From 416233c2e467ff2bae8de82367f53fcae6f677f7 Mon Sep 17 00:00:00 2001 From: flop25 Date: Fri, 15 Aug 2014 16:14:43 +0000 Subject: bug:3122 removed admin files profile.tpl and profile_content.tpl, integrated in configuration.tpl take into account default_user_id with a message prefix for template var, to avoid overwriting of already existing vars especially in admin panel git-svn-id: http://piwigo.org/svn/trunk@29221 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/configuration.php | 3 +- admin/themes/default/template/configuration.tpl | 51 ++++++++++++- admin/themes/default/template/profile.tpl | 5 -- admin/themes/default/template/profile_content.tpl | 93 ----------------------- language/en_UK/admin.lang.php | 1 + profile.php | 39 ++++++---- 6 files changed, 76 insertions(+), 116 deletions(-) delete mode 100644 admin/themes/default/template/profile.tpl delete mode 100644 admin/themes/default/template/profile_content.tpl diff --git a/admin/configuration.php b/admin/configuration.php index 6f9370cf4..ceae4baa1 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -419,7 +419,8 @@ switch ($page['section']) load_profile_in_template( $action, '', - $edit_user + $edit_user, + 'GUEST_' ); $template->assign('default', array()); break; diff --git a/admin/themes/default/template/configuration.tpl b/admin/themes/default/template/configuration.tpl index f11390878..0f0a80e20 100644 --- a/admin/themes/default/template/configuration.tpl +++ b/admin/themes/default/template/configuration.tpl @@ -854,6 +854,55 @@ jQuery("input[name='mail_theme']").change(function() { {if isset($default)}
-{$PROFILE_CONTENT} +
+ +{if $GUEST_USERNAME!='guest'} +
+ {'The settings for the guest are from the %s user'|@translate:$GUEST_USERNAME} +
+{/if} + +
+ {'Preferences'|@translate} + + +
    +
  • + + + + +
  • +
  • + + + + +
  • +
  • + {'Expand all albums'|@translate} + {html_radios name='expand' options=$radio_options selected=$GUEST_EXPAND} +
  • + {if $GUEST_ACTIVATE_COMMENTS} +
  • + {'Show number of comments'|@translate} + {html_radios name='show_nb_comments' options=$radio_options selected=$GUEST_NB_COMMENTS} +
  • + {/if} +
  • + {'Show number of hits'|@translate} + {html_radios name='show_nb_hits' options=$radio_options selected=$GUEST_NB_HITS} +
  • +
+
+ +

+ + + +

+ +
+
{/if} diff --git a/admin/themes/default/template/profile.tpl b/admin/themes/default/template/profile.tpl deleted file mode 100644 index 6eac82e44..000000000 --- a/admin/themes/default/template/profile.tpl +++ /dev/null @@ -1,5 +0,0 @@ -
-

{'Profile'|@translate}

-
- -{$PROFILE_CONTENT} diff --git a/admin/themes/default/template/profile_content.tpl b/admin/themes/default/template/profile_content.tpl deleted file mode 100644 index 3c22dd386..000000000 --- a/admin/themes/default/template/profile_content.tpl +++ /dev/null @@ -1,93 +0,0 @@ -
- -
- {'Registration'|@translate} - -
    -
  • - - - - {if not $SPECIAL_USER} - - {else} - {$USERNAME} - {/if} -
  • - {if not $SPECIAL_USER} {* can modify password + email*} -
  • - - - - -
  • -
  • - - - - -
  • -
  • - - - - -
  • - {/if} -
-
- -
- {'Preferences'|@translate} - -
    -
  • - - - - -
  • - {if not $SPECIAL_USER} -
  • - - - - {html_options id=template name=theme options=$template_options selected=$template_selection} -
  • -
  • - - - - {html_options id=language name=language options=$language_options selected=$language_selection} -
  • - {/if} -
  • - - - - -
  • -
  • - {'Expand all albums'|@translate} - {html_radios name='expand' options=$radio_options selected=$EXPAND} -
  • - {if $ACTIVATE_COMMENTS} -
  • - {'Show number of comments'|@translate} - {html_radios name='show_nb_comments' options=$radio_options selected=$NB_COMMENTS} -
  • - {/if} -
  • - {'Show number of hits'|@translate} - {html_radios name='show_nb_hits' options=$radio_options selected=$NB_HITS} -
  • -
-
- -

- - - -

