wall posts now display - address book structure revamp started
This commit is contained in:
parent
602960460a
commit
794c92a8fb
@ -284,9 +284,10 @@ CREATE TABLE IF NOT EXISTS `deliverq` (
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `event` (
|
CREATE TABLE IF NOT EXISTS `event` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`account` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
`uid` int(11) NOT NULL,
|
`uid` int(11) NOT NULL,
|
||||||
`cid` int(11) NOT NULL,
|
`cid` int(11) NOT NULL,
|
||||||
`uri` char(255) NOT NULL,
|
`message_id` char(255) NOT NULL,
|
||||||
`created` datetime NOT NULL,
|
`created` datetime NOT NULL,
|
||||||
`edited` datetime NOT NULL,
|
`edited` datetime NOT NULL,
|
||||||
`start` datetime NOT NULL,
|
`start` datetime NOT NULL,
|
||||||
@ -305,13 +306,14 @@ CREATE TABLE IF NOT EXISTS `event` (
|
|||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `uid` (`uid`),
|
KEY `uid` (`uid`),
|
||||||
KEY `cid` (`cid`),
|
KEY `cid` (`cid`),
|
||||||
KEY `uri` (`uri`),
|
KEY `uri` (`message_id`),
|
||||||
KEY `type` (`type`),
|
KEY `type` (`type`),
|
||||||
KEY `start` (`start`),
|
KEY `start` (`start`),
|
||||||
KEY `finish` (`finish`),
|
KEY `finish` (`finish`),
|
||||||
KEY `adjust` (`adjust`),
|
KEY `adjust` (`adjust`),
|
||||||
KEY `nofinish` (`nofinish`),
|
KEY `nofinish` (`nofinish`),
|
||||||
KEY `ignore` (`ignore`)
|
KEY `ignore` (`ignore`),
|
||||||
|
KEY `account` (`account`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `fcontact` (
|
CREATE TABLE IF NOT EXISTS `fcontact` (
|
||||||
|
@ -209,7 +209,7 @@ function event_store($arr) {
|
|||||||
$arr['edited'] = (($arr['edited']) ? $arr['edited'] : datetime_convert());
|
$arr['edited'] = (($arr['edited']) ? $arr['edited'] : datetime_convert());
|
||||||
$arr['type'] = (($arr['type']) ? $arr['type'] : 'event' );
|
$arr['type'] = (($arr['type']) ? $arr['type'] : 'event' );
|
||||||
$arr['cid'] = ((intval($arr['cid'])) ? intval($arr['cid']) : 0);
|
$arr['cid'] = ((intval($arr['cid'])) ? intval($arr['cid']) : 0);
|
||||||
$arr['uri'] = (x($arr,'uri') ? $arr['uri'] : item_message_id());
|
$arr['message_id'] = (x($arr,'message_id') ? $arr['message_id'] : get_message_id());
|
||||||
$arr['private'] = ((x($arr,'private')) ? intval($arr['private']) : 0);
|
$arr['private'] = ((x($arr,'private')) ? intval($arr['private']) : 0);
|
||||||
|
|
||||||
if($arr['cid'])
|
if($arr['cid'])
|
||||||
@ -286,7 +286,7 @@ function event_store($arr) {
|
|||||||
intval($arr['uid'])
|
intval($arr['uid'])
|
||||||
);
|
);
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
$object = '<object><type>' . xmlify(ACTIVITY_OBJ_EVENT) . '</type><title></title><id>' . xmlify($arr['uri']) . '</id>';
|
$object = '<object><type>' . xmlify(ACTIVITY_OBJ_EVENT) . '</type><title></title><id>' . xmlify($arr['message_id']) . '</id>';
|
||||||
$object .= '<content>' . xmlify(format_event_bbcode($arr)) . '</content>';
|
$object .= '<content>' . xmlify(format_event_bbcode($arr)) . '</content>';
|
||||||
$object .= '</object>' . "\n";
|
$object .= '</object>' . "\n";
|
||||||
|
|
||||||
@ -317,9 +317,10 @@ function event_store($arr) {
|
|||||||
|
|
||||||
// New event. Store it.
|
// New event. Store it.
|
||||||
|
|
||||||
$r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`,
|
$r = q("INSERT INTO `event` ( `uid`,`account`,`cid`,`message_id`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`,
|
||||||
`adjust`,`nofinish`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`)
|
`adjust`,`nofinish`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`)
|
||||||
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
|
VALUES ( %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
|
||||||
|
intval($arr['account']),
|
||||||
intval($arr['uid']),
|
intval($arr['uid']),
|
||||||
intval($arr['cid']),
|
intval($arr['cid']),
|
||||||
dbesc($arr['uri']),
|
dbesc($arr['uri']),
|
||||||
@ -340,8 +341,8 @@ function event_store($arr) {
|
|||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$r = q("SELECT * FROM `event` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
$r = q("SELECT * FROM `event` WHERE `hash` = '%s' AND `uid` = %d LIMIT 1",
|
||||||
dbesc($arr['uri']),
|
dbesc($arr['hash']),
|
||||||
intval($arr['uid'])
|
intval($arr['uid'])
|
||||||
);
|
);
|
||||||
if(count($r))
|
if(count($r))
|
||||||
@ -349,10 +350,11 @@ function event_store($arr) {
|
|||||||
|
|
||||||
$item_arr = array();
|
$item_arr = array();
|
||||||
|
|
||||||
|
|
||||||
$item_arr['uid'] = $arr['uid'];
|
$item_arr['uid'] = $arr['uid'];
|
||||||
$item_arr['contact-id'] = $arr['cid'];
|
$item_arr['contact-id'] = $arr['cid'];
|
||||||
$item_arr['uri'] = $arr['uri'];
|
$item_arr['uri'] = $arr['message_id'];
|
||||||
$item_arr['parent_uri'] = $arr['uri'];
|
$item_arr['parent_uri'] = $arr['message_id'];
|
||||||
$item_arr['type'] = 'activity';
|
$item_arr['type'] = 'activity';
|
||||||
$item_arr['wall'] = (($arr['cid']) ? 0 : 1);
|
$item_arr['wall'] = (($arr['cid']) ? 0 : 1);
|
||||||
$item_arr['contact-id'] = $contact['id'];
|
$item_arr['contact-id'] = $contact['id'];
|
||||||
@ -376,7 +378,7 @@ function event_store($arr) {
|
|||||||
$item_arr['body'] = format_event_bbcode($event);
|
$item_arr['body'] = format_event_bbcode($event);
|
||||||
|
|
||||||
|
|
||||||
$item_arr['object'] = '<object><type>' . xmlify(ACTIVITY_OBJ_EVENT) . '</type><title></title><id>' . xmlify($arr['uri']) . '</id>';
|
$item_arr['object'] = '<object><type>' . xmlify(ACTIVITY_OBJ_EVENT) . '</type><title></title><id>' . xmlify($arr['message_id']) . '</id>';
|
||||||
$item_arr['object'] .= '<content>' . xmlify(format_event_bbcode($event)) . '</content>';
|
$item_arr['object'] .= '<content>' . xmlify(format_event_bbcode($event)) . '</content>';
|
||||||
$item_arr['object'] .= '</object>' . "\n";
|
$item_arr['object'] .= '</object>' . "\n";
|
||||||
|
|
||||||
|
@ -110,14 +110,17 @@ function create_identity($arr) {
|
|||||||
|
|
||||||
$newuid = $ret['channel']['channel_id'];
|
$newuid = $ret['channel']['channel_id'];
|
||||||
|
|
||||||
$r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_photo, xchan_addr, xchan_profile, xchan_name ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s')",
|
$r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_photo, xchan_addr, xchan_profile, xchan_name, xchan_network, xchan_photo_date, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
|
||||||
dbesc($hash),
|
dbesc($hash),
|
||||||
dbesc($ret['channel']['channel_guid']),
|
dbesc($ret['channel']['channel_guid']),
|
||||||
dbesc($sig),
|
dbesc($sig),
|
||||||
dbesc($a->get_baseurl() . "/photo/profile/{$newuid}"),
|
dbesc($a->get_baseurl() . "/photo/profile/{$newuid}"),
|
||||||
dbesc($ret['channel']['channel_address'] . '@' . $a->get_hostname()),
|
dbesc($ret['channel']['channel_address'] . '@' . $a->get_hostname()),
|
||||||
dbesc(z_root() . '/profile/' . $ret['channel']['channel_address']),
|
dbesc(z_root() . '/profile/' . $ret['channel']['channel_address']),
|
||||||
dbesc($ret['channel']['channel_name'])
|
dbesc($ret['channel']['channel_name']),
|
||||||
|
dbesc('zot'),
|
||||||
|
dbesc(datetime_convert()),
|
||||||
|
dbesc(datetime_convert())
|
||||||
);
|
);
|
||||||
|
|
||||||
// Not checking return value.
|
// Not checking return value.
|
||||||
@ -135,21 +138,6 @@ function create_identity($arr) {
|
|||||||
dbesc($a->get_baseurl() . "/photo/avatar/{$newuid}")
|
dbesc($a->get_baseurl() . "/photo/avatar/{$newuid}")
|
||||||
);
|
);
|
||||||
|
|
||||||
$r = q("INSERT INTO `contact` ( `aid`, `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, `name_date`, `uri_date`, `avatar_date`, `closeness` )
|
|
||||||
VALUES ( %d, %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', 0 ) ",
|
|
||||||
intval($ret['channel']['channel_account_id']),
|
|
||||||
intval($newuid),
|
|
||||||
datetime_convert(),
|
|
||||||
dbesc($ret['channel']['channel_name']),
|
|
||||||
dbesc($ret['channel']['channel_address']),
|
|
||||||
dbesc($a->get_baseurl() . "/photo/profile/{$newuid}"),
|
|
||||||
dbesc($a->get_baseurl() . "/photo/avatar/{$newuid}"),
|
|
||||||
dbesc($a->get_baseurl() . "/photo/micro/{$newuid}"),
|
|
||||||
dbesc($a->get_baseurl() . "/profile/{$ret['channel']['channel_address']}"),
|
|
||||||
dbesc(datetime_convert()),
|
|
||||||
dbesc(datetime_convert()),
|
|
||||||
dbesc(datetime_convert())
|
|
||||||
);
|
|
||||||
|
|
||||||
// Create a group with no members. This allows somebody to use it
|
// Create a group with no members. This allows somebody to use it
|
||||||
// right away as a default group for new contacts.
|
// right away as a default group for new contacts.
|
||||||
|
@ -104,7 +104,7 @@ ACPopup.prototype._search = function(){
|
|||||||
else {
|
else {
|
||||||
txt = tinyMCE.activeEditor.getContent();
|
txt = tinyMCE.activeEditor.getContent();
|
||||||
// alert(that.searchText + ':' + t);
|
// alert(that.searchText + ':' + t);
|
||||||
newtxt = txt.replace(that.searchText,t+' ');
|
newtxt = txt.replace('@' + that.searchText, '@' + t + ' ');
|
||||||
tinyMCE.activeEditor.setContent(newtxt);
|
tinyMCE.activeEditor.setContent(newtxt);
|
||||||
tinyMCE.activeEditor.focus();
|
tinyMCE.activeEditor.focus();
|
||||||
that.close();
|
that.close();
|
||||||
|
@ -97,11 +97,7 @@ function display_content(&$a) {
|
|||||||
|
|
||||||
$sql_extra = item_permissions_sql($a->profile['uid'],$remote_contact,$groups);
|
$sql_extra = item_permissions_sql($a->profile['uid'],$remote_contact,$groups);
|
||||||
|
|
||||||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
|
$r = q("SELECT `item`.*, `item`.`id` AS `item_id` FROM `item`
|
||||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
|
||||||
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
|
||||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
|
||||||
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
|
||||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
||||||
and `item`.`moderated` = 0
|
and `item`.`moderated` = 0
|
||||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||||
|
@ -106,6 +106,7 @@ function events_post(&$a) {
|
|||||||
|
|
||||||
|
|
||||||
$datarray = array();
|
$datarray = array();
|
||||||
|
$datarray['hash'] = random_string();
|
||||||
$datarray['start'] = $start;
|
$datarray['start'] = $start;
|
||||||
$datarray['finish'] = $finish;
|
$datarray['finish'] = $finish;
|
||||||
$datarray['summary'] = $summary;
|
$datarray['summary'] = $summary;
|
||||||
|
51
mod/item.php
51
mod/item.php
@ -310,6 +310,8 @@ function item_post(&$a) {
|
|||||||
|
|
||||||
// get contact info for poster
|
// get contact info for poster
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
$author = null;
|
$author = null;
|
||||||
$self = false;
|
$self = false;
|
||||||
$contact_id = 0;
|
$contact_id = 0;
|
||||||
@ -355,6 +357,8 @@ function item_post(&$a) {
|
|||||||
$contact_record = $r[0];
|
$contact_record = $r[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
$post_type = notags(trim($_REQUEST['type']));
|
$post_type = notags(trim($_REQUEST['type']));
|
||||||
|
|
||||||
|
|
||||||
@ -382,7 +386,7 @@ function item_post(&$a) {
|
|||||||
$image_uri = substr($image_uri,0, strpos($image_uri,'-'));
|
$image_uri = substr($image_uri,0, strpos($image_uri,'-'));
|
||||||
if(! strlen($image_uri))
|
if(! strlen($image_uri))
|
||||||
continue;
|
continue;
|
||||||
$srch = '<' . intval($contact_id) . '>';
|
$srch = '<' . $owner_xchan['xchan_hash'] . '>';
|
||||||
|
|
||||||
$r = q("SELECT `id` FROM `photo` WHERE `allow_cid` = '%s' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = ''
|
$r = q("SELECT `id` FROM `photo` WHERE `allow_cid` = '%s' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = ''
|
||||||
AND `resource_id` = '%s' AND `uid` = %d LIMIT 1",
|
AND `resource_id` = '%s' AND `uid` = %d LIMIT 1",
|
||||||
@ -421,19 +425,19 @@ function item_post(&$a) {
|
|||||||
$attaches = $match[1];
|
$attaches = $match[1];
|
||||||
if(count($attaches)) {
|
if(count($attaches)) {
|
||||||
foreach($attaches as $attach) {
|
foreach($attaches as $attach) {
|
||||||
$r = q("SELECT * FROM `attach` WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
$r = q("select * from attach where uid = %d and hash = '%s' limit 1",
|
||||||
intval($profile_uid),
|
intval($profile_uid),
|
||||||
intval($attach)
|
dbesc($attach)
|
||||||
);
|
);
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
$r = q("UPDATE `attach` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
|
$r = q("UPDATE `attach` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
|
||||||
WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
WHERE `uid` = %d AND `hash` = '%s' LIMIT 1",
|
||||||
dbesc($str_contact_allow),
|
dbesc($str_contact_allow),
|
||||||
dbesc($str_group_allow),
|
dbesc($str_group_allow),
|
||||||
dbesc($str_contact_deny),
|
dbesc($str_contact_deny),
|
||||||
dbesc($str_group_deny),
|
dbesc($str_group_deny),
|
||||||
intval($profile_uid),
|
intval($profile_uid),
|
||||||
intval($attach)
|
dbesc($attach)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -486,11 +490,11 @@ function item_post(&$a) {
|
|||||||
if($success['replaced']) {
|
if($success['replaced']) {
|
||||||
$tagged[] = $tag;
|
$tagged[] = $tag;
|
||||||
$post_tags[] = array(
|
$post_tags[] = array(
|
||||||
'uid' => $profile_uid,
|
'uid' => $profile_uid,
|
||||||
'type' => $success['termtype'],
|
'type' => $success['termtype'],
|
||||||
'otype' => TERM_OBJ_POST,
|
'otype' => TERM_OBJ_POST,
|
||||||
'term' => substr($tag,1),
|
'term' => substr($tag,1),
|
||||||
'url' => $success['url']
|
'url' => $success['url']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if(is_array($success['contact']) && intval($success['contact']['prv'])) {
|
if(is_array($success['contact']) && intval($success['contact']['prv'])) {
|
||||||
@ -504,11 +508,11 @@ function item_post(&$a) {
|
|||||||
$cats = explode(',',$categories);
|
$cats = explode(',',$categories);
|
||||||
foreach($cats as $cat) {
|
foreach($cats as $cat) {
|
||||||
$post_tags[] = array(
|
$post_tags[] = array(
|
||||||
'uid' => $profile_uid,
|
'uid' => $profile_uid,
|
||||||
'type' => TERM_CATEGORY,
|
'type' => TERM_CATEGORY,
|
||||||
'otype' => TERM_OBJ_POST,
|
'otype' => TERM_OBJ_POST,
|
||||||
'term' => trim($cat),
|
'term' => trim($cat),
|
||||||
'url' => ''
|
'url' => ''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -527,20 +531,20 @@ function item_post(&$a) {
|
|||||||
|
|
||||||
if(preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$body,$match)) {
|
if(preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$body,$match)) {
|
||||||
foreach($match[2] as $mtch) {
|
foreach($match[2] as $mtch) {
|
||||||
$r = q("SELECT `id`,`filename`,`filesize`,`filetype` FROM `attach` WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
$r = q("SELECT `hash`,`filename`,`filesize`,`filetype` FROM `attach` WHERE `uid` = %d AND `hash` = '%s' LIMIT 1",
|
||||||
intval($profile_uid),
|
intval($profile_uid),
|
||||||
intval($mtch)
|
dbesc($mtch)
|
||||||
);
|
);
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
if(strlen($attachments))
|
if(strlen($attachments))
|
||||||
$attachments .= ',';
|
$attachments .= ',';
|
||||||
$attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r[0]['id'] . '" length="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : '') . '"[/attach]';
|
$attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r[0]['hash'] . '" length="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : '') . '"[/attach]';
|
||||||
}
|
}
|
||||||
$body = str_replace($match[1],'',$body);
|
$body = str_replace($match[1],'',$body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$item_flags = 0;
|
$item_flags = ITEM_UNSEEN;
|
||||||
$item_restrict = ITEM_VISIBLE;
|
$item_restrict = ITEM_VISIBLE;
|
||||||
|
|
||||||
if($post_type === 'wall' || $post_type === 'wall-comment')
|
if($post_type === 'wall' || $post_type === 'wall-comment')
|
||||||
@ -553,6 +557,8 @@ function item_post(&$a) {
|
|||||||
$item_restrict = $item_restrict | ITEM_MODERATED;
|
$item_restrict = $item_restrict | ITEM_MODERATED;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(! strlen($verb))
|
if(! strlen($verb))
|
||||||
$verb = ACTIVITY_POST ;
|
$verb = ACTIVITY_POST ;
|
||||||
|
|
||||||
@ -573,8 +579,7 @@ function item_post(&$a) {
|
|||||||
$item_flags = $item_flags | ITEM_THREAD_TOP;
|
$item_flags = $item_flags | ITEM_THREAD_TOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
$datarray['aid'] = get_account_id(); // fixme
|
$datarray['aid'] = $channel['account_id'];
|
||||||
|
|
||||||
$datarray['uid'] = $profile_uid;
|
$datarray['uid'] = $profile_uid;
|
||||||
|
|
||||||
$datarray['owner_xchan'] = $owner_xchan['xchan_hash'];
|
$datarray['owner_xchan'] = $owner_xchan['xchan_hash'];
|
||||||
@ -601,11 +606,15 @@ function item_post(&$a) {
|
|||||||
$datarray['attach'] = $attachments;
|
$datarray['attach'] = $attachments;
|
||||||
$datarray['thr_parent'] = $thr_parent;
|
$datarray['thr_parent'] = $thr_parent;
|
||||||
$datarray['postopts'] = '';
|
$datarray['postopts'] = '';
|
||||||
|
$datarray['item_restrict'] = $item_restrict;
|
||||||
|
$datarray['item_flags'] = $item_flags;
|
||||||
|
|
||||||
|
|
||||||
// preview mode - prepare the body for display and send it via json
|
// preview mode - prepare the body for display and send it via json
|
||||||
|
|
||||||
if($preview) {
|
if($preview) {
|
||||||
require_once('include/conversation.php');
|
require_once('include/conversation.php');
|
||||||
|
// fixme
|
||||||
$o = conversation($a,array(array_merge($contact_record,$datarray)),'search',false,'preview');
|
$o = conversation($a,array(array_merge($contact_record,$datarray)),'search',false,'preview');
|
||||||
logger('preview: ' . $o, LOGGER_DEBUG);
|
logger('preview: ' . $o, LOGGER_DEBUG);
|
||||||
echo json_encode(array('preview' => $o));
|
echo json_encode(array('preview' => $o));
|
||||||
@ -716,7 +725,7 @@ function item_post(&$a) {
|
|||||||
intval($parent_item['private']),
|
intval($parent_item['private']),
|
||||||
intval($post_id)
|
intval($post_id)
|
||||||
);
|
);
|
||||||
|
//fixme
|
||||||
if($contact_record != $author) {
|
if($contact_record != $author) {
|
||||||
notification(array(
|
notification(array(
|
||||||
'type' => NOTIFY_COMMENT,
|
'type' => NOTIFY_COMMENT,
|
||||||
@ -741,7 +750,7 @@ function item_post(&$a) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$parent = $post_id;
|
$parent = $post_id;
|
||||||
|
//fixme
|
||||||
if($contact_record != $author) {
|
if($contact_record != $author) {
|
||||||
notification(array(
|
notification(array(
|
||||||
'type' => NOTIFY_WALL,
|
'type' => NOTIFY_WALL,
|
||||||
|
@ -177,16 +177,13 @@ function profile_content(&$a, $update = 0) {
|
|||||||
|
|
||||||
if($update) {
|
if($update) {
|
||||||
|
|
||||||
$r = q("SELECT distinct(parent) AS `item_id`, `contact`.`uid` AS `contact-uid`
|
$r = q("SELECT distinct(parent) AS `item_id` from item
|
||||||
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
WHERE uid = %d AND item_restrict = 0
|
||||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND
|
AND item_flags & %d
|
||||||
(`item`.`deleted` = 0 OR item.verb = '" . ACTIVITY_LIKE ."' OR item.verb = '" . ACTIVITY_DISLIKE . "')
|
|
||||||
and `item`.`moderated` = 0 and `item`.`unseen` = 1
|
|
||||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
|
||||||
AND `item`.`wall` = 1
|
|
||||||
$sql_extra
|
$sql_extra
|
||||||
ORDER BY `item`.`created` DESC",
|
ORDER BY created DESC",
|
||||||
intval($a->profile['profile_uid'])
|
intval($a->profile['profile_uid']),
|
||||||
|
intval(ITEM_WALL)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -208,14 +205,13 @@ function profile_content(&$a, $update = 0) {
|
|||||||
|
|
||||||
$pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
|
$pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
|
||||||
|
|
||||||
$r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact-uid`
|
$r = q("SELECT id AS item_id FROM item
|
||||||
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
WHERE uid = %d AND item_restrict = 0
|
||||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
AND item_flags & %d
|
||||||
and `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
|
||||||
AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1
|
|
||||||
$sql_extra $sql_extra2
|
$sql_extra $sql_extra2
|
||||||
ORDER BY `item`.`created` DESC $pager_sql ",
|
ORDER BY created DESC $pager_sql ",
|
||||||
intval($a->profile['profile_uid'])
|
intval($a->profile['profile_uid']),
|
||||||
|
intval(ITEM_WALL|ITEM_THREAD_TOP)
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -225,21 +221,16 @@ function profile_content(&$a, $update = 0) {
|
|||||||
|
|
||||||
$parents_str = ids_to_querystr($r,'item_id');
|
$parents_str = ids_to_querystr($r,'item_id');
|
||||||
|
|
||||||
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`,
|
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`
|
||||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`network`, `contact`.`rel`,
|
FROM `item`
|
||||||
`contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
WHERE `item`.`uid` = %d AND `item`.`item_restrict` = 0
|
||||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
|
||||||
FROM `item`, `contact`
|
|
||||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
|
||||||
and `item`.`moderated` = 0
|
|
||||||
AND `contact`.`id` = `item`.`contact-id`
|
|
||||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
|
||||||
AND `item`.`parent` IN ( %s )
|
AND `item`.`parent` IN ( %s )
|
||||||
$sql_extra ",
|
$sql_extra ",
|
||||||
intval($a->profile['profile_uid']),
|
intval($a->profile['profile_uid']),
|
||||||
dbesc($parents_str)
|
dbesc($parents_str)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
xchan_query($items);
|
||||||
$items = fetch_post_tags($items);
|
$items = fetch_post_tags($items);
|
||||||
$items = conv_sort($items,'created');
|
$items = conv_sort($items,'created');
|
||||||
|
|
||||||
@ -260,8 +251,10 @@ function profile_content(&$a, $update = 0) {
|
|||||||
|
|
||||||
|
|
||||||
if($is_owner) {
|
if($is_owner) {
|
||||||
$r = q("UPDATE `item` SET `unseen` = 0
|
$r = q("UPDATE `item` SET `item_flags` = item_flags - %d
|
||||||
WHERE `wall` = 1 AND `unseen` = 1 AND `uid` = %d",
|
WHERE item_flags & %d AND `uid` = %d",
|
||||||
|
intval(ITEM_UNSEEN),
|
||||||
|
intval(ITEM_UNSEEN|ITEM_WALL),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ function wall_attach_post(&$a) {
|
|||||||
if(local_user() && intval(get_pconfig(local_user(),'system','plaintext')))
|
if(local_user() && intval(get_pconfig(local_user(),'system','plaintext')))
|
||||||
$lf = "\n";
|
$lf = "\n";
|
||||||
|
|
||||||
echo $lf . $lf . '[attachment]' . $r[0]['id'] . '[/attachment]' . $lf;
|
echo $lf . $lf . '[attachment]' . $r[0]['hash'] . '[/attachment]' . $lf;
|
||||||
|
|
||||||
killme();
|
killme();
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
|
@ -1 +1 @@
|
|||||||
2012-10-08.101
|
2012-10-10.103
|
||||||
|
Reference in New Issue
Block a user