aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2015-09-08 22:03:18 +0200
committerVirtualTam <virtualtam@flibidi.net>2015-09-08 22:03:18 +0200
commitce47a75864d7d398a68705df67da2ae00ca89eca (patch)
treea58c1bcaab33d42161b23d55c739737526ea17e9 /index.php
parent0a813cfd7cdf3c81faba8568bf6e2e667aae6f13 (diff)
parentef591e7ee21435da9314c5f7f6ea983c6f423898 (diff)
downloadShaarli-ce47a75864d7d398a68705df67da2ae00ca89eca.tar.gz
Shaarli-ce47a75864d7d398a68705df67da2ae00ca89eca.tar.zst
Shaarli-ce47a75864d7d398a68705df67da2ae00ca89eca.zip
Merge pull request #337 from doc75/doublon_url
#325 small enhancement to fix the GetLinkFromUrl method
Diffstat (limited to 'index.php')
-rwxr-xr-xindex.php9
1 files changed, 4 insertions, 5 deletions
diff --git a/index.php b/index.php
index e39cff38..61d92f04 100755
--- a/index.php
+++ b/index.php
@@ -1454,12 +1454,11 @@ function renderPage()
1454 1454
1455 // -------- User want to post a new link: Display link edit form. 1455 // -------- User want to post a new link: Display link edit form.
1456 if (isset($_GET['post'])) { 1456 if (isset($_GET['post'])) {
1457 $url = new Url($_GET['post']); 1457 $url = cleanup_url($_GET['post']);
1458 $url->cleanup();
1459 1458
1460 $link_is_new = false; 1459 $link_is_new = false;
1461 // Check if URL is not already in database (in this case, we will edit the existing link) 1460 // Check if URL is not already in database (in this case, we will edit the existing link)
1462 $link = $LINKSDB->getLinkFromUrl((string)$url); 1461 $link = $LINKSDB->getLinkFromUrl($url);
1463 if (!$link) 1462 if (!$link)
1464 { 1463 {
1465 $link_is_new = true; 1464 $link_is_new = true;
@@ -1471,7 +1470,7 @@ function renderPage()
1471 $tags = (empty($_GET['tags']) ? '' : $_GET['tags'] ); 1470 $tags = (empty($_GET['tags']) ? '' : $_GET['tags'] );
1472 $private = (!empty($_GET['private']) && $_GET['private'] === "1" ? 1 : 0); 1471 $private = (!empty($_GET['private']) && $_GET['private'] === "1" ? 1 : 0);
1473 // If this is an HTTP(S) link, we try go get the page to extract the title (otherwise we will to straight to the edit form.) 1472 // If this is an HTTP(S) link, we try go get the page to extract the title (otherwise we will to straight to the edit form.)
1474 if (empty($title) && strpos($url->getScheme(), 'http') !== false) { 1473 if (empty($title) && strpos(get_url_scheme($url), 'http') !== false) {
1475 // Short timeout to keep the application responsive 1474 // Short timeout to keep the application responsive
1476 list($headers, $data) = get_http_url($url, 4); 1475 list($headers, $data) = get_http_url($url, 4);
1477 // FIXME: Decode charset according to specified in either 1) HTTP response headers or 2) <head> in html 1476 // FIXME: Decode charset according to specified in either 1) HTTP response headers or 2) <head> in html
@@ -1505,7 +1504,7 @@ function renderPage()
1505 $link = array( 1504 $link = array(
1506 'linkdate' => $linkdate, 1505 'linkdate' => $linkdate,
1507 'title' => $title, 1506 'title' => $title,
1508 'url' => (string)$url, 1507 'url' => $url,
1509 'description' => $description, 1508 'description' => $description,
1510 'tags' => $tags, 1509 'tags' => $tags,
1511 'private' => $private 1510 'private' => $private