some indention fixes

This commit is contained in:
Robin Appelman 2012-07-24 00:39:59 +02:00
parent 7967685771
commit 856d9c0b54
9 changed files with 141 additions and 172 deletions

View File

@ -195,7 +195,7 @@ class OC_App{
// check if the app is compatible with this version of ownCloud
$info=OC_App::getAppInfo($app);
$version=OC_Util::getVersion();
if(!isset($info['require']) or ($version[0]>$info['require'])){
if(!isset($info['require']) or ($version[0]>$info['require'])){
OC_Log::write('core','App "'.$info['name'].'" can\'t be installed because it is not compatible with this version of ownCloud',OC_Log::ERROR);
return false;
}else{
@ -331,8 +331,8 @@ class OC_App{
}
/**
* Get the path where to install apps
*/
* Get the path where to install apps
*/
public static function getInstallPath() {
if(OC_Config::getValue('appstoreenabled', true)==false) {
return false;

View File

@ -368,9 +368,6 @@ class OC_DB {
if( $definition instanceof MDB2_Schema_Error ){
die( $definition->getMessage().': '.$definition->getUserInfo());
}
// if(OC_Config::getValue('dbtype','sqlite')=='sqlite'){
// $definition['overwrite']=true;//always overwrite for sqlite
// }
$ret=self::$schema->createDatabase( $definition );
// Die in case something went wrong
@ -527,8 +524,7 @@ class OC_DB {
* @brief replaces the owncloud tables with a new set
* @param $file string path to the MDB2 xml db export file
*/
public static function replaceDB( $file ){
public static function replaceDB( $file ){
$apps = OC_App::getAllApps();
self::beginTransaction();
// Delete the old tables

View File

@ -53,99 +53,99 @@ class OC_Filesystem{
static private $defaultInstance;
/**
* classname which used for hooks handling
* used as signalclass in OC_Hooks::emit()
*/
const CLASSNAME = 'OC_Filesystem';
/**
* classname which used for hooks handling
* used as signalclass in OC_Hooks::emit()
*/
const CLASSNAME = 'OC_Filesystem';
/**
* signalname emited before file renaming
* @param oldpath
* @param newpath
*/
const signal_rename = 'rename';
/**
* signalname emited before file renaming
* @param oldpath
* @param newpath
*/
const signal_rename = 'rename';
/**
* signal emited after file renaming
* @param oldpath
* @param newpath
*/
const signal_post_rename = 'post_rename';
/**
* signal emited before file/dir creation
* @param path
* @param run changing this flag to false in hook handler will cancel event
*/
const signal_create = 'create';
/**
* signal emited after file renaming
* @param oldpath
* @param newpath
*/
const signal_post_rename = 'post_rename';
/**
* signal emited after file/dir creation
* @param path
* @param run changing this flag to false in hook handler will cancel event
*/
const signal_post_create = 'post_create';
/**
* signal emited before file/dir creation
* @param path
* @param run changing this flag to false in hook handler will cancel event
*/
const signal_create = 'create';
/**
* signal emits before file/dir copy
* @param oldpath
* @param newpath
* @param run changing this flag to false in hook handler will cancel event
*/
const signal_copy = 'copy';
/**
* signal emited after file/dir creation
* @param path
* @param run changing this flag to false in hook handler will cancel event
*/
const signal_post_create = 'post_create';
/**
* signal emits after file/dir copy
* @param oldpath
* @param newpath
*/
const signal_post_copy = 'post_copy';
/**
* signal emits before file/dir copy
* @param oldpath
* @param newpath
* @param run changing this flag to false in hook handler will cancel event
*/
const signal_copy = 'copy';
/**
* signal emits before file/dir save
* @param path
* @param run changing this flag to false in hook handler will cancel event
*/
const signal_write = 'write';
/**
* signal emits after file/dir copy
* @param oldpath
* @param newpath
*/
const signal_post_copy = 'post_copy';
/**
* signal emits after file/dir save
* @param path
*/
const signal_post_write = 'post_write';
/**
* signal emits when reading file/dir
* @param path
*/
const signal_read = 'read';
/**
* signal emits before file/dir save
* @param path
* @param run changing this flag to false in hook handler will cancel event
*/
const signal_write = 'write';
/**
* signal emits when removing file/dir
* @param path
*/
const signal_delete = 'delete';
/**
* signal emits after file/dir save
* @param path
*/
const signal_post_write = 'post_write';
/**
* parameters definitions for signals
*/
const signal_param_path = 'path';
const signal_param_oldpath = 'oldpath';
const signal_param_newpath = 'newpath';
/**
* signal emits when reading file/dir
* @param path
*/
const signal_read = 'read';
/**
* run - changing this flag to false in hook handler will cancel event
*/
const signal_param_run = 'run';
/**
* signal emits when removing file/dir
* @param path
*/
const signal_delete = 'delete';
/**
* get the mountpoint of the storage object for a path
( note: because a storage is not always mounted inside the fakeroot, the returned mountpoint is relative to the absolute root of the filesystem and doesn't take the chroot into account
*
* @param string path
* @return string
*/
/**
* parameters definitions for signals
*/
const signal_param_path = 'path';
const signal_param_oldpath = 'oldpath';
const signal_param_newpath = 'newpath';
/**
* run - changing this flag to false in hook handler will cancel event
*/
const signal_param_run = 'run';
/**
* get the mountpoint of the storage object for a path
( note: because a storage is not always mounted inside the fakeroot, the returned mountpoint is relative to the absolute root of the filesystem and doesn't take the chroot into account
*
* @param string path
* @return string
*/
static public function getMountPoint($path){
OC_Hook::emit(self::CLASSNAME,'get_mountpoint',array('path'=>$path));
if(!$path){

View File

@ -175,10 +175,8 @@ class OC_Helper {
*/
public static function mimetypeIcon( $mimetype ){
$alias=array('application/xml'=>'code/xml');
// echo $mimetype;
if(isset($alias[$mimetype])){
$mimetype=$alias[$mimetype];
// echo $mimetype;
}
// Replace slash with a minus
$mimetype = str_replace( "/", "-", $mimetype );

View File

@ -23,12 +23,12 @@
//From user comments at http://dk2.php.net/manual/en/function.exif-imagetype.php
if ( ! function_exists( 'exif_imagetype' ) ) {
function exif_imagetype ( $filename ) {
if ( ( $info = getimagesize( $filename ) ) !== false ) {
return $info[2];
}
return false;
}
function exif_imagetype ( $filename ) {
if ( ( $info = getimagesize( $filename ) ) !== false ) {
return $info[2];
}
return false;
}
}
function ellipsis($str, $maxlen) {
@ -66,7 +66,6 @@ class OC_Image {
public function __construct($imageref = null) {
//OC_Log::write('core',__METHOD__.'(): start', OC_Log::DEBUG);
if(!extension_loaded('gd') || !function_exists('gd_info')) {
//if(!function_exists('imagecreatefromjpeg')) {
OC_Log::write('core',__METHOD__.'(): GD module not installed', OC_Log::ERROR);
return false;
}

View File

@ -126,19 +126,19 @@ class OC_Installer{
return false;
}
$info=OC_App::getAppInfo($extractDir.'/appinfo/info.xml',true);
// check the code for not allowed calls
if(!OC_Installer::checkCode($info['id'],$extractDir)){
// check the code for not allowed calls
if(!OC_Installer::checkCode($info['id'],$extractDir)){
OC_Log::write('core','App can\'t be installed because of not allowed code in the App',OC_Log::ERROR);
OC_Helper::rmdirr($extractDir);
return false;
return false;
}
// check if the app is compatible with this version of ownCloud
// check if the app is compatible with this version of ownCloud
$version=OC_Util::getVersion();
if(!isset($info['require']) or ($version[0]>$info['require'])){
if(!isset($info['require']) or ($version[0]>$info['require'])){
OC_Log::write('core','App can\'t be installed because it is not compatible with this version of ownCloud',OC_Log::ERROR);
OC_Helper::rmdirr($extractDir);
return false;
return false;
}
//check if an app with the same id is already installed
@ -339,12 +339,12 @@ class OC_Installer{
}
/**
* check the code of an app with some static code checks
* @param string $folder the folder of the app to check
* @returns true for app is o.k. and false for app is not o.k.
*/
public static function checkCode($appname,$folder){
/**
* check the code of an app with some static code checks
* @param string $folder the folder of the app to check
* @returns true for app is o.k. and false for app is not o.k.
*/
public static function checkCode($appname,$folder){
$blacklist=array(
'exec(',
@ -377,9 +377,7 @@ class OC_Installer{
return true;
}else{
return true;
return true;
}
}
}
}

View File

@ -94,12 +94,12 @@ class OC_JSON{
* Encode and print $data in json format
*/
public static function encodedPrint($data,$setContentType=true){
// Disable mimesniffing, don't move this to setContentTypeHeader!
header( 'X-Content-Type-Options: nosniff' );
if($setContentType){
self::setContentTypeHeader();
}
array_walk_recursive($data, array('OC_JSON', 'to_string'));
echo json_encode($data);
// Disable mimesniffing, don't move this to setContentTypeHeader!
header( 'X-Content-Type-Options: nosniff' );
if($setContentType){
self::setContentTypeHeader();
}
array_walk_recursive($data, array('OC_JSON', 'to_string'));
echo json_encode($data);
}
}

View File

@ -111,21 +111,6 @@ class OC_OCS {
$login = self::readData($method, 'login', 'text');
$passwd = self::readData($method, 'password', 'text');
OC_OCS::personcheck($format,$login,$passwd);
/*
} else if ($method == 'post' && $ex[$paracount - 4] == 'v1.php' && $ex[$paracount - 3] == 'person' && $ex[$paracount - 2] == 'add') {
if (OC_Group::inGroup(self::checkPassword(), 'admin')) {
$login = self::readData($method, 'login', 'text');
$password = self::readData($method, 'password', 'text');
try {
OC_User::createUser($login, $password);
echo self::generateXml($format, 'ok', 201, '');
} catch (Exception $exception) {
echo self::generateXml($format, 'fail', 400, $exception->getMessage());
}
} else {
echo self::generateXml($format, 'fail', 403, 'Permission denied');
}
*/
// ACTIVITY
// activityget - GET ACTIVITY page,pagesize als urlparameter
@ -149,8 +134,8 @@ class OC_OCS {
}elseif(($method=='get') and ($ex[$paracount-5] == 'v1.php') and ($ex[$paracount-3] == 'getattribute')){
$app=$ex[$paracount-2];
OC_OCS::privateDataGet($format, $app);
}elseif(($method=='get') and ($ex[$paracount-6] == 'v1.php') and ($ex[$paracount-4] == 'getattribute')){
}elseif(($method=='get') and ($ex[$paracount-6] == 'v1.php') and ($ex[$paracount-4] == 'getattribute')){
$key=$ex[$paracount-2];
$app=$ex[$paracount-3];
OC_OCS::privateDataGet($format, $app,$key);

View File

@ -77,13 +77,13 @@ class OC_Util {
return '5 pre alpha';
}
/**
* get the current installed edition of ownCloud. There is the community edition that just returns an empty string and the enterprise edition that returns "Enterprise".
* @return string
*/
public static function getEditionString(){
return '';
}
/**
* get the current installed edition of ownCloud. There is the community edition that just returns an empty string and the enterprise edition that returns "Enterprise".
* @return string
*/
public static function getEditionString(){
return '';
}
/**
* add a javascript file
@ -131,12 +131,12 @@ class OC_Util {
self::$headers[]=array('tag'=>$tag,'attributes'=>$attributes,'text'=>$text);
}
/**
* formats a timestamp in the "right" way
*
* @param int timestamp $timestamp
* @param bool dateOnly option to ommit time from the result
*/
/**
* formats a timestamp in the "right" way
*
* @param int timestamp $timestamp
* @param bool dateOnly option to ommit time from the result
*/
public static function formatDate( $timestamp,$dateOnly=false){
if(isset($_SESSION['timezone'])){//adjust to clients timezone if we know it
$systemTimeZone = intval(date('O'));
@ -438,26 +438,25 @@ class OC_Util {
}
/**
* Check if the htaccess file is working by creating a test file in the data directory and trying to access via http
*/
public static function ishtaccessworking() {
/**
* Check if the htaccess file is working by creating a test file in the data directory and trying to access via http
*/
public static function ishtaccessworking() {
// testdata
$filename='/htaccesstest.txt';
$testcontent='testcontent';
// creating a test file
$testfile = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" ).'/'.$filename;
$fp = @fopen($testfile, 'w');
@fwrite($fp, $testcontent);
@fclose($fp);
$testfile = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" ).'/'.$filename;
$fp = @fopen($testfile, 'w');
@fwrite($fp, $testcontent);
@fclose($fp);
// accessing the file via http
$url = OC_Helper::serverProtocol(). '://' . OC_Helper::serverHost() . OC::$WEBROOT.'/data'.$filename;
$fp = @fopen($url, 'r');
$content=@fread($fp, 2048);
@fclose($fp);
$url = OC_Helper::serverProtocol(). '://' . OC_Helper::serverHost() . OC::$WEBROOT.'/data'.$filename;
$fp = @fopen($url, 'r');
$content=@fread($fp, 2048);
@fclose($fp);
// cleanup
@unlink($testfile);
@ -467,13 +466,7 @@ class OC_Util {
return(false);
}else{
return(true);
}
}
}
}