/**
  * Méthode qui effectue une mise a jour d'un commentaire
  *
  * @param	content	données du commentaire à mettre à jour
  * @param	id	identifiant du commentaire
  * @return	string
  * @author	Stephane F. et Florent MONTHEL
  **/
 public function editCommentaire($content, &$id)
 {
     # Vérification de la validité de la date de publication
     if (!plxDate::checkDate($content['day'], $content['month'], $content['year'], $content['time'])) {
         return plxMsg::Error(L_ERR_INVALID_PUBLISHING_DATE);
     }
     $comment = array();
     # Génération du nom du fichier
     $comment['filename'] = $id . '.xml';
     if (!file_exists(PLX_ROOT . $this->aConf['racine_commentaires'] . $comment['filename'])) {
         # Commentaire inexistant
         return plxMsg::Error(L_ERR_UNKNOWN_COMMENT);
     }
     # Contrôle des saisies
     if (trim($content['mail']) != '' and !plxUtils::checkMail(trim($content['mail']))) {
         return plxMsg::Error(L_ERR_INVALID_EMAIL);
     }
     if (trim($content['site']) != '' and !plxUtils::checkSite($content['site'])) {
         return plxMsg::Error(L_ERR_INVALID_SITE);
     }
     # On récupère les infos du commentaire
     $com = $this->parseCommentaire(PLX_ROOT . $this->aConf['racine_commentaires'] . $comment['filename']);
     # Formatage des données
     $comment['author'] = plxUtils::strCheck(trim($content['author']));
     $comment['site'] = plxUtils::strCheck(trim($content['site']));
     if ($com['type'] != 'admin') {
         $comment['content'] = plxUtils::strCheck(trim($content['content']));
     } else {
         $comment['content'] = strip_tags(trim($content['content']), '<a>,<strong>');
     }
     $comment['ip'] = $com['ip'];
     $comment['type'] = $com['type'];
     $comment['mail'] = $content['mail'];
     $comment['site'] = $content['site'];
     $comment['parent'] = $com['parent'];
     # Génération du nouveau nom du fichier
     $time = explode(':', $content['time']);
     $newtimestamp = mktime($time[0], $time[1], 0, $content['month'], $content['day'], $content['year']);
     $com = $this->comInfoFromFilename($id . '.xml');
     $newid = $com['comStatus'] . $com['artId'] . '.' . $newtimestamp . '-' . $com['comIdx'];
     $comment['filename'] = $newid . '.xml';
     # Suppression de l'ancien commentaire
     $this->delCommentaire($id);
     # Création du nouveau commentaire
     $id = $newid;
     if ($this->addCommentaire($comment)) {
         return plxMsg::Info(L_COMMENT_SAVE_SUCCESSFUL);
     } else {
         return plxMsg::Error(L_COMMENT_UPDATE_ERR);
     }
 }
