Changeset 2575


Ignore:
Timestamp:
02/03/10 22:29:20 (2 years ago)
Author:
tomdooley
Message:

Sample integration of Smarty in branch. See notes in README_SMARTY.txt

Location:
branches/smarty
Files:
369 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/smarty/gui/include/ispcp-lib.php

    r2568 r2575  
    3232 
    3333function autoload_class($className) { 
    34         require_once(INCLUDEPATH . "/class.$className.php"); 
     34        if (file_exists(INCLUDEPATH . "/class.".$className.".php")) { 
     35                require_once INCLUDEPATH . "/class.".$className.".php"; 
     36        } 
    3537} 
    3638spl_autoload_register('autoload_class'); 
  • branches/smarty/gui/index.php

    r2505 r2575  
    6666        : Config::get('USER_INITIAL_THEME'); 
    6767 
    68 $tpl = new pTemplate(); 
     68$tpl = new smartyTemplate(); 
    6969 
    7070if ((Config::get('MAINTENANCEMODE') 
     
    7373        && !isset($_GET['admin'])) { 
    7474 
    75         $tpl->define_dynamic('page', Config::get('LOGIN_TEMPLATE_PATH') . '/maintenancemode.tpl'); 
     75        $tpl->setTemplate('maintenancemode.tpl'); 
     76 
    7677        $tpl->assign( 
    7778                array( 
     
    8384                ) 
    8485        ); 
    85  
    8686} else { 
    8787 
    88         $tpl->define_dynamic('page', Config::get('LOGIN_TEMPLATE_PATH') . '/index.tpl'); 
     88        $tpl->setTemplate('index.tpl'); 
    8989 
    9090        $tpl->assign( 
     
    115115} 
    116116 
    117 $tpl->define_dynamic('page_message', 'page'); 
    118117gen_page_message($tpl); 
    119118 
    120 $tpl->parse('PAGE', 'page'); 
    121119$tpl->prnt(); 
    122120 
  • branches/smarty/gui/lostpassword.php

    r2505 r2575  
    5858                check_input($_GET['key']); 
    5959 
    60                 $tpl = new pTemplate(); 
    61                 $tpl->define('page', Config::get('LOGIN_TEMPLATE_PATH') . '/lostpassword_message.tpl'); 
     60                $tpl = new smartyTemplate(); 
     61                $tpl->setTemplate('lostpassword_message.tpl'); 
    6262                $tpl->assign( 
    6363                        array( 
     
    8484                } 
    8585 
    86                 $tpl->parse('PAGE', 'page'); 
    8786                $tpl->prnt(); 
    8887 
     
    101100                check_input($_POST['capcode']); 
    102101 
    103                 $tpl = new pTemplate(); 
    104                 $tpl->define('page', Config::get('LOGIN_TEMPLATE_PATH') . '/lostpassword_message.tpl'); 
     102                $tpl = new smartyTemplate(); 
     103                $tpl->setTemplate('lostpassword_message.tpl'); 
    105104                $tpl->assign( 
    106105                        array( 
     
    127126                } 
    128127 
    129                 $tpl->parse('PAGE', 'page'); 
    130128                $tpl->prnt(); 
    131129 
     
    140138is_ipaddr_blocked(null, 'captcha', true); 
    141139 
    142 $tpl = new pTemplate(); 
    143 $tpl->define('page', Config::get('LOGIN_TEMPLATE_PATH') . '/lostpassword.tpl'); 
     140$tpl = new smartyTemplate(); 
     141$tpl->setTemplate('lostpassword.tpl'); 
    144142$tpl->assign( 
    145143        array( 
     
    156154); 
    157155 
    158 $tpl->parse('PAGE', 'page'); 
    159156$tpl->prnt(); 
    160157 
  • branches/smarty/gui/reseller/ticket_create.php

    r2527 r2575  
    3333check_login(__FILE__); 
    3434 
    35 $tpl = new pTemplate(); 
    36 $tpl->define_dynamic('page', Config::get('RESELLER_TEMPLATE_PATH') . '/ticket_create.tpl'); 
    37 $tpl->define_dynamic('page_message', 'page'); 
    38 $tpl->define_dynamic('logged_from', 'page'); 
     35$tpl = new smartyTemplate('reseller'); 
     36$tpl->setTemplate('ticket_create.tpl'); 
    3937 
    4038// page functions. 
     
    123121gen_logged_from($tpl); 
    124122 
    125 $userdata = array('OPT_URGENCY_1'=>'', 'OPT_URGENCY_2'=>'', 'OPT_URGENCY_3'=>'', 'OPT_URGENCY_4'=>''); 
     123$userdata = array( 
     124/* Smarty integration... not needed... 
     125        'OPT_URGENCY_1'=>'', 'OPT_URGENCY_2'=>'', 'OPT_URGENCY_3'=>'', 'OPT_URGENCY_4'=>'' 
     126*/ 
     127); 
    126128if (isset($_POST['urgency'])) { 
    127129        $userdata['URGENCY'] = intval($_POST['urgency']); 
     
    129131        $userdata['URGENCY'] = 2; 
    130132} 
     133/* Smarty integration... not needed... 
     134 
    131135switch ($userdata['URGENCY']) { 
    132136        case 1: 
     
    143147                break; 
    144148} 
    145 $userdata['SUBJECT'] = isset($_POST['subj']) ? clean_input($_POST['subj'], true) : ''; 
    146 $userdata['USER_MESSAGE'] = isset($_POST['user_message']) ? clean_input($_POST['user_message'], true) : ''; 
     149*/ 
     150 
     151// New by Smarty integration: 
     152$userdata['urgency_options'] = array( 
     153        1 => tr('Low'), 
     154        2 => tr('Medium'), 
     155        3 => tr('High'), 
     156        4 => tr('Very high') 
     157); 
     158 
     159// HTML escaping is done by Smarty 
     160$userdata['SUBJECT'] = isset($_POST['subj']) ? clean_input($_POST['subj']) : ''; 
     161$userdata['USER_MESSAGE'] = isset($_POST['user_message']) ? clean_input($_POST['user_message']) : ''; 
    147162$tpl->assign($userdata); 
    148163 
     
    150165        array( 
    151166                'TR_NEW_TICKET' => tr('New ticket'), 
     167/* Smarty integration... not needed here 
    152168                'TR_LOW' => tr('Low'), 
    153169                'TR_MEDIUM' => tr('Medium'), 
    154170                'TR_HIGH' => tr('High'), 
    155171                'TR_VERI_HIGH' => tr('Very high'), 
     172*/ 
    156173                'TR_URGENCY' => tr('Priority'), 
    157174                'TR_EMAIL' => tr('Email'), 
     
    166183gen_page_message($tpl); 
    167184 
    168 $tpl->parse('PAGE', 'page'); 
    169  
    170185$tpl->prnt(); 
    171186 
Note: See TracChangeset for help on using the changeset viewer.