Create cron_get_uri function

This commit is contained in:
Dmitriy Simushev 2013-04-30 13:39:49 +00:00
parent ff3bfa545f
commit 8914f01b3b
2 changed files with 24 additions and 7 deletions

View File

@ -202,4 +202,25 @@ function cron_index_messages() {
$db->query('COMMIT');
}
/**
* Generates cron URI
*
* @global string $webimroot Path of the mibew instalation from server root.
* It defined in libs/config.php
* @param string $cron_key Cron security key
* @return string Cron URI
*/
function cron_get_uri($cron_key) {
global $webimroot;
$path = (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off')
? 'http://'
: 'https://';
$path .= $_SERVER['SERVER_NAME'] . $webimroot . '/cron.php';
$path .= empty($cron_key)
? ''
: '?cron_key='.$cron_key;
return $path;
}
?>

View File

@ -19,6 +19,7 @@ require_once('../libs/init.php');
require_once('../libs/operator.php');
require_once('../libs/settings.php');
require_once('../libs/styles.php');
require_once('../libs/cron.php');
$operator = check_login();
force_password($operator);
@ -109,13 +110,7 @@ $page['stored'] = isset($_GET['stored']);
$page['enabletracking'] = Settings::get('enabletracking');
$page['formcronkey'] = $params['cron_key'];
$page['cron_path'] = (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off')
? 'http://'
: 'https://';
$page['cron_path'] .= $_SERVER['SERVER_NAME'] . $webimroot . '/cron.php';
$page['cron_path'] .= empty($params['cron_key'])
? ''
: '?cron_key='.$params['cron_key'];
$page['cron_path'] = cron_get_uri($params['cron_key']);
if (Settings::get('enabletracking')) {
$page['forminvitationstyle'] = $params['invitationstyle'];
@ -126,4 +121,5 @@ prepare_menu($operator);
setup_settings_tabs(0);
start_html_output();
require('../view/settings.php');
?>