Skip to content
Snippets Groups Projects
Commit 3db18204 authored by pedro_morgan's avatar pedro_morgan
Browse files

Minor tidy

parent 8951334b
No related branches found
No related tags found
No related merge requests found
...@@ -6,16 +6,17 @@ class remoting { ...@@ -6,16 +6,17 @@ class remoting {
private $session_timeout = 600; private $session_timeout = 600;
//* remote login function //* remote login function
public function login($username, $password) { public function login($username, $password)
global $app,$conf,$server; {
global $app, $conf, $server;
if(empty($username)) { if(empty($username)) {
$server->fault('login_username_empty','The login username is empty'); $server->fault('login_username_empty', 'The login username is empty');
return false; return false;
} }
if(empty($password)) { if(empty($password)) {
$server->fault('login_password_empty','The login password is empty'); $server->fault('login_password_empty', 'The login password is empty');
return false; return false;
} }
...@@ -35,7 +36,7 @@ class remoting { ...@@ -35,7 +36,7 @@ class remoting {
$app->db->query($sql); $app->db->query($sql);
return $remote_session; return $remote_session;
} else { } else {
$server->fault('login_failed','The login failed. Username or password wrong.'); $server->fault('login_failed', 'The login failed. Username or password wrong.');
return false; return false;
} }
...@@ -43,11 +44,12 @@ class remoting { ...@@ -43,11 +44,12 @@ class remoting {
//* remote logout function //* remote logout function
public function logout($session_id) { public function logout($session_id)
global $app,$conf,$server; {
global $app, $conf, $server;
if(empty($session_id)) { if(empty($session_id)) {
$server->fault('session_id_empty','The SessionID is empty.'); $server->fault('session_id_empty', 'The SessionID is empty.');
return false; return false;
} }
...@@ -62,10 +64,11 @@ class remoting { ...@@ -62,10 +64,11 @@ class remoting {
} }
} }
public function mail_domain_add($session_id, $params) { public function mail_domain_add($session_id, $params)
global $app,$conf,$server; {
global $app, $conf, $server;
if(!$this->checkPerm($session_id,'mail_domain_add')) { if(!$this->checkPerm($session_id, 'mail_domain_add')) {
$server->fault('permission_denied','You do not have the permissions to access this function.'); $server->fault('permission_denied','You do not have the permissions to access this function.');
return false; return false;
} }
...@@ -83,31 +86,27 @@ class remoting { ...@@ -83,31 +86,27 @@ class remoting {
//* private functions ----------------------------------------------------------------------------------- //** private functions -----------------------------------------------------------------------------------
private function updateQuery($formdef,$params) { private function updateQuery($formdef, $params)
{
} }
private function checkPerm($session_id,$function_name) { private function checkPerm($session_id, $function_name)
{
$session = $this->getSession($session_id); $session = $this->getSession($session_id);
if($session) { if(!$session){
$remote_functions = explode(',',$session['remote_functions']); return false;
if(in_array($function_name,$remote_functions)) { }
return true; return in_array($function_name, explode(',', $session['remote_functions']) );
} else {
return false;
}
} else {
return false;
}
} }
private function getSession($session_id) { private function getSession($session_id)
global $app,$conf,$server; {
global $app, $conf, $server;
if(empty($session_id)) { if(empty($session_id)) {
$server->fault('session_id_empty','The SessionID is empty.'); $server->fault('session_id_empty','The SessionID is empty.');
...@@ -125,10 +124,7 @@ class remoting { ...@@ -125,10 +124,7 @@ class remoting {
$server->fault('session_does_not_exist','The Session is expired or does not exist.'); $server->fault('session_does_not_exist','The Session is expired or does not exist.');
return false; return false;
} }
} }
} }
?> ?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment