Blame | Last modification | View Log | RSS feed
<?php/*edit.phpCopyright (c) 2002, Hendrik Mans <hendrik@mans.de>Copyright 2002, 2003 David DELONCopyright 2002, 2003 Charles NEPOTECopyright 2002, 2003 Patrick PAULCopyright 2003 Eric FELDSTEINAll rights reserved.Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditionsare met:1. Redistributions of source code must retain the above copyrightnotice, this list of conditions and the following disclaimer.2. Redistributions in binary form must reproduce the above copyrightnotice, this list of conditions and the following disclaimer in thedocumentation and/or other materials provided with the distribution.3. The name of the author may not be used to endorse or promote productsderived from this software without specific prior written permission.THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS ORIMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIESOF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUTNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANYTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OFTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*///vérification de sécuritéif (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {die ("accès direct interdit");}echo $this->Header();?><div class="page"><?phpif ($this->HasAccess("write") && $this->HasAccess("read")){$output='';if ($_POST){// only if saving:if ($_POST["submit"] == "Sauver"){// check for overwritingif ($this->page){if ($this->page["id"] != $_POST["previous"]){$error = "ALERTE : "."Cette page a été modifiée par quelqu'un d'autre pendant que vous l'éditiez.<br />\n"."Veuillez copier vos changements et rééditer cette page.\n";}}// storeif (!$error){$body = str_replace("\r", "", $_POST["body"]);// test si la nouvelle page est differente de la précédenteif(rtrim($body)==rtrim($this->page["body"])) {$this->SetMessage("Cette page n\'a pas été enregistrée car elle n\'a subi aucune modification.");$this->Redirect($this->href());}// add page (revisions)$this->SavePage($this->tag, $body);// now we render it internally so we can write the updated link table.$this->ClearLinkTable();$this->StartLinkTracking();$dummy = $this->Header();$dummy .= $this->Format($body);$dummy .= $this->Footer();$this->StopLinkTracking();$this->WriteLinkTable();$this->ClearLinkTable();// forward$this->Redirect($this->href());}}}// fetch fieldsif (!$previous = $_POST["previous"]) $previous = $this->page["id"];if (!$body = $_POST["body"]) $body = $this->page["body"];// preview?if ($_POST["submit"] == "Aperçu"){$output .="<div class=\"prev_alert\"><strong>Aperçu</strong></div>\n".$this->Format($body)."\n\n".$this->FormOpen("edit")."<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n"."<input type=\"hidden\" name=\"body\" value=\"".htmlentities($body)."\" />\n"."<br />\n"."<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n"."<input name=\"submit\" type=\"submit\" value=\"Rééditer \" accesskey=\"p\" />\n"."<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".$this->FormClose()."\n";}else{// display formif ($error){$output .= "<div class=\"error\">$error</div>\n";}// append a comment?if ($_REQUEST["appendcomment"]){$body = trim($body)."\n\n----\n\n--".$this->UserName()." (".strftime("%c").")";}require_once("ACeditor.buttonsBar.php");$output .=$this->FormOpen("edit")."<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".$ACbuttonsBar."<textarea onkeydown=\"fKeyDown()\" name=\"body\" cols=\"60\" rows=\"40\" wrap=\"soft\" class=\"edit\">\n".htmlspecialchars($body)."\n</textarea><br />\n".($this->config["preview_before_save"] ? "" : "<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n")."<input name=\"submit\" type=\"submit\" value=\"Aperçu\" accesskey=\"p\" />\n"."<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".$this->FormClose();}echo $output;}else{echo "<i>Vous n'avez pas accès en écriture à cette page !</i>\n";}?><hr class="hr_clear" /></div><?php echo $this->Footer(); ?>