- 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,131 +1,140 @@
<? <?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");
//set http header to not cache // set http header to not cache
header("Pragma: no-cache"); header("Pragma: no-cache");
header("Cache-control: no-cache"); header("Cache-control: no-cache");
//check command and process // check command and process
if(isset($_POST['cmd'])) if(isset($_POST['cmd']))
do_account($_POST['cmd']); do_account($_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;
switch($cmd) switch($cmd)
{ {
case "new": case "new":
apidb_header("New Account"); apidb_header("New Account");
include(BASE."include/"."form_new.php"); include(BASE."include/"."form_new.php");
apidb_footer(); apidb_footer();
exit; exit;
case "do_new": case "do_new":
cmd_do_new(); cmd_do_new();
exit; exit;
case "login": case "login":
apidb_header("Login"); apidb_header("Login");
include(BASE."include/"."form_login.php"); include(BASE."include/"."form_login.php");
apidb_footer(); apidb_footer();
exit; exit;
case "do_login": case "do_login":
cmd_do_login(); cmd_do_login();
exit; exit;
case "send_passwd": case "send_passwd":
cmd_send_passwd(); cmd_send_passwd();
exit; exit;
case "logout": case "logout":
apidb_session_destroy(); apidb_session_destroy();
addmsg("You are successfully logged out.", "green"); addmsg("You are successfully logged out.", "green");
redirect(apidb_fullurl("index.php")); redirect(apidb_fullurl("index.php"));
exit; exit;
} }
//not valid command, display error page //not valid command, display error page
errorpage("Internal Error","This module was called with incorrect parameters"); errorpage("Internal Error","This module was called with incorrect parameters");
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()
{ {
if(ereg("^.+@.+\\..+$", $_POST['ext_username'])) if(ereg("^.+@.+\\..+$", $_POST['ext_username']))
{ {
$_POST['ext_username'] = ""; $_POST['ext_username'] = "";
retry("new", "Invalid Username, must not contain special characters"); retry("new", "Invalid Username, must not contain special characters");
return; return;
} }
if(strlen($_POST['ext_username']) < 3) if(strlen($_POST['ext_username']) < 3)
{ {
$_POST['ext_username'] = ""; $_POST['ext_username'] = "";
retry("new", "Username must be at least 3 characters"); retry("new", "Username must be at least 3 characters");
return; return;
} }
if(strlen($_POST['ext_password']) < 5) if(strlen($_POST['ext_password']) < 5)
{ {
retry("new", "Password must be at least 5 characters"); retry("new", "Password must be at least 5 characters");
return; return;
} }
if($_POST['ext_password'] != $_POST['ext_password2']) if($_POST['ext_password'] != $_POST['ext_password2'])
{ {
retry("new", "Passwords don't match"); retry("new", "Passwords don't match");
return; return;
} }
if(!isset($_POST['ext_realname'])) if(!isset($_POST['ext_realname']))
{ {
retry("new", "You don't have a Real name?"); retry("new", "You don't have a Real name?");
return; return;
} }
if(!ereg("^.+@.+\\..+$", $_POST['ext_email'])) if(!ereg("^.+@.+\\..+$", $_POST['ext_email']))
{ {
$_POST['ext_email'] = ""; $_POST['ext_email'] = "";
retry("new", "Invalid email address"); retry("new", "Invalid email address");
return; return;
} }
$user = new User(); $user = new User();
if($user->exists($_POST['ext_username'])) if($user->exists($_POST['ext_username']))
{ {
$_POST['ext_username'] = ""; $_POST['ext_username'] = "";
retry("new", "That username is already in use"); retry("new", "That username is already in use");
return; return;
} }
$result = $user->create($_POST['ext_username'], $_POST['ext_password'], $_POST['ext_realname'], $_POST['ext_email']); $result = $user->create($_POST['ext_username'], $_POST['ext_password'], $_POST['ext_realname'], $_POST['ext_email']);
if($result == null) if($result == null)
{ {
$user->login($_POST['ext_username'], $_POST['ext_password']); $user->login($_POST['ext_username'], $_POST['ext_password']);
addmsg("Account created! (".$_POST['ext_username'].")", "green"); addmsg("Account created! (".$_POST['ext_username'].")", "green");
redirect(apidb_fullurl()); redirect(apidb_fullurl());
} }
else else
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();
@@ -134,7 +143,7 @@ function cmd_send_passwd()
$passwd = generate_passwd(); $passwd = generate_passwd();
if ($userid) if ($userid)
{ {
if ($user->update($userid, $passwd)) if ($user->update($userid, $passwd))
{ {
$msg = "Application DB Lost Password\n"; $msg = "Application DB Lost Password\n";
@@ -166,23 +175,25 @@ 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();
$result = $user->login($_POST['ext_username'], $_POST['ext_password']); $result = $user->login($_POST['ext_username'], $_POST['ext_password']);
if($result == null) if($result == null)
{ {
$_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)
{ {
@@ -41,8 +41,8 @@ opendb();
// We have input, but wrong input // We have input, but wrong input
if( ( $width AND !is_numeric($width) ) || ( $height AND !is_numeric($height) ) ) if( ( $width AND !is_numeric($width) ) || ( $height AND !is_numeric($height) ) )
{ {
$width = 100; $width = 100;
$height = 75; $height = 75;
} }
if($imageId AND is_numeric($imageId) ) if($imageId AND is_numeric($imageId) )
@@ -50,7 +50,7 @@ if($imageId AND is_numeric($imageId) )
else if($appId AND $versionId AND is_numeric($appId) AND is_numeric($versionId) ) else if($appId AND $versionId AND is_numeric($appId) AND is_numeric($versionId) )
$result = mysql_query("SELECT * FROM appData WHERE appId = $appId AND ". $result = mysql_query("SELECT * FROM appData WHERE appId = $appId AND ".
"versionId = $versionId AND type = 'image' LIMIT 1"); "versionId = $versionId AND type = 'image' LIMIT 1");
else else
handle_error("IDs wrong"); handle_error("IDs wrong");

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,54 +1,51 @@
<? <?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
global $apidb_root; global $apidb_root;
$banner_path_468x60 = $apidb_root."banner/468x60/"; $banner_path_468x60 = $apidb_root."banner/468x60/";
$banner_path_xml = $apidb_root."banner/xml/"; $banner_path_xml = $apidb_root."banner/xml/";
// opening html // opening html
$banner = ""; $banner = "";
$banner .= "\n\n".'<!-- START BANNER AD -->'."\n"; $banner .= "\n\n".'<!-- START BANNER AD -->'."\n";
$banner .= '<div align=center>'."\n"; $banner .= '<div align=center>'."\n";
// read dir and get list of banners // read dir and get list of banners
$ads = array(); $ads = array();
$d = opendir($banner_path_468x60); $d = opendir($banner_path_468x60);
while($entry = readdir($d)) while($entry = readdir($d))
{ {
if(!ereg("(.+)\\.gif$", $entry, $arr)) if(!ereg("(.+)\\.gif$", $entry, $arr))
continue; //" continue; //"
array_push($ads, $arr[1]); array_push($ads, $arr[1]);
} }
closedir($d); closedir($d);
// randomly select a banner and display it
$img = $ads[(rand(1,count($ads))-1)];
$url = get_xml_tag($banner_path_xml.$img.'.xml','url');
$alt = get_xml_tag($banner_path_xml.$img.'.xml','alt');
// da banner // randomly select a banner and display it
$banner .= '<a href="'.$url.'">'; $img = $ads[(rand(1,count($ads))-1)];
$banner .= '<img src="'.$banner_path_468x60.$img.'.gif" border=0 width=468 height=60 alt="'.$alt.'">'; $url = get_xml_tag($banner_path_xml.$img.'.xml','url');
$banner .= '</a>'."\n"; $alt = get_xml_tag($banner_path_xml.$img.'.xml','alt');
// closing html
$banner .= '</div>'."\n";
$banner .= '<!-- END BANNER AD -->'."\n\n";
return $banner; // da banner
$banner .= '<a href="'.$url.'">';
$banner .= '<img src="'.$banner_path_468x60.$img.'.gif" border=0 width=468 height=60 alt="'.$alt.'">';
$banner .= '</a>'."\n";
// closing html
$banner .= '</div>'."\n";
$banner .= '<!-- END BANNER AD -->'."\n\n";
return $banner;
} }

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,76 +10,76 @@ 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)
{ {
$this->load($id); $this->load($id);
} }
/* /**
* load the category data into this class * load the category data into this class
*/ */
function load($id) function load($id)
{ {
$this->id = $id; $this->id = $id;
if($id == 0)
{
$this->name = "ROOT";
}
else
{
$result = mysql_query("SELECT * FROM appCategory WHERE catId = $id");
if(!$result) {
// category not found!
errorpage("Internal Error: Category not found!");
return;
}
$ob = mysql_fetch_object($result); if($id == 0)
$this->name = $ob->catName; {
} $this->name = "ROOT";
} else
{
$result = mysql_query("SELECT * FROM appCategory WHERE catId = $id");
if(!$result)
{
// category not found!
errorpage("Internal Error: Category not found!");
return;
}
$result = mysql_query("SELECT catId, catName, catDescription FROM ". $ob = mysql_fetch_object($result);
"appCategory WHERE catParent = $this->id " . $this->name = $ob->catName;
"ORDER BY catName"); }
if(mysql_num_rows($result) == 0)
return; // no sub categories
$this->subcat = array(); $result = mysql_query("SELECT catId, catName, catDescription FROM ".
while($row = mysql_fetch_object($result)) "appCategory WHERE catParent = $this->id " .
{ "ORDER BY catName");
// Ignore NONAME categories if(mysql_num_rows($result) == 0)
if($row->catName == "NONAME") return; // no sub categories
continue;
$this->subcat[$row->catId] = array($row->catName, $row->catDescription); $this->subcat = array();
} while($row = mysql_fetch_object($result))
{
// ignore NONAME categories
if($row->catName == "NONAME")
continue;
$this->subcat[$row->catId] = array($row->catName, $row->catDescription);
}
} }
/* /**
* resolve the category id by name * resolve the category id by name
*/ */
function getCategoryId($name) function getCategoryId($name)
{ {
if($name == "ROOT") if($name == "ROOT")
return 0; return 0;
$result = mysql_query("SELECT catId FROM appCategory WHERE ". $result = mysql_query("SELECT catId FROM appCategory WHERE ".
"catName = '$name'"); "catName = '$name'");
if(!$result) if(!$result)
return -1; return -1;
if(mysql_num_rows($result) != 1) if(mysql_num_rows($result) != 1)
return -1; return -1;
$row = mysql_fetch_object($result); $row = mysql_fetch_object($result);
return $row->catId; return $row->catId;
} }
/* /**
* returns the list of sub categories * returns the list of sub categories
* *
* category list has the following format: * category list has the following format:
@@ -86,83 +88,84 @@ class Category {
*/ */
function getCategoryList() function getCategoryList()
{ {
return $this->subcat; return $this->subcat;
} }
/* /**
* returns a path like: * returns a path like:
* *
* { ROOT, Games, Simulation } * { ROOT, Games, Simulation }
*/ */
function getCategoryPath() function getCategoryPath()
{ {
$path = array(); $path = array();
$id = $this->id; $id = $this->id;
while(1) while(1)
{ {
$result = mysql_query("SELECT catName, catId, catParent FROM appCategory WHERE catId = $id"); $result = mysql_query("SELECT catName, catId, catParent FROM appCategory WHERE catId = $id");
if(!$result || mysql_num_rows($result) != 1) if(!$result || mysql_num_rows($result) != 1)
break; break;
$cat = mysql_fetch_object($result); $cat = mysql_fetch_object($result);
$path[] = array($cat->catId, $cat->catName); $path[] = array($cat->catId, $cat->catName);
$id = $cat->catParent; $id = $cat->catParent;
} }
$path[] = array(0, "ROOT"); $path[] = array(0, "ROOT");
return array_reverse($path); return array_reverse($path);
} }
/* /**
* returns a list of applications in the specified category * returns a list of applications in the specified category
*/ */
function getAppList($id) function getAppList($id)
{ {
$result = mysql_query("SELECT appId, appName, description FROM ". $result = mysql_query("SELECT appId, appName, description FROM ".
"appFamily WHERE catId = $id ". "appFamily WHERE catId = $id ".
"ORDER BY appName"); "ORDER BY appName");
if(!$result || mysql_num_rows($result) == 0) if(!$result || mysql_num_rows($result) == 0)
return array(); return array();
$list = array(); $list = array();
while($row = mysql_fetch_object($result)) while($row = mysql_fetch_object($result))
{ {
if($row->appName == "NONAME") if($row->appName == "NONAME")
continue; continue;
$list[$row->appId] = array($row->appName, $row->description); $list[$row->appId] = array($row->appName, $row->description);
} }
return $list; return $list;
} }
/* /**
* 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)
{ {
$total = 0; $total = 0;
$result = mysql_query("SELECT appId FROM appFamily WHERE catId = $id"); $result = mysql_query("SELECT appId FROM appFamily WHERE catId = $id");
if($result) if($result)
$total += mysql_num_rows($result); $total += mysql_num_rows($result);
if($recurse) if($recurse)
{ {
$result = mysql_query("SELECT catId FROM appCategory WHERE catParent = $id"); $result = mysql_query("SELECT catId FROM appCategory WHERE catParent = $id");
if($result) if($result)
{ {
while($ob = mysql_fetch_object($result)) while($ob = mysql_fetch_object($result))
$total += $this->getAppCount($ob->catId, 1); $total += $this->getAppCount($ob->catId, 1);
} }
} }
return $total; return $total;
} }
}; };
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");
if(!$result || !mysql_num_rows($result)) if(!$result || !mysql_num_rows($result))
return "<unknown>"; // shouldn't normally happen return "<unknown>"; // shouldn't normally happen
$ob = mysql_fetch_object($result); $ob = mysql_fetch_object($result);
return $ob->appName; return $ob->appName;
} }
@@ -176,31 +179,30 @@ 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))
{ {
if($name == "ROOT") if($name == "ROOT")
$catname = "Main"; $catname = "Main";
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
*/ */
@@ -94,7 +88,7 @@ function grab_comments($appId, $versionId, $parentId = -1)
{ {
$extra = ""; $extra = "";
if($parentId != -1) if($parentId != -1)
$extra = "AND parentId = $parentId "; $extra = "AND parentId = $parentId ";
$qstring = "SELECT from_unixtime(unix_timestamp(time), \"%W %M %D %Y, %k:%i\") as time, ". $qstring = "SELECT from_unixtime(unix_timestamp(time), \"%W %M %D %Y, %k:%i\") as time, ".
"commentId, parentId, appId, versionId, userid, subject, body ". "commentId, parentId, appId, versionId, userid, subject, body ".
@@ -107,39 +101,34 @@ 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)
{ {
while($ob = mysql_fetch_object($handle)) while($ob = mysql_fetch_object($handle))
{
view_app_comment($ob);
$result = grab_comments($ob->appId, $ob->versionId, $ob->commentId);
if($result && mysql_num_rows($result))
{ {
view_app_comment($ob); echo "<blockquote>\n";
$result = grab_comments($ob->appId, $ob->versionId, $ob->commentId); do_display_comments_nested($result);
if($result && mysql_num_rows($result)) echo "</blockquote>\n";
{ }
echo "<blockquote>\n";
do_display_comments_nested($result);
echo "</blockquote>\n";
}
} }
} }
@@ -151,28 +140,24 @@ 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)
{ {
if (!$is_main) if (!$is_main)
echo "<ul>\n"; echo "<ul>\n";
while ($ob = mysql_fetch_object($handle)) while ($ob = mysql_fetch_object($handle))
{ {
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";
} }
$result = grab_comments($ob->appId, $ob->versionId, $ob->commentId); $result = grab_comments($ob->appId, $ob->versionId, $ob->commentId);
@@ -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)
{ {
@@ -212,7 +196,7 @@ function display_comments_flat($appId, $versionId)
} }
} }
} }
function view_app_comments($appId, $versionId, $threadId = 0) function view_app_comments($appId, $versionId, $threadId = 0)
{ {
@@ -231,20 +215,20 @@ function view_app_comments($appId, $versionId, $threadId = 0)
// message display mode changer // message display mode changer
if (loggedin()) if (loggedin())
{ {
//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";
echo "<b>Application Comments</b> $messageCount total comments "; echo "<b>Application Comments</b> $messageCount total comments ";
echo '<b>Mode</b> <select name="cmode" onchange="document.smode.submit();">',"\n"; echo '<b>Mode</b> <select name="cmode" onchange="document.smode.submit();">',"\n";
echo ' <option value=flat '.$sel['flat'].'>Flat</option>',"\n"; echo ' <option value=flat '.$sel['flat'].'>Flat</option>',"\n";
echo ' <option value=threaded '.$sel['threaded'].'>Threaded</option>',"\n"; echo ' <option value=threaded '.$sel['threaded'].'>Threaded</option>',"\n";
echo ' <option value=nested '.$sel['nested'].'>Nested</option>',"\n"; echo ' <option value=nested '.$sel['nested'].'>Nested</option>',"\n";
echo ' <option value=off '.$sel['off'].'>No Comments</option>',"\n"; echo ' <option value=off '.$sel['off'].'>No Comments</option>',"\n";
echo '</select><input type=hidden name="appId" value="'.$appId.'">',"\n"; echo '</select><input type=hidden name="appId" value="'.$appId.'">',"\n";
echo '<input type=hidden name="versionId" value="'.$versionId.'"></form></td>',"\n"; echo '<input type=hidden name="versionId" value="'.$versionId.'"></form></td>',"\n";
} }
// blank space // blank space
@@ -266,25 +250,24 @@ function view_app_comments($appId, $versionId, $threadId = 0)
//hide or display depending on pref //hide or display depending on pref
if (loggedin()) if (loggedin())
$mode = $_SESSION['current']->getpref("comments:mode"); $mode = $_SESSION['current']->getpref("comments:mode");
else else
$mode = "flat"; $mode = "flat";
switch ($mode) switch ($mode)
{ {
case "flat": case "flat":
display_comments_flat($appId, $versionId); display_comments_flat($appId, $versionId);
break; break;
case "nested": case "nested":
display_comments_nested($appId, $versionId, $threadId); display_comments_nested($appId, $versionId, $threadId);
break; break;
case "threaded": case "threaded":
display_comments_threaded($appId, $versionId, $threadId); display_comments_threaded($appId, $versionId, $threadId);
break; break;
} }
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;
@@ -10,10 +8,10 @@ function apidb_query($query)
global $public_link; global $public_link;
if(!$public_link) if(!$public_link)
{ {
$public_link = mysql_pconnect($db_public_host, $db_public_user, $db_public_pass); $public_link = mysql_pconnect($db_public_host, $db_public_user, $db_public_pass);
mysql_select_db($db_public_db); mysql_select_db($db_public_db);
} }
return mysql_query($query, $public_link); return mysql_query($query, $public_link);
} }
@@ -24,10 +22,10 @@ function userdb_query($query)
global $private_link; global $private_link;
if(!$private_link) if(!$private_link)
{ {
$private_link = mysql_pconnect($db_private_host, $db_private_user, $db_private_pass); $private_link = mysql_pconnect($db_private_host, $db_private_user, $db_private_pass);
mysql_select_db($db_private_db); mysql_select_db($db_private_db);
} }
return mysql_query($query, $private_link); return mysql_query($query, $private_link);
} }

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,41 +1,32 @@
<? <?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> </tr>
</tr> <tr>
<tr> <td> &nbsp; Password </td>
<td> &nbsp; Password </td> <td> <input type="password" name="ext_password"> </td>
<td> <input type="password" name="ext_password"> </td> </tr>
</tr> <tr>
<tr> <td> &nbsp; Password (again) </td>
<td> &nbsp; Password (again) </td> <td> <input type="password" name="ext_password2"> </td>
<td> <input type="password" name="ext_password2"> </td> </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="<?=$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="<?=$ext_email;?>"> </td> </tr>
</tr> <tr>
<tr> <td colspan=2>&nbsp;</td>
<td colspan=2>&nbsp;</td> </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();
@@ -21,25 +16,25 @@ function cmd_send_passwd() {
//--> //-->
</script> </script>
<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>
<td class=color0> <input type="password" name="ext_password"> </td> <td class=color0> <input type="password" name="ext_password"> </td>
</tr> </tr>
<tr> <tr>
<td colspan=2 align=center class=color3> <td colspan=2 align=center class=color3>
<input type="submit" name="login" value=" Login " class=button> <input type="submit" name="login" value=" Login " class=button>
</td> </td>
</tr> </tr>
</table> </table>
<!-- 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,48 +1,44 @@
<? <?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>
<td class=color0> <input type="password" name="ext_password"> </td> <td class=color0> <input type="password" name="ext_password"> </td>
</tr> </tr>
<tr> <tr>
<td class=color1> Password (again) </td> <td class=color1> Password (again) </td>
<td class=color0> <input type="password" name="ext_password2"> </td> <td class=color0> <input type="password" name="ext_password2"> </td>
</tr> </tr>
<tr> <tr>
<td class=color1> Real Name </td> <td class=color1> Real Name </td>
<td class=color0> <input type="text" name="ext_realname" value='<?if(isset($_POST['ext_realname'])) echo $_POST['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>
<tr> <tr>
<td class=color1> Email Address </td> <td class=color1> Email Address </td>
<td class=color0> <input type="text" name="ext_email" value='<?if(isset($_POST['ext_email'])) echo $_POST['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>
<tr> <tr>
<td colspan=2 align=center class=color3> <td colspan=2 align=center class=color3>
<input type="submit" name="create" value=" Create Account " class=button> <input type="submit" name="create" value=" Create Account " class=button>
</td> </td>
</tr> </tr>
</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,11 +1,9 @@
<? <?php
/*************************************************/
/* Main Include Library for Application Database */
/*************************************************/
/* // set global path
* Main Include Library for Application Database
*
*/
//set global path
$apidb_root = BASE; $apidb_root = BASE;
//get modules //get modules
@@ -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();
@@ -66,7 +64,7 @@ function apidb_header($title = 0)
// Set Page Title // Set Page Title
$page_title = $title; $page_title = $title;
if ($title) if ($title)
$title = " - $title"; $title = " - $title";
// banner ad // banner ad
include(BASE."include/"."banner.php"); include(BASE."include/"."banner.php");
@@ -118,8 +116,8 @@ function apidb_sidebar()
//TURN on GLOBAL ADMIN MENU //TURN on GLOBAL ADMIN MENU
if (havepriv("admin")) if (havepriv("admin"))
{ {
include(BASE."include/"."sidebar_admin.php"); include(BASE."include/"."sidebar_admin.php");
apidb_sidebar_add("global_admin_menu"); apidb_sidebar_add("global_admin_menu");
} }
// Login Menu // Login Menu
@@ -133,13 +131,14 @@ function apidb_sidebar()
//LOOP and display menus //LOOP and display menus
for($i = 0; $i < sizeof($sidebar_func_list); $i++) for($i = 0; $i < sizeof($sidebar_func_list); $i++)
{ {
$func = $sidebar_func_list[$i]; $func = $sidebar_func_list[$i];
$func(); $func();
} }
} }
/* 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,13 +155,13 @@ function apidb_image($name)
} }
/* /**
* display an error page * display an error page
*/ */
function errorpage($text = null, $message = null) function errorpage($text = null, $message = null)
{ {
if (!$text) { if (!$text) {
$text = "You must be logged in to perform that operation."; $text = "You must be logged in to perform that operation.";
} }
apidb_header("Oops"); apidb_header("Oops");
echo "<div align=center><font color=red><b>$text</b></font></div>\n"; echo "<div align=center><font color=red><b>$text</b></font></div>\n";
@@ -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")
@@ -203,7 +200,7 @@ function addmsg($text, $color = "black")
global $PHPSESSID; global $PHPSESSID;
if($color) if($color)
$text = "<font color='$color'> $text </font>\n"; $text = "<font color='$color'> $text </font>\n";
$text = str_replace("'", "\\'", $text); $text = str_replace("'", "\\'", $text);
mysql_query("INSERT INTO sessionMessages VALUES (null, null, '$PHPSESSID', '$text')"); mysql_query("INSERT INTO sessionMessages VALUES (null, null, '$PHPSESSID', '$text')");
@@ -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()
@@ -221,20 +218,20 @@ function dumpmsgbuffer()
$result = mysql_query("SELECT * FROM sessionMessages WHERE sessionId = '$PHPSESSID'"); $result = mysql_query("SELECT * FROM sessionMessages WHERE sessionId = '$PHPSESSID'");
if(!$result) if(!$result)
return; return;
while($r = mysql_fetch_object($result)) while($r = mysql_fetch_object($result))
{ {
echo html_frame_start("","300","",5); echo html_frame_start("","300","",5);
echo "<div align=center> $r->message </div>"; echo "<div align=center> $r->message </div>";
echo html_frame_end("&nbsp;"); echo html_frame_end("&nbsp;");
echo "<br>\n"; echo "<br>\n";
} }
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();
@@ -67,4 +70,4 @@ function getSuperMaintainersUserIdsFromAppId($appId)
return $retval; return $retval;
} }
?> ?>

View File

@@ -1,14 +1,14 @@
<? <?php
class htmlmenu { class htmlmenu {
function htmlmenu($name, $form = null) function htmlmenu($name, $form = null)
{ {
global $apidb_root; global $apidb_root;
if ($form) if ($form)
echo "<form action='$form' method=get>\n"; echo "<form action='$form' method=get>\n";
echo ' echo '
<div align=left> <div align=left>
<table width="160" border="0" cellspacing="0" cellpadding="0"> <table width="160" border="0" cellspacing="0" cellpadding="0">
<tr> <tr>
@@ -40,38 +40,38 @@ echo '
/* add a table row */ /* add a table row */
function add($name, $url = null) function add($name, $url = null)
{ {
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";
}
} }
function addmisc($stuff, $align = "left") function addmisc($stuff, $align = "left")
{ {
echo " <tr class=sideMenu><td width='100%' align=$align><span class=menuItem>&nbsp;$stuff</span></td></tr>\n"; echo " <tr class=sideMenu><td width='100%' align=$align><span class=menuItem>&nbsp;$stuff</span></td></tr>\n";
} }
function done($form = null) function done($form = null)
{ {
global $apidb_root; global $apidb_root;
echo ' echo '
</table> </table>
</td></tr> </td></tr>
</table> </table>
</td> </td>
<td><img src="'.$apidb_root.'images/blank.gif" border=0 width=5 height=1 alt="-"></td> <td><img src="'.$apidb_root.'images/blank.gif" border=0 width=5 height=1 alt="-"></td>
</tr> </tr>
</table> </table>
</div> </div>
<br> <br>
'; ';
if ($form) if ($form)
echo "</form>\n"; echo "</form>\n";
} }
} }
?> ?>

View File

@@ -1,4 +1,4 @@
<? <?php
function parsedate($datestr) function parsedate($datestr)
{ {
@@ -14,66 +14,69 @@ function parsedate($datestr)
$datestr = ereg_replace("[,]", "", $datestr); $datestr = ereg_replace("[,]", "", $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))
{ {
$hour = $arr[1]; $hour = $arr[1];
$minute = $arr[2]; $minute = $arr[2];
$second = $arr[3]; $second = $arr[3];
continue; continue;
} }
/* 23:59 */ /* 23:59 */
if(ereg("^([0-9]+):([0-9]+)$", $part, $arr)) if(ereg("^([0-9]+):([0-9]+)$", $part, $arr))
{ {
$hour = $arr[1]; $hour = $arr[1];
$minute = $arr[2]; $minute = $arr[2];
$second = 0; $second = 0;
continue; continue;
} }
/* 2000-12-31 (mysql date format) */ /* 2000-12-31 (mysql date format) */
if(ereg("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$", $part, $arr)) if(ereg("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$", $part, $arr))
{ {
$year = $arr[1]; $year = $arr[1];
$month = $arr[2]; $month = $arr[2];
$day = $arr[3]; $day = $arr[3];
continue; continue;
} }
if(defined($ampm[$part])) if(defined($ampm[$part]))
{ {
$hour += $ampm[$part]; $hour += $ampm[$part];
continue; continue;
} }
if($monthnames[substr($part, 0, 3)])
{
$month = $monthnames[substr($part, 0, 3)];
continue;
}
if($part > 1900) if($monthnames[substr($part, 0, 3)])
{ {
$year = $part; $month = $monthnames[substr($part, 0, 3)];
continue; continue;
} }
if($part > 31)
{ if($part > 1900)
$year = 1900 + $part; {
continue; $year = $part;
} continue;
if($part >= 1 && $part <= 31) }
{
$day = $part; if($part > 31)
continue; {
} $year = 1900 + $part;
continue;
}
if($part >= 1 && $part <= 31)
{
$day = $part;
continue;
}
//echo "Unparsed: '$part'<br>\n"; //echo "Unparsed: '$part'<br />\n";
} }
return mktime($hour, $minute, $second, $month, $day, $year); return mktime($hour, $minute, $second, $month, $day, $year);
} }

