- 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 @@
<?
/*
* Account Login / Logout Handler for AppDB
*
*/
<?php
/********************************************/
/* Account Login / Logout Handler for AppDB */
/********************************************/
include("path.php");
include(BASE."include/"."incl.php");
//set http header to not cache
// set http header to not cache
header("Pragma: no-cache");
header("Cache-control: no-cache");
//check command and process
// check command and process
if(isset($_POST['cmd']))
do_account($_POST['cmd']);
do_account($_POST['cmd']);
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)
{
if (! $cmd) return 0;
switch($cmd)
{
case "new":
apidb_header("New Account");
include(BASE."include/"."form_new.php");
apidb_footer();
exit;
if (!$cmd) return 0;
switch($cmd)
{
case "new":
apidb_header("New Account");
include(BASE."include/"."form_new.php");
apidb_footer();
exit;
case "do_new":
cmd_do_new();
exit;
case "do_new":
cmd_do_new();
exit;
case "login":
apidb_header("Login");
include(BASE."include/"."form_login.php");
apidb_footer();
exit;
case "login":
apidb_header("Login");
include(BASE."include/"."form_login.php");
apidb_footer();
exit;
case "do_login":
cmd_do_login();
exit;
case "do_login":
cmd_do_login();
exit;
case "send_passwd":
cmd_send_passwd();
exit;
case "send_passwd":
cmd_send_passwd();
exit;
case "logout":
apidb_session_destroy();
addmsg("You are successfully logged out.", "green");
redirect(apidb_fullurl("index.php"));
exit;
}
//not valid command, display error page
errorpage("Internal Error","This module was called with incorrect parameters");
exit;
case "logout":
apidb_session_destroy();
addmsg("You are successfully logged out.", "green");
redirect(apidb_fullurl("index.php"));
exit;
}
//not valid command, display error page
errorpage("Internal Error","This module was called with incorrect parameters");
exit;
}
//retry
/**
* retry
*/
function retry($cmd, $msg)
{
addmsg($msg, "red");
do_account($cmd);
}
//create new account
/**
* create new account
*/
function cmd_do_new()
{
if(ereg("^.+@.+\\..+$", $_POST['ext_username']))
{
$_POST['ext_username'] = "";
retry("new", "Invalid Username, must not contain special characters");
return;
}
{
$_POST['ext_username'] = "";
retry("new", "Invalid Username, must not contain special characters");
return;
}
if(strlen($_POST['ext_username']) < 3)
{
$_POST['ext_username'] = "";
retry("new", "Username must be at least 3 characters");
return;
}
{
$_POST['ext_username'] = "";
retry("new", "Username must be at least 3 characters");
return;
}
if(strlen($_POST['ext_password']) < 5)
{
retry("new", "Password must be at least 5 characters");
return;
}
{
retry("new", "Password must be at least 5 characters");
return;
}
if($_POST['ext_password'] != $_POST['ext_password2'])
{
retry("new", "Passwords don't match");
return;
}
{
retry("new", "Passwords don't match");
return;
}
if(!isset($_POST['ext_realname']))
{
retry("new", "You don't have a Real name?");
return;
}
{
retry("new", "You don't have a Real name?");
return;
}
if(!ereg("^.+@.+\\..+$", $_POST['ext_email']))
{
$_POST['ext_email'] = "";
retry("new", "Invalid email address");
return;
}
{
$_POST['ext_email'] = "";
retry("new", "Invalid email address");
return;
}
$user = new User();
if($user->exists($_POST['ext_username']))
{
$_POST['ext_username'] = "";
retry("new", "That username is already in use");
return;
}
{
$_POST['ext_username'] = "";
retry("new", "That username is already in use");
return;
}
$result = $user->create($_POST['ext_username'], $_POST['ext_password'], $_POST['ext_realname'], $_POST['ext_email']);
if($result == null)
{
$user->login($_POST['ext_username'], $_POST['ext_password']);
addmsg("Account created! (".$_POST['ext_username'].")", "green");
redirect(apidb_fullurl());
}
{
$user->login($_POST['ext_username'], $_POST['ext_password']);
addmsg("Account created! (".$_POST['ext_username'].")", "green");
redirect(apidb_fullurl());
}
else
retry("new", "Failed to create account: $result");
}
//email lost password
/**
* email lost password
*/
function cmd_send_passwd()
{
$user = new User();
@@ -134,7 +143,7 @@ function cmd_send_passwd()
$passwd = generate_passwd();
if ($userid)
{
{
if ($user->update($userid, $passwd))
{
$msg = "Application DB Lost Password\n";
@@ -166,23 +175,25 @@ function cmd_send_passwd()
redirect(apidb_fullurl("account.php?cmd=login"));
}
//on login handler
/**
* on login handler
*/
function cmd_do_login()
{
$user = new User();
$result = $user->login($_POST['ext_username'], $_POST['ext_password']);
if($result == null)
{
$_SESSION['current'] = $user;
addmsg("You are successfully logged in as '$user->username'.", "green");
redirect(apidb_fullurl("index.php"));
}
else
{
retry("login","Login failed ($result)");
$_SESSION['current'] = "";
}
{
$_SESSION['current'] = $user;
addmsg("You are successfully logged in as '$user->username'.", "green");
redirect(apidb_fullurl("index.php"));
} else
{
retry("login","Login failed ($result)");
$_SESSION['current'] = "";
}
}
?>
?>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,7 @@
<?
<?php
/****************************************************************/
/* Code to view all kinds of interesting statistics about appdb */
/****************************************************************/
include("path.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");
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)
{
@@ -41,8 +41,8 @@ opendb();
// We have input, but wrong input
if( ( $width AND !is_numeric($width) ) || ( $height AND !is_numeric($height) ) )
{
$width = 100;
$height = 75;
$width = 100;
$height = 75;
}
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) )
$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
handle_error("IDs wrong");

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
<?
<?php
include("path.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>
<td> &nbsp; User Name </td>
<td> <b> <?=$ext_username?> </b> </td>
<td> <b> <?php echo $ext_username; ?> </b> </td>
</tr>
<tr>
<td> &nbsp; Password </td>
@@ -91,15 +91,16 @@ if($HTTP_POST_VARS)
</tr>
<tr>
<td> &nbsp; Real Name </td>
<td> <input type="text" name="ext_realname" value="<?=$ext_realname?>"> </td>
<td> <input type="text" name="ext_realname" value="<?php echo $ext_realname; ?>"> </td>
</tr>
<tr>
<td> &nbsp; Email Address </td>
<td> <input type="text" name="ext_email" value="<?=$ext_email?>"> </td>
<td> <input type="text" name="ext_email" value="<?php echo $ext_email; ?>"> </td>
</tr>
<tr>
<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>
<td colspan=2>&nbsp;</td>

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,8 @@
<?
<?php
/***********************************************************/
/* this class represents an application incl. all versions */
/***********************************************************/
class Application {
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
*/
function banner_display ()
{
// import banner paths from config
global $apidb_root;
// import banner paths from config
global $apidb_root;
$banner_path_468x60 = $apidb_root."banner/468x60/";
$banner_path_xml = $apidb_root."banner/xml/";
// opening html
$banner = "";
$banner .= "\n\n".'<!-- START BANNER AD -->'."\n";
$banner .= '<div align=center>'."\n";
// opening html
$banner = "";
$banner .= "\n\n".'<!-- START BANNER AD -->'."\n";
$banner .= '<div align=center>'."\n";
// read dir and get list of banners
$ads = array();
$d = opendir($banner_path_468x60);
while($entry = readdir($d))
{
if(!ereg("(.+)\\.gif$", $entry, $arr))
continue; //"
array_push($ads, $arr[1]);
}
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');
// read dir and get list of banners
$ads = array();
$d = opendir($banner_path_468x60);
while($entry = readdir($d))
{
if(!ereg("(.+)\\.gif$", $entry, $arr))
continue; //"
array_push($ads, $arr[1]);
}
closedir($d);
// 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";
// 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');
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 */
/***************************************************/
class Category {
var $name;
@@ -8,76 +10,76 @@ class Category {
var $subcat;
/*
/**
* the special name "ROOT" is the top category
*/
function Category($id = 0)
{
$this->load($id);
$this->load($id);
}
/*
/**
* load the category data into this class
*/
function load($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;
}
$this->id = $id;
$ob = mysql_fetch_object($result);
$this->name = $ob->catName;
}
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;
}
$result = mysql_query("SELECT catId, catName, catDescription FROM ".
"appCategory WHERE catParent = $this->id " .
"ORDER BY catName");
if(mysql_num_rows($result) == 0)
return; // no sub categories
$ob = mysql_fetch_object($result);
$this->name = $ob->catName;
}
$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);
}
$result = mysql_query("SELECT catId, catName, catDescription FROM ".
"appCategory WHERE catParent = $this->id " .
"ORDER BY catName");
if(mysql_num_rows($result) == 0)
return; // no sub categories
$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
*/
function getCategoryId($name)
{
if($name == "ROOT")
return 0;
if($name == "ROOT")
return 0;
$result = mysql_query("SELECT catId FROM appCategory WHERE ".
"catName = '$name'");
if(!$result)
return -1;
if(mysql_num_rows($result) != 1)
return -1;
$row = mysql_fetch_object($result);
return $row->catId;
$result = mysql_query("SELECT catId FROM appCategory WHERE ".
"catName = '$name'");
if(!$result)
return -1;
if(mysql_num_rows($result) != 1)
return -1;
$row = mysql_fetch_object($result);
return $row->catId;
}
/*
/**
* returns the list of sub categories
*
* category list has the following format:
@@ -86,83 +88,84 @@ class Category {
*/
function getCategoryList()
{
return $this->subcat;
return $this->subcat;
}
/*
/**
* returns a path like:
*
* { ROOT, Games, Simulation }
*/
function getCategoryPath()
{
$path = array();
$id = $this->id;
while(1)
{
$result = mysql_query("SELECT catName, catId, catParent FROM appCategory WHERE catId = $id");
if(!$result || mysql_num_rows($result) != 1)
break;
$cat = mysql_fetch_object($result);
$path[] = array($cat->catId, $cat->catName);
$id = $cat->catParent;
}
$path[] = array(0, "ROOT");
return array_reverse($path);
$path = array();
$id = $this->id;
while(1)
{
$result = mysql_query("SELECT catName, catId, catParent FROM appCategory WHERE catId = $id");
if(!$result || mysql_num_rows($result) != 1)
break;
$cat = mysql_fetch_object($result);
$path[] = array($cat->catId, $cat->catName);
$id = $cat->catParent;
}
$path[] = array(0, "ROOT");
return array_reverse($path);
}
/*
/**
* returns a list of applications in the specified category
*/
function getAppList($id)
{
$result = mysql_query("SELECT appId, appName, description FROM ".
"appFamily WHERE catId = $id ".
"ORDER BY appName");
if(!$result || mysql_num_rows($result) == 0)
return array();
$list = array();
$result = mysql_query("SELECT appId, appName, description FROM ".
"appFamily WHERE catId = $id ".
"ORDER BY appName");
if(!$result || mysql_num_rows($result) == 0)
return array();
$list = array();
while($row = mysql_fetch_object($result))
{
if($row->appName == "NONAME")
continue;
$list[$row->appId] = array($row->appName, $row->description);
}
return $list;
{
if($row->appName == "NONAME")
continue;
$list[$row->appId] = array($row->appName, $row->description);
}
return $list;
}
/*
/**
* returns the number of apps in the specified category
*/
function getAppCount($id, $recurse = 1)
{
$total = 0;
$total = 0;
$result = mysql_query("SELECT appId FROM appFamily WHERE catId = $id");
if($result)
$total += mysql_num_rows($result);
$result = mysql_query("SELECT appId FROM appFamily WHERE catId = $id");
if($result)
$total += mysql_num_rows($result);
if($recurse)
{
$result = mysql_query("SELECT catId FROM appCategory WHERE catParent = $id");
if($result)
{
while($ob = mysql_fetch_object($result))
$total += $this->getAppCount($ob->catId, 1);
}
}
return $total;
if($recurse)
{
$result = mysql_query("SELECT catId FROM appCategory WHERE catParent = $id");
if($result)
{
while($ob = mysql_fetch_object($result))
$total += $this->getAppCount($ob->catId, 1);
}
}
return $total;
}
};
function appIdToName($appId)
{
$result = mysql_query("SELECT appName FROM appFamily WHERE appId = $appId");
if(!$result || !mysql_num_rows($result))
return "<unknown>"; // shouldn't normally happen
return "<unknown>"; // shouldn't normally happen
$ob = mysql_fetch_object($result);
return $ob->appName;
}
@@ -176,31 +179,30 @@ function versionIdToName($versionId)
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)
{
global $appId;
global $versionId;
$str = "";
$catCount = 0;
while(list($idx, list($id, $name)) = each($path))
{
if($name == "ROOT")
$catname = "Main";
else
$catname = $name;
{
if($name == "ROOT")
$catname = "Main";
else
$catname = $name;
if ($catCount > 0) { $str .= " &gt; "; }
$str .= html_ahref($catname,"appbrowse.php?catId=$id");
$catCount++;
}
if ($catCount > 0) $str .= " &gt; ";
$str .= html_ahref($catname,"appbrowse.php?catId=$id");
$catCount++;
}
if($appId)
$str .= " &gt; ".html_ahref(appIdToName($appId),"appview.php?appId=$appId");
if($_REQUEST['appId'])
$str .= " &gt; ".html_ahref(appIdToName($_REQUEST['appId']),"appview.php?appId=".$_REQUEST['appId']);
if($versionId)
$str .= " &gt; ".html_ahref(versionIdToName($versionId),"appview.php?appId=$appId&versionId=$versionId");
if($_REQUEST['versionId'])
$str .= " &gt; ".html_ahref(versionIdToName($_REQUEST['versionId']),"appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']);
return $str;
}

View File

@@ -1,10 +1,8 @@
<?
<?php
/***************************/
/* get user info for posts */
/***************************/
/*=========================================================================
*
* get user info for posts
*
*/
function forum_lookup_user ($userid)
{
$mailto = '';
@@ -30,10 +28,8 @@ function forum_lookup_user ($userid)
return $mailto;
}
/*=========================================================================
*
/**
* display a single comment (in $ob)
*
*/
function view_app_comment($ob)
{
@@ -84,9 +80,7 @@ function view_app_comment($ob)
}
/*=========================================================================
*
/**
* grab comments for appId / versionId
* if parentId is not -1 only comments for that thread are returned
*/
@@ -94,7 +88,7 @@ function grab_comments($appId, $versionId, $parentId = -1)
{
$extra = "";
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, ".
"commentId, parentId, appId, versionId, userid, subject, body ".
@@ -107,39 +101,34 @@ function grab_comments($appId, $versionId, $parentId = -1)
return $result;
}
/*=========================================================================
*
/**
* grab comments for appId / versionId
* if parentId is not -1 only comments for that thread are returned
*/
function count_comments($appId, $versionId)
{
$qstring = "SELECT count(commentId) as hits FROM appComments WHERE appId = $appId AND versionId = $versionId";
$result = mysql_query($qstring);
$ob = mysql_fetch_object($result);
return $ob->hits;
}
/*=========================================================================
*
/**
* display nested comments
*
* handle is a db result set
*
*/
function do_display_comments_nested($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);
$result = grab_comments($ob->appId, $ob->versionId, $ob->commentId);
if($result && mysql_num_rows($result))
{
echo "<blockquote>\n";
do_display_comments_nested($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
*
* handle is a db result set
*
*/
function do_display_comments_threaded($handle, $is_main)
{
if (!$is_main)
echo "<ul>\n";
echo "<ul>\n";
while ($ob = mysql_fetch_object($handle))
{
if ($is_main)
{
view_app_comment($ob);
}
else
} else
{
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";
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";
}
$result = grab_comments($ob->appId, $ob->versionId, $ob->commentId);
@@ -188,6 +173,7 @@ function do_display_comments_threaded($handle, $is_main)
echo "</ul>\n";
}
function display_comments_threaded($appId, $versionId, $threadId = 0)
{
$result = grab_comments($appId, $versionId, $threadId);
@@ -196,10 +182,8 @@ function display_comments_threaded($appId, $versionId, $threadId = 0)
}
/*=========================================================================
*
/**
* display flat comments
*
*/
function display_comments_flat($appId, $versionId)
{
@@ -212,7 +196,7 @@ function display_comments_flat($appId, $versionId)
}
}
}
function view_app_comments($appId, $versionId, $threadId = 0)
{
@@ -231,20 +215,20 @@ function view_app_comments($appId, $versionId, $threadId = 0)
// message display mode changer
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)
$_SESSION[current]->setpref("comments:mode", $cmode);
$sel[$_SESSION['current']->getpref("comments:mode")] = 'selected';
echo '<td><form method=get name=smode action="appview.php">',"\n";
echo "<b>Application Comments</b> $messageCount total comments ";
echo '<b>Mode</b> <select name="cmode" onchange="document.smode.submit();">',"\n";
echo ' <option value=flat '.$sel['flat'].'>Flat</option>',"\n";
echo ' <option value=threaded '.$sel['threaded'].'>Threaded</option>',"\n";
echo ' <option value=nested '.$sel['nested'].'>Nested</option>',"\n";
echo ' <option value=off '.$sel['off'].'>No Comments</option>',"\n";
echo '</select><input type=hidden name="appId" value="'.$appId.'">',"\n";
echo '<input type=hidden name="versionId" value="'.$versionId.'"></form></td>',"\n";
$_SESSION['current']->setpref("comments:mode", $cmode);
$sel[$_SESSION['current']->getpref("comments:mode")] = 'selected';
echo '<td><form method=get name=smode action="appview.php">',"\n";
echo "<b>Application Comments</b> $messageCount total comments ";
echo '<b>Mode</b> <select name="cmode" onchange="document.smode.submit();">',"\n";
echo ' <option value=flat '.$sel['flat'].'>Flat</option>',"\n";
echo ' <option value=threaded '.$sel['threaded'].'>Threaded</option>',"\n";
echo ' <option value=nested '.$sel['nested'].'>Nested</option>',"\n";
echo ' <option value=off '.$sel['off'].'>No Comments</option>',"\n";
echo '</select><input type=hidden name="appId" value="'.$appId.'">',"\n";
echo '<input type=hidden name="versionId" value="'.$versionId.'"></form></td>',"\n";
}
// blank space
@@ -266,25 +250,24 @@ function view_app_comments($appId, $versionId, $threadId = 0)
//hide or display depending on pref
if (loggedin())
$mode = $_SESSION['current']->getpref("comments:mode");
$mode = $_SESSION['current']->getpref("comments:mode");
else
$mode = "flat";
$mode = "flat";
switch ($mode)
{
case "flat":
display_comments_flat($appId, $versionId);
break;
display_comments_flat($appId, $versionId);
break;
case "nested":
display_comments_nested($appId, $versionId, $threadId);
break;
display_comments_nested($appId, $versionId, $threadId);
break;
case "threaded":
display_comments_threaded($appId, $versionId, $threadId);
break;
display_comments_threaded($appId, $versionId, $threadId);
break;
}
echo '</td></tr></table>',"\n";
}

