Example #1
0
function homepage()
{
    $results = array();
    $data = Article::getList(HOMEPAGE_NUM_ARTICLES);
    $results['articles'] = $data['results'];
    $results['totalRows'] = $data['totalRows'];
    $results['pageTitle'] = "Widget News";
    require "templates/homepage.php";
}
Example #2
0
function homepage()
{
    $results = array();
    $data = Article::getList(HOMEPAGE_NUM_ARTICLES);
    $results['articles'] = $data['results'];
    $results['totalRows'] = $data['totalRows'];
    $results['pageTitle'] = "FusionCMS";
    require TEMPLATE_PATH . "/homepage.php";
}
Example #3
0
function homepage()
{
    $results = array();
    $data = Article::getList(HOMEPAGE_NUM_ARTICLES);
    $results['articles'] = $data['results'];
    $results['totalRows'] = $data['totalRows'];
    $results['pageTitle'] = "Upcoming Events";
    require TEMPLATE_PATH . "/thingstodo.php";
}
Example #4
0
function content($nav)
{
    $results = array();
    //use getList from the Article class to collect all the articles relating to the users choice
    $data = Article::getList(1000, "menu_order ASC", $nav);
    //now put the results into our results array
    $results['articles'] = $data['results'];
    //record the total number of articles (not used, but may be needed in the future
    $results['totalRows'] = $data['totalRows'];
    //use the content template to output the required html
    require "templates/content.php";
}
Example #5
0
function homepage()
{
    $results = array();
    $data = Article::getList(HOMEPAGE_NUM_ARTICLES);
    $results['articles'] = $data['results'];
    $results['totalRows'] = $data['totalRows'];
    $data = Category::getList();
    $results['categories'] = array();
    foreach ($data['results'] as $category) {
        $results['categories'][$category->id] = $category;
    }
    $results['pageTitle'] = "SystemBolaget";
    require TEMPLATE_PATH . "/homepage.php";
}
Example #6
0
function listArticles()
{
    $results = array();
    $data = Article::getList();
    $results['articles'] = $data['results'];
    $results['totalRows'] = $data['totalRows'];
    $results['pageTitle'] = "All Articles";
    if (isset($_GET['error'])) {
        if ($_GET['error'] == "articleNotFound") {
            $results['errorMessage'] = "Error: Article not found.";
        }
    }
    if (isset($_GET['status'])) {
        if ($_GET['status'] == "changesSaved") {
            $results['statusMessage'] = "Your changes have been saved.";
        }
        if ($_GET['status'] == "articleDeleted") {
            $results['statusMessage'] = "Article deleted.";
        }
    }
    require TEMPLATE_PATH . "/admin/listArticles.php";
}
    if (CheckForLogIn::isLogin()) {
        $user_info_array = GetMainUserInfo::GetInfo($regId);
        if ($user_info_array['is_admin'] == 1) {
            echo '<a id="article_edit" href="/edit-article/' . $singleArticleDescription['article_id'] . '"><i class="fa fa-pencil"></i> Редактировать статью</a>    |    ';
            echo '<a id="article_delete" href="/delete-article/' . $singleArticleDescription['article_id'] . '"><i class="fa fa-times"></i> Удалить статью (клик один раз на ссылку удалит статью)</a>';
            echo '<hr>';
        }
    }
    echo '</div>';
    echo '</div>';
    echo '</div>';
}
echo '<div class="container">';
echo '<div class="row">';
echo '<div class="col-md-12 artcicle_navigation">';
$all_articles = Article::getList();
$articlesCount = count($all_articles);
$get_id = ceil($articlesCount / 4);
// 4 - количество выводимых статей на одной странице
echo 'Страницы: ';
for ($i = 1; $i <= $get_id; $i++) {
    echo '  |  <a href="/article-navigation/' . $i . '">' . $i . '</a>  |  ';
}
echo '</div>';
echo '</div>';
echo '</div>';
?>

</div>

