本文整理汇总了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;
}
示例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 />';
}
}
示例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;
}
}
示例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;
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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();
}
示例9: index
public function index()
{
if (request::method() == "post") {
$this->_try_login();
} else {
print $this->_login_form();
}
}
示例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);
}
}
示例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");
}
示例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 . ".");
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}