From: Seb Sauvage Date: Mon, 3 Oct 2011 11:14:56 +0000 (+0200) Subject: Version 0.0.23 beta: X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=dcd653d10e168e655ce080da6886ef9fc2c1d3e1;hp=28770b26b1a33ed079f9d777bfc6346e7a291c19;p=github%2Fshaarli%2FShaarli.git Version 0.0.23 beta: - Changed: Now you can clic the sentence “Stay signed in” to tick the checkbox (patch by Emilien). - New: Added thumbnail support for imageshack.us - Changed: In tag editing, comma (,) are now automatically converted to spaces. - Changed: In tag editing, autocomplete no longuer suggests a tag you have already entered in the same line. --- diff --git a/index.php b/index.php index 6732083c..a9491ed3 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,5 @@ ' : ''); $loginform='
Login:    Password :
'; - $loginform.=' Stay signed in (Do not check on public computers)'.$returnurl_html.'
'; + $loginform.=''.$returnurl_html.''; $onload = 'onload="document.loginform.login.focus();"'; $data = array('pageheader'=>$loginform,'body'=>'','onload'=>$onload); templatePage($data); @@ -941,7 +941,7 @@ HTML; $tags = trim(preg_replace('/\s\s+/',' ', $_POST['lf_tags'])); // Remove multiple spaces. $linkdate=$_POST['lf_linkdate']; $link = array('title'=>trim($_POST['lf_title']),'url'=>trim($_POST['lf_url']),'description'=>trim($_POST['lf_description']),'private'=>(isset($_POST['lf_private']) ? 1 : 0), - 'linkdate'=>$linkdate,'tags'=>$tags); + 'linkdate'=>$linkdate,'tags'=>str_replace(',',' ',$tags)); if ($link['title']=='') $link['title']=$link['url']; // If title is empty, use the URL as title. $LINKSDB[$linkdate] = $link; $LINKSDB->savedb(); // save to disk @@ -1337,7 +1337,16 @@ function thumbnail($url) return '
'; } } - + if (endsWith($domain,'.imageshack.us')) + { + $ext=strtolower(pathinfo($url,PATHINFO_EXTENSION)); + if ($ext=='jpg' || $ext=='jpeg' || $ext=='png' || $ext=='gif') + { + $thumburl = substr($url,0,strlen($url)-strlen($ext)).'th.'.$ext; + return '
'; + } + } + // Some other hosts are SLOW AS HELL and usually require an extra HTTP request to get the thumbnail URL. // So we deport the thumbnail generation in order not to slow down page generation // (and we also cache the thumbnail) @@ -1544,14 +1553,14 @@ function processWS() // Search in tags (case insentitive, cumulative search) if ($_GET['ws']=='tags') { - $tags=explode(' ',$term); $last = array_pop($tags); // Get the last term ("a b c d" ==> "a b c", "d") + $tags=explode(' ',str_replace(',',' ',$term)); $last = array_pop($tags); // Get the last term ("a b c d" ==> "a b c", "d") $addtags=''; if ($tags) $addtags=implode(' ',$tags).' '; // We will pre-pend previous tags $suggested=array(); /* To speed up things, we store list of tags in session */ if (empty($_SESSION['tags'])) $_SESSION['tags'] = $LINKSDB->allTags(); foreach($_SESSION['tags'] as $key=>$value) { - if (startsWith($key,$last,$case=false)) $suggested[$addtags.$key.' ']=0; + if (startsWith($key,$last,$case=false) && !in_array($key,$tags)) $suggested[$addtags.$key.' ']=0;//FIXME } echo json_encode(array_keys($suggested)); exit;