コード例 #1
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 function onSubmit($vals)
 {
     loader_import('news.Comment');
     $c = new NewsComment();
     $vals['ts'] = date('Y-m-d H:i:s');
     unset($vals['submit_button']);
     $c->modify($vals['id'], $vals);
     page_title(intl_get('Comment Updated'));
     echo template_simple('comment_updated.spt', $vals);
 }
コード例 #2
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 function onSubmit($vals)
 {
     loader_import('news.Comment');
     $c = new NewsComment();
     $vals['ts'] = date('Y-m-d H:i:s');
     unset($vals['submit_button']);
     unset($vals['security_test']);
     $c->add($vals);
     $ce = appconf('comments_email');
     if ($ce) {
         loader_import('news.Functions');
         @mail($ce, intl_get('News Comment Notice'), template_simple('comment_email.spt', $vals), 'From: ' . 'news@' . site_domain());
     }
     page_title(intl_get('Comment Added'));
     echo template_simple('comment_added.spt', $vals);
 }
コード例 #3
0
ファイル: SiteController.php プロジェクト: postfx/fermion
 public function actionNews($slug = null)
 {
     if ($slug === null) {
         $model = new News('search');
         $model->unsetAttributes();
         $model->isList = true;
         $model->category_id = Yii::app()->request->getParam('category_id');
         $this->render('news', array('model' => $model));
     } else {
         $model = $this->loadNews($slug);
         $model->saveCounters(array('countViews' => 1));
         //  to memcache mb
         $comment = new NewsComment();
         if (isset($_POST['ajax']) && $_POST['ajax'] === 'newsComment-form') {
             echo CActiveForm::validate($comment);
             Yii::app()->end();
         }
         if (isset($_POST['NewsComment'])) {
             $comment->attributes = $_POST['NewsComment'];
             $comment->news_id = $model->id;
             $comment->user_id = Yii::app()->user->id;
             if ($comment->validate() && $comment->preSave()) {
                 $comment->unsetAttributes();
                 Yii::app()->user->setFlash('comment_success', true);
                 $this->redirect(array('/site/news', 'slug' => $model->slug, '#' => 'comments'));
             }
         }
         $criteria = new CDbCriteria();
         $criteria->compare('news_id', $model->id);
         $criteria->order = '`id` ASC';
         $comments = NewsComment::model()->findAll($criteria);
         $this->render('news_inner', array('model' => $model, 'comment' => $comment, 'comments' => $comments));
     }
 }
コード例 #4
0
 /**
  * @param string $url
  * @param int $id
  * @return Comment[]
  */
 public static function getComments($url)
 {
     $xh = new XMLHandler($url);
     $nl = $xh->getNodes("commentListItem");
     $commentList = array();
     foreach ($nl as $n) {
         $c = new NewsComment();
         $c->setID($n->getElementsByTagName("id")->item(0)->textContent);
         $c->setLocation($n->getElementsByTagName("location")->item(0)->textContent);
         $c->setUser($n->getElementsByTagName("name")->item(0)->textContent);
         $c->setCommentTxt($n->getElementsByTagName("text")->item(0)->textContent);
         $c->setPostDate($n->getElementsByTagName("postDate")->item(0)->textContent);
         $commentList[] = $c;
     }
     return $commentList;
 }
コード例 #5
0
ファイル: article.php プロジェクト: rashidyusmen/myproject
<?php

require_once '../common/bootstrap.php';
$news_collection = new NewsCollection();
$article = $news_collection->get($_GET['id']);
$news_comment_collection = new NewsCommentCollection($_GET['id']);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if ($_POST['name'] != '' && $_POST['comment'] != '') {
        $comment = new NewsComment();
        $comment->setName($_POST['name']);
        $comment->setContent($_POST['comment']);
        $news_comment_collection->save($comment);
    }
}
$comment = $news_comment_collection->get_all();
require_once 'includes/header.php';
?>
<article class="container-news">
<h2><?php 
echo $article->getTitle();
?>
</h2>
<em>posted on <?php 
echo $article->getDate();
?>
by <?php 
echo $article->getAuthor();
?>
</em>
<section>
	<img src="../storage/image1 laptop.png">
コード例 #6
0
ファイル: ApiHandler.php プロジェクト: textagroup/brafton-api
 /**
  * @return Comment[]
  */
 public function getLatestComments()
 {
     return NewsComment::getComments($this->commentUrl);
 }
コード例 #7
0
 /** @return String **/
 public function getComments()
 {
     if (empty($this->comments)) {
         $xh = $this->getFullNewsXML();
         $this->comments = NewsComment::getComments($xh->getHrefValue(COMMENTS));
     }
     return $this->comments;
 }
