/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('banner', function (Blueprint $table) { Schema: drop('banner'); }); }
/** * 生成用于登陆的Cookie * @param $uid 要生成的Cookie的协会编号 * */ function log_in($uid) { //要创建的数据 $data = array(); $data['uid'] = $uid; $data['date'] = true; $data['token'] = true; //检查是否token表中是否有此用户,没有则inset,有则updata $is_inset = false; $mo = new TokenModel(); $mo->where(array('uid' => $uid)); if (empty($mo->find())) { $is_inset = true; } else { $is_inset = false; } //更新token $mo->field('uid,date,token'); $mo->create($data) or drop($mo->getError()); //更新token,如果不存在则生成一条新记录 if ($is_inset) { $mo->add() or drop(CE_3531 . $mo->getError()); } else { $mo->save() or drop(CE_3532 . $mo->getError()); } //获取生成的token $data['token'] = $mo->getToken(); //生成Cookie cookie('uid', $data['uid']); cookie('token', $data['token']); }
/** * 入口函数。此函数会被自动调用 * */ public function run() { //检查验证码 if (!(APP_DEBUG && C('Not_VerifyCode'))) { check_verify(I('post.verifycode')) or drop(EC_4841); } //校验登陆信息 test_token() or drop(EC_4842); //校验是否需要登记信息 get_state() == '100' or drop(EC_4843); //获取uid $_POST['uid'] = cookie('uid'); //尝试创建数据对象 //user_inf表 $uiMo = new UserInfModel(); $uiMo->create(I('post.'), Model::MODEL_INSERT) or drop($uiMo->getError()); //users表 $uMo = new UsersModel(); $uMo->field('uid,state'); $uMo->create(array('uid' => $_POST['uid'], 'state' => 200), Model::MODEL_UPDATE) or drop($uMo->getError()); //注册信息 $uiMo->add() or drop(EC_4861); $uMo->save() or drop(EC_4862); //End 注册信息 drop(true); }
/** * 入口函数。此函数会被自动调用 * */ public function run() { //检查验证码 if (!(APP_DEBUG && C('Not_VerifyCode'))) { check_verify(I('post.verifycode')) or drop(EC_4741); } //尝试创建数据对象 //users表 $usersMo = new UsersModel(); $usersMo->field('qq,password'); $usersMo->create(I('post.'), Model::MODEL_INSERT) or drop($usersMo->getError()); //invite_code表 $icMo = new InviteCodeModel(); $icMo->field('uid,invite_code'); $icMo->create(array('invite_code' => I('post.invite_code'), 'uid' => $usersMo->getUid()), Model::MODEL_INSERT) or drop($icMo->getError()); //数据检查 if (I('post.password') != I('post.re_password')) { drop(EC_4742); } $this->checkInviteCode_0(I('post.invite_code')) or drop(EC_4751); $this->checkInviteCode_1(I('post.invite_code')) or drop(EC_4752); //注册信息 $usersMo->add() or drop(EC_4761); $icMo->save() or drop(EC_4762); //生成登陆信息 log_in($usersMo->getUid()); //返回成功信息 echo drop('1200,' . $usersMo->getUid(), true); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('solutions', function (Blueprint $table) { $table->dropForeign('solutions_result_foreign'); $table->dropColumn('result'); }); drop('solution_results'); }
protected function createUid() { if (empty(C('WEB_BATCH'))) { drop(EC_5661); } $this->uid = C('WEB_BATCH') . mt_rand(0, 9) . mt_rand(0, 9) . mt_rand(0, 9); return $this->uid; }
function deleteat() { $args = func_get_args(); $deleteat = function ($n, array $xs) { if ($n > 0) { return array_merge(take($n, $xs), drop($n + 1, $xs)); } return $xs; }; return call_user_func_array(partial($deleteat), $args); }
/** * 入口函数。此函数会被自动调用 * */ public function run() { //检查验证码 if (!(APP_DEBUG && C('Not_VerifyCode'))) { check_verify(I('post.verifycode')) or drop(EC_4541); } //检查字段值 preg_match(RegExp_username, I('post.username')) or drop(EC_4531); //检查用户名是否存在 $this->checkUsername(I('post.username')) or drop(EC_4551); //检查密码是否正确 $this->checkPassword(I('post.password')) or drop(EC_4552); //生成登陆信息 log_in($this->uid); //返回成功 drop(true); }
/** * 入口函数。此函数会被自动调用 * */ public function run() { //检查验证码 if (!(APP_DEBUG && C('Not_VerifyCode'))) { check_verify(I('post.verifycode')) or drop(EC_4341); } //校验登陆信息 test_token() or drop(EC_4342); //尝试创建数据对象 $mo = new UsersModel(); $mo->field('uid,password'); $mo->create(array('uid' => cookie('uid'), 'password' => I('post.password')), Model::MODEL_UPDATE) or drop($mo->getError()); //检测字段值 if (I('post.password') != I('post.re_password')) { drop(EC_4343); } //写入数据 $mo->save() or drop(EC_4351 . $mo->getError()); //执行登出操作 R('Service/_empty', 'action=SignOut') or drop(EC_4361); }
private function init($args, UserInterface $ui) { $flags = new Flags(); $displayHelp =& $flags->bool('help', false, 'Display this help message.'); $displayVersion =& $flags->bool('version', false, 'Display this applications version.'); try { $flags->parse($args); } catch (\Exception $e) { $ui->dropError($e->getMessage(), 1, $flags->getDefaults()); drop($e->getMessage(), 1, $flags->getDefaults()); } switch (true) { case $displayVersion: self::versionMarker($ui); die(0); break; case $displayHelp: case count($flags->args()) > 1: $ui->dumpOptions($flags->getDefaults()); die(1); break; } return $flags->args() ? current($flags->args()) : self::CONFIG_FILE; }
/** * Reverse the migrations. * * @return void */ public function down() { Schema: drop('categories'); }
public function scan() { require_once $this->path; $ns = ""; $_ns = ""; $ns_bracket = false; $aliases = []; $tokens = new Tokenizer(FS::get($this->path)); while ($tokens->valid()) { if ($tokens->is(T_NAMESPACE)) { $ns = ""; $_ns = ""; $tokens->next(); if ($tokens->is(T_STRING)) { $ns = $this->_parseName($tokens); if ($tokens->is('{')) { $tokens->skip(); $ns_bracket = true; } else { $tokens->skipIf(';'); } $_ns = $ns . '\\'; } elseif ($tokens->is('{')) { $ns_bracket = true; $tokens->next(); } } elseif ($tokens->is(T_USE)) { do { $tokens->next(); $name = $this->_parseName($tokens); if ($tokens->is(T_AS)) { $aliases[$tokens->next()->get(T_STRING)] = $name; $tokens->next(); } else { if (strpos($name, '\\') === false) { $aliases[$name] = $name; } else { $aliases[ltrim('\\', strrchr($name, '\\'))] = $name; } } } while ($tokens->is(',')); $tokens->need(';')->next(); } elseif ($tokens->is(T_CONST)) { $name = $tokens->next()->get(T_STRING); $constant = new EntityConstant($_ns . $name); $constant->setValue(constant($_ns . $name)); $constant->setLine($this->line($tokens->getLine())); $this->constants[$_ns . $name] = $constant; $tokens->forwardTo(';')->next(); } elseif ($tokens->is(T_FUNCTION)) { $name = $tokens->next()->get(T_STRING); $function = new EntityFunction($_ns . $name); $function->setLine($this->line($tokens->getLine())); $function->setAliases($aliases); $this->parseCallable($function, new \ReflectionFunction($function->name)); $function->setBody($tokens->forwardTo('{')->getScope()); $tokens->next(); $this->functions[$function->name] = $function; } elseif ($tokens->is(T_FINAL, T_ABSTRACT, T_INTERFACE, T_TRAIT, T_CLASS)) { $tokens->forwardTo(T_STRING); $name = $tokens->current(); $class = new EntityClass($_ns . $name); $ref = new \ReflectionClass($class->name); $doc = $ref->getDocComment(); // if($name == "NamesInterface") { // drop($ref); // } if ($ref->isInterface()) { $class->addFlag(Flags::IS_INTERFACE); } elseif ($ref->isTrait()) { $class->addFlag(Flags::IS_TRAIT); } else { $class->addFlag(Flags::IS_CLASS); } if ($ref->isAbstract()) { $class->addFlag(Flags::IS_ABSTRACT); } elseif ($ref->isFinal()) { $class->addFlag(Flags::IS_FINAL); } if ($doc) { $info = ToolKit::parseDoc($doc); $class->setDescription($info['desc']); $class->addOptions($info['options']); } $class->setAliases($aliases); $class->setLine($this->line($tokens->getLine())); $tokens->next(); if ($tokens->is(T_EXTENDS)) { // process 'extends' keyword do { $tokens->next(); $root = $tokens->is(T_NS_SEPARATOR); $parent = $this->_parseName($tokens); if ($root) { // extends from root namespace $class->setParent($parent, $class->isInterface()); } elseif (isset($aliases[$parent])) { $class->setParent($aliases[$parent], $class->isInterface()); } else { $class->setParent($_ns . $parent, $class->isInterface()); } } while ($tokens->is(',')); } if ($tokens->is(T_IMPLEMENTS)) { // process 'implements' keyword do { $tokens->next(); $root = $tokens->is(T_NS_SEPARATOR); $parent = $this->_parseName($tokens); if ($root) { // extends from root namespace $class->addInterface($parent); } elseif (isset($aliases[$parent])) { $class->addInterface($aliases[$parent]); } else { $class->addInterface($_ns . $parent); } } while ($tokens->is(',')); } $tokens->forwardTo('{')->next(); while ($tokens->forwardTo(T_CONST, T_FUNCTION, '{', '}', T_VARIABLE) && $tokens->valid()) { switch ($tokens->key()) { case T_CONST: $constant = new EntityConstant($class->name . '::' . $tokens->next()->get(T_STRING)); $constant->setValue(constant($constant->name)); $constant->setLine(new Line($this, $tokens->getLine())); $class->addConstant($constant); break; case T_VARIABLE: $property = new EntityProperty(ltrim($tokens->getAndNext(), '$')); $ref = new \ReflectionProperty($class->name, $property->name); $doc = $ref->getDocComment(); if ($doc) { $property->setDescription(ToolKit::parseDoc($doc)['desc']); } if ($ref->isPrivate()) { $property->addFlag(Flags::IS_PRIVATE); } elseif ($ref->isProtected()) { $property->addFlag(Flags::IS_PROTECTED); } else { $property->addFlag(Flags::IS_PUBLIC); } if ($ref->isStatic()) { $property->addFlag(Flags::IS_STATIC); } if ($ref->isDefault()) { $property->setValue($ref->getDeclaringClass()->getDefaultProperties()[$property->name]); } $class->addProperty($property); break; case T_FUNCTION: $method = new EntityMethod($name . '::' . $tokens->next()->get(T_STRING)); $method->setLine($this->line($tokens->getLine())); $this->parseCallable($method, $ref = new \ReflectionMethod($class->name, $method->short)); if ($ref->isPrivate()) { $method->addFlag(Flags::IS_PRIVATE); } elseif ($ref->isProtected()) { $method->addFlag(Flags::IS_PROTECTED); } else { $method->addFlag(Flags::IS_PUBLIC); } if ($ref->isStatic()) { $method->addFlag(Flags::IS_STATIC); } if ($ref->isAbstract()) { $method->addFlag(Flags::IS_ABSTRACT); $method->addFlag(Flags::IS_ABSTRACT_IMPLICIT); } elseif ($ref->isFinal()) { $method->addFlag(Flags::IS_FINAL); } if (isset($method->options['deprecated'])) { $method->addFlag(Flags::IS_DEPRECATED); } $tokens->forwardTo(')')->next(); if ($tokens->is('{')) { $method_body = $tokens->getScope(); $method->setBody($method_body); } $tokens->next(); $class->addMethod($method); break; case '{': // use traits scope $tokens->forwardTo('}')->next(); break; case '}': // end of class $tokens->next(); $this->classes[$class->name] = $class; break 2; } } } elseif ($tokens->is('}') && $ns_bracket) { $tokens->next(); $ns_bracket = false; } else { drop($tokens->curr); if ($tokens->valid()) { throw new UnexpectedTokenException($tokens); } break; } } }
<?php return function ($di) { $di->set("log.error.router", function () { return new \Psr\Log\NullLogger(); }); $di->set("log.error.dispatcher", function () { return new \Psr\Log\NullLogger(); }); $di->set("log.drop", function () { return new \Chevron\Loggers\UserFuncLogger(function ($l, $m, $c) { drop($l, $m, $c); }); }); };
/** * Reverse the migrations. * * @return void */ public function down() { Schema: drop('Trades'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema: drop('DipVisas'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema: drop('pages'); }
case "lovkost10": $add = 10; $type = 'stat'; $zaman = time() + 6 * 60 * 60; break; case "lovkost15": $add = 15; $type = 'stat'; $zaman = time() + 6 * 60 * 60; break; case "lovkost22": $add = 22; $type = 'stat_mf'; $zaman = time() + 2 * 60 * 60; break; case "lovkost100": $add = 100; $type = 'stat'; $zaman = time() + 6 * 60 * 60; break; } $my_id = $db["id"]; if ($db["battle"]) { say($login, "¬ы не можете кастовать это закл¤тие наход¤сь в бою!", $login); } else { mysql_query("DELETE FROM effects WHERE user_id=" . $my_id . " and type='" . $type . "'"); mysql_query("INSERT INTO effects (user_id,type,elik_id,add_lovkost,end_time) VALUES ('{$my_id}','{$type}','{$elik_id}','{$add}','{$zaman}')"); $_SESSION["message"] = "¬ы удачно прокастовали заклинание <b>«" . $name . "»</b>"; drop($spell, $DATA); } echo "<script>location.href='main.php?act=inv&otdel=magic'</script>";
/** * Reverse the migrations. * * @return void */ public function down() { Schema: drop('Notices'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema: drop('category_place'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema: drop('Publicholidays'); }
', $spell_cols[2], $item['entry'], $item['entry'], $item['entry']); if ($rows_cf) { $item['createdfrom'] = array(); foreach ($rows_cf as $numRow => $row) { $skillrow = $DB->selectRow(' SELECT skillID, min_value, max_value FROM ?_udwbase_skill_line_ability WHERE spellID=?d LIMIT 1', $row['spellID']); $item['createdfrom'][] = spellinfo2(array_merge($row, $skillrow)); } unset($skillrow); } unset($rows_cf); // Ловится в ... $drops_fi = drop('?_fishing_loot_template', $item['entry']); if ($drops_fi) { $item['fishedin'] = array(); foreach ($drops_fi as $lootid => $drop) { // Обычные локации $row = $DB->selectRow(' SELECT name_loc' . $_SESSION['locale'] . ' AS name, areatableID as id FROM ?_udwbase_zones WHERE areatableID=?d AND (x_min!=0 AND x_max!=0 AND y_min!=0 AND y_max!=0) LIMIT 1 ', $lootid); if ($row) { $item['fishedin'][] = array_merge($row, $drop); } else {
', $lootid); if ($row) { $item['fishedin'][] = array_merge($row, $drop); } } } unset($row); unset($num); } unset($drops_fi); // Размалывается в if (!($item['milling'] = loot('milling_loot_template', $item['entry']))) { unset($item['milling']); } // Получается размалыванием из $drops_mi = drop('milling_loot_template', $item['entry']); if ($drops_mi) { $item['milledfrom'] = array(); foreach ($drops_mi as $lootid => $drop) { $rows = $DB->select(' SELECT c.?#, c.entry, maxcount { , l.name_loc?d AS name_loc } FROM ?_icons, item_template c { LEFT JOIN (locales_item l) ON l.entry=c.entry AND ? } WHERE c.entry=?d AND id=displayid ', $item_cols[2], $_SESSION['locale'] > 0 ? $_SESSION['locale'] : DBSIMPLE_SKIP, $_SESSION['locale'] > 0 ? 1 : DBSIMPLE_SKIP, $lootid); foreach ($rows as $row) {
public function testTakeDrop() { $this->assertSame([1, 2, 3], toArray(take(3, [1, 2, 3, 4, 5]))); $this->assertSame([4, 5], toArray(drop(3, [1, 2, 3, 4, 5]))); $this->assertSame([], toArray(take(3, []))); $this->assertSame([], toArray(drop(3, []))); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema: drop('OrgStructures'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema: drop('Tourisms'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema: drop('ConsularGenerals'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema: drop('traveldocuments'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema: drop('NRNIDs'); }
maps3($do[1]); } elseif ($do[0] == "gotown") { include 'towns.php'; travelto($do[1]); } elseif ($do[0] == "move") { include 'explore.php'; move(); } elseif ($do[0] == "fight") { include 'fight.php'; fight(); } elseif ($do[0] == "victory") { include 'fight.php'; victory(); } elseif ($do[0] == "drop") { include 'fight.php'; drop(); } elseif ($do[0] == "dead") { include 'fight.php'; dead(); } elseif ($do[0] == "duelo") { include 'duelo.php'; duelo(); } elseif ($do[0] == "verify") { header("Location: users.php?do=verify"); die; } elseif ($do[0] == "spell") { include 'heal.php'; healspells($do[1]); } elseif ($do[0] == "showchar") { showchar(); } elseif ($do[0] == "onlinechar") {
/** * Reverse the migrations. * * @return void */ public function down() { Schema: drop('product_attributes'); }