当前位置: 首页>>代码示例>>PHP>>正文


PHP output_page函数代码示例

本文整理汇总了PHP中output_page函数的典型用法代码示例。如果您正苦于以下问题:PHP output_page函数的具体用法?PHP output_page怎么用?PHP output_page使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了output_page函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: build_threadlog

/**
Threadlog functionality - build!
**/
function build_threadlog($uid)
{
    global $mybb, $db, $templates, $theme, $lang, $header, $headerinclude, $footer, $threadlog_list;
    $threadlog = new Threadlog($db, $uid);
    //Define Variables
    $user = $threadlog->get_user();
    $threads = $threadlog->get_threads();
    //Add breadcrubs
    add_breadcrumb($user['username'] . '\'s Profile', "member.php?action=profile&uid=" . $user['uid']);
    add_breadcrumb($user['username'] . '\'s Threadlog', "misc.php?action=threadlog");
    // set up the pager
    $multipage = setup_threadlog_pages($uid, $threads, $start);
    // setup thread counts
    $active_count = count($threadlog->get_active());
    $closed_count = count($threadlog->get_closed());
    $reply_count = count($threadlog->get_need_reply());
    $total_count = count($threads);
    // Print out the rows!
    $rowiterator = 0;
    if ($total_count < 1) {
        eval("\$threadlog_list .= \"" . $templates->get("rpgthreadlog_nothreads") . "\";");
    }
    $threads = array_slice($threads, $start, $mybb->settings['rpgsuite_threadlog_perpage']);
    foreach ($threads as $thread) {
        $participants = $threadlog->get_thread_participants($thread['tid']);
        $notes = $threadlog->get_thread_notes($thread['tid']);
        setup_threadlog_row($user, $thread, $participants, $notes, $rowiterator);
        $rowiterator++;
    }
    eval("\$threadlog_page = \"" . $templates->get("rpgthreadlog_page") . "\";");
    output_page($threadlog_page);
    exit;
}
开发者ID:megan-starr9,项目名称:RPGSuite,代码行数:36,代码来源:threadlog.php

示例2: automedia_usercp

function automedia_usercp()
{
    global $header, $headerinclude, $usercpnav, $footer, $mybb, $theme, $db, $lang, $templates;
    $av_checked_yes = ' checked="checked"';
    $av_checked_no = '';
    if (!isset($lang->av_ucp_yes)) {
        $lang->load("automedia");
    }
    if ($mybb->input['action'] == "userautomedia") {
        if ($mybb->user['automedia_use'] != 'Y') {
            $av_checked_yes = '';
            $av_checked_no = ' checked="checked"';
        }
        add_breadcrumb($lang->nav_usercp, "usercp.php");
        add_breadcrumb("AutoMedia");
        $ucpset = @automedia_ucp_status();
        eval("\$automedia_ucp = \"" . $templates->get("automedia_usercp") . "\";");
        output_page($automedia_ucp);
    } elseif ($mybb->input['action'] == "do_automedia" && $mybb->request_method == "post") {
        $uid = (int) $mybb->user['uid'];
        $updated_record = array("automedia_use" => $db->escape_string($mybb->input['automedia']));
        if ($db->update_query('users', $updated_record, "uid='" . $uid . "'")) {
            redirect("usercp.php?action=userautomedia", $lang->av_ucp_submit_success);
        }
    } else {
        return;
    }
}
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:28,代码来源:automedia_functions.php

示例3: lonelythread_init

