Merge remote-tracking branch 'upstream/develop' into 1608-performance

This commit is contained in:
Michael Vogel 2016-08-01 08:04:11 +02:00
commit d8c4fceef8
28 changed files with 1129 additions and 1192 deletions

View File

@ -38,7 +38,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_CODENAME', 'Asparagus');
define ( 'FRIENDICA_VERSION', '3.5-dev' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1199 );
define ( 'DB_UPDATE_VERSION', 1200 );
/**
* @brief Constant with a HTML line break.

View File

@ -1,6 +1,6 @@
-- ------------------------------------------
-- Friendica 3.5-dev (Asparagus)
-- DB_UPDATE_VERSION 1199
-- DB_UPDATE_VERSION 1200
-- ------------------------------------------
@ -522,6 +522,7 @@ CREATE TABLE IF NOT EXISTS `item` (
INDEX `uid_title` (`uid`,`title`),
INDEX `uid_thrparent` (`uid`,`thr-parent`),
INDEX `uid_parenturi` (`uid`,`parent-uri`),
INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
INDEX `gcontactid_uid_created` (`gcontact-id`,`uid`,`created`),
INDEX `authorid_created` (`author-id`,`created`),
@ -532,7 +533,7 @@ CREATE TABLE IF NOT EXISTS `item` (
INDEX `uid_wall_created` (`uid`,`wall`,`created`),
INDEX `resource-id` (`resource-id`),
INDEX `uid_type` (`uid`,`type`),
INDEX `uid_starred` (`uid`,`starred`),
INDEX `uid_starred_id` (`uid`,`starred`,`id`),
INDEX `contactid_allowcid_allowpid_denycid_denygid` (`contact-id`,`allow_cid`(10),`allow_gid`(10),`deny_cid`(10),`deny_gid`(10)),
INDEX `uid_wall_parent_created` (`uid`,`wall`,`parent`,`created`),
INDEX `uid_type_changed` (`uid`,`type`,`changed`),

View File

@ -631,11 +631,11 @@ function posts_from_contact($a, $contact_id) {
$r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,
`author-name` AS `name`, `owner-avatar` AS `photo`,
`owner-link` AS `url`, `owner-avatar` AS `thumb`
FROM `item` FORCE INDEX (`uid_contactid_created`)
FROM `item` FORCE INDEX (`uid_contactid_id`)
WHERE `item`.`uid` = %d AND `contact-id` = %d
AND `author-link` IN ('%s', '%s')
AND NOT `deleted` AND NOT `moderated` AND `visible`
ORDER BY `item`.`created` DESC LIMIT %d, %d",
ORDER BY `item`.`id` DESC LIMIT %d, %d",
intval(local_user()),
intval($contact_id),
dbesc(str_replace("https://", "http://", $contact["url"])),

File diff suppressed because it is too large Load Diff

View File

@ -858,6 +858,7 @@ function db_definition() {
"uid_title" => array("uid","title"),
"uid_thrparent" => array("uid","thr-parent"),
"uid_parenturi" => array("uid","parent-uri"),
"uid_contactid_id" => array("uid","contact-id","id"),
"uid_contactid_created" => array("uid","contact-id","created"),
"gcontactid_uid_created" => array("gcontact-id","uid","created"),
"authorid_created" => array("author-id","created"),
@ -868,7 +869,7 @@ function db_definition() {
"uid_wall_created" => array("uid","wall","created"),
"resource-id" => array("resource-id"),
"uid_type" => array("uid","type"),
"uid_starred" => array("uid","starred"),
"uid_starred_id" => array("uid","starred", "id"),
"contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"),
"uid_wall_parent_created" => array("uid","wall","parent","created"),
"uid_type_changed" => array("uid","type","changed"),

View File

@ -1971,7 +1971,7 @@ class ostatus {
OR (`item`.`network` = '%s' AND ((`thread`.`network` IN ('%s', '%s')) OR (`thritem`.`network` IN ('%s', '%s')))) AND `thread`.`mention`)
AND ((`item`.`owner-link` IN ('%s', '%s') AND (`item`.`parent` = `item`.`id`))
OR (`item`.`author-link` IN ('%s', '%s')))
ORDER BY `item`.`received` DESC
ORDER BY `item`.`id` DESC
LIMIT 0, 300",
intval($owner["uid"]), dbesc($check_date), dbesc(NETWORK_DFRN),
//dbesc(NETWORK_OSTATUS), dbesc(NETWORK_OSTATUS),

View File

@ -27,8 +27,11 @@ class xml {
foreach ($namespaces AS $nskey => $nsvalue)
$key .= " xmlns".($nskey == "" ? "":":").$nskey.'="'.$nsvalue.'"';
$root = new SimpleXMLElement("<".$key."/>");
self::from_array($value, $root, $remove_header, $namespaces, false);
if (is_array($value)) {
$root = new SimpleXMLElement("<".$key."/>");
self::from_array($value, $root, $remove_header, $namespaces, false);
} else
$root = new SimpleXMLElement("<".$key.">".xmlify($value)."</".$key.">");
$dom = dom_import_simplexml($root)->ownerDocument;
$dom->formatOutput = true;
@ -44,6 +47,15 @@ class xml {
}
foreach($array as $key => $value) {
if (!isset($element) AND isset($xml))
$element = $xml;
if (is_integer($key)) {
if (isset($element))
$element[0] = $value;
continue;
}
if (substr($key, 0, 11) == "@attributes") {
if (!isset($element) OR !is_array($value))
continue;
@ -55,7 +67,7 @@ class xml {
else
$namespace = NULL;
$element->addAttribute ($attr_key, $attr_value, $namespace);
$element->addAttribute($attr_key, $attr_value, $namespace);
}
continue;
@ -64,6 +76,8 @@ class xml {
$element_parts = explode(":", $key);
if ((count($element_parts) > 1) AND isset($namespaces[$element_parts[0]]))
$namespace = $namespaces[$element_parts[0]];
elseif (isset($namespaces[""]))
$namespace = $namespaces[""];
else
$namespace = NULL;

View File

@ -224,7 +224,7 @@ function content_content(&$a, $update = 0) {
$simple_update
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$sql_extra $sql_nets
ORDER BY `item`.`received` DESC $pager_sql ",
ORDER BY `item`.`id` DESC $pager_sql ",
intval($_SESSION['uid'])
);

View File

@ -59,10 +59,6 @@ function notifications_post(&$a) {
}
}
function notifications_content(&$a) {
if(! local_user()) {
@ -76,6 +72,456 @@ function notifications_content(&$a) {
$o = '';
// get the nav tabs for the notification pages
$tabs = notifications_tabs($a);
$notif_content = array();
if( (($a->argc > 1) && ($a->argv[1] == 'intros')) || (($a->argc == 1))) {
nav_set_selected('introductions');
if(($a->argc > 2) && ($a->argv[2] == 'all'))
$sql_extra = '';
else
$sql_extra = " AND `ignore` = 0 ";
$notif_header = t('Notifications');
$notif_tpl = get_markup_template('notifications.tpl');
$notif_ignored_lnk .= '<a href="' . ((strlen($sql_extra)) ? 'notifications/intros/all' : 'notifications/intros' ) . '" id="notifications-show-hide-link" >'
. ((strlen($sql_extra)) ? t('Show Ignored Requests') : t('Hide Ignored Requests')) . '</a></div>' . "\r\n";
$r = q("SELECT COUNT(*) AS `total` FROM `intro`
WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ",
intval($_SESSION['uid'])
);
if($r && count($r)) {
$a->set_pager_total($r[0]['total']);
$a->set_pager_itemspage(20);
}
/// @todo Fetch contact details by "get_contact_details_by_url" instead of queries to contact, fcontact and gcontact
$r = q("SELECT `intro`.`id` AS `intro_id`, `intro`.*, `contact`.*, `fcontact`.`name` AS `fname`,`fcontact`.`url` AS `furl`,`fcontact`.`photo` AS `fphoto`,`fcontact`.`request` AS `frequest`,
`gcontact`.`location` AS `glocation`, `gcontact`.`about` AS `gabout`,
`gcontact`.`keywords` AS `gkeywords`, `gcontact`.`gender` AS `ggender`,
`gcontact`.`network` AS `gnetwork`
FROM `intro`
LEFT JOIN `contact` ON `contact`.`id` = `intro`.`contact-id`
LEFT JOIN `gcontact` ON `gcontact`.`nurl` = `contact`.`nurl`
LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id`
WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ",
intval($_SESSION['uid']));
if(($r !== false) && (count($r))) {
$sugg = get_markup_template('suggestions.tpl');
$tpl = get_markup_template("intros.tpl");
foreach($r as $rr) {
if($rr['fid']) {
$return_addr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : ''));
$notif_content[] = replace_macros($sugg, array(
'$str_notifytype' => t('Notification type: '),
'$notify_type' => t('Friend Suggestion'),
'$intro_id' => $rr['intro_id'],
'$madeby' => sprintf( t('suggested by %s'),$rr['name']),
'$contact_id' => $rr['contact-id'],
'$photo' => ((x($rr,'fphoto')) ? proxy_url($rr['fphoto'], false, PROXY_SIZE_SMALL) : "images/person-175.jpg"),
'$fullname' => $rr['fname'],
'$url' => zrl($rr['furl']),
'$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
'$activity' => array('activity', t('Post a new friend activity'), (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0), t('if applicable')),
'$knowyou' => $knowyou,
'$approve' => t('Approve'),
'$note' => $rr['note'],
'$request' => $rr['frequest'] . '?addr=' . $return_addr,
'$ignore' => t('Ignore'),
'$discard' => t('Discard'),
));
continue;
}
$friend_selected = (($rr['network'] !== NETWORK_OSTATUS) ? ' checked="checked" ' : ' disabled ');
$fan_selected = (($rr['network'] === NETWORK_OSTATUS) ? ' checked="checked" disabled ' : '');
$dfrn_tpl = get_markup_template('netfriend.tpl');
$knowyou = '';
$dfrn_text = '';
if($rr['network'] === NETWORK_DFRN || $rr['network'] === NETWORK_DIASPORA) {
if($rr['network'] === NETWORK_DFRN) {
$lbl_knowyou = t('Claims to be known to you: ');
$knowyou = (($rr['knowyou']) ? t('yes') : t('no'));
$helptext = t('Shall your connection be bidirectional or not? "Friend" implies that you allow to read and you subscribe to their posts. "Fan/Admirer" means that you allow to read but you do not want to read theirs. Approve as: ');
} else {
$knowyou = '';
$helptext = t('Shall your connection be bidirectional or not? "Friend" implies that you allow to read and you subscribe to their posts. "Sharer" means that you allow to read but you do not want to read theirs. Approve as: ');
}
$dfrn_text = replace_macros($dfrn_tpl,array(
'$intro_id' => $rr['intro_id'],
'$friend_selected' => $friend_selected,
'$fan_selected' => $fan_selected,
'$approve_as' => $helptext,
'$as_friend' => t('Friend'),
'$as_fan' => (($rr['network'] == NETWORK_DIASPORA) ? t('Sharer') : t('Fan/Admirer'))
));
}
$header = $rr["name"];
$ret = probe_url($rr["url"]);
if ($rr['gnetwork'] == "")
$rr['gnetwork'] = $ret["network"];
if ($ret["addr"] != "")
$header .= " <".$ret["addr"].">";
$header .= " (".network_to_name($rr['gnetwork'], $rr['url']).")";
// Don't show these data until you are connected. Diaspora is doing the same.
if($rr['gnetwork'] === NETWORK_DIASPORA) {
$rr['glocation'] = "";
$rr['gabout'] = "";
$rr['ggender'] = "";
}
$notif_content[] = replace_macros($tpl, array(
'$header' => htmlentities($header),
'$str_notifytype' => t('Notification type: '),
'$notify_type' => (($rr['network'] !== NETWORK_OSTATUS) ? t('Friend/Connect Request') : t('New Follower')),
'$dfrn_text' => $dfrn_text,
'$dfrn_id' => $rr['issued-id'],
'$uid' => $_SESSION['uid'],
'$intro_id' => $rr['intro_id'],
'$contact_id' => $rr['contact-id'],
'$photo' => ((x($rr,'photo')) ? proxy_url($rr['photo'], false, PROXY_SIZE_SMALL) : "images/person-175.jpg"),
'$fullname' => $rr['name'],
'$location' => bbcode($rr['glocation'], false, false),
'$lbl_location' => t('Location:'),
'$about' => bbcode($rr['gabout'], false, false),
'$lbl_about' => t('About:'),
'$keywords' => $rr['gkeywords'],
'$lbl_keywords' => t('Tags:'),
'$gender' => $rr['ggender'],
'$lbl_gender' => t('Gender:'),
'$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
'$activity' => array('activity', t('Post a new friend activity'), (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0), t('if applicable')),
'$url' => $rr['url'],
'$zrl' => zrl($rr['url']),
'$lbl_url' => t('Profile URL'),
'$addr' => $rr['addr'],
'$lbl_knowyou' => $lbl_knowyou,
'$lbl_network' => t('Network:'),
'$network' => network_to_name($rr['gnetwork'], $rr['url']),
'$knowyou' => $knowyou,
'$approve' => t('Approve'),
'$note' => $rr['note'],
'$ignore' => t('Ignore'),
'$discard' => t('Discard'),
));
}
}
else
info( t('No introductions.') . EOL);
} else if (($a->argc > 1) && ($a->argv[1] == 'network')) {
$notif_header = t('Network Notifications');
$notif_tpl = get_markup_template('notifications.tpl');
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`,
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`, `pitem`.`guid` as `pguid`
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND `pitem`.`parent` != 0 AND
`item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0 ORDER BY `item`.`created` DESC" ,
intval(local_user())
);
$tpl_item_likes = get_markup_template('notifications_likes_item.tpl');
$tpl_item_dislikes = get_markup_template('notifications_dislikes_item.tpl');
$tpl_item_friends = get_markup_template('notifications_friends_item.tpl');
$tpl_item_comments = get_markup_template('notifications_comments_item.tpl');
$tpl_item_posts = get_markup_template('notifications_posts_item.tpl');
if ($r) {
foreach ($r as $it) {
switch($it['verb']){
case ACTIVITY_LIKE:
$notif_content[] = replace_macros($tpl_item_likes,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created'])
));
break;
case ACTIVITY_DISLIKE:
$notif_content[] = replace_macros($tpl_item_dislikes,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created'])
));
break;
case ACTIVITY_FRIEND:
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
$obj = parse_xml_string($xmlhead.$it['object']);
$it['fname'] = $obj->title;
$notif_content[] = replace_macros($tpl_item_friends,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
'$item_when' => relative_date($it['created'])
));
break;
default:
$item_text = (($it['id'] == $it['parent'])
? sprintf( t("%s created a new post"), $it['author-name'])
: sprintf( t("%s commented on %s's post"), $it['author-name'], $it['pname']));
$tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments);
$notif_content[] = replace_macros($tpl,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
'$item_text' => $item_text,
'$item_when' => relative_date($it['created'])
));
}
}
} else {
$notif_nocontent = t('No more network notifications.');
}
} else if (($a->argc > 1) && ($a->argv[1] == 'system')) {
$notif_header = t('System Notifications');
$notif_tpl = get_markup_template('notifications.tpl');
$not_tpl = get_markup_template('notify.tpl');
require_once('include/bbcode.php');
$r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc",
intval(local_user())
);
if (count($r) > 0) {
foreach ($r as $it) {
$notif_content[] = replace_macros($not_tpl,array(
'$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'],
'$item_image' => proxy_url($it['photo'], false, PROXY_SIZE_MICRO),
'$item_text' => strip_tags(bbcode($it['msg'])),
'$item_when' => relative_date($it['date'])
));
}
} else {
$notif_nocontent = t('No more system notifications.');
}
} else if (($a->argc > 1) && ($a->argv[1] == 'personal')) {
$notif_header = t('Personal Notifications');
$notif_tpl = get_markup_template('notifications.tpl');
$myurl = $a->get_baseurl(true) . '/profile/'. $a->user['nickname'];
$myurl = substr($myurl,strpos($myurl,'://')+3);
$myurl = str_replace(array('www.','.'),array('','\\.'),$myurl);
$diasp_url = str_replace('/profile/','/u/',$myurl);
$sql_extra .= sprintf(" AND ( `item`.`author-link` regexp '%s' or `item`.`tag` regexp '%s' or `item`.`tag` regexp '%s' ) ",
dbesc($myurl . '$'),
dbesc($myurl . '\\]'),
dbesc($diasp_url . '\\]')
);
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`,
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`, `pitem`.`guid` as `pguid`
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1
$sql_extra
AND `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0 ORDER BY `item`.`created` DESC" ,
intval(local_user())
);
$tpl_item_likes = get_markup_template('notifications_likes_item.tpl');
$tpl_item_dislikes = get_markup_template('notifications_dislikes_item.tpl');
$tpl_item_friends = get_markup_template('notifications_friends_item.tpl');
$tpl_item_comments = get_markup_template('notifications_comments_item.tpl');
$tpl_item_posts = get_markup_template('notifications_posts_item.tpl');
if (count($r) > 0) {
foreach ($r as $it) {
switch($it['verb']){
case ACTIVITY_LIKE:
$notif_content[] = replace_macros($tpl_item_likes,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created'])
));
break;
case ACTIVITY_DISLIKE:
$notif_content[] = replace_macros($tpl_item_dislikes,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created'])
));
break;
case ACTIVITY_FRIEND:
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
$obj = parse_xml_string($xmlhead.$it['object']);
$it['fname'] = $obj->title;
$notif_content[] = replace_macros($tpl_item_friends,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
'$item_when' => relative_date($it['created'])
));
break;
default:
$item_text = (($it['id'] == $it['parent'])
? sprintf( t("%s created a new post"), $it['author-name'])
: sprintf( t("%s commented on %s's post"), $it['author-name'], $it['pname']));
$tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments);
$notif_content[] = replace_macros($tpl,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'],
'$item_text' => $item_text,
'$item_when' => relative_date($it['created'])
));
}
}
} else {
$notif_nocontent = t('No more personal notifications.');
}
} else if (($a->argc > 1) && ($a->argv[1] == 'home')) {
$notif_header = t('Home Notifications');
$notif_tpl = get_markup_template('notifications.tpl');
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`,
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`, `pitem`.`guid` as `pguid`
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND
`item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 1 ORDER BY `item`.`created` DESC",
intval(local_user())
);
$tpl_item_likes = get_markup_template('notifications_likes_item.tpl');
$tpl_item_dislikes = get_markup_template('notifications_dislikes_item.tpl');
$tpl_item_friends = get_markup_template('notifications_friends_item.tpl');
$tpl_item_comments = get_markup_template('notifications_comments_item.tpl');
if (count($r) > 0) {
foreach ($r as $it) {
switch($it['verb']){
case ACTIVITY_LIKE:
$notif_content[] = replace_macros($tpl_item_likes,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created'])
));
break;
case ACTIVITY_DISLIKE:
$notif_content[] = replace_macros($tpl_item_dislikes,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created'])
));
break;
case ACTIVITY_FRIEND:
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
$obj = parse_xml_string($xmlhead.$it['object']);
$it['fname'] = $obj->title;
$notif_content[] = replace_macros($tpl_item_friends,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
'$item_when' => relative_date($it['created'])
));
break;
default:
$notif_content[] = replace_macros($tpl_item_comments,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s commented on %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created'])
));
}
}
} else {
$notif_nocontent = t('No more home notifications.');
}
}
$o .= replace_macros($notif_tpl, array(
'$notif_header' => $notif_header,
'$tabs' => $tabs,
'$notif_content' => $notif_content,
'$notif_nocontent' => $notif_nocontent,
'$notif_ignored_lnk' => $notif_ignored_lnk,
));
$o .= paginate($a);
return $o;
}
/**
* @brief List of pages for the Notifications TabBar
*
* @param app $a The
* @return array with with notifications TabBar data
*/
function notifications_tabs($a) {
$tabs = array(
array(
'label' => t('System'),
@ -114,470 +560,5 @@ function notifications_content(&$a) {
),*/ /*while I can have notifications for messages, this tablist is not place for message page link */
);
$o = "";
if( (($a->argc > 1) && ($a->argv[1] == 'intros')) || (($a->argc == 1))) {
nav_set_selected('introductions');
if(($a->argc > 2) && ($a->argv[2] == 'all'))
$sql_extra = '';
else
$sql_extra = " AND `ignore` = 0 ";
$notif_tpl = get_markup_template('notifications.tpl');
$notif_content .= '<a href="' . ((strlen($sql_extra)) ? 'notifications/intros/all' : 'notifications/intros' ) . '" id="notifications-show-hide-link" >'
. ((strlen($sql_extra)) ? t('Show Ignored Requests') : t('Hide Ignored Requests')) . '</a></div>' . "\r\n";
$r = q("SELECT COUNT(*) AS `total` FROM `intro`
WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ",
intval($_SESSION['uid'])
);
if($r && count($r)) {
$a->set_pager_total($r[0]['total']);
$a->set_pager_itemspage(20);
}
/// @todo Fetch contact details by "get_contact_details_by_url" instead of queries to contact, fcontact and gcontact
$r = q("SELECT `intro`.`id` AS `intro_id`, `intro`.*, `contact`.*, `fcontact`.`name` AS `fname`,`fcontact`.`url` AS `furl`,`fcontact`.`photo` AS `fphoto`,`fcontact`.`request` AS `frequest`,
`gcontact`.`location` AS `glocation`, `gcontact`.`about` AS `gabout`,
`gcontact`.`keywords` AS `gkeywords`, `gcontact`.`gender` AS `ggender`,
`gcontact`.`network` AS `gnetwork`
FROM `intro`
LEFT JOIN `contact` ON `contact`.`id` = `intro`.`contact-id`
LEFT JOIN `gcontact` ON `gcontact`.`nurl` = `contact`.`nurl`
LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id`
WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ",
intval($_SESSION['uid']));
if(($r !== false) && (count($r))) {
$sugg = get_markup_template('suggestions.tpl');
$tpl = get_markup_template("intros.tpl");
foreach($r as $rr) {
if($rr['fid']) {
$return_addr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : ''));
$notif_content .= replace_macros($sugg, array(
'$str_notifytype' => t('Notification type: '),
'$notify_type' => t('Friend Suggestion'),
'$intro_id' => $rr['intro_id'],
'$madeby' => sprintf( t('suggested by %s'),$rr['name']),
'$contact_id' => $rr['contact-id'],
'$photo' => ((x($rr,'fphoto')) ? proxy_url($rr['fphoto'], false, PROXY_SIZE_SMALL) : "images/person-175.jpg"),
'$fullname' => $rr['fname'],
'$url' => zrl($rr['furl']),
'$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
'$activity' => array('activity', t('Post a new friend activity'), (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0), t('if applicable')),
'$knowyou' => $knowyou,
'$approve' => t('Approve'),
'$note' => $rr['note'],
'$request' => $rr['frequest'] . '?addr=' . $return_addr,
'$ignore' => t('Ignore'),
'$discard' => t('Discard'),
));
continue;
}
$friend_selected = (($rr['network'] !== NETWORK_OSTATUS) ? ' checked="checked" ' : ' disabled ');
$fan_selected = (($rr['network'] === NETWORK_OSTATUS) ? ' checked="checked" disabled ' : '');
$dfrn_tpl = get_markup_template('netfriend.tpl');
$knowyou = '';
$dfrn_text = '';
if($rr['network'] === NETWORK_DFRN || $rr['network'] === NETWORK_DIASPORA) {
if($rr['network'] === NETWORK_DFRN) {
$knowyou = t('Claims to be known to you: ') . (($rr['knowyou']) ? t('yes') : t('no'));
$helptext = t('Shall your connection be bidirectional or not? "Friend" implies that you allow to read and you subscribe to their posts. "Fan/Admirer" means that you allow to read but you do not want to read theirs. Approve as: ');
} else {
$knowyou = '';
$helptext = t('Shall your connection be bidirectional or not? "Friend" implies that you allow to read and you subscribe to their posts. "Sharer" means that you allow to read but you do not want to read theirs. Approve as: ');
}
$dfrn_text = replace_macros($dfrn_tpl,array(
'$intro_id' => $rr['intro_id'],
'$friend_selected' => $friend_selected,
'$fan_selected' => $fan_selected,
'$approve_as' => $helptext,
'$as_friend' => t('Friend'),
'$as_fan' => (($rr['network'] == NETWORK_DIASPORA) ? t('Sharer') : t('Fan/Admirer'))
));
}
$header = $rr["name"];
$ret = probe_url($rr["url"]);
if ($rr['gnetwork'] == "")
$rr['gnetwork'] = $ret["network"];
if ($ret["addr"] != "")
$header .= " <".$ret["addr"].">";
$header .= " (".network_to_name($rr['gnetwork'], $rr['url']).")";
// Don't show these data until you are connected. Diaspora is doing the same.
if($rr['gnetwork'] === NETWORK_DIASPORA) {
$rr['glocation'] = "";
$rr['gabout'] = "";
$rr['ggender'] = "";
}
$notif_content .= replace_macros($tpl, array(
'$header' => htmlentities($header),
'$str_notifytype' => t('Notification type: '),
'$notify_type' => (($rr['network'] !== NETWORK_OSTATUS) ? t('Friend/Connect Request') : t('New Follower')),
'$dfrn_text' => $dfrn_text,
'$dfrn_id' => $rr['issued-id'],
'$uid' => $_SESSION['uid'],
'$intro_id' => $rr['intro_id'],
'$contact_id' => $rr['contact-id'],
'$photo' => ((x($rr,'photo')) ? proxy_url($rr['photo'], false, PROXY_SIZE_SMALL) : "images/person-175.jpg"),
'$fullname' => $rr['name'],
'$location' => bbcode($rr['glocation'], false, false),
'$location_label' => t('Location:'),
'$about' => bbcode($rr['gabout'], false, false),
'$about_label' => t('About:'),
'$keywords' => $rr['gkeywords'],
'$keywords_label' => t('Tags:'),
'$gender' => $rr['ggender'],
'$gender_label' => t('Gender:'),
'$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
'$activity' => array('activity', t('Post a new friend activity'), (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0), t('if applicable')),
'$url' => $rr['url'],
'$zrl' => zrl($rr['url']),
'$url_label' => t('Profile URL'),
'$knowyou' => $knowyou,
'$approve' => t('Approve'),
'$note' => $rr['note'],
'$ignore' => t('Ignore'),
'$discard' => t('Discard'),
));
}
}
else
info( t('No introductions.') . EOL);
$o .= replace_macros($notif_tpl, array(
'$notif_header' => t('Notifications'),
'$tabs' => $tabs,
'$notif_content' => $notif_content,
));
$o .= paginate($a);
return $o;
} else if (($a->argc > 1) && ($a->argv[1] == 'network')) {
$notif_tpl = get_markup_template('notifications.tpl');
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`,
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`, `pitem`.`guid` as `pguid`
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND `pitem`.`parent` != 0 AND
`item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0 ORDER BY `item`.`created` DESC" ,
intval(local_user())
);
$tpl_item_likes = get_markup_template('notifications_likes_item.tpl');
$tpl_item_dislikes = get_markup_template('notifications_dislikes_item.tpl');
$tpl_item_friends = get_markup_template('notifications_friends_item.tpl');
$tpl_item_comments = get_markup_template('notifications_comments_item.tpl');
$tpl_item_posts = get_markup_template('notifications_posts_item.tpl');
$notif_content = '';
if ($r) {
foreach ($r as $it) {
switch($it['verb']){
case ACTIVITY_LIKE:
$notif_content .= replace_macros($tpl_item_likes,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created'])
));
break;
case ACTIVITY_DISLIKE:
$notif_content .= replace_macros($tpl_item_dislikes,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created'])
));
break;
case ACTIVITY_FRIEND:
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
$obj = parse_xml_string($xmlhead.$it['object']);
$it['fname'] = $obj->title;
$notif_content .= replace_macros($tpl_item_friends,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
'$item_when' => relative_date($it['created'])
));
break;
default:
$item_text = (($it['id'] == $it['parent'])
? sprintf( t("%s created a new post"), $it['author-name'])
: sprintf( t("%s commented on %s's post"), $it['author-name'], $it['pname']));
$tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments);
$notif_content .= replace_macros($tpl,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
'$item_text' => $item_text,
'$item_when' => relative_date($it['created'])
));
}
}
} else {
$notif_content = t('No more network notifications.');
}
$o .= replace_macros($notif_tpl, array(
'$notif_header' => t('Network Notifications'),
'$tabs' => $tabs,
'$notif_content' => $notif_content,
));
} else if (($a->argc > 1) && ($a->argv[1] == 'system')) {
$notif_tpl = get_markup_template('notifications.tpl');
$not_tpl = get_markup_template('notify.tpl');
require_once('include/bbcode.php');
$r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc",
intval(local_user())
);
if (count($r) > 0) {
foreach ($r as $it) {
$notif_content .= replace_macros($not_tpl,array(
'$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'],
'$item_image' => proxy_url($it['photo'], false, PROXY_SIZE_MICRO),
'$item_text' => strip_tags(bbcode($it['msg'])),
'$item_when' => relative_date($it['date'])
));
}
} else {
$notif_content .= t('No more system notifications.');
}
$o .= replace_macros($notif_tpl, array(
'$notif_header' => t('System Notifications'),
'$tabs' => $tabs,
'$notif_content' => $notif_content,
));
} else if (($a->argc > 1) && ($a->argv[1] == 'personal')) {
$notif_tpl = get_markup_template('notifications.tpl');
$myurl = $a->get_baseurl(true) . '/profile/'. $a->user['nickname'];
$myurl = substr($myurl,strpos($myurl,'://')+3);
$myurl = str_replace(array('www.','.'),array('','\\.'),$myurl);
$diasp_url = str_replace('/profile/','/u/',$myurl);
$sql_extra .= sprintf(" AND ( `item`.`author-link` regexp '%s' or `item`.`tag` regexp '%s' or `item`.`tag` regexp '%s' ) ",
dbesc($myurl . '$'),
dbesc($myurl . '\\]'),
dbesc($diasp_url . '\\]')
);
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`,
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`, `pitem`.`guid` as `pguid`
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1
$sql_extra
AND `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0 ORDER BY `item`.`created` DESC" ,
intval(local_user())
);
$tpl_item_likes = get_markup_template('notifications_likes_item.tpl');
$tpl_item_dislikes = get_markup_template('notifications_dislikes_item.tpl');
$tpl_item_friends = get_markup_template('notifications_friends_item.tpl');
$tpl_item_comments = get_markup_template('notifications_comments_item.tpl');
$tpl_item_posts = get_markup_template('notifications_posts_item.tpl');
$notif_content = '';
if (count($r) > 0) {
foreach ($r as $it) {
switch($it['verb']){
case ACTIVITY_LIKE:
$notif_content .= replace_macros($tpl_item_likes,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created'])
));
break;
case ACTIVITY_DISLIKE:
$notif_content .= replace_macros($tpl_item_dislikes,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created'])
));
break;
case ACTIVITY_FRIEND:
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
$obj = parse_xml_string($xmlhead.$it['object']);
$it['fname'] = $obj->title;
$notif_content .= replace_macros($tpl_item_friends,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
'$item_when' => relative_date($it['created'])
));
break;
default:
$item_text = (($it['id'] == $it['parent'])
? sprintf( t("%s created a new post"), $it['author-name'])
: sprintf( t("%s commented on %s's post"), $it['author-name'], $it['pname']));
$tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments);
$notif_content .= replace_macros($tpl,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'],
'$item_text' => $item_text,
'$item_when' => relative_date($it['created'])
));
}
}
} else {
$notif_content = t('No more personal notifications.');
}
$o .= replace_macros($notif_tpl, array(
'$notif_header' => t('Personal Notifications'),
'$tabs' => $tabs,
'$notif_content' => $notif_content,
));
} else if (($a->argc > 1) && ($a->argv[1] == 'home')) {
$notif_tpl = get_markup_template('notifications.tpl');
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`,
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`, `pitem`.`guid` as `pguid`
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND
`item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 1 ORDER BY `item`.`created` DESC",
intval(local_user())
);
$tpl_item_likes = get_markup_template('notifications_likes_item.tpl');
$tpl_item_dislikes = get_markup_template('notifications_dislikes_item.tpl');
$tpl_item_friends = get_markup_template('notifications_friends_item.tpl');
$tpl_item_comments = get_markup_template('notifications_comments_item.tpl');
$notif_content = '';
if (count($r) > 0) {
foreach ($r as $it) {
switch($it['verb']){
case ACTIVITY_LIKE:
$notif_content .= replace_macros($tpl_item_likes,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created'])
));
break;
case ACTIVITY_DISLIKE:
$notif_content .= replace_macros($tpl_item_dislikes,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created'])
));
break;
case ACTIVITY_FRIEND:
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
$obj = parse_xml_string($xmlhead.$it['object']);
$it['fname'] = $obj->title;
$notif_content .= replace_macros($tpl_item_friends,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
'$item_when' => relative_date($it['created'])
));
break;
default:
$notif_content .= replace_macros($tpl_item_comments,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s commented on %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created'])
));
}
}
} else {
$notif_content = t('No more home notifications.');
}
$o .= replace_macros($notif_tpl, array(
'$notif_header' => t('Home Notifications'),
'$tabs' => $tabs,
'$notif_content' => $notif_content,
));
}
$o .= paginate($a);
return $o;
}
return $tabs;
}

