[ Index ]

krapohl.info

title

Body

[close]

/ -> pcSmarty.class.php (source)

   1  <?php
   2  /**
   3   *  $Id: pcSmarty.class.php,v 1.1 2004/02/11 17:25:28 larsneo Exp $
   4   *
   5   *  PostCalendar::PostNuke Events Calendar Module
   6   *  Copyright (C) 2002  The PostCalendar Team
   7   *  http://postcalendar.tv
   8   *  
   9   *  This program is free software; you can redistribute it and/or modify
  10   *  it under the terms of the GNU General Public License as published by
  11   *  the Free Software Foundation; either version 2 of the License, or
  12   *  (at your option) any later version.
  13   *  
  14   *  This program is distributed in the hope that it will be useful,
  15   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17   *  GNU General Public License for more details.
  18   *  
  19   *  You should have received a copy of the GNU General Public License
  20   *  along with this program; if not, write to the Free Software
  21   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  22   *
  23   *  To read the license please read the docs/license.txt or visit
  24   *  http://www.gnu.org/copyleft/gpl.html
  25   *
  26   */
  27  class pcSmarty extends Smarty
  28  {
  29      function pcSmarty()
  30      {
  31          $theme = pnUserGetTheme();
  32          $osTheme = pnVarPrepForOS($theme);
  33          pnThemeLoad($theme);
  34          global $bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4,$bgcolor5,$bgcolor6,$textcolor1,$textcolor2;
  35          
  36          // call constructor
  37          $this->Smarty();
  38          
  39          // gather module information
  40          $pcModInfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
  41          $pcDir = pnVarPrepForOS($pcModInfo['directory']);
  42          $pcDisplayName = $pcModInfo['displayname'];
  43          unset($pcModInfo);
  44          
  45          // setup up pcSmarty configs
  46          $this->compile_check    =     true; 
  47          $this->force_compile    =     false;
  48          $this->debugging        =     false;  
  49          $this->template_dir     =   "modules/$pcDir/pntemplates";
  50          array_push($this->plugins_dir,"modules/$pcDir/pnincludes/Smarty/plugins");
  51          array_push($this->plugins_dir,"modules/$pcDir/plugins");
  52          $this->compile_dir      =   "modules/$pcDir/pntemplates/compiled";
  53          $this->cache_dir        =   "modules/$pcDir/pntemplates/cache";
  54          $this->caching          =     _SETTING_USE_CACHE;
  55          $this->cache_lifetime   =   _SETTING_CACHE_LIFETIME;
  56          $this->left_delimiter   =   '[-';
  57          $this->right_delimiter  =   '-]';
  58          
  59          //============================================================
  60          //    checks for safe mode
  61          //    i think it's safe to say we can do this automagically now
  62          //============================================================
  63          $safe_mode      = ini_get('safe_mode');
  64          $safe_mode_gid  = ini_get('safe_mode_gid');
  65          $open_basedir     = ini_get('open_basedir');
  66          
  67          $use_safe_mode = ((bool)$safe_mode || (bool)$safe_mode_gid || !empty($open_basedir));
  68          if($use_safe_mode) {
  69              $this->use_sub_dirs = false;
  70          } else {
  71              $this->use_sub_dirs = true;
  72          }
  73          unset($use_safe_mode,$safe_mode,$safe_mode_gid,$open_basedir);
  74          
  75          $this->autoload_filters = array('output' => array('trimwhitespace'));
  76          
  77          $lang = pnUserGetLang();
  78          $func = pnVarCleanFromInput('func');
  79          $print = pnVarCleanFromInput('print');
  80          // assign theme globals
  81          $this->assign_by_ref('BGCOLOR1',$bgcolor1);
  82          $this->assign_by_ref('BGCOLOR2',$bgcolor2);
  83          $this->assign_by_ref('BGCOLOR3',$bgcolor3);
  84          $this->assign_by_ref('BGCOLOR4',$bgcolor4);
  85          $this->assign_by_ref('BGCOLOR5',$bgcolor5);
  86          $this->assign_by_ref('BGCOLOR6',$bgcolor6);
  87          $this->assign_by_ref('TEXTCOLOR1',$textcolor1);
  88          $this->assign_by_ref('TEXTCOLOR2',$textcolor2);
  89          $this->assign_by_ref('USER_LANG',$lang);
  90          $this->assign_by_ref('FUNCTION',$func);
  91          $this->assign_by_ref('PRINT_VIEW',$print);
  92          $this->assign('USE_POPUPS',_SETTING_USE_POPUPS);
  93          $this->assign('USE_TOPICS',_SETTING_DISPLAY_TOPICS);
  94          $this->assign('USE_INT_DATES',_SETTING_USE_INT_DATES);
  95          $this->assign('OPEN_NEW_WINDOW',_SETTING_OPEN_NEW_WINDOW);
  96          $this->assign('EVENT_DATE_FORMAT',_SETTING_DATE_FORMAT);
  97          $this->assign('HIGHLIGHT_COLOR',_SETTING_DAY_HICOLOR);
  98          $this->assign('24HOUR_TIME',_SETTING_TIME_24HOUR);
  99          $this->assign_by_ref('MODULE_NAME',$pcDisplayName);
 100          $this->assign_by_ref('MODULE_DIR',$pcDir);
 101          $this->assign('ACCESS_NONE',PC_ACCESS_NONE);
 102          $this->assign('ACCESS_OVERVIEW',PC_ACCESS_OVERVIEW);
 103          $this->assign('ACCESS_READ',PC_ACCESS_READ);
 104          $this->assign('ACCESS_COMMENT',PC_ACCESS_COMMENT);
 105          $this->assign('ACCESS_MODERATE',PC_ACCESS_MODERATE);
 106          $this->assign('ACCESS_EDIT',PC_ACCESS_EDIT);
 107          $this->assign('ACCESS_ADD',PC_ACCESS_ADD);
 108          $this->assign('ACCESS_DELETE',PC_ACCESS_DELETE);
 109          $this->assign('ACCESS_ADMIN',PC_ACCESS_ADMIN);
 110          //=================================================================
 111          //  Find out what Template we're using
 112          //=================================================================
 113          $template_name = _SETTING_TEMPLATE;
 114          if(!isset($template_name)) { $template_name = 'default'; }
 115          //=================================================================
 116          //  Find out what Template View to use
 117          //=================================================================
 118          $template_view = pnVarCleanFromInput('tplview');
 119          if(!isset($template_view)) { $template_view = 'default'; }
 120          $this->config_dir = "modules/$pcDir/pntemplates/$template_name/config/";
 121          $this->assign_by_ref('TPL_NAME',$template_name);
 122          $this->assign_by_ref('TPL_VIEW',$template_view);
 123          $this->assign('TPL_IMAGE_PATH',"modules/$pcDir/pntemplates/$template_name/images");
 124          $this->assign('TPL_STYLE_PATH',"modules/$pcDir/pntemplates/$template_name/style");
 125          $this->assign('THEME_PATH',"themes/$osTheme");
 126      }    
 127  }
 128  ?>


Generated: Wed Feb 16 22:40:07 2005 Cross-referenced by PHPXref 0.6