Exemple #1
0
 } else {
     if ($action == 'delete') {
         $id = $_GET['id'];
         if (!empty($id)) {
             news_delete($link, $id);
             header("Location: admin.php");
         }
     } else {
         if ($action == 'edit') {
             $id = $_GET['id'];
             if (!empty($id)) {
                 if (!empty($_POST['submit'])) {
                     news_edit($link, $id, $_POST['title'], $_POST['text'], $_POST['author']);
                     header("Location: admin.php");
                 } else {
                     $article = news_get($link, $id);
                 }
                 include "../views/admin_edit.php";
             }
         } else {
             if ($action == 'filter') {
                 if (isset($_POST['submit'])) {
                     if (empty($_POST['title']) && empty($_POST['author']) && empty($_POST['datefirst']) && empty($_POST['datelast'])) {
                         header("Location: admin.php");
                     } else {
                         $title = "";
                         $author = "";
                         $datefirst = "";
                         $datelast = "";
                         if (!empty($_POST['title'])) {
                             $title = $_POST['title'];
 print "</tr>" . NEWLINE;
 print "</table>" . NEWLINE;
 print "<br>" . NEWLINE;
 ###########################################################################################
 # NEWS
 ###########################################################################################
 print "<table class=hide100>" . NEWLINE;
 print "<tr>" . NEWLINE;
 print "<td><h3><a name='news'>" . lang_get("news") . "</a></h3></td>" . NEWLINE;
 print "<td class=tbl-r><a href='#'>^ " . lang_get("top") . "</a></td>" . NEWLINE;
 print "</tr>" . NEWLINE;
 print "</table>" . NEWLINE;
 print "<div align=center>" . NEWLINE;
 $row_subject = "";
 $row_body = "";
 $row_news = news_get($project_id);
 # if there is no news entered for this project, form will create news record
 #
 # else
 #
 # form will edit news record
 if (empty($row_news)) {
     print "<form method=post action=news_add_action.php>" . NEWLINE;
 } else {
     $row_subject = $row_news[0][NEWS_SUBJECT];
     $row_body = $row_news[0][NEWS_BODY];
     $news_id = $row_news[0][NEWS_ID];
     print "<form method=post action=news_edit_action.php>" . NEWLINE;
     print "<input type=hidden name=news_id value={$news_id}>";
 }
 print "<input type=hidden name=project_id value={$project_id}>";
Exemple #3
0
<?php

require_once "../database.php";
require_once "../models/news.php";
$link = db_connect();
$article = news_get($link, $_GET["id"]);
if (count($article) > 0) {
    include "../views/adminnew.php";
} else {
    echo "404 not found";
    //TODO: сюда можно сделать красивую страничку ошибки через include
}
Exemple #4
0
<!DOCTYPE html>
<?php 
require_once "../database.php";
require_once "../models/functions.php";
$link = db_connect();
$news = news_get($link, $_GET['id']);
?>
<html>
	<head>
		<meta charset="utf-8">
		<title>IntelArt - Городской конкурс мультимедиа проектов - <?php 
echo $news['title'];
?>
</title>
		<!--[if lt IE 9]>
		<script>
			var e = ("article,aside,figcaption,figure,footer,header,hgroup,nav,section,time").split(',');
			for (var i = 0; i < e.length; i++) 
			{
			document.createElement(e[i]);
			}
		</script>
		<![endif]-->
		<link rel="icon" type="image/png" href="../image/favicon.png">
		<link rel="stylesheet" href="../style.css">
		<link rel="stylesheet" href="../about.css">
	</head>
	<body class='background'>
		<header>
		<a href='../index.php'><img class='icon' src='../image/logo.png'></a>
		</header>