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


PHP request::method方法代码示例

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


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

示例1: index

 public function index()
 {
     // require_once(MODPATH . "aws_s3/lib/s3.php");
     $form = $this->_get_s3_form();
     if (request::method() == "post") {
         access::verify_csrf();
         if ($form->validate()) {
             module::set_var("aws_s3", "enabled", isset($_POST['enabled']) ? true : false);
             module::set_var("aws_s3", "access_key", $_POST['access_key']);
             module::set_var("aws_s3", "secret_key", $_POST['secret_key']);
             module::set_var("aws_s3", "bucket_name", $_POST['bucket_name']);
             module::set_var("aws_s3", "g3id", $_POST['g3id']);
             module::set_var("aws_s3", "url_str", $_POST['url_str']);
             module::set_var("aws_s3", "sig_exp", $_POST['sig_exp']);
             module::set_var("aws_s3", "use_ssl", isset($_POST['use_ssl']) ? true : false);
             if (module::get_var("aws_s3", "enabled") && !module::get_var("aws_s3", "synced", false)) {
                 site_status::warning(t('Your site has not yet been syncronised with your Amazon S3 bucket. Content will not appear correctly until you perform syncronisation. <a href="%url" class="g-dialog-link">Fix this now</a>', array("url" => html::mark_clean(url::site("admin/maintenance/start/aws_s3_task::sync?csrf=__CSRF__")))), "aws_s3_not_synced");
             }
             message::success(t("Settings have been saved"));
             url::redirect("admin/aws_s3");
         } else {
             message::error(t("There was a problem with the submitted form. Please check your values and try again."));
         }
     }
     $v = new Admin_View("admin.html");
     $v->page_title = t("Amazon S3 Configuration");
     $v->content = new View("admin_aws_s3.html");
     $v->content->form = $form;
     $v->content->end = "";
     echo $v;
 }
开发者ID:Retroguy,项目名称:gallery3-contrib,代码行数:31,代码来源:admin_aws_s3.php

