Checkstyle fixes: NoSpaceAfterComma
This commit is contained in:
parent
f8d1d7787e
commit
30d7993e01
|
@ -44,7 +44,7 @@ if(OC_Filesystem::file_exists($base) and OC_Filesystem::is_dir($base)) {
|
||||||
if(substr(strtolower($file), 0, $queryLen)==$query) {
|
if(substr(strtolower($file), 0, $queryLen)==$query) {
|
||||||
$item=$base.$file;
|
$item=$base.$file;
|
||||||
if((!$dirOnly or OC_Filesystem::is_dir($item))) {
|
if((!$dirOnly or OC_Filesystem::is_dir($item))) {
|
||||||
$files[]=(object)array('id'=>$item,'label'=>$item,'name'=>$item);
|
$files[]=(object)array('id'=>$item, 'label'=>$item, 'name'=>$item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ if(strpos($dir, '..') === false) {
|
||||||
if(is_uploaded_file($files['tmp_name'][$i]) and OC_Filesystem::fromTmpFile($files['tmp_name'][$i], $target)) {
|
if(is_uploaded_file($files['tmp_name'][$i]) and OC_Filesystem::fromTmpFile($files['tmp_name'][$i], $target)) {
|
||||||
$meta = OC_FileCache::get($target);
|
$meta = OC_FileCache::get($target);
|
||||||
$id = OC_FileCache::getId($target);
|
$id = OC_FileCache::getId($target);
|
||||||
$result[]=array( "status" => "success", 'mime'=>$meta['mimetype'],'size'=>$meta['size'], 'id'=>$id, 'name'=>basename($target));
|
$result[]=array( "status" => "success", 'mime'=>$meta['mimetype'], 'size'=>$meta['size'], 'id'=>$id, 'name'=>basename($target));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OCP\JSON::encodedPrint($result);
|
OCP\JSON::encodedPrint($result);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// load needed apps
|
// load needed apps
|
||||||
$RUNTIME_APPTYPES=array('filesystem','authentication','logging');
|
$RUNTIME_APPTYPES=array('filesystem', 'authentication', 'logging');
|
||||||
OC_App::loadApps($RUNTIME_APPTYPES);
|
OC_App::loadApps($RUNTIME_APPTYPES);
|
||||||
if(!OC_User::isLoggedIn()) {
|
if(!OC_User::isLoggedIn()) {
|
||||||
if(!isset($_SERVER['PHP_AUTH_USER'])) {
|
if(!isset($_SERVER['PHP_AUTH_USER'])) {
|
||||||
|
@ -36,7 +36,7 @@ if(!OC_User::isLoggedIn()) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list($type,$file) = explode('/', substr($path_info, 1+strlen($service)+1), 2);
|
list($type, $file) = explode('/', substr($path_info, 1+strlen($service)+1), 2);
|
||||||
|
|
||||||
if ($type != 'oc_chunked') {
|
if ($type != 'oc_chunked') {
|
||||||
OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
|
OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// load needed apps
|
// load needed apps
|
||||||
$RUNTIME_APPTYPES=array('filesystem','authentication','logging');
|
$RUNTIME_APPTYPES=array('filesystem', 'authentication', 'logging');
|
||||||
|
|
||||||
OC_App::loadApps($RUNTIME_APPTYPES);
|
OC_App::loadApps($RUNTIME_APPTYPES);
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ foreach($filesToRemove as $file) {
|
||||||
$success = OCP\Files::rmdirr($filepath);
|
$success = OCP\Files::rmdirr($filepath);
|
||||||
if($success === false) {
|
if($success === false) {
|
||||||
//probably not sufficient privileges, give up and give a message.
|
//probably not sufficient privileges, give up and give a message.
|
||||||
OCP\Util::writeLog('files','Could not clean /files/ directory. Please remove everything except webdav.php from ' . OC::$SERVERROOT . '/files/', OCP\Util::ERROR);
|
OCP\Util::writeLog('files', 'Could not clean /files/ directory. Please remove everything except webdav.php from ' . OC::$SERVERROOT . '/files/', OCP\Util::ERROR);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ $breadcrumb = array();
|
||||||
$pathtohere = '';
|
$pathtohere = '';
|
||||||
foreach( explode( '/', $dir ) as $i ) {
|
foreach( explode( '/', $dir ) as $i ) {
|
||||||
if( $i != '' ) {
|
if( $i != '' ) {
|
||||||
$pathtohere .= '/'.str_replace('+','%20', urlencode($i));
|
$pathtohere .= '/'.str_replace('+', '%20', urlencode($i));
|
||||||
$breadcrumb[] = array( 'dir' => $pathtohere, 'name' => $i );
|
$breadcrumb[] = array( 'dir' => $pathtohere, 'name' => $i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?php OCP\Util::addscript('files','admin'); ?>
|
<?php OCP\Util::addscript('files', 'admin'); ?>
|
||||||
|
|
||||||
<form name="filesForm" action='#' method='post'>
|
<form name="filesForm" action='#' method='post'>
|
||||||
<fieldset class="personalblock">
|
<fieldset class="personalblock">
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<ul class="popup popupTop">
|
<ul class="popup popupTop">
|
||||||
<li style="background-image:url('<?php echo OCP\mimetype_icon('text/plain') ?>')" data-type='file'><p><?php echo $l->t('Text file');?></p></li>
|
<li style="background-image:url('<?php echo OCP\mimetype_icon('text/plain') ?>')" data-type='file'><p><?php echo $l->t('Text file');?></p></li>
|
||||||
<li style="background-image:url('<?php echo OCP\mimetype_icon('dir') ?>')" data-type='folder'><p><?php echo $l->t('Folder');?></p></li>
|
<li style="background-image:url('<?php echo OCP\mimetype_icon('dir') ?>')" data-type='folder'><p><?php echo $l->t('Folder');?></p></li>
|
||||||
<li style="background-image:url('<?php echo OCP\image_path('core','actions/public.png') ?>')" data-type='web'><p><?php echo $l->t('From link');?></p></li>
|
<li style="background-image:url('<?php echo OCP\image_path('core', 'actions/public.png') ?>')" data-type='web'><p><?php echo $l->t('From link');?></p></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="file_upload_wrapper svg">
|
<div class="file_upload_wrapper svg">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php for($i=0; $i<count($_["breadcrumb"]); $i++):
|
<?php for($i=0; $i<count($_["breadcrumb"]); $i++):
|
||||||
$crumb = $_["breadcrumb"][$i]; ?>
|
$crumb = $_["breadcrumb"][$i]; ?>
|
||||||
<div class="crumb <?php if($i == count($_["breadcrumb"])-1) echo 'last';?> svg" data-dir='<?php echo urlencode($crumb["dir"]);?>' style='background-image:url("<?php echo OCP\image_path('core','breadcrumb.png');?>")'>
|
<div class="crumb <?php if($i == count($_["breadcrumb"])-1) echo 'last';?> svg" data-dir='<?php echo urlencode($crumb["dir"]);?>' style='background-image:url("<?php echo OCP\image_path('core', 'breadcrumb.png');?>")'>
|
||||||
<a href="<?php echo $_['baseURL'].urlencode($crumb["dir"]); ?>"><?php echo OCP\Util::sanitizeHTML($crumb["name"]); ?></a>
|
<a href="<?php echo $_['baseURL'].urlencode($crumb["dir"]); ?>"><?php echo OCP\Util::sanitizeHTML($crumb["name"]); ?></a>
|
||||||
</div>
|
</div>
|
||||||
<?php endfor;?>
|
<?php endfor;?>
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
$relative_modified_date = OCP\relative_modified_date($file['mtime']);
|
$relative_modified_date = OCP\relative_modified_date($file['mtime']);
|
||||||
$relative_date_color = round((time()-$file['mtime'])/60/60/24*14); // the older the file, the brighter the shade of grey; days*14
|
$relative_date_color = round((time()-$file['mtime'])/60/60/24*14); // the older the file, the brighter the shade of grey; days*14
|
||||||
if($relative_date_color>200) $relative_date_color = 200;
|
if($relative_date_color>200) $relative_date_color = 200;
|
||||||
$name = str_replace('+','%20', urlencode($file['name']));
|
$name = str_replace('+', '%20', urlencode($file['name']));
|
||||||
$name = str_replace('%2F','/', $name);
|
$name = str_replace('%2F', '/', $name);
|
||||||
$directory = str_replace('+','%20', urlencode($file['directory']));
|
$directory = str_replace('+', '%20', urlencode($file['directory']));
|
||||||
$directory = str_replace('%2F','/', $directory); ?>
|
$directory = str_replace('%2F', '/', $directory); ?>
|
||||||
<tr data-id="<?php echo $file['id']; ?>" data-file="<?php echo $name;?>" data-type="<?php echo ($file['type'] == 'dir')?'dir':'file'?>" data-mime="<?php echo $file['mimetype']?>" data-size='<?php echo $file['size'];?>' data-permissions='<?php echo $file['permissions']; ?>'>
|
<tr data-id="<?php echo $file['id']; ?>" data-file="<?php echo $name;?>" data-type="<?php echo ($file['type'] == 'dir')?'dir':'file'?>" data-mime="<?php echo $file['mimetype']?>" data-size='<?php echo $file['size'];?>' data-permissions='<?php echo $file['permissions']; ?>'>
|
||||||
<td class="filename svg" style="background-image:url(<?php if($file['type'] == 'dir') echo OCP\mimetype_icon('dir'); else echo OCP\mimetype_icon($file['mimetype']); ?>)">
|
<td class="filename svg" style="background-image:url(<?php if($file['type'] == 'dir') echo OCP\mimetype_icon('dir'); else echo OCP\mimetype_icon($file['mimetype']); ?>)">
|
||||||
<?php if(!isset($_['readonly']) || !$_['readonly']) { ?><input type="checkbox" /><?php } ?>
|
<?php if(!isset($_['readonly']) || !$_['readonly']) { ?><input type="checkbox" /><?php } ?>
|
||||||
|
|
|
@ -6,9 +6,9 @@ OC::$CLASSPATH['OC_FileProxy_Encryption'] = 'apps/files_encryption/lib/proxy.php
|
||||||
|
|
||||||
OC_FileProxy::register(new OC_FileProxy_Encryption());
|
OC_FileProxy::register(new OC_FileProxy_Encryption());
|
||||||
|
|
||||||
OCP\Util::connectHook('OC_User','post_login','OC_Crypt','loginListener');
|
OCP\Util::connectHook('OC_User', 'post_login', 'OC_Crypt', 'loginListener');
|
||||||
|
|
||||||
stream_wrapper_register('crypt','OC_CryptStream');
|
stream_wrapper_register('crypt', 'OC_CryptStream');
|
||||||
|
|
||||||
if(!isset($_SESSION['enckey']) and OCP\User::isLoggedIn()) {//force the user to re-loggin if the encryption key isn't unlocked (happens when a user is logged in before the encryption app is enabled)
|
if(!isset($_SESSION['enckey']) and OCP\User::isLoggedIn()) {//force the user to re-loggin if the encryption key isn't unlocked (happens when a user is logged in before the encryption app is enabled)
|
||||||
OCP\User::logout();
|
OCP\User::logout();
|
||||||
|
|
|
@ -80,7 +80,7 @@ class OC_Crypt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createkey($username,$passcode) {
|
public static function createkey($username, $passcode) {
|
||||||
// generate a random key
|
// generate a random key
|
||||||
$key=mt_rand(10000, 99999).mt_rand(10000, 99999).mt_rand(10000, 99999).mt_rand(10000, 99999);
|
$key=mt_rand(10000, 99999).mt_rand(10000, 99999).mt_rand(10000, 99999).mt_rand(10000, 99999);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
/**
|
/**
|
||||||
* transparently encrypted filestream
|
* transparently encrypted filestream
|
||||||
*
|
*
|
||||||
* you can use it as wrapper around an existing stream by setting OC_CryptStream::$sourceStreams['foo']=array('path'=>$path,'stream'=>$stream)
|
* you can use it as wrapper around an existing stream by setting OC_CryptStream::$sourceStreams['foo']=array('path'=>$path, 'stream'=>$stream)
|
||||||
* and then fopen('crypt://streams/foo');
|
* and then fopen('crypt://streams/foo');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -123,11 +123,11 @@ class OC_CryptStream{
|
||||||
$data=substr($data, 8192);
|
$data=substr($data, 8192);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->size=max($this->size,$currentPos+$length);
|
$this->size=max($this->size, $currentPos+$length);
|
||||||
return $length;
|
return $length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stream_set_option($option,$arg1,$arg2) {
|
public function stream_set_option($option, $arg1, $arg2) {
|
||||||
switch($option) {
|
switch($option) {
|
||||||
case STREAM_OPTION_BLOCKING:
|
case STREAM_OPTION_BLOCKING:
|
||||||
stream_set_blocking($this->source, $arg1);
|
stream_set_blocking($this->source, $arg1);
|
||||||
|
|
|
@ -36,7 +36,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
|
||||||
*/
|
*/
|
||||||
private static function shouldEncrypt($path) {
|
private static function shouldEncrypt($path) {
|
||||||
if(is_null(self::$enableEncryption)) {
|
if(is_null(self::$enableEncryption)) {
|
||||||
self::$enableEncryption=(OCP\Config::getAppValue('files_encryption','enable_encryption','true')=='true');
|
self::$enableEncryption=(OCP\Config::getAppValue('files_encryption', 'enable_encryption', 'true')=='true');
|
||||||
}
|
}
|
||||||
if(!self::$enableEncryption) {
|
if(!self::$enableEncryption) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -59,7 +59,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private static function isEncrypted($path) {
|
private static function isEncrypted($path) {
|
||||||
$metadata=OC_FileCache_Cached::get($path,'');
|
$metadata=OC_FileCache_Cached::get($path, '');
|
||||||
return isset($metadata['encrypted']) and (bool)$metadata['encrypted'];
|
return isset($metadata['encrypted']) and (bool)$metadata['encrypted'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,14 +68,14 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
|
||||||
if (!is_resource($data)) {//stream put contents should have been converter to fopen
|
if (!is_resource($data)) {//stream put contents should have been converter to fopen
|
||||||
$size=strlen($data);
|
$size=strlen($data);
|
||||||
$data=OC_Crypt::blockEncrypt($data);
|
$data=OC_Crypt::blockEncrypt($data);
|
||||||
OC_FileCache::put($path, array('encrypted'=>true,'size'=>$size),'');
|
OC_FileCache::put($path, array('encrypted'=>true,'size'=>$size), '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postFile_get_contents($path,$data) {
|
public function postFile_get_contents($path, $data) {
|
||||||
if(self::isEncrypted($path)) {
|
if(self::isEncrypted($path)) {
|
||||||
$cached=OC_FileCache_Cached::get($path,'');
|
$cached=OC_FileCache_Cached::get($path, '');
|
||||||
$data=OC_Crypt::blockDecrypt($data, '', $cached['size']);
|
$data=OC_Crypt::blockDecrypt($data, '', $cached['size']);
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
|
@ -92,7 +92,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
|
||||||
}elseif(self::shouldEncrypt($path) and $meta['mode']!='r' and $meta['mode']!='rb') {
|
}elseif(self::shouldEncrypt($path) and $meta['mode']!='r' and $meta['mode']!='rb') {
|
||||||
if(OC_Filesystem::file_exists($path) and OC_Filesystem::filesize($path)>0) {
|
if(OC_Filesystem::file_exists($path) and OC_Filesystem::filesize($path)>0) {
|
||||||
//first encrypt the target file so we don't end up with a half encrypted file
|
//first encrypt the target file so we don't end up with a half encrypted file
|
||||||
OCP\Util::writeLog('files_encryption','Decrypting '.$path.' before writing',OCP\Util::DEBUG);
|
OCP\Util::writeLog('files_encryption','Decrypting '.$path.' before writing', OCP\Util::DEBUG);
|
||||||
$tmp=fopen('php://temp');
|
$tmp=fopen('php://temp');
|
||||||
OCP\Files::streamCopy($result, $tmp);
|
OCP\Files::streamCopy($result, $tmp);
|
||||||
fclose($result);
|
fclose($result);
|
||||||
|
@ -106,14 +106,14 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
|
||||||
|
|
||||||
public function postGetMimeType($path, $mime) {
|
public function postGetMimeType($path, $mime) {
|
||||||
if(self::isEncrypted($path)) {
|
if(self::isEncrypted($path)) {
|
||||||
$mime=OCP\Files::getMimeType('crypt://'.$path,'w');
|
$mime=OCP\Files::getMimeType('crypt://'.$path, 'w');
|
||||||
}
|
}
|
||||||
return $mime;
|
return $mime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postStat($path, $data) {
|
public function postStat($path, $data) {
|
||||||
if(self::isEncrypted($path)) {
|
if(self::isEncrypted($path)) {
|
||||||
$cached=OC_FileCache_Cached::get($path,'');
|
$cached=OC_FileCache_Cached::get($path, '');
|
||||||
$data['size']=$cached['size'];
|
$data['size']=$cached['size'];
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
|
@ -121,7 +121,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
|
||||||
|
|
||||||
public function postFileSize($path, $size) {
|
public function postFileSize($path, $size) {
|
||||||
if(self::isEncrypted($path)) {
|
if(self::isEncrypted($path)) {
|
||||||
$cached=OC_FileCache_Cached::get($path,'');
|
$cached=OC_FileCache_Cached::get($path, '');
|
||||||
return $cached['size'];
|
return $cached['size'];
|
||||||
}else{
|
}else{
|
||||||
return $size;
|
return $size;
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
|
|
||||||
$tmpl = new OCP\Template( 'files_encryption', 'settings');
|
$tmpl = new OCP\Template( 'files_encryption', 'settings');
|
||||||
$blackList=explode(',', OCP\Config::getAppValue('files_encryption', 'type_blacklist', 'jpg,png,jpeg,avi,mpg,mpeg,mkv,mp3,oga,ogv,ogg'));
|
$blackList=explode(',', OCP\Config::getAppValue('files_encryption', 'type_blacklist', 'jpg,png,jpeg,avi,mpg,mpeg,mkv,mp3,oga,ogv,ogg'));
|
||||||
$enabled=(OCP\Config::getAppValue('files_encryption','enable_encryption','true')=='true');
|
$enabled=(OCP\Config::getAppValue('files_encryption', 'enable_encryption', 'true')=='true');
|
||||||
$tmpl->assign('blacklist', $blackList);
|
$tmpl->assign('blacklist', $blackList);
|
||||||
$tmpl->assign('encryption_enabled', $enabled);
|
$tmpl->assign('encryption_enabled', $enabled);
|
||||||
|
|
||||||
OCP\Util::addscript('files_encryption','settings');
|
OCP\Util::addscript('files_encryption', 'settings');
|
||||||
OCP\Util::addscript('core','multiselect');
|
OCP\Util::addscript('core', 'multiselect');
|
||||||
|
|
||||||
return $tmpl->fetchPage();
|
return $tmpl->fetchPage();
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Test_Encryption extends UnitTestCase {
|
||||||
$this->assertNotEqual($encrypted, $source);
|
$this->assertNotEqual($encrypted, $source);
|
||||||
$this->assertEqual($decrypted, $source);
|
$this->assertEqual($decrypted, $source);
|
||||||
|
|
||||||
$chunk=substr($source,0, 8192);
|
$chunk=substr($source, 0, 8192);
|
||||||
$encrypted=OC_Crypt::encrypt($chunk, $key);
|
$encrypted=OC_Crypt::encrypt($chunk, $key);
|
||||||
$this->assertEqual(strlen($chunk), strlen($encrypted));
|
$this->assertEqual(strlen($chunk), strlen($encrypted));
|
||||||
$decrypted=OC_Crypt::decrypt($encrypted, $key);
|
$decrypted=OC_Crypt::decrypt($encrypted, $key);
|
||||||
|
@ -30,14 +30,14 @@ class Test_Encryption extends UnitTestCase {
|
||||||
$this->assertEqual($decrypted, $source);
|
$this->assertEqual($decrypted, $source);
|
||||||
|
|
||||||
$tmpFileEncrypted=OCP\Files::tmpFile();
|
$tmpFileEncrypted=OCP\Files::tmpFile();
|
||||||
OC_Crypt::encryptfile($file,$tmpFileEncrypted, $key);
|
OC_Crypt::encryptfile($file, $tmpFileEncrypted, $key);
|
||||||
$encrypted=file_get_contents($tmpFileEncrypted);
|
$encrypted=file_get_contents($tmpFileEncrypted);
|
||||||
$decrypted=OC_Crypt::blockDecrypt($encrypted, $key);
|
$decrypted=OC_Crypt::blockDecrypt($encrypted, $key);
|
||||||
$this->assertNotEqual($encrypted, $source);
|
$this->assertNotEqual($encrypted, $source);
|
||||||
$this->assertEqual($decrypted, $source);
|
$this->assertEqual($decrypted, $source);
|
||||||
|
|
||||||
$tmpFileDecrypted=OCP\Files::tmpFile();
|
$tmpFileDecrypted=OCP\Files::tmpFile();
|
||||||
OC_Crypt::decryptfile($tmpFileEncrypted,$tmpFileDecrypted, $key);
|
OC_Crypt::decryptfile($tmpFileEncrypted, $tmpFileDecrypted, $key);
|
||||||
$decrypted=file_get_contents($tmpFileDecrypted);
|
$decrypted=file_get_contents($tmpFileDecrypted);
|
||||||
$this->assertEqual($decrypted, $source);
|
$this->assertEqual($decrypted, $source);
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@ class Test_CryptProxy extends UnitTestCase {
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
$user=OC_User::getUser();
|
$user=OC_User::getUser();
|
||||||
|
|
||||||
$this->oldConfig=OCP\Config::getAppValue('files_encryption','enable_encryption','true');
|
$this->oldConfig=OCP\Config::getAppValue('files_encryption','enable_encryption', 'true');
|
||||||
OCP\Config::setAppValue('files_encryption','enable_encryption','true');
|
OCP\Config::setAppValue('files_encryption', 'enable_encryption', 'true');
|
||||||
$this->oldKey=isset($_SESSION['enckey'])?$_SESSION['enckey']:null;
|
$this->oldKey=isset($_SESSION['enckey'])?$_SESSION['enckey']:null;
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class Test_CryptProxy extends UnitTestCase {
|
||||||
|
|
||||||
//set up temporary storage
|
//set up temporary storage
|
||||||
OC_Filesystem::clearMounts();
|
OC_Filesystem::clearMounts();
|
||||||
OC_Filesystem::mount('OC_Filestorage_Temporary', array(),'/');
|
OC_Filesystem::mount('OC_Filestorage_Temporary', array(), '/');
|
||||||
|
|
||||||
OC_Filesystem::init('/'.$user.'/files');
|
OC_Filesystem::init('/'.$user.'/files');
|
||||||
|
|
||||||
|
|
|
@ -10,23 +10,23 @@ class Test_CryptStream extends UnitTestCase {
|
||||||
private $tmpFiles=array();
|
private $tmpFiles=array();
|
||||||
|
|
||||||
function testStream() {
|
function testStream() {
|
||||||
$stream=$this->getStream('test1','w', strlen('foobar'));
|
$stream=$this->getStream('test1', 'w', strlen('foobar'));
|
||||||
fwrite($stream,'foobar');
|
fwrite($stream, 'foobar');
|
||||||
fclose($stream);
|
fclose($stream);
|
||||||
|
|
||||||
$stream=$this->getStream('test1','r', strlen('foobar'));
|
$stream=$this->getStream('test1', 'r', strlen('foobar'));
|
||||||
$data=fread($stream, 6);
|
$data=fread($stream, 6);
|
||||||
fclose($stream);
|
fclose($stream);
|
||||||
$this->assertEqual('foobar', $data);
|
$this->assertEqual('foobar', $data);
|
||||||
|
|
||||||
$file=OC::$SERVERROOT.'/3rdparty/MDB2.php';
|
$file=OC::$SERVERROOT.'/3rdparty/MDB2.php';
|
||||||
$source=fopen($file,'r');
|
$source=fopen($file, 'r');
|
||||||
$target=$this->getStream('test2', 'w', 0);
|
$target=$this->getStream('test2', 'w', 0);
|
||||||
OCP\Files::streamCopy($source, $target);
|
OCP\Files::streamCopy($source, $target);
|
||||||
fclose($target);
|
fclose($target);
|
||||||
fclose($source);
|
fclose($source);
|
||||||
|
|
||||||
$stream=$this->getStream('test2','r', filesize($file));
|
$stream=$this->getStream('test2', 'r', filesize($file));
|
||||||
$data=stream_get_contents($stream);
|
$data=stream_get_contents($stream);
|
||||||
$original=file_get_contents($file);
|
$original=file_get_contents($file);
|
||||||
$this->assertEqual(strlen($original), strlen($data));
|
$this->assertEqual(strlen($original), strlen($data));
|
||||||
|
@ -51,7 +51,7 @@ class Test_CryptStream extends UnitTestCase {
|
||||||
$file=$this->tmpFiles[$id];
|
$file=$this->tmpFiles[$id];
|
||||||
}
|
}
|
||||||
$stream=fopen($file, $mode);
|
$stream=fopen($file, $mode);
|
||||||
OC_CryptStream::$sourceStreams[$id]=array('path'=>'dummy'.$id,'stream'=>$stream,'size'=>$size);
|
OC_CryptStream::$sourceStreams[$id]=array('path'=>'dummy'.$id, 'stream'=>$stream, 'size'=>$size);
|
||||||
return fopen('crypt://streams/'.$id, $mode);
|
return fopen('crypt://streams/'.$id, $mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,11 +59,11 @@ class Test_CryptStream extends UnitTestCase {
|
||||||
$file=__DIR__.'/binary';
|
$file=__DIR__.'/binary';
|
||||||
$source=file_get_contents($file);
|
$source=file_get_contents($file);
|
||||||
|
|
||||||
$stream=$this->getStream('test','w', strlen($source));
|
$stream=$this->getStream('test', 'w', strlen($source));
|
||||||
fwrite($stream, $source);
|
fwrite($stream, $source);
|
||||||
fclose($stream);
|
fclose($stream);
|
||||||
|
|
||||||
$stream=$this->getStream('test','r', strlen($source));
|
$stream=$this->getStream('test', 'r', strlen($source));
|
||||||
$data=stream_get_contents($stream);
|
$data=stream_get_contents($stream);
|
||||||
fclose($stream);
|
fclose($stream);
|
||||||
$this->assertEqual(strlen($data), strlen($source));
|
$this->assertEqual(strlen($data), strlen($source));
|
||||||
|
@ -72,11 +72,11 @@ class Test_CryptStream extends UnitTestCase {
|
||||||
$file=__DIR__.'/zeros';
|
$file=__DIR__.'/zeros';
|
||||||
$source=file_get_contents($file);
|
$source=file_get_contents($file);
|
||||||
|
|
||||||
$stream=$this->getStream('test2','w', strlen($source));
|
$stream=$this->getStream('test2', 'w', strlen($source));
|
||||||
fwrite($stream, $source);
|
fwrite($stream, $source);
|
||||||
fclose($stream);
|
fclose($stream);
|
||||||
|
|
||||||
$stream=$this->getStream('test2','r', strlen($source));
|
$stream=$this->getStream('test2', 'r', strlen($source));
|
||||||
$data=stream_get_contents($stream);
|
$data=stream_get_contents($stream);
|
||||||
fclose($stream);
|
fclose($stream);
|
||||||
$this->assertEqual(strlen($data), strlen($source));
|
$this->assertEqual(strlen($data), strlen($source));
|
||||||
|
|
|
@ -53,7 +53,7 @@ class OC_FileStorage_FTP extends OC_FileStorage_StreamWrapper{
|
||||||
case 'ab':
|
case 'ab':
|
||||||
//these are supported by the wrapper
|
//these are supported by the wrapper
|
||||||
$context = stream_context_create(array('ftp' => array('overwrite' => true)));
|
$context = stream_context_create(array('ftp' => array('overwrite' => true)));
|
||||||
return fopen($this->constructUrl($path),$mode, false, $context);
|
return fopen($this->constructUrl($path), $mode, false, $context);
|
||||||
case 'r+':
|
case 'r+':
|
||||||
case 'w+':
|
case 'w+':
|
||||||
case 'wb+':
|
case 'wb+':
|
||||||
|
@ -63,13 +63,13 @@ class OC_FileStorage_FTP extends OC_FileStorage_StreamWrapper{
|
||||||
case 'c':
|
case 'c':
|
||||||
case 'c+':
|
case 'c+':
|
||||||
//emulate these
|
//emulate these
|
||||||
if(strrpos($path,'.')!==false) {
|
if(strrpos($path, '.')!==false) {
|
||||||
$ext=substr($path, strrpos($path,'.'));
|
$ext=substr($path, strrpos($path, '.'));
|
||||||
}else{
|
}else{
|
||||||
$ext='';
|
$ext='';
|
||||||
}
|
}
|
||||||
$tmpFile=OCP\Files::tmpFile($ext);
|
$tmpFile=OCP\Files::tmpFile($ext);
|
||||||
OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
|
OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this, 'writeBack');
|
||||||
if($this->file_exists($path)) {
|
if($this->file_exists($path)) {
|
||||||
$this->getFile($path, $tmpFile);
|
$this->getFile($path, $tmpFile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,8 +394,8 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
|
||||||
case 'x+':
|
case 'x+':
|
||||||
case 'c':
|
case 'c':
|
||||||
case 'c+':
|
case 'c+':
|
||||||
if (strrpos($path,'.') !== false) {
|
if (strrpos($path, '.') !== false) {
|
||||||
$ext = substr($path, strrpos($path,'.'));
|
$ext = substr($path, strrpos($path, '.'));
|
||||||
} else {
|
} else {
|
||||||
$ext = '';
|
$ext = '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,8 @@ abstract class OC_FileStorage_StreamWrapper extends OC_Filestorage_Common{
|
||||||
|
|
||||||
public function touch($path, $mtime=null) {
|
public function touch($path, $mtime=null) {
|
||||||
if(is_null($mtime)) {
|
if(is_null($mtime)) {
|
||||||
$fh=$this->fopen($path,'a');
|
$fh=$this->fopen($path, 'a');
|
||||||
fwrite($fh,'');
|
fwrite($fh, '');
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
}else{
|
}else{
|
||||||
return false;//not supported
|
return false;//not supported
|
||||||
|
|
|
@ -39,7 +39,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function getContainerName($path) {
|
private function getContainerName($path) {
|
||||||
$path=trim(trim($this->root,'/')."/".$path,'/.');
|
$path=trim(trim($this->root, '/')."/".$path, '/.');
|
||||||
return str_replace('/', '\\', $path);
|
return str_replace('/', '\\', $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
|
||||||
unlink($tmpFile);
|
unlink($tmpFile);
|
||||||
return false;
|
return false;
|
||||||
}else{
|
}else{
|
||||||
$fh=fopen($tmpFile,'a');
|
$fh=fopen($tmpFile, 'a');
|
||||||
fwrite($fh, $name."\n");
|
fwrite($fh, $name."\n");
|
||||||
}
|
}
|
||||||
}catch(Exception $e) {
|
}catch(Exception $e) {
|
||||||
|
@ -432,7 +432,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
|
||||||
case 'c':
|
case 'c':
|
||||||
case 'c+':
|
case 'c+':
|
||||||
$tmpFile=$this->getTmpFile($path);
|
$tmpFile=$this->getTmpFile($path);
|
||||||
OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
|
OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this, 'writeBack');
|
||||||
self::$tempFiles[$tmpFile]=$path;
|
self::$tempFiles[$tmpFile]=$path;
|
||||||
return fopen('close://'.$tmpFile, $mode);
|
return fopen('close://'.$tmpFile, $mode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,7 +252,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
|
||||||
public function stat($path) {
|
public function stat($path) {
|
||||||
$path=$this->cleanPath($path);
|
$path=$this->cleanPath($path);
|
||||||
try{
|
try{
|
||||||
$response=$this->client->propfind($path, array('{DAV:}getlastmodified','{DAV:}getcontentlength'));
|
$response=$this->client->propfind($path, array('{DAV:}getlastmodified', '{DAV:}getcontentlength'));
|
||||||
return array(
|
return array(
|
||||||
'mtime'=>strtotime($response['{DAV:}getlastmodified']),
|
'mtime'=>strtotime($response['{DAV:}getlastmodified']),
|
||||||
'size'=>(int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0,
|
'size'=>(int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0,
|
||||||
|
@ -266,7 +266,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
|
||||||
public function getMimeType($path) {
|
public function getMimeType($path) {
|
||||||
$path=$this->cleanPath($path);
|
$path=$this->cleanPath($path);
|
||||||
try{
|
try{
|
||||||
$response=$this->client->propfind($path, array('{DAV:}getcontenttype','{DAV:}resourcetype'));
|
$response=$this->client->propfind($path, array('{DAV:}getcontenttype', '{DAV:}resourcetype'));
|
||||||
$responseType=$response["{DAV:}resourcetype"]->resourceType;
|
$responseType=$response["{DAV:}resourcetype"]->resourceType;
|
||||||
$type=(count($responseType)>0 and $responseType[0]=="{DAV:}collection")?'dir':'file';
|
$type=(count($responseType)>0 and $responseType[0]=="{DAV:}collection")?'dir':'file';
|
||||||
if($type=='dir') {
|
if($type=='dir') {
|
||||||
|
|
|
@ -5,7 +5,7 @@ OC::$CLASSPATH['OCA_Versions\Storage'] = 'apps/files_versions/lib/versions.php';
|
||||||
OC::$CLASSPATH['OCA_Versions\Hooks'] = 'apps/files_versions/lib/hooks.php';
|
OC::$CLASSPATH['OCA_Versions\Hooks'] = 'apps/files_versions/lib/hooks.php';
|
||||||
|
|
||||||
OCP\App::registerAdmin('files_versions', 'settings');
|
OCP\App::registerAdmin('files_versions', 'settings');
|
||||||
OCP\App::registerPersonal('files_versions','settings-personal');
|
OCP\App::registerPersonal('files_versions', 'settings-personal');
|
||||||
|
|
||||||
OCP\Util::addscript('files_versions', 'versions');
|
OCP\Util::addscript('files_versions', 'versions');
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
OCP\User::checkLoggedIn( );
|
OCP\User::checkLoggedIn( );
|
||||||
OCP\Util::addStyle('files_versions','versions');
|
OCP\Util::addStyle('files_versions', 'versions');
|
||||||
$tmpl = new OCP\Template( 'files_versions', 'history', 'user' );
|
$tmpl = new OCP\Template( 'files_versions', 'history', 'user' );
|
||||||
|
|
||||||
if ( isset( $_GET['path'] ) ) {
|
if ( isset( $_GET['path'] ) ) {
|
||||||
|
|
|
@ -109,7 +109,7 @@ class Storage {
|
||||||
// create all parent folders
|
// create all parent folders
|
||||||
$info=pathinfo($filename);
|
$info=pathinfo($filename);
|
||||||
if(!file_exists($versionsFolderName.'/'.$info['dirname'])) {
|
if(!file_exists($versionsFolderName.'/'.$info['dirname'])) {
|
||||||
mkdir($versionsFolderName.'/'.$info['dirname'],0750, true);
|
mkdir($versionsFolderName.'/'.$info['dirname'], 0750, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// store a new version of a file
|
// store a new version of a file
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
$tmpl = new OCP\Template( 'files_versions', 'settings-personal');
|
$tmpl = new OCP\Template( 'files_versions', 'settings-personal');
|
||||||
|
|
||||||
OCP\Util::addscript('files_versions','settings-personal');
|
OCP\Util::addscript('files_versions', 'settings-personal');
|
||||||
|
|
||||||
return $tmpl->fetchPage();
|
return $tmpl->fetchPage();
|
||||||
|
|
|
@ -124,7 +124,7 @@ class GROUP_LDAP extends lib\Access implements \OCP\GroupInterface {
|
||||||
$this->connection->ldapGroupFilter,
|
$this->connection->ldapGroupFilter,
|
||||||
$this->connection->ldapGroupMemberAssocAttr.'='.$uid
|
$this->connection->ldapGroupMemberAssocAttr.'='.$uid
|
||||||
));
|
));
|
||||||
$groups = $this->fetchListOfGroups($filter, array($this->connection->ldapGroupDisplayName,'dn'));
|
$groups = $this->fetchListOfGroups($filter, array($this->connection->ldapGroupDisplayName, 'dn'));
|
||||||
$groups = array_unique($this->ownCloudGroupNames($groups), SORT_LOCALE_STRING);
|
$groups = array_unique($this->ownCloudGroupNames($groups), SORT_LOCALE_STRING);
|
||||||
$this->connection->writeToCache($cacheKey, $groups);
|
$this->connection->writeToCache($cacheKey, $groups);
|
||||||
|
|
||||||
|
|
|
@ -180,13 +180,13 @@ class Connection {
|
||||||
* Caches the general LDAP configuration.
|
* Caches the general LDAP configuration.
|
||||||
*/
|
*/
|
||||||
private function readConfiguration($force = false) {
|
private function readConfiguration($force = false) {
|
||||||
\OCP\Util::writeLog('user_ldap','Checking conf state: isConfigured? '.print_r($this->configured, true).' isForce? '.print_r($force, true).' configID? '.print_r($this->configID, true), \OCP\Util::DEBUG);
|
\OCP\Util::writeLog('user_ldap', 'Checking conf state: isConfigured? '.print_r($this->configured, true).' isForce? '.print_r($force, true).' configID? '.print_r($this->configID, true), \OCP\Util::DEBUG);
|
||||||
if((!$this->configured || $force) && !is_null($this->configID)) {
|
if((!$this->configured || $force) && !is_null($this->configID)) {
|
||||||
\OCP\Util::writeLog('user_ldap','Reading the configuration', \OCP\Util::DEBUG);
|
\OCP\Util::writeLog('user_ldap', 'Reading the configuration', \OCP\Util::DEBUG);
|
||||||
$this->config['ldapHost'] = \OCP\Config::getAppValue($this->configID, 'ldap_host', '');
|
$this->config['ldapHost'] = \OCP\Config::getAppValue($this->configID, 'ldap_host', '');
|
||||||
$this->config['ldapPort'] = \OCP\Config::getAppValue($this->configID, 'ldap_port', 389);
|
$this->config['ldapPort'] = \OCP\Config::getAppValue($this->configID, 'ldap_port', 389);
|
||||||
$this->config['ldapAgentName'] = \OCP\Config::getAppValue($this->configID, 'ldap_dn','');
|
$this->config['ldapAgentName'] = \OCP\Config::getAppValue($this->configID, 'ldap_dn', '');
|
||||||
$this->config['ldapAgentPassword'] = base64_decode(\OCP\Config::getAppValue($this->configID, 'ldap_agent_password',''));
|
$this->config['ldapAgentPassword'] = base64_decode(\OCP\Config::getAppValue($this->configID, 'ldap_agent_password', ''));
|
||||||
$this->config['ldapBase'] = \OCP\Config::getAppValue($this->configID, 'ldap_base', '');
|
$this->config['ldapBase'] = \OCP\Config::getAppValue($this->configID, 'ldap_base', '');
|
||||||
$this->config['ldapBaseUsers'] = \OCP\Config::getAppValue($this->configID, 'ldap_base_users', $this->config['ldapBase']);
|
$this->config['ldapBaseUsers'] = \OCP\Config::getAppValue($this->configID, 'ldap_base_users', $this->config['ldapBase']);
|
||||||
$this->config['ldapBaseGroups'] = \OCP\Config::getAppValue($this->configID, 'ldap_base_groups', $this->config['ldapBase']);
|
$this->config['ldapBaseGroups'] = \OCP\Config::getAppValue($this->configID, 'ldap_base_groups', $this->config['ldapBase']);
|
||||||
|
@ -194,8 +194,8 @@ class Connection {
|
||||||
$this->config['ldapNoCase'] = \OCP\Config::getAppValue($this->configID, 'ldap_nocase', 0);
|
$this->config['ldapNoCase'] = \OCP\Config::getAppValue($this->configID, 'ldap_nocase', 0);
|
||||||
$this->config['turnOffCertCheck'] = \OCP\Config::getAppValue($this->configID, 'ldap_turn_off_cert_check', 0);
|
$this->config['turnOffCertCheck'] = \OCP\Config::getAppValue($this->configID, 'ldap_turn_off_cert_check', 0);
|
||||||
$this->config['ldapUserDisplayName'] = mb_strtolower(\OCP\Config::getAppValue($this->configID, 'ldap_display_name', 'uid'), 'UTF-8');
|
$this->config['ldapUserDisplayName'] = mb_strtolower(\OCP\Config::getAppValue($this->configID, 'ldap_display_name', 'uid'), 'UTF-8');
|
||||||
$this->config['ldapUserFilter'] = \OCP\Config::getAppValue($this->configID, 'ldap_userlist_filter','objectClass=person');
|
$this->config['ldapUserFilter'] = \OCP\Config::getAppValue($this->configID, 'ldap_userlist_filter', 'objectClass=person');
|
||||||
$this->config['ldapGroupFilter'] = \OCP\Config::getAppValue($this->configID, 'ldap_group_filter','(objectClass=posixGroup)');
|
$this->config['ldapGroupFilter'] = \OCP\Config::getAppValue($this->configID, 'ldap_group_filter', '(objectClass=posixGroup)');
|
||||||
$this->config['ldapLoginFilter'] = \OCP\Config::getAppValue($this->configID, 'ldap_login_filter', '(uid=%uid)');
|
$this->config['ldapLoginFilter'] = \OCP\Config::getAppValue($this->configID, 'ldap_login_filter', '(uid=%uid)');
|
||||||
$this->config['ldapGroupDisplayName'] = mb_strtolower(\OCP\Config::getAppValue($this->configID, 'ldap_group_display_name', 'uid'), 'UTF-8');
|
$this->config['ldapGroupDisplayName'] = mb_strtolower(\OCP\Config::getAppValue($this->configID, 'ldap_group_display_name', 'uid'), 'UTF-8');
|
||||||
$this->config['ldapQuotaAttribute'] = \OCP\Config::getAppValue($this->configID, 'ldap_quota_attr', '');
|
$this->config['ldapQuotaAttribute'] = \OCP\Config::getAppValue($this->configID, 'ldap_quota_attr', '');
|
||||||
|
@ -263,7 +263,7 @@ class Connection {
|
||||||
if(empty($this->config['ldapGroupFilter']) && empty($this->config['ldapGroupMemberAssocAttr'])) {
|
if(empty($this->config['ldapGroupFilter']) && empty($this->config['ldapGroupMemberAssocAttr'])) {
|
||||||
\OCP\Util::writeLog('user_ldap', 'No group filter is specified, LDAP group feature will not be used.', \OCP\Util::INFO);
|
\OCP\Util::writeLog('user_ldap', 'No group filter is specified, LDAP group feature will not be used.', \OCP\Util::INFO);
|
||||||
}
|
}
|
||||||
if(!in_array($this->config['ldapUuidAttribute'], array('auto','entryuuid', 'nsuniqueid', 'objectguid')) && (!is_null($this->configID))) {
|
if(!in_array($this->config['ldapUuidAttribute'], array('auto', 'entryuuid', 'nsuniqueid', 'objectguid')) && (!is_null($this->configID))) {
|
||||||
\OCP\Config::setAppValue($this->configID, 'ldap_uuid_attribute', 'auto');
|
\OCP\Config::setAppValue($this->configID, 'ldap_uuid_attribute', 'auto');
|
||||||
\OCP\Util::writeLog('user_ldap', 'Illegal value for the UUID Attribute, reset to autodetect.', \OCP\Util::INFO);
|
\OCP\Util::writeLog('user_ldap', 'Illegal value for the UUID Attribute, reset to autodetect.', \OCP\Util::INFO);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ if ($_POST) {
|
||||||
if('ldap_agent_password' == $param) {
|
if('ldap_agent_password' == $param) {
|
||||||
OCP\Config::setAppValue('user_ldap', $param, base64_encode($_POST[$param]));
|
OCP\Config::setAppValue('user_ldap', $param, base64_encode($_POST[$param]));
|
||||||
} elseif('ldap_cache_ttl' == $param) {
|
} elseif('ldap_cache_ttl' == $param) {
|
||||||
if(OCP\Config::getAppValue('user_ldap', $param,'') != $_POST[$param]) {
|
if(OCP\Config::getAppValue('user_ldap', $param, '') != $_POST[$param]) {
|
||||||
$ldap = new \OCA\user_ldap\lib\Connection('user_ldap');
|
$ldap = new \OCA\user_ldap\lib\Connection('user_ldap');
|
||||||
$ldap->clearCache();
|
$ldap->clearCache();
|
||||||
OCP\Config::setAppValue('user_ldap', $param, $_POST[$param]);
|
OCP\Config::setAppValue('user_ldap', $param, $_POST[$param]);
|
||||||
|
@ -59,7 +59,7 @@ if ($_POST) {
|
||||||
// fill template
|
// fill template
|
||||||
$tmpl = new OCP\Template( 'user_ldap', 'settings');
|
$tmpl = new OCP\Template( 'user_ldap', 'settings');
|
||||||
foreach($params as $param) {
|
foreach($params as $param) {
|
||||||
$value = OCP\Config::getAppValue('user_ldap', $param,'');
|
$value = OCP\Config::getAppValue('user_ldap', $param, '');
|
||||||
$tmpl->assign($param, $value);
|
$tmpl->assign($param, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,8 @@ class Test_Group_Ldap extends UnitTestCase {
|
||||||
$this->assertIsA(OC_Group::getGroups(), gettype(array()));
|
$this->assertIsA(OC_Group::getGroups(), gettype(array()));
|
||||||
$this->assertIsA($group_ldap->getGroups(), gettype(array()));
|
$this->assertIsA($group_ldap->getGroups(), gettype(array()));
|
||||||
|
|
||||||
$this->assertFalse(OC_Group::inGroup('john','dosers'), gettype(false));
|
$this->assertFalse(OC_Group::inGroup('john', 'dosers'), gettype(false));
|
||||||
$this->assertFalse($group_ldap->inGroup('john','dosers'), gettype(false));
|
$this->assertFalse($group_ldap->inGroup('john', 'dosers'), gettype(false));
|
||||||
//TODO: check also for expected true result. This backend won't be able to do any modifications, maybe use a dummy for this.
|
//TODO: check also for expected true result. This backend won't be able to do any modifications, maybe use a dummy for this.
|
||||||
|
|
||||||
$this->assertIsA(OC_Group::getUserGroups('john doe'), gettype(array()));
|
$this->assertIsA(OC_Group::getUserGroups('john doe'), gettype(array()));
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
require_once 'apps/user_webdavauth/user_webdavauth.php';
|
require_once 'apps/user_webdavauth/user_webdavauth.php';
|
||||||
|
|
||||||
OC_APP::registerAdmin('user_webdavauth','settings');
|
OC_APP::registerAdmin('user_webdavauth', 'settings');
|
||||||
|
|
||||||
OC_User::registerBackend("WEBDAVAUTH");
|
OC_User::registerBackend("WEBDAVAUTH");
|
||||||
OC_User::useBackend( "WEBDAVAUTH" );
|
OC_User::useBackend( "WEBDAVAUTH" );
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
<p>MySQL <?php echo $l->t( 'will be used' ); ?>.</p>
|
<p>MySQL <?php echo $l->t( 'will be used' ); ?>.</p>
|
||||||
<input type="hidden" id="dbtype" name="dbtype" value="mysql" />
|
<input type="hidden" id="dbtype" name="dbtype" value="mysql" />
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<input type="radio" name="dbtype" value="mysql" id="mysql" <?php OC_Helper::init_radio('dbtype','mysql', 'sqlite'); ?>/>
|
<input type="radio" name="dbtype" value="mysql" id="mysql" <?php OC_Helper::init_radio('dbtype', 'mysql', 'sqlite'); ?>/>
|
||||||
<label class="mysql" for="mysql">MySQL</label>
|
<label class="mysql" for="mysql">MySQL</label>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
<input type="hidden" id="dbtype" name="dbtype" value="pgsql" />
|
<input type="hidden" id="dbtype" name="dbtype" value="pgsql" />
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<label class="pgsql" for="pgsql">PostgreSQL</label>
|
<label class="pgsql" for="pgsql">PostgreSQL</label>
|
||||||
<input type="radio" name="dbtype" value='pgsql' id="pgsql" <?php OC_Helper::init_radio('dbtype','pgsql', 'sqlite'); ?>/>
|
<input type="radio" name="dbtype" value='pgsql' id="pgsql" <?php OC_Helper::init_radio('dbtype', 'pgsql', 'sqlite'); ?>/>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@
|
||||||
<input type="hidden" id="dbtype" name="dbtype" value="oci" />
|
<input type="hidden" id="dbtype" name="dbtype" value="oci" />
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<label class="oci" for="oci">Oracle</label>
|
<label class="oci" for="oci">Oracle</label>
|
||||||
<input type="radio" name="dbtype" value='oci' id="oci" <?php OC_Helper::init_radio('dbtype','oci', 'sqlite'); ?>/>
|
<input type="radio" name="dbtype" value='oci' id="oci" <?php OC_Helper::init_radio('dbtype', 'oci', 'sqlite'); ?>/>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -351,7 +351,7 @@ class MDB2_Driver_sqlite3 extends MDB2_Driver_Common
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($database_file !== ':memory:') {
|
if ($database_file !== ':memory:') {
|
||||||
if(!strpos($database_file,'.db')) {
|
if(!strpos($database_file, '.db')) {
|
||||||
$database_file="$datadir/$database_file.db";
|
$database_file="$datadir/$database_file.db";
|
||||||
}
|
}
|
||||||
if (!file_exists($database_file)) {
|
if (!file_exists($database_file)) {
|
||||||
|
@ -387,7 +387,7 @@ class MDB2_Driver_sqlite3 extends MDB2_Driver_Common
|
||||||
|
|
||||||
$php_errormsg = '';
|
$php_errormsg = '';
|
||||||
$this->connection = new SQLite3($database_file);
|
$this->connection = new SQLite3($database_file);
|
||||||
if(is_callable(array($this->connection,'busyTimeout'))) {//busy timout is only available in php>=5.3
|
if(is_callable(array($this->connection, 'busyTimeout'))) {//busy timout is only available in php>=5.3
|
||||||
$this->connection->busyTimeout(100);
|
$this->connection->busyTimeout(100);
|
||||||
}
|
}
|
||||||
$this->_lasterror = $this->connection->lastErrorMsg();
|
$this->_lasterror = $this->connection->lastErrorMsg();
|
||||||
|
|
|
@ -185,7 +185,7 @@ class OC_App{
|
||||||
}else{
|
}else{
|
||||||
$download=OC_OCSClient::getApplicationDownload($app, 1);
|
$download=OC_OCSClient::getApplicationDownload($app, 1);
|
||||||
if(isset($download['downloadlink']) and $download['downloadlink']!='') {
|
if(isset($download['downloadlink']) and $download['downloadlink']!='') {
|
||||||
$app=OC_Installer::installApp(array('source'=>'http','href'=>$download['downloadlink']));
|
$app=OC_Installer::installApp(array('source'=>'http', 'href'=>$download['downloadlink']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ class OC_Archive_TAR extends OC_Archive{
|
||||||
private $path;
|
private $path;
|
||||||
|
|
||||||
function __construct($source) {
|
function __construct($source) {
|
||||||
$types=array(null,'gz','bz');
|
$types=array(null, 'gz', 'bz');
|
||||||
$this->path=$source;
|
$this->path=$source;
|
||||||
$this->tar=new Archive_Tar($source, $types[self::getTarType($source)]);
|
$this->tar=new Archive_Tar($source, $types[self::getTarType($source)]);
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ class OC_Archive_TAR extends OC_Archive{
|
||||||
if($mode=='r' or $mode=='rb') {
|
if($mode=='r' or $mode=='rb') {
|
||||||
return fopen($tmpFile, $mode);
|
return fopen($tmpFile, $mode);
|
||||||
}else{
|
}else{
|
||||||
OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
|
OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this, 'writeBack');
|
||||||
self::$tempFiles[$tmpFile]=$path;
|
self::$tempFiles[$tmpFile]=$path;
|
||||||
return fopen('close://'.$tmpFile, $mode);
|
return fopen('close://'.$tmpFile, $mode);
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,7 @@ class OC_Archive_TAR extends OC_Archive{
|
||||||
$this->tar->_close();
|
$this->tar->_close();
|
||||||
$this->tar=null;
|
$this->tar=null;
|
||||||
}
|
}
|
||||||
$types=array(null,'gz','bz');
|
$types=array(null, 'gz', 'bz');
|
||||||
$this->tar=new Archive_Tar($this->path, $types[self::getTarType($this->path)]);
|
$this->tar=new Archive_Tar($this->path, $types[self::getTarType($this->path)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,7 +171,7 @@ class OC_Archive_ZIP extends OC_Archive{
|
||||||
$ext='';
|
$ext='';
|
||||||
}
|
}
|
||||||
$tmpFile=OCP\Files::tmpFile($ext);
|
$tmpFile=OCP\Files::tmpFile($ext);
|
||||||
OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
|
OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this, 'writeBack');
|
||||||
if($this->fileExists($path)) {
|
if($this->fileExists($path)) {
|
||||||
$this->extractFile($path, $tmpFile);
|
$this->extractFile($path, $tmpFile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,7 +239,7 @@ class OC{
|
||||||
}
|
}
|
||||||
if(file_exists(OC::$SERVERROOT."/config/config.php") and !is_writable(OC::$SERVERROOT."/config/config.php")) {
|
if(file_exists(OC::$SERVERROOT."/config/config.php") and !is_writable(OC::$SERVERROOT."/config/config.php")) {
|
||||||
$tmpl = new OC_Template( '', 'error', 'guest' );
|
$tmpl = new OC_Template( '', 'error', 'guest' );
|
||||||
$tmpl->assign('errors', array(1=>array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud")));
|
$tmpl->assign('errors', array(1=>array('error'=>"Can't write into config directory 'config'", 'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud")));
|
||||||
$tmpl->printPage();
|
$tmpl->printPage();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -322,7 +322,7 @@ class OC{
|
||||||
|
|
||||||
public static function init() {
|
public static function init() {
|
||||||
// register autoloader
|
// register autoloader
|
||||||
spl_autoload_register(array('OC','autoload'));
|
spl_autoload_register(array('OC', 'autoload'));
|
||||||
setlocale(LC_ALL, 'en_US.UTF-8');
|
setlocale(LC_ALL, 'en_US.UTF-8');
|
||||||
|
|
||||||
// set some stuff
|
// set some stuff
|
||||||
|
@ -440,7 +440,7 @@ class OC{
|
||||||
OC_Hook::connect('OC_Filesystem', 'rename', 'OC_Filesystem', 'isBlacklisted');
|
OC_Hook::connect('OC_Filesystem', 'rename', 'OC_Filesystem', 'isBlacklisted');
|
||||||
|
|
||||||
//make sure temporary files are cleaned up
|
//make sure temporary files are cleaned up
|
||||||
register_shutdown_function(array('OC_Helper','cleanTmp'));
|
register_shutdown_function(array('OC_Helper', 'cleanTmp'));
|
||||||
|
|
||||||
//parse the given parameters
|
//parse the given parameters
|
||||||
self::$REQUESTEDAPP = (isset($_GET['app']) && trim($_GET['app']) != '' && !is_null($_GET['app'])?str_replace(array('\0', '/', '\\', '..'), '', strip_tags($_GET['app'])):OC_Config::getValue('defaultapp', 'files'));
|
self::$REQUESTEDAPP = (isset($_GET['app']) && trim($_GET['app']) != '' && !is_null($_GET['app'])?str_replace(array('\0', '/', '\\', '..'), '', strip_tags($_GET['app'])):OC_Config::getValue('defaultapp', 'files'));
|
||||||
|
@ -669,7 +669,7 @@ class OC{
|
||||||
}
|
}
|
||||||
OC_App::loadApps(array('authentication'));
|
OC_App::loadApps(array('authentication'));
|
||||||
if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) {
|
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_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG);
|
||||||
OC_User::unsetMagicInCookie();
|
OC_User::unsetMagicInCookie();
|
||||||
$_REQUEST['redirect_url'] = (isset($_SERVER['REQUEST_URI'])?$_SERVER['REQUEST_URI']:'');
|
$_REQUEST['redirect_url'] = (isset($_SERVER['REQUEST_URI'])?$_SERVER['REQUEST_URI']:'');
|
||||||
OC_Util::redirectToDefaultPage();
|
OC_Util::redirectToDefaultPage();
|
||||||
|
|
|
@ -57,7 +57,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
|
||||||
*/
|
*/
|
||||||
public function get() {
|
public function get() {
|
||||||
|
|
||||||
return OC_Filesystem::fopen($this->path,'rb');
|
return OC_Filesystem::fopen($this->path, 'rb');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
|
||||||
* @param Sabre_DAV_Locks_LockInfo $lockInfo
|
* @param Sabre_DAV_Locks_LockInfo $lockInfo
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function lock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) {
|
public function lock($uri, Sabre_DAV_Locks_LockInfo $lockInfo) {
|
||||||
|
|
||||||
// We're making the lock timeout 5 minutes
|
// We're making the lock timeout 5 minutes
|
||||||
$lockInfo->timeout = 300;
|
$lockInfo->timeout = 300;
|
||||||
|
@ -134,7 +134,7 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
|
||||||
* @param Sabre_DAV_Locks_LockInfo $lockInfo
|
* @param Sabre_DAV_Locks_LockInfo $lockInfo
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function unlock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) {
|
public function unlock($uri, Sabre_DAV_Locks_LockInfo $lockInfo) {
|
||||||
|
|
||||||
$query = OC_DB::prepare( 'DELETE FROM `*PREFIX*locks` WHERE `userid` = ? AND `uri` = ? AND `token` = ?' );
|
$query = OC_DB::prepare( 'DELETE FROM `*PREFIX*locks` WHERE `userid` = ? AND `uri` = ? AND `token` = ?' );
|
||||||
$result = $query->execute( array(OC_User::getUser(), $uri, $lockInfo->token));
|
$result = $query->execute( array(OC_User::getUser(), $uri, $lockInfo->token));
|
||||||
|
|
|
@ -85,7 +85,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
|
||||||
$this->path = $newPath;
|
$this->path = $newPath;
|
||||||
|
|
||||||
$query = OC_DB::prepare( 'UPDATE `*PREFIX*properties` SET `propertypath` = ? WHERE `userid` = ? AND `propertypath` = ?' );
|
$query = OC_DB::prepare( 'UPDATE `*PREFIX*properties` SET `propertypath` = ? WHERE `userid` = ? AND `propertypath` = ?' );
|
||||||
$query->execute( array( $newPath,OC_User::getUser(), $oldPath ));
|
$query->execute( array( $newPath, OC_User::getUser(), $oldPath ));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
|
||||||
$query->execute( array( OC_User::getUser(), $this->path, $propertyName, $propertyValue ));
|
$query->execute( array( OC_User::getUser(), $this->path, $propertyName, $propertyValue ));
|
||||||
} else {
|
} else {
|
||||||
$query = OC_DB::prepare( 'UPDATE `*PREFIX*properties` SET `propertyvalue` = ? WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` = ?' );
|
$query = OC_DB::prepare( 'UPDATE `*PREFIX*properties` SET `propertyvalue` = ? WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` = ?' );
|
||||||
$query->execute( array( $propertyValue,OC_User::getUser(), $this->path, $propertyName ));
|
$query->execute( array( $propertyValue, OC_User::getUser(), $this->path, $propertyName ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -324,7 +324,7 @@ class OC_DB {
|
||||||
if( PEAR::isError($result)) {
|
if( PEAR::isError($result)) {
|
||||||
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
|
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
|
||||||
$entry .= 'Offending command was: '.htmlentities($query).'<br />';
|
$entry .= 'Offending command was: '.htmlentities($query).'<br />';
|
||||||
OC_Log::write('core', $entry,OC_Log::FATAL);
|
OC_Log::write('core', $entry, OC_Log::FATAL);
|
||||||
error_log('DB error: '.$entry);
|
error_log('DB error: '.$entry);
|
||||||
die( $entry );
|
die( $entry );
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,7 @@ class OC_DB {
|
||||||
}catch(PDOException $e) {
|
}catch(PDOException $e) {
|
||||||
$entry = 'DB Error: "'.$e->getMessage().'"<br />';
|
$entry = 'DB Error: "'.$e->getMessage().'"<br />';
|
||||||
$entry .= 'Offending command was: '.htmlentities($query).'<br />';
|
$entry .= 'Offending command was: '.htmlentities($query).'<br />';
|
||||||
OC_Log::write('core', $entry,OC_Log::FATAL);
|
OC_Log::write('core', $entry, OC_Log::FATAL);
|
||||||
error_log('DB error: '.$entry);
|
error_log('DB error: '.$entry);
|
||||||
die( $entry );
|
die( $entry );
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ class OC_FileCache{
|
||||||
*
|
*
|
||||||
* $data is an assiciative array in the same format as returned by get
|
* $data is an assiciative array in the same format as returned by get
|
||||||
*/
|
*/
|
||||||
public static function put($path,$data, $root=false) {
|
public static function put($path, $data, $root=false) {
|
||||||
if($root===false) {
|
if($root===false) {
|
||||||
$root=OC_Filesystem::getRoot();
|
$root=OC_Filesystem::getRoot();
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ class OC_FileCache{
|
||||||
private static function update($id, $data) {
|
private static function update($id, $data) {
|
||||||
$arguments=array();
|
$arguments=array();
|
||||||
$queryParts=array();
|
$queryParts=array();
|
||||||
foreach(array('size','mtime','ctime','mimetype','encrypted','versioned','writable') as $attribute) {
|
foreach(array('size','mtime','ctime','mimetype','encrypted','versioned', 'writable') as $attribute) {
|
||||||
if(isset($data[$attribute])) {
|
if(isset($data[$attribute])) {
|
||||||
//Convert to int it args are false
|
//Convert to int it args are false
|
||||||
if($data[$attribute] === false) {
|
if($data[$attribute] === false) {
|
||||||
|
@ -227,7 +227,7 @@ class OC_FileCache{
|
||||||
$where = '`name` LIKE ? AND `user`=?';
|
$where = '`name` LIKE ? AND `user`=?';
|
||||||
}
|
}
|
||||||
$query=OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*fscache` WHERE '.$where);
|
$query=OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*fscache` WHERE '.$where);
|
||||||
$result=$query->execute(array("%$search%",OC_User::getUser()));
|
$result=$query->execute(array("%$search%", OC_User::getUser()));
|
||||||
$names=array();
|
$names=array();
|
||||||
while($row=$result->fetchRow()) {
|
while($row=$result->fetchRow()) {
|
||||||
if(!$returnData) {
|
if(!$returnData) {
|
||||||
|
@ -366,7 +366,7 @@ class OC_FileCache{
|
||||||
* @param int count (optional)
|
* @param int count (optional)
|
||||||
* @param string root (optional)
|
* @param string root (optional)
|
||||||
*/
|
*/
|
||||||
public static function scan($path,$eventSource=false,&$count=0, $root=false) {
|
public static function scan($path, $eventSource=false,&$count=0, $root=false) {
|
||||||
if($eventSource) {
|
if($eventSource) {
|
||||||
$eventSource->send('scanning', array('file'=>$path, 'count'=>$count));
|
$eventSource->send('scanning', array('file'=>$path, 'count'=>$count));
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,7 @@ class OC_FileCache{
|
||||||
}
|
}
|
||||||
|
|
||||||
OC_FileCache_Update::cleanFolder($path, $root);
|
OC_FileCache_Update::cleanFolder($path, $root);
|
||||||
self::increaseSize($path,$totalSize, $root);
|
self::increaseSize($path, $totalSize, $root);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -448,7 +448,7 @@ class OC_FileCache{
|
||||||
* @return array of file paths
|
* @return array of file paths
|
||||||
*
|
*
|
||||||
* $part1 and $part2 together form the complete mimetype.
|
* $part1 and $part2 together form the complete mimetype.
|
||||||
* e.g. searchByMime('text','plain')
|
* e.g. searchByMime('text', 'plain')
|
||||||
*
|
*
|
||||||
* seccond mimetype part can be ommited
|
* seccond mimetype part can be ommited
|
||||||
* e.g. searchByMime('audio')
|
* e.g. searchByMime('audio')
|
||||||
|
|
|
@ -165,7 +165,7 @@ class OC_FileCache_Update{
|
||||||
$mtime=$view->filemtime($path.'/');
|
$mtime=$view->filemtime($path.'/');
|
||||||
$ctime=$view->filectime($path.'/');
|
$ctime=$view->filectime($path.'/');
|
||||||
$writable=$view->is_writable($path.'/');
|
$writable=$view->is_writable($path.'/');
|
||||||
OC_FileCache::put($path, array('size'=>$size,'mtime'=>$mtime,'ctime'=>$ctime,'mimetype'=>$mimetype,'writable'=>$writable));
|
OC_FileCache::put($path, array('size'=>$size,'mtime'=>$mtime,'ctime'=>$ctime,'mimetype'=>$mimetype, 'writable'=>$writable));
|
||||||
}else{
|
}else{
|
||||||
$count=0;
|
$count=0;
|
||||||
OC_FileCache::scan($path, null, $count, $root);
|
OC_FileCache::scan($path, null, $count, $root);
|
||||||
|
@ -200,7 +200,7 @@ class OC_FileCache_Update{
|
||||||
* @param string newPath
|
* @param string newPath
|
||||||
* @param string root (optional)
|
* @param string root (optional)
|
||||||
*/
|
*/
|
||||||
public static function rename($oldPath,$newPath, $root=false) {
|
public static function rename($oldPath, $newPath, $root=false) {
|
||||||
if(!OC_FileCache::inCache($oldPath, $root)) {
|
if(!OC_FileCache::inCache($oldPath, $root)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ class OC_FileProxy{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function runPostProxies($operation,$path, $result) {
|
public static function runPostProxies($operation, $path, $result) {
|
||||||
if(!self::$enabled) {
|
if(!self::$enabled) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,9 @@ class OC_FileProxy_Quota extends OC_FileProxy{
|
||||||
if(in_array($user, $this->userQuota)) {
|
if(in_array($user, $this->userQuota)) {
|
||||||
return $this->userQuota[$user];
|
return $this->userQuota[$user];
|
||||||
}
|
}
|
||||||
$userQuota=OC_Preferences::getValue($user,'files','quota','default');
|
$userQuota=OC_Preferences::getValue($user,'files','quota', 'default');
|
||||||
if($userQuota=='default') {
|
if($userQuota=='default') {
|
||||||
$userQuota=OC_AppConfig::getValue('files','default_quota','none');
|
$userQuota=OC_AppConfig::getValue('files','default_quota', 'none');
|
||||||
}
|
}
|
||||||
if($userQuota=='none') {
|
if($userQuota=='none') {
|
||||||
$this->userQuota[$user]=0;
|
$this->userQuota[$user]=0;
|
||||||
|
|
|
@ -391,7 +391,7 @@ class OC_Files {
|
||||||
*/
|
*/
|
||||||
static function pull($source, $token, $dir, $file) {
|
static function pull($source, $token, $dir, $file) {
|
||||||
$tmpfile=tempnam(get_temp_dir(), 'remoteCloudFile');
|
$tmpfile=tempnam(get_temp_dir(), 'remoteCloudFile');
|
||||||
$fp=fopen($tmpfile,'w+');
|
$fp=fopen($tmpfile, 'w+');
|
||||||
$url=$source.="/files/pull.php?token=$token";
|
$url=$source.="/files/pull.php?token=$token";
|
||||||
$ch=curl_init();
|
$ch=curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
|
|
@ -48,7 +48,7 @@ abstract class OC_Filestorage{
|
||||||
abstract public function copy($path1, $path2);
|
abstract public function copy($path1, $path2);
|
||||||
abstract public function fopen($path, $mode);
|
abstract public function fopen($path, $mode);
|
||||||
abstract public function getMimeType($path);
|
abstract public function getMimeType($path);
|
||||||
abstract public function hash($type,$path, $raw = false);
|
abstract public function hash($type, $path, $raw = false);
|
||||||
abstract public function free_space($path);
|
abstract public function free_space($path);
|
||||||
abstract public function search($query);
|
abstract public function search($query);
|
||||||
abstract public function touch($path, $mtime=null);
|
abstract public function touch($path, $mtime=null);
|
||||||
|
|
|
@ -204,7 +204,7 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
|
||||||
unlink($tmpFile);
|
unlink($tmpFile);
|
||||||
return $mime;
|
return $mime;
|
||||||
}
|
}
|
||||||
public function hash($type,$path, $raw = false) {
|
public function hash($type, $path, $raw = false) {
|
||||||
$tmpFile=$this->getLocalFile();
|
$tmpFile=$this->getLocalFile();
|
||||||
$hash=hash($type, $tmpFile, $raw);
|
$hash=hash($type, $tmpFile, $raw);
|
||||||
unlink($tmpFile);
|
unlink($tmpFile);
|
||||||
|
@ -264,7 +264,7 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
|
||||||
$files[]=$dir.'/'.$item;
|
$files[]=$dir.'/'.$item;
|
||||||
}
|
}
|
||||||
if($this->is_dir($dir.'/'.$item)) {
|
if($this->is_dir($dir.'/'.$item)) {
|
||||||
$files=array_merge($files,$this->searchInDir($query, $dir.'/'.$item));
|
$files=array_merge($files, $this->searchInDir($query, $dir.'/'.$item));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,11 +86,11 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
|
||||||
}
|
}
|
||||||
public function rename($path1, $path2) {
|
public function rename($path1, $path2) {
|
||||||
if (!$this->isUpdatable($path1)) {
|
if (!$this->isUpdatable($path1)) {
|
||||||
OC_Log::write('core','unable to rename, file is not writable : '.$path1,OC_Log::ERROR);
|
OC_Log::write('core','unable to rename, file is not writable : '.$path1, OC_Log::ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(! $this->file_exists($path1)) {
|
if(! $this->file_exists($path1)) {
|
||||||
OC_Log::write('core','unable to rename, file does not exists : '.$path1,OC_Log::ERROR);
|
OC_Log::write('core','unable to rename, file does not exists : '.$path1, OC_Log::ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
|
||||||
if(!$this->file_exists($path2)) {
|
if(!$this->file_exists($path2)) {
|
||||||
$this->mkdir($path2);
|
$this->mkdir($path2);
|
||||||
}
|
}
|
||||||
$source=substr($path1, strrpos($path1,'/')+1);
|
$source=substr($path1, strrpos($path1, '/')+1);
|
||||||
$path2.=$source;
|
$path2.=$source;
|
||||||
}
|
}
|
||||||
return copy($this->datadir.$path1, $this->datadir.$path2);
|
return copy($this->datadir.$path1, $this->datadir.$path2);
|
||||||
|
@ -156,8 +156,8 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hash($path,$type, $raw=false) {
|
public function hash($path, $type, $raw=false) {
|
||||||
return hash_file($type,$this->datadir.$path, $raw);
|
return hash_file($type, $this->datadir.$path, $raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function free_space($path) {
|
public function free_space($path) {
|
||||||
|
@ -182,7 +182,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
|
||||||
$files[]=$dir.'/'.$item;
|
$files[]=$dir.'/'.$item;
|
||||||
}
|
}
|
||||||
if(is_dir($this->datadir.$dir.'/'.$item)) {
|
if(is_dir($this->datadir.$dir.'/'.$item)) {
|
||||||
$files=array_merge($files,$this->searchInDir($query, $dir.'/'.$item));
|
$files=array_merge($files, $this->searchInDir($query, $dir.'/'.$item));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $files;
|
return $files;
|
||||||
|
|
|
@ -35,10 +35,10 @@
|
||||||
* post_create(path)
|
* post_create(path)
|
||||||
* delete(path, &run)
|
* delete(path, &run)
|
||||||
* post_delete(path)
|
* post_delete(path)
|
||||||
* rename(oldpath,newpath, &run)
|
* rename(oldpath, newpath, &run)
|
||||||
* post_rename(oldpath,newpath)
|
* post_rename(oldpath, newpath)
|
||||||
* copy(oldpath,newpath, &run) (if the newpath doesn't exists yes, copy, create and write will be emited in that order)
|
* copy(oldpath, newpath, &run) (if the newpath doesn't exists yes, copy, create and write will be emited in that order)
|
||||||
* post_rename(oldpath,newpath)
|
* post_rename(oldpath, newpath)
|
||||||
*
|
*
|
||||||
* the &run parameter can be set to false to prevent the operation from occuring
|
* the &run parameter can be set to false to prevent the operation from occuring
|
||||||
*/
|
*/
|
||||||
|
@ -246,7 +246,7 @@ class OC_Filesystem{
|
||||||
}
|
}
|
||||||
|
|
||||||
$mtime=filemtime(OC::$SERVERROOT.'/config/mount.php');
|
$mtime=filemtime(OC::$SERVERROOT.'/config/mount.php');
|
||||||
$previousMTime=OC_Appconfig::getValue('files','mountconfigmtime',0);
|
$previousMTime=OC_Appconfig::getValue('files','mountconfigmtime', 0);
|
||||||
if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated
|
if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated
|
||||||
OC_FileCache::triggerUpdate();
|
OC_FileCache::triggerUpdate();
|
||||||
OC_Appconfig::setValue('files', 'mountconfigmtime', $mtime);
|
OC_Appconfig::setValue('files', 'mountconfigmtime', $mtime);
|
||||||
|
@ -312,7 +312,7 @@ class OC_Filesystem{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
OC_Log::write('core','storage backend '.$class.' not found',OC_Log::ERROR);
|
OC_Log::write('core','storage backend '.$class.' not found', OC_Log::ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,7 +356,7 @@ class OC_Filesystem{
|
||||||
if(substr($mountpoint, -1)!=='/') {
|
if(substr($mountpoint, -1)!=='/') {
|
||||||
$mountpoint=$mountpoint.'/';
|
$mountpoint=$mountpoint.'/';
|
||||||
}
|
}
|
||||||
self::$mounts[$mountpoint]=array('class'=>$class,'arguments'=>$arguments);
|
self::$mounts[$mountpoint]=array('class'=>$class, 'arguments'=>$arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -590,7 +590,7 @@ class OC_Filesystem{
|
||||||
$path=substr($path, 0, -1);
|
$path=substr($path, 0, -1);
|
||||||
}
|
}
|
||||||
//remove duplicate slashes
|
//remove duplicate slashes
|
||||||
while(strpos($path,'//')!==false) {
|
while(strpos($path, '//')!==false) {
|
||||||
$path=str_replace('//', '/', $path);
|
$path=str_replace('//', '/', $path);
|
||||||
}
|
}
|
||||||
//normalize unicode if possible
|
//normalize unicode if possible
|
||||||
|
|
|
@ -489,7 +489,7 @@ class OC_FilesystemView {
|
||||||
$hooks[]='write';
|
$hooks[]='write';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
OC_Log::write('core', 'invalid mode ('.$mode.') for '.$path,OC_Log::ERROR);
|
OC_Log::write('core', 'invalid mode ('.$mode.') for '.$path, OC_Log::ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->basicOperation('fopen', $path, $hooks, $mode);
|
return $this->basicOperation('fopen', $path, $hooks, $mode);
|
||||||
|
|
|
@ -271,7 +271,7 @@ class OC_Image {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(is_null($this->filepath) || !is_readable($this->filepath)) {
|
if(is_null($this->filepath) || !is_readable($this->filepath)) {
|
||||||
OC_Log::write('core','OC_Image->fixOrientation() No readable file path set.', OC_Log::DEBUG);
|
OC_Log::write('core', 'OC_Image->fixOrientation() No readable file path set.', OC_Log::DEBUG);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
$exif = @exif_read_data($this->filepath, 'IFD0');
|
$exif = @exif_read_data($this->filepath, 'IFD0');
|
||||||
|
|
|
@ -57,7 +57,7 @@ class OC_Installer{
|
||||||
*/
|
*/
|
||||||
public static function installApp( $data = array()) {
|
public static function installApp( $data = array()) {
|
||||||
if(!isset($data['source'])) {
|
if(!isset($data['source'])) {
|
||||||
OC_Log::write('core','No source specified when installing app',OC_Log::ERROR);
|
OC_Log::write('core','No source specified when installing app', OC_Log::ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,13 +65,13 @@ class OC_Installer{
|
||||||
if($data['source']=='http') {
|
if($data['source']=='http') {
|
||||||
$path=OC_Helper::tmpFile();
|
$path=OC_Helper::tmpFile();
|
||||||
if(!isset($data['href'])) {
|
if(!isset($data['href'])) {
|
||||||
OC_Log::write('core','No href specified when installing app from http',OC_Log::ERROR);
|
OC_Log::write('core','No href specified when installing app from http', OC_Log::ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
copy($data['href'], $path);
|
copy($data['href'], $path);
|
||||||
}else{
|
}else{
|
||||||
if(!isset($data['path'])) {
|
if(!isset($data['path'])) {
|
||||||
OC_Log::write('core','No path specified when installing app from local file',OC_Log::ERROR);
|
OC_Log::write('core','No path specified when installing app from local file', OC_Log::ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$path=$data['path'];
|
$path=$data['path'];
|
||||||
|
@ -86,7 +86,7 @@ class OC_Installer{
|
||||||
rename($path, $path.'.tgz');
|
rename($path, $path.'.tgz');
|
||||||
$path.='.tgz';
|
$path.='.tgz';
|
||||||
}else{
|
}else{
|
||||||
OC_Log::write('core','Archives of type '.$mime.' are not supported',OC_Log::ERROR);
|
OC_Log::write('core','Archives of type '.$mime.' are not supported', OC_Log::ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ class OC_Installer{
|
||||||
* -# including appinfo/upgrade.php
|
* -# including appinfo/upgrade.php
|
||||||
* -# setting the installed version
|
* -# setting the installed version
|
||||||
*
|
*
|
||||||
* upgrade.php can determine the current installed version of the app using "OC_Appconfig::getValue($appid,'installed_version')"
|
* upgrade.php can determine the current installed version of the app using "OC_Appconfig::getValue($appid, 'installed_version')"
|
||||||
*/
|
*/
|
||||||
public static function upgradeApp( $data = array()) {
|
public static function upgradeApp( $data = array()) {
|
||||||
// TODO: write function
|
// TODO: write function
|
||||||
|
|
|
@ -72,7 +72,7 @@ class OC_JSON{
|
||||||
public static function checkSubAdminUser() {
|
public static function checkSubAdminUser() {
|
||||||
self::checkLoggedIn();
|
self::checkLoggedIn();
|
||||||
self::verifyUser();
|
self::verifyUser();
|
||||||
if(!OC_Group::inGroup(OC_User::getUser(),'admin') && !OC_SubAdmin::isSubAdmin(OC_User::getUser())) {
|
if(!OC_Group::inGroup(OC_User::getUser(), 'admin') && !OC_SubAdmin::isSubAdmin(OC_User::getUser())) {
|
||||||
$l = OC_L10N::get('lib');
|
$l = OC_L10N::get('lib');
|
||||||
self::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
|
self::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
|
||||||
exit();
|
exit();
|
||||||
|
|
|
@ -167,7 +167,7 @@ class OC_L10N{
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function tA($textArray) {
|
public function tA($textArray) {
|
||||||
OC_Log::write('core', 'DEPRECATED: the method tA is deprecated and will be removed soon.',OC_Log::WARN);
|
OC_Log::write('core', 'DEPRECATED: the method tA is deprecated and will be removed soon.', OC_Log::WARN);
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach($textArray as $key => $text) {
|
foreach($textArray as $key => $text) {
|
||||||
$result[$key] = (string)$this->t($text);
|
$result[$key] = (string)$this->t($text);
|
||||||
|
|
|
@ -44,9 +44,9 @@ class OC_Log_Owncloud {
|
||||||
* @param int level
|
* @param int level
|
||||||
*/
|
*/
|
||||||
public static function write($app, $message, $level) {
|
public static function write($app, $message, $level) {
|
||||||
$minLevel=min(OC_Config::getValue( "loglevel", OC_Log::WARN ),OC_Log::ERROR);
|
$minLevel=min(OC_Config::getValue( "loglevel", OC_Log::WARN ), OC_Log::ERROR);
|
||||||
if($level>=$minLevel) {
|
if($level>=$minLevel) {
|
||||||
$entry=array('app'=>$app, 'message'=>$message, 'level'=>$level,'time'=>time());
|
$entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=>time());
|
||||||
$fh=fopen(self::$logFile, 'a');
|
$fh=fopen(self::$logFile, 'a');
|
||||||
fwrite($fh, json_encode($entry)."\n");
|
fwrite($fh, json_encode($entry)."\n");
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
|
|
|
@ -27,7 +27,7 @@ class OC_Mail {
|
||||||
* @param string $fromname
|
* @param string $fromname
|
||||||
* @param bool $html
|
* @param bool $html
|
||||||
*/
|
*/
|
||||||
public static function send($toaddress,$toname,$subject,$mailtext,$fromaddress,$fromname,$html=0,$altbody='',$ccaddress='',$ccname='',$bcc='') {
|
public static function send($toaddress,$toname,$subject,$mailtext,$fromaddress,$fromname,$html=0,$altbody='',$ccaddress='',$ccname='', $bcc='') {
|
||||||
|
|
||||||
$SMTPMODE = OC_Config::getValue( 'mail_smtpmode', 'sendmail' );
|
$SMTPMODE = OC_Config::getValue( 'mail_smtpmode', 'sendmail' );
|
||||||
$SMTPHOST = OC_Config::getValue( 'mail_smtphost', '127.0.0.1' );
|
$SMTPHOST = OC_Config::getValue( 'mail_smtphost', '127.0.0.1' );
|
||||||
|
|
|
@ -611,11 +611,11 @@ class OC_Migrate{
|
||||||
if( file_exists( $db ) ) {
|
if( file_exists( $db ) ) {
|
||||||
// Connect to the db
|
// Connect to the db
|
||||||
if(!self::connectDB( $db )) {
|
if(!self::connectDB( $db )) {
|
||||||
OC_Log::write('migration','Failed to connect to migration.db',OC_Log::ERROR);
|
OC_Log::write('migration','Failed to connect to migration.db', OC_Log::ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
OC_Log::write('migration','Migration.db not found at: '.$db, OC_Log::FATAL );
|
OC_Log::write('migration', 'Migration.db not found at: '.$db, OC_Log::FATAL );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ class OC_Migration_Content{
|
||||||
}
|
}
|
||||||
closedir($dirhandle);
|
closedir($dirhandle);
|
||||||
} else {
|
} else {
|
||||||
OC_Log::write('admin_export',"Was not able to open directory: " . $dir,OC_Log::ERROR);
|
OC_Log::write('admin_export',"Was not able to open directory: " . $dir, OC_Log::ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -162,7 +162,7 @@ class OC_OCSClient{
|
||||||
$xml=OC_OCSClient::getOCSresponse($url);
|
$xml=OC_OCSClient::getOCSresponse($url);
|
||||||
|
|
||||||
if($xml==false) {
|
if($xml==false) {
|
||||||
OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL);
|
OC_Log::write('core','Unable to parse OCS content', OC_Log::FATAL);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$data=simplexml_load_string($xml);
|
$data=simplexml_load_string($xml);
|
||||||
|
@ -200,7 +200,7 @@ class OC_OCSClient{
|
||||||
$xml=OC_OCSClient::getOCSresponse($url);
|
$xml=OC_OCSClient::getOCSresponse($url);
|
||||||
|
|
||||||
if($xml==false) {
|
if($xml==false) {
|
||||||
OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL);
|
OC_Log::write('core','Unable to parse OCS content', OC_Log::FATAL);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$data=simplexml_load_string($xml);
|
$data=simplexml_load_string($xml);
|
||||||
|
@ -238,7 +238,7 @@ class OC_OCSClient{
|
||||||
$xml=OC_OCSClient::getOCSresponse($url);
|
$xml=OC_OCSClient::getOCSresponse($url);
|
||||||
|
|
||||||
if($xml==false) {
|
if($xml==false) {
|
||||||
OC_Log::write('core','Unable to parse knowledgebase content',OC_Log::FATAL);
|
OC_Log::write('core','Unable to parse knowledgebase content', OC_Log::FATAL);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$data=simplexml_load_string($xml);
|
$data=simplexml_load_string($xml);
|
||||||
|
|
|
@ -63,7 +63,7 @@ class OC_Request {
|
||||||
$path_info = substr($_SERVER['REQUEST_URI'], strlen($_SERVER['SCRIPT_NAME']));
|
$path_info = substr($_SERVER['REQUEST_URI'], strlen($_SERVER['SCRIPT_NAME']));
|
||||||
// following is taken from Sabre_DAV_URLUtil::decodePathSegment
|
// following is taken from Sabre_DAV_URLUtil::decodePathSegment
|
||||||
$path_info = rawurldecode($path_info);
|
$path_info = rawurldecode($path_info);
|
||||||
$encoding = mb_detect_encoding($path_info, array('UTF-8','ISO-8859-1'));
|
$encoding = mb_detect_encoding($path_info, array('UTF-8', 'ISO-8859-1'));
|
||||||
|
|
||||||
switch($encoding) {
|
switch($encoding) {
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class OC_Request {
|
||||||
$HTTP_ACCEPT_ENCODING = $_SERVER["HTTP_ACCEPT_ENCODING"];
|
$HTTP_ACCEPT_ENCODING = $_SERVER["HTTP_ACCEPT_ENCODING"];
|
||||||
if( strpos($HTTP_ACCEPT_ENCODING, 'x-gzip') !== false )
|
if( strpos($HTTP_ACCEPT_ENCODING, 'x-gzip') !== false )
|
||||||
return 'x-gzip';
|
return 'x-gzip';
|
||||||
else if( strpos($HTTP_ACCEPT_ENCODING,'gzip') !== false )
|
else if( strpos($HTTP_ACCEPT_ENCODING, 'gzip') !== false )
|
||||||
return 'gzip';
|
return 'gzip';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ class OC_Route extends Route {
|
||||||
public function actionInclude($file) {
|
public function actionInclude($file) {
|
||||||
$function = create_function('$param',
|
$function = create_function('$param',
|
||||||
'unset($param["_route"]);'
|
'unset($param["_route"]);'
|
||||||
.'$_GET=array_merge($_GET,$param);'
|
.'$_GET=array_merge($_GET, $param);'
|
||||||
.'unset($param);'
|
.'unset($param);'
|
||||||
.'require_once "'.$file.'";');
|
.'require_once "'.$file.'";');
|
||||||
$this->action($function);
|
$this->action($function);
|
||||||
|
|
|
@ -41,7 +41,7 @@ class OC_Search{
|
||||||
* @param string $provider class name of a OC_Search_Provider
|
* @param string $provider class name of a OC_Search_Provider
|
||||||
*/
|
*/
|
||||||
public static function registerProvider($class, $options=array()) {
|
public static function registerProvider($class, $options=array()) {
|
||||||
self::$registeredProviders[]=array('class'=>$class,'options'=>$options);
|
self::$registeredProviders[]=array('class'=>$class, 'options'=>$options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -95,7 +95,7 @@ class OC_Setup {
|
||||||
//write the config file
|
//write the config file
|
||||||
OC_Config::setValue('datadirectory', $datadir);
|
OC_Config::setValue('datadirectory', $datadir);
|
||||||
OC_Config::setValue('dbtype', $dbtype);
|
OC_Config::setValue('dbtype', $dbtype);
|
||||||
OC_Config::setValue('version', implode('.',OC_Util::getVersion()));
|
OC_Config::setValue('version', implode('.', OC_Util::getVersion()));
|
||||||
if($dbtype == 'mysql') {
|
if($dbtype == 'mysql') {
|
||||||
$dbuser = $options['dbuser'];
|
$dbuser = $options['dbuser'];
|
||||||
$dbpass = $options['dbpass'];
|
$dbpass = $options['dbpass'];
|
||||||
|
|
|
@ -234,7 +234,7 @@ class OC_CloseStreamWrapper{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stream_seek($offset, $whence=SEEK_SET) {
|
public function stream_seek($offset, $whence=SEEK_SET) {
|
||||||
fseek($this->source,$offset, $whence);
|
fseek($this->source, $offset, $whence);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stream_tell() {
|
public function stream_tell() {
|
||||||
|
@ -249,16 +249,16 @@ class OC_CloseStreamWrapper{
|
||||||
return fwrite($this->source, $data);
|
return fwrite($this->source, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stream_set_option($option,$arg1, $arg2) {
|
public function stream_set_option($option, $arg1, $arg2) {
|
||||||
switch($option) {
|
switch($option) {
|
||||||
case STREAM_OPTION_BLOCKING:
|
case STREAM_OPTION_BLOCKING:
|
||||||
stream_set_blocking($this->source, $arg1);
|
stream_set_blocking($this->source, $arg1);
|
||||||
break;
|
break;
|
||||||
case STREAM_OPTION_READ_TIMEOUT:
|
case STREAM_OPTION_READ_TIMEOUT:
|
||||||
stream_set_timeout($this->source,$arg1, $arg2);
|
stream_set_timeout($this->source, $arg1, $arg2);
|
||||||
break;
|
break;
|
||||||
case STREAM_OPTION_WRITE_BUFFER:
|
case STREAM_OPTION_WRITE_BUFFER:
|
||||||
stream_set_write_buffer($this->source,$arg1, $arg2);
|
stream_set_write_buffer($this->source, $arg1, $arg2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,11 +196,11 @@ class OC_Template{
|
||||||
public static function detectFormfactor() {
|
public static function detectFormfactor() {
|
||||||
// please add more useragent strings for other devices
|
// please add more useragent strings for other devices
|
||||||
if(isset($_SERVER['HTTP_USER_AGENT'])) {
|
if(isset($_SERVER['HTTP_USER_AGENT'])) {
|
||||||
if(stripos($_SERVER['HTTP_USER_AGENT'],'ipad')>0) {
|
if(stripos($_SERVER['HTTP_USER_AGENT'], 'ipad')>0) {
|
||||||
$mode='tablet';
|
$mode='tablet';
|
||||||
}elseif(stripos($_SERVER['HTTP_USER_AGENT'],'iphone')>0) {
|
}elseif(stripos($_SERVER['HTTP_USER_AGENT'], 'iphone')>0) {
|
||||||
$mode='mobile';
|
$mode='mobile';
|
||||||
}elseif((stripos($_SERVER['HTTP_USER_AGENT'],'N9')>0) and (stripos($_SERVER['HTTP_USER_AGENT'],'nokia')>0)) {
|
}elseif((stripos($_SERVER['HTTP_USER_AGENT'],'N9')>0) and (stripos($_SERVER['HTTP_USER_AGENT'], 'nokia')>0)) {
|
||||||
$mode='mobile';
|
$mode='mobile';
|
||||||
}else{
|
}else{
|
||||||
$mode='default';
|
$mode='default';
|
||||||
|
@ -357,7 +357,7 @@ class OC_Template{
|
||||||
* @param string $text the text content for the element
|
* @param string $text the text content for the element
|
||||||
*/
|
*/
|
||||||
public function addHeader( $tag, $attributes, $text='') {
|
public function addHeader( $tag, $attributes, $text='') {
|
||||||
$this->headers[]=array('tag'=>$tag,'attributes'=>$attributes,'text'=>$text);
|
$this->headers[]=array('tag'=>$tag,'attributes'=>$attributes, 'text'=>$text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,10 +12,10 @@ class OC_TemplateLayout extends OC_Template {
|
||||||
|
|
||||||
if( $renderas == 'user' ) {
|
if( $renderas == 'user' ) {
|
||||||
parent::__construct( 'core', 'layout.user' );
|
parent::__construct( 'core', 'layout.user' );
|
||||||
if(in_array(OC_APP::getCurrentApp(), array('settings','admin','help'))!==false) {
|
if(in_array(OC_APP::getCurrentApp(), array('settings','admin', 'help'))!==false) {
|
||||||
$this->assign('bodyid','body-settings', false);
|
$this->assign('bodyid', 'body-settings', false);
|
||||||
}else{
|
}else{
|
||||||
$this->assign('bodyid','body-user', false);
|
$this->assign('bodyid', 'body-user', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add navigation entry
|
// Add navigation entry
|
||||||
|
|
|
@ -30,7 +30,7 @@ class OC_Updater{
|
||||||
*/
|
*/
|
||||||
public static function check() {
|
public static function check() {
|
||||||
OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true));
|
OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true));
|
||||||
if(OC_Appconfig::getValue('core', 'installedat','')=='') OC_Appconfig::setValue('core', 'installedat', microtime(true));
|
if(OC_Appconfig::getValue('core', 'installedat', '')=='') OC_Appconfig::setValue('core', 'installedat', microtime(true));
|
||||||
|
|
||||||
$updaterurl='http://apps.owncloud.com/updater.php';
|
$updaterurl='http://apps.owncloud.com/updater.php';
|
||||||
$version=OC_Util::getVersion();
|
$version=OC_Util::getVersion();
|
||||||
|
|
|
@ -133,7 +133,7 @@ class OC_User {
|
||||||
self::useBackend($backend);
|
self::useBackend($backend);
|
||||||
$_setupedBackends[]=$i;
|
$_setupedBackends[]=$i;
|
||||||
}else{
|
}else{
|
||||||
OC_Log::write('core','User backend '.$class.' not found.',OC_Log::ERROR);
|
OC_Log::write('core','User backend '.$class.' not found.', OC_Log::ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ class OC_User_Database extends OC_User_Backend {
|
||||||
* Get a list of all users.
|
* Get a list of all users.
|
||||||
*/
|
*/
|
||||||
public function getUsers($search = '', $limit = null, $offset = null) {
|
public function getUsers($search = '', $limit = null, $offset = null) {
|
||||||
$query = OC_DB::prepare('SELECT `uid` FROM `*PREFIX*users` WHERE LOWER(`uid`) LIKE LOWER(?)',$limit, $offset);
|
$query = OC_DB::prepare('SELECT `uid` FROM `*PREFIX*users` WHERE LOWER(`uid`) LIKE LOWER(?)', $limit, $offset);
|
||||||
$result = $query->execute(array($search.'%'));
|
$result = $query->execute(array($search.'%'));
|
||||||
$users = array();
|
$users = array();
|
||||||
while ($row = $result->fetchRow()) {
|
while ($row = $result->fetchRow()) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ class OC_User_HTTP extends OC_User_Backend {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
private function matchUrl($url) {
|
private function matchUrl($url) {
|
||||||
return ! is_null(parse_url($url,PHP_URL_USER));
|
return ! is_null(parse_url($url, PHP_URL_USER));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
38
lib/util.php
38
lib/util.php
|
@ -95,7 +95,7 @@ class OC_Util {
|
||||||
*/
|
*/
|
||||||
public static function getVersion() {
|
public static function getVersion() {
|
||||||
// hint: We only can count up. So the internal version number of ownCloud 4.5 will be 4.90.0. This is not visible to the user
|
// hint: We only can count up. So the internal version number of ownCloud 4.5 will be 4.90.0. This is not visible to the user
|
||||||
return array(4,91, 00);
|
return array(4, 91, 00);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -157,7 +157,7 @@ class OC_Util {
|
||||||
* @param string $text the text content for the element
|
* @param string $text the text content for the element
|
||||||
*/
|
*/
|
||||||
public static function addHeader( $tag, $attributes, $text='') {
|
public static function addHeader( $tag, $attributes, $text='') {
|
||||||
self::$headers[]=array('tag'=>$tag,'attributes'=>$attributes,'text'=>$text);
|
self::$headers[]=array('tag'=>$tag,'attributes'=>$attributes, 'text'=>$text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -186,7 +186,7 @@ class OC_Util {
|
||||||
* @param string $url
|
* @param string $url
|
||||||
* @return OC_Template
|
* @return OC_Template
|
||||||
*/
|
*/
|
||||||
public static function getPageNavi($pagecount,$page, $url) {
|
public static function getPageNavi($pagecount, $page, $url) {
|
||||||
|
|
||||||
$pagelinkcount=8;
|
$pagelinkcount=8;
|
||||||
if ($pagecount>1) {
|
if ($pagecount>1) {
|
||||||
|
@ -217,7 +217,7 @@ class OC_Util {
|
||||||
$web_server_restart= false;
|
$web_server_restart= false;
|
||||||
//check for database drivers
|
//check for database drivers
|
||||||
if(!(is_callable('sqlite_open') or class_exists('SQLite3')) 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
|
$errors[]=array('error'=>'No database drivers (sqlite, mysql, or postgresql) installed.<br/>', 'hint'=>'');//TODO: sane hint
|
||||||
$web_server_restart= true;
|
$web_server_restart= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,13 +226,13 @@ class OC_Util {
|
||||||
|
|
||||||
// Check if config folder is writable.
|
// Check if config folder is writable.
|
||||||
if(!is_writable(OC::$SERVERROOT."/config/") or !is_readable(OC::$SERVERROOT."/config/")) {
|
if(!is_writable(OC::$SERVERROOT."/config/") or !is_readable(OC::$SERVERROOT."/config/")) {
|
||||||
$errors[]=array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud");
|
$errors[]=array('error'=>"Can't write into config directory 'config'", 'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if there is a writable install folder.
|
// Check if there is a writable install folder.
|
||||||
if(OC_Config::getValue('appstoreenabled', true)) {
|
if(OC_Config::getValue('appstoreenabled', true)) {
|
||||||
if( OC_App::getInstallPath() === null || !is_writable(OC_App::getInstallPath()) || !is_readable(OC_App::getInstallPath()) ) {
|
if( OC_App::getInstallPath() === null || !is_writable(OC_App::getInstallPath()) || !is_readable(OC_App::getInstallPath()) ) {
|
||||||
$errors[]=array('error'=>"Can't write into apps directory",'hint'=>"You can usually fix this by giving the webserver user write access to the apps directory
|
$errors[]=array('error'=>"Can't write into apps directory", 'hint'=>"You can usually fix this by giving the webserver user write access to the apps directory
|
||||||
in owncloud or disabling the appstore in the config file.");
|
in owncloud or disabling the appstore in the config file.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -269,57 +269,57 @@ class OC_Util {
|
||||||
if(!is_dir($CONFIG_DATADIRECTORY)) {
|
if(!is_dir($CONFIG_DATADIRECTORY)) {
|
||||||
$success=@mkdir($CONFIG_DATADIRECTORY);
|
$success=@mkdir($CONFIG_DATADIRECTORY);
|
||||||
if(!$success) {
|
if(!$success) {
|
||||||
$errors[]=array('error'=>"Can't create data directory (".$CONFIG_DATADIRECTORY.")",'hint'=>"You can usually fix this by giving the webserver write access to the ownCloud directory '".OC::$SERVERROOT."' (in a terminal, use the command 'chown -R www-data:www-data /path/to/your/owncloud/install/data' ");
|
$errors[]=array('error'=>"Can't create data directory (".$CONFIG_DATADIRECTORY.")", 'hint'=>"You can usually fix this by giving the webserver write access to the ownCloud directory '".OC::$SERVERROOT."' (in a terminal, use the command 'chown -R www-data:www-data /path/to/your/owncloud/install/data' ");
|
||||||
}
|
}
|
||||||
} else if(!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
|
} else if(!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
|
||||||
$errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY.') not writable by ownCloud<br/>','hint'=>$permissionsHint);
|
$errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY.') not writable by ownCloud<br/>', 'hint'=>$permissionsHint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if all required php modules are present
|
// check if all required php modules are present
|
||||||
if(!class_exists('ZipArchive')) {
|
if(!class_exists('ZipArchive')) {
|
||||||
$errors[]=array('error'=>'PHP module zip not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
|
$errors[]=array('error'=>'PHP module zip not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
|
||||||
$web_server_restart= false;
|
$web_server_restart= false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!function_exists('mb_detect_encoding')) {
|
if(!function_exists('mb_detect_encoding')) {
|
||||||
$errors[]=array('error'=>'PHP module mb multibyte not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
|
$errors[]=array('error'=>'PHP module mb multibyte not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
|
||||||
$web_server_restart= false;
|
$web_server_restart= false;
|
||||||
}
|
}
|
||||||
if(!function_exists('ctype_digit')) {
|
if(!function_exists('ctype_digit')) {
|
||||||
$errors[]=array('error'=>'PHP module ctype is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
|
$errors[]=array('error'=>'PHP module ctype is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
|
||||||
$web_server_restart= false;
|
$web_server_restart= false;
|
||||||
}
|
}
|
||||||
if(!function_exists('json_encode')) {
|
if(!function_exists('json_encode')) {
|
||||||
$errors[]=array('error'=>'PHP module JSON is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
|
$errors[]=array('error'=>'PHP module JSON is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
|
||||||
$web_server_restart= false;
|
$web_server_restart= false;
|
||||||
}
|
}
|
||||||
if(!function_exists('imagepng')) {
|
if(!function_exists('imagepng')) {
|
||||||
$errors[]=array('error'=>'PHP module GD is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
|
$errors[]=array('error'=>'PHP module GD is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
|
||||||
$web_server_restart= false;
|
$web_server_restart= false;
|
||||||
}
|
}
|
||||||
if(!function_exists('gzencode')) {
|
if(!function_exists('gzencode')) {
|
||||||
$errors[]=array('error'=>'PHP module zlib is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
|
$errors[]=array('error'=>'PHP module zlib is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
|
||||||
$web_server_restart= false;
|
$web_server_restart= false;
|
||||||
}
|
}
|
||||||
if(!function_exists('iconv')) {
|
if(!function_exists('iconv')) {
|
||||||
$errors[]=array('error'=>'PHP module iconv is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
|
$errors[]=array('error'=>'PHP module iconv is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
|
||||||
$web_server_restart= false;
|
$web_server_restart= false;
|
||||||
}
|
}
|
||||||
if(!function_exists('simplexml_load_string')) {
|
if(!function_exists('simplexml_load_string')) {
|
||||||
$errors[]=array('error'=>'PHP module SimpleXML is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
|
$errors[]=array('error'=>'PHP module SimpleXML is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
|
||||||
$web_server_restart= false;
|
$web_server_restart= false;
|
||||||
}
|
}
|
||||||
if(floatval(phpversion())<5.3) {
|
if(floatval(phpversion())<5.3) {
|
||||||
$errors[]=array('error'=>'PHP 5.3 is required.<br/>','hint'=>'Please ask your server administrator to update PHP to version 5.3 or higher. PHP 5.2 is no longer supported by ownCloud and the PHP community.');
|
$errors[]=array('error'=>'PHP 5.3 is required.<br/>', 'hint'=>'Please ask your server administrator to update PHP to version 5.3 or higher. PHP 5.2 is no longer supported by ownCloud and the PHP community.');
|
||||||
$web_server_restart= false;
|
$web_server_restart= false;
|
||||||
}
|
}
|
||||||
if(!defined('PDO::ATTR_DRIVER_NAME')) {
|
if(!defined('PDO::ATTR_DRIVER_NAME')) {
|
||||||
$errors[]=array('error'=>'PHP PDO module is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
|
$errors[]=array('error'=>'PHP PDO module is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
|
||||||
$web_server_restart= false;
|
$web_server_restart= false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($web_server_restart) {
|
if($web_server_restart) {
|
||||||
$errors[]=array('error'=>'PHP modules have been installed, but they are still listed as missing?<br/>','hint'=>'Please ask your server administrator to restart the web server.');
|
$errors[]=array('error'=>'PHP modules have been installed, but they are still listed as missing?<br/>', 'hint'=>'Please ask your server administrator to restart the web server.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $errors;
|
return $errors;
|
||||||
|
|
|
@ -66,7 +66,7 @@ class OC_VCategories {
|
||||||
* @returns array containing the categories as strings.
|
* @returns array containing the categories as strings.
|
||||||
*/
|
*/
|
||||||
public function categories() {
|
public function categories() {
|
||||||
//OC_Log::write('core','OC_VCategories::categories: '.print_r($this->categories, true), OC_Log::DEBUG);
|
//OC_Log::write('core', 'OC_VCategories::categories: '.print_r($this->categories, true), OC_Log::DEBUG);
|
||||||
if(!$this->categories) {
|
if(!$this->categories) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
@ -139,12 +139,12 @@ class OC_VCategories {
|
||||||
$this->categories = array();
|
$this->categories = array();
|
||||||
}
|
}
|
||||||
foreach($objects as $object) {
|
foreach($objects as $object) {
|
||||||
//OC_Log::write('core','OC_VCategories::rescan: '.substr($object, 0, 100).'(...)', OC_Log::DEBUG);
|
//OC_Log::write('core', 'OC_VCategories::rescan: '.substr($object, 0, 100).'(...)', OC_Log::DEBUG);
|
||||||
$vobject = OC_VObject::parse($object);
|
$vobject = OC_VObject::parse($object);
|
||||||
if(!is_null($vobject)) {
|
if(!is_null($vobject)) {
|
||||||
$this->loadFromVObject($vobject, $sync);
|
$this->loadFromVObject($vobject, $sync);
|
||||||
} else {
|
} else {
|
||||||
OC_Log::write('core','OC_VCategories::rescan, unable to parse. ID: '.', '.substr($object, 0, 100).'(...)', OC_Log::DEBUG);
|
OC_Log::write('core', 'OC_VCategories::rescan, unable to parse. ID: '.', '.substr($object, 0, 100).'(...)', OC_Log::DEBUG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->save();
|
$this->save();
|
||||||
|
@ -158,9 +158,9 @@ class OC_VCategories {
|
||||||
usort($this->categories, 'strnatcasecmp'); // usort to also renumber the keys
|
usort($this->categories, 'strnatcasecmp'); // usort to also renumber the keys
|
||||||
$escaped_categories = serialize($this->categories);
|
$escaped_categories = serialize($this->categories);
|
||||||
OC_Preferences::setValue($this->user, $this->app, self::PREF_CATEGORIES_LABEL, $escaped_categories);
|
OC_Preferences::setValue($this->user, $this->app, self::PREF_CATEGORIES_LABEL, $escaped_categories);
|
||||||
OC_Log::write('core','OC_VCategories::save: '.print_r($this->categories, true), OC_Log::DEBUG);
|
OC_Log::write('core', 'OC_VCategories::save: '.print_r($this->categories, true), OC_Log::DEBUG);
|
||||||
} else {
|
} else {
|
||||||
OC_Log::write('core','OC_VCategories::save: $this->categories is not an array! '.print_r($this->categories, true), OC_Log::ERROR);
|
OC_Log::write('core', 'OC_VCategories::save: $this->categories is not an array! '.print_r($this->categories, true), OC_Log::ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,37 +173,37 @@ class OC_VCategories {
|
||||||
if(!is_array($names)) {
|
if(!is_array($names)) {
|
||||||
$names = array($names);
|
$names = array($names);
|
||||||
}
|
}
|
||||||
OC_Log::write('core','OC_VCategories::delete, before: '.print_r($this->categories, true), OC_Log::DEBUG);
|
OC_Log::write('core', 'OC_VCategories::delete, before: '.print_r($this->categories, true), OC_Log::DEBUG);
|
||||||
foreach($names as $name) {
|
foreach($names as $name) {
|
||||||
OC_Log::write('core','OC_VCategories::delete: '.$name, OC_Log::DEBUG);
|
OC_Log::write('core', 'OC_VCategories::delete: '.$name, OC_Log::DEBUG);
|
||||||
if($this->hasCategory($name)) {
|
if($this->hasCategory($name)) {
|
||||||
//OC_Log::write('core','OC_VCategories::delete: '.$name.' got it', OC_Log::DEBUG);
|
//OC_Log::write('core', 'OC_VCategories::delete: '.$name.' got it', OC_Log::DEBUG);
|
||||||
unset($this->categories[$this->array_searchi($name, $this->categories)]);
|
unset($this->categories[$this->array_searchi($name, $this->categories)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->save();
|
$this->save();
|
||||||
OC_Log::write('core','OC_VCategories::delete, after: '.print_r($this->categories, true), OC_Log::DEBUG);
|
OC_Log::write('core', 'OC_VCategories::delete, after: '.print_r($this->categories, true), OC_Log::DEBUG);
|
||||||
if(!is_null($objects)) {
|
if(!is_null($objects)) {
|
||||||
foreach($objects as $key=>&$value) {
|
foreach($objects as $key=>&$value) {
|
||||||
$vobject = OC_VObject::parse($value[1]);
|
$vobject = OC_VObject::parse($value[1]);
|
||||||
if(!is_null($vobject)) {
|
if(!is_null($vobject)) {
|
||||||
$categories = $vobject->getAsArray('CATEGORIES');
|
$categories = $vobject->getAsArray('CATEGORIES');
|
||||||
//OC_Log::write('core','OC_VCategories::delete, before: '.$key.': '.print_r($categories, true), OC_Log::DEBUG);
|
//OC_Log::write('core', 'OC_VCategories::delete, before: '.$key.': '.print_r($categories, true), OC_Log::DEBUG);
|
||||||
foreach($names as $name) {
|
foreach($names as $name) {
|
||||||
$idx = $this->array_searchi($name, $categories);
|
$idx = $this->array_searchi($name, $categories);
|
||||||
//OC_Log::write('core','OC_VCategories::delete, loop: '.$name.', '.print_r($idx, true), OC_Log::DEBUG);
|
//OC_Log::write('core', 'OC_VCategories::delete, loop: '.$name.', '.print_r($idx, true), OC_Log::DEBUG);
|
||||||
if($idx !== false) {
|
if($idx !== false) {
|
||||||
OC_Log::write('core','OC_VCategories::delete, unsetting: '.$categories[$this->array_searchi($name, $categories)], OC_Log::DEBUG);
|
OC_Log::write('core', 'OC_VCategories::delete, unsetting: '.$categories[$this->array_searchi($name, $categories)], OC_Log::DEBUG);
|
||||||
unset($categories[$this->array_searchi($name, $categories)]);
|
unset($categories[$this->array_searchi($name, $categories)]);
|
||||||
//unset($categories[$idx]);
|
//unset($categories[$idx]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//OC_Log::write('core','OC_VCategories::delete, after: '.$key.': '.print_r($categories, true), OC_Log::DEBUG);
|
//OC_Log::write('core', 'OC_VCategories::delete, after: '.$key.': '.print_r($categories, true), OC_Log::DEBUG);
|
||||||
$vobject->setString('CATEGORIES', implode(',', $categories));
|
$vobject->setString('CATEGORIES', implode(',', $categories));
|
||||||
$value[1] = $vobject->serialize();
|
$value[1] = $vobject->serialize();
|
||||||
$objects[$key] = $value;
|
$objects[$key] = $value;
|
||||||
} else {
|
} else {
|
||||||
OC_Log::write('core','OC_VCategories::delete, unable to parse. ID: '.$value[0].', '.substr($value[1], 0, 50).'(...)', OC_Log::DEBUG);
|
OC_Log::write('core', 'OC_VCategories::delete, unable to parse. ID: '.$value[0].', '.substr($value[1], 0, 50).'(...)', OC_Log::DEBUG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ function compareEntries($a, $b) {
|
||||||
}
|
}
|
||||||
usort($entries, 'compareEntries');
|
usort($entries, 'compareEntries');
|
||||||
|
|
||||||
$tmpl->assign('loglevel',OC_Config::getValue( "loglevel", 2 ));
|
$tmpl->assign('loglevel', OC_Config::getValue( "loglevel", 2 ));
|
||||||
$tmpl->assign('entries', $entries);
|
$tmpl->assign('entries', $entries);
|
||||||
$tmpl->assign('entriesremain', $entriesremain);
|
$tmpl->assign('entriesremain', $entriesremain);
|
||||||
$tmpl->assign('htaccessworking', $htaccessworking);
|
$tmpl->assign('htaccessworking', $htaccessworking);
|
||||||
|
|
|
@ -36,5 +36,5 @@ if($username) {
|
||||||
}
|
}
|
||||||
OC_Appconfig::setValue('files', 'default_quota', $quota);
|
OC_Appconfig::setValue('files', 'default_quota', $quota);
|
||||||
}
|
}
|
||||||
OC_JSON::success(array("data" => array( "username" => $username ,'quota' => $quota)));
|
OC_JSON::success(array("data" => array( "username" => $username , 'quota' => $quota)));
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,11 @@ $languages=array();
|
||||||
foreach($languageCodes as $lang) {
|
foreach($languageCodes as $lang) {
|
||||||
$l=OC_L10N::get('settings', $lang);
|
$l=OC_L10N::get('settings', $lang);
|
||||||
if(substr($l->t('__language_name__'), 0, 1)!='_') {//first check if the language name is in the translation file
|
if(substr($l->t('__language_name__'), 0, 1)!='_') {//first check if the language name is in the translation file
|
||||||
$languages[]=array('code'=>$lang,'name'=>$l->t('__language_name__'));
|
$languages[]=array('code'=>$lang, 'name'=>$l->t('__language_name__'));
|
||||||
}elseif(isset($languageNames[$lang])) {
|
}elseif(isset($languageNames[$lang])) {
|
||||||
$languages[]=array('code'=>$lang,'name'=>$languageNames[$lang]);
|
$languages[]=array('code'=>$lang, 'name'=>$languageNames[$lang]);
|
||||||
}else{//fallback to language code
|
}else{//fallback to language code
|
||||||
$languages[]=array('code'=>$lang,'name'=>$lang);
|
$languages[]=array('code'=>$lang, 'name'=>$lang);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* This file is licensed under the Affero General Public License version 3 or later.
|
* This file is licensed under the Affero General Public License version 3 or later.
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
$levels=array('Debug','Info','Warning','Error','Fatal');
|
$levels=array('Debug','Info','Warning','Error', 'Fatal');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -26,16 +26,16 @@ abstract class Test_Archive extends UnitTestCase {
|
||||||
public function testGetFiles() {
|
public function testGetFiles() {
|
||||||
$this->instance=$this->getExisting();
|
$this->instance=$this->getExisting();
|
||||||
$allFiles=$this->instance->getFiles();
|
$allFiles=$this->instance->getFiles();
|
||||||
$expected=array('lorem.txt','logo-wide.png','dir/','dir/lorem.txt');
|
$expected=array('lorem.txt','logo-wide.png','dir/', 'dir/lorem.txt');
|
||||||
$this->assertEqual(4, count($allFiles),'only found '.count($allFiles).' out of 4 expected files');
|
$this->assertEqual(4, count($allFiles), 'only found '.count($allFiles).' out of 4 expected files');
|
||||||
foreach($expected as $file) {
|
foreach($expected as $file) {
|
||||||
$this->assertContains($file, $allFiles, 'cant find '. $file . ' in archive');
|
$this->assertContains($file, $allFiles, 'cant find '. $file . ' in archive');
|
||||||
$this->assertTrue($this->instance->fileExists($file),'file '.$file.' does not exist in archive');
|
$this->assertTrue($this->instance->fileExists($file), 'file '.$file.' does not exist in archive');
|
||||||
}
|
}
|
||||||
$this->assertFalse($this->instance->fileExists('non/existing/file'));
|
$this->assertFalse($this->instance->fileExists('non/existing/file'));
|
||||||
|
|
||||||
$rootContent=$this->instance->getFolder('');
|
$rootContent=$this->instance->getFolder('');
|
||||||
$expected=array('lorem.txt','logo-wide.png','dir/');
|
$expected=array('lorem.txt','logo-wide.png', 'dir/');
|
||||||
$this->assertEqual(3, count($rootContent));
|
$this->assertEqual(3, count($rootContent));
|
||||||
foreach($expected as $file) {
|
foreach($expected as $file) {
|
||||||
$this->assertContains($file, $rootContent, 'cant find '. $file . ' in archive');
|
$this->assertContains($file, $rootContent, 'cant find '. $file . ' in archive');
|
||||||
|
@ -71,14 +71,14 @@ abstract class Test_Archive extends UnitTestCase {
|
||||||
$this->assertFalse($this->instance->fileExists('lorem.txt/'));
|
$this->assertFalse($this->instance->fileExists('lorem.txt/'));
|
||||||
|
|
||||||
$this->assertEqual(file_get_contents($textFile), $this->instance->getFile('lorem.txt'));
|
$this->assertEqual(file_get_contents($textFile), $this->instance->getFile('lorem.txt'));
|
||||||
$this->instance->addFile('lorem.txt','foobar');
|
$this->instance->addFile('lorem.txt', 'foobar');
|
||||||
$this->assertEqual('foobar', $this->instance->getFile('lorem.txt'));
|
$this->assertEqual('foobar', $this->instance->getFile('lorem.txt'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testReadStream() {
|
public function testReadStream() {
|
||||||
$dir=OC::$SERVERROOT.'/tests/data';
|
$dir=OC::$SERVERROOT.'/tests/data';
|
||||||
$this->instance=$this->getExisting();
|
$this->instance=$this->getExisting();
|
||||||
$fh=$this->instance->getStream('lorem.txt','r');
|
$fh=$this->instance->getStream('lorem.txt', 'r');
|
||||||
$this->assertTrue($fh);
|
$this->assertTrue($fh);
|
||||||
$content=fread($fh, $this->instance->filesize('lorem.txt'));
|
$content=fread($fh, $this->instance->filesize('lorem.txt'));
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
|
@ -87,8 +87,8 @@ abstract class Test_Archive extends UnitTestCase {
|
||||||
public function testWriteStream() {
|
public function testWriteStream() {
|
||||||
$dir=OC::$SERVERROOT.'/tests/data';
|
$dir=OC::$SERVERROOT.'/tests/data';
|
||||||
$this->instance=$this->getNew();
|
$this->instance=$this->getNew();
|
||||||
$fh=$this->instance->getStream('lorem.txt','w');
|
$fh=$this->instance->getStream('lorem.txt', 'w');
|
||||||
$source=fopen($dir.'/lorem.txt','r');
|
$source=fopen($dir.'/lorem.txt', 'r');
|
||||||
OCP\Files::streamCopy($source, $fh);
|
OCP\Files::streamCopy($source, $fh);
|
||||||
fclose($source);
|
fclose($source);
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
|
@ -123,7 +123,7 @@ abstract class Test_Archive extends UnitTestCase {
|
||||||
$this->instance=$this->getNew();
|
$this->instance=$this->getNew();
|
||||||
$this->instance->addFile('lorem.txt', $textFile);
|
$this->instance->addFile('lorem.txt', $textFile);
|
||||||
$this->assertFalse($this->instance->fileExists('target.txt'));
|
$this->assertFalse($this->instance->fileExists('target.txt'));
|
||||||
$this->instance->rename('lorem.txt','target.txt');
|
$this->instance->rename('lorem.txt', 'target.txt');
|
||||||
$this->assertTrue($this->instance->fileExists('target.txt'));
|
$this->assertTrue($this->instance->fileExists('target.txt'));
|
||||||
$this->assertFalse($this->instance->fileExists('lorem.txt'));
|
$this->assertFalse($this->instance->fileExists('lorem.txt'));
|
||||||
$this->assertEqual(file_get_contents($textFile), $this->instance->getFile('target.txt'));
|
$this->assertEqual(file_get_contents($textFile), $this->instance->getFile('target.txt'));
|
||||||
|
|
|
@ -26,22 +26,22 @@ abstract class Test_Cache extends UnitTestCase {
|
||||||
$this->instance->set('value1', $value);
|
$this->instance->set('value1', $value);
|
||||||
$this->assertTrue($this->instance->hasKey('value1'));
|
$this->assertTrue($this->instance->hasKey('value1'));
|
||||||
$received=$this->instance->get('value1');
|
$received=$this->instance->get('value1');
|
||||||
$this->assertEqual($value, $received,'Value recieved from cache not equal to the original');
|
$this->assertEqual($value, $received, 'Value recieved from cache not equal to the original');
|
||||||
$value='ipsum lorum';
|
$value='ipsum lorum';
|
||||||
$this->instance->set('value1', $value);
|
$this->instance->set('value1', $value);
|
||||||
$received=$this->instance->get('value1');
|
$received=$this->instance->get('value1');
|
||||||
$this->assertEqual($value, $received,'Value not overwritten by second set');
|
$this->assertEqual($value, $received, 'Value not overwritten by second set');
|
||||||
|
|
||||||
$value2='foobar';
|
$value2='foobar';
|
||||||
$this->instance->set('value2', $value2);
|
$this->instance->set('value2', $value2);
|
||||||
$received2=$this->instance->get('value2');
|
$received2=$this->instance->get('value2');
|
||||||
$this->assertTrue($this->instance->hasKey('value1'));
|
$this->assertTrue($this->instance->hasKey('value1'));
|
||||||
$this->assertTrue($this->instance->hasKey('value2'));
|
$this->assertTrue($this->instance->hasKey('value2'));
|
||||||
$this->assertEqual($value, $received,'Value changed while setting other variable');
|
$this->assertEqual($value, $received, 'Value changed while setting other variable');
|
||||||
$this->assertEqual($value2, $received2,'Second value not equal to original');
|
$this->assertEqual($value2, $received2, 'Second value not equal to original');
|
||||||
|
|
||||||
$this->assertFalse($this->instance->hasKey('not_set'));
|
$this->assertFalse($this->instance->hasKey('not_set'));
|
||||||
$this->assertNull($this->instance->get('not_set'),'Unset value not equal to null');
|
$this->assertNull($this->instance->get('not_set'), 'Unset value not equal to null');
|
||||||
|
|
||||||
$this->assertTrue($this->instance->remove('value1'));
|
$this->assertTrue($this->instance->remove('value1'));
|
||||||
$this->assertFalse($this->instance->hasKey('value1'));
|
$this->assertFalse($this->instance->hasKey('value1'));
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Test_Cache_File extends Test_Cache {
|
||||||
|
|
||||||
//set up temporary storage
|
//set up temporary storage
|
||||||
OC_Filesystem::clearMounts();
|
OC_Filesystem::clearMounts();
|
||||||
OC_Filesystem::mount('OC_Filestorage_Temporary', array(),'/');
|
OC_Filesystem::mount('OC_Filestorage_Temporary', array(), '/');
|
||||||
|
|
||||||
OC_User::clearBackends();
|
OC_User::clearBackends();
|
||||||
OC_User::useBackend(new OC_User_Dummy());
|
OC_User::useBackend(new OC_User_Dummy());
|
||||||
|
|
|
@ -50,15 +50,15 @@ class Test_Group extends UnitTestCase {
|
||||||
|
|
||||||
$this->assertFalse(OC_Group::addToGroup($user1, $group1));
|
$this->assertFalse(OC_Group::addToGroup($user1, $group1));
|
||||||
|
|
||||||
$this->assertEqual(array($user1),OC_Group::usersInGroup($group1));
|
$this->assertEqual(array($user1), OC_Group::usersInGroup($group1));
|
||||||
$this->assertEqual(array(),OC_Group::usersInGroup($group2));
|
$this->assertEqual(array(), OC_Group::usersInGroup($group2));
|
||||||
|
|
||||||
$this->assertEqual(array($group1),OC_Group::getUserGroups($user1));
|
$this->assertEqual(array($group1), OC_Group::getUserGroups($user1));
|
||||||
$this->assertEqual(array(),OC_Group::getUserGroups($user2));
|
$this->assertEqual(array(), OC_Group::getUserGroups($user2));
|
||||||
|
|
||||||
OC_Group::deleteGroup($group1);
|
OC_Group::deleteGroup($group1);
|
||||||
$this->assertEqual(array(),OC_Group::getUserGroups($user1));
|
$this->assertEqual(array(), OC_Group::getUserGroups($user1));
|
||||||
$this->assertEqual(array(),OC_Group::usersInGroup($group1));
|
$this->assertEqual(array(), OC_Group::usersInGroup($group1));
|
||||||
$this->assertFalse(OC_Group::inGroup($user1, $group1));
|
$this->assertFalse(OC_Group::inGroup($user1, $group1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,13 +76,13 @@ class Test_Group extends UnitTestCase {
|
||||||
$this->assertEqual(array($group1), $backend1->getGroups());
|
$this->assertEqual(array($group1), $backend1->getGroups());
|
||||||
$this->assertEqual(array(), $backend2->getGroups());
|
$this->assertEqual(array(), $backend2->getGroups());
|
||||||
|
|
||||||
$this->assertEqual(array($group1),OC_Group::getGroups());
|
$this->assertEqual(array($group1), OC_Group::getGroups());
|
||||||
$this->assertTrue(OC_Group::groupExists($group1));
|
$this->assertTrue(OC_Group::groupExists($group1));
|
||||||
$this->assertFalse(OC_Group::groupExists($group2));
|
$this->assertFalse(OC_Group::groupExists($group2));
|
||||||
|
|
||||||
$backend1->createGroup($group2);
|
$backend1->createGroup($group2);
|
||||||
|
|
||||||
$this->assertEqual(array($group1, $group2),OC_Group::getGroups());
|
$this->assertEqual(array($group1, $group2), OC_Group::getGroups());
|
||||||
$this->assertTrue(OC_Group::groupExists($group1));
|
$this->assertTrue(OC_Group::groupExists($group1));
|
||||||
$this->assertTrue(OC_Group::groupExists($group2));
|
$this->assertTrue(OC_Group::groupExists($group2));
|
||||||
|
|
||||||
|
@ -101,14 +101,14 @@ class Test_Group extends UnitTestCase {
|
||||||
|
|
||||||
$this->assertFalse(OC_Group::addToGroup($user1, $group1));
|
$this->assertFalse(OC_Group::addToGroup($user1, $group1));
|
||||||
|
|
||||||
$this->assertEqual(array($user1),OC_Group::usersInGroup($group1));
|
$this->assertEqual(array($user1), OC_Group::usersInGroup($group1));
|
||||||
|
|
||||||
$this->assertEqual(array($group1),OC_Group::getUserGroups($user1));
|
$this->assertEqual(array($group1), OC_Group::getUserGroups($user1));
|
||||||
$this->assertEqual(array(),OC_Group::getUserGroups($user2));
|
$this->assertEqual(array(), OC_Group::getUserGroups($user2));
|
||||||
|
|
||||||
OC_Group::deleteGroup($group1);
|
OC_Group::deleteGroup($group1);
|
||||||
$this->assertEqual(array(),OC_Group::getUserGroups($user1));
|
$this->assertEqual(array(), OC_Group::getUserGroups($user1));
|
||||||
$this->assertEqual(array(),OC_Group::usersInGroup($group1));
|
$this->assertEqual(array(), OC_Group::usersInGroup($group1));
|
||||||
$this->assertFalse(OC_Group::inGroup($user1, $group1));
|
$this->assertFalse(OC_Group::inGroup($user1, $group1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
class Test_StreamWrappers extends UnitTestCase {
|
class Test_StreamWrappers extends UnitTestCase {
|
||||||
public function testFakeDir() {
|
public function testFakeDir() {
|
||||||
$items=array('foo','bar');
|
$items=array('foo', 'bar');
|
||||||
OC_FakeDirStream::$dirs['test']=$items;
|
OC_FakeDirStream::$dirs['test']=$items;
|
||||||
$dh=opendir('fakedir://test');
|
$dh=opendir('fakedir://test');
|
||||||
$result=array();
|
$result=array();
|
||||||
|
@ -60,9 +60,9 @@ class Test_StreamWrappers extends UnitTestCase {
|
||||||
//test callback
|
//test callback
|
||||||
$tmpFile=OC_Helper::TmpFile('.txt');
|
$tmpFile=OC_Helper::TmpFile('.txt');
|
||||||
$file='close://'.$tmpFile;
|
$file='close://'.$tmpFile;
|
||||||
OC_CloseStreamWrapper::$callBacks[$tmpFile]=array('Test_StreamWrappers','closeCallBack');
|
OC_CloseStreamWrapper::$callBacks[$tmpFile]=array('Test_StreamWrappers', 'closeCallBack');
|
||||||
$fh=fopen($file,'w');
|
$fh=fopen($file, 'w');
|
||||||
fwrite($fh,'asd');
|
fwrite($fh, 'asd');
|
||||||
try{
|
try{
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
$this->fail('Expected exception');
|
$this->fail('Expected exception');
|
||||||
|
|
|
@ -51,12 +51,12 @@ abstract class Test_User_Backend extends UnitTestCase {
|
||||||
|
|
||||||
$name1=$this->getUser();
|
$name1=$this->getUser();
|
||||||
$name2=$this->getUser();
|
$name2=$this->getUser();
|
||||||
$this->backend->createUser($name1,'');
|
$this->backend->createUser($name1, '');
|
||||||
$count=count($this->backend->getUsers())-$startCount;
|
$count=count($this->backend->getUsers())-$startCount;
|
||||||
$this->assertEqual(1, $count);
|
$this->assertEqual(1, $count);
|
||||||
$this->assertTrue((array_search($name1, $this->backend->getUsers())!==false));
|
$this->assertTrue((array_search($name1, $this->backend->getUsers())!==false));
|
||||||
$this->assertFalse((array_search($name2, $this->backend->getUsers())!==false));
|
$this->assertFalse((array_search($name2, $this->backend->getUsers())!==false));
|
||||||
$this->backend->createUser($name2,'');
|
$this->backend->createUser($name2, '');
|
||||||
$count=count($this->backend->getUsers())-$startCount;
|
$count=count($this->backend->getUsers())-$startCount;
|
||||||
$this->assertEqual(2, $count);
|
$this->assertEqual(2, $count);
|
||||||
$this->assertTrue((array_search($name1, $this->backend->getUsers())!==false));
|
$this->assertTrue((array_search($name1, $this->backend->getUsers())!==false));
|
||||||
|
@ -76,24 +76,24 @@ abstract class Test_User_Backend extends UnitTestCase {
|
||||||
$this->assertFalse($this->backend->userExists($name1));
|
$this->assertFalse($this->backend->userExists($name1));
|
||||||
$this->assertFalse($this->backend->userExists($name2));
|
$this->assertFalse($this->backend->userExists($name2));
|
||||||
|
|
||||||
$this->backend->createUser($name1,'pass1');
|
$this->backend->createUser($name1, 'pass1');
|
||||||
$this->backend->createUser($name2,'pass2');
|
$this->backend->createUser($name2, 'pass2');
|
||||||
|
|
||||||
$this->assertTrue($this->backend->userExists($name1));
|
$this->assertTrue($this->backend->userExists($name1));
|
||||||
$this->assertTrue($this->backend->userExists($name2));
|
$this->assertTrue($this->backend->userExists($name2));
|
||||||
|
|
||||||
$this->assertTrue($this->backend->checkPassword($name1,'pass1'));
|
$this->assertTrue($this->backend->checkPassword($name1, 'pass1'));
|
||||||
$this->assertTrue($this->backend->checkPassword($name2,'pass2'));
|
$this->assertTrue($this->backend->checkPassword($name2, 'pass2'));
|
||||||
|
|
||||||
$this->assertFalse($this->backend->checkPassword($name1,'pass2'));
|
$this->assertFalse($this->backend->checkPassword($name1, 'pass2'));
|
||||||
$this->assertFalse($this->backend->checkPassword($name2,'pass1'));
|
$this->assertFalse($this->backend->checkPassword($name2, 'pass1'));
|
||||||
|
|
||||||
$this->assertFalse($this->backend->checkPassword($name1,'dummy'));
|
$this->assertFalse($this->backend->checkPassword($name1, 'dummy'));
|
||||||
$this->assertFalse($this->backend->checkPassword($name2,'foobar'));
|
$this->assertFalse($this->backend->checkPassword($name2, 'foobar'));
|
||||||
|
|
||||||
$this->backend->setPassword($name1,'newpass1');
|
$this->backend->setPassword($name1, 'newpass1');
|
||||||
$this->assertFalse($this->backend->checkPassword($name1,'pass1'));
|
$this->assertFalse($this->backend->checkPassword($name1, 'pass1'));
|
||||||
$this->assertTrue($this->backend->checkPassword($name1,'newpass1'));
|
$this->assertTrue($this->backend->checkPassword($name1, 'newpass1'));
|
||||||
$this->assertFalse($this->backend->checkPassword($name2,'newpass1'));
|
$this->assertFalse($this->backend->checkPassword($name2, 'newpass1'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue