- Timestamp:
- Oct 9, 2009, 10:25:34 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/profile.php
r3995 r4001 41 41 trigger_action('loc_begin_profile'); 42 42 43 // Reset to default (Guest) custom settings43 // Reset to default (Guest) custom settings 44 44 if (isset($_POST['reset_to_default'])) 45 45 { 46 46 global $conf; 47 47 // Get the Guest custom settings 48 $query = 'SELECT * FROM '.USER_INFOS_TABLE. 49 ' WHERE user_id = '.$conf['default_user_id'].';'; 48 $query = ' 49 SELECT * FROM '.USER_INFOS_TABLE.' 50 WHERE user_id = '.$conf['default_user_id']. 51 ';'; 50 52 51 53 $result = pwg_query($query); … … 53 55 $cache['default_user'] = mysql_fetch_assoc($result); 54 56 55 57 $default_user = array(); 56 58 57 58 { 59 60 61 59 foreach ($cache['default_user'] as $name => $value) 60 { 61 // If the field is true or false, the variable is transformed into a 62 // boolean value. 63 if ($value == 'true' or $value == 'false') 62 64 { 63 65 $default_user[$name] = get_boolean($value); 64 66 } 65 67 else 66 68 { 67 69 $default_user[$name] = $value; 68 70 } 69 } 70 // Changing $userdata array values with default ones 71 foreach ($userdata as $key => $valeur) 72 { 73 if ($key == 'nb_image_line') 74 { 75 $userdata[$key] = $default_user['nb_image_line']; 76 $_POST['nb_image_line'] = $userdata['nb_image_line']; 77 } 78 if ($key == 'nb_line_page') 79 { 80 $userdata[$key] = $default_user['nb_line_page']; 81 $_POST['nb_line_page'] = $userdata['nb_line_page']; 82 } 83 if ($key == 'maxwidth') 84 { 85 $userdata[$key] = $default_user['maxwidth']; 86 $_POST['maxwidth'] = $userdata['maxheight']; 87 } 88 if ($key == 'maxheight') 89 { 90 $userdata[$key] = $default_user['maxheight']; 91 $_POST['maxheight'] = $userdata['maxheight']; 92 } 93 if ($key == 'expand') 94 { 95 $userdata[$key] = $default_user['expand']; 96 $_POST['expand'] = $userdata['expand']; 97 } 98 if ($key == 'show_nb_comments') 99 { 100 $userdata[$key] = $default_user['show_nb_comments']; 101 $_POST['show_nb_comments'] = $userdata['show_nb_comments']; 102 } 103 if ($key == 'recent_period') 104 { 105 $userdata[$key] = $default_user['recent_period']; 106 $_POST['recent_period'] = $userdata['recent_period']; 107 } 108 if ($key == 'show_nb_hits') 109 { 110 $userdata[$key] = $default_user['show_nb_hits']; 111 $_POST['show_nb_hits'] = $userdata['show_nb_hits']; 112 } 113 } 114 } 115 71 } 72 // Changing $userdata array values with default ones 73 $userdata_params = array('nb_image_line', 'nb_line_page', 74 'maxwidth', 'maxheight', 'expand', 75 'show_nb_comments', 'show_nb_hits'); 76 foreach ($userdata_params as $key) 77 { 78 $userdata[$key] = $default_user[$key]; 79 $_POST[$key] = $userdata[$key]; 80 } 81 } 116 82 save_profile_from_post($userdata, $errors); 117 83
Note: See TracChangeset
for help on using the changeset viewer.