Esempio n. 1
0
<?php

require_once 'database.php';
require_once 'models/articles.php';
$link = db_connect();
$article = article_get($link, $_GET['id']);
include 'views/article.php';
Esempio n. 2
0
    Flight::render('search.php');
});
/**
 * Articles Archive
 */
Flight::route('/articles/(@page_number)/', function ($page_number = 0) {
    site_title('Articles');
    Flight::render('articles.php', array('articles' => get_article_data()));
});
/**
 * Single Article Page
 */
Flight::route('/how-to/(@page)/', function ($page = '') {
    $article = array();
    site_breadcrumb_add('Articles', 'articles/');
    if ($article = article_get($page)) {
        site_breadcrumb_add($article['name'], 'how-to/' . $page . '/');
        site_title($article['name']);
        if (!empty($article['description'])) {
            site_description($article['description']);
        }
    } else {
        Flight::notFound();
    }
    Flight::render('article.php', array('article' => $article, 'articles' => get_article_data()));
});
/**
 * Support
 */
Flight::route('/documentation/(@type)(/@page)/', function ($type = '', $page = '') {
    $layout = '';
Esempio n. 3
0
}
if ($action == "add") {
    if (!empty($_POST)) {
        article_new($link, $_POST['title'], $_POST['date'], $_POST['content']);
        header("Location: index.php");
    }
    $article = ['date' => '', 'title' => '', 'content' => ''];
    include "../views/article_admin.php";
} else {
    if ($action == "edit") {
        if (!isset($_GET['id'])) {
            header("Location: index.php");
        }
        $id = (int) $_GET['id'];
        if (!empty($_POST) && $id > 0) {
            article_edit($link, $id, $_POST['title'], $_POST['date'], $_POST['content']);
            header("Location: index.php");
        }
        $article = article_get($link, $id);
        include "../views/article_admin.php";
    } else {
        if ($action == "delete") {
            $id = (int) $_GET['id'];
            $article = article_delete($link, $id);
            header("Location: index.php");
        } else {
            $articles = articles_all($link);
            include "../views/articles_admin.php";
        }
    }
}
Esempio n. 4
0
<?php

/* точка входа */
require_once "database.php";
require_once "models/articles.php";
$article = article_get($_GET['id']);
/* подключение шаблона */
include "views/article.php";
?>