function lonelythread_init()
{
    global $mybb, $db, $cache, $templates, $threadpage, $header, $headerinclude, $footer, $theme;
    if ($mybb->get_input('action') == 'lonelythreads') {
        $rpgsuite = new RPGSuite($mybb, $db, $cache);
        $threadlist = "";
        $count = 0;
        if (isset($mybb->input['gid'])) {
            $threads = $rpgsuite->get_lonely_threads((int) $mybb->input['gid']);
        } else {
            $threads = $rpgsuite->get_lonely_threads();
        }
        $groupfilters = "";
        eval("\$groupfilters = \"" . $templates->get("rpglonelythread_groupfilter_nogroup") . "\";");
        foreach ($rpgsuite->get_icgroups('fid <> 0') as $group) {
            $groupinfo = $group->get_info();
            eval("\$groupfilters .= \"" . $templates->get("rpglonelythread_groupfilter_group") . "\";");
        }
        foreach ($threads as $thread) {
            $trow = $count % 2 ? "trow2" : "trow1";
            $threaddate = date($mybb->settings['dateformat'], $thread['dateline']);
            eval("\$threadlist .= \"" . $templates->get("rpglonelythread_row") . "\";");
            $count++;
        }
        eval("\$threadpage = \"" . $templates->get("rpglonelythread_page") . "\";");
        output_page($threadpage);
        exit;
    }
}
开发者ID:megan-starr9,项目名称:RPGSuite,代码行数:29,代码来源:lonelythreads.php

示例4: load_groupcp

function load_groupcp()
{
    global $mybb, $db, $cache, $templates, $title, $header, $headerinclude, $footer, $theme, $group;
    if ($mybb->settings['rpgsuite_groupmanagecp'] && $mybb->input['action'] == "managegroup") {
        // Get group id
        if ($mybb->input['gid'] && $mybb->usergroup['issupermod']) {
            $gid = intval($mybb->input['gid']);
            $groupnav = '&gid=' . $gid;
        } else {
            $gid = $mybb->user['displaygroup'];
            $groupnav = '';
        }
        $cpcontent = "";
        if ($mybb->settings['rpgsuite_groupranks_custom']) {
            $customranklink = '<a href="modcp.php?action=managegroup&section=customranks' . $groupnav . '">Manage Custom Ranks</a>';
        } else {
            $customranklink = '';
        }
        $usergroup = new UserGroup($mybb, $db, $cache);
        if ($usergroup->initialize($gid)) {
            $group = $usergroup->get_info();
            if (handle_form($usergroup)) {
                $url = "modcp.php?action=managegroup&gid=" . $gid;
                if ($mybb->input['section']) {
                    $url .= "&section=" . $mybb->input['section'];
                }
                redirect($url, "Your pack settings were successfully updated.");
            }
            if ($mybb->input['section'] == 'groupoptions') {
                $title = 'Manage Options';
                add_breadcrumb('Manage Options');
                $cpcontent = load_groupmod_options($usergroup);
            } else {
                if ($mybb->input['section'] == 'groupmembers') {
                    $title = 'Manage Members';
                    add_breadcrumb('Manage Members');
                    $cpcontent = load_groupmod_members($usergroup);
                } else {
                    if ($mybb->input['section'] == 'customranks' && $mybb->settings['rpgsuite_groupranks_custom']) {
                        $ttile = 'Manage Custom Ranks';
                        add_breadcrumb('Manage Custom Ranks');
                        $cpcontent = load_groupmod_customranks($usergroup);
                    } else {
                        $title = 'Manage Ranks';
                        add_breadcrumb('Manage Ranks');
                        $cpcontent = load_groupmod_ranks($usergroup);
                    }
                }
            }
            // Add group styling
            eval("\$headerinclude .= \"" . $templates->get('rpgmisc_groupstyle') . "\";");
        } else {
            $cpcontent = "Invalid Group";
        }
        eval("\$groupmanagecp = \"" . $templates->get('rpggroupmanagecp_full') . "\";");
        output_page($groupmanagecp);
        exit;
    }
}
开发者ID:megan-starr9,项目名称:RPGSuite,代码行数:59,代码来源:groupmanagecp.php

示例5: mv_embed_iframe

