From 36e7a7c29b1904db6fa9e34dd6ffc29ab7b0b561 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Tue, 10 Sep 2013 12:34:41 +0200 Subject: use \OC::$session instead of $_SESSION --- apps/files_external/lib/irods.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'apps/files_external') diff --git a/apps/files_external/lib/irods.php b/apps/files_external/lib/irods.php index 7ec3b3a0cfc..9b0c744980a 100644 --- a/apps/files_external/lib/irods.php +++ b/apps/files_external/lib/irods.php @@ -27,11 +27,11 @@ class iRODS extends \OC\Files\Storage\StreamWrapper{ private $auth_mode; public function __construct($params) { - if (isset($params['host']) && isset($params['user']) && isset($params['password'])) { + if (isset($params['host'])) { $this->host = $params['host']; - $this->port = $params['port']; - $this->user = $params['user']; - $this->password = $params['password']; + $this->port = isset($params['port']) ? $params['port'] : 1247; + $this->user = isset($params['user']) ? $params['user'] : ''; + $this->password = isset($params['password']) ? $params['password'] : ''; $this->use_logon_credentials = $params['use_logon_credentials']; $this->zone = $params['zone']; $this->auth_mode = isset($params['auth_mode']) ? $params['auth_mode'] : ''; @@ -42,10 +42,11 @@ class iRODS extends \OC\Files\Storage\StreamWrapper{ } // take user and password from the session - if ($this->use_logon_credentials && isset($_SESSION['irods-credentials']) ) + if ($this->use_logon_credentials && \OC::$session->exists('irods-credentials')) { - $this->user = $_SESSION['irods-credentials']['uid']; - $this->password = $_SESSION['irods-credentials']['password']; + $params = \OC::$session->get('irods-credentials'); + $this->user = $params['uid']; + $this->password = $params['password']; } //create the root folder if necessary @@ -59,7 +60,7 @@ class iRODS extends \OC\Files\Storage\StreamWrapper{ } public static function login( $params ) { - $_SESSION['irods-credentials'] = $params; + \OC::$session->set('irods-credentials', $params); } public function getId(){ -- cgit v1.2.3 From d63ca25a946f2b520ae9f0f2cd498c7247f3522a Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Tue, 10 Sep 2013 12:35:14 +0200 Subject: proper test for use_logon_credentials --- apps/files_external/lib/irods.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps/files_external') diff --git a/apps/files_external/lib/irods.php b/apps/files_external/lib/irods.php index 9b0c744980a..6c7e5278ed0 100644 --- a/apps/files_external/lib/irods.php +++ b/apps/files_external/lib/irods.php @@ -42,7 +42,7 @@ class iRODS extends \OC\Files\Storage\StreamWrapper{ } // take user and password from the session - if ($this->use_logon_credentials && \OC::$session->exists('irods-credentials')) + if ($this->use_logon_credentials === "true" && \OC::$session->exists('irods-credentials')) { $params = \OC::$session->get('irods-credentials'); $this->user = $params['uid']; -- cgit v1.2.3 From ec255b52be2533e77214737c116ff97c18519d75 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Wed, 11 Sep 2013 00:49:45 +0200 Subject: fixing boolean handling --- apps/files_external/lib/irods.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apps/files_external') diff --git a/apps/files_external/lib/irods.php b/apps/files_external/lib/irods.php index 6c7e5278ed0..c6f002ffd22 100644 --- a/apps/files_external/lib/irods.php +++ b/apps/files_external/lib/irods.php @@ -32,7 +32,7 @@ class iRODS extends \OC\Files\Storage\StreamWrapper{ $this->port = isset($params['port']) ? $params['port'] : 1247; $this->user = isset($params['user']) ? $params['user'] : ''; $this->password = isset($params['password']) ? $params['password'] : ''; - $this->use_logon_credentials = $params['use_logon_credentials']; + $this->use_logon_credentials = $params['use_logon_credentials'] === 'true' ? true : false; $this->zone = $params['zone']; $this->auth_mode = isset($params['auth_mode']) ? $params['auth_mode'] : ''; @@ -42,7 +42,7 @@ class iRODS extends \OC\Files\Storage\StreamWrapper{ } // take user and password from the session - if ($this->use_logon_credentials === "true" && \OC::$session->exists('irods-credentials')) + if ($this->use_logon_credentials && \OC::$session->exists('irods-credentials')) { $params = \OC::$session->get('irods-credentials'); $this->user = $params['uid']; -- cgit v1.2.3 From 3b835ea1b6e6bfffa98ea10e4cb561b0fb31e5d6 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Wed, 11 Sep 2013 01:11:57 +0200 Subject: never hack late night --- apps/files_external/lib/irods.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps/files_external') diff --git a/apps/files_external/lib/irods.php b/apps/files_external/lib/irods.php index c6f002ffd22..b8191db2f2e 100644 --- a/apps/files_external/lib/irods.php +++ b/apps/files_external/lib/irods.php @@ -32,7 +32,7 @@ class iRODS extends \OC\Files\Storage\StreamWrapper{ $this->port = isset($params['port']) ? $params['port'] : 1247; $this->user = isset($params['user']) ? $params['user'] : ''; $this->password = isset($params['password']) ? $params['password'] : ''; - $this->use_logon_credentials = $params['use_logon_credentials'] === 'true' ? true : false; + $this->use_logon_credentials = ($params['use_logon_credentials'] === 'true'); $this->zone = $params['zone']; $this->auth_mode = isset($params['auth_mode']) ? $params['auth_mode'] : ''; -- cgit v1.2.3