Skip to content

Commit 3db1820

Browse files
author
pedro_morgan
committed
Minor tidy
1 parent 8951334 commit 3db1820

File tree

1 file changed

+26
-30
lines changed

1 file changed

+26
-30
lines changed

interface/lib/classes/remoting.inc.php

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@ class remoting {
66
private $session_timeout = 600;
77

88
//* remote login function
9-
public function login($username, $password) {
10-
global $app,$conf,$server;
9+
public function login($username, $password)
10+
{
11+
global $app, $conf, $server;
1112

1213
if(empty($username)) {
13-
$server->fault('login_username_empty','The login username is empty');
14+
$server->fault('login_username_empty', 'The login username is empty');
1415
return false;
1516
}
1617

1718
if(empty($password)) {
18-
$server->fault('login_password_empty','The login password is empty');
19+
$server->fault('login_password_empty', 'The login password is empty');
1920
return false;
2021
}
2122

@@ -35,19 +36,20 @@ public function login($username, $password) {
3536
$app->db->query($sql);
3637
return $remote_session;
3738
} else {
38-
$server->fault('login_failed','The login failed. Username or password wrong.');
39+
$server->fault('login_failed', 'The login failed. Username or password wrong.');
3940
return false;
4041
}
4142

4243
}
4344

4445

4546
//* remote logout function
46-
public function logout($session_id) {
47-
global $app,$conf,$server;
47+
public function logout($session_id)
48+
{
49+
global $app, $conf, $server;
4850

4951
if(empty($session_id)) {
50-
$server->fault('session_id_empty','The SessionID is empty.');
52+
$server->fault('session_id_empty', 'The SessionID is empty.');
5153
return false;
5254
}
5355

@@ -62,10 +64,11 @@ public function logout($session_id) {
6264
}
6365
}
6466

65-
public function mail_domain_add($session_id, $params) {
66-
global $app,$conf,$server;
67+
public function mail_domain_add($session_id, $params)
68+
{
69+
global $app, $conf, $server;
6770

68-
if(!$this->checkPerm($session_id,'mail_domain_add')) {
71+
if(!$this->checkPerm($session_id, 'mail_domain_add')) {
6972
$server->fault('permission_denied','You do not have the permissions to access this function.');
7073
return false;
7174
}
@@ -83,31 +86,27 @@ public function mail_domain_add($session_id, $params) {
8386

8487

8588

86-
//* private functions -----------------------------------------------------------------------------------
89+
//** private functions -----------------------------------------------------------------------------------
8790

88-
private function updateQuery($formdef,$params) {
91+
private function updateQuery($formdef, $params)
92+
{
8993

9094
}
9195

9296

93-
private function checkPerm($session_id,$function_name) {
94-
97+
private function checkPerm($session_id, $function_name)
98+
{
9599
$session = $this->getSession($session_id);
96-
if($session) {
97-
$remote_functions = explode(',',$session['remote_functions']);
98-
if(in_array($function_name,$remote_functions)) {
99-
return true;
100-
} else {
101-
return false;
102-
}
103-
} else {
104-
return false;
105-
}
100+
if(!$session){
101+
return false;
102+
}
103+
return in_array($function_name, explode(',', $session['remote_functions']) );
106104
}
107105

108106

109-
private function getSession($session_id) {
110-
global $app,$conf,$server;
107+
private function getSession($session_id)
108+
{
109+
global $app, $conf, $server;
111110

112111
if(empty($session_id)) {
113112
$server->fault('session_id_empty','The SessionID is empty.');
@@ -125,10 +124,7 @@ private function getSession($session_id) {
125124
$server->fault('session_does_not_exist','The Session is expired or does not exist.');
126125
return false;
127126
}
128-
129127
}
130-
131-
132128
}
133129

134130
?>

0 commit comments

Comments
 (0)