Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
lolo888
ISPConfig 3
Commits
3b783369
Commit
3b783369
authored
Aug 04, 2010
by
jmontoya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding the sites_web_domain_plugin
parent
bef77520
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
1 deletion
+65
-1
interface/lib/classes/remoting.inc.php
interface/lib/classes/remoting.inc.php
+2
-1
interface/lib/plugins/sites_web_domain_plugin.inc.php
interface/lib/plugins/sites_web_domain_plugin.inc.php
+63
-0
No files found.
interface/lib/classes/remoting.inc.php
View file @
3b783369
...
...
@@ -1197,7 +1197,8 @@ class remoting {
$this
->
server
->
fault
(
'permission_denied'
,
'You do not have the permissions to access this function.'
);
return
false
;
}
return
$this
->
insertQuery
(
'../sites/form/web_domain.tform.php'
,
$client_id
,
$params
);
$affected_rows
=
$this
->
insertQuery
(
'../sites/form/web_domain.tform.php'
,
$client_id
,
$params
,
'sites:web_domain:on_after_insert'
);
return
$affected_rows
;
}
//* Update a record
...
...
interface/lib/plugins/sites_web_domain_plugin.inc.php
0 → 100644
View file @
3b783369
<?php
/**
* sites_web_domain_plugin plugin
*
* @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
*/
class
sites_web_domain_plugin
{
var
$plugin_name
=
'sites_web_domain_plugin'
;
var
$class_name
=
'sites_web_domain_plugin'
;
/*
This function is called when the plugin is loaded
*/
function
onLoad
()
{
global
$app
;
//Register for the events
$app
->
plugin
->
registerEvent
(
'sites:web_domain:on_after_insert'
,
'sites_web_domain_plugin'
,
'sites_web_domain_edit'
);
}
/*
Function to create the sites_web_domain rule and insert it into the custom rules
*/
function
sites_web_domain_edit
(
$event_name
,
$page_form
)
{
global
$app
,
$conf
;
// make sure that the record belongs to the clinet group and not the admin group when a dmin inserts it
// also make sure that the user can not delete domain created by a admin
if
(
$_SESSION
[
"s"
][
"user"
][
"typ"
]
==
'admin'
&&
isset
(
$page_form
->
dataRecord
[
"client_group_id"
]))
{
$client_group_id
=
intval
(
$page_form
->
dataRecord
[
"client_group_id"
]);
$app
->
db
->
query
(
"UPDATE web_domain SET sys_groupid =
$client_group_id
, sys_perm_group = 'ru' WHERE domain_id = "
.
$page_form
->
id
);
}
if
(
$app
->
auth
->
has_clients
(
$_SESSION
[
's'
][
'user'
][
'userid'
])
&&
isset
(
$page_form
->
dataRecord
[
"client_group_id"
]))
{
$client_group_id
=
intval
(
$page_form
->
dataRecord
[
"client_group_id"
]);
$app
->
db
->
query
(
"UPDATE web_domain SET sys_groupid =
$client_group_id
, sys_perm_group = 'riud' WHERE domain_id = "
.
$page_form
->
id
);
}
// Get configuration for the web system
$app
->
uses
(
"getconf"
);
$web_config
=
$app
->
getconf
->
get_server_config
(
intval
(
$page_form
->
dataRecord
[
'server_id'
]),
'web'
);
$document_root
=
str_replace
(
"[website_id]"
,
$page_form
->
id
,
$web_config
[
"website_path"
]);
// get the ID of the client
if
(
$_SESSION
[
"s"
][
"user"
][
"typ"
]
!=
'admin'
&&
!
$app
->
auth
->
has_clients
(
$_SESSION
[
's'
][
'user'
][
'userid'
]))
{
$client_group_id
=
$_SESSION
[
"s"
][
"user"
][
"default_group"
];
$client
=
$app
->
db
->
queryOneRecord
(
"SELECT client_id FROM sys_group WHERE sys_group.groupid =
$client_group_id
"
);
$client_id
=
intval
(
$client
[
"client_id"
]);
}
else
{
//$client_id = intval($this->dataRecord["client_group_id"]);
$client
=
$app
->
db
->
queryOneRecord
(
"SELECT client_id FROM sys_group WHERE sys_group.groupid = "
.
intval
(
$page_form
->
dataRecord
[
"client_group_id"
]));
$client_id
=
intval
(
$client
[
"client_id"
]);
}
// Set the values for document_root, system_user and system_group
$system_user
=
$app
->
db
->
quote
(
'web'
.
$page_form
->
id
);
$system_group
=
$app
->
db
->
quote
(
'client'
.
$client_id
);
$document_root
=
$app
->
db
->
quote
(
str_replace
(
"[client_id]"
,
$client_id
,
$document_root
));
$php_open_basedir
=
str_replace
(
"[website_path]"
,
$document_root
,
$web_config
[
"php_open_basedir"
]);
$php_open_basedir
=
$app
->
db
->
quote
(
str_replace
(
"[website_domain]"
,
$page_form
->
dataRecord
[
'domain'
],
$php_open_basedir
));
$htaccess_allow_override
=
$app
->
db
->
quote
(
$web_config
[
"htaccess_allow_override"
]);
$sql
=
"UPDATE web_domain SET system_user = '
$system_user
', system_group = '
$system_group
', document_root = '
$document_root
', allow_override = '
$htaccess_allow_override
', php_open_basedir = '
$php_open_basedir
' WHERE domain_id = "
.
$page_form
->
id
;
$app
->
db
->
query
(
$sql
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment