aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Acl.php43
-rw-r--r--Zotlabs/Module/Admin/Accounts.php7
-rw-r--r--Zotlabs/Module/Admin/Dbsync.php54
-rw-r--r--Zotlabs/Module/Admin/Profs.php39
-rw-r--r--Zotlabs/Module/Admin/Security.php12
-rw-r--r--Zotlabs/Module/Admin/Site.php42
-rw-r--r--Zotlabs/Module/Api.php10
-rw-r--r--Zotlabs/Module/Articles.php3
-rw-r--r--Zotlabs/Module/Authorize.php94
-rw-r--r--Zotlabs/Module/Cards.php79
-rw-r--r--Zotlabs/Module/Channel.php16
-rw-r--r--Zotlabs/Module/Cloud.php3
-rw-r--r--Zotlabs/Module/Connections.php10
-rw-r--r--Zotlabs/Module/Connedit.php24
-rw-r--r--Zotlabs/Module/Cover_photo.php29
-rw-r--r--Zotlabs/Module/Defperms.php2
-rw-r--r--Zotlabs/Module/Directory.php7
-rw-r--r--Zotlabs/Module/Dirsearch.php7
-rw-r--r--Zotlabs/Module/Display.php22
-rw-r--r--Zotlabs/Module/Email_resend.php46
-rw-r--r--Zotlabs/Module/Email_validation.php48
-rw-r--r--Zotlabs/Module/Embedphotos.php2
-rw-r--r--Zotlabs/Module/Go.php67
-rw-r--r--Zotlabs/Module/Hq.php37
-rw-r--r--Zotlabs/Module/Import.php2
-rw-r--r--Zotlabs/Module/Item.php32
-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/Magic.php2
-rw-r--r--Zotlabs/Module/Network.php48
-rw-r--r--Zotlabs/Module/New_channel.php5
-rw-r--r--Zotlabs/Module/Owa.php2
-rw-r--r--Zotlabs/Module/Ping.php52
-rw-r--r--Zotlabs/Module/Profile_photo.php55
-rw-r--r--Zotlabs/Module/Pubstream.php38
-rw-r--r--Zotlabs/Module/Register.php26
-rw-r--r--Zotlabs/Module/Search.php25
-rw-r--r--Zotlabs/Module/Settings/Account.php2
-rw-r--r--Zotlabs/Module/Settings/Channel.php9
-rw-r--r--Zotlabs/Module/Settings/Display.php26
-rw-r--r--Zotlabs/Module/Settings/Featured.php15
-rw-r--r--Zotlabs/Module/Settings/Permcats.php4
-rw-r--r--Zotlabs/Module/Share.php4
-rw-r--r--Zotlabs/Module/Siteinfo.php1
-rw-r--r--Zotlabs/Module/Sitelist.php4
-rw-r--r--Zotlabs/Module/Thing.php5
-rw-r--r--Zotlabs/Module/Token.php49
-rw-r--r--Zotlabs/Module/Viewconnections.php10
-rw-r--r--Zotlabs/Module/Wfinger.php3
50 files changed, 751 insertions, 458 deletions
diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php
index ad1c8b8cd..fae7e2e44 100644
--- a/Zotlabs/Module/Acl.php
+++ b/Zotlabs/Module/Acl.php
@@ -1,36 +1,39 @@
<?php
+
namespace Zotlabs\Module;
-/*
- * ACL selector json backend
+require_once 'include/acl_selectors.php';
+require_once 'include/group.php';
+
+/**
+ * @brief ACL selector json backend.
+ *
* This module provides JSON lists of connections and local/remote channels
* (xchans) to populate various tools such as the ACL (AccessControlList) popup
- * and various auto-complete functions (such as email recipients, search, and
+ * and various auto-complete functions (such as email recipients, search, and
* mention targets.
+ *
* There are two primary output structural formats. One for the ACL widget and
* the other for auto-completion.
- * Many of the behaviour variations are triggered on the use of single character keys
- * however this functionality has grown in an ad-hoc manner and has gotten quite messy over time.
+ *
+ * Many of the behaviour variations are triggered on the use of single character
+ * keys however this functionality has grown in an ad-hoc manner and has gotten
+ * quite messy over time.
*/
-
-require_once("include/acl_selectors.php");
-require_once("include/group.php");
-
-
class Acl extends \Zotlabs\Web\Controller {
function init() {
-
+
logger('mod_acl: ' . print_r($_REQUEST,true));
-
+
$start = (x($_REQUEST,'start') ? $_REQUEST['start'] : 0);
$count = (x($_REQUEST,'count') ? $_REQUEST['count'] : 500);
$search = (x($_REQUEST,'search') ? $_REQUEST['search'] : '');
$type = (x($_REQUEST,'type') ? $_REQUEST['type'] : '');
- $noforums = (x($_REQUEST,'n') ? $_REQUEST['n'] : false);
+ $noforums = (x($_REQUEST,'n') ? $_REQUEST['n'] : false);
- // $type =
+ // $type =
// '' => standard ACL request
// 'g' => Groups only ACL request
// 'f' => forums only ACL request
@@ -382,15 +385,13 @@ class Acl extends \Zotlabs\Web\Controller {
'count' => $count,
'items' => $items,
);
-
-
-
+
echo json_encode($o);
-
+
killme();
}
-
-
+
+
function navbar_complete(&$a) {
// logger('navbar_complete');
@@ -447,5 +448,5 @@ class Acl extends \Zotlabs\Web\Controller {
}
return array();
}
-
+
}
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/Dbsync.php b/Zotlabs/Module/Admin/Dbsync.php
index cff8a2484..469af2aa5 100644
--- a/Zotlabs/Module/Admin/Dbsync.php
+++ b/Zotlabs/Module/Admin/Dbsync.php
@@ -7,36 +7,38 @@ namespace Zotlabs\Module\Admin;
class Dbsync {
-
-
function get() {
$o = '';
if(argc() > 3 && intval(argv(3)) && argv(2) === 'mark') {
- set_config('database', 'update_r' . intval(argv(3)), 'success');
- if(intval(get_config('system','db_version')) <= intval(argv(3)))
- set_config('system','db_version',intval(argv(3)) + 1);
+ // remove the old style config if it exists
+ del_config('database', 'update_r' . intval(argv(3)));
+ set_config('database', '_' . intval(argv(3)), 'success');
+ if(intval(get_config('system','db_version')) < intval(argv(3)))
+ set_config('system','db_version',intval(argv(3)));
info( t('Update has been marked successful') . EOL);
goaway(z_root() . '/admin/dbsync');
}
if(argc() > 2 && intval(argv(2))) {
- require_once('install/update.php');
- $func = 'update_r' . intval(argv(2));
- if(function_exists($func)) {
- $retval = $func();
+ $x = intval(argv(2));
+ $s = '_' . $x;
+ $cls = '\\Zotlabs\Update\\' . $s ;
+ if(class_exists($cls)) {
+ $c = new $cls();
+ $retval = $c->run();
if($retval === UPDATE_FAILED) {
- $o .= sprintf( t('Executing %s failed. Check system logs.'), $func);
+ $o .= sprintf( t('Executing %s failed. Check system logs.'), $s);
}
elseif($retval === UPDATE_SUCCESS) {
- $o .= sprintf( t('Update %s was successfully applied.'), $func);
- set_config('database',$func, 'success');
+ $o .= sprintf( t('Update %s was successfully applied.'), $s);
+ set_config('database',$s, 'success');
}
else
- $o .= sprintf( t('Update %s did not return a status. Unknown if it succeeded.'), $func);
+ $o .= sprintf( t('Update %s did not return a status. Unknown if it succeeded.'), $s);
}
else
- $o .= sprintf( t('Update function %s could not be found.'), $func);
+ $o .= sprintf( t('Update function %s could not be found.'), $s);
return $o;
}
@@ -45,23 +47,25 @@ class Dbsync {
$r = q("select * from config where cat = 'database' ");
if(count($r)) {
foreach($r as $rr) {
- $upd = intval(substr($rr['k'],8));
+ $upd = intval(substr($rr['k'],-4));
if($rr['v'] === 'success')
continue;
$failed[] = $upd;
}
}
- if(! count($failed))
- return '<div class="generic-content-wrapper-styled"><h3>' . t('No failed updates.') . '</h3></div>';
-
- $o = replace_macros(get_markup_template('failed_updates.tpl'),array(
- '$base' => z_root(),
- '$banner' => t('Failed Updates'),
- '$desc' => '',
- '$mark' => t('Mark success (if update was manually applied)'),
- '$apply' => t('Attempt to execute this update step automatically'),
- '$failed' => $failed
+ if(count($failed)) {
+ $o = replace_macros(get_markup_template('failed_updates.tpl'),array(
+ '$base' => z_root(),
+ '$banner' => t('Failed Updates'),
+ '$desc' => '',
+ '$mark' => t('Mark success (if update was manually applied)'),
+ '$apply' => t('Attempt to execute this update step automatically'),
+ '$failed' => $failed
));
+ }
+ else {
+ return '<div class="generic-content-wrapper-styled"><h3>' . t('No failed updates.') . '</h3></div>';
+ }
return $o;
}
diff --git a/Zotlabs/Module/Admin/Profs.php b/Zotlabs/Module/Admin/Profs.php
index b3da09cb7..eb2501d43 100644
--- a/Zotlabs/Module/Admin/Profs.php
+++ b/Zotlabs/Module/Admin/Profs.php
@@ -9,17 +9,37 @@ class Profs {
if(array_key_exists('basic',$_REQUEST)) {
$arr = explode(',',$_REQUEST['basic']);
- for($x = 0; $x < count($arr); $x ++)
- if(trim($arr[$x]))
- $arr[$x] = trim($arr[$x]);
- set_config('system','profile_fields_basic',$arr);
-
+ array_walk($arr,'array_trim');
+ $narr = [];
+ if(count($arr)) {
+ foreach($arr as $a) {
+ if(strlen($a)) {
+ $narr[] = $a;
+ }
+ }
+ }
+ if(! $narr)
+ del_config('system','profile_fields_basic');
+ else
+ set_config('system','profile_fields_basic',$narr);
+
+
if(array_key_exists('advanced',$_REQUEST)) {
$arr = explode(',',$_REQUEST['advanced']);
- for($x = 0; $x < count($arr); $x ++)
- if(trim($arr[$x]))
- $arr[$x] = trim($arr[$x]);
- set_config('system','profile_fields_advanced',$arr);
+ array_walk($arr,'array_trim');
+ $narr = [];
+ if(count($arr)) {
+ foreach($arr as $a) {
+ if(strlen($a)) {
+ $narr[] = $a;
+ }
+ }
+ }
+ if(! $narr)
+ del_config('system','profile_fields_advanced');
+ else
+ set_config('system','profile_fields_advanced',$narr);
+
}
goaway(z_root() . '/admin/profs');
}
@@ -98,6 +118,7 @@ class Profs {
$basic = '';
$barr = array();
$fields = get_profile_fields_basic();
+
if(! $fields)
$fields = get_profile_fields_basic(1);
if($fields) {
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 32417c77c..015c6535c 100644
--- a/Zotlabs/Module/Admin/Site.php
+++ b/Zotlabs/Module/Admin/Site.php
@@ -24,23 +24,28 @@ class Site {
$siteinfo = ((x($_POST,'siteinfo')) ? trim($_POST['siteinfo']) : '');
$language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
$theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : '');
- $theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : '');
+// $theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : '');
// $site_channel = ((x($_POST,'site_channel')) ? notags(trim($_POST['site_channel'])) : '');
$maximagesize = ((x($_POST,'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0);
$register_policy = ((x($_POST,'register_policy')) ? intval(trim($_POST['register_policy'])) : 0);
-
+ $minimum_age = ((x($_POST,'minimum_age')) ? intval(trim($_POST['minimum_age'])) : 13);
$access_policy = ((x($_POST,'access_policy')) ? intval(trim($_POST['access_policy'])) : 0);
$invite_only = ((x($_POST,'invite_only')) ? True : False);
$abandon_days = ((x($_POST,'abandon_days')) ? intval(trim($_POST['abandon_days'])) : 0);
$register_text = ((x($_POST,'register_text')) ? notags(trim($_POST['register_text'])) : '');
+ $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);
+ $open_pubstream = ((x($_POST,'open_pubstream')) ? 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'])) : '');
@@ -76,6 +81,9 @@ class Site {
set_config('system', 'poll_interval', $poll_interval);
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);
set_config('system', 'login_on_homepage', $login_on_homepage);
@@ -114,15 +122,16 @@ class Site {
set_config('system','siteinfo',$siteinfo);
set_config('system', 'language', $language);
set_config('system', 'theme', $theme);
- if ( $theme_mobile === '---' ) {
- del_config('system', 'mobile_theme');
- } else {
- set_config('system', 'mobile_theme', $theme_mobile);
- }
+// if ( $theme_mobile === '---' ) {
+// del_config('system', 'mobile_theme');
+// } else {
+// set_config('system', 'mobile_theme', $theme_mobile);
+// }
// set_config('system','site_channel', $site_channel);
set_config('system','maximagesize', $maximagesize);
set_config('system','register_policy', $register_policy);
+ set_config('system','minimum_age', $minimum_age);
set_config('system','invitation_only', $invite_only);
set_config('system','access_policy', $access_policy);
set_config('system','account_abandon_days', $abandon_days);
@@ -130,6 +139,8 @@ 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','open_pubstream', $open_pubstream);
set_config('system','force_queue_threshold', $force_queue);
if ($global_directory == '') {
del_config('system', 'directory_submit_url');
@@ -209,9 +220,10 @@ class Site {
$realm = get_directory_realm();
// directory server should not be set or settable unless we are a directory client
+ // avoid older redmatrix servers which don't have modern encryption
if($dirmode == DIRECTORY_MODE_NORMAL) {
- $x = q("select site_url from site where site_flags in (%d,%d) and site_realm = '%s' and site_dead = 0",
+ $x = q("select site_url from site where site_flags in (%d,%d) and site_realm = '%s' and site_dead = 0 and site_project != 'redmatrix'",
intval(DIRECTORY_MODE_SECONDARY),
intval(DIRECTORY_MODE_PRIMARY),
dbesc($realm)
@@ -288,17 +300,18 @@ class Site {
'$techlock' => [ 'techlock', t('Lock the technical skill level setting'), get_config('system','techlevel_lock'), t('Members can set their own technical comfort level by default') ],
- '$banner' => array('banner', t("Banner/Logo"), $banner, ""),
+ '$banner' => array('banner', t("Banner/Logo"), $banner, t('Unfiltered HTML/CSS/JS is allowed')),
'$admininfo' => array('admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. BBCode can be used here")),
'$siteinfo' => array('siteinfo', t('Site Information'), get_config('system','siteinfo'), t("Publicly visible description of this site. Displayed on siteinfo page. BBCode can be used here")),
'$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices),
'$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices),
- '$theme_mobile' => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile),
+// '$theme_mobile' => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile),
// '$site_channel' => array('site_channel', t("Channel to use for this website's static pages"), get_config('system','site_channel'), t("Site Channel")),
'$feed_contacts' => array('feed_contacts', t('Allow Feeds as Connections'),get_config('system','feed_contacts'),t('(Heavy system resource usage)')),
'$maximagesize' => array('maximagesize', t("Maximum image size"), intval(get_config('system','maximagesize')), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")),
'$register_policy' => array('register_policy', t("Does this site allow new member registration?"), get_config('system','register_policy'), "", $register_choices),
'$invite_only' => array('invite_only', t("Invitation only"), get_config('system','invitation_only'), t("Only allow new member registrations with an invitation code. Above register policy must be set to Yes.")),
+ '$minimum_age' => array('minimum_age', t("Minimum age"), (x(get_config('system','minimum_age'))?get_config('system','minimum_age'):13), t("Minimum age (in years) for who may register on this site.")),
'$access_policy' => array('access_policy', t("Which best describes the types of account offered by this hub?"), get_config('system','access_policy'), "This is displayed on the public server site list.", $access_choices),
'$register_text' => array('register_text', t("Register text"), htmlspecialchars(get_config('system','register_text'), ENT_QUOTES, 'UTF-8'), t("Will be displayed prominently on the registration page.")),
'$frontpage' => array('frontpage', t("Site homepage to show visitors (default: login box)"), get_config('system','frontpage'), t("example: 'public' to show public stream, 'page/sys/home' to show a system webpage called 'home' or 'include:home.html' to include a file.")),
@@ -308,6 +321,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.')),
+ '$open_pubstream' => array('open_pubstream', t('Allow anybody on the internet to access the Public streams'), get_config('system','open_pubstream',1), t('Disable to require authentication before viewing. Warning: this content is unmoderated.')),
'$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,6 +343,13 @@ class Site {
'$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.")),
'$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
'$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')),
+
+
'$form_security_token' => get_form_security_token("admin_site"),
));
}
diff --git a/Zotlabs/Module/Api.php b/Zotlabs/Module/Api.php
index a2a1aac1d..aa0fca54d 100644
--- a/Zotlabs/Module/Api.php
+++ b/Zotlabs/Module/Api.php
@@ -39,10 +39,12 @@ class Api extends \Zotlabs\Web\Controller {
// get consumer/client from request token
try {
- $request = OAuth1Request::from_request();
+ $request = \OAuth1Request::from_request();
}
catch(\Exception $e) {
- echo "<pre>"; var_dump($e); killme();
+ logger('OAuth exception: ' . print_r($e,true));
+ // echo "<pre>"; var_dump($e);
+ killme();
}
@@ -52,7 +54,7 @@ class Api extends \Zotlabs\Web\Controller {
if (is_null($app))
return "Invalid request. Unknown token.";
- $consumer = new OAuth1Consumer($app['client_id'], $app['pw'], $app['redirect_uri']);
+ $consumer = new \OAuth1Consumer($app['client_id'], $app['pw'], $app['redirect_uri']);
$verifier = md5($app['secret'] . local_channel());
set_config('oauth', $verifier, local_channel());
@@ -63,7 +65,7 @@ class Api extends \Zotlabs\Web\Controller {
$glue = '?';
if(strstr($consumer->callback_url,$glue))
$glue = '?';
- goaway($consumer->callback_url . $glue . "oauth_token=" . OAuth1Util::urlencode_rfc3986($params['oauth_token']) . "&oauth_verifier=" . OAuth1Util::urlencode_rfc3986($verifier));
+ goaway($consumer->callback_url . $glue . "oauth_token=" . \OAuth1Util::urlencode_rfc3986($params['oauth_token']) . "&oauth_verifier=" . \OAuth1Util::urlencode_rfc3986($verifier));
killme();
}
diff --git a/Zotlabs/Module/Articles.php b/Zotlabs/Module/Articles.php
index 25daca81d..e2e0fed5d 100644
--- a/Zotlabs/Module/Articles.php
+++ b/Zotlabs/Module/Articles.php
@@ -35,7 +35,7 @@ class Articles extends \Zotlabs\Web\Controller {
return;
}
- nav_set_selected(t('Cards'));
+ nav_set_selected(t('Articles'));
head_add_link([
'rel' => 'alternate',
@@ -102,6 +102,7 @@ class Articles extends \Zotlabs\Web\Controller {
'permissions' => $channel_acl,
'showacl' => (($is_owner) ? true : false),
'visitor' => true,
+ 'body' => '[summary][/summary]',
'hide_location' => false,
'hide_voting' => false,
'profile_uid' => intval($owner),
diff --git a/Zotlabs/Module/Authorize.php b/Zotlabs/Module/Authorize.php
index 06f66c456..254700b4e 100644
--- a/Zotlabs/Module/Authorize.php
+++ b/Zotlabs/Module/Authorize.php
@@ -2,70 +2,66 @@
namespace Zotlabs\Module;
-
-class Authorize extends \Zotlabs\Web\Controller {
+use Zotlabs\Identity\OAuth2Storage;
- function get() {
+class Authorize extends \Zotlabs\Web\Controller {
+ function init() {
- // workaround for HTTP-auth in CGI mode
- if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
- $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ;
- if(strlen($userpass)) {
- list($name, $password) = explode(':', $userpass);
- $_SERVER['PHP_AUTH_USER'] = $name;
- $_SERVER['PHP_AUTH_PW'] = $password;
- }
+ // workaround for HTTP-auth in CGI mode
+ if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
+ $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ;
+ if(strlen($userpass)) {
+ list($name, $password) = explode(':', $userpass);
+ $_SERVER['PHP_AUTH_USER'] = $name;
+ $_SERVER['PHP_AUTH_PW'] = $password;
}
-
- if (x($_SERVER, 'HTTP_AUTHORIZATION')) {
- $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)) ;
- if(strlen($userpass)) {
- list($name, $password) = explode(':', $userpass);
- $_SERVER['PHP_AUTH_USER'] = $name;
- $_SERVER['PHP_AUTH_PW'] = $password;
- }
+ }
+
+ if (x($_SERVER, 'HTTP_AUTHORIZATION')) {
+ $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)) ;
+ if(strlen($userpass)) {
+ list($name, $password) = explode(':', $userpass);
+ $_SERVER['PHP_AUTH_USER'] = $name;
+ $_SERVER['PHP_AUTH_PW'] = $password;
}
+ }
+ $s = new \Zotlabs\Identity\OAuth2Server(new OAuth2Storage(\DBA::$dba->db));
+ $request = \OAuth2\Request::createFromGlobals();
+ $response = new \OAuth2\Response();
+ // validate the authorize request
+ if (! $s->validateAuthorizeRequest($request, $response)) {
+ $response->send();
+ killme();
+ }
- require_once('include/oauth2.php');
-
- $request = \OAuth2\Request::createFromGlobals();
- $response = new \OAuth2\Response();
-
- // validate the authorize request
- if (! $oauth2_server->validateAuthorizeRequest($request, $response)) {
- $response->send();
- killme();
- }
-
- // display an authorization form
- if (empty($_POST)) {
+ // display an authorization form
+ if (empty($_POST)) {
- return '
+ return '
<form method="post">
<label>Do You Authorize TestClient?</label><br />
<input type="submit" name="authorized" value="yes">
<input type="submit" name="authorized" value="no">
</form>';
+ }
+
+ // print the authorization code if the user has authorized your client
+ $is_authorized = ($_POST['authorized'] === 'yes');
+ $s->handleAuthorizeRequest($request, $response, $is_authorized, local_channel());
+ if ($is_authorized) {
+ // this is only here so that you get to see your code in the cURL request. Otherwise,
+ // we'd redirect back to the client
+ $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=')+5, 40);
+ echo("SUCCESS! Authorization Code: $code");
+ }
+
+ $response->send();
+ killme();
}
- // print the authorization code if the user has authorized your client
- $is_authorized = ($_POST['authorized'] === 'yes');
- $oauth2_server->handleAuthorizeRequest($request, $response, $is_authorized);
- if ($is_authorized) {
- // this is only here so that you get to see your code in the cURL request. Otherwise,
- // we'd redirect back to the client
- $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=')+5, 40);
- echo("SUCCESS! Authorization Code: $code");
-
- }
-
- $response->send();
- killme();
- }
-
-} \ No newline at end of file
+}
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..3d3eb2a85 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -204,7 +204,7 @@ class Channel extends \Zotlabs\Web\Controller {
$_SESSION['loadtime'] = datetime_convert();
}
else {
- $r = q("SELECT distinct parent AS item_id, created from item
+ $r = q("SELECT distinct parent AS item_id from item
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
WHERE uid = %d $item_normal_update
AND item_wall = 1 $simple_update
@@ -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
- 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)
+ $r = q("SELECT item.parent AS item_id FROM item
+ left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids )
+ WHERE true and item.uid = %d AND item.item_thread_top = 1 $item_normal
+ AND (abook.abook_blocked = 0 or abook.abook_flags is null)
+ AND item.item_wall = 1
$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/Cloud.php b/Zotlabs/Module/Cloud.php
index 2215507ca..8b5476efc 100644
--- a/Zotlabs/Module/Cloud.php
+++ b/Zotlabs/Module/Cloud.php
@@ -110,6 +110,9 @@ class Cloud extends \Zotlabs\Web\Controller {
elseif($err instanceof \Sabre\DAV\Exception\Forbidden) {
notice( t('Permission denied') . EOL);
}
+ elseif($err instanceof \Sabre\DAV\Exception\NotImplemented) {
+ notice( t('Please refresh page') . EOL);
+ }
else {
notice( t('Unknown error') . EOL);
}
diff --git a/Zotlabs/Module/Connections.php b/Zotlabs/Module/Connections.php
index f42ff9b84..55e716ace 100644
--- a/Zotlabs/Module/Connections.php
+++ b/Zotlabs/Module/Connections.php
@@ -232,7 +232,7 @@ class Connections extends \Zotlabs\Web\Controller {
if($rr['xchan_url']) {
if(($rr['vcard']) && is_array($rr['vcard']['tels']) && $rr['vcard']['tels'][0]['nr'])
- $phone = ((\App::$is_mobile || \App::$is_tablet) ? $rr['vcard']['tels'][0]['nr'] : '');
+ $phone = $rr['vcard']['tels'][0]['nr'];
else
$phone = '';
@@ -245,6 +245,11 @@ class Connections extends \Zotlabs\Web\Controller {
((intval($rr['abook_blocked'])) ? t('Blocked') : ''),
((intval($rr['abook_not_here'])) ? t('Not connected at this location') : '')
);
+
+ $oneway = false;
+ if(! intval(get_abconfig(local_channel(),$rr['xchan_hash'],'their_perms','post_comments'))) {
+ $oneway = true;
+ }
foreach($status as $str) {
if(!$str)
@@ -283,7 +288,8 @@ class Connections extends \Zotlabs\Web\Controller {
'ignore_hover' => t('Ignore connection'),
'ignore' => ((! $rr['abook_ignored']) ? t('Ignore') : false),
'recent_label' => t('Recent activity'),
- 'recentlink' => z_root() . '/network/?f=&cid=' . intval($rr['abook_id'])
+ 'recentlink' => z_root() . '/network/?f=&cid=' . intval($rr['abook_id']),
+ 'oneway' => $oneway
);
}
}
diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php
index 8288886cd..f359175c1 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) {
@@ -912,7 +895,6 @@ class Connedit extends \Zotlabs\Web\Controller {
'$permnote_self' => t('Some permissions may be inherited from your channel\'s <a href="settings"><strong>privacy settings</strong></a>, which have higher priority than individual settings. You can change those settings here but they wont have any impact unless the inherited setting changes.'),
'$lastupdtext' => t('Last update:'),
'$last_update' => relative_date($contact['abook_connected']),
- '$is_mobile' => ((\App::$is_mobile || \App::$is_tablet) ? true : false),
'$profile_select' => contact_profile_assign($contact['abook_profile']),
'$multiprofs' => $multiprofs,
'$contact_id' => $contact['abook_id'],
diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php
index 47bce6c2b..56e35f912 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())
@@ -207,7 +207,7 @@ class Cover_photo extends \Zotlabs\Web\Controller {
}
}
- $imagedata = (($os_storage) ? @file_get_contents($imagedata) : $imagedata);
+ $imagedata = (($os_storage) ? @file_get_contents(dbunescbin($imagedata)) : dbunescbin($imagedata));
$ph = photo_factory($imagedata, $filetype);
if(! $ph->is_valid()) {
@@ -357,12 +357,23 @@ class Cover_photo extends \Zotlabs\Web\Controller {
'$user' => \App::$channel['channel_address'],
'$lbl_upfile' => t('Upload File:'),
'$lbl_profiles' => t('Select a profile:'),
- '$title' => t('Upload Cover Photo'),
+ '$title' => t('Change Cover Photo'),
'$submit' => t('Upload'),
'$profiles' => $profiles,
+ '$embedPhotos' => t('Use a photo from your albums'),
+ '$embedPhotosModalTitle' => t('Use a photo from your albums'),
+ '$embedPhotosModalCancel' => t('Cancel'),
+ '$embedPhotosModalOK' => t('OK'),
+ '$modalchooseimages' => t('Choose images to embed'),
+ '$modalchoosealbum' => t('Choose an album'),
+ '$modaldiffalbum' => t('Choose a different album'),
+ '$modalerrorlist' => t('Error getting album list'),
+ '$modalerrorlink' => t('Error getting photo link'),
+ '$modalerroralbum' => t('Error getting album'),
'$form_security_token' => get_form_security_token("cover_photo"),
/// @FIXME - yuk
- '$select' => sprintf('%s %s', t('or'), ($newuser) ? '<a href="' . z_root() . '">' . t('skip this step') . '</a>' : '<a href="'. z_root() . '/photos/' . \App::$channel['channel_address'] . '">' . t('select a photo from your photo albums') . '</a>')
+ '$select' => t('Select existing photo'),
+
));
call_hooks('cover_photo_content_end', $o);
diff --git a/Zotlabs/Module/Defperms.php b/Zotlabs/Module/Defperms.php
index 422333a50..97d9cfd1d 100644
--- a/Zotlabs/Module/Defperms.php
+++ b/Zotlabs/Module/Defperms.php
@@ -22,7 +22,7 @@ class Defperms extends \Zotlabs\Web\Controller {
$r = q("SELECT abook.*, xchan.*
FROM abook left join xchan on abook_xchan = xchan_hash
- WHERE abook_self = 1 and abook_id = %d LIMIT 1",
+ WHERE abook_self = 1 and abook_channel = %d LIMIT 1",
intval(local_channel())
);
if($r) {
diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php
index b1552a694..62a1670f9 100644
--- a/Zotlabs/Module/Directory.php
+++ b/Zotlabs/Module/Directory.php
@@ -17,7 +17,7 @@ class Directory extends \Zotlabs\Web\Controller {
intval(local_channel()),
dbesc($_GET['ignore'])
);
- goaway(z_root() . '/directory?suggest=1');
+ goaway(z_root() . '/directory?f=&suggest=1');
}
$observer = get_observer_hash();
@@ -101,6 +101,11 @@ class Directory extends \Zotlabs\Web\Controller {
if($suggest) {
$r = suggestion_query(local_channel(),get_observer_hash());
+
+ if(! $r) {
+ notice( t('No default suggestions were found.') . EOL);
+ return;
+ }
// Remember in which order the suggestions were
$addresses = array();
diff --git a/Zotlabs/Module/Dirsearch.php b/Zotlabs/Module/Dirsearch.php
index e6cf5449a..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
@@ -313,7 +316,7 @@ class Dirsearch extends \Zotlabs\Web\Controller {
$ret['results'] = $entries;
if($kw) {
- $k = dir_tagadelic($kw);
+ $k = dir_tagadelic($kw, $hub);
if($k) {
$ret['keywords'] = array();
foreach($k as $kv) {
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index 6d895feb5..8e8a1ed24 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -215,6 +215,7 @@ class Display extends \Zotlabs\Web\Controller {
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']),intval(\App::$pager['start']));
if($load || ($checkjs->disabled()) || ($module_format !== 'html')) {
+
$r = null;
require_once('include/channel.php');
@@ -235,7 +236,7 @@ class Display extends \Zotlabs\Web\Controller {
}
}
- if($r === null) {
+ if(! $r) {
// in case somebody turned off public access to sys channel content using permissions
// make that content unsearchable by ensuring the owner uid can't match
@@ -281,7 +282,7 @@ class Display extends \Zotlabs\Web\Controller {
}
}
- if($r === null) {
+ if(! $r) {
// in case somebody turned off public access to sys channel content using permissions
// make that content unsearchable by ensuring the owner_xchan can't match
if(! perm_is_allowed($sysid,$observer_hash,'view_stream'))
@@ -343,14 +344,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..c1ba9a01a
--- /dev/null
+++ b/Zotlabs/Module/Email_validation.php
@@ -0,0 +1,48 @@
+<?php
+
+namespace Zotlabs\Module;
+
+
+class Email_validation extends \Zotlabs\Web\Controller {
+
+ function post() {
+
+ $success = false;
+ if($_POST['token']) {
+ // This will redirect internally on success unless the channel is auto_created
+ if(account_approve(trim(basename($_POST['token'])))) {
+ $success = true;
+ if(get_config('system','auto_channel_create')) {
+ $next_page = get_config('system', 'workflow_channel_next', 'profiles');
+ }
+ if($next_page) {
+ goaway(z_root() . '/' . $next_page);
+ }
+ }
+ }
+ if(! $success) {
+ notice( t('Token verification failed.') . EOL);
+ }
+ }
+
+
+ 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/Embedphotos.php b/Zotlabs/Module/Embedphotos.php
index 15cc68d7f..bcbb0e116 100644
--- a/Zotlabs/Module/Embedphotos.php
+++ b/Zotlabs/Module/Embedphotos.php
@@ -53,7 +53,7 @@ class Embedphotos extends \Zotlabs\Web\Controller {
} else {
json_return_and_die(array('errormsg' => 'Error retrieving resource ' . $resource_id, 'status' => false));
}
- json_return_and_die(array('status' => true, 'photolink' => $photolink));
+ json_return_and_die(array('status' => true, 'photolink' => $photolink, 'resource_id' => $resource_id));
}
}
diff --git a/Zotlabs/Module/Go.php b/Zotlabs/Module/Go.php
new file mode 100644
index 000000000..d33136d9e
--- /dev/null
+++ b/Zotlabs/Module/Go.php
@@ -0,0 +1,67 @@
+<?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'),
+ 'cover_photo' => t('Upload a cover photo'),
+ 'profiles' => t('Edit your default profile'),
+ 'suggest' => t('View friend suggestions'),
+ 'directory' => t('View the channel directory'),
+ '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 1e46a6353..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,9 +52,9 @@ class Hq extends \Zotlabs\Web\Controller {
$item_normal_update = item_normal_update();
if(! $item_hash) {
- $r = q("SELECT mid FROM item
- WHERE uid = %d
- AND mid = parent_mid
+ $r = q("SELECT mid FROM item
+ WHERE uid = %d $item_normal
+ AND mid = parent_mid
ORDER BY created DESC LIMIT 1",
intval(local_channel())
);
@@ -135,13 +137,11 @@ class Hq extends \Zotlabs\Web\Controller {
$o = replace_macros(get_markup_template("hq.tpl"),
[
'$no_messages' => (($target_item) ? false : true),
- '$no_messages_label' => t('Welcome to hubzilla!')
+ '$no_messages_label' => [ t('Welcome to Hubzilla!'), t('You have got no unseen posts...') ],
+ '$editor' => status_editor($a,$x)
]
);
-
- $o = '<div id="jot-popup">';
- $o .= status_editor($a,$x);
- $o .= '</div>';
+
}
if(! $update && ! $load) {
@@ -266,23 +266,20 @@ class Hq extends \Zotlabs\Web\Controller {
}
if($r) {
- $parents_str = ids_to_querystr($r,'item_id');
- if($parents_str) {
- $items = q("SELECT item.*, item.id AS item_id
- FROM item
- WHERE parent IN ( %s ) $item_normal ",
- dbesc($parents_str)
- );
+ $items = q("SELECT item.*, item.id AS item_id
+ FROM item
+ WHERE parent = '%s' $item_normal ",
+ dbesc($r[0]['item_id'])
+ );
- xchan_query($items,true,(($sys_item) ? local_channel() : 0));
- $items = fetch_post_tags($items,true);
- $items = conv_sort($items,'created');
- }
+ xchan_query($items,true,(($sys_item) ? local_channel() : 0));
+ $items = fetch_post_tags($items,true);
+ $items = conv_sort($items,'created');
}
else {
$items = [];
}
-
+
$o .= conversation($items, 'hq', $update, 'client');
if($updateable) {
diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php
index 2b16ff4e1..36bd72310 100644
--- a/Zotlabs/Module/Import.php
+++ b/Zotlabs/Module/Import.php
@@ -64,7 +64,7 @@ class Import extends \Zotlabs\Web\Controller {
notice( t('Nothing to import.') . EOL);
return;
} else if(strpos($old_address, 'ï¼ ')) {
- // if you copy the identity address from your profile page, make it work for convenience
+ // if you copy the identity address from your profile page, make it work for convenience - WARNING: this is a utf-8 variant and NOT an ASCII ampersand. Please do not edit.
$old_address = str_replace('ï¼ ', '@', $old_address);
}
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index 6365230f8..3f857030b 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -39,6 +39,7 @@ class Item extends \Zotlabs\Web\Controller {
$uid = local_channel();
$channel = null;
$observer = null;
+ $datarray = [];
/**
@@ -504,7 +505,12 @@ class Item extends \Zotlabs\Web\Controller {
$body = z_input_filter($body,$mimetype,$execflag);
}
- // Verify ability to use html or php!!!
+
+ $arr = [ 'profile_uid' => $profile_uid, 'content' => $body, 'mimetype' => $mimetype ];
+ call_hooks('post_content',$arr);
+ $body = $arr['content'];
+ $mimetype = $arr['mimetype'];
+
$gacl = $acl->get();
$str_contact_allow = $gacl['allow_cid'];
@@ -516,13 +522,6 @@ class Item extends \Zotlabs\Web\Controller {
require_once('include/text.php');
- if($uid && $uid == $profile_uid && feature_enabled($uid,'markdown')) {
- require_once('include/markdown.php');
- $body = preg_replace_callback('/\[share(.*?)\]/ism','\share_shield',$body);
- $body = markdown_to_bb($body,true,['preserve_lf' => true]);
- $body = preg_replace_callback('/\[share(.*?)\]/ism','\share_unshield',$body);
-
- }
// BBCODE alert: the following functions assume bbcode input
// and will require alternatives for alternative content-types (text/html, text/markdown, text/plain, etc.)
@@ -621,6 +620,21 @@ class Item extends \Zotlabs\Web\Controller {
$i++;
}
}
+
+
+ if(preg_match_all('/(\[share=(.*?)\](.*?)\[\/share\])/',$body,$match)) {
+ // process share by id
+
+ $verb = ACTIVITY_SHARE;
+ $i = 0;
+ foreach($match[2] as $mtch) {
+ $reshare = new \Zotlabs\Lib\Share($mtch);
+ $datarray['obj'] = $reshare->obj();
+ $datarray['obj_type'] = $datarray['obj']['type'];
+ $body = str_replace($match[1][$i],$reshare->bbcode(),$body);
+ $i++;
+ }
+ }
}
@@ -722,7 +736,6 @@ class Item extends \Zotlabs\Web\Controller {
if(!$thr_parent)
$thr_parent = $mid;
- $datarray = array();
$item_thread_top = ((! $parent) ? 1 : 0);
@@ -755,6 +768,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/Magic.php b/Zotlabs/Module/Magic.php
index 9ad9c951c..15e5cedcf 100644
--- a/Zotlabs/Module/Magic.php
+++ b/Zotlabs/Module/Magic.php
@@ -166,7 +166,7 @@ class Magic extends \Zotlabs\Web\Controller {
$token = random_string();
- \Zotlabs\Zot\Verify::create('auth',$channel['channel_id'],$token,$x[0]['hubloc_url']);
+ \Zotlabs\Lib\Verify::create('auth',$channel['channel_id'],$token,$x[0]['hubloc_url']);
$target_url = $x[0]['hubloc_callback'] . '/?f=&auth=' . urlencode(channel_reddress($channel))
. '&sec=' . $token . '&dest=' . urlencode($dest) . '&version=' . ZOT_REVISION;
diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php
index a3e1eee88..6e961dc36 100644
--- a/Zotlabs/Module/Network.php
+++ b/Zotlabs/Module/Network.php
@@ -108,6 +108,9 @@ class Network extends \Zotlabs\Web\Controller {
}
+ $default_cmin = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmin',0) : 0);
+ $default_cmax = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmax',99) : 99);
+
// if no tabs are selected, defaults to comments
@@ -117,8 +120,8 @@ class Network extends \Zotlabs\Web\Controller {
$liked = ((x($_GET,'liked')) ? intval($_GET['liked']) : 0);
$conv = ((x($_GET,'conv')) ? intval($_GET['conv']) : 0);
$spam = ((x($_GET,'spam')) ? intval($_GET['spam']) : 0);
- $cmin = ((x($_GET,'cmin')) ? intval($_GET['cmin']) : 0);
- $cmax = ((x($_GET,'cmax')) ? intval($_GET['cmax']) : 99);
+ $cmin = ((array_key_exists('cmin',$_GET)) ? intval($_GET['cmin']) : $default_cmin);
+ $cmax = ((array_key_exists('cmax',$_GET)) ? intval($_GET['cmax']) : $default_cmax);
$file = ((x($_GET,'file')) ? $_GET['file'] : '');
$xchan = ((x($_GET,'xchan')) ? $_GET['xchan'] : '');
$net = ((x($_GET,'net')) ? $_GET['net'] : '');
@@ -141,7 +144,7 @@ class Network extends \Zotlabs\Web\Controller {
// NOTREACHED
}
if($_GET['pf'] === '1')
- $deftag = '@' . t('forum') . '+' . intval($cid) . '+';
+ $deftag = '!' . t('forum') . '+' . intval($cid);
else
$def_acl = [ 'allow_cid' => '<' . $r[0]['abook_xchan'] . '>', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '' ];
}
@@ -206,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 = '';
@@ -223,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);
@@ -247,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>'
@@ -261,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;
@@ -370,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']))
);
@@ -406,7 +419,6 @@ class Network extends \Zotlabs\Web\Controller {
if($cmax == 99)
$sql_nets .= " OR abook.abook_closeness IS NULL ) ";
-
}
$net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : '');
@@ -446,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
@@ -475,18 +487,16 @@ 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
ORDER BY $ordering DESC $pager_sql "
);
-
}
else {
diff --git a/Zotlabs/Module/New_channel.php b/Zotlabs/Module/New_channel.php
index 2b73fa191..548f28c4f 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);
}
@@ -144,6 +142,7 @@ class New_channel extends \Zotlabs\Web\Controller {
'$role' => $role,
'$default_role' => $default_role,
'$nickname' => $nickname,
+ '$validate' => t('Validate'),
'$submit' => t('Create'),
'$channel_usage_message' => $channel_usage_message
));
diff --git a/Zotlabs/Module/Owa.php b/Zotlabs/Module/Owa.php
index 23ee14f39..e62fc9592 100644
--- a/Zotlabs/Module/Owa.php
+++ b/Zotlabs/Module/Owa.php
@@ -42,7 +42,7 @@ class Owa extends \Zotlabs\Web\Controller {
logger('OWA success: ' . $hubloc['hubloc_addr'],LOGGER_DATA);
$ret['success'] = true;
$token = random_string(32);
- \Zotlabs\Zot\Verify::create('owt',0,$token,$hubloc['hubloc_addr']);
+ \Zotlabs\Lib\Verify::create('owt',0,$token,$hubloc['hubloc_addr']);
$result = '';
openssl_public_encrypt($token,$result,$hubloc['xchan_pubkey']);
$ret['encrypted_token'] = base64url_encode($result);
diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php
index a3f6cdfec..eab49d69e 100644
--- a/Zotlabs/Module/Ping.php
+++ b/Zotlabs/Module/Ping.php
@@ -148,14 +148,12 @@ 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 author_xchan != '%s'
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)
@@ -168,8 +166,8 @@ class Ping extends \Zotlabs\Web\Controller {
$r = q("SELECT * FROM item
WHERE uid = %d
- AND author_xchan != '%s'
AND item_unseen = 1
+ AND author_xchan != '%s'
AND created > '" . datetime_convert('UTC','UTC',$_SESSION['static_loadtime']) . "'
$item_normal
ORDER BY created DESC
@@ -210,22 +208,22 @@ class Ping extends \Zotlabs\Web\Controller {
if(x($_REQUEST, 'markRead') && local_channel()) {
switch($_REQUEST['markRead']) {
case 'network':
- $r = q("update item set item_unseen = 0 where item_unseen = 1 and uid = %d",
+ $r = q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND item_unseen = 1",
intval(local_channel())
);
break;
case 'home':
- $r = q("update item set item_unseen = 0 where item_unseen = 1 and item_wall = 1 and uid = %d",
+ $r = q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND item_unseen = 1 AND item_wall = 1",
intval(local_channel())
);
break;
case 'mail':
- $r = q("update mail set mail_seen = 1 where mail_seen = 0 and channel_id = %d ",
+ $r = q("UPDATE mail SET mail_seen = 1 WHERE channel_id = %d AND mail_seen = 0",
intval(local_channel())
);
break;
case 'all_events':
- $r = q("update event set dismissed = 1 where dismissed = 0 and uid = %d AND dtstart < '%s' AND dtstart > '%s' ",
+ $r = q("UPDATE event SET dismissed = 1 WHERE uid = %d AND dismissed = 0 AND dtstart < '%s' AND dtstart > '%s' ",
intval(local_channel()),
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')),
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days'))
@@ -245,9 +243,9 @@ class Ping extends \Zotlabs\Web\Controller {
}
if(x($_REQUEST, 'markItemRead') && local_channel()) {
- $r = q("update item set item_unseen = 0 where parent = %d and uid = %d",
- intval($_REQUEST['markItemRead']),
- intval(local_channel())
+ $r = q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND parent = %d",
+ intval(local_channel()),
+ intval($_REQUEST['markItemRead'])
);
}
@@ -256,7 +254,7 @@ class Ping extends \Zotlabs\Web\Controller {
* dropdown menu.
*/
if(argc() > 1 && argv(1) === 'notify') {
- $t = q("select * from notify where uid = %d and seen = 0 order by created desc",
+ $t = q("SELECT * FROM notify WHERE uid = %d AND seen = 0 ORDER BY CREATED DESC",
intval(local_channel())
);
@@ -270,7 +268,18 @@ class Ping extends \Zotlabs\Web\Controller {
$mid = basename($tt['link']);
- $b64mid = ((strpos($mid, 'b64.' === 0)) ? $mid : 'b64.' . base64url_encode($mid));
+ if(in_array($tt['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) {
+ // we need the thread parent
+ $r = q("select thr_parent from item where mid = '%s' and uid = %d limit 1",
+ dbesc($mid),
+ intval(local_channel())
+ );
+
+ $b64mid = ((strpos($r[0]['thr_parent'], 'b64.' === 0)) ? $r[0]['thr_parent'] : 'b64.' . base64url_encode($r[0]['thr_parent']));
+ }
+ else {
+ $b64mid = ((strpos($mid, 'b64.' === 0)) ? $mid : 'b64.' . base64url_encode($mid));
+ }
$notifs[] = array(
'notify_link' => z_root() . '/notify/view/' . $tt['id'],
@@ -320,10 +329,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 item_unseen = 1
AND author_xchan != '%s'
- ORDER BY created DESC limit 300",
+ $item_normal
+ ORDER BY created DESC
+ LIMIT 300",
intval(local_channel()),
dbesc($ob_hash)
);
@@ -492,9 +504,9 @@ class Ping extends \Zotlabs\Web\Controller {
$t3 = dba_timer();
if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) {
-
- $r = q("SELECT id, item_wall FROM item
- WHERE item_unseen = 1 and uid = %d
+
+ $r = q("SELECT id, item_wall FROM item
+ WHERE uid = %d and item_unseen = 1
$item_normal
AND author_xchan != '%s'",
intval(local_channel()),
diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php
index 45a606d5f..2ce8686b9 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),
@@ -299,7 +304,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
}
$channel = \App::get_channel();
-
+ $pf = 0;
$newuser = false;
if(argc() == 2 && argv(1) === 'new')
@@ -313,8 +318,8 @@ class Profile_photo extends \Zotlabs\Web\Controller {
$resource_id = argv(2);
- // When using an existing photo, we don't have a dialogue to offer a choice of profiles,
- // so it gets attached to the default
+
+ $pf = (($_REQUEST['pf']) ? intval($_REQUEST['pf']) : 0);
$c = q("select id, is_default from profile where uid = %d",
intval(local_channel())
@@ -326,6 +331,9 @@ class Profile_photo extends \Zotlabs\Web\Controller {
$_REQUEST['profile'] = $c[0]['id'];
$multi_profiles = false;
}
+ else {
+ $_REQUEST['profile'] = $pf;
+ }
$r = q("SELECT id, album, imgscale FROM photo WHERE uid = %d AND resource_id = '%s' ORDER BY imgscale ASC",
intval(local_channel()),
@@ -425,6 +433,16 @@ class Profile_photo extends \Zotlabs\Web\Controller {
intval(local_channel())
);
+ if($profiles) {
+ for($x = 0; $x < count($profiles); $x ++) {
+ $profiles[$x]['selected'] = false;
+ if($pf && $profiles[$x]['id'] == $pf)
+ $profiles[$x]['selected'] = true;
+ if((! $pf) && $profiles[$x]['is_default'])
+ $profiles[$x]['selected'] = true;
+ }
+ }
+
$importing = ((array_key_exists('importfile',\App::$data)) ? true : false);
if(! x(\App::$data,'imagecrop')) {
@@ -436,14 +454,23 @@ class Profile_photo extends \Zotlabs\Web\Controller {
'$importfile' => (($importing) ? \App::$data['importfile'] : ''),
'$lbl_upfile' => t('Upload File:'),
'$lbl_profiles' => t('Select a profile:'),
- '$title' => (($importing) ? t('Use Photo for Profile') : t('Upload Profile Photo')),
+ '$title' => (($importing) ? t('Use Photo for Profile') : t('Change Profile Photo')),
'$submit' => (($importing) ? t('Use') : t('Upload')),
'$profiles' => $profiles,
'$single' => ((count($profiles) == 1) ? true : false),
'$profile0' => $profiles[0],
+ '$embedPhotos' => t('Use a photo from your albums'),
+ '$embedPhotosModalTitle' => t('Use a photo from your albums'),
+ '$embedPhotosModalCancel' => t('Cancel'),
+ '$embedPhotosModalOK' => t('OK'),
+ '$modalchooseimages' => t('Choose images to embed'),
+ '$modalchoosealbum' => t('Choose an album'),
+ '$modaldiffalbum' => t('Choose a different album'),
+ '$modalerrorlist' => t('Error getting album list'),
+ '$modalerrorlink' => t('Error getting photo link'),
+ '$modalerroralbum' => t('Error getting album'),
'$form_security_token' => get_form_security_token("profile_photo"),
- // FIXME - yuk
- '$select' => sprintf('%s %s', t('or'), ($newuser) ? '<a href="' . z_root() . '">' . t('skip this step') . '</a>' : '<a href="'. z_root() . '/photos/' . \App::$channel['channel_address'] . '">' . t('select a photo from your photo albums') . '</a>')
+ '$select' => t('Select existing photo'),
));
call_hooks('profile_photo_content_end', $o);
diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php
index c469a0eca..79f205a22 100644
--- a/Zotlabs/Module/Pubstream.php
+++ b/Zotlabs/Module/Pubstream.php
@@ -12,14 +12,26 @@ class Pubstream extends \Zotlabs\Web\Controller {
if($load)
$_SESSION['loadtime'] = datetime_convert();
-
- if(observer_prohibited(true)) {
+ if((observer_prohibited(true))) {
+ return login();
+ }
+
+ if(! intval(get_config('system','open_pubstream',1))) {
+ if(! get_observer_hash()) {
return login();
+ }
+ }
+
+ $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;
}
-
- $disable_discover_tab = get_config('system','disable_discover_tab') || get_config('system','disable_discover_tab') === false;
- if($disable_discover_tab)
- return;
$mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : '');
@@ -142,7 +154,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 {
@@ -160,7 +172,8 @@ class Pubstream extends \Zotlabs\Web\Controller {
$net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : '');
$net_query2 = (($net) ? " and xchan_network = '" . protect_sprintf(dbesc($net)) . "' " : '');
-
+
+ $abook_uids = " and abook.abook_channel = " . intval(\App::$profile['profile_uid']) . " ";
$simple_update = (($_SESSION['loadtime']) ? " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' " : '');
@@ -179,7 +192,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
if($load) {
if($mid) {
$r = q("SELECT parent AS item_id FROM item
- left join abook on item.author_xchan = abook.abook_xchan
+ left join abook on item.author_xchan = abook.abook_xchan
$net_query
WHERE mid like '%s' $uids $item_normal
and (abook.abook_blocked = 0 or abook.abook_flags is null)
@@ -189,11 +202,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
- left join abook on item.author_xchan = abook.abook_xchan
+ $r = q("SELECT item.id AS item_id FROM item
+ left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids )
$net_query
- WHERE true $uids $item_normal
- AND item.parent = item.id
+ WHERE true $uids and item.item_thread_top = 1 $item_normal
and (abook.abook_blocked = 0 or abook.abook_flags is null)
$sql_extra3 $sql_extra $sql_nets $net_query2
ORDER BY $ordering DESC $pager_sql "
diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php
index deaee31bf..5356669e9 100644
--- a/Zotlabs/Module/Register.php
+++ b/Zotlabs/Module/Register.php
@@ -123,9 +123,6 @@ class Register extends \Zotlabs\Web\Controller {
if($policy == REGISTER_OPEN ) {
if($email_verify) {
$res = verify_email_address($result);
- if($res) {
- info( t('Registration successful. Please check your email for validation instructions.') . EOL ) ;
- }
}
else {
$res = send_register_success_email($result['email'],$result['password']);
@@ -133,7 +130,8 @@ class Register extends \Zotlabs\Web\Controller {
if($res) {
if($invite_code) {
info( t('Registration successful. Continue to create your first channel...') . EOL ) ;
- } else {
+ }
+ else {
info( t('Registration successful. Please check your email for validation instructions.') . EOL ) ;
}
}
@@ -150,9 +148,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 +217,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 +234,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 +260,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 +284,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..55e0e746f 100644
--- a/Zotlabs/Module/Search.php
+++ b/Zotlabs/Module/Search.php
@@ -90,7 +90,7 @@ class Search extends \Zotlabs\Web\Controller {
}
else {
$regstr = db_getfunc('REGEXP');
- $sql_extra = sprintf(" AND item.body $regstr '%s' ", dbesc(protect_sprintf(preg_quote($search))));
+ $sql_extra = sprintf(" AND (item.title $regstr '%s' OR item.body $regstr '%s') ", dbesc(protect_sprintf(preg_quote($search))), dbesc(protect_sprintf(preg_quote($search))));
}
// Here is the way permissions work in the search module...
@@ -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/Account.php b/Zotlabs/Module/Settings/Account.php
index 18890e89f..9643c5958 100644
--- a/Zotlabs/Module/Settings/Account.php
+++ b/Zotlabs/Module/Settings/Account.php
@@ -113,7 +113,7 @@ class Account {
'$origpass' => array('origpass', t('Current Password'), ' ',''),
'$password1'=> array('npassword', t('Enter New Password'), '', ''),
'$password2'=> array('confirm', t('Confirm New Password'), '', t('Leave password fields blank unless changing')),
- '$techlevel' => [ 'techlevel', t('Your technical skill level'), $def_techlevel, t('Used to provide a member experience matched to your comfort level'), $techlevels ],
+ '$techlevel' => [ 'techlevel', t('Your technical skill level'), $def_techlevel, t('Used to provide a member experience and additional features consistent with your comfort level'), $techlevels ],
'$techlock' => $techlock,
'$submit' => t('Submit'),
'$email' => array('email', t('Email Address:'), $email, ''),
diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php
index 5e9e88a6d..fb8284d2e 100644
--- a/Zotlabs/Module/Settings/Channel.php
+++ b/Zotlabs/Module/Settings/Channel.php
@@ -331,22 +331,21 @@ class Channel {
);
$limits = \Zotlabs\Access\PermissionLimits::Get(local_channel());
+ $anon_comments = get_config('system','anonymous_comments',true);
foreach($global_perms as $k => $perm) {
$options = array();
+ $can_be_public = ((strstr($k,'view') || ($k === 'post_comments' && $anon_comments)) ? true : false);
foreach($perm_opts as $opt) {
- if(((! strstr($k,'view')) && $k !== 'post_comments') && $opt[1] == PERMS_PUBLIC)
+ if($opt[1] == PERMS_PUBLIC && (! $can_be_public))
continue;
$options[$opt[1]] = $opt[0];
}
$permiss[] = array($k,$perm,$limits[$k],'',$options);
}
-
-
+
// logger('permiss: ' . print_r($permiss,true));
-
-
$username = $channel['channel_name'];
$nickname = $channel['channel_address'];
$timezone = $channel['channel_timezone'];
diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php
index e1ea0e3e5..340b3c0bb 100644
--- a/Zotlabs/Module/Settings/Display.php
+++ b/Zotlabs/Module/Settings/Display.php
@@ -21,7 +21,7 @@ class Display {
if(! $theme)
$theme = 'redbasic';
- $mobile_theme = ((x($_POST,'mobile_theme')) ? notags(trim($_POST['mobile_theme'])) : '');
+
$preload_images = ((x($_POST,'preload_images')) ? intval($_POST['preload_images']) : 0);
$channel_menu = ((x($_POST,'channel_menu')) ? intval($_POST['channel_menu']) : 0);
$user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0);
@@ -47,11 +47,6 @@ class Display {
if($itemspage > 100)
$itemspage = 100;
- if ($mobile_theme == "---")
- del_pconfig(local_channel(),'system','mobile_theme');
- else {
- set_pconfig(local_channel(),'system','mobile_theme',$mobile_theme);
- }
set_pconfig(local_channel(),'system','preload_images',$preload_images);
set_pconfig(local_channel(),'system','user_scalable',$user_scalable);
@@ -114,10 +109,6 @@ class Display {
$theme = (($existing_theme) ? $existing_theme : $default_theme);
- $default_mobile_theme = get_config('system','mobile_theme');
- if(! $mobile_default_theme)
- $mobile_default_theme = 'none';
-
$allowed_themes_str = get_config('system','allowed_themes');
$allowed_themes_raw = explode(',',$allowed_themes_str);
$allowed_themes = array();
@@ -135,26 +126,19 @@ class Display {
$info = get_theme_info($th);
$compatible = check_plugin_versions($info);
- if(!$compatible) {
- $mobile_themes[$f] = $themes[$f] = sprintf(t('%s - (Incompatible)'), $f);
+ if(! $compatible) {
+ $themes[$f] = sprintf(t('%s - (Incompatible)'), $f);
continue;
}
$is_experimental = file_exists('view/theme/' . $th . '/experimental');
$unsupported = file_exists('view/theme/' . $th . '/unsupported');
- $is_mobile = file_exists('view/theme/' . $th . '/mobile');
$is_library = file_exists('view/theme/'. $th . '/library');
- $mobile_themes['---'] = t("No special theme for mobile devices");
if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){
$theme_name = (($is_experimental) ? sprintf(t('%s - (Experimental)'), $f) : $f);
if (! $is_library) {
- if($is_mobile) {
- $mobile_themes[$f] = $themes[$f] = $theme_name . ' (' . t('mobile') . ')';
- }
- else {
- $mobile_themes[$f] = $themes[$f] = $theme_name;
- }
+ $themes[$f] = $theme_name;
}
}
}
@@ -166,7 +150,6 @@ class Display {
$theme_selected = explode(':', $theme_selected)[0];
}
- $mobile_theme_selected = (!x($_SESSION,'mobile_theme')? $default_mobile_theme : $_SESSION['mobile_theme']);
$preload_images = get_pconfig(local_channel(),'system','preload_images');
$preload_images = (($preload_images===false)? '0': $preload_images); // default if not set: 0
@@ -213,7 +196,6 @@ class Display {
'$theme' => (($themes) ? array('theme', t('Display Theme:'), $theme_selected, '', $themes, 'preview') : false),
'$schema' => array('schema', t('Select scheme'), $existing_schema, '' , $schemas),
- '$mobile_theme' => (($mobile_themes) ? array('mobile_theme', t('Mobile Theme:'), $mobile_theme_selected, '', $mobile_themes, '') : false),
'$preload_images' => array('preload_images', t("Preload images before rendering the page"), $preload_images, t("The subjective page load time will be longer but the page will be ready when displayed"), $yes_no),
'$user_scalable' => array('user_scalable', t("Enable user zoom on mobile devices"), $user_scalable, '', $yes_no),
'$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')),
diff --git a/Zotlabs/Module/Settings/Featured.php b/Zotlabs/Module/Settings/Featured.php
index 6a8d10b2d..1da139206 100644
--- a/Zotlabs/Module/Settings/Featured.php
+++ b/Zotlabs/Module/Settings/Featured.php
@@ -17,12 +17,8 @@ class Featured {
$cmin = intval($_POST['affinity_cmin']);
if($cmin < 0 || $cmin > 99)
$cmin = 0;
- if($cmin !== 0 || $cmax !== 99) {
- set_pconfig(local_channel(),'system','network_page_default','cmin=' . $cmin . '&cmax=' . $cmax);
- }
- else {
- set_pconfig(local_channel(),'system','network_page_default','');
- }
+ set_pconfig(local_channel(),'affinity','cmin',$cmin);
+ set_pconfig(local_channel(),'affinity','cmax',$cmax);
info( t('Affinity Slider settings updated.') . EOL);
@@ -46,12 +42,12 @@ class Featured {
$cmax = intval(get_pconfig(local_channel(),'affinity','cmax'));
$cmax = (($cmax) ? $cmax : 99);
$setting_fields .= replace_macros(get_markup_template('field_input.tpl'), array(
- '$field' => array('affinity_cmax', t('Default maximum affinity level'), $cmax, '')
+ '$field' => array('affinity_cmax', t('Default maximum affinity level'), $cmax, t('0-99 default 99'))
));
$cmin = intval(get_pconfig(local_channel(),'affinity','cmin'));
$cmin = (($cmin) ? $cmin : 0);
$setting_fields .= replace_macros(get_markup_template('field_input.tpl'), array(
- '$field' => array('affinity_cmin', t('Default minimum affinity level'), $cmin, '')
+ '$field' => array('affinity_cmin', t('Default minimum affinity level'), $cmin, t('0-99 - default 0'))
));
$settings_addons .= replace_macros(get_markup_template('generic_addon_settings.tpl'), array(
@@ -65,7 +61,8 @@ class Featured {
$tpl = get_markup_template("settings_addons.tpl");
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_featured"),
- '$title' => t('Feature/Addon Settings'),
+ '$title' => t('Addon Settings'),
+ '$descrip' => t('Please save/submit changes to any panel before opening another.'),
'$settings_addons' => $settings_addons
));
return $o;
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/Share.php b/Zotlabs/Module/Share.php
index 5c4811c59..7f4d8b1eb 100644
--- a/Zotlabs/Module/Share.php
+++ b/Zotlabs/Module/Share.php
@@ -14,6 +14,10 @@ class Share extends \Zotlabs\Web\Controller {
if(! $post_id)
killme();
+
+ echo '[share=' . $post_id . '][/share]';
+ killme();
+
if(! (local_channel() || remote_channel()))
killme();
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/Module/Sitelist.php b/Zotlabs/Module/Sitelist.php
index e7d4187b7..2ac5ed1b8 100644
--- a/Zotlabs/Module/Sitelist.php
+++ b/Zotlabs/Module/Sitelist.php
@@ -32,7 +32,7 @@ class Sitelist extends \Zotlabs\Web\Controller {
$result = array('success' => false);
- $r = q("select count(site_url) as total from site where site_type = %d $sql_extra ",
+ $r = q("select count(site_url) as total from site where site_type = %d and site_dead = 0 $sql_extra ",
intval(SITE_TYPE_ZOT)
);
@@ -42,7 +42,7 @@ class Sitelist extends \Zotlabs\Web\Controller {
$result['start'] = $start;
$result['limit'] = $limit;
- $r = q("select * from site where site_type = %d $sql_extra $sql_order $sql_limit",
+ $r = q("select * from site where site_type = %d and site_dead = 0 $sql_extra $sql_order $sql_limit",
intval(SITE_TYPE_ZOT)
);
diff --git a/Zotlabs/Module/Thing.php b/Zotlabs/Module/Thing.php
index f816632ab..c3d8ff802 100644
--- a/Zotlabs/Module/Thing.php
+++ b/Zotlabs/Module/Thing.php
@@ -20,6 +20,11 @@ class Thing extends \Zotlabs\Web\Controller {
$channel = \App::get_channel();
+ if($_SERVER['REQUEST_METHOD'] === 'GET' && argc() < 2) {
+ profile_load($channel['channel_address']);
+ }
+
+
$term_hash = (($_REQUEST['term_hash']) ? $_REQUEST['term_hash'] : '');
$name = escape_tags($_REQUEST['term']);
diff --git a/Zotlabs/Module/Token.php b/Zotlabs/Module/Token.php
index e0d9d74d7..f7c074233 100644
--- a/Zotlabs/Module/Token.php
+++ b/Zotlabs/Module/Token.php
@@ -2,39 +2,36 @@
namespace Zotlabs\Module;
-
-class Token extends \Zotlabs\Web\Controller {
+use Zotlabs\Identity\OAuth2Storage;
- function get() {
+class Token extends \Zotlabs\Web\Controller {
+ function init() {
- // workaround for HTTP-auth in CGI mode
- if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
- $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ;
- if(strlen($userpass)) {
- list($name, $password) = explode(':', $userpass);
- $_SERVER['PHP_AUTH_USER'] = $name;
- $_SERVER['PHP_AUTH_PW'] = $password;
- }
+ // workaround for HTTP-auth in CGI mode
+ if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
+ $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ;
+ if(strlen($userpass)) {
+ list($name, $password) = explode(':', $userpass);
+ $_SERVER['PHP_AUTH_USER'] = $name;
+ $_SERVER['PHP_AUTH_PW'] = $password;
}
-
- if (x($_SERVER, 'HTTP_AUTHORIZATION')) {
- $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)) ;
- if(strlen($userpass)) {
- list($name, $password) = explode(':', $userpass);
- $_SERVER['PHP_AUTH_USER'] = $name;
- $_SERVER['PHP_AUTH_PW'] = $password;
- }
+ }
+
+ if (x($_SERVER, 'HTTP_AUTHORIZATION')) {
+ $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)) ;
+ if(strlen($userpass)) {
+ list($name, $password) = explode(':', $userpass);
+ $_SERVER['PHP_AUTH_USER'] = $name;
+ $_SERVER['PHP_AUTH_PW'] = $password;
}
+ }
+ $s = new \Zotlabs\Identity\OAuth2Server(new OAuth2Storage(\DBA::$dba->db));
+ $s->handleTokenRequest(\OAuth2\Request::createFromGlobals())->send();
-
-
- require_once('include/oauth2.php');
- $oauth2_server->handleTokenRequest(\OAuth2\Request::createFromGlobals())->send();
-
- killme();
+ killme();
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Module/Viewconnections.php b/Zotlabs/Module/Viewconnections.php
index 1f9c03751..8366e1325 100644
--- a/Zotlabs/Module/Viewconnections.php
+++ b/Zotlabs/Module/Viewconnections.php
@@ -44,7 +44,7 @@ class Viewconnections extends \Zotlabs\Web\Controller {
$sql_extra = '';
if(! $is_owner) {
- $abook_flags = " and abook_hidden = 0 ";
+ $abook_flags .= " and abook_hidden = 0 ";
$sql_extra = " and xchan_hidden = 0 ";
}
@@ -69,8 +69,13 @@ class Viewconnections extends \Zotlabs\Web\Controller {
$contacts = array();
foreach($r as $rr) {
+
+ $oneway = false;
+ if(! intval(get_abconfig(\App::$profile['uid'],$rr['xchan_hash'],'their_perms','post_comments'))) {
+ $oneway = true;
+ }
- $url = chanlink_hash($rr['xchan_hash']);
+ $url = chanlink_hash($rr['xchan_hash']);
if($url) {
$contacts[] = array(
'id' => $rr['abook_id'],
@@ -83,6 +88,7 @@ class Viewconnections extends \Zotlabs\Web\Controller {
'sparkle' => '',
'itemurl' => $rr['url'],
'network' => '',
+ 'oneway' => $oneway
);
}
}
diff --git a/Zotlabs/Module/Wfinger.php b/Zotlabs/Module/Wfinger.php
index 753721d27..81d4beaed 100644
--- a/Zotlabs/Module/Wfinger.php
+++ b/Zotlabs/Module/Wfinger.php
@@ -123,7 +123,8 @@ class Wfinger extends \Zotlabs\Web\Controller {
$result['properties'] = [
'http://webfinger.net/ns/name' => $r[0]['channel_name'],
'http://xmlns.com/foaf/0.1/name' => $r[0]['channel_name'],
- 'https://w3id.org/security/v1#publicKeyPem' => $r[0]['xchan_pubkey']
+ 'https://w3id.org/security/v1#publicKeyPem' => $r[0]['xchan_pubkey'],
+ 'http://purl.org/zot/federation' => 'zot'
];
foreach($aliases as $alias)