mlmmj

changeset 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 diff
     1.1 --- a/contrib/web/php-admin/htdocs/edit.php	Thu Oct 21 10:08:35 2010 +1100
     1.2 +++ b/contrib/web/php-admin/htdocs/edit.php	Fri Oct 29 22:13:47 2010 +1100
     1.3 @@ -90,7 +90,7 @@
     1.4  
     1.5  $tpl = new rFastTemplate($templatedir);
     1.6  
     1.7 -$list = $HTTP_GET_VARS["list"];
     1.8 +$list = $_GET["list"];
     1.9  
    1.10  if(!isset($list))
    1.11  die("no list specified");
     2.1 --- a/contrib/web/php-admin/htdocs/save.php	Thu Oct 21 10:08:35 2010 +1100
     2.2 +++ b/contrib/web/php-admin/htdocs/save.php	Fri Oct 29 22:13:47 2010 +1100
     2.3 @@ -31,11 +31,11 @@
     2.4  
     2.5  function mlmmj_boolean($name, $nicename, $text)
     2.6  {
     2.7 -    global $tpl, $topdir, $list, $HTTP_POST_VARS;
     2.8 +    global $tpl, $topdir, $list;
     2.9      
    2.10      $file = $topdir."/".$list."/control/".$name;
    2.11      
    2.12 -    if (isset($HTTP_POST_VARS[$name])) 
    2.13 +    if(isset($_POST[$name]) && !empty($_POST[$name]))
    2.14      {
    2.15  	if(!touch($file))
    2.16  	    die("Couldn't open ".$file." for writing");
    2.17 @@ -53,16 +53,16 @@
    2.18  
    2.19  function mlmmj_list($name, $nicename, $text) 
    2.20  {
    2.21 -    global $tpl, $topdir, $list,$HTTP_POST_VARS;
    2.22 +    global $tpl, $topdir, $list;
    2.23  
    2.24      $file = $topdir."/".$list."/control/".$name;
    2.25      
    2.26 -    if(!empty($HTTP_POST_VARS[$name]))
    2.27 +    if(isset($_POST[$name]) && !empty($_POST[$name]))
    2.28      {
    2.29  	if (!$fp = fopen($file, "w"))
    2.30  	    die("Couldn't open ".$file." for writing");
    2.31  
    2.32 -	fwrite($fp, preg_replace('/\\r/',"",$HTTP_POST_VARS[$name]));
    2.33 +       fwrite($fp, preg_replace('/\\r/',"",$_POST[$name]));
    2.34  	fclose($fp);
    2.35  
    2.36  	if (!chmod($file, 0644))
    2.37 @@ -79,7 +79,7 @@
    2.38  
    2.39  $tpl = new rFastTemplate($templatedir);
    2.40  
    2.41 -$list = $HTTP_POST_VARS["list"];
    2.42 +$list = $_POST["list"];
    2.43  
    2.44  if(!isset($list))
    2.45  die("no list specified");
     3.1 --- a/contrib/web/php-user/mlmmj.php	Thu Oct 21 10:08:35 2010 +1100
     3.2 +++ b/contrib/web/php-user/mlmmj.php	Fri Oct 29 22:13:47 2010 +1100
     3.3 @@ -55,22 +55,20 @@
     3.4  
     3.5      function mlmmj()
     3.6  	{
     3.7 -	    global $HTTP_POST_VARS, $HTTP_SERVER_VARS;
     3.8 -
     3.9  	    // set mandatory vars...
    3.10  	    $this->errors = FALSE;
    3.11  	    $this->delimiter = "+";
    3.12  
    3.13 -	    if (!isset($HTTP_POST_VARS["email"]) &&
    3.14 -		!isset($HTTP_POST_VARS["mailinglist"]) &&
    3.15 -		!isset($HTTP_POST_VARS["job"]) &&
    3.16 -		!isset($HTTP_POST_VARS["redirect_success"]) &&
    3.17 -		!isset($HTTP_POST_VARS["redirect_failure"]))
    3.18 +	    if (!isset($_POST["email"]) &&
    3.19 +		!isset($_POST["mailinglist"]) &&
    3.20 +		!isset($_POST["job"]) &&
    3.21 +		!isset($_POST["redirect_success"]) &&
    3.22 +		!isset($_POST["redirect_failure"]))
    3.23  	    {
    3.24  		$this->errors = TRUE;
    3.25 -		if(isset($HTTP_POST_VARS["redirect_failure"]))
    3.26 +		if(isset($_POST["redirect_failure"]))
    3.27  		{
    3.28 -		    header("Location: ".$HTTP_POST_VARS["redirect_failure"]);
    3.29 +		    header("Location: ".$_POST["redirect_failure"]);
    3.30  		    exit;
    3.31  		}
    3.32  		else
    3.33 @@ -78,25 +76,25 @@
    3.34  	    }
    3.35  	    else
    3.36  	    {
    3.37 -		if($this->is_email($HTTP_POST_VARS["email"]))
    3.38 -		    $this->email = $HTTP_POST_VARS["email"];
    3.39 +		if($this->is_email($_POST["email"]))
    3.40 +		    $this->email = $_POST["email"];
    3.41  		else
    3.42  		    $this->error("ERROR: email is not a valid email address.");
    3.43  
    3.44 -		if($this->is_email($HTTP_POST_VARS["mailinglist"]))
    3.45 -		    $this->mailinglist = $HTTP_POST_VARS["mailinglist"];
    3.46 +		if($this->is_email($_POST["mailinglist"]))
    3.47 +		    $this->mailinglist = $_POST["mailinglist"];
    3.48  		else
    3.49  		    $this->error("ERROR: mailinglist is not a valid email address.");
    3.50  		
    3.51 -		$this->job = $HTTP_POST_VARS["job"];
    3.52 +		$this->job = $_POST["job"];
    3.53  		
    3.54  		if(!(($this->job == "subscribe") OR ($this->job == "unsubscribe")))
    3.55  		{
    3.56  		    $this->error("ERROR: job unknown.");
    3.57  		}
    3.58  		
    3.59 -		$this->redirect_failure = $HTTP_POST_VARS["redirect_failure"];
    3.60 -		$this->redirect_success = $HTTP_POST_VARS["redirect_success"];
    3.61 +		$this->redirect_failure = $_POST["redirect_failure"];
    3.62 +		$this->redirect_success = $_POST["redirect_success"];
    3.63  
    3.64  	    }
    3.65  
    3.66 @@ -110,9 +108,9 @@
    3.67  		$subject = $this->job." to ".$this->mailinglist;
    3.68  		$body = $this->job;
    3.69  		$addheader = "";
    3.70 -		$addheader .= "Received: from ". $HTTP_SERVER_VARS["REMOTE_ADDR"]
    3.71 -		    ." by ". $HTTP_SERVER_VARS["SERVER_NAME"]. " with HTTP;\r\n\t".date("r")."\n";
    3.72 -		$addheader .= "X-Originating-IP: ".$HTTP_SERVER_VARS["REMOTE_ADDR"]."\n";
    3.73 +		$addheader .= "Received: from ". $_SERVER["REMOTE_ADDR"]
    3.74 +		    ." by ". $_SERVER["SERVER_NAME"]. " with HTTP;\r\n\t".date("r")."\n";
    3.75 +		$addheader .= "X-Originating-IP: ".$_SERVER["REMOTE_ADDR"]."\n";
    3.76  		$addheader .= "X-Mailer: mlmmj-webinterface powered by PHP/". phpversion() ."\n";
    3.77  		$addheader .= "From: ".$this->email."\n";
    3.78  		$addheader .= "Cc: ".$this->email."\n";