Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
33bb223
updating 3rdparty repo commit
DeepDiver1975 Aug 16, 2013
fde9cab
initial import of appframework
DeepDiver1975 Aug 17, 2013
3324495
pulling in 3rdparty submodule
DeepDiver1975 Aug 17, 2013
72e1a8d
fixing require to Pimple
DeepDiver1975 Aug 20, 2013
0fa2e1b
there is no HttpMiddleware
DeepDiver1975 Aug 20, 2013
0fa8f38
fixing broken test
DeepDiver1975 Aug 20, 2013
cdada78
typos & unused var fixed
DeepDiver1975 Aug 20, 2013
93194bb
Introducing IContainer into public api
DeepDiver1975 Aug 20, 2013
6e1946a
Introducing IContainer into public api
DeepDiver1975 Aug 20, 2013
f115b94
Introducing IRequest
DeepDiver1975 Aug 20, 2013
25ebe49
controller reuses IRequest methods
DeepDiver1975 Aug 20, 2013
395deac
reducing controller annotations to:
DeepDiver1975 Aug 20, 2013
33db8a3
kill superfluent classloader from tests - this approach might be of i…
DeepDiver1975 Aug 20, 2013
aa979f5
cleanup of tests
DeepDiver1975 Aug 20, 2013
ba029ef
initial setup of the server container
DeepDiver1975 Aug 20, 2013
e39083c
typo
DeepDiver1975 Aug 20, 2013
911bd3c
moving response classes over to OCP
DeepDiver1975 Aug 20, 2013
38f9df4
introducing OCP\AppFramework\App
DeepDiver1975 Aug 20, 2013
a995e81
Merge branch 'master' into appframework-master
DeepDiver1975 Aug 26, 2013
21fd352
as a quick example the public contacts API has been ported over as a …
DeepDiver1975 Aug 26, 2013
14b67d6
fixing typo
DeepDiver1975 Aug 29, 2013
a9d6b59
Merge branch 'master' into appframework-master
DeepDiver1975 Aug 30, 2013
ec9b7d1
fixing file header
DeepDiver1975 Aug 30, 2013
97bdf00
PHPDoc added to existing interfaces
DeepDiver1975 Aug 31, 2013
206f839
move new interfaces into lib/public and OCP
DeepDiver1975 Aug 31, 2013
823b4cc
More trimming
tanghus Sep 4, 2013
835f477
Merge branch 'master' into appframework-master
DeepDiver1975 Sep 4, 2013
7618cf3
adding public interface for preview
DeepDiver1975 Sep 4, 2013
5b3388c
Merge branch 'master' into appframework-master
DeepDiver1975 Sep 13, 2013
4da8fc6
Merge branch 'appframework-master' of github.com:owncloud/core into a…
DeepDiver1975 Sep 13, 2013
4480b0b
Merge branch 'master' into appframework-master
DeepDiver1975 Sep 13, 2013
ad82a56
Merge branch 'master' into appframework-master
DeepDiver1975 Sep 15, 2013
5acb3c4
first log the exception
DeepDiver1975 Sep 15, 2013
af0069b
adding getRootFolder() to server container and hooking up the new fil…
DeepDiver1975 Sep 15, 2013
5d4e9e0
/OC/Server has created too early causing issues with config operation…
DeepDiver1975 Sep 15, 2013
981a41e
adding interface for middleware
DeepDiver1975 Sep 16, 2013
822daa8
class files have to be lowercase
DeepDiver1975 Sep 16, 2013
4cd0ee4
Merge branch 'master' into appframework-master
DeepDiver1975 Sep 17, 2013
b9e943f
fix naming
DeepDiver1975 Sep 17, 2013
9b420e8
use \OC::$server->getPreviewManager() instead of \OCP\Preview
DeepDiver1975 Sep 17, 2013
fe86182
OC_Cache namespace changes and add UserCache to server container.
tanghus Sep 17, 2013
1a13062
Add legacy wrapper
tanghus Sep 17, 2013
5c19b99
Add interface for Session and add getter in server container.
tanghus Sep 17, 2013
5bddb53
Purge session from Request - and fix some styles
tanghus Sep 17, 2013
8b4f4a7
Still some session leftovers.
tanghus Sep 17, 2013
e760343
Merge branch 'appframework-master' into vcategories_public
tanghus Sep 17, 2013
b0762ad
OC_VCategories=>OC\Tags. Public interface + getter in server container
tanghus Sep 17, 2013
d3f88ce
Add some docs to the sessions interface.
tanghus Sep 18, 2013
415a27c
Merge pull request #4888 from owncloud/public_session
DeepDiver1975 Sep 18, 2013
6ba2391
Add getUserFolder/getAppFolder to Server.
tanghus Sep 18, 2013
442a2e0
Update to adhere to the coding guidelines.
tanghus Sep 18, 2013
534933e
Use new emitter system
tanghus Sep 18, 2013
dd62ccd
Merge branch 'appframework-master' into public_cache
tanghus Sep 18, 2013
2ef0b58
Don't try to be clever
tanghus Sep 18, 2013
79cd655
Note to self: Test before pushing!!!
tanghus Sep 18, 2013
09d0437
Note to self 2: Do as you preach. Test!
tanghus Sep 18, 2013
1274d61
updating php docs
DeepDiver1975 Sep 18, 2013
69c2840
Merge pull request #4886 from owncloud/public_cache
DeepDiver1975 Sep 18, 2013
690e98d
Merge branch 'appframework-master' into vcategories_public
DeepDiver1975 Sep 18, 2013
76f8be3
fixing namespaces and rename hasCategory to hasTag
DeepDiver1975 Sep 18, 2013
314ca84
Updated method names and added a few more tests.
tanghus Sep 19, 2013
d5126dd
Merge branch 'appframework-master' into server_folder_methods
tanghus Sep 19, 2013
9e4d138
Fix syntax error
tanghus Sep 19, 2013
de81210
Add another test.
tanghus Sep 19, 2013
ac73ce1
Add UserSession to server container
bartv2 Sep 20, 2013
aa8a85f
Add DBConnection to server container
bartv2 Sep 20, 2013
e3013c5
Add Navigation class to server container
bartv2 Sep 20, 2013
e92abfd
Add Config container class to server container
bartv2 Sep 20, 2013
9116303
fixing typos
DeepDiver1975 Sep 20, 2013
e31f6c0
fixing PHPDoc
DeepDiver1975 Sep 20, 2013
f83f323
fixing typos + adding missing filed $activeEntry
DeepDiver1975 Sep 20, 2013
d3d52dd
PHPDoc & get UserManager from container for RooFolder
DeepDiver1975 Sep 20, 2013
0c6dcdb
Add missing implements and fix parameters in IConfig
bartv2 Sep 20, 2013
0b4de84
Added more error checking in add()
tanghus Sep 23, 2013
93258e1
Forgot to return false if add() didn't add anything.
tanghus Sep 23, 2013
910a033
Use fetchOne() instead of numRows() when doing a COUNT(*).
tanghus Sep 23, 2013
d27416e
Moar tests.
tanghus Sep 23, 2013
200e969
Merge pull request #4928 from owncloud/interfaces
tanghus Sep 23, 2013
5ca181e
More trimming
tanghus Sep 4, 2013
45f73fe
OC_VCategories=>OC\Tags. Public interface + getter in server container
tanghus Sep 17, 2013
b63acdb
fixing namespaces and rename hasCategory to hasTag
DeepDiver1975 Sep 18, 2013
1bbeb12
Updated method names and added a few more tests.
tanghus Sep 19, 2013
8fab9ee
Add another test.
tanghus Sep 19, 2013
8a02afd
Added more error checking in add()
tanghus Sep 23, 2013
be402fa
Forgot to return false if add() didn't add anything.
tanghus Sep 23, 2013
60bff6c
Use fetchOne() instead of numRows() when doing a COUNT(*).
tanghus Sep 23, 2013
f022ea7
Moar tests.
tanghus Sep 23, 2013
7cad510
Fix conflict
tanghus Sep 23, 2013
4d3e7fa
Add getUserFolder/getAppFolder to Server.
tanghus Sep 18, 2013
f2de5a3
Don't try to be clever
tanghus Sep 18, 2013
698394c
Merge branch 'server_folder_methods' of github.com:owncloud/core into…
tanghus Sep 23, 2013
8c46939
Remove duplicate method definitions
tanghus Sep 23, 2013
843f15f
Merge pull request #4898 from owncloud/server_folder_methods
DeepDiver1975 Sep 24, 2013
aaed871
Add factory class for the server container.
tanghus Sep 24, 2013
db39fed
Merge branch 'master' into appframework-master
DeepDiver1975 Sep 25, 2013
b2ef978
AppFramework:
DeepDiver1975 Sep 25, 2013
b168d5a
class API decommissioning part 1
DeepDiver1975 Sep 25, 2013
30286c0
stripos return value check
DeepDiver1975 Sep 25, 2013
469b309
Merge pull request #4892 from owncloud/vcategories_public
DeepDiver1975 Sep 25, 2013
687ba05
Merge branch 'master' into appframework-master
DeepDiver1975 Sep 27, 2013
adff34c
fixing error in initialization of TagManager
DeepDiver1975 Sep 27, 2013
57f37c8
delay middleware registrations
DeepDiver1975 Sep 27, 2013
6979fd3
Merge branch 'master' into appframework-master
DeepDiver1975 Sep 28, 2013
adcb738
initialize $middleWares
DeepDiver1975 Sep 28, 2013
5462e19
Merge branch 'master' into appframework-master
DeepDiver1975 Sep 29, 2013
629faf6
Merge branch 'master' into appframework-master
DeepDiver1975 Sep 30, 2013
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
6 changes: 3 additions & 3 deletions apps/files/ajax/rawlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
if($mimetypes && !in_array('httpd/unix-directory', $mimetypes)) {
foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, 'httpd/unix-directory' ) as $file ) {
$file['directory'] = $dir;
$file['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($file['mimetype']);
$file['isPreviewAvailable'] = \OC::$server->getPreviewManager()->isMimeSupported($file['mimetype']);
$file["date"] = OCP\Util::formatDate($file["mtime"]);
$file['mimetype_icon'] = \OCA\Files\Helper::determineIcon($file);
$files[] = $file;
Expand All @@ -37,7 +37,7 @@
foreach ($mimetypes as $mimetype) {
foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, $mimetype ) as $file ) {
$file['directory'] = $dir;
$file['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($file['mimetype']);
$file['isPreviewAvailable'] = \OC::$server->getPreviewManager()->isMimeSupported($file['mimetype']);
$file["date"] = OCP\Util::formatDate($file["mtime"]);
$file['mimetype_icon'] = \OCA\Files\Helper::determineIcon($file);
$files[] = $file;
Expand All @@ -46,7 +46,7 @@
} else {
foreach( \OC\Files\Filesystem::getDirectoryContent( $dir ) as $file ) {
$file['directory'] = $dir;
$file['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($file['mimetype']);
$file['isPreviewAvailable'] = \OC::$server->getPreviewManager()->isMimeSupported($file['mimetype']);
$file["date"] = OCP\Util::formatDate($file["mtime"]);
$file['mimetype_icon'] = \OCA\Files\Helper::determineIcon($file);
$files[] = $file;
Expand Down
2 changes: 1 addition & 1 deletion apps/files/lib/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static function getFiles($dir) {
}
}
$i['directory'] = $dir;
$i['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($i['mimetype']);
$i['isPreviewAvailable'] = \OC::$server->getPreviewManager()->isMimeSupported($i['mimetype']);
$i['icon'] = \OCA\Files\Helper::determineIcon($i);
$files[] = $i;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/public.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function determineIcon($file, $sharingRoot, $sharingToken) {
} else {
$i['extension'] = '';
}
$i['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($i['mimetype']);
$i['isPreviewAvailable'] = \OC::$server->getPreviewManager()->isMimeSupported($i['mimetype']);
}
$i['directory'] = $getPath;
$i['permissions'] = OCP\PERMISSION_READ;
Expand Down
2 changes: 1 addition & 1 deletion apps/files_trashbin/lib/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static function getTrashFiles($dir){
$i['directory'] = '';
}
$i['permissions'] = \OCP\PERMISSION_READ;
$i['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($r['mime']);
$i['isPreviewAvailable'] = \OC::$server->getPreviewManager()->isMimeSupported($r['mime']);
$i['icon'] = \OCA\Files\Helper::determineIcon($i);
$files[] = $i;
}
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

} catch (Exception $ex) {
//show the user a detailed error page
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
\OCP\Util::writeLog('index', $ex->getMessage(), \OCP\Util::FATAL);
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
OC_Template::printExceptionErrorPage($ex);
}
77 changes: 77 additions & 0 deletions lib/allconfig.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php
/**
* Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*
*/

namespace OC;

/**
* Class to combine all the configuration options ownCloud offers
*/
class AllConfig implements \OCP\IConfig {
/**
* Sets a new system wide value
* @param string $key the key of the value, under which will be saved
* @param string $value the value that should be stored
* @todo need a use case for this
*/
// public function setSystemValue($key, $value) {
// \OCP\Config::setSystemValue($key, $value);
// }

/**
* Looks up a system wide defined value
* @param string $key the key of the value, under which it was saved
* @return string the saved value
*/
public function getSystemValue($key) {
return \OCP\Config::getSystemValue($key, '');
}


/**
* Writes a new app wide value
* @param string $appName the appName that we want to store the value under
* @param string $key the key of the value, under which will be saved
* @param string $value the value that should be stored
*/
public function setAppValue($appName, $key, $value) {
\OCP\Config::setAppValue($appName, $key, $value);
}

/**
* Looks up an app wide defined value
* @param string $appName the appName that we stored the value under
* @param string $key the key of the value, under which it was saved
* @return string the saved value
*/
public function getAppValue($appName, $key) {
return \OCP\Config::getAppValue($appName, $key, '');
}


/**
* Set a user defined value
* @param string $userId the userId of the user that we want to store the value under
* @param string $appName the appName that we want to store the value under
* @param string $key the key under which the value is being stored
* @param string $value the value that you want to store
*/
public function setUserValue($userId, $appName, $key, $value) {
\OCP\Config::setUserValue($userId, $appName, $key, $value);
}

/**
* Shortcut for getting a user defined value
* @param string $userId the userId of the user that we want to store the value under
* @param string $appName the appName that we stored the value under
* @param string $key the key under which the value is being stored
*/
public function getUserValue($userId, $appName, $key){
return \OCP\Config::getUserValue($userId, $appName, $key);
}
}
31 changes: 12 additions & 19 deletions lib/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
* upgrading and removing apps.
*/
class OC_App{
static private $activeapp = '';
static private $navigation = array();
static private $settingsForms = array();
static private $adminForms = array();
static private $personalForms = array();
Expand Down Expand Up @@ -271,7 +269,7 @@ public static function disable( $app ) {

/**
* @brief adds an entry to the navigation
* @param string $data array containing the data
* @param array $data array containing the data
* @return bool
*
* This function adds a new entry to the navigation visible to users. $data
Expand All @@ -287,11 +285,7 @@ public static function disable( $app ) {
* the navigation. Lower values come first.
*/
public static function addNavigationEntry( $data ) {
$data['active']=false;
if(!isset($data['icon'])) {
$data['icon']='';
}
OC_App::$navigation[] = $data;
OC::$server->getNavigationManager()->add($data);
return true;
}

Expand All @@ -305,25 +299,22 @@ public static function addNavigationEntry( $data ) {
* highlighting the current position of the user.
*/
public static function setActiveNavigationEntry( $id ) {
// load all the apps, to make sure we have all the navigation entries
self::loadApps();
self::$activeapp = $id;
OC::$server->getNavigationManager()->setActiveEntry($id);
return true;
}

/**
* @brief Get the navigation entries for the $app
* @param string $app app
* @return array of the $data added with addNavigationEntry
*
* Warning: destroys the existing entries
*/
public static function getAppNavigationEntries($app) {
if(is_file(self::getAppPath($app).'/appinfo/app.php')) {
$save = self::$navigation;
self::$navigation = array();
OC::$server->getNavigationManager()->clear();
require $app.'/appinfo/app.php';
$app_entries = self::$navigation;
self::$navigation = $save;
return $app_entries;
return OC::$server->getNavigationManager()->getAll();
}
return array();
}
Expand All @@ -336,7 +327,7 @@ public static function getAppNavigationEntries($app) {
* setActiveNavigationEntry
*/
public static function getActiveNavigationEntry() {
return self::$activeapp;
return OC::$server->getNavigationManager()->getActiveEntry();
}

/**
Expand Down Expand Up @@ -419,8 +410,9 @@ public static function getSettingsNavigation() {

// This is private as well. It simply works, so don't ask for more details
private static function proceedNavigation( $list ) {
$activeapp = OC::$server->getNavigationManager()->getActiveEntry();
foreach( $list as &$naventry ) {
if( $naventry['id'] == self::$activeapp ) {
if( $naventry['id'] == $activeapp ) {
$naventry['active'] = true;
}
else{
Expand Down Expand Up @@ -572,7 +564,8 @@ public static function getAppInfo($appid, $path=false) {
* - active: boolean, signals if the user is on this navigation entry
*/
public static function getNavigation() {
$navigation = self::proceedNavigation( self::$navigation );
$entries = OC::$server->getNavigationManager()->getAll();
$navigation = self::proceedNavigation( $entries );
return $navigation;
}

Expand Down
98 changes: 98 additions & 0 deletions lib/appframework/app.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?php

/**
* ownCloud - App Framework
*
* @author Bernhard Posselt
* @copyright 2012 Bernhard Posselt nukeawhale@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/


namespace OC\AppFramework;

use OC\AppFramework\DependencyInjection\DIContainer;
use OCP\AppFramework\IAppContainer;


/**
* Entry point for every request in your app. You can consider this as your
* public static void main() method
*
* Handles all the dependency injection, controllers and output flow
*/
class App {


/**
* Shortcut for calling a controller method and printing the result
* @param string $controllerName the name of the controller under which it is
* stored in the DI container
* @param string $methodName the method that you want to call
* @param array $urlParams an array with variables extracted from the routes
* @param DIContainer $container an instance of a pimple container.
*/
public static function main($controllerName, $methodName, array $urlParams,
IAppContainer $container) {
$container['urlParams'] = $urlParams;
$controller = $container[$controllerName];

// initialize the dispatcher and run all the middleware before the controller
$dispatcher = $container['Dispatcher'];

list($httpHeaders, $responseHeaders, $output) =
$dispatcher->dispatch($controller, $methodName);

if(!is_null($httpHeaders)) {
header($httpHeaders);
}

foreach($responseHeaders as $name => $value) {
header($name . ': ' . $value);
}

if(!is_null($output)) {
header('Content-Length: ' . strlen($output));
print($output);
}

}

/**
* Shortcut for calling a controller method and printing the result.
* Similar to App:main except that no headers will be sent.
* This should be used for example when registering sections via
* \OC\AppFramework\Core\API::registerAdmin()
*
* @param string $controllerName the name of the controller under which it is
* stored in the DI container
* @param string $methodName the method that you want to call
* @param array $urlParams an array with variables extracted from the routes
* @param DIContainer $container an instance of a pimple container.
*/
public static function part($controllerName, $methodName, array $urlParams,
DIContainer $container){

$container['urlParams'] = $urlParams;
$controller = $container[$controllerName];

$dispatcher = $container['Dispatcher'];

list(, , $output) = $dispatcher->dispatch($controller, $methodName);
return $output;
}

}
Loading