Browse Source

trim line separators as URL validation fails

main
ghost 1 year ago
parent
commit
eb6516549c
  1. 8
      src/public/edit.php

8
src/public/edit.php

@ -353,6 +353,8 @@ else {
{ {
foreach (explode(PHP_EOL, str_replace(['#', ',', ' '], PHP_EOL, $_POST['kt'])) as $kt) foreach (explode(PHP_EOL, str_replace(['#', ',', ' '], PHP_EOL, $_POST['kt'])) as $kt)
{ {
$kt = trim($kt);
if (!empty(trim($kt))) if (!empty(trim($kt)))
{ {
$db->initMagnetToKeywordTopicId( $db->initMagnetToKeywordTopicId(
@ -373,6 +375,8 @@ else {
foreach (explode(PHP_EOL, str_replace(['#', ',', ' '], PHP_EOL, $_POST['tr'])) as $tr) foreach (explode(PHP_EOL, str_replace(['#', ',', ' '], PHP_EOL, $_POST['tr'])) as $tr)
{ {
$tr = trim($tr);
if (Valid::url($tr)) if (Valid::url($tr))
{ {
if ($url = Yggverse\Parser\Url::parse($tr)) if ($url = Yggverse\Parser\Url::parse($tr))
@ -404,6 +408,8 @@ else {
foreach (explode(PHP_EOL, str_replace(['#', ',', ' '], PHP_EOL, $_POST['as'])) as $as) foreach (explode(PHP_EOL, str_replace(['#', ',', ' '], PHP_EOL, $_POST['as'])) as $as)
{ {
$xs = trim($as);
if (Valid::url($as)) if (Valid::url($as))
{ {
if ($url = Yggverse\Parser\Url::parse($as)) if ($url = Yggverse\Parser\Url::parse($as))
@ -435,6 +441,8 @@ else {
foreach (explode(PHP_EOL, str_replace(['#', ',', ' '], PHP_EOL, $_POST['xs'])) as $xs) foreach (explode(PHP_EOL, str_replace(['#', ',', ' '], PHP_EOL, $_POST['xs'])) as $xs)
{ {
$xs = trim($xs);
if (Valid::url($xs)) if (Valid::url($xs))
{ {
if ($url = Yggverse\Parser\Url::parse($xs)) if ($url = Yggverse\Parser\Url::parse($xs))

Loading…
Cancel
Save