function mv_embed_iframe()
{
    if (!function_exists('filter_input')) {
        die('your version of PHP lacks <b>filter_input()</b> function<br />');
    }
    // Default to null media if not provided
    $stream_name = isset($_GET['sn']) ? $_GET['sn'] : die('no stream name provided');
    $time = isset($_GET['t']) ? $_GET['t'] : '';
    $width = isset($_GET['width']) ? intval($_GET['width']) : '400';
    $height = isset($_GET['height']) ? intval($_GET['height']) : '300';
    //
    $roe_url = 'http://metavid.org/wiki/Special:MvExportStream?feed_format=roe' . '&stream_name=' . htmlspecialchars($stream_name) . '&t=' . htmlspecialchars($time);
    // Everything good, output page:
    output_page(array('roe_url' => $roe_url, 'width' => $width, 'height' => $height));
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:15,代码来源:mv_embed_iframe.php

示例6: viewranks_init

function viewranks_init()
{
    global $mybb, $db, $cache, $templates, $header, $footer, $headerinclude, $title, $theme, $parser;
    if ($mybb->settings['rpgsuite_groupranks'] && $mybb->input['action'] == "showranks") {
        // Get group id
        if ($mybb->input['gid'] != '') {
            $gid = intval($mybb->input['gid']);
        } else {
            $gid = $mybb->user['displaygroup'];
        }
        $usergroup = new UserGroup($mybb, $db, $cache);
        if ($usergroup->initialize($gid)) {
            $group = $usergroup->get_info();
            // Add Group Styling
            eval("\$headerinclude .= \"" . $templates->get('rpgmisc_groupstyle') . "\";");
            if ($group['hasranks']) {
                $title = $group['title'] . " Ranks";
                if ($group['fid']) {
                    add_breadcrumb($group['title'] . ' Forum', 'forumdisplay.php?fid=' . (int) $group['fid']);
                }
                add_breadcrumb($group['title'] . ' Ranks');
                $tierlist = build_ranks($usergroup);
                $unrankedlist = build_unranked($usergroup);
                eval("\$rankpage = \"" . $templates->get('rpggroupview_ranks_full') . "\";");
                output_page($rankpage);
            } else {
                $title = $group['title'] . " Members";
                if ($group['fid']) {
                    add_breadcrumb($group['title'] . ' Forum', 'forumdisplay.php?fid=' . (int) $group['fid']);
                }
                add_breadcrumb($group['title'] . ' Members');
                // set up the pager
                $multipage = setup_viewgroup_pages($group['gid'], $usergroup->get_member_count(), $start);
                $memberlist = build_members($usergroup, $start);
                eval("\$memberpage = \"" . $templates->get('rpggroupview_noranks_full') . "\";");
                output_page($memberpage);
            }
            exit;
        }
    }
}
开发者ID:megan-starr9,项目名称:RPGSuite,代码行数:41,代码来源:viewranks.php

示例7: htmlspecialchars_uni

        $fromemail = htmlspecialchars_uni($mybb->get_input('fromemail'));
        $subject = htmlspecialchars_uni($mybb->get_input('subject'));
        $message = htmlspecialchars_uni($mybb->get_input('message'));
    } else {
        $errors = '';
        $fromname = '';
        $fromemail = '';
        $subject = '';
        $message = '';
    }
    // Generate CAPTCHA?
    if ($mybb->settings['captchaimage'] && $mybb->user['uid'] == 0) {
        require_once MYBB_ROOT . 'inc/class_captcha.php';
        $post_captcha = new captcha(true, "post_captcha");
        if ($post_captcha->html) {
            $captcha = $post_captcha->html;
        }
    } else {
        $captcha = '';
    }
    $from_email = '';
    if ($mybb->user['uid'] == 0) {
        eval("\$from_email = \"" . $templates->get("member_emailuser_guest") . "\";");
    }
    $plugins->run_hooks("member_emailuser_end");
    eval("\$emailuser = \"" . $templates->get("member_emailuser") . "\";");
    output_page($emailuser);
}
if (!$mybb->input['action']) {
    header("Location: index.php");
}
开发者ID:nicopinto,项目名称:fantasitura.com,代码行数:31,代码来源:member.php

示例8: reset

            }
        }
    }
    // Now we build the actual online rows - we do this separately because we need to query all of the specific activity and location information
    $online_rows = '';
    if (is_array($users)) {
        reset($users);
        foreach ($users as $user) {
            $online_rows .= build_wol_row($user);
        }
    }
    if (is_array($guests)) {
        reset($guests);
        foreach ($guests as $user) {
            $online_rows .= build_wol_row($user);
        }
    }
    // Fetch the most online information
    $most_online = $cache->read("mostonline");
    $record_count = $most_online['numusers'];
    $record_date = my_date($mybb->settings['dateformat'], $most_online['time']);
    $record_time = my_date($mybb->settings['timeformat'], $most_online['time']);
    // Set automatic refreshing if enabled
    if ($mybb->settings['refreshwol'] > 0) {
        $refresh_time = $mybb->settings['refreshwol'] * 60;
        $refresh = "<meta http-equiv=\"refresh\" content=\"{$refresh_time};URL=online.php{$refresh_string}\" />";
    }
    $plugins->run_hooks("online_end");
    eval("\$online = \"" . $templates->get("online") . "\";");
    output_page($online);
}
开发者ID:benn0034,项目名称:SHIELDsite2.old,代码行数:31,代码来源:online.php

示例9: my_mail

        // Send the actual message
        my_mail($mybb->input['email'], $mybb->input['subject'], $message, $from, "", "", false, "text", "", $mybb->user['email']);
        if ($mybb->settings['mail_logging'] > 0) {
            // Log the message
            $log_entry = array("subject" => $db->escape_string($mybb->input['subject']), "message" => $db->escape_string($message), "dateline" => TIME_NOW, "fromuid" => $mybb->user['uid'], "fromemail" => $db->escape_string($mybb->user['email']), "touid" => 0, "toemail" => $db->escape_string($mybb->input['email']), "tid" => $thread['tid'], "ipaddress" => $db->escape_string($session->ipaddress));
            $db->insert_query("maillogs", $log_entry);
        }
        $plugins->run_hooks("sendthread_do_sendtofriend_end");
        redirect(get_thread_link($thread['tid']), $lang->redirect_emailsent);
    } else {
        $mybb->input['action'] = '';
    }
}
if (!$mybb->input['action']) {
    $plugins->run_hooks("sendthread_start");
    // Do we have some errors?
    if (count($errors) >= 1) {
        $errors = inline_error($errors);
        $email = htmlspecialchars_uni($mybb->input['email']);
        $subject = htmlspecialchars_uni($mybb->input['subject']);
        $message = htmlspecialchars_uni($mybb->input['message']);
    } else {
        $errors = '';
        $email = '';
        $subject = $lang->sprintf($lang->emailsubject_sendtofriend, $mybb->settings['bbname']);
        $message = '';
    }
    $plugins->run_hooks("sendthread_end");
    eval("\$sendtofriend = \"" . $templates->get("sendthread") . "\";");
    output_page($sendtofriend);
}
开发者ID:ThinhNguyenVB,项目名称:Gradient-Studios-Website,代码行数:31,代码来源:sendthread.php

示例10: nice_time

            $remaining = $banned['remaining'];
            $timeremaining = nice_time($remaining, array('short' => 1, 'seconds' => false)) . "";
            if ($remaining <= 0) {
                $timeremaining = "<span style=\"color: red;\">({$lang->ban_ending_imminently})</span>";
            } else {
                if ($remaining < 3600) {
                    $timeremaining = "<span style=\"color: red;\">({$timeremaining} {$lang->ban_remaining})</span>";
                } else {
                    if ($remaining < 86400) {
                        $timeremaining = "<span style=\"color: maroon;\">({$timeremaining} {$lang->ban_remaining})</span>";
                    } else {
                        if ($remaining < 604800) {
                            $timeremaining = "<span style=\"color: green;\">({$timeremaining} {$lang->ban_remaining})</span>";
                        } else {
                            $timeremaining = "({$timeremaining} {$lang->ban_remaining})";
                        }
                    }
                }
            }
        }
        eval("\$bannedusers .= \"" . $templates->get("modcp_banning_ban") . "\";");
    }
    if (!$bannedusers) {
        eval("\$bannedusers = \"" . $templates->get("modcp_nobanned") . "\";");
    }
    $modnotes = $cache->read("modnotes");
    $modnotes = htmlspecialchars_uni($modnotes['modmessage']);
    $plugins->run_hooks("modcp_end");
    eval("\$modcp = \"" . $templates->get("modcp") . "\";");
    output_page($modcp);
}
开发者ID:olada,项目名称:mybbintegrator,代码行数:31,代码来源:modcp.php

