当前位置: 首页>>代码示例>>PHP>>正文


PHP PerchUtil::redirect方法代码示例

本文整理汇总了PHP中PerchUtil::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP PerchUtil::redirect方法的具体用法?PHP PerchUtil::redirect怎么用?PHP PerchUtil::redirect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PerchUtil的用法示例。


在下文中一共展示了PerchUtil::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: open_link

 private function open_link()
 {
     try {
         $this->link = new mysqli(PERCH_DB_SERVER, PERCH_DB_USERNAME, PERCH_DB_PASSWORD, PERCH_DB_DATABASE, PERCH_DB_PORT, PERCH_DB_SOCKET);
     } catch (Exception $e) {
     }
     if ($this->link->connect_errno) {
         switch (PERCH_ERROR_MODE) {
             case 'SILENT':
                 break;
             case 'ECHO':
                 if (!$this->errored) {
                     echo 'Could not connect to the database. Please check that the username and password are correct.';
                     $this->errored = true;
                 }
                 break;
             default:
                 PerchUtil::redirect(PERCH_LOGINPATH . '/core/error/db.php');
                 break;
         }
         PerchUtil::debug("Could not create DB link!", 'error');
         return false;
     }
     if (PERCH_DB_CHARSET && !$this->link->set_charset(PERCH_DB_CHARSET)) {
         PerchUtil::debug("Error loading character set utf8: " . $this->link->error, 'error');
     }
 }
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:27,代码来源:PerchDB_MySQLi.class.php

示例2: open_link

 private function open_link()
 {
     $dsn_opts = array();
     $dsn_opts['host'] = PERCH_DB_SERVER;
     $dsn_opts['dbname'] = PERCH_DB_DATABASE;
     if (PERCH_DB_SOCKET) {
         $dsn_opts['unix_socket'] = PERCH_DB_SOCKET;
     }
     if (PERCH_DB_PORT) {
         $dsn_opts['port'] = (int) PERCH_DB_PORT;
     }
     $dsn = 'mysql:';
     foreach ($dsn_opts as $key => $val) {
         $dsn .= "{$key}={$val};";
     }
     $this->dsn = $dsn;
     $opts = NULL;
     if (PERCH_DB_CHARSET) {
         // $opts = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES '".PERCH_DB_CHARSET."'");
         // PHP bug means that this const isn't always defined. Useful.
         $opts = array(1002 => "SET NAMES '" . PERCH_DB_CHARSET . "'");
     }
     try {
         $this->link = new PDO($dsn, PERCH_DB_USERNAME, PERCH_DB_PASSWORD, $opts);
         if ($this->link) {
             $this->link->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         }
     } catch (PDOException $e) {
         switch (PERCH_ERROR_MODE) {
             case 'SILENT':
                 break;
             case 'ECHO':
                 if (!$this->errored) {
                     echo 'Could not connect to the database. Please check that the username and password are correct.';
                     $this->errored = true;
                 }
                 break;
             default:
                 PerchUtil::redirect(PERCH_LOGINPATH . '/core/error/db.php');
                 break;
         }
         PerchUtil::debug("Could not create DB link!", 'error');
         PerchUtil::debug($e->getMessage(), 'error');
         return false;
     }
 }
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:46,代码来源:PerchDB_MySQL.class.php

示例3: handle_login

 /**
  * Process the login form, calling the appropriate authenticator as required.
  * @param  [type] $SubmittedForm [description]
  * @return [type]                [description]
  */
 public function handle_login($SubmittedForm)
 {
     $Session = PerchMembers_Session::fetch();
     if ($Session->logged_in) {
         return true;
     }
     $authenticator = 'native';
     if (isset($SubmittedForm->data['authenticator'])) {
         $authenticator = $SubmittedForm->data['authenticator'];
     }
     $class = 'PerchMembers_Authenticator_' . $authenticator;
     $user_path = realpath(PerchUtil::file_path($this->authenticator_path . $authenticator));
     if (PerchUtil::file_path(substr($user_path, 0, strlen($this->authenticator_path))) == PerchUtil::file_path($this->authenticator_path)) {
         $path = PerchUtil::file_path($this->authenticator_path . $authenticator . '/' . $class . '.class.php');
         if (file_exists($path)) {
             include $path;
             $Authenticator = new $class($this->api);
             if (is_object($Authenticator)) {
                 $user_row = $Authenticator->form_login($SubmittedForm);
                 if ($user_row) {
                     PerchUtil::debug('log them in');
                     if (isset($user_row['memberPassword'])) {
                         unset($user_row['memberPassword']);
                     }
                     $this->_generate_session($user_row);
                     $this->recover_session();
                     if (isset($SubmittedForm->data['r']) && $SubmittedForm->data['r'] != '') {
                         PerchUtil::redirect($SubmittedForm->data['r']);
                     }
                 } else {
                     PerchUtil::debug($Authenticator->get_messages());
                 }
             }
         } else {
             PerchUtil::debug('Authenticator ' . $class . ' not found.', 'error');
         }
     } else {
         PerchUtil::debug('Invalid authenticator path: ' . PerchUtil::file_path($this->authenticator_path . $authenticator), 'error');
     }
 }
