| 1 | 
        
            1392
         | 
        
            Luisehahne
         | 
        <?php
  | 
      
      
        | 2 | 
        
         | 
        
         | 
        /**
  | 
      
      
        | 3 | 
        
         | 
        
         | 
         *
  | 
      
      
        | 4 | 
        
         | 
        
         | 
         * @category        admin
  | 
      
      
        | 5 | 
        
         | 
        
         | 
         * @package         templates
  | 
      
      
        | 6 | 
        
            1529
         | 
        
            Luisehahne
         | 
         * @author          Ryan Djurovich, WebsiteBaker Project
  | 
      
      
        | 7 | 
        
            1392
         | 
        
            Luisehahne
         | 
         * @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$
  | 
      
      
        | 13 | 
        
            1457
         | 
        
            Luisehahne
         | 
         * @filesource		$HeadURL$
  | 
      
      
        | 14 | 
        
         | 
        
         | 
         * @lastmodified    $Date$
  | 
      
      
        | 15 | 
        
            1392
         | 
        
            Luisehahne
         | 
         *
  | 
      
      
        | 16 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 17 | 
        
         | 
        
         | 
        
  | 
      
      
        | 18 | 
        
         | 
        
         | 
        // Include the config file
  | 
      
      
        | 19 | 
        
         | 
        
         | 
        require('../../config.php');
 | 
      
      
        | 20 | 
        
         | 
        
         | 
        require_once(WB_PATH .'/framework/functions.php');
  | 
      
      
        | 21 | 
        
         | 
        
         | 
        require_once(WB_PATH.'/framework/class.admin.php');
  | 
      
      
        | 22 | 
        
            1457
         | 
        
            Luisehahne
         | 
        // suppress to print the header, so no new FTAN will be set
  | 
      
      
        | 23 | 
        
         | 
        
         | 
        $admin = new admin('Addons', 'templates_view', false);
 | 
      
      
        | 24 | 
        
            1392
         | 
        
            Luisehahne
         | 
        if( !$admin->checkFTAN() )
  | 
      
      
        | 25 | 
        
         | 
        
         | 
        {
 | 
      
      
        | 26 | 
        
            1467
         | 
        
            Luisehahne
         | 
        	$admin->print_header();
  | 
      
      
        | 27 | 
        
            1425
         | 
        
            Luisehahne
         | 
        	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
  | 
      
      
        | 28 | 
        
            1392
         | 
        
            Luisehahne
         | 
        }
  | 
      
      
        | 29 | 
        
         | 
        
         | 
        
  | 
      
      
        | 30 | 
        
         | 
        
         | 
        // Get template name
  | 
      
      
        | 31 | 
        
         | 
        
         | 
        if(!isset($_POST['file']) OR $_POST['file'] == "") {
 | 
      
      
        | 32 | 
        
         | 
        
         | 
        	header("Location: index.php");
 | 
      
      
        | 33 | 
        
         | 
        
         | 
        	exit(0);
  | 
      
      
        | 34 | 
        
         | 
        
         | 
        } else {
 | 
      
      
        | 35 | 
        
            1494
         | 
        
            Luisehahne
         | 
        	$file = preg_replace('/[^a-z0-9_-]/i', "", $_POST['file']);  // fix secunia 2010-92-2
 | 
      
      
        | 36 | 
        
            1392
         | 
        
            Luisehahne
         | 
        }
  | 
      
      
        | 37 | 
        
         | 
        
         | 
        
  | 
      
      
        | 38 | 
        
         | 
        
         | 
        // Check if the template exists
  | 
      
      
        | 39 | 
        
         | 
        
         | 
        if(!file_exists(WB_PATH.'/templates/'.$file)) {
 | 
      
      
        | 40 | 
        
         | 
        
         | 
        	header("Location: index.php");
 | 
      
      
        | 41 | 
        
         | 
        
         | 
        	exit(0);
  | 
      
      
        | 42 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 43 | 
        
         | 
        
         | 
        
  | 
      
      
        | 44 | 
        
         | 
        
         | 
        // Print admin header
  | 
      
      
        | 45 | 
        
         | 
        
         | 
        $admin = new admin('Addons', 'templates_view');
 | 
      
      
        | 46 | 
        
         | 
        
         | 
        
  | 
      
      
        | 47 | 
        
            1529
         | 
        
            Luisehahne
         | 
        // Setup template object, parse vars to it, then parse it
  | 
      
      
        | 48 | 
        
         | 
        
         | 
        $ThemePath = realpath(WB_PATH.$admin->correct_theme_source('templates_details.htt'));
 | 
      
      
        | 49 | 
        
         | 
        
         | 
        // Create new template object
  | 
      
      
        | 50 | 
        
         | 
        
         | 
        $template = new Template($ThemePath);
  | 
      
      
        | 51 | 
        
         | 
        
         | 
        // $template->debug = true;
  | 
      
      
        | 52 | 
        
            1392
         | 
        
            Luisehahne
         | 
        $template->set_file('page', 'templates_details.htt');
 | 
      
      
        | 53 | 
        
         | 
        
         | 
        $template->set_block('page', 'main_block', 'main');
 | 
      
      
        | 54 | 
        
         | 
        
         | 
        $template->set_var('FTAN', $admin->getFTAN());
 | 
      
      
        | 55 | 
        
         | 
        
         | 
        
  | 
      
      
        | 56 | 
        
         | 
        
         | 
        // Insert values
  | 
      
      
        | 57 | 
        
         | 
        
         | 
        $result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND directory = '$file'");
 | 
      
      
        | 58 | 
        
         | 
        
         | 
        if($result->numRows() > 0) {
 | 
      
      
        | 59 | 
        
         | 
        
         | 
        	$row = $result->fetchRow();
  | 
      
      
        | 60 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 61 | 
        
         | 
        
         | 
        
  | 
      
      
        | 62 | 
        
         | 
        
         | 
        // check if a template description exists for the displayed backend language
  | 
      
      
        | 63 | 
        
         | 
        
         | 
        $tool_description = false;
  | 
      
      
        | 64 | 
        
         | 
        
         | 
        if(function_exists('file_get_contents') && file_exists(WB_PATH.'/templates/'.$file.'/languages/'.LANGUAGE .'.php')) {
 | 
      
      
        | 65 | 
        
         | 
        
         | 
        	// read contents of the template language file into string
  | 
      
      
        | 66 | 
        
         | 
        
         | 
        	$data = @file_get_contents(WB_PATH .'/templates/' .$file .'/languages/' .LANGUAGE .'.php');
  | 
      
      
        | 67 | 
        
         | 
        
         | 
        	// use regular expressions to fetch the content of the variable from the string
  | 
      
      
        | 68 | 
        
         | 
        
         | 
        	$tool_description = get_variable_content('template_description', $data, false, false);
 | 
      
      
        | 69 | 
        
         | 
        
         | 
        	// replace optional placeholder {WB_URL} with value stored in config.php
 | 
      
      
        | 70 | 
        
         | 
        
         | 
        	if($tool_description !== false && strlen(trim($tool_description)) != 0) {
 | 
      
      
        | 71 | 
        
         | 
        
         | 
        		$tool_description = str_replace('{WB_URL}', WB_URL, $tool_description);
 | 
      
      
        | 72 | 
        
         | 
        
         | 
        	} else {
 | 
      
      
        | 73 | 
        
         | 
        
         | 
        		$tool_description = false;
  | 
      
      
        | 74 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 75 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 76 | 
        
         | 
        
         | 
        if($tool_description !== false) {
 | 
      
      
        | 77 | 
        
         | 
        
         | 
        	// Override the template-description with correct desription in users language
  | 
      
      
        | 78 | 
        
         | 
        
         | 
        	$row['description'] = $tool_description;
  | 
      
      
        | 79 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 80 | 
        
         | 
        
         | 
        
  | 
      
      
        | 81 | 
        
         | 
        
         | 
        $template->set_var(array(
  | 
      
      
        | 82 | 
        
         | 
        
         | 
        								'NAME' => $row['name'],
  | 
      
      
        | 83 | 
        
         | 
        
         | 
        								'AUTHOR' => $row['author'],
  | 
      
      
        | 84 | 
        
         | 
        
         | 
        								'DESCRIPTION' => $row['description'],
  | 
      
      
        | 85 | 
        
         | 
        
         | 
        								'VERSION' => $row['version'],
  | 
      
      
        | 86 | 
        
         | 
        
         | 
        								'DESIGNED_FOR' => $row['platform']
  | 
      
      
        | 87 | 
        
         | 
        
         | 
        								)
  | 
      
      
        | 88 | 
        
         | 
        
         | 
        						);
  | 
      
      
        | 89 | 
        
         | 
        
         | 
        
  | 
      
      
        | 90 | 
        
         | 
        
         | 
        // Insert language headings
  | 
      
      
        | 91 | 
        
         | 
        
         | 
        $template->set_var(array(
  | 
      
      
        | 92 | 
        
         | 
        
         | 
        								'HEADING_TEMPLATE_DETAILS' => $HEADING['TEMPLATE_DETAILS']
  | 
      
      
        | 93 | 
        
         | 
        
         | 
        								)
  | 
      
      
        | 94 | 
        
         | 
        
         | 
        						);
  | 
      
      
        | 95 | 
        
         | 
        
         | 
        // Insert language text and messages
  | 
      
      
        | 96 | 
        
         | 
        
         | 
        $template->set_var(array(
  | 
      
      
        | 97 | 
        
         | 
        
         | 
        								'TEXT_NAME' => $TEXT['NAME'],
  | 
      
      
        | 98 | 
        
         | 
        
         | 
        								'TEXT_AUTHOR' => $TEXT['AUTHOR'],
  | 
      
      
        | 99 | 
        
         | 
        
         | 
        								'TEXT_VERSION' => $TEXT['VERSION'],
  | 
      
      
        | 100 | 
        
         | 
        
         | 
        								'TEXT_DESIGNED_FOR' => $TEXT['DESIGNED_FOR'],
  | 
      
      
        | 101 | 
        
         | 
        
         | 
        								'TEXT_DESCRIPTION' => $TEXT['DESCRIPTION'],
  | 
      
      
        | 102 | 
        
         | 
        
         | 
        								'TEXT_BACK' => $TEXT['BACK']
  | 
      
      
        | 103 | 
        
         | 
        
         | 
        								)
  | 
      
      
        | 104 | 
        
         | 
        
         | 
        						);
  | 
      
      
        | 105 | 
        
         | 
        
         | 
        
  | 
      
      
        | 106 | 
        
         | 
        
         | 
        // Parse template object
  | 
      
      
        | 107 | 
        
         | 
        
         | 
        $template->parse('main', 'main_block', false);
 | 
      
      
        | 108 | 
        
         | 
        
         | 
        $template->pparse('output', 'page');
 | 
      
      
        | 109 | 
        
         | 
        
         | 
        
  | 
      
      
        | 110 | 
        
         | 
        
         | 
        // Print admin footer
  | 
      
      
        | 111 | 
        
         | 
        
         | 
        $admin->print_footer();
  | 
      
      
        | 112 | 
        
         | 
        
         | 
        
  | 
      
      
        | 113 | 
        
            4
         | 
        
            ryan
         | 
        ?>
  |