appDB patch

Jonathan Ernst Jonathan at ErnstFamily.ch
Thu Dec 9 13:28:28 CST 2004


Hello,

I just reviewed the appDB code regarding php 4.x+ compliance (a.k.a
"registered globals should be removed"). I fixed most of them and
everything seems to work fine (the ones that are not yet fixed won't make
any problem as long as we let the php config as it is now). I might try to
fix the remaining vars when this patch or an equivalent patch will be
accepted.

While it was the first time I reviewed this code and the first time I'm
sending a patch to such a big project I fixed some more things and I hope
it won't make the patch too much unreadable. I promise next time I'll do
more tailored patches.

Here are the main changes:
- accesses most globals by their $_XYZ['varname'] name
- fixed some code error and typos (missing $ in front of variable names
and so on)
- fixed a lot of warning that would have been thrown when error_reporting
is set to show notices (if(isset($variable)) instead of  if($variable) for
example)
- removed duplicated css code between winehq stylesheet and appdb one (so
appdb imports now two stylesheets: the one from winehq and the one that
contains additionnal styles): this makes appdb look more like the winehq
website (font sizes) and changes to winehq stylesheet will be
automatically shown on appdb
- improved the main page (replaced <big><b>Page title</b></big> with
<h1></h1>, making the subtitles being <h2>, <h3> and so on
- added a link to sidenet's config script at the bottom of the index page
- added an entry in the stats page that shoes the number of app maintainers
- fixed the file tables/banner.sql even if it seems unused at the moment
as it contained a field whose name was protected (desc->description)

I Hope it helps and I'm looking forward to reading your comments.
jernst

Chris Morgan a écrit :

>What has to be done is very open ended, the biggest task I can think of is
>just fixing up the design of the code to be php 4.x compliant.  We use a lot
>of registered globals which I know is bad but don't know enough of how to
>easily fix.
>
>You can get the code from cvs just like you would get wine:
>export CVSROOT=:pserver:cvs at cvs.winehq.com:/home/wine
>cvs co appdb
>
>If you have changes just generate patches with cvs diff -u and mail them to
>wine-patches and we'll review(mostly just double check) and check them in
;-)
>
>Chris
>

-------------- next part --------------
Index: account.php
===================================================================
RCS file: /home/wine/appdb/account.php,v
retrieving revision 1.3
diff -u -r1.3 account.php
--- account.php	1 Dec 2004 22:26:04 -0000	1.3
+++ account.php	9 Dec 2004 11:45:04 -0000
@@ -13,13 +13,14 @@
 header("Cache-control: no-cache");
 
 //check command and process