View File

@ -1,6 +1,6 @@
<?php
define('UPDATE_VERSION' , 1199);
define('UPDATE_VERSION' , 1200);
/**
*

View File

@ -1,67 +0,0 @@
<config>
<site>
<name>{{$config.site.name}}</name>
<server>{{$config.site.server}}</server>
<theme>default</theme>
<path></path>
<logo>{{$config.site.logo}}</logo>
<fancy>true</fancy>
<language>en</language>
<email>{{$config.site.email}}</email>
<broughtby></broughtby>
<broughtbyurl></broughtbyurl>
<timezone>UTC</timezone>
<closed>{{$config.site.closed}}</closed>
<inviteonly>false</inviteonly>
<private>{{$config.site.private}}</private>
<textlimit>{{$config.site.textlimit}}</textlimit>
<ssl>{{$config.site.ssl}}</ssl>
<sslserver>{{$config.site.sslserver}}</sslserver>
<shorturllength>30</shorturllength>
</site>
<license>
<type>cc</type>
<owner></owner>
<url>http://creativecommons.org/licenses/by/3.0/</url>
<title>Creative Commons Attribution 3.0</title>
<image>http://i.creativecommons.org/l/by/3.0/80x15.png</image>
</license>
<nickname>
<featured></featured>
</nickname>
<profile>
<biolimit></biolimit>
</profile>
<group>
<desclimit></desclimit>
</group>
<notice>
<contentlimit></contentlimit>
</notice>
<throttle>
<enabled>false</enabled>
<count>20</count>
<timespan>600</timespan>
</throttle>
<xmpp>
<enabled>false</enabled>
<server>INVALID SERVER</server>
<port>5222</port>
<user>update</user>
</xmpp>
<integration>
<source>StatusNet</source>
</integration>
<attachments>
<uploads>false</uploads>
<file_quota>0</file_quota>
</attachments>
</config>

View File

@ -1,6 +0,0 @@
{{* used in include/api.php 'api_statuses_friends' and 'api_statuses_followers' *}}
<users type="array">
{{foreach $users as $u}}
<user>{{include file="api_user_xml.tpl" user=$u}}</user>
{{/foreach}}
</users>

View File

@ -1,21 +0,0 @@
<photo>
<id>{{$photo.id}}</id>
<created>{{$photo.created}}</created>
<edited>{{$photo.edited}}</edited>
<title>{{$photo.title}}</title>
<desc>{{$photo.desc}}</desc>
<album>{{$photo.album}}</album>
<filename>{{$photo.filename}}</filename>
<type>{{$photo.type}}</type>
<height>{{$photo.height}}</height>
<width>{{$photo.width}}</width>
<datasize>{{$photo.datasize}}</datasize>
<profile>1</profile>
<links type="array">{{foreach $photo.link as $scale => $url}}
<link type="{{$photo.type}}" scale="{{$scale}}" href="{{$url}}" />
{{/foreach}}</links>
{{if $photo.data}}
<data encode="base64">{{$photo.data}}</data>
{{/if}}
</photo>

View File

@ -1,5 +0,0 @@
<photos type="array">
{{foreach $photos as $photo}}
<photo id="{{$photo.id}}" album="{{$photo.album}}" filename="{{$photo.filename}}" type="{{$photo.type}}">{{$photo.thumb}}</photo>
{{/foreach}}</photos>

View File

@ -1,7 +0,0 @@
<hash>
<remaining-hits type="integer">{{$hash.remaining_hits}}</remaining-hits>
<hourly-limit type="integer">{{$hash.hourly_limit}}</hourly-limit>
<reset-time type="datetime">{{$hash.reset_time}}</reset-time>
<reset_time_in_seconds type="integer">{{$hash.resettime_in_seconds}}</reset_time_in_seconds>
</hash>

View File

@ -1,25 +0,0 @@
{{* shared structure for statuses. includers must define root element *}}
<text>{{$status.text}}</text>
<truncated>{{$status.truncated}}</truncated>
<created_at>{{$status.created_at}}</created_at>
<in_reply_to_status_id>{{$status.in_reply_to_status_id}}</in_reply_to_status_id>
<source>{{$status.source}}</source>
<id>{{$status.id}}</id>
<in_reply_to_user_id>{{$status.in_reply_to_user_id}}</in_reply_to_user_id>
<in_reply_to_screen_name>{{$status.in_reply_to_screen_name}}</in_reply_to_screen_name>
<geo>{{$status.geo}}</geo>
<favorited>{{$status.favorited}}</favorited>
<user>{{include file="api_user_xml.tpl" user=$status.user}}</user>
<friendica:owner>{{include file="api_user_xml.tpl" user=$status.friendica_owner}}</friendica:owner>
<statusnet:html>{{$status.statusnet_html}}</statusnet:html>
<statusnet:conversation_id>{{$status.statusnet_conversation_id}}</statusnet:conversation_id>
<url>{{$status.url}}</url>
<coordinates>{{$status.coordinates}}</coordinates>
<place>{{$status.place}}</place>
<contributors>{{$status.contributors}}</contributors>
{{if $status.retweeted_status}}<retweeted_status>{{include file="api_single_status_xml.tpl" status=$status.retweeted_status}}</retweeted_status>{{/if}}
<friendica:activities>
{{foreach $status.friendica_activities as $k=>$v}}
<friendica:{{$k}}>{{$v|count}}</friendica:{{$k}}>
{{/foreach}}
</friendica:activities>

View File

@ -1,8 +0,0 @@
{{* used in api.php to return a single status *}}
<status
xmlns:statusnet="http://status.net/schema/api/1/"
xmlns:friendica="http://friendi.ca/schema/api/1/">
{{if $status}}
{{include file="api_single_status_xml.tpl" status=$status}}
{{/if}}
</status>

View File

@ -1,2 +0,0 @@
<ok>{{$ok}}</ok>

View File

@ -1,91 +0,0 @@
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:georss="http://www.georss.org/georss" xmlns:activity="http://activitystrea.ms/spec/1.0/" xmlns:media="http://purl.org/syndication/atommedia" xmlns:poco="http://portablecontacts.net/spec/1.0" xmlns:ostatus="http://ostatus.org/schema/1.0" xmlns:statusnet="http://status.net/schema/api/1/">
<generator uri="http://status.net" version="0.9.7">StatusNet</generator>
<id>{{$rss.self}}</id>
<title>Friendica</title>
<subtitle>Friendica API feed</subtitle>
<logo>{{$rss.logo}}</logo>
<updated>{{$rss.atom_updated}}</updated>
<link type="text/html" rel="alternate" href="{{$rss.alternate}}"/>
<link type="application/atom+xml" rel="self" href="{{$rss.self}}"/>
<author>
<activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type>
<uri>{{$user.url}}</uri>
<name>{{$user.name}}</name>
<link rel="alternate" type="text/html" href="{{$user.url}}"/>
<link rel="avatar" type="image/jpeg" media:width="106" media:height="106" href="{{$user.profile_image_url}}"/>
<link rel="avatar" type="image/jpeg" media:width="96" media:height="96" href="{{$user.profile_image_url}}"/>
<link rel="avatar" type="image/jpeg" media:width="48" media:height="48" href="{{$user.profile_image_url}}"/>
<link rel="avatar" type="image/jpeg" media:width="24" media:height="24" href="{{$user.profile_image_url}}"/>
<georss:point></georss:point>
<poco:preferredUsername>{{$user.screen_name}}</poco:preferredUsername>
<poco:displayName>{{$user.name}}</poco:displayName>
<poco:urls>
<poco:type>homepage</poco:type>
<poco:value>{{$user.url}}</poco:value>
<poco:primary>true</poco:primary>
</poco:urls>
<statusnet:profile_info local_id="{{$user.id}}"></statusnet:profile_info>
</author>
<!--Deprecation warning: activity:subject is present only for backward compatibility. It will be removed in the next version of StatusNet.-->
<activity:subject>
<activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type>
<id>{{$user.contact_url}}</id>
<title>{{$user.name}}</title>
<link rel="alternate" type="text/html" href="{{$user.url}}"/>
<link rel="avatar" type="image/jpeg" media:width="106" media:height="106" href="{{$user.profile_image_url}}"/>
<link rel="avatar" type="image/jpeg" media:width="96" media:height="96" href="{{$user.profile_image_url}}"/>
<link rel="avatar" type="image/jpeg" media:width="48" media:height="48" href="{{$user.profile_image_url}}"/>
<link rel="avatar" type="image/jpeg" media:width="24" media:height="24" href="{{$user.profile_image_url}}"/>
<poco:preferredUsername>{{$user.screen_name}}</poco:preferredUsername>
<poco:displayName>{{$user.name}}</poco:displayName>
<poco:urls>
<poco:type>homepage</poco:type>
<poco:value>{{$user.url}}</poco:value>
<poco:primary>true</poco:primary>
</poco:urls>
<statusnet:profile_info local_id="{{$user.id}}"></statusnet:profile_info>
</activity:subject>
{{foreach $statuses as $status}}
<entry>
<activity:object-type>{{$status.objecttype}}</activity:object-type>
<id>{{$status.message_id}}</id>
<title>{{$status.text}}</title>
<content type="html">{{$status.statusnet_html}}</content>
<link rel="alternate" type="text/html" href="{{$status.url}}"/>
<activity:verb>{{$status.verb}}</activity:verb>
<published>{{$status.published}}</published>
<updated>{{$status.updated}}</updated>
<link rel="self" type="application/atom+xml" href="{{$status.self}}"/>
<link rel="edit" type="application/atom+xml" href="{{$status.edit}}"/>
<statusnet:notice_info local_id="{{$status.id}}" source="{{$status.source}}" >
</statusnet:notice_info>
<author>
<activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type>
<uri>{{$status.user.url}}</uri>
<name>{{$status.user.name}}</name>
<link rel="alternate" type="text/html" href="{{$status.user.url}}"/>
<link rel="avatar" type="image/jpeg" media:width="48" media:height="48" href="{{$status.user.profile_image_url}}"/>
<georss:point/>
<poco:preferredUsername>{{$status.user.screen_name}}</poco:preferredUsername>
<poco:displayName>{{$status.user.name}}</poco:displayName>
<poco:address/>
<poco:urls>
<poco:type>homepage</poco:type>
<poco:value>{{$status.user.url}}</poco:value>
<poco:primary>true</poco:primary>
</poco:urls>
</author>
<link rel="ostatus:conversation" type="text/html" href="{{$status.url}}"/>
</entry>
{{/foreach}}
</feed>

View File

@ -1,27 +0,0 @@
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:georss="http://www.georss.org/georss" xmlns:twitter="http://api.twitter.com">
<channel>
<title>Friendica</title>
<link>{{$rss.alternate}}</link>
<atom:link type="application/rss+xml" rel="self" href="{{$rss.self}}"/>
<description>Friendica timeline</description>
<language>{{$rss.language}}</language>
<ttl>40</ttl>
<image>
<link>{{$user.link}}</link>
<title>{{$user.name}}'s items</title>
<url>{{$user.profile_image_url}}</url>
</image>
{{foreach $statuses as $status}}
<item>
<title>{{$status.user.name}}: {{$status.text}}</title>
<description>{{$status.text}}</description>
<pubDate>{{$status.created_at}}</pubDate>
<guid>{{$status.url}}</guid>
<link>{{$status.url}}</link>
<twitter:source>{{$status.source}}</twitter:source>
</item>
{{/foreach}}
</channel>
</rss>

View File

@ -1,10 +0,0 @@
<statuses type="array"
xmlns:statusnet="http://status.net/schema/api/1/"
xmlns:friendica="http://friendi.ca/schema/api/1/">
{{foreach $statuses as $status}}
<status>
{{include file="api_single_status_xml.tpl" status=$status}}
</status>
{{/foreach}}
</statuses>

View File

@ -1,47 +0,0 @@
{{* includer template MUST provide root element *}}
<id>{{$user.id}}</id>
<name>{{$user.name}}</name>
<screen_name>{{$user.screen_name}}</screen_name>
<location>{{$user.location}}</location>
<description>{{$user.description}}</description>
<profile_image_url>{{$user.profile_image_url}}</profile_image_url>
<url>{{$user.url}}</url>
<protected>{{$user.protected}}</protected>
<followers_count>{{$user.followers_count}}</followers_count>
<friends_count>{{$user.friends_count}}</friends_count>
<created_at>{{$user.created_at}}</created_at>
<favourites_count>{{$user.favourites_count}}</favourites_count>
<utc_offset>{{$user.utc_offset}}</utc_offset>
<time_zone>{{$user.time_zone}}</time_zone>
<statuses_count>{{$user.statuses_count}}</statuses_count>
<following>{{$user.following}}</following>
<profile_background_color>{{$user.profile_background_color}}</profile_background_color>
<profile_text_color>{{$user.profile_text_color}}</profile_text_color>
<profile_link_color>{{$user.profile_link_color}}</profile_link_color>
<profile_sidebar_fill_color>{{$user.profile_sidebar_fill_color}}</profile_sidebar_fill_color>
<profile_sidebar_border_color>{{$user.profile_sidebar_border_color}}</profile_sidebar_border_color>
<profile_background_image_url>{{$user.profile_background_image_url}}</profile_background_image_url>
<profile_background_tile>{{$user.profile_background_tile}}</profile_background_tile>
<profile_use_background_image>{{$user.profile_use_background_image}}</profile_use_background_image>
<notifications>{{$user.notifications}}</notifications>
<geo_enabled>{{$user.geo_enabled}}</geo_enabled>
<verified>{{$user.verified}}</verified>
<lang>{{$user.lang}}</lang>
<contributors_enabled>{{$user.contributors_enabled}}</contributors_enabled>
<status>{{if $user.status}}
<created_at>{{$user.status.created_at}}</created_at>
<id>{{$user.status.id}}</id>
<text>{{$user.status.text}}</text>
<source>{{$user.status.source}}</source>
<truncated>{{$user.status.truncated}}</truncated>
<in_reply_to_status_id>{{$user.status.in_reply_to_status_id}}</in_reply_to_status_id>
<in_reply_to_user_id>{{$user.status.in_reply_to_user_id}}</in_reply_to_user_id>
<favorited>{{$user.status.favorited}}</favorited>
<in_reply_to_screen_name>{{$user.status.in_reply_to_screen_name}}</in_reply_to_screen_name>
<geo>{{$user.status.geo}}</geo>
<coordinates>{{$user.status.coordinates}}</coordinates>
<place>{{$user.status.place}}</place>
<contributors>{{$user.status.contributors}}</contributors>
{{/if}}</status>

View File

@ -4,12 +4,12 @@
<p class="intro-desc">{{$str_notifytype}} {{$notify_type}}</p>
<img id="photo-{{$contact_id}}" class="intro-photo" src="{{$photo}}" width="175" height=175" title="{{$fullname|escape:'html'}}" alt="{{$fullname|escape:'html'}}" />
<dl><dt>{{$url_label}}</dt><dd><a target="blank" href="{{$zrl}}">{{$url}}</a></dd></dl>
{{if $location}}<dl><dt>{{$location_label}}</dt><dd>{{$location}}</dd></dl>{{/if}}
{{if $gender}}<dl><dt>{{$gender_label}}</dt><dd>{{$gender}}</dd></dl>{{/if}}
{{if $keywords}}<dl><dt>{{$keywords_label}}</dt><dd>{{$keywords}}</dd></dl>{{/if}}
{{if $about}}<dl><dt>{{$about_label}}</dt><dd>{{$about}}</dd></dl>{{/if}}
<div class="intro-knowyou">{{$knowyou}}</div>
<dl><dt>{{$lbl_url}}</dt><dd><a target="blank" href="{{$zrl}}">{{$url}}</a></dd></dl>
{{if $location}}<dl><dt>{{$lbl_location}}</dt><dd>{{$location}}</dd></dl>{{/if}}
{{if $gender}}<dl><dt>{{$lbl_gender}}</dt><dd>{{$gender}}</dd></dl>{{/if}}
{{if $keywords}}<dl><dt>{{$lbl_keywords}}</dt><dd>{{$keywords}}</dd></dl>{{/if}}
{{if $about}}<dl><dt>{{$lbl_about}}</dt><dd>{{$about}}</dd></dl>{{/if}}
<div class="intro-knowyou">{{$lbl_knowyou}} {{$knowyou}}</div>
<div class="intro-note" id="intro-note-{{$contact_id}}">{{$note}}</div>
<div class="intro-wrapper-end" id="intro-wrapper-end-{{$contact_id}}"></div>
<form class="intro-form" action="notifications/{{$intro_id}}" method="post">

View File

@ -5,5 +5,18 @@
{{if $tabs }}{{include file="common_tabs.tpl"}}{{/if}}
<div class="notif-network-wrapper">
{{$notif_content}}
{{* The "show ignored" link *}}
{{if $notif_ignored_lnk}}{{$notif_ignored_lnk}}{{/if}}
{{* The notifications *}}
{{if $notif_content}}
{{foreach $notif_content as $notification}}
{{$notification}}
{{/foreach}}
{{/if}}
{{* If no notifications messages available *}}
{{if $notif_nocontent}}
<div class="notif_nocontent">{{$notif_nocontent}}</div>
{{/if}}
</div>

View File

@ -1798,7 +1798,7 @@ ul.dropdown-menu li:hover {
.suggest-content-wrapper, .common-content-wrapper,
.allfriends-content-wrapper, .match-content-wrapper, .dirfind-content-wrapper,
.directory-content-wrapper, .manage-content-wrapper, .notes-content-wrapper,
.message-content-wrapper, .apps-content-wrapper, .notifications-content-wrapper,
.message-content-wrapper, .apps-content-wrapper,
.admin-content-wrapper, .group-content-wrapper, .viewcontacts-content-wrapper {
min-height: calc(100vh - 150px);
padding: 15px;
@ -2157,6 +2157,54 @@ td.fc-day {
.group {
margin-left: 20px;
}
/* Notifications */
ul.notif-network-list {
margin-left: -15px;
margin-right: -15px;
}
ul.notif-network-list > li {
padding-left: 15px;
padding-right: 15px;
}
.intro-wrapper.media {
overflow: visible;
word-wrap: break-word;
margin-top: 0;
}
.intro-photo-wrapper img.intro-photo {
height:80px;
width: 80px;
border-radius: 4px;
}
.intro-actions {
display: flex;
}
.intro-enty-name h4 {
font-size: 15px !important;
}
.intro-wrapper button.intro-action-link {
opacity: 0.1;
transition: all 0.25s ease-in-out;
}
.intro-wrapper button.intro-action-link,
.intro-wrapper button.intro-action-link:hover {
padding-right: 5px;
padding-left: 5px;
color: #555;
}
ul li:hover .intro-wrapper button.intro-action-link {
opacity: 0.8;
transition: all 0.25s ease-in-out;
}
ul li:hover .intro-wrapper button.intro-action-link:hover {
opacity: 1;
}
.intro-desc-label, .intro-url-label, .intro-network-label,
.intro-location-label, .intro-gender-label, .intro-keywords-label,
.intro-about-label, .intro-knowyou-label {
font-weight: bold;
}
/*
* Overwriting for transparency and other colors
*/

