Merge branch 'master' into calendar_import
This commit is contained in:
commit
9a10efd80f
|
@ -22,6 +22,7 @@ class Sabre_DAV_Client {
|
||||||
protected $userName;
|
protected $userName;
|
||||||
protected $password;
|
protected $password;
|
||||||
protected $proxy;
|
protected $proxy;
|
||||||
|
protected $capath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -49,6 +50,11 @@ class Sabre_DAV_Client {
|
||||||
'proxy'
|
'proxy'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->capath = '';
|
||||||
|
if (isset($settings['capath'])) {
|
||||||
|
$this->capath = $settings['capath'];
|
||||||
|
}
|
||||||
|
|
||||||
foreach($validSettings as $validSetting) {
|
foreach($validSettings as $validSetting) {
|
||||||
if (isset($settings[$validSetting])) {
|
if (isset($settings[$validSetting])) {
|
||||||
$this->$validSetting = $settings[$validSetting];
|
$this->$validSetting = $settings[$validSetting];
|
||||||
|
@ -249,9 +255,12 @@ class Sabre_DAV_Client {
|
||||||
// Automatically follow redirects
|
// Automatically follow redirects
|
||||||
CURLOPT_FOLLOWLOCATION => true,
|
CURLOPT_FOLLOWLOCATION => true,
|
||||||
CURLOPT_MAXREDIRS => 5,
|
CURLOPT_MAXREDIRS => 5,
|
||||||
|
CURLOPT_SSL_VERIFYPEER => true,
|
||||||
//CURLOPT_SSL_VERIFYPEER => false,
|
//CURLOPT_SSL_VERIFYPEER => false,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($this->capath != '') $curlSettings[CURLOPT_CAPATH] = $this->capath;
|
||||||
|
|
||||||
switch ($method) {
|
switch ($method) {
|
||||||
case 'PUT':
|
case 'PUT':
|
||||||
$curlSettings[CURLOPT_PUT] = true;
|
$curlSettings[CURLOPT_PUT] = true;
|
||||||
|
|
|
@ -327,7 +327,7 @@ Contacts={
|
||||||
|
|
||||||
// Make sure proper DOM is loaded.
|
// Make sure proper DOM is loaded.
|
||||||
if(!$('#card')[0] && newid) {
|
if(!$('#card')[0] && newid) {
|
||||||
$.getJSON(OC.filePath('contacts', 'ajax', 'loadcard.php'),{},function(jsondata){
|
$.getJSON(OC.filePath('contacts', 'ajax', 'loadcard.php'),{requesttoken:requesttoken},function(jsondata){
|
||||||
if(jsondata.status == 'success'){
|
if(jsondata.status == 'success'){
|
||||||
$('#rightcontent').html(jsondata.data.page).ready(function() {
|
$('#rightcontent').html(jsondata.data.page).ready(function() {
|
||||||
Contacts.UI.loadHandlers();
|
Contacts.UI.loadHandlers();
|
||||||
|
|
|
@ -41,7 +41,7 @@ class OC_Contacts_Addressbook{
|
||||||
/**
|
/**
|
||||||
* @brief Returns the list of addressbooks for a specific user.
|
* @brief Returns the list of addressbooks for a specific user.
|
||||||
* @param string $uid
|
* @param string $uid
|
||||||
* @param boolean $active Only return calendars with this $active state, default(=false) is don't care
|
* @param boolean $active Only return addressbooks with this $active state, default(=false) is don't care
|
||||||
* @return array or false.
|
* @return array or false.
|
||||||
*/
|
*/
|
||||||
public static function all($uid, $active=false){
|
public static function all($uid, $active=false){
|
||||||
|
|
|
@ -164,7 +164,7 @@ class OC_Contacts_App {
|
||||||
* @brief returns the default categories of ownCloud
|
* @brief returns the default categories of ownCloud
|
||||||
* @return (array) $categories
|
* @return (array) $categories
|
||||||
*/
|
*/
|
||||||
protected static function getDefaultCategories(){
|
public static function getDefaultCategories(){
|
||||||
return array(
|
return array(
|
||||||
(string)self::$l10n->t('Birthday'),
|
(string)self::$l10n->t('Birthday'),
|
||||||
(string)self::$l10n->t('Business'),
|
(string)self::$l10n->t('Business'),
|
||||||
|
|
|
@ -36,10 +36,15 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
|
||||||
$this->root.='/';
|
$this->root.='/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$capath = '';
|
||||||
|
if($caview = \OCP\Files::getStorage('files_external')) {
|
||||||
|
$capath=\OCP\Config::getSystemValue('datadirectory').$caview->getAbsolutePath("");
|
||||||
|
}
|
||||||
$settings = array(
|
$settings = array(
|
||||||
'baseUri' => $this->createBaseUri(),
|
'baseUri' => $this->createBaseUri(),
|
||||||
'userName' => $this->user,
|
'userName' => $this->user,
|
||||||
'password' => $this->password,
|
'password' => $this->password,
|
||||||
|
'capath' => $capath,
|
||||||
);
|
);
|
||||||
$this->client = new Sabre_DAV_Client($settings);
|
$this->client = new Sabre_DAV_Client($settings);
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
</table>
|
</table>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<?php if (!$_['isAdminPage']): ?>
|
<?php if (!$_['isAdminPage'] && false): // disabled until sabredav can handle uploaded ca certs ?>
|
||||||
<table id="sslCertificate" data-admin='<?php echo json_encode($_['isAdminPage']); ?>'>
|
<table id="sslCertificate" data-admin='<?php echo json_encode($_['isAdminPage']); ?>'>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -12,5 +12,5 @@ OCP\Util::addscript('files_versions', 'versions');
|
||||||
// Listen to write signals
|
// Listen to write signals
|
||||||
OCP\Util::connectHook('OC_Filesystem', 'post_write', "OCA_Versions\Hooks", "write_hook");
|
OCP\Util::connectHook('OC_Filesystem', 'post_write', "OCA_Versions\Hooks", "write_hook");
|
||||||
// Listen to delete and rename signals
|
// Listen to delete and rename signals
|
||||||
OCP\Util::connectHook('OC_Filesystem', 'delete', "OCA_Versions\Storage", "removeVersions");
|
OCP\Util::connectHook('OC_Filesystem', 'delete', "OCA_Versions\Hooks", "remove_hook");
|
||||||
OCP\Util::connectHook('OC_Filesystem', 'rename', "OCA_Versions\Storage", "renameVersions");
|
OCP\Util::connectHook('OC_Filesystem', 'rename', "OCA_Versions\Hooks", "rename_hook");
|
|
@ -30,6 +30,43 @@ class Hooks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Erase versions of deleted file
|
||||||
|
* @param array
|
||||||
|
*
|
||||||
|
* This function is connected to the delete signal of OC_Filesystem
|
||||||
|
* cleanup the versions directory if the actual file gets deleted
|
||||||
|
*/
|
||||||
|
public static function remove_hook($params) {
|
||||||
|
$rel_path = $params['path'];
|
||||||
|
$abs_path = \OCP\Config::getSystemValue('datadirectory').'/'.\OCP\User::getUser()."/versions".$rel_path.'.v';
|
||||||
|
if(Storage::isversioned($rel_path)) {
|
||||||
|
$versions = Storage::getVersions($rel_path);
|
||||||
|
foreach ($versions as $v){
|
||||||
|
unlink($abs_path . $v['version']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief rename/move versions of renamed/moved files
|
||||||
|
* @param array with oldpath and newpath
|
||||||
|
*
|
||||||
|
* This function is connected to the rename signal of OC_Filesystem and adjust the name and location
|
||||||
|
* of the stored versions along the actual file
|
||||||
|
*/
|
||||||
|
public static function rename_hook($params) {
|
||||||
|
$rel_oldpath = $params['oldpath'];
|
||||||
|
$abs_oldpath = \OCP\Config::getSystemValue('datadirectory').'/'.\OCP\User::getUser()."/versions".$rel_oldpath.'.v';
|
||||||
|
$abs_newpath = \OCP\Config::getSystemValue('datadirectory').'/'.\OCP\User::getUser()."/versions".$params['newpath'].'.v';
|
||||||
|
if(Storage::isversioned($rel_oldpath)) {
|
||||||
|
$versions = Storage::getVersions($rel_oldpath);
|
||||||
|
foreach ($versions as $v){
|
||||||
|
rename($abs_oldpath.$v['version'], $abs_newpath.$v['version']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -147,6 +147,9 @@ class Storage {
|
||||||
public static function rollback($filename,$revision) {
|
public static function rollback($filename,$revision) {
|
||||||
|
|
||||||
if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
|
if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
|
||||||
|
$users_view = \OCP\Files::getStorage("files_versions");
|
||||||
|
$users_view->chroot(\OCP\User::getUser().'/');
|
||||||
|
|
||||||
if (\OCP\App::isEnabled('files_sharing') && $source = \OC_Share::getSource('/'.\OCP\User::getUser().'/files'.$filename)) {
|
if (\OCP\App::isEnabled('files_sharing') && $source = \OC_Share::getSource('/'.\OCP\User::getUser().'/files'.$filename)) {
|
||||||
$pos = strpos($source, '/files', 1);
|
$pos = strpos($source, '/files', 1);
|
||||||
$uid = substr($source, 1, $pos - 1);
|
$uid = substr($source, 1, $pos - 1);
|
||||||
|
@ -159,7 +162,7 @@ class Storage {
|
||||||
$filesfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. $uid .'/files';
|
$filesfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. $uid .'/files';
|
||||||
|
|
||||||
// rollback
|
// rollback
|
||||||
if ( @copy($versionsFolderName.'/'.$filename.'.v'.$revision,$filesfoldername.'/'.$filename) ) {
|
if( @$users_view->copy('versions'.$filename.'.v'.$revision, 'files'.$filename) ) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -323,41 +326,4 @@ class Storage {
|
||||||
return $this->view->deleteAll( $dir, true );
|
return $this->view->deleteAll( $dir, true );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Erase versions of deleted file
|
|
||||||
* @param array
|
|
||||||
*
|
|
||||||
* This function is connected to the delete signal of OC_Filesystem
|
|
||||||
* cleanup the versions directory if the actual file gets deleted
|
|
||||||
*/
|
|
||||||
public static function removeVersions($params) {
|
|
||||||
$rel_path = $params['path'];
|
|
||||||
$abs_path = \OCP\Config::getSystemValue('datadirectory').'/'.\OCP\User::getUser()."/versions".$rel_path.'.v';
|
|
||||||
if(Storage::isversioned($rel_path)) {
|
|
||||||
$versions = Storage::getVersions($rel_path);
|
|
||||||
foreach ($versions as $v){
|
|
||||||
unlink($abs_path . $v['version']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief rename/move versions of renamed/moved files
|
|
||||||
* @param array with oldpath and newpath
|
|
||||||
*
|
|
||||||
* This function is connected to the rename signal of OC_Filesystem and adjust the name and location
|
|
||||||
* of the stored versions along the actual file
|
|
||||||
*/
|
|
||||||
public static function renameVersions($params) {
|
|
||||||
$rel_oldpath = $params['oldpath'];
|
|
||||||
$abs_oldpath = \OCP\Config::getSystemValue('datadirectory').'/'.\OCP\User::getUser()."/versions".$rel_oldpath.'.v';
|
|
||||||
$abs_newpath = \OCP\Config::getSystemValue('datadirectory').'/'.\OCP\User::getUser()."/versions".$params['newpath'].'.v';
|
|
||||||
if(Storage::isversioned($rel_oldpath)) {
|
|
||||||
$versions = Storage::getVersions($rel_oldpath);
|
|
||||||
foreach ($versions as $v){
|
|
||||||
rename($abs_oldpath.$v['version'], $abs_newpath.$v['version']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
16
lib/user.php
16
lib/user.php
|
@ -240,17 +240,13 @@ class OC_User {
|
||||||
* Checks if the user is logged in
|
* Checks if the user is logged in
|
||||||
*/
|
*/
|
||||||
public static function isLoggedIn(){
|
public static function isLoggedIn(){
|
||||||
static $is_login_checked = null;
|
|
||||||
if (!is_null($is_login_checked)) {
|
|
||||||
return $is_login_checked;
|
|
||||||
}
|
|
||||||
if( isset($_SESSION['user_id']) AND $_SESSION['user_id']) {
|
if( isset($_SESSION['user_id']) AND $_SESSION['user_id']) {
|
||||||
OC_App::loadApps(array('authentication'));
|
OC_App::loadApps(array('authentication'));
|
||||||
if (self::userExists($_SESSION['user_id']) ){
|
if (self::userExists($_SESSION['user_id']) ){
|
||||||
return $is_login_checked = true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $is_login_checked = false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -349,13 +345,17 @@ class OC_User {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function userExists($uid){
|
public static function userExists($uid){
|
||||||
|
static $user_exists_checked = null;
|
||||||
|
if (!is_null($user_exists_checked)) {
|
||||||
|
return $user_exists_checked;
|
||||||
|
}
|
||||||
foreach(self::$_usedBackends as $backend){
|
foreach(self::$_usedBackends as $backend){
|
||||||
$result=$backend->userExists($uid);
|
$result=$backend->userExists($uid);
|
||||||
if($result===true){
|
if($result===true){
|
||||||
return true;
|
return $user_exists_checked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return $user_exists_checked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue