Merge branch 'master' into calendar
This commit is contained in:
commit
db490fbc8f
|
@ -3,4 +3,4 @@ $appInfoDir = __DIR__;
|
|||
$thisAppDir = dirname($appInfoDir);
|
||||
$appsDir = dirname($thisAppDir);
|
||||
$ownCloudDir = dirname($appsDir);
|
||||
symlink($thisAppDir, $ownCloudDir.'/.well-known');
|
||||
@symlink($thisAppDir, $ownCloudDir.'/.well-known');
|
||||
|
|
|
@ -283,7 +283,7 @@ class OC_Filesystem{
|
|||
return self::basicOperation('unlink',$path,array('delete'));
|
||||
}
|
||||
static public function rename($path1,$path2){
|
||||
if(OC_FileProxy::runPreProxies('rename',$path1,$path2) and self::is_writeable($path1) and self::is_writeable($path2)){
|
||||
if(OC_FileProxy::runPreProxies('rename',$path1,$path2) and self::is_writeable($path1) and self::isValidPath($path2)){
|
||||
$run=true;
|
||||
OC_Hook::emit( 'OC_Filesystem', 'rename', array( 'oldpath' => $path1 ,'newpath'=>$path2, 'run' => &$run));
|
||||
if($run){
|
||||
|
@ -304,7 +304,7 @@ class OC_Filesystem{
|
|||
}
|
||||
}
|
||||
static public function copy($path1,$path2){
|
||||
if(OC_FileProxy::runPreProxies('copy',$path1,$path2) and self::is_readable($path1) and self::is_writeable($path2)){
|
||||
if(OC_FileProxy::runPreProxies('copy',$path1,$path2) and self::is_readable($path1) and self::isValidPath($path2)){
|
||||
$run=true;
|
||||
OC_Hook::emit( 'OC_Filesystem', 'copy', array( 'oldpath' => $path1 ,'newpath'=>$path2, 'run' => &$run));
|
||||
$exists=self::file_exists($path2);
|
||||
|
@ -365,7 +365,7 @@ class OC_Filesystem{
|
|||
}
|
||||
}
|
||||
static public function fromTmpFile($tmpFile,$path){
|
||||
if(OC_FileProxy::runPreProxies('copy',$tmpFile,$path) and self::is_writeable($path) and $storage=self::getStorage($path)){
|
||||
if(OC_FileProxy::runPreProxies('copy',$tmpFile,$path) and self::isValidPath($path) and $storage=self::getStorage($path)){
|
||||
$run=true;
|
||||
$exists=self::file_exists($path);
|
||||
if(!$exists){
|
||||
|
@ -385,7 +385,7 @@ class OC_Filesystem{
|
|||
}
|
||||
}
|
||||
static public function fromUploadedFile($tmpFile,$path){
|
||||
if(OC_FileProxy::runPreProxies('fromUploadedFile',$tmpFile,$path) and self::is_writeable($path) and $storage=self::getStorage($path)){
|
||||
if(OC_FileProxy::runPreProxies('fromUploadedFile',$tmpFile,$path) and self::isValidPath($path) and $storage=self::getStorage($path)){
|
||||
$run=true;
|
||||
$exists=self::file_exists($path);
|
||||
if(!$exists){
|
||||
|
|
|
@ -42,8 +42,7 @@ function ellipsis($str, $maxlen) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Class for image manipulation
|
||||
* Ideas: imagerotate, chunk_split(base64_encode())
|
||||
* Class for basic image manipulation
|
||||
*
|
||||
*/
|
||||
class OC_Image {
|
||||
|
@ -125,7 +124,7 @@ class OC_Image {
|
|||
*/
|
||||
|
||||
public function save($filepath=null) {
|
||||
if($filepath === null && $this->filepath === null) {
|
||||
if($filepath === null && self::$filepath === null) {
|
||||
OC_Log::write('core','OC_Image::save. save() called with no path.', OC_Log::ERROR);
|
||||
return false;
|
||||
} elseif($filepath === null && $this->filepath !== null) {
|
||||
|
@ -138,15 +137,15 @@ class OC_Image {
|
|||
* @brief Outputs/saves the image.
|
||||
*/
|
||||
private function _output($filepath=null, $really=false) {
|
||||
header('Content-Type: '.self::mimeType());
|
||||
if($really === false) {
|
||||
header('Content-Type: '.self::mimeType());
|
||||
$filepath = null; // Just being cautious ;-)
|
||||
} else {
|
||||
if(!is_writable(dirname($filepath))) {
|
||||
OC_Log::write('core','OC_Image::save. Directory \''.dirname($filepath).'\' is not writable.', OC_Log::ERROR);
|
||||
OC_Log::write('core','OC_Image::_output. Directory \''.dirname($filepath).'\' is not writable.', OC_Log::ERROR);
|
||||
return false;
|
||||
} elseif(is_writable(dirname($filepath)) && !is_writable($filepath)) {
|
||||
OC_Log::write('core','OC_Image::save. File \''.$filepath.'\' is not writable.', OC_Log::ERROR);
|
||||
} elseif(is_writable(dirname($filepath)) && file_exists($filepath) && !is_writable($filepath)) {
|
||||
OC_Log::write('core','OC_Image::_output. File \''.$filepath.'\' is not writable.', OC_Log::ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -200,6 +199,87 @@ class OC_Image {
|
|||
return chunk_split(base64_encode(ob_get_clean()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Fixes orientation based on EXIF data.
|
||||
* @returns bool.
|
||||
*/
|
||||
public function fixOrientation() {
|
||||
if(!is_resource(self::$resource)) {
|
||||
OC_Log::write('core','OC_Image::fixOrientation() No image loaded.', OC_Log::DEBUG);
|
||||
return false;
|
||||
}
|
||||
if(is_null(self::$filepath) || !is_readable(self::$filepath)) {
|
||||
OC_Log::write('core','OC_Image::fixOrientation() No readable file path set.', OC_Log::DEBUG);
|
||||
return false;
|
||||
}
|
||||
$exif = exif_read_data(self::$filepath, 'IFD0');
|
||||
if(!$exif) {
|
||||
return false;
|
||||
}
|
||||
if(!isset($exif['Orientation'])) {
|
||||
return true; // Nothing to fix
|
||||
}
|
||||
$o = $exif['Orientation'];
|
||||
OC_Log::write('core','OC_Image::fixOrientation() Orientation: '.$o, OC_Log::DEBUG);
|
||||
$rotate = 0;
|
||||
$flip = false;
|
||||
switch($o) {
|
||||
case 1:
|
||||
$rotate = 0;
|
||||
$flip = false;
|
||||
break;
|
||||
case 2: // Not tested
|
||||
$rotate = 0;
|
||||
$flip = true;
|
||||
break;
|
||||
case 3:
|
||||
$rotate = 180;
|
||||
$flip = false;
|
||||
break;
|
||||
case 4: // Not tested
|
||||
$rotate = 180;
|
||||
$flip = true;
|
||||
break;
|
||||
case 5: // Not tested
|
||||
$rotate = 90;
|
||||
$flip = true;
|
||||
break;
|
||||
case 6:
|
||||
//$rotate = 90;
|
||||
$rotate = 270;
|
||||
$flip = false;
|
||||
break;
|
||||
case 7: // Not tested
|
||||
$rotate = 270;
|
||||
$flip = true;
|
||||
break;
|
||||
case 8:
|
||||
$rotate = 270;
|
||||
$flip = false;
|
||||
break;
|
||||
}
|
||||
if($rotate) {
|
||||
$res = imagerotate(self::$resource, $rotate, -1);
|
||||
if($res) {
|
||||
if(imagealphablending($res, true)) {
|
||||
if(imagesavealpha($res, true)) {
|
||||
self::$resource = $res;
|
||||
return true;
|
||||
} else {
|
||||
OC_Log::write('core','OC_Image::fixOrientation() Error during alphasaving.', OC_Log::DEBUG);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
OC_Log::write('core','OC_Image::fixOrientation() Error during alphablending.', OC_Log::DEBUG);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
OC_Log::write('core','OC_Image::fixOrientation() Error during oriention fixing.', OC_Log::DEBUG);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Loads an image from a local file, a base64 encoded string or a resource created by an imagecreate* function.
|
||||
* @param $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function.
|
||||
|
|
|
@ -169,7 +169,8 @@ class OC_User {
|
|||
foreach( OC_Group::getUserGroups( $uid ) as $i ){
|
||||
OC_Group::removeFromGroup( $uid, $i );
|
||||
}
|
||||
|
||||
// Delete the user's keys in preferences
|
||||
OC_Preferences::deleteUser($uid);
|
||||
// Emit and exit
|
||||
OC_Hook::emit( "OC_User", "post_deleteUser", array( "uid" => $uid ));
|
||||
return true;
|
||||
|
|
|
@ -175,7 +175,7 @@ class OC_Util {
|
|||
$errors=array();
|
||||
|
||||
//check for database drivers
|
||||
if(!is_callable('sqlite_open') and !is_callable('mysql_connect') and !is_callable('pg_connect')){
|
||||
if(!(is_callable('sqlite_open') or class_exists('SQLite3')) and !is_callable('mysql_connect') and !is_callable('pg_connect')){
|
||||
$errors[]=array('error'=>'No database drivers (sqlite, mysql, or postgresql) installed.<br/>','hint'=>'');//TODO: sane hint
|
||||
}
|
||||
$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
|
||||
|
|
Loading…
Reference in New Issue