本文整理汇总了PHP中cmsPage::getBBCodeToolbar方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsPage::getBBCodeToolbar方法的具体用法?PHP cmsPage::getBBCodeToolbar怎么用?PHP cmsPage::getBBCodeToolbar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsPage
的用法示例。
在下文中一共展示了cmsPage::getBBCodeToolbar方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: blogs
//.........这里部分代码省略.........
cmsCore::c('page')->addPathway($blog['title'], cmsCore::m('blogs')->getBlogURL($blog['seolink']));
//для нового поста
if ($inCore->do == 'newpost'){
if (IS_BILLING){ cmsBilling::checkBalance('blogs', 'add_post'); }
cmsCore::c('page')->addPathway($_LANG['NEW_POST']);
cmsCore::c('page')->setTitle($_LANG['NEW_POST']);
$post = cmsUser::sessionGet('mod');
if ($post){
cmsUser::sessionDel('mod');
} else {
$post['cat_id'] = $cat_id;
$post['comments'] = 1;
}
}
//для редактирования поста
if ($inCore->do=='editpost'){
cmsCore::c('page')->addPathway($post['title'], cmsCore::m('blogs')->getPostURL($blog['seolink'], $post['seolink']));
cmsCore::c('page')->addPathway($_LANG['EDIT_POST']);
cmsCore::c('page')->setTitle($_LANG['EDIT_POST']);
}
cmsCore::c('page')->initAutocomplete();
$autocomplete_js = cmsCore::c('page')->getAutocompleteJS('tagsearch', 'tags');
//получаем рубрики блога
$cat_list = cmsCore::getListItems('cms_blog_cats', $post['cat_id'], 'id', 'ASC', "blog_id = '{$blog['id']}'");
//получаем код панелей bbcode и смайлов
$bb_toolbar = cmsPage::getBBCodeToolbar('message',cmsCore::m('blogs')->config['img_on'], 'blogs', 'blog_post', $post_id);
$smilies = cmsPage::getSmilesPanel('message');
$inCore->initAutoGrowText('#message');
//показываем форму
cmsPage::initTemplate('components', 'com_blog_edit_post')->
assign('blog', $blog)->
assign('pagetitle', ($inCore->do=='editpost' ? $_LANG['EDIT_POST'] : $_LANG['NEW_POST']))->
assign('mod', $post)->
assign('cat_list', $cat_list)->
assign('bb_toolbar', $bb_toolbar)->
assign('smilies', $smilies)->
assign('is_admin', cmsCore::c('user')->is_admin)->
assign('cfg', cmsCore::m('blogs')->config)->
assign('myblog', $myblog)->
assign('user_can_iscomments', cmsUser::isUserCan('comments/iscomments'))->
assign('autocomplete_js', $autocomplete_js)->
display();
}
//Если есть запрос на сохранение
if (cmsCore::inRequest('goadd')) {
$errors = false;
//Получаем параметры
$mod['title'] = cmsCore::request('title', 'str');
$mod['content'] = cmsCore::request('content', 'html');
$mod['feel'] = cmsCore::request('feel', 'str', '');
$mod['music'] = cmsCore::request('music', 'str', '');
$mod['cat_id'] = cmsCore::request('cat_id', 'int');
$mod['allow_who']= cmsCore::request('allow_who', 'str', $blog['allow_who']);
$mod['tags'] = cmsCore::request('tags', 'str', '');
示例2: users
//.........这里部分代码省略.........
cmsUser::goToLogin();
}
$usr = cmsUser::getShortUserData($id);
if (!$usr) {
cmsCore::error404();
}
$inPage->setTitle($_LANG['MY_MESS']);
$inPage->addPathway($usr['nickname'], cmsUser::getProfileURL($usr['login']));
$inPage->addPathway($_LANG['MY_MESS'], '/users/' . $id . '/messages.html');
include 'components/users/messages.php';
}
//============================================================================//
//=========================== Отправка сообщения ============================//
//============================================================================//
if ($do == 'sendmessage') {
if (!$model->config['sw_msg']) {
cmsCore::halt();
}
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
cmsCore::halt();
}
if (!$inUser->id || $inUser->id == $id && !cmsCore::inRequest('massmail') && !cmsCore::request('send_to_group', 'int', 0)) {
cmsCore::halt();
}
if (!cmsCore::inRequest('gosend')) {
$replyid = cmsCore::request('replyid', 'int', 0);
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']));
}
//
// далее идут массовые рассылки, доступные только админам
示例3: calendar
//.........这里部分代码省略.........
$content = $inCore->request('content', 'str');
if (!$title || !$type_raw || !$date_start || !$hour_start || !$hour_end || !$min_start || !$min_end) {
cmsCore::addSessionMessage('Ой, что то не было заполнено...', 'error');
$inCore->redirectBack();
exit;
} else {
$start_time = strtotime($date_start . ' ' . $hour_start . ':' . $min_start);
$end_time = strtotime($date_end . ' ' . $hour_end . ':' . $min_end);
if ($data_end == "" or $date_end < $date_start) {
$data_end = $data_start;
}
$type_data = explode("_", $type_raw);
$type = $type_data[0];
$apx = $type_data[1];
$event_id = $model->addEvent($inUser->id, $type, $apx, $start_time, $end_time, $title, $content);
if ($event_id) {
if ($type != "private") {
cmsActions::log('add_event', array('object' => 'событие', 'object_url' => '/calendar/event' . $event_id . '.html', 'object_id' => $event_id, 'target' => $title, 'target_url' => '/calendar/event' . $event_id . '.html', 'target_id' => '0', 'description' => $title));
}
cmsCore::addSessionMessage('Ваше мероприятие добавлено!', 'success');
} else {
cmsCore::addSessionMessage('Ошибка добавления!', 'error');
}
$inCore->redirect('/calendar');
exit;
}
}
if ($event['start_time'] == "") {
$event['start_time'] = time();
}
if ($event['end_time'] == "") {
$event['end_time'] = time();
}
$bb_toolbar = cmsPage::getBBCodeToolbar('message', $cfg['img_on'], 'forum');
$smilies = cmsPage::getSmilesPanel('message');
$inPage->setTitle("Добавить событие");
$smarty = $inCore->initSmarty('components', 'com_calendar_add.tpl');
$smarty->assign('bb_toolbar', $bb_toolbar);
$smarty->assign('smilies', $smilies);
$smarty->assign('title', $event['title']);
$smarty->assign('content', $event['content']);
$smarty->assign('type', $event['type']);
$smarty->assign('start_date', date("d.m.Y", $event['start_time']));
$smarty->assign('start_hour', date("H", $event['start_time']));
$smarty->assign('start_min', date("i", $event['start_time']));
$smarty->assign('end_date', date("d.m.Y", $event['end_time']));
$smarty->assign('end_hour', date("H", $event['end_time']));
$smarty->assign('end_min', date("i", $event['end_time']));
$smarty->display('com_calendar_add.tpl');
return;
}
if ($do == "view_event") {
$event_id = $inCore->request('event_id', 'int', 0);
/*FOTOLIB*/
include 'fotolib.class.php';
$foto = new FotoLib();
//Проверяем можем ли добавлять фото
$allow_add_foto = $foto->addAcces("calendar");
if ($_FILES) {
$foto->uploadFoto($_FILES, "calendar", $event_id);
}
$images = $foto->loadImages("calendar", $event_id);
/*FOTOLIB*/
$event = $model->getEvent($event_id);
if (!$event) {
cmsCore::addSessionMessage('Ошибка запроса' . mysql_error(), 'error');
示例4: battleways
//.........这里部分代码省略.........
$pagination = cmsPage::getPagebar($total_battleways, $page, $cfg['perpage'], '/battleways/page%page%.html');
}
$user_id = $inUser->id;
//GET ENTRIES
$posts_list = $model->getAllPosts($page, $cfg['perpage'], $select_tag, $t, $color, $user_id);
if ($posts_list) {
foreach ($posts_list as $post) {
$post['datetime'] = $inCore->dateFormat($post['datetime'], 1, 0, 1);
/* if(!empty($post['type']))
{
$sql="select * from `cms_battleways_color` where `id`='".$post['color']."';";
$result = $inDB->query($sql);
if ($inDB->num_rows($result)){
$color = $inDB->fetch_assoc($result);
$post['status'] = "<a href='/battleways/".$post['type']."/".$post['color']."/' style='background: ".$color['color'].";border-radius: 3px;color: ".$color['font_color'].";display: inline-block;height: 19px;margin: 5px 3px 2px 2px;outline: #FFFFFF 0px;padding: 1px 4px;text-decoration: none;text-indent: 0px;vertical-align: middle;white-space: nowrap;'>".$post['type']."</a>";
}
else
{
$post['status'] = "<a href='/battleways/".$post['type']."/' style='background: #E6E6E6;border:1px solid #e1e1e1;padding:5px;border-radius: 8px;border-radius: 3px;color:#333333;text-shadow: #FFFFFF 1px 1px 0px;display: inline-block;height: 19px;margin: 5px 3px 2px 2px;outline: #FFFFFF 0px;padding: 1px 4px;text-decoration: none;text-indent: 0px;vertical-align: middle;white-space: nowrap;cursor:pointer;'>".$post['type']."</a>";
}
} */
$posts[] = $post;
}
}
$smarty = $inCore->initSmarty('components', 'com_battleways_view.tpl');
$smarty->assign('is_posts', (bool) sizeof($posts_list));
if ($select_tag == 0) {
$smarty->assign('pagination', $pagination);
}
$smarty->assign('mark', $model->getMarks());
$smarty->assign('pagetitle', "Ваши минизаписки");
if ($posts) {
$smarty->assign('posts', $posts);
}
$smarty->display('com_battleways_view.tpl');
}
if ($do == 'add_battleway') {
$user_id = $inUser->id;
$title = $inCore->request('title', 'str', '');
$type = $inCore->request('type', 'str', '');
$color = $inCore->request('color', 'int', '');
if (!empty($title)) {
$describe_full = $inCore->request('full', 'html', '');
//парсим bb-код перед записью в базу
$describe_full_html = $inCore->parseSmiles($describe_full, true);
// Экранируем специальные символы
$describe_full_html = $inDB->escape_string($describe_full_html);
$sql = "INSERT INTO `cms_battleways` (\n`id` ,\n`datetime` ,\n`title` ,\n`content` ,\n`user` ,\n`type` ,\n`color` \n)\nVALUES (\nNULL , NOW(), '" . $title . "', '" . $describe_full_html . "', '" . $user_id . "', '" . $type . "', '" . $color . "'\n);";
$result = $inDB->query($sql);
$inCore->redirect('/battleways/');
}
$inPage->addHeadJS('components/battleways/js/battleways.js');
$bb_toolbar = cmsPage::getBBCodeToolbar('message', $cfg['images'], 'battleways');
$smilies = cmsPage::getSmilesPanel('message');
$smarty = $inCore->initSmarty('components', 'com_battleways_add.tpl');
$smarty->assign('mark_insert', $model->getAutoMark());
$smarty->assign('select_color', $model->getColors());
$smarty->assign('title', "Добавление записки");
$smarty->assign('bb_toolbar', $bb_toolbar);
$smarty->assign('smilies', $smilies);
$smarty->display('com_battleways_add.tpl');
}
if ($do == 'edit_battleway') {
$battleway = $model->getBattleway($id);
$smarty = $inCore->initSmarty('components', 'com_battleways_edit.tpl');
$smarty->assign('is_posts_view', (bool) sizeof($battleway));
$smarty->assign('pagetitle', $battleway['title']);
$smarty->assign('content', $battleway['content']);
$user_id = $inUser->id;
$title = $inCore->request('title', 'str', '');
$type = $inCore->request('type', 'str', '');
$color = $inCore->request('color', 'int', '');
if (!empty($title)) {
$describe_full = $inCore->request('full', 'html', '');
//парсим bb-код перед записью в базу
$describe_full_html = $inCore->parseSmiles($describe_full, true);
// Экранируем специальные символы
$describe_full_html = $inDB->escape_string($describe_full_html);
$sql = "INSERT INTO `cms_battleways` (\n\t\t\t\t\t`id` ,\n\t\t\t\t\t`datetime` ,\n\t\t\t\t\t`title` ,\n\t\t\t\t\t`content` ,\n\t\t\t\t\t`user` ,\n\t\t\t\t\t`type` ,\n\t\t\t\t\t`color` \n\t\t\t\t\t)\n\t\t\t\t\tVALUES (\n\t\t\t\t\tNULL , NOW(), '" . $title . "', '" . $describe_full_html . "', '" . $user_id . "', '" . $type . "', '" . $color . "'\n\t\t\t\t\t);";
$result = $inDB->query($sql);
$inCore->redirect('/battleways/');
}
$inPage->addHeadJS('components/battleways/js/battleways.js');
$bb_toolbar = cmsPage::getBBCodeToolbar('message', $cfg['images'], 'battleways');
$smilies = cmsPage::getSmilesPanel('message');
$smarty = $inCore->initSmarty('components', 'com_battleways_edit.tpl');
$smarty->assign('mark_insert', $model->getAutoMark());
$smarty->assign('select_color', $model->getColors());
$smarty->assign('title', "Добавление записки");
$smarty->assign('bb_toolbar', $bb_toolbar);
$smarty->assign('smilies', $smilies);
$smarty->display('com_battleways_edit.tpl');
}
}
/////////////////////////////////////////////////
}
示例5: clubs
//.........这里部分代码省略.........
$text = '<p>'.$_LANG['YOU_REALY_JOIN_TO'].' <strong>"'.$club['title'].'"</strong>?</p>';
if ($club['is_vip'] && $club['join_cost'] && !$inUser->is_admin){
$text .= '<p>'.$_LANG['VIP_CLUB_JOIN_COST'].' — <strong>'.$club['join_cost'].' '.$_LANG['BILLING_POINT10'].'</strong></p>';
}
cmsCore::jsonOutput(array('error' => false, 'text' => $text));
}
}
///////////////////// РАССЫЛКА СООБЩЕНИЯ УЧАСТНИКАМ ////////////////////////////
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));
}
示例6: str_replace
$inPage->addHeadJS('includes/jquery/jquery.form.js');
/* ==================================================================================================== */
/* ==================================================================================================== */
if ($do == 'edit') {
// получаем комментарий
$comment = $model->getComment($comment_id);
if (!$comment) {
cmsCore::halt();
}
$is_author = $comment['user_id'] == $inUser->id;
// редактировать могут авторы (если время редактирования есть)
// модераторы и администраторы
if (!$model->is_can_moderate && !$inUser->is_admin && !($is_author && $comment['is_editable'])) {
cmsCore::halt();
}
// Для авторов показываем сколько осталось для редактирования
if ($is_author && $comment['is_editable'] && !$inUser->is_admin && !$model->is_can_moderate) {
$notice = str_replace('{min}', cmsCore::spellCount($comment['is_editable'], $_LANG['MINUTE1'], $_LANG['MINUTE2'], $_LANG['MINUTE10']), $_LANG['EDIT_INFO']);
}
}
if ($model->is_can_bbcode) {
$bb_toolbar = cmsPage::getBBCodeToolbar('content', true, 'comments', 'comment', $comment_id);
$smilies = cmsPage::getSmilesPanel('content');
}
/* ==================================================================================================== */
/* ==================================================================================================== */
$karma_need = $model->config['min_karma_add'];
$can_by_karma = $model->config['min_karma'] && $inUser->karma >= $karma_need || $inUser->is_admin;
$need_captcha = $model->config['regcap'] ? true : ($inUser->id ? false : true);
cmsPage::initTemplate('components', 'com_comments_add')->assign('user_can_add', $model->is_can_add)->assign('is_can_bbcode', $model->is_can_bbcode)->assign('do', $do)->assign('comment', isset($comment) ? $comment : array())->assign('is_user', $inUser->id)->assign('cfg', $model->config)->assign('target', $target)->assign('target_id', $target_id)->assign('parent_id', $parent_id)->assign('user_subscribed', cmsUser::isSubscribed($inUser->id, $target, $target_id))->assign('can_by_karma', $can_by_karma)->assign('karma_need', $karma_need)->assign('karma_has', $inUser->karma)->assign('need_captcha', $need_captcha)->assign('bb_toolbar', isset($bb_toolbar) ? $bb_toolbar : '')->assign('smilies', isset($smilies) ? $smilies : '')->assign('notice', isset($notice) ? $notice : '')->display('com_comments_add.tpl');
cmsCore::halt();
示例7: cmsTagLine
if ($item) {
$target = $component == 'blog_posts' ? 'blogpost' : $component;
$item['tags'] = cmsTagLine("{$target}", $item_id, false);
}
if (!$item) {
cmsCore::jsonOutput(array('error' => true, 'html' => ' Не получена запись для редактирования!'));
cmsCore::halt();
}
//изображение статьи для формы редактирования статей
if ($component == 'content') {
$item['image'] = file_exists(PATH . '/images/photos/medium/article' . $item['id'] . '.jpg') ? 'article' . $item['id'] . '.jpg' : '';
}
//html-код формы
$html = '';
ob_start();
$smarty = cmsPage::initTemplate('plugins', $template);
$smarty->assign('item', $item);
$smarty->assign('csrf_token', cmsUser::getCsrfToken());
if ($component == 'blog_posts') {
//получаем код панелей bbcode и смайлов
$bb_toolbar = cmsPage::getBBCodeToolbar('message', true, 'blogs', 'blog_post', $item['id']);
$smilies = cmsPage::getSmilesPanel('message');
$smarty->assign('smilies', $smilies);
$smarty->assign('bb_toolbar', $bb_toolbar);
}
$smarty->display($template);
$html = ob_get_clean();
cmsCore::jsonOutput(array('error' => false, 'html' => $html));
?>
示例8: assign
if ($bdo=='editpost'){
$inPage->addPathway($post['title'], $model->getPostURL($club['id'], $post['seolink']));
$inPage->addPathway($_LANG['EDIT_POST']);
$inPage->setTitle($_LANG['EDIT_POST']);
}
$inPage->initAutocomplete();
$autocomplete_js = $inPage->getAutocompleteJS('tagsearch', 'tags');
//получаем рубрики блога
$cat_list = cmsCore::getListItems('cms_blog_cats', $post['cat_id'], 'id', 'ASC', "blog_id = '{$blog['id']}'");
//получаем код панелей bbcode и смайлов
$bb_toolbar = cmsPage::getBBCodeToolbar('message', true, 'clubs', 'blog_post', $post_id);
$smilies = cmsPage::getSmilesPanel('message');
$inCore->initAutoGrowText('#message');
//показываем форму
cmsPage::initTemplate('components', 'com_blog_edit_post')->
assign('blog', $blog)->
assign('pagetitle', ($do=='editpost' ? $_LANG['EDIT_POST'] : $_LANG['NEW_POST']))->
assign('mod', $post)->
assign('cat_list', $cat_list)->
assign('bb_toolbar', $bb_toolbar)->
assign('smilies', $smilies)->
assign('is_admin', $inUser->is_admin)->
assign('myblog', ($is_admin || $is_moder))->
assign('user_can_iscomments', cmsUser::isUserCan('comments/iscomments'))->
示例9: forum
//.........这里部分代码省略.........
if (!$thread['is_mythread']) {
$inDB->setFlag('cms_forum_threads', $thread['id'], 'hits', $thread['hits'] + 1);
}
// получаем посты
$model->whereThreadIs($thread['id']);
$inDB->orderBy('p.pinned', 'DESC, p.pubdate ASC');
$inDB->limitPage($page, $model->config['pp_thread']);
$posts = $model->getPosts();
if (!$posts) {
cmsCore::error404();
}
// SEO
$inPage->setTitle($thread['title']);
// meta description
if (!$thread['description']) {
$first_post = current($posts);
$first_post_content = strip_tags($first_post['content_html']);
if (mb_strlen($first_post_content) >= 100) {
$inPage->setDescription(crop($first_post_content));
} else {
$inPage->setDescription($thread['title']);
}
} else {
$inPage->setDescription(crop($thread['description']));
}
// meta keywords
$all_post_content = '';
foreach ($posts as $p) {
$all_post_content .= ' ' . strip_tags($p['content_html']);
}
$meta_keys = cmsCore::getKeywords($all_post_content);
$inPage->setKeywords($meta_keys ? $meta_keys : $thread['title']);
cmsCore::initAutoGrowText('#message');
cmsPage::initTemplate('components', 'com_forum_view_thread')->assign('forum', $pcat)->assign('forums', $model->getForums())->assign('is_subscribed', cmsUser::isSubscribed($inUser->id, 'forum', $thread['id']))->assign('thread', $thread)->assign('prev_thread', $inDB->get_fields('cms_forum_threads', "id < '{$thread['id']}' AND forum_id = '{$thread['forum_id']}'", 'id, title', 'id DESC'))->assign('next_thread', $inDB->get_fields('cms_forum_threads', "id > '{$thread['id']}' AND forum_id = '{$thread['forum_id']}'", 'id, title', 'id ASC'))->assign('posts', $posts)->assign('thread_poll', $model->getThreadPoll($thread['id']))->assign('page', $page)->assign('num', ($page - 1) * $model->config['pp_thread'] + 1)->assign('lastpage', ceil($thread['post_count'] / $model->config['pp_thread']))->assign('pagebar', cmsPage::getPagebar($thread['post_count'], $page, $model->config['pp_thread'], '/forum/thread' . $thread['id'] . '-%page%.html'))->assign('user_id', $inUser->id)->assign('do', $do)->assign('is_moder', $is_forum_moder)->assign('is_admin', $inUser->is_admin)->assign('is_can_add_post', cmsUser::isUserCan('forum/add_post'))->assign('cfg', $model->config)->assign('bb_toolbar', $inUser->id && $model->config['fast_on'] && $model->config['fast_bb'] ? cmsPage::getBBCodeToolbar('message', $model->config['img_on']) : '')->assign('smilies', $inUser->id && $model->config['fast_on'] && $model->config['fast_bb'] ? cmsPage::getSmilesPanel('message') : '')->display('com_forum_view_thread.tpl');
}
//============================================================================//
//================ Новая тема, написать/редактировать пост ===================//
//============================================================================//
if (in_array($do, array('newthread', 'newpost', 'editpost'))) {
if (!$inUser->id) {
cmsUser::goToLogin();
}
// id первого поста в теме
$first_post_id = false;
// опросов по умолчанию нет
$thread_poll = array();
// применяется при редактировании поста
$is_allow_attach = true;
// ограничение по карме
if (in_array($do, array('newthread', 'newpost'))) {
if ($inUser->karma < $model->config['min_karma_add'] && !$inUser->is_admin) {
cmsCore::addSessionMessage(sprintf($_LANG['ADD_KARMA_LIMIT'], cmsCore::spellCount($model->config['min_karma_add'], $_LANG['KPOINT1'], $_LANG['KPOINT2'], $_LANG['KPOINT10']), $inUser->karma), 'error');
cmsCore::redirectBack();
}
}
// новая тема
if ($do == 'newthread') {
// права доступа
if (!cmsUser::isUserCan('forum/add_thread') && !$inUser->is_admin) {
cmsPage::includeTemplateFile('special/accessdenied.php');
return;
}
$forum = $model->getForum($id);
if (!$forum) {
cmsCore::error404();
}
示例10: ob_start
}
/* ==================================================================================================== */
/* ==================================================================================================== */
if($do == 'add'){
if (!$inUser->id) { cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['ONLY_REG_USER_CAN_WALL'])); }
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(); }
示例11: ob_start
cmsCore::loadLanguage('components/users');
/* ==================================================================================================== */
/* ==================================================================================================== */
if ($do == 'view') {
$inDB->limitPage($page, $cfg['wall_perpage']);
echo cmsUser::getUserWall($target_id, $component, $my_profile, $is_admin);
}
/* ==================================================================================================== */
/* ==================================================================================================== */
if ($do == 'add') {
if (!$inUser->id) {
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['ONLY_REG_USER_CAN_WALL']));
}
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('com_users_addwall.tpl');
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')));
if ($wall_id) {
// регистрируем загруженные фотографии к записи
cmsCore::setIdUploadImage('wall', $wall_id);
cmsCore::jsonOutput(array('error' => false, 'html' => $_LANG['WALL_MESG_ADD']));
示例12: blog
//.........这里部分代码省略.........
// проверяем является ли пользователь автором, если редактируем пост
if ($do == 'editpost' && !$inUser->is_admin && $post['user_id'] != $inUser->id) {
cmsCore::error404();
}
//Если еще не было запроса на сохранение
if (!cmsCore::inRequest('goadd')) {
$inPage->addPathway($blog['title'], $model->getBlogURL());
//для нового поста
if ($do == 'newpost') {
if (IS_BILLING) {
cmsBilling::checkBalance('blogs', 'add_post');
}
$inPage->addPathway($_LANG['NEW_POST']);
$inPage->setTitle($_LANG['NEW_POST']);
$post = cmsUser::sessionGet('mod');
if ($post) {
cmsUser::sessionDel('mod');
} else {
$post['cat_id'] = $cat_id;
$post['comments'] = 1;
}
}
//для редактирования поста
if ($do == 'editpost') {
$inPage->addPathway($post['title'], $model->getPostURL('', $post['seolink']));
$inPage->addPathway($_LANG['EDIT_POST']);
$inPage->setTitle($_LANG['EDIT_POST']);
}
$inPage->initAutocomplete();
$autocomplete_js = $inPage->getAutocompleteJS('tagsearch', 'tags');
//получаем рубрики блога
$cat_list = cmsCore::getListItems('cms_blog_cats', $post['cat_id'], 'id', 'ASC', "blog_id = '{$blog['id']}'");
//получаем код панелей bbcode и смайлов
$bb_toolbar = cmsPage::getBBCodeToolbar('message', $model->config['img_on'], 'blogs', 'post', $post_id);
$smilies = cmsPage::getSmilesPanel('message');
$inCore->initAutoGrowText('#message');
//показываем форму
$smarty = $inCore->initSmarty('components', 'com_blog_edit_post.tpl');
$smarty->assign('blog', $blog);
$smarty->assign('pagetitle', $do == 'editpost' ? $_LANG['EDIT_POST'] : $_LANG['NEW_POST']);
$smarty->assign('mod', $post);
$smarty->assign('cat_list', $cat_list);
$smarty->assign('bb_toolbar', $bb_toolbar);
$smarty->assign('smilies', $smilies);
$smarty->assign('is_admin', $inUser->is_admin);
$smarty->assign('myblog', $myblog);
$smarty->assign('user_can_iscomments', cmsUser::isUserCan('comments/iscomments'));
$smarty->assign('autocomplete_js', $autocomplete_js);
$smarty->display('com_blog_edit_post.tpl');
}
//Если есть запрос на сохранение
if (cmsCore::inRequest('goadd')) {
$error = false;
//Получаем параметры
$mod['title'] = cmsCore::request('title', 'str');
$mod['content'] = cmsCore::request('content', 'html');
$mod['feel'] = cmsCore::request('feel', 'str', '');
$mod['music'] = cmsCore::request('music', 'str', '');
$mod['cat_id'] = cmsCore::request('cat_id', 'int');
$mod['allow_who'] = cmsCore::request('allow_who', 'str', $blog['allow_who']);
$mod['tags'] = cmsCore::request('tags', 'str', '');
$mod['comments'] = cmsCore::request('comments', 'int', 1);
$mod['published'] = $myblog || !$blog['premod'] ? 1 : 0;
$mod['blog_id'] = $blog['id'];
//Проверяем их
if (mb_strlen($mod['title']) < 2) {
示例13: calendar
//.........这里部分代码省略.........
} else {
$start_time = strtotime($date_start . ' ' . $hour_start . ':' . $min_start);
if ($data_end == "" or $data_end < $data_start) {
$data_end = $data_start;
}
$end_time = strtotime($date_end . ' ' . $hour_end . ':' . $min_end);
if (!is_numeric($type)) {
$category_id = "0";
} else {
$category_id = $type;
$type = "public";
}
$update = $model->updateEvent($event_id, $type, $category_id, $start_time, $end_time, $title, $content, $hide);
if ($update) {
cmsCore::addSessionMessage('Ваше мероприятие изменено!', 'success');
$inCore->redirect('/calendar/event' . $event_id . '.html');
exit;
} else {
cmsCore::addSessionMessage('Ошибка добавления!', 'error');
$inCore->redirect('/calendar/edit' . $event_id . '.html');
exit;
}
}
} else {
$event = $model->getEvent($event_id);
if (!$event) {
cmsCore::addSessionMessage('Ошибка запроса тут', 'error');
$inCore->redirect('/calendar');
exit;
}
if ($event['category_id']) {
$event['type'] = $event['category_id'];
}
$bb_toolbar = cmsPage::getBBCodeToolbar('calendar', 1, 'forum');
$smilies = cmsPage::getSmilesPanel('calendar');
//Проверяем присоедиялся ли пользователь ко встрече
$catigories = $model->getAllCategories();
$inPage->setTitle("Редактировать событие");
$smarty = $inPage->initTemplate('components', 'com_calendar_add.tpl');
$smarty->assign('event', $event);
$smarty->assign('edit', 1);
$smarty->assign('cfg', $cfg);
$smarty->assign('catigories', $catigories);
$smarty->assign('title', $event['title']);
$smarty->assign('content', $event['content']);
$smarty->assign('type', $event['type']);
$smarty->assign('start_date', date("d.m.Y", $event['start_time']));
$smarty->assign('start_hour', date("H", $event['start_time']));
$smarty->assign('start_min', date("i", $event['start_time']));
$smarty->assign('end_date', date("d.m.Y", $event['end_time']));
$smarty->assign('end_hour', date("H", $event['end_time']));
$smarty->assign('end_min', date("i", $event['end_time']));
$smarty->assign('bb_toolbar', $bb_toolbar);
$smarty->assign('smilies', $smilies);
$smarty->assign('can_moderate', $can_moderate);
$smarty->display('com_calendar_add.tpl');
return;
}
}
if ($do == "event_signup") {
//Если не залогинились то возвращаем обратно
if ($inUser->id == 0) {
$inCore->redirectBack();
return;
}
$event_id = $inCore->request('event_id', 'int', 0);