function ajouter($lang, $dossier, $ligne, $titre, $chapo, $description, $postscriptum) { if (!isset($id)) { $id = ""; } $contenu = new Contenu(); $contenu->charger($id); if ($contenu->id) { return; } $contenu = new Contenu(); $contenu->datemodif = date("Y-m-d H:i:s"); $contenu->dossier = $dossier; if ($ligne == "on") { $contenu->ligne = 1; } else { $contenu->ligne = 0; } $lastid = $contenu->add(); $contenu->id = $lastid; $contenudesc = new Contenudesc(); $contenudesc->chapo = $chapo; $contenudesc->description = $description; $contenudesc->postscriptum = $postscriptum; $contenudesc->contenu = $lastid; $contenudesc->lang = $lang; $contenudesc->titre = $titre; $contenudesc->chapo = str_replace("\n", "<br/>", $contenudesc->chapo); $contenudesc->postscriptum = str_replace("\n", "<br/>", $contenudesc->postscriptum); $contenudesc->add(); $contenudesc->reecrire(); ActionsModules::instance()->appel_module("ajoutcont", $contenu); redirige($_SERVER['PHP_SELF'] . "?id=" . $lastid . "&dossier=" . $contenu->dossier); exit; }
public function modify($lang, $folder, $online, $title, $chapo, $description, $postscriptum, $urlsuiv, $rewriteurl, $images, $documents, $tab) { if ($this->id == '') { throw new TheliaAdminException("Content not found", TheliaAdminException::CONTENT_NOT_FOUND); } $contenudesc = new Contenudesc($this->id, $lang); if ($contenudesc->id == '') { CacheBase::getCache()->reset_cache(); $contenudesc->contenu = $this->id; $contenudesc->lang = $lang; $contenudesc->id = $contenudesc->add(); } $this->oldFolder = $this->dossier; $this->datemodif = date('Y-m-d H:i:s'); if ($this->dossier != $folder) { $this->checkRewrite($folder); $this->checkOrder($folder); } $this->ligne = $online == 'on' ? 1 : 0; $contenudesc->chapo = str_replace("\n", "<br />", $chapo); $contenudesc->titre = $title; $contenudesc->postscriptum = $postscriptum; $contenudesc->description = $description; $this->maj(); $contenudesc->maj(); $contenudesc->reecrire($rewriteurl); $this->setLang($lang); $this->updateImage($images); $this->getImageFile()->ajouter("photo", array("jpg", "gif", "png", "jpeg"), "uploadimage"); $this->updateDocuments($documents); $this->getDocumentFile()->ajouter("document_", array(), "uploaddocument"); ActionsModules::instance()->appel_module("modcont", new Contenu($this->id)); if ($urlsuiv) { redirige('listdos.php?parent=' . $this->dossier); } else { redirige('contenu_modifier.php?id=' . $this->id . '&dossier=' . $this->dossier . '&tab=' . $tab . '&lang=' . $lang); } }