Beispiel #1
0
 public function addComment($item)
 {
     $item = cmsCore::callEvent('ADD_COMMENT', $item);
     $item['target_title'] = $this->inDB->escape_string($item['target_title']);
     $comment_id = $this->inDB->insert('cms_comments', $item);
     cmsCore::setIdUploadImage('comment', $comment_id);
     return $comment_id;
 }
Beispiel #2
0
 /**
  * Добавляет пост в блоге
  * @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']);
 }
Beispiel #3
0
 public function updatePost($post, $post_id)
 {
     cmsCore::callEvent('UPDATE_FORUM_POST', $post_id);
     cmsCore::setIdUploadImage('post', $post_id);
     return $this->inDB->update('cms_forum_posts', $post, $post_id);
 }
Beispiel #4
0
    /**
     * Обновляет статью
     * @return bool
     */
    public function updateArticle($id, $article, $not_upd_seo = false) {
        $article['id'] = $id;
        
        cmsCore::setIdUploadImage('', $article['id'], 'content');
        cmsCore::requestUploadImgTitles($article['id'], 'content');
        cmsCore::updateComImages($article['id'], 'content', '', 'cms_content', 'images');

        if (!$not_upd_seo) {
            if (@$article['url']) {
                $article['url'] = cmsCore::strToURL($article['url'], $this->config['is_url_cyrillic']);
            }

            $article['seolink'] = $this->getSeoLink($article);
        } else {
            unset($article['seolink']);
            unset($article['url']);
        }

        if (!$article['user_id']) {
            $article['user_id'] = cmsCore::c('user')->id;
        }

        $article = cmsCore::callEvent('UPDATE_ARTICLE', $article);

        cmsCore::c('db')->update('cms_content', $article, $id);

        if (!$not_upd_seo) {
            $this->updateContentCommentsLink($id);
        }

        cmsInsertTags($article['tags'], 'content', $id);

        return true;
    }
Beispiel #5
0
	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, $component);

            cmsCore::jsonOutput(array('error' => false, 'html'  => $_LANG['WALL_MESG_ADD']));

	} else {

            cmsCore::jsonOutput(array('error' => true, 'text'  => $_LANG['ERR_SUBMIT_WALL']));

	}

}
/* ==================================================================================================== */
/* ==================================================================================================== */
if($do == 'delete'){

    if (!$inUser->id) { cmsCore::halt(); }
Beispiel #6
0
        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']));
    } else {
        cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['ERR_SUBMIT_WALL']));
    }
}
/* ==================================================================================================== */
/* ==================================================================================================== */
if ($do == 'delete') {
    if (!$inUser->id) {
        cmsCore::halt();
    }
    if (!cmsUser::checkCsrfToken()) {
        cmsCore::halt();
    }
    $record_id = cmsCore::request('record_id', 'int', 0);