コード例 #8
0
ファイル: NewsSettings.php プロジェクト: rverbrugge/dif
    /**
     * handle tree edit
     */
    private function handleConfigGet($retrieveFields = true)
    {
        $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
        $request = Request::getInstance();
        $view = ViewManager::getInstance();
        $view->setType(News::VIEW_CONFIG);
        $key = $this->getKey();
        $fields = array();
        if ($retrieveFields) {
            if ($this->exists($key)) {
                $fields = $this->getDetail($key);
            } else {
                $fields = array_merge($this->getFields(SqlParser::MOD_INSERT), $this->plugin->getSettings());
            }
        } else {
            $fields = $this->getFields(SqlParser::MOD_UPDATE);
        }
        $template->setVariable('cbo_display', Utils::getHtmlCombo(News::getDisplayTypeList(), $fields['display']));
        $template->setVariable('cbo_comment_display', Utils::getHtmlCombo(NewsComment::getDisplayTypeList(), $fields['comment_display']));
        $this->setFields($fields);
        $template->setVariable($fields);
        $template->setVariable($key);
        // add source code editor
        $theme = $this->director->theme;
        $theme->addHeader('<script type="text/javascript" src="' . DIF_VIRTUAL_WEB_ROOT . 'js/editarea/edit_area/edit_area_full.js"></script>');
        $theme->addJavascript('
editAreaLoader.init({ 	id: "area1", 
							start_highlight: true, 
							allow_toggle: true, 
							allow_resize: true,
							language: "en", 
							syntax: "php", 
							syntax_selection_allow: "css,html,js,php", 
					});
');
        // add breadcrumb item
        $this->director->theme->handleAdminLinks($template);
        $this->template[$this->director->theme->getConfig()->main_tag] = $template;
    }
コード例 #9
0
ファイル: NewsComment.php プロジェクト: rverbrugge/dif
 public static function getDisplayTypeList()
 {
     if (isset(self::$displaytypelist)) {
         return self::$displaytypelist;
     }
     self::$displaytypelist = array();
     foreach (self::$displaytypes as $key => $value) {
         self::$displaytypelist[$key] = array('id' => $key, 'name' => $value);
     }
     return self::$displaytypelist;
 }
コード例 #10
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 $story->offset($parameters['offset']);
 $story->orderBy('date desc, rank desc, id desc');
 if (empty($parameters['sec'])) {
     $params = array();
 } else {
     $params = array('category' => $parameters['sec']);
 }
 $list = $story->find($params);
 if (!$list) {
     echo template_simple('no_stories.spt', array('error' => $story->error));
     return;
 }
 $total = $story->total;
 if (appconf('comments_blog_style')) {
     loader_import('news.Comment');
     $c = new NewsComment();
     foreach ($list as $k => $item) {
         $list[$k]->comments = $c->count($item->id);
     }
 }
 if (!appconf('sections') || $parameters['menu'] == 'no') {
     $menu = 'no';
 } else {
     $menu = '';
 }
 if (!appconf('sections')) {
     loader_import('saf.GUI.Pager');
     $pg = new Pager($parameters['offset'], $parameters['limit'], $total);
     $pg->setUrl(site_prefix() . '/index/news-app?menu=no&limit=' . $parameters['limit']);
     $pg->getInfo();
     template_simple_register('pager', $pg);
コード例 #11
0
ファイル: index.php プロジェクト: vojtajina/sitellite
<?php

if (!session_admin() || !isset($parameters['id'])) {
    header('Location: ' . site_prefix() . '/index/news-app');
    exit;
}
loader_import('news.Comment');
$c = new NewsComment();
$comment = $c->get($parameters['id']);
if (!$comment) {
    header('Location: ' . site_prefix() . '/index/news-app');
    exit;
}
$c->remove($parameters['id']);
page_title(intl_get('Comment Deleted'));
echo template_simple('comment_deleted.spt', $comment);
コード例 #12
0
 public function loadModel($id)
 {
     $model = NewsComment::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'Запись не найдена.');
     }
     return $model;
 }
コード例 #13
0
ファイル: News.php プロジェクト: rverbrugge/dif
    /**
     * handle conf edit
     */
    private function handleConfEditGet($retrieveFields = true)
    {
        viewManager::getInstance()->setType(ViewManager::CONF_EDIT);
        $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
        $template->setVariable('pageTitle', $this->description);
        $request = Request::getInstance();
        $view = ViewManager::getInstance();
        $detail = $this->getDetail(array());
        $fields = array();
        if ($retrieveFields) {
            $fields = $this->exists(array()) ? $detail : $this->getFields(SqlParser::MOD_INSERT);
        } else {
            $fields = $this->getFields(SqlParser::MOD_UPDATE);
        }
        $this->setFields($fields);
        $template->setVariable($this->getFields(SqlParser::MOD_UPDATE));
        $template->setVariable('id', $detail ? $detail['id'] : '');
        $template->setVariable('cbo_display', Utils::getHtmlCombo($this->getDisplayTypeList(), $fields['display']));
        $template->setVariable('cbo_comment_display', Utils::getHtmlCombo(NewsComment::getDisplayTypeList(), $fields['comment_display']));
        // add source code editor
        $theme = $this->director->theme;
        $theme->addHeader('<script type="text/javascript" src="' . DIF_VIRTUAL_WEB_ROOT . 'js/editarea/edit_area/edit_area_full.js"></script>');
        $theme->addJavascript('
editAreaLoader.init({ 	id: "area1", 
							start_highlight: true, 
							allow_toggle: true, 
							allow_resize: true,
							language: "en", 
							syntax: "php", 
							syntax_selection_allow: "css,html,js,php", 
					});
');
        $this->template[$this->director->theme->getConfig()->main_tag] = $template;
    }