本文整理汇总了PHP中carl_make_redirect函数的典型用法代码示例。如果您正苦于以下问题:PHP carl_make_redirect函数的具体用法?PHP carl_make_redirect怎么用?PHP carl_make_redirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了carl_make_redirect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run()
{
if (isset($_REQUEST['kill_cache'])) {
$this->clear_page_cache();
$redirect = carl_make_redirect(array('kill_cache' => ''));
header("Location: " . $redirect);
exit;
}
parent::run();
}
示例2: set_inline_editing_availability
/**
* Set the inline editing status in the session and redirect
*/
function set_inline_editing_availability()
{
$inline_edit =& get_reason_inline_editing($this->page_id);
if ($this->request['inline_editing_availability'] == 'enable') {
$inline_edit->enable();
} else {
$inline_edit->disable();
}
$redirect = carl_make_redirect(array('inline_editing_availability' => ''));
header('Location: ' . $redirect);
exit;
}
示例3: run
function run()
{
if (($e = new entity($this->admin_page->id)) && reason_is_entity($e, true)) {
$name = 'Copy of ' . $e->get_value('name');
if ($new_entity_id = duplicate_entity($this->admin_page->id, false, false, array('name' => $name, 'unique_name' => '', 'last_modified_by' => $this->admin_page->user_id, 'state' => 'Pending', 'new' => '1'))) {
header('Location: ' . carl_make_redirect(array('cur_module' => 'Editor', 'id' => $new_entity_id)));
} else {
echo '<p>Unable to duplicate entity.</p>';
return false;
}
} else {
echo '<p>Duplicate called with invalid entity ID.</p>';
return false;
}
}
示例4: init
function init()
{
$this->request = carl_get_request();
// If obtained via post we need to manually decode the URL - all current uses of this pass it via get.
if (isset($_POST['requested_url'])) {
$this->request['requested_url'] = urldecode($this->request['requested_url']);
}
$this->admin_page->title = 'Access Denied';
if ($requested_site_id = $this->get_requested_site_id()) {
// lets double check whether the user has access
if (user_can_edit_site($this->admin_page->user_id, $requested_site_id)) {
header('Location: ' . $this->get_destination_url_with_user_id($this->admin_page->user_id));
exit;
} else {
$this->can_pose_as_other_user = reason_user_has_privs($this->admin_page->user_id, 'pose_as_other_user');
$this->has_master_admin_edit_access = user_can_edit_site($this->admin_page->user_id, id_of('master_admin'));
}
} else {
$redirect = carl_make_redirect(array('cur_module' => '', 'requested_url' => '', 'site_id' => ''));
header('Location: ' . $redirect);
exit;
}
}
示例5: where_to
function where_to(&$disco)
{
return carl_make_redirect(array());
}
示例6: run
/**
* Run the Controller
* @access public
* @return void
*/
function run()
{
$this->determine_step();
if (empty($this->_request[$this->_step_var_name])) {
if ($this->preserve_query_string) {
$redirect = carl_make_redirect(array($this->_step_var_name => $this->_current_step));
header('Location: ' . $redirect);
exit;
} else {
header('Location: ' . $this->_base_url . '?' . $this->_step_var_name . '=' . $this->_current_step);
exit;
}
} elseif (!empty($this->_session_existed) and $this->_first_run) {
// session timed out. we know this because the cookie or SID exists but PHP could not find a
// session file.
trigger_error('Session has expired', E_USER_NOTICE);
$_SESSION['timeout_msg'] = true;
//! This should be a little more descriptive if we're going to be timing out more often, don't you think? Maybe preserve cur_module? Or site_id if they exist?
header('Location: ' . $this->_base_url . '?' . $this->_step_var_name . '=' . $this->_get_start_step());
exit;
} elseif ($this->_request[$this->_step_var_name] != $this->_current_step) {
// This error is no longer being triggered because it's not really an error.
//trigger_error( 'Strange behavior: requested multipage form step not the same as the actual step being displayed. Probably due to session timeout. Client browser headered to start of form.',E_USER_NOTICE );
header('Location: ' . $this->_base_url . '?' . $this->_step_var_name . '=' . $this->_get_start_step());
exit;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// intercept posts, store in session, redirect to a new page, send disco the sessioned _POST
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$this->intercept_post();
$final_step = $this->_current_step == $this->_get_final_step();
// get the actual object that has already been instantiated.
// we know current step is good since validate_step has run.
$f =& $this->forms[$this->_current_step];
$f->set_request($this->_request);
$actions = array();
if (!empty($this->transitions[$this->_current_step])) {
$trans = $this->transitions[$this->_current_step];
if (!empty($trans['step_decision'])) {
$trans_type = !empty($trans['step_decision']['type']) ? $trans['step_decision']['type'] : '';
switch ($trans_type) {
case 'user':
$next_steps = $trans['next_steps'];
foreach ($next_steps as $action => $action_info) {
if (!empty($action_info['label'])) {
$label = $action_info['label'];
} else {
$label = $action;
}
$actions[$action] = $label;
}
break;
case 'method':
$actions['next'] = $this->default_next_text;
break;
default:
trigger_error('Unknown transition step decision type. How is that for programmer jargon?');
break;
}
} else {
$actions['next'] = $this->default_next_text;
}
} else {
$actions['next'] = $this->default_next_text;
}
if ($this->show_back_button && !empty($this->_path)) {
$s = $this->get_previous_step();
if (!empty($this->transitions[$s]['back_button_text'])) {
$actions['back'] = $this->transitions[$s]['back_button_text'];
} else {
$actions['back'] = $this->default_back_text;
}
}
if ($final_step) {
if (!empty($this->transitions[$this->_current_step]['final_button_text'])) {
$actions['next'] = $this->transitions[$this->_current_step]['final_button_text'];
} else {
$actions['next'] = $this->default_final_text;
}
}
$f->actions = $actions;
$f->run_load_phase();
if (!empty($f->chosen_action)) {
if ($f->chosen_action == 'back') {
$form_jump = $this->_remove_last_step_from_path();
}
// Save the last action; otherwise, it's not available to forms.
$this->session->set('chosen_action', $f->chosen_action);
}
if (empty($form_jump)) {
$f->run_process_phase();
// $processed was added to FormStep to see if the form is done.
//.........这里部分代码省略.........
示例7: where_to
function where_to()
{
if ($this->get_chosen_action() == '0') {
return @carl_make_redirect(array("savedTime" => time()));
} else {
return carl_make_redirect(array('cur_module' => 'Lister', 'state' => 'live'));
}
}
示例8: _redirect_old_style_url
/**
* People may have admin URLs bookmarked from the old form module ...
*
* ... in this case a permanent redirect is sent to the correct admin URL
*
* This method is included only for backwards compatibility -
* the query string parameter data_view should now be form_admin_view
*
* @access private
*/
function _redirect_old_style_url()
{
if (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'data_view') {
$redirect = carl_make_redirect(array('mode' => '', 'form_admin_view' => 'true'));
header("Location: " . $redirect);
exit;
}
if (isset($_REQUEST['thor_success']) && $_REQUEST['thor_success'] == 'true') {
$redirect = carl_make_redirect(array('thor_success' => '', 'submission_key' => 'true'));
header("Location: " . $redirect);
exit;
}
}
示例9: init
/**
* Initializes the admin page.
*
* Identifies which admin module to use, instantiates, and initializes it.
* This method uses the $GLOBALS['_reason_admin_modules'] array defined in admin_module.php
* to determine which module to run.
*
* @return true if complete, false if used could not be authenticated
*/
function init()
{
if ($this->authenticate() == false) {
return false;
}
$this->load_params();
$this->head_items = new HeadItems();
$this->set_head_items();
if (!empty($this->cur_module)) {
if (array_key_exists($this->cur_module, $GLOBALS['_reason_admin_modules']) && !empty($GLOBALS['_reason_admin_modules'][$this->cur_module]['file'])) {
reason_include_once('classes/admin/modules/' . $GLOBALS['_reason_admin_modules'][$this->cur_module]['file']);
if (!empty($GLOBALS['_reason_admin_modules'][$this->cur_module]['class']) && class_exists($GLOBALS['_reason_admin_modules'][$this->cur_module]['class'])) {
$module_name = $GLOBALS['_reason_admin_modules'][$this->cur_module]['class'];
} else {
trigger_error('Class ' . $this->cur_module . 'Module not found');
}
}
}
if (empty($module_name)) {
if ($this->site_id) {
if ($this->type_id) {
if ($this->id or $this->cur_module == 'Editor') {
$redirect = carl_make_redirect(array('cur_module' => 'Editor'));
header('Location: ' . $redirect);
die;
} else {
$redirect = carl_make_redirect(array('cur_module' => 'Lister'));
header('Location: ' . $redirect);
die;
}
} else {
reason_include_once('classes/admin/modules/' . $GLOBALS['_reason_admin_modules']['Site']['file']);
$module_name = $GLOBALS['_reason_admin_modules']['Site']['class'];
}
} else {
reason_include_once('classes/admin/modules/' . $GLOBALS['_reason_admin_modules']['Default']['file']);
$module_name = $GLOBALS['_reason_admin_modules']['Default']['class'];
}
}
if (class_exists($module_name)) {
$this->module_name = $module_name;
$this->module = new $module_name($this);
$this->module->set_head_items($this->head_items);
if ($this->module->check_admin_token() && $this->invalid_admin_token()) {
$this->module->init_invalid_admin_token();
} else {
$this->module->init();
}
} else {
trigger_error('Could not determine a module to run in the admin page init method.', HIGH);
}
return true;
}
示例10: _where_to_policy_metadata
function _where_to_policy_metadata(&$disco)
{
if( $disco->get_chosen_action() == 'save' )
{
$url = get_current_url();
$url .= '#metadataEdit';
}
else
{
$inline_edit =& get_reason_inline_editing($this->page_id);
$deactivation_params = $inline_edit->get_deactivation_params($this);
$deactivation_params['edit_id'] = '';
$url = carl_make_redirect($deactivation_params);
}
return $url;
}
示例11: delete_registrant
/**
* Delete the registrant indicated in the delete_registrant request value
*
* @param object $event event entity
* @return void
*/
function delete_registrant($event)
{
$slot = get_entity_by_id($this->request['slot_id']);
$registrants = explode(';', $slot['registrant_data']);
$changed = false;
foreach($registrants as $key=>$registrant)
{
if(md5($registrant) == $this->request['delete_registrant'])
{
$old_data[] = $registrants[$key];
unset($registrants[$key]);
$changed = true;
}
}
if($changed)
{
$values = array ( 'registrant_data' => implode(';', $registrants));
$update_user = $this->user_is_slot_admin($event);
if(empty($update_user))
$update_user = get_user_id('event_agent');
$successful_update = reason_update_entity( $this->request['slot_id'], $update_user, $values );
if($successful_update)
{
// redirect on successful delete
$link = carl_make_redirect(array('delete_registrant' => ''));
header("Location: " . $link );
exit;
}
else
{
$this->slot_registration_admin_messages .= '<h4>Sorry</h4><p>Deletion unsuccesful. The Web Services group has been notified of this error - please try again later.</p>';
$this->send_slot_deletion_error_message($event, print_r($old_data, true) );
}
}
else
$this->slot_registration_admin_messages .= '<h4>Sorry</h4><p>Could not find registrant to delete - most likely they were already deleted.</p>';
}
示例12: verify_parameters
/**
* Make sure conditions are okay for the lister to run and if not, redirect appropriately
*/
function verify_parameters()
{
if (empty($this->admin_page->site_id) && $this->admin_page->cur_module == 'Lister') {
header('Location: ' . carl_make_redirect(array('cur_module' => '', 'site_id' => '')));
exit;
}
if (empty($this->admin_page->type_id) && $this->admin_page->cur_module == 'Lister') {
header('Location: ' . carl_make_redirect(array('cur_module' => '', 'type_id' => '')));
exit;
}
}
示例13: _build_features
//.........这里部分代码省略.........
else $features[$feature_id]->set_value('av_id',"none");
}
//shuffle the features if set to true
//note that keys are preserved in the new
//shuffled feature array
if($this->params['shuffle']==true)
{
$shuffled_results=array();
$temps=array();
$temps=$features;
shuffle($temps);
foreach($temps as $temp)
{
$id=$temp->get_value('id');
$shuffled_results[$id]=$temp;
}
$features=$shuffled_results;
}
//pick a random media work or image from each features list of images.
foreach($features as $id=>$r)
{
$num_imgs=0;
$num_mdia=0;
$i=0;
if($features[$id]->has_value('image_id'))
{
$img_id=$features[$id]->get_value('image_id');
if($img_id!="none")
{
$num_imgs=count($img_id);
}
}
else
{
$features[$id]->set_value('image_id','none');
}
if($features[$id]->has_value('av_id'))
{
$av_id=$features[$id]->get_value('av_id');
if($av_id !="none")
{
$num_mdia=count($av_id);
}
}
else
{
$features[$id]->set_value('av_id','none');
}
$num_objects=$num_imgs+$num_mdia;
$i=rand(0, $num_objects-1 );
if($i<$num_mdia)
{
$features[$id]->set_value('current_object_type','av');
$features[$id]->set_value('current_image_index',$i);
}
else
{
$features[$id]->set_value('current_object_type','img');
$features[$id]->set_value('current_image_index',$i-$num_mdia);
}
}
//set default values for items that are not set
foreach($features as $id=>$r)
{
$cp=$features[$id]->get_value('crop_style');
if($cp==null){ $features[$id]->set_value('crop_style','fill');}
}
$this->_features=$features;
//if feature id is on this page then display it
//else redirect to same page but this feature not set
if(isset($this->request['feature']))
{
$feature_id=$this->request['feature'];
$is_a_feature_on_this_page=false;
foreach($this->_features as $feat)
{
if($feature_id==$feat->get_value('id'))
{
$is_a_feature_on_this_page=true;
break;
}
}
if($is_a_feature_on_this_page)
{
$this->current_feature_id=$this->request['feature'];
}
else
{
$url=carl_make_redirect(array('feature'=>''),'');
header("Location: ".$url);
}
}
$this->_build_view_data();
}
示例14: AND
$es->add_right_relationship_field('owns', 'entity', 'id', 'owner_id');
$es->add_right_relationship_field('owns', 'entity', 'name', 'site_name');
$es->add_left_relationship_field('minisite_page_parent', 'entity', 'id', 'parent_id');
// we add some relations so that we grab only valid pages with names that are not custom url pages
$es->add_relation('(entity.name != "") AND ((url.url = "") OR (url.url IS NULL))');
$result = $es->run_one();
$builder = new reasonPageURL();
$builder->provide_page_entities($result);
$request = carl_get_request();
$detail_mode = isset($request['detail']) ? $request['detail'] == 'true' : false;
$module_limiter = isset($request['limit']) ? conditional_stripslashes(turn_into_string($request['limit'])) : '';
$detail_limiter = isset($request['detail_limit']) ? conditional_stripslashes(turn_into_string($request['detail_limit'])) : '';
$core_local_limiter = isset($request['core_local_limit']) ? check_against_array($request['core_local_limit'], array('core', 'local')) : '';
$num = isset($request['num']) ? turn_into_int($request['num']) : 'All';
if (isset($request['reset'])) {
header("Location: " . carl_make_redirect(array('limit' => '', 'core_local_limit' => '')));
exit;
}
// Make an array with first dimension of page type name, second dimension of every page
// ID using the pt, third dimension 'true' for every page type returned by the query.
foreach ($result as $k => $mypage) {
$page_type_value = $mypage->get_value('custom_page');
if (empty($page_type_value)) {
$page_type_value = 'default';
}
$reason_page_types[$page_type_value][$k] = 'true';
}
$rpts =& get_reason_page_types();
$all_page_types = $rpts->get_page_types();
foreach ($all_page_types as $page_type_name => $pt_obj) {
$regions = $pt_obj->get_region_names();
示例15: where_to
function where_to()
{
$redirect = carl_make_redirect(array('_step' => '', 'report' => $this->controller->get_form_data('xml_id') . '_result'));
return $redirect;
}