<?php

/* Artists use this script to control general site settings.
 */
/*****
 * Setup
 */
require_once 'panl.init.php';
require_once 'lib/htmLawed.php';
$view = new GrlxView();
$link = new GrlxLinkStyle();
$form = new GrlxForm();
$form->send_to($_SERVER['SCRIPT_NAME']);
$form->row_class('config');
$sl = new GrlxSelectList();
$view->yah = 12;
$date_list[] = array('id' => 'm/d/y', 'title' => '10/31/15');
$date_list[] = array('id' => 'm-d-Y', 'title' => '10-31-2015');
$date_list[] = array('id' => 'd-M-Y', 'title' => '31-Oct-2015');
$date_list[] = array('id' => 'F j, Y', 'title' => 'October 31, 2015');
$date_list[] = array('id' => 'j F Y', 'title' => '31 October 2015');
$timezone_master_list['America/Los_Angeles'] = array('id' => 'America/Los_Angeles', 'title' => 'UTC−08:00: San Francisco, Vancouver, Tijuana');
$timezone_master_list['America/Denver'] = array('id' => 'America/Denver', 'title' => 'UTC−07:00: Denver, Phoenix, Calgary, Ciudad Juárez');
$timezone_master_list['America/Chicago'] = array('id' => 'America/Chicago', 'title' => 'UTC−06:00: Chicago, Guatemala City, Mexico City, San José, San Salvador, Tegucigalpa, Winnipeg');
$timezone_master_list['America/New_York'] = array('id' => 'America/New_York', 'title' => 'UTC−05:00: New York, Lima, Toronto, Bogotá, Havana, Kingston');
$timezone_master_list['America/Caracas'] = array('id' => 'America/Caracas', 'title' => 'UTC−04:30: Caracas');
$timezone_master_list['America/Santiago'] = array('id' => 'America/Santiago', 'title' => 'UTC−04:00: Santiago, La Paz, San Juan de Puerto Rico, Manaus, Halifax');
$timezone_master_list['America/Argentina/Buenos_Aires'] = array('id' => 'America/Argentina/Buenos_Aires', 'title' => 'UTC−03:00: Buenos Aires, Montevideo, São Paulo');
$timezone_master_list['America/Canada/Newfoundland'] = array('id' => 'America/Canada/Newfoundland', 'title' => 'UTC−03:30: St. John’s');
$timezone_master_list['Europe/Lisbon'] = array('id' => 'Europe/Lisbon', 'title' => 'UTC±00:00: Accra, Abidjan, Casablanca, Dakar, Dublin, Lisbon, London');
$timezone_master_list['Europe/Berlin'] = array('id' => 'Europe/Berlin', 'title' => 'UTC+01:00: Belgrade, Berlin, Brussels, Lagos, Madrid, Paris, Rome, Tunis, Vienna, Warsaw');
}
// Next we want to find all patterns that seem to match this page’s XML format.
// Heck, just get ’em all to start.
$pattern_option_list = $fileops->get_dir_list('../' . DIR_PATTERNS);
// Now go through them and remove those that do *not* match the page’s XML format.
if ($pattern_option_list && $xml_format) {
    foreach ($pattern_option_list as $id => $filename) {
        // The first part of a pattern file’s name is its XML format (a.k.a. “HILT” combo). Compare that
        // to the page’s XML format.
        $this_pattern = explode('.', $filename);
        if ($this_pattern[0] != $xml_format) {
            unset($pattern_option_list[$id]);
        }
    }
}
$form->row_class('widelabel');
// If anything’s left over, loop through and make radio buttons
// to let the artist choose among the appropriate pattern files.
if ($pattern_option_list && $static_xml) {
    $i = 0;
    $page_pattern = $static_xml->getValue('/options/pattern');
    $page_layout = $static_xml->getValue('/options/layout');
    $function = $static_xml->getValue('/options/function');
    $pattern_select_output = '<ul class="block-grid-small-12">';
    foreach ($pattern_option_list as $this_pattern) {
        $i++;
        $this_pattern = explode('.', $this_pattern);
        $parts = $this_pattern[0];
        $pattern = $this_pattern[1];
        $ext = $this_pattern[2];
        // Ignore the images. Look to the PHP files.