Beispiel #2
0
     exit;
 }
 # Mode création ou maj
 if (isset($_POST['update']) or isset($_POST['publish']) or isset($_POST['moderate']) or isset($_POST['draft'])) {
     $valid = true;
     # Vérification de l'unicité de l'url
     $_POST['url'] = plxUtils::title2url(trim($_POST['url']) == '' ? $_POST['title'] : $_POST['url']);
     foreach ($plxAdmin->plxGlob_arts->aFiles as $numart => $filename) {
         if (preg_match("/^_?[0-9]{4}.([0-9,|home|draft]*).[0-9]{3}.[0-9]{12}." . $_POST["url"] . ".xml\$/", $filename)) {
             if ($numart != str_replace('_', '', $_POST['artId'])) {
                 $valid = plxMsg::Error(L_ERR_URL_ALREADY_EXISTS . " : " . plxUtils::strCheck($_POST["url"])) and $valid;
             }
         }
     }
     # Vérification de la validité de la date de publication
     if (!plxDate::checkDate($_POST['day'], $_POST['month'], $_POST['year'], $_POST['time'])) {
         $valid = plxMsg::Error(L_ERR_INVALID_PUBLISHING_DATE) and $valid;
     }
     if ($valid) {
         $plxAdmin->editArticle($_POST, $_POST['artId']);
         header('Location: article.php?a=' . $_POST['artId']);
         exit;
         # Si url ou date invalide, on ne sauvegarde pas mais on repasse en mode brouillon
     } else {
         array_unshift($_POST['catId'], 'draft');
     }
 }
 # Ajout d'une catégorie
 if (isset($_POST['new_category'])) {
     # Ajout de la nouvelle catégorie
     $plxAdmin->editCategories($_POST);
Beispiel #3
0
include dirname(__FILE__) . '/prepend.php';
# Hook Plugins
eval($plxAdmin->plxPlugins->callHook('AdminStaticPrepend'));
# Control du token du formulaire
plxToken::validateFormToken($_POST);
# Control de l'accès à la page en fonction du profil de l'utilisateur connecté
$plxAdmin->checkProfil(PROFIL_ADMIN, PROFIL_MANAGER);
# On édite la page statique
if (!empty($_POST) and isset($plxAdmin->aStats[$_POST['id']])) {
    $valid = true;
    # Vérification de la validité de la date de création
    if (!plxDate::checkDate($_POST['date_creation_day'], $_POST['date_creation_month'], $_POST['date_creation_year'], $_POST['date_creation_time'])) {
        $valid = plxMsg::Error(L_ERR_INVALID_DATE_CREATION) and $valid;
    }
    # Vérification de la validité de la date de mise à jour
    if (!plxDate::checkDate($_POST['date_update_day'], $_POST['date_update_month'], $_POST['date_update_year'], $_POST['date_update_time'])) {
        $valid = plxMsg::Error(L_ERR_INVALID_DATE_UPDATE) and $valid;
    }
    if ($valid) {
        $plxAdmin->editStatique($_POST);
    }
    header('Location: statique.php?p=' . $_POST['id']);
    exit;
} elseif (!empty($_GET['p'])) {
    # On affiche le contenu de la page
    $id = plxUtils::strCheck(plxUtils::nullbyteRemove($_GET['p']));
    if (!isset($plxAdmin->aStats[$id])) {
        plxMsg::Error(L_STATIC_UNKNOWN_PAGE);
        header('Location: statiques.php');
        exit;
    }
Beispiel #4
0
     exit;
 }
 # Mode création ou maj
 if (isset($_POST['update']) or isset($_POST['publish']) or isset($_POST['moderate']) or isset($_POST['draft'])) {
     $valid = true;
     # Vérification de l'unicité de l'url
     $_POST['url'] = plxUtils::title2url(trim($_POST['url']) == '' ? $_POST['title'] : $_POST['url']);
     foreach ($plxAdmin->plxGlob_arts->aFiles as $numart => $filename) {
         if (preg_match("/^_?[0-9]{4}.([0-9,|home|draft]*).[0-9]{3}.[0-9]{12}." . $_POST["url"] . ".xml\$/", $filename)) {
             if ($numart != str_replace('_', '', $_POST['artId'])) {
                 $valid = plxMsg::Error(L_ERR_URL_ALREADY_EXISTS . " : " . plxUtils::strCheck($_POST["url"])) and $valid;
             }
         }
     }
     # Vérification de la validité de la date de publication
     if (!plxDate::checkDate($_POST['date_publication_day'], $_POST['date_publication_month'], $_POST['date_publication_year'], $_POST['date_publication_time'])) {
         $valid = plxMsg::Error(L_ERR_INVALID_PUBLISHING_DATE) and $valid;
     }
     if ($valid) {
         $plxAdmin->editArticle($_POST, $_POST['artId']);
         header('Location: article.php?a=' . $_POST['artId']);
         exit;
         # Si url ou date invalide, on ne sauvegarde pas mais on repasse en mode brouillon
     } else {
         array_unshift($_POST['catId'], 'draft');
     }
 }
 # Ajout d'une catégorie
 if (isset($_POST['new_category'])) {
     # Ajout de la nouvelle catégorie
     $plxAdmin->editCategories($_POST);