本文整理汇总了PHP中Error::halt方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::halt方法的具体用法?PHP Error::halt怎么用?PHP Error::halt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Error
的用法示例。
在下文中一共展示了Error::halt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: verify
static function verify()
{
$data = array('uname' => array(null, 'string', '', '用户名为空'), 'password' => array(null, 'length', array(4, 16), '密码错误'), 'checkcode' => array(null, 'string', '', '验证码为空'));
Sys::S('core.Verify.Input');
$data = Input::dataFilter($data, 'post');
if (!isset($_SESSION['verify_code']) || strtoupper($data['checkcode']) != $_SESSION['verify_code']) {
Error::halt(self::WRONG_CHECK_CODE, '验证码错误!');
}
$oUcenterMember = Sys::D('UcenterMember');
$loginStatus = UcenterMemberModel::login($data['uname'], $data['password']);
if ($loginStatus >= 10) {
if ($loginStatus == 10) {
Error::halt(UcenterMemberModel::LOGIN_SUCCESS, array('msg' => '登录成功', 'redirect' => DOMAIN . 'Index_index.jsp'));
} else {
if ($loginStatus == UcenterMemberModel::ACCOUNT_LOCKED) {
Error::halt($loginStatus, '账号已被锁定!');
} else {
if ($loginStatus == UcenterMemberModel::ACCOUNT_DISABLED) {
Error::halt($loginStatus, '账号无效');
} else {
Error::halt($loginStatus, '用户名或密码错误');
}
}
}
} else {
$msg = $loginStatus <= 0 ? '您的账号已被锁定' : '登录失败,您还有' . $loginStatus . '次机会登录!';
Error::halt($loginStatus, $msg);
}
}
示例2: render
public static function render(array $additional_js_files = array())
{
echo '<hr>
<footer>
<div style="float: left;">
Copyright © ' . date("Y") . ' <a href="http://www.nodesocket.com">NodeSocket</a>, LLC.
<br >All rights reserved.
</div>
<div style="float: right;">
<div style="margin-bottom: 2px;"><iframe src="http://ghbtns.com/github-btn.html?user=nodesocket&repo=commando&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110px" height="20px"></iframe><iframe src="http://ghbtns.com/github-btn.html?user=nodesocket&repo=commando&type=fork&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110px" height="20px"></iframe></div>
v' . Version::app . '
</div>
</footer>
</div>';
////
// JavaScript files that are always loaded
////
echo '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/common.js"></script>';
////
// Remove possible duplicates from additional_js_files
////
if (count($additional_js_files) > 1) {
$additional_js_files = array_unique($additional_js_files);
}
////
// Additional JavaScript files to load
////
foreach ($additional_js_files as $additional_js_file) {
////
// Handle the special case of codemirror
///
if ($additional_js_file === "codemirror") {
echo '<script type="text/javascript" src="/js/codemirror/codemirror.js"></script>
<script type="text/javascript" src="/js/codemirror/shell.js"></script>
<script type="text/javascript" src="/js/codemirror/perl.js"></script>
<script type="text/javascript" src="/js/codemirror/python.js"></script>
<script type="text/javascript" src="/js/codemirror/javascript.js"></script>
<script type="text/javascript" src="/js/codemirror/markdown.js"></script>';
} else {
if ($additional_js_file === "code-pretty") {
echo '<script type="text/javascript" src="/js/code-pretty/prettify.js"></script>';
} else {
////
//Check to make sure the JavaScript file exists
////
if (file_exists(dirname(__DIR__) . "/js/" . $additional_js_file . ".js")) {
echo '<script type="text/javascript" src="/js/' . $additional_js_file . '.js"></script>';
} else {
Error::halt(404, 'not found', 'The included JavaScript file \'/js/' . $additional_js_file . '.js\' does not exist.');
}
}
}
}
echo '</body>
</html>';
}
示例3: render
public static function render(array $additional_js_files = array())
{
echo '<hr>
<footer>
<p style="float: left;">
Copyright © ' . date("Y") . ' <a href="http://www.nodesocket.com">NodeSocket</a>, LLC.
<br >All rights reserved.
</p>
<p style="float: right;">
v' . Version::current . '
<br />View on <a href="https://github.com/nodesocket/commando">GitHub</a>.
</p>
</footer>
</div>';
////
// JavaScript files that are always loaded
////
echo '<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/common.js"></script>';
////
// Remove possible duplicates from additional_js_files
////
if (sizeof($additional_js_files) > 1) {
$additional_js_files = array_unique($additional_js_files);
}
////
// Additional JavaScript files to load
////
foreach ($additional_js_files as $additional_js_file) {
////
// Handle the special case of codemirror
///
if ($additional_js_file === "codemirror") {
echo '<script type="text/javascript" src="/js/codemirror/codemirror.js"></script>
<script type="text/javascript" src="/js/codemirror/shell.js"></script>
<script type="text/javascript" src="/js/codemirror/perl.js"></script>
<script type="text/javascript" src="/js/codemirror/python.js"></script>
<script type="text/javascript" src="/js/codemirror/javascript.js"></script>
<script type="text/javascript" src="/js/codemirror/markdown.js"></script>';
} else {
if ($additional_js_file === "code-pretty") {
echo '<script type="text/javascript" src="/js/code-pretty/prettify.js"></script>';
} else {
////
//Check to make sure the JavaScript file exists
////
if (file_exists(dirname(__DIR__) . "/js/" . $additional_js_file . ".js")) {
echo '<script type="text/javascript" src="/js/' . $additional_js_file . '.js"></script>';
} else {
Error::halt(404, 'not found', 'The included JavaScript file \'/js/' . $additional_js_file . '.js\' does not exist.');
}
}
}
}
echo '</body>
</html>';
}
示例4: connect
public static function connect()
{
MySQLConnection::$db_connection = mysqli_init();
$connected = @mysqli_real_connect(MySQLConnection::$db_connection, MySQLConfiguration::host, MySQLConfiguration::username, MySQLConfiguration::password, MySQLConfiguration::database, MySQLConfiguration::port, MySQLConfiguration::socket, MYSQLI_CLIENT_COMPRESS);
if (!$connected) {
//Output error details
Error::halt(503, 'service unavailable', 'Temporarily unable to process request. Failed to establish a connection with MySQL. Please retry.');
}
}
示例5: insert
public static function insert(array $data, array $options = array("safe" => 1, "fsync" => false))
{
try {
return MongoConnection::$mongo_collection->insert($data, $options);
} catch (Exception $MongoCursorException) {
//Output error details
Error::halt(503, 'service unavailable', 'Temporarily unable to process request. Failed to insert into the MongoDB collection. Please retry.');
}
}
示例6: index
static function index()
{
if (self::isLogin()) {
Error::halt('', '', '', '');
exit('<script>alert("你已经登录,请退出后再登录");window.location.href="./Index_index.jsp";</script>');
}
View::assign('scripts', array('core.Bracket.bootstrapValidator#min'));
View::assign('styles', array('core.Bracket.bootstrapValidator#min'));
View::display();
}
示例7: index
public static function index()
{
Sys::D('AdminLoginLog');
AdminLoginLogModel::log($_SESSION['userinfo']['id'], AdminLoginLogModel::LOGIN_OUT);
if (isset($_SESSION['userinfo'])) {
unset($_SESSION['userinfo']);
}
if (isset($_SESSION['authority'])) {
unset($_SESSION['authority']);
}
Error::halt(SUCCESS, '登出成功!', './Login_index.jsp');
}
示例8: render
public static function render(array $additional_css_files = array())
{
$output = '<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>' . Header::$title . '</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="A web-based interface for streamlining the use of SSH for deployments and system administration tasks across groups of remote servers.">
<meta name="author" content="Commando.io">
<link rel="shortcut icon" href="/img/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/img/apple-touch-114.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/img/apple-touch-72.png">
<link rel="apple-touch-icon-precomposed" href="/img/apple-touch-57.png">
<link href="/css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
body {
padding-top: 60px;
padding-bottom: 40px;
}
</style>
<link href="/css/bootstrap-responsive.min.css" rel="stylesheet">
<link href="/css/additional-styles.css" rel="stylesheet">';
////
// Remove possible duplicates from additional_css_files
////
if (count($additional_css_files) > 1) {
$additional_css_files = array_unique($additional_css_files);
}
////
// Additional CSS files to load
////
foreach ($additional_css_files as $additional_css_file) {
////
//Make sure the CSS file exists
////
if (file_exists(dirname(__DIR__) . "/css/" . $additional_css_file . ".css")) {
$output .= '<link href="/css/' . $additional_css_file . '.css" rel="stylesheet">';
} else {
Error::halt(404, 'not found', 'The included CSS file \'/css/' . $additional_css_file . '.css\' does not exist.');
}
}
$output .= '<!--[if lt IE 9]>
<script src="/js/html5.js"></script>
<![endif]-->
</head>
<body>';
echo $output;
}
示例9: modifyPassword
public function modifyPassword()
{
Sys::S('core.Verify.Input');
$data = array('src_password' => array(null, 'string', '', '原密码不能为空'), 'new_password' => array(null, 'string', '', '新密码不能为空'));
$data = Input::dataFilter($data, 'post');
if (md5($data['src_password']) != $_SESSION['userinfo']['password']) {
Error::halt(FAIL, '原密码不正确');
} else {
if ($data['src_password'] == $data['new_password']) {
Error::halt(FAIL, '新密码不能与原密码一致');
} else {
Sys::D('UcenterMember');
UcenterMemberModel::savePassword($_SESSION['userinfo']['id'], $data['new_password']);
Error::halt(SUCCESS, '操作成功');
}
}
}
示例10: import
/**
* 文件导入
*/
public static function import($className, $type)
{
static $_file = array();
$method = '';
$flag = false;
$type = strtolower($type);
$type_refer = array('action' => 'importAction', 'model' => 'importModel', 'class' => 'importClass', 'static' => 'importStatic');
if (isset($_file[$className])) {
return true;
}
//判断文件类型 1=>action 2=>model -1=>其他文件
$method = $type_refer[$type];
$flag = self::$method($className);
if (!$flag) {
Error::halt(FILE_NOTFOUND, '文件:' . $className . '未找到');
}
}
示例11: check_required_parameters
public static function check_required_parameters($params)
{
if (is_array($params)) {
foreach ($params as $param) {
if (!isset($param) || empty($param)) {
if ($param != 0) {
//Output error details
Error::halt(400, 'bad request', 'Missing required parameter.');
}
}
}
} else {
if (!isset($params) || empty($params)) {
if ($param != 0) {
//Output error details
Error::halt(400, 'bad request', 'Missing required parameter.');
}
}
}
}
示例12: query
public function query($str)
{
$rs = array();
$this->initConnect();
$this->queryID = $this->linkID->query($str);
if (!$this->queryID) {
Error::halt(501, '执行sql语句出错:' . $str);
} else {
if (is_bool($this->queryID)) {
$this->numRows = mysqli_affected_rows($this->linkID);
} else {
$this->numRows = mysqli_affected_rows($this->linkID);
$this->numFields = $this->queryID->field_count;
for ($i = 0; $i < $this->numRows; $i++) {
$rs[] = $this->queryID->fetch_assoc();
}
$this->free();
return $rs;
}
}
}
示例13: autoload
static function autoload()
{
require_once dirname(__DIR__) . "/classes/Prerequisites.php";
require_once dirname(__DIR__) . "/timezone.php";
require_once dirname(__DIR__) . "/defines.php";
require_once dirname(__DIR__) . "/classes/Error.php";
require_once dirname(__DIR__) . "/classes/Sessions.php";
if (!file_exists(dirname(__DIR__) . "/app.config.php")) {
Error::halt(404, 'not found', 'File \'app.config.php\' does not exist. Did you run \'install.php\'?');
}
require_once dirname(__DIR__) . "/app.config.php";
if (!file_exists(dirname(__DIR__) . "/classes/MySQLConfiguration.php")) {
Error::halt(404, 'not found', 'File \'/classes/MySQLConfiguration.php\' does not exist.');
}
if (!file_exists(dirname(__DIR__) . "/classes/MongoConfiguration.php")) {
Error::halt(404, 'not found', 'File \'/classes/MongoConfiguration.php\' does not exist.');
}
spl_autoload_register(function ($class_name) {
require_once dirname(__DIR__) . "/classes/" . $class_name . ".php";
});
}
示例14: init
public static function init()
{
if (!self::ifUserLogined()) {
Error::halt(10001, '???δ???');
return false;
}
if (self::isAdmin()) {
return true;
} else {
self::getAuthInfo();
//????????????????
Sys::D('Menu');
$menu_id = MenuModel::getIdByActionAndModule(ACTION, MODULE);
if ($menu_id) {
return self::checkMenuAuth($menu_id);
}
Sys::D('GlobalRule');
$menu_id = GlobalRuleModel::getIdByActionAndModule(ACTION, MODULE);
return self::checkGlobalAuth($menu_id);
}
}
示例15: auth
public function auth($username, $public_key_path, $private_key_path, $throw_error = false)
{
////
// Confirm that the public key exists
////
if (!file_exists($public_key_path)) {
unset($this->ssh_connection);
if ($throw_error) {
//Throw error details (string)
throw new Exception(Error::out(404, 'not found', 'The public SSH key file \'' . $public_key_path . '\' does not exist.'));
} else {
//Output error details
Error::halt(404, 'not found', 'The public SSH key file \'' . $public_key_path . '\' does not exist.');
}
}
////
// Confirm that the private key exists
////
if (!file_exists($private_key_path)) {
unset($this->ssh_connection);
if ($throw_error) {
//Throw error details (string)
throw new Exception(Error::out(404, 'not found', 'The private SSH key file \'' . $private_key_path . '\' does not exist.'));
} else {
//Output error details
Error::halt(404, 'not found', 'The private SSH key file \'' . $private_key_path . '\' does not exist.');
}
}
if (!@ssh2_auth_pubkey_file($this->ssh_connection, $username, $public_key_path, $private_key_path)) {
unset($this->ssh_connection);
if ($throw_error) {
//Throw error details (string)
throw new Exception(Error::out(504, 'gateway timeout', 'Failed to authenticate a SSH connection with username \'' . $username . '\' on host \'' . $this->hostname . '\' on port \'' . $this->port . '\'.'));
} else {
//Output error details
Error::halt(504, 'gateway timeout', 'Failed to authenticate a SSH connection with username \'' . $username . '\' on host \'' . $this->hostname . '\' on port \'' . $this->port . '\'.');
}
}
return true;
}