|
@@ 117-136 (lines=20) @@
|
| 114 |
|
* @NoAdminRequired |
| 115 |
|
* @NoCSRFRequired |
| 116 |
|
*/ |
| 117 |
|
public function returnAddAsJson($url = "", $tags = array(), $title = "", $description = "") |
| 118 |
|
{ |
| 119 |
|
$user = \OCP\User::getUser(); |
| 120 |
|
|
| 121 |
|
if ($tags[0] == "") { |
| 122 |
|
$tags = array(); |
| 123 |
|
} |
| 124 |
|
|
| 125 |
|
$output = Bookmarks::addBookmark($user, $this->db, $url, $title, $tags, $description, false); |
| 126 |
|
|
| 127 |
|
if (count($output) == 0) { |
| 128 |
|
$output["status"] = 'error'; |
| 129 |
|
$output["message"] = "No results from this query"; |
| 130 |
|
return new JSONResponse($output); |
| 131 |
|
} |
| 132 |
|
|
| 133 |
|
$output = Bookmarks::findUniqueBookmark($output, $user, $this->db); |
| 134 |
|
|
| 135 |
|
return new JSONResponse($output); |
| 136 |
|
} |
| 137 |
|
|
| 138 |
|
/** |
| 139 |
|
* @CORS |
|
@@ 143-162 (lines=20) @@
|
| 140 |
|
* @NoAdminRequired |
| 141 |
|
* @NoCSRFRequired |
| 142 |
|
*/ |
| 143 |
|
public function returnUpdateAsJson($id, $url = "", $tags = array(), $title = "", $description = "") |
| 144 |
|
{ |
| 145 |
|
$user = \OCP\User::getUser(); |
| 146 |
|
|
| 147 |
|
if ($tags[0] == "") { |
| 148 |
|
$tags = array(); |
| 149 |
|
} |
| 150 |
|
|
| 151 |
|
$output = Bookmarks::editBookmark($user, $this->db, $id, $url, $title, $tags, $description, false); |
| 152 |
|
|
| 153 |
|
if (count($output) == 0) { |
| 154 |
|
$output["status"] = 'error'; |
| 155 |
|
$output["message"] = "No results from this query"; |
| 156 |
|
return new JSONResponse($output); |
| 157 |
|
} |
| 158 |
|
|
| 159 |
|
$output = Bookmarks::findUniqueBookmark($output, $user, $this->db); |
| 160 |
|
|
| 161 |
|
return new JSONResponse($output); |
| 162 |
|
} |
| 163 |
|
|
| 164 |
|
/** |
| 165 |
|
* @CORS |