From 0074b6d54e2d753a5a83965def84571bcdc69214 Mon Sep 17 00:00:00 2001 From: mensonge Date: Thu, 11 Sep 2008 16:53:16 +0000 Subject: Bug fix: add admin page git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@147 b3834d28-1941-0410-a4f8-b48e95affb8f --- AUTHORS | 14 ++++++++++-- admin.php | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 admin.php diff --git a/AUTHORS b/AUTHORS index a45e1e7..cb1f890 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,4 +1,4 @@ -Scuttle contains code from the following applications: +Scuttle and SemanticScuttle contain codes from the following applications: ------------ GPL Licenced @@ -15,4 +15,14 @@ UTF8 Helper Functions Andreas Gohr XSPF Web Music Player (Flash) -http://musicplayer.sourceforge.net/ \ No newline at end of file +http://musicplayer.sourceforge.net/ + + +---- + +Patches were realised by : + +* Simple Admin-Interface for deleting unwanted users +Idea of the patch from Andreas Jaggi, for details visit: +http://sourceforge.net/tracker/index.php?func=detail&aid=1543065&group_id=134378&atid=729862 +Adaptation by Andreas Keller (aka Arakel) http://akeller.eu for Takuya Misawa. diff --git a/admin.php b/admin.php new file mode 100644 index 0000000..c5563f6 --- /dev/null +++ b/admin.php @@ -0,0 +1,78 @@ +isLoggedOn() ) { + header('Location: '. createURL('login', '')); + exit(); +} + +$currentUser = $userservice->getCurrentUser(); +$currentUserID = $userservice->getCurrentUserId(); +$currentUsername = $currentUser[$userservice->getFieldName('username')]; + +if ( !$userservice->isAdmin($currentUserID) ) { + header('Location: '. createURL('bookmarks', $currentUsername)); + exit(); +} + +@list($url, $action, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL; + +if ( $action ) { + switch ( $action ) { + case 'delete': + if ( $user && ($userinfo = $userservice->getUserByUsername($user)) ) { + $uId = $userinfo['uId']; + + $tag2tagservice->removeLinkedTags('','','',$uId); + $userservice->deleteUser($uId); + $bookmark2tagservice->deleteTagsForUser($uId); + // XXX: don't delete bookmarks before tags, else tags can't be deleted !!! + $bookmarkservice->deleteBookmarksForUser($uId); + + $tplVars['msg'] = sprintf(T_('%s and all his bookmarks and tags were deleted.'), $user); + } + break; + default: + // DO NOTHING + } +} + +$templatename = 'userlist.tpl'; +$users =& $userservice->getAllUsers(); + +if ( !is_array($users) ) { + $users = array(); +} + +$tplVars['users'] =& $users; + +$templateservice->loadTemplate($templatename, $tplVars); +?> -- cgit v1.2.3