plugins/admin/UserRanks.php
changeset 633 4f81e21b5590
parent 628 ab6f55abb17e
child 685 17ebe24cdf85
equal deleted inserted replaced
632:567e4b2c763f 633:4f81e21b5590
   118         // perform update
   118         // perform update
   119         $rank_title = $db->escape($request['rank_title']);
   119         $rank_title = $db->escape($request['rank_title']);
   120         $rank_style = $db->escape(@$request['rank_style']);
   120         $rank_style = $db->escape(@$request['rank_style']);
   121         $q = $db->sql_query('UPDATE ' . table_prefix . "ranks SET rank_title = '$rank_title', rank_style = '$rank_style' WHERE rank_id = $rank_id;");
   121         $q = $db->sql_query('UPDATE ' . table_prefix . "ranks SET rank_title = '$rank_title', rank_style = '$rank_style' WHERE rank_id = $rank_id;");
   122         
   122         
       
   123         // regenerate the ranks cache
       
   124         generate_cache_userranks();
       
   125         
   123         echo enano_json_encode(array(
   126         echo enano_json_encode(array(
   124             'mode' => 'success'
   127             'mode' => 'success'
   125           ));
   128           ));
   126         break;
   129         break;
   127       case 'create_rank':
   130       case 'create_rank':
   150               'mode' => 'error',
   153               'mode' => 'error',
   151               'error' => 'Refetch of rank ID failed'
   154               'error' => 'Refetch of rank ID failed'
   152             ));
   155             ));
   153           return true;
   156           return true;
   154         }
   157         }
       
   158         
       
   159         // regenerate the ranks cache
       
   160         generate_cache_userranks();
   155         
   161         
   156         echo enano_json_encode(array(
   162         echo enano_json_encode(array(
   157             'mode' => 'success',
   163             'mode' => 'success',
   158             'rank_id' => $rank_id
   164             'rank_id' => $rank_id
   159           ));
   165           ));
   190         
   196         
   191         // now remove the rank itself
   197         // now remove the rank itself
   192         $q = $db->sql_query('DELETE FROM ' . table_prefix . "ranks WHERE rank_id = $rank_id;");
   198         $q = $db->sql_query('DELETE FROM ' . table_prefix . "ranks WHERE rank_id = $rank_id;");
   193         if ( !$q )
   199         if ( !$q )
   194           $db->_die();
   200           $db->_die();
       
   201         
       
   202         // regenerate the ranks cache
       
   203         generate_cache_userranks();
   195         
   204         
   196         echo enano_json_encode(array(
   205         echo enano_json_encode(array(
   197             'mode' => 'success'
   206             'mode' => 'success'
   198           ));
   207           ));
   199         break;
   208         break;