' . STORE_EMAIL_ADDRESS . ' '; $strSsl = array_key_exists( 'HTTPS', $_SERVER) ? $_SERVER['HTTPS'] : ''; if(!empty($strSsl)) Quinta::$IsSsl = true; ///@todo make me international .. setlocale(LC_MONETARY, 'en_US'); //load an array of filenames for quick autoloading /// @todo change this to just look on demand ..see Autoload foreach( self::$QuintaIncludePaths 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::$QuintaClasses) ) self::$QuintaClasses[strtolower($strClassName)] = $strPath . '/' . $strFileName; } closedir($dh); } } } } /** * This is called by the PHP5 Autoloader. This method overrides the * one in QApplication - if Quinta fails to load the class, we attempt * to load it from QApplication classes here * @todo change this to just look on demand .. * @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 Quinta directories .. if(array_key_exists(strtolower($strClassName), Quinta::$QuintaClasses) ) { require_once(Quinta::$QuintaClasses[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( Quinta::IsBrowser(QBrowserType::InternetExplorer ) ) header('Connection: close'); // }elseif( Quinta::IsBrowser( QBrowserType::Opera) || Quinta::IsBrowser( QBrowserType::Safari) ){ }elseif( Quinta::IsBrowser( QBrowserType::Safari) ){ //these two do not support document.location redirects ..?? ob_clean(); // header('Location: ' . $strProtocol . Quinta::$ServerName . $strLocation); header('Location: ' . $strLocation); }else parent::Redirect($strLocation); exit; } /** * Quinta 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){ return false; 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 Quinta data Quinta::Init(); }//end define ?>