diff --git a/src/messenger/webim/libs/cron.php b/src/messenger/webim/libs/cron.php index cffb3f4d..b886c827 100644 --- a/src/messenger/webim/libs/cron.php +++ b/src/messenger/webim/libs/cron.php @@ -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; +} + ?> \ No newline at end of file diff --git a/src/messenger/webim/operator/settings.php b/src/messenger/webim/operator/settings.php index 4b2761e6..af926216 100644 --- a/src/messenger/webim/operator/settings.php +++ b/src/messenger/webim/operator/settings.php @@ -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'); + ?> \ No newline at end of file