diff --git a/index.php b/index.php
index 23a6294..0643a4d 100644
--- a/index.php
+++ b/index.php
@@ -432,6 +432,12 @@ if (isset($_POST['login']))
// ------------------------------------------------------------------------------------------
// Misc utility functions:
+// Try to get just domain for @via
+function getJustDomain($url){
+ $parts = parse_url($url);
+ return trim($parts['host']);
+ }
+
// Returns the server URL (including port and http/https), without path.
// eg. "http://myserver.com:8080"
// You can append $_SERVER['SCRIPT_NAME'] to get the current script URL.
@@ -794,7 +800,8 @@ class linkdb implements Iterator, Countable, ArrayAccess
$found= (strpos(strtolower($l['title']),$s)!==false)
|| (strpos(strtolower($l['description']),$s)!==false)
|| (strpos(strtolower($l['url']),$s)!==false)
- || (strpos(strtolower($l['tags']),$s)!==false);
+ || (strpos(strtolower($l['tags']),$s)!==false)
+ || (strpos(strtolower($l['via']),$s)!==false);
if ($found) $filtered[$l['linkdate']] = $l;
}
krsort($filtered);
@@ -939,7 +946,12 @@ function showRSS()
// If user wants permalinks first, put the final link in description
if ($usepermalinks===true) $descriptionlink = '(Link)';
if (strlen($link['description'])>0) $descriptionlink = ' '.$descriptionlink;
- echo ''."\n\n";
+ if(!empty($link['via'])){
+ $via = ' via '.text2clickable(htmlspecialchars($link['via']));
+ } else {
+ $via = '';
+ }
+ echo ''."\n\n";
$i++;
}
echo '';
@@ -1001,11 +1013,12 @@ function showATOM()
// Add permalink in description
$descriptionlink = htmlspecialchars('(Permalink)');
+ $via = htmlspecialchars(' via '.(text2clickable(htmlspecialchars($link['via']))));
// If user wants permalinks first, put the final link in description
if ($usepermalinks===true) $descriptionlink = htmlspecialchars('(Link)');
if (strlen($link['description'])>0) $descriptionlink = '<br>'.$descriptionlink;
- $entries.=''.htmlspecialchars(nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description']))))).$descriptionlink."\n";
+ $entries.=''.htmlspecialchars(nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description']))))).$descriptionlink.$via."\n";
if ($link['tags']!='') // Adding tags to each ATOM entry (as mentioned in ATOM specification)
{
foreach(explode(' ',$link['tags']) as $tag)
@@ -1472,7 +1485,7 @@ function renderPage()
if (!startsWith($url,'http:') && !startsWith($url,'https:') && !startsWith($url,'ftp:') && !startsWith($url,'magnet:') && !startsWith($url,'?'))
$url = 'http://'.$url;
$link = array('title'=>trim($_POST['lf_title']),'url'=>$url,'description'=>trim($_POST['lf_description']),'private'=>(isset($_POST['lf_private']) ? 1 : 0),
- 'linkdate'=>$linkdate,'tags'=>str_replace(',',' ',$tags));
+ 'linkdate'=>$linkdate,'tags'=>str_replace(',',' ',$tags), 'via'=>trim($_POST['lf_via']));
if ($link['title']=='') $link['title']=$link['url']; // If title is empty, use the URL as title.
$LINKSDB[$linkdate] = $link;
$LINKSDB->savedb(); // save to disk
@@ -1582,7 +1595,7 @@ function renderPage()
}
}
if ($url=='') $url='?'.smallHash($linkdate); // In case of empty URL, this is just a text (with a link that point to itself)
- $link = array('linkdate'=>$linkdate,'title'=>$title,'url'=>$url,'description'=>$description,'tags'=>$tags,'private'=>$private);
+ $link = array('linkdate'=>$linkdate,'title'=>$title,'url'=>$url,'description'=>$description,'tags'=>$tags,'via' => $via,'private'=>$private);
}
$PAGE = new pageBuilder;
@@ -1832,6 +1845,9 @@ function buildLinkList($PAGE,$LINKSDB)
$taglist = explode(' ',$link['tags']);
uasort($taglist, 'strcasecmp');
$link['taglist']=$taglist;
+ if(!empty($link['via'])){
+ $link['via']=htmlspecialchars($link['via']);
+ }
$linkDisp[$keys[$i]] = $link;
$i++;
}
diff --git a/tpl/editlink.html b/tpl/editlink.html
index 4a2c30c..0da1405 100644
--- a/tpl/editlink.html
+++ b/tpl/editlink.html
@@ -16,6 +16,7 @@
Title