comparison contrib/web/php-admin/htdocs/save.php @ 769:fc5892d87716

Update php code to use superglobals
author Ben Schmidt
date Fri, 29 Oct 2010 22:13:47 +1100
parents 75fb7729c6e8
children b9b60f3dd694
comparison
equal deleted inserted replaced
768:5c46136b0359 769:fc5892d87716
29 require(dirname(dirname(__FILE__))."/conf/config.php"); 29 require(dirname(dirname(__FILE__))."/conf/config.php");
30 require(dirname(__FILE__)."/class.rFastTemplate.php"); 30 require(dirname(__FILE__)."/class.rFastTemplate.php");
31 31
32 function mlmmj_boolean($name, $nicename, $text) 32 function mlmmj_boolean($name, $nicename, $text)
33 { 33 {
34 global $tpl, $topdir, $list, $HTTP_POST_VARS; 34 global $tpl, $topdir, $list;
35 35
36 $file = $topdir."/".$list."/control/".$name; 36 $file = $topdir."/".$list."/control/".$name;
37 37
38 if (isset($HTTP_POST_VARS[$name])) 38 if(isset($_POST[$name]) && !empty($_POST[$name]))
39 { 39 {
40 if(!touch($file)) 40 if(!touch($file))
41 die("Couldn't open ".$file." for writing"); 41 die("Couldn't open ".$file." for writing");
42 if (!chmod($file, 0644)) 42 if (!chmod($file, 0644))
43 die("Couldn't chmod ".$file); 43 die("Couldn't chmod ".$file);
51 mlmmj_list($name, $nicename, $text); 51 mlmmj_list($name, $nicename, $text);
52 } 52 }
53 53
54 function mlmmj_list($name, $nicename, $text) 54 function mlmmj_list($name, $nicename, $text)
55 { 55 {
56 global $tpl, $topdir, $list,$HTTP_POST_VARS; 56 global $tpl, $topdir, $list;
57 57
58 $file = $topdir."/".$list."/control/".$name; 58 $file = $topdir."/".$list."/control/".$name;
59 59
60 if(!empty($HTTP_POST_VARS[$name])) 60 if(isset($_POST[$name]) && !empty($_POST[$name]))
61 { 61 {
62 if (!$fp = fopen($file, "w")) 62 if (!$fp = fopen($file, "w"))
63 die("Couldn't open ".$file." for writing"); 63 die("Couldn't open ".$file." for writing");
64 64
65 fwrite($fp, preg_replace('/\\r/',"",$HTTP_POST_VARS[$name])); 65 fwrite($fp, preg_replace('/\\r/',"",$_POST[$name]));
66 fclose($fp); 66 fclose($fp);
67 67
68 if (!chmod($file, 0644)) 68 if (!chmod($file, 0644))
69 die("Couldn't chmod ".$file); 69 die("Couldn't chmod ".$file);
70 } 70 }
77 function encode_entities($str) { return htmlentities($str); } 77 function encode_entities($str) { return htmlentities($str); }
78 78
79 79
80 $tpl = new rFastTemplate($templatedir); 80 $tpl = new rFastTemplate($templatedir);
81 81
82 $list = $HTTP_POST_VARS["list"]; 82 $list = $_POST["list"];
83 83
84 if(!isset($list)) 84 if(!isset($list))
85 die("no list specified"); 85 die("no list specified");
86 86
87 if (dirname(realpath($topdir."/".$list)) != realpath($topdir)) 87 if (dirname(realpath($topdir."/".$list)) != realpath($topdir))