Merge pull request #13 from redmatrix/dev

Dev
This commit is contained in:
mrjive 2018-01-30 16:13:30 +01:00 committed by GitHub
commit 7ac4b47702
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 447 additions and 129 deletions

View file

@ -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);
}

View file

@ -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')),

View file

@ -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;
}
}

View file

@ -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.
}
}

View file

@ -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;
}
}

66
Zotlabs/Module/Go.php Normal file
View file

@ -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;
}
}

View file

@ -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())

View file

@ -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'];

View file

@ -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"] == "") {

View file

@ -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);
}

View file

@ -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'",

View file

@ -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;

View file

@ -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;

View file

@ -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 );

BIN
images/video_poster.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View file

@ -262,24 +262,46 @@ function create_account($arr) {
function verify_email_address($arr) {
$hash = random_string();
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'])
);
$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
]

View file

@ -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'];

View file

@ -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("&nbsp;&nbsp;&nbsp;&nbsp;", "&nbsp;&nbsp;"), $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('/\[\&amp\;([#a-z0-9]+)\;\]/', '&$1;', $Text);

View file

@ -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.
*

View file

@ -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'";

View file

@ -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);
}

View file

@ -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');
}
}

View file

@ -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

View file

@ -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

View file

@ -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}}

View file

@ -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 {

6
view/pdl/mod_go.pdl Normal file
View file

@ -0,0 +1,6 @@
[region=aside]
[widget=fullprofile][/widget]
[/region]
[region=right_aside]
[widget=notifications][/widget]
[/region]

View file

@ -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}}

View file

@ -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>

View file

@ -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>

16
view/tpl/go.tpl Normal file
View file

@ -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}}

View file

@ -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">&times;</span>
</button>
<h3>{{$no_messages_label.0}}</h3>
<br>
{{$no_messages_label.1}}
</div>
{{/if}}
<div id="jot-popup">
{{$editor}}
</div>

View file

@ -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}}',

View file

@ -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();
window.location.href = 'hq/' + b64mid;
return;
{{else}}
{{if $module == 'display'}}
history.pushState(stateObj, '', 'display/' + b64mid);
{{/if}}
if(! page_load) {
if($(this).parent().attr('id') !== 'nav-pubs-menu')
$(this).fadeOut();
{{if $module == 'hq'}}
history.pushState(stateObj, '', 'hq/' + b64mid);
{{/if}}
getData(b64mid, notify_id);
{{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}}