| 1 | 
        
            4
         | 
        
            ryan
         | 
        <?php
  | 
      
      
        | 2 | 
        
         | 
        
         | 
        
  | 
      
      
        | 3 | 
        
            223
         | 
        
            stefan
         | 
        // $Id$
  | 
      
      
        | 4 | 
        
            4
         | 
        
            ryan
         | 
        
  | 
      
      
        | 5 | 
        
         | 
        
         | 
        /*
  | 
      
      
        | 6 | 
        
         | 
        
         | 
        
  | 
      
      
        | 7 | 
        
         | 
        
         | 
         Website Baker Project <http://www.websitebaker.org/>
  | 
      
      
        | 8 | 
        
            310
         | 
        
            ryan
         | 
         Copyright (C) 2004-2006, Ryan Djurovich
  | 
      
      
        | 9 | 
        
            4
         | 
        
            ryan
         | 
        
  | 
      
      
        | 10 | 
        
         | 
        
         | 
         Website Baker is free software; you can redistribute it and/or modify
  | 
      
      
        | 11 | 
        
         | 
        
         | 
         it under the terms of the GNU General Public License as published by
  | 
      
      
        | 12 | 
        
         | 
        
         | 
         the Free Software Foundation; either version 2 of the License, or
  | 
      
      
        | 13 | 
        
         | 
        
         | 
         (at your option) any later version.
  | 
      
      
        | 14 | 
        
         | 
        
         | 
        
  | 
      
      
        | 15 | 
        
         | 
        
         | 
         Website Baker is distributed in the hope that it will be useful,
  | 
      
      
        | 16 | 
        
         | 
        
         | 
         but WITHOUT ANY WARRANTY; without even the implied warranty of
  | 
      
      
        | 17 | 
        
         | 
        
         | 
         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  | 
      
      
        | 18 | 
        
         | 
        
         | 
         GNU General Public License for more details.
  | 
      
      
        | 19 | 
        
         | 
        
         | 
        
  | 
      
      
        | 20 | 
        
         | 
        
         | 
         You should have received a copy of the GNU General Public License
  | 
      
      
        | 21 | 
        
         | 
        
         | 
         along with Website Baker; if not, write to the Free Software
  | 
      
      
        | 22 | 
        
         | 
        
         | 
         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  | 
      
      
        | 23 | 
        
         | 
        
         | 
        
  | 
      
      
        | 24 | 
        
         | 
        
         | 
        */
  | 
      
      
        | 25 | 
        
         | 
        
         | 
        
  | 
      
      
        | 26 | 
        
         | 
        
         | 
        // Include the config file
  | 
      
      
        | 27 | 
        
         | 
        
         | 
        require('../../config.php');
 | 
      
      
        | 28 | 
        
         | 
        
         | 
        
  | 
      
      
        | 29 | 
        
         | 
        
         | 
        // Get template name
  | 
      
      
        | 30 | 
        
         | 
        
         | 
        if(!isset($_POST['file']) OR $_POST['file'] == "") {
 | 
      
      
        | 31 | 
        
         | 
        
         | 
        	header("Location: index.php");
 | 
      
      
        | 32 | 
        
            286
         | 
        
            stefan
         | 
        	exit(0);
  | 
      
      
        | 33 | 
        
            4
         | 
        
            ryan
         | 
        } else {
 | 
      
      
        | 34 | 
        
         | 
        
         | 
        	$file = $_POST['file'];
  | 
      
      
        | 35 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 36 | 
        
         | 
        
         | 
        
  | 
      
      
        | 37 | 
        
         | 
        
         | 
        // Check if the template exists
  | 
      
      
        | 38 | 
        
         | 
        
         | 
        if(!file_exists(WB_PATH.'/templates/'.$file)) {
 | 
      
      
        | 39 | 
        
         | 
        
         | 
        	header("Location: index.php");
 | 
      
      
        | 40 | 
        
            286
         | 
        
            stefan
         | 
        	exit(0);
  | 
      
      
        | 41 | 
        
            4
         | 
        
            ryan
         | 
        }
  | 
      
      
        | 42 | 
        
         | 
        
         | 
        
  | 
      
      
        | 43 | 
        
         | 
        
         | 
        // Print admin header
  | 
      
      
        | 44 | 
        
         | 
        
         | 
        require_once(WB_PATH.'/framework/class.admin.php');
  | 
      
      
        | 45 | 
        
         | 
        
         | 
        $admin = new admin('Addons', 'templates_view');
 | 
      
      
        | 46 | 
        
         | 
        
         | 
        
  | 
      
      
        | 47 | 
        
         | 
        
         | 
        // Setup template object
  | 
      
      
        | 48 | 
        
         | 
        
         | 
        $template = new Template(ADMIN_PATH.'/templates');
  | 
      
      
        | 49 | 
        
         | 
        
         | 
        $template->set_file('page', 'details.html');
 | 
      
      
        | 50 | 
        
         | 
        
         | 
        $template->set_block('page', 'main_block', 'main');
 | 
      
      
        | 51 | 
        
         | 
        
         | 
        
  | 
      
      
        | 52 | 
        
         | 
        
         | 
        // Insert values
  | 
      
      
        | 53 | 
        
            223
         | 
        
            stefan
         | 
        $result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND directory = '$file'");
 | 
      
      
        | 54 | 
        
         | 
        
         | 
        if($result->numRows() > 0) {
 | 
      
      
        | 55 | 
        
         | 
        
         | 
        	$row = $result->fetchRow();
  | 
      
      
        | 56 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 57 | 
        
         | 
        
         | 
        
  | 
      
      
        | 58 | 
        
            4
         | 
        
            ryan
         | 
        $template->set_var(array(
  | 
      
      
        | 59 | 
        
            223
         | 
        
            stefan
         | 
        								'NAME' => $row['name'],
  | 
      
      
        | 60 | 
        
         | 
        
         | 
        								'AUTHOR' => $row['author'],
  | 
      
      
        | 61 | 
        
         | 
        
         | 
        								'DESCRIPTION' => $row['description'],
  | 
      
      
        | 62 | 
        
         | 
        
         | 
        								'VERSION' => $row['version'],
  | 
      
      
        | 63 | 
        
         | 
        
         | 
        								'DESIGNED_FOR' => $row['platform']
  | 
      
      
        | 64 | 
        
            4
         | 
        
            ryan
         | 
        								)
  | 
      
      
        | 65 | 
        
         | 
        
         | 
        						);
  | 
      
      
        | 66 | 
        
         | 
        
         | 
        
  | 
      
      
        | 67 | 
        
         | 
        
         | 
        // Insert language headings
  | 
      
      
        | 68 | 
        
         | 
        
         | 
        $template->set_var(array(
  | 
      
      
        | 69 | 
        
         | 
        
         | 
        								'HEADING_TEMPLATE_DETAILS' => $HEADING['TEMPLATE_DETAILS']
  | 
      
      
        | 70 | 
        
         | 
        
         | 
        								)
  | 
      
      
        | 71 | 
        
         | 
        
         | 
        						);
  | 
      
      
        | 72 | 
        
         | 
        
         | 
        // Insert language text and messages
  | 
      
      
        | 73 | 
        
         | 
        
         | 
        $template->set_var(array(
  | 
      
      
        | 74 | 
        
         | 
        
         | 
        								'TEXT_NAME' => $TEXT['NAME'],
  | 
      
      
        | 75 | 
        
         | 
        
         | 
        								'TEXT_AUTHOR' => $TEXT['AUTHOR'],
  | 
      
      
        | 76 | 
        
         | 
        
         | 
        								'TEXT_VERSION' => $TEXT['VERSION'],
  | 
      
      
        | 77 | 
        
         | 
        
         | 
        								'TEXT_DESIGNED_FOR' => $TEXT['DESIGNED_FOR'],
  | 
      
      
        | 78 | 
        
            277
         | 
        
            stefan
         | 
        								'TEXT_DESCRIPTION' => $TEXT['DESCRIPTION'],
  | 
      
      
        | 79 | 
        
         | 
        
         | 
        								'TEXT_BACK' => $TEXT['BACK']
  | 
      
      
        | 80 | 
        
            4
         | 
        
            ryan
         | 
        								)
  | 
      
      
        | 81 | 
        
         | 
        
         | 
        						);
  | 
      
      
        | 82 | 
        
         | 
        
         | 
        
  | 
      
      
        | 83 | 
        
         | 
        
         | 
        // Parse template object
  | 
      
      
        | 84 | 
        
         | 
        
         | 
        $template->parse('main', 'main_block', false);
 | 
      
      
        | 85 | 
        
         | 
        
         | 
        $template->pparse('output', 'page');
 | 
      
      
        | 86 | 
        
         | 
        
         | 
        
  | 
      
      
        | 87 | 
        
         | 
        
         | 
        // Print admin footer
  | 
      
      
        | 88 | 
        
         | 
        
         | 
        $admin->print_footer();
  | 
      
      
        | 89 | 
        
         | 
        
         | 
        
  | 
      
      
        | 90 | 
        
         | 
        
         | 
        ?>
  |