function tpAddMenuItems(&$buttons) { global $context, $scripturl, $txt; // If SMF throws a fatal_error TP is not loaded. So don't even worry about menu items. if (!isset($context['TPortal'])) { return; } // Set the forum button activated if needed. if (isset($_GET['board']) || isset($_GET['topic'])) { $context['current_action'] = 'forum'; } elseif (isset($_GET['sa']) && $_GET['sa'] == 'help') { $context['current_action'] = 'help'; } $new_buttons = array(); foreach ($buttons as $but => $val) { $new_buttons[$but] = $buttons[$but]; if ($but == 'home') { $new_buttons['forum'] = array('title' => isset($txt['tp-forum']) ? $txt['tp-forum'] : 'Forum', 'href' => $scripturl . '?action=forum', 'show' => $context['TPortal']['front_type'] != 'boardindex' ? true : false); } if ($but == 'calendar') { $new_buttons['tpadmin'] = array('title' => $txt['tp-tphelp'], 'href' => $scripturl . '?action=tpadmin', 'show' => TPcheckAdminAreas(), 'sub_buttons' => tp_getbuttons()); } if ($but == 'help') { $new_buttons['help']['sub_buttons'] = array('tphelp' => array('title' => $txt['tp-tphelp'], 'href' => $scripturl . '?action=tpmod;sa=help', 'show' => true)); } } $buttons = $new_buttons; }
function do_news($tpsub = 'overview') { global $context, $txt, $scripturl; get_boards(); $context['TPortal']['SSI_boards'] = explode(',', $context['TPortal']['SSI_board']); if ($tpsub == 'overview') { if (!TPcheckAdminAreas()) { fatal_error($txt['tp-notallowed']); } } elseif ($tpsub == 'permissions') { TPadd_linktree($scripturl . '?action=tpadmin;sa=permissions', $txt['tp-permissions']); $context['TPortal']['perm_all_groups'] = get_grps(true, true); $context['TPortal']['perm_groups'] = tp_fetchpermissions($context['TPortal']['modulepermissions']); } else { if ($tpsub == 'news') { TPadd_linktree($scripturl . '?action=tpadmin;sa=news', $txt['news']); } elseif ($tpsub == 'settings') { TPadd_linktree($scripturl . '?action=tpadmin;sa=settings', $txt['tp-settings']); } elseif ($tpsub == 'frontpage') { TPadd_linktree($scripturl . '?action=tpadmin;sa=frontpage', $txt['tp-frontpage']); } isAllowedTo('tp_settings'); } }