[TEP-COMMIT] [CVS admin] unset global variables when register_globals is enabled
hpdl-OfajU3CKLf1/[email protected] 20 Nov 2004 02:12:40 -0000
| Newsgroups | gmane.comp.web.oscommerce.cvs |
|---|---|
| Message-ID | <[email protected]> |
<html>
<head>
<style><!--
body {background-color:#ffffff;}
.file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
.pathname {font-family:monospace; float:right;}
.fileheader {margin-bottom:.5em;}
.diff {margin:0;}
.tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
.tasklist ul {margin-top:0;margin-bottom:0;}
tr.alt {background-color:#eeeeee}
#added {background-color:#ddffdd;}
#addedchars {background-color:#99ff99;font-weight:bolder;}
tr.alt #added {background-color:#ccf7cc;}
#removed {background-color:#ffdddd;}
#removedchars {background-color:#ff9999;font-weight:bolder;}
tr.alt #removed {background-color:#f7cccc;}
#info {color:#888888;}
#context {background-color:#eeeeee;}
td {padding-left:.3em;padding-right:.3em;}
tr.head {border-bottom-width:1px;border-bottom-style:solid;}
tr.head td {padding:0;padding-top:.2em;}
.task {background-color:#ffff00;}
.comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
.error {color:red;}
hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>admin/admin/includes/functions</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1">compatibility.php</a></tt></td><td align="right" id="added">+18</td><td align="right" id="removed">-2</td><td nowrap="nowrap" align="center"><a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/functions/compatibility.php?rev=1.13&content-type=text/vnd.viewcvs-markup">1.13</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/functions/compatibility.php.diff?r1=1.13&r2=1.14">-></a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/functions/compatibility.php?rev=1.14&content-type=text/vnd.viewcvs-markup">1.14</a></td></tr>
</table>
<pre class="comment">
unset global variables when register_globals is enabled
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname"><a href="http://cvs.oscommerce.com/viewcvs.cgi/admin">admin</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin">admin</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/functions">functions</a><br /></span>
<div class="fileheader"><big><b>compatibility.php</b></big> <small id="info"><a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/functions/compatibility.php?rev=1.13&content-type=text/vnd.viewcvs-markup">1.13</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/functions/compatibility.php.diff?r1=1.13&r2=1.14">-></a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/functions/compatibility.php?rev=1.14&content-type=text/vnd.viewcvs-markup">1.14</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.13 -r1.14
--- compatibility.php 2004/08/25 13:11:09 1.13
+++ compatibility.php 2004/11/20 02:12:39 1.14
@@ -19,7 +19,24 @@
</small></pre><pre class="diff" id="context"> if (isset($HTTP_ENV_VARS)) $_ENV =& $HTTP_ENV_VARS;
}
</pre><pre class="diff" id="removed">-// Recursively handle magic_quotes_gpc turned off.
</pre><pre class="diff" id="added">+// unset variables in the global scope if register_globals is enabled
+ if (ini_get('register_globals')) {
+ $superglobals = array($_SERVER, $_ENV, $_FILES, $_COOKIE, $_POST, $_GET);
+
+ if (isset($_SESSION)) {
+ array_unshift($superglobals, $_SESSION);
+ }
+
+ foreach ($superglobals as $superglobal) {
+ foreach ($superglobal as $name => $global) {
+ unset($GLOBALS[$name]);
+ }
+ }
+
+ ini_set('register_globals', false);
+ }
+
+// remove slashes from variables if magic_quotes is enabled
</pre><pre class="diff" id="context"> function osc_remove_magic_quotes(&$array) {
if (!is_array($array) || (sizeof($array) < 1)) {
return false;
</pre><pre class="diff"><small id="info">@@ -34,7 +51,6 @@
</small></pre><pre class="diff" id="context"> }
}
</pre><pre class="diff" id="removed">-// handle magic_quotes_gpc turned off.
</pre><pre class="diff" id="context"> if (get_magic_quotes_gpc() > 0) {
if (isset($_GET)) {
osc_remove_magic_quotes($_GET);
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.9</small></center>
</body></html>
-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8