View File

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

View File

@@ -1,6 +1,4 @@
<?
<?php
$public_link = null;
$private_link = null;
@@ -10,10 +8,10 @@ function apidb_query($query)
global $public_link;
if(!$public_link)
{
$public_link = mysql_pconnect($db_public_host, $db_public_user, $db_public_pass);
mysql_select_db($db_public_db);
}
{
$public_link = mysql_pconnect($db_public_host, $db_public_user, $db_public_pass);
mysql_select_db($db_public_db);
}
return mysql_query($query, $public_link);
}
@@ -24,10 +22,10 @@ function userdb_query($query)
global $private_link;
if(!$private_link)
{
$private_link = mysql_pconnect($db_private_host, $db_private_user, $db_private_pass);
mysql_select_db($db_private_db);
}
{
$private_link = mysql_pconnect($db_private_host, $db_private_user, $db_private_pass);
mysql_select_db($db_private_db);
}
return mysql_query($query, $private_link);
}

View File

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

View File

@@ -1,41 +1,32 @@
<?
/*
* Edit Account Form
*
*/
<?php
/*********************/
/* Edit Account Form */
/*********************/
?>
<!-- start of edit account form -->
<tr>
<td> &nbsp; User Name </td>
<td> <b> <?=$ext_username;?> </b> </td>
</tr>
<tr>
<td> &nbsp; Password </td>
<td> <input type="password" name="ext_password"> </td>
</tr>
<tr>
<td> &nbsp; Password (again) </td>
<td> <input type="password" name="ext_password2"> </td>
</tr>
<tr>
<td> &nbsp; Real Name </td>
<td> <input type="text" name="ext_realname" value="<?=$ext_realname;?>"> </td>
</tr>
<tr>
<td> &nbsp; Email Address </td>
<td> <input type="text" name="ext_email" value="<?=$ext_email;?>"> </td>
</tr>
<tr>
<td colspan=2>&nbsp;</td>
</tr>
<tr>
<td> &nbsp; User Name </td>
<td> <b> <?=$ext_username;?> </b> </td>
</tr>
<tr>
<td> &nbsp; Password </td>
<td> <input type="password" name="ext_password"> </td>
</tr>
<tr>
<td> &nbsp; Password (again) </td>
<td> <input type="password" name="ext_password2"> </td>
</tr>
<tr>
<td> &nbsp; Real Name </td>
<td> <input type="text" name="ext_realname" value="<?=$ext_realname;?>"> </td>
</tr>
<tr>
<td> &nbsp; Email Address </td>
<td> <input type="text" name="ext_email" value="<?=$ext_email;?>"> </td>
</tr>
<tr>
<td colspan=2>&nbsp;</td>
</tr>
<!-- end of edit account form -->
<?
?>

