' . STORE_EMAIL_ADDRESS . ' '; $strSsl = array_key_exists( 'HTTPS', $_SERVER) ? $_SERVER['HTTPS'] : ''; if(!empty($strSsl)) Quasi::$IsSsl = true; ///@todo make me international .. setlocale(LC_MONETARY, 'en_US'); //load an array of filenames for quick autoloading foreach( self::$QuasiIncludePaths as $strPath) { if (is_dir($strPath)) { if ($dh = opendir($strPath)) { while (($strFileName = readdir($dh)) !== false) { $pos = strrpos( $strFileName, '.class.php' ); if(false === $pos || true == strpos( $strFileName , '~' ) ) continue; $strClassName = substr( $strFileName, 0, $pos ); if( ! array_key_exists(strtolower($strClassName), self::$QuasiClasses) ) self::$QuasiClasses[strtolower($strClassName)] = $strPath . '/' . $strFileName; } closedir($dh); } } } } /** * This is called by the PHP5 Autoloader. This method overrides the * one in QApplication - if Quasi fails to load the class, we attempt * to load it from QApplication classes here * @return void */ public static function Autoload($strClassName) { //some Qcodo generated QQ classes go in the same file as the ORM class .. $aryQcodoPrefixes = array( 'QQNode', ); //work around for QCodo classes in same file .. foreach($aryQcodoPrefixes as $strPrefix) if( false !== strpos( $strClassName, $strPrefix ) ) $strClassName = substr( $strClassName, strlen( $strPrefix ) ); // first check Quasi directories .. if(array_key_exists(strtolower($strClassName), Quasi::$QuasiClasses) ) { require_once(Quasi::$QuasiClasses[strtolower($strClassName)]); return true; } // Otherwise use the Qcodo Autoloader if (parent::Autoload($strClassName)) return true; return false; } /** * This will redirect the user to a new web location. This can be a relative or absolute web path, or it * can be an entire URL. This overrides the QApplication::Redirect to work for offsite redirects and to * support browsers like Opera and Safari that do not accept document.location assigns. * * - any string starting with / is assumed to be local. * - any string with http:// or https:// is assumed to be offsite. * *@todo - support SEO friendly URLS .. and ssl (buggy, needs time ..) * *@param string strLocation - the URL to which the user is redirected * @return void */ public static function Redirect($strLocation, $blnUseSsl=false) { ob_clean(); $strProtocol = ''; if($blnUseSsl) $strProtocol = 'https://'; else $strProtocol = 'http://'; if( false !== strpos( $strLocation, 'http://' ) || false !== strpos( $strLocation, 'https://' ) ) { /* candidate: if (!headers_sent()) { header('Location: '. $strLocation ); } else { $strOutPut = ''; $strOutPut .= ''; _p($strOutPut); exit; } */ ob_clean(); header('Location: ' . $strLocation); if( Quasi::IsBrowser(QBrowserType::InternetExplorer ) ) header('Connection: close'); }//these two do not support document.location redirects ..?? elseif( Quasi::IsBrowser( QBrowserType::Opera) || Quasi::IsBrowser( QBrowserType::Safari) ) { ob_clean(); // header('Location: ' . $strProtocol . Quasi::$ServerName . $strLocation); header('Location: ' . $strLocation); } else parent::Redirect($strLocation); exit; } /** * Quasi access control * Note: this is only a sketch of an idea, in the event of a real access control you will be notified .. * ie. THIS DOES NOTHING YET. And it will definitely change. *@todo implement access control */ public static function CheckAccess($aryAllowGroups) { if(sizeof($aryAllowGroups) == 0) return true; $blnLoggedIn = false; $objAccount = null; $objPerson = null; $aryUsergroups = array(); $blnAllow = false; if( isset($_SESSION) && isset($_SESSION['AccountLogin']) ) { $objAccount = unserialize($_SESSION['AccountLogin']); if( $objAccount instanceof Account ) { $blnLoggedIn = true; $objPerson = $objAccount->Person; } } if($blnLoggedIn && $objPerson) $aryUsergroups = $objPerson->GetUsergroupArray(); foreach( $aryUsergroups as $objGroup ) if(in_array($aryAllowGroups, $objGroup->Name )) $blnAllow = true; return $blnAllow; } }//end class //now initialize Quasi data Quasi::Init(); }//end define ?>