Sadji Messages : 3
|
voici le fichier page.php <?php if (!defined('SITE')) exit('No direct script access allowed');
/** * Frontend template class * * Used for generating frontend template * (This really needs some work still - but it's functional for now) * * @version 1.0 * @author Vaska */ class Page { public $result = array(); public $exhibit = array(); public $lib_js_add; public $exhibitz = array(); public $protected = false; public $last_visit; public $cached = true; public $js_lib_table = array(); public $js_jquery_table = array(); public $js_jquery_onready_table = array(); public $js_prototype_table = array(); public $js_prototype_onready_table = array(); public $version = ''; public $parsed = false; /** * Returns results array and exhibition plugin * * @param void * @return mixed */ public function Page() { $OBJ =& get_instance();
//$this->result = $OBJ->vars->exhibit; if (isset($OBJ->vars->exhibit['version'])) { $this->version = '?v=' . $OBJ->vars->exhibit['version']; } //if (isset($OBJ->vars->exhibit['ajax'])) //{ //if ($OBJ->vars->exhibit['ajax'] == false) //{ // init the format // $this->loadExhibit(); //} //} } public function version() { return $this->version; } public function get_imgs() { $OBJ =& get_instance(); global $default;
////////////////// // load the interface $OBJ->lib_interface('filesource');
// implement the interface $class = 'filesource' . $default['filesource'][$OBJ->vars->exhibit['media_source']]; $F =& load_class($class, true, 'lib');
// get our output return $F->getDisplayImages(); ////////////////// } /** * Returns void * * @param void * @return void */ public function last_visit() { // TEMPORARY! date_default_timezone_set('America/New_York'); setcookie('ndxz_last', getNow(), time()+3600*24*365, '/'); } /** * Returns exhibition format parameters * * @param void * @return string */ public function init_page() { $exhibit = array(); $OBJ =& get_instance(); // let's keep track of visits $this->last_visit(); // what about section passwords? if ($OBJ->vars->exhibit['sec_pwd'] != '') { $this->cached = false; $page = 'ndxz_sec_' . $OBJ->vars->exhibit['secid']; if (isset($_POST['ndxz_sec_pwd_sbmt']) && ($_POST['ndxz_hid'] == '')) { // it matches the password if (md5($_POST['ndxz_sec_pwd']) == md5($OBJ->vars->exhibit['sec_pwd'])) { // set the cookie for one day setcookie($page, md5($_POST['ndxz_sec_pwd']), time()+3600*24, '/'); // do we need to do a redirect here then? header('location:' . BASEURL . $OBJ->vars->exhibit['url']); } else // it does not { $this->protected = true;
$out = $this->sec_password(); $out .= "<p>Incorrect.</p>\n"; $OBJ->page->exhibit['exhibit'] = $out; $OBJ->page->exhibit['lib_css'][] = "security.css"; return; } } elseif (isset($_COOKIE[$page])) { // it doesn't match the password if ($_COOKIE[$page] != md5($OBJ->vars->exhibit['sec_pwd'])) { $this->protected = true; $OBJ->page->exhibit['exhibit'] = $this->sec_password(); $OBJ->page->exhibit['lib_css'][] = "security.css"; return; } } else { $this->protected = true; $OBJ->page->exhibit['exhibit'] = $this->sec_password(); $OBJ->page->exhibit['lib_css'][] = "security.css"; return; } } else { // built-in password check // checks only the active page if ($OBJ->vars->exhibit['pwd'] != '') { $this->cached = false; $page = 'ndxz_page_' . $OBJ->vars->exhibit['id']; if (isset($_POST['ndxz_pwd_sbmt']) && ($_POST['ndxz_hid'] == '')) { // it matches the password if (md5($_POST['ndxz_pwd']) == md5($OBJ->vars->exhibit['pwd'])) { // set the cookie for one day setcookie($page, md5($_POST['ndxz_pwd']), time()+3600*24, '/'); // do we need to do a redirect here then? header('location:' . BASEURL . $OBJ->vars->exhibit['url']); } else // it does not { $this->protected = true;
$out = $this->password(); $out .= "<p>Incorrect.</p>\n"; $OBJ->page->exhibit['exhibit'] = $out; $OBJ->page->exhibit['lib_css'][] = "security.css"; return; } } elseif (isset($_COOKIE[$page])) { // it doesn't match the password if ($_COOKIE[$page] != md5($OBJ->vars->exhibit['pwd'])) { $this->protected = true; $OBJ->page->exhibit['exhibit'] = $this->password(); $OBJ->page->exhibit['lib_css'][] = "security.css"; return; } } else { $this->protected = true; $OBJ->page->exhibit['exhibit'] = $this->password(); $OBJ->page->exhibit['lib_css'][] = "security.css"; return; } } } } // occoasionally handy functions public function sysvar($name='') { $OBJ =& get_instance(); if (isset($OBJ->vars->exhibit[$name])) { return $OBJ->vars->exhibit[$name]; } } public function changevar($name='', $value='') { $OBJ =& get_instance(); if (isset($OBJ->vars->exhibit[$name])) { $OBJ->vars->exhibit[$name] = $value; } } public function makevar($name='', $value='') { $OBJ =& get_instance(); if (!isset($OBJ->vars->exhibit[$name])) { $OBJ->vars->exhibit[$name] = $value; } }
/** * Password check * * @param string $function * @return string */ public function sec_password() { $out = "<form name='ndxz_protect' id='ndxz-protect' method='post' action=''>\n"; $out .= "<p>Password Protected Section</p>\n"; $out .= "<p>Enter Password</p>\n"; $out .= "<p><input name='ndxz_sec_pwd' type='text' maxlength='12' /></p>\n"; $out .= "<p><input name='ndxz_hid' type='hidden' value='' /></p>\n"; $out .= "<p><input name='ndxz_sec_pwd_sbmt' type='submit' value='submit' /></p>\n"; $out .= "</form>\n"; return $out; } /** * Password check * * @param string $function * @return string */ public function password() { $out = "<form name='ndxz_protect' id='ndxz-protect' method='post' action=''>\n"; // this can be changed via a plugin (need to make the plugin) $out .= "<p>Password Protected Page (enter password):</p>\n";
$out .= "<div id='ndxz_pwd'><input name='ndxz_pwd' type='text' maxlength='12' /></div>\n"; $out .= "<div id='ndxz_pwd_sbmt'><button name='ndxz_pwd_sbmt' type='submit' />Submit</button></div>\n"; $out .= "<input name='ndxz_hid' type='hidden' value='' />\n"; $out .= "</form>\n"; return $out; } /** * Returns index * * @param string $function * @return string */ public function index($function='') { // load 'theindex' class $NDX =& load_class('theindex', TRUE, 'lib'); return $NDX->load_index(); } public function javascript() { $out = $this->jquery(); $out .= $this->prototype(); $out .= $this->lib_js(); $out .= $this->dyn_js();
return $out; } /** * Returns exhibition * * @param void * @return string */ public function loadExhibit() { $OBJ =& get_instance(); // check for password protection $this->password_protect(); if (file_exists(DIRNAME . '/ndxzsite/' . $OBJ->vars->exhibit['obj_theme'] . '/format.' . $OBJ->vars->exhibit['format'] . '.php')) { include_once DIRNAME . '/ndxzsite/' . $OBJ->vars->exhibit['obj_theme'] . '/format.' . $OBJ->vars->exhibit['format'] . '.php'; $OBJ =& get_instance(); $OBJ->dyn_class('Exhibit'); } elseif (file_exists(DIRNAME . '/ndxzsite/plugin/format.' . $OBJ->vars->exhibit['format'] . '.php')) { include_once DIRNAME . '/ndxzsite/plugin/format.' . $OBJ->vars->exhibit['format'] . '.php';
$OBJ =& get_instance(); $OBJ->dyn_class('Exhibit'); } else { // thie default format if (file_exists(DIRNAME . '/ndxzsite/plugin/format.visual_index.php')) { include_once DIRNAME . '/ndxzsite/plugin/format.visual_index.php';
$OBJ =& get_instance(); $OBJ->dyn_class('Exhibit'); } } } /** * Returns ccs file info * * @param void * @return string */ public function lib_css() { $out = ''; if (!isset($this->exhibit['lib_css'])) return; if ($this->exhibit['lib_css'] != '') { if (is_array($this->exhibit['lib_css'])) { foreach ($this->exhibit['lib_css'] as $css) { $out .= "<style type='text/css'> @import url(" . BASEURL . "/ndxzsite/css/$css" . $this->version . "); </style>\n"; } } else { $out .= "<style type='text/css'> @import url(" . BASEURL . "/ndxzsite/css/" . $this->exhibit['lib_css'] . $this->version . "); </style>\n"; } } return $out; } /** * Returns ccs file info * * @param void * @return string */ public function theme_css() { $OBJ =& get_instance();
$out = ''; if (!isset($this->exhibit['theme_css'])) return; $theme = $OBJ->vars->exhibit['obj_theme']; if ($this->exhibit['theme_css'] != '') { if (is_array($this->exhibit['theme_css'])) { foreach ($this->exhibit['theme_css'] as $css) { $out .= "<style type='text/css'> @import url(" . BASEURL . "/ndxzsite/$theme/$css" . $this->version . "); </style>\n"; } } else { $out .= "<style type='text/css'> @import url(" . BASEURL . "/ndxzsite/$theme/" . $this->exhibit['theme_css'] . $this->version . "); </style>\n"; } } return $out; } public function css() { $out = $this->lib_css(); $out .= $this->theme_css(); $out .= $this->dyn_css(); return $out; } public function append_index() { $OBJ =& get_instance(); $s = '';
if (isset($OBJ->page->exhibit['append_index'])) { foreach ($OBJ->page->exhibit['append_index'] as $do) { $s .= $do; } return $s; } } public function append_page() { $OBJ =& get_instance(); $s = '';
if (isset($OBJ->page->exhibit['append_page'])) { foreach ($OBJ->page->exhibit['append_page'] as $do) { $s .= $do; } return $s; } } public function front_test() { echo ' testing '; } public function sidebar() { $OBJ =& get_instance(); $s = '';
if (isset($OBJ->page->exhibit['sidebar'])) { foreach ($OBJ->page->exhibit['sidebar'] as $do) { $s .= $do; } return $s; } } public function password_protect() { $OBJ =& get_instance(); if ($OBJ->vars->exhibit['cms'] == true) { $this->protected = false; return; }
// let's keep track of visits $this->last_visit(); // what about section passwords? if ($OBJ->vars->exhibit['sec_pwd'] != '') { $this->cached = false; $page = 'ndxz_sec_' . $OBJ->vars->exhibit['secid']; if (isset($_POST['ndxz_sec_pwd_sbmt']) && ($_POST['ndxz_hid'] == '')) { // it matches the password if (md5($_POST['ndxz_sec_pwd']) == md5($OBJ->vars->exhibit['sec_pwd'])) { // set the cookie for one day //setcookie($page, md5($_POST['ndxz_pwd']), time()+3600*24, $OBJ->vars->exhibit['url']); // is this bad? setcookie($page, md5($_POST['ndxz_sec_pwd']), time()+3600*24, '/'); // do we need to do a redirect here then? header('location:' . BASEURL . ndxz_rewriter($OBJ->vars->exhibit['url'])); exit; } else // it does not { $this->protected = true;
$out = $this->sec_password(); $out .= "<p>Incorrect.</p>\n"; $OBJ->page->exhibit['exhibit'] = $out; return $OBJ->page->exhibit['exhibit']; } } elseif (isset($_COOKIE[$page])) { // it doesn't match the password if ($_COOKIE[$page] != md5($OBJ->vars->exhibit['sec_pwd'])) { $this->protected = true; $OBJ->page->exhibit['exhibit'] = $this->sec_password(); return $OBJ->page->exhibit['exhibit']; } } else { $this->protected = true; $OBJ->page->exhibit['exhibit'] = $this->sec_password(); return $OBJ->page->exhibit['exhibit']; } } else { // built-in password check // checks only the active page if ($OBJ->vars->exhibit['pwd'] != '') { $this->cached = false; $page = 'ndxz_page_' . $OBJ->vars->exhibit['id']; if (isset($_POST['ndxz_pwd_sbmt']) && ($_POST['ndxz_hid'] == '')) { // it matches the password if (md5($_POST['ndxz_pwd']) == md5($OBJ->vars->exhibit['pwd'])) { // set the cookie for one day //setcookie($page, md5($_POST['ndxz_pwd']), time()+3600*24, $OBJ->vars->exhibit['url']); // is this bad? setcookie($page, md5($_POST['ndxz_pwd']), time()+3600*24, '/'); // do we need to do a redirect here then? header('location:' . BASEURL . ndxz_rewriter($OBJ->vars->exhibit['url'])); exit; } else // it does not { $out = $this->password(); $out .= "<p>Incorrect.</p>\n"; $OBJ->page->exhibit['exhibit'] = $out; return $OBJ->page->exhibit['exhibit']; } } elseif (isset($_COOKIE[$page])) { // it doesn't match the password if ($_COOKIE[$page] != md5($OBJ->vars->exhibit['pwd'])) { $this->protected = true; $OBJ->page->exhibit['exhibit'] = $this->password(); return $OBJ->page->exhibit['exhibit']; } } else { $this->protected = true; $OBJ->page->exhibit['exhibit'] = $this->password(); return $OBJ->page->exhibit['exhibit']; } } } } public function exhibit() { $OBJ =& get_instance(); if ($OBJ->vars->exhibit['cms'] != true) { if ($this->protected == true) { return $OBJ->page->exhibit['exhibit']; } } // otherwise, we load our exhibit class return $OBJ->exhibit->createExhibit(); } public function submedia() { $OBJ =& get_instance(); phpinfo(); } public function closing() { // this will be for hooks that come at the end // google analytics for instance $OBJ =& get_instance();
// think we need to loop through an array of parts here if ($OBJ->hook->registered_hook('closing')) return $OBJ->hook->do_action('closing'); } public function statistics() { // this will be for hooks that come at the end // google analytics for instance $OBJ =& get_instance();
// think we need to loop through an array of parts here if (isset($OBJ->abstracts->abstract['statistics'])) return $OBJ->abstracts->abstract['statistics']; } public function meta() { $OBJ =& get_instance(); if ($OBJ->hook->registered_hook('add_meta_tags')) return $OBJ->hook->do_action('add_meta_tags'); } public function favicon() { } /** * Returns js file info * * @param void * @return string */ public function lib_js() { $out = ''; if (!empty($this->js_lib_table)) { $this->js_lib_table = array_unique($this->js_lib_table); foreach ($this->js_lib_table as $js) { $out .= "<script type='text/javascript' src='" . BASEURL . "/ndxzsite/js/$js" . $this->version . "'></script>\n"; } //$out .= $this->front_jquery();
return $out; } } /** * Returns jquery file info * * @param void * @return string */ public function lib_jquery() { $out = ''; if (!empty($this->js_jquery_table)) { $this->js_jquery_table = array_unique($this->js_jquery_table); // auto add jquery.js $out .= "<script type='text/javascript' src='" . BASEURL . "/ndxzsite/js/jquery.js" . $this->version . "'></script>\n"; foreach ($this->js_jquery_table as $js) { $out .= "<script type='text/javascript' src='" . BASEURL . "/ndxzsite/js/$js" . $this->version . "'></script>\n"; } $out .= $this->front_jquery();
return $out; } }
/** * Returns css - dynamically generated * * @param void * @return string */ public function dyn_css() { $out = ''; if (!isset($this->exhibit['dyn_css'])) return; if ($this->exhibit['dyn_css'] != '') { if (is_array($this->exhibit['dyn_css'])) { $out .= "<style type='text/css'>\n"; foreach ($this->exhibit['dyn_css'] as $css) { $out .= "$css\n"; } $out .= "</style>\n"; } else { $out .= "<style type='text/css'>\n$css" . $this->version . "\n</style>\n"; } } return $out; } /** * Returns js - dynamically generated * * @param void * @return string */ public function dyn_js() { $out = ''; // check on this later... if (empty($this->exhibit['dyn_js'])) return; if ($this->exhibit['dyn_js'] != '') { if (is_array($this->exhibit['dyn_js'])) { $tmp = array_unique($this->exhibit['dyn_js']);
$out .= "<script type='text/javascript'>\n"; foreach ($tmp as $js) { $out .= "$js\n"; } $out .= "</script>\n"; } } return $out; } /** * Returns js onload parts * * @param void * @return string */ public function onload_js() { $out = ''; if (!isset($this->exhibit['onload'])) return; if ($this->exhibit['onload'] != '') { if (is_array($this->exhibit['onload'])) { $out .= " onload=\""; foreach ($this->exhibit['onload'] as $js) { $out .= "$js "; } $out .= "\""; } else { $out .= " onload=\"$js\"\n"; } } return $out; } /** * Returns js - dynamically generated * * @param void * @return string */ public function jquery() { $out = ''; if (empty($this->js_jquery_table)) return; //array_unique($this->js_jquery_table);
if (is_array($this->js_jquery_table)) { $out .= "<script type='text/javascript' src='" . BASEURL . "/ndxzsite/js/jquery.js" . $this->version . "'></script>\n"; foreach ($this->js_jquery_table as $js) { $out .= "<script type='text/javascript' src='" . BASEURL . "/ndxzsite/js/$js" . $this->version . "'></script>\n"; } } return $out; } /** * Returns js - dynamically generated * * @param void * @return string */ public function prototype() { $out = ''; if (empty($this->js_prototype_table)) return;
if (is_array($this->js_prototype_table)) { $out .= "<script type='text/javascript' src='" . BASEURL . "/ndxzsite/js/prototype.js" . $this->version . "'></script>\n"; foreach ($this->js_prototype_table as $js) { $out .= "<script type='text/javascript' src='" . BASEURL . "/ndxzsite/js/$js" . $this->version . "'></script>\n"; } } return $out; } public function onready() { $out = $this->jquery_onready(); // not sure about this one yet //$out .= $this->front_prototype_onready(); return $out; } /** * Returns js onready parts (for Jquery) * * @param void * @return string */ public function jquery_onready() { $out = ''; if (empty($this->js_jquery_onready_table)) return; ksort($this->js_jquery_onready_table); $result = array_unique($this->js_jquery_onready_table); if (is_array($result)) { $out .= "<script type='text/javascript'>\n"; $out .= "$(document).ready(function()\n"; $out .= "{\n"; foreach ($result as $js) { $out .= "\t{$js}\n"; } $out .= "});\n"; $out .= "</script>\n"; } return $out; } /** * Returns js onready parts (for Jquery) * * @param void * @return string */ public function prototype_onready() { $out = ''; if (empty($this->js_prototype_onready_table)) return;
if (is_array($this->js_prototype_onready_table)) { $out .= "<script type='text/javascript'>\n"; $out .= "$(document).ready(function()\n"; $out .= "{\n"; foreach ($this->js_prototype_onready_table as $js) { $out .= "\t{$js}\n"; } $out .= "});\n"; $out .= "</script>\n"; } return $out; } public function add_jquery($file, $priority = 25) { if (!isset($this->js_jquery_table[$priority])) { $this->js_jquery_table[$priority] = $file; } else { $this->add_jquery($file, $priority+1); } $this->js_jquery_table = array_unique($this->js_jquery_table); } public function add_prototype($file, $priority = 25) { if (!isset($this->js_prototype_table[$priority])) { $this->js_prototype_table[$priority] = $file; } }
public function add_jquery_onready($file, $priority = 25) { if (!isset($this->js_jquery_onready_table[$priority])) { $this->js_jquery_onready_table[$priority] = $file; } else { $this->add_jquery_onready($file, $priority+1); } $this->js_jquery_onready_table = array_unique($this->js_jquery_onready_table); } public function add_prototype_onready($file, $priority = 25) { if (!isset($this->js_prototype_onready_table[$priority])) { $this->js_prototype_onready_table[$priority] = $file; } } public function add_lib_js($file, $priority = 25) { if (!isset($this->js_lib_table[$priority])) { $this->js_lib_table[$priority] = $file; } }
public function remove_lib_js($file, $priority = 25) { if ($this->js_lib_table[$priority] == $file) { unset($this->js_lib_table[$priority]); } } public function delay_load_last($function='') { if ($function == '') return; $OBJ =& get_instance(); return $this->$function(); } /// for alternate parsing - PHP /** * Returns callback for function * * @param array $match * @return string */ public function load_plugin($match) { $OBJ =& get_instance(); $this->func = $match; $arg_list = func_get_args(); if ($arg_list[0][2] != '') { $args = explode(',', $arg_list[0][2]); $args = array_map('trim', $args); } else { $args = NULL; }
$args = $this->getArgs($args); //////////// if (file_exists(DIRNAME . '/ndxzsite/plugin/plugin.' . $this->func . '.php')) include_once DIRNAME . '/ndxzsite/plugin/plugin.' . $this->func . '.php';
if (class_exists($this->func)) { $tmp = $this->func; $OBJ->dyn_class($this->func); // only if it exists if (method_exists($OBJ->$tmp, $args[0]) && $args[0] != '') { // it is possible to send variables to the method $args[1] = (isset($args[1])) ? $args[1] : null; $args[2] = (isset($args[2])) ? $args[2] : null; return call_user_func_array(array($OBJ->$tmp, $args[0]), array($args[1], $args[2])); } //else //{ // return call_user_func_array(array($OBJ->$tmp, '__construct'), array(null, null)); //} } else if (function_exists($this->func)) { return call_user_func_array($this->func, $args); } else { return; } } /** * Returns parameters for function * * @param array $args * @return string */ public function getArgs($args) { if ($args == NULL) return;
foreach ($args as $arg) { // var $arg = preg_replace('/^.*=/', '', $arg); // front $arg = preg_replace('/^(\'|")/', '', $arg); // back $var[] = preg_replace('/(\'|")$/', '', $arg); }
return $var; } } voici le fichier index.php <?php define('SITE', 'Bonjour!');
// hide errors for the live site //error_reporting(0);
// the basics if (file_exists('ndxzsite/config/config.php')) require_once 'ndxzsite/config/config.php';
require_once 'ndxzsite/config/options.php'; require_once 'ndxzstudio/defaults.php'; require_once 'ndxzstudio/common.php';
$time_start = microtime_float();
// make sure we have our connection array shutDownCheck();
// messy, but seems to work $_REAL_SCRIPT_DIR = realpath(dirname($_SERVER['SCRIPT_FILENAME'])); $_REAL_BASE_DIR = realpath(dirname(__FILE__)); $_MY_PATH_PART = substr($_REAL_SCRIPT_DIR, strlen($_REAL_BASE_DIR)); $uri = $_MY_PATH_PART ? substr(dirname($_SERVER['SCRIPT_NAME']), 0, -strlen($_MY_PATH_PART)) : dirname($_SERVER['SCRIPT_NAME']);
$uri = entry_uri($uri, $_SERVER['REQUEST_URI']); $uri = str_replace($self, '', $uri);
// check for cached load_helpers(array('time')); $CACHE =& load_class('cache', true, 'lib'); $CACHE->check_cached($uri); // let's check for post values to turn off caching
if ($CACHE->cached == true) { $CACHE->show_cached(); } else { // load the core $OBJ =& load_class('core', true, 'lib'); // need to load up hooks $OBJ->assign_core_front(); // set defaults $OBJ->vars->default = $default; $OBJ->hook->load_hooks_front(); // check for a preloading hook if ($OBJ->hook->registered_hook('site_protect')) $OBJ->hook->do_action('site_protect'); // make a hook to change defaults? // media checks $uri = media_check($uri); // 'home' feature // if $uri == '/' switch query to search via 'home' if ($uri == '/') { $q['qry'] = "AND home = '1' "; $q['flag'] = true; } else { $q['qry'] = "AND url = " . $OBJ->db->escape($uri) ; $q['flag'] = false; }
// page query $OBJ->vars->exhibit = $OBJ->db->fetchRecord("SELECT * FROM ".PX."objects, ".PX."objects_prefs, ".PX."sections INNER JOIN ".PX."settings ON adm_id = '1' WHERE status = '1' $q[qry] AND section_id = secid AND object = obj_ref_type"); // second try - enforces / as default if ((!$OBJ->vars->exhibit) && ($q['flag'] == true)) { $OBJ->vars->exhibit = $OBJ->db->fetchRecord("SELECT * FROM ".PX."objects, ".PX."objects_prefs, ".PX."sections INNER JOIN ".PX."settings ON adm_id = '1' WHERE status = '1' AND url = " . $OBJ->db->escape($uri) . " AND section_id = secid AND object = obj_ref_type"); }
if (!$OBJ->vars->exhibit) { // try again with site root - the 'home' page $OBJ->vars->exhibit = $OBJ->db->fetchRecord("SELECT * FROM ".PX."objects, ".PX."objects_prefs, ".PX."sections INNER JOIN ".PX."settings ON adm_id = '1' WHERE home = '1' AND status = '1' AND section_id = secid AND object = obj_ref_type"); // we don't cache these $CACHE->defaults['caching'] = false; header("HTTP/1.1 404 Not Found");
// we need a formal error page if (!$OBJ->vars->exhibit) { // we don't search engines indexing this front_error('File Not Found', 404); exit; } } // we need to let the system know whether it's front or back end... $OBJ->vars->exhibit['cms'] = false;
// create the abstracts for exhibits or even images $OBJ->abstracts->front_abstracts();
// autoload 'plugins' folder include_once DIRNAME . '/ndxzsite/plugin/index.php';
// additional variables // perhaps we should port these differently? $OBJ->baseurl = BASEURL; $OBJ->vars->exhibit['baseurl'] = BASEURL; $OBJ->vars->exhibit['basename'] = BASENAME; $OBJ->vars->exhibit['basefiles'] = BASEFILES; $OBJ->vars->exhibit['gimgs'] = GIMGS; $OBJ->vars->exhibit['ajax'] = false; $OBJ->vars->exhibit['cms'] = false;
// we want to lose all of this $GLOBALS['rs'] = $OBJ->vars->exhibit; // setup front end helper class $OBJ->lib_class('page', true, 'lib'); $OBJ->page->loadExhibit(); $OBJ->page->init_page(); if ($OBJ->hook->registered_hook('pre_load')) $OBJ->hook->do_action('pre_load'); // is it special media? $OBJ->vars->exhibit['template'] = ($OBJ->template_override == true) ? 'media.php' : $OBJ->vars->exhibit['template']; $OBJ->parse_class($OBJ->vars->default['parse']); $OBJ->parse->vars = $OBJ->vars->exhibit; // this allows us some control over outputs... // like adding extra exhibits or variables via user input $OBJ->parse->pre_parse($OBJ->vars->exhibit['content']);
$template = (file_exists(DIRNAME . '/ndxzsite/' . $OBJ->vars->exhibit['obj_theme'] . '/' . $OBJ->vars->exhibit['template'])) ? $OBJ->vars->exhibit['template'] : 'index.php'; $filename = DIRNAME . '/ndxzsite/' . $OBJ->vars->exhibit['obj_theme'] . '/' . $template; $fp = @fopen($filename, 'r'); $contents = fread($fp, filesize($filename)); fclose($fp);
$OBJ->parse->code = $contents; $output = $OBJ->parse->parsing(); header('content-type: text/html; charset=utf-8'); echo $output; // caching - if enabled and possible // we want media pages to cache as well $uri = ($OBJ->template_override == true) ? $OBJ->temp_uri : $uri; // no cache if a password page if (($OBJ->page->cached == true)) $CACHE->makeCache($uri, $output); } exit; |