View File

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

View File

@@ -1,48 +1,44 @@
<?
/*
* New Account Form
*
*/
<?php
/********************/
/* New Account Form */
/********************/
echo '<form method="post" action="account.php">',"\n";
echo html_frame_start("Create New Application DB Account","400","",0)
?>
<!-- start of new account form -->
<table border=0 width="100%" cellspacing=0 cellpadding=20>
<tr>
<td class=color1> User Name </td>
<td class=color0> <input type="text" name="ext_username" value='<?if(isset($_POST['ext_username'])) echo $_POST['ext_username']?>'> </td>
</tr>
<tr>
<td class=color1> Password </td>
<td class=color0> <input type="password" name="ext_password"> </td>
</tr>
<tr>
<td class=color1> Password (again) </td>
<td class=color0> <input type="password" name="ext_password2"> </td>
</tr>
<tr>
<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>
</tr>
<tr>
<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>
</tr>
<table border=0 width="100%" cellspacing=0 cellpadding=20>
<tr>
<td class=color1> User Name </td>
<td class=color0> <input type="text" name="ext_username" value='<?php if(isset($_POST['ext_username'])) echo $_POST['ext_username']?>'> </td>
</tr>
<tr>
<td class=color1> Password </td>
<td class=color0> <input type="password" name="ext_password"> </td>
</tr>
<tr>
<td class=color1> Password (again) </td>
<td class=color0> <input type="password" name="ext_password2"> </td>
</tr>
<tr>
<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>
</tr>
<tr>
<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>
</tr>
<tr>
<td colspan=2 align=center class=color3>
<input type="submit" name="create" value=" Create Account " class=button>
</td>
</tr>
</table>
<tr>
<td colspan=2 align=center class=color3>
<input type="submit" name="create" value=" Create Account " class=button>
</td>
</tr>
</table>
<!-- end of new account form -->
<?
<?php
echo html_frame_end("&nbsp;");
echo '<input type="hidden" name="cmd" value="do_new">',"\n";

