From 05c23695077062ea6948b7c5603848e941c6e9df Mon Sep 17 00:00:00 2001
From: cweiske
Date: Sat, 20 Feb 2010 11:04:51 +0000
Subject: replace some strange foreach constructs with the proper variant
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@660 b3834d28-1941-0410-a4f8-b48e95affb8f
---
data/templates/bookmarks.tpl.php | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
(limited to 'data/templates/bookmarks.tpl.php')
diff --git a/data/templates/bookmarks.tpl.php b/data/templates/bookmarks.tpl.php
index 0e9ac95..0050ec8 100644
--- a/data/templates/bookmarks.tpl.php
+++ b/data/templates/bookmarks.tpl.php
@@ -217,8 +217,7 @@ if($currenttag!= '') {
id="bookmarks">
&$row) {
switch ($row['bStatus']) {
case 0:
$access = '';
@@ -234,9 +233,7 @@ if($currenttag!= '') {
$cats = '';
$tagsForCopy = '';
$tags = $row['tags'];
- foreach(array_keys($tags) as $key) {
-
- $tag =& $tags[$key];
+ foreach ($tags as $tkey => &$tag) {
$cats .= ''. filter($tag) .', ';
$tagsForCopy.= $tag.',';
}
--
cgit v1.2.3-54-g00ecf
From fe522e57197133d3a4a09425bf2067418a6f3c7c Mon Sep 17 00:00:00 2001
From: cweiske
Date: Sat, 20 Feb 2010 11:06:12 +0000
Subject: first sql optimization: fetch countOthers() for all bookmarks at once
instead of each single
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@661 b3834d28-1941-0410-a4f8-b48e95affb8f
---
data/templates/bookmarks.tpl.php | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
(limited to 'data/templates/bookmarks.tpl.php')
diff --git a/data/templates/bookmarks.tpl.php b/data/templates/bookmarks.tpl.php
index 0050ec8..b1a6eb0 100644
--- a/data/templates/bookmarks.tpl.php
+++ b/data/templates/bookmarks.tpl.php
@@ -216,7 +216,13 @@ if($currenttag!= '') {
0 ? ' start="'. ++$start .'"' : ''); ?>
id="bookmarks">
- &$row) {
+ $addresses[$row['bId']] = $row['bAddress'];
+ }
+ $otherCounts = $bookmarkservice->countOthers($addresses);
+
foreach ($bookmarks as $key => &$row) {
switch ($row['bStatus']) {
case 0:
@@ -261,7 +267,7 @@ if($currenttag!= '') {
// Udders!
if (!isset($hash)) {
- $others = $bookmarkservice->countOthers($row['bAddress']);
+ $others = $otherCounts[$row['bAddress']];
$ostart = '';
$oend = '';
switch ($others) {
--
cgit v1.2.3-54-g00ecf
From 40ca013e42ff64f5c88e31077e9e816cc3b7e581 Mon Sep 17 00:00:00 2001
From: cweiske
Date: Sat, 20 Feb 2010 11:20:32 +0000
Subject: sql optimization: 9 queries less!
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@670 b3834d28-1941-0410-a4f8-b48e95affb8f
---
data/templates/bookmarks.tpl.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'data/templates/bookmarks.tpl.php')
diff --git a/data/templates/bookmarks.tpl.php b/data/templates/bookmarks.tpl.php
index b1a6eb0..8f502d3 100644
--- a/data/templates/bookmarks.tpl.php
+++ b/data/templates/bookmarks.tpl.php
@@ -307,7 +307,7 @@ if($currenttag!= '') {
}
// Admin specific design
- if($userservice->isAdmin($row['uId'])) {
+ if ($userservice->isAdmin($row['username'])) {
$adminBgClass = 'class="adminBackground"';
$adminStar = '
';
} else {
--
cgit v1.2.3-54-g00ecf
From 53f0a57de09b8a2b0155042eaa433afd06ac682e Mon Sep 17 00:00:00 2001
From: cweiske
Date: Sat, 20 Feb 2010 11:41:01 +0000
Subject: sql optimization: reduce by 9 sql queries when logged in and looking
at bookmarks
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@681 b3834d28-1941-0410-a4f8-b48e95affb8f
---
data/templates/bookmarks.tpl.php | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
(limited to 'data/templates/bookmarks.tpl.php')
diff --git a/data/templates/bookmarks.tpl.php b/data/templates/bookmarks.tpl.php
index 8f502d3..ad2ecd3 100644
--- a/data/templates/bookmarks.tpl.php
+++ b/data/templates/bookmarks.tpl.php
@@ -222,6 +222,11 @@ if($currenttag!= '') {
$addresses[$row['bId']] = $row['bAddress'];
}
$otherCounts = $bookmarkservice->countOthers($addresses);
+ if ($userservice->isLoggedOn()) {
+ $existence = $bookmarkservice->bookmarksExist(
+ $addresses, $currentUser->getId()
+ );
+ }
foreach ($bookmarks as $key => &$row) {
switch ($row['bStatus']) {
@@ -284,7 +289,7 @@ if($currenttag!= '') {
// Copy link
if ($userservice->isLoggedOn()
&& ($currentUser->getId() != $row['uId'])
- && !$bookmarkservice->bookmarkExists($row['bAddress'], $currentUser->getId())
+ && !$existence[$row['bAddress']]
) {
$copy .= ' - ';
} else {
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 05757ac..65ed2e2 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -5,6 +5,7 @@ ChangeLog for SemantiScuttle
-------------------
- Many SQL optimizations
- New config option to skip "SET NAMES UTF8" call: $dbneedssetnames
+- Do not highlight admin bookmarks when $enableAdminColors is disabled
0.96.1 - 2010-02-09
--
cgit v1.2.3-54-g00ecf
From b18869f6d769c18d19fd937683352e0ea7a54939 Mon Sep 17 00:00:00 2001
From: cweiske
Date: Fri, 19 Mar 2010 07:43:42 +0000
Subject: remove another 9 queries for logged in users!
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@696 b3834d28-1941-0410-a4f8-b48e95affb8f
---
data/templates/bookmarks.tpl.php | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
(limited to 'data/templates/bookmarks.tpl.php')
diff --git a/data/templates/bookmarks.tpl.php b/data/templates/bookmarks.tpl.php
index 1caf0e7..a8299fd 100644
--- a/data/templates/bookmarks.tpl.php
+++ b/data/templates/bookmarks.tpl.php
@@ -228,6 +228,14 @@ if($currenttag!= '') {
);
}
+ if ($userservice->isLoggedOn()) {
+ $watchedNames = $userservice->getWatchNames(
+ $currentUser->getId(), true
+ );
+ } else {
+ $watchedNames = null;
+ }
+
foreach ($bookmarks as $key => &$row) {
switch ($row['bStatus']) {
case 0:
@@ -321,7 +329,11 @@ if($currenttag!= '') {
}
// Private Note (just visible by the owner and his/her contacts)
- if($userservice->isLoggedOn() && ($currentUser->getId() == $row['uId'] || in_array($row['username'], $userservice->getWatchNames($currentUser->getId(), true)))) {
+ if ($watchedNames !== null
+ && ($currentUser->getId() == $row['uId']
+ || in_array($row['username'], $watchedNames)
+ )
+ ) {
$privateNoteField = $row['bPrivateNote'];
} else {
$privateNoteField = '';
--
cgit v1.2.3-54-g00ecf