aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-02-05 15:58:28 -0800
committerzotlabs <mike@macgirvin.com>2018-02-05 15:58:28 -0800
commitb41c5f349715abc6ca7db563e3938336bc75974e (patch)
tree31a1ee5a74227c30239bb9d2a10341bbacb8ecec /Zotlabs
parent05de59d4ad174cb106c3a5b5890732af51730384 (diff)
parent930e1fdbdc798868760f8a4e03f32fc3f42e8bc9 (diff)
downloadvolse-hubzilla-b41c5f349715abc6ca7db563e3938336bc75974e.tar.gz
volse-hubzilla-b41c5f349715abc6ca7db563e3938336bc75974e.tar.bz2
volse-hubzilla-b41c5f349715abc6ca7db563e3938336bc75974e.zip
Merge branch 'master' into z6
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Daemon/Notifier.php4
-rw-r--r--Zotlabs/Lib/Config.php4
-rw-r--r--Zotlabs/Lib/Enotify.php16
-rw-r--r--Zotlabs/Lib/ThreadItem.php4
-rw-r--r--Zotlabs/Module/Admin/Accounts.php7
-rw-r--r--Zotlabs/Module/Admin/Security.php12
-rw-r--r--Zotlabs/Module/Admin/Site.php11
-rw-r--r--Zotlabs/Module/Cards.php79
-rw-r--r--Zotlabs/Module/Channel.php6
-rw-r--r--Zotlabs/Module/Connedit.php23
-rw-r--r--Zotlabs/Module/Cover_photo.php12
-rw-r--r--Zotlabs/Module/Dirsearch.php5
-rw-r--r--Zotlabs/Module/Display.php17
-rw-r--r--Zotlabs/Module/Email_resend.php46
-rw-r--r--Zotlabs/Module/Email_validation.php47
-rw-r--r--Zotlabs/Module/Go.php66
-rw-r--r--Zotlabs/Module/Hq.php6
-rw-r--r--Zotlabs/Module/Item.php1
-rw-r--r--Zotlabs/Module/Like.php81
-rw-r--r--Zotlabs/Module/Linkinfo.php4
-rw-r--r--Zotlabs/Module/Logout.php2
-rw-r--r--Zotlabs/Module/Network.php36
-rw-r--r--Zotlabs/Module/New_channel.php4
-rw-r--r--Zotlabs/Module/Ping.php17
-rw-r--r--Zotlabs/Module/Profile_photo.php21
-rw-r--r--Zotlabs/Module/Pubstream.php19
-rw-r--r--Zotlabs/Module/Register.php20
-rw-r--r--Zotlabs/Module/Search.php23
-rw-r--r--Zotlabs/Module/Settings/Permcats.php4
-rw-r--r--Zotlabs/Module/Siteinfo.php1
-rw-r--r--Zotlabs/Web/Router.php6
-rw-r--r--Zotlabs/Web/WebServer.php75
-rw-r--r--Zotlabs/Widget/Forums.php25
-rw-r--r--Zotlabs/Widget/Notifications.php3
34 files changed, 460 insertions, 247 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php
index ca6a7c08a..b168db5ae 100644
--- a/Zotlabs/Daemon/Notifier.php
+++ b/Zotlabs/Daemon/Notifier.php
@@ -90,8 +90,6 @@ class Notifier {
$item_id = $argv[2];
- $extra = (($argc > 3) ? $argv[3] : null);
-
if(! $item_id)
return;
@@ -315,7 +313,7 @@ class Notifier {
}
- if($target_item['id'] == $target_item['parent']) {
+ if($target_item['mid'] === $target_item['parent_mid']) {
$parent_item = $target_item;
$top_level_post = true;
}
diff --git a/Zotlabs/Lib/Config.php b/Zotlabs/Lib/Config.php
index f9f22ba3a..c00b8efb6 100644
--- a/Zotlabs/Lib/Config.php
+++ b/Zotlabs/Lib/Config.php
@@ -142,9 +142,9 @@ class Config {
/**
- * @brief Returns a value directly from the database configuration storage.
+ * @brief Returns a record directly from the database configuration storage.
*
- * This function queries directly the database and bypasses the chached storage
+ * This function queries directly the database and bypasses the cached storage
* from get_config($family, $key).
*
* @param string $family
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index a7b4f28e8..5cf4ec31d 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -794,6 +794,20 @@ class Enotify {
: sprintf( t('commented on %s\'s post'), $item['owner']['xchan_name']));
}
+ $edit = false;
+
+ if($item['edited'] > $item['created']) {
+ if($item['item_thread_top']) {
+ $itemem_text = sprintf( t('edited a post dated %s'), relative_date($item['created']));
+ $edit = true;
+ }
+ else {
+ $itemem_text = sprintf( t('edited a comment dated %s'), relative_date($item['created']));
+ $edit = true;
+ }
+ }
+
+
// convert this logic into a json array just like the system notifications
return array(
@@ -801,7 +815,7 @@ class Enotify {
'name' => $item['author']['xchan_name'],
'url' => $item['author']['xchan_url'],
'photo' => $item['author']['xchan_photo_s'],
- 'when' => relative_date($item['created']),
+ 'when' => relative_date(($edit)? $item['edited'] : $item['created']),
'class' => (intval($item['item_unseen']) ? 'notify-unseen' : 'notify-seen'),
'b64mid' => ((in_array($item['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) ? 'b64.' . base64url_encode($item['thr_parent']) : 'b64.' . base64url_encode($item['mid'])),
'notify_id' => 'undefined',
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 748edcdb7..d35d4732a 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -730,9 +730,6 @@ class ThreadItem {
$observer = $conv->get_observer();
- $qc = ((local_channel()) ? get_pconfig(local_channel(),'system','qcomment') : null);
- $qcomment = (($qc) ? explode("\n",$qc) : null);
-
$arr = array('comment_buttons' => '','id' => $this->get_id());
call_hooks('comment_buttons',$arr);
$comment_buttons = $arr['comment_buttons'];
@@ -744,7 +741,6 @@ class ThreadItem {
'$type' => (($conv->get_mode() === 'channel') ? 'wall-comment' : 'net-comment'),
'$id' => $this->get_id(),
'$parent' => $this->get_id(),
- '$qcomment' => $qcomment,
'$comment_buttons' => $comment_buttons,
'$profile_uid' => $conv->get_profile_owner(),
'$mylink' => $observer['xchan_url'],
diff --git a/Zotlabs/Module/Admin/Accounts.php b/Zotlabs/Module/Admin/Accounts.php
index 2043550fc..2e417edd1 100644
--- a/Zotlabs/Module/Admin/Accounts.php
+++ b/Zotlabs/Module/Admin/Accounts.php
@@ -16,6 +16,7 @@ class Accounts {
*/
function post() {
+
$pending = ( x($_POST, 'pending') ? $_POST['pending'] : array() );
$users = ( x($_POST, 'user') ? $_POST['user'] : array() );
$blocked = ( x($_POST, 'blocked') ? $_POST['blocked'] : array() );
@@ -24,7 +25,7 @@ class Accounts {
// change to switch structure?
// account block/unblock button was submitted
- if (x($_POST, 'page_users_block')) {
+ if (x($_POST, 'page_accounts_block')) {
for ($i = 0; $i < count($users); $i++) {
// if account is blocked remove blocked bit-flag, otherwise add blocked bit-flag
$op = ($blocked[$i]) ? '& ~' : '| ';
@@ -43,13 +44,13 @@ class Accounts {
notice( sprintf( tt("%s account deleted", "%s accounts deleted", count($users)), count($users)) );
}
// registration approved button was submitted
- if (x($_POST, 'page_users_approve')) {
+ if (x($_POST, 'page_accounts_approve')) {
foreach ($pending as $hash) {
account_allow($hash);
}
}
// registration deny button was submitted
- if (x($_POST, 'page_users_deny')) {
+ if (x($_POST, 'page_accounts_deny')) {
foreach ($pending as $hash) {
account_deny($hash);
}
diff --git a/Zotlabs/Module/Admin/Security.php b/Zotlabs/Module/Admin/Security.php
index a1e4bf537..49e1ccf42 100644
--- a/Zotlabs/Module/Admin/Security.php
+++ b/Zotlabs/Module/Admin/Security.php
@@ -52,24 +52,24 @@ class Security {
function get() {
$whitesites = get_config('system','whitelisted_sites');
- $whitesites_str = ((is_array($whitesites)) ? implode($whitesites,"\n") : '');
+ $whitesites_str = ((is_array($whitesites)) ? implode("\n",$whitesites) : '');
$blacksites = get_config('system','blacklisted_sites');
- $blacksites_str = ((is_array($blacksites)) ? implode($blacksites,"\n") : '');
+ $blacksites_str = ((is_array($blacksites)) ? implode("\n",$blacksites) : '');
$whitechannels = get_config('system','whitelisted_channels');
- $whitechannels_str = ((is_array($whitechannels)) ? implode($whitechannels,"\n") : '');
+ $whitechannels_str = ((is_array($whitechannels)) ? implode("\n",$whitechannels) : '');
$blackchannels = get_config('system','blacklisted_channels');
- $blackchannels_str = ((is_array($blackchannels)) ? implode($blackchannels,"\n") : '');
+ $blackchannels_str = ((is_array($blackchannels)) ? implode("\n",$blackchannels) : '');
$whiteembeds = get_config('system','embed_allow');
- $whiteembeds_str = ((is_array($whiteembeds)) ? implode($whiteembeds,"\n") : '');
+ $whiteembeds_str = ((is_array($whiteembeds)) ? implode("\n",$whiteembeds) : '');
$blackembeds = get_config('system','embed_deny');
- $blackembeds_str = ((is_array($blackembeds)) ? implode($blackembeds,"\n") : '');
+ $blackembeds_str = ((is_array($blackembeds)) ? implode("\n",$blackembeds) : '');
$embed_coop = intval(get_config('system','embed_coop'));
diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php
index 60cb39277..52b36e03e 100644
--- a/Zotlabs/Module/Admin/Site.php
+++ b/Zotlabs/Module/Admin/Site.php
@@ -38,11 +38,13 @@ class Site {
$site_sellpage = ((x($_POST,'site_sellpage')) ? notags(trim($_POST['site_sellpage'])) : '');
$site_location = ((x($_POST,'site_location')) ? notags(trim($_POST['site_location'])) : '');
$frontpage = ((x($_POST,'frontpage')) ? notags(trim($_POST['frontpage'])) : '');
+ $firstpage = ((x(trim($_POST,'firstpage'))) ? notags(trim($_POST['firstpage'])) : 'profiles');
$mirror_frontpage = ((x($_POST,'mirror_frontpage')) ? intval(trim($_POST['mirror_frontpage'])) : 0);
$directory_server = ((x($_POST,'directory_server')) ? trim($_POST['directory_server']) : '');
$allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : '');
$force_publish = ((x($_POST,'publish_all')) ? True : False);
$disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? False : True);
+ $site_firehose = ((x($_POST,'site_firehose')) ? True : False);
$login_on_homepage = ((x($_POST,'login_on_homepage')) ? True : False);
$enable_context_help = ((x($_POST,'enable_context_help')) ? True : False);
$global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : '');
@@ -66,7 +68,7 @@ class Site {
$techlevel_lock = ((x($_POST,'techlock')) ? intval($_POST['techlock']) : 0);
$imagick_path = ((x($_POST,'imagick_path')) ? trim($_POST['imagick_path']) : '');
$thumbnail_security = ((x($_POST,'thumbnail_security')) ? intval($_POST['thumbnail_security']) : 0);
- $force_queue = ((intval($_POST['force_queue']) > 0) ? intval($_POST['force_queue']) : 300);
+ $force_queue = ((intval($_POST['force_queue']) > 0) ? intval($_POST['force_queue']) : 3000);
$techlevel = null;
if(array_key_exists('techlevel', $_POST))
@@ -79,6 +81,7 @@ class Site {
set_config('system', 'maxloadavg', $maxloadavg);
set_config('system', 'frontpage', $frontpage);
set_config('system', 'sellpage', $site_sellpage);
+ set_config('system', 'workflow_channel_next', $firstpage);
set_config('system', 'site_location', $site_location);
set_config('system', 'mirror_frontpage', $mirror_frontpage);
set_config('system', 'sitename', $sitename);
@@ -135,6 +138,7 @@ class Site {
set_config('system','allowed_sites', $allowed_sites);
set_config('system','publish_all', $force_publish);
set_config('system','disable_discover_tab', $disable_discover_tab);
+ set_config('system','site_firehose', $site_firehose);
set_config('system','force_queue_threshold', $force_queue);
if ($global_directory == '') {
del_config('system', 'directory_submit_url');
@@ -314,6 +318,8 @@ class Site {
'$verify_email' => array('verify_email', t("Verify Email Addresses"), get_config('system','verify_email'), t("Check to verify email addresses used in account registration (recommended).")),
'$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")),
'$disable_discover_tab' => array('disable_discover_tab', t('Import Public Streams'), $discover_tab, t('Import and allow access to public content pulled from other sites. Warning: this content is unmoderated.')),
+ '$site_firehose' => array('site_firehose', t('Site only Public Streams'), get_config('system','site_firehose'), t('Allow access to public content originating only from this site if Imported Public Streams are disabled.')),
+
'$login_on_homepage' => array('login_on_homepage', t("Login on Homepage"),((intval($homelogin) || $homelogin === false) ? 1 : '') , t("Present a login box to visitors on the home page if no other content has been configured.")),
'$enable_context_help' => array('enable_context_help', t("Enable context help"),((intval($enable_context_help) === 1 || $enable_context_help === false) ? 1 : 0) , t("Display contextual help for the current page when the help button is pressed.")),
@@ -328,7 +334,7 @@ class Site {
'$timeout' => array('timeout', t("Network timeout"), (x(get_config('system','curl_timeout'))?get_config('system','curl_timeout'):60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")),
'$delivery_interval' => array('delivery_interval', t("Delivery interval"), (x(get_config('system','delivery_interval'))?get_config('system','delivery_interval'):2), t("Delay background delivery processes by this many seconds to reduce system load. Recommend: 4-5 for shared hosts, 2-3 for virtual private servers. 0-1 for large dedicated servers.")),
'$delivery_batch_count' => array('delivery_batch_count', t('Deliveries per process'),(x(get_config('system','delivery_batch_count'))?get_config('system','delivery_batch_count'):1), t("Number of deliveries to attempt in a single operating system process. Adjust if necessary to tune system performance. Recommend: 1-5.")),
- '$force_queue' => array('force_queue', t("Queue Threshold"), get_config('system','force_queue_threshold',300), t("Always defer immediate delivery if queue contains more than this number of entries.")),
+ '$force_queue' => array('force_queue', t("Queue Threshold"), get_config('system','force_queue_threshold',3000), t("Always defer immediate delivery if queue contains more than this number of entries.")),
'$poll_interval' => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")),
'$imagick_path' => array('imagick_path', t("Path to ImageMagick convert program"), get_config('system','imagick_convert_path'), t("If set, use this program to generate photo thumbnails for huge images ( > 4000 pixels in either dimension), otherwise memory exhaustion may occur. Example: /usr/bin/convert")),
'$thumbnail_security' => array('thumbnail_security', t("Allow SVG thumbnails in file browser"), get_config('system','thumbnail_security',0), t("WARNING: SVG images may contain malicious code.")),
@@ -336,6 +342,7 @@ class Site {
'$default_expire_days' => array('default_expire_days', t('Expiration period in days for imported (grid/network) content'), intval(get_config('system','default_expire_days')), t('0 for no expiration of imported content')),
'$sellpage' => array('site_sellpage', t('Public servers: Optional landing (marketing) webpage for new registrants'), get_config('system','sellpage',''), sprintf( t('Create this page first. Default is %s/register'),z_root())),
+ '$firstpage' => array('firstpage', t('Page to display after creating a new channel'), get_config('system','workflow_channel_next','profiles'), t('Recommend: profiles, go, or settings')),
'$location' => array('site_location', t('Optional: site location'), get_config('system','site_location',''), t('Region or country')),
diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php
index 22c5d673c..f87988183 100644
--- a/Zotlabs/Module/Cards.php
+++ b/Zotlabs/Module/Cards.php
@@ -9,18 +9,22 @@ require_once('include/acl_selectors.php');
class Cards extends \Zotlabs\Web\Controller {
function init() {
-
+
if(argc() > 1)
$which = argv(1);
else
return;
-
+
profile_load($which);
-
+
}
-
+
+ /**
+ * {@inheritDoc}
+ * @see \Zotlabs\Web\Controller::get()
+ */
function get($update = 0, $load = false) {
-
+
if(observer_prohibited(true)) {
return login();
}
@@ -31,13 +35,13 @@ class Cards extends \Zotlabs\Web\Controller {
return;
}
- if(! feature_enabled(\App::$profile_uid,'cards')) {
+ if(! feature_enabled(\App::$profile_uid, 'cards')) {
return;
}
nav_set_selected(t('Cards'));
- head_add_link([
+ head_add_link([
'rel' => 'alternate',
'type' => 'application/json+oembed',
'href' => z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$query_string),
@@ -46,48 +50,48 @@ class Cards extends \Zotlabs\Web\Controller {
$category = (($_REQUEST['cat']) ? escape_tags(trim($_REQUEST['cat'])) : '');
-
+
if($category) {
- $sql_extra2 .= protect_sprintf(term_item_parent_query(\App::$profile['profile_uid'],'item', $category, TERM_CATEGORY));
+ $sql_extra2 .= protect_sprintf(term_item_parent_query(\App::$profile['profile_uid'], 'item', $category, TERM_CATEGORY));
}
$which = argv(1);
-
+
$selected_card = ((argc() > 2) ? argv(2) : '');
$_SESSION['return_url'] = \App::$query_string;
-
+
$uid = local_channel();
$owner = \App::$profile_uid;
$observer = \App::get_observer();
-
+
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
-
- if(! perm_is_allowed($owner,$ob_hash,'view_pages')) {
+
+ if(! perm_is_allowed($owner, $ob_hash, 'view_pages')) {
notice( t('Permission denied.') . EOL);
return;
}
-
+
$is_owner = ($uid && $uid == $owner);
-
+
$channel = channelx_by_n($owner);
if($channel) {
- $channel_acl = array(
+ $channel_acl = [
'allow_cid' => $channel['channel_allow_cid'],
'allow_gid' => $channel['channel_allow_gid'],
'deny_cid' => $channel['channel_deny_cid'],
'deny_gid' => $channel['channel_deny_gid']
- );
+ ];
}
else {
$channel_acl = [ 'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '' ];
}
-
- if(perm_is_allowed($owner,$ob_hash,'write_pages')) {
+
+ if(perm_is_allowed($owner, $ob_hash, 'write_pages')) {
$x = [
'webpage' => ITEM_TYPE_CARD,
@@ -95,9 +99,9 @@ class Cards extends \Zotlabs\Web\Controller {
'content_label' => t('Add Card'),
'button' => t('Create'),
'nickname' => $channel['channel_address'],
- 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid']
+ 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid']
|| $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
- 'acl' => (($is_owner) ? populate_acl($channel_acl, false,
+ 'acl' => (($is_owner) ? populate_acl($channel_acl, false,
\Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_pages')) : ''),
'permissions' => $channel_acl,
'showacl' => (($is_owner) ? true : false),
@@ -110,7 +114,7 @@ class Cards extends \Zotlabs\Web\Controller {
'layoutselect' => false,
'expanded' => false,
'novoting' => false,
- 'catsenabled' => feature_enabled($owner,'categories'),
+ 'catsenabled' => feature_enabled($owner, 'categories'),
'bbco_autocomplete' => 'bbcode',
'bbcode' => true
];
@@ -119,14 +123,14 @@ class Cards extends \Zotlabs\Web\Controller {
$x['title'] = $_REQUEST['title'];
if($_REQUEST['body'])
$x['body'] = $_REQUEST['body'];
- $editor = status_editor($a,$x);
+ $editor = status_editor($a, $x);
}
else {
$editor = '';
}
-
-
+
+
$sql_extra = item_permissions_sql($owner);
if($selected_card) {
@@ -137,9 +141,9 @@ class Cards extends \Zotlabs\Web\Controller {
$sql_extra .= "and item.id = " . intval($r[0]['iid']) . " ";
}
}
-
- $r = q("select * from item
- where item.uid = %d and item_type = %d
+
+ $r = q("select * from item
+ where uid = %d and item_type = %d
$sql_extra order by item.created desc",
intval($owner),
intval(ITEM_TYPE_CARD)
@@ -149,9 +153,10 @@ class Cards extends \Zotlabs\Web\Controller {
and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_pending_remove = 0
and item.item_blocked = 0 ";
+ $items_result = [];
if($r) {
- $parents_str = ids_to_querystr($r,'id');
+ $parents_str = ids_to_querystr($r, 'id');
$items = q("SELECT item.*, item.id AS item_id
FROM item
@@ -164,24 +169,22 @@ class Cards extends \Zotlabs\Web\Controller {
if($items) {
xchan_query($items);
$items = fetch_post_tags($items, true);
- $items = conv_sort($items,'updated');
+ $items_result = conv_sort($items, 'updated');
}
- else
- $items = [];
}
$mode = 'cards';
-
- $content = conversation($items,$mode,false,'traditional');
+
+ $content = conversation($items_result, $mode, false, 'traditional');
$o = replace_macros(get_markup_template('cards.tpl'), [
'$title' => t('Cards'),
'$editor' => $editor,
'$content' => $content,
- '$pager' => alt_pager($a,count($items))
+ '$pager' => alt_pager($a, count($items_result))
]);
- return $o;
- }
+ return $o;
+ }
}
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index 7c4c900a1..b7e18f954 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -239,7 +239,7 @@ class Channel extends \Zotlabs\Web\Controller {
if($load || ($checkjs->disabled())) {
if($mid) {
- $r = q("SELECT distinct parent AS item_id from item where mid like '%s' and uid = %d $item_normal
+ $r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal
AND item_wall = 1 $sql_extra limit 1",
dbesc($mid . '%'),
intval(\App::$profile['profile_uid'])
@@ -249,13 +249,13 @@ class Channel extends \Zotlabs\Web\Controller {
}
}
else {
- $r = q("SELECT distinct id AS item_id, created FROM item
+ $r = q("SELECT id AS item_id FROM item
left join abook on item.author_xchan = abook.abook_xchan
WHERE uid = %d $item_normal
AND item_wall = 1 and item_thread_top = 1
AND (abook_blocked = 0 or abook.abook_flags is null)
$sql_extra $sql_extra2
- ORDER BY created DESC $pager_sql ",
+ ORDER BY created DESC, id $pager_sql ",
intval(\App::$profile['profile_uid'])
);
}
diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php
index 8288886cd..e23a751d9 100644
--- a/Zotlabs/Module/Connedit.php
+++ b/Zotlabs/Module/Connedit.php
@@ -826,27 +826,10 @@ class Connedit extends \Zotlabs\Web\Controller {
}
}
- $locstr = '';
-
- $locs = q("select hubloc_addr as location from hubloc left join site on hubloc_url = site_url where hubloc_hash = '%s'
- and hubloc_deleted = 0 and site_dead = 0",
- dbesc($contact['xchan_hash'])
- );
-
- if($locs) {
- foreach($locs as $l) {
- if(!($l['location']))
- continue;
- if(strpos($locstr,$l['location']) !== false)
- continue;
- if(strlen($locstr))
- $locstr .= ', ';
- $locstr .= $l['location'];
- }
- }
- else
+ $locstr = locations_by_netid($contact['xchan_hash']);
+ if(! $locstr)
$locstr = $contact['xchan_url'];
-
+
$clone_warn = '';
$clonable = (in_array($contact['xchan_network'],['zot','rss']) ? true : false);
if(! $clonable) {
diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php
index 47bce6c2b..cfb513365 100644
--- a/Zotlabs/Module/Cover_photo.php
+++ b/Zotlabs/Module/Cover_photo.php
@@ -64,12 +64,12 @@ class Cover_photo extends \Zotlabs\Web\Controller {
$image_id = substr($image_id,0,-2);
}
-
- $srcX = $_POST['xstart'];
- $srcY = $_POST['ystart'];
- $srcW = $_POST['xfinal'] - $srcX;
- $srcH = $_POST['yfinal'] - $srcY;
-
+
+
+ $srcX = intval($_POST['xstart']);
+ $srcY = intval($_POST['ystart']);
+ $srcW = intval($_POST['xfinal']) - $srcX;
+ $srcH = intval($_POST['yfinal']) - $srcY;
$r = q("select gender from profile where uid = %d and is_default = 1 limit 1",
intval(local_channel())
diff --git a/Zotlabs/Module/Dirsearch.php b/Zotlabs/Module/Dirsearch.php
index 53ec1a850..08f1f7a13 100644
--- a/Zotlabs/Module/Dirsearch.php
+++ b/Zotlabs/Module/Dirsearch.php
@@ -97,7 +97,10 @@ class Dirsearch extends \Zotlabs\Web\Controller {
else
$sync = false;
-
+ if(($dirmode == DIRECTORY_MODE_STANDALONE) && (! $hub)) {
+ $hub = \App::get_hostname();
+ }
+
if($hub)
$hub_query = " and xchan_hash in (select hubloc_hash from hubloc where hubloc_host = '" . protect_sprintf(dbesc($hub)) . "') ";
else
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index 6d895feb5..11dd0d174 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -343,14 +343,15 @@ class Display extends \Zotlabs\Web\Controller {
case 'atom':
$atom = replace_macros(get_markup_template('atom_feed.tpl'), array(
- '$version' => xmlify(\Zotlabs\Lib\System::get_project_version()),
- '$red' => xmlify(\Zotlabs\Lib\System::get_platform_name()),
- '$feed_id' => xmlify(\App::$cmd),
- '$feed_title' => xmlify(t('Article')),
- '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now', ATOM_TIME)),
- '$author' => '',
- '$owner' => '',
- '$profile_page' => xmlify(z_root() . '/display/' . $target_item['mid']),
+ '$version' => xmlify(\Zotlabs\Lib\System::get_project_version()),
+ '$generator' => xmlify(\Zotlabs\Lib\System::get_platform_name()),
+ '$generator_uri' => 'https://hubzilla.org',
+ '$feed_id' => xmlify(\App::$cmd),
+ '$feed_title' => xmlify(t('Article')),
+ '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now', ATOM_TIME)),
+ '$author' => '',
+ '$owner' => '',
+ '$profile_page' => xmlify(z_root() . '/display/' . $target_item['mid']),
));
$x = [ 'xml' => $atom, 'channel' => $channel, 'observer_hash' => $observer_hash, 'params' => $params ];
diff --git a/Zotlabs/Module/Email_resend.php b/Zotlabs/Module/Email_resend.php
new file mode 100644
index 000000000..f8a336be0
--- /dev/null
+++ b/Zotlabs/Module/Email_resend.php
@@ -0,0 +1,46 @@
+<?php
+
+namespace Zotlabs\Module;
+
+
+class Email_resend extends \Zotlabs\Web\Controller {
+
+ function post() {
+
+ if($_POST['token']) {
+ if(! account_approve(trim($_POST['token']))) {
+ notice(t('Token verification failed.'));
+ }
+ }
+
+ }
+
+
+ function get() {
+
+ if(argc() > 1) {
+ $result = false;
+ $email = hex2bin(argv(1));
+
+ if($email) {
+ $result = verify_email_address( [ 'resend' => true, 'email' => $email ] );
+ }
+
+ if($result) {
+ notice(t('Email verification resent'));
+ }
+ else {
+ notice(t('Unable to resend email verification message.'));
+ }
+
+ goaway(z_root() . '/email_validation/' . bin2hex($email));
+
+ }
+
+ // @todo - one can provide a form here to resend the mail
+ // after directing to here if a succesful login was attempted from an unverified address.
+
+
+ }
+
+}
diff --git a/Zotlabs/Module/Email_validation.php b/Zotlabs/Module/Email_validation.php
new file mode 100644
index 000000000..b8bb720cd
--- /dev/null
+++ b/Zotlabs/Module/Email_validation.php
@@ -0,0 +1,47 @@
+<?php
+
+namespace Zotlabs\Module;
+
+
+class Email_validation extends \Zotlabs\Web\Controller {
+
+ function post() {
+
+ if($_POST['token']) {
+ // This will redirect internally on success unless the channel is auto_created
+ if(! account_approve(trim(basename($_POST['token'])))) {
+ notice('Token verification failed.');
+ }
+ else {
+ if(get_config('system','auto_channel_create')) {
+ $next_page = get_config('system', 'workflow_channel_next', 'profiles');
+ }
+ if($next_page) {
+ goaway(z_root() . '/' . $next_page);
+ }
+ }
+ }
+
+ }
+
+
+ function get() {
+
+ if(argc() > 1) {
+ $email = hex2bin(argv(1));
+ }
+
+ $o = replace_macros(get_markup_template('email_validation.tpl'), [
+ '$title' => t('Email Verification Required'),
+ '$desc' => sprintf( t('A verification token was sent to your email address [%s]. Enter that token here to complete the account verification step. Please allow a few minutes for delivery, and check your spam folder if you do not see the message.'),$email),
+ '$resend' => t('Resend Email'),
+ '$email' => bin2hex($email),
+ '$submit' => t('Submit'),
+ '$token' => [ 'token', t('Validation token'),'','' ],
+ ]);
+
+ return $o;
+
+ }
+
+} \ No newline at end of file
diff --git a/Zotlabs/Module/Go.php b/Zotlabs/Module/Go.php
new file mode 100644
index 000000000..2c2dcf460
--- /dev/null
+++ b/Zotlabs/Module/Go.php
@@ -0,0 +1,66 @@
+<?php
+
+namespace Zotlabs\Module;
+
+
+class Go extends \Zotlabs\Web\Controller {
+
+ function init() {
+ if(local_channel()) {
+ $channel = \App::get_channel();
+ if($channel) {
+ profile_load($channel['channel_address'],0);
+ }
+ }
+ }
+
+
+
+ function get() {
+ if(! local_channel()) {
+ notify( t('This page is available only to site members') . EOL);
+ }
+
+ $channel = \App::get_channel();
+
+
+ $title = t('Welcome');
+
+ $m = t('What would you like to do?');
+
+ $m1 = t('Please bookmark this page if you would like to return to it in the future');
+
+
+ $options = [
+ 'profile_photo' => t('Upload a profile photo'),
+ 'profiles' => t('Edit your default profile'),
+ 'suggest' => t('View friend suggestions'),
+ 'directory' => t('View the directory to find other interesting channels'),
+ 'settings' => t('View/edit your channel settings'),
+ 'help' => t('View the site or project documentation'),
+ 'channel/' . $channel['channel_address'] => t('Visit your channel homepage'),
+ 'connections' => t('View your connections and/or add somebody whose address you already know'),
+ 'network' => t('View your personal stream (this may be empty until you add some connections)'),
+
+ ];
+
+ $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
+ $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true);
+
+ if($site_firehose || $net_firehose) {
+ $options['pubstream'] = t('View the public stream. Warning: this content is not moderated');
+ }
+
+ $o = replace_macros(get_markup_template('go.tpl'), [
+ '$title' => $title,
+ '$m' => $m,
+ '$m1' => $m1,
+ '$options' => $options
+
+ ]);
+
+ return $o;
+
+ }
+
+} \ No newline at end of file
diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php
index a9c3bb8e2..baeba82e8 100644
--- a/Zotlabs/Module/Hq.php
+++ b/Zotlabs/Module/Hq.php
@@ -29,6 +29,8 @@ class Hq extends \Zotlabs\Web\Controller {
);
}
+ killme();
+
}
function get($update = 0, $load = false) {
@@ -50,8 +52,8 @@ class Hq extends \Zotlabs\Web\Controller {
$item_normal_update = item_normal_update();
if(! $item_hash) {
- $r = q("SELECT mid FROM item
- WHERE uid = %d
+ $r = q("SELECT mid FROM item
+ WHERE uid = %d $item_normal
AND mid = parent_mid
ORDER BY created DESC LIMIT 1",
intval(local_channel())
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index ad829137a..db2d64d70 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -753,6 +753,7 @@ class Item extends \Zotlabs\Web\Controller {
if ((! $plink) && ($item_thread_top)) {
$plink = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $mid;
+ $plink = substr($plink,0,190);
}
$datarray['aid'] = $channel['channel_account_id'];
diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php
index b07824363..6d9fde17c 100644
--- a/Zotlabs/Module/Like.php
+++ b/Zotlabs/Module/Like.php
@@ -9,9 +9,41 @@ require_once('include/items.php');
class Like extends \Zotlabs\Web\Controller {
- function get() {
+
+
+ private function reaction_to_activity($reaction) {
+
+ $acts = [
+ 'like' => ACTIVITY_LIKE ,
+ 'dislike' => ACTIVITY_DISLIKE ,
+ 'agree' => ACTIVITY_AGREE ,
+ 'disagree' => ACTIVITY_DISAGREE ,
+ 'abstain' => ACTIVITY_ABSTAIN ,
+ 'attendyes' => ACTIVITY_ATTEND ,
+ 'attendno' => ACTIVITY_ATTENDNO ,
+ 'attendmaybe' => ACTIVITY_ATTENDMAYBE
+ ];
+
+ // unlike (etc.) reactions are an undo of positive reactions, rather than a negative action.
+ // The activity is the same in undo actions and will have the same activity mapping
+
+ if(substr($reaction,0,2) === 'un') {
+ $reaction = substr($reaction,2);
+ }
+
+ if(array_key_exists($reaction,$acts)) {
+ return $acts[$reaction];
+ }
+
+ return EMPTY_STR;
+
+ }
+
+
+
+ public function get() {
- $o = '';
+ $o = EMPTY_STR;
$sys_channel = get_sys_channel();
$sys_channel_id = (($sys_channel) ? $sys_channel['channel_id'] : 0);
@@ -35,48 +67,17 @@ class Like extends \Zotlabs\Web\Controller {
if(! $verb)
$verb = 'like';
- switch($verb) {
- case 'like':
- case 'unlike':
- $activity = ACTIVITY_LIKE;
- break;
- case 'dislike':
- case 'undislike':
- $activity = ACTIVITY_DISLIKE;
- break;
- case 'agree':
- case 'unagree':
- $activity = ACTIVITY_AGREE;
- break;
- case 'disagree':
- case 'undisagree':
- $activity = ACTIVITY_DISAGREE;
- break;
- case 'abstain':
- case 'unabstain':
- $activity = ACTIVITY_ABSTAIN;
- break;
- case 'attendyes':
- case 'unattendyes':
- $activity = ACTIVITY_ATTEND;
- break;
- case 'attendno':
- case 'unattendno':
- $activity = ACTIVITY_ATTENDNO;
- break;
- case 'attendmaybe':
- case 'unattendmaybe':
- $activity = ACTIVITY_ATTENDMAYBE;
- break;
- default:
- return;
- break;
+ $activity = $this->reaction_to_activity($verb);
+
+ if(! $activity) {
+ return EMPTY_STR;
}
+
$extended_like = false;
$object = $target = null;
- $post_type = '';
- $objtype = '';
+ $post_type = EMPTY_STR;
+ $objtype = EMPTY_STR;
if(argc() == 3) {
diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php
index 78c34583e..3392e4114 100644
--- a/Zotlabs/Module/Linkinfo.php
+++ b/Zotlabs/Module/Linkinfo.php
@@ -120,9 +120,9 @@ class Linkinfo extends \Zotlabs\Web\Controller {
$siteinfo = self::parseurl_getsiteinfo($url);
- // If this is a Red site, use zrl rather than url so they get zids sent to them by default
+ // If the site uses this platform, use zrl rather than url so they get zids sent to them by default
- if( x($siteinfo,'generator') && (strpos($siteinfo['generator'], \Zotlabs\Lib\System::get_platform_name() . ' ') === 0))
+ if(is_matrix_url($url))
$template = str_replace('url','zrl',$template);
if($siteinfo["title"] == "") {
diff --git a/Zotlabs/Module/Logout.php b/Zotlabs/Module/Logout.php
index 6aa11d110..f06e7278b 100644
--- a/Zotlabs/Module/Logout.php
+++ b/Zotlabs/Module/Logout.php
@@ -9,4 +9,4 @@ class Logout extends \Zotlabs\Web\Controller {
goaway(z_root());
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php
index 551303984..70e0048fb 100644
--- a/Zotlabs/Module/Network.php
+++ b/Zotlabs/Module/Network.php
@@ -209,8 +209,11 @@ class Network extends \Zotlabs\Web\Controller {
: '');
$sql_nets = '';
+
+ $distinct = '';
+ $item_thread_top = ' AND item_thread_top = 1 ';
- $sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE item_thread_top = 1 $sql_options ) ";
+ $sql_extra = $sql_options;
if($group) {
$contact_str = '';
@@ -226,7 +229,8 @@ class Network extends \Zotlabs\Web\Controller {
$contact_str = ' 0 ';
info( t('Privacy group is empty'));
}
-
+ $distinct = ' distinct ';
+ $item_thread_top = '';
$sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str )) or allow_gid like '" . protect_sprintf('%<' . dbesc($group_hash) . '>%') . "' ) and id = parent $item_normal ) ";
$x = group_rec_byhash(local_channel(), $group_hash);
@@ -250,6 +254,8 @@ class Network extends \Zotlabs\Web\Controller {
intval(local_channel())
);
if($r) {
+ $distinct = ' distinct ';
+ $item_thread_top = '';
$sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($r[0]['abook_xchan']) . "' or owner_xchan = '" . dbesc($r[0]['abook_xchan']) . "' ) $item_normal ) ";
$title = replace_macros(get_markup_template("section_title.tpl"),array(
'$title' => '<a href="' . zid($r[0]['xchan_url']) . '" ><img src="' . zid($r[0]['xchan_photo_s']) . '" alt="' . urlencode($r[0]['xchan_name']) . '" /></a> <a href="' . zid($r[0]['xchan_url']) . '" >' . $r[0]['xchan_name'] . '</a>'
@@ -264,13 +270,15 @@ class Network extends \Zotlabs\Web\Controller {
}
}
elseif($xchan) {
- $r = q("select * from xchan where xchan_hash = '%s'",
- dbesc($xchan)
- );
- if($r) {
- $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($xchan) . "' or owner_xchan = '" . dbesc($xchan) . "' ) $item_normal ) ";
- $title = replace_macros(get_markup_template("section_title.tpl"),array(
- '$title' => '<a href="' . zid($r[0]['xchan_url']) . '" ><img src="' . zid($r[0]['xchan_photo_s']) . '" alt="' . urlencode($r[0]['xchan_name']) . '" /></a> <a href="' . zid($r[0]['xchan_url']) . '" >' . $r[0]['xchan_name'] . '</a>'
+ $r = q("select * from xchan where xchan_hash = '%s'",
+ dbesc($xchan)
+ );
+ if($r) {
+ $distinct = ' distinct ';
+ $item_thread_top = '';
+ $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($xchan) . "' or owner_xchan = '" . dbesc($xchan) . "' ) $item_normal ) ";
+ $title = replace_macros(get_markup_template("section_title.tpl"),array(
+ '$title' => '<a href="' . zid($r[0]['xchan_url']) . '" ><img src="' . zid($r[0]['xchan_photo_s']) . '" alt="' . urlencode($r[0]['xchan_name']) . '" /></a> <a href="' . zid($r[0]['xchan_url']) . '" >' . $r[0]['xchan_name'] . '</a>'
));
$o = $tabs;
$o .= $title;
@@ -373,6 +381,8 @@ class Network extends \Zotlabs\Web\Controller {
}
if($conv) {
+ $distinct = ' distinct ';
+ $item_thread_top = '';
$sql_extra .= sprintf(" AND parent IN (SELECT distinct(parent) from item where ( author_xchan like '%s' or item_mentionsme = 1 )) ",
dbesc(protect_sprintf($channel['channel_hash']))
);
@@ -448,7 +458,7 @@ class Network extends \Zotlabs\Web\Controller {
if($nouveau && $load) {
// "New Item View" - show all items unthreaded in reverse created date order
- $items = q("SELECT item.*, item.id AS item_id, received FROM item
+ $items = q("SELECT item.*, item.id AS item_id, received FROM item
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
$net_query
WHERE true $uids $item_normal
@@ -477,11 +487,11 @@ class Network extends \Zotlabs\Web\Controller {
if($load) {
// Fetch a page full of parent items for this page
- $r = q("SELECT distinct item.id AS item_id, $ordering FROM item
+ $r = q("SELECT $distinct item.parent AS item_id FROM item
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
$net_query
- WHERE true $uids $item_normal
- AND item.parent = item.id
+ WHERE true $uids $item_thread_top $item_normal
+ AND item.mid = item.parent_mid
and (abook.abook_blocked = 0 or abook.abook_flags is null)
$sql_extra3 $sql_extra $sql_nets
$net_query2
diff --git a/Zotlabs/Module/New_channel.php b/Zotlabs/Module/New_channel.php
index 2b73fa191..9f2fea802 100644
--- a/Zotlabs/Module/New_channel.php
+++ b/Zotlabs/Module/New_channel.php
@@ -89,9 +89,7 @@ class New_channel extends \Zotlabs\Web\Controller {
change_channel($result['channel']['channel_id']);
- if(! strlen($next_page = get_config('system','workflow_channel_next')))
- $next_page = 'settings';
-
+ $next_page = get_config('system', 'workflow_channel_next', 'profiles');
goaway(z_root() . '/' . $next_page);
}
diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php
index a3f6cdfec..2e86804ac 100644
--- a/Zotlabs/Module/Ping.php
+++ b/Zotlabs/Module/Ping.php
@@ -149,13 +149,11 @@ class Ping extends \Zotlabs\Web\Controller {
$pubs = q("SELECT count(id) as total from item
WHERE uid = %d
AND author_xchan != '%s'
- AND obj_type != '%s'
AND item_unseen = 1
AND created > '" . datetime_convert('UTC','UTC',$_SESSION['static_loadtime']) . "'
$item_normal",
intval($sys['channel_id']),
- dbesc(get_observer_hash()),
- dbesc(ACTIVITY_OBJ_FILE)
+ dbesc(get_observer_hash())
);
if($pubs)
@@ -320,10 +318,13 @@ class Ping extends \Zotlabs\Web\Controller {
if(argc() > 1 && (argv(1) === 'network' || argv(1) === 'home')) {
$result = array();
- $r = q("SELECT * FROM item
- WHERE item_unseen = 1 and uid = %d $item_normal
+ $r = q("SELECT * FROM item
+ WHERE uid = %d
AND author_xchan != '%s'
- ORDER BY created DESC limit 300",
+ AND item_unseen = 1
+ $item_normal
+ ORDER BY created DESC, id
+ LIMIT 300",
intval(local_channel()),
dbesc($ob_hash)
);
@@ -492,8 +493,8 @@ class Ping extends \Zotlabs\Web\Controller {
$t3 = dba_timer();
if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) {
-
- $r = q("SELECT id, item_wall FROM item
+
+ $r = q("SELECT id, item_wall FROM item
WHERE item_unseen = 1 and uid = %d
$item_normal
AND author_xchan != '%s'",
diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php
index 45a606d5f..222b92721 100644
--- a/Zotlabs/Module/Profile_photo.php
+++ b/Zotlabs/Module/Profile_photo.php
@@ -1,10 +1,11 @@
<?php
namespace Zotlabs\Module;
-/* @file profile_photo.php
- @brief Module-file with functions for handling of profile-photos
-
-*/
+/*
+ * @file Profile_photo.php
+ * @brief Module-file with functions for handling of profile-photos
+ *
+ */
require_once('include/photo/photo_driver.php');
@@ -55,6 +56,10 @@ class Profile_photo extends \Zotlabs\Web\Controller {
if((array_key_exists('cropfinal',$_POST)) && (intval($_POST['cropfinal']) == 1)) {
+ // logger('crop: ' . print_r($_POST,true));
+
+
+
// phase 2 - we have finished cropping
if(argc() != 2) {
@@ -86,10 +91,10 @@ class Profile_photo extends \Zotlabs\Web\Controller {
}
- $srcX = $_POST['xstart'];
- $srcY = $_POST['ystart'];
- $srcW = $_POST['xfinal'] - $srcX;
- $srcH = $_POST['yfinal'] - $srcY;
+ $srcX = intval($_POST['xstart']);
+ $srcY = intval($_POST['ystart']);
+ $srcW = intval($_POST['xfinal']) - $srcX;
+ $srcH = intval($_POST['yfinal']) - $srcY;
$r = q("SELECT * FROM photo WHERE resource_id = '%s' AND uid = %d AND imgscale = %d LIMIT 1",
dbesc($image_id),
diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php
index c469a0eca..16a5fdbba 100644
--- a/Zotlabs/Module/Pubstream.php
+++ b/Zotlabs/Module/Pubstream.php
@@ -17,9 +17,16 @@ class Pubstream extends \Zotlabs\Web\Controller {
return login();
}
- $disable_discover_tab = get_config('system','disable_discover_tab') || get_config('system','disable_discover_tab') === false;
- if($disable_discover_tab)
- return;
+ $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
+ $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true);
+
+ if(! ($site_firehose || $net_firehose)) {
+ return '';
+ }
+
+ if($net_firehose) {
+ $site_firehose = false;
+ }
$mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : '');
@@ -142,7 +149,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
require_once('include/channel.php');
require_once('include/security.php');
- if(get_config('system','site_firehose')) {
+ if($site_firehose) {
$uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and item_wall = 1 ";
}
else {
@@ -189,10 +196,10 @@ class Pubstream extends \Zotlabs\Web\Controller {
}
else {
// Fetch a page full of parent items for this page
- $r = q("SELECT distinct item.id AS item_id, $ordering FROM item
+ $r = q("SELECT item.id AS item_id FROM item
left join abook on item.author_xchan = abook.abook_xchan
$net_query
- WHERE true $uids $item_normal
+ WHERE item_thread_top = 1 $uids $item_normal
AND item.parent = item.id
and (abook.abook_blocked = 0 or abook.abook_flags is null)
$sql_extra3 $sql_extra $sql_nets $net_query2
diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php
index deaee31bf..c7fa1cee8 100644
--- a/Zotlabs/Module/Register.php
+++ b/Zotlabs/Module/Register.php
@@ -150,9 +150,11 @@ class Register extends \Zotlabs\Web\Controller {
}
if($email_verify) {
- goaway(z_root());
+ goaway(z_root() . '/email_validation/' . bin2hex($result['email']));
}
-
+
+ // fall through and authenticate if no approvals or verifications were required.
+
authenticate_success($result['account'],null,true,false,true);
$new_channel = false;
@@ -217,6 +219,9 @@ class Register extends \Zotlabs\Web\Controller {
$privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "");
$perm_roles = \Zotlabs\Access\PermissionRoles::roles();
+
+ // A new account will not have a techlevel, but accounts can also be created by the administrator.
+
if((get_account_techlevel() < 4) && $privacy_role !== 'custom')
unset($perm_roles[t('Other')]);
@@ -231,15 +236,17 @@ class Register extends \Zotlabs\Web\Controller {
// Configurable whether to restrict age or not - default is based on international legal requirements
// This can be relaxed if you are on a restricted server that does not share with public servers
- if(get_config('system','no_age_restriction'))
+ if(get_config('system','no_age_restriction')) {
$label_tos = sprintf( t('I accept the %s for this website'), $toslink);
- else
+ }
+ else {
$age = get_config('system','minimum_age');
if(!$age) {
$age = 13;
}
$label_tos = sprintf( t('I am over %s years of age and accept the %s for this website'), $age, $toslink);
-
+ }
+
$enable_tos = 1 - intval(get_config('system','no_termsofservice'));
$email = array('email', t('Your email address'), ((x($_REQUEST,'email')) ? strip_tags(trim($_REQUEST['email'])) : ""));
@@ -255,6 +262,7 @@ class Register extends \Zotlabs\Web\Controller {
$auto_create = (get_config('system','auto_channel_create') ? true : false);
$default_role = get_config('system','default_permissions_role');
+ $email_verify = get_config('system','verify_email');
require_once('include/bbcode.php');
@@ -278,7 +286,7 @@ class Register extends \Zotlabs\Web\Controller {
'$pass1' => $password,
'$pass2' => $password2,
'$submit' => t('Register'),
- '$verify_note' => t('This site may require email verification after submitting this form. If you are returned to a login page, please check your email for instructions.')
+ '$verify_note' => (($email_verify) ? t('This site requires email verification. After completing this form, please check your email for further instructions.') : ''),
));
return $o;
diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php
index a572a5a42..4d35b59f3 100644
--- a/Zotlabs/Module/Search.php
+++ b/Zotlabs/Module/Search.php
@@ -165,40 +165,41 @@ class Search extends \Zotlabs\Web\Controller {
if($load) {
$r = null;
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $prefix = 'distinct on (created, mid)';
- $suffix = 'ORDER BY created DESC, mid';
- } else {
- $prefix = 'distinct';
- $suffix = 'group by mid ORDER BY created DESC';
- }
if(local_channel()) {
- $r = q("SELECT $prefix mid, item.id as item_id, item.* from item
+ $r = q("SELECT mid, MAX(id) as item_id from item
WHERE ((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = '' AND item.deny_gid = '' AND item_private = 0 )
OR ( item.uid = %d )) OR item.owner_xchan = '%s' )
$item_normal
$sql_extra
- $suffix $pager_sql ",
+ group by mid order by created desc $pager_sql ",
intval(local_channel()),
dbesc($sys['xchan_hash'])
);
}
if($r === null) {
- $r = q("SELECT $prefix mid, item.id as item_id, item.* from item
+ $r = q("SELECT mid, MAX(id) as item_id from item
WHERE (((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = ''
AND item.deny_gid = '' AND item_private = 0 )
and owner_xchan in ( " . stream_perms_xchans(($observer) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " ))
$pub_sql ) OR owner_xchan = '%s')
$item_normal
$sql_extra
- $suffix $pager_sql",
+ group by mid order by created desc $pager_sql",
dbesc($sys['xchan_hash'])
);
}
+ if($r) {
+ $str = ids_to_querystr($r,'item_id');
+ $r = q("select *, id as item_id from item where id in ( " . $str . ") order by created desc ");
+ }
}
else {
$r = array();
}
+
+
+
+
}
if($r) {
diff --git a/Zotlabs/Module/Settings/Permcats.php b/Zotlabs/Module/Settings/Permcats.php
index 336f69653..535399083 100644
--- a/Zotlabs/Module/Settings/Permcats.php
+++ b/Zotlabs/Module/Settings/Permcats.php
@@ -49,7 +49,7 @@ class Permcats {
if(argc() > 2)
- $name = argv(2);
+ $name = hex2bin(argv(2));
if(argc() > 3 && argv(3) === 'drop') {
\Zotlabs\Lib\Permcat::delete(local_channel(),$name);
@@ -70,7 +70,7 @@ class Permcats {
if(($pc['name']) && ($name) && ($pc['name'] == $name))
$existing = $pc['perms'];
if(! $pc['system'])
- $permcats[$pc['name']] = $pc['localname'];
+ $permcats[bin2hex($pc['name'])] = $pc['localname'];
}
}
diff --git a/Zotlabs/Module/Siteinfo.php b/Zotlabs/Module/Siteinfo.php
index fafd51f65..92ee78cc6 100644
--- a/Zotlabs/Module/Siteinfo.php
+++ b/Zotlabs/Module/Siteinfo.php
@@ -5,7 +5,6 @@ namespace Zotlabs\Module;
class Siteinfo extends \Zotlabs\Web\Controller {
function init() {
-logger(print_r($_REQUEST,true));
if (argv(1) === 'json' || $_REQUEST['module_format'] === 'json') {
$data = get_site_info();
json_return_and_die($data);
diff --git a/Zotlabs/Web/Router.php b/Zotlabs/Web/Router.php
index a6b780cdc..fb551e36f 100644
--- a/Zotlabs/Web/Router.php
+++ b/Zotlabs/Web/Router.php
@@ -38,10 +38,9 @@ class Router {
/**
* @brief Router constructor.
*
- * @param[in,out] App &$a
* @throws Exception module not found
*/
- function __construct(&$a) {
+ function __construct() {
$module = \App::$module;
$modname = "Zotlabs\\Module\\" . ucfirst($module);
@@ -179,9 +178,8 @@ class Router {
/**
* @brief
*
- * @param[in,out] App &$a
*/
- function Dispatch(&$a) {
+ function Dispatch() {
/**
* Call module functions
diff --git a/Zotlabs/Web/WebServer.php b/Zotlabs/Web/WebServer.php
index 9e6af8c4c..5183fb2b0 100644
--- a/Zotlabs/Web/WebServer.php
+++ b/Zotlabs/Web/WebServer.php
@@ -58,11 +58,10 @@ class WebServer {
if((x($_GET,'zid')) && (! \App::$install)) {
\App::$query_string = strip_zids(\App::$query_string);
if(! local_channel()) {
- if ($_SESSION['my_address']!=$_GET['zid'])
- {
- $_SESSION['my_address'] = $_GET['zid'];
- $_SESSION['authenticated'] = 0;
- }
+ if ($_SESSION['my_address']!=$_GET['zid']) {
+ $_SESSION['my_address'] = $_GET['zid'];
+ $_SESSION['authenticated'] = 0;
+ }
zid_init();
}
}
@@ -107,9 +106,43 @@ class WebServer {
check_config();
}
- //nav_set_selected('nothing');
+ $this->create_channel_links();
- $Router = new Router($a);
+ $Router = new Router();
+
+ $this->initialise_content();
+
+ $Router->Dispatch();
+
+ $this->set_homebase();
+
+ // now that we've been through the module content, see if the page reported
+ // a permission problem and if so, a 403 response would seem to be in order.
+
+ if(is_array($_SESSION['sysmsg']) && stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) {
+ header($_SERVER['SERVER_PROTOCOL'] . ' 403 ' . t('Permission denied.'));
+ }
+
+ call_hooks('page_end', \App::$page['content']);
+
+ construct_page();
+
+ killme();
+ }
+
+
+ private function initialise_content() {
+
+ /* initialise content region */
+
+ if(! x(\App::$page, 'content'))
+ \App::$page['content'] = '';
+
+ call_hooks('page_content_top', \App::$page['content']);
+
+ }
+
+ private function create_channel_links() {
/* Initialise the Link: response header if this is a channel page.
* This cannot be done inside the channel module because some protocol
@@ -135,26 +168,17 @@ class WebServer {
\App::$channel_links = $x['channel_links'];
header('Link: ' . \App::get_channel_links());
}
+ }
-
-
- /* initialise content region */
-
- if(! x(\App::$page, 'content'))
- \App::$page['content'] = '';
-
- call_hooks('page_content_top', \App::$page['content']);
-
-
- $Router->Dispatch($a);
-
+ private function set_homebase() {
// If you're just visiting, let javascript take you home
if(x($_SESSION, 'visitor_home')) {
$homebase = $_SESSION['visitor_home'];
- } elseif(local_channel()) {
+ }
+ elseif(local_channel()) {
$homebase = z_root() . '/channel/' . \App::$channel['channel_address'];
}
@@ -162,17 +186,8 @@ class WebServer {
\App::$page['content'] .= '<script>var homebase = "' . $homebase . '";</script>';
}
- // now that we've been through the module content, see if the page reported
- // a permission problem and if so, a 403 response would seem to be in order.
-
- if(is_array($_SESSION['sysmsg']) && stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) {
- header($_SERVER['SERVER_PROTOCOL'] . ' 403 ' . t('Permission denied.'));
- }
+ }
- call_hooks('page_end', \App::$page['content']);
- construct_page();
- killme();
- }
}
diff --git a/Zotlabs/Widget/Forums.php b/Zotlabs/Widget/Forums.php
index 0b90b9740..f65a639ff 100644
--- a/Zotlabs/Widget/Forums.php
+++ b/Zotlabs/Widget/Forums.php
@@ -64,13 +64,16 @@ class Forums {
// There also should be a way to update this via ajax.
for($x = 0; $x < count($r1); $x ++) {
- $r = q("select sum(item_unseen) as unseen from item where owner_xchan = '%s' and uid = %d and item_unseen = 1 $perms_sql ",
+ $r = q("select sum(item_unseen) as unseen from item
+ where uid = %d and owner_xchan = '%s' and item_unseen = 1 $perms_sql ",
dbesc($r1[$x]['xchan_hash']),
intval(local_channel())
);
if($r)
$r1[$x]['unseen'] = $r[0]['unseen'];
+ }
+
/**
* @FIXME
* This SQL makes the counts correct when you get forum posts arriving from different routes/sources
@@ -79,21 +82,19 @@ class Forums {
* It may make more sense in that query to look for the mention in the body rather than another join,
* but that makes it very inefficient.
*
- $r = q("select sum(item_unseen) as unseen from item left join term on oid = id where otype = %d and owner_xchan != '%s' and item.uid = %d and url = '%s' and ttype = %d $perms_sql ",
- intval(TERM_OBJ_POST),
- dbesc($r1[$x]['xchan_hash']),
- intval(local_channel()),
- dbesc($r1[$x]['xchan_url']),
- intval(TERM_MENTION)
- );
- if($r)
- $r1[$x]['unseen'] = ((array_key_exists('unseen',$r1[$x])) ? $r1[$x]['unseen'] + $r[0]['unseen'] : $r[0]['unseen']);
+ * $r = q("select sum(item_unseen) as unseen from item left join term on oid = id where otype = %d and owner_xchan != '%s' and item.uid = %d and url = '%s' and ttype = %d $perms_sql ",
+ * intval(TERM_OBJ_POST),
+ * dbesc($r1[$x]['xchan_hash']),
+ * intval(local_channel()),
+ * dbesc($r1[$x]['xchan_url']),
+ * intval(TERM_MENTION)
+ * );
+ * if($r)
+ * $r1[$x]['unseen'] = ((array_key_exists('unseen',$r1[$x])) ? $r1[$x]['unseen'] + $r[0]['unseen'] : $r[0]['unseen']);
*
* end @FIXME
*/
- }
-
if($r1) {
$o .= '<div class="widget">';
$o .= '<h3>' . t('Forums') . '</h3><ul class="nav nav-pills flex-column">';
diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php
index 5a0c1f3d5..322a7b60a 100644
--- a/Zotlabs/Widget/Notifications.php
+++ b/Zotlabs/Widget/Notifications.php
@@ -145,7 +145,8 @@ class Notifications {
'$module' => \App::$module,
'$notifications' => $notifications,
'$no_notifications' => t('Sorry, you have got no notifications at the moment'),
- '$loading' => t('Loading')
+ '$loading' => t('Loading'),
+ '$startpage' => get_pconfig(local_channel(), 'system', 'startpage')
));
return $o;