• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP is_post函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中is_post函数的典型用法代码示例。如果您正苦于以下问题:PHP is_post函数的具体用法?PHP is_post怎么用?PHP is_post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: register

 public function register()
 {
     if (is_post()) {
         $this->loadHelper('Validator');
         if (captcha()) {
             $data = ['email' => validate('email', 'email'), 'username' => validate('required', 'username'), 'password' => password_hash(validate('required', 'register_token'), PASSWORD_BCRYPT), 'token' => str_rand(40)];
             if (validator($data)) {
                 if ($this->user->checkExistUser($data['email'])) {
                     $data2 = ['firstname' => validate('required', 'firstname'), 'lastname' => validate('required', 'lastname'), 'nickname' => validate('required', 'nickname'), 'major' => validate('required', 'major')];
                     if (validator($data2)) {
                         $this->user->createUser($data, $data2);
                         $validate = $this->user->validate($data['email'], $_POST['register_token']);
                         if (!empty($validate)) {
                             $_SESSION['auth'] = $validate;
                             $_SESSION['user'] = $this->user->getDetail($validate['id']);
                             cache_forgot('user.members.' . user('major'));
                             cache_forgot('user.get.members.' . user('major'));
                         }
                     }
                 }
             }
         }
     }
     return redirect('');
 }
开发者ID:Jakkarin,项目名称:Anchor-system-for-branch-or-group,代码行数:25,代码来源:AuthController.php


