本文整理汇总了PHP中Functions::RedirectIf方法的典型用法代码示例。如果您正苦于以下问题:PHP Functions::RedirectIf方法的具体用法?PHP Functions::RedirectIf怎么用?PHP Functions::RedirectIf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Functions
的用法示例。
在下文中一共展示了Functions::RedirectIf方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
<?php
// Include required files
include_once dirname(dirname(__FILE__)) . '/cc-core/config/admin.bootstrap.php';
App::LoadClass('User');
// Establish page variables, objects, arrays, etc
Functions::RedirectIf($logged_in = User::LoginCheck(), HOST . '/login/');
$admin = new User($logged_in);
Functions::RedirectIf(User::CheckPermissions('admin_panel', $admin), HOST . '/myaccount/');
$message = null;
$page_title = 'Plugins';
$plugin_list = array();
$installed_plugins = unserialize(Settings::Get('installed_plugins'));
$enabled_plugins = Plugin::GetEnabledPlugins();
### Handle "Delete" plugin if requested
if (!empty($_GET['delete']) && !ctype_space($_GET['delete'])) {
if (Plugin::ValidPlugin($_GET['delete'])) {
// Disable plugin if applicable
$key = array_search($_GET['delete'], $enabled_plugins);
if ($key !== false) {
unset($enabled_plugins[$key]);
Settings::Set('enabled_plugins', serialize($enabled_plugins));
}
// Uninstall plugin
$key = array_search($_GET['delete'], $installed_plugins);
if ($key !== false) {
if (method_exists($_GET['delete'], 'Uninstall')) {
call_user_func(array($_GET['delete'], 'Uninstall'));
}
unset($installed_plugins[$key]);
Settings::Set('installed_plugins', serialize($installed_plugins));
示例2: dirname
include_once dirname(dirname(__FILE__)) . '/config/bootstrap.php';
App::LoadClass('User');
App::LoadClass('Avatar');
### Retrieve video information
if (!isset($_POST['token'], $_POST['timestamp'])) {
App::Throw404();
}
session_write_close();
session_id($_POST['token']);
session_start();
// Validate upload key
$upload_key = md5(md5($_POST['timestamp']) . SECRET_KEY);
if (!isset($_SESSION['upload_key']) || $_SESSION['upload_key'] != $upload_key) {
App::Throw404();
}
Functions::RedirectIf($logged_in = User::LoginCheck(), HOST . '/login/');
$user = new User($logged_in);
try {
### Verify upload was made
if (empty($_FILES) || !isset($_FILES['upload']['name'])) {
throw new Exception(Language::GetText('error_uploadify_empty'));
}
### Check for upload errors
if ($_FILES['upload']['error'] != 0) {
App::Alert('Error During Avatar Upload', 'There was an HTTP FILE POST error (Error code #' . $_FILES['upload']['error'] . ').');
throw new Exception(Language::GetText('error_uploadify_system', array('host' => HOST)));
}
### Validate filesize
if ($_FILES['upload']['size'] > 1024 * 30 || filesize($_FILES['upload']['tmp_name']) > 1024 * 30) {
throw new Exception(Language::GetText('error_uploadify_filesize'));
}
示例3: dirname
<?php
// Include required files
include_once dirname(dirname(dirname(__FILE__))) . '/config/bootstrap.php';
App::LoadClass('User');
App::LoadClass('Message');
App::LoadClass('Pagination');
// Establish page variables, objects, arrays, etc
View::InitView('message_inbox');
Plugin::Trigger('message_inbox.start');
Functions::RedirectIf(View::$vars->logged_in = User::LoginCheck(), HOST . '/login/');
View::$vars->user = new User(View::$vars->logged_in);
$records_per_page = 20;
$url = HOST . '/myaccount/message/inbox';
View::$vars->message = null;
/***********************
Handle form if submitted
***********************/
// Delete message (Request came from this page)
if (isset($_POST['submitted'])) {
// Verify messages were chosen
if (!empty($_POST['delete']) && is_array($_POST['delete'])) {
foreach ($_POST['delete'] as $value) {
$data = array('recipient' => View::$vars->user->user_id, 'message_id' => $value);
$message_id = Message::Exist($data);
if ($message_id) {
Message::Delete($message_id);
Plugin::Trigger('message_inbox.purge_single_message');
}
}
View::$vars->message = Language::GetText('success_messages_purged');
示例4: dirname
<?php
// Include required files
include_once dirname(dirname(__FILE__)) . '/config/bootstrap.php';
App::LoadClass('User');
App::LoadClass('Mail');
// Establish page variables, objects, arrays, etc
View::InitView('register');
Plugin::Trigger('register.start');
View::$vars->logged_in = User::LoginCheck();
Functions::RedirectIf(!View::$vars->logged_in, HOST . '/myaccount/');
$resp = NULL;
$pass1 = NULL;
$pass2 = NULL;
View::$vars->message = null;
View::$vars->data = array();
View::$vars->errors = array();
/***********************
Handle form if submitted
***********************/
if (isset($_POST['submitted'])) {
// Validate Username
if (!empty($_POST['username']) && !ctype_space($_POST['username'])) {
if (!User::Exist(array('username' => $_POST['username']))) {
View::$vars->data['username'] = htmlspecialchars(trim($_POST['username']));
} else {
View::$vars->errors['username'] = Language::GetText('error_username_unavailable');
}
} else {
View::$vars->errors['username'] = Language::GetText('error_username');
}