示例11: alt_trow

            } else {
                if ($warning['expires']) {
                    $expires = $lang->already_expired;
                }
            }
        }
        $alt_bg = alt_trow();
        $plugins->run_hooks("warnings_warning");
        eval("\$warnings .= \"" . $templates->get("warnings_warning") . "\";");
    }
    if (!$warnings) {
        eval("\$warnings = \"" . $templates->get("warnings_no_warnings") . "\";");
    }
    $plugins->run_hooks("warnings_end");
    eval("\$warnings = \"" . $templates->get("warnings") . "\";");
    output_page($warnings);
}
function find_warnlevels_to_check(&$query, &$max_expiration_times, &$check_levels)
{
    global $db;
    // we have some warning levels we need to revoke
    $max_expiration_times = array(1 => -1, 2 => -1, 3 => -1);
    $check_levels = array(1 => false, 2 => false, 3 => false);
    while ($warn_level = $db->fetch_array($query)) {
        // revoke actions taken at this warning level
        $action = unserialize($warn_level['action']);
        if ($action['type'] < 1 || $action['type'] > 3) {
            continue;
        }
        $check_levels[$action['type']] = true;
        $max_exp_time =& $max_expiration_times[$action['type']];
开发者ID:GeorgeLVP,项目名称:mybb,代码行数:31,代码来源:warnings.php

示例12: newpoints_shop_page


//.........这里部分代码省略.........
                // check if the item exists
                if (!($item = newpoints_shop_get_item($mybb->input['iid']))) {
                    error($lang->newpoints_shop_invalid_item);
                }
                // check if the item is assigned to category
                if (!($cat = newpoints_shop_get_category($item['cid']))) {
                    error($lang->newpoints_shop_invalid_cat);
                }
                // check if we have permissions to view the parent category
                if (!newpoints_shop_check_permissions($cat['usergroups'])) {
                    error_no_permission();
                }
                if ($item['visible'] == 0 || $cat['visible'] == 0) {
                    error_no_permission();
                }
                $myitems = @unserialize($mybb->user['newpoints_items']);
                if (!$myitems) {
                    error($lang->newpoints_shop_inventory_empty);
                }
                // make sure we own the item
                $key = array_search($item['iid'], $myitems);
                if ($key === false) {
                    error($lang->newpoints_shop_selected_item_not_owned);
                }
                $lang->newpoints_shop_action = $lang->newpoints_shop_send_item;
                $item['name'] = htmlspecialchars_uni($item['name']);
                global $shop_action, $data, $colspan;
                $colspan = 2;
                $shop_action = 'do_send';
                $fields = '<input type="hidden" name="iid" value="' . $item['iid'] . '">';
                $data = "<td class=\"trow1\" width=\"50%\"><strong>" . $lang->newpoints_shop_send_item_username . ":</strong><br /><small>" . $lang->newpoints_shop_send_item_message . "</small></td><td class=\"trow1\" width=\"50%\"><input type=\"text\" class=\"textbox\" name=\"username\" value=\"\"></td>";
                $plugins->run_hooks("newpoints_shop_send_end");
                eval("\$page = \"" . $templates->get('newpoints_shop_do_action') . "\";");
                output_page($page);
                break;
            case 'do_send':
                $plugins->run_hooks("newpoints_shop_do_send_start");
                // check if the item exists
                if (!($item = newpoints_shop_get_item($mybb->input['iid']))) {
                    error($lang->newpoints_shop_invalid_item);
                }
                // check if the item is assigned to category
                if (!($cat = newpoints_shop_get_category($item['cid']))) {
                    error($lang->newpoints_shop_invalid_cat);
                }
                // check if we have permissions to view the parent category
                if (!newpoints_shop_check_permissions($cat['usergroups'])) {
                    error_no_permission();
                }
                if ($item['visible'] == 0 || $cat['visible'] == 0) {
                    error_no_permission();
                }
                $myitems = @unserialize($mybb->user['newpoints_items']);
                if (!$myitems) {
                    error($lang->newpoints_shop_inventory_empty);
                }
                // make sure we own the item
                $key = array_search($item['iid'], $myitems);
                if ($key === false) {
                    error($lang->newpoints_shop_selected_item_not_owned);
                }
                $username = trim($mybb->input['username']);
                if (!($user = newpoints_getuser_byname($username))) {
                    error($lang->newpoints_shop_invalid_user);
                } else {
                    if ($user['uid'] == $mybb->user['uid']) {
开发者ID:ambsalinas,项目名称:anima,代码行数:67,代码来源:newpoints_shop.php

示例13: error

                    $lang->error_searchflooding = $lang->sprintf($lang->error_searchflooding_1, $mybb->settings['searchfloodtime']);
                } else {
                    $lang->error_searchflooding = $lang->sprintf($lang->error_searchflooding, $mybb->settings['searchfloodtime'], $remaining_time);
                }
                error($lang->error_searchflooding);
            }
        }
        $search_data = array("keywords" => $mybb->input['keywords'], "postthread" => 1, "tid" => $mybb->input['tid']);
        if ($db->can_search == true) {
            if ($mybb->settings['searchtype'] == "fulltext" && $db->supports_fulltext_boolean("posts") && $db->is_fulltext("posts")) {
                $search_results = perform_search_mysql_ft($search_data);
            } else {
                $search_results = perform_search_mysql($search_data);
            }
        } else {
            error($lang->error_no_search_support);
        }
        $sid = md5(uniqid(microtime(), 1));
        $searcharray = array("sid" => $db->escape_string($sid), "uid" => $mybb->user['uid'], "dateline" => $now, "ipaddress" => $db->escape_string($session->ipaddress), "threads" => $search_results['threads'], "posts" => $search_results['posts'], "resulttype" => 'posts', "querycache" => $search_results['querycache'], "keywords" => $db->escape_string($mybb->input['keywords']));
        $plugins->run_hooks("search_thread_process");
        $db->insert_query("searchlog", $searcharray);
        $plugins->run_hooks("search_do_search_end");
        redirect("search.php?action=results&sid=" . $sid, $lang->redirect_searchresults);
    } else {
        $plugins->run_hooks("search_start");
        $srchlist = make_searchable_forums("", $fid);
        eval("\$search = \"" . $templates->get("search") . "\";");
        $plugins->run_hooks("search_end");
        output_page($search);
    }
}
开发者ID:benn0034,项目名称:SHIELDsite2.old,代码行数:31,代码来源:search.php

