=')) { require_once('lib/Core/Misc/domxml-php4-to-php5.php'); //require_once('lib/Core/Misc/xslt-php4-to-php5.php'); } // **************************************************************************** // Start the timer to measure how long the pages take to render $GLOBALS['pageTimer'] = new Benchmark_Timer(); $GLOBALS['pageTimer']->start(); $GLOBALS['SQLTimer'] = ''; //debug('REQUEST_URI: '.$_SERVER['REQUEST_URI']); // **************************************************************************** // Strip slashes from all incoming variables right away. Cln_stripSlashes($_REQUEST); Cln_stripSlashes($_POST); Cln_stripSlashes($_GET); Cln_stripSlashes($_COOKIE); // **************************************************************************** // Start the session and load/prime session objects session_name(CLN_COOKIE_NAME); if(isset($_REQUEST['sid'])) session_id($_REQUEST['sid']); session_start(); // **************************************************************************** // load/prime session objects // :DEBUG: remove specific session variables - doesn't work yet - dwc /*if(isset($_REQUEST['clearSessionVar'])) { unset($_SESSION[($_REQUEST['clearSessionVar'])]); }*/ // The Module Loader // NOTE: This must be loaded first, before any other session variables //unset($_SESSION['Module_Loader']); if(!isset($_SESSION['Module_Loader'])) { session_register('Module_Loader'); $_SESSION['Module_Loader'] = new $GLOBALS['classes']['module_loader']['classname'](); //$_SESSION['Module_Loader']->loadAllModuleTypes(); //print_f($_SESSION['Module_Loader']); } if (!isset($_SESSION['History'])) { session_register('History'); $_SESSION['History'] = array(); } // The Edit Mode if (!isset($_SESSION['editMode'])) { session_register('editMode'); $_SESSION['editMode'] = 'browse'; } if($_SESSION['editMode'] == 'browse') { $GLOBALS['status'] = 1; } else { $GLOBALS['status'] = 0; } // *************************************************************************** // Load User if(defined('MAIN_CLN_DSN')) { // The User Object if(!isset($_SESSION['User'])) { session_register('User'); $thisUser =& new $GLOBALS['classes']['ko']['classname']('NEW',2); $thisUser->loadPartObject(0); $thisUser->currentPart['title'] = 'New Person'; $_SESSION['User'] =& $thisUser->currentPart['object']; $_SESSION['User']->reloadGroupList(); } //print_f($_SESSION['User']);exit; // catch direct login if(isset($_REQUEST['username']) && isset($_REQUEST['password'])) { $_SESSION['User']->email = $_REQUEST['username']; $_SESSION['User']->password = $_REQUEST['password']; $_SESSION['User']->login(FALSE,FALSE); // doesn't redirect } // See if the user is logging in or out if(isset($_REQUEST['CLN_login_submit'])) { $_SESSION['User'] = login($_REQUEST['CLN_login_email'],$_REQUEST['CLN_login_password']); //print_f($_SESSION['User']);exit; } else if(isset($_REQUEST['Cln_logout'])) { // the user is logging out $_SESSION['User']->logout(); } else { //print 'checking authentication for user
'; isLoggedIn(); } //print_f($_SESSION['User']);exit; } // *************************************************************************** // See if the user is trying to switch languages if(isset($_REQUEST['setLanguage'])) { //if($_POST['setLanguage'] == $_SESSION['User']->preferredLanguages[0]) { // unset($_SESSION['User']->lang); //} else { $_SESSION['User']->lang = $GLOBALS['lang'] = $_REQUEST['setLanguage']; //} $language = $_REQUEST['setLanguage']; // PEAR::raiseError("Your viewing language has been switched to {$GLOBALS['languages'][$language]}.

This doesn't mean that you will see everything in {$GLOBALS['languages'][$language]} - the system does not do automatic translation. However, you will see content in {$GLOBALS['languages'][$language]} whenever a translation exists in that language.", E_USER_NOTICE); PEAR::raiseError("Your viewing language has been switched to {$GLOBALS['languages'][$language]}.", E_USER_NOTICE); // redirect so we get clean urls clnRedirect(appendToURL($_SERVER['REQUEST_URI'],'setLanguage=')); } else { $GLOBALS['lang'] = $_SESSION['User']->lang; } if(isset($_POST['showLanguage'])) { $GLOBALS['lang'] = $_POST['showLanguage']; } if(isset($_GET['emptyHistory'])) { unset($_SESSION['History']); clnRedirect(cleanURL($_GET['p'])); } // *************************************************************************** // See if the user is trying to switch edit mode if(isset($_GET['editMode'])) { $_SESSION['editMode'] = $_GET['editMode']; // redirect so we get clean urls clnRedirect(appendToURL($_SERVER['REQUEST_URI'],'editMode=')); } // *************************************************************************** // Display the Page // If it's PAGETYPE Admin, then don't load the normal content if ((isset($PAGETYPE) && $PAGETYPE == 'Admin')) { if (!defined('CLN_CLEAN_URL_BASE')) define('CLN_CLEAN_URL_BASE', CLN_FILE_BASE); // Do nothing now, content will be handled directly $GLOBALS['path'] = ereg_replace(realpath(CLN_FILE_BASE).'/(.*)','\1',$_SERVER['SCRIPT_FILENAME']); if(isset($GLOBALS['history']) && $GLOBALS['history']) addToHistory(); } // check to see if we need to install else if((isset($PAGETYPE) && $PAGETYPE == 'Install')) { // do nothing } // Otherwise load the normal content else { // test messages //PEAR::raiseError('test',E_USER_NOTICE); //PEAR::raiseError('test',E_USER_WARNING); // config file should exist if(!file_exists(CLN_FILE_BASE . 'config/config.php')) { header('Location: install/index.php'); exit; } // *************************************************************************** // Initialize the appropriate room and page session objects // *************************************************************************** // Set the location information, based on the path $startingKoId = setLocation(); //d("SetLocation - ROOMID {$GLOBALS['ROOMID']}, PAGEID {$GLOBALS['PAGEID']}"); if(isset($_GET['koId'])) { $content = getKO($_GET['koId'],TRUE,TRUE); // create simple room - someday could be special template - dwc $aRoom =& new $GLOBALS['classes']['ko']['classname']($startingKoId); $aRoom->loadPartObject(0); //echo ""; // :NOTE: not sure if this is correct yet, but it will have to do for now - dwc echo $aRoom->currentPart['object']->loadHeader(FALSE); // don't load template stylesheets //echo $aRoom->currentPart['object']->loadModuleStylesheets(); //echo ""; echo $content; //echo ""; } else { // are they specifying a view if (isset($GLOBALS['view'])) { $view = $GLOBALS['view']; } else { $view = 'Default'; } if(isset($GLOBALS['subview'])) { $view .= '/'.$GLOBALS['subview']; } if(isset($_GET['noheader'])) { $GLOBALS['EXCLUDE_ROOT_NODE'][$startingKoId] = TRUE; $GLOBALS['EXCLUDE_KO_CONTAINER'][$startingKoId] = TRUE; } //function getKO($koId, $view = 'Default', $loadHeaders = FALSE, $loadAsHTML = FALSE) { echo getKO($startingKoId,$view,TRUE,TRUE); } } // write out log all at once clnWriteLog(); //*************************************************************************** // Functions /** * Adds various folders to the include path * * @access public * @return bool TRUE on success or FALSE on failure */ function setIncludePath() { $INCLUDE_PATH = array( realpath(CLN_FILE_BASE), realpath(CLN_FILE_BASE . 'config'), realpath(CLN_FILE_BASE . 'lib'), realpath(CLN_FILE_BASE . 'lib/CLN'), realpath(CLN_FILE_BASE . 'lib/Core'), realpath(CLN_FILE_BASE . 'lib/pear') ); // Set the separator based on the OS $separator = ':'; if(preg_match('/^win/i', PHP_OS)) { $separator = ';'; } // Set the include path $current_include_path = ini_get('include_path'); $new_include_path = join($separator, $INCLUDE_PATH) . $separator . $current_include_path; return ini_set('include_path',$new_include_path); } ?>