static function emailUser($option, $rowFrom, $rowTo, $allowPublic = 0, $name = '', $email = '', $subject = '', $message = '') { global $_CB_framework, $_PLUGINS, $ueConfig; $beforeResults = $_PLUGINS->trigger('onBeforeEmailUserForm', array(&$rowFrom, &$rowTo, 1, &$allowPublic, &$name, &$email, &$subject, &$message)); if ($_PLUGINS->is_errors()) { echo "<script type=\"text/javascript\">alert(\"" . $_PLUGINS->getErrorMSG() . "\"); window.history.go(-1); </script>\n"; exit; } if ($allowPublic && !$rowFrom->id) { $warning = CBTxt::T('IMPORTANT:<ol><li>Please be aware that emails may not be received by the intended users due to their email settings and spam filter.</li></ol>'); } else { $warning = CBTxt::Th('UE_EMAILFORMWARNING', 'IMPORTANT:<ol><li>Your email address on your profile is: <strong>%s</strong>.</li><li>Make sure that it is accurate and check your spam filter before sending, because the receiver will use it for his reply.</li><li>Please be aware that emails may not be received by the intended users due to their email settings and spam filter.</li></ol>'); } $pageTitle = CBTxt::T('SEND_MESSAGE_TO_NAME', 'Send message to [name]', array('[name]' => getNameFormat($rowTo->name, $rowTo->username, $ueConfig['name_format']))); if ($pageTitle) { $_CB_framework->setPageTitle($pageTitle); $_CB_framework->appendPathWay($pageTitle); } $afterResults = $_PLUGINS->trigger('onAfterEmailUserForm', array(&$rowFrom, &$rowTo, &$warning, 1, &$allowPublic, &$name, &$email, &$subject, &$message)); outputCbTemplate(1); cbValidator::loadValidation(); $pageClass = $_CB_framework->getMenuPageClass(); $return = '<div class="cbEmailUser cb_template cb_template_' . selectTemplate('dir') . ($pageClass ? ' ' . htmlspecialchars($pageClass) : null) . '">'; if ($rowFrom->id == $rowTo->id) { $return .= '<div class="page-header"><h3>' . CBTxt::Th('UE_NOSELFEMAIL', 'You are not allowed to send an email to yourself!') . '</h3></div>'; } else { $salt = cbMakeRandomString(16); $key = 'cbmv1_' . md5($salt . $rowTo->id . $rowTo->password . $rowTo->lastvisitDate . $rowFrom->password . $rowFrom->lastvisitDate) . '_' . $salt; $toUser = CBuser::getInstance((int) $rowTo->id); $return .= (CBTxt::Th('UE_EMAILFORMTITLE', 'Send a message via email to %s') ? '<div class="page-header"><h3>' . sprintf(CBTxt::Th('UE_EMAILFORMTITLE', 'Send a message via email to %s'), $toUser->getField('formatname', null, 'html', 'none', 'list', 0, true)) . '</h3></div>' : null) . '<form action="' . $_CB_framework->viewUrl('senduseremail') . '" method="post" id="adminForm" name="adminForm" class="cb_form form-auto cbValidation">'; if (is_array($beforeResults)) { $return .= implode('', $beforeResults); } if ($allowPublic && !$rowFrom->id) { $return .= '<div class="form-group cb_form_line clearfix">' . '<label for="emailName" class="col-sm-3 control-label">' . CBTxt::T('Name') . '</label>' . '<div class="cb_field col-sm-9">' . '<input type="text" name="emailName" id="emailName" class="form-control required" size="50" maxlength="255" value="' . htmlspecialchars($name) . '" />' . getFieldIcons(1, 1, null) . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label for="emailAddress" class="col-sm-3 control-label">' . CBTxt::T('Email Address') . '</label>' . '<div class="cb_field col-sm-9">' . '<input type="text" name="emailAddress" id="emailAddress" class="form-control required" size="50" maxlength="255" value="' . htmlspecialchars($email) . '" />' . getFieldIcons(1, 1, null) . '</div>' . '</div>'; } $return .= '<div class="form-group cb_form_line clearfix">' . '<label for="emailSubject" class="col-sm-3 control-label">' . CBTxt::T('Subject') . '</label>' . '<div class="cb_field col-sm-9">' . '<input type="text" name="emailSubject" id="emailSubject" class="form-control required" size="50" maxlength="255" value="' . htmlspecialchars($subject) . '" />' . getFieldIcons(1, 1, null) . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label for="checkemail" class="col-sm-3 control-label">' . CBTxt::T('Message') . '</label>' . '<div class="cb_field col-sm-9">' . '<textarea name="emailBody" id="emailBody" class="form-control required" cols="50" rows="15">' . htmlspecialchars($message) . '</textarea>' . getFieldIcons(1, 1, null) . '</div>' . '</div>'; if (is_array($afterResults)) { $return .= '<div class="form-group cb_form_line clearfix">' . '<div class="col-sm-offset-3 col-sm-9">' . implode('', $afterResults) . '</div>' . '</div>'; } $return .= '<div class="form-group cb_form_line clearfix">' . '<div class="col-sm-offset-3 col-sm-9">' . sprintf($warning, $rowFrom->email) . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<div class="col-sm-offset-3 col-sm-9">' . '<input type="submit" class="btn btn-primary cbEmailUserSubmit" value="' . htmlspecialchars(CBTxt::T('UE_SENDEMAIL', 'Send Email')) . '"' . cbValidator::getSubmitBtnHtmlAttributes() . ' />' . ' <input type="button" class="btn btn-default cbEmailUserCancel" value="' . htmlspecialchars(CBTxt::T('UE_CANCEL', 'Cancel')) . '" onclick="window.location=\'' . $_CB_framework->userProfileUrl((int) $rowTo->id) . '\'; return false;" />' . '</div>' . '</div>' . '<input type="hidden" name="fromID" value="' . (int) $rowFrom->id . '" />' . '<input type="hidden" name="toID" value="' . (int) $rowTo->id . '" />' . '<input type="hidden" name="protect" value="' . $key . '" />' . cbGetSpoofInputTag('emailuser') . cbGetAntiSpamInputTag(null, null, $allowPublic) . '</form>' . '</div>'; } echo $return; $_CB_framework->setMenuMeta(); }
static function emailUser($option, $rowFrom, $rowTo, $subject = '', $message = '') { global $ueConfig, $_PLUGINS; if ($rowFrom->id == $rowTo->id) { echo "<div class=\"contentheading\" >" . _UE_NOSELFEMAIL . "</div>"; return; } HTML_comprofiler::outputMosFormVal('#adminForm'); $_PLUGINS->loadPluginGroup('user'); $results = $_PLUGINS->trigger('onBeforeEmailUserForm', array(&$rowFrom, &$rowTo, 1)); //$ui=1 if ($_PLUGINS->is_errors()) { echo "<script type=\"text/javascript\">alert(\"" . $_PLUGINS->getErrorMSG() . "\"); window.history.go(-1); </script>\n"; exit; } ?> <div style="text-align:left;"> <div class="componentheading" ><?php echo sprintf(_UE_EMAILFORMTITLE, "<a href=\"" . cbSef("index.php?option=com_comprofiler&task=userProfile&user="******"\">" . getNameFormat($rowTo->name, $rowTo->username, $ueConfig['name_format']) . "</a>"); ?> </div> <form action="<?php echo cbSef("index.php?option={$option}" . getCBprofileItemid(true)); ?> " method="post" id="adminForm" name="adminForm"> <br /><?php echo _UE_EMAILFORMSUBJECT; ?> <br /> <?php if (is_array($results)) { echo implode("<br />", $results); } ?> <input mosReq="1" mosLabel="<?php echo htmlspecialchars(_UE_EMAILFORMSUBJECT); ?> " type="text" class="inputbox" name="emailSubject" size="50" value="<?php echo htmlspecialchars($subject); ?> " /><?php echo getFieldIcons(1, 1, null); ?> <br /> <br /><?php echo _UE_EMAILFORMMESSAGE; ?> <br /> <textarea mosReq="1" mosLabel='<?php echo htmlspecialchars(_UE_EMAILFORMMESSAGE); ?> ' class="inputbox" name="emailBody" cols="50" rows="15" ><?php echo htmlspecialchars($message); ?> </textarea><?php echo getFieldIcons(1, 1, null); echo '<br />'; $warning = _UE_EMAILFORMWARNING; $results = $_PLUGINS->trigger('onAfterEmailUserForm', array(&$rowFrom, &$rowTo, &$warning, 1)); //$ui=1 if (is_array($results)) { echo implode("<br />", $results); } ?> <div><?php echo sprintf($warning, $rowFrom->email); ?> </div> <input type="hidden" name="fromID" value="<?php echo $rowFrom->id; ?> " /> <input type="hidden" name="toID" value="<?php echo $rowTo->id; ?> " /> <input type="hidden" name="protect" value="<?php $salt = cbMakeRandomString(16); echo 'cbmv1_' . md5($salt . $rowTo->id . $rowTo->password . $rowTo->lastvisitDate . $rowFrom->password . $rowFrom->lastvisitDate) . '_' . $salt; ?> " /> <?php echo cbGetSpoofInputTag('emailUser'); echo "\t\t" . cbGetAntiSpamInputTag(); ?> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="task" value="sendUserEmail" /> <input type="submit" class="button" value="<?php echo _UE_SENDEMAIL; ?> " /> </form> </div> <div style="align:center;"> <?php echo getFieldIcons(1, 1, null, '', '', 2); ?> </div> <?php }