Merge branch 'dev' into oauth2
This commit is contained in:
@@ -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 );
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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'];
|
||||
|
||||
@@ -1573,14 +1573,25 @@ function advanced_profile() {
|
||||
$profile['howlong'] = relative_date(App::$profile['howlong'], t('for %1$d %2$s'));
|
||||
}
|
||||
|
||||
if(App::$profile['keywords']) {
|
||||
$keywords = str_replace(',',' ', App::$profile['keywords']);
|
||||
$keywords = str_replace(' ',' ', $keywords);
|
||||
$karr = explode(' ', $keywords);
|
||||
if($karr) {
|
||||
for($cnt = 0; $cnt < count($karr); $cnt ++) {
|
||||
$karr[$cnt] = '<a href="' . z_root() . '/directory/f=&keywords=' . trim($karr[$cnt]) . '">' . $karr[$cnt] . '</a>';
|
||||
}
|
||||
}
|
||||
$profile['keywords'] = array( t('Tags:'), implode(' ', $karr));
|
||||
}
|
||||
|
||||
|
||||
if(App::$profile['sexual']) $profile['sexual'] = array( t('Sexual Preference:'), App::$profile['sexual'] );
|
||||
|
||||
if(App::$profile['homepage']) $profile['homepage'] = array( t('Homepage:'), linkify(App::$profile['homepage']) );
|
||||
|
||||
if(App::$profile['hometown']) $profile['hometown'] = array( t('Hometown:'), linkify(App::$profile['hometown']) );
|
||||
|
||||
if(App::$profile['keywords']) $profile['keywords'] = array( t('Tags:'), App::$profile['keywords']);
|
||||
|
||||
if(App::$profile['politic']) $profile['politic'] = array( t('Political Views:'), App::$profile['politic']);
|
||||
|
||||
if(App::$profile['religion']) $profile['religion'] = array( t('Religion:'), App::$profile['religion']);
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -270,7 +270,8 @@ function locations_by_netid($netid) {
|
||||
dbesc($netid)
|
||||
);
|
||||
|
||||
return array_elm_to_str($locs,'location',', ');
|
||||
|
||||
return array_elm_to_str($locs,'location',', ','trim_and_unpunify');
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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']);
|
||||
|
||||
@@ -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 .= ' ';
|
||||
@@ -2189,13 +2189,13 @@ function ids_to_querystr($arr,$idx = 'id',$quote = false) {
|
||||
* @returns string
|
||||
*/
|
||||
|
||||
function array_elm_to_str($arr,$elm,$delim = ',') {
|
||||
function array_elm_to_str($arr,$elm,$delim = ',',$each = 'trim') {
|
||||
|
||||
$tmp = [];
|
||||
if($arr && is_array($arr)) {
|
||||
foreach($arr as $x) {
|
||||
if(is_array($x) && array_key_exists($elm,$x)) {
|
||||
$z = trim($x[$elm]);
|
||||
$z = $each($x[$elm]);
|
||||
if(($z) && (! in_array($z,$tmp))) {
|
||||
$tmp[] = $z;
|
||||
}
|
||||
@@ -2205,7 +2205,9 @@ function array_elm_to_str($arr,$elm,$delim = ',') {
|
||||
return implode($delim,$tmp);
|
||||
}
|
||||
|
||||
|
||||
function trim_and_unpunify($s) {
|
||||
return unpunify(trim($s));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user