CREATE TABLE IF NOT EXISTS `thread` (
`iid` int(10) unsigned NOT NULL DEFAULT '0',
`uid` int(10) unsigned NOT NULL DEFAULT '0',
- `contact-id` int(10) unsigned NOT NULL DEFAULT '0',
+ `contact-id` int(11) unsigned NOT NULL DEFAULT '0',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`mention` tinyint(1) NOT NULL DEFAULT '0',
`network` char(32) NOT NULL,
PRIMARY KEY (`iid`),
- KEY `uid` (`uid`),
- KEY `contact-id` (`contact-id`),
KEY `created` (`created`),
- KEY `edited` (`edited`),
KEY `commented` (`commented`),
- KEY `received` (`received`),
- KEY `changed` (`changed`),
- KEY `network` (`network`),
- KEY `visible_deleted_moderated_private_wall_received` (`visible`,`deleted`,`moderated`,`private`,`wall`,`received`),
- KEY `uid_visible_deleted_moderated_created` (`uid`,`visible`,`deleted`,`moderated`,`created`),
- KEY `uid_visible_deleted_moderated_commented` (`uid`,`visible`,`deleted`,`moderated`,`commented`)
+ KEY `uid_network_commented` (`uid`,`network`,`commented`),
+ KEY `uid_network_created` (`uid`,`network`,`created`),
+ KEY `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
+ KEY `uid_contactid_created` (`uid`,`contact-id`,`created`),
+ KEY `wall_private_received` (`wall`,`private`,`received`),
+ KEY `uid_created` (`uid`,`created`),
+ KEY `uid_commented` (`uid`,`commented`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
//AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`=''",
// count public wall messages
- $r = q("SELECT count(*) as `count` FROM `item` force index (uid_type)
+ $r = q("SELECT count(*) as `count` FROM `item`
WHERE `uid` = %d
AND `type`='wall'",
intval($uinfo[0]['uid'])
require_once('include/crypto.php');
require_once('include/Photo.php');
require_once('include/tags.php');
+require_once('include/files.php');
require_once('include/text.php');
require_once('include/email.php');
require_once('include/ostatus_conversation.php');
$check_date = datetime_convert('UTC','UTC',$last_update,'Y-m-d H:i:s');
+ // AND ( `item`.`edited` > '%s' OR `item`.`changed` > '%s' )
+ // dbesc($check_date),
+
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`network`, `contact`.`photo`, `contact`.`url`,
`contact`.`name-date`, `contact`.`uri-date`, `contact`.`avatar-date`,
`contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
`contact`.`id` AS `contact-id`, `contact`.`uid` AS `contact-uid`,
`sign`.`signed_text`, `sign`.`signature`, `sign`.`signer`
- FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` = `item`.`uid`
+ FROM `item`
+ INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
+ AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`parent` != 0
- AND `item`.`wall` = 1 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
- AND ( `item`.`edited` > '%s' OR `item`.`changed` > '%s' )
+ AND `item`.`wall` = 1 AND `item`.`changed` > '%s'
$sql_extra
ORDER BY `parent` %s, `created` ASC LIMIT 0, 300",
intval($owner_id),
dbesc($check_date),
- dbesc($check_date),
dbesc($sort)
);
$res['edited'] = unxmlify($rawedited[0]['data']);
if((x($res,'edited')) && (! (x($res,'created'))))
- $res['created'] = $res['edited'];
+ $res['created'] = $res['edited'];
if(! $res['created'])
$res['created'] = $item->get_date('c');
if(count($r)) {
$current_post = $r[0]['id'];
logger('item_store: created item ' . $current_post);
- create_tags_from_item($r[0]['id']);
// Only check for notifications on start posts
if ($arr['parent-uri'] === $arr['uri']) {
intval($parent_deleted),
intval($current_post)
);
- create_tags_from_item($current_post);
// Complete ostatus threads
if ($ostatus_conversation)
logger('item_store: put item '.$current_post.' into cachefile '.$cachefile);
}
- $r = q('SELECT * FROM `item` WHERE id = %d', intval($current_post));
- if (count($r) == 1) {
- call_hooks('post_remote_end', $r[0]);
- }
- else {
- logger('item_store: new item not found in DB, id ' . $current_post);
- }
+ $r = q('SELECT * FROM `item` WHERE id = %d', intval($current_post));
+ if (count($r) == 1) {
+ call_hooks('post_remote_end', $r[0]);
+ } else {
+ logger('item_store: new item not found in DB, id ' . $current_post);
+ }
}
+
+ create_tags_from_item($current_post);
+ create_files_from_item($current_post);
+
return $current_post;
}
-
+// return - test
function get_item_contact($item,$contacts) {
if(! count($contacts) || (! is_array($item)))
return false;
* thing regardless of feed ordering. This won't be adequate in a fully-threaded
* model where comments can have sub-threads. That would require some massive sorting
* to get all the feed items into a mostly linear ordering, and might still require
- * recursion.
+ * recursion.
*/
function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) {
intval($importer['uid'])
);
create_tags_from_itemuri($item['uri'], $importer['uid']);
+ create_files_from_itemuri($item['uri'], $importer['uid']);
update_thread_uri($item['uri'], $importer['uid']);
}
else {
intval($importer['uid'])
);
create_tags_from_itemuri($uri, $importer['uid']);
+ create_files_from_itemuri($uri, $importer['uid']);
if($item['last-child']) {
// ensure that last-child is set in case the comment that had it just got wiped.
q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d ",
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",
+ $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s', `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
dbesc($datarray['title']),
dbesc($datarray['body']),
dbesc($datarray['tag']),
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
+ dbesc(datetime_convert()),
dbesc($item_id),
intval($importer['uid'])
);
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",
+ $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s', `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
dbesc($datarray['title']),
dbesc($datarray['body']),
dbesc($datarray['tag']),
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
+ dbesc(datetime_convert()),
dbesc($item_id),
intval($importer['uid'])
);
intval($importer['importer_uid'])
);
create_tags_from_itemuri($item['uri'], $importer['importer_uid']);
+ create_files_from_itemuri($item['uri'], $importer['importer_uid']);
update_thread_uri($item['uri'], $importer['importer_uid']);
}
else {
intval($importer['importer_uid'])
);
create_tags_from_itemuri($uri, $importer['importer_uid']);
+ create_files_from_itemuri($uri, $importer['importer_uid']);
update_thread_uri($uri, $importer['importer_uid']);
if($item['last-child']) {
// ensure that last-child is set in case the comment that had it just got wiped.
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",
+ $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s', `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
dbesc($datarray['title']),
dbesc($datarray['body']),
dbesc($datarray['tag']),
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
+ dbesc(datetime_convert()),
dbesc($item_id),
intval($importer['importer_uid'])
);
intval($importer['importer_uid'])
);
if(count($i) && ! intval($i[0]['blocktags'])) {
- q("UPDATE item SET tag = '%s', `edited` = '%s' WHERE id = %d",
+ q("UPDATE item SET tag = '%s', `edited` = '%s', `changed` = '%s' WHERE id = %d",
dbesc($tagp[0]['tag'] . (strlen($tagp[0]['tag']) ? ',' : '') . $newtag),
intval($tagp[0]['id']),
+ dbesc(datetime_convert()),
dbesc(datetime_convert())
);
create_tags_from_item($tagp[0]['id']);
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",
+ $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s', `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
dbesc($datarray['title']),
dbesc($datarray['body']),
dbesc($datarray['tag']),
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
+ dbesc(datetime_convert()),
dbesc($item_id),
intval($importer['importer_uid'])
);
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",
+ $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s', `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
dbesc($datarray['title']),
dbesc($datarray['body']),
dbesc($datarray['tag']),
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
+ dbesc(datetime_convert()),
dbesc($item_id),
intval($importer['importer_uid'])
);
$mentioned = get_mentions($item);
if($mentioned)
$o .= $mentioned;
-
+
call_hooks('atom_entry', $o);
$o .= '</entry>' . "\r\n";
-
+
return $o;
}
}
-
+
function item_expire($uid,$days) {
if((! $uid) || ($days < 1))
intval($item['id'])
);
create_tags_from_item($item['id']);
+ create_files_from_item($item['id']);
delete_thread($item['id']);
// clean up categories and tags so they don't end up as orphans
intval($item['uid'])
);
create_tags_from_item($item['parent-uri'], $item['uid']);
+ create_files_from_item($item['parent-uri'], $item['uid']);
delete_thread_uri($item['parent-uri'], $item['uid']);
// ignore the result
}
$sql_extra = item_permissions_sql($a->profile['uid'],$remote_contact,$groups);
+ // AND `item`.`parent` = ( SELECT `parent` FROM `item` FORCE INDEX (PRIMARY, `uri`) WHERE ( `id` = '%s' OR `uri` = '%s' ))
+
if($update) {
$r = q("SELECT id FROM item WHERE item.uid = %d
- AND `item`.`parent` = ( SELECT `parent` FROM `item` FORCE INDEX (PRIMARY, `uri`) WHERE ( `id` = '%s' OR `uri` = '%s' ))
+ AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE (`id` = '%s' OR `uri` = '%s'))
$sql_extra AND unseen = 1",
intval($a->profile['uid']),
dbesc($item_id),
- dbesc($item_id)
+ dbesc($item_id)
);
if(!$r)
return '';
}
+ // AND `item`.`parent` = ( SELECT `parent` FROM `item` FORCE INDEX (PRIMARY, `uri`) WHERE ( `id` = '%s' OR `uri` = '%s' )
+
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
- `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
+ `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
and `item`.`moderated` = 0
- AND `item`.`parent` = ( SELECT `parent` FROM `item` FORCE INDEX (PRIMARY, `uri`) WHERE ( `id` = '%s' OR `uri` = '%s' )
- AND uid = %d )
+ AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE (`id` = '%s' OR `uri` = '%s')
+ AND uid = %d)
$sql_extra
- ORDER BY `parent` DESC, `gravity` ASC, `id` ASC ",
+ ORDER BY `parent` DESC, `gravity` ASC, `id` ASC",
intval($a->profile['uid']),
dbesc($item_id),
dbesc($item_id),
);
if($r) {
$item_uri = $r[0]['uri'];
+ // AND `item`.`parent` = ( SELECT `parent` FROM `item` FORCE INDEX (PRIMARY, `uri`) WHERE `uri` = '%s' AND uid = %d )
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
and `item`.`moderated` = 0
- AND `item`.`parent` = ( SELECT `parent` FROM `item` FORCE INDEX (PRIMARY, `uri`) WHERE `uri` = '%s' AND uid = %d )
+ AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE `uri` = '%s' AND uid = %d)
ORDER BY `parent` DESC, `gravity` ASC, `id` ASC ",
intval(local_user()),
dbesc($item_uri),
if($r) {
if((local_user()) && (local_user() == $a->profile['uid'])) {
- q("UPDATE `item` SET `unseen` = 0
+ q("UPDATE `item` SET `unseen` = 0
WHERE `parent` = %d AND `unseen` = 1",
intval($r[0]['parent'])
);
if($r[0]['deleted']) {
notice( t('Item has been removed.') . EOL );
}
- else {
- notice( t('Permission denied.') . EOL );
+ else {
+ notice( t('Permission denied.') . EOL );
}
}
else {
require_once('include/email.php');
require_once('library/langdet/Text/LanguageDetect.php');
require_once('include/tags.php');
+require_once('include/files.php');
require_once('include/threads.php');
function item_post(&$a) {
if($orig_post) {
- $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `attach` = '%s', `file` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d",
+ $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `attach` = '%s', `file` = '%s', `edited` = '%s', `changed` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($datarray['title']),
dbesc($datarray['body']),
dbesc($datarray['tag']),
dbesc($datarray['attach']),
dbesc($datarray['file']),
dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
intval($post_id),
intval($profile_uid)
);
- create_tags_from_itemuri($post_id, $profile_uid);
- update_thread_uri($post_id, $profile_uid);
// update filetags in pconfig
file_tag_update_pconfig($uid,$categories_old,$categories_new,'category');
if(count($r)) {
$post_id = $r[0]['id'];
logger('mod_item: saved item ' . $post_id);
- create_tags_from_item($post_id);
add_thread($post_id);
// update filetags in pconfig
dbesc(datetime_convert()),
intval($post_id)
);
- update_thread($post_id);
// photo comments turn the corresponding item visible to the profile wall
// This way we don't see every picture in your new photo album posted to your wall at once.
}
}
+ create_tags_from_item($post_id);
+ create_files_from_item($post_id);
+ update_thread($post_id);
+
// This is a real juggling act on shared hosting services which kill your processes
// e.g. dreamhost. We used to start delivery to our native delivery agents in the background
// and then run our plugin delivery from the foreground. We're now doing plugin delivery first,
// likely to get killed off. If you end up looking at an /item URL and a blank page,
// it's very likely the delivery got killed before all your friends could be notified.
// Currently the only realistic fixes are to use a reliable server - which precludes shared hosting,
- // or cut back on plugins which do remote deliveries.
+ // or cut back on plugins which do remote deliveries.
proc_run('php', "include/notifier.php", $notify_type, "$post_id");
<?php
/*
To-Do:
-- Community-Seite umstellen
+- Update berücksichtigt keine Konversationen
*/
function network_init(&$a) {
$sql_extra3 = (($nouveau) ? '' : $sql_extra3);
$sql_order = "";
$order_mode = "received";
+ $tag = false;
if(x($_GET,'search')) {
$search = escape_tags($_GET['search']);
$sql_post_table = sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ",
dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG), intval(local_user()));
+ $sql_order = "`item`.`id`";
+ $order_mode = "id";
} else {
if (get_config('system','use_fulltext_engine'))
$sql_extra = sprintf(" AND MATCH (`item`.`body`, `item`.`title`) AGAINST ('%s' in boolean mode) ", dbesc(protect_sprintf($search)));
else
$sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
+ $sql_order = "`item`.`received`";
+ $order_mode = "received";
}
- $sql_order = "`item`.`received`";
- $order_mode = "received";
}
- if(strlen($file))
- $sql_extra .= file_tag_file_query('item',unxmlify($file));
+ if(strlen($file)) {
+ $sql_post_table = sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ",
+ dbesc(protect_sprintf($file)), intval(TERM_OBJ_POST), intval(TERM_FILE), intval(local_user()));
+ $sql_order = "`item`.`id`";
+ $order_mode = "id";
+ }
if($conv)
- $sql_extra2 .= " AND `mention`";
+ $sql_extra3 .= " AND `mention`";
if($update) {
if($nouveau) {
$simple_update = (($update) ? " and `item`.`unseen` = 1 " : '');
+ if ($sql_order == "")
+ $sql_order = "`item`.`received`";
+
// "New Item View" - show all items unthreaded in reverse created date order
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`writable`,
AND `item`.`deleted` = 0 and `item`.`moderated` = 0
$simple_update
$sql_extra $sql_nets
- ORDER BY `item`.`received` DESC $pager_sql ",
+ ORDER BY $sql_order DESC $pager_sql ",
intval($_SESSION['uid'])
);
intval($a->profile['profile_uid'])
);
- }
- else {
+ } else {
+ $sql_post_table = "";
if(x($category)) {
- $sql_extra .= protect_sprintf(file_tag_file_query('item',$category,'category'));
+ $sql_post_table = sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ",
+ dbesc(protect_sprintf($category)), intval(TERM_OBJ_POST), intval(TERM_CATEGORY), intval($a->profile['profile_uid']));
+ //$sql_extra .= protect_sprintf(file_tag_file_query('item',$category,'category'));
}
if($datequery) {
if( (! get_config('alt_pager', 'global')) && (! get_pconfig($a->profile['profile_uid'],'system','alt_pager')) ) {
$r = q("SELECT COUNT(*) AS `total`
FROM `thread` INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
- INNER JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
+ $sql_post_table INNER JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
WHERE `thread`.`uid` = %d AND `thread`.`visible` = 1 AND `thread`.`deleted` = 0
and `thread`.`moderated` = 0
$r = q("SELECT `thread`.`iid` AS `item_id`, `thread`.`network` AS `item_network`,
`thread`.`uid` AS `contact-uid`
FROM `thread` INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
- INNER JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
+ $sql_post_table INNER JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
WHERE `thread`.`uid` = %d AND `thread`.`visible` = 1 AND `thread`.`deleted` = 0
and `thread`.`moderated` = 0
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`.`uid` = `item`.`uid`
+ AND `contact`.`id` = `item`.`contact-id`
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
AND `item`.`parent` IN ( %s )
$sql_extra ",
$tag = true;
if($tag) {
- //$sql_extra = sprintf(" AND `term`.`term` = '%s' AND `term`.`otype` = %d AND `term`.`type` = %d",
- //$sql_extra = sprintf(" AND `term`.`term` = '%s' AND `term`.`otype` = %d AND `term`.`type` = %d group by `item`.`uri` ",
- // dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG));
- //$sql_table = "`term` INNER JOIN `item` ON `item`.`id` = `term`.`oid` AND `item`.`uid` = `term`.`uid` ";
- //$sql_order = "`term`.`tid`";
- //$sql_order = "`item`.`received`";
-
- //$sql_extra = sprintf(" AND EXISTS (SELECT * FROM `term` WHERE `item`.`id` = `term`.`oid` AND `item`.`uid` = `term`.`uid` AND `term`.`term` = '%s' AND `term`.`otype` = %d AND `term`.`type` = %d) GROUP BY `item`.`uri` ",
- // dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG));
- //$sql_table = "`item` FORCE INDEX (`uri`) ";
-
$sql_extra = "";
$sql_table = sprintf("`item` INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ",
// Here is the way permissions work in the search module...
// Only public posts can be shown
// OR your own posts if you are a logged in member
- // No items will be shown if the member has a blocked profile wall.
+ // No items will be shown if the member has a blocked profile wall.
if( (! get_config('alt_pager', 'global')) && (! get_pconfig(local_user(),'system','alt_pager')) ) {
$r = q("SELECT distinct(`item`.`uri`) as `total`
public function __construct($data) {
$a = $this->get_app();
-
+
$this->data = $data;
$this->set_template('wall');
$this->toplevel = ($this->get_id() == $this->get_data_value('parent'));
$r = q("CREATE TABLE IF NOT EXISTS `thread` (
`iid` int(10) unsigned NOT NULL DEFAULT '0',
`uid` int(10) unsigned NOT NULL DEFAULT '0',
- `contact-id` int(10) unsigned NOT NULL DEFAULT '0',
+ `contact-id` int(11) unsigned NOT NULL DEFAULT '0',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`mention` tinyint(1) NOT NULL DEFAULT '0',
`network` char(32) NOT NULL,
PRIMARY KEY (`iid`),
- KEY `uid` (`uid`),
- KEY `contact-id` (`contact-id`),
KEY `created` (`created`),
- KEY `edited` (`edited`),
KEY `commented` (`commented`),
- KEY `received` (`received`),
- KEY `changed` (`changed`),
- KEY `network` (`network`)
- KEY `visible_deleted_moderated_private_wall_received` (`visible`,`deleted`,`moderated`,`private`,`wall`,`received`),
- KEY `uid_visible_deleted_moderated_created` (`uid`,`visible`,`deleted`,`moderated`,`created`),
- KEY `uid_visible_deleted_moderated_commented` (`uid`,`visible`,`deleted`,`moderated`,`commented`)
+ KEY `uid_network_commented` (`uid`,`network`,`commented`),
+ KEY `uid_network_created` (`uid`,`network`,`created`),
+ KEY `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
+ KEY `uid_contactid_created` (`uid`,`contact-id`,`created`),
+ KEY `wall_private_received` (`wall`,`private`,`received`),
+ KEY `uid_created` (`uid`,`created`),
+ KEY `uid_commented` (`uid`,`commented`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
if (!$r)
return UPDATE_FAILED;