public function remove($score_id = null)
 {
     $this->require_login();
     if (!$score_id) {
         redirect('home');
     } else {
         if (User_score::count(array('conditions' => array('id = ?', $score_id))) != 1) {
             redirect('home');
         } else {
             $user_score = User_score::find($score_id);
             $write_mod_log = false;
             if ($user_score->user_id != $this->session->userdata('user_id')) {
                 if ($this->session->userdata('user_level') < 2) {
                     redirect('home');
                 } else {
                     $write_mod_log = true;
                 }
             }
             $this->data['user_score'] = $user_score;
             $song = Ranked_file::find($user_score->file_id);
             $this->data['song'] = $song;
             $user_score->status = "removed";
             $user_score->save();
             $scores_user = User::find($user_score->user_id);
             if ($write_mod_log) {
                 $log_string = $this->session->userdata('username') . " (" . $this->session->userdata('display_name') . ") removed user score: " . $scores_user->username . " (" . $scores_user->display_name . ") " . $song->title . " " . number_format($song->rate, 2) . "x";
                 write_to_mod_log($log_string);
             }
             $this->content_view = "scores/removed";
         }
     }
 }
예제 #2
0
 function delete_pack($pack_id)
 {
     if (Pack::count(array('conditions' => array('id = ?', $pack_id))) != 1) {
         redirect('home');
     }
     $this->content_view = "mod/delete_pack_success";
     $pack = Pack::find($pack_id);
     $pack_name = $pack->name;
     $pack->delete();
     $log_string = $this->session->userdata('username') . " (" . $this->session->userdata('display_name') . ") deleted pack: " . $pack_name;
     write_to_mod_log($log_string);
 }