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


PHP FormHelper::testInput方法代码示例

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


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

示例1: createReply

 public function createReply()
 {
     // Create needed instances
     $formval = new FormHelper();
     $session = new SessionHelper();
     $thisuser = new User();
     $newpost = new Post();
     $postModel = new PostModel();
     $toppostid = $formval->testInput($_POST['toppost_id']);
     $toppost = new Post($toppostid);
     $currentcategory = new Category($toppost->category_id);
     // Grab all data
     // It's a reply so no title
     $newpost->title = '';
     $newpost->contents = $formval->testInput($_POST['contents']);
     // It's a reply so insert the toppost id
     $newpost->post_relation_id = $toppostid;
     // The post_relation_id takes care of showing this post under the right toppost
     $newpost->category_id = $toppost->category_id;
     $newpost->user_id = $thisuser->id;
     $newpost->date_created = time();
     // Validate if contents is not empty
     $formval->fieldEmpty('Contents', $newpost->contents);
     if ($formval->formErrors()) {
         $session->setMessage('Please provide contents', 3);
         redirectTo(BASE_URL . 'index.php?c=user&a=viewcreatereply&id=' . $toppostid);
     }
     // The action of createTopPost would be the same as createReply
     if ($currentcategory->is_locked != 1 && $postModel->createTopPost($newpost)) {
         $session->setMessage('Reply posted', 4);
         redirectTo(BASE_URL . 'index.php?c=user&a=viewpost&id=' . $toppostid);
     } else {
         if ($currentcategory->is_locked == 1) {
             $session->setMessage('Reply not created, category is locked', 2);
         } else {
             $session->setMessage('Reply not created', 3);
         }
         redirectTo(BASE_URL . 'index.php?c=user&a=viewpost&id=' . $toppostid);
     }
 }
开发者ID:sandervanmook,项目名称:forums,代码行数:40,代码来源:Post.php

示例2: _authenticate

 private function _authenticate()
 {
     $session = new SessionHelper();
     $formval = new FormHelper();
     // Captcha
     include_once BASE_URI . 'app/vendor/securimage/securimage.php';
     $securimage = new Securimage();
     if ($securimage->check($formval->testInput($_POST['captcha_code'])) == false) {
         $session->setMessage('Verification code was incorrect, please try again', 3);
         return false;
     }
     $username = $formval->testInput($_POST['username']);
     $password = $formval->testInput($_POST['password']);
     $usermodel = new UserModel();
     if ($usermodel->authenticateUser($username, $password)) {
         return true;
     } else {
         $session->setMessage('Username / password incorrect or acount inactive', 3);
         return false;
     }
 }
开发者ID:sandervanmook,项目名称:forums,代码行数:21,代码来源:User.php

示例3: editCategoryLocked

 public function editCategoryLocked()
 {
     $session = new SessionHelper();
     $formval = new FormHelper();
     // Id of the category being changed
     $id = $formval->testInput($_POST['id']);
     $categorymodel = new CategoryModel();
     if ($formval->testInput($_POST['lock'])) {
         if ($categorymodel->changeLocked($id, 1)) {
             $session->setMessage('Setting changed', 4);
             redirectTo(BASE_URL . 'index.php?c=user&a=editcategory&id=' . $id);
         } else {
             $session->setMessage('Setting not changed', 3);
             redirectTo(BASE_URL . 'index.php?c=user&a=editcategory&id=' . $id);
         }
     } elseif ($formval->testInput($_POST['unlock'])) {
         if ($categorymodel->changeLocked($id, 0)) {
             $session->setMessage('Setting changed', 4);
             redirectTo(BASE_URL . 'index.php?c=user&a=editcategory&id=' . $id);
         } else {
             $session->setMessage('Setting not changed', 3);
             redirectTo(BASE_URL . 'index.php?c=user&a=editcategory&id=' . $id);
         }
     } else {
         $session->setMessage('Setting not changed', 3);
         redirectTo(BASE_URL . 'index.php?c=user&a=editcategory&id=' . $id);
     }
 }
开发者ID:sandervanmook,项目名称:forums,代码行数:28,代码来源:Category.php


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