function func_execute_active_handler()
{
    if (isset($_GET['q'])) {
        $q = format_str($_GET['q']);
        $query = (array) explode('/', $q);
        $GLOBALS['page'] = $query[0];
    } else {
        $query = "";
        $GLOBALS['page'] = "";
    }
    $page = $GLOBALS['func_registry'][$GLOBALS['page']];
    if (!$page) {
        header('HTTP/1.0 404 Not Found');
        die('404 - Page not found.');
    }
    if (isset($page['security']) && $page['security']) {
        user_ensure_authenticated();
    }
    if (isset($page['admin']) && $page['admin']) {
        user_ensure_admin();
    }
    if (function_exists('config_log_request')) {
        config_log_request();
    }
    if (function_exists($page['callback'])) {
        return call_user_func($page['callback'], $query);
    }
    return false;
}
function user_ensure_admin()
{
    user_ensure_authenticated();
    if (!user_is_admin()) {
        header("Location: " . BASE_URL . "?errormsg=" . urlencode("不要做坏事哟^o^"));
        die("Access denied");
    }
}
Пример #3
0
Файл: menu.php Проект: xctcc/npt
function menu_execute_active_handler()
{
    $query = (array) explode('/', $_GET['q']);
    $GLOBALS['page'] = $query[0];
    $page = $GLOBALS['menu_registry'][$GLOBALS['page']];
    if (!$page) {
        header('HTTP/1.0 404 Not Found');
        die('404 - Page not found.');
    }
    if ($page['security']) {
        user_ensure_authenticated();
    }
    if (function_exists($page['callback'])) {
        return call_user_func($page['callback'], $query);
    }
    return false;
}
function user_role_show()
{
    user_ensure_authenticated();
    echo $GLOBALS['user']['role'];
}
Пример #5
0
function twitter_home_page()
{
    user_ensure_authenticated();
    //$request = API_URL.'statuses/home_timeline.json?count=20&include_rts=true&page='.intval($_GET['page']);
    $request = API_URL . 'statuses/home_timeline.json?count=20&include_rts=true&include_entities=true';
    if ($_GET['max_id']) {
        $request .= '&max_id=' . $_GET['max_id'];
    }
    if ($_GET['since_id']) {
        $request .= '&since_id=' . $_GET['since_id'];
    }
    //echo $request;
    $tl = twitter_process($request);
    $tl = twitter_standard_timeline($tl, 'friends');
    $content = theme('status_form');
    $content .= theme('timeline', $tl);
    theme('page', 'Home', $content);
}
Пример #6
0
function twitter_home_page()
{
    user_ensure_authenticated();
    $cb = get_codebird();
    $api_options = "";
    $per_page = setting_fetch('perPage', 20);
    $api_options = "&count={$per_page}";
    //	If we're paginating through
    if ($_GET['max_id']) {
        $api_options .= '&max_id=' . $_GET['max_id'];
    }
    if ($_GET['since_id']) {
        $api_options .= '&since_id=' . $_GET['since_id'];
    }
    $api_options .= "&screen_name={$screen_name}";
    //echo "$api_options";
    $home_timeline = $cb->statuses_homeTimeline($api_options);
    twitter_api_status($home_timeline);
    $tl = twitter_standard_timeline($home_timeline, 'friends');
    $content = theme('status_form');
    $content .= theme('timeline', $tl);
    theme('page', 'Home', $content);
}
Пример #7
0
function twitter_home_page()
{
    user_ensure_authenticated();
    $count = setting_fetch('tpp', 20);
    $request = API_ROOT . "statuses/home_timeline.json?include_entities=true&count={$count}";
    if ($_GET['max_id']) {
        $request .= "&max_id=" . $_GET['max_id'];
    }
    if ($_GET['since_id']) {
        $request .= "&since_id=" . $_GET['since_id'];
    }
    $tl = twitter_process($request);
    $tl = twitter_standard_timeline($tl, 'friends');
    $content = theme('status_form');
    $content .= theme('timeline', $tl);
    theme('page', __("Home") . $page, $content);
}
Пример #8
0
function twitter_home_page()
{
    user_ensure_authenticated();
    $per_page = setting_fetch('perPage', 20);
    $request = API_NEW . "statuses/home_timeline.json?count={$per_page}";
    if ($_GET['max_id']) {
        $request .= '&max_id=' . $_GET['max_id'];
    }
    if ($_GET['since_id']) {
        $request .= '&since_id=' . $_GET['since_id'];
    }
    //echo $request;
    $tl = twitter_process($request);
    $tl = twitter_standard_timeline($tl, 'friends');
    $content = theme('status_form');
    $content .= theme('timeline', $tl);
    theme('page', 'Home', $content);
}
Пример #9
0
function twitter_home_page()
{
    user_ensure_authenticated();
    $request = API_URL . 'statuses/home_timeline.json?count=20&include_rts=true&page=' . intval($_GET['page']);
    $tl = twitter_process($request);
    $tl = twitter_standard_timeline($tl, 'friends');
    $content = theme('status_form');
    $content .= theme('timeline', $tl);
    theme('page', 'Home', $content);
}