/** * Check the access rights agains the DB if we are in the publicms module * * @param $role * @return void */ private function checkRightsPublicms($role) { // check if instance is offline $safinstanceDB = new Safinstances(); $safinstances = $safinstanceDB->find($this->safinstancesId); if (count($safinstances) != 1) { print "FATAL ERROR 452 in Sydney_Controller_Plugin_Auth::checkRightsPublicms(" . $this->safinstancesId . ")"; header('Location: ' . Sydney_Tools_Paths::getRootUrlCdn() . '/install/instance/index.php/referrer/PluginAuth/checkRightsPublicms/noinstancefound'); exit; } elseif ($safinstances[0]->active == 0) { print $safinstances[0]->offlinemessage; if (empty($safinstances[0]->offlinemessage)) { print "This site is offline."; header('Location: ' . Sydney_Tools_Paths::getRootUrlCdn() . '/install/instance/index.php/referrer/PluginAuth/checkRightsPublicms'); } exit; } // get page data $d = $this->request->getParams(); if ($d['module'] == 'publicms' && $d['controller'] == 'index' && $d['action'] == 'view') { $nodes = new Pagstructure(); if (!isset($d['page']) || !preg_match("/^[0-9]{1,100}\$/", $d['page'])) { $nodeId = $nodes->getHomeId($this->safinstancesId); } else { $nodeId = $d['page']; } $node = $nodes->fetchAll(" id = '" . $nodeId . "' AND safinstances_id = '" . $this->safinstancesId . "' "); if (count($node) == 1) { $authorizedGroupId = $node[0]->usersgroups_id; if (!self::isContentAccessible($authorizedGroupId, $this->userNamespace->user['member_of_groups'])) { $this->redirecting('default', 'login', 'index', 'code04'); } } else { print "Node {$nodeId} not found! (FATAL ERROR 542 in Sydney_Controller_Plugin_Auth::checkRightsPublicms)"; header('Location: ' . Sydney_Tools_Paths::getRootUrlCdn() . '/install/instance/index.php/referrer/PluginAuth/checkRightsPublicms/nodenotfound'); exit; } } }
/** * Execute all the default method. * This is the quick mode to make the bootstrapper work. */ public function run() { // Common initialisation $this->registry = Zend_Registry::getInstance(); $this->_setConfigToRegistry(getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'general'); $this->_setPaths(); $this->frontController = Zend_Controller_Front::getInstance(); if (!Zend_Session::sessionExists()) { Zend_Session::start(); } $this->auth = Sydney_Auth::getInstance(); // set default timezone (could be useful) date_default_timezone_set($this->config->general->defaulttimezone); // set this in the registry so we can change the translations according to the page content if needed $this->registry->set('bootstrapper', $this); $this->setRoutes(); $this->setErrorMode($this->config->general->env); $this->setDebugMode(); $this->setCacheGlobalParams(); $this->setLanguageSettings(); $this->setTranslationObject(); $this->setLocalization(); $this->_setRegistredHelpersToRegistry(); try { $this->setDatabaseConnection(); } catch (Exception $e) { header('Location: ' . Sydney_Tools_Paths::getRootUrlCdn() . '/install/index.php'); exit; } try { $this->initCustomModules(); } catch (Exception $e) { echo 'ERROR initCustomModules', '<br>'; echo $e->getMessage(); header('Location: ' . Sydney_Tools_Paths::getRootUrlCdn() . '/install/index.php'); } try { $this->registerAuthPlugin(); } catch (Exception $e) { echo 'ERROR registerAuthPlugin', '<br>'; } try { $this->initModules(); } catch (Exception $e) { echo 'ERROR initModules', '<br>'; } $this->setLayout(); // set frontController plugins $this->registerFriendlyurlsPlugin(); $this->registerCachePlugin(); $this->dispatch(); }
/** * * @param unknown_type $type * @param Zend_View $zview * @param unknown_type $useCompression * @param unknown_type $useConcatenation * @param unknown_type $ctrl */ public static function concatScripts($type, Zend_View $zview, $useConcatenation = true) { $r = ''; $path = Sydney_Tools_Paths::getCorePath() . '/webinstances/sydney/html'; $path2 = Sydney_Tools_Paths::getJslibsPath(); $arrayOrig['jsOrig'] = Zend_Registry::getInstance()->get('config')->admin->js->orig; $arrayOrig['cssOrig'] = Zend_Registry::getInstance()->get('config')->admin->css->orig; $arrayLibs['jsLibs'] = Zend_Registry::getInstance()->get('config')->admin->js->libs; $arrayLibs['cssLibs'] = Zend_Registry::getInstance()->get('config')->admin->css->libs; /** * CSS + JS */ // adding the main files from the jslibs foreach ($arrayLibs[$type . 'Libs'] as $file) { if ($useConcatenation) { if (file_exists($path2 . $file)) { $tcnt = file_get_contents($path2 . $file); if ($type == 'css' && preg_match('#sydneyassets\\/jslibs\\/jquery#', $file)) { $needleStr = "#url\\(\"images\\/([a-zA-Z0-9_-]+)\\.(png|gif|jpg)\"#"; $replaceStr = "url(" . Sydney_Tools_Paths::getRootUrlCdn() . "\\/sydneyassets\\/jslibs\\/jquery\\/css\\/smoothness\\/images\\/\$1.\$2"; $tcnt = preg_replace($needleStr, $replaceStr, $tcnt); } if ($type == 'css' && preg_match('/skins\\/sam/', $file)) { $pht = preg_replace("/^\\/assets\\/yui\\/build\\/([A-z]{1,50})\\/assets\\/skins\\/sam\\/([A-z-_]{1,50}(\\.css))/", "/sydneyassets/yui/build/\\1/assets/skins/sam/", $file); $tcnt = str_replace('../../../../assets/skins/sam/', Sydney_Tools::getRootUrlCdn() . '/sydneyassets/yui/build/assets/skins/sam/', $tcnt); $tcnt = preg_replace("/url\\(([A-z0-9_-]{1,50})\\.(png)\\)/", "url(" . $pht . "\\1.\\2)", $tcnt); } $r .= "/* =========== File: " . $path2 . $file . " ================ */ \n\n\n" . $tcnt . "\n\n\n\n"; } } else { if ($type == 'css') { $zview->headLink()->appendStylesheet($file); } else { // GDE - 19/08/2013 - On va chercher "jslibs" sur le cdn (com.antidot.sydney) $zview->headScript()->appendFile(Zend_Registry::getInstance()->get('config')->general->cdn . $file, 'text/javascript'); } } } // adding the main files foreach ($arrayOrig[$type . 'Orig'] as $file) { if ($useConcatenation) { $tcnt = file_get_contents($path . $file); $r .= "/* =========== File: " . $path . $file . " ================ */ \n\n\n" . $tcnt . "\n\n\n\n"; } else { if ($type == 'css') { $zview->headLink()->appendStylesheet($file); } else { $zview->headScript()->appendFile(Sydney_Tools::getRootUrlCdn() . $file, 'text/javascript'); } } } // END Foreach /** * JS */ if ($type == 'js') { // adding the UI files $t = self::getDirList($path . '/sydneyassets/scripts/ui/'); foreach ($t as $file) { if ($useConcatenation) { $r .= "/* =========== File: " . $path . '/sydneyassets/scripts/ui/' . $file . " ================ */ \n\n\n" . file_get_contents($path . '/sydneyassets/scripts/ui/' . $file) . "\n\n\n\n"; } else { $zview->headScript()->appendFile(Sydney_Tools::getRootUrlCdn() . '/sydneyassets/scripts/ui/' . $file, 'text/javascript'); } } // add the launcher $launchFile = '/sydneyassets/scripts/zLauncher.js'; if ($useConcatenation) { $r .= "/* =========== File: " . $path . $launchFile . " ================ */ \n\n\n" . file_get_contents($path . $launchFile) . "\n\n\n\n"; } else { $zview->headScript()->appendFile(Sydney_Tools::getRootUrlCdn() . $launchFile, 'text/javascript'); } } return $r; }