function getArticlesAdminContent($logged) { global $site; global $sActionText; $oArticles = new BxDolArticles($logged); $sRet = ''; $sActions = $oArticles->ActionAddUpdateElements(); $sRet .= $sActions; switch ($_GET['action']) { case 'addcategory': $sRet .= $oArticles->getArticlesCategoryEditForm(); break; case 'categoryedit': $iCategoryID = (int) $_REQUEST['catID']; $sRet .= $oArticles->getArticlesCategoryEditForm($iCategoryID); break; case 'viewcategory': $iCategoryID = (int) $_REQUEST['catID']; $sRet .= $oArticles->getArticlesList($iCategoryID); break; case 'viewarticle': $iArticleID = (int) $_REQUEST['articleID']; $sRet .= $oArticles->getArticle($iArticleID); break; case 'addarticle': $sRet .= $oArticles->getArticleEditForm(); break; case 'categorydelete': $iCategoryID = (int) $_REQUEST['catID']; $sRet .= $oArticles->deleteCategory($iCategoryID); $sRet .= $oArticles->getArticlesCategoriesList(); break; case 'editarticle': $iArticleID = (int) $_REQUEST['articleID']; $sRet .= $oArticles->getArticleEditForm($iArticleID); break; case 'deletearticle': $iArticleID = (int) $_REQUEST['articleID']; $sRet .= $oArticles->deleteArticle($iArticleID); $sRet .= $oArticles->getArticlesCategoriesList(); break; default: $sRet .= $oArticles->getArticlesCategoriesList(); break; } return $sRet; }
function PageCompArticles() { $oArticles = new BxDolArticles(false); $sRetHtml = ''; switch ($_GET['action']) { case 'viewcategory': $iCategoryID = (int) $_REQUEST['catID']; $sRetHtml = $oArticles->getArticlesList($iCategoryID); break; case 'viewarticle': $iArticleID = (int) $_REQUEST['articleID']; $sRetHtml = $oArticles->getArticle($iArticleID); break; default: $sRetHtml = $oArticles->getArticlesCategiriesList(); break; } return $sRetHtml; }
function getBlockCode_Articles() { $php_date_format = getParam('php_date_format'); $oArticles = new BxDolArticles(false); $iArticlesLimit = (int) getParam('number_articles'); $iArticlesLimit = $iArticlesLimit != 0 ? $iArticlesLimit : 1; $rArticles = $oArticles->getArticlesResource($iArticlesLimit); $ret = ''; $iArticlesIndex = mysql_num_rows($rArticles); if ($iArticlesIndex) { while ($aArticle = mysql_fetch_assoc($rArticles)) { $sDate = date($php_date_format, strtotime($aArticle['Date'])); $sCategUrl = $oArticles->getArticleCatUrl($aArticle['CategoryID']); $sArticleUrl = $oArticles->getArticleUrl($aArticle['ArticlesID']); $sText = strip_tags($aArticle['Text']); if (strlen($sText) > 200) { $sText = mb_substr($sText, 0, 200) . '[...]'; } $ret .= '<div class="rss_item_wrapper">'; $ret .= '<div class="rss_item_header">'; $ret .= '<a href="' . $sArticleUrl . '">'; $ret .= htmlspecialchars_adv($aArticle['Title']); $ret .= '</a>'; $ret .= '</div>'; $ret .= '<div class="rss_item_info">'; $ret .= '<span><img src="' . getTemplateIcon('clock.gif') . '" alt="" />' . date($php_date_format, strtotime($sDate)) . '</span><span>' . _t('_in Category', getTemplateIcon('folder_small.png'), $sCategUrl, htmlspecialchars_adv($aArticle['CategoryName'])) . '</span>'; $ret .= '</div>'; $ret .= '<div class="rss_item_desc">'; $ret .= $sText; $ret .= '</div>'; $ret .= '</div>'; } $iArticlesCount = db_value("SELECT COUNT(*) FROM `Articles`"); $sMoreLink = $oArticles->isPermalinkEnabled() ? 'articles/' : 'articles.php'; if ($iArticlesCount > $iArticlesIndex) { $ret .= '<div class="rss_read_more">'; $ret .= '<a href="' . $GLOBALS['site']['url'] . $sMoreLink . '">'; $ret .= _t('_Read All Articles'); $ret .= '</a>'; $ret .= '</div>'; } } else { $ret .= '<div class="no_result"><div>'; $ret .= _t("_No articles available"); $ret .= '</div></div>'; } return $ret; }