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


PHP helper::validateEmail方法代码示例

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


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

示例1: run

 /**
  * run - display template and edit data
  *
  * @access public
  *
  */
 public function run()
 {
     $tpl = new template();
     $hasher = new PasswordHash(8, TRUE);
     //only Admins
     if ($_SESSION['userdata']['role'] == 'admin') {
         $values = array();
         if (isset($_POST['save'])) {
             $values = array('firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'user' => $_POST['user'], 'phone' => $_POST['phone'], 'role' => $_POST['role'], 'password' => $hasher->HashPassword($_POST['password']), 'clientId' => $_POST['client']);
             //Validation
             if ($values['user'] !== '') {
                 $helper = new helper();
                 if ($helper->validateEmail($values['user']) == 1) {
                     if ($hasher->CheckPassword($_POST['password'], $values['password']) && $_POST['password'] != '') {
                         if ($this->usernameExist($values['user']) === false) {
                             $this->addUser($values);
                             $tpl->setNotification('USER_ADDED', 'success');
                         } else {
                             $tpl->setNotification('USERNAME_EXISTS', 'error');
                         }
                     } else {
                         $tpl->setNotification('PASSWORDS_DONT_MATCH', 'error');
                     }
                 } else {
                     $tpl->setNotification('NO_VALID_EMAIL', 'error');
                 }
             } else {
                 $tpl->setNotification('NO_USERNAME', 'error');
             }
             $tpl->assign('values', $values);
         }
         $clients = new clients();
         $tpl->assign('clients', $clients->getAll());
         $tpl->assign('roles', $this->getRoles());
         $tpl->display('users.newUser');
     } else {
         $tpl->display('general.error');
     }
 }
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:45,代码来源:class.newUser.php

示例2: run

 /**
  * run - display template and edit data
  *
  * @access public
  *
  */
 public function run()
 {
     $tpl = new template();
     $hasher = new PasswordHash(8, TRUE);
     $userId = $_SESSION['userdata']['id'];
     $row = $this->getUser($userId);
     // $projects = $this->getUserProjectRelation($userId);
     $infoKey = '';
     //Build values array
     $values = array('firstname' => $row['firstname'], 'lastname' => $row['lastname'], 'user' => $row['username'], 'phone' => $row['phone'], 'role' => $row['role']);
     //Save form
     if (isset($_POST['save'])) {
         $values = array('firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'user' => $_POST['user'], 'phone' => $_POST['phone'], 'password' => $hasher->HashPassword($_POST['newPassword']));
         $changedEmail = 0;
         if ($row['username'] != $values['user']) {
             $changedEmail = 1;
         }
         //Validation
         if ($values['user'] !== '') {
             $helper = new helper();
             if ($helper->validateEmail($values['user']) == 1) {
                 if ($_POST['newPassword'] == $_POST['confirmPassword']) {
                     if ($_POST['newPassword'] == '') {
                         $values['password'] = '';
                     } else {
                         $this->editOwn($values, $userId);
                     }
                     if ($changedEmail == 1) {
                         if ($this->usernameExist($values['user'], $userId) === false) {
                             $this->editOwn($values, $userId);
                             $tpl->setNotification('EDIT_SUCCESS', 'success');
                         } else {
                             $tpl->setNotification('USERNAME_EXISTS', 'error');
                         }
                     } else {
                         $this->editOwn($values, $userId);
                         $tpl->setNotification('EDIT_SUCCESS', 'success');
                     }
                 } else {
                     $tpl->setNotification('PASSWORDS_DONT_MATCH', 'ERROR');
                 }
             } else {
                 $tpl->setNotification('NO_VALID_EMAIL', 'error');
             }
         } else {
             $tpl->setNotification('NO_USERNAME', 'error');
         }
     }
     $file = new files();
     if (isset($_POST['savePic'])) {
         if (isset($_FILES)) {
             $this->setPicture($_FILES, $_SESSION['userdata']['id']);
         }
     }
     //Assign vars
     $users = new users();
     //		$tpl->assign('profilePic', $file->getFilesByModule('user',$_SESSION['userdata']['id']));
     $tpl->assign('profilePic', $users->getProfilePicture($_SESSION['userdata']['id']));
     $tpl->assign('info', $infoKey);
     $tpl->assign('values', $values);
     //$tpl->assign('roles', $this->roles);
     $tpl->assign('user', $row);
     $tpl->display('users.editOwn');
 }
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:70,代码来源:class.editOwn.php

示例3: run

 /**
  * run - display template and edit data
  *
  * @access public
  *
  */
 public function run()
 {
     $tpl = new template();
     //Only admins
     if ($_SESSION['userdata']['role'] == 'admin') {
         if (isset($_GET['id']) === true) {
             $project = new projects();
             $id = (int) $_GET['id'];
             $row = $this->getUser($id);
             $edit = false;
             $infoKey = '';
             //Build values array
             $values = array('firstname' => $row['firstname'], 'lastname' => $row['lastname'], 'user' => $row['username'], 'phone' => $row['phone'], 'status' => $row['status'], 'role' => $row['role'], 'hours' => $row['hours'], 'wage' => $row['wage'], 'clientId' => $row['clientId']);
             if (isset($_POST['save'])) {
                 $values = array('firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'user' => $_POST['user'], 'phone' => $_POST['phone'], 'status' => $_POST['status'], 'role' => $_POST['role'], 'hours' => $_POST['hours'], 'wage' => $_POST['wage'], 'clientId' => $_POST['client']);
                 $changedEmail = 0;
                 if ($row['username'] != $values['user']) {
                     $changedEmail = 1;
                 }
                 if ($values['user'] !== '') {
                     $helper = new helper();
                     if ($helper->validateEmail($values['user']) === 1) {
                         if ($changedEmail == 1) {
                             if ($this->usernameExist($row['username'], $id) === false) {
                                 $edit = true;
                             } else {
                                 $tpl->setNotification('USERNAME_EXISTS', 'error');
                             }
                         } else {
                             $edit = true;
                         }
                     } else {
                         $tpl->setNotification('NO_VALID_EMAIL_' . $helper->validateEmail($values['user']), 'error');
                     }
                 } else {
                     $tpl->setNotification('NO_USERNAME', 'error');
                 }
             }
             //Was everything okay?
             if ($edit !== false) {
                 $this->editUser($values, $id);
                 if (isset($_POST['projects'])) {
                     if ($_POST['projects'][0] !== '0') {
                         $project->editUserProjectRelations($id, $_POST['projects']);
                     } else {
                         $project->deleteAllProjectRelations($id);
                     }
                 }
                 $tpl->setNotification('EDIT_SUCCESS', 'success');
             }
             // Get relations to projects
             $projects = $project->getUserProjectRelation($id);
             $projectrelation = array();
             foreach ($projects as $projectId) {
                 $projectrelation[] = $projectId['projectId'];
             }
             //Assign vars
             $clients = new clients();
             $tpl->assign('clients', $clients->getAll());
             $tpl->assign('allProjects', $project->getAll());
             $tpl->assign('values', $values);
             $tpl->assign('relations', $projectrelation);
             $tpl->assign('roles', $this->getRoles());
             $tpl->assign('status', $this->status);
             $tpl->display('users.editUser');
         } else {
             $tpl->display('general.error');
         }
     } else {
         $tpl->display('general.error');
     }
 }
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:78,代码来源:class.editUser.php


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