Пример #1
0
<?php

namespace ATPComic\Model;

require_once "Arc.php";
class Commentary extends \ATP\ActiveRecord
{
    public function __construct()
    {
        parent::__construct();
        //Necessary to make sure the admin user class is loaded
        $user = new \ATPAdmin\Model\User();
    }
    public function displayName()
    {
        return "'" . $this->title . "' for '" . $this->page->title . "' by " . $this->user->username;
    }
}
Commentary::init();
Пример #2
0
    } else {
        $result["success"] = false;
    }
    echo json_encode($result);
});
$app->put('/commentary', function () {
    $request = \Slim\Slim::getInstance()->request();
    $commentary = json_decode($request->getBody());
    $commentaryDAO = new Commentary();
    $commentaryDAO->update($commentary);
    echo '{"result":"ok"}';
});
$app->delete('/commentary', function () {
    $request = \Slim\Slim::getInstance()->request();
    $commentary = json_decode($request->getBody());
    $commentaryDAO = new Commentary();
    $commentaryDAO->delete($commentary);
    echo '{"result":"ok"}';
});
$app->post('/picture/getbyplace', function () {
    $request = \Slim\Slim::getInstance()->request();
    //$picture = json_decode($request->getBody());
    $picture = json_decode($_POST["json"]);
    $pictureDAO = new Picture();
    //$pictureDAO->getByPlace($picture);
    //echo '{"result":"ok"}';
    $result = $pictureDAO->getByPlace($picture);
    echo json_encode(array("pictures" => $result));
});
$app->post('/picture/send', function () {
    $request = \Slim\Slim::getInstance()->request();