Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove \OCP\JSON #8943

Merged
merged 3 commits into from
Mar 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions apps/files/ajax/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
use OCP\Files\StorageNotAvailableException;
use OCP\Files\StorageInvalidException;

OCP\JSON::checkLoggedIn();
\OC_JSON::checkLoggedIn();
\OC::$server->getSession()->close();
$l = \OC::$server->getL10N('files');

Expand Down Expand Up @@ -79,26 +79,26 @@
$data['files'] = \OCA\Files\Helper::formatFileInfos($files);
$data['permissions'] = $permissions;

OCP\JSON::success(array('data' => $data));
\OC_JSON::success(array('data' => $data));
} catch (\OCP\Files\StorageNotAvailableException $e) {
\OC::$server->getLogger()->logException($e, ['app' => 'files']);
OCP\JSON::error([
\OC_JSON::error([
'data' => [
'exception' => StorageNotAvailableException::class,
'message' => $l->t('Storage is temporarily not available')
]
]);
} catch (\OCP\Files\StorageInvalidException $e) {
\OC::$server->getLogger()->logException($e, ['app' => 'files']);
OCP\JSON::error(array(
\OC_JSON::error(array(
'data' => array(
'exception' => StorageInvalidException::class,
'message' => $l->t('Storage invalid')
)
));
} catch (\Exception $e) {
\OC::$server->getLogger()->logException($e, ['app' => 'files']);
OCP\JSON::error(array(
\OC_JSON::error(array(
'data' => array(
'exception' => \Exception::class,
'message' => $l->t('Unknown error')
Expand Down
8 changes: 4 additions & 4 deletions apps/files_external/ajax/applicable.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
OCP\JSON::checkAppEnabled('files_external');
OCP\JSON::callCheck();
\OC_JSON::checkAppEnabled('files_external');
\OC_JSON::callCheck();

OCP\JSON::checkAdminUser();
\OC_JSON::checkAdminUser();

$pattern = '';
$limit = null;
Expand All @@ -51,4 +51,4 @@

$results = array('groups' => $groups, 'users' => $users);

\OCP\JSON::success($results);
\OC_JSON::success($results);
6 changes: 3 additions & 3 deletions apps/files_external/ajax/oauth2.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
OCP\JSON::checkAppEnabled('files_external');
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
\OC_JSON::checkAppEnabled('files_external');
\OC_JSON::checkLoggedIn();
\OC_JSON::callCheck();
$l = \OC::$server->getL10N('files_external');

// TODO: implement redirect to which storage backend requested this
8 changes: 4 additions & 4 deletions apps/files_trashbin/ajax/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
\OC_JSON::checkLoggedIn();
\OC_JSON::callCheck();
\OC::$server->getSession()->close();

$folder = isset($_POST['dir']) ? $_POST['dir'] : '/';
Expand Down Expand Up @@ -83,8 +83,8 @@
}
$l = \OC::$server->getL10N('files_trashbin');
$message = $l->t("Couldn't delete %s permanently", array(rtrim($filelist, ', ')));
OCP\JSON::error(array("data" => array("message" => $message,
\OC_JSON::error(array("data" => array("message" => $message,
"success" => $success, "error" => $error)));
} else {
OCP\JSON::success(array("data" => array("success" => $success)));
\OC_JSON::success(array("data" => array("success" => $success)));
}
6 changes: 3 additions & 3 deletions apps/files_trashbin/ajax/isEmpty.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
*
*/

OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
\OC_JSON::checkLoggedIn();
\OC_JSON::callCheck();
\OC::$server->getSession()->close();

$trashStatus = OCA\Files_Trashbin\Trashbin::isEmpty(OCP\User::getUser());

OCP\JSON::success(array("data" => array("isEmpty" => $trashStatus)));
\OC_JSON::success(array("data" => array("isEmpty" => $trashStatus)));


4 changes: 2 additions & 2 deletions apps/files_trashbin/ajax/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
OCP\JSON::checkLoggedIn();
\OC_JSON::checkLoggedIn();
\OC::$server->getSession()->close();

// Load the files
Expand All @@ -44,5 +44,5 @@
$data['directory'] = $dir;
$data['files'] = \OCA\Files_Trashbin\Helper::formatFileInfos($files);

OCP\JSON::success(array('data' => $data));
\OC_JSON::success(array('data' => $data));

8 changes: 4 additions & 4 deletions apps/files_trashbin/ajax/undelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
\OC_JSON::checkLoggedIn();
\OC_JSON::callCheck();
\OC::$server->getSession()->close();

$dir = '/';
Expand Down Expand Up @@ -88,8 +88,8 @@
}
$l = OC::$server->getL10N('files_trashbin');
$message = $l->t("Couldn't restore %s", array(rtrim($filelist, ', ')));
OCP\JSON::error(array("data" => array("message" => $message,
\OC_JSON::error(array("data" => array("message" => $message,
"success" => $success, "error" => $error)));
} else {
OCP\JSON::success(array("data" => array("success" => $success)));
\OC_JSON::success(array("data" => array("success" => $success)));
}
10 changes: 5 additions & 5 deletions apps/files_versions/ajax/getVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
OCP\JSON::checkAppEnabled('files_versions');
\OC_JSON::checkLoggedIn();
\OC_JSON::callCheck();
\OC_JSON::checkAppEnabled('files_versions');

$source = (string)$_GET['source'];
$start = (int)$_GET['start'];
Expand All @@ -47,10 +47,10 @@
unset($version['path']);
}

\OCP\JSON::success(array('data' => array('versions' => $versions, 'endReached' => $endReached)));
\OC_JSON::success(array('data' => array('versions' => $versions, 'endReached' => $endReached)));

} else {

\OCP\JSON::success(array('data' => array('versions' => [], 'endReached' => true)));
\OC_JSON::success(array('data' => array('versions' => [], 'endReached' => true)));

}
10 changes: 5 additions & 5 deletions apps/files_versions/ajax/rollbackVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('files_versions');
OCP\JSON::callCheck();
\OC_JSON::checkLoggedIn();
\OC_JSON::checkAppEnabled('files_versions');
\OC_JSON::callCheck();

$file = (string)$_GET['file'];
$revision=(int)$_GET['revision'];

if(OCA\Files_Versions\Storage::rollback( $file, $revision )) {
OCP\JSON::success(array("data" => array( "revision" => $revision, "file" => $file )));
\OC_JSON::success(array("data" => array( "revision" => $revision, "file" => $file )));
}else{
$l = \OC::$server->getL10N('files_versions');
OCP\JSON::error(array("data" => array( "message" => $l->t("Could not revert: %s", array($file) ))));
\OC_JSON::error(array("data" => array( "message" => $l->t("Could not revert: %s", array($file) ))));
}
4 changes: 2 additions & 2 deletions apps/files_versions/download.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
*
*/

OCP\JSON::checkAppEnabled('files_versions');
OCP\JSON::checkLoggedIn();
\OC_JSON::checkAppEnabled('files_versions');
\OC_JSON::checkLoggedIn();

$file = $_GET['file'];
$revision=(int)$_GET['revision'];
Expand Down
10 changes: 5 additions & 5 deletions apps/user_ldap/ajax/clearMappings.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
use OCA\User_LDAP\Mapping\GroupMapping;

// Check user and app status
OCP\JSON::checkAdminUser();
OCP\JSON::checkAppEnabled('user_ldap');
OCP\JSON::callCheck();
\OC_JSON::checkAdminUser();
\OC_JSON::checkAppEnabled('user_ldap');
\OC_JSON::callCheck();

$subject = (string)$_POST['ldap_clear_mapping'];
$mapping = null;
Expand All @@ -43,7 +43,7 @@
$l = \OC::$server->getL10N('user_ldap');
throw new \Exception($l->t('Failed to clear the mappings.'));
}
OCP\JSON::success();
\OC_JSON::success();
} catch (\Exception $e) {
OCP\JSON::error(array('message' => $e->getMessage()));
\OC_JSON::error(array('message' => $e->getMessage()));
}
10 changes: 5 additions & 5 deletions apps/user_ldap/ajax/deleteConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
*/

// Check user and app status
OCP\JSON::checkAdminUser();
OCP\JSON::checkAppEnabled('user_ldap');
OCP\JSON::callCheck();
\OC_JSON::checkAdminUser();
\OC_JSON::checkAppEnabled('user_ldap');
\OC_JSON::callCheck();

$prefix = (string)$_POST['ldap_serverconfig_chooser'];
$helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
if($helper->deleteServerConfiguration($prefix)) {
OCP\JSON::success();
\OC_JSON::success();
} else {
$l = \OC::$server->getL10N('user_ldap');
OCP\JSON::error(array('message' => $l->t('Failed to delete the server configuration')));
\OC_JSON::error(array('message' => $l->t('Failed to delete the server configuration')));
}
8 changes: 4 additions & 4 deletions apps/user_ldap/ajax/getConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
*/

// Check user and app status
OCP\JSON::checkAdminUser();
OCP\JSON::checkAppEnabled('user_ldap');
OCP\JSON::callCheck();
\OC_JSON::checkAdminUser();
\OC_JSON::checkAppEnabled('user_ldap');
\OC_JSON::callCheck();

$prefix = (string)$_POST['ldap_serverconfig_chooser'];
$ldapWrapper = new OCA\User_LDAP\LDAP();
Expand All @@ -37,4 +37,4 @@
// hide password
$configuration['ldap_agent_password'] = '**PASSWORD SET**';
}
OCP\JSON::success(array('configuration' => $configuration));
\OC_JSON::success(array('configuration' => $configuration));
8 changes: 4 additions & 4 deletions apps/user_ldap/ajax/getNewServerConfigPrefix.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
*/

// Check user and app status
OCP\JSON::checkAdminUser();
OCP\JSON::checkAppEnabled('user_ldap');
OCP\JSON::callCheck();
\OC_JSON::checkAdminUser();
\OC_JSON::checkAppEnabled('user_ldap');
\OC_JSON::callCheck();

$helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
$serverConnections = $helper->getServerConfigurationPrefixes();
Expand All @@ -48,4 +48,4 @@
}
$newConfig->saveConfiguration();

OCP\JSON::success($resultData);
\OC_JSON::success($resultData);
8 changes: 4 additions & 4 deletions apps/user_ldap/ajax/setConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
*/

// Check user and app status
OCP\JSON::checkAdminUser();
OCP\JSON::checkAppEnabled('user_ldap');
OCP\JSON::callCheck();
\OC_JSON::checkAdminUser();
\OC_JSON::checkAppEnabled('user_ldap');
\OC_JSON::callCheck();

$prefix = (string)$_POST['ldap_serverconfig_chooser'];

Expand All @@ -47,4 +47,4 @@
$connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix);
$connection->setConfiguration($_POST);
$connection->saveConfiguration();
OCP\JSON::success();
\OC_JSON::success();
16 changes: 8 additions & 8 deletions apps/user_ldap/ajax/testConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
*/

// Check user and app status
OCP\JSON::checkAdminUser();
OCP\JSON::checkAppEnabled('user_ldap');
OCP\JSON::callCheck();
\OC_JSON::checkAdminUser();
\OC_JSON::checkAppEnabled('user_ldap');
\OC_JSON::callCheck();

$l = \OC::$server->getL10N('user_ldap');

Expand Down Expand Up @@ -69,20 +69,20 @@
$ldapWrapper->read($connection->getConnectionResource(), '', 'objectClass=*', array('dn'));
} catch (\Exception $e) {
if($e->getCode() === 1) {
OCP\JSON::error(array('message' => $l->t('Invalid configuration: Anonymous binding is not allowed.')));
\OC_JSON::error(array('message' => $l->t('Invalid configuration: Anonymous binding is not allowed.')));
exit;
}
}
OCP\JSON::success(array('message'
\OC_JSON::success(array('message'
=> $l->t('Valid configuration, connection established!')));
} else {
OCP\JSON::error(array('message'
\OC_JSON::error(array('message'
=> $l->t('Valid configuration, but binding failed. Please check the server settings and credentials.')));
}
} else {
OCP\JSON::error(array('message'
\OC_JSON::error(array('message'
=> $l->t('Invalid configuration. Please have a look at the logs for further details.')));
}
} catch (\Exception $e) {
OCP\JSON::error(array('message' => $e->getMessage()));
\OC_JSON::error(array('message' => $e->getMessage()));
}
Loading