| 
      1
     | 
    
      <?php
 
     | 
  
  
    | 
      2
     | 
    
      /**
 
     | 
  
  
    | 
      3
     | 
    
       *
 
     | 
  
  
    | 
      4
     | 
    
       * @category        admin
 
     | 
  
  
    | 
      5
     | 
    
       * @package         templates
 
     | 
  
  
    | 
      6
     | 
    
       * @author          Ryan Djurovich, WebsiteBaker Project
 
     | 
  
  
    | 
      7
     | 
    
       * @copyright       2009-2011, Website Baker 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 1643 2012-03-22 15:30:03Z darkviper $
 
     | 
  
  
    | 
      13
     | 
    
       * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/templates/index.php $
 
     | 
  
  
    | 
      14
     | 
    
       * @lastmodified    $Date: 2012-03-22 16:30:03 +0100 (Thu, 22 Mar 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')));
     | 
  
  
    | 
      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
     | 
    
      		$template->set_var('VALUE', $addon['directory']);
     | 
  
  
    | 
      38
     | 
    
      		$template->set_var('NAME', (($addon['function'] == 'theme' ? '[Theme] ' : '').$addon['name']));
     | 
  
  
    | 
      39
     | 
    
      		$template->parse('template_list', 'template_list_block', true);
     | 
  
  
    | 
      40
     | 
    
      	}
 
     | 
  
  
    | 
      41
     | 
    
      }
 
     | 
  
  
    | 
      42
     | 
    
      
 
     | 
  
  
    | 
      43
     | 
    
      // Insert permissions values
 
     | 
  
  
    | 
      44
     | 
    
      if($admin->get_permission('templates_install') != true) {
     | 
  
  
    | 
      45
     | 
    
      	$template->set_var('DISPLAY_INSTALL', 'hide');
     | 
  
  
    | 
      46
     | 
    
      }
 
     | 
  
  
    | 
      47
     | 
    
      if($admin->get_permission('templates_uninstall') != true) {
     | 
  
  
    | 
      48
     | 
    
      	$template->set_var('DISPLAY_UNINSTALL', 'hide');
     | 
  
  
    | 
      49
     | 
    
      }
 
     | 
  
  
    | 
      50
     | 
    
      if($admin->get_permission('templates_view') != true) {
     | 
  
  
    | 
      51
     | 
    
      	$template->set_var('DISPLAY_LIST', 'hide');
     | 
  
  
    | 
      52
     | 
    
      }
 
     | 
  
  
    | 
      53
     | 
    
      
 
     | 
  
  
    | 
      54
     | 
    
      // Insert language headings
 
     | 
  
  
    | 
      55
     | 
    
      $template->set_var(array(
 
     | 
  
  
    | 
      56
     | 
    
      					'HEADING_INSTALL_TEMPLATE' => $HEADING['INSTALL_TEMPLATE'],
 
     | 
  
  
    | 
      57
     | 
    
      					'HEADING_UNINSTALL_TEMPLATE' => $HEADING['UNINSTALL_TEMPLATE'],
 
     | 
  
  
    | 
      58
     | 
    
      					'HEADING_TEMPLATE_DETAILS' => $HEADING['TEMPLATE_DETAILS']
 
     | 
  
  
    | 
      59
     | 
    
      				)
 
     | 
  
  
    | 
      60
     | 
    
      			);
 
     | 
  
  
    | 
      61
     | 
    
      // insert urls
 
     | 
  
  
    | 
      62
     | 
    
      $template->set_var(array(
 
     | 
  
  
    | 
      63
     | 
    
      					'ADMIN_URL' => ADMIN_URL,
 
     | 
  
  
    | 
      64
     | 
    
      					'WB_URL' => WB_URL,
 
     | 
  
  
    | 
      65
     | 
    
      					'THEME_URL' => THEME_URL,
 
     | 
  
  
    | 
      66
     | 
    
      					'FTAN' => $admin->getFTAN()
 
     | 
  
  
    | 
      67
     | 
    
      				)
 
     | 
  
  
    | 
      68
     | 
    
      			);
 
     | 
  
  
    | 
      69
     | 
    
      // Insert language text and messages
 
     | 
  
  
    | 
      70
     | 
    
      $template->set_var(array(
 
     | 
  
  
    | 
      71
     | 
    
      	'URL_MODULES' => $admin->get_permission('modules') ? 
     | 
  
  
    | 
      72
     | 
    
      		'<a href="' . ADMIN_URL . '/modules/index.php">' . $MENU['MODULES'] . '</a>' : '',
 
     | 
  
  
    | 
      73
     | 
    
      	'URL_LANGUAGES' => $admin->get_permission('languages') ?
     | 
  
  
    | 
      74
     | 
    
      		'<a href="' . ADMIN_URL . '/languages/index.php">' . $MENU['LANGUAGES'] . '</a>' : '',
 
     | 
  
  
    | 
      75
     | 
    
      	'URL_ADVANCED' => '          ',
 
     | 
  
  
    | 
      76
     | 
    
      	'TEXT_INSTALL' => $TEXT['INSTALL'],
 
     | 
  
  
    | 
      77
     | 
    
      	'TEXT_UNINSTALL' => $TEXT['UNINSTALL'],
 
     | 
  
  
    | 
      78
     | 
    
      	'TEXT_VIEW_DETAILS' => $TEXT['VIEW_DETAILS'],
 
     | 
  
  
    | 
      79
     | 
    
      	'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
 
     | 
  
  
    | 
      80
     | 
    
      	'CHANGE_TEMPLATE_NOTICE' => $MESSAGE['TEMPLATES']['CHANGE_TEMPLATE_NOTICE']
 
     | 
  
  
    | 
      81
     | 
    
      	)
 
     | 
  
  
    | 
      82
     | 
    
      );
 
     | 
  
  
    | 
      83
     | 
    
      
 
     | 
  
  
    | 
      84
     | 
    
      // Parse template object
 
     | 
  
  
    | 
      85
     | 
    
      $template->parse('main', 'main_block', false);
     | 
  
  
    | 
      86
     | 
    
      $template->pparse('output', 'page');
     | 
  
  
    | 
      87
     | 
    
      
 
     | 
  
  
    | 
      88
     | 
    
      // Print admin footer
 
     | 
  
  
    | 
      89
     | 
    
      $admin->print_footer();
 
     |