aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorVasudev Kamath <kamathvasudev@gmail.com>2012-05-05 20:48:16 +0530
committerVasudev Kamath <kamathvasudev@gmail.com>2012-05-05 20:48:16 +0530
commitb5e857c0e7ccf4ef3d33e5b6d0a4325b693a8e80 (patch)
tree74234775d723e33378059f2fa45fa80e3bc6ac43 /mod
parent214ec91a3f2c5fec6cced93f669b3a9725f0e40a (diff)
parent8ae83201cf8f3c943972a8f246b7972aa640afb4 (diff)
downloadvolse-hubzilla-b5e857c0e7ccf4ef3d33e5b6d0a4325b693a8e80.tar.gz
volse-hubzilla-b5e857c0e7ccf4ef3d33e5b6d0a4325b693a8e80.tar.bz2
volse-hubzilla-b5e857c0e7ccf4ef3d33e5b6d0a4325b693a8e80.zip
Merge branch 'master' of git://github.com/friendica/friendica
Diffstat (limited to 'mod')
-rw-r--r--mod/acl.php8
-rw-r--r--mod/admin.php74
-rw-r--r--mod/common.php77
-rw-r--r--mod/contacts.php56
-rw-r--r--mod/dfrn_confirm.php81
-rw-r--r--mod/dfrn_request.php8
-rw-r--r--mod/events.php30
-rw-r--r--mod/filerm.php8
-rw-r--r--mod/friendica.php23
-rw-r--r--mod/item.php38
-rw-r--r--mod/network.php7
-rw-r--r--mod/profile.php10
-rw-r--r--mod/profiles.php66
-rw-r--r--mod/settings.php6
-rw-r--r--mod/tagger.php8
-rw-r--r--mod/viewcontacts.php4
16 files changed, 435 insertions, 69 deletions
diff --git a/mod/acl.php b/mod/acl.php
index c23ee1a67..88f150d7a 100644
--- a/mod/acl.php
+++ b/mod/acl.php
@@ -33,7 +33,7 @@ function acl_init(&$a){
if ($type=='' || $type=='c'){
$r = q("SELECT COUNT(`id`) AS c FROM `contact`
WHERE `uid` = %d AND `self` = 0
- AND `blocked` = 0 AND `pending` = 0
+ AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0
AND `notify` != '' $sql_extra2" ,
intval(local_user())
);
@@ -45,7 +45,7 @@ function acl_init(&$a){
$r = q("SELECT COUNT(`id`) AS c FROM `contact`
WHERE `uid` = %d AND `self` = 0
- AND `blocked` = 0 AND `pending` = 0
+ AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0
AND `network` IN ('%s','%s','%s') $sql_extra2" ,
intval(local_user()),
dbesc(NETWORK_DFRN),
@@ -94,7 +94,7 @@ function acl_init(&$a){
if ($type=='' || $type=='c'){
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact`
- WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `notify` != ''
+ WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != ''
$sql_extra2
ORDER BY `name` ASC ",
intval(local_user())
@@ -102,7 +102,7 @@ function acl_init(&$a){
}
elseif($type == 'm') {
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact`
- WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0
+ WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0
AND `network` IN ('%s','%s','%s')
$sql_extra2
ORDER BY `name` ASC ",
diff --git a/mod/admin.php b/mod/admin.php
index cdc45c8e3..cfe5a2dd2 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -61,6 +61,9 @@ function admin_post(&$a){
case 'logs':
admin_page_logs_post($a);
break;
+ case 'dbsync':
+ admin_page_dbsync_post($a);
+ break;
case 'update':
admin_page_remoteupdate_post($a);
break;
@@ -94,7 +97,8 @@ function admin_content(&$a) {
'users' => Array($a->get_baseurl(true)."/admin/users/", t("Users") , "users"),
'plugins'=> Array($a->get_baseurl(true)."/admin/plugins/", t("Plugins") , "plugins"),
'themes' => Array($a->get_baseurl(true)."/admin/themes/", t("Themes") , "themes"),
- 'update' => Array($a->get_baseurl(true)."/admin/update/", t("Update") , "update")
+ 'dbsync' => Array($a->get_baseurl(true)."/admin/dbsync/", t('DB updates'), "dbsync"),
+ 'update' => Array($a->get_baseurl(true)."/admin/update/", t("Software Update") , "update")
);
/* get plugins admin page */
@@ -142,6 +146,9 @@ function admin_content(&$a) {
case 'logs':
$o = admin_page_logs($a);
break;
+ case 'dbsync':
+ $o = admin_page_dbsync($a);
+ break;
case 'update':
$o = admin_page_remoteupdate($a);
break;
@@ -235,6 +242,8 @@ function admin_page_site_post(&$a){
$proxyuser = ((x($_POST,'proxyuser')) ? notags(trim($_POST['proxyuser'])) : '');
$proxy = ((x($_POST,'proxy')) ? notags(trim($_POST['proxy'])) : '');
$timeout = ((x($_POST,'timeout')) ? intval(trim($_POST['timeout'])) : 60);
+ $delivery_interval = ((x($_POST,'delivery_interval'))? intval(trim($_POST['delivery_interval'])) : 0);
+ $maxloadavg = ((x($_POST,'maxloadavg')) ? intval(trim($_POST['maxloadavg'])) : 50);
$dfrn_only = ((x($_POST,'dfrn_only')) ? True : False);
$ostatus_disabled = !((x($_POST,'ostatus_disabled')) ? True : False);
$diaspora_enabled = ((x($_POST,'diaspora_enabled')) ? True : False);
@@ -281,7 +290,8 @@ function admin_page_site_post(&$a){
}
}
set_config('system','ssl_policy',$ssl_policy);
-
+ set_config('system','delivery_interval',$delivery_interval);
+ set_config('system','maxloadavg',$maxloadavg);
set_config('config','sitename',$sitename);
if ($banner==""){
// don't know why, but del_config doesn't work...
@@ -425,7 +435,8 @@ function admin_page_site(&$a) {
'$proxyuser' => array('proxyuser', t("Proxy user"), get_config('system','proxyuser'), ""),
'$proxy' => array('proxy', t("Proxy URL"), get_config('system','proxy'), ""),
'$timeout' => array('timeout', t("Network timeout"), (x(get_config('system','curl_timeout'))?get_config('system','curl_timeout'):60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")),
-
+ '$delivery_interval' => array('delivery_interval', t("Delivery interval"), (x(get_config('system','delivery_interval'))?get_config('system','delivery_interval'):2), t("Delay background delivery processes by this many seconds to reduce system load. Recommend: 4-5 for shared hosts, 2-3 for virtual private servers. 0-1 for large dedicated servers.")),
+ '$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
'$form_security_token' => get_form_security_token("admin_site"),
));
@@ -433,6 +444,62 @@ function admin_page_site(&$a) {
}
+function admin_page_dbsync(&$a) {
+
+ $o = '';
+
+ if($a->argc > 3 && intval($a->argv[3]) && $a->argv[2] === 'mark') {
+ set_config('database', 'update_' . intval($a->argv[3]), 'success');
+ info( t('Update has been marked successful') . EOL);
+ goaway($a->get_baseurl(true) . '/admin/dbsync');
+ }
+
+ if($a->argc > 2 && intval($a->argv[2])) {
+ require_once('update.php');
+ $func = 'update_' . intval($a->argv[2]);
+ if(function_exists($func)) {
+ $retval = $func();
+ if($retval === UPDATE_FAILED) {
+ $o .= sprintf( t('Executing %s failed. Check system logs.'), $func);
+ }
+ elseif($retval === UPDATE_SUCCESS) {
+ $o .= sprintf( t('Update %s was successfully applied.', $func));
+ set_config('database',$func, 'success');
+ }
+ else
+ $o .= sprintf( t('Update %s did not return a status. Unknown if it succeeded.'), $func);
+ }
+ else
+ $o .= sprintf( t('Update function %s could not be found.'), $func);
+ return $o;
+ }
+
+ $failed = array();
+ $r = q("select * from config where `cat` = 'database' ");
+ if(count($r)) {
+ foreach($r as $rr) {
+ $upd = intval(substr($rr['k'],7));
+ if($upd < 1139 || $rr['v'] === 'success')
+ continue;
+ $failed[] = $upd;
+ }
+ }
+ if(! count($failed))
+ return '<h3>' . t('No failed updates.') . '</h3>';
+
+ $o = replace_macros(get_markup_template('failed_updates.tpl'),array(
+ '$base' => $a->get_baseurl(true),
+ '$banner' => t('Failed Updates'),
+ '$desc' => t('This does not include updates prior to 1139, which did not return a status.'),
+ '$mark' => t('Mark success (if update was manually applied)'),
+ '$apply' => t('Attempt to execute this update step automatically'),
+ '$failed' => $failed
+ ));
+
+ return $o;
+
+}
+
/**
* Users admin page
*
@@ -977,7 +1044,6 @@ readable.");
$size = 5000000;
$seek = fseek($fp,0-$size,SEEK_END);
if($seek === 0) {
- fgets($fp); // throw away the first partial line
$data = escape_tags(fread($fp,$size));
while(! feof($fp))
$data .= escape_tags(fread($fp,4096));
diff --git a/mod/common.php b/mod/common.php
index 852388c14..617b5b670 100644
--- a/mod/common.php
+++ b/mod/common.php
@@ -5,25 +5,33 @@ require_once('include/socgraph.php');
function common_content(&$a) {
$o = '';
- if(! local_user()) {
- notice( t('Permission denied.') . EOL);
- return;
- }
- if($a->argc > 1)
- $cid = intval($a->argv[1]);
- if(! $cid)
+ $cmd = $a->argv[1];
+ $uid = intval($a->argv[2]);
+ $cid = intval($a->argv[3]);
+ $zcid = 0;
+
+ if($cmd !== 'loc' && $cmd != 'rem')
+ return;
+ if(! $uid)
return;
- $c = q("select name, url, photo from contact where id = %d and uid = %d limit 1",
- intval($cid),
- intval(local_user())
- );
+ if($cmd === 'loc' && $cid) {
+ $c = q("select name, url, photo from contact where id = %d and uid = %d limit 1",
+ intval($cid),
+ intval($uid)
+ );
+ }
+ else {
+ $c = q("select name, url, photo from contact where self = 1 and uid = %d limit 1",
+ intval($uid)
+ );
+ }
$a->page['aside'] .= '<div class="vcard">'
. '<div class="fn label">' . $c[0]['name'] . '</div>'
. '<div id="profile-photo-wrapper">'
- . '<a href="/contacts/' . $cid . '"><img class="photo" width="175" height="175"
+ . '<img class="photo" width="175" height="175"
src="' . $c[0]['photo'] . '" alt="' . $c[0]['name'] . '" /></div>'
. '</div>';
@@ -33,13 +41,52 @@ function common_content(&$a) {
$o .= '<h2>' . t('Common Friends') . '</h2>';
-// $o .= '<h3>' . sprintf( t('You and %s'),$c[0]['name']) . '</h3>';
+ if(! $cid) {
+ if(get_my_url()) {
+ $r = q("select id from contact where nurl = '%s' and uid = %d limit 1",
+ dbesc(normalise_link(get_my_url())),
+ intval($profile_uid)
+ );
+ if(count($r))
+ $cid = $r[0]['id'];
+ else {
+ $r = q("select id from gcontact where nurl = '%s' limit 1",
+ dbesc(normalise_link(get_my_url()))
+ );
+ if(count($r))
+ $zcid = $r[0]['id'];
+ }
+ }
+ }
+
+
+
+ if($cid == 0 && $zcid == 0)
+ return;
+
+
+ if($cid)
+ $t = count_common_friends($uid,$cid);
+ else
+ $t = count_common_friends_zcid($uid,$zcid);
+
+
+ $a->set_pager_total($t);
+
+ if(! $t) {
+ notice( t('No contacts in common.') . EOL);
+ return $o;
+ }
+
+
+ if($cid)
+ $r = common_friends($uid,$cid);
+ else
+ $r = common_friends_zcid($uid,$zcid);
- $r = common_friends(local_user(),$cid);
if(! count($r)) {
- $o .= t('No friends in common.');
return $o;
}
diff --git a/mod/contacts.php b/mod/contacts.php
index 8670c0c80..769239fe0 100644
--- a/mod/contacts.php
+++ b/mod/contacts.php
@@ -182,6 +182,22 @@ function contacts_content(&$a) {
return; // NOTREACHED
}
+
+ if($cmd === 'archive') {
+ $archived = (($orig_record[0]['archive']) ? 0 : 1);
+ $r = q("UPDATE `contact` SET `archive` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($archived),
+ intval($contact_id),
+ intval(local_user())
+ );
+ if($r) {
+ //notice( t('Contact has been ') . (($archived) ? t('archived') : t('unarchived')) . EOL );
+ info( (($archived) ? t('Contact has been archived') : t('Contact has been unarchived')) . EOL );
+ }
+ goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
+ return; // NOTREACHED
+ }
+
if($cmd === 'drop') {
require_once('include/Contact.php');
@@ -274,16 +290,26 @@ function contacts_content(&$a) {
'label' => (($contact['blocked']) ? t('Unblock') : t('Block') ),
'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/block',
'sel' => '',
+ 'title' => t('Toggle Blocked status'),
),
array(
'label' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ),
'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/ignore',
'sel' => '',
+ 'title' => t('Toggle Ignored status'),
+ ),
+
+ array(
+ 'label' => (($contact['archive']) ? t('Unarchive') : t('Archive') ),
+ 'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/archive',
+ 'sel' => '',
+ 'title' => t('Toggle Archive status'),
),
array(
'label' => t('Repair'),
'url' => $a->get_baseurl(true) . '/crepair/' . $contact_id,
'sel' => '',
+ 'title' => t('Advanced Contact Settings'),
)
);
$tab_tpl = get_markup_template('common_tabs.tpl');
@@ -299,7 +325,7 @@ function contacts_content(&$a) {
'$lbl_info1' => t('Contact Information / Notes'),
'$infedit' => t('Edit contact notes'),
'$common_text' => $common_text,
- '$common_link' => $a->get_baseurl(true) . '/common/' . $contact['id'],
+ '$common_link' => $a->get_baseurl(true) . '/common/loc/' . local_user() . '/' . $contact['id'],
'$all_friends' => $all_friends,
'$relation_text' => $relation_text,
'$visit' => sprintf( t('Visit %s\'s profile [%s]'),$contact['name'],$contact['url']),
@@ -324,6 +350,7 @@ function contacts_content(&$a) {
'$info' => $contact['info'],
'$blocked' => (($contact['blocked']) ? t('Currently blocked') : ''),
'$ignored' => (($contact['readonly']) ? t('Currently ignored') : ''),
+ '$archived' => (($contact['archive']) ? t('Currently archived') : ''),
'$hidden' => array('hidden', t('Hide this contact from others'), ($contact['hidden'] == 1), t('Replies/likes to your public posts <strong>may</strong> still be visible')),
'$photo' => $contact['photo'],
'$name' => $contact['name'],
@@ -365,6 +392,10 @@ function contacts_content(&$a) {
$sql_extra = " AND `readonly` = 1 ";
$ignored = true;
}
+ elseif(($a->argc == 2) && ($a->argv[1] === 'archived')) {
+ $sql_extra = " AND `archive` = 1 ";
+ $archived = true;
+ }
else
$sql_extra = " AND `blocked` = 0 ";
@@ -376,34 +407,47 @@ function contacts_content(&$a) {
'label' => t('Suggestions'),
'url' => $a->get_baseurl(true) . '/suggest',
'sel' => '',
+ 'title' => t('Suggest potential friends'),
),
array(
'label' => t('All Contacts'),
'url' => $a->get_baseurl(true) . '/contacts/all',
'sel' => ($all) ? 'active' : '',
+ 'title' => t('Show all contacts'),
),
array(
- 'label' => t('Unblocked Contacts'),
+ 'label' => t('Unblocked'),
'url' => $a->get_baseurl(true) . '/contacts',
- 'sel' => ((! $all) && (! $blocked) && (! $hidden) && (! $search) && (! $nets) && (! $ignored)) ? 'active' : '',
+ 'sel' => ((! $all) && (! $blocked) && (! $hidden) && (! $search) && (! $nets) && (! $ignored) && (! $archived)) ? 'active' : '',
+ 'title' => t('Only show unblocked contacts'),
),
array(
- 'label' => t('Blocked Contacts'),
+ 'label' => t('Blocked'),
'url' => $a->get_baseurl(true) . '/contacts/blocked',
'sel' => ($blocked) ? 'active' : '',
+ 'title' => t('Only show blocked contacts'),
),
array(
- 'label' => t('Ignored Contacts'),
+ 'label' => t('Ignored'),
'url' => $a->get_baseurl(true) . '/contacts/ignored',
'sel' => ($ignored) ? 'active' : '',
+ 'title' => t('Only show ignored contacts'),
+ ),
+
+ array(
+ 'label' => t('Archived'),
+ 'url' => $a->get_baseurl(true) . '/contacts/archived',
+ 'sel' => ($archived) ? 'active' : '',
+ 'title' => t('Only show archived contacts'),
),
array(
- 'label' => t('Hidden Contacts'),
+ 'label' => t('Hidden'),
'url' => $a->get_baseurl(true) . '/contacts/hidden',
'sel' => ($hidden) ? 'active' : '',
+ 'title' => t('Only show hidden contacts'),
),
);
diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php
index efb5be3a4..2b25095fd 100644
--- a/mod/dfrn_confirm.php
+++ b/mod/dfrn_confirm.php
@@ -207,7 +207,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
if($duplex == 1)
$params['duplex'] = 1;
- if($user['page-flags'] == PAGE_COMMUNITY)
+ if($user[0]['page-flags'] == PAGE_COMMUNITY)
$params['page'] = 1;
logger('dfrn_confirm: Confirm: posting data to ' . $dfrn_confirm . ': ' . print_r($params,true), LOGGER_DATA);
@@ -434,7 +434,8 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
else
$contact = null;
- if(isset($new_relation) && $new_relation == CONTACT_IS_FRIEND) {
+
+ if((isset($new_relation) && $new_relation == CONTACT_IS_FRIEND)) {
if(($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
require_once('include/diaspora.php');
@@ -447,7 +448,8 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$r = q("SELECT `hide-friends` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
intval($uid)
);
- if((count($r)) && ($activity) && (! $hidden)) {
+
+ if((count($r)) && ($r[0]['hide-friends'] == 0) && ($activity) && (! $hidden)) {
require_once('include/items.php');
@@ -468,12 +470,15 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$arr['author-name'] = $arr['owner-name'] = $self[0]['name'];
$arr['author-link'] = $arr['owner-link'] = $self[0]['url'];
$arr['author-avatar'] = $arr['owner-avatar'] = $self[0]['thumb'];
- $arr['verb'] = ACTIVITY_FRIEND;
- $arr['object-type'] = ACTIVITY_OBJ_PERSON;
-
+
$A = '[url=' . $self[0]['url'] . ']' . $self[0]['name'] . '[/url]';
+ $APhoto = '[url=' . $self[0]['url'] . ']' . '[img]' . $self[0]['thumb'] . '[/img][/url]';
+
$B = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
$BPhoto = '[url=' . $contact['url'] . ']' . '[img]' . $contact['thumb'] . '[/img][/url]';
+
+ $arr['verb'] = ACTIVITY_FRIEND;
+ $arr['object-type'] = ACTIVITY_OBJ_PERSON;
$arr['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$BPhoto;
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $contact['name'] . '</title>'
@@ -481,6 +486,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $contact['url'] . '" />' . "\n");
$arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $contact['thumb'] . '" />' . "\n");
$arr['object'] .= '</link></object>' . "\n";
+
$arr['last-child'] = 1;
$arr['allow_cid'] = $user[0]['allow_cid'];
@@ -710,6 +716,10 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
WHERE `contact`.`id` = %d LIMIT 1",
intval($dfrn_record)
);
+
+ if(count($r))
+ $combined = $r[0];
+
if((count($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) {
push_lang($r[0]['language']);
@@ -738,6 +748,65 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
}
pop_lang();
}
+
+ // Send a new friend post if we are allowed to...
+
+ if($page && intval(get_pconfig($local_uid,'system','post_joingroup'))) {
+ $r = q("SELECT `hide-friends` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
+ intval($local_uid)
+ );
+
+ if((count($r)) && ($r[0]['hide-friends'] == 0)) {
+
+ require_once('include/items.php');
+
+ $self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
+ intval($local_uid)
+ );
+
+ if(count($self)) {
+
+ $arr = array();
+ $arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), $local_uid);
+ $arr['uid'] = $local_uid;
+ $arr['contact-id'] = $self[0]['id'];
+ $arr['wall'] = 1;
+ $arr['type'] = 'wall';
+ $arr['gravity'] = 0;
+ $arr['origin'] = 1;
+ $arr['author-name'] = $arr['owner-name'] = $self[0]['name'];
+ $arr['author-link'] = $arr['owner-link'] = $self[0]['url'];
+ $arr['author-avatar'] = $arr['owner-avatar'] = $self[0]['thumb'];
+
+ $A = '[url=' . $self[0]['url'] . ']' . $self[0]['name'] . '[/url]';
+ $APhoto = '[url=' . $self[0]['url'] . ']' . '[img]' . $self[0]['thumb'] . '[/img][/url]';
+
+ $B = '[url=' . $combined['url'] . ']' . $combined['name'] . '[/url]';
+ $BPhoto = '[url=' . $combined['url'] . ']' . '[img]' . $combined['thumb'] . '[/img][/url]';
+
+ $arr['verb'] = ACTIVITY_JOIN;
+ $arr['object-type'] = ACTIVITY_OBJ_GROUP;
+ $arr['body'] = sprintf( t('%1$s has joined %2$s'), $A, $B)."\n\n\n" .$BPhoto;
+ $arr['object'] = '<object><type>' . ACTIVITY_OBJ_GROUP . '</type><title>' . $combined['name'] . '</title>'
+ . '<id>' . $combined['url'] . '/' . $combined['name'] . '</id>';
+ $arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $combined['url'] . '" />' . "\n");
+ $arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $combined['thumb'] . '" />' . "\n");
+ $arr['object'] .= '</link></object>' . "\n";
+
+ $arr['last-child'] = 1;
+
+ $arr['allow_cid'] = $user[0]['allow_cid'];
+ $arr['allow_gid'] = $user[0]['allow_gid'];
+ $arr['deny_cid'] = $user[0]['deny_cid'];
+ $arr['deny_gid'] = $user[0]['deny_gid'];
+
+ $i = item_store($arr);
+ if($i)
+ proc_run('php',"include/notifier.php","activity","$i");
+
+ }
+ }
+ }
xml_status(0); // Success
return; // NOTREACHED
diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php
index 79583ea18..2169c494c 100644
--- a/mod/dfrn_request.php
+++ b/mod/dfrn_request.php
@@ -700,7 +700,8 @@ function dfrn_request_content(&$a) {
'node' => $r[0]['nickname'],
'dfrn_id' => $r[0]['issued-id'],
'intro_id' => $intro[0]['id'],
- 'duplex' => (($r[0]['page-flags'] == PAGE_FREELOVE) ? 1 : 0)
+ 'duplex' => (($r[0]['page-flags'] == PAGE_FREELOVE) ? 1 : 0),
+ 'activity' => intval(get_pconfig($r[0]['uid'],'system','post_newfriend'))
);
dfrn_confirm_post($a,$handsfree);
}
@@ -753,6 +754,11 @@ function dfrn_request_content(&$a) {
$myaddr = ((x($_GET,'address')) ? $_GET['address'] : '');
}
+ // last, try a zrl
+ if(! strlen($myaddr))
+ $myaddr = get_my_url();
+
+
$target_addr = $a->profile['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
diff --git a/mod/events.php b/mod/events.php
index e66a2dc44..069046ff9 100644
--- a/mod/events.php
+++ b/mod/events.php
@@ -28,6 +28,9 @@ function events_post(&$a) {
$adjust = intval($_POST['adjust']);
$nofinish = intval($_POST['nofinish']);
+ // The default setting for the `private` field in event_store() is false, so mirror that
+ $private_event = false;
+
$start = sprintf('%d-%d-%d %d:%d:0',$startyear,$startmonth,$startday,$starthour,$startminute);
if($nofinish)
@@ -65,14 +68,38 @@ function events_post(&$a) {
$share = ((intval($_POST['share'])) ? intval($_POST['share']) : 0);
+ $c = q("select id from contact where uid = %d and self = 1 limit 1",
+ intval(local_user())
+ );
+ if(count($c))
+ $self = $c[0]['id'];
+ else
+ $self = 0;
+
+
if($share) {
$str_group_allow = perms2str($_POST['group_allow']);
$str_contact_allow = perms2str($_POST['contact_allow']);
$str_group_deny = perms2str($_POST['group_deny']);
$str_contact_deny = perms2str($_POST['contact_deny']);
+
+ // Undo the pseudo-contact of self, since there are real contacts now
+ if( strpos($str_contact_allow, '<' . $self . '>') !== false )
+ {
+ $str_contact_allow = str_replace('<' . $self . '>', '', $str_contact_allow);
+ }
+ // Make sure to set the `private` field as true. This is necessary to
+ // have the posts show up correctly in Diaspora if an event is created
+ // as visible only to self at first, but then edited to display to others.
+ if( strlen($str_group_allow) or strlen($str_contact_allow) or strlen($str_group_deny) or strlen($str_contact_deny) )
+ {
+ $private_event = true;
+ }
}
else {
- $str_contact_allow = '<' . local_user() . '>';
+ // Note: do not set `private` field for self-only events. It will
+ // keep even you from seeing them!
+ $str_contact_allow = '<' . $self . '>';
$str_group_allow = $str_contact_deny = $str_group_deny = '';
}
@@ -91,6 +118,7 @@ function events_post(&$a) {
$datarray['allow_gid'] = $str_group_allow;
$datarray['deny_cid'] = $str_contact_deny;
$datarray['deny_gid'] = $str_group_deny;
+ $datarray['private'] = $private_event;
$datarray['id'] = $event_id;
$datarray['created'] = $created;
$datarray['edited'] = $edited;
diff --git a/mod/filerm.php b/mod/filerm.php
index c520fec7a..d2b57d447 100644
--- a/mod/filerm.php
+++ b/mod/filerm.php
@@ -7,12 +7,18 @@ function filerm_content(&$a) {
}
$term = unxmlify(trim($_GET['term']));
+ $cat = unxmlify(trim($_GET['cat']));
+
+ $category = (($cat) ? true : false);
+ if($category)
+ $term = $cat;
+
$item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
logger('filerm: tag ' . $term . ' item ' . $item_id);
if($item_id && strlen($term))
- file_tag_unsave_file(local_user(),$item_id,$term);
+ file_tag_unsave_file(local_user(),$item_id,$term, $category);
if(x($_SESSION,'return_url'))
goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
diff --git a/mod/friendica.php b/mod/friendica.php
index 52a064224..28807b5b5 100644
--- a/mod/friendica.php
+++ b/mod/friendica.php
@@ -18,10 +18,18 @@ function friendica_init(&$a) {
$admin = false;
}
+ $visible_plugins = array();
+ if(is_array($a->plugins) && count($a->plugins)) {
+ $r = q("select * from addon where hidden = 0");
+ if(count($r))
+ foreach($r as $rr)
+ $visible_plugins[] = $rr['name'];
+ }
+
$data = Array(
'version' => FRIENDICA_VERSION,
'url' => z_root(),
- 'plugins' => $a->plugins,
+ 'plugins' => $visible_plugins,
'register_policy' => $register_policy[$a->config['register_policy']],
'admin' => $admin,
'site_name' => $a->config['sitename'],
@@ -54,9 +62,18 @@ function friendica_content(&$a) {
$o .= '<p></p>';
- if(count($a->plugins)) {
+ $visible_plugins = array();
+ if(is_array($a->plugins) && count($a->plugins)) {
+ $r = q("select * from addon where hidden = 0");
+ if(count($r))
+ foreach($r as $rr)
+ $visible_plugins[] = $rr['name'];
+ }
+
+
+ if(count($visible_plugins)) {
$o .= '<p>' . t('Installed plugins/addons/apps:') . '</p>';
- $sorted = $a->plugins;
+ $sorted = $visible_plugins;
$s = '';
sort($sorted);
foreach($sorted as $p) {
diff --git a/mod/item.php b/mod/item.php
index 1436f7ffc..639379fe0 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -444,9 +444,28 @@ function item_post(&$a) {
$tags[] = '@' . $parent_contact['nick'];
}
+ $tagged = array();
+
+
if(count($tags)) {
foreach($tags as $tag) {
- handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag);
+
+ // If we already tagged 'Robert Johnson', don't try and tag 'Robert'.
+ // Robert Johnson should be first in the $tags array
+
+ $fullnametagged = false;
+ for($x = 0; $x < count($tagged); $x ++) {
+ if(stristr($tagged[$x],$tag . ' ')) {
+ $fullnametagged = true;
+ break;
+ }
+ }
+ if($fullnametagged)
+ continue;
+
+ $success = handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag);
+ if($success)
+ $tagged[] = $tag;
}
}
@@ -861,21 +880,27 @@ function item_content(&$a) {
* @param unknown_type $str_tags string to add the tag to
* @param unknown_type $profile_uid
* @param unknown_type $tag the tag to replace
+ *
+ * @return boolean true if replaced, false if not replaced
*/
function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
+
+ $replaced = false;
+
//is it a hash tag?
if(strpos($tag,'#') === 0) {
//if the tag is replaced...
if(strpos($tag,'[url='))
//...do nothing
- return;
+ return $replaced;
//base tag has the tags name only
$basetag = str_replace('_',' ',substr($tag,1));
//create text for link
$newtag = '#[url=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]';
//replace tag by the link
$body = str_replace($tag, $newtag, $body);
-
+ $replaced = true;
+
//is the link already in str_tags?
if(! stristr($str_tags,$newtag)) {
//append or set str_tags
@@ -883,13 +908,13 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
$str_tags .= ',';
$str_tags .= $newtag;
}
- return;
+ return $replaced;
}
//is it a person tag?
if(strpos($tag,'@') === 0) {
//is it already replaced?
if(strpos($tag,'[url='))
- return;
+ return $replaced;
$stat = false;
//get the person's name
$name = substr($tag,1);
@@ -965,6 +990,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
}
//if there is an url for this persons profile
if(isset($profile)) {
+ $replaced = true;
//create profile link
$profile = str_replace(',','%2c',$profile);
$newtag = '@[url=' . $profile . ']' . $newname . '[/url]';
@@ -989,4 +1015,6 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
}
}
}
+
+ return $replaced;
}
diff --git a/mod/network.php b/mod/network.php
index b12bd16da..5655f1bfa 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -171,37 +171,44 @@ function network_content(&$a, $update = 0) {
'label' => t('Commented Order'),
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '?f=&cid=' . $_GET['cid'] : ''),
'sel'=>$all_active,
+ 'title'=> t('Sort by Comment Date'),
),
array(
'label' => t('Posted Order'),
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
'sel'=>$postord_active,
+ 'title' => t('Sort by Post Date'),
),
array(
'label' => t('Personal'),
'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&conv=1',
'sel' => $conv_active,
+ 'title' => t('Posts that mention or involve you'),
),
array(
'label' => t('New'),
'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . '/new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''),
'sel' => $new_active,
+ 'title' => t('Activity Stream - by date'),
),
array(
'label' => t('Starred'),
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&star=1',
'sel'=>$starred_active,
+ 'title' => t('Favourite Posts'),
),
array(
'label' => t('Shared Links'),
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&bmark=1',
'sel'=>$bookmarked_active,
+ 'title'=> t('Interesting Links'),
),
// array(
// 'label' => t('Spam'),
// 'url'=>$a->get_baseurl(true) . '/network?f=&spam=1'
// 'sel'=> $spam_active,
+// 'title' => t('Posts flagged as SPAM'),
// ),
diff --git a/mod/profile.php b/mod/profile.php
index de1e27248..69f044e89 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -32,6 +32,8 @@ function profile_init(&$a) {
profile_load($a,$which,$profile);
+ $userblock = (($a->profile['hidewall'] && (! local_user()) && (! remote_user())) ? true : false);
+
if((x($a->profile,'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY)) {
$a->page['htmlhead'] .= '<meta name="friendica.community" content="true" />';
}
@@ -41,8 +43,8 @@ function profile_init(&$a) {
$delegate = ((strstr($a->profile['openid'],'://')) ? $a->profile['openid'] : 'http://' . $a->profile['openid']);
$a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . $delegate . '" />' . "\r\n";
}
-
- if(! $blocked) {
+ // site block
+ if((! $blocked) && (! $userblock)) {
$keywords = ((x($a->profile,'pub_keywords')) ? $a->profile['pub_keywords'] : '');
$keywords = str_replace(array('#',',',' ',',,'),array('',' ',',',','),$keywords);
if(strlen($keywords))
@@ -141,6 +143,10 @@ function profile_content(&$a, $update = 0) {
return $o;
}
+
+ $o .= common_friends_visitor_widget($a->profile['profile_uid']);
+
+
if(x($_SESSION,'new_member') && $_SESSION['new_member'] && $is_owner)
$o .= '<a href="newmember" id="newmember-tips" style="font-size: 1.2em;"><b>' . t('Tips for New Members') . '</b></a>' . EOL;
diff --git a/mod/profiles.php b/mod/profiles.php
index 7a33a03e4..c72a233c2 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -139,21 +139,49 @@ function profiles_post(&$a) {
$changes = array();
+ $value = '';
if($is_default) {
- if($marital != $orig[0]['marital']) $changes[] = '&hearts; ' . t('Marital Status');
- if($withchanged) $changes[] = '&hearts; ' . t('Romantic Partner');
- if($work != $orig[0]['work']) $changes[] = t('Work/Employment');
- if($religion != $orig[0]['religion']) $changes[] = t('Religion');
- if($politic != $orig[0]['politic']) $changes[] = t('Political Views');
- if($gender != $orig[0]['gender']) $changes[] = t('Gender');
- if($sexual != $orig[0]['sexual']) $changes[] = t('Sexual Preference');
- if($homepage != $orig[0]['homepage']) $changes[] = t('Homepage');
- if($interest != $orig[0]['interest']) $changes[] = t('Interests');
+ if($marital != $orig[0]['marital']) {
+ $changes[] = '[color=#ff0000]&hearts;[/color] ' . t('Marital Status');
+ $value = $marital;
+ }
+ if($withchanged) {
+ $changes[] = '&hearts; ' . t('Romantic Partner');
+ $value = strip_tags($with);
+ }
+ if($work != $orig[0]['work']) {
+ $changes[] = t('Work/Employment');
+ }
+ if($religion != $orig[0]['religion']) {
+ $changes[] = t('Religion');
+ $value = $religion;
+ }
+ if($politic != $orig[0]['politic']) {
+ $changes[] = t('Political Views');
+ $value = $politic;
+ }
+ if($gender != $orig[0]['gender']) {
+ $changes[] = t('Gender');
+ $value = $gender;
+ }
+ if($sexual != $orig[0]['sexual']) {
+ $changes[] = t('Sexual Preference');
+ $value = $sexual;
+ }
+ if($homepage != $orig[0]['homepage']) {
+ $changes[] = t('Homepage');
+ $value = $homepage;
+ }
+ if($interest != $orig[0]['interest']) {
+ $changes[] = t('Interests');
+ $value = $interest;
+ }
if($address != $orig[0]['address'] || $locality != $orig[0]['locality'] || $region != $orig[0]['region']
- || $country_name != $orig[0]['country_name'])
- $changes[] = t('Location');
+ || $country_name != $orig[0]['country-name']) {
+ $changes[] = t('Location');
+ }
- profile_activity($changes);
+ profile_activity($changes,$value);
}
@@ -245,7 +273,7 @@ function profiles_post(&$a) {
}
-function profile_activity($changed) {
+function profile_activity($changed, $value) {
$a = get_app();
if(! local_user() || ! is_array($changed) || ! count($changed))
@@ -289,7 +317,7 @@ function profile_activity($changed) {
foreach($changed as $ch) {
if(strlen($changes)) {
if ($z == ($t - 1))
- $changes .= ' and ';
+ $changes .= t(' and ');
else
$changes .= ', ';
}
@@ -299,7 +327,15 @@ function profile_activity($changed) {
$prof = '[url=' . $self[0]['url'] . '?tab=profile' . ']' . t('public profile') . '[/url]';
- $arr['body'] = sprintf( t('%1$s has an updated %2$s, changing %3$s.'), $A, $prof, $changes);
+ if($t == 1 && strlen($value)) {
+ $message = sprintf( t('%1$s changed %2$s to &ldquo;%3$s&rdquo;'), $A, $changes, $value);
+ $message .= "\n\n" . sprintf( t(" - Visit %1$s\'s %2$s"), $A, $prof);
+ }
+ else
+ $message = sprintf( t('%1$s has an updated %2$s, changing %3$s.'), $A, $prof, $changes);
+
+
+ $arr['body'] = $message;
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PROFILE . '</type><title>' . $self[0]['name'] . '</title>'
. '<id>' . $self[0]['url'] . '/' . $self[0]['name'] . '</id>';
diff --git a/mod/settings.php b/mod/settings.php
index 3072d3d65..5f5b2ab2e 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -352,6 +352,7 @@ function settings_post(&$a) {
$hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0);
$hidewall = (($_POST['hidewall'] == 1) ? 1: 0);
$post_newfriend = (($_POST['post_newfriend'] == 1) ? 1: 0);
+ $post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0);
$post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0);
@@ -436,6 +437,7 @@ function settings_post(&$a) {
set_pconfig(local_user(),'system','suggestme', $suggestme);
set_pconfig(local_user(),'system','post_newfriend', $post_newfriend);
+ set_pconfig(local_user(),'system','post_joingroup', $post_joingroup);
set_pconfig(local_user(),'system','post_profilechange', $post_profilechange);
@@ -802,6 +804,9 @@ function settings_content(&$a) {
$post_newfriend = get_pconfig(local_user(), 'system','post_newfriend');
$post_newfriend = (($post_newfriend===false)? '0': $post_newfriend); // default if not set: 0
+ $post_joingroup = get_pconfig(local_user(), 'system','post_joingroup');
+ $post_joingroup = (($post_joingroup===false)? '0': $post_joingroup); // default if not set: 0
+
$post_profilechange = get_pconfig(local_user(), 'system','post_profilechange');
$post_profilechange = (($post_profilechange===false)? '0': $post_profilechange); // default if not set: 0
@@ -976,6 +981,7 @@ function settings_content(&$a) {
'$h_not' => t('Notification Settings'),
'$activity_options' => t('By default post a status message when:'),
'$post_newfriend' => array('post_newfriend', t('accepting a friend request'), $post_newfriend, ''),
+ '$post_joingroup' => array('post_joingroup', t('joining a forum/community'), $post_joingroup, ''),
'$post_profilechange' => array('post_profilechange', t('making an <em>interesting</em> profile change'), $post_profilechange, ''),
'$lbl_not' => t('Send a notification email when:'),
'$notify1' => array('notify1', t('You receive an introduction'), ($notify & NOTIFY_INTRO), NOTIFY_INTRO, ''),
diff --git a/mod/tagger.php b/mod/tagger.php
index 8ee499f5f..6212e2b9b 100644
--- a/mod/tagger.php
+++ b/mod/tagger.php
@@ -66,14 +66,14 @@ function tagger_content(&$a) {
}
$uri = item_new_uri($a->get_hostname(),$owner_uid);
-
+ $xterm = xmlify($term);
$post_type = (($item['resource-id']) ? t('photo') : t('status'));
$targettype = (($item['resource-id']) ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );
$link = xmlify('<link rel="alternate" type="text/html" href="'
. $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;
- $body = $item['body'];
+ $body = xmlify($item['body']);
$target = <<< EOT
<target>
@@ -95,8 +95,8 @@ EOT;
<local>1</local>
<id>$tagid</id>
<link>$tagid</link>
- <title>$term</title>
- <content>$term</content>
+ <title>$xterm</title>
+ <content>$xterm</content>
</object>
EOT;
diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php
index e7d26b73e..8e261e711 100644
--- a/mod/viewcontacts.php
+++ b/mod/viewcontacts.php
@@ -24,13 +24,13 @@ function viewcontacts_content(&$a) {
}
- $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 ",
+ $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ",
intval($a->profile['uid'])
);
if(count($r))
$a->set_pager_total($r[0]['total']);
- $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 ORDER BY `name` ASC LIMIT %d , %d ",
+ $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ORDER BY `name` ASC LIMIT %d , %d ",
intval($a->profile['uid']),
intval($a->pager['start']),
intval($a->pager['itemspage'])