merge master into single-user-mode

This commit is contained in:
Robin Appelman 2013-11-25 21:25:04 +01:00
commit 9fbccc83e3
46 changed files with 530 additions and 62 deletions

View File

@ -691,8 +691,9 @@ var FileList={
var $fileList = $('#fileList');
var permissions = $('#permissions').val();
var isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0;
$('#emptycontent').toggleClass('hidden', !isCreatable || $fileList.find('tr').exists());
$('#filestable th').toggleClass('hidden', $fileList.find('tr').exists() === false);
var exists = $fileList.find('tr:first').exists();
$('#emptycontent').toggleClass('hidden', !isCreatable || exists);
$('#filestable th').toggleClass('hidden', !exists);
},
showMask: function() {
// in case one was shown before

View File

@ -269,7 +269,11 @@ class Dropbox extends \OC\Files\Storage\Common {
}
public function touch($path, $mtime = null) {
return false;
if ($this->file_exists($path)) {
return false;
} else {
$this->file_put_contents($path, '');
}
}
}

View File

@ -364,7 +364,7 @@ class Swift extends \OC\Files\Storage\Common {
'X-Object-Meta-Timestamp' => $mtime
)
);
$object->Update($settings);
return $object->Update($settings);
} else {
$object = $this->container->DataObject();
if (is_null($mtime)) {
@ -377,7 +377,7 @@ class Swift extends \OC\Files\Storage\Common {
'X-Object-Meta-Timestamp' => $mtime
)
);
$object->Create($settings);
return $object->Create($settings);
}
}

View File

