public function run()
 {
     $participants = DB::table('event_participant')->get();
     foreach ($participants as $participant) {
         $player = Player::find($participant->player_id);
         $user = User::find($participant->user_id);
         $event = Evento::find($participant->event_id);
         $payment = Payment::find($participant->payment_id);
         $uuid = Uuid::generate();
         $new = new Participant();
         $new->id = $uuid;
         $new->firstname = $player->firstname;
         $new->lastname = $player->lastname;
         $new->due = $event->getOriginal('fee');
         $new->early_due = $event->getOriginal('early_fee');
         $new->early_due_deadline = $event->early_deadline;
         $new->method = 'full';
         $new->plan_id = Null;
         $new->player_id = $player->id;
         $new->event_id = $participant->event_id;
         $new->accepted_on = $participant->created_at;
         $new->accepted_by = $user->profile->firstname . " " . $user->profile->lastname;
         $new->accepted_user = $participant->user_id;
         $new->status = 1;
         $new->created_at = $participant->created_at;
         $new->updated_at = $participant->updated_at;
         $new->save();
         $update = Item::where('payment_id', '=', $payment->id)->firstOrFail();
         $update->participant_id = $uuid;
         $update->save();
     }
 }
 /**
  * @param string $backUrl
  * @param int $player_id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function add($backUrl = 'entree', $player_id = 0)
 {
     if ($player_id == 0) {
         return Redirect::route($backUrl);
     }
     $player = Player::find($player_id);
     // Cree Entree
     $entree = new Entree();
     $entree->compet_id = MySession::getModel('compet')->id;
     $entree->statusentree_id = 1;
     $entree->teamname = "";
     $entree->hcp = 0;
     $entree->save();
     // Cree les EntreePlayers (en fonction du Compet->TypeCompet->nbplayers
     $nbPlayers = MySession::getModel('compet')->typecompet->nbplayers;
     for ($pl = 1; $pl <= $nbPlayers; $pl++) {
         $entreePlayer = new Entreeplayer();
         $entreePlayer->entree_id = $entree->id;
         if ($pl == 1) {
             $entreePlayer->player_id = $player->id;
             $entreePlayer->hcp = $player->hcp;
         }
         $entreePlayer->num = $pl;
         $entreePlayer->save();
         // get Categorie
         if ($pl == 1) {
             $entreePlayer->competcategorie_id = $entreePlayer->getCategorie();
             $entreePlayer->save();
         }
     }
     return Redirect::route($backUrl);
 }
function prep_page($template, $title = null, $local_vars = array(), $options = null)
{
    // Updates the quickstat via javascript if requested.
    $quickstat = @$options['quickstat'];
    $quickstat = $quickstat ? $quickstat : @$local_vars['quickstat'];
    $body_classes = isset($options['body_classes']) ? $options['body_classes'] : (isset($local_vars['body_classes']) ? $local_vars['body_classes'] : null);
    $is_index = @$options['is_index'];
    // *** Initialize the template object ***
    $tpl = new NWTemplate();
    $tpl->assignArray($local_vars);
    $user_id = self_char_id();
    // Character id.
    $player = Player::find($user_id);
    $public_char_info = $player ? $player->publicData() : [];
    // Char info to pass to javascript.
    $tpl->assign('logged_in', $user_id);
    $tpl->assign('user_id', $user_id);
    $tpl->assign('title', $title);
    $tpl->assign('quickstat', $quickstat);
    $tpl->assign('is_index', $is_index);
    $tpl->assign('json_public_char_info', $public_char_info ? json_encode($public_char_info) : null);
    $tpl->assign('body_classes', $body_classes);
    $tpl->assign('main_template', $template);
    return $tpl;
}
 public static function get_user_logged_in()
 {
     if (isset($_SESSION['user'])) {
         $user_id = $_SESSION['user'];
         $user = Player::find($user_id);
         return $user;
     }
     return null;
 }
 public static function findByTeam($team_id)
 {
     $query = DB::connection()->prepare('SELECT player_id FROM Teammember WHERE team_id = :team_id');
     $query->execute(array('team_id' => $team_id));
     $rows = $query->fetchAll();
     $Player = array();
     foreach ($rows as $row) {
         $Player[] = Player::find($row['player_id']);
     }
     return $Player;
 }
 public function place($backUrl = 'entree', $player_id, $id)
 {
     $entreePlayer = Entreeplayer::find($id);
     $player = Player::find($player_id);
     $entreePlayer->player_id = $player->id;
     $entreePlayer->hcp = $player->hcp;
     $entreePlayer->save();
     // get Categorie
     $entreePlayer->competcategorie_id = $entreePlayer->getCategorie();
     $entreePlayer->save();
     return Redirect::route($backUrl);
 }
 public static function CreatePlayer($server, $name)
 {
     // Try and find a player with this name on this server
     $server_id = mysql_real_escape_string($server->id);
     $name = mysql_real_escape_string($name);
     $player = Player::find("gameserver_id = '{$server_id}' AND players.name = '{$name}'");
     if (!$player) {
         $player = new Player();
     }
     $player->name = $name;
     $player->server = $server;
     $player->gameserver_id = $server->id;
     return $player;
 }
 public static function get_admin_logged_in()
 {
     // Katsotaan onko user-avain sessiossa
     if (isset($_SESSION['user'])) {
         $user_id = $_SESSION['user'];
         // Pyydetään User-mallilta käyttäjä session mukaisella id:llä
         $user = Player::find($user_id);
         if (Player::is_admin($user_id)) {
             return $user;
         }
         return null;
     }
     // Käyttäjä ei ole kirjautunut sisään
     return null;
 }
 public static function index()
 {
     $url = $_SERVER['REQUEST_URI'];
     $stripped_url = preg_replace("/[^A-Za-z0-9 ]/", '', $url);
     // Fetch page from cache
     $cached_page = Cache::getPage($stripped_url);
     if ($cached_page != null && Cache::on()) {
         // Use cached page (which is up to date because outdated pages are deleted)
         echo $cached_page;
     } else {
         // Make page from scratch
         $player = Player::find($_GET['player']);
         $game_count = Game::count_all_player_games($player->playerid);
         $latest_game = Game::latest_player_game($player->playerid);
         $high_scores = Game::player_high_scores($player->playerid);
         $years = Game::game_years();
         $popular_courses = Course::popular_courses($player->playerid);
         $throw_count = Score::count_all_player_scores($player->playerid);
         $birdies = Score::players_birdies($player->playerid);
         $aces = Score::players_aces($player->playerid);
         $courses_avg_scores = array();
         $names_done = false;
         foreach ($years as $year) {
             $avg_scores_by_year = Course::average_player_scoring_by_year($player->playerid, $year);
             for ($i = 0; $i < count($avg_scores_by_year); $i++) {
                 if (!$names_done) {
                     $averages = array();
                     $averages[] = $avg_scores_by_year[$i]['name'];
                     $courses_avg_scores[] = $averages;
                 }
                 if ($avg_scores_by_year[$i]['avg_score'] != null) {
                     $courses_avg_scores[$i][] = $avg_scores_by_year[$i]['avg_score'] . " (" . str_replace(" ", "", $avg_scores_by_year[$i]['to_par']) . ")";
                 } else {
                     $courses_avg_scores[$i][] = "";
                 }
             }
             $names_done = true;
         }
         $page_html = View::make('player/index.html', array('player' => $player, 'players' => Player::all(), 'game_count' => $game_count, 'throw_count' => $throw_count, 'latest_game' => $latest_game, 'high_scores' => $high_scores, 'popular_courses' => $popular_courses, 'birdies' => $birdies, 'aces' => $aces, 'years' => $years, 'courses_avg_scores' => $courses_avg_scores));
         if (Cache::on()) {
             Cache::store($stripped_url, $page_html);
         }
     }
 }
Exemple #10
0
 public function get_delete_player($playerId)
 {
     $player = Player::find($playerId);
     $response = array();
     if (!$player) {
         // no player exists
         $response['code'] = 404;
         $response['msg'] = 'This player does not exist.';
     } elseif ($player->delete()) {
         // success
         $response['code'] = 200;
         $response['msg'] = 'This player has been deleted.';
     } else {
         // fail
         $response['code'] = 500;
         $response['msg'] = 'This player could not be removed.';
     }
     return json_encode($response);
 }
Exemple #11
0
 public function findAction()
 {
     $ident = $this->getRequest()->getParam('ident');
     $view = $this->initView();
     $player_table = new Player();
     $rowset = $player_table->find($ident);
     if ($rowset) {
         $view->player = $rowset->current();
         $view->alias = $player_table->getAlias($view->player->player_ident);
         $view->races = $player_table->getRaces($view->player->player_ident);
         $view->upgrades = $player_table->getUpgrades($view->player->player_ident);
         //$race_table = new Races();
         //$paginator = Zend_Paginator::factory($race_table->selectPlayerRaces($ident));
         //$paginator->setItemCountPerPage(1);
         //$paginator->setCurrentPageNumber($this->_getParam('page'));
         //$paginator->setView($view);
         //$this->view->paginator = $paginator;
         //$this->render();
     } else {
         $view->error = 'Player # "' . $ident . ' was not found';
     }
     $this->render();
 }
 public function postEdit()
 {
     $rules = array('uid' => 'required|numeric|exists:players,uid', 'playerid' => 'required|numeric|exists:players,playerid', 'donatorlvl' => 'numeric|min:0|max:5', 'reason' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes() && Auth::user()->canEditPlayerAdmin(Input::get('playerid'))) {
         $player = Player::find(Input::get('uid'));
         $log = new Adminlog();
         $log->type = 'player';
         $log->editor = Auth::user()->id;
         $log->objectid = Input::get('uid');
         $log->reason = Input::get('reason');
         $log->difference = $log->getDifference(array('donatorlvl' => $player->donatorlvl, 'donatordate' => $player->donatordate, 'donatoramount' => $player->donatoramount, 'donatorduration' => $player->donatorduration), array('donatorlvl' => Input::get('donatorlvl'), 'donatordate' => Input::get('donatordate'), 'donatoramount' => Input::get('donatoramount') * 1, 'donatorduration' => Input::get('donatorduration')));
         $log->save();
         $player->donatorlvl = Input::get('donatorlvl');
         $player->donatordate = Input::get('donatordate');
         $player->donatoramount = Input::get('donatoramount') * 1;
         $player->donatorduration = Input::get('donatorduration');
         $player->save();
         return Redirect::to('/donators')->with(array('message' => 'Die Änderung wurde erfolgreich übernommen.', 'type' => 'success'));
     } else {
         return Redirect::to('/donators')->with(array('message' => 'Leider ist ein Fehler aufgetreten, die Änderung wurde verworfen.', 'type' => 'danger'));
     }
 }
Exemple #13
0
    private function showPlayers()
    {
        $players = Player::find('teamid = ? and name != ? and seasonid = ? order by number asc',
            [$this->team->teamid, '', $this->season->seasonid]);
        if (!$players) return;

        $playersByNumber = Model::indexBy($players, 'number');

        ?>
        <h2>Jugadores iniciales</h2>
        <? for ($y=0; $y*3 < $this->season->teamplayers; $y++) {
        ?><table>
        <thead>
        <tr>
            <?
            $colspan = 1;
            for ($x=0; $x<3; $x++) {
                if ($x != 2 && ($this->tiers[$y*3 + $x] == $this->tiers[$y*3 + $x + 1])) {
                    $colspan++;
                }
                else {
                    ?>
                    <td colspan="<?=$colspan?>">
                        <?= $this->tiers[$y*3 + $x] ?>
                    </td>
                    <?
                    $colspan = 1;
                }
            } ?>
        </tr>
        </thead><tr><?
            for ($x=0; $x<3; $x++) {
                $number = $y*3 + $x + 1;
                $player = $playersByNumber[$number];
                $playerLink = preg_replace("'\\-[0-9]$'", "", $player->name);
                $infoLink = "http://www.smogon.com/dex/xy/pokemon/{$playerLink}/";
                ?>
                <td>
                    <div style="width: 144px">
                        <? if ($player) { ?>
                            <div class="inblock middle" style="text-align: center">
                                <a href="<?=$infoLink?>" target="_blank" title="Ver en Smogon">
                                    <img src="/img/sprites/<?= $player->name ?>.png">
                                </a>
                            </div><br>
                            <a href="<?=$infoLink?>" target="_blank" title="Ver en Smogon">
                                <b><?= ucwords($player->name) ?></b>
                            </a>
                        <? } else { ?>
                            <div class="inblock middle" style="text-align: center">
                                <div style="width:100px; height:100px"
                            </div><br>
                        <? } ?>
                    </div>
                </td>
                <?
            }
            ?></tr></table>
        <div style="height: 6px"></div><?
    } ?>
        <?
    }
 public function postEdit()
 {
     $rules = array('uid' => 'required|numeric|exists:players,uid', 'playerid' => 'required|numeric|exists:players,playerid', 'cash' => 'numeric', 'bankacc' => 'numeric', 'coplevel' => 'numeric|min:0|max:11', 'mediclevel' => 'numeric|min:0|max:5', 'adaclevel' => 'numeric|min:0|max:5', 'adminlevel' => 'numeric|min:0|max:3', 'reason' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     $civ_licenses = array(array('license_civ_sec', 0), array('license_civ_donator', 0), array('license_civ_home', 0), array('license_civ_rebel', 0), array('license_civ_bm', 0), array('license_civ_gun', 0), array('license_civ_driver', 0), array('license_civ_truck', 0), array('license_civ_air', 0), array('license_civ_boat', 0), array('license_civ_dive', 0), array('license_civ_heroin', 0), array('license_civ_coke', 0), array('license_civ_marijuana', 0), array('license_civ_oil', 0), array('license_civ_diamond', 0), array('license_civ_copper', 0), array('license_civ_iron', 0), array('license_civ_sand', 0), array('license_civ_salt', 0), array('license_civ_cement', 0), array('license_civ_brauer', 0), array('license_civ_wein', 0), array('license_civ_zigaretten', 0), array('license_civ_zucker', 0), array('license_civ_whiskey', 0), array('license_civ_zigarren', 0), array('license_civ_rum', 0), array('license_civ_holz', 0), array('license_civ_schwefel', 0), array('license_civ_silber', 0), array('license_civ_zinn', 0), array('license_civ_gusseisen', 0), array('license_civ_bronze', 0), array('license_civ_schmuck', 0), array('license_civ_good', 0), array('license_civ_bus', 0), array('license_civ_taxi', 0), array('license_civ_hunting', 0));
     $cop_licenses = array(array('license_cop_air', 0), array('license_cop_sek', 0), array('license_cop_cg', 0));
     $med_licenses = array(array('license_med_air', 0), array('license_med_mohawk', 0));
     $adac_licenses = array(array('license_adac_car', 0), array('license_adac_air', 0));
     if ($validator->passes() && Auth::user()->canEditPlayerAdmin(Input::get('playerid'))) {
         foreach (Input::all() as $str_key => $value) {
             $subStr = substr($str_key, 0, 12);
             if ($subStr == 'license_civ_') {
                 foreach ($civ_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $civ_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
             if ($subStr == 'license_cop_') {
                 foreach ($cop_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $cop_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
             if ($subStr == 'license_med_') {
                 foreach ($med_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $med_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
             if ($subStr == 'license_adac') {
                 foreach ($adac_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $adac_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
         }
         $civ_licenses = Auth::user()->encodeDBArray($civ_licenses);
         $cop_licenses = Auth::user()->encodeDBArray($cop_licenses);
         $med_licenses = Auth::user()->encodeDBArray($med_licenses);
         $adac_licenses = Auth::user()->encodeDBArray($adac_licenses);
         $player = Player::find(Input::get('uid'));
         $log = new Adminlog();
         $log->type = 'player';
         $log->editor = Auth::user()->id;
         $log->objectid = Input::get('uid');
         $log->reason = Input::get('reason');
         $log->difference = $log->getDifference(array('cash' => $player->cash, 'bankacc' => $player->bankacc, 'coplevel' => $player->coplevel, 'mediclevel' => $player->mediclevel, 'adaclevel' => $player->adaclevel, 'civ_licenses' => $player->civ_licenses, 'cop_licenses' => $player->cop_licenses, 'med_licenses' => $player->med_licenses, 'adac_licenses' => $player->adac_licenses, 'adminlevel' => $player->adminlevel), array('cash' => Input::get('cash') * 1, 'bankacc' => Input::get('bankacc') * 1, 'coplevel' => Input::get('coplevel') * 1, 'mediclevel' => Input::get('mediclevel') * 1, 'adaclevel' => Input::get('adaclevel') * 1, 'civ_licenses' => $civ_licenses, 'cop_licenses' => $cop_licenses, 'med_licenses' => $med_licenses, 'adac_licenses' => $adac_licenses, 'adminlevel' => Input::get('adminlevel')));
         $log->save();
         $player->cash = Input::get('cash');
         $player->bankacc = Input::get('bankacc');
         $player->coplevel = Input::get('coplevel');
         $player->mediclevel = Input::get('mediclevel');
         $player->adaclevel = Input::get('adaclevel');
         $player->civ_licenses = $civ_licenses;
         $player->cop_licenses = $cop_licenses;
         $player->med_licenses = $med_licenses;
         $player->adac_licenses = $adac_licenses;
         $player->adminlevel = Input::get('adminlevel');
         $player->save();
         return Redirect::to('/players')->with(array('message' => 'Die Änderung wurde erfolgreich übernommen.', 'type' => 'success'));
     } elseif ($validator->passes() && Auth::user()->canEditPlayerMoney(Input::get('playerid'))) {
         foreach (Input::all() as $str_key => $value) {
             $subStr = substr($str_key, 0, 12);
             if ($subStr == 'license_civ_') {
                 foreach ($civ_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $civ_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
             if ($subStr == 'license_cop_') {
                 foreach ($cop_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $cop_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
             if ($subStr == 'license_med_') {
                 foreach ($med_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $med_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
             if ($subStr == 'license_adac') {
                 foreach ($adac_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $adac_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
         }
         $civ_licenses = Auth::user()->encodeDBArray($civ_licenses);
         $cop_licenses = Auth::user()->encodeDBArray($cop_licenses);
         $med_licenses = Auth::user()->encodeDBArray($med_licenses);
         $adac_licenses = Auth::user()->encodeDBArray($adac_licenses);
         $player = Player::find(Input::get('uid'));
         $log = new Adminlog();
         $log->type = 'player';
         $log->editor = Auth::user()->id;
         $log->objectid = Input::get('uid');
         $log->reason = Input::get('reason');
         $log->difference = $log->getDifference(array('cash' => $player->cash, 'bankacc' => $player->bankacc, 'coplevel' => $player->coplevel, 'mediclevel' => $player->mediclevel, 'adaclevel' => $player->adaclevel, 'civ_licenses' => $player->civ_licenses, 'cop_licenses' => $player->cop_licenses, 'med_licenses' => $player->med_licenses, 'adac_licenses' => $player->adac_licenses), array('cash' => Input::get('cash') * 1, 'bankacc' => Input::get('bankacc') * 1, 'coplevel' => Input::get('coplevel') * 1, 'mediclevel' => Input::get('mediclevel') * 1, 'adaclevel' => Input::get('adaclevel') * 1, 'civ_licenses' => $civ_licenses, 'cop_licenses' => $cop_licenses, 'med_licenses' => $med_licenses, 'adac_licenses' => $adac_licenses));
         $log->save();
         $player->cash = Input::get('cash');
         $player->bankacc = Input::get('bankacc');
         $player->coplevel = Input::get('coplevel');
         $player->mediclevel = Input::get('mediclevel');
         $player->adaclevel = Input::get('adaclevel');
         $player->civ_licenses = $civ_licenses;
         $player->cop_licenses = $cop_licenses;
         $player->med_licenses = $med_licenses;
         $player->adac_licenses = $adac_licenses;
         $player->save();
         return Redirect::to('/players')->with(array('message' => 'Die Änderung wurde erfolgreich übernommen.', 'type' => 'success'));
     } elseif ($validator->passes() && Auth::user()->canEditPlayerLicenses(Input::get('playerid'))) {
         foreach (Input::all() as $str_key => $value) {
             $subStr = substr($str_key, 0, 12);
             if ($subStr == 'license_civ_') {
                 foreach ($civ_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $civ_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
             if ($subStr == 'license_cop_') {
                 foreach ($cop_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $cop_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
             if ($subStr == 'license_med_') {
                 foreach ($med_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $med_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
             if ($subStr == 'license_adac_') {
                 foreach ($adac_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $adac_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
         }
         $civ_licenses = Auth::user()->encodeDBArray($civ_licenses);
         $cop_licenses = Auth::user()->encodeDBArray($cop_licenses);
         $med_licenses = Auth::user()->encodeDBArray($med_licenses);
         $adac_licenses = Auth::user()->encodeDBArray($adac_licenses);
         $player = Player::find(Input::get('uid'));
         $log = new Adminlog();
         $log->type = 'player';
         $log->editor = Auth::user()->id;
         $log->objectid = Input::get('uid');
         $log->reason = Input::get('reason');
         $log->difference = $log->getDifference(array('coplevel' => $player->coplevel, 'mediclevel' => $player->mediclevel, 'adaclevel' => $player->adaclevel, 'civ_licenses' => $player->civ_licenses, 'cop_licenses' => $player->cop_licenses, 'med_licenses' => $player->med_licenses, 'adac_licenses' => $player->adac_licenses), array('coplevel' => Input::get('coplevel') * 1, 'mediclevel' => Input::get('mediclevel') * 1, 'adaclevel' => Input::get('adaclevel') * 1, 'civ_licenses' => $civ_licenses, 'cop_licenses' => $cop_licenses, 'med_licenses' => $med_licenses, 'adac_licenses' => $adac_licenses));
         $log->save();
         $player->coplevel = Input::get('coplevel');
         $player->mediclevel = Input::get('mediclevel');
         $player->adaclevel = Input::get('adaclevel');
         $player->civ_licenses = $civ_licenses;
         $player->cop_licenses = $cop_licenses;
         $player->med_licenses = $med_licenses;
         $player->adac_licenses = $adac_licenses;
         $player->save();
         return Redirect::to('/players')->with(array('message' => 'Die Änderung wurde erfolgreich übernommen.', 'type' => 'success'));
     } elseif ($validator->passes() && Auth::user()->canEditPlayerLevel(Input::get('playerid'))) {
         $player = Player::find(Input::get('playerid'));
         $log = new Adminlog();
         $log->type = 'player';
         $log->editor = Auth::user()->id;
         $log->objectid = Input::get('uid');
         $log->reason = Input::get('reason');
         $log->difference = $log->getDifference(array('coplevel' => $player->coplevel, 'mediclevel' => $player->mediclevel, 'adaclevel' => $player->adaclevel), array('coplevel' => Input::get('coplevel') * 1, 'mediclevel' => Input::get('mediclevel') * 1, 'adaclevel' => Input::get('adaclevel') * 1));
         $log->save();
         $player->coplevel = Input::get('coplevel');
         $player->mediclevel = Input::get('mediclevel');
         $player->adaclevel = Input::get('adaclevel');
         $player->save();
         return Redirect::to('/players')->with(array('message' => 'Die Änderung wurde erfolgreich übernommen.', 'type' => 'success'));
     } else {
         return Redirect::to('/players')->with(array('message' => 'Leider ist ein Fehler aufgetreten, die Änderung wurde verworfen.', 'type' => 'danger'));
     }
 }
Exemple #15
0
{{ openContent('Eloquent') }}

    <?php 
$player = Player::find(1);
$competCategorie = Competcategorie::with('categorie')->leftJoin('categories', 'competcategories.categorie_id', '=', 'categories.id')->select('competcategories.id')->where('categories.sexe_id', '=', $player->sexe_id)->first();
dd($competCategorie->id);
?>

    <p>Count = {{ $players->count() }}</p>

    @foreach($players as $player)
        {{ $player->nom }} | {{ $player->club->nom }}
        <hr>
    @endforeach

{{ closeContent() }}
Exemple #16
0
 public static function games_players($gameid)
 {
     $sql = "SELECT DISTINCT playerid FROM score WHERE gameid = :gameid";
     $query = DB::connection()->prepare($sql);
     $query->execute(array('gameid' => $gameid));
     $rows = $query->fetchAll();
     $players = array();
     foreach ($rows as $row) {
         $players[] = Player::find($row['playerid']);
     }
     return $players;
 }
 public function doAnnouncement($id)
 {
     global $club, $messageData, $messageSubject, $team, $sms, $user, $recipientMobile, $recipientEmail;
     $user = Auth::user();
     $club = $user->Clubs()->FirstOrFail();
     $event = Evento::where("id", "=", $id)->where("club_id", '=', $club->id)->FirstOrFail();
     $participants = Participant::where('event_id', '=', $event->id)->get();
     $messageData = Input::get('message');
     $messageSubject = Input::get('subject');
     $sms = substr($messageData, 0, 140) . " {$club->name} - Do not reply";
     $uuid = Uuid::generate();
     //get list of recepients
     $recipientUser = array();
     $recipientPlayer = array();
     $recipientContact = array();
     $recipientEmail = array();
     $recipientMobile = array();
     //do selection for children events
     if ($event->children->count() > 0) {
         foreach ($event->children as $e) {
             foreach ($e->participants as $member) {
                 //only members that accepted joined
                 if ($member->accepted_user) {
                     $user = User::find($member->accepted_user);
                     $player = Player::find($member->player_id);
                     $recipientUser[] = array('name' => $user->profile->firstname . " " . $user->profile->lastname, 'email' => $user->email, 'mobile' => $user->profile->mobile);
                     foreach ($player->contacts as $contact) {
                         $recipientContact[] = array('name' => $contact->firstname . " " . $contact->lastname, 'email' => $contact->email, 'mobile' => $contact->mobile);
                     }
                     //allow players with email and mobile
                     if ($player->mobile && $player->email) {
                         $recipientPlayer[] = array('name' => $player->firstname . " " . $player->lastname, 'email' => $player->email, 'mobile' => $player->mobile);
                     }
                 }
             }
         }
     } else {
         foreach ($participants as $member) {
             //only members that accepted joined
             if ($member->accepted_user) {
                 $user = User::find($member->accepted_user);
                 $player = Player::find($member->player_id);
                 $recipientUser[] = array('name' => $user->profile->firstname . " " . $user->profile->lastname, 'email' => $user->email, 'mobile' => $user->profile->mobile);
                 foreach ($player->contacts as $contact) {
                     $recipientContact[] = array('name' => $contact->firstname . " " . $contact->lastname, 'email' => $contact->email, 'mobile' => $contact->mobile);
                 }
                 //allow players with email and mobile
                 if ($player->mobile && $player->email) {
                     $recipientPlayer[] = array('name' => $player->firstname . " " . $player->lastname, 'email' => $player->email, 'mobile' => $player->mobile);
                 }
             }
         }
     }
     //send default function
     function sendmessage($destination)
     {
         global $club, $messageData, $messageSubject, $event, $sms, $user, $recipientMobile, $recipientEmail;
         foreach ($destination as $recipient) {
             //send email notification of acceptance queue
             $data = array('club' => $club, 'messageOriginal' => $messageData, 'subject' => $messageSubject, 'team' => $event);
             Mail::later(3, 'emails.announcement.default', $data, function ($message) use($recipient, $club, $messageSubject) {
                 $message->to($recipient['email'], $recipient['name'])->subject("{$messageSubject} | " . $club->name);
             });
             $recipientEmail[] = array('name' => $recipient['name'], 'email' => $recipient['email']);
             if (Input::get('sms')) {
                 $recipientMobile[] = array('name' => $recipient['name'], 'mobile' => $recipient['mobile']);
                 //queue sms
                 Queue::push(function ($job) use($recipient, $sms) {
                     Twilio::message($recipient['mobile'], $sms);
                     $job->delete();
                 });
             }
         }
     }
     // send to user
     sendmessage($recipientUser);
     //send to player
     if (Input::get('players')) {
         sendmessage($recipientPlayer);
     }
     //send to contacts
     if (Input::get('family')) {
         sendmessage($recipientContact);
     }
     //save message to database
     $announcement = new Announcement();
     $announcement->id = $uuid;
     $announcement->subject = $messageSubject;
     $announcement->message = $messageData;
     $announcement->sms = $sms;
     $announcement->to_email = serialize($recipientEmail);
     $announcement->to_sms = serialize($recipientMobile);
     $announcement->event_id = $event->id;
     $announcement->club_id = $club->id;
     $announcement->user_id = $user->id;
     //$status = $announcement->save();
     return array('success' => true, 'email' => $recipientEmail, 'mobile' => $recipientMobile);
 }
 /**
  * Checks if round is ready to be saved. If not, displays round edit page with information already inputted. If yes, attempts to update selected round and related scores.
  *
  * @param int $id Id of selected round.
  */
 public static function update($id)
 {
     $player = self::get_user_logged_in();
     if (!$player) {
         View::make('player/login.html', array('error' => 'Vain kirjautuneet käyttäjät voivat muokata ratoja.'));
     }
     $params = $_POST;
     $players = Player::all();
     $course = Course::find($params['course']);
     $courses = Course::all();
     $played = $params['played'];
     $round = Round::find($id);
     $holes = Hole::find_by_course($course->id);
     $scores = Score::find_by_round($id);
     $numberOfPlayers = sizeof($scores);
     if ($params['course'] != $params['course_orig']) {
         // If course selection has changed we need to display edit page again with new information.
         $playerScores = array();
         $numberOfHoles = Hole::count_holes($params['course_orig']);
         for ($i = 1; $i <= $numberOfPlayers; $i++) {
             $holeScores = array();
             for ($j = 1; $j <= $numberOfHoles; $j++) {
                 $holeScores[] = $params['p' . $i . '_h' . $j];
             }
             $playerScores[] = array('player' => Player::find($params['player_' . $i]), 'holes' => $holeScores);
         }
         View::make('round/edit.html', array('numberOfPlayers' => $numberOfPlayers, 'players' => $players, 'course' => $course, 'holes' => $holes, 'courses' => $courses, 'playerScores' => $playerScores, 'round' => $round, 'scores' => $scores, 'played' => $played));
     } else {
         $attributes = array('courseId' => $params['course'], 'played' => $params['played']);
         $playerScores = array();
         $numberOfHoles = Hole::count_holes($params['course_orig']);
         $round = new Round(array_merge(array("id" => $round->id), $attributes));
         $errors = $round->errors();
         if (count($errors) == 0) {
             $round->update();
             for ($i = 1; $i <= $numberOfPlayers; $i++) {
                 $holeScores = array();
                 $scoreId = $params['score_' . $i];
                 for ($j = 1; $j <= $numberOfHoles; $j++) {
                     $hole = Hole::find_by_course_and_holenumber($params['course_orig'], $j);
                     $holeScores[] = array('throws' => $params['p' . $i . '_h' . $j], 'holeId' => $hole->id, 'holenumber' => $j);
                 }
                 $score = new Score(array('id' => $scoreId, 'playerId' => $params['player_' . $i], 'roundId' => $round->id, 'scores' => $holeScores));
                 $score->update();
             }
             Redirect::to('/round/' . $round->id, array('message' => 'Kierrosta muokattu.'));
         } else {
             View::make('round/new.html', array('errors' => $errors, 'attributes' => $attributes));
         }
     }
 }
