diff --git a/account.php b/account.php
index a7e4006..06bd898 100644
--- a/account.php
+++ b/account.php
@@ -1,131 +1,140 @@
-
-
-/*
- * Account Login / Logout Handler for AppDB
- *
- */
+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'] = "";
+ }
}
-?>
\ No newline at end of file
+?>
diff --git a/addcomment.php b/addcomment.php
index 12f6db9..fdb04a1 100644
--- a/addcomment.php
+++ b/addcomment.php
@@ -1,4 +1,4 @@
-
+
diff --git a/appbrowse.php b/appbrowse.php
index edd3c04..bb1797c 100644
--- a/appbrowse.php
+++ b/appbrowse.php
@@ -1,7 +1,7 @@
-
-
+
diff --git a/deletecomment.php b/deletecomment.php
index 07af704..68a335d 100644
--- a/deletecomment.php
+++ b/deletecomment.php
@@ -1,4 +1,4 @@
-
+
-
+
User Name
- =$ext_username?>
+
Password
@@ -91,15 +91,16 @@ if($HTTP_POST_VARS)
Real Name
-
+
Email Address
-
+
Administrator
- ">
+ ">
+
diff --git a/help/index.php b/help/index.php
index 37a78a2..efd573b 100644
--- a/help/index.php
+++ b/help/index.php
@@ -1,9 +1,7 @@
-
-
-/*
- * Application Database Documentation Center
- *
- */
+
diff --git a/include/appdb.php b/include/appdb.php
index a85ffe0..08c50c2 100644
--- a/include/appdb.php
+++ b/include/appdb.php
@@ -1,4 +1,4 @@
-
+ */
+/* last modified: 2001.10.08 */
+/**********************************************/
-/*
- * Banner Ad Library
- * by Jeremy Newman
- * 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".''."\n";
- $banner .= ''."\n";
+ // opening html
+ $banner = "";
+ $banner .= "\n\n".''."\n";
+ $banner .= '
'."\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 .= '
';
- $banner .= ' ';
- $banner .= ' '."\n";
-
- // closing html
- $banner .= '
'."\n";
- $banner .= ''."\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 .= '
';
+ $banner .= ' ';
+ $banner .= ' '."\n";
+
+ // closing html
+ $banner .= '
'."\n";
+ $banner .= ''."\n\n";
+
+ return $banner;
}
diff --git a/include/category.php b/include/category.php
index eae9471..c932bd4 100644
--- a/include/category.php
+++ b/include/category.php
@@ -1,6 +1,8 @@
-
-
+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 ""; // shouldn't normally happen
+ return ""; // 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 .= " > "; }
- $str .= html_ahref($catname,"appbrowse.php?catId=$id");
- $catCount++;
- }
+ if ($catCount > 0) $str .= " > ";
+ $str .= html_ahref($catname,"appbrowse.php?catId=$id");
+ $catCount++;
+ }
- if($appId)
- $str .= " > ".html_ahref(appIdToName($appId),"appview.php?appId=$appId");
+ if($_REQUEST['appId'])
+ $str .= " > ".html_ahref(appIdToName($_REQUEST['appId']),"appview.php?appId=".$_REQUEST['appId']);
- if($versionId)
- $str .= " > ".html_ahref(versionIdToName($versionId),"appview.php?appId=$appId&versionId=$versionId");
+ if($_REQUEST['versionId'])
+ $str .= " > ".html_ahref(versionIdToName($_REQUEST['versionId']),"appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']);
return $str;
}
diff --git a/include/comments.php b/include/comments.php
index 2253439..e566b6c 100644
--- a/include/comments.php
+++ b/include/comments.php
@@ -1,10 +1,8 @@
-
+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 "\n";
- do_display_comments_nested($result);
- echo " \n";
- }
+ echo "\n";
+ do_display_comments_nested($result);
+ echo " \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 "\n";
+ echo "\n";
while ($ob = mysql_fetch_object($handle))
{
if ($is_main)
{
view_app_comment($ob);
- }
- else
+ } else
{
- echo ' '.
- $ob->subject.' by '.forum_lookup_user($ob->userid).' on '.$ob->time.' '."\n";
+ echo ' '.
+ $ob->subject.' by '.forum_lookup_user($ob->userid).' on '.$ob->time.' '."\n";
}
$result = grab_comments($ob->appId, $ob->versionId, $ob->commentId);
@@ -188,6 +173,7 @@ function do_display_comments_threaded($handle, $is_main)
echo " \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 ' ',"\n";
+ $_SESSION['current']->setpref("comments:mode", $cmode);
+
+ $sel[$_SESSION['current']->getpref("comments:mode")] = 'selected';
+ echo ' ',"\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 ' ',"\n";
-
}
diff --git a/include/config.php.sample b/include/config.php.sample
index b98104a..4b00f97 100644
--- a/include/config.php.sample
+++ b/include/config.php.sample
@@ -1,5 +1,7 @@
-
- /* config file for apidb */
+
-