本文整理汇总了PHP中show_403函数的典型用法代码示例。如果您正苦于以下问题:PHP show_403函数的具体用法?PHP show_403怎么用?PHP show_403使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show_403函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: route_submit
/**
* Function: submit
* Submits a post to the blog owner.
*/
public function route_submit()
{
if (!Visitor::current()->group->can("submit_article")) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to submit articles."));
}
if (!empty($_POST)) {
if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey) {
show_403(__("Access Denied"), __("Invalid security key."));
}
if (empty($_POST['body'])) {
Flash::notice(__("Post body can't be empty!"), redirect("/"));
}
if (!isset($_POST['draft'])) {
$_POST['draft'] = "true";
}
$_POST['body'] = "{$_POST['body']}\n\n\n{$_POST['name']}\n{$_POST['email']}\n";
$post = Feathers::$instances[$_POST['feather']]->submit();
if (!in_array(false, $post)) {
Flash::notice(__("Thank you for your submission. ", "submission"), "/");
}
}
if (Theme::current()->file_exists("forms/post/submit")) {
MainController::current()->display("forms/post/submit", array("feather" => $feather), __("Submit a Text Post"));
} else {
require "pages/submit.php";
}
}
示例2: main_delete_attachment
public function main_delete_attachment()
{
if (!isset($_GET['id'])) {
error(__("No ID Specified"), __("An ID is required to delete an attachment.", "attachments"));
}
$attachment = new Attachment($_GET['id']);
if ($attachment->no_results) {
error(__("Error"), __("Invalid attachment ID specified.", "attachments"));
}
if (!$attachment->deletable()) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to delete this attachment.", "attachments"));
}
Attachment::delete($attachment->id);
Flash::notice(__("Attachment deleted.", "attachments"), $_SESSION['redirect_to']);
}
示例3: admin_obscura_settings
static function admin_obscura_settings($admin)
{
if (!Visitor::current()->group->can("change_settings")) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to change settings."));
}
if (empty($_POST)) {
return $admin->display("obscura_settings");
}
if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey) {
show_403(__("Access Denied"), __("Invalid security key."));
}
$set = array(Config::current()->set("module_obscura", array("background" => $_POST['background'], "spacing" => $_POST['spacing'], "protect" => isset($_POST['protect']))));
if (!in_array(false, $set)) {
Flash::notice(__("Settings updated."), "/admin/?action=obscura_settings");
}
}
示例4: admin_cascade_settings
static function admin_cascade_settings($admin)
{
if (!Visitor::current()->group->can("change_settings")) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to change settings."));
}
if (empty($_POST)) {
return $admin->display("cascade_settings");
}
if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey) {
show_403(__("Access Denied"), __("Invalid security key."));
}
$set = array(Config::current()->set("ajax_scroll_auto", isset($_POST['auto'])));
if (!in_array(false, $set)) {
Flash::notice(__("Settings updated."), "/admin/?action=cascade_settings");
}
}
示例5: admin_emailblog_settings
static function admin_emailblog_settings($admin)
{
if (!Visitor::current()->group->can("change_settings")) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to change settings."));
}
if (empty($_POST)) {
return $admin->display("emailblog_settings");
}
if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey) {
show_403(__("Access Denied"), __("Invalid security key."));
}
$config = Config::current();
$set = array($config->set("emailblog_address", $_POST['email']), $config->set("emailblog_pass", $_POST['pass']), $config->set("emailblog_minutes", $_POST['minutes']), $config->set("emailblog_subjpass", $_POST['subjpass']), $config->set("emailblog_server", $_POST['server']));
if (!in_array(false, $set)) {
Flash::notice(__("Settings updated."), "/admin/?action=emailblog_settings");
}
}
示例6: admin_theme_editor
public function admin_theme_editor($admin)
{
if (!Visitor::current()->group->can("change_settings")) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to change settings."));
}
if (empty($_POST)) {
return $admin->display("theme_editor", array("editor" => self::admin_context($admin->context)), __("Theme Editor", "theme_editor"));
}
if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey) {
show_403(__("Access Denied"), __("Invalid security key."));
}
if (isset($_POST['file']) and isset($_POST['newcontent'])) {
$done = file_put_contents($_POST['file'], $_POST['newcontent']);
if (!empty($done)) {
Flash::notice(__("File Updated"), "/admin/?action=theme_editor&file=" . $_POST['cur_file']);
}
}
}
示例7: admin_like_settings
static function admin_like_settings($admin)
{
$config = Config::current();
if (!Visitor::current()->group->can("change_settings")) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to change settings."));
}
if (empty($_POST)) {
return $admin->display("like_settings");
}
if (!isset($_POST['hash']) or $_POST['hash'] != $config->secure_hashkey) {
show_403(__("Access Denied"), __("Invalid security key."));
}
$likeText = array();
foreach ($_POST as $key => $value) {
if (strstr($key, "likeText-")) {
$exploded_array = explode("-", $key, 2);
$likeText[$exploded_array[1]] = strip_tags(stripslashes($value));
}
}
$set = array($config->set("module_like", array("showOnFront" => isset($_POST['showOnFront']), "likeWithText" => isset($_POST['likeWithText']), "likeImage" => $_POST['likeImage'], "likeText" => $likeText)));
if (!in_array(false, $set)) {
Flash::notice(__("Settings updated."), "/admin/?action=like_settings");
}
}
示例8: show_403
* User: loveyu
* Date: 2015/12/9
* Time: 0:17
*/
require_once "common.php";
if (!is_login()) {
show_403("Please login.");
}
$path = isset($_GET['path']) ? $_GET['path'] : "";
$ext = pathinfo($path, PATHINFO_EXTENSION);
if (empty($path)) {
show_403("No empty.");
}
if (!in_ext_list($ext)) {
show_403("No support.");
}
$path = get_sys_path($path);
if (!is_file($path)) {
show_403("No found.");
}
$size = filesize($path);
header("Content-Type: image/{$ext}");
header("Content-Length: {$size}");
header("Content-Disposition:filename=" . basename($path));
flush();
$fp = fopen($path, "r");
while (!feof($fp)) {
echo fread($fp, 65536);
flush();
}
fclose($fp);
示例9: admin_manage_comments
static function admin_manage_comments($admin)
{
if (!Comment::any_editable() and !Comment::any_deletable()) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to manage any comments.", "comments"));
}
fallback($_GET['query'], "");
list($where, $params) = keywords($_GET['query'], "body LIKE :query");
$where[] = "status != 'spam'";
$visitor = Visitor::current();
if (!$visitor->group->can("edit_comment", "delete_comment", true)) {
$where["user_id"] = $visitor->id;
}
$admin->display("manage_comments", array("comments" => new Paginator(Comment::find(array("placeholders" => true, "where" => $where, "params" => $params)), 25)));
}
示例10: admin_manage_dropbox
static function admin_manage_dropbox($admin)
{
if (!Visitor::current()->group->can("add_post", "add_draft")) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to create posts."));
}
if (empty($_POST)) {
return $admin->display("manage_dropbox");
}
$config = Config::current();
if (!isset($config->module_dropbox["oauth_token"])) {
Flash::notice(__("You need to authorize Dropbox first.", "dropbox"), "/admin/?action=dropbox_settings");
}
$data = json_decode(file_get_contents("http://chyrp.net/api/1/dropboxsync.php?keys"), true);
$app_key = $data["key"];
$app_secret = $data["secret"];
$storage = new \Dropbox\OAuth\Storage\Session();
$OAuth = new \Dropbox\OAuth\Consumer\Curl($app_key, $app_secret, $storage);
$dropbox = new \Dropbox\API($OAuth);
$delta = $dropbox->delta();
$delta = $delta["body"];
if ($delta->cursor != $config->module_dropbox["cursor"]) {
if (count($delta->entries) > 0) {
foreach ($delta->entries as $entry) {
$tmpfname = tempnam("/tmp", "md");
$file = $dropbox->getFile(ltrim($entry[0], "/"), $tmpfname);
$post = new FrontMatter($file["name"]);
$date = explode(".", ltrim($entry[0], "/"));
$values = array("title" => $post->fetch("title"), "body" => $post->fetch("content"));
# Set defaults
fallback($clean, oneof($post->fetch("slug"), strtolower(str_replace(" ", "-", $post->fetch("title")))));
fallback($url, Post::check_url($clean));
fallback($pinned, oneof($post->fetch("pinned"), 0));
fallback($status, oneof($post->fetch("status"), "public"));
fallback($date, oneof(datetime($post->fetch("date")), datetime($date[0])));
$post = Post::add($values, $clean, $url, "text", 1, $pinned, $status, datetime($post->fetch("date")), datetime($post->fetch("date")), false);
}
}
$set = array($config->set("module_dropbox", array("oauth_token_secret" => $config->module_dropbox['oauth_token_secret'], "oauth_token" => $config->module_dropbox['oauth_token'], "uid" => $config->module_dropbox['uid'], "cursor" => $delta->cursor)));
if (!in_array(false, $set)) {
Flash::notice(__("Post imported successfully.", "dropbox"), "/admin/?action=manage_posts");
}
}
}
示例11: admin_delete_category
public function admin_delete_category($admin)
{
if (!Visitor::current()->group()->can("manage_categorize")) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to manage categories.", "categorize"));
}
Category::deleteCategory($_REQUEST['id']);
Flash::notice(__("Category deleted.", "categorize"), "/admin/?action=manage_category");
}
示例12: drafts
/**
* Function: drafts
* Grabs the posts for viewing the Drafts lists.
*/
public function drafts()
{
$visitor = Visitor::current();
if (!$visitor->group->can("view_own_draft", "view_draft")) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to view drafts."));
}
$posts = new Paginator(Post::find(array("placeholders" => true, "where" => array("status" => "draft", "user_id" => $visitor->id))), $this->post_limit);
$this->display(array("pages/drafts", "pages/index"), array("posts" => $posts), __("Drafts"));
}
示例13: admin_bulk_tag
public function admin_bulk_tag($admin)
{
if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey) {
show_403(__("Access Denied"), __("Invalid security key."));
}
if (empty($_POST['name']) or empty($_POST['post'])) {
redirect("/admin/?action=manage_tags");
}
$sql = SQL::current();
foreach (array_map("trim", explode(",", $_POST['name'])) as $tag) {
foreach ($_POST['post'] as $post_id) {
$post = new Post($post_id);
if (!$post->editable()) {
continue;
}
$tags = $sql->select("post_attributes", "value", array("name" => "tags", "post_id" => $post_id));
if ($tags and $value = $tags->fetchColumn()) {
$tags = YAML::load($value);
} else {
$tags = array();
}
$tags[$tag] = sanitize($tag);
$sql->replace("post_attributes", array("post_id", "name"), array("name" => "tags", "value" => YAML::dump($tags), "post_id" => $post_id));
}
}
Flash::notice(__("Posts tagged.", "tags"), "/admin/?action=manage_tags");
}
示例14: header
header("HTTP/1.1 404 Not Found");
$trigger->call("not_found");
exit;
}
$main->display("feathers/" . $post->feather, array("post" => $post, "ajax_reason" => $reason));
break;
case "preview":
if (empty($_POST['content'])) {
break;
}
$trigger->filter($_POST['content'], array("preview_" . $_POST['feather'], "preview"), $_POST['field'], $_POST['feather']);
echo "<h2 class=\"preview-header\">" . __("Preview") . "</h2>\n" . "<div class=\"preview-content\">" . $_POST['content'] . "</div>";
break;
case "check_confirm":
if (!$visitor->group->can("toggle_extensions")) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to enable/disable extensions."));
}
$dir = $_POST['type'] == "module" ? MODULES_DIR : FEATHERS_DIR;
$info = YAML::load($dir . "/" . $_POST['check'] . "/info.yaml");
fallback($info["confirm"], "");
if (!empty($info["confirm"])) {
echo __($info["confirm"], $_POST['check']);
}
break;
case "organize_pages":
foreach ($_POST['parent'] as $id => $parent) {
$sql->update("pages", array("id" => $id), array("parent_id" => $parent));
}
foreach ($_POST['page_list'] as $index => $page) {
$sql->update("pages", array("id" => $page), array("list_order" => $index));
}
示例15: exit
<?php
if (version_compare(PHP_VERSION, "5.3.0", "<")) {
exit("Chyrp requires PHP 5.3.0 or greater.");
}
require_once "includes/common.php";
# Prepare the controller.
$main = MainController::current();
# Parse the route.
$route = Route::current($main);
# Check if the user can view the site.
if (!$visitor->group->can("view_site") and !in_array($route->action, array("login", "logout", "register", "lost_password"))) {
if ($trigger->exists("can_not_view_site")) {
$trigger->call("can_not_view_site");
} else {
show_403(__("Access Denied"), __("You are not allowed to view this site."));
}
}
# Execute the appropriate Controller responder.
$route->init();
# If the route failed or nothing was displayed, check for:
# 1. Module-provided pages.
# 2. Feather-provided pages.
# 3. Theme-provided pages.
if (!$route->success and !$main->displayed) {
$displayed = false;
foreach ($config->enabled_modules as $module) {
if (file_exists(MODULES_DIR . "/" . $module . "/pages/" . $route->action . ".php")) {
$displayed = (require MODULES_DIR . "/" . $module . "/pages/" . $route->action . ".php");
}
}