示例2: index

 public function index()
 {
     if ($this->auth->logged_in()) {
         $this->template->title = 'Already Logged In';
         $this->template->content = new View('login/login_message');
         $this->template->content->message = 'You are already logged in.<br />';
         $this->template->content->link_to_home = 'YES';
         $this->template->content->link_to_logout = 'YES';
         return;
     }
     $this->template->title = 'Forgotten Password Email Request';
     $this->template->content = new View('login/forgotten_password');
     if (request::method() == 'post') {
         $post = new Validation($_POST);
         $post->pre_filter('trim', TRUE);
         $post->add_rules('UserID', 'required');
         $returned = $this->auth->user_and_person_by_username_or_email($_POST['UserID']);
         if (array_key_exists('error_message', $returned)) {
             $this->template->content->error_message = $returned['error_message'];
             return;
         }
         $user = $returned['user'];
         $person = $returned['person'];
         if (!$this->check_can_login($user)) {
             return;
         }
         $this->auth->send_forgotten_password_mail($user, $person);
         $this->template->title = 'Email Sent';
         $this->template->content = new View('login/login_message');
         $this->template->content->message = 'An email providing a link which will allow your password to be reset has been sent to the specified email address, or if a username was provided, to the registered email address for that user.<br />';
     }
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:32,代码来源:forgotten_password.php

示例3: single

 public function single()
 {
     // Check auth here
     if (intval(Router::$arguments[0])) {
         $id = intval(Router::$arguments[0]);
     } else {
         throw new Kohana_Exception();
     }
     switch (strtoupper(request::method())) {
         case "GET":
             echo json_encode($this->get_messages_array($id));
             break;
         case "POST":
             $this->rest_error(501);
             break;
         case "PUT":
             // Messages are read-only
             $this->rest_error(405);
             break;
         case "DELETE":
             $message = ORM::factory('message', $id);
             if ($message->loaded) {
                 $message->delete();
             } else {
                 $this->rest_error(404);
             }
             break;
     }
 }
开发者ID:rjmackay,项目名称:Ushahidi-plugin-restapiv2,代码行数:29,代码来源:messages.php

示例4: single

 public function single()
 {
     // Check auth here
     if (intval(Router::$arguments[0])) {
         $id = intval(Router::$arguments[0]);
     } else {
         throw new Kohana_Exception();
     }
     switch (strtoupper(request::method())) {
         case "GET":
             echo json_encode($this->get_categories_array($id));
             break;
         case "POST":
             // Not sure what this would do
             $this->rest_error(405);
             break;
         case "PUT":
             if (!$this->admin) {
                 $this->rest_error(401);
             }
             $this->rest_error(501);
             break;
         case "DELETE":
             if (!$this->admin) {
                 $this->rest_error(401);
             }
             $category = ORM::factory('category', $id);
             if ($category->loaded) {
                 $category->delete();
             } else {
                 $this->rest_error(404);
             }
             break;
     }
 }
开发者ID:rjmackay,项目名称:Ushahidi-plugin-restapiv2,代码行数:35,代码来源:categories.php

示例5: profile_pic

 public function profile_pic()
 {
     if (request::is_ajax() && request::method() === 'post') {
         $this->auto_render = FALSE;
         $client_id = $this->auth->get_user()->id;
         //print_r($_FILES['profile-image']);exit;
         if (!empty($_FILES['profile-image']['name'])) {
             $tempFile = $_FILES["profile-image"]["tmp_name"];
             $filename = $_FILES["profile-image"]["name"];
             $targetPath = 'assets/uploads/';
             $temp = explode(".", $filename);
             $extension = end($temp);
             if (!is_dir($targetPath)) {
                 mkdir($targetPath, 0700);
                 $salt = 'user-' . $client_id . '-' . uniqid() . '-';
                 $targetFile = $targetPath . $salt . $filename;
                 $file_data_name = array("name" => $filename, "location" => $targetPath, "extension" => $extension);
                 $this->start_upload($targetFile, $tempFile);
                 $json = json_encode($file_data_name, TRUE);
             } else {
                 $salt = 'user-' . $client_id . '-' . uniqid() . '-';
                 $targetFile = $targetPath . $salt . $filename;
                 $file_data_name = array("name" => $filename, "location" => $targetFile, "extension" => $extension);
                 $this->start_upload($targetFile, $tempFile);
                 $json = json_encode($file_data_name, TRUE);
             }
         } else {
             $json = $this->auth->get_user()->user_avatar;
         }
         $data_profile_pic = array("user_avatar" => $json);
         log_helper::add("2", $this->user_log, $this->user_id, "Profile Picture was Successfully Updated");
         $this->setting_model->update_user($this->auth->get_user()->id, $data_profile_pic);
     }
 }
开发者ID:humbleBeginner,项目名称:inventory-pho2,代码行数:34,代码来源:profile.php

示例6: index

 /**
  * bit.ly module's settings
  * @todo Show default tweet value after resetting it!
  */
 public function index()
 {
     $form = twitter::get_configure_form();
     if (request::method() == "post") {
         access::verify_csrf();
         if ($form->validate()) {
             $consumer_key = $form->twitter_oauth->consumer_key->value;
             $consumer_secret = $form->twitter_oauth->consumer_secret->value;
             $reset_tweet = $form->twitter_message->reset_tweet->value;
             if ($reset_tweet) {
                 $default_tweet = twitter::reset_default_tweet();
             } else {
                 $default_tweet = $form->twitter_message->default_tweet->value;
             }
             $shorten_urls = $form->urls->shorten_urls->value;
             module::set_var("twitter", "consumer_key", $consumer_key);
             module::set_var("twitter", "consumer_secret", $consumer_secret);
             module::set_var("twitter", "default_tweet", $default_tweet);
             module::set_var("twitter", "shorten_urls", $shorten_urls);
             message::success("Twitter settings saved");
             url::redirect("admin/twitter");
         }
     }
     $is_registered = twitter::is_registered();
     $v = new Admin_View("admin.html");
     $v->page_title = t("Twitter");
     $v->content = new View("admin_twitter.html");
     $v->content->form = $form;
     $v->content->is_registered = $is_registered;
     print $v;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:35,代码来源:admin_twitter.php

示例7: __toString

 public function __toString()
 {
     /**
      * poa = product options atributes
      */
     //     echo Kohana::debug(@$_POST);
     $opa = new fpp_product_has_attributes_product_Model();
     $orm = $opa->db2cls();
     $uri = URI::Instance();
     $id = (int) $uri->segment("edit");
     if (request::method() == 'post' and is_array(@$_POST['opt'])) {
         $orm->delete(array('product_id_product' => $id));
         foreach ($_POST['opt'] as $key => $value) {
             $orm = $opa->db2cls();
             $data['product_id_product'] = $id;
             //         $data['ap_id_attributes_product']            = @$_POST['atr'][$key];
             $data['prefix'] = @$_POST['prefix'][$key];
             $data['vap_id_values_atributtes_product'] = @$_POST['opt'][$key];
             $data['value'] = @$_POST['val'][$key];
             $data['extra'] = @$_POST['extra'][$key];
             $orm->set_fields($data);
             $orm->save();
         }
     }
     $results = $this->GetAttr($id);
     //     fetch_where(array('product_id_product'=> ) );
     $atr_p = new fpp_attributes_product_Model();
     $orm_atrp = $atr_p->db2cls();
     $attributes = form::dropdown("poa_id", $orm_atrp->select_list('id_attributes_product', 'name_attributes_product'));
     $string = View::factory("extras/ajaxattributes")->set("attributes", $attributes)->set("results", $results)->render();
     return $string;
 }
开发者ID:brojasmeneses,项目名称:floreriarosabel,代码行数:32,代码来源:MY_OptionsProduct.php

示例8: index

 public function index()
 {
     $form = $this->_get_form();
     if (request::method() == "post") {
         access::verify_csrf();
         if ($form->validate()) {
             module::set_var("strip_exif", "exiv_path", $_POST['exiv_path']);
             if ($_POST['exif_tags'] != "") {
                 module::set_var("strip_exif", "exif_remove", isset($_POST['exif_remove']) ? $_POST['exif_remove'] : false);
                 module::set_var("strip_exif", "exif_tags", $_POST['exif_tags']);
             } else {
                 module::set_var("strip_exif", "exif_remove", false);
                 module::set_var("strip_exif", "exif_tags", self::$defExifTags);
             }
             if ($_POST['iptc_tags'] != "") {
                 module::set_var("strip_exif", "iptc_remove", isset($_POST['iptc_remove']) ? $_POST['iptc_remove'] : false);
                 module::set_var("strip_exif", "iptc_tags", $_POST['iptc_tags']);
             } else {
                 module::set_var("strip_exif", "iptc_remove", false);
                 module::set_var("strip_exif", "iptc_tags", self::$defIptcTags);
             }
             if (isset($_POST['verbose'])) {
                 module::set_var("strip_exif", "verbose", $_POST['verbose']);
             }
             message::success(t("Settings have been saved"));
             url::redirect("admin/strip_exif");
         } else {
             message::error(t("There was a problem with the submitted form. Please check your values and try again."));
         }
     }
     print $this->_get_view();
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:32,代码来源:admin_strip_exif.php

示例9: index

 public function index()
 {
     if (request::method() == "post") {
         $this->_try_login();
     } else {
         print $this->_login_form();
     }
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:8,代码来源:login.php

示例10: getOne

 public function getOne()
 {
     if (request::is_ajax() and request::method() == 'get') {
         $this->auto_render = FALSE;
         $setting = $this->setting_model->getOne();
         echo json_encode($setting);
     }
 }
开发者ID:humbleBeginner,项目名称:inventory-pho2,代码行数:8,代码来源:settings.php

示例11: _prompt_for_reauth

 private static function _prompt_for_reauth($controller_name, $args)
 {
     if (request::method() == "get" && !request::is_ajax()) {
         // Avoid anti-phishing protection by passing the url as session variable.
         Session::instance()->set("continue_url", url::current(true));
     }
     url::redirect("reauthenticate");
 }
开发者ID:andyst,项目名称:gallery3,代码行数:8,代码来源:admin.php

示例12: delete

 public function delete($id)
 {
     if (request::is_ajax() && request::method() === 'post') {
         $this->auto_render = FALSE;
         $category = $this->category_model->find($id);
         echo $this->category_model->delete($category->id);
         log_helper::add("1", $this->user_log, $this->user_id, "Deleted Category named " . $category->name . ".");
     }
 }
开发者ID:humbleBeginner,项目名称:inventory-pho2,代码行数:9,代码来源:categories.php

示例13: delete

 public function delete($id)
 {
     if (request::is_ajax() and request::method() === 'post') {
         $this->auto_render = FALSE;
         $officeBudget = $this->budget_model->with('office')->find($id);
         log_helper::add("2", $this->user_log, $this->user_id, "Deleted a Office Budget for " . $officeBudget->office->name . ".");
         echo $this->budget_model->delete($id);
     }
 }
开发者ID:humbleBeginner,项目名称:inventory-pho2,代码行数:9,代码来源:office_budgets.php

示例14: save

 public function save()
 {
     if (request::is_ajax() && request::method() === 'post') {
         $this->auto_render = FALSE;
         $post = security::xss_clean($this->input->post());
         log_helper::add("1", $this->user_log, $this->user_id, "Added New Purchase");
         $this->purchase_model->insert($post);
     }
 }
开发者ID:humbleBeginner,项目名称:inventory-pho2,代码行数:9,代码来源:purchase.php

示例15: save

 public function save()
 {
     if (request::is_ajax() && request::method() === 'post') {
         $this->auto_render = FALSE;
         $post = security::xss_clean($this->input->post());
         $latest = json_helper::convert($this->district_model->insert($post));
         echo json_encode($latest);
     }
 }
开发者ID:humbleBeginner,项目名称:inventory-pho2,代码行数:9,代码来源:logs.php


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