X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=scripts%2Fsettag.php;h=ca260f7bf9456822fb42139299fe545960b1cae7;hb=b37e12ed3436e7616c491016a68342559752d178;hp=1d7b60b9023cd5ce64657f54b8a788235a292d4d;hpb=4a0413c0270bcac456c20972342c2c29182bec4e;p=quix0rs-gnu-social.git diff --git a/scripts/settag.php b/scripts/settag.php index 1d7b60b902..ca260f7bf9 100644 --- a/scripts/settag.php +++ b/scripts/settag.php @@ -33,32 +33,33 @@ END_OF_SETTAG_HELP; require_once INSTALLDIR.'/scripts/commandline.inc'; -if (count($args) != 2) { +if (count($args) < 1) { show_help(); exit(1); } $nickname = $args[0]; -$tag = strtolower($args[1]); - $sn = Status_network::memGet('nickname', $nickname); if (empty($sn)) { - print "No such site.\n"; + print "No such site ($nickname).\n"; exit(-1); } $tags = $sn->getTags(); -$i = array_search($tags, $tag); +if (count($args) == 1) { + print(implode(', ', $tags) . "\n"); + exit(0); +} +$tag = $args[1]; +$i = array_search($tag, $tags); if ($i !== false) { if (have_option('d', 'delete')) { // Delete unset($tags[$i]); - $orig = clone($sn); - $sn->tags = implode('|', $tags); - $result = $sn->update($orig); + $result = $sn->setTags($tags); if (!$result) { print "Couldn't update.\n"; exit(-1); @@ -73,9 +74,7 @@ if ($i !== false) { exit(-1); } else { $tags[] = $tag; - $orig = clone($sn); - $sn->tags = implode('|', $tags); - $result = $sn->update($orig); + $result = $sn->setTags($tags); if (!$result) { print "Couldn't update.\n"; exit(-1);