PageRenderTime 47ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/punbb/domain/domain.php

http://goodgirl.googlecode.com/
PHP | 120 lines | 84 code | 24 blank | 12 comment | 27 complexity | 5e780a6c93d4288e45549c5ab4e4c77f MD5 | raw file
  1. <?
  2. global $forum_domain;
  3. ////////////////////////////////////////////////////////////////////////////////
  4. if ($hook == 'aop_new_section' and $section == 'domain'){ include $ext_info['path'].'/admin.php'; /*print_r(range(1, 100)); print_r($forum_page);
  5. $forum_page['ext_actions'][] = '<span class="active"><a href="'.forum_link('extensions/domain/admin.php').'">Domains</a></span>';*/
  6. }
  7. ////////////////////////////////////////////////////////////////////////////////
  8. if (file_exists($file = dirname(__file__).'/config/'.$_SERVER['SERVER_NAME'].'.php'))
  9. include $file;
  10. else
  11. return;
  12. ////////////////////////////////////////////////////////////////////////////////
  13. if ($forum_domain['base_url'])
  14. $base_url = $forum_domain['base_url'];
  15. ////////////////////////////////////////////////////////////////////////////////
  16. if ($hook == 'co_common'){
  17. $puno_configo = $forum_config; // italyano?
  18. $forum_config = array_merge($forum_config, $forum_domain);
  19. }
  20. ////////////////////////////////////////////////////////////////////////////////
  21. if ($hook == 'aop_pre_update_configuration'){ foreach ($form as $k => $v)
  22. if (array_key_exists('p_'.$k, $puno_configo) and $puno_configo['p_'.$k] != $v){
  23. if ($puno_configo['p_'.$k] != $v)
  24. $forum_domain['p_'.$k] = $v;
  25. else
  26. unset($forum_domain['p_'.$k]);
  27. } elseif (array_key_exists('o_'.$k, $puno_configo)){ if ($puno_configo['o_'.$k] != $v)
  28. $forum_domain['o_'.$k] = $v;
  29. else
  30. unset($forum_domain['o_'.$k]);
  31. }
  32. file_put_contents($file, '<?php $forum_domain = '.var_export($forum_domain, true).';');
  33. $form = array();
  34. }
  35. ////////////////////////////////////////////////////////////////////////////////
  36. if (in_array($hook, array(
  37. 'in_qr_get_cats_and_forums',
  38. 'ch_qr_get_cats_and_forums',
  39. 'se_qr_get_hits',
  40. 'se_qr_get_cats_and_forums'
  41. )))
  42. if ($forum_domain['categories'])
  43. $query['WHERE'] = '('.$query['WHERE'].') and c.id in ('.join(', ', $forum_domain['categories']).')';
  44. ////////////////////////////////////////////////////////////////////////////////
  45. if (in_array($hook, array(
  46. 'in_qr_get_new_topics',
  47. 'se_qr_get_new',
  48. 'se_qr_get_recent',
  49. 'vt_qr_get_topic_info',
  50. 'vf_qr_get_forum_info',
  51. 'show_unanswered',
  52. 'show_subscriptions',
  53. 'se_qr_get_user_topics',
  54. 'se_qr_get_user_posts'
  55. )))
  56. if ($forum_domain['categories']){
  57. $query['JOINS'][] = array('INNER JOIN' => 'categories as c', 'ON' => 'f.cat_id = c.id');
  58. $query['WHERE'] .= ' and c.id in ('.join(', ', $forum_domain['categories']).')';
  59. }
  60. ////////////////////////////////////////////////////////////////////////////////
  61. if (in_array($hook, array(
  62. 'fn_forum_link_end',
  63. 'fn_forum_sublink_end'
  64. )))
  65. $gen_link = str_replace($base_url, $forum_domain['base_url'], $gen_link);
  66. ////////////////////////////////////////////////////////////////////////////////
  67. if (in_array($hook, array(
  68. 'vt_row_pre_display',
  69. 'pf_view_details_pre_header_load',
  70. 'pf_change_details_about_pre_header_load'
  71. )))
  72. if ($forum_config['o_avatars'])
  73. foreach (array('gif', 'jpg', 'png') as $ext){ $user = ($cur_post['poster_id'] ? $cur_post['poster_id'] : $id); $image = FORUM_ROOT.$forum_config['o_avatars_dir'].'/'.$user.'.'.$ext;
  74. if (file_exists($image) and ($img_size = @getimagesize($image)))
  75. $forum_page['user_ident']['avatar'] = '<img src="'.$base_url.'/'.$forum_config['o_avatars_dir'].'/'.$user.'.'.$ext.'" '.$img_size[3].' alt="" />';
  76. }
  77. ////////////////////////////////////////////////////////////////////////////////
  78. if ($hook == 'pf_change_details_avatar_pre_header_load')
  79. foreach (array('gif', 'jpg', 'png') as $ext){ $dir = ($o_avatars_dir ? $o_avatars_dir : $forum_config['o_avatars_dir']); $image = FORUM_ROOT.$dir.'/'.$id.'.'.$ext;
  80. if (file_exists($image) and ($forum_page['img_size'] = @getimagesize($image))){ $forum_page['avatar_format'] = $ext;
  81. $forum_page['avatar_demo'] = '<img src="'.$base_url.'/'.$dir.'/'.$id.'.'.$ext.'" '.$forum_page['img_size'][3].' alt="'.$lang_profile['Avatar'].'" />'; $forum_page['frm_info'] = array(
  82. '<li><span>'.$lang_profile['Avatar info change'].'</span></li>',
  83. '<li><span>'.$lang_profile['Avatar info type'].'</span></li>',
  84. '<li><span>'.sprintf($lang_profile['Avatar info size'], $forum_config['o_avatars_width'], $forum_config['o_avatars_height'], $forum_config['o_avatars_size'], ceil($forum_config['o_avatars_size'] / 1024)).'</span></li>'
  85. );
  86. }
  87. }
  88. ////////////////////////////////////////////////////////////////////////////////
  89. if (in_array($hook, array(
  90. 'pf_change_details_avatar_validation',
  91. 'pf_delete_avatar_selected'
  92. ))){
  93. $o_avatars_dir = $forum_config['o_avatars_dir'];
  94. $forum_config['o_avatars_dir'] = FORUM_ROOT.$forum_config['o_avatars_dir'];
  95. }
  96. ?>