/** * save invite * * @param int $id * @param UserTable $user */ private function saveInviteEdit( $id, $user ) { global $_CB_framework, $_CB_database, $_PLUGINS; $row = new InviteTable(); $row->load( (int) $id ); $isModerator = CBGroupJive::isModerator( $user->get( 'id' ) ); $groupId = $this->input( 'group', null, GetterInterface::INT ); if ( $groupId === null ) { $group = $row->group(); } else { $group = CBGroupJive::getGroup( $groupId ); } $returnUrl = $_CB_framework->pluginClassUrl( $this->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) ); if ( ! CBGroupJive::canAccessGroup( $group, $user ) ) { cbRedirect( $returnUrl, CBTxt::T( 'Group does not exist.' ), 'error' ); } elseif ( $row->get( 'id' ) && ( $user->get( 'id' ) != $row->get( 'user_id' ) ) ) { cbRedirect( $returnUrl, CBTxt::T( 'You do not have sufficient permissions to edit this invite.' ), 'error' ); } elseif ( ! $isModerator ) { if ( ( $group->get( 'published' ) == -1 ) || ( ( ! $this->params->get( 'groups_invites_display', 1 ) ) && ( $group->get( 'type' ) != 3 ) ) ) { cbRedirect( $returnUrl, CBTxt::T( 'You do not have access to invites in this group.' ), 'error' ); } elseif ( ( ! $row->get( 'id' ) ) && ( ! CBGroupJive::canCreateGroupContent( $user, $group, 'invites' ) ) ) { cbRedirect( $returnUrl, CBTxt::T( 'You do not have sufficient permissions to create an invite in this group.' ), 'error' ); } } $skipCaptcha = false; $row->set( 'message', $this->input( 'post/message', $row->get( 'message' ), GetterInterface::STRING ) ); if ( ! $row->get( 'id' ) ) { $row->set( 'user_id', (int) $row->get( 'user_id', $user->get( 'id' ) ) ); $row->set( 'group', (int) $group->get( 'id' ) ); $to = $this->input( 'post/to', null, GetterInterface::STRING ); $selected = (int) $this->input( 'post/selected', 0, GetterInterface::INT ); if ( $selected ) { $token = $this->input( 'post/token', null, GetterInterface::STRING ); if ( $token ) { if ( $token == md5( $row->get( 'user_id' ) . $to . $row->get( 'group' ) . $row->get( 'message' ) . $_CB_framework->getCfg( 'secret' ) ) ) { $skipCaptcha = true; $row->set( 'user', (int) $selected ); } } elseif ( $this->params->get( 'groups_invites_list', 0 ) ) { $connections = array(); $cbConnection = new cbConnection( (int) $user->get( 'id' ) ); foreach( $cbConnection->getConnectedToMe( (int) $user->get( 'id' ) ) as $connection ) { $connections[] = (int) $connection->id; } if ( in_array( $selected, $connections ) ) { $row->set( 'user', (int) $selected ); } } } else { $inviteByLimit = explode( '|*|', $this->params->get( 'groups_invites_by', '1|*|2|*|3|*|4' ) ); if ( ! $inviteByLimit ) { $inviteByLimit = array( 1, 2, 3, 4 ); } $recipient = new UserTable(); if ( in_array( 1, $inviteByLimit ) && $recipient->load( (int) $to ) ) { $row->set( 'user', (int) $recipient->get( 'id' ) ); } elseif ( in_array( 4, $inviteByLimit ) && cbIsValidEmail( $to ) ) { if ( $recipient->load( array( 'email' => $to ) ) ) { $row->set( 'user', (int) $recipient->get( 'id' ) ); } else { $row->set( 'email', $to ); } } elseif ( in_array( 2, $inviteByLimit ) && $recipient->load( array( 'username' => $to ) ) ) { $row->set( 'user', (int) $recipient->get( 'id' ) ); } elseif ( in_array( 3, $inviteByLimit ) ) { $query = 'SELECT cb.' . $_CB_database->NameQuote( 'id' ) . "\n FROM " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS cb" . "\n LEFT JOIN " . $_CB_database->NameQuote( '#__users' ) . " AS j" . ' ON j.' . $_CB_database->NameQuote( 'id' ) . ' = cb.' . $_CB_database->NameQuote( 'id' ) . "\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_users' ) . " AS u" . ' ON u.' . $_CB_database->NameQuote( 'user_id' ) . ' = cb.' . $_CB_database->NameQuote( 'id' ) . ' AND u.' . $_CB_database->NameQuote( 'group' ) . ' = ' . (int) $group->get( 'id' ) . "\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_invites' ) . " AS i" . ' ON i.' . $_CB_database->NameQuote( 'group' ) . ' = ' . (int) $group->get( 'id' ) . ' AND i.' . $_CB_database->NameQuote( 'user' ) . ' = cb.' . $_CB_database->NameQuote( 'id' ) . "\n WHERE j." . $_CB_database->NameQuote( 'name' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $to, true ) . '%', false ) . "\n AND cb." . $_CB_database->NameQuote( 'approved' ) . " = 1" . "\n AND cb." . $_CB_database->NameQuote( 'confirmed' ) . " = 1" . "\n AND j." . $_CB_database->NameQuote( 'block' ) . " = 0" . "\n AND u." . $_CB_database->NameQuote( 'id' ) . " IS NULL" . "\n AND i." . $_CB_database->NameQuote( 'id' ) . " IS NULL" . "\n ORDER BY j." . $_CB_database->NameQuote( 'registerDate' ) . " DESC"; $_CB_database->setQuery( $query, 0, 15 ); $users = $_CB_database->loadResultArray(); if ( $users ) { if ( count( $users ) > 1 ) { CBGroupJive::getTemplate( 'invite_list' ); CBuser::advanceNoticeOfUsersNeeded( $users ); HTML_groupjiveInviteList::showInviteList( $to, $users, $row, $group, $user, $this ); return; } else { $row->set( 'user', (int) $users[0] ); } } } } } if ( ( ! $isModerator ) && $this->params->get( 'groups_create_captcha', 0 ) && ( ! $skipCaptcha ) ) { $_PLUGINS->loadPluginGroup( 'user' ); $_PLUGINS->trigger( 'onCheckCaptchaHtmlElements', array() ); if ( $_PLUGINS->is_errors() ) { $row->setError( $_PLUGINS->getErrorMSG() ); } } $new = ( $row->get( 'id' ) ? false : true ); if ( $row->getError() || ( ! $row->check() ) ) { $_CB_framework->enqueueMessage( CBTxt::T( 'GROUP_INVITE_FAILED_TO_SAVE', 'Invite failed to save! Error: [error]', array( '[error]' => $row->getError() ) ), 'error' ); $this->showInviteEdit( $id, $user ); return; } if ( $row->getError() || ( ! $row->store() ) ) { $_CB_framework->enqueueMessage( CBTxt::T( 'GROUP_INVITE_FAILED_TO_SAVE', 'Invite failed to save! Error: [error]', array( '[error]' => $row->getError() ) ), 'error' ); $this->showInviteEdit( $id, $user ); return; } if ( $new ) { cbRedirect( $returnUrl, CBTxt::T( 'Invite created successfully!' ) ); } else { cbRedirect( $returnUrl, CBTxt::T( 'Invite saved successfully!' ) ); } }
/** * Checks E-Mail address with Regex, MX records and SMTP server function (uses SMTP) * * @param string $from From e-mail address * @param string|array $recipient Recipient e-mail address(es) * @return int Result: -2: invalid email format, -1: couldn't check, 0: invalid email, 1: valid email. */ function cbCheckMail($from, $recipient) { if (!cbIsValidEmail($recipient)) { return -2; } $mailparts = explode('@', $recipient, 2); if (count($mailparts) != 2) { return 0; } $domain = $mailparts[1]; $mxFound = false; if (function_exists('getmxrr')) { $mxFound = false; while (strpos($domain, '.') !== false) { // Validate domain: $mxRecords = array(); $mxWeights = array(); if (@getmxrr($domain . '.', $mxRecords, $mxWeights)) { $mxFound = true; break; } else { $subDomains = explode('.', $domain, 2); if (count($subDomains) == 2) { $domain = $subDomains[1]; } else { break; } } } } if (!$mxFound) { $ipAddresses = gethostbynamel($mailparts[1] . '.'); // '.' added so local domain is not added as 2nd trial. if ($ipAddresses === false) { return 0; } $mxRecords = array($mailparts[1]); $mxWeights = array(0); } array_multisort($mxWeights, SORT_ASC, SORT_NUMERIC, $mxRecords); $mail =& comprofilerCreateMail($from, '', '', ''); $mail->SMTPAuth = false; // $mail->SMTPDebug = 2; foreach ($mxRecords as $host) { try { $mail->Host = $host; if (!$mail->SmtpConnect()) { continue; } if (!$mail->smtp->Mail($from)) { $mail->smtp->Reset(); return -1; } if (!$mail->smtp->Recipient($recipient)) { $error = $mail->smtp->getError(); $mail->smtp->Reset(); if (isset($error['smtp_code']) && isset($error['smtp_msg']) && $error['smtp_code'] == 450 && substr($error['smtp_msg'], 0, 5) == '4.7.1') { return -1; // greylisting detected. } return 0; } if ($mail->SMTPKeepAlive == true) { $mail->smtp->Reset(); } else { $mail->SmtpClose(); } return 1; } catch (\Exception $e) { return -1; } } if (function_exists('getmxrr') && !$mxFound) { return 0; } else { return -1; } }
/** * Validator: * Validates $value for $field->required and other rules * Override * * @param FieldTable $field * @param UserTable $user RETURNED populated: touch only variables related to saving this field (also when not validating for showing re-edit) * @param string $columnName Column to validate * @param string $value (RETURNED:) Value to validate, Returned Modified if needed ! * @param array $postdata Typically $_POST (but not necessarily), filtering required. * @param string $reason 'edit' for save profile edit, 'register' for registration, 'search' for searches * @return boolean True if validate, $this->_setErrorMSG if False */ public function validate(&$field, &$user, $columnName, &$value, &$postdata, $reason) { $validate = parent::validate($field, $user, $columnName, $value, $postdata, $reason); if ($validate && $value != null) { if (!cbIsValidEmail($value)) { $this->_setValidationError($field, $user, $reason, sprintf(CBTxt::T('UE_EMAIL_NOVALID', 'This is not a valid email address.'), htmlspecialchars($value))); $validate = false; } } return $validate; }
/** * @param null|int $id * @param UserTable $user */ private function saveInviteEdit( $id, $user ) { global $_CB_framework, $_CB_database, $_PLUGINS; $inviteLimit = (int) $this->params->get( 'invite_limit', null ); $cbModerator = Application::User( (int) $user->get( 'id' ) )->isGlobalModerator(); $row = new cbinvitesInviteTable(); $row->load( (int) $id ); $canAccess = false; $inviteCount = 0; if ( ! $row->get( 'id' ) ) { if ( $cbModerator ) { $canAccess = true; } elseif ( $user->get( 'id' ) && Application::MyUser()->canViewAccessLevel( $this->params->get( 'invite_create_access', 2 ) ) ) { if ( $inviteLimit ) { $query = 'SELECT COUNT(*)' . "\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin_invites' ) . "\n WHERE " . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' ) . "\n AND ( " . $_CB_database->NameQuote( 'user' ) . " IS NULL OR " . $_CB_database->NameQuote( 'user' ) . " = " . $_CB_database->Quote( '' ) . " )"; $_CB_database->setQuery( $query ); $inviteCount = (int) $_CB_database->loadResult(); if ( $inviteCount < $inviteLimit ) { $canAccess = true; } } else { $canAccess = true; } } } elseif ( $cbModerator || ( $row->get( 'user_id' ) == $user->get( 'id' ) ) ) { $canAccess = true; } $profileUrl = $_CB_framework->userProfileUrl( $row->get( 'user_id', $user->get( 'id' ) ), false, 'cbinvitesTab' ); if ( $canAccess && ( ! $row->isAccepted() ) ) { $toArray = explode( ',', $this->input( 'post/to', null, GetterInterface::STRING ) ); if ( ( ! $this->params->get( 'invite_multiple', 1 ) ) && ( ! $cbModerator ) && ( count( $toArray ) > 1 ) ) { $this->showInviteEdit( $row->get( 'id' ), $user, CBTxt::T( 'Comma seperated lists are not supported! Please use a single To address.' ) ); return; } $sent = false; if ( ! empty( $toArray ) ) { foreach ( $toArray as $k => $to ) { if ( $k != 0 ) { $row->set( 'id', null ); $row->set( 'code', null ); } $orgTo = $row->get( 'to' ); $row->set( 'to', $to ); $row->set( 'subject', $this->input( 'post/subject', $row->get( 'subject' ), GetterInterface::STRING ) ); if ( $this->params->get( 'invite_editor', 2 ) >= 2 ) { $row->set( 'body', $this->input( 'post/body', $row->get( 'body' ), GetterInterface::HTML ) ); } else { $row->set( 'body', $this->input( 'post/body', $row->get( 'body' ), GetterInterface::STRING ) ); } $row->set( 'user_id', (int) $this->input( 'post/user_id', $row->get( 'user_id', $user->get( 'id' ) ), GetterInterface::INT ) ); if ( $cbModerator ) { $row->set( 'user', (int) $this->input( 'post/user', $row->get( 'user' ), GetterInterface::INT ) ); } if ( ! $row->get( 'code' ) ) { $row->set( 'code', md5( uniqid() ) ); } $new = ( $row->get( 'id' ) ? false : true ); if ( $new && $inviteLimit ) { $inviteCount++; if ( $inviteCount > $inviteLimit ) { cbRedirect( $profileUrl, CBTxt::T( 'Invite limit reached!' ), 'error' ); } } if ( ! $row->get( 'user' ) ) { $toUser = new UserTable(); $toUser->loadByEmail( $row->get( 'to' ) ); } else { $toUser = CBuser::getUserDataInstance( (int) $row->get( 'user' ) ); } if ( ! $row->get( 'to' ) ) { $row->setError( CBTxt::T( 'To address not specified.' ) ); } elseif ( ! cbIsValidEmail( $row->get( 'to' ) ) ) { $row->setError( CBTxt::T( 'INVITE_TO_ADDRESS_INVALID', 'To address not valid: [to_address]', array( '[to_address]' => $row->get( 'to' ) ) ) ); } elseif ( $toUser->id == $row->get( 'user_id' ) ) { $row->setError( CBTxt::T( 'You can not invite your self.' ) ); } elseif ( $toUser->id && ( $row->get( 'to' ) != $orgTo ) ) { $row->setError( CBTxt::T( 'To address is already a user.' ) ); } elseif ( ( ! $this->params->get( 'invite_duplicate', 0 ) ) && ( ! $cbModerator ) && $row->isDuplicate() ) { $row->setError( CBTxt::T( 'To address is already invited.' ) ); } elseif ( $this->params->get( 'invite_captcha', 0 ) && ( ! $row->get( 'id' ) ) && ( $k == 0 ) && ( ! $cbModerator ) ) { $_PLUGINS->loadPluginGroup( 'user' ); $_PLUGINS->trigger( 'onCheckCaptchaHtmlElements', array() ); if ( $_PLUGINS->is_errors() ) { $row->setError( CBTxt::T( $_PLUGINS->getErrorMSG() ) ); } } $_PLUGINS->trigger( 'invites_onBeforeInvite', array( &$row, $user ) ); if ( $row->getError() || ( ! $row->store() ) ) { $this->showInviteEdit( $row->get( 'id' ), $user, CBTxt::T( 'INVITE_FAILED_SAVE_ERROR', 'Invite failed to save! Error: [error]', array( '[error]' => $row->getError() ) ) ); return; } if ( ( $new || ( ! $row->isSent() ) ) && ( ! $toUser->id ) ) { if ( ! $row->send() ) { $this->showInviteEdit( $row->get( 'id' ), $user, CBTxt::T( 'INVITE_FAILED_SEND_ERROR', 'Invite failed to send! Error: [error]', array( '[error]' => $row->getError() ) ) ); return; } else { $sent = true; } } $_PLUGINS->trigger( 'invites_onAfterInvite', array( $row, $sent, $user ) ); } cbRedirect( $profileUrl, ( $sent ? CBTxt::T( 'Invite sent successfully!' ) : CBTxt::T( 'Invite saved successfully!' ) ) ); } else { $this->showInviteEdit( $row->get( 'id' ), $user, CBTxt::T( 'To address not specified.' ) ); return; } } else { cbRedirect( $profileUrl, CBTxt::T( 'Not authorized.' ), 'error' ); } }
/** * Checks if an email address has been supplied by the provider or if email form needs to render * * @param UserTable $user * @param Hybrid_User_Profile $profile * @return bool */ private function email( &$user, $profile ) { global $_CB_framework; $email = $this->input( 'email', null, GetterInterface::STRING ); $emailVerify = $this->input( 'email__verify', null, GetterInterface::STRING ); if ( $email ) { if ( ! cbIsValidEmail( $email ) ) { $_CB_framework->enqueueMessage( sprintf( CBTxt::T( 'UE_EMAIL_NOVALID', 'This is not a valid email address.' ), htmlspecialchars( $email ) ), 'error' ); $email = null; } else { $field = new FieldTable(); $field->load( array( 'name' => 'email' ) ); $field->set( 'params', new Registry( $field->get( 'params' ) ) ); if ( $field->params->get( 'fieldVerifyInput', 0 ) && ( $email != $emailVerify ) ) { $_CB_framework->enqueueMessage( CBTxt::T( 'Email and verification do not match, please try again.' ), 'error' ); $email = null; } } } if ( ! $email ) { $email = $profile->email; } if ( ! $email ) { $regAntiSpamValues = cbGetRegAntiSpams(); outputCbTemplate(); outputCbJs(); cbValidator::loadValidation(); $cbUser = CBuser::getInstance( null ); $_CB_framework->enqueueMessage( CBTxt::T( 'PROVIDER_SIGN_UP_INCOMPLETE', 'Your [provider] sign up is incomplete. Please complete the following.', array( '[provider]' => $this->_providerName ) ) ); $return = '<form action="' . $_CB_framework->pluginClassUrl( $this->element, false, array( 'provider' => $this->_provider, 'action' => 'authenticate', 'return' => base64_encode( $this->_returnUrl ) ) ) . '" method="post" enctype="multipart/form-data" name="adminForm" id="cbcheckedadminForm" class="cb_form form-auto cbValidation">' . '<div class="cbRegistrationTitle page-header">' . '<h3>' . CBTxt::T( 'Sign up incomplete' ) . '</h3>' . '</div>' . $cbUser->getField( 'email', null, 'htmledit', 'div', 'register', 0, true, array( 'required' => 1, 'edit' => 1, 'registration' => 1 ) ) . '<div class="form-group cb_form_line clearfix">' . '<div class="col-sm-offset-3 col-sm-9">' . '<input type="submit" value="Sign up" class="btn btn-primary cbRegistrationSubmit" data-submit-text="Loading...">' . '</div>' . '</div>' . cbGetSpoofInputTag( 'plugin' ) . cbGetRegAntiSpamInputTag( $regAntiSpamValues ) . '</form>'; echo $return; return false; } $user->set( 'email', $email ); return true; }
/** * Validator: * Validates $value for $field->required and other rules * Override * * @param moscomprofilerFields $field * @param moscomprofilerUser $user RETURNED populated: touch only variables related to saving this field (also when not validating for showing re-edit) * @param string $columnName Column to validate * @param string $value (RETURNED:) Value to validate, Returned Modified if needed ! * @param array $postdata Typically $_POST (but not necessarily), filtering required. * @param string $reason 'edit' for save profile edit, 'register' for registration, 'search' for searches * @return boolean True if validate, $this->_setErrorMSG if False */ function validate(&$field, &$user, $columnName, &$value, &$postdata, $reason) { $validate = parent::validate($field, $user, $columnName, $value, $postdata, $reason); if ($validate && $value != null) { if (!cbIsValidEmail($value)) { $this->_setValidationError($field, $user, $reason, sprintf(_UE_EMAIL_NOVALID, htmlspecialchars($value))); $validate = false; } } return $validate; }
/** * prepares and sends notification (email or PM) * * @param mixed $to * @param int $from * @param mixed $subject * @param mixed $message * @param int $replace * @param object $category * @param object $group * @param boolean $type */ static public function getNotification( $to, $from, $subject, $message, $replace = null, $category = null, $group = null, $type = false ) { global $_CB_framework, $_CB_database, $ueConfig, $_CB_PMS, $_PLUGINS; $plugin = cbgjClass::getPlugin(); $user =& CBuser::getUserDataInstance( $_CB_framework->myId() ); $notifyBy = $plugin->params->get( 'general_notifyby', 1 ); $generalTitle = CBTxt::T( $plugin->params->get( 'general_title', null ) ); $msgSiteName = $_CB_framework->getCfg( 'sitename' ); $msgOverviewName = ( $generalTitle ? $generalTitle : $plugin->name ); if ( isset( $from->id ) || preg_match( '!^\d+$!', $from ) ) { if ( is_object( $from ) ) { $fromId = $from->id; } else { $fromId = $from; } $cbUserFrom =& CBuser::getInstance( $fromId ); if ( ! $cbUserFrom ) { $cbUserFrom =& CBuser::getInstance( null ); } $userFrom =& $cbUserFrom->getUserData(); } if ( isset( $userFrom->id ) ) { $fromName = $cbUserFrom->getField( 'formatname', null, 'html', 'none', 'profile', 0, true ); $fromEmail = $userFrom->email; if ( $replace == 1 ) { $msgUserUrl = cbSef( 'index.php?option=com_comprofiler&task=userprofile&user='******'<a href="' . $msgUserUrl . '">' . $msgUserName . '</a>'; $subject = $cbUserFrom->replaceUserVars( $subject, false ); $message = $cbUserFrom->replaceUserVars( $message, false ); } } else { $fromId = 0; $fromName = $_CB_framework->getCfg( 'fromname' ); $fromEmail = $_CB_framework->getCfg( 'mailfrom' ); } if ( isset( $to->id ) || preg_match( '!^\d+$!', $to ) ) { if ( is_object( $to ) ) { $toId = $to->id; } else { $toId = $to; } $cbUserTo =& CBuser::getInstance( $toId ); if ( ! $cbUserTo ) { $cbUserTo =& CBuser::getInstance( null ); } $userTo =& $cbUserTo->getUserData(); } if ( isset( $userTo->id ) ) { $toEmail = $userTo->email; if ( $replace == 2 ) { $msgUserUrl = cbSef( 'index.php?option=com_comprofiler&task=userprofile&user='******'formatname', null, 'html', 'none', 'profile', 0, true ); $msgUser = '******' . $msgUserUrl . '">' . $msgUserName . '</a>'; $subject = $cbUserTo->replaceUserVars( $subject, false ); $message = $cbUserTo->replaceUserVars( $message, false ); } } else { $toId = 0; if ( cbIsValidEmail( $to ) ) { $toEmail = $to; } else { $toEmail = null; } } if ( $plugin->params->get( 'notifications_from_name' ) ) { $fromName = $plugin->params->get( 'notifications_from_name' ); } if ( $plugin->params->get( 'notifications_from_address' ) ) { $fromEmail = $plugin->params->get( 'notifications_from_address' ); } $msgStrings = array( '[site_name]', '[site]', '[admin_override]', '[admins_override]', '[moderator_override]', '[moderators_override]', '[owner_override]', '[panel_override]', '[overview_override]', '[overview_name]', '[overview]', '[categories_override]', '[category_override]', '[category_id]', '[category_name]', '[category]', '[groups_override]', '[group_override]', '[group_id]', '[group_name]', '[group]', '[users_override]', '[user_override]', '[user_name]', '[user]' ); $msgValues = array( $msgSiteName, '<a href="' . $_CB_framework->getCfg( 'live_site' ) . '">' . $msgSiteName . '</a>', cbgjClass::getOverride( 'admin' ), cbgjClass::getOverride( 'admin', true ), cbgjClass::getOverride( 'moderator' ), cbgjClass::getOverride( 'moderator', true ), cbgjClass::getOverride( 'owner' ), cbgjClass::getOverride( 'panel' ), cbgjClass::getOverride( 'overview' ), $msgOverviewName, '<a href="' . cbgjClass::getPluginURL( array( 'overview' ) ) . '">' . $msgOverviewName . '</a>', cbgjClass::getOverride( 'category', true ), cbgjClass::getOverride( 'category' ), ( isset( $category->id ) ? $category->get( 'id' ) : null ), ( isset( $category->id ) ? $category->getName() : null ), ( isset( $category->id ) ? $category->getName( 0, true ) : null ), cbgjClass::getOverride( 'group', true ), cbgjClass::getOverride( 'group' ), ( isset( $group->id ) ? $group->get( 'id' ) : null ), ( isset( $group->id ) ? $group->getName() : null ), ( isset( $group->id ) ? $group->getName( 0, true ) : null ), cbgjClass::getOverride( 'user', true ), cbgjClass::getOverride( 'user' ), ( isset( $msgUserName ) ? $msgUserName : null ), ( isset( $msgUser ) ? $msgUser : null ) ); $_PLUGINS->trigger( 'gj_onBeforeNotification', array( array( $fromId, $fromName, $fromEmail, $toId, $toEmail, $subject, $message ), $group, $category, $user, $plugin ) ); $subject = trim( strip_tags( str_replace( $msgStrings, $msgValues, $subject ) ) ); $message = cbgjClass::getFilteredText( str_replace( $msgStrings, $msgValues, $message ) ); if ( $toId ) { if ( ( $notifyBy == 4 ) || ( $type == 4 ) ) { comprofilerMail( $fromEmail, $fromName, $toEmail, $subject, $message, 1 ); } elseif ( ( $notifyBy == 3 ) || ( $type == 3 ) ) { $_CB_PMS->sendPMSMSG( $toId, $fromId, $subject, $message, true ); } elseif ( ( $notifyBy == 2 ) || ( $type == 2 ) ) { $_CB_PMS->sendPMSMSG( $toId, $fromId, $subject, $message, true ); comprofilerMail( $fromEmail, $fromName, $toEmail, $subject, $message, 1 ); } elseif ( ( $notifyBy == 1 ) || ( $type == 1 ) ) { if ( ! $_CB_PMS->sendPMSMSG( $toId, $fromId, $subject, $message, true ) ) { comprofilerMail( $fromEmail, $fromName, $toEmail, $subject, $message, 1 ); } } } elseif ( $toEmail ) { comprofilerMail( $fromEmail, $fromName, $toEmail, $subject, $message, 1 ); } else { $moderators = implode( ',', $_CB_framework->acl->get_group_parent_ids( $ueConfig['imageApproverGid'] ) ); if ( $moderators ) { $query = 'SELECT ' . $_CB_database->NameQuote( 'email' ) . "\n FROM " . $_CB_database->NameQuote( '#__users' ) . " AS a" . "\n INNER JOIN " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS b" . ' ON b.' . $_CB_database->NameQuote( 'user_id' ) . ' = a.' . $_CB_database->NameQuote( 'id' ); if ( checkJversion() == 2 ) { $query .= "\n INNER JOIN " . $_CB_database->NameQuote( '#__user_usergroup_map' ) . " AS c" . ' ON b.' . $_CB_database->NameQuote( 'id' ) . ' = c.' . $_CB_database->NameQuote( 'user_id' ) . "\n WHERE c." . $_CB_database->NameQuote( 'group_id' ) . " IN ( " . $moderators . " )"; } else { $query .= "\n WHERE a." . $_CB_database->NameQuote( 'gid' ) . " IN ( " . $moderators . " )"; } $query .= "\n AND a." . $_CB_database->NameQuote( 'block' ) . " = 0" . "\n AND a." . $_CB_database->NameQuote( 'sendEmail' ) . " = 1" . "\n AND b." . $_CB_database->NameQuote( 'confirmed' ) . " = 1" . "\n AND b." . $_CB_database->NameQuote( 'approved' ) . " = 1" . "\n AND b." . $_CB_database->NameQuote( 'banned' ) . " = 0"; $_CB_database->setQuery( $query ); $mods = $_CB_database->loadResultArray(); foreach ( $mods AS $mod ) { comprofilerMail( $fromEmail, $fromName, $mod, $subject, $message, 1 ); } } } $_PLUGINS->trigger( 'gj_onAfterNotification', array( array( $fromId, $fromName, $fromEmail, $toId, $toEmail, $subject, $message ), $group, $category, $user, $plugin ) ); }