]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
Twitter-compatible API - /statuses/show and /statuses/update now work
[quix0rs-gnu-social.git] / lib / util.php
index 1aa9d2944c9b044da1930fdfb3cb37639bf3cfa2..9f235494bc02dbfb9eb3d0aebf349dd281b4047c 100644 (file)
@@ -223,6 +223,14 @@ function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall=
        common_element_start('div', array('id' => 'content'));
 }
 
+# XXX: Refactor w/common_user_error() ?
+function common_show_basic_auth_error() {
+       header('HTTP/1.1 401 Unauthorized');
+       header('Content-type: text/plain');
+       print("Could not authenticate you.\n"); # exactly what Twitter says
+       exit();
+}
+
 function common_show_footer() {
        global $xw, $config;
        common_element_end('div'); # content div
@@ -853,6 +861,16 @@ function common_date_w3dtf($dt) {
        return date(DATE_W3C, $t);
 }
 
+function common_date_rfc2822($dt) {
+       $t = strtotime($dt);
+       return date("r", $t);   
+}
+
+function common_date_iso8601($dt) {
+       $t = strtotime($dt);
+       return date("c", $t);   
+}
+
 function common_redirect($url, $code=307) {
        static $status = array(301 => "Moved Permanently",
                                                   302 => "Found",
@@ -880,7 +898,7 @@ function common_save_replies($notice) {
                return true;
        }
        # XXX: is there another way to make an array copy?
-       $names = ($tname) ? array_unique(array_merge(array(strtolower($tname)), $match[1])) : $match[1];
+       $names = ($tname) ? array_unique(array_merge(array(strtolower($tname)), $match[1])) : array_unique($match[1]);
        $sender = Profile::staticGet($notice->profile_id);
        # store replied only for first @ (what user/notice what the reply directed,
        # we assume first @ is it)
@@ -1054,7 +1072,6 @@ function common_ensure_syslog() {
        static $initialized = false;
        if (!$initialized) {
                global $config;
-               define_syslog_variables();
                openlog($config['syslog']['appname'], 0, LOG_USER);
                $initialized = true;
        }