本文整理汇总了PHP中OCP\JSON类的典型用法代码示例。如果您正苦于以下问题:PHP JSON类的具体用法?PHP JSON怎么用?PHP JSON使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JSON类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: preDispatchGuest
/**
* Do security precheck for not logged in users
* @param bool callcheck - whether security token check is needed
*/
public static function preDispatchGuest($callcheck = true)
{
if ($callcheck) {
\OCP\JSON::callCheck();
}
\OCP\JSON::checkAppEnabled('documents');
}
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:11,代码来源:controller.php
示例2: Add
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function Add()
{
\OCP\JSON::setContentTypeHeader('application/json');
if (isset($_POST['FILE']) && strlen($_POST['FILE']) > 0 && Tools::CheckURL($_POST['FILE']) && isset($_POST['OPTIONS'])) {
try {
$Target = Tools::CleanString(substr($_POST['FILE'], strrpos($_POST['FILE'], '/') + 1));
// If target file exists, create a new one
if (\OC\Files\Filesystem::file_exists($this->DownloadsFolder . '/' . $Target)) {
$Target = time() . '_' . $Target;
}
// Create the target file if the downloader is Aria2
if ($this->WhichDownloader == 0) {
\OC\Files\Filesystem::touch($this->DownloadsFolder . '/' . $Target);
} else {
if (!\OC\Files\Filesystem::is_dir($this->DownloadsFolder)) {
\OC\Files\Filesystem::mkdir($this->DownloadsFolder);
}
}
// Build OPTIONS array
$OPTIONS = array('dir' => $this->AbsoluteDownloadsFolder, 'out' => $Target, 'follow-torrent' => false);
if (isset($_POST['OPTIONS']['FTPUser']) && strlen(trim($_POST['OPTIONS']['FTPUser'])) > 0 && isset($_POST['OPTIONS']['FTPPasswd']) && strlen(trim($_POST['OPTIONS']['FTPPasswd'])) > 0) {
$OPTIONS['ftp-user'] = $_POST['OPTIONS']['FTPUser'];
$OPTIONS['ftp-passwd'] = $_POST['OPTIONS']['FTPPasswd'];
}
if (isset($_POST['OPTIONS']['FTPPasv']) && strlen(trim($_POST['OPTIONS']['FTPPasv'])) > 0) {
$OPTIONS['ftp-pasv'] = strcmp($_POST['OPTIONS']['FTPPasv'], "true") == 0 ? true : false;
}
if (!$this->ProxyOnlyWithYTDL && !is_null($this->ProxyAddress) && $this->ProxyPort > 0 && $this->ProxyPort <= 65536) {
$OPTIONS['all-proxy'] = rtrim($this->ProxyAddress, '/') . ':' . $this->ProxyPort;
if (!is_null($this->ProxyUser) && !is_null($this->ProxyPasswd)) {
$OPTIONS['all-proxy-user'] = $this->ProxyUser;
$OPTIONS['all-proxy-passwd'] = $this->ProxyPasswd;
}
}
$AddURI = $this->WhichDownloader == 0 ? Aria2::AddUri(array($_POST['FILE']), array('Params' => $OPTIONS)) : CURL::AddUri($_POST['FILE'], $OPTIONS);
if (isset($AddURI['result']) && !is_null($AddURI['result'])) {
$SQL = 'INSERT INTO `*PREFIX*ocdownloader_queue` (`UID`, `GID`, `FILENAME`, `PROTOCOL`, `STATUS`, `TIMESTAMP`) VALUES (?, ?, ?, ?, ?, ?)';
if ($this->DbType == 1) {
$SQL = 'INSERT INTO *PREFIX*ocdownloader_queue ("UID", "GID", "FILENAME", "PROTOCOL", "STATUS", "TIMESTAMP") VALUES (?, ?, ?, ?, ?, ?)';
}
$Query = \OCP\DB::prepare($SQL);
$Result = $Query->execute(array($this->CurrentUID, $AddURI['result'], $Target, strtoupper(substr($_POST['FILE'], 0, strpos($_POST['FILE'], ':'))), 1, time()));
sleep(1);
$Status = $this->WhichDownloader == 0 ? Aria2::TellStatus($AddURI['result']) : CURL::TellStatus($AddURI['result']);
$Progress = 0;
if ($Status['result']['totalLength'] > 0) {
$Progress = $Status['result']['completedLength'] / $Status['result']['totalLength'];
}
$ProgressString = Tools::GetProgressString($Status['result']['completedLength'], $Status['result']['totalLength'], $Progress);
return new JSONResponse(array('ERROR' => false, 'MESSAGE' => (string) $this->L10N->t('Download started'), 'GID' => $AddURI['result'], 'PROGRESSVAL' => round($Progress * 100, 2) . '%', 'PROGRESS' => is_null($ProgressString) ? (string) $this->L10N->t('N/A') : $ProgressString, 'STATUS' => isset($Status['result']['status']) ? (string) $this->L10N->t(ucfirst($Status['result']['status'])) : (string) $this->L10N->t('N/A'), 'STATUSID' => Tools::GetDownloadStatusID($Status['result']['status']), 'SPEED' => isset($Status['result']['downloadSpeed']) ? Tools::FormatSizeUnits($Status['result']['downloadSpeed']) . '/s' : (string) $this->L10N->t('N/A'), 'FILENAME' => strlen($Target) > 40 ? substr($Target, 0, 40) . '...' : $Target, 'PROTO' => strtoupper(substr($_POST['FILE'], 0, strpos($_POST['FILE'], ':'))), 'ISTORRENT' => false));
} else {
return new JSONResponse(array('ERROR' => true, 'MESSAGE' => (string) $this->L10N->t($this->WhichDownloader == 0 ? 'Returned GID is null ! Is Aria2c running as a daemon ?' : 'An error occurred while running the CURL download')));
}
} catch (Exception $E) {
return new JSONResponse(array('ERROR' => true, 'MESSAGE' => $E->getMessage()));
}
} else {
return new JSONResponse(array('ERROR' => true, 'MESSAGE' => (string) $this->L10N->t('Please check the URL you\'ve just provided')));
}
}
开发者ID:samosito,项目名称:ocdownloader,代码行数:64,代码来源:ftpdownloader.php
示例3: exportEvents
/**
*@PublicPage
* @NoCSRFRequired
*
*/
public function exportEvents()
{
$token = $this->params('t');
$calid = null;
$eventid = null;
if (isset($token)) {
$linkItem = \OCP\Share::getShareByToken($token, false);
if (is_array($linkItem) && isset($linkItem['uid_owner'])) {
$rootLinkItem = \OCP\Share::resolveReShare($linkItem);
if (isset($rootLinkItem['uid_owner'])) {
\OCP\JSON::checkUserExists($rootLinkItem['uid_owner']);
if ($linkItem['item_type'] === CalendarApp::SHARECALENDAR) {
$sPrefix = CalendarApp::SHARECALENDARPREFIX;
}
if ($linkItem['item_type'] === CalendarApp::SHAREEVENT) {
$sPrefix = CalendarApp::SHAREEVENTPREFIX;
}
if ($linkItem['item_type'] === CalendarApp::SHARETODO) {
$sPrefix = CalendarApp::SHARETODOPREFIX;
}
$itemSource = CalendarApp::validateItemSource($linkItem['item_source'], $sPrefix);
if ($linkItem['item_type'] === CalendarApp::SHARECALENDAR) {
$calid = $itemSource;
}
if ($linkItem['item_type'] === CalendarApp::SHAREEVENT || $linkItem['item_type'] === CalendarApp::SHARETODO) {
$eventid = $itemSource;
}
}
}
} else {
if (\OCP\User::isLoggedIn()) {
$calid = $this->params('calid');
$eventid = $this->params('eventid');
}
}
if (!is_null($calid)) {
$calendar = CalendarApp::getCalendar($calid, true);
if (!$calendar) {
$params = ['status' => 'error'];
$response = new JSONResponse($params);
return $response;
}
$name = str_replace(' ', '_', $calendar['displayname']) . '.ics';
$calendarEvents = Export::export($calid, Export::CALENDAR);
$response = new DataDownloadResponse($calendarEvents, $name, 'text/calendar');
return $response;
}
if (!is_null($eventid)) {
$data = CalendarApp::getEventObject($eventid, false);
if (!$data) {
$params = ['status' => 'error'];
$response = new JSONResponse($params);
return $response;
}
$name = str_replace(' ', '_', $data['summary']) . '.ics';
$singleEvent = Export::export($eventid, Export::EVENT);
$response = new DataDownloadResponse($singleEvent, $name, 'text/calendar');
return $response;
}
}
开发者ID:Bullnados,项目名称:calendarplus,代码行数:65,代码来源:exportcontroller.php
示例4: initAjaxController
public static function initAjaxController()
{
\OCP\JSON::checkLoggedIn();
\OCP\JSON::callCheck();
\OCP\JSON::checkAppEnabled('contacts');
\OCP\JSON::checkAppEnabled(self::APP_ID);
}
开发者ID:seanbradley28,项目名称:gsync,代码行数:7,代码来源:app.php
示例5: render
/**
* Returns the rendered json
* @return the rendered json
*/
public function render()
{
parent::render();
ob_start();
if ($this->error) {
\OCP\JSON::error($this->data);
} else {
\OCP\JSON::success($this->data);
}
$result = ob_get_contents();
ob_end_clean();
return $result;
}
开发者ID:nanowish,项目名称:apps,代码行数:17,代码来源:json.response.php
示例6: runChecks
/**
* Runs all security checks
*/
public function runChecks()
{
if ($this->csrfCheck) {
\OCP\JSON::callCheck();
}
if ($this->loggedInCheck) {
\OCP\JSON::checkLoggedIn();
}
if ($this->appEnabledCheck) {
\OCP\JSON::checkAppEnabled($this->appName);
}
if ($this->isAdminCheck) {
\OCP\User::checkAdminUser();
}
}
开发者ID:noldmess,项目名称:apps,代码行数:18,代码来源:security.php
示例7: postlogin_hook
/**
* Send JSON response on successful login
* @param String $uid
*/
public static function postlogin_hook($uid)
{
if (!self::$_isPersona) {
return;
}
\OCP\Util::writeLog(App::APP_ID, 'Check ambigous ', \OCP\Util::DEBUG);
if (self::$_isAmbigous) {
//Reply with error and logout
\OCP\User::logout();
\OCP\JSON::error(array('msg' => 'More than one user found'));
exit;
} else {
\OCP\JSON::success(array('msg' => 'Access granted'));
exit;
}
}
开发者ID:DOM-Digital-Online-Media,项目名称:apps,代码行数:20,代码来源:validator.php
示例8: Check
/**
* @AdminRequired
* @NoCSRFRequired
*/
public function Check()
{
\OCP\JSON::setContentTypeHeader('application/json');
if ($this->Allow) {
try {
$LastVersionNumber = Tools::GetLastVersionNumber();
$AppVersion = \OCP\App::getAppVersion('ocdownloader');
$Response = array('ERROR' => false, 'RESULT' => version_compare($AppVersion, $LastVersionNumber, '<'));
} catch (Exception $E) {
$Response = array('ERROR' => true, 'MESSAGE' => (string) $this->L10N->t('Error while checking application version on GitHub'));
}
} else {
$Response = array('ERROR' => true, 'MESSAGE' => (string) $this->L10N->t('You are not allowed to check for application updates'));
}
return new JSONResponse($Response);
}
开发者ID:venjek,项目名称:ocdownloader,代码行数:20,代码来源:updater.php
示例9: invite
/**
* Invite users to the editing session
*/
public static function invite()
{
self::preDispatch();
$invitees = @$_POST['users'];
if (is_array($invitees)) {
$invitees = array_unique($invitees);
$esId = @$_POST['esId'];
foreach ($invitees as $userId) {
try {
Invite::add($esId, $userId);
} catch (\Exception $e) {
}
}
}
\OCP\JSON::success();
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:19,代码来源:userController.php
示例10: setupFromToken
/**
* Sets up the filesystem and user for public sharing
* @param string $token string share token
* @param string $relativePath optional path relative to the share
* @param string $password optional password
*/
public static function setupFromToken($token, $relativePath = null, $password = null)
{
\OC_User::setIncognitoMode(true);
$linkItem = \OCP\Share::getShareByToken($token, !$password);
if ($linkItem === false || $linkItem['item_type'] !== 'file' && $linkItem['item_type'] !== 'folder') {
\OC_Response::setStatus(404);
\OC_Log::write('core-preview', 'Passed token parameter is not valid', \OC_Log::DEBUG);
exit;
}
if (!isset($linkItem['uid_owner']) || !isset($linkItem['file_source'])) {
\OC_Response::setStatus(500);
\OC_Log::write('core-preview', 'Passed token seems to be valid, but it does not contain all necessary information . ("' . $token . '")', \OC_Log::WARN);
exit;
}
$rootLinkItem = \OCP\Share::resolveReShare($linkItem);
$path = null;
if (isset($rootLinkItem['uid_owner'])) {
\OCP\JSON::checkUserExists($rootLinkItem['uid_owner']);
\OC_Util::tearDownFS();
\OC_Util::setupFS($rootLinkItem['uid_owner']);
$path = \OC\Files\Filesystem::getPath($linkItem['file_source']);
}
if ($path === null) {
\OCP\Util::writeLog('share', 'could not resolve linkItem', \OCP\Util::DEBUG);
\OC_Response::setStatus(404);
\OCP\JSON::error(array('success' => false));
exit;
}
if (!isset($linkItem['item_type'])) {
\OCP\Util::writeLog('share', 'No item type set for share id: ' . $linkItem['id'], \OCP\Util::ERROR);
\OC_Response::setStatus(404);
\OCP\JSON::error(array('success' => false));
exit;
}
if (isset($linkItem['share_with'])) {
if (!self::authenticate($linkItem, $password)) {
\OC_Response::setStatus(403);
\OCP\JSON::error(array('success' => false));
exit;
}
}
$basePath = $path;
if ($relativePath !== null && \OC\Files\Filesystem::isReadable($basePath . $relativePath)) {
$path .= \OC\Files\Filesystem::normalizePath($relativePath);
}
return array('linkItem' => $linkItem, 'basePath' => $basePath, 'realPath' => $path);
}
开发者ID:olucao,项目名称:owncloud-core,代码行数:53,代码来源:helper.php
示例11: rename
public static function rename($args)
{
self::preDispatchGuest();
$memberId = Helper::getArrayValueByKey($args, 'member_id');
$name = Helper::getArrayValueByKey($_POST, 'name');
$member = new Db\Member();
$member->load($memberId);
if ($member->getEsId() && $member->getStatus() == Db\Member::MEMBER_STATUS_ACTIVE && $member->getIsGuest()) {
$guestMark = Db\Member::getGuestPostfix();
if (substr($name, -strlen($guestMark)) !== $guestMark) {
$name = $name . ' ' . $guestMark;
}
$op = new Db\Op();
$op->changeNick($member->getEsId(), $memberId, $name);
}
\OCP\JSON::success();
}
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:17,代码来源:userController.php
示例12: __construct
public function __construct($AppName, IRequest $request, $UserId)
{
parent::__construct($AppName, $request);
$this->userId = $UserId;
$path = self::PROJECTKIT_PREFIX . DIRECTORY_SEPARATOR;
if (isset($_GET['containerId'])) {
$path .= self::PROJECT_PREFIX . (string) $_GET['containerId'] . DIRECTORY_SEPARATOR;
if (isset($_GET['targetType']) && isset($_GET['targetId'])) {
switch ($_GET['targetType']) {
case TargetType::TASK:
$path .= self::TASK_PREFIX;
break;
case TargetType::ISSUE:
$path .= self::ISSUE_PREFIX;
break;
default:
break;
}
$path .= (string) $_GET['targetId'] . DIRECTORY_SEPARATOR;
$_SESSION['targetType'] = $_GET['targetType'];
} elseif (!isset($_GET['targetType']) && !isset($_GET['targetId'])) {
$_SESSION['targetType'] = TargetType::PROJECT;
}
//use session to save targetType
$path = Filesystem::normalizePath($path);
//Create folder for path
if (!Filesystem::file_exists($path)) {
try {
Filesystem::mkdir($path);
} catch (\Exception $e) {
$result = ['success' => false, 'data' => ['message' => $e->getMessage()]];
\OCP\JSON::error($result);
exit;
}
}
if (!isset($_GET['dir'])) {
$params = array_merge($_GET, ["dir" => $path]);
$url = $_SERVER['PHP_SELF'] . '?' . http_build_query($params);
header('Location: ' . $url, true, 302);
exit;
}
}
}
开发者ID:fproject,项目名称:apps,代码行数:43,代码来源:pagecontroller.php
示例13: av_scan
public static function av_scan($path)
{
$path = $path[\OC\Files\Filesystem::signal_param_path];
if ($path != '') {
if (isset($_POST['dirToken'])) {
//Public upload case
$filesView = \OC\Files\Filesystem::getView();
} else {
$filesView = \OCP\Files::getStorage("files");
}
if (!is_object($filesView)) {
\OCP\Util::writeLog('files_antivirus', 'Can\'t init filesystem view', \OCP\Util::WARN);
return;
}
// check if path is a directory
if ($filesView->is_dir($path)) {
return;
}
// we should have a file to work with, and the file shouldn't
// be empty
$fileExists = $filesView->file_exists($path);
if ($fileExists && $filesView->filesize($path) > 0) {
$fileStatus = self::scanFile($filesView, $path);
$result = $fileStatus->getNumericStatus();
switch ($result) {
case Status::SCANRESULT_UNCHECKED:
//TODO: Show warning to the user: The file can not be checked
break;
case Status::SCANRESULT_INFECTED:
//remove file
$filesView->unlink($path);
Notification::sendMail($path);
$message = \OCP\Util::getL10N('files_antivirus')->t("Virus detected! Can't upload the file %s", array(basename($path)));
\OCP\JSON::error(array("data" => array("message" => $message)));
exit;
break;
case Status::SCANRESULT_CLEAN:
//do nothing
break;
}
}
}
}
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:43,代码来源:scanner.php
示例14: apply
/**
* Check if we have a user to login
* @param String $email
* @param String $uid
* @return String
*/
public static function apply($email, $uid = '')
{
//Get list of matching users
$list = array();
$query = \OCP\DB::prepare('SELECT userid FROM *PREFIX*preferences WHERE appid = ? AND configkey = ? AND configvalue = ?');
$result = $query->execute(array('settings', 'email', $email));
while ($userid = $result->fetchOne()) {
$list[] = $userid;
}
$qtyUser = count($list);
//No users found
if (!$qtyUser) {
\OCP\Util::writeLog(App::APP_ID, 'No users found. Deny login.', \OCP\Util::DEBUG);
return false;
}
//One user found
if ($qtyUser == 1) {
\OCP\Util::writeLog(App::APP_ID, 'Single user found. Entering the open space.', \OCP\Util::DEBUG);
return $list[0];
}
//Multiple users found
$currentPolicy = self::getSystemPolicy();
$isValidUid = in_array($uid, $list);
if ($currentPolicy == self::MULTIPLE_USERS_LIST) {
//Do we have correct uid?
if ($isValidUid) {
\OCP\Util::writeLog(App::APP_ID, 'Multiple users found. Entering the open space.', \OCP\Util::DEBUG);
return $uid;
} else {
\OCP\Util::writeLog(App::APP_ID, 'Multiple users found. List them all.', \OCP\Util::DEBUG);
\OCP\JSON::success(array('list' => $list));
exit;
}
} elseif ($currentPolicy == self::MULTIPLE_USERS_FIRST) {
\OCP\Util::writeLog(App::APP_ID, 'Multiple users found. Use first.', \OCP\Util::DEBUG);
//not first but the best matching ;)
$userid = $isValidUid ? $uid : $list[0];
return $userid;
}
\OCP\Util::writeLog(App::APP_ID, 'Multiple users found. Deny login.', \OCP\Util::DEBUG);
return Validator::setAmbigous();
}
开发者ID:DOM-Digital-Online-Media,项目名称:apps,代码行数:48,代码来源:policy.php
示例15: sendTestMail
/**
* Send a mail to test the settings
*/
public static function sendTestMail()
{
\OC_Util::checkAdminUser();
\OCP\JSON::callCheck();
$l = \OC::$server->getL10N('settings');
$email = \OC_Preferences::getValue(\OC_User::getUser(), 'settings', 'email', '');
if (!empty($email)) {
$defaults = new \OC_Defaults();
try {
\OC_Mail::send($email, \OC_User::getDisplayName(), $l->t('test email settings'), $l->t('If you received this email, the settings seem to be correct.'), \OCP\Util::getDefaultEmailAddress('no-reply'), $defaults->getName());
} catch (\Exception $e) {
$message = $l->t('A problem occurred while sending the e-mail. Please revisit your settings.');
\OC_JSON::error(array("data" => array("message" => $message)));
exit;
}
\OC_JSON::success(array("data" => array("message" => $l->t("Email sent"))));
} else {
$message = $l->t('You need to set your user email before being able to send test emails.');
\OC_JSON::error(array("data" => array("message" => $message)));
}
}
开发者ID:Combustible,项目名称:core,代码行数:24,代码来源:controller.php
示例16: Get
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function Get()
{
\OCP\JSON::setContentTypeHeader('application/json');
$PersonalSettings = array();
foreach ($this->OCDSettingKeys as $SettingKey) {
$this->Settings->SetKey($SettingKey);
$PersonalSettings[$SettingKey] = $this->Settings->GetValue();
// Set default if not set in the database
if (is_null($PersonalSettings[$SettingKey])) {
switch ($SettingKey) {
case 'DownloadsFolder':
$PersonalSettings[$SettingKey] = 'Downloads';
break;
case 'TorrentsFolder':
$PersonalSettings[$SettingKey] = 'Downloads/Files/Torrents';
break;
}
}
}
return new JSONResponse(array('ERROR' => false, 'VALS' => $PersonalSettings));
}
开发者ID:venjek,项目名称:ocdownloader,代码行数:25,代码来源:personalsettings.php
示例17: listAll
/**
* lists the documents the user has access to (including shared files, once the code in core has been fixed)
* also adds session and member info for these files
*/
public static function listAll()
{
self::preDispatch();
$documents = Storage::getDocuments();
$fileIds = array();
//$previewAvailable = \OCP\Preview::show($file);
foreach ($documents as $key => $document) {
//\OCP\Preview::show($document['path']);
$documents[$key]['icon'] = preg_replace('/\\.png$/', '.svg', \OC_Helper::mimetypeIcon($document['mimetype']));
$fileIds[] = $document['fileid'];
}
usort($documents, function ($a, $b) {
return @$b['mtime'] - @$a['mtime'];
});
$session = new Db_Session();
$sessions = $session->getCollectionBy('file_id', $fileIds);
$members = array();
$member = new Db_Member();
foreach ($sessions as $session) {
$members[$session['es_id']] = $member->getActiveCollection($session['es_id']);
}
\OCP\JSON::success(array('documents' => $documents, 'sessions' => $sessions, 'members' => $members));
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:27,代码来源:documentController.php
示例18: isset
$password = $_POST['password'];
}
$relativePath = null;
if (isset($_GET['dir'])) {
$relativePath = $_GET['dir'];
}
$sortAttribute = isset($_GET['sort']) ? $_GET['sort'] : 'name';
$sortDirection = isset($_GET['sortdirection']) ? $_GET['sortdirection'] === 'desc' : false;
$data = \OCA\Files_Sharing\Helper::setupFromToken($token, $relativePath, $password);
$linkItem = $data['linkItem'];
// Load the files
$dir = $data['realPath'];
$dir = \OC\Files\Filesystem::normalizePath($dir);
if (!\OC\Files\Filesystem::is_dir($dir . '/')) {
\OC_Response::setStatus(\OC_Response::STATUS_NOT_FOUND);
\OCP\JSON::error(array('success' => false));
exit;
}
$data = array();
// make filelist
$files = \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection);
$formattedFiles = array();
foreach ($files as $file) {
$entry = \OCA\Files\Helper::formatFileInfo($file);
unset($entry['directory']);
// for now
$entry['permissions'] = \OCP\PERMISSION_READ;
$formattedFiles[] = $entry;
}
$data['directory'] = $relativePath;
$data['files'] = $formattedFiles;
开发者ID:olucao,项目名称:owncloud-core,代码行数:31,代码来源:list.php
示例19: catch
} catch (\Exception $e) {
\OCP\JSON::error(array('message' => $e->getMessage()));
exit;
}
\OCP\JSON::error();
exit;
break;
case 'save':
$key = isset($_POST['cfgkey']) ? $_POST['cfgkey'] : false;
$val = isset($_POST['cfgval']) ? $_POST['cfgval'] : null;
if ($key === false || is_null($val)) {
\OCP\JSON::error(array('message' => $l->t('No data specified')));
exit;
}
$cfg = array($key => $val);
$setParameters = array();
$configuration->setConfiguration($cfg, $setParameters);
if (!in_array($key, $setParameters)) {
\OCP\JSON::error(array('message' => $l->t($key . ' Could not set configuration %s', $setParameters[0])));
exit;
}
$configuration->saveConfiguration();
//clear the cache on save
$connection = new \OCA\user_ldap\lib\Connection($ldapWrapper, $prefix);
$connection->clearCache();
OCP\JSON::success();
break;
default:
\OCP\JSON::error(array('message' => $l->t('Action does not exist')));
break;
}
开发者ID:evanjt,项目名称:core,代码行数:31,代码来源:wizard.php
示例20: getPath
/**
* @param $token
* @return null|string
*/
private function getPath($token)
{
$linkItem = Share::getShareByToken($token, false);
$path = null;
if (is_array($linkItem) && isset($linkItem['uid_owner'])) {
// seems to be a valid share
$rootLinkItem = Share::resolveReShare($linkItem);
if (isset($rootLinkItem['uid_owner'])) {
JSON::checkUserExists($rootLinkItem['uid_owner']);
OC_Util::tearDownFS();
OC_Util::setupFS($rootLinkItem['uid_owner']);
$path = Filesystem::getPath($linkItem['file_source']);
}
}
return $path;
}
开发者ID:riso,项目名称:owncloud-core,代码行数:20,代码来源:sharecontroller.php
注:本文中的OCP\JSON类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论