示例14: elseif

                                ++$tcount;
                            } elseif ($attachment['thumbnail'] == "SMALL" && $forumpermissions[$announcement['fid']]['candlattachments'] == 1) {
                                // Image is small enough to show - no thumbnail
                                eval("\$post['imagelist'] .= \"" . $templates->get("postbit_attachments_images_image") . "\";");
                            } else {
                                eval("\$post['attachmentlist'] .= \"" . $templates->get("postbit_attachments_attachment") . "\";");
                            }
                        }
                    } else {
                        $validationcount++;
                    }
                }
                if ($post['thumblist']) {
                    eval("\$post['attachedthumbs'] = \"" . $templates->get("postbit_attachments_thumbnails") . "\";");
                }
                if ($post['imagelist']) {
                    eval("\$post['attachedimages'] = \"" . $templates->get("postbit_attachments_images") . "\";");
                }
                if ($post['attachmentlist'] || $post['thumblist'] || $post['imagelist']) {
                    eval("\$post['attachments'] = \"" . $templates->get("postbit_attachments") . "\";");
                }
            }
            eval("\$announcements .= \"" . $templates->get("portal_announcement") . "\";");
            unset($post);
        }
    }
}
$plugins->run_hooks("portal_end");
eval("\$portal = \"" . $templates->get("portal") . "\";");
output_page($portal);
开发者ID:dequeues,项目名称:mybb,代码行数:30,代码来源:portal.php

示例15: mytwconnect_usercp


