aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/template.php
Commit message (Collapse)AuthorAgeFilesLines
* [feature/template-engine] Move template.php to includes/templateIgor Wiedler2011-07-101-549/+0
| | | | | | This allows making use of autoloading. PHPBB3-9726
* [feature/template-engine] Fixed absolute path PHP includes, added test.Oleg Pudeyev2011-05-191-1/+8
| | | | PHPBB3-9726
* [feature/template-engine] Delete @version everywhere.Oleg Pudeyev2011-05-141-1/+0
| | | | | | This is not used since the switch to git. PHPBB3-9726
* [feature/template-engine] Delete @access everywhere.Oleg Pudeyev2011-05-141-17/+0
| | | | | | Access specification in php 5 is done directly on functions/properties. PHPBB3-9726
* [feature/template-engine] Make INCLUDEPHP relative to board root.Oleg Pudeyev2011-05-121-3/+3
| | | | PHPBB3-9726
* [feature/template-engine] Replaced globals with dependency injection.Oleg Pudeyev2011-05-121-35/+58
| | | | PHPBB3-9726
* [feature/template-engine] Clarify cache directory path for set_custom_templateOleg Pudeyev2011-05-121-1/+4
| | | | | | | Even if the template may be outside of phpBB, phpBB's cache directory is still going to be used for storing compiled template code. PHPBB3-9726
* [feature/template-engine] Try to handle failed template includes.Oleg Pudeyev2011-05-121-2/+3
| | | | PHPBB3-9726
* [feature/template-engine] Rename $filename to $compiled_path for clarity.Oleg Pudeyev2011-05-121-6/+6
| | | | PHPBB3-9726
* [feature/template-engine] Move DEBUG_EXTRA check for $recompile up.Oleg Pudeyev2011-05-121-14/+10
| | | | PHPBB3-9726
* [feature/template-engine] Deleted useless assignment.Oleg Pudeyev2011-05-121-1/+0
| | | | PHPBB3-9726
* [feature/template-engine] Disposed of underscores in property names.Oleg Pudeyev2011-05-121-10/+10
| | | | PHPBB3-9726
* [feature/template-engine] Remove commented out error reporting logic.Oleg Pudeyev2011-05-121-10/+0
| | | | PHPBB3-9726
* [feature/template-engine] Refactor hook logic into a separate function.Oleg Pudeyev2011-05-121-7/+24
| | | | PHPBB3-9726
* [feature/template-engine] Reinstate phpbb_template#destroy function.Oleg Pudeyev2011-05-121-0/+9
| | | | PHPBB3-9726
* [feature/template-engine] Renamed template executor and friends to renderer.Oleg Pudeyev2011-05-081-17/+17
| | | | PHPBB3-9726
* [feature/template-engine] Removed more dead code.Oleg Pudeyev2011-05-071-6/+0
| | | | PHPBB3-9726
* [feature/template-engine] Added phpbb_template_context class.Oleg Pudeyev2011-05-071-240/+41
| | | | | | Objects of this class hold variables assigned to templates. PHPBB3-9726
* [feature/template-engine] Always call ob_end_clean.Oleg Pudeyev2011-05-051-1/+1
| | | | | | We have to stop output buffering even when rendering fails. PHPBB3-9726
* [feature/template-engine] Split template execution logic into classes.Oleg Pudeyev2011-05-041-63/+44
| | | | | | | | | | | Template executor interface defines a template executor object. It is an object which can execute (i.e. display/render) a template. Currently there are two implementations: * phpbb_template_executor_include includes php code from a file. * phpbb_template_executor_eval eval's php code. PHPBB3-9726
* [feature/template-engine] Removed storedb-related logic.Oleg Pudeyev2011-05-041-124/+2
| | | | | | | | | phpBB 3.1 will not provide the option to store templates in the database. This commit removes code that handles templates stored in database from the template engine. PHPBB3-9726
* [feature/template-engine] Delete template class, use phpbb_template instead.Oleg Pudeyev2011-05-041-9/+0
| | | | PHPBB3-9726
* [feature/template-engine] Rename template_compile methods for clarity.Oleg Pudeyev2011-05-041-9/+9
| | | | PHPBB3-9726
* [feature/template-engine] Fixed description of assign_display().Oleg Pudeyev2011-05-011-1/+1
| | | | | | | This function returns false on failure, which can happen if display() failed. Document the failure return value. PHPBB3-9726
* [feature/template-engine] Check return value of display() in assign_display().Oleg Pudeyev2011-05-011-1/+5
| | | | | | If display() failed, propagate the failure out of assign_display(). PHPBB3-9726
* [feature/template-engine] Removed $this from new phpbb_template_compile calls.Oleg Pudeyev2011-04-261-3/+3
| | | | | | The compile class no longer takes template as a parameter. PHPBB3-9726
* [feature/template-engine] Deleted silencing of notices.Oleg Pudeyev2011-04-241-0/+2
| | | | | | | The code is now supposed to be notice-free, therefore there is no need to have the notices silenced. PHPBB3-9726
* [feature/template-engine] Deleted $template from phpbb_template_compile class.Oleg Pudeyev2011-04-241-18/+49
| | | | | | | | | | | | | 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
* [ticket/9924] Pass template instance into $template->display hookIgor Wiedler2011-04-241-1/+1
| | | | | | | This is a cherry-pick of 053cf790a93e9cfb521f484901d79c72783f868f which appears to have been partially reverted here. PHPBB3-9924
* [feature/template-engine] Removed a useless space.Oleg Pudeyev2011-04-241-1/+1
| | | | PHPBB3-9726
* [feature/template-engine] Delete class_exists checks, rely on autoloading.Oleg Pudeyev2011-04-241-10/+0
| | | | PHPBB3-9726
* [feature/template-engine] Fix recompilation logic.Oleg Pudeyev2011-04-241-10/+13
| | | | | | | | | 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
* [feature/template-engine] Delete ?>, add newline at EOF.Oleg Pudeyev2011-04-231-1/+1
| | | | PHPBB3-9726
* [feature/template-engine] Improved template engine.Marek A. Ruszczynski2011-04-231-65/+222
| | | | PHPBB3-9726
* Merge branch 'develop-olympus' into developNils Adermann2010-12-131-1/+1
|\ | | | | | | | | * develop-olympus: [ticket/9924] Pass template instance into $template->display hook
| * [ticket/9924] Pass template instance into $template->display hookIgor Wiedler2010-11-231-1/+1
| | | | | | | | PHPBB3-9924
* | [ticket/9556] Drop php closing tags, add trailing newlineIgor Wiedler2010-11-111-2/+0
|/ | | | | | | | | | | | 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
* Do not store email templates in database. [Bug #54505]Nils Adermann2010-01-261-5/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* fix bug #52605 - regression from r9811Meik Sievertsen2009-10-091-0/+1
| | | | git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10217 89ea8834-ac86-4346-8a33-228a782c2dd0
* bugfix for non-existent handles and theme data (we really need to clean this ↵Meik Sievertsen2009-10-051-1/+6
| | | | | | up, template_files feels quite furry) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10213 89ea8834-ac86-4346-8a33-228a782c2dd0
* Fix #51285 and more issues with template inherence on set_custom_templateJoas Schilling2009-09-161-3/+8
| | | | | | | | 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
* Check for valid $template_path in includes/template.php - Bug #50055Meik Sievertsen2009-08-201-0/+6
| | | | git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10036 89ea8834-ac86-4346-8a33-228a782c2dd0
* Small change to r9839Chris Smith2009-07-251-4/+7
| | | | git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9847 89ea8834-ac86-4346-8a33-228a782c2dd0
* Fix Bug #40515 - Fix set_custom_template for database-stored stylesJoas Schilling2009-07-241-1/+15
| | | | | | | | Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9839 89ea8834-ac86-4346-8a33-228a782c2dd0
* Preserve newlines in template files (one newline had been always dropped ↵Meik Sievertsen2009-07-211-0/+2
| | | | | | 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
* Fix bug #45805 - INCLUDEPHP not depending on phpbb_root_pathJoas Schilling2009-06-191-14/+33
| | | | | | Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9633 89ea8834-ac86-4346-8a33-228a782c2dd0
* Fix problems with styles using an underscore within the filename. (Bug #34315)Meik Sievertsen2008-09-261-2/+2
| | | | | | | | - 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
* Okay. Frozen, we never said anything about it being permafrost. Also, this ↵Henry Sudhof2008-07-281-21/+108
| | | | | | 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
* - fixed database updaterMeik Sievertsen2007-10-041-5/+6
| | | | | | | | - 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
* ok... i seem to have overlooked the handy __CLASS__ constant. ;)Meik Sievertsen2007-09-231-3/+3
| | | | git-svn-id: file:///svn/phpbb/trunk@8106 89ea8834-ac86-4346-8a33-228a782c2dd0