- -
diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php index 7222bb2fb..7697fd1c0 100644 --- a/language/en_UK/admin.lang.php +++ b/language/en_UK/admin.lang.php @@ -802,6 +802,7 @@ $lang['The permalink name must be composed of a-z, A-Z, 0-9, "-", "_" or "/". It $lang['The picture dimensions will be reduced to %dx%d pixels.'] = 'The picture dimensions will be reduced to %dx%d pixels.'; $lang['The Piwigo export plugin allows you to create albums and export photos.'] = 'The Piwigo export plugin allows you to create albums and export photos.'; $lang['The Piwigo publish Plug-in allows you to export and synchronize photos from Lightroom directly to your Piwigo photo gallery.'] = 'The Piwigo publish Plug-in allows you to export and synchronize photos from Lightroom directly to your Piwigo photo gallery.'; +$lang['The settings for the guest are from the %s user']='The settings for the guest are from the %s user' $lang['The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'] = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'; $lang['The uploaded file exceeds the upload_max_filesize directive in php.ini: %sB'] = 'The uploaded file exceeds the upload_max_filesize directive in php.ini: %sB'; $lang['The uploaded file was only partially uploaded'] = 'The uploaded file was only partially uploaded'; diff --git a/profile.php b/profile.php index 29490b902..372f5cc2e 100644 --- a/profile.php +++ b/profile.php @@ -69,11 +69,14 @@ SELECT '.implode(',', $fields).' $title= l10n('Your Gallery Customization'); $page['body_id'] = 'theProfilePage'; $template->set_filename('profile', 'profile.tpl'); + $template->set_filename('profile_content', 'profile_content.tpl'); load_profile_in_template( get_root_url().'profile.php', // action make_index_url(), // for redirect $userdata ); + $template->assign_var_from_handle('PROFILE_CONTENT', 'profile_content'); + // include menubar @@ -289,13 +292,18 @@ function save_profile_from_post($userdata, &$errors) return true; } - -function load_profile_in_template($url_action, $url_redirect, $userdata) +/** + * Assign template variables, from arguments + * Used to build profile edition pages + * + * @param string $url_action + * @param string $url_redirect + * @param array $userdata + */ +function load_profile_in_template($url_action, $url_redirect, $userdata, $template_prefixe=null) { global $template, $conf; - $template->set_filename('profile_content', 'profile_content.tpl'); - $template->assign('radio_options', array( 'true' => l10n('Yes'), @@ -303,17 +311,17 @@ function load_profile_in_template($url_action, $url_redirect, $userdata) $template->assign( array( - 'USERNAME'=>stripslashes($userdata['username']), - 'EMAIL'=>@$userdata['email'], - 'ALLOW_USER_CUSTOMIZATION'=>$conf['allow_user_customization'], - 'ACTIVATE_COMMENTS'=>$conf['activate_comments'], - 'NB_IMAGE_PAGE'=>$userdata['nb_image_page'], - 'RECENT_PERIOD'=>$userdata['recent_period'], - 'EXPAND' =>$userdata['expand'] ? 'true' : 'false', - 'NB_COMMENTS'=>$userdata['show_nb_comments'] ? 'true' : 'false', - 'NB_HITS'=>$userdata['show_nb_hits'] ? 'true' : 'false', - 'REDIRECT' => $url_redirect, - 'F_ACTION'=>$url_action, + $template_prefixe.'USERNAME'=>stripslashes($userdata['username']), + $template_prefixe.'EMAIL'=>@$userdata['email'], + $template_prefixe.'ALLOW_USER_CUSTOMIZATION'=>$conf['allow_user_customization'], + $template_prefixe.'ACTIVATE_COMMENTS'=>$conf['activate_comments'], + $template_prefixe.'NB_IMAGE_PAGE'=>$userdata['nb_image_page'], + $template_prefixe.'RECENT_PERIOD'=>$userdata['recent_period'], + $template_prefixe.'EXPAND' =>$userdata['expand'] ? 'true' : 'false', + $template_prefixe.'NB_COMMENTS'=>$userdata['show_nb_comments'] ? 'true' : 'false', + $template_prefixe.'NB_HITS'=>$userdata['show_nb_hits'] ? 'true' : 'false', + $template_prefixe.'REDIRECT' => $url_redirect, + $template_prefixe.'F_ACTION'=>$url_action, )); $template->assign('template_selection', $userdata['theme']); @@ -338,6 +346,5 @@ function load_profile_in_template($url_action, $url_redirect, $userdata) trigger_notify( 'load_profile_in_template', $userdata ); $template->assign('PWG_TOKEN', get_pwg_token()); - $template->assign_var_from_handle('PROFILE_CONTENT', 'profile_content'); } ?> -- cgit v1.2.3