Merge remote-tracking branch 'upstream/master'

Update
This commit is contained in:
Christian Vogeley 2013-08-21 22:19:38 +02:00
commit 056ed00a4c
21 changed files with 7854 additions and 10285 deletions

View file

@ -43,7 +43,7 @@ require_once('include/taxonomy.php');
define ( 'RED_PLATFORM', 'Red Matrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
define ( 'DB_UPDATE_VERSION', 1059 );
define ( 'DB_UPDATE_VERSION', 1063 );
define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

View file

@ -39,10 +39,10 @@ class Item extends BaseObject {
foreach($data['children'] as $item) {
/*
* Only add thos that will be displayed
* Only add those that will be displayed
*/
if(! visible_activity($item)) {
if((! visible_activity($item)) || array_key_exists('author_blocked',$item)) {
continue;
}

View file

@ -137,7 +137,7 @@ function localize_item(&$item){
case ACTIVITY_OBJ_NOTE:
default:
$post_type = t('status');
if($obj['id'] != $item['mid'])
if($obj['mid'] != $obj['parent_mid'])
$post_type = t('comment');
break;
}
@ -712,6 +712,8 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
$threads = array();
foreach($items as $item) {
// Check for any blocked authors
if($arr_blocked) {
$blocked = false;
foreach($arr_blocked as $b) {
@ -724,6 +726,18 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
continue;
}
// Check all the kids too
if($arr_blocked && $item['children']) {
for($d = 0; $d < count($item['children']); $d ++) {
foreach($arr_blocked as $b) {
if(($b) && ($item['children'][$d]['author_xchan'] == $b))
$item['children'][$d]['author_blocked'] = true;
}
}
}
// Can we put this after the visibility check?
like_puller($a,$item,$alike,'like');

View file

@ -145,12 +145,13 @@ function new_contact($uid,$url,$channel,$interactive = false) {
);
}
else {
$r = q("insert into abook ( abook_account, abook_channel, abook_xchan, abook_their_perms, abook_created, abook_updated )
values( %d, %d, '%s', %d, '%s', '%s' ) ",
$r = q("insert into abook ( abook_account, abook_channel, abook_xchan, abook_their_perms, abook_my_perms, abook_created, abook_updated )
values( %d, %d, '%s', %d, %d, '%s', '%s' ) ",
intval($aid),
intval($uid),
dbesc($xchan_hash),
intval($their_perms),
intval(PERMS_W_STREAM|PERMS_W_MAIL),
dbesc(datetime_convert()),
dbesc(datetime_convert())
);

View file

@ -115,11 +115,19 @@ function create_identity($arr) {
if(array_key_exists('primary', $arr))
$primary = intval($arr['primary']);
$perms_sql = '';
$defperms = site_default_perms();
$global_perms = get_perms();
foreach($defperms as $p => $v) {
$perms_keys .= ', ' . $global_perms[$p][0];
$perms_vals .= ', ' . intval($v);
}
$r = q("insert into channel ( channel_account_id, channel_primary,
channel_name, channel_address, channel_guid, channel_guid_sig,
channel_hash, channel_prvkey, channel_pubkey, channel_pageflags )
values ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d ) ",
channel_hash, channel_prvkey, channel_pubkey, channel_pageflags $perms_keys )
values ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d $perms_vals ) ",
intval($arr['account_id']),
intval($primary),
@ -133,6 +141,9 @@ function create_identity($arr) {
intval($pageflags)
);
$r = q("select * from channel where channel_account_id = %d
and channel_guid = '%s' limit 1",
intval($arr['account_id']),

View file

@ -840,6 +840,9 @@ function encode_mail($item) {
$x['from'] = encode_item_xchan($item['from']);
$x['to'] = encode_item_xchan($item['to']);
if($item['attach'])
$x['attach'] = json_decode_plus($item['attach']);
$x['flags'] = array();
if($item['mail_flags'] & MAIL_RECALLED) {
@ -885,6 +888,9 @@ function get_mail_elements($x) {
$arr['mid'] = (($x['message_id']) ? htmlentities($x['message_id'], ENT_COMPAT,'UTF-8',false) : '');
$arr['parent_mid'] = (($x['message_parent']) ? htmlentities($x['message_parent'], ENT_COMPAT,'UTF-8',false) : '');
if($x['attach'])
$arr['attach'] = activity_sanitise($x['attach']);
if(import_author_xchan($x['from']))
$arr['from_xchan'] = base64url_encode(hash('whirlpool',$x['from']['guid'] . $x['from']['guid_sig'], true));
@ -2202,6 +2208,9 @@ function mail_store($arr) {
if((strpos($arr['body'],'<') !== false) || (strpos($arr['body'],'>') !== false))
$arr['body'] = escape_tags($arr['body']);
if(array_key_exists('attach',$arr) && is_array($arr['attach']))
$arr['attach'] = json_encode($arr['attach']);
$arr['account_id'] = ((x($arr,'account_id')) ? intval($arr['account_id']) : 0);
$arr['mid'] = ((x($arr,'mid')) ? notags(trim($arr['mid'])) : random_string());
$arr['from_xchan'] = ((x($arr,'from_xchan')) ? notags(trim($arr['from_xchan'])) : '');
@ -2210,6 +2219,7 @@ function mail_store($arr) {
$arr['title'] = ((x($arr,'title')) ? notags(trim($arr['title'])) : '');
$arr['parent_mid'] = ((x($arr,'parent_mid')) ? notags(trim($arr['parent_mid'])) : '');
$arr['body'] = ((x($arr,'body')) ? trim($arr['body']) : '');
$arr['mail_flags'] = ((x($arr,'mail_flags')) ? intval($arr['mail_flags']) : 0 );

View file

@ -3,6 +3,7 @@
/* Private Message backend API */
require_once('include/crypto.php');
require_once('include/attach.php');
// send a private message
@ -74,14 +75,44 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
if(preg_match_all("/\[img\](.*?)\[\/img\]/",$body,$match))
$images = $match[1];
$match = false;
if(preg_match_all("/\[attachment\](.*?)\[\/attachment\]/",$body,$match))
$attaches = $match[1];
$attachments = '';
if(preg_match_all('/(\[attachment\](.*?)\[\/attachment\])/',$body,$match)) {
$attachments = array();
foreach($match[2] as $mtch) {
$hash = substr($mtch,0,strpos($mtch,','));
$rev = intval(substr($mtch,strpos($mtch,',')));
$r = attach_by_hash_nodata($hash,$rev);
if($r['success']) {
$attachments[] = array(
'href' => $a->get_baseurl() . '/attach/' . $r['data']['hash'],
'length' => $r['data']['filesize'],
'type' => $r['data']['filetype'],
'title' => urlencode($r['data']['filename']),
'revision' => $r['data']['revision']
);
}
$body = str_replace($match[1],'',$body);
}
}
$jattach = (($attachments) ? json_encode($attachments) : '');
$key = get_config('system','pubkey');
if($subject)
$subject = json_encode(aes_encapsulate($subject,$key));
if($body)
$body = json_encode(aes_encapsulate($body,$key));
$r = q("INSERT INTO mail ( account_id, mail_flags, channel_id, from_xchan, to_xchan, title, body, mid, parent_mid, created )
VALUES ( %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
$r = q("INSERT INTO mail ( account_id, mail_flags, channel_id, from_xchan, to_xchan, title, body, attach, mid, parent_mid, created )
VALUES ( %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
intval($channel['channel_account_id']),
intval(MAIL_OBSCURED),
intval($channel['channel_id']),
@ -89,6 +120,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
dbesc($recipient),
dbesc($subject),
dbesc($body),
dbesc($jattach),
dbesc($mid),
dbesc($replyto),
dbesc(datetime_convert())
@ -122,6 +154,19 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
}
}
if($attaches) {
foreach($attaches as $attach) {
$hash = substr($attach,0,strpos($attach,','));
$rev = intval(substr($attach,strpos($attach,',')));
attach_store($channel,$observer_hash,$options = 'update', array(
'hash' => $hash,
'revision' => $rev,
'allow_cid' => '<' . $recipient . '>',
));
}
}
proc_run('php','include/notifier.php','mail',$post_id);
$ret['success'] = true;

View file

@ -328,3 +328,38 @@ function check_list_permissions($uid,$arr,$perm) {
return($result);
}
function site_default_perms() {
$typical = array(
'view_stream' => PERMS_PUBLIC,
'view_profile' => PERMS_PUBLIC,
'view_photos' => PERMS_PUBLIC,
'view_contacts' => PERMS_PUBLIC,
'view_storage' => PERMS_PUBLIC,
'view_pages' => PERMS_PUBLIC,
'send_stream' => PERMS_SPECIFIC,
'post_wall' => PERMS_SPECIFIC,
'post_comments' => PERMS_SPECIFIC,
'post_mail' => PERMS_SPECIFIC,
'post_photos' => 0,
'tag_deliver' => PERMS_SPECIFIC,
'chat' => PERMS_SPECIFIC,
'write_storage' => 0,
'write_pages' => 0,
'delegate' => 0,
);
$global_perms = get_perms();
$ret = array();
foreach($global_perms as $perm => $v) {
$x = get_config('default_perms',$perm);
if($x === false)
$x = $typical[$perm];
$ret[$perm] = $x;
}
return $ret;
}

View file

@ -136,7 +136,7 @@ CREATE TABLE IF NOT EXISTS `challenge` (
`type` char(255) NOT NULL,
`last_update` char(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `channel` (
`channel_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@ -267,7 +267,7 @@ CREATE TABLE IF NOT EXISTS `event` (
KEY `aid` (`aid`),
KEY `event_hash` (`event_hash`),
KEY `event_xchan` (`event_xchan`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `fcontact` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@ -348,7 +348,7 @@ CREATE TABLE IF NOT EXISTS `group_member` (
KEY `uid` (`uid`),
KEY `gid` (`gid`),
KEY `xchan` (`xchan`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `hook` (
`id` int(11) NOT NULL AUTO_INCREMENT,
@ -421,7 +421,7 @@ CREATE TABLE IF NOT EXISTS `item` (
`owner_xchan` char(255) NOT NULL DEFAULT '',
`author_xchan` char(255) NOT NULL DEFAULT '',
`mimetype` char(255) NOT NULL DEFAULT '',
`title` text NOT NULL DEFAULT '',
`title` text NOT NULL,
`body` mediumtext NOT NULL,
`app` char(255) NOT NULL DEFAULT '',
`lang` char(64) NOT NULL DEFAULT '',
@ -493,7 +493,7 @@ CREATE TABLE IF NOT EXISTS `item_id` (
KEY `sid` (`sid`),
KEY `service` (`service`),
KEY `iid` (`iid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `mail` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@ -504,6 +504,7 @@ CREATE TABLE IF NOT EXISTS `mail` (
`channel_id` int(10) unsigned NOT NULL,
`title` text NOT NULL,
`body` mediumtext NOT NULL,
`attach` mediumtext NOT NULL,
`mid` char(255) NOT NULL,
`parent_mid` char(255) NOT NULL,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
@ -535,7 +536,7 @@ CREATE TABLE IF NOT EXISTS `menu` (
PRIMARY KEY (`menu_id`),
KEY `menu_channel_id` (`menu_channel_id`),
KEY `menu_name` (`menu_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `menu_item` (
`mitem_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@ -550,10 +551,10 @@ CREATE TABLE IF NOT EXISTS `menu_item` (
`mitem_menu_id` int(10) unsigned NOT NULL DEFAULT '0',
`mitem_order` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`mitem_id`),
KEY `mitem_flags` (`mitem_flags`),
KEY `mitem_channel_id` (`mitem_channel_id`),
KEY `mitem_menu_id` (`mitem_menu_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
KEY `mitem_menu_id` (`mitem_menu_id`),
KEY `mitem_flags` (`mitem_flags`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `notify` (
`id` int(11) NOT NULL AUTO_INCREMENT,
@ -594,7 +595,7 @@ CREATE TABLE IF NOT EXISTS `obj` (
KEY `obj_type` (`obj_type`),
KEY `obj_channel` (`obj_channel`),
KEY `obj_obj` (`obj_obj`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `outq` (
`outq_hash` char(255) NOT NULL,
@ -657,7 +658,7 @@ CREATE TABLE IF NOT EXISTS `photo` (
KEY `album` (`album`),
KEY `scale` (`scale`),
KEY `profile` (`profile`),
KEY `photo_flags` (`photo_flags`),
KEY `photo_flags` (`photo_flags`),
KEY `type` (`type`),
KEY `aid` (`aid`),
KEY `xchan` (`xchan`),
@ -665,6 +666,29 @@ CREATE TABLE IF NOT EXISTS `photo` (
KEY `resource_id` (`resource_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `poll` (
`poll_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`poll_channel` int(10) unsigned NOT NULL DEFAULT '0',
`poll_desc` text NOT NULL,
`poll_flags` int(11) NOT NULL DEFAULT '0',
`poll_votes` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`poll_id`),
KEY `poll_channel` (`poll_channel`),
KEY `poll_flags` (`poll_flags`),
KEY `poll_votes` (`poll_votes`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `poll_elm` (
`pelm_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`pelm_poll` int(10) unsigned NOT NULL DEFAULT '0',
`pelm_desc` text NOT NULL,
`pelm_flags` int(11) NOT NULL DEFAULT '0',
`pelm_result` float NOT NULL DEFAULT '0',
PRIMARY KEY (`pelm_id`),
KEY `pelm_poll` (`pelm_poll`),
KEY `pelm_result` (`pelm_result`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `profile` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`profile_guid` char(64) NOT NULL DEFAULT '',
@ -675,7 +699,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
`hide_friends` tinyint(1) NOT NULL DEFAULT '0',
`name` char(255) NOT NULL,
`pdesc` char(255) NOT NULL,
`chandesc` text NOT NULL DEFAULT '',
`chandesc` text NOT NULL,
`dob` char(32) NOT NULL DEFAULT '0000-00-00',
`dob_tz` char(255) NOT NULL DEFAULT 'UTC',
`address` char(255) NOT NULL,
@ -769,7 +793,7 @@ CREATE TABLE IF NOT EXISTS `register` (
KEY `hash` (`hash`),
KEY `created` (`created`),
KEY `uid` (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `session` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
@ -841,7 +865,7 @@ CREATE TABLE IF NOT EXISTS `term` (
KEY `imgurl` (`imgurl`),
KEY `term_hash` (`term_hash`),
KEY `parent_hash` (`parent_hash`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tokens` (
`id` varchar(40) NOT NULL,
@ -876,7 +900,19 @@ CREATE TABLE IF NOT EXISTS `verify` (
KEY `token` (`token`),
KEY `meta` (`meta`),
KEY `created` (`created`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `vote` (
`vote_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`vote_poll` int(11) NOT NULL DEFAULT '0',
`vote_element` int(11) NOT NULL DEFAULT '0',
`vote_result` text NOT NULL,
`vote_xchan` char(255) NOT NULL DEFAULT '',
PRIMARY KEY (`vote_id`),
UNIQUE KEY `vote_vote` (`vote_poll`,`vote_element`,`vote_xchan`),
KEY `vote_poll` (`vote_poll`),
KEY `vote_element` (`vote_element`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `xchan` (
`xchan_hash` char(255) NOT NULL,
@ -901,10 +937,10 @@ CREATE TABLE IF NOT EXISTS `xchan` (
KEY `xchan_addr` (`xchan_addr`),
KEY `xchan_name` (`xchan_name`),
KEY `xchan_network` (`xchan_network`),
KEY `xchan_instance_url` (`xchan_instance_url`),
KEY `xchan_url` (`xchan_url`),
KEY `xchan_flags` (`xchan_flags`),
KEY `xchan_connurl` (`xchan_connurl`)
KEY `xchan_connurl` (`xchan_connurl`),
KEY `xchan_instance_url` (`xchan_instance_url`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `xconfig` (

View file

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1059 );
define( 'UPDATE_VERSION' , 1063 );
/**
*
@ -682,3 +682,63 @@ ADD INDEX ( `mitem_flags` ) ");
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1059() {
$r = q("ALTER TABLE `mail` ADD `attach` MEDIUMTEXT NOT NULL DEFAULT '' AFTER `body` ");
if($r)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1060() {
$r = q("CREATE TABLE IF NOT EXISTS `vote` (
`vote_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`vote_poll` int(11) NOT NULL DEFAULT '0',
`vote_element` int(11) NOT NULL DEFAULT '0',
`vote_result` text NOT NULL,
`vote_xchan` char(255) NOT NULL DEFAULT '',
PRIMARY KEY (`vote_id`),
UNIQUE KEY `vote_vote` (`vote_poll`,`vote_element`,`vote_xchan`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
if($r)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1061() {
$r = q("ALTER TABLE `vote` ADD INDEX ( `vote_poll` ), ADD INDEX ( `vote_element` ) ");
if($r)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1062() {
$r1 = q("CREATE TABLE IF NOT EXISTS `poll` (
`poll_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`poll_channel` INT UNSIGNED NOT NULL DEFAULT '0',
`poll_desc` TEXT NOT NULL DEFAULT '',
`poll_flags` INT NOT NULL DEFAULT '0',
`poll_votes` INT NOT NULL DEFAULT '0',
KEY `poll_channel` (`poll_channel`),
KEY `poll_flags` (`poll_flags`),
KEY `poll_votes` (`poll_votes`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
$r2 = q("CREATE TABLE IF NOT EXISTS `poll_elm` (
`pelm_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`pelm_poll` INT UNSIGNED NOT NULL DEFAULT '0',
`pelm_desc` TEXT NOT NULL DEFAULT '',
`pelm_flags` INT NOT NULL DEFAULT '0',
`pelm_result` FLOAT NOT NULL DEFAULT '0',
KEY `pelm_poll` (`pelm_poll`),
KEY `pelm_result` (`pelm_result`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
if($r1 && $r2)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}

View file

@ -206,10 +206,35 @@ function import_post(&$a) {
// import xchans and contact photos
if($seize) {
// replace our existing xchan if we're seizing control
$r = q("delete from xchan where xchan_hash = '%s' limit 1",
dbesc($channel['channel_hash'])
);
$r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_l, xchan_photo_m, xchan_photo_s, xchan_addr, xchan_url, xchan_name, xchan_network, xchan_photo_date, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
dbesc($channel['channel_hash']),
dbesc($channel['channel_guid']),
dbesc($channel['channel_guid_sig']),
dbesc($channel['channel_pubkey']),
dbesc($a->get_baseurl() . "/photo/profile/l/" . $channel['channel_id']),
dbesc($a->get_baseurl() . "/photo/profile/m/" . $channel['channel_id']),
dbesc($a->get_baseurl() . "/photo/profile/s/" . $channel['channel_id']),
dbesc($channel['channel_address'] . '@' . get_app()->get_hostname()),
dbesc(z_root() . '/channel/' . $channel['channel_address']),
dbesc($channel['channel_name']),
dbesc('zot'),
dbesc(datetime_convert()),
dbesc(datetime_convert())
);
}
$xchans = $data['xchan'];
if($xchans) {
foreach($xchans as $xchan) {
$r = q("select xchan_hash from xchan where xchan_hash = '%s' limit 1",
dbesc($xchan['xchan_hash'])
);

View file

@ -110,6 +110,7 @@ function like_content(&$a) {
$obj = json_encode(array(
'type' => $objtype,
'id' => $item['mid'],
'parent' => (($item['thr_parent']) ? $item['thr_parent'] : $item['parent_mid']),
'link' => $links,
'title' => $item['title'],
'content' => $item['body'],

View file

@ -249,7 +249,7 @@ function message_content(&$a) {
$a->page['htmlhead'] .= replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$nickname' => $channel['channel_addr'],
'$nickname' => $channel['channel_address'],
'$linkurl' => t('Please enter a link URL:')
));
@ -293,6 +293,7 @@ function message_content(&$a) {
'$select' => $select,
'$parent' => '',
'$upload' => t('Upload photo'),
'$attach' => t('Attach file'),
'$insert' => t('Insert web link'),
'$wait' => t('Please wait'),
'$submit' => t('Submit')
@ -371,10 +372,39 @@ function message_content(&$a) {
foreach($messages as $message) {
// FIXME
// $extracted = item_extract_images($message['body']);
// if($extracted['images'])
// $message['body'] = item_redir_and_replace_images($extracted['body'], $extracted['images'], $message['contact-id']);
$s = $arr = '';
if($message['attach'])
$arr = json_decode_plus($message['attach']);
if($arr) {
$s .= '<div class="body-attach">';
foreach($arr as $r) {
$matches = false;
$icon = '';
$icontype = substr($r['type'],0,strpos($r['type'],'/'));
switch($icontype) {
case 'video':
case 'audio':
case 'image':
case 'text':
$icon = '<div class="attachtype icon s22 type-' . $icontype . '"></div>';
break;
default:
$icon = '<div class="attachtype icon s22 type-unkn"></div>';
break;
}
$title = htmlentities($r['title'], ENT_COMPAT,'UTF-8');
if(! $title)
$title = t('unknown.???');
$title .= ' ' . $r['length'] . ' ' . t('bytes');
$url = $a->get_baseurl() . '/magic?f=&hash=' . $message['from_xchan'] . '&dest=' . $r['href'] . '/' . $r['revision'];
$s .= '<a href="' . $url . '" title="' . $title . '" class="attachlink" >' . $icon . '</a>';
}
$s .= '<div class="clear"></div></div>';
}
$mails[] = array(
'id' => $message['id'],
@ -385,7 +415,7 @@ function message_content(&$a) {
'to_url' => chanlink_hash($message['to_xchan']),
'to_photo' => $message['to']['xchan_photo_m'],
'subject' => $message['title'],
'body' => smilies(bbcode($message['body'])),
'body' => smilies(bbcode($message['body']) . $s),
'delete' => t('Delete message'),
'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A'),
);
@ -425,6 +455,7 @@ function message_content(&$a) {
'$select' => $select,
'$parent' => $parent,
'$upload' => t('Upload photo'),
'$attach' => t('Attach file'),
'$insert' => t('Insert web link'),
'$submit' => t('Submit'),
'$wait' => t('Please wait')

View file

@ -349,22 +349,23 @@ function settings_post(&$a) {
$post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0);
$post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0);
$arr = array();
$arr['channel_r_stream'] = (($_POST['view_stream']) ? $_POST['view_stream'] : 0);
$arr['channel_r_profile'] = (($_POST['view_profile']) ? $_POST['view_profile'] : 0);
$arr['channel_r_photos'] = (($_POST['view_photos']) ? $_POST['view_photos'] : 0);
$arr['channel_r_abook'] = (($_POST['view_contacts']) ? $_POST['view_contacts'] : 0);
$arr['channel_w_stream'] = (($_POST['send_stream']) ? $_POST['send_stream'] : 0);
$arr['channel_w_wall'] = (($_POST['post_wall']) ? $_POST['post_wall'] : 0);
$arr['channel_w_tagwall'] = (($_POST['tag_deliver']) ? $_POST['tag_deliver'] : 0);
$arr['channel_w_comment'] = (($_POST['post_comments']) ? $_POST['post_comments'] : 0);
$arr['channel_w_mail'] = (($_POST['post_mail']) ? $_POST['post_mail'] : 0);
$arr['channel_w_photos'] = (($_POST['post_photos']) ? $_POST['post_photos'] : 0);
$arr['channel_w_chat'] = (($_POST['chat']) ? $_POST['chat'] : 0);
$arr['channel_a_delegate'] = (($_POST['delegate']) ? $_POST['delegate'] : 0);
$arr['channel_r_storage'] = (($_POST['view_storage']) ? $_POST['view_storage'] : 0);
$arr['channel_w_storage'] = (($_POST['write_storage']) ? $_POST['write_storage'] : 0);
$arr['channel_r_pages'] = (($_POST['view_pages']) ? $_POST['view_pages'] : 0);
$arr['channel_r_stream'] = (($_POST['view_stream']) ? $_POST['view_stream'] : 0);
$arr['channel_r_profile'] = (($_POST['view_profile']) ? $_POST['view_profile'] : 0);
$arr['channel_r_photos'] = (($_POST['view_photos']) ? $_POST['view_photos'] : 0);
$arr['channel_r_abook'] = (($_POST['view_contacts']) ? $_POST['view_contacts'] : 0);
$arr['channel_w_stream'] = (($_POST['send_stream']) ? $_POST['send_stream'] : 0);
$arr['channel_w_wall'] = (($_POST['post_wall']) ? $_POST['post_wall'] : 0);
$arr['channel_w_tagwall'] = (($_POST['tag_deliver']) ? $_POST['tag_deliver'] : 0);
$arr['channel_w_comment'] = (($_POST['post_comments']) ? $_POST['post_comments'] : 0);
$arr['channel_w_mail'] = (($_POST['post_mail']) ? $_POST['post_mail'] : 0);
$arr['channel_w_photos'] = (($_POST['post_photos']) ? $_POST['post_photos'] : 0);
$arr['channel_w_chat'] = (($_POST['chat']) ? $_POST['chat'] : 0);
$arr['channel_a_delegate'] = (($_POST['delegate']) ? $_POST['delegate'] : 0);
$arr['channel_r_storage'] = (($_POST['view_storage']) ? $_POST['view_storage'] : 0);
$arr['channel_w_storage'] = (($_POST['write_storage']) ? $_POST['write_storage'] : 0);
$arr['channel_r_pages'] = (($_POST['view_pages']) ? $_POST['view_pages'] : 0);
$arr['channel_w_pages'] = (($_POST['write_pages']) ? $_POST['write_pages'] : 0);
$defperms = 0;

View file

@ -1 +1 @@
2013-08-18.409
2013-08-21.412

View file

@ -64,7 +64,7 @@ $a->config['system']['max_import_size'] = 200000;
// maximum size of uploaded photos
$a->config['system']['maximagesize'] = 800000;
$a->config['system']['maximagesize'] = 3000000;
// Location of PHP command line processor

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1882,6 +1882,7 @@ tr.mceLast {
margin-right: 30px;
}
#prvmail-upload-wrapper,
#prvmail-attach-wrapper,
#prvmail-link-wrapper,
#prvmail-rotator-wrapper {
float: left;

View file

@ -54,7 +54,19 @@ else
name: 'userfile',
onSubmit: function(file,ext) { $('#profile-rotator').spin('tiny'); },
onComplete: function(file,response) {
tinyMCE.execCommand('mceInsertRawHTML',false,response);
addeditortext(response);
$('#profile-rotator').spin(false);
}
}
);
var file_uploader = new window.AjaxUpload(
'prvmail-attach',
{ action: 'wall_attach/{{$nickname}}',
name: 'userfile',
onSubmit: function(file,ext) { $('#profile-rotator').spin('tiny'); },
onComplete: function(file,response) {
addeditortext(response);
$('#profile-rotator').spin(false);
}
}
@ -67,7 +79,7 @@ else
if(reply && reply.length) {
$('#profile-rotator').spin('tiny');
$.get('parse_url?url=' + reply, function(data) {
tinyMCE.execCommand('mceInsertRawHTML',false,data);
addeditortext(response);
$('#profile-rotator').spin(false);
});
}
@ -86,11 +98,22 @@ else
if(reply && reply.length) {
$('#profile-rotator').spin('tiny');
$.get('parse_url?url=' + reply, function(data) {
tinyMCE.execCommand('mceInsertRawHTML',false,data);
addeditortext(response);
$('#profile-rotator').spin(false);
});
}
}
function addeditortext(data) {
if(plaintext == 'none') {
var currentText = $("#prvmail-text").val();
$("#prvmail-text").val(currentText + data);
}
else
tinyMCE.execCommand('mceInsertRawHTML',false,data);
}
</script>

View file

@ -26,6 +26,12 @@
<div id="prvmail-upload-wrapper" >
<div id="prvmail-upload" class="icon border camera" title="{{$upload}}" ></div>
</div>
<div id="prvmail-attach-wrapper" >
<div id="prvmail-attach" class="icon attach" title="{{$attach}}" ></div>
</div>
<div id="prvmail-link-wrapper" >
<div id="prvmail-link" class="icon border link" title="{{$insert}}" onclick="jotGetLink();" ></div>
</div>