aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/acl.php68
-rw-r--r--mod/admin.php77
-rw-r--r--mod/common.php77
-rw-r--r--mod/contacts.php93
-rw-r--r--mod/dfrn_confirm.php81
-rw-r--r--mod/dfrn_request.php70
-rw-r--r--mod/events.php30
-rw-r--r--mod/filerm.php8
-rw-r--r--mod/follow.php45
-rw-r--r--mod/friendica.php23
-rw-r--r--mod/item.php40
-rw-r--r--mod/message.php73
-rw-r--r--mod/network.php23
-rw-r--r--mod/ping.php2
-rw-r--r--mod/profile.php10
-rw-r--r--mod/profiles.php66
-rw-r--r--mod/search.php30
-rw-r--r--mod/settings.php15
-rw-r--r--mod/tagger.php16
-rw-r--r--mod/viewcontacts.php4
-rw-r--r--mod/wall_upload.php38
21 files changed, 716 insertions, 173 deletions
diff --git a/mod/acl.php b/mod/acl.php
index fe353d1eb..402d37376 100644
--- a/mod/acl.php
+++ b/mod/acl.php
@@ -13,6 +13,14 @@ function acl_init(&$a){
$type = (x($_REQUEST,'type')?$_REQUEST['type']:"");
+ // For use with jquery.autocomplete for private mail completion
+
+ if(x($_REQUEST,'query') && strlen($_REQUEST['query'])) {
+ $type = 'm';
+ $search = $_REQUEST['query'];
+ }
+
+
if ($search!=""){
$sql_extra = "AND `name` LIKE '%%".dbesc($search)."%%'";
$sql_extra2 = "AND (`attag` LIKE '%%".dbesc($search)."%%' OR `name` LIKE '%%".dbesc($search)."%%' OR `nick` LIKE '%%".dbesc($search)."%%')";
@@ -33,11 +41,27 @@ 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())
);
$contact_count = (int)$r[0]['c'];
+ }
+ elseif ($type == 'm') {
+
+ // autocomplete for Private Messages
+
+ $r = q("SELECT COUNT(`id`) AS c FROM `contact`
+ WHERE `uid` = %d AND `self` = 0
+ AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0
+ AND `network` IN ('%s','%s','%s') $sql_extra2" ,
+ intval(local_user()),
+ dbesc(NETWORK_DFRN),
+ dbesc(NETWORK_ZOT),
+ dbesc(NETWORK_DIASPORA)
+ );
+ $contact_count = (int)$r[0]['c'];
+
} else {
$contact_count = 0;
}
@@ -78,11 +102,45 @@ 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())
);
+ }
+ 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 AND `archive` = 0
+ AND `network` IN ('%s','%s','%s')
+ $sql_extra2
+ ORDER BY `name` ASC ",
+ intval(local_user()),
+ dbesc(NETWORK_DFRN),
+ dbesc(NETWORK_ZOT),
+ dbesc(NETWORK_DIASPORA)
+ );
+ }
+ else
+ $r = array();
+
+
+ if($type == 'm') {
+ $x = array();
+ $x['query'] = $search;
+ $x['suggestions'] = array();
+ $x['data'] = array();
+ if(count($r)) {
+ foreach($r as $g) {
+ $x['suggestions'][] = sprintf( t('%s [%s]'),$g['name'],$g['url']);
+ // '<img src="' . $g['micro'] . ' height="16" width="16" alt="' . t('Image/photo') . '" />' .
+ $x['data'][] = intval($g['id']);
+ }
+ }
+ echo json_encode($x);
+ killme();
+ }
+
+ if(count($r)) {
foreach($r as $g){
$contacts[] = array(
"type" => "c",
@@ -93,11 +151,9 @@ function acl_init(&$a){
"link" => $g['url'],
"nick" => ($g['attag']) ? $g['attag'] : $g['nick'],
);
- }
-
+ }
}
-
-
+
$items = array_merge($groups, $contacts);
$o = array(
diff --git a/mod/admin.php b/mod/admin.php
index cdc45c8e3..2810c8a8a 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,9 @@ 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);
+ $poll_interval = ((x($_POST,'poll_interval'))? intval(trim($_POST['poll_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 +291,9 @@ function admin_page_site_post(&$a){
}
}
set_config('system','ssl_policy',$ssl_policy);
-
+ set_config('system','delivery_interval',$delivery_interval);
+ set_config('system','poll_interval',$poll_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 +437,9 @@ 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.")),
+ '$poll_interval' => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")),
+ '$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 +447,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 +1047,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 9d29d4bd1..769239fe0 100644
--- a/mod/contacts.php
+++ b/mod/contacts.php
@@ -144,7 +144,7 @@ function contacts_content(&$a) {
goaway($a->get_baseurl(true) . '/contacts');
return; // NOTREACHED
}
-
+
if($cmd === 'update') {
// pull feed and consume it, which should subscribe to the hub.
@@ -182,40 +182,27 @@ function contacts_content(&$a) {
return; // NOTREACHED
}
- if($cmd === 'drop') {
- // create an unfollow slap
-
- if($orig_record[0]['network'] === NETWORK_OSTATUS) {
- $tpl = get_markup_template('follow_slap.tpl');
- $slap = replace_macros($tpl, array(
- '$name' => $a->user['username'],
- '$profile_page' => $a->get_baseurl() . '/profile/' . $a->user['nickname'],
- '$photo' => $a->contact['photo'],
- '$thumb' => $a->contact['thumb'],
- '$published' => datetime_convert('UTC','UTC', 'now', ATOM_TIME),
- '$item_id' => 'urn:X-dfrn:' . $a->get_hostname() . ':unfollow:' . random_string(),
- '$title' => '',
- '$type' => 'text',
- '$content' => t('stopped following'),
- '$nick' => $a->user['nickname'],
- '$verb' => 'http://ostatus.org/schema/1.0/unfollow', // ACTIVITY_UNFOLLOW,
- '$ostat_follow' => '' // '<as:verb>http://ostatus.org/schema/1.0/unfollow</as:verb>' . "\r\n"
- ));
-
- if((x($orig_record[0],'notify')) && (strlen($orig_record[0]['notify']))) {
- require_once('include/salmon.php');
- slapper($a->user,$orig_record[0]['notify'],$slap);
- }
- }
- elseif($orig_record[0]['network'] === NETWORK_DIASPORA) {
- require_once('include/diaspora.php');
- diaspora_unshare($a->user,$orig_record[0]);
- }
- elseif($orig_record[0]['network'] === NETWORK_DFRN) {
- require_once('include/items.php');
- dfrn_deliver($a->user,$orig_record[0],'placeholder', 1);
+ 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');
+
+ terminate_friendship($a->user,$a->contact,$orig_record[0]);
contact_remove($orig_record[0]['id']);
info( t('Contact has been removed.') . EOL );
@@ -303,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');
@@ -328,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']),
@@ -353,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'],
@@ -394,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 ";
@@ -405,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 77a3124f7..2169c494c 100644
--- a/mod/dfrn_request.php
+++ b/mod/dfrn_request.php
@@ -314,7 +314,7 @@ function dfrn_request_post(&$a) {
if($email_follow) {
- if(! strpos($url,'@')) {
+ if(! validate_email($url)) {
notice( t('Invalid email address.') . EOL);
return;
}
@@ -346,11 +346,71 @@ function dfrn_request_post(&$a) {
}
}
+ $r = q("insert into contact ( uid, created, addr, name, nick, url, nurl, poll, notify, blocked, pending, network, rel )
+ values( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d ) ",
+ intval($uid),
+ dbesc(datetime_convert()),
+ dbesc($addr),
+ dbesc($name),
+ dbesc($nick),
+ dbesc($url),
+ dbesc($nurl),
+ dbesc($poll),
+ dbesc($notify),
+ intval($blocked),
+ intval($pending),
+ dbesc($network),
+ intval($rel)
+ );
+ $r = q("select id from contact where poll = '%s' and uid = %d limit 1",
+ dbesc($poll),
+ intval($uid)
+ );
+ if(count($r)) {
+ $contact_id = $r[0]['id'];
+
+ $photo = avatar_img($addr);
+
+ $r = q("UPDATE `contact` SET
+ `photo` = '%s',
+ `thumb` = '%s',
+ `micro` = '%s',
+ `name-date` = '%s',
+ `uri-date` = '%s',
+ `avatar-date` = '%s',
+ `hidden` = 0,
+ WHERE `id` = %d LIMIT 1
+ ",
+ dbesc($photos[0]),
+ dbesc($photos[1]),
+ dbesc($photos[2]),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ intval($contact_id)
+ );
+ }
+
+ // contact is created. Now create an introduction
+ $hash = random_string();
+ $r = q("insert into intro ( uid, `contact-id`, knowyou, note, hash, datetime, blocked )
+ values( %d , %d, %d, '%s', '%s', '%s', %d ) ",
+ intval($uid),
+ intval($contact_id),
+ ((x($_POST,'knowyou') && ($_POST['knowyou'] == 1)) ? 1 : 0),
+ dbesc(notags(trim($_POST['dfrn-request-message']))),
+ dbesc($hash),
+ dbesc(datetime_convert()),
+ 1
+ );
+
+ // Next send an email verify form to the requestor.
}
+
else {
// Canonicalise email-style profile locator
@@ -640,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);
}
@@ -693,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/follow.php b/mod/follow.php
index ae8cb200c..4a7f99bf0 100644
--- a/mod/follow.php
+++ b/mod/follow.php
@@ -10,7 +10,10 @@ function follow_init(&$a) {
// NOTREACHED
}
+ $uid = local_user();
$url = $orig_url = notags(trim($_REQUEST['url']));
+ $return_url = $_SESSION['return_url'];
+
// remove ajax junk, e.g. Twitter
@@ -18,19 +21,25 @@ function follow_init(&$a) {
if(! allowed_url($url)) {
notice( t('Disallowed profile URL.') . EOL);
- goaway($_SESSION['return_url']);
+ goaway($return_url);
// NOTREACHED
}
if(! $url) {
notice( t('Connect URL missing.') . EOL);
- goaway($_SESSION['return_url']);
+ goaway($return_url);
// NOTREACHED
}
+ $arr = array('url' => $url, 'contact' => array());
+
+ call_hooks('follow', $arr);
- $ret = probe_url($url);
+ if(x($arr['contact'],'name'))
+ $ret = $arr['contact'];
+ else
+ $ret = probe_url($url);
if($ret['network'] === NETWORK_DFRN) {
if(strlen($a->path))
@@ -46,11 +55,11 @@ function follow_init(&$a) {
if(get_config('system','dfrn_only')) {
notice( t('This site is not configured to allow communications with other networks.') . EOL);
notice( t('No compatible communication protocols or feeds were discovered.') . EOL);
- goaway($_SESSION['return_url']);
+ goaway($return_url);
}
}
- // This just confuses things, remove it
+ // This extra param just confuses things, remove it
if($ret['network'] === NETWORK_DIASPORA)
$ret['url'] = str_replace('?absolute=true','',$ret['url']);
@@ -65,9 +74,11 @@ function follow_init(&$a) {
notice( t('An author or name was not found.') . EOL);
if(! x($ret,'url'))
notice( t('No browser URL could be matched to this address.') . EOL);
- if(strpos($url,'@') !== false)
- notice('Unable to match @-style Identity Address with a known protocol or email contact');
- goaway($_SESSION['return_url']);
+ if(strpos($url,'@') !== false) {
+ notice( t('Unable to match @-style Identity Address with a known protocol or email contact.') . EOL);
+ notice( t('Use mailto: in front of address to force email check.') . EOL);
+ }
+ goaway($return_url);
}
if($ret['network'] === NETWORK_OSTATUS && get_config('system','ostatus_disabled')) {
@@ -94,7 +105,7 @@ function follow_init(&$a) {
// indirect links or webfinger links
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `poll` = '%s' LIMIT 1",
- intval(local_user()),
+ intval($uid),
dbesc($ret['poll'])
);
@@ -104,7 +115,7 @@ function follow_init(&$a) {
q("UPDATE `contact` SET `rel` = %d , `readonly` = 0 WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval(CONTACT_IS_FRIEND),
intval($r[0]['id']),
- intval(local_user())
+ intval($uid)
);
}
}
@@ -118,7 +129,7 @@ function follow_init(&$a) {
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `photo`, `network`, `pubkey`, `rel`, `priority`,
`writable`, `hidden`, `blocked`, `readonly`, `pending` )
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, 0, 0, 0 ) ",
- intval(local_user()),
+ intval($uid),
dbesc(datetime_convert()),
dbesc($ret['url']),
dbesc(normalise_link($ret['url'])),
@@ -142,12 +153,12 @@ function follow_init(&$a) {
$r = q("SELECT * FROM `contact` WHERE `url` = '%s' AND `uid` = %d LIMIT 1",
dbesc($ret['url']),
- intval(local_user())
+ intval($uid)
);
if(! count($r)) {
notice( t('Unable to retrieve contact information.') . EOL);
- goaway($_SESSION['return_url']);
+ goaway($return_url);
// NOTREACHED
}
@@ -156,7 +167,7 @@ function follow_init(&$a) {
require_once("Photo.php");
- $photos = import_profile_photo($ret['photo'],local_user(),$contact_id);
+ $photos = import_profile_photo($ret['photo'],$uid,$contact_id);
$r = q("UPDATE `contact` SET `photo` = '%s',
`thumb` = '%s',
@@ -200,7 +211,7 @@ function follow_init(&$a) {
$r = q("SELECT `contact`.*, `user`.* FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
WHERE `user`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
- intval(local_user())
+ intval($uid)
);
if(count($r)) {
@@ -215,9 +226,9 @@ function follow_init(&$a) {
}
}
- if(strstr($_SESSION['return_url'],'contacts'))
+ if(strstr($return_url,'contacts'))
goaway($a->get_baseurl() . '/contacts/' . $contact_id);
- goaway($_SESSION['return_url']);
+ goaway($return_url);
// NOTREACHED
}
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 642a6758a..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?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]';
+ $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/message.php b/mod/message.php
index 260f4bb14..b8695fdd9 100644
--- a/mod/message.php
+++ b/mod/message.php
@@ -4,20 +4,7 @@ require_once('include/acl_selectors.php');
require_once('include/message.php');
function message_init(&$a) {
- $tabs = array(
- /*
- array(
- 'label' => t('All'),
- 'url'=> $a->get_baseurl(true) . '/message',
- 'sel'=> ($a->argc == 1),
- ),
- array(
- 'label' => t('Sent'),
- 'url' => $a->get_baseurl(true) . '/message/sent',
- 'sel'=> ($a->argv[1] == 'sent'),
- ),
- */
- );
+ $tabs = array();
$new = array(
'label' => t('New Message'),
'url' => $a->get_baseurl(true) . '/message/new',
@@ -29,6 +16,21 @@ function message_init(&$a) {
'$tabs'=>$tabs,
'$new'=>$new,
));
+ $base = $a->get_baseurl();
+
+ $a->page['htmlhead'] .= '<script src="' . $a->get_baseurl(true) . '/library/jquery_ac/jquery.autocomplete-min.js" ></script>';
+ $a->page['htmlhead'] .= <<< EOT
+
+<script>$(document).ready(function() {
+ var a;
+ a = $("#recip").autocomplete({
+ serviceUrl: '$base/acl',
+ width: 350
+ });
+});
+
+</script>
+EOT;
}
@@ -171,7 +173,23 @@ function message_content(&$a) {
$preselect = (isset($a->argv[2])?array($a->argv[2]):false);
- $select = contact_select('messageto','message-to-select', $preselect, 4, true, false, false, 10);
+ if(defined('EMAIL_AUTOCOMP')) {
+
+ // here's where we want to do contact autocomplete
+ // just figure out how to make it do the right thing
+ // pictures would be nice, but that didn't work when I tried.
+ // It sort of barely works, but needs help
+ // (the json backend is found in mod/acl.php)
+
+ $select = '<input type="text" id="recip" name="messageto" value="' . $preselect .'" />';
+ }
+ else {
+
+ // the ugly select box
+
+ $select = contact_select('messageto','message-to-select', $preselect, 4, true, false, false, 10);
+ }
+
$tpl = get_markup_template('prv_message.tpl');
$o .= replace_macros($tpl,array(
'$header' => t('Send Private Message'),
@@ -198,7 +216,7 @@ function message_content(&$a) {
$o .= $header;
$r = q("SELECT count(*) AS `total` FROM `mail`
- WHERE `mail`.`uid` = %d AND `from-url` $eq '%s' GROUP BY `parent-uri` ORDER BY `created` DESC",
+ WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `created` DESC",
intval(local_user()),
dbesc($myprofile)
);
@@ -313,6 +331,29 @@ function message_content(&$a) {
$from_url = $a->get_baseurl(true) . '/redir/' . $message['contact-id'];
$sparkle = ' sparkle';
}
+
+
+ $Text = $message['body'];
+ $saved_image = '';
+ $img_start = strpos($Text,'[img]data:');
+ $img_end = strpos($Text,'[/img]');
+
+ if($img_start !== false && $img_end !== false && $img_end > $img_start) {
+ $start_fragment = substr($Text,0,$img_start);
+ $img_start += strlen('[img]');
+ $saved_image = substr($Text,$img_start,$img_end - $img_start);
+ $end_fragment = substr($Text,$img_end + strlen('[/img]'));
+ $Text = $start_fragment . '[!#saved_image#!]' . $end_fragment;
+ $search = '/\[url\=(.*?)\]\[!#saved_image#!\]\[\/url\]' . '/is';
+ $replace = '[url=' . z_path() . '/redir/' . $message['contact-id']
+ . '?f=1&url=' . '$1' . '][!#saved_image#!][/url]' ;
+
+ $Text = preg_replace($search,$replace,$Text);
+
+ if(strlen($saved_image))
+ $message['body'] = str_replace('[!#saved_image#!]', '[img]' . $saved_image . '[/img]',$Text);
+ }
+
$mails[] = array(
'id' => $message['id'],
'from_name' => template_escape($message['from-name']),
diff --git a/mod/network.php b/mod/network.php
index b12bd16da..e59839ccc 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'),
// ),
@@ -333,7 +340,7 @@ function network_content(&$a, $update = 0) {
info( t('Group is empty'));
}
- $sql_extra = " AND `item`.`parent` IN ( SELECT DISTINCT(`parent`) FROM `item` WHERE 1 $sql_options AND ( `contact-id` IN ( $contact_str ) OR `allow_gid` REGEXP '<" . intval($group) . ">' ) and deleted = 0 ) ";
+ $sql_extra = " AND `item`.`parent` IN ( SELECT DISTINCT(`parent`) FROM `item` WHERE 1 $sql_options AND ( `contact-id` IN ( $contact_str ) OR `allow_gid` like '" . protect_sprintf('%<' . intval($group) . '>%') . "' ) and deleted = 0 ) ";
$o = '<h2>' . t('Group: ') . $r[0]['name'] . '</h2>' . $o;
}
elseif($cid) {
@@ -391,9 +398,9 @@ function network_content(&$a, $update = 0) {
if(x($_GET,'search')) {
$search = escape_tags($_GET['search']);
- $sql_extra .= sprintf(" AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' ) ",
- dbesc(preg_quote($search)),
- dbesc('\\]' . preg_quote($search) . '\\[')
+ $sql_extra .= sprintf(" AND ( `item`.`body` like '%s' OR `item`.`tag` like '%s' ) ",
+ dbesc(protect_sprintf('%' . $search . '%')),
+ dbesc(protect_sprintf('%]' . $search . '[%'))
);
}
if(strlen($file)) {
@@ -405,10 +412,10 @@ function network_content(&$a, $update = 0) {
$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`.`parent` IN (SELECT distinct(`parent`) from item where ( `author-link` regexp '%s' or `tag` regexp '%s' or tag regexp '%s' )) ",
- dbesc($myurl . '$'),
- dbesc($myurl . '\\]'),
- dbesc($diasp_url . '\\]')
+ $sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where ( `author-link` like '%s' or `tag` like '%s' or tag like '%s' )) ",
+ dbesc(protect_sprintf('%s' . $myurl)),
+ dbesc(protect_sprintf('%' . $myurl . '\\]%')),
+ dbesc(protect_sprintf('%' . $diasp_url . '\\]%'))
);
}
diff --git a/mod/ping.php b/mod/ping.php
index e911aaf1f..63aaa0f45 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -134,6 +134,8 @@ function ping_init(&$a) {
function xmlize($href, $name, $url, $photo, $date, $seen, $message){
+ $data = array('href' => &$href, 'name' => &$name, 'url'=>&$url, 'photo'=>&$photo, 'date'=>&$date, 'seen'=>&$seen, 'messsage'=>&$message);
+ call_hooks('ping_xmlize', $data);
$notsxml = '<note href="%s" name="%s" url="%s" photo="%s" date="%s" seen="%s" >%s</note>';
return sprintf ( $notsxml,
xmlify($href), xmlify($name), xmlify($url), xmlify($photo), xmlify($date), xmlify($seen), xmlify($message)
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/search.php b/mod/search.php
index 4ca7db9bb..d467764b0 100644
--- a/mod/search.php
+++ b/mod/search.php
@@ -87,11 +87,26 @@ function search_content(&$a) {
else
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
+ $tag = false;
+ if(x($_GET,'tag')) {
+ $tag = true;
+ $search = ((x($_GET,'tag')) ? notags(trim(rawurldecode($_GET['tag']))) : '');
+ }
+
+
$o .= search($search,'search-box','/search',((local_user()) ? true : false));
if(! $search)
return $o;
+ if($tag)
+ $sql_extra = sprintf(" AND `item`.`tag` REGEXP '%s' ", dbesc('\\]' . preg_quote($search) . '\\['));
+ else
+ $sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(preg_quote($search)));
+
+
+
+
// Here is the way permissions work in the search module...
// Only public posts can be shown
// OR your own posts if you are a logged in member
@@ -103,10 +118,8 @@ function search_content(&$a) {
AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`private` = 0 AND `user`.`hidewall` = 0)
OR `item`.`uid` = %d )
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
- AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' ) group by `item`.`uri` ",
- intval(local_user()),
- dbesc(preg_quote($search)),
- dbesc('\\]' . preg_quote($search) . '\\[')
+ $sql_extra group by `item`.`uri` ",
+ intval(local_user())
);
if(count($r))
@@ -127,18 +140,19 @@ function search_content(&$a) {
AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`private` = 0 AND `user`.`hidewall` = 0 )
OR `item`.`uid` = %d )
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
- AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' )
+ $sql_extra
group by `item`.`uri`
ORDER BY `received` DESC LIMIT %d , %d ",
intval(local_user()),
- dbesc(preg_quote($search)),
- dbesc('\\]' . preg_quote($search) . '\\['),
intval($a->pager['start']),
intval($a->pager['itemspage'])
);
- $o .= '<h2>Search results for: ' . $search . '</h2>';
+ if($tag)
+ $o .= '<h2>Items tagged with: ' . $search . '</h2>';
+ else
+ $o .= '<h2>Search results for: ' . $search . '</h2>';
$o .= conversation($a,$r,'search',false);
diff --git a/mod/settings.php b/mod/settings.php
index 721468437..5f5b2ab2e 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -75,6 +75,11 @@ EOT;
'label' => t('Export personal data'),
'url' => $a->get_baseurl(true) . '/uexport',
'selected' => ''
+ ),
+ array(
+ 'label' => t('Remove account'),
+ 'url' => $a->get_baseurl(true) . '/removeme',
+ 'selected' => ''
)
);
@@ -347,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);
@@ -431,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);
@@ -696,8 +703,8 @@ function settings_content(&$a) {
$allowed_themes_raw = explode(',',$allowed_themes_str);
$allowed_themes = array();
if(count($allowed_themes_raw))
- foreach($allowed_themes_raw as $x)
- if(strlen(trim($x)))
+ foreach($allowed_themes_raw as $x)
+ if(strlen(trim($x)) && is_dir("view/theme/$x"))
$allowed_themes[] = trim($x);
@@ -797,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
@@ -971,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 3ff5d57aa..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>
@@ -86,7 +86,7 @@ function tagger_content(&$a) {
</target>
EOT;
- $tagid = $a->get_baseurl() . '/search?search=' . $term;
+ $tagid = $a->get_baseurl() . '/search?tag=' . $term;
$objtype = ACTIVITY_OBJ_TAGTERM;
$obj = <<< EOT
@@ -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;
@@ -105,7 +105,7 @@ EOT;
if(! isset($bodyverb))
return;
- $termlink = html_entity_decode('&#x2317;') . '[url=' . $a->get_baseurl() . '/search?search=' . urlencode($term) . ']'. $term . '[/url]';
+ $termlink = html_entity_decode('&#x2317;') . '[url=' . $a->get_baseurl() . '/search?tag=' . urlencode($term) . ']'. $term . '[/url]';
$arr = array();
@@ -161,7 +161,7 @@ EOT;
if((! $blocktags) && (! stristr($item['tag'], ']' . $term . '[' ))) {
q("update item set tag = '%s' where id = %d limit 1",
- dbesc($item['tag'] . (strlen($item['tag']) ? ',' : '') . '#[url=' . $a->get_baseurl() . '/search?search=' . $term . ']'. $term . '[/url]'),
+ dbesc($item['tag'] . (strlen($item['tag']) ? ',' : '') . '#[url=' . $a->get_baseurl() . '/search?tag=' . $term . ']'. $term . '[/url]'),
intval($item['id'])
);
}
@@ -177,7 +177,7 @@ EOT;
);
if(count($x) && !$x[0]['blocktags'] && (! stristr($r[0]['tag'], ']' . $term . '['))) {
q("update item set tag = '%s' where id = %d limit 1",
- dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . '#[url=' . $a->get_baseurl() . '/search?search=' . $term . ']'. $term . '[/url]'),
+ dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . '#[url=' . $a->get_baseurl() . '/search?tag=' . $term . ']'. $term . '[/url]'),
intval($r[0]['id'])
);
}
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'])
diff --git a/mod/wall_upload.php b/mod/wall_upload.php
index f341cc9cd..fa66561e8 100644
--- a/mod/wall_upload.php
+++ b/mod/wall_upload.php
@@ -5,19 +5,26 @@ require_once('Photo.php');
function wall_upload_post(&$a) {
if($a->argc > 1) {
- $nick = $a->argv[1];
- $r = q("SELECT `user`.*, `contact`.`id` FROM `user` LEFT JOIN `contact` on `user`.`uid` = `contact`.`uid` WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1",
- dbesc($nick)
- );
- if(! count($r))
- return;
-
+ if(! x($_FILES,'media')) {
+ $nick = $a->argv[1];
+ $r = q("SELECT `user`.*, `contact`.`id` FROM `user` LEFT JOIN `contact` on `user`.`uid` = `contact`.`uid` WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1",
+ dbesc($nick)
+ );
+
+ if(! count($r))
+ return;
+ }
+ else {
+ $user_info = api_get_user($a);
+ $r = q("SELECT `user`.*, `contact`.`id` FROM `user` LEFT JOIN `contact` on `user`.`uid` = `contact`.`uid` WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1",
+ dbesc($user_info['screen_name'])
+ );
+ }
}
else
return;
-
$can_post = false;
$visitor = 0;
@@ -47,12 +54,19 @@ function wall_upload_post(&$a) {
killme();
}
- if(! x($_FILES,'userfile'))
+ if(! x($_FILES,'userfile') && ! x($_FILES,'media'))
killme();
- $src = $_FILES['userfile']['tmp_name'];
- $filename = basename($_FILES['userfile']['name']);
- $filesize = intval($_FILES['userfile']['size']);
+ if(x($_FILES,'userfile')) {
+ $src = $_FILES['userfile']['tmp_name'];
+ $filename = basename($_FILES['userfile']['name']);
+ $filesize = intval($_FILES['userfile']['size']);
+ }
+ elseif(x($_FILES,'media')) {
+ $src = $_FILES['media']['tmp_name'];
+ $filename = basename($_FILES['media']['name']);
+ $filesize = intval($_FILES['media']['size']);
+ }
$maximagesize = get_config('system','maximagesize');