//.........这里部分代码省略.........
        $lang->load('mytwconnect');
    }
    // Authenticate
    if ($mybb->input['action'] == 'twlink') {
        $TwitterConnect->set_fallback('usercp.php?action=do_twlink');
        $TwitterConnect->authenticate();
    }
    // Link account to his Twitter's one
    if ($mybb->input['action'] == 'do_twlink') {
        $TwitterConnect->obtain_tokens();
        $user = $TwitterConnect->get_user();
        if ($user) {
            $TwitterConnect->link_user('', $user['id']);
        } else {
            error($lang->mytwconnect_error_noauth);
        }
        $TwitterConnect->redirect('usercp.php?action=mytwconnect', '', $lang->mytwconnect_success_linked);
    }
    // Settings page
    if ($mybb->input['action'] == 'mytwconnect') {
        global $db, $lang, $theme, $templates, $headerinclude, $header, $footer, $plugins, $usercpnav;
        add_breadcrumb($lang->nav_usercp, 'usercp.php');
        add_breadcrumb($lang->mytwconnect_page_title, 'usercp.php?action=mytwconnect');
        // The user is changing his settings
        if ($mybb->request_method == 'post' or $_SESSION['twlogin']) {
            if ($mybb->request_method == 'post') {
                verify_post_check($mybb->input['my_post_key']);
            }
            // He's unlinking his account
            if ($mybb->input['unlink']) {
                $TwitterConnect->unlink_user();
                redirect('usercp.php?action=mytwconnect', $lang->mytwconnect_success_accunlinked, $lang->mytwconnect_success_accunlinked_title);
            } else {
                $settings = array();
                foreach ($settingsToCheck as $setting) {
                    $settings[$setting] = 0;
                    if ($mybb->input[$setting] == 1) {
                        $settings[$setting] = 1;
                    }
                    // Build a list of parameters to include in the fallback URL
                    $loginUrlExtra .= "&{$setting}=" . $settings[$setting];
                }
                // Process the tokens
                if ($_SESSION['twlogin']) {
                    $TwitterConnect->obtain_tokens();
                }
                $user = $TwitterConnect->get_user();
                // This user is not logged in with Twitter
                if (!$user) {
                    // Store a token in the session, we will check for it in the next call
                    $_SESSION['twlogin'] = 1;
                    $TwitterConnect->set_fallback("usercp.php?action=mytwconnect" . $loginUrlExtra);
                    $TwitterConnect->authenticate();
                    return;
                }
                if ($db->update_query('users', $settings, 'uid = ' . (int) $mybb->user['uid'])) {
                    unset($_SESSION['twlogin']);
                    $newUser = array_merge($mybb->user, $settings);
                    $TwitterConnect->sync($newUser, $user);
                    redirect('usercp.php?action=mytwconnect', $lang->mytwconnect_success_settingsupdated, $lang->mytwconnect_success_settingsupdated_title);
                }
            }
        }
        $options = '';
        if ($mybb->user['mytw_uid']) {
            // Checking if admins and users want to sync that stuff
            foreach ($settingsToCheck as $setting) {
                $tempKey = 'mytwconnect_' . $setting;
                if (!$mybb->settings[$tempKey]) {
                    continue;
                }
                $userSettings[$setting] = 0;
                if ($mybb->user[$setting]) {
                    $userSettings[$setting] = 1;
                }
            }
            $text = $lang->setting_mytwconnect_whattosync;
            $unlink = "<input type=\"submit\" class=\"button\" name=\"unlink\" value=\"{$lang->mytwconnect_settings_unlink}\" />";
            if ($userSettings) {
                foreach ($userSettings as $setting => $value) {
                    $tempKey = 'mytwconnect_settings_' . $setting;
                    $checked = '';
                    if ($value) {
                        $checked = " checked=\"checked\"";
                    }
                    $label = $lang->{$tempKey};
                    $altbg = alt_trow();
                    eval("\$options .= \"" . $templates->get('mytwconnect_usercp_settings_setting') . "\";");
                }
            } else {
                $text = $lang->setting_mytwconnect_connected;
            }
        } else {
            $text = $lang->setting_mytwconnect_linkaccount;
            eval("\$options = \"" . $templates->get('mytwconnect_usercp_settings_linkprofile') . "\";");
        }
        eval("\$content = \"" . $templates->get('mytwconnect_usercp_settings') . "\";");
        output_page($content);
    }
}
开发者ID:forumwatt,项目名称:MyTwitter-Connect,代码行数:101,代码来源:mytwconnect.php


注:本文中的output_page函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。