summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTom Needham <needham.thomas@gmail.com>2012-01-04 16:31:06 +0000
committerTom Needham <needham.thomas@gmail.com>2012-01-04 16:31:06 +0000
commit6dcabdc61c20ab926af15411c326d13cd49f041b (patch)
tree88c2fc778df014a28ce9ff59c885d4ba9cfddf9e /lib
parentebe3ae58cffa8c16ef2b1b74c5b7a9228a5495ff (diff)
parente0a058c732cc9d1f279cd6604623d9bf7c196744 (diff)
downloadnextcloud-server-6dcabdc61c20ab926af15411c326d13cd49f041b.tar.gz
nextcloud-server-6dcabdc61c20ab926af15411c326d13cd49f041b.zip
Fixed merge conflict in /files/ajax/move.php
Diffstat (limited to 'lib')
-rw-r--r--lib/filestorage/local.php2
-rw-r--r--lib/filesystem.php58
-rw-r--r--lib/image.php474
-rw-r--r--lib/setup.php2
-rw-r--r--lib/user.php2
-rw-r--r--lib/util.php2
6 files changed, 500 insertions, 40 deletions
diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php
index 9e29f85071a..cfc27159786 100644
--- a/lib/filestorage/local.php
+++ b/lib/filestorage/local.php
@@ -53,7 +53,7 @@ class OC_Filestorage_Local extends OC_Filestorage{
return is_readable($this->datadir.$path);
}
public function is_writeable($path){
- return is_writeable($this->datadir.$path);
+ return is_writable($this->datadir.$path);
}
public function file_exists($path){
return file_exists($this->datadir.$path);
diff --git a/lib/filesystem.php b/lib/filesystem.php
index cae8ead5b16..44401260c5e 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -131,35 +131,6 @@ class OC_Filesystem{
}
/**
- * check if the current users has the right premissions to read a file
- * @param string path
- * @return bool
- */
- static private function canRead($path){
- if(substr($path,0,1)!=='/'){
- $path='/'.$path;
- }
- if(strstr($path,'/../') || strrchr($path, '/') === '/..' ){
- return false;
- }
- return true;//dummy untill premissions are correctly implemented, also the correcty value because for now users are locked in their seperate data dir and can read/write everything in there
- }
- /**
- * check if the current users has the right premissions to write a file
- * @param string path
- * @return bool
- */
- static private function canWrite($path){
- if(substr($path,0,1)!=='/'){
- $path='/'.$path;
- }
- if(strstr($path,'/../') || strrchr($path, '/') === '/..' ){
- return false;
- }
- return true;//dummy untill premissions are correctly implemented, also the correcty value because for now users are locked in their seperate data dir and can read/write everything in there
- }
-
- /**
* mount an OC_Filestorage in our virtual filesystem
* @param OC_Filestorage storage
* @param string mountpoint
@@ -228,11 +199,26 @@ class OC_Filesystem{
*/
static public function getLocalFile($path){
$parent=substr($path,0,strrpos($path,'/'));
- if(self::canRead($parent) and $storage=self::getStorage($path)){
+ if(self::isValidPath($parent) and $storage=self::getStorage($path)){
return $storage->getLocalFile(self::getInternalPath($path));
}
}
+ /**
+ * check if the requested path is valid
+ * @param string path
+ * @return bool
+ */
+ static public function isValidPath($path){
+ if(substr($path,0,1)!=='/'){
+ $path='/'.$path;
+ }
+ if(strstr($path,'/../') || strrchr($path, '/') === '/..' ){
+ return false;
+ }
+ return true;
+ }
+
static public function mkdir($path){
return self::basicOperation('mkdir',$path,array('create','write'));
}
@@ -297,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::canWrite($path1) and self::canWrite($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){
@@ -318,7 +304,7 @@ class OC_Filesystem{
}
}
static public function copy($path1,$path2){
- if(OC_FileProxy::runPreProxies('copy',$path1,$path2) and self::canRead($path1) and self::canWrite($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);
@@ -373,13 +359,13 @@ class OC_Filesystem{
return self::basicOperation('fopen',$path,$hooks,$mode);
}
static public function toTmpFile($path){
- if(OC_FileProxy::runPreProxies('toTmpFile',$path) and self::canRead($path) and $storage=self::getStorage($path)){
+ if(OC_FileProxy::runPreProxies('toTmpFile',$path) and self::isValidPath($path) and $storage=self::getStorage($path)){
OC_Hook::emit( 'OC_Filesystem', 'read', array( 'path' => $path));
return $storage->toTmpFile(self::getInternalPath($path));
}
}
static public function fromTmpFile($tmpFile,$path){
- if(OC_FileProxy::runPreProxies('copy',$tmpFile,$path) and self::canWrite($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){
@@ -399,7 +385,7 @@ class OC_Filesystem{
}
}
static public function fromUploadedFile($tmpFile,$path){
- if(OC_FileProxy::runPreProxies('fromUploadedFile',$tmpFile,$path) and self::canWrite($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){
@@ -462,7 +448,7 @@ class OC_Filesystem{
* @return mixed
*/
private static function basicOperation($operation,$path,$hooks=array(),$extraParam=null){
- if(OC_FileProxy::runPreProxies($operation,$path, $extraParam) and self::canRead($path) and $storage=self::getStorage($path)){
+ if(OC_FileProxy::runPreProxies($operation,$path, $extraParam) and self::isValidPath($path) and $storage=self::getStorage($path)){
$interalPath=self::getInternalPath($path);
$run=true;
foreach($hooks as $hook){
diff --git a/lib/image.php b/lib/image.php
new file mode 100644
index 00000000000..e09486be081
--- /dev/null
+++ b/lib/image.php
@@ -0,0 +1,474 @@
+<?php
+
+/**
+* ownCloud
+*
+* @author Thomas Tanghus
+* @copyright 2011 Thomas Tanghus <thomas@tanghus.net>
+*
+* 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/>.
+*
+*/
+
+/** From user comments at http://dk2.php.net/manual/en/function.exif-imagetype.php
+ * Don't know if it can come in handy?
+if ( ! function_exists( 'exif_imagetype' ) ) {
+ function exif_imagetype ( $filename ) {
+ if ( ( list($width, $height, $type, $attr) = getimagesize( $filename ) ) !== false ) {
+ return $type;
+ }
+ return false;
+ }
+}
+*/
+
+function ellipsis($str, $maxlen) {
+ if (strlen($str) > $maxlen) {
+ $characters = floor($maxlen / 2);
+ return substr($str, 0, $characters) . '...' . substr($str, -1 * $characters);
+ }
+ return $str;
+}
+
+/**
+ * Class for image manipulation
+ * Ideas: imagerotate, chunk_split(base64_encode())
+ *
+ */
+class OC_Image {
+ static private $resource = false; // tmp resource.
+ static private $destroy = false; // if the resource is created withing the object.
+ static private $imagetype = IMAGETYPE_PNG; // Default to png if file type isn't evident.
+ static private $filepath = null;
+ /**
+ * @brief Constructor.
+ * @param $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function.
+ * If a resource is passed it is the job of the caller to destroy it using imagedestroy($var)
+ * @returns bool False on error
+ */
+ function __construct($imageref = null) {
+ //OC_Log::write('core','OC_Image::__construct, start', OC_Log::DEBUG);
+ if(!extension_loaded('gd') || !function_exists('gd_info')) {
+ //if(!function_exists('imagecreatefromjpeg')) {
+ OC_Log::write('core','OC_Image::__construct, GD module not installed', OC_Log::ERROR);
+ return false;
+ }
+ if(!is_null($imageref)) {
+ self::load($imageref);
+ }
+ }
+
+ /**
+ * @brief Destructor.
+ */
+ function __destruct() {
+ if(is_resource(self::$resource) && self::$destroy) {
+ imagedestroy(self::$resource); // Why does this issue a warning.
+ }
+ }
+
+ /**
+ * @brief Determine whether the object contains an image resource.
+ * @returns bool
+ */
+ public function valid() { // apparently you can't name a method 'empty'...
+ $ret = is_resource(self::$resource);
+ return $ret;
+ }
+
+ /**
+ * @brief Returns the MIME type of the image or an empty string if no image is loaded.
+ * @returns int
+ */
+ public function mimeType() {
+ return is_resource(self::$resource) ? image_type_to_mime_type(self::$imagetype) : '';
+ }
+
+ /**
+ * @brief Returns the width of the image or -1 if no image is loaded.
+ * @returns int
+ */
+ public function width() {
+ return is_resource(self::$resource) ? imagesx(self::$resource) : -1;
+ }
+
+ /**
+ * @brief Returns the height of the image or -1 if no image is loaded.
+ * @returns int
+ */
+ public function height() {
+ return is_resource(self::$resource) ? imagesy(self::$resource) : -1;
+ }
+
+ /**
+ * @brief Outputs the image.
+ * @returns bool
+ */
+ public function show() {
+ return $this->_output();
+ }
+
+ /**
+ * @brief Saves the image.
+ * @returns bool
+ */
+
+ public function save($filepath=null) {
+ if($filepath === null && $this->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) {
+ $filepath = $this->filepath;
+ }
+ return $this->_output($filepath, true);
+ }
+
+ /**
+ * @brief Outputs/saves the image.
+ */
+ private function _output($filepath=null, $really=false) {
+ header('Content-Type: '.self::mimeType());
+ if($really === false) {
+ $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);
+ 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);
+ return false;
+ }
+ }
+ $retval = false;
+ switch(self::$imagetype) {
+ case IMAGETYPE_GIF:
+ $retval = imagegif(self::$resource, $filepath);
+ break;
+ case IMAGETYPE_JPEG:
+ $retval = imagejpeg(self::$resource, $filepath);
+ break;
+ case IMAGETYPE_PNG:
+ $retval = imagepng(self::$resource, $filepath);
+ break;
+ case IMAGETYPE_XBM:
+ $retval = imagexbm(self::$resource, $filepath);
+ break;
+ case IMAGETYPE_WBMP:
+ case IMAGETYPE_BMP:
+ $retval = imagewbmp(self::$resource, $filepath);
+ break;
+ default:
+ $retval = imagepng(self::$resource, $filepath);
+ }
+ return $retval;
+ }
+
+ /**
+ * @brief Prints the image when called as $image().
+ */
+ public function __invoke() {
+ return self::show();
+ }
+
+ /**
+ * @returns Returns the image resource in any.
+ */
+ public function resource() {
+ return self::$resource;
+ }
+
+ /**
+ * @returns Returns a base64 encoded string suitable for embedding in a VCard.
+ */
+ function __toString() {
+ ob_start();
+ $res = imagepng(self::$resource);
+ if (!$res) {
+ OC_Log::write('core','OC_Image::_string. Error writing image',OC_Log::ERROR);
+ }
+ return chunk_split(base64_encode(ob_get_clean()));
+ }
+
+ /**
+ * @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.
+ * If a resource is passed it is the job of the caller to destroy it using imagedestroy($var)
+ * @returns An image resource or false on error
+ */
+ public function load($imageref) {
+ if(self::loadFromFile($imageref) !== false) {
+ return self::$resource;
+ } elseif(self::loadFromBase64($imageref) !== false) {
+ return self::$resource;
+ } elseif(self::loadFromData($imageref) !== false) {
+ return self::$resource;
+ } elseif(self::loadFromResource($imageref) !== false) {
+ return self::$resource;
+ } else {
+ OC_Log::write('core','OC_Image::load, couldn\'t load anything. Giving up!', OC_Log::DEBUG);
+ return false;
+ }
+ }
+
+ /**
+ * @brief Loads an image from a local file.
+ * @param $imageref The path to a local file.
+ * @returns An image resource or false on error
+ */
+ public function loadFromFile($imagepath=false) {
+ if(!is_file($imagepath) || !file_exists($imagepath) || !is_readable($imagepath)) {
+ // Debug output disabled because this method is tried before loadFromBase64?
+ OC_Log::write('core','OC_Image::loadFromFile, couldn\'t load: '.ellipsis($imagepath, 50), OC_Log::DEBUG);
+ return false;
+ }
+ $itype = exif_imagetype($imagepath);
+ switch($itype) {
+ case IMAGETYPE_GIF:
+ if (imagetypes() & IMG_GIF) {
+ self::$resource = imagecreatefromgif($imagepath);
+ } else {
+ OC_Log::write('core','OC_Image::loadFromFile, GIF images not supported: '.$imagepath, OC_Log::DEBUG);
+ }
+ break;
+ case IMAGETYPE_JPEG:
+ if (imagetypes() & IMG_JPG) {
+ self::$resource = imagecreatefromjpeg($imagepath);
+ } else {
+ OC_Log::write('core','OC_Image::loadFromFile, JPG images not supported: '.$imagepath, OC_Log::DEBUG);
+ }
+ break;
+ case IMAGETYPE_PNG:
+ if (imagetypes() & IMG_PNG) {
+ self::$resource = imagecreatefrompng($imagepath);
+ } else {
+ OC_Log::write('core','OC_Image::loadFromFile, PNG images not supported: '.$imagepath, OC_Log::DEBUG);
+ }
+ break;
+ case IMAGETYPE_XBM:
+ if (imagetypes() & IMG_XPM) {
+ self::$resource = imagecreatefromxbm($imagepath);
+ } else {
+ OC_Log::write('core','OC_Image::loadFromFile, XBM/XPM images not supported: '.$imagepath, OC_Log::DEBUG);
+ }
+ break;
+ case IMAGETYPE_WBMP:
+ case IMAGETYPE_BMP:
+ if (imagetypes() & IMG_WBMP) {
+ self::$resource = imagecreatefromwbmp($imagepath);
+ } else {
+ OC_Log::write('core','OC_Image::loadFromFile, (W)BMP images not supported: '.$imagepath, OC_Log::DEBUG);
+ }
+ break;
+ /*
+ case IMAGETYPE_TIFF_II: // (intel byte order)
+ break;
+ case IMAGETYPE_TIFF_MM: // (motorola byte order)
+ break;
+ case IMAGETYPE_JPC:
+ break;
+ case IMAGETYPE_JP2:
+ break;
+ case IMAGETYPE_JPX:
+ break;
+ case IMAGETYPE_JB2:
+ break;
+ case IMAGETYPE_SWC:
+ break;
+ case IMAGETYPE_IFF:
+ break;
+ case IMAGETYPE_ICO:
+ break;
+ case IMAGETYPE_SWF:
+ break;
+ case IMAGETYPE_PSD:
+ break;
+ */
+ default:
+ self::$resource = imagecreatefromstring(file_get_contents($imagepath));
+ $itype = IMAGETYPE_PNG;
+ OC_Log::write('core','OC_Image::loadFromFile, Default', OC_Log::DEBUG);
+ break;
+ }
+ if($this->valid()) {
+ self::$imagetype = $itype;
+ self::$filepath = $imagepath;
+ self::$destroy = true;
+ }
+ return self::$resource;
+ }
+
+ /**
+ * @brief Loads an image from a string of data.
+ * @param $str A string of image data as read from a file.
+ * @returns An image resource or false on error
+ */
+ public function loadFromData($str) {
+ if(is_resource($str)) {
+ return false;
+ }
+ self::$resource = imagecreatefromstring($str);
+ if(!self::$resource) {
+ OC_Log::write('core','OC_Image::loadFromData, couldn\'t load', OC_Log::DEBUG);
+ return false;
+ }
+ self::$destroy = true;
+ return self::$resource;
+ }
+
+ /**
+ * @brief Loads an image from a base64 encoded string.
+ * @param $str A string base64 encoded string of image data.
+ * @returns An image resource or false on error
+ */
+ public function loadFromBase64($str) {
+ if(!is_string($str)) {
+ return false;
+ }
+ $data = base64_decode($str);
+ if($data) { // try to load from string data
+ self::$resource = imagecreatefromstring($data);
+ if(!self::$resource) {
+ OC_Log::write('core','OC_Image::loadFromBase64, couldn\'t load', OC_Log::DEBUG);
+ return false;
+ }
+ self::$destroy = true;
+ return self::$resource;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * @brief Checks if image resource is valid and assigns it to self::$resource.
+ * @param $res An image resource.
+ * @returns An image resource or false on error
+ */
+ public function loadFromResource($res) {
+ if(!is_resource($res)) {
+ return false;
+ }
+ self::$resource = $res;
+ }
+
+ /**
+ * @brief Resizes the image preserving ratio.
+ * @param $maxsize The maximum size of either the width or height.
+ * @returns bool
+ */
+ public function resize($maxsize) {
+ if(!self::$resource) {
+ OC_Log::write('core','OC_Image::resize, No image loaded', OC_Log::ERROR);
+ return false;
+ }
+ $width_orig=imageSX(self::$resource);
+ $height_orig=imageSY(self::$resource);
+ $ratio_orig = $width_orig/$height_orig;
+
+ if ($ratio_orig > 1) {
+ $new_height = round($maxsize/$ratio_orig);
+ $new_width = $maxsize;
+ } else {
+ $new_width = round($maxsize*$ratio_orig);
+ $new_height = $maxsize;
+ }
+
+ $process = imagecreatetruecolor(round($new_width), round($new_height));
+ if ($process == false) {
+ OC_Log::write('core','OC_Image::resize. Error creating true color image',OC_Log::ERROR);
+ imagedestroy($process);
+ return false;
+ }
+
+ imagecopyresampled($process, self::$resource, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig);
+ if ($process == false) {
+ OC_Log::write('core','OC_Image::resize. Error resampling process image '.$new_width.'x'.$new_height,OC_Log::ERROR);
+ imagedestroy($process);
+ return false;
+ }
+ self::$resource = $process;
+ return true;
+ }
+
+ /**
+ * @brief Crops the image to the middle square. If the image is already square it just returns.
+ * @returns bool for success or failure
+ */
+ public function centerCrop() {
+ if(!self::$resource) {
+ OC_Log::write('core','OC_Image::centerCrop, No image loaded', OC_Log::ERROR);
+ return false;
+ }
+ $width_orig=imageSX(self::$resource);
+ $height_orig=imageSY(self::$resource);
+ if($width_orig === $height_orig) {
+ return true;
+ }
+ $ratio_orig = $width_orig/$height_orig;
+ $width = $height = min($width_orig, $height_orig);
+
+ if ($ratio_orig > 1) {
+ $x = ($width_orig/2) - ($width/2);
+ $y = 0;
+ } else {
+ $y = ($height_orig/2) - ($height/2);
+ $x = 0;
+ }
+ $process = imagecreatetruecolor($width, $height);
+ if ($process == false) {
+ OC_Log::write('core','OC_Image::centerCrop. Error creating true color image',OC_Log::ERROR);
+ imagedestroy($process);
+ return false;
+ }
+ imagecopyresampled($process, self::$resource, 0, 0, $x, $y, $width, $height, $width, $height);
+ if ($process == false) {
+ OC_Log::write('core','OC_Image::centerCrop. Error resampling process image '.$width.'x'.$height,OC_Log::ERROR);
+ imagedestroy($process);
+ return false;
+ }
+ self::$resource = $process;
+ return true;
+ }
+
+ /**
+ * @brief Crops the image from point $x$y with dimension $wx$h.
+ * @param $x Horizontal position
+ * @param $y Vertical position
+ * @param $w Width
+ * @param $h Hight
+ * @returns bool for success or failure
+ */
+ public function crop($x, $y, $w, $h) {
+ if(!self::$resource) {
+ OC_Log::write('core','OC_Image::crop, No image loaded', OC_Log::ERROR);
+ return false;
+ }
+ $width_orig=imageSX(self::$resource);
+ $height_orig=imageSY(self::$resource);
+ //OC_Log::write('core','OC_Image::crop. Original size: '.$width_orig.'x'.$height_orig, OC_Log::DEBUG);
+ $process = imagecreatetruecolor($w, $h);
+ if ($process == false) {
+ OC_Log::write('core','OC_Image::crop. Error creating true color image',OC_Log::ERROR);
+ imagedestroy($process);
+ return false;
+ }
+ imagecopyresampled($process, self::$resource, 0, 0, $x, $y, $w, $h, $w, $h);
+ if ($process == false) {
+ OC_Log::write('core','OC_Image::crop. Error resampling process image '.$w.'x'.$h,OC_Log::ERROR);
+ imagedestroy($process);
+ return false;
+ }
+ self::$resource = $process;
+ return true;
+ }
+}
diff --git a/lib/setup.php b/lib/setup.php
index 8afe0070e9b..b53c626c9a7 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -275,7 +275,7 @@ class OC_Setup {
$content.= "php_value post_max_size 512M\n";
$content.= "SetEnv htaccessWorking true\n";
$content.= "</IfModule>\n";
- $content.= "<IfModule !mod_php5.c>\n";
+ $content.= "<IfModule mod_rewrite.c>";
$content.= "RewriteEngine on\n";
$content.= "RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last]\n";
$content.= "</IfModule>\n";
diff --git a/lib/user.php b/lib/user.php
index 241d9aa8b10..0a5881ec0f8 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -120,7 +120,7 @@ class OC_User {
return false;
}
// No empty username
- if( !$uid ){
+ if(trim($uid) == ''){
return false;
}
// Check if user already exists
diff --git a/lib/util.php b/lib/util.php
index 9cf78da6e90..009119b54a9 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -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" );