Ejemplo n.º 1
0
             $response['msg'] = $lang['msg_cmd_noaccess'];
         }
     } else {
         $response['msg'] = $lang['msg_cmd_missingvars'];
     }
     break;
     /**
      * Add to blacklist
      */
 /**
  * Add to blacklist
  */
 case 'addBlacklist':
     if (isset($_POST['vars']['profileId']) && isset($_POST['vars']['reason']) && isset($_POST['vars']['until'])) {
         if ($userInfo['rights_blacklist'] == 'yes') {
             $result = $bl->addBan($userInfo['user_id'], $_POST['vars']['profileId'], $_POST['vars']['reason'], $_POST['vars']['until']);
             if (is_bool($result)) {
                 $response['status'] = 'OK';
                 $response['msg'] = $lang['tool_bl_added'];
                 $log->insertActionLog($userInfo['user_id'], 'Ban added for player ' . $_POST['vars']['profileId'] . ' added to the blacklist');
             } else {
                 $response['msg'] = getLang($result);
             }
         } else {
             $response['msg'] = $lang['msg_cmd_noaccess'];
         }
     } else {
         $response['msg'] = $lang['msg_cmd_missingvars'];
     }
     break;
     /**
Ejemplo n.º 2
0
 /**
  * cmdBanPlayer()
  * Bans player
  * 
  * @param $cmdInfo - Command info
  * @return array - Status
  */
 public function cmdBanPlayer($cmdInfo)
 {
     $return = array('code' => 'ERROR', 'message' => '');
     if (!empty($cmdInfo['vars']) || $cmdInfo['vars'] != null) {
         $varsSplit = explode(' ', $cmdInfo['vars'], 3);
         if (($varsSplit[0] == '0' || !empty($varsSplit[0])) && is_numeric(trim($varsSplit[0]))) {
             if (isset($varsSplit[1]) && !empty($varsSplit[1])) {
                 $result = $this->findPlayerByName($varsSplit[1]);
                 $reason = isset($varsSplit[2]) ? $varsSplit[2] : (!empty($cmdInfo['_cmd']['cmd_response']) ? $cmdInfo['_cmd']['cmd_response'] : 'Unknown');
                 if ($varsSplit[0] == 0) {
                     $until = '0000-00-00 00:00:00';
                 } else {
                     $until = time() + $varsSplit[0] * 3600;
                     $until = date('Y-m-d H:i:s', $until);
                 }
                 if ($result['code'] == 'OK') {
                     $bl = new Blacklist($this->db, $this->config);
                     $ban = $bl->addBan(0, $result['player']['nucleusId'], $reason, $until);
                     if ($ban == true) {
                         $this->ct->sendPlayer($cmdInfo['origin']['name'], '|ccc| ' . $result['player']['name'] . ' is succesfully banned');
                         $return['code'] = 'OK';
                     } else {
                         $return['message'] = '|ccc| Could not ban the player, probably this player already has a ban';
                     }
                 } else {
                     $return['message'] = $result['message'];
                 }
             } else {
                 $return['message'] = '|ccc| Please specify a player to ban';
             }
         } else {
             $return['message'] = '|ccc| Please specify a amount of hours for how long the ban lasts, 0 = permanent';
         }
     } else {
         $return['message'] = '|ccc| There are missing parameters for this command: {time} {player} {reason}';
     }
     return $return;
 }