'.$link['description']."\n";
- }
+ // export as bookmarks_(all|private|public)_YYYYmmdd_HHMMSS.html
+ $selection = $_GET['selection'];
+ if (isset($_GET['prepend_note_url'])) {
+ $prependNoteUrl = $_GET['prepend_note_url'];
+ } else {
+ $prependNoteUrl = false;
}
- exit;
- }
- // -------- User is uploading a file for import
- if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=upload'))
- {
- // If file is too big, some form field may be missing.
- if (!isset($_POST['token']) || (!isset($_FILES)) || (isset($_FILES['filetoupload']['size']) && $_FILES['filetoupload']['size']==0))
- {
- $returnurl = ( empty($_SERVER['HTTP_REFERER']) ? '?' : $_SERVER['HTTP_REFERER'] );
- echo '';
+ try {
+ $PAGE->assign(
+ 'links',
+ NetscapeBookmarkUtils::filterAndFormat(
+ $LINKSDB,
+ $selection,
+ $prependNoteUrl,
+ index_url($_SERVER)
+ )
+ );
+ } catch (Exception $exc) {
+ header('Content-Type: text/plain; charset=utf-8');
+ echo $exc->getMessage();
exit;
}
- if (!tokenOk($_POST['token'])) die('Wrong token.');
- importFile();
+ $now = new DateTime();
+ header('Content-Type: text/html; charset=utf-8');
+ header(
+ 'Content-disposition: attachment; filename=bookmarks_'
+ .$selection.'_'.$now->format(LinkDB::LINK_DATE_FORMAT).'.html'
+ );
+ $PAGE->assign('date', $now->format(DateTime::RFC822));
+ $PAGE->assign('eol', PHP_EOL);
+ $PAGE->assign('selection', $selection);
+ $PAGE->renderPage('export.bookmarks');
exit;
}
- // -------- Show upload/import dialog:
- if ($targetPage == Router::$PAGE_IMPORT)
- {
- $PAGE->assign('linkcount',count($LINKSDB));
- $PAGE->assign('token',getToken());
- $PAGE->assign('maxfilesize',getMaxFileSize());
- $PAGE->renderPage('import');
+ if ($targetPage == Router::$PAGE_IMPORT) {
+ // Upload a Netscape bookmark dump to import its contents
+
+ if (! isset($_POST['token']) || ! isset($_FILES['filetoupload'])) {
+ // Show import dialog
+ $PAGE->assign('maxfilesize', getMaxFileSize());
+ $PAGE->renderPage('import');
+ exit;
+ }
+
+ // Import bookmarks from an uploaded file
+ if (isset($_FILES['filetoupload']['size']) && $_FILES['filetoupload']['size'] == 0) {
+ // The file is too big or some form field may be missing.
+ echo '';
+ exit;
+ }
+ if (! tokenOk($_POST['token'])) {
+ die('Wrong token.');
+ }
+ $status = NetscapeBookmarkUtils::import(
+ $_POST,
+ $_FILES,
+ $LINKSDB,
+ $conf->get('resource.page_cache')
+ );
+ echo '';
exit;
}
- // -------- Otherwise, simply display search form and links:
- showLinkList($PAGE, $LINKSDB);
- exit;
-}
+ // Plugin administration page
+ if ($targetPage == Router::$PAGE_PLUGINSADMIN) {
+ $pluginMeta = $pluginManager->getPluginsMeta();
-// -----------------------------------------------------------------------------------------------
-// Process the import file form.
-function importFile()
-{
- if (!isLoggedIn()) { die('Not allowed.'); }
- $LINKSDB = new LinkDB(
- $GLOBALS['config']['DATASTORE'],
- isLoggedIn(),
- $GLOBALS['config']['HIDE_PUBLIC_LINKS'],
- $GLOBALS['redirector']
- );
- $filename=$_FILES['filetoupload']['name'];
- $filesize=$_FILES['filetoupload']['size'];
- $data=file_get_contents($_FILES['filetoupload']['tmp_name']);
- $private = (empty($_POST['private']) ? 0 : 1); // Should the links be imported as private?
- $overwrite = !empty($_POST['overwrite']) ; // Should the imported links overwrite existing ones?
- $import_count=0;
-
- // Sniff file type:
- $type='unknown';
- if (startsWith($data,'')) $type='netscape'; // Netscape bookmark file (aka Firefox).
-
- // Then import the bookmarks.
- if ($type=='netscape')
- {
- // This is a standard Netscape-style bookmark file.
- // This format is supported by all browsers (except IE, of course), also Delicious, Diigo and others.
- foreach(explode('
',$data) as $html) // explode is very fast
- {
- $link = array('linkdate'=>'','title'=>'','url'=>'','description'=>'','tags'=>'','private'=>0);
- $d = explode('
',$html);
- if (startswith($d[0],'(.*?)!i',$d[0],$matches); $link['title'] = (isset($matches[1]) ? trim($matches[1]) : ''); // Get title
- $link['title'] = html_entity_decode($link['title'],ENT_QUOTES,'UTF-8');
- preg_match_all('! ([A-Z_]+)=\"(.*?)"!i',$html,$matches,PREG_SET_ORDER); // Get all other attributes
- $raw_add_date=0;
- foreach($matches as $m)
- {
- $attr=$m[1]; $value=$m[2];
- if ($attr=='HREF') $link['url']=html_entity_decode($value,ENT_QUOTES,'UTF-8');
- elseif ($attr=='ADD_DATE')
- {
- $raw_add_date=intval($value);
- if ($raw_add_date>30000000000) $raw_add_date/=1000; //If larger than year 2920, then was likely stored in milliseconds instead of seconds
- }
- elseif ($attr=='PRIVATE') $link['private']=($value=='0'?0:1);
- elseif ($attr=='TAGS') $link['tags']=html_entity_decode(str_replace(',',' ',$value),ENT_QUOTES,'UTF-8');
- }
- if ($link['url']!='')
- {
- if ($private==1) $link['private']=1;
- $dblink = $LINKSDB->getLinkFromUrl($link['url']); // See if the link is already in database.
- if ($dblink==false)
- { // Link not in database, let's import it...
- if (empty($raw_add_date)) $raw_add_date=time(); // In case of shitty bookmark file with no ADD_DATE
-
- // Make sure date/time is not already used by another link.
- // (Some bookmark files have several different links with the same ADD_DATE)
- // We increment date by 1 second until we find a date which is not used in DB.
- // (so that links that have the same date/time are more or less kept grouped by date, but do not conflict.)
- while (!empty($LINKSDB[date('Ymd_His',$raw_add_date)])) { $raw_add_date++; }// Yes, I know it's ugly.
- $link['linkdate']=date('Ymd_His',$raw_add_date);
- $LINKSDB[$link['linkdate']] = $link;
- $import_count++;
- }
- else // Link already present in database.
- {
- if ($overwrite)
- { // If overwrite is required, we import link data, except date/time.
- $link['linkdate']=$dblink['linkdate'];
- $LINKSDB[$link['linkdate']] = $link;
- $import_count++;
- }
- }
+ // Split plugins into 2 arrays: ordered enabled plugins and disabled.
+ $enabledPlugins = array_filter($pluginMeta, function($v) { return $v['order'] !== false; });
+ // Load parameters.
+ $enabledPlugins = load_plugin_parameter_values($enabledPlugins, $conf->get('plugins', array()));
+ uasort(
+ $enabledPlugins,
+ function($a, $b) { return $a['order'] - $b['order']; }
+ );
+ $disabledPlugins = array_filter($pluginMeta, function($v) { return $v['order'] === false; });
+
+ $PAGE->assign('enabledPlugins', $enabledPlugins);
+ $PAGE->assign('disabledPlugins', $disabledPlugins);
+ $PAGE->renderPage('pluginsadmin');
+ exit;
+ }
+ // Plugin administration form action
+ if ($targetPage == Router::$PAGE_SAVE_PLUGINSADMIN) {
+ try {
+ if (isset($_POST['parameters_form'])) {
+ unset($_POST['parameters_form']);
+ foreach ($_POST as $param => $value) {
+ $conf->set('plugins.'. $param, escape($value));
}
}
+ else {
+ $conf->set('general.enabled_plugins', save_plugin_config($_POST));
+ }
+ $conf->write(isLoggedIn());
}
- $LINKSDB->savedb($GLOBALS['config']['PAGECACHE']);
+ catch (Exception $e) {
+ error_log(
+ 'ERROR while saving plugin configuration:.' . PHP_EOL .
+ $e->getMessage()
+ );
- echo '';
- }
- else
- {
- echo '';
+ // TODO: do not handle exceptions/errors in JS.
+ echo '';
+ exit;
+ }
+ header('Location: ?do='. Router::$PAGE_PLUGINSADMIN);
+ exit;
}
+
+ // -------- Otherwise, simply display search form and links:
+ showLinkList($PAGE, $LINKSDB, $conf, $pluginManager);
+ exit;
}
-// -----------------------------------------------------------------------------------------------
-// Template for the list of links (
)
-// This function fills all the necessary fields in the $PAGE for the template 'linklist.html'
-function buildLinkList($PAGE,$LINKSDB)
+/**
+ * Template for the list of links (
)
+ * This function fills all the necessary fields in the $PAGE for the template 'linklist.html'
+ *
+ * @param pageBuilder $PAGE pageBuilder instance.
+ * @param LinkDB $LINKSDB LinkDB instance.
+ * @param ConfigManager $conf Configuration Manager instance.
+ * @param PluginManager $pluginManager Plugin Manager instance.
+ */
+function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager)
{
- // ---- Filter link database according to parameters
- $linksToDisplay=array();
- $search_type='';
- $search_crits='';
- if (isset($_GET['searchterm'])) // Fulltext search
- {
- $linksToDisplay = $LINKSDB->filterFulltext(trim($_GET['searchterm']));
- $search_crits=escape(trim($_GET['searchterm']));
- $search_type='fulltext';
- }
- elseif (isset($_GET['searchtags'])) // Search by tag
- {
- $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags']));
- $search_crits=explode(' ',escape(trim($_GET['searchtags'])));
- $search_type='tags';
- }
- elseif (isset($_SERVER['QUERY_STRING']) && preg_match('/[a-zA-Z0-9-_@]{6}(&.+?)?/',$_SERVER['QUERY_STRING'])) // Detect smallHashes in URL
- {
- $linksToDisplay = $LINKSDB->filterSmallHash(substr(trim($_SERVER["QUERY_STRING"], '/'),0,6));
- if (count($linksToDisplay)==0)
- {
- header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
- echo '
404 Not found.
Oh crap. The link you are trying to reach does not exist or has been deleted.';
- echo ' Would you mind clicking here?';
+ // Used in templates
+ $searchtags = !empty($_GET['searchtags']) ? escape($_GET['searchtags']) : '';
+ $searchterm = !empty($_GET['searchterm']) ? escape($_GET['searchterm']) : '';
+
+ // Smallhash filter
+ if (! empty($_SERVER['QUERY_STRING'])
+ && preg_match('/^[a-zA-Z0-9-_@]{6}($|&|#)/', $_SERVER['QUERY_STRING'])) {
+ try {
+ $linksToDisplay = $LINKSDB->filterHash($_SERVER['QUERY_STRING']);
+ } catch (LinkNotFoundException $e) {
+ $PAGE->render404($e->getMessage());
exit;
}
- $search_type='permalink';
+ } else {
+ // Filter links according search parameters.
+ $privateonly = !empty($_SESSION['privateonly']);
+ $linksToDisplay = $LINKSDB->filterSearch($_GET, false, $privateonly);
}
- else
- $linksToDisplay = $LINKSDB; // Otherwise, display without filtering.
-
- // Option: Show only private links
- if (!empty($_SESSION['privateonly']))
- {
- $tmp = array();
- foreach($linksToDisplay as $linkdate=>$link)
- {
- if ($link['private']!=0) $tmp[$linkdate]=$link;
- }
- $linksToDisplay=$tmp;
+ // ---- Handle paging.
+ $keys = array();
+ foreach ($linksToDisplay as $key => $value) {
+ $keys[] = $key;
}
- // ---- Handle paging.
- /* Can someone explain to me why you get the following error when using array_keys() on an object which implements the interface ArrayAccess???
- "Warning: array_keys() expects parameter 1 to be array, object given in ... "
- If my class implements ArrayAccess, why won't array_keys() accept it ? ( $keys=array_keys($linksToDisplay); )
- */
- $keys=array(); foreach($linksToDisplay as $key=>$value) { $keys[]=$key; } // Stupid and ugly. Thanks PHP.
- // If there is only a single link, we change on-the-fly the title of the page.
- if (count($linksToDisplay)==1) $GLOBALS['pagetitle'] = $linksToDisplay[$keys[0]]['title'].' - '.$GLOBALS['title'];
// Select articles according to paging.
- $pagecount = ceil(count($keys)/$_SESSION['LINKS_PER_PAGE']);
- $pagecount = ($pagecount==0 ? 1 : $pagecount);
- $page=( empty($_GET['page']) ? 1 : intval($_GET['page']));
- $page = ( $page<1 ? 1 : $page );
- $page = ( $page>$pagecount ? $pagecount : $page );
- $i = ($page-1)*$_SESSION['LINKS_PER_PAGE']; // Start index.
- $end = $i+$_SESSION['LINKS_PER_PAGE'];
- $linkDisp=array(); // Links to display
+ $pagecount = ceil(count($keys) / $_SESSION['LINKS_PER_PAGE']);
+ $pagecount = $pagecount == 0 ? 1 : $pagecount;
+ $page= empty($_GET['page']) ? 1 : intval($_GET['page']);
+ $page = $page < 1 ? 1 : $page;
+ $page = $page > $pagecount ? $pagecount : $page;
+ // Start index.
+ $i = ($page-1) * $_SESSION['LINKS_PER_PAGE'];
+ $end = $i + $_SESSION['LINKS_PER_PAGE'];
+ $linkDisp = array();
while ($i<$end && $iget('redirector.url'));
+ $classLi = ($i % 2) != 0 ? '' : 'publicLinkHightLight';
+ $link['class'] = $link['private'] == 0 ? $classLi : 'private';
+ $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']);
+ $link['timestamp'] = $date->getTimestamp();
+ if (! empty($link['updated'])) {
+ $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['updated']);
+ $link['updated_timestamp'] = $date->getTimestamp();
+ } else {
+ $link['updated_timestamp'] = '';
+ }
+ $taglist = explode(' ', $link['tags']);
uasort($taglist, 'strcasecmp');
- $link['taglist']=$taglist;
+ $link['taglist'] = $taglist;
$link['shorturl'] = smallHash($link['linkdate']);
- if ($link["url"][0] === '?' && // Check for both signs of a note: starting with ? and 7 chars long. I doubt that you'll post any links that look like this.
- strlen($link["url"]) === 7) {
- $link["url"] = index_url($_SERVER) . $link["url"];
+ // Check for both signs of a note: starting with ? and 7 chars long.
+ if ($link['url'][0] === '?' &&
+ strlen($link['url']) === 7) {
+ $link['url'] = index_url($_SERVER) . $link['url'];
}
$linkDisp[$keys[$i]] = $link;
@@ -1947,35 +1659,38 @@ function buildLinkList($PAGE,$LINKSDB)
}
// Compute paging navigation
- $searchterm= ( empty($_GET['searchterm']) ? '' : '&searchterm='.$_GET['searchterm'] );
- $searchtags= ( empty($_GET['searchtags']) ? '' : '&searchtags='.$_GET['searchtags'] );
- $paging='';
- $previous_page_url=''; if ($i!=count($keys)) $previous_page_url='?page='.($page+1).$searchterm.$searchtags;
- $next_page_url='';if ($page>1) $next_page_url='?page='.($page-1).$searchterm.$searchtags;
+ $searchtagsUrl = empty($searchtags) ? '' : '&searchtags=' . urlencode($searchtags);
+ $searchtermUrl = empty($searchterm) ? '' : '&searchterm=' . urlencode($searchterm);
+ $previous_page_url = '';
+ if ($i != count($keys)) {
+ $previous_page_url = '?page=' . ($page+1) . $searchtermUrl . $searchtagsUrl;
+ }
+ $next_page_url='';
+ if ($page>1) {
+ $next_page_url = '?page=' . ($page-1) . $searchtermUrl . $searchtagsUrl;
+ }
- $token = ''; if (isLoggedIn()) $token=getToken();
+ $token = isLoggedIn() ? getToken($conf) : '';
// Fill all template fields.
$data = array(
- 'linkcount' => count($LINKSDB),
'previous_page_url' => $previous_page_url,
'next_page_url' => $next_page_url,
'page_current' => $page,
'page_max' => $pagecount,
'result_count' => count($linksToDisplay),
- 'search_type' => $search_type,
- 'search_crits' => $search_crits,
- 'redirector' => empty($GLOBALS['redirector']) ? '' : $GLOBALS['redirector'], // Optional redirector URL.
- 'token' => $token,
+ 'search_term' => $searchterm,
+ 'search_tags' => $searchtags,
+ 'redirector' => $conf->get('redirector.url'), // Optional redirector URL.
'links' => $linkDisp,
'tags' => $LINKSDB->allTags(),
);
- // FIXME! temporary fix - see #399.
- if (!empty($GLOBALS['pagetitle']) && count($linkDisp) == 1) {
- $data['pagetitle'] = $GLOBALS['pagetitle'];
+
+ // If there is only a single link, we change on-the-fly the title of the page.
+ if (count($linksToDisplay) == 1) {
+ $data['pagetitle'] = $linksToDisplay[$keys[0]]['title'] .' - '. $conf->get('general.title');
}
- $pluginManager = PluginManager::getInstance();
$pluginManager->executeHooks('render_linklist', $data, array('loggedin' => isLoggedIn()));
foreach ($data as $key => $value) {
@@ -1985,18 +1700,26 @@ function buildLinkList($PAGE,$LINKSDB)
return;
}
-// Compute the thumbnail for a link.
-//
-// With a link to the original URL.
-// Understands various services (youtube.com...)
-// Input: $url = URL for which the thumbnail must be found.
-// $href = if provided, this URL will be followed instead of $url
-// Returns an associative array with thumbnail attributes (src,href,width,height,style,alt)
-// Some of them may be missing.
-// Return an empty array if no thumbnail available.
-function computeThumbnail($url,$href=false)
+/**
+ * Compute the thumbnail for a link.
+ *
+ * With a link to the original URL.
+ * Understands various services (youtube.com...)
+ * Input: $url = URL for which the thumbnail must be found.
+ * $href = if provided, this URL will be followed instead of $url
+ * Returns an associative array with thumbnail attributes (src,href,width,height,style,alt)
+ * Some of them may be missing.
+ * Return an empty array if no thumbnail available.
+ *
+ * @param ConfigManager $conf Configuration Manager instance.
+ * @param string $url
+ * @param string|bool $href
+ *
+ * @return array
+ */
+function computeThumbnail($conf, $url, $href = false)
{
- if (!$GLOBALS['config']['ENABLE_THUMBNAILS']) return array();
+ if (!$conf->get('thumbnail.enable_thumbnails')) return array();
if ($href==false) $href=$url;
// For most hosts, the URL of the thumbnail can be easily deduced from the URL of the link.
@@ -2064,7 +1787,7 @@ function computeThumbnail($url,$href=false)
// So we deport the thumbnail generation in order not to slow down page generation
// (and we also cache the thumbnail)
- if (!$GLOBALS['config']['ENABLE_LOCALCACHE']) return array(); // If local cache is disabled, no thumbnails for services which require the use a local cache.
+ if (! $conf->get('thumbnail.enable_localcache')) return array(); // If local cache is disabled, no thumbnails for services which require the use a local cache.
if ($domain=='flickr.com' || endsWith($domain,'.flickr.com')
|| $domain=='vimeo.com'
@@ -2087,7 +1810,7 @@ function computeThumbnail($url,$href=false)
$path = parse_url($url,PHP_URL_PATH);
if ("/talks/" !== substr($path,0,7)) return array(); // This is not a single video URL.
}
- $sign = hash_hmac('sha256', $url, $GLOBALS['salt']); // We use the salt to sign data (it's random, secret, and specific to each installation)
+ $sign = hash_hmac('sha256', $url, $conf->get('credentials.salt')); // We use the salt to sign data (it's random, secret, and specific to each installation)
return array('src'=>index_url($_SERVER).'?do=genthumbnail&hmac='.$sign.'&url='.urlencode($url),
'href'=>$href,'width'=>'120','style'=>'height:auto;','alt'=>'thumbnail');
}
@@ -2098,7 +1821,7 @@ function computeThumbnail($url,$href=false)
$ext=strtolower(pathinfo($url,PATHINFO_EXTENSION));
if ($ext=='jpg' || $ext=='jpeg' || $ext=='png' || $ext=='gif')
{
- $sign = hash_hmac('sha256', $url, $GLOBALS['salt']); // We use the salt to sign data (it's random, secret, and specific to each installation)
+ $sign = hash_hmac('sha256', $url, $conf->get('credentials.salt')); // We use the salt to sign data (it's random, secret, and specific to each installation)
return array('src'=>index_url($_SERVER).'?do=genthumbnail&hmac='.$sign.'&url='.urlencode($url),
'href'=>$href,'width'=>'120','style'=>'height:auto;','alt'=>'thumbnail');
}
@@ -2115,7 +1838,9 @@ function computeThumbnail($url,$href=false)
// Returns '' if no thumbnail available.
function thumbnail($url,$href=false)
{
- $t = computeThumbnail($url,$href);
+ // FIXME!
+ global $conf;
+ $t = computeThumbnail($conf, $url,$href);
if (count($t)==0) return ''; // Empty array = no thumbnail for this URL.
$html='';
@@ -2161,10 +1888,13 @@ function lazyThumbnail($url,$href=false)
}
-// -----------------------------------------------------------------------------------------------
-// Installation
-// This function should NEVER be called if the file data/config.php exists.
-function install()
+/**
+ * Installation
+ * This function should NEVER be called if the file data/config.php exists.
+ *
+ * @param ConfigManager $conf Configuration Manager instance.
+ */
+function install($conf)
{
// On free.fr host, make sure the /sessions directory exists, otherwise login will not work.
if (endsWith($_SERVER['HTTP_HOST'],'.free.fr') && !is_dir($_SERVER['DOCUMENT_ROOT'].'/sessions')) mkdir($_SERVER['DOCUMENT_ROOT'].'/sessions',0705);
@@ -2196,20 +1926,26 @@ function install()
if (!empty($_POST['setlogin']) && !empty($_POST['setpassword']))
{
$tz = 'UTC';
- if (!empty($_POST['continent']) && !empty($_POST['city'])) {
- if (isTimeZoneValid($_POST['continent'], $_POST['city'])) {
- $tz = $_POST['continent'].'/'.$_POST['city'];
- }
+ if (!empty($_POST['continent']) && !empty($_POST['city'])
+ && isTimeZoneValid($_POST['continent'], $_POST['city'])
+ ) {
+ $tz = $_POST['continent'].'/'.$_POST['city'];
+ }
+ $conf->set('general.timezone', $tz);
+ $login = $_POST['setlogin'];
+ $conf->set('credentials.login', $login);
+ $salt = sha1(uniqid('', true) .'_'. mt_rand());
+ $conf->set('credentials.salt', $salt);
+ $conf->set('credentials.hash', sha1($_POST['setpassword'] . $login . $salt));
+ if (!empty($_POST['title'])) {
+ $conf->set('general.title', escape($_POST['title']));
+ } else {
+ $conf->set('general.title', 'Shared links on '.escape(index_url($_SERVER)));
}
- $GLOBALS['timezone'] = $tz;
- // Everything is ok, let's create config file.
- $GLOBALS['login'] = $_POST['setlogin'];
- $GLOBALS['salt'] = sha1(uniqid('',true).'_'.mt_rand()); // Salt renders rainbow-tables attacks useless.
- $GLOBALS['hash'] = sha1($_POST['setpassword'].$GLOBALS['login'].$GLOBALS['salt']);
- $GLOBALS['title'] = (empty($_POST['title']) ? 'Shared links on '.escape(index_url($_SERVER)) : $_POST['title'] );
- $GLOBALS['config']['ENABLE_UPDATECHECK'] = !empty($_POST['updateCheck']);
+ $conf->set('updates.check_updates', !empty($_POST['updateCheck']));
try {
- writeConfig($GLOBALS, isLoggedIn());
+ // Everything is ok, let's create config file.
+ $conf->write(isLoggedIn());
}
catch(Exception $e) {
error_log(
@@ -2232,42 +1968,46 @@ function install()
$timezone_html = '