本文整理汇总了PHP中cmsCore::parseSmiles方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::parseSmiles方法的具体用法?PHP cmsCore::parseSmiles怎么用?PHP cmsCore::parseSmiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsCore
的用法示例。
在下文中一共展示了cmsCore::parseSmiles方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: users
//.........这里部分代码省略.........
$errors = true;
}
$users['email'] = cmsCore::request('email', 'email');
if (!$users['email']) {
cmsCore::addSessionMessage($_LANG['REALY_ADRESS_EMAIL'], 'error');
$errors = true;
}
if ($usr['email'] != $users['email']) {
$is_set_email = $inDB->get_field('cms_users', "email='{$users['email']}'", 'id');
if ($is_set_email) {
cmsCore::addSessionMessage($_LANG['ADRESS_EMAIL_IS_BUSY'], 'error');
$errors = true;
} else {
// формируем токен
$token = md5($usr['email'] . uniqid() . microtime());
$inDB->insert('cms_users_activate', array('user_id' => $inUser->id, 'pubdate' => date("Y-m-d H:i:s"), 'code' => $token));
$codelink = HOST . '/users/change_email/' . $token . '/' . $users['email'];
// по старому адресу высылаем письмо с подтверждением
$letter = cmsCore::getLanguageTextFile('change_email');
$letter = str_replace(array('{nickname}', '{codelink}'), array($inUser->nickname, $codelink), $letter);
cmsCore::mailText($usr['email'], '', $letter);
cmsCore::addSessionMessage(sprintf($_LANG['YOU_CHANGE_EMAIL'], $usr['email']), 'info');
// email не меняем
$users['email'] = $usr['email'];
}
}
$profiles['showphone'] = cmsCore::request('showphone', 'int', 0);
$profiles['showmail'] = cmsCore::request('showmail', 'int');
$profiles['email_newmsg'] = cmsCore::request('email_newmsg', 'int');
$profiles['showbirth'] = cmsCore::request('showbirth', 'int');
$profiles['description'] = cmsCore::request('description', 'str', '');
$users['birthdate'] = (int) $_REQUEST['birthdate']['year'] . '-' . (int) $_REQUEST['birthdate']['month'] . '-' . (int) $_REQUEST['birthdate']['day'];
$profiles['signature'] = $inDB->escape_string(cmsCore::badTagClear(cmsCore::request('signature', 'html', '')));
$profiles['signature_html'] = $inDB->escape_string(cmsCore::parseSmiles(cmsCore::request('signature', 'html', ''), true));
$profiles['allow_who'] = cmsCore::request('allow_who', 'str');
if (!preg_match('/^([a-zA-Z]+)$/ui', $profiles['allow_who'])) {
$errors = true;
}
$users['icq'] = cmsCore::request('icq', 'str', '');
$profiles['showicq'] = cmsCore::request('showicq', 'int');
$profiles['cm_subscribe'] = cmsCore::request('cm_subscribe', 'str');
if (!preg_match('/^([a-zA-Z]+)$/ui', $profiles['cm_subscribe'])) {
$errors = true;
}
$users['phone'] = cmsCore::request('phone', 'int', 0);
// получаем данные форм
$profiles['formsdata'] = '';
if (isset($model->config['privforms'])) {
if (is_array($model->config['privforms'])) {
foreach ($model->config['privforms'] as $form_id) {
$form_input = cmsForm::getFieldsInputValues($form_id);
$profiles['formsdata'] .= $inDB->escape_string(cmsCore::arrayToYaml($form_input['values']));
// Проверяем значения формы
foreach ($form_input['errors'] as $field_error) {
if ($field_error) {
cmsCore::addSessionMessage($field_error, 'error');
$errors = true;
}
}
}
}
}
if ($errors) {
cmsCore::redirectBack();
}
$inDB->update('cms_user_profiles', cmsCore::callEvent('UPDATE_USER_PROFILES', array_merge(array('id' => $usr['pid'], 'user_id' => $usr['id']), $profiles)), $usr['pid']);
示例2: comments
//.........这里部分代码省略.........
$inDB->orderBy('c.pubdate', 'ASC');
$comments = cmsCore::callEvent('BEFORE_SHOW_COMMENTS', $model->getComments(!($inUser->is_admin || $model->is_can_moderate), true));
$total = count($comments);
ob_start();
cmsPage::initTemplate('components', 'com_comments_list')->assign('comments_count', $total)->assign('comments', $comments)->assign('user_can_moderate', $model->is_can_moderate)->assign('user_can_delete', $model->is_can_delete)->assign('user_can_add', $model->is_can_add)->assign('is_admin', $inUser->is_admin)->assign('is_user', $inUser->id)->assign('cfg', $model->config)->assign('labels', $model->labels)->assign('target', $target)->assign('target_id', $target_id)->display('com_comments_list.tpl');
$html = ob_get_clean();
} else {
$model->whereTargetIs($target, $target_id);
$total = $model->getCommentsCount(!($inUser->is_admin || $model->is_can_moderate));
$inDB->resetConditions();
}
cmsPage::initTemplate('components', 'com_comments_view')->assign('comments_count', $total)->assign('target', $target)->assign('target_id', $target_id)->assign('is_admin', $inUser->is_admin)->assign('labels', $model->labels)->assign('is_user', $inUser->id)->assign('cfg', $model->config)->assign('user_can_add', $model->is_can_add)->assign('html', isset($html) ? $html : '')->assign('add_comment_js', "addComment('" . $target . "', '" . $target_id . "', 0)")->assign('user_subscribed', cmsUser::isSubscribed($inUser->id, $target, $target_id))->display('com_comments_view.tpl');
}
//========================================================================================================================//
//========================================================================================================================//
// Добавление комментария, форма добавления в addform.php
if ($do == 'add') {
// Только аякс
if (!cmsCore::isAjax()) {
cmsCore::error404();
}
// Очищаем буфер
ob_end_clean();
// Добавлять могут только админы и те, кому разрешено в настройках группы
if (!$model->is_can_add && !$inUser->is_admin) {
cmsCore::error404();
}
// Входные данные
$comment['guestname'] = cmsCore::request('guestname', 'str', '');
$comment['user_id'] = $inUser->id;
if ($model->is_can_bbcode) {
$content = cmsCore::request('content', 'html', '');
$comment['content_bbcode'] = $inDB->escape_string($content);
$content = cmsCore::parseSmiles($content, true);
$comment['content'] = $inDB->escape_string($content);
} else {
$comment['content'] = cmsCore::request('content', 'str', '');
$comment['content_bbcode'] = $comment['content'];
$comment['content'] = str_replace(array('\\r', '\\n'), '<br>', $comment['content']);
}
$comment['parent_id'] = cmsCore::request('parent_id', 'int', 0);
$comment['target'] = cmsCore::request('target', 'str', '');
$comment['target_id'] = cmsCore::request('target_id', 'int', 0);
$comment['ip'] = cmsCore::strClear($_SERVER['REMOTE_ADDR']);
// Проверяем правильность/наличие входных парамеров
// цель комментария
if (!$comment['target'] || !$comment['target_id']) {
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['ERR_UNKNOWN_TARGET']));
}
// Имя гостя отсутствует
if (!$comment['guestname'] && !$inUser->id) {
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['ERR_USER_NAME']));
}
// Текст комментраия отсутствует
if (!$comment['content']) {
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['ERR_COMMENT_TEXT']));
}
// проверяем каптчу
$need_captcha = $model->config['regcap'] ? true : ($inUser->id ? false : true);
if ($need_captcha && !cmsPage::checkCaptchaCode()) {
cmsCore::jsonOutput(array('error' => true, 'is_captcha' => true, 'text' => $_LANG['ERR_CAPTCHA']));
}
// получаем массив со ссылкой и заголовком цели комментария
// для этого:
// 1. узнаем ответственный компонент из cms_comment_targets
$target = $inDB->get_fields('cms_comment_targets', "target='{$comment['target']}'", '*');
示例3: clubs
//.........这里部分代码省略.........
}
///////////////////// РАССЫЛКА СООБЩЕНИЯ УЧАСТНИКАМ ////////////////////////////
if ($do == 'send_message'){
if(!$inUser->id) { return false; }
if(!cmsCore::isAjax()) { return false; }
$club = $model->getClub($id);
if(!$club){ cmsCore::halt(); }
// Инициализируем участников клуба
$model->initClubMembers($club['id']);
// Расылать могут только участники и администраторы
$is_admin = $inUser->is_admin || ($inUser->id == $club['admin_id']);
if (!$is_admin){ cmsCore::halt(); }
if (!cmsCore::inRequest('gosend')){
$inPage->setRequestIsAjax();
cmsPage::initTemplate('components', 'com_clubs_messages_member')->
assign('club', $club)->
assign('bbcodetoolbar', cmsPage::getBBCodeToolbar('message'))->
assign('smilestoolbar', cmsPage::getSmilesPanel('message'))->
display();
cmsCore::jsonOutput(array('error' => false,'html' => ob_get_clean()));
} else {
// Здесь не эскейпим, в методе sendMessage эскейпится
$message = cmsCore::parseSmiles(cmsCore::request('content', 'html', ''), true);
$moderators_list = $model->getClubMembersIds('moderator');
$members_list = $model->getClubMembersIds();
$result_list = cmsCore::inRequest('only_mod') ? $moderators_list : $members_list;
if (mb_strlen($message)<3){
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['ERR_SEND_MESS']));
}
if (!$result_list){
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['ERR_SEND_MESS_NO_MEMBERS']));
}
if (!cmsUser::checkCsrfToken()) { return false; }
$message = str_replace('%club%', '<a href="/clubs/'.$club['id'].'">'.$club['title'].'</a>', $_LANG['MESSAGE_FROM ADMIN']).$message;
cmsUser::sendMessages(USER_UPDATER, $result_list, $message);
$info = cmsCore::inRequest('only_mod') ? $_LANG['SEND_MESS_TO_MODERS_OK'] : $_LANG['SEND_MESS_TO_MEMBERS_OK'];
cmsCore::jsonOutput(array('error' => false, 'text' => $info));
}
}
///////////////////////// ПРИГЛАСИТЬ ДРУЗЕЙ В КЛУБ /////////////////////////////
if ($do == 'join_member'){
if (!$inUser->id) { return false; }
if (!cmsCore::isAjax()) { return false; }
示例4: updatePost
/**
* Обновляет пост в блоге
* @param int $post_id
* @param array $item
* @param bool $update_seo_link
* @return bool
*/
public function updatePost($post_id, $item, $update_seo_link = false)
{
$item['id'] = $post_id;
$item = cmsCore::callEvent('UPDATE_POST', $item);
if ($update_seo_link) {
$item['seolink'] = $this->generatePostSeoLink($item);
}
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']);
$this->inDB->update('cms_blog_posts', $item, $post_id);
cmsInsertTags($item['tags'], $this->getTarget('tags'), $post_id);
return isset($item['seolink']) ? $item['seolink'] : true;
}
示例5: forum
//.........这里部分代码省略.........
}
$inPage->addPathway($thread['title'], '/forum/thread' . $thread['id'] . '.html');
$end_min = $model->checkEditTime($last_post['pubdate']);
$is_author_can_edit = (is_bool($end_min) ? $end_min : $end_min > 0) && $last_post['user_id'] == $inUser->id;
// редактировать могут только администраторы, модераторы или авторы, если время есть
if (!$inUser->is_admin && !$is_forum_moder && !$is_author_can_edit) {
cmsCore::error404();
}
if (!$inUser->is_admin && !$is_forum_moder && $model->config['edit_minutes']) {
$msg_minute = str_replace('{min}', cmsCore::spellCount($end_min, $_LANG['MINUTE1'], $_LANG['MINUTE2'], $_LANG['MINUTE10']), $_LANG['EDIT_INFO']);
cmsCore::addSessionMessage($msg_minute, 'info');
}
$first_post_id = $inDB->get_field('cms_forum_posts', "thread_id = '{$thread['id']}' ORDER BY pubdate ASC", 'id');
$thread_poll = $model->getThreadPoll($thread['id']);
$pagetitle = $_LANG['EDIT_POST'];
}
/////////////////////////
/// Показываем форму ///
/////////////////////////
if (!cmsCore::inRequest('gosend')) {
$inPage->setTitle($pagetitle);
$inPage->addPathway($pagetitle);
$inPage->addHeadJsLang(array('FILE_SELECTED', 'FILE_DENIED', 'FILE_DUPLICATE'));
cmsCore::initAutoGrowText('#message');
cmsPage::initTemplate('components', 'com_forum_add')->assign('pagetitle', $pagetitle)->assign('is_first_post', isset($last_post['id']) ? $first_post_id == $last_post['id'] : true)->assign('thread_poll', $thread_poll)->assign('cfg', $model->config)->assign('do', $do)->assign('forum', isset($forum) ? $forum : $pcat)->assign('is_subscribed', cmsUser::isSubscribed($inUser->id, 'forum', @$thread['id']))->assign('thread', $thread)->assign('post_content', htmlspecialchars($last_post['content']))->assign('is_moder', $is_forum_moder)->assign('is_admin', $inUser->is_admin)->assign('is_allow_attach', cmsCore::checkContentAccess($model->config['group_access']) && $is_allow_attach)->assign('bb_toolbar', cmsPage::getBBCodeToolbar('message', $model->config['img_on'], 'forum', 'post', @$last_post['id']))->assign('smilies', cmsPage::getSmilesPanel('message'))->display('com_forum_add.tpl');
} else {
/////////////////////////
// Выполняем действия ///
/////////////////////////
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$message_bb = $inDB->escape_string(cmsCore::request('message', 'html', ''));
$message_html = $inDB->escape_string(cmsCore::parseSmiles(cmsCore::request('message', 'html', ''), true));
if (!$message_html) {
cmsCore::addSessionMessage($_LANG['NEED_TEXT_POST'], 'error');
cmsCore::redirectBack();
}
$message_post = strip_tags($message_html);
$message_post = mb_strlen($message_post) > 200 ? mb_substr($message_post, 0, 200) : $message_post;
$post_pinned = 0;
if (in_array($do, array('newthread', 'newpost'))) {
if ($do == 'newthread') {
$thread['title'] = cmsCore::request('title', 'str', '');
$thread['description'] = cmsCore::request('description', 'str', '');
$post_pinned = 1;
if (!$thread['title']) {
cmsCore::addSessionMessage($_LANG['NEED_TITLE_THREAD_YOUR_POST'], 'error');
cmsUser::sessionPut('thread', $thread);
cmsUser::sessionPut('post_content', stripcslashes($message_bb));
cmsCore::redirectBack();
}
$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")));
示例6: ob_start
if (!cmsCore::inRequest('submit')){
ob_start();
cmsPage::initTemplate('components', 'com_users_addwall')->
assign('target_id', $target_id)->
assign('component', $component)->
assign('bb_toolbar', cmsPage::getBBCodeToolbar('message', true, $component, 'wall'))->
assign('smilies', cmsPage::getSmilesPanel('message'))->
display();
cmsCore::jsonOutput(array('error' => false, 'html' => ob_get_clean()));
}
$message = $inDB->escape_string(cmsCore::parseSmiles(cmsCore::request('message', 'html', ''), true));
if (mb_strlen($message)<2) {
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['ERR_SEND_WALL']));
}
if(!cmsUser::checkCsrfToken()) { cmsCore::halt(); }
// добавляем запись методом модели места назначения
$wall_id = $model->addWall(array(
'user_id'=>$target_id,
'author_id'=>$inUser->id,
'nickname'=>$inUser->nickname,
'content'=>$message,
'usertype'=>$component,
'pubdate'=>date('Y-m-d H:i:s')