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


PHP Users::userExists方法代码示例

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


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

示例1: perform

 function perform()
 {
     // if all data is correct, then we can proceed and use it
     $tf = new Textfilter();
     $this->userName = $tf->filterAllHTML($this->_request->getValue("userName"));
     $this->userPassword = $tf->filterAllHTML($this->_request->getValue("userPassword"));
     $this->confirmPassword = $tf->filterAllHTML($this->_request->getValue("userPasswordCheck"));
     $this->userEmail = $tf->filterAllHTML($this->_request->getValue("userEmail"));
     $this->userFullName = $tf->filterAllHTML($this->_request->getValue("userFullName"));
     $this->captcha = $this->_request->getValue("userAuth");
     // check if there is already a user with the same username and quit if so
     $users = new Users();
     if ($users->userExists($this->userName)) {
         $this->_view = new SummaryUserCreationView();
         //$this->_form->hasRun( true );
         $this->_form->setFieldValidationStatus("userName", false);
         $this->setCommonData(true);
         return false;
     }
     // check if this email account has registered and quit if so, but only if the configuration
     // says that we should only allow one blog per email account
     if ($this->_config->getValue("force_one_blog_per_email_account")) {
         if ($users->emailExists($this->userEmail)) {
             $this->_view = new SummaryUserCreationView();
             //$this->_form->hasRun( true );
             $this->_form->setFieldValidationStatus("userEmail", false);
             $this->setCommonData(true);
             return false;
         }
     }
     // check if the passwords match, and stop processing if so too
     if ($this->userPassword != $this->confirmPassword) {
         $this->_view = new SummaryUserCreationView();
         $this->_view->setErrorMessage($this->_locale->tr("error_passwords_dont_match"));
         $this->_form->setFieldValidationStatus("userPasswordCheck", false);
         $this->setCommonData(true);
         return false;
     }
     // check if the captcha matches
     if ($this->_config->getValue("use_captcha_auth")) {
         include_once PLOG_CLASS_PATH . "class/data/captcha/captcha.class.php";
         $captcha = new Captcha();
         if (!$captcha->validate($this->captcha)) {
             $this->_view = new SummaryUserCreationView();
             $this->_view->setErrorMessage($this->_locale->tr("error_invalid_auth_code"));
             $this->_form->setFieldValidationStatus("userAuth", false);
             $this->setCommonData(true);
             return false;
         }
     }
     // if everything went fine, then proceed
     $this->_view = new doBlogRegistrationView();
     $this->setValues();
     $this->setCommonData();
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:56,代码来源:dousercreation.class.php

示例2: __construct

 /**
  * Constructs the class and sets class properties
  * @param mixed  $field_id Value of the identification column
  * @param string $id_field Identification column
  */
 public function __construct($field_id, $id_field = 'id')
 {
     $this->id_field = $id_field;
     $this->user_id = $field_id;
     Users::$id_field = $id_field;
     if (!Users::userExists($field_id)) {
         //Kernel::Log('User with '.$id_field.' '.$field_id.' does not exist');
         return false;
     }
     $this->boot = true;
     $this->refreshCache($id_field, $field_id);
 }
开发者ID:studio-wolfree,项目名称:sonicwulf-php,代码行数:17,代码来源:User.php

示例3: usrUid

 /**
  * Validate usr_uid
  *
  * @param string $usr_uid, Uid for user
  * @param string $nameField . Name of field for message
  *
  * @access public
  * @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
  * @copyright Colosa - Bolivia
  *
  * @return string
  */
 public static function usrUid($usr_uid, $nameField = 'usr_uid')
 {
     $usr_uid = trim($usr_uid);
     if ($usr_uid == '') {
         throw new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array($nameField, '')));
     }
     $oUsers = new \Users();
     if (!$oUsers->userExists($usr_uid)) {
         throw new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array($nameField, $usr_uid)));
     }
     return $usr_uid;
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:24,代码来源:Validator.php

