Example #1
0
    $cfg['defaulticons'] = 'default';
}
if (empty($usr['icons'])) {
    $usr['icons'] = $cfg['defaulticons'];
}
if (file_exists($cfg['icons_dir'] . '/' . $usr['icons'] . '/resources.php')) {
    require_once $cfg['icons_dir'] . '/' . $usr['icons'] . '/resources.php';
} else {
    require_once './images/icons/' . $cfg['defaulticons'] . '/resources.php';
}
$out['copyright'] = "<a href=\"http://www.cotonti.com\">" . $L['foo_poweredby'] . " Cotonti</a>";
/* ======== Various ======== */
$cot_yesno[0] = $L['No'];
$cot_yesno[1] = $L['Yes'];
/* ======== Local/GMT time ======== */
$usr['timetext'] = cot_build_timezone($usr['timezone']);
$usr['gmttime'] = cot_date('datetime_medium', $sys['now'], false) . ' GMT';
$usr['localtime'] = cot_date('datetime_medium', $sys['now']);
/* ======== Anti-XSS protection ======== */
$x = cot_import('x', 'P', 'ALP');
if (empty($x) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $x = cot_import('x', 'G', 'ALP');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && !defined('COT_NO_ANTIXSS') && (!defined('COT_AUTH') && $x != $sys['xk'] && (empty($sys['xk_prev']) || $x != $sys['xk_prev']) || $cfg['referercheck'] && !preg_match('`https?://([^/]+\\.)?' . preg_quote($sys['domain']) . '(/|:|$)`i', $_SERVER['HTTP_REFERER']))) {
    $cot_error = true;
    cot_die_message(950, TRUE, '', '', $_SERVER['HTTP_REFERER']);
}
/* ============ Head Resources ===========*/
if (!COT_AJAX) {
    // May Be move it to header.php?
    if (!isset($cot_rc_html[$theme]) || !$cache || !$cfg['headrc_consolidate'] || defined('COT_ADMIN')) {
Example #2
0
/**
 * Returns a list of timezones sorted by GMT offset.
 *
 * @param bool $withgmt Return 'GMT' as the first option, otherwise it won't be included
 * @param bool $dst Include DST in timezone offsets, if DST is in effect there right now
 * @return array Multidimensional array. Each timezone has the following keys:
 *  'identifier' - PHP timezone name, e.g. "America/El_Salvador"
 *  'offset' - GMT offset in seconds, e.g. -21600
 *  'title' - Localized timezone name, e.g. "America/El Salvador"
 *  'description' - Hourly GMT offset and localized name, e.g. "GMT-06:00 America/El Salvador"
 */
function cot_timezone_list($withgmt = false, $dst = false)
{
    global $Ltz;
    if (!$Ltz) {
        include cot_langfile('countries', 'core');
    }
    static $timezones = array();
    if (!$timezones) {
        $timezonelist = array();
        $regions = array('Africa', 'America', 'Antarctica', 'Asia', 'Atlantic', 'Europe', 'Indian', 'Pacific');
        $identifiers = DateTimeZone::listIdentifiers();
        foreach ($identifiers as $timezone) {
            list($region, $city) = explode('/', $timezone, 2);
            if (!in_array($region, $regions)) {
                continue;
            }
            $offset = cot_timezone_offset($timezone, false, $dst);
            $gmtoffset = cot_build_timezone($offset);
            $title = $Ltz[$timezone] ? $Ltz[$timezone] : $region . '/' . str_replace('_', ' ', $city);
            $timezonelist[] = array('identifier' => $timezone, 'offset' => $offset, 'title' => $title, 'description' => "{$gmtoffset} {$title}");
        }
        foreach ($timezonelist as $k => $tz) {
            $offsets[$k] = $tz['offset'];
            $names[$k] = $tz['name'];
        }
        array_multisort($offsets, SORT_ASC, $names, SORT_ASC, $timezonelist);
        $timezones = $timezonelist;
    }
    return $withgmt ? array_merge(array(array('name' => 'GMT', 'identifier' => 'GMT', 'offset' => 0, 'description' => 'GMT')), $timezones) : $timezones;
}