Académique Documents
Professionnel Documents
Culture Documents
php
/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 5.0.5 - Licence Number VBFZ48KZZQ
|| # ---------------------------------------------------------------- # ||
|| # Copyright 2000-2013 vBulletin Solutions Inc. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/
// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// ##################### DEFINE IMPORTANT CONSTANTS #######################
define('CVS_REVISION', '$RCSfile$ - $Revision: 74677 $');
// #################### PRE-CACHE TEMPLATES AND DATA ######################
global $phrasegroups, $specialtemplates, $vbphrase, $vbulletin;
$phrasegroups = array('cron');
$specialtemplates = array();
// ########################## REQUIRE BACK-END ############################
require_once(dirname(__FILE__) . '/global.php');
// ######################## CHECK ADMIN PERMISSIONS #######################
if (is_demo_mode() OR !can_administer('canadmincron'))
{
print_cp_no_permission();
}
// ############################# LOG ACTION ###############################
$vbulletin->input->clean_array_gpc('r', array(
'cronid' => vB_Cleaner::TYPE_INT
));
log_admin_action(iif($vbulletin->GPC['cronid'] != 0, 'cron id = ' . $vbulletin->
GPC['cronid']));
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
$vb5_config =& vB::getConfig();
print_cp_header($vbphrase['scheduled_task_manager_gcron']);
if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = 'modify';
}
// ############## quick enabled/disabled status ################
if ($_POST['do'] == 'updateenabled')
{
$vbulletin->input->clean_gpc('p', 'enabled', vB_Cleaner::TYPE_ARRAY_BOOL
);
$updates = array();
//$crons_result = $vbulletin->db->query_read("SELECT varname, active FRO
}
// ###################### Start edit #######################
if ($_REQUEST['do'] == 'edit')
{
$vbulletin->input->clean_array_gpc('r', array(
'cronid' => vB_Cleaner::TYPE_INT
));
print_form_header('cronadmin', 'update');
if (!empty($vbulletin->GPC['cronid']))
{
$cron = vB_Api::instanceInternal('cron')->fetchById($vbulletin->
GPC['cronid']);
print_table_header(construct_phrase($vbphrase['x_y_id_z'], $vbph
rase['scheduled_task'], htmlspecialchars_uni($cron['title']), $cron['cronid']));
construct_hidden_code('cronid' , $cron['cronid']);
print_label_row($vbphrase['varname'], $cron['varname']);
}
else
{
$cron = array(
'cronid' => 0,
'weekday' => -1,
'day'
=> -1,
'hour'
=> -1,
'minute' => array (0 => -1),
'filename' => './includes/cron/.php',
'loglevel' => 0,
'active' => 1,
'volatile' => ($vb5_config['Misc']['debug'] ? 1 : 0),
'product' => 'vbulletin'
);
print_table_header($vbphrase['add_new_scheduled_task_gcron']);
print_input_row($vbphrase['varname'], 'varname');
}
$weekdays = array(-1 => '*', 0 => $vbphrase['sunday'], $vbphrase['monday
'], $vbphrase['tuesday'], $vbphrase['wednesday'], $vbphrase['thursday'], $vbphra
se['friday'], $vbphrase['saturday']);
$hours = array(-1 => '*', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23);
$days = array(-1 => '*', 1 => 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31);
$minutes = array(-1 => '*');
for ($x = 0; $x < 60; $x++)
{
$minutes[] = $x;
}
if ($cron['cronid'])
{
$trans_link = "phrase.php?" . vB::getCurrentSession()->get('sess
ionurl') . "do=edit&fieldname=cron&t=1&varname="; // has varname appended
if (!$cron['volatile'] OR $vb5_config['Misc']['debug'])
{
// non volatile or in debug mode -- always editable (cus
tom created)
'day'
'month'
'weekday'
=> $cron['day'],
=> -1,
=> $cron['weekday']
);
// set '-1' fields as
foreach ($t AS $field => $value)
{
$t["$field"] = iif($value == -1, '*', $value);
}
if (is_numeric($cron['minute']))
{
$cron['minute'] = array(0 => $cron['minute']);
}
else
{
$cron['minute'] = unserialize($cron['minute']);
if (!is_array($cron['minute']))
{
$cron['minute'] = array(-1);
}
}
if ($cron['minute'][0] == -1)
{
$t['minute'] = '*';
}
else
{
$minutes = array();
foreach ($cron['minute'] AS $nextminute)
{
$minutes[] = str_pad(intval($nextminute), 2, 0,
STR_PAD_LEFT);
}
$t['minute'] = implode(', ', $minutes);
}
// set weekday to override day of month if necessary
$days = array('sunday', 'monday', 'tuesday', 'wednesday', 'thurs
day', 'friday', 'saturday');
if ($t['weekday'] != '*')
{
$day = $days[intval($t['weekday'])];
$t['weekday'] = $vbphrase[$day . "_abbr_gcron"];
$t['day'] = '*';
}
return $t;
}
?>
<script type="text/javascript">
<!-function js_cron_jump(cronid)
{
task = eval("document.cpform.c" + cronid + ".options[document.cp
form.c" + cronid + ".selectedIndex].value");
switch (task)
{
case 'edit': window.location = "cronadmin.php?<?php echo
vB::getCurrentSession()->get('sessionurl_js'); ?>do=edit&cronid=" + cronid; bre
ak;
case 'kill': window.location = "cronadmin.php?<?php echo
vB::getCurrentSession()->get('sessionurl_js'); ?>do=remove&cronid=" + cronid; b
reak;
case 'switchactive': window.location = "cronadmin.php?<?
php echo vB::getCurrentSession()->get('sessionurl_js'); ?>do=switchactive&cronid
=" + cronid + "&hash=<?php echo CP_SESSIONHASH; ?>"; break;
default: return false; break;
}
}
function js_run_cron(cronid)
{
window.location = "<?php echo "cronadmin.php?" . vB::getCurrentS
ession()->get('sessionurl_js') . "do=runcron&cronid="; ?>" + cronid;
}
//-->
</script>
<?php
print_form_header('cronadmin', 'updateenabled');
print_table_header($vbphrase['scheduled_task_manager_gcron'], 9);
print_cells_row(array(
'',
$vbphrase['min_abbr'],
$vbphrase['hour_abbr'],
$vbphrase['day_abbr'],
$vbphrase['month_abbr'],
$vbphrase['dow_acronym'],
$vbphrase['title'],
$vbphrase['next_time'],
$vbphrase['controls']
), 1, '', 1);
foreach ($crons as $cron)
{
$options = array(
'edit' => $vbphrase['edit'],
'switchactive' => ($cron['effective_active'] ? $vbphrase
['disable'] : $vbphrase['enable'])
);
if (!$cron['volatile'] OR $vb5_config['Misc']['debug'])
{
$options['kill'] = $vbphrase['delete'];
}
$item_title = htmlspecialchars_uni($vbphrase['task_' . $cron['va
rname'] . '_title']);
if (isset($vbphrase['task_' . $cron['varname'] . '_title']))
{
$item_title = htmlspecialchars_uni($vbphrase['task_' . $
cron['varname'] . '_title']);
}
else
{
$item_title = $cron['varname'];
}
if (!$cron['effective_active'])
{
$item_title = "<strike>$item_title</strike>";
}
$item_desc = htmlspecialchars_uni($vbphrase['task_' . $cron['var
name'] . '_desc']);
$timerule = fetch_cron_timerule($cron);
// this will happen in the future which the yestoday setting doe
sn't handle when its in the detailed mode
$future = ($cron['nextrun'] > TIMENOW AND $vbulletin->options['y
estoday'] == 2);
$cell = array(
"<input type=\"checkbox\" name=\"enabled[$cron[varname]]
\" value=\"1\" title=\"$vbphrase[enabled]\" id=\"cb_enabled_$cron[varname]\" tab
index=\"1\"" . ($cron['active'] ? ' checked="checked"' : '') . " />",
$timerule['minute'],
$timerule['hour'],
$timerule['day'],
$timerule['month'],
$timerule['weekday'],
"<label for=\"cb_enabled_$cron[varname]\"><strong>$item_
title</strong><br /><span class=\"smallfont\">$item_desc</span></label>",
'<div style="white-space:nowrap">' . ($cron['effective_a
ctive'] ? vbdate($vbulletin->options['dateformat'], $cron['nextrun'], (true AND
!$future)) . (($vbulletin->options['yestoday'] != 2 OR $future) ? '<br />' . vbd
ate($vbulletin->options['timeformat'], $cron['nextrun']) : '') : $vbphrase['n_a'
]) . '</div>',
"\n\t<select name=\"c$cron[cronid]\" onchange=\"js_cron_
jump($cron[cronid]);\" class=\"bginput\">\n" . construct_select_options($options
) . "\t</select><input type=\"button\" class=\"button\" value=\"$vbphrase[go]\"
onclick=\"js_cron_jump($cron[cronid]);\" />\n\t" .
"\n\t<input type=\"button\" class=\"button\" value=\"$vb
phrase[run_now]\" onclick=\"js_run_cron($cron[cronid]);\" />"
);
print_cells_row($cell, 0, '', -6);
}
print_description_row("<div class=\"smallfont\" align=\"center\">$vbphra
se[all_times_are_gmt_x_time_now_is_y]</div>", 0, 9, 'thead');
print_submit_row($vbphrase['save_enabled_status'], 0, 9, '', "<input typ
e=\"button\" class=\"button\" value=\"$vbphrase[add_new_scheduled_task_gcron]\"
tabindex=\"1\" onclick=\"window.location='cronadmin.php?" . vB::getCurrentSessio
n()->get('sessionurl') . "do=edit'\" />");
}
print_cp_footer();
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 12:34, Sat Sep 28th 2013
|| # CVS: $RCSfile$ - $Revision: 74677 $
|| ####################################################################
\*======================================================================*/
?>