]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - scripts/commandline.inc
Added wait on signon failure due to update contacts failing
[quix0rs-gnu-social.git] / scripts / commandline.inc
index bca09216d5842c872ccc7c9d61fcd33c6340762b..a475e11d01abba19ba7fb9ba8126f00f312388c7 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, 2009, Control Yourself, Inc.
+ * StatusNet - a distributed open-source microblogging tool
+ * Copyright (C) 2008, 2009, StatusNet, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
@@ -26,7 +26,8 @@ if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
     exit();
 }
 
-define('LACONICA', true);
+define('STATUSNET', true);
+define('LACONICA', true); // compatibility
 
 // Set various flags so we don't time out on long-running processes
 
@@ -122,10 +123,12 @@ require_once INSTALLDIR . '/lib/common.php';
 
 set_error_handler('common_error_handler');
 
-function have_option($opt, $alt=null)
-{
-    global $options;
+// Set up the language infrastructure so we can localize anything that
+// needs to be sent out to users, such as mail notifications.
+common_init_language();
 
+function _make_matches($opt, $alt)
+{
     $matches = array();
 
     if (strlen($opt) > 1 && 0 != strncmp($opt, '--', 2)) {
@@ -142,6 +145,15 @@ function have_option($opt, $alt=null)
         }
     }
 
+    return $matches;
+}
+
+function have_option($opt, $alt=null)
+{
+    global $options;
+
+    $matches = _make_matches($opt, $alt);
+
     foreach ($options as $option) {
         if (in_array($option[0], $matches)) {
             return true;
@@ -151,25 +163,11 @@ function have_option($opt, $alt=null)
     return false;
 }
 
-function get_option_value($str, $alt=null)
+function get_option_value($opt, $alt=null)
 {
     global $options;
 
-    $matches = array();
-
-    if (strlen($opt) > 1 && 0 != strncmp($opt, '--', 2)) {
-        $matches[] = '--'.$opt;
-    } else {
-        $matches[] = $opt;
-    }
-
-    if (!empty($alt)) {
-        if (strlen($alt) > 1 && 0 != strncmp($alt, '--', 2)) {
-            $matches[] = '--'.$alt;
-        } else {
-            $matches[] = $alt;
-        }
-    }
+    $matches = _make_matches($opt, $alt);
 
     foreach ($options as $option) {
         if (in_array($option[0], $matches)) {