示例#1
0
文件: index.php 项目: noon/phpMyFAQ
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Content-type: text/html; charset=" . $PMF_LANG['metaCharset']);
header("Vary: Negotiate,Accept");
//
// Add debug info if needed
//
if (DEBUG) {
    $debug_template_vars = array('debugMessages' => "\n" . '<div id="debug_main">DEBUG INFORMATION:<br />' . $db->sqllog() . '</div>');
} else {
    $debug_template_vars = array('debugMessages' => '');
}
//
// Get main template, set main variables
//
$tpl->processTemplate('index', array_merge($main_template_vars, $links_template_vars, $debug_template_vars));
//
// Show login box or logged-in user information
//
if (isset($auth)) {
    $tpl->processTemplate('loginBox', array('loggedinas' => $PMF_LANG['ad_user_loggedin'], 'currentuser' => $user->getUserData('display_name'), 'printAdminPath' => in_array(true, $permission) ? 'admin/index.php' : '#', 'adminSection' => $PMF_LANG['adminSection'], 'printLogoutPath' => '?action=logout', 'logout' => $PMF_LANG['ad_menu_logout']));
} else {
    if (isset($_SERVER['HTTPS']) || !$faqconfig->get('main.useSslForLogins')) {
        $tpl->processTemplate('loginBox', array('writeLoginPath' => $_SERVER['PHP_SELF'] . '?action=login', 'login' => $PMF_LANG['ad_auth_ok'], 'username' => $PMF_LANG['ad_auth_user'], 'password' => $PMF_LANG['ad_auth_passwd'], 'msgRegisterUser' => $faqconfig->get('main.enableRewriteRules') ? '<a href="' . $systemUri . 'register.html">' . $PMF_LANG['msgRegisterUser'] . '</a>' : '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=register">' . $PMF_LANG['msgRegisterUser'] . '</a>', 'msgLoginFailed' => $error));
    } else {
        $tpl->processTemplate('loginBox', array('secureloginurl' => sprintf('https://%s%s', $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI']), 'securelogintext' => $PMF_LANG['msgSecureSwitch']));
    }
}
$tpl->includeTemplate('loginBox', 'index');
$toptenParams = $faq->getTopTen();
if (!isset($toptenParams['error'])) {
示例#2
0
文件: index.php 项目: atlcurling/tkt
    $links_template_vars = array("faqHome" => $faqconfig->get('main.referenceURL'), "msgSearch" => '<a href="' . $systemUri . 'search.html">' . $PMF_LANG["msgAdvancedSearch"] . '</a>', 'msgAddContent' => '<a href="' . $systemUri . 'addcontent.html">' . $PMF_LANG["msgAddContent"] . '</a>', "msgQuestion" => '<a href="' . $systemUri . 'ask.html">' . $PMF_LANG["msgQuestion"] . '</a>', "msgOpenQuestions" => '<a href="' . $systemUri . 'open.html">' . $PMF_LANG["msgOpenQuestions"] . '</a>', 'msgHelp' => '<a href="' . $systemUri . 'help.html">' . $PMF_LANG["msgHelp"] . '</a>', "msgContact" => '<a href="' . $systemUri . 'contact.html">' . $PMF_LANG["msgContact"] . '</a>', "backToHome" => '<a href="' . $systemUri . 'index.html">' . $PMF_LANG["msgHome"] . '</a>', "allCategories" => '<a href="' . $systemUri . 'showcat.html">' . $PMF_LANG["msgShowAllCategories"] . '</a>', 'showInstantResponse' => '<a href="' . $systemUri . 'instantresponse.html">' . $PMF_LANG['msgInstantResponse'] . '</a>', 'showSitemap' => '<a href="' . $systemUri . 'sitemap/A/' . $LANGCODE . '.html">' . $PMF_LANG['msgSitemap'] . '</a>', 'opensearch' => $systemUri . 'opensearch.html');
} else {
    $links_template_vars = array("faqHome" => $faqconfig->get('main.referenceURL'), "msgSearch" => '<a href="index.php?' . $sids . 'action=search">' . $PMF_LANG["msgAdvancedSearch"] . '</a>', "msgAddContent" => '<a href="index.php?' . $sids . 'action=add&cat=' . $cat . '">' . $PMF_LANG["msgAddContent"] . '</a>', "msgQuestion" => '<a href="index.php?' . $sids . 'action=ask&category_id=' . $cat . '">' . $PMF_LANG["msgQuestion"] . '</a>', "msgOpenQuestions" => '<a href="index.php?' . $sids . 'action=open">' . $PMF_LANG["msgOpenQuestions"] . '</a>', "msgHelp" => '<a href="index.php?' . $sids . 'action=help">' . $PMF_LANG["msgHelp"] . '</a>', "msgContact" => '<a href="index.php?' . $sids . 'action=contact">' . $PMF_LANG["msgContact"] . '</a>', "allCategories" => '<a href="index.php?' . $sids . 'action=show">' . $PMF_LANG["msgShowAllCategories"] . '</a>', "backToHome" => '<a href="index.php?' . $sids . '">' . $PMF_LANG["msgHome"] . '</a>', 'showInstantResponse' => '<a href="index.php?' . $sids . 'action=instantresponse">' . $PMF_LANG['msgInstantResponse'] . '</a>', 'showSitemap' => '<a href="index.php?' . $sids . 'action=sitemap&amp;lang=' . $LANGCODE . '">' . $PMF_LANG['msgSitemap'] . '</a>', 'opensearch' => $systemUri . 'opensearch.php');
}
//
// Add debug info if needed
//
if (DEBUG) {
    $debug_template_vars = array('debugMessages' => '<div id="debug_main"><h2>DEBUG INFORMATION:</h2>' . $db->sqllog() . '</div>');
} else {
    $debug_template_vars = array('debugMessages' => '');
}
//
// Get main template, set main variables
//
$tpl->processTemplate('index', array_merge($main_template_vars, $links_template_vars, $debug_template_vars));
//
// Show login box or logged-in user information
//
if (isset($auth)) {
    if (in_array(true, $permission)) {
        $adminSection = sprintf('<a href="%s">%s</a>', $systemUri . 'admin/index.php', $PMF_LANG['adminSection']);
    } else {
        $adminSection = $PMF_LANG['adminSection'];
    }
    $tpl->processTemplate('loginBox', array('loggedinas' => $PMF_LANG['ad_user_loggedin'], 'currentuser' => $user->getUserData('display_name'), 'adminSection' => $adminSection, 'logout' => $PMF_LANG['ad_menu_logout']));
} else {
    if (isset($_SERVER['HTTPS']) || !$faqconfig->get('security.useSslForLogins')) {
        $tpl->processTemplate('loginBox', array('msgLoginUser' => $PMF_LANG['msgLoginUser'], 'writeLoginPath' => $systemUri . '?action=login', 'faqloginaction' => $action, 'login' => $PMF_LANG['ad_auth_ok'], 'username' => $PMF_LANG['ad_auth_user'], 'password' => $PMF_LANG['ad_auth_passwd'], 'msgRegisterUser' => '<a href="?' . $sids . 'action=register">' . $PMF_LANG['msgRegisterUser'] . '</a>', 'msgLoginFailed' => $error, 'msgLostPassword' => $PMF_LANG['lostPassword'], 'loginVisibility' => $loginVisibility));
    } else {
        $tpl->processTemplate('loginBox', array('secureloginurl' => sprintf('https://%s%s', $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI']), 'securelogintext' => $PMF_LANG['msgSecureSwitch']));