feather = \Slim\Slim::getInstance(); $this->start = $this->feather->start; $this->config = $this->feather->config; $this->user = $this->feather->user; $this->request = $this->feather->request; $this->model = new \model\header(); } private $title; private $page; private $focus_element; private $paging_links; private $required_fields; private $page_head; public function setTitle($title) { $this->title = $title; return $this; } public function setPage($page) { $this->page = $page; return $this; } public function setFocusElement($focus_element) { $this->focus_element = $focus_element; return $this; } public function setPagingLinks($paging_links) { $this->paging_links = $paging_links; return $this; } public function setRequiredFields($required_fields) { $this->required_fields = $required_fields; return $this; } public function setPageHead($page_head) { $this->page_head = $page_head; return $this; } public function display() { global $lang_common; // START SUBST - TODO /*if (isset($focus_element)) { $tpl_main = str_replace('', '', $tpl_main); }*/ // END SUBST - // START SUBST - $links = array(); // Index should always be displayed $links[] = ''; if ($this->user->g_read_board == '1' && $this->user->g_view_users == '1') { $links[] = ''; } if ($this->config['o_rules'] == '1' && (!$this->user->is_guest || $this->user->g_read_board == '1' || $this->config['o_regs_allow'] == '1')) { $links[] = ''; } if ($this->user->g_read_board == '1' && $this->user->g_search == '1') { $links[] = ''; } if ($this->user->is_guest) { $links[] = ''; $links[] = ''; } else { $links[] = ''; if ($this->user->is_admmod) { $links[] = ''; } $links[] = ''; } // Are there any additional navlinks we should insert into the array before imploding it? if ($this->user->g_read_board == '1' && $this->config['o_additional_navlinks'] != '') { if (preg_match_all('%([0-9]+)\s*=\s*(.*?)\n%s', $this->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('')); } } } $navlinks = '
'."\n\t\t\t".''."\n\t\t".'
'; // END SUBST - // START SUBST - $page_statusinfo = $page_topicsearches = array(); if ($this->user->is_guest) { $page_statusinfo = '

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

'; } else { $page_statusinfo[] = '
  • '.$lang_common['Logged in as'].' '.feather_escape($this->user->username).'
  • '; $page_statusinfo[] = '
  • '.sprintf($lang_common['Last visit'], format_time($this->user->last_visit)).'
  • '; if ($this->user->is_admmod) { if ($this->config['o_report_method'] == '0' || $this->config['o_report_method'] == '2') { if ($this->model->get_reports()) { $page_statusinfo[] = ''; } } if ($this->config['o_maintenance'] == '1') { $page_statusinfo[] = ''; } } if ($this->user->g_read_board == '1' && $this->user->g_search == '1') { $page_topicsearches[] = ''.$lang_common['Posted topics'].''; $page_topicsearches[] = ''.$lang_common['New posts header'].''; } } // Quick searches if ($this->user->g_read_board == '1' && $this->user->g_search == '1') { $page_topicsearches[] = ''.$lang_common['Active topics'].''; $page_topicsearches[] = ''.$lang_common['Unanswered topics'].''; } // Generate all that jazz $page_info = '
    '; // The status information if (is_array($page_statusinfo)) { $page_info .= "\n\t\t\t".'
      '; $page_info .= "\n\t\t\t\t".implode("\n\t\t\t\t", $page_statusinfo); $page_info .= "\n\t\t\t".'
    '; } else { $page_info .= "\n\t\t\t".$page_statusinfo; } // Generate quicklinks if (!empty($page_topicsearches)) { $page_info .= "\n\t\t\t".'
      '; $page_info .= "\n\t\t\t\t".'
    • '.$lang_common['Topic searches'].' '.implode(' | ', $page_topicsearches).'
    • '; $page_info .= "\n\t\t\t".'
    '; } $page_info .= "\n\t\t\t".'
    '."\n\t\t".'
    '; // END SUBST - // START SUBST - if (!defined('FEATHER_HEADER')) { define('FEATHER_HEADER', 1); } // Render the header $this->title = isset($this->title) ? $this->title : feather_escape($this->config['o_board_title']); // Define $p if it's not set to avoid a PHP notice $this->page = isset($this->page) ? $this->page : null; $this->page_head = isset($this->page_head) ? $this->page_head : null; $this->focus_element = isset($this->focus_element) ? $this->focus_element : null; $this->paging_links = isset($this->paging_links) ? $this->paging_links : null; $this->required_fields = isset($this->required_fields) ? $this->required_fields : null; $this->feather->render('header.php', array( 'lang_common' => $lang_common, 'page_title' => $this->title, 'focus_element' => $this->focus_element, 'p' => $this->page, 'feather_user' => $this->user, 'feather_config' => $this->config, '_SERVER' => $_SERVER, 'page_head' => $this->page_head, 'navlinks' => $navlinks, 'page_info' => $page_info, 'paging_links' => $this->paging_links, 'required_fields' => $this->required_fields, 'feather' => $this->feather, ) ); } }