示例4: perform

 function perform()
 {
     // fetch the validated data
     $this->_userName = Textfilter::filterAllHTML($this->_request->getValue("userName"));
     $this->_userPassword = $this->_request->getValue("newUserPassword");
     $this->_userEmail = Textfilter::filterAllHTML($this->_request->getValue("userEmail"));
     $this->_userFullName = Textfilter::filterAllHTML($this->_request->getValue("userFullName"));
     $this->_userStatus = $this->_request->getValue("userStatus");
     $this->_userBlog = $this->_request->getValue("userBlog");
     // now that we have validated the data, we can proceed to create the user, making
     // sure that it doesn't already exists
     $users = new Users();
     $userInfo = $users->userExists($this->_userName);
     if ($userInfo) {
         $this->_form->setFieldValidationStatus("userName", false);
         $this->_view = new AdminAddUserView($this->_blogInfo);
         $this->setCommonData(true);
         return false;
     }
     // otherwise, we can create a new one
     $user = new UserInfo($this->_userName, $this->_userPassword, $this->_userEmail, "", $this->_userFullName, 0, $this->_properties);
     $user->setStatus($this->_userStatus);
     $this->notifyEvent(EVENT_PRE_USER_ADD, array("user" => &$user));
     $newUserId = $users->addUser($user);
     if (!$newUserId) {
         $this->_view = new AdminAddUserView($this->_blogInfo);
         $this->_form->setFieldValidationStatus("userName", false);
         $this->setCommonData(true);
         return false;
     }
     // if the userBlog parameter is different than 0, we have to add a relationship
     // between that user and the blog
     if ($this->_userBlog > 0) {
         $permissions = new UserPermissions();
         $result = $permissions->grantPermission($newUserId, $this->_userBlog, PERMISSION_BLOG_USER);
     }
     $this->notifyEvent(EVENT_POST_USER_ADD, array("user" => &$user));
     $this->_view = new AdminSiteUsersListView($this->_blogInfo);
     $this->_view->setSuccessMessage($this->_locale->pr("user_added_ok", $user->getUsername()));
     $this->setCommonData();
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:42,代码来源:adminadduseraction.class.php

示例5: newCaseImpersonate

    /**

     * creates a new case impersonating a user who has the proper privileges to create new cases

     *

     * @param string $processId

     * @param string $userId

     * @param string $variables

     * @param string $taskId, must be in the starting group.

     * @return $result will return an object

     */

    public function newCaseImpersonate ($processId, $userId, $variables, $taskId = '')

    {

        try {

            if (is_array( $variables )) {

                if (count( $variables ) > 0) {

                    $c = count( $variables );

                    $Fields = $variables;

                } else {

                    if ($c == 0) {

                        $result = new wsResponse( 10, G::loadTranslation( 'ID_ARRAY_VARIABLES_EMPTY' ) );



                        return $result;

                    }

                }

            } else {

                $result = new wsResponse( 10, G::loadTranslation( 'ID_VARIABLES_PARAM_NOT_ARRAY' ) );



                return $result;

            }



            $processes = new Processes();



            if (! $processes->processExists( $processId )) {

                $result = new wsResponse( 11, G::loadTranslation( 'ID_INVALID_PROCESS' ) . " " . $processId . "!!" );



                return $result;

            }



            $user = new Users();



            if (! $user->userExists( $userId )) {

                $result = new wsResponse( 11, G::loadTranslation( 'ID_USER_NOT_REGISTERED' ) . " " . $userId . "!!" );



                return $result;

            }



            $oCase = new Cases();



            $numTasks = 0;

            if ($taskId != '') {

                $aTasks = $processes->getStartingTaskForUser( $processId, null );

//.........这里部分代码省略.........
开发者ID:nhenderson,项目名称:processmaker,代码行数:101,代码来源:class.wsBase.php

示例6: getCompleteDocumentInfo


//.........这里部分代码省略.........
                            if ($pluginDetail) {
                                if ($pluginDetail->enabled) {
                                    require_once (PATH_PLUGINS . $pluginName . ".php");
                                    $pluginNameClass = $pluginName . "Plugin";
                                    $objPluginClass = new $pluginNameClass( $pluginName );

                                    if (isset( $objPluginClass->sMethodGetUrlDownload ) && ! empty( $objPluginClass->sMethodGetUrlDownload )) {
                                        if (file_exists( PATH_PLUGINS . $pluginName . PATH_SEP . "class." . $pluginName . ".php" )) {
                                            require_once (PATH_PLUGINS . $pluginName . PATH_SEP . "class." . $pluginName . ".php");
                                            $pluginNameClass = $pluginName . "Class";
                                            $objClass = new $pluginNameClass();

                                            if (method_exists( $objClass, $objPluginClass->sMethodGetUrlDownload )) {
                                                eval( "\$url = \$objClass->" . $objPluginClass->sMethodGetUrlDownload . "(\"" . $row1["APP_DOC_UID"] . "\");" );
                                                $downloadLink = $url;
                                                $fieldValue = $row1["APP_DOC_PLUGIN"];
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        $row1["APP_DOC_PLUGIN"] = $fieldValue;
                    }
                    break;
                default:
                    $row4 = array ();
                    $versioningEnabled = false;
                    $downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion;
                    $downloadLink1 = "";
                    $downloadLabel = G::LoadTranslation( 'ID_DOWNLOAD' );
                    $downloadLabel1 = "";
                    break;
            }
            $oUser = new Users();
            if (($usrId != "-1") && ($oUser->userExists( $usrId ))) {
                $row5 = $oUser->load( $usrId );
            } else {
                $row5['USR_USERNAME'] = "***";
            }

            //Labels/Links
            $row6 = array ();
            $row6['DELETE_LABEL'] = G::LoadTranslation( 'ID_DELETE' );
            $row6['DOWNLOAD_LABEL'] = $downloadLabel;
            $row6['DOWNLOAD_LINK'] = $downloadLink;
            $row6['DOWNLOAD_LABEL1'] = $downloadLabel1;
            $row6['DOWNLOAD_LINK1'] = $downloadLink1;
            //if(($docVersion>1)&&($row1['APP_DOC_TYPE']!="OUTPUT")){
            if (($docVersion > 1)) {
                $row6['VERSIONHISTORY_LABEL'] = G::LoadTranslation( 'ID_VERSION_HISTORY' );
            }
            if ($versioningEnabled) {
                $row6['NEWVERSION_LABEL'] = G::LoadTranslation( 'ID_NEW_VERSION' );
            }
            $row6['APP_DOC_UID_VERSION'] = $appDocUid . "_" . $docVersion;

            if ($appUid == "00000000000000000000000000000000") {
                //External Files
                $row1['APP_DOC_TYPE'] = G::LoadTranslation( 'ID_EXTERNAL_FILE' );
            }
            //**** End get docinfo
            $infoMerged = array_merge( $row1, $row2, $row3, $row4, $row5, $row6 );

            $sUserUID = $_SESSION['USER_LOGGED'];
            $aObjectPermissions = array ();
            if (isset( $infoMerged['PRO_UID'] )) {
                $aObjectPermissions = $oCase->getAllObjects( $infoMerged['PRO_UID'], $infoMerged['APP_UID'], '', $sUserUID );
            }

            if (! is_array( $aObjectPermissions )) {
                $aObjectPermissions = array ('DYNAFORMS' => array (- 1),
                'INPUT_DOCUMENTS' => array (- 1),
                'OUTPUT_DOCUMENTS' => array (- 1)
                );
            }
            if (! isset( $aObjectPermissions['DYNAFORMS'] )) {
                $aObjectPermissions['DYNAFORMS'] = array (- 1);
            } else {
                if (! is_array( $aObjectPermissions['DYNAFORMS'] )) {
                    $aObjectPermissions['DYNAFORMS'] = array (- 1);
                }
            }
            if (! isset( $aObjectPermissions['INPUT_DOCUMENTS'] )) {
                $aObjectPermissions['INPUT_DOCUMENTS'] = array (- 1);
            } else {
                if (! is_array( $aObjectPermissions['INPUT_DOCUMENTS'] )) {
                    $aObjectPermissions['INPUT_DOCUMENTS'] = array (- 1);
                }
            }
            if (! isset( $aObjectPermissions['OUTPUT_DOCUMENTS'] )) {
                $aObjectPermissions['OUTPUT_DOCUMENTS'] = array (- 1);
            } else {
                if (! is_array( $aObjectPermissions['OUTPUT_DOCUMENTS'] )) {
                    $aObjectPermissions['OUTPUT_DOCUMENTS'] = array (- 1);
                }
            }
            return array_merge( $infoMerged, $aObjectPermissions );
        }
    }
开发者ID:rrsc,项目名称:processmaker,代码行数:101,代码来源:AppFolder.php

示例7: submitNewUser

 static function submitNewUser($username, $password, $email, $password2 = null)
 {
     if (!registerUsers()) {
         return 5;
     }
     // admin has disabled registering new users
     $email = filter_var($email, FILTER_SANITIZE_EMAIL);
     $username = validateUserName($username) ? $username : false;
     $password = validatePassword($password) ? $password : false;
     if (!$username || !$password) {
         return 1;
         // username or password does not meet the requirements
     }
     if (isset($password2)) {
         $password2 = validatePassword($password2) ? $password2 : false;
         if ($password2 != false) {
             //$password2 = passwordHash($password2);
             if ($password2 != $password) {
                 return 4;
                 // passwords do not match
             }
         } else {
             return 4;
         }
     }
     $password = passwordHash($password);
     $current_datetime = jDateTime::gdate('Y-m-d H:i:s');
     if (Users::userExists($username)) {
         return 2;
         // username already exist
     }
     $activate = md5($email . time());
     $conn = MySQL::open_conn();
     $query = "INSERT INTO c_users (user_login, user_pass, user_email, user_registered, activate) ";
     $query .= "VALUES ('{$username}', '{$password}', '{$email}', '{$current_datetime}', '{$activate}')";
     $res = $conn->query($query);
     if (!$res) {
         return 3;
     }
     // unknown error while creating new user
     $row = $conn->query("SELECT MAX(ID) AS max FROM c_users")->fetch_array();
     if ($row) {
         $id = $row['max'];
     }
     if (shouldConfMail()) {
         $mail_content = replace_template(getDefaultEmailTemplateContent(), getConfEmailTemplateVars($id));
         Email::sendMail($email, $username, getConfMailSubject(), $mail_content);
     }
     return 0;
 }
开发者ID:VSG24,项目名称:ccms,代码行数:50,代码来源:Users.php

示例8: Exception

     throw new Exception(G::LoadTranslation("ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR"));
 }
 //load the variables
 if ($processFileType == "pm") {
     G::LoadClass('processes');
     $oProcess = new Processes();
 }
 $path = PATH_DOCUMENT . 'input' . PATH_SEP;
 if ($processFileType == "pm") {
     $oData = $oProcess->getProcessData($path . $filename);
 }
 $importer->throwExceptionIfExistsReservedWordsSql($oData);
 //**cheking if the PRO_CREATE_USER exist**//
 $usrCrtr = $oData->process['PRO_CREATE_USER'];
 $exist = new Users();
 if ($exist->userExists($usrCrtr)) {
     $usrInfo = $exist->getAllInformation($usrCrtr);
     if ($usrInfo['status'] == 'CLOSED') {
         $oData->process['PRO_CREATE_USER'] = $_SESSION['USER_LOGGED'];
     }
 } else {
     $oData->process['PRO_CREATE_USER'] = $_SESSION['USER_LOGGED'];
 }
 $Fields['PRO_FILENAME'] = $filename;
 $sProUid = $oData->process['PRO_UID'];
 $oData->process['PRO_UID_OLD'] = $sProUid;
 $result->ExistGroupsInDatabase = 1;
 if (!is_null($optionGroupExistInDatabase)) {
     if ($optionGroupExistInDatabase == 1) {
         $oData->groupwfs = $oProcess->renameExistingGroups($oData->groupwfs);
     } elseif ($optionGroupExistInDatabase == 2) {
开发者ID:emildev35,项目名称:processmaker,代码行数:31,代码来源:processes_Import_Ajax.php

示例9: elseif

 if ($bp_vip == 0) {
     $vip = 0;
     $vip_start = null;
     $vip_expire = null;
 } elseif ($bp_vip == -1) {
     $vip = -1;
     $vip_start = $current_datetime;
     $vip_expire = null;
 } else {
     $vip = $bp_vip;
     $vip_start = strtotime($current_datetime);
     $vip_expire = strtotime('+' . $vip . ' day', $vip_start);
     $vip_start = $current_datetime;
     $vip_expire = date('Y-m-d H:i:s', $vip_expire);
 }
 if (Users::userExists($username)) {
     goToError('?switch=users#new_user', _e('username_already_exists', '', '', true));
 }
 if (!$username || !$password) {
     goToError('?switch=users#new_user', _e('username_password_wrong', '', '', true));
 }
 if ($bp_role == 'Admin') {
     $role = 4;
 } elseif ($bp_role == 'Super User') {
     $role = 3;
 } elseif ($bp_role == 'Subscriber') {
     $role = 2;
 }
 $query = "INSERT INTO c_users (user_login, user_pass, user_email, user_role, vip_status, vip_start_date, vip_expire_date, user_registered) ";
 $query .= "VALUES ('{$username}', '{$password}', '{$email}', {$role}, {$vip}, '{$vip_start}', '{$vip_expire}', '{$current_datetime}')";
 $res = $conn->query($query);
开发者ID:VSG24,项目名称:ccms,代码行数:31,代码来源:submit_new_user.php

示例10: addCaseImpersonate

 /**
  * Add New Case Impersonate
  *
  * @param string $processUid Unique id of Project
  * @param string $userUid Unique id of User
  * @param string $taskUid Unique id of Case
  * @param array $variables
  *
  * return array Return an array with Task Case
  */
 public function addCaseImpersonate($processUid, $userUid, $taskUid, $variables)
 {
     try {
         \G::LoadClass('wsBase');
         $ws = new \wsBase();
         if ($variables) {
             $variables = array_shift($variables);
         } elseif ($variables == null) {
             $variables = array(array());
         }
         Validator::proUid($processUid, '$pro_uid');
         $user = new \Users();
         if (! $user->userExists( $userUid )) {
             throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('usr_uid')));
         }
         $fields = $ws->newCaseImpersonate($processUid, $userUid, $variables, $taskUid);
         $array = json_decode(json_encode($fields), true);
         if ($array ["status_code"] != 0) {
             if ($array ["status_code"] == 12) {
                 throw (new \Exception(\G::loadTranslation('ID_NO_STARTING_TASK') . '. tas_uid.'));
             } elseif ($array ["status_code"] == 13) {
                 throw (new \Exception(\G::loadTranslation('ID_MULTIPLE_STARTING_TASKS') . '. tas_uid.'));
             }
             throw (new \Exception($array ["message"]));
         } else {
             $array['app_uid'] = $array['caseId'];
             $array['app_number'] = $array['caseNumber'];
             unset($array['status_code']);
             unset($array['message']);
             unset($array['timestamp']);
             unset($array['caseId']);
             unset($array['caseNumber']);
         }
         $oResponse = json_decode(json_encode($array), false);
         //Return
         return $oResponse;
     } catch (\Exception $e) {
         throw $e;
     }
 }
开发者ID:nhenderson,项目名称:processmaker,代码行数:50,代码来源:Cases.php

示例11: validateUsrUid

 /**
  * Validate User Uid
  * @var string $usr_uid. Uid for user
  *
  * @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
  * @copyright Colosa - Bolivia
  *
  * @return string
  */
 public function validateUsrUid($usr_uid)
 {
     $usr_uid = trim($usr_uid);
     if ($usr_uid == '') {
         throw new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array('usr_uid', '')));
     }
     $oUsers = new \Users();
     if (!$oUsers->userExists($usr_uid)) {
         throw new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array('usr_uid', $usr_uid)));
     }
     return $usr_uid;
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:21,代码来源:ProcessPermissions.php

示例12: Users

                 $oData->groupwfs = $oNewGroup;
                 $oData->taskusers = $oProcess->mergeExistingUsers($oBaseGroup, $oNewGroup, $oData->taskusers);
                 $oData->objectPermissions = $oProcess->mergeExistingUsers($oBaseGroup, $oNewGroup, $oData->objectPermissions);
             }
         }
         $result->ExistGroupsInDatabase = 0;
     } else {
         if (!($oProcess->checkExistingGroups($oData->groupwfs) > 0)) {
             $result->ExistGroupsInDatabase = 0;
         }
     }
     //replacing a nonexistent user for the current user
     $UsrUid = $oData->process['PRO_CREATE_USER'];
     G::LoadClass('Users');
     $user = new Users();
     if (!$user->userExists($UsrUid)) {
         $oData->process['PRO_CREATE_USER'] = $_SESSION['USER_LOGGED'];
     }
     //!respect of the groups
     if ($result->ExistProcessInDatabase == 0 && $result->ExistGroupsInDatabase == 0) {
         if ($processFileType == "pm") {
             $oProcess->createProcessFromData($oData, $path . $filename);
         }
     }
     //!data ouput
     $result->sNewProUid = $sProUid;
     $result->proFileName = $Fields['PRO_FILENAME'];
 } catch (Exception $e) {
     $result->response = $e->getMessage();
     $result->catchMessage = $e->getMessage();
     $result->success = true;
开发者ID:ralpheav,项目名称:processmaker,代码行数:31,代码来源:processes_Import_Ajax.php

示例13: throwExceptionIfNotExistsUser

    /**
     * Verify if doesn't exists the User in table USERS
     *
     * @param string $userUid               Unique id of User
     * @param string $fieldNameForException Field name for the exception
     *
     * return void Throw exception if doesn't exists the User in table USERS
     */
    public function throwExceptionIfNotExistsUser($userUid, $fieldNameForException)
    {
        try {
            $user = new \Users();

            if (!$user->userExists($userUid)) {
                throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_EXIST", array($fieldNameForException, $userUid)));
            }
        } catch (\Exception $e) {
            throw $e;
        }
    }
开发者ID:rrsc,项目名称:processmaker,代码行数:20,代码来源:Process.php

示例14: unique_username

 public function unique_username($usr)
 {
     $exists = Users::userExists($usr);
     if ($exists) {
         $this->form_validation->set_message('unique_username', 'The Username already exists. Enter another one.');
         return FALSE;
     } else {
         return TRUE;
     }
 }
开发者ID:bamcod,项目名称:Disease-Surveillance,代码行数:10,代码来源:user_management.php


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