Exemple #19
0
        }
    } elseif ($action == 'setnewpassword') {
        $newpassword = $_REQUEST['passor'];
        $code = $_REQUEST['code'];
        $character = $_REQUEST['character'];
        $main_content .= '';
        if (empty($code) || empty($character) || empty($newpassword)) {
            $main_content .= '<font color="red"><b>Error. Try again.</b></font><br />Please enter code from e-mail and name of one character from account. Then press Submit.<BR>
					<BR><FORM ACTION="?subtopic=lostaccount&action=checkcode" METHOD=post>
					<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
					<INPUT TYPE=image NAME="Back" ALT="Back" SRC="' . $layout_name . '/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></center>
					</TD></TR></FORM></TABLE></TABLE>';
        } else {
            $player = new Player();
            $account = new Account();
            $player->find($character);
            if ($player->isLoaded()) {
                $account = $player->getAccount();
            }
            if ($account->isLoaded()) {
                if ($account->getCustomField('email_code') == $code) {
                    if (check_password($newpassword)) {
                        $account->setPassword($newpassword);
                        $account->set('email_code', '');
                        $account->save();
                        $main_content .= 'New password to your account is below. Now you can login.<BR>
						<INPUT TYPE="hidden" NAME="character" VALUE="' . htmlspecialchars($character) . '">
						<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
						<TR><TD BGCOLOR="' . $config['site']['vdarkborder'] . '" CLASS=white><B>Changed password</B></TD></TR>
						<TR><TD BGCOLOR="' . $config['site']['darkborder'] . '">
						New password:&nbsp;<b>' . htmlspecialchars($newpassword) . '</b><BR />
 }
 if (empty($newchar_errors)) {
     $check_name_in_database = new Player();
     $check_name_in_database->find($newchar_name);
     if ($check_name_in_database->isLoaded()) {
         $newchar_errors[] .= 'This name is already used. Please choose another name!';
     }
     $number_of_players_on_account = $account_logged->getPlayersList()->count();
     if ($number_of_players_on_account >= $config['site']['max_players_per_account']) {
         $newchar_errors[] .= 'You have too many characters on your account <b>(' . $number_of_players_on_account . '/' . $config['site']['max_players_per_account'] . ')</b>!';
     }
 }
 if (empty($newchar_errors)) {
     $char_to_copy_name = $config['site']['newchar_vocations'][$world_id][$newchar_vocation];
     $char_to_copy = new Player();
     $char_to_copy->find($char_to_copy_name);
     if (!$char_to_copy->isLoaded()) {
         $newchar_errors[] .= 'Wrong characters configuration. Try again or contact with admin. ADMIN: Edit file config/config.php and set valid characters to copy names. Character to copy <b>' . htmlspecialchars($char_to_copy_name) . '</b> doesn\'t exist.';
     }
 }
 if (empty($newchar_errors)) {
     // load items and skills of player before we change ID
     $char_to_copy->getItems()->load();
     $char_to_copy->loadSkills();
     if ($newchar_sex == "0") {
         $char_to_copy->setLookType(136);
     }
     $char_to_copy->setID(null);
     // save as new character
     $char_to_copy->setLastIP(0);
     $char_to_copy->setLastLogin(0);
Exemple #21
0
 /**
  * Get all brackets a player id has played in.
  *
  * @return Bracket
  **/
 public static function playedIn($pid, $limit = false, $offset = false)
 {
     $r = Player::find($pid)->brackets;
     return $r;
 }
        $logs = DB::table('logs')->where('type', $where)->orderBy('created_at', 'desc')->get();
    } else {
        $logs = DB::table('logs')->orderBy('created_at', 'desc')->paginate(100);
    }
    foreach ($logs as $key => $log) {
        $logs[$key]->editor_name = User::find($log->editor)->username;
        $logs[$key]->difference = unserialize($log->difference);
        $logs[$key]->differences = array();
        foreach ($logs[$key]->difference as $differencekey => $difference) {
            $logs[$key]->differences[] = array($differencekey, $difference[0], $difference[1]);
        }
        $log->search_letter = strtolower(substr($log->type, 0, 1));
        switch ($log->type) {
            case 'player':
                $logs[$key]->type = 'Spieler';
                $logs[$key]->object_name = Player::find($log->objectid)['name'];
                break;
            case 'gang':
                $logs[$key]->type = 'Gang';
                $logs[$key]->object_name = Gang::find($log->objectid)['name'];
                break;
            case 'vehicle':
                $logs[$key]->type = 'Fahrzeug';
                $logs[$key]->object_name = Vehicle::find($log->objectid)['classname'];
                break;
        }
    }
    return View::make('main', array('level_label' => $level_label, 'counter' => $counter))->nest('content', 'logs', array('level_label' => $level_label, 'logs' => $logs, 'search' => $search, 'type' => $type));
}));
Route::get('/statistics', array('before' => 'auth', function () use($level_label, $counter) {
    $statistics = DB::table('statistics')->orderBy('timestamp', 'asc')->get();
Exemple #23
0
        }
    } else {
        $main_content .= "You are not logged in.";
    }
    $main_content .= "<center><h3><a href=\"?subtopic=guilds\">BACK</a></h3></center>";
}
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
if ($action == 'change_nick') {
    if ($logged) {
        $player_n = $_REQUEST['name'];
        $new_nick = $_REQUEST['nick'];
        $player = new Player();
        $player->find($player_n);
        $player_from_account = FALSE;
        if (strlen($new_nick) <= 30) {
            if ($player->isLoaded()) {
                $account_players = $account_logged->getPlayersList();
                if (count($account_players)) {
                    foreach ($account_players as $acc_player) {
                        if ($acc_player->getId() == $player->getId()) {
                            $player_from_account = TRUE;
                        }
                    }
                    if ($player_from_account) {
                        $player->setGuildNick($new_nick);
                        $player->save();
                        $main_content .= 'Guild nick of player <b>' . htmlspecialchars($player->getName()) . '</b> changed to <b>' . htmlspecialchars($new_nick) . '</b>.';
                        $addtolink = '&action=show&guild=' . $player->getRank()->getGuildId();
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $startDate = Carbon::now();
     $from = Carbon::now()->hour(0)->minute(0)->second(0);
     $to = Carbon::now()->hour(23)->minute(59)->second(59);
     $schedules = SchedulePayment::where('status', 0)->whereBetween('date', array($from, $to))->with('member.user.profile')->get();
     //$schedules = SchedulePayment::where('status', 0)->with('member.user.profile')->get();
     $errors = array();
     $totalAmount = array();
     $errorAmount = array();
     //save daylog
     $dayLog = new ScheduleDailyLog();
     $dayLog->started_on = Carbon::now()->toDateTimeString();
     $dayLog->payments_count = count($schedules);
     $dayLog->save();
     Cart::destroy();
     foreach ($schedules as $schedule) {
         try {
             $vault = $schedule->member->user->profile->customer_vault;
             $user = User::find($schedule->member->user->id);
             $player = Player::find($schedule->member->player->id);
             $club = Club::find($schedule->club_id);
             $team = Team::find($schedule->member->team_id);
             $uuid = Uuid::generate();
             $member = Member::find($schedule->member->id);
             $history = SchedulePayment::find($schedule->id);
             //manually login user out before login new user
             Auth::logout();
             //manually login user
             Auth::login($user);
             //clear cart content
             Cart::destroy();
             //set cart item
             $itemCart = array('id' => $team->id, 'name' => "Scheduled payment for " . $team->name, 'price' => $schedule->subtotal, 'quantity' => 1, 'organization' => $club->name, 'organization_id' => $club->id, 'player_id' => $player->id, 'user_id' => $user->id, 'type' => 'full', 'autopay' => true);
             Cart::insert($itemCart);
             //check if vault exist
             if ($vault) {
                 $param = array('customer_vault_id' => $vault, 'discount' => null, 'club' => $club->id);
                 $payment = new Payment();
                 $transaction = $payment->sale($param);
                 //temp json_decode(json_encode($array), FALSE);
                 //$transaction = json_decode(json_encode(array('response' => 1, 'total'=>$schedule->total, 'fee'=>$schedule->fee)), FALSE);
                 if ($transaction->response == 3 || $transaction->response == 2) {
                     $errors[] = array('payment_schedule_id' => $schedule->id, 'error_description' => $transaction->transactionid . ' : ' . $transaction->responsetext, 'error_amount' => $schedule->total, 'daily_log_id' => $dayLog->id);
                     array_push($errorAmount, number_format($schedule->total, 2));
                     //Email error
                     $emailerrorstatus = $payment->error($transaction, $club->id, $player->id);
                 } else {
                     array_push($totalAmount, number_format($transaction->total, 2));
                     $payment->id = $uuid;
                     $payment->customer = $vault;
                     $payment->transaction = $transaction->transactionid;
                     $payment->subtotal = $transaction->subtotal;
                     $payment->service_fee = $transaction->fee;
                     $payment->total = $transaction->total;
                     $payment->promo = $transaction->promo;
                     $payment->tax = $transaction->tax;
                     $payment->discount = $transaction->discount;
                     $payment->club_id = $club->id;
                     $payment->user_id = $user->id;
                     $payment->player_id = $player->id;
                     $payment->event_type = null;
                     $payment->type = $transaction->type;
                     $payment->save();
                     //Email receipt
                     $payment->receipt($transaction, $club->id, $player->id);
                     $sale = new Item();
                     $sale->description = $itemCart['name'];
                     $sale->quantity = $itemCart['quantity'];
                     $sale->price = $itemCart['price'];
                     $sale->fee = $transaction->fee;
                     $sale->member_id = $member->id;
                     $sale->team_id = $team->id;
                     $sale->payment_id = $uuid;
                     $sale->save();
                     //update schedule
                     $history->status = 2;
                     $history->save();
                 }
             } else {
                 //save error that vault didnt exist
                 $errors[] = array('payment_schedule_id' => $schedule->id, 'error_description' => 'Customer Vault not found', 'error_amount' => number_format($schedule->total, 2), 'daily_log_id' => $dayLog->id);
                 array_push($errorAmount, number_format($schedule->total, 2));
             }
         } catch (Exception $e) {
             //save internal error
             $errors[] = array('payment_schedule_id' => $schedule->id, 'error_description' => $e, 'error_amount' => number_format($schedule->total, 2), 'daily_log_id' => $dayLog->id);
             array_push($errorAmount, number_format($schedule->total, 2));
         }
     }
     //end of foreach schedule
     //save log for everything done
     $dayLogEnd = ScheduleDailyLog::find($dayLog->id);
     $dayLogEnd->ended_on = Carbon::now()->toDateTimeString();
     $dayLogEnd->successful_count = Count($totalAmount);
     $dayLogEnd->error_count = Count($errors);
     $dayLogEnd->total_amount = array_sum($totalAmount);
     $dayLogEnd->total_amount_error = array_sum($errorAmount);
     $dayLogEnd->save();
     //save log for errors
     if (Count($errors) > 0) {
         foreach ($errors as $errorItem) {
             $scheduleError = new ScheduleDailyError();
             $scheduleError->error_description = $errorItem['error_description'];
             $scheduleError->error_amount = $errorItem['error_amount'];
             $scheduleError->payment_schedule_id = $errorItem['payment_schedule_id'];
             $scheduleError->daily_log_id = $dayLogEnd->id;
             $scheduleError->save();
         }
     }
     return Log::info($errors);
 }
Exemple #25
0
            $buy_from = trim($_POST['buy_from']);
            if (empty($buy_from)) {
                $buy_from = 'Anonymous';
            }
            if (empty($buy_id)) {
                $errormessage .= 'Please <a href="?subtopic=shopsystem">select item</a> first.';
            } else {
                if (!check_name($buy_from)) {
                    $errormessage .= 'Invalid nick ("from player") format. Please <a href="?subtopic=shopsystem&action=select_player&buy_id=' . $buy_id . '">select other name</a> or contact with administrator.';
                } else {
                    $buy_offer = getItemByID($buy_id);
                    if (isset($buy_offer['id'])) {
                        if ($user_premium_points >= $buy_offer['points']) {
                            if (check_name($buy_name)) {
                                $buy_player = new Player();
                                $buy_player->find($buy_name);
                                if ($buy_player->isLoaded()) {
                                    $buy_player_account = $buy_player->getAccount();
                                    if ($_SESSION['viewed_confirmation_page'] == 'yes' && $_POST['buy_confirmed'] == 'yes') {
                                        if ($buy_offer['type'] == 'item') {
                                            $sql = 'INSERT INTO ' . $SQL->tableName('z_ots_comunication') . ' (' . $SQL->fieldName('id') . ',' . $SQL->fieldName('name') . ',' . $SQL->fieldName('type') . ',' . $SQL->fieldName('action') . ',' . $SQL->fieldName('param1') . ',' . $SQL->fieldName('param2') . ',' . $SQL->fieldName('param3') . ',' . $SQL->fieldName('param4') . ',' . $SQL->fieldName('param5') . ',' . $SQL->fieldName('param6') . ',' . $SQL->fieldName('param7') . ',' . $SQL->fieldName('delete_it') . ') VALUES (NULL, ' . $SQL->quote($buy_player->getName()) . ', ' . $SQL->quote('login') . ', ' . $SQL->quote('give_item') . ', ' . $SQL->quote($buy_offer['item_id']) . ', ' . $SQL->quote($buy_offer['item_count']) . ', ' . $SQL->quote('') . ', ' . $SQL->quote('') . ', ' . $SQL->quote('item') . ', ' . $SQL->quote($buy_offer['name']) . ', ' . $SQL->quote($buy_offer['id']) . ', ' . $SQL->quote(1) . ');';
                                            $SQL->query($sql);
                                            $save_transaction = 'INSERT INTO ' . $SQL->tableName('z_shop_history_item') . ' (' . $SQL->fieldName('id') . ',' . $SQL->fieldName('to_name') . ',' . $SQL->fieldName('to_account') . ',' . $SQL->fieldName('from_nick') . ',' . $SQL->fieldName('from_account') . ',' . $SQL->fieldName('price') . ',' . $SQL->fieldName('offer_id') . ',' . $SQL->fieldName('trans_state') . ',' . $SQL->fieldName('trans_start') . ',' . $SQL->fieldName('trans_real') . ') VALUES (' . $SQL->lastInsertId() . ', ' . $SQL->quote($buy_player->getName()) . ', ' . $SQL->quote($buy_player_account->getId()) . ', ' . $SQL->quote($buy_from) . ',  ' . $SQL->quote($account_logged->getId()) . ', ' . $SQL->quote($buy_offer['points']) . ', ' . $SQL->quote($buy_offer['name']) . ', ' . $SQL->quote('wait') . ', ' . $SQL->quote(time()) . ', ' . $SQL->quote(0) . ');';
                                            $SQL->query($save_transaction);
                                            $account_logged->setCustomField('premium_points', $user_premium_points - $buy_offer['points']);
                                            $user_premium_points = $user_premium_points - $buy_offer['points'];
                                            $main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="' . $config['site']['vdarkborder'] . '" ALIGN=left CLASS=white><B>Item added!</B></TD></TR>
<TR><TD BGCOLOR="' . $config['site']['lightborder'] . '" ALIGN=left><b>' . htmlspecialchars($buy_offer['name']) . '</b> added to player <b>' . htmlspecialchars($buy_player->getName()) . '</b> items (he will get this items after relog) for <b>' . $buy_offer['points'] . ' premium points</b> from your account.<br />Now you have <b>' . $user_premium_points . ' premium points</b>.<br /><a href="?subtopic=shopsystem">GO TO MAIN SHOP SITE</a></TD></TR>
</table>';
                                        } elseif ($buy_offer['type'] == 'mount') {
 public function error($param, $id, $playerid)
 {
     setlocale(LC_MONETARY, "en_US");
     $club = Club::Find($id);
     $user = Auth::user();
     $player = Player::find($playerid);
     $query = array('report_type' => 'customer_vault', 'customer_vault_id' => $user->profile->customer_vault, 'club' => $club->id);
     $payment = new Payment();
     $vault = json_decode(json_encode($payment->ask($query)), false);
     //convert object to array
     $dt = json_decode(json_encode($param), false);
     //clean duplicates from array
     //$club = array_unique($club);
     //cart content
     $items = Cart::contents();
     $data = array('data' => $dt, 'vault' => $vault, 'products' => $items, 'club' => $club, 'player' => $player);
     $mail = Mail::send('emails.receipt.error', $data, function ($message) use($user, $club) {
         $message->to($user->email, $user->profile->firstname . ' ' . $user->profile->lastname)->subject("Payment Declined | {$club->name}");
         foreach ($club->users()->get() as $value) {
             $message->bcc($value->email, $club->name)->subject("Payment Declined - {$club->name}");
         }
     });
     return $mail;
 }
Exemple #27
0
     }
     echo '</select><br />';
     echo '<b>New name: </b><input type="text" name="new_name" value="" /><br />';
     echo '<input type="submit" value="Change name" />';
     echo '</form>';
 } elseif ($action == "change") {
     $newchar_errors = array();
     $newchar_name = ucwords(strtolower(trim($_REQUEST['new_name'])));
     if (empty($newchar_name)) {
         $newchar_errors[] = 'Please enter a new name for your character!';
     }
     if (!check_name_new_char($newchar_name)) {
         $newchar_errors[] = 'This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.';
     }
     $check_name_in_database = new Player();
     $check_name_in_database->find($newchar_name);
     if ($check_name_in_database->isLoaded()) {
         $newchar_errors[] = 'This name is already used. Please choose another name!';
     }
     $charToEdit = new Player($_REQUEST['player_id']);
     if (!$charToEdit->isLoaded()) {
         $newchar_errors[] = 'This player does not exist.';
     }
     if ($charToEdit->isOnline()) {
         $newchar_errors[] = 'This player is ONLINE. Logout first.';
     } elseif ($account_logged->getID() != $charToEdit->getAccountID()) {
         $newchar_errors[] = 'This player is not on your account.';
     }
     if (empty($newchar_errors)) {
         echo 'Name of character <b>' . htmlspecialchars($charToEdit->getName()) . '</b> changed to <b>' . htmlspecialchars($newchar_name) . '</b>';
         $charToEdit->setName($newchar_name);
 public function delete($id)
 {
     $player = Player::find($id);
     $user = Auth::user();
     $title = 'League Together - Player';
     return View::make('app.account.player.delete')->with('page_title', $title)->with('player', $player)->withUser($user);
 }
Exemple #29
0
 private function load_player()
 {
     $this->player = Player::find($this->playerid);
 }
<?php

if (!defined('INITIALIZED')) {
    exit;
}
$name = '';
if (isset($_REQUEST['name'])) {
    $name = (string) $_REQUEST['name'];
}
if (!empty($name)) {
    $player = new Player();
    $player->find($name);
    if ($player->isLoaded()) {
        $number_of_rows = 0;
        $account = $player->getAccount();
        $skull = '';
        if ($player->getSkull() == 4) {
            $skull = "<img style='border: 0;' src='./images/skulls/redskull.gif'/>";
        } else {
            if ($player->getSkull() == 5) {
                $skull = "<img style='border: 0;' src='./images/skulls/blackskull.gif'/>";
            }
        }
        $main_content .= '<table border="0" cellspacing="1" cellpadding="4" width="100%"><tr bgcolor="' . $config['site']['vdarkborder'] . '"><td colspan="2" style="font-weight:bold;color:white">Character Information</td></tr>';
        $bgcolor = $number_of_rows++ % 2 == 1 ? $config['site']['darkborder'] : $config['site']['lightborder'];
        $main_content .= '<tr bgcolor="' . $bgcolor . '"><td width="20%">Name:</td><td style="font-weight:bold;color:' . ($player->isOnline() ? 'green' : 'red') . '">' . htmlspecialchars($player->getName()) . ' ' . $skull . ' <img src="' . $config['site']['flag_images_url'] . $account->getFlag() . $config['site']['flag_images_extension'] . '" title="Country: ' . $account->getFlag() . '" alt="' . $account->getFlag() . '" />';
        if ($player->isBanned() || $account->isBanned()) {
            $main_content .= '<span style="color:red">[BANNED]</span>';
        }
        if ($player->isNamelocked()) {
            $main_content .= '<span style="color:red">[NAMELOCKED]</span>';