26 Commits

Author SHA1 Message Date
Peter Kokot
5cd2630a86 Add dependency injection container
This patch introduces a dependency injection container for the PHP bug
tracker application. Container deals with the creation of all service
classes and additionally provides retrieving of configuration parameters.
Service classes are used everywhere in the app - from accessing database
to uploading files. Configuration parameters include infrastructure
configuration (database credentials...) and application level
configuration (directories locations...).

Container is compatible with the PSR-11 container interface defined
so it is simple to quickly understand its usage. Advanced features
such as autowiring are not included in this phase.
2019-01-28 00:47:18 +01:00
Peter Kokot
e3c4b0ace3 Replace deprecated Text_Diff PEAR package with Horde Text_Diff
This patch replaces obsolete Text_Diff PEAR package with newer and still
maintained Horde Text_Diff version 2.2.0 as suggested in the packages
descriptions.

Since bugs.php.net production is not ready for Composer installations yet,
the Text_Diff package is bundled in the Git repository directly. Its
classes are not compliant with PSR-4 yet so the classmap has been used
until future PSR-4 migration and refactorings.
2019-01-23 22:23:09 +01:00
Peter Kokot
068d8514af Add template engine
This patch adds an initial simplistic template engine to separate logic
from the presentation.

Basic initial features:
- escaping via Context::noHtml() and Context::e() methods
- blocks
- nesting options using includes and extending layouts
- PHP syntax
- variable scopes dedicated to template scope only
- Appending blocks (when JS files are in need to be appended)
- initial unit and functional tests
- Main index page refactored as an example of usage
- Very short intro docs how to use the template layer
- Thanks to @nhlm for the code review and numerous suggestions to
  improve the usability and code stability,
- Thanks to @KalleZ and for the code review and numerous common sense
  suggestions about templates themselves.
- Thanks to @Maikuolan for the code review and numerous suggestions
  about the usability.
- Moved hash ids redirection to aseparate JavaScript file
- Use location instead of window.location in the JavaScript redirection

Discussions:
- http://news.php.net/php.webmaster/27603
- https://github.com/php/web-bugs/pull/66
2019-01-02 22:20:11 +01:00
Peter Kokot
14f8c07aec Refactor PDO wrapper
Some considerations were raised on the mailing list that this PHP
application doesn't need a PDO wrapper at all.

Changes:
- ::fetchRow() method removed in favor of the vanilla PDOStatement::fetch()
- ::fetchAll() override removed in favor of the vanilla
  PDOStatement::fetchAll()
- ::fetchCol() removed since it is not used and is only a wrapper for
  the PDOStatement::fetchColumn()
- PDO fetch_style synced accross the app. When no fetch style is passed
  the default PDO::FETCH_ASSOC is used as set when connecting to db.
- Remove Database::escape() method
  The custom ::escape() method is a wrapper around PDO::quote() which
  additionally trims leading and trailing quotes from the string. All
  this should ideally be done via prepared statements only, except where
  we can and need to use PDO::quote() this step can be done on the given
  string or variable at hand directly.
- Remove escapeSQL() function
  The escapeSQL function is a wrapper around the PDO::quote() and is
  using $dbh from the global scope which is not testable nor good practice
  further on. Removed and refactored into only PDO::quote() usages on
  required places.
- Remove ::fetchOne() method
  The fetchOne() method is a simple wrapper around the PDOStatement::fetch()
  method with very minor tweaks so the usage can be simplified even more.
  The PDOStatement::fetch(\PDO::FETCH_NUM)[0] will always return either a
  result from the database column or when row is empty a null.
- Probably this should be refactored to the database tables respected
  repositories further on.
- Remove PDO wrapper
  The app's current goal is to lean on a vanilla PDO wrapper only.
  Current set of features also don't require additional functionality
  and extending PDO to a wrapper or create a database abstraction layer
  yet.
2018-12-17 22:46:55 +01:00
Peter Kokot
73062503a6 Refactor database classes 2018-12-05 18:00:22 +01:00
Peter Kokot
3f34375526 Fix typo 2018-12-05 17:50:05 +01:00
Peter Kokot
d337e731ff Add dual PSR-4 compatible classes autoloader
This patch is a workaround until Composer installation step can be used
in production bugs.php.net. Once Composer can be added to the deployment
step together with rsync this can be simplified and only Composer's
autoload.php will be used.
2018-12-05 15:40:19 +01:00
Peter Kokot
b4891d7bef Enable displaying errors for local development environments 2018-12-05 13:38:52 +01:00
Niklas Keller
83d6860af9 Add Composer
This patch adds initial Composer files and prepares the project for
using Composer in development environment.

Patch has been initially started via pull request at
https://github.com/php/web-bugs/pull/27
2018-12-03 01:02:16 +01:00
Peter Kokot
a06f85b0c3 Refactor long array() syntax to short []
Since site is using PHP 5.4+ already, the longer `array()` syntax can be
refactored to shorter `[]`. Also code is already using short array
syntax on some places.
2018-10-24 20:27:59 +02:00
Peter Kokot
8249fa5334 Remove unused configuration db_extension
The `db_extension` was once used with PEAR's MDB2. With migration to
vanilla PDO, this is not used anymore.
2018-10-24 18:28:17 +02:00
Peter Kokot
21e0f760f1 Change dirname(__FILE__) to shorter __DIR__ 2018-10-23 17:02:10 +02:00
Rasmus Lerdorf
23298a1236 New bugs.php.net code 2018-07-17 19:53:03 -04:00
Sobak
f7cc97c200 PHP 5.4 is minimal required version 2014-05-18 19:24:16 +02:00
Rasmus Lerdorf
c3110c33dc - The end of an era - switch "Bogus" to "Not a bug" by popular demand
- Switch back to master
- Add site_method to make it easier to install on non-ssl test sites
2012-01-27 11:48:04 -08:00
Felipe Pena
1258b9d566 - Trying to fix the mail sending yet.. 2011-03-25 01:25:13 +00:00
Felipe Pena
5bec6592a6 - Added "Security" bug type to control Security bug instead of a package name 2010-11-19 14:35:57 +00:00
Derick Rethans
d625bbf489 - Commit this local change. 2010-05-02 22:11:33 +00:00
Daniel Egeberg
df6ee6d3c0 Fixed PHP bug #51586 (Wrong mailing list for "Documentation Problem" type bugs) 2010-04-18 09:48:01 +00:00
Jani Taskinen
7b7c024d46 - Enable compression 2010-03-16 13:02:53 +00:00
Philip Olson
945beb386b Handle PEAR errors, in a moderately graceful manner 2010-03-10 02:50:15 +00:00
Jani Taskinen
911112b798 - Moved default patch dir to somewhere where they might be stored over reboots too. 2010-03-05 19:18:43 +00:00
Jani Taskinen
8452f1d08c - Get rid of local_config for the "main" site 2010-03-03 17:41:30 +00:00
Jani Taskinen
495c85699f - Allow using different db ext 2010-02-22 12:52:37 +00:00
Jani Taskinen
bab479126c - More totally unnecessary whitespace changes. 2009-08-25 15:44:45 +00:00
Jani Taskinen
0ce116070e - No .inc, always use .php 2009-08-25 12:07:11 +00:00