}
} catch (NoParentNoticeException $e) {
// It wasn't a reply to anything, so we can't harvest nickname-relations.
+ } catch (NoResultException $e) {
+ // The parent notice was deleted.
}
$matches = common_find_mentions_raw($text);
$tagged = $sender->getTaggedSubscribers($tag);
$url = common_local_url('showprofiletag',
- array('tagger' => $sender->nickname,
+ array('nickname' => $sender->getNickname(),
'tag' => $tag));
$mentions[] = array('mentioned' => $tagged,
$canon = "mailto:$url";
$longurl = "mailto:$url";
} else {
-
$canon = File_redirection::_canonUrl($url);
-
$longurl_data = File_redirection::where($canon, common_config('attachments', 'process_links'));
- if (is_array($longurl_data)) {
- $longurl = $longurl_data['url'];
- } elseif (is_string($longurl_data)) {
- $longurl = $longurl_data;
- } else {
- // Unable to reach the server to verify contents, etc
- // Just pass the link on through for now.
- common_log(LOG_ERR, "Can't linkify url '$url'");
- $longurl = $url;
- }
+ $longurl = $longurl_data->url;
}
$attrs = array('href' => $canon, 'title' => $longurl);
}
/**
- * returns $bytes bytes of random data as a hexadecimal string
+ * returns $bytes bytes of raw random data
*/
-function common_random_hexstr($bytes)
+function common_random_rawstr($bytes)
{
- $str = @file_exists('/dev/urandom')
+ $rawstr = @file_exists('/dev/urandom')
? common_urandom($bytes)
: common_mtrand($bytes);
+ return $rawstr;
+}
+
+/**
+ * returns $bytes bytes of random data as a hexadecimal string
+ */
+function common_random_hexstr($bytes)
+{
+ $str = common_random_rawstr($bytes);
+
$hexstr = '';
for ($i = 0; $i < $bytes; $i++) {
$hexstr .= sprintf("%02x", ord($str[$i]));
return strtolower($tmp[0]);
}
+// Get only the mimetype and not additional info (separated from bare mime with semi-colon)
function common_bare_mime($mimetype)
{
$mimetype = mb_strtolower($mimetype);