@@ -68,8 +68,8 @@ $storageInfo=OC_Helper::getStorageInfo('/', $dirInfo); | |||
// if the encryption app is disabled, than everything is fine (INIT_SUCCESSFUL status code) | |||
$encryptionInitStatus = 2; | |||
if (OC_App::isEnabled('files_encryption')) { | |||
$session = new \OCA\Encryption\Session(new \OC\Files\View('/')); | |||
$encryptionInitStatus = $session->getInitialized(); | |||
$session = new \OCA\Encryption\Session(new \OC\Files\View('/')); | |||
$encryptionInitStatus = $session->getInitialized(); | |||
} | |||
$nav = new OCP\Template('files', 'appnavigation', ''); |
@@ -121,7 +121,7 @@ class Session { | |||
/** | |||
* @brief Sets status of encryption app | |||
* @param string $init INIT_SUCCESSFUL, INIT_EXECUTED, NOT_INITIALIZED | |||
* @param string $init INIT_SUCCESSFUL, INIT_EXECUTED, NOT_INITIALIZED | |||
* @return bool | |||
* | |||
* @note this doesn not indicate of the init was successful, we just remeber the try! |
@@ -180,7 +180,7 @@ class Stream { | |||
/** | |||
* @brief Returns the current position of the file pointer | |||
* @return int position of the file pointer | |||
* @return int position of the file pointer | |||
*/ | |||
public function stream_tell() { | |||
return ftell($this->handle); |
@@ -25,7 +25,7 @@ | |||
namespace OC\Files\Storage; | |||
set_include_path(get_include_path() . PATH_SEPARATOR . | |||
\OC_App::getAppPath('files_external') . '/3rdparty/aws-sdk-php'); | |||
\OC_App::getAppPath('files_external') . '/3rdparty/aws-sdk-php'); | |||
require 'aws-autoloader.php'; | |||
use Aws\S3\S3Client; |
@@ -23,7 +23,7 @@ | |||
namespace OC\Files\Storage; | |||
set_include_path(get_include_path() . PATH_SEPARATOR . | |||
\OC_App::getAppPath('files_external') . '/3rdparty/php-opencloud/lib'); | |||
\OC_App::getAppPath('files_external') . '/3rdparty/php-opencloud/lib'); | |||
require_once 'openstack.php'; | |||
use \OpenCloud; | |||
@@ -31,25 +31,25 @@ use \OpenCloud\Common\Exceptions; | |||
class Swift extends \OC\Files\Storage\Common { | |||
/** | |||
* @var \OpenCloud\ObjectStore | |||
*/ | |||
/** | |||
* @var \OpenCloud\ObjectStore | |||
*/ | |||
private $connection; | |||
/** | |||
* @var \OpenCloud\ObjectStore\Container | |||
*/ | |||
/** | |||
* @var \OpenCloud\ObjectStore\Container | |||
*/ | |||
private $container; | |||
/** | |||
* @var \OpenCloud\OpenStack | |||
*/ | |||
/** | |||
* @var \OpenCloud\OpenStack | |||
*/ | |||
private $anchor; | |||
/** | |||
* @var string | |||
*/ | |||
/** | |||
* @var string | |||
*/ | |||
private $bucket; | |||
/** | |||
* @var array | |||
*/ | |||
/** | |||
* @var array | |||
*/ | |||
private static $tmpFiles = array(); | |||
/** |
@@ -424,7 +424,7 @@ class Shared_Cache extends Cache { | |||
* | |||
* @param int $id | |||
* @param string $pathEnd (optional) used internally for recursive calls | |||
* @return string | null | |||
* @return string|null | |||
*/ | |||
public function getPathById($id, $pathEnd = '') { | |||
// direct shares are easy |
@@ -187,7 +187,7 @@ class Test_Files_Sharing_Api extends Test_Files_Sharing_Base { | |||
$this->assertTrue($result->succeeded()); | |||
// test should return two shares created from testCreateShare() | |||
// test should return two shares created from testCreateShare() | |||
$this->assertTrue(count($result->getData()) === 1); | |||
\OCP\Share::unshare('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, | |||
@@ -214,7 +214,7 @@ class Test_Files_Sharing_Api extends Test_Files_Sharing_Base { | |||
$this->assertTrue($result->succeeded()); | |||
// test should return one share created from testCreateShare() | |||
// test should return one share created from testCreateShare() | |||
$this->assertTrue(count($result->getData()) === 2); | |||
\OCP\Share::unshare('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, | |||
@@ -341,7 +341,7 @@ class Test_Files_Sharing_Api extends Test_Files_Sharing_Base { | |||
$this->assertTrue($result->succeeded()); | |||
// test should return one share within $this->folder | |||
// test should return one share within $this->folder | |||
$this->assertTrue(count($result->getData()) === 1); | |||
\OCP\Share::unshare('file', $fileInfo1['fileid'], \OCP\Share::SHARE_TYPE_USER, | |||
@@ -698,7 +698,7 @@ class Test_Files_Sharing_Api extends Test_Files_Sharing_Base { | |||
$result = Share\Api::getShare($params); | |||
$this->assertEquals(404, $result->getStatusCode()); | |||
$meta = $result->getMeta(); | |||
$meta = $result->getMeta(); | |||
$this->assertEquals('share doesn\'t exist', $meta['message']); | |||
} | |||
@@ -755,7 +755,7 @@ class Test_Files_Sharing_Api extends Test_Files_Sharing_Base { | |||
$result = Share\Api::updateShare($params); | |||
$meta = $result->getMeta(); | |||
$meta = $result->getMeta(); | |||
$this->assertTrue($result->succeeded(), $meta['message']); | |||
$items = \OCP\Share::getItemShared('file', $userShare['file_source']); |
@@ -177,8 +177,8 @@ class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface { | |||
} | |||
$allGroups = array(); | |||
if (array_key_exists($dn, $seen)) { | |||
// avoid loops | |||
return array(); | |||
// avoid loops | |||
return array(); | |||
} | |||
$seen[$dn] = true; | |||
$filter = $this->access->combineFilterWithAnd(array( |
@@ -36,7 +36,7 @@ class Group_Proxy extends lib\Proxy implements \OCP\GroupInterface { | |||
public function __construct($serverConfigPrefixes, ILDAPWrapper $ldap) { | |||
parent::__construct($ldap); | |||
foreach($serverConfigPrefixes as $configPrefix) { | |||
$this->backends[$configPrefix] = | |||
$this->backends[$configPrefix] = | |||
new \OCA\user_ldap\GROUP_LDAP($this->getAccess($configPrefix)); | |||
if(is_null($this->refBackend)) { | |||
$this->refBackend = &$this->backends[$configPrefix]; | |||
@@ -54,10 +54,10 @@ class Group_Proxy extends lib\Proxy implements \OCP\GroupInterface { | |||
protected function walkBackends($gid, $method, $parameters) { | |||
$cacheKey = $this->getGroupCacheKey($gid); | |||
foreach($this->backends as $configPrefix => $backend) { | |||
if($result = call_user_func_array(array($backend, $method), $parameters)) { | |||
if($result = call_user_func_array(array($backend, $method), $parameters)) { | |||
$this->writeToCache($cacheKey, $configPrefix); | |||
return $result; | |||
} | |||
} | |||
} | |||
return false; | |||
} | |||
@@ -118,7 +118,7 @@ class Group_Proxy extends lib\Proxy implements \OCP\GroupInterface { | |||
$groups = array(); | |||
foreach($this->backends as $backend) { | |||
$backendGroups = $backend->getUserGroups($uid); | |||
$backendGroups = $backend->getUserGroups($uid); | |||
if (is_array($backendGroups)) { | |||
$groups = array_merge($groups, $backendGroups); | |||
} | |||
@@ -135,7 +135,7 @@ class Group_Proxy extends lib\Proxy implements \OCP\GroupInterface { | |||
$users = array(); | |||
foreach($this->backends as $backend) { | |||
$backendUsers = $backend->usersInGroup($gid, $search, $limit, $offset); | |||
$backendUsers = $backend->usersInGroup($gid, $search, $limit, $offset); | |||
if (is_array($backendUsers)) { | |||
$users = array_merge($users, $backendUsers); | |||
} | |||
@@ -148,7 +148,7 @@ class Group_Proxy extends lib\Proxy implements \OCP\GroupInterface { | |||
* @brief returns the number of users in a group, who match the search term | |||
* @param string $gid the internal group name | |||
* @param string $search optional, a search string | |||
* @return int | bool | |||
* @return int|bool | |||
*/ | |||
public function countUsersInGroup($gid, $search = '') { | |||
return $this->handleRequest( | |||
@@ -165,7 +165,7 @@ class Group_Proxy extends lib\Proxy implements \OCP\GroupInterface { | |||
$groups = array(); | |||
foreach($this->backends as $backend) { | |||
$backendGroups = $backend->getGroups($search, $limit, $offset); | |||
$backendGroups = $backend->getGroups($search, $limit, $offset); | |||
if (is_array($backendGroups)) { | |||
$groups = array_merge($groups, $backendGroups); | |||
} |
@@ -138,7 +138,7 @@ class Access extends LDAPUtility { | |||
if(is_array($dn)) { | |||
$result = array(); | |||
foreach($dn as $singleDN) { | |||
$result[] = $this->sanitizeDN($singleDN); | |||
$result[] = $this->sanitizeDN($singleDN); | |||
} | |||
return $result; | |||
} | |||
@@ -897,7 +897,7 @@ class Access extends LDAPUtility { | |||
$findings = array(); | |||
foreach($sr as $res) { | |||
$findings = array_merge($findings, $this->ldap->getEntries($cr , $res )); | |||
$findings = array_merge($findings, $this->ldap->getEntries($cr , $res )); | |||
} | |||
$this->processPagedSearchStatus($sr, $filter, $base, $findings['count'], | |||
@@ -1028,10 +1028,10 @@ class Access extends LDAPUtility { | |||
private function combineFilter($filters, $operator) { | |||
$combinedFilter = '('.$operator; | |||
foreach($filters as $filter) { | |||
if(!empty($filter) && $filter[0] !== '(') { | |||
if(!empty($filter) && $filter[0] !== '(') { | |||
$filter = '('.$filter.')'; | |||
} | |||
$combinedFilter.=$filter; | |||
} | |||
$combinedFilter.=$filter; | |||
} | |||
$combinedFilter.=')'; | |||
return $combinedFilter; |
@@ -289,7 +289,7 @@ class Connection extends LDAPUtility { | |||
private function doSoftValidation() { | |||
//if User or Group Base are not set, take over Base DN setting | |||
foreach(array('ldapBaseUsers', 'ldapBaseGroups') as $keyBase) { | |||
$val = $this->configuration->$keyBase; | |||
$val = $this->configuration->$keyBase; | |||
if(empty($val)) { | |||
$obj = strpos('Users', $keyBase) !== false ? 'Users' : 'Groups'; | |||
\OCP\Util::writeLog('user_ldap', |
@@ -80,26 +80,26 @@ class Jobs extends \OC\BackgroundJob\TimedJob { | |||
'); | |||
foreach($groups as $group) { | |||
//we assume, that self::$groupsFromDB has been retrieved already | |||
$knownUsers = unserialize(self::$groupsFromDB[$group]['owncloudusers']); | |||
$actualUsers = self::getGroupBE()->usersInGroup($group); | |||
$hasChanged = false; | |||
foreach(array_diff($knownUsers, $actualUsers) as $removedUser) { | |||
\OCP\Util::emitHook('OC_User', 'post_removeFromGroup', array('uid' => $removedUser, 'gid' => $group)); | |||
\OCP\Util::writeLog('user_ldap', | |||
$knownUsers = unserialize(self::$groupsFromDB[$group]['owncloudusers']); | |||
$actualUsers = self::getGroupBE()->usersInGroup($group); | |||
$hasChanged = false; | |||
foreach(array_diff($knownUsers, $actualUsers) as $removedUser) { | |||
\OCP\Util::emitHook('OC_User', 'post_removeFromGroup', array('uid' => $removedUser, 'gid' => $group)); | |||
\OCP\Util::writeLog('user_ldap', | |||
'bgJ "updateGroups" – "'.$removedUser.'" removed from "'.$group.'".', | |||
\OCP\Util::INFO); | |||
$hasChanged = true; | |||
} | |||
foreach(array_diff($actualUsers, $knownUsers) as $addedUser) { | |||
\OCP\Util::emitHook('OC_User', 'post_addToGroup', array('uid' => $addedUser, 'gid' => $group)); | |||
\OCP\Util::writeLog('user_ldap', | |||
$hasChanged = true; | |||
} | |||
foreach(array_diff($actualUsers, $knownUsers) as $addedUser) { | |||
\OCP\Util::emitHook('OC_User', 'post_addToGroup', array('uid' => $addedUser, 'gid' => $group)); | |||
\OCP\Util::writeLog('user_ldap', | |||
'bgJ "updateGroups" – "'.$addedUser.'" added to "'.$group.'".', | |||
\OCP\Util::INFO); | |||
$hasChanged = true; | |||
} | |||
if($hasChanged) { | |||
$hasChanged = true; | |||
} | |||
if($hasChanged) { | |||
$query->execute(array(serialize($actualUsers), $group)); | |||
} | |||
} | |||
} | |||
\OCP\Util::writeLog('user_ldap', | |||
'bgJ "updateGroups" – FINISHED dealing with known Groups.', | |||
@@ -121,7 +121,7 @@ class Jobs extends \OC\BackgroundJob\TimedJob { | |||
'bgJ "updateGroups" – new group "'.$createdGroup.'" found.', | |||
\OCP\Util::INFO); | |||
$users = serialize(self::getGroupBE()->usersInGroup($createdGroup)); | |||
$query->execute(array($createdGroup, $users)); | |||
$query->execute(array($createdGroup, $users)); | |||
} | |||
\OCP\Util::writeLog('user_ldap', | |||
'bgJ "updateGroups" – FINISHED dealing with created Groups.', | |||
@@ -142,7 +142,7 @@ class Jobs extends \OC\BackgroundJob\TimedJob { | |||
\OCP\Util::writeLog('user_ldap', | |||
'bgJ "updateGroups" – group "'.$removedGroup.'" was removed.', | |||
\OCP\Util::INFO); | |||
$query->execute(array($removedGroup)); | |||
$query->execute(array($removedGroup)); | |||
} | |||
\OCP\Util::writeLog('user_ldap', | |||
'bgJ "updateGroups" – FINISHED dealing with removed groups.', | |||
@@ -184,7 +184,7 @@ class Jobs extends \OC\BackgroundJob\TimedJob { | |||
$result = $query->execute()->fetchAll(); | |||
self::$groupsFromDB = array(); | |||
foreach($result as $dataset) { | |||
self::$groupsFromDB[$dataset['owncloudname']] = $dataset; | |||
self::$groupsFromDB[$dataset['owncloudname']] = $dataset; | |||
} | |||
return self::$groupsFromDB; |
@@ -641,7 +641,7 @@ class Wizard extends LDAPUtility { | |||
//assuming only groups have their cn cached :) | |||
continue; | |||
} | |||
$filter = strtolower($filterPrefix . $dn . $filterSuffix); | |||
$filter = strtolower($filterPrefix . $dn . $filterSuffix); | |||
$rr = $this->ldap->search($cr, $base, $filter, array('dn')); | |||
if(!$this->ldap->isResource($rr)) { | |||
continue; | |||
@@ -776,7 +776,7 @@ class Wizard extends LDAPUtility { | |||
if(is_array($attrsToFilter) && count($attrsToFilter) > 0) { | |||
$filterAttributes = '(|'; | |||
foreach($attrsToFilter as $attribute) { | |||
$filterAttributes .= '(' . $attribute . $loginpart . ')'; | |||
$filterAttributes .= '(' . $attribute . $loginpart . ')'; | |||
} | |||
$filterAttributes .= ')'; | |||
$parts++; |
@@ -71,7 +71,7 @@ $tmpl->assign('settingControls', $sControls); | |||
$config = new \OCA\user_ldap\lib\Configuration('', false); | |||
$defaults = $config->getDefaults(); | |||
foreach($defaults as $key => $default) { | |||
$tmpl->assign($key.'_default', $default); | |||
$tmpl->assign($key.'_default', $default); | |||
} | |||
return $tmpl->fetchPage(); |
@@ -372,7 +372,7 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface { | |||
return $displayNames; | |||
} | |||
/** | |||
/** | |||
* @brief Check if backend implements actions | |||
* @param int $actions bitwise-or'ed actions | |||
* @return boolean | |||
@@ -399,7 +399,7 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface { | |||
/** | |||
* counts the users in LDAP | |||
* | |||
* @return int | bool | |||
* @return int|bool | |||
*/ | |||
public function countUsers() { | |||
$filter = \OCP\Util::mb_str_replace( |
@@ -36,7 +36,7 @@ class User_Proxy extends lib\Proxy implements \OCP\UserInterface { | |||
public function __construct($serverConfigPrefixes, ILDAPWrapper $ldap) { | |||
parent::__construct($ldap); | |||
foreach($serverConfigPrefixes as $configPrefix) { | |||
$this->backends[$configPrefix] = | |||
$this->backends[$configPrefix] = | |||
new \OCA\user_ldap\USER_LDAP($this->getAccess($configPrefix)); | |||
if(is_null($this->refBackend)) { | |||
$this->refBackend = &$this->backends[$configPrefix]; | |||
@@ -51,7 +51,7 @@ class User_Proxy extends lib\Proxy implements \OCP\UserInterface { | |||
* @param array $parameters an array of parameters to be passed | |||
* @return mixed the result of the method or false | |||
*/ | |||
protected function walkBackends($uid, $method, $parameters) { | |||
protected function walkBackends($uid, $method, $parameters) { | |||
$cacheKey = $this->getUserCacheKey($uid); | |||
foreach($this->backends as $configPrefix => $backend) { | |||
$instance = $backend; | |||
@@ -75,7 +75,7 @@ class User_Proxy extends lib\Proxy implements \OCP\UserInterface { | |||
* @param mixed $passOnWhen the result matches this variable | |||
* @return mixed the result of the method or false | |||
*/ | |||
protected function callOnLastSeenOn($uid, $method, $parameters, $passOnWhen) { | |||
protected function callOnLastSeenOn($uid, $method, $parameters, $passOnWhen) { | |||
$cacheKey = $this->getUserCacheKey($uid); | |||
$prefix = $this->getFromCache($cacheKey); | |||
//in case the uid has been found in the past, try this stored connection first | |||
@@ -185,7 +185,7 @@ class User_Proxy extends lib\Proxy implements \OCP\UserInterface { | |||
/** | |||
* @brief Get a list of all display names | |||
* @return array with all displayNames (value) and the corresponding uids (key) | |||
* @return array with all displayNames (value) and the corresponding uids (key) | |||
* | |||
* Get a list of all display names and user ids. | |||
*/ |