diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2008-05-29 12:25:56 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2008-05-29 12:25:56 +0000 |
commit | 2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04 (patch) | |
tree | 3b7ea329bf35eab5ddab9b0b5eb790e45e283a5c /phpBB/docs/coding-guidelines.html | |
parent | 91b4fe1868ca2c4d81111943f781e3cfd0262ef2 (diff) | |
download | forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar.gz forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar.bz2 forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar.xz forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.zip |
ok... i hope i haven't messed too much with the code and everything is still working.
Changes:
- Ascraeus now uses constants for the phpbb root path and the php extension. This ensures more security for external applications and modifications (no more overwriting of root path and extension possible through insecure mods and register globals enabled) as well as no more globalizing needed.
- A second change implemented here is an additional short-hand-notation for append_sid(). It is allowed to omit the root path and extension now (for example calling append_sid('memberlist')) - in this case the root path and extension get added automatically. The hook is called after these are added.
git-svn-id: file:///svn/phpbb/trunk@8572 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/docs/coding-guidelines.html')
-rw-r--r-- | phpBB/docs/coding-guidelines.html | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 837ae55227..38410fd0cc 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -399,12 +399,12 @@ do_stuff($str); <p class="bad">// Sometimes single quotes are just not right</p> <div class="codebox"><pre> -$post_url = $phpbb_root_path . 'posting.' . $phpEx . '?mode=' . $mode . '&amp;start=' . $start; +$some_string = $board_url . 'someurl.php?mode=' . $mode . '&amp;start=' . $start; </pre></div> <p class="good">// Double quotes are sometimes needed to not overcroud the line with concentinations</p> <div class="codebox"><pre> -$post_url = "{$phpbb_root_path}posting.$phpEx?mode=$mode&amp;start=$start"; +$some_string = "{$board_url}someurl.php?mode=$mode&amp;start=$start"; </pre></div> <p>In SQL Statements mixing single and double quotes is partly allowed (following the guidelines listed here about SQL Formatting), else it should be tryed to only use one method - mostly single quotes.</p> @@ -925,12 +925,18 @@ trigger_error('NO_MODE', E_USER_ERROR); <h4>Url formatting</h4> - <p>All urls pointing to internal files need to be prepended by the <code>$phpbb_root_path</code> variable. Within the administration control panel all urls pointing to internal files need to be prepended by the <code>$phpbb_admin_path</code> variable. This makes sure the path is always correct and users being able to just rename the admin folder and the acp still working as intended (though some links will fail and the code need to be slightly adjusted).</p> + <p>All urls pointing to internal files need to be prepended by the <code>PHPBB_ROOT_PATH</code> constant. Within the administration control panel all urls pointing to internal files need to be prepended by the <code>PHPBB_ADMIN_PATH</code> constant. This makes sure the path is always correct and users being able to just rename the admin folder and the acp still working as intended (though some links will fail and the code need to be slightly adjusted).</p> <p>The <code>append_sid()</code> function from 2.0.x is available too, though does not handle url alterations automatically. Please have a look at the code documentation if you want to get more details on how to use append_sid(). A sample call to append_sid() can look like this:</p> <div class="codebox"><pre> -append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) +append_sid(PHPBB_ROOT_PATH . 'memberlist.' . PHP_EXT, 'mode=group&amp;g=' . $row['group_id']) + </pre></div> + + <p>For shorter writing internal urls are allowed to be written in short notation, not providing the root path and the extension. The append_sid() function will prepend the root path and append the extension automatically (and before calling the hook).</p> + + <div class="codebox"><pre> +append_sid('memberlist', 'mode=group&amp;g=' . $row['group_id']) </pre></div> <h4>General function usage: </h4> |