function __tokenize($context, $input, $pattern) { $sequence = array(); foreach (preg_split("#" . preg_replace("/#/", "\\#", __toString($pattern)) . "#", __toString($input)) as $item) { $sequence[] = $GLOBALS['XQDB_Storage']->registerItem(new AtomicValue($item, "xs:string")); } return $sequence; }
public static function mapchars($array) { $ccchar = Database::Get("characters", array("map" => (string) $array['map'], 'online' => array('$gt' => time()))); $answer = array(); foreach ($ccchar as $c) { if (__toString($c['_id']) == $_SESSION['cid']) { continue; } $c['_id'] = __toString($c['_id']); $answer[$c['_id']]['id'] = $c['_id']; $answer[$c['_id']]['name'] = $c['name']; $answer[$c['_id']]['x'] = $c['pos_x']; $answer[$c['_id']]['y'] = $c['pos_y']; $answer[$c['_id']]['skin'] = $c['skin']; $answer[$c['_id']]['dir'] = $c['dir']; } $answer = json_encode($answer, JSON_FORCE_OBJECT); return $answer; }
function __call($func, $args) { $func = str_replace("action", "", $func); if ($func != 'index') { $array = Database::GetOne("characters", array("name" => $func)); } else { $array = Database::GetOne("characters", array("_id" => toId($_SESSION['cid']))); $func = $array['name']; } if (!isset($array['name'])) { die("<h1>Персонаж " . $func . " не найден</h1>"); } $params = Database::GetOne("config", array("mod" => "params")); $main = new Templater(); $main->import("interface/playerinfo.tpl"); $main->setvar("%URL%", "http://" . $GLOBALS['url']); $main->setvar("%STORAGE_TPL_URL%", "/storage/tpl"); $main->setvar("%YEAR%", date("Y")); $main->setvar("%CSS%", "<style>" . templater("css/game.css", array("%ROOT%" => "/storage/tpl")) . "</style>"); $main->setvar("%GAME_TITLE%", $GLOBALS['name']); $main->setvar("%STORAGE_STATIC_URL%", "/storage/static"); $main->setvar("%GUI%", template("interface/GUI.tpl")); $main->setvar("%CHATBOX%", template("boxes/chat.tpl")); $params_all = ''; foreach ($array as $key => $value) { if (MongoReserved($key) or MongoReserved($value) or strstr($key, "p_")) { continue; } $main->setvar("%" . $key . "%", $array[$key]); } foreach ($params as $key => $value) { if (!strstr($key, "p_")) { continue; } $v = char(__toString($array['_id']))->getParam($key); $main->setvar("%" . $key . "%", $v); $params_all .= '<p><b>' . $value['name'] . '</b>: ' . $v . '</p>'; } $main->setvar("%PARAMS_ALL%", $params_all); $main->renderEcho(); }
if (isset($GLOBALS['modules'])) { foreach ($GLOBALS['modules'] as $module) { if (!file_exists(MODS_ROOT . SEPARATOR . $module . SEPARATOR . "global.php")) { continue; } @(include_once MODS_ROOT . SEPARATOR . $module . SEPARATOR . "global.php"); } } if (!defined("NOT_CLIENT_USE") and defined("CLIENT_USE")) { if (isset($_SESSION['cid'])) { if (is_object($_SESSION['cid'])) { $_SESSION['cid'] = __toString($_SESSION['cid']); } $GLOBALS['chars'][$_SESSION['cid']] = new Char($_SESSION['cid']); $GLOBALS['chars'][$_SESSION['cid']]->setOnline(); $ev = check_player_events($_SESSION['cid'], false, true); if (!empty($ev['eval'])) { eval(implode(" ", $ev['eval'])); } } if (isset($_SESSION['id'])) { if (is_object($_SESSION['id'])) { $_SESSION['id'] = __toString($_SESSION['id']); } global $player; $player = new Player($_SESSION['id']); } eval(getScript('main')); call_user_func("scriptEngineInit"); checkTimers(); }
function __comparison($arg1, $arg2, $operator) { switch ($operator) { case "=": if (__toString($arg1) == __toString($arg2)) { return $GLOBALS['XQDB_Storage']->boolTrue(); } break; case "!=": if (__toString($arg1) != __toString($arg2)) { return $GLOBALS['XQDB_Storage']->boolTrue(); } break; case "<": if (__toString($arg1) < __toString($arg2)) { return $GLOBALS['XQDB_Storage']->boolTrue(); } break; case "<=": if (__toString($arg1) <= __toString($arg2)) { return $GLOBALS['XQDB_Storage']->boolTrue(); } break; case ">": if (__toString($arg1) > __toString($arg2)) { return $GLOBALS['XQDB_Storage']->boolTrue(); } break; case ">=": if (__toString($arg1) >= __toString($arg2)) { return $GLOBALS['XQDB_Storage']->boolTrue(); } break; default: PEAR::raiseError("Der Operator '" . $operator . "' wird nicht unterstützt!"); } return $GLOBALS['XQDB_Storage']->boolFalse(); }
<?php $first = 0; $second = 1; for ($i = 0; $i < 400; $i++) { $third = $first + $second; $first = $second; $second = $third; //echo $third . PHP_EOL; if ($third % 2 == 0) { //$sum = $sum + $third; bcadd(__toString($sum), __toString($third)); } } echo $sum . PHP_EOL;
private static function getMessage($object, $text = '', $mode = 0) { if (is_int($text) && $text <= self::$MAX) { $mode = $text; $text = ''; } $message = ''; switch ($mode) { case self::$COUNT: if (is_array($object)) { oggetto_array: $message .= "ARRAY con " . count($object) . ' elementi'; break; } if ($object instanceof \Traversable) { $message .= "OGGETTO " + get_class($s) + " con " . count($object) . ' elementi'; break; } $message .= "Variabile non iterabile: "; case self::$CLASS: $message .= Debug::typeof($object, true); break; case self::$VD: $message .= Debug::var_dump($object, true); break; case self::$PR: $message .= Debug::print_r($object); break; case self::$STRING: if (is_bool($object)) { $message .= 'Valore booleano: '; $message .= $object ? 'TRUE' : 'FALSE'; } elseif (is_array($object)) { goto oggetto_array; } elseif (!is_object($object)) { $message .= $object; } else { $message .= Debug::typeof($object, true); $methods = get_class_methods($object); if (in_array('__toString', $methods)) { $message .= ': ' . $object . __toString(); } } break; } return ($text != '' ? "{$text}: " : '') . $message; }
/** * * @param type $userBirthdate * @return \Cbfk\Tf\UserBundle\Entity\User */ function setUserBirthdate($userBirthdate) { $userBirthdate = __toString($userBirthdate); $this->userBirthdate = new DateTime($userBirthdate); return $this; }
trace(__FILE__, 'CompanyWebsite::init() - use file storage'); FileRepository::setBackend(new FileRepository_Backend_FileSystem(FILES_DIR)); } else { trace(__FILE__, 'CompanyWebsite::init() - use mysql storage'); FileRepository::setBackend(new FileRepository_Backend_MySQL(DB::connection()->getLink(), TABLE_PREFIX)); } // if PublicFiles::setRepositoryPath(ROOT . '/public/files'); if (trim(PUBLIC_FOLDER) == '') { PublicFiles::setRepositoryUrl(with_slash(ROOT_URL) . 'files'); } else { PublicFiles::setRepositoryUrl(with_slash(ROOT_URL) . PUBLIC_FOLDER . '/files'); } // if // Owner company or administrator doen't exist? Let the user create them } catch(OwnerCompanyDnxError $e) { Env::executeAction('access', 'complete_installation'); } catch(AdministratorDnxError $e) { Env::executeAction('access', 'complete_installation'); // Other type of error? We need to break here } catch(Exception $e) { trace(__FILE__, '- catch '.$e.__toString()); if (Env::isDebugging()) { Env::dumpError($e); } else { Logger::log($e, Logger::FATAL); Env::executeAction('error', 'system'); } // if } // if ?>
function __createDoc($context, $uri) { return $GLOBALS['XQDB_Storage']->createDoc(__toString($uri)); }
function CharByName($name) { $id = Database::GetOne("characters", array("name" => $name)); if (is_array($id)) { return char(__toString($id['_id'])); } else { return false; } }
/** * @deprecated 1.6 - Jun 24, 2009 * @see __toString() */ function toString() { return __toString(); }
<label>Тема письма</label> <input class="form-control" name="subject" placeholder="Тема письма"> </div> <div class="form-group"> <label>Сообщение</label> <textarea class="form-control" name="message" rows="3"></textarea> </div> <button type="submit" class="btn btn-default">Отправить сообщение</button> </form>'; break; case "masscript": if (isset($_POST['eval'])) { $mail = new Mail(); $players = Database::GetAll('players'); foreach ($players as $a) { $player = new Player(__toString($a['_id'])); if (!eval($_POST['eval'])) { unset($player); continue; } if ($mail->sendMail(array('to' => $a['email'], 'subject' => $_POST['subject'], 'message' => $_POST['message']))) { $count += 1; } else { echo '<div class="alert alert-danger">Ошибка при отправке на <b>' . $a['email'] . '</b> (' . $a['login'] . ')</div>'; } unset($player); } echo '<div class="alert alert-success">Сообщение отправлено на <b>' . $count . '</b> адресов</div>'; } echo ' <form method="POST" action="" role="form">