/** * Constructs the administration object, taking the authentication object as a parameter and storing it for further use; * * This method will construct the administration object, which automatically takes an authentication object as a parameter. Thus * we can have separate authentication mechanisms (besides the implemented MySQL authentication) that can be used with our * administration mechanism, as long as the proper parameters respect the IFaceAuthentication interface; * * @param IFaceAuthentication $objAuthMech The authentication object, passed as a parameter; * @return void Doesn't need to return anything (being a constructor); */ public function __construct(IFaceAuthentication $objAuthMech) { // Construct any possible parent, parse the configuration meanwhile; parent::__construct(); // Set the execution time start; self::setExeTime(new S('administration_start')); // Tie in common configuration data; $this->tieInCommonConfiguration(); // Tie in with the authentication mechanism; $this->tieInWithAuthenticationMechanism($objAuthMech); // Set some requirements ... $objPathToSkinJSS = $this->getPathToSkinJSS()->toRelativePath(); $objPathToSkinCSS = $this->getPathToSkinCSS()->toRelativePath(); // Auto-LogOut the user if we detect the proper action ... if (isset($_GET[ADMIN_INTERFACE_ACTION])) { // Switch ... switch ($_GET[ADMIN_INTERFACE_ACTION]) { case ADMIN_LOG_OUT: self::$objAuthenticationMech->doLogOut(); URL::doCleanURLPath(); break; case ADMIN_SWITCH_THEME: if ($this->objCookie->checkKey(new S('admin_css'))->toBoolean() == TRUE) { switch ($this->objCookie->getKey(new S('admin_css'))) { case 'default.css': $this->objCookie->setKey(new S('admin_css'), new S('default_inverted.css'), new B(TRUE)); break; default: $this->objCookie->setKey(new S('admin_css'), new S('default.css'), new B(TRUE)); break; } } else { // Set the INVERTED, at first ... $this->objCookie->setKey(new S('admin_css'), new S('default_inverted.css'), new B(TRUE)); } // Get out ... $this->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_INTERFACE_ACTION))), new S('Location')); break; } } // Set the required JS dependencies ... TPL::manageCSS(new FilePath($objPathToSkinJSS . 'jQ' . _S . 'jQUI.css'), new S('jQUICSS')); TPL::manageCSS(new FilePath($objPathToSkinJSS . 'jQ' . _S . 'jQContextMenu.css'), new S('jQCM')); TPL::manageCSS(new FilePath($objPathToSkinJSS . 'jQ' . _S . 'jQFancybox.css'), new S('jQFancybox')); TPL::manageJSS(new FilePath($objPathToSkinJSS . 'jQ' . _S . 'jQ.js'), new S('jQ')); TPL::manageJSS(new FilePath($objPathToSkinJSS . 'jQ' . _S . 'jQUI.js'), new S('jQUI')); TPL::manageJSS(new FilePath($objPathToSkinJSS . 'jQ' . _S . 'jQClock.js'), new S('jQClock')); TPL::manageJSS(new FilePath($objPathToSkinJSS . 'jQ' . _S . 'jQBind.js'), new S('jQBind')); TPL::manageJSS(new FilePath($objPathToSkinJSS . 'jQ' . _S . 'jQUICheckbox.js'), new S('jQUICR')); TPL::manageJSS(new FilePath($objPathToSkinJSS . 'jQ' . _S . 'jQFileStyle.js'), new S('jQFStyle')); TPL::manageJSS(new FilePath($objPathToSkinJSS . 'jQ' . _S . 'jQEasing.js'), new S('jQEasing')); TPL::manageJSS(new FilePath($objPathToSkinJSS . 'jQ' . _S . 'jQFancybox.js'), new S('jQFancybox')); TPL::manageJSS(new FilePath($objPathToSkinJSS . 'jQ' . _S . 'jQToolTip.js'), new S('jQTT')); TPL::manageJSS(new FilePath($objPathToSkinJSS . 'jQ' . _S . 'jQWidget.js'), new S('jQWidget')); TPL::manageJSS(new FilePath($objPathToSkinJSS . 'jQ' . _S . 'jQContextMenu.js'), new S('jQCM')); TPL::manageJSS(new FilePath($objPathToSkinJSS . 'jQ' . _S . 'jQMasked.js'), new S('jQMasked')); TPL::manageJSS(new FilePath($objPathToSkinJSS . 'jQ' . _S . 'jQTypeFace.js'), new S('jQTF')); TPL::manageJSS(new FilePath($objPathToSkinJSS . 'jQ' . _S . 'jQKabelTypeFace.js'), new S('jQTK')); TPL::manageJSS(new FilePath($objPathToSkinJSS . 'jQ' . _S . 'jQExe.js'), new S('jQExe')); // Add the default CSS, either black or white ... if ($this->objCookie->checkKey(new S('admin_css'))->toBoolean() == TRUE) { // Set the proper CSS, acording to _SESSION; TPL::manageCSS(new FilePath($objPathToSkinCSS . $this->objCookie->getKey(new S('admin_css'))), new S(__CLASS__)); } else { // Set the default to BLACK; TPL::manageCSS(new FilePath($objPathToSkinCSS . 'default.css'), new S(__CLASS__)); } // Safari, Google Chrome and maybe others on WebKIT ... if ($this->getUserAgentProperty(new S('browser')) == 'sf') { // Add'em fixes ... TPL::manageCSS(new FilePath($objPathToSkinCSS . 'default_fixed.css'), new S('safari-css-fix')); } // Get the proper configuration options stored in the object; self::$objHeaderText = $this->getConfigKey(new S('administration_header_text')); self::$objFooterText = $this->getConfigKey(new S('administration_footer_text')); // Do some actions, based on user information; if (self::$objAuthenticationMech->checkIfUserIsLoggedIn()->toBoolean() == TRUE and self::$objAuthenticationMech->checkCurrentUserZoneACL(new S(__CLASS__))->toBoolean() == TRUE) { // Redirect to the dashboard page; if (!isset($_GET[ADMIN_PAGE])) { $this->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_PAGE)), new A(array(ADMIN_DASHBOARD))), new S('Location')); } // Do a CALL to ALL registered administrator interfaces; $this->tieALLRegisteredAdminInterfaces(); } else { // Echo an error, for our dear friend, the Internet Explorer (MSIE); if ($this->getUserAgentProperty(new S('browser')) == 'ie') { self::renderScreenOfDeath(new S(__CLASS__), new S(ADMIN_IE_NOT_ALLOWED), new S(ADMIN_IE_NOT_ALLOWED_FIX)); } else { // Safari, Google Chrome and maybe others on WebKIT ... if ($this->getUserAgentProperty(new S('browser')) == 'sf') { // Add'em fixes ... TPL::manageCSS(new FilePath($objPathToSkinCSS . 'default_fixed_adm.css'), new S('safari-fix')); } // Do the authentication screen; self::$objAuthenticationMech->renderForm(new S('adminLoginScreen')); // Set some predefines ... self::$objMenuArray = new A(); self::$objSubMArray = new A(); self::$objLogOutLink = new S(); self::$objSwitcherLink = new S(); // After we know all the details, execute the viewer whit these parameters; $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'administration.tp'); TPL::tpSet(self::$objHeaderText, new S('objHeaderText'), $tpF); TPL::tpSet(self::$objFooterText, new S('objFooterText'), $tpF); TPL::tpSet(self::$objMenuArray, new S('objMenuArray'), $tpF); TPL::tpSet(self::$objSubMArray, new S('objSubMArray'), $tpF); TPL::tpSet(self::$objLogOutLink, new S('objLogOutLink'), $tpF); TPL::tpSet(self::$objSwitcherLink, new S('objSwitcherLink'), $tpF); TPL::tpExe($tpF); } } }