| 
      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 1789 2012-10-14 10:17:38Z Luisehahne $
 
     | 
  
  
    | 
      13
     | 
    
       * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/templates/index.php $
 
     | 
  
  
    | 
      14
     | 
    
       * @lastmodified    $Date: 2012-10-14 12:17:38 +0200 (Sun, 14 Oct 2012) $
 
     | 
  
  
    | 
      15
     | 
    
       *
 
     | 
  
  
    | 
      16
     | 
    
       */
 
     | 
  
  
    | 
      17
     | 
    
      
 
     | 
  
  
    | 
      18
     | 
    
      // Print admin header
 
     | 
  
  
    | 
      19
     | 
    
      require('../../config.php');
     | 
  
  
    | 
      20
     | 
    
      require_once(WB_PATH.'/framework/class.admin.php');
 
     | 
  
  
    | 
      21
     | 
    
      $admin = new admin('Addons', 'templates');
     | 
  
  
    | 
      22
     | 
    
      
 
     | 
  
  
    | 
      23
     | 
    
      // Setup template object, parse vars to it, then parse it
 
     | 
  
  
    | 
      24
     | 
    
      // Create new template object
 
     | 
  
  
    | 
      25
     | 
    
      $template = new Template(dirname($admin->correct_theme_source('templates.htt')),'keep');
     | 
  
  
    | 
      26
     | 
    
      // $template->debug = true;
 
     | 
  
  
    | 
      27
     | 
    
      $template->set_file('page', 'templates.htt');
     | 
  
  
    | 
      28
     | 
    
      $template->set_block('page', 'main_block', 'main');
     | 
  
  
    | 
      29
     | 
    
      $template->set_var('FTAN', $admin->getFTAN());
     | 
  
  
    | 
      30
     | 
    
      
 
     | 
  
  
    | 
      31
     | 
    
      // Insert values into template list
 
     | 
  
  
    | 
      32
     | 
    
      $template->set_block('main_block', 'template_list_block', 'template_list');
     | 
  
  
    | 
      33
     | 
    
      $sql = 'SELECT `directory`, `name`, `function` FROM `'.TABLE_PREFIX.'addons` '
 
     | 
  
  
    | 
      34
     | 
    
           . 'WHERE `type`=\'template\' ORDER BY `name`';
 
     | 
  
  
    | 
      35
     | 
    
      if(($result = $database->query($sql))) {
     | 
  
  
    | 
      36
     | 
    
      	while($addon = $result->fetchRow(MYSQL_ASSOC))
 
     | 
  
  
    | 
      37
     | 
    
      	{
     | 
  
  
    | 
      38
     | 
    
      		if ($admin->get_permission($addon['directory'],'template')==false) { continue;}
     | 
  
  
    | 
      39
     | 
    
      		$template->set_var('VALUE', $addon['directory']);
     | 
  
  
    | 
      40
     | 
    
      		$template->set_var('NAME', (($addon['function'] == 'theme' ? '[Theme] ' : '').$addon['name']));
     | 
  
  
    | 
      41
     | 
    
      		$template->parse('template_list', 'template_list_block', true);
     | 
  
  
    | 
      42
     | 
    
      	}
 
     | 
  
  
    | 
      43
     | 
    
      }
 
     | 
  
  
    | 
      44
     | 
    
      
 
     | 
  
  
    | 
      45
     | 
    
      // Insert permissions values
 
     | 
  
  
    | 
      46
     | 
    
      if($admin->get_permission('templates_install') != true) {
     | 
  
  
    | 
      47
     | 
    
      	$template->set_var('DISPLAY_INSTALL', 'hide');
     | 
  
  
    | 
      48
     | 
    
      }
 
     | 
  
  
    | 
      49
     | 
    
      if($admin->get_permission('templates_uninstall') != true) {
     | 
  
  
    | 
      50
     | 
    
      	$template->set_var('DISPLAY_UNINSTALL', 'hide');
     | 
  
  
    | 
      51
     | 
    
      }
 
     | 
  
  
    | 
      52
     | 
    
      if($admin->get_permission('templates_view') != true) {
     | 
  
  
    | 
      53
     | 
    
      	$template->set_var('DISPLAY_LIST', 'hide');
     | 
  
  
    | 
      54
     | 
    
      }
 
     | 
  
  
    | 
      55
     | 
    
      
 
     | 
  
  
    | 
      56
     | 
    
      $mLang = ModLanguage::getInstance();
 
     | 
  
  
    | 
      57
     | 
    
      $mLang->setLanguage(ADMIN_PATH.'/addons/languages/', LANGUAGE, DEFAULT_LANGUAGE);
 
     | 
  
  
    | 
      58
     | 
    
      
 
     | 
  
  
    | 
      59
     | 
    
      /*-- insert all needed vars from language files ----------------------------------------*/
 
     | 
  
  
    | 
      60
     | 
    
      $template->set_var($mLang->getLangArray());
 
     | 
  
  
    | 
      61
     | 
    
      
 
     | 
  
  
    | 
      62
     | 
    
      // insert urls
 
     | 
  
  
    | 
      63
     | 
    
      $template->set_var(array(
 
     | 
  
  
    | 
      64
     | 
    
      					'ADMIN_URL' => ADMIN_URL,
 
     | 
  
  
    | 
      65
     | 
    
      					'WB_URL' => WB_URL,
 
     | 
  
  
    | 
      66
     | 
    
      					'THEME_URL' => THEME_URL,
 
     | 
  
  
    | 
      67
     | 
    
      					'FTAN' => $admin->getFTAN()
 
     | 
  
  
    | 
      68
     | 
    
      				)
 
     | 
  
  
    | 
      69
     | 
    
      			);
 
     | 
  
  
    | 
      70
     | 
    
      // Insert language text and messages
 
     | 
  
  
    | 
      71
     | 
    
      $template->set_var(array(
 
     | 
  
  
    | 
      72
     | 
    
      	'URL_MODULES' => $admin->get_permission('modules') ?
     | 
  
  
    | 
      73
     | 
    
      		'<a href="' . ADMIN_URL . '/modules/index.php">' . $mLang->MENU_MODULES . '</a>' : '<b>'.$mLang->MENU_MODULES.'</b>',
 
     | 
  
  
    | 
      74
     | 
    
      	'URL_LANGUAGES' => $admin->get_permission('languages') ?
     | 
  
  
    | 
      75
     | 
    
      		'<a href="' . ADMIN_URL . '/languages/index.php">' . $mLang->MENU_LANGUAGES . '</a>' : '<b>'.$mLang->MENU_LANGUAGES.'</b>',
 
     | 
  
  
    | 
      76
     | 
    
      	'URL_ADVANCED' => $admin->get_permission('modules_advanced')
     | 
  
  
    | 
      77
     | 
    
                      ? '<a href="' . ADMIN_URL . '/addons/index.php?advanced">' . $mLang->TEXT_ADVANCED . '</a>' : '<b>'.$mLang->TEXT_ADVANCED.'</b>' ,
 
     | 
  
  
    | 
      78
     | 
    
      	)
 
     | 
  
  
    | 
      79
     | 
    
      );
 
     | 
  
  
    | 
      80
     | 
    
      
 
     | 
  
  
    | 
      81
     | 
    
      // Parse template object
 
     | 
  
  
    | 
      82
     | 
    
      $template->parse('main', 'main_block', false);
     | 
  
  
    | 
      83
     | 
    
      $template->pparse('output', 'page');
     | 
  
  
    | 
      84
     | 
    
      
 
     | 
  
  
    | 
      85
     | 
    
      // Print admin footer
 
     | 
  
  
    | 
      86
     | 
    
      $admin->print_footer();
 
     |