Example #1
0
 function getMimeIconUrl($thumb_size)
 {
     $strThumbFile = $this->getParentPath() . SLASH . 'images' . SLASH . $this->getNameWithoutExt() . '.gif';
     if (is_file($strThumbFile)) {
         require SITE_PATH . 'core/lib/pimage.php';
         $oThumb = new PImage($strThumbFile);
         return $oThumb->getMimeIconUrl($thumb_size);
     }
     return parent::getMimeIconUrl($thumb_size);
 }
Example #2
0
function loadhistorypage()
{
    if (!isset($_REQUEST['strPage'])) {
        return setError('Internal error in loadhistorypage');
    }
    // recup content html
    $oPpage = new PPage($_REQUEST['strPage']);
    $fckContent = $oPpage->getEditorFileContent();
    echo $fckContent;
    return true;
}
Example #3
0
 function PLink($strPath)
 {
     parent::PPage($strPath);
     $strContent = file_get_contents($this->path);
     $this->oLinkedPage = getFileObjectAndFind(PAGES_PATH . SLASH . $strContent);
 }
Example #4
0
 function rename_info_search(&$oPage, &$strNewPageName)
 {
     if (!se_get_config('tablename', $strTable)) {
         return false;
     }
     if (!connectBdd()) {
         return false;
     }
     /* init value and bdd */
     $dateModif = date("d-m-Y");
     $oPageNew = new PPage($strNewPageName);
     $newname = addslashes($oPageNew->getMenuName());
     $url = cleanUrl($oPage->getUrl());
     $newUrl = cleanUrl($oPageNew->getUrl());
     $published = $oPage->isPublished();
     $sql = "UPDATE {$strTable} SET nom = '{$newname}' , url = '{$newUrl}' , date_modif = '{$dateModif}', published = '{$published}' WHERE url = '{$url}'";
     /* save value */
     if (!mysql_query($sql)) {
         return closeBdd(sprintf(_('Mysql Error occured : %s'), mysql_error()));
     }
     return closeBdd();
 }
Example #5
0
 /**
  * Rename the page.
  * This function is called to rename the page.
  * If the new name of the page contains specific caracters as éà, it is replace by ea,
  * but the menu name is set with special caracters
  * An event is attached to this fonction: renamepage
  * This event is used for example by the search engine plugin to index the file content.
  * 
  * The difference between move and rename, is that in move do not set the menu title !!
  * @param string $newname, the new name (basename)
  * @param string $destDir, if == false the parent dir
  * @return true if suceed
  */
 function Rename($newname, $destDir = false)
 {
     $fileNewName = $this->getUnixName($newname);
     $pageNewName = $newname;
     $pageCurrName = $this->getVirtualName();
     $fileCurrName = $this->getName();
     if (strlen($fileNewName) == 0) {
         return setError(_('Can not rename with empty name'));
     }
     //manage extensions
     $oFile = new PFile($fileNewName);
     if ($oFile->getExtension() == '') {
         $fileNewName .= '.' . $this->getExtension();
     } else {
         $oFile = new PFile($pageNewName);
         $pageNewName = $oFile->getNameWithoutExt();
     }
     if ($fileNewName == $fileCurrName && $pageCurrName == $pageNewName && $destDir === false) {
         return true;
     }
     //check the name is valid, not a php file or a cgi one for example
     if (!$this->checkname($pageNewName)) {
         return false;
     }
     //set the menu name in the ini file if has been renamed !! not moved
     if (!$destDir && !$this->setVirtualName($pageNewName)) {
         return false;
     }
     if ($fileCurrName != $fileNewName || $destDir !== false) {
         //if history dir exists, rename it
         $oDirHistoryCache = new PDir(CACHE_HIST_DIR . SLASH . $this->getId());
         if (is_dir($oDirHistoryCache->path)) {
             $destDirModify = !$destDir ? $this->getParentPath() : $destDir;
             if (substr($destDirModify, -1) == SLASH) {
                 $destDirModify = substr($destDirModify, 0, strlen($destDirModify) - 1);
             }
             $oPageNewHistory = new PPage($destDirModify . SLASH . $fileNewName);
             $strNewHistoryName = $oPageNewHistory->getId();
             if ($this->getId() != $strNewHistoryName) {
                 if (!$oDirHistoryCache->Rename($strNewHistoryName)) {
                     return false;
                 }
             }
         }
         if (!doEventAction('renamepage', array(&$this, ($destDir ? $destDir : $this->getParentPath()) . SLASH . $fileNewName))) {
             return false;
         }
         //on supprime le cache du menu
         if (!deleteMenuCache()) {
             return false;
         }
         //rename the config file if exists
         if (is_file($this->oPConfigFile->path)) {
             $oFileTmp = new PFile($fileNewName);
             if (!$this->oPConfigFile->Rename($oFileTmp->getNameWithoutExt() . ".ini", $destDir)) {
                 return false;
             }
         }
         if (!parent::Rename($fileNewName, $destDir)) {
             return false;
         }
     }
     return true;
 }
Example #6
0
 function menuEditContent($url = '')
 {
     $oIndexFile = new PPage($this->path . SLASH . '/' . 'index.html');
     //search index file in the category
     $tabIndex = $this->listDir($this->ONLY_FILES, $fullpath = true, $filter = 'index\\.htm[l]?$');
     if (sizeof($tabIndex) > 0) {
         $oIndexFile = new PPage($tabIndex[0]);
     }
     return "<li><a href=\"admin_file_editor.php?file=" . urlencode($oIndexFile->getRelativePath()) . "\" id=\"edit\" title=\"" . _("Edit") . "\">" . _("Edit") . "</a></li>";
 }