aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authornodiscc <nodiscc@gmail.com>2015-03-05 13:42:38 +0100
committernodiscc <nodiscc@gmail.com>2015-03-05 13:42:38 +0100
commit01b8f52718f5136fb7de54e09b47ae4523aec9e8 (patch)
treecc4b80e8691c6472689bf14df4f184466886c3f0 /index.php
parent0e5400e6178468cd0da0b266123545db2a80f707 (diff)
parentbaf5cbf27d18467d838a24b6f451036cebaa27bf (diff)
downloadShaarli-01b8f52718f5136fb7de54e09b47ae4523aec9e8.tar.gz
Shaarli-01b8f52718f5136fb7de54e09b47ae4523aec9e8.tar.zst
Shaarli-01b8f52718f5136fb7de54e09b47ae4523aec9e8.zip
Merge pull request #141 from nodiscc/cleanurl-filters
Add URL cleaning filters + refactoring
Diffstat (limited to 'index.php')
-rw-r--r--index.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/index.php b/index.php
index 890eb581..a8326a2b 100644
--- a/index.php
+++ b/index.php
@@ -1642,10 +1642,13 @@ function renderPage()
1642 { 1642 {
1643 $url=$_GET['post']; 1643 $url=$_GET['post'];
1644 1644
1645 // We remove the annoying parameters added by FeedBurner and GoogleFeedProxy (?utm_source=...) 1645
1646 $i=strpos($url,'&utm_source='); if ($i!==false) $url=substr($url,0,$i); 1646 // We remove the annoying parameters added by FeedBurner, GoogleFeedProxy, Facebook...
1647 $i=strpos($url,'?utm_source='); if ($i!==false) $url=substr($url,0,$i); 1647 $annoyingpatterns = array('/[\?&]utm_source=[^&]*/', '/[\?&]utm_campaign=[^&]*/', '/[\?&]utm_medium=[^&]*/', '/#xtor=RSS-[^&]*/', '/[\?&]fb_[^&]*/', '/[\?&]__scoop[^&]*/', '/#tk\.rss_all\?/', '/[\?&]action_ref_map=[^&]*/', '/[\?&]action_type_map=[^&]*/', '/[\?&]action_object_map=[^&]*/');
1648 $i=strpos($url,'#xtor=RSS-'); if ($i!==false) $url=substr($url,0,$i); 1648 foreach($annoyingpatterns as $pattern)
1649 {
1650 $url = preg_replace($pattern, "", $url);
1651 }
1649 1652
1650 $link_is_new = false; 1653 $link_is_new = false;
1651 $link = $LINKSDB->getLinkFromUrl($url); // Check if URL is not already in database (in this case, we will edit the existing link) 1654 $link = $LINKSDB->getLinkFromUrl($url); // Check if URL is not already in database (in this case, we will edit the existing link)