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


PHP Filter::getString方法代码示例

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


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

示例1: build

 public function build()
 {
     $info = $this->getParams();
     if (!isset($info['url_arguments'][0])) {
         $sessio = Session::getInstance()->get('my_name');
         if (!empty($sessio)) {
             $this->setLayout('error/errorlogin.tpl');
         } else {
             $this->setLayout('project/main.tpl');
             $s = FALSE;
             Session::getInstance()->set('login', $s);
             if (Filter::getString('usernamelogin') && Filter::getString('passwordlogin')) {
                 $var = $this->validator(Filter::getString('usernamelogin'), Filter::getString('passwordlogin'));
                 if ($var == true) {
                     $userName = Filter::getString('usernamelogin');
                     Session::getInstance()->set('my_name', $userName);
                     $s = TRUE;
                     Session::getInstance()->set('login', $s);
                     $this->assign('loguejat', $s);
                     header('Location: http://g4.local/home');
                 } else {
                     $this->assign('errorMessage', "The username or/and password were incorrect, try again");
                     $this->setLayout('project/main.tpl');
                 }
             }
         }
     } else {
         $this->setLayout('error/error404.tpl');
     }
 }
开发者ID:GuillemGarciaSabate,项目名称:SocialTravel,代码行数:30,代码来源:main.ctrl.php

示例2: helloUser

 protected function helloUser()
 {
     $name = Filter::getString('user_name');
     if ($name) {
         $this->assign('user_name', $name);
     }
 }
开发者ID:GuillemGarciaSabate,项目名称:SocialTravel,代码行数:7,代码来源:home.ctrl.php

示例3: isValidTimeHash

 /**
  * Validates the elements ensuring that the form has been on screen enough seconds.
  *
  * @param string $form_config Configuration file with form definition.
  * @param string $input_name Optional input name that contains the security hash.
  * @return boolean
  */
 public function isValidTimeHash($input_name)
 {
     if (!$this->filter->isSent($input_name) || $this->filter->isEmpty($input_name)) {
         $this->errors[$input_name] = 'Security hash not sent';
         // You shouldn't display this error. Hackers don't need info.
         return false;
     } else {
         Bootstrap::getClass('Crypt', false);
         $time_printed = intval(Crypt::decrypt($this->filter->getString($input_name)));
         if (time() < $time_printed) {
             // Too fast cowboy!
             $this->errors[$input_name] = 'Form submitted too fast, might be a BOT';
             return false;
         }
     }
     return true;
 }
开发者ID:ninodafonte,项目名称:SIFO,代码行数:24,代码来源:Form.php

示例4: build

 public function build()
 {
     $info = $this->getParams();
     if (!isset($info['url_arguments'][0])) {
         $sessio = Session::getInstance()->get('my_name');
         if (!empty($sessio)) {
             $this->setLayout('error/errorlogin.tpl');
         } else {
             $this->setLayout('project/signup.tpl');
             $this->assign('next', '/signup');
             if (Filter::getString('username') && Filter::getString('birth') && Filter::getString('email') && Filter::getString('password')) {
                 if ($this->checkUsername(Filter::getString('username')) == true && $this->checkBirth(Filter::getString('birth')) == true && $this->checkEmail(Filter::getString('email')) == true && $this->checkPassword(Filter::getString('password')) == true) {
                     //Generem un link aleatori a partir del login de l'usuari
                     $activation = md5(uniqid(Filter::getString('username'), true));
                     $this->assign('activation', $activation);
                     $this->assign('name', Filter::getString('username'));
                     $this->assign('birth', Filter::getString('birth'));
                     $this->assign('email', Filter::getString('email'));
                     $this->assign('password', Filter::getString('password'));
                     //Temporal storage of the user data
                     $userName = Filter::getString('username');
                     $birth = Filter::getString('birth');
                     $email = Filter::getString('email');
                     $password = Filter::getString('password');
                     Session::getInstance()->set('username', $userName);
                     Session::getInstance()->set('birth', $birth);
                     Session::getInstance()->set('email', $email);
                     Session::getInstance()->set('password', $password);
                 } else {
                     $this->assign('name', Filter::getString('username'));
                     $this->assign('birth', Filter::getString('birth'));
                     $this->assign('email', Filter::getString('email'));
                     $this->assign('password', Filter::getString('password'));
                     $this->assign('next', '/signup');
                     $this->setLayout('project/signup.tpl');
                 }
             }
         }
     } else {
         $this->setLayout('error/error404.tpl');
     }
 }