开发者ID:jaredmedley,项目名称:Perch-Core-Files,代码行数:45,代码来源:PerchMembers_Auth.class.php

示例4: PerchBlog_Util

<?php

$HTML = $API->get('HTML');
if (!$CurrentUser->has_priv('perch_blog.import')) {
    PerchUtil::redirect($API->app_path());
}
$BlogUtil = new PerchBlog_Util($API);
$files = $BlogUtil->find_importable_files();
$Form = $API->get('Form');
$Form->require_field('file', 'Required');
if ($Form->submitted()) {
    $postvars = array('file', 'format', 'type', 'section');
    $data = $Form->receive($postvars);
    switch ($data['type']) {
        case 'wordpress':
            PerchUtil::redirect($API->app_path() . '/import/wordpress?' . http_build_query($data));
            break;
        case 'posterous':
            PerchUtil::redirect($API->app_path() . '/import/posterous?' . http_build_query($data));
            break;
    }
}
开发者ID:jimcurran,项目名称:bdmusichub,代码行数:22,代码来源:import.pre.php

示例5: array

<?php

$HTML = $API->get('HTML');
// Try to update
$Settings = $API->get('Settings');
if ($Settings->get('perch_blog_update')->val() != '5.0') {
    PerchUtil::redirect($API->app_path() . '/update/');
}
$Blog = new PerchBlog_Posts($API);
$Paging = $API->get('Paging');
$Paging->set_per_page(15);
$Categories = new PerchCategories_Categories();
$categories = $Categories->get_for_set('blog');
$Sections = new PerchBlog_Sections($API);
$sections = $Sections->all();
$Lang = $API->get('Lang');
$posts = array();
$filter = 'all';
if (isset($_GET['category']) && $_GET['category'] != '') {
    $filter = 'category';
    $category = $_GET['category'];
}
if (isset($_GET['section']) && $_GET['section'] != '') {
    $filter = 'section';
    $section = $_GET['section'];
}
if (isset($_GET['status']) && $_GET['status'] != '') {
    $filter = 'status';
    $status = $_GET['status'];
}
switch ($filter) {
开发者ID:scottbrabazon,项目名称:scottbrabazon.com,代码行数:31,代码来源:list.pre.php

示例6: PerchContent_Regions

<?php

if (isset($_GET['id']) && is_numeric($_GET['id'])) {
    $region_id = (int) $_GET['id'];
    $item_id = (int) $_GET['itm'];
    $Regions = new PerchContent_Regions();
    $Region = $Regions->find($region_id);
    $Pages = new PerchContent_Pages();
    $Page = $Pages->find($Region->pageID());
}
if (!$Region || !is_object($Region)) {
    PerchUtil::redirect(PERCH_LOGINPATH . '/core/apps/content');
}
// set the current user
$Region->set_current_user($CurrentUser->id());
/* --------- Delete Form ----------- */
$Form = new PerchForm('delete');
if ($Form->posted() && $Form->validate() && isset($item_id)) {
    $Region->delete_item($item_id);
    $Region->index();
    if ($Form->submitted_via_ajax) {
        echo PERCH_LOGINPATH . '/core/apps/content/edit/?id=' . $Region->id();
        exit;
    } else {
        PerchUtil::redirect(PERCH_LOGINPATH . '/core/apps/content/edit/?id=' . $Region->id());
    }
}
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:27,代码来源:delete.pre.php

示例7: PerchAssets_Assets

$FieldTag->set('input_id', 'image');
$Assets = new PerchAssets_Assets();
$Tags = new PerchAssets_Tags();
$Form = new PerchForm('edit');
$message = false;
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
    $assetID = (int) $_GET['id'];
    $Asset = $Assets->find($assetID);
    if ($Asset) {
        if (!$Asset->is_image()) {
            $FieldTag->set('type', 'file');
        }
    }
} else {
    if (!$CurrentUser->has_priv('assets.create')) {
        PerchUtil::redirect(PERCH_LOGINPATH . '/core/apps/assets/');
    }
    $assetID = false;
    $Asset = false;
}
$Form = new PerchForm('edit');
$req = array();
$req['resourceTitle'] = "Required";
$Form->set_required($req);
if ($Form->posted() && $Form->validate()) {
    /*
    if (isset($_POST['image_remove']) && $_POST['image_remove']=='1') {
        $Asset->delete();
        PerchUtil::redirect()
    }
    */
开发者ID:jaredmedley,项目名称:Perch-Core-Files,代码行数:31,代码来源:edit.pre.php

示例8: PerchForm

    $groupID = false;
    $NavGroup = false;
}
$Form = new PerchForm('editpage');
$req = array();
$req['groupTitle'] = "Required";
$Form->set_required($req);
if ($Form->posted() && $Form->validate()) {
    $postvars = array('groupTitle');
    $data = $Form->receive($postvars);
    if (is_object($NavGroup)) {
        $NavGroup->update($data);
        $Alert->set('success', PerchLang::get('Your navigation group has been successfully updated.'));
    } else {
        $data['groupSlug'] = PerchUtil::urlify($data['groupTitle']);
        $NavGroup = $NavGroups->create($data);
        if (is_object($NavGroup)) {
            PerchUtil::redirect(PERCH_LOGINPATH . '/core/apps/content/navigation/edit/?id=' . $NavGroup->id() . '&created=1');
        } else {
            $Alert->set('failure', PerchLang::get('There was a problem creating the navigation group.'));
        }
    }
}
if (isset($_GET['created'])) {
    $Alert->set('success', PerchLang::get('Your navigation group has been successfully created.'));
}
if (is_object($NavGroup)) {
    $details = $NavGroup->to_array();
} else {
    $details = array();
}
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:31,代码来源:nav.edit.pre.php

示例9: array

    $data = $Form->receive($postvars);
    $data['eventDateTime'] = $Form->get_date('eventDateTime');
    $prev = false;
    if (isset($details['eventDynamicFields'])) {
        $prev = PerchUtil::json_safe_decode($details['eventDynamicFields'], true);
    }
    $dynamic_fields = $Form->receive_from_template_fields($Template, $prev);
    $data['eventDynamicFields'] = PerchUtil::json_safe_encode($dynamic_fields);
    $result = false;
    if (is_object($Event)) {
        $result = $Event->update($data);
    } else {
        $new_event = $Events->create($data);
        if ($new_event) {
            $result = true;
            PerchUtil::redirect($API->app_path() . '/edit/?id=' . $new_event->id() . '&created=1');
        } else {
            $message = $HTML->failure_message('Sorry, that event could not be updated.');
        }
    }
    if ($result) {
        $message = $HTML->success_message('Your event has been successfully updated. Return to %sevent listing%s', '<a href="' . $API->app_path() . '">', '</a>');
    } else {
        $message = $HTML->failure_message('Sorry, that event could not be updated.');
    }
    if (is_object($Event)) {
        $details = $Event->to_array();
    } else {
        $details = array();
    }
}
开发者ID:pete-naish,项目名称:4hair,代码行数:31,代码来源:edit.pre.php

