From 7fb5a034c4c2756ff47bf9346d33599f7772bd8c Mon Sep 17 00:00:00 2001 From: Paul van Schayck Date: Fri, 31 Dec 2004 00:30:00 +0000 Subject: [PATCH] Remove appOwners code. We're now using mantainers --- admin/editAppFamily.php | 2 +- admin/editAppOwners.php | 120 ---------------------------------------- appview.php | 20 +------ include/user.php | 14 ----- noteview.php | 58 ------------------- tables/appdb_tables.sql | 12 ---- 6 files changed, 2 insertions(+), 224 deletions(-) delete mode 100644 admin/editAppOwners.php delete mode 100644 noteview.php diff --git a/admin/editAppFamily.php b/admin/editAppFamily.php index 5ec46ab..2808231 100644 --- a/admin/editAppFamily.php +++ b/admin/editAppFamily.php @@ -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; diff --git a/admin/editAppOwners.php b/admin/editAppOwners.php deleted file mode 100644 index e1892f8..0000000 --- a/admin/editAppOwners.php +++ /dev/null @@ -1,120 +0,0 @@ -\n"; - while($ob = mysql_fetch_object($result)) - { - echo "\n"; - } - echo "\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 "\n\n"; - - echo "\n"; - echo " \n"; - echo " \n"; - echo "\n\n"; - - $c = 1; - while($ob = mysql_fetch_object($result)) - { - //set row color - if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; } - - $delete_link = "[delete]"; - - echo "\n"; - echo " \n"; - echo " \n"; - echo "\n\n"; - - $c++; - } - - echo "
User Name Delete
$ob->username  $delete_link  
\n\n"; - echo html_frame_end(); - - } - - echo "
\n"; - - echo html_frame_start("Manually Add User","300",'',5); - echo "\n"; - echo "\n"; - echo html_frame_end(); - - - echo html_frame_start("User List","",'',2); - build_user_list(); - echo html_frame_end(); - - echo "\n"; - echo "\n"; - echo "
\n"; - - apidb_footer(); -} - - -?> diff --git a/appview.php b/appview.php index 7288c25..0d1376e 100644 --- a/appview.php +++ b/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 "$img\n"; - // display app owner - $result = mysql_query("SELECT * FROM appOwners WHERE appId = $appId"); - if($result && mysql_num_rows($result) > 0) - { - echo " Owner\n"; - echo " \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 " \n"; - } echo " \n"; /* close of name/vendor/bugs/url table */ echo " \n"; diff --git a/include/user.php b/include/user.php index 6eb7d23..352d995 100644 --- a/include/user.php +++ b/include/user.php @@ -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) diff --git a/noteview.php b/noteview.php deleted file mode 100644 index a2d6d1d..0000000 --- a/noteview.php +++ /dev/null @@ -1,58 +0,0 @@ -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(); - -?> diff --git a/tables/appdb_tables.sql b/tables/appdb_tables.sql index bf2bb27..22005f9 100644 --- a/tables/appdb_tables.sql +++ b/tables/appdb_tables.sql @@ -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 */