Skip to content

Commit 3e41e8e

Browse files
author
latham
committed
Start Private Label work
1 parent 777a1d2 commit 3e41e8e

File tree

3 files changed

+42
-24
lines changed

3 files changed

+42
-24
lines changed

interface/lib/config.inc.local.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
// $conf['theme'] = 'mycustom_theme'; // Must be installed.
2626
// $conf['logo'] = 'themes/default/images/ispc_logo.png';
2727

28-
// $conf['language'] = 'en';
28+
// $conf['templates'] = '/opt/tecnoera/templates';
29+
30+
// $conf['language'] = 'es';
2931

3032
// $conf['interface_logout_url'] = 'http://www.mycompany.com';
3133

interface/lib/config.inc.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@
128128
$conf['html_content_encoding'] = 'utf-8'; // example: utf-8, iso-8859-1, ...
129129
$conf['logo'] = 'themes/default/images/ispc_logo.png';
130130

131+
//** Templates
132+
$conf['templates'] = '/usr/local/ispconfig/server/conf';
131133

132134
//** Default Language
133135
$conf['language'] = 'en';

server/plugins-available/apache2_plugin.inc.php

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -420,40 +420,54 @@ function update($event_name,$data) {
420420
}
421421

422422

423+
424+
// Install the Standard or Custom Error, Index and other related files
425+
// /usr/local/ispconfig/server/conf is for the standard files
426+
// /usr/local/ispconfig/server/conf-custom is for the custom files
427+
// setting a local var here
428+
429+
// normally $conf['templates'] = "/usr/local/ispconfig/server/conf";
430+
423431
if($this->action == 'insert' && $data['new']['type'] == 'vhost') {
424432
// Copy the error pages
425433
if($data['new']['errordocs']) {
426434
$error_page_path = escapeshellcmd($data['new']['document_root']).'/web/error/';
427-
if (file_exists('/usr/local/ispconfig/server/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) {
428-
exec('cp /usr/local/ispconfig/server/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
435+
if (file_exists($conf['templates'] . '-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) {
436+
exec('cp ' . $conf['templates'] . '-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
429437
}
430438
else {
431-
if (file_exists('/usr/local/ispconfig/server/conf-custom/error/400.html')) {
432-
exec('cp /usr/local/ispconfig/server/conf-custom/error/*.html '.$error_page_path);
439+
if (file_exists($conf['templates'] . '-custom/error/400.html')) {
440+
exec('cp '. $conf['templates'] .'-custom/error/*.html '.$error_page_path);
433441
}
434442
else {
435-
exec('cp /usr/local/ispconfig/server/conf/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
443+
exec('cp ' . $conf['templates'] . '/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
436444
}
437445
}
438446
exec('chmod -R a+r '.$error_page_path);
439447
}
440448

441-
// copy the standard index page
442-
if (file_exists('/usr/local/ispconfig/server/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2))) {
443-
exec('cp /usr/local/ispconfig/server/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/web/index.html');
444-
if(is_file('/usr/local/ispconfig/server/conf-custom/index/favicon.ico')) exec('cp /usr/local/ispconfig/server/conf-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/web/');
445-
if(is_file('/usr/local/ispconfig/server/conf-custom/index/robots.txt')) exec('cp /usr/local/ispconfig/server/conf-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/web/');
446-
if(is_file('/usr/local/ispconfig/server/conf-custom/index/.htaccess')) exec('cp /usr/local/ispconfig/server/conf-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/web/');
447-
}
449+
if (file_exists($conf['templates'] . '-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2))) {
450+
exec('cp ' . $conf['templates'] . '-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/web/index.html');
451+
452+
if(is_file($conf['templates'] . '-custom/index/favicon.ico')) {
453+
exec('cp ' . $conf['templates'] . '-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/web/');
454+
}
455+
if(is_file($conf['templates'] . '-custom/index/robots.txt')) {
456+
exec('cp ' . $conf['templates'] . '-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/web/');
457+
}
458+
if(is_file($conf['templates'] . '-custom/index/.htaccess')) {
459+
exec('cp ' . $conf['templates'] . '-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/web/');
460+
}
461+
}
448462
else {
449-
if (file_exists('/usr/local/ispconfig/server/conf-custom/index/standard_index.html')) {
450-
exec('cp /usr/local/ispconfig/server/conf-custom/index/standard_index.html '.escapeshellcmd($data['new']['document_root']).'/web/index.html');
463+
if (file_exists($conf['templates'] . '-custom/index/standard_index.html')) {
464+
exec('cp ' . $conf['templates'] . '-custom/index/standard_index.html '.escapeshellcmd($data['new']['document_root']).'/web/index.html');
451465
}
452466
else {
453-
exec('cp /usr/local/ispconfig/server/conf/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/web/index.html');
454-
if(is_file('/usr/local/ispconfig/server/conf/index/favicon.ico')) exec('cp /usr/local/ispconfig/server/conf/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/web/');
455-
if(is_file('/usr/local/ispconfig/server/conf/index/robots.txt')) exec('cp /usr/local/ispconfig/server/conf/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/web/');
456-
if(is_file('/usr/local/ispconfig/server/conf/index/.htaccess')) exec('cp /usr/local/ispconfig/server/conf/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/web/');
467+
exec('cp ' . $conf['templates'] . '/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/web/index.html');
468+
if(is_file($conf['templates'] . '/index/favicon.ico')) exec('cp ' . $conf['templates'] . '/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/web/');
469+
if(is_file($conf['templates'] . '/index/robots.txt')) exec('cp ' . $conf['templates'] . '/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/web/');
470+
if(is_file($conf['templates'] . '/index/.htaccess')) exec('cp ' . $conf['templates'] . '/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/web/');
457471
}
458472
}
459473
exec('chmod -R a+r '.escapeshellcmd($data['new']['document_root']).'/web/');
@@ -462,15 +476,15 @@ function update($event_name,$data) {
462476
} elseif ($this->action == 'update' && $data['new']['type'] == 'vhost' && $data['old']['errordocs'] == 0 && $data['new']['errordocs'] == 1) {
463477

464478
$error_page_path = escapeshellcmd($data['new']['document_root']).'/web/error/';
465-
if (file_exists('/usr/local/ispconfig/server/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) {
466-
exec('cp /usr/local/ispconfig/server/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
479+
if (file_exists($conf['templates'] . '-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) {
480+
exec('cp ' . $conf['templates'] . '-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
467481
}
468482
else {
469-
if (file_exists('/usr/local/ispconfig/server/conf-custom/error/400.html')) {
470-
exec('cp /usr/local/ispconfig/server/conf-custom/error/*.html '.$error_page_path);
483+
if (file_exists($conf['templates'] . '-custom/error/400.html')) {
484+
exec('cp ' . $conf['templates'] . '-custom/error/*.html '.$error_page_path);
471485
}
472486
else {
473-
exec('cp /usr/local/ispconfig/server/conf/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
487+
exec('cp ' . $conf['templates'] . '/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
474488
}
475489
}
476490
exec('chmod -R a+r '.$error_page_path);

0 commit comments

Comments
 (0)