Skip to content

Commit 8d34e32

Browse files
committed
Merge branch 'develop' into 7.0dev
# Conflicts: # rsc/build/bootstrap-b2evo_base.bmin.css # rsc/build/bootstrap-backoffice-b2evo_base.bmin.css
2 parents f90781b + 85af12f commit 8d34e32

37 files changed

Lines changed: 1160 additions & 221 deletions

conf/_application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* Release date (ISO)
2222
* @global string
2323
*/
24-
$app_date = '2017-12-27';
24+
$app_date = '2017-12-29';
2525

2626
/**
2727
* Long version string for checking differences

htsrv/anon_async.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,29 @@
6363
$params = param( 'params', 'array', array() );
6464
switch( $action )
6565
{
66+
case 'get_item_form':
67+
// Display item form:
68+
69+
// Use the glyph or font-awesome icons if requested by skin
70+
param( 'b2evo_icons_type', 'string', '' );
71+
72+
$cat_ID = param( 'cat', 'integer' );
73+
$BlogCache = & get_BlogCache();
74+
$Collection = $Blog = & $BlogCache->get_by_ID( $blog_ID );
75+
76+
locale_activate( $Blog->get( 'locale' ) );
77+
78+
$blog_skin_ID = $Blog->get_skin_ID();
79+
if( ! empty( $blog_skin_ID ) )
80+
{ // Initialize collection skin folder to check if it has a specific new item form:
81+
$SkinCache = & get_SkinCache();
82+
$Skin = & $SkinCache->get_by_ID( $blog_skin_ID );
83+
$ads_current_skin_path = $skins_path.$Skin->folder.'/';
84+
}
85+
86+
require skin_template_path( '_item_new_form.inc.php' );
87+
break;
88+
6689
case 'get_comment_form':
6790
// Display comment form:
6891

htsrv/profile_update.php

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,20 +293,53 @@
293293
switch( $action )
294294
{
295295
case 'update':
296-
if( isset( $current_User->previous_pass_driver ) &&
296+
if( $user_tab == 'register_finish' )
297+
{ // After submitting quick data we should redirect user to page like after registration:
298+
$after_registration = $Settings->get( 'after_registration' );
299+
if( $after_registration == 'return_to_original' )
300+
{ // Return to original page ( where user was before the registration process ):
301+
if( empty( $redirect_to ) )
302+
{ // redirect_to param was not set
303+
if( ! empty( $Blog ) )
304+
{
305+
$redirect_to = $Blog->gen_blogurl();
306+
}
307+
else
308+
{
309+
$redirect_to = $baseurl;
310+
}
311+
}
312+
}
313+
elseif( $after_registration == 'specific_slug' )
314+
{ // Return to the specific slug which is set in the registration settings form:
315+
$SlugCache = get_SlugCache();
316+
if( ( $Slug = & $SlugCache->get_by_name( $Settings->get( 'after_registration_slug' ), false, false ) ) &&
317+
( $slug_Item = & $Slug->get_object() ) &&
318+
( $slug_Item instanceof Item ) )
319+
{ // Use permanent URL of the slug Item:
320+
$redirect_to = $slug_Item->get_permanent_url( '', '', '&' );
321+
}
322+
}
323+
else
324+
{ // Return to the specific URL which is set in the registration settings form:
325+
$redirect_to = $after_registration;
326+
}
327+
}
328+
elseif( isset( $current_User->previous_pass_driver ) &&
297329
$current_User->previous_pass_driver == 'nopass' &&
298330
$current_User->previous_pass_driver != $current_User->get( 'pass_driver' ) )
299331
{ // Redirect to page as we use after email validation if current user set password first time, e-g after email capture/quick registration:
300332
$redirect_to = redirect_after_account_activation();
301333
}
302-
elseif( $current_User->has_avatar() )
303-
{ // Redirect to display user page
304-
$redirect_to = $Blog->get( 'userurl', array( 'glue' => '&' ) );
305-
}
306-
else
307-
{ // Redirect to upload avatar
334+
elseif( ! $current_User->has_avatar() )
335+
{ // Redirect to upload avatar if it is not uploaded yet:
308336
$redirect_to = get_user_avatar_url();
309337
}
338+
339+
if( empty( $redirect_to ) )
340+
{ // Redirect to display user page for cases when redirect param cannot be defined above by some reason:
341+
$redirect_to = $Blog->get( 'userurl', array( 'glue' => '&' ) );
342+
}
310343
break;
311344
case 'upload_avatar':
312345
// Redirect to display user profile form

inc/_blog_main.inc.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@
492492
if( empty( $Item ) &&
493493
(
494494
! is_null( $catsel ) || // Filter by many categories
495-
( $disp != 'edit' && ! is_null( $cat ) ) || // Filter by one category
495+
( $disp != 'edit' && $disp != 'anonpost' && ! is_null( $cat ) ) || // Filter by one category
496496
! is_null( $tag ) || // Filter by tag
497497
! empty( $m ) // Filter by date like '201410' (urls from ?disp=arcdir)
498498
) )
@@ -825,6 +825,7 @@
825825
'access_denied' => 'access_denied.main.php',
826826
'access_requires_login' => 'access_requires_login.main.php',
827827
'activateinfo' => 'activateinfo.main.php',
828+
'anonpost' => 'anonpost.main.php',
828829
'arcdir' => 'arcdir.main.php',
829830
'catdir' => 'catdir.main.php',
830831
'closeaccount' => 'closeaccount.main.php',
@@ -853,6 +854,7 @@
853854
'subs' => 'subs.main.php',
854855
'visits' => 'visits.main.php',
855856
'register' => 'register.main.php',
857+
'register_finish' => 'register_finish.main.php',
856858
'search' => 'search.main.php',
857859
'single' => 'single.main.php',
858860
'sitemap' => 'sitemap.main.php',

inc/_core/_param.funcs.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2368,20 +2368,20 @@ function check_html_sanity( $content, $context = 'posting', $User = NULL, $encod
23682368
{
23692369
case 'posting':
23702370
case 'xmlrpc_posting':
2371-
$Group = $User->get_Group();
2371+
$Group = $User ? $User->get_Group() : false;
23722372
if( $context == 'posting' )
23732373
{
2374-
$xhtmlvalidation = ($Group->perm_xhtmlvalidation == 'always');
2374+
$xhtmlvalidation = ( $Group && $Group->perm_xhtmlvalidation == 'always' );
23752375
}
23762376
else
23772377
{
2378-
$xhtmlvalidation = ($Group->perm_xhtmlvalidation_xmlrpc == 'always');
2378+
$xhtmlvalidation = ( $Group && $Group->perm_xhtmlvalidation_xmlrpc == 'always' );
23792379
}
2380-
$allow_css_tweaks = $Group->perm_xhtml_css_tweaks;
2381-
$allow_javascript = $Group->perm_xhtml_javascript;
2382-
$allow_iframes = $Group->perm_xhtml_iframes;
2383-
$allow_objects = $Group->perm_xhtml_objects;
2384-
$bypass_antispam = $Group->perm_bypass_antispam;
2380+
$allow_css_tweaks = $Group && $Group->perm_xhtml_css_tweaks;
2381+
$allow_javascript = $Group && $Group->perm_xhtml_javascript;
2382+
$allow_iframes = $Group && $Group->perm_xhtml_iframes;
2383+
$allow_objects = $Group && $Group->perm_xhtml_objects;
2384+
$bypass_antispam = $Group && $Group->perm_bypass_antispam;
23852385
break;
23862386

23872387
case 'commenting':

inc/_core/_template.funcs.php

Lines changed: 135 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ function get_request_title( $params = array() )
421421
'format' => 'htmlbody',
422422
// Title for each disp:
423423
// fp> TODO: Make a global array of $disp => Clear text disp
424+
'anonpost_text' => '#',// # - 'New [Post]' ('Post' is item type name)
424425
'arcdir_text' => T_('Archive Directory'),
425426
'catdir_text' => T_('Category Directory'),
426427
'mediaidx_text' => T_('Photo Index'),
@@ -432,7 +433,8 @@ function get_request_title( $params = array() )
432433
'contacts_text' => T_('Contacts'),
433434
'login_text' => /* TRANS: trailing space = verb */ T_('Login '),
434435
'register_text' => T_('Register'),
435-
'req_activate_email' => T_('Account activation'),
436+
'register_finish_text'=> T_('Finish Registration'),
437+
'req_activate_email' => T_('Account activation'),
436438
'account_activation' => T_('Account activation'),
437439
'lostpassword_text' => T_('Lost your password?'),
438440
'profile_text' => T_('User Profile'),
@@ -554,6 +556,11 @@ function get_request_title( $params = array() )
554556
$r[] = $params['subs_text'];
555557
break;
556558

