本文整理汇总了PHP中request::referrer方法的典型用法代码示例。如果您正苦于以下问题:PHP request::referrer方法的具体用法?PHP request::referrer怎么用?PHP request::referrer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类request
的用法示例。
在下文中一共展示了request::referrer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* 物流对应的地区列表
*/
function index($id)
{
if (!$id) {
remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error');
}
$deliverycn_service = DeliverycnService::get_instance();
$deliverycn_region_service = Deliverycn_regionService::get_instance();
//验证此条物流
$data = $deliverycn_service->get($id);
if (!$data['id']) {
remind::set(Kohana::lang('o_global.access_denied'), request::referrer(), 'error');
}
//初始化请求结构体
$query_struct = array('where' => array('deliverycn_id' => $id), 'like' => array(), 'orderby' => array('position' => 'ASC', 'id' => 'ASC'), 'limit' => array('per_page' => 2000, 'offset' => 0));
// 每页条目数
controller_tool::request_per_page($query_struct, $request_data);
$count = $deliverycn_region_service->query_count($query_struct);
// 模板输出 分页
$this->pagination = new Pagination(array('total_items' => $count, 'items_per_page' => $query_struct['limit']['per_page']));
$query_struct['limit']['offset'] = $this->pagination->sql_offset;
$query_struct['limit']['page'] = $this->pagination->current_page;
//调用列表
$deliverycn_regions = $deliverycn_region_service->get_delivery_regions_by_position($query_struct);
$this->template->content = new View("site/deliverycn/region");
$this->template->content->deliverycn_regions = $deliverycn_regions;
$this->template->content->data = $data;
$this->template->content->regions = $deliverycn_region_service->get_regions();
}
示例2: check_spam
public static function check_spam()
{
$comment = array('comment_type' => 'comment', 'comment_author' => Event::$data->author, 'comment_author_email' => Event::$data->email, 'comment_author_url' => Event::$data->url, 'comment_content' => Event::$data->content, 'referrer' => request::referrer(), 'user_ip' => Event::$data->ip, 'user_agent' => Kohana::user_agent(), 'blog' => url::base(TRUE, 'http'));
$result = self::send_request('comment', $comment);
if ($result === 'true') {
Event::$data->approved = 'no';
Event::$data->save();
}
}
示例3: create
/**
* Log the customer in
* @Developer brandon
* @Date Oct 12, 2010
*/
public function create()
{
if (Auth::instance()->login($this->input->post('customername'), $this->input->post('password'))) {
url::redirect($this->input->post('redirect_override', request::referrer()));
} else {
flash::set_error('Unable to log in');
url::redirect(request::referrer());
}
}
示例4: add_view
/**
* Allows a model to be loaded by filename.
*/
public function add_view($type, $id)
{
$this->item_type = $type;
$this->item_id = $id;
$this->ip = Input::instance()->ip_address();
$this->referrer = request::referrer();
$this->user_agent = Kohana::user_agent();
$this->save();
}
示例5: installed
public function installed()
{
if (request::referrer() !== 'auth') {
// Do not allow non-referrered requests
url::redirect('auth');
}
$this->template->title = 'Installation Sucessful!';
$this->template->content = View::factory('auth/installed');
}
示例6: send_email
/**
* Send out the e-mail to the user if we can find their email
* @developer Brandon Hansen
* @date May 31, 2010
*/
public function send_email()
{
$user = ORM::factory('user')->find_by_email($this->input->post('email'));
if ($user->loaded) {
$email = new Email();
$email->reset_password($user);
flash::set_message('We have sent you an e-mail with password reset instructions');
url::redirect('login');
} else {
flash::set_message('We were unable to locate an account with that e-mail address');
url::redirect(request::referrer());
}
}
示例7: _add
/**
* Add a log entry.
*
* @param string $category an arbitrary category we can use to filter log messages
* @param string $message a detailed log message
* @param integer $severity INFO, WARNING or ERROR
* @param string $html an html snippet presented alongside the log message to aid the admin
*/
private static function _add($category, $message, $html, $severity)
{
$log = ORM::factory("log");
$log->category = $category;
$log->message = $message;
$log->severity = $severity;
$log->html = $html;
$log->url = substr(url::abs_current(true), 0, 255);
$log->referer = request::referrer(null);
$log->timestamp = time();
$log->user_id = identity::active_user()->id;
$log->save();
}
示例8: _sort_order
public function _sort_order()
{
$session = Session::instance();
$sortFunction = "listingNameCmp";
$currentSort = $session->get('sort_order');
$currentSortOrder = $session->get('sort_order_direction');
if (isset($_GET["sort"])) {
if ($_GET["sort"] == "filename") {
$sortFunction = "listingNameCmp";
} else {
if ($_GET["sort"] == "size") {
$sortFunction = "listingSizeCmp";
} else {
if ($_GET["sort"] == "date") {
$sortFunction = "listingDateCmp";
} else {
if ($_GET["sort"] == "kind") {
$sortFunction = "listingKindCmp";
}
}
}
}
$session->set('sort_order', $sortFunction);
$this->sort_order = $sortFunction;
if ($currentSort == $sortFunction) {
$newSortOrder = "Asc";
if ($currentSortOrder == "Asc") {
$newSortOrder = "Desc";
}
$session->set('sort_order_direction', $newSortOrder);
$this->sort_order_direction = $newSortOrder;
} else {
if ($sortFunction == "listingDateCmp") {
$session->set('sort_order_direction', "Desc");
$this->sort_order_direction = "Desc";
} else {
$session->set('sort_order_direction', "Asc");
$this->sort_order_direction = "Asc";
}
}
// redirect to avoid url resorting issue
url::redirect(request::referrer());
exit;
} else {
if ($currentSort != NULL) {
$this->sort_order = $currentSort;
$this->sort_order_direction = $currentSortOrder;
}
}
}
示例9: delete
public function delete($templateId)
{
//权限检查 得到所有可管理站点ID列表
role::check('distribution_system_manage');
$templateDao = Superplaner_Realtime_contract_template::instance();
$template = $templateDao->get_by_id($templateId);
if ($template == null) {
remind::set(Kohana::lang('o_contract.contract_not_exists'), request::referrer(), 'error');
}
if (Superplaner_Realtime_contract_template::instance($templateId)->delete()) {
remind::set(Kohana::lang('o_global.delete_success'), request::referrer(), 'success');
} else {
remind::set(Kohana::lang('o_global.delete_error'), request::referrer(), 'error');
}
}
示例10: _add
/**
* Add a log entry.
*
* @param string $category an arbitrary category we can use to filter log messages
* @param string $message a detailed log message
* @param integer $severity INFO, WARNING or ERROR
* @param string $html an html snippet presented alongside the log message to aid the admin
*/
private static function _add($category, $message, $html, $severity)
{
$log = ORM::factory("log");
$log->category = $category;
$log->message = $message;
$log->severity = $severity;
$log->html = $html;
$log->url = url::abs_current(true);
$log->referer = request::referrer(null);
$log->timestamp = time();
if (module::is_installed("user")) {
$log->user_id = user::active()->id;
}
$log->save();
}
示例11: delete
public function delete($cardTypeId)
{
//权限检查 得到所有可管理站点ID列表
role::check('card_system_manage');
$cardType = $this->cardTypeDao->get_by_id($cardTypeId);
if ($cardType == null) {
remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error');
return;
}
if ($this->cardTypeDao->delete($cardTypeId)) {
remind::set(Kohana::lang('o_global.delete_success'), 'card/card_type', 'success');
return;
} else {
remind::set(Kohana::lang('o_global.delete_error'), request::referrer(), 'error');
return;
}
}
示例12: update
public function update($photo_id)
{
access::verify_csrf();
$photo = ORM::factory("item", $photo_id);
access::required("view", $photo);
access::required("edit", $photo);
$form = photo::get_edit_form($photo);
$valid = $form->validate();
if ($valid) {
$new_ext = pathinfo($form->edit_item->filename->value, PATHINFO_EXTENSION);
$old_ext = pathinfo($photo->name, PATHINFO_EXTENSION);
if (strcasecmp($new_ext, $old_ext)) {
$form->edit_item->filename->add_error("illegal_extension", 1);
$valid = false;
}
}
if ($valid) {
if ($form->edit_item->filename->value != $photo->name || $form->edit_item->slug->value != $photo->slug) {
// Make sure that there's not a name or slug conflict
if ($row = db::build()->select(array("name", "slug"))->from("items")->where("parent_id", "=", $photo->parent_id)->where("id", "<>", $photo->id)->and_open()->where("name", "=", $form->edit_item->filename->value)->or_where("slug", "=", $form->edit_item->slug->value)->close()->execute()->current()) {
if ($row->name == $form->edit_item->filename->value) {
$form->edit_item->filename->add_error("name_conflict", 1);
}
if ($row->slug == $form->edit_item->slug->value) {
$form->edit_item->slug->add_error("slug_conflict", 1);
}
$valid = false;
}
}
}
if ($valid) {
$watching_album = $photo->url() != ($location = parse_url(request::referrer(), PHP_URL_PATH));
$photo->title = $form->edit_item->title->value;
$photo->description = $form->edit_item->description->value;
$photo->slug = $form->edit_item->slug->value;
$photo->rename($form->edit_item->filename->value);
$photo->save();
module::event("item_edit_form_completed", $photo, $form);
log::success("content", "Updated photo", "<a href=\"{$photo->url()}\">view</a>");
message::success(t("Saved photo %photo_title", array("photo_title" => html::purify($photo->title))));
print json_encode(array("result" => "success", "location" => $watching_album ? $location : $photo->url()));
} else {
print json_encode(array("result" => "error", "form" => $form->__toString()));
}
}
示例13: do_edit
/**
* 修改用户地址
*/
function do_edit($id)
{
//权限验证
$site_id_list = role::check('user_edit');
if (!$id) {
remind::set(Kohana::lang('o_global.bad_request'), 'user/address');
}
if ($_POST) {
$data = $_POST;
//标签过滤
tool::filter_strip_tags($data);
$data['date_upd'] = date('Y-m-d H:i:s');
if (Myaddress::instance($id)->edit($data)) {
remind::set(Kohana::lang('o_global.update_success'), request::referrer(), 'success');
} else {
remind::set(Kohana::lang('o_global.update_error'), request::referrer(), 'error');
}
}
}
示例14: delete
public function delete($moneyExchangeId)
{
//权限检查 得到所有可管理站点ID列表
role::check('card_system_manage');
$moneyExchange = $this->moneyExchangeDao->get_by_id($moneyExchangeId);
if ($moneyExchange == null) {
remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error');
return;
}
if ($moneyExchange['flag'] == 2) {
remind::set("不能删除生效中的汇率方案", request::referrer(), 'error');
return;
}
if ($this->moneyExchangeDao->delete($moneyExchange)) {
remind::set(Kohana::lang('o_global.delete_success'), 'card/money_exchange', 'success');
return;
} else {
remind::set(Kohana::lang('o_global.delete_error'), request::referrer(), 'error');
return;
}
}
示例15: login
public function login($tag_id = NULL)
{
if ($this->auth->logged_in('login')) {
url::redirect();
}
$this->template->title = 'Login';
if (!$this->session->get('referer')) {
$this->session->set('referer', request::referrer());
}
$this->template->content = View::factory('shadadmin/users/login')->bind('errors', $errors);
$post = Validation::factory($_POST)->pre_filter('trim')->add_rules('username', 'required')->add_rules('password', 'required');
if ($post->validate()) {
$user = ORM::factory('user', $post->username);
if (!$user->loaded) {
$post->add_error('username', 'not_found');
} elseif ($this->auth->login($user, $post->password)) {
url::redirect($this->session->get_once('referer'));
} else {
$post->add_error('password', 'incorrect_password');
}
}
$errors = $post->errors('errors_users_login');
$this->template->navigation = '';
}