Correct remote and public, and last occurence of OC::

This commit is contained in:
Brice Maron 2012-06-04 20:37:00 +00:00
parent 6a250d0d20
commit 6a812644e4
10 changed files with 34 additions and 32 deletions

View File

@ -30,6 +30,6 @@ $RUNTIME_NOSETUPFS=true;
OCP\JSON::checkLoggedIn(); OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('bookmarks'); OCP\JSON::checkAppEnabled('bookmarks');
require_once(OC::$APPSROOT . '/apps/bookmarks/bookmarksHelper.php'); require_once(OC_App::getAppPath('bookmarks').'/bookmarksHelper.php');
$id = addBookmark($_GET['url'], $_GET['title'], $_GET['tags']); $id = addBookmark($_GET['url'], $_GET['title'], $_GET['tags']);
OCP\JSON::success(array('data' => $id)); OCP\JSON::success(array('data' => $id));

View File

@ -7,8 +7,8 @@
*/ */
OCP\App::checkAppEnabled('calendar'); OCP\App::checkAppEnabled('calendar');
if(substr($_SERVER["REQUEST_URI"],0,strlen(OC::$APPSWEBROOT . '/apps/calendar/caldav.php')) == OC::$APPSWEBROOT . '/apps/calendar/caldav.php'){ if(substr($_SERVER["REQUEST_URI"],0,strlen(OC_App::getAppWebPath('calendar').'/caldav.php')) == OC_App::getAppWebPath('calendar'). '/caldav.php'){
$baseuri = OC::$APPSWEBROOT . '/apps/calendar/caldav.php'; $baseuri = OC_App::getAppWebPath('calendar').'/caldav.php';
} }
// only need authentication apps // only need authentication apps

View File

@ -5,7 +5,7 @@ $RUNTIME_APPTYPES=array('filesystem','authentication');
OC_App::loadApps($RUNTIME_APPTYPES); OC_App::loadApps($RUNTIME_APPTYPES);
if($path_info == '/ampache' || $path_info == '/ampache/'){ if($path_info == '/ampache' || $path_info == '/ampache/'){
require_once(OC::$APPSROOT . '/apps/media/index.php'); require_once(OC_App::getAppPath('media').'/index.php');
}else{ }else{
require_once(OC::$APPSROOT . '/apps/media/server/xml.server.php'); require_once(OC_App::getAppPath('media').'/server/xml.server.php');
} }

View File

