1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-09-18 12:01:33 +02:00

Compare commits

..

356 Commits

Author SHA1 Message Date
Meik Sievertsen
1ef96b504d Tag Trunk before we change it to a state where merges from the 3.0.x branch are no longer possible
git-svn-id: file:///svn/phpbb/tags/merge_point_20082412@9220 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-24 13:11:39 +00:00
Meik Sievertsen
8c9af252cb merge #r9217
git-svn-id: file:///svn/phpbb/trunk@9218 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-24 12:11:31 +00:00
Chris Smith
7e95a3ee6c merge in r9090, r9170, r9174, r9179
git-svn-id: file:///svn/phpbb/trunk@9214 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-23 13:53:13 +00:00
Chris Smith
79f2dedb51 Remove cache files after each test, ensure they are not included in the coverage report
git-svn-id: file:///svn/phpbb/trunk@9181 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-07 02:26:47 +00:00
Chris Smith
c48f64ce94 Should not be needed, unlink() should clear sthe cache and this was never the problem anyway
git-svn-id: file:///svn/phpbb/trunk@9180 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-07 02:11:12 +00:00
Meik Sievertsen
a39e879300 fix postcount resync for situations where low and high post ids are higher than step value, resulting in users having 0 posts. (Bug #38195)
Enforce a requirement for some DBMS (Oracle, PostgreSQL, MSSQL) where the table order is quite important in some situations. ;) Since this does not affect the operation of the other DBMS the code is placed into dbal.php.


git-svn-id: file:///svn/phpbb/trunk@9176 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-05 11:21:01 +00:00
Meik Sievertsen
a0c9705bb7 every second commit an pre/post-commit error... :/
Ask for forum password if post within passworded forum quoted in private message (Reported by nickvergessen)


git-svn-id: file:///svn/phpbb/trunk@9169 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-03 16:48:58 +00:00
Meik Sievertsen
bb5c5adab1 correctly update last topic/forum information if changing guest usernames through editing posts - Bug #38095
(Changelog follows)

git-svn-id: file:///svn/phpbb/trunk@9167 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-03 16:43:20 +00:00
Meik Sievertsen
c076becc5a Use "less than a minute ago" instead of "0 minutes ago"
Use "Sent: {DATE}" in pm's, instead of "Sent at: {DATE}"

git-svn-id: file:///svn/phpbb/trunk@9163 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-03 11:19:25 +00:00
Meik Sievertsen
4e3d564be6 fix the no_profile one called after another mode with the same user_id and guest_username
git-svn-id: file:///svn/phpbb/trunk@9161 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-03 11:17:30 +00:00
Meik Sievertsen
16e8b8271b ok... now i remember. Added more precise comments
git-svn-id: file:///svn/phpbb/trunk@9159 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-03 09:42:10 +00:00
Chris Smith
9ef743ba7d fix tiny typos in r9087
git-svn-id: file:///svn/phpbb/trunk@9158 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-02 20:04:27 +00:00
Chris Smith
79dc2e79b2 Merge in r9156
git-svn-id: file:///svn/phpbb/trunk@9157 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-02 18:49:02 +00:00
Meik Sievertsen
a236d24ae5 Add same redirect disable_cd_check parameter to meta_refresh - #38065
git-svn-id: file:///svn/phpbb/trunk@9154 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-02 17:04:13 +00:00
Meik Sievertsen
eddddaa3a4 Slight performance increase for common parameter calls to append_sid() (Bug #37555 - Patch by BartVB)
Unsure if this works with the mysterious, uncommented block in front of it, the parsed_urls thingy... whoever wrote it, please prod me. :) Or add comments.

git-svn-id: file:///svn/phpbb/trunk@9151 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-02 16:27:44 +00:00
Meik Sievertsen
d054940739 Performance increase for get_username_string() (Bug #37545 - Patch by BartVB)
git-svn-id: file:///svn/phpbb/trunk@9149 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-02 16:22:03 +00:00
Chris Smith
45ac6aba10 merge in r9145
git-svn-id: file:///svn/phpbb/trunk@9147 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-01 17:28:32 +00:00
Chris Smith
b68a102491 merge in r9144
git-svn-id: file:///svn/phpbb/trunk@9145 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-01 17:04:58 +00:00
Chris Smith
be17000b92 Clear the stat cache of cache files after writing them
git-svn-id: file:///svn/phpbb/trunk@9143 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-01 16:56:57 +00:00
Chris Smith
f49fe16766 Fixed :D
git-svn-id: file:///svn/phpbb/trunk@9142 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-12-01 16:37:52 +00:00
Meik Sievertsen
132a1d2efa do not display ban link for own profile
git-svn-id: file:///svn/phpbb/trunk@9141 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-30 17:46:54 +00:00
Meik Sievertsen
81b57da147 force full date on "edited by" line. ;)
git-svn-id: file:///svn/phpbb/trunk@9139 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-30 16:56:31 +00:00
Meik Sievertsen
4379b3d7bc [Change] Performance increase for format_date() (Bug #37575 - Patch by BartVB)
[Change] Changed prosilver date separator from 'on' to '»'
[Feature] Added 'AGO' setting to relative date strings. For example: posted 14 minutes ago. (Patch by BartVB)
[Fix] Extend vertical line for last post column if no posts in forum (Bug #37125)


git-svn-id: file:///svn/phpbb/trunk@9137 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-30 14:43:25 +00:00
Meik Sievertsen
b4bf675273 Do not increment users post count after post approval if post had been posted in a forum with no post count increasing set (Bug #37865)
git-svn-id: file:///svn/phpbb/trunk@9134 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-30 12:05:15 +00:00
Meik Sievertsen
764c1c4f2b Let's face it - the most common setup we see with phpBB is having group-specific settings for external users (FTP, whatever).
Changed phpbb_chmod() to set the group bit, even if the PHP user is the owner. (somehow this sounds complicated, i hope you get the idea).

git-svn-id: file:///svn/phpbb/trunk@9132 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-30 11:50:23 +00:00
Meik Sievertsen
0d92e30b38 extend the style columns (style_id, template_id, imageset_id, image_id...)
No, not only because of possible style demos. :o

git-svn-id: file:///svn/phpbb/trunk@9130 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-27 13:46:54 +00:00
Chris Smith
d57b4d0b48 Test empty filename and invalid handle
git-svn-id: file:///svn/phpbb/trunk@9119 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-25 00:50:21 +00:00
Chris Smith
de51ec8a15 Test empty filename
git-svn-id: file:///svn/phpbb/trunk@9118 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-25 00:46:22 +00:00
Chris Smith
7b5dc8f3c5 Test missing files
git-svn-id: file:///svn/phpbb/trunk@9117 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-25 00:42:32 +00:00
Chris Smith
c95f0c7935 - Add template variable S_BLOCK_NAME
- Modify template::alter_block_array() so it supports modification of nested blocks
- Add (incomplete) tests for template::alter_block_array()


git-svn-id: file:///svn/phpbb/trunk@9116 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-25 00:31:32 +00:00
Chris Smith
332521a369 - Make a start on completing the phpDoc comments for the template engine
- Tidy template engine code, mainly PHP5 stuff, made some methods void instead of just returning true
- Add tests for the remaining untested compilation code


git-svn-id: file:///svn/phpbb/trunk@9115 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-24 21:59:33 +00:00
Nils Adermann
9954d9c29f - merge r9113: Handle checking for duplicate usernames in chunks (Bug #17285 - Patch by A_Jelly_Doughnut)
git-svn-id: file:///svn/phpbb/trunk@9114 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-24 19:31:44 +00:00
Nils Adermann
81c44f8351 - added a PHPUnit version check
git-svn-id: file:///svn/phpbb/trunk@9112 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-24 13:41:39 +00:00
Chris Smith
f816e67c36 Test is (even|odd) by y
git-svn-id: file:///svn/phpbb/trunk@9110 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-24 11:46:28 +00:00
Chris Smith
528bd80651 Fix a bug we inherited from Smarty a long time ago
git-svn-id: file:///svn/phpbb/trunk@9109 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-24 11:38:22 +00:00
David M
0955e2e539 Optimized this so it would not renumber the keys in the array every time it would grab a unicode character. Instead, it uses the php internal functions to get at the array as we see fit.
git-svn-id: file:///svn/phpbb/trunk@9108 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-24 08:14:36 +00:00
Chris Smith
ae9c4068e7 Deprecate S_ROW_COUNT, remove *really* old assignments from the code
git-svn-id: file:///svn/phpbb/trunk@9107 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-24 07:22:28 +00:00
Nils Adermann
21573a8473 - updating all tests to use new framework
git-svn-id: file:///svn/phpbb/trunk@9106 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-24 00:29:58 +00:00
Nils Adermann
0b11951412 - adding tests for the new request class and extending the tests for request_var to include deep direct access to multidimensional arrays and arbitrary number of dimensions
git-svn-id: file:///svn/phpbb/trunk@9105 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-24 00:28:57 +00:00
Nils Adermann
c8cba06910 - updated security/redirect test to use new framework functionality
git-svn-id: file:///svn/phpbb/trunk@9104 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-24 00:27:18 +00:00
Nils Adermann
bcfcf9b048 - added phpBB test framework which is an extension with some additional
functionality of PHPUnit
- first addition: setExpectedTriggerError() if a test expects a call
  to trigger_error().

git-svn-id: file:///svn/phpbb/trunk@9103 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-24 00:24:46 +00:00
Nils Adermann
07e9b83a3d - updated all code to use the request class instead of any direct access to
super globals
- disabled super globals in common.php. See commit r9101 for
  more information
- cleaned up/simplified a few lines along the way.

git-svn-id: file:///svn/phpbb/trunk@9102 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-24 00:20:33 +00:00
Nils Adermann
8427ae3fd4 Introducing the new request class. All input his handled through this class.
"Given a choice between dancing pigs and security, users will pick
          dancing pigs every time." (Gary McGraw and Edward Felten)

What stays the same?
- request_var() keeps working as it used to, alternatively you can directly use
  request::variable() which allows choosing which super global you want to read

So what's new?
- request::disable_super_globals() which disables super globals. This
  function causes any direct use of $_POST, $_GET, $_REQUEST or $_COOKIE to
  result in an E_USER_ERROR. We hope that this will force MOD authors to at
  least think about validation as they will have to read about how to use the
  request class.
- request::is_set() / request::is_set_post will be used instead of using isset
  directly on super globals
- request_var() now supports arrays with arbitrary depth
- request_var() can be used with an array as the variable name to directly
  access values in mutli dimensional arrays.

What's next?
- request::disable_super_globals() will be active by default (set in
  common.php)
- all code will be adjusted to use the new class consistently
- tests for the request class to make sure it works as designed and will not
  change behaviour between releases

I've also already updated all the code within functions.php to use the request class.

git-svn-id: file:///svn/phpbb/trunk@9101 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-23 23:43:00 +00:00
Chris Smith
6e2d2f85b5 More tests
git-svn-id: file:///svn/phpbb/trunk@9100 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-23 22:39:31 +00:00
Chris Smith
500eb05c48 test advanced loop constructs
git-svn-id: file:///svn/phpbb/trunk@9099 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-23 19:51:52 +00:00
Chris Smith
3f11fc12ac S_NUM_ROWS gives you the number of rows in a block
git-svn-id: file:///svn/phpbb/trunk@9098 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-23 16:07:36 +00:00
Chris Smith
aa3a2f565b Why did I not do it this way to begin with :)
git-svn-id: file:///svn/phpbb/trunk@9097 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-23 16:01:33 +00:00
Meik Sievertsen
3bd6984785 [Change] Alllow applications to set custom module inclusion path (idea by HoL)
git-svn-id: file:///svn/phpbb/trunk@9096 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-23 12:45:22 +00:00
Chris Smith
dcf0b15c9f Will he ever be happy? ...
git-svn-id: file:///svn/phpbb/trunk@9094 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-23 03:50:16 +00:00
Chris Smith
ff22d7a368 Refactor and fix :)
git-svn-id: file:///svn/phpbb/trunk@9093 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-23 03:41:54 +00:00
Chris Smith
f4c079a62b Run template tests over non-cached data as well
git-svn-id: file:///svn/phpbb/trunk@9092 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-23 01:55:12 +00:00
Chris Smith
d26f38c4e0 all 557 tests pass now :D
git-svn-id: file:///svn/phpbb/trunk@9091 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-23 01:08:08 +00:00
Chris Smith
99fa62267e Fix r9088
git-svn-id: file:///svn/phpbb/trunk@9089 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-23 00:10:48 +00:00
Chris Smith
74121b41fa Fix a tiny bug
git-svn-id: file:///svn/phpbb/trunk@9088 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-23 00:09:34 +00:00
Chris Smith
416270ee77 - Deprecate S_ROW_COUNT use S_ROW_NUM
- S_ROW_NUM, S_FIRST_ROW, S_LAST_ROW are now using internal template engine variables saving memory
- Other small changes
- Update of template tests


git-svn-id: file:///svn/phpbb/trunk@9087 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-22 23:53:40 +00:00
Nils Adermann
efe06af913 - merge r9084 and r9085
- added tests for make_clickable

git-svn-id: file:///svn/phpbb/trunk@9086 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-22 23:25:57 +00:00
Meik Sievertsen
04f7c1da69 Only display special ranks to guests; no longer display normal ranks for guests (Bug #36735)
[changed parameters for get_user_rank(), breaks backward compatibility]

git-svn-id: file:///svn/phpbb/trunk@9083 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-22 20:26:47 +00:00
Meik Sievertsen
a9274f1d63 define cookie var for styleswitcher.js for popups (Bug #36765)
git-svn-id: file:///svn/phpbb/trunk@9081 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-22 20:05:24 +00:00
Meik Sievertsen
08bd36f0b2 Do not try to send jabber notifications if no jid entered (Bug #36775)
git-svn-id: file:///svn/phpbb/trunk@9079 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-22 19:58:08 +00:00
Meik Sievertsen
d46e8e6f98 merge revisions i missed... hopefully not breaking things - did not check every change.
git-svn-id: file:///svn/phpbb/trunk@9077 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-22 19:38:25 +00:00
Chris Smith
47b4b83468 Merge in r9065
git-svn-id: file:///svn/phpbb/trunk@9074 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-22 18:03:04 +00:00
Henry Sudhof
c8e3035a4b Merge R 9067
git-svn-id: file:///svn/phpbb/trunk@9068 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-21 13:46:39 +00:00
Chris Smith
ef0c0d4c82 been a while :( ... merge in r8997, r8998, r8999, r9000, r9001, r9002, r9003, r9004, r9005, r9007, r9008, r9009, r9010, r9011, r9012, r9013, r9014, r9015, r9022, r9023, r9029, r9030, r9034, r9048, r9049, r9054, r9056
git-svn-id: file:///svn/phpbb/trunk@9064 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-13 13:04:54 +00:00
Henry Sudhof
1739da9335 Merging R9051 and R 9052
git-svn-id: file:///svn/phpbb/trunk@9062 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-13 11:46:49 +00:00
Henry Sudhof
36635929a8 #36695
git-svn-id: file:///svn/phpbb/trunk@9061 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-13 11:45:40 +00:00
Meik Sievertsen
f353fd2d57 db_tools from static to non-static due to the db dependancy (#31245)
git-svn-id: file:///svn/phpbb/trunk@9044 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-02 11:36:13 +00:00
Meik Sievertsen
6a15c2a936 we no longer need them. Schema is in install now.
git-svn-id: file:///svn/phpbb/trunk@9043 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-02 11:34:50 +00:00
Meik Sievertsen
c903b453fa i had these changes sitting... must've been a merge not committed (and because we do not use svn 1.5 as the client version i am not able to say which they were)
git-svn-id: file:///svn/phpbb/trunk@9042 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-11-02 11:22:30 +00:00
Meik Sievertsen
1b10cb9c37 gah@trunk
git-svn-id: file:///svn/phpbb/trunk@9027 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-10-17 14:56:19 +00:00
Meik Sievertsen
d0e630157c Disable referer validation on install if it is not possible to determine correct referer due to a proxy setup (Bug #32765)
git-svn-id: file:///svn/phpbb/trunk@9025 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-10-17 10:33:06 +00:00
Chris Smith
69cfb5b821 Initial template tests, a bit hackish currently, excuse the rushed nature of this commit got to catch a train :)
git-svn-id: file:///svn/phpbb/trunk@9020 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-10-15 16:21:27 +00:00
Chris Smith
baf8d571e3 Mini bug fix for UNDEFINE
git-svn-id: file:///svn/phpbb/trunk@9016 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-10-15 01:47:37 +00:00
Chris Smith
5ce6035aad Merging r8993, r8994, r8995
git-svn-id: file:///svn/phpbb/trunk@8996 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-10-10 17:58:32 +00:00
Meik Sievertsen
746b617807 Add two standard language items - #30885
Make sure users still get notifications if they set to only be notified by Jabber, but Jabber service disabled. (Bug #29715 - Patch by Paul)


git-svn-id: file:///svn/phpbb/trunk@8991 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-10-09 15:42:08 +00:00
Meik Sievertsen
9c7d8dcd7d - Do not show link to user/group profiles if user has no permission to view the linked page and gets a denied message anyway. (Bug #15088)
- Do not display last post link and sort display options for search engines. (Bug #15088)


git-svn-id: file:///svn/phpbb/trunk@8988 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-10-09 14:22:07 +00:00
Meik Sievertsen
73db74dfa1 Implemented strict check for cached user permissions and existing ACL options. This fix makes sure cached permissions are valid, even if they got already cached.
git-svn-id: file:///svn/phpbb/trunk@8986 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-10-09 13:19:36 +00:00
Meik Sievertsen
d4c8a078a2 Show coloured guest names correctly if not enclosed in <a> tags. ;) Bug #21935
git-svn-id: file:///svn/phpbb/trunk@8984 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-10-08 15:17:27 +00:00
Meik Sievertsen
9d9d61b1a2 Merge revisions:
r8974, r8975, r8976, r8977, r8978, r8979

git-svn-id: file:///svn/phpbb/trunk@8980 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-10-08 12:51:43 +00:00
Meik Sievertsen
89f1b88fe1 merge r8970 and r8971
git-svn-id: file:///svn/phpbb/trunk@8972 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-10-06 05:52:49 +00:00
Meik Sievertsen
9a7804cb71 [Change] Remove NUL-Bytes directly in request_var() for strings and within the custom DBAL sql_escape() functions (MSSQL, Firebird, Oracle) (reported by AdhostMikeSw)
git-svn-id: file:///svn/phpbb/trunk@8968 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-10-02 12:05:13 +00:00
Henry Sudhof
8f2b4562b1 meh
git-svn-id: file:///svn/phpbb/trunk@8966 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-10-01 11:14:48 +00:00
Henry Sudhof
18bfc5e69b and why not this as well?
git-svn-id: file:///svn/phpbb/trunk@8965 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-10-01 10:29:27 +00:00
Meik Sievertsen
ad4d7c036e merge r8956, r8957 and r8960
git-svn-id: file:///svn/phpbb/trunk@8961 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-30 15:18:35 +00:00
Henry Sudhof
e4c3a743ca #34815
git-svn-id: file:///svn/phpbb/trunk@8959 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-30 12:55:48 +00:00
Meik Sievertsen
f3844a17f7 revert r8893 - there were massive problems with the display and select all code
git-svn-id: file:///svn/phpbb/trunk@8954 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-28 17:09:20 +00:00
Chris Smith
c439b286e9 Merge in r8940, r8941, r8942, r8945, r8946, r8947, r8949, r8950, r8951
git-svn-id: file:///svn/phpbb/trunk@8952 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-27 11:45:30 +00:00
Chris Smith
0b6dd99a76 tiny typo #34345
git-svn-id: file:///svn/phpbb/trunk@8948 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-26 21:27:31 +00:00
Chris Smith
0a4c62f12e Merge in r8924, r8925, r8926, r8936, r8938
git-svn-id: file:///svn/phpbb/trunk@8939 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-26 09:28:12 +00:00
Marek A. R
1cc419fb4c Fix typos
git-svn-id: file:///svn/phpbb/trunk@8937 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-25 19:55:04 +00:00
Chris Smith
f6a47c6f82 Merge in r8934
git-svn-id: file:///svn/phpbb/trunk@8935 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-24 18:41:06 +00:00
Meik Sievertsen
10d3191198 better query for syncing post counts. Thanks to BartVB for this. ;)
git-svn-id: file:///svn/phpbb/trunk@8933 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-24 13:58:50 +00:00
Henry Sudhof
9f9a89c78e Merging 8927, 8928, 8929, 8930
git-svn-id: file:///svn/phpbb/trunk@8931 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-24 12:29:57 +00:00
Chris Smith
884cde18fe Merge in r8922
git-svn-id: file:///svn/phpbb/trunk@8923 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-23 16:31:45 +00:00
Meik Sievertsen
ec1be2563c gah^2
git-svn-id: file:///svn/phpbb/trunk@8921 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-23 14:40:20 +00:00
Meik Sievertsen
ec88ec534b here too
git-svn-id: file:///svn/phpbb/trunk@8919 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-23 14:14:33 +00:00
Meik Sievertsen
bb97d3531a remove exit statement and make sure no "additional" code gets executed
git-svn-id: file:///svn/phpbb/trunk@8916 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-23 13:31:04 +00:00
Meik Sievertsen
ce6b87ccec - Automatically add users/groups to the PM recipient list, if entered or selected.
- Reply to PM now includes all previous recipients and not only the original sender.
- Added 'max_recipients' setting for private messages. This setting allows admins to define the maximum number of recipients per private message with a board-wide setting and a group-specific setting.
- Added new permission setting for sending private messages to groups. Now there are two permissions to define sending private messages to multiple recipients and private messages to groups.



git-svn-id: file:///svn/phpbb/trunk@8914 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-23 13:11:34 +00:00
Chris Smith
b486710ea1 Merge in r8843, r8908, r8909
git-svn-id: file:///svn/phpbb/trunk@8910 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-23 12:56:34 +00:00
Meik Sievertsen
aa9dbcec3c short php open tags should not be used. :) A lot of users (including myself) do not allow them.
git-svn-id: file:///svn/phpbb/trunk@8907 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-22 17:51:43 +00:00
Henry Sudhof
08428f8fa1 merging 8904
git-svn-id: file:///svn/phpbb/trunk@8905 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-22 13:32:28 +00:00
Henry Sudhof
0f14f278d0 fixing some vC bugs (attempt counting and posting) and introducing prototype for reCaptcha
git-svn-id: file:///svn/phpbb/trunk@8903 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-22 12:37:42 +00:00
Meik Sievertsen
c67fa83652 remove some spaces
git-svn-id: file:///svn/phpbb/trunk@8902 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-21 10:14:17 +00:00
Meik Sievertsen
1f6eea1b5b Fix sql_multi_insert() if called with non multi-dimensional array (Bug #32975)
git-svn-id: file:///svn/phpbb/trunk@8901 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-19 17:13:22 +00:00
Meik Sievertsen
6f0ea3c9d2 do not allow categories to be locked by accident (Bug #14548)
git-svn-id: file:///svn/phpbb/trunk@8899 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-19 17:07:45 +00:00
Meik Sievertsen
8fd7f16642 language correction (Bug #23955)
git-svn-id: file:///svn/phpbb/trunk@8897 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-19 17:00:26 +00:00
Meik Sievertsen
80ced5c0b7 support tabs in code selections (Bug #25445). Still does not solve the strange "4 spaces prefixed on every line" problem in firefox. :/
git-svn-id: file:///svn/phpbb/trunk@8894 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-19 16:42:55 +00:00
Henry Sudhof
01c1c27f2c meh
git-svn-id: file:///svn/phpbb/trunk@8892 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-19 16:18:59 +00:00
Meik Sievertsen
eee2f89ace Correctly delete message attachments. (Bug #23755) Also revamped and simplified delete_attachments() - it looks like we did not touch it for a long long time.
git-svn-id: file:///svn/phpbb/trunk@8891 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-19 15:42:33 +00:00
Henry Sudhof
461be11e8d Okay, that is pretty raw, but better to have it in place than trying to play catch-up. Introducing an early stage of CAPTCHA modules.
git-svn-id: file:///svn/phpbb/trunk@8889 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-19 13:17:30 +00:00
Meik Sievertsen
5349280538 Pass S_SEARCH_ACTION through append_sid() in search.php. (Bug #21585)
git-svn-id: file:///svn/phpbb/trunk@8886 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-18 15:25:45 +00:00
Meik Sievertsen
24da8c474d remove duplicate statement
git-svn-id: file:///svn/phpbb/trunk@8884 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-18 15:06:23 +00:00
Meik Sievertsen
158a15ba9c Reset login attempts on new password activation. Prevents "first failed login attempt" on converted boards. Bug #19965
git-svn-id: file:///svn/phpbb/trunk@8882 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-18 14:50:50 +00:00
Meik Sievertsen
958d077faa Fix native full text search on postgresql while using excluding keyword matches. (Bug #19195)
git-svn-id: file:///svn/phpbb/trunk@8880 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-18 14:32:51 +00:00
Meik Sievertsen
4649b93e0d Prevent integer overflow - Bug #19895
git-svn-id: file:///svn/phpbb/trunk@8877 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-18 14:27:27 +00:00
Meik Sievertsen
2fc6d5147a Set secure cookie for style switcher if required. (Bug #19625)
git-svn-id: file:///svn/phpbb/trunk@8875 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-18 14:17:39 +00:00
Meik Sievertsen
e2736dea20 Display assigned rank/avatar for guests. (Bug #19155)
git-svn-id: file:///svn/phpbb/trunk@8873 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-18 13:36:40 +00:00
Meik Sievertsen
76c0e5aa5e Do not allow setting forums parent to the forum itself. (Bug #18855)
git-svn-id: file:///svn/phpbb/trunk@8871 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-18 13:22:15 +00:00
Meik Sievertsen
d135060c12 #18175
git-svn-id: file:///svn/phpbb/trunk@8869 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-17 15:52:21 +00:00
Meik Sievertsen
3b79fd122e Use correct port delimiter for MSSQL connections in windows. (Bug #16615)
git-svn-id: file:///svn/phpbb/trunk@8867 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-17 15:12:31 +00:00
Meik Sievertsen
b6949c47ec Preserve alpha transparency for created thumbnails. (Bug #16575)
git-svn-id: file:///svn/phpbb/trunk@8865 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-17 14:59:53 +00:00
Meik Sievertsen
235f552974 Expand shown ban reason in unban screen to fully show long entries. (Bug #16234)
git-svn-id: file:///svn/phpbb/trunk@8863 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-17 14:50:48 +00:00
Meik Sievertsen
1651c5df57 Display popular topic based on posts within topic instead of replies within topic. (Bug #16099)
git-svn-id: file:///svn/phpbb/trunk@8861 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-17 14:31:32 +00:00
Meik Sievertsen
17ec98b834 simplify $user->img()
git-svn-id: file:///svn/phpbb/trunk@8859 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-16 15:15:03 +00:00
Meik Sievertsen
cc5d77e06d make topic icon image width/height available to viewforum and search templates (Bug #15934)
git-svn-id: file:///svn/phpbb/trunk@8858 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-16 15:07:38 +00:00
Meik Sievertsen
2eeeaadcfd emails to e-mails
git-svn-id: file:///svn/phpbb/trunk@8856 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-16 13:21:12 +00:00
Meik Sievertsen
de0bc7476a Do not display reported topic icon for shadow topics. (Bug #13970)
git-svn-id: file:///svn/phpbb/trunk@8854 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-16 12:51:36 +00:00
Meik Sievertsen
ca07af715f Fix Wrong table order in query obtaining posts if post id given. In MSSQL there is an sql error due to this bug.
git-svn-id: file:///svn/phpbb/trunk@8852 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-16 12:37:33 +00:00
Meik Sievertsen
46b4d09e3a add missing dot. :)
git-svn-id: file:///svn/phpbb/trunk@8849 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-16 11:42:09 +00:00
Meik Sievertsen
af26b56470 more in-depth hostname validation. Not used in install files... there the code is fine.
There are ways to improve this, either a whitelist or "more guessing"

git-svn-id: file:///svn/phpbb/trunk@8847 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-15 18:43:24 +00:00
Henry Sudhof
310375db66 Merge 8844, Bug #34045
git-svn-id: file:///svn/phpbb/trunk@8845 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-15 11:44:25 +00:00
Chris Smith
e5425dfd46 Merge in r8840
git-svn-id: file:///svn/phpbb/trunk@8841 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-11 00:32:02 +00:00
Chris Smith
0e0100c525 merge r8829, r8830, r8831, r8832, r8833, r8834, r8835, r8836, r8837, r8838
git-svn-id: file:///svn/phpbb/trunk@8839 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-08 13:39:34 +00:00
Chris Smith
a32f3a6709 Merge in r8827
git-svn-id: file:///svn/phpbb/trunk@8828 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-05 13:49:04 +00:00
Chris Smith
10c8d29205 Merge in r8825
git-svn-id: file:///svn/phpbb/trunk@8826 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-05 12:52:00 +00:00
Chris Smith
6f754d49e4 Remove a useless str_replace()
git-svn-id: file:///svn/phpbb/trunk@8823 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-05 12:41:08 +00:00
Meik Sievertsen
c83e6f7e94 cleanage
git-svn-id: file:///svn/phpbb/trunk@8822 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-04 14:10:17 +00:00
Meik Sievertsen
3a330753f4 Get real dbms version instead of relying on php internal functions which only grab the local library version
git-svn-id: file:///svn/phpbb/trunk@8821 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-04 14:10:03 +00:00
Meik Sievertsen
a736c97c04 needed for mysql 4.1.3+?
git-svn-id: file:///svn/phpbb/trunk@8820 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-04 14:08:19 +00:00
Meik Sievertsen
199ab53f30 support new method of getting correct language strings for nullar/singular/plural forms
git-svn-id: file:///svn/phpbb/trunk@8819 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-04 14:07:30 +00:00
Meik Sievertsen
63e2f5cf14 add phpbb version number to constants
git-svn-id: file:///svn/phpbb/trunk@8818 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-04 14:06:43 +00:00
Meik Sievertsen
4658e3f828 schema updates for the queue trigger feature and for storing the dbms version
git-svn-id: file:///svn/phpbb/trunk@8817 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-04 14:06:20 +00:00
Meik Sievertsen
44416f4744 - queue trigger feature
- queued posts do not affect user_posts
- show links to MCP + queued posts in ucp and acp


git-svn-id: file:///svn/phpbb/trunk@8816 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-04 14:04:30 +00:00
Chris Smith
0dbe7e3b6c Remove caching of templates from the database completely, themes is cut down ready for a complete chop, and fix the installer :)
git-svn-id: file:///svn/phpbb/trunk@8812 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-04 11:39:25 +00:00
Chris Smith
f2abefeaed Merge in r8758, r8807, r8808, r8809
git-svn-id: file:///svn/phpbb/trunk@8810 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-09-02 13:36:48 +00:00
Henry Sudhof
57ec5805df Merging R8795
git-svn-id: file:///svn/phpbb/trunk@8796 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-29 11:53:11 +00:00
Henry Sudhof
73da6084d0 Merge R8792
git-svn-id: file:///svn/phpbb/trunk@8794 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-28 13:12:48 +00:00
Henry Sudhof
323fb23b49 Merge R8790/8791
git-svn-id: file:///svn/phpbb/trunk@8793 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-28 13:12:18 +00:00
Meik Sievertsen
cbacffd9fc fix bug #32925
git-svn-id: file:///svn/phpbb/trunk@8789 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-25 17:17:25 +00:00
Meik Sievertsen
589db44b56 Merge of the language-specific custom path change Revision #r8782
git-svn-id: file:///svn/phpbb/trunk@8786 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-24 10:04:15 +00:00
Meik Sievertsen
8174462e89 Merge chmod changes into trunk
git-svn-id: file:///svn/phpbb/trunk@8781 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-22 13:32:34 +00:00
Henry Sudhof
a45ac24bd7 comments
git-svn-id: file:///svn/phpbb/trunk@8779 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-22 11:02:17 +00:00
Henry Sudhof
3a3b9eb8ef merge
git-svn-id: file:///svn/phpbb/trunk@8776 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-21 15:50:21 +00:00
Meik Sievertsen
76a542a03e merge
git-svn-id: file:///svn/phpbb/trunk@8773 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-21 14:21:38 +00:00
Henry Sudhof
d67b943ef6 merge
git-svn-id: file:///svn/phpbb/trunk@8771 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-18 13:09:08 +00:00
Henry Sudhof
b46bd90f6e merge
git-svn-id: file:///svn/phpbb/trunk@8769 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-18 11:51:07 +00:00
Marek A. R
c119d0b424 More 5.3 compatibility.
git-svn-id: file:///svn/phpbb/trunk@8767 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-16 22:32:24 +00:00
Meik Sievertsen
15e04808fc writeable -> writable merge
git-svn-id: file:///svn/phpbb/trunk@8762 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-16 13:11:50 +00:00
Marek A. R
4235be4bcb PHP5.3 compatibility.
git-svn-id: file:///svn/phpbb/trunk@8759 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-15 13:00:20 +00:00
Henry Sudhof
f741c4ff05 merge
git-svn-id: file:///svn/phpbb/trunk@8757 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-14 12:49:11 +00:00
Henry Sudhof
8236a7438d merge
git-svn-id: file:///svn/phpbb/trunk@8753 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-13 14:43:14 +00:00
Henry Sudhof
ae27aaf1a4 merge
git-svn-id: file:///svn/phpbb/trunk@8750 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-13 14:22:27 +00:00
Henry Sudhof
cec12340b9 merge
git-svn-id: file:///svn/phpbb/trunk@8748 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-13 14:17:11 +00:00
Henry Sudhof
f405535730 merge
git-svn-id: file:///svn/phpbb/trunk@8746 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-13 12:31:19 +00:00
Henry Sudhof
6eed0e5bd2 merge
git-svn-id: file:///svn/phpbb/trunk@8744 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-13 12:28:17 +00:00
David M
6a401ab68b Extracted the IF code to make a generic parsing function,
now DEFINE is nicely integrated and we can even do things
like <!-- BEGIN foo($FOO, $BAR) --> if we *really* wanted
to do so.


git-svn-id: file:///svn/phpbb/trunk@8742 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-03 18:11:40 +00:00
Marek A. R
b3e2250391 Compile things like {$FOO} again.
git-svn-id: file:///svn/phpbb/trunk@8741 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-01 15:13:23 +00:00
Meik Sievertsen
c002c468c4 change conditional enclosements in template engine
oh... thank you very much brainy. :)

git-svn-id: file:///svn/phpbb/trunk@8740 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-01 14:36:52 +00:00
Meik Sievertsen
1071d9cb31 merge cookie secure detection
git-svn-id: file:///svn/phpbb/trunk@8738 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-08-01 14:30:42 +00:00
Henry Sudhof
48701289ff Igor, hope that makes you happy
git-svn-id: file:///svn/phpbb/trunk@8729 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-29 15:38:30 +00:00
Henry Sudhof
360e245a1a make IM links in PMs behave like their viewtopic brothers (#30075 - fix by Porter21)
git-svn-id: file:///svn/phpbb/trunk@8728 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-29 15:35:45 +00:00
Henry Sudhof
97b5920055 Oh. A Paul
git-svn-id: file:///svn/phpbb/trunk@8726 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-29 15:28:46 +00:00
Henry Sudhof
492354344b enable stupid php.ini fallback for readfile (#30325 - fix by bellzebu)
git-svn-id: file:///svn/phpbb/trunk@8725 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-29 15:18:03 +00:00
Henry Sudhof
c1cf3404a2 No negative values (#30335)
git-svn-id: file:///svn/phpbb/trunk@8723 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-29 15:14:07 +00:00
Meik Sievertsen
96948b010c erm, yeah
git-svn-id: file:///svn/phpbb/trunk@8721 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-29 15:05:31 +00:00
Meik Sievertsen
9047c986da upgrader in trunk too. :P
git-svn-id: file:///svn/phpbb/trunk@8720 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-29 15:02:08 +00:00
Henry Sudhof
4580ca9683 Merge teach viewonline about download/file
git-svn-id: file:///svn/phpbb/trunk@8717 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-29 14:58:49 +00:00
Henry Sudhof
be1849a901 Merge make the MCP remember a bit more - still far from perfect as pagination makes it forget
git-svn-id: file:///svn/phpbb/trunk@8716 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-29 14:57:54 +00:00
Henry Sudhof
e9b2e6174e Add VST
git-svn-id: file:///svn/phpbb/trunk@8715 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-29 14:56:40 +00:00
Henry Sudhof
fe93fa0e9d Merge attachment caching
git-svn-id: file:///svn/phpbb/trunk@8714 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-29 14:54:57 +00:00
Henry Sudhof
dceaf59d3b Merge avatar deletion on change code
git-svn-id: file:///svn/phpbb/trunk@8713 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-29 14:38:46 +00:00
Henry Sudhof
db4011c9d9 Merge style element name conflict code
git-svn-id: file:///svn/phpbb/trunk@8712 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-29 14:35:32 +00:00
Meik Sievertsen
7c79d0f860 hmm, this seems to be a merge i forgot
git-svn-id: file:///svn/phpbb/trunk@8711 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-29 13:39:50 +00:00
Marek A. R
8c186d97c6 - Make "<?" and/or "<%" in template files not break the compiled template.
- Enable <!-- PHP --> and <!-- INCLUDEPHP --> again.

git-svn-id: file:///svn/phpbb/trunk@8699 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-28 15:01:06 +00:00
Meik Sievertsen
1b67e80422 marge
git-svn-id: file:///svn/phpbb/trunk@8696 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-28 13:37:16 +00:00
Meik Sievertsen
d8f2c4a1c4 add warning to ACP index if config file is writeable
git-svn-id: file:///svn/phpbb/trunk@8689 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-28 13:21:53 +00:00
David M
41d3effa19 Added the locking code back in... Marek, feel free to reorder it as you see fit.
git-svn-id: file:///svn/phpbb/trunk@8687 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-28 01:16:47 +00:00
Marek A. R
e6e9618be6 Fix ucp.php?mode=login login box redirect
git-svn-id: file:///svn/phpbb/trunk@8686 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-27 22:39:22 +00:00
Marek A. R
0c4ae1cd97 - Optimise compiled template code.
- Improve template filter.

git-svn-id: file:///svn/phpbb/trunk@8685 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-27 22:08:47 +00:00
Meik Sievertsen
036dc071e7 merge
git-svn-id: file:///svn/phpbb/trunk@8684 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-27 13:42:46 +00:00
Marek A. R
d5d7de4ffa - Add some necessary evil
- Template DEFINE variables can now be assigned other variables

git-svn-id: file:///svn/phpbb/trunk@8683 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-25 17:24:12 +00:00
Marek A. R
79dd5b164b Cleanup
git-svn-id: file:///svn/phpbb/trunk@8682 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-20 15:33:23 +00:00
Marek A. R
e0799b79e2 Fix file ACM to work with cached single-quotes and other characters that could need escaping.
git-svn-id: file:///svn/phpbb/trunk@8681 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-07-13 19:08:30 +00:00
Marek A. R
95462dca58 git-svn-id: file:///svn/phpbb/trunk@8680 89ea8834-ac86-4346-8a33-228a782c2dd0 2008-07-12 18:22:47 +00:00
Meik Sievertsen
ad739a358c merge? merge.
git-svn-id: file:///svn/phpbb/trunk@8672 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-23 18:22:44 +00:00
Marek A. R
3892e7330a Fix merge to use the new constants
git-svn-id: file:///svn/phpbb/trunk@8660 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-19 17:51:11 +00:00
Marek A. R
aeb36226c0 Change 5.1.0 to 5.2.0
git-svn-id: file:///svn/phpbb/trunk@8659 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-18 21:32:58 +00:00
Meik Sievertsen
eeba8f4560 Fix some instances where we left db connections open (registration -> captcha for example)
git-svn-id: file:///svn/phpbb/trunk@8656 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-13 19:44:40 +00:00
Marek A. R
677e6451c4 ...
git-svn-id: file:///svn/phpbb/trunk@8654 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-13 18:12:52 +00:00
Marek A. R
c44d2edc4a Changed the template compiler to work on streams. Should be a bit faster.
git-svn-id: file:///svn/phpbb/trunk@8653 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-13 17:57:47 +00:00
Marek A. R
50dd4c183a Fix ACP module URLs
git-svn-id: file:///svn/phpbb/trunk@8652 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-13 17:12:09 +00:00
David M
97d2fb55b7 /me slaps himself for being old school
git-svn-id: file:///svn/phpbb/trunk@8650 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-12 07:27:01 +00:00
David M
0ebc5cc9ee The beginnings of the destruction of phpBB's greatest bottleneck, dynamic css...
As of phpBB 3.0.x, we take our "generic" CSS for a theme and later on combine it with the imagesets and languages as needed... What we did for 3.0.x involved dynamically resolving the variables in the CSS and then sending it off, caching it at several layers (except the one that mattered). The biggest issue with style.php is that it is one giant str_replace on every page load, no matter what; cache be damned. Instead, the trick is to cache the full compilation earlier on...
Further work to do: kill all the old crap and fully integrate the new solution


git-svn-id: file:///svn/phpbb/trunk@8649 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-12 07:24:13 +00:00
Meik Sievertsen
0ca7e81ca4 #28595 (AVATAR_IMG available to memberlist_body.html)
git-svn-id: file:///svn/phpbb/trunk@8646 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-10 14:38:07 +00:00
Meik Sievertsen
fc8db76da9 added two comments to describe the functions use-case
git-svn-id: file:///svn/phpbb/trunk@8644 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-10 12:55:32 +00:00
Nils Adermann
d168abdcc9 Regular expression for email matching in posts will no longer die on long words
git-svn-id: file:///svn/phpbb/trunk@8642 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-09 22:32:51 +00:00
Meik Sievertsen
50f5502cc9 check if folder is not empty (may happen for absolute paths). Thanks paul
git-svn-id: file:///svn/phpbb/trunk@8640 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-09 17:46:41 +00:00
Meik Sievertsen
e199f55ba2 #27395
git-svn-id: file:///svn/phpbb/trunk@8637 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-09 17:10:59 +00:00
Henry Sudhof
d7a217c28c #16124
git-svn-id: file:///svn/phpbb/trunk@8635 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-09 13:06:14 +00:00
Henry Sudhof
8f3c085f7f #27325
git-svn-id: file:///svn/phpbb/trunk@8633 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-09 12:37:44 +00:00
Henry Sudhof
4ba2921cec #23945
git-svn-id: file:///svn/phpbb/trunk@8632 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-09 12:37:08 +00:00
Henry Sudhof
fe2343965b merge
git-svn-id: file:///svn/phpbb/trunk@8629 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-09 11:59:43 +00:00
Henry Sudhof
d0140a096c merge
git-svn-id: file:///svn/phpbb/trunk@8627 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-09 11:36:17 +00:00
David M
fc126eec66 Rewrote this stuff so that it is all multiple object oriented instead of looping single objects... The way it is written, there should be no speed decrease (and in some places, a speed increase) and maybe a miniscule amount of extra memory used in the move_topics function... Everything in there should be O(n) where n is the number of topics or posts being delete or moved or whatever. Multiple topic insertions are not supported as I cannot forsee where one would like to insert multiple topics into the same forum. Different forums I can understand but there is no way to optimize that _at all_. More work to come...
git-svn-id: file:///svn/phpbb/trunk@8625 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-09 00:59:44 +00:00
Meik Sievertsen
1aa40171e0 merge...
git-svn-id: file:///svn/phpbb/trunk@8624 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-08 21:44:59 +00:00
Meik Sievertsen
6a59f3efd6 fix security test for redirect. Also set common server variables to mimick a real testbed.
git-svn-id: file:///svn/phpbb/trunk@8623 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-08 21:43:27 +00:00
Meik Sievertsen
b54a9ec1e2 #28485
git-svn-id: file:///svn/phpbb/trunk@8618 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-07 13:59:14 +00:00
Meik Sievertsen
24b9d6432f #28635
git-svn-id: file:///svn/phpbb/trunk@8616 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-07 13:51:51 +00:00
Meik Sievertsen
7524ca5249 do not allow [flash=0,0]... not implemented for images due to the reliance on getimagesize() - as usual both sizes are able to be limited by the maximum/minimum image size configuration options
git-svn-id: file:///svn/phpbb/trunk@8614 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-07 13:42:06 +00:00
Henry Sudhof
4dddc3a130 Some xenophobia
git-svn-id: file:///svn/phpbb/trunk@8612 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-06 11:28:55 +00:00
Meik Sievertsen
8822747b91 merge...
git-svn-id: file:///svn/phpbb/trunk@8610 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-05 14:11:42 +00:00
Henry Sudhof
ea3eb9e9c3 merge
git-svn-id: file:///svn/phpbb/trunk@8608 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-05 11:38:33 +00:00
Henry Sudhof
a156e31f0c minor constant fix, won't make it work
git-svn-id: file:///svn/phpbb/trunk@8607 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-05 11:35:43 +00:00
Nils Adermann
443ec9dcb0 merging r8604 into trunk
git-svn-id: file:///svn/phpbb/trunk@8606 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-04 17:28:43 +00:00
Nils Adermann
e08a400b9f HTTP Authentication supports UTF-8 usernames now [Bug #21135]
git-svn-id: file:///svn/phpbb/trunk@8603 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-04 16:05:49 +00:00
Nils Adermann
a11f41986f corrected link for searching post author's other posts [Bug #26455]
git-svn-id: file:///svn/phpbb/trunk@8600 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-04 15:48:00 +00:00
Nils Adermann
150c6c4c24 removed executable props [Bug #6464]
git-svn-id: file:///svn/phpbb/trunk@8599 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-04 15:38:14 +00:00
Meik Sievertsen
e8b7c45d85 fix adm redirect
git-svn-id: file:///svn/phpbb/trunk@8590 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-04 11:23:00 +00:00
Meik Sievertsen
e8e807f797 adding missing props
git-svn-id: file:///svn/phpbb/trunk@8588 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-04 11:06:51 +00:00
Henry Sudhof
65fb840b76 merge
git-svn-id: file:///svn/phpbb/trunk@8587 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-03 16:33:02 +00:00
Meik Sievertsen
59e6bc27f1 erm, no, not yet. :P
git-svn-id: file:///svn/phpbb/trunk@8586 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-03 16:32:49 +00:00
Meik Sievertsen
7591a84c0d two new tests, added security suite and fixed utf8 tests.
git-svn-id: file:///svn/phpbb/trunk@8584 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-03 16:15:01 +00:00
Meik Sievertsen
990e3cd4b2 add missing constant to config file
git-svn-id: file:///svn/phpbb/trunk@8583 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-06-03 14:57:04 +00:00
Vic D'Elfant
de5ddf3907 I'm going to get an award for the smallest commit ever.
git-svn-id: file:///svn/phpbb/trunk@8579 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-29 16:19:06 +00:00
Meik Sievertsen
7c159b8c6e mcp link (not within adm folder) - as well as carrying a session by default
git-svn-id: file:///svn/phpbb/trunk@8576 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-29 14:30:00 +00:00
Henry Sudhof
98dadd5eb8 merge
git-svn-id: file:///svn/phpbb/trunk@8575 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-29 14:07:55 +00:00
Meik Sievertsen
8ce9e1b852 i am very sorry... i played a bit... :(
git-svn-id: file:///svn/phpbb/trunk@8573 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-29 12:28:07 +00:00
Meik Sievertsen
2f4a618900 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
2008-05-29 12:25:56 +00:00
Henry Sudhof
91b4fe1868 Merging mime and referer checks into the Trunk
git-svn-id: file:///svn/phpbb/trunk@8571 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-28 13:05:45 +00:00
Meik Sievertsen
28e8c3ea85 merge
git-svn-id: file:///svn/phpbb/trunk@8570 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-26 12:05:22 +00:00
Meik Sievertsen
0c1fa73423 git-svn-id: file:///svn/phpbb/trunk@8569 89ea8834-ac86-4346-8a33-228a782c2dd0 2008-05-26 12:03:22 +00:00
Meik Sievertsen
e7a043a22a ok... still merge needed... now the fix is spread. :/
git-svn-id: file:///svn/phpbb/trunk@8566 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-18 20:15:41 +00:00
Meik Sievertsen
53dc95d429 #26885
git-svn-id: file:///svn/phpbb/trunk@8564 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-18 20:02:14 +00:00
Meik Sievertsen
41d8c20836 merge fix for bug #27355
git-svn-id: file:///svn/phpbb/trunk@8562 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-18 18:58:42 +00:00
Meik Sievertsen
8dde998e87 merge the quick fix
git-svn-id: file:///svn/phpbb/trunk@8553 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-08 17:36:22 +00:00
Nils Adermann
9aac603888 :o don't allow access to that file for people who cannot add a comment
git-svn-id: file:///svn/phpbb/trunk@8551 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-05 00:17:12 +00:00
Nils Adermann
2cfc6b7e0b fixing access to const members in the normalizer and the normalizer test
git-svn-id: file:///svn/phpbb/trunk@8550 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-05 00:14:46 +00:00
Nils Adermann
6871e7caa4 - adding request_var tests
git-svn-id: file:///svn/phpbb/trunk@8549 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-04 22:54:16 +00:00
Nils Adermann
0d631c2ae0 Moving code sniffer stuff into subfolder so directory can be linked and doesn't require copying
git-svn-id: file:///svn/phpbb/trunk@8548 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-04 20:06:02 +00:00
Nils Adermann
1219ff4717 these files should have headers too
git-svn-id: file:///svn/phpbb/trunk@8547 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-04 15:41:51 +00:00
Nils Adermann
22f6e1ed1e - adding a test for utf8_clean_string()
git-svn-id: file:///svn/phpbb/trunk@8546 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-04 14:47:54 +00:00
Meik Sievertsen
eb664ddafb some missing merges...
git-svn-id: file:///svn/phpbb/trunk@8545 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-04 14:47:49 +00:00
Nils Adermann
771fd3696d adding a bbcode test suite
git-svn-id: file:///svn/phpbb/trunk@8541 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-04 12:54:47 +00:00
Nils Adermann
b1915b6f25 expectation goes first
git-svn-id: file:///svn/phpbb/trunk@8540 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-04 12:49:20 +00:00
Nils Adermann
378838499e Going further with our attempt to make phpBB more stable: Testing with PHPUnit
git-svn-id: file:///svn/phpbb/trunk@8539 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-04 12:04:08 +00:00
Henry Sudhof
60aad364c8 #26605
git-svn-id: file:///svn/phpbb/trunk@8537 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-02 16:39:30 +00:00
Henry Sudhof
52400baafa merge
git-svn-id: file:///svn/phpbb/trunk@8535 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-02 14:45:19 +00:00
Henry Sudhof
ebb801ebff merge
git-svn-id: file:///svn/phpbb/trunk@8534 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-05-02 14:44:41 +00:00
Meik Sievertsen
4b9077a58b merge
git-svn-id: file:///svn/phpbb/trunk@8532 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-04-30 15:56:02 +00:00
David M
5e7c936618 Some enhancements to the posting api, replaced the bitfield with two int fields... This represents what the new system could be...
git-svn-id: file:///svn/phpbb/trunk@8528 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-04-23 00:31:28 +00:00
Meik Sievertsen
c5dcff536a #22855
git-svn-id: file:///svn/phpbb/trunk@8527 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-04-22 14:13:12 +00:00
Meik Sievertsen
91d0c8b3bf merge again, revisions 8516 to 8525
git-svn-id: file:///svn/phpbb/trunk@8526 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-04-21 15:10:59 +00:00
Meik Sievertsen
f2ba40f294 merge
git-svn-id: file:///svn/phpbb/trunk@8515 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-04-21 10:55:47 +00:00
Meik Sievertsen
0cf75b2546 remove changelog for the time being and add changes.txt (only temporary for us to mark changes, else we forget them. :P)
git-svn-id: file:///svn/phpbb/trunk@8512 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-04-20 11:27:50 +00:00
Meik Sievertsen
5c2b9b17d1 merged #r8490
git-svn-id: file:///svn/phpbb/trunk@8504 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-04-11 14:22:59 +00:00
Meik Sievertsen
dbae1db24c merge some changes/fixes
henry: is your viewonline fix/change missing? ;)

git-svn-id: file:///svn/phpbb/trunk@8503 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-04-11 14:21:45 +00:00
Nils Adermann
82454165c3 merging r8489 into trunk
git-svn-id: file:///svn/phpbb/trunk@8490 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-04-03 14:06:57 +00:00
Marek A. R
4879a7a075 Some fixes
git-svn-id: file:///svn/phpbb/trunk@8488 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-04-02 21:46:47 +00:00
Meik Sievertsen
c5081a685e #s24575
git-svn-id: file:///svn/phpbb/trunk@8487 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-04-02 08:52:49 +00:00
David M
2deee69e2f Some neat stuff, the new DBAL function has the potential of removing somewhere in the ballpark of 40% of all the DBAL code. It combines a few very common idioms into one statement, allowing us to implicitly use prepared statements. Short term advantages are the ability to remove the gross code that attempts to work around DB2, Oracle and Firebird. Long term advantages include removing the burden of sanitizing data (at least on input) from our end and placing it on shoulders of the backend PHP driver.
Also included is a new posting API I am working on. It is not a real API in so much as it is a backend that a "nice" API could use. User submitted functions are welcome :) It represents a massive simplification in post and topic accounting and a generalization of concepts like "soft deletion" as it works across both topics and posts (yes, this has preliminary support for soft deletions). The only "interesting" problem left is global topics, this has yet to be solved.

Enough talk, time for sleep.

P.S.
Sorry if I broke stuff, was not done on purpose :)

git-svn-id: file:///svn/phpbb/trunk@8485 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-04-02 08:28:21 +00:00
Meik Sievertsen
3e42df098c merging some changes
git-svn-id: file:///svn/phpbb/trunk@8484 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-03-31 14:58:14 +00:00
Marek A. R
45c97a40d2 A little cleanup
git-svn-id: file:///svn/phpbb/trunk@8480 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-03-29 14:11:49 +00:00
Nils Adermann
b935389427 I mean it. Really. Go away.
git-svn-id: file:///svn/phpbb/trunk@8478 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-03-29 00:10:43 +00:00
Nils Adermann
195cd7e148 Go away evil carriage returns\!
git-svn-id: file:///svn/phpbb/trunk@8477 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-03-29 00:08:34 +00:00
Marek A. R
22c304092e It's here and it's awesome!
git-svn-id: file:///svn/phpbb/trunk@8476 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-03-28 22:59:53 +00:00
Henry Sudhof
7596a3bfdc #22385 - David told me to ci this
git-svn-id: file:///svn/phpbb/trunk@8473 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-03-26 17:32:05 +00:00
Nils Adermann
a3da99f358 new isset_post function and some better comments
git-svn-id: file:///svn/phpbb/trunk@8468 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-03-24 01:21:42 +00:00
Nils Adermann
6a30daeb59 not sure what the implications of this quick fix are, especially when upgrading from earlier versions we either have to use a different timezone depending on the server or fix timestamps on update, though shouldn't they be gmt already?
git-svn-id: file:///svn/phpbb/trunk@8467 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-03-24 01:04:27 +00:00
Nils Adermann
5417ec5c4d - add error_reporting to style.php (merge from r8464)
- let the error handler deal with E_STRICT (same as E_WARNING/E_NOTICE) and E_RECOVERABLE_ERROR (same as E_USER_ERROR)


git-svn-id: file:///svn/phpbb/trunk@8466 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-03-24 00:59:39 +00:00
Nils Adermann
65b0f6b165 add session_forum_id column to schema on trunk too
git-svn-id: file:///svn/phpbb/trunk@8465 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-03-24 00:53:17 +00:00
Nils Adermann
6c8a8163e8 - merging r8462 from 3.0 branch
git-svn-id: file:///svn/phpbb/trunk@8463 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-03-24 00:22:16 +00:00
Meik Sievertsen
312bd1a670 merging, revisions #r8453 and #r8454
git-svn-id: file:///svn/phpbb/trunk@8455 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-03-21 10:50:11 +00:00
Meik Sievertsen
02a5032a52 merging... again
git-svn-id: file:///svn/phpbb/trunk@8452 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-03-18 14:47:43 +00:00
Manuel Pichler
c34599126f - First PHP_CodeSniffer rule added that checks all files for a valid file doc
comment as specified in "1.ii. File Header" of the phpBB Coding Guidelines.

git-svn-id: file:///svn/phpbb/trunk@8435 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-03-15 01:01:15 +00:00
Manuel Pichler
9b96e12678 - Initial commit of an ant build file that helps to execute the test suite
for this code sniffer standard implementation. 
  


git-svn-id: file:///svn/phpbb/trunk@8434 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-03-14 20:21:03 +00:00
Nils Adermann
d1f48526d7 code sniffer directory
git-svn-id: file:///svn/phpbb/trunk@8433 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-03-14 20:08:44 +00:00
Meik Sievertsen
8c64d7c32a merging #r8426 to #r8430
git-svn-id: file:///svn/phpbb/trunk@8431 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-03-13 15:25:20 +00:00
Nils Adermann
f115ab68a5 Custom profile fields with date type should be timezone independend [Bug #15003]
git-svn-id: file:///svn/phpbb/trunk@8425 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-03-06 19:31:03 +00:00
Henry Sudhof
cf17b13c98 Problem migrating old cvs working copy to svn
git-svn-id: file:///svn/phpbb/trunk@8423 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-29 13:42:28 +00:00
Meik Sievertsen
da966fed65 #22355 and #22365
git-svn-id: file:///svn/phpbb/trunk@8421 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-28 19:57:52 +00:00
Vic D'Elfant
a765c1aba1 #22285
git-svn-id: file:///svn/phpbb/trunk@8416 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-28 07:39:57 +00:00
Henry Sudhof
f465cdd782 cross-ci
git-svn-id: file:///svn/phpbb/trunk@8415 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-27 15:51:23 +00:00
Henry Sudhof
05ba2058c6 git-svn-id: file:///svn/phpbb/trunk@8413 89ea8834-ac86-4346-8a33-228a782c2dd0 2008-02-27 15:29:35 +00:00
Henry Sudhof
2a3eb724a8 cross-ci
git-svn-id: file:///svn/phpbb/trunk@8411 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-27 15:21:23 +00:00
Nils Adermann
30b24d476c guess we need to initialise it first
git-svn-id: file:///svn/phpbb/trunk@8404 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-26 17:13:12 +00:00
Nils Adermann
f83b47bc11 allow search backends to handle regular updates too, and not just backend switches
git-svn-id: file:///svn/phpbb/trunk@8403 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-25 18:39:16 +00:00
Vic D'Elfant
42073ab0af This will prevent a php warning from being printed (and the layout getting ruined) in case of a conflicting permission restriction such as open_basedir
git-svn-id: file:///svn/phpbb/trunk@8401 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-25 13:07:41 +00:00
Vic D'Elfant
a800565393 #22035
git-svn-id: file:///svn/phpbb/trunk@8396 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-24 15:04:20 +00:00
Meik Sievertsen
0c5839a0b9 merge revisions #r8392 and #r8393
git-svn-id: file:///svn/phpbb/trunk@8394 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-23 15:32:34 +00:00
Meik Sievertsen
2cedbbac09 merge revisions #r8384, #r8387, #r8388, #r8389 and #r8390
git-svn-id: file:///svn/phpbb/trunk@8391 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-23 14:23:34 +00:00
Vic D'Elfant
6dc85449c1 - New set of smilies (they're all face-shaped now), provided by camm15h. Send all your love his way! ;)
- Set svn:ignore on cache/*.php

git-svn-id: file:///svn/phpbb/trunk@8386 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-21 13:14:24 +00:00
Henry Sudhof
95f11a38c0 Cross ci, converter not updated. (as 3.1 schema won't fit any more)
git-svn-id: file:///svn/phpbb/trunk@8383 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-14 12:38:06 +00:00
Henry Sudhof
65ba4fe94e cross-ci
git-svn-id: file:///svn/phpbb/trunk@8382 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-14 12:35:57 +00:00
Henry Sudhof
b33ec670a2 Minor stuff: #20925, #20815
git-svn-id: file:///svn/phpbb/trunk@8376 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-04 12:14:03 +00:00
Nils Adermann
3b669aedfd adding a new option to hide the entire list of subforums on listforums
git-svn-id: file:///svn/phpbb/trunk@8373 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-03 22:39:38 +00:00
David M
7b262babcd Alright, this should give some improved performance :)
This is the end of random seek access to rows. If you have a compelling reason as to why they should stay, contact me. Else, they are gone forevermore...

The following API calls are deprecated:
acm::sql_rowseek() -> no replacement
$db->sql_fetchfield($field, $rownum = false, $query_id = false) -> $db->sql_fetchfield($field, $query_id = false)

Initial tests show that phpBB3 over four percent of memory against phpBB3.1 on an empty board. So far so good :)

Other cool things: 
db2, MS SQL ODBC and MS SQL 2005 all use less memory because they do not need to reference the last executed query to handle random access seeks :)

P.S.
The crazy people using SVN: please report any issues with the new way we itterate through caches, I do not want to miss anything :)

git-svn-id: file:///svn/phpbb/trunk@8372 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-03 10:19:04 +00:00
Meik Sievertsen
e9e9e8e69c merge revisions: #r8359, #r8360, #r8368
git-svn-id: file:///svn/phpbb/trunk@8369 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-02 15:24:55 +00:00
Henry Sudhof
2e5e0a7868 Oh well
git-svn-id: file:///svn/phpbb/trunk@8365 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-01 15:17:04 +00:00
Henry Sudhof
9a4a3a089a cross-ci 8362; #15120, #16029
git-svn-id: file:///svn/phpbb/trunk@8363 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-02-01 13:15:50 +00:00
Meik Sievertsen
48ed77f046 Merging revisions #r8352, #r8353, #r8354 and #r8355
git-svn-id: file:///svn/phpbb/trunk@8356 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-30 21:48:49 +00:00
Meik Sievertsen
4b5fab372f merge with revision #r8350
git-svn-id: file:///svn/phpbb/trunk@8351 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-30 16:14:39 +00:00
Meik Sievertsen
1407460895 Merging revisions #r8346, #r8347 and #r8348
git-svn-id: file:///svn/phpbb/trunk@8349 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-29 15:57:56 +00:00
Meik Sievertsen
e970da6514 Merge revision #r8334
git-svn-id: file:///svn/phpbb/trunk@8345 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-29 14:35:29 +00:00
Meik Sievertsen
1819be3ed1 Merge revision #r8343
git-svn-id: file:///svn/phpbb/trunk@8344 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-29 14:33:53 +00:00
Henry Sudhof
9f5841219a nit rightfully picked
git-svn-id: file:///svn/phpbb/trunk@8341 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-28 15:23:14 +00:00
Henry Sudhof
e683deeeb8 merging #20255
git-svn-id: file:///svn/phpbb/trunk@8338 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-28 13:04:49 +00:00
Henry Sudhof
fedee2c07e cross-ci
git-svn-id: file:///svn/phpbb/trunk@8336 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-24 11:11:11 +00:00
Henry Sudhof
7fed5dd166 cross-checkin for the TRUNK
git-svn-id: file:///svn/phpbb/trunk@8333 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-23 14:32:15 +00:00
Marek A. R
e6991260df Fix parse errors
git-svn-id: file:///svn/phpbb/trunk@8331 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-22 22:15:30 +00:00
Nils Adermann
dbcf8a6f31 poor file being commited without reason
git-svn-id: file:///svn/phpbb/trunk@8330 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-22 19:38:55 +00:00
Marek A. R
835558ea38 Fix parse error
git-svn-id: file:///svn/phpbb/trunk@8329 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-22 19:38:05 +00:00
Nils Adermann
8608cea5c8 test commit on svn
git-svn-id: file:///svn/phpbb/trunk@8328 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-22 19:16:52 +00:00
David M
18a081bc6c oops
#19305


git-svn-id: file:///svn/phpbb/trunk@8325 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-14 05:52:11 +00:00
David M
5195509f3b #19285
git-svn-id: file:///svn/phpbb/trunk@8324 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-13 08:46:37 +00:00
David M
13ee383aad #19245
git-svn-id: file:///svn/phpbb/trunk@8323 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-13 07:49:51 +00:00
David M
9dcb557a5e I suppose I should fix this :P
git-svn-id: file:///svn/phpbb/trunk@8322 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-13 07:47:41 +00:00
David M
b9da54ba91 arg, the voices in my head won't let me focus :P
git-svn-id: file:///svn/phpbb/trunk@8321 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-11 06:25:28 +00:00
David M
24a359e9f5 db tools can now drop tables
git-svn-id: file:///svn/phpbb/trunk@8320 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-11 06:17:46 +00:00
David M
cbb4db46b2 - use proper OOP for db_tools
- made it all static. If one of you disagree, you are free to change it. I just couldn't think of a reason of having it otherwise...


git-svn-id: file:///svn/phpbb/trunk@8319 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-11 05:07:33 +00:00
David M
35f59ceb9a we enter a brave new world...
- fix schema data so that it can now be used
- replace the current system of packaging schemas with phpBB with a new system that dynamically generates the schemas on the fly
- give the db tools package the power to create databases


git-svn-id: file:///svn/phpbb/trunk@8318 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-10 21:46:46 +00:00
David M
b9b46a8b45 - phpBB now uses a less ancient version of Oracle
git-svn-id: file:///svn/phpbb/trunk@8317 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-09 00:21:29 +00:00
David M
7193d91e40 so close to that perfect commit, yet so very far...
git-svn-id: file:///svn/phpbb/trunk@8316 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-08 06:46:08 +00:00
David M
370e189f15 - make viewforum work again
- remove the lower case functions, they were stupid anyway
- added some indexes
- added a group_name_clean column


git-svn-id: file:///svn/phpbb/trunk@8315 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-08 06:44:05 +00:00
Meik Sievertsen
b4e64655af grr
git-svn-id: file:///svn/phpbb/trunk@8314 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-07 19:29:50 +00:00
David M
2928574ed4 - a few tiny clean ups
- a new MS SQL DBAL, it does not work so hot because of issues with the extension it depends on


git-svn-id: file:///svn/phpbb/trunk@8313 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-07 15:19:38 +00:00
Vic D'Elfant
159ce6f8d1 Fixed a problem caused by "-x-" variations of a translation, such as fr-x-strict and de-x-sie. We're now sending the main language code to the output so it will at least be a valid language code
git-svn-id: file:///svn/phpbb/trunk@8311 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-07 09:30:18 +00:00
Meik Sievertsen
5dddcb42ae - Do not split topic list for topics being promoted to announcements after been moved to another forum (Bug #18635)
- Allow editing usernames within database_update on username cleanup (Bug #18415)
- Fixing wrong sync() calls if moving all posts by a member in ACP (Bug #18385)
- Check entered imagemagick path for trailing slash (Bug #18205)
- Use proper title on index for new/unread posts (Bug #13101) - patch provided by Pyramide
- Allow calls to $user->set_cookie() define no cookie time for setting session cookies (Bug #18025)


git-svn-id: file:///svn/phpbb/trunk@8310 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-06 17:00:09 +00:00
David M
6dfa770986 I plan on getting a perfect commit one of these days... Today is not that day :P
git-svn-id: file:///svn/phpbb/trunk@8309 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-06 13:48:28 +00:00
David M
2f08a36062 - add DB2 support
/me takes a nap


git-svn-id: file:///svn/phpbb/trunk@8308 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-06 13:46:20 +00:00
David M
57645ad5bc the end of an era...
- MySQL < 4.1.3 support is removed
- renamed mysql4 to mysql, no need to cause confusion
- changed the cfg cacher, reduces file system lookups and include count by two on every page load


git-svn-id: file:///svn/phpbb/trunk@8307 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-06 02:21:44 +00:00
Meik Sievertsen
f0dea06097 Correctly check empty subjects/messages (Bug #17915)
Do not check usernames against word censor list. Disallowed usernames is already checked and word censor belong to posts. (Bug #17745)
Additionally include non-postable forums for moderators forums shown within the teams list. (Bug #17265)


git-svn-id: file:///svn/phpbb/trunk@8306 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-05 16:10:10 +00:00
Meik Sievertsen
a4633d8ac0 - version jump
- take empty topic_list into account as well as re-enabling for an empty get_forum_ids


git-svn-id: file:///svn/phpbb/trunk@8304 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-05 15:44:31 +00:00
David M
3b29db4545 oops
git-svn-id: file:///svn/phpbb/trunk@8303 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-04 19:54:24 +00:00
David M
f14f82775f ACMs? yep, ACMs...
- Added support for APC, eAccelerator, xcache and memcache systems


git-svn-id: file:///svn/phpbb/trunk@8302 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-04 18:56:42 +00:00
David M
af738dbc2a Ch-ch-ch-changes
- Made us more DB independent by making many queries capability based instead of DB specific
- Finished PHP5ifying of the acm_file class, now with some (hopefully) enhancements to its performance
- Sped up viewforum considerably (also goes towards mcp_forum)

I really hope I didn't explode CVS...


git-svn-id: file:///svn/phpbb/trunk@8301 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-04 18:35:49 +00:00
David M
edd6c34eda do this the proper way
git-svn-id: file:///svn/phpbb/trunk@8300 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-03 19:12:41 +00:00
David M
6b8f2fb4cc PHP, why do you break my heart?
git-svn-id: file:///svn/phpbb/trunk@8299 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-03 18:22:48 +00:00
David M
a7c29a06bf oops
git-svn-id: file:///svn/phpbb/trunk@8298 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-03 17:53:18 +00:00
David M
12d7c9b007 good bye old friend
git-svn-id: file:///svn/phpbb/trunk@8297 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-03 17:14:12 +00:00
David M
4b1b950068 uncomment the second one for ultra debugging power :P
git-svn-id: file:///svn/phpbb/trunk@8296 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-03 17:10:17 +00:00
David M
85055ac97f oh boy...
- Migrate code base to PHP 5.1+


git-svn-id: file:///svn/phpbb/trunk@8295 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-03 17:00:40 +00:00
Henry Sudhof
0f26ffbade cross-ci to the head
git-svn-id: file:///svn/phpbb/trunk@8294 89ea8834-ac86-4346-8a33-228a782c2dd0
2008-01-03 14:37:34 +00:00
Meik Sievertsen
fe56349e34 #16695
#s17235


git-svn-id: file:///svn/phpbb/trunk@8290 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-12-27 17:34:05 +00:00
Meik Sievertsen
5eb46fb67e Ticket #16825
git-svn-id: file:///svn/phpbb/trunk@8289 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-12-27 16:36:24 +00:00
Meik Sievertsen
c3ef1109c0 Ticket #16945
git-svn-id: file:///svn/phpbb/trunk@8288 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-12-27 16:27:24 +00:00
Meik Sievertsen
bf2741ca80 Ticket #17705
git-svn-id: file:///svn/phpbb/trunk@8287 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-12-27 16:04:42 +00:00
Meik Sievertsen
253c07733e re-allow disabling of word censors (we somehow forgot to commit this, i really do not know why :/)
git-svn-id: file:///svn/phpbb/trunk@8286 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-12-26 15:33:06 +00:00
299 changed files with 16943 additions and 71216 deletions

View File

@@ -0,0 +1,210 @@
<?php
/**
*
* @package code_sniffer
* @version $Id: $
* @copyright (c) 2007 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* Checks that each source file contains the standard header.
*
* Based on Coding Guidelines 1.ii File Header.
*
* @package code_sniffer
* @author Manuel Pichler <mapi@phpundercontrol.org>
*/
class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
{
/**
* Returns an array of tokens this test wants to listen for.
*
* @return array
*/
public function register()
{
return array(T_OPEN_TAG);
}
/**
* Processes this test, when one of its tokens is encountered.
*
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token
* in the stack passed in $tokens.
*
* @return void
*/
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
// We are only interested in the first file comment.
if ($stackPtr !== 0)
{
if ($phpcsFile->findPrevious(T_OPEN_TAG, $stackPtr - 1) !== false)
{
return;
}
}
// Fetch next non whitespace token
$tokens = $phpcsFile->getTokens();
$start = $phpcsFile->findNext(T_WHITESPACE, $stackPtr + 1, null, true);
// Skip empty files
if ($tokens[$start]['code'] === T_CLOSE_TAG)
{
return;
}
// Mark as error if this is not a doc comment
else if ($start === false || $tokens[$start]['code'] !== T_DOC_COMMENT)
{
$phpcsFile->addError('Missing required file doc comment.', $stackPtr);
return;
}
// Find comment end token
$end = $phpcsFile->findNext(T_DOC_COMMENT, $start + 1, null, true) - 1;
// If there is no end, skip processing here
if ($end === false)
{
return;
}
// List of found comment tags
$tags = array();
// check comment lines without the first(/**) an last(*/) line
for ($i = $start + 1, $c = ($end - $start); $i <= $c; ++$i)
{
$line = $tokens[$i]['content'];
// Check that each line starts with a '*'
if (substr($line, 0, 1) !== '*')
{
$message = 'The file doc comment should not be idented.';
$phpcsFile->addWarning($message, $i);
}
else if (preg_match('/^\*\s+@([\w]+)\s+(.*)$/', $line, $match) !== 0)
{
$tags[$match[1]] = array($match[2], $i);
}
}
// Check that the first and last line is empty
if (trim($tokens[$start + 1]['content']) !== '*')
{
$message = 'The first file comment line should be empty.';
$phpcsFile->addWarning($message, ($start + 1));
}
if (trim($tokens[$end - $start]['content']) !== '*')
{
$message = 'The last file comment line should be empty.';
$phpcsFile->addWarning($message, ($end - $start));
}
$this->processPackage($phpcsFile, $start, $tags);
$this->processVersion($phpcsFile, $start, $tags);
$this->processCopyright($phpcsFile, $start, $tags);
$this->processLicense($phpcsFile, $start, $tags);
//print_r($tags);
}
/**
* Checks that the tags array contains a valid package tag
*
* @param PHP_CodeSniffer_File $phpcsFile The context source file instance.
* @param integer The stack pointer for the first comment token.
* @param array(string=>array) $tags The found file doc comment tags.
*
* @return void
*/
protected function processPackage(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
{
if (!isset($tags['package']))
{
$message = 'Missing require @package tag in file doc comment.';
$phpcsFile->addError($message, $ptr);
}
else if (preg_match('/^([\w]+)$/', $tags['package'][0]) === 0)
{
$message = 'Invalid content found for @package tag.';
$phpcsFile->addWarning($message, $tags['package'][1]);
}
}
/**
* Checks that the tags array contains a valid version tag
*
* @param PHP_CodeSniffer_File $phpcsFile The context source file instance.
* @param integer The stack pointer for the first comment token.
* @param array(string=>array) $tags The found file doc comment tags.
*
* @return void
*/
protected function processVersion(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
{
if (!isset($tags['version']))
{
$message = 'Missing require @version tag in file doc comment.';
$phpcsFile->addError($message, $ptr);
}
else if (preg_match('/^\$Id:[^\$]+\$$/', $tags['version'][0]) === 0)
{
$message = 'Invalid content found for @version tag, use "$Id: $".';
$phpcsFile->addError($message, $tags['version'][1]);
}
}
/**
* Checks that the tags array contains a valid copyright tag
*
* @param PHP_CodeSniffer_File $phpcsFile The context source file instance.
* @param integer The stack pointer for the first comment token.
* @param array(string=>array) $tags The found file doc comment tags.
*
* @return void
*/
protected function processCopyright(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
{
if (!isset($tags['copyright']))
{
$message = 'Missing require @copyright tag in file doc comment.';
$phpcsFile->addError($message, $ptr);
}
else if (preg_match('/^\(c\) 2[0-9]{3} phpBB Group\s*$/', $tags['copyright'][0]) === 0)
{
$message = 'Invalid content found for @copyright tag, use "(c) <year> phpBB Group".';
$phpcsFile->addError($message, $tags['copyright'][1]);
}
}
/**
* Checks that the tags array contains a valid license tag
*
* @param PHP_CodeSniffer_File $phpcsFile The context source file instance.
* @param integer The stack pointer for the first comment token.
* @param array(string=>array) $tags The found file doc comment tags.
*
* @return void
*/
protected function processLicense(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
{
$license = 'http://opensource.org/licenses/gpl-license.php GNU Public License';
if (!isset($tags['license']))
{
$message = 'Missing require @license tag in file doc comment.';
$phpcsFile->addError($message, $ptr);
}
else if (trim($tags['license'][0]) !== $license)
{
$message = 'Invalid content found for @license tag, use '
. '"' . $license . '".';
$phpcsFile->addError($message, $tags['license'][1]);
}
}
}

View File

@@ -0,0 +1,19 @@
<?php
/**
*
* @package code_sniffer³
* @version $Id: $
* @copyright (c) 2008 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php BSD License
*
*/
?>
<?php
/**
* Broken but not first file doc comment.
*
* @version @package_version@
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @copyright (c) 2007 phpBB Group
*
*/

View File

@@ -0,0 +1,51 @@
<?php
/**
*
* @package code_sniffer
* @version $Id: $
* @copyright (c) 2007 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* Unit test class for the EmptyStatement sniff.
*
* @package code_sniffer
* @author Manuel Pichler <mapi@phpundercontrol.org>
*/
class phpbb_Tests_Commenting_FileCommentUnitTest extends AbstractSniffUnitTest
{
/**
* Returns the lines where errors should occur.
*
* The key of the array should represent the line number and the value
* should represent the number of errors that should occur on that line.
*
* @return array(int => int)
*/
public function getErrorList()
{
return array(
7 => 1 // BSD License error :)
);
}//end getErrorList()
/**
* Returns the lines where warnings should occur.
*
* The key of the array should represent the line number and the value
* should represent the number of warnings that should occur on that line.
*
* @return array(int => int)
*/
public function getWarningList()
{
return array(
4 => 1,
8 => 1
);
}//end getWarningList()
}

View File

@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="code_sniffer" basedir="." default="phpunit">
<property name="cvs.module" value="pear/PHP_CodeSniffer" />
<property name="working.dir" value="${basedir}/_work/code" />
<property name="test.coverage" value="${basedir}/_work/coverage" />
<target name="phpunit" depends="update,prepare">
<exec executable="phpunit">
<arg line="--coverage-html ${test.coverage}
PHP_CodeSniffer_AllTests
${working.dir}/${cvs.module}/tests/AllTests.php" />
</exec>
</target>
<target name="prepare">
<delete dir="${working.dir}/${cvs.module}/CodeSniffer/Standards/phpbb" />
<mkdir dir="${working.dir}/${cvs.module}/CodeSniffer/Standards/phpbb"/>
<copy todir="${working.dir}/${cvs.module}/CodeSniffer/Standards/phpbb/Sniffs">
<fileset dir="${basedir}/Sniffs" />
</copy>
<copy todir="${working.dir}/${cvs.module}/CodeSniffer/Standards/phpbb/Tests">
<fileset dir="${basedir}/Tests" />
</copy>
<copy todir="${working.dir}/${cvs.module}/CodeSniffer/Standards/phpbb">
<fileset file="${basedir}/phpbbCodingStandard.php" />
</copy>
</target>
<target name="cleanup">
<delete dir="${working.dir}" />
</target>
<target name="update">
<exec executable="cvs" dir="${working.dir}/${cvs.module}">
<arg line="up" />
</exec>
</target>
<target name="checkout" depends="cleanup">
<cvspass cvsroot=":pserver:cvsread@cvs.php.net:/repository" password="phpfi" />
<cvs cvsRoot=":pserver:cvsread@cvs.php.net:/repository"
package="${cvs.module}"
dest="${working.dir}" />
</target>
<!--
Installs the sniffs on my local development machine
-->
<target name="install">
<delete dir="/usr/local/pear/PEAR/PHP/CodeSniffer/Standards/phpbb" />
<mkdir dir="/usr/local/pear/PEAR/PHP/CodeSniffer/Standards/phpbb" />
<copy todir="/usr/local/pear/PEAR/PHP/CodeSniffer/Standards/phpbb">
<fileset file="${basedir}/phpbbCodingStandard.php" />
</copy>
<copy todir="/usr/local/pear/PEAR/PHP/CodeSniffer/Standards/phpbb/Sniffs">
<fileset dir="${basedir}/Sniffs" />
</copy>
</target>
</project>

View File

@@ -0,0 +1,43 @@
<?php
/**
*
* @package code_sniffer
* @version $Id: $
* @copyright (c) 2007 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (class_exists('PHP_CodeSniffer_Standards_CodingStandard', true) === false) {
throw new PHP_CodeSniffer_Exception(
'Class PHP_CodeSniffer_Standards_CodingStandard not found'
);
}
/**
* Primary class for the phpbb coding standard.
*
* @package code_sniffer
*/
class PHP_CodeSniffer_Standards_phpbb_phpbbCodingStandard extends PHP_CodeSniffer_Standards_CodingStandard
{
/**
* Return a list of external sniffs to include with this standard.
*
* External locations can be single sniffs, a whole directory of sniffs, or
* an entire coding standard. Locations start with the standard name. For
* example:
* PEAR => include all sniffs in this standard
* PEAR/Sniffs/Files => include all sniffs in this dir
* PEAR/Sniffs/Files/LineLengthSniff => include this single sniff
*
* @return array
*/
public function getIncludedSniffs()
{
return array();
}
}

View File

@@ -15,11 +15,13 @@ define('ADMIN_START', true);
define('NEED_SID', true);
// Include files
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require($phpbb_root_path . 'common.' . $phpEx);
require($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
require($phpbb_root_path . 'includes/functions_module.' . $phpEx);
if (!defined('PHPBB_ROOT_PATH')) define('PHPBB_ROOT_PATH', './../');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
if (!defined('PHPBB_ADMIN_PATH')) define('PHPBB_ADMIN_PATH', './');
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
require(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT);
require(PHPBB_ROOT_PATH . 'includes/functions_module.' . PHP_EXT);
// Start session management
$user->session_begin();
@@ -28,10 +30,14 @@ $user->setup('acp/common');
// End session management
// Have they authenticated (again) as an admin for this session?
if (!isset($user->data['session_admin']) || !$user->data['session_admin'])
if ($user->data['user_id'] != ANONYMOUS && (!isset($user->data['session_admin']) || !$user->data['session_admin']))
{
login_box('', $user->lang['LOGIN_ADMIN_CONFIRM'], $user->lang['LOGIN_ADMIN_SUCCESS'], true, false);
}
else if ($user->data['user_id'] == ANONYMOUS)
{
login_box('');
}
// Is user any type of admin? No, then stop here, each script needs to
// check specific permissions but this is a catchall
@@ -42,7 +48,6 @@ if (!$auth->acl_get('a_'))
// We define the admin variables now, because the user is now able to use the admin related features...
define('IN_ADMIN', true);
$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : './';
// Some oft used variables
$safe_mode = (@ini_get('safe_mode') == '1' || strtolower(@ini_get('safe_mode')) === 'on') ? true : false;
@@ -51,11 +56,8 @@ $module_id = request_var('i', '');
$mode = request_var('mode', '');
// Set custom template for admin area
$template->set_custom_template($phpbb_admin_path . 'style', 'admin');
$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');
// the acp template is never stored in the database
$user->theme['template_storedb'] = false;
$template->set_custom_template(PHPBB_ADMIN_PATH . 'style', 'admin');
$template->assign_var('T_TEMPLATE_PATH', PHPBB_ADMIN_PATH . 'style');
// Instantiate new module
$module = new p_master();
@@ -68,7 +70,7 @@ $module->set_active($module_id, $mode);
// Assign data to the template engine for the list of modules
// We do this before loading the active module for correct menu display in trigger_error
$module->assign_tpl_vars(append_sid("{$phpbb_admin_path}index.$phpEx"));
$module->assign_tpl_vars(append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT));
// Load and execute the relevant module
$module->load_active();
@@ -88,7 +90,7 @@ adm_page_footer();
function adm_page_header($page_title)
{
global $config, $db, $user, $template;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $SID, $_SID;
global $SID, $_SID;
if (defined('HEADER_INC'))
{
@@ -108,36 +110,39 @@ function adm_page_header($page_title)
$template->assign_vars(array(
'PAGE_TITLE' => $page_title,
'USERNAME' => $user->data['username'],
'USERNAME' => ($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : '',
'SID' => $SID,
'_SID' => $_SID,
'SESSION_ID' => $user->session_id,
'ROOT_PATH' => $phpbb_admin_path,
'ROOT_PATH' => PHPBB_ADMIN_PATH,
'U_LOGOUT' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout'),
'U_ADM_LOGOUT' => append_sid("{$phpbb_admin_path}index.$phpEx", 'action=admlogout'),
'U_ADM_INDEX' => append_sid("{$phpbb_admin_path}index.$phpEx"),
'U_INDEX' => append_sid("{$phpbb_root_path}index.$phpEx"),
'U_LOGOUT' => append_sid('ucp', 'mode=logout'),
'U_ADM_LOGOUT' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'action=admlogout'),
'U_ADM_INDEX' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT),
'U_INDEX' => append_sid('index'),
'T_IMAGES_PATH' => "{$phpbb_root_path}images/",
'T_SMILIES_PATH' => "{$phpbb_root_path}{$config['smilies_path']}/",
'T_AVATAR_PATH' => "{$phpbb_root_path}{$config['avatar_path']}/",
'T_AVATAR_GALLERY_PATH' => "{$phpbb_root_path}{$config['avatar_gallery_path']}/",
'T_ICONS_PATH' => "{$phpbb_root_path}{$config['icons_path']}/",
'T_RANKS_PATH' => "{$phpbb_root_path}{$config['ranks_path']}/",
'T_UPLOAD_PATH' => "{$phpbb_root_path}{$config['upload_path']}/",
'S_USER_ADMIN' => $user->data['session_admin'],
'S_USER_LOGGED_IN' => ($user->data['user_id'] != ANONYMOUS && !$user->data['is_bot']),
'ICON_MOVE_UP' => '<img src="' . $phpbb_admin_path . 'images/icon_up.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />',
'ICON_MOVE_UP_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_up_disabled.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />',
'ICON_MOVE_DOWN' => '<img src="' . $phpbb_admin_path . 'images/icon_down.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />',
'ICON_MOVE_DOWN_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_down_disabled.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />',
'ICON_EDIT' => '<img src="' . $phpbb_admin_path . 'images/icon_edit.gif" alt="' . $user->lang['EDIT'] . '" title="' . $user->lang['EDIT'] . '" />',
'ICON_EDIT_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_edit_disabled.gif" alt="' . $user->lang['EDIT'] . '" title="' . $user->lang['EDIT'] . '" />',
'ICON_DELETE' => '<img src="' . $phpbb_admin_path . 'images/icon_delete.gif" alt="' . $user->lang['DELETE'] . '" title="' . $user->lang['DELETE'] . '" />',
'ICON_DELETE_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_delete_disabled.gif" alt="' . $user->lang['DELETE'] . '" title="' . $user->lang['DELETE'] . '" />',
'ICON_SYNC' => '<img src="' . $phpbb_admin_path . 'images/icon_sync.gif" alt="' . $user->lang['RESYNC'] . '" title="' . $user->lang['RESYNC'] . '" />',
'ICON_SYNC_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_sync_disabled.gif" alt="' . $user->lang['RESYNC'] . '" title="' . $user->lang['RESYNC'] . '" />',
'T_IMAGES_PATH' => PHPBB_ROOT_PATH . 'images/',
'T_SMILIES_PATH' => PHPBB_ROOT_PATH . $config['smilies_path'] . '/',
'T_AVATAR_PATH' => PHPBB_ROOT_PATH . $config['avatar_path'] . '/',
'T_AVATAR_GALLERY_PATH' => PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/',
'T_ICONS_PATH' => PHPBB_ROOT_PATH . $config['icons_path'] . '/',
'T_RANKS_PATH' => PHPBB_ROOT_PATH . $config['ranks_path'] . '/',
'T_UPLOAD_PATH' => PHPBB_ROOT_PATH . $config['upload_path'] . '/',
'ICON_MOVE_UP' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_up.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />',
'ICON_MOVE_UP_DISABLED' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_up_disabled.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />',
'ICON_MOVE_DOWN' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_down.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />',
'ICON_MOVE_DOWN_DISABLED' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_down_disabled.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />',
'ICON_EDIT' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_edit.gif" alt="' . $user->lang['EDIT'] . '" title="' . $user->lang['EDIT'] . '" />',
'ICON_EDIT_DISABLED' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_edit_disabled.gif" alt="' . $user->lang['EDIT'] . '" title="' . $user->lang['EDIT'] . '" />',
'ICON_DELETE' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_delete.gif" alt="' . $user->lang['DELETE'] . '" title="' . $user->lang['DELETE'] . '" />',
'ICON_DELETE_DISABLED' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_delete_disabled.gif" alt="' . $user->lang['DELETE'] . '" title="' . $user->lang['DELETE'] . '" />',
'ICON_SYNC' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_sync.gif" alt="' . $user->lang['RESYNC'] . '" title="' . $user->lang['RESYNC'] . '" />',
'ICON_SYNC_DISABLED' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_sync_disabled.gif" alt="' . $user->lang['RESYNC'] . '" title="' . $user->lang['RESYNC'] . '" />',
'S_USER_LANG' => $user->lang['USER_LANG'],
'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'],
@@ -162,7 +167,7 @@ function adm_page_header($page_title)
function adm_page_footer($copyright_html = true)
{
global $db, $config, $template, $user, $auth, $cache;
global $starttime, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $starttime;
// Output page creation time
if (defined('DEBUG'))
@@ -170,7 +175,7 @@ function adm_page_footer($copyright_html = true)
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
if (!empty($_REQUEST['explain']) && $auth->acl_get('a_') && defined('DEBUG_EXTRA') && method_exists($db, 'sql_report'))
if (request::variable('explain', false) && $auth->acl_get('a_') && defined('DEBUG_EXTRA') && method_exists($db, 'sql_report'))
{
$db->sql_report('display');
}
@@ -373,7 +378,8 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
*/
function validate_config_vars($config_vars, &$cfg_array, &$error)
{
global $phpbb_root_path, $user;
global $user;
$type = 0;
$min = 1;
$max = 2;
@@ -466,13 +472,13 @@ function validate_config_vars($config_vars, &$cfg_array, &$error)
$cfg_array[$config_name] = basename($cfg_array[$config_name]);
if (!file_exists($phpbb_root_path . 'language/' . $cfg_array[$config_name] . '/'))
if (!file_exists(PHPBB_ROOT_PATH . 'language/' . $cfg_array[$config_name] . '/'))
{
$error[] = $user->lang['WRONG_DATA_LANG'];
}
break;
// Relative path (appended $phpbb_root_path)
// Relative path (appended PHPBB_ROOT_PATH)
case 'rpath':
case 'rwpath':
if (!$cfg_array[$config_name])
@@ -514,12 +520,12 @@ function validate_config_vars($config_vars, &$cfg_array, &$error)
break;
}
if (!file_exists($phpbb_root_path . $cfg_array[$config_name]))
if (!file_exists(PHPBB_ROOT_PATH . $cfg_array[$config_name]))
{
$error[] = sprintf($user->lang['DIRECTORY_DOES_NOT_EXIST'], $cfg_array[$config_name]);
}
if (file_exists($phpbb_root_path . $cfg_array[$config_name]) && !is_dir($phpbb_root_path . $cfg_array[$config_name]))
if (file_exists(PHPBB_ROOT_PATH . $cfg_array[$config_name]) && !is_dir(PHPBB_ROOT_PATH . $cfg_array[$config_name]))
{
$error[] = sprintf($user->lang['DIRECTORY_NOT_DIR'], $cfg_array[$config_name]);
}
@@ -527,7 +533,7 @@ function validate_config_vars($config_vars, &$cfg_array, &$error)
// Check if the path is writable
if ($config_definition['validate'] == 'wpath' || $config_definition['validate'] == 'rwpath')
{
if (file_exists($phpbb_root_path . $cfg_array[$config_name]) && !@is_writable($phpbb_root_path . $cfg_array[$config_name]))
if (file_exists(PHPBB_ROOT_PATH . $cfg_array[$config_name]) && !@is_writable(PHPBB_ROOT_PATH . $cfg_array[$config_name]))
{
$error[] = sprintf($user->lang['DIRECTORY_NOT_WRITABLE'], $cfg_array[$config_name]);
}

View File

@@ -22,47 +22,34 @@
<dd><label><input type="radio" class="radio" id="enable_post_confirm" name="enable_post_confirm" value="1"<!-- IF POST_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_ENABLED}</label>
<label><input type="radio" class="radio" name="enable_post_confirm" value="0"<!-- IF not POST_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_DISABLED}</label></dd>
</dl>
<!-- IF GD -->
<dl>
<dt><label for="captcha_gd">{L_CAPTCHA_GD}:</label><br /><span>{L_CAPTCHA_GD_EXPLAIN}</span></dt>
<dd><label><input id="captcha_gd" name="captcha_gd" value="1" class="radio" type="radio"<!-- IF CAPTCHA_GD --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label><input name="captcha_gd" value="0" class="radio" type="radio"<!-- IF not CAPTCHA_GD --> checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
</dl>
<dl>
<dt><label for="captcha_gd_foreground_noise">{L_CAPTCHA_GD_FOREGROUND_NOISE}:</label><br /><span>{L_CAPTCHA_GD_FOREGROUND_NOISE_EXPLAIN}</span></dt>
<dd><label><input id="captcha_gd_foreground_noise" name="captcha_gd_foreground_noise" value="1" class="radio" type="radio"<!-- IF CAPTCHA_GD_FOREGROUND_NOISE --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label><input name="captcha_gd_foreground_noise" value="0" class="radio" type="radio"<!-- IF not CAPTCHA_GD_FOREGROUND_NOISE --> checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
</dl>
<dl>
<dt><label for="captcha_gd_x_grid">{L_CAPTCHA_GD_X_GRID}:</label><br /><span>{L_CAPTCHA_GD_X_GRID_EXPLAIN}</span></dt>
<dd><input id="captcha_gd_x_grid" name="captcha_gd_x_grid" value="{CAPTCHA_GD_X_GRID}" type="text" /></dd>
</dl>
<dl>
<dt><label for="captcha_gd_y_grid">{L_CAPTCHA_GD_Y_GRID}:</label><br /><span>{L_CAPTCHA_GD_Y_GRID_EXPLAIN}</span></dt>
<dd><input id="captcha_gd_y_grid" name="captcha_gd_y_grid" value="{CAPTCHA_GD_Y_GRID}" type="text" /></dd>
</dl>
<!-- ENDIF -->
</fieldset>
<fieldset>
<legend>{L_AVAILABLE_CAPTCHAS}</legend>
<dl>
<dt><label for="captcha_select">{L_CAPTCHA_SELECT}:</label><br /><span>{L_CAPTCHA_SELECT_EXPLAIN}</span></dt>
<dd><select id="captcha_select" name="select_captcha" onchange="(document.getElementById('acp_captcha')).submit()" >{CAPTCHA_SELECT}</select></dd>
</dl>
<dl>
<dt><label for="configure">{L_CAPTCHA_CONFIGURE}:</label><br /><span>{L_CAPTCHA_CONFIGURE_EXPLAIN}</span></dt>
<dd><input class="button2" type="submit" id="configure" name="configure" value="{L_CONFIGURE}" /></dd>
</dl>
</fieldset>
<!-- IF CAPTCHA_PREVIEW -->
<fieldset>
<legend>{L_PREVIEW}</legend>
<!-- IF PREVIEW -->
<div class="successbox">
<h3>{L_WARNING}</h3>
<p>{L_CAPTCHA_PREVIEW_MSG}</p>
</div>
<!-- ENDIF -->
<dl>
<dt><label for="captcha_preview">{L_PREVIEW}:</label><br /><span>{L_CAPTCHA_PREVIEW_EXPLAIN}</span></dt>
<dd><img src="{CAPTCHA_PREVIEW}" alt="{L_PREVIEW}" <!-- IF CAPTCHA_GD_PREVIEWED -->width="360" height="96"<!-- ELSE --> width="320" height="50"<!-- ENDIF --> id="captcha_preview" /></dd>
</dl>
{CAPTCHA_PREVIEW}
</fieldset>
<!-- ENDIF -->
<fieldset class="submit-buttons">
<legend>{L_SUBMIT}</legend>
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />&nbsp;
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />&nbsp;
<input class="button2" type="submit" id="preview" name="preview" value="{L_PREVIEW}" />
<input class="button1" type="submit" id="main_submit" name="main_submit" value="{L_SUBMIT}" />&nbsp;
<input class="button2" type="reset" id="form_reset" name="reset" value="{L_RESET}" />&nbsp;
{S_FORM_TOKEN}
</fieldset>
</form>

View File

@@ -0,0 +1,46 @@
<!-- INCLUDE overall_header.html -->
<h1>{PAGE_TITLE}</h1>
<p><!-- IF LOGIN_EXPLAIN -->{LOGIN_EXPLAIN}<!-- ELSE -->{L_LOGIN}<!-- ENDIF --></p>
<!-- IF LOGIN_ERROR -->
<div class="errorbox">
<h3>{L_WARNING}</h3>
<p>{LOGIN_ERROR}</p>
</div>
<!-- ENDIF -->
<form action="{S_LOGIN_ACTION}" method="post" id="login">
<fieldset>
<dl>
<dt><label for="{USERNAME_CREDENTIAL}">{L_USERNAME}:</label></dt>
<dd><input type="text" tabindex="1" name="{USERNAME_CREDENTIAL}" id="{USERNAME_CREDENTIAL}" size="25" value="{USERNAME}" class="inputbox autowidth" /></dd>
</dl>
<dl>
<dt><label for="{PASSWORD_CREDENTIAL}">{L_PASSWORD}:</label></dt>
<dd><input type="password" tabindex="2" id="{PASSWORD_CREDENTIAL}" name="{PASSWORD_CREDENTIAL}" size="25" class="inputbox autowidth" /></dd>
<!-- IF S_DISPLAY_FULL_LOGIN and (U_SEND_PASSWORD or U_RESEND_ACTIVATION) -->
<!-- IF U_SEND_PASSWORD --><dd><a href="{U_SEND_PASSWORD}">{L_FORGOT_PASS}</a></dd><!-- ENDIF -->
<!-- IF U_RESEND_ACTIVATION --><dd><a href="{U_RESEND_ACTIVATION}">{L_RESEND_ACTIVATION}</a></dd><!-- ENDIF -->
<!-- ENDIF -->
</dl>
<!-- IF S_CONFIRM_CODE -->
<dl>
<dt><label for="confirm_code">{L_CONFIRM_CODE}:</label><br /><span>{L_CONFIRM_CODE_EXPLAIN}</span></dt>
<dd><input type="hidden" name="confirm_id" value="{CONFIRM_ID}" />{CONFIRM_IMAGE}</dd>
<dd><input type="text" name="confirm_code" id="confirm_code" size="8" maxlength="8" tabindex="3" class="inputbox narrow" title="{L_CONFIRM_CODE}" /></dd>
</dl>
<!-- ENDIF -->
<p class="submit-buttons">
<!-- IF S_DISPLAY_FULL_LOGIN -->
<!-- IF S_AUTOLOGIN_ENABLED --><label for="autologin"><input type="checkbox" name="autologin" id="autologin" tabindex="4" /> {L_LOG_ME_IN}</label><!-- ENDIF -->
<label for="viewonline"><input type="checkbox" name="viewonline" id="viewonline" tabindex="5" /> {L_HIDE_ME}</label>
<!-- ENDIF -->
&nbsp;
{S_HIDDEN_FIELDS}<input type="submit" name="login" tabindex="6" value="{L_LOGIN}" class="button1" />
</p>
</fieldset>
</form>
<!-- INCLUDE overall_footer.html -->

View File

@@ -48,20 +48,20 @@
<fieldset>
<legend>{L_VISIBILITY_OPTION}</legend>
<dl>
<dt><label for="field_show_profile">{L_DISPLAY_AT_PROFILE}:</label><br /><span>{L_DISPLAY_AT_PROFILE_EXPLAIN}</span></dt>
<dd><input type="checkbox" class="radio" id="field_show_profile" name="field_show_profile" value="1"<!-- IF S_SHOW_PROFILE --> checked="checked"<!-- ENDIF --> /></dd>
<dt><label for="field_option_none">{L_DISPLAY_AT_PROFILE}:</label><br /><span>{L_DISPLAY_AT_PROFILE_EXPLAIN}</span></dt>
<dd><input type="radio" class="radio" id="field_option_none" name="field_option" value="none"<!-- IF not S_SHOW_ON_REG and not S_FIELD_REQUIRED and not S_FIELD_HIDE --> checked="checked"<!-- ENDIF --> /></dd>
</dl>
<dl>
<dt><label for="field_show_on_reg">{L_DISPLAY_AT_REGISTER}:</label><br /><span>{L_DISPLAY_AT_REGISTER_EXPLAIN}</span></dt>
<dd><input type="checkbox" class="radio" id="field_show_on_reg" name="field_show_on_reg" value="1"<!-- IF S_SHOW_ON_REG --> checked="checked"<!-- ENDIF --> /></dd>
<dd><input type="radio" class="radio" id="field_show_on_reg" name="field_option" value="field_show_on_reg"<!-- IF S_SHOW_ON_REG --> checked="checked"<!-- ENDIF --> /></dd>
</dl>
<dl>
<dt><label for="field_required">{L_REQUIRED_FIELD}:</label><br /><span>{L_REQUIRED_FIELD_EXPLAIN}</span></dt>
<dd><input type="checkbox" class="radio" id="field_required" name="field_required" value="1"<!-- IF S_FIELD_REQUIRED --> checked="checked"<!-- ENDIF --> /></dd>
<dd><input type="radio" class="radio" id="field_required" name="field_option" value="field_required"<!-- IF S_FIELD_REQUIRED --> checked="checked"<!-- ENDIF --> /></dd>
</dl>
<dl>
<dt><label for="field_hide">{L_HIDE_PROFILE_FIELD}:</label><br /><span>{L_HIDE_PROFILE_FIELD_EXPLAIN}</span></dt>
<dd><input type="checkbox" class="radio" id="field_hide" name="field_hide" value="1"<!-- IF S_FIELD_HIDE --> checked="checked"<!-- ENDIF --> /></dd>
<dd><input type="radio" class="radio" id="field_hide" name="field_option" value="field_hide"<!-- IF S_FIELD_HIDE --> checked="checked"<!-- ENDIF --> /></dd>
</dl>
</fieldset>

View File

@@ -261,11 +261,11 @@
<!-- ELSEIF S_CACHE -->
<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">&laquo; {L_BACK}</a>
<h1>{L_TEMPLATE_CACHE}</h1>
<p>{L_TEMPLATE_CACHE_EXPLAIN}</p>
<form name="acp_styles" method="post" action="{U_ACTION}">
<fieldset class="tabulated">
<legend>{L_TEMPLATE_CACHE}</legend>
@@ -283,7 +283,7 @@
<tbody>
<!-- BEGIN file -->
<!-- IF file.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
<td><a href="{file.U_VIEWSOURCE}" onclick="popup(this.href, 750, 550, '_source'); return false;">{file.FILENAME_PATH}</a></td>
<td><a href="{file.U_VIEWSOURCE}" onclick="popup(this.href, 750, 550, '_source'); return false;">{file.FILENAME}</a></td>
<td>{file.FILESIZE}</td>
<td>{file.CACHED}</td>
<td>{file.MODIFIED}</td>
@@ -361,7 +361,7 @@
</p>
</fieldset>
</form>
<!-- ELSEIF S_FRONTEND -->
@@ -461,12 +461,6 @@
<dt><label for="copyright">{L_COPYRIGHT}:</label></dt>
<dd><!-- IF S_INSTALL --><b id="copyright">{COPYRIGHT}</b><!-- ELSE --><input type="text" id="copyright" name="copyright" value="{COPYRIGHT}" /><!-- ENDIF --></dd>
</dl>
<!-- IF S_SUPERTEMPLATE -->
<dl>
<dt><label for="inheriting">{L_INHERITING_FROM}:</label></dt>
<dd><b id="inheriting">{S_SUPERTEMPLATE}</b></dd>
</dl>
<!-- ENDIF -->
<!-- IF S_STYLE and not S_BASIS -->
<dl>
<dt><label for="template_id">{L_STYLE_TEMPLATE}:</label></dt>
@@ -481,13 +475,6 @@
<dd><!-- IF S_INSTALL --><b id="imageset_id">{IMAGESET_NAME}</b><!-- ELSE --><select id="imageset_id" name="imageset_id">{S_IMAGESET_OPTIONS}</select><!-- ENDIF --></dd>
</dl>
<!-- ENDIF -->
<!-- IF (S_TEMPLATE or S_THEME) and (S_LOCATION or not S_INSTALL) -->
<dl>
<dt><label for="store_db">{L_LOCATION}:</label><br /><span><!-- IF S_STORE_DB_DISABLED -->{L_LOCATION_DISABLED_EXPLAIN}<!-- ELSE -->{L_LOCATION_EXPLAIN}<!-- ENDIF --></span></dt>
<dd><label><input type="radio" class="radio" name="store_db" value="0"<!-- IF not S_STORE_DB --> id="store_db" checked="checked"<!-- ENDIF --> <!-- IF S_STORE_DB_DISABLED -->disabled="disabled" <!-- ENDIF --> />{L_STORE_FILESYSTEM}</label>
<label><input type="radio" class="radio" name="store_db" value="1"<!-- IF S_STORE_DB --> id="store_db" checked="checked"<!-- ENDIF --> <!-- IF S_STORE_DB_DISABLED -->disabled="disabled" <!-- ENDIF -->/> {L_STORE_DATABASE}</label></dd>
</dl>
<!-- ENDIF -->
<!-- IF S_STYLE -->
</fieldset>
@@ -513,7 +500,7 @@
<input class="button1" type="submit" name="update" value="{L_SUBMIT}" />
{S_FORM_TOKEN}
</fieldset>
</form>
<!-- ENDIF -->

View File

@@ -0,0 +1,5 @@
<dl>
<dt><label for="captcha_preview">{L_PREVIEW}:</label><br /><span>{L_CAPTCHA_PREVIEW_EXPLAIN}</span></dt>
<dd><img src="{CONFIRM_IMAGE}" alt="{L_PREVIEW}" width="360" height="96" id="captcha_preview" /></dd>
</dl>

View File

@@ -0,0 +1,53 @@
<!-- INCLUDE overall_header.html -->
<a name="maincontent"></a>
<h1>{L_ACP_VC_SETTINGS}</h1>
<p>{L_ACP_VC_SETTINGS_EXPLAIN}</p>
<form id="acp_captcha" method="post" action="{U_ACTION}">
<fieldset>
<legend>{L_GENERAL_OPTIONS}</legend>
<dl>
<dt><label for="captcha_gd_foreground_noise">{L_CAPTCHA_GD_FOREGROUND_NOISE}:</label><br /><span>{L_CAPTCHA_GD_FOREGROUND_NOISE_EXPLAIN}</span></dt>
<dd><label><input id="captcha_gd_foreground_noise" name="captcha_gd_foreground_noise" value="1" class="radio" type="radio"<!-- IF CAPTCHA_GD_FOREGROUND_NOISE --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label><input name="captcha_gd_foreground_noise" value="0" class="radio" type="radio"<!-- IF not CAPTCHA_GD_FOREGROUND_NOISE --> checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
</dl>
<dl>
<dt><label for="captcha_gd_x_grid">{L_CAPTCHA_GD_X_GRID}:</label><br /><span>{L_CAPTCHA_GD_X_GRID_EXPLAIN}</span></dt>
<dd><input id="captcha_gd_x_grid" name="captcha_gd_x_grid" value="{CAPTCHA_GD_X_GRID}" type="text" /></dd>
</dl>
<dl>
<dt><label for="captcha_gd_y_grid">{L_CAPTCHA_GD_Y_GRID}:</label><br /><span>{L_CAPTCHA_GD_Y_GRID_EXPLAIN}</span></dt>
<dd><input id="captcha_gd_y_grid" name="captcha_gd_y_grid" value="{CAPTCHA_GD_Y_GRID}" type="text" /></dd>
</dl>
</fieldset>
<fieldset>
<legend>{L_PREVIEW}</legend>
<!-- IF PREVIEW -->
<div class="successbox">
<h3>{L_WARNING}</h3>
<p>{L_CAPTCHA_PREVIEW_MSG}</p>
</div>
<!-- ENDIF -->
{CAPTCHA_PREVIEW}
</fieldset>
<fieldset class="submit-buttons">
<legend>{L_SUBMIT}</legend>
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />&nbsp;
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />&nbsp;
<input type="hidden" name="select_captcha" value="{CAPTCHA_NAME}" />
<input type="hidden" name="configure" value="1" />
{S_FORM_TOKEN}
</fieldset>
</form>
<!-- INCLUDE overall_footer.html -->

View File

@@ -0,0 +1,19 @@
<!-- IF S_RECAPTCHA_AVAILABLE -->
<dl>
<script type="text/javascript" src="{RECAPTCHA_SERVER}/challenge?k={RECAPTCHA_PUBKEY}{RECAPTCHA_ERRORGET}">
// <![CDATA[
var RecaptchaOptions = {
lang : {L_RECAPTCHA_LANG}
};
// ]]>
</script>
<noscript>
<iframe src="{RECAPTCHA_SERVER}/noscript?k={RECAPTCHA_PUBKEY}{RECAPTCHA_ERRORGET}" height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>
</dl>
<!-- ELSE -->
{L_RECAPTCHA_NOT_AVAILABLE}
<!-- ENDIF -->

View File

@@ -0,0 +1,48 @@
<!-- INCLUDE overall_header.html -->
<a name="maincontent"></a>
<h1>{L_ACP_VC_SETTINGS}</h1>
<p>{L_ACP_VC_SETTINGS_EXPLAIN}</p>
<form id="acp_captcha" method="post" action="{U_ACTION}">
<fieldset>
<legend>{L_GENERAL_OPTIONS}</legend>
<dl>
<dt><label for="recaptcha_pubkey">{L_RECAPTCHA_PUBLIC}:</label><br /><span>{L_RECAPTCHA_PUBLIC_EXPLAIN}</span></dt>
<dd><input id="recaptcha_pubkey" name="recaptcha_pubkey" value="{RECAPTCHA_PUBKEY}" size="50" type="text" /></dd>
</dl>
<dl>
<dt><label for="recaptcha_privkey">{L_RECAPTCHA_PRIVATE}:</label><br /><span>{L_RECAPTCHA_PRIVATE_EXPLAIN}</span></dt>
<dd><input id="recaptcha_privkey" name="recaptcha_privkey" value="{RECAPTCHA_PRIVKEY}" size="50" type="text" /></dd>
</dl>
</fieldset>
<fieldset>
<legend>{L_PREVIEW}</legend>
<!-- IF PREVIEW -->
<div class="successbox">
<h3>{L_WARNING}</h3>
<p>{L_CAPTCHA_PREVIEW_MSG}</p>
</div>
<!-- ENDIF -->
{CAPTCHA_PREVIEW}
</fieldset>
<fieldset class="submit-buttons">
<legend>{L_SUBMIT}</legend>
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />&nbsp;
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />&nbsp;
<input type="hidden" name="select_captcha" value="{CAPTCHA_NAME}" />
<input type="hidden" name="configure" value="1" />
{S_FORM_TOKEN}
</fieldset>
</form>
<!-- INCLUDE overall_footer.html -->

View File

@@ -63,7 +63,7 @@
<p>{L_UPDATE_SUCCESS_EXPLAIN}</p>
<fieldset class="submit-buttons">
<input class="button1" type="submit" name="check_again" value="{L_CONTINUE_UPDATE}" />
<input class="button1" type="submit" name="check_again" value="{L_CHECK_FILES_AGAIN}" />
</fieldset>
</form>

View File

@@ -185,7 +185,8 @@ function switch_menu()
<a id="toggle-handle" accesskey="m" title="{L_MENU_TOGGLE}" onclick="switch_menu(); return false;" href="#"></a></div>
<!-- ENDIF -->
<div id="menu">
<p>{L_LOGGED_IN_AS}<br /><strong>{USERNAME}</strong> [&nbsp;<a href="{U_LOGOUT}">{L_LOGOUT}</a>&nbsp;][&nbsp;<a href="{U_ADM_LOGOUT}">{L_ADM_LOGOUT}</a>&nbsp;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p><!-- IF S_USER_LOGGED_IN --> {L_LOGGED_IN_AS}<br /><strong>{USERNAME}</strong> [&nbsp;<a href="{U_LOGOUT}">{L_LOGOUT}</a>&nbsp;]<!-- ENDIF --><!-- IF S_USER_ADMIN -->[&nbsp;<a href="{U_ADM_LOGOUT}">{L_ADM_LOGOUT}</a>&nbsp;]<!-- ENDIF --></p>
<!-- IF S_USER_ADMIN -->
<ul>
<!-- BEGIN l_block1 -->
<!-- IF l_block1.S_SELECTED -->
@@ -203,6 +204,7 @@ function switch_menu()
<!-- ENDIF -->
<!-- END l_block1 -->
</ul>
<!-- ENDIF -->
</div>
<div id="main">

View File

@@ -13,9 +13,9 @@
*/
define('IN_PHPBB', true);
define('ADMIN_START', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
if (!defined('PHPBB_ROOT_PATH')) define('PHPBB_ROOT_PATH', './../');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
// Start session management
$user->session_begin(false);
@@ -23,7 +23,7 @@ $auth->acl($user->data);
$user->setup();
// Set custom template for admin area
$template->set_custom_template($phpbb_root_path . 'adm/style', 'admin');
$template->set_custom_template(PHPBB_ROOT_PATH . CONFIG_ADM_FOLDER . '/style', 'admin');
$template->set_filenames(array(
'body' => 'colour_swatch.html')
@@ -39,7 +39,7 @@ $name = (!preg_match('/^[a-z0-9_-]+$/i', $name)) ? '' : $name;
$template->assign_vars(array(
'OPENER' => $form,
'NAME' => $name,
'T_IMAGES_PATH' => "{$phpbb_root_path}images/",
'T_IMAGES_PATH' => PHPBB_ROOT_PATH . 'images/',
'S_USER_LANG' => $user->lang['USER_LANG'],
'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'],

View File

@@ -6,7 +6,7 @@
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* Minimum Requirement: PHP 4.3.3
* Minimum Requirement: PHP 5.2.0+
*/
/**
@@ -21,6 +21,7 @@ $starttime = $starttime[1] + $starttime[0];
// Report all errors, except notices
error_reporting(E_ALL ^ E_NOTICE);
date_default_timezone_set('UTC');
/*
* Remove variables created by register_globals from the global scope
@@ -116,15 +117,15 @@ else
if (defined('IN_CRON'))
{
$phpbb_root_path = dirname(__FILE__) . DIRECTORY_SEPARATOR;
@define('PHPBB_ROOT_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
}
if (!file_exists($phpbb_root_path . 'config.' . $phpEx))
if (!file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT))
{
die("<p>The config.$phpEx file could not be found.</p><p><a href=\"{$phpbb_root_path}install/index.$phpEx\">Click here to install phpBB</a></p>");
die('<p>The config.' . PHP_EXT . ' file could not be found.</p><p><a href="' . PHPBB_ROOT_PATH . 'install/index.' . PHP_EXT . '">Click here to install phpBB</a></p>');
}
require($phpbb_root_path . 'config.' . $phpEx);
require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
if (!defined('PHPBB_INSTALLED'))
{
@@ -143,7 +144,7 @@ if (!defined('PHPBB_INSTALLED'))
// Replace any number of consecutive backslashes and/or slashes with a single slash
// (could happen on some proxy setups and/or Windows servers)
$script_path = trim(dirname($script_name)) . '/install/index.' . $phpEx;
$script_path = trim(dirname($script_name)) . '/install/index.' . PHP_EXT;
$script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path);
$url = (($secure) ? 'https://' : 'http://') . $server_name;
@@ -183,27 +184,30 @@ if (!empty($load_extensions))
}
// Include files
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx);
require($phpbb_root_path . 'includes/cache.' . $phpEx);
require($phpbb_root_path . 'includes/template.' . $phpEx);
require($phpbb_root_path . 'includes/session.' . $phpEx);
require($phpbb_root_path . 'includes/auth.' . $phpEx);
require(PHPBB_ROOT_PATH . 'includes/acm/acm_' . $acm_type . '.' . PHP_EXT);
require(PHPBB_ROOT_PATH . 'includes/cache.' . PHP_EXT);
require(PHPBB_ROOT_PATH . 'includes/template.' . PHP_EXT);
require(PHPBB_ROOT_PATH . 'includes/session.' . PHP_EXT);
require(PHPBB_ROOT_PATH . 'includes/auth.' . PHP_EXT);
require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
require(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
require(PHPBB_ROOT_PATH . 'includes/functions_content.' . PHP_EXT);
require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT);
require(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT);
require(PHPBB_ROOT_PATH . 'includes/utf/utf_tools.' . PHP_EXT);
// Set PHP error handler to ours
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
// enforce the use of the request class
request::disable_super_globals();
// Instantiate some basic classes
$user = new user();
$auth = new auth();
$template = new template();
$cache = new cache();
$cache = new acm();
$db = new $sql_db();
// Connect to DB
@@ -213,15 +217,15 @@ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('
unset($dbpasswd);
// Grab global variables, re-cache if necessary
$config = $cache->obtain_config();
$config = cache::obtain_config();
// Add own hook handler
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
require(PHPBB_ROOT_PATH . 'includes/hooks/index.' . PHP_EXT);
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
foreach ($cache->obtain_hooks() as $hook)
foreach (cache::obtain_hooks() as $hook)
{
@include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
@include(PHPBB_ROOT_PATH . 'includes/hooks/' . $hook . '.' . PHP_EXT);
}
?>

View File

View File

@@ -12,9 +12,9 @@
*/
define('IN_PHPBB', true);
define('IN_CRON', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
if (!defined('PHPBB_ROOT_PATH')) define('PHPBB_ROOT_PATH', './');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
// Do not update users last page entry
$user->session_begin(false);
@@ -74,7 +74,7 @@ switch ($cron_type)
{
case 'queue':
if (time() - $config['queue_interval'] <= $config['last_queue_run'] || !file_exists($phpbb_root_path . 'cache/queue.' . $phpEx))
if (time() - $config['queue_interval'] <= $config['last_queue_run'] || !file_exists(PHPBB_ROOT_PATH . 'cache/queue.' . PHP_EXT))
{
break;
}
@@ -85,7 +85,7 @@ switch ($cron_type)
$use_shutdown_function = false;
}
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT);
$queue = new queue();
if ($use_shutdown_function)
@@ -118,16 +118,16 @@ switch ($cron_type)
break;
case 'tidy_search':
// Select the search method
$search_type = basename($config['search_type']);
if (time() - $config['search_gc'] <= $config['search_last_gc'] || !file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx))
if (time() - $config['search_gc'] <= $config['search_last_gc'] || !file_exists(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT))
{
break;
}
include_once("{$phpbb_root_path}includes/search/$search_type.$phpEx");
include_once(PHPBB_ROOT_PATH . "includes/search/$search_type." . PHP_EXT);
// We do some additional checks in the module to ensure it can actually be utilised
$error = false;
@@ -156,7 +156,7 @@ switch ($cron_type)
break;
}
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT);
if ($use_shutdown_function)
{
@@ -176,7 +176,7 @@ switch ($cron_type)
break;
}
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT);
if ($use_shutdown_function)
{
@@ -226,7 +226,7 @@ switch ($cron_type)
// Do the forum Prune thang
if ($row['prune_next'] < time() && $row['enable_prune'])
{
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT);
if ($row['prune_days'])
{

View File

@@ -20,34 +20,10 @@
//
die("Please read the first lines of this script for instructions on how to enable it");
// This script adds missing permissions
$db = $dbhost = $dbuser = $dbpasswd = $dbport = $dbname = '';
define('IN_PHPBB', 1);
define('ANONYMOUS', 1);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
$phpbb_root_path='./../';
include($phpbb_root_path . 'config.'.$phpEx);
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.'.$phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
define('ACL_NEVER', 0);
define('ACL_YES', 1);
define('ACL_NO', -1);
define('ACL_GROUPS_TABLE', $table_prefix.'acl_groups');
define('ACL_OPTIONS_TABLE', $table_prefix.'acl_options');
define('ACL_USERS_TABLE', $table_prefix.'acl_users');
define('GROUPS_TABLE', $table_prefix.'groups');
define('USERS_TABLE', $table_prefix.'users');
$cache = new acm();
$db = new sql_db();
// Connect to DB
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
require(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
// auth => is_local, is_global
$f_permissions = array(
@@ -250,7 +226,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting)
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . "
WHERE group_name = '" . strtoupper($ug_id) . "'";
$result = $db->sql_query_limit($sql, 1);
$id = (int) $db->sql_fetchfield('group_id', 0, $result);
$id = (int) $db->sql_fetchfield('group_id', $result);
$db->sql_freeresult($result);
if (!$id)
@@ -414,4 +390,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting)
}
garbage_collection();
exit_handler();
?>

View File

@@ -9,9 +9,9 @@ die("Please read the first lines of this script for instructions on how to enabl
set_time_limit(0);
define('IN_PHPBB', true);
$phpbb_root_path = './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
// Start session management
$user->session_begin();
@@ -130,9 +130,9 @@ $db->sql_close();
function adjust_avatar($old_name, $midfix)
{
global $config, $phpbb_root_path;
global $config;
$avatar_path = $phpbb_root_path . $config['avatar_path'];
$avatar_path = PHPBB_ROOT_PATH . $config['avatar_path'];
$extension = strtolower(substr(strrchr($old_name, '.'), 1));
$new_name = $config['avatar_salt'] . '_' . $midfix . '.' . $extension;

View File

@@ -11,10 +11,10 @@ die("Please read the first lines of this script for instructions on how to enabl
set_time_limit(0);
define('IN_PHPBB', true);
$phpbb_root_path = './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/message_parser.' . $phpEx);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
include(PHPBB_ROOT_PATH . 'includes/message_parser.' . PHP_EXT);
// Start session management
$user->session_begin();

View File

@@ -10,9 +10,9 @@ die("Please read the first lines of this script for instructions on how to enabl
set_time_limit(0);
define('IN_PHPBB', true);
$phpbb_root_path = './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
// Start session management
$user->session_begin();

View File

@@ -13,9 +13,9 @@ set_time_limit(0);
@ini_set('memory_limit', '128M');
define('IN_PHPBB', true);
$phpbb_root_path = './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
// Start session management
$user->session_begin();

View File

@@ -7,9 +7,9 @@ die("Please read the first lines of this script for instructions on how to enabl
set_time_limit(0);
define('IN_PHPBB', true);
$phpbb_root_path = './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
// Start session management
$user->session_begin();

View File

@@ -12,9 +12,9 @@ set_time_limit(0);
@ini_set('memory_limit', '512M');
define('IN_PHPBB', true);
$phpbb_root_path = './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
// Start session management
$user->session_begin();

View File

@@ -9,9 +9,9 @@ die("Please read the first lines of this script for instructions on how to enabl
set_time_limit(0);
define('IN_PHPBB', true);
$phpbb_root_path = './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
// Start session management
$user->session_begin();

View File

@@ -1,462 +0,0 @@
<?php
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
//
// Do not change anything below this line.
//
$phpbb_root_path = "../";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/post.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
srand ((double) microtime() * 1000000);
set_time_limit(240*60);
// Here's the text we stick in posts..
$bigass_text = '
phpBB BBCode test suite v0.0.2
auto-linkification:
http://something.com
www.something.com
nate@phpbb.com
http://something.com/foo.php?this=that&theother=some%20encoded%20string is a link.
[code]
Simple code block with some <html> <tags>.
[/code]
[b]bolded[/b], [i]italic[/i]
[email]james@totalgeek.org[/email]
[url=http://www.totalgeek.org]totalgeek.org[/url]
[url]www.totalgeek.org[/url]
[list]
[*] This is the first bulleted item.
[*] This is the second bulleted item.
[/list]
[list=A]
[*] This is the first bulleted item.
[*] This is the second bulleted item.
[/list]
[quote]
And a quote!
[/quote]
';
// The script expects the ID's in the tables to sequential (1,2,3,4,5),
// so no holes please (1,4,5,8)...
$nr_of_users = nrof(USERS_TABLE);
$nr_of_cats = nrof(CATEGORIES_TABLE);
$nr_of_forums = nrof(FORUMS_TABLE);
$nr_of_posts = nrof(POSTS_TABLE);
$u = $users;
$starttime = microtime();
$usercreationcount = 0;
while($users > 0)
{
$name = "testuser_" . substr(md5(uniqid(rand())), 0, 10);
if (make_user($name))
{
$usercreationcount++;
$users--;
}
if (($usercreationcount % 500) == 0)
{
echo "status: $usercreationcount <br>\n";
flush();
}
}
if ($posts > 0)
{
filldb($posts);
}
$endtime = microtime();
if ($submit="" || !isset($submit))
{
?>
Hello, welcome to this little phpBB Benchmarking script :)<p>
At the moment there are:<br>
<table>
<tr><td align="right"><?php echo $nr_of_users?></td><td>Users</td></tr>
<tr><td align="right"><?php echo $nr_of_forums?></td><td>Forums</td></tr>
<tr><td align="right"><?php echo $nr_of_posts?></td><td>Posts</td></tr>
</table>
<p>
What do you want to create?<p>
<form method="get" action="<?php echo $PHP_SELF?>">
<input type="text" name="users" size="3"> Users<br>
<input type="text" name="posts" size="3"> Posts/topics (optional: post size in <input type="text" name="size" size="3"> bytes)<br>
<input type="submit" name="submit">
</form>
<?php
}
else
{
list ($starttime_msec,$starttime_sec) = explode(" ",$starttime);
list ($endtime_msec,$endtime_sec) = explode(" ",$endtime);
$timetaken_sec = ($endtime_sec+$endtime_msec) - ($starttime_sec+$starttime_msec);
print "<B>TIME TAKEN : ".$timetaken_sec."s</B><BR>\n";
print "<p>\n<a href=\"$PHP_SELF\">Back to the overview page</a>\n";
}
function filldb($newposts)
{
global $nr_of_forums;
global $nr_of_users;
$forum_topic_counts = array();
for ($i = 1; $i <= $nr_of_forums; $i++)
{
$forum_topic_counts[$i] = get_topic_count($i);
}
for($i = 0; $i < $newposts; $i++)
{
$userid = rand(2, $nr_of_users - 1);
$forum = rand(1,$nr_of_forums);
if ((rand(0,30) < 1) || ($forum_topic_count[$forum] == 0))
{
// create a new topic 1 in 30 times (or when there are none);
$topic = make_topic($userid, "Testing topic $i", $forum);
$forum_topic_count[$forum]++;
}
else
{
// Otherwise create a reply(posting) somewhere.
$topic = get_smallest_topic($forum);
create_posting($userid, $topic, $forum, "reply");
}
if (($i % 1000) == 0)
{
echo "status: $i <br>";
flush();
}
}
}
function get_smallest_topic($forum_id)
{
global $db;
$sql = "SELECT topic_id
FROM " . TOPICS_TABLE . "
WHERE (forum_id = $forum_id)
ORDER BY topic_replies ASC LIMIT 1";
if($result = $db->sql_query($sql))
{
$row = $db->sql_fetchrow($result);
$topic_id = $row['topic_id'];
unset($result);
unset($row);
return $topic_id;
}
else
{
message_die(GENERAL_ERROR, "Couldn't get smallest topic.", "", __LINE__, __FILE__, $sql);
}
}
function get_topic_count($forum_id)
{
global $db;
$sql = "SELECT forum_topics
FROM " . FORUMS_TABLE . "
WHERE (forum_id = $forum_id)";
if($result = $db->sql_query($sql))
{
$row = $db->sql_fetchrow($result);
$topic_count = $row['forum_topics'];
unset($result);
unset($row);
return $topic_count;
}
else
{
message_die(GENERAL_ERROR, "Couldn't get topic count.", "", __LINE__, __FILE__, $sql);
}
}
function make_topic($user_id, $subject, $forum_id)
{
global $db;
$topic_type = POST_NORMAL;
$topic_vote = 0;
$current_time = time();
$sql = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote)
VALUES ('$subject', $user_id, $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote)";
if( $result = $db->sql_query($sql, BEGIN_TRANSACTION) )
{
$new_topic_id = $db->sql_nextid();
}
else
{
message_die(GENERAL_ERROR, "Error inserting data into topics table", "", __LINE__, __FILE__, $sql);
}
create_posting($user_id, $new_topic_id, $forum_id);
return $new_topic_id;
}
function create_posting($userid, $topic_id, $forum, $mode='newtopic')
{
$message = generatepost();
return make_post($topic_id, $forum, $userid, "", $message, $mode);
}
function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $mode='newtopic')
{
global $db;
$current_time = time();
$user_ip = "ac100202";
$bbcode_on = 1;
$html_on = 1;
$smilies_on = 1;
$attach_sig = 1;
$bbcode_uid = make_bbcode_uid();
$post_subject = 'random subject';
$post_message = prepare_message($text, $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
$sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, attach_id, icon_id, post_username, post_time, poster_ip, post_approved, bbcode_uid, enable_bbcode, enable_html, enable_smilies, enable_sig, post_subject, post_text)
VALUES ($new_topic_id, $forum_id, $user_id, 0, 0, '$post_username', $current_time, '$user_ip', 1, '$bbcode_uid', $bbcode_on, $html_on, $smilies_on, $attach_sig, '$post_subject', '$post_message')";
$result = $db->sql_query($sql);
if ($result)
{
$new_post_id = $db->sql_nextid();
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_last_post_id = $new_post_id";
if($mode == "reply")
{
$sql .= ", topic_replies = topic_replies + 1 ";
}
$sql .= " WHERE topic_id = $new_topic_id";
if($db->sql_query($sql))
{
$sql = "UPDATE " . FORUMS_TABLE . "
SET forum_last_post_id = $new_post_id, forum_posts = forum_posts + 1";
if($mode == "newtopic")
{
$sql .= ", forum_topics = forum_topics + 1";
}
$sql .= " WHERE forum_id = $forum_id";
if($db->sql_query($sql))
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_posts = user_posts + 1
WHERE user_id = " . $user_id;
if($db->sql_query($sql, END_TRANSACTION))
{
// SUCCESS.
return true;
}
else
{
message_die(GENERAL_ERROR, "Error updating users table", "", __LINE__, __FILE__, $sql);
}
}
else
{
message_die(GENERAL_ERROR, "Error updating forums table", "", __LINE__, __FILE__, $sql);
}
}
else
{
// Rollback
if($db->sql_layer == "mysql")
{
$sql = "DELETE FROM " . POSTS_TABLE . "
WHERE post_id = $new_post_id";
$db->sql_query($sql);
}
message_die(GENERAL_ERROR, "Error updating topics table", "", __LINE__, __FILE__, $sql);
}
}
else
{
message_die(GENERAL_ERROR, "Error inserting data into posts table", "", __LINE__, __FILE__, $sql);
}
}
function generatepost($size=850)
{
global $bigass_text;
// Returns a string with a length between $size and $size*0.2
$size = rand(0.2*$size, $size);
$textsize = strlen($bigass_text);
$currentsize = 0;
// Add whole $text multiple times
while($currentsize < $size && $size-$currentsize <= $textsize)
{
$message .= $bigass_text;
$currentsize += $textsize;
}
// Add the remainder number of chars and return it.
$message .= substr($bigass_text, 0, $size-$currentsize);
return (addslashes($message));
}
function nrof($table)
{
global $db;
$sql = "SELECT count(*) AS counted FROM $table";
$result = $db->sql_query($sql);
$topics = $db->sql_fetchrow($result);
return $topics[counted];
}
function make_user($username)
{
global $db, $board_config;
$password = md5("benchpass");
$email = "nobody@localhost";
$icq = "12345678";
$website = "http://www.phpbb.com";
$occupation = "phpBB tester";
$location = "phpBB world hq";
$interests = "Eating, sleeping, living, and breathing phpBB";
$signature = "$username: phpBB tester.";
$signature_bbcode_uid = "";
$avatar_filename = "";
$viewemail = 0;
$aim = 0;
$yim = 0;
$msn = 0;
$attachsig = 1;
$allowsmilies = 1;
$allowhtml = 1;
$allowbbcode = 1;
$allowviewonline = 1;
$notifyreply = 0;
$notifypm = 0;
$user_timezone = $board_config['board_timezone'];
$user_dateformat = $board_config['default_dateformat'];
$user_lang = $board_config['default_lang'];
$user_style = $board_config['default_style'];
$sql = "SELECT MAX(user_id) AS total
FROM " . USERS_TABLE;
if($result = $db->sql_query($sql))
{
$row = $db->sql_fetchrow($result);
$new_user_id = $row['total'] + 1;
unset($result);
unset($row);
}
else
{
message_die(GENERAL_ERROR, "Couldn't obtained next user_id information.", "", __LINE__, __FILE__, $sql);
}
$sql = "SELECT MAX(group_id) AS total
FROM " . GROUPS_TABLE;
if($result = $db->sql_query($sql))
{
$row = $db->sql_fetchrow($result);
$new_group_id = $row['total'] + 1;
unset($result);
unset($row);
}
else
{
message_die(GENERAL_ERROR, "Couldn't obtained next user_id information.", "", __LINE__, __FILE__, $sql);
}
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmilies, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
VALUES ($new_user_id, '$username', " . time() . ", '$password', '$email', '$icq', '$website', '$occupation', '$location', '$interests', '$signature', '$signature_bbcode_uid', '$avatar_filename', $viewemail, '$aim', '$yim', '$msn', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $user_timezone, '$user_dateformat', '$user_lang', $user_style, 0, 1, ";
$sql .= "1, '')";
if($result = $db->sql_query($sql, BEGIN_TRANSACTION))
{
$sql = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_name, group_description, group_single_user, group_moderator)
VALUES ($new_group_id, '', 'Personal User', 1, 0)";
if($result = $db->sql_query($sql))
{
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending)
VALUES ($new_user_id, $new_group_id, 0)";
if($result = $db->sql_query($sql, END_TRANSACTION))
{
// SUCCESS.
return true;
}
else
{
message_die(GENERAL_ERROR, "Couldn't insert data into user_group table", "", __LINE__, __FILE__, $sql);
}
}
else
{
message_die(GENERAL_ERROR, "Couldn't insert data into groups table", "", __LINE__, __FILE__, $sql);
}
}
else
{
message_die(GENERAL_ERROR, "Couldn't insert data into users table", "", __LINE__, __FILE__, $sql);
}
}
?>

View File

@@ -21,22 +21,10 @@
die("Please read the first lines of this script for instructions on how to enable it");
@set_time_limit(300);
$db = $dbhost = $dbuser = $dbpasswd = $dbport = $dbname = '';
define('IN_PHPBB', 1);
define('ANONYMOUS', 1);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
$phpbb_root_path='./../';
include($phpbb_root_path . 'config.'.$phpEx);
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.'.$phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
$cache = new acm();
$db = new sql_db();
// Connect to DB
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
$start = 0;
do

View File

@@ -30,23 +30,9 @@ die("Please read the first lines of this script for instructions on how to enabl
@set_time_limit(2400);
// This script adds missing permissions
$db = $dbhost = $dbuser = $dbpasswd = $dbport = $dbname = '';
define('IN_PHPBB', 1);
define('ANONYMOUS', 1);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
$phpbb_root_path='./../';
include($phpbb_root_path . 'config.'.$phpEx);
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.'.$phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
$cache = new acm();
$db = new $sql_db();
// Connect to DB
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
$sql = "SELECT post_id, post_text FROM {$table_prefix}posts WHERE post_text LIKE '%{SMILE_PATH}%'";
$result = $db->sql_query($sql);

File diff suppressed because it is too large Load Diff

View File

@@ -21,10 +21,10 @@ die("Please read the first lines of this script for instructions on how to enabl
define('IN_PHPBB', true);
$phpbb_root_path = './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
include(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT);
set_time_limit(0);
header('Expires: 0');
@@ -117,14 +117,14 @@ switch ($mode)
if ($topic_id >= $num_topics)
{
echo '<meta http-equiv="refresh" content="10; url=fill.' . $phpEx . '?mode=sync&amp;' . time() . '">And now for something completely different...';
echo '<meta http-equiv="refresh" content="10; url=fill.' . PHP_EXT . '?mode=sync&amp;' . time() . '">And now for something completely different...';
$db->sql_query('ANALYZE TABLES ' . TOPICS_TABLE . ', ' . POSTS_TABLE);
flush();
}
else
{
echo '<meta http-equiv="refresh" content="10; url=fill.' . $phpEx . '?start=' . $topic_id . '&amp;' . time() . '">To the next page... (' . $topic_id . '/' . $num_topics . ')';
echo '<meta http-equiv="refresh" content="10; url=fill.' . PHP_EXT . '?start=' . $topic_id . '&amp;' . time() . '">To the next page... (' . $topic_id . '/' . $num_topics . ')';
flush();
}
break;
@@ -141,7 +141,7 @@ switch ($mode)
$e = explode(' ', microtime());
echo '<pre><b>' . ($e[0] + $e[1] - $s[0] - $s[1]) . '</b></pre>';
echo '<a href="fill.' . $phpEx . '">Here we go again</a>';
echo '<a href="fill.' . PHP_EXT . '">Here we go again</a>';
}
else
{
@@ -157,11 +157,11 @@ switch ($mode)
if ($end < $num_topics)
{
$start += $batch_size;
echo '<meta http-equiv="refresh" content="0; url=fill.' . $phpEx . "?mode=sync&amp;start=$start&amp;" . time() . "\">And now for something completely different... ($start/$num_topics)";
echo '<meta http-equiv="refresh" content="0; url=fill.' . PHP_EXT . "?mode=sync&amp;start=$start&amp;" . time() . "\">And now for something completely different... ($start/$num_topics)";
}
else
{
echo '<a href="fill.' . $phpEx . '">Here we go again</a>';
echo '<a href="fill.' . PHP_EXT . '">Here we go again</a>';
}
}

View File

@@ -25,8 +25,8 @@ die("Please read the first lines of this script for instructions on how to enabl
set_time_limit(0);
define('IN_PHPBB', true);
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
echo "Checking for required files\n";
download('http://unicode.org/Public/UNIDATA/CaseFolding.txt');
@@ -71,8 +71,8 @@ foreach ($array as $value)
foreach ($uniarray as $idx => $contents)
{
echo "Writing to case_fold_$idx.$phpEx\n";
$fp = fopen($phpbb_root_path . 'includes/utf/data/case_fold_' . strtolower($idx) . '.' . $phpEx, 'wb');
echo "Writing to case_fold_$idx." . PHP_EXT . "\n";
$fp = fopen(PHPBB_ROOT_PATH . 'includes/utf/data/case_fold_' . strtolower($idx) . '.' . PHP_EXT, 'wb');
fwrite($fp, '<?php return ' . my_var_export($contents) . ';');
fclose($fp);
}
@@ -116,9 +116,7 @@ function my_var_export($var)
*/
function download($url)
{
global $phpbb_root_path;
if (file_exists($phpbb_root_path . 'develop/' . basename($url)))
if (file_exists(PHPBB_ROOT_PATH . 'develop/' . basename($url)))
{
return;
}
@@ -130,7 +128,7 @@ function download($url)
die("Can't download from $url\nPlease download it yourself and put it in the develop/ dir, kthxbai");
}
if (!$fpw = fopen($phpbb_root_path . 'develop/' . basename($url), 'wb'))
if (!$fpw = fopen(PHPBB_ROOT_PATH . 'develop/' . basename($url), 'wb'))
{
die("Can't open develop/" . basename($url) . " for output... please check your permissions or something");
}

View File

@@ -25,8 +25,8 @@ die("Please read the first lines of this script for instructions on how to enabl
set_time_limit(0);
define('IN_PHPBB', true);
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
echo "Checking for required files\n";
download('http://unicode.org/reports/tr39/data/confusables.txt');
@@ -155,9 +155,9 @@ foreach ($array as $value)
$uniarray[utf8_chr(hexdec((string)$value[1]))] = $temp_hold;
}
echo "Writing to confusables.$phpEx\n";
echo "Writing to confusables." . PHP_EXT . "\n";
$fp = fopen($phpbb_root_path . 'includes/utf/data/confusables.' . $phpEx, 'wb');
$fp = fopen(PHPBB_ROOT_PATH . 'includes/utf/data/confusables.' . PHP_EXT, 'wb');
fwrite($fp, '<?php return ' . my_var_export($uniarray) . ';');
fclose($fp);
@@ -200,9 +200,7 @@ function my_var_export($var)
*/
function download($url)
{
global $phpbb_root_path;
if (file_exists($phpbb_root_path . 'develop/' . basename($url)))
if (file_exists(PHPBB_ROOT_PATH . 'develop/' . basename($url)))
{
return;
}
@@ -214,7 +212,7 @@ function download($url)
die("Can't download from $url\nPlease download it yourself and put it in the develop/ dir, kthxbai");
}
if (!$fpw = fopen($phpbb_root_path . 'develop/' . basename($url), 'wb'))
if (!$fpw = fopen(PHPBB_ROOT_PATH . 'develop/' . basename($url), 'wb'))
{
die("Can't open develop/" . basename($url) . " for output... please check your permissions or something");
}

View File

@@ -25,8 +25,8 @@ die("Please read the first lines of this script for instructions on how to enabl
set_time_limit(0);
define('IN_PHPBB', true);
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
echo "Checking for required files\n";
download('http://www.unicode.org/Public/UNIDATA/CompositionExclusions.txt');
@@ -34,7 +34,7 @@ download('http://www.unicode.org/Public/UNIDATA/DerivedNormalizationProps.txt');
download('http://www.unicode.org/Public/UNIDATA/UnicodeData.txt');
echo "\n";
require_once($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx);
require_once(PHPBB_ROOT_PATH . 'includes/utf/utf_normalizer.' . PHP_EXT);
$file_contents = array();
/**
@@ -172,7 +172,7 @@ fclose($fp);
* Do mappings
*/
echo "Loading Unicode decomposition mappings\n";
$fp = fopen($phpbb_root_path . 'develop/UnicodeData.txt', 'rt');
$fp = fopen(PHPBB_ROOT_PATH . 'develop/UnicodeData.txt', 'rt');
$map = array();
while (!feof($fp))
@@ -266,9 +266,9 @@ foreach ($file_contents as $file => $contents)
/**
* Generate a new file
*/
echo "Writing to $file.$phpEx\n";
echo "Writing to $file." . PHP_EXT . "\n";
if (!$fp = fopen($phpbb_root_path . 'includes/utf/data/' . $file . '.' . $phpEx, 'wb'))
if (!$fp = fopen(PHPBB_ROOT_PATH . 'includes/utf/data/' . $file . '.' . PHP_EXT, 'wb'))
{
trigger_error('Cannot open ' . $file . ' for write');
}
@@ -288,7 +288,7 @@ echo "\n*** UTF-8 normalization tables done\n\n";
*/
echo "Generating search indexer tables\n";
$fp = fopen($phpbb_root_path . 'develop/UnicodeData.txt', 'rt');
$fp = fopen(PHPBB_ROOT_PATH . 'develop/UnicodeData.txt', 'rt');
$map = array();
while ($line = fgets($fp, 1024))
@@ -406,8 +406,8 @@ unset($map);
foreach ($file_contents as $idx => $contents)
{
echo "Writing to search_indexer_$idx.$phpEx\n";
$fp = fopen($phpbb_root_path . 'includes/utf/data/search_indexer_' . $idx . '.' . $phpEx, 'wb');
echo "Writing to search_indexer_$idx." . PHP_EXT . "\n";
$fp = fopen(PHPBB_ROOT_PATH . 'includes/utf/data/search_indexer_' . $idx . '.' . PHP_EXT, 'wb');
fwrite($fp, '<?php return ' . my_var_export($contents) . ';');
fclose($fp);
}
@@ -486,9 +486,7 @@ function my_var_export($var)
*/
function download($url)
{
global $phpbb_root_path;
if (file_exists($phpbb_root_path . 'develop/' . basename($url)))
if (file_exists(PHPBB_ROOT_PATH . 'develop/' . basename($url)))
{
return;
}
@@ -500,7 +498,7 @@ function download($url)
die("Can't download from $url\nPlease download it yourself and put it in the develop/ dir, kthxbai");
}
if (!$fpw = fopen($phpbb_root_path . 'develop/' . basename($url), 'wb'))
if (!$fpw = fopen(PHPBB_ROOT_PATH . 'develop/' . basename($url), 'wb'))
{
die("Can't open develop/" . basename($url) . " for output... please check your permissions or something");
}

View File

@@ -24,13 +24,13 @@ die("Please read the first lines of this script for instructions on how to enabl
// Thanks to arod-1
define('IN_PHPBB', 1);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
$phpbb_root_path='./../';
include($phpbb_root_path . 'common.'.$phpEx);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
$mode = request_var('mode', '');
$modules = find_modules($phpbb_root_path . 'language/en');
$modules = find_modules(PHPBB_ROOT_PATH . 'language/en');
$kkeys = $keys = array();
$langdir = dirname(__FILE__);
@@ -81,7 +81,7 @@ while ($module = array_shift($keys))
}
$color = '';
if ((basename($module) == "common.$phpEx") || (basename($other_module) == "common.$phpEx"))
if ((basename($module) == "common." . PHP_EXT) || (basename($other_module) == "common." . PHP_EXT))
{
$color = ' style="color:#B00000;"';
}

View File

@@ -1,80 +0,0 @@
<?php
// -------------------------------------------------------------
//
// $Id$
//
// FILENAME : merge_attachment_tables.php
// STARTED : Tue Nov 04, 2003
// COPYRIGHT : <20> 2001, 2003 phpBB Group
// WWW : http://www.phpbb.com/
// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
//
// -------------------------------------------------------------
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
$db = $dbhost = $dbuser = $dbpasswd = $dbport = $dbname = '';
define('IN_PHPBB', 1);
define('ANONYMOUS', 1);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
$phpbb_root_path='./../';
include($phpbb_root_path . 'config.'.$phpEx);
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.'.$phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
$cache = new acm();
$db = new sql_db();
// Connect to DB
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
// Rename the attachments table...
$sql = "RENAME TABLE {$table_prefix}attachments TO {$table_prefix}attach_temp";
$db->sql_query($sql);
$sql = "CREATE TABLE {$table_prefix}attachments
SELECT d.*, a.post_id, a.user_id_from as poster_id, p.topic_id
FROM {$table_prefix}attach_desc d, {$table_prefix}attach_temp a, {$table_prefix}posts p
WHERE a.attach_id = d.attach_id
AND a.post_id = p.post_id";
$db->sql_query($sql);
switch ($db->sql_layer)
{
case 'mysql':
case 'mysql4':
$sql = 'ALTER TABLE ' . $table_prefix . 'attachments
ADD PRIMARY KEY (attach_id),
ADD INDEX filetime (filetime),
ADD INDEX post_id (post_id),
ADD INDEX poster_id (poster_id),
ADD INDEX physical_filename (physical_filename(10)),
ADD INDEX filesize (filesize),
ADD INDEX topic_id (topic_id),
MODIFY COLUMN attach_id mediumint(8) UNSIGNED NOT NULL auto_increment';
break;
case 'mssql':
case 'mssql-odbc':
case 'msaccess':
break;
case 'postgresql':
break;
}
$db->sql_query($sql);
//$db->sql_query("DROP TABLE {$table_prefix}attach_temp");
echo "<p><b>Done</b></p>\n";
?>

View File

@@ -1,209 +0,0 @@
<?php
/***************************************************************************
* merge_clean_posts.php
* -------------------
* begin : Tuesday, February 25, 2003
* copyright : (C) 2003 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
@set_time_limit(2400);
$db = $dbhost = $dbuser = $dbpasswd = $dbport = $dbname = '';
define('IN_PHPBB', 1);
define('ANONYMOUS', 1);
$phpbb_root_path='./../';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'config.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
require($phpbb_root_path . 'includes/acm/cache_' . $acm_type . '.'.$phpEx);
include($phpbb_root_path . 'db/' . $dbms . '.'.$phpEx);
$cache = new acm();
$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
// Just Do it (tm)
$sql = "RENAME TABLE {$table_prefix}posts TO {$table_prefix}posts_temp";
$db->sql_query($sql);
$sql = "CREATE TABLE {$table_prefix}posts
SELECT p.*, pt.post_subject, pt.post_text, pt.post_checksum, pt.bbcode_bitfield, pt.bbcode_uid
FROM {$table_prefix}posts_temp p, {$table_prefix}posts_text pt
WHERE pt.post_id = p.post_id";
$db->sql_query($sql);
switch ($db->sql_layer)
{
case 'mysql':
case 'mysql4':
$sql = 'ALTER TABLE ' . $table_prefix . 'posts
ADD PRIMARY KEY (post_id),
ADD INDEX topic_id (topic_id),
ADD INDEX poster_ip (poster_ip),
ADD INDEX post_approved (post_approved),
MODIFY COLUMN post_id mediumint(8) UNSIGNED NOT NULL auto_increment,
ADD COLUMN post_encoding varchar(11) DEFAULT \'iso-8859-15\' NOT NULL';
break;
case 'mssql':
case 'mssql-odbc':
case 'msaccess':
break;
case 'postgresql':
break;
}
$db->sql_query($sql);
$sql = "UPDATE {$table_prefix}topics SET topic_poster = 1 WHERE topic_poster = 0 OR topic_poster IS NULL";
$db->sql_query($sql);
$sql = "UPDATE {$table_prefix}topics SET topic_last_poster_id = 1 WHERE topic_last_poster_id = 0 OR topic_last_poster_id IS NULL";
$db->sql_query($sql);
$sql = "UPDATE {$table_prefix}posts SET poster_id = 1 WHERE poster_id = 0 OR poster_id IS NULL";
$db->sql_query($sql);
$sql = "UPDATE {$table_prefix}users SET user_id = 1 WHERE user_id = 0";
$db->sql_query($sql);
$sql = "SELECT t.topic_id
FROM {$table_prefix}topics t
LEFT JOIN {$table_prefix}posts p ON p.topic_id = t.topic_id
WHERE p.topic_id IS NULL";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
$del_sql = '';
do
{
$del_sql .= (($del_sql != '') ? ', ' : '') . $row['topic_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM {$table_prefix}topics
WHERE topic_id IN ($del_sql)";
$db->sql_query($sql);
}
$db->sql_freeresult($result);
$del_sql = '';
$sql = "SELECT topic_id, MIN(post_id) AS first_post_id, MAX(post_id) AS last_post_id, COUNT(post_id) AS total_posts
FROM {$table_prefix}posts
GROUP BY topic_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$del_sql .= (($del_sql != '') ? ', ' : '') . $row['topic_id'];
$sql = "UPDATE {$table_prefix}topics
SET topic_first_post_id = " . $row['first_post_id'] . ", topic_last_post_id = " . $row['last_post_id'] . ", topic_replies = " . ($row['total_posts'] - 1) . "
WHERE topic_id = " . $row['topic_id'];
$db->sql_query($sql);
}
$db->sql_freeresult($result);
$sql = "DELETE FROM {$table_prefix}topics WHERE topic_id NOT IN ($del_sql)";
$db->sql_query($sql);
$topic_count = $post_count = array();
$sql = "SELECT forum_id, COUNT(topic_id) AS topics
FROM {$table_prefix}topics
GROUP BY forum_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$topic_count[$row['forum_id']] = $row['topics'];
}
$db->sql_freeresult($result);
$sql = "SELECT forum_id, COUNT(post_id) AS posts
FROM {$table_prefix}posts
GROUP BY forum_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$post_count[$row['forum_id']] = $row['posts'];
}
$db->sql_freeresult($result);
switch ($db->sql_layer)
{
case 'oracle':
$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
FROM " . $table_prefix . "forums f, " . $table_prefix . "posts p, " . $table_prefix . "users u
WHERE p.post_id = f.forum_last_post_id(+)
AND u.user_id = p.poster_id(+)";
break;
default:
$sql = "SELECT f.forum_id, p.post_time, p.post_username, u.username, u.user_id
FROM ((" . $table_prefix . "forums f
LEFT JOIN " . $table_prefix . "posts p ON p.post_id = f.forum_last_post_id)
LEFT JOIN " . $table_prefix . "users u ON u.user_id = p.poster_id)";
break;
}
$result = $db->sql_query($sql);
$sql_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$forum_id = $row['forum_id'];
$sql_ary[] = "UPDATE " . $table_prefix . "forums
SET forum_last_poster_id = " . ((!empty($row['user_id']) && $row['user_id'] != ANONYMOUS) ? $row['user_id'] : ANONYMOUS) . ", forum_last_poster_name = '" . ((!empty($row['user_id']) && $row['user_id'] != ANONYMOUS) ? addslashes($row['username']) : addslashes($row['post_username'])) . "', forum_last_post_time = " . $row['post_time'] . ", forum_posts = " . (($post_count[$forum_id]) ? $post_count[$forum_id] : 0) . ", forum_topics = " . (($topic_count[$forum_id]) ? $topic_count[$forum_id] : 0) . "
WHERE forum_id = $forum_id";
$sql = "SELECT t.topic_id, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
FROM " . $table_prefix . "topics t, " . $table_prefix . "users u, " . $table_prefix . "posts p, " . $table_prefix . "posts p2, " . $table_prefix . "users u2
WHERE t.forum_id = $forum_id
AND u.user_id = t.topic_poster
AND p.post_id = t.topic_first_post_id
AND p2.post_id = t.topic_last_post_id
AND u2.user_id = p2.poster_id";
$result2 = $db->sql_query($sql);
while ($row2 = $db->sql_fetchrow($result2))
{
$sql_ary[] = "UPDATE " . $table_prefix . "topics
SET topic_poster = " . $row2['user_id'] . ", topic_first_poster_name = '" . ((!empty($row2['user_id']) && $row2['user_id'] != ANONYMOUS) ? addslashes($row2['username']) : addslashes($row2['post_username'])) . "', topic_last_poster_id = " . ((!empty($row2['id2']) && $row2['id2'] != ANONYMOUS) ? $row2['id2'] : ANONYMOUS) . ", topic_last_post_time = " . $row2['post_time'] . ", topic_last_poster_name = '" . ((!empty($row2['id2']) && $row2['id2'] != ANONYMOUS) ? addslashes($row2['user2']) : addslashes($row2['post_username2'])) . "'
WHERE topic_id = " . $row2['topic_id'];
}
$db->sql_freeresult($result2);
unset($row2);
}
$db->sql_freeresult($result);
foreach ($sql_ary as $sql)
{
$sql . "<br />";
$db->sql_query($sql);
}
echo "<p><b>Done</b></p>\n";
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,866 @@
<?php
define('IN_PHPBB', true);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
//$db = new dbal_mysqli();
class posting_api
{
/*
topic table:
topic_id
forum_id
topic_title
topic_status
topic_type
topic_shadow_id // to implement
sec:
topic_posts
topic_shadow_posts
topic_deleted_posts
topic_unapproved_posts
all must be approved:
topic_poster
topic_first_poster_name
topic_first_poster_id
topic_last_post_id
topic_last_poster_name
topic_last_poster_id
topic_last_post_title
topic_last_post_time
*/
/*
post table:
post_id
topic_id
post_subject
post_body
post_status
post_type
post_username
poster_id
forum_id
post_time
/*
forum table:
forum_id
forum_posts
forum_shadow_posts
forum_deleted_posts
forum_unapproved_posts
sec:
forum_topics
forum_shadow_topics
forum_deleted_topics
forum_unapproved_topics
forum_last_poster_name
forum_last_user_id
forum_last_post_title
forum_last_post_time
*/
const NORMAL = 0;
// status
const UNAPPROVED = 1;
const DELETED = 2;
// type
const ANNOUNCEMENT = 1;
const STICKY = 2;
// we, for now, only support the insertion of posts that are not already
// shadow'd and not deleted (it must first exist for it to be shadow'd or deleted!)
static function insert_topic($data)
{
global $db;
// one transaction, we can now garuntee that atomicity of insertions
$db->sql_transaction('begin');
$user_id = (int) $data['user_id'];
$forum_id = (int) $data['forum_id'];
$topic_title = $data['title'];
$post_contents = $data['post_contents'];
$topic_status = (int) $data['status'];
$topic_type = (int) $data['type'];
$approved = (bool) $data['approved'];
$shadow_forums = $data['shadow_forums'];
$time = ($data['time']) ? (int) $data['time'] : time();
if (isset($data['username']))
{
$username = $data['username'];
}
else
{
$sql = 'SELECT username
FROM ' . USERS_TABLE . '
WHERE user_id = ' . $user_id;
$result = $db->sql_query($sql);
$username = (string) $db->sql_fetchfield('username');
$db->sql_freeresult($result);
}
$sql = 'SELECT forum_topics, forum_unapproved_topics, forum_posts, forum_unapproved_posts
FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . (int) $forum_id;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// throw our topic to the dogs
$topic_data = array(
'topic_title' => $topic_title,
'topic_status' => $topic_status,
'topic_type' => $topic_type,
'topic_posts' => 1,
'topic_shadow_posts' => 0,
'topic_deleted_posts' => 0,
'topic_unapproved_posts' => ($approved) ? 0 : 1,
'topic_first_poster_name' => $username,
'topic_poster' => $user_id,
'topic_last_username' => $username,
'topic_last_post_title' => $topic_title,
'topic_last_post_time' => $time,
'topic_last_poster_id' => $user_id,
'forum_id' => $forum_id
);
$db->sql_handle_data('INSERT', TOPICS_TABLE, $topic_data);
$topic_id = $db->sql_nextid();
// I suppose it is time to make us a post, no?
$post_data = array(
'topic_id' => $topic_id,
'post_subject' => $topic_title,
'post_body' => $post_contents,
'post_username' => $username,
'poster_id' => $user_id,
'post_status' => $topic_status, // first post inherits its type from the topic
'post_type' => self::NORMAL, // for now, there are no shadow, global or sticky posts
'forum_id' => $forum_id
);
$db->sql_handle_data('INSERT', POSTS_TABLE, $post_data);
$post_id = $db->sql_nextid();
// time to fill in the blanks
$db->sql_handle_data('UPDATE', TOPICS_TABLE, array('topic_first_post_id' => $post_id, 'topic_last_post_id' => $post_id), "topic_id = $topic_id");
// let's go update the forum table
$forum_data = array(
'forum_posts' => ++$row['forum_posts'],
'forum_topics' => ++$row['forum_topics'],
);
// the last post inserted is always the latest,
// we must update the forum records to make sure everybody knows the good news
if ($approved)
{
$forum_data['forum_last_poster_name'] = $username;
$forum_data['forum_last_user_id'] = $user_id;
$forum_data['forum_last_post_title'] = $topic_title;
$forum_data['forum_last_post_time'] = $time;
}
else
{
$forum_data['forum_unapproved_posts'] = ++$row['forum_unapproved_posts'];
$forum_data['forum_unapproved_topics'] = ++$row['forum_unapproved_topics'];
}
$db->sql_handle_data('UPDATE', FORUMS_TABLE, $forum_data, "forum_id = $forum_id");
foreach ($shadow_forums as $shadow_forum_id)
{
$data['shadow_topic_id'] = $topic_id;
$data['forum_id'] = $shadow_forum_id;
self::insert_shadow_topic($data);
}
// we are consistant, victory is ours
$db->sql_transaction('commit');
}
// inserts a shadow topic into the database
static function insert_shadow_topic($data)
{
global $db;
// one transaction, we can now garuntee that atomicity of insertions
$db->sql_transaction('begin');
$user_id = (int) $data['user_id'];
$forum_id = (int) $data['forum_id'];
$topic_title = $data['title'];
$topic_status = (int) $data['status'];
$topic_type = (int) $data['type'];
$time = ($data['time']) ? (int) $data['time'] : time();
$shadow_topic_id = (int) $data['shadow_topic_id'];
$approved = (bool) $data['approved'];
if (isset($data['username']))
{
$username = $data['username'];
}
else
{
$sql = 'SELECT username
FROM ' . USERS_TABLE . '
WHERE user_id = ' . $user_id;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$username = $row['username'];
$db->sql_freeresult($result);
}
$sql = 'SELECT forum_topics, forum_shadow_topics
FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . (int) $forum_id;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// throw our topic to the dogs
$topic_data = array(
'topic_title' => $topic_title,
'topic_status' => $topic_status,
'topic_type' => $topic_type,
'topic_posts' => 0,
'topic_shadow_posts' => 0,
'topic_deleted_posts' => 0,
'topic_unapproved_posts' => ($approved ? 0 : 1),
'topic_first_poster_name' => $username,
'topic_poster' => $user_id,
'topic_last_username' => $username,
'topic_last_post_title' => $topic_title,
'topic_last_post_time' => $time,
'topic_last_poster_id' => $user_id,
'forum_id' => $forum_id,
'topic_shadow_id' => $shadow_topic_id
);
$db->sql_handle_data('INSERT', TOPICS_TABLE, $topic_data);
// let's go update the forum table
$forum_data = array(
'forum_topics' => ++$row['forum_topics'],
'forum_shadow_topics' => ++$row['forum_shadow_topics']
);
// an unapproved shadow topic? I suppose...
if (!$approved)
{
$forum_data['forum_unapproved_topics'] = ++$row['forum_unapproved_topics'];
}
$db->sql_handle_data('UPDATE', FORUMS_TABLE, $forum_data, "forum_id = $forum_id");
// we are consistant, victory is ours
$db->transaction('END');
}
static function insert_post($data)
{
global $db;
// one transaction, we can now garuntee that atomicity of insertions
$db->transaction('BEGIN');
$user_id = (int) $data['user_id'];
$topic_id = (int) $data['topic_id'];
// begin massive amounts of hand holding
if (isset($data['forum_id']))
{
$forum_id = (int) $data['forum_id'];
}
else
{
$sql = 'SELECT forum_id
FROM ' . TOPICS_TABLE . '
WHERE topic_id = ' . $topic_id;
$result = $db->sql_query($sql);
$forum_id = (int) $db->sql_fetchfield('forum_id');
$db->sql_freeresult($result);
}
$post_title = $data['title'];
$post_contents = $data['post_contents'];
$time = ($data['time']) ? (int) $data['time'] : time();
if (isset($data['username']))
{
$username = $data['username'];
}
else
{
$sql = 'SELECT username
FROM ' . USERS_TABLE . '
WHERE user_id = ' . $user_id;
$result = $db->sql_query($sql);
$username = (string) $db->sql_fetchfield('username');
$db->sql_freeresult($result);
}
// hand holding complete, lets write some posts
$sql = 'SELECT forum_topics, forum_unapproved_topics, forum_posts, forum_unapproved_posts
FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . (int) $forum_id;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$post_status = (int) $data['post_status'];
$approved = ($post_status === self::NORMAL);
// I suppose it is time to make us a post, no?
$post_data = array(
'topic_id' => $topic_id,
'post_subject' => $post_title,
'post_body' => $post_contents,
'post_username' => $username,
'poster_id' => $user_id,
'post_status' => $post_status,
'forum_id' => $forum_id,
);
$db->sql_handle_data('INSERT', POSTS_TABLE, $post_data);
// what is the new post_id?
$post_id = $db->sql_nextid();
// iceberg ahead! we must only update the topic information if the post is approved ;)
if ($approved)
{
// time to fill in the blanks
$topics_data = array(
'topic_last_poster_id' => $user_id,
'topic_last_post_id' => $post_id,
'topic_last_poster_name'=> $username,
'topic_last_post_title' => $post_title,
'topic_last_post_time' => $time,
);
$db->sql_handle_data('UPDATE', TOPICS_TABLE, $topics_data, "topic_id = $topic_id");
}
// let's go update the forum table
$forum_data = array(
'forum_posts' => ++$row['forum_posts'],
);
// the last post inserted is always the latest,
// we must update the forum records to make sure everybody knows the good news
if ($approved)
{
$forum_data['forum_last_poster_name'] = $username;
$forum_data['forum_last_user_id'] = $user_id;
$forum_data['forum_last_post_title'] = $post_title;
$forum_data['forum_last_post_time'] = $time;
}
else
{
$forum_data['forum_unapproved_posts'] = ++$row['forum_unapproved_posts'];
}
$db->sql_handle_data('UPDATE', FORUMS_TABLE, $forum_data, "forum_id = $forum_id");
// we are consistant, victory is ours
$db->sql_transaction('commit');
}
static function delete_topic($data)
{
// just call the more powerful variant with just one topic :)
self::delete_topics(array('topic_ids' => array($data['topic_id'])));
}
static function delete_topics($data)
{
global $db;
// lets get this party started
$db->sql_transaction('begin');
$topic_ids = array_map('intval', $data['topic_ids']);
// what kind of topic is this? lets find out how much we must tamper with the forum table...
// TODO: investigate how aggregate functions can speed this up/reduce the number of results returned/misc. other benefits
$sql = 'SELECT topic_posts, topic_shadow_posts, topic_deleted_posts, topic_unapproved_posts, topic_shadow_id, forum_id, topic_status
FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('topic_id', $topic_ids);
$result = $db->sql_query($sql);
// the following in an array, key'd by forum id that refers to topic rows
$forum_lookup = array();
while ($topic_row = $db->sql_fetchrow($result))
{
$forum_id = (int) $topic_row['forum_id'];
// deal with posts
$forum_lookup[$forum_id]['forum_posts'] += $topic_row['topic_posts'];
$forum_lookup[$forum_id]['forum_shadow_posts'] += $topic_row['topic_shadow_posts'];
$forum_lookup[$forum_id]['forum_deleted_posts'] += $topic_row['topic_deleted_posts'];
$forum_lookup[$forum_id]['forum_unapproved_posts'] += $topic_row['topic_unapproved_posts'];
// deal with topics
$topic_status = (int) $topic_row['topic_status'];
$forum_lookup[$forum_id]['forum_topics']++; // a topic is a topic
$forum_lookup[$forum_id]['forum_shadow_topics'] += ($topic_row['topic_shadow_id'] != 0);
$forum_lookup[$forum_id]['forum_deleted_topics'] += ($topic_status & self::DELETED);
$forum_lookup[$forum_id]['forum_unapproved_topics'] += ($topic_status & self::UNAPPROVED);
}
$db->sql_freeresult($result);
// goodnight, topics
$db->sql_query('DELETE FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids));
// goodnight, posts
$db->sql_query('DELETE FROM ' . POSTS_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids));
$forum_ids = array_keys($forum_lookup);
// what kind of topic is this? lets find out how much we must tamper with the forum table...
$sql = 'SELECT forum_posts, forum_shadow_posts, forum_deleted_posts, forum_unapproved_posts, forum_id
FROM ' . FORUMS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_ids);
$result = $db->sql_query($sql);
$forum_rows = array();
while ($forum_row = $db->sql_fetchrow($result))
{
$forum_id = (int) $forum_row['forum_id'];
$forum_rows[$forum_id] = $forum_row;
}
$db->sql_freeresult($result);
$shadow_topic_ids = array();
foreach ($forum_rows as $forum_id => $forum_row)
{
$topic_row = $forum_lookup[$forum_id];
$forum_array = array(
'forum_posts' => max($forum_row['forum_posts'] - $topic_row['forum_posts'], 0),
'forum_shadow_posts' => max($forum_row['forum_shadow_posts'] - $topic_row['forum_shadow_posts'], 0),
'forum_deleted_posts' => max($forum_row['forum_deleted_posts'] - $topic_row['forum_deleted_posts'], 0),
'forum_unapproved_posts' => max($forum_row['forum_unapproved_posts'] - $topic_row['forum_unapproved_posts'], 0),
'forum_topics' => max($forum_row['forum_topics'] - $topic_row['forum_topics'], 0),
'forum_shadow_topics' => max($forum_row['forum_shadow_topics'] - $topic_row['forum_shadow_topics'], 0),
'forum_deleted_topics' => max($forum_row['forum_deleted_topics'] - $topic_row['forum_deleted_topics'], 0),
'forum_unapproved_topics' => max($forum_row['forum_unapproved_topics'] - $topic_row['forum_unapproved_topics'], 0),
);
// get the last "normal" post in the forum, we _must_ update it
$sql = 'SELECT MAX(post_id) as max_post_id
FROM ' . POSTS_TABLE . '
WHERE post_status = ' . self::NORMAL . '
AND forum_id = ' . $forum_id;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// anything left?
if ($row)
{
// OK, lets go do some magick
$sql = 'SELECT post_username, poster_id, post_subject, post_time
FROM '. POSTS_TABLE . '
WHERE post_id = ' . (int) $row['max_post_id'];
$result = $db->sql_query($sql);
$last_post = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$forum_array['forum_last_user_id'] = (int) $last_post['poster_id'];
$forum_array['forum_last_poster_name'] = $last_post['post_username'];
$forum_array['forum_last_post_title'] = $last_post['post_subject'];
$forum_array['forum_last_post_time'] = (int) $last_post['post_time'];
}
else
{
// reset forum state
$forum_array['forum_last_user_id'] = 0;
$forum_array['forum_last_poster_name'] = '';
$forum_array['forum_last_post_title'] = '';
$forum_array['forum_last_post_time'] = 0;
}
$db->sql_handle_data('UPDATE', FORUMS_TABLE, $forum_array, "forum_id = $forum_id");
}
// let's not get too hasty, we can kill off the shadows later,
// instead we compose a list of all shadows and then efficiently kill them off :)
$sql = 'SELECT topic_id
FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('topic_shadow_id', $topic_ids);
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$shadow_topic_ids[] = $row['topic_id'];
}
$db->sql_freeresult($result);
// recursion, the other white meat.
if (sizeof($shadow_topic_ids))
{
self::delete_topics(array('topic_ids' => $shadow_topic_ids));
}
// goodnight, moon
$db->transaction('commit');
}
static function delete_post($data)
{
// just call the more powerful variant with just one post :)
self::delete_posts(array('post_ids' => array($data['post_id'])));
}
static function delete_posts($data)
{
global $db;
// lets get this party started
$db->sql_transaction('begin');
$post_ids = array_map('intval', $data['post_ids']);
$sql = 'SELECT topic_id, post_status, post_id, post_shadow_id, forum_id
FROM ' . POSTS_TABLE . '
WHERE ' . $db->sql_in_set('post_id', $post_ids);
$result = $db->sql_query($sql);
// the following arrays are designed to allow for much faster updates
$topic_lookup = array();
$forum_lookup = array();
while ($post_row = $db->sql_fetchrow($result))
{
$topic_id = (int) $post_row['topic_id'];
$forum_id = (int) $post_row['forum_id'];
$post_status = (int) $post_row['post_status'];
$topic_lookup[$topic_id]['topic_posts']++; // we remove a post, go figure
$topic_lookup[$topic_id]['topic_shadow_posts'] += ($post_row['post_shadow_id'] != 0); // did we just try to kill a shadow post?!
$topic_lookup[$topic_id]['topic_deleted_posts'] += ($post_status & self::DELETED);
$topic_lookup[$topic_id]['topic_unapproved_posts'] += ($post_status & self::UNAPPROVED);
$forum_lookup[$forum_id]['forum_posts']++;
$forum_lookup[$topic_id]['forum_shadow_posts'] += ($post_row['post_shadow_id'] != 0); // did we just try to kill a shadow post?!
$forum_lookup[$topic_id]['forum_deleted_posts'] += ($post_status & self::DELETED);
$forum_lookup[$topic_id]['forum_unapproved_posts'] += ($post_status & self::UNAPPROVED);
}
$db->sql_freeresult($result);
$topic_ids = array_keys($forum_lookup);
// goodnight, posts
$db->sql_query('DELETE FROM ' . POSTS_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids));
// mangle the forums table
$sql = 'SELECT forum_posts, forum_shadow_posts, forum_deleted_posts, forum_unapproved_posts, forum_id
FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . $forum_id;
$result = $db->sql_query($sql);
$forum_rows = array();
while ($forum_row = $db->sql_fetchrow($result))
{
$forum_id = (int) $forum_row['forum_id'];
$forum_rows[$forum_id] = $forum_row;
}
$db->sql_freeresult($result);
$shadow_topic_ids = array();
foreach ($forum_rows as $forum_id => $forum_row)
{
$topic_row = $forum_lookup[$forum_id];
$forum_array = array(
'forum_posts' => max($forum_row['forum_posts'] - $topic_row['forum_posts'], 0),
'forum_shadow_posts' => max($forum_row['forum_shadow_posts'] - $topic_row['forum_shadow_posts'], 0),
'forum_deleted_posts' => max($forum_row['forum_deleted_posts'] - $topic_row['forum_deleted_posts'], 0),
'forum_unapproved_posts' => max($forum_row['forum_unapproved_posts'] - $topic_row['forum_unapproved_posts'], 0),
);
// get the last "normal" post in the forum, we _must_ update it
$sql = 'SELECT MAX(post_id) as max_post_id
FROM ' . POSTS_TABLE . '
WHERE post_status = ' . self::NORMAL . '
AND forum_id = ' . $forum_id;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// anything left?
if ($row)
{
// OK, lets go do some magick
$sql = 'SELECT post_username, poster_id, post_subject, post_time
FROM '. POSTS_TABLE . '
WHERE post_id = ' . (int) $row['max_post_id'];
$result = $db->sql_query($sql);
$last_post = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$forum_array['forum_last_user_id'] = (int) $last_post['poster_id'];
$forum_array['forum_last_poster_name'] = $last_post['post_username'];
$forum_array['forum_last_post_title'] = $last_post['post_subject'];
$forum_array['forum_last_post_time'] = (int) $last_post['post_time'];
}
else
{
// reset forum state
$forum_array['forum_last_user_id'] = 0;
$forum_array['forum_last_poster_name'] = '';
$forum_array['forum_last_post_title'] = '';
$forum_array['forum_last_post_time'] = 0;
}
$db->sql_handle_data('UPDATE', FORUMS_TABLE, $forum_array, "forum_id = $forum_id");
}
// mangle the topics table now :)
$sql = 'SELECT topic_posts, topic_shadow_posts, topic_deleted_posts, topic_unapproved_posts, topic_id
FROM ' . TOPICS_TABLE . '
WHERE forum_id = ' . $forum_id;
$result = $db->sql_query($sql);
$topic_rows = array();
while ($topic_row = $db->sql_fetchrow($result))
{
$topic_id = (int) $topic_row['topic_id'];
$topic_rows[$topic_id] = $topic_row;
}
$db->sql_freeresult($result);
$empty_topic_ids = array();
foreach ($topic_rows as $topic_id => $topic_row)
{
$post_row = $topic_lookup[$topic_id];
$topic_array = array(
'topic_posts' => max($topic_row['topic_posts'] - $post_row['topic_posts'], 0),
'topic_shadow_posts' => max($topic_row['topic_shadow_posts'] - $post_row['topic_shadow_posts'], 0),
'topic_deleted_posts' => max($topic_row['topic_deleted_posts'] - $post_row['topic_deleted_posts'], 0),
'topic_unapproved_posts' => max($topic_row['topic_unapproved_posts'] - $post_row['topic_unapproved_posts'], 0),
);
// get the last "normal" post in the topic, we _must_ update it
$sql = 'SELECT MAX(post_id) as max_post_id
FROM ' . POSTS_TABLE . '
WHERE post_status = ' . self::NORMAL . '
AND topic_id = ' . $topic_id;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// anything left?
if ($row)
{
// OK, lets go do some magick
$sql = 'SELECT post_username, poster_id, post_subject, post_time
FROM '. POSTS_TABLE . '
WHERE post_id = ' . (int) $row['max_post_id'];
$result = $db->sql_query($sql);
$last_post = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$topic_array['topic_last_user_id'] = (int) $last_post['poster_id'];
$topic_array['topic_last_poster_name'] = $last_post['post_username'];
$topic_array['topic_last_post_title'] = $last_post['post_subject'];
$topic_array['topic_last_post_time'] = (int) $last_post['post_time'];
}
else
{
// mark this post for execution!
$empty_topic_ids[] = $topic_id;
}
$db->sql_handle_data('UPDATE', TOPICS_TABLE, $topic_array, "topic_id = $topic_id");
}
$shadow_post_ids = array();
// let's not get too hasty, we can kill off the shadows later,
// instead we compose a list of all shadows and then efficiently kill them off :)
$sql = 'SELECT post_id
FROM ' . POSTS_TABLE . '
WHERE ' . $db->sql_in_set('post_shadow_id', $topic_ids);
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$shadow_post_ids[] = $row['post_id'];
}
$db->sql_freeresult($result);
// recursion, the other white meat.
if (sizeof($shadow_topic_ids))
{
self::delete_posts(array('post_ids' => $shadow_post_ids));
}
// we killed all the posts in a topic, time to kill the topics!
if (sizeof($empty_topic_ids))
{
self::delete_topics(array('topic_ids' => $empty_topic_ids));
}
// goodnight, moon
$db->transaction('commit');
}
static function move_topic($data)
{
self::move_topics(array('topic_forum_mapping' => array(array('topic_id' => $data['topic_id'], 'forum_id' => $data['forum_id'], 'make_shadow' => $data['make_shadow']))));
}
static function move_topics($data)
{
global $db;
// lets get this party started
$db->transaction('begin');
// all of each are indexed by topic id
$to_forum_ids = $shadow_topic_ids = array();
foreach ($data['topic_forum_mapping'] as $mapping)
{
$topic_id = (int) $mapping['topic_id'];
$to_forum_ids[$topic_id] = (int) $mapping['forum_id'];
if ($mapping['make_shadow'])
{
$shadow_topic_ids[] = $topic_id;
}
}
$forum_columns = array('forum_posts', 'forum_shadow_posts', 'forum_deleted_posts', 'forum_unapproved_posts', 'forum_topics', 'forum_shadow_topics', 'forum_deleted_topics', 'forum_unapproved_topics');
$topic_ids = array_keys($to_forum_ids);
// let us first determine how many items we are removing from the pool
$sql = 'SELECT topic_posts, topic_shadow_posts, topic_deleted_posts, topic_unapproved_posts, forum_id, topic_status, topic_type, topic_shadow_id, topic_id
FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('topic_id', $topic_ids);
$result = $db->sql_query($sql);
$forum_lookup = array();
while ($topic_row = $db->sql_fetchrow($result))
{
$topic_id = $topic_row['topic_id'];
$from_forum_id = (int) $topic_row['forum_id'];
$to_forum_id = $to_forum_ids[$topic_id];
// we are iterating one topic at a time...
$forum_lookup[$from_forum_id]['forum_topics'] = $forum_lookup[$to_forum_id]['forum_topics'] = 1;
foreach ($forum_columns as $column)
{
$forum_lookup[$from_forum_id][$column] -= $topic_row['topic_posts'];
$forum_lookup[$to_forum_id][$column] += $topic_row['topic_posts'];
}
}
$db->sql_freeresult($result);
// determine the totals
$sql = 'SELECT forum_posts, forum_shadow_posts, forum_deleted_posts, forum_unapproved_posts, forum_id, forum_topics, forum_deleted_topics, forum_unapproved_topics
FROM ' . FORUMS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', array_keys($forum_lookup));
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$forum_id = (int) $row['forum_id'];
foreach ($forum_columns as $column)
{
$forum_lookup[$forum_id][$column] += (int) $row[$column];
}
}
// create a listing of which topics are going in which forums
$update_list = array();
foreach ($to_forum_ids as $topic_id => $forum_id)
{
$update_list[$forum_id][] = $topic_id;
}
// we save as many queries as we can by updating all similar topics at once
foreach ($update_list as $forum_id => $topic_ids)
{
// update the topic itself
$db->sql_handle_data('UPDATE', TOPICS_TABLE, array('forum_id' => $to_forum_id), $db->sql_in_set('topic_id', $topic_ids));
// update the posts now
$db->sql_handle_data('UPDATE', POSTS_TABLE, array('forum_id' => $to_forum_id), $db->sql_in_set('topic_id', $topic_ids));
}
// start building the needed arrays for updating the forum data
foreach ($forum_lookup as $forum_id => $forum_data)
{
foreach ($forum_columns as $column)
{
$forum_data[$column] = max($forum_data[$column], 0); // ensure the result is unsigned
}
// get the last "normal" post in the old forum, we _must_ update it
$sql = 'SELECT MAX(post_id) as max_post_id
FROM ' . POSTS_TABLE . '
WHERE post_status = ' . self::NORMAL . '
AND forum_id = ' . $forum_id;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// anything left?
if ($row)
{
// OK, lets go do some magick
$sql = 'SELECT post_username, poster_id, post_subject, post_time
FROM '. POSTS_TABLE . '
WHERE post_id = ' . (int) $row['max_post_id'];
$result = $db->sql_query($sql);
$last_post = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$forum_data['forum_last_user_id'] = (int) $last_post['poster_id'];
$forum_data['forum_last_poster_name'] = $last_post['post_username'];
$forum_data['forum_last_post_title'] = $last_post['post_subject'];
$forum_data['forum_last_post_time'] = (int) $last_post['post_time'];
}
else
{
// reset forum state
$forum_data['forum_last_user_id'] = 0;
$forum_data['forum_last_poster_name'] = '';
$forum_data['forum_last_post_title'] = '';
$forum_data['forum_last_post_time'] = 0;
}
// update the old forum
$db->sql_handle_data('UPDATE', FORUMS_TABLE, $forum_data, "forum_id = $forum_id");
}
// hooray for code reuse!
foreach ($shadow_topic_ids as $topic_id)
{
$data['shadow_topic_id'] = $topic_id;
$data['forum_id'] = $from_forum_id;
self::insert_shadow_topic($data);
}
$db->sql_transaction('commit');
}
}
?>

View File

@@ -80,4 +80,4 @@ echo 'www.URL: ' . $www_url . "<br />\n";
$relative_url = "$segment$path_abempty(?:\?$query)?(?:\#$fragment)?";
echo 'relative URL: ' . $relative_url . "<br />\n";
?>
?>

View File

@@ -11,10 +11,10 @@ die("Please read the first lines of this script for instructions on how to enabl
set_time_limit(0);
define('IN_PHPBB', true);
$phpbb_root_path = './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . '/includes/functions_user.'.$phpEx);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
// Start session management
@@ -98,7 +98,7 @@ function add_bots($bots)
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'";
$result = $db->sql_query($sql);
$group_id = (int) $db->sql_fetchfield('group_id', false, $result);
$group_id = (int) $db->sql_fetchfield('group_id', $result);
$db->sql_freeresult($result);
$db->sql_query('TRUNCATE TABLE ' . BOTS_TABLE);
@@ -108,7 +108,7 @@ function add_bots($bots)
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'";
$result = $db->sql_query($sql);
$group_id = (int) $db->sql_fetchfield('group_id', false, $result);
$group_id = (int) $db->sql_fetchfield('group_id', $result);
$db->sql_freeresult($result);
}

View File

@@ -23,9 +23,9 @@ die("Please read the first lines of this script for instructions on how to enabl
set_time_limit(0);
define('IN_PHPBB', true);
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
// Start session management
$user->session_begin();
@@ -34,12 +34,12 @@ $user->setup();
$search_type = $config['search_type'];
if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx))
if (!file_exists(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT))
{
trigger_error('NO_SUCH_SEARCH_MODULE');
}
require($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx);
require(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT);
$error = false;
$search = new $search_type($error);

View File

@@ -98,8 +98,7 @@ function utf8_normalize_nfkc($strings)
if (!class_exists('utf_normalizer'))
{
global $phpbb_root_path, $phpEx;
include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/utf/utf_normalizer.' . PHP_EXT);
}
if (!is_array($strings))

View File

@@ -26,8 +26,8 @@ set_time_limit(0);
error_reporting(E_ALL);
define('IN_PHPBB', true);
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
define('PHPBB_ROOT_PATH', './../');
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
/**
@@ -77,13 +77,13 @@ $test_suite = array(
)
);
require_once($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx);
require_once(PHPBB_ROOT_PATH . 'includes/utf/utf_normalizer.' . PHP_EXT);
$i = $n = 0;
$failed = false;
$tested_chars = array();
$fp = fopen($phpbb_root_path . 'develop/NormalizationTest.txt', 'rb');
$fp = fopen(PHPBB_ROOT_PATH . 'develop/NormalizationTest.txt', 'rb');
while (!feof($fp))
{
$line = fgets($fp);
@@ -158,7 +158,7 @@ fclose($fp);
*/
echo "\n\nTesting for invariants...\n\n";
$fp = fopen($phpbb_root_path . 'develop/UnicodeData.txt', 'rt');
$fp = fopen(PHPBB_ROOT_PATH . 'develop/UnicodeData.txt', 'rt');
$n = 0;
while (!feof($fp))
@@ -184,21 +184,21 @@ while (!feof($fp))
$utf_expected = hex_to_utf($hex_expected);
if ($utf_expected >= UTF8_SURROGATE_FIRST
&& $utf_expected <= UTF8_SURROGATE_LAST)
if ($utf_expected >= utf_normalizer::UTF8_SURROGATE_FIRST
&& $utf_expected <= utf_normalizer::UTF8_SURROGATE_LAST)
{
/**
* Surrogates are illegal on their own, we expect the normalizer
* to return a replacement char
*/
$utf_expected = UTF8_REPLACEMENT;
$utf_expected = utf_normalizer::UTF8_REPLACEMENT;
$hex_expected = utf_to_hexseq($utf_expected);
}
foreach (array('nfc', 'nfkc', 'nfd', 'nfkd') as $form)
{
$utf_result = $utf_expected;
utf_normalizer::$form($utf_result);
call_user_func(array('utf_normalizer', $form), $utf_result);
$hex_result = utf_to_hexseq($utf_result);
// echo "$form($utf_expected) == $utf_result\n";
@@ -227,9 +227,7 @@ die("\n\nALL TESTS PASSED SUCCESSFULLY\n");
*/
function download($url)
{
global $phpbb_root_path;
if (file_exists($phpbb_root_path . 'develop/' . basename($url)))
if (file_exists(PHPBB_ROOT_PATH . 'develop/' . basename($url)))
{
return;
}
@@ -241,7 +239,7 @@ function download($url)
die("Can't download from $url\nPlease download it yourself and put it in the develop/ dir, kthxbai");
}
if (!$fpw = fopen($phpbb_root_path . 'develop/' . basename($url), 'wb'))
if (!$fpw = fopen(PHPBB_ROOT_PATH . 'develop/' . basename($url), 'wb'))
{
die("Can't open develop/" . basename($url) . " for output... please check your permissions or something");
}

View File

@@ -1,815 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="content-language" content="en" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="resource-type" content="document" />
<meta name="distribution" content="global" />
<meta name="copyright" content="2007 phpBB Group" />
<meta name="keywords" content="" />
<meta name="description" content="phpBB 3.0.x Changelog" />
<title>phpBB3 &bull; Changelog</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css" media="screen, projection" />
</head>
<body id="phpbb" class="section-docs">
<div id="wrap">
<a id="top" name="top" accesskey="t"></a>
<div id="page-header">
<div class="headerbar">
<div class="inner"><span class="corners-top"><span></span></span>
<div id="doc-description">
<a href="../index.php" id="logo"><img src="site_logo.gif" alt="" /></a>
<h1>phpBB 3.0.x Changelog</h1>
<p style="display: none;"><a href="#start_here">Skip</a></p>
</div>
<span class="corners-bottom"><span></span></span></div>
</div>
</div>
<a name="start_here"></a>
<div id="page-body">
<!-- BEGIN DOCUMENT -->
<p>This is a non-exhaustive (but still near complete) changelog for phpBB 3.0.x including release candidate versions. Our thanks to all those people who've contributed bug reports and code fixes.</p>
<h1>Changelog</h1>
<div class="paragraph menu">
<div class="inner"><span class="corners-top"><span></span></span>
<div class="content">
<ol>
<li><a href="#changelog">Changelog</a>
<ol style="list-style-type: lower-roman;">
<li><a href="#v303">Changes since 3.0.3</a></li>
<li><a href="#v302">Changes since 3.0.2</a></li>
<li><a href="#v301">Changes since 3.0.1</a></li>
<li><a href="#v300">Changes since 3.0.0</a></li>
<li><a href="#v30rc8">Changes since RC-8</a></li>
<li><a href="#v30rc7">Changes since RC-7</a></li>
<li><a href="#v30rc6">Changes since RC-6</a></li>
<li><a href="#v30rc5">Changes since RC-5</a></li>
<li><a href="#v30rc4">Changes since RC-4</a></li>
<li><a href="#v30rc3">Changes since RC-3</a></li>
<li><a href="#v30rc2">Changes since RC-2</a></li>
<li><a href="#v30rc1">Changes since RC-1</a></li>
</ol>
</li>
<li><a href="#disclaimer">Copyright and disclaimer</a></li>
</ol>
</div>
<span class="corners-bottom"><span></span></span></div>
</div>
<hr />
<a name="changelog"></a><h2>1. Changelog</h2>
<div class="paragraph">
<div class="inner"><span class="corners-top"><span></span></span>
<div class="content">
<a name="v303"></a><h3>1.i. Changes since 3.0.3</h3>
<ul>
<li>[Fix] Allow mixed-case template directories to be inherited (Bug #36725)</li>
<li>[Fix] Regression bug from revision #8908 regarding log display in ACP</li>
<li>[Fix] Allow the UCP group management to work for groups with avatars. (Bug #37375)</li>
<li>[Fix] Fix header list build for replying oldest PM in PM history (Bug #37275)</li>
<li>[Fix] Do not display COPPA group in memberlist find member dialog if COPPA disabled (Bug #37175)</li>
<li>[Fix] Do not try to send jabber notifications if no jid entered (Bug #36775)</li>
<li>[Fix] Only display special ranks to guests; no longer display normal ranks for guests (Bug #36735)</li>
<li>[Fix] Properly treat punctuation marks after local urls (Bug #37055)</li>
<li>[Fix] Make searching for members by YIM address work in prosilver</li>
<li>[Fix] Tell users to recreate the search index after changing the common word threshold for fulltext_native (Bug #36345)</li>
<li>[Fix] Adjusted phpbb_chmod() to always set permissions for group bit.</li>
<li>[Fix] Do not increment users post count after post approval if post had been posted in a forum with no post count increasing set (Bug #37865)</li>
<li>[Fix] Extend vertical line for last post column if no posts in forum (Bug #37125)</li>
<li>[Fix] correctly update last topic/forum information if changing guest usernames through editing posts (Bug #38095)</li>
<li>[Fix] fix postcount resync for situations where low and high post ids are higher than step value, resulting in users having 0 posts. (Bug #38195)</li>
<li>[Fix] Use a left join for the topics table on search to avoid trouble with FROM syntax on some databases (Bug #37005)</li>
<li>[Fix] Do not show 'Forward' button if the user cannot send PM's</li>
<li>[Change] Alllow applications to set custom module inclusion path (idea by HoL)</li>
<li>[Change] Handle checking for duplicate usernames in chunks (Bug #17285 - Patch by A_Jelly_Doughnut)</li>
<li>[Change] Better handling and finer control for custom profile fields visibility options. (Patch by Highway of Life)</li>
<li>[Change] Performance increase for format_date() (Bug #37575 - Patch by BartVB)</li>
<li>[Change] Changed prosilver date separator from 'on' to '&raquo;'</li>
<li>[Change] Performance increase for get_username_string() (Bug #37545 - Patch by BartVB)</li>
<li>[Change] Slight performance increase for common parameter calls to append_sid() (Bug #37555 - Patch by BartVB)</li>
<li>[Feature] Added 'AGO' setting to relative date strings. For example: posted 14 minutes ago. (Patch by BartVB)</li>
<li>[Sec] Fixed an issue where deactivated accounts could be re-activated without the required privileges. (Reported by Jorick)</li>
<li>[Sec] Ask for forum password if post within passworded forum quoted in private message. (Reported by nickvergessen)</li>
</ul>
<a name="v302"></a><h3>1.ii. Changes since 3.0.2</h3>
<ul>
<li>[Fix] Correctly set topic starter if first post in topic removed (Bug #30575 - Patch by blueray2048)</li>
<li>[Fix] Delete avatar files (Bug #29985).</li>
<li>[Fix] Preserve selection in the MCP. (Bug #31265).</li>
<li>[Fix] Added VST - Venezuela Standard Time (Bug #30545).</li>
<li>[Fix] Close DB connections in file.php.</li>
<li>[Fix] Correctly return results for nested cached queries (Bug #31445 - Patch by faw).</li>
<li>[Fix] Allow export of PM pages greater one. (#33155)</li>
<li>[Fix] Display coloured username of last poster in list of subscribed forums (prosilver).</li>
<li>[Fix] Added missing UCP language string <em>NO_AUTH_READ_HOLD_MESSAGE</em>.</li>
<li>[Fix] Do not jump back to page 1 when hiding member search in memberlist. (Bug #32515)</li>
<li>[Fix] Correctly limit input of the users location to 100 characters in the UCP and ACP. (Bug #32655)</li>
<li>[Fix] Sync reports when using the move all users posts tool in the ACP. (Bug #31165)</li>
<li>[Fix] Extra slash is included in the redirect url when redirecting to the forum root directory. (Bug #33605)</li>
<li>[Fix] Remove reported flag from shadow topics when closing reports. (Bug #19765)</li>
<li>[Fix] Do not show non indexed forums on the search page if they contain no subforums. (Bug #33125)</li>
<li>[Fix] Stop search bots incrementing topic views. (Bug #32675 - Patch by eviL&lt;3)</li>
<li>[Fix] Use correct link for post author search. (Bug #32595)</li>
<li>[Fix] Do not decrease topics counter when deleting shadow topics. (Bug #26495)</li>
<li>[Fix] Send localised disapproval reasons in the recipients local language. (Bug #31645)</li>
<li>[Fix] Language typos/fixes. (Bugs #27625, #30755, #34185, #32795)</li>
<li>[Fix] Added missing terms parameter to search pagination. (Bug #34085)</li>
<li>[Fix] Wrong table order in query obtaining posts if post id given.</li>
<li>[Fix] Do not display reported topic icon for shadow topics. (Bug #13970)</li>
<li>[Fix] Display popular topic based on posts within topic instead of replies within topic. (Bug #16099)</li>
<li>[Fix] Expand shown ban reason in unban screen to fully show long entries. (Bug #16234)</li>
<li>[Fix] Preserve alpha transparency for created thumbnails. (Bug #16575)</li>
<li>[Fix] Use correct port delimiter for MSSQL connections in windows. (Bug #16615)</li>
<li>[Fix] Do not allow setting forums parent to the forum itself. (Bug #18855)</li>
<li>[Fix] Display assigned rank/avatar for guests. (Bug #19155)</li>
<li>[Fix] Set secure cookie for style switcher if required. (Bug #19625)</li>
<li>[Fix] Fix native full text search on postgresql while using excluding keyword matches. (Bug #19195)</li>
<li>[Fix] Pass S_SEARCH_ACTION through append_sid() in search.php. (Bug #21585)</li>
<li>[Fix] Correctly delete message attachments. (Bug #23755)</li>
<li>[Fix] Correctly handle unread status of subforums (that are not shown on the index) of forums that are shown on the index. (Bug #14589)</li>
<li>[Fix] Stop users from deleting posts after the edit time has passed or they have been locked. (Bug #19115)</li>
<li>[Fix] Split posts target forum requires 'f_post' now instead of 'm_split'. (Bug #31015)</li>
<li>[Fix] Duplicate log messages for deleting a topic ('LOG_TOPIC_DELETED' has been deprecated in favour of 'LOG_DELETE_TOPIC').</li>
<li>[Fix] Use a distinct log message for shadow topic deletions to differentiate between normal topic deletions. (Bug #34635)</li>
<li>[Fix] Fix problems with styles using an underscore within the filename. (Bug #34315)</li>
<li>[Fix] Better return links when deleting topics through the MCP. (Bug #34655)</li>
<li>[Fix] Add quoting support to PM history when composing a reply. (Bug #34285)</li>
<li>[Fix] Use phpBB 3.1.x method for storing cached data to prevent PHP bug with our usage of var_export(). (Thanks to Techie-Micheal and HoL for pointing out possible problems)</li>
<li>[Fix] Check users pm preferences for pm's sent to groups. (Bug #33245)</li>
<li>[Fix] Do not allow password reminders if u_passchg permission is not given. (Bug #14806)</li>
<li>[Fix] Implemented strict check for cached user permissions and existing ACL options. This fix makes sure cached permissions are valid, even if they got already cached.</li>
<li>[Fix] Do not show link to user/group profiles if user has no permission to view the linked page and gets a denied message anyway. (Bug #15088)</li>
<li>[Fix] Do not display last post link and sort display options for search engines. (Bug #15088)</li>
<li>[Fix] Make sure users still get notifications if they set to only be notified by Jabber, but Jabber service disabled. (Bug #29715 - Patch by Paul)</li>
<li>[Fix] Don't show forum subscription link on categories. (Bug #34895)</li>
<li>[Fix] Display a message if no topics or forums are selected when unsubscribing. (Bug #34855)</li>
<li>[Fix] Mark/unmark all links in UCP now select/unselect both subscribed topics and forums.</li>
<li>[Fix] Increase board topic counter when splitting topics. (Bug #32125)</li>
<li>[Fix] Display profile icons when viewing a topic, or PM when only the jabber icon is to be visible. (Bug #34755)</li>
<li>[Fix] Do not send PMs with warnings if the user cannot read PMs or they are disabled. (Bug #30815)</li>
<li>[Fix] Correctly convert Niels' Birthday MOD to the date format used in phpBB3. (Bug #32895)</li>
<li>[Fix] Parse BBCode lists of type square, circle and disc. (Bug #35295)</li>
<li>[Fix] Round the displayed percentages in polls. (Bug #32375)</li>
<li>[Fix] Disable mass e-mail when e-mail is disabled. (Bug #27385)</li>
<li>[Fix] Display coloured poster username of queued posts displayed on the front of the MCP.</li>
<li>[Fix] Moderators can only see reports/queue/logs from forums they can actually read. (Bug #31085)</li>
<li>[Fix] Correctly display topic when start parameter is equal to the number of posts.</li>
<li>[Fix] Correctly display topic in MCP when start parameter is equal to or greater than the number of posts. (Bug #30525)</li>
<li>[Change] No longer allow the direct use of MULTI_INSERT in sql_build_array. sql_multi_insert() must be used.</li>
<li>[Change] Display warning in ACP if config.php file is left writable.</li>
<li>[Change] More restrictive chmod to new files being created. (phpbb_chmod() function mostly by faw)</li>
<li>[Change] Set headers to allow browsers to better cache attachments (Mylek pointed this out)</li>
<li>[Change] Hide parameters if they equal the default in viewforum/viewtopic (Bug #31185)</li>
<li>[Change] Various improvements to group listings (Bugs #32155, #32145, #32085, #26675, #26265)</li>
<li>[Change] Set headers for IE 8 in file.php</li>
<li>[Change] Do not count queued posts to user_posts.</li>
<li>[Change] Allow setting birth year to current year.</li>
<li>[Change] Do not use the topics posted table when performing an egosearch.</li>
<li>[Change] Log the forum name that topics are moved into.</li>
<li>[Change] Automatically add users/groups to the PM recipient list, if entered or selected.</li>
<li>[Change] Reply to PM now includes all previous recipients and not only the original sender.</li>
<li>[Change] Make topic selection for merge less confusing by removing unneeded controls. (Bug #21925)</li>
<li>[Change] MCP topic view checkboxes now default to unchecked.</li>
<li>[Change] Adjust language key <em>SPLIT_AFTER</em> to make the action clearer.</li>
<li>[Change] Add links to the post and forum when viewing a report from the MCP. (Bugs #33795, #33805)</li>
<li>[Change] Added CSRF protection to GET-only actions like marking forums.</li>
<li>[Change] Remove NUL-Bytes directly in request_var() for strings and within the custom DBAL sql_escape() functions (MSSQL, Firebird, Oracle) (reported by AdhostMikeSw)</li>
<li>[Feature] Allow limited inheritance for template sets.</li>
<li>[Feature] Allow hard disabling of the template editor.</li>
<li>[Feature] Allow setting custom language path through $user-&gt;set_custom_lang_path(). $user-&gt;lang_path now also do not include the user language, but only the path.</li>
<li>[Feature] Ability to define nullar/singular/plural language entries</li>
<li>[Feature] Ability to mimic sprintf() calls with $user-&gt;lang() with the ability to correctly assign nullar/singular/plural language entries.</li>
<li>[Feature] Added the possibility to force user posts put in queue if post count is lower than an admin defined value. Guest posting is not affected by this setting.</li>
<li>[Feature] Added 'max_recipients' setting for private messages. This setting allows admins to define the maximum number of recipients per private message with a board-wide setting and a group-specific setting.</li>
<li>[Feature] Added new permission setting for sending private messages to groups. Now there are two permissions to define sending private messages to multiple recipients and private messages to groups.</li>
<li>[Feature] Allow specific connection to different server for jabber functionality by providing a valid JID as username. This also allows the use of talk.google.com as jabber server with gmail.com JIDs. (Bug #14989)</li>
<li>[Sec Precaution] Stricter validation of the HTTP_HOST header (Thanks to Techie-Micheal et al for pointing out possible issues in derived code)</li>
</ul>
<a name="v301"></a><h3>1.iii. Changes since 3.0.1</h3>
<ul>
<li>[Fix] Ability to set permissions on non-mysql dbms (Bug #24955)</li>
<li>[Fix] Fixed blank style on setups having no username defined within config.php (Bug #25065)</li>
<li>[Fix] Made the compress_tar class tolerate archives that do not properly have their archived contents listed (Bug #14429 / thanks to JRSweets for his patch)</li>
<li>[Fix] Moved topics should not count towards the number of topics in a forum (Bug #14648 / thanks to Schumi for his patch)</li>
<li>[Fix] Properly check for invalid characters in MySQL DB prefixes during install (Bug #18775)</li>
<li>[Fix] Bring the PostgreSQL backup system back to working order (Bug #22385)</li>
<li>[Fix] Update correct theme for cached styles in style.php (Bug #25805)</li>
<li>[Fix] Also add PHPBB_INSTALLED check to download/file.php for inline avatar delivery</li>
<li>[Fix] Unable to login to some jabber server, reverted previous change (Bug #25095)</li>
<li>[Fix] Do not return BMP as valid image type for GD image manipulation (Bug #25925)</li>
<li>[Fix] Correctly determine safe mode for temp file creation in functions_upload.php (Bug #23525)</li>
<li>[Fix] Correctly sort by rank in memberlist (Bug #24435)</li>
<li>[Fix] Purge cache after database restore (Bug #24245)</li>
<li>[Fix] Correctly display subforum read/unread icons from RTL in FF3, Konqueror and Safari3+. (thanks arod-1 for the fix, related to Bug #14830)</li>
<li>[Fix] Added missing form token in acp (thanks NBBN).</li>
<li>[Fix] Do not remove whitespace in front of url containing the boards url and no relative path appended (Bug #27355)</li>
<li>[Fix] reset forum notifications in viewtopic (Bug #28025)</li>
<li>[Fix] corrected link for searching post author's other posts (Bug #26455)</li>
<li>[Fix] HTTP Authentication supports UTF-8 usernames now (Bug #21135)</li>
<li>[Fix] Topic searches by author no longer return invalid results (Bug #11777)</li>
<li>[Fix] Delete drafts and bookmarks when deleting an user. (#27585, thanks Schumi for the fix)</li>
<li>[Fix] Set last_post_subject for new topics. (#23945)</li>
<li>[Fix] Allow moving posts to invisible forums. (#27325)</li>
<li>[Fix] Don't allow promoting unapproved group members (#16124)</li>
<li>[Fix] Correctly fetch server name if using non-standard port (#27395)</li>
<li>[Fix] Regular expression for email matching in posts will no longer die on long words.</li>
<li>[Fix] Do not display ban message if direct call to cron. (thanks Dog Cow for reporting)</li>
<li>[Fix] Correctly display double-colon on special conditions within highlighted php source (Bug #26795)</li>
<li>[Fix] Increase storage capacity of titles/subjects due to specialchared content (Bug #25235)</li>
<li>[Fix] Catch invalid username wildcard ban (we do not support these) (Bug #29305)</li>
<li>[Fix] Fix (email)-domain checks for those having DNS prefixes set (Bug #29635)</li>
<li>[Change] Adjust truncate_string() to be able to adjust the maximum storage length.</li>
<li>[Change] Generalize load check (Bug #21255 / thanks to Xipher)</li>
<li>[Change] Make utf8_htmlspecialchars not pass its argument by reference (Bug #21885)</li>
<li>[Change] Sort the tables at the database table backup screen</li>
<li>[Change] For determining the maximum number of private messages in one box, use the biggest value from all groups the user is a member of (Bug #24665)</li>
<li>[Change] Show email ban reason on registration. Additionally allow custom errors properly returned if using validate_data(). (Bug #26885)</li>
<li>[Change] Don't allow redirects to different domains. (thanks nookieman)</li>
<li>[Feature] Added optional referer validation of POST requests as additional CSRF protection.</li>
<li>[Feature] Added optional stricter upload validation to avoid mime sniffing in addition to the safeguards provided by file.php. (thanks to Nicolas Grekas for compiling the list).</li>
<li>[Feature] Streamlined banning via the MCP by adding a ban link to the user profile. Also pre-fills ban fields as far as possible.</li>
<li>[Feature] Added ACP logout to reset an admin session.</li>
<li>[Sec] Only allow urls gone through redirect() being used within login_box(). (thanks nookieman)</li>
</ul>
<a name="v300"></a><h3>1.iv. Changes since 3.0.0</h3>
<ul>
<li>[Change] Validate birthdays (Bug #15004)</li>
<li>[Fix] Allow correct avatar caching for CGI installations. (thanks wildbill)</li>
<li>[Fix] Fix disabling of word censor, now possible again</li>
<li>[Fix] Allow single quotes in db password to be stored within config.php in installer</li>
<li>[Fix] Correctly quote db password for re-display in installer (Bug #16695 / thanks to m313 for reporting too - #s17235)</li>
<li>[Fix] Correctly handle empty imageset entries (Bug #16865)</li>
<li>[Fix] Correctly check empty subjects/messages (Bug #17915)</li>
<li>[Change] Do not check usernames against word censor list. Disallowed usernames is already checked and word censor belong to posts. (Bug #17745)</li>
<li>[Fix] Additionally include non-postable forums for moderators forums shown within the teams list. (Bug #17265)</li>
<li>[Change] Sped up viewforum considerably (also goes towards mcp_forum)</li>
<li>[Fix] Do not split topic list for topics being promoted to announcements after been moved to another forum (Bug #18635)</li>
<li>[Fix] Allow editing usernames within database_update on username cleanup (Bug #18415)</li>
<li>[Fix] Fixing wrong sync() calls if moving all posts by a member in ACP (Bug #18385)</li>
<li>[Fix] Check entered imagemagick path for trailing slash (Bug #18205)</li>
<li>[Fix] Use proper title on index for new/unread posts (Bug #13101) - patch provided by Pyramide</li>
<li>[Fix] Allow calls to $user-&gt;set_cookie() define no cookie time for setting session cookies (Bug #18025)</li>
<li>[Fix] Stricter checks on smilie packs (Bug #19675)</li>
<li>[Fix] Gracefully return from cancelling pm drafts (Bug #19675)</li>
<li>[Fix] Possible login problems with IE7 if browser check is activated (Bug #20135)</li>
<li>[Fix] Fix possible database transaction errors if code returns on error and rollback happened (Bug #17025)</li>
<li>[Change] Allow numbers in permission names for modifications, as well as uppercase letters for the request_ part (Bug #20125)</li>
<li>[Fix] Use HTTP_HOST in favor of SERVER_NAME for determining server url for redirection and installation (Bug #19955)</li>
<li>[Fix] Removing s_watching_img from watch_topic_forum() function (Bug #20445)</li>
<li>[Fix] Changing order for post review if more than one post affected (Bug #15249)</li>
<li>[Fix] Language typos/fixes (Bug #20425, #15719, #15429, #14669, #13479, #20795, #21095, #21405, #21715, #21725, #21755, #21865, #15689)</li>
<li>[Fix] Style/Template fixes (Bug #20065, #19405, #19205, #15028, #14934, #14821, #14752, #14497, #13707, #14738, #19725)</li>
<li>[Fix] Tiny code fixes (Bug #20165, #20025, #19795, #14804)</li>
<li>[Fix] Prepend phpbb_root_path to ranks path for displaying ranks (Bug #19075)</li>
<li>[Fix] Allow forum notifications if topic notifications are disabled but forum notifications enabled (Bug #14765)</li>
<li>[Fix] Fixing realpath issues for provider returning the passed value instead of disabling it. This fixes issues with confirm boxes for those hosted on Network Solutions for example. (Bug #20435)</li>
<li>[Fix] Try to sort last active date on memberlist correctly at least on current page (Bug #18665)</li>
<li>[Fix] Handle generation of form tokens when maximum time is set to -1</li>
<li>[Fix] Correctly delete unapproved posts without deleting the topic (Bug #15120)</li>
<li>[Fix] Respect signature permissions in posting (Bug #16029)</li>
<li>[Fix] Users allowed to resign only from open and freely open groups (Bug #19355)</li>
<li>[Fix] Assign a last viewed date to converted topics (Bug #16565)</li>
<li>[Fix] Many minor and/or cosmetic fixes (Including, but not limited to: #21315, #18575, #18435, #21215)</li>
<li>[Feature] New option to hide the entire list of subforums on listforums</li>
<li>[Fix] Custom BBCode {EMAIL}-Token usage (Bug #21155)</li>
<li>[Fix] Do not rely on parameter returned by unlink() for verifying cache directory write permission (Bug #19565)</li>
<li>[Change] Use correct string for filesize (MiB instead of MB for example)</li>
<li>[Change] Remove left join for query used to retrieve already assigned users and groups within permission panel (Bug #20235)</li>
<li>[Fix] Correctly return sole whitespaces if used with BBCodes (Bug #19535)</li>
<li>[Fix] Quote bbcode parsing adding too much closing tags on special conditions (Bug #20735)</li>
<li>[Change] Added sanity checks to various ACP settings</li>
<li>[Change] Removed minimum form times</li>
<li>[Fix] Check topics_per_page value in acp_forums (Bug #15539)</li>
<li>[Fix] Custom profile fields with date type should be timezone independend (Bug #15003)</li>
<li>[Fix] Fixing some XHTML errors/warnings within the ACP (Bug #22875)</li>
<li>[Fix] Warnings if poll title/options exceed maximum characters per post (Bug #22865)</li>
<li>[Fix] Do not allow selecting non-authorized groups within memberlist by adjusting URL (Bug #22805 - patch provided by ToonArmy)</li>
<li>[Fix] Correctly specify &quot;close report action&quot; (Bug #22685)</li>
<li>[Fix] Display &quot;empty password error&quot; within the login box instead of issuing a general error (Bug #22525)</li>
<li>[Fix] Clean up who is online code in page_header (Bug #22715, thanks HighwayofLife)</li>
<li>[Fix] Pertain select single link on memberlist (Bug #23235 - patch provided by Schumi)</li>
<li>[Fix] Allow &amp; and | in local part of email addresses (Bug #22995)</li>
<li>[Fix] Do not error out if php_uname function disabled / Authenticating on SMTP Server (Bug #22235 - patch by HoL)</li>
<li>[Fix] Correctly obtain to be ignored users within topic/forum notification (Bug #21795 - patch provided by dr.death)</li>
<li>[Fix] Correctly update board statistics for attaching orphaned files to existing posts (Bug #20185)</li>
<li>[Fix] Do not detect the board URL as a link twice in posts (Bug #19215)</li>
<li>[Fix] Set correct error reporting in style.php to avoid blank pages after CSS changes (Bug #23885)</li>
<li>[Fix] If pruning users based on last activity, do not include users never logged in before (Bug #18105)</li>
<li>[Sec] Only allow searching by email address in memberlist for users having the a_user permission (reported by evil&lt;3)</li>
<li>[Sec] Limit private message attachments to be viewable only by the recipient(s)/sender (Report #s23535) - reported by AlleyKat</li>
<li>[Sec] Check for non-empty config.php within style.php (Report #s24575) - reported by bantu</li>
<li>[Fix] Find and display colliding usernames correctly when converting from one database to another (Bug #23925)</li>
</ul>
<a name="v30rc8"></a><h3>1.v. Changes since 3.0.RC8</h3>
<ul>
<li>[Fix] Cleaned usernames contain only single spaces, so &quot;a_name&quot; and &quot;a__name&quot; are treated as the same name (Bug #15634)</li>
<li>[Fix] Check &quot;able to disable word censor&quot; option while applying word censor on text (Bug #15974)</li>
<li>[Fix] Rollback changes on failed transaction if returning on sql error is set</li>
<li>[Fix] Call garbage_collection() within database updater to correctly close connections (affects Oracle for example)</li>
</ul>
<a name="v30rc7"></a><h3>1.vi. Changes since 3.0.RC7</h3>
<ul>
<li>[Fix] Fixed MSSQL related bug in the update system</li>
<li>[Fix] Display &quot;Return to&quot; links on unwritable forums (Bug #14824)</li>
<li>[Fix] Mitigating different realpath() handling between PHP versions (fixing confirm box redirects)</li>
<li>[Fix] Fix signature editing - ability to remove signature (Bug #14820)</li>
<li>[Fix] Send correct activation key by forcing reactivation for inactive user (Bug #14819)</li>
<li>[Fix] Adding correct IP for private messages sent by issuing warnings (Bug #14781)</li>
<li>[Fix] Open private message notification (Bug #14773)</li>
<li>[Fix] Fixing false new private message indicator (Bug #14627)</li>
<li>[Fix] Let newly activated passwords work if users were converted (Bug #14787)</li>
<li>[Fix] Quote bbcode fixes. Letting parse quote=&quot;[&quot; and re-allowing whitelisted bbcodes within username portion (Bug #14770)</li>
<li>[Fix] Allow alternative text for styled buttons if images turned off, but CSS staying on</li>
<li>[Sec] Fix bbcode helpline display for custom bbcodes - this requires style changes for any custom style (Bug #14850)</li>
<li>[Fix] Correctly count announcements when filtering forums by date (Bug #14877)</li>
<li>[Fix] Allow charset names containing underscores or spaces</li>
<li>[Fix] Don't allow previous/next links for non-existing topics (Bug #15039)</li>
<li>[Change] Do not assign converted votes to the first option in a vote.</li>
<li>[Fix] Use correct RFC 2822 date format in emails (Bug #15042)</li>
<li>[Fix] Require founder status for some actions on founder-only groups (Bug #15119)</li>
<li>[Fix] Allow changing the &quot;now&quot; option of date CPFs (Bug #15111)</li>
<li>[Change] Some improvements to the caching of avatars</li>
<li>[Change] Set template recompilation to be disabled by default. All mod and style authors and all those who want to modify their styles should enabled it after installation.</li>
<li>[Change] Disable debug mode. All mod and style authors should enable DEBUG and DEBUG_EXTRA.</li>
<li>[Fix] Check error reporting level for all error level. This fixes a problem for hosts having manipulated the error handler. (Bug #14831)</li>
<li>[Feature] Constant PHPBB_DB_NEW_LINK introduced which can be used to force phpBB to create a new database connection instead of reusing an existing one if the dbms supports it (Bug #14927)</li>
<li>[Fix] Automatic URL parsing no longer allows dots in the schema but can parse URLs starting after a dot (Bug #15110)</li>
<li>[Fix] Dynamic width for birthday select boxes (Bug #15149)</li>
<li>[Fix] Recache Moderators when copying permissions. (Bug #15384)</li>
<li>[Fix] Propagate sort options in mcp_forums (Bug #15464)</li>
<li>[Change] Do not allow [size=0] bbcodes (font-size of 0)</li>
<li>[Fix] No duplication of active topics (Bug #15474)</li>
</ul>
<a name="v30rc6"></a><h3>1.vii. Changes since 3.0.RC6</h3>
<ul>
<li>[Fix] Submitting language changes using acp_language (Bug #14736)</li>
<li>[Fix] Fixed wrong bbcode handling for forum rules, forum descriptions and group descriptions</li>
<li>[Fix] Fixed faulty form tokens (Bug #14725, #14762 and #14755)</li>
<li>[Fix] Fixed bbcode uid generation in the phpBB2 converter (Bug #14722)</li>
<li>[Fix] Able to request new password (Bug #14743)</li>
</ul>
<a name="v30rc5"></a><h3>1.viii. Changes since 3.0.RC5</h3>
<ul>
<li>[Feature] Removing constant PHPBB_EMBEDDED in favor of using an exit_handler(); the constant was meant to achive this more or less.</li>
<li>[Feature] Constant PHPBB_ADMIN_PATH introduced, having the same purpose as PHPBB_ROOT_PATH, but for the ACP.</li>
<li>[Fix] Further fixing user profile view (please do not forget to update/refresh your template and style) (Bug #14230)</li>
<li>[Fix] Adjust google adsense bot information (Bug #14296)</li>
<li>[Fix] Fix horizontal scrollbar problem in IE6 (Bug #14228) - fix provided by Danny-dev</li>
<li>[Fix] Use correct size values in ACP user signature screen (Bug #13367)</li>
<li>[Fix] Attachment Place inline won't work with single quotes (Bug #14291)</li>
<li>[Fix] Unable to save email templates through ACP language page (Bug #14266)</li>
<li>[Fix] Correctly set user style for guest user (able to be changed within user management)</li>
<li>[Change] Moved note about dns_get_record function for using GTalk (Jabber) from Jabber log to Jabber ACP panel</li>
<li>[Fix] Do not use register_shutdown_function within cron.php if handling the queue and the mail function being used (Bug #14321)</li>
<li>[Fix] Fixing private message on-hold code if moving messages into folder based on rules (Bug #14309)</li>
<li>[Fix] Allow the merge selection screen to work (Bug #14363)</li>
<li>[Change] Require additional permissions for copying permission when editing forums </li>
<li>[Fix] Local magic URLs no longer get an additional trailing slash (Bug #14362)</li>
<li>[Fix] Do not let the cron script stale for one hour if register_shutdown_function is not able to be called (Bug #14436)</li>
<li>[Feature] Added /includes/db/db_tools.php file, which includes tools for handling cross-db actions such as altering columns, etc.</li>
<li>[Change] Reset the start parameter when the timeframe is changed in the mcp topic page (Ticket #14438)</li>
<li>[Change] Added Code for cleaning the confirm table to the session garbage collection</li>
<li>[Fix] Fixed token handling in jabber class for extremely spec-compliant XMPP server (Bug #14445)</li>
<li>[Fix] Disallowed galleries from using special characters (Bug #14466)</li>
<li>[Change] Listing the board url within the email text instead of appending it to the subject (Bug #14378)</li>
<li>[Fix] Always display the quote button as the most accessible one (this means edit is before quote in prosilver due to the way we lay out profiles)</li>
<li>[Fix] Use correct dimension (width x height) in ACP (Bug #14452)</li>
<li>[Fix] Only display PM history links if there are PM's to be displayed (Bug #14484)</li>
<li>[Feature] Added completely new hook system to allow better application/mod integration - see docs/hook_system.html</li>
<li>[Fix] Correctly delete excess poll options (Bug #14566)</li>
<li>[Fix] Allow names evaluating to false for poll options</li>
<li>[Change] use in-build functions for user online list (Bug #14596) - provided by rxu</li>
<li>[Fix] Fixing google cache display problems with Firefox (Bug #14472) - patch provided by Raimon</li>
<li>[Fix] Prevent topic unlocking if locked by someone else while posting (Bug #10307)</li>
<li>[Change] Allow years in future be selected for date custom profile field (Bug #14519)</li>
<li>[Fix] Don't display &quot;Avatars Disabled&quot; message on edit groups in UCP (Bug #14636)</li>
<li>[Change] Require confirm for deleting inactive users. (Bug #14641)</li>
<li>[Fix] Match custom BBCodes in the same way during first and second pass - patch provided by IBBoard (Bug #14268)</li>
<li>[Fix] Correct quote parsing if opening bracket before opening quote (Bug #14667)</li>
<li>[Fix] Clean post message for checking length to prevent posting empty messages</li>
<li>[Fix] Display jumpbox if needed for functionality (Bug #14702)</li>
<li>[Feature] Added an option to enforce that users spend a configurable amount of time on the terms page during registration</li>
<li>[Fix] Fixed copy permissions box in the ACP</li>
<li>[Fix] Enforce types for the user table during conversions</li>
<li>[Sec] Fixing possible XSS through compromised WHOIS server (#i63, #i64)</li>
<li>[Sec] Missing access control on whois in viewonline.php (#i51)</li>
<li>[Sec] Encoding some variables within user::page array correctly (to cope with browser not doing it correctly) to prevent XSS through functions re-using them (#i61)</li>
<li>[Sec] Fixed XSS through memberlist search feature (#i62)</li>
<li>[Sec] Fixed XSS through colour swatch (#i65)</li>
<li>[Sec] Fixed insecure attachment deletion (#i53)</li>
<li>[Sec] Only allow whitelisted protocols in meta_redirect/redirect (#i66)</li>
<li>[Sec] Check file names to be written in language management panel (#i52)</li>
<li>[Sec] Deregister globals if ini_get has been disabled (#i112)</li>
<li>[Sec] Added form tokens to most forms to enforce a lighter variant of CSRF protection (#i91 - #i96)</li>
<li>[Sec] Use new password hash method for forum passwords (#i43)</li>
<li>[Sec] Changed download file location to prevent flash crossdomain policies taking effect (#i8)</li>
<li>[Sec] Do not allow autocompletion for password on admin re-authentication (#i41)</li>
<li>[Sec] Made sure users are not completely locked out if they have a GLOBALS cookie (#i101)</li>
<li>[Sec] Use the secure hash to generate BBCODE_UIDs (#i71)</li>
<li>[Sec] Increase the length of BBCODE_UIDs (#i72)</li>
<li>[Sec] New password hashing mechanism for storing passwords (#i42)</li>
</ul>
<a name="v30rc4"></a><h3>1.ix. Changes since 3.0.RC4</h3>
<ul>
<li>[Fix] MySQL, PostgreSQL and SQLite related database fixes (Bug #13862)</li>
<li>[Fix] Allow MS SQL to properly connect when using the mssql driver and PHP is less than either 4.4.1 or 5.1 (Bug #13874)</li>
<li>[Fix] Ignore files containing HTML special chars in the filenames as gallery avatars (Bug #13906)</li>
<li>[Fix] Multiple PM recipients not separated (Bug #13876)</li>
<li>[Change] Split the select list for the smilie order to clarify which are feasible and which are not (Bug #13911)</li>
<li>[Fix] Convert empty homepage fields (Bug #13917)</li>
<li>[Fix] Use board default DST setting on creating new profiles (Bug #11563)</li>
<li>[Feature] New constant PHPBB_EMBEDDED can be used to let phpBB not call exit; if wrapped/embedded (We may re-check this constant on other code locations later too)</li>
<li>[Feature] append_sid() having a check for the function append_sid_phpbb_hook(). This function is called in favour of append_sid() with the exact same parameters if present.</li>
<li>[Fix] Only list enabled modes within the dropdown at user administration (Bug #13883) - patch provided by damnian</li>
<li>[Fix] Properly display ban reason if selecting banned entries within the ACP (Bug #13896)</li>
<li>[Fix] Properly parse SQL expressions for Oracle (Bug #13916)</li>
<li>[Fix] Added label bindings to the custom profile fields in the ACP (Bug #13936) - patch provided by damnian</li>
<li>[Change] Made group avatar/rank changes more intuitive</li>
<li>[Fix] Give more feedback in icon/smilie management (Bug #13295)</li>
<li>[Fix] Correctly set user::lang_id (Bug #14010)</li>
<li>[Fix] Properly display the smiley export screen (Bug #13968)</li>
<li>[Feature] Add "DECIMAL:", "PDECIMAL", and "PDECIMAL:" to the schema creation code (Bug #13999) - patch provided by poyntesm</li>
<li>[Fix] Don't show the notify checkbox in the approval queue if the only posts are written by ANONYMOUS (Bug #13973)</li>
<li>[Fix] Redirect to bots management page on edit/add (Bug #14073)</li>
<li>[Fix] Display locked icon in viewforum/prosilver if forum locked (Bug #14009)</li>
<li>[Feature] Display message history in compose PM screen</li>
<li>[Change] Do not force login on visiting topic/forum from notification emails (Bug #13818)</li>
<li>[Fix] Fixed cron_lock value for cron execution. This bug led to users having problems with the email queue and other cron related issues.</li>
<li>[Fix] Prevent white pages on php notices with gzip compression enabled (Bug #14096)</li>
<li>[Fix] Propagate the cleaned identifier for CFPs (Bug #14072)</li>
<li>[Fix] Do not display NO_TOPICS message if viewing non-postable category (Bug #13489)</li>
<li>[Fix] Let the theme immediately expire if changed from ACP for at least 30 minutes after change</li>
<li>[Fix] Do not append hilit= in search if highlighting term is empty (Bug #13910)</li>
<li>[Fix] Return to last page after voting in viewtopic instead of first page in topic (Bug #13976)</li>
<li>[Fix] If sending PM's to groups only include activated member (Bug #14040)</li>
<li>[Fix] Correctly wrap words in emails containing utf8 characters (Bug #14109)</li>
<li>[Change] For new posts or editing the first post topic titles have a maxlength of 60 characters. For any subsequent posts the length is extended to 64 to make room for the Re: part, but cutting at 60 characters. The maxlength need to be 64, else users using opera are unable to post (opera does not allow pre-filling a field with more characters than specified within the maxlength attribute)</li>
<li>[Fix] Disable gzip compression for cached stylesheet for Internet Explorer 6 or empty browser (IE6 is not able to properly display the compressed stylesheet) (Bug #14054)</li>
<li>[Fix] Header icons fixed in FF for RTL languages (Bug #14084)</li>
<li>[Change] Words in topic titles and post subjects are highlighted on the search results page and viewtopic too now (Bug #13383)</li>
<li>[Fix] Made sure strip_bbcode cannot get the idea that a smiley is a BBCode (Bug #14030)</li>
<li>[Change] Added a filter for user objects to LDAP configuration and improved explanations (Bug #12627)</li>
<li>[Fix] Display searchable subforums of invisible parents in advanced search forum selection (Bug #11395)</li>
<li>[Fix] Allow line breaks in custom BBCodes (Bug #10758)</li>
<li>[Fix] Ordered BBcode parsing functions in the same way everywhere where they are used</li>
<li>[Fix] Prevent {URL} token in custom BBCodes from make_clickable messing (Bug #14151)</li>
<li>[Sec] Added alternative tokens to custom BBCodes which are safe for CSS/Javascript and changed TEXT token to entitise opening and closing parantheses.</li>
<li>[Fix] Convert 2.0 moderator posting permissions (Bug #14105)</li>
<li>[Fix] Correctly apply PM box limit of 0 to custom folder (Bug #14154)</li>
<li>[Fix] odbc_autocommit causing existing result sets to be dropped (Bug #14182)</li>
</ul>
<a name="v30rc3"></a><h3>1.x. Changes since 3.0.RC3</h3>
<ul>
<li>[Fix] Fixing some subsilver2 and prosilver style issues</li>
<li>[Fix] Parse error in MCP ban (Bug #13109)</li>
<li>[Fix] Correctly hide online status in the profile (Bug #13059)</li>
<li>[Feature] Let the user choose how to update modified files (merging, using new file or using old file) within automatic updater</li>
<li>[Fix] An extra \ in an Oracle SQL regex was corrected (Bug #13151)</li>
<li>[Fix] Added a missing global to get_file() (Bug #13149)</li>
<li>[Fix] Hide autologin box when autologin is disabled (Bug #13093)</li>
<li>[Fix] Account for the forum id not being part of the request uri in prosilver (Bug #13121)</li>
<li>[Fix] Properly alter PostgreSQL tables</li>
<li>[Fix] Properly cache template files that were stored in the database (Bug #12675)</li>
<li>[Fix] Do not count the deletion of an unapproved topic as a decrease in normally viewable posts (Bug #13167)</li>
<li>[Fix] Allow column_exists() to return true if the column exists but no data is in the table</li>
<li>[Fix] Allow setting the smiley order via the select. Also allow to add smileys at the top. (Bug #13199)</li>
<li>[Fix] Fix php notice on sending jabber messages (Bug #13201)</li>
<li>[Fix] Make the window showing file differences a little wider (Bug #13157)</li>
<li>[Fix] Preserve preview style on search form (Bug #13205)</li>
<li>[Fix] Place attachment filename in new line in posting editor (Bug #9726)</li>
<li>[Fix] Don't allow caching to occur in the update sequence (Bug #13207)</li>
<li>[Fix] Enforce the max password length for automatically generated password created by the password sender (Bug #13181)</li>
<li>[Fix] Handle phpinfo() when expose_php is false (Bug #12777)</li>
<li>[Fix] Allow managing of forum roles without global users (Bug #13249)</li>
<li>[Change] Do not run cron script if board is disabled</li>
<li>[Fix] Correctly destroy sql cache for some query combinations (Bug #13237)</li>
<li>[Fix] Allow link forums being password protected (Bug #12967)</li>
<li>[Fix] Allow wrapping topic/post icons in posting editor (Bug #12843)</li>
<li>[Fix] Display L_RANK only once in template if rank title and image defined (Bug #13231)</li>
<li>[Fix] Make sure selected transfer method exists before calling (Bug #13265)</li>
<li>[Fix] Correctly escape language keys in language editor (Bug #13279)</li>
<li>[Fix] Correctly hide post/reply buttons if permissions are not given (related to Bug #12809)</li>
<li>[Fix] Remove orphan/wrong permission entries for non-existent forums - self-repairing permissions if conversions went &quot;crazy&quot;</li>
<li>[Feature] Allow &quot;older&quot; updates applied with the automatic updater. This allows people using it for updating, say, from 3.0.0 to 3.0.1 (with the correct package of course) and then from 3.0.1 to 3.0.2 if the latest version at this time is 3.0.2. These changes take effect beginning with RC4 or people replacing install/install_update.php manually prior doing the updates.</li>
<li>[Fix] Present correct error message if user tries to edit already read private message (Bug #13271)</li>
<li>[Fix] Also display board disabled notice for admins/mods if board got disabled due to exceeding the load limit (Bug #13267)</li>
<li>[Fix] Correctly deliver avatar if readfile function has been disabled (Bug #13309)</li>
<li>[Fix] Display php information page with the correct direction (Bug #12557)</li>
<li>[Fix] Increased the number of style objects (styles, templates, themes and imagesets) possible from 127 to 65535 for MySQL (Bug #13179)</li>
<li>[Fix] Although theoretically impossible in our code, removed the chance of trying to open a file that does not exist (Bug #13327)</li>
<li>[Fix] Although theoretically impossible in our code, changed the handling of non-existent language files (Bug #13329, #13331)</li>
<li>[Fix] Removed extra ampersand from ACP link (Bug #13315)</li>
<li>[Fix] used cleaned up version of given field identification for pre-filling a new custom profile field (Bug #13319)</li>
<li>[Fix] Correctly convert 2.0 website profile fields. (Bug #13379)</li>
<li>[Fix] Fixed the "Alphanumeric" and "Alphanumeric and spacers" username selection limitations (Bug #13391)</li>
<li>[Fix] Make sure filelist() is only returning array types (Bug #13385)</li>
<li>[Fix] Correctly mark forums read if using cookie based topic tracking (Bug #13245)</li>
<li>[Change] Put custom profile fields into top box and signature into separate box in members profile view (Bug #13357)</li>
<li>[Fix] Only show moderator log entries for forums the user is having moderation rights in (Bug #12481)</li>
<li>[Feature] Show resulting permission alone in trace window (Bug #10952) - thanks to dark/rain for the proposal</li>
<li>[Fix] Fixed bug in realpath replacement letting it actually work again</li>
<li>[Change] Try to be a bit more specific regarding global/local permission trace (Bug #11032)</li>
<li>[Fix] Fixed some strangeness in password validation due to mb_ereg()</li>
<li>[Fix] Subforums of a forum would overwrite the latest post information even if they did not contain the latest post (Bug #11931)</li>
<li>[Fix] Use global username display function on several places (Bug #11080, #11098) - patch by HoL</li>
<li>[Fix] Several viewonline fixes and feature changes. Also displaying the users browser in viewonline list to let the admin easier spot additional search bots, connected to a_user permission (Bug #11088) - patch and suggestions provided by HoL</li>
<li>[Change] u_viewprofile permission also affecting viewonline list now</li>
<li>[Fix] Do not display return to search link in prosilver if search is not allowed (Bug #11393)</li>
<li>[Fix] Use global url validation for img bbcode tag (Bug #11935)</li>
<li>[Fix] Added proper unicode support to style names (Bug #12165)</li>
<li>[Fix] Search result extract should not end in the middle of a multibyte character (Bug #11863)</li>
<li>[Fix] Missing localisation for an imageset no longer triggers a lot of &quot;imageset refreshed&quot; log messages (Bug #12027)</li>
<li>[Fix] Explain that themes which need parsing cannot be stored on the filesystem (Bug #11134)</li>
<li>[Fix] Normalize usernames</li>
<li>[Change] Improved utf8_clean_string with a more complete list of homographs and NFKC normalization</li>
<li>[Fix] Fixed error messages that ACP Database can give (Bug #13463)</li>
<li>[Fix] Fixed potential issues with databases that use tables names is uppercase</li>
<li>[Fix] Handle forum links/redirects within viewforum if no read permission given (to display login box or error message) (Bug #13467)</li>
<li>[Fix] Prevent changing postable forum having subforums to link forum without moving subforums out first</li>
<li>[Fix] Do not display version in admin template (Bug #13495)</li>
<li>[Fix] Allow manual specification of remote avatar dimensions if getimagesize is disabled (Bug #13531)</li>
<li>[Fix] Make viewonline use the session page's added forum parameter (Bug #13597)</li>
<li>[Fix] Correcting BBCode FAQ (Bug #11180)</li>
<li>[Fix] Make to/bcc line in view private message display consistent with other username displays in prosilver (Bug #11989)</li>
<li>[Fix] Send out activation email if admin activation is enabled and user activated through inactive users panel upon registration (Bug #12065)</li>
<li>[Change] Re-implemented All Yes/No/Never links in permission panels for easier changing all categories at once</li>
<li>[Change] Advanced permission link now &quot;marked&quot; if no role is assigned and custom permissions set. With this an admin can instantly see if the object is not set at all or having custom permissions, something you only saw if advanced permissions were viewed before.</li>
<li>[Fix] Change misleading custom BBCodes explanation, regarding tokens and useable template variables (Bug #12403, #5660)</li>
<li>[Feature] Ability to disable birthdays completely with new board features setting</li>
<li>[Fix] Fix disallowed username check (Bug #13511)</li>
<li>[Fix] Allow for unicode usernames to be pruned (Bug #13643)</li>
<li>[Fix] Do not copy forum permissions from self (Bug #13663)</li>
<li>[Fix] Allow for polls to work during preview (Bug #13657) - thanks to Thatbitextra</li>
<li>[Fix] Finer error conditions for sending IM messages (Bugs #13681, #13683)</li>
<li>[Fix] Add a confirmation for log deletion in the MCP (Bug #13693)</li>
<li>[Fix] Do not erase ranks and avatars when changing default groups (Bugs #13701, #13697)</li>
<li>[Fix] Limit author searches to firstpost, if selected (Bug #13579)</li>
<li>[Fix] Properly resync user post counts for users that have no posts (Bug #13581)</li>
<li>[Fix] Do not require space after , in smiley pak files (Bug #13647)</li>
<li>[Fix] Properly display the subscribe link in topic and forum display for Oracle (Bug #13583)</li>
<li>[Change] Add version number to ACP index (Bug #13703)</li>
<li>[Fix] Several fixes for custom profile fields on multi-lingual boards (Bugs #13763, #13527, #13525, #11515)</li>
<li>[Fix] Return to the mode previously selected after disaproving a post (Bug #13796)</li>
<li>[Fix] Cron now uses a locking variable to make sure it does not spawn too many webserver processes (Bug #12741)</li>
<li>[Fix] Cached stylesheet now supporting gzip compression</li>
<li>[Fix] Added link to inbox for deleted PMs (Bug #13813)</li>
<li>[Fix] Re-syncing the board stats also refreshes the newest user (Bug #13831)</li>
<li>[Feature] Ability to externally set $phpbb_root_path if wrapping phpBB3 by defining constant PHPBB_ROOT_PATH</li>
<li>[Fix] Implemented correct left/right floating within ACP in regard to RTL languages (Bug #13777)</li>
<li>[Fix] Fixing session problems when using MySQL strict mode in conjunction with very long browser agent string (Bug #13827)</li>
<li>[Fix] Disallow post/pm subjects entirely made up from non-printable chars and whitespaces (Bug #13800)</li>
<li>[Fix] Allow moving private messages from the sentbox (Bug #13791)</li>
<li>[Fix] Properly export localized imagesets</li>
<li>[Feature] Show the size of Firebird databases</li>
<li>[Fix] Show error when moving topic into a category via quickmod (Bug #11611)</li>
<li>[Fix] Allow Oracle to install on a database without specify the database name</li>
</ul>
<a name="v30rc2"></a><h3>1.xi. Changes since 3.0.RC2</h3>
<ul>
<li>[Fix] Re-allow searching within the memberlist</li>
<li>[Fix] Force prune related values to integers during conversions</li>
<li>[Fix] Updater now detects successfully merged files having conflicts and user chose to merge with modifications (Bug #12685)</li>
<li>[Fix] Updater is no longer listing missing language entries and styles if these had been removed (Bug #12655)</li>
<li>[Fix] Correct approval of posts in global announcements (Bug #12699)</li>
<li>[Sec] Do not allow setup spiders/robots to post, even if permissions are given. We see no reason why this should be possible. (Thanks to Frank Rizzo for convincing us regarding this)</li>
<li>[Sec] Do not display the last active column within the memberlist if u_viewonline permission is not given (Bug #12797)</li>
<li>[Fix] Display custom profile field &quot;date&quot; based on users language (Bug #12787)</li>
<li>[Fix] Allow adding of help language files within subdirectories (Bug #12783)</li>
<li>[Fix] Correctly apply smileys on posting having # within their emotion code</li>
<li>[Fix] Correctly convert smileys having double quotes within their emotion code (Bug #12731)</li>
<li>[Fix] The converter now adds the protocol to user website profile fields missing it (Bug #12819)</li>
<li>[Fix] Correctly escape banned ip/email using wildcard for ban check (Bug #12815)</li>
<li>[Fix] Fixed some very nasty opera bugs (dropdown list bug, cpu spike bug) (Bug #12763, #11609)</li>
<li>[Fix] Font colour list having the correct height in IE (Bug #9571)</li>
<li>[Feature] Added mark/unmark all links to the bots page (Bug #12461)</li>
<li>[Fix] Introduced check on duplicate usernames during bot creation/edit (Bug #12461)</li>
<li>[Fix] Allow multibyte letters for smilie codes(Bug #12321)</li>
<li>[Fix] Correctly chmod created cache files (Bug #12859)</li>
<li>[Fix] Use our global expression for checking email syntax in memberlist (Bug #12827)</li>
<li>[Fix] Correctly retrieve/refresh templates stored in database if using subdirectories within template directory (Bug #12839)</li>
<li>[Fix] Correctly translate special group names in ucp_groups.php (Bug #12597)</li>
<li>[Fix] Search boxes not losing session id (changing method from get to post) (Bug #12643)</li>
<li>[Fix] Make sure the automatic update is also working for those having fsockopen disabled</li>
<li>[Fix] Simulate recache of theme data on automatic update finished page - recaching it if css data changed</li>
<li>[Feature] Allow dropping in custom &quot;info_[module class]_*.php&quot; files to language/*/mods directory for inclusion into the menu structure without the need to modify phpBB language files for menu placements</li>
<li>[Fix] Added login box to egosearch (Bug #12941)</li>
<li>[Fix] Deal with slashed quotes during quote bbcode conversion (Bug #12607)</li>
<li>[Fix] Minor language and style fixes (Bugs #12235, #12493, #11949)</li>
<li>[Feature] Added backlinks to mcp_report (Bug #12905)</li>
<li>[Fix] Only check usernames in guest posts upon edit (Bug #11349)</li>
<li>[Fix] Consider viewonline permission when viewing friends/foes (Bug #12955)</li>
<li>[Fix] Added proper unicode support to ban reasons (Bug #12947)</li>
<li>[Fix] The forum/topic sync code now recognizes other ways that the latest post in a topic can be expressed (Bug #12947) - patch provided by APTX</li>
<li>[Fix] Topic deletion via the user post deletion mechanism did not take into account statistics for forums that hold shadow topics (Bug #12981)</li>
<li>[Fix] Allow for negative and decimal numbers to be in transposed queries in the Oracle and Firebird DBAL (Bug #13033)</li>
<li>[Fix] Some jabber related bugs (Bug #12989, #11805, #11809)</li>
<li>[Fix] Added UTF-8 support for banning via the MCP (Bug #13013)</li>
<li>[Fix] Properly detect the script name in session::extract_current_page() if PHP_SELF is not defined (Bug #12705) - patch provided by ToonArmy</li>
<li>[Fix] Show role mask for global permission class under Permissions-&gt;Permission Roles (Bug #13057)</li>
</ul>
<a name="v30rc1"></a><h3>1.xii. Changes since 3.0.RC1</h3>
<ul>
<li>[Fix] (X)HTML issues within the templates (Bug #11255, #11255)</li>
<li>[Fix] Tiny language and grammar changes</li>
<li>[Fix] Several style related fixes, mainly fixing cross-browser issues</li>
<li>[Fix] Several RTL fixes within prosilver</li>
<li>[Fix] MCP looses forum_id in some panels (Bug #11255)</li>
<li>[Fix] Moderation queue used unfriendly notification of no posts/topics (Bug #11291)</li>
<li>[Fix] Array in Oracle DBAL not always set (Bug #11475)</li>
<li>[Fix] Improper continue; in acp_styles.php (Bug #11523)</li>
<li>[Fix] Imageset editor more friendly (Bug #11511)</li>
<li>[Fix] Made Custom BBCode validation more strict (Bug #11335)</li>
<li>[Fix] Proper sync of data on topic copy (Bug #11335)</li>
<li>[Fix] Introduced ORDER BY clauses to converter queries (Bug #10697)</li>
<li>[Fix] Stopped bots from getting added to the registered users group during conversion (Bug #11283)</li>
<li>[Fix] Filled &quot;SMILIEYS_DISABLED&quot; template variable (Bug #11257)</li>
<li>[Fix] Properly escaped the delimiter in disallowed username comparisons (Bug #11339)</li>
<li>[Fix] Check global purge setting (Bug #11555)</li>
<li>[Fix] Improper magic url parsing applied to already parsed [url=] bbcode tag (Bug #11429)</li>
<li>[Fix] Renamed two indicies for Oracle support (Bug #11457)</li>
<li>[Fix] Added support for ISO-8859-8(-i) in the character set convertor (Bug #11265, #12039)</li>
<li>[Fix] Added support for Oracle's &quot;easy connect naming&quot;</li>
<li>[Fix] Let Mark/Unmark All work in Manage Drafts (Bug #11679)</li>
<li>[Fix] Display correct message if no attachments found in user administration (Bug #11629)</li>
<li>[Fix] Let the &quot;Delete all board cookies&quot; being displayed for guests too (only prosilver) (Bug #11603)</li>
<li>[Fix] Do not display view topic link in MCP while there is no link present (Bug #11573)</li>
<li>[Fix] MySQL now properly sorts by post_subject (Bug #11637)</li>
<li>[Fix] Introduced checks to stop negative postcounts (Bug #11561, #11421)</li>
<li>[Fix] Allow IP v4/v6 urls for remote avatars (Bug #11633)</li>
<li>[Fix] Delete avatar files automatically (Bug #11631)</li>
<li>[Fix] Automatically add selected columns to group by statements in the converter (Bug #11465)</li>
<li>[Fix] Allow posts without subjects to be clicked in the MCP (Bug #11483)</li>
<li>[Fix] Sync the forums that shadow topics reside in when the topic that they point to is deleted</li>
<li>[Fix] Do not use the gen_random_string function to create cookie names during install (Bug #11431)</li>
<li>[Fix] Send stylesheet in style.php even without a valid session id (Bug #11531)</li>
<li>[Fix] request_var should strictly return the requested number of dimensions</li>
<li>[Fix] Correct assignment of custom width to $user-&gt;img(); / Correctly display poll bars in subsilver2 (Bug #11301)</li>
<li>[Fix] Allow removing polls in prosilver</li>
<li>[Fix] Correct link to post in managing users attachments (Bug #11765)</li>
<li>[Fix] Reload confirm screen for selecting new forum for global topic type change if not postable forum is chosen (Bug #11711)</li>
<li>[Fix] Correctly show system default color for disabled options in Internet Explorer which does not support disabled option fields</li>
<li>[Fix] Update query for custom profiles in user management used wrong order for left/right delimiter (affecting mssql) (Bug #11781)</li>
<li>[Fix] Inconsistent display of more smileys link fixed (Bug #11801)</li>
<li>[Fix] Outbox messages are no always neither new nor unread post-conversion (Bug #11461)</li>
<li>[Feature] Replaced outdated jabber class with the one from the flyspray project</li>
<li>[Feature] The converter no longer relies on the smiley ID to decide if it should be displayed on the posting page</li>
<li>[Change] Limit maximum number of allowed characters in messages to 60.000 by default. Admins should increase their PHP time limits if they want to raise this tremedously.</li>
<li>[Change] Some changes to the conversion documentation</li>
<li>[Fix] Only use permissions from existing forums during the conversion (Bug #11417)</li>
<li>[Fix] Do not permit the decimal as a valid prefix character (Bug #11967)</li>
<li>[Fix] Account for the fact that the IM fields might hold non-IM information</li>
<li>[Fix] Make the queue function on post details</li>
<li>[Fix] Check if there are active styles left before deleting a style</li>
<li>[Fix] Correctly update styles after the deletion of an imageset.</li>
<li>[Fix] Replaced jabber validation to use the method used by the new jabber class (Bug #9822)</li>
<li>[Sec] Adding confirm boxes to UCP group actions (ToonArmy)</li>
<li>[Feature] Added the option to disable the flash bbcode globally (DelvarWorld)</li>
<li>[Sec] Changed the embedding of Flash (NeoThermic, DelvarWorld)</li>
<li>[Fix] Use the signature setting for PMs (Bug #12001)</li>
<li>[Fix] Made the DBMS selection use language variables (Bug #11969)</li>
<li>[Fix] Make sure that a folder is used when viewing messages to oneself (Bug #12105)</li>
<li>[Fix] Account for the fact that a board might have no visible Admins (Bug #12185)</li>
<li>[Fix] Change group ranks even if empty (Bug #12231)</li>
<li>[Fix] Correctly propagate variables across the custom profile field wizard (Bug #12237)</li>
<li>[Fix] Correctly move pm's into folders if more than one is received (Bug #12135)</li>
<li>[Fix] Corrected various bugs with CPF on multi-language boards (Bug #11803)</li>
<li>[Fix] Disable notify checkbox in posting editor when board email is disabled (Bug #12263)</li>
<li>[Fix] Removed maxlength from password/username fields (Bugs #12215, #11797)</li>
<li>[Fix] Use icon-unsubscribe in prosilver (Bug #12211)</li>
<li>[Fix] Seperated PREVIOUS/NEXT language vars for pagination and next/previous step (Bug #12197)</li>
<li>[Feature] append_sid() supporting anchor (Bug #11535) - patch provided by Schumi and ToonArmy</li>
<li>[Fix] Remember selected language while registering after submit (Bug #11435)</li>
<li>[Fix] UTF-8 support in theme and template editors (Bug #12251)</li>
<li>[Fix] Allow for posts per page in the MCP to change during topic selection (Bug #12067)</li>
<li>[Fix] Remove group avatars upon deletion from all profiles, not just the people having the group as default (Bug #12275, #12267)</li>
<li>[Fix] Allow for conversions to SQLite (Bug #12279) - patch provided by ToonArmy</li>
<li>[Fix] Apply colours to guests (Bug #12219)</li>
<li>[Fix] Set the Admin group as founder_manage during conversion (Bug #12287)</li>
<li>[Fix] Fixed a special quote BBCode case (Bug #12189)</li>
<li>[Fix] Correctly parse BBCodes in a post when a poll is being used (Bug #11833)</li>
<li>[Fix] Remember attached files on PM edit (Bug #12019)</li>
<li>[Fix] Correctly display poll ending on preview (Bug #12303)</li>
<li>[Feature] Display the success message on posting longer for posts awaiting approval (Bug #12053)</li>
<li>[Fix] Display maximum and entered number of characters for the &quot;maximum number of characters exceeded&quot; error messages (Bug #11981)</li>
<li>[Fix] Wrongly applied setting for allowing links in private messages (used the signature setting instead of the post setting) (Bug #11945)</li>
<li>[Fix] Unread flag for multipage topic wrongly set under some conditions (Bug #12127) - fix provided by asinshesq</li>
<li>[Fix] Able to delete posts within user prune panel (Bug #11849)</li>
<li>[Feature] Allow to specify dimensions of images manually on imageset config (Bug #11675)</li>
<li>[Fix] Correctly re-assign query result id after seeking rows (MSSQL/Firebird) (Bug #12369)</li>
<li>[Feature] Make effect of a changed hideonline permission instantaneous</li>
<li>[Fix] Do not overwrite larger memory values in the installer (Bug #12195)</li>
<li>[Fix] Order forums on role permission mask (Bug #12337)</li>
<li>[Fix] Show "no image" image when a non-selectable item was selected in the acp imageset editor - IE (Bug #12423)</li>
<li>[Fix] Update session information without new pageload (Bug #12393, Bug #12441)</li>
<li>[Fix] Let polls be edited correctly (Bug #12433)</li>
<li>[Fix] Overcome Oracle's inability to handle IN() clauses with over one thousand elements (Bug #12449)</li>
<li>[Fix] Simulate Firebird's affected rows mechanism for older versions of PHP</li>
<li>[Fix] Custom BBCodes properly handle lowercasing of parameterized tags (Bug #12377)</li>
<li>[Fix] Update the forum_id sequence for PostgreSQL during conversion (Bug #11927)</li>
<li>[Fix] Allow for multiple tags containing URL and LOCAL_URL tokens (Bug #12473)</li>
<li>[Fix] Properly display forum list in the MCP Queue (Bug #11313)</li>
<li>[Fix] Use the localised guest name for quotes (Bug #12483)</li>
<li>[Fix] Added post anchor to links in default warning message (Bug #12489)</li>
<li>[Fix] Allow 5 digits in editing time fields (Bug #12489)</li>
<li>[Fix] MS SQL DBAL drivers now write over extension limitations, they are too low for most installations (Bug #12415)</li>
<li>[Fix] Fix sorting by author on "unanswered posts" (Bug #12545)</li>
<li>[Fix] Allow searching for multibyte authors (Bug #11793)</li>
<li>[Fix] Writing directories/files with correct permissions using FTP for transfers on PHP4</li>
<li>[Fix] Oracle sequences during conversions are now corrected (Bug #12555)</li>
<li>[Fix] Allow users to continue after selecting "No" in the merge quickmod confirmation (Bug #12577)</li>
<li>[Fix] Correctly check permissions on the UCP subscription/bookmark pages (Bug #12595)</li>
<li>[Fix] Only convert non-orphaned PMs</li>
<li>[Fix] Fixed a few Postgres related errors (Bug #12587)</li>
<li>[Feature] New DBAL wrapper for LIKE expressions / sql_like_expression()</li>
<li>[Sec] Stricter validation of language entries. </li>
</ul>
</div>
<div class="back2top"><a href="#wrap" class="top">Back to Top</a></div>
<span class="corners-bottom"><span></span></span></div>
</div>
<hr />
<a name="disclaimer"></a><h2>2. Copyright and disclaimer</h2>
<div class="paragraph">
<div class="inner"><span class="corners-top"><span></span></span>
<div class="content">
<p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-license.php">GPL</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p>
</div>
<div class="back2top"><a href="#wrap" class="top">Back to Top</a></div>
<span class="corners-bottom"><span></span></span></div>
</div>
<!-- END DOCUMENT -->
<div id="page-footer">
<div class="version">Note that a full list of fixed bugs can be found at the bug tracker (<a href="README.html#bugs">see section on bug reporting</a>)</div>
</div>
</div></div>
<div>
<a id="bottom" name="bottom" accesskey="z"></a>
</div>
</body>
</html>

View File

@@ -273,7 +273,7 @@
<p>This package is meant for those wanting to only replace changed files from a previous version to the latest version. This package normally contains the changed files from up to five previous versions.</p>
<p>This package contains a number of archives, each contains the files changed from a given release to the latest version. You should select the appropriate archive for your current version, e.g. if you currently have <samp>3.0.3</samp> you should select the phpBB-3.0.3_to_3.0.4.zip/tar.gz file.</p>
<p>This package contains a number of archives, each contains the files changed from a given release to the latest version. You should select the appropriate archive for your current version, e.g. if you currently have <samp>3.0.2</samp> you should select the phpBB-3.0.2_to_3.0.3.zip/tar.gz file.</p>
<p>The directory structure has been preserved enabling you (if you wish) to simply upload the contents of the archive to the appropriate location on your server, i.e. simply overwrite the existing files with the new versions. Do not forget that if you have installed any MODs these files will overwrite the originals possibly destroying them in the process. You will need to re-add MODs to any affected file before uploading.</p>
@@ -285,7 +285,7 @@
<p>The patch file is one solution for those with many Modifications (MODs) or other changes who do not want to re-add them back to all the changed files if they use the method explained above. To use this you will need command line access to a standard UNIX type <strong>patch</strong> application. If you do not have access to such an application but still want to use this update approach, we strongly recommend the <a href="#update_auto">Automatic update package</a> explained below. It is also the preferred update method.</p>
<p>A number of patch files are provided to allow you to update from previous stable releases. Select the correct patch, e.g. if your current version is 3.0.3 you need the phpBB-3.0.3_to_3.0.4.patch file. Place the correct patch in the parent directory containing the phpBB3 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: <strong>patch -cl -d [PHPBB DIRECTORY] -p1 &lt; [PATCH NAME]</strong> (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB3, and where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.</p>
<p>A number of patch files are provided to allow you to update from previous stable releases. Select the correct patch, e.g. if your current version is 3.0.2 you need the phpBB-3.0.2_to_3.0.3.patch file. Place the correct patch in the parent directory containing the phpBB3 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: <strong>patch -cl -d [PHPBB DIRECTORY] -p1 &lt; [PATCH NAME]</strong> (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB3, and where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.</p>
<p>If you do get failures you should look at using the <a href="#update_files">Changed files only</a> package to replace the files which failed to patch, please note that you will need to manually re-add any Modifications (MODs) to these particular files. Alternatively if you know how you can examine the .rej files to determine what failed where and make manual adjustments to the relevant source.</p>

4
phpBB/docs/changes.txt Normal file
View File

@@ -0,0 +1,4 @@
List of major changes since 3.0.x:
- new stack-based bbcode system
- Migrate phpBB to PHP versions >= 5.2

View File

@@ -69,15 +69,7 @@
</ol>
</li>
<li><a href="#styling">Styling</a></li>
<ol style="list-style-type: lower-roman;">
<li><a href="#cfgfiles">Style Config Files</a></li>
<li><a href="#genstyling">General Styling Rules</a></li>
</ol></li>
<li><a href="#templating">Templating</a>
<ol style="list-style-type: lower-roman;">
<li><a href="#templates">General Templating</a></li>
<li><a href="#inheritance">Template Inheritance</a></li>
</ol></li>
<li><a href="#templating">Templating</a></li>
<li><a href="#charsets">Character Sets and Encodings</a></li>
<li><a href="#translation">Translation (<abbr title="Internationalisation">i18n</abbr>/<abbr title="Localisation">L10n</abbr>) Guidelines</a>
<ol style="list-style-type: lower-roman;">
@@ -406,12 +398,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;amp;start=' . $start;
$some_string = $board_url . 'someurl.php?mode=' . $mode . '&amp;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;amp;start=$start";
$some_string = "{$board_url}someurl.php?mode=$mode&amp;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>
@@ -883,7 +875,7 @@ $submit = (isset($HTTP_POST_VARS['submit'])) ? true : false;
<p class="good">// Use request var and define a default variable (use the correct type)</p>
<div class="codebox"><pre>
$start = request_var('start', 0);
$submit = (isset($_POST['submit'])) ? true : false;
$submit = request::is_set_post('submit');
</pre></div>
<p class="bad">// $start is an int, the following use of request_var therefore is not allowed</p>
@@ -954,12 +946,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(&quot;{$phpbb_root_path}memberlist.$phpEx&quot;, 'mode=group&amp;amp;g=' . $row['group_id'])
append_sid(PHPBB_ROOT_PATH . 'memberlist.' . PHP_EXT, 'mode=group&amp;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;amp;g=' . $row['group_id'])
</pre></div>
<h4>General function usage: </h4>
@@ -1080,6 +1078,7 @@ append_sid(&quot;{$phpbb_root_path}memberlist.$phpEx&quot;, 'mode=group&amp;amp;
<div class="inner"><span class="corners-top"><span></span></span>
<div class="content">
<a name="templates"></a><h3>4.i. General Templating</h3>
<h4>File naming</h4>
@@ -2258,14 +2257,6 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
<div class="content">
<h3>Revision 8732</h3>
<ul>
<li>Added cfg files.</li>
<li>Added template <a href="#inheritance">inheritance</a>.</li>
</ul>
<h3>Revision 8596+</h3>
<ul>

View File

@@ -383,10 +383,10 @@ a:active { color: #368AD2; }
<p>There are also valid external constants you may want to use if you embed phpBB3 into your application:</p>
<div class="codebox"><pre>
PHPBB_MSG_HANDLER (overwrite message handler)
PHPBB_MSG_HANDLER (define own message handler)
PHPBB_DB_NEW_LINK (overwrite new_link parameter for sql_connect)
PHPBB_ROOT_PATH (overwrite $phpbb_root_path)
PHPBB_ADMIN_PATH (overwrite $phpbb_admin_path)
PHPBB_ROOT_PATH (define own PHPBB_ROOT_PATH)
PHPBB_ADMIN_PATH (define own PHPBB_ADMIN_PATH)
</pre></div>
</div>

View File

@@ -12,8 +12,9 @@
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
if (!defined('PHPBB_ROOT_PATH')) define('PHPBB_ROOT_PATH', './../');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
// Thank you sun.
@@ -29,35 +30,13 @@ else if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'
exit;
}
if (isset($_GET['avatar']))
if (request::is_set('avatar', request::GET))
{
require($phpbb_root_path . 'config.' . $phpEx);
if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type))
{
exit;
}
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx);
require($phpbb_root_path . 'includes/cache.' . $phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx);
$db = new $sql_db();
$cache = new cache();
// Connect to DB
if (!@$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false))
{
exit;
}
unset($dbpasswd);
// worst-case default
$browser = (!empty($_SERVER['HTTP_USER_AGENT'])) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : 'msie 6.0';
$config = $cache->obtain_config();
$filename = $_GET['avatar'];
$config = cache::obtain_config();
$filename = request::variable('avatar', '', false, request::GET);
$avatar_group = false;
$exit = false;
@@ -70,7 +49,7 @@ if (isset($_GET['avatar']))
// '==' is not a bug - . as the first char is as bad as no dot at all
if (strpos($filename, '.') == false)
{
header('HTTP/1.0 403 Forbidden');
header('HTTP/1.0 403 forbidden');
$exit = true;
}
@@ -105,8 +84,6 @@ if (isset($_GET['avatar']))
}
// implicit else: we are not in avatar mode
include($phpbb_root_path . 'common.' . $phpEx);
$download_id = request_var('id', 0);
$mode = request_var('mode', '');
$thumbnail = request_var('t', false);
@@ -156,7 +133,7 @@ if ($attachment['is_orphan'])
}
// Obtain all extensions...
$extensions = $cache->obtain_attach_extensions(true);
$extensions = cache::obtain_attach_extensions(true);
}
else
{
@@ -192,7 +169,7 @@ else
$row['forum_id'] = false;
if (!$auth->acl_get('u_pm_download'))
{
header('HTTP/1.0 403 Forbidden');
header('HTTP/1.0 403 forbidden');
trigger_error('SORRY_AUTH_VIEW_ATTACH');
}
@@ -215,7 +192,7 @@ else
if (!$allowed)
{
header('HTTP/1.0 403 Forbidden');
header('HTTP/1.0 403 forbidden');
trigger_error('ERROR_NO_ATTACHMENT');
}
}
@@ -230,7 +207,7 @@ else
if (!download_allowed())
{
header('HTTP/1.0 403 Forbidden');
header('HTTP/1.0 403 forbidden');
trigger_error($user->lang['LINKAGE_FORBIDDEN']);
}
@@ -277,7 +254,7 @@ else if (($display_cat == ATTACHMENT_CATEGORY_NONE || $display_cat == ATTACHMENT
if ($display_cat == ATTACHMENT_CATEGORY_IMAGE && $mode === 'view' && (strpos($attachment['mimetype'], 'image') === 0) && ((strpos(strtolower($user->browser), 'msie') !== false) && (strpos(strtolower($user->browser), 'msie 8.0') === false)))
{
wrap_img_in_html(append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'id=' . $attachment['attach_id']), $attachment['real_filename']);
wrap_img_in_html(append_sid('download/file', 'id=' . $attachment['attach_id']), $attachment['real_filename']);
}
else
{
@@ -285,12 +262,12 @@ else
if ($download_mode == PHYSICAL_LINK)
{
// This presenting method should no longer be used
if (!@is_dir($phpbb_root_path . $config['upload_path']))
if (!@is_dir(PHPBB_ROOT_PATH . $config['upload_path']))
{
trigger_error($user->lang['PHYSICAL_DOWNLOAD_NOT_POSSIBLE']);
}
redirect($phpbb_root_path . $config['upload_path'] . '/' . $attachment['physical_filename']);
redirect(PHPBB_ROOT_PATH . $config['upload_path'] . '/' . $attachment['physical_filename']);
file_gc();
}
else
@@ -307,7 +284,7 @@ else
*/
function send_avatar_to_browser($file, $browser)
{
global $config, $phpbb_root_path;
global $config;
$prefix = $config['avatar_salt'] . '_';
$image_dir = $config['avatar_path'];
@@ -323,7 +300,7 @@ function send_avatar_to_browser($file, $browser)
{
$image_dir = '';
}
$file_path = $phpbb_root_path . $image_dir . '/' . $prefix . $file;
$file_path = PHPBB_ROOT_PATH . $image_dir . '/' . $prefix . $file;
if ((@file_exists($file_path) && @is_readable($file_path)) && !headers_sent())
{
@@ -405,9 +382,9 @@ function wrap_img_in_html($src, $title)
*/
function send_file_to_browser($attachment, $upload_dir, $category)
{
global $user, $db, $config, $phpbb_root_path;
global $user, $db, $config;
$filename = $phpbb_root_path . $upload_dir . '/' . $attachment['physical_filename'];
$filename = PHPBB_ROOT_PATH . $upload_dir . '/' . $attachment['physical_filename'];
if (!@file_exists($filename))
{

View File

@@ -12,9 +12,9 @@
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
if (!defined('PHPBB_ROOT_PATH')) define('PHPBB_ROOT_PATH', './');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
// Start session management
$user->session_begin();
@@ -67,7 +67,7 @@ page_header($l_title);
$template->set_filenames(array(
'body' => 'faq_body.html')
);
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
make_jumpbox(append_sid('viewforum'));
page_footer();

View File

@@ -0,0 +1,320 @@
<?php
/**
*
* @package acm
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* ACM APC Based Caching
* @package acm
*/
class acm
{
private $vars = array();
private $is_modified = false;
public $sql_rowset = array();
public $cache_dir = '';
/**
* Set cache path
*/
function __construct()
{
$this->cache_dir = PHPBB_ROOT_PATH . 'cache/';
}
/**
* Load global cache
*/
private function load()
{
// grab the global cache
if ($this->vars = apc_fetch('global'))
{
return true;
}
return false;
}
/**
* Unload cache object
*/
public function unload()
{
$this->save();
unset($this->vars);
unset($this->sql_rowset);
$this->vars = array();
$this->sql_rowset = array();
}
/**
* Save modified objects
*/
private function save()
{
if (!$this->is_modified)
{
return;
}
apc_store('global', $this->vars, 31536000);
$this->is_modified = false;
}
/**
* Tidy cache
*/
public function tidy()
{
// cache has auto GC, no need to have any code here :)
set_config('cache_last_gc', time(), true);
}
/**
* Get saved cache object
*/
public function get($var_name)
{
if ($var_name[0] === '_')
{
return apc_fetch($var_name);
}
else
{
if (!sizeof($this->vars))
{
$this->load();
}
return (isset($this->vars[$var_name])) ? $this->vars[$var_name] : false;
}
}
/**
* Put data into cache
*/
public function put($var_name, $var, $ttl = 31536000)
{
if ($var_name[0] === '_')
{
apc_store($var_name, $var, $ttl);
}
else
{
$this->vars[$var_name] = $var;
$this->is_modified = true;
}
}
/**
* Purge cache data
*/
public function purge()
{
// Purge all phpbb cache files
$dir = @opendir($this->cache_dir);
if (!$dir)
{
return;
}
while (($entry = readdir($dir)) !== false)
{
if (strpos($entry, 'sql_') !== 0 && strpos($entry, 'data_') !== 0 && strpos($entry, 'ctpl_') !== 0 && strpos($entry, 'tpl_') !== 0)
{
continue;
}
@unlink($this->cache_dir . $entry);
}
closedir($dir);
apc_clear_cache('user');
unset($this->vars);
unset($this->sql_rowset);
$this->vars = array();
$this->var_expires = array();
$this->sql_rowset = array();
$this->is_modified = false;
}
/**
* Destroy cache data
*/
public function destroy($var_name, $table = '')
{
if ($var_name === 'sql' && !empty($table))
{
if (!is_array($table))
{
$table = array($table);
}
foreach ($table as $table_name)
{
// gives us the md5s that we want
$temp = apc_fetch('sql_' . $table_name);
if ($temp === false)
{
continue;
}
// delete each query ref
foreach ($temp as $md5_id => $void)
{
apc_delete('sql_' . $md5_id);
}
// delete the table ref
apc_delete('sql_' . $table_name);
}
return;
}
if ($var_name[0] === '_')
{
apc_delete($var_name);
}
else if (isset($this->vars[$var_name]))
{
$this->is_modified = true;
unset($this->vars[$var_name]);
// We save here to let the following cache hits succeed
$this->save();
}
}
/**
* Load cached sql query
*/
public function sql_load($query)
{
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
$query_id = sizeof($this->sql_rowset);
$temp = apc_fetch('sql_' . md5($query));
if ($temp === false)
{
return false;
}
$this->sql_rowset[$query_id] = $temp;
return $query_id;
}
/**
* Save sql query
*/
public function sql_save($query, &$query_result, $ttl)
{
global $db;
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
// determine which tables this query belongs to:
// grab all the FROM tables, avoid getting a LEFT JOIN
preg_match('/FROM \(?(\w+(?: (?!LEFT JOIN)\w+)?(?:, ?\w+(?: (?!LEFT JOIN)\w+)?)*)\)?/', $query, $regs);
$tables = array_map('trim', explode(',', $regs[1]));
// now get the LEFT JOIN
preg_match_all('/LEFT JOIN\s+(\w+)(?: \w+)?/', $query, $result, PREG_PATTERN_ORDER);
$tables = array_merge($tables, $result[1]);
$query_hash = md5($query);
foreach ($tables as $table_name)
{
if (($pos = strpos($table_name, ' ')) !== false)
{
$table_name = substr($table_name, 0, $pos);
}
$temp = apc_fetch('sql_' . $table_name);
if ($temp === false)
{
$temp = array();
}
$temp[$query_hash] = true;
apc_store('sql_' . $table_name, $temp, $ttl);
}
// store them in the right place
$query_id = sizeof($this->sql_rowset);
$this->sql_rowset[$query_id] = array();
while ($row = $db->sql_fetchrow($query_result))
{
$this->sql_rowset[$query_id][] = $row;
}
$db->sql_freeresult($query_result);
apc_store('sql_' . $query_hash, $this->sql_rowset[$query_id], $ttl);
$query_result = $query_id;
}
/**
* Fetch row from cache (database)
*/
public function sql_fetchrow($query_id)
{
list(, $row) = each($this->sql_rowset[$query_id]);
return ($row !== NULL) ? $row : false;
}
/**
* Fetch a field from the current row of a cached database result (database)
*/
public function sql_fetchfield($query_id, $field)
{
$row = current($this->sql_rowset[$query_id]);
return ($row !== false && isset($row[$field])) ? $row[$field] : false;
}
/**
* Free memory used for a cached database result (database)
*/
public function sql_freeresult($query_id)
{
if (!isset($this->sql_rowset[$query_id]))
{
return false;
}
unset($this->sql_rowset[$query_id]);
return true;
}
}
?>

View File

@@ -0,0 +1,336 @@
<?php
/**
*
* @package acm
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* ACM eAccelerator Based Caching
* @package acm
*/
class acm
{
private $vars = array();
private $is_modified = false;
public $sql_rowset = array();
public $cache_dir = '';
/**
* Set cache path
*/
function __construct()
{
$this->cache_dir = PHPBB_ROOT_PATH . 'cache/';
}
/**
* Load global cache
*/
private function load()
{
// grab the global cache
if ($this->vars = eaccelerator_get('global'))
{
return true;
}
return false;
}
/**
* Unload cache object
*/
public function unload()
{
$this->save();
unset($this->vars);
unset($this->sql_rowset);
$this->vars = array();
$this->sql_rowset = array();
}
/**
* Save modified objects
*/
private function save()
{
if (!$this->is_modified)
{
return;
}
eaccelerator_put('global', $this->vars, 31536000);
$this->is_modified = false;
}
/**
* Tidy cache
*/
public function tidy()
{
eaccelerator_gc();
set_config('cache_last_gc', time(), true);
}
/**
* Get saved cache object
*/
public function get($var_name)
{
if ($var_name[0] === '_')
{
$temp = eaccelerator_get($var_name);
if ($temp !== null)
{
return $temp;
}
else
{
return false;
}
}
else
{
if (!sizeof($this->vars))
{
$this->load();
}
return (isset($this->vars[$var_name])) ? $this->vars[$var_name] : false;
}
}
/**
* Put data into cache
*/
public function put($var_name, $var, $ttl = 31536000)
{
if ($var_name[0] === '_')
{
eaccelerator_put($var_name, $var, $ttl);
}
else
{
$this->vars[$var_name] = $var;
$this->is_modified = true;
}
}
/**
* Purge cache data
*/
public function purge()
{
// Purge all phpbb cache files
$dir = @opendir($this->cache_dir);
if (!$dir)
{
return;
}
while (($entry = readdir($dir)) !== false)
{
if (strpos($entry, 'sql_') !== 0 && strpos($entry, 'data_') !== 0 && strpos($entry, 'ctpl_') !== 0 && strpos($entry, 'tpl_') !== 0)
{
continue;
}
@unlink($this->cache_dir . $entry);
}
closedir($dir);
foreach (eaccelerator_list_keys() as $var)
{
eaccelerator_rm(substr($var['name'], 1));
}
unset($this->vars);
unset($this->sql_rowset);
$this->vars = array();
$this->var_expires = array();
$this->sql_rowset = array();
$this->is_modified = false;
}
/**
* Destroy cache data
*/
public function destroy($var_name, $table = '')
{
if ($var_name === 'sql' && !empty($table))
{
if (!is_array($table))
{
$table = array($table);
}
foreach ($table as $table_name)
{
// gives us the md5s that we want
eaccelerator_lock('sql_' . $table_name);
$temp = eaccelerator_get('sql_' . $table_name);
if ($temp === null)
{
continue;
}
// delete each query ref
foreach ($temp as $md5_id => $void)
{
eaccelerator_lock('sql_' . $md5_id);
eaccelerator_rm('sql_' . $md5_id);
eaccelerator_unlock('sql_' . $md5_id);
}
// delete the table ref
eaccelerator_rm('sql_' . $table_name);
eaccelerator_unlock('sql_' . $table_name);
}
return;
}
if ($var_name[0] === '_')
{
eaccelerator_rm($var_name);
}
else if (isset($this->vars[$var_name]))
{
$this->is_modified = true;
unset($this->vars[$var_name]);
// We save here to let the following cache hits succeed
$this->save();
}
}
/**
* Load cached sql query
*/
public function sql_load($query)
{
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
$query_id = sizeof($this->sql_rowset);
$temp = eaccelerator_get('sql_' . md5($query));
if ($temp === null)
{
return false;
}
$this->sql_rowset[$query_id] = $temp;
return $query_id;
}
/**
* Save sql query
*/
public function sql_save($query, &$query_result, $ttl)
{
global $db;
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
// determine which tables this query belongs to:
// grab all the FROM tables, avoid getting a LEFT JOIN
preg_match('/FROM \(?(\w+(?: (?!LEFT JOIN)\w+)?(?:, ?\w+(?: (?!LEFT JOIN)\w+)?)*)\)?/', $query, $regs);
$tables = array_map('trim', explode(',', $regs[1]));
// now get the LEFT JOIN
preg_match_all('/LEFT JOIN\s+(\w+)(?: \w+)?/', $query, $result, PREG_PATTERN_ORDER);
$tables = array_merge($tables, $result[1]);
$query_hash = md5($query);
foreach ($tables as $table_name)
{
if (($pos = strpos($table_name, ' ')) !== false)
{
$table_name = substr($table_name, 0, $pos);
}
$temp = eaccelerator_get('sql_' . $table_name);
if ($temp === null)
{
$temp = array();
}
$temp[$query_hash] = true;
eaccelerator_put('sql_' . $table_name, $temp, $ttl);
}
// store them in the right place
$query_id = sizeof($this->sql_rowset);
$this->sql_rowset[$query_id] = array();
while ($row = $db->sql_fetchrow($query_result))
{
$this->sql_rowset[$query_id][] = $row;
}
$db->sql_freeresult($query_result);
eaccelerator_put('sql_' . $query_hash, $this->sql_rowset[$query_id], $ttl);
$query_result = $query_id;
}
/**
* Fetch row from cache (database)
*/
public function sql_fetchrow($query_id)
{
list(, $row) = each($this->sql_rowset[$query_id]);
return ($row !== NULL) ? $row : false;
}
/**
* Fetch a field from the current row of a cached database result (database)
*/
public function sql_fetchfield($query_id, $field)
{
$row = current($this->sql_rowset[$query_id]);
return ($row !== false && isset($row[$field])) ? $row[$field] : false;
}
/**
* Free memory used for a cached database result (database)
*/
public function sql_freeresult($query_id)
{
if (!isset($this->sql_rowset[$query_id]))
{
return false;
}
unset($this->sql_rowset[$query_id]);
return true;
}
}
?>

View File

@@ -22,84 +22,74 @@ if (!defined('IN_PHPBB'))
*/
class acm
{
var $vars = array();
var $var_expires = array();
var $is_modified = false;
private $vars = array();
private $var_expires = array();
private $is_modified = false;
var $sql_rowset = array();
var $sql_row_pointer = array();
var $cache_dir = '';
public $sql_rowset = array();
public $cache_dir = '';
/**
* Set cache path
*/
function acm()
function __construct()
{
global $phpbb_root_path;
$this->cache_dir = $phpbb_root_path . 'cache/';
$this->cache_dir = PHPBB_ROOT_PATH . 'cache/';
}
/**
* Load global cache
*/
function load()
private function load()
{
global $phpEx;
if (file_exists($this->cache_dir . 'data_global.' . $phpEx))
// grab the global cache
if (file_exists($this->cache_dir . 'data_global.' . PHP_EXT))
{
@include($this->cache_dir . 'data_global.' . $phpEx);
}
else
{
return false;
@include($this->cache_dir . 'data_global.' . PHP_EXT);
return true;
}
return true;
return false;
}
/**
* Unload cache object
*/
function unload()
public function unload()
{
$this->save();
unset($this->vars);
unset($this->var_expires);
unset($this->sql_rowset);
unset($this->sql_row_pointer);
$this->vars = array();
$this->var_expires = array();
$this->sql_rowset = array();
$this->sql_row_pointer = array();
}
/**
* Save modified objects
*/
function save()
private function save()
{
if (!$this->is_modified)
{
return;
}
global $phpEx;
if ($fp = @fopen($this->cache_dir . 'data_global.' . $phpEx, 'wb'))
if ($fp = @fopen($this->cache_dir . 'data_global.' . PHP_EXT, 'wb'))
{
@flock($fp, LOCK_EX);
fwrite($fp, "<?php\n\$this->vars = " . var_export($this->vars, true) . ";\n\n\$this->var_expires = " . var_export($this->var_expires, true) . "\n?>");
fwrite($fp, "<?php\n\$this->vars = unserialize(" . var_export(serialize($this->vars), true) . ");\n\$this->var_expires = unserialize(" . var_export(serialize($this->var_expires), true) . ");");
@flock($fp, LOCK_UN);
fclose($fp);
if (!function_exists('phpbb_chmod'))
{
global $phpbb_root_path;
include($phpbb_root_path . 'includes/functions.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
}
phpbb_chmod($this->cache_dir . 'data_global.' . $phpEx, CHMOD_WRITE);
phpbb_chmod($this->cache_dir . 'data_global.' . PHP_EXT, CHMOD_WRITE);
}
else
{
@@ -109,7 +99,7 @@ class acm
trigger_error($this->cache_dir . ' is NOT writable.', E_USER_ERROR);
}
trigger_error('Not able to open ' . $this->cache_dir . 'data_global.' . $phpEx, E_USER_ERROR);
trigger_error('Not able to open ' . $this->cache_dir . 'data_global.' . PHP_EXT, E_USER_ERROR);
}
$this->is_modified = false;
@@ -118,10 +108,8 @@ class acm
/**
* Tidy cache
*/
function tidy()
public function tidy()
{
global $phpEx;
$dir = @opendir($this->cache_dir);
if (!$dir)
@@ -145,7 +133,7 @@ class acm
}
closedir($dir);
if (file_exists($this->cache_dir . 'data_global.' . $phpEx))
if (file_exists($this->cache_dir . 'data_global.' . PHP_EXT))
{
if (!sizeof($this->vars))
{
@@ -167,18 +155,16 @@ class acm
/**
* Get saved cache object
*/
function get($var_name)
public function get($var_name)
{
if ($var_name[0] == '_')
if ($var_name[0] === '_')
{
global $phpEx;
if (!$this->_exists($var_name))
{
return false;
}
@include($this->cache_dir . "data{$var_name}.$phpEx");
@include($this->cache_dir . "data{$var_name}." . PHP_EXT);
return (isset($data)) ? $data : false;
}
else
@@ -192,24 +178,21 @@ class acm
*/
function put($var_name, $var, $ttl = 31536000)
{
if ($var_name[0] == '_')
if ($var_name[0] === '_')
{
global $phpEx;
if ($fp = @fopen($this->cache_dir . "data{$var_name}.$phpEx", 'wb'))
if ($fp = @fopen($this->cache_dir . "data{$var_name}." . PHP_EXT, 'wb'))
{
@flock($fp, LOCK_EX);
fwrite($fp, "<?php\n\$expired = (time() > " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n\n\$data = " . (sizeof($var) ? "unserialize(" . var_export(serialize($var), true) . ");" : 'array();') . "\n\n?>");
fwrite($fp, "<?php\n\$expired = (time() > " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n\$data = " . (sizeof($var) ? "unserialize(" . var_export(serialize($var), true) . ");" : 'array();'));
@flock($fp, LOCK_UN);
fclose($fp);
if (!function_exists('phpbb_chmod'))
{
global $phpbb_root_path;
include($phpbb_root_path . 'includes/functions.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
}
phpbb_chmod($this->cache_dir . "data{$var_name}.$phpEx", CHMOD_WRITE);
phpbb_chmod($this->cache_dir . "data{$var_name}." . PHP_EXT, CHMOD_WRITE);
}
}
else
@@ -223,7 +206,7 @@ class acm
/**
* Purge cache data
*/
function purge()
public function purge()
{
// Purge all phpbb cache files
$dir = @opendir($this->cache_dir);
@@ -247,12 +230,10 @@ class acm
unset($this->vars);
unset($this->var_expires);
unset($this->sql_rowset);
unset($this->sql_row_pointer);
$this->vars = array();
$this->var_expires = array();
$this->sql_rowset = array();
$this->sql_row_pointer = array();
$this->is_modified = false;
}
@@ -260,11 +241,9 @@ class acm
/**
* Destroy cache data
*/
function destroy($var_name, $table = '')
public function destroy($var_name, $table = '')
{
global $phpEx;
if ($var_name == 'sql' && !empty($table))
if ($var_name === 'sql' && !empty($table))
{
if (!is_array($table))
{
@@ -322,9 +301,9 @@ class acm
return;
}
if ($var_name[0] == '_')
if ($var_name[0] === '_')
{
$this->remove_file($this->cache_dir . 'data' . $var_name . ".$phpEx", true);
$this->remove_file($this->cache_dir . 'data' . $var_name . '.' . PHP_EXT, true);
}
else if (isset($this->vars[$var_name]))
{
@@ -340,12 +319,11 @@ class acm
/**
* Check if a given cache entry exist
*/
function _exists($var_name)
private function _exists($var_name)
{
if ($var_name[0] == '_')
if ($var_name[0] === '_')
{
global $phpEx;
return file_exists($this->cache_dir . 'data' . $var_name . ".$phpEx");
return file_exists($this->cache_dir . 'data' . $var_name . '.' . PHP_EXT);
}
else
{
@@ -366,20 +344,18 @@ class acm
/**
* Load cached sql query
*/
function sql_load($query)
public function sql_load($query)
{
global $phpEx;
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
$query_id = sizeof($this->sql_rowset);
if (!file_exists($this->cache_dir . 'sql_' . md5($query) . ".$phpEx"))
if (!file_exists($this->cache_dir . 'sql_' . md5($query) . '.' . PHP_EXT))
{
return false;
}
@include($this->cache_dir . 'sql_' . md5($query) . ".$phpEx");
@include($this->cache_dir . 'sql_' . md5($query) . '.' . PHP_EXT);
if (!isset($expired))
{
@@ -387,11 +363,10 @@ class acm
}
else if ($expired)
{
$this->remove_file($this->cache_dir . 'sql_' . md5($query) . ".$phpEx", true);
$this->remove_file($this->cache_dir . 'sql_' . md5($query) . '.' . PHP_EXT, true);
return false;
}
$this->sql_row_pointer[$query_id] = 0;
return $query_id;
}
@@ -399,13 +374,13 @@ class acm
/**
* Save sql query
*/
function sql_save($query, &$query_result, $ttl)
public function sql_save($query, &$query_result, $ttl)
{
global $db, $phpEx;
global $db;
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
$filename = $this->cache_dir . 'sql_' . md5($query) . '.' . $phpEx;
$filename = $this->cache_dir . 'sql_' . md5($query) . '.' . PHP_EXT;
if ($fp = @fopen($filename, 'wb'))
{
@@ -413,7 +388,6 @@ class acm
$query_id = sizeof($this->sql_rowset);
$this->sql_rowset[$query_id] = array();
$this->sql_row_pointer[$query_id] = 0;
while ($row = $db->sql_fetchrow($query_result))
{
@@ -421,17 +395,16 @@ class acm
}
$db->sql_freeresult($query_result);
$file = "<?php\n\n/* " . str_replace('*/', '*\/', $query) . " */\n";
$file = "<?php\n/* " . str_replace('*/', '*\/', $query) . " */";
$file .= "\n\$expired = (time() > " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n";
fwrite($fp, $file . "\n\$this->sql_rowset[\$query_id] = " . (sizeof($this->sql_rowset[$query_id]) ? "unserialize(" . var_export(serialize($this->sql_rowset[$query_id]), true) . ");" : 'array();') . "\n\n?>");
fwrite($fp, $file . "\$this->sql_rowset[\$query_id] = " . (sizeof($this->sql_rowset[$query_id]) ? "unserialize(" . var_export(serialize($this->sql_rowset[$query_id]), true) . ");" : 'array();'));
@flock($fp, LOCK_UN);
fclose($fp);
if (!function_exists('phpbb_chmod'))
{
global $phpbb_root_path;
include($phpbb_root_path . 'includes/functions.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
}
phpbb_chmod($filename, CHMOD_WRITE);
@@ -440,58 +413,30 @@ class acm
}
}
/**
* Ceck if a given sql query exist in cache
*/
function sql_exists($query_id)
{
return isset($this->sql_rowset[$query_id]);
}
/**
* Fetch row from cache (database)
*/
function sql_fetchrow($query_id)
public function sql_fetchrow($query_id)
{
if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
{
return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++];
}
list(, $row) = each($this->sql_rowset[$query_id]);
return false;
return ($row !== NULL) ? $row : false;
}
/**
* Fetch a field from the current row of a cached database result (database)
*/
function sql_fetchfield($query_id, $field)
public function sql_fetchfield($query_id, $field)
{
if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
{
return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field] : false;
}
$row = current($this->sql_rowset[$query_id]);
return false;
}
/**
* Seek a specific row in an a cached database result (database)
*/
function sql_rowseek($rownum, $query_id)
{
if ($rownum >= sizeof($this->sql_rowset[$query_id]))
{
return false;
}
$this->sql_row_pointer[$query_id] = $rownum;
return true;
return ($row !== false && isset($row[$field])) ? $row[$field] : false;
}
/**
* Free memory used for a cached database result (database)
*/
function sql_freeresult($query_id)
public function sql_freeresult($query_id)
{
if (!isset($this->sql_rowset[$query_id]))
{
@@ -499,7 +444,6 @@ class acm
}
unset($this->sql_rowset[$query_id]);
unset($this->sql_row_pointer[$query_id]);
return true;
}
@@ -507,7 +451,7 @@ class acm
/**
* Removes/unlinks file
*/
function remove_file($filename, $check = false)
private function remove_file($filename, $check = false)
{
if ($check && !@is_writable($this->cache_dir))
{

View File

@@ -0,0 +1,322 @@
<?php
/**
*
* @package acm
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* ACM Memcache Based Caching
* @package acm
*/
class acm
{
private $vars = array();
private $is_modified = false;
public $sql_rowset = array();
public $cache_dir = '';
private $memcache;
/**
* Set cache path
*/
function __construct()
{
$this->memcache = memcache_connect('localhost', 11211);
}
/**
* Load global cache
*/
private function load()
{
// grab the global cache
if ($this->vars = memcache_get($this->memcache, 'global'))
{
return true;
}
return false;
}
/**
* Unload cache object
*/
public function unload()
{
$this->save();
unset($this->vars);
unset($this->sql_rowset);
$this->vars = array();
$this->sql_rowset = array();
}
/**
* Save modified objects
*/
private function save()
{
if (!$this->is_modified)
{
return;
}
memcache_set($this->memcache, 'global', $this->vars, 0, 2592000);
$this->is_modified = false;
}
/**
* Tidy cache
*/
public function tidy()
{
// cache has auto GC, no need to have any code here :)
set_config('cache_last_gc', time(), true);
}
/**
* Get saved cache object
*/
public function get($var_name)
{
if ($var_name[0] === '_')
{
return memcache_get($this->memcache, $var_name);
}
else
{
if (!sizeof($this->vars))
{
$this->load();
}
return (isset($this->vars[$var_name])) ? $this->vars[$var_name] : false;
}
}
/**
* Put data into cache
*/
public function put($var_name, $var, $ttl = 31536000)
{
if ($var_name[0] === '_')
{
memcache_set($this->memcache, $var_name, $var, 0, $ttl);
}
else
{
$this->vars[$var_name] = $var;
$this->is_modified = true;
}
}
/**
* Purge cache data
*/
public function purge()
{
// Purge all phpbb cache files
$dir = @opendir($this->cache_dir);
if (!$dir)
{
return;
}
while (($entry = readdir($dir)) !== false)
{
if (strpos($entry, 'sql_') !== 0 && strpos($entry, 'data_') !== 0 && strpos($entry, 'ctpl_') !== 0 && strpos($entry, 'tpl_') !== 0)
{
continue;
}
@unlink($this->cache_dir . $entry);
}
closedir($dir);
memcache_flush($this->memcache);
unset($this->vars);
unset($this->sql_rowset);
$this->vars = array();
$this->var_expires = array();
$this->sql_rowset = array();
$this->is_modified = false;
}
/**
* Destroy cache data
*/
public function destroy($var_name, $table = '')
{
if ($var_name === 'sql' && !empty($table))
{
if (!is_array($table))
{
$table = array($table);
}
foreach ($table as $table_name)
{
// gives us the md5s that we want
$temp = memcache_get($this->memcache, 'sql_' . $table_name);
if ($temp === false)
{
continue;
}
// delete each query ref
foreach ($temp as $md5_id => $void)
{
memcache_delete($this->memcache, 'sql_' . $md5_id);
}
// delete the table ref
memcache_delete($this->memcache, 'sql_' . $table_name);
}
return;
}
if ($var_name[0] === '_')
{
memcache_delete($this->memcache, $var_name);
}
else if (isset($this->vars[$var_name]))
{
$this->is_modified = true;
unset($this->vars[$var_name]);
// We save here to let the following cache hits succeed
$this->save();
}
}
/**
* Load cached sql query
*/
public function sql_load($query)
{
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
$query_id = sizeof($this->sql_rowset);
$temp = memcache_get($this->memcache, 'sql_' . md5($query));
if ($temp === false)
{
return false;
}
$this->sql_rowset[$query_id] = $temp;
return $query_id;
}
/**
* Save sql query
*/
public function sql_save($query, &$query_result, $ttl)
{
global $db;
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
// determine which tables this query belongs to:
// grab all the FROM tables, avoid getting a LEFT JOIN
preg_match('/FROM \(?(\w+(?: (?!LEFT JOIN)\w+)?(?:, ?\w+(?: (?!LEFT JOIN)\w+)?)*)\)?/', $query, $regs);
$tables = array_map('trim', explode(',', $regs[1]));
// now get the LEFT JOIN
preg_match_all('/LEFT JOIN\s+(\w+)(?: \w+)?/', $query, $result, PREG_PATTERN_ORDER);
$tables = array_merge($tables, $result[1]);
$query_hash = md5($query);
foreach ($tables as $table_name)
{
if (($pos = strpos($table_name, ' ')) !== false)
{
$table_name = substr($table_name, 0, $pos);
}
$temp = memcache_get($this->memcache, 'sql_' . $table_name);
if ($temp === false)
{
$temp = array();
}
$temp[$query_hash] = true;
memcache_set($this->memcache, 'sql_' . $table_name, $temp, 0, $ttl);
}
// store them in the right place
$query_id = sizeof($this->sql_rowset);
$this->sql_rowset[$query_id] = array();
while ($row = $db->sql_fetchrow($query_result))
{
$this->sql_rowset[$query_id][] = $row;
}
$db->sql_freeresult($query_result);
memcache_set($this->memcache, 'sql_' . $query_hash, $this->sql_rowset[$query_id], 0, $ttl);
$query_result = $query_id;
}
/**
* Fetch row from cache (database)
*/
public function sql_fetchrow($query_id)
{
list(, $row) = each($this->sql_rowset[$query_id]);
return ($row !== NULL) ? $row : false;
}
/**
* Fetch a field from the current row of a cached database result (database)
*/
public function sql_fetchfield($query_id, $field)
{
$row = current($this->sql_rowset[$query_id]);
return ($row !== false && isset($row[$field])) ? $row[$field] : false;
}
/**
* Free memory used for a cached database result (database)
*/
public function sql_freeresult($query_id)
{
if (!isset($this->sql_rowset[$query_id]))
{
return false;
}
unset($this->sql_rowset[$query_id]);
return true;
}
}
?>

View File

@@ -0,0 +1,329 @@
<?php
/**
*
* @package acm
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* ACM XCache Based Caching
* @package acm
*/
class acm
{
private $vars = array();
private $is_modified = false;
public $sql_rowset = array();
public $cache_dir = '';
/**
* Set cache path
*/
function __construct()
{
$this->cache_dir = PHPBB_ROOT_PATH . 'cache/';
}
/**
* Load global cache
*/
private function load()
{
// grab the global cache
if (xcache_isset('global'))
{
$this->vars = xcache_get('global');
return true;
}
return false;
}
/**
* Unload cache object
*/
public function unload()
{
$this->save();
unset($this->vars);
unset($this->sql_rowset);
$this->vars = array();
$this->sql_rowset = array();
}
/**
* Save modified objects
*/
private function save()
{
if (!$this->is_modified)
{
return;
}
xcache_set('global', $this->vars, 31536000);
$this->is_modified = false;
}
/**
* Tidy cache
*/
public function tidy()
{
// cache has auto GC, no need to have any code here :)
set_config('cache_last_gc', time(), true);
}
/**
* Get saved cache object
*/
public function get($var_name)
{
if ($var_name[0] === '_')
{
return (xcache_isset($var_name)) ? xcache_get($var_name) : false;
}
else
{
if (!sizeof($this->vars))
{
$this->load();
}
return (isset($this->vars[$var_name])) ? $this->vars[$var_name] : false;
}
}
/**
* Put data into cache
*/
public function put($var_name, $var, $ttl = 31536000)
{
if ($var_name[0] === '_')
{
xcache_set($var_name, $var, $ttl);
}
else
{
$this->vars[$var_name] = $var;
$this->is_modified = true;
}
}
/**
* Purge cache data
*/
public function purge()
{
// Purge all phpbb cache files
$dir = @opendir($this->cache_dir);
if (!$dir)
{
return;
}
while (($entry = readdir($dir)) !== false)
{
if (strpos($entry, 'sql_') !== 0 && strpos($entry, 'data_') !== 0 && strpos($entry, 'ctpl_') !== 0 && strpos($entry, 'tpl_') !== 0)
{
continue;
}
@unlink($this->cache_dir . $entry);
}
closedir($dir);
$n = xcache_count(XC_TYPE_VAR);
for ($i = 0; $i < $n; $i++)
{
xcache_clear_cache(XC_TYPE_VAR, $i);
}
unset($this->vars);
unset($this->sql_rowset);
$this->vars = array();
$this->var_expires = array();
$this->sql_rowset = array();
$this->is_modified = false;
}
/**
* Destroy cache data
*/
public function destroy($var_name, $table = '')
{
if ($var_name === 'sql' && !empty($table))
{
if (!is_array($table))
{
$table = array($table);
}
foreach ($table as $table_name)
{
// gives us the md5s that we want
if (!xcache_isset('sql_' . $table_name))
{
continue;
}
$temp = xcache_get('sql_' . $table_name);
// delete each query ref
foreach ($temp as $md5_id => $void)
{
xcache_unset('sql_' . $md5_id);
}
// delete the table ref
xcache_unset('sql_' . $table_name);
}
return;
}
if ($var_name[0] === '_')
{
xcache_unset($var_name);
}
else if (isset($this->vars[$var_name]))
{
$this->is_modified = true;
unset($this->vars[$var_name]);
// We save here to let the following cache hits succeed
$this->save();
}
}
/**
* Load cached sql query
*/
public function sql_load($query)
{
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
$query_id = sizeof($this->sql_rowset);
$query_hash = md5($query);
if (!xcache_isset('sql_' . $query_hash))
{
return false;
}
$this->sql_rowset[$query_id] = xcache_get('sql_' . $query_hash);
return $query_id;
}
/**
* Save sql query
*/
public function sql_save($query, &$query_result, $ttl)
{
global $db;
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
// determine which tables this query belongs to:
// grab all the FROM tables, avoid getting a LEFT JOIN
preg_match('/FROM \(?(\w+(?: (?!LEFT JOIN)\w+)?(?:, ?\w+(?: (?!LEFT JOIN)\w+)?)*)\)?/', $query, $regs);
$tables = array_map('trim', explode(',', $regs[1]));
// now get the LEFT JOIN
preg_match_all('/LEFT JOIN\s+(\w+)(?: \w+)?/', $query, $result, PREG_PATTERN_ORDER);
$tables = array_merge($tables, $result[1]);
$query_hash = md5($query);
foreach ($tables as $table_name)
{
if (($pos = strpos($table_name, ' ')) !== false)
{
$table_name = substr($table_name, 0, $pos);
}
if (xcache_isset('sql_' . $table_name))
{
$temp = xcache_get('sql_' . $table_name);
}
else
{
$temp = array();
}
$temp[$query_hash] = true;
xcache_set('sql_' . $table_name, $temp, $ttl);
}
// store them in the right place
$query_id = sizeof($this->sql_rowset);
$this->sql_rowset[$query_id] = array();
while ($row = $db->sql_fetchrow($query_result))
{
$this->sql_rowset[$query_id][] = $row;
}
$db->sql_freeresult($query_result);
xcache_set('sql_' . $query_hash, $this->sql_rowset[$query_id], $ttl);
$query_result = $query_id;
}
/**
* Fetch row from cache (database)
*/
public function sql_fetchrow($query_id)
{
list(, $row) = each($this->sql_rowset[$query_id]);
return ($row !== NULL) ? $row : false;
}
/**
* Fetch a field from the current row of a cached database result (database)
*/
public function sql_fetchfield($query_id, $field)
{
$row = current($this->sql_rowset[$query_id]);
return ($row !== false && isset($row[$field])) ? $row[$field] : false;
}
/**
* Free memory used for a cached database result (database)
*/
public function sql_freeresult($query_id)
{
if (!isset($this->sql_rowset[$query_id]))
{
return false;
}
unset($this->sql_rowset[$query_id]);
return true;
}
}
?>

View File

@@ -26,13 +26,12 @@ class acp_attachments
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
global $db, $user, $auth, $template, $cache, $config;
$user->add_lang(array('posting', 'viewtopic', 'acp/attachments'));
$error = $notify = array();
$submit = (isset($_POST['submit'])) ? true : false;
$submit = request::is_set_post('submit');
$action = request_var('action', '');
$form_key = 'acp_attach';
@@ -79,7 +78,7 @@ class acp_attachments
{
case 'attach':
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT);
$sql = 'SELECT group_name, cat_id
FROM ' . EXTENSION_GROUPS_TABLE . '
@@ -99,13 +98,9 @@ class acp_attachments
$display_vars = array(
'title' => 'ACP_ATTACHMENT_SETTINGS',
'vars' => array(
'img_max_width' => false, 'img_max_height' => false, 'img_link_width' => false, 'img_link_height' => false,
'legend1' => 'ACP_ATTACHMENT_SETTINGS',
'img_max_width' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,),
'img_max_height' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,),
'img_link_width' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,),
'img_link_height' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,),
'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'upload_path' => array('lang' => 'UPLOAD_DIR', 'validate' => 'wpath', 'type' => 'text:25:100', 'explain' => true),
@@ -133,7 +128,7 @@ class acp_attachments
);
$this->new_config = $config;
$cfg_array = (isset($_REQUEST['config'])) ? request_var('config', array('' => '')) : $this->new_config;
$cfg_array = (request::is_set('config')) ? request_var('config', array('' => '')) : $this->new_config;
$error = array();
// We validate the complete config if whished
@@ -279,7 +274,7 @@ class acp_attachments
{
$l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
}
$content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
if (empty($content))
{
@@ -302,7 +297,7 @@ class acp_attachments
case 'extensions':
if ($submit || isset($_POST['add_extension_check']))
if ($submit || request::is_set_post('add_extension_check'))
{
if ($submit)
{
@@ -366,7 +361,7 @@ class acp_attachments
// Add Extension?
$add_extension = strtolower(request_var('add_extension', ''));
$add_extension_group = request_var('add_group_select', 0);
$add = (isset($_POST['add_extension_check'])) ? true : false;
$add = request::is_set_post('add_extension_check');
if ($add_extension && $add)
{
@@ -407,7 +402,7 @@ class acp_attachments
$template->assign_vars(array(
'S_EXTENSIONS' => true,
'ADD_EXTENSION' => (isset($add_extension)) ? $add_extension : '',
'GROUP_SELECT_OPTIONS' => (isset($_POST['add_extension_check'])) ? $this->group_select('add_group_select', $add_extension_group, 'extension_group') : $this->group_select('add_group_select', false, 'extension_group'))
'GROUP_SELECT_OPTIONS' => (request::is_set_post('add_extension_check')) ? $this->group_select('add_group_select', $add_extension_group, 'extension_group') : $this->group_select('add_group_select', false, 'extension_group'))
);
$sql = 'SELECT *
@@ -491,14 +486,21 @@ class acp_attachments
// Check New Group Name
if ($new_group_name)
{
$sql = 'SELECT group_id
FROM ' . EXTENSION_GROUPS_TABLE . "
WHERE LOWER(group_name) = '" . $db->sql_escape(utf8_strtolower($new_group_name)) . "'";
$sql = 'SELECT group_name
FROM ' . EXTENSION_GROUPS_TABLE;
$result = $db->sql_query($sql);
$ext_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($db->sql_fetchrow($result))
$clean_group_name = utf8_clean_string($new_group_name);
while ($row = $db->sql_fetchrow($result))
{
$error[] = sprintf($user->lang['EXTENSION_GROUP_EXIST'], $new_group_name);
if (utf8_clean_string($row['group_name']) === $clean_group_name)
{
$error[] = sprintf($user->lang['EXTENSION_GROUP_EXIST'], $new_group_name);
break;
}
}
$db->sql_freeresult($result);
}
@@ -510,10 +512,10 @@ class acp_attachments
$size_select = request_var('size_select', 'b');
$forum_select = request_var('forum_select', false);
$allowed_forums = request_var('allowed_forums', array(0));
$allow_in_pm = (isset($_POST['allow_in_pm'])) ? true : false;
$allow_in_pm = request::is_set_post('allow_in_pm');
$max_filesize = request_var('max_filesize', 0);
$max_filesize = ($size_select == 'kb') ? round($max_filesize * 1024) : (($size_select == 'mb') ? round($max_filesize * 1048576) : $max_filesize);
$allow_group = (isset($_POST['allow_group'])) ? true : false;
$allow_group = request::is_set_post('allow_group');
if ($max_filesize == $config['max_filesize'])
{
@@ -540,6 +542,7 @@ class acp_attachments
$group_ary['download_mode'] = INLINE_LINK;
}
// @TODO: rewrite with the new param db functions
$sql = ($action == 'add') ? 'INSERT INTO ' . EXTENSION_GROUPS_TABLE . ' ' : 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' SET ';
$sql .= $db->sql_build_array((($action == 'add') ? 'INSERT' : 'UPDATE'), $group_ary);
$sql .= ($action == 'edit') ? " WHERE group_id = $group_id" : '';
@@ -590,7 +593,7 @@ class acp_attachments
);
$group_id = request_var('g', 0);
$action = (isset($_POST['add'])) ? 'add' : $action;
$action = request::is_set_post('add');
switch ($action)
{
@@ -692,7 +695,7 @@ class acp_attachments
$filename_list = '';
$no_image_select = false;
$imglist = filelist($phpbb_root_path . $img_path);
$imglist = filelist(PHPBB_ROOT_PATH . $img_path);
if (sizeof($imglist))
{
@@ -738,14 +741,14 @@ class acp_attachments
}
$template->assign_vars(array(
'PHPBB_ROOT_PATH' => $phpbb_root_path,
'PHPBB_ROOT_PATH' => PHPBB_ROOT_PATH,
'IMG_PATH' => $img_path,
'ACTION' => $action,
'GROUP_ID' => $group_id,
'GROUP_NAME' => $ext_group_row['group_name'],
'ALLOW_GROUP' => $ext_group_row['allow_group'],
'ALLOW_IN_PM' => $ext_group_row['allow_in_pm'],
'UPLOAD_ICON_SRC' => $phpbb_root_path . $img_path . '/' . $ext_group_row['upload_icon'],
'UPLOAD_ICON_SRC' => PHPBB_ROOT_PATH . $img_path . '/' . $ext_group_row['upload_icon'],
'EXTGROUP_FILESIZE' => $ext_group_row['max_filesize'],
'ASSIGNED_EXTENSIONS' => $assigned_extensions,
@@ -757,7 +760,7 @@ class acp_attachments
'S_NO_IMAGE' => $no_image_select,
'S_FORUM_IDS' => (sizeof($forum_ids)) ? true : false,
'U_EXTENSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&amp;mode=extensions"),
'U_EXTENSIONS' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=$id&amp;mode=extensions"),
'U_BACK' => $this->u_action,
'L_LEGEND' => $user->lang[strtoupper($action) . '_EXTENSION_GROUP'])
@@ -873,8 +876,8 @@ class acp_attachments
if ($submit)
{
$delete_files = (isset($_POST['delete'])) ? array_keys(request_var('delete', array('' => 0))) : array();
$add_files = (isset($_POST['add'])) ? array_keys(request_var('add', array('' => 0))) : array();
$delete_files = array_keys(request::variable('delete', array('' => 0), false, request::POST));
$add_files = array_keys(request::variable('add', array('' => 0), false, request::POST));
$post_ids = request_var('post_id', array('' => 0));
if (sizeof($delete_files))
@@ -1030,7 +1033,7 @@ class acp_attachments
'PHYSICAL_FILENAME' => basename($row['physical_filename']),
'ATTACH_ID' => $row['attach_id'],
'POST_IDS' => (!empty($post_ids[$row['attach_id']])) ? $post_ids[$row['attach_id']] : '',
'U_FILE' => append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'mode=view&amp;id=' . $row['attach_id']))
'U_FILE' => append_sid('download/file', 'mode=view&amp;id=' . $row['attach_id']))
);
}
$db->sql_freeresult($result);
@@ -1190,31 +1193,31 @@ class acp_attachments
*/
function test_upload(&$error, $upload_dir, $create_directory = false)
{
global $user, $phpbb_root_path;
global $user;
// Does the target directory exist, is it a directory and writable.
if ($create_directory)
{
if (!file_exists($phpbb_root_path . $upload_dir))
if (!file_exists(PHPBB_ROOT_PATH . $upload_dir))
{
@mkdir($phpbb_root_path . $upload_dir, 0777);
phpbb_chmod($phpbb_root_path . $upload_dir, CHMOD_READ | CHMOD_WRITE);
@mkdir(PHPBB_ROOT_PATH . $upload_dir, 0777);
phpbb_chmod(PHPBB_ROOT_PATH . $upload_dir, CHMOD_READ | CHMOD_WRITE);
}
}
if (!file_exists($phpbb_root_path . $upload_dir))
if (!file_exists(PHPBB_ROOT_PATH . $upload_dir))
{
$error[] = sprintf($user->lang['NO_UPLOAD_DIR'], $upload_dir);
return;
}
if (!is_dir($phpbb_root_path . $upload_dir))
if (!is_dir(PHPBB_ROOT_PATH . $upload_dir))
{
$error[] = sprintf($user->lang['UPLOAD_NOT_DIR'], $upload_dir);
return;
}
if (!is_writable($phpbb_root_path . $upload_dir))
if (!is_writable(PHPBB_ROOT_PATH . $upload_dir))
{
$error[] = sprintf($user->lang['NO_WRITE_UPLOAD'], $upload_dir);
return;
@@ -1228,14 +1231,14 @@ class acp_attachments
{
global $db, $user;
if (isset($_REQUEST['securesubmit']))
if (request::is_set('securesubmit'))
{
// Grab the list of entries
$ips = request_var('ips', '');
$ip_list = array_unique(explode("\n", $ips));
$ip_list_log = implode(', ', $ip_list);
$ip_exclude = (!empty($_POST['ipexclude'])) ? 1 : 0;
$ip_exclude = (int) request::variable('ipexclude', false, false, request::POST);
$iplist = array();
$hostlist = array();
@@ -1382,7 +1385,7 @@ class acp_attachments
trigger_error($user->lang['SECURE_DOWNLOAD_UPDATE_SUCCESS'] . adm_back_link($this->u_action));
}
else if (isset($_POST['unsecuresubmit']))
else if (request::is_set_post('unsecuresubmit'))
{
$unip_sql = request_var('unip', array(0));

View File

@@ -26,12 +26,11 @@ class acp_ban
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $cache;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
$bansubmit = (isset($_POST['bansubmit'])) ? true : false;
$unbansubmit = (isset($_POST['unbansubmit'])) ? true : false;
$bansubmit = request::is_set_post('bansubmit');
$unbansubmit = request::is_set_post('unbansubmit');
$current_time = time();
$user->add_lang(array('acp/ban', 'acp/users'));
@@ -98,7 +97,7 @@ class acp_ban
break;
}
$this->display_ban_options($mode);
self::display_ban_options($mode);
$template->assign_vars(array(
'L_TITLE' => $this->page_title,
@@ -112,14 +111,14 @@ class acp_ban
'S_USERNAME_BAN' => ($mode == 'user') ? true : false,
'U_ACTION' => $this->u_action,
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=acp_ban&amp;field=ban'),
'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&amp;form=acp_ban&amp;field=ban'),
));
}
/**
* Display ban options
*/
function display_ban_options($mode)
static function display_ban_options($mode)
{
global $user, $db, $template;

View File

@@ -25,8 +25,7 @@ class acp_bbcodes
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $user, $auth, $template, $cache, $config;
$user->add_lang('acp/posting');

View File

@@ -27,13 +27,12 @@ class acp_board
function main($id, $mode)
{
global $db, $user, $auth, $template;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $user, $auth, $template, $config;
$user->add_lang('acp/board');
$action = request_var('action', '');
$submit = (isset($_POST['submit'])) ? true : false;
$submit = request::is_set_post('submit');
$form_key = 'acp_board';
add_form_key($form_key);
@@ -102,11 +101,7 @@ class acp_board
'title' => 'ACP_AVATAR_SETTINGS',
'vars' => array(
'legend1' => 'ACP_AVATAR_SETTINGS',
'avatar_min_width' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,),
'avatar_min_height' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,),
'avatar_max_width' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,),
'avatar_max_height' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,),
'avatar_min_height' => false, 'avatar_min_width' => false, 'avatar_max_height' => false, 'avatar_max_width' => false,
'allow_avatar_local' => array('lang' => 'ALLOW_LOCAL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'allow_avatar_remote' => array('lang' => 'ALLOW_REMOTE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
@@ -376,7 +371,7 @@ class acp_board
}
$this->new_config = $config;
$cfg_array = (isset($_REQUEST['config'])) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
$cfg_array = (request::is_set('config')) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
$error = array();
// We validate the complete config if whished
@@ -425,15 +420,15 @@ class acp_board
// Retrieve a list of auth plugins and check their config values
$auth_plugins = array();
$dp = @opendir($phpbb_root_path . 'includes/auth');
$dp = @opendir(PHPBB_ROOT_PATH . 'includes/auth');
if ($dp)
{
while (($file = readdir($dp)) !== false)
{
if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
if (preg_match('#^auth_(.*?)\.' . PHP_EXT . '$#', $file))
{
$auth_plugins[] = basename(preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file));
$auth_plugins[] = basename(preg_replace('#^auth_(.*?)\.' . PHP_EXT . '$#', '\1', $file));
}
}
closedir($dp);
@@ -445,9 +440,9 @@ class acp_board
$old_auth_config = array();
foreach ($auth_plugins as $method)
{
if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx))
if ($method && file_exists(PHPBB_ROOT_PATH . 'includes/auth/auth_' . $method . '.' . PHP_EXT))
{
include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/auth/auth_' . $method . '.' . PHP_EXT);
$method = 'acp_' . $method;
if (function_exists($method))
@@ -488,7 +483,7 @@ class acp_board
$method = basename($cfg_array['auth_method']);
if ($method && in_array($method, $auth_plugins))
{
include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/auth/auth_' . $method . '.' . PHP_EXT);
$method = 'init_' . $method;
if (function_exists($method))
@@ -586,7 +581,7 @@ class acp_board
foreach ($auth_plugins as $method)
{
if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx))
if ($method && file_exists(PHPBB_ROOT_PATH . 'includes/auth/auth_' . $method . '.' . PHP_EXT))
{
$method = 'acp_' . $method;
if (function_exists($method))
@@ -611,11 +606,9 @@ class acp_board
*/
function select_auth_method($selected_method, $key = '')
{
global $phpbb_root_path, $phpEx;
$auth_plugins = array();
$dp = @opendir($phpbb_root_path . 'includes/auth');
$dp = @opendir(PHPBB_ROOT_PATH . 'includes/auth');
if (!$dp)
{
@@ -624,9 +617,9 @@ class acp_board
while (($file = readdir($dp)) !== false)
{
if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
if (preg_match('#^auth_(.*?)\.' . PHP_EXT . '$#', $file))
{
$auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file);
$auth_plugins[] = preg_replace('#^auth_(.*?)\.' . PHP_EXT . '$#', '\1', $file);
}
}
closedir($dp);

View File

@@ -26,14 +26,13 @@ class acp_bots
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $cache;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
$action = request_var('action', '');
$submit = (isset($_POST['submit'])) ? true : false;
$submit = request::is_set_post('submit');
$mark = request_var('mark', array(0));
$bot_id = request_var('id', 0);
if (isset($_POST['add']))
if (request::is_set_post('add'))
{
$action = 'add';
}
@@ -141,7 +140,7 @@ class acp_bots
case 'edit':
case 'add':
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
$bot_row = array(
'bot_name' => utf8_normalize_nfc(request_var('bot_name', '', true)),
@@ -210,7 +209,7 @@ class acp_bots
{
$sql = 'SELECT group_id, group_colour
FROM ' . GROUPS_TABLE . "
WHERE group_name = 'BOTS'
WHERE group_name_clean = 'bots'
AND group_type = " . GROUP_SPECIAL;
$result = $db->sql_query($sql);
$group_row = $db->sql_fetchrow($result);

View File

@@ -10,6 +10,8 @@
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
@@ -24,99 +26,119 @@ class acp_captcha
function main($id, $mode)
{
global $db, $user, $auth, $template;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $user, $auth, $template, $config;
$user->add_lang('acp/board');
include(PHPBB_ROOT_PATH . 'includes/captcha/captcha_factory.' . PHP_EXT);
$captcha_vars = array(
'captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID',
'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID',
'captcha_gd_foreground_noise' => 'CAPTCHA_GD_FOREGROUND_NOISE',
'captcha_gd' => 'CAPTCHA_GD_PREVIEWED'
);
if (isset($_GET['demo']))
$selected = request_var('select_captcha', $config['captcha_plugin']);
$configure = request_var('configure', false);
// Oh, they are just here for the view
if (request::is_set('captcha_demo', request::GET))
{
$captcha_vars = array_keys($captcha_vars);
foreach ($captcha_vars as $captcha_var)
{
$config[$captcha_var] = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, 0) : $config[$captcha_var];
}
if ($config['captcha_gd'])
{
include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx);
}
else
{
include($phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx);
}
$captcha = new captcha();
$captcha->execute(gen_rand_string(mt_rand(5, 8)), time());
exit;
$this->deliver_demo($selected);
}
$config_vars = array(
'enable_confirm' => 'REG_ENABLE',
'enable_post_confirm' => 'POST_ENABLE',
'captcha_gd' => 'CAPTCHA_GD',
);
$this->tpl_name = 'acp_captcha';
$this->page_title = 'ACP_VC_SETTINGS';
$form_key = 'acp_captcha';
add_form_key($form_key);
$submit = request_var('submit', '');
if ($submit && check_form_key($form_key))
// Delegate
if ($configure)
{
$config_vars = array_keys($config_vars);
foreach ($config_vars as $config_var)
{
set_config($config_var, request_var($config_var, ''));
}
$captcha_vars = array_keys($captcha_vars);
foreach ($captcha_vars as $captcha_var)
{
$value = request_var($captcha_var, 0);
if ($value >= 0)
{
set_config($captcha_var, $value);
}
}
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
else if ($submit)
{
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action));
$config_captcha = phpbb_captcha_factory::get_instance($selected);
$config_captcha->acp_page($id, $this);
}
else
{
$captchas = phpbb_captcha_factory::get_captcha_types();
$preview_image_src = append_sid(append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&amp;demo=demo"));
if (@extension_loaded('gd'))
{
$template->assign_var('GD', true);
}
foreach ($config_vars as $config_var => $template_var)
{
$template->assign_var($template_var, (isset($_REQUEST[$config_var])) ? request_var($config_var, '') : $config[$config_var]) ;
}
foreach ($captcha_vars as $captcha_var => $template_var)
{
$var = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, 0) : $config[$captcha_var];
$template->assign_var($template_var, $var);
$preview_image_src .= "&amp;$captcha_var=" . $var;
}
$template->assign_vars(array(
'CAPTCHA_PREVIEW' => $preview_image_src,
'PREVIEW' => isset($_POST['preview']),
));
$config_vars = array(
'enable_confirm' => 'REG_ENABLE',
'enable_post_confirm' => 'POST_ENABLE',
);
$this->tpl_name = 'acp_captcha';
$this->page_title = 'ACP_VC_SETTINGS';
$form_key = 'acp_captcha';
add_form_key($form_key);
$submit = request_var('main_submit', false);
if ($submit && check_form_key($form_key))
{
$config_vars = array_keys($config_vars);
foreach ($config_vars as $config_var)
{
set_config($config_var, request_var($config_var, false));
}
if ($selected !== $config['captcha_plugin'])
{
// sanity check
if (isset($captchas['available'][$selected]))
{
$old_captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
$old_captcha->uninstall();
set_config('captcha_plugin', $selected);
$new_captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
$new_captcha->install();
}
else
{
trigger_error($user->lang['CAPTCHA_UNAVAILABLE'] . adm_back_link($this->u_action));
}
}
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
else if ($submit)
{
trigger_error($user->lang['FORM_INVALID'] . adm_back_link());
}
else
{
$captcha_select = '';
foreach ($captchas['available'] as $value => $title)
{
$current = ($selected !== false && $value == $selected) ? ' selected="selected"' : '';
$captcha_select .= '<option value="' . $value . '"' . $current . '>' . $user->lang[$title] . '</option>';
}
foreach ($captchas['unavailable'] as $value => $title)
{
$captcha_select .= '<option value="' . $value . '"' . $current . ' class="disabled-option" >' . $user->lang[$title] . '</option>';
}
$demo_captcha = phpbb_captcha_factory::get_instance($selected);
foreach ($config_vars as $config_var => $template_var)
{
$template->assign_var($template_var, request_var($config_var, $config[$config_var])) ;
}
$template->assign_vars(array(
'CAPTCHA_PREVIEW' => $demo_captcha->get_demo_template($id),
'CAPTCHA_SELECT' => $captcha_select,
));
}
}
}
/**
* Entry point for delivering image CAPTCHAs in the ACP.
*/
function deliver_demo($selected)
{
global $db, $user, $config;
$captcha = phpbb_captcha_factory::get_instance($selected);
$captcha->init(CONFIRM_REG);
$captcha->execute_demo();
garbage_collection();
exit_handler();
}
}
?>

View File

@@ -25,8 +25,7 @@ class acp_database
function main($id, $mode)
{
global $cache, $db, $user, $auth, $template, $table_prefix;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $cache, $db, $user, $auth, $template, $table_prefix, $config;
$user->add_lang('acp/database');
@@ -34,7 +33,7 @@ class acp_database
$this->page_title = 'ACP_DATABASE';
$action = request_var('action', '');
$submit = (isset($_POST['submit'])) ? true : false;
$submit = request::is_set_post('submit');
$template->assign_vars(array(
'MODE' => $mode
@@ -86,10 +85,8 @@ class acp_database
$time = time();
$filename = 'backup_' . $time . '_' . unique_id();
switch ($db->sql_layer)
switch ($db->dbms_type)
{
case 'mysqli':
case 'mysql4':
case 'mysql':
$extractor = new mysql_extractor($download, $store, $format, $filename, $time);
break;
@@ -107,13 +104,16 @@ class acp_database
break;
case 'mssql':
case 'mssql_odbc':
$extractor = new mssql_extractor($download, $store, $format, $filename, $time);
break;
case 'firebird':
$extractor = new firebird_extractor($download, $store, $format, $filename, $time);
break;
case 'db2':
$extractor = new db2_extractor($download, $store, $format, $filename, $time);
break;
}
$extractor->write_start($table_prefix);
@@ -128,15 +128,15 @@ class acp_database
else
{
// We might wanna empty out all that junk :D
switch ($db->sql_layer)
switch ($db->dbms_type)
{
case 'sqlite':
case 'firebird':
case 'db2':
$extractor->flush('DELETE FROM ' . $table_name . ";\n");
break;
case 'mssql':
case 'mssql_odbc':
$extractor->flush('TRUNCATE TABLE ' . $table_name . "GO\n");
break;
@@ -170,7 +170,7 @@ class acp_database
break;
default:
include($phpbb_root_path . 'includes/functions_install.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/functions_install.' . PHP_EXT);
$tables = get_tables($db);
asort($tables);
foreach ($tables as $table_name)
@@ -224,7 +224,7 @@ class acp_database
trigger_error($user->lang['BACKUP_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$file_name = $phpbb_root_path . 'store/' . $matches[0];
$file_name = PHPBB_ROOT_PATH . 'store/' . $matches[0];
if (!file_exists($file_name) || !is_readable($file_name))
{
@@ -316,12 +316,11 @@ class acp_database
break;
}
switch ($db->sql_layer)
switch ($db->dbms_type)
{
case 'mysql':
case 'mysql4':
case 'mysqli':
case 'sqlite':
case 'db2':
while (($sql = $fgetd($fp, ";\n", $read, $seek, $eof)) !== false)
{
$db->sql_query($sql);
@@ -390,7 +389,6 @@ class acp_database
break;
case 'mssql':
case 'mssql_odbc':
while (($sql = $fgetd($fp, "GO\n", $read, $seek, $eof)) !== false)
{
$db->sql_query($sql);
@@ -421,7 +419,7 @@ class acp_database
$methods[] = $type;
}
$dir = $phpbb_root_path . 'store/';
$dir = PHPBB_ROOT_PATH . 'store/';
$dh = @opendir($dir);
if ($dh)
@@ -470,7 +468,7 @@ class base_extractor
var $format;
var $run_comp = false;
function base_extractor($download = false, $store = false, $format, $filename, $time)
function __construct($download = false, $store = false, $format, $filename, $time)
{
$this->download = $download;
$this->store = $store;
@@ -530,8 +528,7 @@ class base_extractor
if ($store == true)
{
global $phpbb_root_path;
$file = $phpbb_root_path . 'store/' . $filename . $ext;
$file = PHPBB_ROOT_PATH . 'store/' . $filename . $ext;
$this->fp = $open($file, 'w');
@@ -616,28 +613,16 @@ class mysql_extractor extends base_extractor
function write_table($table_name)
{
global $db;
static $new_extract;
if ($new_extract === null)
{
if ($db->sql_layer === 'mysqli' || version_compare($db->sql_server_info(true), '3.23.20', '>='))
{
$new_extract = true;
}
else
{
$new_extract = false;
}
}
$sql = 'SHOW CREATE TABLE ' . $table_name;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
if ($new_extract)
{
$this->new_write_table($table_name);
}
else
{
$this->old_write_table($table_name);
}
$sql_data = '# Table: ' . $table_name . "\n";
$sql_data .= "DROP TABLE IF EXISTS $table_name;\n";
$this->flush($sql_data . $row['Create Table'] . ";\n\n");
$db->sql_freeresult($result);
}
function write_data($table_name)
@@ -815,113 +800,6 @@ class mysql_extractor extends base_extractor
}
}
}
function new_write_table($table_name)
{
global $db;
$sql = 'SHOW CREATE TABLE ' . $table_name;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$sql_data = '# Table: ' . $table_name . "\n";
$sql_data .= "DROP TABLE IF EXISTS $table_name;\n";
$this->flush($sql_data . $row['Create Table'] . ";\n\n");
$db->sql_freeresult($result);
}
function old_write_table($table_name)
{
global $db;
$sql_data = '# Table: ' . $table_name . "\n";
$sql_data .= "DROP TABLE IF EXISTS $table_name;\n";
$sql_data .= "CREATE TABLE $table_name(\n";
$rows = array();
$sql = "SHOW FIELDS
FROM $table_name";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$line = ' ' . $row['Field'] . ' ' . $row['Type'];
if (!is_null($row['Default']))
{
$line .= " DEFAULT '{$row['Default']}'";
}
if ($row['Null'] != 'YES')
{
$line .= ' NOT NULL';
}
if ($row['Extra'] != '')
{
$line .= ' ' . $row['Extra'];
}
$rows[] = $line;
}
$db->sql_freeresult($result);
$sql = "SHOW KEYS
FROM $table_name";
$result = $db->sql_query($sql);
$index = array();
while ($row = $db->sql_fetchrow($result))
{
$kname = $row['Key_name'];
if ($kname != 'PRIMARY')
{
if ($row['Non_unique'] == 0)
{
$kname = "UNIQUE|$kname";
}
}
if ($row['Sub_part'])
{
$row['Column_name'] .= '(' . $row['Sub_part'] . ')';
}
$index[$kname][] = $row['Column_name'];
}
$db->sql_freeresult($result);
foreach ($index as $key => $columns)
{
$line = ' ';
if ($key == 'PRIMARY')
{
$line .= 'PRIMARY KEY (' . implode(', ', $columns) . ')';
}
else if (strpos($key, 'UNIQUE') === 0)
{
$line .= 'UNIQUE ' . substr($key, 7) . ' (' . implode(', ', $columns) . ')';
}
else if (strpos($key, 'FULLTEXT') === 0)
{
$line .= 'FULLTEXT ' . substr($key, 9) . ' (' . implode(', ', $columns) . ')';
}
else
{
$line .= "KEY $key (" . implode(', ', $columns) . ')';
}
$rows[] = $line;
}
$sql_data .= implode(",\n", $rows);
$sql_data .= "\n);\n\n";
$this->flush($sql_data);
}
}
/**
@@ -1152,7 +1030,7 @@ class postgres_extractor extends base_extractor
}
else
{
$row['rowdefault'] = $db->sql_fetchfield('rowdefault', false, $def_res);
$row['rowdefault'] = $db->sql_fetchfield('rowdefault', $def_res);
}
$db->sql_freeresult($def_res);
@@ -1496,10 +1374,15 @@ class mssql_extractor extends base_extractor
{
$this->write_data_mssql($table_name);
}
else
else if ($db->sql_layer === 'mssql_odbc')
{
$this->write_data_odbc($table_name);
}
else
{
// @todo: write code for MS SQL 2005 DBAL
trigger_error('KungFuDeathGrip');
}
}
function write_data_mssql($table_name)
@@ -1694,6 +1577,175 @@ class mssql_extractor extends base_extractor
}
/**
* @package acp
*/
class db2_extractor extends base_extractor
{
function write_start($prefix)
{
$sql_data = "--\n";
$sql_data .= "-- phpBB Backup Script\n";
$sql_data .= "-- Dump of tables for $prefix\n";
$sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n";
$sql_data .= "--\n";
$this->flush($sql_data);
}
function write_table($table_name)
{
global $db;
$sql_data = '-- Table: ' . $table_name . "\n";
$sql_data .= "\nCREATE TABLE $table_name (\n";
$rows = array();
// switch to db2_columns()?
$sql = "SELECT colname, typename, length, default, identity, nulls
FROM syscat.columns
WHERE tabname = '$table_name'";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$line = "\t{$row['colname']} {$row['typename']}";
if ($row['identity'] == 'Y')
{
$line .= ' GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1)';
}
if ($row['typename'] == 'VARCHAR' || $row['typename'] == 'CHARACTER' || $row['typename'] == 'CLOB')
{
$line .= ' (' . $row['length'] . ')';
}
if ($row['nulls'] == 'N')
{
$line .= ' NOT NULL';
}
else
{
$line .= ' NULL';
}
if ($row['default'] !== null)
{
$line .= ' DEFAULT ' . $row['default'];
}
$rows[] = $line;
}
$db->sql_freeresult($result);
// switch to db2_columns()?
$sql = "SELECT colname
FROM SYSCAT.KEYCOLUSE
WHERE tabname = '$table_name'";
$result = $db->sql_query($sql);
$prim_cols = array();
while ($row = $db->sql_fetchrow($result))
{
$prim_cols[] = $row['colname'];
}
$db->sql_freeresult($result);
if (sizeof($prim_cols))
{
$rows[] = "\tPRIMARY KEY (" . implode($prim_cols) . ')';
}
$sql_data .= implode(",\n", $rows);
$sql_data .= "\n);\n\n";
$rows = array();
$sql = "SELECT colnames, indname
FROM SYSCAT.INDEXES
WHERE TABNAME = '$table_name'
AND UNIQUERULE <> 'P'";
$result = $db->sql_query($sql);
$index = array();
while ($row = $db->sql_fetchrow($result))
{
$inds = explode('+', $row['colnames']);
unset($inds[0]);
$sql_data .= 'CREATE INDEX ' . $row['indname'] . ' ON ' . $table_name . ' (' . implode(', ', $inds) . ") PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS;\n";
}
$db->sql_freeresult($result);
$this->flush($sql_data);
}
function write_data($table_name)
{
global $db;
$ary_type = $ary_name = array();
$result = db2_columns($db->db_connect_id, '', '%', $table_name);
$i = 0;
while ($row = $db->sql_fetchrow($result))
{
$ary_type[$i] = $row['type_name'];
$ary_name[$i++] = strtolower($row['column_name']);
}
$db->sql_freeresult($result);
// Grab all of the data from current table.
$sql = "SELECT *
FROM $table_name";
$result = $db->sql_query($sql);
$sql_data = '';
$i_num_fields = $i;
while ($row = $db->sql_fetchrow($result))
{
$schema_vals = $schema_fields = array();
// Build the SQL statement to recreate the data.
for ($i = 0; $i < $i_num_fields; $i++)
{
$str_val = $row[$ary_name[$i]];
if (preg_match('#char|clob#i', $ary_type[$i]))
{
$str_quote = "'";
$str_empty = '';
$str_val = sanitize_data_generic(str_replace("'", "''", $str_val));
}
else if (preg_match('#date|timestamp#i', $ary_type[$i]))
{
if (empty($str_val))
{
$str_quote = '';
}
else
{
$str_quote = "'";
}
}
else
{
$str_quote = '';
$str_empty = 'NULL';
}
if (empty($str_val) && $str_val !== '0')
{
$str_val = $str_empty;
}
$schema_vals[$i] = $str_quote . $str_val . $str_quote;
$schema_fields[$i] = '"' . $ary_name[$i] . "'";
}
// Take the ordered fields and their associated data and build it
// into a valid sql statement to recreate that field in the data.
$sql_data = "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\n";
$this->flush($sql_data);
}
$db->sql_freeresult($result);
}
}
/**
* @package acp
*/
@@ -1775,7 +1827,7 @@ class oracle_extractor extends base_extractor
FROM USER_DEPENDENCIES A, USER_TRIGGERS B
WHERE A.REFERENCED_TYPE = 'SEQUENCE'
AND A.NAME = B.TRIGGER_NAME
AND B. TABLE_NAME = '{$table_name}'";
AND B.TABLE_NAME = '{$table_name}'";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{

View File

@@ -25,10 +25,9 @@ class acp_disallow
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $user, $auth, $template, $cache, $config;
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
$user->add_lang('acp/posting');
@@ -39,8 +38,8 @@ class acp_disallow
$form_key = 'acp_disallow';
add_form_key($form_key);
$disallow = (isset($_POST['disallow'])) ? true : false;
$allow = (isset($_POST['allow'])) ? true : false;
$disallow = request::is_set_post('disallow');
$allow = request::is_set_post('allow');
if (($allow || $disallow) && !check_form_key($form_key))
{

View File

@@ -26,7 +26,6 @@ class acp_email
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $cache;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
$user->add_lang('acp/email');
$this->tpl_name = 'acp_email';
@@ -36,7 +35,7 @@ class acp_email
add_form_key($form_key);
// Set some vars
$submit = (isset($_POST['submit'])) ? true : false;
$submit = request::is_set_post('submit');
$error = array();
$usernames = request_var('usernames', '', true);
@@ -49,7 +48,7 @@ class acp_email
{
// Error checking needs to go here ... if no subject and/or no message then skip
// over the send and return to the form
$use_queue = (isset($_POST['send_immediately'])) ? false : true;
$use_queue = request::is_set_post('send_immediately');
$priority = request_var('mail_priority_flag', MAIL_NORMAL_PRIORITY);
if (!check_form_key($form_key))
@@ -148,8 +147,8 @@ class acp_email
$db->sql_freeresult($result);
// Send the messages
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT);
include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
$messenger = new messenger($use_queue);
$errored = false;
@@ -218,7 +217,7 @@ class acp_email
}
else
{
$message = sprintf($user->lang['EMAIL_SEND_ERROR'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=logs&amp;mode=critical') . '">', '</a>');
$message = sprintf($user->lang['EMAIL_SEND_ERROR'], '<a href="' . append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=logs&amp;mode=critical') . '">', '</a>');
trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING);
}
}
@@ -227,7 +226,7 @@ class acp_email
// Exclude bots and guests...
$sql = 'SELECT group_id
FROM ' . GROUPS_TABLE . "
WHERE group_name IN ('BOTS', 'GUESTS')";
WHERE group_name_clean IN ('bots', 'guests')";
$result = $db->sql_query($sql);
$exclude = array();
@@ -250,12 +249,11 @@ class acp_email
'U_ACTION' => $this->u_action,
'S_GROUP_OPTIONS' => $select_list,
'USERNAMES' => $usernames,
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=acp_email&amp;field=usernames'),
'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&amp;form=acp_email&amp;field=usernames'),
'SUBJECT' => $subject,
'MESSAGE' => $message,
'S_PRIORITY_OPTIONS' => $s_priority_options)
);
'S_PRIORITY_OPTIONS' => $s_priority_options,
));
}
}

View File

@@ -26,8 +26,7 @@ class acp_forums
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
global $db, $user, $auth, $template, $cache, $config;
$user->add_lang('acp/forums');
$this->tpl_name = 'acp_forums';
@@ -37,7 +36,7 @@ class acp_forums
add_form_key($form_key);
$action = request_var('action', '');
$update = (isset($_POST['update'])) ? true : false;
$update = request::is_set_post('update');
$forum_id = request_var('f', 0);
$this->parent_id = request_var('parent_id', 0);
@@ -256,13 +255,13 @@ class acp_forums
// Redirect to permissions
if ($auth->acl_get('a_fauth'))
{
$message .= '<br /><br />' . sprintf($user->lang['REDIRECT_ACL'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url) . '">', '</a>');
$message .= '<br /><br />' . sprintf($user->lang['REDIRECT_ACL'], '<a href="' . append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=permissions' . $acl_url) . '">', '</a>');
}
// redirect directly to permission settings screen if authed
if ($action == 'add' && !$forum_perm_from && $auth->acl_get('a_fauth'))
{
meta_refresh(4, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url));
meta_refresh(4, append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=permissions' . $acl_url));
}
trigger_error($message . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
@@ -639,7 +638,7 @@ class acp_forums
'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_DATA_LINK' => $forum_data['forum_link'],
'FORUM_IMAGE' => $forum_data['forum_image'],
'FORUM_IMAGE_SRC' => ($forum_data['forum_image']) ? $phpbb_root_path . $forum_data['forum_image'] : '',
'FORUM_IMAGE_SRC' => ($forum_data['forum_image']) ? PHPBB_ROOT_PATH . $forum_data['forum_image'] : '',
'FORUM_POST' => FORUM_POST,
'FORUM_LINK' => FORUM_LINK,
'FORUM_CAT' => FORUM_CAT,
@@ -813,8 +812,8 @@ class acp_forums
$template->assign_block_vars('forums', array(
'FOLDER_IMAGE' => $folder_image,
'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="" />' : '',
'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '',
'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . PHPBB_ROOT_PATH . $row['forum_image'] . '" alt="" />' : '',
'FORUM_IMAGE_SRC' => ($row['forum_image']) ? PHPBB_ROOT_PATH . $row['forum_image'] : '',
'FORUM_NAME' => $row['forum_name'],
'FORUM_DESCRIPTION' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']),
'FORUM_TOPICS' => $row['forum_topics'],
@@ -1629,9 +1628,9 @@ class acp_forums
*/
function delete_forum_content($forum_id)
{
global $db, $config, $phpbb_root_path, $phpEx;
global $db, $config;
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT);
$db->sql_transaction('begin');
@@ -1667,10 +1666,9 @@ class acp_forums
}
$db->sql_freeresult($result);
switch ($db->sql_layer)
switch ($db->dbms_type)
{
case 'mysql4':
case 'mysqli':
case 'mysql':
// Delete everything else and thank MySQL for offering multi-table deletion
$tables_ary = array(

View File

@@ -25,8 +25,7 @@ class acp_groups
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $cache;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads;
global $config, $db, $user, $auth, $template, $cache, $file_uploads;
$user->add_lang('acp/groups');
$this->tpl_name = 'acp_groups';
@@ -35,21 +34,21 @@ class acp_groups
$form_key = 'acp_groups';
add_form_key($form_key);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
// Check and set some common vars
$action = (isset($_POST['add'])) ? 'add' : ((isset($_POST['addusers'])) ? 'addusers' : request_var('action', ''));
$action = (request::is_set_post('add')) ? 'add' : ((request::is_set_post('addusers')) ? 'addusers' : request_var('action', ''));
$group_id = request_var('g', 0);
$mark_ary = request_var('mark', array(0));
$name_ary = request_var('usernames', '', true);
$leader = request_var('leader', 0);
$default = request_var('default', 0);
$start = request_var('start', 0);
$update = (isset($_POST['update'])) ? true : false;
$update = request::is_set_post('update');
// Clear some vars
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;
$can_upload = (file_exists(PHPBB_ROOT_PATH . $config['avatar_path']) && @is_writable(PHPBB_ROOT_PATH . $config['avatar_path']) && $file_uploads) ? true : false;
$group_row = array();
// Grab basic data for group, if group_id is set and exists
@@ -259,7 +258,7 @@ class acp_groups
case 'edit':
case 'add':
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT);
$data = $submit_ary = array();
@@ -304,8 +303,8 @@ class acp_groups
$submit_ary = array(
'colour' => request_var('group_colour', ''),
'rank' => request_var('group_rank', 0),
'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0,
'legend' => isset($_REQUEST['group_legend']) ? 1 : 0,
'receive_pm' => request::is_set('group_receive_pm') ? 1 : 0,
'legend' => request::is_set('group_legend') ? 1 : 0,
'message_limit' => request_var('group_message_limit', 0),
'max_recipients' => request_var('group_max_recipients', 0),
'founder_manage' => 0,
@@ -313,7 +312,7 @@ class acp_groups
if ($user->data['user_type'] == USER_FOUNDER)
{
$submit_ary['founder_manage'] = isset($_REQUEST['group_founder_manage']) ? 1 : 0;
$submit_ary['founder_manage'] = request::is_set('group_founder_manage') ? 1 : 0;
}
if (!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl'] || $data['remotelink'])
@@ -343,11 +342,11 @@ class acp_groups
else if ($avatar_select && $config['allow_avatar_local'])
{
// check avatar gallery
if (is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category))
if (is_dir(PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/' . $category))
{
$submit_ary['avatar_type'] = AVATAR_GALLERY;
list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select);
list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize(PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select);
$submit_ary['avatar'] = $category . '/' . $avatar_select;
}
}
@@ -518,9 +517,9 @@ class acp_groups
$type_closed = ($group_type == GROUP_CLOSED) ? ' checked="checked"' : '';
$type_hidden = ($group_type == GROUP_HIDDEN) ? ' checked="checked"' : '';
$avatar_img = (!empty($group_row['group_avatar'])) ? get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR') : '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />';
$avatar_img = (!empty($group_row['group_avatar'])) ? get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR') : '<img src="' . PHPBB_ADMIN_PATH . 'images/no_avatar.gif" alt="" />';
$display_gallery = (isset($_POST['display_gallery'])) ? true : false;
$display_gallery = request::is_set_post('display_gallery');
if ($config['allow_avatar_local'] && $display_gallery)
{
@@ -532,7 +531,7 @@ class acp_groups
switch ($back_link)
{
case 'acp_users_groups':
$u_back = append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&amp;mode=groups&amp;u=' . request_var('u', 0));
$u_back = append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=users&amp;mode=groups&amp;u=' . request_var('u', 0));
break;
default:
@@ -588,7 +587,7 @@ class acp_groups
'GROUP_HIDDEN' => $type_hidden,
'U_BACK' => $u_back,
'U_SWATCH' => append_sid("{$phpbb_admin_path}swatch.$phpEx", 'form=settings&amp;name=group_colour'),
'U_SWATCH' => append_sid(PHPBB_ADMIN_PATH . 'swatch.' . PHP_EXT, 'form=settings&amp;name=group_colour'),
'U_ACTION' => "{$this->u_action}&amp;action=$action&amp;g=$group_id",
'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024)),
)
@@ -618,7 +617,7 @@ class acp_groups
while ($row = $db->sql_fetchrow($result))
{
$template->assign_block_vars('leader', array(
'U_USER_EDIT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&amp;action=edit&amp;u={$row['user_id']}"),
'U_USER_EDIT' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=users&amp;action=edit&amp;u={$row['user_id']}"),
'USERNAME' => $row['username'],
'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false,
@@ -657,7 +656,7 @@ class acp_groups
'U_ACTION' => $this->u_action . "&amp;g=$group_id",
'U_BACK' => $this->u_action,
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=list&amp;field=usernames'),
'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&amp;form=list&amp;field=usernames'),
'U_DEFAULT_ALL' => "{$this->u_action}&amp;action=default&amp;g=$group_id",
));
@@ -684,7 +683,7 @@ class acp_groups
}
$template->assign_block_vars('member', array(
'U_USER_EDIT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&amp;action=edit&amp;u={$row['user_id']}"),
'U_USER_EDIT' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=users&amp;action=edit&amp;u={$row['user_id']}"),
'USERNAME' => $row['username'],
'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false,

View File

@@ -26,16 +26,15 @@ class acp_icons
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $user, $auth, $template, $cache, $config;
$user->add_lang('acp/posting');
// Set up general vars
$action = request_var('action', '');
$action = (isset($_POST['add'])) ? 'add' : $action;
$action = (isset($_POST['edit'])) ? 'edit' : $action;
$action = (isset($_POST['import'])) ? 'import' : $action;
$action = (request::is_set_post('add')) ? 'add' : $action;
$action = (request::is_set_post('edit')) ? 'edit' : $action;
$action = (request::is_set_post('import')) ? 'import' : $action;
$icon_id = request_var('id', 0);
$mode = ($mode == 'smilies') ? 'smilies' : 'icons';
@@ -69,7 +68,7 @@ class acp_icons
// Grab file list of paks and images
if ($action == 'edit' || $action == 'add' || $action == 'import')
{
$imglist = filelist($phpbb_root_path . $img_path, '');
$imglist = filelist(PHPBB_ROOT_PATH . $img_path, '');
foreach ($imglist as $path => $img_ary)
{
@@ -82,7 +81,7 @@ class acp_icons
foreach ($img_ary as $img)
{
$img_size = getimagesize($phpbb_root_path . $img_path . '/' . $path . $img);
$img_size = getimagesize(PHPBB_ROOT_PATH . $img_path . '/' . $path . $img);
if (!$img_size[0] || !$img_size[1] || strlen($img) > 255)
{
@@ -96,11 +95,11 @@ class acp_icons
}
unset($imglist);
if ($dir = @opendir($phpbb_root_path . $img_path))
if ($dir = @opendir(PHPBB_ROOT_PATH . $img_path))
{
while (($file = readdir($dir)) !== false)
{
if (is_file($phpbb_root_path . $img_path . '/' . $file) && preg_match('#\.pak$#i', $file))
if (is_file(PHPBB_ROOT_PATH . $img_path . '/' . $file) && preg_match('#\.pak$#i', $file))
{
$_paks[] = $file;
}
@@ -266,7 +265,7 @@ class acp_icons
$template->assign_block_vars('items', array(
'IMG' => $img,
'A_IMG' => addslashes($img),
'IMG_SRC' => $phpbb_root_path . $img_path . '/' . $img,
'IMG_SRC' => PHPBB_ROOT_PATH . $img_path . '/' . $img,
'CODE' => ($mode == 'smilies' && isset($img_row['code'])) ? $img_row['code'] : '',
'EMOTION' => ($mode == 'smilies' && isset($img_row['emotion'])) ? $img_row['emotion'] : '',
@@ -290,9 +289,9 @@ class acp_icons
'S_ADD_ORDER_LIST_DISPLAY' => $add_order_list . $add_order_lists[1],
'S_ADD_ORDER_LIST_UNDISPLAY' => $add_order_list . $add_order_lists[0],
'IMG_SRC' => $phpbb_root_path . $img_path . '/' . $default_row['smiley_url'],
'IMG_SRC' => PHPBB_ROOT_PATH . $img_path . '/' . $default_row['smiley_url'],
'IMG_PATH' => $img_path,
'PHPBB_ROOT_PATH' => $phpbb_root_path,
'PHPBB_ROOT_PATH' => PHPBB_ROOT_PATH,
'CODE' => $default_row['code'],
'EMOTION' => $default_row['emotion'],
@@ -310,20 +309,20 @@ class acp_icons
case 'modify':
// Get items to create/modify
$images = (isset($_POST['image'])) ? array_keys(request_var('image', array('' => 0))) : array();
$images = array_keys(request::variable('image', array('' => 0), false, request::POST));
// Now really get the items
$image_id = (isset($_POST['id'])) ? request_var('id', array('' => 0)) : array();
$image_order = (isset($_POST['order'])) ? request_var('order', array('' => 0)) : array();
$image_width = (isset($_POST['width'])) ? request_var('width', array('' => 0)) : array();
$image_height = (isset($_POST['height'])) ? request_var('height', array('' => 0)) : array();
$image_add = (isset($_POST['add_img'])) ? request_var('add_img', array('' => 0)) : array();
$image_emotion = utf8_normalize_nfc(request_var('emotion', array('' => ''), true));
$image_code = utf8_normalize_nfc(request_var('code', array('' => ''), true));
$image_display_on_posting = (isset($_POST['display_on_posting'])) ? request_var('display_on_posting', array('' => 0)) : array();
$image_id = request::variable('id', array('' => 0), false, request::POST);
$image_order = request::variable('order', array('' => 0), false, request::POST);
$image_width = request::variable('width', array('' => 0), false, request::POST);
$image_height = request::variable('height', array('' => 0), false, request::POST);
$image_add = request::variable('add_img', array('' => 0), false, request::POST);
$image_display_on_posting = request::variable('display_on_posting', array('' => 0), false, request::POST);
$image_emotion = utf8_normalize_nfc(request_var('emotion', array('' => ''), true));
$image_code = utf8_normalize_nfc(request_var('code', array('' => ''), true));
// Ok, add the relevant bits if we are adding new codes to existing emoticons...
if (!empty($_POST['add_additional_code']))
if (request::variable('add_additional_code', false, false, request::POST))
{
$add_image = request_var('add_image', '');
$add_code = utf8_normalize_nfc(request_var('add_code', '', true));
@@ -339,7 +338,7 @@ class acp_icons
$image_width[$add_image] = request_var('add_width', 0);
$image_height[$add_image] = request_var('add_height', 0);
if (!empty($_POST['add_display_on_posting']))
if (request::variable('add_display_on_posting', false, false, request::POST))
{
$image_display_on_posting[$add_image] = 1;
}
@@ -364,7 +363,7 @@ class acp_icons
{
if ($image_width[$image] == 0 || $image_height[$image] == 0)
{
$img_size = getimagesize($phpbb_root_path . $img_path . '/' . $image);
$img_size = getimagesize(PHPBB_ROOT_PATH . $img_path . '/' . $image);
$image_width[$image] = $img_size[0];
$image_height[$image] = $img_size[1];
}
@@ -473,7 +472,7 @@ class acp_icons
{
$order = 0;
if (!($pak_ary = @file($phpbb_root_path . $img_path . '/' . $pak)))
if (!($pak_ary = @file(PHPBB_ROOT_PATH . $img_path . '/' . $pak)))
{
trigger_error($user->lang['PAK_FILE_NOT_READABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
}
@@ -499,16 +498,13 @@ class acp_icons
// The user has already selected a smilies_pak file
if ($current == 'delete')
{
switch ($db->sql_layer)
if ($db->truncate)
{
case 'sqlite':
case 'firebird':
$db->sql_query('DELETE FROM ' . $table);
break;
default:
$db->sql_query('TRUNCATE TABLE ' . $table);
break;
$db->sql_query('TRUNCATE TABLE ' . $table);
}
else
{
$db->sql_query('DELETE FROM ' . $table);
}
switch ($mode)
@@ -848,7 +844,7 @@ class acp_icons
$template->assign_block_vars('items', array(
'S_SPACER' => (!$spacer && !$row['display_on_posting']) ? true : false,
'ALT_TEXT' => $alt_text,
'IMG_SRC' => $phpbb_root_path . $img_path . '/' . $row[$fields . '_url'],
'IMG_SRC' => PHPBB_ROOT_PATH . $img_path . '/' . $row[$fields . '_url'],
'WIDTH' => $row[$fields . '_width'],
'HEIGHT' => $row[$fields . '_height'],
'CODE' => (isset($row['code'])) ? $row['code'] : '',

View File

@@ -24,7 +24,7 @@ class acp_inactive
var $u_action;
var $p_master;
function acp_inactive(&$p_master)
function __construct(&$p_master)
{
$this->p_master = &$p_master;
}
@@ -32,16 +32,15 @@ class acp_inactive
function main($id, $mode)
{
global $config, $db, $user, $auth, $template;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
$user->add_lang('memberlist');
$action = request_var('action', '');
$mark = (isset($_REQUEST['mark'])) ? request_var('mark', array(0)) : array();
$mark = request_var('mark', array(0));
$start = request_var('start', 0);
$submit = isset($_POST['submit']);
$submit = request::is_set_post('submit');
// Sort keys
$sort_days = request_var('st', 0);
@@ -98,7 +97,7 @@ class acp_inactive
if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !empty($inactive_users))
{
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT);
$messenger = new messenger();
@@ -167,7 +166,7 @@ class acp_inactive
if ($row = $db->sql_fetchrow($result))
{
// Send the messages
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT);
$messenger = new messenger();
$usernames = array();
@@ -182,7 +181,7 @@ class acp_inactive
$messenger->assign_vars(array(
'USERNAME' => htmlspecialchars_decode($row['username']),
'REGISTER_DATE' => $user->format_date($row['user_regdate']),
'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u=" . $row['user_id'] . '&k=' . $row['user_actkey'])
'U_ACTIVATE' => generate_board_url() . '/ucp.' . PHP_EXT . '?mode=activate&u=' . $row['user_id'] . '&k=' . $row['user_actkey'])
);
$messenger->send($row['user_notify_type']);
@@ -228,7 +227,7 @@ class acp_inactive
'REASON' => $row['inactive_reason'],
'USER_ID' => $row['user_id'],
'USERNAME' => $row['username'],
'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&amp;mode=overview&amp;u={$row['user_id']}"))
'U_USER_ADMIN' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=users&amp;mode=overview&amp;u={$row['user_id']}"))
);
}

View File

@@ -26,15 +26,14 @@ class acp_jabber
function main($id, $mode)
{
global $db, $user, $auth, $template;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $user, $auth, $template, $config;
$user->add_lang('acp/board');
include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_jabber.' . PHP_EXT);
$action = request_var('action', '');
$submit = (isset($_POST['submit'])) ? true : false;
$submit = request::is_set_post('submit');
if ($mode != 'settings')
{

View File

@@ -32,36 +32,45 @@ class acp_language
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $cache;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
global $safe_mode, $file_uploads;
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
/**
* @todo make this work with the request class, might require some additional functionality
* inside the request class. Reducing some of the redundance of this code would certainly
* not hurt either.
*/
request::enable_super_globals();
include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
$this->default_variables();
// Check and set some common vars
$action = (isset($_POST['update_details'])) ? 'update_details' : '';
$action = (isset($_POST['download_file'])) ? 'download_file' : $action;
$action = (isset($_POST['upload_file'])) ? 'upload_file' : $action;
$action = (isset($_POST['upload_data'])) ? 'upload_data' : $action;
$action = (isset($_POST['submit_file'])) ? 'submit_file' : $action;
$action = (isset($_POST['remove_store'])) ? 'details' : $action;
$action = (request::is_set_post('update_details')) ? 'update_details' : '';
$action = (request::is_set_post('download_file')) ? 'download_file' : $action;
$action = (request::is_set_post('upload_file')) ? 'upload_file' : $action;
$action = (request::is_set_post('upload_data')) ? 'upload_data' : $action;
$action = (request::is_set_post('submit_file')) ? 'submit_file' : $action;
$action = (request::is_set_post('remove_store')) ? 'details' : $action;
$submit = (empty($action) && !isset($_POST['update']) && !isset($_POST['test_connection'])) ? false : true;
$submit = (empty($action) && !request::is_set_post('update') && !request::is_set_post('test_connection')) ? false : true;
$action = (empty($action)) ? request_var('action', '') : $action;
$form_name = 'acp_lang';
add_form_key('acp_lang');
$lang_id = request_var('id', 0);
if (isset($_POST['missing_file']))
if (request::is_set_post('missing_file'))
{
$missing_file = request_var('missing_file', array('' => 0));
list($_REQUEST['language_file'], ) = array_keys($missing_file);
/**
* @todo Do NOT overwrite a request variable.
*/
request::overwrite('language_file', key($missing_file));
}
$selected_lang_file = request_var('language_file', '|common.' . $phpEx);
$selected_lang_file = request_var('language_file', '|common.' . PHP_EXT);
list($this->language_directory, $this->language_file) = explode('|', $selected_lang_file);
@@ -78,7 +87,7 @@ class acp_language
$action = 'upload_file';
$method = request_var('method', '');
include_once($phpbb_root_path . 'includes/functions_transfer.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_transfer.' . PHP_EXT);
switch ($method)
{
@@ -103,7 +112,7 @@ class acp_language
{
case 'upload_file':
include_once($phpbb_root_path . 'includes/functions_transfer.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_transfer.' . PHP_EXT);
$method = request_var('method', '');
@@ -115,11 +124,12 @@ class acp_language
$requested_data = call_user_func(array($method, 'data'));
foreach ($requested_data as $data => $default)
{
$default_value = request_var($data, '');
$template->assign_block_vars('data', array(
'DATA' => $data,
'NAME' => $user->lang[strtoupper($method . '_' . $data)],
'EXPLAIN' => $user->lang[strtoupper($method . '_' . $data) . '_EXPLAIN'],
'DEFAULT' => (!empty($_REQUEST[$data])) ? request_var($data, '') : $default
'DEFAULT' => (empty($default_value)) ? $default : $default_value
));
}
@@ -130,6 +140,9 @@ class acp_language
'method' => $method)
);
/**
* @todo Do not use $_POST here, but request::variable which needs to support more dimensions
*/
$hidden_data .= build_hidden_fields(array('entry' => $_POST['entry']), true, STRIP);
$template->assign_vars(array(
@@ -181,7 +194,7 @@ class acp_language
case 'submit_file':
case 'download_file':
case 'upload_data':
if (!$submit || !check_form_key($form_name))
{
trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING);
@@ -219,7 +232,7 @@ class acp_language
{
case 'email':
// Get email templates
$email_files = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'email', 'txt');
$email_files = filelist(PHPBB_ROOT_PATH . 'language/' . $row['lang_iso'], 'email', 'txt');
$email_files = $email_files['email/'];
if (!in_array($this->language_file, $email_files))
@@ -230,7 +243,7 @@ class acp_language
case 'acp':
// Get acp files
$acp_files = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'acp', $phpEx);
$acp_files = filelist(PHPBB_ROOT_PATH . 'language/' . $row['lang_iso'], 'acp', PHP_EXT);
$acp_files = $acp_files['acp/'];
if (!in_array($this->language_file, $acp_files))
@@ -241,7 +254,7 @@ class acp_language
case 'mods':
// Get mod files
$mods_files = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'mods', $phpEx);
$mods_files = filelist(PHPBB_ROOT_PATH . 'language/' . $row['lang_iso'], 'mods', PHP_EXT);
$mods_files = (isset($mods_files['mods/'])) ? $mods_files['mods/'] : array();
if (!in_array($this->language_file, $mods_files))
@@ -261,16 +274,16 @@ class acp_language
if (!$safe_mode)
{
$mkdir_ary = array('language', 'language/' . $row['lang_iso']);
if ($this->language_directory)
{
$mkdir_ary[] = 'language/' . $row['lang_iso'] . '/' . $this->language_directory;
}
foreach ($mkdir_ary as $dir)
{
$dir = $phpbb_root_path . 'store/' . $dir;
$dir = PHPBB_ROOT_PATH . 'store/' . $dir;
if (!is_dir($dir))
{
if (!@mkdir($dir, 0777))
@@ -284,7 +297,7 @@ class acp_language
// Get target filename for storage folder
$filename = $this->get_filename($row['lang_iso'], $this->language_directory, $this->language_file, true, true);
$fp = @fopen($phpbb_root_path . $filename, 'wb');
$fp = @fopen(PHPBB_ROOT_PATH . $filename, 'wb');
if (!$fp)
{
@@ -316,7 +329,7 @@ class acp_language
}
$entry = "\tarray(\n";
foreach ($value as $_key => $_value)
{
$entry .= "\t\t" . (int) $_key . "\t=> '" . $this->prepare_lang_entry($_value) . "',\n";
@@ -354,7 +367,7 @@ class acp_language
header('Content-Type: application/octetstream; name="' . $this->language_file . '"');
header('Content-disposition: attachment; filename=' . $this->language_file);
$fp = @fopen($phpbb_root_path . $filename, 'rb');
$fp = @fopen(PHPBB_ROOT_PATH . $filename, 'rb');
while ($buffer = fread($fp, 1024))
{
echo $buffer;
@@ -382,7 +395,7 @@ class acp_language
$old_file = '/' . $this->get_filename($row['lang_iso'], $dir, $file, false, true);
$lang_path = 'language/' . $row['lang_iso'] . '/' . (($dir) ? $dir . '/' : '');
include_once($phpbb_root_path . 'includes/functions_transfer.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_transfer.' . PHP_EXT);
$method = request_var('method', '');
if ($method != 'ftp' && $method != 'ftp_fsock')
@@ -412,9 +425,9 @@ class acp_language
$transfer->close_session();
// Remove from storage folder
if (file_exists($phpbb_root_path . 'store/' . $lang_path . $file))
if (file_exists(PHPBB_ROOT_PATH . 'store/' . $lang_path . $file))
{
@unlink($phpbb_root_path . 'store/' . $lang_path . $file);
@unlink(PHPBB_ROOT_PATH . 'store/' . $lang_path . $file);
}
add_log('admin', 'LOG_LANGUAGE_FILE_REPLACED', $file);
@@ -433,7 +446,7 @@ class acp_language
{
trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$this->page_title = 'LANGUAGE_PACK_DETAILS';
$sql = 'SELECT *
@@ -442,20 +455,20 @@ class acp_language
$result = $db->sql_query($sql);
$lang_entries = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$lang_iso = $lang_entries['lang_iso'];
$missing_vars = $missing_files = array();
// Get email templates
$email_files = filelist($phpbb_root_path . 'language/' . $config['default_lang'], 'email', 'txt');
$email_files = filelist(PHPBB_ROOT_PATH . 'language/' . $config['default_lang'], 'email', 'txt');
$email_files = $email_files['email/'];
// Get acp files
$acp_files = filelist($phpbb_root_path . 'language/' . $config['default_lang'], 'acp', $phpEx);
$acp_files = filelist(PHPBB_ROOT_PATH . 'language/' . $config['default_lang'], 'acp', PHP_EXT);
$acp_files = $acp_files['acp/'];
// Get mod files
$mods_files = filelist($phpbb_root_path . 'language/' . $config['default_lang'], 'mods', $phpEx);
$mods_files = filelist(PHPBB_ROOT_PATH . 'language/' . $config['default_lang'], 'mods', PHP_EXT);
$mods_files = (isset($mods_files['mods/'])) ? $mods_files['mods/'] : array();
// Check if our current filename matches the files
@@ -488,18 +501,18 @@ class acp_language
trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&amp;action=details&amp;id=' . $lang_id), E_USER_WARNING);
}
}
if (isset($_POST['remove_store']))
if (request::is_set_post('remove_store'))
{
$store_filename = $this->get_filename($lang_iso, $this->language_directory, $this->language_file, true, true);
if (file_exists($phpbb_root_path . $store_filename))
if (file_exists(PHPBB_ROOT_PATH . $store_filename))
{
@unlink($phpbb_root_path . $store_filename);
@unlink(PHPBB_ROOT_PATH . $store_filename);
}
}
include_once($phpbb_root_path . 'includes/functions_transfer.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_transfer.' . PHP_EXT);
$methods = transfer::methods();
@@ -529,10 +542,10 @@ class acp_language
foreach ($this->main_files as $file)
{
if (file_exists($phpbb_root_path . $this->get_filename($lang_iso, '', $file)))
if (file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, '', $file)))
{
$missing_vars[$file] = $this->compare_language_files($config['default_lang'], $lang_iso, '', $file);
if (sizeof($missing_vars[$file]))
{
$is_missing_var = true;
@@ -547,10 +560,10 @@ class acp_language
// Now go through acp/mods directories
foreach ($acp_files as $file)
{
if (file_exists($phpbb_root_path . $this->get_filename($lang_iso, 'acp', $file)))
if (file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, 'acp', $file)))
{
$missing_vars['acp/' . $file] = $this->compare_language_files($config['default_lang'], $lang_iso, 'acp', $file);
if (sizeof($missing_vars['acp/' . $file]))
{
$is_missing_var = true;
@@ -566,10 +579,10 @@ class acp_language
{
foreach ($mods_files as $file)
{
if (file_exists($phpbb_root_path . $this->get_filename($lang_iso, 'mods', $file)))
if (file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, 'mods', $file)))
{
$missing_vars['mods/' . $file] = $this->compare_language_files($config['default_lang'], $lang_iso, 'mods', $file);
if (sizeof($missing_vars['mods/' . $file]))
{
$is_missing_var = true;
@@ -581,11 +594,11 @@ class acp_language
}
}
}
// More missing files... for example email templates?
foreach ($email_files as $file)
{
if (!file_exists($phpbb_root_path . $this->get_filename($lang_iso, 'email', $file)))
if (!file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, 'email', $file)))
{
$missing_files[] = $this->get_filename($lang_iso, 'email', $file);
}
@@ -625,7 +638,7 @@ class acp_language
}
// Main language files
$s_lang_options = '<option value="|common.' . $phpEx . '" class="sep">' . $user->lang['LANGUAGE_FILES'] . '</option>';
$s_lang_options = '<option value="|common.' . PHP_EXT . '" class="sep">' . $user->lang['LANGUAGE_FILES'] . '</option>';
foreach ($this->main_files as $file)
{
if (strpos($file, 'help_') === 0)
@@ -633,14 +646,14 @@ class acp_language
continue;
}
$prefix = (file_exists($phpbb_root_path . $this->get_filename($lang_iso, '', $file, true, true))) ? '* ' : '';
$prefix = (file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, '', $file, true, true))) ? '* ' : '';
$selected = (!$this->language_directory && $this->language_file == $file) ? ' selected="selected"' : '';
$s_lang_options .= '<option value="|' . $file . '"' . $selected . '>' . $prefix . $file . '</option>';
}
// Help Files
$s_lang_options .= '<option value="|common.' . $phpEx . '" class="sep">' . $user->lang['HELP_FILES'] . '</option>';
$s_lang_options .= '<option value="|common.' . PHP_EXT . '" class="sep">' . $user->lang['HELP_FILES'] . '</option>';
foreach ($this->main_files as $file)
{
if (strpos($file, 'help_') !== 0)
@@ -648,7 +661,7 @@ class acp_language
continue;
}
$prefix = (file_exists($phpbb_root_path . $this->get_filename($lang_iso, '', $file, true, true))) ? '* ' : '';
$prefix = (file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, '', $file, true, true))) ? '* ' : '';
$selected = (!$this->language_directory && $this->language_file == $file) ? ' selected="selected"' : '';
$s_lang_options .= '<option value="|' . $file . '"' . $selected . '>' . $prefix . $file . '</option>';
@@ -664,11 +677,11 @@ class acp_language
continue;
}
$s_lang_options .= '<option value="|common.' . $phpEx . '" class="sep">' . $user->lang[strtoupper($check) . '_FILES'] . '</option>';
$s_lang_options .= '<option value="|common.' . PHP_EXT . '" class="sep">' . $user->lang[strtoupper($check) . '_FILES'] . '</option>';
foreach (${$check . '_files'} as $file)
{
$prefix = (file_exists($phpbb_root_path . $this->get_filename($lang_iso, $check, $file, true, true))) ? '* ' : '';
$prefix = (file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, $check, $file, true, true))) ? '* ' : '';
$selected = ($this->language_directory == $check && $this->language_file == $file) ? ' selected="selected"' : '';
$s_lang_options .= '<option value="' . $check . '|' . $file . '"' . $selected . '>' . $prefix . $file . '</option>';
@@ -681,10 +694,10 @@ class acp_language
$is_email_file = ($this->language_directory == 'email') ? true : false;
$is_help_file = (strpos($this->language_file, 'help_') === 0) ? true : false;
$file_from_store = (file_exists($phpbb_root_path . $this->get_filename($lang_iso, $this->language_directory, $this->language_file, true, true))) ? true : false;
$file_from_store = (file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, $this->language_directory, $this->language_file, true, true))) ? true : false;
$no_store_filename = $this->get_filename($lang_iso, $this->language_directory, $this->language_file);
if (!$file_from_store && !file_exists($phpbb_root_path . $no_store_filename))
if (!$file_from_store && !file_exists(PHPBB_ROOT_PATH . $no_store_filename))
{
$print_message = sprintf($user->lang['MISSING_LANGUAGE_FILE'], $no_store_filename);
}
@@ -692,12 +705,12 @@ class acp_language
{
if ($is_email_file)
{
$lang = file_get_contents($phpbb_root_path . $this->get_filename($lang_iso, $this->language_directory, $this->language_file, $file_from_store));
$lang = file_get_contents(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, $this->language_directory, $this->language_file, $file_from_store));
}
else
{
$help = array();
include($phpbb_root_path . $this->get_filename($lang_iso, $this->language_directory, $this->language_file, $file_from_store));
include(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, $this->language_directory, $this->language_file, $file_from_store));
if ($is_help_file)
{
@@ -794,12 +807,12 @@ class acp_language
$lang_iso = request_var('iso', '');
$lang_iso = basename($lang_iso);
if (!$lang_iso || !file_exists("{$phpbb_root_path}language/$lang_iso/iso.txt"))
if (!$lang_iso || !file_exists(PHPBB_ROOT_PATH . "language/$lang_iso/iso.txt"))
{
trigger_error($user->lang['LANGUAGE_PACK_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$file = file("{$phpbb_root_path}language/$lang_iso/iso.txt");
$file = file(PHPBB_ROOT_PATH . "language/$lang_iso/iso.txt");
$lang_pack = array(
'iso' => $lang_iso,
@@ -849,9 +862,9 @@ class acp_language
$result = $db->sql_query($sql);
while ($imageset_row = $db->sql_fetchrow($result))
{
if (@file_exists("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['iso']}/imageset.cfg"))
if (@file_exists(PHPBB_ROOT_PATH . "styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['iso']}/imageset.cfg"))
{
$cfg_data_imageset_data = parse_cfg_file("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['iso']}/imageset.cfg");
$cfg_data_imageset_data = parse_cfg_file(PHPBB_ROOT_PATH . "styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['iso']}/imageset.cfg");
foreach ($cfg_data_imageset_data as $image_name => $value)
{
if (strpos($value, '*') !== false)
@@ -994,41 +1007,41 @@ class acp_language
$use_method = '.tar';
}
include_once($phpbb_root_path . 'includes/functions_compress.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_compress.' . PHP_EXT);
if ($use_method == '.zip')
{
$compress = new compress_zip('w', $phpbb_root_path . 'store/lang_' . $row['lang_iso'] . $use_method);
$compress = new compress_zip('w', PHPBB_ROOT_PATH . 'store/lang_' . $row['lang_iso'] . $use_method);
}
else
{
$compress = new compress_tar('w', $phpbb_root_path . 'store/lang_' . $row['lang_iso'] . $use_method, $use_method);
$compress = new compress_tar('w', PHPBB_ROOT_PATH . 'store/lang_' . $row['lang_iso'] . $use_method, $use_method);
}
// Get email templates
$email_templates = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'email', 'txt');
$email_templates = filelist(PHPBB_ROOT_PATH . 'language/' . $row['lang_iso'], 'email', 'txt');
$email_templates = $email_templates['email/'];
// Get acp files
$acp_files = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'acp', $phpEx);
$acp_files = filelist(PHPBB_ROOT_PATH . 'language/' . $row['lang_iso'], 'acp', PHP_EXT);
$acp_files = $acp_files['acp/'];
// Get mod files
$mod_files = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'mods', $phpEx);
$mod_files = filelist(PHPBB_ROOT_PATH . 'language/' . $row['lang_iso'], 'mods', PHP_EXT);
$mod_files = (isset($mod_files['mods/'])) ? $mod_files['mods/'] : array();
// Add main files
$this->add_to_archive($compress, $this->main_files, $row['lang_iso']);
// Add search files if they exist...
if (file_exists($phpbb_root_path . 'language/' . $row['lang_iso'] . '/search_ignore_words.' . $phpEx))
if (file_exists(PHPBB_ROOT_PATH . 'language/' . $row['lang_iso'] . '/search_ignore_words.' . PHP_EXT))
{
$this->add_to_archive($compress, array("search_ignore_words.$phpEx"), $row['lang_iso']);
$this->add_to_archive($compress, array('search_ignore_words.' . PHP_EXT), $row['lang_iso']);
}
if (file_exists($phpbb_root_path . 'language/' . $row['lang_iso'] . '/search_synonyms.' . $phpEx))
if (file_exists(PHPBB_ROOT_PATH . 'language/' . $row['lang_iso'] . '/search_synonyms.' . PHP_EXT))
{
$this->add_to_archive($compress, array("search_synonyms.$phpEx"), $row['lang_iso']);
$this->add_to_archive($compress, array('search_synonyms.' . PHP_EXT), $row['lang_iso']);
}
// Write files in folders
@@ -1046,7 +1059,7 @@ class acp_language
$compress->add_data('', 'language/' . $row['lang_iso'] . '/index.html');
$compress->add_data('', 'language/' . $row['lang_iso'] . '/email/index.html');
$compress->add_data('', 'language/' . $row['lang_iso'] . '/acp/index.html');
if (sizeof($mod_files))
{
$compress->add_data('', 'language/' . $row['lang_iso'] . '/mods/index.html');
@@ -1055,7 +1068,7 @@ class acp_language
$compress->close();
$compress->download('lang_' . $row['lang_iso']);
@unlink($phpbb_root_path . 'store/lang_' . $row['lang_iso'] . $use_method);
@unlink(PHPBB_ROOT_PATH . 'store/lang_' . $row['lang_iso'] . $use_method);
exit;
@@ -1101,17 +1114,17 @@ class acp_language
$db->sql_freeresult($result);
$new_ary = $iso = array();
$dp = @opendir("{$phpbb_root_path}language");
$dp = @opendir(PHPBB_ROOT_PATH . 'language');
if ($dp)
{
while (($file = readdir($dp)) !== false)
{
if ($file[0] != '.' && file_exists("{$phpbb_root_path}language/$file/iso.txt"))
if ($file[0] != '.' && file_exists(PHPBB_ROOT_PATH . "language/$file/iso.txt"))
{
if (!in_array($file, $installed))
{
if ($iso = file("{$phpbb_root_path}language/$file/iso.txt"))
if ($iso = file(PHPBB_ROOT_PATH . "language/$file/iso.txt"))
{
if (sizeof($iso) == 3)
{
@@ -1153,8 +1166,6 @@ class acp_language
*/
function default_variables()
{
global $phpEx;
$this->language_file_header = '<?php
/**
*
@@ -1199,7 +1210,7 @@ $lang = array_merge($lang, array(
';
// Language files in language root directory
$this->main_files = array("common.$phpEx", "groups.$phpEx", "install.$phpEx", "mcp.$phpEx", "memberlist.$phpEx", "posting.$phpEx", "search.$phpEx", "ucp.$phpEx", "viewforum.$phpEx", "viewtopic.$phpEx", "help_bbcode.$phpEx", "help_faq.$phpEx");
$this->main_files = array('common.' . PHP_EXT, 'groups.' . PHP_EXT, 'install.' . PHP_EXT, 'mcp.' . PHP_EXT, 'memberlist.' . PHP_EXT, 'posting.' . PHP_EXT, 'search.' . PHP_EXT, 'ucp.' . PHP_EXT, 'viewforum.' . PHP_EXT, 'viewtopic.' . PHP_EXT, 'help_bbcode.' . PHP_EXT, 'help_faq.' . PHP_EXT);
}
/**
@@ -1207,15 +1218,15 @@ $lang = array_merge($lang, array(
*/
function get_filename($lang_iso, $directory, $filename, $check_store = false, $only_return_filename = false)
{
global $phpbb_root_path, $safe_mode;
global $safe_mode;
$check_filename = "language/$lang_iso/" . (($directory) ? $directory . '/' : '') . $filename;
if ($check_store)
{
$check_store_filename = ($safe_mode) ? "store/langfile_{$lang_iso}" . (($directory) ? '_' . $directory : '') . "_{$filename}" : "store/language/$lang_iso/" . (($directory) ? $directory . '/' : '') . $filename;
if (!$only_return_filename && file_exists($phpbb_root_path . $check_store_filename))
if (!$only_return_filename && file_exists(PHPBB_ROOT_PATH . $check_store_filename))
{
return $check_store_filename;
}
@@ -1233,8 +1244,6 @@ $lang = array_merge($lang, array(
*/
function add_to_archive(&$compress, $filelist, $lang_iso, $directory = '')
{
global $phpbb_root_path;
foreach ($filelist as $file)
{
// Get source filename
@@ -1242,7 +1251,7 @@ $lang = array_merge($lang, array(
$destination = 'language/' . $lang_iso . '/' . (($directory) ? $directory . '/' : '') . $file;
// Add file to archive
$compress->add_custom_file($phpbb_root_path . $source, $destination);
$compress->add_custom_file(PHPBB_ROOT_PATH . $source, $destination);
}
}
@@ -1359,22 +1368,20 @@ $lang = array_merge($lang, array(
*/
function compare_language_files($source_lang, $dest_lang, $directory, $file)
{
global $phpbb_root_path, $phpEx;
$return_ary = array();
$lang = array();
include("{$phpbb_root_path}language/{$source_lang}/" . (($directory) ? $directory . '/' : '') . $file);
include(PHPBB_ROOT_PATH . "language/{$source_lang}/" . (($directory) ? $directory . '/' : '') . $file);
$lang_entry_src = $lang;
$lang = array();
if (!file_exists($phpbb_root_path . $this->get_filename($dest_lang, $directory, $file, true)))
if (!file_exists(PHPBB_ROOT_PATH . $this->get_filename($dest_lang, $directory, $file, true)))
{
return array();
}
include($phpbb_root_path . $this->get_filename($dest_lang, $directory, $file, true));
include(PHPBB_ROOT_PATH . $this->get_filename($dest_lang, $directory, $file, true));
$lang_entry_dst = $lang;

View File

@@ -25,8 +25,7 @@ class acp_logs
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $user, $auth, $template, $cache, $config;
$user->add_lang('mcp');
@@ -34,8 +33,8 @@ class acp_logs
$action = request_var('action', '');
$forum_id = request_var('f', 0);
$start = request_var('start', 0);
$deletemark = (!empty($_POST['delmarked'])) ? true : false;
$deleteall = (!empty($_POST['delall'])) ? true : false;
$deletemark = request::variable('delmarked', false, false, request::POST);
$deleteall = request::variable('delall', false, false, request::POST);
$marked = request_var('mark', array(0));
// Sort keys

View File

@@ -26,7 +26,6 @@ class acp_main
function main($id, $mode)
{
global $config, $db, $user, $auth, $template;
global $phpbb_root_path, $phpbb_admin_path, $phpEx;
// Show restore permissions notice
if ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm'))
@@ -42,16 +41,16 @@ class acp_main
$db->sql_freeresult($result);
$perm_from = '<strong' . (($user_row['user_colour']) ? ' style="color: #' . $user_row['user_colour'] . '">' : '>');
$perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '<a href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&amp;u=' . $user_row['user_id']) . '">' : '';
$perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '<a href="' . append_sid('memberlist', 'mode=viewprofile&amp;u=' . $user_row['user_id']) . '">' : '';
$perm_from .= $user_row['username'];
$perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '</a>' : '';
$perm_from .= '</strong>';
$template->assign_vars(array(
'S_RESTORE_PERMISSIONS' => true,
'U_RESTORE_PERMISSIONS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm'),
'U_RESTORE_PERMISSIONS' => append_sid('ucp', 'mode=restore_perm'),
'PERM_FROM' => $perm_from,
'L_PERMISSIONS_TRANSFERRED_EXPLAIN' => sprintf($user->lang['PERMISSIONS_TRANSFERRED_EXPLAIN'], $perm_from, append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm')),
'L_PERMISSIONS_TRANSFERRED_EXPLAIN' => sprintf($user->lang['PERMISSIONS_TRANSFERRED_EXPLAIN'], $perm_from, append_sid('ucp', 'mode=restore_perm')),
));
return;
@@ -64,7 +63,7 @@ class acp_main
if ($action === 'admlogout')
{
$user->unset_admin();
$redirect_url = append_sid("{$phpbb_root_path}index.$phpEx");
$redirect_url = append_sid(PHPBB_ROOT_PATH . 'index.' . PHP_EXT);
meta_refresh(3, $redirect_url);
trigger_error($user->lang['ADM_LOGGED_OUT'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . $redirect_url . '">', '</a>'));
}
@@ -171,7 +170,7 @@ class acp_main
if (!function_exists('update_last_username'))
{
include($phpbb_root_path . "includes/functions_user.$phpEx");
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
}
update_last_username();
@@ -252,16 +251,13 @@ class acp_main
break;
case 'db_track':
switch ($db->sql_layer)
if ($db->truncate)
{
case 'sqlite':
case 'firebird':
$db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE);
break;
default:
$db->sql_query('TRUNCATE TABLE ' . TOPICS_POSTED_TABLE);
break;
$db->sql_query('TRUNCATE TABLE ' . TOPICS_POSTED_TABLE);
}
else
{
$db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE);
}
// This can get really nasty... therefore we only do the last six months
@@ -364,13 +360,13 @@ class acp_main
$avatar_dir_size = 0;
if ($avatar_dir = @opendir($phpbb_root_path . $config['avatar_path']))
if ($avatar_dir = @opendir(PHPBB_ROOT_PATH . $config['avatar_path']))
{
while (($file = readdir($avatar_dir)) !== false)
{
if ($file[0] != '.' && $file != 'CVS' && strpos($file, 'index.') === false)
{
$avatar_dir_size += filesize($phpbb_root_path . $config['avatar_path'] . '/' . $file);
$avatar_dir_size += filesize(PHPBB_ROOT_PATH . $config['avatar_path'] . '/' . $file);
}
}
closedir($avatar_dir);
@@ -440,8 +436,8 @@ class acp_main
'BOARD_VERSION' => $config['version'],
'U_ACTION' => $this->u_action,
'U_ADMIN_LOG' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=logs&amp;mode=admin'),
'U_INACTIVE_USERS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=inactive&amp;mode=list'),
'U_ADMIN_LOG' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=logs&amp;mode=admin'),
'U_INACTIVE_USERS' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=inactive&amp;mode=list'),
'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false,
'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false,
@@ -482,7 +478,7 @@ class acp_main
'REASON' => $row['inactive_reason'],
'USER_ID' => $row['user_id'],
'USERNAME' => $row['username'],
'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&amp;mode=overview&amp;u={$row['user_id']}"))
'U_USER_ADMIN' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=users&amp;mode=overview&amp;u={$row['user_id']}"))
);
}
@@ -499,15 +495,15 @@ class acp_main
}
// Warn if install is still present
if (file_exists($phpbb_root_path . 'install'))
if (file_exists(PHPBB_ROOT_PATH . 'install'))
{
$template->assign_var('S_REMOVE_INSTALL', true);
}
if (!defined('PHPBB_DISABLE_CONFIG_CHECK') && file_exists($phpbb_root_path . 'config.' . $phpEx) && is_writable($phpbb_root_path . 'config.' . $phpEx))
if (!defined('PHPBB_DISABLE_CONFIG_CHECK') && file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) && is_writable(PHPBB_ROOT_PATH . 'config.' . PHP_EXT))
{
// World-Writable? (000x)
$template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms($phpbb_root_path . 'config.' . $phpEx) & 0x0002));
$template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) & 0x0002));
}
$this->tpl_name = 'acp_main';
@@ -515,4 +511,4 @@ class acp_main
}
}
?>
?>

View File

@@ -34,11 +34,16 @@ class acp_modules
var $module_class = '';
var $parent_id;
var $u_action;
var $p_master;
function __construct(p_master $p_master = null)
{
$this->p_master = $p_master;
}
function main($id, $mode)
{
global $db, $user, $auth, $template, $module;
global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
global $db, $user, $auth, $template, $module, $config;
// Set a global define for modules we might include (the author is able to prevent execution of code by checking this constant)
define('MODULE_INCLUDE', true);
@@ -261,7 +266,7 @@ class acp_modules
$module_data['module_langname'] = utf8_normalize_nfc(request_var('module_langname', (string) $module_row['module_langname'], true));
$module_data['module_mode'] = request_var('module_mode', (string) $module_row['module_mode']);
$submit = (isset($_POST['submit'])) ? true : false;
$submit = request::is_set_post('submit');
if ($submit)
{
@@ -530,11 +535,9 @@ class acp_modules
*/
function get_module_infos($module = '', $module_class = false)
{
global $phpbb_root_path, $phpEx;
$module_class = ($module_class === false) ? $this->module_class : $module_class;
$directory = $phpbb_root_path . 'includes/' . $module_class . '/info/';
$directory = PHPBB_ROOT_PATH . 'includes/' . $module_class . '/info/';
$fileinfo = array();
if (!$module)
@@ -549,9 +552,9 @@ class acp_modules
while (($file = readdir($dh)) !== false)
{
// Is module?
if (preg_match('/^' . $module_class . '_.+\.' . $phpEx . '$/', $file))
if (preg_match('/^' . $module_class . '_.+\.' . PHP_EXT . '$/', $file))
{
$class = str_replace(".$phpEx", '', $file) . '_info';
$class = str_replace('.' . PHP_EXT, '', $file) . '_info';
if (!class_exists($class))
{
@@ -578,7 +581,7 @@ class acp_modules
if (!class_exists($class))
{
include($directory . $filename . '.' . $phpEx);
include($directory . $filename . '.' . PHP_EXT);
}
// Get module title tag
@@ -627,7 +630,7 @@ class acp_modules
if (!$ignore_acl && $row['module_auth'])
{
// We use zero as the forum id to check - global setting.
if (!p_master::module_auth($row['module_auth'], 0))
if (!$this->p_master->module_auth($row['module_auth'], 0))
{
continue;
}

View File

@@ -25,11 +25,10 @@ class acp_permission_roles
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $user, $auth, $template, $cache, $config;
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
include_once(PHPBB_ROOT_PATH . 'includes/acp/auth.' . PHP_EXT);
$auth_admin = new auth_admin();
@@ -38,10 +37,10 @@ class acp_permission_roles
$this->tpl_name = 'acp_permission_roles';
$submit = (isset($_POST['submit'])) ? true : false;
$submit = request::is_set_post('submit');
$role_id = request_var('role_id', 0);
$action = request_var('action', '');
$action = (isset($_POST['add'])) ? 'add' : $action;
$action = (request::is_set_post('add')) ? 'add' : $action;
$form_name = 'acp_permissions';
add_form_key($form_name);

View File

@@ -26,11 +26,10 @@ class acp_permissions
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $user, $auth, $template, $cache, $config;
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
include_once(PHPBB_ROOT_PATH . 'includes/acp/auth.' . PHP_EXT);
$auth_admin = new auth_admin();
@@ -60,7 +59,7 @@ class acp_permissions
// Set some vars
$action = request_var('action', array('' => 0));
$action = key($action);
$action = (isset($_POST['psubmit'])) ? 'apply_permissions' : $action;
$action = (request::is_set_post('psubmit')) ? 'apply_permissions' : $action;
$all_forums = request_var('all_forums', 0);
$subforum_id = request_var('subforum_id', 0);
@@ -230,8 +229,8 @@ class acp_permissions
trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING);
}
// All users/groups selected?
$all_users = (isset($_POST['all_users'])) ? true : false;
$all_groups = (isset($_POST['all_groups'])) ? true : false;
$all_users = request::is_set_post('all_users');
$all_groups = request::is_set_post('all_groups');
if ($all_users || $all_groups)
{
@@ -258,7 +257,7 @@ class acp_permissions
break;
case 'apply_permissions':
if (!isset($_POST['setting']))
if (!request::is_set_post('setting'))
{
trigger_error($user->lang['NO_AUTH_SETTING_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
}
@@ -271,7 +270,7 @@ class acp_permissions
break;
case 'apply_all_permissions':
if (!isset($_POST['setting']))
if (!request::is_set_post('setting'))
{
trigger_error($user->lang['NO_AUTH_SETTING_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
}
@@ -354,7 +353,7 @@ class acp_permissions
$template->assign_vars(array(
'S_SELECT_USER' => true,
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=select_victim&amp;field=username&amp;select_single=true'),
'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&amp;form=select_victim&amp;field=username&amp;select_single=true'),
));
break;
@@ -369,16 +368,16 @@ class acp_permissions
$template->assign_vars(array(
'S_SELECT_GROUP' => true,
'S_GROUP_OPTIONS' => group_select_options(false, false, false), // Show all groups
));
'S_GROUP_OPTIONS' => group_select_options(false, false, (($user->data['user_type'] == USER_FOUNDER) ? false : 0)))
);
break;
case 'usergroup':
case 'usergroup_view':
$all_users = (isset($_POST['all_users'])) ? true : false;
$all_groups = (isset($_POST['all_groups'])) ? true : false;
$all_users = request::is_set_post('all_users');
$all_groups = request::is_set_post('all_groups');
if ((sizeof($user_id) && !$all_users) || (sizeof($group_id) && !$all_groups))
{
@@ -415,8 +414,8 @@ class acp_permissions
'S_SELECT_USERGROUP_VIEW' => ($victim == 'usergroup_view') ? true : false,
'S_DEFINED_USER_OPTIONS' => $items['user_ids_options'],
'S_DEFINED_GROUP_OPTIONS' => $items['group_ids_options'],
'S_ADD_GROUP_OPTIONS' => group_select_options(false, $items['group_ids'], false), // Show all groups
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=add_user&amp;field=username&amp;select_single=true'),
'S_ADD_GROUP_OPTIONS' => group_select_options(false, $items['group_ids'], (($user->data['user_type'] == USER_FOUNDER) ? false : 0)),
'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&amp;form=add_user&amp;field=username&amp;select_single=true'),
));
break;
@@ -633,18 +632,14 @@ class acp_permissions
list($ug_id, ) = each($psubmit);
list($forum_id, ) = each($psubmit[$ug_id]);
if (empty($_POST['setting']) || empty($_POST['setting'][$ug_id]) || empty($_POST['setting'][$ug_id][$forum_id]) || !is_array($_POST['setting'][$ug_id][$forum_id]))
$auth_settings = request::variable('setting', array(0 => array(0 => array('' => 0))), false, request::POST);
if (!isset($auth_settings[$ug_id][$forum_id]) || !sizeof($auth_settings[$ug_id][$forum_id])))
{
trigger_error('WRONG_PERMISSION_SETTING_FORMAT', E_USER_WARNING);
}
// We obtain and check $_POST['setting'][$ug_id][$forum_id] directly and not using request_var() because request_var()
// currently does not support the amount of dimensions required. ;)
// $auth_settings = request_var('setting', array(0 => array(0 => array('' => 0))));
$auth_settings = array_map('intval', $_POST['setting'][$ug_id][$forum_id]);
// Do we have a role we want to set?
$assigned_role = (isset($_POST['role'][$ug_id][$forum_id])) ? (int) $_POST['role'][$ug_id][$forum_id] : 0;
$assigned_role = request::variable(array('role', $ug_id, $forum_id), 0, false, request::POST));
// Do the admin want to set these permissions to other items too?
$inherit = request_var('inherit', array(0 => array(0)));
@@ -714,23 +709,21 @@ class acp_permissions
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$auth_settings = (isset($_POST['setting'])) ? $_POST['setting'] : array();
$auth_roles = (isset($_POST['role'])) ? $_POST['role'] : array();
$auth_settings = request::variable('setting', array(0 => array(0 => array('' => 0))), false, request::POST);
$auth_roles = request::variable('role', array(0 => array(0 => 0)), false, request::POST);
$ug_ids = $forum_ids = array();
// We need to go through the auth settings
foreach ($auth_settings as $ug_id => $forum_auth_row)
{
$ug_id = (int) $ug_id;
$ug_ids[] = $ug_id;
foreach ($forum_auth_row as $forum_id => $auth_options)
{
$forum_id = (int) $forum_id;
$forum_ids[] = $forum_id;
// Check role...
$assigned_role = (isset($auth_roles[$ug_id][$forum_id])) ? (int) $auth_roles[$ug_id][$forum_id] : 0;
$assigned_role = (isset($auth_roles[$ug_id][$forum_id])) ? $auth_roles[$ug_id][$forum_id] : 0;
// If the auth settings differ from the assigned role, then do not set a role...
if ($assigned_role)

View File

@@ -25,8 +25,7 @@ class acp_php_info
function main($id, $mode)
{
global $db, $user, $auth, $template;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $user, $auth, $template, $config;
if ($mode != 'info')
{

View File

@@ -29,17 +29,16 @@ class acp_profile
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $cache;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT);
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
include(PHPBB_ROOT_PATH . 'includes/functions_profile_fields.' . PHP_EXT);
$user->add_lang(array('ucp', 'acp/profile'));
$this->tpl_name = 'acp_profile';
$this->page_title = 'ACP_CUSTOM_PROFILE_FIELDS';
$action = (isset($_POST['create'])) ? 'create' : request_var('action', '');
$action = (request::is_set_post('create')) ? 'create' : request_var('action', '');
$error = array();
$s_hidden_fields = '';
@@ -77,7 +76,7 @@ class acp_profile
FROM ' . PROFILE_LANG_TABLE . '
ORDER BY lang_id';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
// Which languages are available for each item
@@ -120,9 +119,8 @@ class acp_profile
$db->sql_query('DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . " WHERE field_id = $field_id");
$db->sql_query('DELETE FROM ' . PROFILE_LANG_TABLE . " WHERE field_id = $field_id");
switch ($db->sql_layer)
if ($db->dbms_type == 'sqlite')
{
case 'sqlite':
$sql = "SELECT sql
FROM sqlite_master
WHERE type = 'table'
@@ -166,9 +164,9 @@ class acp_profile
$db->sql_query('CREATE TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $new_table_cols . ');');
$db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . PROFILE_FIELDS_DATA_TABLE . '_temp;');
$db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp');
break;
default:
}
else
{
$db->sql_query('ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " DROP COLUMN pf_$field_ident");
}
@@ -206,7 +204,7 @@ class acp_profile
'field_id' => $field_id,
)));
}
break;
case 'activate':
@@ -216,7 +214,7 @@ class acp_profile
{
trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$sql = 'SELECT lang_id
FROM ' . LANG_TABLE . "
WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'";
@@ -253,7 +251,7 @@ class acp_profile
{
trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . "
SET field_active = 0
WHERE field_id = $field_id";
@@ -285,12 +283,12 @@ class acp_profile
case 'create':
case 'edit':
$field_id = request_var('field_id', 0);
$step = request_var('step', 1);
$submit = (isset($_REQUEST['next']) || isset($_REQUEST['prev'])) ? true : false;
$save = (isset($_REQUEST['save'])) ? true : false;
$submit = (request::is_set('next') || request::is_set('prev')) ? true : false;
$save = request::is_set('save');
// The language id of default language
$this->edit_lang_id = $this->lang_defs['iso'][$config['default_lang']];
@@ -354,19 +352,18 @@ class acp_profile
{
// We are adding a new field, define basic params
$lang_options = $field_row = array();
$field_type = request_var('field_type', 0);
if (!$field_type)
{
trigger_error($user->lang['NO_FIELD_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$field_row = array_merge($default_values[$field_type], array(
'field_ident' => str_replace(' ', '_', utf8_clean_string(request_var('field_ident', '', true))),
'field_ident' => utf8_clean_string(request_var('field_ident', '', true)),
'field_required' => 0,
'field_hide' => 0,
'field_show_profile'=> 0,
'field_no_view' => 0,
'field_show_on_reg' => 0,
'lang_name' => utf8_normalize_nfc(request_var('field_ident', '', true)),
@@ -379,7 +376,7 @@ class acp_profile
// $exclude contains the data we gather in each step
$exclude = array(
1 => array('field_ident', 'lang_name', 'lang_explain', 'field_option_none', 'field_show_on_reg', 'field_required', 'field_hide', 'field_show_profile', 'field_no_view'),
1 => array('field_ident', 'lang_name', 'lang_explain', 'field_option', 'field_no_view'),
2 => array('field_length', 'field_maxlen', 'field_minlen', 'field_validation', 'field_novalue', 'field_default_value'),
3 => array('l_lang_name', 'l_lang_explain', 'l_lang_default_value', 'l_lang_options')
);
@@ -401,20 +398,25 @@ class acp_profile
$cp->vars['lang_explain'] = utf8_normalize_nfc(request_var('lang_explain', $field_row['lang_explain'], true));
$cp->vars['lang_default_value'] = utf8_normalize_nfc(request_var('lang_default_value', $field_row['lang_default_value'], true));
// Visibility Options...
$visibility_ary = array(
'field_required',
'field_show_on_reg',
'field_show_profile',
'field_hide',
);
foreach ($visibility_ary as $val)
// Field option...
if (request::is_set('field_option'))
{
$cp->vars[$val] = ($submit || $save) ? request_var($val, 0) : $field_row[$val];
$field_option = request_var('field_option', '');
$cp->vars['field_required'] = ($field_option == 'field_required') ? 1 : 0;
$cp->vars['field_show_on_reg'] = ($field_option == 'field_show_on_reg') ? 1 : 0;
$cp->vars['field_hide'] = ($field_option == 'field_hide') ? 1 : 0;
}
else
{
$cp->vars['field_required'] = $field_row['field_required'];
$cp->vars['field_show_on_reg'] = $field_row['field_show_on_reg'];
$cp->vars['field_hide'] = $field_row['field_hide'];
$field_option = ($field_row['field_required']) ? 'field_required' : (($field_row['field_show_on_reg']) ? 'field_show_on_reg' : (($field_row['field_hide']) ? 'field_hide' : ''));
}
$cp->vars['field_no_view'] = request_var('field_no_view', (int) $field_row['field_no_view']);
$cp->vars['field_no_view'] = request_var('field_no_view', $field_row['field_no_view']);
// A boolean field expects an array as the lang options
if ($field_type == FIELD_BOOL)
@@ -461,7 +463,7 @@ class acp_profile
}
else if ($field_type == FIELD_TEXT && $key == 'field_length')
{
if (isset($_REQUEST['rows']))
if (request::is_set('rows'))
{
$cp->vars['rows'] = request_var('rows', 0);
$cp->vars['columns'] = request_var('columns', 0);
@@ -477,7 +479,7 @@ class acp_profile
else if ($field_type == FIELD_DATE && $key == 'field_default_value')
{
$always_now = request_var('always_now', -1);
if ($always_now == 1 || ($always_now === -1 && $var == 'now'))
{
$now = getdate();
@@ -485,22 +487,33 @@ class acp_profile
$cp->vars['field_default_value_day'] = $now['mday'];
$cp->vars['field_default_value_month'] = $now['mon'];
$cp->vars['field_default_value_year'] = $now['year'];
$var = $_POST['field_default_value'] = 'now';
$var = 'now';
/**
* @todo Do NOT overwrite a request variable.
*/
request::overwrite('field_default_value', $var, request::REQUEST);
request::overwrite('field_default_value', $var, request::POST);
}
else
{
if (isset($_REQUEST['field_default_value_day']))
if (request::is_set('field_default_value_day'))
{
$cp->vars['field_default_value_day'] = request_var('field_default_value_day', 0);
$cp->vars['field_default_value_month'] = request_var('field_default_value_month', 0);
$cp->vars['field_default_value_year'] = request_var('field_default_value_year', 0);
$var = $_POST['field_default_value'] = sprintf('%2d-%2d-%4d', $cp->vars['field_default_value_day'], $cp->vars['field_default_value_month'], $cp->vars['field_default_value_year']);
$var = sprintf('%2d-%2d-%4d', $cp->vars['field_default_value_day'], $cp->vars['field_default_value_month'], $cp->vars['field_default_value_year']);
/**
* @todo Do NOT overwrite a request variable.
*/
request::overwrite('field_default_value', $var, request::REQUEST);
request::overwrite('field_default_value', $var, request::POST);
}
else
{
list($cp->vars['field_default_value_day'], $cp->vars['field_default_value_month'], $cp->vars['field_default_value_year']) = explode('-', $var);
}
}
}
}
/* else if ($field_type == FIELD_BOOL && $key == 'field_default_value')
{
@@ -529,7 +542,7 @@ class acp_profile
}
$db->sql_freeresult($result);
$sql = 'SELECT lang_id, lang_name, lang_explain, lang_default_value
FROM ' . PROFILE_LANG_TABLE . '
WHERE lang_id <> ' . $this->edit_lang_id . "
@@ -546,7 +559,7 @@ class acp_profile
}
$db->sql_freeresult($result);
}
foreach ($exclude[3] as $key)
{
$cp->vars[$key] = utf8_normalize_nfc(request_var($key, array(0 => ''), true));
@@ -565,7 +578,7 @@ class acp_profile
{
$cp->vars[$key][$lang_id] = explode("\n", $options);
}
}
}
@@ -620,7 +633,7 @@ class acp_profile
}
}
$step = (isset($_REQUEST['next'])) ? $step + 1 : ((isset($_REQUEST['prev'])) ? $step - 1 : $step);
$step = (request::is_set('next')) ? $step + 1 : ((request::is_set('prev')) ? $step - 1 : $step);
if (sizeof($error))
{
@@ -640,7 +653,7 @@ class acp_profile
foreach ($key_ary as $key)
{
if ($field_type == FIELD_TEXT && $key == 'field_length' && isset($_REQUEST['rows']))
if ($field_type == FIELD_TEXT && $key == 'field_length' && request::is_set('rows'))
{
$cp->vars['rows'] = request_var('rows', 0);
$cp->vars['columns'] = request_var('columns', 0);
@@ -654,21 +667,21 @@ class acp_profile
{
$_new_key_ary[$key] = 'now';
}
else if (isset($_REQUEST['field_default_value_day']))
else if (request::is_set('field_default_value_day'))
{
$cp->vars['field_default_value_day'] = request_var('field_default_value_day', 0);
$cp->vars['field_default_value_month'] = request_var('field_default_value_month', 0);
$cp->vars['field_default_value_year'] = request_var('field_default_value_year', 0);
$_new_key_ary[$key] = sprintf('%2d-%2d-%4d', $cp->vars['field_default_value_day'], $cp->vars['field_default_value_month'], $cp->vars['field_default_value_year']);
$_new_key_ary[$key] = sprintf('%2d-%2d-%4d', $cp->vars['field_default_value_day'], $cp->vars['field_default_value_month'], $cp->vars['field_default_value_year']);
}
}
else if ($field_type == FIELD_BOOL && $key == 'l_lang_options' && isset($_REQUEST['l_lang_options']))
else if ($field_type == FIELD_BOOL && $key == 'l_lang_options' && request::is_set('l_lang_options'))
{
$_new_key_ary[$key] = utf8_normalize_nfc(request_var($key, array(array('')), true));
}
else
{
if (!isset($_REQUEST[$key]))
if (!request::is_set($key))
{
$var = false;
}
@@ -678,7 +691,11 @@ class acp_profile
}
else
{
$_new_key_ary[$key] = (is_array($_REQUEST[$key])) ? utf8_normalize_nfc(request_var($key, array(''), true)) : utf8_normalize_nfc(request_var($key, '', true));
$_new_key_ary[$key] = utf8_normalize_nfc(request_var($key, array(''), true));
if (!sizeof($_new_key_ary[$key]))
{
$_new_key_ary[$key] = utf8_normalize_nfc(request_var($key, '', true));
}
}
}
}
@@ -705,7 +722,7 @@ class acp_profile
'L_TITLE' => $user->lang['STEP_' . $step . '_TITLE_' . strtoupper($action)],
'L_EXPLAIN' => $user->lang['STEP_' . $step . '_EXPLAIN_' . strtoupper($action)],
'U_ACTION' => $this->u_action . "&amp;action=$action&amp;step=$step",
'U_BACK' => $this->u_action)
);
@@ -715,18 +732,17 @@ class acp_profile
{
// Create basic options - only small differences between field types
case 1:
// Build common create options
$template->assign_vars(array(
'S_STEP_ONE' => true,
'S_FIELD_REQUIRED' => ($cp->vars['field_required']) ? true : false,
'S_SHOW_ON_REG' => ($cp->vars['field_show_on_reg']) ? true : false,
'S_FIELD_HIDE' => ($cp->vars['field_hide']) ? true : false,
'S_SHOW_PROFILE' => ($cp->vars['field_show_profile']) ? true : false,
'S_FIELD_NO_VIEW' => ($cp->vars['field_no_view']) ? true : false,
'L_LANG_SPECIFIC' => sprintf($user->lang['LANG_SPECIFIC_OPTIONS'], $config['default_lang']),
'FIELD_TYPE' => $user->lang['FIELD_' . strtoupper($cp->profile_types[$field_type])],
'FIELD_TYPE' => $user->lang['FIELD_' . strtoupper(custom_profile::$profile_types[$field_type])],
'FIELD_IDENT' => $cp->vars['field_ident'],
'LANG_NAME' => $cp->vars['lang_name'],
'LANG_EXPLAIN' => $cp->vars['lang_explain'])
@@ -739,11 +755,11 @@ class acp_profile
'S_TEXT' => ($field_type == FIELD_TEXT) ? true : false,
'S_STRING' => ($field_type == FIELD_STRING) ? true : false,
'L_DEFAULT_VALUE_EXPLAIN' => $user->lang[strtoupper($cp->profile_types[$field_type]) . '_DEFAULT_VALUE_EXPLAIN'],
'L_DEFAULT_VALUE_EXPLAIN' => $user->lang[strtoupper(custom_profile::$profile_types[$field_type]) . '_DEFAULT_VALUE_EXPLAIN'],
'LANG_DEFAULT_VALUE' => $cp->vars['lang_default_value'])
);
}
if ($field_type == FIELD_BOOL || $field_type == FIELD_DROPDOWN)
{
// Initialize these array elements if we are creating a new field
@@ -766,24 +782,24 @@ class acp_profile
'S_BOOL' => ($field_type == FIELD_BOOL) ? true : false,
'S_DROPDOWN' => ($field_type == FIELD_DROPDOWN) ? true : false,
'L_LANG_OPTIONS_EXPLAIN' => $user->lang[strtoupper($cp->profile_types[$field_type]) . '_ENTRIES_EXPLAIN'],
'L_LANG_OPTIONS_EXPLAIN' => $user->lang[strtoupper(custom_profile::$profile_types[$field_type]) . '_ENTRIES_EXPLAIN'],
'LANG_OPTIONS' => ($field_type == FIELD_DROPDOWN) ? implode("\n", $cp->vars['lang_options']) : '',
'FIRST_LANG_OPTION' => ($field_type == FIELD_BOOL) ? $cp->vars['lang_options'][0] : '',
'SECOND_LANG_OPTION' => ($field_type == FIELD_BOOL) ? $cp->vars['lang_options'][1] : '')
);
}
break;
case 2:
$template->assign_vars(array(
'S_STEP_TWO' => true,
'L_NEXT_STEP' => (sizeof($this->lang_defs['iso']) == 1) ? $user->lang['SAVE'] : $user->lang['PROFILE_LANG_OPTIONS'])
);
// Build options based on profile type
$function = 'get_' . $cp->profile_types[$field_type] . '_options';
$function = 'get_' . custom_profile::$profile_types[$field_type] . '_options';
$options = $cp->$function();
foreach ($options as $num => $option_ary)
@@ -814,7 +830,7 @@ class acp_profile
);
}
}
break;
}
@@ -826,7 +842,7 @@ class acp_profile
break;
}
$sql = 'SELECT *
FROM ' . PROFILE_FIELDS_TABLE . '
ORDER BY field_order';
@@ -848,7 +864,7 @@ class acp_profile
$template->assign_block_vars('fields', array(
'FIELD_IDENT' => $row['field_ident'],
'FIELD_TYPE' => $user->lang['FIELD_' . strtoupper($cp->profile_types[$row['field_type']])],
'FIELD_TYPE' => $user->lang['FIELD_' . strtoupper(custom_profile::$profile_types[$row['field_type']])],
'L_ACTIVATE_DEACTIVATE' => $user->lang[$active_lang],
'U_ACTIVATE_DEACTIVATE' => $this->u_action . "&amp;action=$active_value&amp;field_id=$id",
@@ -870,7 +886,7 @@ class acp_profile
}
$s_select_type = '';
foreach ($cp->profile_types as $key => $value)
foreach (custom_profile::$profile_types as $key => $value)
{
$s_select_type .= '<option value="' . $key . '">' . $user->lang['FIELD_' . strtoupper($value)] . '</option>';
}
@@ -902,14 +918,14 @@ class acp_profile
$languages[$row['lang_id']] = $row['lang_iso'];
}
$db->sql_freeresult($result);
$options = array();
$options['lang_name'] = 'string';
if ($cp->vars['lang_explain'])
{
$options['lang_explain'] = 'text';
}
switch ($field_type)
{
case FIELD_BOOL:
@@ -919,7 +935,7 @@ class acp_profile
case FIELD_DROPDOWN:
$options['lang_options'] = 'optionfield';
break;
case FIELD_TEXT:
case FIELD_STRING:
if ($cp->vars['lang_default_value'])
@@ -928,7 +944,7 @@ class acp_profile
}
break;
}
$lang_options = array();
foreach ($options as $field => $field_type)
@@ -954,7 +970,7 @@ class acp_profile
if ($field == 'lang_options')
{
$var = (!isset($cp->vars['l_lang_options'][$lang_id]) || !is_array($cp->vars['l_lang_options'][$lang_id])) ? $cp->vars['lang_options'] : $cp->vars['l_lang_options'][$lang_id];
switch ($field_type)
{
case 'two_options':
@@ -975,7 +991,7 @@ class acp_profile
);
break;
}
if (isset($user->lang['CP_' . strtoupper($field) . '_EXPLAIN']))
{
$lang_options[$lang_id]['fields'][$field]['EXPLAIN'] = $user->lang['CP_' . strtoupper($field) . '_EXPLAIN'];
@@ -989,7 +1005,7 @@ class acp_profile
'TITLE' => $user->lang['CP_' . strtoupper($field)],
'FIELD' => ($field_type == 'string') ? '<dd><input class="medium" type="text" name="l_' . $field . '[' . $lang_id . ']" value="' . ((isset($value[$lang_id])) ? $value[$lang_id] : $var) . '" /></dd>' : '<dd><textarea name="l_' . $field . '[' . $lang_id . ']" rows="3" cols="80">' . ((isset($value[$lang_id])) ? $value[$lang_id] : $var) . '</textarea></dd>'
);
if (isset($user->lang['CP_' . strtoupper($field) . '_EXPLAIN']))
{
$lang_options[$lang_id]['fields'][$field]['EXPLAIN'] = $user->lang['CP_' . strtoupper($field) . '_EXPLAIN'];
@@ -1037,7 +1053,6 @@ class acp_profile
'field_required' => $cp->vars['field_required'],
'field_show_on_reg' => $cp->vars['field_show_on_reg'],
'field_hide' => $cp->vars['field_hide'],
'field_show_profile' => $cp->vars['field_show_profile'],
'field_no_view' => $cp->vars['field_no_view']
);
@@ -1063,7 +1078,7 @@ class acp_profile
WHERE field_id = $field_id";
$db->sql_query($sql);
}
if ($action == 'create')
{
$field_ident = 'pf_' . $field_ident;
@@ -1080,7 +1095,7 @@ class acp_profile
{
$sql_ary['field_id'] = $field_id;
$sql_ary['lang_id'] = $default_lang_id;
$profile_sql[] = 'INSERT INTO ' . PROFILE_LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
}
else
@@ -1153,7 +1168,7 @@ class acp_profile
AND lang_id = " . (int) $default_lang_id;
$db->sql_query($sql);
}
foreach ($cp->vars['lang_options'] as $option_id => $value)
{
$sql_ary = array(
@@ -1256,7 +1271,7 @@ class acp_profile
$lang_id = $sql['lang_id'];
$option_id = $sql['option_id'];
unset($sql['lang_id'], $sql['field_id'], $sql['option_id']);
$this->update_insert(PROFILE_FIELDS_LANG_TABLE, $sql, array(
'lang_id' => $lang_id,
'field_id' => $field_id,
@@ -1276,7 +1291,7 @@ class acp_profile
$db->sql_query($sql);
}
}
$db->sql_transaction('commit');
if ($action == 'edit')
@@ -1322,7 +1337,7 @@ class acp_profile
if (!$row)
{
$sql_ary = array_merge($where_fields, $sql_ary);
if (sizeof($sql_ary))
{
$db->sql_query("INSERT INTO $table " . $db->sql_build_array('INSERT', $sql_ary));
@@ -1346,11 +1361,9 @@ class acp_profile
{
global $db;
switch ($db->sql_layer)
switch ($db->dbms_type)
{
case 'mysql':
case 'mysql4':
case 'mysqli':
// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
$sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD `$field_ident` ";
@@ -1374,7 +1387,7 @@ class acp_profile
case FIELD_BOOL:
$sql .= 'TINYINT(2) ';
break;
case FIELD_DROPDOWN:
$sql .= 'MEDIUMINT(8) ';
break;
@@ -1467,7 +1480,6 @@ class acp_profile
break;
case 'mssql':
case 'mssql_odbc':
// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
$sql = 'ALTER TABLE [' . PROFILE_FIELDS_DATA_TABLE . "] ADD [$field_ident] ";
@@ -1604,10 +1616,46 @@ class acp_profile
}
break;
case 'db2':
// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
$sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD \"$field_ident\" ";
switch ($field_type)
{
case FIELD_STRING:
$sql .= ' VARCHAR(255) ';
break;
case FIELD_DATE:
$sql .= 'VARCHAR(10) ';
break;
case FIELD_TEXT:
$sql .= "varchar(32672)";
// ADD {$field_ident}_bbcode_uid VARCHAR2(5) NOT NULL,
// ADD {$field_ident}_bbcode_bitfield NUMBER(11) UNSIGNED";
break;
case FIELD_BOOL:
$sql .= 'smallint ';
break;
case FIELD_DROPDOWN:
$sql .= 'integer ';
break;
case FIELD_INT:
$sql .= 'float ';
break;
}
break;
}
return $sql;
}
}
?>
?>

View File

@@ -25,10 +25,10 @@ class acp_prune
function main($id, $mode)
{
global $user, $phpEx, $phpbb_admin_path, $phpbb_root_path;
global $user;
$user->add_lang('acp/prune');
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
switch ($mode)
{
@@ -51,12 +51,11 @@ class acp_prune
*/
function prune_forums($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $user, $auth, $template, $cache, $config;
$all_forums = request_var('all_forums', 0);
$forum_id = request_var('f', array(0));
$submit = (isset($_POST['submit'])) ? true : false;
$submit = request::is_set_post('submit');
if ($all_forums)
{
@@ -228,12 +227,11 @@ class acp_prune
*/
function prune_users($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $user, $auth, $template, $cache, $config;
$user->add_lang('memberlist');
$prune = (isset($_POST['prune'])) ? true : false;
$prune = request::is_set_post('prune');
if ($prune)
{
@@ -300,8 +298,8 @@ class acp_prune
{
$template->assign_block_vars('users', array(
'USERNAME' => $usernames[$user_id],
'U_PROFILE' => append_sid($phpbb_root_path . 'memberlist.' . $phpEx, 'mode=viewprofile&amp;u=' . $user_id),
'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&amp;mode=overview&amp;u=' . $user_id, true, $user->session_id) : '',
'U_PROFILE' => append_sid('memberlist', 'mode=viewprofile&amp;u=' . $user_id),
'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=users&amp;mode=overview&amp;u=' . $user_id, true, $user->session_id) : '',
));
}
@@ -358,7 +356,7 @@ class acp_prune
'S_JOINED_OPTIONS' => $s_find_join_time,
'S_ACTIVE_OPTIONS' => $s_find_active_time,
'S_COUNT_OPTIONS' => $s_find_count,
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=acp_prune&amp;field=users'),
'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&amp;form=acp_prune&amp;field=users'),
));
}

View File

@@ -25,15 +25,14 @@ class acp_ranks
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $user, $auth, $template, $cache, $config;
$user->add_lang('acp/posting');
// Set up general vars
$action = request_var('action', '');
$action = (isset($_POST['add'])) ? 'add' : $action;
$action = (isset($_POST['save'])) ? 'save' : $action;
$action = (request::is_set_post('add')) ? 'add' : $action;
$action = (request::is_set_post('save')) ? 'save' : $action;
$rank_id = request_var('id', 0);
$this->tpl_name = 'acp_ranks';
@@ -157,7 +156,7 @@ class acp_ranks
}
$db->sql_freeresult($result);
$imglist = filelist($phpbb_root_path . $config['ranks_path'], '');
$imglist = filelist(PHPBB_ROOT_PATH . $config['ranks_path'], '');
$edit_img = $filename_list = '';
foreach ($imglist as $path => $img_ary)
@@ -196,12 +195,12 @@ class acp_ranks
$template->assign_vars(array(
'S_EDIT' => true,
'U_BACK' => $this->u_action,
'RANKS_PATH' => $phpbb_root_path . $config['ranks_path'],
'RANKS_PATH' => PHPBB_ROOT_PATH . $config['ranks_path'],
'U_ACTION' => $this->u_action . '&amp;id=' . $rank_id,
'RANK_TITLE' => (isset($ranks['rank_title'])) ? $ranks['rank_title'] : '',
'S_FILENAME_LIST' => $filename_list,
'RANK_IMAGE' => ($edit_img) ? $phpbb_root_path . $config['ranks_path'] . '/' . $edit_img : $phpbb_admin_path . 'images/spacer.gif',
'RANK_IMAGE' => ($edit_img) ? PHPBB_ROOT_PATH . $config['ranks_path'] . '/' . $edit_img : PHPBB_ADMIN_PATH . 'images/spacer.gif',
'S_SPECIAL_RANK' => (!isset($ranks['rank_special']) || $ranks['rank_special']) ? true : false,
'MIN_POSTS' => (isset($ranks['rank_min']) && !$ranks['rank_special']) ? $ranks['rank_min'] : 0)
);
@@ -227,7 +226,7 @@ class acp_ranks
'S_RANK_IMAGE' => ($row['rank_image']) ? true : false,
'S_SPECIAL_RANK' => ($row['rank_special']) ? true : false,
'RANK_IMAGE' => $phpbb_root_path . $config['ranks_path'] . '/' . $row['rank_image'],
'RANK_IMAGE' => PHPBB_ROOT_PATH . $config['ranks_path'] . '/' . $row['rank_image'],
'RANK_TITLE' => $row['rank_title'],
'MIN_POSTS' => $row['rank_min'],

View File

@@ -25,14 +25,13 @@ class acp_reasons
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $user, $auth, $template, $cache, $config;
$user->add_lang(array('mcp', 'acp/posting'));
// Set up general vars
$action = request_var('action', '');
$submit = (isset($_POST['submit'])) ? true : false;
$submit = request::is_set_post('submit');
$reason_id = request_var('id', 0);
$this->tpl_name = 'acp_reasons';
@@ -211,53 +210,22 @@ class acp_reasons
// Let the deletion be confirmed...
if (confirm_box(true))
{
$sql = 'SELECT reason_id
$sql = 'SELECT reason_id, report_text
FROM ' . REPORTS_REASONS_TABLE . "
WHERE LOWER(reason_title) = 'other'";
$result = $db->sql_query($sql);
$other_reason_id = (int) $db->sql_fetchfield('reason_id');
$row = $db->sql_fetchrow($result);
$other_reason_id = (int) $row['reason_id'];
$report_text = $row['report_text'];
$db->sql_freeresult($result);
switch ($db->sql_layer)
{
// The ugly one!
case 'mysqli':
case 'mysql4':
case 'mysql':
// Change the reports using this reason to 'other'
$sql = 'UPDATE ' . REPORTS_TABLE . '
SET reason_id = ' . $other_reason_id . ", report_text = CONCAT('" . $db->sql_escape($reason_row['reason_description']) . "\n\n', report_text)
WHERE reason_id = $reason_id";
break;
$report_text .= $reason_row['reason_description'] . "\n\n";
// Standard? What's that?
case 'mssql':
case 'mssql_odbc':
// Change the reports using this reason to 'other'
$sql = "DECLARE @ptrval binary(16)
SELECT @ptrval = TEXTPTR(report_text)
FROM " . REPORTS_TABLE . "
WHERE reason_id = " . $reason_id . "
UPDATETEXT " . REPORTS_TABLE . ".report_text @ptrval 0 0 '" . $db->sql_escape($reason_row['reason_description']) . "\n\n'
UPDATE " . REPORTS_TABLE . '
SET reason_id = ' . $other_reason_id . "
WHERE reason_id = $reason_id";
break;
// Teh standard
case 'postgres':
case 'oracle':
case 'firebird':
case 'sqlite':
// Change the reports using this reason to 'other'
$sql = 'UPDATE ' . REPORTS_TABLE . '
SET reason_id = ' . $other_reason_id . ", report_text = '" . $db->sql_escape($reason_row['reason_description']) . "\n\n' || report_text
WHERE reason_id = $reason_id";
break;
}
$sql = 'UPDATE ' . REPORTS_TABLE . '
SET reason_id = ' . $other_reason_id . ", report_text = '" . $db->sql_escape($report_text) . "'
WHERE reason_id = $reason_id";
$db->sql_query($sql);
$db->sql_query('DELETE FROM ' . REPORTS_REASONS_TABLE . ' WHERE reason_id = ' . $reason_id);

View File

@@ -50,10 +50,9 @@ class acp_search
function settings($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $user, $auth, $template, $cache, $config;
$submit = (isset($_POST['submit'])) ? true : false;
$submit = request::is_set_post('submit');
$search_types = $this->get_search_types();
@@ -100,7 +99,7 @@ class acp_search
unset($search);
unset($error);
$cfg_array = (isset($_REQUEST['config'])) ? request_var('config', array('' => ''), true) : array();
$cfg_array = request_var('config', array('' => ''), true);
$updated = request_var('updated', false);
foreach ($settings as $config_name => $var_type)
@@ -159,7 +158,7 @@ class acp_search
{
add_log('admin', 'LOG_CONFIG_SEARCH');
}
$extra_message = '<br />' . $user->lang['SWITCHED_SEARCH_BACKEND'] . '<br /><a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=search&amp;mode=index') . '">&raquo; ' . $user->lang['GO_TO_SEARCH_INDEX'] . '</a>';
$extra_message = '<br />' . $user->lang['SWITCHED_SEARCH_BACKEND'] . '<br /><a href="' . append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=search&amp;mode=index') . '">&raquo; ' . $user->lang['GO_TO_SEARCH_INDEX'] . '</a>';
}
else
{
@@ -227,12 +226,11 @@ class acp_search
function index($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $user, $auth, $template, $cache, $config;
if (isset($_REQUEST['action']) && is_array($_REQUEST['action']))
$action = request_var('action', array('' => false));
if (sizeof($action))
{
$action = request_var('action', array('' => false));
$action = key($action);
}
else
@@ -241,7 +239,7 @@ class acp_search
}
$this->state = explode(',', $config['search_indexing_state']);
if (isset($_POST['cancel']))
if (request::is_set_post('cancel'))
{
$action = '';
$this->state = array();
@@ -297,7 +295,7 @@ class acp_search
if (method_exists($this->search, 'delete_index'))
{
// pass a reference to myself so the $search object can make use of save_state() and attributes
if ($error = $this->search->delete_index($this, append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=$mode&action=delete", false)))
if ($error = $this->search->delete_index($this, append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=$id&mode=$mode&action=delete", false)))
{
$this->state = array('');
$this->save_state();
@@ -360,7 +358,7 @@ class acp_search
if (method_exists($this->search, 'create_index'))
{
// pass a reference to acp_search so the $search object can make use of save_state() and attributes
if ($error = $this->search->create_index($this, append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=$mode&action=create", false)))
if ($error = $this->search->create_index($this, append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=$id&mode=$mode&action=create", false)))
{
$this->state = array('');
$this->save_state();
@@ -500,8 +498,8 @@ class acp_search
$template->assign_vars(array(
'S_INDEX' => true,
'U_ACTION' => $this->u_action,
'U_PROGRESS_BAR' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&amp;mode=$mode&amp;action=progress_bar"),
'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&amp;mode=$mode&amp;action=progress_bar")),
'U_PROGRESS_BAR' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=$id&amp;mode=$mode&amp;action=progress_bar"),
'UA_PROGRESS_BAR' => addslashes(append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=$id&amp;mode=$mode&amp;action=progress_bar")),
));
if (isset($this->state[1]))
@@ -546,19 +544,17 @@ class acp_search
function get_search_types()
{
global $phpbb_root_path, $phpEx;
$search_types = array();
$dp = @opendir($phpbb_root_path . 'includes/search');
$dp = @opendir(PHPBB_ROOT_PATH . 'includes/search');
if ($dp)
{
while (($file = readdir($dp)) !== false)
{
if ((preg_match('#\.' . $phpEx . '$#', $file)) && ($file != "search.$phpEx"))
if ((preg_match('#\.' . PHP_EXT . '$#', $file)) && ($file != 'search.' . PHP_EXT))
{
$search_types[] = preg_replace('#^(.*?)\.' . $phpEx . '$#', '\1', $file);
$search_types[] = preg_replace('#^(.*?)\.' . PHP_EXT . '$#', '\1', $file);
}
}
closedir($dp);
@@ -601,15 +597,15 @@ class acp_search
*/
function init_search($type, &$search, &$error)
{
global $phpbb_root_path, $phpEx, $user;
global $user;
if (!preg_match('#^\w+$#', $type) || !file_exists("{$phpbb_root_path}includes/search/$type.$phpEx"))
if (!preg_match('#^\w+$#', $type) || !file_exists(PHPBB_ROOT_PATH . "includes/search/$type." . PHP_EXT))
{
$error = $user->lang['NO_SUCH_SEARCH_MODULE'];
return $error;
}
include_once("{$phpbb_root_path}includes/search/$type.$phpEx");
include_once(PHPBB_ROOT_PATH . "includes/search/$type." . PHP_EXT);
if (!class_exists($type))
{

File diff suppressed because it is too large Load Diff

View File

@@ -26,7 +26,6 @@ class acp_update
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $cache;
global $phpbb_root_path, $phpbb_admin_path, $phpEx;
$user->add_lang('install');
@@ -48,7 +47,7 @@ class acp_update
$latest_version = trim($info[0]);
$announcement_url = trim($info[1]);
$update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update');
$update_link = append_sid('install/index', 'mode=update');
// Determine automatic update...
$sql = 'SELECT config_value

View File

@@ -24,15 +24,14 @@ class acp_users
var $u_action;
var $p_master;
function acp_users(&$p_master)
function __construct(&$p_master)
{
$this->p_master = &$p_master;
}
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $cache;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads;
global $config, $db, $user, $auth, $template, $cache, $file_uploads;
$user->add_lang(array('posting', 'ucp', 'acp/users'));
$this->tpl_name = 'acp_users';
@@ -43,7 +42,7 @@ class acp_users
$user_id = request_var('u', 0);
$action = request_var('action', '');
$submit = (isset($_POST['update']) && !isset($_POST['cancel'])) ? true : false;
$submit = (request::is_set_post('update') && !request::is_set_post('cancel')) ? true : false;
$form_name = 'acp_users';
add_form_key($form_name);
@@ -51,7 +50,7 @@ class acp_users
// Whois (special case)
if ($action == 'whois')
{
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
$this->page_title = 'WHOIS';
$this->tpl_name = 'simple_body';
@@ -78,7 +77,7 @@ class acp_users
'ANONYMOUS_USER_ID' => ANONYMOUS,
'S_SELECT_USER' => true,
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=select_user&amp;field=username&amp;select_single=true'),
'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&amp;form=select_user&amp;field=username&amp;select_single=true'),
));
return;
@@ -146,7 +145,7 @@ class acp_users
$template->assign_vars(array(
'U_BACK' => $this->u_action,
'U_MODE_SELECT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&amp;u=$user_id"),
'U_MODE_SELECT' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=$id&amp;u=$user_id"),
'U_ACTION' => $this->u_action . '&amp;u=' . $user_id,
'S_FORM_OPTIONS' => $s_form_options,
'MANAGED_USERNAME' => $user_row['username'])
@@ -162,7 +161,7 @@ class acp_users
{
case 'overview':
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
$user->add_lang('acp/ban');
@@ -303,7 +302,7 @@ class acp_users
if ($config['email_enable'])
{
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT);
$server_url = generate_board_url();
@@ -347,7 +346,7 @@ class acp_users
$messenger->assign_vars(array(
'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])),
'USERNAME' => htmlspecialchars_decode($user_row['username']),
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k=$user_actkey")
'U_ACTIVATE' => "$server_url/ucp." . PHP_EXT . "?mode=activate&u={$user_row['user_id']}&k=$user_actkey")
);
$messenger->send(NOTIFY_EMAIL);
@@ -775,7 +774,7 @@ class acp_users
{
$sql_ary += array(
'user_email' => $update_email,
'user_email_hash' => crc32($update_email) . strlen($update_email)
'user_email_hash' => hexdec(crc32($update_email) . strlen($update_email))
);
add_log('user', $user_id, 'LOG_USER_UPDATE_EMAIL', $user_row['username'], $user_row['user_email'], $update_email);
@@ -915,9 +914,9 @@ class acp_users
'U_SHOW_IP' => $this->u_action . "&amp;u=$user_id&amp;ip=" . (($ip == 'ip') ? 'hostname' : 'ip'),
'U_WHOIS' => $this->u_action . "&amp;action=whois&amp;user_ip={$user_row['user_ip']}",
'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '',
'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid('mcp', 'i=queue', true, $user->session_id) : '',
'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_row['user_id']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&amp;u={$user_row['user_id']}") : '',
'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_row['user_id']) ? append_sid('ucp', "mode=switch_perm&amp;u={$user_row['user_id']}") : '',
'POSTS_IN_QUEUE' => $user_row['posts_in_queue'],
'USER' => $user_row['username'],
@@ -938,8 +937,8 @@ class acp_users
// Set up general vars
$start = request_var('start', 0);
$deletemark = (isset($_POST['delmarked'])) ? true : false;
$deleteall = (isset($_POST['delall'])) ? true : false;
$deletemark = request::is_set_post('delmarked');
$deleteall = request::is_set_post('delall');
$marked = request_var('mark', array(0));
$message = utf8_normalize_nfc(request_var('message', '', true));
@@ -1036,8 +1035,8 @@ class acp_users
case 'profile':
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
include(PHPBB_ROOT_PATH . 'includes/functions_profile_fields.' . PHP_EXT);
$cp = new custom_profile();
@@ -1137,24 +1136,22 @@ class acp_users
// Update Custom Fields
if (sizeof($cp_data))
{
switch ($db->sql_layer)
switch ($db->dbms_type)
{
case 'oracle':
case 'firebird':
case 'postgres':
case 'db2':
$right_delim = $left_delim = '"';
break;
case 'sqlite':
case 'mssql':
case 'mssql_odbc':
$right_delim = ']';
$left_delim = '[';
break;
case 'mysql':
case 'mysql4':
case 'mysqli':
$right_delim = $left_delim = '`';
break;
}
@@ -1241,7 +1238,7 @@ class acp_users
case 'prefs':
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
$data = array(
'dateformat' => utf8_normalize_nfc(request_var('dateformat', $user_row['user_dateformat'], true)),
@@ -1452,10 +1449,10 @@ class acp_users
case 'avatar':
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT);
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;
$can_upload = (file_exists(PHPBB_ROOT_PATH . $config['avatar_path']) && @is_writable(PHPBB_ROOT_PATH . $config['avatar_path']) && $file_uploads) ? true : false;
if ($submit)
{
@@ -1475,9 +1472,9 @@ class acp_users
}
// Generate users avatar
$avatar_img = ($user_row['user_avatar']) ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']) : '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />';
$avatar_img = ($user_row['user_avatar']) ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']) : '<img src="' . PHPBB_ADMIN_PATH . 'images/no_avatar.gif" alt="" />';
$display_gallery = (isset($_POST['display_gallery'])) ? true : false;
$display_gallery = request::is_set_post('display_gallery');
$avatar_select = basename(request_var('avatar_select', ''));
$category = basename(request_var('category', ''));
@@ -1546,19 +1543,19 @@ class acp_users
case 'sig':
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT);
include_once(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT);
$enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', !$user->optionget('bbcode'))) ? false : true) : false;
$enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', !$user->optionget('smilies'))) ? false : true) : false;
$enable_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false;
$signature = utf8_normalize_nfc(request_var('signature', (string) $user_row['user_sig'], true));
$preview = (isset($_POST['preview'])) ? true : false;
$preview = request::is_set_post('preview');
if ($submit || $preview)
{
include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/message_parser.' . PHP_EXT);
$message_parser = new parse_message($signature);
@@ -1616,7 +1613,7 @@ class acp_users
'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '',
'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '',
'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'),
'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>'),
'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
@@ -1639,7 +1636,7 @@ class acp_users
case 'attach':
$start = request_var('start', 0);
$deletemark = (isset($_POST['delmarked'])) ? true : false;
$deletemark = request::is_set_post('delmarked');
$marked = request_var('mark', array(0));
// Sort keys
@@ -1748,11 +1745,11 @@ class acp_users
{
if ($row['in_message'])
{
$view_topic = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&amp;p={$row['post_msg_id']}");
$view_topic = append_sid('ucp', "i=pm&amp;p={$row['post_msg_id']}");
}
else
{
$view_topic = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_id']}&amp;p={$row['post_msg_id']}") . '#p' . $row['post_msg_id'];
$view_topic = append_sid('viewtopic', "t={$row['topic_id']}&amp;p={$row['post_msg_id']}") . '#p' . $row['post_msg_id'];
}
$template->assign_block_vars('attach', array(
@@ -1770,7 +1767,7 @@ class acp_users
'S_IN_MESSAGE' => $row['in_message'],
'U_DOWNLOAD' => append_sid("{$phpbb_root_path}download/file.$phpEx", 'mode=view&amp;id=' . $row['attach_id']),
'U_DOWNLOAD' => append_sid('download/file', 'mode=view&amp;id=' . $row['attach_id']),
'U_VIEW_TOPIC' => $view_topic)
);
}
@@ -1789,7 +1786,7 @@ class acp_users
case 'groups':
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
$user->add_lang(array('groups', 'acp/groups'));
$group_id = request_var('g', 0);
@@ -1947,7 +1944,7 @@ class acp_users
foreach ($data_ary as $data)
{
$template->assign_block_vars('group', array(
'U_EDIT_GROUP' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=groups&amp;mode=manage&amp;action=edit&amp;u=$user_id&amp;g={$data['group_id']}&amp;back_link=acp_users_groups"),
'U_EDIT_GROUP' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=groups&amp;mode=manage&amp;action=edit&amp;u=$user_id&amp;g={$data['group_id']}&amp;back_link=acp_users_groups"),
'U_DEFAULT' => $this->u_action . "&amp;action=default&amp;u=$user_id&amp;g=" . $data['group_id'],
'U_DEMOTE_PROMOTE' => $this->u_action . '&amp;action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&amp;u=$user_id&amp;g=" . $data['group_id'],
'U_DELETE' => $this->u_action . "&amp;action=delete&amp;u=$user_id&amp;g=" . $data['group_id'],
@@ -1971,7 +1968,7 @@ class acp_users
case 'perm':
include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/acp/auth.' . PHP_EXT);
$auth_admin = new auth_admin();
@@ -2029,8 +2026,8 @@ class acp_users
'S_FORUM_OPTIONS' => $s_forum_options,
'U_ACTION' => $this->u_action . '&amp;u=' . $user_id,
'U_USER_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx" ,'i=permissions&amp;mode=setting_user_global&amp;user_id[]=' . $user_id),
'U_USER_FORUM_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions&amp;mode=setting_user_local&amp;user_id[]=' . $user_id))
'U_USER_PERMISSIONS' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=permissions&amp;mode=setting_user_global&amp;user_id[]=' . $user_id),
'U_USER_FORUM_PERMISSIONS' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=permissions&amp;mode=setting_user_local&amp;user_id[]=' . $user_id))
);
break;

View File

@@ -26,14 +26,13 @@ class acp_words
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $user, $auth, $template, $cache, $config;
$user->add_lang('acp/posting');
// Set up general vars
$action = request_var('action', '');
$action = (isset($_POST['add'])) ? 'add' : ((isset($_POST['save'])) ? 'save' : $action);
$action = (request::is_set_post('add')) ? 'add' : ((request::is_set_post('save')) ? 'save' : $action);
$s_hidden_fields = '';
$word_info = array();

View File

@@ -25,7 +25,7 @@ class auth_admin extends auth
/**
* Init auth settings
*/
function auth_admin()
function __construct()
{
global $db, $cache;
@@ -71,7 +71,7 @@ class auth_admin extends auth
* @param local|global $scope the scope defines the permission scope. If local, a forum_id is additionally required
* @param ACL_NEVER|ACL_NO|ACL_YES $acl_fill defines the mode those permissions not set are getting filled with
*/
function get_mask($mode, $user_id = false, $group_id = false, $forum_id = false, $auth_option = false, $scope = false, $acl_fill = ACL_NEVER)
public function get_mask($mode, $user_id = false, $group_id = false, $forum_id = false, $auth_option = false, $scope = false, $acl_fill = ACL_NEVER)
{
global $db, $user;
@@ -222,7 +222,7 @@ class auth_admin extends auth
* Get permission mask for roles
* This function only supports getting masks for one role
*/
function get_role_mask($role_id)
public function get_role_mask($role_id)
{
global $db;
@@ -260,9 +260,9 @@ class auth_admin extends auth
/**
* Display permission mask (assign to template)
*/
function display_mask($mode, $permission_type, &$hold_ary, $user_mode = 'user', $local = false, $group_display = true)
public function display_mask($mode, $permission_type, array $hold_ary, $user_mode = 'user', $local = false, $group_display = true)
{
global $template, $user, $db, $phpbb_root_path, $phpEx;
global $template, $user, $db;
// Define names for template loops, might be able to be set
$tpl_pmask = 'p_mask';
@@ -438,7 +438,7 @@ class auth_admin extends auth
foreach ($hold_ary as $forum_id => $forum_array)
{
$content_array = $categories = array();
$this->build_permission_array($hold_ary[$forum_id], $content_array, $categories, array_keys($ug_names_ary));
self::build_permission_array($hold_ary[$forum_id], $content_array, $categories, array_keys($ug_names_ary));
$template->assign_block_vars($tpl_pmask, array(
'NAME' => ($forum_id == 0) ? $forum_names_ary[0] : $forum_names_ary[$forum_id]['forum_name'],
@@ -506,7 +506,7 @@ class auth_admin extends auth
'FORUM_ID' => $forum_id)
);
$this->assign_cat_array($ug_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, $show_trace, ($mode == 'view'));
self::assign_cat_array($ug_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, $show_trace, ($mode == 'view'));
unset($content_array[$ug_id]);
}
@@ -524,7 +524,7 @@ class auth_admin extends auth
}
$content_array = $categories = array();
$this->build_permission_array($hold_ary[$ug_id], $content_array, $categories, array_keys($forum_names_ary));
self::build_permission_array($hold_ary[$ug_id], $content_array, $categories, array_keys($forum_names_ary));
$template->assign_block_vars($tpl_pmask, array(
'NAME' => $ug_name,
@@ -593,7 +593,7 @@ class auth_admin extends auth
'FORUM_ID' => $forum_id)
);
$this->assign_cat_array($forum_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, $show_trace, ($mode == 'view'));
self::assign_cat_array($forum_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, $show_trace, ($mode == 'view'));
}
unset($hold_ary[$ug_id], $ug_names_ary[$ug_id]);
@@ -604,9 +604,9 @@ class auth_admin extends auth
/**
* Display permission mask for roles
*/
function display_role_mask(&$hold_ary)
public function display_role_mask(array $hold_ary)
{
global $db, $template, $user, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $template, $user;
if (!sizeof($hold_ary))
{
@@ -650,7 +650,7 @@ class auth_admin extends auth
$template->assign_block_vars('role_mask.users', array(
'USER_ID' => $row['user_id'],
'USERNAME' => $row['username'],
'U_PROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=viewprofile&amp;u={$row['user_id']}"))
'U_PROFILE' => append_sid('memberlist', "mode=viewprofile&amp;u={$row['user_id']}"))
);
}
$db->sql_freeresult($result);
@@ -669,7 +669,7 @@ class auth_admin extends auth
$template->assign_block_vars('role_mask.groups', array(
'GROUP_ID' => $row['group_id'],
'GROUP_NAME' => ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'],
'U_PROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=group&amp;g={$row['group_id']}"))
'U_PROFILE' => append_sid('memberlist', "mode=group&amp;g={$row['group_id']}"))
);
}
$db->sql_freeresult($result);
@@ -685,15 +685,10 @@ class auth_admin extends auth
* 'global' => array('optionA', 'optionB', ...)
* );
*/
function acl_add_option($options)
public function acl_add_option(array $options)
{
global $db, $cache;
if (!is_array($options))
{
return false;
}
$cur_options = array();
$sql = 'SELECT auth_option, is_global, is_local
@@ -767,7 +762,7 @@ class auth_admin extends auth
// Because we just changed the options and also purged the options cache, we instantly update/regenerate it for later calls to succeed.
$this->acl_options = array();
$this->auth_admin();
$this->__construct();
return true;
}
@@ -775,7 +770,7 @@ class auth_admin extends auth
/**
* Set a user or group ACL record
*/
function acl_set($ug_type, $forum_id, $ug_id, $auth, $role_id = 0, $clear_prefetch = true)
public function acl_set($ug_type, $forum_id, $ug_id, $auth, $role_id = 0, $clear_prefetch = true)
{
global $db;
@@ -908,7 +903,7 @@ class auth_admin extends auth
/**
* Set a role-specific ACL record
*/
function acl_set_role($role_id, $auth)
public function acl_set_role($role_id, $auth)
{
global $db;
@@ -971,7 +966,7 @@ class auth_admin extends auth
/**
* Remove local permission
*/
function acl_delete($mode, $ug_id = false, $forum_id = false, $permission_type = false)
public function acl_delete($mode, $ug_id = false, $forum_id = false, $permission_type = false)
{
global $db;
@@ -1079,9 +1074,9 @@ class auth_admin extends auth
* Assign category to template
* used by display_mask()
*/
function assign_cat_array(&$category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id, $show_trace = false, $s_view)
private static function assign_cat_array(array $category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id, $show_trace = false, $s_view)
{
global $template, $user, $phpbb_admin_path, $phpEx;
global $template, $user;
@reset($category_array);
while (list($cat, $cat_array) = each($category_array))
@@ -1123,8 +1118,8 @@ class auth_admin extends auth
'FIELD_NAME' => $permission,
'S_FIELD_NAME' => 'setting[' . $ug_id . '][' . $forum_id . '][' . $permission . ']',
'U_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&amp;mode=trace&amp;u=$ug_id&amp;f=$forum_id&amp;auth=$permission") : '',
'UA_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission", false) : '',
'U_TRACE' => ($show_trace) ? append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=permissions&amp;mode=trace&amp;u=$ug_id&amp;f=$forum_id&amp;auth=$permission") : '',
'UA_TRACE' => ($show_trace) ? append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission", false) : '',
'PERMISSION' => $user->lang['acl_' . $permission]['lang'])
);
@@ -1141,8 +1136,8 @@ class auth_admin extends auth
'FIELD_NAME' => $permission,
'S_FIELD_NAME' => 'setting[' . $ug_id . '][' . $forum_id . '][' . $permission . ']',
'U_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&amp;mode=trace&amp;u=$ug_id&amp;f=$forum_id&amp;auth=$permission") : '',
'UA_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission", false) : '',
'U_TRACE' => ($show_trace) ? append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=permissions&amp;mode=trace&amp;u=$ug_id&amp;f=$forum_id&amp;auth=$permission") : '',
'UA_TRACE' => ($show_trace) ? append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission", false) : '',
'PERMISSION' => $user->lang['acl_' . $permission]['lang'])
);
@@ -1155,7 +1150,7 @@ class auth_admin extends auth
* Building content array from permission rows with explicit key ordering
* used by display_mask()
*/
function build_permission_array(&$permission_row, &$content_array, &$categories, $key_sort_array)
public static function build_permission_array(array $permission_row, array &$content_array, array &$categories, array $key_sort_array)
{
global $user;
@@ -1220,7 +1215,7 @@ class auth_admin extends auth
* "more" permissions by this.
* Admin permissions will not be copied.
*/
function ghost_permissions($from_user_id, $to_user_id)
public function ghost_permissions($from_user_id, $to_user_id)
{
global $db;

View File

@@ -22,15 +22,15 @@ if (!defined('IN_PHPBB'))
*/
class auth
{
var $acl = array();
var $cache = array();
var $acl_options = array();
var $acl_forum_ids = false;
private $acl = array();
private $cache = array();
public $acl_options = array();
private $acl_forum_ids = false;
/**
* Init permissions
*/
function acl(&$userdata)
function acl(array &$userdata)
{
global $db, $cache;
@@ -107,7 +107,7 @@ class auth
* Fill ACL array with relevant bitstrings from user_permissions column
* @access private
*/
function _fill_acl($user_permissions)
private function _fill_acl($user_permissions)
{
$this->acl = array();
$user_permissions = explode("\n", $user_permissions);
@@ -140,7 +140,7 @@ class auth
* If a forum id is specified the local option will be combined with a global option if one exist.
* If a forum id is not specified, only the global option will be checked.
*/
function acl_get($opt, $f = 0)
public function acl_get($opt, $f = 0)
{
$negate = false;
@@ -150,6 +150,7 @@ class auth
$opt = substr($opt, 1);
}
// @todo: use the ref technique to reduce opcode generation
if (!isset($this->cache[$f][$opt]))
{
// We combine the global/local option with an OR because some options are global and local.
@@ -177,16 +178,16 @@ class auth
}
// Founder always has all global options set to true...
return ($negate) ? !$this->cache[$f][$opt] : $this->cache[$f][$opt];
return $negate xor $this->cache[$f][$opt];
}
/**
* Get forums with the specified permission setting
* if the option is prefixed with !, then the result becomes nagated
* if the option is prefixed with !, then the result becomes negated
*
* @param bool $clean set to true if only values needs to be returned which are set/unset
*/
function acl_getf($opt, $clean = false)
public function acl_getf($opt, $clean = false)
{
$acl_f = array();
$negate = false;
@@ -236,14 +237,11 @@ class auth
if (!$clean)
{
$acl_f[$f][$opt] = ($negate) ? !$allowed : $allowed;
$acl_f[$f][$opt] = $negate xor $allowed;
}
else
else if ($negate xor $allowed)
{
if (($negate && !$allowed) || (!$negate && $allowed))
{
$acl_f[$f][$opt] = 1;
}
$acl_f[$f][$opt] = 1;
}
}
}
@@ -267,7 +265,7 @@ class auth
* If global option is checked it returns the global state (same as acl_get($opt))
* Local option has precedence...
*/
function acl_getf_global($opt)
public function acl_getf_global($opt)
{
if (is_array($opt))
{
@@ -311,7 +309,7 @@ class auth
/**
* Get permission settings (more than one)
*/
function acl_gets()
public function acl_gets()
{
$args = func_get_args();
$f = array_pop($args);
@@ -340,7 +338,7 @@ class auth
/**
* Get permission listing based on user_id/options/forum_ids
*/
function acl_get_list($user_id = false, $opts = false, $forum_id = false)
public function acl_get_list($user_id = false, $opts = false, $forum_id = false)
{
if ($user_id !== false && !is_array($user_id) && $opts === false && $forum_id === false)
{
@@ -372,7 +370,7 @@ class auth
/**
* Cache data to user_permissions row
*/
function acl_cache(&$userdata)
public function acl_cache(array &$userdata)
{
global $db;
@@ -414,7 +412,7 @@ class auth
/**
* Build bitstring from permission set
*/
function build_bitstring(&$hold_ary)
protected function build_bitstring(&$hold_ary)
{
$hold_str = '';
@@ -475,7 +473,7 @@ class auth
/**
* Clear one or all users cached permission settings
*/
function acl_clear_prefetch($user_id = false)
public function acl_clear_prefetch($user_id = false)
{
global $db, $cache;
@@ -521,8 +519,9 @@ class auth
/**
* Get assigned roles
* @todo: protected or public?
*/
function acl_role_data($user_type, $role_type, $ug_id = false, $forum_id = false)
public function acl_role_data($user_type, $role_type, $ug_id = false, $forum_id = false)
{
global $db;
@@ -554,8 +553,9 @@ class auth
/**
* Get raw acl data based on user/option/forum
* @todo: protected or public?
*/
function acl_raw_data($user_id = false, $opts = false, $forum_id = false)
public function acl_raw_data($user_id = false, $opts = false, $forum_id = false)
{
global $db;
@@ -636,6 +636,7 @@ class auth
{
$option = ($sql_opts_select) ? $row['auth_option'] : $this->acl_options['option'][$row['auth_option_id']];
// @todo: use the ref technique to reduce opcode generation
if (!isset($hold_ary[$row['user_id']][$row['forum_id']][$option]) || (isset($hold_ary[$row['user_id']][$row['forum_id']][$option]) && $hold_ary[$row['user_id']][$row['forum_id']][$option] != ACL_NEVER))
{
$hold_ary[$row['user_id']][$row['forum_id']][$option] = $row['auth_setting'];
@@ -667,7 +668,7 @@ class auth
/**
* Get raw user based permission settings
*/
function acl_user_raw_data($user_id = false, $opts = false, $forum_id = false)
public function acl_user_raw_data($user_id = false, $opts = false, $forum_id = false)
{
global $db;
@@ -719,7 +720,7 @@ class auth
/**
* Get raw group based permission settings
*/
function acl_group_raw_data($group_id = false, $opts = false, $forum_id = false)
public function acl_group_raw_data($group_id = false, $opts = false, $forum_id = false)
{
global $db;
@@ -772,7 +773,7 @@ class auth
* Get raw acl data based on user for caching user_permissions
* This function returns the same data as acl_raw_data(), but without the user id as the first key within the array.
*/
function acl_raw_data_single_user($user_id)
public function acl_raw_data_single_user($user_id)
{
global $db, $cache;
@@ -853,7 +854,7 @@ class auth
/**
* Private function snippet for setting a specific piece of the hold_ary
*/
function _set_group_hold_ary(&$hold_ary, $option_id, $setting)
private function _set_group_hold_ary(&$hold_ary, $option_id, $setting)
{
if (!isset($hold_ary[$option_id]) || (isset($hold_ary[$option_id]) && $hold_ary[$option_id] != ACL_NEVER))
{
@@ -882,12 +883,12 @@ class auth
/**
* Authentication plug-ins is largely down to Sergey Kanareykin, our thanks to him.
*/
function login($username, $password, $autologin = false, $viewonline = 1, $admin = 0)
public function login($username, $password, $autologin = false, $viewonline = 1, $admin = 0)
{
global $config, $db, $user, $phpbb_root_path, $phpEx;
global $config, $db, $user;
$method = trim(basename($config['auth_method']));
include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
include_once(PHPBB_ROOT_PATH . 'includes/auth/auth_' . $method . '.' . PHP_EXT);
$method = 'login_' . $method;
if (function_exists($method))
@@ -900,7 +901,7 @@ class auth
// we are going to use the user_add function so include functions_user.php if it wasn't defined yet
if (!function_exists('user_add'))
{
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
}
user_add($login['user_row'], (isset($login['cp_data'])) ? $login['cp_data'] : false);
@@ -984,7 +985,7 @@ class auth
/**
* Fill auth_option statement for later querying based on the supplied options
*/
function build_auth_option_statement($key, $auth_options, &$sql_opts)
private function build_auth_option_statement($key, $auth_options, &$sql_opts)
{
global $db;

View File

@@ -165,9 +165,7 @@ function autologin_apache()
if (!function_exists('user_add'))
{
global $phpbb_root_path, $phpEx;
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
}
// create the user if he does not exist yet
@@ -198,7 +196,7 @@ function user_row_apache($username, $password)
// first retrieve default group id
$sql = 'SELECT group_id
FROM ' . GROUPS_TABLE . "
WHERE group_name = '" . $db->sql_escape('REGISTERED') . "'
WHERE group_name_clean = '" . $db->sql_escape('registered') . "'
AND group_type = " . GROUP_SPECIAL;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);

View File

@@ -81,54 +81,34 @@ function login_db(&$username, &$password)
}
else
{
global $user;
$sql = 'SELECT code
FROM ' . CONFIRM_TABLE . "
WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "'
AND session_id = '" . $db->sql_escape($user->session_id) . "'
AND confirm_type = " . CONFIRM_LOGIN;
$result = $db->sql_query($sql);
$confirm_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($confirm_row)
{
if (strcasecmp($confirm_row['code'], $confirm_code) === 0)
{
$sql = 'DELETE FROM ' . CONFIRM_TABLE . "
WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "'
AND session_id = '" . $db->sql_escape($user->session_id) . "'
AND confirm_type = " . CONFIRM_LOGIN;
$db->sql_query($sql);
}
else
{
return array(
'status' => LOGIN_ERROR_ATTEMPTS,
'error_msg' => 'CONFIRM_CODE_WRONG',
'user_row' => $row,
);
}
}
else
$captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
$captcha->init(CONFIRM_LOGIN);
$vc_response = $captcha->validate();
if ($vc_response)
{
return array(
'status' => LOGIN_ERROR_ATTEMPTS,
'error_msg' => 'CONFIRM_CODE_WRONG',
'user_row' => $row,
'status' => LOGIN_ERROR_ATTEMPTS,
'error_msg' => 'LOGIN_ERROR_ATTEMPTS',
'user_row' => $row,
);
}
}
}
// @todo: safe to remove?
// If the password convert flag is set we need to convert it
if ($row['user_pass_convert'])
/*if ($row['user_pass_convert'])
{
// in phpBB2 passwords were used exactly as they were sent, with addslashes applied
$disabled = request::super_globals_disabled();
request::enable_super_globals();
$password_old_format = isset($_REQUEST['password']) ? (string) $_REQUEST['password'] : '';
$password_old_format = (!STRIP) ? addslashes($password_old_format) : $password_old_format;
$password_new_format = '';
if ($disabled)
{
request::disable_super_globals();
}
set_var($password_new_format, stripslashes($password_old_format), 'string');
@@ -136,8 +116,7 @@ function login_db(&$username, &$password)
{
if (!function_exists('utf8_to_cp1252'))
{
global $phpbb_root_path, $phpEx;
include($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx);
include(PHPBB_ROOT_PATH . 'includes/utf/data/recode_basic.' . PHP_EXT);
}
// cp1252 is phpBB2's default encoding, characters outside ASCII range might work when converted into that encoding
@@ -171,7 +150,7 @@ function login_db(&$username, &$password)
);
}
}
}
}*/
// Check password ...
if (!$row['user_pass_convert'] && phpbb_check_hash($password, $row['user_password']))

View File

@@ -208,7 +208,7 @@ function login_ldap(&$username, &$password)
// retrieve default group id
$sql = 'SELECT group_id
FROM ' . GROUPS_TABLE . "
WHERE group_name = '" . $db->sql_escape('REGISTERED') . "'
WHERE group_name_clean = '" . $db->sql_escape('registered') . "'
AND group_type = " . GROUP_SPECIAL;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);

View File

@@ -36,7 +36,7 @@ class bbcode
* Constructor
* Init bbcode cache entries if bitfield is specified
*/
function bbcode($bitfield = '')
function __construct($bitfield = '')
{
if ($bitfield)
{
@@ -128,27 +128,16 @@ class bbcode
*/
function bbcode_cache_init()
{
global $user, $phpbb_root_path;
global $user;
if (empty($this->template_filename))
{
$this->template_bitfield = new bitfield($user->theme['bbcode_bitfield']);
$this->template_filename = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/bbcode.html';
$this->template_filename = PHPBB_ROOT_PATH . 'styles/' . $user->theme['template_path'] . '/template/bbcode.html';
if (!@file_exists($this->template_filename))
{
if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'])
{
$this->template_filename = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template/bbcode.html';
if (!@file_exists($this->template_filename))
{
trigger_error('The file ' . $this->template_filename . ' is missing.', E_USER_ERROR);
}
}
else
{
trigger_error('The file ' . $this->template_filename . ' is missing.', E_USER_ERROR);
}
trigger_error('The file ' . $this->template_filename . ' is missing.', E_USER_ERROR);
}
}

View File

@@ -0,0 +1,241 @@
<?php
/**
*
* @package phpBB3
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* The phpBB version of the BBCode parser
*
*/
class phpbb_bbcode_parser extends phpbb_bbcode_parser_base
{
private $list_stack = array();
protected $tags = array();
public function __construct()
{
$this->tags = array(
// The exact B BBcode from phpBB
'b' => array(
'replace' => '<span style="font-weight: bold">',
'close' => '</span>',
'attributes' => array(),
'children' => array(true, 'quote' => true, 'code' => true, 'list' => true),
'parents' => array(true),
),
// The exact I BBcode from phpBB
'i' => array(
'replace' => '<span style="font-style: italic">',
'close' => '</span>',
'attributes' => array(),
'children' => array(true, 'quote' => true, 'code' => true, 'list' => true),
'parents' => array(true),
),
// The exact U BBcode from phpBB
'u' => array(
'replace' => '<span style="text-decoration: underline">',
'close' => '</span>',
'attributes' => array(),
'children' => array(true, 'quote' => true, 'code' => true, 'list' => true),
'parents' => array(true),
),
// Quote tag attempt.
'quote' => array(
'replace' => '<div class="quotetitle">{_}</div><div class="quotecontent">',
'close' => '</div>',
'attributes' => array(
'_' => array(
'replace' => '%s wrote:',
),
),
'children' => array(true),
'parents' => array(true),
),
// code tag (without the =php functionality)
'code' => array(
'replace' => '<div class="codetitle"><b>Code:</b></div><div class="codecontent">',
'close' => '</div>',
'attributes' => array(),
'children' => array(false),
'parents' => array(true),
),
// list tag
'list' => array(
'replace' => '',
'replace_func' => array($this, 'list_open'),
'close' => '',
'close_func' => array($this, 'list_close'),
'attributes' => array(
'_' => array(
'replace' => '',
),
),
'children' => array(false, 'li' => true),
'parents' => array(true),
),
// The exact * tag from phpBB. "*" is not a valid tag name in this parser... introducing li from HTML!
'li' => array(
'replace' => '<li>',
'close' => '</li>',
'close_shadow' => true,
'attributes' => array(),
'children' => array(true, 'li' => true),
'parents' => array(false, 'list' => true),
),
// Almost exact img tag from phpBB...
'img' => array(
'replace' => '<img alt="Image" src="',
'close' => '" />',
'attributes' => array(
'__' => array(
'replace' => '%s',
),
),
'children' => array(false),
'parents' => array(true),
),
'url' => array(
'replace' => '',
'replace_func' => array($this, 'url_tag'),
'close' => '</a>',
'attributes' => array(
// The replace value is not important empty because the replace_func handles this.
'_' => array(
'replace' => '',
),
'__' => array(
'replace' => '',
),
),
'children' => array(false),
'parents' => array(true),
),
'color' => array(
'replace' => '<span style="color: {_}">',
'close' => '</span>',
'attributes' => array(
'_' => array(
'replace' => '%s',
'required' => true
),
),
'children' => array(true, 'color' => true),
'parents' => array(true),
),
'size' => array(
'replace' => '<span style="font-size: {_}px; line-height: normal">',
'close' => '</span>',
'attributes' => array(
'_' => array(
'replace' => '%s',
'required' => true
),
),
'children' => array(true, 'size' => true),
'parents' => array(true),
),
// FLASH tag implementation attempt.
'flash' => array(
'replace' => '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"{w}{h}>
<param name="movie" value="{m}" />
<param name="quality" value="high" />
<embed src="{m}" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"{w}{h}>
</embed>
</object>',
'close' => false,
'attributes' => array(
'm' => array(
'replace' => '%s',
'required' => true,
),
'w' => array(
'replace' => ' width="%s"',
'type_check' => 'ctype_digit',
),
'h' => array(
'replace' => ' height="%s"',
'type_check' => 'ctype_digit',
),
),
'children' => array(false),
'parents' => array(true),
),
// The spoiler tag from area51.phpbb.com :p
'spoiler' => array(
'replace' => '<span class="quotetitle"><b>Spoiler:</b></span><span style="background-color:white;color:white;">',
'close' => '</span>',
'attributes' => array(),
'children' => array(false),
'parents' => array(true),
),
// a noparse tag
'noparse' => array(
'replace' => '',
'close' => '',
'attributes' => array(),
'children' => array(false),
'parents' => array(true),
),
);
$this->smilies = array(
':)' => '<img src="http://area51.phpbb.com/phpBB/images/smilies/icon_e_smile.gif" />',
':(' => '<img src="http://area51.phpbb.com/phpBB/images/smilies/icon_e_sad.gif" />',
);
// $this->text_callback = 'strtoupper';
parent::__construct();
}
protected function url_tag(array $attributes = array(), array $definition = array())
{
if (isset($attributes['_']))
{
return '<a href="' . $attributes['_'] . '">';
}
return '<a href="' . $attributes['__'] . '">';
}
protected function list_open(array $attributes = array(), array $definition = array())
{
if (isset($attributes['_']))
{
return '<ol style="list-style-type: ' . $attributes['_'] . '">';
}
return '<ul>';
}
protected function list_close(array $attributes = array())
{
if (isset($attributes['_']))
{
return '</ol>';
}
return '</ul>';
}
}

View File

@@ -0,0 +1,868 @@
<?php
/**
*
* @package phpBB3
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* A stack based BBCode parser.
*
*/
abstract class phpbb_bbcode_parser_base
{
/**
* Array holding the BBCode definitions.
*
* This is all the documentation you'll find!
*
* 'tagName' => array( // The tag name must start with a letter and can consist only of letters and numbers.
* 'replace' => 'The open tag is replaced with this. "{attribute}" - Will be replaced with an existing attribute.',
* // Optional
* 'replace_func' => 'function_name', // Open tag is replaced with the the value that this function returns. replace will not be used. The function will get the arguments given to the tag and the tag definition. It is your responsibility to validate the arguments.
* 'close' => 'The close tag is replaced by this. If set to bool(false) the tag won't need a closing tag.',
* // Optional
* 'close_shadow' => true, // If set, no closing tag will be needed, but the value close will be added as soon as the parent tag is closed or a tag which is not allowed in the tag is encountered.
* // Optional
* 'close_func' => 'function_name', // Close tag is replaced with the the value that this function returns. close will not be used. If close is set to bool this might not function as expected.
* 'attributes' => array(
* 'attributeName' => array(
* 'replace' => 'Attribute replacement. Use string defined in self::$attr_value_replace as a replacement for the attributes value',
* 'type_check' => 'function_name', // Optional. Function name to check if the value of the attribute is allowed. It must return bool or a corrected string. It must accept the attribute value string.
* 'required' => true, // Optional. The attribute must be set and not empty for the tag to be parsed.
* ),
* // ...
* ),
* 'children' => array(
* true, // true allows all tags to be a child of this tag except for the other tags in the array. false allows only the tags in the array.
* 'tag2' => true,
* // ...
* ),
* 'parents' => array(true), // Same as 'children'.
* // Optional
* 'content_func' => 'function_name', // Applies function to the contents of the tag and replaces it with the output. Used only when the tag does not allow children. It must return the replacement string and accept the input string. This is not like HTML...
* ),
* 'tag2' => array(
* // ...
*
* NOTE: Use "_" as the name of the attribute assigned to the tag itself. (eg. form the tag [tag="value"] "_" will hold "value")
* NOTE: Use "__" for the content of a tag without children. (eg. for [u]something[/u] "__" will hold "something") This is not like HTML...
* NOTE: The following special tags exist: "__url" (child), "__smiley" (child) and "__global" (parent). They are to be used in the child/parent allowed/disallowed lists.
* @var array
*/
protected $tags = array();
/**
* The smilies which are to be "parsed".
*
* Smilies are treated the same way as BBCodes (though BBcodes have precedence).
* Use "__smiley" to allow/disallow them in tags. Smileys can only be children.
*
* 'smiley' => 'replacement'
*
* @var array
*/
protected $smilies = array();
/**
* Callback to be applied to all text nodes (in second_pass).
*
* @var mixed
*/
protected $text_callback = null;
/**
* Used by first_pass and second_pass
*
* @var array
*/
private $stack = array();
/**
* Regex to match BBCode tags.
*
* @var string
*/
private $tag_regex = '\[(/?)([a-z][a-z0-9]*)(?:=(\'[^\']*\'|"[^"]*"))?((?: [a-z]+(?:\s?=\s?(?:\'[^\']*\'|"[^"]*"))?)*)\]';
/**
* Regex for URL's
*
* @var string
*/
private $url_regex = '(?>([a-z+]{2,}://|www\.))(?:[a-z0-9]+(?:\.[a-z0-9]+)?@)?(?:(?:[a-z](?:[a-z0-9]|(?<!-)-)*[a-z0-9])(?:\.[a-z](?:[a-z0-9]|(?<!-)-)*[a-z0-9])+|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(?:/[^\\/:?*"<>|\n]*[a-z0-9])*/?(?:\?[a-z0-9_.%]+(?:=[a-z0-9_.%:/+-]*)?(?:&[a-z0-9_.%]+(?:=[a-z0-9_.%:/+-]*)?)*)?(?:#[a-z0-9_%.]+)?';
/**
* Regex to match attribute&value pairs.
*
* @var string
*/
private $attribute_regex = '~([a-z]+)(?:\s?=\s?((?:\'[^\']*?\'|"[^"]*?")))?~i';
/**
* Delimiter's ASCII code.
*
* @var int
*/
private $delimiter = 0;
/**
* This string will be replaced by the attribute value.
*
* @var string
*/
private $attr_value_replace = '%s';
/**
* First pass result.
*
* @var array
*/
private $parsed = array();
private $parse_pos = 1;
/**
* Parse flags
*
* @var int
*/
protected $flags;
/**
* Types
*/
const TYPE_TAG = 1;
const TYPE_TAG_SIMPLE = 2;
const TYPE_CTAG = 3;
const TYPE_ABSTRACT_SMILEY = 4;
const TYPE_ABSTRACT_URL = 5;
/**
* Feature flags
*/
const PARSE_BBCODE = 1;
const PARSE_URLS = 2;
const PARSE_SMILIES = 4;
/**
* Tag Backreferences.
*
*/
const MATCH_CLOSING_TAG = 1;
const MATCH_TAG_NAME = 2;
const MATCH_SHORT_ARG = 3;
const MATCH_ARGS = 4;
/**
* Argument backreferences
*
*/
const MATCH_ARG_NAME = 1;
const MATCH_ARG_VALUE = 2;
/**
* Constructor.
*
*/
public function __construct()
{
$this->delimiter = chr($this->delimiter);
$this->flags = self::PARSE_BBCODE | self::PARSE_URLS | self::PARSE_SMILIES;
}
/**
* Returns a string ready for storage and/or second_pass
*
* @param string $string
* @return string
*/
public function first_pass($string)
{
$this->stack = array();
$this->parsed = array();
$this->parse_pos = 1;
// Remove the delimiter from the string.
$string = str_replace($this->delimiter, '', $string);
$smilies = implode('|',array_map(array($this, 'regex_quote'), array_keys($this->smilies)));
// Make a regex out of the following items:
$regex_parts = array(
$this->tag_regex,
$this->url_regex,
$smilies,
);
$regex = '~' . implode('|', $regex_parts) . '~i';
// Do most of the job here...
$string = preg_replace_callback($regex, array($this, 'first_pass_tag_check'), $string);
// Close all remaining open tags.
if (sizeof($this->stack) > 0)
{
$string .= $this->close_tags($this->stack);
$this->stack = array();
}
// Make a serialized array out of it.
$string = explode($this->delimiter, $string);
if (sizeof($string) > 1)
{
$parsed = array();
$this->parse_pos = 0;
end($this->parsed);
reset($string);
foreach ($this->parsed as $key => $val)
{
$parsed[key($string) * 2] = current($string);
$parsed[$key] = $val;
next($string);
}
$this->parsed = array();
$this->parse_pos = 1;
}
else
{
$parsed = $string;
}
return serialize($parsed);
}
/**
* Opposite function to first_pass.
* Changes the output of first_pass back to BBCode.
*
* @param string $string
* @return string
* @todo make sure this works after the change of first_pass data storage.
*/
public function first_pass_decompile($string)
{
$string = unserialize($string);
for ($i = 1, $n = sizeof($string); $i < $n; $i += 2)
{
$string[$i] = $this->decompile_tag($tag);
}
return implode('', $string);
}
/**
* Removes first_pass data. This removes all BBCode tags. To reverse the effect of first_pass use first_pass_decompile
*
* @param string $string
* @return string
*/
public function remove_first_pass_data($string)
{
$decompiled = array();
$compiled = unserialize($string);
for ($i = 0, $n = sizeof($compiled); $i < $n; $n += 2)
{
$decompiled[] = $compiled[$i];
}
return implode('', $decompiled);
}
/**
* The function takes the result of first_pass and returnes the string fully parsed.
*
* @param string $string
* @return string
*/
public function second_pass($string)
{
$this->stack = array();
$string = unserialize($string);
if (!is_null($this->text_callback))
{
for ($i = 0, $n = sizeof($string); $i < $n; $i += 2)
{
$string[$i] = call_user_func($this->text_callback, $string[$i]);
}
}
for ($i = 1, $n = sizeof($string); $i < $n; $i += 2)
{
$tag_data = $string[$i];
$type = &$tag_data[0];
$tag = $tag_data[1];
$tag_definition = &$this->tags[$tag];
if ($this->flags & self::PARSE_BBCODE && $type != self::TYPE_ABSTRACT_URL && $type != self::TYPE_ABSTRACT_SMILEY && $type != self::TYPE_CTAG)
{
// These apply to opening tags and tags without closing tags.
// Is the tag still allowed as a child?
// This is still needed!
if (sizeof($this->stack) && isset($this->tags[$this->stack[0]['name']]['close_shadow']) && !is_bool($this->tags[$this->stack[0]['name']]['close']) && !$this->child_allowed($tag))
{
// The previous string won't be edited anymore.
$string[$i - 1] .= $this->tags[$this->stack[0]['name']]['close'];
array_shift($this->stack);
}
// Add tag to stack only if it needs a closing tag.
if ($tag_definition['close'] !== false || !isset($tag_definition['close_shadow']))
{
array_unshift($this->stack, array('name' => $tag, 'attributes' => array()));
}
}
switch ($type)
{
case self::TYPE_ABSTRACT_URL:
if ($this->flags & self::PARSE_URLS && $this->child_allowed('__url'))
{
$string[$i] = '<a href="' . $tag_data[1] . '">' . $tag_data[1] . '</a>';
}
else
{
$string[$i] = $tag_data[1];
}
break;
case self::TYPE_ABSTRACT_SMILEY:
if ($this->flags & self::PARSE_SMILIES && $this->child_allowed('__smiley'))
{
$string[$i] = $this->smilies[$tag_data[1]];
}
else
{
$string[$i] = $tag_data[1];
}
break;
case self::TYPE_CTAG:
if (($this->flags & self::PARSE_BBCODE) == 0)
{
$string[$i] = $this->decompile_tag($string[$i]);
break;
}
// It must be the last one as tag nesting was checked in the first pass.
// An exception to this rule was created with adding the new type of tag without closing tag.
if (isset($this->tags[$this->stack[0]['name']]['close_shadow']))
{
if (!is_bool($this->tags[$this->stack[0]['name']]['close']))
{
// the previous string won't be edited anymore.
$string[$i - 1] .= $this->tags[$this->stack[0]['name']]['close'];
}
else if (isset($tag_definition['close_func']))
{
$string[$i - 1] .= call_user_func($tag_definition['close_func'], $this->stack[0]['attributes']);
}
array_shift($this->stack);
}
if ($tag != $this->stack[0]['name'])
{
$string[$i] = $this->decompile_tag('/' . $tag);
}
else if (isset($tag_definition['close_shadow']))
{
$string[$i] = '';
}
else if ($tag_definition['close'] !== false || !isset($tag_definition['close_shadow']))
{
if (isset($tag_definition['close_func']))
{
$string[$i] = call_user_func($tag_definition['close_func'], $this->stack[0]['attributes']);
}
else
{
$string[$i] = $tag_definition['close'];
}
array_shift($this->stack);
}
else
{
$string[$i] = '';
}
break;
case self::TYPE_TAG_SIMPLE:
if (($this->flags & self::PARSE_BBCODE) == 0)
{
$string[$i] = $this->decompile_tag($string[$i]);
break;
}
if ($tag_definition['children'][0] == false && sizeof($tag_definition['children']) == 1)
{
if (isset($tag_definition['attributes']['__']))
{
$this->stack[0]['attributes'] = array('__' => $string[$i + 1]);
if (isset($tag_definition['replace_func']))
{
$string[$i] = call_user_func($tag_definition['replace_func'], array('__' => $string[$i + 1]), $tag_definition);
}
else
{
$string[$i] = str_replace('{__}', $string[$i + 1], $tag_definition['replace']);
}
}
else if (isset($tag_definition['replace_func']))
{
$string[$i] = call_user_func($tag_definition['replace_func'], array(), $tag_definition);
}
else
{
$string[$i] = $tag_definition['replace'];
}
if (isset($this->tags[$tag]['content_func']))
{
$string[$i + 1] = call_user_func($tag_definition['content_func'], $string[$i + 1]);
}
}
else
{
if (isset($tag_definition['replace_func']))
{
$string[$i] = call_user_func($tag_definition['replace_func'], array(), $tag_definition);
}
else
{
$string[$i] = $tag_definition['replace'];
}
}
if (sizeof($tag_definition['attributes']) > 0)
{
// The tag has defined attributes but doesn't use any. The attribute replacements must be removed. I don't want this regex here.
$string[$i] = preg_replace('/{[^}]*}/', '', $string[$i]);
}
break;
case self::TYPE_TAG:
if (($this->flags & self::PARSE_BBCODE) == 0)
{
$string[$i] = $this->decompile_tag($string[$i]);
break;
}
// These apply to tags with attributes.
if (!isset($tag_data[2]))
{
$tag_data[2] = array('__' => $string[$i + 1]);
}
$this->stack[0]['attributes'] = $tag_data[2];
// Handle the (opening) tag with a custom function
if (isset($tag_definition['replace_func']))
{
$string[$i] = call_user_func($tag_definition['replace_func'], $tag_data[2], $tag_definition);
if (isset($tag_definition['content_func']) && $tag_definition['children'][0] === false && sizeof($tag_definition['children']) == 1)
{
$string[$i + 1] = call_user_func($tag_definition['content_func'], $string[$i + 1]);
}
break;
}
// New code for the feature I've always wanted to implement :)
if (isset($tag_definition['attributes']['__']) && $tag_definition['children'][0] == false && sizeof($tag_definition['children']) == 1)
{
$attributes = array('{__}');
$replacements = array($string[$i + 1]);
// End new code.
}
else
{
$attributes = array();
$replacements = array();
}
foreach ($tag_definition['attributes'] as $attribute => $value)
{
$attributes[] = '{' . $attribute . '}';
if (!isset($tag_data[2][$attribute]))
{
if (isset($value['required']))
{
$string[$i] = $this->decompile_tag($tag_data);
break 2;
}
$replacements[] = '';
continue;
}
$replacements[] = str_replace($this->attr_value_replace, $tag_data[2][$attribute], $tag_definition['attributes'][$attribute]['replace']);
}
$string[$i] = str_replace($attributes, $replacements, $this->tags[$tag]['replace']);
// It has to be twice... this should not be used if required attributes are missing.
if (isset($tag_definition['content_func']) && $tag_definition['children'][0] === false && sizeof($tag_definition['children']) == 1)
{
$string[$i + 1] = call_user_func($tag_definition['content_func'], $string[$i + 1]);
}
break;
}
}
return implode($string);
}
/**
* Callback for preg_replace_callback in first_pass.
*
* @param array $matches
* @return string
*/
private function first_pass_tag_check($matches)
{
switch (sizeof($matches))
{
// Smilies
case 1:
$this->parsed[$this->parse_pos] = array(self::TYPE_ABSTRACT_SMILEY, $matches[0]);
$this->parse_pos += 2;
return $this->delimiter;
break;
// URL
case 6:
$this->parsed[$this->parse_pos] = array(self::TYPE_ABSTRACT_URL, $matches[0]);
$this->parse_pos += 2;
return $this->delimiter;
break;
default:
if (!isset($this->tags[$matches[self::MATCH_TAG_NAME]]))
{
// Tag with the given name not defined.
return $matches[0];
}
// If tag is an opening tag.
if (strlen($matches[self::MATCH_CLOSING_TAG]) == 0)
{
if (sizeof($this->stack))
{
if ($this->tags[$this->stack[0]]['children'][0] == false && sizeof($this->tags[$this->stack[0]]['children']) == 1)
{
// Tag does not allow children.
return $matches[0];
}
// Tag parent not allowed for this tag. Omit here.
else if (!$this->parent_allowed($matches[self::MATCH_TAG_NAME], $this->stack[0]))
{
if (isset($this->tags[$this->stack[0]]['close_shadow']))
{
array_shift($this->stack);
}
else
{
return $matches[0];
}
}
}
// Is tag allowed in global scope?
else if (!$this->parent_allowed($matches[self::MATCH_TAG_NAME], '__global'))
{
return $matches[0];
}
if ($this->tags[$matches[self::MATCH_TAG_NAME]]['close'] !== false || !isset($this->tags[$matches[self::MATCH_TAG_NAME]]['close_shadow']))
{
// Do not add tags to stack that do not need closing tags.
array_unshift($this->stack, $matches[self::MATCH_TAG_NAME]);
}
$tag_attributes = &$this->tags[$matches[self::MATCH_TAG_NAME]]['attributes'];
if (strlen($matches[self::MATCH_SHORT_ARG]) != 0 && isset($tag_attributes['_']))
{
// Add short attribute.
$attributes = array('_' => substr($matches[self::MATCH_SHORT_ARG], 1, -1));
}
else if (strlen($matches[4]) == 0 || (sizeof($tag_attributes)) == 0)
{
// Check all attributes, which were not used, if they are required.
if ($this->has_required($matches[self::MATCH_TAG_NAME], array_keys($tag_attributes)))
{
// Not all required attributes were used.
return $matches[0];
}
else
{
$this->parsed[$this->parse_pos] = array(self::TYPE_TAG_SIMPLE, $matches[self::MATCH_TAG_NAME]);
if (isset($attributes))
{
$this->parsed[$this->parse_pos][] = $attributes;
}
$this->parse_pos += 2;
return $this->delimiter;
}
}
else
{
$attributes = array();
}
// Analyzer...
$matched_attrs = array();
preg_match_all($this->attribute_regex, $matches[self::MATCH_ARGS], $matched_attrs, PREG_SET_ORDER);
foreach($matched_attrs as $i => $value)
{
$tag_attribs_matched = &$tag_attributes[$value[self::MATCH_ARG_NAME]];
if (isset($attributes[$value[self::MATCH_ARG_NAME]]))
{
// This prevents adding the same attribute more than once. Childish betatesters are needed.
continue;
}
if (isset($tag_attribs_matched))
{
// The attribute exists within the defined tag. Undefined tags are removed.
$attr_value = substr($value[self::MATCH_ARG_VALUE], 1, -1);
if (isset($tag_attribs_matched['type_check']))
{
// A type check is needed for this attribute.
$type_check = $tag_attribs_matched['type_check']($attr_value);
if (!is_bool($type_check))
{
// The type check function decided to fix the input instead of returning false.
$attr_value = $type_check;
}
else if ($type_check === false)
{
// Type check has failed.
continue;
}
}
if (isset($tag_attribs_matched['required']) && strlen($attr_value) == 0)
{
// A required attribute is empty. This is done after the type check as the type check may return an empty value.
return $matches[0];
}
$attributes[$value[self::MATCH_ARG_NAME]] = $attr_value;
}
}
// Check all attributes, which were not used, if they are required.
if ($this->has_required($matches[self::MATCH_TAG_NAME], array_values(array_diff(array_keys($tag_attributes), array_keys($attributes)))))
{
// Not all required attributes were used.
return $matches[0];
}
if (sizeof($attributes))
{
$this->parsed[$this->parse_pos] = array(self::TYPE_TAG, $matches[self::MATCH_TAG_NAME], $attributes);
$this->parse_pos += 2;
return $this->delimiter;
}
$this->parsed[$this->parse_pos] = array(self::TYPE_TAG_SIMPLE, $matches[self::MATCH_TAG_NAME]);
$this->parse_pos += 2;
return $this->delimiter;
}
// If tag is a closing tag.
$valid = array_search($matches[self::MATCH_TAG_NAME], $this->stack);
if ($valid === false)
{
// Closing tag without open tag.
return $matches[0];
}
else if ($valid != 0)
{
if ($this->tags[$this->stack[0]]['children'][0] == false && sizeof($this->tags[$this->stack[0]]['children']) == 1)
{
// Tag does not allow children.
// Do not handle other closing tags here as they are invalid in tags which do not allow children.
return $matches[0];
}
// Now we have to close all tags that were opened before this closing tag.
// We know that this tag does not close the last opened tag.
$to_close = array_splice($this->stack, 0, $valid + 1);
return $this->close_tags($to_close);
}
else
{
// A unset() was elicting many notices here.
array_shift($this->stack);
$this->parsed[$this->parse_pos] = array(self::TYPE_CTAG, $matches[self::MATCH_TAG_NAME]);
$this->parse_pos += 2;
return $this->delimiter;
}
break;
}
}
/**
* Returns closing tags for all tags in the $tags array (in reverse order).
*
* @param array $tags
* @return string
*/
private function close_tags($tags)
{
$ret = '';
foreach($tags as $tag)
{
// @todo: Is this needed?
if (!isset($this->tags[$tag]['close_shadow']))
{
$this->parsed[$this->parse_pos] = array(self::TYPE_CTAG, $tag);
$this->parse_pos += 2;
$ret .= $this->delimiter;
}
}
return $ret;
}
/**
* Returns the tag to the form it had before the first_pass
*
* @param array $tag
* @return string
*/
private function decompile_tag(array $tag)
{
$ret = '[' . (($tag[0]) ? '' : '/');
$ret .= $tag[1];
if(isset($tag[2]))
{
if (isset($tag[2]['_']))
{
$ret .= '="' . $tag[2]['_'] . '"';
unset($tag[2]['_']);
}
foreach ($tag[2] as $attribute => $value)
{
$ret .= ' ' . $attribute . '="' . $value . '"';
}
}
$ret .= ']';
return $ret;
}
/**
* Checks if $tag can be a child of the tag in stack index $index
*
* @param string $tag
* @param int $index = 0
* @return bool
*/
private function child_allowed($tag, $index = 0)
{
if (!isset($this->stack[$index]))
{
return true;
}
// I assume this trick is usefull starting form two.
$children = &$this->tags[$this->stack[$index]['name']]['children'];
if (isset($children[$tag]) xor $children[0])
{
return true;
}
else
{
return false;
}
}
/**
* Checks if the $tag can be a child of $parent
*
* @param string $tag
* @param string $parent
* @return bool
*/
private function parent_allowed($tag, $parent)
{
$parents = &$this->tags[$tag]['parents'];
if (isset($parents[$parent]) xor $parents[0])
{
return true;
}
else
{
return false;
}
}
/**
* Checks if any of $tag's attributes in $attributes are required.
*
* @param string $tag
* @param string $attributes
* @return bool
*/
private function has_required($tag, $attributes)
{
for ($i = 0, $n = sizeof($attributes); $i < $n; ++$i)
{
if (isset($this->tags[$tag]['attributes'][$attributes[$i]]['required']))
{
return true;
}
}
return false;
}
private function regex_quote($var)
{
return preg_quote($var, '~');
}
public function set_flags($flags)
{
$this->flags = (int) $flags;
}
}

View File

@@ -20,16 +20,16 @@ if (!defined('IN_PHPBB'))
* Class for grabbing/handling cached entries, extends acm_file or acm_db depending on the setup
* @package acm
*/
class cache extends acm
class cache
{
/**
* Get config values
*/
function obtain_config()
public static function obtain_config()
{
global $db;
global $db, $cache;
if (($config = $this->get('config')) !== false)
if (($config = $cache->get('config')) !== false)
{
$sql = 'SELECT config_name, config_value
FROM ' . CONFIG_TABLE . '
@@ -61,7 +61,7 @@ class cache extends acm
}
$db->sql_freeresult($result);
$this->put('config', $cached_config);
$cache->put('config', $cached_config);
}
return $config;
@@ -71,12 +71,14 @@ class cache extends acm
* Obtain list of naughty words and build preg style replacement arrays for use by the
* calling script
*/
function obtain_word_list()
public static function obtain_word_list()
{
global $db;
global $cache;
if (($censors = $this->get('_word_censors')) === false)
if (($censors = $cache->get('_word_censors')) === false)
{
global $db;
$sql = 'SELECT word, replacement
FROM ' . WORDS_TABLE;
$result = $db->sql_query($sql);
@@ -89,7 +91,7 @@ class cache extends acm
}
$db->sql_freeresult($result);
$this->put('_word_censors', $censors);
$cache->put('_word_censors', $censors);
}
return $censors;
@@ -98,9 +100,11 @@ class cache extends acm
/**
* Obtain currently listed icons
*/
function obtain_icons()
public static function obtain_icons()
{
if (($icons = $this->get('_icons')) === false)
global $cache;
if (($icons = $cache->get('_icons')) === false)
{
global $db;
@@ -120,7 +124,7 @@ class cache extends acm
}
$db->sql_freeresult($result);
$this->put('_icons', $icons);
$cache->put('_icons', $icons);
}
return $icons;
@@ -129,9 +133,11 @@ class cache extends acm
/**
* Obtain ranks
*/
function obtain_ranks()
public static function obtain_ranks()
{
if (($ranks = $this->get('_ranks')) === false)
global $cache;
if (($ranks = $cache->get('_ranks')) === false)
{
global $db;
@@ -161,7 +167,7 @@ class cache extends acm
}
$db->sql_freeresult($result);
$this->put('_ranks', $ranks);
$cache->put('_ranks', $ranks);
}
return $ranks;
@@ -174,9 +180,11 @@ class cache extends acm
*
* @return array allowed extensions array.
*/
function obtain_attach_extensions($forum_id)
public static function obtain_attach_extensions($forum_id)
{
if (($extensions = $this->get('_extensions')) === false)
global $cache;
if (($extensions = $cache->get('_extensions')) === false)
{
global $db;
@@ -220,7 +228,7 @@ class cache extends acm
}
$db->sql_freeresult($result);
$this->put('_extensions', $extensions);
$cache->put('_extensions', $extensions);
}
// Forum post
@@ -279,37 +287,18 @@ class cache extends acm
/**
* Obtain active bots
*/
function obtain_bots()
public static function obtain_bots()
{
if (($bots = $this->get('_bots')) === false)
global $cache;
if (($bots = $cache->get('_bots')) === false)
{
global $db;
switch ($db->sql_layer)
{
case 'mssql':
case 'mssql_odbc':
$sql = 'SELECT user_id, bot_agent, bot_ip
FROM ' . BOTS_TABLE . '
WHERE bot_active = 1
ORDER BY LEN(bot_agent) DESC';
break;
case 'firebird':
$sql = 'SELECT user_id, bot_agent, bot_ip
FROM ' . BOTS_TABLE . '
WHERE bot_active = 1
ORDER BY CHAR_LENGTH(bot_agent) DESC';
break;
// LENGTH supported by MySQL, IBM DB2 and Oracle for sure...
default:
$sql = 'SELECT user_id, bot_agent, bot_ip
FROM ' . BOTS_TABLE . '
WHERE bot_active = 1
ORDER BY LENGTH(bot_agent) DESC';
break;
}
$sql = 'SELECT user_id, bot_agent, bot_ip
FROM ' . BOTS_TABLE . '
WHERE bot_active = 1
ORDER BY ' . $db->sql_function('length_varchar', 'bot_agent') . 'DESC';
$result = $db->sql_query($sql);
$bots = array();
@@ -319,7 +308,7 @@ class cache extends acm
}
$db->sql_freeresult($result);
$this->put('_bots', $bots);
$cache->put('_bots', $bots);
}
return $bots;
@@ -327,59 +316,56 @@ class cache extends acm
/**
* Obtain cfg file data
*
* @param array $theme An array containing the path to the item
*
* @param string $item The specific item to get: 'theme', 'template', or 'imageset'
*
*/
function obtain_cfg_items($theme)
public static function obtain_cfg_item($theme, $item = 'theme')
{
global $config, $phpbb_root_path;
global $config, $cache;
$parsed_items = array(
'theme' => array(),
'template' => array(),
'imageset' => array()
);
$parsed_array = $cache->get('_cfg_' . $item . '_' . $theme[$item . '_path']);
foreach ($parsed_items as $key => $parsed_array)
if ($parsed_array === false)
{
$parsed_array = $this->get('_cfg_' . $key . '_' . $theme[$key . '_path']);
if ($parsed_array === false)
{
$parsed_array = array();
}
$reparse = false;
$filename = $phpbb_root_path . 'styles/' . $theme[$key . '_path'] . '/' . $key . '/' . $key . '.cfg';
if (!file_exists($filename))
{
continue;
}
if (!isset($parsed_array['filetime']) || (($config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime'])))
{
$reparse = true;
}
// Re-parse cfg file
if ($reparse)
{
$parsed_array = parse_cfg_file($filename);
$parsed_array['filetime'] = @filemtime($filename);
$this->put('_cfg_' . $key . '_' . $theme[$key . '_path'], $parsed_array);
}
$parsed_items[$key] = $parsed_array;
$parsed_array = array();
}
return $parsed_items;
$reparse = false;
$filename = PHPBB_ROOT_PATH . 'styles/' . $theme[$item . '_path'] . '/' . $item . '/' . $item . '.cfg';
if (!file_exists($filename))
{
return $parsed_array;
}
if (!isset($parsed_array['filetime']) || (($config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime'])))
{
$reparse = true;
}
// Re-parse cfg file
if ($reparse)
{
$parsed_array = parse_cfg_file($filename);
$parsed_array['filetime'] = @filemtime($filename);
$cache->put('_cfg_' . $item . '_' . $theme[$item . '_path'], $parsed_array);
}
return $parsed_array;
}
/**
* Obtain disallowed usernames
*/
function obtain_disallowed_usernames()
public static function obtain_disallowed_usernames()
{
if (($usernames = $this->get('_disallowed_usernames')) === false)
global $cache;
if (($usernames = $cache->get('_disallowed_usernames')) === false)
{
global $db;
@@ -394,7 +380,7 @@ class cache extends acm
}
$db->sql_freeresult($result);
$this->put('_disallowed_usernames', $usernames);
$cache->put('_disallowed_usernames', $usernames);
}
return $usernames;
@@ -403,30 +389,30 @@ class cache extends acm
/**
* Obtain hooks...
*/
function obtain_hooks()
public static function obtain_hooks()
{
global $phpbb_root_path, $phpEx;
global $cache;
if (($hook_files = $this->get('_hooks')) === false)
if (($hook_files = $cache->get('_hooks')) === false)
{
$hook_files = array();
// Now search for hooks...
$dh = @opendir($phpbb_root_path . 'includes/hooks/');
$dh = @opendir(PHPBB_ROOT_PATH . 'includes/hooks/');
if ($dh)
{
while (($file = readdir($dh)) !== false)
{
if (strpos($file, 'hook_') === 0 && substr($file, -(strlen($phpEx) + 1)) === '.' . $phpEx)
if (strpos($file, 'hook_') === 0 && substr($file, -(strlen(PHP_EXT) + 1)) === '.' . PHP_EXT)
{
$hook_files[] = substr($file, 0, -(strlen($phpEx) + 1));
$hook_files[] = substr($file, 0, -(strlen(PHP_EXT) + 1));
}
}
closedir($dh);
}
$this->put('_hooks', $hook_files);
$cache->put('_hooks', $hook_files);
}
return $hook_files;

View File

@@ -0,0 +1,95 @@
<?php
/**
*
* @package VC
* @version $Id: $
* @copyright (c) 2008 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
if (!interface_exists('phpbb_captcha_plugin'))
{
include(PHPBB_ROOT_PATH . 'includes/captcha/captcha_plugin.' . PHP_EXT);
}
/**
* A small class until we get the autoloader done
*/
class phpbb_captcha_factory
{
/**
* return an instance of class $name in file $name_plugin.php
*/
public static function get_instance($name)
{
$name = basename($name);
if (!class_exists($name))
{
include(PHPBB_ROOT_PATH . "includes/captcha/plugins/{$name}_plugin." . PHP_EXT);
}
return call_user_func(array($name, 'get_instance'));
}
/**
* Call the garbage collector
*/
public static function garbage_collect($name)
{
$name = basename($name);
if (!class_exists($name))
{
include(PHPBB_ROOT_PATH . "includes/captcha/plugins/{$name}_plugin." . PHP_EXT);
}
call_user_func(array($name, 'garbage_collect'), 0);
}
/**
* return a list of all discovered CAPTCHA plugins
*/
public static function get_captcha_types()
{
$captchas = array(
'available' => array(),
'unavailable' => array(),
);
$dp = @opendir(PHPBB_ROOT_PATH . 'includes/captcha/plugins');
if ($dp)
{
while (($file = readdir($dp)) !== false)
{
if ((preg_match('#_plugin\.' . PHP_EXT . '$#', $file)))
{
$name = preg_replace('#^(.*?)_plugin\.' . PHP_EXT . '$#', '\1', $file);
if (!class_exists($name))
{
include(PHPBB_ROOT_PATH . "includes/captcha/plugins/$file");
}
if (call_user_func(array($name, 'is_available')))
{
$captchas['available'][$name] = call_user_func(array($name, 'get_name'));
}
else
{
$captchas['unavailable'][$name] = call_user_func(array($name, 'get_name'));
}
}
}
closedir($dp);
}
return $captchas;
}
}
?>

View File

@@ -24,20 +24,20 @@ if (!defined('IN_PHPBB'))
*/
class captcha
{
var $width = 360;
var $height = 96;
const width = 360;
const height = 96;
/**
* Create the image containing $code with a seed of $seed
*/
function execute($code, $seed)
public static function execute($code, $seed)
{
global $config;
srand($seed);
mt_srand($seed);
// Create image
$img = imagecreatetruecolor($this->width, $this->height);
$img = imagecreatetruecolor(self::width, self::height);
// Generate colours
$colour = new colour_manager($img, array(
@@ -53,15 +53,15 @@ class captcha
// Generate code characters
$characters = $sizes = $bounding_boxes = array();
$width_avail = $this->width - 15;
$width_avail = self::width - 15;
$code_len = strlen($code);
$captcha_bitmaps = $this->captcha_bitmaps();
$captcha_bitmaps = self::captcha_bitmaps();
for ($i = 0; $i < $code_len; ++$i)
{
$characters[$i] = new char_cube3d($captcha_bitmaps, $code[$i]);
list($min, $max) = $characters[$i]->range();
list($min, $max) = char_cube3d::range();
$sizes[$i] = mt_rand($min, $max);
$box = $characters[$i]->dimensions($sizes[$i]);
@@ -82,20 +82,20 @@ class captcha
if ($config['captcha_gd_x_grid'])
{
$grid = (int) $config['captcha_gd_x_grid'];
for ($y = 0; $y < $this->height; $y += mt_rand($grid - 2, $grid + 2))
for ($y = 0; $y < self::height; $y += mt_rand($grid - 2, $grid + 2))
{
$current_colour = $scheme[array_rand($scheme)];
imageline($img, mt_rand(0,4), mt_rand($y - 3, $y), mt_rand($this->width - 5, $this->width), mt_rand($y - 3, $y), $current_colour);
imageline($img, mt_rand(0,4), mt_rand($y - 3, $y), mt_rand(self::width - 5, self::width), mt_rand($y - 3, $y), $current_colour);
}
}
if ($config['captcha_gd_y_grid'])
{
$grid = (int) $config['captcha_gd_y_grid'];
for ($x = 0; $x < $this->width; $x += mt_rand($grid - 2, $grid + 2))
for ($x = 0; $x < self::width; $x += mt_rand($grid - 2, $grid + 2))
{
$current_colour = $scheme[array_rand($scheme)];
imagedashedline($img, mt_rand($x -3, $x + 3), mt_rand(0, 4), mt_rand($x -3, $x + 3), mt_rand($this->height - 5, $this->height), $current_colour);
imagedashedline($img, mt_rand($x -3, $x + 3), mt_rand(0, 4), mt_rand($x -3, $x + 3), mt_rand(self::height - 5, self::height), $current_colour);
}
}
@@ -104,7 +104,7 @@ class captcha
{
$dimm = $bounding_boxes[$i];
$xoffset += ($offset[$i] - $dimm[0]);
$yoffset = mt_rand(-$dimm[1], $this->height - $dimm[3]);
$yoffset = mt_rand(-$dimm[1], self::height - $dimm[3]);
$characters[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme);
$xoffset += $dimm[2];
@@ -112,7 +112,7 @@ class captcha
if ($config['captcha_gd_foreground_noise'])
{
$this->noise_line($img, 0, 0, $this->width, $this->height, $colour->get_resource('background'), $scheme, $bg_colours);
self::noise_line($img, 0, 0, self::width, self::height, $colour->get_resource('background'), $scheme, $bg_colours);
}
// Send image
@@ -125,7 +125,7 @@ class captcha
/**
* Noise line
*/
function noise_line($img, $min_x, $min_y, $max_x, $max_y, $bg, $font, $non_font)
private static function noise_line($img, $min_x, $min_y, $max_x, $max_y, $bg, $font, $non_font)
{
imagesetthickness($img, 2);
@@ -174,7 +174,7 @@ class captcha
/**
* Return bitmaps
*/
function captcha_bitmaps()
private static function captcha_bitmaps()
{
return array(
'width' => 9,
@@ -786,21 +786,21 @@ class captcha
*/
class char_cube3d
{
var $bitmap;
var $bitmap_width;
var $bitmap_height;
private $bitmap;
private $bitmap_width;
private $bitmap_height;
var $basis_matrix = array(array(1, 0, 0), array(0, 1, 0), array(0, 0, 1));
var $abs_x = array(1, 0);
var $abs_y = array(0, 1);
var $x = 0;
var $y = 1;
var $z = 2;
var $letter = '';
private $basis_matrix = array(array(1, 0, 0), array(0, 1, 0), array(0, 0, 1));
private $abs_x = array(1, 0);
private $abs_y = array(0, 1);
private $x = 0;
private $y = 1;
private $z = 2;
private $letter = '';
/**
*/
function char_cube3d(&$bitmaps, $letter)
function __construct(&$bitmaps, $letter)
{
$this->bitmap = $bitmaps['data'][$letter];
$this->bitmap_width = $bitmaps['width'];
@@ -886,7 +886,7 @@ class char_cube3d
/**
* Draw a character
*/
function drawchar($scale, $xoff, $yoff, $img, $background, $colours)
public function drawchar($scale, $xoff, $yoff, $img, $background, $colours)
{
$width = $this->bitmap_width;
$height = $this->bitmap_height;
@@ -915,16 +915,16 @@ class char_cube3d
$origin = array(0, 0, 0);
$xvec = $this->scale($this->basis_matrix[$this->x], $scale);
$yvec = $this->scale($this->basis_matrix[$this->y], $scale);
$face_corner = $this->sum2($xvec, $yvec);
$face_corner = self::sum2($xvec, $yvec);
$zvec = $this->scale($this->basis_matrix[$this->z], $scale);
$x_corner = $this->sum2($xvec, $zvec);
$y_corner = $this->sum2($yvec, $zvec);
$x_corner = self::sum2($xvec, $zvec);
$y_corner = self::sum2($yvec, $zvec);
imagefilledpolygon($img, $this->gen_poly($xo, $yo, $origin, $xvec, $x_corner,$zvec), 4, $colour1);
imagefilledpolygon($img, $this->gen_poly($xo, $yo, $origin, $yvec, $y_corner,$zvec), 4, $colour2);
imagefilledpolygon($img, self::gen_poly($xo, $yo, $origin, $xvec, $x_corner,$zvec), 4, $colour1);
imagefilledpolygon($img, self::gen_poly($xo, $yo, $origin, $yvec, $y_corner,$zvec), 4, $colour2);
$face = $this->gen_poly($xo, $yo, $origin, $xvec, $face_corner, $yvec);
$face = self::gen_poly($xo, $yo, $origin, $xvec, $face_corner, $yvec);
imagefilledpolygon($img, $face, 4, $background);
imagepolygon($img, $face, 4, $colour1);
@@ -936,7 +936,7 @@ class char_cube3d
/*
* return a roughly acceptable range of sizes for rendering with this texttype
*/
function range()
public static function range()
{
return array(3, 4);
}
@@ -944,7 +944,7 @@ class char_cube3d
/**
* Vector length
*/
function vectorlen($vector)
private static function vectorlen($vector)
{
return sqrt(pow($vector[0], 2) + pow($vector[1], 2) + pow($vector[2], 2));
}
@@ -952,10 +952,10 @@ class char_cube3d
/**
* Normalize
*/
function normalize(&$vector, $length = 1)
private static function normalize(&$vector, $length = 1)
{
$length = (( $length < 1) ? 1 : $length);
$length /= $this->vectorlen($vector);
$length /= self::vectorlen($vector);
$vector[0] *= $length;
$vector[1] *= $length;
$vector[2] *= $length;
@@ -963,7 +963,7 @@ class char_cube3d
/**
*/
function cross_product($vector1, $vector2)
private static function cross_product($vector1, $vector2)
{
$retval = array(0, 0, 0);
$retval[0] = (($vector1[1] * $vector2[2]) - ($vector1[2] * $vector2[1]));
@@ -975,21 +975,21 @@ class char_cube3d
/**
*/
function sum($vector1, $vector2)
private static function sum($vector1, $vector2)
{
return array($vector1[0] + $vector2[0], $vector1[1] + $vector2[1], $vector1[2] + $vector2[2]);
}
/**
*/
function sum2($vector1, $vector2)
private static function sum2($vector1, $vector2)
{
return array($vector1[0] + $vector2[0], $vector1[1] + $vector2[1]);
}
/**
*/
function scale($vector, $length)
private static function scale($vector, $length)
{
if (sizeof($vector) == 2)
{
@@ -1001,7 +1001,7 @@ class char_cube3d
/**
*/
function gen_poly($xoff, $yoff, &$vec1, &$vec2, &$vec3, &$vec4)
private static function gen_poly($xoff, $yoff, &$vec1, &$vec2, &$vec3, &$vec4)
{
$poly = array();
$poly[0] = $xoff + $vec1[0];
@@ -1019,7 +1019,7 @@ class char_cube3d
/**
* dimensions
*/
function dimensions($size)
public function dimensions($size)
{
$xn = $this->scale($this->basis_matrix[$this->x], -($this->bitmap_width / 2) * $size);
$xp = $this->scale($this->basis_matrix[$this->x], ($this->bitmap_width / 2) * $size);
@@ -1027,10 +1027,10 @@ class char_cube3d
$yp = $this->scale($this->basis_matrix[$this->y], ($this->bitmap_height / 2) * $size);
$p = array();
$p[0] = $this->sum2($xn, $yn);
$p[1] = $this->sum2($xp, $yn);
$p[2] = $this->sum2($xp, $yp);
$p[3] = $this->sum2($xn, $yp);
$p[0] = self::sum2($xn, $yn);
$p[1] = self::sum2($xp, $yn);
$p[2] = self::sum2($xp, $yp);
$p[3] = self::sum2($xn, $yp);
$min_x = $max_x = $p[0][0];
$min_y = $max_y = $p[0][1];
@@ -1052,15 +1052,15 @@ class char_cube3d
*/
class colour_manager
{
var $img;
var $mode;
var $colours;
var $named_colours;
private $img;
private $mode;
private $colours;
private $named_colours;
/**
* Create the colour manager, link it to the image resource
*/
function colour_manager($img, $background = false, $mode = 'ahsv')
function __construct($img, $background = false, $mode = 'ahsv')
{
$this->img = $img;
$this->mode = $mode;
@@ -1077,7 +1077,7 @@ class colour_manager
/**
* Lookup a named colour resource
*/
function get_resource($named_colour)
public function get_resource($named_colour)
{
if (isset($this->named_colours[$named_colour]))
{
@@ -1095,7 +1095,7 @@ class colour_manager
/**
* Assign a name to a colour resource
*/
function name_colour($name, $resource)
private function name_colour($name, $resource)
{
$this->named_colours[$name] = $resource;
}
@@ -1103,7 +1103,7 @@ class colour_manager
/**
* names and allocates a colour resource
*/
function allocate_named($name, $colour, $mode = false)
private function allocate_named($name, $colour, $mode = false)
{
$resource = $this->allocate($colour, $mode);
@@ -1117,7 +1117,7 @@ class colour_manager
/**
* allocates a specified colour into the image
*/
function allocate($colour, $mode = false)
private function allocate($colour, $mode = false)
{
if ($mode === false)
{
@@ -1164,7 +1164,7 @@ class colour_manager
/**
* randomly generates a colour, with optional params
*/
function random_colour($params = array(), $mode = false)
private function random_colour($params = array(), $mode = false)
{
if ($mode === false)
{
@@ -1263,7 +1263,7 @@ class colour_manager
/**
*/
function colour_scheme($resource, $include_original = true)
public function colour_scheme($resource, $include_original = true)
{
$mode = 'hsv';
@@ -1289,7 +1289,7 @@ class colour_manager
/**
*/
function mono_range($resource, $count = 5, $include_original = true)
public function mono_range($resource, $count = 5, $include_original = true)
{
if (is_array($resource))
{
@@ -1331,7 +1331,7 @@ class colour_manager
/**
* Convert from one colour model to another
*/
function model_convert($colour, $from_model, $to_model)
private static function model_convert($colour, $from_model, $to_model)
{
if ($from_model == $to_model)
{
@@ -1387,7 +1387,7 @@ class colour_manager
/**
* Slightly altered from wikipedia's algorithm
*/
function hsv2rgb($hsv)
private static function hsv2rgb($hsv)
{
colour_manager::normalize_hue($hsv[0]);
@@ -1450,7 +1450,7 @@ class colour_manager
/**
* (more than) Slightly altered from wikipedia's algorithm
*/
function rgb2hsv($rgb)
private static function rgb2hsv($rgb)
{
$r = min(255, max(0, $rgb[0]));
$g = min(255, max(0, $rgb[1]));
@@ -1488,7 +1488,7 @@ class colour_manager
/**
*/
function normalize_hue(&$hue)
private static function normalize_hue(&$hue)
{
$hue %= 360;
@@ -1501,7 +1501,7 @@ class colour_manager
/**
* Alternate hue to hue
*/
function ah2h($ahue)
private static function ah2h($ahue)
{
if (is_array($ahue))
{
@@ -1535,7 +1535,7 @@ class colour_manager
/**
* hue to Alternate hue
*/
function h2ah($hue)
private static function h2ah($hue)
{
if (is_array($hue))
{

View File

@@ -0,0 +1,842 @@
<?php
/**
*
* @package VC
* @version $Id: captcha_gd.php,v 1.19 2007/01/26 16:07:43 acydburn Exp $
* @copyright (c) 2006 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
Wave3D CAPTCHA by Robert Hetzler
*/
class captcha
{
const WIDTH = 360;
const HEIGHT = 96;
static function execute($code, $seed)
{
global $starttime;
// seed the random generator
mt_srand($seed);
// set height and width
$img_x = self::WIDTH;
$img_y = self::HEIGHT;
// Generate image
$img = imagecreatetruecolor($img_x, $img_y);
$x_grid = mt_rand(6, 10);
$y_grid = mt_rand(6, 10);
// Ok, so lets cut to the chase. We could accurately represent this in 3d and
// do all the appropriate linear transforms. my questions is... why bother?
// The computational overhead is unnecessary when you consider the simple fact:
// we're not here to accurately represent a model, but to just show off some random-ish
// polygons
// Conceive of 3 spaces.
// 1) planar-space (discrete "pixel" grid)
// 2) 3-space. (planar-space with z/height aspect)
// 3) image space (pixels on the screen)
// resolution of the planar-space we're embedding the text code in
$plane_x = 100;
$plane_y = 30;
$subdivision_factor = 3;
// $box is the 4 points in img_space that correspond to the corners of the plane in 3-space
$box = array(
'upper_left' => array(
'x' => mt_rand(5, 15),
'y' => mt_rand(10, 15)
),
'upper_right' => array(
'x' => mt_rand($img_x - 35, $img_x - 19),
'y' => mt_rand(10, 17)
),
'lower_left' => array(
'x' => mt_rand($img_x - 5, $img_x - 45),
'y' => mt_rand($img_y - 0, $img_y - 15)
),
);
$box['lower_right'] = array(
'x' => $box['lower_left']['x'] + $box['upper_left']['x'] - $box['upper_right']['x'],
'y' => $box['lower_left']['y'] + $box['upper_left']['y'] - $box['upper_right']['y'],
);
// TODO
$background = imagecolorallocate($img, mt_rand(155, 255), mt_rand(155, 255), mt_rand(155, 255));
imagefill($img, 0, 0, $background);
$black = imagecolorallocate($img, 0, 0, 0);
$random = array();
$fontcolors = array();
for ($i = 0; $i < 15; ++$i)
{
$random[$i] = imagecolorallocate($img, mt_rand(120, 255), mt_rand(120, 255), mt_rand(120, 255));
}
$fontcolors[0] = imagecolorallocate($img, mt_rand(0, 120), mt_rand(0, 120), mt_rand(0, 120));
$colors = array();
$minr = mt_rand(20, 30);
$ming = mt_rand(20, 30);
$minb = mt_rand(20, 30);
$maxr = mt_rand(150, 230);
$maxg = mt_rand(150, 230);
$maxb = mt_rand(150, 230);
for ($i = -30; $i <= 30; ++$i)
{
$coeff1 = ($i + 12) / 45;
$coeff2 = 1 - $coeff1;
$colors[$i] = imagecolorallocate($img, ($coeff2 * $maxr) + ($coeff1 * $minr), ($coeff2 * $maxg) + ($coeff1 * $ming), ($coeff2 * $maxb) + ($coeff1 * $minb));
}
// $img_buffer is the last row of 3-space positions (converted to img-space), cached
// (using this means we don't need to recalculate all 4 positions for each new polygon,
// merely the newest point that we're adding, which is then cached.
$img_buffer = array(array(), array());
// In image-space, the x- and y-offset necessary to move one unit in the x-direction in planar-space
$dxx = ($box['upper_right']['x'] - $box['upper_left']['x']) / ($subdivision_factor * $plane_x);
$dxy = ($box['upper_right']['y'] - $box['upper_left']['y']) / ($subdivision_factor * $plane_x);
// In image-space, the x- and y-offset necessary to move one unit in the y-direction in planar-space
$dyx = ($box['lower_right']['x'] - $box['upper_left']['x']) / ($subdivision_factor * $plane_y);
$dyy = ($box['lower_right']['y'] - $box['upper_left']['y']) / ($subdivision_factor * $plane_y);
// Initial captcha-letter offset in planar-space
$plane_offset_x = mt_rand(3, 8);
$plane_offset_y = mt_rand( 12, 15);
// character map
$map = self::captcha_bitmaps();
// matrix
$plane = array();
// for each character, we'll silkscreen it into our boolean pixel plane
for ($c = 0, $code_num = strlen($code); $c < $code_num; ++$c)
{
$letter = $code[$c];
for ($x = $map['width'] - 1; $x >= 0; --$x)
{
for ($y = $map['height'] - 1; $y >= 0; --$y)
{
if ($map['data'][$letter][$y][$x])
{
$plane[$y + $plane_offset_y + (($c & 1) ? 1 : -1)][$x + $plane_offset_x] = true;
}
}
}
$plane_offset_x += 11;
}
// calculate our first buffer, we can't actually draw polys with these yet
// img_pos_prev == screen x,y location to our immediate left.
// img_pos_cur == current screen x,y location
// we calculate screen position of our
// current cell based on the difference from the previous cell
// rather than recalculating from absolute coordinates
// What we cache into the $img_buffer contains the raised text coordinates.
$img_pos_prev = $img_buffer[0][0] = array($box['upper_left']['x'], $box['upper_left']['y']);
$cur_height = $prev_height = self::wave_height(0, 0, $subdivision_factor);
$full_x = $plane_x * $subdivision_factor;
$full_y = $plane_y * $subdivision_factor;
for ($x = 1; $x <= $full_x; ++$x)
{
$cur_height = self::wave_height($x, 0, $subdivision_factor);
$offset = $cur_height - $prev_height;
$img_pos_cur = array($img_pos_prev[0] + $dxx, $img_pos_prev[1] + $dxy + $offset);
$img_buffer[0][$x] = $img_pos_cur;
$img_pos_prev = $img_pos_cur;
$prev_height = $cur_height;
}
for ($y = 1; $y <= $full_y; ++$y)
{
// swap buffers
$buffer_cur = $y & 1;
$buffer_prev = 1 - $buffer_cur;
$prev_height = self::wave_height(0, $y, $subdivision_factor);
$offset = $prev_height - self::wave_height(0, $y - 1, $subdivision_factor);
$img_pos_cur = array($img_buffer[$buffer_prev][0][0] + $dyx, min($img_buffer[$buffer_prev][0][1] + $dyy + $offset, $img_y - 1));
// make sure we don't try to write off the page
$img_pos_prev = $img_pos_cur;
$img_buffer[$buffer_cur][0] = $img_pos_cur;
for ($x = 1; $x <= $full_x; ++$x)
{
$cur_height = self::wave_height($x, $y, $subdivision_factor) + self::grid_height($x, $y, 1, $x_grid, $y_grid);
// height is a z-factor, not a y-factor
$offset = $cur_height - $prev_height;
$img_pos_cur = array($img_pos_prev[0] + $dxx, $img_pos_prev[1] + $dxy + $offset);
// height is float, index it to an int, get closest color
$color = $colors[intval($cur_height)];
$img_pos_prev = $img_pos_cur;
$prev_height = $cur_height;
$y_index_old = intval(($y - 1) / $subdivision_factor);
$y_index_new = intval($y / $subdivision_factor);
$x_index_old = intval(($x - 1) / $subdivision_factor);
$x_index_new = intval($x / $subdivision_factor);
if (!empty($plane[$y_index_new][$x_index_new]))
{
$img_pos_cur[1] += self::wave_height($x, $y, $subdivision_factor, 1) - 30 - $cur_height;
$color = $colors[20];
}
$img_pos_cur[1] = min($img_pos_cur[1], $img_y - 1);
$img_buffer[$buffer_cur][$x] = $img_pos_cur;
// Smooth the edges as much as possible by having not more than one low<->high traingle per square
// Otherwise, just
$diag_down = (empty($plane[$y_index_old][$x_index_old]) == empty($plane[$y_index_new][$x_index_new]));
$diag_up = (empty($plane[$y_index_old][$x_index_new]) == empty($plane[$y_index_new][$x_index_old]));
// natural switching
$mode = ($x + $y) & 1;
// override if it requires it
if ($diag_down != $diag_up)
{
$mode = $diag_up;
}
if ($mode)
{
// +-/ /
// 1 |/ 2 /|
// / /-+
$poly1 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_prev][$x]);
$poly2 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_cur][$x], $img_buffer[$buffer_prev][$x]);
}
else
{
// \ \-+
// 1 |\ 2 \|
// +-\ \
$poly1 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_cur][$x]);
$poly2 = array_merge($img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_prev][$x], $img_buffer[$buffer_cur][$x]);
}
imagefilledpolygon($img, $poly1, 3, $color);
imagefilledpolygon($img, $poly2, 3, $color);
}
}
// Output image
header('Content-Type: image/png');
header('Cache-control: no-cache, no-store');
//$mtime = explode(' ', microtime());
//$totaltime = $mtime[0] + $mtime[1] - $starttime;
//echo $totaltime . "<br />\n";
//echo memory_get_usage() - $tmp;
imagepng($img);
imagedestroy($img);
}
static function wave_height($x, $y, $factor = 1, $tweak = 0.7)
{
// stretch the wave. TODO: pretty it up
$x = $x/5 + 180;
$y = $y/4;
return ((sin($x / (3 * $factor)) + sin($y / (3 * $factor))) * 10 * $tweak);
}
static function grid_height($x, $y, $factor = 1, $x_grid, $y_grid)
{
return ((!($x % ($x_grid * $factor)) || !($y % ($y_grid * $factor))) ? 3 : 0);
}
static function captcha_bitmaps()
{
return array(
'width' => 9,
'height' => 13,
'data' => array(
'A' => array(
array(0,0,1,1,1,1,0,0,0),
array(0,1,0,0,0,0,1,0,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,1,1,1,1,1,1,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(0,0,0,0,0,0,0,0,0),
),
'B' => array(
array(1,1,1,1,1,1,0,0,0),
array(1,0,0,0,0,0,1,0,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,1,0,0),
array(1,1,1,1,1,1,0,0,0),
array(1,0,0,0,0,0,1,0,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,1,0,0),
array(1,1,1,1,1,1,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'C' => array(
array(0,0,1,1,1,1,1,0,0),
array(0,1,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,1),
array(0,1,0,0,0,0,0,1,0),
array(0,0,1,1,1,1,1,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'D' => array(
array(1,1,1,1,1,1,1,0,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,1,0),
array(1,1,1,1,1,1,1,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'E' => array(
array(0,0,1,1,1,1,1,1,1),
array(0,1,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,1,1,1,1,1,1,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(0,1,0,0,0,0,0,0,0),
array(0,0,1,1,1,1,1,1,1),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'F' => array(
array(0,0,1,1,1,1,1,1,0),
array(0,1,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,1,1,1,1,1,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'G' => array(
array(0,0,1,1,1,1,1,0,0),
array(0,1,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,1,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(0,1,0,0,0,0,0,1,0),
array(0,0,1,1,1,1,1,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'H' => array(
array(1,0,0,0,0,0,1,0,0),
array(1,0,0,0,0,0,1,0,0),
array(1,0,0,0,0,0,1,0,0),
array(1,0,0,0,0,0,1,0,0),
array(1,0,0,0,0,0,1,0,0),
array(1,1,1,1,1,1,1,0,0),
array(1,0,0,0,0,0,1,0,0),
array(1,0,0,0,0,0,1,0,0),
array(1,0,0,0,0,0,1,0,0),
array(1,0,0,0,0,0,1,0,0),
array(1,0,0,0,0,0,1,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'I' => array(
array(0,1,1,1,1,1,1,1,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,1,1,1,1,1,1,1,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'J' => array(
array(0,0,0,0,0,0,1,1,1),
array(0,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,0,1),
array(0,1,0,0,0,0,0,0,1),
array(0,1,0,0,0,0,0,0,1),
array(0,0,1,0,0,0,0,1,0),
array(0,0,0,1,1,1,1,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'K' => array(
array(1,0,0,0,0,0,1,0,0),
array(1,0,0,0,0,1,0,0,0),
array(1,0,0,0,1,0,0,0,0),
array(1,0,0,1,0,0,0,0,0),
array(1,0,1,0,0,0,0,0,0),
array(1,1,0,0,0,0,0,0,0),
array(1,0,1,0,0,0,0,0,0),
array(1,0,0,1,0,0,0,0,0),
array(1,0,0,0,1,0,0,0,0),
array(1,0,0,0,0,1,0,0,0),
array(1,0,0,0,0,0,1,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'L' => array(
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(0,1,0,0,0,0,0,0,0),
array(0,0,1,1,1,1,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'M' => array(
array(0,1,0,0,0,0,0,1,0),
array(0,1,1,0,0,0,1,1,0),
array(0,1,0,1,0,1,0,1,0),
array(0,1,0,0,1,0,0,1,0),
array(0,1,0,0,0,0,0,1,0),
array(0,1,0,0,0,0,0,1,0),
array(0,1,0,0,0,0,0,1,0),
array(0,1,0,0,0,0,0,1,0),
array(0,1,0,0,0,0,0,1,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'N' => array(
array(1,0,0,0,0,0,0,0,1),
array(1,1,0,0,0,0,0,0,1),
array(1,0,1,0,0,0,0,0,1),
array(1,0,0,1,0,0,0,0,1),
array(1,0,0,0,1,0,0,0,1),
array(1,0,0,0,0,1,0,0,1),
array(1,0,0,0,0,0,1,0,1),
array(1,0,0,0,0,0,0,1,1),
array(1,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'O' => array(
array(0,0,0,1,1,1,0,0,0),
array(0,0,1,0,0,0,1,0,0),
array(0,1,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(0,1,0,0,0,0,0,1,0),
array(0,0,1,0,0,0,1,0,0),
array(0,0,0,1,1,1,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'P' => array(
array(1,1,1,1,1,1,0,0,0),
array(1,0,0,0,0,0,1,0,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,1,0,0),
array(1,1,1,1,1,1,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'Q' => array(
array(0,0,1,1,1,1,0,0,0),
array(0,1,0,0,0,0,1,0,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,1,0,0,1,0),
array(1,0,0,0,0,1,0,1,0),
array(0,1,0,0,0,0,1,0,0),
array(0,0,1,1,1,1,0,1,0),
array(0,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'R' => array(
array(1,1,1,1,1,1,0,0,0),
array(1,0,0,0,0,0,1,0,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,1,0,0),
array(1,1,1,1,1,1,0,0,0),
array(1,0,1,0,0,0,0,0,0),
array(1,0,0,1,0,0,0,0,0),
array(1,0,0,0,1,0,0,0,0),
array(1,0,0,0,0,1,0,0,0),
array(1,0,0,0,0,0,1,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'S' => array(
array(0,0,1,1,1,1,1,1,1),
array(0,1,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(0,1,0,0,0,0,0,0,0),
array(0,0,1,1,1,1,1,0,0),
array(0,0,0,0,0,0,0,1,0),
array(0,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,1,0),
array(1,1,1,1,1,1,1,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'T' => array(
array(1,1,1,1,1,1,1,1,1),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'U' => array(
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(0,1,0,0,0,0,0,1,0),
array(0,0,1,1,1,1,1,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'V' => array(
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(0,1,0,0,0,0,0,1,0),
array(0,0,1,0,0,0,1,0,0),
array(0,0,0,1,0,1,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'W' => array(
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,1,0,0,0,1),
array(1,0,0,1,0,1,0,0,1),
array(1,0,1,0,0,0,1,0,1),
array(1,1,0,0,0,0,0,1,1),
array(1,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'X' => array(
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(0,1,0,0,0,0,0,1,0),
array(0,0,1,0,0,0,1,0,0),
array(0,0,0,1,0,1,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,1,0,1,0,0,0),
array(0,0,1,0,0,0,1,0,0),
array(0,1,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'Y' => array(
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(0,1,0,0,0,0,0,1,0),
array(0,0,1,0,0,0,1,0,0),
array(0,0,0,1,0,1,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'Z' => array(
array(1,1,1,1,1,1,1,1,1),
array(1,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,1,0),
array(0,0,0,0,0,0,1,0,0),
array(0,0,0,0,0,1,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,1,0,0,0,0,0),
array(0,0,1,0,0,0,0,0,0),
array(0,1,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,1),
array(1,1,1,1,1,1,1,1,1),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'1' => array(
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,1,1,0,0,0,0),
array(0,0,1,0,1,0,0,0,0),
array(0,1,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,1,1,1,1,1,1,1,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'2' => array(
array(0,0,0,1,1,1,0,0,0),
array(0,0,1,0,0,0,1,0,0),
array(0,1,0,0,0,0,0,1,0),
array(0,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,1,0),
array(0,0,0,0,0,0,1,0,0),
array(0,0,0,0,0,1,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,1,0,0,0,0,0),
array(0,0,1,0,0,0,0,0,0),
array(0,1,1,1,1,1,1,1,1),
array(0,0,0,0,0,0,0,0,0),
),
'3' => array(
array(0,0,0,1,1,1,1,0,0),
array(0,0,1,0,0,0,0,1,0),
array(0,1,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,1,0),
array(0,0,0,0,0,1,1,0,0),
array(0,0,0,0,0,0,0,1,0),
array(0,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,0,1),
array(0,1,0,0,0,0,0,0,1),
array(0,0,1,0,0,0,0,1,0),
array(0,0,0,1,1,1,1,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'4' => array(
array(0,0,0,0,0,0,0,1,0),
array(0,0,0,0,0,0,1,1,0),
array(0,0,0,0,0,1,0,1,0),
array(0,0,0,0,1,0,0,1,0),
array(0,0,0,1,0,0,0,1,0),
array(0,0,1,0,0,0,0,1,0),
array(0,1,1,1,1,1,1,1,1),
array(0,0,0,0,0,0,0,1,0),
array(0,0,0,0,0,0,0,1,0),
array(0,0,0,0,0,0,0,1,0),
array(0,0,0,0,0,0,0,1,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'5' => array(
array(1,1,1,1,1,1,1,1,1),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(0,1,0,0,0,0,0,0,0),
array(0,0,1,1,1,1,1,0,0),
array(0,0,0,0,0,0,0,1,0),
array(0,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(0,1,0,0,0,0,0,1,0),
array(0,0,1,1,1,1,1,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'6' => array(
array(0,0,1,1,1,1,1,0,0),
array(0,1,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,0,0,0,0,0,0),
array(1,0,0,1,1,1,1,0,0),
array(1,0,1,0,0,0,0,1,0),
array(1,1,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(0,1,0,0,0,0,0,1,0),
array(0,0,1,1,1,1,1,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'7' => array(
array(1,1,1,1,1,1,1,1,1),
array(1,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,1,0),
array(0,0,0,0,0,0,1,0,0),
array(0,0,0,0,0,1,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,1,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'8' => array(
array(0,0,1,1,1,1,1,0,0),
array(0,1,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(0,1,0,0,0,0,0,1,0),
array(0,0,1,1,1,1,1,0,0),
array(0,1,0,0,0,0,0,1,0),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(1,0,0,0,0,0,0,0,1),
array(0,1,0,0,0,0,0,1,0),
array(0,0,1,1,1,1,1,0,0),
array(0,0,0,0,0,0,0,0,0),
),
'9' => array(
array(0,0,0,1,1,1,1,0,0),
array(0,0,1,0,0,0,0,1,0),
array(0,1,0,0,0,0,0,0,1),
array(0,1,0,0,0,0,0,0,1),
array(0,1,0,0,0,0,0,0,1),
array(0,1,0,0,0,0,0,1,1),
array(0,0,1,1,1,1,1,0,1),
array(0,0,0,0,0,0,0,0,1),
array(0,0,0,0,0,0,0,0,1),
array(0,1,0,0,0,0,0,0,1),
array(0,0,1,0,0,0,0,1,0),
array(0,0,0,1,1,1,1,0,0),
array(0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0),
),
)
);
}
}
?>

Some files were not shown because too many files have changed in this diff Show More