Compare commits
No commits in common. "master" and "0.98" have entirely different histories.
15
.travis.yml
15
.travis.yml
@ -1,15 +0,0 @@
|
||||
language: php
|
||||
phps:
|
||||
- 5.3
|
||||
script: cd tests && phpunit .
|
||||
notifications:
|
||||
irc: "irc.freenode.org#semanticscuttle"
|
||||
|
||||
before_script:
|
||||
- mysql -e 'create database semanticscuttle_test;'
|
||||
- mysql semanticscuttle_test < data/tables.sql
|
||||
- cat data/config.php.dist | sed "s/'username'/'root'/" | sed "s/'password'/''/" | sed "s/'scuttle'/'semanticscuttle_test'/" | sed "s/'mysql4'/'mysqli'/" > data/config.php
|
||||
- pyrus install pear/HTTP_Request2
|
||||
- pyrus install pear/PEAR
|
||||
- pyrus install pear/Stream_Var
|
||||
- phpenv rehash
|
12
README.md
12
README.md
@ -1,12 +0,0 @@
|
||||
Patched SemanticScuttle (social bookmarking tool).
|
||||
================================================
|
||||
|
||||
### New :
|
||||
|
||||
* Better import for XML bookmark file.
|
||||
* Support for adding multiple bookmarks at once with my modified Firefox's Scuttle plugin.
|
||||
* Block everything if global private mode enabled and user not logged on.
|
||||
* Shoulder surfing protection.
|
||||
* Batch tagging.
|
||||
* Search will now look in bookmarks addresses too.
|
||||
|
69
build.xml
69
build.xml
@ -28,34 +28,6 @@
|
||||
<property name="sffilepath" value="s/se/semanticscuttle/" />
|
||||
<property name="svnpath" value="https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/" />
|
||||
|
||||
<fileset id="fs.zip" dir=".">
|
||||
<include name="data/**"/>
|
||||
<include name="doc/**"/>
|
||||
<include name="src/**"/>
|
||||
<include name="www/**"/>
|
||||
<include name="scripts/avahi-export.php"/>
|
||||
<include name="scripts/fix-unfiled-tags.php"/>
|
||||
<exclude name="**/.gitignore/"/>
|
||||
<exclude name="**/.svn/"/>
|
||||
<exclude name="data/config.php"/>
|
||||
<exclude name="data/config.testing.php"/>
|
||||
<exclude name="data/config.testing-tmp.php"/>
|
||||
<exclude name="data/locales/messages.po"/>
|
||||
<exclude name="data/locales/*/LC_MESSAGES/messages.po"/>
|
||||
<exclude name="src/php-gettext/examples/" />
|
||||
<exclude name="src/php-gettext/tests/"/>
|
||||
</fileset>
|
||||
|
||||
<fileset id="fs.doc" dir="doc">
|
||||
<include name="ChangeLog"/>
|
||||
<include name="**.txt"/>
|
||||
<include name="**.rst"/>
|
||||
<include name="**/*.rst"/>
|
||||
<exclude name="LICENSE.txt"/>
|
||||
<exclude name="developers/TODO.rst"/>
|
||||
<exclude name="allinone.rst"/>
|
||||
</fileset>
|
||||
|
||||
<taskdef name="rST" classname="phing.tasks.ext.rSTTask" />
|
||||
<taskdef name="d51pearpkg2" classname="phing.tasks.ext.d51PearPkg2Task" />
|
||||
|
||||
@ -71,7 +43,23 @@
|
||||
<echo msg="Creating distribution zip for SemanticScuttle ${version}"/>
|
||||
<delete file="${distfile}" failonerror="false"/>
|
||||
<zip destfile="${distfile}" prefix="${phing.project.name}-${version}/">
|
||||
<fileset refid="fs.zip"/>
|
||||
<fileset dir=".">
|
||||
<include name="data/**"/>
|
||||
<include name="doc/**"/>
|
||||
<include name="src/**"/>
|
||||
<include name="www/**"/>
|
||||
<include name="scripts/avahi-export.php"/>
|
||||
<include name="scripts/fix-unfiled-tags.php"/>
|
||||
<exclude name="**/.gitignore/"/>
|
||||
<exclude name="**/.svn/"/>
|
||||
<exclude name="data/config.php"/>
|
||||
<exclude name="data/config.testing.php"/>
|
||||
<exclude name="data/config.testing-tmp.php"/>
|
||||
<exclude name="data/locales/messages.po"/>
|
||||
<exclude name="data/locales/*/LC_MESSAGES/messages.po"/>
|
||||
<exclude name="src/php-gettext/examples/" />
|
||||
<exclude name="src/php-gettext/tests/"/>
|
||||
</fileset>
|
||||
</zip>
|
||||
</target>
|
||||
|
||||
@ -105,15 +93,6 @@
|
||||
channel="pear.php.net"
|
||||
minimum_version="0.4.0"
|
||||
/>
|
||||
<!-- unit tests: -->
|
||||
<package name="HTML_Request2"
|
||||
channel="pear.php.net"
|
||||
minimum_version="2.0.0"
|
||||
/>
|
||||
<package name="Stream_Var"
|
||||
channel="pear.php.net"
|
||||
minimum_version="1.1.0"
|
||||
/>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@ -309,7 +288,15 @@
|
||||
<rST format="html" uptodate="true"
|
||||
toolparam="--stylesheet=res/docs/style.css"
|
||||
>
|
||||
<fileset refid="fs.doc"/>
|
||||
<fileset dir="doc">
|
||||
<include name="ChangeLog"/>
|
||||
<include name="**.txt"/>
|
||||
<include name="**.rst"/>
|
||||
<include name="**/*.rst"/>
|
||||
<exclude name="LICENSE.txt"/>
|
||||
<exclude name="developers/TODO.rst"/>
|
||||
<exclude name="allinone.rst"/>
|
||||
</fileset>
|
||||
<mapper type="regexp" from="^doc/(.+?)(.rst|.txt)?$" to="dist/docs/\1.html"/>
|
||||
<!--
|
||||
<filterchain>
|
||||
@ -321,10 +308,6 @@
|
||||
</rST>
|
||||
</target>
|
||||
|
||||
<target name="clean-docs" description="delete rendered documentation files">
|
||||
<delete dir="dist/docs" includeemptydirs="yes"/>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="release" depends="check,zip,package,deploy-sf"
|
||||
description="Release the version on sourceforge"
|
||||
|
@ -253,13 +253,10 @@ $adminsAreAdvisedTagsFromOtherAdmins = false;
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
$reservedusers = array('all', 'watchlist');
|
||||
$reservedusers = array('all', 'watchlist');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* If global private mode is enabled (everything will be blocked for unlogged users).
|
||||
* @var boolean
|
||||
*/
|
||||
$privatemode = false;
|
||||
|
||||
/***************************************************
|
||||
* Anti SPAM measures
|
||||
@ -545,27 +542,35 @@ $defaults['privacy'] = 0;
|
||||
*/
|
||||
|
||||
/**
|
||||
* Which thumbnail service type to use.
|
||||
* Enable bookmark website thumbnails.
|
||||
*
|
||||
* Currently supported:
|
||||
* - null (no screenshots)
|
||||
* - 'phancap', see http://cweiske.de/phancap.htm
|
||||
* According to artviper.net license, buy a license if you
|
||||
* gain profit with your pages.
|
||||
*
|
||||
* @var boolean
|
||||
* @link http://www.websitethumbnail.de/
|
||||
*/
|
||||
$enableWebsiteThumbnails = false;
|
||||
|
||||
/**
|
||||
* User ID from websitethumbnail.de
|
||||
*
|
||||
* You need to register on
|
||||
* http://www.artviper.net/registerapi.php
|
||||
* in order to use thumbnails on your domain
|
||||
*
|
||||
* @var string
|
||||
* @link http://www.artviper.net/registerapi.php
|
||||
*/
|
||||
$thumbnailsUserId = null;
|
||||
|
||||
/**
|
||||
* API key.
|
||||
* Sent to you by artviper.net after registration.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
$thumbnailsType = null;
|
||||
|
||||
/**
|
||||
* Configuration for thumbnail service.
|
||||
*
|
||||
* Phancap requires an array with the following keys:
|
||||
* - url: URL to phancap's get.php file
|
||||
* - token: user name (if access protected)
|
||||
* - secret: password for the user (if access protected)
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
$thumbnailsConfig = array();
|
||||
$thumbnailsKey = null;
|
||||
|
||||
|
||||
|
||||
@ -615,13 +620,6 @@ $menu2Tags = array(
|
||||
'menu2', 'tags', 'configurable', 'in', 'data/config.php'
|
||||
);
|
||||
|
||||
/**
|
||||
* Tag protected from shoulder surfing.
|
||||
* This tag, his children and the associated bookmarks won't appear anywhere unless enabled in the UI.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
$shoulderSurfingProtectedTag = 's_hidden';
|
||||
|
||||
|
||||
/****************************
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -115,38 +115,3 @@ echo jsEscTitle(htmlspecialchars($link));
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
function activateSocialApi(node) {
|
||||
var baseurl = <?php echo json_encode(addProtocolToUrl(createURL())); ?>;
|
||||
var socialApiData = {
|
||||
// currently required
|
||||
"name": <?php echo json_encode($GLOBALS['sitename']); ?>,
|
||||
"iconURL": baseurl + "themes/default/images/logo.png",
|
||||
"icon32URL": baseurl + "themes/default/images/logo.png",
|
||||
"icon64URL": baseurl + "themes/default/images/logo.png",
|
||||
|
||||
"markURL": "<?php echo addProtocolToUrl(createURL('bookmarks', $GLOBALS['user'])); ?>?action=add&popup=1&width=800&height=470&address=%{url}&title=%{title}&description=%{description}%{text}",
|
||||
"markedIcon": baseurl + "themes/default/images/logo.png",
|
||||
"unmarkedIcon": baseurl + "themes/default/images/logo-empty.png",
|
||||
|
||||
// should be available for display purposes
|
||||
"description": "Self-hosted bookmark manager",
|
||||
"author": "Christian Weiske",
|
||||
"homepageURL": "http://semanticscuttle.sf.net/",
|
||||
|
||||
// optional
|
||||
"version": "0.0.3"
|
||||
};
|
||||
|
||||
var event = new CustomEvent("ActivateSocialFeature");
|
||||
node.setAttribute("data-service", JSON.stringify(socialApiData));
|
||||
node.dispatchEvent(event);
|
||||
}
|
||||
</script>
|
||||
<p>
|
||||
<button onclick="activateSocialApi(this)" title="activate semanticscuttle in firefox">
|
||||
Add SemanticScuttle to Firefox
|
||||
</button>
|
||||
</p>
|
||||
|
@ -5,14 +5,14 @@
|
||||
*
|
||||
* Expects a $row variable with bookmark data.
|
||||
*/
|
||||
|
||||
$thumbnailer = SemanticScuttle_Service_Factory::get('Thumbnails')->getThumbnailer();
|
||||
$imgUrl = $thumbnailer->getThumbnailUrl($address, 120, 90);
|
||||
if ($imgUrl !== false) {
|
||||
echo '<a href="' . htmlspecialchars($address) . '">'
|
||||
. '<img class="thumbnail" width="120" height="90" src="'
|
||||
. htmlspecialchars($imgUrl).
|
||||
'" />'
|
||||
. '</a>';
|
||||
if (!$GLOBALS['enableWebsiteThumbnails']) {
|
||||
return;
|
||||
}
|
||||
|
||||
$thumbnailHash = md5(
|
||||
$address . $GLOBALS['thumbnailsUserId'] . $GLOBALS['thumbnailsKey']
|
||||
);
|
||||
//echo '<a href="'. $address .'"'. $rel .' ><img class="thumbnail" src="http://www.artviper.net/screenshots/screener.php?url='.$address.'&w=120&sdx=1280&userID='.$GLOBALS['thumbnailsUserId'].'&hash='.$thumbnailHash.'" />';
|
||||
echo '<img class="thumbnail" onclick="window.location.href=\''.htmlspecialchars($address).'\'" src="http://www.artviper.net/screenshots/screener.php?url='.htmlspecialchars($address).'&w=120&sdx=1280&userID='.$GLOBALS['thumbnailsUserId'].'&hash='.$thumbnailHash.'" />';
|
||||
|
||||
?>
|
@ -162,14 +162,6 @@ default:
|
||||
<a href="?sort=<?php echo $votingSort ?>"><?php echo T_("Voting").$votingArrow; ?></a>
|
||||
<span>/</span>
|
||||
<?php } ?>
|
||||
<?php
|
||||
if ($userservice->isLoggedOn() && $_SERVER['PHP_SELF'] !== "/index.php") {
|
||||
echo '<form method="get" action="'. $_SERVER['REQUEST_URI'] .'">';
|
||||
echo '<input type="hidden" name="batch" value="1"/>';
|
||||
echo '<input type="submit" value="Batch tagging"/>';
|
||||
echo "</form>";
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ($currenttag!= '') {
|
||||
@ -186,6 +178,7 @@ if ($currenttag!= '') {
|
||||
}
|
||||
}
|
||||
?></p>
|
||||
|
||||
<?php
|
||||
// PAGINATION
|
||||
|
||||
|
@ -6,6 +6,11 @@ echo '<a href="'.createURL('about').'">'.T_('About').'</a>';
|
||||
echo ' - ';
|
||||
echo T_("Propulsed by ");
|
||||
echo " <a href=\"https://sourceforge.net/projects/semanticscuttle/\">SemanticScuttle</a>";
|
||||
|
||||
if($GLOBALS['enableWebsiteThumbnails']) {
|
||||
// Licence to the thumbnails provider (OBLIGATORY IF YOU USE ARTVIPER SERVICE)
|
||||
echo ' (Thumbnails by <a href="http://www.artviper.net">webdesign</a>)';
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
@ -25,13 +25,13 @@ $b2tservice = SemanticScuttle_Service_Factory :: get('Bookmark2Tag');
|
||||
$logged_on_userid = $userservice->getCurrentUserId();
|
||||
|
||||
//tags from current user
|
||||
$userPopularTags = $b2tservice->getPopularTags($logged_on_userid, 25, $logged_on_userid);
|
||||
$userPopularTagsCloud = $b2tservice->tagCloud($userPopularTags, 5, 90, 175);
|
||||
$userPopularTags =& $b2tservice->getPopularTags($logged_on_userid, 25, $logged_on_userid);
|
||||
$userPopularTagsCloud =& $b2tservice->tagCloud($userPopularTags, 5, 90, 175);
|
||||
$userPopularTagsCount = count($userPopularTags);
|
||||
|
||||
//tags from all users
|
||||
$allPopularTags = $b2tservice->getPopularTags(null, 5, $logged_on_userid);
|
||||
$allPopularTagsCloud = $b2tservice->tagCloud($allPopularTags, 5, 90, 175);
|
||||
$allPopularTags =& $b2tservice->getPopularTags(null, 5, $logged_on_userid);
|
||||
$allPopularTagsCloud =& $b2tservice->tagCloud($allPopularTags, 5, 90, 175);
|
||||
$allPopularTagsCount = count($allPopularTags);
|
||||
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
$this->includeTemplate($GLOBALS['top_include']);
|
||||
|
||||
$accessPublic = '';
|
||||
$accessShared = '';
|
||||
$accessPrivate = '';
|
||||
@ -32,14 +33,6 @@ if (is_array($row['tags'])) {
|
||||
$row['tags'] = implode(', ', $row['tags']);
|
||||
}
|
||||
|
||||
if (! is_array($row['bAddress'])) {
|
||||
$row['bAddress'] = array($row['bAddress']);
|
||||
}
|
||||
|
||||
if (! is_array($row['bTitle'])) {
|
||||
$row['bTitle'] = array($row['bTitle']);
|
||||
}
|
||||
|
||||
$ajaxUrl = ROOT . 'ajax/'
|
||||
. (
|
||||
($GLOBALS['adminsAreAdvisedTagsFromOtherAdmins'] && $currentUser->isAdmin())
|
||||
@ -47,8 +40,18 @@ $ajaxUrl = ROOT . 'ajax/'
|
||||
: 'getcontacttags'
|
||||
) . '.php';
|
||||
?>
|
||||
<form onsubmit="var ind = 0; var cb = document.getElementById('checkbox'+ind); while (cb !== null) {var title = document.getElementById('titleField'+ind); var address = document.getElementById('address'+ind); if(cb.checked) {cb.parentNode.removeChild(cb);} else {cb.parentNode.removeChild(cb); title.parentNode.removeChild(title); address.parentNode.removeChild(address);} ind++; cb = document.getElementById('checkbox'+ind);}" action="<?php echo $formaction; ?>" method="post">
|
||||
<form action="<?php echo $formaction; ?>" method="post">
|
||||
<table>
|
||||
<tr>
|
||||
<th align="left"><?php echo T_('Address'); ?></th>
|
||||
<td><input type="text" id="address" name="address" size="75" maxlength="65535" value="<?php echo filter($row['bAddress'], 'xml'); ?>" onblur="useAddress(this)" /></td>
|
||||
<td>← <?php echo T_('Required'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="left"><?php echo T_('Title'); ?></th>
|
||||
<td><input type="text" id="titleField" name="title" size="75" maxlength="255" value="<?php echo filter($row['bTitle'], 'xml'); ?>" onkeypress="this.style.backgroundImage = 'none';" /></td>
|
||||
<td>← <?php echo T_('Required'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="left">
|
||||
<?php echo T_('Description'); ?>
|
||||
@ -75,44 +78,13 @@ $ajaxUrl = ROOT . 'ajax/'
|
||||
<td>← <?php echo T_('Just visible by you and your contacts.'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if(! isset($batch)): ?>
|
||||
<tr>
|
||||
<th align="left"><?php echo T_('Tags'); ?></th>
|
||||
<td class="scuttletheme">
|
||||
<input type="text" id="tags" class="tags" name="tags" size="75" value="<?php echo filter($row['tags'], 'xml'); ?>"/>
|
||||
<input type="text" id="tags" name="tags" size="75" value="<?php echo filter($row['tags'], 'xml'); ?>"/>
|
||||
</td>
|
||||
<td>← <?php echo T_('Comma-separated'); ?></td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<tr>
|
||||
<th align="left"><?php echo 'Common tags'; ?></th>
|
||||
<td class="scuttletheme">
|
||||
<span><?php echo filter($commontags, 'xml'); ?></span>
|
||||
</td>
|
||||
<td>← <?php echo 'Tags common to all those bookmarks'; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="left"><?php echo 'Associated tags'; ?></th>
|
||||
<td class="scuttletheme">
|
||||
<span><?php echo filter($alltags, 'xml'); ?></span>
|
||||
</td>
|
||||
<td>← <?php echo 'All tags associated to those bookmarks'; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="left"><?php echo 'Add those tags'; ?></th>
|
||||
<td class="scuttletheme">
|
||||
<input type="text" id="tags" class="tags" name="tags" size="75" value="<?php echo filter($row['tags'], 'xml'); ?>"/>
|
||||
</td>
|
||||
<td>← <?php echo T_('Comma-separated'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="left"><?php echo 'Remove those tags'; ?></th>
|
||||
<td class="scuttletheme">
|
||||
<input type="text" id="removetags" class="tags" name="removetags" size="75" value="<?php echo filter($row['tags'], 'xml'); ?>"/>
|
||||
</td>
|
||||
<td>← <?php echo T_('Comma-separated'); ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td align="right"><small><?php echo htmlspecialchars(T_('Note: use ">" to include one tag in another. e.g.: europe>france>paris'))?></small></td>
|
||||
@ -143,9 +115,6 @@ $ajaxUrl = ROOT . 'ajax/'
|
||||
<input type="submit" name="delete" value="<?php echo T_('Delete Bookmark'); ?>" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<button type="button" id="button" title="Invert selection" onclick="var ind = 0; var cb = document.getElementById('checkbox'+ind); while (cb !== null) {var title = document.getElementById('titleField'+ind); var address = document.getElementById('address'+ind); if(cb.checked) {cb.checked=false;} else {cb.checked=true;} ind++; cb = document.getElementById('checkbox'+ind);}">Invert selection</button>
|
||||
<?php
|
||||
if (isset($showdelete) && $showdelete) {
|
||||
echo ' (<a href="'.createURL('bookmarkcommondescriptionedit', $row['bHash']).'">';
|
||||
echo T_('edit common description').'</a>)';
|
||||
@ -157,42 +126,14 @@ $ajaxUrl = ROOT . 'ajax/'
|
||||
<?php
|
||||
} elseif (isset($referrer)) {
|
||||
?>
|
||||
<input type="hidden" name="referrer" value="<?php echo filter($referrer, 'xml'); ?>" />
|
||||
<input type="hidden" name="referrer" value="<?php echo $referrer; ?>" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php
|
||||
$ind = 0;
|
||||
foreach($row['bAddress'] as $index => $address) {
|
||||
?>
|
||||
<tr>
|
||||
<td height="20px"></td>
|
||||
<td><input type="checkbox" id="checkbox<?php echo $ind; ?>" checked="checked" /></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="left"><?php echo T_('Address'); ?></th>
|
||||
<td><input type="text" id="address<?php echo $ind; ?>" name="address[<?php echo $index; ?>]" size="75" maxlength="65535" value="<?php echo filter($address, 'xml'); ?>" onblur="useAddress(this)" /></td>
|
||||
<td>← <?php echo T_('Required'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="left"><?php echo T_('Title'); ?></th>
|
||||
<td><input type="text" id="titleField<?php echo $ind; ?>" name="title[<?php echo $index; ?>]" size="75" maxlength="255" value="<?php echo filter($row['bTitle'][$index], 'xml'); ?>" onkeypress="this.style.backgroundImage = 'none';" /></td>
|
||||
<td>← <?php echo T_('Required'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="20px"></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php
|
||||
$ind++;
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<link href="<?php echo ROOT ?>js/jquery-ui-1.8.11/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css"/>
|
||||
@ -215,8 +156,7 @@ jQuery(document).ready(function() {
|
||||
}
|
||||
//var availableTags = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"];
|
||||
|
||||
//jQuery("input#tags").autocomplete({
|
||||
jQuery("input.tags").autocomplete({
|
||||
jQuery("input#tags").autocomplete({
|
||||
autoFocus: true,
|
||||
minLength: 1,
|
||||
|
||||
|
@ -22,11 +22,6 @@ window.onload = function() {
|
||||
<td><input type="password" id="password" name="password" size="20" class="required" /></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="left"><label for="password2"><?php echo T_('Repeat Password'); ?></label></th>
|
||||
<td><input type="password" id="password2" name="password2" size="20" class="required" /></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="left"><label for="email"><?php echo T_('E-mail'); ?></label></th>
|
||||
<td><input type="text" id="email" name="email" size="40" class="required" value="<?php echo htmlspecialchars(POST_MAIL); ?>" /></td>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
$b2tservice =SemanticScuttle_Service_Factory::get('Bookmark2Tag');
|
||||
$commonTags = $b2tservice->getRelatedTagsByHash($hash);
|
||||
$commonTags = $b2tservice->tagCloud($commonTags, 5, 90, 225, 'alphabet_asc');
|
||||
$commonTags =& $b2tservice->getRelatedTagsByHash($hash);
|
||||
$commonTags =& $b2tservice->tagCloud($commonTags, 5, 90, 225, 'alphabet_asc');
|
||||
|
||||
if ($commonTags && count($commonTags) > 0) {
|
||||
?>
|
||||
|
@ -14,8 +14,8 @@ $logged_on_userid = $userservice->getCurrentUserId();
|
||||
if ($logged_on_userid === false) {
|
||||
$logged_on_userid = NULL;
|
||||
}
|
||||
$popularTags = $b2tservice->getPopularTags($userid, $popCount, $logged_on_userid);
|
||||
$popularTags = $b2tservice->tagCloud($popularTags, 5, 90, 225, 'alphabet_asc');
|
||||
$popularTags =& $b2tservice->getPopularTags($userid, $popCount, $logged_on_userid);
|
||||
$popularTags =& $b2tservice->tagCloud($popularTags, 5, 90, 225, 'alphabet_asc');
|
||||
|
||||
if ($popularTags && count($popularTags) > 0) {
|
||||
?>
|
||||
|
@ -10,7 +10,7 @@ if ($logged_on_userid === false) {
|
||||
$logged_on_userid = NULL;
|
||||
}
|
||||
$recentTags = $b2tservice->getPopularTags($userid, $popCount, $logged_on_userid, $GLOBALS['defaultRecentDays']);
|
||||
$recentTags = $b2tservice->tagCloud($recentTags, 5, 90, 225, 'alphabet_asc');
|
||||
$recentTags =& $b2tservice->tagCloud($recentTags, 5, 90, 225, 'alphabet_asc');
|
||||
|
||||
if ($recentTags && count($recentTags) > 0) {
|
||||
?>
|
||||
|
@ -11,62 +11,14 @@ if ($userservice->isLoggedOn() && is_object($currentUser)) {
|
||||
<li><a href="<?php echo createURL('watchlist', $cUsername); ?>"><?php echo T_('Watchlist'); ?></a></li>
|
||||
<li><a href="<?php echo $userservice->getProfileUrl($cUserId, $cUsername); ?>"><?php echo T_('Profile'); ?></a></li>
|
||||
<li><a href="<?php echo createURL('bookmarks', $cUsername . '?action=add'); ?>"><?php echo T_('Add a Bookmark'); ?></a></li>
|
||||
|
||||
<?php if (isset($loadjs)) :?>
|
||||
<li class="access"><button type="button" id="button" title="shoulder surfing protection" onclick="if(! $.cookie('noshoulderSurfingProtection')) {toggle();} else {$.removeCookie('noshoulderSurfingProtection', { path: '/' }); location.reload();}"><?php if(! isset($_COOKIE["noshoulderSurfingProtection"])) {echo "Protected";} else {echo "Unprotected";} ?></button></li>
|
||||
<?php endif ?>
|
||||
|
||||
<li class="access"><?php echo $cUsername?><a href="<?php echo ROOT ?>?action=logout">(<?php echo T_('Log Out'); ?>)</a></li>
|
||||
<li><a href="<?php echo createURL('about'); ?>"><?php echo T_('About'); ?></a></li>
|
||||
<?php if($currentUser->isAdmin()): ?>
|
||||
<li><a href="<?php echo createURL('admin', ''); ?>"><?php echo '['.T_('Admin').']'; ?></a></li>
|
||||
<?php endif; ?>
|
||||
|
||||
</ul>
|
||||
|
||||
<?php if (isset($loadjs)) :?>
|
||||
<div id="password-form" style="background:white; z-index: 2; position:absolute; top:55px; right:10px; visibility:hidden;">
|
||||
<form id="noshoulderSurfingProtectionPassword">
|
||||
<input type="password" name="password" id="password" size="40" placeholder="Type your password then press Enter to unprotect."/>
|
||||
<!-- Allow form submission with keyboard without duplicating the dialog button -->
|
||||
<input type="submit" tabindex="-1" style="position:absolute; top:-1000px"/>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
// Prevents browser autocompletion. autocomplete="off" as input type="password" attribute only works with HTML5.
|
||||
setTimeout(
|
||||
clear(),
|
||||
1000 //1,000 milliseconds = 1 second
|
||||
);
|
||||
function clear() {
|
||||
$('#password').val('');
|
||||
}
|
||||
function toggle() {
|
||||
if ($("#password-form").css("visibility") == "visible") {
|
||||
$("#password-form").css("visibility", "hidden");
|
||||
}
|
||||
else {
|
||||
clear();
|
||||
$("#password-form").css("visibility", "visible");
|
||||
}
|
||||
}
|
||||
$( "#noshoulderSurfingProtectionPassword" ).submit(function( event ) {
|
||||
$.post(
|
||||
'<?php echo ROOT ?>ajax/checkpassword.php',
|
||||
{
|
||||
password : $("#password").val(),
|
||||
},
|
||||
function(data) {
|
||||
if(data == 'true') {
|
||||
$.cookie('noshoulderSurfingProtection', 'null', { path: '/' });
|
||||
location.reload();
|
||||
}
|
||||
},
|
||||
'text'
|
||||
);
|
||||
event.preventDefault();
|
||||
});
|
||||
</script>
|
||||
<?php endif ?>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
|
@ -22,35 +22,19 @@ if (isset($rsschannels)) {
|
||||
<?php if (DEBUG_MODE) : ?>
|
||||
<script type="text/javascript" src="<?php echo ROOT_JS ?>jquery-1.4.2.js"></script>
|
||||
<script type="text/javascript" src="<?php echo ROOT_JS ?>jquery.jstree.js"></script>
|
||||
<script type="text/javascript" src="<?php echo ROOT_JS ?>jquery.cookie-1.4.1.js"></script>
|
||||
<?php else: ?>
|
||||
<script type="text/javascript" src="<?php echo ROOT_JS ?>jquery-1.4.2.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo ROOT_JS ?>jquery.jstree.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo ROOT_JS ?>jquery.cookie-1.4.1.js"></script>
|
||||
<?php endif ?>
|
||||
<script type="text/javascript" src="<?php echo ROOT ?>jsScuttle.php"></script>
|
||||
<?php endif ?>
|
||||
|
||||
</head>
|
||||
<?php
|
||||
$bodystyle = '';
|
||||
if (isset($_GET['popup'])) {
|
||||
if (isset($_GET['height'])) {
|
||||
$bodystyle .= 'height:' . intval($_GET['height']) . 'px;';
|
||||
}
|
||||
if (isset($_GET['width'])) {
|
||||
$bodystyle .= 'width:' . intval($_GET['width']) . 'px;';
|
||||
}
|
||||
if ($bodystyle != '') {
|
||||
$bodystyle = ' style="' . $bodystyle . '"';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<body<?php echo $bodystyle; ?>>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
$headerstyle = '';
|
||||
if (isset($_GET['popup'])) {
|
||||
if(isset($_GET['popup'])) {
|
||||
$headerstyle = ' class="popup"';
|
||||
}
|
||||
?>
|
||||
|
@ -1,13 +1,8 @@
|
||||
ChangeLog for SemanticScuttle
|
||||
=============================
|
||||
ChangeLog for SemantiScuttle
|
||||
============================
|
||||
|
||||
.. contents::
|
||||
|
||||
0.98.6 - 2013-XX-XX
|
||||
-------------------
|
||||
- Fix bug #161: URLs broken on 1&1 server
|
||||
|
||||
|
||||
0.98.5 - 2013-03-20
|
||||
-------------------
|
||||
- Fix bug #109: preserve privacy setting from Delicious export files
|
||||
|
@ -2,7 +2,6 @@
|
||||
SemanticScuttle installation
|
||||
============================
|
||||
|
||||
.. contents::
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
@ -12,22 +11,17 @@ To run SemanticScuttle, you need:
|
||||
- A web server, for example Apache
|
||||
|
||||
|
||||
Standard installation instructions
|
||||
==================================
|
||||
If you've downloaded a ``SemanticScuttle-x.y.z.zip`` file from SourceForge,
|
||||
then this instructions are for you.
|
||||
|
||||
1. Create a new MySQL/PostgreSQL database
|
||||
Installation instructions
|
||||
=========================
|
||||
1. Create a new MySQL database
|
||||
2. Import ``data/tables.sql`` into that database, i.e.
|
||||
run ::
|
||||
|
||||
$ mysql -umyusername -p mydatabasename < data/tables.sql
|
||||
$ mysql -umyusername semanticscuttle < data/tables.sql
|
||||
|
||||
on the shell.
|
||||
on the shell ("semanticscuttle" being the database name)
|
||||
|
||||
If you run PostgreSQL, use ``tables-postgresql.sql``::
|
||||
|
||||
$ psql mydatabasename myusername < data/tables-postgresql.sql
|
||||
If you run PostgreSQL, use ``data/tables.postgresql.sql``.
|
||||
|
||||
3. Copy ``data/config.php.dist`` to ``data/config.php`` and modify it as
|
||||
necessary. See configuration_ for more information.
|
||||
@ -48,7 +42,7 @@ then this instructions are for you.
|
||||
|
||||
|
||||
Ugly www directory in URLs
|
||||
--------------------------
|
||||
==========================
|
||||
In case point 5 of the installation instructions cannot be put into
|
||||
practice by you because you are not able to change the web server
|
||||
configuration, you are not lost! There is a way to get rid of
|
||||
@ -91,58 +85,3 @@ with ::
|
||||
|
||||
require_once '../../semanticscuttle/src/SemanticScuttle/header.php';
|
||||
|
||||
|
||||
|
||||
PEAR package installation
|
||||
=========================
|
||||
Apart from the normal installation, you may install the SemanticScuttle PEAR
|
||||
package - it gives you the ability to upgrade to the next version with a single
|
||||
command, without manually unzipping files.
|
||||
|
||||
0. The SemanticScuttle PEAR channel is available at
|
||||
http://semanticscuttle.sourceforge.net/pirum.html
|
||||
|
||||
1. Make sure you have the PEAR installer (or Pyrus) available and working.
|
||||
You can check that by running ::
|
||||
|
||||
$ pear version
|
||||
PEAR Version: 1.9.2
|
||||
PHP Version: 5.3.6-13ubuntu3.2
|
||||
Zend Engine Version: 2.3.0
|
||||
Running on: Linux bogo 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 x86_64
|
||||
|
||||
2. Discover the channel if you haven't done so yet::
|
||||
|
||||
$ pear channel-discover semanticscuttle.sourceforge.net
|
||||
|
||||
Verify that the channel has been added with::
|
||||
|
||||
$ pear list-channels
|
||||
Registered Channels:
|
||||
====================
|
||||
Channel Alias Summary
|
||||
...
|
||||
semanticscuttle.sourceforge.net sc SemanticScuttle PEAR channel
|
||||
...
|
||||
|
||||
3. Install SemanticScuttle::
|
||||
|
||||
$ pear install sc/semanticscuttle-beta
|
||||
|
||||
4. Find out where it got installed to::
|
||||
|
||||
$ pear list-files sc/semanticscuttle
|
||||
|
||||
5. Generally, the directory you need to point your web server's ``DocumentRoot`` to
|
||||
is the *PEAR www directory* + ``/SemanticScuttle/``. Find the www directory with::
|
||||
|
||||
$ pear config-get www_dir
|
||||
/usr/share/php/htdocs
|
||||
|
||||
6. The configuration file is located in *PEAR's data directory* + ``/SemanticScuttle/``::
|
||||
|
||||
$ pear config-get data_dir
|
||||
/usr/share/php/data
|
||||
|
||||
In ``$data_dir/SemanticScuttle/``, copy ``config.php.dist`` to
|
||||
``config.php`` and continue with configuration_.
|
||||
|
@ -211,6 +211,3 @@ Here we authenticate against an active directory server.
|
||||
);
|
||||
$authEmailSuffix = '@example.org';
|
||||
|
||||
More LDAP options can be found in the `PEAR manual`__.
|
||||
|
||||
__ http://pear.php.net/manual/en/package.authentication.auth.storage.ldap.php
|
||||
|
@ -14,18 +14,9 @@ How to release a new version of SemanticScuttle
|
||||
The build script takes care for most of the
|
||||
tasks.
|
||||
Run "``phing release``", and it will upload the release to
|
||||
sourceforge.
|
||||
7. Create a git tag and push it
|
||||
8. Create the PEAR package and test it:
|
||||
Run ``phing package``, then
|
||||
``pear upgrade dist/pear/SemanticScuttle-0.xx.tgz``
|
||||
9. Publish the PEAR package: ``phing deploy-sf-pear``
|
||||
10. Publish the documentation: ``phing deploy-docs``
|
||||
11. Write announcement mail to the SemanticScuttle mailing list
|
||||
semanticscuttle-devel@lists.sourceforge.net
|
||||
12. Announce the new release in the sourceforge project news
|
||||
https://sourceforge.net/news/submit.php?group_id=211356
|
||||
Help about the process is available in
|
||||
https://sourceforge.net/apps/trac/sourceforge/wiki/News
|
||||
13. Set the default file in
|
||||
https://sourceforge.net/projects/semanticscuttle/files/SemanticScuttle/
|
||||
sourceforge and create a svn tag.
|
||||
7. Write announcement mail to the SemanticScuttle mailing list
|
||||
semanticscuttle-devel@lists.sourceforge.net
|
||||
8. Announce the new release in the sourceforge project news
|
||||
https://sourceforge.net/apps/trac/sourceforge/wiki/News
|
||||
|
||||
|
@ -1,10 +1,5 @@
|
||||
Running unit tests
|
||||
==================
|
||||
The tests are dependent on the pear packages HTTP_Request2 and Stream_Var.
|
||||
|
||||
Install them with: ::
|
||||
$ pear install HTTP_Request2
|
||||
$ pear install Stream_Var
|
||||
|
||||
Go to the SemanticScuttle ``tests`` directory and run ``phpunit``::
|
||||
|
||||
|
@ -21,13 +21,11 @@ Features
|
||||
- `SSL Client certificates`__
|
||||
- Themes__
|
||||
- `Configuration files`__
|
||||
- Tools__
|
||||
|
||||
__ authentication.html
|
||||
__ ssl-client-certificates.html
|
||||
__ themes.html
|
||||
__ configuration.html
|
||||
__ tools.html
|
||||
|
||||
|
||||
|
||||
|
@ -46,13 +46,3 @@ You may put your theme template files into ::
|
||||
|
||||
data/templates/$themename/
|
||||
|
||||
|
||||
Existing themes
|
||||
===============
|
||||
|
||||
* `Flat`__ by Roman Lehnhof. See the `introduction blog post`__
|
||||
* `sscuttlizr`__
|
||||
|
||||
__ https://github.com/rlehnhof/flat
|
||||
__ http://lehnhof.net/2013/08/semantic-scuttle-new-flat-interface-theme-template/
|
||||
__ https://github.com/jonrandoem/sscuttlizr
|
||||
|
@ -1,44 +0,0 @@
|
||||
=================================
|
||||
Tools to use with SemanticScuttle
|
||||
=================================
|
||||
|
||||
Scuttleoid
|
||||
==========
|
||||
Scuttloid is an android client for managing your bookmarks that are
|
||||
stored on a Semantic Scuttle server.
|
||||
It allows to list/search your personal bookmarks, add and edit existing
|
||||
bookmarks, and share them to other applications.
|
||||
|
||||
Installable via `f-droid`__.
|
||||
Also see the `source code`__.
|
||||
|
||||
__ https://f-droid.org/repository/browse/?fdid=gr.ndre.scuttloid
|
||||
__ https://github.com/ilesinge/scuttloid
|
||||
|
||||
|
||||
Scuttle for Android
|
||||
===================
|
||||
Scuttle for Android is a client for the Scuttle bookmarking software.
|
||||
Enter your Scuttle login information and you will presented with a list of your
|
||||
bookmarks.
|
||||
Touching a bookmark will load that web page in the browser.
|
||||
Use the browser's "Share" menu option to add bookmarks to your Scuttle.
|
||||
|
||||
See the homepage__ and `source code`__.
|
||||
|
||||
__ http://slideme.org/application/scuttle-android
|
||||
__ https://github.com/shadybrooksoftware/Scuttle-For-Android
|
||||
|
||||
|
||||
ttrss2scuttle
|
||||
=============
|
||||
Announced in a `blog post`__, the plugin for the feed reader `Tiny Tiny RSS`__
|
||||
allows you to bookmark any of the articles in your own SemanticScuttle
|
||||
instance.
|
||||
|
||||
Source code and installation instructions are on the
|
||||
`ttrss2scuttle github page`__.
|
||||
|
||||
__ http://www.versvs.net/anotacion/plugin-tiny-tiny-rss-semanticscuttle
|
||||
__ http://tt-rss.org/
|
||||
__ https://github.com/versvs/ttrss2scuttle
|
@ -1,8 +0,0 @@
|
||||
<ul class="menu">
|
||||
<li><a href="index.html">Index</a></li>
|
||||
<li><a href="INSTALL.html">Installation</a></li>
|
||||
<li><a href="UPGRADE.html">Upgrade</a></li>
|
||||
<li><a href="ChangeLog.html">ChangeLog</a></li>
|
||||
<li><a href="http://semanticscuttle.sourceforget.net/">Homepage</a></li>
|
||||
<li><a href="https://sourceforget.net/projects/semanticscuttle">Project page</a></li>
|
||||
</ul>
|
@ -1,7 +1,4 @@
|
||||
/* SemanticScuttle improvements */
|
||||
.document {
|
||||
max-width: 100ex;
|
||||
}
|
||||
h1.title {
|
||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAsvSURBVGiBxZprjCRXdcd/p6r6Nd0979mHZ+3sCkfx4AdJsAhGm2BMYhAbrAgsEimKjGIlxELk8SkrQoQiSGgrCSJZh9hECsQ8hJCQlRDjYDsY4RAvRF6b9drN2t7HzOzOzmtnpl/V1fW4Jx+qu6emZ3pmbI/kI7Wq+9Ste///87j33FstqspeS7kkR4HPAAeAx4G/mDqu9T0fCJC9JlAuyXuB72Ymbklnxt9K/fxjmFblf4A7p45rc08HA6y97KxcksPAI5mJW9JDN99DbvI2Rt7+CSSVPwo8tJdjdWRPCQAPWZmhYuHn70LwyeQFOzvC4C/cDfB75ZL85h6Pt3cEyiW5B7gzf+T9ABRGM+SHHFIZQ3p8isz4TajyYLkkQ3s1JuwRgXJJ9gGfT49NkSpeQzYvpDMKxic/kkLUp3D9MaxUbhL4u70YsyN75YH7xcmN5q75FUQCCqNp0BaYFraE5IdTiJUmf+ROVLm3XJLb9mjcN06gXJJ3Avdk9/0iqDK0L4slAZgA1Af1yeaFVMaQGXsrqeKkGOWBckn2xHhvqJNySQQ4YWVHxRk8RCYvZHICptX1ACYmURhLo8Zj4OfegyXyy8C9bzoB4GPArZmxKYg8hvbn2lYP2sCDLgnHMQwMOtjZETLjN2IMnyuXZORNI1AuyU3A553CJOJkKY5ncZxog9W7V/XBtOKExid78Fbs9MCYUf71TSHQBv8tSeVzTnESJxVSnMgkgLfWwyhBxCJgcF8WEPJxKP1WuSSfLZdk8PUS2FUpUS7JAeCdwG3AMeBGsbOkhg5jpXNM3nQd6YEsiAU48VVsoH0VC7Db323WrtRorHr4Ky/TWnwejVot4HvAD4BngOemjmvrdRMol+Qg8OvAbwC/ChwGASuFlcphpQqIk0XEZuL6/QzuH2kD7AVub6lXtVi6sELgGRAhbMwTVGeJGgsYvwrgA6eAp4iLwf+dOq7+tgTKJbkF+Ggb9E3xbQssG7EcxE6D2IjYWKkU+fFBhg+MkhvO94DcgUj7atSisdKkWfXbRGzEstEoIGouE7qLhLU5ouYSQAP4IfBd4OGp41rtEnjpc+SBh4EPbe0kC7EtcsMFsoMFBkYK5EeKWI5DMiz6hctu9IGvePWAoBkReBFhAGK125mAsD5PULtEsHYOjVoV4ONTx/XrHQL/DPzRBrdYwsDwAPmRPAOjA2QLWcSSra2btHI//WsIL8TGRELLDWm5AX4jJAxBxAYUb/4U3sIpBd4+dVyfc4APdIAXxguMXjtKbjiHZW01QUWg7Y9YoB0gUft7r5UT+k7bThttA07q220tyyZXsMgVB0AswgBa9YD6VZfMvrfhLZwS4H3Acw5wBbgOIFvMkh/Nbx1JG8SAGiBMAEiAwtqlPtqsJ6mPDeA4NtagTW2xhb86DcBilaWp+ElOdGAtX1ymsdLYBYFer/QuWtuvBxv0Znf6lZkrBG4Fb/5ZWgGLv/sgMyIybgHfaIWcBEDh8guX8Ztbzli7INIuHbpg2wWdWS8pNul7wXafXddXrizjXl2jefkkGrp8v8wDl1fxgWtFVbnvDvmlj93B4xmHcYBMPsPhWw9jpTKQmoD0frAH25177U8LWpdiXV/pJKnD5tlod/pGxWPp3ApB5SJhbZZXF/jWXV/gi+0BPAfgwac4m0nxl39wO/9oWU4qdeiDVPQwwweuRTqdqqGbxGisswvgnoX6s+DP9/FKlIjpZPJaINH66r2FvtWIWHplkdBdIazNslLn2d/+Ig8mBlhxAFTVFZHv33CQv3/3DeHxsDKNHjpKo+pQGMkCJgathvUENhDWYw9N3A2RC9WT4L60BZH2MxomQDqsz1JRj/UjAs9w5cV5Qq9BUJnGC7jyx1/jr5o+Zt06TCfnyvP3/RuPlOf4qjf/f9TPPUqr5uKu1duDR20gHasaEI0BRY04pIbfCxO/E3tmS9GYxIaE3Vy1Rn6TuTMXCRprBJUZwkgbJ57gk6emqSY6e0VV/S4BVQ2BMx8+wZcurfBfjYtP0Jw7ibtap9VorpPoeiFK6NqhEC6DpODgH0L+5j4kkuGVTPo4adW0mDtzkVa1QtiYx6gJvvljPvnlp7mQePiSqi5ATzmtqi5Q/tAJ/na5xo9rZx8hqFygtrhGFAY9edDxSoIIGs8e3kzbGx8Ba6d1xazPSuqzfH6OxtU1Im8VNZF54gx//Tff4aeJB1aB850fm5ZbVb1a9zh3z5f4tOub2erZb2OCJtWFVbTXA0SgGv/uxnk7X7yLYGXhmvtg6NdAMjsQUZprNZbPz6GBCxpx5jJf/rNv8INEIxd4SRMl9JYbGlWdvrDMxa88zWej5mrUuPgkgesTND02JHHXI4ZNeYKBYAXcn8XhdOhPYfg9YOX6Urg6c7VrkEqTFz/6L3w9cdsHXmiHele225G9/MCTPLNc5ydB7TKqESYMEiAT4DeFVfJ+CM2XYyK5G2DyT+LwckY3DRj669gef4Gv9Mw4L6iq1/uM0w+9qqqIvCTgYhIzT8f6vSFDMg96pls1ENXiKVYccEZg7FgcVurH9/wl0qOD+P4FIneReovOQbACL6pufbq97Z5YVaPhAdZQAyaKc6BfyCRnpU0eSuiNB/5lcF+BxumYlHcJALt4mIHrbgfAGDpxPqOqq/0w9vVAt4HNsDgZVCNEeuM/4YEu4J6k3tCm10OJtlEL9eYIKi4gjBd1kHgnNr0tvp0IAAcklQcTYdusg9guZDbptgK/+b6dEtTEZcdYIRwFmrrDqcOuCFhODtUIy5adwe8EuGv5iI3eM9iOgEaIZTM0EI62B9tWtiVQLkkKGBUnBxph2dtZOxE+m0gpuwkv26HtAYtChlF2cW61kwdGABE7jYhB+gF+LR7YcN9sIG070ClLBjKMA+k3SqAI8QmBSD/rbgTsey2aqw3ctRqRH5DOp8gP58gW03EObUkq7ltsUDWIWKQsBvaMAGLH1t9g1XUPGBPhrtSoLVUJ3BaqBtNaw/gNAncI92oVMORHcwzuK5IZcLYIL4NldQwBjr2HBERsxNq8iEVBQG2pSn25hgkCTFAnqM4QuUto1DkZFKx0ATs3Ri0coba4RibvMLS/SH4kF3u23a9lxTmgqjgWOUBExOktH14LgWx86cR63LlXaVBfqeFVXTSKCN0Fgso0xlvBGPzFKj86fYmny3PM3DGltx3ZV7u94NfeQnUWOzuK8YfxKnVsRyiO5ylMDJDJOSCdRdEQbwUBsIHXTWAJwAQNAs9nZfYqzaqL8QNM6BJUZwmrs2jk4Ycsn73Cv3/he3znmXOsdTp46CleBb7658e45f03R3fvG1w6Ks0lS1J5onSRVa/Jyqwhk0/hZKx4xTchrYCVBIG+shOBl4FaUJku2rkx6o0KUXM5PohtLqOqutrg1LMXefTTj/DDNbe/pe5/lNP3P8rpY29j/73v5oNHJhrvywSNiQgLK53HCzLxwa+JX46sNji3G4w7Hq+XS/IJVf5BBOnoWgGL5xZ57OEf8dh/PMdWu/mO+MQbkByw4R1ALo31qbt4x7uu5wMTg7zLknWgfsjyp77Nx//zeRaA09vVQrt6P/CZD8vv33CQo65P9acznP2n/+ZnftgtdXtFgWVgTlW7oSQiGeL/TlxDz+xy6xEGP/IObj48zlu8APeBJ3niJ+eptG8/r6oV+siuCIjIjRCfGW0jIfEx5WXV/i8nRESACWCSHq/0kZPb9bebWghgkf4E1oB5YElV+3mlK+3ibBFYFJECsVf298Gyth142KUHAERkEjgEpIA6cWwvbLVLeq0iIhYwRuyZQeKZZxV4VXXboz/+HwP+91Qbpr+OAAAAAElFTkSuQmCC");
|
||||
background-repeat: no-repeat;
|
||||
|
@ -29,20 +29,24 @@ class SemanticScuttle_Environment
|
||||
*/
|
||||
public static function getServerPathInfo()
|
||||
{
|
||||
if (isset($_SERVER['PATH_INFO'])) {
|
||||
return $_SERVER['PATH_INFO'];
|
||||
}
|
||||
|
||||
if (isset($_SERVER['ORIG_PATH_INFO'])) {
|
||||
//1&1 servers
|
||||
if ($_SERVER['ORIG_PATH_INFO'] == $_SERVER['SCRIPT_NAME']) {
|
||||
return '';
|
||||
/* old code that does not work today.
|
||||
if you find that this code helps you, tell us
|
||||
and send us the output of var_export($_SERVER);
|
||||
// Correct bugs with PATH_INFO (maybe for Apache 1 or CGI) -- for 1&1 host...
|
||||
if (isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO'])) {
|
||||
if (strlen($_SERVER["PATH_INFO"])<strlen($_SERVER["ORIG_PATH_INFO"])) {
|
||||
$_SERVER["PATH_INFO"] = $_SERVER["ORIG_PATH_INFO"];
|
||||
}
|
||||
if (strcasecmp($_SERVER["PATH_INFO"], $_SERVER["SCRIPT_NAME"]) == 0) {
|
||||
unset($_SERVER["PATH_INFO"]);
|
||||
}
|
||||
if (strpos($_SERVER["PATH_INFO"], '.php') !== false) {
|
||||
unset($_SERVER["PATH_INFO"]);
|
||||
}
|
||||
return $_SERVER['ORIG_PATH_INFO'];
|
||||
}
|
||||
*/
|
||||
|
||||
//fallback when no special path after the php file is given
|
||||
return '';
|
||||
return $_SERVER['PATH_INFO'];
|
||||
}
|
||||
}
|
||||
?>
|
@ -51,7 +51,7 @@ class SemanticScuttle_Service
|
||||
{
|
||||
static $instance;
|
||||
if (!isset($instance)) {
|
||||
$instance = new static($db);
|
||||
$instance = new self($db);
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
|
||||
. ' "' . $this->db->sql_escape($value) .'"'
|
||||
. $range;
|
||||
|
||||
if (!($dbresult = $this->db->sql_query_limit($query, 1, 0))) {
|
||||
if (!($dbresult = & $this->db->sql_query_limit($query, 1, 0))) {
|
||||
message_die(
|
||||
GENERAL_ERROR,
|
||||
'Could not get bookmark', '', __LINE__, __FILE__,
|
||||
@ -148,7 +148,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
|
||||
. $query_2
|
||||
.' WHERE B.bId = '. $this->db->sql_escape($bid);
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($sql))) {
|
||||
if (!($dbresult = & $this->db->sql_query($sql))) {
|
||||
message_die(
|
||||
GENERAL_ERROR, 'Could not get bookmark',
|
||||
'', __LINE__, __FILE__, $sql, $this->db
|
||||
@ -630,7 +630,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
|
||||
. ' WHERE bId = ' . intval($bId);
|
||||
$this->db->sql_transaction('begin');
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($sql))) {
|
||||
if (!($dbresult = & $this->db->sql_query($sql))) {
|
||||
$this->db->sql_transaction('rollback');
|
||||
message_die(
|
||||
GENERAL_ERROR, 'Could not update bookmark',
|
||||
@ -687,7 +687,6 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
|
||||
* @param string $terms Search terms separated by spaces
|
||||
* @param string $sortOrder One of the following values:
|
||||
* "date_asc", "date_desc",
|
||||
* "modified_asc", "modified_desc"
|
||||
* "title_desc", "title_asc",
|
||||
* "url_desc", "url_asc",
|
||||
* "voting_asc", "voting_desc"
|
||||
@ -733,26 +732,11 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
|
||||
if (!is_array($tags) && !is_null($tags)) {
|
||||
$tags = explode('+', trim($tags));
|
||||
}
|
||||
if (!is_null($tags)) {
|
||||
$tags = array_map('trim', $tags);
|
||||
}
|
||||
// Remove shoulder surfing protected tags.
|
||||
if (! empty($GLOBALS['shoulderSurfingProtectedTag']) && $userservice->isLoggedOn() && ! isset($_COOKIE["noshoulderSurfingProtection"])) {
|
||||
$shoulderSurfingProtectedTags = $tag2tagservice->getAllLinkedTags($GLOBALS['shoulderSurfingProtectedTag'], '>', $sId, array());
|
||||
$shoulderSurfingProtectedTags[] = $GLOBALS['shoulderSurfingProtectedTag'];
|
||||
$tags2 = [];
|
||||
foreach ($tags as $tag) {
|
||||
if (! in_array($tag, $shoulderSurfingProtectedTags, true)) {
|
||||
$tags2[] = $tag;
|
||||
}
|
||||
}
|
||||
// If we filtered everything, we stop here and return nothing.
|
||||
if(! empty($tags) && empty($tags2)) {
|
||||
return array();
|
||||
}
|
||||
$tags = $tags2;
|
||||
}
|
||||
|
||||
$tagcount = count($tags);
|
||||
for ($i = 0; $i < $tagcount; $i ++) {
|
||||
$tags[$i] = trim($tags[$i]);
|
||||
}
|
||||
|
||||
// Set up the SQL query.
|
||||
$query_1 = 'SELECT DISTINCT ';
|
||||
@ -830,12 +814,6 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
|
||||
case 'url_asc':
|
||||
$query_5 .= ' ORDER BY B.bAddress ASC ';
|
||||
break;
|
||||
case 'modified_desc':
|
||||
$query_5 .= ' ORDER BY B.bModified DESC ';
|
||||
break;
|
||||
case 'modified_asc':
|
||||
$query_5 .= ' ORDER BY B.bModified ASC ';
|
||||
break;
|
||||
default:
|
||||
$query_5 .= ' ORDER BY B.' . $GLOBALS['dateOrderField'] . ' DESC ';
|
||||
}
|
||||
@ -888,13 +866,10 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
|
||||
// but private notes won't appear if not allowed.
|
||||
$query_4 .= ' OR B.bPrivateNote LIKE "'
|
||||
. $this->db->sql_escape($aTerms[$i])
|
||||
. '%"';
|
||||
.'%"';
|
||||
$query_4 .= ' OR U.username = "'
|
||||
. $this->db->sql_escape($aTerms[$i])
|
||||
. '"'; //exact match for username
|
||||
$query_4 .= ' OR B.bAddress LIKE "%'
|
||||
. $this->db->sql_escape($aTerms[$i])
|
||||
. '%"';
|
||||
if ($dotags) {
|
||||
$query_4 .= ' OR T.tag LIKE "'
|
||||
. $this->db->sql_escape($aTerms[$i])
|
||||
@ -917,20 +892,6 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
|
||||
$query_4 .= ' AND B.bHash = "'. $hash .'"';
|
||||
}
|
||||
|
||||
// Exclude bookmarks with shoulder surfing protected tags.
|
||||
if (! empty($GLOBALS['shoulderSurfingProtectedTag']) && $userservice->isLoggedOn() && ! isset($_COOKIE["noshoulderSurfingProtection"])) {
|
||||
$query_4 .= ' AND B.bId NOT IN (SELECT DISTINCT B0.bId FROM '.
|
||||
$this->getTableName() .' AS B0, ' . $userservice->getTableName()
|
||||
.' AS U, ' . $b2tservice->getTableName() .' AS T WHERE B0.uId = U.'
|
||||
. $userservice->getFieldName('primary') . $privacy .' AND B0.uId = '
|
||||
. $sId . ' AND (';
|
||||
$count_s = count($shoulderSurfingProtectedTags);
|
||||
for ($i = 0; $i < $count_s - 1; $i++) {
|
||||
$query_4 .= 'T.tag = "'. $shoulderSurfingProtectedTags[$i] .'" OR ';
|
||||
}
|
||||
$query_4 .= 'T.tag = "'. $shoulderSurfingProtectedTags[$count_s - 1] .'")'
|
||||
.' AND T.bId = B0.bId)';
|
||||
}
|
||||
|
||||
$query = $query_1 . $query_2 . $query_3 . $query_4 . $query_5;
|
||||
|
||||
@ -943,10 +904,10 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
|
||||
'', __LINE__, __FILE__, $query, $this->db
|
||||
);
|
||||
}
|
||||
// Disabled because breaks when in debug mode…
|
||||
//if (SQL_LAYER == 'mysql4') {
|
||||
// $totalquery = 'SELECT FOUND_ROWS() AS total';
|
||||
//} else {
|
||||
|
||||
if (SQL_LAYER == 'mysql4') {
|
||||
$totalquery = 'SELECT FOUND_ROWS() AS total';
|
||||
} else {
|
||||
if ($hash) {
|
||||
$totalquery = 'SELECT COUNT(*) AS total'. $query_2
|
||||
. $query_3 . $query_4;
|
||||
@ -954,7 +915,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
|
||||
$totalquery = 'SELECT COUNT(DISTINCT bAddress) AS total'
|
||||
. $query_2 . $query_3 . $query_4;
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
if (!($totalresult = $this->db->sql_query($totalquery))
|
||||
|| (!($row = $this->db->sql_fetchrow($totalresult)))
|
||||
|
@ -92,16 +92,17 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
||||
}
|
||||
}
|
||||
|
||||
$tagservice = SemanticScuttle_Service_Factory::get('Tag');
|
||||
$tagservice =SemanticScuttle_Service_Factory::get('Tag');
|
||||
$tags = $tagservice->normalize($tags);
|
||||
|
||||
|
||||
$tags_count = is_array($tags)?count($tags):0;
|
||||
if (is_array($tags)) {
|
||||
foreach ($tags as $i => $tag) {
|
||||
$tags[$i] = trim(utf8_strtolower($tags[$i]));
|
||||
if ($fromApi) {
|
||||
$tags[$i] = convertTag($tags[$i], 'in');
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $tags_count; $i++) {
|
||||
$tags[$i] = trim(utf8_strtolower($tags[$i]));
|
||||
if ($fromApi) {
|
||||
include_once 'SemanticScuttle/functions.php';
|
||||
$tags[$i] = convertTag($tags[$i], 'in');
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,7 +150,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
||||
foreach ($tags as $key => $tag) {
|
||||
if (strpos($tag, '=')) {
|
||||
// case "="
|
||||
$pieces = $tagservice->normalize(explode('=', $tag));
|
||||
$pieces = explode('=', $tag);
|
||||
$nbPieces = count($pieces);
|
||||
if ($nbPieces <= 1) {
|
||||
continue;
|
||||
@ -163,7 +164,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
||||
$tags[$key] = $pieces[0];
|
||||
} else {
|
||||
// case ">"
|
||||
$pieces = $tagservice->normalize(explode('>', $tag));
|
||||
$pieces = explode('>', $tag);
|
||||
$nbPieces = count($pieces);
|
||||
if ($nbPieces <= 1) {
|
||||
continue;
|
||||
@ -199,7 +200,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
||||
|
||||
$sql = 'INSERT INTO '. $this->getTableName()
|
||||
. ' ' . $this->db->sql_build_array('INSERT', $values);
|
||||
if (!($dbresult = $this->db->sql_query($sql))) {
|
||||
if (!($dbresult =& $this->db->sql_query($sql))) {
|
||||
$this->db->sql_transaction('rollback');
|
||||
message_die(
|
||||
GENERAL_ERROR, 'Could not attach tags',
|
||||
@ -221,7 +222,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
||||
$query.= ' AND '. $bs->getTableName() .'.uId = '. $uId;
|
||||
$query.= ' AND '. $this->getTableName() .'.tag = "'. $this->db->sql_escape($tag) .'"';
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult =& $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not delete tags', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -237,7 +238,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
||||
|
||||
$query = 'DELETE FROM '. $this->getTableName() .' WHERE bId = '. intval($bookmarkid);
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult =& $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not delete tags', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -257,7 +258,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
||||
$GLOBALS['tableprefix'].'bookmarks',
|
||||
$uId);
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult =& $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not delete tags', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -353,7 +354,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
||||
|
||||
|
||||
function &getTags($userid = NULL) {
|
||||
$userservice = SemanticScuttle_Service_Factory::get('User');
|
||||
$userservice =SemanticScuttle_Service_Factory::get('User');
|
||||
$logged_on_user = $userservice->getCurrentUserId();
|
||||
|
||||
$query = 'SELECT T.tag, COUNT(B.bId) AS bCount FROM '. $GLOBALS['tableprefix'] .'bookmarks AS B INNER JOIN '. $userservice->getTableName() .' AS U ON B.uId = U.'. $userservice->getFieldName('primary') .' INNER JOIN '. $GLOBALS['tableprefix'] .'bookmarks2tags AS T ON B.bId = T.bId';
|
||||
@ -366,41 +367,19 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
||||
} else {
|
||||
$conditions['B.bStatus'] = 0;
|
||||
}
|
||||
|
||||
$query .= ' WHERE '. $this->db->sql_build_array('SELECT', $conditions) .' AND LEFT(T.tag, 7) <> "system:" GROUP BY T.tag ORDER BY bCount DESC, tag';
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult =& $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not get tags', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
|
||||
$output = $this->db->sql_fetchrowset($dbresult);
|
||||
|
||||
$this->db->sql_freeresult($dbresult);
|
||||
return $this->filterShoulderSurfingProtectedTags($output);
|
||||
return $output;
|
||||
}
|
||||
|
||||
function &filterShoulderSurfingProtectedTags($dboutput) {
|
||||
$userservice = SemanticScuttle_Service_Factory::get('User');
|
||||
if (! empty($GLOBALS['shoulderSurfingProtectedTag']) && $userservice->isLoggedOn() && ! isset($_COOKIE["noshoulderSurfingProtection"])) {
|
||||
$logged_on_user = $userservice->getCurrentUserId();
|
||||
$ttt = SemanticScuttle_Service_Factory::get('Tag2Tag');
|
||||
$shoulderSurfingProtectedTags = $ttt->getAllLinkedTags($GLOBALS['shoulderSurfingProtectedTag'], '>', $logged_on_user, array());
|
||||
$shoulderSurfingProtectedTags[] = $GLOBALS['shoulderSurfingProtectedTag'];
|
||||
$output = array();
|
||||
foreach ($dboutput as $array) {
|
||||
$flag = 1;
|
||||
foreach ($shoulderSurfingProtectedTags as $tag) {
|
||||
if ($array['tag'] === $tag) {
|
||||
$flag = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($flag) {$output[] = $array;}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
else {return $dboutput;}
|
||||
}
|
||||
|
||||
// Returns the tags related to the specified tags; i.e. attached to the same bookmarks
|
||||
function &getRelatedTags($tags, $for_user = NULL, $logged_on_user = NULL, $limit = 10) {
|
||||
@ -439,13 +418,13 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
||||
$query_5 = ' AND LEFT(T0.tag, 7) <> "system:" GROUP BY T0.tag ORDER BY bCount DESC, T0.tag';
|
||||
$query = $query_1 . $query_2 . $query_3 . $query_4 . $query_5;
|
||||
|
||||
if (! ($dbresult = $this->db->sql_query_limit($query, $limit)) ){
|
||||
if (! ($dbresult =& $this->db->sql_query_limit($query, $limit)) ){
|
||||
message_die(GENERAL_ERROR, 'Could not get related tags', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
$output = $this->db->sql_fetchrowset($dbresult);
|
||||
$this->db->sql_freeresult($dbresult);
|
||||
return $this->filterShoulderSurfingProtectedTags($output);
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Returns the most popular tags used for a particular bookmark hash
|
||||
@ -469,13 +448,13 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
||||
|
||||
$query = 'SELECT T.tag, COUNT(T.tag) AS bCount FROM '.$GLOBALS['tableprefix'].'bookmarks AS B LEFT JOIN '.$GLOBALS['tableprefix'].'bookmarks2tags AS T ON B.bId = T.bId WHERE B.bHash = \''. $this->db->sql_escape($hash) .'\' '. $privacy .'AND LEFT(T.tag, 7) <> "system:" GROUP BY T.tag ORDER BY bCount DESC';
|
||||
|
||||
if (!($dbresult = $this->db->sql_query_limit($query, $limit))) {
|
||||
if (!($dbresult =& $this->db->sql_query_limit($query, $limit))) {
|
||||
message_die(GENERAL_ERROR, 'Could not get related tags for this hash', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
$output = $this->db->sql_fetchrowset($dbresult);
|
||||
$this->db->sql_freeresult($dbresult);
|
||||
return $this->filterShoulderSurfingProtectedTags($output);
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
@ -635,7 +614,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
||||
|
||||
$output = $this->db->sql_fetchrowset($dbresult);
|
||||
$this->db->sql_freeresult($dbresult);
|
||||
return $this->filterShoulderSurfingProtectedTags($output);
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
@ -643,18 +622,17 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
||||
function hasTag($bookmarkid, $tag) {
|
||||
$query = 'SELECT COUNT(*) AS tCount FROM '. $this->getTableName() .' WHERE bId = '. intval($bookmarkid) .' AND tag ="'. $this->db->sql_escape($tag) .'"';
|
||||
|
||||
if (! ($dbresult = $this->db->sql_query($query)) ) {
|
||||
if (! ($dbresult =& $this->db->sql_query($query)) ) {
|
||||
message_die(GENERAL_ERROR, 'Could not find tag', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
|
||||
$output = false;
|
||||
if ($row = $this->db->sql_fetchrow($dbresult)) {
|
||||
if ($row =& $this->db->sql_fetchrow($dbresult)) {
|
||||
if ($row['tCount'] > 0) {
|
||||
$output = true;
|
||||
}
|
||||
}
|
||||
|
||||
$output = false;
|
||||
$this->db->sql_freeresult($dbresult);
|
||||
return $output;
|
||||
}
|
||||
@ -667,8 +645,8 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
||||
return false;
|
||||
|
||||
// Find bookmarks with old tag
|
||||
$bookmarksInfo = $bookmarkservice->getBookmarks(0, NULL, $userid, $old);
|
||||
$bookmarks = $bookmarksInfo['bookmarks'];
|
||||
$bookmarksInfo =& $bookmarkservice->getBookmarks(0, NULL, $userid, $old);
|
||||
$bookmarks =& $bookmarksInfo['bookmarks'];
|
||||
|
||||
// Delete old tag
|
||||
$this->deleteTag($userid, $old);
|
||||
@ -676,8 +654,8 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
||||
// Attach new tags
|
||||
$new = $tagservice->normalize($new);
|
||||
|
||||
foreach (array_keys($bookmarks) as $key) {
|
||||
$row = $bookmarks[$key];
|
||||
foreach(array_keys($bookmarks) as $key) {
|
||||
$row =& $bookmarks[$key];
|
||||
$this->attachTags($row['bId'], $new, $fromApi, NULL, false);
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
|
||||
$values = array('tag'=>$tag, 'cdDescription'=>$desc, 'uId'=>$uId, 'cdDatetime'=>$datetime);
|
||||
$sql = 'INSERT INTO '. $this->getTableName() .' '. $this->db->sql_build_array('INSERT', $values);
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($sql))) {
|
||||
if (!($dbresult =& $this->db->sql_query($sql))) {
|
||||
$this->db->sql_transaction('rollback');
|
||||
message_die(GENERAL_ERROR, 'Could not add tag description', '', __LINE__, __FILE__, $sql, $this->db);
|
||||
return false;
|
||||
@ -79,7 +79,7 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
|
||||
$query.= ' WHERE tag=\'' . $this->db->sql_escape($tag) . "'";
|
||||
$query.= " ORDER BY cdDatetime DESC";
|
||||
|
||||
if (!($dbresult = $this->db->sql_query_limit($query, 1, 0))) {
|
||||
if (!($dbresult = & $this->db->sql_query_limit($query, 1, 0))) {
|
||||
message_die(GENERAL_ERROR, 'Could not get tag description', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -99,7 +99,7 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
|
||||
$query.= ' WHERE tag=\'' . $this->db->sql_escape($tag) . "'";
|
||||
$query.= " ORDER BY cdDatetime DESC";
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult = & $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not get tag descriptions', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -114,12 +114,12 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
|
||||
$query.= " FROM `". $this->getTableName() ."`";
|
||||
$query.= ' WHERE cdId=\'' . $this->db->sql_escape($cdId) . "'";
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult = & $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not get tag descriptions', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($row = $this->db->sql_fetchrow($dbresult)) {
|
||||
if ($row =& $this->db->sql_fetchrow($dbresult)) {
|
||||
$this->db->sql_freeresult($dbresult);
|
||||
return $row;
|
||||
} else {
|
||||
@ -140,7 +140,7 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
|
||||
$values = array('bHash'=>$bHash, 'cdTitle'=>$title, 'cdDescription'=>$desc, 'uId'=>$uId, 'cdDatetime'=>$datetime);
|
||||
$sql = 'INSERT INTO '. $this->getTableName() .' '. $this->db->sql_build_array('INSERT', $values);
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($sql))) {
|
||||
if (!($dbresult =& $this->db->sql_query($sql))) {
|
||||
$this->db->sql_transaction('rollback');
|
||||
message_die(GENERAL_ERROR, 'Could not add bookmark description', '', __LINE__, __FILE__, $sql, $this->db);
|
||||
return false;
|
||||
@ -154,7 +154,7 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
|
||||
$query.= ' WHERE bHash=\'' . $this->db->sql_escape($bHash) . "'";
|
||||
$query.= " ORDER BY cdDatetime DESC";
|
||||
|
||||
if (!($dbresult = $this->db->sql_query_limit($query, 1, 0))) {
|
||||
if (!($dbresult = & $this->db->sql_query_limit($query, 1, 0))) {
|
||||
message_die(GENERAL_ERROR, 'Could not get bookmark description', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -174,7 +174,7 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
|
||||
$query.= ' WHERE bHash=\'' . $this->db->sql_escape($bHash) . "'";
|
||||
$query.= " ORDER BY cdDatetime DESC";
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult = & $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not get bookmark descriptions', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -188,7 +188,7 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
|
||||
$query = 'DELETE FROM '. $this->getTableName() . ' WHERE uId = '. intval($uId);
|
||||
|
||||
$this->db->sql_transaction('begin');
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult = & $this->db->sql_query($query))) {
|
||||
$this->db->sql_transaction('rollback');
|
||||
message_die(GENERAL_ERROR, 'Could not delete user descriptions', '',
|
||||
__LINE__, __FILE__, $query, $this->db);
|
||||
|
@ -151,10 +151,6 @@ class SemanticScuttle_Service_SearchHistory extends SemanticScuttle_DbService
|
||||
$range = null, $uId = null, $nb = null,
|
||||
$start = null, $distinct = false, $withResults = false
|
||||
) {
|
||||
$userservice = SemanticScuttle_Service_Factory::get('User');
|
||||
if ($userservice->isLoggedOn() && ! isset($_COOKIE["noshoulderSurfingProtection"])) {
|
||||
return array();
|
||||
}
|
||||
$sql = 'SELECT DISTINCT(shTerms),'
|
||||
. ' shId, shRange, shNbResults, shDatetime, uId';
|
||||
$sql.= ' FROM '. $this->getTableName();
|
||||
@ -202,7 +198,7 @@ class SemanticScuttle_Service_SearchHistory extends SemanticScuttle_DbService
|
||||
{
|
||||
$sql = 'SELECT COUNT(*) AS `total` FROM '. $this->getTableName();
|
||||
if (!($dbresult = $this->db->sql_query($sql))
|
||||
|| (!($row = $this->db->sql_fetchrow($dbresult)))
|
||||
|| (!($row = & $this->db->sql_fetchrow($dbresult)))
|
||||
) {
|
||||
message_die(
|
||||
GENERAL_ERROR, 'Could not get total searches',
|
||||
|
@ -54,7 +54,7 @@ class SemanticScuttle_Service_Tag extends SemanticScuttle_DbService
|
||||
$query.= ' WHERE tag = \''. $this->db->sql_escape($tag) . "'";
|
||||
$query.= ' AND uId = ' . intval($uId);
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult = & $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not get tag description', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -74,7 +74,7 @@ class SemanticScuttle_Service_Tag extends SemanticScuttle_DbService
|
||||
$query.= ' WHERE tag = \'' . $this->db->sql_escape($tag) . "'";
|
||||
$query.= ' AND uId = "' . intval($uId) . '"';
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult = & $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not get tag description', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -93,7 +93,7 @@ class SemanticScuttle_Service_Tag extends SemanticScuttle_DbService
|
||||
$query.= ' FROM '.$this->getTableName();
|
||||
$query.= ' WHERE tag = \''. $this->db->sql_escape($tag) . "'";
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult = & $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not get tag description', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -114,7 +114,7 @@ class SemanticScuttle_Service_Tag extends SemanticScuttle_DbService
|
||||
}
|
||||
|
||||
$this->db->sql_transaction('begin');
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult = & $this->db->sql_query($query))) {
|
||||
$this->db->sql_transaction('rollback');
|
||||
message_die(GENERAL_ERROR, 'Could not delete bookmarks', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
@ -144,7 +144,7 @@ class SemanticScuttle_Service_Tag extends SemanticScuttle_DbService
|
||||
$tags = utf8_strtolower(trim($tags));
|
||||
} else {
|
||||
$tags = array_filter($tags);//remove empty values
|
||||
foreach($tags as $i => $tag) {
|
||||
for($i=0; $i<count($tags); $i++) {
|
||||
$tags[$i] = utf8_strtolower(trim($tags[$i]));
|
||||
}
|
||||
}
|
||||
|
@ -43,9 +43,9 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService
|
||||
}
|
||||
|
||||
|
||||
function __construct($db)
|
||||
function __construct(&$db)
|
||||
{
|
||||
$this->db =$db;
|
||||
$this->db =& $db;
|
||||
$this->tablename = $GLOBALS['tableprefix'] .'tags2tags';
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService
|
||||
$query.= " AND uId = '".intval($uId)."'";
|
||||
}
|
||||
//die($query);
|
||||
if (! ($dbresult = $this->db->sql_query($query)) ){
|
||||
if (! ($dbresult =& $this->db->sql_query($query)) ){
|
||||
message_die(GENERAL_ERROR, 'Could not get related tags', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -312,14 +312,13 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService
|
||||
$query.= " LIMIT 0," . intval($limit);
|
||||
}
|
||||
|
||||
if (! ($dbresult = $this->db->sql_query($query)) ){
|
||||
if (! ($dbresult =& $this->db->sql_query($query)) ){
|
||||
message_die(GENERAL_ERROR, 'Could not get linked tags', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
$output = $this->db->sql_fetchrowset($dbresult);
|
||||
$this->db->sql_freeresult($dbresult);
|
||||
$btt = SemanticScuttle_Service_Factory::get('Bookmark2Tag');
|
||||
return $btt->filterShoulderSurfingProtectedTags($output);
|
||||
return $output;
|
||||
}
|
||||
|
||||
function getMenuTags($uId) {
|
||||
@ -338,7 +337,7 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService
|
||||
$query.= " ORDER BY count DESC";
|
||||
$query.= " LIMIT 0, " . intval($GLOBALS['maxSizeMenuBlock']);
|
||||
|
||||
if (! ($dbresult = $this->db->sql_query($query)) ){
|
||||
if (! ($dbresult =& $this->db->sql_query($query)) ){
|
||||
message_die(GENERAL_ERROR, 'Could not get linked tags', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -378,25 +377,6 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService
|
||||
$dbres = $this->db->sql_query($query);
|
||||
$rowset = $this->db->sql_fetchrowset($dbres);
|
||||
$this->db->sql_freeresult($dbres);
|
||||
|
||||
$userservice = SemanticScuttle_Service_Factory::get('User');
|
||||
if (count($rowset)>0 && ! empty($GLOBALS['shoulderSurfingProtectedTag']) && $userservice->isLoggedOn() && ! isset($_COOKIE["noshoulderSurfingProtection"])) {
|
||||
$logged_on_user = $userservice->getCurrentUserId();
|
||||
$shoulderSurfingProtectedTags = $this->getAllLinkedTags($GLOBALS['shoulderSurfingProtectedTag'], '>', $logged_on_user, array());
|
||||
$shoulderSurfingProtectedTags[] = $GLOBALS['shoulderSurfingProtectedTag'];
|
||||
$output = array();
|
||||
foreach($rowset as $link) {
|
||||
$flag = 1;
|
||||
foreach ($shoulderSurfingProtectedTags as $tag) {
|
||||
if ($link['tag1'] === $tag || $link['tag2'] === $tag) {
|
||||
$flag = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($flag) {$output[] = $link;}
|
||||
}
|
||||
$rowset = $output;
|
||||
}
|
||||
return $rowset;
|
||||
}
|
||||
|
||||
@ -413,7 +393,7 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService
|
||||
$query.= strlen($relationType)>0 ? ' AND relationType = \''. $this->db->sql_escape($relationType) . "'" : '';
|
||||
$query.= strlen($uId)>0 ? ' AND uId = '. intval($uId) : '';
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult =& $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not remove tag relation', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -430,7 +410,7 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService
|
||||
$query = 'DELETE FROM '. $this->getTableName();
|
||||
$query.= ' WHERE uId = '. intval($uId);
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult =& $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not remove tag relation', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
|
||||
$query.= " AND uId = " . intval($uId);
|
||||
|
||||
//die($query);
|
||||
if (! ($dbresult = $this->db->sql_query($query)) ){
|
||||
if (! ($dbresult =& $this->db->sql_query($query)) ){
|
||||
message_die(GENERAL_ERROR, 'Could not get related tags', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -101,7 +101,7 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
|
||||
$values = array('tag1' => $tag1, 'tag2' => $tag2, 'relationType'=> '>', 'uId'=> $uId);
|
||||
$query = 'INSERT INTO '. $this->getTableName() .' '. $this->db->sql_build_array('INSERT', $values);
|
||||
//die($query);
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult =& $this->db->sql_query($query))) {
|
||||
$this->db->sql_transaction('rollback');
|
||||
message_die(GENERAL_ERROR, 'Could not add tag cache inference', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
@ -122,7 +122,7 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
|
||||
$query.= ' AND relationType = ">"';
|
||||
$query.= strlen($uId)>0 ? ' AND uId = ' . intval($uId) : '';
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult =& $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not remove tag cache inference', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -183,7 +183,7 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
|
||||
$values = $this->_getSynonymValues($tag2, $uId);
|
||||
$this->removeSynonymGroup($tag2, $uId);
|
||||
foreach($values as $value) {
|
||||
$this->addSynonym($tag1, $value, $uId);
|
||||
$this->addSynonym($tag1, $value['tag'], $uId);
|
||||
}
|
||||
$this->addSynonym($tag1, $tag2, $uId);
|
||||
break;
|
||||
@ -215,7 +215,7 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
|
||||
$values = array('tag1' => $tag1, 'tag2' => $tag2, 'relationType'=> '=', 'uId'=> $uId);
|
||||
$query = 'INSERT INTO '. $this->getTableName() .' '. $this->db->sql_build_array('INSERT', $values);
|
||||
//die($query);
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult =& $this->db->sql_query($query))) {
|
||||
$this->db->sql_transaction('rollback');
|
||||
message_die(GENERAL_ERROR, 'Could not add tag cache synonymy', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
@ -232,7 +232,7 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
|
||||
$query.= ' AND relationType = "="';
|
||||
$query.= ' AND uId = ' . intval($uId);
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult =& $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not remove tag cache inference', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -295,7 +295,7 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
|
||||
$query.= " AND uId = " . intval($uId);
|
||||
|
||||
//die($query);
|
||||
if (! ($dbresult = $this->db->sql_query($query)) ){
|
||||
if (! ($dbresult =& $this->db->sql_query($query)) ){
|
||||
message_die(GENERAL_ERROR, 'Could not get related tags', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -308,11 +308,8 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
|
||||
/*
|
||||
* Return values associated with a key.
|
||||
* $tagExcepted allows to hide a value.
|
||||
*
|
||||
* @return array Array with tag names
|
||||
*/
|
||||
protected function _getSynonymValues($tag1, $uId, $tagExcepted = NULL)
|
||||
{
|
||||
function _getSynonymValues($tag1, $uId, $tagExcepted = NULL) {
|
||||
$tagservice =SemanticScuttle_Service_Factory::get('Tag');
|
||||
$tag1 = $tagservice->normalize($tag1);
|
||||
$tagExcepted = $tagservice->normalize($tagExcepted);
|
||||
@ -320,19 +317,14 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
|
||||
if($tag1 == '') return false;
|
||||
|
||||
$query = "SELECT DISTINCT tag2 as 'tag'";
|
||||
$query .= " FROM `". $this->getTableName() ."`";
|
||||
$query .= " WHERE relationType = '='";
|
||||
$query .= " AND tag1 = '" . $this->db->sql_escape($tag1) . "'";
|
||||
$query .= " AND uId = " . intval($uId);
|
||||
$query .= $tagExcepted != ''
|
||||
? " AND tag2!='" . $this->db->sql_escape($tagExcepted) . "'"
|
||||
: '';
|
||||
$query.= " FROM `". $this->getTableName() ."`";
|
||||
$query.= " WHERE relationType = '='";
|
||||
$query.= " AND tag1 = '" . $this->db->sql_escape($tag1) . "'";
|
||||
$query.= " AND uId = " . intval($uId);
|
||||
$query.= $tagExcepted!=''?" AND tag2!='" . $this->db->sql_escape($tagExcepted) . "'" : '';
|
||||
|
||||
if (! ($dbresult = $this->db->sql_query($query)) ){
|
||||
message_die(
|
||||
GENERAL_ERROR, 'Could not get related tags',
|
||||
'', __LINE__, __FILE__, $query, $this->db
|
||||
);
|
||||
if (! ($dbresult =& $this->db->sql_query($query)) ){
|
||||
message_die(GENERAL_ERROR, 'Could not get related tags', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -379,7 +371,7 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
|
||||
function deleteByUser($uId) {
|
||||
$query = 'DELETE FROM '. $this->getTableName() .' WHERE uId = '. intval($uId);
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult = & $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not delete user tags cache', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ class SemanticScuttle_Service_TagStat extends SemanticScuttle_DbService
|
||||
$query.= " AND relationType = '". $relationType ."'";
|
||||
$query.= " AND uId = '".$uId."'";
|
||||
|
||||
$dbresults = $this->db->sql_query($query);
|
||||
$dbresults =& $this->db->sql_query($query);
|
||||
$row = $this->db->sql_fetchrow($dbresults);
|
||||
$this->db->sql_freeresult($dbresults);
|
||||
if($row['nb'] == null) {
|
||||
@ -83,7 +83,7 @@ class SemanticScuttle_Service_TagStat extends SemanticScuttle_DbService
|
||||
$query.= " AND relationType = '". $relationType ."'";
|
||||
$query.= " AND uId = '".$uId."'";
|
||||
|
||||
$dbresults = $this->db->sql_query($query);
|
||||
$dbresults =& $this->db->sql_query($query);
|
||||
$row = $this->db->sql_fetchrow($dbresults);
|
||||
$this->db->sql_freeresult($dbresults);
|
||||
if($row['depth'] == null) {
|
||||
@ -99,7 +99,7 @@ class SemanticScuttle_Service_TagStat extends SemanticScuttle_DbService
|
||||
$query.= " AND relationType = '". $relationType ."'";
|
||||
$query.= " AND uId = '".$uId."'";
|
||||
|
||||
$dbresults = $this->db->sql_query($query);
|
||||
$dbresults =& $this->db->sql_query($query);
|
||||
$row = $this->db->sql_fetchrow($dbresults);
|
||||
$this->db->sql_freeresult($dbresults);
|
||||
if($row['nbupdate'] == null) {
|
||||
@ -161,7 +161,7 @@ class SemanticScuttle_Service_TagStat extends SemanticScuttle_DbService
|
||||
|
||||
//die($query);
|
||||
|
||||
if (! ($dbresult = $this->db->sql_query($query)) ){
|
||||
if (! ($dbresult =& $this->db->sql_query($query)) ){
|
||||
message_die(GENERAL_ERROR, 'Could not update stats', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -215,7 +215,7 @@ class SemanticScuttle_Service_TagStat extends SemanticScuttle_DbService
|
||||
function deleteTagStatForUser($uId) {
|
||||
$query = 'DELETE FROM '. $this->getTableName() .' WHERE uId = '. intval($uId);
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult = & $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not delete tag stats', '', __LINE__,
|
||||
__FILE__, $query, $this->db);
|
||||
return false;
|
||||
|
@ -1,59 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* SemanticScuttle - your social bookmark manager.
|
||||
*
|
||||
* PHP version 5.
|
||||
*
|
||||
* @category Bookmarking
|
||||
* @package SemanticScuttle
|
||||
* @author Christian Weiske <cweiske@cweiske.de>
|
||||
* @license GPL http://www.gnu.org/licenses/gpl.html
|
||||
* @link http://sourceforge.net/projects/semanticscuttle
|
||||
*/
|
||||
|
||||
/**
|
||||
* Instantiates the configured website thumbnailer object.
|
||||
*
|
||||
* @category Bookmarking
|
||||
* @package SemanticScuttle
|
||||
* @author Christian Weiske <cweiske@cweiske.de>
|
||||
* @license GPL http://www.gnu.org/licenses/gpl.html
|
||||
* @link http://sourceforge.net/projects/semanticscuttle
|
||||
*/
|
||||
class SemanticScuttle_Service_Thumbnails extends SemanticScuttle_Service
|
||||
{
|
||||
/**
|
||||
* Instantiates the configured website thumbnailer object.
|
||||
*
|
||||
* @return object Website thumbnailer
|
||||
*/
|
||||
public function getThumbnailer()
|
||||
{
|
||||
if (!isset($GLOBALS['thumbnailsType'])
|
||||
|| $GLOBALS['thumbnailsType'] == ''
|
||||
) {
|
||||
$class = 'SemanticScuttle_Thumbnailer_Null';
|
||||
} else {
|
||||
$class = 'SemanticScuttle_Thumbnailer_'
|
||||
. ucfirst($GLOBALS['thumbnailsType']);
|
||||
}
|
||||
if (!class_exists($class)) {
|
||||
//PEAR classname to filename rule
|
||||
$file = str_replace('_', '/', $class) . '.php';
|
||||
include_once $file;
|
||||
}
|
||||
|
||||
$thumbnailer = new $class();
|
||||
|
||||
if (!isset($GLOBALS['thumbnailsConfig'])
|
||||
|| $GLOBALS['thumbnailsConfig'] == ''
|
||||
) {
|
||||
$thumbnailer->setConfig(null);
|
||||
} else {
|
||||
$thumbnailer->setConfig($GLOBALS['thumbnailsConfig']);
|
||||
}
|
||||
|
||||
return $thumbnailer;
|
||||
}
|
||||
}
|
||||
?>
|
@ -120,12 +120,12 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
|
||||
if($nb>0) {
|
||||
$query .= ' LIMIT 0, '.$nb;
|
||||
}
|
||||
if (! ($dbresult = $this->db->sql_query($query)) ) {
|
||||
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)) {
|
||||
while ($row = & $this->db->sql_fetchrow($dbresult)) {
|
||||
$users[] = $row;
|
||||
}
|
||||
$this->db->sql_freeresult($dbresult);
|
||||
@ -149,7 +149,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
|
||||
$query .= ' LIMIT 0, ' . intval($nb);
|
||||
}
|
||||
|
||||
if (! ($dbresult = $this->db->sql_query($query)) ) {
|
||||
if (! ($dbresult =& $this->db->sql_query($query)) ) {
|
||||
message_die(
|
||||
GENERAL_ERROR, 'Could not get user',
|
||||
'', __LINE__, __FILE__, $query, $this->db
|
||||
@ -158,7 +158,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
|
||||
}
|
||||
|
||||
$users = array();
|
||||
while ($row = $this->db->sql_fetchrow($dbresult)) {
|
||||
while ($row = & $this->db->sql_fetchrow($dbresult)) {
|
||||
$users[] = new SemanticScuttle_Model_User(
|
||||
$row[$this->getFieldName('primary')],
|
||||
$row[$this->getFieldName('username')]
|
||||
@ -434,7 +434,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
|
||||
')) = \''.$this->db->sql_escape($cook[1]).'\' AND '.
|
||||
$this->getFieldName('primary'). ' = '. $this->db->sql_escape($cook[0]);
|
||||
|
||||
if (! ($dbresult = $this->db->sql_query($query)) ) {
|
||||
if (! ($dbresult =& $this->db->sql_query($query)) ) {
|
||||
message_die(
|
||||
GENERAL_ERROR, 'Could not get user',
|
||||
'', __LINE__, __FILE__, $query, $this->db
|
||||
@ -596,7 +596,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
|
||||
// Gets the list of user IDs being watched by the given user.
|
||||
$query = 'SELECT watched FROM '. $GLOBALS['tableprefix'] .'watched WHERE uId = '. intval($uId);
|
||||
|
||||
if (! ($dbresult = $this->db->sql_query($query)) ) {
|
||||
if (! ($dbresult =& $this->db->sql_query($query)) ) {
|
||||
message_die(GENERAL_ERROR, 'Could not get watchlist', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -606,7 +606,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
|
||||
$this->db->sql_freeresult($dbresult);
|
||||
return $arrWatch;
|
||||
}
|
||||
while ($row = $this->db->sql_fetchrow($dbresult)) {
|
||||
while ($row =& $this->db->sql_fetchrow($dbresult)) {
|
||||
$arrWatch[] = $row['watched'];
|
||||
}
|
||||
$this->db->sql_freeresult($dbresult);
|
||||
@ -668,7 +668,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
|
||||
// Returns true if the current user is watching the given user, and false otherwise.
|
||||
$query = 'SELECT watched FROM '. $GLOBALS['tableprefix'] .'watched AS W INNER JOIN '. $this->getTableName() .' AS U ON U.'. $this->getFieldName('primary') .' = W.watched WHERE U.'. $this->getFieldName('primary') .' = '. intval($watcheduser) .' AND W.uId = '. intval($currentuser);
|
||||
|
||||
if (! ($dbresult = $this->db->sql_query($query)) ) {
|
||||
if (! ($dbresult =& $this->db->sql_query($query)) ) {
|
||||
message_die(GENERAL_ERROR, 'Could not get watchstatus', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -690,7 +690,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
|
||||
|
||||
if ($watched) {
|
||||
$sql = 'DELETE FROM '. $GLOBALS['tableprefix'] .'watched WHERE uId = '. intval($currentUserID) .' AND watched = '. intval($subjectUserID);
|
||||
if (!($dbresult = $this->db->sql_query($sql))) {
|
||||
if (!($dbresult =& $this->db->sql_query($sql))) {
|
||||
$this->db->sql_transaction('rollback');
|
||||
message_die(GENERAL_ERROR, 'Could not add user to watch list', '', __LINE__, __FILE__, $sql, $this->db);
|
||||
return false;
|
||||
@ -701,7 +701,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
|
||||
'watched' => intval($subjectUserID)
|
||||
);
|
||||
$sql = 'INSERT INTO '. $GLOBALS['tableprefix'] .'watched '. $this->db->sql_build_array('INSERT', $values);
|
||||
if (!($dbresult = $this->db->sql_query($sql))) {
|
||||
if (!($dbresult =& $this->db->sql_query($sql))) {
|
||||
$this->db->sql_transaction('rollback');
|
||||
message_die(GENERAL_ERROR, 'Could not add user to watch list', '', __LINE__, __FILE__, $sql, $this->db);
|
||||
return false;
|
||||
@ -743,7 +743,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
|
||||
|
||||
// Execute the statement.
|
||||
$this->db->sql_transaction('begin');
|
||||
if (!($dbresult = $this->db->sql_query($sql))) {
|
||||
if (!($dbresult = & $this->db->sql_query($sql))) {
|
||||
$this->db->sql_transaction('rollback');
|
||||
message_die(
|
||||
GENERAL_ERROR, 'Could not insert user',
|
||||
@ -826,7 +826,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
|
||||
|
||||
// Execute the statement.
|
||||
$this->db->sql_transaction('begin');
|
||||
if (!($dbresult = $this->db->sql_query($sql))) {
|
||||
if (!($dbresult = & $this->db->sql_query($sql))) {
|
||||
$this->db->sql_transaction('rollback');
|
||||
message_die(
|
||||
GENERAL_ERROR, 'Could not update user', '',
|
||||
@ -845,7 +845,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
|
||||
function getAllUsers ( ) {
|
||||
$query = 'SELECT * FROM '. $this->getTableName();
|
||||
|
||||
if (! ($dbresult = $this->db->sql_query($query)) ) {
|
||||
if (! ($dbresult =& $this->db->sql_query($query)) ) {
|
||||
message_die(GENERAL_ERROR, 'Could not get users', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
@ -872,7 +872,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
|
||||
function deleteUser($uId) {
|
||||
$query = 'DELETE FROM '. $this->getTableName() .' WHERE uId = '. intval($uId);
|
||||
|
||||
if (!($dbresult = $this->db->sql_query($query))) {
|
||||
if (!($dbresult = & $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not delete user', '', __LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
|
@ -1,52 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* SemanticScuttle - your social bookmark manager.
|
||||
*
|
||||
* PHP version 5.
|
||||
*
|
||||
* @category Bookmarking
|
||||
* @package SemanticScuttle
|
||||
* @author Christian Weiske <cweiske@cweiske.de>
|
||||
* @license GPL http://www.gnu.org/licenses/gpl.html
|
||||
* @link http://sourceforge.net/projects/semanticscuttle
|
||||
*/
|
||||
|
||||
/**
|
||||
* Dummy thumbnailer that never returns a thumbnail URL
|
||||
*
|
||||
* @category Bookmarking
|
||||
* @package SemanticScuttle
|
||||
* @author Christian Weiske <cweiske@cweiske.de>
|
||||
* @license GPL http://www.gnu.org/licenses/gpl.html
|
||||
* @link http://sourceforge.net/projects/semanticscuttle
|
||||
*/
|
||||
class SemanticScuttle_Thumbnailer_Null
|
||||
{
|
||||
/**
|
||||
* Set dummy configuration
|
||||
*
|
||||
* @param array $config Dummy configuration
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setConfig($config)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URL for a website thumbnail.
|
||||
* Always returns false.
|
||||
*
|
||||
* @param string $bookmarkUrl URL of website to create thumbnail for
|
||||
* @param integer $width Screenshot width
|
||||
* @param integer $height Screenshot height
|
||||
*
|
||||
* @return mixed FALSE when no screenshot could be obtained,
|
||||
* string with the URL otherwise
|
||||
*/
|
||||
public function getThumbnailUrl($bookmarkUrl, $width, $height)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,92 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* SemanticScuttle - your social bookmark manager.
|
||||
*
|
||||
* PHP version 5.
|
||||
*
|
||||
* @category Bookmarking
|
||||
* @package SemanticScuttle
|
||||
* @author Christian Weiske <cweiske@cweiske.de>
|
||||
* @license GPL http://www.gnu.org/licenses/gpl.html
|
||||
* @link http://sourceforge.net/projects/semanticscuttle
|
||||
*/
|
||||
|
||||
/**
|
||||
* Show website thumbnails/screenshots using phancap
|
||||
*
|
||||
* @category Bookmarking
|
||||
* @package SemanticScuttle
|
||||
* @author Christian Weiske <cweiske@cweiske.de>
|
||||
* @license GPL http://www.gnu.org/licenses/gpl.html
|
||||
* @link http://sourceforge.net/projects/semanticscuttle
|
||||
* @see http://cweiske.de/phancap.htm
|
||||
*/
|
||||
class SemanticScuttle_Thumbnailer_Phancap
|
||||
{
|
||||
/**
|
||||
* Configuration array.
|
||||
* Required keys:
|
||||
* - url
|
||||
* - token
|
||||
* - secret
|
||||
*/
|
||||
protected $config = array();
|
||||
|
||||
/**
|
||||
* Set phancap configuration
|
||||
*
|
||||
* @param array $config Phancap configuration
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setConfig($config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URL for a website thumbnail
|
||||
*
|
||||
* @param string $bookmarkUrl URL of website to create thumbnail for
|
||||
* @param integer $width Screenshot width
|
||||
* @param integer $height Screenshot height
|
||||
*
|
||||
* @return mixed FALSE when no screenshot could be obtained,
|
||||
* string with the URL otherwise
|
||||
*/
|
||||
public function getThumbnailUrl($bookmarkUrl, $width, $height)
|
||||
{
|
||||
//default parameters for the phancap service
|
||||
$parameters = array(
|
||||
'url' => $bookmarkUrl,
|
||||
'swidth' => $width,
|
||||
'sheight' => $height,
|
||||
'sformat' => 'jpg',
|
||||
);
|
||||
|
||||
if (isset($this->config['token']) && $this->config['token'] != '') {
|
||||
$parameters['atoken'] = $this->config['token'];
|
||||
$parameters['atimestamp'] = time();
|
||||
|
||||
//create signature
|
||||
ksort($parameters);
|
||||
foreach ($parameters as $key => $value) {
|
||||
$encparams[] = $key . '=' . rawurlencode($value);
|
||||
}
|
||||
$encstring = implode('&', $encparams);
|
||||
$signature = hash_hmac('sha1', $encstring, $this->config['secret']);
|
||||
//append signature to parameters
|
||||
$parameters['asignature'] = $signature;
|
||||
}
|
||||
|
||||
//url-encode the parameters
|
||||
$urlParams = array();
|
||||
foreach ($parameters as $key => $value) {
|
||||
$urlParams[] = $key . '=' . urlencode($value);
|
||||
}
|
||||
|
||||
//final URL
|
||||
return $this->config['url'] . '?' . implode('&', $urlParams);
|
||||
}
|
||||
}
|
||||
?>
|
@ -69,6 +69,6 @@ define('PAGE_WATCHLIST', "watchlist");
|
||||
// installations on the same host server
|
||||
define('INSTALLATION_ID', md5($GLOBALS['dbname'].$GLOBALS['tableprefix']));
|
||||
|
||||
//fix PATH_INFO on certain hosts
|
||||
$_SERVER['PATH_INFO'] = SemanticScuttle_Environment::getServerPathInfo();
|
||||
//currently not needed
|
||||
//$_SERVER['PATH_INFO'] = SemanticScuttle_Environment::getServerPathInfo();
|
||||
?>
|
||||
|
@ -281,14 +281,13 @@ class sql_db
|
||||
|
||||
if ($query_id)
|
||||
{
|
||||
$id = (int) $query_id;
|
||||
unset($this->rowset[$id]);
|
||||
unset($this->row[$id]);
|
||||
unset($this->rowset[$query_id]);
|
||||
unset($this->row[$query_id]);
|
||||
|
||||
$result = array();
|
||||
while ($this->rowset[$id] = $this->sql_fetchrow($query_id))
|
||||
while ($this->rowset[$query_id] = $this->sql_fetchrow($query_id))
|
||||
{
|
||||
$result[] = $this->rowset[$id];
|
||||
$result[] = $this->rowset[$query_id];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
@ -276,17 +276,4 @@ function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '',
|
||||
echo "<html>\n<body>\n". $msg_title ."\n<br /><br />\n". $msg_text ."</body>\n</html>";
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls reset() on the given arg, without the E_STRICT error
|
||||
* "Only variables should be passed by reference"
|
||||
*
|
||||
* @param array $arg Array to return first element of
|
||||
*
|
||||
* @return mixed First element of the array
|
||||
*/
|
||||
function rreset($array)
|
||||
{
|
||||
return reset($array);
|
||||
}
|
||||
?>
|
||||
|
@ -32,15 +32,18 @@ $cfg = new SemanticScuttle_Config();
|
||||
list($configfile, $defaultfile) = $cfg->findFiles();
|
||||
if ($defaultfile === null) {
|
||||
header('HTTP/1.0 500 Internal Server Error');
|
||||
echo 'No default configuration file config.default.php found.'
|
||||
die(
|
||||
'No default configuration file config.default.php found.'
|
||||
. ' This is really, really strange'
|
||||
. "\n";
|
||||
exit(1);
|
||||
. "\n"
|
||||
);
|
||||
}
|
||||
if ($configfile === null) {
|
||||
header('HTTP/1.0 500 Internal Server Error');
|
||||
echo 'Please copy "config.php.dist" to "config.php" in data/ folder.' . "\n";
|
||||
exit(1);
|
||||
die(
|
||||
'Please copy "config.php.dist" to "config.php" in data/ folder.'
|
||||
. "\n"
|
||||
);
|
||||
}
|
||||
set_include_path(
|
||||
get_include_path() . PATH_SEPARATOR
|
||||
@ -55,8 +58,7 @@ if (isset($_GET['unittestMode']) && $_GET['unittestMode'] == 1
|
||||
) {
|
||||
if ($allowUnittestMode !== true) {
|
||||
header('HTTP/1.0 400 Bad Request');
|
||||
echo "Unittestmode is not allowed\n";
|
||||
exit(2);
|
||||
die("Unittestmode is not allowed\n");
|
||||
}
|
||||
|
||||
define('HTTP_UNIT_TEST_MODE', true);
|
||||
@ -87,7 +89,7 @@ require_once 'SemanticScuttle/constants.php';
|
||||
|
||||
// Debug Management using constants
|
||||
if (DEBUG_MODE) {
|
||||
ini_set('display_errors', '0');
|
||||
ini_set('display_errors', '1');
|
||||
ini_set('mysql.trace_mode', '1');
|
||||
error_reporting(E_ALL);
|
||||
} else {
|
||||
@ -171,29 +173,4 @@ if (!defined('UNIT_TEST_MODE') || defined('HTTP_UNIT_TEST_MODE')) {
|
||||
header('Content-Type: ' . $httpContentType . '; charset=utf-8');
|
||||
}
|
||||
}
|
||||
// 7 // Block everything if global private mode enabled and user not logged on
|
||||
|
||||
// This is required to prevent breaking the API. Some API PHP source files include httpauth.inc.php
|
||||
// which already check if the user is logged on and include www-header.php.
|
||||
// We also allow password.php so users can reset their password and login.php so they can log in.
|
||||
if (isset($GLOBALS['privatemode'])) {
|
||||
if ($GLOBALS['privatemode'] && ! $userservice->isLoggedOn()) {
|
||||
$flag = 1;
|
||||
$included_files = get_included_files();
|
||||
foreach ($included_files as $filename) {
|
||||
if (strpos($filename,'httpauth.inc.php') !== false || strpos($filename,'password.php') !== false || strpos($filename,'login.php') !== false) {
|
||||
$flag = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($flag) {
|
||||
$tplVars['error'] = T_('You must log in.');
|
||||
$tplVars['subtitle'] = T_('Log In');
|
||||
$tplVars['formaction'] = createURL('login');
|
||||
$tplVars['querystring'] = filter($_SERVER['QUERY_STRING']);
|
||||
$templateservice->loadTemplate('login.tpl', $tplVars);
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -1,149 +0,0 @@
|
||||
<?php
|
||||
/***************************************************************************
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 kafene
|
||||
https://github.com/kafene/netscape-bookmark-parser
|
||||
http://kafene.org
|
||||
|
||||
Slightly modified by yohan.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* Basically netscape bookmark files often come so badly formed, there's
|
||||
* no reliable way I could find to parse them with DOM or SimpleXML,
|
||||
* even after running HTML Tidy on them. So, this function does a bunch of
|
||||
* transformations on the general format of a netscape bookmark file, to get
|
||||
* Each bookmark and its description onto one line, and goes through line by
|
||||
* line, matching tags and attributes. It's messy, but it works better than
|
||||
* anything I could find in hours of googling, and anything that I could
|
||||
* write after hours with DOM and SimpleXML. I didn't want to pull in a big
|
||||
* DOM parsing library just to do this one thing, so this is it.
|
||||
*/
|
||||
|
||||
/*
|
||||
print '<PRE>';
|
||||
var_dump(parse_netscape_bookmarks(file_get_contents('bookmarks_export.htm')));
|
||||
*/
|
||||
|
||||
function parse_netscape_bookmarks($bkmk_str, $default_tag = null) {
|
||||
$i = 0;
|
||||
$next = false;
|
||||
$items = [];
|
||||
|
||||
$current_tag = $default_tag = $default_tag ?: 'autoimported-'.date("Ymd");
|
||||
|
||||
$bkmk_str = str_replace(["\r","\n","\t"], ['','',' '], $bkmk_str);
|
||||
|
||||
$bkmk_str = preg_replace_callback('@<dd>(.*?)(<A|<\/|<DL|<DT|<P)@mis', function($m) {
|
||||
return '<dd>'.str_replace(["\r", "\n"], ['', '<br>'], trim($m[1])).'</';
|
||||
}, $bkmk_str);
|
||||
|
||||
$bkmk_str = preg_replace('/>(\s*?)</mis', ">\n<", $bkmk_str);
|
||||
$bkmk_str = preg_replace('/(<!DOCTYPE|<META|<!--|<TITLE|<H1|<P)(.*?)\n/i', '', $bkmk_str);
|
||||
|
||||
$bkmk_str = trim($bkmk_str);
|
||||
$bkmk_str = preg_replace('/\n<dd/i', '<dd', $bkmk_str);
|
||||
//best way to do it :
|
||||
$bkmk_str = preg_replace('/(?<=.)<\/DL>/', "\n</DL>", $bkmk_str);
|
||||
$lines = explode("\n", $bkmk_str);
|
||||
|
||||
$str_bool = function($str, $default = false) {
|
||||
if (!$str) {
|
||||
return false;
|
||||
} elseif (!is_string($str) && $str) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$true = 'y|yes|on|checked|ok|1|true|array|\+|okay|yes+|t|one';
|
||||
$false = 'n|no|off|empty|null|false|0|-|exit|die|neg|f|zero|void';
|
||||
|
||||
if (preg_match("/^($true)$/i", $str)) {
|
||||
return true;
|
||||
} elseif (preg_match("/^($false)$/i", $str)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $default;
|
||||
};
|
||||
$tags = array($default_tag);
|
||||
foreach ($lines as $line_no => $line) {
|
||||
/* If we match a tag, set current tag to that, if <DL>, stop tag. */
|
||||
if (preg_match('/^<h\d(.*?)>(.*?)<\/h\d>/i', $line, $m1)) {
|
||||
$current_tag = trim(preg_replace("/\s+/", "_", strtr($m1[2], ', /+', '____')));
|
||||
$tags[] = $current_tag;
|
||||
continue;
|
||||
} elseif (preg_match('/^<\/DL>/i', $line)) {
|
||||
$current_tag = $default_tag;
|
||||
array_pop($tags);
|
||||
}
|
||||
|
||||
if (preg_match('/<a/i', $line, $m2)) {
|
||||
$items[$i]['tags'] = $tags;
|
||||
|
||||
if (preg_match('/href="(.*?)"/i', $line, $m3)) {
|
||||
$items[$i]['uri'] = $m3[1];
|
||||
// $items[$i]['meta'] = meta($m3[1]);
|
||||
} else {
|
||||
$items[$i]['uri'] = '';
|
||||
// $items[$i]['meta'] = '';
|
||||
}
|
||||
|
||||
if (preg_match('/<a(.*?)>(.*?)<\/a>/i', $line, $m4)) {
|
||||
$items[$i]['title'] = $m4[2];
|
||||
// $items[$i]['slug'] = slugify($m4[2]);
|
||||
} else {
|
||||
$items[$i]['title'] = 'untitled';
|
||||
// $items[$i]['slug'] = '';
|
||||
}
|
||||
|
||||
if (preg_match('/note="(.*?)"<\/a>/i', $line, $m5)) {
|
||||
$items[$i]['note'] = $m5[1];
|
||||
} elseif (preg_match('/<dd>(.*?)<\//i', $line, $m6)) {
|
||||
$items[$i]['note'] = str_replace('<br>', "\n", $m6[1]);
|
||||
} else {
|
||||
$items[$i]['note'] = '';
|
||||
}
|
||||
|
||||
if (preg_match('/(tags?|labels?|folders?)="(.*?)"/i', $line, $m7)) {
|
||||
array_unique(array_merge($items[$i]['tags'], explode(' ', trim(preg_replace("/\s+/", " ", strtr($m7[2], ',', ' '))))));
|
||||
}
|
||||
if (preg_match('/add_date="(.*?)"/i', $line, $m8)) {
|
||||
$items[$i]['time'] = $m8[1];
|
||||
} else {
|
||||
$items[$i]['time'] = time();
|
||||
}
|
||||
|
||||
if (preg_match('/(public|published|pub)="(.*?)"/i', $line, $m9)) {
|
||||
$items[$i]['pub'] = $str_bool($m9[2], false) ? 1 : 0;
|
||||
} elseif (preg_match('/(private|shared)="(.*?)"/i', $line, $m10)) {
|
||||
$items[$i]['pub'] = $str_bool($m10[2], true) ? 0 : 1;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
ksort($items);
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
?>
|
@ -64,7 +64,7 @@ class Api_ExportCsvTest extends TestBaseApi
|
||||
*/
|
||||
public function testMimeTypeFilename()
|
||||
{
|
||||
$res = rreset($this->getAuthRequest())->send();
|
||||
$res = reset($this->getAuthRequest())->send();
|
||||
|
||||
$this->assertEquals(200, $res->getStatus());
|
||||
//verify MIME content type
|
||||
@ -253,7 +253,7 @@ class Api_ExportCsvTest extends TestBaseApi
|
||||
$ar[] = $arl;
|
||||
}
|
||||
}
|
||||
if (count(end($ar)) == 1 && rreset(end($ar)) == '') {
|
||||
if (count(end($ar)) == 1 && reset(end($ar)) == '') {
|
||||
unset($ar[key($ar)]);
|
||||
}
|
||||
return $ar;
|
||||
|
@ -12,7 +12,7 @@ class Api_OpenSearchTest extends TestBaseApi
|
||||
$xhtml = $req->send()->getBody();
|
||||
|
||||
$xml = simplexml_load_string($xhtml);
|
||||
$xml->registerXPathNamespace('h', rreset($xml->getDocNamespaces()));
|
||||
$xml->registerXPathNamespace('h', reset($xml->getDocNamespaces()));
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'SimpleXMLElement', $xml,
|
||||
@ -58,7 +58,7 @@ class Api_OpenSearchTest extends TestBaseApi
|
||||
{
|
||||
$xml = $this->getRequest('api/opensearch.php')->send()->getBody();
|
||||
$x = simplexml_load_string($xml);
|
||||
$x->registerXPathNamespace('os', rreset($x->getDocNamespaces()));
|
||||
$x->registerXPathNamespace('os', reset($x->getDocNamespaces()));
|
||||
|
||||
$arElements = $x->xpath('//os:Url[@type="text/html"]');
|
||||
$this->assertEquals(
|
||||
|
@ -89,30 +89,7 @@ class Bookmark2TagTest extends TestBase
|
||||
);
|
||||
}
|
||||
|
||||
public function testAttachTagsWithEmptyStringAddsSystemUnfiled()
|
||||
{
|
||||
$originalDisplayErros = ini_get('display_errors');
|
||||
$originalErrorReporting = ini_get('error_reporting');
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
$bid = $this->addBookmark(null, null, 0, '');
|
||||
$this->assertEquals(
|
||||
array('system:unfiled'),
|
||||
$this->b2ts->getTagsForBookmark($bid, true)
|
||||
);
|
||||
ini_set('display_errors', $originalDisplayErros);
|
||||
error_reporting($originalErrorReporting);
|
||||
}
|
||||
|
||||
public function testAttachTagsWithSomeEmptyTags()
|
||||
{
|
||||
$bid = $this->addBookmark(null, null, 0, array());
|
||||
$this->b2ts->attachTags($bid, array('foo', '', 'bar', 'baz'));
|
||||
$this->assertEquals(
|
||||
array('foo', 'bar', 'baz'),
|
||||
$this->b2ts->getTagsForBookmark($bid)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getTagsForBookmark() when the bookmark has no tags
|
||||
@ -675,14 +652,5 @@ class Bookmark2TagTest extends TestBase
|
||||
$this->assertContains(array('tag' => 'usertag1', 'bCount' => '1'), $arTags);
|
||||
$this->assertContains(array('tag' => 'usable', 'bCount' => '2'), $arTags);
|
||||
}
|
||||
|
||||
public function testHasTag()
|
||||
{
|
||||
$bid = $this->addBookmark(null, null, 0, array('foo'));
|
||||
|
||||
$this->assertTrue($this->b2ts->hasTag($bid, 'foo'));
|
||||
$this->assertFalse($this->b2ts->hasTag($bid, 'bar'));
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -129,9 +129,9 @@ class BookmarkTest extends TestBase
|
||||
$bs = $this->bs;
|
||||
|
||||
$bs->addBookmark("http://site1.com", "title", "éèüaàê", "status", array('tag1'), null, false, false, 1);
|
||||
$bookmarks = $bs->getBookmarks(0, NULL, NULL, NULL, $terms = "eeaae"); //void
|
||||
$bookmarks =& $bs->getBookmarks(0, NULL, NULL, NULL, $terms = "eeaae"); //void
|
||||
$this->assertEquals(0, $bookmarks['total']);
|
||||
$bookmarks = $bs->getBookmarks(0, NULL, NULL, NULL, $terms = "eeuaae");
|
||||
$bookmarks =& $bs->getBookmarks(0, NULL, NULL, NULL, $terms = "eeuaae");
|
||||
$this->assertEquals(1, $bookmarks['total']);
|
||||
}*/
|
||||
|
||||
|
@ -2,42 +2,6 @@
|
||||
|
||||
class SemanticScuttle_EnvironmentTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testServerPathInfoModPhpNoPath()
|
||||
{
|
||||
$_SERVER = array (
|
||||
'HTTP_USER_AGENT' => 'Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16',
|
||||
'HTTP_HOST' => 'bm.bogo',
|
||||
'HTTP_ACCEPT' => 'text/html, application/xml;q=0.9, applicaton/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1',
|
||||
'HTTP_ACCEPT_LANGUAGE' => 'en,de-DE;q=0.9,de;q=0.8',
|
||||
'HTTP_ACCEPT_ENCODING' => 'gzip, deflate',
|
||||
'HTTP_CONNECTION' => 'Keep-Alive',
|
||||
'HTTP_DNT' => '1',
|
||||
'PATH' => '/usr/local/bin:/usr/bin:/bin',
|
||||
'SERVER_SIGNATURE' => '<address>Apache/2.2.22 (Ubuntu) Server at bm.bogo Port 80</address>',
|
||||
'SERVER_SOFTWARE' => 'Apache/2.2.22 (Ubuntu)',
|
||||
'SERVER_NAME' => 'bm.bogo',
|
||||
'SERVER_ADDR' => '127.0.0.1',
|
||||
'SERVER_PORT' => '80',
|
||||
'REMOTE_ADDR' => '127.0.0.1',
|
||||
'DOCUMENT_ROOT' => '/var/www',
|
||||
'SERVER_ADMIN' => '[no address given]',
|
||||
'SCRIPT_FILENAME' => '/home/cweiske/Dev/html/hosts/bm.bogo/test.php',
|
||||
'REMOTE_PORT' => '38545',
|
||||
'GATEWAY_INTERFACE' => 'CGI/1.1',
|
||||
'SERVER_PROTOCOL' => 'HTTP/1.1',
|
||||
'REQUEST_METHOD' => 'GET',
|
||||
'QUERY_STRING' => '',
|
||||
'REQUEST_URI' => '/test.php',
|
||||
'SCRIPT_NAME' => '/test.php',
|
||||
'PHP_SELF' => '/test.php',
|
||||
'REQUEST_TIME_FLOAT' => 1377024570.296,
|
||||
'REQUEST_TIME' => 1377024570,
|
||||
);
|
||||
$this->assertEquals(
|
||||
'', SemanticScuttle_Environment::getServerPathInfo()
|
||||
);
|
||||
}
|
||||
|
||||
public function testServerPathInfoModPhp()
|
||||
{
|
||||
$_SERVER = array(
|
||||
@ -126,109 +90,6 @@ class SemanticScuttle_EnvironmentTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testServerPathInfo1and1NoPath()
|
||||
{
|
||||
$_SERVER = array(
|
||||
'REDIRECT_SCRIPT_URL' => '/dummy.php',
|
||||
'REDIRECT_SCRIPT_URI' => 'http://www.example.org/dummy.php',
|
||||
'REDIRECT_DOCUMENT_ROOT' => '/kunden/homepages/44/dexample/htdocs/example/www',
|
||||
'REDIRECT_HANDLER' => 'x-mapp-php6',
|
||||
'REDIRECT_STATUS' => '200',
|
||||
'DBENTRY_HOST' => 'example.org',
|
||||
'DBENTRY' => '/kunden/homepages/44/dexample/htdocs/example/www:d0000#CPU 6 #MEM 10240 #CGI 18 #NPROC 12 #TAID 46322755 #WERB 0 #LANG 2 #STAT 1',
|
||||
'SCRIPT_URL' => '/dummy.php',
|
||||
'SCRIPT_URI' => 'http://www.example.org/dummy.php',
|
||||
'HTTP_USER_AGENT' => 'Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16',
|
||||
'HTTP_HOST' => 'www.example.org',
|
||||
'HTTP_ACCEPT' => 'text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1',
|
||||
'HTTP_ACCEPT_LANGUAGE' => 'en,de-DE;q=0.9,de;q=0.8',
|
||||
'HTTP_ACCEPT_ENCODING' => 'gzip, deflate',
|
||||
'HTTP_COOKIE' => 'PHPSESSID=8c7853d7f639b3c6d24c224cf7d4cb1c',
|
||||
'HTTP_CONNECTION' => 'Keep-Alive',
|
||||
'HTTP_DNT' => '1',
|
||||
'PATH' => '/bin:/usr/bin',
|
||||
'SERVER_SIGNATURE' => '',
|
||||
'SERVER_SOFTWARE' => 'Apache',
|
||||
'SERVER_NAME' => 'example.org',
|
||||
'SERVER_ADDR' => '127.0.0.1',
|
||||
'SERVER_PORT' => '80',
|
||||
'REMOTE_ADDR' => '127.0.0.1',
|
||||
'DOCUMENT_ROOT' => '/kunden/homepages/44/dexample/htdocs/example/www',
|
||||
'SERVER_ADMIN' => 'webmaster@example.org',
|
||||
'SCRIPT_FILENAME' => '/kunden/homepages/44/dexample/htdocs/example/www/dummy.php',
|
||||
'REMOTE_PORT' => '35368',
|
||||
'REDIRECT_URL' => '/dummy.php',
|
||||
'GATEWAY_INTERFACE' => 'CGI/1.1',
|
||||
'SERVER_PROTOCOL' => 'HTTP/1.1',
|
||||
'REQUEST_METHOD' => 'GET',
|
||||
'QUERY_STRING' => '',
|
||||
'REQUEST_URI' => '/dummy.php',
|
||||
'SCRIPT_NAME' => '/dummy.php',
|
||||
'STATUS' => '200',
|
||||
'ORIG_PATH_INFO' => '/dummy.php',
|
||||
'ORIG_PATH_TRANSLATED' => '/kunden/homepages/44/dexample/htdocs/example/www/dummy.php',
|
||||
'PHP_SELF' => '/dummy.php',
|
||||
'REQUEST_TIME_FLOAT' => 1377022156.0101,
|
||||
'REQUEST_TIME' => 1377022156,
|
||||
'argv' => array(),
|
||||
'argc' => 0,
|
||||
);
|
||||
$this->assertEquals(
|
||||
'', SemanticScuttle_Environment::getServerPathInfo()
|
||||
);
|
||||
}
|
||||
|
||||
public function testServerPathInfo1and1WithPath()
|
||||
{
|
||||
$_SERVER = array(
|
||||
'REDIRECT_SCRIPT_URL' => '/dummy.php/dummy/foo',
|
||||
'REDIRECT_SCRIPT_URI' => 'http://www.example.org/dummy.php/dummy/foo',
|
||||
'REDIRECT_DOCUMENT_ROOT' => '/kunden/homepages/44/dexample/htdocs/example/www',
|
||||
'REDIRECT_HANDLER' => 'x-mapp-php6',
|
||||
'REDIRECT_STATUS' => '200',
|
||||
'DBENTRY_HOST' => 'example.org',
|
||||
'DBENTRY' => '/kunden/homepages/44/dexample/htdocs/example/www:d0000#CPU 6 #MEM 10240 #CGI 18 #NPROC 12 #TAID 46322755 #WERB 0 #LANG 2 #STAT 1',
|
||||
'SCRIPT_URL' => '/dummy.php/dummy/foo',
|
||||
'SCRIPT_URI' => 'http://www.example.org/dummy.php/dummy/foo',
|
||||
'HTTP_USER_AGENT' => 'Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16',
|
||||
'HTTP_HOST' => 'www.example.org',
|
||||
'HTTP_ACCEPT' => 'text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1',
|
||||
'HTTP_ACCEPT_LANGUAGE' => 'en,de-DE;q=0.9,de;q=0.8',
|
||||
'HTTP_ACCEPT_ENCODING' => 'gzip, deflate',
|
||||
'HTTP_COOKIE' => 'PHPSESSID=8c7853d7f639b3c6d24c224cf7d4cb1c',
|
||||
'HTTP_CONNECTION' => 'Keep-Alive',
|
||||
'HTTP_DNT' => '1',
|
||||
'PATH' => '/bin:/usr/bin',
|
||||
'SERVER_SIGNATURE' => '',
|
||||
'SERVER_SOFTWARE' => 'Apache',
|
||||
'SERVER_NAME' => 'example.org',
|
||||
'SERVER_ADDR' => '127.0.0.1',
|
||||
'SERVER_PORT' => '80',
|
||||
'REMOTE_ADDR' => '127.0.0.1',
|
||||
'DOCUMENT_ROOT' => '/kunden/homepages/44/dexample/htdocs/example/www',
|
||||
'SERVER_ADMIN' => 'webmaster@example.org',
|
||||
'SCRIPT_FILENAME' => '/kunden/homepages/44/dexample/htdocs/example/www/dummy.php',
|
||||
'REMOTE_PORT' => '35857',
|
||||
'REDIRECT_URL' => '/dummy.php/dummy/foo',
|
||||
'GATEWAY_INTERFACE' => 'CGI/1.1',
|
||||
'SERVER_PROTOCOL' => 'HTTP/1.1',
|
||||
'REQUEST_METHOD' => 'GET',
|
||||
'QUERY_STRING' => '',
|
||||
'REQUEST_URI' => '/dummy.php/dummy/foo',
|
||||
'SCRIPT_NAME' => '/dummy.php',
|
||||
'STATUS' => '200',
|
||||
'ORIG_PATH_INFO' => '/dummy/foo',
|
||||
'ORIG_PATH_TRANSLATED' => '/kunden/homepages/44/dexample/htdocs/example/www/dummy.php',
|
||||
'PHP_SELF' => '/dummy.php',
|
||||
'REQUEST_TIME_FLOAT' => 1377024137.8098,
|
||||
'REQUEST_TIME' => 1377024137,
|
||||
'argv' => array(),
|
||||
'argc' => 0,
|
||||
);
|
||||
$this->assertEquals(
|
||||
'/dummy/foo', SemanticScuttle_Environment::getServerPathInfo()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -35,8 +35,6 @@ class Tag2TagTest extends TestBase
|
||||
protected function setUp()
|
||||
{
|
||||
$this->us =SemanticScuttle_Service_Factory::get('User');
|
||||
$this->us->deleteAll();
|
||||
$this->addUser();
|
||||
$this->bs =SemanticScuttle_Service_Factory::get('Bookmark');
|
||||
$this->bs->deleteAll();
|
||||
$this->b2ts =SemanticScuttle_Service_Factory::get('Bookmark2Tag');
|
||||
@ -272,14 +270,12 @@ class Tag2TagTest extends TestBase
|
||||
$tts = $this->tts;
|
||||
$linkedTags = $tts->getLinkedTags('a', '>', $uid);
|
||||
$this->assertEquals(2, count($linkedTags));
|
||||
$this->assertInternalType('string', $linkedTags[0]);
|
||||
$this->assertSame('b', $linkedTags[0]);
|
||||
$this->assertInternalType('string', $linkedTags[1]);
|
||||
$this->assertSame('d', $linkedTags[1]);
|
||||
$this->assertSame('b', $linkedTags[0]['tag']);
|
||||
$this->assertSame('d', $linkedTags[1]['tag']);
|
||||
|
||||
$linkedTags = $tts->getLinkedTags('b', '>', $uid);
|
||||
$this->assertEquals(1, count($linkedTags));
|
||||
$this->assertSame('c', $linkedTags[0]);
|
||||
$this->assertSame('c', $linkedTags[0]['tag']);
|
||||
$this->assertTrue($tts->existsLinkedTags('d', 'e', '>', $uid));
|
||||
$this->assertFalse($tts->existsLinkedTags('e', 'd', '>', $uid));
|
||||
}
|
||||
@ -320,20 +316,20 @@ class Tag2TagTest extends TestBase
|
||||
$this->assertSame('B1', $results['bookmarks'][0]['bTitle']);
|
||||
|
||||
//advanced queries
|
||||
$results = $bs->getBookmarks(0, NULL, 1, 'aa', null, 'title_asc');
|
||||
$results = $bs->getBookmarks(0, NULL, 1, 'aa');
|
||||
$this->assertSame(2, intval($results['total']));
|
||||
$this->assertSame('B1', $results['bookmarks'][0]['bTitle']);
|
||||
$this->assertSame('B2', $results['bookmarks'][1]['bTitle']);
|
||||
|
||||
$results = $bs->getBookmarks(0, NULL, 1, 'ee', null, 'title_asc');
|
||||
$results = $bs->getBookmarks(0, NULL, 1, 'ee');
|
||||
$this->assertSame(2, intval($results['total']));
|
||||
$this->assertSame('B2', $results['bookmarks'][0]['bTitle']);
|
||||
$this->assertSame('B3', $results['bookmarks'][1]['bTitle']);
|
||||
$this->assertSame('B2', $results['bookmarks'][1]['bTitle']);
|
||||
$this->assertSame('B3', $results['bookmarks'][0]['bTitle']);
|
||||
|
||||
$results = $bs->getBookmarks(0, NULL, 1, 'ii', null, 'title_asc');
|
||||
$results = $bs->getBookmarks(0, NULL, 1, 'ii');
|
||||
$this->assertSame(2, intval($results['total']));
|
||||
$this->assertSame('B2', $results['bookmarks'][0]['bTitle']);
|
||||
$this->assertSame('B3', $results['bookmarks'][1]['bTitle']);
|
||||
$this->assertSame('B2', $results['bookmarks'][1]['bTitle']);
|
||||
$this->assertSame('B3', $results['bookmarks'][0]['bTitle']);
|
||||
|
||||
$results = $bs->getBookmarks(0, NULL, 1, 'aa+ee');
|
||||
|
||||
|
@ -87,13 +87,5 @@ class TagTest extends TestBase
|
||||
|
||||
}
|
||||
|
||||
public function testNormalizeEmptyValues()
|
||||
{
|
||||
$tags = $this->ts->normalize(
|
||||
array('foo', '', 'bar', 'baz')
|
||||
);
|
||||
$this->assertEquals(array(0 => 'foo', 2 => 'bar', 3 => 'baz'), $tags);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -87,7 +87,7 @@ class TestBase extends PHPUnit_Framework_TestCase
|
||||
protected function addUser(
|
||||
$username = null, $password = null, $privateKey = null
|
||||
) {
|
||||
return rreset($this->addUserData($username, $password, $privateKey));
|
||||
return reset($this->addUserData($username, $password, $privateKey));
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,7 +55,7 @@ class TestBaseApi extends TestBase
|
||||
protected function setUp()
|
||||
{
|
||||
if ($GLOBALS['unittestUrl'] === null) {
|
||||
$this->markTestSkipped('Unittest URL not set in config');
|
||||
$this->assertTrue(false, 'Unittest URL not set in config');
|
||||
}
|
||||
if ($this->urlPart === null) {
|
||||
$this->assertTrue(false, 'Set the urlPart variable');
|
||||
|
@ -22,7 +22,6 @@ require_once 'www-header.php';
|
||||
|
||||
$tplVars['pagetitle'] = T_('About');
|
||||
$tplVars['subtitle'] = T_('About');
|
||||
$tplVars['loadjs'] = true;
|
||||
|
||||
$templateservice->loadTemplate('about.tpl', $tplVars);
|
||||
?>
|
@ -70,7 +70,7 @@ if ($action
|
||||
}
|
||||
break;
|
||||
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) {
|
||||
if(!checkUrl($bookmark['bAddress'])) {
|
||||
$tplVars['error'].= T_('Problem with ').$bookmark['bAddress'].' ('. $bookmark['username'] .')<br/>';
|
||||
@ -83,13 +83,13 @@ if ($action
|
||||
}
|
||||
|
||||
$templatename = 'admin.tpl';
|
||||
$users = $userservice->getObjectUsers();
|
||||
$users =& $userservice->getObjectUsers();
|
||||
|
||||
if ( !is_array($users) ) {
|
||||
$users = array();
|
||||
}
|
||||
|
||||
$tplVars['users'] = $users;
|
||||
$tplVars['users'] =& $users;
|
||||
|
||||
$templateservice->loadTemplate($templatename, $tplVars);
|
||||
?>
|
||||
|
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
require_once '../www-header.php';
|
||||
if(isset($_POST['password']) && $userservice->isLoggedOn()){
|
||||
$password = $userservice->sanitisePassword($_POST['password']);
|
||||
$username = $currentUser->getUsername();
|
||||
$db = SemanticScuttle_Service_Factory::getDb();
|
||||
|
||||
$query = 'SELECT '. $userservice->getFieldName('primary') .' FROM '. $userservice->getTableName() .' WHERE '. $userservice->getFieldName('username') .' = "'. $db->sql_escape($username) .'" AND '. $userservice->getFieldName('password') .' = "'. $db->sql_escape($password) .'"';
|
||||
|
||||
if (!($dbresult = $db->sql_query($query))) {
|
||||
message_die(
|
||||
GENERAL_ERROR,
|
||||
'Could not get user',
|
||||
'', __LINE__, __FILE__, $query, $db
|
||||
);
|
||||
echo 'false';
|
||||
}
|
||||
else {
|
||||
$row = $db->sql_fetchrow($dbresult);
|
||||
$db->sql_freeresult($dbresult);
|
||||
|
||||
if ($row) {
|
||||
echo 'true';
|
||||
}
|
||||
else {
|
||||
echo 'false';
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo 'false';
|
||||
}
|
||||
?>
|
@ -63,8 +63,8 @@ if (isset($user) && $user != '') {
|
||||
$userid = NULL;
|
||||
}
|
||||
|
||||
$tags = $b2tservice->getTags($userid);
|
||||
$tplVars['tags'] = $b2tservice->tagCloud($tags, 5, 90, 225, getSortOrder());
|
||||
$tags =& $b2tservice->getTags($userid);
|
||||
$tplVars['tags'] =& $b2tservice->tagCloud($tags, 5, 90, 225, getSortOrder());
|
||||
$tplVars['user'] = $user;
|
||||
|
||||
if (isset($userid)) {
|
||||
@ -72,6 +72,7 @@ if (isset($userid)) {
|
||||
} else {
|
||||
$tplVars['cat_url'] = createURL('tags', '%2$s');
|
||||
}
|
||||
|
||||
$tplVars['sidebar_blocks'] = array('linked');
|
||||
$tplVars['userid'] = $userid;
|
||||
$tplVars['loadjs'] = true;
|
||||
|
@ -36,7 +36,7 @@ else
|
||||
$tag = NULL;
|
||||
|
||||
// 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.
|
||||
|
@ -61,7 +61,7 @@ No page for usergroup (users/admin) for the moment
|
||||
|
||||
<?php
|
||||
//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): ?>
|
||||
|
@ -4,9 +4,6 @@
|
||||
// del.icio.us behavior:
|
||||
// - doesn't include the filtered tag as an attribute on the root element (we do)
|
||||
|
||||
// Scuttle behavior:
|
||||
// - returns privacy status of each bookmark.
|
||||
|
||||
// Force HTTP authentication first!
|
||||
$httpContentType = 'text/xml';
|
||||
require_once 'httpauth.inc.php';
|
||||
@ -22,7 +19,7 @@ else
|
||||
$tag = NULL;
|
||||
|
||||
// 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.
|
||||
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
|
||||
@ -43,7 +40,7 @@ foreach($bookmarks['bookmarks'] as $row) {
|
||||
$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'])) . '" status="'. filter($row['bStatus'], 'xml') ."\" />\r\n";
|
||||
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 '</posts>';
|
||||
|
@ -10,7 +10,6 @@
|
||||
*
|
||||
* Scuttle behavior:
|
||||
* - Uses today, instead of the last bookmarked date, if no date is specified
|
||||
* - returns privacy status of each bookmark.
|
||||
*
|
||||
* SemanticScuttle - your social bookmark manager.
|
||||
*
|
||||
@ -76,7 +75,7 @@ foreach ($bookmarks['bookmarks'] as $row) {
|
||||
$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'])) . '" status="'. filter($row['bStatus'], 'xml') ."\" />\r\n";
|
||||
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 '</posts>';
|
||||
|
@ -4,9 +4,6 @@
|
||||
// del.icio.us behavior:
|
||||
// - doesn't include the filtered tag as an attribute on the root element (we do)
|
||||
|
||||
// Scuttle behavior:
|
||||
// - returns privacy status of each bookmark.
|
||||
|
||||
// Force HTTP authentication first!
|
||||
//require_once('httpauth.inc.php');
|
||||
$httpContentType = 'text/xml';
|
||||
@ -23,7 +20,7 @@ else
|
||||
$tag = NULL;
|
||||
|
||||
// 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.
|
||||
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
|
||||
@ -44,7 +41,7 @@ foreach($bookmarks['bookmarks'] as $row) {
|
||||
$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'])) . '" status="'. filter($row['bStatus'], 'xml') ."\" />\r\n";
|
||||
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 '</posts>';
|
||||
|
@ -4,9 +4,6 @@
|
||||
* optionally filtered by tag and/or number of posts
|
||||
* (default 15, max 100, just like del.icio.us).
|
||||
*
|
||||
* Scuttle behavior:
|
||||
* - returns privacy status of each bookmark.
|
||||
*
|
||||
* SemanticScuttle - your social bookmark manager.
|
||||
*
|
||||
* PHP version 5.
|
||||
@ -78,7 +75,7 @@ foreach ($bookmarks['bookmarks'] as $row) {
|
||||
$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'])) . '" status="'. filter($row['bStatus'], 'xml') ."\" />\r\n";
|
||||
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 '</posts>';
|
||||
|
@ -9,11 +9,6 @@
|
||||
* that too, so we are as close at the API as possible,
|
||||
* not breaking delicious clients.
|
||||
*
|
||||
* SemanticScuttle supports an extra parameter:
|
||||
* - ?datemode=modified
|
||||
* - sorts by modified date and returns modification time
|
||||
* instead of creation time
|
||||
*
|
||||
* SemanticScuttle - your social bookmark manager.
|
||||
*
|
||||
* PHP version 5.
|
||||
@ -32,25 +27,16 @@
|
||||
$httpContentType = 'text/xml';
|
||||
require_once 'httpauth.inc.php';
|
||||
|
||||
// parameter "datemode=modified" will get last modified date
|
||||
// instead of last created date
|
||||
$orderby = null;
|
||||
$timeField = 'bDatetime';
|
||||
if (isset($_GET['datemode']) && $_GET['datemode'] == 'modified') {
|
||||
$orderby = 'modified_desc';
|
||||
$timeField = 'bModified';
|
||||
}
|
||||
|
||||
$bs = SemanticScuttle_Service_Factory::get('Bookmark');
|
||||
|
||||
$bookmarks = $bs->getBookmarks(0, 1, $userservice->getCurrentUserId(), null, null, $orderby);
|
||||
$bookmarks = $bs->getBookmarks(0, 1, $userservice->getCurrentUserId());
|
||||
|
||||
// Set up the XML file and output all the tags.
|
||||
echo '<?xml version="1.0" standalone="yes" ?' . ">\r\n";
|
||||
//foreach is used in case there are no bookmarks
|
||||
foreach ($bookmarks['bookmarks'] as $row) {
|
||||
echo '<update time="'
|
||||
. gmdate('Y-m-d\TH:i:s\Z', strtotime($row[$timeField]))
|
||||
. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime']))
|
||||
. '"'
|
||||
. ' inboxnew="0"'
|
||||
. ' />';
|
||||
|
@ -13,7 +13,7 @@ $b2tservice =SemanticScuttle_Service_Factory::get('Bookmark2Tag');
|
||||
|
||||
|
||||
// Get the tags relevant to the passed-in variables.
|
||||
$tags = $b2tservice->getTags($userservice->getCurrentUserId());
|
||||
$tags =& $b2tservice->getTags($userservice->getCurrentUserId());
|
||||
|
||||
// Set up the XML file and output all the tags.
|
||||
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
|
||||
|
@ -29,21 +29,15 @@ $cacheservice =SemanticScuttle_Service_Factory::get('Cache');
|
||||
isset($_GET['action']) ? define('GET_ACTION', $_GET['action']): define('GET_ACTION', '');
|
||||
isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', '');
|
||||
|
||||
// define does not support arrays before PHP version 7
|
||||
isset($_GET['title']) ? $TITLE = $_GET['title']: $TITLE = array();
|
||||
//isset($_GET['title']) ? define('GET_TITLE', $_GET['title']): define('GET_TITLE', '');
|
||||
isset($_GET['address']) ? $ADDRESS = $_GET['address']: $ADDRESS = array();
|
||||
//isset($_GET['address']) ? define('GET_ADDRESS', $_GET['address']): define('GET_ADDRESS', '');
|
||||
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['privateNote']) ? define('GET_PRIVATENOTE', $_GET['privateNote']): define('GET_PRIVATENOTE', '');
|
||||
isset($_GET['tags']) ? define('GET_TAGS', $_GET['tags']): define('GET_TAGS', '');
|
||||
isset($_GET['copyOf']) ? define('GET_COPYOF', $_GET['copyOf']): define('GET_COPYOF', '');
|
||||
|
||||
// define does not support arrays before PHP version 7
|
||||
isset($_POST['title']) ? $TITLE = $_POST['title']: $TITLE = array();
|
||||
//isset($_POST['title']) ? define('POST_TITLE', $_POST['title']): define('POST_TITLE', '');
|
||||
isset($_POST['address']) ? $ADDRESS = $_POST['address']: $ADDRESS = array();
|
||||
//isset($_POST['address']) ? define('POST_ADDRESS', $_POST['address']): define('POST_ADDRESS', '');
|
||||
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['privateNote']) ? define('POST_PRIVATENOTE', $_POST['privateNote']): define('POST_PRIVATENOTE', '');
|
||||
isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', '');
|
||||
@ -54,22 +48,12 @@ isset($_POST['popup']) ? define('POST_POPUP', $_POST['popup']): define('POST_POP
|
||||
|
||||
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['batch']) ? define('GET_BATCH', $_GET['batch']): define('GET_BATCH', 0);
|
||||
|
||||
if (!isset($_POST['tags'])) {
|
||||
$_POST['tags'] = array();
|
||||
}
|
||||
if (!isset($_POST['removetags'])) {
|
||||
$_POST['removetags'] = array();
|
||||
}
|
||||
//echo '<p>' . var_export($_POST, true) . '</p>';die();
|
||||
if (! is_array($ADDRESS)) {
|
||||
$ADDRESS = array($ADDRESS);
|
||||
}
|
||||
|
||||
if (! is_array($TITLE)) {
|
||||
$TITLE = array($TITLE);
|
||||
}
|
||||
|
||||
if ((GET_ACTION == "add") && !$userservice->isLoggedOn()) {
|
||||
$loginqry = str_replace("'", '%27', stripslashes($_SERVER['QUERY_STRING']));
|
||||
@ -116,7 +100,7 @@ if ($user) {
|
||||
$templateservice->loadTemplate('error.404.tpl', $tplVars);
|
||||
exit();
|
||||
} else {
|
||||
$userid = $userinfo['uId'];
|
||||
$userid =& $userinfo['uId'];
|
||||
}
|
||||
}
|
||||
$pagetitle .= ': '. $user;
|
||||
@ -146,119 +130,71 @@ $tplVars['loadjs'] = true;
|
||||
$saved = false;
|
||||
$templatename = 'bookmarks.tpl';
|
||||
if ($userservice->isLoggedOn() && POST_SUBMITTED != '') {
|
||||
if (!$TITLE || !$ADDRESS) {
|
||||
if (!POST_TITLE || !POST_ADDRESS) {
|
||||
$tplVars['error'] = T_('Your bookmark must have a title and an address');
|
||||
$templatename = 'editbookmark.tpl';
|
||||
}
|
||||
else {
|
||||
$address = array_map('trim', $ADDRESS);
|
||||
$valid = 1;
|
||||
foreach($address as $value) {
|
||||
if (!SemanticScuttle_Model_Bookmark::isValidUrl($value)) {
|
||||
$tplVars['error'] = T_('This bookmark URL may not be added' + $value);
|
||||
$templatename = 'editbookmark.tpl';
|
||||
$valid = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($valid) {
|
||||
$title = array_map('trim', $TITLE);
|
||||
$description = trim(POST_DESCRIPTION);
|
||||
$privateNote = trim(POST_PRIVATENOTE);
|
||||
$status = intval(POST_STATUS);
|
||||
$categories = array_map('trim', explode(',', trim($_POST['tags'])));
|
||||
$removecategories = array_map('trim', explode(',', trim($_POST['removetags'])));
|
||||
$saved = true;
|
||||
foreach($address as $index => $value) {
|
||||
if ($bookmarkservice->bookmarkExists($value, $currentUserID)) {
|
||||
// If the bookmark exists already, edit the original
|
||||
$bookmark = $bookmarkservice->getBookmarkByAddress($value);
|
||||
$bId = intval($bookmark['bId']);
|
||||
$row = $bookmarkservice->getBookmark($bId, true);
|
||||
$categories = array_unique(array_merge($row['tags'], $categories));
|
||||
// remove tags
|
||||
$categories = array_diff($categories, $removecategories);
|
||||
if (!$bookmarkservice->updateBookmark($bId, $value, $title[$index], $description, $privateNote, $status, $categories)) {
|
||||
$tplvars['error'] = T_('Error while saving this bookmark : ' + $value);
|
||||
$templatename = 'editbookmark.tpl';
|
||||
$saved = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If it's new, save it
|
||||
elseif (!$bookmarkservice->addBookmark($value, $title[$index], $description, $privateNote, $status, $categories)) {
|
||||
$tplVars['error'] = T_('There was an error saving this bookmark : ' + $value + ' Please try again or contact the administrator.');
|
||||
$templatename = 'editbookmark.tpl';
|
||||
$saved = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($saved) {
|
||||
if (POST_POPUP != '') {
|
||||
$tplVars['msg'] = '<script type="text/javascript">window.close();</script>';
|
||||
}
|
||||
else {
|
||||
$tplVars['msg'] = T_('Bookmark saved') . ' <a href="javascript:history.go(-2)">'.T_('(Come back to previous page.)').'</a>';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$address = trim(POST_ADDRESS);
|
||||
if (!SemanticScuttle_Model_Bookmark::isValidUrl($address)) {
|
||||
$tplVars['error'] = T_('This bookmark URL may not be added');
|
||||
$templatename = 'editbookmark.tpl';
|
||||
} else if ($bookmarkservice->bookmarkExists($address, $currentUserID)) {
|
||||
// If the bookmark exists already, edit the original
|
||||
$bookmark = $bookmarkservice->getBookmarkByAddress($address);
|
||||
header('Location: '. createURL('edit', $bookmark['bId']));
|
||||
exit();
|
||||
// If it's new, save it
|
||||
} else {
|
||||
$title = trim(POST_TITLE);
|
||||
$description = trim(POST_DESCRIPTION);
|
||||
$privateNote = trim(POST_PRIVATENOTE);
|
||||
$status = intval(POST_STATUS);
|
||||
$categories = explode(',', $_POST['tags']);
|
||||
$saved = true;
|
||||
if ($bookmarkservice->addBookmark($address, $title, $description, $privateNote, $status, $categories)) {
|
||||
if (POST_POPUP != '') {
|
||||
$tplVars['msg'] = '<script type="text/javascript">window.close();</script>';
|
||||
} else {
|
||||
$tplVars['msg'] = T_('Bookmark saved') . ' <a href="javascript:history.go(-2)">'.T_('(Come back to previous page.)').'</a>';
|
||||
// Redirection option
|
||||
if ($GLOBALS['useredir']) {
|
||||
$address = $GLOBALS['url_redir'] . $address;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');
|
||||
$templatename = 'editbookmark.tpl';
|
||||
$saved = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GET_ACTION == "add" || GET_BATCH) {
|
||||
if (GET_ACTION == "add") {
|
||||
// If the bookmark exists already, edit the original
|
||||
if (count($ADDRESS) === 1) {
|
||||
if ($bookmarkservice->bookmarkExists(stripslashes($ADDRESS[0]), $currentUserID)) {
|
||||
$bookmark =& $bookmarkservice->getBookmarks(0, NULL, $currentUserID, NULL, NULL, NULL, NULL, NULL, NULL, $bookmarkservice->getHash(stripslashes($ADDRESS[0])));
|
||||
$popup = (GET_POPUP!='') ? '?popup=1' : '';
|
||||
header('Location: '. createURL('edit', $bookmark['bookmarks'][0]['bId'] . $popup));
|
||||
exit();
|
||||
}
|
||||
if ($bookmarkservice->bookmarkExists(stripslashes(GET_ADDRESS), $currentUserID)) {
|
||||
$bookmark =& $bookmarkservice->getBookmarks(0, NULL, $currentUserID, NULL, NULL, NULL, NULL, NULL, NULL, $bookmarkservice->getHash(stripslashes(GET_ADDRESS)));
|
||||
$popup = (GET_POPUP!='') ? '?popup=1' : '';
|
||||
header('Location: '. createURL('edit', $bookmark['bookmarks'][0]['bId'] . $popup));
|
||||
exit();
|
||||
}
|
||||
$templatename = 'editbookmark.tpl';
|
||||
}
|
||||
|
||||
if ($templatename == 'editbookmark.tpl') { // Prepare to display the edit bookmark page.
|
||||
if ($templatename == 'editbookmark.tpl') {
|
||||
if ($userservice->isLoggedOn()) {
|
||||
$tplVars['formaction'] = createURL('bookmarks', $currentUsername);
|
||||
if (POST_SUBMITTED != '') {
|
||||
$tplVars['row'] = array(
|
||||
'bTitle' => array_map('stripslashes', $TITLE),
|
||||
'bAddress' => array_map('stripslashes', $ADDRESS),
|
||||
'bDescription' => stripslashes(POST_DESCRIPTION),
|
||||
'bPrivateNote' => stripslashes(POST_PRIVATENOTE),
|
||||
'tags' => ($_POST['tags'] ? $_POST['tags'] : array()),
|
||||
'bTitle' => stripslashes(POST_TITLE),
|
||||
'bAddress' => stripslashes(POST_ADDRESS),
|
||||
'bDescription' => stripslashes(POST_DESCRIPTION),
|
||||
'bPrivateNote' => stripslashes(POST_PRIVATENOTE),
|
||||
'tags' => ($_POST['tags'] ? $_POST['tags'] : array()),
|
||||
'bStatus' => $GLOBALS['defaults']['privacy'],
|
||||
);
|
||||
$tplVars['tags'] = $_POST['tags'];
|
||||
}
|
||||
elseif (GET_BATCH) {
|
||||
$completebookmarks = $bookmarkservice->getBookmarks(0, null, $userid, $cat, null, getSortOrder());
|
||||
$addresses2 = array();
|
||||
$titles2 = array();
|
||||
$tags2 = array();
|
||||
foreach ($completebookmarks['bookmarks'] as $key => &$row) {
|
||||
$addresses2[$row['bId']] = $row['bAddress'];
|
||||
$titles2[$row['bId']] = $row['bTitle'];
|
||||
$row = $bookmarkservice->getBookmark($row['bId'], true);
|
||||
$tags2[] = $row['tags'];
|
||||
}
|
||||
$alltags2 = array_unique(call_user_func_array('array_merge', $tags2));
|
||||
$commontags2 = call_user_func_array('array_intersect', $tags2);
|
||||
$tplVars['row'] = array(
|
||||
'bTitle' => $titles2,
|
||||
'bAddress' => $addresses2,
|
||||
'bDescription' => '',
|
||||
'bPrivateNote' => '',
|
||||
'tags' => array(),
|
||||
'bStatus' => $GLOBALS['defaults']['privacy']
|
||||
);
|
||||
$tplVars['batch'] = '1';
|
||||
$tplVars['alltags'] = implode(', ', $alltags2);
|
||||
$tplVars['commontags'] = implode(', ', $commontags2);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if(GET_COPYOF != '') { //copy from bookmarks page
|
||||
$tplVars['row'] = $bookmarkservice->getBookmark(intval(GET_COPYOF), true);
|
||||
if(!$currentUser->isAdmin()) {
|
||||
@ -266,12 +202,12 @@ if ($templatename == 'editbookmark.tpl') { // Prepare to display the edit bookma
|
||||
}
|
||||
}else { //copy from pop-up bookmarklet
|
||||
$tplVars['row'] = array(
|
||||
'bTitle' => array_map('stripslashes', $TITLE),
|
||||
'bAddress' => array_map('stripslashes', $ADDRESS),
|
||||
'bDescription' => stripslashes(GET_DESCRIPTION),
|
||||
'bPrivateNote' => stripslashes(GET_PRIVATENOTE),
|
||||
'tags' => (GET_TAGS ? explode(',', stripslashes(GET_TAGS)) : array()),
|
||||
'bStatus' => $GLOBALS['defaults']['privacy']
|
||||
'bTitle' => stripslashes(GET_TITLE),
|
||||
'bAddress' => stripslashes(GET_ADDRESS),
|
||||
'bDescription' => stripslashes(GET_DESCRIPTION),
|
||||
'bPrivateNote' => stripslashes(GET_PRIVATENOTE),
|
||||
'tags' => (GET_TAGS ? explode(',', stripslashes(GET_TAGS)) : array()),
|
||||
'bStatus' => $GLOBALS['defaults']['privacy']
|
||||
);
|
||||
}
|
||||
|
||||
@ -293,46 +229,20 @@ if ($templatename == 'editbookmark.tpl') { // Prepare to display the edit bookma
|
||||
$tplVars['sidebar_blocks'] = array('watchstatus');
|
||||
|
||||
if (!$cat) { //user page without tags
|
||||
$rssTitle = "My Bookmarks";
|
||||
$rssTitle = "My Bookmarks";
|
||||
$cat = NULL;
|
||||
$tplVars['currenttag'] = NULL;
|
||||
//$tplVars['sidebar_blocks'][] = 'menu2';
|
||||
$tplVars['sidebar_blocks'][] = 'linked';
|
||||
$tplVars['sidebar_blocks'][] = 'popular';
|
||||
} else { //pages with tags
|
||||
$rssTitle = "Tags" . $catTitle;
|
||||
$rssTitle = "Tags" . $catTitle;
|
||||
$rssCat = '/'. filter($cat, 'url');
|
||||
$tplVars['currenttag'] = $cat;
|
||||
$tplVars['sidebar_blocks'][] = 'tagactions';
|
||||
//$tplVars['sidebar_blocks'][] = 'menu2';
|
||||
|
||||
if (! empty($GLOBALS['shoulderSurfingProtectedTag']) && ! isset($_COOKIE["noshoulderSurfingProtection"])) {
|
||||
$tag2tagservice = SemanticScuttle_Service_Factory::get('Tag2Tag');
|
||||
$b2tservice = SemanticScuttle_Service_Factory::get('Bookmark2Tag');
|
||||
$alltags = $b2tservice->getTags($currentUserID);
|
||||
$shoulderSurfingProtectedTags = $tag2tagservice->getAllLinkedTags($GLOBALS['shoulderSurfingProtectedTag'], '>', $currentUserID, array());
|
||||
$shoulderSurfingProtectedTags[] = $GLOBALS['shoulderSurfingProtectedTag'];
|
||||
$flag = 0;
|
||||
if (! in_array($cat, $shoulderSurfingProtectedTags, true)) {
|
||||
foreach ($alltags as $tag) {
|
||||
if ($tag['tag'] === $cat) {
|
||||
$flag = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if ($flag) {
|
||||
$tplVars['sidebar_blocks'][] = 'tagactions';
|
||||
$tplVars['sidebar_blocks'][] = 'linked';
|
||||
$tplVars['sidebar_blocks'][] = 'related';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$tplVars['sidebar_blocks'][] = 'tagactions';
|
||||
$tplVars['sidebar_blocks'][] = 'linked';
|
||||
$tplVars['sidebar_blocks'][] = 'related';
|
||||
}
|
||||
|
||||
$tplVars['sidebar_blocks'][] = 'linked';
|
||||
$tplVars['sidebar_blocks'][] = 'related';
|
||||
/*$tplVars['sidebar_blocks'][] = 'menu';*/
|
||||
}
|
||||
$tplVars['sidebar_blocks'][] = 'menu2';
|
||||
@ -340,7 +250,7 @@ if ($templatename == 'editbookmark.tpl') { // Prepare to display the edit bookma
|
||||
//$tplVars['sidebar_blocks'][] = 'popular';
|
||||
|
||||
$tplVars['userid'] = $userid;
|
||||
$tplVars['userinfo'] = $userinfo;
|
||||
$tplVars['userinfo'] =& $userinfo;
|
||||
$tplVars['user'] = $user;
|
||||
$tplVars['range'] = 'user';
|
||||
|
||||
@ -363,32 +273,32 @@ if ($templatename == 'editbookmark.tpl') { // Prepare to display the edit bookma
|
||||
)
|
||||
);
|
||||
|
||||
if ($userservice->isLoggedOn()) {
|
||||
$currentUsername = $currentUser->getUsername();
|
||||
if ($userservice->isPrivateKeyValid($currentUser->getPrivateKey())) {
|
||||
array_push(
|
||||
$tplVars['rsschannels'],
|
||||
array(
|
||||
sprintf(
|
||||
T_('%s: %s (+private %s)'),
|
||||
$sitename, $rssTitle, $currentUsername
|
||||
),
|
||||
createURL('rss', filter($currentUsername, 'url'))
|
||||
. $rssCat
|
||||
. '?sort=' . getSortOrder()
|
||||
. '&privateKey=' . $currentUser->getPrivateKey()
|
||||
)
|
||||
);
|
||||
}
|
||||
if ($userservice->isLoggedOn()) {
|
||||
$currentUsername = $currentUser->getUsername();
|
||||
if ($userservice->isPrivateKeyValid($currentUser->getPrivateKey())) {
|
||||
array_push(
|
||||
$tplVars['rsschannels'],
|
||||
array(
|
||||
sprintf(
|
||||
T_('%s: %s (+private %s)'),
|
||||
$sitename, $rssTitle, $currentUsername
|
||||
),
|
||||
createURL('rss', filter($currentUsername, 'url'))
|
||||
. $rssCat
|
||||
. '?sort=' . getSortOrder()
|
||||
. '&privateKey=' . $currentUser->getPrivateKey()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$tplVars['page'] = $page;
|
||||
$tplVars['start'] = $start;
|
||||
$tplVars['bookmarkCount'] = $start + 1;
|
||||
|
||||
$bookmarks = $bookmarkservice->getBookmarks($start, $perpage, $userid, $cat, null, getSortOrder());
|
||||
$bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, $userid, $cat, null, getSortOrder());
|
||||
$tplVars['total'] = $bookmarks['total'];
|
||||
$tplVars['bookmarks'] = $bookmarks['bookmarks'];
|
||||
$tplVars['bookmarks'] =& $bookmarks['bookmarks'];
|
||||
$tplVars['cat_url'] = createURL('bookmarks', '%s/%s');
|
||||
$tplVars['nav_url'] = createURL('bookmarks', '%s/%s%s');
|
||||
if ($userservice->isLoggedOn() && $user == $currentUsername) {
|
||||
|
30
www/edit.php
30
www/edit.php
@ -29,12 +29,8 @@ $bookmarkservice = SemanticScuttle_Service_Factory :: get('Bookmark');
|
||||
isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', '');
|
||||
isset($_POST['delete']) ? define('POST_DELETE', $_POST['delete']): define('POST_DELETE', '');
|
||||
|
||||
// define does not support arrays before PHP version 7
|
||||
isset($_POST['title']) ? $TITLE = $_POST['title']: $TITLE = array();
|
||||
//isset($_POST['title']) ? define('POST_TITLE', $_POST['title']): define('POST_TITLE', '');
|
||||
isset($_POST['address']) ? $ADDRESS = $_POST['address']: $ADDRESS = array();
|
||||
//isset($_POST['address']) ? define('POST_ADDRESS', $_POST['address']): define('POST_ADDRESS', '');
|
||||
|
||||
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['privateNote']) ? define('POST_PRIVATENOTE', $_POST['privateNote']): define('POST_PRIVATENOTE', '');
|
||||
isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', $GLOBALS['defaults']['privacy']);
|
||||
@ -44,14 +40,6 @@ 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', '');
|
||||
|
||||
if (! is_array($ADDRESS)) {
|
||||
$ADDRESS = array($ADDRESS);
|
||||
}
|
||||
|
||||
if (! is_array($TITLE)) {
|
||||
$TITLE = array($TITLE);
|
||||
}
|
||||
|
||||
// Header variables
|
||||
$tplVars['pagetitle'] = T_('Edit Bookmark');
|
||||
$tplVars['subtitle'] = T_('Edit Bookmark');
|
||||
@ -64,24 +52,28 @@ if (!($row = $bookmarkservice->getBookmark(intval($bookmark), true))) {
|
||||
$templateservice->loadTemplate('error.404.tpl', $tplVars);
|
||||
exit();
|
||||
} else {
|
||||
|
||||
if (!$bookmarkservice->editAllowed($row)) {
|
||||
$tplVars['error'] = T_('You are not allowed to edit this bookmark');
|
||||
$templateservice->loadTemplate('error.500.tpl', $tplVars);
|
||||
exit();
|
||||
} else if (POST_SUBMITTED != '') {
|
||||
if (!$TITLE || !$ADDRESS) {
|
||||
|
||||
|
||||
|
||||
if (!POST_TITLE || !POST_ADDRESS) {
|
||||
$tplVars['error'] = T_('Your bookmark must have a title and an address');
|
||||
} else {
|
||||
// Update bookmark
|
||||
$bId = intval($bookmark);
|
||||
$address = array_map('trim', $ADDRESS);
|
||||
$title = array_map('trim', $TITLE);
|
||||
$address = trim(POST_ADDRESS);
|
||||
$title = trim(POST_TITLE);
|
||||
$description = trim(POST_DESCRIPTION);
|
||||
$privateNote = trim(POST_PRIVATENOTE);
|
||||
$status = intval(POST_STATUS);
|
||||
$tags = trim(POST_TAGS);
|
||||
|
||||
if (!$bookmarkservice->updateBookmark($bId, $address[0], $title[0], $description, $privateNote, $status, $tags)) {
|
||||
if (!$bookmarkservice->updateBookmark($bId, $address, $title, $description, $privateNote, $status, $tags)) {
|
||||
$tplvars['error'] = T_('Error while saving your bookmark');
|
||||
} else {
|
||||
if (POST_POPUP != '') {
|
||||
@ -116,7 +108,7 @@ if (!($row = $bookmarkservice->getBookmark(intval($bookmark), true))) {
|
||||
}
|
||||
|
||||
$tplVars['popup'] = (GET_POPUP) ? GET_POPUP : null;
|
||||
$tplVars['row'] = $row;
|
||||
$tplVars['row'] =& $row;
|
||||
$tplVars['formaction'] = createURL('edit', $bookmark);
|
||||
$tplVars['btnsubmit'] = T_('Save Changes');
|
||||
$tplVars['showdelete'] = true;
|
||||
|
@ -55,9 +55,9 @@ if (intval(GET_PAGE) > 1) {
|
||||
$start = 0;
|
||||
}
|
||||
|
||||
if ($bookmark = $bookmarkservice->getBookmarkByHash($hash)) {
|
||||
if ($bookmark =& $bookmarkservice->getBookmarkByHash($hash)) {
|
||||
// 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['subtitle'] = sprintf(T_('History for %s'), $bookmark['bAddress']);
|
||||
$tplVars['loadjs'] = true;
|
||||
@ -65,7 +65,7 @@ if ($bookmark = $bookmarkservice->getBookmarkByHash($hash)) {
|
||||
$tplVars['start'] = $start;
|
||||
$tplVars['bookmarkCount'] = $start + 1;
|
||||
$tplVars['total'] = $bookmarks['total'];
|
||||
$tplVars['bookmarks'] = $bookmarks['bookmarks'];
|
||||
$tplVars['bookmarks'] =& $bookmarks['bookmarks'];
|
||||
$tplVars['hash'] = $hash;
|
||||
$tplVars['popCount'] = 50;
|
||||
$tplVars['sidebar_blocks'] = array('common');
|
||||
|
@ -120,14 +120,14 @@ function startElement($parser, $name, $attrs) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isset($depth[(int)$parser])) {
|
||||
$depth[(int)$parser] = 0;
|
||||
if (!isset($depth[$parser])) {
|
||||
$depth[$parser] = 0;
|
||||
}
|
||||
$depth[(int)$parser]++;
|
||||
$depth[$parser]++;
|
||||
}
|
||||
|
||||
function endElement($parser, $name) {
|
||||
global $depth;
|
||||
$depth[(int)$parser]--;
|
||||
$depth[$parser]--;
|
||||
}
|
||||
?>
|
||||
|
@ -20,13 +20,6 @@
|
||||
***************************************************************************/
|
||||
|
||||
require_once 'www-header.php';
|
||||
if ('@data_dir@' == '@' . 'data_dir@') {
|
||||
//non pear-install
|
||||
require_once dirname(__FILE__) . '/../src/SemanticScuttle/parse_netscape_bookmarks.php';
|
||||
} else {
|
||||
//pear installation; files are in include path
|
||||
require_once 'SemanticScuttle/parse_netscape_bookmarks.php';
|
||||
}
|
||||
|
||||
/* Service creation: only useful services are created */
|
||||
$bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
|
||||
@ -51,45 +44,78 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
|
||||
|
||||
// File handle
|
||||
$html = file_get_contents($_FILES['userfile']['tmp_name']);
|
||||
// Create array
|
||||
$matches = parse_netscape_bookmarks($html);
|
||||
//var_dump($matches);
|
||||
|
||||
$size = count($matches);
|
||||
// Create link array
|
||||
//preg_match_all('/<a\s+(.*?)\s*\/*>([^<]*)/si', $html, $matches);
|
||||
preg_match_all('/<a\s+(.*?)>([^<]*?)<\/a>.*?(<dd>([^<]*)|<dt>)/si', $html, $matches);
|
||||
|
||||
//var_dump($matches);die();
|
||||
|
||||
|
||||
$links = $matches[1];
|
||||
$titles = $matches[2];
|
||||
$descriptions = $matches[4];
|
||||
|
||||
$size = count($links);
|
||||
for ($i = 0; $i < $size; $i++) {
|
||||
$bDatetime = gmdate('Y-m-d H:i:s', $matches[$i]['time']); //bDateTime optional
|
||||
$bCategories = $matches[$i]['tags']; //bCategories optional
|
||||
$bAddress = $matches[$i]['uri'];
|
||||
$bDescription = $matches[$i]['note'];
|
||||
$bTitle = $matches[$i]['title'];
|
||||
$bPrivateNote = '';
|
||||
|
||||
// echo "<hr/>";
|
||||
// echo $links[$i]."<br/>";
|
||||
|
||||
preg_match_all('/(\w*\s*=\s*"[^"]*")/', $links[$i], $attributes);
|
||||
//$attributes = $attributes[0]; // we keep just one row
|
||||
|
||||
$bDatetime = ""; //bDateTime optional
|
||||
$bCategories = ""; //bCategories optional
|
||||
$bPrivateNote = ""; //bPrivateNote optional
|
||||
$bPrivate = $status; //bPrivate set default
|
||||
|
||||
foreach ($attributes[0] as $attribute) {
|
||||
$att = preg_split('/\s*=\s*/s', $attribute, 2);
|
||||
$attrTitle = $att[0];
|
||||
|
||||
$attrVal = str_replace(
|
||||
'"', '"',
|
||||
preg_replace('/([\'"]?)(.*)\1/', '$2', $att[1])
|
||||
);
|
||||
|
||||
switch ($attrTitle) {
|
||||
case "HREF":
|
||||
$bAddress = $attrVal;
|
||||
break;
|
||||
case "ADD_DATE":
|
||||
$bDatetime = gmdate('Y-m-d H:i:s', $attrVal);
|
||||
break;
|
||||
case "TAGS":
|
||||
$bCategories = $attrVal;
|
||||
break;
|
||||
case "NOTE":
|
||||
$bPrivateNote = $attrVal;
|
||||
break;
|
||||
case "PRIVATE":
|
||||
if ($attrVal) {
|
||||
$bPrivate = 2;//private
|
||||
}
|
||||
}
|
||||
}
|
||||
$bTitle = trim($titles[$i]);
|
||||
$bDescription = trim($descriptions[$i]);
|
||||
|
||||
if ($bookmarkservice->bookmarkExists($bAddress, $userservice->getCurrentUserId())) {
|
||||
//$tplVars['error'] = T_('You have already submitted some of these bookmarks.');
|
||||
// If the bookmark exists already, edit the original
|
||||
$bookmark = $bookmarkservice->getBookmarkByAddress($bAddress);
|
||||
$bId = intval($bookmark['bId']);
|
||||
$row = $bookmarkservice->getBookmark($bId, true);
|
||||
$categories = array_unique(array_merge($row['tags'], $bCategories));
|
||||
//var_dump('update', $bId, $bAddress, $row['bTitle'], $row['bDescription'], $row['bPrivateNote'], $row['bStatus'], $categories);
|
||||
if ($bookmarkservice->updateBookmark($bId, $bAddress, $row['bTitle'], $row['bDescription'], $row['bPrivateNote'], $row['bStatus'], $categories)) {
|
||||
$countImportedBookmarks++;
|
||||
}
|
||||
else {
|
||||
$tplvars['error'] = T_('Error while saving this bookmark : ' + $bAddress);
|
||||
}
|
||||
$tplVars['error'] = T_('You have already submitted some of these bookmarks.');
|
||||
} else {
|
||||
// If bookmark is local (like javascript: or place: in Firefox3), do nothing
|
||||
if(substr($bAddress, 0, 7) == "http://" || substr($bAddress, 0, 8) == "https://") {
|
||||
|
||||
// If bookmark claims to be from the future, set it to be now instead
|
||||
if (strtotime($bDatetime) > time()) {
|
||||
$bDatetime = gmdate('Y-m-d H:i:s');
|
||||
}
|
||||
//var_dump('add ', $bAddress, $bTitle, $bDescription, $bPrivateNote, $status, $bCategories, $bDatetime);
|
||||
if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, $bPrivateNote, $status, $bCategories, null, $bDatetime, false, true)) {
|
||||
|
||||
if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, $bPrivateNote, $bPrivate, $bCategories, null, $bDatetime, false, true)) {
|
||||
$countImportedBookmarks++;
|
||||
} else {
|
||||
$tplVars['error'] = T_('There was an error saving your bookmark : ' . $bAddress . ' Please try again or contact the administrator.');
|
||||
$tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -107,5 +133,4 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
|
||||
$tplVars['formaction'] = createURL('importNetscape');
|
||||
$templateservice->loadTemplate($templatename, $tplVars);
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -100,7 +100,7 @@ $tplVars['bookmarkCount'] = $start + 1;
|
||||
$bookmarks = $bookmarkservice->getBookmarks($start, $perpage, NULL, NULL, NULL, getSortOrder(), NULL, 0, NULL);
|
||||
|
||||
$tplVars['total'] = $bookmarks['total'];
|
||||
$tplVars['bookmarks'] = $bookmarks['bookmarks'];
|
||||
$tplVars['bookmarks'] =& $bookmarks['bookmarks'];
|
||||
$tplVars['cat_url'] = createURL('bookmarks', '%1$s/%2$s');
|
||||
$tplVars['nav_url'] = createURL('index', '%3$s');
|
||||
$tplVars['summarizeLinkedTags'] = true;
|
||||
|
@ -1,117 +0,0 @@
|
||||
/*!
|
||||
* jQuery Cookie Plugin v1.4.1
|
||||
* https://github.com/carhartl/jquery-cookie
|
||||
*
|
||||
* Copyright 2013 Klaus Hartl
|
||||
* Released under the MIT license
|
||||
*/
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// CommonJS
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
|
||||
var pluses = /\+/g;
|
||||
|
||||
function encode(s) {
|
||||
return config.raw ? s : encodeURIComponent(s);
|
||||
}
|
||||
|
||||
function decode(s) {
|
||||
return config.raw ? s : decodeURIComponent(s);
|
||||
}
|
||||
|
||||
function stringifyCookieValue(value) {
|
||||
return encode(config.json ? JSON.stringify(value) : String(value));
|
||||
}
|
||||
|
||||
function parseCookieValue(s) {
|
||||
if (s.indexOf('"') === 0) {
|
||||
// This is a quoted cookie as according to RFC2068, unescape...
|
||||
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
||||
}
|
||||
|
||||
try {
|
||||
// Replace server-side written pluses with spaces.
|
||||
// If we can't decode the cookie, ignore it, it's unusable.
|
||||
// If we can't parse the cookie, ignore it, it's unusable.
|
||||
s = decodeURIComponent(s.replace(pluses, ' '));
|
||||
return config.json ? JSON.parse(s) : s;
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
function read(s, converter) {
|
||||
var value = config.raw ? s : parseCookieValue(s);
|
||||
return $.isFunction(converter) ? converter(value) : value;
|
||||
}
|
||||
|
||||
var config = $.cookie = function (key, value, options) {
|
||||
|
||||
// Write
|
||||
|
||||
if (value !== undefined && !$.isFunction(value)) {
|
||||
options = $.extend({}, config.defaults, options);
|
||||
|
||||
if (typeof options.expires === 'number') {
|
||||
var days = options.expires, t = options.expires = new Date();
|
||||
t.setTime(+t + days * 864e+5);
|
||||
}
|
||||
|
||||
return (document.cookie = [
|
||||
encode(key), '=', stringifyCookieValue(value),
|
||||
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
||||
options.path ? '; path=' + options.path : '',
|
||||
options.domain ? '; domain=' + options.domain : '',
|
||||
options.secure ? '; secure' : ''
|
||||
].join(''));
|
||||
}
|
||||
|
||||
// Read
|
||||
|
||||
var result = key ? undefined : {};
|
||||
|
||||
// To prevent the for loop in the first place assign an empty array
|
||||
// in case there are no cookies at all. Also prevents odd result when
|
||||
// calling $.cookie().
|
||||
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||
|
||||
for (var i = 0, l = cookies.length; i < l; i++) {
|
||||
var parts = cookies[i].split('=');
|
||||
var name = decode(parts.shift());
|
||||
var cookie = parts.join('=');
|
||||
|
||||
if (key && key === name) {
|
||||
// If second argument (value) is a function it's a converter...
|
||||
result = read(cookie, value);
|
||||
break;
|
||||
}
|
||||
|
||||
// Prevent storing a cookie that we couldn't decode.
|
||||
if (!key && (cookie = read(cookie)) !== undefined) {
|
||||
result[name] = cookie;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
config.defaults = {};
|
||||
|
||||
$.removeCookie = function (key, options) {
|
||||
if ($.cookie(key) === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Must not alter options, thus extending a fresh object...
|
||||
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
|
||||
return !$.cookie(key);
|
||||
};
|
||||
|
||||
}));
|
@ -61,7 +61,7 @@ if (isset($user) && $user != '') {
|
||||
}
|
||||
|
||||
$tags = $b2tservice->getPopularTags($userid, 150);
|
||||
$tplVars['tags'] = $b2tservice->tagCloud($tags, 5, 90, 225, getSortOrder('alphabet_asc'));
|
||||
$tplVars['tags'] =& $b2tservice->tagCloud($tags, 5, 90, 225, getSortOrder('alphabet_asc'));
|
||||
$tplVars['user'] = $user;
|
||||
|
||||
if (isset($userid)) {
|
||||
|
@ -56,7 +56,7 @@ if ($user) {
|
||||
$templateservice->loadTemplate('error.404.tpl', $tplVars);
|
||||
exit();
|
||||
} else {
|
||||
$userid = $userinfo->getId();
|
||||
$userid =& $userinfo->getId();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -34,7 +34,6 @@ if (!$GLOBALS['enableRegistration']) {
|
||||
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['password2']) ? define('POST_PASS2', $_POST['password2']): define('POST_PASS2', '');
|
||||
if (isset($_POST['email'])) {
|
||||
define('POST_MAIL', $_POST['email']);
|
||||
} else if (isset($_SERVER['SSL_CLIENT_S_DN_Email'])) {
|
||||
@ -52,10 +51,6 @@ if (POST_SUBMITTED != '') {
|
||||
if (!($posteduser) || POST_PASS == '' || POST_MAIL == '') {
|
||||
$tplVars['error'] = T_('You <em>must</em> enter a username, password and e-mail address.');
|
||||
|
||||
// Check if passwords match
|
||||
} elseif (POST_PASS != POST_PASS2) {
|
||||
$tplVars['error'] = T_('Those passwords do not match.');
|
||||
|
||||
// Check if username is reserved
|
||||
} elseif ($userservice->isReserved($posteduser)) {
|
||||
$tplVars['error'] = T_('This username has been reserved, please make another choice.');
|
||||
|
@ -82,7 +82,7 @@ if ($user && $user != 'all') {
|
||||
$userid = intval($user);
|
||||
} else {
|
||||
if ($userinfo = $userservice->getUserByUsername($user)) {
|
||||
$userid = $userinfo[$userservice->getFieldName('primary')];
|
||||
$userid =& $userinfo[$userservice->getFieldName('primary')];
|
||||
/* if user is not logged in and has valid privateKey */
|
||||
if (!$userservice->isLoggedOn()) {
|
||||
if ($privateKey != null) {
|
||||
|
@ -26,7 +26,7 @@ isset($_POST['terms']) ? define('POST_TERMS', $_POST['terms']): define('POST_TER
|
||||
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', '');
|
||||
isset($_GET['batch']) ? define('GET_BATCH', $_GET['batch']): define('GET_BATCH', 0);
|
||||
|
||||
|
||||
// POST
|
||||
if (POST_TERMS != '') {
|
||||
@ -115,42 +115,7 @@ if (is_null($terms)) {
|
||||
|
||||
}
|
||||
}
|
||||
if ($userservice->isLoggedOn() && GET_BATCH) {
|
||||
$currentUsername = $currentUser->getUsername();
|
||||
$completebookmarks = $bookmarkservice->getBookmarks(0, null, $s_user, null, $terms, getSortOrder(),
|
||||
$s_watchlist, $s_start, $s_end);
|
||||
$templatename = 'editbookmark.tpl';
|
||||
$addresses2 = array();
|
||||
$titles2 = array();
|
||||
$tags2 = array();
|
||||
foreach ($completebookmarks['bookmarks'] as $key => &$row) {
|
||||
$addresses2[$row['bId']] = $row['bAddress'];
|
||||
$titles2[$row['bId']] = $row['bTitle'];
|
||||
$row = $bookmarkservice->getBookmark($row['bId'], true);
|
||||
$tags2[] = $row['tags'];
|
||||
}
|
||||
$alltags2 = array_unique(call_user_func_array('array_merge', $tags2));
|
||||
$commontags2 = call_user_func_array('array_intersect', $tags2);
|
||||
$tplVars['row'] = array(
|
||||
'bTitle' => $titles2,
|
||||
'bAddress' => $addresses2,
|
||||
'bDescription' => '',
|
||||
'bPrivateNote' => '',
|
||||
'tags' => array(),
|
||||
'bStatus' => $GLOBALS['defaults']['privacy']
|
||||
);
|
||||
$tplVars['pagetitle'] = T_('Add a Bookmark');
|
||||
$tplVars['subtitle'] = T_('Add a Bookmark');
|
||||
$tplVars['btnsubmit'] = T_('Add Bookmark');
|
||||
$tplVars['popup'] = null;
|
||||
$tplVars['batch'] = '1';
|
||||
$tplVars['alltags'] = implode(', ', $alltags2);
|
||||
$tplVars['commontags'] = implode(', ', $commontags2);
|
||||
$tplVars['formaction'] = createURL('bookmarks', $currentUsername);
|
||||
$templateservice->loadTemplate($templatename, $tplVars);
|
||||
}
|
||||
else {
|
||||
$bookmarks = $bookmarkservice->getBookmarks(
|
||||
$bookmarks =& $bookmarkservice->getBookmarks(
|
||||
$start, $perpage, $s_user, NULL, $terms, getSortOrder(),
|
||||
$s_watchlist, $s_start, $s_end
|
||||
);
|
||||
@ -182,10 +147,9 @@ $tplVars['terms'] = $terms;
|
||||
$tplVars['pagetitle'] = T_('Search Bookmarks');
|
||||
$tplVars['bookmarkCount'] = $start + 1;
|
||||
$tplVars['total'] = $bookmarks['total'];
|
||||
$tplVars['bookmarks'] = $bookmarks['bookmarks'];
|
||||
$tplVars['bookmarks'] =& $bookmarks['bookmarks'];
|
||||
$tplVars['cat_url'] = createURL('tags', '%2$s');
|
||||
$tplVars['nav_url'] = createURL('search', $range .'/'. $terms .'/%3$s');
|
||||
|
||||
$templateservice->loadTemplate('bookmarks.tpl', $tplVars);
|
||||
}
|
||||
?>
|
||||
|
@ -63,7 +63,7 @@ if (POST_CONFIRM != '') {
|
||||
}
|
||||
|
||||
$tplVars['links'] = $tag2tagservice->getLinks($currentUser->getId());
|
||||
$tplVars['loadjs'] = true;
|
||||
|
||||
$tplVars['tag1'] = $tag1;
|
||||
$tplVars['tag2'] = '';
|
||||
$tplVars['subtitle'] = T_('Add Tag Link') .': '. $tag1;
|
||||
|
@ -75,7 +75,7 @@ if (POST_CONFIRM) {
|
||||
}
|
||||
|
||||
$tplVars['links'] = $tag2tagservice->getLinks($currentUser->getId());
|
||||
$tplVars['loadjs'] = true;
|
||||
|
||||
$tplVars['tag1'] = $tag1;
|
||||
$tplVars['tag2'] = $tag2;
|
||||
$tplVars['subtitle'] = T_('Delete Link Between Tags') .': '. $tag1.' > '.$tag2;
|
||||
|
@ -73,7 +73,6 @@ if (POST_CONFIRM) {
|
||||
$tplVars['formaction'] = $_SERVER['SCRIPT_NAME'] .'/'. $tag;
|
||||
$tplVars['referrer'] = $_SERVER['HTTP_REFERER'];
|
||||
$tplVars['old'] = $tag;
|
||||
$tplVars['loadjs'] = true;
|
||||
}
|
||||
$templateservice->loadTemplate($template, $tplVars);
|
||||
?>
|
||||
|
78
www/tags.php
78
www/tags.php
@ -20,6 +20,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
require_once 'www-header.php';
|
||||
|
||||
/* Service creation: only useful services are created */
|
||||
$bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
|
||||
$cacheservice =SemanticScuttle_Service_Factory::get('Cache');
|
||||
@ -27,7 +28,6 @@ $cacheservice =SemanticScuttle_Service_Factory::get('Cache');
|
||||
/* 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', '');
|
||||
isset($_GET['batch']) ? define('GET_BATCH', $_GET['batch']): define('GET_BATCH', 0);
|
||||
|
||||
/* Managing current logged user */
|
||||
$currentUser = $userservice->getCurrentObjectUser();
|
||||
@ -63,43 +63,6 @@ if ($usecache) {
|
||||
$cacheservice->Start($hash, 1800);
|
||||
}
|
||||
|
||||
// We need all bookmarks (without paging) for batch tagging.
|
||||
if ($userservice->isLoggedOn() && GET_BATCH) {
|
||||
$currentUsername = $currentUser->getUsername();
|
||||
$completebookmarks = $bookmarkservice->getBookmarks(0, null, null, $cat, null, getSortOrder());
|
||||
$templatename = 'editbookmark.tpl';
|
||||
$addresses2 = array();
|
||||
$titles2 = array();
|
||||
$tags2 = array();
|
||||
foreach ($completebookmarks['bookmarks'] as $key => &$row) {
|
||||
$addresses2[$row['bId']] = $row['bAddress'];
|
||||
$titles2[$row['bId']] = $row['bTitle'];
|
||||
$row = $bookmarkservice->getBookmark($row['bId'], true);
|
||||
$tags2[] = $row['tags'];
|
||||
}
|
||||
$alltags2 = array_unique(call_user_func_array('array_merge', $tags2));
|
||||
$commontags2 = call_user_func_array('array_intersect', $tags2);
|
||||
$tplVars['row'] = array(
|
||||
'bTitle' => $titles2,
|
||||
'bAddress' => $addresses2,
|
||||
'bDescription' => '',
|
||||
'bPrivateNote' => '',
|
||||
'tags' => array(),
|
||||
'bStatus' => $GLOBALS['defaults']['privacy']
|
||||
);
|
||||
$tplVars['pagetitle'] = T_('Add a Bookmark');
|
||||
$tplVars['subtitle'] = T_('Add a Bookmark');
|
||||
$tplVars['btnsubmit'] = T_('Add Bookmark');
|
||||
$tplVars['popup'] = null;
|
||||
$tplVars['batch'] = '1';
|
||||
$tplVars['alltags'] = implode(', ', $alltags2);
|
||||
$tplVars['commontags'] = implode(', ', $commontags2);
|
||||
$tplVars['formaction'] = createURL('bookmarks', $currentUsername);
|
||||
$tplVars['loadjs'] = true;
|
||||
$templateservice->loadTemplate($templatename, $tplVars);
|
||||
}
|
||||
else {
|
||||
|
||||
// Header variables
|
||||
$tplVars['pagetitle'] = T_('Tags') .': '. $cat;
|
||||
$tplVars['loadjs'] = true;
|
||||
@ -143,48 +106,17 @@ $tplVars['page'] = $page;
|
||||
$tplVars['start'] = $start;
|
||||
$tplVars['popCount'] = 25;
|
||||
$tplVars['currenttag'] = $cat;
|
||||
|
||||
if ($userservice->isLoggedOn() && ! empty($GLOBALS['shoulderSurfingProtectedTag']) && ! isset($_COOKIE["noshoulderSurfingProtection"])) {
|
||||
$tag2tagservice = SemanticScuttle_Service_Factory::get('Tag2Tag');
|
||||
$b2tservice = SemanticScuttle_Service_Factory::get('Bookmark2Tag');
|
||||
$currentUserID = $currentUser->getId();
|
||||
$alltags = $b2tservice->getTags($currentUserID);
|
||||
$shoulderSurfingProtectedTags = $tag2tagservice->getAllLinkedTags($GLOBALS['shoulderSurfingProtectedTag'], '>', $currentUserID, array());
|
||||
$shoulderSurfingProtectedTags[] = $GLOBALS['shoulderSurfingProtectedTag'];
|
||||
$flag = 0;
|
||||
if (! in_array($cat, $shoulderSurfingProtectedTags, true)) {
|
||||
foreach ($alltags as $tag) {
|
||||
if ($tag['tag'] === $cat) {
|
||||
$flag = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if ($flag) {
|
||||
$tplVars['sidebar_blocks'][] = 'tagactions';
|
||||
$tplVars['sidebar_blocks'][] = 'linked';
|
||||
$tplVars['sidebar_blocks'][] = 'related';
|
||||
$tplVars['sidebar_blocks'][] = 'menu2';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$tplVars['sidebar_blocks'][] = 'tagactions';
|
||||
$tplVars['sidebar_blocks'][] = 'linked';
|
||||
$tplVars['sidebar_blocks'][] = 'related';
|
||||
$tplVars['sidebar_blocks'][] = 'menu2';
|
||||
}
|
||||
|
||||
$tplVars['sidebar_blocks'] = array('linked', 'related', 'menu2');//array('linked', 'related', 'popular');
|
||||
$tplVars['subtitlehtml'] = $pagetitle;
|
||||
$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['bookmarks'] = $bookmarks['bookmarks'];
|
||||
$tplVars['bookmarks'] =& $bookmarks['bookmarks'];
|
||||
$tplVars['cat_url'] = createURL('bookmarks', '%1$s/%2$s');
|
||||
$tplVars['nav_url'] = createURL('tags', '%2$s%3$s');
|
||||
|
||||
$templateservice->loadTemplate('bookmarks.tpl', $tplVars);
|
||||
}
|
||||
|
||||
if ($usecache) {
|
||||
// Cache output if existing copy has expired
|
||||
$cacheservice->End($hash);
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB |
@ -110,8 +110,7 @@ html > body h1 {
|
||||
padding-left: 75px;
|
||||
}
|
||||
html > body div#header.popup h1 {
|
||||
background: url('images/logo.png') no-repeat 10px;
|
||||
background-size: 24px;
|
||||
background: url('images/logo_24.gif') no-repeat 10px;
|
||||
padding: 0.5em 0.5em 0.5em 50px;
|
||||
}
|
||||
/*html > body div#header #welcome {
|
||||
@ -196,6 +195,7 @@ img.thumbnail {
|
||||
padding: 1px;
|
||||
margin-right: 6px;
|
||||
margin-bottom:4px;
|
||||
cursor:pointer;
|
||||
border:1px solid #AAA;
|
||||
}
|
||||
div.link a {
|
||||
|
@ -49,7 +49,7 @@ $tplVars['loadjs'] = true;
|
||||
$tplVars['sidebar_blocks'] = array('recent', 'popular');
|
||||
$tplVars['subtitle'] = filter($pagetitle);
|
||||
|
||||
$tplVars['users'] = $userservice->getUsers();
|
||||
$tplVars['users'] =& $userservice->getUsers();
|
||||
//$tplVars['cat_url'] = createURL('tags', '%2$s');
|
||||
//$tplVars['nav_url'] = createURL('tags', '%2$s%3$s');
|
||||
|
||||
|
@ -62,7 +62,7 @@ if ($user) {
|
||||
$templateservice->loadTemplate('error.404.tpl', $tplVars);
|
||||
exit();
|
||||
} else {
|
||||
$userid = $userinfo->getId();
|
||||
$userid =& $userinfo->getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -73,7 +73,7 @@ $tplVars['loadjs'] = true;
|
||||
if ($user) {
|
||||
$tplVars['user'] = $user;
|
||||
$tplVars['userid'] = $userid;
|
||||
$tplVars['userinfo'] = $userinfo;
|
||||
$tplVars['userinfo'] =& $userinfo;
|
||||
|
||||
// Pagination
|
||||
$perpage = getPerPageCount($currentUser);
|
||||
@ -91,12 +91,12 @@ if ($user) {
|
||||
$tplVars['start'] = $start;
|
||||
$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['watched'] = true;
|
||||
$tplVars['total'] = $bookmarks['total'];
|
||||
$tplVars['bookmarks'] = $bookmarks['bookmarks'];
|
||||
$tplVars['bookmarks'] =& $bookmarks['bookmarks'];
|
||||
$tplVars['cat_url'] = createURL('tags', '%2$s');
|
||||
$tplVars['nav_url'] = createURL('watchlist', '%s/%s%s');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user