@ -234,6 +234,7 @@ class DAV extends \OC\Files\Storage\Common{
} else {
$this->file_put_contents($path, '');
}
return true;
}
public function getFile($path, $target) {

View File

@ -3,10 +3,19 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
$files = $_POST['files'];
$dirlisting = $_POST['dirlisting'];
$list = json_decode($files);
// "empty trash" command
$deleteAll = false;
if (isset($_POST['allfiles']) and $_POST['allfiles'] === 'true'){
$user = \OCP\User::getUser();
$list = OCA\Files_Trashbin\Helper::getTrashFiles('/');
$deleteAll = true;
$dirlisting = '0';
}
else {
$files = $_POST['files'];
$dirlisting = $_POST['dirlisting'];
$list = json_decode($files);
}
$error = array();
$success = array();
@ -14,22 +23,30 @@ $success = array();
$i = 0;
foreach ($list as $file) {
if ( $dirlisting === '0') {
$delimiter = strrpos($file, '.d');
$filename = substr($file, 0, $delimiter);
$timestamp = substr($file, $delimiter+2);
if ($deleteAll) {
$filename = $file['name'];
$timestamp = $file['timestamp'];
}
else {
$delimiter = strrpos($file, '.d');
$filename = substr($file, 0, $delimiter);
$timestamp = substr($file, $delimiter+2);
}
} else {
$filename = $file;
$timestamp = null;
}
OCA\Files_Trashbin\Trashbin::delete($filename, $timestamp);
if (!OCA\Files_Trashbin\Trashbin::file_exists($filename, $timestamp)) {
if (OCA\Files_Trashbin\Trashbin::file_exists($filename, $timestamp)) {
$error[] = $filename;
OC_Log::write('trashbin','can\'t delete ' . $filename . ' permanently.', OC_Log::ERROR);
}
// only list deleted files if not deleting everything
else if (!$deleteAll) {
$success[$i]['filename'] = $file;
$success[$i]['timestamp'] = $timestamp;
$i++;
} else {
$error[] = $filename;
OC_Log::write('trashbin','can\'t delete ' . $filename . ' permanently.', OC_Log::ERROR);
}
}

View File

@ -22,3 +22,10 @@ FileList.reload = function(){
FileList.linkTo = function(dir){
return OC.linkTo('files_trashbin', 'index.php')+"?dir="+ encodeURIComponent(dir).replace(/%2F/g, '/');
}
FileList.updateEmptyContent = function(){
var $fileList = $('#fileList');
var exists = $fileList.find('tr:first').exists();
$('#emptycontent').toggleClass('hidden', exists);
$('#filestable th').toggleClass('hidden', !exists);
}

View File

@ -19,6 +19,7 @@ $(document).ready(function() {
}
enableActions();
FileList.updateFileSummary();
FileList.updateEmptyContent();
}
);
@ -45,6 +46,7 @@ $(document).ready(function() {
}
enableActions();
FileList.updateFileSummary();
FileList.updateEmptyContent();
}
);
@ -122,34 +124,60 @@ $(document).ready(function() {
}
enableActions();
FileList.updateFileSummary();
FileList.updateEmptyContent();
}
);
});
$('.delete').click('click', function(event) {
event.preventDefault();
var files = getSelectedFiles('file');
var fileslist = JSON.stringify(files);
var dirlisting = getSelectedFiles('dirlisting')[0];
var allFiles = $('#select_all').is(':checked');
var files = [];
var params = {};
if (allFiles) {
params = {
allfiles: true
};
}
else {
files = getSelectedFiles('file');
params = {
files: JSON.stringify(files),
dirlisting: getSelectedFiles('dirlisting')[0]
};
};
disableActions();
for (var i = 0; i < files.length; i++) {
var deleteAction = $('tr').filterAttr('data-file', files[i]).children("td.date").children(".action.delete");
deleteAction.removeClass('delete-icon').addClass('progress-icon');
if (allFiles) {
FileList.showMask();
}
else {
for (var i = 0; i < files.length; i++) {
var deleteAction = $('tr').filterAttr('data-file', files[i]).children("td.date").children(".action.delete");
deleteAction.removeClass('delete-icon').addClass('progress-icon');
}
}
$.post(OC.filePath('files_trashbin', 'ajax', 'delete.php'),
{files: fileslist, dirlisting: dirlisting},
params,
function(result) {
for (var i = 0; i < result.data.success.length; i++) {
var row = document.getElementById(result.data.success[i].filename);
row.parentNode.removeChild(row);
if (allFiles) {
FileList.hideMask();
// simply remove all files
$('#fileList').empty();
}
else {
for (var i = 0; i < result.data.success.length; i++) {
var row = document.getElementById(result.data.success[i].filename);
row.parentNode.removeChild(row);
}
}
if (result.status !== 'success') {
OC.dialogs.alert(result.data.message, t('core', 'Error'));
}
enableActions();
FileList.updateFileSummary();
FileList.updateEmptyContent();
}
);

View File

@ -4,9 +4,7 @@
</div>
<div id='notification'></div>
<?php if (isset($_['files']) && count($_['files']) === 0 && $_['dirlisting'] === false && !$_['ajaxLoad']):?>
<div id="emptycontent"><?php p($l->t('Nothing in here. Your trash bin is empty!'))?></div>
<?php endif; ?>
<div id="emptycontent" <?php if (!(isset($_['files']) && count($_['files']) === 0 && $_['dirlisting'] === false && !$_['ajaxLoad'])):?>class="hidden"<?php endif; ?>><?php p($l->t('Nothing in here. Your trash bin is empty!'))?></div>
<input type="hidden" name="ajaxLoad" id="ajaxLoad" value="<?php p($_['ajaxLoad']); ?>" />
<input type="hidden" id="disableSharing" data-status="<?php p($_['disableSharing']); ?>"></input>

View File

@ -0,0 +1,37 @@
<?php
/**
* Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace OC\Core\Command\App;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class Disable extends Command {
protected function configure() {
$this
->setName('app:disable')
->setDescription('disable an app')
->addArgument(
'app-id',
InputArgument::REQUIRED,
'disable the specified app'
);
}
protected function execute(InputInterface $input, OutputInterface $output) {
$appId = $input->getArgument('app-id');
if (\OC_App::isEnabled($appId)) {
\OC_App::disable($appId);
$output->writeln($appId . ' disabled');
} else {
$output->writeln('No such app enabled: ' . $appId);
}
}
}

View File

@ -0,0 +1,39 @@
<?php
/**
* Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace OC\Core\Command\App;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class Enable extends Command {
protected function configure() {
$this
->setName('app:enable')
->setDescription('enable an app')
->addArgument(
'app-id',
InputArgument::REQUIRED,
'enable the specified app'
);
}
protected function execute(InputInterface $input, OutputInterface $output) {
$appId = $input->getArgument('app-id');
if (\OC_App::isEnabled($appId)) {
$output->writeln($appId . ' is already enabled');
} else if (!\OC_App::getAppPath($appId)) {
$output->writeln($appId . ' not found');
} else {
\OC_App::enable($appId);
$output->writeln($appId . ' enabled');
}
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace OC\Core\Command\App;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class ListApps extends Command {
protected function configure() {
$this
->setName('app:list')
->setDescription('List all available apps');
}
protected function execute(InputInterface $input, OutputInterface $output) {
$apps = \OC_App::getAllApps();
$enabledApps = array();
$disabledApps = array();
//sort enabled apps above disabled apps
foreach ($apps as $app) {
if (\OC_App::isEnabled($app)) {
$enabledApps[] = $app;
} else {
$disabledApps[] = $app;
}
}
sort($enabledApps);
sort($disabledApps);
$output->writeln('Enabled:');
foreach ($enabledApps as $app) {
$output->writeln(' - ' . $app);
}
$output->writeln('Disabled:');
foreach ($disabledApps as $app) {
$output->writeln(' - ' . $app);
}
}
}

View File

@ -561,7 +561,7 @@ label.infield { cursor:text !important; top:1.05em; left:.85em; }
/* NAVIGATION ------------------------------------------------------------- */
#navigation {
position: absolute;
position: fixed;
top: 0;
bottom: 0;
left: 0;

View File

@ -11,3 +11,6 @@ $application->add(new OC\Core\Command\Status);
$application->add(new OC\Core\Command\Db\GenerateChangeScript());
$application->add(new OC\Core\Command\Upgrade());
$application->add(new OC\Core\Command\Maintenance\SingleUser());
$application->add(new OC\Core\Command\App\Disable());
$application->add(new OC\Core\Command\App\Enable());
$application->add(new OC\Core\Command\App\ListApps());

View File

@ -178,11 +178,19 @@ class OC {
if (file_exists(OC::$SERVERROOT . "/config/config.php")
and !is_writable(OC::$SERVERROOT . "/config/config.php")) {
$defaults = new OC_Defaults();
OC_Template::printErrorPage(
"Can't write into config directory!",
'This can usually be fixed by '
.'<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the config directory</a>.'
);
if (self::$CLI) {
echo "Can't write into config directory!\n";
echo "This can usually be fixed by giving the webserver write access to the config directory\n";
echo "\n";
echo "See " . \OC_Helper::linkToDocs('admin-dir_permissions') . "\n";
exit;
} else {
OC_Template::printErrorPage(
"Can't write into config directory!",
'This can usually be fixed by '
.'<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the config directory</a>.'
);
}
}
}
@ -496,7 +504,14 @@ class OC {
$errors = OC_Util::checkServer();
if (count($errors) > 0) {
OC_Template::printGuestPage('', 'error', array('errors' => $errors));
if (self::$CLI) {
foreach ($errors as $error) {
echo $error['error']."\n";
echo $error['hint'] . "\n\n";
}
} else {
OC_Template::printGuestPage('', 'error', array('errors' => $errors));
}
exit;
}

View File

@ -78,7 +78,19 @@ class OC_Connector_Sabre_FilesPlugin extends Sabre_DAV_ServerPlugin
* @throws Sabre_DAV_Exception_BadRequest
*/
public function sendFileIdHeader($filePath, Sabre_DAV_INode $node = null) {
// chunked upload handling
if (isset($_SERVER['HTTP_OC_CHUNKED'])) {
list($path, $name) = \Sabre_DAV_URLUtil::splitPath($filePath);
$info = OC_FileChunking::decodeName($name);
if (!empty($info)) {
$filePath = $path . '/' . $info['name'];
}
}
// we get the node for the given $filePath here because in case of afterCreateFile $node is the parent folder
if (!$this->server->tree->nodeExists($filePath)) {
return;
}
$node = $this->server->tree->getNodeForPath($filePath);
if ($node instanceof OC_Connector_Sabre_Node) {
$fileId = $node->getFileId();

View File

@ -1,15 +1,13 @@
<?php
/**
* Default strings and values which differ between the enterprise and the
* community edition. Use the get methods to always get the right strings.
*/
if (file_exists(OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php')) {
require_once 'themes/' . OC_Util::getTheme() . '/defaults.php';
}
/**
* Default strings and values which differ between the enterprise and the
* community edition. Use the get methods to always get the right strings.
*/
class OC_Defaults {
private $theme;
@ -48,6 +46,10 @@ class OC_Defaults {
return false;
}
/**
* Returns the base URL
* @return string URL
*/
public function getBaseUrl() {
if ($this->themeExist('getBaseUrl')) {
return $this->theme->getBaseUrl();
@ -56,6 +58,10 @@ class OC_Defaults {
}
}
/**
* Returns the URL where the sync clients are listed
* @return string URL
*/
public function getSyncClientUrl() {
if ($this->themeExist('getSyncClientUrl')) {
return $this->theme->getSyncClientUrl();
@ -64,6 +70,10 @@ class OC_Defaults {
}
}
/**
* Returns the documentation URL
* @return string URL
*/
public function getDocBaseUrl() {
if ($this->themeExist('getDocBaseUrl')) {
return $this->theme->getDocBaseUrl();
@ -72,6 +82,10 @@ class OC_Defaults {
}
}
/**
* Returns the title
* @return string title
*/
public function getTitle() {
if ($this->themeExist('getTitle')) {
return $this->theme->getTitle();
@ -80,6 +94,10 @@ class OC_Defaults {
}
}
/**
* Returns the short name of the software
* @return string title
*/
public function getName() {
if ($this->themeExist('getName')) {
return $this->theme->getName();
@ -88,6 +106,10 @@ class OC_Defaults {
}
}
/**
* Returns entity (e.g. company name) - used for footer, copyright
* @return string entity name
*/
public function getEntity() {
if ($this->themeExist('getEntity')) {
return $this->theme->getEntity();
@ -96,6 +118,10 @@ class OC_Defaults {
}
}
/**
* Returns slogan
* @return string slogan
*/
public function getSlogan() {
if ($this->themeExist('getSlogan')) {
return $this->theme->getSlogan();
@ -104,6 +130,10 @@ class OC_Defaults {
}
}
/**
* Returns logo claim
* @return string logo claim
*/
public function getLogoClaim() {
if ($this->themeExist('getLogoClaim')) {
return $this->theme->getLogoClaim();
@ -112,6 +142,10 @@ class OC_Defaults {
}
}
/**
* Returns short version of the footer
* @return string short footer
*/
public function getShortFooter() {
if ($this->themeExist('getShortFooter')) {
$footer = $this->theme->getShortFooter();
@ -123,6 +157,10 @@ class OC_Defaults {
return $footer;
}
/**
* Returns long version of the footer
* @return string long footer
*/
public function getLongFooter() {
if ($this->themeExist('getLongFooter')) {
$footer = $this->theme->getLongFooter();

View File

@ -136,7 +136,18 @@ class OC_Request {
* @returns string Path info or false when not found
*/
public static function getRawPathInfo() {
$path_info = substr($_SERVER['REQUEST_URI'], strlen($_SERVER['SCRIPT_NAME']));
$requestUri = $_SERVER['REQUEST_URI'];
// remove too many leading slashes - can be caused by reverse proxy configuration
if (strpos($requestUri, '/') === 0) {
$requestUri = '/' . ltrim($requestUri, '/');
}
$scriptName = $_SERVER['SCRIPT_NAME'];
// in case uri and script name don't match we better throw an exception
if (strpos($requestUri, $scriptName) !== 0) {
throw new Exception("REQUEST_URI($requestUri) does not start with the SCRIPT_NAME($scriptName)");
}
$path_info = substr($requestUri, strlen($scriptName));
// Remove the query string from REQUEST_URI
if ($pos = strpos($path_info, '?')) {
$path_info = substr($path_info, 0, $pos);

View File

@ -20,6 +20,11 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* Activity/IConsumer interface
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Activity;

View File

@ -20,6 +20,11 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* Activity/IManager interface
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Activity;
@ -47,7 +52,6 @@ interface IManager {
*
* $callable has to return an instance of OCA\Activity\IConsumer
*
* @param string $key
* @param \Closure $callable
*/
function registerConsumer(\Closure $callable);

View File

@ -20,6 +20,11 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* AppFramework/App class
*/
namespace OCP\AppFramework;

View File

@ -20,6 +20,10 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* AppFramework\Controller class
*/
namespace OCP\AppFramework;
@ -34,16 +38,19 @@ use OCP\IRequest;
abstract class Controller {
/**
* app container for dependency injection
* @var \OCP\AppFramework\IAppContainer
*/
protected $app;
/**
* current request
* @var \OCP\IRequest
*/
protected $request;
/**
* constructor of the controller
* @param IAppContainer $app interface to the app
* @param IRequest $request an instance of the request
*/

View File

@ -20,10 +20,16 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* AppFramework\HTTP class
*/
namespace OCP\AppFramework;
/**
* Base class which contains constants for HTTP status codes
*/
class Http {
const STATUS_CONTINUE = 100;

View File

@ -20,6 +20,10 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* AppFramework\HTTP\JSONResponse class
*/
namespace OCP\AppFramework\Http;
@ -30,10 +34,15 @@ use OCP\AppFramework\Http;
*/
class JSONResponse extends Response {
/**
* response data
* @var array|object
*/
protected $data;
/**
* constructor of JSONResponse
* @param array|object $data the object or array that should be transformed
* @param int $statusCode the Http status code, defaults to 200
*/
@ -55,7 +64,7 @@ class JSONResponse extends Response {
/**
* Sets values in the data json array
* @param array|object $params an array or object which will be transformed
* @param array|object $data an array or object which will be transformed
* to JSON
*/
public function setData($data){

View File

@ -20,6 +20,10 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* AppFramework\HTTP\Response class
*/
namespace OCP\AppFramework\Http;

View File

@ -20,6 +20,10 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* AppFramework\HTTP\TemplateResponse class
*/
namespace OCP\AppFramework\Http;
@ -29,14 +33,34 @@ namespace OCP\AppFramework\Http;
*/
class TemplateResponse extends Response {
/**
* name of the template
* @var string
*/
protected $templateName;
/**
* parameters
* @var array
*/
protected $params;
/**
* rendering type (admin, user, blank)
* @var string
*/
protected $renderAs;
/**
* app name
* @var string
*/
protected $appName;
/**
* @param string $templateName the name of the template
* constructor of TemplateResponse
* @param string $appName the name of the app to load the template from
* @param string $templateName the name of the template
*/
public function __construct($appName, $templateName) {
$this->templateName = $templateName;

View File

@ -20,6 +20,10 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* AppFramework/IApi interface
*/
namespace OCP\AppFramework;

View File

@ -20,6 +20,10 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* AppFramework\Middleware class
*/
namespace OCP\AppFramework;

View File

@ -20,6 +20,11 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* Authentication/IApacheBackend interface
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Authentication;

View File

@ -37,6 +37,8 @@ class DB {
/**
* Prepare a SQL query
* @param string $query Query string
* @param int $limit Limit of the SQL statement
* @param int $offset Offset of the SQL statement
* @return \MDB2_Statement_Common prepared SQL query
*
* SQL query via MDB2 prepare(), needs to be execute()'d!

View File

@ -30,19 +30,27 @@
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
/*
/**
* public api to access default strings and urls for your templates
*/
class Defaults {
/**
* \OC_Defaults instance to retrieve the defaults
* @return string
*/
private $defaults;
/**
* creates a \OC_Defaults instance which is used in all methods to retrieve the
* actual defaults
*/
function __construct() {
$this->defaults = new \OC_Defaults();
}
/**
* @breif get base URL for the organisation behind your ownCloud instance
* get base URL for the organisation behind your ownCloud instance
* @return string
*/
public function getBaseUrl() {
@ -50,7 +58,7 @@ class Defaults {
}
/**
* @breif link to the desktop sync client
* link to the desktop sync client
* @return string
*/
public function getSyncClientUrl() {
@ -58,7 +66,7 @@ class Defaults {
}
/**
* @breif base URL to the documentation of your ownCloud instance
* base URL to the documentation of your ownCloud instance
* @return string
*/
public function getDocBaseUrl() {
@ -66,7 +74,7 @@ class Defaults {
}
/**
* @breif name of your ownCloud instance
* name of your ownCloud instance
* @return string
*/
public function getName() {
@ -74,7 +82,7 @@ class Defaults {
}
/**
* @breif Entity behind your onwCloud instance
* Entity behind your onwCloud instance
* @return string
*/
public function getEntity() {
@ -82,7 +90,7 @@ class Defaults {
}
/**
* @breif ownCloud slogan
* ownCloud slogan
* @return string
*/
public function getSlogan() {
@ -90,7 +98,7 @@ class Defaults {
}
/**
* @breif logo claim
* logo claim
* @return string
*/
public function getLogoClaim() {
@ -98,7 +106,7 @@ class Defaults {
}
/**
* @breif footer, short version
* footer, short version
* @return string
*/
public function getShortFooter() {
@ -106,7 +114,7 @@ class Defaults {
}
/**
* @breif footer, long version
* footer, long version
* @return string
*/
public function getLongFooter() {

View File

@ -20,8 +20,16 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* Files/AlreadyExistsException class
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
/**
* Exception for already existing files/folders
*/
class AlreadyExistsException extends \Exception {}

View File

@ -20,8 +20,16 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* Files/EntityTooLargeException class
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
/**
* Exception for too large entity
*/
class EntityTooLargeException extends \Exception {}

View File

@ -20,6 +20,11 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* Files/File interface
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;

View File

@ -20,6 +20,11 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* Files/Folder interface
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;

View File

@ -20,8 +20,16 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* Files/InvalidContentException class
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
/**
* Exception for invalid content
*/
class InvalidContentException extends \Exception {}

View File

@ -20,8 +20,16 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* Files/InvalidPathException class
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
/**
* Exception for invalid path
*/
class InvalidPathException extends \Exception {}

View File

@ -20,6 +20,11 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* Files/Node interface
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;

View File

@ -20,8 +20,16 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* Files/NotEnoughSpaceException class
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
/**
* Exception for not enough space
*/
class NotEnoughSpaceException extends \Exception {}

View File

@ -20,8 +20,16 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* Files/NotFoundException class
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
/**
* Exception for not found entity
*/
class NotFoundException extends \Exception {}

View File

@ -20,8 +20,16 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* Files/NotPermittedException class
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
/**
* Exception for not permitted action
*/
class NotPermittedException extends \Exception {}

View File

@ -20,6 +20,11 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* Files/Storage interface
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;

View File

@ -20,6 +20,11 @@
*
*/
/**
* Public interface of ownCloud for apps to use.
* IAddressBook interface
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP {

View File

@ -64,7 +64,7 @@ interface IContainer {
* In case the parameter is false the service will be recreated on every call.
*
* @param string $name
* @param callable $closure
* @param \Closure $closure
* @param bool $shared
* @return void
*/

View File

@ -45,7 +45,7 @@ interface IDBConnection {
/**
* Used to get the id of the just inserted element
* @param string $tableName the name of the table where we inserted the item
* @param string $table the name of the table where we inserted the item
* @return int the id of the inserted element
*/
public function lastInsertId($table = null);

View File

@ -256,7 +256,7 @@ class Share {
/**
* Get the item of item type shared with the current user
* @param string $itemType
* @param string $ItemTarget
* @param string $itemTarget
* @param int $format (optional) Format type must be defined by the backend
* @return Return depends on format
*/
@ -268,8 +268,8 @@ class Share {
/**
* Get the item of item type shared with a given user by source
* @param string $ItemType
* @param string $ItemSource
* @param string $itemType
* @param string $itemSource
* @param string $user User user to whom the item was shared
* @return array Return list of items with file_target, permissions and expiration
*/

View File

@ -23,4 +23,46 @@ class Test_Request extends PHPUnit_Framework_TestCase {
$scriptName = OC_Request::scriptName();
$this->assertEquals('/domain.tld/ownCloud/tests/lib/request.php', $scriptName);
}
/**
* @dataProvider rawPathInfoProvider
* @param $expected
* @param $requestUri
* @param $scriptName
*/
public function testRawPathInfo($expected, $requestUri, $scriptName) {
$_SERVER['REQUEST_URI'] = $requestUri;
$_SERVER['SCRIPT_NAME'] = $scriptName;
$rawPathInfo = OC_Request::getRawPathInfo();
$this->assertEquals($expected, $rawPathInfo);
}
function rawPathInfoProvider() {
return array(
array('/core/ajax/translations.php', 'index.php/core/ajax/translations.php', 'index.php'),
array('/core/ajax/translations.php', '/index.php/core/ajax/translations.php', '/index.php'),
array('/core/ajax/translations.php', '//index.php/core/ajax/translations.php', '/index.php'),
);
}
/**
* @dataProvider rawPathInfoThrowsExceptionProvider
* @expectedException Exception
*
* @param $requestUri
* @param $scriptName
*/
public function testRawPathInfoThrowsException($requestUri, $scriptName) {
$_SERVER['REQUEST_URI'] = $requestUri;
$_SERVER['SCRIPT_NAME'] = $scriptName;
OC_Request::getRawPathInfo();
}
function rawPathInfoThrowsExceptionProvider() {
return array(
array('core/ajax/translations.php', '/index.php'),
array('/core/ajax/translations.php', '/index.php'),
array('//core/ajax/translations.php', '/index.php'),
);
}
}