getParsedBodyParam('db'); $label = $request->getParsedBodyParam('label'); $bookmarkQuery = $request->getParsedBodyParam('bookmark_query'); $shared = $request->getParsedBodyParam('shared'); if (! is_string($label) || ! is_string($db) || ! is_string($bookmarkQuery) || ! is_string($shared)) { $this->response->addJSON('message', __('Incomplete params')); return; } $bookmarkFields = [ 'bkm_database' => $db, 'bkm_user' => $GLOBALS['cfg']['Server']['user'], 'bkm_sql_query' => $bookmarkQuery, 'bkm_label' => $label, ]; $bookmark = Bookmark::createBookmark($this->dbi, $bookmarkFields, $shared === 'true'); if ($bookmark === false || ! $bookmark->save()) { $this->response->addJSON('message', __('Failed')); return; } $this->response->addJSON('message', __('Succeeded')); $this->response->addJSON('data', $bookmarkFields); $this->response->addJSON('isShared', $shared === 'true'); } }