Commit Graph

198 Commits

Author SHA1 Message Date
Andreas Gohr 0ecde6ce23 central logging mechanism
This introduces a logger mechanism and a new data/log directory. This is
a first proof of concept. It's built on top of the new global error
handling mechanism

Things to discuss:

* should we adopt PSR-3 somehow? if yes, how and should plugins be able
  to drop-in other psr3 loggers?
* how to configure which facilities shall be logged?
* should we implement a log deletion feature?
* is the log format sensible?
* should we implement a log viewer admin plugin?
* should logging trigger events (it should maybe replace the
  deprecation event)
2020-08-13 13:28:40 +02:00
Andreas Gohr 642e976cb6 introduce a global error handler
This transfers old style PHP errors into Exceptions and installs a
global exception handler. All exceptions caught by this handler are
logged to an error log and a meassage is shown to the end user. This
should finally get rid of "blank page" bug reports.
2020-08-12 17:42:26 +02:00
movatica 9fdcc8fcd8 Respect fmode config setting
Fix hardcoded fmode overriding user config, which breaks with nondefault environments.
2020-02-18 21:46:31 +01:00
movatica 3aa7587497 Fixed inconsistent handling of falsy values on fperm setting
The $conf['fperm'] value was checked in multiple files using different methods.
This can cause permission trouble with restricted environments, i.e. when chmod is forbidden and file permissions are non-default.
Now, all checks use implicit cast to boolean which leads to consistent behaviour.

Also, a misleading variable was renamed in context to better understand one of the checks.
2020-02-18 19:29:53 +01:00
Syntaxseed 2401f18d30 Fix curly brace syntax. PHP 7.3 deprecations in inc/ directory. 2019-10-31 13:24:50 +01:00
Andreas Gohr 1935a89170 Move list of plugin types to plugin controller constant
There is no need to have them in a global variable.
2019-04-21 19:31:27 +02:00
Andreas Gohr 3a7140a158 moved plugin controller to Extension namespace 2019-04-20 21:55:27 +02:00
Andreas Gohr cbb44eabe0 deprecated trigger_event() in favor of a static method on Event 2019-04-20 21:48:53 +02:00
Andreas Gohr e1d9dcc8b4 First go at moving the plugin classes into their own namespace 2019-04-20 21:33:23 +02:00
Andreas Gohr abc9c0d217 Merge branch 'master' into psr2
* master: (22 commits)
  Support "local" subdir when listing the smiley directory
  fix zero ID/NS issue with page_findnearest
  add ID/NS = '0' test against page_findnearest
  fix zero value issue with metadata indexer
  add key/value = '0' test to metadata indexer
  fix zero ID issue with linkwiz and search indexer
  fix zero ID issue with wl() and getID()
  add $ID = '0' test against wl() and getID()
  cookie.js when setValue‘s value parameter is false delete entry
  install.php: respect useacl=0 choice, fixes #2576
  cookie.js add def parameter to getValue()
  cookie.js convert value type to string
  set_doku_pref bugfix, closes #2721
  more definition tests of doku_pref, for #1129
  add tests for get/set_doku_pref #2721
  fix Windows tests for #2702
  use absolute URL in index.php when redirecting to doku.php, fixes #2706
  Adding "recursive_groups" setting for authad-plugin in configuration-manager
  Fix notices when using dw CLI
  Fix issue #2396
  ...
2019-03-30 22:08:54 +01:00
Michael Große fb97a12a23
Fix notices when using dw CLI
On the commandline several global variables might not be set. Accessing
them might generate an E_NOTICE.
2019-02-28 21:40:45 +01:00
Andreas Gohr ccc4c71ca8 adjusted the Input clases for PSR2
They are now in their own namespace.
2019-02-19 20:39:13 +01:00
Michael Große 923e149a1f
Merge branch 'master' into psr2 2019-02-15 01:05:01 +01:00
Michael Große c163dbef86
💡 Better deprecation annotation for DOKU_TPL*
This syntax can be used by IDEA and other IDEs to mark the constants as
deprecated in the editor.
2018-10-08 16:02:44 +02:00
Andreas Gohr 9ddafced33 Merge branch 'master' into psr2
* master:
  🐛 (Draft) Fix exception when actually viewing a draft of a page
  💡(Draft): Add doc block for constructor
   Add unittest for deleteUsers remote API call
  fix remote API call dokuwiki.deleteUsers
  translation update
  🏗 Use json for the response to dw_locktimer
  (dw_locktimer) plugins may reuse to add fields and callbacks
  💄 (editor) draft status is semantically not part of the toolbar
  🏗 Create new Draft class and move draft handling there
  translation update
  correctly avoid notice in init.
  avoid creating expensive stacktrace in dbg_deprecated()
  add method to EventHandler to check if an event is actually handled
  introduce INFO_DEPRECATION_LOG event
2018-06-15 10:34:40 +02:00
Andreas Gohr 724970e65d correctly avoid notice in init. 2018-06-02 09:19:30 +02:00
Andreas Gohr 64159a61e9 line lengths shortened
This makes sure all files use line lenghts shorter than 120 characters.

This is a quick fix. It might not always be the nicest change.
2018-04-27 19:07:43 +02:00
Andreas Gohr b4f2363aa1 remove DOKU_INC checks
There is no need for this check, since these files should not have any
main code that is executed on direct call.

Fixes PSR1.Files.SideEffects.FoundWithSymbols
2018-04-27 14:32:42 +02:00
Andreas Gohr 3862da0e1f throw exception in nice_die during tests
Exits during testing will break the whole test suite. It makes more
sense to throw an exception in that case. The exception's stack trace
will help to debug the actual problem
2017-09-02 16:23:14 +02:00
Andreas Gohr a69722b37d always send Vary: Cookie header. fixes #1594 2017-08-27 12:36:09 +02:00
Andreas Gohr 267143863b moved function and fixed whitespace errors 2017-08-27 12:33:12 +02:00
Yurii K 1d7c1f1bfd response on review 2017-07-28 20:20:24 +03:00
Yurii K 7b0d379feb cleaning 2017-07-23 17:03:49 +03:00
Yurii K 30085ef376 fix tests on windows 2017-07-23 16:13:12 +03:00
Andreas Gohr 75ce4e03a1 remove magic quote handling 2017-03-31 09:54:07 +02:00
Takamura f50a239b3b I supplemented the existing comments on the methods in which there was not enough information to the standard phpDoc. 2017-03-31 09:33:33 +02:00
Andreas Gohr 924e477e18 adjust session ID check to specification
The documentation says sessionIDs are between 22 and 256 chars long. A
quick test only showed 26 chars in common configurations, but this
should cover all possibilities.
2017-03-01 10:26:04 +01:00
Andreas Gohr 6eb3cdf688 do not use invalid session IDs #1883
When an invalid session ID is passed to PHP a warning is thrown, but the
session is still initialized with this invalid ID (throwing additional
warnings on save).

This makes sure such invalid IDs are removed from the cookie array
before initializing the session.

PHP bug references:

https://bugs.php.net/bug.php?id=68063
https://bugs.php.net/bug.php?id=73860
2017-03-01 10:26:04 +01:00
Andreas Gohr 472b5ca14d removed commented out code 2017-02-03 11:00:35 +01:00
Anders Sandblad 59752844d1 Fixed broken links to php.net and redirecting pages to php.net 2016-06-14 08:48:12 +02:00
Andreas Gohr 13c3790029 streamline zlib checking #1410
Instead of having various function_exists checks all over the place,
this introduces the constants DOKU_HAS_GZIP and DOKU_HAS_BZIP. All
non-3rdparty parts of the code using gz* functions should now check if
zlib is actually available.
2015-11-27 09:29:01 +01:00
Andreas Gohr 605f8e8d0e added composer setup and the first composer package php-archive 2015-05-15 15:42:12 +02:00
Elan Ruusamäe 0a4266d4ab consistency: failure exit with status code 1 2015-02-10 14:48:08 +02:00
Andreas Gohr 79e7937762 Remove error supression for file_exists()
In an older version of PHP a file_exists() call would issue a warning
when the file did not exist. This was fixed in later PHP releases. Since
we require PHP 5.3 now, there's no need to supress any error here
anymore. This might even give a minor performance boost.
2015-01-07 10:47:45 +01:00
Gerry Weißbach 8da2ebf4f4 Merge remote-tracking branch 'splitbrain/master' 2014-12-22 10:31:30 +01:00
Danny Lin 0f8f7aaa42 Move check after libraries are loaded, so that $conf['compression'] is not turned off in the case that gzopen doesn't exist while gzopen64 does exist, as inc/compatibility.php ought to have fixed. 2014-10-31 18:44:26 +08:00
Gerrit Uitslag b79379f2e5 Merge remote-tracking branch 'origin/master' into overridablelangstrings
Conflicts:
	inc/plugin.php
2014-09-28 13:46:04 +02:00
Gerrit Uitslag dd7a6159c4 use config cascade for loading of localizations 2014-09-28 13:27:05 +02:00
Gerry Weißbach 0bd5b90b4c Merge remote-tracking branch 'splitbrain/master' 2014-07-16 08:02:34 +02:00
Enrico Tagliavini 19738e6513 adding X-Forwarded-Proto support in is_ssl()
This commit adds support for X-Forwarded-Proto in case dokuwiki runs
behind a reverse (SSL) proxy, but the connection between the proxy and
the web server running dokuwki is plain HTTP. If an authenticated
user is accidentaly dropped to HTTP from HTTPS the securecookie setting
should be honored and the redirection when saving or canceling a page
edit should point to the correct protocol. This happens every time a
user hits cancel after editing a page, and likely even after saving. If
the webserver doesn't enforce HTTPS the coockie might be sent in clear.
2014-07-12 23:26:45 +02:00
Gerry Weißbach 1858e4d768 Check for basedir and baseurl
If these configuration values are not set php will throw an unnecessary
NOTICE.
2014-06-30 09:13:10 +02:00
Gerrit Uitslag 38fb1fc7a9 extend lang file cascade, so users can override some lang strings
Fixes #692
2014-05-13 21:57:50 +02:00
Christopher Smith 585bf44e2b amend $_SERVER to $INPUT->server 2014-03-06 19:55:56 +00:00
Christopher Smith f87b5dbbba use isset() + ?: or error suppression where value may not be set 2014-03-05 22:04:14 +00:00
Christopher Smith 0e80bb5e34 use empty() where array values might not be set 2014-03-05 21:58:46 +00:00
Gerrit Uitslag 55a71a16cb removed pre PHP 5.2 code wrt setcookie and session setting
- moved cookiedir determination in the if-statement
2014-03-04 21:14:24 +01:00
Gerrit Uitslag c09f0eb1d9 define overridable constants for session properties FS#1913 2014-02-28 17:13:42 +01:00
Gerrit Uitslag 8d443db51f remove 'fix dateformat config for upgraders' FS#2073 2014-02-20 17:19:45 +01:00
Andreas Gohr d9529222b0 Merge pull request #380 from splitbrain/phpstrict
Php strict
2013-10-20 11:30:51 -07:00
Christopher Smith 443e135d59 replace boolean conditional checks on possibly uninitialized vars with \!empty/empty/isset as appropriate 2013-10-16 22:04:01 +01:00