Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace:

Diff

333
 
351
 
351
 
template.php
_> 11 <?php
  22 /*
<> 3 -  $Id: template.php 333 2005-12-07 03:15:13Z hpdl $
   3+  $Id: template.php 351 2005-12-19 11:46:41Z hpdl $
44 
  55   osCommerce, Open Source E-Commerce Solutions
  66   http://www.oscommerce.com
     
 !
2323  * @access private
  2424  */
  2525 
<> 26 -    var $_template = 'default';
   26+    var $_template;
2727 
  2828 /**
<>  29+ * Holds the template ID value
   30+ *
   31+ * @var int
   32+ * @access private
   33+ */
   34+
   35+    var $_template_id;
   36+
   37+/**
2938  * Holds the title of the page module
  3039  *
  3140  * @var string
     
 !
144153     }
  145154 
  146155 /**
<>  156+ * Returns the template ID
   157+ *
   158+ * @access public
   159+ * @return int
   160+ */
   161+
   162+    function getID() {
   163+      if (isset($this->_template) === false) {
   164+        $this->setTemplate();
   165+      }
   166+
   167+      return $this->_template_id;
   168+    }
   169+
   170+/**
147171  * Returns the template name
  148172  *
  149173  * @access public
  150174  * @return string
  151175  */
  152176 
  153177     function getTemplate() {
<>  178+      if (isset($this->_template) === false) {
   179+        $this->setTemplate();
   180+      }
   181+
154182       return $this->_template;
  155183     }
  156184 
     
 !
311339     }
  312340 
  313341 /**
<> 314 - * Sets the name of the template to use
   342+ * Sets the template to use
315343  *
<> 316 - * @param string $template The name of the template to set
317344  * @access public
  318345  */
  319346 
<> 320 -    function setTemplate($template) {
  321 -      $this->_template = $template;
   347+    function setTemplate() {
   348+      global $osC_Database;
   349+
   350+      if ( (isset($_SESSION['template']) === false) || (isset($_GET['template']) && !empty($_GET['template'])) ) {
   351+        $Qtemplates = $osC_Database->query('select id, code from :table_templates');
   352+        $Qtemplates->bindTable(':table_templates', TABLE_TEMPLATES);
   353+        $Qtemplates->setCache('templates');
   354+        $Qtemplates->execute();
   355+
   356+        $template = (isset($_GET['template']) && !empty($_GET['template'])) ? $_GET['template'] : DEFAULT_TEMPLATE;
   357+
   358+        $data = array();
   359+        $data_default = array();
   360+
   361+        while ($Qtemplates->next()) {
   362+          if ($Qtemplates->value('code') == DEFAULT_TEMPLATE) {
   363+            $data_default = array('id' => $Qtemplates->valueInt('id'), 'code' => $Qtemplates->value('code'));
   364+          } elseif ($Qtemplates->value('code') == $template) {
   365+            $data = array('id' => $Qtemplates->valueInt('id'), 'code' => $Qtemplates->value('code'));
   366+          }
   367+        }
   368+
   369+        $Qtemplates->freeResult();
   370+
   371+        if (empty($data)) {
   372+          $data =& $data_default;
   373+        }
   374+
   375+        $_SESSION['template'] =& $data;
   376+      }
   377+
   378+      $this->_template_id =& $_SESSION['template']['id'];
   379+      $this->_template =& $_SESSION['template']['code'];
<_ 322380     }
  323381 
  324382 /**