2007-12-12 16:29:16 +00:00
|
|
|
<?php
|
|
|
|
/***************************************************************************
|
2008-11-25 15:57:29 +00:00
|
|
|
Copyright (C) 2004 - 2006 Scuttle project
|
|
|
|
http://sourceforge.net/projects/scuttle/
|
|
|
|
http://scuttle.org/
|
2007-12-12 16:29:16 +00:00
|
|
|
|
2008-11-25 15:57:29 +00:00
|
|
|
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.
|
2007-12-12 16:29:16 +00:00
|
|
|
|
2008-11-25 15:57:29 +00:00
|
|
|
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.
|
2007-12-12 16:29:16 +00:00
|
|
|
|
2008-11-25 15:57:29 +00:00
|
|
|
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
|
|
|
|
***************************************************************************/
|
2007-12-12 16:29:16 +00:00
|
|
|
|
2010-02-08 07:32:34 +00:00
|
|
|
require_once 'www-header.php';
|
2008-11-25 15:57:29 +00:00
|
|
|
|
|
|
|
/* Service creation: only useful services are created */
|
2008-12-05 07:25:04 +00:00
|
|
|
//No specific services
|
2007-12-12 16:29:16 +00:00
|
|
|
|
2009-02-17 11:31:16 +00:00
|
|
|
isset($_POST['contact']) ? define('POST_CONTACT', $_POST['contact']): define('POST_CONTACT', '');
|
|
|
|
isset($_GET['contact']) ? define('GET_CONTACT', $_GET['contact']): define('GET_CONTACT', '');
|
2008-11-25 15:57:29 +00:00
|
|
|
|
|
|
|
/* Managing path info */
|
2011-01-24 07:04:08 +00:00
|
|
|
@list($url, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : null;
|
2008-11-25 15:57:29 +00:00
|
|
|
|
2011-01-24 07:04:08 +00:00
|
|
|
if ($user=='' && POST_CONTACT != '') {
|
|
|
|
$user = POST_CONTACT;
|
|
|
|
} elseif ($user=='' && GET_CONTACT != '') {
|
|
|
|
$user = GET_CONTACT;
|
2009-02-10 11:40:07 +00:00
|
|
|
}
|
2008-11-25 15:57:29 +00:00
|
|
|
|
2007-12-12 16:29:16 +00:00
|
|
|
if ($userservice->isLoggedOn() && $user) {
|
2011-01-24 07:04:08 +00:00
|
|
|
$pagetitle = '';
|
|
|
|
|
|
|
|
$userid = $userservice->getIdFromUser($user);
|
|
|
|
|
|
|
|
if ($userid == null) {
|
|
|
|
$tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
|
|
|
|
$templateservice->loadTemplate('error.404.tpl', $tplVars);
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
$watched = $userservice->getWatchStatus($userid, $currentUser->getId());
|
|
|
|
$changed = $userservice->setWatchStatus($userid);
|
|
|
|
|
|
|
|
if ($watched) {
|
|
|
|
$tplVars['msg'] = T_('User removed from your watchlist');
|
|
|
|
} else {
|
|
|
|
$tplVars['msg'] = T_('User added to your watchlist');
|
|
|
|
}
|
|
|
|
|
|
|
|
header('Location: '. createURL('watchlist', $currentUser->getUsername()));
|
2007-12-12 16:29:16 +00:00
|
|
|
}
|
|
|
|
?>
|