1
0
mirror of https://github.com/gamaio/lobli.git synced 2024-12-22 11:42:40 +00:00

Remove title grabbing.

This thing is just a big pain and isn't really needed, so I'm removing it.
Really the options for getting the title or even the description involved downloading the whole file.
This commit is contained in:
alopexc0de 2014-08-15 19:35:35 -04:00
parent 0836e64c80
commit cacd80a024
No known key found for this signature in database
GPG Key ID: 48E847F18074C953
3 changed files with 5 additions and 20 deletions

View File

@ -26,8 +26,6 @@
}else{
do {
if(checkRemoteFile($link) !== true) return "2$seperator$link";
//if(($title = getRemoteTitle($url)) !== true) return "2$seperator$link";
$title = "google";
$short = substr(number_format(time() * mt_rand(),0,'',''),0,5);
$short = base_convert($short, 10, 36);
@ -47,7 +45,6 @@
$redis->set("llinks:$link", $short);
$redis->rpush("links:$short", $link);
$redis->rpush("links:$short", $title);
$redis->rpush("links:$short", date("m/d/Y"));
$redis->expireAt("links:$short", $now+$xTime);
$redis->expireAt("llinks:$link", $now+$xTime);
@ -58,14 +55,6 @@
}
}
function getRemoteTitle($url){
$url = parse_url($url);
if($tags = get_meta_tags($url['scheme'].'://'.$url['host'])){
$ret = $tags['description'];
return $ret;
}else{ return false; }
}
function checkRemoteFile($ip=null){
if($ip==null) return false;

View File

@ -24,12 +24,11 @@
$short = "";
$link = "";
$error = "";
$title = "";
$messages = array(
"
<div class=\"alert alert-success\" id=\"success\">
Your Resolved link: <a href=\"$link\" title=\"$title\">
Your Resolved link: <a href=\"$link\">
<span class=\"longlink\">$link</span></a>
<a href=\"#\" id=\"copylink\" title=\"Copy Link\" onclick=\"copyToClipboard('$link');\">
@ -39,7 +38,7 @@
",
"
<div class=\"alert alert-warning\" id=\"warning\">
Your link: <a href=\"$link\" title=\"$title\">
Your link: <a href=\"$link\">
<span class=\"longlink2\">$link</span></a> is not a lob.li link.<br> However we found that it has been shortened. <a href=\"http://lob.li/$short\" title=\"$title\">lob.li/$short</a>
<a href=\"#\" id=\"copylink\" title=\"Copy Link\" onclick=\"copyToClipboard('http://lob.li/$short');\">
<span class=\"glyphicon glyphicon-link\" style=\"float:right;padding-right:1%;\"></span>
@ -96,10 +95,9 @@
switch($retCode){
case "0": // Successful link Shorten
$short = $reShort[1];
$title = $reShort[2];
echo "
<div class=\"alert alert-success\" id=\"success\">
Your link: <a href=\"http://lob.li/$short\" title=\"$title\" target=\"lobli.$short\">lob.li/$short</a>
Your link: <a href=\"http://lob.li/$short\" target=\"lobli.$short\">lob.li/$short</a>
<a href=\"#\" id=\"copylink\" title=\"Copy Link\" onclick=\"copyToClipboard('http://lob.li/$short');\">
<!--<a href=\"#\" id=\"newlink\" title=\"New Link\"> This would require changing how I generate links, and I don't feel like doing it right now - 6/22/12 1:21am EST
<span class=\"glyphicon glyphicon-refresh\" style=\"float:right;\"></span>
@ -112,10 +110,9 @@
case "1": // Existing Short Link Found
$short = $reShort[1];
$title = $reShort[2];
echo "
<div class=\"alert alert-warning\" id=\"warning\">
Existing link: <a href=\"http://lob.li/$short\" title=\"$title\" target=\"lobli.$short\">lob.li/$short</a>
Existing link: <a href=\"http://lob.li/$short\" target=\"lobli.$short\">lob.li/$short</a>
<a href=\"#\" id=\"copylink\" title=\"Copy Link\" onclick=\"copyToClipboard('http://lob.li/$short');\">
<span class=\"glyphicon glyphicon-link\" style=\"float:right;padding-right:1%;\"></span>
</a>

View File

@ -59,7 +59,6 @@
$linkData = $redis->lRange("links:$id", 0, -1);
$link = $linkData[0];
$title = $linkData[1];
$date = $linkData[2];
$trackClicks = $redis->zScore("tracking:clicks", $id);
@ -67,7 +66,7 @@
<tr class=\"success\">
<td></td>
<td class=\"centertab\"><a href=\"http://lob.li/$id\">$id</a></td>
<td><a href=\"$link\" title=\"$title\" class=\"res\">$link</a></td>
<td><a href=\"$link\" class=\"res\">$link</a></td>
<td class=\"centertab\">$trackClicks</td>
<td>$date</td>
</tr>