X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Futil.php;h=9872d97c4895f8f66cbae97ae4bf565cf817623d;hb=adfb79a9bbdfb43f35c0f022c1de6118b10ce115;hp=25c0fb0a15915467e2a6a64f3a316122c7472cee;hpb=2e394ef47ce2f069e331c24586cda13bc34413aa;p=quix0rs-gnu-social.git diff --git a/lib/util.php b/lib/util.php index 25c0fb0a15..9872d97c48 100644 --- a/lib/util.php +++ b/lib/util.php @@ -496,11 +496,32 @@ function common_linkify($url) { } $attrs = array('href' => $longurl, 'rel' => 'external'); -if(0){ - if ($longurl !== $url) { - $attrs['title'] = $longurl; + +// if this URL is an attachment, then we set class='attachment' and id='attahcment-ID' +// where ID is the id of the attachment for the given URL. +// +// we need a better test telling what can be shown as an attachment +// we're currently picking up oembeds only. +// I think the best option is another file_view table in the db +// and associated dbobject. + $query = "select file_oembed.file_id as file_id from file join file_oembed on file.id = file_oembed.file_id where file.url='$longurl'"; + $file = new File; + $file->query($query); + $file->fetch(); + + if (!empty($file->file_id)) { + $query = "select file_thumbnail.file_id as file_id from file join file_thumbnail on file.id = file_thumbnail.file_id where file.url='$longurl'"; + $file2 = new File; + $file2->query($query); + $file2->fetch(); + + if (empty($file2->file_id)) { + $attrs['class'] = 'attachment'; + } else { + $attrs['class'] = 'attachment thumbnail'; + } + $attrs['id'] = "attachment-{$file->file_id}"; } -} return XMLStringer::estring('a', $attrs, $display); } @@ -879,6 +900,34 @@ function common_enqueue_notice($notice) return $result; } +function common_post_inbox_transports() +{ + $transports = array('omb', 'sms'); + + if (common_config('xmpp', 'enabled')) { + $transports = array_merge($transports, array('jabber', 'public')); + } + + return $transports; +} + +function common_enqueue_notice_transport($notice, $transport) +{ + $qi = new Queue_item(); + $qi->notice_id = $notice->id; + $qi->transport = $transport; + $qi->created = $notice->created; + $result = $qi->insert(); + if (!$result) { + $last_error = &PEAR::getStaticProperty('DB_DataObject','lastError'); + common_log(LOG_ERR, 'DB error inserting queue item: ' . $last_error->message); + throw new ServerException('DB error inserting queue item: ' . $last_error->message); +>>>>>>> 0.7.x:lib/util.php + } + common_log(LOG_DEBUG, 'complete queueing notice ID = ' . $notice->id . ' for ' . $transport); + return true; +} + function common_real_broadcast($notice, $remote=false) { $success = true;