Commit Graph

49 Commits (6a4b7ec1632691438fd0829406660c6d3d82aea1)

Author SHA1 Message Date
David Goodwin 87824ef970 psalm fixes/workarounds; require PHP 5.6+ 5 years ago
David Goodwin a0b4e690b2 only load random_compat if PHP_VERSION is < 7.0 5 years ago
David Goodwin 7e7f644952 skip this check if unit test 6 years ago
David Goodwin 2b31e71d5c improve error message 6 years ago
David Goodwin 4fcdba9cf4 run php-cs-fixer (code reforamt) 6 years ago
David Goodwin 5d74ff4cc7 only require language if non-empty 6 years ago
David Goodwin 1c4a6080d7 make phar loading optional depending on the extension being present or not 7 years ago
Christian Boltz 05bf2d2013
if unconfigured, recommend to edit config.local.php
... instead of config.inc.php

(idea based on comments on
7c38bdd871 )
7 years ago
David Goodwin b97decb7c2 add a lib directory; move smarty into it; add random_compat phar (for random_bytes() on PHP < 7) 7 years ago
David Goodwin 9bef45aed5 remove logout behaviour from common.php (never used); try and fix logout in login.php - see #130 7 years ago
Adrien Crivelli 15df6c1d7b
Reformat everything with PHP-Cs-Fixer 7 years ago
David Goodwin f0be0ebf62 remove more incpath usages 7 years ago
David Goodwin 99147d51eb move public facing stuff into public/, this allows us to stop exposing templates_c/ etc to the world 7 years ago
Christian Boltz 9df6de65af
Finally get rid of variables.inc.php
Initialize $error and $tMailbox where needed.

The other variables in variables.inc.php are already initialized
everywhere.
8 years ago
Christian Boltz 431bd3d810 rename session cookie
With the default PHPSESSID cookie name, there are some rare (and hard to
debug) cases that break logging in if a different application on the
domain also uses a PHPSESSID cookie. See
https://sourceforge.net/p/postfixadmin/bugs/314/ for details.

Using 'postfixadmin_session' as cookie name should fix this.


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1846 a1433add-5e2c-0410-b055-b7f2511e0802
9 years ago
David Goodwin 9c022f7e01 merge patch from https://sourceforge.net/p/postfixadmin/bugs/347/ (thank you Eugene Grosbein) - explictly set session_cache_limiter to nocache
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1792 a1433add-5e2c-0410-b055-b7f2511e0802
9 years ago
David Goodwin e39510726a use !empty to avoid error
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1623 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz fbc18ff993 login.php, common.php:
- when login.php is requested, logout the current admin/user
  https://sourceforge.net/p/postfixadmin/bugs/284/



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1568 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 6e2e132bac remove "postfixadmin.com" in comments in lots of files
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1558 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz c6ca4f9bae common.php:
- call Config::write() earlier, because check_language() uses it
- later add $PALANG with Config::write(__LANG)

Thanks to <controlcde> for reporting the results of this bug on IRC
(even if I had to hunt it down to find the reason ;-)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1548 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 4d9a338eb2 After hunting an "undefined index transport" error in list-domain, I
found out that the 'Config' class is too static - it shares its static
data with the 'Lang' child class. 

This caused a conflict because we have $CONF[transport] and 
$PALANG[transport], and Config::read('transport') returned the $PALANG 
text.

To fix this, all texts are now stored as $CONF[__LANG].
I also dropped the 'Lang' class.


model/Config.php:
- mark the 'Config' class as final to ensure we don't trap into the 
  "too static" problem again.
- bool(): display and log an error message if a $CONF option does not
  contain YES or NO (that would have uncovered this bug much earlier)
- add lang() and lang_f() wrapper functions to get $PALANG texts
- remove unused $__cache and $__objects

model/Lang.php:
- deleted

common.php:
- store $PALANG as $CONF[__LANG]

lots of files:
- replace Lang::read() and Lang::read_f() calls with Config::lang()
  and Config::lang_f()




git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1536 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 631c6e754f common.php:
- move postfixadmin_autoload() and spl_autoload_register upwards
  (it's needed earlier after using the Config class in more functions)
- call Config::write earlier (as soon as $CONF is complete)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1454 a1433add-5e2c-0410-b055-b7f2511e0802
12 years ago
David Goodwin ecf7757981 Remove getInstance calls; not needed as we use ::write
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1239 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz 646c790371 common.php, scripts/postfixadmin-cli.php:
- init Lang and Config classes in common.php instead of postfixadmin-cli.php -
  they need to be available in the web interface also


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1215 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz 4611b111e3 common.php:
- merge with scripts/common.php
- don't start/use session in CLI mode
- don't load smarty.inc.php in CLI mode
- hardcode language to 'en' in CLI mode (was done in postfixadmin-cli.php before)

scripts/postfixadmin-cli.php - __bootstrap():
- use common.php instead of scripts/common.php
- don't load languages/language.php and languages/en.lang (already
  done via common.php)
- don't call language_hook (already done via common.php)

scripts/common.php:
- deleted
- dropped helper functions low(), up(), r() and pr() which were just
  shortnames for existing PHP functions


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1214 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz a5f3cb9b96 config.inc.php:
- new config option $CONF['language_hook']
  Hook function to override or add translations to $PALANG.
  Example hook function included (commented out).

common.php:
- honor $CONF['language_hook']

scripts/postfixadmin-cli.php:
- honor $CONF['language_hook']
- add TODO - language shouldn't be hardcoded to english

This implements my feature request at
http://sourceforge.net/tracker/?func=detail&aid=3292408&group_id=191583&atid=937967


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1176 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
David Goodwin b0bd8cd1f5 see changeset:952 ... move php code out of template into here
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@953 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Christian Boltz 98c0252a08 common.php:
- store language in session variable
  (BTW: storing it only at login instead of calling check_language() on 
  every page would save some processor cycles ;-)

templates/header.tpl:
- add   class="lang-XY"   (where XY is the language to the body tag.
  This allows language-specific CSS code: .lang-XY table {...}

This commit implements the feature request from J.Kruis (jan-kruis)
https://sourceforge.net/tracker/?func=detail&aid=2903088&group_id=191583&atid=937967



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@872 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Norman Messtorff 7229502738 Small typo fixed...
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@761 a1433add-5e2c-0410-b055-b7f2511e0802
15 years ago
Sebastian cf40467570 - accidentially deleted header.php. Needed for setup
- add some error checks.

git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@759 a1433add-5e2c-0410-b055-b7f2511e0802
15 years ago
Sebastian b1287d97e2 - big merge of Postfixadmin smarty into trunk
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@757 a1433add-5e2c-0410-b055-b7f2511e0802
15 years ago
Christian Boltz 562ab4dc14 setup.php:
- define('POSTFIXADMIN') to avoid session_start() call in common.php
  This avoids breakage if php5-session is not installed. Fixes
  https://sourceforge.net/tracker/?func=detail&aid=2855430&group_id=191583&atid=937964

common.php
- only define('POSTFIXADMIN') if it is not yet defined (avoids a warning)



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@733 a1433add-5e2c-0410-b055-b7f2511e0802
15 years ago
Christian Boltz acb3d4799d login.php, index.php:
- removed the $CONF['configured'] = 'I_know_the_risk_of_not_deleting_setup.php' 
  developer hack (no longer needed since setup.php requires a password)
- this also makes index.php redirecting to login.php again (the old check tested
  for file_exists(setup.php)...)

common.php:
- removed a superfluous check for $CONF[setup_password] (see mailinglist for details)

config.inc.php:
- removed a small outdated comment


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@640 a1433add-5e2c-0410-b055-b7f2511e0802
16 years ago
David Goodwin 1adebfbe03 common.php: remove redundant check
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@637 a1433add-5e2c-0410-b055-b7f2511e0802
16 years ago
David Goodwin 140864dee1 common.php: remove requirement to delete setup.php; require $CONF["setup_password"] is changed etc
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@618 a1433add-5e2c-0410-b055-b7f2511e0802
16 years ago
David Goodwin 51d418f16c fix register globals check in common.php - see https://sourceforge.net/tracker/?func=detail&aid=2721614&group_id=191583&atid=937964
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@611 a1433add-5e2c-0410-b055-b7f2511e0802
16 years ago
David Goodwin f9341abb8b common.php: add autoloading for model classes
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@577 a1433add-5e2c-0410-b055-b7f2511e0802
16 years ago
Christian Boltz 873631a277 common.php:
- common.php is indirectly included in setup.php (via upgrade.php),
  avoid endless redirect loop from setup.php to setup.php
  (just found some minutes ago, had blocker quality...)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@343 a1433add-5e2c-0410-b055-b7f2511e0802
17 years ago
David Goodwin b3dc4ba6af common.php: ensure we only start a session once
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@325 a1433add-5e2c-0410-b055-b7f2511e0802
17 years ago
Christian Boltz f12ac3a8c8 common.php:
- check if setup.php exists before blindly redirecting to it.
  Display error message if the user has already deleted it.
  (old behaviour caused some user confusion)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@288 a1433add-5e2c-0410-b055-b7f2511e0802
17 years ago
Christian Boltz f217f0c1bb Summary: Added language selector to login form
functions.inc.php:
- function check_language
  - new optional parameter $use_post (needed by login.php)
  - check for language cookie
  - check for $_POST['lang']
  - removed substr() call because it made pt-br translation unuseable
- new function language_selector
  - returns a HTML dropdown language selector
- new function safecookie
  - similar to safeget, but for cookies

templates/login.php, templates/users_login.php:
- display language selector dropdown

login.php, users/login.php:
- check for selected language
- set cookie if user selected non-default language

languages/language.php: (NEW FILE)
- list of supported languages
- language names taken from phpMyAdmin login form

common.php:
- include languages/language.php
 


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@280 a1433add-5e2c-0410-b055-b7f2511e0802
17 years ago
Christian Boltz 02195254d7 common.php
- define('POSTFIXADMIN', 1)

templates/*.php
- check if POSTFIXADMIN is defined to prevent direct access to the
  template files


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@256 a1433add-5e2c-0410-b055-b7f2511e0802
17 years ago
David Goodwin 6797912ca9 common.php: ensure register_globals are not enabled
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@242 a1433add-5e2c-0410-b055-b7f2511e0802
17 years ago
David Goodwin 1e5b40c348 common.php: caps change in headeR
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@142 a1433add-5e2c-0410-b055-b7f2511e0802
17 years ago
Christian Boltz ac6af2c99e - read config.inc.php earlier to make the check for
$CONF['configured'] == FALSE work


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@136 a1433add-5e2c-0410-b055-b7f2511e0802
17 years ago
David Goodwin 736a1a0b1f common.php: ensure $CONF["configured"] is not false
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@130 a1433add-5e2c-0410-b055-b7f2511e0802
17 years ago
David Goodwin dc51d62e15 update license headers
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@107 a1433add-5e2c-0410-b055-b7f2511e0802
17 years ago
David Goodwin 53df296722 common.php: magic quotes stuff
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@102 a1433add-5e2c-0410-b055-b7f2511e0802
17 years ago
David Goodwin 3e70f276c2 final set of refactoring patches (and the rest)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@71 a1433add-5e2c-0410-b055-b7f2511e0802
17 years ago