@@ -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