Example #1
0
<?php

require_once __DIR__ . '/../classes/AbstractModel.php';
require_once __DIR__ . '/../classes/DB.php';
require_once __DIR__ . '/../models/News.php';
$title = $_POST['title'];
$text = $_POST['txt'];
News::add($title, $text);
//echo $title . ' - ' . $text;
Example #2
0
{
    private $logging;
    public function __construct()
    {
        parent::__construct('neo');
        $this->logging = new Logging('/tmp/news.log');
    }
    public function __destruct()
    {
        $this->logging->debug('news->get permission denied!!!');
        $this->logging->close();
    }
    public function add()
    {
        if (!$this->is_allowed(__CLASS__, __FUNCTION__)) {
            return;
        }
        print "Allowed!!! \r\n";
        $this->logging->info('news->add ok');
    }
    public function get()
    {
        if ($this->is_denied(__CLASS__, __FUNCTION__)) {
            print "Denied!!! \r\n";
            $this->logging->warning('news->get permission denied!!!');
        }
    }
}
$news = new News();
$news->add();
$news->get();
Example #3
0
    $descrizione_ita = $_POST["descrizione_ita"];
    $titolo_ted = $_POST["titolo_ted"];
    $abstract_ted = $_POST["abstract_ted"];
    $descrizione_ted = $_POST["descrizione_ted"];
    if ($_POST["date"] != "") {
        list($gg, $mm, $aa) = explode("/", $_POST["date"]);
        $data = $aa . "-" . $mm . "-" . $gg;
    }
    if (isset($_POST["home"]) and $_POST["home"] == "t") {
        $home = "t";
    } else {
        $home = "f";
    }
    $news = new News();
    if (isset($_POST["insert"]) and $_POST["insert"] == "si") {
        $news->add($data, $link, $titolo, $abstract, $descrizione, $titolo_ita, $abstract_ita, $descrizione_ita, $titolo_ted, $abstract_ted, $descrizione_ted, $home);
        //recupero l'ultimo id inserito
        $db = new Db();
        $id = $db->get_last_id();
    } elseif (isset($_POST["update"]) and $_POST["update"] == "si") {
        $id = aggiusta_post($_GET["id"]);
        $news->update($id, $data, $link, $titolo, $abstract, $descrizione, $titolo_ita, $abstract_ita, $descrizione_ita, $titolo_ted, $abstract_ted, $descrizione_ted, $home);
        //upload dei file
        update_file("news", "news_dettaglio.php?errore=file&id=" . $id, $id);
    }
    print "<script language='Javascript'>window.location.replace('news_dettaglio.php?id=" . $id . "&ins=si');</script>";
}
$data = date("d") . "/" . date("m") . "/" . date("Y");
$link = "";
$titolo = "";
$abstract = "";
Example #4
0
<?php

require '..' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'bootstrap.config.php';
$Stock_Company_Id = 5;
$News_Info = "This is a Fake news which increases stock prices.";
/*
 *	Give the percent change the news will have on the stock's current price
 */
$price_change_in_percent = 20;
/*
 *	Enter the live date and time when you want to release the news!
 */
//Type hour in 00-23 format
$hour = 3;
//Type Min in 00-59 format
$min = 34;
//Type day in 1-31 format
$day = 12;
$timestamp = mktime($hour, $min, 0, 2, $day, 2016);
$news_go_live_date = strftime("%Y-%m-%d %H:%M:%S", $timestamp);
News::add($Stock_Company_Id, $News_Info, $price_change_in_percent, $news_go_live_date);