当前位置: 首页>>代码示例>>PHP>>正文


PHP Neuron_Core_Tools::checkInput方法代码示例

本文整理汇总了PHP中Neuron_Core_Tools::checkInput方法的典型用法代码示例。如果您正苦于以下问题:PHP Neuron_Core_Tools::checkInput方法的具体用法?PHP Neuron_Core_Tools::checkInput怎么用?PHP Neuron_Core_Tools::checkInput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Neuron_Core_Tools的用法示例。


在下文中一共展示了Neuron_Core_Tools::checkInput方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInput

 public static function getInput($dat, $key, $type, $default = false)
 {
     global ${$dat};
     $dat = ${$dat};
     if (!isset($dat[$key])) {
         return $default;
     } else {
         // Check if the value has the right type
         if (Neuron_Core_Tools::checkInput($dat[$key], $type)) {
             return $dat[$key];
         } else {
             return $default;
         }
     }
 }
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:15,代码来源:Tools.php

示例2: processInput

 public function processInput()
 {
     $_SESSION['clan_overview_lastrefresh'] = null;
     $login = Neuron_Core_Login::__getInstance();
     $data = $this->getRequestData();
     $input = $this->getInputData();
     if (isset($data['id']) && $data['id'] > 0) {
         $clan = new Dolumar_Players_Clan($data['id']);
         if ($clan) {
             if (!isset($input['action'])) {
                 $input['action'] = 'overview';
             }
             switch ($input['action']) {
                 case 'join':
                     $this->updateContent($this->getJoinClan($clan));
                     break;
                 case 'government':
                     $this->updateContent($this->getGovernment($clan));
                     break;
                 case 'leave':
                     $this->updateContent($this->getLeaveClan($clan));
                     break;
                 case 'overview':
                 default:
                     $this->updateContent($this->getOverview($clan));
                     break;
             }
         }
     } elseif ($login->isLogin()) {
         $profile = Neuron_GameServer::getPlayer();
         $clans = $profile->getClans();
         if (count($clans) == 0 && isset($input['clanname'])) {
             if (Neuron_Core_Tools::checkInput($input['clanname'], 'unitname')) {
                 if ($this->makeClan($input['clanname'])) {
                     $this->updateContent();
                 } else {
                     $this->updateContent($this->getNoClan($profile, $this->getError()));
                 }
             } else {
                 $this->updateContent($this->getNoClan($profile, 'err_clanname'));
             }
         }
     }
 }
开发者ID:Toxicat,项目名称:dolumar,代码行数:44,代码来源:Clan.php

示例3: getAddSquad

 private function getAddSquad()
 {
     $input = $this->getInputData();
     if (isset($input['squadName']) && Neuron_Core_Tools::checkInput($input['squadName'], 'unitname') && isset($input['squadUnit'])) {
         // Check if unit type exists
         $unit = Dolumar_Units_Unit::getUnitFromId($input['squadUnit'], $this->village->getRace(), $this->village);
         if ($unit) {
             // Add the squad
             $objSquad = $this->village->addSquad($input['squadName'], $input['squadUnit']);
             if ($objSquad) {
                 return $this->getAddUnits($objSquad);
             } else {
                 return $this->getOverview();
             }
         } else {
             $this->alert('Invalid unit type: ' . $input['squadUnit']);
         }
     } else {
         $text = Neuron_Core_Text::__getInstance();
         $text->setFile('squads');
         $text->setSection('addSquad');
         $page = new Neuron_Core_Template();
         if (isset($input['squadName'])) {
             $page->set('warning', $text->get('squadNameSyntax'));
         }
         $page->set('title', $text->get('title'));
         $page->set('name', $text->get('name'));
         $page->set('submit', $text->get('submit'));
         $page->set('toReturn', $text->getClickTo($text->get('toReturn')));
         // Load all units
         $units = $this->village->getMyUnits();
         foreach ($units as $unit) {
             if ($unit->getSquadlessAmount() > 0) {
                 $page->addListValue('units', array('name' => $unit->getName(), 'id' => $unit->getUnitId()));
             }
         }
         return $page->parse('squads/add.tpl');
     }
 }
开发者ID:Toxicat,项目名称:dolumar,代码行数:39,代码来源:Squads.php

