1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-06 14:35:56 +02:00

136 Commits

Author SHA1 Message Date
Oleg Pudeyev
5c3ebb3465 [feature/template-engine] Deleted silencing of notices.
The code is now supposed to be notice-free, therefore there is no need
to have the notices silenced.

PHPBB3-9726
2011-04-24 21:22:43 -04:00
Oleg Pudeyev
a2c75f6053 [feature/template-engine] Deleted $template from phpbb_template_compile class.
phpbb_template_compile is now much simpler. It takes complete file paths
as inputs, either source template path or source template path and output
compiled template path. The number of methods also went down to two -
compile template and returned compiled text or compile and write to file.

phpbb_compile class is responsible for determining source and compiled
paths. It already had all the data necessary for this, now the code is
in the same place as the data it uses.

PHPBB3-9726
2011-04-24 21:18:18 -04:00
Igor Wiedler
81962d1d8f [ticket/9924] Pass template instance into $template->display hook
This is a cherry-pick of 053cf790a93e9cfb521f484901d79c72783f868f
which appears to have been partially reverted here.

PHPBB3-9924
2011-04-24 11:23:46 -04:00
Oleg Pudeyev
c8db531fcb [feature/template-engine] Removed a useless space.
PHPBB3-9726
2011-04-24 01:59:40 -04:00
Oleg Pudeyev
321ecf4273 [feature/template-engine] Delete class_exists checks, rely on autoloading.
PHPBB3-9726
2011-04-24 01:18:58 -04:00
Oleg Pudeyev
203187a841 [feature/template-engine] Fix recompilation logic.
Do not change $recompile from true to false - any recompilation
condition alone is sufficient to force recompilation.

Also uncomment the nonexistent file test which passes with this fix.

PHPBB3-9726
2011-04-24 01:08:48 -04:00
Oleg Pudeyev
4f3e966fdc [feature/template-engine] Delete ?>, add newline at EOF.
PHPBB3-9726
2011-04-23 22:49:08 -04:00
Marek A. Ruszczynski
2d11e1c095 [feature/template-engine] Improved template engine.
PHPBB3-9726
2011-04-23 22:49:02 -04:00
Nils Adermann
8b9b1f1187 Merge branch 'develop-olympus' into develop
* develop-olympus:
  [ticket/9924] Pass template instance into $template->display hook
2010-12-13 17:22:05 +01:00
Igor Wiedler
053cf790a9 [ticket/9924] Pass template instance into $template->display hook
PHPBB3-9924
2010-11-23 16:09:09 +01:00
Igor Wiedler
af5b9a9640 [ticket/9556] Drop php closing tags, add trailing newline
Closing tags converted using Oleg's script.
remove-php-end-tags.py -a .

Trailing newlines added using the following where $ext is file extension.
find . -type f -name "*.$ext" -print | xargs printf "e %s\nw\n" | ed -s;

Extensions: php, css, html, js, xml.

PHPBB3-9556
2010-11-11 19:10:55 +01:00
Nils Adermann
6e31ce8573 Do not store email templates in database. [Bug #54505]
To explain what this is about, first a short phpBB code history lesson: ;-)

r9823 originally introduced the usage of our template class for emails. The
messenger class uses set_custom_template() to initialise the template object
which neither disables storedb nor inheritance. These two values are set in
$user->theme rather than inside a particular template instance (quite a design
failure if I may add). Thus the html page that is displayed to the user also
determines these settings for the email templates. This obviously causes
problems because both emails and other custom templates can quite simply not
be stored in the database because the db table only stores the filename, not
the path and requires a template id.

r9839 then generally disabled storedb and template inheritance for custom
templates to fix Bug #40515. This works for custom templates, but not for
emails where lots of template objects are created. In such a situation the
last call to set(_custom)_template() would now determine the values of storedb
and inheritance in _tpl_load. So any page sending emails would neither load
its template from the database nor use template inheritance. The same revision
also introduced orig_tpl_* variables in set_template() which on their own are
very much pointless, but could allow resetting the storedb and inheritance
values if they were used to reset $user->theme just before template execution
in _tpl_load.

In r10150 these orig_tpl_* variables are correctly used to access information
about the template of the page being displayed - contrary to the last template
used - from within the bbcode, fixing Bug #51285. However r10150 also introduces
a pointless $template_mode parameter for set_custom_template(). $template_mode
is really just a boolean flag (value you can be 'template' or an arbitrary other
value) that if it set circumvents the unsetting of storedb and template
inheritance. The very code that had been added to prevent issues with emails and
custom templates. Fixing the problem introduced by r8839 but at the same time
reintroducing the much greater problem from the original implementation of email
templates.

And now an explanation of what I did:

