Example #1
0
 * @package Kiki
 * @author Rob Kaper <http://robkaper.nl/>
 * @copyright 2010-2011 Rob Kaper <http://robkaper.nl/>
 * @license Released under the terms of the MIT license.
 */
use Kiki\Article;
use Kiki\Album;
use Kiki\Router;
//  require_once "../../lib/init.php";
if ($_POST) {
    $article = new Article($_POST['articleId']);
    $errors = array();
    if (!$user->id()) {
        $errors[] = "Je bent niet ingelogd.";
    }
    $article->setSectionId($_POST['sectionId']);
    // In case of multiple authors who can proofread, amend: don't update unless empty.
    if (!$article->userId()) {
        $article->setUserId($user->id());
    }
    $article->setIpAddr($_SERVER['REMOTE_ADDR']);
    if (isset($_POST['ctime'])) {
        list($date, $time) = explode(" ", $_POST['ctime']);
        list($day, $month, $year) = explode("-", $date);
        $ctime = "{$year}-{$month}-{$day} {$time}";
        $article->setCtime($ctime);
    } else {
        $showAsPage = true;
    }
    if (isset($_POST['cname']) && !count($article->publications())) {
        // TODO: allow changing when publications exist: 301 redirect must be created somewhere in this case.