View File

@ -204,6 +204,19 @@ function addToModal(url) {
});
}
// Add a element (by it's id) to a bootstrap modal
function addElmToModal(id) {
var elm = $(id).html();
var modal = $('#modal').modal();
modal
.find('#modal-body')
.append(elm)
.modal.show;
loadModalTitle();
}
// function to load the html from the edit post page into
// the jot modal
function editpost(url) {

View File

@ -0,0 +1,54 @@
<div class="intro-wrapper media" id="intro-{{$contact_id}}" >
{{* Contact Photo *}}
<div class="intro-photo-wrapper dropdown pull-left" >
<img id="photo-{{$contact_id}}" class="intro-photo media-object" src="{{$photo}}" title="{{$fullname|escape:'html'}}" alt="{{$fullname|escape:'html'}}" />
</div>
<div class="media-body">
{{* The intro actions like approve, ignore, discard intro*}}
<div class="intro-actions pull-right nav-pills preferences hidden-xs">
<button class="btn-link intro-action-link" onclick="addElmToModal('#intro-approve-wrapper-{{$contact_id}}')"><i class="fa fa-check" aria-hidden="true"></i></button>
<form class="intro-form" action="notifications/{{$intro_id}}" method="post">
<button class="btn-link intro-submit-ignore intro-action-link" type="submit" name="submit" value="{{$ignore|escape:'html'}}"><i class="fa fa-ban" aria-hidden="true"></i></button>
<button class="btn-link intro-submit-discard intro-action-link" type="submit" name="submit" value="{{$discard|escape:'html'}}"><i class="fa fa-trash-o" aria-hidden="true"></i></button>
</form>
</div>
<div class='intro-enty-name'><h4 class="media-heading"><a href="{{$zrl}}">{{$fullname}}</a></h4></div>
<div class="intro-desc"><span class="intro-desc-label">{{$str_notifytype}}</span>{{$notify_type}}</div>
{{* Additional information of the contact *}}
<div class="intro-url"><span class="intro-url-label">{{$lbl_url}}:&nbsp;</span><a href="{{$zrl}}">{{$url}}</a></div>
{{if $network}}<div class="intro-network"><span class="intro-network-label">{{$lbl_network}}</span>&nbsp;{{$network}}</div>{{/if}}
{{if $location}}<div class="intro-location"><span class="intro-location-label">{{$lbl_location}}</span>&nbsp;{{$location}}</div>{{/if}}
{{if $gender}}<div class="intro-gender"><span class="intro-gender-label">{{$lbl_gender}}</span>&nbsp;{{$gender}}</div>{{/if}}
{{if $keywords}}<div class="intro-keywords"><span class="intro-keywords-label">{{$lbl_keywords}}</span>&nbsp;{{$keywords}}</div>{{/if}}
{{if $about}}<div class="intro-about"><span class="intro-about-label">{{$lbl_about}}</span>&nbsp;{{$about}}</div>{{/if}}
<div class="intro-knowyou"><span class="intro-knowyou-label">{{$lbl_knowyou}}</span>{{$knowyou}}</div>
<div class="intro-note" id="intro-note-{{$contact_id}}">{{$note}}</div>
{{* This sections contains special settings for contact approval. We hide it by default and load this section in
a bootstrap modal in the case of approval *}}
<div id="intro-approve-wrapper-{{$contact_id}}" style="display: none;">
<h3 class="heading">{{$fullname}}{{if $addr}}&nbsp;({{$addr}}){{/if}}</h3>
<form class="intro-approve-form" action="dfrn_confirm" method="post">
{{include file="field_checkbox.tpl" field=$hidden}}
{{include file="field_checkbox.tpl" field=$activity}}
<input type="hidden" name="dfrn_id" value="{{$dfrn_id}}" >
<input type="hidden" name="intro_id" value="{{$intro_id}}" >
<input type="hidden" name="contact_id" value="{{$contact_id}}" >
{{$dfrn_text}}
<div class="pull-right">
<button class="btn btn-default intro-submit-approve" type="submit" name="submit" value="{{$approve|escape:'html'}}">{{$approve|escape:'html'}}</button>
</div>
<div class="clear"></div>
</form>
</div>
</div>
</div>
<div class="intro-end"></div>

View File

@ -0,0 +1,25 @@
<div class="generic-page-wrapper">
{{include file="section_title.tpl" title=$notif_header}}
{{if $tabs }}{{include file="common_tabs.tpl"}}{{/if}}
<div class="notif-network-wrapper">
{{* The "show ignored" link *}}
{{if $notif_ignored_lnk}}{{$notif_ignored_lnk}}{{/if}}
{{* The notifications *}}
{{if $notif_content}}
<ul class="notif-network-list media-list">
{{foreach $notif_content as $notification}}
<li>{{$notification}}</li>
{{/foreach}}
</ul>
{{/if}}
{{* If no notifications messages available *}}
{{if $notif_nocontent}}
<div class="notif_nocontent">{{$notif_nocontent}}</div>
{{/if}}
</div>
</div>