From dcd653d10e168e655ce080da6886ef9fc2c1d3e1 Mon Sep 17 00:00:00 2001 From: Seb Sauvage Date: Mon, 3 Oct 2011 13:14:56 +0200 Subject: [PATCH] =?utf8?q?Version=200.0.23=20beta:=20-=20Changed:=20Now=20?= =?utf8?q?you=20can=20clic=20the=20sentence=20=E2=80=9CStay=20signed=20in?= =?utf8?q?=E2=80=9D=20to=20tick=20the=20checkbox=20(patch=20by=20Emilien).?= =?utf8?q?=20-=20New:=20Added=20thumbnail=20support=20for=20imageshack.us?= =?utf8?q?=20-=20Changed:=20In=20tag=20editing,=20comma=20(,)=20are=20now?= =?utf8?q?=20automatically=20converted=20to=20spaces.=20-=20Changed:=20In?= =?utf8?q?=20tag=20editing,=20autocomplete=20no=20longuer=20suggests=20a?= =?utf8?q?=20tag=20you=20have=20already=20entered=20in=20the=20same=20line?= =?utf8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- index.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) 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; -- 2.41.0