本文整理汇总了PHP中UsersPeer类的典型用法代码示例。如果您正苦于以下问题:PHP UsersPeer类的具体用法?PHP UsersPeer怎么用?PHP UsersPeer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UsersPeer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeIndex
/**
* Executes index action
*
*/
public function executeIndex()
{
$u_id = sfContext::getInstance()->getUser()->getAttribute('subscriber_id', '-1', 'subscriber');
if ($u_id <= 0) {
$this->subscribe = null;
if ($this->getRequest()->getMethod() == sfRequest::POST) {
try {
$newUser = $this->getRequestParameter('email');
$this->subscribe = 'Thanks, we will contact you shortly at the email address you have provided';
/*$connection = new Swift_Connection_SMTP('smtp.gmail.com', 465, Swift_Connection_SMTP::ENC_SSL);
$connection->setUsername('cyclebrain@gmail.com');
$connection->setPassword('bRb061626');
$mailer = new Swift($connection);
$message = new Swift_Message('USER REQUEST-'.$email);
// Send
$mailer->send($message, 'cyclebrain@gmail.com', 'cyclebrain@gmail.com');
$mailer->disconnect();
*/
$email = new CycleBrainEmail();
$email->sendEmail('cyclebrain@gmail.com', 'admin@cyclebrain.com', 'BETA USER', $newUser);
} catch (Exception $e) {
echo 'MainActions:Index Caught exception: ', $e->getMessage(), "\n";
}
}
} else {
$this->user = UsersPeer::retrieveByPK($u_id);
}
}
示例2: getEmailEventAccounts
/**
* Get the email accounts of the current workspace
*
* return array
*/
public function getEmailEventAccounts()
{
try {
$criteria = new \Criteria("workflow");
$criteria->clearSelectColumns();
$criteria->addSelectColumn(\UsersPeer::USR_UID);
$criteria->addSelectColumn(\UsersPeer::USR_EMAIL);
$criteria->addAsColumn('UID', 'USR_UID');
$criteria->addAsColumn('EMAIL', 'USR_EMAIL');
$criteria->add(\UsersPeer::USR_STATUS, "ACTIVE");
$result = \UsersPeer::doSelectRS($criteria);
$result->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$result->next();
$accountsArray = array();
while ($aRow = $result->getRow()) {
if (($aRow['USR_EMAIL'] != null) || ($aRow['USR_EMAIL'] != "")) {
$accountsArray[] = array_change_key_case($aRow, CASE_LOWER);
}
$result->next();
}
return $accountsArray;
} catch (\Exception $e) {
throw $e;
}
}
示例3: init
public function init()
{
parent::init();
// Verify we're on the correct database
//print_r(coreConfig::get('database_connection'));exit;
$connectionInfo = coreConfig::get('database_connection');
$this->verbose("Using database: %s", $connectionInfo['database']);
$username = trim($this->getOption('u'));
$raw_password = trim($this->getOption('p'));
if (empty($username) || empty($raw_password)) {
$this->throwError('Username or password is empty.');
}
$userid = UsersPeer::getUserId($username);
if (false === $userid) {
$this->throwError('User named "%s" not found.', $username);
}
$this->verbose("Userid: %s", $userid);
$this->verbose("Set password to: %s", $raw_password);
// update user record
if (false === UsersPeer::updateUser($userid, array('raw_password' => $raw_password))) {
$this->throwError('Could not update user "%s" (userid %s)', $username, $userid);
}
// only with linked PunBB forum
if ($this->args->flag('forum')) {
if (coreConfig::get('app_path_to_punbb') !== null) {
PunBBUsersPeer::setPassword($username, $raw_password);
} else {
$this->throwError('Forum password: "app_path_to_punbb" is not defined in environment "%s"', CORE_ENVIRONMENT);
}
}
$this->verbose('Success!');
}
示例4: executeShow
public function executeShow()
{
$this->users = UsersPeer::retrieveByPk($this->getRequestParameter('id'));
$c = new Criteria();
$c->add(RolePeer::ID, $this->users->getRoleId());
$this->roles = RolePeer::doSelect($c);
$this->forward404Unless($this->users);
}
示例5: createUser
private function createUser($username, $raw_password)
{
$userinfo = array('username' => $username, 'password' => coreContext::getInstance()->getUser()->getSaltyHashedPassword($raw_password), 'userlevel' => $this->getOption('level', UsersPeer::USERLEVEL_USER), 'email' => trim($this->getOption('email', 'created@localhost')), 'location' => trim($this->getOption('location', 'localhost')));
//die(print_r($userinfo, true));
if (false === UsersPeer::createUser($userinfo)) {
$this->throwError('Could not create user.');
}
}
示例6: updateUser
/**
* Updates any column data for given user id.
*
* 'raw_password' will be hashed as required and stored into 'password' column.
*
* @param int $userid
* @param array $data
* @return boolean
*/
private function updateUser($userid, $data)
{
if (isset($data['raw_password'])) {
$data['password'] = coreContext::getInstance()->getUser()->getSaltyHashedPassword($data['raw_password']);
unset($data['raw_password']);
}
if (false === UsersPeer::updateUser($userid, $data)) {
$this->throwError('Could not update user id %s', $userid);
}
return true;
}
示例7: executeIndex
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfWebRequest $request)
{
$uid = $this->getRequestParameter('uid');
$conf = $this->getRequestParameter('conf');
$c = new Criteria();
$c->add(UsersPeer::USER_ID, $uid);
$user = UsersPeer::doSelectOne($c);
if (sha1($user->getSalt() . $user->getUsername()) == $conf) {
$this->goodConf = true;
$user->setActive('Y');
$user->save();
} else {
$this->goodConf = false;
}
}
示例8: executeLogin
public function executeLogin()
{
$c = new Criteria();
$c->add(UsersPeer::USER_NAME, $this->getRequestParameter('login'));
$c->add(UsersPeer::USER_PWD, $this->getRequestParameter('password'));
$user_record = UsersPeer::doSelectOne($c);
if ($user_record) {
$this->getUser()->setAuthenticated(true);
$c = new Criteria();
$c->add(RolePeer::ID, $user_record->getRoleId());
$user_role = RolePeer::doSelectOne($c);
$this->getUser()->addCredential($user_role->getRoleName());
return $this->redirect('users');
} else {
$this->getRequest()->setError('login', 'incorrect entry');
return $this->forward('security', 'index');
}
}
示例9: executeLogin
/**
* Sign In form.
*
* @return
*/
public function executeLogin($request)
{
if ($request->getMethod() != coreRequest::POST) {
// get the referer option from redirectToLogin()
$referer = $this->getUser()->getAttribute('login_referer', '');
// get other options from redirectToLogin()
$username = $this->getUser()->getAttribute('login_username', '');
// clear redirectToLogin() options
$this->getUser()->getAttributeHolder()->remove('login_referer');
$this->getUser()->getAttributeHolder()->remove('login_username');
$this->getRequest()->setParameter('referer', empty($referer) ? '@homepage' : $referer);
$this->getRequest()->setParameter('username', $username);
// AUTO FILL FORM (DEVELOPMENT ONLY!)
if (CORE_ENVIRONMENT === 'dev') {
$request->getParameterHolder()->add(array('username' => 'guest', 'password' => ''));
}
} else {
$validator = new coreValidator($this->getActionName());
if ($validator->validate($request->getParameterHolder()->getAll())) {
$username = trim($request->getParameter('username'));
$raw_password = trim($request->getParameter('password'));
$rememberme = $request->hasParameter('rememberme');
// check that user exists and password matches
$user = UsersPeer::getUser($username);
if (!$user || $this->getUser()->getSaltyHashedPassword($raw_password) != $user['password']) {
$request->setError('login_invalid', "Invalid username and/or password.");
return;
}
// sign in user
$this->getUser()->signIn($user);
// optionally, create the remember me cookie
if ($rememberme) {
$this->getUser()->setRememberMeCookie($user['username'], $this->getUser()->getSaltyHashedPassword($raw_password));
}
// authenticate user on the community forums
if (coreContext::getInstance()->getConfiguration()->getEnvironment() !== 'staging' && coreConfig::get('app_path_to_punbb') !== null) {
PunBBUsersPeer::signIn($username, $raw_password, $rememberme);
}
// succesfully signed in
return $this->redirect($this->getRequestParameter('referer', '@homepage'));
}
}
}
示例10: executeIndex
public function executeIndex($request)
{
$username = $request->getParameter('username');
if (!$username) {
if ($this->getUser()->isAuthenticated()) {
$username = $this->getUser()->getUserName();
} else {
// if unauthenticated user checks his (bookmarked?) profile, go to login and back
$url = $this->getController()->genUrl('profile/index', true);
$this->getUser()->redirectToLogin(array('referer' => $url));
}
}
if ($user = UsersPeer::getUser($username)) {
$this->user = $user;
$this->self_account = $user['username'] == $this->getUser()->getUserName();
$this->kanji_count = ReviewsPeer::getReviewedFlashcardCount($user['userid']);
$this->total_reviews = ReviewsPeer::getTotalReviews($user['userid']);
$this->forum_uid = coreConfig::get('app_path_to_punbb') !== null ? PunBBUsersPeer::getInstance()->getForumUID($username) : false;
return coreView::SUCCESS;
}
return coreView::ERROR;
}
示例11: adhocAssignUsersk
function adhocAssignUsersk($params)
{
G::LoadClass('groups');
G::LoadClass('tasks');
$oTasks = new Tasks();
$aAux = $oTasks->getGroupsOfTask($_SESSION['TASK'], 2);
$aAdhocUsers = array();
$oGroups = new Groups();
foreach ($aAux as $aGroup) {
$aUsers = $oGroups->getUsersOfGroup($aGroup['GRP_UID']);
foreach ($aUsers as $aUser) {
if ($aUser['USR_UID'] != $_SESSION['USER_LOGGED']) {
$aAdhocUsers[] = $aUser['USR_UID'];
}
}
}
$aAux = $oTasks->getUsersOfTask($_SESSION['TASK'], 2);
foreach ($aAux as $aUser) {
if ($aUser['USR_UID'] != $_SESSION['USER_LOGGED']) {
$aAdhocUsers[] = $aUser['USR_UID'];
}
}
require_once 'classes/model/Users.php';
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(UsersPeer::USR_UID);
$oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$oCriteria->add(UsersPeer::USR_UID, $aAdhocUsers, Criteria::IN);
$oDataset = UsersPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$aData = array();
while ($oDataset->next()) {
$aData[] = $oDataset->getRow();
}
$this->data = $aData;
}
示例12: reassignCase
/**
* reassign Case
*
* @param string sessionId : The session ID (which was obtained during login)
* @param string caseId : The case ID (which can be obtained with the caseList() function)
* @param string delIndex : The delegation index number of the case (which can be obtained with the caseList()
* function).
* @param string userIdSource : The user who is currently assigned the case.
* @param string userIdTarget : The target user who will be newly assigned to the case.
* @return $result will return an object
*/
public function reassignCase ($sessionId, $caseId, $delIndex, $userIdSource, $userIdTarget)
{
$g = new G();
try {
$g->sessionVarSave();
$_SESSION["APPLICATION"] = $caseId;
$_SESSION["INDEX"] = $delIndex;
$_SESSION["USER_LOGGED"] = $userIdSource;
if ($userIdTarget == $userIdSource) {
$result = new wsResponse( 30, G::loadTranslation( 'ID_TARGET_ORIGIN_USER_SAME' ) );
$g->sessionVarRestore();
return $result;
}
/**
* ****************( 1 )*****************
*/
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( UsersPeer::USR_STATUS, 'ACTIVE' );
$oCriteria->add( UsersPeer::USR_UID, $userIdSource );
$oDataset = UsersPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aRow = $oDataset->getRow();
if (! is_array( $aRow )) {
$result = new wsResponse( 31, G::loadTranslation( 'ID_INVALID_ORIGIN_USER' ) );
$g->sessionVarRestore();
return $result;
}
/**
//.........这里部分代码省略.........
示例13: create
/**
* Create List Completed Table
*
* @param type $data
* @return type
*
*/
public function create($data)
{
$criteria = new Criteria();
$criteria->addSelectColumn(ListCompletedPeer::APP_UID);
$criteria->add( ListCompletedPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL );
$dataset = ListCompletedPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($dataset->next()) {
return 1;
}
$criteria = new Criteria();
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
$criteria->add( ContentPeer::CON_ID, $data['APP_UID'], Criteria::EQUAL );
$criteria->add( ContentPeer::CON_CATEGORY, 'APP_TITLE', Criteria::EQUAL );
$criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL );
$dataset = ContentPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
$data['APP_TITLE'] = $aRow['CON_VALUE'];
$criteria = new Criteria();
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
$criteria->add( ContentPeer::CON_ID, $data['PRO_UID'], Criteria::EQUAL );
$criteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE', Criteria::EQUAL );
$criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL );
$dataset = ContentPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
$data['APP_PRO_TITLE'] = $aRow['CON_VALUE'];
$criteria = new Criteria();
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
$criteria->add( ContentPeer::CON_ID, $data['TAS_UID'], Criteria::EQUAL );
$criteria->add( ContentPeer::CON_CATEGORY, 'TAS_TITLE', Criteria::EQUAL );
$criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL );
$dataset = ContentPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
$data['APP_TAS_TITLE'] = $aRow['CON_VALUE'];
$criteria = new Criteria();
$criteria->addSelectColumn(UsersPeer::USR_USERNAME);
$criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$criteria->add( UsersPeer::USR_UID, $data['USR_UID'], Criteria::EQUAL );
$dataset = UsersPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
$data['DEL_CURRENT_USR_USERNAME'] = $aRow['USR_USERNAME'];
$data['DEL_CURRENT_USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME'];
$data['DEL_CURRENT_USR_LASTNAME'] = $aRow['USR_LASTNAME'];
$data['DEL_PREVIOUS'] = isset($data['DEL_PREVIOUS']) ? $data['DEL_PREVIOUS'] : "";
if ($data['DEL_PREVIOUS'] != 0) {
$criteria = new Criteria();
$criteria->addSelectColumn(AppDelegationPeer::USR_UID);
$criteria->add( AppDelegationPeer::DEL_INDEX, $data['DEL_PREVIOUS'], Criteria::EQUAL );
$dataset = UsersPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
$data['DEL_PREVIOUS_USR_UID'] = $aRow['USR_UID'];
}
//Update - WHERE
$criteriaWhere = new Criteria("workflow");
$criteriaWhere->add(ListParticipatedLastPeer::APP_UID, $data["APP_UID"], Criteria::EQUAL);
//Update - SET
$criteriaSet = new Criteria("workflow");
$criteriaSet->add(ListParticipatedLastPeer::APP_STATUS, 'COMPLETED');
BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));
$users = new Users();
$users->refreshTotal($data['USR_UID'], 'add', 'completed');
if ($data['DEL_PREVIOUS'] != 0) {
$criteria = new Criteria();
$criteria->addSelectColumn(TaskPeer::TAS_TYPE);
$criteria->add( TaskPeer::TAS_UID, $data['TAS_UID'], Criteria::EQUAL );
$dataset = TaskPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
if ($aRow['TAS_TYPE'] != 'SUBPROCESS') {
$users->refreshTotal($data['USR_UID'], 'remove', 'inbox');
}
//.........这里部分代码省略.........
示例14: getSelectForActiveMembersList
/**
* Return Select object for the active members list.
*
* @param
* @return coreDatabaseSelect
*/
public static function getSelectForActiveMembersList()
{
return self::getInstance()->select(array(self::getInstance()->getName() . '.userid', 'username', 'location', 'fc_count', 'ts_lastreview' => 'UNIX_TIMESTAMP(last_review)'))->joinUsing(UsersPeer::getInstance()->getName(), 'userid');
}
示例15: fromArray
/**
* Populates the object using an array.
*
* This is particularly useful when populating an object from one of the
* request arrays (e.g. $_POST). This method goes through the column
* names, checking to see whether a matching key exists in populated
* array. If so the setByName() method is called for that column.
*
* You can specify the key type of the array by additionally passing one
* of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
* TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
* @return void
*/
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
{
$keys = UsersPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) {
$this->setUsrUid($arr[$keys[0]]);
}
if (array_key_exists($keys[1], $arr)) {
$this->setUsrUsername($arr[$keys[1]]);
}
if (array_key_exists($keys[2], $arr)) {
$this->setUsrPassword($arr[$keys[2]]);
}
if (array_key_exists($keys[3], $arr)) {
$this->setUsrFirstname($arr[$keys[3]]);
}
if (array_key_exists($keys[4], $arr)) {
$this->setUsrLastname($arr[$keys[4]]);
}
if (array_key_exists($keys[5], $arr)) {
$this->setUsrEmail($arr[$keys[5]]);
}
if (array_key_exists($keys[6], $arr)) {
$this->setUsrDueDate($arr[$keys[6]]);
}
if (array_key_exists($keys[7], $arr)) {
$this->setUsrCreateDate($arr[$keys[7]]);
}
if (array_key_exists($keys[8], $arr)) {
$this->setUsrUpdateDate($arr[$keys[8]]);
}
if (array_key_exists($keys[9], $arr)) {
$this->setUsrStatus($arr[$keys[9]]);
}
if (array_key_exists($keys[10], $arr)) {
$this->setUsrCountry($arr[$keys[10]]);
}
if (array_key_exists($keys[11], $arr)) {
$this->setUsrCity($arr[$keys[11]]);
}
if (array_key_exists($keys[12], $arr)) {
$this->setUsrLocation($arr[$keys[12]]);
}
if (array_key_exists($keys[13], $arr)) {
$this->setUsrAddress($arr[$keys[13]]);
}
if (array_key_exists($keys[14], $arr)) {
$this->setUsrPhone($arr[$keys[14]]);
}
if (array_key_exists($keys[15], $arr)) {
$this->setUsrFax($arr[$keys[15]]);
}
if (array_key_exists($keys[16], $arr)) {
$this->setUsrCellular($arr[$keys[16]]);
}
if (array_key_exists($keys[17], $arr)) {
$this->setUsrZipCode($arr[$keys[17]]);
}
if (array_key_exists($keys[18], $arr)) {
$this->setDepUid($arr[$keys[18]]);
}
if (array_key_exists($keys[19], $arr)) {
$this->setUsrPosition($arr[$keys[19]]);
}
if (array_key_exists($keys[20], $arr)) {
$this->setUsrResume($arr[$keys[20]]);
}
if (array_key_exists($keys[21], $arr)) {
$this->setUsrBirthday($arr[$keys[21]]);
}
if (array_key_exists($keys[22], $arr)) {
$this->setUsrRole($arr[$keys[22]]);
}
if (array_key_exists($keys[23], $arr)) {
$this->setUsrReportsTo($arr[$keys[23]]);
}
if (array_key_exists($keys[24], $arr)) {
$this->setUsrReplacedBy($arr[$keys[24]]);
}
if (array_key_exists($keys[25], $arr)) {
$this->setUsrUx($arr[$keys[25]]);
}
if (array_key_exists($keys[26], $arr)) {
$this->setUsrTotalInbox($arr[$keys[26]]);
}
//.........这里部分代码省略.........