View File

@@ -1,10 +1,7 @@
<?
/*
* Application Database - Header
*
*/
<?php
/*********************************/
/* Application Database - Header */
/*********************************/
?>
<!-- start of header.inc -->
@@ -12,12 +9,12 @@
<html>
<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="Pragma" CONTENT="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="<?=$apidb_root?>apidb.css" type="text/css">
<script language="JavaScript" src="<?=$apidb_root?>scripts.js" type="text/javascript"></script>
<link rel="stylesheet" href="<?php echo $apidb_root; ?>apidb.css" type="text/css">
<script language="JavaScript" src="<?php echo $apidb_root; ?>scripts.js" type="text/javascript"></script>
</head>
<body bgcolor="#E2E2E2" text="#000000">
@@ -27,21 +24,21 @@
<td>
<table width="100%" border=0 cellpadding=0 cellspacing=0>
<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>
<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 width="100%" align="center" valign="middle">
<!-- BANNER AD -->
<table border=0 cellpadding=1 cellspacing=0>
<tr><td valign="middle" align="center" class="black"
><?=$banner_ad?></td
><?php echo $banner_ad; ?></td
></tr>
</table>
<!-- END BANNER AD -->
</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>
</tr>
</table>

View File

@@ -1,11 +1,9 @@
<?
<?php
/*************************************************/
/* Main Include Library for Application Database */
/*************************************************/
/*
* Main Include Library for Application Database
*
*/
//set global path
// set global path
$apidb_root = BASE;
//get modules
@@ -20,7 +18,7 @@ require(BASE."include/"."html.php");
$sidebar_func_list = array();
$help_list = array();
// Start session ...
// start session ...
apidb_session_start();
@@ -66,7 +64,7 @@ function apidb_header($title = 0)
// Set Page Title
$page_title = $title;
if ($title)
$title = " - $title";
$title = " - $title";
// banner ad
include(BASE."include/"."banner.php");
@@ -118,8 +116,8 @@ function apidb_sidebar()
//TURN on GLOBAL ADMIN MENU
if (havepriv("admin"))
{
include(BASE."include/"."sidebar_admin.php");
apidb_sidebar_add("global_admin_menu");
include(BASE."include/"."sidebar_admin.php");
apidb_sidebar_add("global_admin_menu");
}
// Login Menu
@@ -133,13 +131,14 @@ function apidb_sidebar()
//LOOP and display menus
for($i = 0; $i < sizeof($sidebar_func_list); $i++)
{
$func = $sidebar_func_list[$i];
$func();
$func = $sidebar_func_list[$i];
$func();
}
}
/* register a sidebar menu function
/**
* register a sidebar menu function
* the supplied function is called when the sidebar is built
*/
function apidb_sidebar_add($funcname)
@@ -156,13 +155,13 @@ function apidb_image($name)
}
/*
/**
* display an error page
*/
function errorpage($text = null, $message = null)
{
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");
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
*/
function redirect($url)
@@ -180,22 +179,20 @@ function redirect($url)
header("Location: ".$url);
}
/*
/**
* redirect back to referer, or else to the main page
*/
function redirectref($url = null)
{
global $HTTP_REFERER;
if(!$url)
$url = $HTTP_REFERER;
$url = $_SERVER['HTTP_REFERER'];
if(!$url)
$url = apidb_fullurl();
$url = apidb_fullurl();
redirect($url);
}
/*
/**
* msgs will be displayed on the Next page view of the same user
*/
function addmsg($text, $color = "black")
@@ -203,7 +200,7 @@ function addmsg($text, $color = "black")
global $PHPSESSID;
if($color)
$text = "<font color='$color'> $text </font>\n";
$text = "<font color='$color'> $text </font>\n";
$text = str_replace("'", "\\'", $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.
*/
function dumpmsgbuffer()
@@ -221,20 +218,20 @@ function dumpmsgbuffer()
$result = mysql_query("SELECT * FROM sessionMessages WHERE sessionId = '$PHPSESSID'");
if(!$result)
return;
return;
while($r = mysql_fetch_object($result))
{
echo html_frame_start("","300","",5);
echo "<div align=center> $r->message </div>";
echo html_frame_end("&nbsp;");
{
echo html_frame_start("","300","",5);
echo "<div align=center> $r->message </div>";
echo html_frame_end("&nbsp;");
echo "<br>\n";
}
}
mysql_query("DELETE FROM sessionMessages WHERE sessionId = '$PHPSESSID'");
}
/*
/**
* Statics
*/
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)
{
$result = mysql_query("SELECT appId, versionId, superMaintainer FROM ".
"appMaintainers WHERE userId = '$userId'");
if(mysql_num_rows($result) == 0)
if(!$result || mysql_num_rows($result) == 0)
return;
$retval = array();
@@ -53,7 +56,7 @@ function getSuperMaintainersUserIdsFromAppId($appId)
"appMaintainers WHERE appId = '$appId' " .
"AND superMaintainer = '1';";
$result = mysql_query($query);
if(mysql_num_rows($result) == 0)
if(!$result || mysql_num_rows($result) == 0)
return; // no sub categories
$retval = array();
@@ -67,4 +70,4 @@ function getSuperMaintainersUserIdsFromAppId($appId)
return $retval;
}
?>
?>

View File

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

View File

