home » zplus/freepost.git
Author zPlus <--> 2016-11-13 05:28:57
Committer zPlus <--> 2016-11-13 05:28:57
Commit 912d2e3 (patch)
Tree 78aa20a
Parent(s)

Remove 'http://' prefix from empty links


commits diff: a4eeb5a..912d2e3
1 file changed, 10 insertions, 3 deletionsdownload


Diffstat
-rw-r--r-- submit.php 13

Diff options
View
Side
Whitespace
Context lines
Inter-hunk lines
+10/-3 M   submit.php
index 58ccda9..06d3e95
old size: 1K - new size: 1K
@@ -35,9 +35,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST')
35 35
36 36 // Normalize Link
37 37 $link = trim ($_POST['link']);
38 - $link_components = parse_url ($link);
39 - if (!isset ($link_components['scheme']))
40 - $link = 'http://' . $link;
38 +
39 + // If no link given, keep an empty string
40 + if (strlen ($link) > 0)
41 + {
42 + $link_components = parse_url ($link);
43 +
44 + // Make sure there's a "scheme"
45 + if (!isset ($link_components['scheme']))
46 + $link = 'http://' . $link;
47 + }
41 48
42 49 // Add the new post
43 50 $post_hash_id = $db->new_post ($title, $link, $_POST['text'], Session::get_userid());