function run_self_tests() { global $MYSITE; global $LAST_UPDATED, $sqlite, $mirror_stats, $md5_ok; //$MYSITE = "http://sg.php.net/"; $content = fetch_contents($MYSITE . "manual/noalias.txt"); if (is_array($content) || trim($content) !== 'manual-noalias') { return array("name" => "Apache manual alias", "see" => $MYSITE . "mirroring-troubles.php#manual-redirect", "got" => $content); } $ctype = fetch_header($MYSITE . "manual/en/faq.html.php", "content-type"); if (strpos($ctype, "text/html") === false) { return array("name" => "Header weirdness. Pages named '.html.php' are returning wrong status headers", "see" => $MYSITE . "mirroring-troubles.php#content-type", "got" => var_export($ctype, true)); } $ctype = fetch_header($MYSITE . "functions", "content-type"); if (is_array($ctype)) { $ctype = current($ctype); } if (strpos($ctype, "text/html") === false) { return array("name" => "MultiViews on", "see" => $MYSITE . "mirroring-troubles.php#multiviews", "got" => var_export($ctype, true)); } $header = fetch_header($MYSITE . "manual/en/ref.var.php", 0); list($ver, $status, $msg) = explode(" ", $header, 3); if ($status != 200) { return array("name" => "Var Handler", "see" => $MYSITE . "mirroring-troubles.php#var", "got" => var_export($header, true)); } return array("servername" => $MYSITE, "version" => phpversion(), "updated" => $LAST_UPDATED, "sqlite" => $sqlite, "stats" => $mirror_stats, "language" => default_language(), "rsync" => $md5_ok); }
?> </p> <?php } ?> </li> </ul> <?php } ?> <h2>Mirror Services</h2> <ul> <li>Default language is <?php echo $LANGUAGES[default_language()]; ?> </li> <li>Local visitor statistics are <?php echo have_stats() ? "available" : "not available"; ?> </li> </ul> <h2>Mirror Status</h2> <ul> <li>The site was last updated at <?php echo strftime("%c %Z", $LAST_UPDATED); ?> </li>
<h2>Preferred language</h2> <p> If you use a shortcut or search for a function, the language used is determined by checking for the following settings. The list is in priority order, the first is the most important. Normally you don't need to set your preferred language, as your last seen language is always remembered, and is a good estimate on your preferred language most of the time. </p> <div class="indent"> <table border="0" cellpadding="3" cellspacing="2" class="standard"> <?php // Data for the language settings table $langinfo = array("Your preferred language" => $langpref, "Last seen language" => isset($_COOKIE['LAST_LANG']) ? htmlentities($_COOKIE['LAST_LANG'], ENT_QUOTES | ENT_IGNORE, 'UTF-8') : "None", "Your Accept-Language browser setting" => isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? htmlentities($_SERVER['HTTP_ACCEPT_LANGUAGE'], ENT_QUOTES | ENT_IGNORE, 'UTF-8') : "None", "The mirror's default language" => default_language(), "Default" => "en"); // Write a row for all settings foreach ($langinfo as $lin => $lid) { echo " <tr>\n <td class=\"sub\">" . $lin . "</td>\n"; echo " <td>" . $lid . "</td>\n </tr>\n"; } ?> </table> </div> <p> These settings are only overridden in case you have passed a language setting URL parameter or POST data to a page or you are viewing a manual page in a particular language. In these cases, the explicit specification overrides the language selected from the above list. </p>
protected function _initialize($data) { // Init the template language $this->lang = $GLOBALS['language']; // Set our template paths and all that if the we dont have one if ($this->template['path'] == NULL) { $this->set_template_path(); } // Load the template information if ($this->xml == NULL) { $this->load_template_xml(); } // Load template helpers if required if (isset($this->xml->helpers)) { foreach ($this->xml->helpers->children() as $helper) { $this->load->helper($helper); } } // Set our layout/view language $supported = explode(',', $this->xml->config->languages); if (!in_array($this->lang, $supported)) { $default = default_language(); $this->lang = in_array($default, $supported) ? $default : $supported[0]; } // Add session data to our data array $data['session']['user'] = $this->load->library('User')->data; // Add the config... $configs = load_class('Config')->get_all('App'); if (isset($data['config'])) { $data['config'] = array_merge($configs, $data['config']); } else { $data['config'] = $configs; } // Add the passed variables to the template variables list foreach ($data as $key => $value) { $this->set($key, $value); } unset($data); // Set all the template data LAST! Also squeeze the site url in there $this->set('BASE_URL', BASE_URL); $this->set('SITE_URL', SITE_URL); $this->set('TEMPLATE_URL', $this->template['http_path']); $this->set('TEMPLATE_PATH', $this->template['path']); $this->set('TEMPLATE_NAME', $this->xml->info->name); $this->set('TEMPLATE_AUTHOR', $this->xml->info->author); $this->set('TEMPLATE_CODED_BY', $this->xml->info->coded_by); $this->set('TEMPLATE_COPYRIGHT', $this->xml->info->copyright); // we are done return; }