aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric <eric@piwigo.org>2009-10-08 21:05:51 +0000
committerEric <eric@piwigo.org>2009-10-08 21:05:51 +0000
commita44ceedea6f0bc66db6dd924e111c7634d6e17f0 (patch)
tree3a2ec6d330d5fecc88805ec8e0b0a762c7075cb5
parent327cdb0eabdfd0e64b187d796fed6939263b40b5 (diff)
[Piwigo] Merged from trunk to branch - Bug 1079 fixed : Return to default settings in user profile page.
(I don't really enjoy the code but it's the simplest way i've found) git-svn-id: http://piwigo.org/svn/branches/2.0@3996 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--language/de_DE/common.lang.php1
-rw-r--r--language/en_UK/common.lang.php1
-rw-r--r--language/es_ES/common.lang.php2
-rw-r--r--language/fr_FR/common.lang.php1
-rw-r--r--language/it_IT/common.lang.php1
-rw-r--r--profile.php74
-rw-r--r--template/yoga/profile_content.tpl1
7 files changed, 80 insertions, 1 deletions
diff --git a/language/de_DE/common.lang.php b/language/de_DE/common.lang.php
index 41eaca250..31d5a3a63 100644
--- a/language/de_DE/common.lang.php
+++ b/language/de_DE/common.lang.php
@@ -365,4 +365,5 @@ $lang['group by letters'] = 'Gruppieren nach Buchstaben';
$lang['letters'] = 'Buchstaben';
$lang['show tag cloud'] = 'zeigen die Tag-Wolke';
$lang['cloud'] = 'Wolke';
+$lang['Reset_To_Default'] = 'Zurücksetzen auf Standardwerte';
?>
diff --git a/language/en_UK/common.lang.php b/language/en_UK/common.lang.php
index 8858e10f2..af037f9d3 100644
--- a/language/en_UK/common.lang.php
+++ b/language/en_UK/common.lang.php
@@ -365,4 +365,5 @@ $lang['group by letters'] = 'group by letters';
$lang['letters'] = 'letters';
$lang['show tag cloud'] = 'show tag cloud';
$lang['cloud'] = 'cloud';
+$lang['Reset_To_Default'] = 'Reset to default values';
?> \ No newline at end of file
diff --git a/language/es_ES/common.lang.php b/language/es_ES/common.lang.php
index e7a2c820d..9af5df057 100644
--- a/language/es_ES/common.lang.php
+++ b/language/es_ES/common.lang.php
@@ -365,5 +365,5 @@ $lang['group by letters'] = 'Reagrupar por letras';
$lang['letters'] = 'letras';
$lang['show tag cloud'] = 'mostrar la nube de tags';
$lang['cloud'] = 'nube';
-
+$lang['Reset_To_Default'] = 'Restablecer los valores predeterminados';
?>
diff --git a/language/fr_FR/common.lang.php b/language/fr_FR/common.lang.php
index f929703c7..1f576615c 100644
--- a/language/fr_FR/common.lang.php
+++ b/language/fr_FR/common.lang.php
@@ -365,4 +365,5 @@ $lang['group by letters'] = 'regrouper par lettres';
$lang['letters'] = 'lettres';
$lang['show tag cloud'] = 'montrer le nuage de tags';
$lang['cloud'] = 'nuage';
+$lang['Reset_To_Default'] = 'Rétablir les valeurs par défaut';
?>
diff --git a/language/it_IT/common.lang.php b/language/it_IT/common.lang.php
index 84bb393b8..4a47cb585 100644
--- a/language/it_IT/common.lang.php
+++ b/language/it_IT/common.lang.php
@@ -365,6 +365,7 @@ $lang['group by letters'] = 'ragruppare per lettera';
$lang['letters'] = 'lettere';
$lang['show tag cloud'] = 'fare salire la nuvola di tags';
$lang['cloud'] = 'nuvola';
+$lang['Reset_To_Default'] = 'Ripristinare le impostazioni predefinite';
// --------- Starting below: New or revised $lang ---- from Colibri (2.1)
$lang['del_all_favorites_hint'] = 'cancellare tutte le immagini dai vostri favoriti';
$lang['Sent by'] = 'Mandato da';
diff --git a/profile.php b/profile.php
index 2412f2e19..e84ace65b 100644
--- a/profile.php
+++ b/profile.php
@@ -40,6 +40,79 @@ if (!defined('PHPWG_ROOT_PATH'))
trigger_action('loc_begin_profile');
+// Reset to default (Guest) custom settings
+ if (isset($_POST['reset_to_default']))
+ {
+ global $conf;
+ // Get the Guest custom settings
+ $query = 'SELECT * FROM '.USER_INFOS_TABLE.
+ ' WHERE user_id = '.$conf['default_user_id'].';';
+
+ $result = pwg_query($query);
+
+ $cache['default_user'] = mysql_fetch_assoc($result);
+
+ $default_user = array();
+
+ foreach ($cache['default_user'] as $name => $value)
+ {
+ // If the field is true or false, the variable is transformed into a
+ // boolean value.
+ if ($value == 'true' or $value == 'false')
+ {
+ $default_user[$name] = get_boolean($value);
+ }
+ else
+ {
+ $default_user[$name] = $value;
+ }
+ }
+ // Changing $userdata array values with default ones
+ foreach ($userdata as $key => $valeur)
+ {
+ if ($key == 'nb_image_line')
+ {
+ $userdata[$key] = $default_user['nb_image_line'];
+ $_POST['nb_image_line'] = $userdata['nb_image_line'];
+ }
+ if ($key == 'nb_line_page')
+ {
+ $userdata[$key] = $default_user['nb_line_page'];
+ $_POST['nb_line_page'] = $userdata['nb_line_page'];
+ }
+ if ($key == 'maxwidth')
+ {
+ $userdata[$key] = $default_user['maxwidth'];
+ $_POST['maxwidth'] = $userdata['maxheight'];
+ }
+ if ($key == 'maxheight')
+ {
+ $userdata[$key] = $default_user['maxheight'];
+ $_POST['maxheight'] = $userdata['maxheight'];
+ }
+ if ($key == 'expand')
+ {
+ $userdata[$key] = $default_user['expand'];
+ $_POST['expand'] = $userdata['expand'];
+ }
+ if ($key == 'show_nb_comments')
+ {
+ $userdata[$key] = $default_user['show_nb_comments'];
+ $_POST['show_nb_comments'] = $userdata['show_nb_comments'];
+ }
+ if ($key == 'recent_period')
+ {
+ $userdata[$key] = $default_user['recent_period'];
+ $_POST['recent_period'] = $userdata['recent_period'];
+ }
+ if ($key == 'show_nb_hits')
+ {
+ $userdata[$key] = $default_user['show_nb_hits'];
+ $_POST['show_nb_hits'] = $userdata['show_nb_hits'];
+ }
+ }
+ }
+
save_profile_from_post($userdata, $errors);
$title= l10n('customize_page_title');
@@ -257,6 +330,7 @@ function load_profile_in_template($url_action, $url_redirect, $userdata)
}
$language_options[$language_code] = $language_name;
}
+
$template->assign('language_options', $language_options);
$special_user = in_array($userdata['id'], array($conf['guest_id'], $conf['default_user_id']));
diff --git a/template/yoga/profile_content.tpl b/template/yoga/profile_content.tpl
index 9cabf0a51..ed45b3a9a 100644
--- a/template/yoga/profile_content.tpl
+++ b/template/yoga/profile_content.tpl
@@ -104,6 +104,7 @@
<p class="bottomButtons">
<input class="submit" type="submit" name="validate" value="{'Submit'|@translate}">
<input class="submit" type="reset" name="reset" value="{'Reset'|@translate}">
+ <input class="submit" type="submit" name="reset_to_default" value="{'Reset_To_Default'|@translate}">
</p>
</form>