Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
ISPConfig 3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ISPConfig
ISPConfig 3
Commits
412aa4f7
Commit
412aa4f7
authored
17 years ago
by
tbrehm
Browse files
Options
Downloads
Patches
Plain Diff
First files of the remoting interface.
parent
c5a08eeb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
interface/lib/app.inc.php
+1
-1
1 addition, 1 deletion
interface/lib/app.inc.php
interface/lib/classes/remoting.inc.php
+134
-0
134 additions, 0 deletions
interface/lib/classes/remoting.inc.php
interface/web/remote/index.php
+16
-0
16 additions, 0 deletions
interface/web/remote/index.php
with
151 additions
and
1 deletion
interface/lib/app.inc.php
+
1
−
1
View file @
412aa4f7
...
...
@@ -55,7 +55,7 @@ class app {
}
//* Start the session
if
(
$conf
[
"
start_session
"
]
==
true
)
{
if
(
$
this
->
_
conf
[
'
start_session
'
]
==
true
)
{
session_start
();
//* Initialize session variables
...
...
This diff is collapsed.
Click to expand it.
interface/lib/classes/remoting.inc.php
0 → 100644
+
134
−
0
View file @
412aa4f7
<?php
class
remoting
{
//* remote session timeout in seconds
private
$session_timeout
=
600
;
//* remote login function
public
function
login
(
$username
,
$password
)
{
global
$app
,
$conf
,
$server
;
if
(
empty
(
$username
))
{
$server
->
fault
(
'login_username_empty'
,
'The login username is empty'
);
return
false
;
}
if
(
empty
(
$password
))
{
$server
->
fault
(
'login_password_empty'
,
'The login password is empty'
);
return
false
;
}
$username
=
$app
->
db
->
quote
(
$username
);
$password
=
$app
->
db
->
quote
(
$password
);
$sql
=
"SELECT * FROM remote_user WHERE remote_username = '
$username
' and remote_password = md5('
$password
')"
;
$remote_user
=
$app
->
db
->
queryOneRecord
(
$sql
);
if
(
$remote_user
[
'remote_userid'
]
>
0
)
{
//* Create a remote user session
srand
((
double
)
microtime
()
*
1000000
);
$remote_session
=
md5
(
rand
());
$remote_userid
=
$remote_user
[
'remote_userid'
];
$remote_functions
=
$remote_user
[
'remote_functions'
];
$tstamp
=
time
()
+
$this
->
session_timeout
;
$sql
=
"INSERT INTO remote_session (remote_session,remote_userid,remote_functions,tstamp) VALUES ('
$remote_session
',
$remote_userid
,'
$remote_functions
',
$tstamp
)"
;
$app
->
db
->
query
(
$sql
);
return
$remote_session
;
}
else
{
$server
->
fault
(
'login_failed'
,
'The login failed. Username or password wrong.'
);
return
false
;
}
}
//* remote logout function
public
function
logout
(
$session_id
)
{
global
$app
,
$conf
,
$server
;
if
(
empty
(
$session_id
))
{
$server
->
fault
(
'session_id_empty'
,
'The SessionID is empty.'
);
return
false
;
}
$session_id
=
$app
->
db
->
quote
(
$session_id
);
$sql
=
"DELETE FROM remote_session WHERE remote_session = '
$session_id
'"
;
$app
->
db
->
query
(
$sql
);
if
(
$app
->
db
->
affectedRows
()
==
1
)
{
return
true
;
}
else
{
return
false
;
}
}
public
function
mail_domain_add
(
$session_id
,
$params
)
{
global
$app
,
$conf
,
$server
;
if
(
!
$this
->
checkPerm
(
$session_id
,
'mail_domain_add'
))
{
$server
->
fault
(
'permission_denied'
,
'You do not have the permissions to access this function.'
);
return
false
;
}
//* Form definition file, that is used for this table in the interafce
$formdef
=
'../mail/form/mail_domain.tform.php'
;
//* check the variables against the form definition and build the sql query automatically.
// I will use a modified version of the tform class for this.
}
//* private functions -----------------------------------------------------------------------------------
private
function
updateQuery
(
$formdef
,
$params
)
{
}
private
function
checkPerm
(
$session_id
,
$function_name
)
{
$session
=
$this
->
getSession
(
$session_id
);
if
(
$session
)
{
$remote_functions
=
explode
(
','
,
$session
[
'remote_functions'
]);
if
(
in_array
(
$function_name
,
$remote_functions
))
{
return
true
;
}
else
{
return
false
;
}
}
else
{
return
false
;
}
}
private
function
getSession
(
$session_id
)
{
global
$app
,
$conf
,
$server
;
if
(
empty
(
$session_id
))
{
$server
->
fault
(
'session_id_empty'
,
'The SessionID is empty.'
);
return
false
;
}
$session_id
=
$app
->
db
->
quote
(
$session_id
);
$now
=
time
();
$sql
=
"SELECT * FROM remote_session WHERE remote_session = '
$session_id
' AND tstamp >=
$now
"
;
$session
=
$app
->
db
->
queryOneRecord
(
$sql
);
if
(
$session
[
'remote_userid'
]
>
0
)
{
return
$session
;
}
else
{
$server
->
fault
(
'session_does_not_exist'
,
'The Session is expired or does not exist.'
);
return
false
;
}
}
}
?>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
interface/web/remote/index.php
0 → 100644
+
16
−
0
View file @
412aa4f7
<?php
require_once
(
'../../lib/config.inc.php'
);
$conf
[
'start_session'
]
=
false
;
require_once
(
'../../lib/app.inc.php'
);
$app
->
load
(
'remoting'
);
$server
=
new
SoapServer
(
null
,
array
(
'uri'
=>
$_SERVER
[
'REQUEST_URI'
]));
//$server->setPersistence(SOAP_PERSISTENCE_SESSION);
$server
->
setClass
(
'remoting'
);
$server
->
handle
();
?>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment