Merge pull request #3287 from Quix0r/rewrites/coding-convention-split2-1-2

Coding convention applied split 2-1-2 (of 2-14-2)
This commit is contained in:
Hypolite Petovan 2017-04-19 20:39:07 -04:00 committed by GitHub
commit 0811f9257e
13 changed files with 2342 additions and 1804 deletions

View file

@ -4,11 +4,11 @@
* @file include/acl_selectors.php
*/
require_once("include/contact_selectors.php");
require_once("include/contact_widgets.php");
require_once("include/DirSearch.php");
require_once("include/features.php");
require_once("mod/proxy.php");
require_once "include/contact_selectors.php";
require_once "include/contact_widgets.php";
require_once "include/DirSearch.php";
require_once "include/features.php";
require_once "mod/proxy.php";
/**
@ -35,10 +35,11 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
if (dbm::is_result($r)) {
foreach ($r as $rr) {
if((is_array($preselected)) && in_array($rr['id'], $preselected))
if ((is_array($preselected)) && in_array($rr['id'], $preselected)) {
$selected = " selected=\"selected\" ";
else
} else {
$selected = '';
}
$trimmed = mb_substr($rr['name'],0,12);
@ -54,7 +55,8 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
return $o;
}
/// @TODO after an optional parameter, no mandadory parameter can follow
/// @TODO find proper type-hints
function contact_selector($selname, $selclass, $preselected = false, $options) {
$a = get_app();
@ -88,18 +90,20 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
$networks = array(NETWORK_DFRN);
break;
case 'PRIVATE':
if(is_array($a->user) && $a->user['prvnets'])
if (is_array($a->user) && $a->user['prvnets']) {
$networks = array(NETWORK_DFRN, NETWORK_MAIL, NETWORK_DIASPORA);
else
} else {
$networks = array(NETWORK_DFRN, NETWORK_FACEBOOK, NETWORK_MAIL, NETWORK_DIASPORA);
}
break;
case 'TWO_WAY':
if(is_array($a->user) && $a->user['prvnets'])
if (is_array($a->user) && $a->user['prvnets']) {
$networks = array(NETWORK_DFRN, NETWORK_MAIL, NETWORK_DIASPORA);
else
} else {
$networks = array(NETWORK_DFRN, NETWORK_FACEBOOK, NETWORK_MAIL, NETWORK_DIASPORA, NETWORK_OSTATUS);
}
break;
default:
default: /// @TODO Maybe log this call?
break;
}
}
@ -113,26 +117,30 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
$sql_extra = '';
if($x['mutual']) {
if (x($x, 'mutual')) {
$sql_extra .= sprintf(" AND `rel` = %d ", intval(CONTACT_IS_FRIEND));
}
if(intval($x['exclude']))
if (x($x, 'exclude')) {
$sql_extra .= sprintf(" AND `id` != %d ", intval($x['exclude']));
}
if (is_array($x['networks']) && count($x['networks'])) {
for($y = 0; $y < count($x['networks']) ; $y ++)
/// @TODO rewrite to foreach()
for ($y = 0; $y < count($x['networks']) ; $y ++) {
$x['networks'][$y] = "'" . dbesc($x['networks'][$y]) . "'";
}
$str_nets = implode(',', $x['networks']);
$sql_extra .= " AND `network` IN ( $str_nets ) ";
}
$tabindex = (x($options, 'tabindex') ? "tabindex=\"" . $options["tabindex"] . "\"" : "");
if($x['single'])
if ($x['single']) {
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"" . $x['size'] . "\" $tabindex >\r\n";
else
} else {
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"" . $x['size'] . "$\" $tabindex >\r\n";
}
$r = q("SELECT `id`, `name`, `url`, `network` FROM `contact`
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
@ -174,7 +182,7 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false, $celeb = false, $privatenet = false, $tabindex = null) {
require_once("include/bbcode.php");
require_once "include/bbcode.php";
$a = get_app();
@ -189,25 +197,28 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
$sql_extra .= sprintf(" AND `rel` = %d ", intval(CONTACT_IS_FRIEND));
}
if($privmail)
if ($privmail) {
$sql_extra .= sprintf(" AND `network` IN ('%s' , '%s') ",
NETWORK_DFRN, NETWORK_DIASPORA);
elseif($privatenet)
} elseif ($privatenet) {
$sql_extra .= sprintf(" AND `network` IN ('%s' , '%s', '%s', '%s') ",
NETWORK_DFRN, NETWORK_MAIL, NETWORK_FACEBOOK, NETWORK_DIASPORA);
}
$tabindex = ($tabindex > 0 ? "tabindex=\"$tabindex\"" : "");
if ($privmail AND $preselected) {
$sql_extra .= " AND `id` IN (".implode(",", $preselected).")";
$hidepreselected = ' style="display: none;"';
} else
} else {
$hidepreselected = "";
}
if($privmail)
if ($privmail) {
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\" $tabindex $hidepreselected>\r\n";
else
} else {
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" $tabindex >\r\n";
}
$r = q("SELECT `id`, `name`, `url`, `network` FROM `contact`
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
@ -229,8 +240,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
foreach ($r as $rr) {
if ((is_array($preselected)) && in_array($rr['id'], $preselected)) {
$selected = " selected=\"selected\" ";
}
else {
} else {
$selected = '';
}
@ -249,8 +259,9 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
$o .= "</select>\r\n";
if ($privmail AND $preselected)
if ($privmail AND $preselected) {
$o .= implode(", ", $receiverlist);
}
call_hooks($a->module . '_post_' . $selname, $o);
@ -330,10 +341,11 @@ function populate_acl($user = null, $show_jotnets = false) {
);
if (dbm::is_result($r)) {
$mail_enabled = true;
if(intval($r[0]['pubmail']))
if (intval($r[0]['pubmail'])) {
$pubmail_enabled = true;
}
}
}
if (!$user['hidewall']) {
if ($mail_enabled) {
@ -342,10 +354,11 @@ function populate_acl($user = null, $show_jotnets = false) {
}
call_hooks('jot_networks', $jotnets);
} else
} else {
$jotnets .= sprintf(t('Connectors disabled, since "%s" is enabled.'),
t('Hide your profile details from unknown viewers?'));
}
}
$tpl = get_markup_template("acl_selector.tpl");
$o = replace_macros($tpl, array(
@ -363,7 +376,7 @@ function populate_acl($user = null, $show_jotnets = false) {
'$aclModalTitle' => t('Permissions'),
'$aclModalDismiss' => t('Close'),
'$features' => array(
"aclautomention"=>(feature_enabled($user['uid'],"aclautomention")?"true":"false")
'aclautomention' => (feature_enabled($user['uid'], "aclautomention") ? "true" : "false")
),
));
@ -383,22 +396,24 @@ function construct_acl_data(App $a, $user) {
foreach ($acl_data['groups'] as $key => $group) {
// Add a "selected" flag to groups that are posted to by default
if ($user_defaults['allow_gid'] &&
in_array($group['id'], $user_defaults['allow_gid']) && !in_array($group['id'], $user_defaults['deny_gid']) )
in_array($group['id'], $user_defaults['allow_gid']) && !in_array($group['id'], $user_defaults['deny_gid']) ) {
$acl_data['groups'][$key]['selected'] = 1;
else
} else {
$acl_data['groups'][$key]['selected'] = 0;
}
}
}
if ($acl_data['contacts']) {
foreach ($acl_data['contacts'] as $key => $contact) {
// Add a "selected" flag to groups that are posted to by default
if ($user_defaults['allow_cid'] &&
in_array($contact['id'], $user_defaults['allow_cid']) && !in_array($contact['id'], $user_defaults['deny_cid']) )
in_array($contact['id'], $user_defaults['allow_cid']) && !in_array($contact['id'], $user_defaults['deny_cid']) ) {
$acl_data['contacts'][$key]['selected'] = 1;
else
} else {
$acl_data['contacts'][$key]['selected'] = 0;
}
}
}
return $acl_data;
@ -420,8 +435,9 @@ function acl_lookup(App $a, $out_type = 'json') {
// For use with jquery.textcomplete for private mail completion
if (x($_REQUEST, 'query') && strlen($_REQUEST['query'])) {
if(! $type)
if (! $type) {
$type = 'm';
}
$search = $_REQUEST['query'];
}
@ -431,6 +447,7 @@ function acl_lookup(App $a, $out_type = 'json') {
$sql_extra = "AND `name` LIKE '%%".dbesc($search)."%%'";
$sql_extra2 = "AND (`attag` LIKE '%%".dbesc($search)."%%' OR `name` LIKE '%%".dbesc($search)."%%' OR `nick` LIKE '%%".dbesc($search)."%%')";
} else {
/// @TODO Avoid these needless else blocks by putting variable-initialization atop of if()
$sql_extra = $sql_extra2 = "";
}
@ -446,8 +463,8 @@ function acl_lookup(App $a, $out_type = 'json') {
$sql_extra2 .= " ".unavailable_networks();
// autocomplete for editor mentions
if ($type == '' || $type == 'c') {
// autocomplete for editor mentions
$r = q("SELECT COUNT(*) AS c FROM `contact`
WHERE `uid` = %d AND NOT `self`
AND NOT `blocked` AND NOT `pending` AND NOT `archive`
@ -534,9 +551,7 @@ function acl_lookup(App $a, $out_type = 'json') {
intval(local_user()),
dbesc(NETWORK_OSTATUS), dbesc(NETWORK_STATUSNET)
);
}
elseif ($type=='c'){
} elseif ($type == 'c') {
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `forum`, `prv` FROM `contact`
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
AND NOT (`network` IN ('%s'))
@ -602,7 +617,7 @@ function acl_lookup(App $a, $out_type = 'json') {
'network' => $g['network'],
'link' => $g['url'],
'nick' => htmlentities(($g['attag']) ? $g['attag'] : $g['nick']),
'forum' => ((x($g['forum']) || x($g['prv'])) ? 1 : 0),
'forum' => ((x($g, 'forum') || x($g, 'prv')) ? 1 : 0),
);
}
}

File diff suppressed because it is too large Load diff

View file

@ -1067,6 +1067,7 @@ function z_mime_content_type($filename) {
return $mime_types[$ext];
}
}
/// @TODO Then let's get rid of it?
// can't use this because we're just passing a name, e.g. not a file that can be opened
// elseif (function_exists('finfo_open')) {
// $finfo = @finfo_open(FILEINFO_MIME);

View file

@ -30,11 +30,12 @@ function diaspora_mention2bb($match) {
return '@[url=' . $data['url'] . ']' . $name . '[/url]';
}
// we don't want to support a bbcode specific markdown interpreter
// and the markdown library we have is pretty good, but provides HTML output.
// So we'll use that to convert to HTML, then convert the HTML back to bbcode,
// and then clean up a few Diaspora specific constructs.
/*
* we don't want to support a bbcode specific markdown interpreter
* and the markdown library we have is pretty good, but provides HTML output.
* So we'll use that to convert to HTML, then convert the HTML back to bbcode,
* and then clean up a few Diaspora specific constructs.
*/
function diaspora2bb($s) {
$s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
@ -93,11 +94,11 @@ function diaspora_mentions($match) {
$contact = get_contact_details_by_url($match[3]);
if (!isset($contact['addr'])) {
if (!x($contact, 'addr')) {
$contact = Probe::uri($match[3]);
}
if (!isset($contact['addr'])) {
if (!x($contact, 'addr')) {
return $match[0];
}
@ -222,9 +223,9 @@ function unescape_underscores_in_links($m) {
}
function format_event_diaspora($ev) {
if(! ((is_array($ev)) && count($ev)))
if (! ((is_array($ev)) && count($ev))) {
return '';
}
$bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM
@ -239,17 +240,19 @@ function format_event_diaspora($ev) {
$ev['start'] , $bd_format)))
. '](' . App::get_baseurl() . '/localtime/?f=&time=' . urlencode(datetime_convert('UTC','UTC',$ev['start'])) . ")\n";
if(! $ev['nofinish'])
if (! $ev['nofinish']) {
$o .= t('Finishes:') . ' ' . '['
. (($ev['adjust']) ? day_translate(datetime_convert('UTC', 'UTC',
$ev['finish'] , $bd_format ))
: day_translate(datetime_convert('UTC', 'UTC',
$ev['finish'] , $bd_format )))
. '](' . App::get_baseurl() . '/localtime/?f=&time=' . urlencode(datetime_convert('UTC','UTC',$ev['finish'])) . ")\n";
}
if(strlen($ev['location']))
if (strlen($ev['location'])) {
$o .= t('Location:') . bb2diaspora($ev['location'])
. "\n";
}
$o .= "\n";
return $o;

View file

@ -9,16 +9,18 @@ require_once 'include/Contact.php';
require_once 'include/plaintext.php';
function bb_PictureCacheExt($matches) {
if (strpos($matches[3], "data:image/") === 0)
return ($matches[0]);
if (strpos($matches[3], "data:image/") === 0) {
return $matches[0];
}
$matches[3] = proxy_url($matches[3]);
return "[img=" . $matches[1] . "x" . $matches[2] . "]" . $matches[3] . "[/img]";
}
function bb_PictureCache($matches) {
if (strpos($matches[1], "data:image/") === 0)
return ($matches[0]);
if (strpos($matches[1], "data:image/") === 0) {
return $matches[0];
}
$matches[1] = proxy_url($matches[1]);
return "[img]" . $matches[1] . "[/img]";
@ -36,8 +38,9 @@ function bb_map_location($match) {
function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
$data = get_attachment_data($Text);
if (!$data)
if (!$data) {
return $Text;
}
if (isset($data["title"])) {
$data["title"] = strip_tags($data["title"]);
@ -57,38 +60,43 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
// If the link description is similar to the text above then don't add the link description
if (($data["title"] != "") AND ((strpos($test1,$test2) !== false) OR
(similar_text($test1,$test2) / strlen($data["title"])) > 0.9))
(similar_text($test1,$test2) / strlen($data["title"])) > 0.9)) {
$title2 = $data["url"];
}
$text = sprintf('<a href="%s" title="%s" class="attachment thumbnail" rel="nofollow external">%s</a><br />',
$data["url"], $data["title"], $title2);
} elseif (($simplehtml != 4) AND ($simplehtml != 0))
} elseif (($simplehtml != 4) AND ($simplehtml != 0)) {
$text = sprintf('<a href="%s" target="_blank">%s</a><br>', $data["url"], $data["title"]);
else {
} else {
$text = sprintf('<span class="type-%s">', $data["type"]);
$bookmark = array(sprintf('[bookmark=%s]%s[/bookmark]', $data["url"], $data["title"]), $data["url"], $data["title"]);
if ($tryoembed)
if ($tryoembed) {
$oembed = tryoembed($bookmark);
else
} else {
$oembed = $bookmark[0];
}
if (strstr(strtolower($oembed), "<iframe "))
if (strstr(strtolower($oembed), "<iframe ")) {
$text = $oembed;
else {
if (($data["image"] != "") AND !strstr(strtolower($oembed), "<img "))
} else {
if (($data["image"] != "") AND !strstr(strtolower($oembed), "<img ")) {
$text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a><br />', $data["url"], proxy_url($data["image"]), $data["title"]);
elseif (($data["preview"] != "") AND !strstr(strtolower($oembed), "<img "))
} elseif (($data["preview"] != "") AND !strstr(strtolower($oembed), "<img ")) {
$text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-preview" /></a><br />', $data["url"], proxy_url($data["preview"]), $data["title"]);
}
if (($data["type"] == "photo") AND ($data["url"] != "") AND ($data["image"] != ""))
if (($data["type"] == "photo") AND ($data["url"] != "") AND ($data["image"] != "")) {
$text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a>', $data["url"], proxy_url($data["image"]), $data["title"]);
else
} else {
$text .= $oembed;
}
if (trim($data["description"]) != "")
if (trim($data["description"]) != "") {
$text .= sprintf('<blockquote>%s</blockquote></span>', trim(bbcode($data["description"])));
}
}
}
return $data["text"] . $text . $data["after"];
}
@ -96,34 +104,37 @@ function bb_remove_share_information($Text, $plaintext = false, $nolink = false)
$data = get_attachment_data($Text);
if (!$data)
if (!$data) {
return $Text;
if ($nolink)
} elseif ($nolink) {
return $data["text"] . $data["after"];
}
$title = htmlentities($data["title"], ENT_QUOTES, 'UTF-8', false);
$text = htmlentities($data["text"], ENT_QUOTES, 'UTF-8', false);
if ($plaintext OR (($title != "") AND strstr($text, $title)))
if ($plaintext OR (($title != "") AND strstr($text, $title))) {
$data["title"] = $data["url"];
elseif (($text != "") AND strstr($title, $text)) {
} elseif (($text != "") AND strstr($title, $text)) {
$data["text"] = $data["title"];
$data["title"] = $data["url"];
}
if (($data["text"] == "") AND ($data["title"] != "") AND ($data["url"] == ""))
if (($data["text"] == "") AND ($data["title"] != "") AND ($data["url"] == "")) {
return $data["title"] . $data["after"];
}
// If the link already is included in the post, don't add it again
if (($data["url"] != "") AND strpos($data["text"], $data["url"]))
if (($data["url"] != "") AND strpos($data["text"], $data["url"])) {
return $data["text"] . $data["after"];
}
$text = $data["text"];
if (($data["url"] != "") AND ($data["title"] != ""))
if (($data["url"] != "") AND ($data["title"] != "")) {
$text .= "\n[url=" . $data["url"] . "]" . $data["title"] . "[/url]";
elseif (($data["url"] != ""))
} elseif (($data["url"] != "")) {
$text .= "\n" . $data["url"];
}
return $text . "\n" . $data["after"];
}
@ -145,14 +156,16 @@ function cleancss($input) {
for ($i = 0; $i < strlen($input); $i++) {
$char = substr($input, $i, 1);
if (($char >= "a") and ($char <= "z"))
$cleaned .= $char;
if (!(strpos(" #;:0123456789-_.%", $char) === false))
if (($char >= "a") and ($char <= "z")) {
$cleaned .= $char;
}
return($cleaned);
if (!(strpos(" #;:0123456789-_.%", $char) === false)) {
$cleaned .= $char;
}
}
return $cleaned;
}
function stripcode_br_cb($s) {
@ -166,25 +179,30 @@ function tryoembed($match) {
$url = str_replace(array("http://www.youtube.com/", "http://player.vimeo.com/"),
array("https://www.youtube.com/", "https://player.vimeo.com/"), $url);
$o = oembed_fetch_url($url);
if (!is_object($o))
if (!is_object($o)) {
return $match[0];
}
if (isset($match[2]))
if (isset($match[2])) {
$o->title = $match[2];
}
if ($o->type=="error") return $match[0];
if ($o->type == "error") {
return $match[0];
}
$html = oembed_format_object($o);
return $html;
}
// [noparse][i]italic[/i][/noparse] turns into
// [noparse][ i ]italic[ /i ][/noparse],
// to hide them from parser.
/*
* [noparse][i]italic[/i][/noparse] turns into
* [noparse][ i ]italic[ /i ][/noparse],
* to hide them from parser.
*/
function bb_spacefy($st) {
$whole_match = $st[0];
$captured = $st[1];
@ -193,10 +211,11 @@ function bb_spacefy($st) {
return $new_str;
}
// The previously spacefied [noparse][ i ]italic[ /i ][/noparse],
// now turns back and the [noparse] tags are trimed
// returning [i]italic[/i]
/*
* The previously spacefied [noparse][ i ]italic[ /i ][/noparse],
* now turns back and the [noparse] tags are trimed
* returning [i]italic[/i]
*/
function bb_unspacefy_and_trim($st) {
$whole_match = $st[0];
$captured = $st[1];
@ -205,23 +224,26 @@ function bb_unspacefy_and_trim($st) {
}
function bb_find_open_close($s, $open, $close, $occurence = 1) {
if($occurence < 1)
if ($occurence < 1) {
$occurence = 1;
}
$start_pos = -1;
for ($i = 1; $i <= $occurence; $i++) {
if( $start_pos !== false)
if ($start_pos !== false) {
$start_pos = strpos($s, $open, $start_pos + 1);
}
}
if( $start_pos === false)
if ($start_pos === false) {
return false;
}
$end_pos = strpos($s, $close, $start_pos);
if( $end_pos === false)
if ($end_pos === false) {
return false;
}
$res = array( 'start' => $start_pos, 'end' => $end_pos );
@ -229,36 +251,50 @@ function bb_find_open_close($s, $open, $close, $occurence = 1) {
}
function get_bb_tag_pos($s, $name, $occurence = 1) {
if($occurence < 1)
if ($occurence < 1) {
$occurence = 1;
}
$start_open = -1;
for ($i = 1; $i <= $occurence; $i++) {
if( $start_open !== false)
if ($start_open !== false) {
$start_open = strpos($s, '[' . $name, $start_open + 1); // allow [name= type tags
}
}
if( $start_open === false)
if ($start_open === false) {
return false;
}
$start_equal = strpos($s, '=', $start_open);
$start_close = strpos($s, ']', $start_open);
if( $start_close === false)
if ($start_close === false) {
return false;
}
$start_close++;
$end_open = strpos($s, '[/' . $name . ']', $start_close);
if( $end_open === false)
if ($end_open === false) {
return false;
}
$res = array( 'start' => array('open' => $start_open, 'close' => $start_close),
'end' => array('open' => $end_open, 'close' => $end_open + strlen('[/' . $name . ']')) );
if( $start_equal !== false)
$res = array(
'start' => array(
'open' => $start_open,
'close' => $start_close
),
'end' => array(
'open' => $end_open,
'close' => $end_open + strlen('[/' . $name . ']')
),
);
if ($start_equal !== false) {
$res['start']['equal'] = $start_equal + 1;
}
return $res;
}
@ -270,12 +306,12 @@ function bb_tag_preg_replace($pattern, $replace, $name, $s) {
$occurence = 1;
$pos = get_bb_tag_pos($string, $name, $occurence);
while ($pos !== false && $occurence < 1000) {
$start = substr($string, 0, $pos['start']['open']);
$subject = substr($string, $pos['start']['open'], $pos['end']['close'] - $pos['start']['open']);
$end = substr($string, $pos['end']['close']);
if($end === false)
if ($end === false) {
$end = '';
}
$subject = preg_replace($pattern, $replace, $subject);
$string = $start . $subject . $end;
@ -310,14 +346,16 @@ function bb_extract_images($body) {
$new_body = $new_body . substr($orig_body, 0, $img_start) . '[$#saved_image' . $cnt . '#$]';
$cnt++;
}
else
} else {
$new_body = $new_body . substr($orig_body, 0, $img_end + strlen('[/img]'));
}
$orig_body = substr($orig_body, $img_end + strlen('[/img]'));
if($orig_body === false) // in case the body ends on a closing image tag
if ($orig_body === false) {
// in case the body ends on a closing image tag
$orig_body = '';
}
$img_start = strpos($orig_body, '[img');
$img_st_close = ($img_start !== false ? strpos(substr($orig_body, $img_start), ']') : false);
@ -504,104 +542,114 @@ function bb_ShareAttributes($share, $simplehtml) {
);
break;
}
return($text);
return $text;
}
function GetProfileUsername($profile, $username, $compact = false, $getnetwork = false) {
$twitter = preg_replace("=https?://twitter.com/(.*)=ism", "$1@twitter.com", $profile);
if ($twitter != $profile) {
if ($getnetwork)
return(NETWORK_TWITTER);
elseif ($compact)
return($twitter);
else
if ($getnetwork) {
return NETWORK_TWITTER;
} elseif ($compact) {
return $twitter;
} else {
return ($username . " (" . $twitter . ")");
}
}
$appnet = preg_replace("=https?://alpha.app.net/(.*)=ism", "$1@alpha.app.net", $profile);
if ($appnet != $profile) {
if ($getnetwork)
return(NETWORK_APPNET);
elseif ($compact)
return($appnet);
else
if ($getnetwork) {
return NETWORK_APPNET;
} elseif ($compact) {
return $appnet;
} else {
return ($username . " (" . $appnet . ")");
}
}
$gplus = preg_replace("=https?://plus.google.com/(.*)=ism", "$1@plus.google.com", $profile);
if ($gplus != $profile) {
if ($getnetwork)
return(NETWORK_GPLUS);
elseif ($compact)
if ($getnetwork) {
return NETWORK_GPLUS;
} elseif ($compact) {
return ($gplususername . " (" . $username . ")");
else
} else {
return ($username . " (" . $gplus . ")");
}
}
$friendica = preg_replace("=https?://(.*)/profile/(.*)=ism", "$2@$1", $profile);
if ($friendica != $profile) {
if ($getnetwork)
return(NETWORK_DFRN);
elseif ($compact)
return($friendica);
else
if ($getnetwork) {
return NETWORK_DFRN;
} elseif ($compact) {
return $friendica;
} else {
return ($username . " (" . $friendica . ")");
}
}
$diaspora = preg_replace("=https?://(.*)/u/(.*)=ism", "$2@$1", $profile);
if ($diaspora != $profile) {
if ($getnetwork)
return(NETWORK_DIASPORA);
elseif ($compact)
return($diaspora);
else
if ($getnetwork) {
return NETWORK_DIASPORA;
} elseif ($compact) {
return $diaspora;
} else {
return ($username . " (" . $diaspora . ")");
}
}
$red = preg_replace("=https?://(.*)/channel/(.*)=ism", "$2@$1", $profile);
if ($red != $profile) {
if ($getnetwork)
if ($getnetwork) {
// red is identified as Diaspora - friendica can't connect directly to it
return(NETWORK_DIASPORA);
elseif ($compact)
return($red);
else
return NETWORK_DIASPORA;
} elseif ($compact) {
return $red;
} else {
return ($username . " (" . $red . ")");
}
}
$StatusnetHost = preg_replace("=https?://(.*)/user/(.*)=ism", "$1", $profile);
if ($StatusnetHost != $profile) {
$StatusnetUser = preg_replace("=https?://(.*)/user/(.*)=ism", "$2", $profile);
if ($StatusnetUser != $profile) {
/// @TODO Some hosts run on https, not just http and sometimes http is disabled, let's support both here
$UserData = fetch_url("http://".$StatusnetHost."/api/users/show.json?user_id=".$StatusnetUser);
$user = json_decode($UserData);
if ($user) {
if ($getnetwork)
return(NETWORK_STATUSNET);
elseif ($compact)
if ($getnetwork) {
return NETWORK_STATUSNET;
} elseif ($compact) {
return ($user->screen_name . "@" . $StatusnetHost);
else
} else {
return ($username . " (" . $user->screen_name . "@" . $StatusnetHost . ")");
}
}
}
}
// pumpio (http://host.name/user)
$rest = preg_replace("=https?://([\.\w]+)/([\.\w]+)(.*)=ism", "$3", $profile);
if ($rest == "") {
$pumpio = preg_replace("=https?://([\.\w]+)/([\.\w]+)(.*)=ism", "$2@$1", $profile);
if ($pumpio != $profile) {
if ($getnetwork)
return(NETWORK_PUMPIO);
elseif ($compact)
return($pumpio);
else
if ($getnetwork) {
return NETWORK_PUMPIO;
} elseif ($compact) {
return $pumpio;
} else {
return ($username . " (" . $pumpio . ")");
}
}
}
return($username);
return $username;
}
function bb_DiasporaLinks($match) {
@ -652,15 +700,17 @@ function bb_RemovePictureLinks($match) {
}
Cache::set($match[1],$text);
}
return($text);
return $text;
}
function bb_expand_links($match) {
if (($match[3] == "") OR ($match[2] == $match[3]) OR stristr($match[2], $match[3]))
if (($match[3] == "") OR ($match[2] == $match[3]) OR stristr($match[2], $match[3])) {
return ($match[1] . "[url]" . $match[2] . "[/url]");
else
} else {
return ($match[1] . $match[3] . " [url]" . $match[2] . "[/url]");
}
}
function bb_CleanPictureLinksSub($match) {
$text = Cache::get($match[1]);
@ -707,18 +757,20 @@ function bb_CleanPictureLinksSub($match) {
}
Cache::set($match[1],$text);
}
return($text);
return $text;
}
function bb_CleanPictureLinks($text) {
$text = preg_replace_callback("&\[url=([^\[\]]*)\]\[img\](.*)\[\/img\]\[\/url\]&Usi", 'bb_CleanPictureLinksSub', $text);
return ($text);
return $text;
}
function bb_highlight($match) {
if (in_array(strtolower($match[1]), ['php', 'css', 'mysql', 'sql', 'abap', 'diff', 'html', 'perl', 'ruby',
'vbscript','avrc','dtd','java','xml','cpp','python','javascript','js','sh']))
'vbscript', 'avrc', 'dtd', 'java', 'xml', 'cpp', 'python', 'javascript', 'js', 'sh'])) {
return text_highlight($match[2], strtolower($match[1]));
}
return $match[0];
}
@ -1083,14 +1135,13 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
// Shared content
$Text = preg_replace_callback("/(.*?)\[share(.*?)\](.*?)\[\/share\]/ism",
function ($match) use ($simplehtml) {
return(bb_ShareAttributes($match, $simplehtml));
return bb_ShareAttributes($match, $simplehtml);
}, $Text);
$Text = preg_replace("/\[crypt\](.*?)\[\/crypt\]/ism", '<br/><img src="' .App::get_baseurl() . '/images/lock_icon.gif" alt="' . t('Encrypted content') . '" title="' . t('Encrypted content') . '" /><br />', $Text);
$Text = preg_replace("/\[crypt(.*?)\](.*?)\[\/crypt\]/ism", '<br/><img src="' .App::get_baseurl() . '/images/lock_icon.gif" alt="' . t('Encrypted content') . '" title="' . '$1' . ' ' . t('Encrypted content') . '" /><br />', $Text);
//$Text = preg_replace("/\[crypt=(.*?)\](.*?)\[\/crypt\]/ism", '<br/><img src="' .App::get_baseurl() . '/images/lock_icon.gif" alt="' . t('Encrypted content') . '" title="' . '$1' . ' ' . t('Encrypted content') . '" /><br />', $Text);
// Try to Oembed
if ($tryoembed) {
$Text = preg_replace("/\[video\](.*?\.(ogg|ogv|oga|ogm|webm|mp4))\[\/video\]/ism", '<video src="$1" controls="controls" width="' . $a->videowidth . '" height="' . $a->videoheight . '"><a href="$1">$1</a></video>', $Text);

View file

@ -13,7 +13,7 @@ function follow_widget($value = "") {
}
function findpeople_widget() {
require_once('include/Contact.php');
require_once 'include/Contact.php';
$a = get_app();
@ -45,32 +45,41 @@ function unavailable_networks() {
$networks = array();
if (!plugin_enabled("appnet"))
if (!plugin_enabled("appnet")) {
$networks[] = NETWORK_APPNET;
}
if (!plugin_enabled("fbpost") AND !plugin_enabled("facebook"))
if (!plugin_enabled("fbpost") AND !plugin_enabled("facebook")) {
$networks[] = NETWORK_FACEBOOK;
}
if (!plugin_enabled("statusnet"))
if (!plugin_enabled("statusnet")) {
$networks[] = NETWORK_STATUSNET;
}
if (!plugin_enabled("pumpio"))
if (!plugin_enabled("pumpio")) {
$networks[] = NETWORK_PUMPIO;
}
if (!plugin_enabled("twitter"))
if (!plugin_enabled("twitter")) {
$networks[] = NETWORK_TWITTER;
}
if (get_config("system","ostatus_disabled"))
if (get_config("system", "ostatus_disabled")) {
$networks[] = NETWORK_OSTATUS;
}
if (!get_config("system","diaspora_enabled"))
if (!get_config("system", "diaspora_enabled")) {
$networks[] = NETWORK_DIASPORA;
}
if (!plugin_enabled("pnut"))
if (!plugin_enabled("pnut")) {
$networks[] = NETWORK_PNUT;
}
if (!sizeof($networks))
if (!sizeof($networks)) {
return "";
}
$network_filter = implode("','", $networks);
@ -99,7 +108,7 @@ function networks_widget($baseurl,$selected = '') {
$nets = array();
if (dbm::is_result($r)) {
require_once('include/contact_selectors.php');
require_once 'include/contact_selectors.php';
foreach ($r as $rr) {
/// @TODO If 'network' is not there, this triggers an E_NOTICE
if ($rr['network']) {
@ -108,8 +117,9 @@ function networks_widget($baseurl,$selected = '') {
}
}
if(count($nets) < 2)
if (count($nets) < 2) {
return '';
}
return replace_macros(get_markup_template('nets.tpl'), array(
'$title' => t('Networks'),
@ -173,6 +183,7 @@ function categories_widget($baseurl,$selected = '') {
$matches = false;
$terms = array();
$cnt = preg_match_all('/<(.*?)>/', $saved, $matches, PREG_SET_ORDER);
if ($cnt) {
foreach ($matches as $mtch) {
$unescaped = xmlify(file_tag_decode($mtch[1]));
@ -195,8 +206,9 @@ function common_friends_visitor_widget($profile_uid) {
$a = get_app();
if(local_user() == $profile_uid)
if (local_user() == $profile_uid) {
return;
}
$cid = $zcid = 0;
@ -215,9 +227,9 @@ function common_friends_visitor_widget($profile_uid) {
dbesc(normalise_link(get_my_url())),
intval($profile_uid)
);
if (dbm::is_result($r))
if (dbm::is_result($r)) {
$cid = $r[0]['id'];
else {
} else {
$r = q("select id from gcontact where nurl = '%s' limit 1",
dbesc(normalise_link(get_my_url()))
);
@ -227,22 +239,26 @@ function common_friends_visitor_widget($profile_uid) {
}
}
if($cid == 0 && $zcid == 0)
if ($cid == 0 && $zcid == 0) {
return;
}
require_once('include/socgraph.php');
require_once 'include/socgraph.php';
if($cid)
if ($cid) {
$t = count_common_friends($profile_uid, $cid);
else
} else {
$t = count_common_friends_zcid($profile_uid, $zcid);
if(! $t)
}
if (! $t) {
return;
}
if($cid)
if ($cid) {
$r = common_friends($profile_uid, $cid, 0, 5, true);
else
} else {
$r = common_friends_zcid($profile_uid, $zcid, 0, 5, true);
}
return replace_macros(get_markup_template('remote_friends_common.tpl'), array(
'$desc' => sprintf( tt("%d contact in common", "%d contacts in common", $t), $t),

View file

@ -1,12 +1,14 @@
<?php
require_once("include/bbcode.php");
require_once("include/acl_selectors.php");
require_once "include/bbcode.php";
require_once "include/acl_selectors.php";
// Note: the code in 'item_extract_images' and 'item_redir_and_replace_images'
// is identical to the code in mod/message.php for 'item_extract_images' and
// 'item_redir_and_replace_images'
/*
* Note: the code in 'item_extract_images' and 'item_redir_and_replace_images'
* is identical to the code in mod/message.php for 'item_extract_images' and
* 'item_redir_and_replace_images'
*/
if (! function_exists('item_extract_images')) {
function item_extract_images($body) {
@ -30,14 +32,16 @@ function item_extract_images($body) {
$new_body = $new_body . substr($orig_body, 0, $img_start) . '[!#saved_image' . $cnt . '#!]';
$cnt++;
}
else
} else {
$new_body = $new_body . substr($orig_body, 0, $img_end + strlen('[/img]'));
}
$orig_body = substr($orig_body, $img_end + strlen('[/img]'));
if($orig_body === false) // in case the body ends on a closing image tag
if ($orig_body === false) {
// in case the body ends on a closing image tag
$orig_body = '';
}
$img_start = strpos($orig_body, '[img');
$img_st_close = ($img_start !== false ? strpos(substr($orig_body, $img_start), ']') : false);
@ -66,8 +70,9 @@ function item_redir_and_replace_images($body, $images, $cid) {
$newbody .= substr($origbody, 0, $pos['start']['open']);
$subject = substr($origbody, $pos['start']['open'], $pos['end']['close'] - $pos['start']['open']);
$origbody = substr($origbody, $pos['end']['close']);
if($origbody === false)
if ($origbody === false) {
$origbody = '';
}
$subject = preg_replace($search, $replace, $subject);
$newbody .= $subject;
@ -79,26 +84,28 @@ function item_redir_and_replace_images($body, $images, $cid) {
$cnt = 0;
foreach ($images as $image) {
// We're depending on the property of 'foreach' (specified on the PHP website) that
// it loops over the array starting from the first element and going sequentially
// to the last element
/*
* We're depending on the property of 'foreach' (specified on the PHP website) that
* it loops over the array starting from the first element and going sequentially
* to the last element.
*/
$newbody = str_replace('[!#saved_image' . $cnt . '#!]', '[img]' . $image . '[/img]', $newbody);
$cnt++;
}
return $newbody;
}}
/**
* Render actions localized
*/
function localize_item(&$item) {
$extracted = item_extract_images($item['body']);
if($extracted['images'])
if ($extracted['images']) {
$item['body'] = item_redir_and_replace_images($extracted['body'], $extracted['images'], $item['contact-id']);
}
/// @Separted ???
$xmlhead = "<" . "?xml version='1.0' encoding='UTF-8' ?" . ">";
if (activity_match($item['verb'], ACTIVITY_LIKE)
|| activity_match($item['verb'], ACTIVITY_DISLIKE)
@ -106,10 +113,14 @@ function localize_item(&$item){
|| activity_match($item['verb'], ACTIVITY_ATTENDNO)
|| activity_match($item['verb'], ACTIVITY_ATTENDMAYBE)) {
$r = q("SELECT * from `item`,`contact` WHERE
`item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';",
/// @TODO may hurt performance
$r = q("SELECT * FROM `item`, `contact`
WHERE `item`.`contact-id`=`contact`.`id`
AND `item`.`uri`='%s'",
dbesc($item['parent-uri']));
if (!dbm::is_result($r)) return;
if (!dbm::is_result($r)) {
return;
}
$obj = $r[0];
$author = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
@ -128,7 +139,8 @@ function localize_item(&$item){
default:
if ($obj['resource-id']) {
$post_type = t('photo');
$m=array(); preg_match("/\[url=([^]]*)\]/", $obj['body'], $m);
$m = array();
preg_match("/\[url=([^]]*)\]/", $obj['body'], $m);
$rr['plink'] = $m[1];
} else {
$post_type = t('status');
@ -175,21 +187,25 @@ function localize_item(&$item){
case "alternate": $Blink = $atts['href'];
case "photo": $Bphoto = $atts['href'];
}
}
$A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]';
$B = '[url=' . zrl($Blink) . ']' . $Bname . '[/url]';
if ($Bphoto!="") $Bphoto = '[url=' . zrl($Blink) . '][img]' . $Bphoto . '[/img][/url]';
if ($Bphoto != "") {
$Bphoto = '[url=' . zrl($Blink) . '][img]' . $Bphoto . '[/img][/url]';
}
$item['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$Bphoto;
}
if (stristr($item['verb'], ACTIVITY_POKE)) {
$verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1));
if(! $verb)
if (! $verb) {
return;
if ($item['object-type']=="" || $item['object-type']!== ACTIVITY_OBJ_PERSON) return;
}
if ($item['object-type']=="" || $item['object-type']!== ACTIVITY_OBJ_PERSON) {
return;
}
$Aname = $item['author-name'];
$Alink = $item['author-link'];
@ -200,22 +216,26 @@ function localize_item(&$item){
$links = parse_xml_string($xmlhead."<links>".unxmlify($obj->link)."</links>");
$Bname = $obj->title;
$Blink = ""; $Bphoto = "";
$Blink = "";
$Bphoto = "";
foreach ($links->link as $l) {
$atts = $l->attributes();
switch ($atts['rel']) {
case "alternate": $Blink = $atts['href'];
case "photo": $Bphoto = $atts['href'];
}
}
$A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]';
$B = '[url=' . zrl($Blink) . ']' . $Bname . '[/url]';
if ($Bphoto!="") $Bphoto = '[url=' . zrl($Blink) . '][img=80x80]' . $Bphoto . '[/img][/url]';
if ($Bphoto != "") {
$Bphoto = '[url=' . zrl($Blink) . '][img=80x80]' . $Bphoto . '[/img][/url]';
}
// we can't have a translation string with three positions but no distinguishable text
// So here is the translate string.
/*
* we can't have a translation string with three positions but no distinguishable text
* So here is the translate string.
*/
$txt = t('%1$s poked %2$s');
// now translate the verb
@ -229,8 +249,9 @@ function localize_item(&$item){
}
if (stristr($item['verb'], ACTIVITY_MOOD)) {
$verb = urldecode(substr($item['verb'], strpos($item['verb'], '#') + 1));
if(! $verb)
if (! $verb) {
return;
}
$Aname = $item['author-name'];
$Alink = $item['author-link'];
@ -242,10 +263,16 @@ function localize_item(&$item){
}
if (activity_match($item['verb'], ACTIVITY_TAG)) {
$r = q("SELECT * from `item`,`contact` WHERE
`item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';",
/// @TODO may hurt performance "joining" two tables + asterisk
$r = q("SELECT * FROM `item`, `contact`
WHERE `item`.`contact-id`=`contact`.`id`
AND `item`.`uri`='%s'",
dbesc($item['parent-uri']));
if (!dbm::is_result($r)) return;
if (!dbm::is_result($r)) {
return;
}
$obj = $r[0];
$author = '[url=' . zrl($item['author-link']) . ']' . $item['author-name'] . '[/url]';
@ -269,6 +296,8 @@ function localize_item(&$item){
} else {
$post_type = t('status');
}
// Let's break everthing ... ;-)
break;
}
$plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]';
@ -280,8 +309,9 @@ function localize_item(&$item){
}
if (activity_match($item['verb'], ACTIVITY_FAVORITE)) {
if ($item['object-type']== "")
if ($item['object-type'] == "") {
return;
}
$Aname = $item['author-name'];
$Alink = $item['author-link'];
@ -290,10 +320,11 @@ function localize_item(&$item){
$obj = parse_xml_string($xmlhead.$item['object']);
if (strlen($obj->id)) {
$r = q("select * from item where uri = '%s' and uid = %d limit 1",
$r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($obj->id),
intval($item['uid'])
);
if (dbm::is_result($r) && $r[0]['plink']) {
$target = $r[0];
$Bname = $target['author-name'];
@ -302,17 +333,17 @@ function localize_item(&$item){
$B = '[url=' . zrl($Blink) . ']' . $Bname . '[/url]';
$P = '[url=' . $target['plink'] . ']' . t('post/item') . '[/url]';
$item['body'] = sprintf( t('%1$s marked %2$s\'s %3$s as favorite'), $A, $B, $P)."\n";
}
}
}
$matches = null;
if (preg_match_all('/@\[url=(.*?)\]/is', $item['body'], $matches, PREG_SET_ORDER)) {
foreach ($matches as $mtch) {
if(! strpos($mtch[1],'zrl='))
if (! strpos($mtch[1], 'zrl=')) {
$item['body'] = str_replace($mtch[0], '@[url=' . zrl($mtch[1]) . ']', $item['body']);
}
}
}
// add zrl's to public images
$photo_pattern = "/\[url=(.*?)\/photos\/(.*?)\/image\/(.*?)\]\[img(.*?)\]h(.*?)\[\/img\]\[\/url\]/is";
@ -332,21 +363,20 @@ function localize_item(&$item){
$item['plink'] = $y . '?f=&url=' . $item['plink'];
}
}
}
/**
* Count the total of comments on this item and its desendants
* @TODO proper type-hint + doc-tag
*/
function count_descendants($item) {
$total = count($item['children']);
if ($total > 0) {
foreach ($item['children'] as $child) {
if(! visible_activity($child))
if (! visible_activity($child)) {
$total --;
}
$total += count_descendants($child);
}
}
@ -356,9 +386,10 @@ function count_descendants($item) {
function visible_activity($item) {
// likes (etc.) can apply to other things besides posts. Check if they are post children,
// in which case we handle them specially
/*
* likes (etc.) can apply to other things besides posts. Check if they are post children,
* in which case we handle them specially
*/
$hidden_activities = array(ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE);
foreach ($hidden_activities as $act) {
if (activity_match($item['verb'], $act)) {
@ -379,7 +410,6 @@ function visible_activity($item) {
* @brief SQL query for items
*/
function item_query() {
return "SELECT " . item_fieldlists() . " FROM `item` " .
item_joins() . " WHERE " . item_condition();
}
@ -439,7 +469,6 @@ These Fields are not added below (yet). They are here to for bug search.
* @brief SQL join for contacts that are needed for displaying items
*/
function item_joins() {
return "STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND
(NOT `contact`.`blocked` OR `contact`.`pending`)
LEFT JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id`
@ -450,10 +479,10 @@ function item_joins() {
* @brief SQL condition for items that are needed for displaying items
*/
function item_condition() {
return "`item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`";
}
if (!function_exists('conversation')) {
/**
* "Render" a conversation or list of items for HTML display.
* There are two major forms of display:
@ -464,13 +493,11 @@ function item_condition() {
* that are based on unique features of the calling module.
*
*/
if(!function_exists('conversation')) {
function conversation(App $a, $items, $mode, $update, $preview = false) {
require_once('include/bbcode.php');
require_once('include/Contact.php');
require_once('mod/proxy.php');
require_once 'include/bbcode.php';
require_once 'include/Contact.php';
require_once 'mod/proxy.php';
$ssl_state = ((local_user()) ? true : false);
@ -484,9 +511,10 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
$str_blocked = get_pconfig(local_user(), 'system', 'blocked');
if ($str_blocked) {
$arr_blocked = explode(',', $str_blocked);
for($x = 0; $x < count($arr_blocked); $x ++)
for ($x = 0; $x < count($arr_blocked); $x ++) {
$arr_blocked[$x] = trim($arr_blocked[$x]);
}
}
}
@ -496,10 +524,11 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
$profile_owner = local_user();
$page_writeable = true;
if (!$update) {
// The special div is needed for liveUpdate to kick in for this page.
// We only launch liveUpdate if you aren't filtering in some incompatible
// way and also you aren't writing a comment (discovered in javascript).
/*
* The special div is needed for liveUpdate to kick in for this page.
* We only launch liveUpdate if you aren't filtering in some incompatible
* way and also you aren't writing a comment (discovered in javascript).
*/
$live_update_div = '<div id="live-network"></div>' . "\r\n"
. "<script> var profile_uid = " . $_SESSION['uid']
. "; var netargs = '" . substr($a->cmd, 8)
@ -519,8 +548,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
. "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
}
}
else if($mode === 'profile') {
} elseif ($mode === 'profile') {
$profile_owner = $a->profile['profile_uid'];
$page_writeable = can_write_wall($a,$profile_owner);
@ -528,16 +556,17 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
$tab = notags(trim($_GET['tab']));
$tab = ( $tab ? $tab : 'posts' );
if ($tab === 'posts') {
// This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
// because browser prefetching might change it on us. We have to deliver it with the page.
/*
* This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
* because browser prefetching might change it on us. We have to deliver it with the page.
*/
$live_update_div = '<div id="live-profile"></div>' . "\r\n"
. "<script> var profile_uid = " . $a->profile['profile_uid']
. "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
}
}
}
else if($mode === 'notes') {
} elseif ($mode === 'notes') {
$profile_owner = local_user();
$page_writeable = true;
if (!$update) {
@ -545,8 +574,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
. "<script> var profile_uid = " . local_user()
. "; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
}
}
else if($mode === 'display') {
} elseif ($mode === 'display') {
$profile_owner = $a->profile['uid'];
$page_writeable = can_write_wall($a,$profile_owner);
if (!$update) {
@ -554,26 +582,25 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
. "<script> var profile_uid = " . $_SESSION['uid'] . ";"
. " var profile_page = 1; </script>";
}
}
else if($mode === 'community') {
} elseif ($mode === 'community') {
$profile_owner = 0;
$page_writeable = false;
if (!$update) {
$live_update_div = '<div id="live-community"></div>' . "\r\n"
. "<script> var profile_uid = -1; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
}
}
else if($mode === 'search') {
} elseif ($mode === 'search') {
$live_update_div = '<div id="live-search"></div>' . "\r\n";
}
$page_dropping = ((local_user() && local_user() == $profile_owner) ? true : false);
if($update)
if ($update) {
$return_url = $_SESSION['return_url'];
else
} else {
$return_url = $_SESSION['return_url'] = $a->query_string;
}
$cb = array('items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview);
call_hooks('conversation_start',$cb);
@ -598,9 +625,12 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
if ($mode === 'network-new' || $mode === 'search' || $mode === 'community') {
// "New Item View" on network page or search page results
// - just loop through the items and format them minimally for display
/*
* "New Item View" on network page or search page results
* - just loop through the items and format them minimally for display
*/
/// @TODO old lost code?
// $tpl = get_markup_template('search_item.tpl');
$tpl = 'search_item.tpl';
@ -614,9 +644,10 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
break;
}
}
if($blocked)
if ($blocked) {
continue;
}
}
$threadsid++;
@ -631,19 +662,19 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
&& ($item['id'] != $item['parent']))
continue;
$nickname = $item['nickname'];
}
else
} else {
$nickname = $a->user['nickname'];
}
// prevent private email from leaking.
if($item['network'] === NETWORK_MAIL && local_user() != $item['uid'])
if ($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
continue;
}
$profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']);
if($item['author-link'] && (! $item['author-name']))
if ($item['author-link'] && (! $item['author-name'])) {
$profile_name = $item['author-link'];
}
$tags = array();
$hashtags = array();
@ -654,8 +685,9 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
foreach ($taglist as $tag) {
if ($tag["url"] == "")
if ($tag["url"] == "") {
$tag["url"] = $searchpath . strtolower($tag["term"]);
}
if ($tag["type"] == TERM_HASHTAG) {
$hashtags[] = "#<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
@ -669,28 +701,33 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
$sp = false;
$profile_link = best_link_url($item,$sp);
if($profile_link === 'mailbox')
if ($profile_link === 'mailbox') {
$profile_link = '';
if($sp)
$sparkle = ' sparkle';
else
$profile_link = zrl($profile_link);
}
if (!isset($item['author-thumb']) OR ($item['author-thumb'] == "")) {
if ($sp) {
$sparkle = ' sparkle';
} else {
$profile_link = zrl($profile_link);
}
if (!x($item, 'author-thumb') OR ($item['author-thumb'] == "")) {
$author_contact = get_contact_details_by_url($item['author-link'], $profile_owner);
if ($author_contact["thumb"])
if ($author_contact["thumb"]) {
$item['author-thumb'] = $author_contact["thumb"];
else
} else {
$item['author-thumb'] = $item['author-avatar'];
}
}
if (!isset($item['owner-thumb']) OR ($item['owner-thumb'] == "")) {
$owner_contact = get_contact_details_by_url($item['owner-link'], $profile_owner);
if ($owner_contact["thumb"])
if ($owner_contact["thumb"]) {
$item['owner-thumb'] = $owner_contact["thumb"];
else
} else {
$item['owner-thumb'] = $item['owner-avatar'];
}
}
$locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
call_hooks('render_location',$locate);
@ -698,11 +735,11 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
$location = ((strlen($locate['html'])) ? $locate['html'] : render_location_dummy($locate));
localize_item($item);
if($mode === 'network-new')
if ($mode === 'network-new') {
$dropping = true;
else
} else {
$dropping = false;
}
$drop = array(
'dropping' => $dropping,
@ -720,7 +757,6 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
$body = prepare_body($item, true, $preview);
list($categories, $folders) = get_cats_and_terms($item);
if ($a->theme['template_engine'] === 'internal') {
@ -732,8 +768,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
$mentions_e = template_escape($mentions);
$location_e = template_escape($location);
$owner_name_e = template_escape($owner_name);
}
else {
} else {
$profile_name_e = $profile_name;
$item['title_e'] = $item['title'];
$body_e = $body;
@ -744,8 +779,9 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
$owner_name_e = $owner_name;
}
if ($item['item_network'] == "")
if ($item['item_network'] == "") {
$item['item_network'] = $item['network'];
}
$tmp_item = array(
'template' => $tpl,
@ -802,38 +838,35 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
$threads[$threadsid]['items'] = array($arr['output']);
}
}
else
{
} else {
// Normal View
$page_template = get_markup_template("threaded_conversation.tpl");
require_once('object/Conversation.php');
require_once('object/Item.php');
require_once 'object/Conversation.php';
require_once 'object/Item.php';
$conv = new Conversation($mode, $preview);
// get all the topmost parents
// this shouldn't be needed, as we should have only them in our array
// But for now, this array respects the old style, just in case
/*
* get all the topmost parents
* this shouldn't be needed, as we should have only them in our array
* But for now, this array respects the old style, just in case
*/
$threads = array();
foreach ($items as $item) {
if ($arr_blocked) {
$blocked = false;
foreach ($arr_blocked as $b) {
if ($b && link_compare($item['author-link'], $b)) {
$blocked = true;
break;
}
}
if($blocked)
if ($blocked) {
continue;
}
}
// Can we put this after the visibility check?
builtin_activity_puller($item, $conv_responses);
@ -842,6 +875,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
if ($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
continue;
}
if (! visible_activity($item)) {
continue;
}
@ -889,25 +923,25 @@ function best_link_url($item,&$sparkle,$ssl_state = false) {
if (local_user()) {
$r = q("SELECT `id` FROM `contact` WHERE `network` = '%s' AND `uid` = %d AND `nurl` = '%s' AND NOT `pending` LIMIT 1",
dbesc(NETWORK_DFRN), intval(local_user()), dbesc(normalise_link($clean_url)));
if ($r) {
if (dbm::is_result($r)) {
$best_url = 'redir/' . $r[0]['id'];
$sparkle = true;
}
}
if (! $best_url) {
if(strlen($item['author-link']))
if (strlen($item['author-link'])) {
$best_url = $item['author-link'];
else
} else {
$best_url = $item['url'];
}
}
return $best_url;
}
if (! function_exists('item_photo_menu')) {
function item_photo_menu($item)
{
function item_photo_menu($item) {
$ssl_state = false;
if (local_user()) {
@ -938,7 +972,7 @@ function item_photo_menu($item)
$rel = 0;
$r = q("SELECT `id`, `network`, `rel` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' LIMIT 1",
intval(local_user()), dbesc(normalise_link($item['author-link'])));
if ($r) {
if (dbm::is_result($r)) {
$cid = $r[0]['id'];
$network = $r[0]['network'];
$rel = $r[0]['rel'];
@ -964,7 +998,7 @@ function item_photo_menu($item)
}
if (local_user()) {
$menu = Array(
$menu = array(
t('Follow Thread') => $sub_link,
t('View Status') => $status_link,
t('View Profile') => $profile_link,
@ -1004,6 +1038,7 @@ function item_photo_menu($item)
return $o;
}}
if (! function_exists('builtin_activity_puller')) {
/**
* @brief Checks item to see if it is one of the builtin activities (like/dislike, event attendance, consensus items, etc.)
* Increments the count of each matching activity and adds a link to the author as needed.
@ -1012,7 +1047,6 @@ function item_photo_menu($item)
* @param array &$conv_responses (already created with builtin activity structure)
* @return void
*/
if(! function_exists('builtin_activity_puller')) {
function builtin_activity_puller($item, &$conv_responses) {
foreach ($conv_responses as $mode => $v) {
$url = '';
@ -1044,27 +1078,31 @@ function builtin_activity_puller($item, &$conv_responses) {
if ((local_user()) && (local_user() == $item['uid']) && ($item['network'] === NETWORK_DFRN) && (! $item['self']) && (link_compare($item['author-link'], $item['url']))) {
$url = 'redir/' . $item['contact-id'];
$sparkle = ' class="sparkle" ';
}
else
} else {
$url = zrl($url);
}
$url = '<a href="'. $url . '"'. $sparkle .'>' . htmlentities($item['author-name']) . '</a>';
if(! $item['thr-parent'])
if (! $item['thr-parent']) {
$item['thr-parent'] = $item['parent-uri'];
}
if (! ((isset($conv_responses[$mode][$item['thr-parent'] . '-l']))
&& (is_array($conv_responses[$mode][$item['thr-parent'] . '-l']))))
&& (is_array($conv_responses[$mode][$item['thr-parent'] . '-l'])))) {
$conv_responses[$mode][$item['thr-parent'] . '-l'] = array();
}
// only list each unique author once
if(in_array($url,$conv_responses[$mode][$item['thr-parent'] . '-l']))
if (in_array($url,$conv_responses[$mode][$item['thr-parent'] . '-l'])) {
continue;
}
if(! isset($conv_responses[$mode][$item['thr-parent']]))
if (! isset($conv_responses[$mode][$item['thr-parent']])) {
$conv_responses[$mode][$item['thr-parent']] = 1;
else
} else {
$conv_responses[$mode][$item['thr-parent']] ++;
}
if (public_contact() == $item['author-id']) {
$conv_responses[$mode][$item['thr-parent'] . '-self'] = 1;
@ -1078,15 +1116,16 @@ function builtin_activity_puller($item, &$conv_responses) {
}
}}
// Format the vote text for a profile item
// $cnt = number of people who vote the item
// $arr = array of pre-linked names of likers/dislikers
// $type = one of 'like, 'dislike', 'attendyes', 'attendno', 'attendmaybe'
// $id = item id
// returns formatted text
if (! function_exists('format_like')) {
function format_like($cnt,$arr,$type,$id) {
/**
* Format the vote text for a profile item
* @param int $cnt = number of people who vote the item
* @param array $arr = array of pre-linked names of likers/dislikers
* @param string $type = one of 'like, 'dislike', 'attendyes', 'attendno', 'attendmaybe'
* @param int $id = item id
* @return formatted text
*/
function format_like($cnt, array $arr, $type, $id) {
$o = '';
$expanded = '';
@ -1116,8 +1155,9 @@ function format_like($cnt,$arr,$type,$id) {
if ($cnt > 1) {
$total = count($arr);
if($total >= MAX_LIKERS)
if ($total >= MAX_LIKERS) {
$arr = array_slice($arr, 0, MAX_LIKERS - 1);
}
if ($total < MAX_LIKERS) {
$last = t('and') . ' ' . $arr[count($arr)-1];
$arr2 = array_slice($arr, 0, -1);
@ -1169,11 +1209,10 @@ function format_like($cnt,$arr,$type,$id) {
return $o;
}}
function status_editor($a,$x, $notes_cid = 0, $popup=false) {
function status_editor(App $a, $x, $notes_cid = 0, $popup = false) {
$o = '';
$geotag = (($x['allow_location']) ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '');
$geotag = (x($x, 'allow_location') ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '');
$tpl = get_markup_template('jot-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array(
@ -1211,22 +1250,25 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
// Private/public post links for the non-JS ACL form
$private_post = 1;
if($_REQUEST['public'])
if (x($_REQUEST, 'public')) {
$private_post = 0;
}
$query_str = $a->query_string;
if(strpos($query_str, 'public=1') !== false)
if (strpos($query_str, 'public=1') !== false) {
$query_str = str_replace(array('?public=1', '&public=1'), array('', ''), $query_str);
}
// I think $a->query_string may never have ? in it, but I could be wrong
// It looks like it's from the index.php?q=[etc] rewrite that the web
// server does, which converts any ? to &, e.g. suggest&ignore=61 for suggest?ignore=61
if(strpos($query_str, '?') === false)
/*
* I think $a->query_string may never have ? in it, but I could be wrong
* It looks like it's from the index.php?q=[etc] rewrite that the web
* server does, which converts any ? to &, e.g. suggest&ignore=61 for suggest?ignore=61
*/
if (strpos($query_str, '?') === false) {
$public_post_link = '?public=1';
else
} else {
$public_post_link = '&public=1';
}
// $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
$tpl = get_markup_template("jot.tpl");
@ -1292,7 +1334,6 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
if ($popup == true) {
$o = '<div id="jot-popup" style="display: none;">'.$o.'</div>';
}
return $o;
@ -1307,15 +1348,15 @@ function get_item_children($arr, $parent) {
if (get_config('system', 'thread_allow') && $a->theme_thread_allow) {
// Fallback to parent-uri if thr-parent is not set
$thr_parent = $item['thr-parent'];
if($thr_parent == '')
if ($thr_parent == '') {
$thr_parent = $item['parent-uri'];
}
if ($thr_parent == $parent['uri']) {
$item['children'] = get_item_children($arr, $item);
$children[] = $item;
}
}
else if($item['parent'] == $parent['id']) {
} elseif ($item['parent'] == $parent['id']) {
$children[] = $item;
}
}
@ -1323,6 +1364,7 @@ function get_item_children($arr, $parent) {
return $children;
}
/// @TODO Add type-hint
function sort_item_children($items) {
$result = $items;
usort($result, 'sort_thr_created_rev');
@ -1334,44 +1376,58 @@ function sort_item_children($items) {
return $result;
}
/// @TODO Add type-hint
function add_children_to_list($children, &$arr) {
foreach ($children as $y) {
$arr[] = $y;
if(count($y['children']))
if (count($y['children'])) {
add_children_to_list($y['children'], $arr);
}
}
}
/// @TODO Add type-hint
function conv_sort($arr, $order) {
if((!(is_array($arr) && count($arr))))
if ((!(is_array($arr) && count($arr)))) {
return array();
}
$parents = array();
$children = array();
$newarr = array();
// This is a preparation for having two different items with the same uri in one thread
// This will otherwise lead to an endless loop.
foreach($arr as $x)
if (!isset($newarr[$x['uri']]))
/*
* This is a preparation for having two different items with the same uri in one thread
* This will otherwise lead to an endless loop.
*/
foreach ($arr as $x) {
if (!isset($newarr[$x['uri']])) {
$newarr[$x['uri']] = $x;
}
}
$arr = $newarr;
foreach($arr as $x)
if($x['id'] == $x['parent'])
foreach ($arr as $x) {
if ($x['id'] == $x['parent']) {
$parents[] = $x;
}
}
if(stristr($order,'created'))
if (stristr($order, 'created')) {
usort($parents, 'sort_thr_created');
elseif(stristr($order,'commented'))
} elseif (stristr($order, 'commented')) {
usort($parents, 'sort_thr_commented');
}
if(count($parents))
foreach($parents as $i=>$_x)
if (count($parents)) {
foreach ($parents as $i => $_x) {
$parents[$i]['children'] = get_item_children($arr, $_x);
}
}
/// @TODO Old-lost code?
/*foreach ($arr as $x) {
if ($x['id'] != $x['parent']) {
$p = find_thread_parent_index($parents,$x);
@ -1383,6 +1439,7 @@ function conv_sort($arr,$order) {
foreach ($parents as $k => $v) {
if (count($parents[$k]['children'])) {
$parents[$k]['children'] = sort_item_children($parents[$k]['children']);
/// @TODO Old-lost code?
/*$y = $parents[$k]['children'];
usort($y,'sort_thr_created_rev');
$parents[$k]['children'] = $y;*/
@ -1394,44 +1451,55 @@ function conv_sort($arr,$order) {
if (count($parents)) {
foreach ($parents as $x) {
$ret[] = $x;
if(count($x['children']))
if (count($x['children'])) {
add_children_to_list($x['children'], $ret);
/// @TODO Old-lost code?
/*foreach ($x['children'] as $y)
$ret[] = $y;*/
}
}
}
return $ret;
}
/// @TODO Add type-hint
function sort_thr_created($a, $b) {
return strcmp($b['created'], $a['created']);
}
/// @TODO Add type-hint
function sort_thr_created_rev($a, $b) {
return strcmp($a['created'], $b['created']);
}
/// @TODO Add type-hint
function sort_thr_commented($a, $b) {
return strcmp($b['commented'], $a['commented']);
}
/// @TODO Add type-hint
function find_thread_parent_index($arr, $x) {
foreach($arr as $k => $v)
if($v['id'] == $x['parent'])
foreach ($arr as $k => $v) {
if ($v['id'] == $x['parent']) {
return $k;
}
}
return false;
}
/// @TODO Add type-hint
function render_location_dummy($item) {
if ($item['location'] != "")
if ($item['location'] != "") {
return $item['location'];
if ($item['coord'] != "")
return $item['coord'];
}
if ($item['coord'] != "") {
return $item['coord'];
}
}
/// @TODO Add type-hint
function get_responses($conv_responses, $response_verbs, $ob, $item) {
$ret = array();
foreach ($response_verbs as $v) {
@ -1443,8 +1511,7 @@ function get_responses($conv_responses,$response_verbs,$ob,$item) {
$ret[$v]['list_part'] = array_slice($ret[$v]['list'], 0, MAX_LIKERS);
array_push($ret[$v]['list_part'], '<a href="#" data-toggle="modal" data-target="#' . $v . 'Modal-'
. (($ob) ? $ob->get_id() : $item['id']) . '"><b>' . t('View all') . '</b></a>');
}
else {
} else {
$ret[$v]['list_part'] = '';
}
$ret[$v]['button'] = get_response_button_text($v, $ret[$v]['count']);
@ -1453,9 +1520,10 @@ function get_responses($conv_responses,$response_verbs,$ob,$item) {
$count = 0;
foreach ($ret as $key) {
if ($key['count'] == true)
if ($key['count'] == true) {
$count++;
}
}
$ret['count'] = $count;
return $ret;

View file

@ -4,7 +4,7 @@ use \Friendica\Core\Config;
function cron_run(&$argv, &$argc){
global $a;
require_once('include/datetime.php');
require_once 'include/datetime.php';
// Poll contacts with specific parameters
if ($argc > 1) {
@ -18,6 +18,7 @@ function cron_run(&$argv, &$argc){
if (! $poll_interval) {
$poll_interval = 10;
}
if ($last) {
$next = $last + ($poll_interval * 60);
if ($next > time()) {
@ -156,7 +157,7 @@ function cron_poll_contacts($argc, $argv) {
dbesc(NETWORK_MAIL2)
);
if (!count($contacts)) {
if (!dbm::is_result($contacts)) {
return;
}
@ -183,25 +184,24 @@ function cron_poll_contacts($argc, $argv) {
}
if ($contact['subhub'] AND in_array($contact['network'], array(NETWORK_DFRN, NETWORK_ZOT, NETWORK_OSTATUS))) {
// We should be getting everything via a hub. But just to be sure, let's check once a day.
// (You can make this more or less frequent if desired by setting 'pushpoll_frequency' appropriately)
// This also lets us update our subscription to the hub, and add or replace hubs in case it
// changed. We will only update hubs once a day, regardless of 'pushpoll_frequency'.
/*
* We should be getting everything via a hub. But just to be sure, let's check once a day.
* (You can make this more or less frequent if desired by setting 'pushpoll_frequency' appropriately)
* This also lets us update our subscription to the hub, and add or replace hubs in case it
* changed. We will only update hubs once a day, regardless of 'pushpoll_frequency'.
*/
$poll_interval = get_config('system', 'pushpoll_frequency');
$contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
}
if ($contact['priority'] AND !$force) {
$update = false;
$t = $contact['last-update'];
/**
/*
* Based on $contact['priority'], should we poll this site now? Or later?
*/
switch ($contact['priority']) {
case 5:
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 month")) {

View file

@ -5,22 +5,24 @@ use \Friendica\Core\Config;
function cronhooks_run(&$argv, &$argc) {
global $a;
require_once('include/datetime.php');
require_once 'include/datetime.php';
if (($argc == 2) AND is_array($a->hooks) AND array_key_exists("cron", $a->hooks)) {
foreach ($a->hooks["cron"] as $hook)
foreach ($a->hooks["cron"] as $hook) {
if ($hook[1] == $argv[1]) {
logger("Calling cron hook '" . $hook[1] . "'", LOGGER_DEBUG);
call_single_hook($a, $name, $hook, $data);
}
}
return;
}
$last = get_config('system', 'last_cronhook');
$poll_interval = intval(get_config('system', 'cronhook_interval'));
if(! $poll_interval)
if (! $poll_interval) {
$poll_interval = 9;
}
if ($last) {
$next = $last + ($poll_interval * 60);

View file

@ -554,8 +554,9 @@ class dfrn {
xml::add_element($doc, $author, "poco:displayName", $profile["name"]);
xml::add_element($doc, $author, "poco:updated", $namdate);
if (trim($profile["dob"]) > '0001-01-01')
if (trim($profile["dob"]) > '0001-01-01') {
xml::add_element($doc, $author, "poco:birthday", "0000-".date("m-d", strtotime($profile["dob"])));
}
xml::add_element($doc, $author, "poco:note", $profile["about"]);
xml::add_element($doc, $author, "poco:preferredUsername", $profile["nickname"]);

File diff suppressed because it is too large Load diff