X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=mod%2Ftagrm.php;h=2e7f8b97082436e8061998997f0150d666147fcb;hb=f94a10bf00de699a5f3d22ea74665053a5661175;hp=176986bc38e23cc195918b60b3f0e995e4b28fab;hpb=29092ace4428aeb796b31856aafa14cef1632bac;p=friendica.git diff --git a/mod/tagrm.php b/mod/tagrm.php index 176986bc38..2e7f8b9708 100644 --- a/mod/tagrm.php +++ b/mod/tagrm.php @@ -2,14 +2,15 @@ require_once('include/bbcode.php'); -function tagrm_post(&$a) { - - if(! local_user()) - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); +function tagrm_post(App $a) { + if (! local_user()) { + goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); + } - if((x($_POST,'submit')) && ($_POST['submit'] === t('Cancel'))) - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + 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(! count($r)) - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + 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; } @@ -39,42 +41,43 @@ function tagrm_post(&$a) { ); info( t('Tag removed') . EOL ); - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); - + goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); + // NOTREACHED } -function tagrm_content(&$a) { +function tagrm_content(App $a) { $o = ''; - if(! local_user()) { - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + if (! local_user()) { + goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); // NOTREACHED } $item = (($a->argc > 1) ? intval($a->argv[1]) : 0); - if(! $item) { - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + 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(! count($r)) - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + if (! dbm::is_result($r)) { + goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); + } $arr = explode(',', $r[0]['tag']); - if(! count($arr)) - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + if (! count($arr)) { + goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); + } $o .= '