示例4: setName

 public function setName($name)
 {
     $this->loadData();
     if (Neuron_Core_Tools::checkInput($name, 'village')) {
         if ($this->isFound()) {
             // Check if this name exists
             $db = Neuron_Core_Database::__getInstance();
             $found = $db->select('villages', array('vid'), "vname = '{$db->escape($name)}' AND vid != {$this->getId()}");
             if (count($found) == 0) {
                 $db->update('villages', array('vname' => $name), "vid = '" . $this->id . "'");
                 $this->data['vname'] = $name;
                 return true;
             } else {
                 $this->error = 'village_name_duplicate';
                 return false;
             }
         } else {
             $this->error = 'village_not_found';
             return false;
         }
     } else {
         $this->error = 'invalid_village_syntax';
         return false;
     }
 }
开发者ID:Toxicat,项目名称:dolumar,代码行数:25,代码来源:Village.php

示例5: changeNickname

 public function changeNickname($nickname)
 {
     $db = Neuron_Core_Database::__getInstance();
     $this->loadData();
     if (!empty($this->data['nickname'])) {
         if (Neuron_Core_Tools::checkInput($nickname, 'username')) {
             $data = Neuron_GameServer_Mappers_PlayerMapper::getFromNickname($nickname);
             if (!isset($data)) {
                 Neuron_GameServer_Mappers_PlayerMapper::setNickname($this, $nickname);
                 if ($chk == 1) {
                     $this->data['nickname'] = $nickname;
                     return true;
                 } else {
                     $this->error = 'update_failed';
                     return false;
                 }
             } else {
                 $this->error = 'user_found';
                 return false;
             }
         } else {
             $this->error = 'error_username';
             return false;
         }
     } else {
         $this->error = 'nickname_not_set';
     }
 }
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:28,代码来源:Player.php

示例6: processRegistration

 private function processRegistration($username, $email, $password, $password2)
 {
     $db = Neuron_Core_Database::__getInstance();
     $login = Neuron_Core_Login::__getInstance();
     $text = Neuron_Core_Text::__getInstance();
     $text->setFile('account');
     $text->setSection('register');
     // Check input
     if (!Neuron_Core_Tools::checkInput($username, 'username')) {
         $this->updateContent($this->showRegisterForm('usernameFormat'));
     } elseif (!Neuron_Core_Tools::checkInput($password, 'password')) {
         $this->updateContent($this->showRegisterForm('passwordFormat'));
     } elseif (!Neuron_Core_Tools::checkInput($email, 'email')) {
         $this->updateContent($this->showRegisterForm('emailFormat'));
     } elseif ($password != $password2) {
         $this->updateContent($this->showRegisterForm('passwordMismatch'));
     } else {
         // Next step: checking username and stuff
         $userCheck = $db->select('n_players', array('plid'), "nickname = '{$username}' AND isRemoved = 0");
         $mailCheck = $db->select('n_players', array('plid'), "email = '{$email}' AND isRemoved = 0");
         if (count($userCheck) > 0) {
             $this->updateContent($this->showRegisterForm('userFound'));
         } elseif (count($mailCheck) > 0) {
             $this->updateContent($this->showRegisterForm('emailFound'));
         } else {
             /*
             	Check for referrer.
             */
             $referrer = intval(Neuron_Core_Tools::getInput('_COOKIE', 'preferrer', 'int'));
             $user = Neuron_GameServer::getPlayer($referrer);
             $ref_id = $user ? $user->getId() : null;
             // Create the account
             $id = $login->registerAccount($username, $email, $password, $ref_id);
             $user = Neuron_GameServer::getPlayer($id);
             /*
             if (!$isInfinite)
             {
             	// Withdraw 1 invitation
             	$db->update
             	(
             		'invitation_codes',
             		array
             		(
             			'invLeft' => '--'
             		),
             		"invCode = '$invitation'"
             	);
             }
             else
             {
             	// Add 1 invitation
             	$db->update
             	(
             		'invitation_codes',
             		array
             		(
             			'invLeft' => '++'
             		),
             		"invCode = '$invitation'"
             	);
             }
             */
             // Show "finished" page
             $page = new Neuron_Core_Template();
             $page->set('done', $text->get('done'));
             $page->set('login', $text->get('login'));
             $page->set('tracker_url', htmlentities($user->getTrackerUrl('registration')));
             $this->updateContent($page->parse('register/register_done.tpl'));
         }
     }
 }
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:71,代码来源:Register.php


注:本文中的Neuron_Core_Tools::checkInput方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。