3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @copyright Intermesh 2003 * @author Merijn Schering <mschering@intermesh.nl> * @version $Revision: 1.54 $ $Date: 2006/11/22 15:09:59 $ * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ require_once("../../netjuris.php"); $GO_SECURITY->authenticate(); $GO_MODULES->authenticate('calendar'); require_once($GO_LANGUAGE->get_language_file('calendar')); load_basic_controls(); load_control('color_selector'); require_once($GO_MODULES->path.'classes/calendar.class.inc'); $cal = new calendar(); $GO_CONFIG->set_help_url($cal_help_url); $date = isset($_REQUEST['date']) ? $_REQUEST['date'] : getdate(); $year = isset($_POST['year']) ? $_POST['year'] : $date["year"]; $month = isset($_POST['month']) ? $_POST['month'] : $date["mon"]; $day = isset($_POST['day']) ? $_POST['day'] : $date["mday"]; $task = isset($_POST['task']) ? $_POST['task'] : ''; $return_to = isset($_REQUEST['return_to']) ? $_REQUEST['return_to'] : $_SERVER['HTTP_REFERER']; $calendar_id = isset($_REQUEST['calendar_id']) ? $_REQUEST['calendar_id'] : 0; $link_back = $_SERVER['PHP_SELF'].'?calendar_id='.$calendar_id.'&return_to='.urlencode($return_to); $hours = array("00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"); switch($task) { case 'import': if (!file_exists($_FILES['ical_file']['tmp_name'])) { $feedback = $cal_no_file; }else { if($cal->import_ical_file($GO_SECURITY->user_id, $_FILES['ical_file']['tmp_name'], $calendar_id)) { $feedback =$cal_import_success; }else { $feedback = $strDataError; } unlink($_FILES['ical_file']['tmp_name']); } break; case 'save': $user_id = (isset($_POST['user_id']) && $_POST['user_id'] > 0) ? $_POST['user_id'] : $GO_SECURITY->user_id; $name = smart_addslashes(trim($_POST['name'])); $public = isset($_POST['public']) ? '1' : '0'; if ($name != "") { if ($calendar_id > 0) { $existing_calendar = $cal->get_calendar_by_name($name); if ($existing_calendar && $existing_calendar['id'] != $calendar_id) { $feedback = $sc_calendar_exists; }else { $calendar = $cal->get_calendar($calendar_id); if($calendar['user_id'] != $user_id) { $GO_SECURITY->chown_acl($calendar['acl_read'], $user_id); $GO_SECURITY->chown_acl($calendar['acl_write'], $user_id); } $cal->update_calendar( $calendar_id, $user_id, $name, smart_addslashes($_POST['calendar_start_hour']), smart_addslashes($_POST['calendar_end_hour']), smart_addslashes($_POST['background']), $public, smart_addslashes($_POST['group_id']), smart_addslashes($_POST['time_interval'])); if ($_POST['close'] == 'true') { header('Location: '.$return_to); exit(); } } }else { if ($cal->get_calendar_by_name($name)) { $feedback = $sc_calendar_exists; }else { if ($calendar_id = $cal->add_calendar($user_id, $name, smart_addslashes($_POST['calendar_start_hour']), smart_addslashes($_POST['calendar_end_hour']), smart_addslashes($_POST['background']), $public, smart_addslashes($_POST['group_id']), smart_addslashes($_POST['time_interval']))) { if ($_POST['close'] == 'true') { header('Location: '.$return_to); exit(); } }else { $feedback = $strSaveError; } } } }else { $feedback = $error_missing_field; } break; } if ($calendar_id > 0) { $calendar = $cal->get_calendar($calendar_id); $title = $calendar['name']; //if(!$GO_SECURITY->has_permission($GO_SECURITY->user_id, $calendar['acl_write'])) if($calendar['user_id']!=$GO_SECURITY->user_id && !$GO_MODULES->write_permission) { header('Location: '.$GO_CONFIG->host.'error_docs/403.php'); exit(); } }else { $calendar['user_id'] = $GO_SECURITY->user_id; $calendar['start_hour'] = isset($_POST['calendar_start_hour']) ? $_POST['calendar_start_hour'] : '07'; $calendar['end_hour'] = isset($_POST['calendar_end_hour']) ? $_POST['calendar_end_hour'] : '20'; $calendar['name'] = isset($_POST['name']) ? smart_stripslashes($_POST['name']) : ''; $calendar['background'] = 'FFFFCC'; $calendar['group_id'] = isset($_REQUEST['group_id']) ? smart_stripslashes($_REQUEST['group_id']) : '1'; $calendar['time_interval'] = isset($_REQUEST['time_interval']) ? smart_stripslashes($_REQUEST['time_interval']) : '1800'; $title = $sc_new_calendar; } $tabstrip = new tabstrip('calendar_strip', $title); $tabstrip->set_attribute('style','width:100%'); $tabstrip->set_return_to(htmlspecialchars($return_to)); if ($calendar_id > 0) { $tabstrip->add_tab('calendar', $strProperties); if($cal->get_backgrounds()) { $tabstrip->add_tab('calendar_backgrounds', $cal_background_colors); } $tabstrip->add_tab('import', $cal_import); $group = $cal->get_group($calendar['group_id']); if($GO_MODULES->write_permission || $GO_SECURITY->has_permission($GO_SECURITY->user_id, $group['acl_write'])) { $tabstrip->add_tab('read_permissions', $strReadRights); $tabstrip->add_tab('write_permissions', $strWriteRights); } } switch ($tabstrip->get_active_tab_id()) { case 'calendar_backgrounds': load_control('datatable'); $GO_HEADER['head'] = datatable::get_header(); break; case 'calendar': $GO_HEADER['head'] = color_selector::get_header(); $GO_HEADER['body_arguments'] = 'onload="javascript:document.calendar_form.name.focus();"'; break; case '': $GO_HEADER['head'] = color_selector::get_header(); $GO_HEADER['body_arguments'] = 'onload="javascript:document.calendar_form.name.focus();"'; break; } require_once($GO_THEME->theme_path.'header.inc'); $form = new form('calendar_form'); $form->set_attribute('enctype','multipart/form-data'); $form->add_html_element(new input('hidden', 'calendar_id',$calendar_id,false)); $form->add_html_element(new input('hidden', 'task','',false)); $form->add_html_element(new input('hidden', 'close','false',false)); $form->add_html_element(new input('hidden', 'return_to',$return_to,false)); switch($tabstrip->get_active_tab_id()) { case 'read_permissions': $tabstrip->innerHTML .= get_acl($calendar['acl_read']); $tabstrip->add_html_element(new button($cmdClose,"javascript:document.location='".htmlspecialchars($return_to)."'")); break; case 'write_permissions': $tabstrip->innerHTML .= get_acl($calendar['acl_write']); $tabstrip->add_html_element(new button($cmdClose,"javascript:document.location='".htmlspecialchars($return_to)."'")); break; case 'import': require_once('import.inc'); break; case 'calendar_backgrounds': $datatable = new datatable('calendar_backgrounds'); if($datatable->task=='delete') { foreach($datatable->selected as $calendar_background_id) { $cal->delete_calendar_background($calendar_background_id); } } $menu = new button_menu(); $menu->add_button('add', $cmdAdd, 'calendar_background.php?calendar_id='.$calendar_id.'&return_to='.urlencode($link_back)); $menu->add_button('delete_big', $cmdDelete, $datatable->get_delete_handler()); $form->add_html_element($menu); $th =new table_heading($strName); $th->set_attribute('colspan','2'); $datatable->add_column($th); $datatable->add_column(new table_heading($cal_weekday)); $datatable->add_column(new table_heading($sc_start_time)); $datatable->add_column(new table_heading($sc_end_time)); if($cal->get_calendar_backgrounds($calendar_id)) { while($cal->next_record()) { $row = new table_row($cal->f('id')); $row->set_attribute('ondblclick', "javascript:document.location='calendar_background.php?calendar_background_id=".$cal->f('id')."&return_to=".urlencode($link_back)."';"); $div = new html_element('div', ''); $div->set_attribute('style','margin:2px;width:8px;height:8px;border:1px solid black;background-color:#'.$cal->f('color')); $cell = new table_cell($div->get_html()); $cell->set_attribute('style','width:8px;'); $row->add_cell($cell); $row->add_cell(new table_cell($cal->f('name'))); $row->add_cell(new table_cell($full_days[$cal->f('weekday')])); $row->add_cell(new table_cell(gmdate($_SESSION['GO_SESSION']['time_format'], $cal->f('start_time')))); $row->add_cell(new table_cell(gmdate($_SESSION['GO_SESSION']['time_format'], $cal->f('end_time')))); $datatable->add_row($row); } }else { $row = new table_row(); $cell = new table_cell($strNoItems); $cell->set_attribute('colspan','99'); $row->add_cell($cell); $datatable->add_row($row); } $tabstrip->add_html_element($datatable); break; default: if(isset($feedback)) { $p = new html_element('p',$feedback); $p->set_attribute('class','Error'); $tabstrip->add_html_element($p); } $table = new table(); if($GO_SECURITY->has_admin_permission($GO_SECURITY->user_id)) { load_control('user_autocomplete'); $user_autocomplete=new user_autocomplete('user_id',$calendar['user_id'],'0',$link_back); $row = new table_row(); $row->add_cell(new table_cell($strOwner.':')); $row->add_cell(new table_cell($user_autocomplete->get_html())); $table->add_row($row); }else { $form->add_html_element(new input('hidden', 'user_id', $calendar['user_id'])); } if($calendar['group_id'] == 0) { $form->add_html_element(new input('hidden','group_id','0')); }else { $row = new table_row(); $row->add_cell(new table_cell($cal_group.': ')); $select = new select('group_id', $calendar['group_id']); $cal->get_writable_resource_groups($GO_SECURITY->user_id); while($cal->next_record()) { $select->add_value($cal->f('id'), $cal->f('name')); } if(!$select->is_in_select($calendar['group_id']) && $resource_group=$cal->get_group($calendar['group_id'])) { $select->add_value($resource_group['id'], $resource_group['name']); } $row->add_cell(new table_cell($select->get_html())); $table->add_row($row); } $row = new table_row(); $row->add_cell(new table_cell($strName.'*: ')); $input = new input('text', 'name',$calendar['name']); $input->set_attribute('maxlength','100'); $input->set_attribute('style', 'width:300px'); $row->add_cell(new table_cell($input->get_html())); $table->add_row($row); $row = new table_row(); $row->add_cell(new table_cell($sc_show_hours.': ')); $select1 = new select('calendar_start_hour', $calendar['start_hour']); $select1->add_arrays($hours, $hours); $select2 = new select('calendar_end_hour', $calendar['end_hour']); $select2->add_arrays($hours, $hours); $row->add_cell(new table_cell($select1->get_html().$sc_to.$select2->get_html())); $table->add_row($row); $row = new table_row(); $row->add_cell(new table_cell($cal_scale.': ')); $select = new select('time_interval', $calendar['time_interval']); $select->add_value('900', '15 '.$sc_mins); $select->add_value('1800', '30 '.$sc_mins); $select->add_value('3600', '1 '.$sc_hour); $row->add_cell(new table_cell($select->get_html())); $table->add_row($row); $row = new table_row(); $row->add_cell(new table_cell($sc_background.': ')); $color_selector = new color_selector('background','background', $calendar['background'], 'calendar_form'); $row->add_cell(new table_cell($color_selector->get_html())); $table->add_row($row); if(file_exists('public.php')) { $row = new table_row(); $row->add_cell(new table_cell($cal_public_calendar.': ')); $checkbox = new checkbox('public','public','1', '', $calendar['public']); $row->add_cell(new table_cell($checkbox->get_html())); $table->add_row($row); $row = new table_row(); $row->add_cell(new table_cell($cal_public_url.': ')); $link = new hyperlink($GO_MODULES->modules['calendar']['full_url'].'public.php?calendar_id='.$calendar_id, $GO_MODULES->modules['calendar']['full_url'].'public.php?calendar_id='.$calendar_id); $link->set_attribute('class','normal'); $link->set_attribute('target','_blank'); $row->add_cell(new table_cell($link->get_html())); $table->add_row($row); } $tabstrip->add_html_element($table); $tabstrip->add_html_element(new button($cmdOk,"javascript:document.forms[0].close.value='true';document.forms[0].task.value='save';document.forms[0].submit()")); $tabstrip->add_html_element(new button($cmdApply,"javascript:document.forms[0].task.value='save';document.forms[0].submit()")); if ($calendar_id > 0) { $tabstrip->add_html_element(new button($cal_export, "document.location='export.php?calendar_id=$calendar_id';")); } $tabstrip->add_html_element(new button($cmdClose,"javascript:document.location='".htmlspecialchars($return_to)."'")); break; } $form->add_html_element($tabstrip); echo $form->get_html(); ?> <script type="text/javascript" language="javascript"> <!-- function upload() { document.forms[0].task.value="import"; var status = null; if (status = get_object("status")) { status.innerHTML = "<?php echo $cal_please_wait; ?>"; } document.forms[0].submit(); } --> </script> <?php require_once($GO_THEME->theme_path.'footer.inc');

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.40.0130.01019.04
8.3.30.0120.00319.34
8.3.20.0030.00520.60
8.3.10.0080.00022.15
8.3.00.0030.00619.38
8.2.170.0180.00419.34
8.2.160.0060.01522.96
8.2.150.0050.00324.18
8.2.140.0030.00624.66
8.2.130.0030.00526.16
8.2.120.0050.00319.23
8.2.110.0090.00019.49
8.2.100.0060.00617.88
8.2.90.0030.00619.30
8.2.80.0090.00017.97
8.2.70.0030.00618.00
8.2.60.0030.00618.05
8.2.50.0090.00018.07
8.2.40.0060.00320.07
8.2.30.0080.00018.52
8.2.20.0040.00418.11
8.2.10.0030.00618.28
8.2.00.0030.00518.05
8.1.270.0060.00319.16
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00322.42
8.1.230.0040.00818.16
8.1.220.0000.00817.91
8.1.210.0060.00318.77
8.1.200.0030.00717.60
8.1.190.0040.00417.38
8.1.180.0030.00618.10
8.1.170.0000.00819.03
8.1.160.0030.00522.34
8.1.150.0030.00619.18
8.1.140.0030.00617.63
8.1.130.0000.00818.07
8.1.120.0100.00017.70
8.1.110.0000.00817.71
8.1.100.0000.00817.66
8.1.90.0080.00017.59
8.1.80.0050.00317.71
8.1.70.0040.00417.68
8.1.60.0130.00017.82
8.1.50.0090.00017.83
8.1.40.0000.00817.71
8.1.30.0060.00317.95
8.1.20.0000.00917.97
8.1.10.0000.00917.89
8.1.00.0070.00417.73
8.0.300.0040.00418.77
8.0.290.0030.00617.25
8.0.280.0060.00318.82
8.0.270.0000.00817.74
8.0.260.0030.00617.64
8.0.250.0000.00817.30
8.0.240.0000.00817.36
8.0.230.0040.00417.34
8.0.220.0030.00617.27
8.0.210.0060.00317.28
8.0.200.0040.00417.30
8.0.190.0030.00617.41
8.0.180.0040.00417.35
8.0.170.0000.00817.30
8.0.160.0030.00617.36
8.0.150.0000.00817.30
8.0.140.0030.00617.19
8.0.130.0060.00413.79
8.0.120.0040.00417.32
8.0.110.0000.00817.20
8.0.100.0040.00417.39
8.0.90.0080.00017.12
8.0.80.0130.00317.39
8.0.70.0080.00017.44
8.0.60.0000.00817.29
8.0.50.0050.00317.18
8.0.30.0200.00917.40
8.0.20.0100.00917.41
8.0.10.0030.00517.22
8.0.00.0090.01017.19
7.4.330.0030.00315.10
7.4.320.0050.00316.86
7.4.300.0040.00416.71
7.4.290.0040.00416.86
7.4.280.0060.00316.95
7.4.270.0050.00216.93
7.4.260.0040.00416.87
7.4.250.0040.00416.70
7.4.240.0000.00816.92
7.4.230.0030.00516.73
7.4.220.0150.00816.83
7.4.210.0030.01416.75
7.4.200.0000.00716.89
7.4.160.0040.01416.95
7.4.150.0140.00617.40
7.4.140.0100.01017.86
7.4.130.0090.01516.77
7.4.120.0120.00616.76
7.4.110.0130.00616.80
7.4.100.0130.00616.71
7.4.90.0060.01216.74
7.4.80.0170.01119.39
7.4.70.0040.01416.92
7.4.60.0150.00316.75
7.4.50.0030.00616.89
7.4.40.0130.00316.67
7.4.30.0100.01016.76
7.4.00.0000.01314.91
7.3.330.0030.00313.42
7.3.320.0110.00313.46
7.3.310.0000.00716.63
7.3.300.0070.00016.40
7.3.290.0090.00516.63
7.3.280.0080.00916.54
7.3.270.0060.01317.40
7.3.260.0070.01116.57
7.3.250.0150.00416.62
7.3.240.0090.00916.56
7.3.230.0160.00916.59
7.3.210.0120.00616.55
7.3.200.0080.00819.39
7.3.190.0050.01116.64
7.3.180.0070.01116.54
7.3.170.0130.01016.59
7.3.160.0160.00716.57
7.2.330.0110.00816.61
7.2.320.0090.00916.79
7.2.310.0060.01216.60
7.2.300.0190.00316.77
7.2.290.0150.00316.70
7.2.60.0070.00716.86
7.2.00.0060.00619.42
7.1.200.0080.00415.67
7.1.100.0030.00817.77
7.1.70.0060.00317.06
7.1.60.0000.01719.50
7.1.50.0100.01616.80
7.1.00.0000.08022.45
7.0.200.0100.00715.17
7.0.140.0000.07021.95
7.0.100.0070.03720.27
7.0.90.0100.03720.16
7.0.80.0030.03320.17
7.0.70.0030.04020.16
7.0.60.0170.04020.24
7.0.50.0000.07320.54
7.0.40.0070.05320.15
7.0.30.0030.06720.05
7.0.20.0030.05020.15
7.0.10.0100.07320.17
7.0.00.0100.05020.14
5.6.280.0070.07321.34
5.6.250.0030.04020.71
5.6.240.0070.04320.93
5.6.230.0030.04020.88
5.6.220.0000.04320.77
5.6.210.0030.04020.68
5.6.200.0030.05321.17
5.6.190.0070.03721.23
5.6.180.0100.08021.27
5.6.170.0030.04021.38
5.6.160.0130.07721.35
5.6.150.0070.04321.14
5.6.140.0200.07021.32
5.6.130.0030.08321.36
5.6.120.0100.05021.14
5.6.110.0070.07721.21
5.6.100.0170.06321.14
5.6.90.0070.05321.21
5.6.80.0030.07720.73
5.6.70.0100.04720.63
5.6.60.0070.04020.59
5.6.50.0030.05020.68
5.6.40.0130.07320.64
5.6.30.0030.07320.53
5.6.20.0070.04320.62
5.6.10.0070.06320.59
5.6.00.0100.07020.57
5.5.380.0000.04720.66
5.5.370.0030.04320.72
5.5.360.0100.03720.77
5.5.350.0000.03720.67
5.5.340.0070.03321.12
5.5.330.0070.06021.09
5.5.320.0070.07321.01
5.5.310.0030.04021.02
5.5.300.0130.08021.04
5.5.290.0130.03321.14
5.5.280.0030.05721.13
5.5.270.0070.04720.96
5.5.260.0170.06321.03
5.5.250.0100.07320.94
5.5.240.0130.03320.51
5.5.230.0100.08320.32
5.5.220.0070.05020.45
5.5.210.0130.06320.43
5.5.200.0130.06720.48
5.5.190.0070.04720.44
5.5.180.0130.06720.48
5.5.160.0070.06320.36
5.5.150.0200.05020.46
5.5.140.0100.07320.48
5.5.130.0030.06320.36
5.5.120.0100.07320.41
5.5.110.0030.06020.34
5.5.100.0100.07020.32
5.5.90.0000.08020.33
5.5.80.0030.03720.27
5.5.70.0000.05720.26
5.5.60.0030.08020.11
5.5.50.0030.05020.36
5.5.40.0170.03320.26
5.5.30.0000.07020.24
5.5.20.0100.04020.29
5.5.10.0170.04020.29
5.5.00.0070.06020.25
5.4.450.0000.06719.55
5.4.440.0130.07719.47
5.4.430.0070.08319.58
5.4.420.0100.07319.41
5.4.410.0030.07319.40
5.4.400.0070.07319.19
5.4.390.0100.07719.10
5.4.380.0100.07718.96
5.4.370.0130.06319.19
5.4.360.0100.05719.04
5.4.350.0100.06718.97
5.4.340.0130.03719.11
5.4.320.0030.04019.11
5.4.310.0130.03019.29
5.4.300.0030.08019.09
5.4.290.0130.03718.92
5.4.280.0070.05019.04
5.4.270.0030.07319.04
5.4.260.0100.07019.11
5.4.250.0130.07019.18
5.4.240.0130.06019.25
5.4.230.0130.05719.14
5.4.220.0130.06719.09
5.4.210.0070.07019.09
5.4.200.0030.08019.25
5.4.190.0030.07319.28
5.4.180.0070.04319.18
5.4.170.0100.03319.03
5.4.160.0100.06719.21
5.4.150.0100.04719.02
5.4.140.0070.04316.55
5.4.130.0100.06316.29
5.4.120.0030.05316.57
5.4.110.0070.05716.36
5.4.100.0130.06716.46
5.4.90.0100.06016.44
5.4.80.0070.04016.44
5.4.70.0130.05016.40
5.4.60.0030.06716.61
5.4.50.0100.05016.48
5.4.40.0100.05016.43
5.4.30.0030.08016.39
5.4.20.0030.05316.39
5.4.10.0130.04316.60
5.4.00.0030.04315.98

preferences:
38.21 ms | 400 KiB | 5 Q