Beispiel #1
0
 /**
  * Initialize phpBB.
  *
  * @param $args  An associative array, which may contain the following options:
  *    template: Whether the default header and footer should be printed. Defaults to true.
  *    admin: Whether the visitor must be an administrator. Defaults to false.
  *    check_sid: Whether 'sid' parameter should be checked against the visitor's actual SID.
  *               Defaults to true if 'admin' is set to true, otherwise defaults to false.
  *    root: Specify the phpbb root path. Defaults to './'.
  *    page: The page type, as will be shown in the administration panel. Defaults to PAGE_MODERATING
  *    title: The page title.
  */
 public static function init($args = array())
 {
     global $phpbb_root_path, $phpEx, $user_ip, $userdata, $db, $themes_id, $board_config, $template, $theme, $lang, $page_title, $SID, $html_entities_match, $html_entities_replace, $user_ip, $attachment_mod, $unhtml_specialchars_match, $unhtml_specialchars_replace;
     define('IN_PHPBB', true);
     if (isset($args['root'])) {
         $phpbb_root_path = $args['root'];
     } else {
         $phpbb_root_path = './';
     }
     include $phpbb_root_path . 'extension.inc';
     include $phpbb_root_path . 'common.' . $phpEx;
     // Start session management.
     if (!isset($args['page'])) {
         $args['page'] = PAGE_MODERATING;
     }
     $userdata = session_pagestart($user_ip, $args['page']);
     init_userprefs($userdata);
     // Check whether user is admin.
     if ($args['admin'] && $userdata['user_level'] != ADMIN) {
         message_die(GENERAL_MESSAGE, "You are not an administrator.");
     }
     // Check session ID if necessary.
     if (!isset($args['check_sid']) && $args['admin'] || $args['check_sid']) {
         // Session ID check.
         if (!empty($_POST['sid']) || !empty($_GET['sid'])) {
             $sid = !empty($_POST['sid']) ? $_POST['sid'] : $_GET['sid'];
         } else {
             $sid = '';
         }
         if ($sid == '' || $sid != $userdata['session_id']) {
             message_die(GENERAL_ERROR, 'Invalid session.');
         }
     }
     $SID = $userdata['session_id'];
     // Print default header and footer.
     if (isset($args['title'])) {
         $page_title = $args['title'];
     }
     if (!isset($args['template']) || $args['template']) {
         include $phpbb_root_path . 'includes/page_header.' . $phpEx;
     }
     self::$phpBB_args = $args;
 }
Beispiel #2
0
<?php

if (empty($_GET['q'])) {
    require_once 'includes/phpbb.php';
    PhpBB::init(array('template' => true, 'title' => 'Search forum'));
    $template->set_filenames(array('body' => 'newsearch.tpl'));
    $template->pparse('body');
    PhpBB::finalize();
} else {
    header("Location: http://www.google.com/search?as_q=" . urlencode($_GET['q']) . "&hl=en&hs=nsk&num=10&btnG=Google+Search&as_epq=&as_oq=&as_eq=&lr=&as_ft=i&as_filetype=&as_qdr=all&as_nlo=&as_nhi=&as_occt=any&as_dt=i&as_sitesearch=openkore.com&as_rights=&safe=off");
}