| 1 | <? |
|---|
| 2 | |
|---|
| 3 | /*************************************************************************** |
|---|
| 4 | * Dolphin Smart Community Builder |
|---|
| 5 | * ----------------- |
|---|
| 6 | * begin : Mon Mar 23 2006 |
|---|
| 7 | * copyright : (C) 2006 BoonEx Group |
|---|
| 8 | * website : http://www.boonex.com/ |
|---|
| 9 | * This file is part of Dolphin - Smart Community Builder |
|---|
| 10 | * |
|---|
| 11 | * Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License. |
|---|
| 12 | * http://creativecommons.org/licenses/by/3.0/ |
|---|
| 13 | * |
|---|
| 14 | * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
|---|
| 15 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|---|
| 16 | * See the Creative Commons Attribution 3.0 License for more details. |
|---|
| 17 | * You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin, |
|---|
| 18 | * see license.txt file; if not, write to marketing@boonex.com |
|---|
| 19 | ***************************************************************************/ |
|---|
| 20 | |
|---|
| 21 | require_once( 'inc/header.inc.php' ); |
|---|
| 22 | require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' ); |
|---|
| 23 | require_once( BX_DIRECTORY_PATH_INC . 'admin_design.inc.php' ); |
|---|
| 24 | require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' ); |
|---|
| 25 | require_once( BX_DIRECTORY_PATH_CLASSES . 'BxDolArticles.php' ); |
|---|
| 26 | |
|---|
| 27 | check_logged(); |
|---|
| 28 | |
|---|
| 29 | $_page['name_index'] = 0; |
|---|
| 30 | $_ni = $_page['name_index']; |
|---|
| 31 | $_page_cont[$_ni]['page_main_code'] = PageCompArticles($logged); |
|---|
| 32 | $_page['extra_js'] = $oTemplConfig -> sTinyMceEditorJS; |
|---|
| 33 | $_page['css_name'] = 'articles.css'; |
|---|
| 34 | |
|---|
| 35 | $_page['header'] = _t( "_ARTICLES_H", $site['title'] ); |
|---|
| 36 | $_page['header_text'] = _t( "_ARTICLES_H1" ); |
|---|
| 37 | |
|---|
| 38 | // --------------- page components |
|---|
| 39 | |
|---|
| 40 | function PageCompArticles($logged) { |
|---|
| 41 | global $site; |
|---|
| 42 | global $sActionText; |
|---|
| 43 | |
|---|
| 44 | $oArticles = new BxDolArticles($logged); |
|---|
| 45 | $sRet = ''; |
|---|
| 46 | |
|---|
| 47 | $sActions = $oArticles->ActionAddUpdateElements(); |
|---|
| 48 | $sRet .= $sActions; |
|---|
| 49 | |
|---|
| 50 | switch ($_GET['action'] ) { |
|---|
| 51 | case 'addcategory': |
|---|
| 52 | $sRet .= $oArticles->getArticlesCategoryEditForm(); |
|---|
| 53 | break; |
|---|
| 54 | |
|---|
| 55 | case 'categoryedit': |
|---|
| 56 | $iCategoryID = (int)$_REQUEST['catID']; |
|---|
| 57 | $sRet .= $oArticles->getArticlesCategoryEditForm( $iCategoryID ); |
|---|
| 58 | break; |
|---|
| 59 | |
|---|
| 60 | case 'viewcategory': |
|---|
| 61 | if (isset($_REQUEST['articleCatUri'])) |
|---|
| 62 | $iCategoryID = (int)$oArticles->getArticleCatIdByUri( $_REQUEST['articleCatUri'] ); |
|---|
| 63 | else |
|---|
| 64 | $iCategoryID = (int)$_REQUEST['catID']; |
|---|
| 65 | $sRet = $oArticles->getArticlesList( $iCategoryID ); |
|---|
| 66 | break; |
|---|
| 67 | |
|---|
| 68 | case 'viewarticle': |
|---|
| 69 | if (isset($_REQUEST['articleUri'])) |
|---|
| 70 | $iArticleID = $oArticles->getArticleIdByUri( $_REQUEST['articleUri'] ); |
|---|
| 71 | else |
|---|
| 72 | $iArticleID = $_REQUEST['articleID']; |
|---|
| 73 | |
|---|
| 74 | $sRet = $oArticles->getArticle( $iArticleID ); |
|---|
| 75 | break; |
|---|
| 76 | |
|---|
| 77 | case 'addarticle': |
|---|
| 78 | $sRet .= $oArticles->getArticleEditForm(); |
|---|
| 79 | break; |
|---|
| 80 | |
|---|
| 81 | case 'categorydelete': |
|---|
| 82 | $iCategoryID = (int)$_REQUEST['catID']; |
|---|
| 83 | $sRet .= $oArticles->deleteCategory( $iCategoryID ); |
|---|
| 84 | $sRet .= $oArticles->getArticlesCategoriesList(); |
|---|
| 85 | break; |
|---|
| 86 | |
|---|
| 87 | case 'editarticle': |
|---|
| 88 | $iArticleID = (int)$_REQUEST['articleID']; |
|---|
| 89 | $sRet .= $oArticles->getArticleEditForm( $iArticleID ); |
|---|
| 90 | break; |
|---|
| 91 | |
|---|
| 92 | case 'deletearticle': |
|---|
| 93 | $iArticleID = (int)$_REQUEST['articleID']; |
|---|
| 94 | $sRet .= $oArticles->deleteArticle( $iArticleID ); |
|---|
| 95 | $sRet .= $oArticles->getArticlesCategoriesList(); |
|---|
| 96 | break; |
|---|
| 97 | |
|---|
| 98 | default: |
|---|
| 99 | $sRet .= $oArticles->getArticlesCategoriesList(); |
|---|
| 100 | break; |
|---|
| 101 | } |
|---|
| 102 | |
|---|
| 103 | return $sRet; |
|---|
| 104 | } |
|---|
| 105 | |
|---|
| 106 | PageCode(); |
|---|
| 107 | ?> |
|---|