Merge remote-tracking branch 'mike/master' into dev
This commit is contained in:
commit
376091010f
@ -127,21 +127,26 @@ class Articles extends \Zotlabs\Web\Controller {
|
|||||||
$editor = '';
|
$editor = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$itemspage = get_pconfig(local_channel(),'system','itemspage');
|
||||||
|
\App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
|
||||||
|
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
|
||||||
|
|
||||||
|
|
||||||
$sql_extra = item_permissions_sql($owner);
|
$sql_extra = item_permissions_sql($owner);
|
||||||
|
$sql_item = '';
|
||||||
|
|
||||||
if($selected_card) {
|
if($selected_card) {
|
||||||
$r = q("select * from iconfig where iconfig.cat = 'system' and iconfig.k = 'ARTICLE' and iconfig.v = '%s' limit 1",
|
$r = q("select * from iconfig where iconfig.cat = 'system' and iconfig.k = 'ARTICLE' and iconfig.v = '%s' limit 1",
|
||||||
dbesc($selected_card)
|
dbesc($selected_card)
|
||||||
);
|
);
|
||||||
if($r) {
|
if($r) {
|
||||||
$sql_extra .= "and item.id = " . intval($r[0]['iid']) . " ";
|
$sql_item = "and item.id = " . intval($r[0]['iid']) . " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("select * from item
|
$r = q("select * from item
|
||||||
where item.uid = %d and item_type = %d
|
where item.uid = %d and item_type = %d
|
||||||
$sql_extra order by item.created desc",
|
$sql_extra $sql_item order by item.created desc $pager_sql",
|
||||||
intval($owner),
|
intval($owner),
|
||||||
intval(ITEM_TYPE_ARTICLE)
|
intval(ITEM_TYPE_ARTICLE)
|
||||||
);
|
);
|
||||||
@ -152,6 +157,8 @@ class Articles extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
if($r) {
|
if($r) {
|
||||||
|
|
||||||
|
$pager_total = count($r);
|
||||||
|
|
||||||
$parents_str = ids_to_querystr($r,'id');
|
$parents_str = ids_to_querystr($r,'id');
|
||||||
|
|
||||||
$items = q("SELECT item.*, item.id AS item_id
|
$items = q("SELECT item.*, item.id AS item_id
|
||||||
@ -173,13 +180,18 @@ class Articles extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
$mode = 'articles';
|
$mode = 'articles';
|
||||||
|
|
||||||
$content = conversation($items,$mode,false,'traditional');
|
if(get_pconfig(local_channel(),'system','articles_list_mode') && (! $selected_card))
|
||||||
|
$page_mode = 'pager_list';
|
||||||
|
else
|
||||||
|
$page_mode = 'traditional';
|
||||||
|
|
||||||
|
$content = conversation($items,$mode,false,$page_mode);
|
||||||
|
|
||||||
$o = replace_macros(get_markup_template('cards.tpl'), [
|
$o = replace_macros(get_markup_template('cards.tpl'), [
|
||||||
'$title' => t('Articles'),
|
'$title' => t('Articles'),
|
||||||
'$editor' => $editor,
|
'$editor' => $editor,
|
||||||
'$content' => $content,
|
'$content' => $content,
|
||||||
'$pager' => alt_pager($a,count($items))
|
'$pager' => alt_pager($a,$pager_total)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
|
@ -131,20 +131,26 @@ class Cards extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$itemspage = get_pconfig(local_channel(),'system','itemspage');
|
||||||
|
\App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
|
||||||
|
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
|
||||||
|
|
||||||
|
|
||||||
$sql_extra = item_permissions_sql($owner);
|
$sql_extra = item_permissions_sql($owner);
|
||||||
|
$sql_item = '';
|
||||||
|
|
||||||
if($selected_card) {
|
if($selected_card) {
|
||||||
$r = q("select * from iconfig where iconfig.cat = 'system' and iconfig.k = 'CARD' and iconfig.v = '%s' limit 1",
|
$r = q("select * from iconfig where iconfig.cat = 'system' and iconfig.k = 'CARD' and iconfig.v = '%s' limit 1",
|
||||||
dbesc($selected_card)
|
dbesc($selected_card)
|
||||||
);
|
);
|
||||||
if($r) {
|
if($r) {
|
||||||
$sql_extra .= "and item.id = " . intval($r[0]['iid']) . " ";
|
$sql_item = "and item.id = " . intval($r[0]['iid']) . " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("select * from item
|
$r = q("select * from item
|
||||||
where uid = %d and item_type = %d
|
where uid = %d and item_type = %d
|
||||||
$sql_extra order by item.created desc",
|
$sql_extra $sql_item order by item.created desc $pager_sql",
|
||||||
intval($owner),
|
intval($owner),
|
||||||
intval(ITEM_TYPE_CARD)
|
intval(ITEM_TYPE_CARD)
|
||||||
);
|
);
|
||||||
@ -156,6 +162,8 @@ class Cards extends \Zotlabs\Web\Controller {
|
|||||||
$items_result = [];
|
$items_result = [];
|
||||||
if($r) {
|
if($r) {
|
||||||
|
|
||||||
|
$pager_total = count($r);
|
||||||
|
|
||||||
$parents_str = ids_to_querystr($r, 'id');
|
$parents_str = ids_to_querystr($r, 'id');
|
||||||
|
|
||||||
$items = q("SELECT item.*, item.id AS item_id
|
$items = q("SELECT item.*, item.id AS item_id
|
||||||
@ -175,13 +183,18 @@ class Cards extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
$mode = 'cards';
|
$mode = 'cards';
|
||||||
|
|
||||||
$content = conversation($items_result, $mode, false, 'traditional');
|
if(get_pconfig(local_channel(),'system','articles_list_mode') && (! $selected_card))
|
||||||
|
$page_mode = 'pager_list';
|
||||||
|
else
|
||||||
|
$page_mode = 'traditional';
|
||||||
|
|
||||||
|
$content = conversation($items_result, $mode, false, $page_mode);
|
||||||
|
|
||||||
$o = replace_macros(get_markup_template('cards.tpl'), [
|
$o = replace_macros(get_markup_template('cards.tpl'), [
|
||||||
'$title' => t('Cards'),
|
'$title' => t('Cards'),
|
||||||
'$editor' => $editor,
|
'$editor' => $editor,
|
||||||
'$content' => $content,
|
'$content' => $content,
|
||||||
'$pager' => alt_pager($a, count($items_result))
|
'$pager' => alt_pager($a, $pager_total)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
|
@ -134,6 +134,40 @@ class Display extends \Zotlabs\Web\Controller {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($target_item['item_type'] == ITEM_TYPE_ARTICLE) {
|
||||||
|
$x = q("select * from channel where channel_id = %d limit 1",
|
||||||
|
intval($target_item['uid'])
|
||||||
|
);
|
||||||
|
$y = q("select * from iconfig left join item on iconfig.iid = item.id
|
||||||
|
where item.uid = %d and iconfig.cat = 'system' and iconfig.k = 'ARTICLE' and item.id = %d limit 1",
|
||||||
|
intval($target_item['uid']),
|
||||||
|
intval($target_item['id'])
|
||||||
|
);
|
||||||
|
if($x && $y) {
|
||||||
|
goaway(z_root() . '/articles/' . $x[0]['channel_address'] . '/' . $y[0]['v']);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
notice( t('Page not found.') . EOL);
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($target_item['item_type'] == ITEM_TYPE_CARD) {
|
||||||
|
$x = q("select * from channel where channel_id = %d limit 1",
|
||||||
|
intval($target_item['uid'])
|
||||||
|
);
|
||||||
|
$y = q("select * from iconfig left join item on iconfig.iid = item.id
|
||||||
|
where item.uid = %d and iconfig.cat = 'system' and iconfig.k = 'CARD' and item.id = %d limit 1",
|
||||||
|
intval($target_item['uid']),
|
||||||
|
intval($target_item['id'])
|
||||||
|
);
|
||||||
|
if($x && $y) {
|
||||||
|
goaway(z_root() . '/cards/' . $x[0]['channel_address'] . '/' . $y[0]['v']);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
notice( t('Page not found.') . EOL);
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0);
|
$static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0);
|
||||||
|
|
||||||
|
@ -838,11 +838,11 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
|
|||||||
|
|
||||||
$item_object = new Zotlabs\Lib\ThreadItem($item);
|
$item_object = new Zotlabs\Lib\ThreadItem($item);
|
||||||
$conv->add_thread($item_object);
|
$conv->add_thread($item_object);
|
||||||
if($page_mode === 'list') {
|
if(($page_mode === 'list') || ($page_mode === 'pager_list')) {
|
||||||
$item_object->set_template('conv_list.tpl');
|
$item_object->set_template('conv_list.tpl');
|
||||||
$item_object->set_display_mode('list');
|
$item_object->set_display_mode('list');
|
||||||
}
|
}
|
||||||
if($page_mode === 'cards') {
|
if($mode === 'cards' || $mode === 'articles') {
|
||||||
$item_object->set_reload($jsreload);
|
$item_object->set_reload($jsreload);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -857,7 +857,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($page_mode === 'traditional' || $page_mode === 'preview') {
|
if(in_array($page_mode, [ 'traditional', 'preview', 'pager_list'] )) {
|
||||||
$page_template = get_markup_template("threaded_conversation.tpl");
|
$page_template = get_markup_template("threaded_conversation.tpl");
|
||||||
}
|
}
|
||||||
elseif($update) {
|
elseif($update) {
|
||||||
|
@ -182,11 +182,10 @@ function tagadelic($uid, $count = 0, $authors = '', $owner = '', $flags = 0, $re
|
|||||||
$sql_options .= " and owner_xchan = '" . dbesc($owner) . "' ";
|
$sql_options .= " and owner_xchan = '" . dbesc($owner) . "' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Fetch tags
|
// Fetch tags
|
||||||
$r = q("select term, count(term) as total from term left join item on term.oid = item.id
|
$r = q("select term, count(term) as total from term left join item on term.oid = item.id
|
||||||
where term.uid = %d and term.ttype = %d
|
where term.uid = %d and term.ttype = %d
|
||||||
and otype = %d and item_type = %d and item_private = 0
|
and otype = %d and item_type = %d
|
||||||
$sql_options $item_normal
|
$sql_options $item_normal
|
||||||
group by term order by total desc %s",
|
group by term order by total desc %s",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
@ -196,6 +195,7 @@ function tagadelic($uid, $count = 0, $authors = '', $owner = '', $flags = 0, $re
|
|||||||
((intval($count)) ? "limit $count" : '')
|
((intval($count)) ? "limit $count" : '')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
if(! $r)
|
if(! $r)
|
||||||
return array();
|
return array();
|
||||||
|
|
||||||
|
@ -2285,13 +2285,31 @@ function process_mail_delivery($sender, $arr, $deliveries) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(! perm_is_allowed($channel['channel_id'],$sender['hash'],'post_mail')) {
|
if(! perm_is_allowed($channel['channel_id'],$sender['hash'],'post_mail')) {
|
||||||
logger("permission denied for mail delivery {$channel['channel_id']}");
|
|
||||||
$DR->update('permission denied');
|
/*
|
||||||
$result[] = $DR->get();
|
* Always allow somebody to reply if you initiated the conversation. It's anti-social
|
||||||
continue;
|
* and a bit rude to send a private message to somebody and block their ability to respond.
|
||||||
|
* If you are being harrassed and want to put an end to it, delete the conversation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$return = false;
|
||||||
|
if($arr['parent_mid']) {
|
||||||
|
$return = q("select * from mail where mid = '%s' and channel_id = %d limit 1",
|
||||||
|
dbesc($arr['parent_mid']),
|
||||||
|
intval($channel['channel_id'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if(! $return) {
|
||||||
|
logger("permission denied for mail delivery {$channel['channel_id']}");
|
||||||
|
$DR->update('permission denied');
|
||||||
|
$result[] = $DR->get();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$r = q("select id from mail where mid = '%s' and channel_id = %d limit 1",
|
$r = q("select id from mail where mid = '%s' and channel_id = %d limit 1",
|
||||||
dbesc($arr['mid']),
|
dbesc($arr['mid']),
|
||||||
intval($channel['channel_id'])
|
intval($channel['channel_id'])
|
||||||
|
Reference in New Issue
Block a user