aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php52
1 files changed, 50 insertions, 2 deletions
diff --git a/index.php b/index.php
index beba9c32..31dcbf0f 100644
--- a/index.php
+++ b/index.php
@@ -1,6 +1,6 @@
1<?php 1<?php
2/** 2/**
3 * Shaarli v0.6.2 - Shaare your links... 3 * Shaarli v0.6.3 - Shaare your links...
4 * 4 *
5 * The personal, minimalist, super-fast, no-database Delicious clone. 5 * The personal, minimalist, super-fast, no-database Delicious clone.
6 * 6 *
@@ -119,7 +119,7 @@ $GLOBALS['config']['PUBSUBHUB_URL'] = '';
119/* 119/*
120 * PHP configuration 120 * PHP configuration
121 */ 121 */
122define('shaarli_version', '0.6.2'); 122define('shaarli_version', '0.6.3');
123 123
124// http://server.com/x/shaarli --> /shaarli/ 124// http://server.com/x/shaarli --> /shaarli/
125define('WEB_PATH', substr($_SERVER["REQUEST_URI"], 0, 1+strrpos($_SERVER["REQUEST_URI"], '/', 0))); 125define('WEB_PATH', substr($_SERVER["REQUEST_URI"], 0, 1+strrpos($_SERVER["REQUEST_URI"], '/', 0)));
@@ -1770,6 +1770,54 @@ HTML;
1770 exit; 1770 exit;
1771 } 1771 }
1772 1772
1773 // Plugin administration page
1774 if ($targetPage == Router::$PAGE_PLUGINSADMIN) {
1775 $pluginMeta = $pluginManager->getPluginsMeta();
1776
1777 // Split plugins into 2 arrays: ordered enabled plugins and disabled.
1778 $enabledPlugins = array_filter($pluginMeta, function($v) { return $v['order'] !== false; });
1779 // Load parameters.
1780 $enabledPlugins = load_plugin_parameter_values($enabledPlugins, $GLOBALS['plugins']);
1781 uasort(
1782 $enabledPlugins,
1783 function($a, $b) { return $a['order'] - $b['order']; }
1784 );
1785 $disabledPlugins = array_filter($pluginMeta, function($v) { return $v['order'] === false; });
1786
1787 $PAGE->assign('enabledPlugins', $enabledPlugins);
1788 $PAGE->assign('disabledPlugins', $disabledPlugins);
1789 $PAGE->renderPage('pluginsadmin');
1790 exit;
1791 }
1792
1793 // Plugin administration form action
1794 if ($targetPage == Router::$PAGE_SAVE_PLUGINSADMIN) {
1795 try {
1796 if (isset($_POST['parameters_form'])) {
1797 unset($_POST['parameters_form']);
1798 foreach ($_POST as $param => $value) {
1799 $GLOBALS['plugins'][$param] = escape($value);
1800 }
1801 }
1802 else {
1803 $GLOBALS['config']['ENABLED_PLUGINS'] = save_plugin_config($_POST);
1804 }
1805 writeConfig($GLOBALS, isLoggedIn());
1806 }
1807 catch (Exception $e) {
1808 error_log(
1809 'ERROR while saving plugin configuration:.' . PHP_EOL .
1810 $e->getMessage()
1811 );
1812
1813 // TODO: do not handle exceptions/errors in JS.
1814 echo '<script>alert("'. $e->getMessage() .'");document.location=\'?do=pluginsadmin\';</script>';
1815 exit;
1816 }
1817 header('Location: ?do='. Router::$PAGE_PLUGINSADMIN);
1818 exit;
1819 }
1820
1773 // -------- Otherwise, simply display search form and links: 1821 // -------- Otherwise, simply display search form and links:
1774 showLinkList($PAGE, $LINKSDB); 1822 showLinkList($PAGE, $LINKSDB);
1775 exit; 1823 exit;