本文整理汇总了PHP中cmsUser::sendMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsUser::sendMessage方法的具体用法?PHP cmsUser::sendMessage怎么用?PHP cmsUser::sendMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsUser
的用法示例。
在下文中一共展示了cmsUser::sendMessage方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forms
function forms()
{
cmsCore::loadClass('form');
$do = cmsCore::getInstance()->do;
global $_LANG;
//========================================================================================================================//
//========================================================================================================================//
if ($do == 'view') {
// Получаем форму
$form = cmsForm::getFormData(cmsCore::request('form_id', 'int'));
if (!$form) {
cmsCore::error404();
}
// Получаем данные полей формы
$form_fields = cmsForm::getFormFields($form['id']);
// Если полей нет, 404
if (!$form_fields) {
cmsCore::error404();
}
$errors = array();
$attachment = array();
// Получаем данные формы
// Если не переданы, назад
$form_input = cmsForm::getFieldsInputValues($form['id']);
if (!$form_input) {
$errors[] = $_LANG['FORM_ERROR'];
}
// Проверяем значения формы
foreach ($form_input['errors'] as $field_error) {
if ($field_error) {
$errors[] = $field_error;
}
}
// проверяем каптчу
if (!cmsPage::checkCaptchaCode()) {
$errors[] = $_LANG['ERR_CAPTCHA'];
}
if ($errors) {
if (cmsCore::isAjax()) {
cmsCore::jsonOutput(array('error' => true, 'text' => end($errors)));
} else {
foreach ($errors as $error) {
cmsCore::addSessionMessage($error, 'error');
}
cmsCore::redirectBack();
}
}
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
// Подготовим начало письма
$mail_message = '<h3>' . $_LANG['FORM'] . ': ' . $form['title'] . '</h3>';
// Добавляем заполненные поля в письмо
foreach ($form_fields as $field) {
// Значение поля
$value = $form_input['values'][$field['id']];
if (!$value) {
continue;
}
if (is_string($value)) {
$mail_message .= '<h5>' . $field['title'] . '</h5><p>' . $value . '</p>';
} elseif (is_array($value)) {
// если массив, значит к форме прикреплен файл
if ($form['sendto'] == 'mail') {
$attachment[] = !empty($value['url']) ? PATH . $value['url'] : '';
} elseif (!empty($value['url'])) {
$mail_message .= '<h5>' . $field['title'] . '</h5><p><a href="' . $value['url'] . '">' . $value['name'] . '</a></p>';
}
}
}
// Отправляем форму
if ($form['sendto'] == 'mail') {
$emails = explode(',', $form['email']);
if ($emails) {
foreach ($emails as $email) {
cmsCore::mailText(trim($email), cmsConfig::getConfig('sitename') . ': ' . $form['title'], $mail_message, $attachment);
}
}
// удаляем прикрепленные файлы
foreach ($attachment as $attach) {
@unlink($attach);
}
} else {
cmsUser::sendMessage(-2, $form['user_id'], $mail_message);
}
cmsUser::sessionClearAll();
if (cmsCore::isAjax()) {
cmsCore::jsonOutput(array('error' => false, 'text' => $_LANG['FORM_IS_SEND']));
} else {
cmsCore::addSessionMessage($_LANG['FORM_IS_SEND'], 'info');
cmsCore::redirectBack();
}
}
//========================================================================================================================//
}
示例2: blogs
//.........这里部分代码省略.........
// добавляем пост, получая его id и seolink
$added = cmsCore::c('blog')->addPost($mod);
$mod = array_merge($mod, $added);
if ($mod['published']) {
$mod['seolink'] = cmsCore::m('blogs')->getPostURL($blog['seolink'], $mod['seolink']);
if ($blog['allow_who'] != 'nobody' && $mod['allow_who'] != 'nobody') {
cmsCore::callEvent('ADD_POST_DONE', $mod);
cmsActions::log('add_post', array(
'object' => $mod['title'],
'object_url' => $mod['seolink'],
'object_id' => $mod['id'],
'target' => $blog['title'],
'target_url' => cmsCore::m('blogs')->getBlogURL($blog['seolink']),
'target_id' => $blog['id'],
'description' => '',
'is_friends_only' => (int)($blog['allow_who'] == 'friends' || $mod['allow_who'] == 'friends')
));
}
cmsCore::addSessionMessage($_LANG['POST_CREATED'], 'success');
cmsCore::redirect($mod['seolink']);
}
if (!$mod['published']) {
$message = str_replace('%user%', cmsUser::getProfileLink(cmsCore::c('user')->login, cmsCore::c('user')->nickname), $_LANG['MSG_POST_SUBMIT']);
$message = str_replace('%post%', '<a href="'.cmsCore::m('blogs')->getPostURL($blog['seolink'], $added['seolink']).'">'.$mod['title'].'</a>', $message);
$message = str_replace('%blog%', '<a href="'.cmsCore::m('blogs')->getBlogURL($blog['seolink']).'">'.$blog['title'].'</a>', $message);
cmsUser::sendMessage(USER_UPDATER, $blog['user_id'], $message);
cmsCore::addSessionMessage($_LANG['POST_PREMODER_TEXT'], 'info');
cmsCore::redirect(cmsCore::m('blogs')->getBlogURL($blog['seolink']));
}
}
//...или сохраняем пост после редактирования
if ($inCore->do=='editpost') {
if (cmsCore::m('blogs')->config['update_date']){
$mod['pubdate'] = date( 'Y-m-d H:i:s');
}
$mod['edit_times'] = (int)$post['edit_times']+1;
$new_post_seolink = cmsCore::c('blog')->updatePost($post['id'], $mod, cmsCore::m('blogs')->config['update_seo_link']);
$post['seolink'] = is_string($new_post_seolink) ? $new_post_seolink : $post['seolink'];
cmsActions::updateLog(
'add_post',
array(
'object' => $mod['title'],
'pubdate' => cmsCore::m('blogs')->config['update_date'] ? $mod['pubdate'] : $post['pubdate'],
'object_url' => cmsCore::m('blogs')->getPostURL($blog['seolink'], $post['seolink'])
),
$post['id']
);
if (!$mod['published']) {
$message = str_replace('%user%', cmsUser::getProfileLink(cmsCore::c('user')->login, cmsCore::c('user')->nickname), $_LANG['MSG_POST_UPDATE']);
$message = str_replace('%post%', '<a href="'.cmsCore::m('blogs')->getPostURL($blog['seolink'], $post['seolink']).'">'.$mod['title'].'</a>', $message);
示例3: users
//.........这里部分代码省略.........
if ($replyid) {
$msg = $model->getReplyMessage($replyid, $inUser->id);
if (!$msg) {
cmsCore::halt();
}
}
$inPage->setRequestIsAjax();
cmsPage::initTemplate('components', 'com_users_messages_add')->assign('msg', isset($msg) ? $msg : array())->assign('is_reply_user', $replyid)->assign('id', $id)->assign('bbcodetoolbar', cmsPage::getBBCodeToolbar('message'))->assign('smilestoolbar', cmsPage::getSmilesPanel('message'))->assign('groups', $inUser->is_admin ? cmsUser::getGroups(true) : array())->assign('friends', cmsUser::getFriends($inUser->id))->assign('id_admin', $inUser->is_admin)->display('com_users_messages_add.tpl');
cmsCore::jsonOutput(array('error' => false, 'html' => ob_get_clean()));
}
if (cmsCore::inRequest('gosend')) {
// Кому отправляем
$usr = cmsUser::getShortUserData($id);
if (!$usr) {
cmsCore::halt();
}
$message = cmsCore::parseSmiles(cmsCore::request('message', 'html', ''), true);
if (mb_strlen($message) < 2) {
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['ERR_SEND_MESS']));
}
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$output = cmsCore::callEvent('USER_SEND_MESSEDGE', array('text' => $message, 'to_id' => $id));
$message = $output['text'];
$id = $output['to_id'];
$send_to_group = cmsCore::request('send_to_group', 'int', 0);
$group_id = cmsCore::request('group_id', 'int', 0);
//
// Обычная отправка (1 получатель)
//
if (!cmsCore::inRequest('massmail') && !$send_to_group) {
//отправляем сообщение
$msg_id = cmsUser::sendMessage($inUser->id, $id, $message);
// отправляем уведомление на email если нужно
$model->sendNotificationByEmail($id, $inUser->id, $msg_id);
cmsCore::jsonOutput(array('error' => false, 'text' => $_LANG['SEND_MESS_OK']));
}
//
// далее идут массовые рассылки, доступные только админам
//
if (!$inUser->is_admin) {
cmsCore::halt();
}
// отправить всем: получаем список всех пользователей
if (cmsCore::inRequest('massmail')) {
$userlist = cmsUser::getAllUsers();
// проверяем что есть кому отправлять
if (!$userlist) {
cmsCore::jsonOutput(array('error' => false, 'text' => $_LANG['ERR_SEND_MESS']));
}
$count = array();
// отправляем всем по списку
foreach ($userlist as $usr) {
$count[] = cmsUser::sendMessage(USER_MASSMAIL, $usr['id'], $message);
}
cmsCore::jsonOutput(array('error' => false, 'text' => sprintf($_LANG['SEND_MESS_ALL_OK'], sizeof($count))));
}
// отправить группе: получаем список членов группы
if ($send_to_group) {
$count = cmsUser::sendMessageToGroup(USER_MASSMAIL, $group_id, $message);
$success_msg = sprintf($_LANG['SEND_MESS_GROUP_OK'], $count, cmsUser::getGroupTitle($group_id));
cmsCore::jsonOutput(array('error' => false, 'text' => $success_msg));
}
}
}
示例4: sendGreetsMessage
public function sendGreetsMessage($user_id) {
return cmsUser::sendMessage(USER_MASSMAIL, $user_id, $this->config['greetmsg']);
}
示例5: comments
//.........这里部分代码省略.........
$targetlink = HOST . $comment['target_link'] . '#c' . $comment_id;
//получаем ID и e-mail автора
$author = $inUser->id ? $model->getTargetAuthor($target['target_table'], $comment['target_id']) : '';
//подписываем пользователя на обновления, если нужно
if ($inUser->id && cmsCore::inRequest('subscribe')) {
cmsUser::subscribe($inUser->id, $comment['target'], $comment['target_id']);
}
if ($comment['published']) {
//рассылаем уведомления о новом комменте
cmsUser::sendUpdateNotify($comment['target'], $comment['target_id'], array('link' => $comment['target_link'] . '#c' . $comment_id, 'title' => stripslashes($comment['target_title']), 'letter_file' => 'newcomment', 'author' => $inUser->id ? $inUser->nickname : $comment['guestname']));
//проверяем и выдаем награду если нужно
cmsUser::checkAwards($inUser->id);
}
//отправляем админу уведомление о комментарии на e-mail, если нужно
if ($model->config['email']) {
$mailmsg = str_replace(array('{sitename}', '{date}', '{from}', '{subjtitle}', '{targetlink}', '{content}'), array($inConf->sitename, date('d/m/Y (H:i)'), $from_nick, stripslashes($comment['target_title']), $targetlink, strip_tags($comment['content'])), cmsCore::getLanguageTextFile('newcomment_admin'));
$inCore->mailText($model->config['email'], '', $mailmsg);
}
//отправляем автору уведомление на e-mail
if ($author && $comment['published']) {
if ($model->isAuthorNeedMail($author['id']) && $inUser->id != $author['id']) {
$letter = cmsCore::getLanguageTextFile('newpostcomment');
$letter = str_replace('{sitename}', $inConf->sitename, $letter);
$letter = str_replace('{subj}', $target['subj'], $letter);
$letter = str_replace('{subjtitle}', stripslashes($comment['target_title']), $letter);
$letter = str_replace('{targetlink}', $targetlink, $letter);
$letter = str_replace('{date}', date('d/m/Y H:i:s'), $letter);
$letter = str_replace('{from}', $from_nick, $letter);
$inCore->mailText($author['email'], '', $letter);
}
}
if (!$comment['published']) {
$message = str_replace(array('%user%', '%targetlink%'), array($from_nick, $targetlink), $_LANG['COMM_PREMODER_ADMIN_TEXT']);
cmsUser::sendMessage(USER_UPDATER, 1, $message);
}
cmsCore::jsonOutput(array('error' => false, 'target' => $comment['target'], 'target_id' => $comment['target_id'], 'is_premod' => $comment['published'] ? 0 : $_LANG['COMM_PREMODER_TEXT'], 'comment_id' => $comment_id));
}
//========================================================================================================================//
//========================================================================================================================//
if ($do == 'edit') {
if (!cmsCore::isAjax()) {
cmsCore::error404();
}
$comment = $model->getComment(cmsCore::request('comment_id', 'int', 0));
if (!$comment) {
die;
}
// редактировать могут авторы (если время редактирования есть)
// модераторы и администраторы
if (!$model->is_can_moderate && !$inUser->is_admin && !($inUser->id == $comment['user_id'] && $comment['is_editable'])) {
cmsCore::error404();
}
if ($model->is_can_bbcode) {
$content = cmsCore::request('content', 'html', '');
$com_new['content_bbcode'] = $inDB->escape_string($content);
$com_new['content'] = $inDB->escape_string(cmsCore::parseSmiles($content, true));
} else {
$com_new['content'] = cmsCore::request('content', 'str', '');
$com_new['content_bbcode'] = $com_new['content'];
$com_new['content'] = str_replace(array('\\r', '\\n'), '<br>', $com_new['content']);
}
// Текст комментраия отсутствует
if (!$com_new['content']) {
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['ERR_COMMENT_TEXT']));
}
if (!cmsUser::checkCsrfToken()) {
示例6: htmlspecialchars
if ($file) {
if (!cmsCore::inRequest('upload')) {
$last_id = $inDB->get_field('cms_photo_files', 'published=1 ORDER BY id DESC', 'id');
}
$photo['album_id'] = $album['id'];
$photo['file'] = $file['filename'];
$photo['title'] = $photo['title'] ? $photo['title'] . $last_id : $file['realfile'];
$photo['published'] = $inUser->is_admin || $album['public'] == 2 ? 1 : 0;
$photo['owner'] = 'photos';
$photo['user_id'] = $inUser->id;
$photo['id'] = $inPhoto->addPhoto($photo);
if ($photo['published']) {
cmsCore::callEvent('ADD_PHOTO_DONE', $photo);
$description = '<a href="/photos/photo' . $photo['id'] . '.html" class="act_photo"><img src="/images/photos/small/' . $photo['file'] . '" alt="' . htmlspecialchars(stripslashes($photo['title'])) . '" /></a>';
cmsActions::log('add_photo', array('object' => $photo['title'], 'object_url' => '/photos/photo' . $photo['id'] . '.html', 'object_id' => $photo['id'], 'target' => $album['title'], 'target_id' => $album['id'], 'target_url' => '/photos/' . $album['id'], 'description' => $description));
}
if (!$photo['published']) {
$message = str_replace('%user%', cmsUser::getProfileLink($inUser->login, $inUser->nickname), $_LANG['MSG_PHOTO_SUBMIT']);
$message = str_replace('%photos%', '<a href="/photos/photo' . $photo['id'] . '.html">' . $photo['title'] . '</a>', $message);
$message = str_replace('%album%', '<a href="/photos/' . $album['id'] . '">' . $album['title'] . '</a>', $message);
cmsUser::sendMessage(USER_UPDATER, 1, $message);
cmsCore::addSessionMessage($_LANG['PHOTO_PREMODER_TEXT'], 'info');
}
if (cmsCore::inRequest('upload')) {
cmsCore::redirect('/photos/' . $album['id'] . '/uploaded.html');
}
echo "FILEID:" . $photo['id'];
} else {
header("HTTP/1.1 500 Internal Server Error");
echo $inCore->uploadError();
}
示例7: content
//.........这里部分代码省略.........
if ($do == 'addarticle') {
$article_id = $model->addArticle($article);
}
// загрузка фото
$file = 'article' . (@$article_id ? $article_id : $item['id']) . '.jpg';
if (cmsCore::request('delete_image', 'int', 0)) {
@unlink(PATH . "/images/photos/small/{$file}");
@unlink(PATH . "/images/photos/medium/{$file}");
}
// Загружаем класс загрузки фото
cmsCore::loadClass('upload_photo');
$inUploadPhoto = cmsUploadPhoto::getInstance();
// Выставляем конфигурационные параметры
$inUploadPhoto->upload_dir = PATH . '/images/photos/';
$inUploadPhoto->small_size_w = $model->config['img_small_w'];
$inUploadPhoto->medium_size_w = $model->config['img_big_w'];
$inUploadPhoto->thumbsqr = $model->config['img_sqr'];
$inUploadPhoto->is_watermark = $model->config['watermark'];
$inUploadPhoto->input_name = 'picture';
$inUploadPhoto->filename = $file;
// Процесс загрузки фото
$inUploadPhoto->uploadPhoto();
// операции после добавления/редактирования статьи
// добавление статьи
if ($do == 'addarticle') {
// Получаем добавленную статью
$article = $model->getArticle($article_id);
if (!$article['published']) {
cmsCore::addSessionMessage($_LANG['ARTICLE_PREMODER_TEXT'], 'info');
// отсылаем уведомление администраторам
$link = '<a href="' . $model->getArticleURL(null, $article['seolink']) . '">' . $article['title'] . '</a>';
$message = str_replace('%user%', cmsUser::getProfileLink($inUser->login, $inUser->nickname), $_LANG['MSG_ARTICLE_SUBMIT']);
$message = str_replace('%link%', $link, $message);
cmsUser::sendMessageToGroup(USER_UPDATER, cmsUser::getAdminGroups(), $message);
} else {
//регистрируем событие
cmsActions::log('add_article', array('object' => $article['title'], 'object_url' => $model->getArticleURL(null, $article['seolink']), 'object_id' => $article['id'], 'target' => $article['cat_title'], 'target_url' => $model->getCategoryURL(null, $article['catseolink']), 'target_id' => $article['category_id'], 'description' => ''));
if (IS_BILLING) {
$category_cost = $article['cost'] === '' ? false : (int) $article['cost'];
cmsBilling::process('content', 'add_content', $category_cost);
}
cmsUser::checkAwards($inUser->id);
}
cmsCore::addSessionMessage($_LANG['ARTICLE_SAVE'], 'info');
cmsCore::redirect('/my.html');
}
// Редактирование статьи
if ($do == 'editarticle') {
$model->updateArticle($item['id'], $article, true);
cmsActions::updateLog('add_article', array('object' => $article['title']), $item['id']);
if (!$article['published']) {
$link = '<a href="' . $model->getArticleURL(null, $item['seolink']) . '">' . $article['title'] . '</a>';
$message = str_replace('%user%', cmsUser::getProfileLink($inUser->login, $inUser->nickname), $_LANG['MSG_ARTICLE_EDITED']);
$message = str_replace('%link%', $link, $message);
cmsUser::sendMessageToGroup(USER_UPDATER, cmsUser::getAdminGroups(), $message);
}
$mess = $article['published'] ? $_LANG['ARTICLE_SAVE'] : $_LANG['ARTICLE_SAVE'] . ' ' . $_LANG['ARTICLE_PREMODER_TEXT'];
cmsCore::addSessionMessage($mess, 'info');
cmsCore::redirect($model->getArticleURL(null, $item['seolink']));
}
}
}
///////////////////////// PUBLISH ARTICLE /////////////////////////////////////////////////////////////////////////////
if ($do == 'publisharticle') {
if (!$inUser->id) {
cmsCore::error404();
示例8: board
//.........这里部分代码省略.........
cmsBilling::pay(cmsCore::c('user')->id, $summ, $_LANG['VIP_ITEM']);
cmsCore::m('board')->setVip($add['id'], $vipdays);
}
}
}
cmsUser::sessionClearAll();
if ($published) {
//регистрируем событие
cmsActions::log('add_board', array(
'object' => $obtype .' '. $title,
'object_url' => '/board/read'. $add['id'] .'.html',
'object_id' => $add['id'],
'target' => $cat['title'],
'target_url' => '/board/'. $cat['id'],
'target_id' => $cat['id'],
'description' => ''
));
cmsCore::addSessionMessage($_LANG['ADV_IS_ADDED'], 'success');
cmsCore::callEvent('ADD_BOARD_DONE', $add);
cmsCore::redirect('/board/read'. $add['id'] .'.html');
}
if (!$published) {
$link = '<a href="/board/read'. $add['id'] .'.html">'. $obtype .' '. $title .'</a>';
if (cmsCore::c('user')->id) {
$user = '<a href="'. cmsUser::getProfileURL(cmsCore::c('user')->login) .'">'. cmsCore::c('user')->nickname .'</a>';
} else {
$user = $_LANG['BOARD_GUEST'] .', ip: '. cmsCore::c('user')->ip;
}
$message = str_replace('%user%', $user, $_LANG['MSG_ADV_SUBMIT']);
$message = str_replace('%link%', $link, $message);
cmsUser::sendMessage(USER_UPDATER, 1, $message);
cmsCore::addSessionMessage($_LANG['ADV_IS_ADDED'] .'<br>'. $_LANG['ADV_PREMODER_TEXT'], 'success');
cmsCore::redirect('/board/'.cmsCore::m('board')->category_id);
}
}
}
/////////////////////////////// EDIT BOARD ITEM ////////////////////////////////
if ($do == 'edititem') {
$item = cmsCore::m('board')->getRecord(cmsCore::m('board')->item_id);
$cat = cmsCore::m('board')->getCategory($item['category_id']);
if (!$cat || !$item) { cmsCore::error404(); }
cmsCore::c('page')->setTitle($_LANG['EDIT_ADV']);
cmsCore::c('page')->addPathway($item['category'], '/board/'. $item['cat_id']);
cmsCore::c('page')->addPathway($_LANG['EDIT_ADV']);
if (!$item['moderator']) {
cmsCore::addSessionMessage($_LANG['YOU_HAVENT_ACCESS'], 'error');
cmsCore::redirect('/board/read'. $item['id'] .'.html');
}
$errors = false;
if (!cmsCore::inRequest('submit')) {
cmsPage::initTemplate('components', 'com_board_edit')->
assign('action', "/board/edit{$item['id']}.html")->
assign('form_do', 'edit')->
assign('cfg', cmsCore::m('board')->config)->
assign('cat', $cat)->
assign('item', $item)->
示例9: array
if (!$is_admin && !$is_moder) { cmsCore::halt(); }
$inBlog->publishPost($post_id);
$post['seolink'] = $model->getPostURL($club['id'], $post['seolink']);
if ($club['clubtype'] != 'private' && $post['allow_who'] == 'all') { cmsCore::callEvent('ADD_POST_DONE', $post); }
if ($club['clubtype'] != 'private' && $post['allow_who'] != 'nobody'){
if(!cmsCore::c('db')->get_field('cms_actions_log', "object_id = '". $post['id'] ."' AND object_url = '". $post['seolink'] ."'", 'id')){
cmsActions::log($inBlog->getTarget('actions_post'), array(
'object' => $post['title'],
'user_id' => $post['user_id'],
'object_url' => $post['seolink'],
'object_id' => $post['id'],
'target' => $club['title'],
'target_url' => '/clubs/'.$club['id'],
'target_id' => $club['id'],
'description' => '',
'is_friends_only' => (int)($post['allow_who'] == 'friends')
));
}
}
cmsUser::sendMessage(USER_UPDATER, $post['user_id'], $_LANG['YOUR_POST'].' <b>«<a href="'.$post['seolink'].'">'.$post['title'].'</a>»</b> '.$_LANG['PUBLISHED_IN_BLOG'].' <b>«<a href="'.$model->getBlogURL($club['id']).'">'.$blog['title'].'</a>»</b>');
cmsCore::halt('ok');
}
示例10: clubSaveUsers
/**
* Сохраняет участников клуба
* @return bool
*/
public function clubSaveUsers($club_id, $list)
{
if (!is_array($list)) {
return false;
}
$inUser = cmsUser::getInstance();
global $_LANG;
// Все участники
$members = $this->getClubMembersIds();
$premembers = $this->getClubPreMembersIds();
// Название клуба
$club_title = $this->inDB->get_field('cms_clubs', "id = '{$club_id}'", 'title');
// Добавляем новых
foreach ($list as $user_id) {
if (in_array($user_id, $members)) {
continue;
}
$this->addUserToClub($club_id, $user_id);
//Уведомляем
if ($this->config['notify_in'] && $user_id != $inUser->id) {
cmsUser::sendMessage(USER_UPDATER, $user_id, sprintf($_LANG['USER_ADD_YOU'], '<a href="' . cmsUser::getProfileURL($inUser->login) . '">' . $inUser->nickname . '</a>', '<a href="' . HOST . '/clubs/' . $club_id . '">' . $club_title . '</a>'));
}
}
// удаляем пользователя
foreach ($members as $member_id) {
if (in_array($member_id, $list)) {
continue;
}
$this->removeUserFromClub($club_id, $member_id);
// Уведомляем пользователя
if ($this->config['notify_out'] && $member_id != $inUser->id) {
cmsUser::sendMessage(USER_UPDATER, $member_id, sprintf($_LANG['USER_DELETE_YOU'], '<a href="' . cmsUser::getProfileURL($inUser->login) . '">' . $inUser->nickname . '</a>', '<a href="' . HOST . '/clubs/' . $club_id . '">' . $club_title . '</a>'));
}
}
}
示例11: catalog
//.........这里部分代码省略.........
}
if (!$cfg['premod'] || $inUser->is_admin) {
cmsCore::callEvent('ADD_CATALOG_DONE', $item);
//регистрируем событие
cmsActions::log('add_catalog', array(
'object' => $item['title'],
'object_url' => '/catalog/item'.$item['id'].'.html',
'object_id' => $item['id'],
'target' => $cat['title'],
'target_url' => '/catalog/'.$cat['id'],
'target_id' => $cat['id'],
'description' => ''
));
}
}
if ($opt=='edit'){
$model->updateItem($item['id'], $item);
cmsActions::updateLog('add_catalog', array('object' => $item['title']), $item['id']);
}
if ($inUser->id != 1 && $cfg['premod'] && $cfg['premod_msg']){
$link = '<a href="/catalog/item'.$item['id'].'.html">'.$item['title'].'</a>';
$user = '<a href="'.cmsUser::getProfileURL($inUser->login).'">'.$inUser->nickname.'</a>';
if ($opt=='add') { $message = $_LANG['MSG_ITEM_SUBMIT']; }
if ($opt=='edit') { $message = $_LANG['MSG_ITEM_EDITED']; }
$message = str_replace('%user%', $user, $message);
$message = str_replace('%link%', $link, $message);
cmsUser::sendMessage(USER_UPDATER, 1, $message);
cmsCore::addSessionMessage($_LANG['ITEM_PREMOD_NOTICE'], 'info');
cmsCore::redirect('/catalog/'.$item['category_id']);
}
cmsCore::redirect('/catalog/item'.$item['id'].'.html');
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ($do == 'accept_item'){
$item_id = cmsCore::request('item_id', 'int');
$item = $inDB->get_fields('cms_uc_items', "id='{$item_id}'", 'title, user_id, category_id');
if (!$item || !$inUser->is_admin){ cmsCore::error404(); }
$inDB->query("UPDATE cms_uc_items SET published=1, on_moderate=0 WHERE id='{$item_id}'");
$cat = $inDB->get_fields('cms_uc_cats', 'id='.$item['category_id'], 'id, title');
cmsCore::callEvent('ADD_CATALOG_DONE', $item);
//регистрируем событие
cmsActions::log('add_catalog', array(
'object' => $item['title'],
'user_id' => $item['user_id'],
'object_url' => '/catalog/item'.$item_id.'.html',
示例12: array
}
// Загружаем фото
$file = $model->initUploadClass()->uploadPhoto();
if ($file) {
if (!cmsCore::inRequest('upload')) {
$last_id = $inDB->get_field('cms_photo_files', 'published=1 ORDER BY id DESC', 'id');
}
$photo['album_id'] = $album['id'];
$photo['file'] = $file['filename'];
$photo['title'] = $photo['title'] ? $photo['title'] . $last_id : $file['realfile'];
$photo['published'] = $is_admin || $is_moder ? 1 : (int) (!$club['photo_premod']);
$photo['owner'] = 'club' . $club['id'];
$photo['user_id'] = $inUser->id;
$photo_id = $inPhoto->addPhoto($photo);
if ($photo['published']) {
$description = $club['clubtype'] == 'private' ? '' : '<a href="/clubs/photo' . $photo_id . '.html" class="act_photo"><img border="0" src="/images/photos/small/' . $photo['file'] . '" /></a>';
cmsActions::log('add_photo_club', array('object' => $photo['title'], 'object_url' => '/clubs/photo' . $photo_id . '.html', 'object_id' => $photo_id, 'target' => $club['title'], 'target_id' => $photo['album_id'], 'target_url' => '/clubs/' . $club['id'], 'description' => $description));
}
if (!$photo['published']) {
$message = sprintf($_LANG['MSG_CLUB_PHOTO_SUBMIT'], cmsUser::getProfileLink($inUser->login, $inUser->nickname), '<a href="/clubs/photo' . $photo_id . '.html">' . $photo['title'] . '</a>', '<a href="/clubs/' . $club['id'] . '">' . $club['title'] . '</a>');
cmsUser::sendMessage(USER_UPDATER, $club['admin_id'], $message);
cmsCore::addSessionMessage($_LANG['PHOTO_PREMODER_TEXT'], 'info');
}
if (cmsCore::inRequest('upload')) {
cmsCore::redirect('/clubs/uploaded' . $album['id'] . '.html');
}
echo "FILEID:" . $photo_id;
} else {
header("HTTP/1.1 500 Internal Server Error");
echo $inCore->uploadError();
}
示例13: blog
//.........这里部分代码省略.........
cmsCore::addSessionMessage($_LANG['POST_ERR_TITLE'], 'error');
$errors = true;
}
if (mb_strlen($mod['content']) < 5) {
cmsCore::addSessionMessage($_LANG['POST_ERR_TEXT'], 'error');
$errors = true;
}
// Если есть ошибки, возвращаемся назад
if ($errors) {
cmsUser::sessionPut('mod', $mod);
cmsCore::redirectBack();
}
//Если нет ошибок
//добавляем новый пост...
if ($do == 'newpost') {
if (IS_BILLING) {
cmsBilling::process('blogs', 'add_post');
}
$mod['pubdate'] = date('Y-m-d H:i:s');
$mod['user_id'] = $inUser->id;
// добавляем пост, получая его id и seolink
$added = $inBlog->addPost($mod);
if ($mod['published']) {
if ($blog['allow_who'] != 'nobody' && $mod['allow_who'] != 'nobody') {
cmsActions::log('add_post', array('object' => $mod['title'], 'object_url' => $model->getPostURL('', $added['seolink']), 'object_id' => $added['id'], 'target' => $blog['title'], 'target_url' => $model->getBlogURL(), 'target_id' => $blog['id'], 'description' => '', 'is_friends_only' => (int) ($blog['allow_who'] == 'friends' || $mod['allow_who'] == 'friends')));
}
cmsCore::addSessionMessage($_LANG['POST_CREATED'], 'success');
cmsCore::redirect($model->getPostURL('', $added['seolink']));
}
if (!$mod['published']) {
$message = str_replace('%user%', cmsUser::getProfileLink($inUser->login, $inUser->nickname), $_LANG['MSG_POST_SUBMIT']);
$message = str_replace('%post%', '<a href="' . $model->getPostURL('', $added['seolink']) . '">' . $mod['title'] . '</a>', $message);
$message = str_replace('%blog%', '<a href="' . $model->getBlogURL() . '">' . $blog['title'] . '</a>', $message);
cmsUser::sendMessage(USER_UPDATER, $blog['user_id'], $message);
cmsCore::addSessionMessage($_LANG['POST_PREMODER_TEXT'], 'info');
cmsCore::redirect($model->getBlogURL());
}
}
//...или сохраняем пост после редактирования
if ($do == 'editpost') {
if ($model->config['update_date']) {
$mod['pubdate'] = date('Y-m-d H:i:s');
}
$mod['edit_times'] = (int) $post['edit_times'] + 1;
$new_post_seolink = $inBlog->updatePost($post['id'], $mod, $model->config['update_seo_link']);
$post['seolink'] = is_string($new_post_seolink) ? $new_post_seolink : $post['seolink'];
cmsActions::updateLog('add_post', array('object' => $mod['title'], 'pubdate' => $model->config['update_date'] ? $mod['pubdate'] : $post['pubdate'], 'object_url' => $model->getPostURL('', $post['seolink'])), $post['id']);
if (!$mod['published']) {
$message = str_replace('%user%', cmsUser::getProfileLink($inUser->login, $inUser->nickname), $_LANG['MSG_POST_UPDATE']);
$message = str_replace('%post%', '<a href="' . $model->getPostURL('', $post['seolink']) . '">' . $mod['title'] . '</a>', $message);
$message = str_replace('%blog%', '<a href="' . $model->getBlogURL() . '">' . $blog['title'] . '</a>', $message);
cmsUser::sendMessage(USER_UPDATER, $blog['user_id'], $message);
cmsCore::addSessionMessage($_LANG['POST_PREMODER_TEXT'], 'info');
} else {
cmsCore::addSessionMessage($_LANG['POST_UPDATED'], 'success');
}
cmsCore::redirect($model->getPostURL('', $post['seolink']));
}
}
}
////////// НОВАЯ РУБРИКА / РЕДАКТИРОВАНИЕ РУБРИКИ //////////////////////////////////////////////////////
if ($do == 'newcat' || $do == 'editcat') {
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
cmsCore::halt();
}
if (!$inUser->id) {
示例14: date
$ticket = cmsCore::c('db')->get_fields('cms_ticket', "`id`='". $ticket_id ."' AND `secret_key`='". cmsCore::c('db')->escape_string($secret_key) ."'", '*');
if (empty($ticket)) { cmsCore::error404(); }
if ($do == 'ticket_closed') {
cmsCore::c('db')->setFlag('cms_ticket', $ticket['id'], 'status', 3);
cmsUser::sendMessage(-1, $ticket['user_id'], $_LANG['AD_SUPPORT_CLOSE_TICKET']);
}
if ($do == 'add_msg') {
$msg = cmsCore::request('msg', 'str', '', 'post');
$support = cmsCore::request('support', 'str', 'Support', 'post');
$date = date('Y-m-d H:i:s');
$msg_id = cmsCore::c('db')->insert(
'cms_ticket_msg',
array(
'ticket_id' => $ticket['id'],
'msg' => cmsCore::c('db')->escape_string($msg),
'support' => $support,
'pubdate' => $date
)
);
if ($msg_id) {
cmsCore::c('db')->query("UPDATE `cms_ticket` SET `last_msg_date` = '". $date ."', `msg_count` = `msg_count` + 1 WHERE `id` = '". $ticket['id'] ."'");
cmsUser::sendMessage(-1, $ticket['user_id'], sprintf($_LANG['AD_SUPPORT_NEW_MSG'], $ticket['title'], '/admin/index.php?view=tickets&do=view&id='. $ticket['id']));
}
}