Bug fix: add admin page
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@147 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
parent
1d059dc06d
commit
0074b6d54e
2 changed files with 90 additions and 2 deletions
12
AUTHORS
12
AUTHORS
|
@ -1,4 +1,4 @@
|
||||||
Scuttle contains code from the following applications:
|
Scuttle and SemanticScuttle contain codes from the following applications:
|
||||||
|
|
||||||
------------
|
------------
|
||||||
GPL Licenced
|
GPL Licenced
|
||||||
|
@ -16,3 +16,13 @@ Andreas Gohr <andi@splitbrain.org>
|
||||||
|
|
||||||
XSPF Web Music Player (Flash)
|
XSPF Web Music Player (Flash)
|
||||||
http://musicplayer.sourceforge.net/
|
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.
|
||||||
|
|
78
admin.php
Normal file
78
admin.php
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
<?php
|
||||||
|
/***************************************************************************
|
||||||
|
Copyright (C) 2007 - 2008 SemanticScuttle project (fork from Scuttle)
|
||||||
|
http://sourceforge.net/projects/semanticscuttle/
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
require_once('header.inc.php');
|
||||||
|
|
||||||
|
$userservice = & ServiceFactory :: getServiceInstance('UserService');
|
||||||
|
$bookmark2tagservice = & ServiceFactory :: getServiceInstance('Bookmark2Tagservice');
|
||||||
|
$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService');
|
||||||
|
$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService');
|
||||||
|
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
|
||||||
|
|
||||||
|
// Header variables
|
||||||
|
$tplVars['subtitle'] = T_('Manage users');
|
||||||
|
$tplVars['loadjs'] = true;
|
||||||
|
|
||||||
|
if ( !$userservice->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);
|
||||||
|
?>
|
Loading…
Reference in a new issue