Based on this I have now changed the set_custom_template method to always
disable storedb. It can now properly use inheritance, you simply tell it the
path where the parent template can be found, by default the path is false which
will turn inheritance off. To make this work the template class now always
overwrites $user->theme storedb and inheritance variabbles with orig_tpl_* just
before rendering a template in _tpl_load. This way they are guaranteed to always
contain the value they had at the time set_template/set_custom_template were
called. This fixes [Bug #54505].

In summary, using global state is simply a horrible idea in object oriented
programming. Always Pass values, that an object depends on, as parameters - never
through magic global variables. Following this principle will safe you from a lot
of headaches.

Please test this patch as much as possible to make sure templates still work
properly for you, focus on multiple languages, missing language files, and
custom templates in systems that make use of the template class outside of
phpBB itself.


git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10460 89ea8834-ac86-4346-8a33-228a782c2dd0
2010-01-26 16:52:46 +00:00
Meik Sievertsen
9ccd209930 fix bug #52605 - regression from r9811
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10217 89ea8834-ac86-4346-8a33-228a782c2dd0
2009-10-09 11:12:37 +00:00
Meik Sievertsen
d5fe2e7db7 bugfix for non-existent handles and theme data (we really need to clean this up, template_files feels quite furry)
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10213 89ea8834-ac86-4346-8a33-228a782c2dd0
2009-10-05 16:22:21 +00:00
Joas Schilling
697fd5a134 Fix #51285 and more issues with template inherence on set_custom_template
Conflict introduced with r9839 and r9823

Authorised by: AcydBurn

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10150 89ea8834-ac86-4346-8a33-228a782c2dd0
2009-09-16 08:11:52 +00:00
Meik Sievertsen
edc5061f1d Check for valid $template_path in includes/template.php - Bug #50055
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10036 89ea8834-ac86-4346-8a33-228a782c2dd0
2009-08-20 14:53:25 +00:00
Chris Smith
b902fc20ae Small change to r9839
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9847 89ea8834-ac86-4346-8a33-228a782c2dd0
2009-07-25 10:16:13 +00:00
Joas Schilling
89332c00b7 Fix Bug #40515 - Fix set_custom_template for database-stored styles
Authorised by: AcydBurn



git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9839 89ea8834-ac86-4346-8a33-228a782c2dd0
2009-07-24 08:47:10 +00:00
Meik Sievertsen
b613781d3a Preserve newlines in template files (one newline had been always dropped after a template variable due to PHP's handling of closing tags)
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9811 89ea8834-ac86-4346-8a33-228a782c2dd0
2009-07-21 10:58:31 +00:00
Joas Schilling
7d605da65b Fix bug #45805 - INCLUDEPHP not depending on phpbb_root_path
Authorised by: acydburn

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9633 89ea8834-ac86-4346-8a33-228a782c2dd0
2009-06-19 22:07:27 +00:00
Meik Sievertsen
2bf9ea373b Fix problems with styles using an underscore within the filename. (Bug #34315)
- Also display inheriting template on style installation (previously, it was only displayed on template installs)
- Fixes undefined variable in error message if inheriting style does not work
- Fixes export of styles/templates and correctly set inherit_from variable

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8943 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-26 13:09:56 +00:00
Henry Sudhof
eda1d40861 Okay. Frozen, we never said anything about it being permafrost. Also, this is not 100% tested, expect troubel with store_db (I'm waiting for the bug reports)
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8697 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-28 14:24:37 +00:00
Meik Sievertsen
07f6a6b5f3 - fixed database updater
- fixed hook function call in database updater
- fixed bot agent detection (we used a wildcard within the w3c-agent, therefore we should really support this. ;))


git-svn-id: file:///svn/phpbb/trunk@8131 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-10-04 12:03:05 +00:00
Meik Sievertsen
8d2bfa5c10 ok... i seem to have overlooked the handy __CLASS__ constant. ;)
git-svn-id: file:///svn/phpbb/trunk@8106 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-09-23 14:14:49 +00:00
Meik Sievertsen
91f5af494b PHP4 compatibility
git-svn-id: file:///svn/phpbb/trunk@8104 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-09-23 13:14:28 +00:00
Meik Sievertsen
7f65bc98ad new hook system (do not get it confused with events or plugins please)
- introducing two new hookable functions too


git-svn-id: file:///svn/phpbb/trunk@8100 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-09-22 19:18:13 +00:00
Meik Sievertsen
8257d1c828 ok, the nasty one then... :/
git-svn-id: file:///svn/phpbb/trunk@8044 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-08-17 21:29:20 +00:00
David M
ec4eabe4ce #12675
git-svn-id: file:///svn/phpbb/trunk@7853 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-07-09 18:27:57 +00:00
Meik Sievertsen
5aa220bcd2 tweak the sql_like_expression feature a little bit to allow correct escaping
git-svn-id: file:///svn/phpbb/trunk@7789 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-06-24 12:49:13 +00:00
Meik Sievertsen
318418b0f2 new wrapper for LIKE expressions to streamline the fixes. We actually need to adjust them for different DBMS as well as SQLite2 not supporting escaping characters in LIKE statements (which is a reason why we think about dropping sqlite support completely).
git-svn-id: file:///svn/phpbb/trunk@7788 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-06-23 12:16:20 +00:00
Meik Sievertsen
ba536c6270 some fixes
git-svn-id: file:///svn/phpbb/trunk@7286 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-04-06 14:03:20 +00:00
Meik Sievertsen
576bb754e9 fixing some bugs, most being submitted grammatical/spelling errors.
git-svn-id: file:///svn/phpbb/trunk@6915 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-01-21 18:33:45 +00:00
David M
69ef685cde #6642
git-svn-id: file:///svn/phpbb/trunk@6817 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-12-28 14:27:19 +00:00
David M
0d502f3b07 - quite a few optimizations to the template engine. bitwise arithmatic is used to check odd/even, usage of ref to the root template variables should reduce the number of hash lookups needed, usage of refs within loops should reduce the amount of hash lookups, incrementing vars were turned from class variables to regular variables, cache now uses preincrementing variables instead of postincrementing variables, some regex were optimized/trimmed
- a bug fix somewhere in there...


git-svn-id: file:///svn/phpbb/trunk@6796 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-12-23 18:27:15 +00:00
Meik Sievertsen
d9387842ac adjust some comments to work with phpdocumentor. :)
git-svn-id: file:///svn/phpbb/trunk@6595 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-11-17 19:37:57 +00:00
Meik Sievertsen
22129be21f - now username changes should work as desired
- removed some extract() calls


git-svn-id: file:///svn/phpbb/trunk@6517 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-10-22 13:32:33 +00:00
Meik Sievertsen
e1beb68ae1 fix bug #4454
git-svn-id: file:///svn/phpbb/trunk@6405 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-09-24 15:07:08 +00:00
Meik Sievertsen
79137c312c - Fix some bugs
- fixed retrieving of permissions if the LIKE statement is used as well as proper supporting (needs testing on mssql)


git-svn-id: file:///svn/phpbb/trunk@6366 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-09-14 14:57:29 +00:00
Meik Sievertsen
1d42d1b981 some updates. Also adjusted the utf tools and normalizer more to our coding guidelines.
git-svn-id: file:///svn/phpbb/trunk@6312 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-08-22 21:26:06 +00:00
Meik Sievertsen
ced8624b8e - fixing some bugs
- shortening some db columns to meet the requirements
- correctly increase/decrease user post counts
- fix the topic title length bug(s)


git-svn-id: file:///svn/phpbb/trunk@6224 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-08-01 15:29:47 +00:00
Meik Sievertsen
8dbef23cea show error if template path could not be determined
git-svn-id: file:///svn/phpbb/trunk@6112 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-06-21 16:52:10 +00:00
Meik Sievertsen
1aac08acc0 make sure custom profile fields are created correctly on registration (#2225)
git-svn-id: file:///svn/phpbb/trunk@6058 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-06-13 21:06:29 +00:00
Meik Sievertsen
01b4145381 - fixed a few bugs
- added user_add() function
- check posted images ([img]) for same domain/scipt and php files
- auth_api.html updated to the coding guidelines look&feel
- introduced ability to force non page-updates (cron is using it)
- correctly resend coppa email


git-svn-id: file:///svn/phpbb/trunk@6048 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-06-11 18:13:52 +00:00
Meik Sievertsen
0e7adebad6 ok, sorry for this. :/
- cleaned up table names/constants


git-svn-id: file:///svn/phpbb/trunk@6021 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-06-07 19:32:23 +00:00
Meik Sievertsen
9fca29eae3 some tiny changes...
git-svn-id: file:///svn/phpbb/trunk@5967 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-05-26 15:04:27 +00:00
Meik Sievertsen
fec41273a4 first round of custom profile changes
git-svn-id: file:///svn/phpbb/trunk@5965 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-05-25 19:15:04 +00:00
Meik Sievertsen
a8d99f2228 - introduce new function build_url to easily build a valid url from the user->page object as well as optionally removing certain keys
- changed attachment config to utilize the config build methods
- cleaned up posting.php
- the submit/delete_post functions are now usable (functions_posting.php)
- adjusted header icons (transparency)
- a bunch of fixes for mssql
- bug fixes


git-svn-id: file:///svn/phpbb/trunk@5902 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-05-12 20:52:58 +00:00
Nils Adermann
f83b7e1581 - added the template editor (doesn't use a hardcoded list of template filenames for categorisation anymore)
- fix some bugs related to storing template files in the database
- allow templates stored in subfolders of the /styles/name/template/ folder


git-svn-id: file:///svn/phpbb/trunk@5894 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-05-07 21:44:23 +00:00
Meik Sievertsen
076a235bb0 introduce LA_ for addslashing language variables for use in js vars (idea by naderman)
git-svn-id: file:///svn/phpbb/trunk@5865 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-04-29 17:19:24 +00:00
Meik Sievertsen
a0f8e1323a - clean up marklist calls (global function)
- added new feature: test out others permissions (admin permissions will not be copied)
- changed attachment processing by directly using the template engine
- fixed some attachment related bugs
- additional tiny fixes


git-svn-id: file:///svn/phpbb/trunk@5790 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-04-17 13:09:50 +00:00