/punbb/domain/domain.php
PHP | 120 lines | 84 code | 24 blank | 12 comment | 27 complexity | 5e780a6c93d4288e45549c5ab4e4c77f MD5 | raw file
- <?
- global $forum_domain;
-
- ////////////////////////////////////////////////////////////////////////////////
-
- if ($hook == 'aop_new_section' and $section == 'domain'){
include $ext_info['path'].'/admin.php';
/*print_r(range(1, 100));
print_r($forum_page);
- $forum_page['ext_actions'][] = '<span class="active"><a href="'.forum_link('extensions/domain/admin.php').'">Domains</a></span>';*/
- }
-
- ////////////////////////////////////////////////////////////////////////////////
-
- if (file_exists($file = dirname(__file__).'/config/'.$_SERVER['SERVER_NAME'].'.php'))
- include $file;
- else
- return;
-
- ////////////////////////////////////////////////////////////////////////////////
-
- if ($forum_domain['base_url'])
- $base_url = $forum_domain['base_url'];
-
- ////////////////////////////////////////////////////////////////////////////////
-
- if ($hook == 'co_common'){
- $puno_configo = $forum_config; // italyano?
- $forum_config = array_merge($forum_config, $forum_domain);
- }
-
- ////////////////////////////////////////////////////////////////////////////////
-
- if ($hook == 'aop_pre_update_configuration'){
foreach ($form as $k => $v)
- if (array_key_exists('p_'.$k, $puno_configo) and $puno_configo['p_'.$k] != $v){
- if ($puno_configo['p_'.$k] != $v)
- $forum_domain['p_'.$k] = $v;
- else
- unset($forum_domain['p_'.$k]);
- } elseif (array_key_exists('o_'.$k, $puno_configo)){
if ($puno_configo['o_'.$k] != $v)
- $forum_domain['o_'.$k] = $v;
- else
- unset($forum_domain['o_'.$k]);
- }
-
file_put_contents($file, '<?php $forum_domain = '.var_export($forum_domain, true).';');
- $form = array();
- }
-
- ////////////////////////////////////////////////////////////////////////////////
-
- if (in_array($hook, array(
- 'in_qr_get_cats_and_forums',
- 'ch_qr_get_cats_and_forums',
- 'se_qr_get_hits',
- 'se_qr_get_cats_and_forums'
- )))
- if ($forum_domain['categories'])
- $query['WHERE'] = '('.$query['WHERE'].') and c.id in ('.join(', ', $forum_domain['categories']).')';
-
- ////////////////////////////////////////////////////////////////////////////////
-
- if (in_array($hook, array(
- 'in_qr_get_new_topics',
- 'se_qr_get_new',
- 'se_qr_get_recent',
- 'vt_qr_get_topic_info',
- 'vf_qr_get_forum_info',
- 'show_unanswered',
- 'show_subscriptions',
- 'se_qr_get_user_topics',
- 'se_qr_get_user_posts'
- )))
- if ($forum_domain['categories']){
- $query['JOINS'][] = array('INNER JOIN' => 'categories as c', 'ON' => 'f.cat_id = c.id');
- $query['WHERE'] .= ' and c.id in ('.join(', ', $forum_domain['categories']).')';
- }
-
- ////////////////////////////////////////////////////////////////////////////////
-
- if (in_array($hook, array(
- 'fn_forum_link_end',
- 'fn_forum_sublink_end'
- )))
- $gen_link = str_replace($base_url, $forum_domain['base_url'], $gen_link);
-
- ////////////////////////////////////////////////////////////////////////////////
-
- if (in_array($hook, array(
- 'vt_row_pre_display',
- 'pf_view_details_pre_header_load',
- 'pf_change_details_about_pre_header_load'
- )))
- if ($forum_config['o_avatars'])
- 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;
-
- if (file_exists($image) and ($img_size = @getimagesize($image)))
- $forum_page['user_ident']['avatar'] = '<img src="'.$base_url.'/'.$forum_config['o_avatars_dir'].'/'.$user.'.'.$ext.'" '.$img_size[3].' alt="" />';
- }
-
- ////////////////////////////////////////////////////////////////////////////////
-
- if ($hook == 'pf_change_details_avatar_pre_header_load')
- 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;
-
- if (file_exists($image) and ($forum_page['img_size'] = @getimagesize($image))){
$forum_page['avatar_format'] = $ext;
- $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(
- '<li><span>'.$lang_profile['Avatar info change'].'</span></li>',
- '<li><span>'.$lang_profile['Avatar info type'].'</span></li>',
- '<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>'
- );
- }
- }
-
- ////////////////////////////////////////////////////////////////////////////////
-
- if (in_array($hook, array(
- 'pf_change_details_avatar_validation',
- 'pf_delete_avatar_selected'
- ))){
- $o_avatars_dir = $forum_config['o_avatars_dir'];
- $forum_config['o_avatars_dir'] = FORUM_ROOT.$forum_config['o_avatars_dir'];
- }
- ?>