Major refactoring: transform user into object, define parameters used into each file, ...

git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@173 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
mensonge 2008-11-25 15:57:29 +00:00
parent 9aafe7551e
commit 15b91c7e66
51 changed files with 2247 additions and 1820 deletions

View file

@ -19,6 +19,8 @@
***************************************************************************/
require_once('header.inc.php');
/* Service creation: only useful services are created */
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$tplVars = array();

View file

@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
require_once('header.inc.php');
/* Service creation: only useful services are created */
$userservice = & ServiceFactory :: getServiceInstance('UserService');
$bookmark2tagservice = & ServiceFactory :: getServiceInstance('Bookmark2Tagservice');
$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService');
@ -28,18 +29,20 @@ $templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
// Header variables
$tplVars['subtitle'] = T_('Manage users');
$tplVars['loadjs'] = true;
$tplVars['sidebar_blocks'] = array('users' );
if ( !$userservice->isLoggedOn() ) {
header('Location: '. createURL('login', ''));
exit();
}
$currentUser = $userservice->getCurrentUser();
$currentUserID = $userservice->getCurrentUserId();
$currentUsername = $currentUser[$userservice->getFieldName('username')];
//$currentUser = $userservice->getCurrentUser();
//$currentUserID = $userservice->getCurrentUserId();
//$currentUsername = $currentUser[$userservice->getFieldName('username')];
$currentObjectUser = $userservice->getCurrentObjectUser();
if ( !$userservice->isAdmin($currentUserID) ) {
header('Location: '. createURL('bookmarks', $currentUsername));
if ( !$currentObjectUser->isAdmin() ) {
header('Location: '. createURL('bookmarks', $currentObjectUser->getUsername()));
exit();
}
@ -66,7 +69,7 @@ if ( $action ) {
}
$templatename = 'userlist.tpl';
$users =& $userservice->getAllUsers();
$users =& $userservice->getObjectUsers();
if ( !is_array($users) ) {
$users = array();

View file

@ -24,8 +24,15 @@ header('Last-Modified: '. gmdate("D, d M Y H:i:s") .' GMT');
header('Cache-Control: no-cache, must-revalidate');
require_once('header.inc.php');
/* Service creation: only useful services are created */
$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService');
$bookmark = intval($_GET['id']);
/* Managing all possible inputs */
isset($_GET['id']) ? define('GET_ID', $_GET['id']): define('GET_ID', '');
$bookmark = intval(GET_ID);
if (!$bookmarkservice->editAllowed($bookmark)) {
$result = T_('You are not allowed to delete this bookmark');
} elseif ($bookmarkservice->deleteBookmark($bookmark)) {

View file

@ -25,6 +25,9 @@ header("Cache-Control: no-cache, must-revalidate");
require_once('header.inc.php');
/* Managing all possible inputs */
isset($_GET['url']) ? define('GET_URL', $_GET['url']): define('GET_URL', '');
function getTitle($url) {
$fd = @fopen($url, 'r');
if ($fd) {
@ -65,6 +68,6 @@ echo '<?xml version="1.0" encoding="utf-8"?>';
getTitle
</method>
<result>
<?php echo getTitle($_GET['url']); ?>
<?php echo getTitle(GET_URL); ?>
</result>
</response>

View file

@ -24,11 +24,18 @@ header("Last-Modified: ". gmdate("D, d M Y H:i:s") ." GMT");
header("Cache-Control: no-cache, must-revalidate");
require_once('header.inc.php');
/* Service creation: only useful services are created */
$userservice = & ServiceFactory :: getServiceInstance('UserService');
if ($userservice->isReserved($_GET['username'])) {
/* Managing all possible inputs */
isset($_GET['username']) ? define('GET_USERNAME', $_GET['username']): define('GET_USERNAME', '');
if ($userservice->isReserved(GET_USERNAME)) {
$result = 'false';
} else {
$result = $userservice->getUserByUsername($_GET['username']) ? 'false' : 'true';
$result = $userservice->getUserByUsername(GET_USERNAME) ? 'false' : 'true';
}
?>
<response>

View file

@ -20,11 +20,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/
require_once('header.inc.php');
/* Service creation: only useful services are created */
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
$userservice =& ServiceFactory::getServiceInstance('UserService');
$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
list($url, $user) = explode('/', $_SERVER['PATH_INFO']);
if (!$user) {
header('Location: '. createURL('populartags'));
@ -51,8 +55,8 @@ if (isset($user) && $user != '') {
if (is_int($user)) {
$userid = intval($user);
} else {
if ($userinfo = $userservice->getUserByUsername($user)) {
$userid =& $userinfo[$userservice->getFieldName('primary')];
if ($userinfo = $userservice->getObjectUserByUsername($user)) {
$userid = $userinfo->getId();
} else {
$tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
$templateservice->loadTemplate('error.404.tpl', $tplVars);

View file

@ -1,56 +1,68 @@
<?php
/***************************************************************************
Copyright (C) 2006 - 2007 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
Copyright (C) 2006 - 2007 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
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 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.
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
***************************************************************************/
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');
/* Service creation: only useful services are created */
$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService');
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
$userservice = & ServiceFactory :: getServiceInstance('UserService');
$cdservice = & ServiceFactory :: getServiceInstance('CommonDescriptionService');
/* Managing all possible inputs */
isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', '');
isset($_POST['cancel']) ? define('POST_CANCEL', $_POST['cancel']): define('POST_CANCEL', '');
isset($_POST['hash']) ? define('POST_HASH', $_POST['hash']): define('POST_HASH', '');
isset($_POST['title']) ? define('POST_TITLE', $_POST['title']): define('POST_TITLE', '');
isset($_POST['description']) ? define('POST_DESCRIPTION', $_POST['description']): define('POST_DESCRIPTION', '');
isset($_POST['referrer']) ? define('POST_REFERRER', $_POST['referrer']): define('POST_REFERRER', '');
list ($url, $hash) = explode('/', $_SERVER['PATH_INFO']);
$template = 'bookmarkcommondescriptionedit.tpl';
$logged_on_user = $userservice->getCurrentUser();
//$logged_on_user = $userservice->getCurrentUser();
$currentObjectUser = $userservice->getCurrentObjectUser();
//permissions
if($logged_on_user == null) {
if(is_null($currentObjectUser)) {
$tplVars['error'] = T_('Permission denied.');
$templateservice->loadTemplate('error.500.tpl', $tplVars);
exit();
}
if ($_POST['confirm']) {
if (POST_CONFIRM) {
if (strlen($hash)>0 &&
$cdservice->addBookmarkDescription($_POST['hash'], stripslashes($_POST['title']), stripslashes($_POST['description']), $logged_on_user['uId'], time())
$cdservice->addBookmarkDescription(POST_HASH, stripslashes(POST_TITLE), stripslashes(POST_DESCRIPTION), $currentObjectUser->getId(), time())
) {
$tplVars['msg'] = T_('Bookmark common description updated');
header('Location: '. $_POST['referrer']);
header('Location: '. POST_REFERRER);
} else {
$tplVars['error'] = T_('Failed to update the bookmark common description');
$template = 'error.500.tpl';
}
} elseif ($_POST['cancel']) {
} elseif (POST_CANCEL) {
$logged_on_user = $userservice->getCurrentUser();
header('Location: '. $_POST['referrer']);
header('Location: '. POST_REFERRER);
} else {
$bkm = $bookmarkservice->getBookmarkByHash($hash);

View file

@ -1,26 +1,27 @@
<?php
/***************************************************************************
Copyright (C) 2004 - 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
Copyright (C) 2004 - 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
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 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.
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
***************************************************************************/
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');
/* Service creation: only useful services are created */
$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$userservice =& ServiceFactory::getServiceInstance('UserService');
@ -28,21 +29,47 @@ $cacheservice =& ServiceFactory::getServiceInstance('CacheService');
$tplVars = array();
if (isset($_GET['action']) && ($_GET['action'] == "add") && !$userservice->isLoggedOn()) {
/* Managing all possible inputs */
isset($_GET['action']) ? define('GET_ACTION', $_GET['action']): define('GET_ACTION', '');
isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', '');
isset($_GET['title']) ? define('GET_TITLE', $_GET['title']): define('GET_TITLE', '');
isset($_GET['address']) ? define('GET_ADDRESS', $_GET['address']): define('GET_ADDRESS', '');
isset($_GET['description']) ? define('GET_DESCRIPTION', $_GET['description']): define('GET_DESCRIPTION', '');
isset($_GET['tags']) ? define('GET_TAGS', $_GET['tags']): define('GET_TAGS', '');
isset($_POST['title']) ? define('POST_TITLE', $_POST['title']): define('POST_TITLE', '');
isset($_POST['address']) ? define('POST_ADDRESS', $_POST['address']): define('POST_ADDRESS', '');
isset($_POST['description']) ? define('POST_DESCRIPTION', $_POST['description']): define('POST_DESCRIPTION', '');
isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', '');
isset($_POST['tags']) ? define('POST_TAGS', $_POST['tags']): define('POST_TAGS', '');
isset($_GET['popup']) ? define('GET_POPUP', $_GET['popup']): define('GET_POPUP', '');
isset($_POST['popup']) ? define('POST_POPUP', $_POST['popup']): define('POST_POPUP', '');
isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
if ((GET_ACTION == "add") && !$userservice->isLoggedOn()) {
$loginqry = str_replace("'", '%27', stripslashes($_SERVER['QUERY_STRING']));
header('Location: '. createURL('login', '?'. $loginqry));
exit();
}
if ($userservice->isLoggedOn()) {
//$currentUser = $userservice->getCurrentUser();
//$currentUserID = $userservice->getCurrentUserId();
//$currentUsername = $currentUser[$userservice->getFieldName('username')];
$currentObjectUser = $userservice->getCurrentObjectUser();
$currentUserID = $currentObjectUser->getId();
$currentUsername = $currentObjectUser->getUsername();
}
@list($url, $user, $cat) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL;
$loggedon = false;
if ($userservice->isLoggedOn()) {
$loggedon = true;
$currentUser = $userservice->getCurrentUser();
$currentUserID = $userservice->getCurrentUserId();
$currentUsername = $currentUser[$userservice->getFieldName('username')];
}
$endcache = false;
if ($usecache) {
@ -50,7 +77,7 @@ if ($usecache) {
$hash = md5($_SERVER['REQUEST_URI'] . $user);
// Don't cache if its users' own bookmarks
if ($loggedon) {
if ($userservice->isLoggedOn()) {
if ($currentUsername != $user) {
// Cache for 5 minutes
$cacheservice->Start($hash);
@ -90,12 +117,12 @@ $tplVars['loadjs'] = true;
// ADD A BOOKMARK
$saved = false;
$templatename = 'bookmarks.tpl';
if ($loggedon && isset($_POST['submitted'])) {
if (!$_POST['title'] || !$_POST['address']) {
if ($userservice->isLoggedOn() && POST_SUBMITTED != '') {
if (!POST_TITLE || !POST_ADDRESS) {
$tplVars['error'] = T_('Your bookmark must have a title and an address');
$templatename = 'editbookmark.tpl';
} else {
$address = trim($_POST['address']);
$address = trim(POST_ADDRESS);
// If the bookmark exists already, edit the original
if ($bookmarkservice->bookmarkExists($address, $currentUserID)) {
$bookmark =& $bookmarkservice->getBookmarkByAddress($address);
@ -103,13 +130,13 @@ if ($loggedon && isset($_POST['submitted'])) {
exit();
// If it's new, save it
} else {
$title = trim($_POST['title']);
$description = trim($_POST['description']);
$status = intval($_POST['status']);
$categories = trim($_POST['tags']);
$title = trim(POST_TITLE);
$description = trim(POST_DESCRIPTION);
$status = intval(POST_STATUS);
$categories = trim(POST_TAGS);
$saved = true;
if ($bookmarkservice->addBookmark($address, $title, $description, $status, $categories)) {
if (isset($_POST['popup'])) {
if (POST_POPUP != '') {
$tplVars['msg'] = '<script type="text/javascript">window.close();</script>';
} else {
$tplVars['msg'] = T_('Bookmark saved');
@ -128,11 +155,11 @@ if ($loggedon && isset($_POST['submitted'])) {
}
}
if (isset($_GET['action']) && ($_GET['action'] == "add")) {
if (GET_ACTION == "add") {
// If the bookmark exists already, edit the original
if ($bookmarkservice->bookmarkExists(stripslashes($_GET['address']), $currentUserID)) {
$bookmark =& $bookmarkservice->getBookmarks(0, NULL, $currentUserID, NULL, NULL, NULL, NULL, NULL, NULL, md5(stripslashes($_GET['address'])));
$popup = (isset($_GET['popup'])) ? '?popup=1' : '';
if ($bookmarkservice->bookmarkExists(stripslashes(GET_ADDRESS), $currentUserID)) {
$bookmark =& $bookmarkservice->getBookmarks(0, NULL, $currentUserID, NULL, NULL, NULL, NULL, NULL, NULL, md5(stripslashes(GET_ADDRESS)));
$popup = (GET_POPUP!='') ? '?popup=1' : '';
header('Location: '. createURL('edit', $bookmark['bookmarks'][0]['bId'] . $popup));
exit();
}
@ -140,33 +167,35 @@ if (isset($_GET['action']) && ($_GET['action'] == "add")) {
}
if ($templatename == 'editbookmark.tpl') {
if ($loggedon) {
if ($userservice->isLoggedOn()) {
$tplVars['formaction'] = createURL('bookmarks', $currentUsername);
if (isset($_POST['submitted'])) {
if (POST_SUBMITTED != '') {
$tplVars['row'] = array(
'bTitle' => stripslashes($_POST['title']),
'bAddress' => stripslashes($_POST['address']),
'bDescription' => stripslashes($_POST['description']),
'tags' => ($_POST['tags'] ? explode(',', stripslashes($_POST['tags'])) : array())
'bTitle' => stripslashes(POST_TITLE),
'bAddress' => stripslashes(POST_ADDRESS),
'bDescription' => stripslashes(POST_DESCRIPTION),
'tags' => (POST_TAGS ? explode(',', stripslashes(POST_TAGS)) : array()),
'bStatus' => 0,
);
$tplVars['tags'] = $_POST['tags'];
$tplVars['tags'] = POST_TAGS;
} else {
$tplVars['row'] = array(
'bTitle' => stripslashes($_GET['title']),
'bAddress' => stripslashes($_GET['address']),
'bDescription' => stripslashes($_GET['description']),
'tags' => ($_GET['tags'] ? explode(',', stripslashes($_GET['tags'])) : array())
'bTitle' => stripslashes(GET_TITLE),
'bAddress' => stripslashes(GET_ADDRESS),
'bDescription' => stripslashes(GET_DESCRIPTION),
'tags' => (GET_TAGS ? explode(',', stripslashes(GET_TAGS)) : array()),
'bStatus' => 0
);
}
$title = T_('Add a Bookmark');
$tplVars['pagetitle'] = $title;
$tplVars['subtitle'] = $title;
$tplVars['btnsubmit'] = T_('Add Bookmark');
$tplVars['popup'] = (isset($_GET['popup'])) ? $_GET['popup'] : null;
$tplVars['popup'] = (GET_POPUP!='') ? GET_POPUP : null;
} else {
$tplVars['error'] = T_('You must be logged in before you can add bookmarks.');
}
} else if ($user && !isset($_GET['popup'])) {
} else if ($user && GET_POPUP == '') {
$tplVars['sidebar_blocks'] = array('profile', 'watchstatus');
@ -192,8 +221,8 @@ if ($templatename == 'editbookmark.tpl') {
// Pagination
$perpage = getPerPageCount();
if (isset($_GET['page']) && intval($_GET['page']) > 1) {
$page = $_GET['page'];
if (intval(GET_PAGE) > 1) {
$page = GET_PAGE;
$start = ($page - 1) * $perpage;
} else {
$page = 0;

View file

@ -1,6 +1,6 @@
<?php
/*
* Define constants use in all the application.
* Define constants used in all the application.
* Some constants are based on variables from configuration file.
*/

View file

@ -21,10 +21,29 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
require_once('header.inc.php');
/* Service creation: only useful services are created */
$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService');
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
$userservice = & ServiceFactory :: getServiceInstance('UserService');
/* Managing all possible inputs */
isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', '');
isset($_POST['delete']) ? define('POST_DELETE', $_POST['delete']): define('POST_DELETE', '');
isset($_POST['title']) ? define('POST_TITLE', $_POST['title']): define('POST_TITLE', '');
isset($_POST['address']) ? define('POST_ADDRESS', $_POST['address']): define('POST_ADDRESS', '');
isset($_POST['description']) ? define('POST_DESCRIPTION', $_POST['description']): define('POST_DESCRIPTION', '');
isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', '');
isset($_POST['tags']) ? define('POST_TAGS', $_POST['tags']): define('POST_TAGS', '');
isset($_GET['popup']) ? define('GET_POPUP', $_GET['popup']): define('GET_POPUP', '');
isset($_POST['popup']) ? define('POST_POPUP', $_POST['popup']): define('POST_POPUP', '');
isset($_POST['referrer']) ? define('POST_REFERRER', $_POST['referrer']): define('POST_REFERRER', '');
/* Managing current logged user */
$currentObjectUser = $userservice->getCurrentObjectUser();
// Header variables
$tplVars['subtitle'] = T_('Edit Bookmark');
$tplVars['loadjs'] = true;
@ -39,39 +58,41 @@ if (!($row = $bookmarkservice->getBookmark(intval($bookmark), true))) {
$tplVars['error'] = T_('You are not allowed to edit this bookmark');
$templateservice->loadTemplate('error.500.tpl', $tplVars);
exit();
} else if ($_POST['submitted']) {
if (!$_POST['title'] || !$_POST['address']) {
} else if (POST_SUBMITTED != '') {
if (!POST_TITLE || !POST_ADDRESS) {
$tplVars['error'] = T_('Your bookmark must have a title and an address');
} else {
// Update bookmark
$bId = intval($bookmark);
$address = trim($_POST['address']);
$title = trim($_POST['title']);
$description = trim($_POST['description']);
$status = intval($_POST['status']);
$tags = trim($_POST['tags']);
$logged_on_user = $userservice->getCurrentUser();
$address = trim(POST_ADDRESS);
$title = trim(POST_TITLE);
$description = trim(POST_DESCRIPTION);
$status = intval(POST_STATUS);
$tags = trim(POST_TAGS);
if (!$bookmarkservice->updateBookmark($bId, $address, $title, $description, $status, $tags)) {
$tplvars['error'] = T_('Error while saving your bookmark');
} else {
if (isset($_POST['popup'])) {
$tplVars['msg'] = (isset($_POST['popup'])) ? '<script type="text/javascript">window.close();</script>' : T_('Bookmark saved');
} elseif (isset($_POST['referrer'])) {
header('Location: '. $_POST['referrer']);
if (POST_POPUP != '') {
//$tplVars['msg'] = (POST_POPUP != '') ? '<script type="text/javascript">window.close();</script>' : T_('Bookmark saved');
$tplVars['msg'] = '<script type="text/javascript">window.close();</script>';
} elseif (POST_REFERRER != '') {
$tplVars['msg'] = T_('Bookmark saved');
header('Location: '. POST_REFERRER);
} else {
header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')]));
$tplVars['msg'] = T_('Bookmark saved');
header('Location: '. createURL('bookmarks', $currentObjectUser->getUsername()));
}
}
}
} else {
if ($_POST['delete']) {
if (POST_DELETE != '') {
// Delete bookmark
if ($bookmarkservice->deleteBookmark($bookmark)) {
$logged_on_user = $userservice->getCurrentUser();
if (isset($_POST['referrer'])) {
header('Location: '. $_POST['referrer']);
if (POST_REFERRER != '') {
header('Location: '. POST_REFERRER);
} else {
header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')]));
header('Location: '. createURL('bookmarks', $currentObjectUser->getUsername()));
}
exit();
} else {
@ -82,7 +103,7 @@ if (!($row = $bookmarkservice->getBookmark(intval($bookmark), true))) {
}
}
$tplVars['popup'] = (isset($_GET['popup'])) ? $_GET['popup'] : null;
$tplVars['popup'] = (GET_POPUP) ? GET_POPUP : null;
$tplVars['row'] =& $row;
$tplVars['formaction'] = createURL('edit', $bookmark);
$tplVars['btnsubmit'] = T_('Save Changes');

View file

@ -21,27 +21,34 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
require_once('header.inc.php');
/* Service creation: only useful services are created */
$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$userservice =& ServiceFactory::getServiceInstance('UserService');
$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
/* Managing all possible inputs */
isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
$tplVars = array();
@list($url, $hash) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL;
$loggedon = false;
$currentObjectUser = $userservice->getCurrentObjectUser();
/*$loggedon = false;
if ($userservice->isLoggedOn()) {
$loggedon = true;
$currentUser = $userservice->getCurrentUser();
$currentUsername = $currentUser[$userservice->getFieldName('username')];
}
}*/
if ($usecache) {
// Generate hash for caching on
$hashtext = $_SERVER['REQUEST_URI'];
if ($userservice->isLoggedOn()) {
$hashtext .= $currentUsername;
$hashtext .= $currentObjectUser->getUsername();
}
$cachehash = md5($hashtext);
@ -51,8 +58,8 @@ if ($usecache) {
// Pagination
$perpage = getPerPageCount();
if (isset($_GET['page']) && intval($_GET['page']) > 1) {
$page = $_GET['page'];
if (intval(GET_PAGE) > 1) {
$page = GET_PAGE;
$start = ($page - 1) * $perpage;
} else {
$page = 0;
@ -76,6 +83,12 @@ if ($bookmark =& $bookmarkservice->getBookmarkByHash($hash)) {
//$tplVars['cat_url'] = createURL('tags', '%2$s');
$tplVars['cat_url'] = createURL('bookmarks', '%1$s/%2$s');
$tplVars['nav_url'] = createURL('history', $hash .'/%3$s');
$tplVars['rsschannels'] = array();
if($userservice->isLoggedOn()) {
$tplVars['user'] = $currentObjectUser->getUsername();
} else {
$tplVars['user'] = '';
}
$templateservice->loadTemplate('bookmarks.tpl', $tplVars);
} else {
// Throw a 404 error

View file

@ -1,34 +1,44 @@
<?
/***************************************************************************
Copyright (C) 2004 - 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
Copyright (C) 2004 - 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
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 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.
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
***************************************************************************/
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');
/* Service creation: only useful services are created */
$userservice =& ServiceFactory::getServiceInstance('UserService');
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
/* Managing all possible inputs */
// First input is $_FILES
// Other inputs
isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', '');
$tplVars = array();
if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['size'] > 0) {
$userinfo = $userservice->getCurrentUser();
$userinfo = $userservice->getCurrentObjectUser();
if (isset($_POST['status']) && is_numeric($_POST['status'])) {
$status = intval($_POST['status']);
if (is_numeric(POST_STATUS)) {
$status = intval(POST_STATUS);
} else {
$status = 2;
}
@ -48,7 +58,7 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
}
}
xml_parser_free($xml_parser);
header('Location: '. createURL('bookmarks', $userinfo[$userservice->getFieldName('username')]));
header('Location: '. createURL('bookmarks', $userinfo->getUsername()));
} else {
$templatename = 'importDelicious.tpl';
$tplVars['subtitle'] = T_('Import Bookmarks from del.icio.us');
@ -56,6 +66,8 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
$templateservice->loadTemplate($templatename, $tplVars);
}
function startElement($parser, $name, $attrs) {
global $depth, $status, $tplVars, $userservice;

View file

@ -20,16 +20,26 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/
require_once('header.inc.php');
/* Service creation: only useful services are created */
$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
$userservice =& ServiceFactory::getServiceInstance('UserService');
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
/* Managing all possible inputs */
// First input is $_FILES
// Other inputs
isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', '');
$tplVars = array();
if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['size'] > 0) {
$userinfo = $userservice->getCurrentUser();
$userinfo = $userservice->getCurrentObjectUser();
if (isset($_POST['status']) && is_numeric($_POST['status'])) {
$status = intval($_POST['status']);
if (is_numeric(POST_STATUS)) {
$status = intval(POST_STATUS);
} else {
$status = 2;
}
@ -79,7 +89,7 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
}
}
}
header('Location: '. createURL('bookmarks', $userinfo[$userservice->getFieldName('username')]));
header('Location: '. createURL('bookmarks', $userinfo->getUsername()));
} else {
$templatename = 'importNetscape.tpl';
$tplVars['subtitle'] = T_('Import Bookmarks from Browser File');

View file

@ -28,11 +28,10 @@ $templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$userservice =& ServiceFactory::getServiceInstance('UserService');
$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
/* Managing possible inputs */
/* Managing all possible inputs */
isset($_GET['action']) ? define('GET_ACTION', $_GET['action']): define('GET_ACTION', '');
isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
//isset($_GET['popup']) ? define('GET_POPUP', $_GET['popup']): define('GET_SORT', '');
// Logout action
@ -91,6 +90,8 @@ $tplVars['cat_url'] = createURL('bookmarks', '%1$s/%2$s');
$tplVars['nav_url'] = createURL('index', '%3$s');
$tplVars['summarizeLinkedTags'] = true;
$tplVars['pageName'] = PAGE_INDEX;
$tplVars['user'] = '';
$tplVars['currenttag'] = '';
$templateservice->loadTemplate('bookmarks.tpl', $tplVars);

View file

@ -20,20 +20,32 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/
require_once('header.inc.php');
/* Service creation: only useful services are created */
$userservice =& ServiceFactory::getServiceInstance('UserService');
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
/* Managing all possible inputs */
isset($_POST['keeppass']) ? define('POST_KEEPPASS', $_POST['keeppass']): define('POST_KEEPPASS', '');
isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', '');
isset($_POST['username']) ? define('POST_USERNAME', $_POST['username']): define('POST_USERNAME', '');
isset($_POST['password']) ? define('POST_PASSWORD', $_POST['password']): define('POST_PASSWORD', '');
isset($_POST['query']) ? define('POST_QUERY', $_POST['query']): define('POST_QUERY', '');
$tplVars = array();
$keeppass = isset($_POST['keeppass'])&&($_POST['keeppass']=='yes')?true:false;
$keeppass = (POST_KEEPPASS=='yes')?true:false;
$login = false;
if (isset($_POST['submitted']) && isset($_POST['username']) && isset($_POST['password'])) {
$posteduser = trim(utf8_strtolower($_POST['username']));
$login = $userservice->login($posteduser, $_POST['password'], $keeppass);
if (POST_SUBMITTED!='' && POST_USERNAME!='' && POST_PASSWORD!='') {
$posteduser = trim(utf8_strtolower(POST_USERNAME));
$login = $userservice->login($posteduser, POST_PASSWORD, $keeppass);
if ($login) {
if ($_POST['query'])
header('Location: '. createURL('bookmarks', $posteduser .'?'. $_POST['query']));
if (POST_QUERY)
header('Location: '. createURL('bookmarks', $posteduser .'?'. POST_QUERY));
else
header('Location: '. createURL('bookmarks', $posteduser));
} else {
@ -42,9 +54,8 @@ if (isset($_POST['submitted']) && isset($_POST['username']) && isset($_POST['pas
}
if (!$login) {
if ($userservice->isLoggedOn()) {
$cUser = $userservice->getCurrentUser();
$cUsername = strtolower($cUser[$userservice->getFieldName('username')]);
header('Location: '. createURL('bookmarks', $cUsername));
$cUser = $userservice->getCurrentObjectUser();
header('Location: '. createURL('bookmarks', strtolower($cUser->getUsername())));
}
$tplVars['subtitle'] = T_('Log In');

View file

@ -1,55 +1,65 @@
<?
/***************************************************************************
Copyright (C) 2005 Scuttle project
https://sourceforge.net/projects/scuttle/
Copyright (C) 2005 Scuttle project
https://sourceforge.net/projects/scuttle/
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 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.
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
***************************************************************************/
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');
/* Service creation: only useful services are created */
$userservice =& ServiceFactory::getServiceInstance('UserService');
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
/* Managing all possible inputs */
isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', '');
isset($_POST['username']) ? define('POST_USERNAME', $_POST['username']): define('POST_USERNAME', '');
isset($_POST['email']) ? define('POST_EMAIL', $_POST['email']): define('POST_EMAIL', '');
$tplVars = array();
// IF SUBMITTED
if (isset($_POST['submitted'])) {
if (POST_SUBMITTED != '') {
// NO USERNAME
if (!$_POST['username']) {
if (!POST_USERNAME) {
$tplVars['error'] = T_('You must enter your username.');
// NO E-MAIL
} elseif (!$_POST['email']) {
} elseif (!POST_EMAIL) {
$tplVars['error'] = T_('You must enter your <abbr title="electronic mail">e-mail</abbr> address.');
// USERNAME AND E-MAIL
} else {
// NO MATCH
if (!($userinfo = $userservice->getUserByUsername($_POST['username']))) {
$userinfo = $userservice->getObjectUserByUsername(POST_USERNAME);
if ($userinfo == '') {
$tplVars['error'] = T_('No matches found for that username.');
} elseif ($_POST['email'] != $userinfo['email']) {
} elseif (POST_EMAIL != $userinfo->getEmail()) {
$tplVars['error'] = T_('No matches found for that combination of username and <abbr title="electronic mail">e-mail</abbr> address.');
// MATCH
} else {
// GENERATE AND STORE PASSWORD
$password = $userservice->generatePassword($userinfo['uId']);
if (!($password = $userservice->generatePassword($userinfo['uId']))) {
$password = $userservice->generatePassword($userinfo->getId());
if (!($password = $userservice->generatePassword($userinfo->getId()))) {
$tplVars['error'] = T_('There was an error while generating your new password. Please try again.');
} else {
@ -57,9 +67,9 @@ if (isset($_POST['submitted'])) {
$message = T_('Your new password is:') ."\n". $password ."\n\n". T_('To keep your bookmarks secure, you should change this password in your profile the next time you log in.');
$message = wordwrap($message, 70);
$headers = 'From: '. $adminemail;
$mail = mail($_POST['email'], sprintf(T_('%s Account Information'), $sitename), $message);
$mail = mail(POST_EMAIL, sprintf(T_('%s Account Information'), $sitename), $message);
$tplVars['msg'] = sprintf(T_('New password generated and sent to %s'), $_POST['email']);
$tplVars['msg'] = sprintf(T_('New password generated and sent to %s'), POST_EMAIL);
}
}
}

View file

@ -20,21 +20,25 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/
require_once('header.inc.php');
/* Service creation: only useful services are created */
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
$userservice =& ServiceFactory::getServiceInstance('UserService');
$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
/* Managing current logged user */
$currentObjectUser = $userservice->getCurrentObjectUser();
list($url, $user) = explode('/', $_SERVER['PATH_INFO']);
if ($usecache) {
// Generate hash for caching on
$hashtext = $_SERVER['REQUEST_URI'];
if ($userservice->isLoggedOn()) {
$hashtext .= $userservice->getCurrentUserID();
$currentUser = $userservice->getCurrentUser();
$currentUsername = $currentUser[$userservice->getFieldName('username')];
if ($currentUsername == $user) {
$hashtext .= $currentObjectUser->getId();
if ($currentObjectUser->getUsername() == $user) {
$hashtext .= $user;
}
}
@ -52,8 +56,9 @@ if (isset($user) && $user != '') {
if (is_int($user)) {
$userid = intval($user);
} else {
if ($userinfo = $userservice->getUserByUsername($user)) {
$userid =& $userinfo[$userservice->getFieldName('primary')];
$userinfo = $userservice->getObjectUserByUsername($user);
if ($userinfo != '') {
$userid = $userinfo->getId();
} else {
$tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
$templateservice->loadTemplate('error.404.tpl', $tplVars);
@ -77,8 +82,8 @@ if (isset($userid)) {
}
$tplVars['sidebar_blocks'] = array('linked');
$tplVars['subtitle'] = $pagetitle;
$templateservice->loadTemplate('tags.tpl', $tplVars);
if ($usecache) {

View file

@ -20,32 +20,45 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/
require_once('header.inc.php');
/* Service creation: only useful services are created */
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$userservice =& ServiceFactory::getServiceInstance('UserService');
/* Managing all possible inputs */
isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', '');
isset($_POST['pPass']) ? define('POST_PASS', $_POST['pPass']): define('POST_PASS', '');
isset($_POST['pPassConf']) ? define('POST_PASSCONF', $_POST['pPassConf']): define('POST_PASSCONF', '');
isset($_POST['pName']) ? define('POST_NAME', $_POST['pName']): define('POST_NAME', '');
isset($_POST['pMail']) ? define('POST_MAIL', $_POST['pMail']): define('POST_MAIL', '');
isset($_POST['pPage']) ? define('POST_PAGE', $_POST['pPage']): define('POST_PAGE', '');
isset($_POST['pDesc']) ? define('POST_DESC', $_POST['pDesc']): define('POST_DESC', '');
isset($_POST['token']) ? define('POST_TOKEN', $_POST['token']): define('POST_TOKEN', '');
isset($_SESSION['token']) ? define('SESSION_TOKEN', $_SESSION['token']): define('SESSION_TOKEN', '');
isset($_SESSION['token_stamp']) ? define('SESSION_TOKENSTAMP', $_SESSION['token_stamp']): define('SESSION_TOKENSTAMP', '');
/* Managing current logged user */
$currentObjectUser = $userservice->getCurrentObjectUser();
$tplVars = array();
@list($url, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL;
$loggedon = false;
if ($userservice->isLoggedOn()) {
$loggedon = true;
$currentUser = $userservice->getCurrentUser();
$currentUserID = $userservice->getCurrentUserId();
$currentUsername = $currentUser[$userservice->getFieldName('username')];
}
if ($user) {
if (is_int($user)) {
$userid = intval($user);
} else {
$user = urldecode($user);
if (!($userinfo = $userservice->getUserByUsername($user))) {
$userinfo = $userservice->getObjectUserByUsername($user);
if ($userinfo == '') {
$tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
$templateservice->loadTemplate('error.404.tpl', $tplVars);
exit();
} else {
$userid =& $userinfo['uId'];
$userid =& $userinfo->getId();
}
}
} else {
@ -54,7 +67,7 @@ if ($user) {
exit();
}
if ($user == $currentUsername) {
if ($userservice->isLoggedOn() && $user == $currentObjectUser->getUsername()) {
$title = T_('My Profile');
} else {
$title = T_('Profile') .': '. $user;
@ -65,19 +78,19 @@ $tplVars['subtitle'] = $title;
$tplVars['user'] = $user;
$tplVars['userid'] = $userid;
if (isset($_POST['submitted']) && $currentUserID == $userid) {
if (POST_SUBMITTED!='' && $currentObjectUser->getId() == $userid) {
$error = false;
$detPass = trim($_POST['pPass']);
$detPassConf = trim($_POST['pPassConf']);
$detName = trim($_POST['pName']);
$detMail = trim($_POST['pMail']);
$detPage = trim($_POST['pPage']);
$detDesc = filter($_POST['pDesc']);
$detPass = trim(POST_PASS);
$detPassConf = trim(POST_PASSCONF);
$detName = trim(POST_NAME);
$detMail = trim(POST_MAIL);
$detPage = trim(POST_PAGE);
$detDesc = filter(POST_DESC);
// manage token preventing from CSRF vulnaribilities
if ( !isset($_SESSION['token'], $_SESSION['token_stamp'])
|| time() - $_SESSION['token_stamp'] > 600 //limit token lifetime, optionnal
|| $_SESSION['token'] != $_POST['token']) {
if ( SESSION_TOKEN == ''
|| time() - SESSION_TOKENSTAMP > 600 //limit token lifetime, optionnal
|| SESSION_TOKEN != POST_TOKEN) {
$error = true;
$tplVars['error'] = T_('Invalid Token');
}
@ -101,10 +114,10 @@ if (isset($_POST['submitted']) && $currentUserID == $userid) {
$tplVars['msg'] = T_('Changes saved.');
}
}
$userinfo = $userservice->getUserByUsername($user);
$userinfo = $userservice->getObjectUserByUsername($user);
}
if ($currentUserID != $userid) {
if (!$userservice->isLoggedOn() || $currentObjectUser->getId() != $userid) {
$templatename = 'profile.tpl.php';
} else {
//Token Init
@ -117,6 +130,6 @@ if ($currentUserID != $userid) {
}
$tplVars['row'] = $userinfo;
$tplVars['objectUser'] = $userinfo;
$templateservice->loadTemplate($templatename, $tplVars);
?>

View file

@ -20,16 +20,26 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/
require_once('header.inc.php');
/* Service creation: only useful services are created */
$userservice =& ServiceFactory::getServiceInstance('UserService');
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
/* Managing all possible inputs */
isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', '');
isset($_POST['username']) ? define('POST_USERNAME', $_POST['username']): define('POST_USERNAME', '');
isset($_POST['password']) ? define('POST_PASS', $_POST['password']): define('POST_PASS', '');
isset($_POST['email']) ? define('POST_MAIL', $_POST['email']): define('POST_MAIL', '');
isset($_POST['antispamAnswer']) ? define('POST_ANTISPAMANSWER', $_POST['antispamAnswer']): define('POST_ANTISPAMANSWER', '');
$tplVars = array();
if (isset($_POST['submitted'])) {
$posteduser = trim(utf8_strtolower($_POST['username']));
if (POST_SUBMITTED != '') {
$posteduser = trim(utf8_strtolower(POST_USERNAME));
// Check if form is incomplete
if (!($posteduser) || !($_POST['password']) || !($_POST['email'])) {
if (!($posteduser) || POST_PASS == '' || POST_MAIL == '') {
$tplVars['error'] = T_('You <em>must</em> enter a username, password and e-mail address.');
// Check if username is reserved
@ -45,17 +55,17 @@ if (isset($_POST['submitted'])) {
$tplVars['error'] = T_('This username is not valid (too long, forbidden characters...), please make another choice.');
// Check if e-mail address is valid
} elseif (!$userservice->isValidEmail($_POST['email'])) {
} elseif (!$userservice->isValidEmail(POST_MAIL)) {
$tplVars['error'] = T_('E-mail address is not valid. Please try again.');
// Check if antispam answer is valid
} elseif (strcmp($_POST['antispamAnswer'], $GLOBALS['antispamAnswer']) != 0) {
} elseif (strcmp(POST_ANTISPAMANSWER, $GLOBALS['antispamAnswer']) != 0) {
$tplVars['error'] = T_('Antispam answer is not valid. Please try again.');
// Register details
} elseif ($userservice->addUser($posteduser, $_POST['password'], $_POST['email'])) {
} elseif ($userservice->addUser($posteduser, POST_PASS, POST_MAIL)) {
// Log in with new username
$login = $userservice->login($posteduser, $_POST['password']);
$login = $userservice->login($posteduser, POST_PASS);
if ($login) {
header('Location: '. createURL('bookmarks', $posteduser));
}

44
rss.php
View file

@ -1,33 +1,43 @@
<?php
/***************************************************************************
Copyright (C) 2004 - 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
Copyright (C) 2004 - 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
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 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.
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
***************************************************************************/
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');
/* Service creation: only useful services are created */
$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$userservice =& ServiceFactory::getServiceInstance('UserService');
$tplVars = array();
header('Content-Type: application/xml');
list($url, $user, $cat) = explode('/', $_SERVER['PATH_INFO']);
if(isset($_SERVER['PATH_INFO']) && strlen($_SERVER['PATH_INFO']) >1) {
list($url, $user, $cat) = explode('/', $_SERVER['PATH_INFO']);
} else {
$url = '';
$user = '';
$cat = NULL;
}
if ($usecache) {
// Generate hash for caching on
@ -47,6 +57,7 @@ if ($usecache) {
}
$watchlist = null;
$pagetitle = '';
if ($user && $user != 'all') {
if ($user == 'watchlist') {
$user = $cat;
@ -79,6 +90,7 @@ $tplVars['feedlink'] = ROOT;
$tplVars['feeddescription'] = sprintf(T_('Recent bookmarks posted to %s'), $GLOBALS['sitename']);
$bookmarks =& $bookmarkservice->getBookmarks(0, 15, $userid, $cat, NULL, getSortOrder(), $watchlist);
$bookmarks_tmp =& filter($bookmarks['bookmarks']);
$bookmarks_tpl = array();

View file

@ -1,5 +1,7 @@
<?php
/* Manage input */
/* Managing all possible inputs */
$select_watchlist = isset($select_watchlist)?$select_watchlist:'';
$select_all = isset($select_all)?$select_all:'';
?>
@ -9,13 +11,11 @@ $select_all = isset($select_all)?$select_all:'';
<table>
<tr>
<?php
$logged_on = false;
if ($userservice->isLoggedOn()) {
$currentUser = $userservice->getCurrentUser();
$currentUsername = $currentUser[$userservice->getFieldName('username')];
$logged_on = true;
$currentUser = $userservice->getCurrentObjectUser();
$currentUsername = $currentUser->getUsername();
}
if ($logged_on || isset($user)) {
if ($userservice->isLoggedOn() || isset($user)) {
?>
<td><?php echo T_('Search' /* Search ... for */); ?></td>
<td>
@ -26,7 +26,7 @@ $select_all = isset($select_all)?$select_all:'';
<option value="<?php echo $user ?>"<?php //echo $selectUser; ?>><?php echo T_("this user's bookmarks"); ?></option>
<?php
}
if ($logged_on) {
if ($userservice->isLoggedOn()) {
?>
<option value="<?php echo $currentUsername; ?>"<?php //echo $selectMy; ?>><?php echo T_('my bookmarks'); ?></option>
<option value="watchlist"<?php echo $select_watchlist; ?>><?php echo T_('my watchlist'); ?></option>

View file

@ -1,48 +1,65 @@
<?php
/***************************************************************************
Copyright (C) 2005 - 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
Copyright (C) 2005 - 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
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 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.
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
***************************************************************************/
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');
// POST
if (isset($_POST['terms'])) {
// Redirect to GET
header('Location: '. createURL('search', $_POST['range'] .'/'. filter($_POST['terms'], 'url')));
/* Managing all possible inputs */
isset($_POST['terms']) ? define('POST_TERMS', $_POST['terms']): define('POST_TERMS', '');
isset($_POST['range']) ? define('POST_RANGE', $_POST['range']): define('POST_RANGE', '');
isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
// GET
// POST
if (POST_TERMS != '') {
// Redirect to GET
header('Location: '. createURL('search', POST_RANGE .'/'. filter(POST_TERMS, 'url')));
// GET
} else {
/* Service creation: only useful services are created */
$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$userservice =& ServiceFactory::getServiceInstance('UserService');
$searchhistoryservice =& ServiceFactory::getServiceInstance('SearchHistoryService');
$logged_on_userid = $userservice->getCurrentUserId();
list($url, $range, $terms, $page) = explode('/', $_SERVER['PATH_INFO']);
/* Managing current logged user */
$currentUserId = $userservice->getCurrentUserId();
$exploded = explode('/', $_SERVER['PATH_INFO']);
if(count($exploded) == 4) {
list($url, $range, $terms, $page) = $exploded;
} else {
list($url, $range, $terms) = $exploded;
$page= NULL;
}
$tplvars = array();
$tplVars['loadjs'] = true;
// Pagination
$perpage = getPerPageCount();
if (isset($_GET['page']) && intval($_GET['page']) > 1) {
$page = $_GET['page'];
if (intval(GET_PAGE) > 1) {
$page = GET_PAGE;
$start = ($page - 1) * $perpage;
} else {
$page = 0;
@ -72,7 +89,7 @@ if (isset($_POST['terms'])) {
break;
case 'watchlist':
$tplVars['select_watchlist'] = $selected;
$s_user = $logged_on_userid;
$s_user = $currentUserId;
$s_watchlist = true;
break;
default:
@ -84,12 +101,13 @@ if (isset($_POST['terms'])) {
if (is_numeric($s_user)) {
$s_user = intval($s_user);
} else {
if (!($userinfo = $userservice->getUserByUsername($s_user) ) ) {
$userinfo = $userservice->getObjectUserByUsername($s_user);
if ($userinfo == '' ) {
$tplVars['error'] = sprintf(T_('User with username %s was not found'), $s_user);
$templateservice->loadTemplate('error.404.tpl', $tplVars);
exit();
} else {
$s_user =& $userinfo[$userservice->getFieldName('primary')];
$s_user =& $userinfo->getId();
}
}
}
@ -97,8 +115,9 @@ if (isset($_POST['terms'])) {
$bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, $s_user, NULL, $terms, getSortOrder(), $s_watchlist, $s_start, $s_end);
// Save search
$searchhistoryservice->addSearch($terms, $range, $bookmarks['total'], $logged_on_userid);
$searchhistoryservice->addSearch($terms, $range, $bookmarks['total'], $currentUserId);
$tplVars['rsschannels'] = array();
$tplVars['page'] = $page;
$tplVars['start'] = $start;
$tplVars['popCount'] = 25;

View file

@ -45,7 +45,8 @@ class Bookmark2TagService {
$tags = str_replace(array('"', '\''), "_", $tags);
$tags_count = count($tags);
$tags_count = is_array($tags)?count($tags):0;
for ($i = 0; $i < $tags_count; $i++) {
$tags[$i] = trim(strtolower($tags[$i]));
if ($fromApi) {
@ -317,7 +318,8 @@ class Bookmark2TagService {
message_die(GENERAL_ERROR, 'Could not get related tags for this hash', '', __LINE__, __FILE__, $query, $this->db);
return false;
}
return $this->db->sql_fetchrowset($dbresult);
$output = $this->db->sql_fetchrowset($dbresult);
return $output;
}
function &getPopularTags($user = NULL, $limit = 30, $logged_on_user = NULL, $days = NULL) {

View file

@ -20,6 +20,8 @@ class BookmarkService {
$userservice = & ServiceFactory :: getServiceInstance('UserService');
$sId = $userservice->getCurrentUserId();
$range = ' AND uId = '. $sId;
} else {
$range = '';
}
$query = 'SELECT * FROM '. $this->getTableName() .' WHERE '. $fieldname .' = "'. $this->db->sql_escape($value) .'"'. $range;
@ -271,6 +273,7 @@ class BookmarkService {
} else {
$arrWatch = $userservice->getWatchlist($user);
if (count($arrWatch) > 0) {
$query_3_1 = '';
foreach($arrWatch as $row) {
$query_3_1 .= 'B.uId = '. intval($row) .' OR ';
}

View file

@ -23,7 +23,7 @@ class Tag2TagService {
}
$values = array('tag1' => $tag1, 'tag2' => $tag2, 'relationType'=> $relationType, 'uId'=> $uId);
$query = 'INSERT INTO '. $this->getTableName() .' '. $this->db->sql_build_array('INSERT', $values);
//die($query);
//die($query);
if (!($dbresult =& $this->db->sql_query($query))) {
$this->db->sql_transaction('rollback');
message_die(GENERAL_ERROR, 'Could not attach tag to tag', '', __LINE__, __FILE__, $query, $this->db);
@ -61,7 +61,7 @@ class Tag2TagService {
if($uId != null) {
$query.= " AND uId = '".$uId."'";
}
//die($query);
//die($query);
if (! ($dbresult =& $this->db->sql_query($query)) ){
message_die(GENERAL_ERROR, 'Could not get related tags', '', __LINE__, __FILE__, $query, $this->db);
return false;
@ -91,7 +91,7 @@ class Tag2TagService {
function getAllLinkedTags($tag1, $relationType, $uId, $asFlatList=true, $stopList=array()) {
$asFlatList = true; //we disable the tree list parameter for the moment
if(in_array($tag1, $stopList)) {
if(in_array($tag1, $stopList) || $tag1 == '') {
return array();
}

View file

@ -29,7 +29,7 @@ class TagService {
if ($row =& $this->db->sql_fetchrow($dbresult)) {
return $row;
} else {
return array();
return array('tDescription'=>'');
}
}
@ -47,7 +47,8 @@ class TagService {
}
function updateDescription($tag, $uId, $desc) {
if(count($this->getDescription($tag, $uId))>0) {
$objectTag = $this->getDescription($tag, $uId);
if(count($objectTag)>0 && $objectTag['tDescription'] != '') {
$query = 'UPDATE '.$this->getTableName();
$query.= ' SET tDescription="'.$this->db->sql_escape($desc).'"';
$query.= ' WHERE tag="'.$tag.'" AND uId="'.$uId.'"';

View file

@ -76,6 +76,22 @@ class UserService {
return $users;
}
function & getObjectUsers($nb=0) {
$query = 'SELECT * FROM '. $this->getTableName() .' ORDER BY `uId` DESC';
if($nb>0) {
$query .= ' LIMIT 0, '.$nb;
}
if (! ($dbresult =& $this->db->sql_query($query)) ) {
message_die(GENERAL_ERROR, 'Could not get user', '', __LINE__, __FILE__, $query, $this->db);
return false;
}
while ($row = & $this->db->sql_fetchrow($dbresult)) {
$users[] = new User($row[$this->getFieldName('primary')], $row[$this->getFieldName('username')]);
}
return $users;
}
function _randompassword() {
$seed = (integer) md5(microtime());
mt_srand($seed);
@ -109,6 +125,11 @@ class UserService {
return $this->_getuser($this->getFieldName('username'), $username);
}
function getObjectUserByUsername($username) {
$user = $this->_getuser($this->getFieldName('username'), $username);
return new User($user[$this->getFieldName('primary')], $username);
}
function getUser($id) {
return $this->_getuser($this->getFieldName('primary'), $id);
}
@ -152,6 +173,22 @@ class UserService {
return $currentObjectUser;
}
function existsUserWithUsername($username) {
if($this->getUserByUsername($username) != '') {
return true;
} else {
return false;
}
}
function existsUser($id) {
if($this->getUser($id) != '') {
return true;
} else {
return false;
}
}
function isAdmin($userid) {
$user = $this->getUser($userid);
@ -446,10 +483,17 @@ class UserService {
function setCookieKey($value) { $this->cookiekey = $value; }
}
/* Defines a user. Rare fields are filled if required. */
class User {
var $id;
var $username;
var $name;
var $email;
var $homepage;
var $content;
var $datetime;
var $isAdmin;
function User($id, $username) {
@ -465,8 +509,58 @@ class User {
return $this->username;
}
function getName() {
// Look for value only if not already set
if(!isset($this->name)) {
$userservice =& ServiceFactory::getServiceInstance('UserService');
$user = $userservice->getUser($this->id);
$this->name = $user['name'];
}
return $this->name;
}
function getEmail() {
// Look for value only if not already set
if(!isset($this->email)) {
$userservice =& ServiceFactory::getServiceInstance('UserService');
$user = $userservice->getUser($this->id);
$this->email = $user['email'];
}
return $this->email;
}
function getHomepage() {
// Look for value only if not already set
if(!isset($this->homepage)) {
$userservice =& ServiceFactory::getServiceInstance('UserService');
$user = $userservice->getUser($this->id);
$this->homepage = $user['homepage'];
}
return $this->homepage;
}
function getContent() {
// Look for value only if not already set
if(!isset($this->content)) {
$userservice =& ServiceFactory::getServiceInstance('UserService');
$user = $userservice->getUser($this->id);
$this->content = $user['uContent'];
}
return $this->content;
}
function getDatetime() {
// Look for value only if not already set
if(!isset($this->content)) {
$userservice =& ServiceFactory::getServiceInstance('UserService');
$user = $userservice->getUser($this->id);
$this->datetime = $user['uDatetime'];
}
return $this->datetime;
}
function isAdmin() {
// Look for value if not already set
// Look for value only if not already set
if(!isset($this->isAdmin)) {
$userservice =& ServiceFactory::getServiceInstance('UserService');
$this->isAdmin = $userservice->isAdmin($this->id);

View file

@ -20,43 +20,52 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/
require_once('header.inc.php');
/* Service creation: only useful services are created */
$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService');
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
$userservice = & ServiceFactory :: getServiceInstance('UserService');
/* Managing all possible inputs */
isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', '');
isset($_POST['cancel']) ? define('POST_CANCEL', $_POST['cancel']): define('POST_CANCEL', '');
isset($_POST['tag1']) ? define('POST_TAG1', $_POST['tag1']): define('POST_TAG1', '');
isset($_POST['linkType']) ? define('POST_LINKTYPE', $_POST['linkType']): define('POST_LINKTYPE', '');
isset($_POST['tag2']) ? define('POST_TAG2', $_POST['tag2']): define('POST_TAG2', '');
$logged_on_user = $userservice->getCurrentUser();
/* Managing current logged user */
$currentObjectUser = $userservice->getCurrentObjectUser();
//permissions
if($logged_on_user == null) {
if(!$userservice->isLoggedOn()) {
$tplVars['error'] = T_('Permission denied.');
$templateservice->loadTemplate('error.500.tpl', $tplVars);
exit();
}
/* Managing path info */
list ($url, $tag1) = explode('/', $_SERVER['PATH_INFO']);
if ($_POST['confirm']) {
$tag1 = $_POST['tag1'];
$linkType = $_POST['linkType'];
$tag2 = $_POST['tag2'];
if ($tag2tagservice->addLinkedTags($tag1, $tag2, $linkType, $userservice->getCurrentUserId())) {
if (POST_CONFIRM != '') {
$tag1 = POST_TAG1;
$linkType = POST_LINKTYPE;
$tag2 = POST_TAG2;
if ($tag2tagservice->addLinkedTags($tag1, $tag2, $linkType, $currentObjectUser->getId())) {
$tplVars['msg'] = T_('Tag link created');
header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')]));
header('Location: '. createURL('bookmarks', $currentObjectUser->getUsername()));
} else {
$tplVars['error'] = T_('Failed to create the link');
$templateservice->loadTemplate('error.500.tpl', $tplVars);
exit();
}
} elseif ($_POST['cancel']) {
header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')] .'/'. $tags));
} elseif (POST_CANCEL) {
header('Location: '. createURL('bookmarks', $currentObjectUser->getUsername() .'/'. $tags));
}
$tplVars['links'] = $tag2tagservice->getLinks($userservice->getCurrentUserId());
$tplVars['links'] = $tag2tagservice->getLinks($currentObjectUser->getId());
$tplVars['tag1'] = $tag1;
$tplVars['tag2'] = '';
$tplVars['subtitle'] = T_('Add Tag Link') .': '. $tag1;
$tplVars['formaction'] = $_SERVER['SCRIPT_NAME'] .'/'. $tag1;
$tplVars['referrer'] = $_SERVER['HTTP_REFERER'];

View file

@ -1,62 +1,87 @@
<?php
/***************************************************************************
Copyright (C) 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
Copyright (C) 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
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 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.
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
***************************************************************************/
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');
/* Service creation: only useful services are created */
$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService');
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
$userservice = & ServiceFactory :: getServiceInstance('UserService');
$logged_on_user = $userservice->getCurrentUser();
/* Managing all possible inputs */
isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', '');
isset($_POST['cancel']) ? define('POST_CANCEL', $_POST['cancel']): define('POST_CANCEL', '');
isset($_POST['tag1']) ? define('POST_TAG1', $_POST['tag1']): define('POST_TAG1', '');
isset($_POST['linkType']) ? define('POST_LINKTYPE', $_POST['linkType']): define('POST_LINKTYPE', '');
isset($_POST['tag2']) ? define('POST_TAG2', $_POST['tag2']): define('POST_TAG2', '');
isset($_SERVER['HTTP_REFERER']) ? define('HTTP_REFERER', $_SERVER['HTTP_REFERER']): define('HTTP_REFERER', '');
/* Managing current logged user */
$currentUser = $userservice->getCurrentObjectUser();
//permissions
if($logged_on_user == null) {
if(!$userservice->isloggedOn()) {
$tplVars['error'] = T_('Permission denied.');
$templateservice->loadTemplate('error.500.tpl', $tplVars);
exit();
}
list ($url, $tag1, $tag2) = explode('/', $_SERVER['PATH_INFO']);
/* Managing path info */
if(isset($_SERVER['PATH_INFO'])) {
$exploded = explode('/', $_SERVER['PATH_INFO']);
if(count($exploded) == 3) {
list ($url, $tag1, $tag2) = explode('/', $_SERVER['PATH_INFO']);
} else {
list ($url, $tag1) = explode('/', $_SERVER['PATH_INFO']);
$tag2 = '';
}
} else {
$url = $tag1 = $tag2 = '';
}
if ($_POST['confirm']) {
$tag = $_POST['tag1'];
$linkType = $_POST['linkType'];
$newTag = $_POST['tag2'];
if ($tag2tagservice->removeLinkedTags($_POST['tag1'], $_POST['tag2'], $linkType, $userservice->getCurrentUserId())) {
if (POST_CONFIRM) {
$tag = POST_TAG1;
$linkType = POST_LINKTYPE;
$newTag = POST_TAG2;
if ($tag2tagservice->removeLinkedTags(POST_TAG1, POST_TAG2, POST_LINKTYPE, $currentUser->getId())) {
$tplVars['msg'] = T_('Tag link deleted');
header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')].'/'.$tag));
header('Location: '. createURL('bookmarks', $currentUser->getUsername().'/'.$tag));
} else {
$tplVars['error'] = T_('Failed to delete the link');
$templateservice->loadTemplate('error.500.tpl', $tplVars);
exit();
}
} elseif ($_POST['cancel']) {
header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')] .'/'. $tags));
} elseif (POST_CANCEL) {
header('Location: '. createURL('bookmarks', $currentUser->getUsername() .'/'. $tags));
}
$tplVars['links'] = $tag2tagservice->getLinks($userservice->getCurrentUserId());
$tplVars['links'] = $tag2tagservice->getLinks($currentUser->getId());
$tplVars['tag1'] = $tag1;
$tplVars['tag2'] = $tag2;
$tplVars['subtitle'] = T_('Delete Link Between Tags') .': '. $tag1.' > '.$tag2;
$tplVars['formaction'] = $_SERVER['SCRIPT_NAME'] .'/'. $tag;
$tplVars['referrer'] = $_SERVER['HTTP_REFERER'];
$tplVars['formaction'] = $_SERVER['SCRIPT_NAME'];
$tplVars['referrer'] = HTTP_REFERER;
$templateservice->loadTemplate('tag2tagdelete.tpl', $tplVars);
?>

View file

@ -20,12 +20,19 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/
require_once('header.inc.php');
/* Service creation: only useful services are created */
$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService');
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
$userservice = & ServiceFactory :: getServiceInstance('UserService');
/* Managing all possible inputs */
isset($_SERVER['HTTP_REFERER']) ? define('HTTP_REFERER', $_SERVER['HTTP_REFERER']): define('HTTP_REFERER', '');
/* Managing current logged user */
$logged_on_user = $userservice->getCurrentUser();
//permissions
if($logged_on_user == null) {
$tplVars['error'] = T_('Permission denied.');
@ -33,23 +40,18 @@ if($logged_on_user == null) {
exit();
}
list ($url, $tag1, $tag2) = explode('/', $_SERVER['PATH_INFO']);
/*if ($_POST['confirm']) {
$tag = $_POST['tag1'];
$linkType = $_POST['linkType'];
$newTag = $_POST['tag2'];
if ($tag2tagservice->removeLinkedTags($_POST['tag1'], $_POST['tag2'], $linkType, $userservice->getCurrentUserId())) {
$tplVars['msg'] = T_('Tag link deleted');
header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')]));
/* Managing path info */
if(isset($_SERVER['PATH_INFO'])) {
$exploded = explode('/', $_SERVER['PATH_INFO']);
if(count($exploded) == 3) {
list ($url, $tag1, $tag2) = explode('/', $_SERVER['PATH_INFO']);
} else {
$tplVars['error'] = T_('Failed to delete the link');
$templateservice->loadTemplate('error.500.tpl', $tplVars);
exit();
list ($url, $tag1) = explode('/', $_SERVER['PATH_INFO']);
$tag2 = '';
}
} elseif ($_POST['cancel']) {
header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')] .'/'. $tags));
}*/
} else {
$url = $tag1 = $tag2 = '';
}
$tplVars['links'] = $tag2tagservice->getLinks($userservice->getCurrentUserId());
@ -58,6 +60,6 @@ $tplVars['tag2'] = $tag2;
$tplVars['subtitle'] = T_('Edit Link Between Tags') .': '. $tag1.' > '.$tag2;
$tplVars['formaddaction'] = createUrl('tag2tagadd');
$tplVars['formdeleteaction'] = createUrl('tag2tagdelete');
$tplVars['referrer'] = $_SERVER['HTTP_REFERER'];
$tplVars['referrer'] = HTTP_REFERER;
$templateservice->loadTemplate('tag2tagedit.tpl', $tplVars);
?>

View file

@ -1,56 +1,67 @@
<?php
/***************************************************************************
Copyright (C) 2006 - 2007 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
Copyright (C) 2006 - 2007 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
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 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.
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
***************************************************************************/
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');
/* Service creation: only useful services are created */
$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
$userservice = & ServiceFactory :: getServiceInstance('UserService');
$cdservice = & ServiceFactory :: getServiceInstance('CommonDescriptionService');
list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']);
$template = 'tagcommondescriptionedit.tpl';
/* Managing all possible inputs */
isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', '');
isset($_POST['cancel']) ? define('POST_CANCEL', $_POST['cancel']): define('POST_CANCEL', '');
isset($_POST['description']) ? define('POST_DESCRIPTION', $_POST['description']): define('POST_DESCRIPTION', '');
isset($_POST['referrer']) ? define('POST_REFERRER', $_POST['referrer']): define('POST_REFERRER', '');
$logged_on_user = $userservice->getCurrentUser();
/* Managing current logged user */
$currentUser = $userservice->getCurrentObjectUser();
/* Managing path info */
list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']);
//permissions
if($logged_on_user == null) {
if(!$userservice->isLoggedOn()) {
$tplVars['error'] = T_('Permission denied.');
$templateservice->loadTemplate('error.500.tpl', $tplVars);
exit();
}
if ($_POST['confirm']) {
$template = 'tagcommondescriptionedit.tpl';
if (POST_CONFIRM) {
if ( strlen($tag)>0 &&
$cdservice->addTagDescription($tag, stripslashes($_POST['description']), $logged_on_user['uId'], time())
$cdservice->addTagDescription($tag, stripslashes(POST_DESCRIPTION), $currentUser->getId(), time())
) {
$tplVars['msg'] = T_('Tag common description updated');
header('Location: '. $_POST['referrer']);
header('Location: '. POST_REFERRER);
} else {
$tplVars['error'] = T_('Failed to update the tag common description');
$template = 'error.500.tpl';
}
} elseif ($_POST['cancel']) {
$logged_on_user = $userservice->getCurrentUser();
header('Location: '. $_POST['referrer']);
} elseif (POST_CANCEL) {
header('Location: '. POST_REFERRER);
} else {
$tplVars['subtitle'] = T_('Edit Tag Common Description') .': '. $tag;
$tplVars['formaction'] = $_SERVER['SCRIPT_NAME'] .'/'. $tag;

View file

@ -20,25 +20,36 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/
require_once('header.inc.php');
/* Service creation: only useful services are created */
$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
$userservice = & ServiceFactory :: getServiceInstance('UserService');
$logged_on_user = $userservice->getCurrentUser();
/* Managing all possible inputs */
isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', '');
isset($_POST['cancel']) ? define('POST_CANCEL', $_POST['cancel']): define('POST_CANCEL', '');
isset($_POST['referrer']) ? define('POST_REFERRER', $_POST['referrer']): define('POST_REFERRER', '');
/* Managing current logged user */
$currentUser = $userservice->getCurrentObjectUser();
/* Managing path info */
list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']);
if ($_POST['confirm']) {
if ($b2tservice->deleteTag($logged_on_user['uId'], $tag)) {
if (POST_CONFIRM) {
if ($b2tservice->deleteTag($currentUser->getId(), $tag)) {
$tplVars['msg'] = T_('Tag deleted');
header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')]));
header('Location: '. createURL('bookmarks', $currentUser->getUsername()));
} else {
$tplVars['error'] = T_('Failed to delete the tag');
$templateservice->loadTemplate('error.500.tpl', $tplVars);
exit();
}
} elseif ($_POST['cancel']) {
header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')] .'/'. $tags));
} elseif (POST_CANCEL) {
header('Location: '. POST_REFERRER);
}
$tplVars['subtitle'] = T_('Delete Tag') .': '. $tag;

View file

@ -1,61 +1,70 @@
<?php
/***************************************************************************
Copyright (C) 2006 - 2007 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
Copyright (C) 2006 - 2007 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
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 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.
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
***************************************************************************/
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');
/* Service creation: only useful services are created */
$tagservice = & ServiceFactory :: getServiceInstance('TagService');
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
$userservice = & ServiceFactory :: getServiceInstance('UserService');
/* Managing all possible inputs */
isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', '');
isset($_POST['cancel']) ? define('POST_CANCEL', $_POST['cancel']): define('POST_CANCEL', '');
isset($_POST['description']) ? define('POST_DESCRIPTION', $_POST['description']): define('POST_DESCRIPTION', '');
isset($_POST['referrer']) ? define('POST_REFERRER', $_POST['referrer']): define('POST_REFERRER', '');
/* Managing current logged user */
$currentUser = $userservice->getCurrentObjectUser();
/* Managing path info */
list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']);
$template = 'tagedit.tpl';
$logged_on_user = $userservice->getCurrentUser();
//permissions
if($logged_on_user == null) {
if(!$userservice->isLoggedOn()) {
$tplVars['error'] = T_('Permission denied.');
$templateservice->loadTemplate('error.500.tpl', $tplVars);
exit();
}
if ($_POST['confirm']) {
if (POST_CONFIRM) {
if ( strlen($tag)>0 &&
$tagservice->updateDescription($tag, $logged_on_user['uId'], $_POST['description'])
$tagservice->updateDescription($tag, $currentUser->getId(), POST_DESCRIPTION)
) {
$tplVars['msg'] = T_('Tag description updated');
header('Location: '. $_POST['referrer']);
header('Location: '. POST_REFERRER);
} else {
$tplVars['error'] = T_('Failed to update the tag description');
$template = 'error.500.tpl';
}
} elseif ($_POST['cancel']) {
$logged_on_user = $userservice->getCurrentUser();
header('Location: '. $_POST['referrer']);
} elseif (POST_CANCEL) {
header('Location: '. POST_REFERRER);
} else {
$tplVars['subtitle'] = T_('Edit Tag Description') .': '. $tag;
$tplVars['formaction'] = $_SERVER['SCRIPT_NAME'] .'/'. $tag;
$tplVars['referrer'] = $_SERVER['HTTP_REFERER'];
$tplVars['tag'] = $tag;
$tplVars['description'] = $tagservice->getDescription($tag, $logged_on_user['uId']);
$tplVars['description'] = $tagservice->getDescription($tag, $currentUser->getId());
}
$templateservice->loadTemplate($template, $tplVars);
?>

View file

@ -1,63 +1,75 @@
<?php
/***************************************************************************
Copyright (C) 2006 - 2007 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
Copyright (C) 2006 - 2007 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
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 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.
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
***************************************************************************/
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');
/* Service creation: only useful services are created */
$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
$tagservice = & ServiceFactory :: getServiceInstance('TagService');
$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2tagService');
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
$userservice = & ServiceFactory :: getServiceInstance('UserService');
/* Managing all possible inputs */
isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', '');
isset($_POST['cancel']) ? define('POST_CANCEL', $_POST['cancel']): define('POST_CANCEL', '');
isset($_POST['old']) ? define('POST_OLD', $_POST['old']): define('POST_OLD', '');
isset($_POST['new']) ? define('POST_NEW', $_POST['new']): define('POST_NEW', '');
/* Managing current logged user */
$currentUser = $userservice->getCurrentObjectUser();
/* Managing path info */
list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']);
//$tag = isset($_GET['query']) ? $_GET['query'] : NULL;
$template = 'tagrename.tpl';
if ($_POST['confirm']) {
if (isset($_POST['old']) && trim($_POST['old']) != '')
$old = trim($_REQUEST['old']);
else
if (POST_CONFIRM) {
if (trim(POST_OLD) != '') {
$old = trim(POST_OLD);
} else {
$old = NULL;
}
if (isset($_POST['new']) && trim($_POST['new']) != '')
$new = trim($_POST['new']);
else
if (trim(POST_NEW) != '') {
$new = trim(POST_NEW);
} else {
$new = NULL;
}
if (
!is_null($old) &&
!is_null($new) &&
$tagservice->renameTag($userservice->getCurrentUserId(), $old, $new) &&
$b2tservice->renameTag($userservice->getCurrentUserId(), $old, $new) &&
$tag2tagservice->renameTag($userservice->getCurrentUserId(), $old, $new)
$tagservice->renameTag($currentUser->getId(), $old, $new) &&
$b2tservice->renameTag($currentUser->getId(), $old, $new) &&
$tag2tagservice->renameTag($currentUser->getId(), $old, $new)
) {
$tplVars['msg'] = T_('Tag renamed');
$logged_on_user = $userservice->getCurrentUser();
header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')]));
header('Location: '. createURL('bookmarks', $currentUser->getUsername()));
} else {
$tplVars['error'] = T_('Failed to rename the tag');
$template = 'error.500.tpl';
}
} elseif ($_POST['cancel']) {
$logged_on_user = $userservice->getCurrentUser();
header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')] .'/'. $tags));
} elseif (POST_CANCEL) {
header('Location: '. createURL('bookmarks', $currentUser->getUsername() .'/'. $tags));
} else {
$tplVars['subtitle'] = T_('Rename Tag') .': '. $tag;
$tplVars['formaction'] = $_SERVER['SCRIPT_NAME'] .'/'. $tag;

View file

@ -1,34 +1,45 @@
<?php
/***************************************************************************
Copyright (C) 2004 - 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
Copyright (C) 2004 - 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
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 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.
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
***************************************************************************/
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');
/* Service creation: only useful services are created */
$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$userservice =& ServiceFactory::getServiceInstance('UserService');
$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
/* Managing all possible inputs */
isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
/* Managing current logged user */
$currentUser = $userservice->getCurrentObjectUser();
/* Managing path info */
list($url, $cat) = explode('/', $_SERVER['PATH_INFO']);
$tplVars = array();
list($url, $cat) = explode('/', $_SERVER['PATH_INFO']);
if (!$cat) {
header('Location: '. createURL('populartags'));
exit;
@ -40,7 +51,7 @@ $pagetitle = T_('Tags') .': '. $cattitle;
if ($usecache) {
// Generate hash for caching on
if ($userservice->isLoggedOn()) {
$hash = md5($_SERVER['REQUEST_URI'] . $userservice->getCurrentUserID());
$hash = md5($_SERVER['REQUEST_URI'] . $currentUser->getId());
} else {
$hash = md5($_SERVER['REQUEST_URI']);
}
@ -53,13 +64,13 @@ if ($usecache) {
$tplVars['pagetitle'] = $pagetitle;
$tplVars['loadjs'] = true;
$tplVars['rsschannels'] = array(
array(filter($sitename .': '. $pagetitle), createURL('rss', 'all/'. filter($cat, 'url')).'?sort='.getSortOrder())
array(filter($sitename .': '. $pagetitle), createURL('rss', 'all/'. filter($cat, 'url')).'?sort='.getSortOrder())
);
// Pagination
$perpage = getPerPageCount();
if (isset($_GET['page']) && intval($_GET['page']) > 1) {
$page = $_GET['page'];
if (intval(GET_PAGE) > 1) {
$page = GET_PAGE;
$start = ($page - 1) * $perpage;
} else {
$page = 0;

View file

@ -1,9 +1,13 @@
<?php
$this->includeTemplate($GLOBALS['top_include']);
/* Service creation: only useful services are created */
$userservice =& ServiceFactory::getServiceInstance('UserService');
$currentUser = $userservice->getCurrentUser();
$currentUserId = $userservice->getCurrentUserId();
//$currentUser = $userservice->getCurrentUser();
//$currentUserId = $userservice->getCurrentUserId();
$currentObjectUser = $userservice->getCurrentObjectUser();
$this->includeTemplate($GLOBALS['top_include']);
?>
<ul>
@ -20,9 +24,10 @@ $currentUserId = $userservice->getCurrentUserId();
<?php if(!is_null($currentUser) && $userservice->isAdmin($currentUserId)): ?>
<?php if(!is_null($currentObjectUser) && $currentObjectUser->isAdmin()): ?>
<li>SemanticScuttle v0.91</li>
<?php endif ?>
</ul>
<?php

View file

@ -1,7 +1,12 @@
<?php
$this->includeTemplate($GLOBALS['top_include']);
/* Service creation: only useful services are created */
$userservice = & ServiceFactory :: getServiceInstance('UserService');
$this->includeTemplate($GLOBALS['top_include']);
list ($url, $hash) = explode('/', $_SERVER['PATH_INFO']);
?>
<script type="text/javascript">
window.onload = function() {

View file

@ -6,8 +6,6 @@ $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
$tagservice =& ServiceFactory::getServiceInstance('TagService');
$cdservice =& ServiceFactory::getServiceInstance('CommonDescriptionService');
//$logged_on_userid = $userservice->getCurrentUserId();
//$currentUser = $userservice->getCurrentUser();
//$currentUsername = $currentUser[$userservice->getFieldName('username')];
@ -28,10 +26,13 @@ include('search.inc.php');
<?php
if((isset($currenttag) && $GLOBALS['enableCommonTagDescription'])
// common tag description
if((isset($currenttag) && $currenttag!= '' && $GLOBALS['enableCommonTagDescription'])
|| (isset($hash) && $GLOBALS['enableCommonBookmarkDescription'])):?>
<p class="commondescription"><?php
if(isset($currenttag) && $cdservice->getLastTagDescription($currenttag)) {
if(isset($currenttag) && $currenttag!= '' && $cdservice->getLastTagDescription($currenttag)) {
$description = $cdservice->getLastTagDescription($currenttag);
echo nl2br(filter($description['cdDescription']));
} elseif(isset($hash) && $cdservice->getLastBookmarkDescription($hash)) {
@ -40,8 +41,9 @@ if(isset($currenttag) && $cdservice->getLastTagDescription($currenttag)) {
echo nl2br(filter($description['cdDescription'])). "<br/>";
}
//common tag description edit
if($userservice->isLoggedOn()) {
if(isset($currenttag)) {
if(isset($currenttag) && $currenttag!= '') {
echo ' (<a href="'. createURL('tagcommondescriptionedit', $currenttag).'">';
echo T_('edit common description').'</a>)';
} elseif(isset($hash)) {
@ -55,7 +57,7 @@ if($userservice->isLoggedOn()) {
<?php
/* Private tag description */
if(isset($currenttag) && isset($user)) {
if(isset($currenttag) && $currenttag!= '' && isset($user)) {
$userObject = $userservice->getUserByUsername($user);
if($tagservice->getDescription($currenttag, $userObject['uId'])) { ?>
@ -87,7 +89,7 @@ if (!isset($hash)) {
<?php
}
?> <?php
if(isset($currenttag)) {
if(isset($currenttag) && $currenttag!= '') {
if(isset($user)) {
echo ' - ';
echo '<a href="'. createURL('tags', $currenttag) .'">';
@ -216,8 +218,8 @@ if(isset($currenttag)) {
// Ordering
$sortOrder = '';
if (isset($_GET['sort'])) {
$sortOrder = 'sort='. $_GET['sort'];
if (GET_SORT != '') {
$sortOrder = 'sort='. GET_SORT;
}
$sortAmp = (($sortOrder) ? '&amp;'. $sortOrder : '');

View file

@ -47,8 +47,6 @@ switch ($row['bStatus']) {
<input type="text" dojoType="dojox.form.MultiComboBox" id="tags" name="tags" size="75" value="<?php echo filter(implode(', ', $row['tags']), 'xml'); ?>" store="memberTagStore" delimiter="," searchAttr="tag" hasDownArrow="false"/></td>
<td>&larr; <?php echo T_('Comma-separated'); ?></td>
</tr>
<tr>
<th></th>
<td align="right"><small><?php echo T_('Note: use ">" to include one tag in another. e.g.: europe>france>paris')?><small></td>
@ -73,7 +71,7 @@ switch ($row['bStatus']) {
<td>
<input type="submit" name="submitted" value="<?php echo $btnsubmit; ?>" />
<?php
if ($showdelete) {
if (isset($showdelete) && $showdelete) {
?>
<input type="submit" name="delete" value="<?php echo T_('Delete Bookmark'); ?>" />
<?php
@ -82,7 +80,7 @@ switch ($row['bStatus']) {
?>
<input type="hidden" name="popup" value="1" />
<?php
} elseif ($referrer) {
} elseif (isset($referrer)) {
?>
<input type="hidden" name="referrer" value="<?php echo $referrer; ?>" />
<?php
@ -99,7 +97,7 @@ switch ($row['bStatus']) {
$this->includeTemplate('dynamictags.inc');
// Bookmarklets and import links
if (empty($_REQUEST['popup']) && !$showdelete) {
if (empty($_REQUEST['popup']) && (!isset($showdelete) || !$showdelete)) {
?>
<h3><?php echo T_('Bookmarklet'); ?></h3>

View file

@ -27,7 +27,7 @@ $this->includeTemplate($GLOBALS['top_include']);
</tr>
<tr>
<th align="left"><?php echo T_('E-mail'); ?></th>
<td><input type="text" name="pMail" size="75" value="<?php echo filter($row['email'], 'xml'); ?>" /></td>
<td><input type="text" name="pMail" size="75" value="<?php echo filter($objectUser->getEmail(), 'xml'); ?>" /></td>
<td>&larr; <?php echo T_('Required'); ?></td>
</tr>
</table>
@ -37,15 +37,15 @@ $this->includeTemplate($GLOBALS['top_include']);
<table class="profile">
<tr>
<th align="left"><?php echo T_('Name'); ?></th>
<td><input type="text" name="pName" size="75" value="<?php echo filter($row['name'], 'xml'); ?>" /></td>
<td><input type="text" name="pName" size="75" value="<?php echo filter($objectUser->getName(), 'xml'); ?>" /></td>
</tr>
<tr>
<th align="left"><?php echo T_('Homepage'); ?></th>
<td><input type="text" name="pPage" size="75" value="<?php echo filter($row['homepage']); ?>" /></td>
<td><input type="text" name="pPage" size="75" value="<?php echo filter($objectUser->getHomepage()); ?>" /></td>
</tr>
<tr>
<th align="left"><?php echo T_('Description'); ?></th>
<td><textarea name="pDesc" cols="75" rows="10"><?php echo $row['uContent']; ?></textarea></td>
<td><textarea name="pDesc" cols="75" rows="10"><?php echo $objectUser->getContent(); ?></textarea></td>
</tr>
<tr>
<th></th>

View file

@ -7,26 +7,26 @@ $this->includeTemplate($GLOBALS['top_include']);
<dt><?php echo T_('Username'); ?></dt>
<dd><?php echo $user; ?></dd>
<?php
if ($row['name'] != "") {
if ($objectUser->getName() != "") {
?>
<dt><?php echo T_('Name'); ?></dt>
<dd><?php echo filter($row['name']); ?></dd>
<dd><?php echo filter($objectUser->getName()); ?></dd>
<?php
}
if ($row['homepage'] != "") {
if ($objectUser->getHomepage() != "") {
?>
<dt><?php echo T_('Homepage'); ?></dt>
<dd><a href="<?php echo filter($row['homepage']); ?>"><?php echo filter($row['homepage']); ?></a></dd>
<dd><a href="<?php echo filter($objectUser->getHomepage()); ?>"><?php echo filter($objectUser->getHomepage()); ?></a></dd>
<?php
}
?>
<dt><?php echo T_('Member Since'); ?></dt>
<dd><?php echo date($GLOBALS['longdate'], strtotime($row['uDatetime'])); ?></dd>
<dd><?php echo date($GLOBALS['longdate'], strtotime($objectUser->getDatetime())); ?></dd>
<?php
if ($row['uContent'] != "") {
if ($objectUser->getContent() != "") {
?>
<dt><?php echo T_('Description'); ?></dt>
<dd><?php echo $row['uContent']; ?></dd>
<dd><?php echo $objectUser->getContent(); ?></dd>
<?php
}
$watching = $userservice->getWatchNames($userid);

View file

@ -4,25 +4,23 @@ $commonTags =& $b2tservice->getRelatedTagsByHash($hash);
$commonTags =& $b2tservice->tagCloud($commonTags, 5, 90, 225, 'alphabet_asc');
if ($commonTags && count($commonTags) > 0) {
?>
?>
<h2><?php echo T_('Popular Tags'); ?></h2>
<div id="common">
<p class="tags">
<?php
$contents = '';
<p class="tags"><?php
$contents = '';
if(strlen($user)==0) {
if(strlen($user)==0) {
$cat_url = createURL('tags', '%2$s');
}
}
foreach ($commonTags as $row) {
foreach ($commonTags as $row) {
$entries = T_ngettext('bookmark', 'bookmarks', $row['bCount']);
$contents .= '<a href="'. sprintf($cat_url, $user, filter($row['tag'], 'url')) .'" title="'. $row['bCount'] .' '. $entries .'" rel="tag" style="font-size:'. $row['size'] .'">'. filter($row['tag']) .'</a> ';
}
echo $contents ."\n";
?>
</p>
}
echo $contents ."\n";
?></p>
</div>
<?php

View file

@ -2,6 +2,13 @@
$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
$userservice =& ServiceFactory::getServiceInstance('UserService');
if(!isset($user)) {
$user = '';
}
if(!isset($userid)) {
$userid = NULL;
}
$logged_on_userid = $userservice->getCurrentUserId();
if ($logged_on_userid === false) {
$logged_on_userid = NULL;

View file

@ -20,7 +20,7 @@ if ($recentTags && count($recentTags) > 0) {
<?php
$contents = '<p class="tags">';
if(!isset($user)) {
if(!isset($user) || $user == '') {
$user = '';
$cat_url = createURL('tags', '%2$s');
}

View file

@ -6,7 +6,12 @@ $logged_on_userid = $userservice->getCurrentUserId();
if ($logged_on_userid === false) {
$logged_on_userid = NULL;
}
if(strlen($user)==0) {
if(!isset($userid)) {
$userid = NULL;
}
if(isset($user) && strlen($user)==0) {
$cat_url = createURL('tags', '%2$s');
}
if ($currenttag) {

View file

@ -22,6 +22,7 @@ if(isset($rsschannels)) {
<script type="text/javascript"
src="<?php echo ROOT ?>jsScuttle.php"></script>
<link rel="stylesheet" type="text/css"
href="http://ajax.googleapis.com/ajax/libs/dojo/1.2/dijit/themes/nihilo/nihilo.css">

View file

@ -1,27 +1,24 @@
<?php
/* Service creation: only useful services are created */
$userservice =& ServiceFactory::getServiceInstance('UserService');
$currentUser = $userservice->getCurrentUser();
$currentUserID = $userservice->getCurrentUserId();
$currentUsername = $currentUser[$userservice->getFieldName('username')];
$currentObjectUser = $userservice->getCurrentObjectUser();
$this->includeTemplate($GLOBALS['top_include']);
echo '<ol id="bookmarks">';
foreach(array_keys($users) as $key) {
foreach($users as $user) {
echo '<li class="xfolkentry">'."\n";
echo '<div class="link">';
echo '<a href="'.createURL('profile', $users[$key][$userservice->getFieldname('username')]).'">'.$users[$key][$userservice->getFieldName('username')].'</a>';
echo '<a href="'.createURL('profile', $user->getUsername()).'">'.$user->getUsername().'</a>';
echo '</div>';
if($users[$key][$userservice->getFieldName('username')] != $currentUsername) {
if($user->getUsername() != $currentObjectUser->getUsername()) {
echo '<div class="meta">';
echo '<a href="'.createURL('admin','delete/'.$users[$key][$userservice->getFieldname('username')]).'" onclick="return confirm(\''.T_('Are you sure?').'\');">'.T_('Delete').'</a>';
echo '<a href="'.createURL('admin','delete/'.$user->getUsername()).'" onclick="return confirm(\''.T_('Are you sure?').'\');">'.T_('Delete').'</a>';
echo '</div>';
}

View file

@ -21,21 +21,26 @@
require_once('header.inc.php');
/* Service creation: only useful services are created */
$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$userservice =& ServiceFactory::getServiceInstance('UserService');
$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
$tplVars = array();
/* Managing current logged user */
$currentUser = $userservice->getCurrentObjectUser();
/* Managing path info */
list($url, $cat) = explode('/', $_SERVER['PATH_INFO']);
$tplVars = array();
$pagetitle = T_('Users');
if ($usecache) {
// Generate hash for caching on
if ($userservice->isLoggedOn()) {
$hash = md5($_SERVER['REQUEST_URI'] . $userservice->getCurrentUserID());
$hash = md5($_SERVER['REQUEST_URI'] . $currentUser->getId());
} else {
$hash = md5($_SERVER['REQUEST_URI']);
}

View file

@ -1,28 +1,36 @@
<?php
/***************************************************************************
Copyright (C) 2004 - 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
Copyright (C) 2004 - 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
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 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.
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
***************************************************************************/
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');
/* Service creation: only useful services are created */
$userservice =& ServiceFactory::getServiceInstance('UserService');
/* Managing current logged user */
$currentUser = $userservice->getCurrentObjectUser();
/* Managing path info */
@list($url, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL;
if ($userservice->isLoggedOn() && $user) {
$tplVars = array();
$pagetitle = '';
@ -30,16 +38,17 @@ if ($userservice->isLoggedOn() && $user) {
if (is_int($user)) {
$userid = intval($user);
} else {
if (!($userinfo = $userservice->getUserByUsername($user))) {
$userinfo = $userservice->getObjectUserByUsername($user);
if ($userinfo == '') {
$tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
$templateservice->loadTemplate('error.404.tpl', $tplVars);
exit();
} else {
$userid =& $userinfo['uId'];
$userid =& $userinfo->getId();
}
}
$watched = $userservice->getWatchStatus($userid, $userservice->getCurrentUserId());
$watched = $userservice->getWatchStatus($userid, $currentUser->getId());
$changed = $userservice->setWatchStatus($userid);
if ($watched) {
@ -48,9 +57,6 @@ if ($userservice->isLoggedOn() && $user) {
$tplVars['msg'] = T_('User added to your watchlist');
}
$currentUser = $userservice->getCurrentUser();
$currentUsername = $currentUser[$userservice->getFieldName('username')];
header('Location: '. createURL('watchlist', $currentUsername));
header('Location: '. createURL('watchlist', $currentUser->getUsername()));
}
?>

View file

@ -20,27 +20,29 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/
require_once('header.inc.php');
/* Service creation: only useful services are created */
$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$userservice =& ServiceFactory::getServiceInstance('UserService');
$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
$tplVars = array();
/* Managing all possible inputs */
isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
/* Managing current logged user */
$currentUser = $userservice->getCurrentObjectUser();
/* Managing path info */
@list($url, $user, $page) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL;
$loggedon = false;
if ($userservice->isLoggedOn()) {
$loggedon = true;
$currentUser = $userservice->getCurrentUser();
$currentUsername = $currentUser[$userservice->getFieldName('username')];
}
$tplVars = array();
if ($usecache) {
// Generate hash for caching on
if ($loggedon) {
if ($currentUsername != $user) {
$cachehash = md5($_SERVER['REQUEST_URI'] . $currentUsername);
if ($userservice->isLoggedOn()) {
if ($currentUser->getUsername() != $user) {
$cachehash = md5($_SERVER['REQUEST_URI'] . $currentUser->getUsername());
// Cache for 5 minutes
$cacheservice->Start($cachehash);
@ -56,13 +58,14 @@ if ($user) {
if (is_int($user)) {
$userid = intval($user);
} else {
if (!($userinfo = $userservice->getUserByUsername($user) ) ) {
$userinfo = $userservice->getObjectUserByUsername($user);
if ($userinfo == '' ) {
// Throw a 404 error
$tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
$templateservice->loadTemplate('error.404.tpl', $tplVars);
exit();
} else {
$userid =& $userinfo['uId'];
$userid =& $userinfo->getId();
}
}
}
@ -77,8 +80,8 @@ if ($user) {
// Pagination
$perpage = getPerPageCount();
if (isset($_GET['page']) && intval($_GET['page']) > 1) {
$page = $_GET['page'];
if (intval(GET_PAGE) > 1) {
$page = GET_PAGE;
$start = ($page - 1) * $perpage;
} else {
$page = 0;
@ -86,6 +89,7 @@ if ($user) {
}
// Set template vars
$tplVars['currenttag'] = '';
$tplVars['page'] = $page;
$tplVars['start'] = $start;
$tplVars['bookmarkCount'] = $start + 1;
@ -99,7 +103,7 @@ if ($user) {
$tplVars['cat_url'] = createURL('tags', '%2$s');
$tplVars['nav_url'] = createURL('watchlist', '%s/%s%s');
if ($user == $currentUsername) {
if ($userservice->isLoggedOn() && $user == $currentUser->getUsername()) {
$title = T_('My Watchlist');
} else {
$title = T_('Watchlist') .': '. $user;