function Save($strText = false) { if ($strText === false) { $strText = $this->toString(); if ($strText === false) { return false; } } else { //replace break lines by \\n for textarea var $tabResult = $this->parseIniFromString(stripslashes($strText)); $strText = $this->toString($tabResult); } if (!$this->_Modified($strText)) { return true; } if (!deleteMenuCache()) { return false; } //save without stripslashes return parent::Save($strText, false); }
$strModelContent .= $oTemp->Display(70, $url = false, $oDirModels); } } } $tabMainTabs[] = array('FRAG_NAME' => 'models_link', 'TAB_NAME' => _('Models Management'), 'TAB_CONTENT' => ' <form> <button onClick="myRelodPage(\'' . $strUrltabModels . '\')" class="ui-state-default ui-corner-all" type="button">' . _('Manage') . '</button> </form> <div id="listTypes">' . $strModelContent . '</div>'); /** TAB FCKEDITOR */ $oFile_fck_toolbar = new PTextFile(CONFIG_DIR . 'fckeditor' . SLASH . 'fckconfig.js'); $oFile_fck_styles = new PTextFile(CONFIG_DIR . 'fckeditor' . SLASH . 'fckstyles.xml'); $oFile_fck_css = new PTextFile(CONFIG_DIR . 'fckeditor' . SLASH . 'fckeditor.css'); $oFile_fck_templates = new PTextFile(CONFIG_DIR . 'fckeditor' . SLASH . 'fcktemplates.xml'); $tabMainTabs[] = array('FRAG_NAME' => 'conf_editor', 'TAB_NAME' => _('FCK Editor'), 'TAB_CONTENT' => array_to_tabs(array(array('FRAG_NAME' => 'fck_toolbar', 'TAB_NAME' => 'FCK TOOLBAR', 'TAB_CONTENT' => $oFile_fck_toolbar->DisplayEditor()), array('FRAG_NAME' => 'fck_styles', 'TAB_NAME' => 'FCK Styles', 'TAB_CONTENT' => $oFile_fck_styles->DisplayEditor()), array('FRAG_NAME' => 'fck_editor_css', 'TAB_NAME' => 'FCK Editor CSS', 'TAB_CONTENT' => $oFile_fck_css->DisplayEditor()), array('FRAG_NAME' => 'fck_templates', 'TAB_NAME' => 'FCK Templates', 'TAB_CONTENT' => $oFile_fck_templates->DisplayEditor())), 'tabConfiguratorLevel2')); /** TAB PLUGINS */ $strTableActivated = '<h2>' . _('Activated Plugins list') . '</h2> <table id="listPluginsActivated" class="listPlugins"> <tr> <th>' . _('Name') . '</th> <th>' . _('Author') . '</th> <th>' . _('Version') . '</th> <th>' . _('Action') . '</th> </tr> {LIST} </table> ';
/** * Copy a page. Check the name of the new copy, then copy the html file and the inifile. * Also set the virtual name, and reset the MENU NAME and the MENU_ORDER * * @param string $strNewName, the new name of the file. If the file extension is not set use the original one. * @param string $strParentPath, path of the dire where will be but the copy. If not set use the parent path of the * copied page. * @return boolean true if succeed, else false. */ function Copy($strNewName, $strParentPath = false) { $strCPageName = $strNewName; $strCFileName = $this->getUnixName($strNewName); if (strlen($strCFileName) == 0) { return setError(_("Can not copy page with empty name.")); } if (!$this->checkname($strCPageName)) { return false; } if (!$strParentPath) { $strParentPath = $this->getParentPath(); } $strCFileName .= "." . $this->getExtension(); $strCFilePath = $strParentPath . SLASH . $strCFileName; if (getFileObjectAndFind($strCFilePath)) { return setError(sprintf(_('Page %s ever exists.'), $strNewName)); } //Copy the html file if (!parent::Copy($strCFileName, $strParentPath)) { return false; } //then copy the ini file if exists if (!($oCPage =& getFileObject($strCFilePath))) { return setError(_('Internal Error. In copy, page not exists')); } if (is_file($this->oPConfigFile->path)) { if (!$this->oPConfigFile->Copy($oCPage->oPConfigFile->getName(), $strParentPath)) { return false; } } //reset the MENU NAME for the newfile, set the menu order and set the virtual name if (!$oCPage->oPConfigFile->setParam('MENU_NAME', '')) { return false; } if (!$oCPage->oPConfigFile->setParam('MENU_ORDER', '99')) { return false; } if (!$oCPage->setVirtualName($strCPageName)) { return false; } return true; }
/** * Function: getMenu * Generate a table of the structure of the site * If adminMode is true take also the not published pages, else take only published page * The menu is cached in the menu.cache file as a serialize element, in adminmode the cache is not use, * but in production mode only the directory structure is parsed only if menu.cache file not exists. * * @rev: 1.0 July 2008 * * @param adminMode, boolean take or not take the not published pages * @return a table of the structure of the web site, each element of the menu contains: * NAME of the element, the URL, the ID and the PATH to this element * */ function getMenu($adminMode = false) { $oMenuFile = new PTextFile(SMARTY_CACHE_DIR . 'menu.cache'); //if tabmenu is in cache and not in admin mod, load the menu from cache if ($adminMode === false && is_file($oMenuFile->path)) { if ($strMenu = unserialize(file_get_contents($oMenuFile->path))) { return $strMenu; } } $tabMenu =& $this->getMenuFromDir(getFileObject(PAGES_PATH), $adminMode); if ($adminMode === false) { if (!$oMenuFile->Save(serialize($tabMenu), false)) { die(getError()); } } return $tabMenu; }