Merge remote branch 'upstream/master'
This commit is contained in:
commit
f9a40ccbde
34 changed files with 991 additions and 536 deletions
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Disable LF normalization for all files
|
||||
* -text
|
43
boot.php
43
boot.php
|
@ -4,12 +4,13 @@ require_once('include/config.php');
|
|||
require_once('include/network.php');
|
||||
require_once('include/plugin.php');
|
||||
require_once('include/text.php');
|
||||
require_once('include/datetime.php');
|
||||
require_once('include/pgettext.php');
|
||||
require_once('include/nav.php');
|
||||
require_once('include/cache.php');
|
||||
|
||||
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
||||
define ( 'FRIENDICA_VERSION', '3.0.1369' );
|
||||
define ( 'FRIENDICA_VERSION', '3.0.1375' );
|
||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||
define ( 'DB_UPDATE_VERSION', 1149 );
|
||||
|
||||
|
@ -333,6 +334,12 @@ if(! class_exists('App')) {
|
|||
|
||||
function __construct() {
|
||||
|
||||
global $default_timezone;
|
||||
|
||||
$this->timezone = ((x($default_timezone)) ? $default_timezone : 'UTC');
|
||||
|
||||
date_default_timezone_set($this->timezone);
|
||||
|
||||
$this->config = array();
|
||||
$this->page = array();
|
||||
$this->pager= array();
|
||||
|
@ -407,9 +414,6 @@ if(! class_exists('App')) {
|
|||
$this->argc = count($this->argv);
|
||||
if((array_key_exists('0',$this->argv)) && strlen($this->argv[0])) {
|
||||
$this->module = str_replace(".", "_", $this->argv[0]);
|
||||
if(array_key_exists('2',$this->argv)) {
|
||||
$this->category = $this->argv[2];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->argc = 1;
|
||||
|
@ -432,7 +436,7 @@ if(! class_exists('App')) {
|
|||
* pagination
|
||||
*/
|
||||
|
||||
$this->pager['page'] = ((x($_GET,'page')) ? $_GET['page'] : 1);
|
||||
$this->pager['page'] = ((x($_GET,'page') && intval($_GET['page']) > 0) ? intval($_GET['page']) : 1);
|
||||
$this->pager['itemspage'] = 50;
|
||||
$this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage'];
|
||||
$this->pager['total'] = 0;
|
||||
|
@ -499,7 +503,7 @@ if(! class_exists('App')) {
|
|||
}
|
||||
|
||||
function set_pager_itemspage($n) {
|
||||
$this->pager['itemspage'] = intval($n);
|
||||
$this->pager['itemspage'] = ((intval($n) > 0) ? intval($n) : 0);
|
||||
$this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage'];
|
||||
|
||||
}
|
||||
|
@ -1573,3 +1577,30 @@ function zrl($s,$force = false) {
|
|||
return $s . $achar . 'zrl=' . urlencode($mine);
|
||||
return $s;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns querystring as string from a mapped array
|
||||
*
|
||||
* @param params Array
|
||||
* @return string
|
||||
*/
|
||||
function build_querystring($params, $name=null) {
|
||||
$ret = "";
|
||||
foreach($params as $key=>$val) {
|
||||
if(is_array($val)) {
|
||||
if($name==null) {
|
||||
$ret .= build_querystring($val, $key);
|
||||
} else {
|
||||
$ret .= build_querystring($val, $name."[$key]");
|
||||
}
|
||||
} else {
|
||||
$val = urlencode($val);
|
||||
if($name!=null) {
|
||||
$ret.=$name."[$key]"."=$val&";
|
||||
} else {
|
||||
$ret.= "$key=$val&";
|
||||
}
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
|
|
@ -139,6 +139,10 @@ function terminate_friendship($user,$self,$contact) {
|
|||
|
||||
if(! function_exists('mark_for_death')) {
|
||||
function mark_for_death($contact) {
|
||||
|
||||
if($contact['archive'])
|
||||
return;
|
||||
|
||||
if($contact['term-date'] == '0000-00-00 00:00:00') {
|
||||
q("UPDATE `contact` SET `term-date` = '%s' WHERE `id` = %d LIMIT 1",
|
||||
dbesc(datetime_convert()),
|
||||
|
@ -146,12 +150,23 @@ function mark_for_death($contact) {
|
|||
);
|
||||
}
|
||||
else {
|
||||
|
||||
// TODO: We really should send a notification to the owner after 2-3 weeks
|
||||
// so they won't be surprised when the contact vanishes and can take
|
||||
// remedial action if this was a serious mistake or glitch
|
||||
|
||||
$expiry = $contact['term-date'] . ' + 32 days ';
|
||||
if(datetime_convert() > datetime_convert('UTC','UTC',$expiry)) {
|
||||
|
||||
// relationship is really truly dead.
|
||||
// archive them rather than delete
|
||||
// though if the owner tries to unarchive them we'll start the whole process over again
|
||||
|
||||
contact_remove($contact['id']);
|
||||
q("update contact set `archive` = 1 where id = %d limit 1",
|
||||
intval($contact['id'])
|
||||
);
|
||||
|
||||
//contact_remove($contact['id']);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -256,6 +256,56 @@ class Photo {
|
|||
else
|
||||
$guid = get_guid();
|
||||
|
||||
$x = q("select id from photo where `resource-id` = '%s' and uid = %d and `contact-id` = %d and `scale` = %d limit 1",
|
||||
dbesc($rid),
|
||||
intval($uid),
|
||||
intval($cid),
|
||||
intval($scale)
|
||||
);
|
||||
if(count($x)) {
|
||||
$r = q("UPDATE `photo`
|
||||
set `uid` = %d,
|
||||
`contact-id` = %d,
|
||||
`guid` = '%s',
|
||||
`resource-id` = '%s',
|
||||
`created` = '%s',
|
||||
`edited` = '%s',
|
||||
`filename` = '%s',
|
||||
`type` = '%s',
|
||||
`album` = '%s',
|
||||
`height` = %d,
|
||||
`width` = %d,
|
||||
`data` = '%s',
|
||||
`scale` = %d,
|
||||
`profile` = %d,
|
||||
`allow_cid` = '%s',
|
||||
`allow_gid` = '%s',
|
||||
`deny_cid` = '%s',
|
||||
`deny_gid` = '%s'
|
||||
where id = %d limit 1",
|
||||
|
||||
intval($uid),
|
||||
intval($cid),
|
||||
dbesc($guid),
|
||||
dbesc($rid),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(basename($filename)),
|
||||
dbesc($this->type),
|
||||
dbesc($album),
|
||||
intval($this->height),
|
||||
intval($this->width),
|
||||
dbesc($this->imageString()),
|
||||
intval($scale),
|
||||
intval($profile),
|
||||
dbesc($allow_cid),
|
||||
dbesc($allow_gid),
|
||||
dbesc($deny_cid),
|
||||
dbesc($deny_gid),
|
||||
intval($x[0]['id'])
|
||||
);
|
||||
}
|
||||
else {
|
||||
$r = q("INSERT INTO `photo`
|
||||
( `uid`, `contact-id`, `guid`, `resource-id`, `created`, `edited`, `filename`, type, `album`, `height`, `width`, `data`, `scale`, `profile`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` )
|
||||
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, '%s', '%s', '%s', '%s' )",
|
||||
|
@ -278,13 +328,9 @@ class Photo {
|
|||
dbesc($deny_cid),
|
||||
dbesc($deny_gid)
|
||||
);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}}
|
||||
|
||||
|
||||
|
@ -326,6 +372,17 @@ function import_profile_photo($photo,$uid,$cid) {
|
|||
|
||||
$a = get_app();
|
||||
|
||||
$r = q("select `resource-id` from photo where `uid` = %d and `contact-id` = %d and `scale` = 4 and `album` = 'Contact Photos' limit 1",
|
||||
intval($uid),
|
||||
intval($cid)
|
||||
);
|
||||
if(count($r)) {
|
||||
$hash = $r[0]['resource-id'];
|
||||
}
|
||||
else {
|
||||
$hash = photo_new_resource();
|
||||
}
|
||||
|
||||
$photo_failure = false;
|
||||
|
||||
$filename = basename($photo);
|
||||
|
@ -340,8 +397,6 @@ function import_profile_photo($photo,$uid,$cid) {
|
|||
|
||||
$img->scaleImageSquare(175);
|
||||
|
||||
$hash = photo_new_resource();
|
||||
|
||||
$r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 4 );
|
||||
|
||||
if($r === false)
|
||||
|
@ -361,8 +416,6 @@ function import_profile_photo($photo,$uid,$cid) {
|
|||
if($r === false)
|
||||
$photo_failure = true;
|
||||
|
||||
|
||||
|
||||
$photo = $a->get_baseurl() . '/photo/' . $hash . '-4.' . $img->getExt();
|
||||
$thumb = $a->get_baseurl() . '/photo/' . $hash . '-5.' . $img->getExt();
|
||||
$micro = $a->get_baseurl() . '/photo/' . $hash . '-6.' . $img->getExt();
|
||||
|
|
|
@ -1654,7 +1654,6 @@ account/update_profile_background_image
|
|||
account/update_profile_image
|
||||
blocks/create
|
||||
blocks/destroy
|
||||
oauth/authorize
|
||||
|
||||
Not implemented in status.net:
|
||||
statuses/retweeted_to_me
|
||||
|
|
|
@ -173,8 +173,8 @@ function localize_item(&$item){
|
|||
$item['body'] = str_replace($mtch[0],'@[url=' . zrl($mtch[1]). ']',$item['body']);
|
||||
}
|
||||
}
|
||||
// add zrl's to public images
|
||||
if(preg_match_all('/\[url=(.*?)\/photos\/(.*?)\/image\/(.*?)\]\[img(.*?)\]h(.*?)\[\/img\]\[\/url\]/is',$item['body'],$matches,PREG_SET_ORDER)) {
|
||||
logger('matched');
|
||||
foreach($matches as $mtch) {
|
||||
$item['body'] = str_replace($mtch[0],'[url=' . zrl($mtch[1] . '/photos/' . $mtch[2] . '/image/' . $mtch[3] ,true) . '][img' . $mtch[4] . ']h' . $mtch[5] . '[/img][/url]',$item['body']);
|
||||
}
|
||||
|
@ -546,7 +546,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
}
|
||||
|
||||
$likebuttons = '';
|
||||
$shareable = ((($profile_owner == local_user()) && (! $item['private'])) ? true : false); //($mode != 'display') &&
|
||||
$shareable = ((($profile_owner == local_user()) && ((! $item['private']) || $item['network'] === NETWORK_FEED)) ? true : false);
|
||||
|
||||
if($page_writeable) {
|
||||
if($toplevelpost) {
|
||||
|
|
|
@ -87,7 +87,7 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d
|
|||
$from = 'UTC';
|
||||
if($to === '')
|
||||
$to = 'UTC';
|
||||
if($s === '')
|
||||
if( ($s === '') || (! is_string($s)) )
|
||||
$s = 'now';
|
||||
|
||||
// Slight hackish adjustment so that 'zero' datetime actually returns what is intended
|
||||
|
|
|
@ -41,8 +41,8 @@ function notification($params) {
|
|||
|
||||
$subject = sprintf( t('[Friendica:Notify] New mail received at %s'),$sitename);
|
||||
|
||||
$preamble = sprintf( t('%s sent you a new private message at %s.'),$params['source_name'],$sitename);
|
||||
$epreamble = sprintf( t('%s sent you %s.'),'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]', '[url=$itemlink]' . t('a private message') . '[/url]');
|
||||
$preamble = sprintf( t('%1$s sent you a new private message at %2$s.'),$params['source_name'],$sitename);
|
||||
$epreamble = sprintf( t('%1$s sent you %2$s.'),'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]', '[url=$itemlink]' . t('a private message') . '[/url]');
|
||||
$sitelink = t('Please visit %s to view and/or reply to your private messages.');
|
||||
$tsitelink = sprintf( $sitelink, $siteurl . '/message/' . $params['item']['id'] );
|
||||
$hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '/message/' . $params['item']['id'] . '">' . $sitename . '</a>');
|
||||
|
@ -66,27 +66,38 @@ function notification($params) {
|
|||
);
|
||||
}
|
||||
|
||||
$possess_desc = str_replace('<!item_type!>',item_post_type($p[0]),$possess_desc);
|
||||
$item_post_type = item_post_type($p[0]);
|
||||
//$possess_desc = str_replace('<!item_type!>',$possess_desc);
|
||||
|
||||
// "a post"
|
||||
$dest_str = sprintf($possess_desc,'a');
|
||||
$dest_str = sprintf(t('%1$s commented on [url=%2$s]a %3$s[/url]'),
|
||||
'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
|
||||
$itemlink,
|
||||
$item_post_type);
|
||||
|
||||
// "George Bull's post"
|
||||
if($p)
|
||||
$dest_str = sprintf($possess_desc,sprintf( t("%s's"),$p[0]['author-name']));
|
||||
$dest_str = sprintf(t('%1$s commented on [url=%2$s]%3$s\'s %4$s[/url]'),
|
||||
'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
|
||||
$itemlink,
|
||||
$p[0]['author-name'],
|
||||
$item_post_type);
|
||||
|
||||
// "your post"
|
||||
if($p[0]['owner-name'] == $p[0]['author-name'] && $p[0]['wall'])
|
||||
$dest_str = sprintf($possess_desc, t('your') );
|
||||
$dest_str = sprintf(t('%1$s commented on [url=%2$s]your %3$s[/url]'),
|
||||
'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
|
||||
$itemlink,
|
||||
$item_post_type);
|
||||
|
||||
// Some mail softwares relies on subject field for threading.
|
||||
// So, we cannot have different subjects for notifications of the same thread.
|
||||
// Before this we have the name of the replier on the subject rendering
|
||||
// differents subjects for messages on the same thread.
|
||||
|
||||
$subject = sprintf( t('[Friendica:Notify] Comment to conversation #%d by %s'), $parent_id, $params['source_name']);
|
||||
$subject = sprintf( t('[Friendica:Notify] Comment to conversation #%1$d by %2$s'), $parent_id, $params['source_name']);
|
||||
$preamble = sprintf( t('%s commented on an item/conversation you have been following.'), $params['source_name']);
|
||||
$epreamble = sprintf( t('%s commented on %s.'), '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]', '[url=$itemlink]' . $dest_str . '[/url]');
|
||||
$epreamble = $dest_str;
|
||||
|
||||
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
|
||||
$tsitelink = sprintf( $sitelink, $siteurl );
|
||||
|
@ -97,9 +108,11 @@ function notification($params) {
|
|||
if($params['type'] == NOTIFY_WALL) {
|
||||
$subject = sprintf( t('[Friendica:Notify] %s posted to your profile wall') , $params['source_name']);
|
||||
|
||||
$preamble = sprintf( t('%s posted to your profile wall at %s') , $params['source_name'], $sitename);
|
||||
$preamble = sprintf( t('%1$s posted to your profile wall at %2$s') , $params['source_name'], $sitename);
|
||||
|
||||
$epreamble = sprintf( t('%s posted to %s') , '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]', '[url=$itemlink]' . t('your profile wall.') . '[/url]');
|
||||
$epreamble = sprintf( t('%1$s posted to [url=%2s]your wall[/url]') ,
|
||||
'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
|
||||
$itemlink);
|
||||
|
||||
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
|
||||
$tsitelink = sprintf( $sitelink, $siteurl );
|
||||
|
@ -109,8 +122,10 @@ function notification($params) {
|
|||
|
||||
if($params['type'] == NOTIFY_TAGSELF) {
|
||||
$subject = sprintf( t('[Friendica:Notify] %s tagged you') , $params['source_name']);
|
||||
$preamble = sprintf( t('%s tagged you at %s') , $params['source_name'], $sitename);
|
||||
$epreamble = sprintf( t('%s %s.') , '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]', '[url=' . $params['link'] . ']' . t('tagged you') . '[/url]');
|
||||
$preamble = sprintf( t('%1$s tagged you at %2$s') , $params['source_name'], $sitename);
|
||||
$epreamble = sprintf( t('%1$s [url=%2s]tagged you[/url].') ,
|
||||
'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
|
||||
$params['link']);
|
||||
|
||||
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
|
||||
$tsitelink = sprintf( $sitelink, $siteurl );
|
||||
|
@ -120,8 +135,10 @@ function notification($params) {
|
|||
|
||||
if($params['type'] == NOTIFY_TAGSHARE) {
|
||||
$subject = sprintf( t('[Friendica:Notify] %s tagged your post') , $params['source_name']);
|
||||
$preamble = sprintf( t('%s tagged your post at %s') , $params['source_name'], $sitename);
|
||||
$epreamble = sprintf( t('%s tagged %s') , '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]', '[url=$itemlink]' . t('your post') . '[/url]' );
|
||||
$preamble = sprintf( t('%1$s tagged your post at %2$s') , $params['source_name'], $sitename);
|
||||
$epreamble = sprintf( t('%1$s tagged [url=%2$s]your post[/url]') ,
|
||||
'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
|
||||
$itemlink);
|
||||
|
||||
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
|
||||
$tsitelink = sprintf( $sitelink, $siteurl );
|
||||
|
@ -131,8 +148,10 @@ function notification($params) {
|
|||
|
||||
if($params['type'] == NOTIFY_INTRO) {
|
||||
$subject = sprintf( t('[Friendica:Notify] Introduction received'));
|
||||
$preamble = sprintf( t('You\'ve received an introduction from \'%s\' at %s'), $params['source_name'], $sitename);
|
||||
$epreamble = sprintf( t('You\'ve received %s from %s.'), '[url=$itemlink]' . t('an introduction') . '[/url]' , '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]');
|
||||
$preamble = sprintf( t('You\'ve received an introduction from \'%1$s\' at %2$s'), $params['source_name'], $sitename);
|
||||
$epreamble = sprintf( t('You\'ve received [url=%1$s]an introduction[/url] from %2$s.'),
|
||||
$itemlink,
|
||||
'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]');
|
||||
$body = sprintf( t('You may visit their profile at %s'),$params['source_link']);
|
||||
|
||||
$sitelink = t('Please visit %s to approve or reject the introduction.');
|
||||
|
@ -143,11 +162,12 @@ function notification($params) {
|
|||
|
||||
if($params['type'] == NOTIFY_SUGGEST) {
|
||||
$subject = sprintf( t('[Friendica:Notify] Friend suggestion received'));
|
||||
$preamble = sprintf( t('You\'ve received a friend suggestion from \'%s\' at %s'), $params['source_name'], $sitename);
|
||||
$epreamble = sprintf( t('You\'ve received %s for %s from %s.'),
|
||||
'[url=$itemlink]' . t('a friend suggestion') . '[/url]',
|
||||
$preamble = sprintf( t('You\'ve received a friend suggestion from \'%1$s\' at %2$s'), $params['source_name'], $sitename);
|
||||
$epreamble = sprintf( t('You\'ve received [url=%1$s]a friend suggestion[/url] for %2$s from %3$s.'),
|
||||
$itemlink,
|
||||
'[url=' . $params['item']['url'] . ']' . $params['item']['name'] . '[/url]',
|
||||
'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]');
|
||||
|
||||
$body = t('Name:') . ' ' . $params['item']['name'] . "\n";
|
||||
$body .= t('Photo:') . ' ' . $params['item']['photo'] . "\n";
|
||||
$body .= sprintf( t('You may visit their profile at %s'),$params['item']['url']);
|
||||
|
|
|
@ -22,8 +22,6 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
|
|||
if($a->argv[$x] === 'category' && $a->argc > ($x + 1) && strlen($a->argv[$x+1]))
|
||||
$category = $a->argv[$x+1];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -693,6 +691,8 @@ function encode_rel_links($links) {
|
|||
return xmlify($o);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function item_store($arr,$force_parent = false) {
|
||||
|
||||
// If a Diaspora signature structure was passed in, pull it out of the
|
||||
|
@ -806,6 +806,14 @@ function item_store($arr,$force_parent = false) {
|
|||
$deny_cid = $r[0]['deny_cid'];
|
||||
$deny_gid = $r[0]['deny_gid'];
|
||||
$arr['wall'] = $r[0]['wall'];
|
||||
|
||||
// if the parent is private, force privacy for the entire conversation
|
||||
// This differs from the above settings as it subtly allows comments from
|
||||
// email correspondents to be private even if the overall thread is not.
|
||||
|
||||
if($r[0]['private'])
|
||||
$arr['private'] = 1;
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
|
@ -900,6 +908,16 @@ function item_store($arr,$force_parent = false) {
|
|||
intval($current_post)
|
||||
);
|
||||
|
||||
$arr['id'] = $current_post;
|
||||
$arr['parent'] = $parent_id;
|
||||
$arr['allow_cid'] = $allow_cid;
|
||||
$arr['allow_gid'] = $allow_gid;
|
||||
$arr['deny_cid'] = $deny_cid;
|
||||
$arr['deny_gid'] = $deny_gid;
|
||||
$arr['private'] = $private;
|
||||
$arr['deleted'] = $parent_deleted;
|
||||
call_hooks('post_remote_end',$arr);
|
||||
|
||||
// update the commented timestamp on the parent
|
||||
|
||||
q("UPDATE `item` set `commented` = '%s', `changed` = '%s' WHERE `id` = %d LIMIT 1",
|
||||
|
@ -1635,6 +1653,11 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
|
||||
if(count($r)) {
|
||||
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
|
||||
// do not accept (ignore) an earlier edit than one we currently have.
|
||||
if(datetime_convert('UTC','UTC',$datarray['edited']) < $r[0]['edited'])
|
||||
continue;
|
||||
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
dbesc($datarray['body']),
|
||||
|
@ -1781,6 +1804,11 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
|
||||
if(count($r)) {
|
||||
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
|
||||
// do not accept (ignore) an earlier edit than one we currently have.
|
||||
if(datetime_convert('UTC','UTC',$datarray['edited']) < $r[0]['edited'])
|
||||
continue;
|
||||
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
dbesc($datarray['body']),
|
||||
|
@ -1839,6 +1867,8 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
// one way feed - no remote comment ability
|
||||
$datarray['last-child'] = 0;
|
||||
}
|
||||
if($contact['network'] === NETWORK_FEED)
|
||||
$datarray['private'] = 1;
|
||||
|
||||
// This is my contact on another system, but it's really me.
|
||||
// Turn this into a wall post.
|
||||
|
@ -2265,6 +2295,11 @@ function local_delivery($importer,$data) {
|
|||
if(count($r)) {
|
||||
$iid = $r[0]['id'];
|
||||
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
|
||||
// do not accept (ignore) an earlier edit than one we currently have.
|
||||
if(datetime_convert('UTC','UTC',$datarray['edited']) < $r[0]['edited'])
|
||||
continue;
|
||||
|
||||
logger('received updated comment' , LOGGER_DEBUG);
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
|
@ -2443,6 +2478,11 @@ function local_delivery($importer,$data) {
|
|||
|
||||
if(count($r)) {
|
||||
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
|
||||
// do not accept (ignore) an earlier edit than one we currently have.
|
||||
if(datetime_convert('UTC','UTC',$datarray['edited']) < $r[0]['edited'])
|
||||
continue;
|
||||
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
dbesc($datarray['body']),
|
||||
|
@ -2609,6 +2649,11 @@ function local_delivery($importer,$data) {
|
|||
|
||||
if(count($r)) {
|
||||
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
|
||||
// do not accept (ignore) an earlier edit than one we currently have.
|
||||
if(datetime_convert('UTC','UTC',$datarray['edited']) < $r[0]['edited'])
|
||||
continue;
|
||||
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
dbesc($datarray['body']),
|
||||
|
@ -3345,3 +3390,69 @@ function drop_item($id,$interactive = true) {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function first_post_date($uid,$wall = false) {
|
||||
$r = q("select id, created from item
|
||||
where uid = %d and wall = %d and deleted = 0 and visible = 1 AND moderated = 0
|
||||
and id = parent
|
||||
order by created asc limit 1",
|
||||
intval($uid),
|
||||
intval($wall ? 1 : 0)
|
||||
);
|
||||
if(count($r)) {
|
||||
// logger('first_post_date: ' . $r[0]['id'] . ' ' . $r[0]['created'], LOGGER_DATA);
|
||||
return substr(datetime_convert('',date_default_timezone_get(),$r[0]['created']),0,10);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function posted_dates($uid,$wall) {
|
||||
$dnow = datetime_convert('',date_default_timezone_get(),'now','Y-m-d');
|
||||
|
||||
$dthen = first_post_date($uid,$wall);
|
||||
if(! $dthen)
|
||||
return array();
|
||||
|
||||
// If it's near the end of a long month, backup to the 28th so that in
|
||||
// consecutive loops we'll always get a whole month difference.
|
||||
|
||||
if(intval(substr($dnow,8)) > 28)
|
||||
$dnow = substr($dnow,0,8) . '28';
|
||||
if(intval(substr($dthen,8)) > 28)
|
||||
$dnow = substr($dthen,0,8) . '28';
|
||||
|
||||
$ret = array();
|
||||
while($dnow >= $dthen) {
|
||||
$dstart = substr($dnow,0,8) . '01';
|
||||
$dend = substr($dnow,0,8) . get_dim(intval($dnow),intval(substr($dnow,5)));
|
||||
$start_month = datetime_convert('','',$dstart,'Y-m-d');
|
||||
$end_month = datetime_convert('','',$dend,'Y-m-d');
|
||||
$str = day_translate(datetime_convert('','',$dnow,'F Y'));
|
||||
$ret[] = array($str,$end_month,$start_month);
|
||||
$dnow = datetime_convert('','',$dnow . ' -1 month', 'Y-m-d');
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
function posted_date_widget($url,$uid,$wall) {
|
||||
$o = '';
|
||||
|
||||
// For former Facebook folks that left because of "timeline"
|
||||
|
||||
if($wall && intval(get_pconfig($uid,'system','no_wall_archive_widget')))
|
||||
return $o;
|
||||
|
||||
$ret = posted_dates($uid,$wall);
|
||||
if(! count($ret))
|
||||
return $o;
|
||||
|
||||
$o = replace_macros(get_markup_template('posted_date_widget.tpl'),array(
|
||||
'$title' => t('Archives'),
|
||||
'$size' => ((count($ret) > 6) ? 6 : count($ret)),
|
||||
'$url' => $url,
|
||||
'$dates' => $ret
|
||||
));
|
||||
return $o;
|
||||
}
|
|
@ -36,11 +36,6 @@ function onepoll_run($argv, $argc){
|
|||
|
||||
logger('onepoll: start');
|
||||
|
||||
$abandon_days = intval(get_config('system','account_abandon_days'));
|
||||
if($abandon_days < 1)
|
||||
$abandon_days = 0;
|
||||
|
||||
|
||||
$manual_id = 0;
|
||||
$generation = 0;
|
||||
$hub_update = false;
|
||||
|
@ -55,8 +50,6 @@ function onepoll_run($argv, $argc){
|
|||
return;
|
||||
}
|
||||
|
||||
if(was_recently_delayed($contact_id))
|
||||
return;
|
||||
|
||||
$d = datetime_convert();
|
||||
|
||||
|
@ -64,11 +57,6 @@ function onepoll_run($argv, $argc){
|
|||
// and which have a polling address and ignore Diaspora since
|
||||
// we are unable to match those posts with a Diaspora GUID and prevent duplicates.
|
||||
|
||||
$abandon_sql = (($abandon_days)
|
||||
? sprintf(" AND `user`.`login_date` > UTC_TIMESTAMP() - INTERVAL %d DAY ", intval($abandon_days))
|
||||
: ''
|
||||
);
|
||||
|
||||
$contacts = q("SELECT `contact`.* FROM `contact`
|
||||
WHERE ( `rel` = %d OR `rel` = %d ) AND `poll` != ''
|
||||
AND NOT `network` IN ( '%s', '%s' )
|
||||
|
@ -88,14 +76,13 @@ function onepoll_run($argv, $argc){
|
|||
|
||||
$contact = $contacts[0];
|
||||
|
||||
|
||||
$xml = false;
|
||||
|
||||
$t = $contact['last-update'];
|
||||
|
||||
if($contact['subhub']) {
|
||||
$interval = get_config('system','pushpoll_frequency');
|
||||
$contact['priority'] = (($interval !== false) ? intval($interval) : 3);
|
||||
$poll_interval = get_config('system','pushpoll_frequency');
|
||||
$contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
|
||||
$hub_update = false;
|
||||
|
||||
if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day"))
|
||||
|
@ -139,15 +126,18 @@ function onepoll_run($argv, $argc){
|
|||
. '&perm=' . $perm ;
|
||||
|
||||
$handshake_xml = fetch_url($url);
|
||||
$html_code = $a->get_curl_code();
|
||||
|
||||
logger('onepoll: handshake with url ' . $url . ' returns xml: ' . $handshake_xml, LOGGER_DATA);
|
||||
|
||||
|
||||
if(! $handshake_xml) {
|
||||
if((! strlen($handshake_xml)) || ($html_code >= 400) || (! $html_code)) {
|
||||
logger("poller: $url appears to be dead - marking for death ");
|
||||
|
||||
// dead connection - might be a transient event, or this might
|
||||
// mean the software was uninstalled or the domain expired.
|
||||
// Will keep trying for one month.
|
||||
|
||||
mark_for_death($contact);
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
|
@ -161,6 +151,9 @@ function onepoll_run($argv, $argc){
|
|||
|
||||
if(! strstr($handshake_xml,'<?xml')) {
|
||||
logger('poller: response from ' . $url . ' did not contain XML.');
|
||||
|
||||
mark_for_death($contact);
|
||||
|
||||
$r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1",
|
||||
dbesc(datetime_convert()),
|
||||
intval($contact['id'])
|
||||
|
|
|
@ -201,8 +201,8 @@ function poller_run($argv, $argc){
|
|||
|
||||
|
||||
if($contact['subhub']) {
|
||||
$interval = get_config('system','pushpoll_frequency');
|
||||
$contact['priority'] = (($interval !== false) ? intval($interval) : 3);
|
||||
$poll_interval = get_config('system','pushpoll_frequency');
|
||||
$contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
|
||||
$hub_update = false;
|
||||
|
||||
if((datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) || $force)
|
||||
|
|
|
@ -23,6 +23,13 @@ function was_recently_delayed($cid) {
|
|||
);
|
||||
if(count($r))
|
||||
return true;
|
||||
|
||||
$r = q("select `term-date` from contact where id = %d and `term-date` != '' and `term-date` != '0000-00-00 00:00:00' limit 1",
|
||||
intval($cid)
|
||||
);
|
||||
if(count($r))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1059,7 +1059,7 @@ function feed_salmonlinks($nick) {
|
|||
if(! function_exists('get_plink')) {
|
||||
function get_plink($item) {
|
||||
$a = get_app();
|
||||
if (x($item,'plink') && (! $item['private'])){
|
||||
if (x($item,'plink') && ((! $item['private']) || ($item['network'] === NETWORK_FEED))){
|
||||
return array(
|
||||
'href' => $item['plink'],
|
||||
'title' => t('link to source'),
|
||||
|
@ -1255,13 +1255,13 @@ function bb_translate_video($s) {
|
|||
|
||||
function html2bb_video($s) {
|
||||
|
||||
$s = preg_replace('#<object[^>]+>(.*?)https+://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+)(.*?)</object>#ism',
|
||||
$s = preg_replace('#<object[^>]+>(.*?)https?://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+)(.*?)</object>#ism',
|
||||
'[youtube]$2[/youtube]', $s);
|
||||
|
||||
$s = preg_replace('#<iframe[^>](.*?)https+://www.youtube.com/embed/([A-Za-z0-9\-_=]+)(.*?)</iframe>#ism',
|
||||
$s = preg_replace('#<iframe[^>](.*?)https?://www.youtube.com/embed/([A-Za-z0-9\-_=]+)(.*?)</iframe>#ism',
|
||||
'[youtube]$2[/youtube]', $s);
|
||||
|
||||
$s = preg_replace('#<iframe[^>](.*?)https+://player.vimeo.com/video/([0-9]+)(.*?)</iframe>#ism',
|
||||
$s = preg_replace('#<iframe[^>](.*?)https?://player.vimeo.com/video/([0-9]+)(.*?)</iframe>#ism',
|
||||
'[vimeo]$2[/vimeo]', $s);
|
||||
|
||||
return $s;
|
||||
|
@ -1541,3 +1541,16 @@ function protect_sprintf($s) {
|
|||
return(str_replace('%','%%',$s));
|
||||
}
|
||||
|
||||
|
||||
function is_a_date_arg($s) {
|
||||
$i = intval($s);
|
||||
if($i > 1900) {
|
||||
$y = date('Y');
|
||||
if($i <= $y+1 && strpos($s,'-') == 4) {
|
||||
$m = intval(substr($s,5));
|
||||
if($m > 0 && $m <= 12)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -59,8 +59,7 @@ if(! $install) {
|
|||
/**
|
||||
*
|
||||
* Important stuff we always need to do.
|
||||
* Initialise authentication and date and time.
|
||||
* Create the HTML head for the page, even if we may not use it (xml, etc.)
|
||||
*
|
||||
* The order of these may be important so use caution if you think they're all
|
||||
* intertwingled with no logical order and decide to sort it out. Some of the
|
||||
* dependencies have changed, but at least at one time in the recent past - the
|
||||
|
@ -68,12 +67,6 @@ if(! $install) {
|
|||
*
|
||||
*/
|
||||
|
||||
require_once("datetime.php");
|
||||
|
||||
$a->timezone = (($default_timezone) ? $default_timezone : 'UTC');
|
||||
|
||||
date_default_timezone_set($a->timezone);
|
||||
|
||||
session_start();
|
||||
|
||||
/**
|
||||
|
|
|
@ -335,6 +335,7 @@ function contacts_content(&$a) {
|
|||
$tab_tpl = get_markup_template('common_tabs.tpl');
|
||||
$tab_str = replace_macros($tab_tpl, array('$tabs' => $tabs));
|
||||
|
||||
$lost_contact = (($contact['archive'] && $contact['term-date'] != '0000-00-00 00:00:00' && $contact['term-date'] < datetime_convert('','','now')) ? t('Communications lost with this contact!') : '');
|
||||
|
||||
$o .= replace_macros($tpl,array(
|
||||
'$header' => t('Contact Editor'),
|
||||
|
@ -359,6 +360,7 @@ function contacts_content(&$a) {
|
|||
'$poll_interval' => contact_poll_interval($contact['priority'],(! $poll_enabled)),
|
||||
'$poll_enabled' => $poll_enabled,
|
||||
'$lastupdtext' => t('Last update:'),
|
||||
'$lost_contact' => $lost_contact,
|
||||
'$updpub' => t('Update public posts'),
|
||||
'$last_update' => $last_update,
|
||||
'$udnow' => t('Update now'),
|
||||
|
|
|
@ -170,6 +170,21 @@ function dfrn_request_post(&$a) {
|
|||
info( t("Introduction complete.") . EOL);
|
||||
}
|
||||
|
||||
$r = q("select id from contact where uid = %d and url = '%s' and `site-pubkey` = '%s limit 1",
|
||||
intval(local_user()),
|
||||
dbesc($dfrn_url),
|
||||
$parms['key'] // this was already escaped
|
||||
);
|
||||
if(count($r)) {
|
||||
$g = q("select def_gid from user where uid = %d limit 1",
|
||||
intval(local_user())
|
||||
);
|
||||
if($g && intval($g[0]['def_gid'])) {
|
||||
require_once('include/group.php');
|
||||
group_add_member(local_user(),'',$r[0]['id'],$g[0]['def_gid']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow the blocked remote notification to complete
|
||||
*/
|
||||
|
|
|
@ -96,7 +96,7 @@ function manage_content(&$a) {
|
|||
|
||||
$o .= '<div id="identity-selector-wrapper">' . "\r\n";
|
||||
$o .= '<form action="manage" method="post" >' . "\r\n";
|
||||
$o .= '<select name="identity" size="4">' . "\r\n";
|
||||
$o .= '<select name="identity" size="4" onchange="this.form.submit();" >' . "\r\n";
|
||||
|
||||
foreach($a->identities as $rr) {
|
||||
$selected = (($rr['nickname'] === $a->user['nickname']) ? ' selected="selected" ' : '');
|
||||
|
@ -106,7 +106,8 @@ function manage_content(&$a) {
|
|||
$o .= '</select>' . "\r\n";
|
||||
$o .= '<div id="identity-select-break"></div>' . "\r\n";
|
||||
|
||||
$o .= '<input id="identity-submit" type="submit" name="submit" value="' . t('Submit') . '" /></div></form>' . "\r\n";
|
||||
// $o .= '<input id="identity-submit" type="submit" name="submit" value="' . t('Submit') . '" />';
|
||||
$o .= '</div></form>' . "\r\n";
|
||||
|
||||
return $o;
|
||||
|
||||
|
|
209
mod/network.php
209
mod/network.php
|
@ -7,10 +7,64 @@ function network_init(&$a) {
|
|||
return;
|
||||
}
|
||||
|
||||
$is_a_date_query = false;
|
||||
|
||||
if($a->argc > 1) {
|
||||
for($x = 1; $x < $a->argc; $x ++) {
|
||||
if(is_a_date_arg($a->argv[$x])) {
|
||||
$is_a_date_query = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// convert query string to array and remove first element (wich is friendica args)
|
||||
$query_array = array();
|
||||
parse_str($a->query_string, $query_array);
|
||||
array_shift($query_array);
|
||||
|
||||
// fetch last used tab and redirect if needed
|
||||
$sel_tabs = network_query_get_sel_tab($a);
|
||||
$last_sel_tabs = get_pconfig(local_user(), 'network.view','tab.selected');
|
||||
if (is_array($last_sel_tabs)){
|
||||
$tab_urls = array(
|
||||
'/network?f=&order=comment',//all
|
||||
'/network?f=&order=post', //postord
|
||||
'/network?f=&conv=1', //conv
|
||||
'/network/new', //new
|
||||
'/network?f=&star=1', //starred
|
||||
'/network?f=&bmark=1', //bookmarked
|
||||
'/network?f=&spam=1', //spam
|
||||
);
|
||||
|
||||
// redirect if current selected tab is 'no_active' and
|
||||
// last selected tab is _not_ 'all_active'.
|
||||
// and this isn't a date query
|
||||
|
||||
if ($sel_tabs[0] == 'active' && $last_sel_tabs[0]!='active' && (! $is_a_date_query)) {
|
||||
$k = array_search('active', $last_sel_tabs);
|
||||
|
||||
// merge tab querystring with request querystring
|
||||
$dest_qa = array();
|
||||
list($dest_url,$dest_qs) = explode("?", $tab_urls[$k]);
|
||||
parse_str( $dest_qs, $dest_qa);
|
||||
$dest_qa = array_merge($query_array, $dest_qa);
|
||||
$dest_qs = build_querystring($dest_qa);
|
||||
|
||||
// groups filter is in form of "network/nnn". Add it to $dest_url, if it's possible
|
||||
if ($a->argc==2 && is_numeric($a->argv[1]) && strpos($dest_url, "/",1)===false){
|
||||
$dest_url .= "/".$a->argv[1];
|
||||
}
|
||||
|
||||
goaway($a->get_baseurl() . $dest_url."?".$dest_qs);
|
||||
}
|
||||
}
|
||||
|
||||
$group_id = (($a->argc > 1 && intval($a->argv[1])) ? intval($a->argv[1]) : 0);
|
||||
|
||||
require_once('include/group.php');
|
||||
require_once('include/contact_widgets.php');
|
||||
require_once('include/items.php');
|
||||
|
||||
if(! x($a->page,'aside'))
|
||||
$a->page['aside'] = '';
|
||||
|
@ -44,6 +98,7 @@ function network_init(&$a) {
|
|||
}
|
||||
|
||||
$a->page['aside'] .= group_side('network','network',true,$group_id);
|
||||
$a->page['aside'] .= posted_date_widget($a->get_baseurl() . '/network',local_user(),false);
|
||||
$a->page['aside'] .= networks_widget($a->get_baseurl(true) . '/network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
|
||||
$a->page['aside'] .= saved_searches($search);
|
||||
$a->page['aside'] .= fileas_widget($a->get_baseurl(true) . '/network',(x($_GET, 'file') ? $_GET['file'] : ''));
|
||||
|
@ -98,26 +153,23 @@ function saved_searches($search) {
|
|||
|
||||
}
|
||||
|
||||
|
||||
function network_content(&$a, $update = 0) {
|
||||
|
||||
require_once('include/conversation.php');
|
||||
|
||||
if(! local_user()) {
|
||||
$_SESSION['return_url'] = $a->query_string;
|
||||
return login(false);
|
||||
}
|
||||
|
||||
$arr = array('query' => $a->query_string);
|
||||
|
||||
call_hooks('network_content_init', $arr);
|
||||
|
||||
$o = '';
|
||||
|
||||
// item filter tabs
|
||||
// TODO: fix this logic, reduce duplication
|
||||
//$a->page['content'] .= '<div class="tabs-wrapper">';
|
||||
|
||||
/**
|
||||
* Return selected tab from query
|
||||
*
|
||||
* urls -> returns
|
||||
* '/network' => $no_active = 'active'
|
||||
* '/network?f=&order=comment' => $comment_active = 'active'
|
||||
* '/network?f=&order=post' => $postord_active = 'active'
|
||||
* '/network?f=&conv=1', => $conv_active = 'active'
|
||||
* '/network/new', => $new_active = 'active'
|
||||
* '/network?f=&star=1', => $starred_active = 'active'
|
||||
* '/network?f=&bmark=1', => $bookmarked_active = 'active'
|
||||
* '/network?f=&spam=1', => $spam_active = 'active'
|
||||
*
|
||||
* @return Array ( $no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active );
|
||||
*/
|
||||
function network_query_get_sel_tab($a) {
|
||||
$no_active='';
|
||||
$starred_active = '';
|
||||
$new_active = '';
|
||||
$bookmarked_active = '';
|
||||
|
@ -125,6 +177,7 @@ function network_content(&$a, $update = 0) {
|
|||
$search_active = '';
|
||||
$conv_active = '';
|
||||
$spam_active = '';
|
||||
$postord_active = '';
|
||||
|
||||
if(($a->argc > 1 && $a->argv[1] === 'new')
|
||||
|| ($a->argc > 2 && $a->argv[2] === 'new')) {
|
||||
|
@ -152,59 +205,118 @@ function network_content(&$a, $update = 0) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
if (($new_active == '')
|
||||
&& ($starred_active == '')
|
||||
&& ($bookmarked_active == '')
|
||||
&& ($conv_active == '')
|
||||
&& ($search_active == '')
|
||||
&& ($spam_active == '')) {
|
||||
$all_active = 'active';
|
||||
$no_active = 'active';
|
||||
}
|
||||
|
||||
if ($no_active=='active' && x($_GET,'order')) {
|
||||
switch($_GET['order']){
|
||||
case 'post': $postord_active = 'active'; $no_active=''; break;
|
||||
case 'comment' : $all_active = 'active'; $no_active=''; break;
|
||||
}
|
||||
}
|
||||
|
||||
return array($no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active);
|
||||
}
|
||||
|
||||
|
||||
$postord_active = '';
|
||||
function network_content(&$a, $update = 0) {
|
||||
|
||||
if($all_active && x($_GET,'order') && $_GET['order'] !== 'comment') {
|
||||
$all_active = '';
|
||||
$postord_active = 'active';
|
||||
require_once('include/conversation.php');
|
||||
|
||||
if(! local_user()) {
|
||||
$_SESSION['return_url'] = $a->query_string;
|
||||
return login(false);
|
||||
}
|
||||
|
||||
$arr = array('query' => $a->query_string);
|
||||
|
||||
call_hooks('network_content_init', $arr);
|
||||
|
||||
|
||||
$datequery = $datequery2 = '';
|
||||
|
||||
$group = 0;
|
||||
|
||||
$nouveau = false;
|
||||
|
||||
if($a->argc > 1) {
|
||||
for($x = 1; $x < $a->argc; $x ++) {
|
||||
if(is_a_date_arg($a->argv[$x])) {
|
||||
if($datequery)
|
||||
$datequery2 = escape_tags($a->argv[$x]);
|
||||
else {
|
||||
$datequery = escape_tags($a->argv[$x]);
|
||||
$_GET['order'] = 'post';
|
||||
}
|
||||
}
|
||||
elseif($a->argv[$x] === 'new') {
|
||||
$nouveau = true;
|
||||
}
|
||||
elseif(intval($a->argv[$x])) {
|
||||
$group = intval($a->argv[$x]);
|
||||
$def_acl = array('allow_gid' => '<' . $group . '>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$o = '';
|
||||
|
||||
// item filter tabs
|
||||
// TODO: fix this logic, reduce duplication
|
||||
//$a->page['content'] .= '<div class="tabs-wrapper">';
|
||||
|
||||
list($no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active) = network_query_get_sel_tab($a);
|
||||
// if no tabs are selected, defaults to comments
|
||||
if ($no_active=='active') $all_active='active';
|
||||
//echo "<pre>"; var_dump($no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active); killme();
|
||||
|
||||
$cmd = (($datequery) ? '' : $a->cmd);
|
||||
$len_naked_cmd = strlen(str_replace('/new','',$cmd));
|
||||
|
||||
// tabs
|
||||
$tabs = array(
|
||||
array(
|
||||
'label' => t('Commented Order'),
|
||||
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '?f=&cid=' . $_GET['cid'] : ''),
|
||||
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . '?f=&order=comment' . ((x($_GET,'cid')) ? '&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'] : ''),
|
||||
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $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',
|
||||
'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $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'] : ''),
|
||||
'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ($len_naked_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',
|
||||
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $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',
|
||||
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&bmark=1',
|
||||
'sel'=>$bookmarked_active,
|
||||
'title'=> t('Interesting Links'),
|
||||
),
|
||||
|
@ -215,9 +327,13 @@ function network_content(&$a, $update = 0) {
|
|||
// 'title' => t('Posts flagged as SPAM'),
|
||||
// ),
|
||||
|
||||
|
||||
);
|
||||
|
||||
// save selected tab, but only if not in search or file mode
|
||||
if(!x($_GET,'search') && !x($_GET,'file')) {
|
||||
set_pconfig( local_user(), 'network.view','tab.selected',array($all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active) );
|
||||
}
|
||||
|
||||
$arr = array('tabs' => $tabs);
|
||||
call_hooks('network_tabs', $arr);
|
||||
|
||||
|
@ -231,9 +347,6 @@ function network_content(&$a, $update = 0) {
|
|||
|
||||
$contact_id = $a->cid;
|
||||
|
||||
$group = 0;
|
||||
|
||||
$nouveau = false;
|
||||
require_once('include/acl_selectors.php');
|
||||
|
||||
$cid = ((x($_GET,'cid')) ? intval($_GET['cid']) : 0);
|
||||
|
@ -248,17 +361,7 @@ function network_content(&$a, $update = 0) {
|
|||
$cmax = ((x($_GET,'cmax')) ? intval($_GET['cmax']) : 99);
|
||||
$file = ((x($_GET,'file')) ? $_GET['file'] : '');
|
||||
|
||||
if(($a->argc > 2) && $a->argv[2] === 'new')
|
||||
$nouveau = true;
|
||||
|
||||
if($a->argc > 1) {
|
||||
if($a->argv[1] === 'new')
|
||||
$nouveau = true;
|
||||
else {
|
||||
$group = intval($a->argv[1]);
|
||||
$def_acl = array('allow_gid' => '<' . $group . '>');
|
||||
}
|
||||
}
|
||||
|
||||
if(x($_GET,'search') || x($_GET,'file'))
|
||||
$nouveau = true;
|
||||
|
@ -398,7 +501,17 @@ function network_content(&$a, $update = 0) {
|
|||
. "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
|
||||
}
|
||||
|
||||
$sql_extra3 = '';
|
||||
|
||||
if($datequery) {
|
||||
$sql_extra3 .= protect_sprintf(sprintf(" AND item.created <= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery))));
|
||||
}
|
||||
if($datequery2) {
|
||||
$sql_extra3 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
|
||||
}
|
||||
|
||||
$sql_extra2 = (($nouveau) ? '' : " AND `item`.`parent` = `item`.`id` ");
|
||||
$sql_extra3 = (($nouveau) ? '' : $sql_extra3);
|
||||
|
||||
if(x($_GET,'search')) {
|
||||
$search = escape_tags($_GET['search']);
|
||||
|
@ -454,7 +567,7 @@ function network_content(&$a, $update = 0) {
|
|||
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
$sql_extra2
|
||||
$sql_extra2 $sql_extra3
|
||||
$sql_extra $sql_nets ",
|
||||
intval($_SESSION['uid'])
|
||||
);
|
||||
|
@ -506,7 +619,7 @@ function network_content(&$a, $update = 0) {
|
|||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
||||
and `item`.`moderated` = 0 and `item`.`unseen` = 1
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
$sql_extra $sql_nets ",
|
||||
$sql_extra3 $sql_extra $sql_nets ",
|
||||
intval(local_user())
|
||||
);
|
||||
}
|
||||
|
@ -516,7 +629,7 @@ function network_content(&$a, $update = 0) {
|
|||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
||||
AND `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
AND `item`.`parent` = `item`.`id`
|
||||
$sql_extra $sql_nets
|
||||
$sql_extra3 $sql_extra $sql_nets
|
||||
ORDER BY `item`.$ordering DESC $pager_sql ",
|
||||
intval(local_user())
|
||||
);
|
||||
|
|
|
@ -67,10 +67,22 @@ function profile_init(&$a) {
|
|||
|
||||
function profile_content(&$a, $update = 0) {
|
||||
|
||||
if (x($a->category)) {
|
||||
$category = $a->category;
|
||||
$category = $datequery = $datequery2 = '';
|
||||
|
||||
if($a->argc > 2) {
|
||||
for($x = 2; $x < $a->argc; $x ++) {
|
||||
if(is_a_date_arg($a->argv[$x])) {
|
||||
if($datequery)
|
||||
$datequery2 = escape_tags($a->argv[$x]);
|
||||
else
|
||||
$datequery = escape_tags($a->argv[$x]);
|
||||
}
|
||||
else {
|
||||
else
|
||||
$category = $a->argv[$x];
|
||||
}
|
||||
}
|
||||
|
||||
if(! x($category)) {
|
||||
$category = ((x($_GET,'category')) ? $_GET['category'] : '');
|
||||
}
|
||||
|
||||
|
@ -82,6 +94,8 @@ function profile_content(&$a, $update = 0) {
|
|||
require_once('include/security.php');
|
||||
require_once('include/conversation.php');
|
||||
require_once('include/acl_selectors.php');
|
||||
require_once('include/items.php');
|
||||
|
||||
$groups = array();
|
||||
|
||||
$tab = 'posts';
|
||||
|
@ -97,6 +111,7 @@ function profile_content(&$a, $update = 0) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
$contact = null;
|
||||
$remote_contact = false;
|
||||
|
||||
|
@ -155,6 +170,7 @@ function profile_content(&$a, $update = 0) {
|
|||
|
||||
$celeb = ((($a->profile['page-flags'] == PAGE_SOAPBOX) || ($a->profile['page-flags'] == PAGE_COMMUNITY)) ? true : false);
|
||||
|
||||
$a->page['aside'] .= posted_date_widget($a->get_baseurl(true) . '/profile/' . $a->profile['nickname'],$a->profile['profile_uid'],true);
|
||||
$a->page['aside'] .= categories_widget($a->get_baseurl(true) . '/profile/' . $a->profile['nickname'],(x($category) ? xmlify($category) : ''));
|
||||
|
||||
if(can_write_wall($a,$a->profile['profile_uid'])) {
|
||||
|
@ -201,15 +217,23 @@ function profile_content(&$a, $update = 0) {
|
|||
else {
|
||||
|
||||
if(x($category)) {
|
||||
$sql_extra .= file_tag_file_query('item',$category,'category');
|
||||
$sql_extra .= protect_sprintf(file_tag_file_query('item',$category,'category'));
|
||||
}
|
||||
|
||||
if($datequery) {
|
||||
$sql_extra2 .= protect_sprintf(sprintf(" AND item.created <= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery))));
|
||||
}
|
||||
if($datequery2) {
|
||||
$sql_extra2 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
|
||||
}
|
||||
|
||||
|
||||
$r = q("SELECT COUNT(*) AS `total`
|
||||
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
||||
and `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1
|
||||
$sql_extra ",
|
||||
$sql_extra $sql_extra2 ",
|
||||
intval($a->profile['profile_uid'])
|
||||
);
|
||||
|
||||
|
@ -225,7 +249,7 @@ function profile_content(&$a, $update = 0) {
|
|||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
||||
and `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1
|
||||
$sql_extra
|
||||
$sql_extra $sql_extra2
|
||||
ORDER BY `item`.`created` DESC $pager_sql ",
|
||||
intval($a->profile['profile_uid'])
|
||||
|
||||
|
|
762
util/messages.po
762
util/messages.po
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,3 @@
|
|||
<div class="clear"></div>
|
||||
<div id="categories-sidebar" class="widget">
|
||||
<h3>$title</h3>
|
||||
<div id="nets-desc">$desc</div>
|
||||
|
|
|
@ -9,3 +9,4 @@
|
|||
</div>
|
||||
{{ endif }}
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
<ul>
|
||||
<li><div id="contact-edit-rel">$relation_text</div></li>
|
||||
<li><div id="contact-edit-nettype">$nettype</div></li>
|
||||
{{ if $lost_contact }}
|
||||
<li><div id="lost-contact-message">$lost_contact</div></li>
|
||||
{{ endif }}
|
||||
{{ if $insecure }}
|
||||
<li><div id="insecure-message">$insecure</div></li>
|
||||
{{ endif }}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
</div>
|
||||
{{ endfor }}
|
||||
|
||||
<div id="conversation-end"></div>
|
||||
|
||||
{{ if $dropping }}
|
||||
<div id="item-delete-selected" class="fakelink" onclick="deleteCheckedItems();">
|
||||
<div id="item-delete-selected-icon" class="icon drophide" title="$dropping" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></div>
|
||||
|
|
9
view/posted_date_widget.tpl
Normal file
9
view/posted_date_widget.tpl
Normal file
|
@ -0,0 +1,9 @@
|
|||
<div id="datebrowse-sidebar" class="widget">
|
||||
<h3>$title</h3>
|
||||
<script>function dateSubmit(dateurl) { window.location.href = dateurl; } </script>
|
||||
<select id="posted-date-selector" name="posted-date-select" onchange="dateSubmit($(this).val());" size="$size">
|
||||
{{ for $dates as $d }}
|
||||
<option value="$url/$d.1/$d.2" >$d.0</option>
|
||||
{{ endfor }}
|
||||
</select>
|
||||
</div>
|
|
@ -1,4 +1,4 @@
|
|||
<a name="$item.id" />
|
||||
<a name="$item.id" ></a>
|
||||
<div class="wall-item-outside-wrapper$item.indent$item.previewing" id="wall-item-outside-wrapper-$item.id" >
|
||||
<div class="wall-item-content-wrapper$item.indent" id="wall-item-content-wrapper-$item.id" >
|
||||
<div class="wall-item-info" id="wall-item-info-$item.id">
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
</div>
|
||||
{{ endfor }}
|
||||
|
||||
<div id="conversation-end"></div>
|
||||
|
||||
{{ if $dropping }}
|
||||
<div class="delete-checked">
|
||||
<a href="#" onclick="deleteCheckedItems();return false;"><span class="icon delete"></span><span class="s22 text" onmouseover="imgbright(this);" onmouseout="imgdull(this);">$dropping</span></a>
|
||||
|
|
|
@ -1608,7 +1608,7 @@ input#dfrn-url {
|
|||
.contact-photo-menu li a:hover { color: #FFFFFF; background: #3465A4; text-decoration: none; }
|
||||
|
||||
|
||||
#block-message, #ignore-message, #archive-message {
|
||||
#block-message, #ignore-message, #archive-message, #lost-contact-message {
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
|
@ -3226,3 +3226,7 @@ ul.menu-popup {
|
|||
.autocomplete { color:#000; border:1px solid #999; background:#FFF; cursor:default; text-align:left; max-height:350px; overflow:auto; margin:-6px 6px 6px -6px; /* IE6 specific: */ _height:350px; _margin:0; _overflow-x:hidden; }
|
||||
.autocomplete .selected { background:#F0F0F0; }
|
||||
.autocomplete div { padding:2px 5px; white-space:nowrap; overflow:hidden; }
|
||||
|
||||
#datebrowse-sidebar select {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
</div>
|
||||
{{ endfor }}
|
||||
|
||||
<div id="conversation-end"></div>
|
||||
|
||||
{{ if $dropping }}
|
||||
<div id="item-delete-selected" class="fakelink" onclick="deleteCheckedItems();">
|
||||
<div id="item-delete-selected-icon" class="icon drophide" title="$dropping" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></div>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{{ for $threads as $thread }}
|
||||
<div id="tread-wrapper-$thread.id" class="tread-wrapper">
|
||||
{{ for $thread.items as $item }}
|
||||
{{if $mode == display}}
|
||||
{{ else }}
|
||||
{{if $item.comment_firstcollapsed}}
|
||||
<div class="hide-comments-outer">
|
||||
<span id="hide-comments-total-$thread.id" class="hide-comments-total">$thread.num_comments</span> <span id="hide-comments-$thread.id" class="hide-comments fakelink" onclick="showHideComments($thread.id);">$thread.hide_text</span>
|
||||
|
@ -8,6 +10,7 @@
|
|||
<div id="collapsed-comments-$thread.id" class="collapsed-comments" style="display: none;">
|
||||
{{endif}}
|
||||
{{if $item.comment_lastcollapsed}}</div>{{endif}}
|
||||
{{ endif }}
|
||||
|
||||
{{ if $item.type == tag }}
|
||||
{{ inc wall_item_tag.tpl }}{{ endinc }}
|
||||
|
@ -19,6 +22,8 @@
|
|||
</div>
|
||||
{{ endfor }}
|
||||
|
||||
<div id="conversation-end"></div>
|
||||
|
||||
{{ if $dropping }}
|
||||
<a href="#" onclick="deleteCheckedItems();return false;">
|
||||
<span class="icon s22 delete text">$dropping</span>
|
||||
|
|
|
@ -88,6 +88,20 @@ nav #site-location {
|
|||
box-shadow: 4px 4px 3px 0 #444444;
|
||||
}
|
||||
|
||||
#datebrowse-sidebar select {
|
||||
margin-left: 25px;
|
||||
border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
opacity: 0.3;
|
||||
filter:alpha(opacity=30);
|
||||
}
|
||||
|
||||
#datebrowse-sidebar select:hover {
|
||||
opacity: 1.0;
|
||||
filter:alpha(opacity=100);
|
||||
}
|
||||
|
||||
|
||||
.contact-entry-photo img, .profile-match-photo img, #photo-photo img, .directory-photo-img, .photo-album-photo, .photo-top-photo, .profile-jot-text, .group-selected, .nets-selected, .fileas-selected, #profile-jot-submit, .categories-selected {
|
||||
border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
</div>
|
||||
{{ endfor }}
|
||||
|
||||
<div id="conversation-end"></div>
|
||||
|
||||
{{ if $dropping }}
|
||||
<div id="item-delete-selected" class="fakelink" onclick="deleteCheckedItems();">
|
||||
<div id="item-delete-selected-icon" class="icon drophide" title="$dropping" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<a name="$item.id" />
|
||||
<a name="$item.id" ></a>
|
||||
<div class="wall-item-outside-wrapper$item.indent$item.previewing" id="wall-item-outside-wrapper-$item.id" >
|
||||
<div class="wall-item-content-wrapper$item.indent" id="wall-item-content-wrapper-$item.id" >
|
||||
<div class="wall-item-info" id="wall-item-info-$item.id">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<a name="$item.id" />
|
||||
<a name="$item.id" ></a>
|
||||
<div class="wall-item-outside-wrapper$item.indent$item.previewing wallwall" id="wall-item-outside-wrapper-$item.id" >
|
||||
<div class="wall-item-content-wrapper$item.indent" id="wall-item-content-wrapper-$item.id" >
|
||||
<div class="wall-item-info wallwall" id="wall-item-info-$item.id">
|
||||
|
|
Loading…
Reference in a new issue