/[drupal]/contributions/modules/phpbbforum/phpbbforum.module
ViewVC logotype

Contents of /contributions/modules/phpbbforum/phpbbforum.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.49 - (show annotations) (download) (as text)
Thu Sep 3 16:31:57 2009 UTC (2 months, 3 weeks ago) by vb
Branch: MAIN
CVS Tags: HEAD
Changes since 1.48: +10 -2 lines
File MIME type: text/x-php
updated instructions
1 <?php
2 // $Id: phpbbforum.module,v 1.48 2009/09/02 18:19:02 vb Exp $
3 /**
4 * Copyright 2007-2009 by Vadim G.B. (http://vgb.org.ru, http://drupalbridge.org)
5 */
6
7 ////////////////////////////////////////////////////////////////////////////////
8 define('PHPBB_DRUPAL_MODULE_VERSION', 6);
9 define('PHPBB_DISABLE_MODULE', 0); // Only use in emergency
10 define('PHPBB_DISABLE_AUTO_LOGOUT', 0); // Only use if you are not able to login
11 define('PHPBB_MODULE_DEBUG', 0); // Do not change!
12 ////////////////////////////////////////////////////////////////////////////////
13
14 define('PHPBB_DRUPAL_MODULE', 'phpbbforum');
15 define('PHPBB_DRUPAL_MODULE_TAG', 'phpBBforum');
16
17 define('PHPBB_API_FILE', 'phpbb_api.php');
18 define('PHPBB_API_INCLUDE_PATH', '/includes/');
19 define('PHPBB_PATH', '/phpBB3/');
20 define('PHPBB_PAGE', 'phpbbforum');
21
22 define('PHPBB_SYNC_TO_PHPBB', 'to phpBB');
23 define('PHPBB_SYNC_TO_DRUPAL', 'to Drupal');
24 define('PHPBB_SYNC_TO_MASTER', 'to master');
25
26 @define('A_SYNC_TO_UNDEFINED', 0);
27 @define('A_SYNC_TO_ME', 1);
28 @define('A_SYNC_TO_EXTERNAL', 2);
29 @define('A_SYNC_TO_MASTER', 3);
30 @define('A_SYNC_TO_FINISHED', -1);
31
32 define('PHPBB_NUM_RECENT_POSTS', 10);
33 define('PHPBB_NUM_RECENT_TOPICS', 10);
34
35 define('PHPBB_RECENT_DELIMITER_SPACE', " ");
36 define('PHPBB_RECENT_DELIMITER_BR', "<br />");
37
38 define('PHPBB_COOKIELENGTH', 1440);
39 define('PHPBB_NUM_WHOS_ONLINE', 9999);
40 define('PHPBB_NUM_TOP_POSTERS', 5);
41
42 require_once(dirname(__FILE__) .'/phpbbforum.theme.inc');
43 require_once(dirname(__FILE__) .'/phpbbforum.pages.inc');
44 require_once(dirname(__FILE__) .'/phpbbforum.hooks.inc');
45
46 global $phpbb_root_path, $_drupal_base_path, $site_base_url, $site_phpbb_page, $_phpbb_base_path,
47 $_phpbb_forum_url, $site_forum_url, $_phpbb_integration_mode, $_phpbb_acp_integration_mode,
48 $_phpbb_result, $_phpbb_embed_mode, $phpbb_hook;
49 // Needed for handle_message_list_actions()
50 global $refresh, $submit, $preview;
51
52 _phpbbforum_set_globals();
53
54 function _phpbbforum_set_globals() {
55 global $phpbb_config, $base_url, $base_path, $base_root, $_drupal_base_path, $phpbb_root_path, $_phpbb_base_path, $_phpbb_result, $_phpbb_embed_mode,
56 $site_base_url, $site_phpbb_page, $site_forum_url, $_phpbb_integration_mode, $_phpbb_acp_integration_mode;
57
58 $site_base_url = $base_url;
59 $site_phpbb_page = drupal_get_path_alias(PHPBB_PAGE);
60 $_drupal_base_path = realpath('.');
61
62 $phpbb_root_path = variable_get('phpbbforum_root', $_drupal_base_path . PHPBB_PATH);
63
64 $_phpbb_base_path = substr($phpbb_root_path, strlen($_drupal_base_path) + 1);
65
66 $_phpbb_integration_mode = variable_get("phpbbforum_page_frame", 0);
67 $_phpbb_acp_integration_mode = variable_get("phpbbforum_page_frame_acp", 0);
68
69 $_phpbb_embed_mode = array();
70
71 $site_forum_url = $base_url .'/'. $site_phpbb_page;
72
73 if (PHPBB_DRUPAL_MODULE_VERSION == 5) {
74 $theme_custom_inc = dirname(__FILE__) .'/phpbbforum.theme.custom.inc';
75 if (file_exists($theme_custom_inc)) {
76 require_once($theme_custom_inc);
77 }
78 }
79 else {
80 module_load_include('theme.custom.inc', 'phpbbforum');
81 }
82
83 /*
84 if (module_exists('a_sync')) {
85 module_load_include('a_sync.inc', 'phpbbforum');
86 }
87
88 if (module_exists('services')) {
89 module_load_include('service.inc', 'phpbbforum');
90 }
91 */
92 }
93
94 function phpbbforum_init() {
95 //variable_set("phpbbforum_result", array());
96 }
97
98 function _phpbbforum_settings() {
99 if (PHPBB_DISABLE_MODULE)
100 return false;
101 $phpbb_root_path = variable_get('phpbbforum_root', '');
102 $phpbbsettings = $phpbb_root_path .'config.php';
103 $phpbbinc = variable_get('phpbbforum_inc', '');
104 $phpbbapifile = variable_get('phpbbforum_api_file', PHPBB_API_FILE);
105 $phpbbapi = $phpbbinc . $phpbbapifile;
106 if (file_exists($phpbbapi) && file_exists($phpbbsettings)) {
107 require_once($phpbbapi);
108 return true;
109 }
110 else {
111 return false;
112 }
113 }
114
115 if (PHPBB_DRUPAL_MODULE_VERSION == 5) {
116
117 function phpbbforum_help($section) { // 5.x
118 $output = '';
119 switch ($section) {
120 case 'admin/help#phpbbforum':
121 break;
122 case 'admin/modules#description':
123 $output .= t('This module provides integration with phpBB Forum.');
124 break;
125 }
126 return $output;
127 }
128
129 function phpbbforum_menu($maycache) { // 5.x
130 if (variable_get("phpbbforum_page_frame", 0) == '1' || variable_get("phpbbforum_page_frame", 0) == '2') {
131 $items[] = array(
132 'path' => 'phpbbforum',
133 //'title' => t('phpBB Forum'),
134 'access' => user_access('access content'),
135 //'access' => user_access('access forum'),
136 'callback' => 'phpbbforum_page',
137 'type' => MENU_SUGGESTED_ITEM,
138 //'type' => MENU_NORMAL_ITEM,
139 );
140 }
141 $items[] = array(
142 'path' => 'admin/settings/phpbbforum',
143 'title' => t('phpBBforum settings'),
144 'description' => t('Change phpBBforum integration settings'),
145 'callback' => 'drupal_get_form',
146 'callback arguments' => 'phpbbforum_admin_settings',
147 'access' => user_access('administer site configuration'),
148 'type' => MENU_NORMAL_ITEM,
149 );
150 return $items;
151 }
152
153 function phpbbforum_admin_settings() { // 5.x
154 // Only administrators can access this page
155 if (!user_access('access administration pages'))
156 return message_access();
157
158 $form = _phpbbforum_admin_settings();
159 return system_settings_form($form); // 5.x
160 }
161
162 /**
163 * Implementation of hook_form_alter().
164 */
165 function phpbbforum_form_alter($form_id, &$form) { // 5.x
166 global $phpbb_user;
167 if ($form_id == 'user_login_block' || $form_id == 'user_login') {
168 global $phpbb_config;
169 $phpbb_url = $phpbb_config['forum_url'];
170 $phpbb_master = variable_get('phpbbforum_master', 1);
171 if ($phpbb_master && !empty($phpbb_url)) {
172 global $site_base_url, $site_forum_url, $phpEx, $_phpbb_integration_mode;
173 if ($_phpbb_integration_mode == 1 || $_phpbb_integration_mode == 2) {
174 $phpbb_url = $site_forum_url;
175 }
176 $new_account = append_sid("{$phpbb_url}/ucp.$phpEx", 'mode=register');
177 $new_password = append_sid("{$phpbb_url}/ucp.$phpEx", 'mode=sendpassword');
178 $items = array();
179 if (variable_get('user_register', 1)) {
180 $items[] = l(t('Create new account'), $new_account, array('title' => t('Create a new user account.')));
181 }
182 $items[] = l(t('Request new password'), $new_password, array('title' => t('Request new password via e-mail.')));
183 $form['links'] = array('#value' => theme('item_list', $items));
184 }
185 }
186 elseif ($form_id == 'node_type_form' && isset($form['identity']['type'])) {
187 // Alter the node type's configuration form to add our setting. We don't
188 // need to worry about saving this value back to the variable, the form
189 // we're altering will do it for us.
190 if (variable_get('phpbbforum_submission', true)) {
191
192 $form['phpbbforum'] = array(
193 '#type' => 'fieldset',
194 '#title' => t('phpBBforum submission settings'),
195 '#collapsible' => TRUE,
196 '#collapsed' => TRUE,
197 );
198
199 $form['phpbbforum']['phpbbforum_submission'] = array(
200 '#type' => 'radios',
201 '#title' => t('Drupal to phpBB submission'),
202 '#default_value' => variable_get('phpbbforum_submission_'. $form['#node_type']->type, 0),
203 '#options' => array(0 => t('Disabled'), 1 => t('Enabled')),
204 '#description' => t('Should this node be able to submit a post to the phpBB forum?'),
205 );
206
207 $form['phpbbforum']['phpbbforum_submission_teaser'] = array(
208 '#type' => 'radios',
209 '#title' => t('Create a post from teaser or full node content'),
210 '#default_value' => variable_get('phpbbforum_submission_teaser_'. $form['#node_type']->type, 1),
211 '#options' => array(0 => t('Full node content'), 1 => t('Teaser'), 2 => t('No node content. Back link only, if enabled.')),
212 '#description' => t('Create a post to the phpBB forum from teaser or full node content?'),
213 );
214
215 $form['phpbbforum']['phpbbforum_backlink_default'] = array(
216 '#type' => 'checkbox',
217 '#title' => t("Add back link"),
218 '#default_value' => variable_get('phpbbforum_backlink_default_'. $form['#node_type']->type, 1),
219 '#description' => t("Default back link setting")
220 );
221
222 $form['phpbbforum']['phpbbforum_commentlink_default'] = array(
223 '#type' => 'checkbox',
224 '#title' => t("Add comment link"),
225 '#default_value' => variable_get('phpbbforum_commentlink_default_'. $form['#node_type']->type, 1),
226 '#description' => t("Default comment link setting")
227 );
228
229 $form['phpbbforum']['phpbbforum_comment_location'] = array(
230 '#type' => 'radios',
231 '#title' => t("Location of phpBB topic comments"),
232 '#default_value' => variable_get('phpbbforum_comment_location_'. $form['#node_type']->type, 0),
233 '#options' => array(
234 0 => t('Display only on the phpBBforum page'),
235 1 => t('Display below the post'),
236 //2 => t('Display on a separate tab'),
237 ),
238 //'#description' => t("Default setting")variable_get('phpbbforum_comment_drupal_'. $node->type, 0)
239 );
240
241 if (variable_get('phpbbforum_comment_location_'. $form['#node_type']->type, 0)) {
242 $form['phpbbforum']['phpbbforum_comment_drupal'] = array(
243 '#type' => 'radios',
244 '#title' => t("Display Drupal comments"),
245 '#default_value' => variable_get('phpbbforum_comment_drupal_'. $form['#node_type']->type, 0),
246 '#options' => array(
247 0 => t('Display only phpBB comments'),
248 1 => t('Display both Drupal and phpBB comments'),
249 ),
250 );
251 }
252
253 $form['phpbbforum']['phpbbforum_commentlink_text_nocomments'] = array(
254 '#type' => 'textfield',
255 '#title' => t("Link text when no comments are posted"),
256 '#default_value' => variable_get('phpbbforum_commentlink_text_nocomments_'. $form['#node_type']->type, variable_get('phpbbforum_commentlink_text_nocomments', t('Discuss'))),
257 );
258
259 $form['phpbbforum']['phpbbforum_commentlink_text_comments'] = array(
260 '#type' => 'textfield',
261 '#title' => t("Link text when one or more comments are posted"),
262 '#default_value' => variable_get('phpbbforum_commentlink_text_comments_'. $form['#node_type']->type, variable_get('phpbbforum_commentlink_text_comments', t('Discuss'))),
263 );
264
265 $form['phpbbforum']['phpbbforum_submission_forum_ids_exclude'] = array(
266 '#type' => 'radios',
267 '#title' => t('Include or exclude phpBB forum ids in the list'),
268 '#default_value' => variable_get('phpbbforum_submission_forum_ids_exclude_'. $form['#node_type']->type, 1),
269 '#options' => array(0 => t('Include'), 1 => t('Exclude')),
270 //'#description' => t('Include or exclude phpBB forum ids in the list'),
271 );
272
273 $form['phpbbforum']['phpbbforum_submission_forum_ids_list'] = array(
274 '#type' => 'textfield',
275 '#title' => t('phpBB forum id list'),
276 '#default_value' => variable_get('phpbbforum_submission_forum_ids_list_'. $form['#node_type']->type, ''),
277 '#description' => t('Enter phpBB forum id list, for example, 2,5,6,12'),
278 );
279 }
280 }
281 // If the type and node field are set this may be a node edit form.
282 elseif (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) {
283
284 if (variable_get('phpbbforum_submission', true) && variable_get('phpbbforum_submission_'. $form['type']['#value'], 0)) {
285
286 $node = $form['#node'];
287
288 $defaults = _phpbbforum_get_defaults($node->nid, $node->type);
289
290 $form['phpbbforum'] = array(
291 '#type' => 'fieldset',
292 '#title' => t('phpBBforum submission settings'),
293 '#collapsible' => TRUE,
294 '#collapsed' => TRUE,
295 );
296
297 $form['phpbbforum']['phpbbforum_forumid'] = array(
298 '#type' => 'select',
299 '#title' => t('Submit this node to'),
300 '#default_value' => $defaults['forum'],
301 '#description' => t('If you choose a forum, a phpbb topic with the node\'s content will be created in the specified forum.'),
302 '#options' => _phpbbforum_get_accessable_forums($phpbb_user->data['user_id'],
303 variable_get('phpbbforum_submission_forum_ids_list_'. $node->type, ''),
304 variable_get('phpbbforum_submission_forum_ids_exclude_'. $node->type, 1)
305 ),
306 );
307
308 $form['phpbbforum']['phpbbforum_submission_teaser'] = array(
309 '#type' => 'radios',
310 '#title' => t('Create a post from teaser or full node content'),
311 '#default_value' => variable_get('phpbbforum_submission_teaser_'. $node->type, 1),
312 '#options' => array(0 => t('Full node content'), 1 => t('Teaser'), 2 => t('No node content. Back link only, if enabled.')),
313 '#description' => t('Create a post to the phpBB forum from teaser or full node content?'),
314 );
315
316 $form['phpbbforum']['phpbbforum_commentlink'] = array(
317 '#type' => 'checkbox',
318 '#title' => t('Add comment link'),
319 '#default_value' => $defaults['linked'],
320 );
321
322 }
323 }
324 elseif ($form_id == 'user_register') {
325 }
326 }
327
328 }
329 else { // 6.0
330
331 function phpbbforum_help($path, $arg) {
332 $output = '';
333 switch ($path) {
334 case 'admin/help#phpbbforum':
335 break;
336 case 'admin/modules#description':
337 $output .= t('This module provides integration with phpBB3 Forum.');
338 break;
339 }
340 return $output;
341 }
342
343 /*
344 function phpbbforum_access($op, $node, $account) {
345
346 if ($op == 'create') {
347 return user_access('create forum topics', $account);
348 }
349
350 if ($op == 'update' || $op == 'delete') {
351 if (user_access('edit own forum topics', $account) && ($account->uid == $node->uid)) {
352 return TRUE;
353 }
354 }
355
356 if ($op == 'view') {
357 return user_access('access content');
358 }
359 }
360
361
362 function phpbbforum_perm() {
363 return array('view forum', 'administer_forum', 'moderate_forum');
364 }
365 */
366
367 function phpbbforum_menu() { // 6.0
368
369 $items = array();
370
371 if (variable_get("phpbbforum_page_frame", 0) == '1' || variable_get("phpbbforum_page_frame", 0) == '2') {
372 $items['phpbbforum'] = array(
373 //'title' => t('phpBB Forum'),
374 'page callback' => 'phpbbforum_page',
375 'access callback' => 'user_access',
376 'access arguments' => array('access content'),
377 'type' => MENU_SUGGESTED_ITEM,
378 //'type' => MENU_NORMAL_ITEM,
379 );
380 }
381
382 $items['admin/settings/phpbbforum'] = array(
383 'title' => t('phpBBforum settings'),
384 'description' => t('Change phpBBforum integration settings'),
385 'page callback' => 'drupal_get_form',
386 'page arguments' => array('phpbbforum_admin_settings'),
387 'access arguments' => array('administer site configuration'),
388 'type' => MENU_NORMAL_ITEM
389 );
390
391 return $items;
392 }
393
394 function phpbbforum_admin_settings() { // 6.x
395 $form = _phpbbforum_admin_settings();
396 return system_settings_form($form);
397 }
398
399 /**
400 * Implementation of hook_form_alter().
401 */
402 function phpbbforum_form_alter(&$form, $form_state, $form_id) { // 6.x
403 global $phpbb_user;
404 if ($form_id == 'user_login_block' || $form_id == 'user_login') {
405 /*if (PHPBB_MODULE_DEBUG) {
406 drupal_set_message('PHPBB Form validators before');
407 $message = print_r($form['#validate'], true);
408 drupal_set_message($message);
409 }*/
410
411 $form['#validate'] = phpbbforum_login_validators($form);
412
413 /*if (PHPBB_MODULE_DEBUG) {
414 drupal_set_message('PHPBB Form validators after');
415 $message = print_r($form['#validate'], true);
416 drupal_set_message($message);
417 }*/
418
419 // Get forum URL
420 global $phpbb_config;
421 $phpbb_url = $phpbb_config['forum_url'];
422 $phpbb_master = variable_get('phpbbforum_master', 1);
423 if ($phpbb_master && !empty($phpbb_url)) {
424 global $site_base_url, $site_forum_url, $phpEx, $_phpbb_integration_mode;
425 if ($_phpbb_integration_mode == 1 || $_phpbb_integration_mode == 2) {
426 $phpbb_url = $site_forum_url;
427 }
428 $new_account = append_sid("{$phpbb_url}/ucp.$phpEx", 'mode=register');
429 $new_password = append_sid("{$phpbb_url}/ucp.$phpEx", 'mode=sendpassword');
430 $items = array();
431 if (variable_get('user_register', 1)) {
432 $items[] = l(t('Create new account'), $new_account, array('title' => t('Create a new user account.')));
433 }
434 $items[] = l(t('Request new password'), $new_password, array('title' => t('Request new password via e-mail.')));
435 $form['links'] = array('#value' => theme('item_list', $items));
436 }
437 }
438 elseif ($form_id == 'node_type_form' && isset($form['identity']['type'])) {
439 // Alter the node type's configuration form to add our setting. We don't
440 // need to worry about saving this value back to the variable, the form
441 // we're altering will do it for us.
442 if (variable_get('phpbbforum_submission', true)) {
443
444 $form['phpbbforum'] = array(
445 '#type' => 'fieldset',
446 '#title' => t('phpBBforum submission settings'),
447 '#collapsible' => TRUE,
448 '#collapsed' => TRUE,
449 );
450
451 $form['phpbbforum']['phpbbforum_submission'] = array(
452 '#type' => 'radios',
453 '#title' => t('Drupal to phpBB submission'),
454 '#default_value' => variable_get('phpbbforum_submission_'. $form['#node_type']->type, 0),
455 '#options' => array(0 => t('Disabled'), 1 => t('Enabled')),
456 '#description' => t('Should this node be able to submit a post to the phpBB forum?'),
457 );
458
459 $form['phpbbforum']['phpbbforum_submission_teaser'] = array(
460 '#type' => 'radios',
461 '#title' => t('Create a post from teaser or full node content'),
462 '#default_value' => variable_get('phpbbforum_submission_teaser_'. $form['#node_type']->type, 1),
463 '#options' => array(0 => t('Full node content'), 1 => t('Teaser'), 2 => t('No node content. Back link only, if enabled.')),
464 '#description' => t('Create a post to the phpBB forum from teaser or full node content?'),
465 );
466
467 $form['phpbbforum']['phpbbforum_backlink_default'] = array(
468 '#type' => 'checkbox',
469 '#title' => t("Add back link"),
470 '#default_value' => variable_get('phpbbforum_backlink_default_'. $form['#node_type']->type, 1),
471 '#description' => t("Default back link setting")
472 );
473
474 $form['phpbbforum']['phpbbforum_commentlink_default'] = array(
475 '#type' => 'checkbox',
476 '#title' => t("Add comment link"),
477 '#default_value' => variable_get('phpbbforum_commentlink_default_'. $form['#node_type']->type, 1),
478 '#description' => t("Default comment link setting")
479 );
480
481 $form['phpbbforum']['phpbbforum_comment_location'] = array(
482 '#type' => 'radios',
483 '#title' => t("Location of phpBB topic comments"),
484 '#default_value' => variable_get('phpbbforum_comment_location_'. $form['#node_type']->type, 0),
485 '#options' => array(
486 0 => t('Display only on the phpBBforum page'),
487 1 => t('Display below the post'),
488 //2 => t('Display on a separate tab'),
489 ),
490 //'#description' => t("Default setting")variable_get('phpbbforum_comment_drupal_'. $node->type, 0)
491 );
492
493 if (variable_get('phpbbforum_comment_location_'. $form['#node_type']->type, 0)) {
494 $form['phpbbforum']['phpbbforum_comment_drupal'] = array(
495 '#type' => 'radios',
496 '#title' => t("Display Drupal comments"),
497 '#default_value' => variable_get('phpbbforum_comment_drupal_'. $form['#node_type']->type, 0),
498 '#options' => array(
499 0 => t('Display only phpBB comments'),
500 1 => t('Display both Drupal and phpBB comments'),
501 ),
502 );
503 }
504
505 $form['phpbbforum']['phpbbforum_commentlink_text_nocomments'] = array(
506 '#type' => 'textfield',
507 '#title' => t("Link text when no comments are posted"),
508 '#default_value' => variable_get('phpbbforum_commentlink_text_nocomments_'. $form['#node_type']->type, variable_get('phpbbforum_commentlink_text_nocomments', t('Discuss'))),
509 );
510
511 $form['phpbbforum']['phpbbforum_commentlink_text_comments'] = array(
512 '#type' => 'textfield',
513 '#title' => t("Link text when one or more comments are posted"),
514 '#default_value' => variable_get('phpbbforum_commentlink_text_comments_'. $form['#node_type']->type, variable_get('phpbbforum_commentlink_text_comments', t('Discuss'))),
515 );
516
517 $form['phpbbforum']['phpbbforum_submission_forum_ids_exclude'] = array(
518 '#type' => 'radios',
519 '#title' => t('Include or exclude phpBB forum ids in the list'),
520 '#default_value' => variable_get('phpbbforum_submission_forum_ids_exclude_'. $form['#node_type']->type, 1),
521 '#options' => array(0 => t('Include'), 1 => t('Exclude')),
522 //'#description' => t('Include or exclude phpBB forum ids in the list'),
523 );
524
525 $form['phpbbforum']['phpbbforum_submission_forum_ids_list'] = array(
526 '#type' => 'textfield',
527 '#title' => t('phpBB forum id list'),
528 '#default_value' => variable_get('phpbbforum_submission_forum_ids_list_'. $form['#node_type']->type, ''),
529 '#description' => t('Enter phpBB forum id list, for example, 2,5,6,12'),
530 );
531 }
532 }
533 // If the type and node field are set this may be a node edit form.
534 elseif (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) {
535
536 if (variable_get('phpbbforum_submission', true) && variable_get('phpbbforum_submission_'. $form['type']['#value'], 0)) {
537
538 $node = $form['#node'];
539
540 $defaults = _phpbbforum_get_defaults($node->nid, $node->type);
541
542 $form['phpbbforum'] = array(
543 '#type' => 'fieldset',
544 '#title' => t('phpBBforum submission settings'),
545 '#collapsible' => TRUE,
546 '#collapsed' => TRUE,
547 );
548
549 $form['phpbbforum']['phpbbforum_forumid'] = array(
550 '#type' => 'select',
551 '#title' => t('Submit this node to'),
552 '#default_value' => $defaults['forum'],
553 '#description' => t('If you choose a forum, a phpbb topic with the node\'s content will be created in the specified forum.'),
554 '#options' => _phpbbforum_get_accessable_forums($phpbb_user->data['user_id'],
555 variable_get('phpbbforum_submission_forum_ids_list_'. $node->type, ''),
556 variable_get('phpbbforum_submission_forum_ids_exclude_'. $node->type, 1)
557 ),
558 );
559
560 $form['phpbbforum']['phpbbforum_submission_teaser'] = array(
561 '#type' => 'radios',
562 '#title' => t('Create a post from teaser or full node content'),
563 '#default_value' => variable_get('phpbbforum_submission_teaser_'. $node->type, 1),
564 '#options' => array(0 => t('Full node content'), 1 => t('Teaser'), 2 => t('No node content. Back link only, if enabled.')),
565 '#description' => t('Create a post to the phpBB forum from teaser or full node content?'),
566 );
567
568 $form['phpbbforum']['phpbbforum_commentlink'] = array(
569 '#type' => 'checkbox',
570 '#title' => t('Add comment link'),
571 '#default_value' => $defaults['linked'],
572 );
573
574 }
575 }
576 elseif ($form_id == 'user_register') {
577
578 }
579 //if (PHPBB_MODULE_DEBUG) {
580 // _phpbbforum_set_message('Formid='.$form_id);
581 //}
582 return $form;
583 }
584
585
586 function phpbbforum_login_validators($form) {
587
588 //if (PHPBB_MODULE_DEBUG)
589 //return $form['#validate'];
590 if (is_array($form['#validate'])) {
591 $key = array_search('user_login_authenticate_validate', $form['#validate']);
592 if ($key !== false)
593 unset($form['#validate'][$key]);
594 $key = array_search('user_login_name_validate', $form['#validate']);
595 if ($key !== false)
596 unset($form['#validate'][$key]);
597 $key = array_search('user_login_final_validate', $form['#validate']);
598 if ($key !== false)
599 unset($form['#validate'][$key]);
600 $validators = $form['#validate'];
601 $form_validate = true;
602 }
603 else {
604 $validators = array();
605 $form_validate = false;
606 }
607
608 if (!$form_validate || (!module_exists('ldapauth') && !module_exists('logintoboggan'))) {
609 $validators[] = 'user_login_name_validate';
610 }
611 if (!$form_validate || !module_exists('ldapauth')) {
612 $validators[] = 'user_login_authenticate_validate';
613 }
614 $validators[] = 'phpbbforum_login_authenticate_validate';
615 $validators[] = 'user_login_final_validate';
616
617 return $validators;
618 }
619
620 /**
621 * A validate handler on the login form. Check supplied username/password
622 * against local users table. If successful, sets the global $user object.
623 */
624 function phpbbforum_login_authenticate_validate($form, &$form_state) {
625 global $user;
626 if (!$user->uid) {
627 $pass = trim($form_state['values']['pass']);
628 if (!empty($pass)) {
629 phpbbforum_external_login_register($form_state['values']['name'], $pass);
630 if ($user->uid) {
631 user_authenticate_finalize($form_state['values']);
632 }
633 }
634 }
635 }
636
637 if (module_exists('ldapauth')) {
638 function phpbbforum_ldapauth_login_validate($form, &$form_state) {
639 global $user;
640 if (!$user->uid) {
641 $pass = trim($form_state['values']['pass']);
642 if (!empty($pass)) {
643 ldapauth_login_validate($form, $form_state);
644 }
645 }
646 }
647 }
648
649 } // 6
650
651 /**
652 * Specifies the default parameters for the node.
653 * Checks if the node was already submitted and gets the parameters used.
654 *
655 * @param integer $node_id
656 * @return array default: array ('forum' => 0, 'linked' => 0);
657 */
658 function _phpbbforum_get_defaults($node_id, $node_type) {
659
660 $defaults = array (
661 'forum' => _phpbbforum_variable_get('phpbbforum_forumid_default_'. $node_type, 0),
662 'linked' => _phpbbforum_variable_get('phpbbforum_commentlink_default_'. $node_type, 1),
663 );
664
665 if (!is_numeric($node_id))
666 return $defaults;
667
668 $topic = db_fetch_object(db_query('SELECT topic_id, linked FROM {drupal2phpbb} WHERE node_id = %d', $node_id));
669
670 if (is_object($topic)) {
671 $postInformation = phpbb_api_get_post_information($topic->topic_id);
672 if (isset($postInformation['forum_id']) && is_numeric($postInformation['forum_id']) )
673 $defaults['forum'] = $postInformation['forum_id'];
674 $defaults['linked'] = $topic->linked;
675 }
676
677 return $defaults;
678 }
679
680 /**
681 * Returns an array with the forums, in which the user can create a thread
682 * and post messages.
683 *
684 * @param integer $user_id
685 * @return array (forum_id => forum_name);
686 */
687 function _phpbbforum_get_accessable_forums($user_id, $forum_ids = '', $exclude = 0) {
688
689 if (_phpbbforum_settings())
690 $forums = phpbb_api_get_accessable_forums($user_id, $forum_ids, $exclude);
691
692 $forums[0] = t('Don\'t submit this node');
693
694 return $forums;
695 }
696
697 /**
698 * Implementation of hook_link()
699 */
700 /*
701 function phpbbforum_link_alter(&$links, $node) {
702
703 global $phpbb_config, $site_base_url, $site_forum_url, $phpEx, $_phpbb_integration_mode, $phpbb_root_path, $phpEx;
704
705 if (!_phpbbforum_settings() || !variable_get('phpbbforum_submission', false) || !variable_get('phpbbforum_submission_'.$node->type, false))
706 return;
707
708 $map = db_fetch_object(db_query('SELECT topic_id, linked FROM {drupal2phpbb} WHERE node_id = %d', $node->nid));
709
710 if ($map === FALSE || $map->linked == 0)
711 return;
712
713 $postInformation = phpbb_api_get_post_information($map->topic_id);
714
715 if (empty($postInformation) || !isset($postInformation['forum_id']) || !isset($postInformation['topic_id']) || !isset($postInformation['post_id']))
716 return;
717
718 if ($postInformation['countPosts'] === 0)
719 //$title = t('!comments '.variable_get('phpbbforum_commentlink_text_nocomments_'.$object->type, ''), array ('!comments' => format_plural ($postInformation['countPosts'], '1 comment', '@count comments')));
720 $title = t(variable_get('phpbbforum_commentlink_text_nocomments_'.$node->type, '').' (!comments) ', array ('!comments' => format_plural ($postInformation['countPosts'], '1 comment', '@count comments')));
721 else
722 //$title = t('!comments '.variable_get('phpbbforum_commentlink_text_comments_'.$object->type, ''), array ('!comments' => format_plural ($postInformation['countPosts'], '1 comment', '@count comments')));
723 $title = t(variable_get('phpbbforum_commentlink_text_comments_'.$node->type, '') .' (!comments) ', array ('!comments' => format_plural ($postInformation['countPosts'], '1 comment', '@count comments')));
724
725 $phpbb_url = $phpbb_config['forum_url'];
726 if ($_phpbb_integration_mode == 1 || $_phpbb_integration_mode == 2) {
727 $phpbb_url = $site_forum_url;
728 }
729 if (empty($links['phpbbforum_comment'])) {
730 $links['phpbbforum_comment'] = array (
731 'title' => $title,
732 'href' => html_entity_decode(append_sid("{$phpbb_url}/viewtopic.$phpEx", "f=".$postInformation['forum_id']."&t=".$postInformation['topic_id']."#p".$postInformation['post_id'])),
733 );
734 }
735 }
736 */
737 /**
738 * Preprocessing node template.
739 */
740 function phpbbforum_preprocess_node(&$vars) {
741
742 $node = $vars['node'];
743
744 if (variable_get('phpbbforum_submission', true) && variable_get('phpbbforum_submission_'. $node->type, false) && user_access('access comments')) {
745 $enabled = variable_get('phpbbforum_comment_location_'. $node->type, 0);
746 if ($enabled) {
747
748 if (!_phpbbforum_settings())
749 return;
750
751 $teaser = $vars['teaser'];
752
753 $post = db_fetch_object(db_query("SELECT topic_id, linked FROM {drupal2phpbb} WHERE node_id = %d", $node->nid));
754 if ($post !== false) {
755 global $phpbb_config, $site_base_url, $site_forum_url, $phpEx, $_phpbb_integration_mode, $phpbb_root_path, $phpEx;
756 global $_phpbbforum_comments_mode;
757
758 $postInformation = phpbb_api_get_post_information($post->topic_id);
759
760 //if (empty($postInformation) || !isset($postInformation['forum_id']) || !isset($postInformation['topic_id']) || !isset($postInformation['post_id']))
761 // return;
762 /*
763 if ($postInformation['countPosts'] === 0)
764 //$title = t('!comments '.variable_get('phpbbforum_commentlink_text_nocomments_'.$object->type, ''), array ('!comments' => format_plural ($postInformation['countPosts'], '1 comment', '@count comments')));
765 $title = t(variable_get('phpbbforum_commentlink_text_nocomments_'.$node->type, '').' (!comments) ', array ('!comments' => format_plural ($postInformation['countPosts'], '1 comment', '@count comments')));
766 else
767 //$title = t('!comments '.variable_get('phpbbforum_commentlink_text_comments_'.$object->type, ''), array ('!comments' => format_plural ($postInformation['countPosts'], '1 comment', '@count comments')));
768 $title = t(variable_get('phpbbforum_commentlink_text_comments_'.$node->type, '') .' (!comments) ', array ('!comments' => format_plural ($postInformation['countPosts'], '1 comment', '@count comments')));
769 */
770 $phpbb_url = $phpbb_config['forum_url'];
771 if ($_phpbb_integration_mode == 1 || $_phpbb_integration_mode == 2) {
772 $phpbb_url = $site_forum_url;
773 }
774 //if (empty($links['phpbbforum_comment'])) {
775 $href = html_entity_decode(append_sid("{$phpbb_url}/viewtopic.$phpEx", "f=".$postInformation['forum_id']."&t=".$postInformation['topic_id']."#p".$postInformation['post_id']));
776 /*
777 $node->links['phpbbforum_comment'] = array (
778 //$vars['links']['phpbbforum_comment'] = array (
779 'title' => $title,
780 'href' => html_entity_decode(append_sid("{$phpbb_url}/viewtopic.$phpEx", "f=".$postInformation['forum_id']."&t=".$postInformation['topic_id']."#p".$postInformation['post_id'])),
781 );
782 //}
783 */
784 $query = array();
785
786 $vars['phpbbforum_comments'] = _phpbbforum_comment_render($node, $href, $teaser, $query);
787
788 if (!variable_get('phpbbforum_comment_drupal_'. $node->type, 0)) {
789 $node->comment = null;
790 //variable_get('phpbbforum_commentlink_default_'. $node_type, 1)
791 if (!empty($node->links)) {
792 //if (!isset($node->links['comment_forbidden'])) {
793 if (user_access('post comments')) {
794 $node->links['comment_add']['href'] = _phpbbforum_posting_destination($query);
795 $node->links['comment_add']['fragment'] = null;
796 }
797 //}
798 //else {
799 if (isset($node->links['comment_forbidden'])) {
800 unset($node->links['comment_forbidden']);
801 }
802 }
803 }
804 if (!empty($node->links)) {
805 if (!$post->linked) {
806 unset($node->links['phpbbforum_comment']);
807 }
808 // refresh $links
809 $vars['links'] = theme('links', $node->links, array('class' => 'links inline'));
810 }
811 }
812 }
813 }
814 }
815
816 /**
817 * Implemantation of hook_nodeapi()
818 */
819 function phpbbforum_nodeapi(&$node, $op, $teaser, $page) {
820
821 if (!_phpbbforum_settings())
822 return;
823
824 switch ($op) {
825
826 case 'validate':
827
828 if (variable_get('phpbbforum_submission_'. $node->type, false)) {
829 if (isset($node->phpbbforum_forumid) && $node->phpbbforum_forumid && !_phpbbforum_nodeapi_validate_forumid($node->phpbbforum_forumid))
830 form_set_error('phpbbforum_forumid', t('Cannot submit node to the selected forum. Please try again.'));
831 }
832
833 break;
834
835
836 case 'view':
837 /*
838 if (!variable_get('phpbbforum_submission', true) || !variable_get('phpbbforum_submission_'.$node->type, false))
839 break;
840 if ($node->phpbbforum_forumid == 0)
841 break;
842
843 global $phpbb_config, $phpbb_user, $base_url, $phpbb_root_path,
844 $site_base_url, $site_phpbb_page, $site_forum_url, $_phpbb_integration_mode;
845
846 if (PHPBB_MODULE_DEBUG) {
847 drupal_set_message('Op='. $op .' teaser='. $teaser.' show='. variable_get('phpbbforum_submission_teaser_'. $node->type, true));
848
849 $message = $filteredText .'<div id="topic-backlink"><p>'. $a_backlink .'</p></div>';
850 drupal_set_message('Message='. $message);
851
852 }
853 */
854 break;
855
856
857 case 'insert':
858 case 'update':
859
860 //if (PHPBB_MODULE_DEBUG)
861 //drupal_set_message('Op='. $op .' teaser='. $teaser.' show='. variable_get('phpbbforum_submission_teaser_'. $node->type, true));
862
863 if (!variable_get('phpbbforum_submission', true) || !variable_get('phpbbforum_submission_'. $node->type, false))
864 break;
865 if ($node->phpbbforum_forumid == 0)
866 break;
867
868 global $phpbb_config, $phpbb_user, $base_url, $phpbb_root_path,
869 $site_base_url, $site_phpbb_page, $site_forum_url, $_phpbb_integration_mode;
870
871 /*
872 if (PHPBB_MODULE_DEBUG) {
873 $nodetext = $node->teaser;
874 drupal_set_message('Message teaser='. $nodetext);
875 $nodetext = $node->body;
876 drupal_set_message('Message body='. $nodetext);
877 }
878 * phpbbforum_submission_teaser
879 */
880 $topic_content_submission_teaser = $node->phpbbforum_submission_teaser; //variable_get('phpbbforum_submission_teaser_'. $node->type, 1);
881 if ($topic_content_submission_teaser != 2) {
882 if ($topic_content_submission_teaser == 1) {
883 $nodetext = $node->teaser;
884 //if (PHPBB_MODULE_DEBUG)
885 //drupal_set_message('Message teaser='. $nodetext);
886 }
887 else {
888 $nodetext = $node->body;
889 //if (PHPBB_MODULE_DEBUG)
890 //drupal_set_message('Message body='. $nodetext);
891 }
892
893 $filteredText = check_markup($nodetext, $node->format);
894 }
895 else {
896 $filteredText = '';
897 }
898
899 if (variable_get('phpbbforum_backlink_default_'. $node->type, 1)) {
900
901 $backlink = 'node/'. $node->nid;
902 //if (PHPBB_MODULE_DEBUG)
903 //drupal_set_message('Teaser('.$teaser.')='. $filteredText. '<p>Link='. $backlink.'</p>');
904
905 $title = variable_get('phpbbforum_topic_backlink_text', t('Read'));
906 $a_backlink = l($title, $backlink, array('title' => $title, 'absolute' => true));
907 $message = $filteredText .'<div id="topic-backlink"><p>'. $a_backlink .'</p></div>';
908 }
909 else {
910 $message = $filteredText;
911 }
912 //if (PHPBB_MODULE_DEBUG)
913 //drupal_set_message('Message='. $message);
914 if ($node->phpbbforum_commentlink != 1)
915 $node->phpbbforum_commentlink = 0;
916
917 _phpbbforum_variable_set('phpbbforum_forumid_default_'. $node->type, $node->phpbbforum_forumid);
918 _phpbbforum_variable_set('phpbbforum_commentlink_default_'. $node->type, $node->phpbbforum_commentlink);
919
920 // data which will be provided by the content creation
921 $data['topic_title'] = check_markup($node->title, $node->format);
922 $data['message'] = $message;
923 $data['message_md5'] = md5($message);
924 $data['forum_id'] = $node->phpbbforum_forumid;
925 // using the approved mechanism for publishing and unpublishing topics
926 $approved = ($node->status == 1) ? 1 : 0;
927 $data['topic_approved'] = $approved;
928 $data['post_approved'] = $approved;
929 // Hardcoded data to get the party working
930 // maybe it would be better to be able to fill this data via node creation as well
931 // but it's not necessary atm
932 $data['icon_id'] = 1;
933 $data['enable_bbcode'] = 1;
934 $data['enable_smilies'] = 1;
935 $data['enable_urls'] = 1;
936 $data['enable_sig'] = 1;
937 $data['bbcode_bitfield'] = '';
938 $data['bbcode_uid'] = '';
939 $data['post_edit_locked'] = 0;
940 $poll = array();
941
942 $post = db_fetch_object(db_query("SELECT topic_id FROM {drupal2phpbb} WHERE node_id = %d", $node->nid));
943 if ($post === false) {
944
945 phpbb_api_submit_post('post', $node->title, $phpbb_user->data['username'], POST_NORMAL, $poll, $data);
946
947 if (is_numeric($node->nid) && isset($data['topic_id']) && is_numeric($data['topic_id']))
948 db_query('INSERT INTO {drupal2phpbb} (node_id, topic_id, linked) VALUES (%d, %d, %d)', $node->nid, $data['topic_id'], $node->phpbbforum_commentlink);
949
950 } else {
951
952 $postInformation = phpbb_api_get_post_information($post->topic_id);
953 $data['topic_id'] = $post->topic_id;
954 $data['topic_replies_real'] = $postInformation['countPosts'];
955 $data['topic_first_post_id'] = $postInformation['post_id'];
956 $data['post_id'] = $postInformation['post_id'];
957 $data['poster_id'] = (int) $phpbb_user->data['user_id'];
958
959 phpbb_api_submit_post('edit', $node->title, $phpbb_user->data['username'], POST_NORMAL, $poll, $data, TRUE);
960
961 if (is_numeric($node->nid) && isset($data['topic_id']) && is_numeric($data['topic_id']))
962 db_query('UPDATE {drupal2phpbb} SET topic_id = %d, linked = %d WHERE node_id = %d', $data['topic_id'], $node->phpbbforum_commentlink, $node->nid);
963
964 }
965
966 break;
967
968 }
969
970 }
971
972 /**
973 * Validates the given forum_id against the accessable forums of the current user.
974 *
975 * @param integer $forum_id
976 * @return boolean false on error true otherwise
977 */
978 function _phpbbforum_nodeapi_validate_forumid($forum_id) {
979
980 $return = false;
981
982 if (!is_numeric($forum_id))
983 return $return;
984
985 global $phpbb_user;
986
987 $forums = phpbb_api_get_accessable_forums($phpbb_user->data['user_id']);
988
989 if (isset($forums[$forum_id]))
990 $return = true;
991
992 return $return;
993
994 }
995
996 /**
997 * Implementation of hook_link()
998 */
999 function phpbbforum_link($type, $object, $teaser = FALSE) {
1000
1001 global $phpbb_config, $site_base_url, $site_forum_url, $phpEx, $_phpbb_integration_mode, $phpbb_root_path, $phpEx;
1002
1003 $links = array();
1004
1005 if ($type == 'node') {
1006
1007 if (!user_access('access comments') || !_phpbbforum_settings() || !variable_get('phpbbforum_submission', false) || !variable_get('phpbbforum_submission_'. $object->type, false))
1008 return array();
1009
1010 $map = db_fetch_object(db_query('SELECT topic_id, linked FROM {drupal2phpbb} WHERE node_id = %d', $object->nid));
1011
1012 if ($map === false || $map->linked == 0)
1013 return array();
1014
1015 $postInformation = phpbb_api_get_post_information($map->topic_id);
1016
1017 if (empty($postInformation) || !isset($postInformation['forum_id']) || !isset($postInformation['topic_id']) || !isset($postInformation['post_id']))
1018 return array();
1019
1020 if ($postInformation['countPosts'] === 0)
1021 //$title = t('!comments '.variable_get('phpbbforum_commentlink_text_nocomments_'.$object->type, ''), array ('!comments' => format_plural ($postInformation['countPosts'], '1 comment', '@count comments')));
1022 $title = t(variable_get('phpbbforum_commentlink_text_nocomments_'.$object->type, '').' (!comments) ', array ('!comments' => format_plural ($postInformation['countPosts'], '1 comment', '@count comments')));
1023 else
1024 //$title = t('!comments '.variable_get('phpbbforum_commentlink_text_comments_'.$object->type, ''), array ('!comments' => format_plural ($postInformation['countPosts'], '1 comment', '@count comments')));
1025 $title = t(variable_get('phpbbforum_commentlink_text_comments_'.$object->type, '') .' (!comments) ', array ('!comments' => format_plural ($postInformation['countPosts'], '1 comment', '@count comments')));
1026
1027 $phpbb_url = $phpbb_config['forum_url'];
1028 if ($_phpbb_integration_mode == 1 || $_phpbb_integration_mode == 2) {
1029 $phpbb_url = $site_forum_url;
1030 }
1031
1032 $links['phpbbforum_comment'] = array (
1033 'title' => $title,
1034 'href' => html_entity_decode(append_sid("{$phpbb_url}/viewtopic.$phpEx", "f=".$postInformation['forum_id']."&t=".$postInformation['topic_id']."#p".$postInformation['post_id'])),
1035 );
1036 }
1037
1038 return $links;
1039
1040 }
1041
1042
1043 ///////////////////////////////////////////////////////////////////////////////
1044
1045
1046 function _phpbbforum_admin_settings() { // 5.x, 6
1047 global $phpbb_connection, $phpbb_root_path, $phpbb_user, $_phpbb_integration_mode;
1048
1049 $form = array();
1050
1051 $form['phpbbstatus'] = array('#type' => 'fieldset',
1052 '#title' => t('phpBBforum status'),
1053 '#collapsible' => TRUE,
1054 '#collapsed' => FALSE);
1055
1056 $phpbbapi_exists = false;
1057 $phpbbinc = "";
1058
1059 $phpbbroot = variable_get('phpbbforum_root', realpath('.') . PHPBB_PATH);
1060 if (empty($phpbbroot)) {
1061 $phpbbroot = realpath('.') . PHPBB_PATH;
1062 variable_set('phpbbforum_root', $phpbbroot);
1063 }
1064
1065 $phpbbsettings = $phpbbroot .'config.php';
1066 $phpbbapifile = variable_get('phpbbforum_api_file', PHPBB_API_FILE);
1067 if (empty($phpbbapifile)) {
1068 $phpbbapifile = PHPBB_API_FILE;
1069 variable_set('phpbbforum_api_file', $phpbbapifile);
1070 }
1071
1072 if (file_exists($phpbbsettings)) {
1073 $phpbbsettings_exists = true;
1074 $form['phpbbstatus']['info3'] = array('#type' => 'markup',
1075 '#value' => '<div class="ok">'. t('Successfully locating phpBB installation.') .'</div>');
1076
1077 $phpbb_root_path = $phpbbroot;
1078 $phpbbinc = variable_get('phpbbforum_inc', drupal_get_path('module', PHPBB_PAGE) . PHPBB_API_INCLUDE_PATH);
1079 if (empty($phpbbinc)) {
1080 $phpbbinc = drupal_get_path('module', PHPBB_PAGE) . PHPBB_API_INCLUDE_PATH;
1081 variable_set('phpbbforum_inc', $phpbbinc);
1082 }
1083 $phpbbapi = $phpbbinc . $phpbbapifile;
1084 if (file_exists($phpbbapi)) {
1085 $phpbbapi_exists = true;
1086 }
1087 else {
1088 $phpbbapi = $phpbb_root_path . $phpbbapifile;
1089 if (file_exists($phpbbapi)) {
1090 $phpbbapi_exists = true;
1091 $phpbbinc = $phpbb_root_path;
1092 }
1093 }
1094 }
1095 else {
1096 $phpbbsettings_exists = false;
1097 $form['phpbbstatus']['info4'] = array('#type' => 'markup',
1098 '#value' => '<div class="error">'. t('Error locating phpBB installation.') .' '. t('Please fix your settings!') .'</div>');
1099 }
1100
1101 if ($phpbbapi_exists) {
1102 $form['phpbbstatus']['info1'] = array('#type' => 'markup',
1103 '#value' => '<div class="ok">'. t('Successfully locating %api.', array('%api' => $phpbbapi)) .'</div>');
1104 }
1105 else {
1106 $form['phpbbstatus']['info2'] = array('#type' => 'markup',
1107 '#value' => '<div class="error">'. t('Error locating %api.', array('%api' => $phpbbapi)) .' '. t('Please fix your settings!') .'</div>');
1108 }
1109 /*
1110 if (PHPBB_MODULE_DEBUG) {
1111 global $active_db;
1112 $message = '0 D = PHPBB '.$active_db.' == '.$phpbb_connection;
1113 drupal_set_message($message);
1114 }
1115 */
1116 if (!$phpbb_connection && $phpbbsettings_exists && $phpbbapi_exists)
1117 require_once($phpbbapi);