]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into 0.9.x
[quix0rs-gnu-social.git] / lib / util.php
index 4312f9876b36ecf1916a972b9985d093909c6c5b..879834a3d5ef52647a0ec14a150b68deba4b7f12 100644 (file)
@@ -178,7 +178,6 @@ function common_ensure_session()
        }
        if (isset($id)) {
            session_id($id);
-           setcookie(session_name(), $id);
        }
         @session_start();
         if (!isset($_SESSION['started'])) {
@@ -596,20 +595,13 @@ function common_linkify($url) {
     }
 
     if (!empty($f)) {
-        if ($f->isEnclosure()) {
+        if ($f->getEnclosure()) {
             $is_attachment = true;
             $attachment_id = $f->id;
-        } else {
-            $foe = File_oembed::staticGet('file_id', $f->id);
-            if (!empty($foe)) {
-                // if it has OEmbed info, it's an attachment, too
-                $is_attachment = true;
-                $attachment_id = $f->id;
-
-                $thumb = File_thumbnail::staticGet('file_id', $f->id);
-                if (!empty($thumb)) {
-                    $has_thumb = true;
-                }
+
+            $thumb = File_thumbnail::staticGet('file_id', $f->id);
+            if (!empty($thumb)) {
+                $has_thumb = true;
             }
         }
     }
@@ -666,6 +658,9 @@ function common_valid_profile_tag($str)
 function common_at_link($sender_id, $nickname)
 {
     $sender = Profile::staticGet($sender_id);
+    if (!$sender) {
+        return $nickname;
+    }
     $recipient = common_relative_profile($sender, common_canonical_nickname($nickname));
     if ($recipient) {
         $user = User::staticGet('id', $recipient->id);
@@ -997,9 +992,14 @@ function common_enqueue_notice($notice)
     static $localTransports = array('omb',
                                     'ping');
 
-    static $allTransports = array('sms', 'plugin');
-
-    $transports = $allTransports;
+    $transports = array();
+    if (common_config('sms', 'enabled')) {
+        $transports[] = 'sms';
+    }
+    if (Event::hasHandler('HandleQueuedNotice')) {
+        $transports[] = 'plugin';
+    }
+    
 
     $xmpp = common_config('xmpp', 'enabled');
 
@@ -1007,6 +1007,7 @@ function common_enqueue_notice($notice)
         $transports[] = 'jabber';
     }
 
+    // @fixme move these checks into QueueManager and/or individual handlers
     if ($notice->is_local == Notice::LOCAL_PUBLIC ||
         $notice->is_local == Notice::LOCAL_NONPUBLIC) {
         $transports = array_merge($transports, $localTransports);