Example #1
0
 public function confirmDelete($id_art)
 {
     $articles = new Model_Article();
     $viewArticle = $articles->viewArticle($id_art);
     if (!empty($viewArticle)) {
         require_once $_SERVER['DOCUMENT_ROOT'] . "IMIE/Equipedia/views/admins/delete.php";
     }
 }
Example #2
0
 public function action_interesting()
 {
     $article = new Model_Article();
     $text = $article->get_text('interesting');
     $text = $text[0]['text'];
     $content = View::factory('/pages/interesting');
     $content->text = $text;
     $this->template->content = $content;
 }
Example #3
0
 /**
  * (non-PHPdoc)
  * @see Controller::index()
  */
 public function index()
 {
     $arr = [3234, 'abc'];
     echo '<pre>';
     exit;
     $mo = new Model_Article();
     //获取新闻公告列表
     $options = array();
     $this->list = $mo->getList($options);
 }
Example #4
0
 public function action_about()
 {
     $article = new Model_Article();
     $text = $article->get_text('about');
     $text = $text[0]['text'];
     $content = View::factory('/pages/about');
     $content->text = $text;
     //      $this->template->text = $text;
     $this->template->content = $content;
 }
Example #5
0
 public function deleteArticle($numero_series)
 {
     $article = new Model_Article();
     $deleteArticle = $article->deleteArticle($numero_series);
     if (!empty($deleteArticle)) {
         header('Location : /imie/boutique/index.php?c=article&a=list');
     } else {
         var_dump($deleteArticle);
     }
 }
 /**
  * Fonction permettant de lister les articles sur la page home des admins
  */
 public function listLastArticleUser()
 {
     $precision1 = ' ORDER BY id_article DESC';
     $article = new Model_Article();
     $listArticle = $article->listArticle($precision1);
     $precision2 = ' ORDER BY id_users DESC';
     $users = new Model_Utilisateur();
     $listUsers = $users->listUsers($precision2);
     require_once $_SERVER['DOCUMENT_ROOT'] . 'boutique/admin/views/home_admin.php';
 }
Example #7
0
 public function action_post()
 {
     $article_id = $this->request->param('id');
     $article = new Model_Article($article_id);
     $article->values($_POST);
     // populate $article object from $_POST array
     $article->save();
     // saves article to database
     $this->redirect('article');
     // redirects to article page after saving
 }
Example #8
0
 /**
  * 显示文章信息
  */
 public function detail()
 {
     if (!empty($_GET['url'])) {
         $start = strrpos($_GET['url'], '/');
         if (false === $start) {
             $start = -1;
         }
         if (false === strpos($_GET['url'], '.html')) {
             $str = substr($_GET['url'], $start + 1);
         } else {
             $str = substr($_GET['url'], $start + 1, -5);
         }
         $_GET['id'] = $id = UMath::idDecrypt($str);
     }
     if (empty($_GET['id']) || !ctype_digit($_GET['id'])) {
         $this->header404();
         exit;
     } else {
         $id = $_GET['id'];
     }
     $mo = new Model_Article();
     if (!$detail) {
         $this->header404();
         exit;
     }
     // 有跳转链接,直接跳转到目标网址
     if ($detail['redirect']) {
         header('Location:' . $detail['redirect']);
         exit;
     }
     if ($detail['html_file']) {
         if (!empty($_GET['make_html']) && is_file($htmlFile = $mo->getHtmlFile($id, $detail['html_file']))) {
             $htmlUrl = str_replace(WEB_PATH, '/', $htmlFile);
             header('Location:' . $htmlUrl);
             exit;
         } else {
             $_GET['make_html'] = true;
         }
     } else {
         $_GET['make_html'] = true;
         $detail['html_file'] = UMath::idCrypt($id);
         $data = array('id' => $id, 'html_file' => $detail['html_file']);
         $mo->save($data);
     }
     $this->detail = $detail;
     $_GET['make_html'] = true;
     $_GET['html_display'] = false;
     $_GET['html_file'] = $mo->getHtmlFile($id, $detail['html_file']);
     $htmlUrl = str_replace(WEB_PATH, '/', $_GET['html_file']);
     $this->display();
     header('Location:' . $htmlUrl);
     return false;
 }
