diff options
-rw-r--r-- | application/FeedBuilder.php | 3 | ||||
-rw-r--r-- | tests/FeedBuilderTest.php | 33 | ||||
-rw-r--r-- | tpl/daily.html | 6 | ||||
-rw-r--r-- | tpl/dailyrss.html | 2 | ||||
-rw-r--r-- | tpl/export.bookmarks.html | 2 | ||||
-rw-r--r-- | tpl/feed.atom.html | 2 | ||||
-rw-r--r-- | tpl/feed.rss.html | 2 | ||||
-rw-r--r-- | tpl/linklist.html | 4 | ||||
-rw-r--r-- | tpl/page.header.html | 2 | ||||
-rw-r--r-- | tpl/picwall.html | 2 | ||||
-rw-r--r-- | tpl/tagcloud.html | 2 |
11 files changed, 47 insertions, 13 deletions
diff --git a/application/FeedBuilder.php b/application/FeedBuilder.php index 58c6bb17..c6657fbb 100644 --- a/application/FeedBuilder.php +++ b/application/FeedBuilder.php | |||
@@ -124,7 +124,8 @@ class FeedBuilder | |||
124 | $data['last_update'] = $this->getLatestDateFormatted(); | 124 | $data['last_update'] = $this->getLatestDateFormatted(); |
125 | $data['show_dates'] = !$this->hideDates || $this->isLoggedIn; | 125 | $data['show_dates'] = !$this->hideDates || $this->isLoggedIn; |
126 | // Remove leading slash from REQUEST_URI. | 126 | // Remove leading slash from REQUEST_URI. |
127 | $data['self_link'] = $pageaddr . escape(ltrim($this->serverInfo['REQUEST_URI'], '/')); | 127 | $data['self_link'] = escape(server_url($this->serverInfo)) |
128 | . escape($this->serverInfo['REQUEST_URI']); | ||
128 | $data['index_url'] = $pageaddr; | 129 | $data['index_url'] = $pageaddr; |
129 | $data['usepermalinks'] = $this->usePermalinks === true; | 130 | $data['usepermalinks'] = $this->usePermalinks === true; |
130 | $data['links'] = $linkDisplayed; | 131 | $data['links'] = $linkDisplayed; |
diff --git a/tests/FeedBuilderTest.php b/tests/FeedBuilderTest.php index c9ff397d..aa57f44e 100644 --- a/tests/FeedBuilderTest.php +++ b/tests/FeedBuilderTest.php | |||
@@ -217,4 +217,37 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase | |||
217 | $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links'])); | 217 | $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links'])); |
218 | $this->assertEquals('http://pubsubhub.io', $data['pubsubhub_url']); | 218 | $this->assertEquals('http://pubsubhub.io', $data['pubsubhub_url']); |
219 | } | 219 | } |
220 | |||
221 | /** | ||
222 | * Test buildData when Shaarli is served from a subdirectory | ||
223 | */ | ||
224 | public function testBuildDataServerSubdir() | ||
225 | { | ||
226 | $serverInfo = array( | ||
227 | 'HTTPS' => 'Off', | ||
228 | 'SERVER_NAME' => 'host.tld', | ||
229 | 'SERVER_PORT' => '8080', | ||
230 | 'SCRIPT_NAME' => '/~user/shaarli/index.php', | ||
231 | 'REQUEST_URI' => '/~user/shaarli/index.php?do=feed', | ||
232 | ); | ||
233 | $feedBuilder = new FeedBuilder( | ||
234 | self::$linkDB, | ||
235 | FeedBuilder::$FEED_ATOM, | ||
236 | $serverInfo, | ||
237 | null, | ||
238 | false | ||
239 | ); | ||
240 | $feedBuilder->setLocale(self::$LOCALE); | ||
241 | $data = $feedBuilder->buildData(); | ||
242 | |||
243 | $this->assertEquals( | ||
244 | 'http://host.tld:8080/~user/shaarli/index.php?do=feed', | ||
245 | $data['self_link'] | ||
246 | ); | ||
247 | |||
248 | // Test first link (note link) | ||
249 | $link = array_shift($data['links']); | ||
250 | $this->assertEquals('http://host.tld:8080/~user/shaarli/?WDWyig', $link['guid']); | ||
251 | $this->assertEquals('http://host.tld:8080/~user/shaarli/?WDWyig', $link['url']); | ||
252 | } | ||
220 | } | 253 | } |
diff --git a/tpl/daily.html b/tpl/daily.html index dde1f376..b82ad483 100644 --- a/tpl/daily.html +++ b/tpl/daily.html | |||
@@ -42,10 +42,10 @@ | |||
42 | <div class="clear"></div> | 42 | <div class="clear"></div> |
43 | 43 | ||
44 | {if="$linksToDisplay"} | 44 | {if="$linksToDisplay"} |
45 | {loop="cols"} | 45 | {loop="$cols"} |
46 | {if="isset($value[0])"} | 46 | {if="isset($value[0])"} |
47 | <div id="daily_col{$counter+1}"> | 47 | <div id="daily_col{$counter+1}"> |
48 | {loop="value"} | 48 | {loop="$value"} |
49 | {$link=$value} | 49 | {$link=$value} |
50 | <div class="dailyEntry"> | 50 | <div class="dailyEntry"> |
51 | <div class="dailyEntryPermalink"> | 51 | <div class="dailyEntryPermalink"> |
@@ -60,7 +60,7 @@ | |||
60 | {/if} | 60 | {/if} |
61 | {if="$link.tags"} | 61 | {if="$link.tags"} |
62 | <div class="dailyEntryTags"> | 62 | <div class="dailyEntryTags"> |
63 | {loop="link.taglist"} | 63 | {loop="$link.taglist"} |
64 | {$value} - | 64 | {$value} - |
65 | {/loop} | 65 | {/loop} |
66 | </div> | 66 | </div> |
diff --git a/tpl/dailyrss.html b/tpl/dailyrss.html index b14a3859..ddbd6c5e 100644 --- a/tpl/dailyrss.html +++ b/tpl/dailyrss.html | |||
@@ -4,7 +4,7 @@ | |||
4 | <link>{$absurl}</link> | 4 | <link>{$absurl}</link> |
5 | <pubDate>{$rssdate}</pubDate> | 5 | <pubDate>{$rssdate}</pubDate> |
6 | <description><![CDATA[ | 6 | <description><![CDATA[ |
7 | {loop="links"} | 7 | {loop="$links"} |
8 | <h3><a href="{$value.url}">{$value.title}</a></h3> | 8 | <h3><a href="{$value.url}">{$value.title}</a></h3> |
9 | <small>{if="!$hide_timestamps"}{function="strftime('%c', $value.timestamp)"} - {/if}{if="$value.tags"}{$value.tags}{/if}<br> | 9 | <small>{if="!$hide_timestamps"}{function="strftime('%c', $value.timestamp)"} - {/if}{if="$value.tags"}{$value.tags}{/if}<br> |
10 | {$value.url}</small><br> | 10 | {$value.url}</small><br> |
diff --git a/tpl/export.bookmarks.html b/tpl/export.bookmarks.html index da733257..127a5c20 100644 --- a/tpl/export.bookmarks.html +++ b/tpl/export.bookmarks.html | |||
@@ -5,6 +5,6 @@ | |||
5 | Do Not Edit! -->{ignore}The RainTPL loop is formatted to avoid generating extra newlines{/ignore} | 5 | Do Not Edit! -->{ignore}The RainTPL loop is formatted to avoid generating extra newlines{/ignore} |
6 | <TITLE>{$pagetitle}</TITLE> | 6 | <TITLE>{$pagetitle}</TITLE> |
7 | <H1>Shaarli export of {$selection} bookmarks on {$date}</H1> | 7 | <H1>Shaarli export of {$selection} bookmarks on {$date}</H1> |
8 | <DL><p>{loop="links"} | 8 | <DL><p>{loop="$links"} |
9 | <DT><A HREF="{$value.url}" ADD_DATE="{$value.timestamp}" PRIVATE="{$value.private}" TAGS="{$value.taglist}">{$value.title}</A>{if="$value.description"}{$eol}<DD>{$value.description}{/if}{/loop} | 9 | <DT><A HREF="{$value.url}" ADD_DATE="{$value.timestamp}" PRIVATE="{$value.private}" TAGS="{$value.taglist}">{$value.title}</A>{if="$value.description"}{$eol}<DD>{$value.description}{/if}{/loop} |
10 | </DL><p> | 10 | </DL><p> |
diff --git a/tpl/feed.atom.html b/tpl/feed.atom.html index 1932f507..40fd421a 100644 --- a/tpl/feed.atom.html +++ b/tpl/feed.atom.html | |||
@@ -17,7 +17,7 @@ | |||
17 | </author> | 17 | </author> |
18 | <id>{$index_url}</id> | 18 | <id>{$index_url}</id> |
19 | <generator>Shaarli</generator> | 19 | <generator>Shaarli</generator> |
20 | {loop="links"} | 20 | {loop="$links"} |
21 | <entry> | 21 | <entry> |
22 | <title>{$value.title}</title> | 22 | <title>{$value.title}</title> |
23 | {if="$usepermalinks"} | 23 | {if="$usepermalinks"} |
diff --git a/tpl/feed.rss.html b/tpl/feed.rss.html index 4bfe4196..e18dbf9b 100644 --- a/tpl/feed.rss.html +++ b/tpl/feed.rss.html | |||
@@ -12,7 +12,7 @@ | |||
12 | <!-- PubSubHubbub Discovery --> | 12 | <!-- PubSubHubbub Discovery --> |
13 | <atom:link rel="hub" href="{$pubsubhub_url}" /> | 13 | <atom:link rel="hub" href="{$pubsubhub_url}" /> |
14 | {/if} | 14 | {/if} |
15 | {loop="links"} | 15 | {loop="$links"} |
16 | <item> | 16 | <item> |
17 | <title>{$value.title}</title> | 17 | <title>{$value.title}</title> |
18 | <guid isPermaLink="{if="$usepermalinks"}true{else}false{/if}">{$value.guid}</guid> | 18 | <guid isPermaLink="{if="$usepermalinks"}true{else}false{/if}">{$value.guid}</guid> |
diff --git a/tpl/linklist.html b/tpl/linklist.html index 9979f12a..ddfd729a 100644 --- a/tpl/linklist.html +++ b/tpl/linklist.html | |||
@@ -63,7 +63,7 @@ | |||
63 | </div> | 63 | </div> |
64 | {/if} | 64 | {/if} |
65 | <ul> | 65 | <ul> |
66 | {loop="links"} | 66 | {loop="$links"} |
67 | <li{if="$value.class"} class="{$value.class}"{/if}> | 67 | <li{if="$value.class"} class="{$value.class}"{/if}> |
68 | <a id="{$value.shorturl}"></a> | 68 | <a id="{$value.shorturl}"></a> |
69 | <div class="thumbnail">{$value.url|thumbnail}</div> | 69 | <div class="thumbnail">{$value.url|thumbnail}</div> |
@@ -110,7 +110,7 @@ | |||
110 | <a href="{$value.real_url}"><span class="linkurl" title="Short link">{$value.url}</span></a><br> | 110 | <a href="{$value.real_url}"><span class="linkurl" title="Short link">{$value.url}</span></a><br> |
111 | {if="$value.tags"} | 111 | {if="$value.tags"} |
112 | <div class="linktaglist"> | 112 | <div class="linktaglist"> |
113 | {loop="value.taglist"}<span class="linktag" title="Add tag"><a href="?addtag={$value|urlencode}">{$value}</a></span> {/loop} | 113 | {loop="$value.taglist"}<span class="linktag" title="Add tag"><a href="?addtag={$value|urlencode}">{$value}</a></span> {/loop} |
114 | </div> | 114 | </div> |
115 | {/if} | 115 | {/if} |
116 | 116 | ||
diff --git a/tpl/page.header.html b/tpl/page.header.html index 0012c689..eac2ed4a 100644 --- a/tpl/page.header.html +++ b/tpl/page.header.html | |||
@@ -43,7 +43,7 @@ | |||
43 | 43 | ||
44 | {if="!empty($plugin_errors) && isLoggedIn()"} | 44 | {if="!empty($plugin_errors) && isLoggedIn()"} |
45 | <ul class="errors"> | 45 | <ul class="errors"> |
46 | {loop="plugin_errors"} | 46 | {loop="$plugin_errors"} |
47 | <li>{$value}</li> | 47 | <li>{$value}</li> |
48 | {/loop} | 48 | {/loop} |
49 | </ul> | 49 | </ul> |
diff --git a/tpl/picwall.html b/tpl/picwall.html index 230c948b..4e227e37 100644 --- a/tpl/picwall.html +++ b/tpl/picwall.html | |||
@@ -14,7 +14,7 @@ | |||
14 | 14 | ||
15 | <div class="center"> | 15 | <div class="center"> |
16 | <div id="picwall_container"> | 16 | <div id="picwall_container"> |
17 | {loop="linksToDisplay"} | 17 | {loop="$linksToDisplay"} |
18 | <div class="picwall_pictureframe"> | 18 | <div class="picwall_pictureframe"> |
19 | {$value.thumbnail}<a href="{$value.real_url}"><span class="info">{$value.title}</span></a> | 19 | {$value.thumbnail}<a href="{$value.real_url}"><span class="info">{$value.title}</span></a> |
20 | {loop="$value.picwall_plugin"} | 20 | {loop="$value.picwall_plugin"} |
diff --git a/tpl/tagcloud.html b/tpl/tagcloud.html index e449f293..05e45273 100644 --- a/tpl/tagcloud.html +++ b/tpl/tagcloud.html | |||
@@ -11,7 +11,7 @@ | |||
11 | </div> | 11 | </div> |
12 | 12 | ||
13 | <div id="cloudtag"> | 13 | <div id="cloudtag"> |
14 | {loop="tags"} | 14 | {loop="$tags"} |
15 | <span class="count">{$value.count}</span><a | 15 | <span class="count">{$value.count}</span><a |
16 | href="?searchtags={$key|urlencode}" style="font-size:{$value.size}em;">{$key}</a> | 16 | href="?searchtags={$key|urlencode}" style="font-size:{$value.size}em;">{$key}</a> |
17 | {loop="$value.tag_plugin"} | 17 | {loop="$value.tag_plugin"} |