Mercurial > hg > mlmmj
changeset 769:fc5892d87716
Update php code to use superglobals
author | Ben Schmidt |
---|---|
date | Fri, 29 Oct 2010 22:13:47 +1100 |
parents | 5c46136b0359 |
children | b9b60f3dd694 |
files | contrib/web/php-admin/htdocs/edit.php contrib/web/php-admin/htdocs/save.php contrib/web/php-user/mlmmj.php |
diffstat | 3 files changed, 24 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/web/php-admin/htdocs/edit.php Thu Oct 21 10:08:35 2010 +1100 +++ b/contrib/web/php-admin/htdocs/edit.php Fri Oct 29 22:13:47 2010 +1100 @@ -90,7 +90,7 @@ $tpl = new rFastTemplate($templatedir); -$list = $HTTP_GET_VARS["list"]; +$list = $_GET["list"]; if(!isset($list)) die("no list specified");
--- a/contrib/web/php-admin/htdocs/save.php Thu Oct 21 10:08:35 2010 +1100 +++ b/contrib/web/php-admin/htdocs/save.php Fri Oct 29 22:13:47 2010 +1100 @@ -31,11 +31,11 @@ function mlmmj_boolean($name, $nicename, $text) { - global $tpl, $topdir, $list, $HTTP_POST_VARS; + global $tpl, $topdir, $list; $file = $topdir."/".$list."/control/".$name; - if (isset($HTTP_POST_VARS[$name])) + if(isset($_POST[$name]) && !empty($_POST[$name])) { if(!touch($file)) die("Couldn't open ".$file." for writing"); @@ -53,16 +53,16 @@ function mlmmj_list($name, $nicename, $text) { - global $tpl, $topdir, $list,$HTTP_POST_VARS; + global $tpl, $topdir, $list; $file = $topdir."/".$list."/control/".$name; - if(!empty($HTTP_POST_VARS[$name])) + if(isset($_POST[$name]) && !empty($_POST[$name])) { if (!$fp = fopen($file, "w")) die("Couldn't open ".$file." for writing"); - fwrite($fp, preg_replace('/\\r/',"",$HTTP_POST_VARS[$name])); + fwrite($fp, preg_replace('/\\r/',"",$_POST[$name])); fclose($fp); if (!chmod($file, 0644)) @@ -79,7 +79,7 @@ $tpl = new rFastTemplate($templatedir); -$list = $HTTP_POST_VARS["list"]; +$list = $_POST["list"]; if(!isset($list)) die("no list specified");
--- a/contrib/web/php-user/mlmmj.php Thu Oct 21 10:08:35 2010 +1100 +++ b/contrib/web/php-user/mlmmj.php Fri Oct 29 22:13:47 2010 +1100 @@ -55,22 +55,20 @@ function mlmmj() { - global $HTTP_POST_VARS, $HTTP_SERVER_VARS; - // set mandatory vars... $this->errors = FALSE; $this->delimiter = "+"; - if (!isset($HTTP_POST_VARS["email"]) && - !isset($HTTP_POST_VARS["mailinglist"]) && - !isset($HTTP_POST_VARS["job"]) && - !isset($HTTP_POST_VARS["redirect_success"]) && - !isset($HTTP_POST_VARS["redirect_failure"])) + if (!isset($_POST["email"]) && + !isset($_POST["mailinglist"]) && + !isset($_POST["job"]) && + !isset($_POST["redirect_success"]) && + !isset($_POST["redirect_failure"])) { $this->errors = TRUE; - if(isset($HTTP_POST_VARS["redirect_failure"])) + if(isset($_POST["redirect_failure"])) { - header("Location: ".$HTTP_POST_VARS["redirect_failure"]); + header("Location: ".$_POST["redirect_failure"]); exit; } else @@ -78,25 +76,25 @@ } else { - if($this->is_email($HTTP_POST_VARS["email"])) - $this->email = $HTTP_POST_VARS["email"]; + if($this->is_email($_POST["email"])) + $this->email = $_POST["email"]; else $this->error("ERROR: email is not a valid email address."); - if($this->is_email($HTTP_POST_VARS["mailinglist"])) - $this->mailinglist = $HTTP_POST_VARS["mailinglist"]; + if($this->is_email($_POST["mailinglist"])) + $this->mailinglist = $_POST["mailinglist"]; else $this->error("ERROR: mailinglist is not a valid email address."); - $this->job = $HTTP_POST_VARS["job"]; + $this->job = $_POST["job"]; if(!(($this->job == "subscribe") OR ($this->job == "unsubscribe"))) { $this->error("ERROR: job unknown."); } - $this->redirect_failure = $HTTP_POST_VARS["redirect_failure"]; - $this->redirect_success = $HTTP_POST_VARS["redirect_success"]; + $this->redirect_failure = $_POST["redirect_failure"]; + $this->redirect_success = $_POST["redirect_success"]; } @@ -110,9 +108,9 @@ $subject = $this->job." to ".$this->mailinglist; $body = $this->job; $addheader = ""; - $addheader .= "Received: from ". $HTTP_SERVER_VARS["REMOTE_ADDR"] - ." by ". $HTTP_SERVER_VARS["SERVER_NAME"]. " with HTTP;\r\n\t".date("r")."\n"; - $addheader .= "X-Originating-IP: ".$HTTP_SERVER_VARS["REMOTE_ADDR"]."\n"; + $addheader .= "Received: from ". $_SERVER["REMOTE_ADDR"] + ." by ". $_SERVER["SERVER_NAME"]. " with HTTP;\r\n\t".date("r")."\n"; + $addheader .= "X-Originating-IP: ".$_SERVER["REMOTE_ADDR"]."\n"; $addheader .= "X-Mailer: mlmmj-webinterface powered by PHP/". phpversion() ."\n"; $addheader .= "From: ".$this->email."\n"; $addheader .= "Cc: ".$this->email."\n";