/** * Returns the page from the given uri * @param string $page The page we want to translate to uri * @return string|bool The uri, or false */ public function translateUriToPage($uri) { if ($uri == '/' . $this->shortClassName . '/changer.php') { $page = $this->shortClassName . '/changer/'; return $page; } return parent::translateUriToPage($uri); }
/** * Returns the page from the given uri * @param string $page The page we want to translate to uri * @return string|bool The uri, or false */ public function translateUriToPage($uri) { $index = array('/', '/index.php', '/index.php3', '/index.htm', '/index.html'); if (in_array($uri, $index)) { // We check if there is an history if (!isset($_SESSION[__CLASS__]['introPageShown'])) { // We check if there is an intro page if ($this->getParam('intro>activated', false)) { sh_cache::disable(); $page = $this->getParam('intro>class') . '/' . $this->getParam('intro>method') . '/'; $page .= $this->getParam('intro>id', ''); $_SESSION[__CLASS__]['introPageShown'] = true; return $page; } $_SESSION[__CLASS__]['introPageShown'] = true; } $page = $this->getParam('class') . '/' . $this->getParam('action') . '/'; $page .= $this->getParam('id', ''); return $page; } if ($uri == '/' . $this->shortClassName . '/' . $this->getI18n('choose_uri') . '.php') { $page = $this->shortClassName . '/choose/'; return $page; } return parent::translatePageToUri($page); }
/** * Returns the page from the given uri * @param string $page The page we want to translate to uri * @return string|bool The uri, or false */ public function translateUriToPage($uri) { if ($uri == '/' . $this->shortClassName . '/create.php') { $page = $this->shortClassName . '/create/'; return $page; } if ($uri == '/' . $this->shortClassName . '/showChanges.php') { $page = $this->shortClassName . '/showChanges/'; return $page; } if ($uri == '/' . $this->shortClassName . '/prepareCommit.php') { $page = $this->shortClassName . '/prepareCommit/'; return $page; } return parent::translateUriToPage($uri); }
/** * This method tells if the user is an admin or not. * @param bool $alsoVerifyIfMaster If set to <b>true</b> (default), will also return true if the * user is not an admin, but a master. * @return bool True for yes, false for no. */ public function isAdmin($alsoVerifyIfMaster = true) { return parent::isAdmin($alsoVerifyIfMaster); }
/** * Returns the page from the given uri * @param string $page The page we want to translate to uri * @return string|bool The uri, or false */ public function translateUriToPage($uri) { if (preg_match('`/' . $this->shortClassName . '/([^/]+)(/([0-9]+)(-[^/]+)?)?\\.php`', $uri, $matches)) { if ($matches[1] == 'editImage') { return $this->shortClassName . '/editImage/' . $matches[3]; } } return parent::translateUriToPage($uri); }
/** * Constructor * @param str $class The name of the class */ private final function __construct($class) { $this->linker = sh_linker::getInstance(); self::$instances[$class] = $this; $className = $this->__tostring(); $this->className = $className; $this->shortClassName = str_replace(SH_PREFIX, '', $className); if (isset($_SESSION['core'][$this->className]['version'])) { // We check if an update has been made if ($_SESSION['core'][$this->className]['version'] != $this::CLASS_VERSION) { $needUpdate = true; } } if ($this->shortClassName != 'helper') { $this->helper = $this->linker->helper; } $this->shortClassName = str_replace(SH_CUSTOM_PREFIX, '', $this->shortClassName); $this->linker->{$className} = $this; if ($className::$needs_params) { $this->paramsFile = $className; $this->i18nClassName = $className; $this->linker->params->addElement($this->paramsFile); } if ($className::$needs_db) { $this->linker->db->addElement($className); if ($needUpdate) { $this->linker->db->updateQueries($this->className); } } if (is_null(self::$form_verifier) && $class::$needs_form_verifier) { self::$form_verifier = new sh_form_verifier(); } $this->debugger = new sh_debugger(); $_SESSION['core'][$this->className]['version'] = $this::CLASS_VERSION; }
/** * Returns the page from the given uri * @param string $page The page we want to translate to uri * @return string|bool The uri, or false */ public function translateUriToPage($uri) { if ($uri == '/menu/image.php') { // To change this, we also have to do it in menuEditor.js return 'menu/image/'; } if ($uri == '/menu/insertVideo.php') { // To change this, we also have to do it in menuEditor.js return 'menu/insertVideo/'; } if ($uri == '/menu/insertDiaporama.php') { // To change this, we also have to do it in menuEditor.js return 'menu/insertDiaporama/'; } if ($uri == '/menu/chooseLink.php') { // To change this, we also have to do it in menuEditor.js return 'menu/chooseLink/'; } if ($uri == '/menu/addBlock.php') { // To change this, we also have to do it in menuEditor.js return 'menu/addBlock/'; } return parent::translateUriToPage($uri); }
/** * Returns the page from the given uri * @param string $page The page we want to translate to uri * @return string|bool The uri, or false */ public function translateUriToPage($uri) { if (preg_match('`/' . $this->shortClassName . '/' . $this->getI18n('change_uri') . '\\.php`', $uri)) { $page = $this->shortClassName . '/change/'; return $page; } return parent::translateUriToPage($uri); }
/** * Returns the page from the given uri * @param string $page The page we want to translate to uri * @return string|bool The uri, or false */ public function translateUriToPage($uri) { if (preg_match('`/menu/edit/([0-9]+)\\.php`', $uri, $matches)) { return 'menu/edit/' . $matches[1]; } if ($uri == '/menu/verifyLength.php') { // To change this, we also have to do it in menuEditor.js return 'menu/verifyLength/'; } if ($uri == '/menu/addEntry.php') { // To change this, we also have to do it in menuEditor.js return 'menu/addEntry/'; } if ($uri == '/menu/chooseLink.php') { // To change this, we also have to do it in menuEditor.js return 'menu/chooseLink/'; } if ($uri == '/menu/unpack_button_type.php') { // To change this, we also have to do it in menuEditor.js return 'menu/unpack_button_type/'; } return parent::translateUriToPage($uri); }
public function isMaster($id = null) { $this->linker->params->addElement(__CLASS__, false, true); if (is_null($id)) { return parent::isMaster(); } return in_array($id, $this->getMasters()); }
public function render() { $this->debug('function : ' . __FUNCTION__, 2, __LINE__); self::$willRender = false; // We check if there are classes to construct before managing the contents (as they may add some) $classes = $this->helper->getClassesSharedMethods(__CLASS__, 'construct'); foreach ($classes as $class) { $tempClass = $this->linker->{$class}; } $tempClass = null; // We first prepare the common contents for mobile and complete versions $specialContentsClasses = $this->get_shared_methods('add_special_content'); foreach ($specialContentsClasses as $class) { $this->linker->{$class}->add_special_content(); } $data = $this->specialContents; $data['html']['isAdminPage'] = $this->helper->isAdminPage(); if ($data['html']['isAdminPage']) { $data['html']['isAdminPage_class'] = 'this_is_an_admin_page'; } else { $data['html']['isAdminPage_class'] = 'this_is_not_an_admin_page'; } $data['body']['headline'] = $this->getHeadLine(); $data['body']['title'] = $this->getTitle(true); $data['body']['content'] = ''; $data['body']['beforeContent'] = ''; if (!empty($_SESSION[__CLASS__]['messages_alert'])) { $values['messages'] = $_SESSION[__CLASS__]['messages_alert']; $data['body']['content'] .= parent::render('message_alert', $values, false, false); $data['body']['beforeContent'] .= parent::render('message_alert', $values, false, false); unset($_SESSION[__CLASS__]['messages_alert']); } if (!empty($_SESSION[__CLASS__]['messages_normal'])) { $values['messages'] = $_SESSION[__CLASS__]['messages_normal']; $data['body']['content'] .= parent::render('message_normal', $values, false, false); $data['body']['beforeContent'] .= parent::render('message_normal', $values, false, false); unset($_SESSION[__CLASS__]['messages_normal']); } $data['body']['onlyContent'] = $this->getBodyContent(); $data['body']['content'] .= $data['body']['onlyContent']; $data['body']['logo'] = $this->linker->site->logo; $data['body']['copyrights'] = $this->linker->legacy->getLegacyLine(); $data['body']['analytics'] = $this->linker->googleServices->getAnalytics(true); /*if($this->linker->session->checkIfIsMobileDevice()) { // We render using a special template // We only get the first menu for the mobile template $menuNumber = 1; $data['menu'] = $this->linker->menu->getForMobile($menuNumber); $data['language']['selector'] = $this->linker->i18n->getLanguageSelector(true); $data['head']['content'] = $this->getHead(true); // Sending to classic mode $uri = $this->linker->path->url; if(strpos($uri,'?') === false) { $linkerChar = '?'; }else { $linkerChar = '&'; } $data['mode']['classicLink'] = $uri.$linkerChar.'mode=classic'; $variation = $this->linker->site->variation; $data['variation']['background'] = $this->getParam('variation_'.$variation); // Rendering $pageContent = parent::render('mobile_template',$data,false,false); $pageContent = str_replace('</body>',$data['body']['adminpanel'].$data['body']['analytics'].'</body>',$pageContent); $pageContent = $this->linker->renderer->toHtml($pageContent); $docType = '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.1//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd">'."\n"; }else {/**/ // We render the complete version $this->linker->javascript->get(sh_javascript::SCRIPTACULOUS); $this->linker->javascript->get(sh_javascript::POPUPS); $this->linker->javascript->get(sh_javascript::WINDOW); $this->addCSS('main.css', 'MAIN', '/templates/global/global.css', 'GLOBAL'); $data['language']['selector'] = $this->linker->i18n->getLanguageSelector(); $loadClasses = $this->linker->template->get('loadClasses', array()); if (is_array($loadClasses)) { foreach ($loadClasses as $loadClass) { $this->linker->{$loadClass}; } } // Prepares the data for the output $this->bodyContent = $this->fromRoot(str_replace('#TEMPLATE_DIR#', $this->template, $this->bodyContent)); // Sets the variables to fill the output $data['body']['adminpanel'] = $this->linker->admin->get(); $data['body']['searchEngine'] = $this->linker->searcher->get(); for ($menuNumber = 1; $menuNumber <= $this->menusNumber; $menuNumber++) { $data['body']['menu_' . $menuNumber] = $this->linker->menu->get($menuNumber); } $data['body']['global_image'] = str_replace(SH_ROOT_FOLDER, SH_ROOT_PATH, $this->global_image); $data['body']['global_image_text'] = $this->global_image_text; $data['diaporamas']['display'] = $this->linker->site->diaporamaDisplay; $data['body']['otherContents'] = $this->getOtherContent(); $data['body']['otherContents'] .= '<script>$$(".toggle_next_element").each(function(el){el.next().addClassName("toggle_keep_hidden")});</script>'; $data['body']['otherContents'] .= '<style>.toggle_keep_hidden{display:none;}</style>'; //$data['body']['analytics'] = $this->linker->googleServices->getAnalytics(true); $ending = ''; $data['body']['analytics'] .= '<script type="text/javascript">' . $this->endingScripts . '</script>'; list($action, $link) = $this->linker->user->getConnectionLink(); $data[$action]['link'] = $link; $data['profile']['link'] = $this->linker->user->getProfileLink(); // These vars should be built just before rendering, // to be sure that they contain everything that is built $this->addToBody('class', 'shopsailors_navigator'); $data['body']['data'] = $this->getBodyData(); $data['body']['beginning'] = $this->getAfterBody(); $data['head']['content'] = $this->getHead(); // Renders the html document $template = $this->template . '/template.rf.xml'; if (!empty($this->specialTemplate)) { $template = $this->specialTemplate; } $pageContent = parent::render($template, $data, false, false); $pageContent = str_replace('</body>', $data['body']['adminpanel'] . $data['body']['analytics'] . '</body>', $pageContent); $pageContent = $this->linker->renderer->toHtml($pageContent); $docType = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n"; /*}/**/ $cpt = 1; $pageContent = str_replace('<html ', '<html xmlns="http://www.w3.org/1999/xhtml" ', $pageContent, $cpt); // xmlDeclaration $xmlTag = '<?xml version="1.0" encoding="UTF-8" ?>' . "\n"; // DocType $pageContent = $xmlTag . $docType . $pageContent; if ($_SESSION['this_is_a_temp_session']) { // We don't cache temp sessions pages $pageContent = preg_replace(array('`(src|href)="([^\\?"]*)"`', '`(src|href)="([^"]*)\\?([^"]*)"`'), array('$1="$2?nothing_special=true"', '$1="$2?$3&temp_session=' . $_SESSION['temp_session'] . '"'), $pageContent); echo $pageContent; } else { echo sh_cache::saveCache($pageContent); } }
/** * Returns the page from the given uri * @param string $page The page we want to translate to uri * @return string|bool The uri, or false */ public function translateUriToPage($uri) { if (preg_match('`/' . $this->shortClassName . '/configure\\.php`', $uri)) { $page = $this->shortClassName . '/configure/'; return $page; } if ($uri == '/' . $this->shortClassName . '/prepareCommit.php') { $page = $this->shortClassName . '/prepareCommit/'; return $page; } if ($uri == '/' . $this->shortClassName . '/showProject.php') { $page = $this->shortClassName . '/showProject/'; return $page; } if ($uri == '/' . $this->shortClassName . '/showFileHistory.php') { $page = $this->shortClassName . '/showFileHistory/'; return $page; } if ($uri == '/' . $this->shortClassName . '/test.php') { $page = $this->shortClassName . '/test/'; return $page; } if ($uri == '/' . $this->shortClassName . '/showCheckList.php') { $page = $this->shortClassName . '/showCheckList/'; return $page; } return parent::translateUriToPage($uri); }