开发者ID:GuillemGarciaSabate,项目名称:SocialTravel,代码行数:42,代码来源:signup.ctrl.php

示例5: build

 public function build()
 {
     $sessio = Session::getInstance()->get('my_name');
     if (empty($sessio) || !isset($sessio)) {
         header("HTTP/1.1 403 Forbidden");
         $this->setLayout('error/error403.tpl');
     } else {
         $info = $this->getParams();
         if (!isset($info['url_arguments'][0]) || $info['url_arguments'][0] == 'user' || $info['url_arguments'][0] == 'country' || $info['url_arguments'][0] == 'unfollow') {
             $this->setLayout('project/follow.tpl');
             $obj = $this->getClass('MainModel');
             $userID = $obj->selectUserIDExact($sessio);
             $obj = $this->getClass('MainModel');
             $followedPeople = $obj->selectFollowers($userID);
             if (empty($followedPeople)) {
                 $this->assign('buit', TRUE);
             }
             $this->assign('followed', $followedPeople);
             $info = $this->getParams();
             //Quan el tio vol deixar de seguir a un altre
             if ($info['key_main_controller'] == 'follow' && isset($info['url_arguments'][0]) && $info['url_arguments'][0] == "unfollow" && isset($info['url_arguments'][1])) {
                 $userName = $info['url_arguments'][1];
                 $followedID = $obj->selectUserIDExact($userName);
                 $obj->deleteFollow($userID, $followedID);
                 header('Location: http://g4.local/follow');
             }
             //Quan un tio vol seguir a un altre per nom de usuari
             if ($info['key_main_controller'] == 'follow' && isset($info['url_arguments'][0]) && $info['url_arguments'][0] == "user" && isset($info['url_arguments'][1])) {
                 $userName = $info['url_arguments'][1];
                 $followedID = $obj->selectUserIDExact($userName);
                 $obj->insertFollow($userID, $sessio, $followedID, $userName);
                 header('Location: http://g4.local/follow');
             }
             //Quan el tio esta fent una cerca de usuaris per nom
             if ($info['key_main_controller'] == 'follow' && isset($info['url_arguments'][0]) && $info['url_arguments'][0] == "user") {
                 $nametoSearch = Filter::getString('peopletofollow');
                 $foundUsers = $obj->selectUserToFollow($nametoSearch);
                 if (empty($foundUsers)) {
                     $this->assign('notfoundUsers', 'There is not any user with this name');
                 } else {
                     $myarray = array();
                     for ($i = 0; $i < count($foundUsers); $i++) {
                         $name = $obj->selectUserName($foundUsers[$i]['id']);
                         $myarray[$i] = $name;
                     }
                     $myarray = array_unique($myarray);
                     $this->assign('foundUsers', $myarray);
                 }
             }
             //Quan el tio esta fent una cerca de usuaris per pais
             if ($info['key_main_controller'] == 'follow' && isset($info['url_arguments'][0]) && $info['url_arguments'][0] == "country") {
                 $countrytoSearch = Filter::getString('peopletofollow');
                 $foundUsers = $obj->selectUserbyCountry($countrytoSearch);
                 if (empty($foundUsers)) {
                     $this->assign('notfoundUsers', 'No users in this country!');
                 } else {
                     /*for ($i = 0; $i < count($foundUsers); $i++)
                                             {
                     
                                                 $name = $obj -> selectUserName($foundUsers[$i]['id']);
                                                 $myarray[$i] = $name;
                     
                                             }*/
                     $foundUsers = array_unique($foundUsers);
                     $this->assign('foundUsers', $foundUsers);
                 }
             }
         } else {
             $this->setLayout('error/error404.tpl');
         }
     }
 }
开发者ID:GuillemGarciaSabate,项目名称:SocialTravel,代码行数:72,代码来源:follow.ctrl.php

