/**
 * extrapage_sitemap
 * This is the extrapagesite map event function
 * This function check the name of the page and if it is sitemap.xml, generate the site map.
 *
 * @param unknown_type $strPage
 * @param unknown_type $site
 * @return unknown
 */
function extrapage_sitemap($strPage, &$site)
{
    if ($strPage == 'sitemap.xml') {
        $strTplFile = dirname(__FILE__) . SLASH . 'google_sitemap.tpl';
        if (!$site->template_exists($strTplFile)) {
            setError('Error in plugin google site map. Can not find the google_sitemap.tpl file.');
            printFatalHtmlError();
            die;
        }
        header('Content-Type: text/xml;');
        $site->display($strTplFile);
        return true;
    }
    return false;
}
Beispiel #2
0
 if (!defined('SITENAME')) {
     define('SITENAME', false);
 }
 define("SITE", 'sites' . (SITENAME ? SLASH . SITENAME : ''));
 //Config File
 require 'lib/psiteconfigfile.php';
 define("CONFIG_DIR", SITE_PATH . SITE . SLASH . 'config' . SLASH);
 if (is_file(CONFIG_DIR . 'myconfig.php')) {
     include CONFIG_DIR . 'myconfig.php';
 }
 define('CONFIG_FILE', CONFIG_DIR . 'config.ini');
 $configDescr = SITE_PATH . 'core' . SLASH . 'default_config.ini';
 $configDescr = is_file($configDescr) ? $configDescr : false;
 $configFile = new PSiteConfigFile(CONFIG_FILE, $configDescr);
 if (!$configFile->parse()) {
     printFatalHtmlError();
 }
 define('SITE_URL', $configFile->getDirectParam('SITE_URL'));
 define('PLUGINS_DIR', SITE_PATH . 'plugins');
 define('PAGES', 'pages');
 define('PAGES_PATH', SITE_PATH . SITE . SLASH . PAGES . SLASH . 'languages');
 define('PAGES_MODELS_PATH', SITE_PATH . SITE . SLASH . PAGES . SLASH . "models");
 define('CACHE_DIR', SITE_PATH . SITE . SLASH . PAGES . SLASH . "cache" . SLASH);
 if (!defined('MEDIAS_PATH')) {
     define('MEDIAS_PATH', SITE_PATH . SITE . SLASH . PAGES . SLASH . 'medias');
 }
 define('THEME_DIR', SITE . SLASH . 'theme' . SLASH);
 define('THEME_URL', SITE_URL . (SLASH != '/' ? str_replace(SLASH, '/', THEME_DIR) : THEME_DIR));
 //SMARTY CONFIG
 define("SMARTY_DIR", 'vendors' . SLASH . 'php' . SLASH . "smarty" . SLASH);
 //CACHES
Beispiel #3
0
                     * savesiteconfig, toggleactivateplugin, sortfiles, ajaxgettext,renamefile, loadhistorypage, upload, createdir, clearcache
                     */
                    if (function_exists($action)) {
                        if (!call_user_func($action)) {
                            printFatalHtmlError();
                        }
                    } else {
                        printFatalHtmlError('Action Unknown');
                    }
                    break;
            }
        } else {
            printFatalHtmlError('Internal error, action must me defined');
        }
    } else {
        printFatalHtmlError('You are not connected', 505);
    }
    die;
}
function toggleactivateplugin()
{
    global $configFile;
    if (!isset($_REQUEST["plugin"]) || !isset($_REQUEST["value"])) {
        setError('Internal Error in togleactivateplugin');
    }
    $strPluginName = urljsdecode($_REQUEST["plugin"]);
    $strValue = urljsdecode($_REQUEST["value"]);
    $oPluginDir = new PPluginDir(PLUGINS_DIR . SLASH . $strPluginName);
    if (!$oPluginDir->isDir()) {
        return setError(sprintf(_('Can not find the plugin %s'), $strPluginName));
    }
Beispiel #4
0
 /**
  * Function: display
  * If page has not been cached, calculate it.
  * Then call the smarty display fonction
  *
  *
  * param: &$oPage, a reference to the object page to display
  */
 function displayPage(&$oPage)
 {
     $strTemplateName = $oPage->getTemplateName();
     $strCompiledId = $this->getCompiledId();
     $this->oPageCurrent =& $oPage;
     $this->register_object('oPageCurrent', $oPage);
     //if page must not be cached, set the site cache to 0
     $this->caching = $this->caching && $oPage->isCached() ? 1 : 0;
     //on regénére le menu si le menu n'existe pas en cache ou si la page courante a été modifiée après le menu
     $bGenerateMenu = !is_file(SMARTY_CACHE_DIR . 'menu.cache');
     //|| (is_file(SMARTY_CACHE_DIR.'menu.cache') && $oPage->getModifiedTime()>filemtime(SMARTY_CACHE_DIR.'menu.cache'));
     //rebuild menu not exist (a page has been updated) or the page if cache not exists or page not use cache
     if ($bGenerateMenu || $this->caching == 0 || $this->force_compile || !$this->is_cached($strTemplateName, $strCompiledId)) {
         //check that the template file exists
         if (!is_file($this->template_dir . SLASH . $strTemplateName)) {
             setError(sprintf(_("The template file %s doesn't exist."), $strTemplateName));
             printFatalHtmlError();
         }
         //si on doit regénérer le menu, on le supprime avant
         if ($bGenerateMenu) {
             if (!deleteMenuCache()) {
                 printFatalError();
             }
         }
         //assign the menu
         $this->assign_by_ref("menu", $this->getMenu(isConnected()));
         $this->assign("PAGE_PATH", $oPage->path);
         $this->assign("PAGE_CONTENU", $oPage->path);
         $this->assign("PAGE_PATH_TITLE", $oPage->getPagePathForTitle());
         $this->assign('MEDIAS_URL', POFile::getPathUrl(MEDIAS_PATH));
         $oPageConfigFile = $oPage->getConfigFileObject();
         if (is_file($oPageConfigFile->path)) {
             $this->assign("CONFIG_FILE_PAGE", $oPageConfigFile->path);
         }
         $oCatConfigFile = $oPage->getConfigFileObjectCategory();
         if (is_file($oCatConfigFile->path)) {
             $this->assign("CONFIG_FILE_CATAGORY", $oCatConfigFile->path);
         }
         //we load filter only in case of cache
         $this->loadAdminFilters();
     }
     //end calcul
     if (true || checkKey()) {
         //display the page !!
         $strContent = parent::fetch($strTemplateName, $strCompiledId);
         doEventAction('beforedisplay', array(&$strContent, &$this));
         echo $strContent;
     } else {
         printError();
     }
 }