From: ArthurHoaro Date: Tue, 13 Mar 2018 17:02:49 +0000 (+0100) Subject: Merge pull request #1096 from ArthurHoaro/feature/download-params X-Git-Tag: v0.10.0~45 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=4294bc7b98c8f45ceaac867cad3d5d35ee9eb096;hp=-c;p=github%2Fshaarli%2FShaarli.git Merge pull request #1096 from ArthurHoaro/feature/download-params Make max download size and timeout configurable --- 4294bc7b98c8f45ceaac867cad3d5d35ee9eb096 diff --combined index.php index 3b8b52a7,f7722433..f7f87d95 --- a/index.php +++ b/index.php @@@ -887,7 -887,7 +887,7 @@@ function renderPage($conf, $pluginManag if (empty($params['searchtags'])) { $params['searchtags'] = trim($_GET['addtag']); } - else if ($addtag) { + elseif ($addtag) { $params['searchtags'] = trim($params['searchtags']).' '.trim($_GET['addtag']); } @@@ -953,7 -953,7 +953,7 @@@ } else { unset($_SESSION['visibility']); } - } else if ($_GET['visibility'] === 'public') { + } elseif ($_GET['visibility'] === 'public') { if (empty($_SESSION['visibility']) || $_SESSION['visibility'] !== 'public') { // See only public links $_SESSION['visibility'] = 'public'; @@@ -1376,7 -1376,12 +1376,12 @@@ if (empty($title) && strpos(get_url_scheme($url), 'http') !== false) { // Short timeout to keep the application responsive // The callback will fill $charset and $title with data from the downloaded page. - get_http_response($url, 25, 4194304, get_curl_download_callback($charset, $title)); + get_http_response( + $url, + $conf->get('general.download_max_size', 4194304), + $conf->get('general.download_timeout', 30), + get_curl_download_callback($charset, $title) + ); if (! empty($title) && strtolower($charset) != 'utf-8') { $title = mb_convert_encoding($title, 'utf-8', $charset); }