本文整理汇总了PHP中log::warning方法的典型用法代码示例。如果您正苦于以下问题:PHP log::warning方法的具体用法?PHP log::warning怎么用?PHP log::warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类log
的用法示例。
在下文中一共展示了log::warning方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _send_reset
private function _send_reset($form)
{
$user_name = $form->reset->inputs["name"]->value;
$user = user::lookup_by_name($user_name);
if ($user && !empty($user->email)) {
$user->hash = random::hash();
$user->save();
$message = new View("reset_password.html");
$message->confirm_url = url::abs_site("password/do_reset?key={$user->hash}");
$message->user = $user;
Sendmail::factory()->to($user->email)->subject(t("Password Reset Request"))->header("Mime-Version", "1.0")->header("Content-type", "text/html; charset=UTF-8")->message($message->render())->send();
log::success("user", t("Password reset email sent for user %name", array("name" => $user->name)));
} else {
if (!$user) {
// Don't include the username here until you're sure that it's XSS safe
log::warning("user", t("Password reset email requested for user %user_name, which does not exist.", array("user_name" => $user_name)));
} else {
log::warning("user", t("Password reset failed for %user_name (has no email address on record).", array("user_name" => $user->name)));
}
}
// Always pretend that an email has been sent to avoid leaking
// information on what user names are actually real.
message::success(t("Password reset email sent"));
json::reply(array("result" => "success"));
}
示例2: storeContent
public function storeContent()
{
$name = $_POST['name'];
$final = $_POST['final'];
$advantages = $_POST['ad'];
$disadvantages = $_POST['dis'];
$retID = pass_passService::getUid();
if (!$retID) {
$result['errNum'] = '0007';
$result['errMsg'] = errorcode::$error[$result['errNum']];
$this->renderJson($result);
}
$content = array('name' => $name, 'final' => $final, 'ad' => $advantages, 'dis' => $disadvantages);
$redis = redisModel::getInstance();
$key = sprintf(self::REDIS_DECISION_USER_KEY, $retID);
$ret = $redis::$redis->lPush($key, json_encode($content));
if (!$ret) {
log::warning("redis write error", "log.wf");
$result['errNum'] = '0005';
$result['errMsg'] = errorcode::$error[$result['errNum']];
$this->renderJson($result);
}
$result['errNum'] = '0000';
$result['errMsg'] = errorcode::$error[$result['errNum']];
$this->renderJson($result);
}
示例3: _send_reset
private function _send_reset()
{
$form = $this->_reset_form();
$valid = $form->validate();
if ($valid) {
$user = user::lookup_by_name($form->reset->inputs["name"]->value);
if (!$user->loaded || empty($user->email)) {
$form->reset->inputs["name"]->add_error("no_email", 1);
$valid = false;
}
}
if ($valid) {
$user->hash = md5(rand());
$user->save();
$message = new View("reset_password.html");
$message->confirm_url = url::abs_site("password/do_reset?key={$user->hash}");
$message->user = $user;
Sendmail::factory()->to($user->email)->subject(t("Password Reset Request"))->header("Mime-Version", "1.0")->header("Content-type", "text/html; charset=iso-8859-1")->message($message->render())->send();
log::success("user", t("Password reset email sent for user %name", array("name" => $user->name)));
} else {
// Don't include the username here until you're sure that it's XSS safe
log::warning("user", "Password reset email requested for bogus user");
}
message::success(t("Password reset email sent"));
print json_encode(array("result" => "success"));
}
示例4: auth
public function auth()
{
if (!identity::active_user()->admin) {
access::forbidden();
}
access::verify_csrf();
$form = self::_form();
$valid = $form->validate();
$user = identity::active_user();
if ($valid) {
module::event("user_auth", $user);
if (!request::is_ajax()) {
message::success(t("Successfully re-authenticated!"));
}
url::redirect(Session::instance()->get_once("continue_url"));
} else {
$name = $user->name;
log::warning("user", t("Failed re-authentication for %name", array("name" => $name)));
module::event("user_auth_failed", $name);
if (request::is_ajax()) {
$v = new View("reauthenticate.html");
$v->form = $form;
$v->user_name = identity::active_user()->name;
json::reply(array("html" => (string) $v));
} else {
self::_show_form($form);
}
}
}
示例5: __construct
public function __construct()
{
$dbConfig = (require CONF_PATH . "db.conf.php");
$this->mysqli = mysqli_init();
$ret = $this->mysqli->real_connect($dbConfig["host"], $dbConfig["username"], $dbConfig["password"], $dbConfig["dbname"], $dbConfig["port"]);
if (!$ret) {
log::warning("mysql connect error", "log.wf");
}
}
示例6: __construct
public function __construct()
{
$dbConfig = (require CONF_PATH . "redis.conf.php");
self::$redis = new redis();
$ret = self::$redis->connect($dbConfig["host"], $dbConfig["port"]);
if (!$ret) {
log::warning("redis connect error", "log.wf");
}
}
示例7: selectUid
public function selectUid($email)
{
$sql = "select userId from {$this->table} where email='{$email}' ";
$ret = $this->db->mysqli->query($sql);
if ($this->db->mysqli->error) {
log::warning($sql, "log.wf");
return false;
}
log::notice($sql, "log.nf");
return $ret;
}
示例8: index
/**
* Show a list of all available, running and finished tasks.
*/
public function index()
{
$query = Database::instance()->query("UPDATE {tasks} SET `state` = 'stalled' " . "WHERE done = 0 " . "AND state <> 'stalled' " . "AND unix_timestamp(now()) - updated > 15");
$stalled_count = $query->count();
if ($stalled_count) {
log::warning("tasks", t2("One task is stalled", "%count tasks are stalled", $stalled_count), t('<a href="%url">view</a>', array("url" => html::mark_clean(url::site("admin/maintenance")))));
}
$view = new Admin_View("admin.html");
$view->content = new View("admin_maintenance.html");
$view->content->task_definitions = task::get_definitions();
$view->content->running_tasks = ORM::factory("task")->where("done", 0)->orderby("updated", "DESC")->find_all();
$view->content->finished_tasks = ORM::factory("task")->where("done", 1)->orderby("updated", "DESC")->find_all();
print $view;
}
示例9: index
/**
* Show a list of all available, running and finished tasks.
*/
public function index()
{
$query = db::build()->update("tasks")->set("state", "stalled")->where("done", "=", 0)->where("state", "<>", "stalled")->where(new Database_Expression("UNIX_TIMESTAMP(NOW()) - `updated` > 15"))->execute();
$stalled_count = $query->count();
if ($stalled_count) {
log::warning("tasks", t2("One task is stalled", "%count tasks are stalled", $stalled_count), t('<a href="%url">view</a>', array("url" => html::mark_clean(url::site("admin/maintenance")))));
}
$view = new Admin_View("admin.html");
$view->content = new View("admin_maintenance.html");
$view->content->task_definitions = task::get_definitions();
$view->content->running_tasks = ORM::factory("task")->where("done", "=", 0)->order_by("updated", "DESC")->find_all();
$view->content->finished_tasks = ORM::factory("task")->where("done", "=", 1)->order_by("updated", "DESC")->find_all();
print $view;
}
示例10: index
/**
* Show a list of all available, running and finished tasks.
*/
public function index()
{
$query = Database::instance()->query("UPDATE `tasks` SET `state` = 'stalled' " . "WHERE done = 0 " . "AND state <> 'stalled' " . "AND unix_timestamp(now()) - updated > 120");
$stalled_count = $query->count();
if ($stalled_count) {
log::warning("tasks", t2("One task is stalled", "%count tasks are stalled", $stalled_count), t("%link_startview%link_end", array("link_start" => "<a href=\"" . url::site("admin/maintenance") . "\">", "link_start" => "</a>")));
}
$view = new Admin_View("admin.html");
$view->content = new View("admin_maintenance.html");
$view->content->task_definitions = $this->_get_task_definitions();
$view->content->running_tasks = ORM::factory("task")->where("done", 0)->orderby("updated", "desc")->find_all();
$view->content->finished_tasks = ORM::factory("task")->where("done", 1)->orderby("updated", "desc")->find_all();
$view->content->csrf = access::csrf_token();
print $view;
}
示例11: index
/**
* Show a list of all available, running and finished tasks.
*/
public function index()
{
$query = db::build()->update("tasks")->set("state", "stalled")->where("done", "=", 0)->where("state", "<>", "stalled")->where(db::expr("UNIX_TIMESTAMP(NOW()) - `updated` > 15"))->execute();
$stalled_count = $query->count();
if ($stalled_count) {
log::warning("tasks", t2("One task is stalled", "%count tasks are stalled", $stalled_count), t('<a href="%url">view</a>', array("url" => html::mark_clean(url::site("admin/maintenance")))));
}
$view = new Admin_View("admin.html");
$view->page_title = t("Maintenance tasks");
$view->content = new View("admin_maintenance.html");
$view->content->task_definitions = task::get_definitions();
$view->content->running_tasks = ORM::factory("task")->where("done", "=", 0)->order_by("updated", "DESC")->find_all();
$view->content->finished_tasks = ORM::factory("task")->where("done", "=", 1)->order_by("updated", "DESC")->find_all();
print $view;
// Do some maintenance while we're in here
db::build()->delete("caches")->where("expiration", "<>", 0)->where("expiration", "<=", time())->execute();
module::deactivate_missing_modules();
}
示例12: _auth
private function _auth($url)
{
$form = auth::get_login_form($url);
$valid = $form->validate();
if ($valid) {
$user = identity::lookup_user_by_name($form->login->inputs["name"]->value);
if (empty($user) || !identity::is_correct_password($user, $form->login->password->value)) {
log::warning("user", t("Failed login for %name", array("name" => $form->login->inputs["name"]->value)));
$form->login->inputs["name"]->add_error("invalid_login", 1);
$valid = false;
}
}
if ($valid) {
auth::login($user);
}
// Either way, regenerate the session id to avoid session trapping
Session::instance()->regenerate();
return array($valid, $form);
}
示例13: _auth
private function _auth($url)
{
$form = user::get_login_form($url);
$valid = $form->validate();
if ($valid) {
$user = ORM::factory("user")->where("name", $form->login->inputs["name"]->value)->find();
if (!$user->loaded || !user::is_correct_password($user, $form->login->password->value)) {
log::warning("user", t("Failed login for %name", array("name" => $form->login->inputs["name"]->value)));
$form->login->inputs["name"]->add_error("invalid_login", 1);
$valid = false;
}
}
if ($valid) {
user::login($user);
log::info("user", t("User %name logged in", array("name" => $user->name)));
}
// Either way, regenerate the session id to avoid session trapping
Session::instance()->regenerate();
return array($valid, $form);
}
示例14: _try_login
private function _try_login()
{
$form = $this->_login_form();
$valid = $form->validate();
if ($valid) {
$user = ORM::factory("user")->where("name", $form->login->inputs["name"]->value)->find();
if (!$user->loaded || !user::is_correct_password($user, $form->login->password->value)) {
log::warning("user", t("Failed login for %name", array("name" => $form->login->inputs["name"]->value)));
$form->login->inputs["name"]->add_error("invalid_login", 1);
$valid = false;
}
}
if ($valid) {
user::login($user);
log::info("user", t("User %name logged in", array("name" => $user->name)));
print json_encode(array("result" => "success"));
} else {
print json_encode(array("result" => "error", "form" => $form->__toString()));
}
}
示例15: auth
public function auth()
{
if (!identity::active_user()->admin) {
access::forbidden();
}
access::verify_csrf();
$form = self::_form();
$valid = $form->validate();
$user = identity::active_user();
if ($valid) {
message::success(t("Successfully re-authenticated!"));
module::event("user_auth", $user);
$continue_url = Session::instance()->get_once("continue_url", "admin");
url::redirect($continue_url);
} else {
$name = $user->name;
log::warning("user", t("Failed re-authentication for %name", array("name" => $name)));
module::event("user_auth_failed", $name);
return self::_show_form($form);
}
}