Example #9
0
 public function action_delete($article_id)
 {
     $article = Model_Article::find($article_id);
     $article->delete();
     Session::set_flash('notice', 'Article deleted');
     Response::redirect('-admin/articles');
 }
Example #10
0
 public function action_show($article_id)
 {
     $article = Model_Article::find($this->param('id'));
     $this->title($article->title);
     $this->view = $this->theme->view('articles/show');
     $this->view->set('article', $article);
 }
Example #11
0
 /**
  * Действие для отображения определённой статьи из категории
  */
 public function action_view($id = NULL)
 {
     is_null($id) and \Response::redirect('');
     $data['article'] = \Model_Article::query()->where('id', '=', $id)->where('category_id', '=', 5)->order_by('id', 'DESC')->limit(1)->get_one();
     $this->template->page_title = 'Клуб :: ' . $data['article']->title;
     $this->template->content = \View::forge('club/view', $data, FALSE);
 }
Example #12
0
 /**
  * Действие для отображения главной страницы
  */
 public function action_index()
 {
     // Три последних новости
     $data['contacts'] = \Model_Article::query()->where('category_id', '=', 2)->order_by('id', 'DESC')->limit(1)->get_one();
     $this->template->page_title = 'Контакты';
     $this->template->content = \View::forge('contacts/index', $data, FALSE);
 }
Example #13
0
 function tweet_newArticleBuild($board = null, $article = null)
 {
     if ($board == null || $article == null) {
         return;
     }
     if ($board->type != 3) {
         $longURL = BBS_URL . 'thread' . DS . $board->shortName . DS . $article->id;
         $shortURL = $this->url_shorten_google($longURL);
         if (!$shortURL) {
             $shortURL = $longURL;
         }
         if ($article->commentOf == 0) {
             $text = $shortURL . ' 【' . $board->title . '】にスレッド【' . $article->title . '】が投稿されました。是非ご覧下さい。';
             $this->tweet($text);
         } else {
             $numArray = [1, 10, 30, 50, 100, 300, 500, 1000];
             $th = Model_Article::find($article->commentOf);
             foreach ($numArray as $num) {
                 if ($th->commentCount == $num) {
                     if ($num == 1) {
                         $text = $shortURL . ' おめでとうございます!掲示板' . '【' . $board->title . '】 のスレッド【' . $th->title . '】に初コメントが付きました!。是非御覧ください。';
                     } else {
                         $text = $shortURL . ' おめでとうございます!掲示板' . '【' . $board->title . '】のスレッド【' . $th->title . '】のコメントが' . $th->commentCount . 'になりました!。是非御覧ください。';
                     }
                     $this->tweet($text);
                     break;
                 }
             }
         }
     }
 }
Example #14
0
 /**
  * 自身の書き込みに対するコメント数を得る
  * @param type $board Model_Board
  * @param type $threadId スレッド元(Model_Article)のID
  * @return int コメント数
  */
 public function getCountOfComments()
 {
     $query = Model_Article::query();
     $query->and_where_open();
     $query->where('commentOf', '=', $this->id);
     $query->and_where_close();
     return $query->count();
 }
Example #15
0
File: view.php Project: sajans/cms
 /**
  * Prepare the view data, keeping this in here helps clean up
  * the controller.
  *
  * @return void
  */
 public function view()
 {
     $this->article = $this->article;
     $this->admin = $this->admin;
     $this->fields = Model_Article_Detail::getFields();
     $this->uploads = $this->article->getUploads(7, 1);
     $this->related = Model_Article::getRelatedArticle();
 }
Example #16
0
 public function action_delete()
 {
     $user_id = $this->user->id;
     $article_id = $this->request->param('article_id');
     if (!empty($article_id) && !empty($user_id)) {
         Model_Article::get($article_id)->remove($user_id);
     }
     $this->redirect('/admin/articles');
 }
