aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--application/PageBuilder.php14
-rw-r--r--index.php4
2 files changed, 13 insertions, 5 deletions
diff --git a/application/PageBuilder.php b/application/PageBuilder.php
index 8e39455b..50e3f124 100644
--- a/application/PageBuilder.php
+++ b/application/PageBuilder.php
@@ -22,15 +22,22 @@ class PageBuilder
22 protected $conf; 22 protected $conf;
23 23
24 /** 24 /**
25 * @var LinkDB $linkDB instance.
26 */
27 protected $linkDB;
28
29 /**
25 * PageBuilder constructor. 30 * PageBuilder constructor.
26 * $tpl is initialized at false for lazy loading. 31 * $tpl is initialized at false for lazy loading.
27 * 32 *
28 * @param ConfigManager $conf Configuration Manager instance (reference). 33 * @param ConfigManager $conf Configuration Manager instance (reference).
34 * @param LinkDB $linkDB instance.
29 */ 35 */
30 public function __construct(&$conf) 36 public function __construct(&$conf, $linkDB = null)
31 { 37 {
32 $this->tpl = false; 38 $this->tpl = false;
33 $this->conf = $conf; 39 $this->conf = $conf;
40 $this->linkDB = $linkDB;
34 } 41 }
35 42
36 /** 43 /**
@@ -81,6 +88,9 @@ class PageBuilder
81 $this->tpl->assign('feed_type', $this->conf->get('feed.show_atom', true) !== false ? 'atom' : 'rss'); 88 $this->tpl->assign('feed_type', $this->conf->get('feed.show_atom', true) !== false ? 'atom' : 'rss');
82 $this->tpl->assign('hide_timestamps', $this->conf->get('privacy.hide_timestamps', false)); 89 $this->tpl->assign('hide_timestamps', $this->conf->get('privacy.hide_timestamps', false));
83 $this->tpl->assign('token', getToken($this->conf)); 90 $this->tpl->assign('token', getToken($this->conf));
91 if ($this->linkDB !== null) {
92 $this->tpl->assign('tags', $this->linkDB->allTags());
93 }
84 // To be removed with a proper theme configuration. 94 // To be removed with a proper theme configuration.
85 $this->tpl->assign('conf', $this->conf); 95 $this->tpl->assign('conf', $this->conf);
86 } 96 }
diff --git a/index.php b/index.php
index ba1c2b2b..ab1e30da 100644
--- a/index.php
+++ b/index.php
@@ -728,7 +728,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history)
728 die($e->getMessage()); 728 die($e->getMessage());
729 } 729 }
730 730
731 $PAGE = new PageBuilder($conf); 731 $PAGE = new PageBuilder($conf, $LINKSDB);
732 $PAGE->assign('linkcount', count($LINKSDB)); 732 $PAGE->assign('linkcount', count($LINKSDB));
733 $PAGE->assign('privateLinkcount', count_private($LINKSDB)); 733 $PAGE->assign('privateLinkcount', count_private($LINKSDB));
734 $PAGE->assign('plugin_errors', $pluginManager->getErrors()); 734 $PAGE->assign('plugin_errors', $pluginManager->getErrors());
@@ -1170,7 +1170,6 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history)
1170 if ($targetPage == Router::$PAGE_CHANGETAG) 1170 if ($targetPage == Router::$PAGE_CHANGETAG)
1171 { 1171 {
1172 if (empty($_POST['fromtag']) || (empty($_POST['totag']) && isset($_POST['renametag']))) { 1172 if (empty($_POST['fromtag']) || (empty($_POST['totag']) && isset($_POST['renametag']))) {
1173 $PAGE->assign('tags', $LINKSDB->allTags());
1174 $PAGE->renderPage('changetag'); 1173 $PAGE->renderPage('changetag');
1175 exit; 1174 exit;
1176 } 1175 }
@@ -1700,7 +1699,6 @@ function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager)
1700 'visibility' => ! empty($_SESSION['privateonly']) ? 'private' : '', 1699 'visibility' => ! empty($_SESSION['privateonly']) ? 'private' : '',
1701 'redirector' => $conf->get('redirector.url'), // Optional redirector URL. 1700 'redirector' => $conf->get('redirector.url'), // Optional redirector URL.
1702 'links' => $linkDisp, 1701 'links' => $linkDisp,
1703 'tags' => $LINKSDB->allTags(),
1704 ); 1702 );
1705 1703
1706 // If there is only a single link, we change on-the-fly the title of the page. 1704 // If there is only a single link, we change on-the-fly the title of the page.