コード例 #1
0
    $forum_ids = request_var('forum_id', array(0 => 0));
    $cat = false;
    if (!$forum_ids && !$global) {
        trigger_error('NOTHING_SELECTED');
    }
    if ($global) {
        // reset forum_ids, we don't want any user input
        $forum_ids = array();
    } else {
        // is there a category which has been selected?
        foreach ($forum_ids as $forum_id) {
            $sql = 'SELECT forum_id
				FROM ' . FORUMS_TABLE . "\n\t\t\t\tWHERE forum_id = {$forum_id}\n\t\t\t\t\tAND forum_type = " . FORUM_CAT;
            $result = $db->sql_query($sql);
            $row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if ($row) {
                $cat = true;
                break;
            }
        }
    }
    // build URL only with necessary elements in correct order
    $url = build_feed_url();
    redirect(reapply_sid($url));
}
// Lets build a page ...
$template->assign_vars(array('S_FORUM_OPTIONS' => make_forum_select(false, false, false, false, false, false, false, true), 'S_ACTION' => append_sid("{$phpbb_root_path}create_syndication.{$phpEx}"), 'NUMBER_ITEMS' => $config['syndication_items'], 'L_SYNDICATION_ADMIN_LIMIT' => sprintf($user->lang['SYNDICATION_ADMIN_LIMIT'], $config['syndication_items'])));
page_header($user->lang['CUSTOM_SYNDICATION_TITLE']);
$template->set_filenames(array('body' => 'syndication_body.html'));
page_footer();
コード例 #2
0
ファイル: generate_feed.php プロジェクト: sietf/sietf.org
    }
}
// user has set a different language as used in cached feed description? Regenerate.
if ($user->data['user_lang'] != $feed_data['lang']) {
    generate_feed_details($content, $global, $feed_data);
}
foreach ($feed_data['items'] as $item) {
    // apply session id to links if user is logged in
    if ($user->data['user_id'] != ANONYMOUS) {
        $item_link = append_sid($item['link']);
    } else {
        $item_link = $item['link'];
    }
    $template->assign_block_vars('item', array('AUTHOR' => $item['author'], 'TIME' => format_date($item['time'], $syndication_method), 'LINK' => $item_link, 'IDENTIFIER' => $item['identifier'], 'TITLE' => $item['title'], 'TEXT' => prepare_message($item['text'], $syndication_method)));
}
$template->set_filenames(array('body' => 'syndication_' . ($syndication_method == SYNDICATION_ATOM ? 'atom' : 'rss2') . '.html'));
// get time from last item or use current time in case of an empty feed
$last_build_date = $number_items_current ? $feed_data['items'][$number_items_current - 1]['time'] : time();
$template->assign_vars(array('HEADER' => '<?xml version="1.0" encoding="UTF-8"?>' . "\n", 'TITLE' => $feed_data['title'], 'DESCRIPTION' => $feed_data['description'], 'LINK' => $feed_data['source_link'], 'FEED_LINK' => build_feed_url(true), 'LAST_BUILD' => format_date($last_build_date, $syndication_method)));
// gzip compression
if ($config['gzip_compress']) {
    if (@extension_loaded('zlib') && !headers_sent()) {
        ob_start('ob_gzhandler');
    }
}
// text/xml for Internet Explorer
header('Content-Type: text/xml; charset=UTF-8');
header('Last-Modified: ' . date('D, d M Y H:i:s O', $last_build_date));
$template->display('body');
garbage_collection();
exit_handler();
コード例 #3
0
/**
* do login for user authenticating via HTTP AUTH
*/
function phpbb_login()
{
    global $auth;
    // get username and password
    set_var($username, $_SERVER['PHP_AUTH_USER'], 'string', true);
    set_var($password, $_SERVER['PHP_AUTH_PW'], 'string', true);
    $result = $auth->login($username, $password, true, false);
    if ($result['status'] == LOGIN_SUCCESS) {
        // Special case... the user is effectively banned, but we allow founders to login
        if (defined('IN_CHECK_BAN') && $result['user_row']['user_type'] != USER_FOUNDER) {
            trigger_error('BANNED');
        }
        // user logged in successfully, redirect to the same page to make the new session become effective
        $url = build_feed_url();
        $redirect = reapply_sid($url);
        redirect($redirect);
    } else {
        http_auth();
    }
}