/** * @brief Test whether a given identity is a member of the Hubzilla. * * @param string $s; * xchan_hash of the identity in question * @returns boolean true or false */ function is_member($s) { return is_foreigner($s) ? false : true; }
function theme_attachments(&$item) { $arr = json_decode_plus($item['attach']); if (is_array($arr) && count($arr)) { $attaches = array(); foreach ($arr as $r) { $icon = ''; $icontype = substr($r['type'], 0, strpos($r['type'], '/')); /** * @FIXME This should probably be a giant "if" statement in the * template so that we don't have icon names embedded in php code. */ switch ($icontype) { case 'video': $icon = 'icon-facetime-video'; break; case 'audio': $icon = 'icon-volume-up'; break; case 'image': $icon = 'icon-picture'; break; case 'text': $icon = 'icon-align-justify'; break; default: $icon = 'icon-question'; break; } $title = htmlspecialchars($r['title'], ENT_COMPAT, 'UTF-8'); if (!$title) { $title = t('unknown.???'); } $title .= ' ' . $r['length'] . ' ' . t('bytes'); require_once 'include/identity.php'; if (is_foreigner($item['author_xchan'])) { $url = $r['href']; } else { $url = z_root() . '/magic?f=&hash=' . $item['author_xchan'] . '&dest=' . $r['href'] . '/' . $r['revision']; } $s .= '<a href="' . $url . '" title="' . $title . '" class="attachlink" >' . $icon . '</a>'; $attaches[] = array('title' => $title, 'url' => $url, 'icon' => $icon); } } $s = replace_macros(get_markup_template('item_attach.tpl'), array('$attaches' => $attaches)); return $s; }
function theme_attachments(&$item) { $arr = json_decode_plus($item['attach']); if (is_array($arr) && count($arr)) { $attaches = array(); foreach ($arr as $r) { $icon = getIconFromType($r['type']); $label = $r['title'] ? urldecode(htmlspecialchars($r['title'], ENT_COMPAT, 'UTF-8')) : t('Unknown Attachment'); //some feeds provide an attachment where title an empty space if ($label == ' ') { $label = t('Unknown Attachment'); } $title = t('Size') . ' ' . ($r['length'] ? userReadableSize($r['length']) : t('unknown')); require_once 'include/identity.php'; if (is_foreigner($item['author_xchan'])) { $url = $r['href']; } else { $url = z_root() . '/magic?f=&hash=' . $item['author_xchan'] . '&dest=' . $r['href'] . '/' . $r['revision']; } //$s .= '<a href="' . $url . '" title="' . $title . '" class="attachlink" >' . $icon . '</a>'; $attaches[] = array('label' => $label, 'url' => $url, 'icon' => $icon, 'title' => $title); } $s = replace_macros(get_markup_template('item_attach.tpl'), array('$attaches' => $attaches)); } return $s; }
/** * Remote visitors also need to be checked against the public_scope parameter if item_private is set. * This function checks the various permutations of that field for any which apply to this observer. * */ function scopes_sql($uid, $observer) { $str = " and ( public_policy = 'authenticated' "; if (!is_foreigner($observer)) { $str .= " or public_policy = 'network: red' "; } if (local_channel()) { $str .= " or public_policy = 'site: " . App::get_hostname() . "' "; } $ab = q("select * from abook where abook_xchan = '%s' and abook_channel = %d limit 1", dbesc($observer), intval($uid)); if (!$ab) { return $str . " ) "; } if ($ab[0]['abook_pending']) { $str .= " or public_policy = 'any connections' "; } $str .= " or public_policy = 'contacts' ) "; return $str; }