@@ -1,4 +1,4 @@
<?
<?php
function parsedate($datestr)
{
@@ -14,66 +14,69 @@ function parsedate($datestr)
$datestr = ereg_replace("[,]", "", $datestr);
$dp = explode(' ', $datestr);
while(list($idx, $part) = each($dp))
{
//echo "PART($part)<br>";
{
//echo "PART($part)<br />";
/* 23:59:59 */
if(ereg("^([0-9]+):([0-9]+):([0-9]+)$", $part, $arr))
{
$hour = $arr[1];
$minute = $arr[2];
$second = $arr[3];
continue;
}
/* 23:59:59 */
if(ereg("^([0-9]+):([0-9]+):([0-9]+)$", $part, $arr))
{
$hour = $arr[1];
$minute = $arr[2];
$second = $arr[3];
continue;
}
/* 23:59 */
if(ereg("^([0-9]+):([0-9]+)$", $part, $arr))
{
$hour = $arr[1];
$minute = $arr[2];
$second = 0;
continue;
}
/* 23:59 */
if(ereg("^([0-9]+):([0-9]+)$", $part, $arr))
{
$hour = $arr[1];
$minute = $arr[2];
$second = 0;
continue;
}
/* 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))
{
$year = $arr[1];
$month = $arr[2];
$day = $arr[3];
continue;
}
/* 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))
{
$year = $arr[1];
$month = $arr[2];
$day = $arr[3];
continue;
}
if(defined($ampm[$part]))
{
$hour += $ampm[$part];
continue;
}
if($monthnames[substr($part, 0, 3)])
{
$month = $monthnames[substr($part, 0, 3)];
continue;
}
if(defined($ampm[$part]))
{
$hour += $ampm[$part];
continue;
}
if($part > 1900)
{
$year = $part;
continue;
}
if($part > 31)
{
$year = 1900 + $part;
continue;
}
if($part >= 1 && $part <= 31)
{
$day = $part;
continue;
}
if($monthnames[substr($part, 0, 3)])
{
$month = $monthnames[substr($part, 0, 3)];
continue;
}
if($part > 1900)
{
$year = $part;
continue;
}
if($part > 31)
{
$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);
}

View File

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

View File

@@ -1,8 +1,10 @@
<?
// query class
// (de)compose/exec queries
// this should have query_inc.php's query preprocessing etc.
<?php
/*************************************************************/
/* query class */
/* (de)compose/exec queries */
/* this should have query_inc.php's query preprocessing etc. */
/*************************************************************/
class qclass {
var $fields;

View File

@@ -7,12 +7,12 @@
<tr>
<td class="box-body">
<form ACTION="stdquery.php" METHOD="get">
Vendor Name:
<input TYPE="TEXT" NAME="searchfor"> (leave blank to match all)
<?
include(BASE."include/"."appbyvendor_inc.php");
Vendor Name:
<input TYPE="TEXT" NAME="searchfor" /> (leave blank to match all)
<?php
include(BASE."include/"."appbyvendor_inc.php");
output_appbyvendor_forminputs();
output_appbyvendor_forminputs();
?>
<br><br>
@@ -20,18 +20,17 @@
<? if(havepriv("admin")) echo "<input type=checkbox name=mode value=edit> Edit mode <br>\n"; ?>
<br>Entries Per Page:
<select NAME="linesPerPage">
<option>50
<option>100
<option>150
<option>200
<option>500
<option>ALL
</select>
<br> <input TYPE="SUBMIT" VALUE="List Apps">
<select NAME="linesPerPage">
<option>50
<option>100
<option>150
<option>200
<option>500
<option>ALL
</select>
<br /> <input TYPE="SUBMIT" VALUE="List Apps" />
</form>
</td>
</tr>
</table>
<!-- end of App query -->

View File

@@ -1,4 +1,3 @@
<!-- start of App query -->
<table border=1 width="100%" cellspacing=0 cellpadding=3 bordercolor=black>
<tr>
@@ -8,46 +7,45 @@
<tr>
<td class="box-body">
<form ACTION="stdquery.php" METHOD="get">
<input TYPE="HIDDEN" NAME="orderby" VALUE="appId">
App Name:
<input TYPE="TEXT" NAME="searchfor"> (leave blank to match all)
<input TYPE="HIDDEN" NAME="searchwhat" VALUE="appFamily.appName">
<input TYPE="HIDDEN" NAME="fields[]" VALUE="appFamily.appId">
<input TYPE="HIDDEN" NAME="fields[]" VALUE="appFamily.appName">
<input TYPE="HIDDEN" NAME="fields[]" VALUE="appFamily.webPage">
<br><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"; ?>
<input TYPE="HIDDEN" NAME="orderby" VALUE="appId" />
App Name:
<input TYPE="TEXT" NAME="searchfor" /> (leave blank to match all)
<input TYPE="HIDDEN" NAME="searchwhat" VALUE="appFamily.appName" />
<input TYPE="HIDDEN" NAME="fields[]" VALUE="appFamily.appId" />
<input TYPE="HIDDEN" NAME="fields[]" VALUE="appFamily.appName" />
<input TYPE="HIDDEN" NAME="fields[]" VALUE="appFamily.webPage" />
<br /><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"; ?>
<br>Rating
<select NAME="rating">
<option>ANY
<option>1
<option>2
<option>3
<option>4
<option>5
</select> or higher
<select NAME="system">
<option>ANY
<option value=windows> Windows
<option value=fake> Fake Windows
</select>
<br />Rating
<select NAME="rating">
<option>ANY
<option>1
<option>2
<option>3
<option>4
<option>5
</select> or higher
<br>Entries Per Page:
<select NAME="linesPerPage">
<option>50
<option>100
<option>150
<option>200
<option>500
<option>ALL
</select>
<br> <input TYPE="SUBMIT" VALUE="List Apps">
<select NAME="system">
<option>ANY
<option value=windows> Windows
<option value=fake> Fake Windows
</select>
<br />Entries Per Page:
<select NAME="linesPerPage">
<option>50
<option>100
<option>150
<option>200
<option>500
<option>ALL
</select>
<br /> <input TYPE="SUBMIT" VALUE="List Apps">
</form>
</td>
</tr>
</table>
<!-- end of App query -->

View File

@@ -6,182 +6,176 @@ include(BASE."include/"."appbyvendor_inc.php");
function initFields()
{
global $fields, $orderby, $join, $searchfor, $searchwhat;
global $fields, $orderby, $join, $searchfor, $searchwhat;
$fields = "";
$searchfor = "";
$searchwhat = "";
$join = "";
$orderby = "";
$fields = "";
$searchfor = "";
$searchwhat = "";
$join = "";
$orderby = "";
}
/*
/**
* perform a sql query
*/
function twinedb_query($query, $vars)
{
// imports vars into symbol table
extract($vars);
// imports vars into symbol table
extract($vars);
if(debugging())
echo "QUERY: $query <p>";
if(debugging())
echo "QUERY: $query <p>";
// Only permit sql SELECT statements
if(!eregi("^select .*$", $query))
{
echo "<b> Invalid SQL Query </b>";
echo "<br> $query <br>";
return;
}
// Only permit sql SELECT statements
if(!eregi("^select .*$", $query))
{
echo "<b> Invalid SQL Query </b>";
echo "<br /> $query <br />";
return;
}
opendb();
$tmpq = str_replace("\\", "", $query);
opendb();
$tmpq = str_replace("\\", "", $query);
$endPos=$curPos+$linesPerPage;
$tcurpos = $curPos+$startapi;
$tendpos = $endPos+$startapi;
// set a limit if not already set
if(!stristr($query, "limit"))
$tmpq .= " LIMIT $tcurpos,$linesPerPage";
$endPos=$curPos+$linesPerPage;
$tcurpos = $curPos+$startapi;
$tendpos = $endPos+$startapi;
// execute the db query
$tstamp = time();
$result = mysql_query($tmpq);
$tstamp = time() - $tstamp;
if(debugging())
echo "<b> QUERY TIME: $tstamp seconds </b><br>\n";
// set a limit if not already set
if(!stristr($query, "limit"))
$tmpq .= " LIMIT $tcurpos,$linesPerPage";
// query error!
if(!$result)
{
echo "$query <br><br>\n";
echo "A QUERY error occurred: ".mysql_error()."\n";
exit;
}
// execute the db query
$tstamp = time();
$result = mysql_query($tmpq);
$tstamp = time() - $tstamp;
$numRows = mysql_num_rows($result);
$numCols = mysql_num_fields($result);
if(debugging())
echo "<b> QUERY TIME: $tstamp seconds </b><br />\n";
$curPage = $curPos/$linesPerPage;
$tmendpos = $curPos + $numRows;
$explain = "stdquery.php?query=".urlencode("EXPLAIN $tmpq");
// query error!
if(!$result)
{
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
if($debug || stristr($tmpq, "explain"))
{
$str = eregi_replace("(SELECT|EXPLAIN|DISTINCT|FROM|WHERE|AND".
"|OR |IS NULL|IS NOT NULL|LIMIT|ORDER BY".
"|GROUP BY)",
"<br><b>\\1</b><br>", $tmpq);
echo "<br>$str<br>\n";
}
// set $debug to enable query debugging
if($debug || stristr($tmpq, "explain"))
{
$str = eregi_replace("(SELECT|EXPLAIN|DISTINCT|FROM|WHERE|AND".
"|OR |IS NULL|IS NOT NULL|LIMIT|ORDER BY".
"|GROUP BY)",
"<br /><b>\\1</b><br />", $tmpq);
echo "<br />$str<br />\n";
}
echo html_echo("<div align=center>");
echo html_echo("<div align=center>");
add_pn_buttons($vars, $tmendpos);
echo html_br(2);
add_pn_buttons($vars, $tmendpos);
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++)
{
$name = mysql_field_name($result, $k);
$helems[] = $name;
if($name == "apiid")
$have_apiid = 1;
}
echo html_th($helems, "title");
$fname = mysql_field_name($result, $k);
if($fname == "username")
{
$username = $row[$k];
$userid = $row["userid"];
$arr[] = html_ahref($username."&nbsp;", apidb_url("edituser.php?userid=$userid&username=$username"));
continue;
}
$curapiid=0;
$curName="[NONAME]";
if($fname == "vendorName")
{
initFields();
$url = "vendorview.php?vendorId=".$row["vendorId"];
$arr[] = html_ahref($row[$k], $url);
continue;
}
for($i = 0; $i < $numRows; $i++)
{
$row = mysql_fetch_array($result, MYSQL_BOTH);
$color = ($i % 2);
$arr = array();
if($fname == "appName")
{
initFields();
$url = "appview.php?appId=".$row["appId"];
$arr[] = html_ahref($row[$k], $url);
continue;
}
for($k = 0; $k < $numCols; $k++)
{
$fname = mysql_field_name($result, $k);
if($fname == "username")
{
$username = $row[$k];
$userid = $row["userid"];
$arr[] = html_ahref($username."&nbsp;", apidb_url("edituser.php?userid=$userid&username=$username"));
continue;
}
if($fname == "versionName")
{
$versionId = $row["versionId"];
$url = "admin/editAppVersion.php?versionId=$versionId";
$arr[] = html_ahref($row[$k], $url);
continue;
}
if($fname == "vendorName")
{
initFields();
$url = "vendorview.php?vendorId=".$row["vendorId"];
$arr[] = html_ahref($row[$k], $url);
continue;
}
if($fname == "webPage")
{
$url = $row[$k];
$theLink = "$url";
$arr[] = html_ahref($url, $theLink);
if($fname == "appName")
{
initFields();
$url = "appview.php?appId=".$row["appId"];
$arr[] = html_ahref($row[$k], $url);
continue;
continue;
}
}
if($fname == "versionName")
{
$versionId = $row["versionId"];
$url = "admin/editAppVersion.php?versionId=$versionId";
$arr[] = html_ahref($row[$k], $url);
continue;
}
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");
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_table_end();
echo html_br();
echo html_tr($arr, "color$color");
}
add_pn_buttons($vars, $tmendpos);
echo html_echo("</div>");
echo html_table_end();
echo html_br();
mysql_free_result($result);
closedb();
add_pn_buttons($vars, $tmendpos);
echo html_echo("</div>");
mysql_free_result($result);
closedb();
}

View File

@@ -1,56 +1,52 @@
<?
/*
* User List
*
*/
<?php
/*************/
/* User List */
/*************/
echo html_frame_start("List Users","400","",0)
?>
<!-- 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>
<td class=color1>Pattern</td>
<td><input TYPE="TEXT" NAME="searchfor"><br><small>(leave blank to match all)</small></td>
</tr>
<tr>
<td class=color1>Pattern</td>
<td><input TYPE="TEXT" NAME="searchfor"><br /><small>(leave blank to match all)</small></td>
</tr>
<tr>
<td class=color1>Entries Per Page</td>
<td>
<select NAME="linesPerPage">
<option>100</option>
<option>200</option>
<option>500</option>
<option>ALL</option>
</select>
</td>
</tr>
<tr>
<td class=color1>Entries Per Page</td>
<td>
<select NAME="linesPerPage">
<option>100</option>
<option>200</option>
<option>500</option>
<option>ALL</option>
</select>
</td>
</tr>
<tr>
<td colspan=2 class=color3 align=center><input TYPE="SUBMIT" VALUE="List Users" class=button></td>
</tr>
<tr>
<td colspan=2 class=color3 align=center><input TYPE="SUBMIT" VALUE="List Users" class=button></td>
</tr>
</table>
</table>
<input TYPE="HIDDEN" NAME="orderby" VALUE="userid">
<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.username">
<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.created">
</form>
<input TYPE="HIDDEN" NAME="orderby" VALUE="userid">
<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.username">
<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.created">
</form>
<!-- end of users query -->
<?
<?php
echo html_frame_end();

View File

@@ -1,37 +1,34 @@
<!-- start of Vendor query -->
<table border=1 width="100%" cellspacing=0 cellpadding=3 bordercolor=black>
<tr>
<th class="box-title">Search Vendors
</th>
</tr>
<tr>
<td class="box-body">
<form ACTION="stdquery.php" METHOD="get">
<input TYPE="HIDDEN" NAME="orderby" VALUE="vendorId">
Pattern:
<input TYPE="TEXT" NAME="searchfor"> (leave blank to match all)
<input TYPE="HIDDEN" NAME="searchwhat" VALUE="vendor.vendorName">
<input TYPE="HIDDEN" NAME="fields[]" VALUE="vendor.vendorId">
<input TYPE="HIDDEN" NAME="fields[]" VALUE="vendor.vendorName">
<input TYPE="HIDDEN" NAME="fields[]" VALUE="vendor.vendorURL">
<br><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"; ?>
<tr>
<th class="box-title">Search Vendors</th>
</tr>
<tr>
<td class="box-body">
<form ACTION="stdquery.php" METHOD="get">
<input TYPE="HIDDEN" NAME="orderby" VALUE="vendorId">
Pattern:
<input TYPE="TEXT" NAME="searchfor"> (leave blank to match all)
<input TYPE="HIDDEN" NAME="searchwhat" VALUE="vendor.vendorName">
<input TYPE="HIDDEN" NAME="fields[]" VALUE="vendor.vendorId">
<input TYPE="HIDDEN" NAME="fields[]" VALUE="vendor.vendorName">
<input TYPE="HIDDEN" NAME="fields[]" VALUE="vendor.vendorURL">
<br /><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"; ?>
<br>Entries Per Page:
<select NAME="linesPerPage">
<option>50
<option>100
<option>150
<option>200
<option>500
<option>ALL
</select>
<br> <input TYPE="SUBMIT" VALUE="List Vendors">
</form>
</td>
</tr>
<br />Entries Per Page:
<select NAME="linesPerPage">
<option>50
<option>100
<option>150
<option>200
<option>500
<option>ALL
</select>
<br /> <input TYPE="SUBMIT" VALUE="List Vendors">
</form>
</td>
</tr>
</table>
<!-- end of Vendor query -->

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
<?
<?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 {
var $link; // database connection
var $stamp;
var $userid;
var $username;
@@ -15,32 +14,32 @@ class User {
var $status;
var $perm;
/*
/**
* constructor
* opens a connection to the user database
*/
function User()
{
$this->connect();
$this->connect();
}
function connect()
{
$this->link = opendb();
$this->link = opendb();
}
/*
/**
* check if a user exists
* returns TRUE if the user exists
*/
function exists($username)
{
$result = mysql_query("SELECT * FROM user_list WHERE username = '$username'", $this->link);
if(!$result || mysql_num_rows($result) != 1)
return 0;
return 1;
$result = mysql_query("SELECT * FROM user_list WHERE username = '$username'", $this->link);
if(!$result || mysql_num_rows($result) != 1)
return 0;
return 1;
}
@@ -58,21 +57,24 @@ class User {
return $ob->userid;
}
function lookup_realname($userid)
{
$result = mysql_query("SELECT realname FROM user_list WHERE userid = $userid");
if(!$result || mysql_num_rows($result) != 1)
return null;
$ob = mysql_fetch_object($result);
return $ob->realname;
$result = mysql_query("SELECT realname FROM user_list WHERE userid = $userid");
if(!$result || mysql_num_rows($result) != 1)
return null;
$ob = mysql_fetch_object($result);
return $ob->realname;
}
function lookup_email($userid)
{
return lookupEmail($userid);
}
/*
/**
* restore a user from the database
* returns 0 on success and an error msg on failure
*/
@@ -82,7 +84,6 @@ class User {
"created, status, perm FROM user_list WHERE ".
"username = '$username' AND ".
"password = password('$password')", $this->link);
//echo "RESTORE($username, $password) result=$result rows=".mysql_num_rows($result)."<br>\n";
if(!$result)
return "Error: ".mysql_error($this->link);
@@ -92,7 +93,6 @@ class User {
list($this->stamp, $this->userid, $this->username, $this->realname,
$this->created, $status, $perm) = mysql_fetch_row($result);
//echo "<br> User: $this->userid ($this->username, $this->realname) <br>\n";
return 0;
}
@@ -105,8 +105,6 @@ class User {
if($result != null)
return $result;
//echo "<br>LOGIN($this->username)<br>\n";
/* update the 'stamp' field in the users account to reflect the last time */
/* they logged in */
$myUserId = $this->lookup_userid($username);
@@ -114,6 +112,7 @@ class User {
return 0;
}
/*
* create a new user
* 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, ".
"'$username', password('$password'), ".
"'$realname', '$email', NOW(), 0, 0)", $this->link);
//echo "error: ".mysql_error();
if(!$result)
return mysql_error($this->link);
return $this->restore($username, $password);
}
// Update User Account;
/**
* Update User Account;
*/
function update($userid = 0, $password = null, $realname = null, $email = null)
{
if (!$userid)
@@ -139,13 +140,13 @@ class User {
if (!mysql_query("UPDATE user_list SET password = password('$password') WHERE userid = $userid"))
return 0;
}
if ($realname)
{
if (!mysql_query("UPDATE user_list SET realname = '".addslashes($realname)."' WHERE userid = $userid"))
return 0;
}
if ($email)
{
if (!mysql_query("UPDATE user_list SET email = '".addslashes($email)."' WHERE userid = $userid"))
@@ -154,7 +155,7 @@ class User {
return 1;
}
/*
/**
* remove the current, or specified user from the database
* returns 0 on success and an error msg on failure
*/
@@ -191,6 +192,7 @@ class User {
return $ob->value;
}
function setpref($key, $value)
{
if(!$this->userid || !$key || !$value)
@@ -201,9 +203,9 @@ class User {
echo mysql_error();
return $result ? true : false;
}
/*
/**
* check if this user has $priv
*/
function checkpriv($priv)
@@ -217,7 +219,8 @@ class User {
return mysql_num_rows($result);
}
/*
/**
* check if this user is an maintainer of a given appId/versionId
*/
function is_maintainer($appId, $versionId)
@@ -239,6 +242,7 @@ class User {
return mysql_num_rows($result);
}
/*
* check if this user is an maintainer of a given appId/versionId
*/
@@ -254,6 +258,7 @@ class User {
return mysql_num_rows($result);
}
function addpriv($priv)
{
if(!$this->userid || !$priv)
@@ -266,6 +271,7 @@ class User {
return $result;
}
function delpriv($priv)
{
if(!$this->userid || !$priv)
@@ -275,9 +281,8 @@ class User {
return $result;
}
/*=========================================================================
*
/**
* App Owners
*
*/
@@ -292,23 +297,22 @@ class User {
function loggedin()
{
if(isset($_SESSION['current']) && $_SESSION['current']->userid)
return true;
return true;
return false;
}
function havepriv($priv)
{
if(!loggedin())
return false;
return $_SESSION['current']->checkpriv($priv);
}
function isMaintainer($appId, $versionId)
{
if(!loggedin())
@@ -317,6 +321,7 @@ function isMaintainer($appId, $versionId)
return $_SESSION['current']->is_maintainer($appId, $versionId);
}
function isSuperMaintainer($appId)
{
if(!loggedin())
@@ -325,10 +330,11 @@ function isSuperMaintainer($appId)
return $_SESSION['current']->is_super_maintainer($appId);
}
function debugging()
{
if(!loggedin())
return false;
return false;
return $_SESSION['current']->getpref("debug") == "yes";
}
@@ -343,7 +349,10 @@ function makeurl($text, $url, $pref = null)
return "<a href='$url' $extra> $text </a>\n";
}
// create a new random password
/**
* create a new random password
*/
function generate_passwd($pass_len = 10)
{
$nps = "";
@@ -356,6 +365,7 @@ function generate_passwd($pass_len = 10)
return ($nps);
}
function lookupUsername($userid)
{
$result = mysql_query("SELECT username FROM user_list WHERE userid = $userid");
@@ -365,6 +375,7 @@ function lookupUsername($userid)
return $ob->username;
}
function lookupEmail($userid)
{
$result = mysql_query("SELECT email FROM user_list WHERE userid = $userid");
@@ -374,6 +385,7 @@ function lookupEmail($userid)
return $ob->email;
}
function UserWantsEmail($userid)
{
$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);
}
/*
/**
* get the email address of people to notify for this appId and versionId
*/
function getNotifyEmailAddressList($appId, $versionId)
@@ -431,7 +444,10 @@ function getNotifyEmailAddressList($appId, $versionId)
return $retval;
}
/* Get the number of users in the database */
/**
* Get the number of users in the database
*/
function getNumberOfUsers()
{
$result = mysql_query("SELECT count(*) as num_users FROM user_list;");
@@ -439,7 +455,10 @@ function getNumberOfUsers()
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)
{
$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 = 3;
/*
/**
* count the number of votes for appId by userId
*/
function vote_count($appId, $userId = null)
{
if(!$userId)
{
if(loggedin())
$userId = $_SESSION['current']->userid;
else
return 0;
}
{
if(loggedin())
$userId = $_SESSION['current']->userid;
else
return 0;
}
$result = mysql_query("SELECT * FROM appVotes WHERE appId = $appId AND userId = $userId");
return mysql_num_rows($result);
}
/*
/**
* total votes by userId
*/
function vote_count_user_total($userId = null)
{
if(!$userId)
{
if(loggedin())
$userId = $_SESSION['current']->userid;
else
return 0;
}
{
if(loggedin())
$userId = $_SESSION['current']->userid;
else
return 0;
}
$result = mysql_query("SELECT * FROM appVotes WHERE userId = $userId");
return mysql_num_rows($result);
}
/*
* total votes for appId
*/
@@ -47,9 +49,7 @@ function vote_count_app_total($appId)
}
/*
/**
* add a vote for appId
*/
function vote_add($appId, $slot, $userId = null)
@@ -71,7 +71,7 @@ function vote_add($appId, $slot, $userId = null)
}
/*
/**
* remove vote for appId
*/
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");
}
function vote_get_user_votes($userId = null)
{
if(!$userId)
{
if(loggedin())
$userId = $_SESSION['current']->userid;
if(!$userId)
return array();
}
{
if(loggedin())
$userId = $_SESSION['current']->userid;
if(!$userId)
return array();
}
$result = mysql_query("SELECT * FROM appVotes WHERE userId = $userId");
if(!$result)
return array();
return array();
$obs = array();
while($ob = mysql_fetch_object($result))
$obs[$ob->slot] = $ob;
$obs[$ob->slot] = $ob;
return $obs;
}
function vote_menu()
{
global $appId;
@@ -119,26 +119,26 @@ function vote_menu()
$votes = vote_get_user_votes();
if($votes[1])
{
$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);
}
{
$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);
}
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])
{
$str = "<a href='appview.php?appId=".$votes[2]->appId."'> App #".$votes[2]->appId."</a>";
$m->add("<input type=radio name=slot value='2'> ".$str);
}
{
$str = "<a href='appview.php?appId=".$votes[2]->appId."'> App #".$votes[2]->appId."</a>";
$m->add("<input type=radio name=slot value='2'> ".$str);
}
else
$m->add("<input type=radio name=slot value='2'> No App Selected");
if($votes[3])
{
{
$str = "<a href='appview.php?appId=".$votes[3]->appId."'> App #".$votes[3]->appId."</a>";
$m->add("<input type=radio name=slot value='3'> ".$str);
}
}
else
$m->add("<input type=radio name=slot value='3'> No App Selected");
@@ -159,21 +159,20 @@ function vote_menu()
function dump($arr)
{
while(list($key, $val) = each($arr))
{
echo "$key => $val <br>\n";
}
{
echo "$key => $val <br>\n";
}
}
function vote_update($vars)
{
//FIXME this doesn't work since msgs only work when logged in
if(!$_SESSION['current'])
{
addmsg("You must be logged in to vote", "red");
return;
}
if(!loggedin())
{
addmsg("You must be logged in to vote", "red");
return;
}
dump($vars);
echo "<br>\n";

109
index.php
View File

@@ -1,10 +1,7 @@
<?
/*
* Application Database Index Page
*
*/
<?php
/***********************************/
/* Application Database Index Page */
/***********************************/
include("path.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">
<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>
<h1>Welcome</h1>
<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>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>
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>
<?
<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
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();
@@ -78,7 +75,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr>
<tr class=white>
<?
<?php
echo "<td><a href='".$apidb_root."appview.php?appId=134'>Acrobat Reader</a></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 class=white>
<?
<?php
echo "<td><a href='".$apidb_root."appview.php?appId=145'>WS-FTP LE</a></td>";
?>
<td>5.08</td>
@@ -100,7 +97,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr>
<tr class=white>
<?
<?php
echo "<td><a href='".$apidb_root."appview.php?appId=77'>mIRC</a></td>";
?>
<td>6.03</td>
@@ -111,7 +108,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr>
<tr class=white>
<?
<?php
echo "<td><a href='".$apidb_root."appview.php?appId=356'>Putty</a></td>";
?>
<td>0.52</td>
@@ -122,7 +119,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr>
<tr class=white>
<?
<?php
echo "<td><a href='".$apidb_root."appview.php?appId=1110'>FTP Commander</a></td>";
?>
<td>5.58</td>
@@ -133,7 +130,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr>
<tr class=white>
<?
<?php
echo "<td><a href='".$apidb_root."appview.php?appId=284'>Pegasus Mail</a></td>";
?>
<td>4.02</td>
@@ -144,7 +141,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr>
<tr class=white>
<?
<?php
echo "<td><a href='".$apidb_root."appview.php?appId=1756'>12Ghosts Zip</a></td>";
?>
<td>XP/31</td>
@@ -155,7 +152,7 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr>
<tr class=white>
<?
<?php
echo "<td><a href='".$apidb_root."appview.php?appId=1755'>WinMerge</a></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 class=white>
<?
<?php
echo "<td><a href='".$apidb_root."appview.php?appId=868'>FileZilla</a></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 class=white>
<?
echo "<td><a href='".$apidb_root."appview.php?appId=2'>WinZip</a></td>";
<?php
echo "<td><a href='".$apidb_root."appview.php?appId=2'>WinZip</a></td>";
?>
<td>8.1</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 class=white>
<?
echo "<td><a href='".$apidb_root."appview.php?appId=55'>ICQ</a></td>";
<?php
echo "<td><a href='".$apidb_root."appview.php?appId=55'>ICQ</a></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>
@@ -214,8 +211,8 @@ direct formatting related flames to <a href="mailto:dpaun@rogers.com">Dimitrie O
</tr>
<tr class=white>
<?
echo "<td><a href='".$apidb_root."appview.php?appId=5'>Winamp</a></td>";
<?php
echo "<td><a href='".$apidb_root."appview.php?appId=5'>Winamp</a></td>";
?>
<td>3.0</td>
<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 class=white>
<?
echo "<td><a href='".$apidb_root."appview.php?appId=391'>WinRAR</a></td>";
<?php
echo "<td><a href='".$apidb_root."appview.php?appId=391'>WinRAR</a></td>";
?>
<td>3.00</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 class=white>
<?
echo "<td><a href='".$apidb_root."appview.php?appId=288'>WinMX</a></td>";
<?php
echo "<td><a href='".$apidb_root."appview.php?appId=288'>WinMX</a></td>";
?>
<td>3.22</td>
<td>Take file sharing to a new level.</td>
<td>50</td>
<td>Install: Yes (Dlls installed none)<br />
Run: Yes. (listbox is not working in it (comctl32))
</td>
</td>
<td><span class=todo>[TODO]</span></td>
</tr>
<tr class=white>
<?
echo "<td><a href='".$apidb_root."appview.php?appId=1757'>SnagIt</a></td>";
<?php
echo "<td><a href='".$apidb_root."appview.php?appId=1757'>SnagIt</a></td>";
?>
<td>6.1.1</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>&nbsp;</p>
<?
<?php
apidb_footer();
?>

View File

@@ -1,4 +1,4 @@
<?
<?php
include("path.php");
require(BASE."include/"."incl.php");
@@ -27,14 +27,12 @@ else
if($confirmed)
{
global $current;
echo html_frame_start("Removing",400,"",0);
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
$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";

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
<?
<?php
include("path.php");
include(BASE."include/"."incl.php");
@@ -96,7 +96,7 @@ build_prefs_list();
echo html_table_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";

View File

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

View File

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

View File

@@ -1,9 +1,7 @@
<?
/*
* Application Database Support Page
*
*/
<?php
/*************************************/
/* Application Database Support Page */
/*************************************/
include("path.php");
require(BASE."include/"."incl.php");
@@ -11,32 +9,30 @@ require(BASE."include/"."incl.php");
apidb_header("Help and Support");
?>
<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><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>
<?php
apidb_footer();
?>

View File

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

View File

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

View File

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

View File

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