function r_proc_files($path) { global $eol, $into, $relative, $whitelist; $fd = opendir($path); $to = str_replace($relative, $into, $path); if (!file_exists($to)) { mkdir($to); } // over each zone while (false !== ($file = readdir($fd))) { if (false !== strpos($file, '.')) { continue; } if (is_dir($path . $file)) { if (in_array($file, $whitelist)) { r_proc_files($path . $file . '/'); } else { echo 'Dropped: `' . $file . '` - Not in whitelist' . $eol; } continue; } $tz = new tz_decode2($path . $file); if (!$tz->open()) { die("Count not open file: {$tz->tz_file}\n"); } $tz->exec(); $tz->load_current_offsets(); $code = build_php($tz); file_put_contents($to . $file . '.php', $code); echo 'Proc: ' . $path . $file . $eol; // echo $to . $eol; } closedir($fd); }
function select_timezones($zone) { $out = null; $query = $this->db->query("SELECT zone_id, zone_name, zone_offset, zone_updated, zone_abbrev FROM {$this->pre}timezones ORDER BY zone_name ASC"); while ($row = $this->db->nqfetch($query)) { if ($row['zone_updated'] < $this->time) { include_once 'lib/tz_decode2.php'; $tz = new tz_decode2('timezone/' . $row['zone_name']); $tz->magic2(); if (strlen($tz->abba) < 1) { $tz->abba = 'N/A'; } $this->db->query("UPDATE {$this->pre}timezones SET zone_offset={$tz->gmt_offset}, zone_updated={$tz->next_update}, zone_abbrev='{$tz->abba}' WHERE zone_id={$row['zone_id']};"); $row['zone_abbrev'] = $tz->abba; $row['zone_offset'] = $tz->gmt_offset; } $padding = str_repeat(' ', 30 - strlen($row['zone_name'])); $out .= '<option style=\'font-family: "Courier New", Courier, serif;\' value=' . $row['zone_id'] . ($zone == $row['zone_id'] ? ' selected=\'selected\'' : null) . '>' . $row['zone_name'] . $padding . ' ' . $row['zone_abbrev'] . ' (GMT' . ($row['zone_offset'] >= 0 ? '+' : '') . $row['zone_offset'] / 3600 . ') </option>' . "\n"; } return $out; }
$qsf->user = $qsf->user_cl->login(); $qsf->lang = $qsf->get_lang($qsf->user['user_language'], $qsf->get['a']); $qsf->session['id'] = session_id(); if (!isset($qsf->get['skin'])) { $qsf->skin = $qsf->user['skin_dir']; } else { $qsf->skin = $qsf->get['skin']; } $qsf->perms = new permissions(); $qsf->perms->db =& $qsf->db; $qsf->perms->pre =& $qsf->pre; $qsf->perms->get_perms($qsf->user['user_group'], $qsf->user['user_id'], $qsf->user['user_perms'] ? $qsf->user['user_perms'] : $qsf->user['group_perms']); /* set timezone offset */ if ($qsf->user['zone_updated'] < $qsf->time) { include 'lib/tz_decode2.php'; $tz = new tz_decode2('timezone/' . $qsf->user['zone_name']); $tz->magic2(); if (strlen($tz->abba) < 1) { $tz->abba = 'N/A'; } $qsf->db->query("UPDATE {$qsf->pre}timezones SET zone_offset={$tz->gmt_offset}, zone_updated={$tz->next_update}, zone_abbrev='{$tz->abba}' WHERE zone_id={$qsf->user['zone_id']};"); } else { $qsf->tz_adjust = $qsf->user['zone_offset']; } $qsf->temps = $qsf->get_templates($qsf->get['a']); $qsf->table = eval($qsf->template('MAIN_TABLE')); $qsf->etable = eval($qsf->template('MAIN_ETABLE')); $server_load = $qsf->get_load(); $qsf->tree($qsf->sets['forum_name'], $qsf->self); if ($qsf->is_banned()) { error(QUICKSILVER_NOTICE, $qsf->lang->main_banned);