Remove appOwners code. We're now using mantainers
This commit is contained in:
@@ -6,7 +6,7 @@ include(BASE."include/"."incl.php");
|
||||
include(BASE."include/"."tableve.php");
|
||||
include(BASE."include/"."qclass.php");
|
||||
|
||||
if(!loggedin() || (!havepriv("admin") && !$_SESSION['current']->ownsApp($appId)) )
|
||||
if(!(havepriv("admin") || $_SESSION['current']->is_super_maintainer($_REQUEST['appId'])))
|
||||
{
|
||||
errorpage("Insufficient Privileges!");
|
||||
exit;
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
include("path.php");
|
||||
include(BASE."include/"."incl.php");
|
||||
|
||||
if(!havepriv("admin"))
|
||||
{
|
||||
errorpage("Insufficient Privileges","You do not have access to this section of the website");
|
||||
exit;
|
||||
}
|
||||
|
||||
function build_user_list()
|
||||
{
|
||||
$result = mysql_query("SELECT username,email FROM user_list ORDER BY username");
|
||||
|
||||
echo "<select name=username size=15 onChange='this.form.ownerName.value = this.value; this.form.submit()'>\n";
|
||||
while($ob = mysql_fetch_object($result))
|
||||
{
|
||||
echo "<option value='$ob->username'>$ob->username - $ob->email</option>\n";
|
||||
}
|
||||
echo "</select>\n";
|
||||
}
|
||||
|
||||
|
||||
if($cmd)
|
||||
{
|
||||
if($cmd == "delete")
|
||||
{
|
||||
$result = mysql_query("DELETE FROM appOwners WHERE appId = $appId AND ownerId = $ownerId");
|
||||
if($result)
|
||||
{
|
||||
addmsg("Owner deleted", "green");
|
||||
redirectref();
|
||||
}
|
||||
else
|
||||
echo "Failed: " . mysql_error();
|
||||
}
|
||||
if($cmd == "add")
|
||||
{
|
||||
$result = mysql_query("SELECT userid FROM user_list WHERE username = '$ownerName'");
|
||||
if($result)
|
||||
{
|
||||
$ob = mysql_fetch_object($result);
|
||||
if(!$ob || !$ob->userid)
|
||||
{
|
||||
errorpage("Not Found!","User $ownerName was not found in the database");
|
||||
exit;
|
||||
}
|
||||
$result = mysql_query("INSERT INTO appOwners VALUES ($appId, $ob->userid)");
|
||||
if(!$result)
|
||||
{
|
||||
errorpage("Failed!",mysql_error());
|
||||
exit;
|
||||
}
|
||||
addmsg("Owner $ownerName added", "green");
|
||||
redirectref();
|
||||
}
|
||||
else
|
||||
echo "Failed: " . mysql_error();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
apidb_header("Edit Application Owners");
|
||||
|
||||
$result = mysql_query("SELECT ownerId,username FROM appOwners, user_list WHERE appId = $appId AND userid = ownerId");
|
||||
|
||||
if($result && mysql_num_rows($result))
|
||||
{
|
||||
echo html_frame_start("Current Owners","300",'',0);
|
||||
echo "<table width='100%' border=0 cellpadding=3 cellspacing=0>\n\n";
|
||||
|
||||
echo "<tr class=color4>\n";
|
||||
echo " <td><font color=white> User Name </font></td>\n";
|
||||
echo " <td><font color=white> Delete </font></td>\n";
|
||||
echo "</tr>\n\n";
|
||||
|
||||
$c = 1;
|
||||
while($ob = mysql_fetch_object($result))
|
||||
{
|
||||
//set row color
|
||||
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
|
||||
|
||||
$delete_link = "[<a href='editAppOwners.php?cmd=delete&appId=$appId&ownerId=$ob->ownerId'>delete</a>]";
|
||||
|
||||
echo "<tr class=$bgcolor>\n";
|
||||
echo " <td>$ob->username </td>\n";
|
||||
echo " <td>$delete_link </td>\n";
|
||||
echo "</tr>\n\n";
|
||||
|
||||
$c++;
|
||||
}
|
||||
|
||||
echo "</table>\n\n";
|
||||
echo html_frame_end();
|
||||
|
||||
}
|
||||
|
||||
echo "<form method=post action=editAppOwners.php>\n";
|
||||
|
||||
echo html_frame_start("Manually Add User","300",'',5);
|
||||
echo "<input type=text name=ownerName size=15>\n";
|
||||
echo "<input type=submit value=' Add User ' class=button>\n";
|
||||
echo html_frame_end();
|
||||
|
||||
|
||||
echo html_frame_start("User List","",'',2);
|
||||
build_user_list();
|
||||
echo html_frame_end();
|
||||
|
||||
echo "<input type=hidden name=appId value=$appId>\n";
|
||||
echo "<input type=hidden name=cmd value=add>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
apidb_footer();
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
20
appview.php
20
appview.php
@@ -45,7 +45,6 @@ function admin_menu()
|
||||
$url = BASE."admin/deleteAny.php?what=appFamily&appId=".$_REQUEST['appId']."&confirmed=yes";
|
||||
$m->add("Delete App", "javascript:deleteURL(\"Are you sure?\", \"".$url."\")");
|
||||
$m->addmisc(" ");
|
||||
$m->add("Edit Owners", BASE."admin/editAppOwners.php?appId=".$_REQUEST['appId']);
|
||||
$m->add("Edit Bundle", BASE."admin/editBundle.php?bundleId=".$_REQUEST['appId']);
|
||||
}
|
||||
}
|
||||
@@ -247,7 +246,7 @@ if($appId && !$versionId)
|
||||
apidb_sidebar_add("vote_menu");
|
||||
|
||||
// show Admin Menu
|
||||
if(loggedin() && (havepriv("admin") || $_SESSION['current']->ownsApp($appId)))
|
||||
if(loggedin() && ((havepriv("admin") || $_SESSION['current']->is_super_maintainer($appId))))
|
||||
apidb_sidebar_add("admin_menu");
|
||||
|
||||
// header
|
||||
@@ -299,23 +298,6 @@ if($appId && !$versionId)
|
||||
$img = get_screenshot_img($appId);
|
||||
echo "<tr><td align=center colspan=2>$img</td></tr>\n";
|
||||
|
||||
// display app owner
|
||||
$result = mysql_query("SELECT * FROM appOwners WHERE appId = $appId");
|
||||
if($result && mysql_num_rows($result) > 0)
|
||||
{
|
||||
echo " <tr class=color0><td valign=top align=right> <b>Owner</b></td>\n";
|
||||
echo " <td>\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 " <a href='mailto:$foo->email'>".substr(stripslashes($foo->username),0,30)."</a> <br />\n";
|
||||
}
|
||||
}
|
||||
echo " </td></tr>\n";
|
||||
}
|
||||
echo " </table>\n"; /* close of name/vendor/bugs/url table */
|
||||
|
||||
echo " </td></tr>\n";
|
||||
|
||||
@@ -272,23 +272,9 @@ class User {
|
||||
$result = mysql_query("DELETE FROM user_privs WHERE userid = $this->userid AND priv = '$priv'");
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* App Owners
|
||||
*
|
||||
*/
|
||||
function ownsApp($appId)
|
||||
{
|
||||
$result = mysql_query("SELECT * FROM appOwners WHERE ownerId = $this->userid AND appId = $appId");
|
||||
if($result && mysql_num_rows($result))
|
||||
return 1; // OK
|
||||
return 0; // NOPE!
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function loggedin()
|
||||
{
|
||||
if(isset($_SESSION['current']) && $_SESSION['current']->userid)
|
||||
|
||||
58
noteview.php
58
noteview.php
@@ -1,58 +0,0 @@
|
||||
<?php
|
||||
/***************/
|
||||
/* note viewer */
|
||||
/***************/
|
||||
|
||||
/*
|
||||
* application environment
|
||||
*/
|
||||
include("path.php");
|
||||
require(BASE."include/"."incl.php");
|
||||
|
||||
function admin_menu()
|
||||
{
|
||||
global $noteId;
|
||||
|
||||
$m = new htmlmenu("Admin");
|
||||
$m->add("Edit this Note", BASE."admin/editAppNote.php?noteId=$noteId");
|
||||
$m->done();
|
||||
}
|
||||
|
||||
//do query
|
||||
$result = mysql_query("SELECT noteTitle, noteDesc FROM appNotes WHERE noteId = $noteId");
|
||||
$ob = mysql_fetch_object($result);
|
||||
|
||||
//die if error
|
||||
if(!$result || mysql_num_rows($result) == 0)
|
||||
{
|
||||
// error
|
||||
errorpage("No Note Found","The selected note was not found.");
|
||||
exit;
|
||||
}
|
||||
|
||||
//display admin menu
|
||||
if(loggedin() && (havepriv("admin") || $_SESSION['current']->ownsApp($appId))) {
|
||||
apidb_sidebar_add("admin_menu");
|
||||
}
|
||||
|
||||
//show page
|
||||
apidb_header();
|
||||
|
||||
echo html_frame_start("View Note - $ob->noteTitle ","80%");
|
||||
|
||||
echo add_br(stripslashes($ob->noteDesc));
|
||||
|
||||
echo html_frame_end();
|
||||
|
||||
if ($versionId)
|
||||
{
|
||||
echo html_back_link(1,"appview.php?appId=$appId&versionId=$versionId");
|
||||
}
|
||||
else
|
||||
{
|
||||
echo html_back_link(1,"appview.php?appId=$appId");
|
||||
}
|
||||
|
||||
apidb_footer();
|
||||
|
||||
?>
|
||||
@@ -10,7 +10,6 @@ drop table if exists apiUsage;
|
||||
drop table if exists appCategory;
|
||||
drop table if exists appHitStats;
|
||||
drop table if exists catHitStats;
|
||||
drop table if exists appOwners;
|
||||
drop table if exists appComments;
|
||||
drop table if exists appData;
|
||||
drop table if exists appDataQueue;
|
||||
@@ -154,17 +153,6 @@ create table catHitStats (
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* application <> owner mapping
|
||||
*/
|
||||
create table appOwners (
|
||||
appId int not null,
|
||||
ownerId int not null,
|
||||
key(appId)
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* user comments
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user