Merge branch 'master' of gitorious.org:owncloud/owncloud

This commit is contained in:
Georg Ehrke 2012-06-09 15:40:48 +02:00
commit 9c644fe53b
4 changed files with 20 additions and 8 deletions

View File

@ -432,10 +432,8 @@
<field>
<name>configvalue</name>
<type>text</type>
<default></default>
<type>clob</type>
<notnull>true</notnull>
<length>255</length>
</field>
</declaration>

View File

@ -69,10 +69,10 @@ elseif(OC_User::isLoggedIn()) {
// For all others cases, we display the guest page :
} else {
OC_App::loadApps();
$error = false;
// remember was checked after last login
if(isset($_COOKIE["oc_remember_login"]) && isset($_COOKIE["oc_token"]) && isset($_COOKIE["oc_username"]) && $_COOKIE["oc_remember_login"]) {
OC_App::loadApps(array('authentication'));
if(defined("DEBUG") && DEBUG) {
OC_Log::write('core','Trying to login from cookie',OC_Log::DEBUG);
}
@ -88,6 +88,7 @@ elseif(OC_User::isLoggedIn()) {
// Someone wants to log in :
} elseif(isset($_POST["user"]) and isset($_POST['password']) and isset($_SESSION['sectoken']) and isset($_POST['sectoken']) and ($_SESSION['sectoken']==$_POST['sectoken']) ) {
OC_App::loadApps(array('authentication'));
if(OC_User::login($_POST["user"], $_POST["password"])) {
if(!empty($_POST["remember_login"])){
if(defined("DEBUG") && DEBUG) {
@ -107,6 +108,7 @@ elseif(OC_User::isLoggedIn()) {
// The user is already authenticated using Apaches AuthType Basic... very usable in combination with LDAP
} elseif(isset($_SERVER["PHP_AUTH_USER"]) && isset($_SERVER["PHP_AUTH_PW"])){
OC_App::loadApps(array('authentication'));
if (OC_User::login($_SERVER["PHP_AUTH_USER"],$_SERVER["PHP_AUTH_PW"])) {
//OC_Log::write('core',"Logged in with HTTP Authentication",OC_Log::DEBUG);
OC_User::unsetMagicInCookie();

View File

@ -343,6 +343,20 @@ class OC_Filesystem{
return self::$defaultInstance->getLocalFile($path);
}
/**
* return path to file which reflects one visible in browser
* @param string path
* @return string
*/
static public function getLocalPath($path) {
$datadir = \OCP\Config::getSystemValue('datadirectory').'/'.\OC_User::getUser().'/files';
$newpath = $path;
if (strncmp($newpath, $datadir, strlen($datadir)) == 0) {
$newpath = substr($path, strlen($datadir));
}
return $newpath;
}
/**
* check if the requested path is valid
* @param string path

View File

@ -407,11 +407,9 @@ class OC_Image {
break;
*/
default:
error_log($imagepath);
error_log(\OC_Filesystem::getInternalPath($imagepath));
error_log(\OC_Filesystem::getLocalFile($imagepath));
// this is mostly file created from encrypted file
$this->resource = imagecreatefromstring(\OC_Filesystem::file_get_contents(\OC_Filesystem::getInternalPath($imagepath)));
$this->resource = imagecreatefromstring(\OC_Filesystem::file_get_contents(\OC_Filesystem::getLocalPath($newimgpath)));
$itype = IMAGETYPE_PNG;
OC_Log::write('core','OC_Image->loadFromFile, Default', OC_Log::DEBUG);
break;