From 99147d51ebbf7d6da506b65190fee06e0e1ed3d0 Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Thu, 25 Jan 2018 20:27:09 +0000 Subject: [PATCH] move public facing stuff into public/, this allows us to stop exposing templates_c/ etc to the world --- common.php | 2 ++ .../broadcast-message.php | 0 calendar.js => public/calendar.js | 0 public/common.php | 3 +++ {css => public/css}/calendar.css | 0 {css => public/css}/default.css | 0 delete.php => public/delete.php | 2 +- edit.php => public/edit.php | 2 +- editactive.php => public/editactive.php | 2 +- {images => public/images}/arrow-l.png | Bin {images => public/images}/arrow-r.png | Bin {images => public/images}/arrow-u.png | Bin {images => public/images}/calendar/cal.gif | Bin {images => public/images}/calendar/next_mon.gif | Bin .../images}/calendar/next_year.gif | Bin {images => public/images}/calendar/no_cal.gif | Bin {images => public/images}/calendar/pixel.gif | Bin {images => public/images}/calendar/prev_mon.gif | Bin .../images}/calendar/prev_year.gif | Bin {images => public/images}/calendar/shade_bl.png | Bin {images => public/images}/calendar/shade_bm.png | Bin {images => public/images}/calendar/shade_br.png | Bin {images => public/images}/calendar/shade_mr.png | Bin {images => public/images}/calendar/shade_tr.png | Bin {images => public/images}/favicon.ico | Bin {images => public/images}/index.php | 0 {images => public/images}/logo-default.png | Bin {images => public/images}/mail_bg.gif | Bin {images => public/images}/postbox.png | Bin {images => public/images}/postfixadmin.png | Bin {images => public/images}/postfixadmin2.png | Bin {images => public/images}/postfixadmin2.xcf | Bin {images => public/images}/quota-colors.png | Bin index.php => public/index.php | 16 ++++++++++------ list-virtual.php => public/list-virtual.php | 0 list.php => public/list.php | 2 +- login.php => public/login.php | 0 main.php => public/main.php | 0 .../password-change.php | 0 .../password-recover.php | 0 sendmail.php => public/sendmail.php | 0 setup.php => public/setup.php | 10 +++++----- upgrade.php => public/upgrade.php | 0 {users => public/users}/calendar.js | 0 {users => public/users}/css/calendar.css | 0 {users => public/users}/css/default.css | 0 {users => public/users}/edit-alias.php | 0 {users => public/users}/images/calendar/cal.gif | Bin .../users}/images/calendar/next_mon.gif | Bin .../users}/images/calendar/next_year.gif | Bin .../users}/images/calendar/no_cal.gif | Bin .../users}/images/calendar/pixel.gif | Bin .../users}/images/calendar/prev_mon.gif | Bin .../users}/images/calendar/prev_year.gif | Bin .../users}/images/calendar/shade_bl.png | Bin .../users}/images/calendar/shade_bm.png | Bin .../users}/images/calendar/shade_br.png | Bin .../users}/images/calendar/shade_mr.png | Bin .../users}/images/calendar/shade_tr.png | Bin {users => public/users}/index.php | 0 {users => public/users}/login.php | 0 {users => public/users}/main.php | 0 {users => public/users}/password-change.php | 0 {users => public/users}/password-recover.php | 0 {users => public/users}/password.php | 0 {users => public/users}/vacation.php | 0 vacation.php => public/vacation.php | 0 viewlog.php => public/viewlog.php | 0 xmlrpc.php => public/xmlrpc.php | 0 smarty.inc.php | 1 - 70 files changed, 24 insertions(+), 16 deletions(-) rename broadcast-message.php => public/broadcast-message.php (100%) rename calendar.js => public/calendar.js (100%) create mode 100644 public/common.php rename {css => public/css}/calendar.css (100%) rename {css => public/css}/default.css (100%) rename delete.php => public/delete.php (91%) rename edit.php => public/edit.php (98%) rename editactive.php => public/editactive.php (91%) rename {images => public/images}/arrow-l.png (100%) rename {images => public/images}/arrow-r.png (100%) rename {images => public/images}/arrow-u.png (100%) rename {images => public/images}/calendar/cal.gif (100%) rename {images => public/images}/calendar/next_mon.gif (100%) rename {images => public/images}/calendar/next_year.gif (100%) rename {images => public/images}/calendar/no_cal.gif (100%) rename {images => public/images}/calendar/pixel.gif (100%) rename {images => public/images}/calendar/prev_mon.gif (100%) rename {images => public/images}/calendar/prev_year.gif (100%) rename {images => public/images}/calendar/shade_bl.png (100%) rename {images => public/images}/calendar/shade_bm.png (100%) rename {images => public/images}/calendar/shade_br.png (100%) rename {images => public/images}/calendar/shade_mr.png (100%) rename {images => public/images}/calendar/shade_tr.png (100%) rename {images => public/images}/favicon.ico (100%) rename {images => public/images}/index.php (100%) rename {images => public/images}/logo-default.png (100%) rename {images => public/images}/mail_bg.gif (100%) rename {images => public/images}/postbox.png (100%) rename {images => public/images}/postfixadmin.png (100%) rename {images => public/images}/postfixadmin2.png (100%) rename {images => public/images}/postfixadmin2.xcf (100%) rename {images => public/images}/quota-colors.png (100%) rename index.php => public/index.php (83%) rename list-virtual.php => public/list-virtual.php (100%) rename list.php => public/list.php (96%) rename login.php => public/login.php (100%) rename main.php => public/main.php (100%) rename password-change.php => public/password-change.php (100%) rename password-recover.php => public/password-recover.php (100%) rename sendmail.php => public/sendmail.php (100%) rename setup.php => public/setup.php (98%) rename upgrade.php => public/upgrade.php (100%) rename {users => public/users}/calendar.js (100%) rename {users => public/users}/css/calendar.css (100%) rename {users => public/users}/css/default.css (100%) rename {users => public/users}/edit-alias.php (100%) rename {users => public/users}/images/calendar/cal.gif (100%) rename {users => public/users}/images/calendar/next_mon.gif (100%) rename {users => public/users}/images/calendar/next_year.gif (100%) rename {users => public/users}/images/calendar/no_cal.gif (100%) rename {users => public/users}/images/calendar/pixel.gif (100%) rename {users => public/users}/images/calendar/prev_mon.gif (100%) rename {users => public/users}/images/calendar/prev_year.gif (100%) rename {users => public/users}/images/calendar/shade_bl.png (100%) rename {users => public/users}/images/calendar/shade_bm.png (100%) rename {users => public/users}/images/calendar/shade_br.png (100%) rename {users => public/users}/images/calendar/shade_mr.png (100%) rename {users => public/users}/images/calendar/shade_tr.png (100%) rename {users => public/users}/index.php (100%) rename {users => public/users}/login.php (100%) rename {users => public/users}/main.php (100%) rename {users => public/users}/password-change.php (100%) rename {users => public/users}/password-recover.php (100%) rename {users => public/users}/password.php (100%) rename {users => public/users}/vacation.php (100%) rename vacation.php => public/vacation.php (100%) rename viewlog.php => public/viewlog.php (100%) rename xmlrpc.php => public/xmlrpc.php (100%) diff --git a/common.php b/common.php index 6425d377..54d34751 100644 --- a/common.php +++ b/common.php @@ -92,6 +92,7 @@ if(!empty($CONF['language_hook']) && function_exists($CONF['language_hook'])) { Config::write('__LANG', $PALANG); +unset($incpath); if (!defined('POSTFIXADMIN_CLI')) { if(!is_file("$incpath/smarty.inc.php")) { @@ -99,5 +100,6 @@ if (!defined('POSTFIXADMIN_CLI')) { } require_once ("$incpath/smarty.inc.php"); } + /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ ?> diff --git a/broadcast-message.php b/public/broadcast-message.php similarity index 100% rename from broadcast-message.php rename to public/broadcast-message.php diff --git a/calendar.js b/public/calendar.js similarity index 100% rename from calendar.js rename to public/calendar.js diff --git a/public/common.php b/public/common.php new file mode 100644 index 00000000..3e4da4bb --- /dev/null +++ b/public/common.php @@ -0,0 +1,3 @@ + FALSE); -if(file_exists(dirname(__FILE__) . '/config.inc.php')) { - require_once('config.inc.php'); +if(file_exists(dirname(__FILE__) . '/../config.inc.php')) { + require_once(dirname(__FILE__) . '/../config.inc.php'); } if ( $CONF['configured'] === TRUE ) @@ -67,9 +67,9 @@ if ( $CONF['configured'] === TRUE )

What now?

    -
  1. Read the INSTALL.txt file
  2. +
  3. Read the INSTALL.TXT file
  4. Configure Postfix to use your chosen database - see (for example) the following pages : -
      +
      • Postfix/PostgreSQL/Postfixadmin/Courier
      • Postfix/MySQL/Postfixadmin/Dovecot
      • Postfix/MySQL/Postfixamdin/Courier
      • @@ -80,10 +80,14 @@ if ( $CONF['configured'] === TRUE )

        When you have configured Postfixadmin, this page will be replaced with a login page.

        You can now run setup to make sure that all the PHP functions are available for Postfix Admin to run.

        If you still encounter any problems, please check the documentation and website for more information.

        +

        Postfix Admin Web sites

        For further help, or documentation please check out - - Postfix Admin web site
        - Knowledge Base +

        diff --git a/list-virtual.php b/public/list-virtual.php similarity index 100% rename from list-virtual.php rename to public/list-virtual.php diff --git a/list.php b/public/list.php similarity index 96% rename from list.php rename to public/list.php index 09b26bc8..9fe64a3b 100644 --- a/list.php +++ b/public/list.php @@ -25,7 +25,7 @@ $table = safeget('table'); $handlerclass = ucfirst($table) . 'Handler'; -if ( !preg_match('/^[a-z]+$/', $table) || !file_exists("model/$handlerclass.php")) { # validate $table +if ( !preg_match('/^[a-z]+$/', $table) || !file_exists(dirname(__FILE__) . "/../model/$handlerclass.php")) { # validate $table die ("Invalid table name given!"); } diff --git a/login.php b/public/login.php similarity index 100% rename from login.php rename to public/login.php diff --git a/main.php b/public/main.php similarity index 100% rename from main.php rename to public/main.php diff --git a/password-change.php b/public/password-change.php similarity index 100% rename from password-change.php rename to public/password-change.php diff --git a/password-recover.php b/public/password-recover.php similarity index 100% rename from password-recover.php rename to public/password-recover.php diff --git a/sendmail.php b/public/sendmail.php similarity index 100% rename from sendmail.php rename to public/sendmail.php diff --git a/setup.php b/public/setup.php similarity index 98% rename from setup.php rename to public/setup.php index 1bb7841d..65e82c9f 100644 --- a/setup.php +++ b/public/setup.php @@ -29,7 +29,7 @@ require_once(dirname(__FILE__).'/common.php'); # make sure correct common.php is $CONF['show_header_text'] = 'NO'; $CONF['theme_logo'] = 'images/logo-default.png'; $CONF['theme_css'] = 'css/default.css'; -require($incpath.'/templates/header.php'); +require(dirname(__FILE__) . '/../templates/header.php'); ?>
        @@ -53,8 +53,8 @@ $f_preg_match = function_exists ("preg_match"); $f_mb_encode_mimeheader = function_exists ("mb_encode_mimeheader"); $f_imap_open = function_exists ("imap_open"); -$file_config = file_exists (realpath ("./config.inc.php")); -$file_local_config = file_exists (realpath ("./config.local.php")); +$file_config = file_exists (realpath ("./../config.inc.php")); +$file_local_config = file_exists (realpath ("./../config.local.php")); $error = 0; @@ -130,7 +130,7 @@ $config_loaded = 0; if ($file_config == 1) { print "
      • Depends on: presence config.inc.php - OK
      • \n"; - require_once($incpath.'/config.inc.php'); + require_once(dirname(__FILE__) .'/../config.inc.php'); $config_loaded = 1; if(isset($CONF['configured'])) { @@ -327,7 +327,7 @@ if ($error != 0) else { print "

        Everything seems fine... attempting to create/update database structure

        \n"; - require_once($incpath.'/upgrade.php'); + require_once(dirname(__FILE__) .'/upgrade.php'); $tUsername = ''; $setupMessage = ''; diff --git a/upgrade.php b/public/upgrade.php similarity index 100% rename from upgrade.php rename to public/upgrade.php diff --git a/users/calendar.js b/public/users/calendar.js similarity index 100% rename from users/calendar.js rename to public/users/calendar.js diff --git a/users/css/calendar.css b/public/users/css/calendar.css similarity index 100% rename from users/css/calendar.css rename to public/users/css/calendar.css diff --git a/users/css/default.css b/public/users/css/default.css similarity index 100% rename from users/css/default.css rename to public/users/css/default.css diff --git a/users/edit-alias.php b/public/users/edit-alias.php similarity index 100% rename from users/edit-alias.php rename to public/users/edit-alias.php diff --git a/users/images/calendar/cal.gif b/public/users/images/calendar/cal.gif similarity index 100% rename from users/images/calendar/cal.gif rename to public/users/images/calendar/cal.gif diff --git a/users/images/calendar/next_mon.gif b/public/users/images/calendar/next_mon.gif similarity index 100% rename from users/images/calendar/next_mon.gif rename to public/users/images/calendar/next_mon.gif diff --git a/users/images/calendar/next_year.gif b/public/users/images/calendar/next_year.gif similarity index 100% rename from users/images/calendar/next_year.gif rename to public/users/images/calendar/next_year.gif diff --git a/users/images/calendar/no_cal.gif b/public/users/images/calendar/no_cal.gif similarity index 100% rename from users/images/calendar/no_cal.gif rename to public/users/images/calendar/no_cal.gif diff --git a/users/images/calendar/pixel.gif b/public/users/images/calendar/pixel.gif similarity index 100% rename from users/images/calendar/pixel.gif rename to public/users/images/calendar/pixel.gif diff --git a/users/images/calendar/prev_mon.gif b/public/users/images/calendar/prev_mon.gif similarity index 100% rename from users/images/calendar/prev_mon.gif rename to public/users/images/calendar/prev_mon.gif diff --git a/users/images/calendar/prev_year.gif b/public/users/images/calendar/prev_year.gif similarity index 100% rename from users/images/calendar/prev_year.gif rename to public/users/images/calendar/prev_year.gif diff --git a/users/images/calendar/shade_bl.png b/public/users/images/calendar/shade_bl.png similarity index 100% rename from users/images/calendar/shade_bl.png rename to public/users/images/calendar/shade_bl.png diff --git a/users/images/calendar/shade_bm.png b/public/users/images/calendar/shade_bm.png similarity index 100% rename from users/images/calendar/shade_bm.png rename to public/users/images/calendar/shade_bm.png diff --git a/users/images/calendar/shade_br.png b/public/users/images/calendar/shade_br.png similarity index 100% rename from users/images/calendar/shade_br.png rename to public/users/images/calendar/shade_br.png diff --git a/users/images/calendar/shade_mr.png b/public/users/images/calendar/shade_mr.png similarity index 100% rename from users/images/calendar/shade_mr.png rename to public/users/images/calendar/shade_mr.png diff --git a/users/images/calendar/shade_tr.png b/public/users/images/calendar/shade_tr.png similarity index 100% rename from users/images/calendar/shade_tr.png rename to public/users/images/calendar/shade_tr.png diff --git a/users/index.php b/public/users/index.php similarity index 100% rename from users/index.php rename to public/users/index.php diff --git a/users/login.php b/public/users/login.php similarity index 100% rename from users/login.php rename to public/users/login.php diff --git a/users/main.php b/public/users/main.php similarity index 100% rename from users/main.php rename to public/users/main.php diff --git a/users/password-change.php b/public/users/password-change.php similarity index 100% rename from users/password-change.php rename to public/users/password-change.php diff --git a/users/password-recover.php b/public/users/password-recover.php similarity index 100% rename from users/password-recover.php rename to public/users/password-recover.php diff --git a/users/password.php b/public/users/password.php similarity index 100% rename from users/password.php rename to public/users/password.php diff --git a/users/vacation.php b/public/users/vacation.php similarity index 100% rename from users/vacation.php rename to public/users/vacation.php diff --git a/vacation.php b/public/vacation.php similarity index 100% rename from vacation.php rename to public/vacation.php diff --git a/viewlog.php b/public/viewlog.php similarity index 100% rename from viewlog.php rename to public/viewlog.php diff --git a/xmlrpc.php b/public/xmlrpc.php similarity index 100% rename from xmlrpc.php rename to public/xmlrpc.php diff --git a/smarty.inc.php b/smarty.inc.php index e416533f..dee834f1 100644 --- a/smarty.inc.php +++ b/smarty.inc.php @@ -12,7 +12,6 @@ class PFASmarty { $this->template = new Smarty(); //$this->template->debugging = true; - $incpath = dirname(__FILE__); $this->template->setTemplateDir(dirname(__FILE__) . '/templates'); // if it's not present or writeable, smarty should just not cache.