Merge branch 'master' into myShaarli

This commit is contained in:
Knah Tsaeb 2013-12-19 09:30:59 +01:00
commit b55c95e172
2 changed files with 9 additions and 12 deletions

View file

@ -239,7 +239,7 @@ cursor:pointer;
.linkdescription { color:#000; margin-top:0; margin-bottom:12px; font-weight:normal; max-height:400px; overflow:auto; }
.linkdescription a { text-decoration: none; color:#3465A4; }
.linkdescription a:hover { color:#F57900; }
.linktaglist { padding-top:10px;}
.linktaglist { padding-top:10px; line-height:200%;}
.linktag {
font-size:9pt;

View file

@ -227,7 +227,7 @@ function nl2br_escaped($html)
return str_replace('>','&gt;',str_replace('<','&lt;',nl2br($html)));
}
/* Returns the small hash of a string
/* Returns the small hash of a string, using RFC 4648 base64url format
eg. smallHash('20111006_131924') --> yZH23w
Small hashes:
- are unique (well, as unique as crc32, at last)
@ -239,10 +239,7 @@ function nl2br_escaped($html)
function smallHash($text)
{
$t = rtrim(base64_encode(hash('crc32',$text,true)),'=');
$t = str_replace('+','-',$t); // Get rid of characters which need encoding in URLs.
$t = str_replace('/','_',$t);
$t = str_replace('=','@',$t);
return $t;
return strtr($t, '+/', '-_');
}
// In a string, converts urls to clickable links.
@ -961,7 +958,7 @@ function showRSS()
echo '<description><![CDATA['.nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description'])))).$via.$descriptionlink.']]></description>'."\n</item>\n";
$i++;
}
echo '</channel></rss><!-- Cached version of '.pageUrl().' -->';
echo '</channel></rss><!-- Cached version of '.htmlspecialchars(pageUrl()).' -->';
$cache->cache(ob_get_contents());
ob_end_flush();
@ -1051,7 +1048,7 @@ function showATOM()
$feed.='<author><name>'.htmlspecialchars($pageaddr).'</name><uri>'.htmlspecialchars($pageaddr).'</uri></author>';
$feed.='<id>'.htmlspecialchars($pageaddr).'</id>'."\n\n"; // Yes, I know I should use a real IRI (RFC3987), but the site URL will do.
$feed.=$entries;
$feed.='</feed><!-- Cached version of '.pageUrl().' -->';
$feed.='</feed><!-- Cached version of '.htmlspecialchars(pageUrl()).' -->';
echo $feed;
$cache->cache(ob_get_contents());
@ -1128,7 +1125,7 @@ function showDailyRSS()
echo '<description><![CDATA['.$html.']]></description>'."\n</item>\n\n";
}
echo '</channel></rss><!-- Cached version of '.pageUrl().' -->';
echo '</channel></rss><!-- Cached version of '.htmlspecialchars(pageUrl()).' -->';
$cache->cache(ob_get_contents());
ob_end_flush();
@ -1575,7 +1572,7 @@ function renderPage()
$link_is_new = true; // This is a new link
$linkdate = strval(date('Ymd_His'));
$title = (empty($_GET['title']) ? '' : $_GET['title'] ); // Get title if it was provided in URL (by the bookmarklet).
$description = (empty($_GET['description']) ? '' : $_GET['description'] )."\n"; // Get description if it was provided in URL (by the bookmarklet). [Bronco added that]
$description = (empty($_GET['description']) ? '' : $_GET['description']); // Get description if it was provided in URL (by the bookmarklet). [Bronco added that]
$tags = (empty($_GET['tags']) ? '' : $_GET['tags'] ); // Get tags if it was provided in URL
$private = (!empty($_GET['private']) && $_GET['private'] === "1" ? 1 : 0); // Get private if it was provided in URL
if (($url!='') && parse_url($url,PHP_URL_SCHEME)=='') $url = 'http://'.$url;
@ -1774,11 +1771,11 @@ function importFile()
}
$LINKSDB->savedb();
echo '<script language="JavaScript">alert("File '.$filename.' ('.$filesize.' bytes) was successfully processed: '.$import_count.' links imported.");document.location=\'?\';</script>';
echo '<script language="JavaScript">alert("File '.json_encode($filename).' ('.$filesize.' bytes) was successfully processed: '.$import_count.' links imported.");document.location=\'?\';</script>';
}
else
{
echo '<script language="JavaScript">alert("File '.$filename.' ('.$filesize.' bytes) has an unknown file format. Nothing was imported.");document.location=\'?\';</script>';
echo '<script language="JavaScript">alert("File '.json_encode($filename).' ('.$filesize.' bytes) has an unknown file format. Nothing was imported.");document.location=\'?\';</script>';
}
}