-do_account($cmd);
+if(isset($_POST['cmd']))
+ do_account($_POST['cmd']);
+else
+ do_account($_GET['cmd']);
 
 //process according to $cmd from URL
 function do_account($cmd = null)
 {
-    global $ext_username, $ext_password, $ext_password2, $ext_realname, $ext_email;
-
 	if (! $cmd) return 0;
 	switch($cmd)
 	{
@@ -68,58 +69,56 @@
 //create new account
 function cmd_do_new()
 {
-    global $ext_username, $ext_password, $ext_password2, $ext_realname, $ext_email;
-    global $current;
-
-    if(ereg("^.+ at .+\\..+$", $ext_username))
+    
+    if(ereg("^.+ at .+\\..+$", $_POST['ext_username']))
 	{
-	    $ext_username = "";
+	    $_POST['ext_username'] = "";
 	    retry("new", "Invalid Username, must not contain special characters");
 	    return;
 	}
-    if(strlen($ext_username) < 3)
+    if(strlen($_POST['ext_username']) < 3)
 	{
-	    $ext_username = "";
+	    $_POST['ext_username'] = "";
 	    retry("new", "Username must be at least 3 characters");
 	    return;
 	}
-    if(strlen($ext_password) < 5)
+    if(strlen($_POST['ext_password']) < 5)
 	{
 	    retry("new", "Password must be at least 5 characters");
 	    return;
 	}
-    if($ext_password != $ext_password2)
+    if($_POST['ext_password'] != $_POST['ext_password2'])
 	{
 	    retry("new", "Passwords don't match");
 	    return;
 	}
-    if(strlen($ext_realname) == 0)
+    if(!isset($_POST['ext_realname']))
 	{
 	    retry("new", "You don't have a Real name?");
 	    return;
 	}
-    if(!ereg("^.+ at .+\\..+$", $ext_email))
+    if(!ereg("^.+ at .+\\..+$", $_POST['ext_email']))
 	{
-	    $ext_email = "";
+	    $_POST['ext_email'] = "";
 	    retry("new", "Invalid email address");
 	    return;
 	}
 
     $user = new User();
 
-    if($user->exists($ext_username))
+    if($user->exists($_POST['ext_username']))
 	{
-	    $ext_username = "";
+	    $_POST['ext_username'] = "";
 	    retry("new", "That username is already in use");
 	    return;
 	}
 
-    $result = $user->create($ext_username, $ext_password, $ext_realname, $ext_email);
+    $result = $user->create($_POST['ext_username'], $_POST['ext_password'], $_POST['ext_realname'], $_POST['ext_email']);
 
     if($result == null)
 	{
-	    $user->login($ext_username, $ext_password);
-	    addmsg("Account created! ($ext_username)", "green");
+	    $user->login($_POST['ext_username'], $_POST['ext_password']);
+	    addmsg("Account created! (".$_POST['ext_username'].")", "green");
 	    redirect(apidb_fullurl());
 	}
     else
@@ -129,11 +128,9 @@
 //email lost password
 function cmd_send_passwd()
 {
-    global $ext_username;
-
     $user = new User();
     
-    $userid = $user->lookup_userid($ext_username);
+    $userid = $user->lookup_userid($_POST['ext_username']);
     $passwd = generate_passwd();
     
     if ($userid)
@@ -163,7 +160,7 @@
     }
     else
     {
-        addmsg("Sorry, that username [$ext_username] does not exist.", "red");
+        addmsg("Sorry, that username (".$_POST['ext_username'].") does not exist.", "red");
     }
     
     redirect(apidb_fullurl("account.php?cmd=login"));
@@ -172,24 +169,20 @@
 //on login handler
 function cmd_do_login()
 {
-    global $ext_username, $ext_password;
-    global $ext_referer;
-    global $current;
-
     $user = new User();
-    $result = $user->login($ext_username, $ext_password);
+    $result = $user->login($_POST['ext_username'], $_POST['ext_password']);
 
     if($result == null)
 	{
-	    $current = $user;
+	    $_SESSION['current'] = $user;
 	    addmsg("You are successfully logged in as '$user->username'.", "green");
 	    redirect(apidb_fullurl("index.php"));    	    
 	}
     else
 	{
 	    retry("login","Login failed ($result)");
-	    $current = 0;
+	    $_SESSION['current'] = "";
 	}
 }
 
-?>
+?>
\ No newline at end of file
Index: addcomment.php
===================================================================
RCS file: /home/wine/appdb/addcomment.php,v
retrieving revision 1.4
diff -u -r1.4 addcomment.php
--- addcomment.php	17 Nov 2004 23:05:36 -0000	1.4
+++ addcomment.php	9 Dec 2004 11:53:31 -0000
@@ -4,7 +4,7 @@
 require(BASE."include/"."incl.php");
 require(BASE."include/"."application.php");
 
-global $current;
+
 
 if(!$appId) {
     errorpage('Internal Database Access Error');
@@ -33,7 +33,7 @@
     $body1 = mysql_escape_string($body);
 
     // get current userid
-    $userId = (loggedin()) ? $current->userid : 0;
+    $userId = (loggedin()) ? $_SESSION['current']->userid : 0;
 
     $result = mysql_query("INSERT INTO appComments VALUES (NOW(), null, $thread, ".
 			   "$appId, $versionId, $userId, '$hostname', '$subject', ".
@@ -53,7 +53,7 @@
                 $fullAppName = "Application: ".lookupAppName($appId)." Version: ".lookupVersionName($appId, $versionId);
                 $ms .= APPDB_ROOT."appview.php?appId=$appId&versionId=$versionId"."\n";
                 $ms .= "\n";
-                $ms .= ($current->username ? $current->username : "Anonymous")." added comment to ".$fullAppName."\n";
+                $ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." added comment to ".$fullAppName."\n";
                 $ms .= "\n";
                 $ms .= "Subject: ".$subject."\n";
                 $ms .= "\n";
@@ -74,7 +74,7 @@
             $fullAppName = "Application: ".lookupAppName($appId)." Version: ".lookupVersionName($appId, $versionId);
             $ms = APPDB_ROOT."appview.php?appId=$appId&versionId=$versionId"."\n";
             $ms .= "\n";
-            $ms .= ($current->username ? $current->username : "Anonymous")." added comment to ".$fullAppName."\n";
+            $ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." added comment to ".$fullAppName."\n";
             $ms .= "\n";
             $ms .= "Subject: ".$subject."\n";
             $ms .= "\n";
@@ -121,7 +121,7 @@
     
     echo '<table width="100%" border=0 cellpadding=0 cellspacing=1>',"\n";
     echo "<tr bgcolor=#E0E0E0><td align=right><b>From:</b>&nbsp;</td>\n";
-    echo "	<td>&nbsp;". ($current->username ? $current->username : "Anonymous") ." </td></tr>\n";
+    echo "	<td>&nbsp;". ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous") ." </td></tr>\n";
     echo "<tr bgcolor=#E0E0E0><td align=right><b>Subject:</b>&nbsp;</td>\n";
     echo "	<td>&nbsp;<input type=text size=35 name=subject value='$subject'> </td></tr>\n";
     echo "<tr bgcolor=#C0C0C0><td colspan=2><textarea name=body cols=70 rows=15 wrap=virtual>$body</textarea></td></tr>\n";
Index: apidb.css
===================================================================
RCS file: /home/wine/appdb/apidb.css,v
retrieving revision 1.2
diff -u -r1.2 apidb.css
--- apidb.css	6 Oct 2004 15:09:19 -0000	1.2
+++ apidb.css	9 Dec 2004 14:53:19 -0000
@@ -1,23 +1,3 @@
-/* Body Document Defaults */
-BODY 		{ background-color: #E2E2E2;
-              color: #000000; margin: 0; }
-
-/* Link Colors */
-A		    { color: #A50D0D; }
-A:visited	{ color: #FF0000; }
-A:hover		{ color: #FF6666; text-decoration: underline; }
-A:active	{ color: #FF0000; }
-A.hidden	{ text-decoration: none; color: #000000; }
-
-OL,UL,P,BODY	{ font-family: Helvetica, Arial; font-size: 10pt; }
-TD,TR,TH,FORM	{ font-family: Helvetica, Arial; font-size: 10pt; }
-SPAN		{ font-family: Helvetica, Arial; font-size: 10pt; }
-H1,H2,H3	{ font-family: Helvetica, Arial; font-size: 14pt; }
-H4,H5,H6	{ font-family: Helvetica, Arial; font-size: 12pt; }
-INPUT		{ font-family: Helvetica, Arial; font-size: 10pt; }
-PRE,T1		{ font-family: Helvetica, Arial; font-size: 10pt; }
-SMALL		{ font-family: Helvetica, Arial; font-size: 8pt; }
-
 TD.cline { background-color: #EEEEEE; color: #000000; 
 	  text-align: center; font-weight: bold; font-size: 10pt; }
 
@@ -72,82 +52,9 @@
 TD.stub { color: #0000B1; font-weight: italic; text-align: center }
 
 
-/* Copyright Notice */
-.copyright { font-family: Helvetica, Arial; font-size: 8pt; color: #6F6F6F; }
-
-
-/* Rating Number */
-.rating { font-family: Helvetica, Arial; font-size: 6pt; color: #333333; }
-
-
-/* background colors */
-.vltgrey	{ background-color: #f9f9f9; }
-.ltgrey		{ background-color: #EFEFEF; }
-.grey		{ background-color: #C0C0C0; }
-.white		{ background-color: #FFFFFF; }
-.dkgrey		{ background-color: #888888; }
-.ltblack	{ background-color: #999999; }
-.black		{ background-color: #000000; }
-.blueish    { background-color: #bed5f7; }
-
-/* text colors */
-.inverse    { color: #FFFFFF; }
-.disabled	{ color: #999999; }
-.normal		{ color: #000000; }
-.error		{ color: #ff0000; }
-.water		{ color: #6060ff; }
-.good		{ color: #60ff60; }
-.warning	{ color: #fffa00; }
-.blueman    { color: #335184; }
-
-/* text styles */
-.strike 	{ text-decoration: line-through; }
-.bold       { font-weight: bold; }
-.newstitle  { font-size: 14px; font-weight: bold; color: #000000; }
-
-/* Menu Config */
-.menuTitle	       { font-size: 12px; color: #ffffff; font-weight: bold; text-decoration: none; }
-.menuTitle:visited { font-size: 12px; color: #ffffff; font-weight: bold; text-decoration: none; }
-.menuTitle:hover   { font-size: 12px; color: #ffffff; font-weight: bold; text-decoration: none; }
-.menuLink	       { font-size: 10px; color: #ffffff; font-weight: bold; }
-.menuItem	       { font-size: 10px; color: #000000; }
-.menuItem:visited  { font-size: 10px; color: #000000; }
-.menuItem:hover    { font-size: 10px; color: #A50D0D; }
-
-.topMenu	{ background-color: #601919; }
-.sideMenu	{ background-color: #FFFFFF; }
-.border	    { background-color: #601919; }
-
-/* Misc */
-.tiny		{ font-size: 6pt; }
-.small		{ font-size: 8pt; }
-.big		{ font-size: 14pt; }
-
-/* Generic Buttons */
-.button		 { background-color: #6b86bb; color: #ffffff; font-family: Helvetica, Arial, Sans-Serif; font-size: 10pt;
-               padding: 0; }
-.searchInput { background-color: #FFFFFF; color: #000000; font-family: Helvetica, Arial, Sans-Serif; font-size: 10pt;
-               padding: 0; }
-				  
-/* Note Blip */
-.blip		{ color: #ff0000; font-size: 8pt; }				   
-
-/* Footer */
-.footer		{ font-size: 8pt; color: #777777; }
-
-/* Footer Link */
-.footerLink { font-family: Helvetica, Arial; font-size: 8pt; color: #666666; }
-
-
-/* Generic Buttons */
-.button	{ background-color: #666666; color: #ffffff; font-family: Helvetica, Arial; font-size: 10pt;
-                   groove #000000; padding: 0; }
-
-
 /* Vote Button */
 .votebutton	{ background-color: #666666; color: #ffffff; font-family: Helvetica, Arial; font-size: 8pt;
                    groove #000000; padding: 0; }
-
 
 /* Rate Button */
 .ratebutton	{ background-color: #666666; color: #ffffff; font-family: Helvetica, Arial; font-size: 8pt;
Index: appbrowse.php
===================================================================
RCS file: /home/wine/appdb/appbrowse.php,v
retrieving revision 1.2
diff -u -r1.2 appbrowse.php
--- appbrowse.php	15 Mar 2004 20:39:12 -0000	1.2
+++ appbrowse.php	9 Dec 2004 11:14:05 -0000
@@ -11,7 +11,8 @@
 
 function admin_menu()
 {
-    global $catId;
+    if(isset($_REQUEST['catId'])) $catId=$_REQUEST['catId'];
+    else $catId="";
 
     $m = new htmlmenu("Admin");
     $m->add("Edit this Category", $apidb_root."admin/editCategory.php?catId=$catId");
@@ -22,10 +23,8 @@
     $m->done();
 }
 
-$catId = $_REQUEST['catId'];
-
-if(!$catId)
-    $catId = 0; // ROOT
+if(isset($_REQUEST['catId'])) $catId=$_REQUEST['catId'];
+else $catId=0; // ROOT
 
 if( !is_numeric($catId) )
 {
Index: appdbStats.php
===================================================================
RCS file: /home/wine/appdb/appdbStats.php,v
retrieving revision 1.2
diff -u -r1.2 appdbStats.php
--- appdbStats.php	7 Dec 2004 22:42:32 -0000	1.2
+++ appdbStats.php	9 Dec 2004 15:04:51 -0000
@@ -36,6 +36,12 @@
 echo "    <td>".getNumberOfVersions()."</td>\n";
 echo "</tr>\n\n";
 
+/* Display the number of application maintainers */
+echo "<tr class=color4>\n";
+echo "    <td>Application maintainers:</td>\n";
+echo "    <td>".getNumberOfMaintainers()."</td>\n";
+echo "</tr>\n\n";
+
 /* Display the number of images */
 echo "<tr class=color4>\n";
 echo "    <td>Images:</td>\n";
Index: appsubmit.php
===================================================================
RCS file: /home/wine/appdb/appsubmit.php,v
retrieving revision 1.8
diff -u -r1.8 appsubmit.php
--- appsubmit.php	6 Dec 2004 23:12:23 -0000	1.8
+++ appsubmit.php	9 Dec 2004 14:06:18 -0000
@@ -24,7 +24,7 @@
     }
 
     // No vendor entered, and nothing in the list is selected
-    if ( empty( $fields['queueVendor']) and $fields['altvendor'] == '0' )
+    if ( empty( $fields['queueVendor']) and (isset($fields['altvendor']) and $fields['altvendor'] == '0'))
     {
         $errors .= "<li>Please enter a vendor.</li>\n";
     }
@@ -55,12 +55,23 @@
 include("path.php");
 require(BASE."include/"."incl.php");
 require(BASE."include/"."tableve.php");
-global $current;
 
-if ($_REQUEST['queueName'])
+// We make sure every variable is defined to don't let php complain when warning is E_ALL
+if(!isset($queueName))$queueName="";
+if(!isset($queueVersion))$queueVersion="";
+if(!isset($queueVendor))$queueVendor="";
+if(!isset($queueDesc))$queueDesc="";
+if(!isset($queueEmail))$queueEmail="";
+if(!isset($queueURL))$queueURL="";
+if(!isset($appId))$appId="";
+if(!isset($apptype))$apptype="";
+if(!isset($email))$email="";
+if(!isset($_REQUEST['queueImage']))$_REQUEST['queueImage']="";
+
+if (isset($_POST['queueName']))
 {
     // Check input and exit if we found errors
-    $errors = checkInput($_REQUEST);
+    $errors = checkInput($_POST);
     if( !empty($errors) )
     {
         errorpage("We found the following errors:","<ul>$errors</ul><br>Please go back and correct them.");
@@ -110,12 +121,12 @@
         echo "soon about the status of your submission</p>\n";
     }
 }
-else if ($_REQUEST['apptype'])
+else if (isset($_GET['apptype']))
 {
     // set email field if logged in
-    if ($current && loggedin())
+    if (loggedin())
 	{
-        $email = $current->lookup_email($current->userid);
+        $email = $_SESSION['current']->lookup_email($_SESSION['current']->userid);
     }
 
 	// header
@@ -136,7 +147,7 @@
 	echo "<p>To submit screenshots, please email them to ";
 	echo "<a href='mailto:appdb at winehq.org'>appdb at winehq.org</a></p>\n";
 
-        if ($apptype == 1)
+        if ($_GET['apptype'] == 1)
             {
 	    echo html_frame_start("New Application Form",400,"",0);
 	    echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
@@ -193,7 +204,8 @@
             echo '<tr valign=top><td class=color0><b>App Parent</b></td><td>',"\n";
             $x->make_option_list("queueName",stripslashes($appId),"appFamily","appId","appName");
             echo '</td></tr>',"\n";
-
+      
+      
 	    echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n";
             echo '<td><input type=text name="queueVersion" size=20 value="'.$queueVersion.'"></td></tr>',"\n";
 
Index: appview.php
===================================================================
RCS file: /home/wine/appdb/appview.php,v
retrieving revision 1.11
diff -u -r1.11 appview.php
--- appview.php	6 Dec 2004 23:12:23 -0000	1.11
+++ appview.php	9 Dec 2004 11:53:32 -0000
@@ -260,7 +260,7 @@
 	    apidb_sidebar_add("vote_menu");
 
 	// Show Admin Menu
-	if(loggedin() && (havepriv("admin") || $current->ownsApp($appId))) {
+	if(loggedin() && (havepriv("admin") || $_SESSION['current']->ownsApp($appId))) {
 	    apidb_sidebar_add("admin_menu");
 	}
 
Index: deletecomment.php
===================================================================
RCS file: /home/wine/appdb/deletecomment.php,v
retrieving revision 1.4
diff -u -r1.4 deletecomment.php
--- deletecomment.php	1 Dec 2004 22:25:21 -0000	1.4
+++ deletecomment.php	9 Dec 2004 11:53:32 -0000
@@ -67,7 +67,7 @@
     $fullAppName = "Application: ".lookupAppName($appId)." Version: ".lookupVersionName($appId, $versionId);
     $ms .= APPDB_ROOT."appview.php?appId=$appId&versionId=$versionId\n";
     $ms .= "\n";
-    $ms .= ($current->username ? $current->username : "Anonymous")." deleted comment from ".$fullAppName."\n";
+    $ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." deleted comment from ".$fullAppName."\n";
     $ms .= "\n";
     $ms .= "Subject: ".$subject."\n";
     $ms .= "\n";
Index: index.php
===================================================================
RCS file: /home/wine/appdb/index.php,v
retrieving revision 1.6
diff -u -r1.6 index.php
--- index.php	1 Dec 2004 22:26:50 -0000	1.6
+++ index.php	9 Dec 2004 14:58:19 -0000
@@ -14,7 +14,7 @@
 
     <img src="images/appdb_montage.jpg" width=391 height=266 border=0 align=right alt="Wine AppDB">
     
-	<p><big><b>Welcome</b></big></p>
+	<h1>Welcome</h1>
 	
 	<p>This is the Wine Application Database. From here you get info on application
 	compatibility with Wine. For developers, you can get information on the APIs used in an
@@ -61,14 +61,14 @@
 
 
 ?>
-<h1>Wine 0.9 Supported Applications List</h1>
+<h2>Wine 0.9 Supported Applications List</h2>
 
 <p>This is a working version of the application lists which we hope to
 support 'officially' for Wine 0.9. Please send comments, and suggestions,
 about the list to <a href="mailto:clozano at andago.com">Carlos Lozano</a>;
 direct formatting related flames to <a href="mailto:dpaun at rogers.com">Dimitrie O. Paun</a>.</p>
 
-<h2>The Gold List</h2> 
+<h3>The Gold List</h3> 
 <p>Applications which install and run virtually flawless on a 
         out-of-the-box Wine installation make it to the Gold list: <br>
 <table class=gold>
@@ -176,7 +176,7 @@
     </tr>
 </table>
 
-<h2>The Silver List</h2> 
+<h3>The Silver List</h3> 
 <p>The Silver list contains apps which we hope we can easily fix so they make it
    to Gold status:
 <dl class=color4>
@@ -273,12 +273,15 @@
 
 </dl>
 
-<h1>Other Wine Application Compatibility Sites</h1>
-
+<h3>Other Wine Application Compatibility Sites</h3>
 <p>
 <a href="http://frankscorner.org"><b>Frank's Corner</b></a>:  Frank has a fantastic Wine
 application site. The site contains tips and howtos on getting listed apps to run.
 </p>
+<p>
+<a href="http://sidenet.ddo.jp/winetips/config.html"><b>Hajime Segawa's Sidenet wine configuration utility</b></a>:  Scripts to install automatically Internet Explorer 6, Windows Media Player 7, MSN Messenger, RealPlayer and others.
+</p>
+
 
 <?
     echo "<p>&nbsp;</p>\n";
Index: maintainerdelete.php
===================================================================
RCS file: /home/wine/appdb/maintainerdelete.php,v
retrieving revision 1.1
diff -u -r1.1 maintainerdelete.php
--- maintainerdelete.php	9 Nov 2004 22:41:18 -0000	1.1
+++ maintainerdelete.php	9 Dec 2004 11:53:32 -0000
@@ -22,11 +22,11 @@
 
 if($confirmed)
 {
-    global $current;
+    
 
     echo html_frame_start("Removing",400,"",0);
 
-    $query = "DELETE FROM appMaintainers WHERE appId = '$appId' AND versionId = '$versionId' AND userId = '$current->userid';";
+    $query = "DELETE FROM appMaintainers WHERE appId = '$appId' AND versionId = '$versionId' AND userId = '$_SESSION['current']->userid';";
     $result = mysql_query($query);
     if($result)
     {
Index: maintainersubmit.php
===================================================================
RCS file: /home/wine/appdb/maintainersubmit.php,v
retrieving revision 1.1
diff -u -r1.1 maintainersubmit.php
--- maintainersubmit.php	9 Nov 2004 22:41:18 -0000	1.1
+++ maintainersubmit.php	9 Dec 2004 11:53:32 -0000
@@ -61,7 +61,7 @@
     $query = "INSERT INTO appMaintainerQueue VALUES (null, '".
             addslashes($_REQUEST['appId'])."', '".
             addslashes($_REQUEST['versionId'])."', '".
-            addslashes($current->userid)."', '".
+            addslashes($_SESSION['current']->userid)."', '".
             addslashes($_REQUEST['maintainReason'])."',".
             "NOW()".");";
 
Index: noteview.php
===================================================================
RCS file: /home/wine/appdb/noteview.php,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 noteview.php
--- noteview.php	15 Mar 2004 16:22:00 -0000	1.1.1.1
+++ noteview.php	9 Dec 2004 11:53:32 -0000
@@ -33,7 +33,7 @@
 }
 
 //display admin menu
-if(loggedin() && (havepriv("admin") || $current->ownsApp($appId))) {
+if(loggedin() && (havepriv("admin") || $_SESSION['current']->ownsApp($appId))) {
     apidb_sidebar_add("admin_menu");
 }
 
Index: preferences.php
===================================================================
RCS file: /home/wine/appdb/preferences.php,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 preferences.php
--- preferences.php	15 Mar 2004 16:22:00 -0000	1.1.1.1
+++ preferences.php	9 Dec 2004 14:38:43 -0000
@@ -11,7 +11,7 @@
 
 function build_prefs_list()
 {
-    global $current;
+    
 
     opendb();
 
@@ -37,19 +37,19 @@
 		}
 		
 	    $input = html_select("pref_$r->name", explode('|', $r->value_list), 
-				 $current->getpref($r->name, $r->def_value));
+				 $_SESSION['current']->getpref($r->name, $r->def_value));
 	    echo html_tr(array("&nbsp; $r->description", $input));
 	}
 }
 
 function show_user_fields()
 {
-	global $current;
+	
 	$user = new User();
 	
-	$ext_username = $current->username;
-	$ext_realname = $user->lookup_realname($current->userid);
-	$ext_email = $user->lookup_email($current->userid);
+	$ext_username = $_SESSION['current']->username;
+	$ext_realname = $user->lookup_realname($_SESSION['current']->userid);
+	$ext_email = $user->lookup_email($_SESSION['current']->userid);
 	
 	include(BASE."include/"."form_edit.php");
 }
@@ -57,7 +57,7 @@
 if($HTTP_POST_VARS)
 {
     global $ext_username, $ext_password1, $ext_password2, $ext_realname, $ext_email;
-    global $current;
+    
     
     $user = new User();
     
@@ -65,7 +65,7 @@
 	{
 	    if(!ereg("^pref_(.+)$", $key, $arr))
 		continue;
-	    $current->setpref($arr[1], $value);
+	    $_SESSION['current']->setpref($arr[1], $value);
 	}
     
     if ($ext_password == $ext_password2)
@@ -77,7 +77,7 @@
         addmsg("The Passwords you entered did not match.", "red");
     }
     
-    if ($user->update($current->userid, $passwd, $ext_realname, $ext_email))
+    if ($user->update($_SESSION['current']->userid, $passwd, $ext_realname, $ext_email))
     {
         addmsg("Preferences Updated", "green");
     }
@@ -90,7 +90,7 @@
 apidb_header("User Preferences");
 
 echo "<form method=post action='preferences.php'>\n";
-echo html_frame_start("Preferences for $current->username", "80%");
+echo html_frame_start("Preferences for ".$_SESSION['current']->username, "80%");
 echo html_table_begin("width='100%' border=0 align=left cellspacing=0 class='box-body'");
 
 show_user_fields();
Index: screenshots.php
===================================================================
RCS file: /home/wine/appdb/screenshots.php,v
retrieving revision 1.2
diff -u -r1.2 screenshots.php
--- screenshots.php	17 Nov 2004 22:57:20 -0000	1.2
+++ screenshots.php	9 Dec 2004 11:53:32 -0000
@@ -4,7 +4,7 @@
 require(BASE."include/"."incl.php");
 require(BASE."include/"."application.php");
 
-global $current;
+
 
 /*=========================================================================
  *
@@ -44,7 +44,7 @@
                     $fullAppName = "Application: ".lookupAppName($appId)." Version: ".lookupVersionName($appId, $versionId);
                     $ms .= APPDB_ROOT."screenshots.php?appId=$appId&versionId=$versionId"."\n";
                     $ms .= "\n";
-                    $ms .= ($current->username ? $current->username : "Anonymous")." added screenshot ".$screenshot_desc." to ".$fullAppName."\n";
+                    $ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." added screenshot ".$screenshot_desc." to ".$fullAppName."\n";
                     $ms .= "\n";
                     $ms .= STANDARD_NOTIFY_FOOTER;
 
@@ -79,7 +79,7 @@
                         $fullAppName = "Application: ".lookupAppName($appId)." Version: ".lookupVersionName($appId, $versionId);
                         $ms .= APPDB_ROOT."screenshots.php?appId=$appId&versionId=$versionId"."\n";
                         $ms .= "\n";
-                        $ms .= ($current->username ? $current->username : "Anonymous")." deleted screenshot from ".$fullAppName."\n";
+                        $ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." deleted screenshot from ".$fullAppName."\n";
                         $ms .= "\n";
                         $ms .= STANDARD_NOTIFY_FOOTER;
    
@@ -137,7 +137,7 @@
 	    $img = '<a href="javascript:openWin(\'appimage.php?imageId='.$ob->id.'\',\''.$randName.'\','.$size[0].','.$size[1].');">'.$imgSRC.'</a>';
 	    if (loggedin())
 	    {
-	        if ($current->getpref("window:screenshot") == "no")
+	        if ($_SESSION['current']->getpref("window:screenshot") == "no")
 	        {
 	            $img = '<a href="appimage.php?imageId='.$ob->id.'">'.$imgSRC.'</a>';
 	        }
Index: search.php
===================================================================
RCS file: /home/wine/appdb/search.php,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 search.php
--- search.php	15 Mar 2004 16:22:00 -0000	1.1.1.1
+++ search.php	9 Dec 2004 15:09:51 -0000
@@ -4,7 +4,7 @@
 require(BASE."include/"."incl.php");
 require(BASE."include/"."application.php");
 
-$search = str_replace("'", "\\'", $q);
+$search = str_replace("'", "\\'", $_REQUEST['q']);
 $search = "%$search%";
 
 $query = "SELECT * FROM appFamily WHERE appName != 'NONAME' AND appName LIKE '$search' ORDER BY appName";
Index: stdquery.php
===================================================================
RCS file: /home/wine/appdb/stdquery.php,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 stdquery.php
--- stdquery.php	15 Mar 2004 16:22:00 -0000	1.1.1.1
+++ stdquery.php	9 Dec 2004 11:53:32 -0000
@@ -17,9 +17,9 @@
 
 if(loggedin())
 {
-    if($current->getpref("query:hide_header") == "yes")
+    if($_SESSION['current']->getpref("query:hide_header") == "yes")
 	disable_header();
-    if($current->getpref("query:hide_sidebar") == "yes")
+    if($_SESSION['current']->getpref("query:hide_sidebar") == "yes")
 	disable_sidebar();
 }
 
Index: admin/addAppNote.php
===================================================================
RCS file: /home/wine/appdb/admin/addAppNote.php,v
retrieving revision 1.2
diff -u -r1.2 addAppNote.php
--- admin/addAppNote.php	1 Dec 2004 22:33:48 -0000	1.2
+++ admin/addAppNote.php	9 Dec 2004 11:54:24 -0000
@@ -40,7 +40,7 @@
             $fullAppName = "Application: ".lookupAppName($appId)." Version: ".lookupVersionName($appId, $versionId);
             $ms = APPDB_ROOT."appview.php?appId=$appId&versionId=$versionId"."\n";
             $ms .= "\n";
-            $ms .= ($current->username ? $current->username : "Anonymous")." added note to ".$fullAppName."\n";
+            $ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." added note to ".$fullAppName."\n";
             $ms .= "\n";
             $ms .= "title: ".$noteTitle."\n";
             $ms .= "\n";
Index: admin/adminAppQueue.php
===================================================================
RCS file: /home/wine/appdb/admin/adminAppQueue.php,v
retrieving revision 1.7
diff -u -r1.7 adminAppQueue.php
--- admin/adminAppQueue.php	8 Dec 2004 03:03:05 -0000	1.7
+++ admin/adminAppQueue.php	9 Dec 2004 14:32:52 -0000
@@ -20,12 +20,12 @@
 }
 
 
-if ($sub)
+if ($_REQUEST['sub'])
 {
-    if ($queueId)
+    if ($_REQUEST['queueId'])
     {
         //get data
-        $query = "SELECT * from appQueue where queueId = $queueId;";
+        $query = "SELECT * from appQueue where queueId = ".$_REQUEST['queueId'].";";
         $result = mysql_query($query);
         $ob = mysql_fetch_object($result);
         mysql_free_result($result);
@@ -39,14 +39,14 @@
     }
 
     //process according to sub flag
-    if ($sub == 'view' && $queueId)
+    if ($_REQUEST['sub'] == 'view' && $_REQUEST['queueId'])
     {
         $x = new TableVE("view");
         apidb_header("Admin App Queue");
         echo '<form name="qform" action="adminAppQueue.php" method="post" enctype="multipart/form-data">',"\n";
 
         echo '<input type=hidden name="sub" value="add">',"\n"; 
-        echo '<input type=hidden name="queueId" value="'.$queueId.'">',"\n";  
+        echo '<input type=hidden name="queueId" value="'.$_REQUEST['queueId'].'">',"\n";  
 
         If ($ob->queueCatId == -1) //app version
         { 
@@ -160,7 +160,7 @@
                     $checkvendor = $ob2->vendorId;
                 }
             }
-            if(checkvendor)
+            if($checkvendor)
             {
                 $ob->queueVendor = '';
     
@@ -206,50 +206,50 @@
         echo html_frame_end("&nbsp;");
         echo html_back_link(1,'adminAppQueue.php');
     }
-    else if ($sub == 'add' && $queueId)
+    else if ($_REQUEST['sub'] == 'add' && $_REQUEST['queueId'])
     {
         //add item to main db
         $statusMessage = "";
         $goodtogo = 0;
-        if ($type == 'app')
+        if ($_REQUEST['type'] == 'app')
         {
             //process as application family
-            if ($altvendor == 0 && $queueVendor)
+            if ($_REQUEST['altvendor'] == 0 && $_REQUEST['queueVendor'])
             {
                 //add new vendor
-                mysql_query("INSERT into vendor VALUES (null, '".addslashes($queueVendor)."', '');");
-                $altvendor = mysql_insert_id();
+                mysql_query("INSERT into vendor VALUES (null, '".addslashes($_REQUEST['queueVendor'])."', '');");
+                $_REQUEST['altvendor'] = mysql_insert_id();
             }
             
             $query = "INSERT into appFamily VALUES (null, '".
-                                    addslashes($queueName)."', $altvendor, '', '".
-                                addslashes($queueDesc)."', '".
-                                addslashes($queueURL)."', $cat);"; 
+                                    addslashes($_REQUEST['queueName'])."', ".$_REQUEST['altvendor'].", '', '".
+                                addslashes($_REQUEST['queueDesc'])."', '".
+                                addslashes($_REQUEST['queueURL'])."', ".$_REQUEST['cat'].");"; 
                
             if (mysql_query($query))
             {
                     //get the id of the app just added    
-                $appParent = mysql_insert_id();
+                $_REQUEST['appParent'] = mysql_insert_id();
                 //delete queue item
-                mysql_query("DELETE from appQueue where queueId = $queueId;");
+                mysql_query("DELETE from appQueue where queueId = ".$_REQUEST['queueId'].";");
                                             
                 //set ver if not set
-                if (!$queueVersion)
-                    $queueVersion = '1.0';
-                if (!$queueDesc)
-                    $queueDesc = 'released version';
-
-                $verQuery = "INSERT into appVersion VALUES (null, $appParent, '".
-                addslashes($queueVersion)."', '', '".
-                addslashes($queueDesc)."', '".
-                addslashes($queueURL)."', 0.0, 0.0);";
+                if (!$_REQUEST['queueVersion'])
+                    $_REQUEST['queueVersion'] = '1.0';
+                if (!$_REQUEST['queueDesc'])
+                    $_REQUEST['queueDesc'] = 'released version';
+
+                $verQuery = "INSERT into appVersion VALUES (null, ".$_REQUEST['appParent'].", '".
+                addslashes($_REQUEST['queueVersion'])."', '', '".
+                addslashes($_REQUEST['queueDesc'])."', '".
+                addslashes($_REQUEST['queueURL'])."', 0.0, 0.0);";
                 
                 //Now add a version
                 if (mysql_query($verQuery))
                 {
                     //successful
-                    $appVersion = mysql_insert_id();
-                    addmsg("The application $queueName was successfully added into the database", "green");
+                    $_REQUEST['appVersion'] = mysql_insert_id();
+                    addmsg("The application ".$_REQUEST['queueName']." was successfully added into the database", "green");
                     $goodtogo = 1;
                 }
                 else
@@ -268,23 +268,23 @@
                addmsg($statusMessage, "red");
             }
         }
-        else if ($type == 'ver')
+        else if ($_REQUEST['type'] == 'ver')
         {
             //process as application version
-            if ($appParent)
+            if ($_REQUEST['appParent'])
             {
-                $query = "INSERT into appVersion VALUES (null, $appParent, '".
-                addslashes($queueVersion)."', '', '".
-                addslashes($queueDesc)."', '".
-                addslashes($queueURL)."', 0.0, 0.0);";
+                $query = "INSERT into appVersion VALUES (null, ".$_REQUEST['appParent'].", '".
+                addslashes($_REQUEST['queueVersion'])."', '', '".
+                addslashes($_REQUEST['queueDesc'])."', '".
+                addslashes($_REQUEST['queueURL'])."', 0.0, 0.0);";
                 
                 if (mysql_query($query))
                 {
                     //successful
-                    $appVersion = mysql_insert_id();
-                    $statusMessage = "<p>The application $queueName was successfully added into the database</p>\n";
-                    addmsg($statusMessage,Green);
-                    mysql_query("DELETE from appQueue where queueId = $queueId;");
+                    $_REQUEST['appVersion'] = mysql_insert_id();
+                    $statusMessage = "<p>The application ".$_REQUEST['queueName']." was successfully added into the database</p>\n";
+                    addmsg($statusMessage,"Green");
+                    mysql_query("DELETE from appQueue where queueId = ".$_REQUEST['queueId'].";");
                     $goodtogo = 1;
                                         
                 }
@@ -292,13 +292,13 @@
                 {
                     //error
                     $statusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n";
-                    addmsg($statusMessage,red);
+                    addmsg($statusMessage,"red");
                 }
             }
             else
             {
                 addmsg("You did not pick an application Parent!",red);
-                redirect(apidb_fullurl("admin/adminAppQueue.php?cat=view&queueId=$queueId"));
+                redirect(apidb_fullurl("admin/adminAppQueue.php?cat=view&queueId=".$_REQUEST['queueId']));
                 exit;
 
             }
@@ -308,13 +308,13 @@
         //Send Status Email
         if ($ob->queueEmail && $goodtogo)
         {
-            $fullAppName = lookupAppName($appParent)." Version: ".lookupVersionName($appParent, $appVersion);
+            $fullAppName = lookupAppName($_REQUEST['appParent'])." Version: ".lookupVersionName($_REQUEST['appParent'], $_REQUEST['appVersion']);
              
             $ms =  "Application Database Status Report\n";
             $ms .= "----------------------------------\n\n";
             $ms .= "Your application: ".$fullAppName." has been entered ";
             $ms .= "into the application database.\n\n";
-            $ms .= APPDB_ROOT."appview.php?appId=$appParent&versionId=$appVersion"."\n\n";
+            $ms .= APPDB_ROOT."appview.php?appId=".$_REQUEST['appParent']."&versionId=".$_REQUEST['appVersion']."\n\n";
             $ms .= "Thanks!\n\n";
             $ms .= $emailtext;
 
@@ -322,12 +322,12 @@
         }
         if ($goodtogo)
         {
-            $email = getNotifyEmailAddressList($appParent, $appVersion);
+            $email = getNotifyEmailAddressList($_REQUEST['appParent'], $_REQUEST['appVersion']);
             if($email)
             {
-                $fullAppName = "Application: ".lookupAppName($appParent).
-                    " Version: ".lookupVersionName($appParent, $appVersion);
-                $ms = APPDB_ROOT."appview.php?appId=$appParent&versionId=$appVersion"."\n\n";
+                $fullAppName = "Application: ".lookupAppName($_REQUEST['appParent']).
+                    " Version: ".lookupVersionName($_REQUEST['appParent'], $_REQUEST['appVersion']);
+                $ms = APPDB_ROOT."appview.php?appId=".$_REQUEST['appParent']."&versionId=".$_REQUEST['appVersion']."\n\n";
                 $ms .= "New Application added to database:\n\n";
                 $ms .= $fullAppName."\n\n";
                 $ms .= STANDARD_NOTIFY_FOOTER;
@@ -338,24 +338,24 @@
             {
                 $email = "no one";
             }
-            addmsg("mesage sent to: ".$email, green);
+            addmsg("mesage sent to: ".$email, "green");
 
         }
         //done
-        addmsg("<a href=".apidb_fullurl("appview.php")."?appId=".$appParent."&versionId=".$appVersion.">Veiw App</a>", "green");
+        addmsg("<a href=".apidb_fullurl("appview.php")."?appId=".$_REQUEST['appParent']."&versionId=".$_REQUEST['appVersion'].">Veiw App</a>", "green");
         redirect(apidb_fullurl("admin/adminAppQueue.php"));
         exit;
     }
-    else if ($sub == 'Delete' && $queueId)
+    else if ($_REQUEST['sub'] == 'Delete' && $_REQUEST['queueId'])
     {
         //delete main item
-        $query = "DELETE from appQueue where queueId = $queueId;";
+        $query = "DELETE from appQueue where queueId = ".$_REQUEST['queueId'].";";
         $result = mysql_query($query);
         if(!$result)
         {
             //error
             addmsg("Internal Error: unable to delete selected application!", "red");
-            redirect(apidb_fullurl("admin/adminAppQueue.php?appId=$appId&versionId=$versionId"));
+            redirect(apidb_fullurl("admin/adminAppQueue.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
         }
         else
         {   
@@ -364,7 +364,7 @@
             {
                 if($ob->queueCatId == -1) //app version
                 {
-                    $fullAppName = lookupAppName($appParent)." Version: ".$ob->queueVersion;
+                    $fullAppName = lookupAppName($_REQUEST['appParent'])." Version: ".$ob->queueVersion;
                 } else
                 {
                     $fullAppName = $ob->queueName." Version: ".$ob->queueVersion;
@@ -381,7 +381,7 @@
             }
             //success
             addmsg("Application was successfully deleted from the Queue.", "green");
-            redirect(apidb_fullurl("admin/adminAppQueue.php?appId=$appId&versionId=$versionId"));
+            redirect(apidb_fullurl("admin/adminAppQueue.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
         }
     }
     else
Index: admin/adminCommentView.php
===================================================================
RCS file: /home/wine/appdb/admin/adminCommentView.php,v
retrieving revision 1.1
diff -u -r1.1 adminCommentView.php
--- admin/adminCommentView.php	1 Dec 2004 22:28:52 -0000	1.1
+++ admin/adminCommentView.php	9 Dec 2004 11:54:24 -0000
@@ -9,12 +9,12 @@
 
 apidb_header("Comments");
 
-function display_range($currentPage, $pageRange, $totalPages, $commentsPerPage)
+function display_range($_SESSION['current']Page, $pageRange, $totalPages, $commentsPerPage)
 {
     /* display the links to each of these pages */
-    if($currentPage != 0)
+    if($_SESSION['current']Page != 0)
     {
-        $previousPage = $currentPage - 1;
+        $previousPage = $_SESSION['current']Page - 1;
         echo "<a href='adminCommentView.php?page=$previousPage&commentsPerPage=$commentsPerPage'>Previous</a> ";
     } else
         echo "Previous ";
@@ -22,38 +22,38 @@
     /* display the next 10 and previous 10 pages */
     $pageRange = 10;
 
-    if($currentPage > $pageRange)
-        $startPage = $currentPage - $pageRange;
+    if($_SESSION['current']Page > $pageRange)
+        $startPage = $_SESSION['current']Page - $pageRange;
     else
         $startPage = 0;
 
-    if($currentPage + $pageRange < $totalPages)
-        $endPage = $currentPage + $pageRange;
+    if($_SESSION['current']Page + $pageRange < $totalPages)
+        $endPage = $_SESSION['current']Page + $pageRange;
     else
         $endPage = $totalPages;
 
     /* display the desired range */
     for($x = $startPage; $x <= $endPage; $x++)
     {
-        if($x != $currentPage)
+        if($x != $_SESSION['current']Page)
             echo "<a href='adminCommentView.php?page=$x&commentsPerPage=$commentsPerPage'>$x</a> ";
         else
             echo "$x ";
     }
 
-    if($currentPage < $totalPages)
+    if($_SESSION['current']Page < $totalPages)
     {
-        $nextPage = $currentPage + 1;
+        $nextPage = $_SESSION['current']Page + 1;
         echo "<a href='adminCommentView.php?page=$nextPage&commentsPerPage=$commentsPerPage'>Next</a> ";
     } else
         echo "Next ";
 }
 
 $commentsPerPage = 10;
-$currentPage = 0;
+$_SESSION['current']Page = 0;
 
 if($_REQUEST['page'])
-    $currentPage = $_REQUEST['page'];
+    $_SESSION['current']Page = $_REQUEST['page'];
 
 if($_REQUEST['commentsPerPage'])
     $commentsPerPage = $_REQUEST['commentsPerPage'];
@@ -64,8 +64,8 @@
 
 /* display page selection links */
 echo "<center>";
-echo "<b>Page $currentPage of $totalPages</b><br>";
-display_range($currentPage, $pageRange, $totalPages, $commentsPerPage);
+echo "<b>Page $_SESSION['current']Page of $totalPages</b><br>";
+display_range($_SESSION['current']Page, $pageRange, $totalPages, $commentsPerPage);
 echo "<br>";
 echo "<br>";
 
@@ -84,14 +84,14 @@
 }
 echo "</select>";
 
-echo "<input type=hidden name=page value=$currentPage>";
+echo "<input type=hidden name=page value=$_SESSION['current']Page>";
 echo "<input type=submit value='Refresh'>";
 echo "</form>";
 
 echo "</center>";
 
 /* query for all of the commentId's, ordering by their time in reverse order */
-$offset = $currentPage * $commentsPerPage;
+$offset = $_SESSION['current']Page * $commentsPerPage;
 $commentIds = mysql_query("SELECT commentId from appComments ORDER BY ".
                           "appComments.time ASC LIMIT $offset, $commentsPerPage;");
 while ($ob = mysql_fetch_object($commentIds))
@@ -108,7 +108,7 @@
 
 /* display page selection links */
 echo "<center>";
-display_range($currentPage, $pageRange, $totalPages, $commentsPerPage);
+display_range($_SESSION['current']Page, $pageRange, $totalPages, $commentsPerPage);
 echo "</center>";
 
 apidb_footer();
Index: admin/editAppFamily.php
===================================================================
RCS file: /home/wine/appdb/admin/editAppFamily.php,v
retrieving revision 1.4
diff -u -r1.4 editAppFamily.php
--- admin/editAppFamily.php	17 Nov 2004 23:09:07 -0000	1.4
+++ admin/editAppFamily.php	9 Dec 2004 11:54:25 -0000
@@ -8,7 +8,7 @@
 
 global $apidb_root;
 
-if(!loggedin() || (!havepriv("admin") && !$current->ownsApp($appId)) )
+if(!loggedin() || (!havepriv("admin") && !$_SESSION['current']->ownsApp($appId)) )
 {
     errorpage("Insufficient Privileges!");
     exit;
Index: admin/editAppNote.php
===================================================================
RCS file: /home/wine/appdb/admin/editAppNote.php,v
retrieving revision 1.2
diff -u -r1.2 editAppNote.php
--- admin/editAppNote.php	1 Dec 2004 22:33:48 -0000	1.2
+++ admin/editAppNote.php	9 Dec 2004 11:54:25 -0000
@@ -53,7 +53,7 @@
                 $fullAppName = "Application: ".lookupAppName($appId)." Version: ".lookupVersionName($appId, $versionId);
                 $ms = APPDB_ROOT."appview.php?appId=$appId&versionId=$versionId"."\n";
                 $ms .= "\n";
-                $ms .= ($current->username ? $current->username : "Anonymous")." deleted note from ".$fullAppName."\n";
+                $ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." deleted note from ".$fullAppName."\n";
                 $ms .= "\n";
                 $ms .= "title: ".$oldNoteTitle."\n";
                 $ms .= "\n";
@@ -92,7 +92,7 @@
                 $fullAppName = "Application: ".lookupAppName($appId)." Version: ".lookupVersionName($appId, $versionId);
                 $ms = APPDB_ROOT."appview.php?appId=$appId&versionId=$versionId"."\n";
                 $ms .= "\n";
-                $ms .= ($current->username ? $current->username : "Anonymous")." changed note for ".$fullAppName."\n";
+                $ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." changed note for ".$fullAppName."\n";
                 $ms .= "\n";
                 $ms .= "From --------------------------\n";
                 $ms .= "title: ".$oldNoteTitle."\n";
Index: admin/editAppVersion.php
===================================================================
RCS file: /home/wine/appdb/admin/editAppVersion.php,v
retrieving revision 1.3
diff -u -r1.3 editAppVersion.php
--- admin/editAppVersion.php	8 Dec 2004 03:03:05 -0000	1.3
+++ admin/editAppVersion.php	9 Dec 2004 11:54:25 -0000
@@ -81,7 +81,7 @@
                     $fullAppName = "Application: ".lookupAppName($appId)." Version: ".lookupVersionName($appId, $versionId);
                     $ms .= APPDB_ROOT."appview.php?appId=$appId&versionId=$versionId"."\n";
                     $ms .= "\n";
-                    $ms .= ($current->username ? $current->username : "Anonymous")." changed ".$fullAppName."\n";
+                    $ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." changed ".$fullAppName."\n";
                     $ms .= "\n";
                     $ms .= $WhatChanged."\n";
                     $ms .= "\n";
Index: help/index.php
===================================================================
RCS file: /home/wine/appdb/help/index.php,v
retrieving revision 1.2
diff -u -r1.2 index.php
--- help/index.php	13 May 2004 20:34:17 -0000	1.2
+++ help/index.php	9 Dec 2004 15:02:52 -0000
@@ -10,9 +10,9 @@
 
 $help_path = $apidb_root."/help";
 
-if($topic)
+if(isset($_REQUEST['topic']))
 {
-    display_help($topic);
+    display_help($_REQUEST['topic']);
 } else {
     display_index();    
 }
Index: include/comments.php
===================================================================
RCS file: /home/wine/appdb/include/comments.php,v
retrieving revision 1.5
diff -u -r1.5 comments.php
--- include/comments.php	8 Dec 2004 02:47:26 -0000	1.5
+++ include/comments.php	9 Dec 2004 11:49:34 -0000
@@ -214,7 +214,6 @@
 
 function view_app_comments($appId, $versionId, $threadId = 0)
 {
-    global $current;
     global $cmode;
 
     // count posts
@@ -232,9 +231,9 @@
     {
 	    //FIXME we need to change this so not logged in users can change current view as well
         if ($cmode)
-    		$current->setpref("comments:mode", $cmode);
+    		$_SESSION[current]->setpref("comments:mode", $cmode);
 	
-        $sel[$current->getpref("comments:mode")] = 'selected';
+        $sel[$_SESSION['current']->getpref("comments:mode")] = 'selected';
 	    echo '<td><form method=get name=smode action="appview.php">',"\n";
         echo "<b>Application Comments</b> $messageCount total comments ";
 	    echo '<b>Mode</b> <select name="cmode" onchange="document.smode.submit();">',"\n";
@@ -265,7 +264,7 @@
     
     //hide or display depending on pref
     if (loggedin())
-	    $mode = $current->getpref("comments:mode");
+	    $mode = $_SESSION['current']->getpref("comments:mode");
     else
 	    $mode = "flat";
 
Index: include/form_edit.php
===================================================================
RCS file: /home/wine/appdb/include/form_edit.php,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 form_edit.php
--- include/form_edit.php	15 Mar 2004 16:22:03 -0000	1.1.1.1
+++ include/form_edit.php	9 Dec 2004 14:46:04 -0000
@@ -11,7 +11,7 @@
 
       <tr>
 	<td> &nbsp; User Name </td>
-	<td> <b> <?=$ext_username?> </b> </td>
+	<td> <b> <?=$ext_username;?> </b> </td>
       </tr>
       <tr>
 	<td> &nbsp; Password </td>
@@ -23,11 +23,11 @@
       </tr>
       <tr>
 	<td> &nbsp; Real Name </td>
-	<td> <input type="text" name="ext_realname" value="<?=$ext_realname?>"> </td>
+	<td> <input type="text" name="ext_realname" value="<?=$ext_realname;?>"> </td>
       </tr>
       <tr>
 	<td> &nbsp; Email Address </td>
-	<td> <input type="text" name="ext_email" value="<?=$ext_email?>"> </td>
+	<td> <input type="text" name="ext_email" value="<?=$ext_email;?>"> </td>
       </tr>
       <tr>
 	<td colspan=2>&nbsp;</td>
Index: include/form_login.php
===================================================================
RCS file: /home/wine/appdb/include/form_login.php,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 form_login.php
--- include/form_login.php	15 Mar 2004 16:22:01 -0000	1.1.1.1
+++ include/form_login.php	9 Dec 2004 10:40:05 -0000
@@ -24,7 +24,7 @@
     <table border="0" width="100%" cellspacing=0 cellpadding="10">  
       <tr>
 	<td class=color1> User Name </td> 
-	<td class=color0> <input type="text" name="ext_username" value='<?=$ext_username?>'> </td>
+	<td class=color0> <input type="text" name="ext_username" value='<?if(isset($_POST['ext_username'])) echo $_POST['ext_username']?>'> </td>
       </tr>
       <tr>
 	<td class=color1> Password </td> 
@@ -43,7 +43,7 @@
 
 echo html_frame_end("&nbsp;");
 echo '<input type="hidden" name="cmd" value="do_login">',"\n";
-echo '<input type="hidden" name="ext_referer" value="'.$HTTP_REFERER.'">',"\n";
+echo '<input type="hidden" name="ext_referer" value="'.$_SERVER['HTTP_REFERER'].'">',"\n";
 echo '</form>',"\n";
 
 ?>
Index: include/form_new.php
===================================================================
RCS file: /home/wine/appdb/include/form_new.php,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 form_new.php
--- include/form_new.php	15 Mar 2004 16:22:01 -0000	1.1.1.1
+++ include/form_new.php	9 Dec 2004 10:42:38 -0000
@@ -15,7 +15,7 @@
     <table border=0 width="100%" cellspacing=0 cellpadding=20>
       <tr>
 	<td class=color1> User Name </td>
-	<td class=color0> <input type="text" name="ext_username" value='<?=$ext_username?>'> </td>
+	<td class=color0> <input type="text" name="ext_username" value='<?if(isset($_POST['ext_username'])) echo $_POST['ext_username']?>'> </td>
       </tr>
       <tr>
 	<td class=color1> Password </td>
@@ -27,11 +27,11 @@
       </tr>
       <tr>
 	<td class=color1> Real Name </td>
-	<td class=color0> <input type="text" name="ext_realname" value='<?=$ext_realname?>'> </td>
+	<td class=color0> <input type="text" name="ext_realname" value='<?if(isset($_POST['ext_realname'])) echo $_POST['ext_realname']?>'> </td>
       </tr>
       <tr>
 	<td class=color1> Email Address </td>
-	<td class=color0> <input type="text" name="ext_email" value='<?=$ext_email?>'> </td>
+	<td class=color0> <input type="text" name="ext_email" value='<?if(isset($_POST['ext_email'])) echo $_POST['ext_email']?>'> </td>
       </tr>
       
       <tr>
Index: include/header.php
===================================================================
RCS file: /home/wine/appdb/include/header.php,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 header.php
--- include/header.php	15 Mar 2004 16:22:01 -0000	1.1.1.1
+++ include/header.php	9 Dec 2004 14:53:31 -0000
@@ -16,7 +16,8 @@
     <meta HTTP-EQUIV="Expires" CONTENT="Mon, 06 Jan 1990 00:00:01 GMT">
     <meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-	<link rel="stylesheet" href="<?=$apidb_root?>apidb.css" type="text/css">
+	  <link rel="stylesheet" href="<?=$apidb_root?>apidb.css" type="text/css">
+	  <link rel="stylesheet" href="http://www.winehq.org/winehq_styles.css" type="text/css">
     <script language="JavaScript" src="<?=$apidb_root?>scripts.js" type="text/javascript"></script>
 </head>
 
Index: include/html.php
===================================================================
RCS file: /home/wine/appdb/include/html.php,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 html.php
--- include/html.php	15 Mar 2004 16:22:01 -0000	1.1.1.1
+++ include/html.php	9 Dec 2004 10:06:41 -0000
@@ -197,7 +197,7 @@
 
     if ($width) { $width = 'width="'.$width.'"'; }
 
-$str .= '<table '.$width.' border=0 cellpadding=0 cellspacing=0 align=center>'."\n";
+$str = '<table '.$width.' border=0 cellpadding=0 cellspacing=0 align=center>'."\n";
 
 if ($title)
 {
Index: include/incl.php
===================================================================
RCS file: /home/wine/appdb/include/incl.php,v
retrieving revision 1.4
diff -u -r1.4 incl.php
--- include/incl.php	1 Dec 2004 22:25:21 -0000	1.4
+++ include/incl.php	9 Dec 2004 14:01:33 -0000
@@ -6,7 +6,6 @@
  */
 
 //set global path
-global $apidb_root;
 $apidb_root = BASE;
 
 //get modules
@@ -60,9 +59,9 @@
  */
 function apidb_header($title = 0)
 {
-    global $apidb_root, $current;
+    global $apidb_root;
 
-    $username = $current->username;
+    $username = isset($_SESSION['current'])?$_SESSION['current']->username:"";
 
     // Set Page Title
     $page_title = $title;
@@ -97,7 +96,6 @@
 function apidb_footer()
 {
     global $apidb_root;
-    global $current;
 
     echo html_frame_end();
 
@@ -105,7 +103,7 @@
     echo "<br></td></tr></table>\n";
     
     // Display Footer
-    if(!$header_disabled)
+    if(!isset($header_disabled))
     include(BASE."include/"."footer.php");
 }
 
@@ -202,7 +200,6 @@
  */
 function addmsg($text, $color = "black")
 {
-    global $current;
     global $PHPSESSID;
 
     if($color)
@@ -220,7 +217,6 @@
  */
 function dumpmsgbuffer()
 {
-    global $current;
     global $PHPSESSID;
     
     $result = mysql_query("SELECT * FROM sessionMessages WHERE sessionId = '$PHPSESSID'");
Index: include/rating.php
===================================================================
RCS file: /home/wine/appdb/include/rating.php,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 rating.php
--- include/rating.php	15 Mar 2004 16:22:03 -0000	1.1.1.1
+++ include/rating.php	9 Dec 2004 14:37:47 -0000
@@ -15,12 +15,11 @@
  */
 function rating_current_for_user($versionId, $system)
 {
-    global $current;
 
     if(!loggedin())
 	return 0;
 
-    $userId = $current->userid;
+    $userId = $_SESSION['current']->userid;
 
     $result = mysql_query("SELECT score FROM appRating WHERE versionId = $versionId AND system = '$system' AND userId = $userId");
     if(!$result)
@@ -38,7 +37,6 @@
  */
 function rating_menu()
 {
-    global $versionId;
     global $apidb_root;
 
     $s = '<img src="'.$apidb_root.'images/s1.gif" border=0 alt="s1">';
@@ -46,8 +44,8 @@
     
     $j = new htmlmenu("Compatibility Rating","updaterating.php");
 
-    $r_win = rating_current_for_user($versionId, "windows");
-    $r_fake = rating_current_for_user($versionId, "fake");
+    $r_win = rating_current_for_user($_REQUEST['versionId'], "windows");
+    $r_fake = rating_current_for_user($_REQUEST['versionId'], "fake");
 
     $wchk = array('checked',' ',' ',' ',' ',' ');
     $fchk = array('checked',' ',' ',' ',' ',' ');
@@ -78,7 +76,7 @@
 
     
     $j->addmisc("<input type=submit value='  Rate it!  ' class=ratebutton>","center");
-    $j->addmisc("<input type=hidden name=versionId value=$versionId>");
+    $j->addmisc("<input type=hidden name=versionId value=".$_REQUEST['versionId'].">");
     
     $j->add("Rating Help", $apidb_root."help/?topic=ratings");
     
@@ -161,7 +159,6 @@
  */
 function rating_update($vars)
 {
-    global $current;
 
     if(!loggedin())
 	{
@@ -169,7 +166,7 @@
 	    return;
 	}
 
-    $userId = $current->userid;
+    $userId = $_SESSION[current]->userid;
     $versionId = $vars["versionId"];
     $score_w = $vars["score_w"];
     $score_f = $vars["score_f"];
Index: include/session.php
===================================================================
RCS file: /home/wine/appdb/include/session.php,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 session.php
--- include/session.php	15 Mar 2004 16:22:02 -0000	1.1.1.1
+++ include/session.php	9 Dec 2004 14:05:32 -0000
@@ -2,13 +2,11 @@
 
 function apidb_session_start()
 {
-    global $current;
-
     session_set_cookie_params(time() + 3600 * 48);
     session_start();
-
-    if($current)
-	$current->connect();
+    if(isset($_SESSION['current'])) {
+ 	    $_SESSION['current']->connect();
+ 	  }
 }
 
 
@@ -40,7 +38,7 @@
 
 function _session_read($key)
 {
-    global $msg_buffer;
+	  if(isset($_REQUEST['msg_buffer']))$msg_buffer=$_REQUEST['msg_buffer'];
 
     opendb();
     $result = mysql_query("SELECT data, messages FROM session_list WHERE session_id = '$key'");
@@ -57,15 +55,12 @@
 
 function _session_write($key, $value)
 {
-    global $current;
-    global $msg_buffer;
-    global $apidb_debug;
 
     opendb();
 
 
-    if($msg_buffer)
-	$messages = implode("|", $msg_buffer);
+    if(isset($_REQUEST['msg_buffer']))
+	$messages = implode("|", $_REQUEST['msg_buffer']);
     else
 	$messages = "";
 
@@ -75,12 +70,12 @@
 
 
     //DEBUGGING
-    if ($apidb_debug)
+    if (isset($_REQUEST['apidb_debug']))
         mysql_query("INSERT INTO debug VALUES(null, '$key = $messages')");
 
 
-    if($current)
-	mysql_query("REPLACE session_list VALUES ('$key', $current->userid, '".get_remote()."', '$value', '$messages', NOW())");
+    if(isset($_SESSION['current']))
+	mysql_query("REPLACE session_list VALUES ('$key', ".$_SESSION['current']->userid.", '".get_remote()."', '$value', '$messages', NOW())");
     else
 	mysql_query("REPLACE session_list VALUES ('$key', 0, '".get_remote()."', null, '$messages', NOW())");
 
@@ -107,7 +102,4 @@
 			 "_session_write", 
 			 "_session_destroy", 
 			 "_session_gc");
-
-session_register("current");
-
 ?>
Index: include/sidebar.php
===================================================================
RCS file: /home/wine/appdb/include/sidebar.php,v
retrieving revision 1.3
diff -u -r1.3 sidebar.php
--- include/sidebar.php	1 Dec 2004 22:26:50 -0000	1.3
+++ include/sidebar.php	9 Dec 2004 10:07:04 -0000
@@ -33,7 +33,7 @@
 function app_search_box($q = '')
 {
    global $apidb_root;
-   $str .= '<form method="get" action="'.$apidb_root.'search.php">'."\n";
+   $str = '<form method="get" action="'.$apidb_root.'search.php">'."\n";
    $str .= "<input type=text name=q value='$q' size=8 class=searchfield>";
    $str .= "<input type=submit value='Search' class=searchbutton>\n";
    $str .= "</form>\n";
Index: include/sidebar_login.php
===================================================================
RCS file: /home/wine/appdb/include/sidebar_login.php,v
retrieving revision 1.3
diff -u -r1.3 sidebar_login.php
--- include/sidebar_login.php	8 Dec 2004 03:56:00 -0000	1.3
+++ include/sidebar_login.php	9 Dec 2004 14:02:55 -0000
@@ -16,14 +16,13 @@
     
     if(loggedin())
     {
-        global $current;
 
         $g->add("Logout", $apidb_root."account.php?cmd=logout");
         $g->add("Preferences", $apidb_root."preferences.php");
         
         /* if this user maintains any applications list them */
         /* in their sidebar */
-        $apps_user_maintains = getAppsFromUserId($current->userid);
+        $apps_user_maintains = getAppsFromUserId($_SESSION['current']->userid);
         if($apps_user_maintains)
         {
             $g->addmisc("");
Index: include/tableve.php
===================================================================
RCS file: /home/wine/appdb/include/tableve.php,v
retrieving revision 1.2
diff -u -r1.2 tableve.php
--- include/tableve.php	15 Mar 2004 17:18:22 -0000	1.2
+++ include/tableve.php	9 Dec 2004 11:49:37 -0000
@@ -193,7 +193,7 @@
     {
     
 	$result = mysql_query("SELECT $idField, $nameField FROM $table $where ORDER BY $nameField");
-	if(!result)
+	if(!$result)
 	    return; // Oops
 
 	echo "<select name='$varname'>\n";
@@ -396,7 +396,6 @@
      */
     function update($vars)
     {
-	global $current;
 
 	$tables = array();
 	$fieldnames = array();
@@ -474,7 +473,7 @@
 			if(ereg("^impl_.+$", $table))
 			    {
 				$value = $fieldnames["apiid"][$i];
-				mysql_query("UPDATE $table SET lastmodby = $current->userid WHERE apiid = $value");
+				mysql_query("UPDATE $table SET lastmodby = ".$_SESSION['current']->userid." WHERE apiid = $value");
 			    }
 		    }
 	    }
Index: include/user.php
===================================================================
RCS file: /home/wine/appdb/include/user.php,v
retrieving revision 1.7
diff -u -r1.7 user.php
--- include/user.php	8 Dec 2004 03:16:08 -0000	1.7
+++ include/user.php	9 Dec 2004 11:49:36 -0000
@@ -222,7 +222,6 @@
      */
     function is_maintainer($appId, $versionId)
     {
-        global $current;
         if(!loggedin() || !$this->userid)
             return false;
 
@@ -274,9 +273,7 @@
 
 function loggedin()
 {
-    global $current;
-
-    if($current && $current->userid)
+    if(isset($_SESSION['current']) && $_SESSION['current']->userid)
 	return true;
 
     return false;
@@ -284,41 +281,33 @@
 
 function havepriv($priv)
 {
-    global $current;
-
     if(!loggedin())
         return false;
 
-    return $current->checkpriv($priv);
+    return $_SESSION['current']->checkpriv($priv);
 }
 
 function isMaintainer($appId, $versionId)
 {
-    global $current;
-
     if(!loggedin())
         return false;
 
-    return $current->is_maintainer($appId, $versionId);
+    return $_SESSION['current']->is_maintainer($appId, $versionId);
 }
 
 function debugging()
 {
-    global $current;
-
     if(!loggedin())
 	return false;
-    return $current->getpref("debug") == "yes";
+    return $_SESSION['current']->getpref("debug") == "yes";
 }
 
 
 function makeurl($text, $url, $pref = null)
 {
-    global $current;
-
     if(loggedin())
 	{
-	    if($current->getpref($pref) == "yes")
+	    if($_SESSION['current']->getpref($pref) == "yes")
 		$extra = "window='new'";
 	}
     return "<a href='$url' $extra> $text </a>\n";
Index: include/util.php
===================================================================
RCS file: /home/wine/appdb/include/util.php,v
retrieving revision 1.6
diff -u -r1.6 util.php
--- include/util.php	8 Dec 2004 03:46:38 -0000	1.6
+++ include/util.php	9 Dec 2004 15:07:04 -0000
@@ -214,6 +214,14 @@
     return $row->num_versions;
 }
 
+/* Get the number of maintainers in the database */
+function getNumberOfMaintainers()
+{
+    $result = mysql_query("SELECT count(maintainerId ) as num_maintainers FROM appMaintainers;");
+    $row = mysql_fetch_object($result);
+    return $row->num_maintainers;
+}
+
 /* Get the number of app familes in the database */
 function getNumberOfAppFamilies()
 {
Index: include/vote.php
===================================================================
RCS file: /home/wine/appdb/include/vote.php,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 vote.php
--- include/vote.php	15 Mar 2004 16:22:03 -0000	1.1.1.1
+++ include/vote.php	9 Dec 2004 11:54:24 -0000
@@ -9,12 +9,11 @@
  */
 function vote_count($appId, $userId = null)
 {
-    global $current;
 
     if(!$userId)
 	{
 	    if(loggedin())
-		$userId = $current->userid;
+		$userId = $_SESSION['current']->userid;
 	    else
 		return 0;
 	}
@@ -27,12 +26,10 @@
  */
 function vote_count_user_total($userId = null)
 {
-    global $current;
-
     if(!$userId)
         {
             if(loggedin())
-                $userId = $current->userid;
+                $userId = $_SESSION['current']->userid;
             else
                 return 0;
         }
@@ -57,13 +54,12 @@
  */
 function vote_add($appId, $slot, $userId = null)
 {
-    global $current;
     global $MAX_VOTES;
 
     if(!$userId)
         {
             if(loggedin())
-                $userId = $current->userid;
+                $userId = $_SESSION['current']->userid;
             else
                 return;
         }
@@ -80,12 +76,12 @@
  */
 function vote_remove($appId, $slot, $userId = null)
 {
-    global $current;
+    
 
     if(!$userId)
         {
             if(loggedin())
-                $userId = $current->userid;
+                $userId = $_SESSION['current']->userid;
             else
                 return;
         }
@@ -94,12 +90,12 @@
 
 function vote_get_user_votes($userId = null)
 {
-    global $current;
+    
 
     if(!$userId)
         {
             if(loggedin())
-                $userId = $current->userid;
+                $userId = $_SESSION['current']->userid;
 	    if(!$userId)
                 return array();
         }
@@ -170,10 +166,10 @@
 
 function vote_update($vars)
 {
-    global $current;
+    
 
     //FIXME this doesn't work since msgs only work when logged in
-    if(!$current)
+    if(!$_SESSION['current'])
 	{
 	    addmsg("You must be logged in to vote", "red");
 	    return;
Index: tables/banner.sql
===================================================================
RCS file: /home/wine/appdb/tables/banner.sql,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 banner.sql
--- tables/banner.sql	15 Mar 2004 16:22:03 -0000	1.1.1.1
+++ tables/banner.sql	9 Dec 2004 15:15:57 -0000
@@ -1,6 +1,6 @@
 CREATE TABLE banner (
 	id		int not null,
-	desc		text,
+	description 	text,
 	img		varchar(255),
 	url		varchar(255),
 	alt		varchar(255),


More information about the wine-patches mailing list