Example #1
0
     break;
 case 'mailto':
     // nothing to do
     break;
 case 'redirect':
     require SM_PATH . 'functions/auth.php';
     //nobreak;
 //nobreak;
 case 'login':
     require SM_PATH . 'functions/display_messages.php';
     require SM_PATH . 'functions/page_header.php';
     require SM_PATH . 'functions/html.php';
     // reset template file cache
     //
     $sTemplateID = Template::get_default_template_set();
     Template::cache_template_file_hierarchy($sTemplateID, TRUE);
     /**
      * Make sure icon variables are setup for the login page.
      */
     $icon_theme = $icon_themes[$icon_theme_def]['PATH'];
     /*
      * NOTE: The $icon_theme_path var should contain the path to the icon
      *       theme to use.  If the admin has disabled icons, or the user has
      *       set the icon theme to "None," no icons will be used.
      */
     $icon_theme_path = !$use_icons || $icon_theme == 'none' ? NULL : ($icon_theme == 'template' ? SM_PATH . Template::calculate_template_images_directory($sTemplateID) : $icon_theme);
     break;
 default:
     require SM_PATH . 'functions/display_messages.php';
     require SM_PATH . 'functions/page_header.php';
     require SM_PATH . 'functions/html.php';
Example #2
0
 /**
  * Set up internal attributes
  *
  * This method does most of the work for setting up
  * newly constructed objects.
  *
  * @param string $template_set_id the template ID
  *
  */
 function set_up_template($template_set_id)
 {
     // FIXME: do we want to place any restrictions on the ID like
     //        making sure no slashes included?
     // get template ID
     //
     $this->template_set_id = $template_set_id;
     $this->fallback_template_set_id = Template::get_fallback_template_set();
     // set up template directories
     //
     $this->template_dir = Template::calculate_template_file_directory($this->template_set_id);
     $this->fallback_template_dir = Template::calculate_template_file_directory($this->fallback_template_set_id);
     // determine content type, defaulting to text/html
     //
     $this->content_type = Template::get_template_config($this->template_set_id, 'content_type', 'text/html');
     // determine template engine
     // FIXME: assuming PHP template engine may not necessarily be a good thing
     //
     $this->template_engine = Template::get_template_config($this->template_set_id, 'template_engine', SQ_PHP_TEMPLATE);
     // get template file cache
     //
     $this->template_file_cache = Template::cache_template_file_hierarchy($template_set_id);
 }
Example #3
0
/**
 * This function saves a new template setting.
 * It updates the template array.
 */
function save_option_template($option)
{
    global $aTemplateSet;
    /* Do checking to make sure new template is in the available templates array. */
    $templateset_in_array = false;
    for ($i = 0; $i < count($aTemplateSet); ++$i) {
        if ($aTemplateSet[$i]['ID'] == $option->new_value) {
            $templateset_in_array = true;
            break;
        }
    }
    if (!$templateset_in_array) {
        $option->new_value = '';
    } else {
        // clear template cache when changing template sets
        // (in order to do so, we have to change the global
        // template set ID now... should not be a problem --
        // in fact, if we don't do it now, very anomalous
        // problems occur)
        //
        global $sTemplateID;
        $sTemplateID = $option->new_value;
        Template::cache_template_file_hierarchy($sTemplateID, TRUE);
    }
    /**
     * TODO: If the template changes and we are using a template provided theme
     * ($user_theme), do we want to reset $user_theme?
     */
    /* Save the option like normal. */
    save_option($option);
}