Cleaning up some code in www folder

This commit is contained in:
Mark Pemberton 2011-01-24 02:04:08 -05:00
parent 8d91bf83bc
commit 456af09a04
49 changed files with 1260 additions and 1100 deletions

View File

@ -45,11 +45,10 @@ if ( !$currentUser->isAdmin() ) {
exit(); exit();
} }
@list($url, $action, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL; @list($url, $action, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : null;
if ( $action // Prevent CSRF attacks
&& (strpos($_SERVER['HTTP_REFERER'], ROOT.'admin') === 0) // Prevent CSRF attacks if ($action && (strpos($_SERVER['HTTP_REFERER'], ROOT.'admin') === 0)) {
) {
switch ($action) { switch ($action) {
case 'delete': case 'delete':
if ($user && ($userinfo = $userservice->getUserByUsername($user))) { if ($user && ($userinfo = $userservice->getUserByUsername($user))) {
@ -69,7 +68,7 @@ if ( $action
} }
break; break;
case 'checkUrl' : case 'checkUrl' :
$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, NULL, NULL, getSortOrder()); $bookmarks =& $bookmarkservice->getBookmarks(0, null, null, null, null, getSortOrder());
foreach ($bookmarks['bookmarks'] as $bookmark) { foreach ($bookmarks['bookmarks'] as $bookmark) {
if (!checkUrl($bookmark['bAddress'])) { if (!checkUrl($bookmark['bAddress'])) {
$tplVars['error'].= T_('Problem with ').$bookmark['bAddress'].' ('. $bookmark['username'] .')<br/>'; $tplVars['error'].= T_('Problem with ').$bookmark['bAddress'].' ('. $bookmark['username'] .')<br/>';

View File

@ -33,8 +33,10 @@ isset($_GET['tag']) ? define('GET_TAG', $_GET['tag']): define('GET_TAG', '');
isset($_GET['uId']) ? define('GET_UID', $_GET['uId']): define('GET_UID', ''); isset($_GET['uId']) ? define('GET_UID', $_GET['uId']): define('GET_UID', '');
function displayTag($tag, $uId) { function displayTag($tag, $uId)
$uId = ($uId==0)?NULL:$uId; // if user is nobody, NULL allows to look for every public tags {
// if user is nobody, NULL allows to look for every public tags
$uId = ($uId==0) ? null : $uId;
$tag2tagservice = SemanticScuttle_Service_Factory::get('Tag2Tag'); $tag2tagservice = SemanticScuttle_Service_Factory::get('Tag2Tag');
$output = '{ id:'.rand().', name:\''.$tag.'\''; $output = '{ id:'.rand().', name:\''.$tag.'\'';
@ -45,7 +47,8 @@ function displayTag($tag, $uId) {
foreach ($linkedTags as $linkedTag) { foreach ($linkedTags as $linkedTag) {
$output.= displayTag($linkedTag, $uId); $output.= displayTag($linkedTag, $uId);
} }
$output = substr($output, 0, -1); // remove final comma avoiding IE6 Dojo bug /* remove final comma avoiding IE6 Dojo bug */
$output = substr($output, 0, -1);
$output.= "]"; $output.= "]";
} }
@ -58,7 +61,8 @@ function displayTag($tag, $uId) {
{ label: 'name', identifier: 'id', items: [ { label: 'name', identifier: 'id', items: [
<?php <?php
$json = displayTag(GET_TAG, intval(GET_UID)); $json = displayTag(GET_TAG, intval(GET_UID));
$json = substr($json, 0, -1); // remove final comma avoiding IE6 Dojo bug // remove final comma avoiding IE6 Dojo bug
$json = substr($json, 0, -1);
echo $json; echo $json;
?> ?>
] } ] }

View File

@ -19,7 +19,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/ ***************************************************************************/
/* Return a json file with list of tags according to current user and sort by popularity*/ /* Return a json file with list of tags according */
/* to current user and sort by popularity */
$httpContentType = 'application/json'; $httpContentType = 'application/json';
require_once '../www-header.php'; require_once '../www-header.php';
@ -29,8 +30,7 @@ $bookmarkservice =SemanticScuttle_Service_Factory::get('Tag');
?> ?>
{identifier:"tag", {identifier:"tag", items: [
items: [
<?php <?php
$listTags = $b2tservice->getAdminTags(1000, $userservice->getCurrentUserId()); $listTags = $b2tservice->getAdminTags(1000, $userservice->getCurrentUserId());
foreach ($listTags as $t) { foreach ($listTags as $t) {
@ -38,7 +38,3 @@ items: [
} }
?> ?>
]} ]}

View File

@ -19,7 +19,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/ ***************************************************************************/
/* Return a json file with list of tags according to current user and sort by popularity*/ /* Return a json file with list of tags according */
/* to current user and sort by popularity */
$httpContentType = 'application/json'; $httpContentType = 'application/json';
require_once '../www-header.php'; require_once '../www-header.php';
@ -29,16 +30,13 @@ $bookmarkservice =SemanticScuttle_Service_Factory::get('Tag');
?> ?>
{identifier:"tag", {identifier:"tag", items: [
items: [
<?php <?php
$listTags = $b2tservice->getContactTags($userservice->getCurrentUserId(), 1000, $userservice->getCurrentUserId()); $listTags = $b2tservice->getContactTags(
$userservice->getCurrentUserId(), 1000, $userservice->getCurrentUserId()
);
foreach ($listTags as $t) { foreach ($listTags as $t) {
echo "{tag: \"".$t['tag']."\"},"; echo "{tag: \"".$t['tag']."\"},";
} }
?> ?>
]} ]}

View File

@ -33,8 +33,10 @@ isset($_GET['tag']) ? define('GET_TAG', $_GET['tag']): define('GET_TAG', '');
isset($_GET['uId']) ? define('GET_UID', $_GET['uId']): define('GET_UID', ''); isset($_GET['uId']) ? define('GET_UID', $_GET['uId']): define('GET_UID', '');
function displayTag($tag, $uId) { function displayTag($tag, $uId)
$uId = ($uId==0)?NULL:$uId; // if user is nobody, NULL allows to look for every public tags {
// if user is nobody, NULL allows to look for every public tags
$uId = ($uId==0) ? null : $uId;
$tag2tagservice =SemanticScuttle_Service_Factory::get('Tag2Tag'); $tag2tagservice =SemanticScuttle_Service_Factory::get('Tag2Tag');
$output = '{ id:'.rand().', name:\''.$tag.'\''; $output = '{ id:'.rand().', name:\''.$tag.'\'';
@ -45,7 +47,8 @@ function displayTag($tag, $uId) {
foreach ($linkedTags as $linkedTag) { foreach ($linkedTags as $linkedTag) {
$output.= displayTag($linkedTag, $uId); $output.= displayTag($linkedTag, $uId);
} }
$output = substr($output, 0, -1); // remove final comma avoiding IE6 Dojo bug // remove final comma avoiding IE6 Dojo bug
$output = substr($output, 0, -1);
$output.= "]"; $output.= "]";
} }
@ -58,7 +61,8 @@ function displayTag($tag, $uId) {
{ label: 'name', identifier: 'id', items: [ { label: 'name', identifier: 'id', items: [
<?php <?php
$json = displayTag(GET_TAG, intval(GET_UID)); $json = displayTag(GET_TAG, intval(GET_UID));
$json = substr($json, 0, -1); // remove final comma avoiding IE6 Dojo bug // remove final comma avoiding IE6 Dojo bug
$json = substr($json, 0, -1);
echo $json; echo $json;
?> ?>
] } ] }

View File

@ -19,7 +19,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/ ***************************************************************************/
/* Return a json file with list of tags according to current user and sort by popularity*/ /* Return a json file with list of tags according */
/* to current user and sort by popularity */
$httpContentType = 'application/json'; $httpContentType = 'application/json';
require_once '../www-header.php'; require_once '../www-header.php';
@ -32,13 +33,11 @@ $bookmarkservice =SemanticScuttle_Service_Factory::get('Tag');
{identifier:"tag", {identifier:"tag",
items: [ items: [
<?php <?php
$listTags = $b2tservice->getPopularTags($userservice->getCurrentUserId(), 1000, $userservice->getCurrentUserId()); $listTags = $b2tservice->getPopularTags(
$userservice->getCurrentUserId(), 1000, $userservice->getCurrentUserId()
);
foreach ($listTags as $t) { foreach ($listTags as $t) {
echo "{tag: \"".$t['tag']."\"},"; echo "{tag: \"".$t['tag']."\"},";
} }
?> ?>
]} ]}

View File

@ -28,7 +28,8 @@ require_once 'www-header.php';
/* Managing all possible inputs */ /* Managing all possible inputs */
isset($_GET['url']) ? define('GET_URL', $_GET['url']): define('GET_URL', ''); isset($_GET['url']) ? define('GET_URL', $_GET['url']): define('GET_URL', '');
function getTitle($url) { function getTitle($url)
{
$fd = @fopen($url, 'r'); $fd = @fopen($url, 'r');
if ($fd) { if ($fd) {
$html = fread($fd, 1750); $html = fread($fd, 1750);

View File

@ -50,17 +50,15 @@ if ($usecache) {
$pagetitle = T_('All Tags'); $pagetitle = T_('All Tags');
if (isset($user) && $user != '') { if (isset($user) && $user != '') {
$userid = $userservice->getIdFromUser($user); $userid = $userservice->getIdFromUser($user);
if($userid == NULL) { if ($userid == null) {
$tplVars['error'] = sprintf(T_('User with username %s was not found'), $user); $tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
$templateservice->loadTemplate('error.404.tpl', $tplVars); $templateservice->loadTemplate('error.404.tpl', $tplVars);
exit(); exit();
} }
$pagetitle .= ': '. ucfirst($user); $pagetitle .= ': '. ucfirst($user);
} else { } else {
$userid = NULL; $userid = null;
} }
$tags =& $b2tservice->getTags($userid); $tags =& $b2tservice->getTags($userid);

View File

@ -41,21 +41,26 @@ echo 'url;title;tags;description';
echo "\n"; echo "\n";
foreach ($bookmarks['bookmarks'] as $row) { foreach ($bookmarks['bookmarks'] as $row) {
if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) {
$description = ''; $description = '';
else } else {
$description = filter(str_replace(array("\r\n", "\n", "\r"),"", $row['bDescription']), 'xml'); $description = filter(
str_replace(array("\r\n", "\n", "\r"), "", $row['bDescription']), 'xml'
);
}
$taglist = ''; $taglist = '';
if (count($row['tags']) > 0) { if (count($row['tags']) > 0) {
foreach($row['tags'] as $tag) foreach ($row['tags'] as $tag) {
$taglist .= convertTag($tag) .','; $taglist .= convertTag($tag) .',';
}
$taglist = substr($taglist, 0, -1); $taglist = substr($taglist, 0, -1);
} else { } else {
$taglist = 'system:unfiled'; $taglist = 'system:unfiled';
} }
echo '"'.filter($row['bAddress'], 'xml') .'";"'. filter($row['bTitle'], 'xml') .'";"'. filter($taglist, 'xml') .'";"'. $description .'"'; echo '"'.filter($row['bAddress'], 'xml') .'";"'. filter($row['bTitle'], 'xml') .
'";"'. filter($taglist, 'xml') .'";"'. $description .'"';
echo "\n"; echo "\n";
} }

View File

@ -1,22 +1,34 @@
<?php <?php
/*
Export for Google Custom Search /**
* Export for Google Custom Search
*
* PHP version 5.
*
* @category Bookmarking
* @package SemanticScuttle
* @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>
* @author Christian Weiske <cweiske@cweiske.de>
* @author Eric Dane <ericdane@users.sourceforge.net>
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/ */
// Force HTTP authentication first! // Force HTTP authentication first!
//require_once('httpauth.inc.php'); //require_once('httpauth.inc.php');
$httpContentType = false; $httpContentType = false;
require_once '../www-header.php'; require_once '../www-header.php';
if ($GLOBALS['enableGoogleCustomSearch'] == false) { if ($GLOBALS['enableGoogleCustomSearch'] == false) {
echo "Google Custom Search disabled. You can enable it into the config.php file."; echo "Google Custom Search disabled. " .
"You can enable it into the config.php file.";
die; die;
} }
/* Service creation: only useful services are created */ /* Service creation: only useful services are created */
$bookmarkservice = SemanticScuttle_Service_Factory::get('Bookmark'); $bookmarkservice = SemanticScuttle_Service_Factory::get('Bookmark');
/* /*
// Restrict to admins? // Restrict to admins?
if(!$userservice->isAdmin($userservice->getCurrentUserId())) { if(!$userservice->isAdmin($userservice->getCurrentUserId())) {
@ -24,19 +36,23 @@ $bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
}*/ }*/
// Check if queried format is xml // Check if queried format is xml
if (isset($_REQUEST['xml']) && (trim($_REQUEST['xml']) == 1)) if (isset($_REQUEST['xml']) && (trim($_REQUEST['xml']) == 1)) {
$xml = true; $xml = true;
else } else {
$xml = false; $xml = false;
}
// Check to see if a tag was specified. // Check to see if a tag was specified.
if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) {
$tag = trim($_REQUEST['tag']); $tag = trim($_REQUEST['tag']);
else } else {
$tag = NULL; $tag = null;
}
// Get the posts relevant to the passed-in variables. // Get the posts relevant to the passed-in variables.
$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, $tag, NULL, getSortOrder()); $bookmarks =& $bookmarkservice->getBookmarks(
0, null, null, $tag, null, getSortOrder()
);
// Set up the plain file and output all the posts. // Set up the plain file and output all the posts.

View File

@ -48,11 +48,13 @@ echo '<!DOCTYPE NETSCAPE-Bookmark-file-1>'."\r\n";
echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" />'; echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" />';
echo '<!-- This is an automatically generated file. -->'."\r\n"; echo '<!-- This is an automatically generated file. -->'."\r\n";
echo '<TITLE>Bookmarks</TITLE>'."\r\n"; echo '<TITLE>Bookmarks</TITLE>'."\r\n";
echo '<H1 LAST_MODIFIED="'. date('U') .'">Bookmarks for '. htmlspecialchars($currentUser->getUsername()) .''. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') ." from " . $sitename ."</H1>\r\n"; echo '<H1 LAST_MODIFIED="'. date('U');
echo '">Bookmarks for '. htmlspecialchars($currentUser->getUsername());
echo (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"');
echo ' from ' . $sitename .'</H1>\r\n';
echo '<DL>'."\r\n"; echo '<DL>'."\r\n";
foreach ($bookmarks['bookmarks'] as $row) { foreach ($bookmarks['bookmarks'] as $row) {
if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) { if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) {
$description = ''; $description = '';
@ -71,7 +73,11 @@ foreach ($bookmarks['bookmarks'] as $row) {
$taglist = 'system:unfiled'; $taglist = 'system:unfiled';
} }
echo "\t<DT><A HREF=\"". filter($row['bAddress'], 'xml') .'" '. $description .' hash="'. md5($row['bAddress']) .'" tags="'. filter($taglist, 'xml') .'" ADD_DATE="'. date('U', strtotime($row['bDatetime'])) ."\" >" . filter($row['bTitle'], 'xml') ."</a>\r\n"; echo "\t<DT><A HREF=\"". filter($row['bAddress'], 'xml') .'" ';
echo $description .' hash="'. md5($row['bAddress']) .'" tags="';
echo filter($taglist, 'xml') .'" ADD_DATE="';
echo date('U', strtotime($row['bDatetime']));
echo "\" >" . filter($row['bTitle'], 'xml') ."</a>\r\n";
} }

View File

@ -1,5 +1,22 @@
<?php <?php
/* Export data with semantic format (SIOC: http://sioc-project.org/, FOAF, SKOS, Annotea Ontology) */ /**
* Export data with semantic format
*
* (SIOC: http://sioc-project.org/, FOAF, SKOS, Annotea Ontology)
*
* SemanticScuttle - your social bookmark manager.
*
* PHP version 5.
*
* @category Bookmarking
* @package SemanticScuttle
* @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>
* @author Christian Weiske <cweiske@cweiske.de>
* @author Eric Dane <ericdane@users.sourceforge.net>
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
$httpContentType = 'text/xml'; $httpContentType = 'text/xml';
require_once '../www-header.php'; require_once '../www-header.php';
@ -40,16 +57,14 @@ $usersArray = array(); // useful for bookmarks display
foreach ($users as $user) { foreach ($users as $user) {
$usersArray[$user->getId()] = $user->getUserName(); $usersArray[$user->getId()] = $user->getUserName();
} }
?>
<?php foreach($users as $user) :?> foreach ($users as $user) { ?>
<sioc:User rdf:about="<?php echo createUrl('profile', $user->getUserName())?>"> <sioc:User rdf:about="<?php echo createUrl('profile', $user->getUserName())?>">
<sioc:name><?php echo $user->getUserName() ?></sioc:name> <sioc:name><?php echo $user->getUserName() ?></sioc:name>
<sioc:member_of rdf:resource="<?php echo ROOT?>" /> <sioc:member_of rdf:resource="<?php echo ROOT?>" />
</sioc:User> </sioc:User>
<?php endforeach; ?>
<?php <?php
}
/* /*
No page for usergroup (users/admin) for the moment No page for usergroup (users/admin) for the moment
<sioc:Usergroup rdf:ID="authors"> <sioc:Usergroup rdf:ID="authors">
@ -57,31 +72,33 @@ No page for usergroup (users/admin) for the moment
<sioc:has_member rdf:nodeID="sioc-id2245901" /> <sioc:has_member rdf:nodeID="sioc-id2245901" />
</sioc:Usergroup> </sioc:Usergroup>
*/ */
?>
<?php
//bookmarks are described using Annotea ontology //bookmarks are described using Annotea ontology
$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, NULL); $bookmarks =& $bookmarkservice->getBookmarks(0, null, null, null);
?>
<?php foreach($bookmarks['bookmarks'] as $bookmark): ?>
foreach ($bookmarks['bookmarks'] as $bookmark) { ?>
<bm:Bookmark rdf:about="<?php echo createUrl('history', $bookmark['bHash']) ?>"> <bm:Bookmark rdf:about="<?php echo createUrl('history', $bookmark['bHash']) ?>">
<dc:title><?php echo filter($bookmark['bTitle']) ?></dc:title> <dc:title><?php echo filter($bookmark['bTitle']) ?></dc:title>
<dc:created><?php echo filter($bookmark['bCreated']) ?></dc:created> <dc:created><?php echo filter($bookmark['bCreated']) ?></dc:created>
<dc:description><?php echo filter(strip_tags($bookmark['bDescription'])) ?></dc:description> <dc:description><?php echo filter(strip_tags($bookmark['bDescription'])) ?>
</dc:description>
<dc:date><?php echo $bookmark['bDateTime'] ?></dc:date> <dc:date><?php echo $bookmark['bDateTime'] ?></dc:date>
<bm:recalls rdf:resource="<?php echo filter($bookmark['bAddress']) ?>"/> <bm:recalls rdf:resource="<?php echo filter($bookmark['bAddress']) ?>"/>
<sioc:owner_of rdf:resource="<?php echo createUrl('profile', $usersArray[$bookmark['uId']]) ?>"/> <sioc:owner_of rdf:resource="<?php
<?php foreach($bookmark['tags'] as $tag): ?> echo createUrl('profile', $usersArray[$bookmark['uId']])
?>"/>
<?php foreach ($bookmark['tags'] as $tag) { ?>
<sioc:topic> <sioc:topic>
<skos:concept rdf:about="<?php echo createUrl('bookmarks', $usersArray[$bookmark['uId']].'/'.$tag) ?>" /> <skos:concept rdf:about="<?php
echo createUrl('bookmarks', $usersArray[$bookmark['uId']].'/'.$tag)
?>" />
</sioc:topic> </sioc:topic>
<?php endforeach; ?> <?php } ?>
</bm:Bookmark> </bm:Bookmark>
<?php endforeach; ?>
<?php <?php
}
// tags and concepts are described using SKOS ontology // tags and concepts are described using SKOS ontology
//concept for user/admins, preflabel, definition, top concept //concept for user/admins, preflabel, definition, top concept
?> ?>

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Checks if the user is logged on and sends a HTTP basic auth * Checks if the user is logged on and sends a HTTP basic auth
* request to the browser if not. In that case the script ends. * request to the browser if not. In that case the script ends.
@ -17,10 +18,13 @@
* @license GPL http://www.gnu.org/licenses/gpl.html * @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle * @link http://sourceforge.net/projects/semanticscuttle
*/ */
require_once '../www-header.php'; require_once '../www-header.php';
/** /**
* Sends HTTP auth headers to the browser * Sends HTTP auth headers to the browser
*
* @return nothing
*/ */
function authenticate() function authenticate()
{ {
@ -32,7 +36,7 @@ function authenticate()
if (!$userservice->isLoggedOn()) { if (!$userservice->isLoggedOn()) {
/* First check to see if a private key was sent */ /* First check to see if a private key was sent */
if (isset($_POST['privatekey']) { if (isset($_POST['privatekey'])) {
$login = $userservice->loginPK($_POST['privatekey']); $login = $userservice->loginPK($_POST['privatekey']);
if ($login) { if ($login) {
$currentUser = $userservice->getCurrentObjectUser(); $currentUser = $userservice->getCurrentObjectUser();
@ -47,7 +51,8 @@ if (!$userservice->isLoggedOn()) {
( Inspired by http://www.yetanothercommunitysystem.com/article-321-regle-comment-utiliser-l-authentification-http-en-php-chez-ovh ) */ ( Inspired by http://www.yetanothercommunitysystem.com/article-321-regle-comment-utiliser-l-authentification-http-en-php-chez-ovh ) */
if ((!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) if ((!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']))
&& isset($_SERVER['REMOTE_USER']) && isset($_SERVER['REMOTE_USER'])
&& preg_match('/Basic\s+(.*)$/i', $_SERVER['REMOTE_USER'], $matches)) { && preg_match('/Basic\s+(.*)$/i', $_SERVER['REMOTE_USER'], $matches)
) {
list($name, $password) = explode(':', base64_decode($matches[1])); list($name, $password) = explode(':', base64_decode($matches[1]));
$_SERVER['PHP_AUTH_USER'] = strip_tags($name); $_SERVER['PHP_AUTH_USER'] = strip_tags($name);
$_SERVER['PHP_AUTH_PW'] = strip_tags($password); $_SERVER['PHP_AUTH_PW'] = strip_tags($password);
@ -56,7 +61,10 @@ if (!$userservice->isLoggedOn()) {
if (!isset($_SERVER['PHP_AUTH_USER'])) { if (!isset($_SERVER['PHP_AUTH_USER'])) {
authenticate(); authenticate();
} else { } else {
$login = $userservice->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']); $login = $userservice->login(
$_SERVER['PHP_AUTH_USER'],
$_SERVER['PHP_AUTH_PW']
);
if ($login) { if ($login) {
$currentUser = $userservice->getCurrentObjectUser(); $currentUser = $userservice->getCurrentObjectUser();
} else { } else {
@ -64,4 +72,5 @@ if (!$userservice->isLoggedOn()) {
} }
} }
} }
?> ?>

View File

@ -1,7 +1,22 @@
<?php <?php
/**
* Perform OpenSearch
*
* PHP version 5.
*
* @category Bookmarking
* @package SemanticScuttle
* @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>
* @author Christian Weiske <cweiske@cweiske.de>
* @author Eric Dane <ericdane@users.sourceforge.net>
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
$httpContentType = 'text/xml'; $httpContentType = 'text/xml';
require_once '../www-header.php'; require_once '../www-header.php';
?> ?>
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName><?php echo $GLOBALS['sitename']?></ShortName> <ShortName><?php echo $GLOBALS['sitename']?></ShortName>

View File

@ -2,7 +2,10 @@
/** /**
* API for adding a new bookmark. * API for adding a new bookmark.
* *
* PHP version 5.
*
* The following POST and GET parameters are accepted: * The following POST and GET parameters are accepted:
*
* @param string $url URL of the bookmark (required) * @param string $url URL of the bookmark (required)
* @param string $description Bookmark title (required) * @param string $description Bookmark title (required)
* @param string $extended Extended bookmark description (optional) * @param string $extended Extended bookmark description (optional)
@ -28,8 +31,6 @@
* *
* SemanticScuttle - your social bookmark manager. * SemanticScuttle - your social bookmark manager.
* *
* PHP version 5.
*
* @category Bookmarking * @category Bookmarking
* @package SemanticScuttle * @package SemanticScuttle
* @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net> * @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>

View File

@ -1,8 +1,21 @@
<?php <?php
// Implements the del.icio.us API request for all a user's posts, optionally filtered by tag. /**
* Implements the del.icio.us API request for all a user's posts
// del.icio.us behavior: * optionally filtered by tag.
// - doesn't include the filtered tag as an attribute on the root element (we do) *
* del.icio.us behavior:
* - doesn't include the filtered tag as an attribute on the root element (we do)
*
* PHP version 5.
*
* @category Bookmarking
* @package SemanticScuttle
* @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>
* @author Christian Weiske <cweiske@cweiske.de>
* @author Eric Dane <ericdane@users.sourceforge.net>
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
//Force HTTP authentication first! //Force HTTP authentication first!
$httpContentType = 'text/xml'; $httpContentType = 'text/xml';
@ -13,34 +26,44 @@ $bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
// Check to see if a tag was specified. // Check to see if a tag was specified.
if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) {
$tag = trim($_REQUEST['tag']); $tag = trim($_REQUEST['tag']);
else } else {
$tag = NULL; $tag = null;
}
// Get the posts relevant to the passed-in variables. // Get the posts relevant to the passed-in variables.
$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag); $bookmarks =& $bookmarkservice->getBookmarks(
0, null, $userservice->getCurrentUserId(), $tag
);
// Set up the XML file and output all the posts. // Set up the XML file and output all the posts.
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n"; echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
echo '<posts update="'. gmdate('Y-m-d\TH:i:s\Z') .'" user="'. htmlspecialchars($currentUser->getUsername()) .'"'. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') .">\r\n"; echo '<posts update="'. gmdate('Y-m-d\TH:i:s\Z');
echo '" user="'. htmlspecialchars($currentUser->getUsername());
echo '"'. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') .">\r\n";
foreach ($bookmarks['bookmarks'] as $row) { foreach ($bookmarks['bookmarks'] as $row) {
if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) {
$description = ''; $description = '';
else } else {
$description = 'extended="'. filter($row['bDescription'], 'xml') .'" '; $description = 'extended="'. filter($row['bDescription'], 'xml') .'" ';
}
$taglist = ''; $taglist = '';
if (count($row['tags']) > 0) { if (count($row['tags']) > 0) {
foreach($row['tags'] as $tag) foreach ($row['tags'] as $tag) {
$taglist .= convertTag($tag) .' '; $taglist .= convertTag($tag) .' ';
}
$taglist = substr($taglist, 0, -1); $taglist = substr($taglist, 0, -1);
} else { } else {
$taglist = 'system:unfiled'; $taglist = 'system:unfiled';
} }
echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. md5($row['bAddress']) .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n"; echo "\t<post href=\"". filter($row['bAddress'], 'xml');
echo '" description="'. filter($row['bTitle'], 'xml');
echo '" '. $description .'hash="'. md5($row['bAddress']);
echo '" tag="'. filter($taglist, 'xml') .'" time="';
echo gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n";
} }
echo '</posts>'; echo '</posts>';

View File

@ -38,7 +38,8 @@ $bookmarks = $bookmarkservice->getBookmarks(
// Set up the XML file and output all the tags. // Set up the XML file and output all the tags.
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n"; echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
echo '<dates tag="'. (is_null($tag) ? '' : filter($tag, 'xml')) .'" user="'. filter($currentUser->getUsername(), 'xml') ."\">\r\n"; echo '<dates tag="'. (is_null($tag) ? '' : filter($tag, 'xml'));
echo '" user="'. filter($currentUser->getUsername(), 'xml') ."\">\r\n";
$lastdate = null; $lastdate = null;
$count = 0; $count = 0;

View File

@ -6,7 +6,8 @@
* uses GMT dates -- so we do too. * uses GMT dates -- so we do too.
* *
* del.icio.us behavior: * del.icio.us behavior:
* - includes an empty tag attribute on the root element when it hasn't been specified * - includes an empty tag attribute on the root element
* when it hasn't been specified
* *
* Scuttle behavior: * Scuttle behavior:
* - Uses today, instead of the last bookmarked date, if no date is specified * - Uses today, instead of the last bookmarked date, if no date is specified
@ -56,7 +57,9 @@ $bookmarks = $bookmarkservice->getBookmarks(
// Set up the XML file and output all the tags. // Set up the XML file and output all the tags.
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n"; echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
echo '<posts'. (is_null($dtstart) ? '' : ' dt="'. $dtstart .'"') .' tag="'. (is_null($tag) ? '' : filter($tag, 'xml')) .'" user="'. filter($currentUser->getUsername(), 'xml') ."\">\r\n"; echo '<posts'. (is_null($dtstart) ? '' : ' dt="'. $dtstart .'"') .' tag="';
echo (is_null($tag) ? '' : filter($tag, 'xml')) .'" user="';
echo filter($currentUser->getUsername(), 'xml') ."\">\r\n";
foreach ($bookmarks['bookmarks'] as $row) { foreach ($bookmarks['bookmarks'] as $row) {
if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) { if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) {
@ -75,7 +78,13 @@ foreach ($bookmarks['bookmarks'] as $row) {
$taglist = 'system:unfiled'; $taglist = 'system:unfiled';
} }
echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. $row['bHash'] .'" others="'. $bookmarkservice->countOthers($row['bAddress']) .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n"; echo "\t<post href=\"". filter($row['bAddress'], 'xml');
echo '" description="'. filter($row['bTitle'], 'xml');
echo '" '. $description .'hash="'. $row['bHash'];
echo '" others="'. $bookmarkservice->countOthers($row['bAddress']);
echo '" tag="'. filter($taglist, 'xml');
echo '" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />";
echo "\r\n";
} }
echo '</posts>'; echo '</posts>';

View File

@ -1,8 +1,21 @@
<?php <?php
// Implements the del.icio.us API request for all a user's posts, optionally filtered by tag. /**
* Implements the del.icio.us API request for all a user's posts
// del.icio.us behavior: * optionally filtered by tag.
// - doesn't include the filtered tag as an attribute on the root element (we do) *
* del.icio.us behavior:
* - doesn't include the filtered tag as an attribute on the root element (we do)
*
* PHP version 5.
*
* @category Bookmarking
* @package SemanticScuttle
* @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>
* @author Christian Weiske <cweiske@cweiske.de>
* @author Eric Dane <ericdane@users.sourceforge.net>
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
// Force HTTP authentication first! // Force HTTP authentication first!
//require_once('httpauth.inc.php'); //require_once('httpauth.inc.php');
@ -14,34 +27,42 @@ $bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
// Check to see if a tag was specified. // Check to see if a tag was specified.
if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) {
$tag = trim($_REQUEST['tag']); $tag = trim($_REQUEST['tag']);
else } else {
$tag = NULL; $tag = null;
}
// Get the posts relevant to the passed-in variables. // Get the posts relevant to the passed-in variables.
$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, $tag); $bookmarks =& $bookmarkservice->getBookmarks(0, null, null, $tag);
// Set up the XML file and output all the posts. // Set up the XML file and output all the posts.
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n"; echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
echo '<posts update="'. gmdate('Y-m-d\TH:i:s\Z') .'" '. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') .">\r\n"; echo '<posts update="'. gmdate('Y-m-d\TH:i:s\Z') .'" ';
echo (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') .">\r\n";
foreach ($bookmarks['bookmarks'] as $row) { foreach ($bookmarks['bookmarks'] as $row) {
if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) {
$description = ''; $description = '';
else } else {
$description = 'extended="'. filter($row['bDescription'], 'xml') .'" '; $description = 'extended="'. filter($row['bDescription'], 'xml') .'" ';
}
$taglist = ''; $taglist = '';
if (count($row['tags']) > 0) { if (count($row['tags']) > 0) {
foreach($row['tags'] as $tag) foreach ($row['tags'] as $tag) {
$taglist .= convertTag($tag) .' '; $taglist .= convertTag($tag) .' ';
}
$taglist = substr($taglist, 0, -1); $taglist = substr($taglist, 0, -1);
} else { } else {
$taglist = 'system:unfiled'; $taglist = 'system:unfiled';
} }
echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. md5($row['bAddress']) .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n"; echo "\t<post href=\"". filter($row['bAddress'], 'xml');
echo '" description="'. filter($row['bTitle'], 'xml');
echo '" '. $description .'hash="'. md5($row['bAddress']);
echo '" tag="'. filter($taglist, 'xml');
echo '" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />";
echo "\r\n";
} }
echo '</posts>'; echo '</posts>';

View File

@ -56,7 +56,8 @@ $bookmarks = $bookmarkservice->getBookmarks(
// Set up the XML file and output all the tags. // Set up the XML file and output all the tags.
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n"; echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
echo '<posts tag="'. (is_null($tag) ? '' : filter($tag, 'xml')) .'" user="'. filter($currentUser->getUsername(), 'xml') ."\">\r\n"; echo '<posts tag="'. (is_null($tag) ? '' : filter($tag, 'xml'));
echo '" user="'. filter($currentUser->getUsername(), 'xml') ."\">\r\n";
foreach ($bookmarks['bookmarks'] as $row) { foreach ($bookmarks['bookmarks'] as $row) {
if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) { if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) {
@ -75,7 +76,12 @@ foreach ($bookmarks['bookmarks'] as $row) {
$taglist = 'system:unfiled'; $taglist = 'system:unfiled';
} }
echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. $row['bHash'] .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n"; echo "\t<post href=\"". filter($row['bAddress'], 'xml');
echo '" description="'. filter($row['bTitle'], 'xml');
echo '" '. $description .'hash="'. $row['bHash'];
echo '" tag="'. filter($taglist, 'xml');
echo '" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />";
echo "\r\n";
} }
echo '</posts>'; echo '</posts>';

View File

@ -1,8 +1,22 @@
<?php <?php
// Implements the del.icio.us API request for all a user's tags.
// del.icio.us behavior: /**
// - tags can't have spaces * Implements the del.icio.us API request for all a user's tags.
*
* del.icio.us behavior:
* - tags can't have spaces
*
* PHP version 5.
*
* @category Bookmarking
* @package SemanticScuttle
* @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>
* @author Christian Weiske <cweiske@cweiske.de>
* @author Eric Dane <ericdane@users.sourceforge.net>
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
// Force HTTP authentication first! // Force HTTP authentication first!
$httpContentType = 'text/xml'; $httpContentType = 'text/xml';
@ -19,7 +33,8 @@ $tags =& $b2tservice->getTags($userservice->getCurrentUserId());
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n"; echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
echo "<tags>\r\n"; echo "<tags>\r\n";
foreach ($tags as $row) { foreach ($tags as $row) {
echo "\t<tag count=\"". $row['bCount'] .'" tag="'. filter(convertTag($row['tag'], 'out'), 'xml') ."\" />\r\n"; echo "\t<tag count=\"". $row['bCount'] .'" tag="';
echo filter(convertTag($row['tag'], 'out'), 'xml') ."\" />\r\n";
} }
echo "</tags>"; echo "</tags>";
?> ?>

View File

@ -1,8 +1,21 @@
<?php <?php
// Implements the del.icio.us API request to rename a user's tag. /**
* Implements the del.icio.us API request to rename a user's tag.
// del.icio.us behavior: *
// - oddly, returns an entirely different result (<result></result>) than the other API calls. * del.icio.us behavior:
* - oddly, returns an entirely different result (<result></result>) than
* the other API calls.
*
* PHP version 5.
*
* @category Bookmarking
* @package SemanticScuttle
* @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>
* @author Christian Weiske <cweiske@cweiske.de>
* @author Eric Dane <ericdane@users.sourceforge.net>
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
// Force HTTP authentication first! // Force HTTP authentication first!
$httpContentType = 'text/xml'; $httpContentType = 'text/xml';
@ -12,21 +25,25 @@ require_once 'httpauth.inc.php';
$b2tservice = SemanticScuttle_Service_Factory::get('Bookmark2Tag'); $b2tservice = SemanticScuttle_Service_Factory::get('Bookmark2Tag');
// Get the tag info. // Get the tag info.
if (isset($_REQUEST['old']) && (trim($_REQUEST['old']) != '')) if (isset($_REQUEST['old']) && (trim($_REQUEST['old']) != '')) {
$old = trim($_REQUEST['old']); $old = trim($_REQUEST['old']);
else } else {
$old = NULL; $old = null;
}
if (isset($_REQUEST['new']) && (trim($_REQUEST['new']) != '')) if (isset($_REQUEST['new']) && (trim($_REQUEST['new']) != '')) {
$new = trim($_REQUEST['new']); $new = trim($_REQUEST['new']);
else } else {
$new = NULL; $new = null;
}
if (is_null($old) || is_null($new)) { if (is_null($old) || is_null($new)) {
$renamed = false; $renamed = false;
} else { } else {
// Rename the tag. // Rename the tag.
$result = $b2tservice->renameTag($userservice->getCurrentUserId(), $old, $new, true); $result = $b2tservice->renameTag(
$userservice->getCurrentUserId(), $old, $new, true
);
$renamed = $result; $renamed = $result;
} }

View File

@ -41,11 +41,9 @@ if(!isset($_POST['referrer'])) {
define('POST_REFERRER', $_POST['referrer']); define('POST_REFERRER', $_POST['referrer']);
} }
list ($url, $hash) = explode('/', $_SERVER['PATH_INFO']); list ($url, $hash) = explode('/', $_SERVER['PATH_INFO']);
$template = 'bookmarkcommondescriptionedit.tpl'; $template = 'bookmarkcommondescriptionedit.tpl';
//permissions //permissions
if (is_null($currentUser)) { if (is_null($currentUser)) {
$tplVars['error'] = T_('Permission denied.'); $tplVars['error'] = T_('Permission denied.');
@ -54,9 +52,7 @@ if(is_null($currentUser)) {
} }
if (POST_CONFIRM) { if (POST_CONFIRM) {
if (strlen($hash)>0 && if (strlen($hash)>0 && $cdservice->addBookmarkDescription(POST_HASH, stripslashes(POST_TITLE), stripslashes(POST_DESCRIPTION), $currentUser->getId(), time())) {
$cdservice->addBookmarkDescription(POST_HASH, stripslashes(POST_TITLE), stripslashes(POST_DESCRIPTION), $currentUser->getId(), time())
) {
$tplVars['msg'] = T_('Bookmark common description updated'); $tplVars['msg'] = T_('Bookmark common description updated');
header('Location: '. POST_REFERRER); header('Location: '. POST_REFERRER);
} else { } else {

View File

@ -64,9 +64,7 @@ if ($userservice->isLoggedOn()) {
$currentUsername = $currentUser->getUsername(); $currentUsername = $currentUser->getUsername();
} }
@list($url, $user, $cat) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : null;
@list($url, $user, $cat) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL;
$endcache = false; $endcache = false;
if ($usecache) { if ($usecache) {
@ -113,9 +111,7 @@ if ($cat) {
$catTitleWithUrls = substr($catTitleWithUrls, 0, strlen($catTitleWithUrls) - strlen(' + ')); $catTitleWithUrls = substr($catTitleWithUrls, 0, strlen($catTitleWithUrls) - strlen(' + '));
$pagetitle .= $catTitleWithUrls; $pagetitle .= $catTitleWithUrls;
} } else {
else
{
$catTitleWithUrls = ''; $catTitleWithUrls = '';
} }
$pagetitle = substr($pagetitle, 2); $pagetitle = substr($pagetitle, 2);
@ -137,8 +133,8 @@ if ($userservice->isLoggedOn() && POST_SUBMITTED != '') {
$bookmark = $bookmarkservice->getBookmarkByAddress($address); $bookmark = $bookmarkservice->getBookmarkByAddress($address);
header('Location: '. createURL('edit', $bookmark['bId'])); header('Location: '. createURL('edit', $bookmark['bId']));
exit(); exit();
// If it's new, save it
} else { } else {
// If it's new, save it
$title = trim(POST_TITLE); $title = trim(POST_TITLE);
$description = trim(POST_DESCRIPTION); $description = trim(POST_DESCRIPTION);
$privateNote = trim(POST_PRIVATENOTE); $privateNote = trim(POST_PRIVATENOTE);
@ -167,7 +163,7 @@ if ($userservice->isLoggedOn() && POST_SUBMITTED != '') {
if (GET_ACTION == "add") { if (GET_ACTION == "add") {
// If the bookmark exists already, edit the original // If the bookmark exists already, edit the original
if ($bookmarkservice->bookmarkExists(stripslashes(GET_ADDRESS), $currentUserID)) { if ($bookmarkservice->bookmarkExists(stripslashes(GET_ADDRESS), $currentUserID)) {
$bookmark =& $bookmarkservice->getBookmarks(0, NULL, $currentUserID, NULL, NULL, NULL, NULL, NULL, NULL, $bookmarkservice->getHash(stripslashes(GET_ADDRESS))); $bookmark =& $bookmarkservice->getBookmarks(0, null, $currentUserID, null, null, null, null, null, null, $bookmarkservice->getHash(stripslashes(GET_ADDRESS)));
$popup = (GET_POPUP!='') ? '?popup=1' : ''; $popup = (GET_POPUP!='') ? '?popup=1' : '';
header('Location: '. createURL('edit', $bookmark['bookmarks'][0]['bId'] . $popup)); header('Location: '. createURL('edit', $bookmark['bookmarks'][0]['bId'] . $popup));
exit(); exit();
@ -204,7 +200,6 @@ if ($templatename == 'editbookmark.tpl') {
'bStatus' => 0 'bStatus' => 0
); );
} }
} }
$title = T_('Add a Bookmark'); $title = T_('Add a Bookmark');
$tplVars['referrer'] = '';; $tplVars['referrer'] = '';;
@ -223,8 +218,8 @@ if ($templatename == 'editbookmark.tpl') {
$tplVars['sidebar_blocks'] = array('watchstatus'); $tplVars['sidebar_blocks'] = array('watchstatus');
if (!$cat) { //user page without tags if (!$cat) { //user page without tags
$cat = NULL; $cat = null;
$tplVars['currenttag'] = NULL; $tplVars['currenttag'] = null;
//$tplVars['sidebar_blocks'][] = 'menu2'; //$tplVars['sidebar_blocks'][] = 'menu2';
$tplVars['sidebar_blocks'][] = 'linked'; $tplVars['sidebar_blocks'][] = 'linked';
$tplVars['sidebar_blocks'][] = 'popular'; $tplVars['sidebar_blocks'][] = 'popular';
@ -258,7 +253,10 @@ if ($templatename == 'editbookmark.tpl') {
// Set template vars // Set template vars
$tplVars['rsschannels'] = array( $tplVars['rsschannels'] = array(
array(filter($sitename .': '. $pagetitle), createURL('rss', filter($user, 'url') . $rssCat.'?sort='.getSortOrder())) array(
filter($sitename .': '. $pagetitle),
createURL('rss', filter($user, 'url') . $rssCat.'?sort='.getSortOrder())
)
); );
$tplVars['page'] = $page; $tplVars['page'] = $page;
@ -282,7 +280,6 @@ if ($templatename == 'editbookmark.tpl') {
$tplVars['summarizeLinkedTags'] = true; $tplVars['summarizeLinkedTags'] = true;
$tplVars['pageName'] = PAGE_BOOKMARKS; $tplVars['pageName'] = PAGE_BOOKMARKS;
$templateservice->loadTemplate($templatename, $tplVars); $templateservice->loadTemplate($templatename, $tplVars);
if ($usecache && $endcache) { if ($usecache && $endcache) {

View File

@ -52,15 +52,12 @@ if (!($row = $bookmarkservice->getBookmark(intval($bookmark), true))) {
$templateservice->loadTemplate('error.404.tpl', $tplVars); $templateservice->loadTemplate('error.404.tpl', $tplVars);
exit(); exit();
} else { } else {
if (!$bookmarkservice->editAllowed($row)) { if (!$bookmarkservice->editAllowed($row)) {
$tplVars['error'] = T_('You are not allowed to edit this bookmark'); $tplVars['error'] = T_('You are not allowed to edit this bookmark');
$templateservice->loadTemplate('error.500.tpl', $tplVars); $templateservice->loadTemplate('error.500.tpl', $tplVars);
exit(); exit();
} else if (POST_SUBMITTED != '') { } else if (POST_SUBMITTED != '') {
if (!POST_TITLE || !POST_ADDRESS) { if (!POST_TITLE || !POST_ADDRESS) {
$tplVars['error'] = T_('Your bookmark must have a title and an address'); $tplVars['error'] = T_('Your bookmark must have a title and an address');
} else { } else {

View File

@ -1,4 +1,18 @@
<?php <?php
/**
* Google custom search
*
* PHP version 5.
*
* @category Bookmarking
* @package SemanticScuttle
* @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>
* @author Christian Weiske <cweiske@cweiske.de>
* @author Eric Dane <ericdane@users.sourceforge.net>
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
require_once '../www-header.php'; require_once '../www-header.php';
if ($GLOBALS['enableGoogleCustomSearch'] == false) { if ($GLOBALS['enableGoogleCustomSearch'] == false) {

View File

@ -1,4 +1,19 @@
<?php require_once '../www-header.php'; <?php
/**
* Google custom search
*
* PHP version 5.
*
* @category Bookmarking
* @package SemanticScuttle
* @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>
* @author Christian Weiske <cweiske@cweiske.de>
* @author Eric Dane <ericdane@users.sourceforge.net>
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
require_once '../www-header.php';
if ($GLOBALS['enableGoogleCustomSearch']==false) { if ($GLOBALS['enableGoogleCustomSearch']==false) {
echo "Google Custom Search disabled. You can enable it into the config.php file."; echo "Google Custom Search disabled. You can enable it into the config.php file.";
@ -20,26 +35,24 @@ if($GLOBALS['enableGoogleCustomSearch']==false) {
<input type="submit" name="sa" value="Search" /> <input type="submit" name="sa" value="Search" />
</form> </form>
<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cref"></script> <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cref"></script>
<!-- Google CSE Search Box Ends --> <!-- Google CSE Search Box Ends -->
<small>Based on <a href="http://www.google.com/coop/cse/">Google Custom Search</a> over this <a href="<?php echo ROOT ?>api/export_gcs.php">list of websites</a> from <?php echo $GLOBALS['sitename'] ?>.</small> <small>Based on <a href="http://www.google.com/coop/cse/">Google Custom Search</a> over this <a href="<?php echo ROOT ?>api/export_gcs.php">list of websites</a> from <?php echo $GLOBALS['sitename'] ?>.</small>
<br /> <br />
<br /> <br />
<small><a href="<?php echo ROOT?>"><?php echo T_('Come back to ').$GLOBALS['sitename'] ?>...</a></small> <small><a href="<?php echo ROOT?>"><?php echo T_('Come back to ').$GLOBALS['sitename'] ?>...</a></small>
<?php
<?php if($userservice->isLoggedOn() && $currentUser->isAdmin()){ if ($userservice->isLoggedOn() && $currentUser->isAdmin()) {
echo '<p><small>'; echo '<p><small>';
echo T_('Admin tips: '); echo T_('Admin tips: ');
echo T_('To refresh manually Google Custom Search Engine, goes to: '); echo T_('To refresh manually Google Custom Search Engine, goes to: ');
echo '<a href="http://www.google.com/coop/cse/cref?cref='.ROOT.'search/context.php">http://www.google.com/coop/cse/cref</a><br/>'; echo '<a href="http://www.google.com/coop/cse/cref?cref='.ROOT.'search/context.php">http://www.google.com/coop/cse/cref</a><br/>';
echo T_('If no result appears, check that all the urls are valid in the admin section.'); echo T_('If no result appears, check that all the urls are valid in the admin section.');
echo '</small></p>'; echo '</small></p>';
} }
?> ?>
</center> </center>
</body> </body>
</html> </html>

View File

@ -29,9 +29,7 @@ $cacheservice =SemanticScuttle_Service_Factory::get('Cache');
isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0); 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['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
@list($url, $hash) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL; @list($url, $hash) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : null;
if ($usecache) { if ($usecache) {
// Generate hash for caching on // Generate hash for caching on
@ -57,7 +55,7 @@ if (intval(GET_PAGE) > 1) {
if ($bookmark =& $bookmarkservice->getBookmarkByHash($hash)) { if ($bookmark =& $bookmarkservice->getBookmarkByHash($hash)) {
// Template variables // Template variables
$bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, NULL, NULL, NULL, getSortOrder(), NULL, NULL, NULL, $hash); $bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, null, null, null, getSortOrder(), null, null, null, $hash);
$tplVars['pagetitle'] = T_('History') .': '. $bookmark['bAddress']; $tplVars['pagetitle'] = T_('History') .': '. $bookmark['bAddress'];
$tplVars['subtitle'] = sprintf(T_('History for %s'), $bookmark['bAddress']); $tplVars['subtitle'] = sprintf(T_('History for %s'), $bookmark['bAddress']);
$tplVars['loadjs'] = true; $tplVars['loadjs'] = true;

View File

@ -43,14 +43,17 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
$xml_parser = xml_parser_create(); $xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_element_handler($xml_parser, "startElement", "endElement");
if (!($fp = fopen($_FILES['userfile']['tmp_name'], "r"))) if (!($fp = fopen($_FILES['userfile']['tmp_name'], "r"))) {
die(T_("Could not open XML input")); die(T_("Could not open XML input"));
}
while ($data = fread($fp, 4096)) { while ($data = fread($fp, 4096)) {
if (!xml_parse($xml_parser, $data, feof($fp))) { if (!xml_parse($xml_parser, $data, feof($fp))) {
die(sprintf(T_("XML error: %s at line %d"), die(sprintf(
T_("XML error: %s at line %d"),
xml_error_string(xml_get_error_code($xml_parser)), xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser))); xml_get_current_line_number($xml_parser)
));
} }
} }
xml_parser_free($xml_parser); xml_parser_free($xml_parser);
@ -62,9 +65,8 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
$templateservice->loadTemplate($templatename, $tplVars); $templateservice->loadTemplate($templatename, $tplVars);
} }
function startElement($parser, $name, $attrs)
{
function startElement($parser, $name, $attrs) {
global $depth, $status, $tplVars, $userservice; global $depth, $status, $tplVars, $userservice;
$bookmarkservice = SemanticScuttle_Service_Factory::get('Bookmark'); $bookmarkservice = SemanticScuttle_Service_Factory::get('Bookmark');
@ -100,16 +102,18 @@ function startElement($parser, $name, $attrs) {
$bDatetime = gmdate('Y-m-d H:i:s'); $bDatetime = gmdate('Y-m-d H:i:s');
} }
if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, '', $status, $tags, null, $bDatetime, true, true)) if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, '', $status, $tags, null, $bDatetime, true, true)) {
$tplVars['msg'] = T_('Bookmark imported.'); $tplVars['msg'] = T_('Bookmark imported.');
else } else {
$tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.'); $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');
} }
} }
}
$depth[$parser]++; $depth[$parser]++;
} }
function endElement($parser, $name) { function endElement($parser, $name)
{
global $depth; global $depth;
$depth[$parser]--; $depth[$parser]--;
} }

View File

@ -30,7 +30,6 @@ isset($_GET['action']) ? define('GET_ACTION', $_GET['action']): define('GET_ACTI
isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0); 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['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
// Logout action // Logout action
if (GET_ACTION == "logout") { if (GET_ACTION == "logout") {
$userservice->logout(); $userservice->logout();
@ -38,7 +37,6 @@ if (GET_ACTION == "logout") {
$tplvars['msg'] = T_('You have now logged out'); $tplvars['msg'] = T_('You have now logged out');
} }
// Header variables // Header variables
$tplVars['loadjs'] = true; $tplVars['loadjs'] = true;
$tplVars['rsschannels'] = array( $tplVars['rsschannels'] = array(
@ -76,7 +74,7 @@ $tplVars['pagetitle'] = T_('Store, share and tag your favourite links');
$tplVars['subtitle'] = T_('All Bookmarks'); $tplVars['subtitle'] = T_('All Bookmarks');
$tplVars['bookmarkCount'] = $start + 1; $tplVars['bookmarkCount'] = $start + 1;
$bookmarks = $bookmarkservice->getBookmarks($start, $perpage, NULL, NULL, NULL, getSortOrder(), NULL, 0, NULL); $bookmarks = $bookmarkservice->getBookmarks($start, $perpage, null, null, null, getSortOrder(), null, 0, null);
$tplVars['total'] = $bookmarks['total']; $tplVars['total'] = $bookmarks['total'];
$tplVars['bookmarks'] =& $bookmarks['bookmarks']; $tplVars['bookmarks'] =& $bookmarks['bookmarks'];

View File

@ -40,10 +40,11 @@ if (POST_SUBMITTED!='' && POST_USERNAME!='' && POST_PASSWORD!='') {
$posteduser = trim(utf8_strtolower(POST_USERNAME)); $posteduser = trim(utf8_strtolower(POST_USERNAME));
$login = $userservice->login($posteduser, POST_PASSWORD, $keeppass); $login = $userservice->login($posteduser, POST_PASSWORD, $keeppass);
if ($login) { if ($login) {
if (POST_QUERY) if (POST_QUERY) {
header('Location: '. createURL('bookmarks', $posteduser .'?'. POST_QUERY)); header('Location: '. createURL('bookmarks', $posteduser .'?'. POST_QUERY));
else } else {
header('Location: '. createURL('bookmarks', $posteduser)); header('Location: '. createURL('bookmarks', $posteduser));
}
} else { } else {
$tplVars['error'] = T_('The details you have entered are incorrect. Please try again.'); $tplVars['error'] = T_('The details you have entered are incorrect. Please try again.');
} }

View File

@ -44,7 +44,7 @@ if (POST_SUBMITTED != '') {
// NO MATCH // NO MATCH
$userinfo = $userservice->getObjectUserByUsername(POST_USERNAME); $userinfo = $userservice->getObjectUserByUsername(POST_USERNAME);
if ($userinfo == NULL) { if ($userinfo == null) {
$tplVars['error'] = T_('No matches found for that username.'); $tplVars['error'] = T_('No matches found for that username.');
} elseif (POST_EMAIL != $userinfo->getEmail()) { } elseif (POST_EMAIL != $userinfo->getEmail()) {

View File

@ -25,7 +25,7 @@ require_once 'www-header.php';
$b2tservice = SemanticScuttle_Service_Factory::get('Bookmark2Tag'); $b2tservice = SemanticScuttle_Service_Factory::get('Bookmark2Tag');
$cacheservice = SemanticScuttle_Service_Factory::get('Cache'); $cacheservice = SemanticScuttle_Service_Factory::get('Cache');
@list($url, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL; @list($url, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : null;
if ($usecache) { if ($usecache) {
// Generate hash for caching on // Generate hash for caching on
@ -48,7 +48,7 @@ $pagetitle = T_('Popular Tags');
if (isset($user) && $user != '') { if (isset($user) && $user != '') {
$userid = $userservice->getIdFromUser($user); $userid = $userservice->getIdFromUser($user);
if($userid == NULL) { if ($userid == null) {
$tplVars['error'] = sprintf(T_('User with username %s was not found'), $user); $tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
$templateservice->loadTemplate('error.404.tpl', $tplVars); $templateservice->loadTemplate('error.404.tpl', $tplVars);
//throw a 404 error //throw a 404 error
@ -57,7 +57,7 @@ if (isset($user) && $user != '') {
$pagetitle .= ': '. ucfirst($user); $pagetitle .= ': '. ucfirst($user);
} else { } else {
$userid = NULL; $userid = null;
} }
$tags = $b2tservice->getPopularTags($userid, 150); $tags = $b2tservice->getPopularTags($userid, 150);

View File

@ -38,16 +38,15 @@ isset($_SESSION['token']) ? define('SESSION_TOKEN', $_SESSION['token']): define(
isset($_SESSION['token_stamp']) ? define('SESSION_TOKENSTAMP', $_SESSION['token_stamp']): define('SESSION_TOKENSTAMP', ''); isset($_SESSION['token_stamp']) ? define('SESSION_TOKENSTAMP', $_SESSION['token_stamp']): define('SESSION_TOKENSTAMP', '');
@list($url, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL; @list($url, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : null;
if ($user) { if ($user) {
if (is_int($user)) { if (is_int($user)) {
$userid = intval($user); $userid = intval($user);
} else { } else {
$user = urldecode($user); $user = urldecode($user);
$userinfo = $userservice->getObjectUserByUsername($user); $userinfo = $userservice->getObjectUserByUsername($user);
if ($userinfo == NULL) { if ($userinfo == null) {
$tplVars['error'] = sprintf(T_('User with username %s was not found'), $user); $tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
$templateservice->loadTemplate('error.404.tpl', $tplVars); $templateservice->loadTemplate('error.404.tpl', $tplVars);
exit(); exit();
@ -82,9 +81,8 @@ if (POST_SUBMITTED!='' && $currentUser->getId() == $userid) {
$detDesc = filter(POST_DESC); $detDesc = filter(POST_DESC);
// manage token preventing from CSRF vulnaribilities // manage token preventing from CSRF vulnaribilities
if ( SESSION_TOKEN == '' //limit token lifetime, optionnal
|| time() - SESSION_TOKENSTAMP > 600 //limit token lifetime, optionnal if ( SESSION_TOKEN == '' || time() - SESSION_TOKENSTAMP > 600 || SESSION_TOKEN != POST_TOKEN) {
|| SESSION_TOKEN != POST_TOKEN) {
$error = true; $error = true;
$tplVars['error'] = T_('Invalid Token'); $tplVars['error'] = T_('Invalid Token');
} }
@ -121,7 +119,6 @@ if (!$userservice->isLoggedOn() || $currentUser->getId() != $userid) {
$templatename = 'editprofile.tpl.php'; $templatename = 'editprofile.tpl.php';
$tplVars['formaction'] = createURL('profile', $user); $tplVars['formaction'] = createURL('profile', $user);
$tplVars['token'] = $_SESSION['token']; $tplVars['token'] = $_SESSION['token'];
} }
$tplVars['objectUser'] = $userinfo; $tplVars['objectUser'] = $userinfo;

View File

@ -46,17 +46,15 @@ $searchhistoryservice =SemanticScuttle_Service_Factory::get('SearchHistory');
/* Managing current logged user */ /* Managing current logged user */
$currentUserId = $userservice->getCurrentUserId(); $currentUserId = $userservice->getCurrentUserId();
$exploded = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : null;
$exploded = isset($_SERVER['PATH_INFO'])
? explode('/', $_SERVER['PATH_INFO']) : null;
if (count($exploded) == 4) { if (count($exploded) == 4) {
list($url, $range, $terms, $page) = $exploded; list($url, $range, $terms, $page) = $exploded;
} elseif (count($exploded) == 2) { } elseif (count($exploded) == 2) {
list($url, $range) = $exploded; list($url, $range) = $exploded;
$terms = $page= NULL; $terms = $page= null;
} else { } else {
list($url, $range, $terms) = $exploded; list($url, $range, $terms) = $exploded;
$page= NULL; $page= null;
} }
$tplVars['loadjs'] = true; $tplVars['loadjs'] = true;
@ -71,10 +69,10 @@ if (intval(GET_PAGE) > 1) {
$start = 0; $start = 0;
} }
$s_user = NULL; $s_user = null;
$s_start = NULL; $s_start = null;
$s_end = NULL; $s_end = null;
$s_watchlist = NULL; $s_watchlist = null;
// No search terms // No search terms
if (is_null($terms)) { if (is_null($terms)) {
@ -90,7 +88,7 @@ if (is_null($terms)) {
switch ($range) { switch ($range) {
case 'all': case 'all':
$tplVars['select_all'] = $selected; $tplVars['select_all'] = $selected;
$s_user = NULL; $s_user = null;
break; break;
case 'watchlist': case 'watchlist':
$tplVars['select_watchlist'] = $selected; $tplVars['select_watchlist'] = $selected;
@ -105,7 +103,7 @@ if (is_null($terms)) {
if (isset($s_user)) { if (isset($s_user)) {
$tplVars['user'] = $range; $tplVars['user'] = $range;
$s_user = $userservice->getIdFromUser($s_user); $s_user = $userservice->getIdFromUser($s_user);
if($s_user == NULL) { if ($s_user == null) {
$tplVars['error'] = sprintf(T_('User with username %s was not found'), $s_user); $tplVars['error'] = sprintf(T_('User with username %s was not found'), $s_user);
$templateservice->loadTemplate('error.404.tpl', $tplVars); $templateservice->loadTemplate('error.404.tpl', $tplVars);
exit(); exit();
@ -114,7 +112,7 @@ if (is_null($terms)) {
} }
} }
$bookmarks =& $bookmarkservice->getBookmarks( $bookmarks =& $bookmarkservice->getBookmarks(
$start, $perpage, $s_user, NULL, $terms, getSortOrder(), $start, $perpage, $s_user, null, $terms, getSortOrder(),
$s_watchlist, $s_start, $s_end $s_watchlist, $s_start, $s_end
); );
@ -123,9 +121,7 @@ $searchhistoryservice->addSearch(
$terms, $range, $bookmarks['total'], $currentUserId $terms, $range, $bookmarks['total'], $currentUserId
); );
if (isset($_GET['lucky']) && $_GET['lucky'] if (isset($_GET['lucky']) && $_GET['lucky'] && isset($bookmarks['bookmarks'][0])) {
&& isset($bookmarks['bookmarks'][0])
) {
$url = $bookmarks['bookmarks'][0]['bAddress']; $url = $bookmarks['bookmarks'][0]['bAddress'];
header('Location: ' . $url); header('Location: ' . $url);
exit(); exit();

View File

@ -59,7 +59,6 @@ if (POST_CONFIRM != '') {
} }
$tplVars['links'] = $tag2tagservice->getLinks($currentUser->getId()); $tplVars['links'] = $tag2tagservice->getLinks($currentUser->getId());
$tplVars['tag1'] = $tag1; $tplVars['tag1'] = $tag1;
$tplVars['tag2'] = ''; $tplVars['tag2'] = '';
$tplVars['subtitle'] = T_('Add Tag Link') .': '. $tag1; $tplVars['subtitle'] = T_('Add Tag Link') .': '. $tag1;

View File

@ -56,8 +56,6 @@ if(isset($_SERVER['PATH_INFO'])) {
$url = $tag1 = $tag2 = ''; $url = $tag1 = $tag2 = '';
} }
if (POST_CONFIRM) { if (POST_CONFIRM) {
$tag = POST_TAG1; $tag = POST_TAG1;
$linkType = POST_LINKTYPE; $linkType = POST_LINKTYPE;
@ -75,7 +73,6 @@ if (POST_CONFIRM) {
} }
$tplVars['links'] = $tag2tagservice->getLinks($currentUser->getId()); $tplVars['links'] = $tag2tagservice->getLinks($currentUser->getId());
$tplVars['tag1'] = $tag1; $tplVars['tag1'] = $tag1;
$tplVars['tag2'] = $tag2; $tplVars['tag2'] = $tag2;
$tplVars['subtitle'] = T_('Delete Link Between Tags') .': '. $tag1.' > '.$tag2; $tplVars['subtitle'] = T_('Delete Link Between Tags') .': '. $tag1.' > '.$tag2;

View File

@ -49,7 +49,6 @@ if(isset($_SERVER['PATH_INFO'])) {
} }
$tplVars['links'] = $tag2tagservice->getLinks($userservice->getCurrentUserId()); $tplVars['links'] = $tag2tagservice->getLinks($userservice->getCurrentUserId());
$tplVars['tag1'] = $tag1; $tplVars['tag1'] = $tag1;
$tplVars['tag2'] = $tag2; $tplVars['tag2'] = $tag2;
$tplVars['subtitle'] = T_('Edit Link Between Tags') .': '. $tag1.' > '.$tag2; $tplVars['subtitle'] = T_('Edit Link Between Tags') .': '. $tag1.' > '.$tag2;

View File

@ -43,11 +43,7 @@ $currentUser = $userservice->getCurrentObjectUser();
list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']); list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']);
//permissions //permissions
if (!$userservice->isLoggedOn() if (!$userservice->isLoggedOn() || (!$GLOBALS['enableCommonTagDescriptionEditedByAll'] && !$currentUser->isAdmin())) {
|| (!$GLOBALS['enableCommonTagDescriptionEditedByAll']
&& !$currentUser->isAdmin()
)
) {
$tplVars['error'] = T_('Permission denied.'); $tplVars['error'] = T_('Permission denied.');
$templateservice->loadTemplate('error.500.tpl', $tplVars); $templateservice->loadTemplate('error.500.tpl', $tplVars);
exit(); exit();

View File

@ -46,9 +46,7 @@ if(!$userservice->isLoggedOn()) {
} }
if (POST_CONFIRM) { if (POST_CONFIRM) {
if ( strlen($tag)>0 && if (strlen($tag)>0 && $tagservice->updateDescription($tag, $currentUser->getId(), stripslashes(POST_DESCRIPTION))) {
$tagservice->updateDescription($tag, $currentUser->getId(), stripslashes(POST_DESCRIPTION))
) {
$tplVars['msg'] = T_('Tag description updated'); $tplVars['msg'] = T_('Tag description updated');
header('Location: '. POST_REFERRER); header('Location: '. POST_REFERRER);
} else { } else {

View File

@ -37,28 +37,27 @@ $currentUser = $userservice->getCurrentObjectUser();
/* Managing path info */ /* Managing path info */
list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']); list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']);
//$tag = isset($_GET['query']) ? $_GET['query'] : NULL; //$tag = isset($_GET['query']) ? $_GET['query'] : null;
$template = 'tagrename.tpl'; $template = 'tagrename.tpl';
if (POST_CONFIRM) { if (POST_CONFIRM) {
if (trim(POST_OLD) != '') { if (trim(POST_OLD) != '') {
$old = trim(POST_OLD); $old = trim(POST_OLD);
} else { } else {
$old = NULL; $old = null;
} }
if (trim(POST_NEW) != '') { if (trim(POST_NEW) != '') {
$new = trim(POST_NEW); $new = trim(POST_NEW);
} else { } else {
$new = NULL; $new = null;
} }
if ( if (!is_null($old)
!is_null($old) && && !is_null($new)
!is_null($new) && && $tagservice->renameTag($currentUser->getId(), $old, $new)
$tagservice->renameTag($currentUser->getId(), $old, $new) && && $b2tservice->renameTag($currentUser->getId(), $old, $new)
$b2tservice->renameTag($currentUser->getId(), $old, $new) && && $tag2tagservice->renameTag($currentUser->getId(), $old, $new)
$tag2tagservice->renameTag($currentUser->getId(), $old, $new)
) { ) {
$tplVars['msg'] = T_('Tag renamed'); $tplVars['msg'] = T_('Tag renamed');
header('Location: '. createURL('bookmarks', $currentUser->getUsername())); header('Location: '. createURL('bookmarks', $currentUser->getUsername()));

View File

@ -35,7 +35,6 @@ $currentUser = $userservice->getCurrentObjectUser();
/* Managing path info */ /* Managing path info */
list($url, $cat) = explode('/', $_SERVER['PATH_INFO']); list($url, $cat) = explode('/', $_SERVER['PATH_INFO']);
if (!$cat) { if (!$cat) {
header('Location: '. createURL('populartags')); header('Location: '. createURL('populartags'));
exit; exit;
@ -48,7 +47,6 @@ for($i = 0; $i<count($titleTags);$i++) {
} }
$pagetitle = substr($pagetitle, 0, strlen($pagetitle) - strlen(' + ')); $pagetitle = substr($pagetitle, 0, strlen($pagetitle) - strlen(' + '));
//$cattitle = str_replace('+', ' + ', $cat); //$cattitle = str_replace('+', ' + ', $cat);
if ($usecache) { if ($usecache) {
@ -67,7 +65,10 @@ if ($usecache) {
$tplVars['pagetitle'] = T_('Tags') .': '. $cat; $tplVars['pagetitle'] = T_('Tags') .': '. $cat;
$tplVars['loadjs'] = true; $tplVars['loadjs'] = true;
$tplVars['rsschannels'] = array( $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 // Pagination
@ -87,7 +88,7 @@ $tplVars['currenttag'] = $cat;
$tplVars['sidebar_blocks'] = array('linked', 'related', 'menu2');//array('linked', 'related', 'popular'); $tplVars['sidebar_blocks'] = array('linked', 'related', 'menu2');//array('linked', 'related', 'popular');
$tplVars['subtitle'] = $pagetitle; $tplVars['subtitle'] = $pagetitle;
$tplVars['bookmarkCount'] = $start + 1; $tplVars['bookmarkCount'] = $start + 1;
$bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, NULL, $cat, NULL, getSortOrder()); $bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, null, $cat, null, getSortOrder());
$tplVars['total'] = $bookmarks['total']; $tplVars['total'] = $bookmarks['total'];
$tplVars['bookmarks'] =& $bookmarks['bookmarks']; $tplVars['bookmarks'] =& $bookmarks['bookmarks'];
$tplVars['cat_url'] = createURL('bookmarks', '%1$s/%2$s'); $tplVars['cat_url'] = createURL('bookmarks', '%1$s/%2$s');

View File

@ -28,7 +28,7 @@ isset($_POST['contact']) ? define('POST_CONTACT', $_POST['contact']): define('PO
isset($_GET['contact']) ? define('GET_CONTACT', $_GET['contact']): define('GET_CONTACT', ''); isset($_GET['contact']) ? define('GET_CONTACT', $_GET['contact']): define('GET_CONTACT', '');
/* Managing path info */ /* Managing path info */
@list($url, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL; @list($url, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : null;
if ($user=='' && POST_CONTACT != '') { if ($user=='' && POST_CONTACT != '') {
$user = POST_CONTACT; $user = POST_CONTACT;
@ -41,7 +41,7 @@ if ($userservice->isLoggedOn() && $user) {
$userid = $userservice->getIdFromUser($user); $userid = $userservice->getIdFromUser($user);
if($userid == NULL) { if ($userid == null) {
$tplVars['error'] = sprintf(T_('User with username %s was not found'), $user); $tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
$templateservice->loadTemplate('error.404.tpl', $tplVars); $templateservice->loadTemplate('error.404.tpl', $tplVars);
exit(); exit();

View File

@ -32,7 +32,7 @@ isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '')
$currentUser = $userservice->getCurrentObjectUser(); $currentUser = $userservice->getCurrentObjectUser();
/* Managing path info */ /* Managing path info */
@list($url, $user, $page) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL; @list($url, $user, $page) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : null;
if ($usecache) { if ($usecache) {
@ -56,7 +56,7 @@ if ($user) {
$userid = intval($user); $userid = intval($user);
} else { } else {
$userinfo = $userservice->getObjectUserByUsername($user); $userinfo = $userservice->getObjectUserByUsername($user);
if ($userinfo == NULL ) { if ($userinfo == null ) {
// Throw a 404 error // Throw a 404 error
$tplVars['error'] = sprintf(T_('User with username %s was not found'), $user); $tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
$templateservice->loadTemplate('error.404.tpl', $tplVars); $templateservice->loadTemplate('error.404.tpl', $tplVars);
@ -91,7 +91,7 @@ if ($user) {
$tplVars['start'] = $start; $tplVars['start'] = $start;
$tplVars['bookmarkCount'] = $start + 1; $tplVars['bookmarkCount'] = $start + 1;
$bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, $userid, NULL, NULL, getSortOrder(), true); $bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, $userid, null, null, getSortOrder(), true);
$tplVars['sidebar_blocks'] = array('watchlist'); $tplVars['sidebar_blocks'] = array('watchlist');
$tplVars['watched'] = true; $tplVars['watched'] = true;