X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Ftagrm.php;h=2e7f8b97082436e8061998997f0150d666147fcb;hb=6dd27b83ef99ca49a59e9d8786ae44138d50ef58;hp=08d390a70bb7112719dca1eee875396632499efa;hpb=e1f366164509fc8217f9d0cf21d7475f6d71b73a;p=friendica.git diff --git a/mod/tagrm.php b/mod/tagrm.php index 08d390a70b..2e7f8b9708 100644 --- a/mod/tagrm.php +++ b/mod/tagrm.php @@ -2,14 +2,15 @@ require_once('include/bbcode.php'); -function tagrm_post(&$a) { +function tagrm_post(App $a) { - if(! local_user()) + if (! local_user()) { goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); + } - - if((x($_POST,'submit')) && ($_POST['submit'] === t('Cancel'))) + if ((x($_POST,'submit')) && ($_POST['submit'] === t('Cancel'))) { goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); + } $tag = ((x($_POST,'tag')) ? hex2bin(notags(trim($_POST['tag']))) : ''); $item = ((x($_POST,'item')) ? intval($_POST['item']) : 0 ); @@ -19,12 +20,13 @@ function tagrm_post(&$a) { intval(local_user()) ); - if(! dbm::is_result($r)) + if (! dbm::is_result($r)) { goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); + } $arr = explode(',', $r[0]['tag']); - for($x = 0; $x < count($arr); $x ++) { - if($arr[$x] === $tag) { + for ($x = 0; $x < count($arr); $x ++) { + if ($arr[$x] === $tag) { unset($arr[$x]); break; } @@ -40,41 +42,42 @@ function tagrm_post(&$a) { info( t('Tag removed') . EOL ); goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); - + // NOTREACHED } -function tagrm_content(&$a) { +function tagrm_content(App $a) { $o = ''; - if(! local_user()) { + if (! local_user()) { goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); // NOTREACHED } $item = (($a->argc > 1) ? intval($a->argv[1]) : 0); - if(! $item) { + if (! $item) { goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); // NOTREACHED } - $r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($item), intval(local_user()) ); - if(! dbm::is_result($r)) + if (! dbm::is_result($r)) { goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); + } $arr = explode(',', $r[0]['tag']); - if(! count($arr)) + if (! count($arr)) { goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); + } $o .= '

' . t('Remove Item Tag') . '

'; @@ -84,8 +87,7 @@ function tagrm_content(&$a) { $o .= ''; $o .= '