diff options
Diffstat (limited to 'apps/bookmarks/ajax')
-rw-r--r-- | apps/bookmarks/ajax/addBookmark.php | 10 | ||||
-rw-r--r-- | apps/bookmarks/ajax/delBookmark.php | 10 | ||||
-rw-r--r-- | apps/bookmarks/ajax/editBookmark.php | 8 | ||||
-rw-r--r-- | apps/bookmarks/ajax/getMeta.php | 10 | ||||
-rw-r--r-- | apps/bookmarks/ajax/recordClick.php | 6 | ||||
-rw-r--r-- | apps/bookmarks/ajax/updateList.php | 10 |
6 files changed, 10 insertions, 44 deletions
diff --git a/apps/bookmarks/ajax/addBookmark.php b/apps/bookmarks/ajax/addBookmark.php index 7cf5baa4a6e..9b0beb388a0 100644 --- a/apps/bookmarks/ajax/addBookmark.php +++ b/apps/bookmarks/ajax/addBookmark.php @@ -26,14 +26,8 @@ $RUNTIME_NOSETUPFS=true; require_once('../../../lib/base.php'); -// We send json data -header( "Content-Type: application/jsonrequest" ); - // Check if we are a user -if( !OC_User::isLoggedIn()){ - echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); - exit(); -} +OC_JSON::checkLoggedIn(); $CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" ); if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){ @@ -76,6 +70,6 @@ if($b_id !== false) { $query->execute($params); } - echo json_encode( array( 'status' => 'success', 'data' => $b_id)); + OC_JSON::success(array('data' => $b_id)); } diff --git a/apps/bookmarks/ajax/delBookmark.php b/apps/bookmarks/ajax/delBookmark.php index bf1611fe5c1..afe60f7d1bf 100644 --- a/apps/bookmarks/ajax/delBookmark.php +++ b/apps/bookmarks/ajax/delBookmark.php @@ -26,14 +26,8 @@ $RUNTIME_NOSETUPFS=true; require_once('../../../lib/base.php'); -// We send json data -header( "Content-Type: application/jsonrequest" ); - // Check if we are a user -if( !OC_User::isLoggedIn()){ - echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); - exit(); -} +OC_JSON::checkLoggedIn(); $params=array( htmlspecialchars_decode($_GET["url"]), @@ -64,4 +58,4 @@ $query = OC_DB::prepare(" $result = $query->execute(); // var_dump($params); -echo json_encode( array( "status" => "success", "data" => array())); +OC_JSON::success(array('data' => array())); diff --git a/apps/bookmarks/ajax/editBookmark.php b/apps/bookmarks/ajax/editBookmark.php index 1bd2fc08bca..5125f9ce898 100644 --- a/apps/bookmarks/ajax/editBookmark.php +++ b/apps/bookmarks/ajax/editBookmark.php @@ -26,14 +26,8 @@ $RUNTIME_NOSETUPFS=true; require_once('../../../lib/base.php'); -// We send json data -header( 'Content-Type: application/jsonrequest' ); - // Check if we are a user -if( !OC_User::isLoggedIn()){ - echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => 'Authentication error' ))); - exit(); -} +OC_JSON::checkLoggedIn(); $CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" ); if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){ diff --git a/apps/bookmarks/ajax/getMeta.php b/apps/bookmarks/ajax/getMeta.php index e9fe0d684dc..4583ef204b4 100644 --- a/apps/bookmarks/ajax/getMeta.php +++ b/apps/bookmarks/ajax/getMeta.php @@ -26,14 +26,8 @@ $RUNTIME_NOSETUPFS=true; require_once('../../../lib/base.php'); -// We send json data -header( 'Content-Type: application/jsonrequest' ); - // Check if we are a user -if( !OC_User::isLoggedIn()){ - echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => 'Authentication error' ))); - exit(); -} +OC_JSON::checkLoggedIn(); // $metadata = array(); @@ -41,4 +35,4 @@ require '../bookmarksHelper.php'; $metadata = getURLMetadata(htmlspecialchars_decode($_GET["url"])); -echo json_encode( array( 'status' => 'success', 'data' => $metadata)); +OC_JSON::success(array('data' => $metadata)); diff --git a/apps/bookmarks/ajax/recordClick.php b/apps/bookmarks/ajax/recordClick.php index 116daea8bbb..f5f7c20c6a0 100644 --- a/apps/bookmarks/ajax/recordClick.php +++ b/apps/bookmarks/ajax/recordClick.php @@ -27,11 +27,7 @@ $RUNTIME_NOSETUPFS=true; require_once('../../../lib/base.php'); // Check if we are a user -if( !OC_User::isLoggedIn()){ - header( "Content-Type: application/jsonrequest" ); - echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); - exit(); -} +OC_JSON::checkLoggedIn(); $query = OC_DB::prepare(" UPDATE *PREFIX*bookmarks diff --git a/apps/bookmarks/ajax/updateList.php b/apps/bookmarks/ajax/updateList.php index e9051a8dbfa..de3480d6c3a 100644 --- a/apps/bookmarks/ajax/updateList.php +++ b/apps/bookmarks/ajax/updateList.php @@ -26,14 +26,8 @@ $RUNTIME_NOSETUPFS=true; require_once('../../../lib/base.php'); -// We send json data -header( 'Content-Type: application/jsonrequest' ); - // Check if we are a user -if( !OC_User::isLoggedIn()){ - echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => 'Authentication error' ))); - exit(); -} +OC_JSON::checkLoggedIn(); $params=array(OC_User::getUser()); $CONFIG_DBTYPE = OC_Config::getValue( 'dbtype', 'sqlite' ); @@ -85,4 +79,4 @@ $query = OC_DB::prepare(' $bookmarks = $query->execute($params)->fetchAll(); -echo json_encode( array( 'status' => 'success', 'data' => $bookmarks)); +OC_JSON::success(array('data' => $bookmarks)); |