aboutsummaryrefslogtreecommitdiff
path: root/www/admin.php
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-10-03 21:52:30 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-10-03 21:52:30 +0000
commitd5f09b7e4d802cdc2d5f3f876c48ea918c961488 (patch)
treeaa1eb37219c17bef03b1515e5074b4743f89a9a3 /www/admin.php
parentb7345f833dea849e94f2ce23fdbe6ab58ba98be3 (diff)
downloadsemanticscuttle-d5f09b7e4d802cdc2d5f3f876c48ea918c961488.tar.gz
semanticscuttle-d5f09b7e4d802cdc2d5f3f876c48ea918c961488.tar.bz2
make the application work again
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@388 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'www/admin.php')
-rw-r--r--www/admin.php144
1 files changed, 72 insertions, 72 deletions
diff --git a/www/admin.php b/www/admin.php
index b57b568..37ebe4b 100644
--- a/www/admin.php
+++ b/www/admin.php
@@ -1,71 +1,71 @@
-<?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');
+<?php
+/***************************************************************************
+ Copyright (C) 2007 - 2008 SemanticScuttle project (fork from Scuttle)
+ http://sourceforge.net/projects/semanticscuttle/
-/* Service creation: only useful services are created */
-$bookmark2tagservice = & ServiceFactory :: getServiceInstance('Bookmark2Tagservice');
-$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService');
-$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService');
-$tagcacheservice = & ServiceFactory :: getServiceInstance('TagCacheService');
-$commondescriptionservice = & ServiceFactory :: getServiceInstance('CommonDescriptionService');
-$searchhistoryservice = & ServiceFactory :: getServiceInstance('SearchHistoryService');
-$tagstatservice = & ServiceFactory :: getServiceInstance('TagStatService');
-
-// Header variables
-$tplVars['subtitle'] = T_('Manage users');
+ 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 '../src/SemanticScuttle/header.php';
+
+/* Service creation: only useful services are created */
+$bookmark2tagservice = SemanticScuttle_Service_Factory :: getServiceInstance('Bookmark2Tagservice');
+$bookmarkservice = SemanticScuttle_Service_Factory :: getServiceInstance('Bookmark');
+$tag2tagservice = SemanticScuttle_Service_Factory :: getServiceInstance('Tag2Tag');
+$tagcacheservice = SemanticScuttle_Service_Factory :: getServiceInstance('TagCache');
+$commondescriptionservice = SemanticScuttle_Service_Factory :: getServiceInstance('CommonDescription');
+$searchhistoryservice = SemanticScuttle_Service_Factory :: getServiceInstance('SearchHistory');
+$tagstatservice = SemanticScuttle_Service_Factory :: getServiceInstance('TagStat');
+
+// Header variables
+$tplVars['subtitle'] = T_('Manage users');
$tplVars['loadjs'] = true;
$tplVars['sidebar_blocks'] = array('users' );
$tplVars['error'] = '';
-$tplVars['msg'] = '';
-
-if ( !$userservice->isLoggedOn() ) {
- header('Location: '. createURL('login', ''));
- exit();
+$tplVars['msg'] = '';
+
+if ( !$userservice->isLoggedOn() ) {
+ header('Location: '. createURL('login', ''));
+ exit();
}
-
-if ( !$currentUser->isAdmin() ) {
- header('Location: '. createURL('bookmarks', $currentUser->getUsername()));
- exit();
-}
-
+
+if ( !$currentUser->isAdmin() ) {
+ header('Location: '. createURL('bookmarks', $currentUser->getUsername()));
+ exit();
+}
+
@list($url, $action, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL;
-
+
if ( $action
&& (strpos($_SERVER['HTTP_REFERER'], ROOT.'admin') === 0) // Prevent CSRF attacks
-) {
- switch ( $action ) {
- case 'delete':
- if ( $user && ($userinfo = $userservice->getUserByUsername($user)) ) {
- $uId = $userinfo['uId'];
+) {
+ switch ( $action ) {
+ case 'delete':
+ if ( $user && ($userinfo = $userservice->getUserByUsername($user)) ) {
+ $uId = $userinfo['uId'];
$tagcacheservice->deleteByUser($uId);
- $tag2tagservice->removeLinkedTagsForUser($uId);
- $userservice->deleteUser($uId);
+ $tag2tagservice->removeLinkedTagsForUser($uId);
+ $userservice->deleteUser($uId);
$bookmark2tagservice->deleteTagsForUser($uId);
$commondescriptionservice->deleteDescriptionsForUser($uId);
$searchhistoryservice->deleteSearchHistoryForUser($uId);
- $tagstatservice->deleteTagStatForUser($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);
+ $tagstatservice->deleteTagStatForUser($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;
case 'checkUrl' :
@@ -74,21 +74,21 @@ if ( $action
if(!checkUrl($bookmark['bAddress'])) {
$tplVars['error'].= T_('Problem with ').$bookmark['bAddress'].' ('. $bookmark['username'] .')<br/>';
}
- }
- break;
- default:
- // DO NOTHING
- }
-}
-
-$templatename = 'admin.tpl';
-$users =& $userservice->getObjectUsers();
-
-if ( !is_array($users) ) {
- $users = array();
-}
-
-$tplVars['users'] =& $users;
-
-$templateservice->loadTemplate($templatename, $tplVars);
+ }
+ break;
+ default:
+ // DO NOTHING
+ }
+}
+
+$templatename = 'admin.tpl';
+$users =& $userservice->getObjectUsers();
+
+if ( !is_array($users) ) {
+ $users = array();
+}
+
+$tplVars['users'] =& $users;
+
+$templateservice->loadTemplate($templatename, $tplVars);
?>