/** * Registers a new user * * @param UserTable $user * @param Hybrid_User_Profile $profile * @return bool */ private function register( $user, $profile ) { global $_CB_framework, $_PLUGINS, $ueConfig; if ( ! $profile->identifier ) { cbRedirect( $this->_returnUrl, CBTxt::T( 'PROVIDER_PROFILE_MISSING', '[provider] profile could not be found.', array( '[provider]' => $this->_providerName ) ), 'error' ); return false; } $mode = $this->params->get( $this->_provider . '_mode', 1, GetterInterface::INT ); $approve = $this->params->get( $this->_provider . '_approve', 0, GetterInterface::INT ); $confirm = $this->params->get( $this->_provider . '_confirm', 0, GetterInterface::INT ); $usergroup = $this->params->get( $this->_provider . '_usergroup', null, GetterInterface::STRING ); $approval = ( $approve == 2 ? $ueConfig['reg_admin_approval'] : $approve ); $confirmation = ( $confirm == 2 ? $ueConfig['reg_confirmation'] : $confirm ); $usernameFormat = $this->params->get( $this->_provider . '_username', null, GetterInterface::STRING ); $username = null; $dummyUser = new UserTable(); if ( $usernameFormat ) { $extras = array( 'provider' => $this->_provider, 'provider_id' => $this->_providerId, 'provider_name' => $this->_providerName ); foreach ( (array) $profile as $k => $v ) { if ( ( ! is_array( $v ) ) && ( ! is_object( $v ) ) ) { $k = 'profile_' . $k; $extras[$k] = $v; } } $username = preg_replace( '/[<>\\\\"%();&\']+/', '', trim( cbReplaceVars( $usernameFormat, $user, true, false, $extras, false ) ) ); } else { if ( isset( $profile->username ) ) { $username = preg_replace( '/[<>\\\\"%();&\']+/', '', trim( $profile->username ) ); } if ( ( ! $username ) || ( $username && $dummyUser->loadByUsername( $username ) ) ) { $username = preg_replace( '/[<>\\\\"%();&\']+/', '', trim( $profile->displayName ) ); } } if ( ( ! $username ) || ( $username && $dummyUser->loadByUsername( $username ) ) ) { $username = (string) $profile->identifier; } if ( $mode == 2 ) { $user->set( 'email', $profile->email ); } else { if ( $dummyUser->loadByUsername( $username ) ) { cbRedirect( $this->_returnUrl, CBTxt::T( 'UE_USERNAME_NOT_AVAILABLE', "The username '[username]' is already in use.", array( '[username]' => htmlspecialchars( $username ) ) ), 'error' ); return false; } if ( ! $this->email( $user, $profile ) ) { return false; } if ( $dummyUser->loadByEmail( $user->get( 'email' ) ) ) { cbRedirect( $this->_returnUrl, CBTxt::T( 'UE_EMAIL_NOT_AVAILABLE', "The email '[email]' is already in use.", array( '[email]' => htmlspecialchars( $user->get( 'email' ) ) ) ), 'error' ); return false; } $this->avatar( $user, $profile, $mode ); if ( ! $usergroup ) { $gids = array( (int) $_CB_framework->getCfg( 'new_usertype' ) ); } else { $gids = cbToArrayOfInt( explode( '|*|', $usergroup ) ); } $user->set( 'gids', $gids ); $user->set( 'sendEmail', 0 ); $user->set( 'registerDate', $_CB_framework->getUTCDate() ); $user->set( 'password', $user->hashAndSaltPassword( $user->getRandomPassword() ) ); $user->set( 'registeripaddr', cbGetIPlist() ); if ( $approval == 0 ) { $user->set( 'approved', 1 ); } else { $user->set( 'approved', 0 ); } if ( $confirmation == 0 ) { $user->set( 'confirmed', 1 ); } else { $user->set( 'confirmed', 0 ); } if ( ( $user->get( 'confirmed' ) == 1 ) && ( $user->get( 'approved' ) == 1 ) ) { $user->set( 'block', 0 ); } else { $user->set( 'block', 1 ); } } if ( $profile->firstName || $profile->lastName ) { $user->set( 'name', trim( $profile->firstName . ' ' . $profile->lastName ) ); } elseif ( $profile->displayName ) { $user->set( 'name', trim( $profile->displayName ) ); } else { $user->set( 'name', $username ); } switch ( $ueConfig['name_style'] ) { case 2: $lastName = strrpos( $user->get( 'name' ), ' ' ); if ( $lastName !== false ) { $user->set( 'firstname', substr( $user->get( 'name' ), 0, $lastName ) ); $user->set( 'lastname', substr( $user->get( 'name' ), ( $lastName + 1 ) ) ); } else { $user->set( 'firstname', '' ); $user->set( 'lastname', $user->get( 'name' ) ); } break; case 3: $middleName = strpos( $user->get( 'name' ), ' ' ); $lastName = strrpos( $user->get( 'name' ), ' ' ); if ( $lastName !== false ) { $user->set( 'firstname', substr( $user->get( 'name' ), 0, $middleName ) ); $user->set( 'lastname', substr( $user->get( 'name' ), ( $lastName + 1 ) ) ); if ( $middleName !== $lastName ) { $user->set( 'middlename', substr( $user->get( 'name' ), ( $middleName + 1 ), ( $lastName - $middleName - 1 ) ) ); } else { $user->set( 'middlename', '' ); } } else { $user->set( 'firstname', '' ); $user->set( 'lastname', $user->get( 'name' ) ); } break; } $user->set( 'username', $username ); $user->set( $this->_providerField, $profile->identifier ); $this->fields( $user, $profile, $mode ); if ( $mode == 2 ) { foreach ( $user as $k => $v ) { $_POST[$k] = $v; } $emailPass = ( isset( $ueConfig['emailpass'] ) ? $ueConfig['emailpass'] : '******' ); $regErrorMSG = null; if ( ( ( $_CB_framework->getCfg( 'allowUserRegistration' ) == '0' ) && ( ( ! isset( $ueConfig['reg_admin_allowcbregistration'] ) ) || $ueConfig['reg_admin_allowcbregistration'] != '1' ) ) ) { $msg = CBTxt::T( 'UE_NOT_AUTHORIZED', 'You are not authorized to view this page!' ); } else { $msg = null; } $_PLUGINS->loadPluginGroup( 'user' ); $_PLUGINS->trigger( 'onBeforeRegisterFormRequest', array( &$msg, $emailPass, &$regErrorMSG ) ); if ( $msg ) { $_CB_framework->enqueueMessage( $msg, 'error' ); return false; } $fieldsQuery = null; $results = $_PLUGINS->trigger( 'onBeforeRegisterForm', array( 'com_comprofiler', $emailPass, &$regErrorMSG, $fieldsQuery ) ); if ( $_PLUGINS->is_errors() ) { $_CB_framework->enqueueMessage( $_PLUGINS->getErrorMSG( '<br />' ), 'error' ); return false; } if ( implode( '', $results ) != '' ) { $return = '<div class="cb_template cb_template_' . selectTemplate( 'dir' ) . '">' . '<div>' . implode( '</div><div>', $results ) . '</div>' . '</div>'; echo $return; return false; } $_CB_framework->enqueueMessage( CBTxt::T( 'PROVIDER_SIGN_UP_INCOMPLETE', 'Your [provider] sign up is incomplete. Please complete the following.', array( '[provider]' => $this->_providerName ) ) ); HTML_comprofiler::registerForm( 'com_comprofiler', $emailPass, $user, $_POST, $regErrorMSG ); return false; } else { $_PLUGINS->trigger( 'onBeforeUserRegistration', array( &$user, &$user ) ); if ( $user->store() ) { if ( $user->get( 'confirmed' ) == 0 ) { $user->store(); } $messagesToUser = activateUser( $user, 1, 'UserRegistration' ); $_PLUGINS->trigger( 'onAfterUserRegistration', array( &$user, &$user, true ) ); if ( $user->get( 'block' ) == 1 ) { $return = '<div class="cb_template cb_template_' . selectTemplate( 'dir' ) . '">' . '<div>' . implode( '</div><div>', $messagesToUser ) . '</div>' . '</div>'; echo $return; } else { return true; } } cbRedirect( $this->_returnUrl, CBTxt::T( 'SIGN_UP_WITH_PROVIDER_FAILED', 'Sign up with [provider] failed. Error: [error]', array( '[provider]' => $this->_providerName, '[error]' => $user->getError() ) ), 'error' ); return false; } }
/** * @param string $option */ function saveRegistrationNOCHECKSLOL($option) { global $_CB_framework, $_CB_database, $ueConfig, $_POST, $_PLUGINS; // Check rights to access: if ($_CB_framework->getCfg('allowUserRegistration') == '0' && (!isset($ueConfig['reg_admin_allowcbregistration']) || $ueConfig['reg_admin_allowcbregistration'] != '1') || $_CB_framework->myId()) { cbNotAuth(); return; } if (!isset($ueConfig['emailpass'])) { $ueConfig['emailpass'] = '******'; } $userComplete = new moscomprofilerUser($_CB_database); // Pre-registration trigger: $_PLUGINS->loadPluginGroup('user'); $_PLUGINS->trigger('onStartSaveUserRegistration', array()); if ($_PLUGINS->is_errors()) { echo "<script type=\"text/javascript\">alert('" . addslashes($_PLUGINS->getErrorMSG()) . "'); </script>\n"; $oldUserComplete = new moscomprofilerUser($_CB_database); $userComplete->bindSafely($_POST, $_CB_framework->getUi(), 'register', $oldUserComplete); HTML_comprofiler::registerForm($option, $ueConfig['emailpass'], $userComplete, $_POST, $_PLUGINS->getErrorMSG("<br />")); return; } // Check if this user already registered with exactly this username and password: $username = cbGetParam($_POST, 'username', ''); $usernameExists = $userComplete->loadByUsername($username); if ($usernameExists) { $password = cbGetParam($_POST, 'password', '', _CB_ALLOWRAW); if ($userComplete->verifyPassword($password)) { $pwd_md5 = $userComplete->password; $userComplete->password = $password; $messagesToUser = activateUser($userComplete, 1, 'SameUserRegistrationAgain'); $userComplete->password = $pwd_md5; echo "\n<div>" . implode("</div>\n<div>", $messagesToUser) . "</div>\n"; return; } else { $msg = sprintf(_UE_USERNAME_ALREADY_EXISTS, $username); echo "<script type=\"text/javascript\">alert('" . addslashes($msg) . "'); </script>\n"; $oldUserComplete = new moscomprofilerUser($_CB_database); $userComplete->bindSafely($_POST, $_CB_framework->getUi(), 'register', $oldUserComplete); HTML_comprofiler::registerForm($option, $ueConfig['emailpass'], $userComplete, $_POST, htmlspecialchars($msg)); return; } } // Store and check terms and conditions accepted (not a field yet !!!!): if (isset($_POST['acceptedterms'])) { $userComplete->acceptedterms = (int) cbGetParam($_POST, 'acceptedterms', 0) == 1 ? 1 : 0; } else { $userComplete->acceptedterms = null; } if ($ueConfig['reg_enable_toc']) { if ($userComplete->acceptedterms != 1) { echo "<script type=\"text/javascript\">alert('" . addslashes(cbUnHtmlspecialchars(_UE_TOC_REQUIRED)) . "'); </script>\n"; $oldUserComplete = new moscomprofilerUser($_CB_database); $userComplete->bindSafely($_POST, $_CB_framework->getUi(), 'register', $oldUserComplete); HTML_comprofiler::registerForm($option, $ueConfig['emailpass'], $userComplete, $_POST, _UE_TOC_REQUIRED . '<br />'); return; } } // Set id to 0 for autoincrement and store IP address used for registration: $userComplete->id = 0; $userComplete->registeripaddr = cbGetIPlist(); // Store new user state: $saveResult = $userComplete->saveSafely($_POST, $_CB_framework->getUi(), 'register'); if ($saveResult === false) { echo "<script type=\"text/javascript\">alert('" . str_replace('\\\\n', '\\n', addslashes(strip_tags(str_replace('<br />', '\\n', $userComplete->getError())))) . "'); </script>\n"; HTML_comprofiler::registerForm($option, $ueConfig['emailpass'], $userComplete, $_POST, $userComplete->getError()); return; } if ($saveResult['ok'] === true) { $messagesToUser = activateUser($userComplete, 1, "UserRegistration"); } foreach ($saveResult['tabs'] as $res) { if ($res) { $messagesToUser[] = $res; } } if ($saveResult['ok'] === false) { echo "<script type=\"text/javascript\">alert('" . str_replace('\\\\n', '\\n', addslashes(strip_tags(str_replace('<br />', '\\n', $userComplete->getError())))) . "'); </script>\n"; HTML_comprofiler::registerForm($option, $ueConfig['emailpass'], $userComplete, $_POST, $userComplete->getError()); return; } $_PLUGINS->trigger('onAfterUserRegistrationMailsSent', array(&$userComplete, &$userComplete, &$messagesToUser, $ueConfig['reg_confirmation'], $ueConfig['reg_admin_approval'], true)); foreach ($saveResult['after'] as $res) { if ($res) { echo "\n<div>" . $res . "</div>\n"; } } if ($_PLUGINS->is_errors()) { echo $_PLUGINS->getErrorMSG(); HTML_comprofiler::registerForm($option, $ueConfig['emailpass'], $userComplete, $_POST, $_PLUGINS->getErrorMSG()); return; } echo "\n<div>" . implode("</div>\n<div>", $messagesToUser) . "</div>\n"; }
/** * @param int $userId * @param UserTable $user * @return mixed */ public function deleteUser( $userId, $user ) { global $_CB_framework, $_PLUGINS; if ( ! $userId ) { $userId = $user->get( 'id' ); } $profileUrl = $_CB_framework->userProfileUrl( $userId, false ); if ( ! $userId ) { $profileUrl = 'index.php'; } if ( $this->getDeleteField( $userId, $user ) ) { $cbUser = CBuser::getInstance( $userId, false ); $deleteUser = $cbUser->getUserData(); $_PLUGINS->trigger( 'privacy_onBeforeAccountDelete', array( &$deleteUser, $user ) ); if ( $deleteUser->delete( $userId ) ) { $closed = new cbprivacyClosedTable(); $closed->set( 'user_id', (int) $deleteUser->get( 'id' ) ); $closed->set( 'username', $deleteUser->get( 'username' ) ); $closed->set( 'name', $deleteUser->get( 'name' ) ); $closed->set( 'email', $deleteUser->get( 'email' ) ); $closed->set( 'type', 'delete' ); $closed->set( 'date', $_CB_framework->getUTCDate() ); $closed->set( 'reason', $this->input( 'reason', null, GetterInterface::STRING ) ); $closed->store(); $notification = new cbNotification(); $extra = array( 'ip_address' => cbGetIPlist(), 'reason' => $closed->get( 'reason' ), 'date' => $closed->get( 'date' ) ); $subject = $cbUser->replaceUserVars( CBTxt::T( 'User Account Deleted' ), true, false, $extra, false ); $body = $cbUser->replaceUserVars( CBTxt::T( 'Name: [name]<br />Username: [username]<br />Email: [email]<br />IP Address: [ip_address]<br />Date: [date]<br /><br />[reason]<br /><br />' ), false, false, $extra, false ); if ( $subject && $body ) { $notification->sendToModerators( $subject, $body, false, 1 ); } $subject = CBTxt::T( 'Your Account has been Deleted' ); $body = CBTxt::T( 'This is a notice that your account [username] on [siteurl] has been deleted.' ); if ( $subject && $body ) { $notification->sendFromSystem( $deleteUser, $subject, $body, true, 1, null, null, null, $extra ); } $_PLUGINS->trigger( 'privacy_onAfterAccountDelete', array( $deleteUser, $user ) ); cbRedirect( 'index.php', CBTxt::T( 'Account deleted successfully!' ) ); } else { cbRedirect( $profileUrl, CBTxt::T( 'ACCOUNT_FAILED_TO_DELETE', 'Account failed to delete! Error: [error]', array( '[error]' => $deleteUser->getError() ) ), 'error' ); } } cbRedirect( $profileUrl, CBTxt::T( 'Not authorized.' ), 'error' ); }
function saveRegistration($option) { global $_CB_framework, $ueConfig, $_POST, $_PLUGINS; // simple spoof check security checkCBPostIsHTTPS(); cbSpoofCheck('registerForm'); cbRegAntiSpamCheck(); // Check rights to access: if ($_CB_framework->getCfg('allowUserRegistration') == '0' && (!isset($ueConfig['reg_admin_allowcbregistration']) || $ueConfig['reg_admin_allowcbregistration'] != '1') || $_CB_framework->myId()) { $msg = CBTxt::Th('UE_NOT_AUTHORIZED', 'You are not authorized to view this page!'); } else { $msg = null; } $_PLUGINS->loadPluginGroup('user'); $_PLUGINS->trigger('onBeforeSaveUserRegistrationRequest', array(&$msg)); if ($msg) { $_CB_framework->enqueueMessage($msg, 'error'); return; } if (!isset($ueConfig['emailpass'])) { $ueConfig['emailpass'] = '******'; } $userComplete = new UserTable(); // Pre-registration trigger: $_PLUGINS->trigger('onStartSaveUserRegistration', array()); if ($_PLUGINS->is_errors()) { $oldUserComplete = new UserTable(); $userComplete->bindSafely($_POST, $_CB_framework->getUi(), 'register', $oldUserComplete); HTML_comprofiler::registerForm($option, $ueConfig['emailpass'], $userComplete, $_POST, $_PLUGINS->getErrorMSG('<br />')); return; } // Check if this user already registered with exactly this username and password: $username = cbGetParam($_POST, 'username', ''); $usernameExists = $userComplete->loadByUsername($username); if ($usernameExists) { $password = cbGetParam($_POST, 'password', '', _CB_ALLOWRAW); if ($userComplete->verifyPassword($password)) { $pwd_md5 = $userComplete->password; $userComplete->password = $password; $messagesToUser = activateUser($userComplete, 1, 'SameUserRegistrationAgain'); $userComplete->password = $pwd_md5; $return = '<div class="cb_template cb_template_' . selectTemplate('dir') . '">' . '<div>' . implode('</div><div>', $messagesToUser) . '</div>' . '</div>'; echo $return; return; } else { $oldUserComplete = new UserTable(); $userComplete->bindSafely($_POST, $_CB_framework->getUi(), 'register', $oldUserComplete); HTML_comprofiler::registerForm($option, $ueConfig['emailpass'], $userComplete, $_POST, CBTxt::Th('UE_USERNAME_NOT_AVAILABLE', "The username '[username]' is already in use.", array('[username]' => htmlspecialchars($username)))); return; } } // Set id to 0 for autoincrement and store IP address used for registration: $userComplete->id = 0; $userComplete->registeripaddr = cbGetIPlist(); // Store new user state: $saveResult = $userComplete->saveSafely($_POST, $_CB_framework->getUi(), 'register'); if ($saveResult === false) { $regErrorMSG = $userComplete->getError(); $_PLUGINS->trigger('onAfterUserRegistrationSaveFailed', array(&$userComplete, &$regErrorMSG, 1)); HTML_comprofiler::registerForm($option, $ueConfig['emailpass'], $userComplete, $_POST, $regErrorMSG); return; } if ($saveResult['ok'] === true) { $messagesToUser = activateUser($userComplete, 1, 'UserRegistration'); } else { $messagesToUser = array(); } foreach ($saveResult['tabs'] as $res) { if ($res) { $messagesToUser[] = $res; } } if ($saveResult['ok'] === false) { HTML_comprofiler::registerForm($option, $ueConfig['emailpass'], $userComplete, $_POST, $userComplete->getError()); return; } $_PLUGINS->trigger('onAfterUserRegistrationMailsSent', array(&$userComplete, &$userComplete, &$messagesToUser, $ueConfig['reg_confirmation'], $ueConfig['reg_admin_approval'], true)); foreach ($saveResult['after'] as $res) { if ($res) { $messagesToUser[] = $res; } } if ($_PLUGINS->is_errors()) { HTML_comprofiler::registerForm($option, $ueConfig['emailpass'], $userComplete, $_POST, $_PLUGINS->getErrorMSG()); return; } $_PLUGINS->trigger('onAfterSaveUserRegistration', array(&$userComplete, &$messagesToUser, 1)); $return = '<div class="cb_template cb_template_' . selectTemplate('dir') . '">' . '<div>' . implode('</div><div>', $messagesToUser) . '</div>' . '</div>'; echo $return; }
/** * @param cbautoactionsActionTable $trigger * @param UserTable $user */ public function execute( $trigger, $user ) { global $_CB_framework, $_PLUGINS, $ueConfig; $params = $trigger->getParams()->subTree( 'registration' ); $approve = (int) $params->get( 'approve', null, GetterInterface::INT ); $confirm = (int) $params->get( 'confirm', null, GetterInterface::INT ); $approval = ( $approve == 2 ? $ueConfig['reg_admin_approval'] : $approve ); $confirmation = ( $confirm == 2 ? $ueConfig['reg_confirmation'] : $confirm ); $usergroup = $params->get( 'usergroup', null, GetterInterface::STRING ); $password = $trigger->getSubstituteString( $params->get( 'password', null, GetterInterface::STRING ) ); $name = array(); if ( ! $usergroup ) { $gids = array( $_CB_framework->getCfg( 'new_usertype' ) ); } else { $gids = explode( '|*|', $usergroup ); } cbArrayToInts( $gids ); $newUser = new UserTable(); $newUser->set( 'gids', $gids ); $newUser->set( 'sendEmail', 0 ); $newUser->set( 'registerDate', $_CB_framework->getUTCDate() ); $newUser->set( 'username', $trigger->getSubstituteString( $params->get( 'username', null, GetterInterface::STRING ) ) ); $newUser->set( 'firstname', $trigger->getSubstituteString( $params->get( 'firstname', null, GetterInterface::STRING ) ) ); $newUser->set( 'middlename', $trigger->getSubstituteString( $params->get( 'middlename', null, GetterInterface::STRING ) ) ); $newUser->set( 'lastname', $trigger->getSubstituteString( $params->get( 'lastname', null, GetterInterface::STRING ) ) ); if ( $newUser->get( 'firstname' ) ) { $name[] = $newUser->get( 'firstname' ); } if ( $newUser->get( 'middlename' ) ) { $name[] = $newUser->get( 'middlename' ); } if ( $newUser->get( 'lastname' ) ) { $name[] = $newUser->get( 'lastname' ); } $newUser->set( 'name', implode( ' ', $name ) ); $newUser->set( 'email', $trigger->getSubstituteString( $params->get( 'email', null, GetterInterface::STRING ) ) ); if ( $password ) { $newUser->set( 'password', $newUser->hashAndSaltPassword( $password ) ); } else { $newUser->setRandomPassword(); $newUser->set( 'password', $newUser->hashAndSaltPassword( $newUser->get( 'password' ) ) ); } $newUser->set( 'registeripaddr', cbGetIPlist() ); if ( $approval == 0 ) { $newUser->set( 'approved', 1 ); } else { $newUser->set( 'approved', 0 ); } if ( $confirmation == 0 ) { $newUser->set( 'confirmed', 1 ); } else { $newUser->set( 'confirmed', 0 ); } if ( ( $newUser->get( 'confirmed' ) == 1 ) && ( $newUser->get( 'approved' ) == 1 ) ) { $newUser->set( 'block', 0 ); } else { $newUser->set( 'block', 1 ); } foreach ( $params->subTree( 'fields' ) as $row ) { /** @var ParamsInterface $row */ $field = $row->get( 'field', null, GetterInterface::STRING ); if ( $field ) { $newUser->set( $field, $trigger->getSubstituteString( $row->get( 'value', null, GetterInterface::RAW ), false, $row->get( 'translate', false, GetterInterface::BOOLEAN ) ) ); } } $_PLUGINS->trigger( 'onBeforeUserRegistration', array( &$newUser, &$newUser ) ); if ( ! $newUser->store() ) { if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) { var_dump( CBTxt::T( 'AUTO_ACTION_REGISTRATION_FAILED', ':: Action [action] :: Registration failed to save. Error: [error]', array( '[action]' => (int) $trigger->get( 'id' ), '[error]' => $newUser->getError() ) ) ); } return; } if ( ( $newUser->get( 'confirmed' ) == 0 ) && ( $confirmation != 0 ) ) { if ( ! $newUser->store() ) { if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) { var_dump( CBTxt::T( 'AUTO_ACTION_REGISTRATION_FAILED', ':: Action [action] :: Registration failed to save. Error: [error]', array( '[action]' => (int) $trigger->get( 'id' ), '[error]' => $newUser->getError() ) ) ); } return; } } if ( $params->get( 'supress', 1, GetterInterface::BOOLEAN ) ) { $emails = false; } else { $emails = true; } activateUser( $newUser, 1, 'UserRegistration', $emails, $emails ); $_PLUGINS->trigger( 'onAfterUserRegistration', array( &$newUser, &$newUser, true ) ); }
function pbEdit( $id, $userId, $curruser, $iAmModerator, $tab ) { global $_CB_database, $ueConfig; $postertitle = $this->_getReqParam( 'postertitle', null ); $postercomment = $this->_getReqParam( 'postercomments', null ); $postername = $this->_getReqParam( 'postername', null ); $posterlocation = $this->_getReqParam( 'posterlocation', null ); $posteremail = $this->_getReqParam( 'posteremail', null ); $posterurl = $this->_getReqParam( 'posterurl', null ); $posterid = Application::MyUser()->getUserId(); $posterip = cbGetIPlist(); $postervote = $this->_getReqParam( 'postervote', 'NULL' ); $editedbyname = ( $posterid ? getNameFormat( $curruser->name, $curruser->username, $ueConfig['name_format'] ) : stripslashes( $postername ) ); $query = 'UPDATE #__comprofiler_plug_profilebook' . ' SET editdate = NOW()' . ( $posterid ? ', editedbyid = ' . $posterid : '' ) . ', editedbyname = ' . $_CB_database->Quote( $editedbyname ) . ', postername = ' . $_CB_database->Quote( stripslashes( $postername ) ) . ( $posteremail ? ', posteremail = ' . $_CB_database->Quote( stripslashes( $posteremail ) ) : '' ) . ', posterlocation = ' . $_CB_database->Quote( stripslashes( $posterlocation ) ) . ', postertitle = ' . $_CB_database->Quote( stripslashes( $postertitle ) ) . ', postercomment = ' . $_CB_database->Quote( stripslashes( $postercomment ) ) . ', postervote = ' . (int) $postervote . ', posterip = ' . $_CB_database->Quote( $posterip ) // . ( $published !== null ? ', published = ' . (int) $published : '' ) . ', posterurl = ' . $_CB_database->Quote( stripslashes( $posterurl ) ) . ' WHERE id = ' . (int) $id . ' AND userid = ' . (int) $userId . ( $iAmModerator ? '' : ' AND posterid = ' . (int) $posterid ) ; $_CB_database->setQuery( $query ); $_CB_database->query(); $notify = $this->getUserParam( $userId, 'notifyme' ); $res = true; if ( $notify && ( $userId != $posterid ) ) { $autoPublish = $this->getUserParam( $userId, 'autopublish' ); $cbNotification = new cbNotification( ); $res = $cbNotification->sendFromSystem( (int) $userId, sprintf( CBTxt::T( "An entry in your %s has just been updated" ), CBTxt::T( $tab->title ) ), sprintf( CBTxt::T( "%s has just submitted an edited entry for %s in your %s." ), $editedbyname, $postername, CBTxt::T( $tab->title ) ) . ( $iAmModerator ? '' : sprintf( $autoPublish ? CBTxt::T( "\n\nYour current setting is that new entries in your %1\$s are automatically published. To see the new entry, please login. You can then see the new entry and take appropriate action if needed. Direct access to your %1\$s:\n%2\$s\n" ) : CBTxt::T( "\n\nYour current setting is that you need to review entries in your %1\$s. Please login, review the new entry and publish if you agree. Direct access to your %1\$s:\n%2\$s\n" ), CBTxt::T( $tab->title ), cbUnHtmlspecialchars( $this->_getAbsURLwithParam( array() ) ) ) ) ); } return $res; }