| 1 | <?php
 | 
  
    | 2 | /**
 | 
  
    | 3 |  *
 | 
  
    | 4 |  * @category        admin
 | 
  
    | 5 |  * @package         templates
 | 
  
    | 6 |  * @author          Ryan Djurovich, WebsiteBaker Project
 | 
  
    | 7 |  * @copyright       2009-2012, WebsiteBaker Org. e.V.
 | 
  
    | 8 |  * @link			http://www.websitebaker2.org/
 | 
  
    | 9 |  * @license         http://www.gnu.org/licenses/gpl.html
 | 
  
    | 10 |  * @platform        WebsiteBaker 2.8.x
 | 
  
    | 11 |  * @requirements    PHP 5.2.2 and higher
 | 
  
    | 12 |  * @version         $Id: index.php 2098 2014-02-11 01:37:03Z darkviper $
 | 
  
    | 13 |  * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/templates/index.php $
 | 
  
    | 14 |  * @lastmodified    $Date: 2014-02-11 02:37:03 +0100 (Tue, 11 Feb 2014) $
 | 
  
    | 15 |  *
 | 
  
    | 16 |  */
 | 
  
    | 17 | 
 | 
  
    | 18 | // Print admin header
 | 
  
    | 19 | require('../../config.php');
 | 
  
    | 20 | $oDb = WbDatabase::getInstance();
 | 
  
    | 21 | $oTrans = Translate::getInstance();
 | 
  
    | 22 | $oTrans->enableAddon('admin\\addons');
 | 
  
    | 23 | $admin = new admin('Addons', 'templates');
 | 
  
    | 24 | 
 | 
  
    | 25 | // Setup template object, parse vars to it, then parse it
 | 
  
    | 26 | // Create new template object
 | 
  
    | 27 | $template = new Template(dirname($admin->correct_theme_source('templates.htt')),'keep');
 | 
  
    | 28 | // $template->debug = true;
 | 
  
    | 29 | $template->set_file('page', 'templates.htt');
 | 
  
    | 30 | $template->set_block('page', 'main_block', 'main');
 | 
  
    | 31 | $template->set_var('FTAN', $admin->getFTAN());
 | 
  
    | 32 | /*-- insert all needed vars from language files ----------------------------------------*/
 | 
  
    | 33 | $template->set_var($oTrans->getLangArray());
 | 
  
    | 34 | 
 | 
  
    | 35 | // Insert values into template list
 | 
  
    | 36 | $template->set_block('main_block', 'template_list_block', 'template_list');
 | 
  
    | 37 | $sql = 'SELECT `directory`, `name`, `function` FROM `'.$oDb->TablePrefix.'addons` '
 | 
  
    | 38 |      . 'WHERE `type`=\'template\' ORDER BY `name`';
 | 
  
    | 39 | if (($result = $oDb->doQuery($sql))) {
 | 
  
    | 40 | 	while ($addon = $result->fetchRow(MYSQL_ASSOC)) {
 | 
  
    | 41 | 		if ($admin->get_permission($addon['directory'],'template')==false) { continue;}
 | 
  
    | 42 | 		$template->set_var('VALUE', $addon['directory']);
 | 
  
    | 43 | 		$template->set_var('NAME', (($addon['function'] == 'theme' ? '[Theme] ' : '').$addon['name']));
 | 
  
    | 44 | 		$template->parse('template_list', 'template_list_block', true);
 | 
  
    | 45 | 	}
 | 
  
    | 46 | }
 | 
  
    | 47 | 
 | 
  
    | 48 | // Insert permissions values
 | 
  
    | 49 | if($admin->get_permission('templates_install') != true) {
 | 
  
    | 50 | 	$template->set_var('DISPLAY_INSTALL', 'hide');
 | 
  
    | 51 | }
 | 
  
    | 52 | if($admin->get_permission('templates_uninstall') != true) {
 | 
  
    | 53 | 	$template->set_var('DISPLAY_UNINSTALL', 'hide');
 | 
  
    | 54 | }
 | 
  
    | 55 | if($admin->get_permission('templates_view') != true) {
 | 
  
    | 56 | 	$template->set_var('DISPLAY_LIST', 'hide');
 | 
  
    | 57 | }
 | 
  
    | 58 | 
 | 
  
    | 59 | // insert urls
 | 
  
    | 60 | $template->set_var(array(
 | 
  
    | 61 | 					'ADMIN_URL' => ADMIN_URL,
 | 
  
    | 62 | 					'WB_URL' => WB_URL,
 | 
  
    | 63 | 					'THEME_URL' => THEME_URL,
 | 
  
    | 64 | 					'FTAN' => $admin->getFTAN()
 | 
  
    | 65 | 				)
 | 
  
    | 66 | 			);
 | 
  
    | 67 | // Insert language text and messages
 | 
  
    | 68 | $template->set_var(array(
 | 
  
    | 69 | 	'URL_MODULES' => $admin->get_permission('modules') ?
 | 
  
    | 70 | 		'<a href="' . ADMIN_URL . '/modules/index.php">' . $oTrans->MENU_MODULES . '</a>' : '<b>'.$oTrans->MENU_MODULES.'</b>',
 | 
  
    | 71 | 	'URL_LANGUAGES' => $admin->get_permission('languages') ?
 | 
  
    | 72 | 		'<a href="' . ADMIN_URL . '/languages/index.php">' . $oTrans->MENU_LANGUAGES . '</a>' : '<b>'.$oTrans->MENU_LANGUAGES.'</b>',
 | 
  
    | 73 | 	'URL_ADVANCED' => $admin->get_permission('modules_advanced')
 | 
  
    | 74 |                 ? '<a href="' . ADMIN_URL . '/addons/index.php?advanced">' . $oTrans->TEXT_ADVANCED . '</a>' : '<b>'.$oTrans->TEXT_ADVANCED.'</b>' ,
 | 
  
    | 75 | 	)
 | 
  
    | 76 | );
 | 
  
    | 77 | 
 | 
  
    | 78 | // Parse template object
 | 
  
    | 79 | $template->parse('main', 'main_block', false);
 | 
  
    | 80 | $template->pparse('output', 'page');
 | 
  
    | 81 | 
 | 
  
    | 82 | $oTrans->disableAddon();
 | 
  
    | 83 | // Print admin footer
 | 
  
    | 84 | $admin->print_footer();
 |