本文整理汇总了PHP中do_redirect函数的典型用法代码示例。如果您正苦于以下问题:PHP do_redirect函数的具体用法?PHP do_redirect怎么用?PHP do_redirect使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了do_redirect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view_init
/**
* Initialize view variables and check permissions.
* @param int $view_id id for the view
*/
function view_init($view_id)
{
global $views, $error, $login;
global $ALLOW_VIEW_OTHER, $is_admin;
global $view_name, $view_type, $custom_view;
//set this to prove we in are inside a custom view page
$custom_view = true;
if ((empty($ALLOW_VIEW_OTHER) || $ALLOW_VIEW_OTHER == 'N') && !$is_admin) {
// not allowed...
send_to_preferred_view();
}
if (empty($view_id)) {
do_redirect('views.php');
}
// Find view name in $views[]
$view_name = '';
$view_type = '';
$viewcnt = count($views);
for ($i = 0; $i < $viewcnt; $i++) {
if ($views[$i]['cal_view_id'] == $view_id) {
$view_name = htmlspecialchars($views[$i]['cal_name']);
$view_type = $views[$i]['cal_view_type'];
}
}
// If view_name not found, then the specified view id does not
// belong to current user.
if (empty($view_name)) {
$error = print_not_auth(34);
}
}
示例2: redirect_away
function redirect_away()
{
if (array_key_exists('return', $_GET)) {
do_redirect($_GET['return']);
} else {
do_redirect('');
}
# index.php
exit;
}
示例3: set_post
//check if form submitted
if (!isset($_POST['email'])) {
return false;
}
//variables not set yet
//get variables
$email = set_post('email', '');
if (empty($email) || !email_is_valid($email)) {
notices_set('Invalid email.', 'error');
return false;
}
//check if it is valid
$sql = sql_query(" SELECT id FROM `users` WHERE email='{$email}' LIMIT 1 ");
if (sql_count($sql) <= 0) {
notices_set('Invalid email.', 'error');
return false;
}
$data = sql_fetch($sql);
//create code
$confirm = confirm_token_create($email);
//delete all tokens for that email
sql_query(" DELETE FROM `password_reset` WHERE user='{$data['id']}' LIMIT 1 ");
//insert
sql_query(" INSERT INTO `password_reset` (user, token) VALUES('{$data['id']}' , '{$confirm}') \n\t\t\tON DUPLICATE KEY UPDATE token='{$confirm}' ");
//send email
email_send('password_reset', 'Planling Password Reset', array($email => $email), array('{{%LINK%}}' => 'http://' . MAIN_URL . '/password?e=' . $email . '&t=' . $confirm));
//set message
notices_set('Instructions on how to reset your password has been sent to <strong>' . $email . '</strong>.', 'success');
//redirect user
do_redirect();
示例4: do_redirect
<?php
require 'inc.bootstrap.php';
if ( is_logged_in(false) && isset($_SESSION['series']) ) {
unset($_SESSION['series']);
}
do_redirect('login');
示例5: pathinfo
// $icon_props = getimagesize ( $file['tmp_name'] );
// print_r ($icon_props );
$path_parts = pathinfo($_SERVER['SCRIPT_FILENAME']);
$fullIcon = $path_parts['dirname'] . '/' . $icon_path . 'cat-' . $id . '.gif';
renameIcon($id);
$file_result = move_uploaded_file($file['tmp_name'], $fullIcon);
// echo "Upload Result:" . $file_result;
} else {
if ($file['size'] > $icon_max_size) {
$error = translate('File size exceeds maximum.');
} else {
if ($file['type'] != 'image/gif') {
$error = translate('File is not a gif image.');
}
}
}
}
// Copy icon if local file specified.
$urlname = getPostvalue('urlname');
if (!empty($urlname) && file_exists($icon_path . $urlname)) {
copy($icon_path . $urlname, $icon_path . 'cat-' . $id . '.gif');
}
}
}
}
}
if (empty($error)) {
do_redirect('category.php');
}
print_header();
echo print_error($error) . print_trailer();
示例6: do_redirect
<?php
include_once 'includes/init.php';
$USERS_PER_TABLE = 6;
if ($allow_view_other == "N" && !$is_admin) {
// not allowed...
do_redirect("{$STARTVIEW}.php");
}
// Find view name in $views[]
$view_name = "";
for ($i = 0; $i < count($views); $i++) {
if ($views[$i]['cal_view_id'] == $id) {
$view_name = $views[$i]['cal_name'];
}
}
$INC = array('js/popups.php');
print_header($INC);
// Initialise la date au premier du mois en cours
if ($timeb == 0) {
$date = substr($date, 0, 6) . "01";
}
set_today($date);
// Week timebar
if ($timeb == 1) {
$next = mktime(3, 0, 0, $thismonth, $thisday + 7, $thisyear);
} else {
$next = mktime(3, 0, 0, $thismonth + 1, $thisday, $thisyear);
}
$nextyear = date("Y", $next);
$nextmonth = date("m", $next);
$nextday = date("d", $next);
示例7: require_valide_referring_url
* event as deleted.
*
* Security:
* Events will only be deleted if they were created by the selected
* user. Events where the user was a participant (but not did not
* create) will remain unchanged.
*
*/
include_once 'includes/init.php';
require_valide_referring_url();
// Set this to true do show the SQL at the bottom of the page
$purgeDebug = false;
$sqlLog = '';
if (!$is_admin) {
// must be admin...
do_redirect('index.php');
exit;
}
$ALL = 0;
$previewStr = translate('Preview');
$allStr = translate('All');
$purgingStr = translate('Purging events for');
$deleteStr = translate('Delete');
$delete = getPostValue('delete');
$do_purge = false;
if (!empty($delete)) {
$do_purge = true;
}
$purge_all = getPostValue('purge_all');
$purge_deleted = getPostValue('purge_deleted');
$end_year = getPostValue('end_year');
示例8: reset_language
if ($send_user_mail == "Y" && strlen($tempemail) && $send_email != "N") {
if ($GLOBALS['LANGUAGE'] != $user_language && !empty($user_language) && $user_language != 'none') {
reset_language($user_language);
}
$msg = translate("Hello") . ", " . $tempfullname . ".\n\n" . translate("An appointment has been rejected by") . " " . $login_fullname . ". " . translate("The subject was") . " \"" . $name . " \"\n" . translate("The description is") . " \"" . $description . "\"\n" . translate("Date") . ": " . date_to_str($fmtdate) . "\n" . (empty($hour) && empty($minute) ? "" : translate("Time") . ": " . display_time($hour * 10000 + $minute * 100)) . "\n\n\n";
if (!empty($server_url)) {
$url = $server_url . "view_entry.php?id=" . $id;
$msg .= "\n\n" . $url;
}
$from = $email_fallback_from;
if (strlen($login_email)) {
$from = $login_email;
}
$extra_hdrs = "From: {$from}\r\nX-Mailer: " . translate("Title");
mail($tempemail, translate($application_name) . " " . translate("Notification") . ": " . $name, html_to_8bits($msg), $extra_hdrs);
activity_log($id, $login, $partlogin[$i], $LOG_NOTIFICATION, "Event rejected by {$app_user}");
}
}
}
if (empty($error)) {
if ($ret == "list") {
do_redirect("list_unapproved.php?user={$app_user}");
} else {
do_redirect("view_entry.php?id={$id}&user={$app_user}");
}
exit;
}
print_header();
echo "<h2>" . translate("Error") . "</h2>\n";
echo "<p>" . $error . "</p>\n";
print_trailer();
示例9: dbi_free_result
if ($event_owner == $login || user_is_assistant($login, $event_owner)) {
$can_delete = true;
}
}
dbi_free_result($res);
}
}
if (empty($error) && !$can_delete) {
$error = print_not_auth(6);
}
if (empty($error) && $can_delete) {
if (!dbi_execute('DELETE FROM webcal_blob WHERE cal_blob_id = ?', array($blid))) {
$error = db_error();
} else {
if ($event_id > 0) {
$removeStr = translate('Removed');
if ($type == 'A') {
activity_log($event_id, $login, $login, LOG_ATTACHMENT, $removeStr . ': ' . $name);
} elseif ($type == 'C') {
activity_log($event_id, $login, $login, LOG_COMMENT, $removeStr);
}
}
if ($event_id > 0) {
do_redirect('view_entry.php?id=' . $event_id);
}
do_redirect(get_preferred_view());
}
}
// Some kind of error...
print_header();
echo print_error($error) . print_trailer();
示例10: send_to_preferred_view
function send_to_preferred_view($indate = '', $args = '')
{
do_redirect(get_preferred_view($indate, $args));
}
示例11: dbi_fetch_row
if ($res) {
$row = dbi_fetch_row($res);
$name = $row[0];
dbi_free_result($res);
}
for ($i = 0; $i < count($partlogin); $i++) {
// does this user want email for this?
$send_user_mail = get_pref_setting($partlogin[$i], "EMAIL_EVENT_REJECTED");
user_load_variables($partlogin[$i], "temp");
if ($send_user_mail == "Y" && strlen($tempemail) && $send_email != "N") {
$fmtdate = sprintf("%04d%02d%02d", $year, $month, $day);
$msg = translate("Hello") . ", " . $tempfullname . ".\n\n" . translate("An appointment has been rejected by") . " " . $login_fullname . ". " . translate("The subject was") . " \"" . $name . " \"\n" . translate("The description is") . " \"" . $description . "\"\n" . translate("Date") . ": " . date_to_str($fmtdate) . "\n" . (empty($hour) && empty($minute) ? "" : translate("Time") . ": " . display_time($hour * 10000 + $minute * 100)) . "\n\n\n";
if (!empty($server_url)) {
$url = $server_url . "view_entry.php?id=" . $id;
$msg .= "\n\n" . $url;
}
$from = $email_fallback_from;
if (strlen($login_email)) {
$from = $login_email;
}
$extra_hdrs = "From: {$from}\nX-Mailer: " . translate("Title");
mail($tempemail, translate($application_name) . " " . translate("Notification") . ": " . $name, html_to_8bits($msg), $extra_hdrs);
activity_log($id, $login, $partlogin[$i], $LOG_NOTIFICATION, "Event rejected by {$app_user}");
}
}
}
if ($ret == "list") {
do_redirect("list_unapproved.php");
} else {
do_redirect("view_entry.php?id={$id}");
}
示例12: do_redirect
// The source code packaged with this file is Free Software, Copyright (C) 2012 by
// Ricardo Galli <gallir at gallir dot com>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
// Use the alternate server for api, if it exists
//$globals['alternate_db_server'] = 'backend';
include '../config.php';
$db->connect_timeout = 3;
if (!$current_user->user_id) {
die;
}
if (!empty($_GET['redirect'])) {
do_redirect($_GET['redirect']);
exit(0);
}
header('Content-Type: application/json; charset=utf-8');
http_cache(5);
$notifications = new stdClass();
$notifications->posts = (int) Post::get_unread_conversations($current_user->user_id);
$notifications->comments = (int) Comment::get_unread_conversations($current_user->user_id);
$notifications->privates = (int) PrivateMessage::get_unread($current_user->user_id);
$notifications->friends = count(User::get_new_friends($current_user->user_id));
$notifications->total = $notifications->posts + $notifications->privates + $notifications->friends + $notifications->comments;
echo json_encode($notifications);
function do_redirect($type)
{
global $globals, $current_user;
$url = '/';
示例13: get_preferred_view
$page = get_preferred_view();
if (access_can_view_page($page)) {
send_to_preferred_view();
} else {
// User's preferences need to be updated to their preferred view.
if (access_can_access_function(ACCESS_PREFERENCES)) {
do_redirect('pref.php');
}
// User does not have access to preferences...
// So, we need to pick another page.
if (access_can_access_function(ACCESS_WEEK)) {
do_redirect('week.php');
} elseif (access_can_access_function(ACCESS_MONTH)) {
do_redirect('month.php');
} elseif (access_can_access_function(ACCESS_DAY)) {
do_redirect('day.php');
} elseif (access_can_access_function(ACCESS_YEAR)) {
do_redirect('year.php');
}
// At this point, this user cannot view the preferred view in their
// preferences (and they cannot update their preferences), and they cannot
// view any of the standard day/week/month/year pages. All that's left is a
// custom view that is either created by them or a global view.
if (count($views) > 0) {
do_redirect($views[0]['url']);
}
// No views either? You gotta be kidding me! ;-)
}
} else {
do_redirect('month.php');
}
示例14: translate
} else {
$error = translate("Database error") . ": " . dbi_error();
}
}
}
# update user list
if ($error == "") {
dbi_query("DELETE FROM webcal_group_user WHERE cal_group_id = {$id}");
for ($i = 0; $i < count($users); $i++) {
dbi_query("INSERT INTO webcal_group_user ( cal_group_id, cal_login ) " . "VALUES ( {$id}, '{$users[$i]}' )");
}
}
}
}
if ($error == "") {
do_redirect("groups.php");
}
?>
<HTML>
<HEAD>
<TITLE><?php
etranslate($application_name);
?>
</TITLE>
<?php
include "includes/styles.php";
?>
</HEAD>
<BODY BGCOLOR="<?php
echo $BGCOLOR;
?>
示例15: send_to_preferred_view
/**
* Sends a redirect to the user's preferred view.
*
* The user's preferred view is stored in the $STARTVIEW global variable. This
* is loaded from the user preferences (or system settings if there are no user
* prefererences.)
*
* @param string $indate Date to pass to preferred view in YYYYMMDD format
* @param string $args Arguments to include in the URL (such as "user=joe")
*/
function send_to_preferred_view($indate = "", $args = "")
{
$url = get_preferred_view($indate, $args);
do_redirect($url);
}