]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
move getUser() function to commandline.inc
authorEvan Prodromou <evan@status.net>
Wed, 15 Sep 2010 20:00:00 +0000 (16:00 -0400)
committerEvan Prodromou <evan@status.net>
Wed, 15 Sep 2010 20:00:00 +0000 (16:00 -0400)
scripts/commandline.inc
scripts/importtwitteratom.php

index a475e11d01abba19ba7fb9ba8126f00f312388c7..a29f588448db88f7d048be2d5475ebe9f786874e 100644 (file)
@@ -177,3 +177,27 @@ function get_option_value($opt, $alt=null)
 
     return null;
 }
+
+function getUser()
+{
+    $user = null;
+
+    if (have_option('i', 'id')) {
+        $id = get_option_value('i', 'id');
+        $user = User::staticGet('id', $id);
+        if (empty($user)) {
+            throw new Exception("Can't find user with id '$id'.");
+        }
+    } else if (have_option('n', 'nickname')) {
+        $nickname = get_option_value('n', 'nickname');
+        $user = User::staticGet('nickname', $nickname);
+        if (empty($user)) {
+            throw new Exception("Can't find user with nickname '$nickname'");
+        }
+    } else {
+        show_help();
+        exit(1);
+    }
+
+    return $user;
+}
index c12e3b91a8f3a920ce9fc9c4f21e08fded44b83d..261dfb1d02b7af595d628632eec97f1af2947cb4 100644 (file)
@@ -36,30 +36,6 @@ END_OF_IMPORTTWITTERATOM_HELP;
 require_once INSTALLDIR.'/scripts/commandline.inc';
 require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php';
 
-function getUser()
-{
-    $user = null;
-
-    if (have_option('i', 'id')) {
-        $id = get_option_value('i', 'id');
-        $user = User::staticGet('id', $id);
-        if (empty($user)) {
-            throw new Exception("Can't find user with id '$id'.");
-        }
-    } else if (have_option('n', 'nickname')) {
-        $nickname = get_option_value('n', 'nickname');
-        $user = User::staticGet('nickname', $nickname);
-        if (empty($user)) {
-            throw new Exception("Can't find user with nickname '$nickname'");
-        }
-    } else {
-        show_help();
-        exit(1);
-    }
-
-    return $user;
-}
-
 function getAtomFeedDocument()
 {
     $filename = get_option_value('f', 'file');