Beispiel #1
0
    echo utf8_decode(L_ERR_PLUXML_ALREADY_INSTALLED);
    exit;
}
# Control du token du formulaire
plxToken::validateFormToken($_POST);
# Vérification de l'existence des dossiers médias
if (!is_dir(PLX_ROOT . 'data/medias')) {
    @mkdir(PLX_ROOT . 'data/medias', 0755, true);
}
# Vérification de l'existence du dossier data/configuration/plugins
if (!is_dir(PLX_ROOT . PLX_CONFIG_PATH . 'plugins')) {
    @mkdir(PLX_ROOT . PLX_CONFIG_PATH . 'plugins', 0755, true);
}
# Echappement des caractères
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $_POST = plxUtils::unSlash($_POST);
}
# Initialisation du timezone
$timezone = 'Europe/Paris';
if (isset($_POST['timezone'])) {
    $timezone = $_POST['timezone'];
}
if (!array_key_exists($timezone, plxTimezones::timezones())) {
    $timezone = date_default_timezone_get();
}
# Configuration de base
$config = array('title' => 'PluXml', 'description' => plxUtils::strRevCheck(L_SITE_DESCRIPTION), 'meta_description' => '', 'meta_keywords' => '', 'timezone' => $timezone, 'allow_com' => 1, 'mod_com' => 0, 'mod_art' => 0, 'capcha' => 1, 'style' => 'defaut', 'clef' => plxUtils::charAleatoire(15), 'bypage' => 5, 'bypage_archives' => 5, 'bypage_admin' => 10, 'bypage_admin_coms' => 10, 'bypage_feed' => 8, 'tri' => 'desc', 'tri_coms' => 'asc', 'images_l' => 800, 'images_h' => 600, 'miniatures_l' => 200, 'miniatures_h' => 100, 'thumbs' => 1, 'medias' => 'data/medias/', 'racine_articles' => 'data/articles/', 'racine_commentaires' => 'data/commentaires/', 'racine_statiques' => 'data/statiques/', 'racine_themes' => 'themes/', 'racine_plugins' => 'plugins/', 'homestatic' => '', 'hometemplate' => 'home.php', 'urlrewriting' => 0, 'gzip' => 0, 'feed_chapo' => 0, 'feed_footer' => '', 'version' => PLX_VERSION, 'default_lang' => $lang, 'userfolders' => 0, 'display_empty_cat' => 0, 'custom_admincss_file' => '');
function install($content, $config)
{
    # gestion du timezone
    date_default_timezone_set($config['timezone']);
Beispiel #2
0
 *
 * @package PLX
 * @author	Stephane F et Florent MONTHEL
 **/
include dirname(__FILE__) . '/prepend.php';
# Suppression des articles selectionnes
if (isset($_POST['selection']) and $_POST['selection'] == 'delete' and isset($_POST['idArt'])) {
    foreach ($_POST['idArt'] as $k => $v) {
        $plxAdmin->delArticle($v);
    }
    header('Location: index.php');
    exit;
}
# Check des variables GET pour la recherche
$_GET['catId'] = !empty($_GET['catId']) ? plxUtils::unSlash(trim($_GET['catId'])) : '';
$_GET['artTitle'] = !empty($_GET['artTitle']) ? plxUtils::unSlash(trim($_GET['artTitle'])) : '';
# On génère notre motif de recherche
$userId = $_SESSION['profil'] < PROFIL_WRITER ? '[0-9]{3}' : $_SESSION['user'];
if ($_GET['catId'] != '') {
    $motif = '/^[0-9]{4}.(.*)' . $_GET['catId'] . '(.*).' . $userId . '.[0-9]{12}.(.*)' . plxUtils::title2filename($_GET['artTitle']) . '(.*).xml$/';
} else {
    $motif = '/^[0-9]{4}.([0-9,|home|draft]*).' . $userId . '.[0-9]{12}.(.*)' . plxUtils::title2filename($_GET['artTitle']) . '(.*).xml$/';
}
# Traitement
$plxAdmin->prechauffage('admin', $motif, $plxAdmin->aConf['bypage_admin']);
$plxAdmin->getPage();
# Recuperation de la page
$plxAdmin->getFiles('all');
# Recuperation des fichiers
$plxAdmin->getArticles();
# Recuperation des articles
Beispiel #3
0
 /**
  * Méthode qui effectue le traitement selon le mode du moteur
  *
  * @return	null
  * @author	Florent MONTHEL, Stephane F
  **/
 public function demarrage()
 {
     # Hook plugins
     if (eval($this->plxPlugins->callHook('plxMotorDemarrageBegin'))) {
         return;
     }
     if ($this->mode == 'home' or $this->mode == 'categorie' or $this->mode == 'archives' or $this->mode == 'tags') {
         $this->getPage();
         # Recuperation du numéro de la page courante
         if (!$this->getArticles()) {
             # Si aucun article
             $this->error404(L_NO_ARTICLE_PAGE);
         }
     } elseif ($this->mode == 'article') {
         # On a validé le formulaire commentaire
         if (!empty($_POST) and $this->plxRecord_arts->f('allow_com') and $this->aConf['allow_com']) {
             # On récupère le retour de la création
             $retour = $this->newCommentaire($this->cible, plxUtils::unSlash($_POST));
             # Url de l'article
             $url = $this->urlRewrite('?article' . intval($this->plxRecord_arts->f('numero')) . '/' . $this->plxRecord_arts->f('url'));
             eval($this->plxPlugins->callHook('plxMotorDemarrageNewCommentaire'));
             if ($retour[0] == 'c') {
                 # Le commentaire a été publié
                 header('Location: ' . $url . '#' . $retour);
             } elseif ($retour == 'mod') {
                 # Le commentaire est en modération
                 $_SESSION['msgcom'] = L_COM_IN_MODERATION;
                 header('Location: ' . $url . '#form');
             } else {
                 $_SESSION['msgcom'] = $retour;
                 $_SESSION['msg']['name'] = plxUtils::unSlash($_POST['name']);
                 $_SESSION['msg']['site'] = plxUtils::unSlash($_POST['site']);
                 $_SESSION['msg']['mail'] = plxUtils::unSlash($_POST['mail']);
                 $_SESSION['msg']['content'] = plxUtils::unSlash($_POST['content']);
                 $_SESSION['msg']['parent'] = plxUtils::unSlash($_POST['parent']);
                 eval($this->plxPlugins->callHook('plxMotorDemarrageCommentSessionMessage'));
                 header('Location: ' . $url . '#form');
             }
             exit;
         }
         # Récupération des commentaires
         $this->getCommentaires('/^' . $this->cible . '.[0-9]{10}-[0-9]+.xml$/', $this->mapTri($this->tri_coms));
         $this->template = $this->plxRecord_arts->f('template');
         if ($this->aConf['capcha']) {
             $this->plxCapcha = new plxCapcha();
         }
         # Création objet captcha
     } elseif ($this->mode == 'preview') {
         $this->mode = 'article';
         $this->plxRecord_arts = new plxRecord($_SESSION['preview']);
         $this->template = $this->plxRecord_arts->f('template');
         if ($this->aConf['capcha']) {
             $this->plxCapcha = new plxCapcha();
         }
         # Création objet captcha
     }
     # Hook plugins
     eval($this->plxPlugins->callHook('plxMotorDemarrageEnd'));
 }
Beispiel #4
0
        break;
    case '000':
        $catIdSel = str_replace('FILTER', '000', $catIdSel);
        break;
    case 'home':
        $catIdSel = str_replace('FILTER', 'home', $catIdSel);
        break;
    case preg_match('/^[0-9]{3}$/', $_SESSION['sel_cat']) == 1:
        $catIdSel = str_replace('FILTER', $_SESSION['sel_cat'], $catIdSel);
}
# Nombre d'article sélectionnés
$nbArtPagination = $plxAdmin->nbArticles($catIdSel, $userId);
# Récupération du texte à rechercher
$artTitle = !empty($_GET['artTitle']) ? plxUtils::unSlash(trim(urldecode($_GET['artTitle']))) : '';
if (empty($artTitle)) {
    $artTitle = !empty($_POST['artTitle']) ? plxUtils::unSlash(trim(urldecode($_POST['artTitle']))) : '';
}
$_GET['artTitle'] = $artTitle;
# On génère notre motif de recherche
$motif = '/^' . $mod . '[0-9]{4}.' . $catIdSel . '.' . $userId . '.[0-9]{12}.(.*)' . plxUtils::title2filename($_GET['artTitle']) . '(.*).xml$/';
# Calcul du nombre de page si on fait une recherche
if ($_GET['artTitle'] != '') {
    if ($arts = $plxAdmin->plxGlob_arts->query($motif)) {
        $nbArtPagination = sizeof($arts);
    }
}
# Traitement
$plxAdmin->prechauffage($motif);
$plxAdmin->getPage();
$arts = $plxAdmin->getArticles('all');
# Recuperation des articles
Beispiel #5
0
    /**
     * Méthode statique qui affiche le formulaire de recherche
     *
     * @return	stdio
     * @author	Stephane F
     **/
    public static function form($title = false)
    {
        $placeholder = '';
        # récupération d'une instance de plxMotor
        $plxMotor = plxMotor::getInstance();
        $plxPlugin = $plxMotor->plxPlugins->getInstance('plxMySearch');
        $searchword = '';
        if (!empty($_POST['searchfield'])) {
            $searchword = plxUtils::strCheck(plxUtils::unSlash($_POST['searchfield']));
        }
        if ($plxPlugin->getParam('placeholder_' . $plxPlugin->default_lang) != '') {
            $placeholder = ' placeholder="' . $plxPlugin->getParam('placeholder_' . $plxPlugin->default_lang) . '"';
        }
        ?>

<div class="searchform">
	<form action="<?php 
        echo $plxMotor->urlRewrite('?' . $plxPlugin->getParam('url'));
        ?>
" method="post">
		<?php 
        if ($title) {
            ?>
		<p class="searchtitle">
			<?php 
            if ($plxPlugin->getParam('checkboxes_' . $plxPlugin->default_lang) == '') {
                $plxPlugin->lang('L_FORM_SEARCHFIELD');
            } else {
                $plxPlugin->lang('L_FORM_SEARCHFIELD_2');
            }
            ?>
&nbsp;:
		</p>
		<?php 
        }
        ?>
		<div class="searchfields">
			<?php 
        if ($plxPlugin->getParam('checkboxes_' . $plxPlugin->default_lang) != '') {
            if ($chk = explode(';', $plxPlugin->getParam('checkboxes_' . $plxPlugin->default_lang))) {
                echo '<ul>';
                foreach ($chk as $k => $v) {
                    $c = plxUtils::title2url(trim($v));
                    $sel = "";
                    if (isset($_POST['searchcheckboxes'])) {
                        foreach ($_POST['searchcheckboxes'] as $s) {
                            if ($s == $c) {
                                $sel = ' checked="checked"';
                            }
                        }
                    }
                    echo '<li><input' . $sel . ' class="searchcheckboxes" type="checkbox" name="searchcheckboxes[]" id="id_searchcheckboxes[]" value="' . $c . '" />&nbsp;' . plxUtils::strCheck($v) . '</li>';
                }
                echo '</ul>';
            }
        }
        ?>
			<input type="text"<?php 
        echo $placeholder;
        ?>
 class="searchfield" name="searchfield" value="<?php 
        echo $searchword;
        ?>
" />
			<input type="submit" class="searchbutton" name="searchbutton" value="<?php 
        echo $plxPlugin->getParam('frmLibButton_' . $plxPlugin->default_lang);
        ?>
" />
			</p>
		</div>
	</form>
</div>

	<?php 
    }
