]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - scripts/settag.php
Merge remote-tracking branch 'upstream/master'
[quix0rs-gnu-social.git] / scripts / settag.php
old mode 100644 (file)
new mode 100755 (executable)
index d1b06ff..3c234f2
@@ -31,7 +31,7 @@ With -d, delete the tag.
 
 END_OF_SETTAG_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 if (count($args) < 1) {
     show_help();
@@ -39,11 +39,10 @@ if (count($args) < 1) {
 }
 
 $nickname = $args[0];
-
 $sn = Status_network::memGet('nickname', $nickname);
 
 if (empty($sn)) {
-    print "No such site.\n";
+    print "No such site ($nickname).\n";
     exit(-1);
 }
 
@@ -54,33 +53,28 @@ if (count($args) == 1) {
        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);
         }
     } else {
         print "Already set.\n";
-        exit(-1);
+        exit(0);
     }
 } else {
     if (have_option('d', 'delete')) { // Delete
         print "No such tag.\n";
-        exit(-1);
+        exit(0);
     } 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);