559+
case 'register_finish':
560+
// We are requesting the register finish form:
561+
$r[] = $params['register_finish_text'];
562+
break;
563+
557564
case 'visits':
558565
// We are requesting the profile visits screen:
559566
$user_ID = param( 'user_ID', 'integer', 0 );
@@ -684,6 +691,17 @@ function get_request_title( $params = array() )
684691
$r[] = $params['closeaccount_text'];
685692
break;
686693

694+
case 'anonpost':
695+
if( $params['anonpost_text'] == '#' )
696+
{ // Initialize default auto title:
697+
$r[] = sprintf( T_('New [%s]'), $Blog->get_default_item_type_name() );
698+
}
699+
else
700+
{ // Use custom title from param:
701+
$r[] = $params['anonpost_text'];
702+
}
703+
break;
704+
687705
case 'edit':
688706
global $edited_Item;
689707
$type_name = $edited_Item->get_ItemType()->get_name();
@@ -3157,6 +3175,122 @@ function passinfo(el)
31573175
}
31583176

31593177

3178+
/*
3179+
* Display javascript code to edit password
3180+
*
3181+
* @param array Params
3182+
*/
3183+
function display_password_js_edit()
3184+
{
3185+
global $Settings;
3186+
3187+
echo '<script type="text/javascript">
3188+
jQuery( "#current_user_pass" ).keyup( function()
3189+
{
3190+
var error_obj = jQuery( this ).parent().find( "span.field_error" );
3191+
if( error_obj.length )
3192+
{
3193+
if( jQuery( this ).val() == "" )
3194+
{
3195+
error_obj.show();
3196+
}
3197+
else
3198+
{
3199+
error_obj.hide();
3200+
}
3201+
}
3202+
3203+
user_pass_clear_style( "#current_user_pass" );
3204+
} );
3205+
3206+
jQuery( "#edited_user_pass1, #edited_user_pass2" ).keyup( function()
3207+
{
3208+
var minpass_obj = jQuery( this ).parent().find( ".pass_check_min" );
3209+
if( minpass_obj.length )
3210+
{ // Hide/Show a message about min pass length
3211+
if( jQuery.trim( jQuery( this ).val() ).length >= '.intval( $Settings->get('user_minpwdlen') ).' )
3212+
{
3213+
minpass_obj.hide();
3214+
}
3215+
else
3216+
{
3217+
minpass_obj.show();
3218+
}
3219+
}
3220+
3221+
var diff_obj = jQuery( ".pass_check_diff" );
3222+
if( diff_obj.length && jQuery( "#edited_user_pass1" ).val() == jQuery( " #edited_user_pass2" ).val() )
3223+
{ // Hide message about different passwords
3224+
diff_obj.hide();
3225+
}
3226+
3227+
// Hide message about that new password must be entered
3228+
var new_obj = jQuery( this ).parent().find( ".pass_check_new" );
3229+
if( new_obj.length )
3230+
{
3231+
if( jQuery( this ).val() == "" )
3232+
{
3233+
new_obj.show();
3234+
}
3235+
else
3236+
{
3237+
new_obj.hide();
3238+
}
3239+
}
3240+
3241+
// Hide message about that new password must be entered twice
3242+
var twice_obj = jQuery( this ).parent().find( ".pass_check_twice" );
3243+
if( twice_obj.length )
3244+
{
3245+
if( jQuery( this ).val() == "" )
3246+
{
3247+
twice_obj.show();
3248+
}
3249+
else
3250+
{
3251+
twice_obj.hide();
3252+
}
3253+
}
3254+
3255+
var warning_obj = jQuery( this ).parent().find( ".pass_check_warning" );
3256+
if( jQuery.trim( jQuery( this ).val() ) != jQuery( this ).val() )
3257+
{ // Password contains the leading and trailing spaces
3258+
if( ! warning_obj.length )
3259+
{
3260+
jQuery( this ).parent().append( "<span class=\"pass_check_warning notes field_error\">.'.TS_('The leading and trailing spaces will be trimmed.').'</span>" );
3261+
}
3262+
}
3263+
else if( warning_obj.length )
3264+
{ // No spaces, Remove warning
3265+
warning_obj.remove();
3266+
}
3267+
3268+
user_pass_clear_style( "#edited_user_pass1, #edited_user_pass2" );
3269+
} );
3270+
3271+
/**
3272+
* Hide/Show error style of input depending on visibility of the error messages
3273+
*
3274+
* @param string jQuery selector
3275+
*/
3276+
function user_pass_clear_style( obj_selector )
3277+
{
3278+
jQuery( obj_selector ).each( function()
3279+
{
3280+
if( jQuery( this ).parent().find( "span.field_error span:visible" ).length )
3281+
{
3282+
jQuery( this ).addClass( "field_error" );
3283+
}
3284+
else
3285+
{
3286+
jQuery( this ).removeClass( "field_error" );
3287+
}
3288+
} );
3289+
}
3290+
</script>';
3291+
}
3292+
3293+
31603294
/*
31613295
* Display javascript login validator
31623296
*

inc/_core/model/_pagecache.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ function check()
229229
return false;
230230
}
231231

232-
if( $disp == 'login' || $disp == 'access_requires_login' || $disp == 'register' || $disp == 'lostpassword' )
233-
{ // We do NOT want caching for in-skin login, register and lostpassord pages
234-
$Debuglog->add( 'Never cache the in-skin login and register pages!', 'pagecache' );
232+
if( $disp == 'login' || $disp == 'access_requires_login' || $disp == 'register' || $disp == 'lostpassword' || $disp == 'anonpost' )
233+
{ // We do NOT want caching for in-skin login, register, lostpassord pages and new item anonymous form:
234+
$Debuglog->add( 'Never cache the in-skin login, register and anonymous new item pages!', 'pagecache' );
235235
return false;
236236
}
237237

0 commit comments

Comments
 (0)