Merge pull request #1 from redmatrix/dev

Dev
This commit is contained in:
mrjive 2018-03-29 17:47:50 +02:00 committed by GitHub
commit 20ac91703d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 57 additions and 28 deletions

View File

@ -102,7 +102,7 @@ class Display extends \Zotlabs\Web\Controller {
if($decoded)
$item_hash = $decoded;
$r = q("select id, uid, mid, parent_mid, thr_parent, verb, item_type, item_deleted, item_blocked from item where mid like '%s' limit 1",
$r = q("select id, uid, mid, parent_mid, thr_parent, verb, item_type, item_deleted, author_xchan, item_blocked from item where mid like '%s' limit 1",
dbesc($item_hash . '%')
);
@ -110,6 +110,13 @@ class Display extends \Zotlabs\Web\Controller {
$target_item = $r[0];
}
$x = q("select * from xchan where xchan_hash = '%s' limit 1",
dbesc($target_item['author_xchan'])
);
if($x) {
\App::$poi = $x[0];
}
//if the item is to be moderated redirect to /moderate
if($target_item['item_blocked'] == ITEM_MODERATED) {
goaway(z_root() . '/moderate/' . $target_item['id']);
@ -169,6 +176,7 @@ class Display extends \Zotlabs\Web\Controller {
}
}
$static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0);

View File

@ -45,7 +45,9 @@ class Rpost extends \Zotlabs\Web\Controller {
$url = get_rpost_path(\App::get_observer());
// make sure we're not looping to our own hub
if(($url) && (! stristr($url, \App::get_hostname()))) {
foreach($_REQUEST as $key => $arg) {
foreach($_GET as $key => $arg) {
if($key === 'q')
continue;
$url .= '&' . $key . '=' . $arg;
}
goaway($url);

View File

@ -22,8 +22,8 @@ class Uexport extends \Zotlabs\Web\Controller {
$month = intval(argv(2));
}
header('content-type: application/octet_stream');
header('content-disposition: attachment; filename="' . $channel['channel_address'] . (($year) ? '-' . $year : '') . (($month) ? '-' . $month : '') . '.json"' );
header('content-type: application/json');
header('content-disposition: attachment; filename="' . $channel['channel_address'] . (($year) ? '-' . $year : '') . (($month) ? '-' . $month : '') . (($_REQUEST['sections']) ? '-' . $_REQUEST['sections'] : '') . '.json"' );
if($year) {
echo json_encode(identity_export_year(local_channel(),$year,$month));

View File

@ -9,9 +9,6 @@ class Newmember {
if(! local_channel())
return EMPTY_STR;
if(get_pconfig(local_channel(), 'system', 'disable_newmemberwidget'))
return EMPTY_STR;
$c = \App::get_channel();
if(! $c)
return EMPTY_STR;
@ -20,16 +17,9 @@ class Newmember {
if(! $a)
return EMPTY_STR;
if(datetime_convert('UTC','UTC',$a['account_created']) < datetime_convert('UTC','UTC', 'now - 60 days'))
if(! feature_enabled(local_channel(),'start_menu'))
return EMPTY_STR;
// This could be a new account that was used to clone a very old channel
$ob = \App::get_observer();
if($ob && array_key_exists('xchan_name_date',$ob) && $ob['xchan_name_date'] < datetime_convert('UTC','UTC','now - 60 days'))
return EMPTY_STR;
$options = [
t('Profile Creation'),
[

View File

@ -50,7 +50,7 @@ require_once('include/attach.php');
require_once('include/bbcode.php');
define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '3.3.2' );
define ( 'STD_VERSION', '3.3.3' );
define ( 'ZOT_REVISION', '6.0a' );
@ -857,7 +857,7 @@ class App {
self::$scheme = 'https';
if(x($_SERVER,'SERVER_NAME')) {
self::$hostname = $_SERVER['SERVER_NAME'];
self::$hostname = punify($_SERVER['SERVER_NAME']);
if(x($_SERVER,'SERVER_PORT') && $_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443)
self::$hostname .= ':' . $_SERVER['SERVER_PORT'];
@ -954,14 +954,14 @@ class App {
&& is_array(self::$config['system'])
&& array_key_exists('baseurl',self::$config['system'])
&& strlen(self::$config['system']['baseurl'])) {
$url = self::$config['system']['baseurl'];
$url = punify(self::$config['system']['baseurl']);
$url = trim($url,'\\/');
return $url;
}
$scheme = self::$scheme;
self::$baseurl = $scheme . "://" . self::$hostname . ((isset(self::$path) && strlen(self::$path)) ? '/' . self::$path : '' );
self::$baseurl = $scheme . "://" . punify(self::$hostname) . ((isset(self::$path) && strlen(self::$path)) ? '/' . self::$path : '' );
return self::$baseurl;
}
@ -972,7 +972,7 @@ class App {
&& is_array(self::$config['system'])
&& array_key_exists('baseurl',self::$config['system'])
&& strlen(self::$config['system']['baseurl'])) {
$url = self::$config['system']['baseurl'];
$url = punify(self::$config['system']['baseurl']);
$url = trim($url,'\\/');
}
@ -983,7 +983,7 @@ class App {
if($parsed !== false) {
self::$scheme = $parsed['scheme'];
self::$hostname = $parsed['host'];
self::$hostname = punify($parsed['host']);
if(x($parsed,'port'))
self::$hostname .= ':' . $parsed['port'];
if(x($parsed,'path'))

View File

@ -23,6 +23,7 @@ function get_account_by_id($account_id) {
function check_account_email($email) {
$email = punify($email);
$result = array('error' => false, 'message' => '');
// Caution: empty email isn't counted as an error in this function.
@ -139,7 +140,7 @@ function create_account($arr) {
$result = array('success' => false, 'email' => '', 'password' => '', 'message' => '');
$invite_code = ((x($arr,'invite_code')) ? notags(trim($arr['invite_code'])) : '');
$email = ((x($arr,'email')) ? notags(trim($arr['email'])) : '');
$email = ((x($arr,'email')) ? notags(punify(trim($arr['email']))) : '');
$password = ((x($arr,'password')) ? trim($arr['password']) : '');
$password2 = ((x($arr,'password2')) ? trim($arr['password2']) : '');
$parent = ((x($arr,'parent')) ? intval($arr['parent']) : 0 );

View File

@ -948,6 +948,16 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
return $ret;
}
// Update the folder timestamp @todo recurse to the storage root folder
if($folder_hash) {
q("UPDATE attach set edited = '%s' where hash = '%s' and uid = %d and is_dir = 1",
dbesc($edited),
dbesc($folder_hash),
intval($channel_id)
);
}
// Caution: This re-uses $sql_options set further above
$r = q("select * from attach where uid = %d and hash = '%s' $sql_options limit 1",

View File

@ -37,6 +37,7 @@ require_once('include/security.php');
function account_verify_password($login, $pass) {
$ret = [ 'account' => null, 'channel' => null, 'xchan' => null ];
$login = punify($login);
$email_verify = get_config('system', 'verify_email');
$register_policy = get_config('system', 'register_policy');
@ -235,7 +236,7 @@ else {
$record = null;
$addon_auth = array(
'username' => trim($_POST['username']),
'username' => punify(trim($_POST['username'])),
'password' => trim($_POST['password']),
'authenticated' => 0,
'user_record' => null
@ -261,7 +262,7 @@ else {
$verify = account_verify_password($_POST['username'], $_POST['password']);
if($verify && array_key_exists('reason',$verify) && $verify['reason'] === 'unvalidated') {
notice( t('Email validation is incomplete. Please check your email.'));
goaway(z_root() . '/email_validation/' . bin2hex(trim(escape_tags($_POST['username']))));
goaway(z_root() . '/email_validation/' . bin2hex(punify(trim(escape_tags($_POST['username'])))));
}
elseif($verify) {
$atoken = $verify['xchan'];

View File

@ -100,7 +100,6 @@ function vcard_from_xchan($xchan, $observer = null, $mode = '') {
if(! $xchan)
return;
// FIXME - show connect button to observer if appropriate
$connect = false;
if(local_channel()) {
$r = q("select * from abook where abook_xchan = '%s' and abook_channel = %d limit 1",

View File

@ -28,8 +28,9 @@ function get_feature_default($feature) {
$f = get_features(false);
foreach($f as $cat) {
foreach($cat as $feat) {
if(is_array($feat) && $feat[0] === $feature)
if(is_array($feat) && $feat[0] === $feature) {
return $feat[3];
}
}
}
return false;
@ -45,6 +46,7 @@ function feature_level($feature,$def) {
function get_features($filtered = true) {
$account = \App::get_account();
$arr = [
@ -53,7 +55,14 @@ function get_features($filtered = true) {
t('General Features'),
[
'start_menu',
t('New Member Links'),
t('Display new member quick links menu'),
(($account['account_created'] > datetime_convert('','','now - 60 days')) ? true : false),
get_config('feature_lock','start_menu'),
feature_level('start_menu',1),
],
[
'advanced_profiles',

View File

@ -21,6 +21,11 @@ function import_channel($channel, $account_id, $seize) {
$channel['channel_removed'] = (($channel['channel_pageflags'] & 0x8000) ? 1 : 0);
}
if(intval($channel['channel_removed'])) {
notice( t('Unable to import a removed channel.') . EOL);
return false;
}
// Ignore the hash provided and re-calculate
$channel['channel_hash'] = make_xchan_hash($channel['channel_guid'],$channel['channel_guid_sig']);

View File

@ -1491,7 +1491,7 @@ function format_hashtags(&$item) {
$term = htmlspecialchars($t['term'], ENT_COMPAT, 'UTF-8', false) ;
if(! trim($term))
continue;
if(strpos($item['body'], $t['url']))
if($t['url'] && strpos($item['body'], $t['url']))
continue;
if($s)
$s .= ' ';

View File

@ -212,6 +212,7 @@ function string2bb(element) {
index: 3,
search: function(term, callback) { $.getJSON('/hashtags/' + '$f=&t=' + term).done(function(data) { callback($.map(data, function(entry) { return entry.text.indexOf(term) === 0 ? entry : null; })); }); },
replace: function(item) { return "$1$2" + item.text + ' '; },
context: function(text) { return text.toLowerCase(); },
template: tag_format
};

View File

@ -1,3 +1,6 @@
[region=aside]
[widget=vcard][/widget]
[/region]
[region=right_aside]
[widget=notifications][/widget]
[widget=newmember][/widget]