Exemple #1
0
<?php

require_once "../database.php";
require_once "../models/news.php";
$page = 0;
$link = db_connect();
if (isset($_GET['page'])) {
    $page = $_GET['page'] - 1;
}
if (isset($_GET['action'])) {
    $action = $_GET['action'];
    if ($action == 'add') {
        if (!empty($_POST['submit'])) {
            news_add($link, $_POST['title'], $_POST['text'], $_POST['author']);
            header("Location: admin.php");
        } else {
            include "../views/admin_add.php";
        }
    } 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']);
<?php

# ---------------------------------------------------------------------
# rth is a requirement, test, and bugtracking system
# Copyright (C) 2005 George Holbrook - rth@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
#----------------------------------------------------------------------
# ------------------------------------
# New Add Action Page
#
# $RCSfile: news_add_action.php,v $ $Revision: 1.1.1.1 $
# ------------------------------------
include "./api/include_api.php";
auth_authenticate_user();
$redirect_page = 'home_page.php';
$edit_page = 'project_manage_page.php';
session_validate_form_set($_POST, $edit_page);
#### Call api function to add/update database passing in form field values ####
news_add($_POST['project_id'], session_validate_form_get_field('subject'), session_validate_form_get_field('body'), $_POST['poster']);
html_print_operation_successful('news_add_page', $redirect_page);
# ------------------------------------
# $Log: news_add_action.php,v $
# Revision 1.1.1.1  2005/11/30 23:00:57  gth2
# importing initial version - gth
#
# ------------------------------------
Exemple #3
0
<?php

include 'db_func.php';
if ($_POST) {
    news_add($_POST['catid'], $_POST['title'], $_POST['text']);
    header('Location:../view/news_add_form.php');
} else {
    echo 'Данные от пользователя не пришли или не корректны';
}
<!DOCTYPE html>
<?php 
require_once "../database.php";
require_once "../models/functions.php";
$link = db_connect();
$news = news_all($link);
if (isset($_GET['action'])) {
    $action = $_GET['action'];
} else {
    $action = "";
}
if ($action == "add") {
    if (!empty($_POST)) {
        news_add($link, $_POST['title'], $_POST['content'], $_FILES['icon']);
        header("Location: admin_news.php");
    }
} else {
    if ($action == "delete") {
        $id = $_GET['id'];
        $article = news_delete($link, $id);
        header("Location: admin_news.php");
    }
}
?>
<html>
<head>
	<title>Административная консоль - Новости</title>
	<meta charset="utf-8">
	<link rel="shortcut icon" href="favicon.png" type="image/png">
	<link rel='stylesheet' href='style.css'>
</head>
Exemple #5
0
<?php

include __DIR__ . "/model/news.php";
if (!empty($_POST["caption"]) && !empty($_POST["content"])) {
    news_add($_POST);
    header("Location: /www");
}
$news = news_getAll();
include __DIR__ . "/view/newslist.php";