- improve application and related classes
- use application/version/vendor class in scripts - don't use a full table for queued appication but only one field in the application and version tables - simplify the code in many places
This commit is contained in:
@@ -9,6 +9,14 @@ require(BASE."include/tableve.php");
|
||||
require(BASE."include/application.php");
|
||||
require(BASE."include/mail.php");
|
||||
|
||||
|
||||
function get_vendor_from_keywords($sKeywords)
|
||||
{
|
||||
$aKeywords = explode(" *** ",$keywords);
|
||||
$iLastElt = (sizeOf($aKeywords)-1);
|
||||
return($aKeywords[$iLastElt]);
|
||||
}
|
||||
|
||||
//deny access if not logged in
|
||||
if(!$_SESSION['current']->hasPriv("admin"))
|
||||
{
|
||||
@@ -18,67 +26,70 @@ if(!$_SESSION['current']->hasPriv("admin"))
|
||||
|
||||
if ($_REQUEST['sub'])
|
||||
{
|
||||
if(!is_numeric($_REQUEST['queueId']))
|
||||
if(is_numeric($_REQUEST['appId']))
|
||||
{
|
||||
errorpage("Wrong ID");
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($_REQUEST['queueId'])
|
||||
$oApp = new Application($_REQUEST['appId']);
|
||||
} elseif(is_numeric($_REQUEST['versionId']))
|
||||
{
|
||||
//get data
|
||||
$query = "SELECT * from appQueue where queueId = ".$_REQUEST['queueId'].";";
|
||||
$result = query_appdb($query);
|
||||
$ob = mysql_fetch_object($result);
|
||||
mysql_free_result($result);
|
||||
}
|
||||
else
|
||||
$oVersion = new Version($_REQUEST['versionId']);
|
||||
} else
|
||||
{
|
||||
//error no Id!
|
||||
addmsg("Application Not Found!", "red");
|
||||
redirect(apidb_fullurl("admin/adminAppQueue.php"));
|
||||
exit;
|
||||
}
|
||||
|
||||
//process according to sub flag
|
||||
if ($_REQUEST['sub'] == 'view' && $_REQUEST['queueId'])
|
||||
if ($_REQUEST['sub'] == 'view')
|
||||
{
|
||||
$x = new TableVE("view");
|
||||
apidb_header("Admin App Queue");
|
||||
?>
|
||||
<link rel="stylesheet" href="./application.css" type="text/css">
|
||||
<!-- load HTMLArea -->
|
||||
<script type="text/javascript" src="../htmlarea/htmlarea_loader.js"></script>
|
||||
<?php
|
||||
echo '<form name="qform" action="adminAppQueue.php" method="post" enctype="multipart/form-data">',"\n";
|
||||
echo '<input type="hidden" name="sub" value="add">',"\n";
|
||||
|
||||
echo '<input type=hidden name="sub" value="add">',"\n";
|
||||
echo '<input type=hidden name="queueId" value="'.$_REQUEST['queueId'].'">',"\n";
|
||||
|
||||
If ($ob->queueCatId == -1) //app version
|
||||
if ($oVersion) //app version
|
||||
{
|
||||
//help
|
||||
echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
|
||||
echo "<p>This is the full view of the application waiting to be approved. \n";
|
||||
echo "If you approve this application,\n";
|
||||
echo "an email will be sent to the author of the submission.<p>\n";
|
||||
echo "<p>This is the full view of the application version waiting to be approved. \n";
|
||||
echo "If you approve this application version an email will be sent to the author of the submission.<p>\n";
|
||||
|
||||
echo "<b>App Version</b> This type of application will be nested under the selected application parent.\n";
|
||||
echo "<p>Click delete to remove the selected item from the queue an email will automatically be sent to the\n";
|
||||
echo "submitter to let him know the item was deleted.</p>\n\n";
|
||||
echo "</td></tr></table></div>\n\n";
|
||||
|
||||
echo '<input type=hidden name=type value="ver">',"\n";
|
||||
|
||||
echo html_frame_start("New Application Form",400,"",0);
|
||||
echo html_frame_start("New Version Form",400,"",0);
|
||||
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
|
||||
|
||||
//app parent
|
||||
echo '<tr valign=top><td class=color0><b>App Parent</b></td><td>',"\n";
|
||||
$x->make_option_list("appParent",stripslashes($ob->queueName),"appFamily","appId","appName");
|
||||
echo '<tr valign=top><td class=color0><b>Application</b></td><td>',"\n";
|
||||
$x->make_option_list("appId",$oVersion->sName,"appFamily","appId","appName");
|
||||
echo '</td></tr>',"\n";
|
||||
|
||||
//version
|
||||
echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n";
|
||||
echo '<td><input type=text name="queueVersion" value="'.stripslashes($ob->queueVersion).'" size=20></td></tr>',"\n";
|
||||
echo '<tr valign=top><td class="color0"><b>Version name</b></td>',"\n";
|
||||
echo '<td><input type=text name="versionName" value="'.$oVersion->sName.'" size="20"></td></tr>',"\n";
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
echo '<tr valign=top><td class=color0><b>Description</b></td>',"\n";
|
||||
echo '<td><p style="width:700px"><textarea cols="80" rows="20" id="editor" name="versionDescription">'.$oVersion->sDescription.'</textarea></p></td></tr>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class="color0"><b>email Text</b></td>',"\n";
|
||||
echo '<td><textarea name="emailtext" rows="10" cols="35"></textarea></td></tr>',"\n";
|
||||
|
||||
|
||||
echo '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n";
|
||||
echo '<input type="hidden" name="versionId" value="'.$oVersion->iVersionId.'" />';
|
||||
echo '<input type="submit" value=" Submit App Into Database " class=button> ',"\n";
|
||||
echo '<input name="sub" type=submit value="Delete" class=button> </td></tr>',"\n";
|
||||
echo '</table>',"\n";
|
||||
} else // application
|
||||
{
|
||||
|
||||
//help
|
||||
@@ -103,345 +114,237 @@ if ($_REQUEST['sub'])
|
||||
echo html_frame_start("New Application Form",400,"",0);
|
||||
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
|
||||
|
||||
//type
|
||||
echo '<tr valign=top><td class=color0><b>Type</b></td><td>',"\n";
|
||||
echo '<select name=type><option value=app>Application</option><option value=ver>Version</option></select>',"\n";
|
||||
echo '</td></tr>',"\n";
|
||||
|
||||
//category
|
||||
|
||||
$query = "select * from appCategory where catId = '$ob->queueCatId';";
|
||||
$result = query_appdb($query);
|
||||
if($result)
|
||||
{
|
||||
$ob2 = mysql_fetch_object($result);
|
||||
|
||||
echo '<tr valign=top><td class=color0><b>Category</b></td><td>',"\n";
|
||||
$x->make_option_list("cat",stripslashes($ob2->catId),"appCategory","catId","catName");
|
||||
echo '</td></tr>',"\n";
|
||||
} else
|
||||
{
|
||||
echo '<tr valign=top><td class=color0><b>Category</b></td><td>',"\n";
|
||||
$x->make_option_list("cat","","appCategory","catId","catName");
|
||||
echo '</td></tr>',"\n";
|
||||
}
|
||||
//app parent
|
||||
echo '<tr valign=top><td class=color0><b>App Parent</b></td><td>',"\n";
|
||||
$x->make_option_list("appParent","","appFamily","appId","appName");
|
||||
echo '<tr valign=top><td class="color0>"<b>Category</b></td><td>',"\n";
|
||||
$x->make_option_list("catId",$oApp->iCatId,"appCategory","catId","catName");
|
||||
echo '</td></tr>',"\n";
|
||||
|
||||
//name
|
||||
echo '<tr valign=top><td class=color0><b>App Name</b></td>',"\n";
|
||||
echo '<td><input type=text name="queueName" value="'.stripslashes($ob->queueName).'" size=20></td></tr>',"\n";
|
||||
echo '<tr valign=top><td class="color0"><b>App Name</b></td>',"\n";
|
||||
echo '<td><input type="text" name="appName" value="'.$oApp->sName.'" size=20></td></tr>',"\n";
|
||||
|
||||
//version
|
||||
echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n";
|
||||
echo '<td><input type=text name="queueVersion" value="'.stripslashes($ob->queueVersion).'" size=20></td>',"\n";
|
||||
echo '</tr>',"\n";
|
||||
/*
|
||||
* vendor/alt vendor fields
|
||||
* if user selected a predefined vendorId:
|
||||
*/
|
||||
$iVendorId = $oApp->iVendorId;
|
||||
|
||||
//vendor/alt vendor fields
|
||||
// try for an exact match
|
||||
// Use the first match if we found one and clear out the vendor field,
|
||||
// otherwise don't pick a vendor
|
||||
$query = "select * from vendor where vendorname = '$ob->queueVendor';";
|
||||
$result = query_appdb($query);
|
||||
$checkvendor = 0;
|
||||
if($result)
|
||||
/*
|
||||
* If not, try for an exact match
|
||||
* Use the first match if we found one and clear out the vendor field,
|
||||
* otherwise don't pick a vendor
|
||||
* N.B. The vendor string is the last word of the keywords field !
|
||||
*/
|
||||
if(!$iVendorId)
|
||||
{
|
||||
$ob2 = mysql_fetch_object($result);
|
||||
$checkvendor = $ob2->vendorId;
|
||||
}
|
||||
if(!$checkvendor)
|
||||
$sVendor = get_vendor_from_keywords($oApp->sKeywords);
|
||||
$sQuery = "SELECT vendorId FROM vendor WHERE vendorname = '".$sVendor."';";
|
||||
$hResult = query_appdb($sQuery);
|
||||
if($hResult)
|
||||
{
|
||||
// try for a partial match
|
||||
$query = "select * from vendor where vendorname like '%$ob->queueVendor%';";
|
||||
$result = query_appdb($query);
|
||||
if($result)
|
||||
{
|
||||
$ob2 = mysql_fetch_object($result);
|
||||
$checkvendor = $ob2->vendorId;
|
||||
$oRow = mysql_fetch_object($hResult);
|
||||
$iVendorId = $oRow->vendorId;
|
||||
}
|
||||
}
|
||||
if($checkvendor)
|
||||
|
||||
/*
|
||||
* try for a partial match
|
||||
*/
|
||||
if(!$iVendorId)
|
||||
{
|
||||
$ob->queueVendor = '';
|
||||
$sQuery = "select * from vendor where vendorname like '%$ob->queueVendor%';";
|
||||
$hResult = query_appdb($sQuery);
|
||||
if($hResult)
|
||||
{
|
||||
$oRow = mysql_fetch_object($hResult);
|
||||
$iVendorId = $oRow->vendorId;
|
||||
}
|
||||
}
|
||||
|
||||
//vendor field
|
||||
echo '<tr valign=top><td class=color0><b>App Vendor</b></td>',"\n";
|
||||
echo '<td><input type=text name="queueVendor" value="'.stripslashes($ob->queueVendor).'" size=20></td>',"\n";
|
||||
if($iVendorId)
|
||||
$sVendor = "";
|
||||
echo '<tr valign=top><td class="color0"><b>App Vendor</b></td>',"\n";
|
||||
echo '<td><input type=text name="sVendor" value="'.$sVendor.'" size="20"></td>',"\n";
|
||||
echo '</tr>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class=color0> </td><td>',"\n";
|
||||
$x->make_option_list("altvendor", $checkvendor ,"vendor","vendorId","vendorName");
|
||||
echo '<tr valign=top><td class="color0"> </td><td>',"\n";
|
||||
$x->make_option_list("vendorId", $iVendorId ,"vendor","vendorId","vendorName");
|
||||
echo '</td></tr>',"\n";
|
||||
} else
|
||||
{
|
||||
//vendor field
|
||||
echo '<tr valign=top><td class=color0><b>App Vendor</b></td>',"\n";
|
||||
echo '<td><input type=text name="queueVendor" value="'.stripslashes($ob->queueVendor).'" size=20></td>',"\n";
|
||||
echo '</tr>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class=color0> </td><td>',"\n";
|
||||
$x->make_option_list("altvendor","","vendor","vendorId","vendorName");
|
||||
echo '</td></tr>',"\n";
|
||||
}
|
||||
}
|
||||
|
||||
//url
|
||||
// FIXME: don't display this field for appversion
|
||||
echo '<tr valign=top><td class=color0><b>App URL</b></td>',"\n";
|
||||
echo '<td><input type=text name="queueURL" value="'.stripslashes($ob->queueURL).'" size=20></td></tr>',"\n";
|
||||
echo '<tr valign=top><td class="color0"><b>App URL</b></td>',"\n";
|
||||
echo '<td><input type=text name="webpage" value="'.$oApp->sWebpage.'" size="20"></td></tr>',"\n";
|
||||
|
||||
//desc
|
||||
?>
|
||||
<link rel="stylesheet" href="./application.css" type="text/css">
|
||||
<!-- load HTMLArea -->
|
||||
<script type="text/javascript" src="../htmlarea/htmlarea_loader.js"></script>
|
||||
<?php
|
||||
echo '<tr valign=top><td class=color0><b>App Desc</b></td>',"\n";
|
||||
echo '<td><p style="width:700px"><textarea cols="80" rows="20" id="editor" name="queueDesc">'.stripslashes($ob->queueDesc).'</textarea></p></td></tr>',"\n";
|
||||
|
||||
//email message text
|
||||
if ($ob->queueEmail)
|
||||
{
|
||||
echo '<tr valign=top><td class=color0><b>email Text</b></td>',"\n";
|
||||
echo '<tr valign=top><td class=color0><b>Description</b></td>',"\n";
|
||||
echo '<td><p style="width:700px"><textarea cols="80" rows="20" id="editor" name="description">'.$oApp->sDescription.'</textarea></p></td></tr>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class="color0"><b>email Text</b></td>',"\n";
|
||||
echo '<td><textarea name="emailtext" rows=10 cols=35></textarea></td></tr>',"\n";
|
||||
}
|
||||
|
||||
echo '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n";
|
||||
echo '<input type="hidden" name="appId" value="'.$oApp->iAppId.'" />';
|
||||
echo '<input type=submit value=" Submit App Into Database " class=button> ',"\n";
|
||||
echo '<input name="sub" type=submit value="Delete" class=button> </td></tr>',"\n";
|
||||
echo '<input name="sub" type="submit" value="Delete" class="button" /></td></tr>',"\n";
|
||||
echo '</table>',"\n";
|
||||
}
|
||||
|
||||
echo html_frame_end(" ");
|
||||
echo html_back_link(1,'adminAppQueue.php');
|
||||
}
|
||||
else if ($_REQUEST['sub'] == 'add' && $_REQUEST['queueId'])
|
||||
else if ($_REQUEST['sub'] == 'add')
|
||||
{
|
||||
//add item to main db
|
||||
$statusMessage = "";
|
||||
$goodtogo = 0;
|
||||
if ($_REQUEST['type'] == 'app')
|
||||
{
|
||||
//process as application family
|
||||
if ($_REQUEST['altvendor'] == 0 && $_REQUEST['queueVendor'])
|
||||
if (is_numeric($_REQUEST['appId'])) // application
|
||||
{
|
||||
// add new vendor
|
||||
$aInsert = compile_insert_string( array('vendorName' => $_REQUEST['queueVendor'],
|
||||
'vendorURL' => $_REQUEST['queueURL']));
|
||||
|
||||
query_appdb("INSERT INTO `vendor` ({$aInsert['FIELDS']}) VALUES ({$aInsert['VALUES']})");
|
||||
$_REQUEST['altvendor'] = mysql_insert_id();
|
||||
}
|
||||
$aInsert = compile_insert_string( array('AppName' => $_REQUEST['queueName'],
|
||||
'vendorId' => $_REQUEST['altvendor'],
|
||||
'description' => $_REQUEST['queueDesc'],
|
||||
'webPage' => $_REQUEST['queueURL'],
|
||||
'keywords' => "",
|
||||
'catId' => $_REQUEST['cat']));
|
||||
|
||||
if (query_appdb("INSERT INTO `appFamily` ({$aInsert['FIELDS']}) VALUES ({$aInsert['VALUES']})"))
|
||||
if($sVendor)
|
||||
{
|
||||
//get the id of the app just added
|
||||
$_REQUEST['appParent'] = mysql_insert_id();
|
||||
//delete queue item
|
||||
query_appdb("DELETE from appQueue where queueId = ".$_REQUEST['queueId'].";");
|
||||
|
||||
//set ver if not set
|
||||
if (!$_REQUEST['queueVersion'])
|
||||
$_REQUEST['queueVersion'] = '1.0';
|
||||
if (!$_REQUEST['queueDesc'])
|
||||
$_REQUEST['queueDesc'] = 'released version';
|
||||
|
||||
//Now add a version
|
||||
$aInsert = compile_insert_string( array('appId' => $_REQUEST['appParent'],
|
||||
'versionName' => $_REQUEST['queueVersion'],
|
||||
'description' => $_REQUEST['queueDesc'],
|
||||
'maintainer_rating' => "",
|
||||
'maintainer_release' => ""));
|
||||
if (query_appdb("INSERT INTO `appVersion` ({$aInsert['FIELDS']}) VALUES ({$aInsert['VALUES']})"))
|
||||
{
|
||||
//successful
|
||||
$_REQUEST['appVersion'] = mysql_insert_id();
|
||||
addmsg("The application ".$_REQUEST['queueName']." was successfully added into the database", "green");
|
||||
$goodtogo = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//error
|
||||
$statusMessage = "<p><b>Note:</b> The application family was successfully added.</p>\n";
|
||||
addmsg($statusMessage, "red");
|
||||
$oVendor = new Vendor();
|
||||
$oVendor->create($sVendor);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if ($_REQUEST['type'] == 'ver')
|
||||
$oApp = new Application($_REQUEST['appId']);
|
||||
$oApp->update($_REQUEST['appName'], $_REQUEST['appDescription'], $_REQUEST['keywords'], $_REQUEST['webPage'], $_REQUEST['vendorId'], $_REQUEST['catId']);
|
||||
$oApp->unQueue();
|
||||
} else if(is_numeric($_REQUEST['versionId'])) // version
|
||||
{
|
||||
//process as application version
|
||||
if ($_REQUEST['appParent'])
|
||||
{
|
||||
$aInsert = compile_insert_string( array('appId' => $_REQUEST['appParent'],
|
||||
'versionName' => $_REQUEST['queueVersion'],
|
||||
'description' => $_REQUEST['queueDesc'],
|
||||
'maintainer_rating' => "",
|
||||
'maintainer_release' => ""));
|
||||
|
||||
if (query_appdb("INSERT INTO `appVersion` ({$aInsert['FIELDS']}) VALUES ({$aInsert['VALUES']})"))
|
||||
{
|
||||
//successful
|
||||
$_REQUEST['appVersion'] = mysql_insert_id();
|
||||
$statusMessage = "<p>The application ".$_REQUEST['queueName']." was successfully added into the database</p>\n";
|
||||
addmsg($statusMessage,"Green");
|
||||
query_appdb("DELETE from appQueue where queueId = ".$_REQUEST['queueId'].";");
|
||||
$goodtogo = 1;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addmsg("You did not pick an application Parent!",red);
|
||||
redirect(apidb_fullurl("admin/adminAppQueue.php?cat=view&queueId=".$_REQUEST['queueId']));
|
||||
exit;
|
||||
|
||||
$oVersion = new Version($_REQUEST['versionId']);
|
||||
$oVersion->update($_REQUEST['versionName'], $_REQUEST['versionDescription']);
|
||||
$oVersion->unQueue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Send Status Email
|
||||
if($_REQUEST['type'] == 'ver')
|
||||
{
|
||||
$sFullAppName = lookup_app_name($_REQUEST['appParent'])." ".lookup_version_name($_REQUEST['appVersion']);
|
||||
$sUrl = APPDB_ROOT."appview.php?versionId=".$_REQUEST['appVersion'];
|
||||
} else
|
||||
{
|
||||
$sFullAppName = lookup_app_name($_REQUEST['appParent']);
|
||||
$sUrl = APPDB_ROOT."appview.php?appId=".$_REQUEST['appParent'];
|
||||
}
|
||||
$sSubject = $sFullAppName." has been added into the AppDB";
|
||||
$sMsg = $sUrl."\n";
|
||||
if ($ob->queueEmail && $goodtogo)
|
||||
{
|
||||
$sMsg .= $emailtext;
|
||||
mail_appdb($ob->queueEmail, $sSubject ,$sMsg);
|
||||
}
|
||||
if ($goodtogo)
|
||||
{
|
||||
$sEmail = get_notify_email_address_list($_REQUEST['appParent'], $_REQUEST['appVersion']);
|
||||
if($sEmail)
|
||||
{
|
||||
mail_appdb($sEmail, $sSubject ,$sMsg);
|
||||
}
|
||||
}
|
||||
//done
|
||||
addmsg("<a href=".apidb_fullurl("appview.php")."?appId=".$_REQUEST['appParent'].">View App</a>", "green");
|
||||
redirect(apidb_fullurl("admin/adminAppQueue.php"));
|
||||
exit;
|
||||
}
|
||||
else if ($_REQUEST['sub'] == 'Delete' && $_REQUEST['queueId'])
|
||||
else if ($_REQUEST['sub'] == 'Delete')
|
||||
{
|
||||
//delete main item
|
||||
$query = "DELETE from appQueue where queueId = ".$_REQUEST['queueId'].";";
|
||||
$result = query_appdb($query, "unable to delete selected application!");
|
||||
if(!$result)
|
||||
if (is_numeric($_REQUEST['appId'])) // application
|
||||
{
|
||||
redirect(apidb_fullurl("admin/adminAppQueue.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
|
||||
}
|
||||
else
|
||||
{
|
||||
//Send Status Email
|
||||
if($_REQUEST['type'] == 'ver')
|
||||
{
|
||||
$sFullAppName = lookup_app_name($_REQUEST['appParent'])." ".lookup_version_name($_REQUEST['appVersion']);
|
||||
} else
|
||||
{
|
||||
$sFullAppName = lookup_app_name($_REQUEST['appParent']);
|
||||
}
|
||||
$sSubject = $sFullAppName." has not been added into the AppDB";
|
||||
if ($ob->queueEmail)
|
||||
{
|
||||
$sMsg = $emailtext;
|
||||
mail_appdb($ob->queueEmail, $sSubject ,$sMsg);
|
||||
}
|
||||
//success
|
||||
addmsg("Application was successfully deleted from the Queue.", "green");
|
||||
redirect(apidb_fullurl("admin/adminAppQueue.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
|
||||
$oApp = new Application($_REQUEST['appId']);
|
||||
$oApp->delete();
|
||||
} else if(is_numeric($_REQUEST['versionId'])) // version
|
||||
{
|
||||
$oVersion = new Version($_REQUEST['versionId']);
|
||||
$oVersion->delete();
|
||||
}
|
||||
|
||||
redirect(apidb_fullurl("admin/adminAppQueue.php"));
|
||||
}
|
||||
else
|
||||
{
|
||||
//error no sub!
|
||||
addmsg("Internal Routine Not Found!!", "red");
|
||||
redirect(apidb_fullurl("admin/adminAppQueue.php"));
|
||||
|
||||
}
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
apidb_header("Admin App Queue");
|
||||
echo '<form name="qform" action="admin/adminAppQueue.php" method="post" enctype="multipart/form-data">',"\n";
|
||||
// get queued apps
|
||||
$sQuery = "SELECT appId FROM appFamily WHERE queued = 'true'";
|
||||
$hResult = query_appdb($sQuery);
|
||||
|
||||
//get available apps
|
||||
$query = "SELECT queueId, queueName, queueVendor,".
|
||||
"queueVersion, queueEmail, queueCatId,".
|
||||
"UNIX_TIMESTAMP(submitTime) as submitTime ".
|
||||
"from appQueue;";
|
||||
$result = query_appdb($query);
|
||||
|
||||
if(!$result || !mysql_num_rows($result))
|
||||
if(!$hResult || !mysql_num_rows($hResult))
|
||||
{
|
||||
//no apps in queue
|
||||
echo html_frame_start("","90%");
|
||||
echo html_frame_start("Application Queue","90%");
|
||||
echo '<p><b>The Application Queue is empty.</b></p>',"\n";
|
||||
echo '<p>There is nothing for you to do. Check back later.</p>',"\n";
|
||||
echo html_frame_end(" ");
|
||||
}
|
||||
else
|
||||
{
|
||||
//help
|
||||
echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
|
||||
echo "<p>This is the list of applications waiting for your approval, or to be annihilated from existence.</p>\n";
|
||||
echo "<p>This is the list of applications waiting for your approval, or to be rejected.</p>\n";
|
||||
echo "<p>To view a submission, click on its name. From that page you can edit, delete or approve it into \n";
|
||||
echo "the AppDB .<br>\n";
|
||||
echo "</td></tr></table></div>\n\n";
|
||||
|
||||
//show applist
|
||||
echo html_frame_start("","90%","",0);
|
||||
echo "<table width='100%' border=0 cellpadding=3 cellspacing=0>\n\n";
|
||||
|
||||
echo "<tr class=color4>\n";
|
||||
echo " <td><font color=white>Submission Date</font></td>\n";
|
||||
echo " <td><font color=white>Application Name</font></td>\n";
|
||||
echo " <td><font color=white>Version</font></td>\n";
|
||||
echo " <td><font color=white>Vendor</font></td>\n";
|
||||
echo " <td><font color=white>Submitter Email</font></td>\n";
|
||||
echo " <td> </td>\n";
|
||||
echo "</tr>\n\n";
|
||||
echo "<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\">
|
||||
<tr class=color4>
|
||||
<td>Submission Date</td>
|
||||
<td>Vendor</td>
|
||||
<td>Application Name</td>
|
||||
<td>Submitter</td>
|
||||
</tr>";
|
||||
|
||||
$c = 1;
|
||||
while($ob = mysql_fetch_object($result))
|
||||
while($oRow = mysql_fetch_object($hResult))
|
||||
{
|
||||
$oApp = new Application($oRow->appId);
|
||||
$oSubmitter = new User($oApp->iSubmitterId);
|
||||
if($oApp->iVendorId)
|
||||
{
|
||||
$oVendor = new Vendor($oApp->iVendorId);
|
||||
$sVendor = $oVendor->sName;
|
||||
} else
|
||||
{
|
||||
$sVendor = get_vendor_from_keywords($oApp->sKeywords);
|
||||
}
|
||||
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
|
||||
echo "<tr class=$bgcolor>\n";
|
||||
echo " <td>".date("Y-n-t h:i:sa", $ob->submitTime)." </td>\n";
|
||||
if ($ob->queueCatId == -1)
|
||||
{
|
||||
$query2 = "select * from appFamily where appId = '$ob->queueName';";
|
||||
$result2 = query_appdb($query2);
|
||||
if($result2)
|
||||
{
|
||||
$ob2 = mysql_fetch_object($result2);
|
||||
echo " <td><a href='adminAppQueue.php?sub=view&queueId=$ob->queueId'>$ob2->appName</a></td>\n";
|
||||
} else
|
||||
{
|
||||
echo " <td><a href='adminAppQueue.php?sub=view&queueId=$ob->queueId'>App not found</a></td>\n";
|
||||
echo "<tr class=\"$bgcolor\">\n";
|
||||
echo " <td>".date("Y-n-t h:i:sa", $oApp->sSubmitTime)." </td>\n";
|
||||
echo " <td>".$sVendor." </td>\n";
|
||||
echo " <td><a href=\"adminAppQueue.php?sub=view&appId=".$oApp->iAppId."\">".$oApp->sName."</a></td>\n";
|
||||
echo " <td><a href=\"mailto:".$oSubmitter->sEmail."\">".$oSubmitter->sRealname."</a></td>\n";
|
||||
echo "</tr>\n\n";
|
||||
$c++;
|
||||
}
|
||||
} else
|
||||
{
|
||||
echo " <td><a href='adminAppQueue.php?sub=view&queueId=$ob->queueId'>$ob->queueName</a></td>\n";
|
||||
echo "</table>\n\n";
|
||||
echo html_frame_end(" ");
|
||||
}
|
||||
echo " <td>".stripslashes($ob->queueVersion)." </td>\n";
|
||||
echo " <td>".stripslashes($ob->queueVendor)." </td>\n";
|
||||
echo " <td>".stripslashes($ob->queueEmail)." </td>\n";
|
||||
|
||||
// get queued versions (only versions where application are not queued already)
|
||||
$sQuery = "SELECT versionId FROM appVersion, appFamily WHERE appFamily.appId = appVersion.appId and appFamily.queued = 'false' AND appVersion.queued = 'true'";
|
||||
$hResult = query_appdb($sQuery);
|
||||
|
||||
if(!$hResult || !mysql_num_rows($hResult))
|
||||
{
|
||||
//no apps in queue
|
||||
echo html_frame_start("Version Queue","90%");
|
||||
echo '<p><b>The Version Queue is empty.</b></p>',"\n";
|
||||
echo html_frame_end(" ");
|
||||
}
|
||||
else
|
||||
{
|
||||
//help
|
||||
echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
|
||||
echo "<p>This is the list of versions waiting for your approval, or to be rejected.</p>\n";
|
||||
echo "<p>To view a submission, click on its name. From that page you can edit, delete or approve it into \n";
|
||||
echo "the AppDB .<br>\n";
|
||||
echo "<p>Note that versions linked to application that have not been yet approved are not displayed in this list.</p>\n";
|
||||
echo "the AppDB.<br>\n";
|
||||
echo "</td></tr></table></div>\n\n";
|
||||
|
||||
//show applist
|
||||
echo html_frame_start("","90%","",0);
|
||||
echo "<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\">
|
||||
<tr class=color4>
|
||||
<td>Submission Date</td>
|
||||
<td>Vendor</td>
|
||||
<td>Application Name</td>
|
||||
<td>Version Name</td>
|
||||
<td>Submitter</td>
|
||||
</tr>";
|
||||
|
||||
$c = 1;
|
||||
while($oRow = mysql_fetch_object($hResult))
|
||||
{
|
||||
$oVersion = new Version($oRow->versionId);
|
||||
$oApp = new Application($oVersion->iAppId);
|
||||
$oSubmitter = new User($oVersion->iSubmitterId);
|
||||
$oVendor = new Vendor($oApp->iVendorId);
|
||||
$sVendor = $oVendor->sName;
|
||||
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
|
||||
echo "<tr class=\"$bgcolor\">\n";
|
||||
echo " <td>".date("Y-n-t h:i:sa", $oVersion->sSubmitTime)." </td>\n";
|
||||
echo " <td>".$sVendor." </td>\n";
|
||||
echo " <td>".$oApp->sName." </td>\n";
|
||||
echo " <td><a href=\"adminAppQueue.php?sub=view&versionId=".$oVersion->iVersionId."\">".$oVersion->sName."</a></td>\n";
|
||||
echo " <td><a href=\"mailto:".$oSubmitter->sEmail."\">".$oSubmitter->sRealname."</a></td>\n";
|
||||
echo "</tr>\n\n";
|
||||
$c++;
|
||||
}
|
||||
@@ -449,9 +352,6 @@ else
|
||||
echo html_frame_end(" ");
|
||||
|
||||
}
|
||||
echo "</form>";
|
||||
apidb_footer();
|
||||
|
||||
}
|
||||
|
||||
apidb_footer();
|
||||
?>
|
||||
|
||||
@@ -24,110 +24,14 @@ if(!($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isSuperMain
|
||||
|
||||
if(isset($_REQUEST['submit']))
|
||||
{
|
||||
$statusMessage = '';
|
||||
|
||||
// commit changes of form to database
|
||||
if($_REQUEST['submit'] == "Update Database")
|
||||
{
|
||||
// Get the old values from the database
|
||||
$sQuery = "SELECT * FROM appFamily WHERE appId = ".$_REQUEST['appId'];
|
||||
$hResult = query_appdb($sQuery);
|
||||
$ob = mysql_fetch_object($hResult);
|
||||
$sOld_appName = $ob->appName;
|
||||
$sOld_description = $ob->description;
|
||||
$iOld_vendorId = $ob->vendorId;
|
||||
$iOld_catId = $ob->catId;
|
||||
$sOld_keywords = $ob->keywords;
|
||||
$sOld_webPage = $ob->webPage;
|
||||
|
||||
$sWhatChanged = "";
|
||||
$bAppChanged = false;
|
||||
if ($sOld_appName <> $_REQUEST['appName'])
|
||||
{
|
||||
$sWhatChanged .= " App name: Old Value: ".stripslashes($sOld_appName)."\n";
|
||||
$sWhatChanged .= " New Value: ".stripslashes($_REQUEST['appName'])."\n";
|
||||
$bAppChanged = true;
|
||||
}
|
||||
|
||||
if ($iOld_vendorId <> $_REQUEST['vendorId'])
|
||||
{
|
||||
$sWhatChanged .= " Vendor: Old Value: ".lookupVendorName($iOld_vendorId)."\n";
|
||||
$sWhatChanged .= " New Value: ".lookupVendorName($_REQUEST['vendorId'])."\n";
|
||||
$bAppChanged = true;
|
||||
}
|
||||
|
||||
if ($old_description <> $_REQUEST['description'])
|
||||
{
|
||||
$sWhatChanged .= " Description: Old Value:\n";
|
||||
$sWhatChanged .= "-----------------------:\n";
|
||||
$sWhatChanged .= stripslashes($sOld_description)."\n";
|
||||
$sWhatChanged .= "-----------------------:\n";
|
||||
$sWhatChanged .= " Description: New Value:\n";
|
||||
$sWhatChanged .= "-----------------------:\n";
|
||||
$sWhatChanged .= stripslashes($_REQUEST['description'])."\n";
|
||||
$sWhatChanged .= "-----------------------:\n";
|
||||
$bAppChanged = true;
|
||||
}
|
||||
|
||||
if ($iOld_catId <> $_REQUEST['catId'])
|
||||
{
|
||||
$sWhatChanged .= " Category: Old Value: ".lookupCategoryName($iOld_catId)."\n";
|
||||
$sWhatChanged .= " New Value: ".lookupCategoryName($_REQUEST['catId'])."\n";
|
||||
$bAppChanged = true;
|
||||
}
|
||||
|
||||
if ($sOld_keywords <> $_REQUEST['keywords'])
|
||||
{
|
||||
$sWhatChanged .= " keywords: Old Value: ".stripslashes($sOld_keywords)."\n";
|
||||
$sWhatChanged .= " New Value: ".stripslashes($_REQUEST['keywords'])."\n";
|
||||
$bAppChanged = true;
|
||||
}
|
||||
|
||||
if ($sOld_webPage <> $_REQUEST['webPage'])
|
||||
{
|
||||
$sWhatChanged .= " Web Page: Old Value: ".stripslashes($sOld_webPage)."\n";
|
||||
$sWhatChanged .= " New Value: ".stripslashes($_REQUEST['webPage'])."\n";
|
||||
$bAppChanged = true;
|
||||
}
|
||||
|
||||
//did anything change?
|
||||
if ($bAppChanged)
|
||||
{
|
||||
$sUpdate = compile_update_string(array( 'appName' => $_REQUEST['appName'],
|
||||
'description' => $_REQUEST['description'],
|
||||
'webPage' => $_REQUEST['webPage'],
|
||||
'vendorId' => $_REQUEST['vendorId'],
|
||||
'keywords' => $_REQUEST['keywords'],
|
||||
'catId' => $_REQUEST['catId'] ));
|
||||
|
||||
// success
|
||||
if (query_appdb("UPDATE `appFamily` SET $sUpdate WHERE `appId` = {$_REQUEST['appId']}"))
|
||||
{
|
||||
$sEmail = get_notify_email_address_list($_REQUEST['appId']);
|
||||
if($sEmail)
|
||||
{
|
||||
$sSubject = lookup_app_name($_REQUEST['appId'])." has been modified by ".$_SESSION['current']->sRealname;
|
||||
$sMsg .= APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."\n";
|
||||
$sMsg .= "\n";
|
||||
$sMsg .= "The following changes have been made:";
|
||||
$sMsg .= "\n";
|
||||
$sMsg .= $sWhatChanged."\n";
|
||||
$sMsg .= "\n";
|
||||
|
||||
mail_appdb($sEmail, $sSubject ,$sMsg);
|
||||
}
|
||||
addmsg("The application was successfully updated in the database", "green");
|
||||
redirect(apidb_fullurl("appview.php?appId=".$_REQUEST['appId']));
|
||||
} else
|
||||
{
|
||||
//error
|
||||
redirect(apidb_fullurl("admin/editAppVersion.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
|
||||
}
|
||||
}
|
||||
$oApp = new Application($_REQUEST['appId']);
|
||||
$oApp->update($_REQUEST['appName'], $_REQUEST['description'], $_REQUEST['keywords'], $_REQUEST['webPage'], $_REQUEST['vendorId'], $_REQUEST['catId']);
|
||||
}
|
||||
else if($_REQUEST['submit'] == "Update URL")
|
||||
{
|
||||
|
||||
$sWhatChanged = "";
|
||||
$bAppChanged = false;
|
||||
|
||||
@@ -208,10 +112,8 @@ if(isset($_REQUEST['submit']))
|
||||
mail_appdb($sEmail, $sFullAppName ,$sMsg);
|
||||
}
|
||||
}
|
||||
|
||||
redirect(apidb_fullurl("appview.php?appId={$_REQUEST['appId']}"));
|
||||
exit;
|
||||
}
|
||||
redirect(apidb_fullurl("appview.php?appId={$_REQUEST['appId']}"));
|
||||
}
|
||||
else
|
||||
// Show the form for editing the Application Family
|
||||
@@ -228,7 +130,6 @@ else
|
||||
if(!mysql_num_rows($result))
|
||||
{
|
||||
errorpage('Application does not exist');
|
||||
exit;
|
||||
}
|
||||
|
||||
$ob = mysql_fetch_object($result);
|
||||
|
||||
@@ -20,97 +20,11 @@ if(!($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isMaintaine
|
||||
|
||||
if(isset($_REQUEST['submit1']))
|
||||
{
|
||||
$oVersion = new Version($_REQUEST['versionId']);
|
||||
$oApp = new Application($_REQUEST['appId']);
|
||||
if($_REQUEST['submit1'] == "Update Database")
|
||||
{
|
||||
$statusMessage = '';
|
||||
// Get the old values from the database
|
||||
$query = "SELECT * FROM appVersion WHERE appId = ".$_REQUEST['appId']." and versionId = ".$_REQUEST['versionId'];
|
||||
$result = query_appdb($query);
|
||||
$ob = mysql_fetch_object($result);
|
||||
$old_versionName = $ob->versionName;
|
||||
$old_description = $ob->description;
|
||||
$old_rating = $ob->maintainer_rating;
|
||||
$old_release = $ob->maintainer_release;
|
||||
|
||||
$versionName = $_REQUEST['versionName'];
|
||||
$description = $_REQUEST['description'];
|
||||
$maintainer_rating = $_REQUEST['maintainer_rating'];
|
||||
$maintainer_release = $_REQUEST['maintainer_release'];
|
||||
|
||||
|
||||
$VersionChanged = false;
|
||||
if ($old_versionName <> $versionName)
|
||||
{
|
||||
$WhatChanged .= "Version name: Old Value: ".stripslashes($old_versionName)."\n";
|
||||
$WhatChanged .= " New Value: ".$versionName."\n";
|
||||
$VersionChanged = true;
|
||||
}
|
||||
if ($old_description <> $description)
|
||||
{
|
||||
$WhatChanged .= " Description: Old Value:\n";
|
||||
$WhatChanged .= "-----------------------:\n";
|
||||
$WhatChanged .= stripslashes($old_description)."\n";
|
||||
$WhatChanged .= "-----------------------:\n";
|
||||
$WhatChanged .= " Description: New Value:\n";
|
||||
$WhatChanged .= "-----------------------:\n";
|
||||
$WhatChanged .= stripslashes($description)."\n";
|
||||
$WhatChanged .= "-----------------------:\n";
|
||||
$VersionChanged = true;
|
||||
}
|
||||
if ($old_rating <> $maintainer_rating)
|
||||
{
|
||||
$WhatChanged .= " Release: Old Value: ".stripslashes($old_rating)."\n";
|
||||
$WhatChanged .= " New Value: ".$maintainer_rating."\n";
|
||||
$VersionChanged = true;
|
||||
}
|
||||
|
||||
if ($old_release <> $maintainer_release)
|
||||
{
|
||||
$WhatChanged .= " Release: Old Value: ".stripslashes($old_release)."\n";
|
||||
$WhatChanged .= " New Value: ".$maintainer_release."\n";
|
||||
$VersionChanged = true;
|
||||
}
|
||||
|
||||
//did anything change?
|
||||
if ($VersionChanged)
|
||||
{
|
||||
$sUpdate = compile_update_string( array('versionName' => $versionName,
|
||||
'description' => $description,
|
||||
'maintainer_rating' => $maintainer_rating,
|
||||
'maintainer_release' => $maintainer_release));
|
||||
|
||||
$sQuery = "UPDATE appVersion
|
||||
SET $sUpdate
|
||||
WHERE appId = '".$_REQUEST['appId']."'
|
||||
AND versionId = '".$_REQUEST['versionId']."'";
|
||||
// success
|
||||
if (query_appdb($sQuery))
|
||||
{
|
||||
$sEmail = get_notify_email_address_list($_REQUEST['appId'], $_REQUEST['versionId']);
|
||||
if($sEmail)
|
||||
{
|
||||
$sSubject = lookup_app_name($_REQUEST['appId'])." ".lookup_version_name($_REQUEST['versionId'])." has been modified by ".$_SESSION['current']->sRealname;
|
||||
$sMsg .= APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\n";
|
||||
$sMsg .= "\n";
|
||||
$sMsg .= "The following changes have been made:";
|
||||
$sMsg .= "\n";
|
||||
$sMsg .= $WhatChanged."\n";
|
||||
$sMsg .= "\n";
|
||||
|
||||
mail_appdb($sEmail, $sSubject ,$sMsg);
|
||||
}
|
||||
addmsg("The version was successfully updated in the database", "green");
|
||||
redirect(apidb_fullurl("appview.php?versionId=".$_REQUEST['versionId']));
|
||||
} else
|
||||
{
|
||||
//error
|
||||
redirect(apidb_fullurl("admin/editAppVersion.php?versionId=".$_REQUEST['versionId']));
|
||||
}
|
||||
} else
|
||||
{
|
||||
addmsg("Nothing changed", "red");
|
||||
redirect(apidb_fullurl("admin/editAppVersion.php?versionId=".$_REQUEST['versionId']));
|
||||
}
|
||||
$oVersion->update($_REQUEST['versionName'], $_REQUEST['description'], $_REQUEST['maintainer_release'], $_REQUEST['maintainer_rating']);
|
||||
}
|
||||
else if($_REQUEST['submit1'] == "Update URL")
|
||||
{
|
||||
@@ -174,13 +88,12 @@ if(isset($_REQUEST['submit1']))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($bAppChanged)
|
||||
{
|
||||
$sEmail = get_notify_email_address_list($_REQUEST['appId']);
|
||||
if($sEmail)
|
||||
{
|
||||
$sSubject = "Links for ".lookup_app_name($_REQUEST['appId'])." ".lookup_app_name($_REQUEST['versionId'])." have been updated by ".$_SESSION['current']->sRealname;
|
||||
$sSubject = "Links for ".$oApp->sName." ".$oVersion->sName." have been updated by ".$_SESSION['current']->sRealname;
|
||||
$sMsg = APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."\n";
|
||||
$sMsg .= "\n";
|
||||
$sMsg .= "The following changes have been made:";
|
||||
@@ -191,6 +104,7 @@ if(isset($_REQUEST['submit1']))
|
||||
mail_appdb($sEmail, $sSubject ,$sMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
redirect(apidb_fullurl("appview.php?versionId=".$_REQUEST['versionId']));
|
||||
} else
|
||||
{
|
||||
@@ -199,26 +113,23 @@ if(isset($_REQUEST['submit1']))
|
||||
<!-- load HTMLArea -->
|
||||
<script type="text/javascript" src="../htmlarea/htmlarea_loader.js"></script>
|
||||
<?php
|
||||
$sQuery = "SELECT *
|
||||
FROM appVersion
|
||||
WHERE versionId = '".$_REQUEST['versionId']."'";
|
||||
$hResult = query_appdb($sQuery);
|
||||
$oRow = mysql_fetch_object($hResult);
|
||||
$oVersion = new Version($_REQUEST['versionId']);
|
||||
|
||||
apidb_header("Edit Application Version");
|
||||
|
||||
echo "<form method=post action='editAppVersion.php'>\n";
|
||||
echo html_frame_start("Data for Application ID: ".$_REQUEST['appId']." Version ID: ".$_REQUEST['versionId'], "90%","",0);
|
||||
echo html_frame_start("Data for Application ID: ".$oVersion->iAppId." Version ID: ".$oVersion->iVersionId, "90%","",0);
|
||||
echo html_table_begin("width='100%' border=0 align=left cellpadding=6 cellspacing=0 class='box-body'");
|
||||
echo '<input type="hidden" name="appId" value='.$_REQUEST['appId'].' />';
|
||||
echo '<input type="hidden" name="versionId" value='.$_REQUEST['versionId'].' />';
|
||||
echo '<tr><td class=color1>Name</td><td class=color0>'.lookup_app_name($_REQUEST['appId']).'</td></tr>',"\n";
|
||||
echo '<tr><td class=color4>Version</td><td class=color0><input size=80% type="text" name="versionName" type="text" value="'.$oRow->versionName.'" /></td></tr>',"\n";
|
||||
echo '<input type="hidden" name="appId" value='.$oVersion->iAppId.' />';
|
||||
echo '<input type="hidden" name="versionId" value='.$oVersion->iVersionId.' />';
|
||||
echo '<tr><td class=color1>Name</td><td class=color0>'.lookup_app_name($oVersion->iAppId).'</td></tr>',"\n";
|
||||
echo '<tr><td class=color4>Version</td><td class=color0><input size=80% type="text" name="versionName" type="text" value="'.$oVersion->sName.'" /></td></tr>',"\n";
|
||||
echo '<tr><td class="color4">Version specific description</td><td class="color0">', "\n";
|
||||
if(trim(strip_tags($oRow->description))=="")
|
||||
// FIXME: put templates in config file or somewhere else.
|
||||
if(trim(strip_tags($oVersion->sDescription))=="")
|
||||
{
|
||||
$oRow->description = "<p>This is a template; enter version-specific description here</p>";
|
||||
$oRow->description .= "<p>
|
||||
$oVersion->sDescription = "<p>This is a template; enter version-specific description here</p>";
|
||||
$oVersion->sDescription .= "<p>
|
||||
<span class=\"title\">Wine compatibility</span><br />
|
||||
<span class=\"subtitle\">What works:</span><br />
|
||||
- settings<br />
|
||||
@@ -228,7 +139,7 @@ if(isset($_REQUEST['submit1']))
|
||||
<br /><span class=\"subtitle\">What was not tested:</span><br />
|
||||
- burning<br />
|
||||
</p>";
|
||||
$oRow->description .= "<p><span class=\"title\">Tested versions</span><br /><table class=\"historyTable\" width=\"90%\" border=\"1\">
|
||||
$oVersion->sDescription .= "<p><span class=\"title\">Tested versions</span><br /><table class=\"historyTable\" width=\"90%\" border=\"1\">
|
||||
<thead class=\"historyHeader\"><tr>
|
||||
<td>App. version</td><td>Wine version</td><td>Installs?</td><td>Runs?</td><td>Rating</td>
|
||||
</tr></thead>
|
||||
@@ -241,13 +152,13 @@ if(isset($_REQUEST['submit1']))
|
||||
</tr></tbody></table></p><p> <br /> </p>";
|
||||
}
|
||||
echo '<p style="width:700px">', "\n";
|
||||
echo '<textarea cols="80" rows="30" id="editor" name="description">'.$oRow->description.'</textarea></td></tr>',"\n";
|
||||
echo '<textarea cols="80" rows="30" id="editor" name="description">'.$oVersion->sDescription.'</textarea></td></tr>',"\n";
|
||||
echo '</p>';
|
||||
echo '<tr><td class="color4">Rating</td><td class="color0">',"\n";
|
||||
make_maintainer_rating_list("maintainer_rating", $oRow->maintainer_rating);
|
||||
make_maintainer_rating_list("maintainer_rating", $oVersion->sTestedRating);
|
||||
echo '</td></tr>',"\n";
|
||||
echo '<tr><td class=color1>Release</td><td class=color0>',"\n";
|
||||
make_bugzilla_version_list("maintainer_release", $oRow->maintainer_release);
|
||||
make_bugzilla_version_list("maintainer_release", $oVersion->sTestedRelease);
|
||||
echo '</td></tr>',"\n";
|
||||
|
||||
echo '<tr><td colspan=2 align=center class=color3><input type="submit" name="submit1" value="Update Database" /></td></tr>',"\n";
|
||||
@@ -258,13 +169,13 @@ if(isset($_REQUEST['submit1']))
|
||||
|
||||
// url edit form
|
||||
echo '<form enctype="multipart/form-data" action="editAppVersion.php" method="post">',"\n";
|
||||
echo '<input type=hidden name="appId" value='.$_REQUEST['appId'].'>';
|
||||
echo '<input type=hidden name="versionId" value='.$_REQUEST['versionId'].'>';
|
||||
echo '<input type=hidden name="appId" value='.$oVersion->iAppId.'>';
|
||||
echo '<input type=hidden name="versionId" value='.$oVersion->iVersionId.'>';
|
||||
echo html_frame_start("Edit URL","90%","",0);
|
||||
echo '<table border=0 cellpadding=6 cellspacing=0 width="100%">',"\n";
|
||||
|
||||
$i = 0;
|
||||
$result = query_appdb("SELECT * FROM appData WHERE versionId = ".$_REQUEST['versionId']." AND type = 'url'");
|
||||
$result = query_appdb("SELECT * FROM appData WHERE versionId = ".$oVersion->iVersionId." AND type = 'url'");
|
||||
if($result && mysql_num_rows($result) > 0)
|
||||
{
|
||||
echo '<tr><td class=color1><b>Delete</b></td><td class=color1>',"\n";
|
||||
@@ -287,7 +198,7 @@ if(isset($_REQUEST['submit1']))
|
||||
}
|
||||
} else
|
||||
{
|
||||
echo '<tr><td class=color1></td><td class="color1"><b>Description</b></td>',"\n";
|
||||
echo '<tr><td class="color1"></td><td class="color1"><b>Description</b></td>',"\n";
|
||||
echo '<td class=color1><b>URL</b></td></tr>',"\n";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
@@ -300,7 +211,7 @@ if(isset($_REQUEST['submit1']))
|
||||
echo '</table>',"\n";
|
||||
echo html_frame_end();
|
||||
echo "</form>";
|
||||
echo html_back_link(1,BASE."appview.php?versionId=".$_REQUEST['versionId']);
|
||||
echo html_back_link(1,BASE."appview.php?versionId=".$oVersion->iVersionId);
|
||||
apidb_footer();
|
||||
}
|
||||
?>
|
||||
|
||||
307
appsubmit.php
307
appsubmit.php
@@ -5,13 +5,16 @@
|
||||
include("path.php");
|
||||
require(BASE."include/incl.php");
|
||||
require(BASE."include/tableve.php");
|
||||
require(BASE."include/mail.php");
|
||||
require(BASE."include/application.php");
|
||||
|
||||
|
||||
// Send user to the correct branch of code even if they try to bypass
|
||||
// the first page (appsubmit.php without parameters)
|
||||
if(!$_SESSION['current']->isLoggedIn())
|
||||
{
|
||||
unset($_REQUEST['queueName']);
|
||||
unset($_REQUEST['apptype']);
|
||||
// you must be logged in to submit app
|
||||
apidb_header("Please login");
|
||||
echo "To submit an application to the database you must be logged in. Please <a href=\"account.php?cmd=login\">login now</a> or create a <a href=\"account.php?cmd=new\">new account</a>.","\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check the input of a submitted form. And output with a list
|
||||
@@ -20,40 +23,32 @@ function checkInput($fields)
|
||||
{
|
||||
$errors = "";
|
||||
|
||||
if (strlen($fields['queueName']) > 200 )
|
||||
if (strlen($fields['appName']) > 200 )
|
||||
$errors .= "<li>Your application name is too long.</li>\n";
|
||||
|
||||
if (empty( $fields['queueName']))
|
||||
if (empty($fields['appName']) && !$fields['appId'])
|
||||
$errors .= "<li>Please enter an application name.</li>\n";
|
||||
|
||||
if (empty( $fields['queueVersion']))
|
||||
if (empty($fields['versionName']))
|
||||
$errors .= "<li>Please enter an application version.</li>\n";
|
||||
|
||||
// No vendor entered, and nothing in the list is selected
|
||||
if (empty( $fields['queueVendor']) and $fields['altvendor'] == '0')
|
||||
if (empty($fields['vendorName']) && !$fields['vendorId'])
|
||||
$errors .= "<li>Please enter a vendor.</li>\n";
|
||||
|
||||
if (empty( $fields['queueDesc']))
|
||||
if (empty($fields['appDescription']))
|
||||
$errors .= "<li>Please enter a description of your application.</li>\n";
|
||||
|
||||
// Not empty and an invalid e-mail address
|
||||
if (!empty( $fields['queueEmail'])
|
||||
AND !preg_match('/^[A-Za-z0-9\._-]+[@][A-Za-z0-9_-]+([.][A-Za-z0-9_-]+)+[A-Za-z]$/',
|
||||
$fields['queueEmail']))
|
||||
{
|
||||
$errors .= "<li>Please enter a valid e-mail address.</li>\n";
|
||||
}
|
||||
|
||||
if (empty($errors))
|
||||
return "";
|
||||
else
|
||||
return $errors;
|
||||
}
|
||||
|
||||
#################################
|
||||
# USER SUBMITTED APP OR VERSION #
|
||||
#################################
|
||||
if (isset($_REQUEST['queueName']))
|
||||
/*
|
||||
* User submitted an application
|
||||
*/
|
||||
if (isset($_REQUEST['appName']))
|
||||
{
|
||||
// Check input and exit if we found errors
|
||||
$errors = checkInput($_REQUEST);
|
||||
@@ -64,43 +59,34 @@ if (isset($_REQUEST['queueName']))
|
||||
exit;
|
||||
}
|
||||
|
||||
/* if the user picked the vendor we need to retrieve the vendor name */
|
||||
/* and store it into the $queueVendor */
|
||||
if(isset($_REQUEST['altvendor']))
|
||||
{
|
||||
/* retrieve the actual name here */
|
||||
$sQuery = "select * from vendor where vendorId = ".$_REQUEST['altvendor'].";";
|
||||
$result = query_appdb($sQuery);
|
||||
if($result && mysql_num_rows($result) > 0 )
|
||||
{
|
||||
$ob = mysql_fetch_object($result);
|
||||
$_REQUEST['queueVendor'] = $ob->vendorName;
|
||||
}
|
||||
}
|
||||
|
||||
$aFields = compile_insert_string(
|
||||
array( 'queueName' => $_REQUEST['queueName'],
|
||||
'queueVersion' => $_REQUEST['queueVersion'],
|
||||
'queueVendor' => $_REQUEST['queueVendor'],
|
||||
'queueDesc' => $_REQUEST['queueDesc'],
|
||||
'queueEmail' => $_REQUEST['queueEmail'],
|
||||
'queueURL' => $_REQUEST['queueURL'],
|
||||
'queueCatId' => $_REQUEST['queueCatId']));
|
||||
|
||||
$sQuery = "INSERT INTO appQueue ({$aFields['FIELDS']},`submitTime`) VALUES ({$aFields['VALUES']}, NOW())";
|
||||
|
||||
if(query_appdb($sQuery))
|
||||
{
|
||||
addmsg("Your application has been submitted for review. You should hear back soon".
|
||||
" about the status of your submission.",'green');
|
||||
}
|
||||
|
||||
if($vendorName) $_REQUEST['vendorId']="";
|
||||
$oApplication = new Application();
|
||||
$oApplication->create($_REQUEST['appName'], $_REQUEST['appDescription'], $_REQUEST['keywords']." *** ".$_REQUEST['vendorName'], $_REQUEST['webpage'],$_REQUEST['vendorId'], $_REQUEST['catId']);
|
||||
$oVersion = new Version();
|
||||
$oVersion->create($_REQUEST['versionName'], $_REQUEST['versionDescription'], null, null, $oApplication->iAppId);
|
||||
redirect(apidb_fullurl("index.php"));
|
||||
}
|
||||
/*
|
||||
* User submitted a version
|
||||
*/
|
||||
elseif (isset($_REQUEST['versionName']) && is_numeric($_REQUEST['appId']))
|
||||
{
|
||||
// Check input and exit if we found errors
|
||||
$errors = checkInput($_REQUEST);
|
||||
if(!empty($errors))
|
||||
{
|
||||
errorpage("We found the following errors:","<ul>$errors</ul><br />Please go back and correct them.");
|
||||
echo html_back_link(1);
|
||||
exit;
|
||||
}
|
||||
|
||||
#######################################
|
||||
# USER WANTS TO SUBMIT APP OR VERSION #
|
||||
#######################################
|
||||
$oVersion = new Version();
|
||||
$oVersion->create($_REQUEST['versionName'], $_REQUEST['versionDescription'], null, null, $_REQUEST['appId']);
|
||||
redirect(apidb_fullurl("index.php"));
|
||||
}
|
||||
/*
|
||||
* User wants to submit an application or version
|
||||
*/
|
||||
elseif (isset($_REQUEST['apptype']))
|
||||
{
|
||||
//FIXME: use absolute path in htmlarea_loader.js to avoid code duplication here
|
||||
@@ -125,6 +111,14 @@ function initDocument() {
|
||||
editor.config.pageStyle = "@import url(./application.css);";
|
||||
editor.registerPlugin(DynamicCSS);
|
||||
editor.generate();
|
||||
<?php
|
||||
if($_REQUEST['apptype'] == 1) // we have two editors, one for application and one for version.
|
||||
{?>
|
||||
var editor2 = new HTMLArea("editor2",config);
|
||||
editor2.config.pageStyle = "@import url(./application.css);";
|
||||
editor2.generate();
|
||||
<?php
|
||||
}?>
|
||||
}
|
||||
|
||||
onload = function() {
|
||||
@@ -135,87 +129,14 @@ onload = function() {
|
||||
</script>
|
||||
<script type="text/javascript" src="./htmlarea/htmlarea.js"></script>
|
||||
<?php
|
||||
// set email field if logged in
|
||||
if ($_SESSION['current']->isLoggedIn())
|
||||
$email = $_SESSION['current']->sEmail;
|
||||
|
||||
// header
|
||||
apidb_header("Submit Application");
|
||||
|
||||
// show add to queue form
|
||||
echo '<form name="newApp" action="appsubmit.php" method="post" enctype="multipart/form-data">',"\n";
|
||||
echo "<p>This page is for submitting new applications to be added to this\n";
|
||||
echo "database. The application will be reviewed by the AppDB Administrator\n";
|
||||
echo "and you will be notified via email if this application will be added to\n";
|
||||
echo "the database.</p>\n";
|
||||
echo "<p>Please don't forget to mention which Wine version you used, how well it worked\n";
|
||||
echo "and if any workaround were needed. Having app descriptions just sponsoring the app\n";
|
||||
echo "(Yes, some vendor want to use the appdb for this) or saying \"I haven't tried this app with Wine\" ";
|
||||
echo "won't help Wine development or Wine users.</p>\n";
|
||||
echo "<p>After your application has been added you'll be able to submit screenshots for it.</p>";
|
||||
|
||||
# NEW APPLICATION
|
||||
if ($_REQUEST['apptype'] == 1)
|
||||
{
|
||||
echo html_frame_start("New Application Form",400,"",0);
|
||||
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
|
||||
echo '<tr valign=top><td class=color0><b>App Name</b></td>',"\n";
|
||||
echo '<td><input type=text name="queueName" value="" size=20></td></tr>',"\n";
|
||||
echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n";
|
||||
echo '<td><input type=text name="queueVersion" value="" size=20></td></tr>',"\n";
|
||||
|
||||
// app Category
|
||||
$w = new TableVE("view");
|
||||
echo '<tr valign=top><td class=color0><b>Category</b></td><td>',"\n";
|
||||
$w->make_option_list("queueCatId","","appCategory","catId","catName");
|
||||
echo '</td></tr>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class=color0><b>App Vendor</b></td>',"\n";
|
||||
echo '<td><input type=text name="queueVendor" value="" size=20></td></tr>',"\n";
|
||||
|
||||
// alt vendor
|
||||
$x = new TableVE("view");
|
||||
echo '<tr valign=top><td class=color0> </td><td>',"\n";
|
||||
$x->make_option_list("altvendor","","vendor","vendorId","vendorName");
|
||||
echo '</td></tr>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class=color0><b>App URL</b></td>',"\n";
|
||||
echo '<td><input type=text name="queueURL" value="" size=20></td></tr>',"\n";
|
||||
$sDescription = "<p>Enter description here</p>";
|
||||
echo '<tr valign=top><td class=color0><b>Description</b></td>',"\n";
|
||||
echo '<td><p style="width:700px"><textarea cols="80" rows="20" id="editor" name="queueDesc">'.$sDescription.'</textarea></p></td></tr>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class=color0><b>Email</b></td>',"\n";
|
||||
echo '<td><input type=text name="queueEmail" value="'.$email.'" size=20></td></tr>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class=color3 align=center colspan=2>',"\n";
|
||||
echo '<input type=submit value=" Submit New Application " class=button> </td></tr>',"\n";
|
||||
|
||||
|
||||
echo '</table>',"\n";
|
||||
|
||||
echo html_frame_end();
|
||||
|
||||
echo "</form>";
|
||||
}
|
||||
|
||||
# NEW VERSION
|
||||
else
|
||||
{
|
||||
echo html_frame_start("New Version Form",400,"",0);
|
||||
|
||||
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
|
||||
|
||||
// app parent
|
||||
$x = new TableVE("view");
|
||||
echo '<tr valign=top><td class=color0><b>App Parent</b></td><td>',"\n";
|
||||
$x->make_option_list("queueName",$_REQUEST['appId'],"appFamily","appId","appName");
|
||||
echo '</td></tr>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n";
|
||||
echo '<td><input type=text name="queueVersion" size=20></td></tr>',"\n";
|
||||
$sDescription = "<p>This is a template; enter version-specific description here</p>";
|
||||
$sDescription .= "<p>
|
||||
/*
|
||||
* Templates
|
||||
* FIXME: put templates in config file or somewhere else.
|
||||
*/
|
||||
$sAppDescription = "<p>Enter description here</p>";
|
||||
$sVersionDescription = "<p>This is a template; enter version-specific description here</p>
|
||||
<p>
|
||||
<span class=\"title\">Wine compatibility</span><br />
|
||||
<span class=\"subtitle\">What works:</span><br />
|
||||
- settings<br />
|
||||
@@ -224,8 +145,8 @@ onload = function() {
|
||||
- erasing<br />
|
||||
<br /><span class=\"subtitle\">What was not tested:</span><br />
|
||||
- burning<br />
|
||||
</p>";
|
||||
$oRow->description .= "<p><span class=\"title\">Tested versions</span><br /><table class=\"historyTable\" width=\"90%\" border=\"1\">
|
||||
</p>
|
||||
<p><span class=\"title\">Tested versions</span><br /><table class=\"historyTable\" width=\"90%\" border=\"1\">
|
||||
<thead class=\"historyHeader\"><tr>
|
||||
<td>App. version</td><td>Wine version</td><td>Installs?</td><td>Runs?</td><td>Rating</td>
|
||||
</tr></thead>
|
||||
@@ -237,17 +158,89 @@ onload = function() {
|
||||
<td class=\"bronze\">3.21</td><td class=\"bronze\">20040615</td><td class=\"bronze\">yes</td><td class=\"bronze\">yes</td><td class=\"bronze\">Bronze</td>
|
||||
</tr></tbody></table></p><p> <br /> </p>";
|
||||
|
||||
echo '<tr valign=top><td class=color0><b>App Desc</b></td>',"\n";
|
||||
echo '<td><p style="width:700px"><textarea cols="80" rows="20" id="editor" name="queueDesc">'.$sDescription.'</textarea></p></td></tr>',"\n";
|
||||
// header
|
||||
apidb_header("Submit Application");
|
||||
|
||||
echo '<tr valign=top><td class=color0><b>Email</b></td>',"\n";
|
||||
echo '<td><input type=text name="queueEmail" value="'.$email.'" size=20></td></tr>',"\n";
|
||||
// show add to queue form
|
||||
echo '<form name="newApp" action="appsubmit.php" method="post">'."\n";
|
||||
echo "<p>This page is for submitting new applications to be added to this\n";
|
||||
echo "database. The application will be reviewed by the AppDB Administrator\n";
|
||||
echo "and you will be notified via email if this application will be added to\n";
|
||||
echo "the database.</p>\n";
|
||||
echo "<p>Please don't forget to mention which Wine version you used, how well it worked\n";
|
||||
echo "and if any workaround were needed. Having app descriptions just sponsoring the app\n";
|
||||
echo "(Yes, some vendor want to use the appdb for this) or saying \"I haven't tried this app with Wine\" ";
|
||||
echo "won't help Wine development or Wine users.</p>\n";
|
||||
echo "<p>After your application has been added you'll be able to submit screenshots for it.</p>";
|
||||
|
||||
// new application and version
|
||||
if ($_REQUEST['apptype'] == 1)
|
||||
{
|
||||
echo html_frame_start("New Application Form",400,"",0);
|
||||
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
|
||||
echo '<tr valign=top><td class="color0"><b>Application name</b></td>',"\n";
|
||||
echo '<td><input type=text name="appName" value="" size="20"></td></tr>',"\n";
|
||||
echo '<tr valign=top><td class="color0"><b>Version name</b></td>',"\n";
|
||||
echo '<td><input type=text name="versionName" value="" size="20"></td></tr>',"\n";
|
||||
|
||||
// app Category
|
||||
$w = new TableVE("view");
|
||||
echo '<tr valign=top><td class="color0"><b>Category</b></td><td>',"\n";
|
||||
$w->make_option_list("catId","","appCategory","catId","catName");
|
||||
echo '</td></tr>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class="color0"><b>Vendor</b></td>',"\n";
|
||||
echo '<td><input type=text name="vendorName" value="" size="20"></td></tr>',"\n";
|
||||
|
||||
// alt vendor
|
||||
$x = new TableVE("view");
|
||||
echo '<tr valign=top><td class="color0"> </td><td>',"\n";
|
||||
$x->make_option_list("vendorId","","vendor","vendorId","vendorName");
|
||||
echo '</td></tr>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class="color0"><b>URL</b></td>',"\n";
|
||||
echo '<td><input type=text name="webpage" value="" size=20></td></tr>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class="color0"><b>Keywords</b></td>',"\n";
|
||||
echo '<td><input size="80%" type="text" name="keywords"></td></tr>',"\n";
|
||||
|
||||
|
||||
echo '<tr valign=top><td class="color0"><b>Application Description</b></td>',"\n";
|
||||
echo '<td><p style="width:700px"><textarea cols="80" rows="20" id="editor" name="appDescription">'.$sAppDescription.'</textarea></p></td></tr>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class="color0"><b>Version Description</b></td>',"\n";
|
||||
echo '<td><p style="width:700px"><textarea cols="80" rows="20" id="editor2" name="versionDescription">'.$sVersionDescription.'</textarea></p></td></tr>',"\n";
|
||||
|
||||
echo '<input type=hidden name="queueVendor" value="">',"\n";
|
||||
echo '<input type=hidden name="queueCatId" value=-1>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class=color3 align=center colspan=2>',"\n";
|
||||
echo '<input type=submit value=" Submit New Version" class=button> </td></tr>',"\n";
|
||||
echo '<input type=submit value="Submit New Application" class="button"> </td></tr>',"\n";
|
||||
echo '</table>',"\n";
|
||||
|
||||
echo html_frame_end();
|
||||
|
||||
echo "</form>";
|
||||
}
|
||||
// new version
|
||||
else
|
||||
{
|
||||
echo html_frame_start("New Version Form",400,"",0);
|
||||
|
||||
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
|
||||
|
||||
// app parent
|
||||
$x = new TableVE("view");
|
||||
echo '<tr valign=top><td class=color0><b>Application</b></td><td>',"\n";
|
||||
$x->make_option_list("appId",$_REQUEST['appId'],"appFamily","appId","appName");
|
||||
echo '</td></tr>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class="color0"><b>Version name</b></td>',"\n";
|
||||
echo '<td><input type=text name="versionName" size="20"></td></tr>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class=color0><b>Version description</b></td>',"\n";
|
||||
echo '<td><p style="width:700px"><textarea cols="80" rows="20" id="editor" name="versionDescription">'.$sVersionDescription.'</textarea></p></td></tr>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class="color3" align="center" colspan="2">',"\n";
|
||||
echo '<input type=submit value="Submit New Version" class="button"> </td></tr>',"\n";
|
||||
|
||||
echo '</table>',"\n";
|
||||
|
||||
@@ -256,31 +249,5 @@ onload = function() {
|
||||
echo "</form>";
|
||||
}
|
||||
}
|
||||
|
||||
##########################
|
||||
# HOME PAGE OF APPSUBMIT #
|
||||
##########################
|
||||
else
|
||||
{
|
||||
if(!$_SESSION['current']->isLoggedIn())
|
||||
{
|
||||
// you must be logged in to submit app
|
||||
apidb_header("Please login");
|
||||
echo "To submit an application to the database you must be logged in. Please <a href=\"account.php?cmd=login\">login now</a> or create a <a href=\"account.php?cmd=new\">new account</a>.","\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
// choose type of app
|
||||
apidb_header("Choose Application Type");
|
||||
echo "Please search through the database first. If you cannot find your application in the database select ","\n";
|
||||
echo "<b>New Application</b>.","\n";
|
||||
echo "If you have found your application but have not found your version then choose <b>New Version</b>.","\n";
|
||||
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
|
||||
echo "<tr valign=top><td class=color0 align=center><a href='appsubmit.php?apptype=1'>New Application</a></td>","\n";
|
||||
echo "<td class=color0 align=center><a href='appsubmit.php?apptype=2'>New Version</a></td></tr>","\n";
|
||||
echo '</table>',"\n";
|
||||
}
|
||||
}
|
||||
|
||||
apidb_footer();
|
||||
?>
|
||||
|
||||
10
appview.php
10
appview.php
@@ -33,9 +33,11 @@ function display_catpath($catId, $appId, $versionId = '')
|
||||
|
||||
/**
|
||||
* display the SUB apps that belong to this app
|
||||
* FIXME:
|
||||
*/
|
||||
function display_bundle($appId)
|
||||
{
|
||||
$oApp = new Application($appId);
|
||||
$result = query_appdb("SELECT appFamily.appId, appName, description FROM appBundle, appFamily ".
|
||||
"WHERE bundleId = $appId AND appBundle.appId = appFamily.appId");
|
||||
if(!$result || mysql_num_rows($result) == 0)
|
||||
@@ -56,12 +58,10 @@ function display_bundle($appId)
|
||||
//set row color
|
||||
$bgcolor = ($c % 2 == 0) ? "color0" : "color1";
|
||||
|
||||
//format desc
|
||||
$aDesc = explode("\n",$oApp->data->description,2);
|
||||
//display row
|
||||
echo "<tr class=$bgcolor>\n";
|
||||
echo " <td><a href='appview.php?appId=$ob->appId'>".stripslashes($ob->appName)."</a></td>\n";
|
||||
echo " <td>".$aDesc[0]."</td>\n";
|
||||
echo " <td>".trim_description($oApp->sDescription)."</td>\n";
|
||||
echo "</tr>\n\n";
|
||||
|
||||
$c++;
|
||||
@@ -194,7 +194,7 @@ if($_REQUEST['appId'])
|
||||
display_catpath($oApp->iCatId, $oApp->iAppId);
|
||||
|
||||
// set Vendor
|
||||
$vendor = $oApp->iVendorId;
|
||||
$oVendor = new Vendor($oApp->iVendorId);
|
||||
|
||||
// set URL
|
||||
$appLinkURL = ($oApp->sWebpage) ? "<a href=\"$data->webPage\">".substr(stripslashes($oApp->sWebpage),0,30)."</a>": " ";
|
||||
@@ -209,7 +209,7 @@ if($_REQUEST['appId'])
|
||||
echo ' <table width="250" border=0 cellpadding=3 cellspacing=1">',"\n";
|
||||
echo " <tr class=color0 valign=top><td width=\"100\"><b>Name</b></td><td width='100%'> ".$oApp->sName." </td>\n";
|
||||
echo " <tr class=\"color1\"><td><b>Vendor</b></td><td> ".
|
||||
" <a href='vendorview.php?vendorId=$vendor->vendorId'> ".stripslashes($vendor->vendorName)." </a> \n";
|
||||
" <a href='vendorview.php?vendorId=$oVendor->iVendorId'> ".$oVendor->sName." </a> \n";
|
||||
echo " <tr class=\"color0\"><td><b>BUGS</b></td><td> ".
|
||||
" <a href=\"bugs.php?appId=".$oApp->iAppId."\">Check for bugs in bugzilla </a> \n";
|
||||
echo " </td></tr>\n";
|
||||
|
||||
@@ -61,10 +61,6 @@ function hasDataAssociated($iUserId)
|
||||
$hResult = query_appdb($sQuery);
|
||||
if(mysql_num_rows($hResult)) return true;
|
||||
|
||||
$sQuery = "SELECT * FROM appDataQueue WHERE userId = $iUserId";
|
||||
$hResult = query_appdb($sQuery);
|
||||
if(mysql_num_rows($hResult)) return true;
|
||||
|
||||
$sQuery = "SELECT * FROM appMaintainerQueue WHERE userId = $iUserId";
|
||||
$hResult = query_appdb($sQuery);
|
||||
if(mysql_num_rows($hResult)) return true;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
/* this class represents an application incl. all versions */
|
||||
/***********************************************************/
|
||||
|
||||
require(BASE."include/version.php");
|
||||
require(BASE."include/vendor.php");
|
||||
require_once(BASE."include/version.php");
|
||||
require_once(BASE."include/vendor.php");
|
||||
|
||||
/**
|
||||
* Application class for handling applications.
|
||||
@@ -19,6 +19,7 @@ class Application {
|
||||
var $sDescription;
|
||||
var $sWebpage;
|
||||
var $bQueued;
|
||||
var $sSubmitTime;
|
||||
var $iSubmitterId;
|
||||
var $aVersionsIds; // an array that contains the versionId of every version linked to this app.
|
||||
|
||||
@@ -47,6 +48,7 @@ class Application {
|
||||
$this->iVendorId = $oRow->vendorId;
|
||||
$this->iCatId = $oRow->catId;
|
||||
$this->iSubmitterId = $oRow->submitterId;
|
||||
$this->sSubmitTime = $oRow->submitTime;
|
||||
$this->sDate = $oRow->submitTime;
|
||||
$this->sName = $oRow->appName;
|
||||
$this->sKeywords = $oRow->keywords;
|
||||
@@ -104,6 +106,7 @@ class Application {
|
||||
'webPage' => $sWebpage,
|
||||
'vendorId' => $iVendorId,
|
||||
'catId' => $iCatId,
|
||||
'submitterId'=> $_REQUEST['current']->iUserId,
|
||||
'queued' => $this->bQueued ));
|
||||
$sFields = "({$aInsert['FIELDS']})";
|
||||
$sValues = "({$aInsert['VALUES']})";
|
||||
@@ -123,34 +126,36 @@ class Application {
|
||||
/**
|
||||
* Update application.
|
||||
* FIXME: Informs interested people about the modification.
|
||||
* FIXME: tell what changed in the email.
|
||||
* FIXME: get rid of addslashes and use compile_update_string
|
||||
* Returns true on success and false on failure.
|
||||
*/
|
||||
function update($sName=null, $sDescription=null, $sKeywords=null, $sWebpage=null, $iVendorId=null, $iCatId=null)
|
||||
{
|
||||
if ($sName)
|
||||
{
|
||||
if (!query_appdb("UPDATE appFamily SET appName = '".$sName."' WHERE appId = ".$this->iAppId))
|
||||
if (!query_appdb("UPDATE appFamily SET appName = '".addslashes($sName)."' WHERE appId = ".$this->iAppId))
|
||||
return false;
|
||||
$this->sName = $sName;
|
||||
}
|
||||
|
||||
if ($sDescription)
|
||||
{
|
||||
if (!query_appdb("UPDATE appFamily SET description = '".$sDescription."' WHERE appId = ".$this->iAppId))
|
||||
if (!query_appdb("UPDATE appFamily SET description = '".addslashes($sDescription)."' WHERE appId = ".$this->iAppId))
|
||||
return false;
|
||||
$this->sDescription = $sDescription;
|
||||
}
|
||||
|
||||
if ($sKeywords)
|
||||
{
|
||||
if (!query_appdb("UPDATE appFamily SET keywords = '".$sKeywords."' WHERE appId = ".$this->iAppId))
|
||||
if (!query_appdb("UPDATE appFamily SET keywords = '".addslashes($sKeywords)."' WHERE appId = ".$this->iAppId))
|
||||
return false;
|
||||
$this->sKeywords = $sKeywords;
|
||||
}
|
||||
|
||||
if ($sWebpage)
|
||||
{
|
||||
if (!query_appdb("UPDATE appFamily SET webPage = '".$sWebpage."' WHERE appId = ".$this->iAppId))
|
||||
if (!query_appdb("UPDATE appFamily SET webPage = '".addslashes($sWebpage)."' WHERE appId = ".$this->iAppId))
|
||||
return false;
|
||||
$this->sWebpage = $sWebpage;
|
||||
}
|
||||
@@ -161,6 +166,13 @@ class Application {
|
||||
return false;
|
||||
$this->iVendorId = $iVendorId;
|
||||
}
|
||||
|
||||
if ($iCatId)
|
||||
{
|
||||
if (!query_appdb("UPDATE appFamily SET catId = '".$iCatId."' WHERE appId = ".$this->iAppId))
|
||||
return false;
|
||||
$this->iCatId = $iCatId;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -196,8 +208,9 @@ class Application {
|
||||
if(!$this->bQueued)
|
||||
return false;
|
||||
|
||||
$sUpdate = compile_insert_string(array('queued' => "false"));
|
||||
if(query_appdb("UPDATE appFamily ".$sUpdate))
|
||||
$sUpdate = compile_update_string(array('queued' => "false",
|
||||
'keywords'=> str_replace(" *** ","",$this->sKeywords) ));
|
||||
if(query_appdb("UPDATE appFamily SET ".$sUpdate." WHERE appId = ".$this->iAppId))
|
||||
{
|
||||
// we send an e-mail to intersted people
|
||||
$this->mailSubmitter();
|
||||
@@ -258,8 +271,7 @@ class Application {
|
||||
$sSubject = "Application ".$this->sName." deleted by ".$_SESSION['current']->sRealname;
|
||||
addmsg("Application deleted.", "green");
|
||||
}
|
||||
|
||||
$sEmail = get_notify_email_address_list(null, $this->iVersionId);
|
||||
$sEmail = get_notify_email_address_list($this->iAppId);
|
||||
if($sEmail)
|
||||
mail_appdb($sEmail, $sSubject ,$sMsg);
|
||||
}
|
||||
|
||||
@@ -203,14 +203,16 @@ function make_cat_path($path, $appId = '', $versionId = '')
|
||||
|
||||
if(!empty($appId))
|
||||
{
|
||||
$oApp = new Application($appId);
|
||||
if(!empty($versionId))
|
||||
{
|
||||
$str .= " > ".html_ahref(lookup_app_name($appId),"appview.php?appId=$appId");
|
||||
$str .= " > ".lookup_version_name($versionId);
|
||||
$oVersion = new Version($versionId);
|
||||
$str .= " > ".html_ahref($oApp->sName,"appview.php?appId=$appId");
|
||||
$str .= " > ".$oVersion->sName;
|
||||
}
|
||||
else
|
||||
{
|
||||
$str .= " > ".lookup_app_name($appId);
|
||||
$str .= " > ".$oApp->sName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ function global_sidebar_menu() {
|
||||
$g->add("AppDB Home", BASE);
|
||||
$g->add("Browse Apps", BASE."appbrowse.php");
|
||||
$g->add("Top 25", BASE."votestats.php");
|
||||
$g->add("Submit App", BASE."appsubmit.php");
|
||||
$g->add("Submit App", BASE."appsubmit.php?apptype=1");
|
||||
$g->add("Documentation", BASE."help/");
|
||||
$g->add("Help & Support", BASE."support.php");
|
||||
$g->add("Appdb Stats", BASE."appdbStats.php");
|
||||
|
||||
@@ -128,25 +128,25 @@ function make_maintainer_rating_list($varname, $cvalue)
|
||||
echo "</select>\n";
|
||||
}
|
||||
|
||||
/* get the number of applications in the appQueue table */
|
||||
/* get the number of queued applications */
|
||||
function getQueuedAppCount()
|
||||
{
|
||||
$qstring = "SELECT count(*) as queued_apps FROM appQueue";
|
||||
$qstring = "SELECT count(*) as queued_apps FROM appFamily WHERE queued='true'";
|
||||
$result = query_appdb($qstring);
|
||||
$ob = mysql_fetch_object($result);
|
||||
return $ob->queued_apps;
|
||||
}
|
||||
|
||||
/* get the number of applications in the appQueue table */
|
||||
/* get the number of queued appdata */
|
||||
function getQueuedAppDataCount()
|
||||
{
|
||||
$qstring = "SELECT count(*) as queued_appdata FROM appDataQueue";
|
||||
$qstring = "SELECT count(*) as queued_appdata FROM appData WHERE queued='true'";
|
||||
$result = query_appdb($qstring);
|
||||
$ob = mysql_fetch_object($result);
|
||||
return $ob->queued_appdata;
|
||||
}
|
||||
|
||||
/* get the number of applications in the appQueue table */
|
||||
/* get the number of queued maintainers */
|
||||
function getQueuedMaintainerCount()
|
||||
{
|
||||
$qstring = "SELECT count(*) as queued_maintainers FROM appMaintainerQueue";
|
||||
|
||||
@@ -13,7 +13,9 @@ class Version {
|
||||
var $sDescription;
|
||||
var $sTestedRelease;
|
||||
var $sTestedRating;
|
||||
var $sSubmitTime;
|
||||
var $iSubmitterId;
|
||||
var $sDate;
|
||||
var $aNotesIds; // an array that contains the noteId of every note linked to this version
|
||||
var $aScreenshotsIds; // an array that contains the screenshotId of every screenshot linked to this version
|
||||
var $aUrlsIds; // an array that contains the screenshotId of every url linked to this version
|
||||
@@ -42,6 +44,7 @@ class Version {
|
||||
$this->iVendorId = $oRow->vendorId;
|
||||
$this->iCatId = $oRow->catId;
|
||||
$this->iSubmitterId = $oRow->submitterId;
|
||||
$this->sSubmitTime = $oRow->submitTime;
|
||||
$this->sDate = $oRow->submitTime;
|
||||
$this->sName = $oRow->versionName;
|
||||
$this->sKeywords = $oRow->keywords;
|
||||
@@ -206,8 +209,8 @@ class Version {
|
||||
if(!$this->bQueued)
|
||||
return false;
|
||||
|
||||
$sUpdate = compile_insert_string(array('queued' => "false"));
|
||||
if(query_appdb("UPDATE appVersion ".$sUpdate))
|
||||
$sUpdate = compile_update_string(array('queued' => "false"));
|
||||
if(query_appdb("UPDATE appVersion SET ".$sUpdate." WHERE versionId = ".$this->iVersionId))
|
||||
{
|
||||
// we send an e-mail to intersted people
|
||||
$this->mailSubmitter();
|
||||
|
||||
@@ -41,9 +41,12 @@ if($_REQUEST['cmd'])
|
||||
*/
|
||||
$hResult = get_screenshots($_REQUEST['appId'], $_REQUEST['versionId']);
|
||||
apidb_header("Screenshots");
|
||||
$oApp = new Application($_REQUEST['appId']);
|
||||
$oVersion = new Version($_REQUEST['versionId']);
|
||||
|
||||
if($hResult && mysql_num_rows($hResult))
|
||||
{
|
||||
echo html_frame_start("Screenshot Gallery for ".lookup_app_name($_REQUEST['appId'])." ".lookup_version_name($_REQUEST['versionId']),500);
|
||||
echo html_frame_start("Screenshot Gallery for ".$oApp->sName." ".$oVersion->sName,500);
|
||||
|
||||
// display thumbnails
|
||||
$c = 1;
|
||||
|
||||
@@ -11,8 +11,6 @@ drop table if exists appHitStats;
|
||||
drop table if exists catHitStats;
|
||||
drop table if exists appComments;
|
||||
drop table if exists appData;
|
||||
drop table if exists appDataQueue;
|
||||
drop table if exists appQueue;
|
||||
drop table if exists appBundle;
|
||||
drop table if exists appVotes;
|
||||
drop table if exists appNotes;
|
||||
@@ -41,6 +39,9 @@ create table appFamily (
|
||||
description text,
|
||||
webPage varchar(100),
|
||||
catId int,
|
||||
submitTime timestamp(14) NOT NULL,
|
||||
submitterId int(11) NOT NULL default '0',
|
||||
queued enum('true','false') NOT NULL default 'false',
|
||||
key(appId)
|
||||
);
|
||||
|
||||
@@ -55,22 +56,12 @@ create table appVersion (
|
||||
description text,
|
||||
maintainer_rating text,
|
||||
maintainer_release text,
|
||||
submitTime timestamp(14) NOT NULL,
|
||||
submitterId int(11) NOT NULL default '0',
|
||||
queued enum('true','false') NOT NULL default 'false',
|
||||
key(versionId)
|
||||
);
|
||||
|
||||
create table appQueue (
|
||||
queueId int not null auto_increment,
|
||||
queueName varchar(100) not null,
|
||||
queueVersion varchar(100) not null,
|
||||
queueVendor varchar(100) not null,
|
||||
queueDesc text,
|
||||
queueEmail varchar(100),
|
||||
queueURL varchar(100),
|
||||
queueImage varchar(100) not null,
|
||||
submitTime timestamp,
|
||||
queueCatId int,
|
||||
key(queueId)
|
||||
);
|
||||
|
||||
create table userExperience (
|
||||
uExpId int not null auto_increment,
|
||||
@@ -158,27 +149,12 @@ create table appData (
|
||||
versionId int default 0,
|
||||
type enum('image', 'url', 'bug'),
|
||||
description text,
|
||||
url varchar(255),
|
||||
key(id),
|
||||
index(appId),
|
||||
index(versionId)
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* links to screenshots and other stuff waiting to be accepted
|
||||
*/
|
||||
create table appDataQueue (
|
||||
queueId int not null auto_increment,
|
||||
versionId int default 0,
|
||||
type enum('image', 'url'),
|
||||
description text,
|
||||
url varchar(255),
|
||||
userId int not null,
|
||||
submitTime timestamp,
|
||||
key(queueid),
|
||||
index(appId),
|
||||
index(versionId)
|
||||
url varchar(255) default NULL,
|
||||
submitTime timestamp(14) NOT NULL,
|
||||
submitterId int(11) NOT NULL default '0',
|
||||
queued enum('true','false') NOT NULL default 'false',
|
||||
KEY id (id),
|
||||
KEY versionId (versionId)
|
||||
);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user