aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Access/PermissionRoles.php19
-rw-r--r--Zotlabs/Module/Admin/Accounts.php7
-rw-r--r--Zotlabs/Module/Articles.php20
-rw-r--r--Zotlabs/Module/Cards.php21
-rw-r--r--Zotlabs/Module/Cloud.php6
-rw-r--r--Zotlabs/Module/Display.php34
-rw-r--r--Zotlabs/Module/Moderate.php14
-rw-r--r--Zotlabs/Module/Ochannel.php69
-rw-r--r--Zotlabs/Module/Regmod.php2
-rw-r--r--Zotlabs/Storage/Directory.php18
10 files changed, 198 insertions, 12 deletions
diff --git a/Zotlabs/Access/PermissionRoles.php b/Zotlabs/Access/PermissionRoles.php
index b335bf825..a8a9ae462 100644
--- a/Zotlabs/Access/PermissionRoles.php
+++ b/Zotlabs/Access/PermissionRoles.php
@@ -41,6 +41,24 @@ class PermissionRoles {
break;
+ case 'social_party':
+ $ret['perms_auto'] = false;
+ $ret['default_collection'] = false;
+ $ret['directory_publish'] = true;
+ $ret['online'] = true;
+ $ret['perms_connect'] = [
+ 'view_stream', 'view_profile', 'view_contacts', 'view_storage',
+ 'view_pages', 'view_wiki', 'send_stream', 'post_wall', 'post_comments',
+ 'post_mail', 'chat', 'post_like', 'republish'
+ ];
+ $ret['limits'] = PermissionLimits::Std_Limits();
+ $ret['limits']['post_comments'] = PERMS_AUTHED;
+ $ret['limits']['post_mail'] = PERMS_AUTHED;
+ $ret['limits']['post_like'] = PERMS_AUTHED;
+ $ret['limits']['chat'] = PERMS_AUTHED;
+ break;
+
+
case 'social_restricted':
$ret['perms_auto'] = false;
$ret['default_collection'] = true;
@@ -263,6 +281,7 @@ class PermissionRoles {
static public function roles() {
$roles = [
t('Social Networking') => [
+ 'social_party' => t('Social - Party'),
'social' => t('Social - Mostly Public'),
'social_restricted' => t('Social - Restricted'),
'social_private' => t('Social - Private')
diff --git a/Zotlabs/Module/Admin/Accounts.php b/Zotlabs/Module/Admin/Accounts.php
index 2e417edd1..0c7e089be 100644
--- a/Zotlabs/Module/Admin/Accounts.php
+++ b/Zotlabs/Module/Admin/Accounts.php
@@ -133,12 +133,13 @@ class Accounts {
$base = z_root() . '/admin/accounts?f=';
$odir = (($dir === 'asc') ? '0' : '1');
-
+
$users = q("SELECT account_id , account_email, account_lastlog, account_created, account_expires, account_service_class, ( account_flags & %d ) > 0 as blocked,
(SELECT %s FROM channel as ch WHERE ch.channel_account_id = ac.account_id and ch.channel_removed = 0 ) as channels FROM account as ac
- where true $serviceclass order by $key $dir limit %d offset %d ",
+ where true $serviceclass and account_flags != %d order by $key $dir limit %d offset %d ",
intval(ACCOUNT_BLOCKED),
db_concat('ch.channel_address', ' '),
+ intval(ACCOUNT_BLOCKED | ACCOUNT_PENDING),
intval(\App::$pager['itemspage']),
intval(\App::$pager['start'])
);
@@ -203,4 +204,4 @@ class Accounts {
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Module/Articles.php b/Zotlabs/Module/Articles.php
index e2e0fed5d..62ce1cb9c 100644
--- a/Zotlabs/Module/Articles.php
+++ b/Zotlabs/Module/Articles.php
@@ -127,21 +127,26 @@ class Articles extends \Zotlabs\Web\Controller {
$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_item = '';
if($selected_card) {
$r = q("select * from iconfig where iconfig.cat = 'system' and iconfig.k = 'ARTICLE' and iconfig.v = '%s' limit 1",
dbesc($selected_card)
);
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
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(ITEM_TYPE_ARTICLE)
);
@@ -152,6 +157,8 @@ class Articles extends \Zotlabs\Web\Controller {
if($r) {
+ $pager_total = count($r);
+
$parents_str = ids_to_querystr($r,'id');
$items = q("SELECT item.*, item.id AS item_id
@@ -173,13 +180,18 @@ class Articles extends \Zotlabs\Web\Controller {
$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'), [
'$title' => t('Articles'),
'$editor' => $editor,
'$content' => $content,
- '$pager' => alt_pager($a,count($items))
+ '$pager' => alt_pager($a,$pager_total)
]);
return $o;
diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php
index f87988183..d3b16e82e 100644
--- a/Zotlabs/Module/Cards.php
+++ b/Zotlabs/Module/Cards.php
@@ -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_item = '';
if($selected_card) {
$r = q("select * from iconfig where iconfig.cat = 'system' and iconfig.k = 'CARD' and iconfig.v = '%s' limit 1",
dbesc($selected_card)
);
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
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(ITEM_TYPE_CARD)
);
@@ -156,6 +162,8 @@ class Cards extends \Zotlabs\Web\Controller {
$items_result = [];
if($r) {
+ $pager_total = count($r);
+
$parents_str = ids_to_querystr($r, 'id');
$items = q("SELECT item.*, item.id AS item_id
@@ -175,13 +183,18 @@ class Cards extends \Zotlabs\Web\Controller {
$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'), [
'$title' => t('Cards'),
'$editor' => $editor,
'$content' => $content,
- '$pager' => alt_pager($a, count($items_result))
+ '$pager' => alt_pager($a, $pager_total)
]);
return $o;
diff --git a/Zotlabs/Module/Cloud.php b/Zotlabs/Module/Cloud.php
index 8b5476efc..34397d275 100644
--- a/Zotlabs/Module/Cloud.php
+++ b/Zotlabs/Module/Cloud.php
@@ -60,6 +60,12 @@ class Cloud extends \Zotlabs\Web\Controller {
// if we arrived at this path with any query parameters in the url, build a clean url without
// them and redirect.
+ if(! array_key_exists('cloud_sort',$_SESSION)) {
+ $_SESSION['cloud_sort'] = 'name';
+ }
+
+ $_SESSION['cloud_sort'] = (($_REQUEST['sort']) ? trim(notags($_REQUEST['sort'])) : $_SESSION['cloud_sort']);
+
$x = clean_query_string();
if($x !== \App::$query_string)
goaway(z_root() . '/' . $x);
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index 8e8a1ed24..fa29ce66c 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -134,6 +134,40 @@ class Display extends \Zotlabs\Web\Controller {
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);
diff --git a/Zotlabs/Module/Moderate.php b/Zotlabs/Module/Moderate.php
index cf1625a6b..b4709f3bd 100644
--- a/Zotlabs/Module/Moderate.php
+++ b/Zotlabs/Module/Moderate.php
@@ -52,6 +52,20 @@ class Moderate extends \Zotlabs\Web\Controller {
intval(local_channel()),
intval($post_id)
);
+
+ // update the parent's commented timestamp
+
+ $z = q("select max(created) as commented from item where parent_mid = '%s' and uid = %d and item_delayed = 0 ",
+ dbesc($r[0]['parent_mid']),
+ intval(local_channel())
+ );
+
+ q("UPDATE item set commented = '%s', changed = '%s' WHERE id = %d",
+ dbesc(($z) ? $z[0]['commented'] : (datetime_convert())),
+ dbesc(datetime_convert()),
+ intval($r[0]['parent'])
+ );
+
notice( t('Comment approved') . EOL);
}
elseif($action === 'drop') {
diff --git a/Zotlabs/Module/Ochannel.php b/Zotlabs/Module/Ochannel.php
new file mode 100644
index 000000000..508be1408
--- /dev/null
+++ b/Zotlabs/Module/Ochannel.php
@@ -0,0 +1,69 @@
+<?php
+
+namespace Zotlabs\Module;
+
+require_once('include/contact_widgets.php');
+require_once('include/items.php');
+require_once("include/bbcode.php");
+require_once('include/security.php');
+require_once('include/conversation.php');
+require_once('include/acl_selectors.php');
+require_once('include/permissions.php');
+
+/**
+ * @brief Channel Controller for broken OStatus implementations
+ *
+ */
+class Ochannel extends \Zotlabs\Web\Controller {
+
+ function init() {
+
+ $which = null;
+ if(argc() > 1)
+ $which = argv(1);
+ if(! $which) {
+ if(local_channel()) {
+ $channel = \App::get_channel();
+ if($channel && $channel['channel_address'])
+ $which = $channel['channel_address'];
+ }
+ }
+ if(! $which) {
+ notice( t('You must be logged in to see this page.') . EOL );
+ return;
+ }
+
+ $profile = 0;
+ $channel = \App::get_channel();
+
+ if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) {
+ $which = $channel['channel_address'];
+ $profile = argv(1);
+ }
+
+ head_add_link( [
+ 'rel' => 'alternate',
+ 'type' => 'application/atom+xml',
+ 'href' => z_root() . '/ofeed/' . $which
+ ]);
+
+
+ // Run profile_load() here to make sure the theme is set before
+ // we start loading content
+
+ profile_load($which,$profile);
+ }
+
+ function get($update = 0, $load = false) {
+
+ if(argc() < 2)
+ return;
+
+ if($load)
+ $_SESSION['loadtime'] = datetime_convert();
+
+ return '<script>window.location.href = "' . z_root() . '/' . str_replace('ochannel/','channel/',\App::$query_string) . '";</script>';
+
+ }
+
+}
diff --git a/Zotlabs/Module/Regmod.php b/Zotlabs/Module/Regmod.php
index c7e5c44aa..70635d707 100644
--- a/Zotlabs/Module/Regmod.php
+++ b/Zotlabs/Module/Regmod.php
@@ -35,6 +35,8 @@ class Regmod extends \Zotlabs\Web\Controller {
if($cmd === 'allow') {
if (! account_allow($hash)) killme();
}
+
+ goaway('/admin/accounts');
}
}
diff --git a/Zotlabs/Storage/Directory.php b/Zotlabs/Storage/Directory.php
index a2dd1e9b8..a2ae0fee8 100644
--- a/Zotlabs/Storage/Directory.php
+++ b/Zotlabs/Storage/Directory.php
@@ -691,7 +691,23 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
}
$prefix = '';
- $suffix = ' order by is_dir desc, filename asc ';
+
+ if(! array_key_exists('cloud_sort',$_SESSION))
+ $_SESSION['cloud_sort'] = 'name';
+
+ switch($_SESSION['cloud_sort']) {
+ case 'size':
+ $suffix = ' order by is_dir desc, filesize asc ';
+ break;
+ // The following provides inconsistent results for directories because we re-calculate the date for directories based on the most recent change
+ case 'date':
+ $suffix = ' order by is_dir desc, edited asc ';
+ break;
+ case 'name':
+ default:
+ $suffix = ' order by is_dir desc, filename asc ';
+ break;
+ }
$r = q("select $prefix id, uid, hash, filename, filetype, filesize, revision, folder, flags, is_dir, created, edited from attach where folder = '%s' and uid = %d $perms $suffix",
dbesc($folder),