preg_match_all('%%i', $tpl_main, $pun_includes, PREG_SET_ORDER); foreach ($pun_includes as $cur_include) { ob_start(); $file_info = pathinfo($cur_include[1]); if (!in_array($file_info['extension'], array('php', 'php4', 'php5', 'inc', 'html', 'txt'))) // Allow some extensions error(sprintf($lang_common['Pun include extension'], pun_htmlspecialchars($cur_include[0]), basename($tpl_file), pun_htmlspecialchars($file_info['extension']))); if (strpos($file_info['dirname'], '..') !== false) // Don't allow directory traversal error(sprintf($lang_common['Pun include directory'], pun_htmlspecialchars($cur_include[0]), basename($tpl_file))); // Allow for overriding user includes, too. if (file_exists($tpl_inc_dir.$cur_include[1])) require $tpl_inc_dir.$cur_include[1]; else if (file_exists(PUN_ROOT.'include/user/'.$cur_include[1])) require PUN_ROOT.'include/user/'.$cur_include[1]; else error(sprintf($lang_common['Pun include error'], pun_htmlspecialchars($cur_include[0]), basename($tpl_file))); $tpl_temp = ob_get_contents(); $tpl_main = str_replace($cur_include[0], $tpl_temp, $tpl_main); ob_end_clean(); } // END SUBST - // START SUBST - $tpl_main = str_replace('', $lang_common['lang_identifier'], $tpl_main); // END SUBST - // START SUBST - $tpl_main = str_replace('', $lang_common['lang_direction'], $tpl_main); // END SUBST - // START SUBST - ob_start(); // Define $p if it's not set to avoid a PHP notice $p = isset($p) ? $p : null; // Is this a page that we want search index spiders to index? if (!defined('PUN_ALLOW_INDEX')) echo ''."\n"; ?> <?php echo generate_page_title($page_title, $p) ?> '."\n"; else echo ''."\n"; } if (isset($required_fields)) { // Output JavaScript to validate form (make sure required fields are filled out) ?> ', $tpl_temp, $tpl_main); ob_end_clean(); // END SUBST - // START SUBST - if (isset($focus_element)) { $tpl_main = str_replace('', '', $tpl_main); } // END SUBST - // START SUBST - $tpl_main = str_replace('', htmlspecialchars(basename($_SERVER['SCRIPT_NAME'], '.php')), $tpl_main); // END SUBST - // START SUBST - $tpl_main = str_replace('', '

'.pun_htmlspecialchars($pun_config['o_board_title']).'

', $tpl_main); // END SUBST - // START SUBST - $tpl_main = str_replace('', '
'.$pun_config['o_board_desc'].'
', $tpl_main); // END SUBST - // START SUBST - $links = array(); // Index should always be displayed $links[] = ''; if ($pun_user['g_read_board'] == '1' && $pun_user['g_view_users'] == '1') $links[] = ''; if ($pun_config['o_rules'] == '1' && (!$pun_user['is_guest'] || $pun_user['g_read_board'] == '1' || $pun_config['o_regs_allow'] == '1')) $links[] = ''; if ($pun_user['g_read_board'] == '1' && $pun_user['g_search'] == '1') $links[] = ''; if ($pun_user['is_guest']) { $links[] = ''; $links[] = ''; } else { $links[] = ''; if ($pun_user['is_admmod']) $links[] = ''; $links[] = ''; } // Are there any additional navlinks we should insert into the array before imploding it? if ($pun_user['g_read_board'] == '1' && $pun_config['o_additional_navlinks'] != '') { if (preg_match_all('%([0-9]+)\s*=\s*(.*?)\n%s', $pun_config['o_additional_navlinks']."\n", $extra_links)) { // Insert any additional links into the $links array (at the correct index) $num_links = count($extra_links[1]); for ($i = 0; $i < $num_links; ++$i) array_splice($links, $extra_links[1][$i], 0, array('')); } } $tpl_temp = '
'."\n\t\t\t".'
    '."\n\t\t\t\t".implode("\n\t\t\t\t", $links)."\n\t\t\t".'
'."\n\t\t".'
'; $tpl_main = str_replace('', $tpl_temp, $tpl_main); // END SUBST - // START SUBST - $page_statusinfo = $page_topicsearches = array(); if ($pun_user['is_guest']) $page_statusinfo = '

'.$lang_common['Not logged in'].'

'; else { $page_statusinfo[] = '
  • '.$lang_common['Logged in as'].' '.pun_htmlspecialchars($pun_user['username']).'
  • '; $page_statusinfo[] = '
  • '.sprintf($lang_common['Last visit'], format_time($pun_user['last_visit'])).'
  • '; if ($pun_user['is_admmod']) { if ($pun_config['o_report_method'] == '0' || $pun_config['o_report_method'] == '2') { $result_header = $db->query('SELECT 1 FROM '.$db->prefix.'reports WHERE zapped IS NULL') or error('Unable to fetch reports info', __FILE__, __LINE__, $db->error()); if ($db->result($result_header)) $page_statusinfo[] = ''; } if ($pun_config['o_maintenance'] == '1') $page_statusinfo[] = ''; } if ($pun_user['g_read_board'] == '1' && $pun_user['g_search'] == '1') { $page_topicsearches[] = ''.$lang_common['Posted topics'].''; $page_topicsearches[] = ''.$lang_common['New posts header'].''; } } // Quick searches if ($pun_user['g_read_board'] == '1' && $pun_user['g_search'] == '1') { $page_topicsearches[] = ''.$lang_common['Active topics'].''; $page_topicsearches[] = ''.$lang_common['Unanswered topics'].''; } // Generate all that jazz $tpl_temp = '
    '; // The status information if (is_array($page_statusinfo)) { $tpl_temp .= "\n\t\t\t".'
      '; $tpl_temp .= "\n\t\t\t\t".implode("\n\t\t\t\t", $page_statusinfo); $tpl_temp .= "\n\t\t\t".'
    '; } else $tpl_temp .= "\n\t\t\t".$page_statusinfo; // Generate quicklinks if (!empty($page_topicsearches)) { $tpl_temp .= "\n\t\t\t".'
      '; $tpl_temp .= "\n\t\t\t\t".'
    • '.$lang_common['Topic searches'].' '.implode(' | ', $page_topicsearches).'
    • '; $tpl_temp .= "\n\t\t\t".'
    '; } $tpl_temp .= "\n\t\t\t".'
    '."\n\t\t".'
    '; $tpl_main = str_replace('', $tpl_temp, $tpl_main); // END SUBST - // START SUBST - if ($pun_user['g_read_board'] == '1' && $pun_config['o_announcement'] == '1') { ob_start(); ?>

    ', $tpl_temp, $tpl_main); ob_end_clean(); } else $tpl_main = str_replace('', '', $tpl_main); // END SUBST - // START SUBST - ob_start(); define('PUN_HEADER', 1);