diff options
author | mrjive <mrjive@mrjive.it> | 2018-01-30 16:13:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-30 16:13:30 +0100 |
commit | 7ac4b477020689572a50dbc777c968263e86f6c4 (patch) | |
tree | 470336bcbdf0f989d48fb2c3349bd0ac0513da42 | |
parent | c2abbe2c238fa4d66e8a088c7d271acaa7e20876 (diff) | |
parent | d24cf0b85b24cb8d6d10e9fe66fed568f9fb08b2 (diff) | |
download | volse-hubzilla-7ac4b477020689572a50dbc777c968263e86f6c4.tar.gz volse-hubzilla-7ac4b477020689572a50dbc777c968263e86f6c4.tar.bz2 volse-hubzilla-7ac4b477020689572a50dbc777c968263e86f6c4.zip |
Merge pull request #13 from redmatrix/dev
Dev
34 files changed, 450 insertions, 132 deletions
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/Site.php b/Zotlabs/Module/Admin/Site.php index 037f49277..52b36e03e 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -38,6 +38,7 @@ class Site { $site_sellpage = ((x($_POST,'site_sellpage')) ? notags(trim($_POST['site_sellpage'])) : ''); $site_location = ((x($_POST,'site_location')) ? notags(trim($_POST['site_location'])) : ''); $frontpage = ((x($_POST,'frontpage')) ? notags(trim($_POST['frontpage'])) : ''); + $firstpage = ((x(trim($_POST,'firstpage'))) ? notags(trim($_POST['firstpage'])) : 'profiles'); $mirror_frontpage = ((x($_POST,'mirror_frontpage')) ? intval(trim($_POST['mirror_frontpage'])) : 0); $directory_server = ((x($_POST,'directory_server')) ? trim($_POST['directory_server']) : ''); $allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : ''); @@ -80,6 +81,7 @@ class Site { set_config('system', 'maxloadavg', $maxloadavg); set_config('system', 'frontpage', $frontpage); set_config('system', 'sellpage', $site_sellpage); + set_config('system', 'workflow_channel_next', $firstpage); set_config('system', 'site_location', $site_location); set_config('system', 'mirror_frontpage', $mirror_frontpage); set_config('system', 'sitename', $sitename); @@ -340,6 +342,7 @@ class Site { '$default_expire_days' => array('default_expire_days', t('Expiration period in days for imported (grid/network) content'), intval(get_config('system','default_expire_days')), t('0 for no expiration of imported content')), '$sellpage' => array('site_sellpage', t('Public servers: Optional landing (marketing) webpage for new registrants'), get_config('system','sellpage',''), sprintf( t('Create this page first. Default is %s/register'),z_root())), + '$firstpage' => array('firstpage', t('Page to display after creating a new channel'), get_config('system','workflow_channel_next','profiles'), t('Recommend: profiles, go, or settings')), '$location' => array('site_location', t('Optional: site location'), get_config('system','site_location',''), t('Region or country')), diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php index 22c5d673c..8eff6c80d 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 item.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/Email_resend.php b/Zotlabs/Module/Email_resend.php new file mode 100644 index 000000000..f8a336be0 --- /dev/null +++ b/Zotlabs/Module/Email_resend.php @@ -0,0 +1,46 @@ +<?php + +namespace Zotlabs\Module; + + +class Email_resend extends \Zotlabs\Web\Controller { + + function post() { + + if($_POST['token']) { + if(! account_approve(trim($_POST['token']))) { + notice(t('Token verification failed.')); + } + } + + } + + + function get() { + + if(argc() > 1) { + $result = false; + $email = hex2bin(argv(1)); + + if($email) { + $result = verify_email_address( [ 'resend' => true, 'email' => $email ] ); + } + + if($result) { + notice(t('Email verification resent')); + } + else { + notice(t('Unable to resend email verification message.')); + } + + goaway(z_root() . '/email_validation/' . bin2hex($email)); + + } + + // @todo - one can provide a form here to resend the mail + // after directing to here if a succesful login was attempted from an unverified address. + + + } + +} diff --git a/Zotlabs/Module/Email_validation.php b/Zotlabs/Module/Email_validation.php new file mode 100644 index 000000000..b8bb720cd --- /dev/null +++ b/Zotlabs/Module/Email_validation.php @@ -0,0 +1,47 @@ +<?php + +namespace Zotlabs\Module; + + +class Email_validation extends \Zotlabs\Web\Controller { + + function post() { + + if($_POST['token']) { + // This will redirect internally on success unless the channel is auto_created + if(! account_approve(trim(basename($_POST['token'])))) { + notice('Token verification failed.'); + } + else { + if(get_config('system','auto_channel_create')) { + $next_page = get_config('system', 'workflow_channel_next', 'profiles'); + } + if($next_page) { + goaway(z_root() . '/' . $next_page); + } + } + } + + } + + + function get() { + + if(argc() > 1) { + $email = hex2bin(argv(1)); + } + + $o = replace_macros(get_markup_template('email_validation.tpl'), [ + '$title' => t('Email Verification Required'), + '$desc' => sprintf( t('A verification token was sent to your email address [%s]. Enter that token here to complete the account verification step. Please allow a few minutes for delivery, and check your spam folder if you do not see the message.'),$email), + '$resend' => t('Resend Email'), + '$email' => bin2hex($email), + '$submit' => t('Submit'), + '$token' => [ 'token', t('Validation token'),'','' ], + ]); + + return $o; + + } + +}
\ No newline at end of file diff --git a/Zotlabs/Module/Go.php b/Zotlabs/Module/Go.php new file mode 100644 index 000000000..2c2dcf460 --- /dev/null +++ b/Zotlabs/Module/Go.php @@ -0,0 +1,66 @@ +<?php + +namespace Zotlabs\Module; + + +class Go extends \Zotlabs\Web\Controller { + + function init() { + if(local_channel()) { + $channel = \App::get_channel(); + if($channel) { + profile_load($channel['channel_address'],0); + } + } + } + + + + function get() { + if(! local_channel()) { + notify( t('This page is available only to site members') . EOL); + } + + $channel = \App::get_channel(); + + + $title = t('Welcome'); + + $m = t('What would you like to do?'); + + $m1 = t('Please bookmark this page if you would like to return to it in the future'); + + + $options = [ + 'profile_photo' => t('Upload a profile photo'), + 'profiles' => t('Edit your default profile'), + 'suggest' => t('View friend suggestions'), + 'directory' => t('View the directory to find other interesting channels'), + 'settings' => t('View/edit your channel settings'), + 'help' => t('View the site or project documentation'), + 'channel/' . $channel['channel_address'] => t('Visit your channel homepage'), + 'connections' => t('View your connections and/or add somebody whose address you already know'), + 'network' => t('View your personal stream (this may be empty until you add some connections)'), + + ]; + + $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false); + $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true); + + if($site_firehose || $net_firehose) { + $options['pubstream'] = t('View the public stream. Warning: this content is not moderated'); + } + + $o = replace_macros(get_markup_template('go.tpl'), [ + '$title' => $title, + '$m' => $m, + '$m1' => $m1, + '$options' => $options + + ]); + + return $o; + + } + +}
\ No newline at end of file diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index a9c3bb8e2..c46695b65 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) { @@ -49,9 +51,11 @@ class Hq extends \Zotlabs\Web\Controller { $item_normal = item_normal(); $item_normal_update = item_normal_update(); + $use_index = db_use_index('created'); + if(! $item_hash) { - $r = q("SELECT mid FROM item - WHERE uid = %d + $r = q("SELECT mid FROM item $use_index + WHERE uid = %d $item_normal AND mid = parent_mid ORDER BY created DESC LIMIT 1", intval(local_channel()) diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index ad829137a..db2d64d70 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -753,6 +753,7 @@ class Item extends \Zotlabs\Web\Controller { if ((! $plink) && ($item_thread_top)) { $plink = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $mid; + $plink = substr($plink,0,190); } $datarray['aid'] = $channel['channel_account_id']; diff --git a/Zotlabs/Module/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/New_channel.php b/Zotlabs/Module/New_channel.php index 2b73fa191..9f2fea802 100644 --- a/Zotlabs/Module/New_channel.php +++ b/Zotlabs/Module/New_channel.php @@ -89,9 +89,7 @@ class New_channel extends \Zotlabs\Web\Controller { change_channel($result['channel']['channel_id']); - if(! strlen($next_page = get_config('system','workflow_channel_next'))) - $next_page = 'settings'; - + $next_page = get_config('system', 'workflow_channel_next', 'profiles'); goaway(z_root() . '/' . $next_page); } diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index a3f6cdfec..f8399d871 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -320,7 +320,9 @@ class Ping extends \Zotlabs\Web\Controller { if(argc() > 1 && (argv(1) === 'network' || argv(1) === 'home')) { $result = array(); - $r = q("SELECT * FROM item + $use_index = db_use_index('uid_item_unseen'); + + $r = q("SELECT * FROM item $use_index WHERE item_unseen = 1 and uid = %d $item_normal AND author_xchan != '%s' ORDER BY created DESC limit 300", @@ -492,8 +494,10 @@ class Ping extends \Zotlabs\Web\Controller { $t3 = dba_timer(); if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) { + + $use_index = db_use_index('uid_item_unseen'); - $r = q("SELECT id, item_wall FROM item + $r = q("SELECT id, item_wall FROM item $use_index WHERE item_unseen = 1 and uid = %d $item_normal AND author_xchan != '%s'", diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php index deaee31bf..c7fa1cee8 100644 --- a/Zotlabs/Module/Register.php +++ b/Zotlabs/Module/Register.php @@ -150,9 +150,11 @@ class Register extends \Zotlabs\Web\Controller { } if($email_verify) { - goaway(z_root()); + goaway(z_root() . '/email_validation/' . bin2hex($result['email'])); } - + + // fall through and authenticate if no approvals or verifications were required. + authenticate_success($result['account'],null,true,false,true); $new_channel = false; @@ -217,6 +219,9 @@ class Register extends \Zotlabs\Web\Controller { $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : ""); $perm_roles = \Zotlabs\Access\PermissionRoles::roles(); + + // A new account will not have a techlevel, but accounts can also be created by the administrator. + if((get_account_techlevel() < 4) && $privacy_role !== 'custom') unset($perm_roles[t('Other')]); @@ -231,15 +236,17 @@ class Register extends \Zotlabs\Web\Controller { // Configurable whether to restrict age or not - default is based on international legal requirements // This can be relaxed if you are on a restricted server that does not share with public servers - if(get_config('system','no_age_restriction')) + if(get_config('system','no_age_restriction')) { $label_tos = sprintf( t('I accept the %s for this website'), $toslink); - else + } + else { $age = get_config('system','minimum_age'); if(!$age) { $age = 13; } $label_tos = sprintf( t('I am over %s years of age and accept the %s for this website'), $age, $toslink); - + } + $enable_tos = 1 - intval(get_config('system','no_termsofservice')); $email = array('email', t('Your email address'), ((x($_REQUEST,'email')) ? strip_tags(trim($_REQUEST['email'])) : "")); @@ -255,6 +262,7 @@ class Register extends \Zotlabs\Web\Controller { $auto_create = (get_config('system','auto_channel_create') ? true : false); $default_role = get_config('system','default_permissions_role'); + $email_verify = get_config('system','verify_email'); require_once('include/bbcode.php'); @@ -278,7 +286,7 @@ class Register extends \Zotlabs\Web\Controller { '$pass1' => $password, '$pass2' => $password2, '$submit' => t('Register'), - '$verify_note' => t('This site may require email verification after submitting this form. If you are returned to a login page, please check your email for instructions.') + '$verify_note' => (($email_verify) ? t('This site requires email verification. After completing this form, please check your email for further instructions.') : ''), )); return $o; diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php index 5a0c1f3d5..322a7b60a 100644 --- a/Zotlabs/Widget/Notifications.php +++ b/Zotlabs/Widget/Notifications.php @@ -145,7 +145,8 @@ class Notifications { '$module' => \App::$module, '$notifications' => $notifications, '$no_notifications' => t('Sorry, you have got no notifications at the moment'), - '$loading' => t('Loading') + '$loading' => t('Loading'), + '$startpage' => get_pconfig(local_channel(), 'system', 'startpage') )); return $o; @@ -51,7 +51,7 @@ require_once('include/attach.php'); require_once('include/bbcode.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); -define ( 'STD_VERSION', '3.1.4' ); +define ( 'STD_VERSION', '3.1.5' ); define ( 'ZOT_REVISION', '1.3' ); define ( 'DB_UPDATE_VERSION', 1198 ); diff --git a/images/video_poster.jpg b/images/video_poster.jpg Binary files differnew file mode 100644 index 000000000..e4fc3b2da --- /dev/null +++ b/images/video_poster.jpg diff --git a/include/account.php b/include/account.php index 6c6fdece4..3ac485974 100644 --- a/include/account.php +++ b/include/account.php @@ -262,24 +262,46 @@ function create_account($arr) { function verify_email_address($arr) { - $hash = random_string(); - - $r = q("INSERT INTO register ( hash, created, uid, password, lang ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ", - dbesc($hash), - dbesc(datetime_convert()), - intval($arr['account']['account_id']), - dbesc('verify'), - dbesc($arr['account']['account_language']) - ); + if(array_key_exists('resend',$arr)) { + $email = $arr['email']; + $a = q("select * from account where account_email = '%s' limit 1", + dbesc($arr['email']) + ); + if(! ($a && ($a[0]['account_flags'] & ACCOUNT_UNVERIFIED))) { + return false; + } + $account = $a[0]; + $v = q("select * from register where uid = %d and password = 'verify' limit 1", + intval($account['account_id']) + ); + if($v) { + $hash = $v[0]['hash']; + } + else { + return false; + } + } + else { + $hash = random_string(24); + + $r = q("INSERT INTO register ( hash, created, uid, password, lang ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ", + dbesc($hash), + dbesc(datetime_convert()), + intval($arr['account']['account_id']), + dbesc('verify'), + dbesc($arr['account']['account_language']) + ); + $account = $arr['account']; + } - push_lang(($arr['account']['account_language']) ? $arr['account']['account_language'] : 'en'); + push_lang(($account['account_language']) ? $account['account_language'] : 'en'); $email_msg = replace_macros(get_intltext_template('register_verify_member.tpl'), [ '$sitename' => get_config('system','sitename'), '$siteurl' => z_root(), '$email' => $arr['email'], - '$uid' => $arr['account']['account_id'], + '$uid' => $account['account_id'], '$hash' => $hash, '$details' => $details ] diff --git a/include/auth.php b/include/auth.php index 78be32bf4..6f5e58361 100644 --- a/include/auth.php +++ b/include/auth.php @@ -261,6 +261,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'])))); } elseif($verify) { $atoken = $verify['xchan']; diff --git a/include/bbcode.php b/include/bbcode.php index de32bd57a..0c85a0a4e 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -108,7 +108,11 @@ function tryzrlvideo($match) { if($zrl) $link = zid($link); - return '<video controls="controls" preload="none" src="' . str_replace(' ','%20',$link) . '" style="width:100%; max-width:' . App::$videowidth . 'px"><a href="' . str_replace(' ','%20',$link) . '">' . $link . '</a></video>'; + $static_link = get_config('system','video_default_poster','images/video_poster.jpg'); + if($static_link) + $poster = 'poster="' . escape_tags($static_link) . '" ' ; + + return '<video ' . $poster . ' controls="controls" preload="none" src="' . str_replace(' ','%20',$link) . '" style="width:100%; max-width:' . App::$videowidth . 'px"><a href="' . str_replace(' ','%20',$link) . '">' . $link . '</a></video>'; } // [noparse][i]italic[/i][/noparse] turns into @@ -610,11 +614,23 @@ function bb_observer($Text) { return $Text; } +function bb_code_protect($s) { + return 'b64.^9e%.' . base64_encode($s) . '.b64.$9e%'; +} + +function bb_code_unprotect($s) { + return preg_replace_callback('|b64\.\^9e\%\.(.*?)\.b64\.\$9e\%|ism','bb_code_unprotect_sub',$s); +} + +function bb_code_unprotect_sub($match) { + return base64_decode($match[1]); +} + function bb_code($match) { if(strpos($match[0], "<br />")) - return '<code>' . trim($match[1]) . '</code>'; + return '<code>' . bb_code_protect(trim($match[1])) . '</code>'; else - return '<code class="inline-code">' . trim($match[1]) . '</code>'; + return '<code class="inline-code">' . bb_code_protect(trim($match[1])) . '</code>'; } function bb_code_options($match) { @@ -628,11 +644,11 @@ function bb_code_options($match) { } else { $style = ""; } - return '<code class="'. $class .'" style="'. $style .'">' . trim($match[2]) . '</code>'; + return '<code class="'. $class .'" style="'. $style .'">' . bb_code_protect(trim($match[2])) . '</code>'; } function bb_highlight($match) { - return text_highlight($match[2],strtolower($match[1])); + return bb_code_protect(text_highlight($match[2],strtolower($match[1]))); } function bb_fixtable_lf($match) { @@ -822,6 +838,17 @@ function bbcode($Text, $options = []) { $Text = str_replace(array("\t", " "), array(" ", " "), $Text); + + // Check for [code] text + if (strpos($Text,'[code]') !== false) { + $Text = preg_replace_callback("/\[code\](.*?)\[\/code\]/ism", 'bb_code', $Text); + } + + // Check for [code options] text + if (strpos($Text,'[code ') !== false) { + $Text = preg_replace_callback("/\[code(.*?)\](.*?)\[\/code\]/ism", 'bb_code_options', $Text); + } + // Set up the parameters for a URL search string $URLSearchString = "^\[\]"; // Set up the parameters for a MAIL search string @@ -1062,16 +1089,6 @@ function bbcode($Text, $options = []) { $Text = preg_replace("/\[font=(.*?)\](.*?)\[\/font\]/sm", "<span style=\"font-family: $1;\">$2</span>", $Text); } - // Check for [code] text - if (strpos($Text,'[code]') !== false) { - $Text = preg_replace_callback("/\[code\](.*?)\[\/code\]/ism", 'bb_code', $Text); - } - - // Check for [code options] text - if (strpos($Text,'[code ') !== false) { - $Text = preg_replace_callback("/\[code(.*?)\](.*?)\[\/code\]/ism", 'bb_code_options', $Text); - } - if(strpos($Text,'[/summary]') !== false) { $Text = preg_replace_callback("/^(.*?)\[summary\](.*?)\[\/summary\](.*?)$/ism", 'bb_summary', $Text); @@ -1288,6 +1305,7 @@ function bbcode($Text, $options = []) { // replace escaped links in code= blocks $Text = str_replace('%eY9-!','http', $Text); + $Text = bb_code_unprotect($Text); $Text = preg_replace('/\[\&\;([#a-z0-9]+)\;\]/', '&$1;', $Text); diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php index 7e925a106..deec9adfd 100755 --- a/include/dba/dba_driver.php +++ b/include/dba/dba_driver.php @@ -321,6 +321,10 @@ function db_concat($fld, $sep) { return \DBA::$dba->concat($fld, $sep); } +function db_use_index($str) { + return \DBA::$dba->use_index($str); +} + /** * @brief Execute a SQL query with printf style args. * diff --git a/include/dba/dba_pdo.php b/include/dba/dba_pdo.php index 7b58561a7..a9d824a50 100755 --- a/include/dba/dba_pdo.php +++ b/include/dba/dba_pdo.php @@ -111,6 +111,15 @@ class dba_pdo extends dba_driver { } } + function use_index($str) { + if($this->driver_dbtype === 'pgsql') { + return ''; + } + else { + return 'USE INDEX( ' . $str . ')'; + } + } + function quote_interval($txt) { if($this->driver_dbtype === 'pgsql') { return "'$txt'"; diff --git a/include/items.php b/include/items.php index b12ad1d85..c7206458e 100755 --- a/include/items.php +++ b/include/items.php @@ -390,7 +390,7 @@ function post_activity_item($arr, $allow_code = false, $deliver = true) { $arr['comment_policy'] = map_scope(\Zotlabs\Access\PermissionLimits::Get($channel['channel_id'],'post_comments')); if ((! $arr['plink']) && (intval($arr['item_thread_top']))) { - $arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . urlencode($arr['mid']); + $arr['plink'] = substr(z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . urlencode($arr['mid']),0,190); } diff --git a/include/text.php b/include/text.php index 956f42f7d..8ec6ebace 100644 --- a/include/text.php +++ b/include/text.php @@ -973,7 +973,14 @@ function contact_block() { $contacts = t('Connections'); $micropro = Array(); foreach($r as $rr) { - $rr['archived'] = (intval($rr['abook_archived']) ? true : false); + + // There is no setting to discover if you are bi-directionally connected + // Use the ability to post comments as an indication that this relationship is more + // than wishful thinking; even though soapbox channels and feeds will disable it. + + if(! intval(get_abconfig(App::$profile['uid'],$rr['xchan_hash'],'their_perms','post_comments'))) { + $rr['archived'] = true; + } $micropro[] = micropro($rr,true,'mpfriend'); } } diff --git a/view/en-au/register_verify_member.tpl b/view/en-au/register_verify_member.tpl index d1e34be67..9bdd7fa51 100644 --- a/view/en-au/register_verify_member.tpl +++ b/view/en-au/register_verify_member.tpl @@ -10,7 +10,12 @@ Login with the password you chose at registration. We need to verify your email address in order to give you full access. -If you registered this account, please visit the following link: +Your validation code is + +{{$hash}} + + +If you registered this account, please enter the validation code when requested or visit the following link: {{$siteurl}}/regver/allow/{{$hash}} @@ -23,3 +28,8 @@ To deny the request and remove the account, please visit: Thank you. + +-- +Terms Of Service: +{{$siteurl}}/help/TermsOfService + diff --git a/view/en-gb/register_verify_member.tpl b/view/en-gb/register_verify_member.tpl index d1e34be67..9bdd7fa51 100644 --- a/view/en-gb/register_verify_member.tpl +++ b/view/en-gb/register_verify_member.tpl @@ -10,7 +10,12 @@ Login with the password you chose at registration. We need to verify your email address in order to give you full access. -If you registered this account, please visit the following link: +Your validation code is + +{{$hash}} + + +If you registered this account, please enter the validation code when requested or visit the following link: {{$siteurl}}/regver/allow/{{$hash}} @@ -23,3 +28,8 @@ To deny the request and remove the account, please visit: Thank you. + +-- +Terms Of Service: +{{$siteurl}}/help/TermsOfService + diff --git a/view/en/register_verify_member.tpl b/view/en/register_verify_member.tpl index 71f0964d4..9bdd7fa51 100644 --- a/view/en/register_verify_member.tpl +++ b/view/en/register_verify_member.tpl @@ -10,7 +10,12 @@ Login with the password you chose at registration. We need to verify your email address in order to give you full access. -If you registered this account, please visit the following link: +Your validation code is + +{{$hash}} + + +If you registered this account, please enter the validation code when requested or visit the following link: {{$siteurl}}/regver/allow/{{$hash}} diff --git a/view/js/main.js b/view/js/main.js index 8eb02156b..02b0f125c 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -70,11 +70,19 @@ $(document).ready(function() { if(! $('#nav-' + notifyType + '-sub').hasClass('show')) { loadNotificationItems(notifyType); + sessionStorage.setItem('notification_open', notifyType); + } + else { + sessionStorage.removeItem('notification_open'); } - - $(this).data('clicked', true); }); + if(sessionStorage.getItem('notification_open') !== null) { + var notifyType = sessionStorage.getItem('notification_open'); + $('#nav-' + notifyType + '-sub').addClass('show'); + loadNotificationItems(notifyType); + } + // Allow folks to stop the ajax page updates with the pause/break key $(document).keydown(function(event) { if(event.keyCode == '8') { @@ -446,11 +454,7 @@ function handleNotificationsItems(notifyType, data) { notify_menu.append(html); }); - $(".dropdown-menu img[data-src], .notification img[data-src]").each(function(i, el){ - // Replace data-src attribute with src attribute for every image - $(el).attr('src', $(el).data("src")); - $(el).removeAttr("data-src"); - }); + datasrc2src('#notifications .notification img[data-src]'); if($('#tt-' + notifyType + '-only').hasClass('active')) $('#nav-' + notifyType + '-menu [data-thread_top=false]').hide(); @@ -824,7 +828,7 @@ function liveUpdate(notify_id) { // else data was valid - reset the recursion counter liveRecurse = 0; - if(typeof notify_id !== 'undefined') { + if(typeof notify_id !== 'undefined' && notify_id !== 'undefined') { $.post( "hq", { @@ -932,9 +936,11 @@ function loadNotificationItems(notifyType) { var pingExCmd = 'ping/' + notifyType + ((localUser != 0) ? '?f=&uid=' + localUser : ''); var clicked = $('[data-type=\'' + notifyType + '\']').data('clicked'); + if((clicked === undefined) && (sessionStorage.getItem(notifyType + '_notifications_cache') !== null)) { var cached_data = JSON.parse(sessionStorage.getItem(notifyType + '_notifications_cache')); handleNotificationsItems(notifyType, cached_data); + $('[data-type=\'' + notifyType + '\']').data('clicked',true); console.log('updating ' + notifyType + ' notifications from cache...'); } else { diff --git a/view/pdl/mod_go.pdl b/view/pdl/mod_go.pdl new file mode 100644 index 000000000..c34898dd5 --- /dev/null +++ b/view/pdl/mod_go.pdl @@ -0,0 +1,6 @@ +[region=aside] +[widget=fullprofile][/widget] +[/region] +[region=right_aside] +[widget=notifications][/widget] +[/region] diff --git a/view/tpl/admin_accounts.tpl b/view/tpl/admin_accounts.tpl index 3535363a0..d6c9591fd 100755 --- a/view/tpl/admin_accounts.tpl +++ b/view/tpl/admin_accounts.tpl @@ -41,7 +41,7 @@ </tbody> </table> <div class="selectall"><a href="#" onclick="return toggle_selectall('pending_ckbx');">{{$select_all}}</a></div> - <div class="submit"><input type="submit" name="page_users_deny" value="{{$deny}}"> <input type="submit" name="page_users_approve" value="{{$approve}}"></div> + <div class="submit"><input type="submit" name="page_accounts_deny" value="{{$deny}}"> <input type="submit" name="page_accounts_approve" value="{{$approve}}"></div> {{else}} <p>{{$no_pending}}</p> {{/if}} @@ -80,7 +80,7 @@ </tbody> </table> <div class="selectall"><a href="#" onclick="return toggle_selectall('users_ckbx');">{{$select_all}}</a></div> - <div class="submit"><input type="submit" name="page_users_block" value="{{$block}}/{{$unblock}}"> <input type="submit" name="page_users_delete" value="{{$delete}}" onclick="return confirm_delete_multi()"></div> + <div class="submit"><input type="submit" name="page_accounts_block" value="{{$block}}/{{$unblock}}"> <input type="submit" name="page_accounts_delete" value="{{$delete}}" onclick="return confirm_delete_multi()"></div> {{else}} NO USERS?!? {{/if}} diff --git a/view/tpl/admin_site.tpl b/view/tpl/admin_site.tpl index 50482f03d..0eabe620d 100755 --- a/view/tpl/admin_site.tpl +++ b/view/tpl/admin_site.tpl @@ -74,6 +74,7 @@ {{include file="field_select.tpl" field=$access_policy}} {{include file="field_input.tpl" field=$location}} {{include file="field_input.tpl" field=$sellpage}} + {{include file="field_input.tpl" field=$firstpage}} <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div> diff --git a/view/tpl/email_validation.tpl b/view/tpl/email_validation.tpl new file mode 100644 index 000000000..f049a040f --- /dev/null +++ b/view/tpl/email_validation.tpl @@ -0,0 +1,16 @@ +<h2>{{$title}}</h2> + +<div class="descriptive-paragraph" style="font-size: 1.2em;"><p>{{$desc}}</p></div> + +<form action="email_validation" method="post"> +{{include file="field_input.tpl" field=$token}} + +<div class="pull-right"> + <a href="email_resend/{{$email}}" class="btn btn-warning">{{$resend}}</a> +</div> +<div class="submit-wrapper" > + <button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button> +</div> +</form> +<div class="clear"></div> + diff --git a/view/tpl/go.tpl b/view/tpl/go.tpl new file mode 100644 index 000000000..f0f9ee79e --- /dev/null +++ b/view/tpl/go.tpl @@ -0,0 +1,16 @@ +<h2>{{$title}}</h2> + +<div class="descriptive-text"> + <p>{{$m}}</p> + <p>{{$m1}}</p> +</div> + +{{if $options}} +<ul class="nav nav-pills flex-column"> +{{foreach $options as $k => $v}} + <li class="nav-item"><a href="{{$k}}" class="nav-link">{{$v}}</a></li> +{{/foreach}} +</ul> +{{/if}} + + diff --git a/view/tpl/hq.tpl b/view/tpl/hq.tpl index fce11ff83..099d892bb 100755 --- a/view/tpl/hq.tpl +++ b/view/tpl/hq.tpl @@ -1,13 +1,3 @@ -{{if $no_messages}} -<div class="alert alert-warning alert-dismissible fade show" role="alert"> - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> - <span aria-hidden="true">×</span> - </button> - <h3>{{$no_messages_label.0}}</h3> - <br> - {{$no_messages_label.1}} -</div> -{{/if}} <div id="jot-popup"> {{$editor}} </div> diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl index ffaa4e208..0ffc8b349 100755 --- a/view/tpl/jot-header.tpl +++ b/view/tpl/jot-header.tpl @@ -110,10 +110,21 @@ var activeCommentID = 0; var activeCommentText = ''; $(document).ready(function() { + /* enable tinymce on focus and click */ $("#profile-jot-text").focus(enableOnUser); $("#profile-jot-text").click(enableOnUser); + $('#id_mimetype').on('load', jotSetMime); + $('#id_mimetype').on('change', jotSetMime); + + function jotSetMime() { + var mtype = $('#id_mimetype').val(); + if(mtype == 'text/bbcode') + $('#profile-jot-submit-left').show(); + else + $('#profile-jot-submit-left').hide(); + } $('#invisible-wall-file-upload').fileupload({ url: 'wall_attach/{{$nickname}}', diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl index 69e5e15bc..0f27b1a47 100644 --- a/view/tpl/notifications_widget.tpl +++ b/view/tpl/notifications_widget.tpl @@ -21,7 +21,7 @@ }; }); - {{if $module == 'display' || $module == 'hq'}} + {{if $module == 'display' || $module == 'hq' || $startpage == 'hq'}} $(document).on('click', '.notification', function(e) { var b64mid = $(this).data('b64mid'); var notify_id = $(this).data('notify_id'); @@ -31,30 +31,34 @@ if(b64mid === 'undefined' && notify_id === 'undefined') return; - {{if $module == 'display'}} - history.pushState(stateObj, '', 'display/' + b64mid); - {{/if}} - {{if $module == 'hq'}} - history.pushState(stateObj, '', 'hq/' + b64mid); - {{/if}} - - {{if $module == 'hq'}} - if(b64mid !== 'undefined') { - {{else}} - if(path === 'display' && b64mid) { - {{/if}} + {{if $module != 'hq' && $startpage == 'hq'}} e.preventDefault(); - - if(! page_load) { - if($(this).parent().attr('id') !== 'nav-pubs-menu') - $(this).fadeOut(); - - getData(b64mid, notify_id); + window.location.href = 'hq/' + b64mid; + return; + {{else}} + {{if $module == 'display'}} + history.pushState(stateObj, '', 'display/' + b64mid); + {{/if}} + + {{if $module == 'hq'}} + history.pushState(stateObj, '', 'hq/' + b64mid); + {{/if}} + + {{if $module == 'hq'}} + if(b64mid !== 'undefined') { + {{else}} + if(path === 'display' && b64mid) { + {{/if}} + e.preventDefault(); + + if(! page_load) { + getData(b64mid, notify_id); + } + + if($('#notifications_wrapper').hasClass('fs')) + $('#notifications_wrapper').prependTo('#' + notifications_parent).removeClass('fs'); } - - if($('#notifications_wrapper').hasClass('fs')) - $('#notifications_wrapper').prependTo('#' + notifications_parent).removeClass('fs'); - } + {{/if}} }); {{/if}} |