Beispiel #6
0
             $art_url = $art['url'];
             $art_title = plxUtils::strCheck($art['title']);
             $art_date = plxDate::formatDate($art['date'], $format_date);
             echo '<li>' . $art_date . ': <a href="' . $plxMotor->urlRewrite('?article' . $art_num . '/' . $art_url) . '">' . $art_title . '</a></li>';
         }
     }
 }
 # recherche dans les pages statiques
 if ($plxMotor->aStats) {
     foreach ($plxMotor->aStats as $k => $v) {
         if ($v['active'] == 1 and $v['url'] != $plxMotor->mode) {
             # si la page est bien active
             $filename = PLX_ROOT . $plxMotor->aConf['racine_statiques'] . $k . '.' . $v['url'] . '.php';
             if (file_exists($filename)) {
                 $searchstring = strtolower(plxUtils::strRevCheck(file_get_contents($filename)));
                 $searchstring = plxUtils::unSlash($searchstring);
                 $searchok = false;
                 foreach ($searchwords as $word) {
                     if (strpos($searchstring, $word) !== false) {
                         $searchok = true;
                     }
                 }
                 if ($searchok) {
                     $searchresults = true;
                     $stat_num = intval($k);
                     $stat_url = $v['url'];
                     $stat_title = plxUtils::strCheck($v['name']);
                     echo '<li><a href="' . $plxMotor->urlRewrite('?static' . $stat_num . '/' . $stat_url) . '">' . $stat_title . '</a></li>';
                 }
             }
         }
Beispiel #7
0
 /**
  * Méthode qui effectue le traitement selon le mode du moteur
  *
  * @return	null
  * @author	Florent MONTHEL, Stephane F
  **/
 public function demarrage()
 {
     if ($this->mode == 'home' or $this->mode == 'categorie' or $this->mode == 'archives' or $this->mode == 'tags') {
         if ($this->mode == 'categorie' and empty($this->aCats[$this->cible])) {
             # Catégorie inexistante
             $this->plxErreur = new plxErreur('Cette cat&eacute;gorie est inexistante !');
             $this->mode = 'erreur';
             return;
         }
         $this->getPage();
         # Recuperation de la page
         $this->getFiles('before');
         # Recuperation des fichiers
         $this->getArticles();
         # Recuperation des articles
         if (!$this->plxGlob_arts->count or !$this->plxRecord_arts->size) {
             # Aucun article
             $this->plxErreur = new plxErreur('Aucun article pour cette page !');
             $this->mode = 'erreur';
             $this->template = 'erreur.php';
             return;
         }
     } elseif ($this->mode == 'article') {
         $this->getFiles('before');
         # Recuperation des fichiers
         $this->getArticles();
         # Recuperation des articles
         if (!$this->plxGlob_arts->count or !$this->plxRecord_arts->size) {
             # Aucun article
             $this->plxErreur = new plxErreur('Cet article n\'existe pas ou n\'existe plus !');
             $this->mode = 'erreur';
             $this->template = 'erreur.php';
             return;
         }
         # On a validé le formulaire commentaire
         if (!empty($_POST) and $this->plxRecord_arts->f('allow_com') and $this->aConf['allow_com']) {
             # On récupère le retour de la création
             $retour = $this->newCommentaire($this->cible, plxUtils::unSlash($_POST));
             # Url de l'article
             $url = $this->urlRewrite('?article' . intval($this->plxRecord_arts->f('numero')) . '/' . $this->plxRecord_arts->f('url'));
             if ($retour[0] == 'c') {
                 # Le commentaire a été publié
                 header('Location: ' . $url . '/#' . $retour);
             } elseif ($retour == 'mod') {
                 # Le commentaire est en modération
                 $_SESSION['msgcom'] = 'Le commentaire est en cours de mod&eacute;ration par l\'administrateur de ce site';
                 header('Location: ' . $url . '/#form');
             } else {
                 $_SESSION['msgcom'] = $retour;
                 $_SESSION['msg'] = array('name' => plxUtils::unSlash($_POST['name']), 'site' => plxUtils::unSlash($_POST['site']), 'mail' => plxUtils::unSlash($_POST['mail']), 'content' => plxUtils::unSlash($_POST['content']));
                 header('Location: ' . $url . '/#form');
             }
             exit;
         }
         # Récupération des commentaires
         $this->getCommentaires('/^' . $this->cible . '.[0-9]{10}-[0-9]+.xml$/', $this->mapTri($this->tri_coms));
         $this->template = $this->plxRecord_arts->f('template');
     } elseif ($this->mode == 'static') {
         # On va verifier que la page existe vraiment
         if (!isset($this->aStats[$this->cible]) or intval($this->aStats[$this->cible]['active']) != 1) {
             $this->plxErreur = new plxErreur('Cette page n\'existe pas ou n\'existe plus !');
             $this->mode = 'erreur';
             $this->template = 'erreur.php';
             return;
         }
     } elseif ($this->mode == 'telechargement') {
         # On va verifier que la page existe vraiment
         if (!$this->sendTelechargement($this->cible)) {
             $this->plxErreur = new plxErreur('Le document sp&eacute;cifi&eacute; est introuvable');
             $this->mode = 'erreur';
             $this->template = 'erreur.php';
             return;
         }
     }
 }