本文整理汇总了PHP中cmsUser::checkAwards方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsUser::checkAwards方法的具体用法?PHP cmsUser::checkAwards怎么用?PHP cmsUser::checkAwards使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsUser
的用法示例。
在下文中一共展示了cmsUser::checkAwards方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: comments
//.........这里部分代码省略.........
}
// публикация согласно настроек
$comment['published'] = $inUser->is_admin || $model->is_can_moderate || $model->is_add_published ? 1 : 0;
// Проверяем токен перед самым добавлением комментария
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
// 5. добавляем комментарий в базу
$comment_id = $model->addComment($comment);
// 6. Пересчитываем количество комментариев у цели если нужно
if (method_exists($target_model, 'updateCommentsCount')) {
$target_model->updateCommentsCount($comment['target'], $comment['target_id']);
}
if (!$comment['is_hidden'] && $comment['published']) {
//регистрируем событие
$content_short = strip_tags($comment['content']);
cmsActions::log('add_comment', array('object' => $_LANG['COMMENT'], 'object_url' => $comment['target_link'] . '#c' . $comment_id, 'object_id' => $comment_id, 'target' => $comment['target_title'], 'target_url' => $comment['target_link'], 'target_id' => $comment['target_id'], 'description' => mb_strlen($content_short) > 140 ? mb_substr($content_short, 0, 140) : $content_short));
}
////////////////////////////////////////////////////////////////
///////////////// Операции по уведомлениям /////////////////////
$inConf = cmsConfig::getInstance();
$from_nick = $inUser->id ? $inUser->nickname : $comment['guestname'];
$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));
示例2: content
//.........这里部分代码省略.........
}
// Загружаем класс загрузки фото
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();
}
$article = $model->getArticle($id);
if (!$article) {
cmsCore::error404();
}
// Редактор с правами на добавление без модерации или администраторы могут публиковать
if (!($article['modgrp_id'] == $inUser->group_id && cmsUser::isUserCan('content/autoadd')) && !$inUser->is_admin) {
cmsCore::error404();
示例3: addPost
/**
* Добавляет пост в блоге
* @param array $item
* @return array $post_id, $seolink
*/
public function addPost($item)
{
$item = cmsCore::callEvent('ADD_POST', $item);
//парсим bb-код перед записью в базу
// Парсим по отдельности части текста, если есть тег [cut
if (mb_strstr($item['content'], '[cut')) {
$msg_to = $this->getPostShort($item['content']);
$msg_to = cmsCore::parseSmiles($msg_to, true);
$msg_after = $this->getPostShort($item['content'], false, true);
$msg_after = cmsCore::parseSmiles($msg_after, true);
$cut = $this->getPostCut($item['content']);
$item['content_html'] = $msg_to . $cut . $msg_after;
} else {
$item['content_html'] = cmsCore::parseSmiles($item['content'], true);
}
// Экранируем специальные символы
$item['content'] = $this->inDB->escape_string($item['content']);
$item['content_html'] = $this->inDB->escape_string($item['content_html']);
$post_id = $this->inDB->insert('cms_blog_posts', $item);
if (!$post_id) {
return false;
}
cmsInsertTags($item['tags'], $this->getTarget('tags'), $post_id);
$item['id'] = $post_id;
$item['seolink'] = $this->generatePostSeoLink($item);
$this->inDB->query("UPDATE cms_blog_posts SET seolink='{$item['seolink']}' WHERE id = '{$post_id}'");
if ($item['published']) {
cmsUser::checkAwards($item['user_id']);
}
cmsCore::setIdUploadImage('blog_post', $post_id);
return array('id' => $post_id, 'seolink' => $item['seolink']);
}
示例4: addPhoto
/**
* Добавляет фото
* @param array $photo
* @return int
*/
public function addPhoto($photo){
$photo_id = cmsCore::c('db')->insert('cms_photo_files', cmsCore::callEvent('ADD_PHOTO', $photo));
if ($photo['tags']){
cmsInsertTags($photo['tags'], $this->getTarget('tags'), $photo_id);
}
cmsUser::checkAwards($inUser->id);
return $photo_id;
}
示例5: array
$is_users_only = $album['allow_who'] == 'registered' ? 1 : 0;
cmsActions::log('add_user_photo_multi', array(
'object' => $total_foto,
'object_url' => '',
'object_id' => '',
'target' => $album['title'],
'target_id' => $album_id,
'target_url' => '/users/'.$usr['login'].'/photos/private'.$album_id.'.html',
'description' => $photo_descr,
'is_friends_only' => $is_friends_only,
'is_users_only' => $is_users_only
));
}
if (!$is_edit) {
cmsUser::checkAwards($inUser->id);
cmsCore::redirect("/users/{$usr['login']}/photos/private{$album_id}.html");
} else {
cmsCore::redirect("/users/{$usr['id']}/photo{$photo_id}.html");
}
}
}
/////////////////////////////// PHOTO DELETE /////////////////////////////////////////////////////////////////////////////////////////
if ($pdo=='delphoto'){
cmsCore::loadLib('tags');
cmsCore::loadLanguage('components/photos');
$photo_id = cmsCore::request('photoid', 'int', '');
示例6: forum
//.........这里部分代码省略.........
}
$thread['is_hidden'] = cmsCore::yamlToArray($forum['access_list']) ? 1 : 0;
$thread['forum_id'] = $forum['id'];
$thread['user_id'] = $inUser->id;
$thread['pubdate'] = date("Y-m-d H:i:s");
$thread['hits'] = 0;
$thread['id'] = $model->addThread($thread);
$thread['NSLeft'] = $forum['NSLeft'];
$thread['NSRight'] = $forum['NSRight'];
$thread['post_count'] = 0;
if (IS_BILLING && $forum['topic_cost']) {
cmsBilling::process('forum', 'add_thread', $forum['topic_cost']);
}
}
$post_id = $model->addPost(array('thread_id' => $thread['id'], 'user_id' => $inUser->id, 'pinned' => $post_pinned, 'content' => $message_bb, 'content_html' => $message_html, 'pubdate' => date("Y-m-d H:i:s"), 'editdate' => date("Y-m-d H:i:s")));
// Обновляем количество постов в теме
$thread_post_count = $model->updateThreadPostCount($thread['id']);
// Закрываем тему если нужно
$is_fixed = cmsCore::request('fixed', 'int', 0);
if ($is_fixed && ($is_forum_moder || $inUser->is_admin || $thread['is_mythread'])) {
$model->closeThread($thread['id']);
}
// Загружаем аттачи
if ($model->config['fa_on'] && cmsCore::checkContentAccess($model->config['group_access'])) {
$file_error = $model->addUpdatePostAttachments($post_id);
if ($file_error === false) {
cmsCore::addSessionMessage($_LANG['CHECK_SIZE_TYPE_FILE'] . $model->config['fa_max'], 'error');
}
}
// Обновляем кеши
$model->updateForumCache($thread['NSLeft'], $thread['NSRight'], true);
$total_pages = ceil($thread_post_count / $model->config['pp_thread']);
// Проверяем награды
cmsUser::checkAwards($inUser->id);
// Рассылаем уведомления тем, кто подписан
if ($do == 'newpost') {
cmsUser::sendUpdateNotify('forum', $thread['id'], array('link' => '/forum/thread' . $thread['id'] . '-' . $total_pages . '.html#' . $post_id, 'title' => stripslashes($thread['title']), 'letter_file' => 'newforumpost', 'author' => $inUser->nickname));
}
// Подписываемся сами если нужно
if (cmsCore::inRequest('subscribe')) {
cmsUser::subscribe($inUser->id, 'forum', $thread['id']);
}
// Если пост не в скрытый форум и не в объедненный с предыдущим, добавляем в ленту
if (!$thread['is_hidden'] && $thread_post_count > $thread['post_count']) {
if ($do == 'newthread') {
cmsActions::log('add_thread', array('object' => $thread['title'], 'object_url' => '/forum/thread' . $thread['id'] . '-1.html', 'object_id' => $thread['id'], 'target' => $forum['title'], 'target_url' => '/forum/' . $forum['id'], 'target_id' => $forum['id'], 'description' => $message_post));
} else {
cmsActions::log('add_fpost', array('object' => $_LANG['MESSAGE'], 'object_url' => '/forum/thread' . $thread['id'] . '-' . $total_pages . '.html#' . $post_id, 'object_id' => $post_id, 'target' => $thread['title'], 'target_url' => '/forum/thread' . $thread['id'] . '.html', 'target_id' => $thread['id'], 'description' => $message_post));
}
}
// Для новой темы прикрепляем опрос если нужно
if ($do == 'newthread') {
$model->addPoll(cmsCore::request('poll', 'array', array()), $thread['id']);
$last_poll_error = $model->getLastAddPollError();
if ($last_poll_error) {
cmsCore::addSessionMessage($last_poll_error, 'error');
cmsCore::redirect('/forum/editpost' . $post_id . '-1.html');
}
}
cmsCore::redirect('/forum/thread' . $thread['id'] . '-' . $total_pages . '.html#' . $post_id);
} elseif ($do == 'editpost') {
$model->updatePost(array('content' => $message_bb, 'content_html' => $message_html, 'edittimes' => $last_post['edittimes'] + 1, 'editdate' => date("Y-m-d H:i:s")), $last_post['id']);
if ($model->config['fa_on'] && cmsCore::checkContentAccess($model->config['group_access'])) {
$file_error = $model->addUpdatePostAttachments($last_post['id']);
if ($file_error === false) {
cmsCore::addSessionMessage($_LANG['CHECK_SIZE_TYPE_FILE'] . $model->config['fa_max'], 'error');
示例7: createForum
private function createForum($article)
{
$forum_id = (int) $this->config['AF_ADDTREADFORUM_ID'];
if (!$forum_id) {
return false;
}
if (!$this->checkCatForAdd($article['category_id'])) {
return false;
}
// если для статьи есть уже тема, выходим
$forum_thread_id = $this->inDB->get_field('cms_forum_threads', "rel_to='content' AND rel_id='{$article['id']}'", 'id');
if ($forum_thread_id) {
return false;
}
cmsCore::loadModel('forum');
$model_forum = new cms_model_forum();
$post_html = $this->getHtmlPost($article);
$post = $this->getBbtexPost($article);
$threadlastid = $model_forum->addThread(array('forum_id' => $forum_id, 'user_id' => $article['user_id'], 'title' => $this->inDB->escape_string($article['title']), 'description' => '', 'is_hidden' => '0', 'rel_to' => 'content', 'hits' => 0, 'pubdate' => date("Y-m-d H:i:s"), 'rel_id' => $article['id']));
$model_forum->addPost(array('thread_id' => $threadlastid, 'user_id' => $article['user_id'], 'content' => $post, 'content_html' => $post_html, 'pubdate' => date("Y-m-d H:i:s"), 'editdate' => date("Y-m-d H:i:s")));
$forum = $this->inDB->get_fields('cms_forums', "id='{$forum_id}'", '*');
$model_forum->updateThreadPostCount($threadlastid);
cmsUser::checkAwards($article['user_id']);
$model_forum->updateForumCache($forum['NSLeft'], $forum['NSRight'], true);
cmsActions::log('add_thread', array('object' => $article['title'], 'user_id' => $article['user_id'], 'object_url' => '/forum/thread' . $threadlastid . '.html', 'object_id' => $threadlastid, 'target' => $this->inDB->escape_string($forum['title']), 'target_url' => '/forum/' . $forum_id, 'target_id' => $forum_id, 'description' => strip_tags($post_html)));
return true;
}
示例8: addPhoto_new
public function addPhoto_new($photo)
{
if (isset($_SESSION['lang']) && $_SESSION['lang'] != 'ru') {
$photo_id = $this->inDB->insert($_SESSION['lang'] . '_photo_files', cmsCore::callEvent('ADD_PHOTO', $photo));
} else {
$photo_id = $this->inDB->insert('cms_photo_files', cmsCore::callEvent('ADD_PHOTO', $photo));
}
if ($photo['tags']) {
cmsInsertTags($photo['tags'], $this->getTarget('tags'), $photo_id);
}
cmsUser::checkAwards($inUser->id);
return $photo_id;
}