Exemplo n.º 1
0
 function se_get_config($strParam, &$strValue)
 {
     global $seConfigFile;
     if (!$seConfigFile) {
         $oDir = new PDir(dirname(__FILE__));
         $oPlugin = new PPluginDir($oDir->getParentPath());
         $seConfigFile = $oPlugin->oConfig;
     }
     if ($strParam == 'tablename') {
         if (!$seConfigFile->getParam('PREFIX', $strPrefix)) {
             return false;
         }
         $strValue = $strPrefix . 'searchengine';
     } else {
         if (!$seConfigFile->getParam($strParam, $strValue)) {
             return false;
         }
     }
     if ($strValue === "true") {
         $strValue = true;
     }
     if ($strValue === "false") {
         $strValue = false;
     }
     return true;
 }
Exemplo n.º 2
0
/**
 * Function sortpages
 * This fonction is call by the sortfile javascript plugins.
 * It renames the files. The file begin with a number are ordered.
 * 
 * If an object file not begin with a number, it is not ordered. 
 * 
 * @return: true if suceed, else return false.
 */
function sortpages()
{
    if (!isset($_REQUEST['filename'])) {
        return setError('Internal error in sortfiles, filename not defined');
    }
    $tabFilesNew = $_REQUEST['filename'];
    //if less than two files no need to sort
    if (sizeof($tabFilesNew) < 2) {
        return true;
    }
    //get the dir to order, take the second element because in some cas the first element is ../
    $pTemp = new PFile(SITE_PATH . urljsdecode($tabFilesNew[1]));
    $oDirToOrder = new PDir($pTemp->getParentPath());
    $i = 0;
    foreach ($tabFilesNew as $strFile) {
        $strFile = urljsdecode($strFile);
        //if not parent file
        if (SITE_PATH . $strFile != $oDirToOrder->getParentPath()) {
            //get the file number, if number exist reorder it
            //this is the original file number, if modified twice it change in php but not in html
            $oFileTest = new PFile($oDirToOrder->path . SLASH . basename($strFile));
            if ($oFileTest->is_page() || $oFileTest->is_dircategory() || $oFileTest->is_link()) {
                $oFile = getFileObject($oFileTest->path);
                $iCurrOrder = $oFile->getMenuOrder();
                $i++;
                if ($iCurrOrder != $i) {
                    //print('reorder '.$oFile->getName().' from '.$iCurrOrder.' to '.$i);
                    if (!$oFile->setMenuOrder($i)) {
                        return false;
                    }
                }
                //if file order has changed
            }
            //end if filenumber is set
        }
        //end if ofile not parent dir
    }
    //end foreach
    return true;
}