aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2015-11-08 13:22:44 +0100
committerArthurHoaro <arthur@hoa.ro>2015-11-08 13:22:44 +0100
commit056107ab4eae0a4867cf8d55de77d31f8868b899 (patch)
tree2d92c7afc59721584f62cd2a07052e1f5a27c7f4 /index.php
parent89dfc37b0aeb865bc7298836b615e2ac5b6406ce (diff)
downloadShaarli-056107ab4eae0a4867cf8d55de77d31f8868b899.tar.gz
Shaarli-056107ab4eae0a4867cf8d55de77d31f8868b899.tar.zst
Shaarli-056107ab4eae0a4867cf8d55de77d31f8868b899.zip
Handle errors raised by plugins in template. fixes #370
Diffstat (limited to 'index.php')
-rwxr-xr-xindex.php52
1 files changed, 33 insertions, 19 deletions
diff --git a/index.php b/index.php
index c82735ca..ea7bf4d1 100755
--- a/index.php
+++ b/index.php
@@ -55,8 +55,7 @@ $GLOBALS['config']['HIDE_PUBLIC_LINKS'] = false;
55$GLOBALS['config']['ENABLED_PLUGINS'] = array('qrcode'); 55$GLOBALS['config']['ENABLED_PLUGINS'] = array('qrcode');
56 56
57// Default plugins, default config - will be overriden by config.php and then plugin's config.php file. 57// Default plugins, default config - will be overriden by config.php and then plugin's config.php file.
58$GLOBALS['plugins']['READITYOUSELF_URL'] = 'http://someurl.com'; 58//$GLOBALS['plugins']['WALLABAG_URL'] = 'https://demo.wallabag.org/';
59$GLOBALS['plugins']['WALLABAG_URL'] = 'https://demo.wallabag.org/';
60// ----------------------------------------------------------------------------------------------- 59// -----------------------------------------------------------------------------------------------
61define('shaarli_version', '0.5.4'); 60define('shaarli_version', '0.5.4');
62// http://server.com/x/shaarli --> /shaarli/ 61// http://server.com/x/shaarli --> /shaarli/
@@ -580,28 +579,43 @@ class pageBuilder
580 579
581 function __construct() 580 function __construct()
582 { 581 {
583 $this->tpl=false; 582 $this->tpl = false;
584 } 583 }
585 584
585 /**
586 * Initialize all default tpl tags.
587 */
586 private function initialize() 588 private function initialize()
587 { 589 {
588 $this->tpl = new RainTPL; 590 $this->tpl = new RainTPL;
589 $this->tpl->assign('newversion',escape(checkUpdate())); 591 $this->tpl->assign('newversion', escape(checkUpdate()));
590 $this->tpl->assign('feedurl',escape(index_url($_SERVER))); 592 $this->tpl->assign('feedurl', escape(index_url($_SERVER)));
591 $searchcrits=''; // Search criteria 593 $searchcrits = ''; // Search criteria
592 if (!empty($_GET['searchtags'])) $searchcrits.='&searchtags='.urlencode($_GET['searchtags']); 594 if (!empty($_GET['searchtags'])) {
593 elseif (!empty($_GET['searchterm'])) $searchcrits.='&searchterm='.urlencode($_GET['searchterm']); 595 $searchcrits .= '&searchtags=' . urlencode($_GET['searchtags']);
594 $this->tpl->assign('searchcrits',$searchcrits); 596 }
595 $this->tpl->assign('source',index_url($_SERVER)); 597 elseif (!empty($_GET['searchterm'])) {
596 $this->tpl->assign('version',shaarli_version); 598 $searchcrits .= '&searchterm=' . urlencode($_GET['searchterm']);
597 $this->tpl->assign('scripturl',index_url($_SERVER)); 599 }
598 $this->tpl->assign('pagetitle','Shaarli'); 600 $this->tpl->assign('searchcrits', $searchcrits);
599 $this->tpl->assign('privateonly',!empty($_SESSION['privateonly'])); // Show only private links? 601 $this->tpl->assign('source', index_url($_SERVER));
600 if (!empty($GLOBALS['title'])) $this->tpl->assign('pagetitle',$GLOBALS['title']); 602 $this->tpl->assign('version', shaarli_version);
601 if (!empty($GLOBALS['titleLink'])) $this->tpl->assign('titleLink',$GLOBALS['titleLink']); 603 $this->tpl->assign('scripturl', index_url($_SERVER));
602 if (!empty($GLOBALS['pagetitle'])) $this->tpl->assign('pagetitle',$GLOBALS['pagetitle']); 604 $this->tpl->assign('pagetitle', 'Shaarli');
603 $this->tpl->assign('shaarlititle',empty($GLOBALS['title']) ? 'Shaarli': $GLOBALS['title'] ); 605 $this->tpl->assign('privateonly', !empty($_SESSION['privateonly'])); // Show only private links?
604 return; 606 if (!empty($GLOBALS['title'])) {
607 $this->tpl->assign('pagetitle', $GLOBALS['title']);
608 }
609 if (!empty($GLOBALS['titleLink'])) {
610 $this->tpl->assign('titleLink', $GLOBALS['titleLink']);
611 }
612 if (!empty($GLOBALS['pagetitle'])) {
613 $this->tpl->assign('pagetitle', $GLOBALS['pagetitle']);
614 }
615 $this->tpl->assign('shaarlititle', empty($GLOBALS['title']) ? 'Shaarli': $GLOBALS['title']);
616 if (!empty($GLOBALS['plugins']['errors'])) {
617 $this->tpl->assign('plugin_errors', $GLOBALS['plugins']['errors']);
618 }
605 } 619 }
606 620
607 // The following assign() method is basically the same as RainTPL (except that it's lazy) 621 // The following assign() method is basically the same as RainTPL (except that it's lazy)