Browse Source

More json_encode migration and some 2FA fixes

spaghetti 8 years ago
parent
commit
e857952d21
2 changed files with 6 additions and 6 deletions
  1. 5
    5
      classes/users.class.php
  2. 1
    1
      sections/user/take_edit.php

+ 5
- 5
classes/users.class.php View File

@@ -95,7 +95,7 @@ class Users {
95 95
       } else {
96 96
         $UserInfo = G::$DB->next_record(MYSQLI_ASSOC, array('Paranoia', 'Title'));
97 97
         $UserInfo['CatchupTime'] = strtotime($UserInfo['CatchupTime']);
98
-        $UserInfo['Paranoia'] = unserialize($UserInfo['Paranoia']);
98
+        $UserInfo['Paranoia'] = json_decode($UserInfo['Paranoia'], true);
99 99
         if ($UserInfo['Paranoia'] === false) {
100 100
           $UserInfo['Paranoia'] = array();
101 101
         }
@@ -182,7 +182,7 @@ class Users {
182 182
       $HeavyInfo = G::$DB->next_record(MYSQLI_ASSOC, array('CustomPermissions', 'SiteOptions'));
183 183
 
184 184
       if (!empty($HeavyInfo['CustomPermissions'])) {
185
-        $HeavyInfo['CustomPermissions'] = unserialize($HeavyInfo['CustomPermissions']);
185
+        $HeavyInfo['CustomPermissions'] = json_decode($HeavyInfo['CustomPermissions'], true);
186 186
       } else {
187 187
         $HeavyInfo['CustomPermissions'] = array();
188 188
       }
@@ -232,7 +232,7 @@ class Users {
232 232
         unset($HeavyInfo['CustomForums']['']);
233 233
       }
234 234
 
235
-      $HeavyInfo['SiteOptions'] = unserialize($HeavyInfo['SiteOptions']);
235
+      $HeavyInfo['SiteOptions'] = json_decode($HeavyInfo['SiteOptions'], true);
236 236
       if (!empty($HeavyInfo['SiteOptions'])) {
237 237
         $HeavyInfo = array_merge($HeavyInfo, $HeavyInfo['SiteOptions']);
238 238
       }
@@ -268,7 +268,7 @@ class Users {
268 268
       FROM users_info
269 269
       WHERE UserID = $UserID");
270 270
     list($SiteOptions) = G::$DB->next_record(MYSQLI_NUM, false);
271
-    $SiteOptions = unserialize($SiteOptions);
271
+    $SiteOptions = json_decode($SiteOptions, true);
272 272
 
273 273
     // Get HeavyInfo
274 274
     $HeavyInfo = Users::user_heavy_info($UserID);
@@ -280,7 +280,7 @@ class Users {
280 280
     // Update DB
281 281
     G::$DB->query("
282 282
       UPDATE users_info
283
-      SET SiteOptions = '".db_string(serialize($SiteOptions))."'
283
+      SET SiteOptions = '".db_string(json_encode($SiteOptions, true))."'
284 284
       WHERE UserID = $UserID");
285 285
     G::$DB->set_query_id($QueryID);
286 286
 

+ 1
- 1
sections/user/take_edit.php View File

@@ -181,7 +181,7 @@ if ($CurEmail != $_POST['email']) {
181 181
 //End email change
182 182
 
183 183
 //2FA activation
184
-if (isset($_POST['twofa'])) {
184
+if (!empty($_POST['twofa'])) {
185 185
   $DB->query("
186 186
     SELECT TwoFactor, PassHash
187 187
     FROM users_main

Loading…
Cancel
Save