本文整理汇总了PHP中ampredirect函数的典型用法代码示例。如果您正苦于以下问题:PHP ampredirect函数的具体用法?PHP ampredirect怎么用?PHP ampredirect使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ampredirect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _after_request
function _after_request()
{
$list_location_cookie = get_class($this) . '_ListLocation';
if (isset($_COOKIE[$list_location_cookie]) && $_COOKIE[$list_location_cookie]) {
ampredirect($_COOKIE[$list_location_cookie]);
}
}
示例2: check_authen_credentials
function check_authen_credentials()
{
// First check for an existing authentication token.
if (isset($_COOKIE[$this->_cookie_name])) {
$this->notice('cookie exists');
if ($result = $this->_handler->check_cookie($_COOKIE[$this->_cookie_name])) {
return $result;
}
}
//Check for a temporary auth token
if (isset($_GET[$this->_cookie_name]) && isset($_GET['authtype']) && $_GET['authtype'] == 'temp') {
if ($result = $this->_handler->check_cookie($_GET[$this->_cookie_name])) {
$cookie_bits = explode(':', $_GET[$this->_cookie_name]);
$hash = $cookie_bits[0];
$this->_handler->set_authen_tokens();
$this->_dbcon->Execute('DELETE FROM users_sessions where hash=' . $this->_dbcon->qstr($hash));
if (isset($_GET['auth_action']) && $_GET['auth_action'] == 'reset') {
trigger_error('redirecting to :' . AMP_url_update('/system/' . AMP_SYSTEM_URL_USER, array('id' => $this->_handler->userid, 'action' => 'reset')));
ampredirect(AMP_url_update('/system/' . AMP_SYSTEM_URL_USER, array('id' => $this->_handler->userid, 'action' => 'reset')));
exit;
}
return $result;
}
}
if (isset($_REQUEST[$this->_login_username_field]) || isset($_SERVER['PHP_AUTH_USER'])) {
$this->notice('checking password');
return $this->_handler->check_password();
}
$this->error('neither cookie nor password found');
return false;
}
示例3: temp_auth_actions
function temp_auth_actions()
{
if (isset($_GET['auth_action']) && $_GET['auth_action'] == 'reset') {
trigger_error('redirecting to :' . AMP_url_update('/system/' . AMP_SYSTEM_URL_USER, array('id' => $this->_handler->userid, 'action' => 'reset')));
ampredirect(AMP_url_update('/system/' . AMP_SYSTEM_URL_USER, array('id' => $this->_handler->userid, 'action' => 'reset')));
exit;
}
}
示例4: onDelete
function onDelete(&$controller, $args = array())
{
$model = $controller->get_model();
$nav_layout = $model->getLayoutId();
if ($nav_layout) {
ampredirect(AMP_url_update(AMP_SYSTEM_URL_NAV_LAYOUT, array('id' => $nav_layout)));
}
}
示例5: onSave
function onSave(&$controller)
{
$form = $controller->get_form();
$values = $form->getValues();
if (isset($values['list_form_id']) && $values['list_form_id']) {
ampredirect(AMP_url_add_vars(AMP_SYSTEM_URL_TOOL_PUBLICPAGE, array('modid=' . $values['modid'])));
}
}
示例6: commit_cancel
function commit_cancel()
{
$url = $this->assert_var('source_url');
if (!$url) {
$url = AMP_CONTENT_URL_INDEX;
}
ampredirect($url);
return true;
}
示例7: commit_save
function commit_save()
{
$result = parent::commit_save();
if (!$result) {
return false;
}
$this->_saveSections();
ampredirect(AMP_SYSTEM_URL_HOME);
return $result;
}
示例8: commit_update
function commit_update()
{
require_once 'AMP/Content/RSS/Subscription/Subscription.php';
$current_subscription_list =& AMPContent_Lookup::instance('RSS_Subscriptions');
foreach ($current_subscription_list as $subscription_id => $subscription_name) {
$sub = new RSS_Subscription(AMP_Registry::getDbcon(), $subscription_id);
$sub->update();
}
AMP_flush_common_cache();
ampredirect(AMP_SYSTEM_URL_RSS_AGGREGATOR);
}
示例9: show
function show()
{
$this->_before('show');
$article = $this->current_object = new Article(AMP_dbcon(), $this->params['id']);
//section headers redirect to sections
if ($article && $article->hasData() && $article->getData('class') == AMP_CONTENT_CLASS_SECTIONHEADER) {
return ampredirect(AMP_route_for('section', $article->getParent()));
}
if (!($article && AmpUtility::display_okay($article))) {
return AMP_make_404();
}
$this->render($article->getDisplay());
}
示例10: show
function show()
{
$this->_before('show');
$section = $this->current_object = new Section(AMP_dbcon(), $this->params['id']);
if (!($section && AmpUtility::display_okay($section))) {
return AMP_make_404();
}
if ($target = $section->getHeaderRedirect()) {
ampredirect($target);
}
$display =& $section->getDisplay();
$this->_render_section_header($display);
$this->render($display);
}
示例11: AMP_init_user
function AMP_init_user()
{
if (!isset($_SERVER['REMOTE_USER'])) {
return false;
}
$AMP_Permission =& AMPSystem_PermissionManager::instance();
$AMP_CurrentUser = false;
$AMP_CurrentUser =& $AMP_Permission->readUser($_SERVER['REMOTE_USER']);
if ($AMP_CurrentUser) {
if (!defined('AMP_SYSTEM_USER_ID')) {
define('AMP_SYSTEM_USER_ID', $AMP_CurrentUser->id);
}
$content_roots = AMP_lookup('userSiteRoots');
if (isset($content_roots[AMP_SYSTEM_USER_ID])) {
if (!defined('AMP_CONTENT_MAP_ROOT_SECTION')) {
define('AMP_CONTENT_MAP_ROOT_SECTION', $content_roots[AMP_SYSTEM_USER_ID]);
}
$sections = AMP_lookup('sections');
if (!defined('AMP_CONTENT_SECTION_NAME_ROOT')) {
if (AMP_CONTENT_MAP_ROOT_SECTION != AMP_CONTENT_SECTION_ID_ROOT) {
define('AMP_CONTENT_SECTION_NAME_ROOT', $sections[AMP_CONTENT_MAP_ROOT_SECTION]);
} else {
define('AMP_CONTENT_SECTION_NAME_ROOT', AMP_SITE_NAME);
}
}
} else {
define('AMP_CONTENT_MAP_ROOT_SECTION', AMP_CONTENT_SECTION_ID_ROOT);
define('AMP_CONTENT_SECTION_NAME_ROOT', AMP_SITE_NAME);
}
//ACL user def code
if (!defined('AMP_SYSTEM_USER_TYPE')) {
define('AMP_SYSTEM_USER_TYPE', 'users');
}
if (!defined('AMP_SYSTEM_USER_ID_ACL')) {
define('AMP_SYSTEM_USER_ID_ACL', 'user_' . $AMP_CurrentUser->id);
}
if (!AMP_Authorized(AMP_PERMISSION_CONTENT_ACCESS)) {
trigger_error('content access not authorized for user ' . $AMP_CurrentUser->getName());
ampredirect(AMP_SITE_URL);
}
//ENSURE THAT THE current user is allowed to see this page
if (!$AMP_Permission->authorizedPage()) {
trigger_error('unauthorized page access attempt by ' . $AMP_CurrentUser->getName());
ampredirect($AMP_Permission->userHome());
}
}
}
示例12: commit_update
function commit_update()
{
require_once 'Modules/WebAction/Deprecated.php';
$old_webActions = new WebAction_Deprecated(AMP_Registry::getDbcon());
$actions_set = $old_webActions->search();
if (!$actions_set) {
ampredirect(AMP_SYSTEM_URL_WEBACTION);
return false;
}
foreach ($actions_set as $action) {
if ($action->update()) {
$this->message($action->getName() . ' updated');
//$action->delete( );
}
}
$this->display_default();
}
示例13: onInitForm
/**
* onInitForm
* Populate the form with default values based on different AMP Modules that can publish to the Content System
* Currently handles IntroTexts, Photo Galleries, Petitions, and Web Actions
*
* @param AMP_System_Component_Controller &$controller
* @access public
* @return void
*/
function onInitForm(&$controller)
{
$form =& $controller->get_form();
if (($introtext_id = $controller->assert_var('mod_id')) || ($introtext_id = $controller->assert_var('introtext_id'))) {
return $this->_initFormForIntrotext($form, $introtext_id);
}
if (($petition_id = $controller->assert_var('pid')) || ($petition_id = $controller->assert_var('petition_id'))) {
return $this->_initFormForPetition($form, $petition_id);
}
if (($action_id = $controller->assert_var('action')) || ($action_id = $controller->assert_var('webaction_id'))) {
return $this->_initFormForWebAction($form, $action_id);
}
if (($gallery_id = $controller->assert_var('gallery')) || ($gallery_id = $controller->assert_var('gallery_id'))) {
return $this->_initFormForGallery($form, $gallery_id);
}
ampredirect(AMP_SYSTEM_URL_INDEX);
}
示例14: display_response
function display_response()
{
$renderer =& new AMPDisplay_HTML();
$this->message(sprintf(AMP_TEXT_DATA_SAVE_SUCCESS, AMP_TEXT_YOUR_COMMENT));
if ($this->_article_id) {
AMP_lookup_clear_cached('comments_live_by_article', $this->_article_id);
ampredirect(AMP_Url_AddVars(AMP_CONTENT_URL_ARTICLE, array('id=' . $this->_article_id)));
}
if ($this->_userdata_id) {
require_once 'AMP/UserData/Lookups.inc.php';
$form_id_lookup =& FormLookup::instance('modin');
if (isset($form_id_lookup[$this->_userdata_id])) {
$target_modin = $form_id_lookup[$this->_userdata_id];
ampredirect(AMP_Url_AddVars(AMP_CONTENT_URL_FORM_DISPLAY, array('uid=' . $this->_userdata_id, 'modin=' . $target_modin)));
}
}
}
示例15: restore
function restore()
{
$target_id = $this->getData('id');
if (!$target_id) {
return false;
}
require_once 'AMP/Content/Template.inc.php';
$template =& new AMPContent_Template($this->dbcon, $target_id);
$template->save_version();
$template->mergeData($this->getData());
$result = $template->save();
if (!$result) {
return false;
}
AMP_flush_common_cache();
$flash =& AMP_System_Flash::instance();
$flash->add_message(sprintf(AMP_TEXT_DATA_RESTORE_SUCCESS, $this->getName()));
ampredirect(AMP_url_update(AMP_SYSTEM_URL_TEMPLATE, array('id' => $target_id)));
return $result;
}