public function executeCreate() { $title = mfwRequest::param('title'); $data = mfwRequest::param('icon-data'); $description = mfwRequest::param('description'); $repository = mfwRequest::param('repository'); if (!$title || !preg_match('/^data:[^;]+;base64,(.+)$/', $data, $match)) { error_log(__METHOD__ . '(' . __LINE__ . "): bad request: {$title}, " . substr($data, 0, 30)); return $this->response(self::HTTP_400_BADREQUEST); } $image = base64_decode($match[1]); $con = mfwDBConnection::getPDO(); $con->beginTransaction(); try { $app = ApplicationDb::insertNewApp($this->login_user, $title, $image, $description, $repository); $con->commit(); } catch (Exception $e) { error_log(__METHOD__ . '(' . __LINE__ . '): ' . get_class($e) . ":{$e->getMessage()}"); $con->rollback(); throw $e; } apache_log('app_id', $app->getId()); return $this->redirect("/app?id={$app->getId()}"); }