View File

@@ -1,76 +1,73 @@
<? <?php
/* /**
* add previous/next buttons * add previous/next buttons
*/ */
function add_pn_buttons($vars, $endpos) function add_pn_buttons($vars, $endpos)
{ {
extract($vars); extract($vars);
if($linesPerPage == "ALL") if($linesPerPage == "ALL")
{ {
return; return;
} }
$curPage = $curPos / $linesPerPage; $curPage = $curPos / $linesPerPage;
$numRows = $endpos - $curPos; $numRows = $endpos - $curPos;
$numButtons = $totalCount / $linesPerPage; $numButtons = $totalCount / $linesPerPage;
$buttonCount = 1; $buttonCount = 1;
$prev_url = 0; $prev_url = 0;
$next_url = 0; $next_url = 0;
// define previous/next buttons // define previous/next buttons
if($curPos > 0) if($curPos > 0)
{ {
$vars["curPos"] = $curPos - $linesPerPage; $vars["curPos"] = $curPos - $linesPerPage;
$prev_url = "stdquery.php?".build_urlarg($vars); $prev_url = "stdquery.php?".build_urlarg($vars);
} }
if($endpos < $totalCount) if($endpos < $totalCount)
{ {
$vars["curPos"] = $curPos + $linesPerPage; $vars["curPos"] = $curPos + $linesPerPage;
$next_url = "stdquery.php?".build_urlarg($vars); $next_url = "stdquery.php?".build_urlarg($vars);
} }
// show prev button if nessessary
if($prev_url)
{
echo html_b(html_ahref("&lt;&lt; Prev", $prev_url));
}
// show numbered links // show prev button if nessessary
if(!$useNextOnly && $endpos <= $totalCount) if($prev_url)
{ {
while($buttonCount <= $numButtons + 1) echo html_b(html_ahref("&lt;&lt; Prev", $prev_url));
{ }
if($curPage == ($buttonCount - 1))
{
echo html_b("$buttonCount");
}
else
{
$vars["curPos"] = ($buttonCount - 1) * $linesPerPage;
$url = "stdquery.php?".build_urlarg($vars);
echo " ".html_ahref("$buttonCount", $url)." ";
}
if(!($buttonCount % 40)) // show numbered links
{ if(!$useNextOnly && $endpos <= $totalCount)
echo html_p(); {
} while($buttonCount <= $numButtons + 1)
$buttonCount++; {
} if($curPage == ($buttonCount - 1))
{
echo html_b("$buttonCount");
} else
{
$vars["curPos"] = ($buttonCount - 1) * $linesPerPage;
$url = "stdquery.php?".build_urlarg($vars);
echo " ".html_ahref("$buttonCount", $url)." ";
}
if(!($buttonCount % 40))
{
echo html_p();
}
$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,8 +1,10 @@
<? <?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 {
var $fields; var $fields;

View File

@@ -7,12 +7,12 @@
<tr> <tr>
<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();
?> ?>
<br><br> <br><br>
@@ -20,18 +20,17 @@
<? if(havepriv("admin")) echo "<input type=checkbox name=mode value=edit> Edit mode <br>\n"; ?> <? 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
<option>150 <option>150
<option>200 <option>200
<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,46 +7,45 @@
<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
<option>2 <option>2
<option>3 <option>3
<option>4 <option>4
<option>5 <option>5
</select> or higher </select> or higher
<select NAME="system">
<option>ANY
<option value=windows> Windows
<option value=fake> Fake Windows
</select>
<br>Entries Per Page: <select NAME="system">
<select NAME="linesPerPage"> <option>ANY
<option>50 <option value=windows> Windows
<option>100 <option value=fake> Fake Windows
<option>150 </select>
<option>200
<option>500 <br />Entries Per Page:
<option>ALL <select NAME="linesPerPage">
</select> <option>50
<br> <input TYPE="SUBMIT" VALUE="List Apps"> <option>100
<option>150
<option>200
<option>500
<option>ALL
</select>
<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

@@ -6,182 +6,176 @@ include(BASE."include/"."appbyvendor_inc.php");
function initFields() function initFields()
{ {
global $fields, $orderby, $join, $searchfor, $searchwhat; global $fields, $orderby, $join, $searchfor, $searchwhat;
$fields = ""; $fields = "";
$searchfor = ""; $searchfor = "";
$searchwhat = ""; $searchwhat = "";
$join = ""; $join = "";
$orderby = ""; $orderby = "";
} }
/* /**
* perform a sql query * perform a sql query
*/ */
function twinedb_query($query, $vars) function twinedb_query($query, $vars)
{ {
// imports vars into symbol table // imports vars into symbol table
extract($vars); extract($vars);
if(debugging()) if(debugging())
echo "QUERY: $query <p>"; echo "QUERY: $query <p>";
// Only permit sql SELECT statements // Only permit sql SELECT statements
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;
$tcurpos = $curPos+$startapi; $tcurpos = $curPos+$startapi;
$tendpos = $endPos+$startapi; $tendpos = $endPos+$startapi;
// set a limit if not already set
if(!stristr($query, "limit"))
$tmpq .= " LIMIT $tcurpos,$linesPerPage";
// execute the db query // set a limit if not already set
$tstamp = time(); if(!stristr($query, "limit"))
$result = mysql_query($tmpq); $tmpq .= " LIMIT $tcurpos,$linesPerPage";
$tstamp = time() - $tstamp;
if(debugging())
echo "<b> QUERY TIME: $tstamp seconds </b><br>\n";
// query error! // execute the db query
if(!$result) $tstamp = time();
{ $result = mysql_query($tmpq);
echo "$query <br><br>\n"; $tstamp = time() - $tstamp;
echo "A QUERY error occurred: ".mysql_error()."\n";
exit;
}
$numRows = mysql_num_rows($result); if(debugging())
$numCols = mysql_num_fields($result); echo "<b> QUERY TIME: $tstamp seconds </b><br />\n";
$curPage = $curPos/$linesPerPage; // query error!
$tmendpos = $curPos + $numRows; if(!$result)
$explain = "stdquery.php?query=".urlencode("EXPLAIN $tmpq"); {
echo "$query <br /><br />\n";
echo "A QUERY error occurred: ".mysql_error()."\n";
exit;
}
$numRows = mysql_num_rows($result);
$numCols = mysql_num_fields($result);
$curPage = $curPos/$linesPerPage;
$tmendpos = $curPos + $numRows;
$explain = "stdquery.php?query=".urlencode("EXPLAIN $tmpq");
echo html_br(2); echo html_br(2);
// set $debug to enable query debugging // set $debug to enable query debugging
if($debug || stristr($tmpq, "explain")) if($debug || stristr($tmpq, "explain"))
{ {
$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>");
add_pn_buttons($vars, $tmendpos); add_pn_buttons($vars, $tmendpos);
echo html_br(2); echo html_br(2);
// output table header
echo html_table_begin("width='80%' cellspacing=1 border=0 rules=rows frame=hsides");
$helems = array();
for($k = 0; $k < $numCols; $k++)
{
$name = mysql_field_name($result, $k);
$helems[] = $name;
if($name == "apiid")
$have_apiid = 1;
}
echo html_th($helems, "title");
$curapiid=0;
$curName="[NONAME]";
for($i = 0; $i < $numRows; $i++)
{
$row = mysql_fetch_array($result, MYSQL_BOTH);
$color = ($i % 2);
$arr = array();
// output table header
echo html_table_begin("width='80%' cellspacing=1 border=0 rules=rows frame=hsides");
$helems = array();
for($k = 0; $k < $numCols; $k++) for($k = 0; $k < $numCols; $k++)
{ {
$name = mysql_field_name($result, $k); $fname = mysql_field_name($result, $k);
$helems[] = $name; if($fname == "username")
if($name == "apiid") {
$have_apiid = 1; $username = $row[$k];
} $userid = $row["userid"];
echo html_th($helems, "title"); $arr[] = html_ahref($username."&nbsp;", apidb_url("edituser.php?userid=$userid&username=$username"));
continue;
}
$curapiid=0; if($fname == "vendorName")
$curName="[NONAME]"; {
initFields();
$url = "vendorview.php?vendorId=".$row["vendorId"];
$arr[] = html_ahref($row[$k], $url);
continue;
}
for($i = 0; $i < $numRows; $i++) if($fname == "appName")
{ {
$row = mysql_fetch_array($result, MYSQL_BOTH); initFields();
$color = ($i % 2); $url = "appview.php?appId=".$row["appId"];
$arr = array(); $arr[] = html_ahref($row[$k], $url);
continue;
}
for($k = 0; $k < $numCols; $k++) if($fname == "versionName")
{ {
$fname = mysql_field_name($result, $k); $versionId = $row["versionId"];
$url = "admin/editAppVersion.php?versionId=$versionId";
$arr[] = html_ahref($row[$k], $url);
if($fname == "username") continue;
{ }
$username = $row[$k];
$userid = $row["userid"];
$arr[] = html_ahref($username."&nbsp;", apidb_url("edituser.php?userid=$userid&username=$username"));
continue;
}
if($fname == "vendorName") if($fname == "webPage")
{ {
initFields(); $url = $row[$k];
$url = "vendorview.php?vendorId=".$row["vendorId"]; $theLink = "$url";
$arr[] = html_ahref($row[$k], $url); $arr[] = html_ahref($url, $theLink);
continue;
}
if($fname == "appName") continue;
{ }
initFields();
$url = "appview.php?appId=".$row["appId"];
$arr[] = html_ahref($row[$k], $url);
continue;
} if(mysql_field_type($result, $k) == "int")
{
if($fname == "versionName") $val = (int)$row[$k];
{ $arr[] = "<div align=right>$val</div>";
$versionId = $row["versionId"]; } else
$url = "admin/editAppVersion.php?versionId=$versionId"; {
$arr[] = html_ahref($row[$k], $url); if(!$row[$k])
continue; $arr[] = "&nbsp";
} else
$arr[] = "$row[$k]";
if($fname == "webPage") }
{
$url = $row[$k];
$theLink = "$url";
$arr[] = html_ahref($url, $theLink);
continue;
}
if(mysql_field_type($result, $k) == "int")
{
$val = (int)$row[$k];
$arr[] = "<div align=right>$val</div>";
}
else
{
if(!$row[$k])
$arr[] = "&nbsp";
else
$arr[] = "$row[$k]";
}
}
echo html_tr($arr, "color$color");
} }
echo html_table_end(); echo html_tr($arr, "color$color");
echo html_br(); }
add_pn_buttons($vars, $tmendpos); echo html_table_end();
echo html_echo("</div>"); echo html_br();
mysql_free_result($result); add_pn_buttons($vars, $tmendpos);
closedb(); echo html_echo("</div>");
mysql_free_result($result);
closedb();
} }

View File

@@ -1,56 +1,52 @@
<? <?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>
<td class=color1>Entries Per Page</td> <td class=color1>Entries Per Page</td>
<td> <td>
<select NAME="linesPerPage"> <select NAME="linesPerPage">
<option>100</option> <option>100</option>
<option>200</option> <option>200</option>
<option>500</option> <option>500</option>
<option>ALL</option> <option>ALL</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan=2 class=color3 align=center><input TYPE="SUBMIT" VALUE="List Users" class=button></td> <td colspan=2 class=color3 align=center><input TYPE="SUBMIT" VALUE="List Users" class=button></td>
</tr> </tr>
</table> </table>
<input TYPE="HIDDEN" NAME="orderby" VALUE="userid"> <input TYPE="HIDDEN" NAME="orderby" VALUE="userid">
<input TYPE="HIDDEN" NAME="searchwhat" VALUE="user_list.username"> <input TYPE="HIDDEN" NAME="searchwhat" VALUE="user_list.username">
<input TYPE="HIDDEN" NAME="fields[]" VALUE="user_list.userid"> <input TYPE="HIDDEN" NAME="fields[]" VALUE="user_list.userid">
<input TYPE="HIDDEN" NAME="fields[]" VALUE="user_list.username"> <input TYPE="HIDDEN" NAME="fields[]" VALUE="user_list.username">
<input TYPE="HIDDEN" NAME="fields[]" VALUE="user_list.email"> <input TYPE="HIDDEN" NAME="fields[]" VALUE="user_list.email">
<input TYPE="HIDDEN" NAME="fields[]" VALUE="user_list.realname"> <input TYPE="HIDDEN" NAME="fields[]" VALUE="user_list.realname">
<input TYPE="HIDDEN" NAME="fields[]" VALUE="user_list.created"> <input TYPE="HIDDEN" NAME="fields[]" VALUE="user_list.created">
</form> </form>
<!-- end of users query --> <!-- end of users query -->
<? <?php
echo html_frame_end(); echo html_frame_end();

View File

@@ -1,37 +1,34 @@
<!-- 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"> <form ACTION="stdquery.php" METHOD="get">
<form ACTION="stdquery.php" METHOD="get"> <input TYPE="HIDDEN" NAME="orderby" VALUE="vendorId">
<input TYPE="HIDDEN" NAME="orderby" VALUE="vendorId"> Pattern:
Pattern: <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="vendor.vendorName">
<input TYPE="HIDDEN" NAME="searchwhat" VALUE="vendor.vendorName"> <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> <?php if(havepriv("admin")) echo "<input type=checkbox name=mode value=edit> Edit mode <br />\n"; ?>
<? 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
<option>150 <option>150
<option>200 <option>200
<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,13 +1,12 @@
<? <?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() {
global $apidb_root; global $apidb_root;

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,32 +14,32 @@ 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
*/ */
function User() function User()
{ {
$this->connect(); $this->connect();
} }
function connect() function connect()
{ {
$this->link = opendb(); $this->link = opendb();
} }
/* /**
* check if a user exists * check if a user exists
* returns TRUE if the user exists * returns TRUE if the user exists
*/ */
function exists($username) function exists($username)
{ {
$result = mysql_query("SELECT * FROM user_list WHERE username = '$username'", $this->link); $result = mysql_query("SELECT * FROM user_list WHERE username = '$username'", $this->link);
if(!$result || mysql_num_rows($result) != 1) if(!$result || mysql_num_rows($result) != 1)
return 0; return 0;
return 1; return 1;
} }
@@ -58,21 +57,24 @@ 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");
if(!$result || mysql_num_rows($result) != 1) if(!$result || mysql_num_rows($result) != 1)
return null; return null;
$ob = mysql_fetch_object($result); $ob = mysql_fetch_object($result);
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)
@@ -139,13 +140,13 @@ class User {
if (!mysql_query("UPDATE user_list SET password = password('$password') WHERE userid = $userid")) if (!mysql_query("UPDATE user_list SET password = password('$password') WHERE userid = $userid"))
return 0; return 0;
} }
if ($realname) if ($realname)
{ {
if (!mysql_query("UPDATE user_list SET realname = '".addslashes($realname)."' WHERE userid = $userid")) if (!mysql_query("UPDATE user_list SET realname = '".addslashes($realname)."' WHERE userid = $userid"))
return 0; return 0;
} }
if ($email) if ($email)
{ {
if (!mysql_query("UPDATE user_list SET email = '".addslashes($email)."' WHERE userid = $userid")) if (!mysql_query("UPDATE user_list SET email = '".addslashes($email)."' WHERE userid = $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)
@@ -201,9 +203,9 @@ class User {
echo mysql_error(); echo mysql_error();
return $result ? true : false; return $result ? true : false;
} }
/*
/**
* 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)
@@ -275,9 +281,8 @@ class User {
return $result; return $result;
} }
/*========================================================================= /**
*
* 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,10 +330,11 @@ 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())
return false; return false;
return $_SESSION['current']->getpref("debug") == "yes"; return $_SESSION['current']->getpref("debug") == "yes";
} }
@@ -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,42 +1,44 @@
<? <?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)
{ {
if(!$userId) if(!$userId)
{ {
if(loggedin()) if(loggedin())
$userId = $_SESSION['current']->userid; $userId = $_SESSION['current']->userid;
else else
return 0; return 0;
} }
$result = mysql_query("SELECT * FROM appVotes WHERE appId = $appId AND userId = $userId"); $result = mysql_query("SELECT * FROM appVotes WHERE appId = $appId AND userId = $userId");
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)
{ {
if(!$userId) if(!$userId)
{ {
if(loggedin()) if(loggedin())
$userId = $_SESSION['current']->userid; $userId = $_SESSION['current']->userid;
else else
return 0; return 0;
} }
$result = mysql_query("SELECT * FROM appVotes WHERE userId = $userId"); $result = mysql_query("SELECT * FROM appVotes WHERE userId = $userId");
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,27 +88,27 @@ 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())
$userId = $_SESSION['current']->userid; $userId = $_SESSION['current']->userid;
if(!$userId) if(!$userId)
return array(); return array();
} }
$result = mysql_query("SELECT * FROM appVotes WHERE userId = $userId"); $result = mysql_query("SELECT * FROM appVotes WHERE userId = $userId");
if(!$result) if(!$result)
return array(); return array();
$obs = array(); $obs = array();
while($ob = mysql_fetch_object($result)) while($ob = mysql_fetch_object($result))
$obs[$ob->slot] = $ob; $obs[$ob->slot] = $ob;
return $obs; return $obs;
} }
function vote_menu() function vote_menu()
{ {
global $appId; global $appId;
@@ -119,26 +119,26 @@ function vote_menu()
$votes = vote_get_user_votes(); $votes = vote_get_user_votes();
if($votes[1]) if($votes[1])
{ {
$str = "<a href='appview.php?appId=".$votes[1]->appId."'> App #".$votes[1]->appId."</a>"; $str = "<a href='appview.php?appId=".$votes[1]->appId."'> App #".$votes[1]->appId."</a>";
$m->add("<input type=radio name=slot value='1' selected> ".$str); $m->add("<input type=radio name=slot value='1' selected> ".$str);
} }
else else
$m->add("<input type=radio name=slot value='1' selected> No App Selected"); $m->add("<input type=radio name=slot value='1' selected> No App Selected");
if($votes[2]) if($votes[2])
{ {
$str = "<a href='appview.php?appId=".$votes[2]->appId."'> App #".$votes[2]->appId."</a>"; $str = "<a href='appview.php?appId=".$votes[2]->appId."'> App #".$votes[2]->appId."</a>";
$m->add("<input type=radio name=slot value='2'> ".$str); $m->add("<input type=radio name=slot value='2'> ".$str);
} }
else else
$m->add("<input type=radio name=slot value='2'> No App Selected"); $m->add("<input type=radio name=slot value='2'> No App Selected");
if($votes[3]) if($votes[3])
{ {
$str = "<a href='appview.php?appId=".$votes[3]->appId."'> App #".$votes[3]->appId."</a>"; $str = "<a href='appview.php?appId=".$votes[3]->appId."'> App #".$votes[3]->appId."</a>";
$m->add("<input type=radio name=slot value='3'> ".$str); $m->add("<input type=radio name=slot value='3'> ".$str);
} }
else else
$m->add("<input type=radio name=slot value='3'> No App Selected"); $m->add("<input type=radio name=slot value='3'> No App Selected");
@@ -159,21 +159,20 @@ function vote_menu()
function dump($arr) function dump($arr)
{ {
while(list($key, $val) = each($arr)) while(list($key, $val) = each($arr))
{ {
echo "$key => $val <br>\n"; echo "$key => $val <br>\n";
} }
} }
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;
} }
dump($vars); dump($vars);
echo "<br>\n"; echo "<br>\n";

109
index.php
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");
@@ -14,34 +11,34 @@ apidb_header("Wine Application Database");
<img src="images/appdb_montage.jpg" width=391 height=266 border=0 align=right alt="Wine AppDB"> <img src="images/appdb_montage.jpg" width=391 height=266 border=0 align=right alt="Wine AppDB">
<h1>Welcome</h1> <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
application.</p>
<p>Most of the features of the Application database require that you have a user account and
are logged in. Some of the benefits of membership are:<p>
<ul>
<li>Ability to Vote on Favorite Applications</li>
<li>Access to the Application Rating System. Rate the apps that "Don't Suck"</li>
<li>Ability to customize the View of the Apps DB and Comment System</li>
<li>Take Credit for your witty posts</li>
<li>Ability to sign up to be an application maintainer.</li>
</ul>
<p>So what are you waiting for, [<a href="account.php?cmd=login">login now</a>]. Your help in <p>This is the Wine Application Database. From here you get info on application
stomping out Wine issues will be greatly appreciated.</p> compatibility with Wine. For developers, you can get information on the APIs used in an
application.</p>
<p> <p>Most of the features of the Application database require that you have a user account and
If you have anything to contribute (screenshots, howtos), contact us at: are logged in. Some of the benefits of membership are:<p>
<a href="mailto:appdb@winehq.org">appdb@winehq.org</a><br>
Note that this address is not for end-user support, for end user support please contact the <ul>
wine-users mailing list or the wine newsgroup, for more information visit <li>Ability to Vote on Favorite Applications</li>
<a href="http://www.winehq.com/site/forums">this page</a> <li>Access to the Application Rating System. Rate the apps that "Don't Suck"</li>
</p> <li>Ability to customize the View of the Apps DB and Comment System</li>
<? <li>Take Credit for your witty posts</li>
<li>Ability to sign up to be an application maintainer.</li>
</ul>
<p>So what are you waiting for, [<a href="account.php?cmd=login">login now</a>]. Your help in
stomping out Wine issues will be greatly appreciated.</p>
<p>
If you have anything to contribute (screenshots, howtos), contact us at:
<a href="mailto:appdb@winehq.org">appdb@winehq.org</a><br>
Note that this address is not for end-user support, for end user support please contact the
wine-users mailing list or the wine newsgroup, for more information visit
<a href="http://www.winehq.com/site/forums">this page</a>
</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,8 +183,8 @@ 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>
<td>The most popular compression utility for Windows just got better.</td> <td>The most popular compression utility for Windows just got better.</td>
@@ -199,8 +196,8 @@ 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>
<td>The new and improved ICQ is here with all the great features you've come to expect -- plus a whole new set!</td> <td>The new and improved ICQ is here with all the great features you've come to expect -- plus a whole new set!</td>
@@ -214,8 +211,8 @@ 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>
<td>This program has so many possibilities and offers such a wide <td>This program has so many possibilities and offers such a wide
@@ -227,8 +224,8 @@ 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>
<td>This is a version of the popular RAR compression format, offering significantly improved compression ratios.</td> <td>This is a version of the popular RAR compression format, offering significantly improved compression ratios.</td>
@@ -243,21 +240,21 @@ 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>
<td>Take file sharing to a new level.</td> <td>Take file sharing to a new level.</td>
<td>50</td> <td>50</td>
<td>Install: Yes (Dlls installed none)<br /> <td>Install: Yes (Dlls installed none)<br />
Run: Yes. (listbox is not working in it (comctl32)) Run: Yes. (listbox is not working in it (comctl32))
</td> </td>
<td><span class=todo>[TODO]</span></td> <td><span class=todo>[TODO]</span></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>
<td>Use this to capture and manage images, text, and video.</td> <td>Use this to capture and manage images, text, and video.</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");
@@ -11,32 +9,30 @@ require(BASE."include/"."incl.php");
apidb_header("Help and Support"); apidb_header("Help and Support");
?> ?>
<p><big><b>Who Can Help Me Out?</b></big></p> <p><big><b>Who Can Help Me Out?</b></big></p>
<p>
If you have questions, comments on the Wine Application Database, you can contact
us at <a href="mailto:appdb@winehq.org">appdb@winehq.org</a>.
</p>
<p>
If you notice something that seems to be wrong, or busticated, there is a way you can
help us out.<br>
We also have a <a href="http://bugs.winehq.org/">Bug Tracking Database</a>
where you can register bugs. This is the best way to get problems fixed. You can go directly
to the App DB Bug Database by following this
<a href="http://bugs.winehq.org/buglist.cgi?product=Wine+Apps+Database">link</a>.
</p>
<p>
If you need more information on the Wine Project itself, there are plenty of resources.
</p>
<ul>
<li><a href="http://www.winehq.org">Wine Development HQ</a></li>
<li><a href="http://www.codeweavers.com">CodeWeavers Home Page</a></li>
</ul>
<?
<p>
If you have questions, comments on the Wine Application Database, you can contact
us at <a href="mailto:appdb@winehq.org">appdb@winehq.org</a>.
</p>
<p>
If you notice something that seems to be wrong, or busticated, there is a way you can
help us out.<br>
We also have a <a href="http://bugs.winehq.org/">Bug Tracking Database</a>
where you can register bugs. This is the best way to get problems fixed. You can go directly
to the App DB Bug Database by following this
<a href="http://bugs.winehq.org/buglist.cgi?product=Wine+Apps+Database">link</a>.
</p>
<p>
If you need more information on the Wine Project itself, there are plenty of resources.
</p>
<ul>
<li><a href="http://www.winehq.org">Wine Development HQ</a></li>
<li><a href="http://www.codeweavers.com">CodeWeavers Home Page</a></li>
</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");