Example #17
0
 public function articles()
 {
     $articles = Model_Article::getAllArticles();
     foreach ($articles as $article) {
         $article->views = $this->stats->get(Model_Stats::ARTICLE, $article->id);
     }
     $this->view["articles"] = $articles;
     return View::factory('templates/admin/articles/list', $this->view);
 }
Example #18
0
 public function action_delete($id = null)
 {
     if ($article = Model_Article::find($id)) {
         $article->delete();
         Session::set_flash('success', 'Deleted article #' . $id);
     } else {
         Session::set_flash('error', 'Could not delete article #' . $id);
     }
     Response::redirect('articles');
 }
Example #19
0
 /**
  * Действие для просмотра новости
  * 
  * @param int $news_id
  */
 public function action_view($news_id)
 {
     is_null($news_id) and \Response::redirect('');
     // Получаем новость
     $data['news'] = \Model_Article::query()->where('category_id', 1)->where('id', $news_id)->get_one();
     // Если такой статьи нет, то отображаем страницу 404
     if (is_null($data['news'])) {
         throw new \HttpNotFoundException();
     }
     // Передаем данные в вид
     $this->template->content = \View::forge('news/view', $data, FALSE);
 }
Example #20
0
 /**
  * 添加/修改文章
  */
 public function save()
 {
     if (!empty($_POST['id']) && !ctype_digit($_POST['id'])) {
         $this->failure(Core::getLang('invalid_request'));
     }
     // 如果有文件上传
     if ($_FILES['title_image']['error'] != UPLOAD_ERR_NO_FILE) {
         $options = array('type' => 'image', 'max_size' => 1024000, 'save_path' => IMG_PATH . 'article/', 'save_rule' => '##Ymd/');
         $upload = new UploadFile($options);
         // 上传错误提示错误信息
         if (!$upload->upload()) {
             $this->failure($upload->error());
         } else {
             // 上传成功 获取上传文件信息
             $_POST['title_image'] = $upload->fileList['title_image']['savename'];
         }
     } else {
         $_POST['title_image'] = '';
     }
     $_POST['editor_uid'] = $_SESSION['uid'];
     $_POST['editor'] = $_SESSION['username'];
     $_POST['post_time'] = strtotime($_POST['post_time']);
     // 		if (!isset($_POST['brief'])) {
     // 			$_POST['brief'] = '';
     // 		}
     // 		$_POST['content'] = '';
     $mo = new Model_Article();
     if ($mo->save($_POST)) {
         $this->success(Core::getLang('handle_success'), 'admin.php?a=article');
     } else {
         if ($mo->msg) {
             $msg = $mo->msg;
         } else {
             $msg = Core::getLang('save_article_data_fail');
         }
         $this->failure($msg);
     }
 }
Example #21
0
 /**
  * Дейсвтие-обработчик ПОСТ-запроса на изменения кол-ва комментов ВК
  */
 public function action_change_comments_num()
 {
     if (\Input::method() == 'POST') {
         $id = (int) \Input::post('id');
         $num = (int) \Input::post('num');
         if ($id != 0) {
             $article = \Model_Article::find($id);
             if ($article) {
                 $article->vk_comments_count = $num;
                 $article->save();
                 return \View::forge('empty', array());
             }
         }
     }
 }
Example #22
0
 public function action_showArticle()
 {
     $articleId = $this->request->param('article_id');
     $this->view["id"] = $articleId;
     $article = Model_Article::get($articleId);
     if ($article->id == 0) {
         throw new HTTP_Exception_404();
     }
     $this->stats->hit(Model_Stats::ARTICLE, $articleId);
     $this->view["article"] = $article;
     $this->title = $article->title;
     $comments = Model_Comment::getCommentsByArticle($articleId);
     $comments_table_rebuild = $this->methods->rebuildCommentsTree($comments);
     $this->view["comments"] = $comments_table_rebuild;
     $this->template->content = View::factory('templates/articles/article', $this->view);
 }
