- replaced tons of tabs with spaces

- replaced <? with <?php for compatibility sake (see TODO and CODING_STANDARD to know more)
- improved overall code lisibility
This commit is contained in:
Jonathan Ernst
2004-12-12 03:51:51 +00:00
committed by WineHQ
parent 7270e4cabc
commit d3d9e853d9
73 changed files with 1156 additions and 1219 deletions

View File

@@ -1,9 +1,7 @@
<? <?php
/********************************************/
/* /* Account Login / Logout Handler for AppDB */
* Account Login / Logout Handler for AppDB /********************************************/
*
*/
include("path.php"); include("path.php");
include(BASE."include/"."incl.php"); include(BASE."include/"."incl.php");
@@ -18,7 +16,10 @@ if(isset($_POST['cmd']))
else else
do_account($_GET['cmd']); do_account($_GET['cmd']);
//process according to $cmd from URL
/**
* process according to $cmd from URL
*/
function do_account($cmd = null) function do_account($cmd = null)
{ {
if (!$cmd) return 0; if (!$cmd) return 0;
@@ -59,14 +60,19 @@ function do_account($cmd = null)
exit; exit;
} }
//retry /**
* retry
*/
function retry($cmd, $msg) function retry($cmd, $msg)
{ {
addmsg($msg, "red"); addmsg($msg, "red");
do_account($cmd); do_account($cmd);
} }
//create new account
/**
* create new account
*/
function cmd_do_new() function cmd_do_new()
{ {
@@ -125,7 +131,10 @@ function cmd_do_new()
retry("new", "Failed to create account: $result"); retry("new", "Failed to create account: $result");
} }
//email lost password
/**
* email lost password
*/
function cmd_send_passwd() function cmd_send_passwd()
{ {
$user = new User(); $user = new User();
@@ -166,7 +175,10 @@ function cmd_send_passwd()
redirect(apidb_fullurl("account.php?cmd=login")); redirect(apidb_fullurl("account.php?cmd=login"));
} }
//on login handler
/**
* on login handler
*/
function cmd_do_login() function cmd_do_login()
{ {
$user = new User(); $user = new User();
@@ -177,8 +189,7 @@ function cmd_do_login()
$_SESSION['current'] = $user; $_SESSION['current'] = $user;
addmsg("You are successfully logged in as '$user->username'.", "green"); addmsg("You are successfully logged in as '$user->username'.", "green");
redirect(apidb_fullurl("index.php")); redirect(apidb_fullurl("index.php"));
} } else
else
{ {
retry("login","Login failed ($result)"); retry("login","Login failed ($result)");
$_SESSION['current'] = ""; $_SESSION['current'] = "";

View File

@@ -1,4 +1,4 @@
<? <?php
/********************************/ /********************************/
/* code to submit a new comment */ /* code to submit a new comment */
/********************************/ /********************************/

View File

@@ -1,4 +1,4 @@
<? <?php
include("path.php"); include("path.php");
include(BASE."include/"."incl.php"); include(BASE."include/"."incl.php");

View File

@@ -1,9 +1,7 @@
<? <?php
/************************/
/* /* Add Application Note */
* Add Application Note /************************/
*
*/
include("path.php"); include("path.php");
include(BASE."include/"."incl.php"); include(BASE."include/"."incl.php");

View File

@@ -1,4 +1,4 @@
<? <?php
include("path.php"); include("path.php");
include(BASE."include/"."incl.php"); include(BASE."include/"."incl.php");

View File

@@ -1,4 +1,4 @@
<? <?php
include("path.php"); include("path.php");

View File

@@ -1,7 +1,7 @@
<?php <?php
/** /*************************************/
* code to View and approve new Apps /* code to View and approve new Apps */
*/ /*************************************/
include("path.php"); include("path.php");
require(BASE."include/"."incl.php"); require(BASE."include/"."incl.php");

View File

@@ -1,7 +1,8 @@
<? <?php
/************************************************************/
/* Page for managing all of the comments in the apidb */ /* Page for managing all of the comments in the apidb */
/* Without having go into each application version to do so */ /* Without having go into each application version to do so */
/************************************************************/
include("path.php"); include("path.php");
include(BASE."include/"."incl.php"); include(BASE."include/"."incl.php");

View File

@@ -1,6 +1,7 @@
<? <?php
/********************************************************/
/* code to View and approve new application maintainers */ /* code to View and approve new application maintainers */
/********************************************************/
include("path.php"); include("path.php");
require(BASE."include/"."incl.php"); require(BASE."include/"."incl.php");

View File

@@ -1,6 +1,7 @@
<? <?php
/*****************************************************************/
/* code to view and maintain the list of application maintainers */ /* code to view and maintain the list of application maintainers */
/*****************************************************************/
include("path.php"); include("path.php");
require(BASE."include/"."incl.php"); require(BASE."include/"."incl.php");

View File

@@ -1,4 +1,4 @@
<? <?php
include("path.php"); include("path.php");

View File

@@ -1,4 +1,4 @@
<? <?php
include("path.php"); include("path.php");

View File

@@ -1,8 +1,7 @@
<? <?php
/****************/
/* /* Edit AppNote */
* Edit AppNote /****************/
*/
include("path.php"); include("path.php");
include(BASE."include/"."incl.php"); include(BASE."include/"."incl.php");

View File

@@ -1,4 +1,4 @@
<? <?php
include("path.php"); include("path.php");

View File

@@ -1,4 +1,4 @@
<? <?php
include("path.php"); include("path.php");

View File

@@ -1,4 +1,4 @@
<? <?php
include("path.php"); include("path.php");
include(BASE."include/"."incl.php"); include(BASE."include/"."incl.php");

View File

@@ -1,5 +1,4 @@
<? <?php
include("path.php"); include("path.php");
include(BASE."include/"."incl.php"); include(BASE."include/"."incl.php");

View File

@@ -1,4 +1,4 @@
<? <?php
include("path.php"); include("path.php");
include(BASE."include/"."incl.php"); include(BASE."include/"."incl.php");

View File

@@ -1,9 +1,7 @@
<? <?php
/***************************/
// /* Admin Script for API Db */
// Admin Script for API Db /***************************/
// last modified 04-20-01
//
include("path.php"); include("path.php");
include(BASE."include/"."incl.php"); include(BASE."include/"."incl.php");

View File

@@ -1,3 +1,3 @@
<? <?php
define("BASE","../"); define("BASE","../");
?> ?>

View File

@@ -1,7 +1,7 @@
<? <?php
/**********************************/
/* code to BROWSE categories/apps */ /* code to BROWSE categories/apps */
/**********************************/
include("path.php"); include("path.php");
require(BASE."include/"."incl.php"); require(BASE."include/"."incl.php");

View File

@@ -1,6 +1,7 @@
<? <?php
/****************************************************************/
/* Code to view all kinds of interesting statistics about appdb */ /* Code to view all kinds of interesting statistics about appdb */
/****************************************************************/
include("path.php"); include("path.php");
require(BASE."include/"."incl.php"); require(BASE."include/"."incl.php");

View File

@@ -1,23 +1,23 @@
<? <?php
/*************************************************************/
/* app image handler */
/* */
/* valid arguments: */
/* */
/* appId (required) */
/* versionId */
/* */
/* imageId (no appId required if this is specified) */
/* */
/* width */
/* height */
/* */
/* When both width/height are specified, the image is scaled */
/*************************************************************/
include("path.php"); include("path.php");
require(BASE."include/"."incl.php"); require(BASE."include/"."incl.php");
/*
* app image handler
*
* valid arguments:
*
* appId (required)
* versionId
*
* imageId (no appId required if this is specified)
*
* width
* height
*
* When both width/height are specified, the image is scaled
*/
function handle_error($text) function handle_error($text)
{ {

View File

@@ -1,4 +1,4 @@
<? <?php
/************************************/ /************************************/
/* code to Submit a new application */ /* code to Submit a new application */
/************************************/ /************************************/

View File

@@ -1,6 +1,4 @@
<? <?php
/* /*
* Application Database - appview.php * Application Database - appview.php
* *

View File

@@ -1,12 +1,9 @@
<? <?php
/************************************************************/
/*========================================================================= /* view comments */
* /* */
* view comments /* script expects appId, versionId and threadId as argument */
* /************************************************************/
* script expects appId, versionId and threadId as argument
*
*/
include("path.php"); include("path.php");
include(BASE."include/"."incl.php"); include(BASE."include/"."incl.php");
@@ -17,5 +14,4 @@ apidb_header("Comments");
view_app_comments($appId, $versionId, $threadId); view_app_comments($appId, $versionId, $threadId);
apidb_footer(); apidb_footer();
?> ?>

View File

@@ -1,4 +1,4 @@
<? <?php
include("path.php"); include("path.php");
require(BASE."include/"."incl.php"); require(BASE."include/"."incl.php");

View File

@@ -1,4 +1,4 @@
<? <?php
include("path.php"); include("path.php");
include(BASE."include/"."incl.php"); include(BASE."include/"."incl.php");
@@ -76,10 +76,10 @@ if($HTTP_POST_VARS)
?> ?>
<input type="hidden" name="userid" value="<?=$userid?>"> <input type="hidden" name="userid" value="<?php echo $userid; ?>">
<tr> <tr>
<td> &nbsp; User Name </td> <td> &nbsp; User Name </td>
<td> <b> <?=$ext_username?> </b> </td> <td> <b> <?php echo $ext_username; ?> </b> </td>
</tr> </tr>
<tr> <tr>
<td> &nbsp; Password </td> <td> &nbsp; Password </td>
@@ -91,15 +91,16 @@ if($HTTP_POST_VARS)
</tr> </tr>
<tr> <tr>
<td> &nbsp; Real Name </td> <td> &nbsp; Real Name </td>
<td> <input type="text" name="ext_realname" value="<?=$ext_realname?>"> </td> <td> <input type="text" name="ext_realname" value="<?php echo $ext_realname; ?>"> </td>
</tr> </tr>
<tr> <tr>
<td> &nbsp; Email Address </td> <td> &nbsp; Email Address </td>
<td> <input type="text" name="ext_email" value="<?=$ext_email?>"> </td> <td> <input type="text" name="ext_email" value="<?php echo $ext_email; ?>"> </td>
</tr> </tr>
<tr> <tr>
<td> &nbsp; Administrator </td> <td> &nbsp; Administrator </td>
<td> <input type="checkbox" name="ext_hasadmin" "<?=$ext_hasadmin?>"> </td> <td> <input type="checkbox" name="ext_hasadmin" "<?php echo $ext_hasadmin; ?>"> </td>
</tr> </tr>
<tr> <tr>
<td colspan=2>&nbsp;</td> <td colspan=2>&nbsp;</td>

View File

@@ -1,9 +1,7 @@
<? <?php
/*********************************************/
/* /* Application Database Documentation Center */
* Application Database Documentation Center /*********************************************/
*
*/
include("path.php"); include("path.php");
include(BASE."include/"."incl.php"); include(BASE."include/"."incl.php");

View File

@@ -1,3 +1,3 @@
<? <?php
define("BASE","../"); define("BASE","../");
?> ?>

View File

@@ -1,4 +1,4 @@
<? <?php
function log_category_visit($catId) function log_category_visit($catId)
{ {

View File

@@ -1,6 +1,8 @@
<? <?php
/***********************************************************/
/* this class represents an application incl. all versions */ /* this class represents an application incl. all versions */
/***********************************************************/
class Application { class Application {
var $data; var $data;

View File

@@ -1,16 +1,13 @@
<? <?php
/**********************************************/
/* Banner Ad Library */
/* by Jeremy Newman <jnewman@codeweavers.com> */
/* last modified: 2001.10.08 */
/**********************************************/
/* /**
* Banner Ad Library
* by Jeremy Newman <jnewman@codeweavers.com>
* last modified: 2001.10.08
*
*/
/*
* Path for Banner Ads * Path for Banner Ads
*/ */
function banner_display () function banner_display ()
{ {
// import banner paths from config // import banner paths from config

View File

@@ -1,6 +1,8 @@
<? <?php
/***************************************************/
/* this class represents a category + its children */ /* this class represents a category + its children */
/***************************************************/
class Category { class Category {
var $name; var $name;
@@ -8,7 +10,7 @@ class Category {
var $subcat; var $subcat;
/* /**
* the special name "ROOT" is the top category * the special name "ROOT" is the top category
*/ */
function Category($id = 0) function Category($id = 0)
@@ -17,7 +19,7 @@ class Category {
} }
/* /**
* load the category data into this class * load the category data into this class
*/ */
function load($id) function load($id)
@@ -27,11 +29,11 @@ class Category {
if($id == 0) if($id == 0)
{ {
$this->name = "ROOT"; $this->name = "ROOT";
} } else
else
{ {
$result = mysql_query("SELECT * FROM appCategory WHERE catId = $id"); $result = mysql_query("SELECT * FROM appCategory WHERE catId = $id");
if(!$result) { if(!$result)
{
// category not found! // category not found!
errorpage("Internal Error: Category not found!"); errorpage("Internal Error: Category not found!");
return; return;
@@ -50,7 +52,7 @@ class Category {
$this->subcat = array(); $this->subcat = array();
while($row = mysql_fetch_object($result)) while($row = mysql_fetch_object($result))
{ {
// Ignore NONAME categories // ignore NONAME categories
if($row->catName == "NONAME") if($row->catName == "NONAME")
continue; continue;
$this->subcat[$row->catId] = array($row->catName, $row->catDescription); $this->subcat[$row->catId] = array($row->catName, $row->catDescription);
@@ -58,7 +60,7 @@ class Category {
} }
/* /**
* resolve the category id by name * resolve the category id by name
*/ */
function getCategoryId($name) function getCategoryId($name)
@@ -77,7 +79,7 @@ class Category {
} }
/* /**
* returns the list of sub categories * returns the list of sub categories
* *
* category list has the following format: * category list has the following format:
@@ -89,7 +91,7 @@ class Category {
return $this->subcat; return $this->subcat;
} }
/* /**
* returns a path like: * returns a path like:
* *
* { ROOT, Games, Simulation } * { ROOT, Games, Simulation }
@@ -112,7 +114,7 @@ class Category {
} }
/* /**
* returns a list of applications in the specified category * returns a list of applications in the specified category
*/ */
function getAppList($id) function getAppList($id)
@@ -134,7 +136,7 @@ class Category {
} }
/* /**
* returns the number of apps in the specified category * returns the number of apps in the specified category
*/ */
function getAppCount($id, $recurse = 1) function getAppCount($id, $recurse = 1)
@@ -158,6 +160,7 @@ class Category {
} }
}; };
function appIdToName($appId) function appIdToName($appId)
{ {
$result = mysql_query("SELECT appName FROM appFamily WHERE appId = $appId"); $result = mysql_query("SELECT appName FROM appFamily WHERE appId = $appId");
@@ -176,12 +179,11 @@ function versionIdToName($versionId)
return $ob->versionName; return $ob->versionName;
} }
// create the Category: line at the top of appdb pages /**
* create the Category: line at the top of appdb pages$
*/
function make_cat_path($path) function make_cat_path($path)
{ {
global $appId;
global $versionId;
$str = ""; $str = "";
$catCount = 0; $catCount = 0;
while(list($idx, list($id, $name)) = each($path)) while(list($idx, list($id, $name)) = each($path))
@@ -191,16 +193,16 @@ function make_cat_path($path)
else else
$catname = $name; $catname = $name;
if ($catCount > 0) { $str .= " &gt; "; } if ($catCount > 0) $str .= " &gt; ";
$str .= html_ahref($catname,"appbrowse.php?catId=$id"); $str .= html_ahref($catname,"appbrowse.php?catId=$id");
$catCount++; $catCount++;
} }
if($appId) if($_REQUEST['appId'])
$str .= " &gt; ".html_ahref(appIdToName($appId),"appview.php?appId=$appId"); $str .= " &gt; ".html_ahref(appIdToName($_REQUEST['appId']),"appview.php?appId=".$_REQUEST['appId']);
if($versionId) if($_REQUEST['versionId'])
$str .= " &gt; ".html_ahref(versionIdToName($versionId),"appview.php?appId=$appId&versionId=$versionId"); $str .= " &gt; ".html_ahref(versionIdToName($_REQUEST['versionId']),"appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']);
return $str; return $str;
} }

View File

@@ -1,10 +1,8 @@
<? <?php
/***************************/
/* get user info for posts */
/***************************/
/*=========================================================================
*
* get user info for posts
*
*/
function forum_lookup_user ($userid) function forum_lookup_user ($userid)
{ {
$mailto = ''; $mailto = '';
@@ -30,10 +28,8 @@ function forum_lookup_user ($userid)
return $mailto; return $mailto;
} }
/*========================================================================= /**
*
* display a single comment (in $ob) * display a single comment (in $ob)
*
*/ */
function view_app_comment($ob) function view_app_comment($ob)
{ {
@@ -84,9 +80,7 @@ function view_app_comment($ob)
} }
/**
/*=========================================================================
*
* grab comments for appId / versionId * grab comments for appId / versionId
* if parentId is not -1 only comments for that thread are returned * if parentId is not -1 only comments for that thread are returned
*/ */
@@ -107,26 +101,21 @@ function grab_comments($appId, $versionId, $parentId = -1)
return $result; return $result;
} }
/*========================================================================= /**
*
* grab comments for appId / versionId * grab comments for appId / versionId
* if parentId is not -1 only comments for that thread are returned * if parentId is not -1 only comments for that thread are returned
*/ */
function count_comments($appId, $versionId) function count_comments($appId, $versionId)
{ {
$qstring = "SELECT count(commentId) as hits FROM appComments WHERE appId = $appId AND versionId = $versionId"; $qstring = "SELECT count(commentId) as hits FROM appComments WHERE appId = $appId AND versionId = $versionId";
$result = mysql_query($qstring); $result = mysql_query($qstring);
$ob = mysql_fetch_object($result); $ob = mysql_fetch_object($result);
return $ob->hits; return $ob->hits;
} }
/*========================================================================= /**
*
* display nested comments * display nested comments
*
* handle is a db result set * handle is a db result set
*
*/ */
function do_display_comments_nested($handle) function do_display_comments_nested($handle)
{ {
@@ -151,12 +140,9 @@ function display_comments_nested($appId, $versionId, $threadId)
} }
/*========================================================================= /**
*
* display threaded comments * display threaded comments
*
* handle is a db result set * handle is a db result set
*
*/ */
function do_display_comments_threaded($handle, $is_main) function do_display_comments_threaded($handle, $is_main)
{ {
@@ -168,8 +154,7 @@ function do_display_comments_threaded($handle, $is_main)
if ($is_main) if ($is_main)
{ {
view_app_comment($ob); view_app_comment($ob);
} } else
else
{ {
echo '<li><a href="commentview.php?appId='.$ob->appId.'&versionId='.$ob->versionId.'&threadId='.$ob->parentId.'"> '. echo '<li><a href="commentview.php?appId='.$ob->appId.'&versionId='.$ob->versionId.'&threadId='.$ob->parentId.'"> '.
$ob->subject.' </a> by '.forum_lookup_user($ob->userid).' on '.$ob->time.' </li>'."\n"; $ob->subject.' </a> by '.forum_lookup_user($ob->userid).' on '.$ob->time.' </li>'."\n";
@@ -188,6 +173,7 @@ function do_display_comments_threaded($handle, $is_main)
echo "</ul>\n"; echo "</ul>\n";
} }
function display_comments_threaded($appId, $versionId, $threadId = 0) function display_comments_threaded($appId, $versionId, $threadId = 0)
{ {
$result = grab_comments($appId, $versionId, $threadId); $result = grab_comments($appId, $versionId, $threadId);
@@ -196,10 +182,8 @@ function display_comments_threaded($appId, $versionId, $threadId = 0)
} }
/*========================================================================= /**
*
* display flat comments * display flat comments
*
*/ */
function display_comments_flat($appId, $versionId) function display_comments_flat($appId, $versionId)
{ {
@@ -233,7 +217,7 @@ function view_app_comments($appId, $versionId, $threadId = 0)
{ {
// FIXME we need to change this so not logged in users can change current view as well // FIXME we need to change this so not logged in users can change current view as well
if ($cmode) if ($cmode)
$_SESSION[current]->setpref("comments:mode", $cmode); $_SESSION['current']->setpref("comments:mode", $cmode);
$sel[$_SESSION['current']->getpref("comments:mode")] = 'selected'; $sel[$_SESSION['current']->getpref("comments:mode")] = 'selected';
echo '<td><form method=get name=smode action="appview.php">',"\n"; echo '<td><form method=get name=smode action="appview.php">',"\n";
@@ -284,7 +268,6 @@ function view_app_comments($appId, $versionId, $threadId = 0)
} }
echo '</td></tr></table>',"\n"; echo '</td></tr></table>',"\n";
} }

View File

@@ -1,5 +1,7 @@
<? <?php
/* config file for apidb */ /*************************/
/* config file for appDB */
/*************************/
/* /*

View File

@@ -1,6 +1,4 @@
<? <?php
$public_link = null; $public_link = null;
$private_link = null; $private_link = null;

View File

@@ -1,8 +1,4 @@
<!-- start of footer.inc --> <!-- start of footer.inc -->
</body> </body>
</html> </html>
<!-- end of footer.inc --> <!-- end of footer.inc -->

View File

@@ -1,14 +1,10 @@
<? <?php
/*********************/
/* /* Edit Account Form */
* Edit Account Form /*********************/
*
*/
?> ?>
<!-- start of edit account form --> <!-- start of edit account form -->
<tr> <tr>
<td> &nbsp; User Name </td> <td> &nbsp; User Name </td>
<td> <b> <?=$ext_username;?> </b> </td> <td> <b> <?=$ext_username;?> </b> </td>
@@ -34,8 +30,3 @@
</tr> </tr>
<!-- end of edit account form --> <!-- end of edit account form -->
<?
?>

View File

@@ -1,19 +1,14 @@
<? <?php
/**************/
/* /* Login Form */
* Login Form /**************/
*
*/
echo '<form method="post" name="flogin" action="account.php">',"\n"; echo '<form method="post" name="flogin" action="account.php">',"\n";
echo html_frame_start("Login to Application DB","400","",0) echo html_frame_start("Login to Application DB","400","",0)
?> ?>
<!-- start of login form --> <!-- start of login form -->
<script type="text/javascript">
<script language="javascript"> <!--
<!--//
function cmd_send_passwd() { function cmd_send_passwd() {
document.flogin.cmd.value = "send_passwd"; document.flogin.cmd.value = "send_passwd";
document.flogin.submit(); document.flogin.submit();
@@ -24,7 +19,7 @@ function cmd_send_passwd() {
<table border="0" width="100%" cellspacing=0 cellpadding="10"> <table border="0" width="100%" cellspacing=0 cellpadding="10">
<tr> <tr>
<td class=color1> User Name </td> <td class=color1> User Name </td>
<td class=color0> <input type="text" name="ext_username" value='<?if(isset($_POST['ext_username'])) echo $_POST['ext_username']?>'> </td> <td class=color0> <input type="text" name="ext_username" value='<?php if(isset($_POST['ext_username'])) echo $_POST['ext_username']?>'> </td>
</tr> </tr>
<tr> <tr>
<td class=color1> Password </td> <td class=color1> Password </td>
@@ -39,7 +34,7 @@ function cmd_send_passwd() {
<!-- end of login form --> <!-- end of login form -->
<? <?php
echo html_frame_end("&nbsp;"); echo html_frame_end("&nbsp;");
echo '<input type="hidden" name="cmd" value="do_login">',"\n"; echo '<input type="hidden" name="cmd" value="do_login">',"\n";
@@ -54,7 +49,7 @@ echo '</form>',"\n";
<p align=center>Lost your password?<br> <p align=center>Lost your password?<br>
[<a href="javascript:cmd_send_passwd();" onMouseOver="document.status='';return true;">Email a New Password</a>]</p> [<a href="javascript:cmd_send_passwd();" onMouseOver="document.status='';return true;">Email a New Password</a>]</p>
<? <?php
echo p(),p(),p(); echo p(),p(),p();

View File

@@ -1,21 +1,17 @@
<? <?php
/********************/
/* /* New Account Form */
* New Account Form /********************/
*
*/
echo '<form method="post" action="account.php">',"\n"; echo '<form method="post" action="account.php">',"\n";
echo html_frame_start("Create New Application DB Account","400","",0) echo html_frame_start("Create New Application DB Account","400","",0)
?> ?>
<!-- start of new account form --> <!-- start of new account form -->
<table border=0 width="100%" cellspacing=0 cellpadding=20> <table border=0 width="100%" cellspacing=0 cellpadding=20>
<tr> <tr>
<td class=color1> User Name </td> <td class=color1> User Name </td>
<td class=color0> <input type="text" name="ext_username" value='<?if(isset($_POST['ext_username'])) echo $_POST['ext_username']?>'> </td> <td class=color0> <input type="text" name="ext_username" value='<?php if(isset($_POST['ext_username'])) echo $_POST['ext_username']?>'> </td>
</tr> </tr>
<tr> <tr>
<td class=color1> Password </td> <td class=color1> Password </td>
@@ -42,7 +38,7 @@ echo html_frame_start("Create New Application DB Account","400","",0)
</table> </table>
<!-- end of new account form --> <!-- end of new account form -->
<? <?php
echo html_frame_end("&nbsp;"); echo html_frame_end("&nbsp;");
echo '<input type="hidden" name="cmd" value="do_new">',"\n"; echo '<input type="hidden" name="cmd" value="do_new">',"\n";

View File

@@ -1,10 +1,7 @@
<? <?php
/*********************************/
/* /* Application Database - Header */
* Application Database - Header /*********************************/
*
*/
?> ?>
<!-- start of header.inc --> <!-- start of header.inc -->
@@ -12,12 +9,12 @@
<html> <html>
<head> <head>
<title>Wine Application DB <?=$title?></title> <title>Wine Application DB <?php echo $title; ?></title>
<meta HTTP-EQUIV="Expires" CONTENT="Mon, 06 Jan 1990 00:00:01 GMT"> <meta HTTP-EQUIV="Expires" CONTENT="Mon, 06 Jan 1990 00:00:01 GMT">
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache"> <meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <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="<?php echo $apidb_root; ?>apidb.css" type="text/css">
<script language="JavaScript" src="<?=$apidb_root?>scripts.js" type="text/javascript"></script> <script language="JavaScript" src="<?php echo $apidb_root; ?>scripts.js" type="text/javascript"></script>
</head> </head>
<body bgcolor="#E2E2E2" text="#000000"> <body bgcolor="#E2E2E2" text="#000000">
@@ -27,21 +24,21 @@
<td> <td>
<table width="100%" border=0 cellpadding=0 cellspacing=0> <table width="100%" border=0 cellpadding=0 cellspacing=0>
<tr> <tr>
<td width="100%"><a href="<?=$apidb_root?>"><img src="<?=$apidb_root?>images/winehq_top_logo.gif" width=300 height=99 border=0 alt="Wine HQ"></a></td> <td width="100%"><a href="<?php echo $apidb_root; ?>"><img src="<?php echo $apidb_root; ?>images/winehq_top_logo.gif" width=300 height=99 border=0 alt="Wine HQ"></a></td>
<td> <td>
<img src="<?=$apidb_root?>images/blank.gif" border=0 width=10 height=1 alt=""> <img src="<?php echo $apidb_root; ?>images/blank.gif" border=0 width=10 height=1 alt="">
</td> </td>
<td width="100%" align="center" valign="middle"> <td width="100%" align="center" valign="middle">
<!-- BANNER AD --> <!-- BANNER AD -->
<table border=0 cellpadding=1 cellspacing=0> <table border=0 cellpadding=1 cellspacing=0>
<tr><td valign="middle" align="center" class="black" <tr><td valign="middle" align="center" class="black"
><?=$banner_ad?></td ><?php echo $banner_ad; ?></td
></tr> ></tr>
</table> </table>
<!-- END BANNER AD --> <!-- END BANNER AD -->
</td> </td>
<td> <td>
<img src="<?=$apidb_root?>images/blank.gif" border=0 width=10 height=1 alt=""> <img src="<?php echo $apidb_root; ?>images/blank.gif" border=0 width=10 height=1 alt="">
</td> </td>
</tr> </tr>
</table> </table>

View File

@@ -1,9 +1,7 @@
<? <?php
/*************************************************/
/* /* Main Include Library for Application Database */
* Main Include Library for Application Database /*************************************************/
*
*/
// set global path // set global path
$apidb_root = BASE; $apidb_root = BASE;
@@ -20,7 +18,7 @@ require(BASE."include/"."html.php");
$sidebar_func_list = array(); $sidebar_func_list = array();
$help_list = array(); $help_list = array();
// Start session ... // start session ...
apidb_session_start(); apidb_session_start();
@@ -139,7 +137,8 @@ function apidb_sidebar()
} }
/* register a sidebar menu function /**
* register a sidebar menu function
* the supplied function is called when the sidebar is built * the supplied function is called when the sidebar is built
*/ */
function apidb_sidebar_add($funcname) function apidb_sidebar_add($funcname)
@@ -156,7 +155,7 @@ function apidb_image($name)
} }
/* /**
* display an error page * display an error page
*/ */
function errorpage($text = null, $message = null) function errorpage($text = null, $message = null)
@@ -172,7 +171,7 @@ function errorpage($text = null, $message = null)
/* /**
* redirect to $url * redirect to $url
*/ */
function redirect($url) function redirect($url)
@@ -180,22 +179,20 @@ function redirect($url)
header("Location: ".$url); header("Location: ".$url);
} }
/* /**
* redirect back to referer, or else to the main page * redirect back to referer, or else to the main page
*/ */
function redirectref($url = null) function redirectref($url = null)
{ {
global $HTTP_REFERER;
if(!$url) if(!$url)
$url = $HTTP_REFERER; $url = $_SERVER['HTTP_REFERER'];
if(!$url) if(!$url)
$url = apidb_fullurl(); $url = apidb_fullurl();
redirect($url); redirect($url);
} }
/* /**
* msgs will be displayed on the Next page view of the same user * msgs will be displayed on the Next page view of the same user
*/ */
function addmsg($text, $color = "black") function addmsg($text, $color = "black")
@@ -212,7 +209,7 @@ function addmsg($text, $color = "black")
/* /**
* output msg_buffer and clear it. * output msg_buffer and clear it.
*/ */
function dumpmsgbuffer() function dumpmsgbuffer()
@@ -234,7 +231,7 @@ function dumpmsgbuffer()
mysql_query("DELETE FROM sessionMessages WHERE sessionId = '$PHPSESSID'"); mysql_query("DELETE FROM sessionMessages WHERE sessionId = '$PHPSESSID'");
} }
/* /**
* Statics * Statics
*/ */
define("APPDB_ROOT", "http://appdb.winehq.org/"); define("APPDB_ROOT", "http://appdb.winehq.org/");

View File

@@ -1,13 +1,16 @@
<? <?php
/*****************************/
/* functions for maintainers */
/*****************************/
/* /**
* get the applications and versions that this userId maintains * get the applications and versions that this userId maintains
*/ */
function getAppsFromUserId($userId) function getAppsFromUserId($userId)
{ {
$result = mysql_query("SELECT appId, versionId, superMaintainer FROM ". $result = mysql_query("SELECT appId, versionId, superMaintainer FROM ".
"appMaintainers WHERE userId = '$userId'"); "appMaintainers WHERE userId = '$userId'");
if(mysql_num_rows($result) == 0) if(!$result || mysql_num_rows($result) == 0)
return; return;
$retval = array(); $retval = array();
@@ -53,7 +56,7 @@ function getSuperMaintainersUserIdsFromAppId($appId)
"appMaintainers WHERE appId = '$appId' " . "appMaintainers WHERE appId = '$appId' " .
"AND superMaintainer = '1';"; "AND superMaintainer = '1';";
$result = mysql_query($query); $result = mysql_query($query);
if(mysql_num_rows($result) == 0) if(!$result || mysql_num_rows($result) == 0)
return; // no sub categories return; // no sub categories
$retval = array(); $retval = array();

View File

@@ -1,4 +1,4 @@
<? <?php
class htmlmenu { class htmlmenu {
function htmlmenu($name, $form = null) function htmlmenu($name, $form = null)
@@ -43,7 +43,8 @@ echo '
if($url) if($url)
{ {
echo " <tr class=sideMenu><td width='100%'><span class=menuItem>&nbsp;<a href='$url' class=menuItem>$name</a></span></td></tr>\n"; echo " <tr class=sideMenu><td width='100%'><span class=menuItem>&nbsp;<a href='$url' class=menuItem>$name</a></span></td></tr>\n";
} else { } else
{
echo " <tr class=sideMenu><td width='100%'><span class=menuItem>&nbsp;$name</span></td></tr>\n"; echo " <tr class=sideMenu><td width='100%'><span class=menuItem>&nbsp;$name</span></td></tr>\n";
} }
} }
@@ -71,7 +72,6 @@ echo '
if ($form) if ($form)
echo "</form>\n"; echo "</form>\n";
} }
} }
?> ?>

View File

@@ -1,4 +1,4 @@
<? <?php
function parsedate($datestr) function parsedate($datestr)
{ {
@@ -15,7 +15,7 @@ function parsedate($datestr)
$dp = explode(' ', $datestr); $dp = explode(' ', $datestr);
while(list($idx, $part) = each($dp)) while(list($idx, $part) = each($dp))
{ {
//echo "PART($part)<br>"; //echo "PART($part)<br />";
/* 23:59:59 */ /* 23:59:59 */
if(ereg("^([0-9]+):([0-9]+):([0-9]+)$", $part, $arr)) if(ereg("^([0-9]+):([0-9]+):([0-9]+)$", $part, $arr))
@@ -49,6 +49,7 @@ function parsedate($datestr)
$hour += $ampm[$part]; $hour += $ampm[$part];
continue; continue;
} }
if($monthnames[substr($part, 0, 3)]) if($monthnames[substr($part, 0, 3)])
{ {
$month = $monthnames[substr($part, 0, 3)]; $month = $monthnames[substr($part, 0, 3)];
@@ -60,18 +61,20 @@ function parsedate($datestr)
$year = $part; $year = $part;
continue; continue;
} }
if($part > 31) if($part > 31)
{ {
$year = 1900 + $part; $year = 1900 + $part;
continue; continue;
} }
if($part >= 1 && $part <= 31) if($part >= 1 && $part <= 31)
{ {
$day = $part; $day = $part;
continue; continue;
} }
//echo "Unparsed: '$part'<br>\n"; //echo "Unparsed: '$part'<br />\n";
} }

View File

@@ -1,6 +1,6 @@
<? <?php
/* /**
* add previous/next buttons * add previous/next buttons
*/ */
function add_pn_buttons($vars, $endpos) function add_pn_buttons($vars, $endpos)
@@ -47,8 +47,7 @@ function add_pn_buttons($vars, $endpos)
if($curPage == ($buttonCount - 1)) if($curPage == ($buttonCount - 1))
{ {
echo html_b("$buttonCount"); echo html_b("$buttonCount");
} } else
else
{ {
$vars["curPos"] = ($buttonCount - 1) * $linesPerPage; $vars["curPos"] = ($buttonCount - 1) * $linesPerPage;
$url = "stdquery.php?".build_urlarg($vars); $url = "stdquery.php?".build_urlarg($vars);
@@ -61,16 +60,14 @@ function add_pn_buttons($vars, $endpos)
} }
$buttonCount++; $buttonCount++;
} }
} }
// show next button if nessessary // show next button if nessessary
if($next_url) if($next_url)
{ {
echo html_b(html_ahref("Next &gt;&gt;", $next_url)); echo html_b(html_ahref("Next &gt;&gt;", $next_url));
} }
echo "<br>".html_small("listing $numRows record".($numRows == 1 ? "" : "s")." ".($curPos+1)." to $endpos of $totalCount total"); echo "<br />".html_small("listing $numRows record".($numRows == 1 ? "" : "s")." ".($curPos+1)." to $endpos of $totalCount total");
} }
?> ?>

View File

@@ -1,7 +1,9 @@
<? <?php
// query class /*************************************************************/
// (de)compose/exec queries /* query class */
// this should have query_inc.php's query preprocessing etc. /* (de)compose/exec queries */
/* this should have query_inc.php's query preprocessing etc. */
/*************************************************************/
class qclass { class qclass {

View File

@@ -8,8 +8,8 @@
<td class="box-body"> <td class="box-body">
<form ACTION="stdquery.php" METHOD="get"> <form ACTION="stdquery.php" METHOD="get">
Vendor Name: Vendor Name:
<input TYPE="TEXT" NAME="searchfor"> (leave blank to match all) <input TYPE="TEXT" NAME="searchfor" /> (leave blank to match all)
<? <?php
include(BASE."include/"."appbyvendor_inc.php"); include(BASE."include/"."appbyvendor_inc.php");
output_appbyvendor_forminputs(); output_appbyvendor_forminputs();
@@ -28,10 +28,9 @@
<option>500 <option>500
<option>ALL <option>ALL
</select> </select>
<br> <input TYPE="SUBMIT" VALUE="List Apps"> <br /> <input TYPE="SUBMIT" VALUE="List Apps" />
</form> </form>
</td> </td>
</tr> </tr>
</table> </table>
<!-- end of App query --> <!-- end of App query -->

View File

@@ -1,4 +1,3 @@
<!-- start of App query --> <!-- start of App query -->
<table border=1 width="100%" cellspacing=0 cellpadding=3 bordercolor=black> <table border=1 width="100%" cellspacing=0 cellpadding=3 bordercolor=black>
<tr> <tr>
@@ -8,18 +7,18 @@
<tr> <tr>
<td class="box-body"> <td class="box-body">
<form ACTION="stdquery.php" METHOD="get"> <form ACTION="stdquery.php" METHOD="get">
<input TYPE="HIDDEN" NAME="orderby" VALUE="appId"> <input TYPE="HIDDEN" NAME="orderby" VALUE="appId" />
App Name: App Name:
<input TYPE="TEXT" NAME="searchfor"> (leave blank to match all) <input TYPE="TEXT" NAME="searchfor" /> (leave blank to match all)
<input TYPE="HIDDEN" NAME="searchwhat" VALUE="appFamily.appName"> <input TYPE="HIDDEN" NAME="searchwhat" VALUE="appFamily.appName" />
<input TYPE="HIDDEN" NAME="fields[]" VALUE="appFamily.appId"> <input TYPE="HIDDEN" NAME="fields[]" VALUE="appFamily.appId" />
<input TYPE="HIDDEN" NAME="fields[]" VALUE="appFamily.appName"> <input TYPE="HIDDEN" NAME="fields[]" VALUE="appFamily.appName" />
<input TYPE="HIDDEN" NAME="fields[]" VALUE="appFamily.webPage"> <input TYPE="HIDDEN" NAME="fields[]" VALUE="appFamily.webPage" />
<br><br> <br /><br />
<input type=checkbox name=verbose value=yes> Verbose query results <br> <input type=checkbox name=verbose value=yes /> Verbose query results <br />
<? if(havepriv("admin")) echo "<input type=checkbox name=mode value=edit> Edit mode <br>\n"; ?> <?php if(havepriv("admin")) echo "<input type=checkbox name=mode value=edit /> Edit mode <br />\n"; ?>
<br>Rating <br />Rating
<select NAME="rating"> <select NAME="rating">
<option>ANY <option>ANY
<option>1 <option>1
@@ -35,7 +34,7 @@
<option value=fake> Fake Windows <option value=fake> Fake Windows
</select> </select>
<br>Entries Per Page: <br />Entries Per Page:
<select NAME="linesPerPage"> <select NAME="linesPerPage">
<option>50 <option>50
<option>100 <option>100
@@ -44,10 +43,9 @@
<option>500 <option>500
<option>ALL <option>ALL
</select> </select>
<br> <input TYPE="SUBMIT" VALUE="List Apps"> <br /> <input TYPE="SUBMIT" VALUE="List Apps">
</form> </form>
</td> </td>
</tr> </tr>
</table> </table>
<!-- end of App query --> <!-- end of App query -->

View File

@@ -16,7 +16,7 @@ function initFields()
} }
/* /**
* perform a sql query * perform a sql query
*/ */
function twinedb_query($query, $vars) function twinedb_query($query, $vars)
@@ -31,12 +31,11 @@ function twinedb_query($query, $vars)
if(!eregi("^select .*$", $query)) if(!eregi("^select .*$", $query))
{ {
echo "<b> Invalid SQL Query </b>"; echo "<b> Invalid SQL Query </b>";
echo "<br> $query <br>"; echo "<br /> $query <br />";
return; return;
} }
opendb(); opendb();
$tmpq = str_replace("\\", "", $query); $tmpq = str_replace("\\", "", $query);
$endPos=$curPos+$linesPerPage; $endPos=$curPos+$linesPerPage;
@@ -53,12 +52,12 @@ function twinedb_query($query, $vars)
$tstamp = time() - $tstamp; $tstamp = time() - $tstamp;
if(debugging()) if(debugging())
echo "<b> QUERY TIME: $tstamp seconds </b><br>\n"; echo "<b> QUERY TIME: $tstamp seconds </b><br />\n";
// query error! // query error!
if(!$result) if(!$result)
{ {
echo "$query <br><br>\n"; echo "$query <br /><br />\n";
echo "A QUERY error occurred: ".mysql_error()."\n"; echo "A QUERY error occurred: ".mysql_error()."\n";
exit; exit;
} }
@@ -79,8 +78,8 @@ function twinedb_query($query, $vars)
$str = eregi_replace("(SELECT|EXPLAIN|DISTINCT|FROM|WHERE|AND". $str = eregi_replace("(SELECT|EXPLAIN|DISTINCT|FROM|WHERE|AND".
"|OR |IS NULL|IS NOT NULL|LIMIT|ORDER BY". "|OR |IS NULL|IS NOT NULL|LIMIT|ORDER BY".
"|GROUP BY)", "|GROUP BY)",
"<br><b>\\1</b><br>", $tmpq); "<br /><b>\\1</b><br />", $tmpq);
echo "<br>$str<br>\n"; echo "<br />$str<br />\n";
} }
echo html_echo("<div align=center>"); echo html_echo("<div align=center>");
@@ -112,8 +111,6 @@ function twinedb_query($query, $vars)
for($k = 0; $k < $numCols; $k++) for($k = 0; $k < $numCols; $k++)
{ {
$fname = mysql_field_name($result, $k); $fname = mysql_field_name($result, $k);
if($fname == "username") if($fname == "username")
{ {
$username = $row[$k]; $username = $row[$k];
@@ -136,7 +133,6 @@ function twinedb_query($query, $vars)
$url = "appview.php?appId=".$row["appId"]; $url = "appview.php?appId=".$row["appId"];
$arr[] = html_ahref($row[$k], $url); $arr[] = html_ahref($row[$k], $url);
continue; continue;
} }
if($fname == "versionName") if($fname == "versionName")
@@ -149,7 +145,6 @@ function twinedb_query($query, $vars)
if($fname == "webPage") if($fname == "webPage")
{ {
$url = $row[$k]; $url = $row[$k];
$theLink = "$url"; $theLink = "$url";
$arr[] = html_ahref($url, $theLink); $arr[] = html_ahref($url, $theLink);
@@ -161,8 +156,7 @@ function twinedb_query($query, $vars)
{ {
$val = (int)$row[$k]; $val = (int)$row[$k];
$arr[] = "<div align=right>$val</div>"; $arr[] = "<div align=right>$val</div>";
} } else
else
{ {
if(!$row[$k]) if(!$row[$k])
$arr[] = "&nbsp"; $arr[] = "&nbsp";

View File

@@ -1,24 +1,20 @@
<? <?php
/*************/
/* /* User List */
* User List /*************/
*
*/
echo html_frame_start("List Users","400","",0) echo html_frame_start("List Users","400","",0)
?> ?>
<!-- start of users query --> <!-- start of users query -->
<form ACTION="<?=$apidb_root?>stdquery.php" METHOD="get"> <form ACTION="<?php echo $apidb_root; ?>stdquery.php" METHOD="get">
<table width="100%" border=0 cellpadding=0 cellspacing=0> <table width="100%" border=0 cellpadding=0 cellspacing=0>
<tr> <tr>
<td class=color1>Pattern</td> <td class=color1>Pattern</td>
<td><input TYPE="TEXT" NAME="searchfor"><br><small>(leave blank to match all)</small></td> <td><input TYPE="TEXT" NAME="searchfor"><br /><small>(leave blank to match all)</small></td>
</tr> </tr>
<tr> <tr>
@@ -50,7 +46,7 @@ echo html_frame_start("List Users","400","",0)
<!-- end of users query --> <!-- end of users query -->
<? <?php
echo html_frame_end(); echo html_frame_end();

View File

@@ -1,9 +1,7 @@
<!-- start of Vendor query --> <!-- start of Vendor query -->
<table border=1 width="100%" cellspacing=0 cellpadding=3 bordercolor=black> <table border=1 width="100%" cellspacing=0 cellpadding=3 bordercolor=black>
<tr> <tr>
<th class="box-title">Search Vendors <th class="box-title">Search Vendors</th>
</th>
</tr> </tr>
<tr> <tr>
<td class="box-body"> <td class="box-body">
@@ -15,11 +13,11 @@
<input TYPE="HIDDEN" NAME="fields[]" VALUE="vendor.vendorId"> <input TYPE="HIDDEN" NAME="fields[]" VALUE="vendor.vendorId">
<input TYPE="HIDDEN" NAME="fields[]" VALUE="vendor.vendorName"> <input TYPE="HIDDEN" NAME="fields[]" VALUE="vendor.vendorName">
<input TYPE="HIDDEN" NAME="fields[]" VALUE="vendor.vendorURL"> <input TYPE="HIDDEN" NAME="fields[]" VALUE="vendor.vendorURL">
<br><br> <br /><br />
<input type=checkbox name=verbose value=yes> Verbose query results <br> <input type=checkbox name=verbose value=yes> Verbose query results <br />
<? if(havepriv("admin")) echo "<input type=checkbox name=mode value=edit> Edit mode <br>\n"; ?> <?php if(havepriv("admin")) echo "<input type=checkbox name=mode value=edit> Edit mode <br />\n"; ?>
<br>Entries Per Page: <br />Entries Per Page:
<select NAME="linesPerPage"> <select NAME="linesPerPage">
<option>50 <option>50
<option>100 <option>100
@@ -28,10 +26,9 @@
<option>500 <option>500
<option>ALL <option>ALL
</select> </select>
<br> <input TYPE="SUBMIT" VALUE="List Vendors"> <br /> <input TYPE="SUBMIT" VALUE="List Vendors">
</form> </form>
</td> </td>
</tr> </tr>
</table> </table>
<!-- end of Vendor query --> <!-- end of Vendor query -->

View File

@@ -1,18 +1,8 @@
<? <?php
/**
/*
*
* App Compatibility Rating * App Compatibility Rating
*
*/ */
/*=========================================================================
*
*
*
*/
function rating_current_for_user($versionId, $system) function rating_current_for_user($versionId, $system)
{ {

View File

@@ -1,9 +1,7 @@
<? <?php
/***********/
/* /* SideBar */
* SideBar /***********/
*
*/
function global_sidebar_menu() { function global_sidebar_menu() {

View File

@@ -1,9 +1,7 @@
.<? <?php
/*****************/
/* /* sidebar_admin */
* sidebar_admin /*****************/
*
*/
function global_admin_menu() { function global_admin_menu() {

View File

@@ -1,12 +1,11 @@
<? <?php
/*****************/
/* Login SideBar */
/*****************/
require_once(BASE."include/"."maintainer.php"); require_once(BASE."include/"."maintainer.php");
require_once(BASE."include/"."category.php"); require_once(BASE."include/"."category.php");
/*
* Login SideBar
*
*/
function global_sidebar_login() { function global_sidebar_login() {

View File

@@ -1,4 +1,4 @@
<? <?php
require(BASE."include/"."parsedate.php"); require(BASE."include/"."parsedate.php");

View File

@@ -1,12 +1,11 @@
<? <?php
/******************************************/
/* This class represents a logged in user */
/******************************************/
/*
* This class represents a logged in user
*/
class User { class User {
var $link; // database connection var $link; // database connection
var $stamp; var $stamp;
var $userid; var $userid;
var $username; var $username;
@@ -15,7 +14,7 @@ class User {
var $status; var $status;
var $perm; var $perm;
/* /**
* constructor * constructor
* opens a connection to the user database * opens a connection to the user database
*/ */
@@ -31,7 +30,7 @@ class User {
} }
/* /**
* check if a user exists * check if a user exists
* returns TRUE if the user exists * returns TRUE if the user exists
*/ */
@@ -58,6 +57,7 @@ class User {
return $ob->userid; return $ob->userid;
} }
function lookup_realname($userid) function lookup_realname($userid)
{ {
$result = mysql_query("SELECT realname FROM user_list WHERE userid = $userid"); $result = mysql_query("SELECT realname FROM user_list WHERE userid = $userid");
@@ -67,12 +67,14 @@ class User {
return $ob->realname; return $ob->realname;
} }
function lookup_email($userid) function lookup_email($userid)
{ {
return lookupEmail($userid); return lookupEmail($userid);
} }
/*
/**
* restore a user from the database * restore a user from the database
* returns 0 on success and an error msg on failure * returns 0 on success and an error msg on failure
*/ */
@@ -82,7 +84,6 @@ class User {
"created, status, perm FROM user_list WHERE ". "created, status, perm FROM user_list WHERE ".
"username = '$username' AND ". "username = '$username' AND ".
"password = password('$password')", $this->link); "password = password('$password')", $this->link);
//echo "RESTORE($username, $password) result=$result rows=".mysql_num_rows($result)."<br>\n";
if(!$result) if(!$result)
return "Error: ".mysql_error($this->link); return "Error: ".mysql_error($this->link);
@@ -92,7 +93,6 @@ class User {
list($this->stamp, $this->userid, $this->username, $this->realname, list($this->stamp, $this->userid, $this->username, $this->realname,
$this->created, $status, $perm) = mysql_fetch_row($result); $this->created, $status, $perm) = mysql_fetch_row($result);
//echo "<br> User: $this->userid ($this->username, $this->realname) <br>\n";
return 0; return 0;
} }
@@ -105,8 +105,6 @@ class User {
if($result != null) if($result != null)
return $result; return $result;
//echo "<br>LOGIN($this->username)<br>\n";
/* update the 'stamp' field in the users account to reflect the last time */ /* update the 'stamp' field in the users account to reflect the last time */
/* they logged in */ /* they logged in */
$myUserId = $this->lookup_userid($username); $myUserId = $this->lookup_userid($username);
@@ -114,6 +112,7 @@ class User {
return 0; return 0;
} }
/* /*
* create a new user * create a new user
* returns 0 on success and an error msg on failure * returns 0 on success and an error msg on failure
@@ -123,13 +122,15 @@ class User {
$result = mysql_query("INSERT INTO user_list VALUES ( NOW(), 0, ". $result = mysql_query("INSERT INTO user_list VALUES ( NOW(), 0, ".
"'$username', password('$password'), ". "'$username', password('$password'), ".
"'$realname', '$email', NOW(), 0, 0)", $this->link); "'$realname', '$email', NOW(), 0, 0)", $this->link);
//echo "error: ".mysql_error();
if(!$result) if(!$result)
return mysql_error($this->link); return mysql_error($this->link);
return $this->restore($username, $password); return $this->restore($username, $password);
} }
// Update User Account;
/**
* Update User Account;
*/
function update($userid = 0, $password = null, $realname = null, $email = null) function update($userid = 0, $password = null, $realname = null, $email = null)
{ {
if (!$userid) if (!$userid)
@@ -154,7 +155,7 @@ class User {
return 1; return 1;
} }
/* /**
* remove the current, or specified user from the database * remove the current, or specified user from the database
* returns 0 on success and an error msg on failure * returns 0 on success and an error msg on failure
*/ */
@@ -191,6 +192,7 @@ class User {
return $ob->value; return $ob->value;
} }
function setpref($key, $value) function setpref($key, $value)
{ {
if(!$this->userid || !$key || !$value) if(!$this->userid || !$key || !$value)
@@ -203,7 +205,7 @@ class User {
} }
/* /**
* check if this user has $priv * check if this user has $priv
*/ */
function checkpriv($priv) function checkpriv($priv)
@@ -217,7 +219,8 @@ class User {
return mysql_num_rows($result); return mysql_num_rows($result);
} }
/*
/**
* check if this user is an maintainer of a given appId/versionId * check if this user is an maintainer of a given appId/versionId
*/ */
function is_maintainer($appId, $versionId) function is_maintainer($appId, $versionId)
@@ -239,6 +242,7 @@ class User {
return mysql_num_rows($result); return mysql_num_rows($result);
} }
/* /*
* check if this user is an maintainer of a given appId/versionId * check if this user is an maintainer of a given appId/versionId
*/ */
@@ -254,6 +258,7 @@ class User {
return mysql_num_rows($result); return mysql_num_rows($result);
} }
function addpriv($priv) function addpriv($priv)
{ {
if(!$this->userid || !$priv) if(!$this->userid || !$priv)
@@ -266,6 +271,7 @@ class User {
return $result; return $result;
} }
function delpriv($priv) function delpriv($priv)
{ {
if(!$this->userid || !$priv) if(!$this->userid || !$priv)
@@ -276,8 +282,7 @@ class User {
} }
/*========================================================================= /**
*
* App Owners * App Owners
* *
*/ */
@@ -292,23 +297,22 @@ class User {
function loggedin() function loggedin()
{ {
if(isset($_SESSION['current']) && $_SESSION['current']->userid) if(isset($_SESSION['current']) && $_SESSION['current']->userid)
return true; return true;
return false; return false;
} }
function havepriv($priv) function havepriv($priv)
{ {
if(!loggedin()) if(!loggedin())
return false; return false;
return $_SESSION['current']->checkpriv($priv); return $_SESSION['current']->checkpriv($priv);
} }
function isMaintainer($appId, $versionId) function isMaintainer($appId, $versionId)
{ {
if(!loggedin()) if(!loggedin())
@@ -317,6 +321,7 @@ function isMaintainer($appId, $versionId)
return $_SESSION['current']->is_maintainer($appId, $versionId); return $_SESSION['current']->is_maintainer($appId, $versionId);
} }
function isSuperMaintainer($appId) function isSuperMaintainer($appId)
{ {
if(!loggedin()) if(!loggedin())
@@ -325,6 +330,7 @@ function isSuperMaintainer($appId)
return $_SESSION['current']->is_super_maintainer($appId); return $_SESSION['current']->is_super_maintainer($appId);
} }
function debugging() function debugging()
{ {
if(!loggedin()) if(!loggedin())
@@ -343,7 +349,10 @@ function makeurl($text, $url, $pref = null)
return "<a href='$url' $extra> $text </a>\n"; return "<a href='$url' $extra> $text </a>\n";
} }
// create a new random password
/**
* create a new random password
*/
function generate_passwd($pass_len = 10) function generate_passwd($pass_len = 10)
{ {
$nps = ""; $nps = "";
@@ -356,6 +365,7 @@ function generate_passwd($pass_len = 10)
return ($nps); return ($nps);
} }
function lookupUsername($userid) function lookupUsername($userid)
{ {
$result = mysql_query("SELECT username FROM user_list WHERE userid = $userid"); $result = mysql_query("SELECT username FROM user_list WHERE userid = $userid");
@@ -365,6 +375,7 @@ function lookupUsername($userid)
return $ob->username; return $ob->username;
} }
function lookupEmail($userid) function lookupEmail($userid)
{ {
$result = mysql_query("SELECT email FROM user_list WHERE userid = $userid"); $result = mysql_query("SELECT email FROM user_list WHERE userid = $userid");
@@ -374,6 +385,7 @@ function lookupEmail($userid)
return $ob->email; return $ob->email;
} }
function UserWantsEmail($userid) function UserWantsEmail($userid)
{ {
$result = mysql_query("SELECT * FROM user_prefs WHERE userid = $userid AND name = 'send_email'"); $result = mysql_query("SELECT * FROM user_prefs WHERE userid = $userid AND name = 'send_email'");
@@ -385,7 +397,8 @@ function UserWantsEmail($userid)
return ($ob->value == 'no' ? false : true); return ($ob->value == 'no' ? false : true);
} }
/*
/**
* get the email address of people to notify for this appId and versionId * get the email address of people to notify for this appId and versionId
*/ */
function getNotifyEmailAddressList($appId, $versionId) function getNotifyEmailAddressList($appId, $versionId)
@@ -431,7 +444,10 @@ function getNotifyEmailAddressList($appId, $versionId)
return $retval; return $retval;
} }
/* Get the number of users in the database */
/**
* Get the number of users in the database
*/
function getNumberOfUsers() function getNumberOfUsers()
{ {
$result = mysql_query("SELECT count(*) as num_users FROM user_list;"); $result = mysql_query("SELECT count(*) as num_users FROM user_list;");
@@ -439,7 +455,10 @@ function getNumberOfUsers()
return $row->num_users; return $row->num_users;
} }
/* Get the number of active users within $days of the current day */
/**
* Get the number of active users within $days of the current day
*/
function getActiveUsersWithinDays($days) function getActiveUsersWithinDays($days)
{ {
$result = mysql_query("SELECT count(*) as num_users FROM user_list WHERE stamp >= DATE_SUB(CURDATE(), interval $days day);"); $result = mysql_query("SELECT count(*) as num_users FROM user_list WHERE stamp >= DATE_SUB(CURDATE(), interval $days day);");

View File

@@ -1,10 +1,10 @@
<? <?php
/* max votes per user */ /* max votes per user */
$MAX_VOTES = 3; $MAX_VOTES = 3;
/* /**
* count the number of votes for appId by userId * count the number of votes for appId by userId
*/ */
function vote_count($appId, $userId = null) function vote_count($appId, $userId = null)
@@ -21,7 +21,8 @@ function vote_count($appId, $userId = null)
return mysql_num_rows($result); return mysql_num_rows($result);
} }
/*
/**
* total votes by userId * total votes by userId
*/ */
function vote_count_user_total($userId = null) function vote_count_user_total($userId = null)
@@ -37,6 +38,7 @@ function vote_count_user_total($userId = null)
return mysql_num_rows($result); return mysql_num_rows($result);
} }
/* /*
* total votes for appId * total votes for appId
*/ */
@@ -47,9 +49,7 @@ function vote_count_app_total($appId)
} }
/**
/*
* add a vote for appId * add a vote for appId
*/ */
function vote_add($appId, $slot, $userId = null) function vote_add($appId, $slot, $userId = null)
@@ -71,7 +71,7 @@ function vote_add($appId, $slot, $userId = null)
} }
/* /**
* remove vote for appId * remove vote for appId
*/ */
function vote_remove($appId, $slot, $userId = null) function vote_remove($appId, $slot, $userId = null)
@@ -88,10 +88,9 @@ function vote_remove($appId, $slot, $userId = null)
mysql_query("DELETE FROM appVotes WHERE appId = $appId AND userId = $userId AND slot = $slot"); mysql_query("DELETE FROM appVotes WHERE appId = $appId AND userId = $userId AND slot = $slot");
} }
function vote_get_user_votes($userId = null) function vote_get_user_votes($userId = null)
{ {
if(!$userId) if(!$userId)
{ {
if(loggedin()) if(loggedin())
@@ -109,6 +108,7 @@ function vote_get_user_votes($userId = null)
return $obs; return $obs;
} }
function vote_menu() function vote_menu()
{ {
global $appId; global $appId;
@@ -164,12 +164,11 @@ function dump($arr)
} }
} }
function vote_update($vars) function vote_update($vars)
{ {
//FIXME this doesn't work since msgs only work when logged in //FIXME this doesn't work since msgs only work when logged in
if(!$_SESSION['current']) if(!loggedin())
{ {
addmsg("You must be logged in to vote", "red"); addmsg("You must be logged in to vote", "red");
return; return;

View File

@@ -1,10 +1,7 @@
<? <?php
/***********************************/
/* /* Application Database Index Page */
* Application Database Index Page /***********************************/
*
*/
include("path.php"); include("path.php");
require(BASE."include/"."incl.php"); require(BASE."include/"."incl.php");
@@ -41,7 +38,7 @@ apidb_header("Wine Application Database");
wine-users mailing list or the wine newsgroup, for more information visit wine-users mailing list or the wine newsgroup, for more information visit
<a href="http://www.winehq.com/site/forums">this page</a> <a href="http://www.winehq.com/site/forums">this page</a>
</p> </p>
<? <?php
$numApps = getNumberOfVersions(); $numApps = getNumberOfVersions();
@@ -78,7 +75,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr> </tr>
<tr class=white> <tr class=white>
<? <?php
echo "<td><a href='".$apidb_root."appview.php?appId=134'>Acrobat Reader</a></td>"; echo "<td><a href='".$apidb_root."appview.php?appId=134'>Acrobat Reader</a></td>";
?> ?>
<td>5.0.5</td> <td>5.0.5</td>
@@ -89,7 +86,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr> </tr>
<tr class=white> <tr class=white>
<? <?php
echo "<td><a href='".$apidb_root."appview.php?appId=145'>WS-FTP LE</a></td>"; echo "<td><a href='".$apidb_root."appview.php?appId=145'>WS-FTP LE</a></td>";
?> ?>
<td>5.08</td> <td>5.08</td>
@@ -100,7 +97,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr> </tr>
<tr class=white> <tr class=white>
<? <?php
echo "<td><a href='".$apidb_root."appview.php?appId=77'>mIRC</a></td>"; echo "<td><a href='".$apidb_root."appview.php?appId=77'>mIRC</a></td>";
?> ?>
<td>6.03</td> <td>6.03</td>
@@ -111,7 +108,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr> </tr>
<tr class=white> <tr class=white>
<? <?php
echo "<td><a href='".$apidb_root."appview.php?appId=356'>Putty</a></td>"; echo "<td><a href='".$apidb_root."appview.php?appId=356'>Putty</a></td>";
?> ?>
<td>0.52</td> <td>0.52</td>
@@ -122,7 +119,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr> </tr>
<tr class=white> <tr class=white>
<? <?php
echo "<td><a href='".$apidb_root."appview.php?appId=1110'>FTP Commander</a></td>"; echo "<td><a href='".$apidb_root."appview.php?appId=1110'>FTP Commander</a></td>";
?> ?>
<td>5.58</td> <td>5.58</td>
@@ -133,7 +130,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr> </tr>
<tr class=white> <tr class=white>
<? <?php
echo "<td><a href='".$apidb_root."appview.php?appId=284'>Pegasus Mail</a></td>"; echo "<td><a href='".$apidb_root."appview.php?appId=284'>Pegasus Mail</a></td>";
?> ?>
<td>4.02</td> <td>4.02</td>
@@ -144,7 +141,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr> </tr>
<tr class=white> <tr class=white>
<? <?php
echo "<td><a href='".$apidb_root."appview.php?appId=1756'>12Ghosts Zip</a></td>"; echo "<td><a href='".$apidb_root."appview.php?appId=1756'>12Ghosts Zip</a></td>";
?> ?>
<td>XP/31</td> <td>XP/31</td>
@@ -155,7 +152,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr> </tr>
<tr class=white> <tr class=white>
<? <?php
echo "<td><a href='".$apidb_root."appview.php?appId=1755'>WinMerge</a></td>"; echo "<td><a href='".$apidb_root."appview.php?appId=1755'>WinMerge</a></td>";
?> ?>
<td>2.1.4</td> <td>2.1.4</td>
@@ -166,7 +163,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr> </tr>
<tr class=white> <tr class=white>
<? <?php
echo "<td><a href='".$apidb_root."appview.php?appId=868'>FileZilla</a></td>"; echo "<td><a href='".$apidb_root."appview.php?appId=868'>FileZilla</a></td>";
?> ?>
<td>2.2.2</td> <td>2.2.2</td>
@@ -186,7 +183,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr> </tr>
<tr class=white> <tr class=white>
<? <?php
echo "<td><a href='".$apidb_root."appview.php?appId=2'>WinZip</a></td>"; echo "<td><a href='".$apidb_root."appview.php?appId=2'>WinZip</a></td>";
?> ?>
<td>8.1</td> <td>8.1</td>
@@ -199,7 +196,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr> </tr>
<tr class=white> <tr class=white>
<? <?php
echo "<td><a href='".$apidb_root."appview.php?appId=55'>ICQ</a></td>"; echo "<td><a href='".$apidb_root."appview.php?appId=55'>ICQ</a></td>";
?> ?>
<td>2002a</td> <td>2002a</td>
@@ -214,7 +211,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr> </tr>
<tr class=white> <tr class=white>
<? <?php
echo "<td><a href='".$apidb_root."appview.php?appId=5'>Winamp</a></td>"; echo "<td><a href='".$apidb_root."appview.php?appId=5'>Winamp</a></td>";
?> ?>
<td>3.0</td> <td>3.0</td>
@@ -227,7 +224,7 @@ range of interfaces, you'll need no other player.</td>
</tr> </tr>
<tr class=white> <tr class=white>
<? <?php
echo "<td><a href='".$apidb_root."appview.php?appId=391'>WinRAR</a></td>"; echo "<td><a href='".$apidb_root."appview.php?appId=391'>WinRAR</a></td>";
?> ?>
<td>3.00</td> <td>3.00</td>
@@ -243,7 +240,7 @@ range of interfaces, you'll need no other player.</td>
</tr> </tr>
<tr class=white> <tr class=white>
<? <?php
echo "<td><a href='".$apidb_root."appview.php?appId=288'>WinMX</a></td>"; echo "<td><a href='".$apidb_root."appview.php?appId=288'>WinMX</a></td>";
?> ?>
<td>3.22</td> <td>3.22</td>
@@ -256,7 +253,7 @@ range of interfaces, you'll need no other player.</td>
</tr> </tr>
<tr class=white> <tr class=white>
<? <?php
echo "<td><a href='".$apidb_root."appview.php?appId=1757'>SnagIt</a></td>"; echo "<td><a href='".$apidb_root."appview.php?appId=1757'>SnagIt</a></td>";
?> ?>
<td>6.1.1</td> <td>6.1.1</td>
@@ -282,6 +279,6 @@ application site. The site contains tips and howtos on getting listed apps to ru
</p> </p>
<p>&nbsp;</p> <p>&nbsp;</p>
<? <?php
apidb_footer(); apidb_footer();
?> ?>

View File

@@ -1,4 +1,4 @@
<? <?php
include("path.php"); include("path.php");
require(BASE."include/"."incl.php"); require(BASE."include/"."incl.php");
@@ -27,14 +27,12 @@ else
if($confirmed) if($confirmed)
{ {
global $current;
echo html_frame_start("Removing",400,"",0); echo html_frame_start("Removing",400,"",0);
if($superMaintainer) if($superMaintainer)
$query = "DELETE FROM appMaintainers WHERE userId = '$current->userid' AND appId = '$appId' AND superMaintainer = '$superMaintainer';"; $query = "DELETE FROM appMaintainers WHERE userId = '$_SESSION['current']->userid' AND appId = '$appId' AND superMaintainer = '$superMaintainer';";
else else
$query = "DELETE FROM appMaintainers WHERE userId = '$current->userid' AND appId = '$appId' AND versionId = '$versionId' AND superMaintainer = '$superMaintainer';"; $query = "DELETE FROM appMaintainers WHERE userId = '$_SESSION['current']->userid' AND appId = '$appId' AND versionId = '$versionId' AND superMaintainer = '$superMaintainer';";
echo "$query"; echo "$query";

View File

@@ -1,4 +1,4 @@
<? <?php
// Check the input of a submitted form. And output with a list // Check the input of a submitted form. And output with a list
// of errors. (<ul></ul>) // of errors. (<ul></ul>)

View File

@@ -1,9 +1,7 @@
<? <?php
/**************************************/
/* /* Application Database - Note Viewer */
* Application Database - Note Viewer /**************************************/
*
*/
include("path.php"); include("path.php");
require(BASE."include/"."incl.php"); require(BASE."include/"."incl.php");

View File

@@ -1,3 +1,3 @@
<? <?php
define("BASE","./"); define("BASE","./");
?> ?>

View File

@@ -1,4 +1,4 @@
<? <?php
include("path.php"); include("path.php");
include(BASE."include/"."incl.php"); include(BASE."include/"."incl.php");
@@ -96,7 +96,7 @@ build_prefs_list();
echo html_table_end(); echo html_table_end();
echo html_frame_end(); echo html_frame_end();
echo "<br> <div align=center> <input type=submit value='Update'> </div> <br>\n"; echo "<br /> <div align=center> <input type=submit value='Update'> </div> <br />\n";
echo "</form>\n"; echo "</form>\n";

View File

@@ -1,4 +1,4 @@
<? <?php
include("path.php"); include("path.php");
require(BASE."include/"."incl.php"); require(BASE."include/"."incl.php");

View File

@@ -1,4 +1,4 @@
<? <?php
include("path.php"); include("path.php");
require(BASE."include/"."incl.php"); require(BASE."include/"."incl.php");

View File

@@ -1,9 +1,7 @@
<? <?php
/*************************************/
/* /* Application Database Support Page */
* Application Database Support Page /*************************************/
*
*/
include("path.php"); include("path.php");
require(BASE."include/"."incl.php"); require(BASE."include/"."incl.php");
@@ -35,8 +33,6 @@ apidb_header("Help and Support");
<li><a href="http://www.winehq.org">Wine Development HQ</a></li> <li><a href="http://www.winehq.org">Wine Development HQ</a></li>
<li><a href="http://www.codeweavers.com">CodeWeavers Home Page</a></li> <li><a href="http://www.codeweavers.com">CodeWeavers Home Page</a></li>
</ul> </ul>
<? <?php
apidb_footer(); apidb_footer();
?> ?>

View File

@@ -1,4 +1,4 @@
<? <?php
include("path.php"); include("path.php");
include(BASE."include/"."incl.php"); include(BASE."include/"."incl.php");

View File

@@ -1,4 +1,4 @@
<? <?php
include("path.php"); include("path.php");
include(BASE."include/"."incl.php"); include(BASE."include/"."incl.php");

View File

@@ -1,9 +1,7 @@
<? <?php
/*************************************/
/* /* code to view vendors & their apps */
* code to view vendors & their apps /*************************************/
*
*/
include("path.php"); include("path.php");
require(BASE."include/"."incl.php"); require(BASE."include/"."incl.php");

View File

@@ -1,4 +1,4 @@
<? <?php
include("path.php"); include("path.php");
include(BASE."include/"."incl.php"); include(BASE."include/"."incl.php");