function __construct() { AuthenticationHandler::getInstance(); if (!AuthenticationHandler::$data) { Go::to(); } $this->addScript('ShopLater'); $f = new Form('search'); $this->addForm('search', $f); $f = new Form('addEntry'); $this->addForm('addUrl', $f); $m = new ModelList(); $this->addContent('user_lists', $m->retrieveByUser(AuthenticationHandler::$data['id_user'], 5)); }
public function update() { if (!Core::checkRequiredGetVars('permalink_list', 'prop_list') || !isset($_POST) || empty($_POST) || !isset($_POST['value']) || empty($_POST['value'])) { Go::to404(); } $m = new ModelList(); $list = $m->one(Query::condition()->andWhere('permalink_list', Query::EQUAL, $_GET['permalink_list'])); if (!$list) { Go::to404(); } $name = $_GET['prop_list']; if ($m->updateById($list['id_list'], array($name => $_POST['value']))) { $response = array("message" => "ok"); } else { $response = array("error", "Unable to perform an update on field '" . $name . "'"); } $response = SimpleJSON::encode($response); Core::performResponse($response, 'json'); }