| 1 | 238 | stefan | <?php
 | 
      
        | 2 |  |  | 
 | 
      
        | 3 |  |  | // $Id$
 | 
      
        | 4 |  |  | 
 | 
      
        | 5 |  |  | /*
 | 
      
        | 6 |  |  | 
 | 
      
        | 7 |  |  |  Website Baker Project <http://www.websitebaker.org/>
 | 
      
        | 8 | 915 | Ruebenwurz |  Copyright (C) 2004-2009, Ryan Djurovich
 | 
      
        | 9 | 238 | stefan | 
 | 
      
        | 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 |  |  | $starttime = array_sum(explode(" ",microtime()));
 | 
      
        | 27 |  |  | 
 | 
      
        | 28 | 1149 | aldus | /**
 | 
      
        | 29 |  |  |  *	looking for the config file
 | 
      
        | 30 |  |  |  */
 | 
      
        | 31 |  |  | if (!file_exists(dirname(__FILE__).'/config.php')) {
 | 
      
        | 32 |  |  | 	/**
 | 
      
        | 33 |  |  | 	 *	Config doesn't exists
 | 
      
        | 34 |  |  | 	 *	So we've try to run the installation
 | 
      
        | 35 |  |  | 	 */
 | 
      
        | 36 | 238 | stefan | 	header("Location: install/index.php");
 | 
      
        | 37 | 286 | stefan | 	exit(0);
 | 
      
        | 38 | 1149 | aldus | } else {
 | 
      
        | 39 |  |  | 	/**
 | 
      
        | 40 |  |  | 	 *	Config file exists
 | 
      
        | 41 |  |  | 	 */
 | 
      
        | 42 |  |  | 	require_once(dirname(__FILE__).'/config.php');
 | 
      
        | 43 |  |  | 
 | 
      
        | 44 |  |  | 	if (!defined(WB_PATH)) {
 | 
      
        | 45 |  |  | 		/**
 | 
      
        | 46 |  |  | 		 *	Ups ... config seems to be corrupt
 | 
      
        | 47 |  |  | 		 */
 | 
      
        | 48 |  |  | 		header("Location: install/index.php");
 | 
      
        | 49 |  |  | 		exit(0);
 | 
      
        | 50 |  |  | 	}
 | 
      
        | 51 | 238 | stefan | }
 | 
      
        | 52 |  |  | 
 | 
      
        | 53 |  |  | require_once(WB_PATH.'/framework/class.frontend.php');
 | 
      
        | 54 |  |  | // Create new frontend object
 | 
      
        | 55 |  |  | $wb = new frontend();
 | 
      
        | 56 |  |  | 
 | 
      
        | 57 |  |  | // Figure out which page to display
 | 
      
        | 58 |  |  | // Stop processing if intro page was shown
 | 
      
        | 59 |  |  | $wb->page_select() or die();
 | 
      
        | 60 |  |  | 
 | 
      
        | 61 |  |  | // Collect info about the currently viewed page
 | 
      
        | 62 |  |  | // and check permissions
 | 
      
        | 63 |  |  | $wb->get_page_details();
 | 
      
        | 64 |  |  | 
 | 
      
        | 65 |  |  | // Collect general website settings
 | 
      
        | 66 |  |  | $wb->get_website_settings();
 | 
      
        | 67 |  |  | 
 | 
      
        | 68 |  |  | // Load functions available to templates, modules and code sections
 | 
      
        | 69 |  |  | // also, set some aliases for backward compatibility
 | 
      
        | 70 |  |  | require(WB_PATH.'/framework/frontend.functions.php');
 | 
      
        | 71 |  |  | 
 | 
      
        | 72 | 543 | thorn | // redirect menu-link
 | 
      
        | 73 |  |  | $this_page_id = PAGE_ID;
 | 
      
        | 74 | 883 | thorn | if(version_compare(phpversion(), '4.3', '>=')) $php43 = TRUE; else $php43 = FALSE;
 | 
      
        | 75 | 543 | thorn | $query_this_module = $database->query("SELECT module, block FROM ".TABLE_PREFIX."sections WHERE page_id = '$this_page_id' AND module = 'menu_link'");
 | 
      
        | 76 |  |  | if($query_this_module->numRows() == 1) { // This is a menu_link. Get link of target-page and redirect
 | 
      
        | 77 |  |  | 	// get target_page_id
 | 
      
        | 78 |  |  | 	$table = TABLE_PREFIX.'mod_menu_link';
 | 
      
        | 79 | 883 | thorn | 	$query_tpid = $database->query("SELECT * FROM $table WHERE page_id = '$this_page_id'");
 | 
      
        | 80 | 543 | thorn | 	if($query_tpid->numRows() == 1) {
 | 
      
        | 81 |  |  | 		$res=$query_tpid->fetchRow();
 | 
      
        | 82 |  |  | 		$target_page_id = $res['target_page_id'];
 | 
      
        | 83 | 883 | thorn | 		$r_type = $res['redirect_type'];
 | 
      
        | 84 | 565 | thorn | 		$anchor = $res['anchor'];
 | 
      
        | 85 | 698 | thorn | 		$extern = $res['extern'];
 | 
      
        | 86 | 565 | thorn | 		if($anchor != '0') $anchor = ''.$anchor;
 | 
      
        | 87 |  |  | 		else $anchor = FALSE;
 | 
      
        | 88 | 883 | thorn | 		// set redirect-type
 | 
      
        | 89 |  |  | 		if($r_type=='301') {
 | 
      
        | 90 |  |  | 			if($php43) @header('HTTP/1.1 301 Moved Permanently', TRUE, 301);
 | 
      
        | 91 |  |  | 			else @header('HTTP/1.1 301 Moved Permanently');
 | 
      
        | 92 |  |  | 		}
 | 
      
        | 93 | 698 | thorn | 		if($target_page_id == -1) {
 | 
      
        | 94 |  |  | 			if($extern!='') {
 | 
      
        | 95 | 699 | thorn | 				header("Location: $extern".($anchor?'#'.$anchor:''));
 | 
      
        | 96 | 698 | thorn | 			}
 | 
      
        | 97 |  |  | 		} else {
 | 
      
        | 98 |  |  | 			// get link of target-page
 | 
      
        | 99 |  |  | 			$table = TABLE_PREFIX.'pages';
 | 
      
        | 100 |  |  | 			$query_link = $database->query("SELECT link FROM $table WHERE page_id = '$target_page_id'");
 | 
      
        | 101 |  |  | 			if($query_link->numRows() == 1) {
 | 
      
        | 102 |  |  | 				$res=$query_link->fetchRow();
 | 
      
        | 103 |  |  | 				$target_page_link = $res['link'];
 | 
      
        | 104 |  |  | 				header('Location: '.WB_URL.PAGES_DIRECTORY.$target_page_link.PAGE_EXTENSION.($anchor?'#'.$anchor:''));
 | 
      
        | 105 |  |  | 				exit;
 | 
      
        | 106 |  |  | 			}
 | 
      
        | 107 | 543 | thorn | 		}
 | 
      
        | 108 |  |  | 	}
 | 
      
        | 109 |  |  | }
 | 
      
        | 110 |  |  | 
 | 
      
        | 111 | 989 | aldus | // Backwards compatible Frontend filter support
 | 
      
        | 112 |  |  | // include the output filter module routines
 | 
      
        | 113 |  |  | if(file_exists(WB_PATH .'/modules/output_filter/filter-routines.php')) {@require_once(WB_PATH .'/modules/output_filter/filter-routines.php');}
 | 
      
        | 114 |  |  | // Load Droplet engine
 | 
      
        | 115 |  |  | if(file_exists(WB_PATH .'/modules/droplets/droplets.php')) { @require_once(WB_PATH .'/modules/droplets/droplets.php'); }
 | 
      
        | 116 | 673 | doc | 
 | 
      
        | 117 | 989 | aldus | //Get pagecontent in buffer for Droplets and/or Filter operations
 | 
      
        | 118 |  |  | ob_start();
 | 
      
        | 119 | 238 | stefan | require(WB_PATH.'/templates/'.TEMPLATE.'/index.php');
 | 
      
        | 120 | 989 | aldus | $output = ob_get_contents();
 | 
      
        | 121 | 1138 | ruud | if (ob_get_length() > 0) ob_end_clean();
 | 
      
        | 122 | 238 | stefan | 
 | 
      
        | 123 | 989 | aldus | if(function_exists('evalDroplets')) { $output = evalDroplets($output); }
 | 
      
        | 124 |  |  | if(function_exists('filter_frontend_output')) { $output = filter_frontend_output($output); }
 | 
      
        | 125 |  |  | echo $output;
 | 
      
        | 126 |  |  | 
 | 
      
        | 127 | 699 | thorn | ?>
 |