示例10: array

    $user = $Form->receive($postvars);
    PerchSession::set('user', $user);
    $postvars = array('loginpath', 'db_server', 'db_database', 'db_username', 'db_password', 'licenseKey', 'tz');
    $conf = $Form->receive($postvars);
    if (!isset($conf['db_password'])) {
        $conf['db_password'] = '';
    }
    $conf['loginpath'] = rtrim($conf['loginpath'], '/');
    $config_file = file_get_contents('config.sample.php');
    $config_file = preg_replace_callback('/\\$(\\w+)/', "substitute_vars", $config_file);
    $config_file_path = PerchUtil::file_path(realpath('../config') . '/config.php');
    if (is_writable($config_file_path)) {
        file_put_contents($config_file_path, $config_file);
        $test_contents = file_get_contents($config_file_path);
        if ($test_contents == $config_file) {
            PerchUtil::redirect('index.php?install=1&auto=1');
        }
    }
    $mode = 'configfile';
}
function substitute_vars($matches)
{
    global $user, $conf;
    if (isset($user[$matches[1]])) {
        return addslashes($user[$matches[1]]);
    }
    if (isset($conf[$matches[1]])) {
        return $conf[$matches[1]];
    } else {
        return '$' . $matches[1];
    }
开发者ID:TodayIShould,项目名称:todayishould_website,代码行数:31,代码来源:gather.pre.php

示例11: PerchAPI

<?php

# include the API
include '../../../../core/inc/api.php';
$API = new PerchAPI(1.0, 'perch_events');
$Lang = $API->get('Lang');
if (!$CurrentUser->has_priv('perch_events.categories.manage')) {
    PerchUtil::redirect($API->app_path());
}
# include your class files
include '../PerchEvents_Categories.class.php';
include '../PerchEvents_Category.class.php';
# Set the page title
$Perch->page_title = $Lang->get('Manage Event Categories');
# Do anything you want to do before output is started
include '../modes/cat.list.pre.php';
# Top layout
include PERCH_CORE . '/inc/top.php';
# Display your page
include '../modes/cat.list.post.php';
# Bottom layout
include PERCH_CORE . '/inc/btm.php';
开发者ID:pete-naish,项目名称:4hair,代码行数:22,代码来源:index.php

示例12: PerchGallery_Images

<?php

$GalleryImages = new PerchGallery_Images($API);
$Albums = new PerchGallery_Albums($API);
$HTML = $API->get('HTML');
$Form = $API->get('Form');
$message = false;
if (isset($_GET['id']) && $_GET['id'] != '') {
    $Image = $GalleryImages->find($_GET['id']);
} else {
    PerchUtil::redirect($API->app_path() . '/');
}
if ($Form->submitted()) {
    if (is_object($Image)) {
        $albumID = $Image->albumID();
        $Image->delete();
        $Album = $Albums->find($albumID);
        if (is_object($Album)) {
            $Album->update_image_count();
        }
        PerchUtil::redirect($API->app_path() . '/images/?id=' . $albumID);
    } else {
        $message = $HTML->failure_message('Sorry, the image could not be deleted.');
    }
}
$details = $Image->to_array();
开发者ID:connor-baer,项目名称:waterford-website,代码行数:26,代码来源:image.delete.pre.php

示例13:

    }
}
// Template
$Template = $API->get('Template');
$Template->set('mailchimp/lists/list.html', 'mailchimp');
$tags = $Template->find_all_tags_and_repeaters();
$Form = $API->get('Form');
$Form->handle_empty_block_generation($Template);
$Form->set_required_fields_from_template($Template, $details);
if ($Form->submitted()) {
    $data = $Form->get_posted_content($Template, $Lists, $List);
    if ($List) {
        $List->update($data);
    } else {
        $List = $Lists->create($data);
        if ($List) {
            PerchUtil::redirect($Perch->get_page() . '?id=' . $List->id() . '&created=1');
        }
    }
    if (is_object($List)) {
        $message = $HTML->success_message('Your list has been successfully edited. Return to %slisting%s', '<a href="' . $API->app_path('perch_mailchimp') . '/">', '</a>');
    } else {
        $message = $HTML->failure_message('Sorry, that update was not successful.');
    }
}
if (PerchUtil::get('created') && !$message) {
    $message = $HTML->success_message('Your list has been successfully created. Return to %s listing%s', '<a href="' . $API->app_path('perch_mailchimp') . '/">', '</a>');
}
if (is_object($List)) {
    $details = $List->to_array();
}
开发者ID:jimcurran,项目名称:bdmusichub,代码行数:31,代码来源:list.edit.pre.php

示例14:

<?php

$Settings->get('headerColour')->settingValue();
PerchUtil::set_security_headers();
// Check for updates
$update_setting_key = 'update_' . $Perch->version;
if (PERCH_RUNWAY) {
    $update_setting_key = 'update_runway_' . $Perch->version;
}
if (!$auth_page && !$Settings->get($update_setting_key)->val()) {
    PerchUtil::redirect(PERCH_LOGINPATH . '/core/update/');
}
// Help markup as used by apps etc
$Perch->help_html = '';
$help_html = '';
header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE html>
<html lang="<?php 
echo $Settings->get('lang')->settingValue();
?>
">
<head>
	<meta charset="utf-8" />
	<title><?php 
echo PerchUtil::html($Perch->page_title);
if (!$Settings->get('hideBranding')->settingValue()) {
    if (PERCH_RUNWAY) {
        echo PerchUtil::html(' - ' . PerchLang::get('Perch Runway'));
    } else {
        echo PerchUtil::html(' - ' . PerchLang::get('Perch'));
开发者ID:jaredmedley,项目名称:Perch-Core-Files,代码行数:31,代码来源:top.php

示例15: force_non_ssl

 public static function force_non_ssl()
 {
     Perch::fetch();
     // to define PERCH_SSL
     if (PERCH_SSL) {
         if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
             header('Strict-Transport-Security: max-age=0');
             PerchUtil::redirect(PerchUtil::url_to_non_ssl($_SERVER['REQUEST_URI']));
         }
     }
 }
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:11,代码来源:PerchSystem.class.php


注:本文中的PerchUtil::redirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。