本文整理汇总了PHP中SJB_UserManager::getComposeDisplayName方法的典型用法代码示例。如果您正苦于以下问题:PHP SJB_UserManager::getComposeDisplayName方法的具体用法?PHP SJB_UserManager::getComposeDisplayName怎么用?PHP SJB_UserManager::getComposeDisplayName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SJB_UserManager
的用法示例。
在下文中一共展示了SJB_UserManager::getComposeDisplayName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$errors = array();
$info = '';
if (SJB_UserManager::isUserLoggedIn()) {
$user_id = SJB_UserManager::getCurrentUserSID();
$to = SJB_Request::getVar('to');
// POST and check for errors form_to form_subject form_message
if (isset($_POST['form_to'])) {
$to_user_name = SJB_Request::getVar('form_to', null, 'POST');
$to_user_info = null;
// trying to get user info by user id
if (intval($to_user_name)) {
$to_user_info = SJB_UserManager::getUserInfoBySID($to_user_name);
}
/*
* в функции compose private message функцию отправки
* сообщения по имени пользователя оставить рабочей
*/
if (is_null($to_user_info)) {
$to_user_info = SJB_UserManager::getUserInfoByUserName($to_user_name);
}
// trying to get user info by user id
if (intval($to_user_name)) {
$to_user_info = SJB_UserManager::getUserInfoBySID($to_user_name);
}
/*
* в функции compose private message функцию отправки
* сообщения по имени пользователя оставить рабочей
*/
if (is_null($to_user_info)) {
$to_user_info = SJB_UserManager::getUserInfoByUserName($to_user_name);
}
$to_user = isset($to_user_info['sid']) ? $to_user_info['sid'] : 0;
$subject = isset($_POST['form_subject']) ? strip_tags($_POST['form_subject']) : '';
$message = isset($_POST['form_message']) ? SJB_PrivateMessage::cleanText($_POST['form_message']) : '';
$save = isset($_POST['form_save']) ? true : false;
if ($to_user == 0) {
$errors['form_to'] = 'You specified wrong username';
}
if (empty($subject)) {
$errors['form_subject'] = 'Please, enter message subject';
}
if (empty($message)) {
$errors['form_message'] = 'Please, enter message';
}
if (count($errors) == 0) {
$anonym = SJB_Request::getVar('anonym');
SJB_PrivateMessage::sendMessage($user_id, $to_user, $subject, $message, $save, false, false, $anonym);
$info = 'The message was sent successfully';
$to = '';
// save to contacts
if (!$anonym) {
SJB_PrivateMessage::saveContact($user_id, $to_user);
SJB_PrivateMessage::saveContact($to_user, $user_id);
}
} else {
$tp->assign("form_to", htmlentities($to_user_name, ENT_QUOTES, "UTF-8"));
$tp->assign("form_subject", htmlentities($subject, ENT_QUOTES, "UTF-8"));
$tp->assign("form_message", $message);
$tp->assign("form_save", $save);
$tp->assign("errors", $errors);
}
}
$display_to = '';
// get display name for "Message to" field
SJB_UserManager::getComposeDisplayName($to, $display_to);
$tp->assign('info', $info);
$tp->assign('to', $to);
$tp->assign('anonym', SJB_Request::getVar('anonym'));
$tp->assign('display_to', $display_to);
$tp->assign('include', 'new_message.tpl');
$tp->assign('unread', SJB_PrivateMessage::getCountUnreadMessages($user_id));
$tp->display('main.tpl');
} else {
$tp->assign('return_url', base64_encode(SJB_Navigator::getURIThis()));
$tp->assign('ajaxRelocate', true);
$tp->display('../users/login.tpl');
}
}
示例2: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
if (SJB_UserManager::isUserLoggedIn()) {
$user_id = SJB_UserManager::getCurrentUserSID();
$errors = array();
$info = '';
$to = SJB_Request::getVar('to', '', 'GET');
// POST and check for errors form_to form_subject form_message
if (isset($_POST['act'])) {
$to_user_name = SJB_Request::getVar('form_to', '', 'POST');
$to_user_info = null;
if (intval($to_user_name)) {
$to_user_info = SJB_UserManager::getUserInfoBySID($to_user_name);
}
// в функции compose private message функцию отправки
// сообщения по имени пользователя оставить рабочей
if (is_null($to_user_info)) {
$to_user_info = SJB_UserManager::getUserInfoByUserName($to_user_name);
}
$cc = SJB_Request::getVar('cc', false);
if ($cc !== false) {
if (intval($cc)) {
$cc_info = SJB_UserManager::getUserInfoBySID($cc);
}
// в функции compose private message функцию отправки
// сообщения по имени пользователя оставить рабочей
if (is_null($cc_info)) {
$cc_info = SJB_UserManager::getUserInfoByUserName($cc);
}
if (!empty($cc_info)) {
$cc = $cc_info['sid'];
}
}
$to_user = isset($to_user_info['sid']) ? $to_user_info['sid'] : 0;
$subject = isset($_POST['form_subject']) ? strip_tags($_POST['form_subject']) : '';
$message = isset($_POST['form_message']) ? SJB_PrivateMessage::cleanText($_POST['form_message']) : '';
$save = isset($_POST['form_save']) ? $_POST['form_save'] == 1 ? true : false : false;
if ($to_user == 0) {
$errors['form_to'] = 'Please enter correct username';
}
if (empty($subject)) {
$errors['form_subject'] = 'Please, enter message subject';
}
if (empty($message)) {
$errors['form_message'] = 'Please, enter message';
}
if (count($errors) == 0) {
$anonym = SJB_Request::getVar('anonym');
SJB_PrivateMessage::sendMessage($user_id, $to_user, $subject, $message, $save, false, $cc, $anonym);
// save to contacts
if (!$anonym) {
SJB_PrivateMessage::saveContact($user_id, $to_user);
SJB_PrivateMessage::saveContact($to_user, $user_id);
}
echo '<p class="message">' . SJB_I18N::getInstance()->gettext(null, 'The message was sent successfully') . '</p>';
exit;
}
}
$display_to = '';
// get display name for 'Message to' field
SJB_UserManager::getComposeDisplayName($to, $display_to);
$tp->assign('errors', $errors);
$tp->assign('info', $info);
$tp->assign('to', $to);
$tp->assign('display_to', $display_to);
$tp->assign('anonym', SJB_Request::getVar('anonym'));
$tp->assign('cc', SJB_Request::getVar('cc', ''));
$tp->assign('unread', SJB_PrivateMessage::getCountUnreadMessages($user_id));
$tp->display('new_message_ajax.tpl');
} else {
$tp->assign('return_url', base64_encode(SJB_Navigator::getURIThis()));
$tp->assign('ajaxRelocate', true);
$tp->display('../users/login.tpl');
}
}