@ -22,8 +22,8 @@
*/ */
OCP\App::checkAppEnabled('media'); OCP\App::checkAppEnabled('media');
require_once(OC::$APPSROOT . '/apps/media/lib_collection.php'); require_once(OC_App::getAppPath('media').'/lib_collection.php');
require_once(OC::$APPSROOT . '/apps/media/lib_ampache.php'); require_once(OC_App::getAppPath('media').'/lib_ampache.php');
$arguments=$_POST; $arguments=$_POST;
if(!isset($_POST['action']) and isset($_GET['action'])){ if(!isset($_POST['action']) and isset($_GET['action'])){

View File

@ -59,7 +59,7 @@ echo "{\"links\":[";
$apps = OC_Appconfig::getApps(); $apps = OC_Appconfig::getApps();
foreach($apps as $app) { foreach($apps as $app) {
if(OCP\App::isEnabled($app)) { if(OCP\App::isEnabled($app)) {
if(is_file(OC::$APPSROOT . '/apps/' . $app . '/appinfo/webfinger.php')) { if(is_file(OC_App::getAppPath($app). '/appinfo/webfinger.php')) {
require($app . '/appinfo/webfinger.php'); require($app . '/appinfo/webfinger.php');
} }
} }

View File

@ -571,10 +571,10 @@ class OC_App{
//set remote/public handelers //set remote/public handelers
$appData=self::getAppInfo($appid); $appData=self::getAppInfo($appid);
foreach($appData['remote'] as $name=>$path){ foreach($appData['remote'] as $name=>$path){
OCP\CONFIG::setAppValue('core', 'remote_'.$name, '/apps/'.$appid.'/'.$path); OCP\CONFIG::setAppValue('core', 'remote_'.$name, $path);
} }
foreach($appData['public'] as $name=>$path){ foreach($appData['public'] as $name=>$path){
OCP\CONFIG::setAppValue('core', 'public_'.$name, '/apps/'.$appid.'/'.$path); OCP\CONFIG::setAppValue('core', 'public_'.$name, $appid.'/'.$path);
} }
self::setAppTypes($appid); self::setAppTypes($appid);

View File

@ -40,7 +40,7 @@ class OC_Helper {
if( $app != '' ){ if( $app != '' ){
$app .= '/'; $app .= '/';
// Check if the app is in the app folder // Check if the app is in the app folder
if( file_exists( OC_App::getAppPath($app).$file )){ if( file_exists( OC_App::getAppPath($app).'/'.$file )){
if(substr($file, -3) == 'php' || substr($file, -3) == 'css'){ if(substr($file, -3) == 'php' || substr($file, -3) == 'css'){
if(substr($app, -1, 1) == '/'){ if(substr($app, -1, 1) == '/'){
$app = substr($app, 0, strlen($app) - 1); $app = substr($app, 0, strlen($app) - 1);

View File

@ -197,10 +197,10 @@ class OC_Installer{
//set remote/public handelers //set remote/public handelers
foreach($info['remote'] as $name=>$path){ foreach($info['remote'] as $name=>$path){
OCP\CONFIG::setAppValue('core', 'remote_'.$name, '/apps/'.$info['id'].'/'.$path); OCP\CONFIG::setAppValue('core', 'remote_'.$name, $app.'/'.$path);
} }
foreach($info['public'] as $name=>$path){ foreach($info['public'] as $name=>$path){
OCP\CONFIG::setAppValue('core', 'public_'.$name, '/apps/'.$info['id'].'/'.$path); OCP\CONFIG::setAppValue('core', 'public_'.$name, $app.'/'.$path);
} }
OC_App::setAppTypes($info['id']); OC_App::setAppTypes($info['id']);
@ -287,22 +287,24 @@ class OC_Installer{
* This function installs all apps found in the 'apps' directory that should be enabled by default; * This function installs all apps found in the 'apps' directory that should be enabled by default;
*/ */
public static function installShippedApps(){ public static function installShippedApps(){
$dir = opendir( OC::$APPSROOT."/apps" ); foreach(OC::$APPSROOTS as $app_dir) {
while( false !== ( $filename = readdir( $dir ))){ $dir = opendir( $app_dir['path'] );
if( substr( $filename, 0, 1 ) != '.' and is_dir(OC::$APPSROOT."/apps/$filename") ){ while( false !== ( $filename = readdir( $dir ))){
if( file_exists( OC::$APPSROOT."/apps/$filename/appinfo/app.php" )){ if( substr( $filename, 0, 1 ) != '.' and is_dir($app_dir['path']."/$filename") ){
if(!OC_Installer::isInstalled($filename)){ if( file_exists( $app_dir['path']."/$filename/appinfo/app.php" )){
$info=OC_App::getAppInfo($filename); if(!OC_Installer::isInstalled($filename)){
$enabled = isset($info['default_enable']); $info=OC_App::getAppInfo($filename);
if( $enabled ){ $enabled = isset($info['default_enable']);
OC_Installer::installShippedApp($filename); if( $enabled ){
OC_Appconfig::setValue($filename,'enabled','yes'); OC_Installer::installShippedApp($filename);
OC_Appconfig::setValue($filename,'enabled','yes');
}
} }
} }
} }
} }
closedir( $dir );
} }
closedir( $dir );
} }
/** /**
@ -325,10 +327,10 @@ class OC_Installer{
//set remote/public handelers //set remote/public handelers
foreach($info['remote'] as $name=>$path){ foreach($info['remote'] as $name=>$path){
OCP\CONFIG::setAppValue('core', 'remote_'.$name, '/apps/'.$app.'/'.$path); OCP\CONFIG::setAppValue('core', 'remote_'.$name, $app.'/'.$path);
} }
foreach($info['public'] as $name=>$path){ foreach($info['public'] as $name=>$path){
OCP\CONFIG::setAppValue('core', 'public_'.$name, '/apps/'.$app.'/'.$path); OCP\CONFIG::setAppValue('core', 'public_'.$name, $app.'/'.$path);
} }
OC_App::setAppTypes($info['id']); OC_App::setAppTypes($info['id']);

View File

@ -8,8 +8,8 @@ if(is_null($file)){
exit; exit;
} }
$parts=explode('/',$file); $parts=explode('/',$file,2);
$app=$parts[2]; $app=$parts[0];
OC_App::loadApp($app); OC_App::loadApp($app);
require_once(OC::$APPSROOT . $file); require_once(OC_App::getAppPath($app) .'/'. $parts[1]);

View File

@ -17,9 +17,9 @@ if(is_null($file)){
exit; exit;
} }
$parts=explode('/',$file); $parts=explode('/', $file, 2);
$app=$parts[2]; $app=$parts[0];
OC_App::loadApp($app); OC_App::loadApp($app);
$baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/'; $baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/';
require_once(OC::$APPSROOT . $file); require_once(OC_App::getAppPath($app) .'/'. $parts[1]);