]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15058 - Removing usage of super globals and replacing them with optional_param...
authormchurch <mchurch>
Fri, 30 May 2008 17:22:24 +0000 (17:22 +0000)
committermchurch <mchurch>
Fri, 30 May 2008 17:22:24 +0000 (17:22 +0000)
mod/wiki/confirmlock.php
mod/wiki/ewiki/ewiki.php
mod/wiki/ewiki/plugins/email_protect.php
mod/wiki/ewiki/plugins/init.php
mod/wiki/ewiki/plugins/jump.php
mod/wiki/ewiki/plugins/moodle/downloads.php
mod/wiki/ewiki/plugins/moodle/moodle_wikidump.php
mod/wiki/ewiki/plugins/notify.php
mod/wiki/ewiki/plugins/patchsaving.php

index 45eeea7dda761bfb0cc72fbb46ed88fe4839e5f9..8c4b5d039425ba638431ed6d988b4e312cf90725 100644 (file)
@@ -15,12 +15,13 @@ require_once("../../config.php");
 
 header('Content-Type: text/plain');    
 
-if(empty($_POST['lockid'])) {
+$lockid = optional_param('lockid', 0, PARAM_INT);
+
+if($lockid == 0) {
     print 'noid';
     exit;
 }
 
-$lockid=(int)$_POST['lockid'];
 if($lock=get_record('wiki_locks','id',$lockid)) {
     $lock->lockedseen=time();
     update_record('wiki_locks',$lock);
index 4ba72c4ae81663cf62204b59426a3e22f686e2f8..cdd7846abc9671fc5a4b0c15320ffc21f11253a7 100644 (file)
@@ -479,21 +479,21 @@ function ewiki_page($id=false) {
    $o = "";
 
    #-- selected page
-   if (!isset($_REQUEST)) {
-      $_REQUEST = @array_merge($_GET, $_POST);
-   }
+    $action  = optional_param('action', EWIKI_DEFAULT_ACTION);
+    $content = optional_param('content', false);
+    $version = optional_param('version', false);
+
    if (!strlen($id)) {
       $id = ewiki_id();
    }
    $id = format_string($id,true);
    #-- page action
-   $action = EWIKI_DEFAULT_ACTION;
    if ($delim = strpos($id, EWIKI_ACTION_SEP_CHAR)) {
       $action = substr($id, 0, $delim);
       $id = substr($id, $delim + 1);
    }
-   elseif (EWIKI_USE_ACTION_PARAM && isset($_REQUEST["action"])) {
-      $action = $_REQUEST["action"];
+   elseif (!EWIKI_USE_ACTION_PARAM) {
+      $action = EWIKI_DEFAULT_ACTION;
    }
    $GLOBALS["ewiki_id"] = $id;
    $GLOBALS["ewiki_title"] = ewiki_split_title($id);
@@ -503,7 +503,7 @@ function ewiki_page($id=false) {
    $dquery = array(
       "id" => $id
    );
-   if (!isset($_REQUEST["content"]) && ($dquery["version"] = @$_REQUEST["version"])) {
+   if (!$content && ($dquery["version"] = $version)) {
       $dquery["forced_version"] = $dquery["version"];
    }
    $data = @array_merge($dquery, ewiki_database("GET", $dquery));
@@ -725,6 +725,8 @@ function ewiki_page_view($id, &$data, $action, $all=1) {
    global $ewiki_plugins, $ewiki_config;
    $o = "";
 
+   $thanks = optional_param('thankyou', '');
+
    #-- render requested wiki page  <-- goal !!!
    $render_args = array(
       "scan_links" => 1,
@@ -750,7 +752,7 @@ function ewiki_page_view($id, &$data, $action, $all=1) {
       foreach ($pf_a as $n => $pf) { $pf($o, $id, $data, $action); }
    }
 
-   if (!empty($_REQUEST["thankyou"]) && $ewiki_config["edit_thank_you"]) {
+   if (!empty($thankyou) && $ewiki_config["edit_thank_you"]) {
       $o = ewiki_t("THANKSFORCONTRIBUTION") . $o;
    }
 
@@ -773,10 +775,10 @@ function ewiki_page_view($id, &$data, $action, $all=1) {
     further whenever desired
 */
 function ewiki_id() {
-   ($id = @$_REQUEST["id"]) or
-   ($id = @$_REQUEST["name"]) or
-   ($id = @$_REQUEST["page"]) or
-   ($id = @$_REQUEST["file"]) or
+   ($id = optional_param("id", '')) or
+   ($id = optional_param("name", '')) or
+   ($id = optional_param("page", '')) or
+   ($id = optional_param("file", '')) or
    (EWIKI_USE_PATH_INFO) and ($id = ltrim(@$_SERVER["PATH_INFO"], "/")) or
    (!isset($_REQUEST["id"])) and ($id = trim(strtok($_SERVER["QUERY_STRING"], "&")));
    if (!strlen($id) || ($id=="id=")) {
@@ -1092,9 +1094,10 @@ function ewiki_page_search($id, &$data, $action) {
 
    global $CFG;
 
+   $q = optional_param('q', '');
    $o = ewiki_make_title($id, $id, 2, $action);
 
-   if (! ($q = @$_REQUEST["q"])) {
+   if ($q == '') {
 
       $o .= '<form action="' . ewiki_script("", $id) . '" method="post">';
       $o .= '<fieldset class="invisiblefieldset">';
@@ -1146,6 +1149,9 @@ function ewiki_page_info($id, &$data, $action) {
    global $ewiki_plugins, $ewiki_config, $ewiki_links;
    global $CFG, $course;  // MOODLE HACK
 
+   $pnum = optional_param(EWIKI_UP_PAGENUM, 0);
+   $pend = optional_param(EWIKI_UP_PAGEEND, 0);
+
    $o = ewiki_make_title($id, ewiki_t("INFOABOUTPAGE")." '{$id}'", 2, $action,"", "_MAY_SPLIT=1"); 
 
    $flagnames = array(
@@ -1160,12 +1166,12 @@ function ewiki_page_info($id, &$data, $action) {
 
    #-- versions to show
    $v_start = $data["version"];
-   if ( ($uu=@$_REQUEST[EWIKI_UP_PAGENUM]) && ($uu<=$v_start) ) {
-      $v_start = $uu;
+   if ( $pnum && ($pnum<=$v_start) ) {
+      $v_start = $pnum;
    }
    $v_end = $v_start - $ewiki_config["list_limit"] + 1;
-   if ( ($uu=@$_REQUEST[EWIKI_UP_PAGEEND]) && ($uu<=$v_start) ) {
-      $v_end = $uu;
+   if ( $pend && ($pend<=$v_start) ) {
+      $v_end = $pend;
    }
    $v_end = max($v_end, 1);
 
@@ -1349,6 +1355,11 @@ function ewiki_page_edit($id, $data, $action) {
 
    global $ewiki_links, $ewiki_author, $ewiki_plugins, $ewiki_ring, $ewiki_errmsg;
 
+   $content = optional_param('content', '');
+   $version = optional_param('version', '');
+   $preview = optional_param('preview', false);
+   $save    = optional_param('save', false);
+   
    $hidden_postdata = array();
 
    #-- previous version come back
@@ -1358,8 +1369,11 @@ function ewiki_page_edit($id, $data, $action) {
       $data["version"] = $current["version"];
       unset($current);
 
-      unset($_REQUEST["content"]);
-      unset($_REQUEST["version"]);
+    /// Is this done for somewhere else?
+      $_REQUEST['content'] = $_POST['content'] = $_GET['content'] = null;
+      $_REQUEST['version'] = $_POST['version'] = $_GET['version'] = null;
+      $content = '';
+      $version = '';
    }
 
    #-- edit hacks
@@ -1397,21 +1411,21 @@ function ewiki_page_edit($id, $data, $action) {
    $o = ewiki_make_title($id, ewiki_t("EDITTHISPAGE").(" '{$id}'"), 2, $action, "", "_MAY_SPLIT=1");
 
    #-- preview
-   if (isset($_REQUEST["preview"])) {
+   if ($preview) {
       $o .= $ewiki_plugins["edit_preview"][0]($data);
    }
 
    #-- save
-   if (isset($_REQUEST["save"])) {
+   if ($save) {
 
 
          #-- normalize to UNIX newlines
-         $_REQUEST["content"] = str_replace("\015\012", "\012", $_REQUEST["content"]);
-         $_REQUEST["content"] = str_replace("\015", "\012", $_REQUEST["content"]);
+         $content = str_replace("\015\012", "\012", $content);
+         $content = str_replace("\015", "\012", $content);
 
          #-- check for concurrent version saving
          $error = 0;
-         if ((@$data["version"] >= 1) && ($data["version"] != @$_REQUEST["version"]) || (@$_REQUEST["version"] < 1)) {
+         if ((@$data["version"] >= 1) && ($data["version"] != $version) || ($version < 1)) {
 
             $pf = $ewiki_plugins["edit_patch"][0];
 
@@ -1436,7 +1450,7 @@ function ewiki_page_edit($id, $data, $action) {
                "id" => $id,
                "version" => @$data["version"] + 1,
                "flags" => $set_flags,
-               "content" => $_REQUEST["content"],
+               "content" => $content,
                "created" => ($uu=@$data["created"]) ? $uu : time(),
                "meta" => ($uu=@$data["meta"]) ? $uu : "",
                "hits" => ($uu=@$data["hits"]) ? $uu : "0",
@@ -1518,13 +1532,16 @@ function ewiki_data_update(&$data, $author="") {
 function ewiki_page_edit_form(&$id, &$data, &$hidden_postdata) {
    global $ewiki_plugins, $ewiki_config, $moodle_format;   
 
+   $content = optional_param('content', '');
+   $version = optional_param('version', '');
+
    $o='';
       
    #-- previously edited, or db fetched content
-   if (@$_REQUEST["content"] || @$_REQUEST["version"]) {
+   if ($content || $version) {
       $data = array(
-         "version" => &$_REQUEST["version"],
-         "content" => &$_REQUEST["content"]
+         "version" => $version,
+         "content" => $content
       );
    }
    else {
@@ -1636,7 +1653,7 @@ function ewiki_page_edit_form_final_imgupload(&$o, &$id, &$data, &$action) {
 function ewiki_page_edit_preview(&$data) {
 #### BEGIN MOODLE CHANGES   
    global $moodle_format;   
-   $preview_text=$GLOBALS["ewiki_plugins"]["render"][0]($_REQUEST["content"], 1, EWIKI_ALLOW_HTML || (@$data["flags"]&EWIKI_DB_F_HTML));
+   $preview_text=$GLOBALS["ewiki_plugins"]["render"][0](optional_param("content", null), 1, EWIKI_ALLOW_HTML || (@$data["flags"]&EWIKI_DB_F_HTML));
    return( '<div class="preview">'
            . "<hr noshade>"
            . "<div align=\"right\">" . ewiki_t("PREVIEW") . "</div><hr noshade><br />\n"
@@ -2536,8 +2553,10 @@ function ewiki_binary($break=0) {
    global $ewiki_plugins;
    global $USER;   // MOODLE
 
+   $id = optional_param(EWIKI_UP_BINARY, '');
+
    #-- reject calls
-   if (!strlen($id = @$_REQUEST[EWIKI_UP_BINARY]) || !EWIKI_IDF_INTERNAL) {
+   if (!strlen($id) || !EWIKI_IDF_INTERNAL) {
       return(false);
    }
    if (headers_sent()) die("ewiki-binary configuration error");
@@ -2571,7 +2590,8 @@ function ewiki_binary($break=0) {
    #-- auth only happens when enforced with _PROTECTED_MODE_XXL setting
    #   (authentication for inline images in violation of the WWW spirit)
    if ((EWIKI_PROTECTED_MODE>=5) && !ewiki_auth($id, $data, "binary-{$do}")) {
-      return($_REQUEST["id"]="view/BinaryPermissionError");
+      $_REQUEST['id'] = $_POST['id'] = $_GET['id'] = "view/BinaryPermissionError";
+      return("view/BinaryPermissionError");
    }
 
    #-- upload an image
index 6604224a131f474dc734fae420acf0e7048d970c..eaa77e0e1e988984f4fbeb9df14e3dbbbe9f6b61 100644 (file)
  $ewiki_t["en"]["PROTE6"] = "the email address you've clicked on is:";
  $ewiki_t["en"]["PROTE7"] = "<b>spammers, please eat these:</b>";
 
- $ewiki_t["de"]["PROTE0"] = "Geschützte EMail-Adresse";
- $ewiki_t["de"]["PROTE1"] = "Die EMail-Adresse, die du angeklickt hast, wird durch dieses Formular vor <a href=\"http://google.com/search?q=spambots\">spambots</a> (automatisierte Suchwerkzeuge, die das Netz zur Freude der MarketingMafia nach Adressen abgrasen) beschützt.";
- $ewiki_t["de"]["PROTE2"] = "Die Seite, die du ändern willst, enthält momentan wenigstens eine EMail-Adresse. Um diese zu schützen müssen wir sicherstellen, daß kein Spambot an die Edit-Box kommt (weil dort die Adresse ja im Klartext steht).";
+ $ewiki_t["de"]["PROTE0"] = "Geschtzte EMail-Adresse";
+ $ewiki_t["de"]["PROTE1"] = "Die EMail-Adresse, die du angeklickt hast, wird durch dieses Formular vor <a href=\"http://google.com/search?q=spambots\">spambots</a> (automatisierte Suchwerkzeuge, die das Netz zur Freude der MarketingMafia nach Adressen abgrasen) beschtzt.";
+ $ewiki_t["de"]["PROTE2"] = "Die Seite, die du �ndern willst, enth�lt momentan wenigstens eine EMail-Adresse. Um diese zu sch�tzen m�ssen wir sicherstellen, da� kein Spambot an die Edit-Box kommt (weil dort die Adresse ja im Klartext steht).";
  $ewiki_t["de"]["PROTE4"] = "Ich bin wirklich kein Spambot!";
  $ewiki_t["de"]["PROTE5"] = "<b>noch mehr fingierte Adressen anzeigen</b>";
  $ewiki_t["de"]["PROTE6"] = "die EMail-Adresse die du angeklickt hast lautet:";
- $ewiki_t["de"]["PROTE7"] = "<b>Liebe Spammer, bitte freßt das:</b>";
+ $ewiki_t["de"]["PROTE7"] = "<b>Liebe Spammer, bitte fret das:</b>";
 
  #-- plugin glue
  $ewiki_plugins["link_url"][] = "ewiki_email_protect_link";
   */
  function ewiki_email_protect_edit_hook($id, &$data, &$hidden_postdata) {
 
+    $ewiki_up_nospambot = optional_param(EWIKI_UP_NOSPAMBOT, null);
+
     $hidden_postdata[EWIKI_UP_NOSPAMBOT] = 1;
 
-    if (empty($_REQUEST[EWIKI_UP_NOSPAMBOT])
+    if (empty($ewiki_up_nospambot )
         && strpos($data["content"], "@")
         && preg_match('/\w\w@([-\w]+\.)+\w\w/', $data["content"])   )
     {
@@ -96,7 +98,7 @@
        return($o);
     }
 
-    if (!empty($_POST[EWIKI_UP_NOSPAMBOT]) && empty($_COOKIE[EWIKI_UP_NOSPAMBOT]) && EWIKI_HTTP_HEADERS) {
+    if (!empty($ewiki_up_nospambot) && empty($_COOKIE[EWIKI_UP_NOSPAMBOT]) && EWIKI_HTTP_HEADERS) {
        setcookie(EWIKI_UP_NOSPAMBOT, "grant_access", time()+7*24*3600, "/");
     }
 
   */
  function ewiki_email_protect_form($id, $data=0, $action=0, $text="PROTE1", $url="") {
 
-    if ($url || ($email = @$_REQUEST[EWIKI_UP_ENCEMAIL])) {
+    $ewiki_up_encemail = optional_param(EWIKI_UP_ENCEMAIL, null);
+    $ewiki_up_nospambot = optional_param(EWIKI_UP_NOSPAMBOT, null);
+
+    if ($url || ($email = $ewiki_up_encemail)) {
 
           $html = "<h3>" . ewiki_t("PROTE0") . "</h3>\n";
 
-          if (empty($_REQUEST[EWIKI_UP_NOSPAMBOT])) {  #// from GET,POST,COOKIE
+          if (empty($ewiki_up_nospambot)) {  #// from GET,POST,COOKIE
 
              (empty($url)) and ($url = ewiki_script("", EWIKI_PAGE_EMAIL));
 
           while (($rd = strrpos($string, ".")) > strpos($string, "@")) {
              $string = substr($string, 0, $rd);
           }
-          $string = strtr($string, "@.-_", "»·±¯");
+          $string = strtr($string, "@.-_", "����");
           break;
 
        case 1:  // encode
 
     global $ewiki_config;
 
+    $ewiki_up_requestlv = optional_param(EWIKI_UP_REQUESTLV, 0);
+    
     $html = "";
     srand(time()/17-1000*microtime());
 
 
     $html .= '<a href="mailto:'.$traps[rand(0, $n_trp)].'">'.$traps[rand(0, $n_trp)].'</a>';
 
-    if (($rl = 1 + @$_REQUEST[EWIKI_UP_REQUESTLV]) < EWIKI_FAKE_EMAIL_LOOP) {
+    if (($rl = 1 + $ewiki_up_requestlv) < EWIKI_FAKE_EMAIL_LOOP) {
        $html .= ",\n" . '<br /><a href="' .
              ewiki_script("", EWIKI_PAGE_EMAIL,
                array(
index f53711421ee06e6cfce3a6b0474d69ac08f6fa84..d518d71e7d8db9ea3e9023b524fd278733402add 100644 (file)
@@ -26,14 +26,17 @@ function ewiki_initialization_wizard($id, &$data, &$action) {
 
    global $ewiki_plugins;
 
+   $abort = optional_param('abort', false);
+   $init  = optional_param('init', '');
+
    #-- proceed only if frontpage missing or explicetely requested
-   if ((strtolower($id)=="wikisetupwizard") || ($id==EWIKI_PAGE_INDEX) && ($action=="edit") && empty($data["version"]) && !($_REQUEST["abort"])) {
+   if ((strtolower($id)=="wikisetupwizard") || ($id==EWIKI_PAGE_INDEX) && ($action=="edit") && empty($data["version"]) && !($abort)) {
 
-      if ($_REQUEST["abort"]) {
+      if ($abort) {
       }
 
       #-- first print some what-would-we-do-stats
-      elseif (empty($_REQUEST["init"])) {
+      elseif (empty($init)) {
 
          $o = "<h2>WikiSetupWizard</h2>\n";
          $o .= "You don't have any pages in your Wiki yet, so we should try to read-in the default ones from <tt>init-pages/</tt> now.<br /><br />";
index 727f13ae0a391ac1e4fc5ae94b13ac64eda7f3d5..bfcfdcb07a6b1230b2bb9f4603d658080c561517 100644 (file)
@@ -34,8 +34,10 @@ $ewiki_config["interwiki"]["goto"] = "";
 function ewiki_handler_jump(&$id, &$data, &$action) {
 
    global $ewiki_config;
-
    static $redirect_count = 5;
+   
+   $redirect_count = optional_param("EWIKI_UP_REDIRECT_COUNT", $redirect_count, PARAM_INT);
+
    $jump_markup = array("jump", "goto", "redirect", "location");
 
    #-- we only care about "view" action
@@ -44,9 +46,6 @@ function ewiki_handler_jump(&$id, &$data, &$action) {
    }
 
    #-- escape from loop
-   if (isset($_REQUEST["EWIKI_UP_REDIRECT_COUNT"])) {
-      $redirect_count = $_REQUEST["EWIKI_UP_REDIRECT_COUNT"];
-   }
    if ($redirect_count-- <= 0) {
       return(ewiki_t("REDIRECTION_LOOP", array("id"=>$id)));
    }
index 6e3cc41e0a5dca7fe79d006490a615f0eb7fec18..9f4ef3530e2ba0afeec77796e3616c2dc96aedbe 100644 (file)
@@ -116,7 +116,7 @@ function ewiki_page_fileupload($id, $data, $action, $def_sec="") {
       }
       if (count($ewiki_upload_sections) > 1) {
          if (empty($def_sec)) {
-            $def_sec = $_REQUEST["section"];
+            $def_sec = optional_param('section', '');
          }
          $o .= '<b>'.ewiki_t("UPL_INSECT").'</b><br /><select name="section">';
          foreach ($ewiki_upload_sections as $id => $title) {
@@ -144,7 +144,7 @@ function ewiki_page_fileupload($id, $data, $action, $def_sec="") {
       if (($s = $upload_file["name"]) && (strlen($s) >= 3)
          || ($s = substr(md5(time()+microtime()),0,8) . ".dat"))
       {
-         if (strlen($uu = trim($_REQUEST["new_filename"])) >= 3) {
+         if (strlen($uu = trim(optional_param("new_filename",''))) >= 3) {
             if ($uu != $s) {
                $meta["Original-Filename"] = $s;
             }
@@ -156,7 +156,7 @@ function ewiki_page_fileupload($id, $data, $action, $def_sec="") {
          ($p = strrpos($s, '\\')) and ($p++);
          $meta["Content-Disposition"] = 'attachment; filename="'.urlencode(substr($s, $p)).'"';
       }
-      if (strlen($sect = $_REQUEST["section"])) {
+      if (strlen($sect = optional_param("section",''))) {
          if ($ewiki_upload_sections[$sect]
             || ($action==EWIKI_ACTION_ATTACHMENTS) && ($data["content"])
                && strlen($ewiki_plugins["action"][EWIKI_ACTION_ATTACHMENTS])) {
@@ -168,7 +168,7 @@ function ewiki_page_fileupload($id, $data, $action, $def_sec="") {
             return($o);
          }
       }
-      if (strlen($s = trim($_REQUEST["comment"]))) {
+      if (strlen($s = trim(optional_param("comment",'')))) {
          $meta["comment"] = $s;
       }
 
@@ -198,13 +198,13 @@ function ewiki_page_filedownload($id, $data, $action, $def_sec="") {
 
 
    #-- params (section, orderby)
-   ($orderby = $_REQUEST["orderby"]) or ($orderby = "created");
+   $orderby = optional_param('orderby', 'created');
 
    if ($def_sec) {
       $section = $def_sec;
    }
    else {
-      ($section = $_REQUEST["section"]) or ($section = "");
+      $section = optional_param('section', '');
       if (count($ewiki_upload_sections) > 1) {
          $oa = array();
          $ewiki_upload_sections["*"] = "*";
@@ -256,7 +256,7 @@ function ewiki_page_filedownload($id, $data, $action, $def_sec="") {
 
 
    #-- slice
-   ($pnum = $_REQUEST[EWIKI_UP_PAGENUM]) or ($pnum = 0);
+   $pnum = optional_param(EWIKI_UP_PAGENUM, 0, PARAM_INT);
    if (count($sorted) > EWIKI_LIST_LIMIT) {
       $o_nl .= '<div class="lighter">&gt;&gt; ';
       for ($n=0; $n < (int)(count($sorted) / EWIKI_LIST_LIMIT); $n++) {
index 1e857bd71956b8d967ebb4bb81a25ee7607ae8e5..f31ee0c44f760e3b4b27d1a4c928d4191fe0ef5a 100644 (file)
@@ -44,19 +44,23 @@ function moodle_ewiki_page_wiki_dump($id=0, $data=0, $action=0) {
   global $userid, $groupid, $cm, $wikipage, $wiki, $course, $CFG;
   #-- return legacy page
   $cont = true;
-  if (!empty($_REQUEST["wikiexport"])) {
-    $binaries=$_REQUEST["exportbinaries"];
+  $wikiexport = optional_param('wikiexport', '');
+  $binaries = optional_param("exportbinaries", null);
+  $exportformatval = optional_param("exportformats", null);
+  $withvirtualpages = optional_param("withvirtualpages", null);
+  $exportdestinationsval = optional_param('exportdestinations', null);
+
+  if (!empty($wikiexport)) {
     if(!$wiki->ewikiacceptbinary) {
       $binaries=0;
     }
-    $exportformats=$_REQUEST["exportformats"];
     if($wiki->htmlmode==2) {
-      $exportformats=1;
+      $exportformatval=1;
     }
     $cont=ewiki_page_wiki_dump_send($binaries, 
-                                $exportformats
-                                $_REQUEST["withvirtualpages"]
-                                $_REQUEST["exportdestinations"]);
+                                $exportformatval
+                                $withvirtualpages
+                                optional_param("exportdestinations", null));
   }  
   if($cont===false) {
      die;
@@ -89,14 +93,14 @@ function moodle_ewiki_page_wiki_dump($id=0, $data=0, $action=0) {
     $ret.="  <TR valign=\"top\">\n".
         '    <TD align="right">'.get_string("withbinaries","wiki").":</TD>\n".
         "    <TD>\n".
-        '      <input type="checkbox" name="exportbinaries" value="1"'.($_REQUEST["exportbinaries"]==1?" checked":"")." />\n".
+        '      <input type="checkbox" name="exportbinaries" value="1"'.($binaries==1?" checked":"")." />\n".
         "    </TD>\n".
         "  </TR>\n";
   }
   $ret.="  <TR valign=\"top\">\n".
       '    <TD align="right">'.get_string("withvirtualpages","wiki").":</TD>\n".
       "    <TD>\n".
-      '      <input type="checkbox" name="withvirtualpages" value="1"'.($_REQUEST["withvirtualpages"]==1?" checked":"")." />\n".
+      '      <input type="checkbox" name="withvirtualpages" value="1"'.($withvirtualpages==1?" checked":"")." />\n".
       "    </TD>\n".
       "  </TR>\n";
   $exportformats=array( "0" => get_string("plaintext","wiki") , "1" => get_string("html","wiki"));
@@ -105,7 +109,7 @@ function moodle_ewiki_page_wiki_dump($id=0, $data=0, $action=0) {
         '    <TD align="right">'.get_string("exportformats","wiki").":</TD>\n".
         "    <TD>\n";
   if($wiki->htmlmode!=2) {
-    $ret.= choose_from_menu($exportformats, "exportformats", $_REQUEST["exportformats"], "", "", "", true)."\n";
+    $ret.= choose_from_menu($exportformats, "exportformats", $exportformatval, "", "", "", true)."\n";
   } else {
     $ret.= '<INPUT type="hidden" name="exportformats" value="1" />'.
            get_string("html","wiki");
@@ -129,7 +133,7 @@ function moodle_ewiki_page_wiki_dump($id=0, $data=0, $action=0) {
   if(count($exportdestinations)==1) {
     $ret.='<INPUT type="hidden" name="exportdestinations" value="0" />'.$exportdestinations[0]."\n";
   } else {
-    $ret.=choose_from_menu($exportdestinations, "exportdestinations", $_REQUEST["exportdestinations"], "", "", "", true)."\n";
+    $ret.=choose_from_menu($exportdestinations, "exportdestinations", $exportdestinationsval, "", "", "", true)."\n";
   }
   $ret.="    </TD>\n".
       "  </TR>\n".      
index 7992c3886e0ff46b1af198d3956fe5f7c2fd9329..7e245b7b9da93e04d2d9f5f2cee89b2181d4e891 100644 (file)
@@ -46,17 +46,17 @@ _END_OF_STRING;
 
 
 #-- translation.de
-$ewiki_t["de"]["NOTIFY_SUBJECT"] = '"$id" wurde geändert [notify:...]';
+$ewiki_t["de"]["NOTIFY_SUBJECT"] = '"$id" wurde gendert [notify:...]';
 $ewiki_t["de"]["NOTIFY_BODY"] = <<<_END_OF_STRING
 Hi,
 
-Eine WikiSeite hat sich geändert, und du wolltest ja unbedingt wissen,
-wenn das passiert. Die geänderte Seite war '\$id' und
+Eine WikiSeite hat sich gendert, und du wolltest ja unbedingt wissen,
+wenn das passiert. Die genderte Seite war '\$id' und
 ist leicht zu finden unter folgender URL:
 \$link
 
 Wenn du diese Benachrichtigungen nicht mehr bekommen willst, solltest du
-deine [notify:...]-Adresse aus der entsprechenden Edit-Box herauslöschen:
+deine [notify:...]-Adresse aus der entsprechenden Edit-Box herauslschen:
 \$edit_link
 
 (\$wiki_title auf http://\$server/)
@@ -72,9 +72,12 @@ _END_OF_STRING;
 function ewiki_notify_edit_hook($id, $data, &$hidden_postdata) {
 
    global $ewiki_t, $ewiki_plugins;
+
+   $content = optional_param('content', '');
    $ret_err = 0;
+   $save = optional_param('save', false);
 
-   if (!isset($_REQUEST["save"])) {
+   if ($save === false) {
       return(false);
    }
 
@@ -90,12 +93,12 @@ function ewiki_notify_edit_hook($id, $data, &$hidden_postdata) {
 
       #-- save page versions temporarily as files
       $fn1 = EWIKI_TMP."/ewiki.tmp.notify.diff.".md5($data["content"]);
-      $fn2 = EWIKI_TMP."/ewiki.tmp.notify.diff.".md5($_REQUEST["content"]);
+      $fn2 = EWIKI_TMP."/ewiki.tmp.notify.diff.".md5($content);
       $f = fopen($fn1, "w");
       fwrite($f, $data["content"]);
       fclose($f);
       $f = fopen($fn2, "w");
-      fwrite($f, $_REQUEST["content"]);
+      fwrite($f, $content);
       fclose($f);
       #-- set mtime of the old one (GNU diff will report it)
       touch($fn1, $data["lastmodified"]);
index 9cec59c524436565e04547ba60010436b753e959..6b1b0f53453d2724f80eda1277226ee49c8c7d1c 100644 (file)
@@ -19,19 +19,22 @@ if (function_exists("is_executable") && is_executable(EWIKI_BIN_PATCH) && is_exe
 
 function ewiki_edit_patch($id, &$data) {
 
+   $version = optional_param('version', null);
+   $content = optional_param('content', '');
+
    $r = false;
 
    $base = ewiki_database(
       "GET",
-      array("id"=>$id, "version"=>$_REQUEST["version"])
+      array("id"=>$id, "version"=>$version)
    );
    if (!$base) { 
      return(false);
    }
 
    $fn_base = EWIKI_TMP."/ewiki.base.".md5($base["content"]);
-   $fn_requ = EWIKI_TMP."/ewiki..requ.".md5($_REQUEST["content"]);
-   $fn_patch = EWIKI_TMP."/ewiki.patch.".md5($base["content"])."-".md5($_REQUEST["content"]);
+   $fn_requ = EWIKI_TMP."/ewiki..requ.".md5($content);
+   $fn_patch = EWIKI_TMP."/ewiki.patch.".md5($base["content"])."-".md5($content);
    $fn_curr = EWIKI_TMP."/ewiki.curr.".md5($data["content"]);
 
    if ($f = fopen($fn_base, "w")) {
@@ -43,7 +46,7 @@ function ewiki_edit_patch($id, &$data) {
    }
 
    if ($f = fopen($fn_requ, "w")) {
-     fwrite($f, $_REQUEST["content"]);
+     fwrite($f, $content);
      fclose($f);
    }
    else { 
@@ -67,8 +70,9 @@ function ewiki_edit_patch($id, &$data) {
       exec("patch $fn_curr $fn_patch", $output, $retval);
       if (!$retval) {
 
-         $_REQUEST["version"] = $curr["version"];
-         $_REQUEST["content"] = implode("", file($fn_curr));
+    /// mrc - ?? what is $curr supposed to be ??
+         $_REQUEST["version"] = $_POST["version"] = $_GET["version"] = $curr["version"];
+         $_REQUEST["content"] = $_POST["content"] = $_GET["content"] = implode("", file($fn_curr));
          $r = true;
 
       }