/*
* Application Database - appview.php
*
*/
include("path.php");
require(BASE."include/"."incl.php");
require(BASE."include/"."application.php");
require(BASE."include/"."comments.php");
require(BASE."include/"."appdb.php");
require(BASE."include/"."vote.php");
require(BASE."include/"."rating.php");
require(BASE."include/"."category.php");
require(BASE."include/"."maintainer.php");
global $apidb_root;
// NOTE: app Owners will see this menu too, make sure we don't show admin-only options
function admin_menu()
{
global $appId;
global $versionId;
global $apidb_root;
$m = new htmlmenu("Admin");
if($versionId)
{
$m->add("Add Note", $apidb_root."admin/addAppNote.php?appId=$appId&versionId=$versionId");
$m->addmisc(" ");
$m->add("Edit Version", $apidb_root."admin/editAppVersion.php?appId=$appId&versionId=$versionId");
$url = $apidb_root."admin/deleteAny.php?what=appVersion&versionId=$versionId&confirmed=yes";
$m->add("Delete Version", "javascript:deleteURL(\"Are you sure?\", \"".$url."\")");
}
else
{
$m->add("Add Version", $apidb_root."admin/addAppVersion.php?appId=$appId");
$m->addmisc(" ");
$m->add("Edit App", $apidb_root."admin/editAppFamily.php?appId=$appId");
// global admin options
if(havepriv("admin"))
{
$url = $apidb_root."admin/deleteAny.php?what=appFamily&appId=$appId&confirmed=yes";
$m->add("Delete App", "javascript:deleteURL(\"Are you sure?\", \"".$url."\")");
$m->addmisc(" ");
$m->add("Edit Owners", $apidb_root."admin/editAppOwners.php?appId=$appId");
$m->add("Edit Bundle", $apidb_root."admin/editBundle.php?bundleId=$appId");
}
}
$m->done();
}
function get_screenshot_img($appId, $versionId)
{
global $apidb_root;
if(!$versionId)
$versionId = 0;
$result = mysql_query("SELECT * FROM appData WHERE appId = $appId AND versionId = $versionId AND type = 'image'");
if(!$result || !mysql_num_rows($result))
{
$imgFile = "
";
}
else
{
$ob = mysql_fetch_object($result);
$imgFile = "";
}
$img = html_frame_start("",'128','',2);
$img .= "$imgFile";
$img .= html_frame_end()."
";
return $img;
}
function display_catpath($catId)
{
$cat = new Category($catId);
$catFullPath = make_cat_path($cat->getCategoryPath());
echo html_frame_start("",'98%','',2);
echo "
Category: ". $catFullPath ."
\n";
echo html_frame_end();
}
/* display the SUB apps that belong to this app */
function display_bundle($appId)
{
$result = mysql_query("SELECT appFamily.appId, appName, description FROM appBundle, appFamily ".
"WHERE bundleId = $appId AND appBundle.appId = appFamily.appId");
if(!$result || mysql_num_rows($result) == 0)
{
// do nothing
return;
}
echo html_frame_start("","98%","",0);
echo "
| Application Name | \n"; echo "Description | \n"; echo "
| ".stripslashes($ob->appName)." | \n"; echo "$desc | \n"; echo "
| Version | \n"; echo "Description | \n"; echo "Rating With Windows | \n"; echo "Rating Without Windows | \n"; echo "Comments | \n"; echo "
| ".$ver->versionName." | \n"; echo "$desc | \n"; echo "$r_win | \n"; echo "$r_fake | \n"; echo "$r_count | \n"; echo "
| Name | ".stripslashes($data->appName)." | \n"; echo "
| App Id | ".$data->appId." | \n"; echo "
| Vendor | ". " ".stripslashes($vendor->vendorName)." \n"; echo " |
| BUGS | ". " Check for bugs in bugzilla \n"; echo " |
| URL | ".$appLinkURL." |
| Links | \n";
while($ob = mysql_fetch_object($result))
{
echo " ".substr(stripslashes($ob->description),0,30)." \n"; } echo " |
| Owner | \n";
while($ob = mysql_fetch_object($result))
{
$inResult = mysql_query("SELECT username,email FROM user_list WHERE userid = $ob->ownerId");
if ($inResult && mysql_num_rows($inResult) > 0)
{
$foo = mysql_fetch_object($inResult);
echo " ".substr(stripslashes($foo->username),0,30)." \n"; } } echo " |
| Description \n"; echo add_br(stripslashes($data->description)); echo " |
| Name | ".stripslashes($data->appName)." | \n"; echo "||||
| Ver Id | $ver->versionId | \n"; echo "||||
| Version | ".stripslashes($ver->versionName)." | ||||
| URL | ".stripslashes($appLinkURL)." | ||||
| Rating | $r_win \n";
echo " $r_fake | ||||
| $img | |||||
Maintainers of this application:\n";
echo "
| |||||
| Description \n"; echo add_br(stripslashes($ver->description)); echo " |