Example #23
0
 function delete_index()
 {
     if (Input::get('id')) {
         $articulo = Model_Article::find(Input::get('id'));
         if ($articulo) {
             $articulo->delete();
             $respuesta = array("success" => "true", "data" => array('msg' => 'Articulo Eliminado'));
             $this->response($respuesta, 200);
         } else {
             $respuesta = array("error" => "true", "msg" => 'id No encontrado, No se pudo borrar');
             $this->response($respuesta, 404);
         }
     } else {
         $respuesta = array("error" => "true", "msg" => 'No encontrado, No se pudo borrar');
         $this->response($respuesta, 404);
     }
 }
Example #24
0
<?php

/* TODO: Add code here */
require 'config/globalconfig.php';
include_once 'class/model_comment.php';
include_once 'class/model_commentbad.php';
include_once 'class/model_articletype.php';
include_once 'class/model_article.php';
include_once 'class/model_user.php';
$objComment = new Model_Comment($objConnection);
$objCommentBad = new Model_CommentBad($objConnection);
$objUser = new Model_User($objConnection);
$objArticle = new Model_Article($objConnection);
$objArticleType = new Model_ArticleType($objConnection);
if ($_pgR["act"] == model_Article::ACT_ADD || $_pgR["act"] == model_Article::ACT_UPDATE) {
    if (global_common::isCLogin()) {
        //get user info
        $c_userInfo = $_SESSION[global_common::SES_C_USERINFO];
        $articleid = $_pgR[global_mapping::ArticleID];
        $content = html_entity_decode($_pgR[global_mapping::Content], ENT_COMPAT, 'UTF-8');
        $createdby = $c_userInfo[global_mapping::UserID];
        $status = 1;
        if ($_pgR["act"] == Model_Comment::ACT_ADD) {
            $createdBy = $c_userInfo[global_mapping::UserID];
            $resultID = $objComment->insert($articleid, $content, $createdby, $status);
            //echo global_common::convertToXML($arrHeader, array("rs","info"), array(0,$resultID), array(0,1));
            //return;
            if ($resultID) {
                $commentHTML = $objComment->getCommentHTMLByArticle($articleid);
                $arrHeader = global_common::getMessageHeaderArr($banCode);
                //$banCode
Example #25
0
 /**
  * Load more
  *
  * @version 1.0
  * @since 1.0
  * @access public
  * @author Nguyen Van Hiep
  */
 public function action_ajaxload()
 {
     $cat_id = Input::post('cat_id');
     $lang = Input::post('lang');
     $current_news_count = Input::post('current_news_count');
     $type = Input::post('type');
     $cat = Model_Categories::find($cat_id);
     switch ($type) {
         case 'ds_sanpham_4col':
             $show_more = View::forge('customer/cat/show_more_template_ds_sanpham_4col');
             $more_arts = Model_Article::load_articles_limit($cat_id, $lang, $current_news_count, 4);
             break;
         case 'news':
             $show_more = View::forge('customer/cat/show_more_template_news');
             $more_arts = Model_Article::load_articles_limit($cat_id, $lang, $current_news_count, NEWS_LIMIT);
             break;
         case 'ds_monan':
             $show_more = View::forge('customer/cat/show_more_template_ds_monan');
             $more_arts = Model_Article::load_articles_limit($cat_id, $lang, $current_news_count, 8);
             break;
     }
     $count = count($more_arts);
     $ret = '';
     if ($count > 0) {
         $show_more->current_count = Input::post('current_count', 0);
         foreach ($more_arts as $art) {
             ++$show_more->current_count;
             $show_more->art = $art;
             $show_more->cat = $cat;
             $ret .= $show_more;
         }
     }
     return $ret;
 }
<?php

/* TODO: Add code here */
require 'config/globalconfig.php';
include_once 'include/_permission.inc';
include_once 'class/model_user.php';
include_once 'class/model_article.php';
$objArticle = new Model_Article($objConnection);
$objUser = new Model_User($objConnection);
if (global_common::isCLogin()) {
    //get user info
    $userInfo = $_SESSION[global_common::SES_C_USERINFO];
    $userID = $userInfo[global_mapping::UserID];
    $condidtion = '(' . global_mapping::EndDate . ' >= \'' . global_common::nowDateSQL() . '\' Or ' . global_mapping::EndDate . ' is null)';
    $articles = $objArticle->getArticleByUser($userID, 1, global_common::DEFAULT_PAGE_SIZE, null, $condidtion, '');
    $condidtion = global_mapping::EndDate . ' < \'' . global_common::nowDateSQL() . '\'';
    $expireArticles = $objArticle->getArticleByUser($userID, 1, global_common::DEFAULT_PAGE_SIZE, null, $condidtion, '');
    //print_r($articles);
}
?>

<?php 
include_once 'include/_header.inc';
include_once 'include/_menu.inc';
?>
<script type="text/javascript" src="<?php 
echo $_objSystem->locateJs('user_user.js');
?>
"></script>
<script type="text/javascript" src="<?php 
echo $_objSystem->locateJs('user_article.js');
Example #27
0
 public function action_delete()
 {
     $article = new Model_Article();
     $article->deleteArticleById($this->params['id']);
     $this->redirect('article');
 }
Example #28
0
 private static function rowsToModels($article_rows)
 {
     $articles = array();
     if (!empty($article_rows)) {
         foreach ($article_rows as $article_row) {
             $article = new Model_Article();
             $article->fillByRow($article_row);
             array_push($articles, $article);
         }
     }
     return $articles;
 }
Example #29
0
<?php

/* TODO: Add code here */
require 'config/globalconfig.php';
include_once 'class/model_article.php';
include_once 'class/model_articletype.php';
$objArticle = new Model_Article($objConnection);
$objArticleType = new Model_ArticleType($objConnection);
if ($_pgR["act"] == model_Article::ACT_ADD || $_pgR["act"] == model_Article::ACT_UPDATE) {
    if (global_common::isCLogin()) {
        //get user info
        $c_userInfo = $_SESSION[global_common::SES_C_USERINFO];
        //print_r($c_userInfo);
        //if ($objMenu->getMenuByName($_pgR['name'])) {
        //	echo global_common::convertToXML($arrHeader, array("rs",'info'), array(0,global_common::STRING_NAME_EXIST), array(0,1));
        //	return;
        //}
        //print_r($_pgR);
        $title = $_pgR[global_mapping::Title];
        $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
        $content = $_pgR[global_mapping::Content];
        //$content = html_entity_decode($content,ENT_COMPAT ,'UTF-8' );
        $tags = $_pgR[global_mapping::Tags];
        $tags = html_entity_decode($tags, ENT_COMPAT, 'UTF-8');
        $catalogueID = $_pgR[global_mapping::CatalogueID];
        $sectionID = $_pgR[global_mapping::SectionID];
        $renewedNum = 0;
        $companyName = html_entity_decode($_pgR[global_mapping::CompanyName], ENT_COMPAT, 'UTF-8');
        $companyAddress = html_entity_decode($_pgR[global_mapping::CompanyAddress], ENT_COMPAT, 'UTF-8');
        $companyWebsite = html_entity_decode($_pgR[global_mapping::CompanyWebsite], ENT_COMPAT, 'UTF-8');
        $companyPhone = html_entity_decode($_pgR[global_mapping::CompanyPhone], ENT_COMPAT, 'UTF-8');
Example #30
0
 /**
  * Get article from keyword of name
  *
  * @params string $k keyword of name to search
  * @params int $offset Offset
  * @params int $offset Limit
  *
  * @return array objects of articles
  *
  * @access public
  * @author Nguyen Van hiep
  *
  * @version 1.0
  * @since 1.0
  */
 public static function get_arts_from_keyword($k, $offset = null, $limit = null)
 {
     if ($offset != null or $limit != null) {
         $arts = Model_Article::query()->where('name', 'LIKE', "%{$k}%")->order_by('created_at', 'desc')->rows_offset($offset)->rows_limit($limit)->get();
         return $arts;
     }
     $count = Model_Article::query()->where('name', 'LIKE', "%{$k}%")->count();
     return $count;
 }