<div class="row">
Example #8
0
function listArticles()
{
    $results = array();
    $data = Article::getList();
    $results['articles'] = $data['results'];
    $results['totalRows'] = $data['totalRows'];
    $results['pageTitle'] = "All Articles";
    if (isset($_GET['error'])) {
        if ($_GET['error'] == "articleNotFound") {
            $results['errorMessage'] = "Error: Article not found. Are you sure you know what you're doing here?";
        }
        /*the reason there is an if but not an else is that I only want to respond to errors. 
          To do that, I need to check if they exist (if). The else is not needed. This is kinda like a throw/catch kinda thing. Speaking of which, I should (once this version is live) look into implementing throw/catch. 
          It's the same thing as this, but it would make me look like less of a idiot */
    }
    if (isset($_GET['status'])) {
        #this isn't an error, so plain 'if' might be best. There is probably some alternative though.
        if ($_GET['status'] == "changesSaved") {
            $results['statusMessage'] = "Your changes have been saved, Captain.";
        }
        #I AM PICARD AND NO ONE CAN TELL ME OTHERWISE
        if ($_GET['status'] == "articleDeleted") {
            $results['statusMessage'] = "Article deleted. You monster.";
        }
    }
    require TEMPLATE_PATH . "/admin/listArticles.php";
    #note that there are no return;s. This is because I want the code to cycle through checking for errors and status messages. I don't want it to not find an article and then just die, and I /definitely/ don't want it to save changes and then crap out on me.
}
Example #9
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== TRUE) {
    die;
}
CModule::IncludeModule("iblock");
$article = Article::getList();
$arResult["ARTICLE"] = $article;
$this->IncludeComponentTemplate();
$APPLICATION->SetTitle("Список интересных статей от проекта MyTb.ru");
$APPLICATION->SetPageProperty("description", "Список статей от проекта MyTb.ru");
function deleteCategory()
{
    if (!($category = Category::getById((int) $_GET['categoryId']))) {
        header("Location: admin.php?action=listCategories&error=categoryNotFound");
        return;
    }
    $articles = Article::getList(1000000, $category->id);
    if ($articles['totalRows'] > 0) {
        header("Location: admin.php?action=listCategories&error=categoryContainsArticles");
        return;
    }
    $category->delete();
    header("Location: admin.php?action=listCategories&status=categoryDeleted");
}
Example #11
0
function homepage()
{
    $results = array();
    $data = Article::getList(HOMEPAGE_NUM_ARTICLES);
    #this passes our value (defined in config.php) of the number of articles on the homepage, and the getList() function then stores those as articles (obligatory "as associative arrays") in $data.
    $results['articles'] = $data['results'];
    /*the getList() function 'return's its found articles (and totalRows). This is where 'return' is useful: passing the output of a function to something above it in a chain. 
      In this case, getList() passes the articles to its parent in the chain under the name 'results' (same for totalRows), and by setting $data equal to getList()'s output, we kind of "catch" that return and give it a container */
    $results['totalRows'] = $data['totalRows'];
    $results['pageTitle'] = "The Blag";
    /*I don't need to have any variables here because this is a static homepage. 
      The content changes, the type of page does not. This contrasts with individual article pages where the only content on them are the articles in question. 
      Here the main content is the homepage itself, therefore the name is the site's chosen name. (here it's "The Blag" because I like xkcd and it's simple.) */
    require TEMPLATE_PATH . "/homepage.php";
}
Example #12
0
*  This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Add a special article
* 
* Settings
* 
* 01/10/2004 by Christian Ehret chris@uffbasse.de
*/
$smartyType = "www";
include_once "../includes/default.inc.php";
$auth->is_authenticated();
include_once "articleclass.inc.php";
$article = new Article();
$smarty->assign("tpl_title", "Sonderverkauf");
if ($request->GetVar('frm_description', 'post') !== $request->undefined) {
    include_once "barguestclass.inc.php";
    $barguest = new Barguest();
    $articleid = $article->addSpecial();
    $theguestid = $request->GetVar('frm_theguestid', 'post');
    $smarty->assign("tpl_theguestid", $theguestid);
    $num = $request->GetVar('frm_num', 'post');
    $barguest->buy($articleid, $theguestid, $num);
    $smarty->assign('tpl_added', 'true');
} else {
    $smarty->assign('tpl_articles', $article->getList());
    $smarty->assign("tpl_theguestid", $request->GetVar('guestid', get));
    $smarty->assign("tpl_catid", $request->GetVar('catid', get));
    $smarty->assign('tpl_added', 'false');
}
$smarty->display('addspecial.tpl');
Example #13
0
function listArticles()
{
    $results = array();
    $data = Article::getList();
    $results['articles'] = $data['results'];
    $results['totalRows'] = $data['totalRows'];
    $results['pageTitle'] = "All Articles";
    if (isset($_GET['error'])) {
        if ($_GET['error'] == "articleNotFound") {
            $results['errorMessage'] = "Errore: articolo non trovato.";
        }
    }
    if (isset($_GET['status'])) {
        if ($_GET['status'] == "changesSaved") {
            $results['statusMessage'] = "Le tue modifiche sono state salvate.";
        }
        if ($_GET['status'] == "articleDeleted") {
            $results['statusMessage'] = "Articolo eliminato.";
        }
    }
    require TEMPLATE_PATH . "/admin/listArticles.php";
}
Example #14
0
function admin()
{
    if (!$GLOBALS['authentication']) {
        header("Location: index.php?admin=login");
    }
    $results = array();
    if (!$GLOBALS['authentication']) {
        header("Location: index.php?admin=login");
    }
    $data = Article::getList();
    $results['articles'] = $data['results'];
    $results['totalRows'] = $data['totalRows'];
    $results['pageTitle'] = "Здвинская ЦБС | Список новостей";
    $results['admin'] = true;
    //! @todo страница не тарифицируется роботами
    if (isset($_GET['error'])) {
        if ($_GET['error'] == "articleNotFound") {
            $results['errorMessage'] = "Error: Страница не найдена";
        }
    }
    if (!$results['articles']) {
        $results['statusMessage'] = 'Страниц не обнаруженно';
    }
    if (isset($_GET['status'])) {
        if ($_GET['status'] == "changesSaved") {
            $results['statusMessage'] = "Ваши изменение были сохранены";
        }
        if ($_GET['status'] == "articleDeleted") {
            $results['statusMessage'] = "Страница удаленна";
        }
    }
    $results['script'] = "/admin/listNews";
    require $setting["SCRIPT_PATH"] . $setting["TEMPLATE_PATH"] . "/include/page.php";
}