示例6: getAll

 /**
  * Bulk Filtering
  */
 public static function getAll($fields = array(), $nulls = false)
 {
     $result = array();
     foreach ($fields as $var_name => $var_type) {
         switch ($var_type) {
             case 'decimal':
                 $result[$var_name] = Filter::getDecimal($var_name);
                 break;
             case 'string':
                 $result[$var_name] = Filter::getString($var_name, $nulls);
                 break;
             case 'int':
                 $result[$var_name] = Filter::getInt($var_name);
                 break;
             case 'float':
                 $result[$var_name] = Filter::getFloat($var_name);
                 break;
             case 'bool':
                 $result[$var_name] = Filter::getBool($var_name);
                 break;
             case 'email':
                 $result[$var_name] = Filter::getEmail($var_name);
                 break;
             case 'url':
                 $result[$var_name] = Filter::getUrl($var_name);
                 break;
             case is_array($var_type):
                 $result[$var_name] = Filter::getEnum($var_name, $var_type);
                 break;
         }
     }
     return $result;
 }
开发者ID:MrYogi,项目名称:hasoffers-promotional-platform,代码行数:36,代码来源:Filter.php

示例7: build

 public function build()
 {
     $sessio = Session::getInstance()->get('my_name');
     $login = Session::getInstance()->get('login');
     if ($login == TRUE) {
         $this->assign('loguejat', $login);
     }
     /**if(empty($sessio) || !isset($sessio))
        {
            header("HTTP/1.1 403 Forbidden");
            header("Location: /login");
            exit();
        }else
        {**/
     $state = Session::getInstance()->get('state');
     if (isset($state)) {
         Session::getInstance()->delete('state');
     }
     //}
     $info = $this->getParams();
     if (isset($info['url_arguments'][0])) {
         $obj = $this->getClass('MainModel');
         $travel = $obj->getTravelbyID($info['url_arguments'][0]);
         //var_dump($travel);
         if (!empty($travel) && !isset($info['url_arguments'][1])) {
             $this->setLayout('project/mostrarViatge.tpl');
             $user = $obj->selectUserName($travel[0]['User_id']);
             $this->assign('user', $user);
             $this->assign('username', $sessio);
             Session::getInstance()->set('travel_id', $travel[0]['Travel_id']);
             $this->assign('information', $travel);
             $travel[0]['Hashtags'] = str_replace("#", "", $travel[0]['Hashtags']);
             $hash = explode(" ", $travel[0]['Hashtags']);
             $this->assign('hastags', $hash);
             $haEntrat = 0;
             //Guardem la imatge per a la edicio
             //Session::getInstance()->delete('imageID');
             Session::getInstance()->set('imageID', $info['url_arguments'][0]);
             // Si estem al primer o a l'ultim element hem de canviar on apunten les fletxes
             $id = $info['url_arguments'][0];
             $primerId = $obj->firstTravel();
             if ($id == $primerId) {
                 $ultimId = $obj->lastTravel();
                 $this->assign('indexleft', $ultimId);
                 $id = $info['url_arguments'][0];
                 $id = $obj->nextTravel($id);
                 $this->assign('indexrigth', $id);
                 $haEntrat = 1;
             }
             $id = $info['url_arguments'][0];
             $ultimId = $obj->lastTravel();
             if ($id == $ultimId && $haEntrat == 0) {
                 $id = $info['url_arguments'][0];
                 $id = $obj->previousTravel($id);
                 $this->assign('indexleft', $id);
                 $primerId = $obj->firstTravel();
                 $this->assign('indexrigth', $primerId);
                 $haEntrat = 1;
             }
             if ($haEntrat == 0) {
                 $id = $info['url_arguments'][0];
                 $id = $obj->previousTravel($id);
                 $this->assign('indexleft', $id);
                 $id = $info['url_arguments'][0];
                 $id = $obj->nextTravel($id);
                 $this->assign('indexrigth', $id);
             }
             if (Filter::getString('comment')) {
                 $name = Session::getInstance()->get('my_name');
                 $id = $obj->selectUserIDExact($name);
                 $obj->addComment(Filter::getString('comment'), $travel[0]['Travel_id'], $id);
             }
         } else {
             $this->setLayout('error/error404.tpl');
         }
     } else {
         $this->setLayout('error/error404.tpl');
     }
 }
开发者ID:GuillemGarciaSabate,项目名称:SocialTravel,代码行数:79,代码来源:mostrarViatge.ctrl.php


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