本文整理汇总了PHP中get_request_method函数的典型用法代码示例。如果您正苦于以下问题:PHP get_request_method函数的具体用法?PHP get_request_method怎么用?PHP get_request_method使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_request_method函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forgot
function forgot()
{
if (get_request_method() == 'POST') {
return $this->_sendPasswordTo($_POST['forgot']['email']);
}
$this->display('login/forgot', array('email' => Flash::get('email')));
}
示例2: settings
public function settings()
{
$errors = false;
if (get_request_method() == 'POST') {
$data = $_POST['settings'];
$settings = array();
$settings['filemanager_base'] = preg_replace('/\\s+/', '', $data['filemanager_base']);
$settings['filemanager_base'] = trim($settings['filemanager_base'], '/');
$settings['filemanager_view'] = isset($data['filemanager_view']) ? $data['filemanager_view'] : 'grid';
// image extensions
if (isset($data['filemanager_images'])) {
$settings['filemanager_images'] = serialize($data['filemanager_images']);
} else {
$errors[] = __("You need to select at least one image extension!");
}
$settings['filemanager_upload_size'] = !empty($data['filemanager_upload_size']) && is_numeric($data['filemanager_upload_size']) ? $data['filemanager_upload_size'] : '0';
$settings['filemanager_dateformat'] = !empty($data['filemanager_dateformat']) ? trim($data['filemanager_dateformat']) : 'd M Y H:i';
$booleans = array('filemanager_enabled', 'filemanager_browse_only', 'filemanager_upload_overwrite', 'filemanager_upload_images_only');
foreach ($booleans as $bool) {
$settings[$bool] = isset($data[$bool]) && $data[$bool] == 1 ? '1' : '0';
}
if (Plugin::setAllSettings($settings, 'ckeditor')) {
Flash::setNow('success', 'Settings were updated successfully');
} else {
$errors[] = __("There was a problem saving the settings.");
}
} else {
$settings = Plugin::getAllSettings('ckeditor');
}
if ($errors !== false) {
Flash::setNow('error', implode('<br/>', $errors));
}
$this->display('settings', array('settings' => $settings));
}
示例3: __construct
public function __construct()
{
parent::__construct();
if (get_request_method() != 'AJAX') {
die('error request');
}
}
示例4: index
function index()
{
// check if trying to save
if (get_request_method() == 'POST') {
return $this->_save();
}
$this->display('setting/index');
}
示例5: index
/**
* Calls save function or displays settings screen.
*/
public final function index()
{
// check if trying to save
if (get_request_method() == 'POST') {
$this->_save();
}
$this->display('setting/index', array('csrf_token' => SecureToken::generateToken(BASE_URL . 'setting')));
}
示例6: edit
function edit($id)
{
if (!($snippet = Snippet::findById($id))) {
Flash::set('error', __('Snippet not found!'));
redirect(get_url('snippet'));
}
// check if trying to save
if (get_request_method() == 'POST') {
return $this->_edit($id);
}
$this->display('snippet/edit', array('action' => 'edit', 'filters' => Filter::findAll(), 'snippet' => $snippet));
}
示例7: edit
public function edit($id)
{
if (!($gallery = Gallery::findById($id))) {
Flash::set('error', __('Image is not found!'));
redirect(get_url('gallery'));
}
// check if trying to save
if (get_request_method() == 'POST') {
return $this->_edit($id);
}
$this->display('gallery/view', array('gallery' => $gallery));
}
示例8: edit
function edit($id)
{
if (!($layout = Layout::findById($id))) {
Flash::set('error', __('Layout not found!'));
redirect(get_url('layout'));
}
// check if trying to save
if (get_request_method() == 'POST') {
return $this->_edit($id);
}
// display things...
$this->display('layout/edit', array('action' => 'edit', 'layout' => $layout));
}
示例9: edit
function edit($id = null)
{
if (is_null($id)) {
redirect(get_url('plugin/comment'));
}
if (!($comment = Comment::findById($id))) {
Flash::set('error', __('comment not found!'));
redirect(get_url('plugin/comment'));
}
// check if trying to save
if (get_request_method() == 'POST') {
return $this->_edit($id);
}
// display things...
$this->display('comment/views/edit', array('action' => 'edit', 'comment' => $comment));
}
示例10: edit
function edit($id)
{
if (AuthUser::getId() != $id && !AuthUser::hasPermission('administrator')) {
Flash::set('error', __('You do not have permission to access the requested page!'));
redirect(get_url());
}
// check if trying to save
if (get_request_method() == 'POST') {
return $this->_edit($id);
}
if ($user = User::findById($id)) {
$this->display('user/edit', array('action' => 'edit', 'user' => $user, 'permissions' => Record::findAllFrom('Permission')));
} else {
Flash::set('error', __('User not found!'));
}
redirect(get_url('user'));
}
示例11: _send_headers
private function _send_headers()
{
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header('Pragma: no-cache');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
if (get_request_method() == 'AJAX') {
//if( $this->param('ajaxtp') == 'xml' ) {
// header('Content-type: application/xml; charset=utf-8');
//}
//else {
header('Content-type: text/plain; charset=utf-8');
//}
} else {
header('Content-type: text/html; charset=utf-8');
}
}
示例12: edit
/**
* Saves the edited Snippet.
*
* @todo Merge _edit() and edit()
*
* @param string $id Snippet id.
*/
public function edit($id)
{
// check if user have already enter something
$snippet = Flash::get('post_data');
if (empty($snippet)) {
$snippet = Snippet::findById($id);
if (!$snippet) {
Flash::set('error', __('Snippet not found!'));
redirect(get_url('snippet'));
}
}
// check if trying to save
if (get_request_method() == 'POST') {
$this->_edit($id);
}
$this->display('snippet/edit', array('action' => 'edit', 'csrf_token' => SecureToken::generateToken(BASE_URL . 'snippet/edit'), 'filters' => Filter::findAll(), 'snippet' => $snippet));
}
示例13: collection_update
public function collection_update($id = null)
{
if (is_null($id)) {
redirect(get_url('plugin/ecommerce/collection'));
}
if (!($collection = Collection::findById($id))) {
Flash::set('error', __('Collection not found!'));
redirect(get_url('plugin/ecommerce/collection'));
}
if (get_request_method() == 'POST') {
$collection_id = $this->_collection_save($id, 'collection', 'Collection');
//insert log
$this->_insert_log('Collection <a href="' . get_url('plugin/ecommerce/collection_update/' . $collection_id) . '">' . $_POST['collection']['title'] . '</a> was updated.');
redirect(get_url('plugin/ecommerce/collection'));
}
//get products
global $__FROG_CONN__;
$sql = 'select pc.id, pc.collection_id, pc.product_id, p.title, pc.position from ecommerce_collection c inner join ecommerce_product_collection pc on c.id = pc.collection_id inner join ecommerce_product p on p.id = pc.product_id where c.id = ' . $id . ' order by pc.position;';
$stmt = $__FROG_CONN__->prepare($sql);
$stmt->execute();
$products = $stmt->fetchAll();
$this->display('ecommerce/views/collections/update', array('action' => 'update', 'collection' => $collection, 'products' => $products));
}
示例14: add
public function add()
{
// check if trying to save
if (get_request_method() == 'POST') {
return $this->_add();
}
// check if user have already enter something
$sidebarlink = Flash::get('post_data');
if (empty($sidebarlink)) {
$sidebarlink = new SidebarLink();
}
$this->browse();
}
示例15: _check
private function _check($permission = NULL)
{
global $pawUsers;
if (!$pawUsers->isLoggedIn()) {
$this->_redirect(get_url("login"));
}
if ($permission !== NULL && !$pawUsers->permissions->hasPermission($permission)) {
Flash::set("error", __("You don't have the Permission to access the requested page!"));
if (Setting::get("default_tab") === "user") {
$this->_redirect(get_url("page"));
} else {
$this->_redirect();
}
}
return get_request_method();
}