3v4l.org

run code in 300+ PHP versions simultaneously
<?php require_once(WCF_DIR.'lib/system/event/EventListener.class.php'); /** * Loads thank'o'mat data for the Threadpage. * * @author Christian "Plunts" Grubert * @copyright 2010 Duetschi Kreativagentur * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> * @package de.wbb3mods.wbb.thankbot */ class ThreadPageThankBotListener implements EventListener { /** * @see EventListener::execute() * @param ThreadPage $eventObj */ public function execute($eventObj, $className, $eventName) { if (empty($eventObj->postList->postIDs)) return; $thankdata = array(); $thankedFor = array(); $sql = "SELECT * FROM wbb".WBB_N."_thank_guests WHERE postID IN (".$eventObj->postList->postIDs.")"; $result = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result)) { if (isset($thankdata[$row['postID']]['guests'])) $thankdata[$row['postID']]['guests']++; else $thankdata[$row['postID']]['guests'] = 1; } //$canUseOnlineMarking = version_compare(PACKAGE_VERSION, '3.1.0') >= 0; $sql = "SELECT thank_user.*, user.username" . ($canUseOnlineMarking ? ", g.userOnlineMarking usernameStyle" : "") . " FROM wbb" . WBB_N . "_thank_user thank_user LEFT JOIN wcf" . WCF_N . "_user user USING (userID) " . ($canUseOnlineMarking ? "LEFT JOIN wcf" . WCF_N . "_group g ON (user.userOnlineGroupID = g.groupID)" : "") . " WHERE thank_user.postID IN (" . $eventObj->postList->postIDs . ") ORDER BY " . THANKS_SORT; $result = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result)) { if ($row['username'] == null) { if (isset($thankdata[$row['postID']]['guests'])) $thankdata[$row['postID']]['guests']++; else $thankdata[$row['postID']]['guests'] = 1; } else { if ($canUseOnlineMarking && !empty($row['usernameStyle']) && $row['usernameStyle'] != '%s') { $styledUsername = sprintf($row['usernameStyle'], StringUtil::encodeHTML($row['username'])); } else { $styledUsername = StringUtil::encodeHTML($row['username']); } $thankdata[$row['postID']]['users'][$row['userID']] = array('userID' => $row['userID'], 'username' => $row['username'], 'styledUsername' => $styledUsername, 'time' => $row['time']); } } if ($eventObj->board->getPermission('canThank') && !WCF::getSession()->spiderID) { $sql = "SELECT post.postID, post.userID, GROUP_CONCAT(DISTINCT thank_user.userID) AS userIDs, GROUP_CONCAT(DISTINCT thank_guests.iphash) AS iphashes FROM wbb".WBB_N."_post post LEFT JOIN wbb".WBB_N."_thank_user thank_user ON (post.postID=thank_user.postID) LEFT JOIN wbb".WBB_N."_thank_guests thank_guests ON (post.postID=thank_guests.postID AND thank_guests.time > ".(TIME_NOW-86400).") WHERE post.postID IN (".$eventObj->postList->postIDs.") AND post.hasThank = 1 GROUP BY post.postID ORDER BY post.time"; $result = WCF::getDB()->sendQuery($sql); $additionalSmallButtons = WCF::getTPL()->get('additionalSmallButtons'); $showLargeThankLink = array(); while ($row = WCF::getDB()->fetchArray($result)) { $row['userIDs'] = explode(',', $row['userIDs']); if ($row['userIDs'][0] == '') $row['userIDs'] = array(); $row['iphashes'] = explode(',', $row['iphashes']); if ($row['iphashes'][0] == '') $row['iphashes'] = array(); if ($row['userID'] != WCF::getUser()->userID) { // @todo autor = gast und user = gast sollte auch gehen $hasThanked = (in_array(WCF::getUser()->userID, $row['userIDs']) || in_array(sha1(UserUtil::getIpAddress()), $row['iphashes'])); WCF::getTPL()->assign(array( 'postID' => $row['postID'], 'hasThanked' => $hasThanked )); if (THANKS_BIGBUTTON && $row['postID'] == $eventObj->thread->firstPostID) { WCF::getTPL()->append('additionalLargeButtons', WCF::getTPL()->fetch('threadThankButton')); } elseif (THANKS_LINKPOS == 1) { $thankedFor[$row['postID']] = $hasThanked; } else { if (!isset($additionalSmallButtons[$row['postID']])) $additionalSmallButtons[$row['postID']] = ''; $additionalSmallButtons[$row['postID']] .= WCF::getTPL()->fetch('postThankButton'); } } } WCF::getTPL()->assign('additionalSmallButtons', $additionalSmallButtons); } if (THANKS_SHOWCOUNT) { $additionalSidebarUserCredits = WCF::getTPL()->get('additionalSidebarUserCredits'); foreach ($eventObj->sidebarFactory->messageSidebars AS $sidebar) { if (!isset($additionalSidebarUserCredits[$sidebar->getMessageID()])) $additionalSidebarUserCredits[$sidebar->getMessageID()] = ''; WCF::getTPL()->assign(array( 'thanks_got' => $sidebar->getUser()->thanks_got, 'thanks_given' => $sidebar->getUser()->thanks_given, 'userID' => $sidebar->getUser()->userID, 'postID' => $sidebar->getMessageID() )); $additionalSidebarUserCredits[$sidebar->getMessageID()] .= WCF::getTPL()->fetch('postThankCredits'); } WCF::getTPL()->assign('additionalSidebarUserCredits', $additionalSidebarUserCredits); } $additionalMessageFooter = WCF::getTPL()->get('additionalMessageFooter'); foreach ($eventObj->postList->posts AS $key=>$post) { if ($post->hasThank) { WCF::getTPL()->assign(array( 'postID' => $post->postID, 'postThanks' => isset($thankdata[$post->postID]) ? $thankdata[$post->postID] : null, 'isAuthor' => $post->userID == WCF::getUser()->userID && $post->userID != 0, 'hasThanked' => isset($thankedFor[$post->postID]) ? $thankedFor[$post->postID] : false )); $template = WCF::getTPL()->fetch('postThankStats'); if (!isset($additionalMessageFooter[$post->postID])) { $additionalMessageFooter[$post->postID] = $template; } else { $additionalMessageFooter[$post->postID] .= $template; } } } WCF::getTPL()->assign('additionalMessageFooter', $additionalMessageFooter); WCF::getTPL()->append('specialStyles', "\n".'<script src="' . RELATIVE_WBB_DIR . 'js/ThankOmat.class.js" type="text/javascript"></script>'."\n"); } private function isAuthor(Post $post) { if (WCF::getUser()->userID == 0) { return (UserUtil::getIpAddress() == $post->ipAddress && $post->userID == 0 && $post->time > TIME_NOW-86400); } else { return (WCF::getUser()->userID == $post->userID); } } } ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.60.0100.00718.30
8.3.50.0120.00922.90
8.3.40.0120.00319.02
8.3.30.0090.00619.24
8.3.20.0030.00520.35
8.3.10.0040.00423.65
8.3.00.0060.00319.38
8.2.180.0120.00618.66
8.2.170.0110.00422.96
8.2.160.0040.01120.38
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0030.00526.16
8.2.120.0090.00021.01
8.2.110.0030.00622.11
8.2.100.0060.00618.22
8.2.90.0040.00419.30
8.2.80.0030.00517.97
8.2.70.0030.00617.75
8.2.60.0000.00818.05
8.2.50.0160.00018.07
8.2.40.0000.00818.28
8.2.30.0040.00418.13
8.2.20.0030.00517.81
8.2.10.0040.00418.07
8.2.00.0000.00917.94
8.1.280.0040.01125.92
8.1.270.0080.00024.02
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0100.00023.82
8.1.230.0080.00419.22
8.1.220.0080.00017.74
8.1.210.0000.00818.77
8.1.200.0030.00717.47
8.1.190.0040.00417.35
8.1.180.0030.00518.10
8.1.170.0070.00418.78
8.1.160.0040.00422.03
8.1.150.0000.00818.82
8.1.140.0040.00417.45
8.1.130.0000.00817.86
8.1.120.0030.00517.48
8.1.110.0000.00717.43
8.1.100.0000.00717.47
8.1.90.0040.00417.57
8.1.80.0000.00817.49
8.1.70.0070.00017.44
8.1.60.0060.00317.54
8.1.50.0060.00317.50
8.1.40.0030.00517.48
8.1.30.0040.00417.54
8.1.20.0030.00517.70
8.1.10.0000.00917.66
8.1.00.0090.00017.60
8.0.300.0000.00718.77
8.0.290.0090.00016.88
8.0.280.0070.00018.48
8.0.270.0000.00717.39
8.0.260.0030.00317.31
8.0.250.0030.00317.16
8.0.240.0030.00317.20
8.0.230.0040.00317.14
8.0.220.0070.00016.99
8.0.210.0000.00717.15
8.0.200.0030.00317.04
8.0.190.0030.00517.16
8.0.180.0130.00017.13
8.0.170.0040.00417.01
8.0.160.0000.00716.93
8.0.150.0000.01117.03
8.0.140.0000.00816.94
8.0.130.0030.00313.61
8.0.120.0030.00517.07
8.0.110.0040.00416.98
8.0.100.0040.00417.08
8.0.90.0050.00217.05
8.0.80.0030.01317.09
8.0.70.0040.00417.08
8.0.60.0040.00417.07
8.0.50.0040.00416.94
8.0.30.0110.01017.19
8.0.20.0120.01117.40
8.0.10.0040.00417.10
8.0.00.0140.00916.86
7.4.330.0030.00315.14
7.4.320.0000.00716.73
7.4.300.0030.00316.80
7.4.290.0000.00716.74
7.4.280.0030.00716.79
7.4.270.0030.00616.81
7.4.260.0070.00316.64
7.4.250.0000.00816.70
7.4.240.0010.00616.75
7.4.230.0070.00016.79
7.4.220.0060.01116.81
7.4.210.0060.01016.79
7.4.200.0030.00516.68
7.4.160.0160.00316.65
7.4.150.0110.00917.40
7.4.140.0170.01517.86
7.4.130.0100.00716.74
7.4.120.0140.00316.61
7.4.110.0090.00916.66
7.4.100.0090.00916.67
7.4.90.0120.00616.74
7.4.80.0160.00619.39
7.4.70.0130.01016.77
7.4.60.0060.01216.58
7.4.50.0050.00316.55
7.4.40.0120.00416.73
7.4.30.0120.00616.64
7.4.10.0030.01315.11
7.4.00.0050.01215.05
7.3.330.0030.00313.34
7.3.320.0030.00313.48
7.3.310.0000.00716.62
7.3.300.0000.00816.55
7.3.290.0080.00716.45
7.3.280.0120.00816.55
7.3.270.0120.00917.40
7.3.260.0120.00616.46
7.3.250.0070.01216.53
7.3.240.0120.00616.47
7.3.230.0120.00916.72
7.3.210.0140.00516.74
7.3.200.0190.00019.39
7.3.190.0110.01016.40
7.3.180.0070.01316.56
7.3.170.0070.01016.53
7.3.160.0160.00316.45
7.3.130.0160.00315.04
7.3.120.0070.00714.91
7.3.110.0100.00715.03
7.3.100.0040.00714.93
7.3.90.0030.01215.05
7.3.80.0040.00814.79
7.3.70.0040.01214.76
7.3.60.0070.00714.66
7.3.50.0030.00714.86
7.3.40.0070.00715.01
7.3.30.0060.00314.81
7.3.20.0080.00316.63
7.3.10.0030.01016.77
7.3.00.0080.00616.53
7.2.330.0090.00916.62
7.2.320.0030.01316.67
7.2.310.0070.01116.56
7.2.300.0080.00816.52
7.2.290.0120.00616.86
7.2.260.0110.00715.05
7.2.250.0070.01014.71
7.2.240.0040.01415.26
7.2.230.0070.00715.24
7.2.220.0060.00615.28
7.2.210.0000.01315.25
7.2.200.0140.00415.19
7.2.190.0100.00314.98
7.2.180.0030.01314.73
7.2.170.0040.01115.07
7.2.160.0000.00915.11
7.2.150.0040.01116.91
7.2.140.0040.01116.63
7.2.130.0060.01016.67
7.2.120.0070.00716.79
7.2.110.0070.00716.72
7.2.100.0080.00716.78
7.2.90.0040.00916.73
7.2.80.0040.00816.81
7.2.70.0040.01116.70
7.2.60.0110.00316.76
7.2.50.0060.00716.89
7.2.40.0040.01016.78
7.2.30.0030.00816.89
7.2.20.0050.00716.71
7.2.10.0060.00716.72
7.2.00.0030.01017.51
7.1.330.0060.00615.57
7.1.320.0090.00615.81
7.1.310.0030.01015.41
7.1.300.0000.01415.68
7.1.290.0030.01315.40
7.1.280.0080.00015.63
7.1.270.0030.00915.61
7.1.260.0070.00715.79
7.1.250.0040.01015.54
7.1.240.0060.00715.66
7.1.230.0040.01015.63
7.1.220.0020.00815.62
7.1.210.0030.01015.72
7.1.200.0040.00715.52
7.1.190.0070.00715.56
7.1.180.0080.00515.72
7.1.170.0060.00615.64
7.1.160.0040.00715.62
7.1.150.0070.00415.63
7.1.140.0040.00815.75
7.1.130.0020.01115.79
7.1.120.0050.00815.60
7.1.110.0040.01115.55
7.1.100.0050.00615.60
7.1.90.0040.01115.60
7.1.80.0080.00515.73
7.1.70.0060.00716.05
7.1.60.0050.00716.02
7.1.50.0050.00915.87
7.1.40.0070.00615.79
7.1.30.0060.00715.62
7.1.20.0100.00215.42
7.1.10.0050.00615.76
7.1.00.0060.02217.43
7.0.330.0060.00615.06
7.0.320.0040.00815.16
7.0.310.0060.00615.22
7.0.300.0050.01115.20
7.0.290.0080.00515.31
7.0.280.0050.00815.36
7.0.270.0060.00615.35
7.0.260.0050.00615.18
7.0.250.0040.01015.33
7.0.240.0070.00715.33
7.0.230.0040.00815.27
7.0.220.0050.00715.37
7.0.210.0050.00915.22
7.0.200.0060.00615.66
7.0.190.0040.00915.50
7.0.180.0050.00715.30
7.0.170.0070.00715.24
7.0.160.0080.00415.26
7.0.150.0030.00915.18
7.0.140.0050.02416.98
7.0.130.0050.00715.42
7.0.120.0050.00715.26
7.0.110.0060.00515.38
7.0.100.0030.02616.38
7.0.90.0070.02616.48
7.0.80.0060.01616.40
7.0.70.0110.02216.63
7.0.60.0050.02516.40
7.0.50.0060.02616.63
7.0.40.0060.01915.04
7.0.30.0080.02314.98
7.0.20.0030.02714.88
7.0.10.0090.02315.02
7.0.00.0070.02214.84
5.6.400.0030.00614.33
5.6.390.0060.00614.27
5.6.380.0030.00714.25
5.6.370.0020.01014.36
5.6.360.0100.00514.37
5.6.350.0050.00714.44
5.6.340.0040.00914.33
5.6.330.0060.00814.38
5.6.320.0020.01114.13
5.6.310.0070.00614.18
5.6.300.0080.00414.34
5.6.290.0060.00614.32
5.6.280.0020.02816.05
5.6.270.0020.01014.32
5.6.260.0010.01114.51
5.6.250.0070.02016.00
5.6.240.0090.02315.83
5.6.230.0070.02115.82
5.6.220.0070.02415.82
5.6.210.0060.02516.00
5.6.200.0050.02616.01
5.6.190.0070.01616.10
5.6.180.0040.02216.06
5.6.170.0090.02315.98
5.6.160.0070.02516.08
5.6.150.0050.02416.03
5.6.140.0050.02915.97
5.6.130.0080.01316.00
5.6.120.0020.02815.84
5.6.110.0030.02216.10
5.6.100.0090.01816.05
5.6.90.0090.02315.92
5.6.80.0060.01815.77
5.6.70.0040.01715.71
5.6.60.0100.02215.77
5.6.50.0050.02215.80
5.6.40.0050.02615.74
5.6.30.0060.02615.83
5.6.20.0080.02615.70
5.6.10.0090.01715.68
5.6.00.0070.02715.85
5.5.380.0060.02214.68
5.5.370.0050.02014.74
5.5.360.0050.02514.59
5.5.350.0070.01614.70
5.5.340.0020.02514.76
5.5.330.0080.02114.81
5.5.320.0060.02514.71
5.5.310.0080.01914.76
5.5.300.0120.01914.74
5.5.290.0040.02714.77
5.5.280.0040.02514.67
5.5.270.0090.02014.81
5.5.260.0060.02614.66
5.5.250.0070.02414.64
5.5.240.0120.01514.56
5.5.230.0030.01714.61
5.5.220.0060.02314.56
5.5.210.0060.02214.56
5.5.200.0060.01814.63
5.5.190.0070.02014.63
5.5.180.0080.02214.54
5.5.170.0060.00512.74
5.5.160.0040.02614.51
5.5.150.0030.02514.53
5.5.140.0050.02514.54
5.5.130.0090.02214.51
5.5.120.0060.02414.50
5.5.110.0040.02514.61
5.5.100.0110.01814.52
5.5.90.0100.02114.43
5.5.80.0090.01714.60
5.5.70.0040.02614.53
5.5.60.0040.02514.59
5.5.50.0070.02314.43
5.5.40.0110.01914.47
5.5.30.0090.02514.46
5.5.20.0050.02414.61
5.5.10.0070.02514.46
5.5.00.0030.02514.52
5.4.450.0050.02313.54
5.4.440.0090.01813.56
5.4.430.0040.02613.57
5.4.420.0030.02513.49
5.4.410.0070.02313.49
5.4.400.0040.01513.43
5.4.390.0050.02513.43
5.4.380.0040.02313.44
5.4.370.0070.02213.40
5.4.360.0030.02813.41
5.4.350.0080.02013.43
5.4.340.0040.02313.45
5.4.330.0020.00611.59
5.4.320.0060.02213.50
5.4.310.0050.02013.37
5.4.300.0030.01913.41
5.4.290.0060.02313.41
5.4.280.0040.02913.44
5.4.270.0040.01613.46
5.4.260.0070.01313.46
5.4.250.0040.01713.47
5.4.240.0090.01913.44
5.4.230.0060.02213.46
5.4.220.0040.01713.47
5.4.210.0070.01813.44
5.4.200.0080.02113.41
5.4.190.0030.02713.42
5.4.180.0050.02313.39
5.4.170.0050.01313.41
5.4.160.0050.02013.40
5.4.150.0030.02813.42
5.4.140.0050.01712.77
5.4.130.0050.02412.76
5.4.120.0020.02512.77
5.4.110.0060.01612.80
5.4.100.0060.01512.80
5.4.90.0030.02612.78
5.4.80.0040.01512.82
5.4.70.0060.02112.81
5.4.60.0060.01812.79
5.4.50.0080.01912.79
5.4.40.0060.01712.74
5.4.30.0060.01812.82
5.4.20.0050.02112.75
5.4.10.0040.02212.80
5.4.00.0020.02212.66

preferences:
40.96 ms | 401 KiB | 5 Q