示例2: install_check

 public static function install_check()
 {
     //Check the cache folder
     if (!Backend::checkConfigFile()) {
         if (function_exists('posix_getgrgid') && function_exists('posix_getegid')) {
             if ($group = posix_getgrgid(posix_getegid())) {
                 $group = $group['name'];
             }
         }
         $values = array('file' => Backend::getConfigFileLocation(), 'group' => isset($group) ? $group : false);
         Backend::addContent(Render::file('config_value.fix_config.tpl.php', $values));
         return false;
     }
     if (self::get('settings.ConfigValueSet')) {
         return true;
     }
     if (is_post()) {
         $result = true;
         foreach ($_POST as $name => $value) {
             $name = str_replace('_', '.', $name);
             if (in_array($name, array('application.Title', 'application.Moto', 'application.HelpBoxContent', 'application.Description', 'author.Name', 'author.Email', 'author.Website'))) {
                 if (!self::set($name, $value)) {
                     Backend::addError('Could not set ' . $name);
                     $result = false;
                 }
             } else {
                 var_dump('Rejected:', $name);
             }
         }
         self::set('settings.ConfigValueSet', $result);
         Controller::redirect();
     }
     Backend::addContent(Render::file('config_value.values.tpl.php'));
     return false;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:35,代码来源:ConfigValue.obj.php


示例3: confirm

    /**
     * Show a simple confirmation form
     */
    public static function confirm($label)
    {
        if (is_post()) {
            if (isset($_POST['confirm_yes'])) {
                return true;
            } else {
                if (isset($_POST['confirm_no'])) {
                    return false;
                }
            }
        }
        ?>
        <?php 
        print_header();
        ?>
        <div id="confirm_form">
            <?php 
        \Meta\Core\Form::open();
        ?>
            <h2><?php 
        echo $label;
        ?>
</h2>
            <input type="submit" name="confirm_yes" value="Sim" />
            <input type="submit" name="confirm_no" value="Nao" />
            <?php 
        \Meta\Core\Form::close();
        ?>
        </div>
        <?php 
        print_footer();
        ?>
        <?php 
        exit;
    }
开发者ID:moiseh,项目名称:metapages,代码行数:38,代码来源:Form.php


示例4: action_create

    public function action_create()
    {
        if (is_post()) {
            $parameters = get_previous_parameters();
            $object = new CommentObj();
            $object = $object->fromRequest();
            $object['foreign_id'] = empty($object['foreign_id']) ? reset($parameters) : $object['foreign_id'];
            $object['foreign_table'] = empty($object['foreign_table']) ? table_name(get_previous_area()) : $object['foreign_table'];
            //If we don't have a logged in user, create a dummy account
            if (!BackendUser::check()) {
                $query = new SelectQuery('BackendUser');
                $query->filter('`email` = :email');
                if ($old_user = Controller::getVar('user')) {
                    $existing_user = $query->fetchAssoc(array(':email' => $old_user['email']));
                }
                switch (true) {
                    case $existing_user && $existing_user['confirmed'] && $existing_user['active']:
                        //Attribute quote to user? Seems risque, actually, if I know a user's email address, I can just attribute to him. Auth first
                        Backend::addError('Comment not added. Please login first');
                        return false;
                        break;
                    case $existing_user && !$existing_user['confirmed'] && $existing_user['active']:
                        //Unregistered user commented before
                        $object['user_id'] = $existing_user['id'];
                        break;
                    default:
                    case !$existing_user:
                        $user_data = array('name' => $old_user['name'], 'surname' => '', 'email' => $old_user['email'], 'website' => $old_user['website'], 'username' => $old_user['email'], 'password' => get_random(), 'confirmed' => 0, 'active' => 1);
                        $user = self::getObject('BackendUser');
                        if ($user->create($user_data)) {
                            $object['user_id'] = $user->array['id'];
                            $url = SITE_LINK . '/?q=backend_user/confirm/' . $user->array['salt'];
                            $app_name = ConfigValue::get('Title');
                            $message = <<<END
Hi {$user->array['name']}!

Thank you for your comment on {$app_name}. An account has automatically been created for you. To activate it, please click on the following link:

{$url}

Please note that you don't need to do this for your comments to show, but this account will be deleted if it isn't confirmed in a weeks time.

Regards
END;
                            send_email($user->array['email'], 'Thank you for your comment.', $message);
                        } else {
                            Backend::addError('Could not create user to add Comment');
                            return false;
                        }
                        break;
                }
            }
            $object = array_filter($object, create_function('$var', 'return !is_null($var);'));
            Controller::setVar('obj', $object);
        }
        return parent::action_create();
    }
开发者ID:jrgns,项目名称:backend-php,代码行数:57,代码来源:Comment.obj.php


示例5: stage4

 public function stage4()
 {
     if (is_post()) {
         if (Installer::stage4()) {
             return redirect('complete');
         }
     }
     render('stage4');
 }
开发者ID:nathggns,项目名称:anchor-cms,代码行数:9,代码来源:controller.php


示例6: entry_password_edit

 function entry_password_edit()
 {
     $model = model::load('user');
     $_POST['user_id'] = $this->user_id;
     if (is_post() && $model->edit_password($_POST) === false) {
         $this->assign['message'] = $model->message;
     }
     $this->display('password_edit');
 }
开发者ID:questionlin,项目名称:readcat,代码行数:9,代码来源:Vuser.php


示例7: entry_comment

 function entry_comment()
 {
     $feed_mod = model::load('feed');
     $feed_mod->init('comments');
     if (is_post()) {
         $feed_mod->edit($_POST);
     }
     $this->assign['comment'] = $feed_mod->get($_GET);
     $this->display('comment_edit');
 }
开发者ID:questionlin,项目名称:readcat,代码行数:10,代码来源:Vfeed.php


示例8: fromRequest

 function fromRequest()
 {
     $data = parent::fromRequest();
     if (is_post() && array_key_exists('mime_type', $data)) {
         if (!empty($data['meta_info']['mime']) && $data['mime_type'] != $data['meta_info']['mime']) {
             $data['mime_type'] = $data['meta_info']['mime'];
         }
     }
     return $data;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:10,代码来源:ImageObj.obj.php


示例9: checkConfiguration

    public static function checkConfiguration()
    {
        // configuration installer manager
        $cfgFile = abspath('app/config.php');
        if (file_exists($cfgFile)) {
            return;
        }
        ?>
        <h2>Please configure the database</h2>
        <form method="POST">
            <label>Database host</label> <input type="text" name="DB_HOST" value="localhost">
            <br/>
            <label>Database user</label> <input type="text" name="DB_USER" value="root">
            <br/>
            <label>Database password</label> <input type="text" name="DB_PASS" value="">
            <br/>
            <label>Database name</label> <input type="text" name="DB_NAME" value="reservic">
            <br/><br/>
            <input type="submit" value="Install configuration file">
        </form>
        <?php 
        // write config file
        if (is_post()) {
            // check database connectivity
            try {
                $dbh = new \PDO('mysql:host=' . $_POST['DB_HOST'] . ';dbname=' . $_POST['DB_NAME'], $_POST['DB_USER'], $_POST['DB_PASS']);
            } catch (\Exception $e) {
                ?>
<h2>Database connection error: <?php 
                echo $e->getMessage();
                ?>
</h2><?php 
                exit;
            }
            // create config file content
            $content = "<?php\n";
            foreach ($_POST as $key => $val) {
                $content .= "define('{$key}', '{$val}');\n";
            }
            // try write config file
            if (!file_put_contents($cfgFile, $content)) {
                ?>
                <h2>The file <?php 
                echo $cfgFile;
                ?>
 is not writable!
                    Please set write permission for the app/ folder</h2>
                <?php 
                exit;
            }
            Flash::success(t('Database configuration saved.'));
            redirect(page_home());
        }
        exit;
    }
开发者ID:moiseh,项目名称:codegen,代码行数:55,代码来源:Installer.php


示例10: entry_admin_edit

 function entry_admin_edit()
 {
     $model = model::load('user');
     if (is_post() && !$model->edit($_POST)) {
         $this->assign['message'] = $model->message;
     }
     if ($_GET['user_id']) {
         $this->assign['admin'] = $model->get($_GET);
     }
     $this->display('admin_edit');
 }
开发者ID:questionlin,项目名称:readcat,代码行数:11,代码来源:Vuser.php


示例11: post_create

 public function post_create($id = false)
 {
     $result = parent::post_create();
     if ($result instanceof ContentObj) {
         /* TODO This can easily "overwrite" existing urls */
         if (is_post() && Component::isActive('BackendQuery')) {
             BackendQuery::add($result->array['name'], 'content/display/' . $result->array['id']);
         }
     }
     return $result;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:11,代码来源:Content.obj.php


示例12: add_message

 public function add_message()
 {
     $this->moduleTag = 'message';
     if (is_post()) {
         $data = $this->check_message();
         $info = $this->model->add_message_info($data);
         if (!$info) {
             response_code('-1');
         }
         response_code('1');
     }
 }
开发者ID:qiuai,项目名称:qieyou,代码行数:12,代码来源:message.php


示例13: p

 public function p($action = null, $id = null)
 {
     switch ($action) {
         case 'news':
             if (is_post()) {
                 $gbn = new \app\models\GbNews();
                 $data = array('title' => $_POST['title'], 'content' => $_POST['content']);
                 if ($_POST['active'] === 'on') {
                     $data['active'] = 1;
                 } else {
                     $data['active'] = 0;
                 }
                 if (!empty($_POST['action'])) {
                     $data['id'] = $_POST['id'];
                     $gbn->update($data);
                     cache_forgot('home.gbnews');
                     cache_forgot('p.gbn.' . $data['id']);
                 } else {
                     $gbn->create($data);
                     cache_forgot('home.gbnews');
                 }
                 return redirect('admin/p/news');
             } else {
                 $gbn = new \app\models\GbNews();
                 $gbn = $gbn->all();
                 $data = empty($gbn) ? array() : $gbn;
                 return $this->view('admin/gbnews', compact('data'));
             }
             break;
         case 'write':
             if (!empty($id)) {
                 $id = intval($id);
                 $news = new \app\models\GbNews();
                 $news = $news->getNews($id);
                 if (empty($news)) {
                     return $this->view('errors/404');
                 }
                 return $this->view('admin/gbnews_write', compact('news'));
             }
             return $this->view('admin/gbnews_write');
             break;
         case 'destroy':
             echo $_POST['id'];
             if (is_post()) {
                 $news = new \app\models\GbNews();
                 $news->remove($_POST['id']);
             }
             break;
         default:
             return redirect('admin');
             break;
     }
 }
开发者ID:Jakkarin,项目名称:Anchor-system-for-branch-or-group,代码行数:53,代码来源:AdminController.php


示例14: edit

    /**
     */
    function edit()
    {
        $a = $this->_get_info();
        if (!$a) {
            return _404();
        }
        $a['back_link'] = url('/@object');
        $form_id = 'content_form';
        jquery('
			var form_id = "' . $form_id . '";
			var bak_action = $("form#" + form_id).attr("action");
			var preview_url = "' . url_user('/dynamic/preview/static_pages/' . $a['id']) . '";
			$("[type=submit].preview", "form#" + form_id).on("click", function() {
				$(this).closest("form").attr("target", "_blank").attr("action", preview_url)
			})
			$("[type=submit]:not(.preview)", "form#" + form_id).on("click", function() {
				$(this).closest("form").attr("target", "").attr("action", bak_action)
			})
		');
        // Prevent execution of template tags when editing page content
        $exec_fix = ['{' => '&#123;', '}' => '&#125;'];
        $keys_to_fix = ['text'];
        foreach ((array) $keys_to_fix as $k) {
            if (false !== strpos($a[$k], '{') && false !== strpos($a[$k], '}')) {
                $a[$k] = str_replace(array_keys($exec_fix), array_values($exec_fix), $a[$k]);
            }
        }
        $a = (array) $_POST + (array) $a;
        if (is_post()) {
            foreach ((array) $keys_to_fix as $k) {
                if (false !== strpos($_POST[$k], '{') && false !== strpos($_POST[$k], '}')) {
                    $_POST[$k] = str_replace(array_values($exec_fix), array_keys($exec_fix), $_POST[$k]);
                }
            }
        }
        $_this = $this;
        return form($a, ['hide_empty' => true, 'id' => $form_id])->validate(['__before__' => 'trim', 'name' => ['required', function (&$in) use($_this) {
            $in = $_this->_fix_page_name($in);
            return (bool) strlen($in);
        }, function ($name, $tmp, $d, &$error) use($_this, $a) {
            $id = db()->from($_this::table)->where('locale', $a['locale'])->where('name', $name)->get_one('id');
            if ($id && $id != $a['id']) {
                $error = t('Page with this name and locale already exists');
            }
            return $error ? false : true;
        }], 'text' => 'required'])->update_if_ok(self::table, ['name', 'text', 'page_title', 'page_heading', 'meta_keywords', 'meta_desc', 'active'], 'id=' . $a['id'])->on_before_update(function () use($a, $_this) {
            module_safe('manage_revisions')->add(['object_name' => $_this::table, 'object_id' => $a['id'], 'old' => $a, 'new' => $_POST, 'action' => 'update']);
        })->on_after_update(function () {
            common()->admin_wall_add(['static page updated: ' . $a['name'], $a['id']]);
            cache_del('static_pages_names');
        })->container($this->_get_lang_links($a['locale'], $a['name'], 'edit'))->text('name')->textarea('text', ['id' => 'text', 'cols' => 200, 'rows' => 10, 'ckeditor' => ['config' => _class('admin_methods')->_get_cke_config()]])->text('page_title')->text('page_heading')->text('meta_keywords')->text('meta_desc')->active_box()->save_and_back()->preview();
    }
开发者ID:yfix,项目名称:yf,代码行数:54,代码来源:yf_static_pages.class.php


示例15: entry_register

 function entry_register()
 {
     $model = model::load('user');
     if (is_post()) {
         if ($model->register($_POST)) {
             header('Location: /');
         } else {
             $this->assign['message'] = $model->message;
             $this->display('message');
             exit;
         }
     }
     $this->display('register');
 }
开发者ID:questionlin,项目名称:readcat,代码行数:14,代码来源:Vindex.php


示例16: change_debug

 /**
  */
 function change_debug()
 {
     if (!DEBUG_MODE) {
         return;
     }
     if (is_post()) {
         $_SESSION['debug_console_light'] = intval((bool) $_POST['debug_console_light']);
         $_SESSION['locale_vars_edit'] = intval((bool) $_POST['locale_edit']);
         #			$_SESSION['stpls_inline_edit']		= intval((bool)$_POST['stpl_edit']);
         return js_redirect($_SERVER['HTTP_REFERER'], 0);
     }
     $a = $_POST + $_SESSION;
     return form($a)->active_box('debug_console_light', ['selected' => $_SESSION['debug_console_light']])->active_box('locale_edit', ['selected' => $_SESSION['locale_vars_edit']])->save();
 }
开发者ID:yfix,项目名称:yf,代码行数:16,代码来源:yf_test.class.php


示例17: entry_add_node

 function entry_add_node()
 {
     $node_mod = model::load('node');
     if (is_post()) {
         $node_id = $node_mod->add_node($_POST, $this->user_id);
         if ($node_id) {
             header('Location: /index.php?view=feed&node_id=' . $node_id);
         } else {
             $this->assign['message'] = $node_mod->message;
             $this->display('message');
         }
     } else {
         $this->display('edit_node');
     }
 }
开发者ID:questionlin,项目名称:readcat,代码行数:15,代码来源:Vnode.php


示例18: add

 public function add()
 {
     if (is_post()) {
         $_data = array();
         foreach ($_POST as $key => $value) {
             $value['time'] = date('D, d M Y');
             $_data[] = implode(':|', $value);
         }
         if ($this->update($this->current_name, $_data)) {
             return redirect('ledger/summary');
         }
     } else {
         return $this->view('ledger/add');
     }
 }
开发者ID:Jakkarin,项目名称:Anchor-system-for-branch-or-group,代码行数:15,代码来源:LedgerController.php


示例19: upme_reset_module_settings

 public function upme_reset_module_settings()
 {
     global $upme_admin;
     if (is_post() && is_in_post('current_tab')) {
         if (isset($upme_admin->default_module_settings[post_value('current_tab')])) {
             $current_options = get_option('upme_options');
             foreach ($upme_admin->default_module_settings[post_value('current_tab')] as $key => $value) {
                 $current_options[$key] = $value;
             }
             update_option('upme_options', $current_options);
             echo json_encode(array('status' => 'success'));
             exit;
         }
     }
 }
开发者ID:nikwin333,项目名称:pcu_project,代码行数:15,代码来源:class-upme-modules.php


示例20: edit_user

/**
 * edit_user 
 * 
 * @param mixed $id the unique identifier
 *
 * @access public
 * @return string
 */
function edit_user($id)
{
    i_am_logged();
    $user = fetch_or_404('User', $id);
    if (is_post()) {
        $user->fromArray($_POST);
        if ($user->isValid()) {
            $user->save();
            return redirect('/user/page/' . $user->id);
        } else {
            $errors = array();
            $errors['user'] = get_errors($user);
        }
    }
    return render('user_edit.tpl', compact('user', 'errors'));
}
开发者ID:jouvent,项目名称:Genitura,代码行数:24,代码来源:controllers.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP is_post_type_archive函数代码示例发布时间:2022-05-15
下一篇:
PHP is_posnumericint函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap