本文整理汇总了PHP中Authenticate::is_authorized方法的典型用法代码示例。如果您正苦于以下问题:PHP Authenticate::is_authorized方法的具体用法?PHP Authenticate::is_authorized怎么用?PHP Authenticate::is_authorized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authenticate
的用法示例。
在下文中一共展示了Authenticate::is_authorized方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
/**
* check administrator authentication
* role: administrator
*/
public function login()
{
if (Authenticate::is_authorized()) {
transport("dashboard");
} else {
$model_administrator = new Authenticate();
/*
* populate login data for administrator
* use setter method to registering information of authentication
*/
$model_administrator->set_email($_POST['username']);
$model_administrator->set_password($_POST['password']);
$model_administrator->set_type(Authenticate::SUPERUSER);
$login = $model_administrator->authenticate();
/*
* $login variable contain array which have 2 keys [granted] and [state]
* granted {true|false} and state {active|pending}
* just grant credential that return active and match email and password
*/
if ($login["granted"] && $login["state"] == User::ACTIVE) {
transport("dashboard");
} else {
$_SESSION['operation'] = 'error';
$_SESSION['message'] = $login["state"];
transport("administrator");
}
}
}
示例2: index
/**
* show feedback management page on administrator feature.
* role: administrator
*/
public function index()
{
if (Authenticate::is_authorized()) {
$model_player = Player::getInstance();
$model_player->get_total_player();
$model_player->unread_new_player();
$this->framework->view->page = "feedback";
$this->framework->view->content = "/backend/pages/feedback";
$this->framework->view->show("backend/template");
} else {
transport("administrator");
}
}
示例3: get_overall
/**
* export/download overall report into pdf
* role: administrator
*/
public function get_overall()
{
if (Authenticate::is_authorized()) {
$model_player = Player::getInstance();
$model_feedback = Feedback::getInstance();
$model_administrator = Administrator::getInstance();
$model_leaderboard = Leaderboard::getInstance();
$model_report = new ReportGenerator();
$model_report->get_report_overall($model_player->get_player_report(), $model_feedback->retrieve_feedback_report(), $model_administrator->retrieve_traffic_report(), $model_leaderboard->get_top10_ranking());
$model_report->print_report();
} else {
transport("administrator");
}
}
示例4: delete
/**
* delete player and all related data with this player
* role: administrator
*/
public function delete()
{
if (Authenticate::is_authorized()) {
$model_player = Player::getInstance();
$id = $_POST["id"];
if ($model_player->delete_player($id)) {
$_SESSION['operation'] = 'success';
} else {
$_SESSION['operation'] = 'error';
}
transport("player");
} else {
transport("administrator");
}
}
示例5: setting_update
/**
* update profile data from setting page.
* role: administrator
*/
public function setting_update()
{
if (Authenticate::is_authorized()) {
$model_administrator = Administrator::getInstance();
/*
* populate data from post request.
* make sure form data match with setting keys
*/
$data = [Administrator::COLUMN_STG_NAME => $_POST["website_name"], Administrator::COLUMN_STG_DESCRIPTION => $_POST["website_description"], Administrator::COLUMN_STG_KEYWORD => $_POST["website_keyword"], Administrator::COLUMN_STG_EMAIL => $_POST["website_email"], Administrator::COLUMN_STG_NUMBER => $_POST["website_number"], Administrator::COLUMN_STG_ADDRESS => $_POST["website_address"], Administrator::COLUMN_STG_FACEBOOK => $_POST["website_facebook"], Administrator::COLUMN_STG_TWITTER => $_POST["website_twitter"]];
/*
* invoke update_setting() method in administrator model.
* check the return value that indicate upload favicon and update database are success
*/
if ($model_administrator->update_setting($data)) {
$_SESSION['setting_operation'] = 'success';
} else {
$_SESSION['setting_operation'] = 'error';
}
transport("dashboard/setting");
} else {
transport("administrator");
}
}