Example #1
0
/**
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;
}
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;
    }
}
Example #3
0
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;
    }
}
Example #4
0
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;
    }
}
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));
}
Example #6
0
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;
        }
    }
}
Example #7
0
        $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");
}
Example #8
0
            }
        }
    }
    // 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);
}
        // 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);
}
Example #10
0
            $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);
}
Example #11
0
            } 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']];
Example #12
0
function newpoints_shop_page()
{
    global $mybb, $db, $lang, $cache, $theme, $header, $templates, $plugins, $headerinclude, $footer, $options, $inline_errors;
    if (!$mybb->user['uid']) {
        return;
    }
    newpoints_lang_load("newpoints_shop");
    if ($mybb->input['action'] == "do_shop") {
        verify_post_check($mybb->input['postcode']);
        $plugins->run_hooks("newpoints_do_shop_start");
        switch ($mybb->input['shop_action']) {
            case 'buy':
                $plugins->run_hooks("newpoints_shop_buy_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();
                }
                // check group rules - primary group check
                $grouprules = newpoints_getrules('group', $mybb->user['usergroup']);
                if (!$grouprules) {
                    $grouprules['items_rate'] = 1.0;
                }
                // no rule set so default income rate is 1
                // if the group items rate is 0, the price of the item is 0
                if (floatval($grouprules['items_rate']) == 0) {
                    $item['price'] = 0;
                } else {
                    $item['price'] = $item['price'] * floatval($grouprules['items_rate']);
                }
                if (floatval($item['price']) > floatval($mybb->user['newpoints'])) {
                    $errors[] = $lang->newpoints_shop_not_enough;
                }
                if ($item['infinite'] != 1 && $item['stock'] <= 0) {
                    $errors[] = $lang->newpoints_shop_out_of_stock;
                }
                if ($item['limit'] != 0) {
                    // Get how many items of this type we have in our inventory
                    $myitems = @unserialize($mybb->user['newpoints_items']);
                    if (!$myitems) {
                        $myitems = array();
                    }
                    // If more than or equal to $item['limit'] -> FAILED
                    if (count(array_keys($myitems, $item['iid'])) >= $item['limit']) {
                        $errors[] = $lang->newpoints_shop_limit_reached;
                    }
                }
                if (!empty($errors)) {
                    $inline_errors = inline_error($errors, $lang->newpoints_shop_inline_errors);
                    $mybb->input = array();
                    $mybb->input['action'] = 'shop';
                } else {
                    $myitems = @unserialize($mybb->user['newpoints_items']);
                    if (!$myitems) {
                        $myitems = array();
                    }
                    $myitems[] = $item['iid'];
                    $db->update_query('users', array('newpoints_items' => serialize($myitems)), 'uid=\'' . $mybb->user['uid'] . '\'');
                    // update stock
                    if ($item['infinite'] != 1) {
                        $db->update_query('newpoints_shop_items', array('stock' => $item['stock'] - 1), 'iid=\'' . $item['iid'] . '\'');
                    }
                    // get money from user
                    newpoints_addpoints($mybb->user['uid'], -floatval($item['price']));
                    if (!empty($item['pm'])) {
                        // send PM if item has private message
                        newpoints_send_pm(array('subject' => $lang->newpoints_shop_bought_item_pm_subject, 'message' => $item['pm'], 'touid' => $mybb->user['uid'], 'receivepms' => 1), -1);
                    }
                    $plugins->run_hooks("newpoints_shop_buy_end", $item);
                    // log purchase
                    newpoints_log('shop_purchase', $lang->sprintf($lang->newpoints_shop_purchased_log, $item['iid'], $item['price']));
                    redirect($mybb->settings['bburl'] . "/newpoints.php?action=shop", $lang->newpoints_shop_item_bought, $lang->newpoints_shop_item_bought_title);
                }
                break;
            case 'send':
                $plugins->run_hooks("newpoints_shop_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);
                }
                $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']) {
                        error($lang->newpoints_shop_cant_send_item_self);
                    }
                    // send item to the selected user
                    $useritems = @unserialize($user['newpoints_items']);
                    if (!$useritems) {
                        $useritems = array();
                    }
                    $useritems[] = $item['iid'];
                    $db->update_query('users', array('newpoints_items' => serialize($useritems)), 'uid=\'' . $user['uid'] . '\'');
                    // remove item from our inventory
                    unset($myitems[$key]);
                    sort($myitems);
                    $db->update_query('users', array('newpoints_items' => serialize($myitems)), 'uid=\'' . $mybb->user['uid'] . '\'');
                    $plugins->run_hooks("newpoints_shop_do_send_end");
                    // send pm to user
                    newpoints_send_pm(array('subject' => $lang->newpoints_shop_item_received_title, 'message' => $lang->sprintf($lang->newpoints_shop_item_received, htmlspecialchars_uni($mybb->user['username']), htmlspecialchars_uni($item['name'])), 'touid' => $user['uid'], 'receivepms' => 1), -1);
                    // log
                    newpoints_log('shop_send', $lang->sprintf($lang->newpoints_shop_sent_log, $item['iid'], $user['uid'], $user['username']));
                    redirect($mybb->settings['bburl'] . "/newpoints.php?action=shop&amp;shop_action=myitems", $lang->newpoints_shop_item_sent, $lang->newpoints_shop_item_sent_title);
                }
                break;
            case 'sell':
                $plugins->run_hooks("newpoints_shop_sell_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);
                }
                $lang->newpoints_shop_action = $lang->newpoints_shop_sell_item;
                $item['name'] = htmlspecialchars_uni($item['name']);
                global $shop_action, $data, $colspan;
                $colspan = 1;
                $shop_action = 'do_sell';
                $fields = '<input type="hidden" name="iid" value="' . $item['iid'] . '">';
                $data = "<td class=\"trow1\" width=\"100%\">" . $lang->sprintf($lang->newpoints_shop_sell_item_confirm, htmlspecialchars_uni($item['name']), newpoints_format_points(floatval($item['price']) * $mybb->settings['newpoints_shop_percent'])) . "</td>";
                $plugins->run_hooks("newpoints_shop_sell_end");
                eval("\$page = \"" . $templates->get('newpoints_shop_do_action') . "\";");
                output_page($page);
                break;
            case 'do_sell':
                $plugins->run_hooks("newpoints_shop_do_sell_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);
                }
                // remove item from our inventory
                unset($myitems[$key]);
                sort($myitems);
                $db->update_query('users', array('newpoints_items' => serialize($myitems)), 'uid=\'' . $mybb->user['uid'] . '\'');
                // update stock
                if ($item['infinite'] != 1) {
                    $db->update_query('newpoints_shop_items', array('stock' => $item['stock'] + 1), 'iid=\'' . $item['iid'] . '\'');
                }
                newpoints_addpoints($mybb->user['uid'], floatval($item['price']) * $mybb->settings['newpoints_shop_percent']);
                $plugins->run_hooks("newpoints_shop_do_sell_end");
                // log
                newpoints_log('shop_sell', $lang->sprintf($lang->newpoints_shop_sell_log, $item['iid'], floatval($item['price']) * $mybb->settings['newpoints_shop_percent']));
                redirect($mybb->settings['bburl'] . "/newpoints.php?action=shop&amp;shop_action=myitems", $lang->newpoints_shop_item_sell, $lang->newpoints_shop_item_sell_title);
                break;
            default:
                error_no_permission();
        }
        $plugins->run_hooks("newpoints_do_shop_end");
    }
    // shop page
    if ($mybb->input['action'] == "shop") {
        $plugins->run_hooks("newpoints_shop_start");
        if ($mybb->input['shop_action'] == 'view') {
            // 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();
            }
            $item['name'] = htmlspecialchars_uni($item['name']);
            $item['description'] = htmlspecialchars_uni($item['description']);
            // check group rules - primary group check
            $grouprules = newpoints_getrules('group', $mybb->user['usergroup']);
            if (!$grouprules) {
                $grouprules['items_rate'] = 1.0;
            }
            // no rule set so default income rate is 1
            // if the group items rate is 0, the price of the item is 0
            if (floatval($grouprules['items_rate']) == 0) {
                $item['price'] = 0;
            } else {
                $item['price'] = $item['price'] * floatval($grouprules['items_rate']);
            }
            $item['price'] = newpoints_format_points($item['price']);
            if ($item['price'] > $mybb->user['newpoints']) {
                $item['price'] = '<span style="color: #FF0000;">' . $item['price'] . '</span>';
            }
            // build icon
            if ($item['icon'] != '') {
                $item['icon'] = htmlspecialchars_uni($item['icon']);
                $item['icon'] = '<img src="' . $mybb->settings['bburl'] . '/' . $item['icon'] . '">';
            } else {
                $item['icon'] = '<img src="' . $mybb->settings['bburl'] . '/images/newpoints/default.png">';
            }
            if ($item['infinite'] == 1) {
                $item['stock'] = $lang->newpoints_shop_infinite;
            } else {
                $item['stock'] = intval($item['stock']);
            }
            if ($item['sendable'] == 1) {
                $item['sendable'] = $lang->newpoints_shop_yes;
            } else {
                $item['sendable'] = $lang->newpoints_shop_no;
            }
            if ($item['sellable'] == 1) {
                $item['sellable'] = $lang->newpoints_shop_yes;
            } else {
                $item['sellable'] = $lang->newpoints_shop_no;
            }
            eval("\$page = \"" . $templates->get('newpoints_shop_view_item') . "\";");
        } elseif ($mybb->input['shop_action'] == 'myitems') {
            $uid = intval($mybb->input['uid']);
            $uidpart = '';
            if ($uid > 0) {
                $user = get_user($uid);
                // we're viewing someone else's inventory
                if (!empty($user)) {
                    // we can't view others inventories if we don't have enough previleges
                    if ($mybb->settings['newpoints_shop_viewothers'] != 1 && $mybb->usergroup['cancp'] != 1 && $mybb->user['uid'] != $uid) {
                        error_no_permission();
                    }
                    $myitems = @unserialize($user['newpoints_items']);
                    $lang->newpoints_shop_myitems = $lang->sprintf($lang->newpoints_shop_items_username, htmlspecialchars_uni($user['username']));
                    $uidpart = "&amp;uid=" . $uid;
                    // we need this for pagination
                } else {
                    $myitems = @unserialize($mybb->user['newpoints_items']);
                }
            } else {
                $myitems = @unserialize($mybb->user['newpoints_items']);
            }
            $items = '';
            $newrow = true;
            $invert_bgcolor = alt_trow();
            if ($mybb->settings['newpoints_shop_sendable'] != 1) {
                $sendable = false;
            } else {
                $sendable = true;
            }
            if ($mybb->settings['newpoints_shop_sellable'] != 1) {
                $sellable = false;
            } else {
                $sellable = true;
            }
            require_once MYBB_ROOT . "inc/class_parser.php";
            $parser = new postParser();
            $parser_options = array('allow_mycode' => 1, 'allow_smilies' => 1, 'allow_imgcode' => 0, 'allow_html' => 0, 'filter_badwords' => 1);
            if (!empty($myitems)) {
                // pagination
                $per_page = 10;
                $mybb->input['page'] = intval($mybb->input['page']);
                if ($mybb->input['page'] && $mybb->input['page'] > 1) {
                    $mybb->input['page'] = intval($mybb->input['page']);
                    $start = $mybb->input['page'] * $per_page - $per_page;
                } else {
                    $mybb->input['page'] = 1;
                    $start = 0;
                }
                // total items
                $total_rows = $db->fetch_field($db->simple_select("newpoints_shop_items", "COUNT(iid) as items", 'visible=1 AND iid IN (' . implode(',', array_unique($myitems)) . ')'), "items");
                // multi-page
                if ($total_rows > $per_page) {
                    $multipage = multipage($total_rows, $per_page, $mybb->input['page'], $mybb->settings['bburl'] . "/newpoints.php?action=shop&shop_action=myitems" . $uidpart);
                }
                $query = $db->simple_select('newpoints_shop_items', '*', 'visible=1 AND iid IN (' . implode(',', array_unique($myitems)) . ')', array('limit' => "{$start}, {$per_page}"));
                while ($item = $db->fetch_array($query)) {
                    if ($newrow === true) {
                        $trstart = '<tr>';
                        $trend = '';
                        $newrow = false;
                    } elseif ($newrow === false) {
                        $trstart = '';
                        $trend = '</tr>';
                        $newrow = true;
                    }
                    if ($sellable === true && $item['sellable']) {
                        if ($sendable === true && $item['sendable']) {
                            $tdstart = '<td width="50%">';
                        } else {
                            $tdstart = '<td width="100%">';
                        }
                        $sell = $tdstart . '<form action="newpoints.php" method="POST"><input type="hidden" name="action" value="do_shop"><input type="hidden" name="shop_action" value="sell"><input type="hidden" name="iid" value="' . $item['iid'] . '"><input type="hidden" name="postcode" value="' . $mybb->post_code . '"><input type="submit" name="submit" value="' . $lang->newpoints_shop_sell . '"></form></td>';
                    } else {
                        $sell = '';
                    }
                    if ($sendable === true && $item['sendable']) {
                        if ($sell == '') {
                            $tdstart = '<td width="100%">';
                        } else {
                            $tdstart = '<td width="50%">';
                        }
                        $send = $tdstart . '<form action="newpoints.php" method="POST"><input type="hidden" name="action" value="do_shop"><input type="hidden" name="shop_action" value="send"><input type="hidden" name="iid" value="' . $item['iid'] . '"><input type="hidden" name="postcode" value="' . $mybb->post_code . '"><input type="submit" name="submit" value="' . $lang->newpoints_shop_send . '"></form></td>';
                    } else {
                        $send = '';
                    }
                    if (!$send && !$sell) {
                        $send = $lang->newpoints_shop_no_options;
                    }
                    $item['description'] = $parser->parse_message($item['description'], $parser_options);
                    // check group rules - primary group check
                    $grouprules = newpoints_getrules('group', $mybb->user['usergroup']);
                    if (!$grouprules) {
                        $grouprules['items_rate'] = 1.0;
                    }
                    // no rule set so default income rate is 1
                    // if the group items rate is 0, the price of the item is 0
                    if (floatval($grouprules['items_rate']) == 0) {
                        $item['price'] = 0;
                    } else {
                        $item['price'] = $item['price'] * floatval($grouprules['items_rate']);
                    }
                    $item['price'] = newpoints_format_points($item['price']);
                    $item['quantity'] = count(array_keys($myitems, $item['iid']));
                    // build icon
                    if ($item['icon'] != '') {
                        $item['icon'] = htmlspecialchars_uni($item['icon']);
                        $item['icon'] = '<img src="' . $mybb->settings['bburl'] . '/' . $item['icon'] . '">';
                    } else {
                        $item['icon'] = '<img src="' . $mybb->settings['bburl'] . '/images/newpoints/default.png">';
                    }
                    $bgcolor = alt_trow();
                    $invert_bgcolor = alt_trow();
                    eval("\$items .= \"" . $trstart . $templates->get('newpoints_shop_myitems_item') . $trend . "\";");
                }
                if (!$items) {
                    eval("\$items = \"" . $templates->get('newpoints_shop_myitems_no_items') . "\";");
                } else {
                    if ($newrow === false) {
                        eval("\$items .= \"" . $templates->get('newpoints_shop_myitems_item_empty') . "</tr>" . "\";");
                        $newrow = true;
                    }
                }
            } else {
                eval("\$items = \"" . $templates->get('newpoints_shop_myitems_no_items') . "\";");
            }
            eval("\$page = \"" . $templates->get('newpoints_shop_myitems') . "\";");
        } else {
            // check group rules - primary group check
            $grouprules = newpoints_getrules('group', $mybb->user['usergroup']);
            if (!$grouprules) {
                $grouprules['items_rate'] = 1.0;
            }
            // no rule set so default income rate is 1
            // if the group items rate is 0, the price of the item is 0
            $itemsrate = floatval($grouprules['items_rate']);
            global $cats, $items;
            // get categories
            $query = $db->simple_select('newpoints_shop_categories', '*', '', array('order_by' => 'disporder', 'order_dir' => 'ASC'));
            while ($cat = $db->fetch_array($query)) {
                $categories[$cat['cid']] = $cat;
            }
            // get items and store them in their categories
            $query = $db->simple_select('newpoints_shop_items', '*', 'visible=1 AND cid>0', array('order_by' => 'disporder', 'order_dir' => 'ASC'));
            while ($item = $db->fetch_array($query)) {
                $items_array[$item['cid']][$item['iid']] = $item;
            }
            $cats = '';
            $bgcolor = '';
            $bgcolor = alt_trow();
            // build items and categories
            if (!empty($categories)) {
                foreach ($categories as $cid => $category) {
                    $items = '';
                    if ($category['items'] > 0 && !empty($items_array[$category['cid']])) {
                        foreach ($items_array as $cid => $member) {
                            if ($cid != $category['cid']) {
                                continue;
                            }
                            $bgcolor = alt_trow();
                            foreach ($member as $iid => $item) {
                                // skip hidden items
                                if ($item['visible'] == 0) {
                                    continue;
                                }
                                if ($item['infinite'] == 1) {
                                    $item['stock'] = $lang->newpoints_shop_infinite;
                                }
                                if ($item['price'] > $mybb->user['newpoints']) {
                                    $enough_money = false;
                                } else {
                                    $enough_money = true;
                                }
                                $item['name'] = htmlspecialchars_uni($item['name']);
                                $item['description'] = htmlspecialchars_uni($item['description']);
                                $item['price'] = newpoints_format_points($item['price'] * $itemsrate);
                                // build icon
                                if ($item['icon'] != '') {
                                    $item['icon'] = htmlspecialchars_uni($item['icon']);
                                    $item['icon'] = '<img src="' . $mybb->settings['bburl'] . '/' . $item['icon'] . '">';
                                } else {
                                    $item['icon'] = '<img src="' . $mybb->settings['bburl'] . '/images/newpoints/default.png">';
                                }
                                if (!$enough_money) {
                                    $item['price'] = '<span style="color: #FF0000;">' . $item['price'] . '</span>';
                                }
                                eval("\$items .= \"" . $templates->get('newpoints_shop_item') . "\";");
                            }
                        }
                    } else {
                        eval("\$items = \"" . $templates->get('newpoints_shop_no_items') . "\";");
                    }
                    // if it's not visible, don't show it
                    if ($category['visible'] == 0) {
                        continue;
                    }
                    // check if we have permissions to view the category
                    if (!newpoints_shop_check_permissions($category['usergroups'])) {
                        continue;
                    }
                    // Expanded by default feature
                    global $extdisplay, $expcolimage, $expdisplay, $expaltext, $icon;
                    $expdisplay = '';
                    if (intval($category['expanded']) == 0) {
                        $expcolimage = "collapse_collapsed.gif";
                        $expdisplay = "display: none;";
                        $expaltext = "[+]";
                    } else {
                        $expcolimage = "collapse.gif";
                        $expaltext = "[-]";
                    }
                    // build icon
                    if ($category['icon'] != '') {
                        $category['icon'] = htmlspecialchars_uni($category['icon']);
                        $category['icon'] = '<img src="' . $mybb->settings['bburl'] . '/' . $category['icon'] . '" style="vertical-align:middle">';
                    }
                    // sanitize html
                    $category['description'] = htmlspecialchars_uni($category['description']);
                    $category['name'] = htmlspecialchars_uni($category['name']);
                    eval("\$cats .= \"" . $templates->get('newpoints_shop_category') . "\";");
                }
            } else {
                eval("\$cats = \"" . $templates->get('newpoints_shop_no_cats') . "\";");
            }
            eval("\$page = \"" . $templates->get('newpoints_shop') . "\";");
        }
        $plugins->run_hooks("newpoints_shop_end");
        // output page
        output_page($page);
    }
}
Example #13
0
                    $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);
    }
}
Example #14
0
                                ++$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);
function mytwconnect_usercp()
{
    global $mybb, $lang, $inlinesuccess;
    // Load API in certain areas
    if (in_array($mybb->input['action'], array('twlink', 'do_twlink')) or $_SESSION['twlogin'] or $mybb->input['action'] == 'mytwconnect' and $mybb->request_method == 'post') {
        require_once MYBB_ROOT . "inc/plugins/MyTwitterConnect/class_twitter.php";
        $TwitterConnect = new MyTwitter();
    }
    $settingsToCheck = array('twavatar', 'twbio', 'twlocation');
    if (!$lang->mytwconnect) {
        $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);
    }
}
Example #16
0
        $lang->subscribe_to_thread = $lang->sprintf($lang->subscribe_to_thread, $thread['subject']);
        $notification_none_checked = $notification_email_checked = $notification_pm_checked = '';
        if ($mybb->user['subscriptionmethod'] == 1 || $mybb->user['subscriptionmethod'] == 0) {
            $notification_none_checked = "checked=\"checked\"";
        } else {
            if ($mybb->user['subscriptionmethod'] == 2) {
                $notification_email_checked = "checked=\"checked\"";
            } else {
                if ($mybb->user['subscriptionmethod'] == 3) {
                    $notification_pm_checked = "checked=\"checked\"";
                }
            }
        }
        $plugins->run_hooks("usercp2_addsubscription_thread");
        eval("\$add_subscription = \"" . $templates->get("usercp_addsubscription_thread") . "\";");
        output_page($add_subscription);
        exit;
    }
} elseif ($mybb->get_input('action') == "removesubscription") {
    if ($mybb->get_input('type') == "forum") {
        $forum = get_forum($mybb->get_input('fid', MyBB::INPUT_INT));
        if (!$forum) {
            error($lang->error_invalidforum);
        }
        $plugins->run_hooks("usercp2_removesubscription_forum");
        remove_subscribed_forum($forum['fid']);
        if ($server_http_referer) {
            $url = $server_http_referer;
        } else {
            $url = "usercp.php?action=forumsubscriptions";
        }
Example #17
0
        $foruminfo = $forum;
        if ($forum['rulestype'] == 3) {
            eval("\$forumrules = \"" . $templates->get("forumdisplay_rules") . "\";");
        } else {
            if ($forum['rulestype'] == 2) {
                eval("\$forumrules = \"" . $templates->get("forumdisplay_rules_link") . "\";");
            }
        }
    }
    $moderation_notice = '';
    if (!is_moderator($forum['fid'], "canapproveunapproveattachs")) {
        if ($forumpermissions['modattachments'] == 1 && $forumpermissions['canpostattachments'] != 0) {
            $moderation_text = $lang->moderation_forum_attachments;
            eval('$moderation_notice = "' . $templates->get('global_moderation_notice') . '";');
        }
    }
    if (!is_moderator($forum['fid'], "canapproveunapproveposts")) {
        if ($forumpermissions['modposts'] == 1) {
            $moderation_text = $lang->moderation_forum_posts;
            eval('$moderation_notice = "' . $templates->get('global_moderation_notice') . '";');
        }
        if ($mybb->user['moderateposts'] == 1) {
            $moderation_text = $lang->moderation_user_posts;
            eval('$moderation_notice = "' . $templates->get('global_moderation_notice') . '";');
        }
    }
    $plugins->run_hooks("newreply_end");
    $forum['name'] = strip_tags($forum['name']);
    eval("\$newreply = \"" . $templates->get("newreply") . "\";");
    output_page($newreply);
}
Example #18
0
        $username_same = $db->fetch_field($query, 'username');
        // Don't run if Steam ID matches another user's current ID, and display error.
        if ($db->num_rows($query)) {
            $submit_message = '
				<p><em>' . $lang->please_correct_errors . '</em></p>
				<p>' . $lang->mysteam_submit_same . $username_same . '</p>';
        } else {
            $db->update_query("users", array('steamid' => $steamid), "uid='" . $uid . "'");
            if ($vanity_url) {
                $success_third_line = '<br />
				<strong>' . $lang->mysteam_vanityurl . '</strong>' . $vanity_url . '</p>';
            } else {
                $success_third_line = '<br />
				<strong>' . $lang->mysteam_name . '</strong>' . $steamname . '</p>';
            }
            $submit_message = '<p><strong>' . $lang->mysteam_submit_success_modcp . '</strong></p>
				<p><strong>' . $lang->mysteam_steamid . '</strong>' . $steamid . $success_third_line;
        }
    } else {
        $submit_message = '<p><em>' . $lang->please_correct_errors . '</em></p>
			<p>' . $lang->mysteam_submit_invalid . '</p>';
    }
} elseif ($mybb->input['decouple']) {
    $db->update_query("users", array('steamid' => ''), "uid='" . $uid . "'");
    $submit_message = $lang->mysteam_decouple_success_modcp;
}
add_breadcrumb($lang->nav_modcp, 'modcp.php');
add_breadcrumb($lang->mysteam_integration, "modcp-submit.php");
eval("\$html = \"" . $templates->get("mysteam_submit") . "\";");
output_page($html);
Example #19
0
    // Build a forum cache.
    $query = $db->query("\n\t\tSELECT f.*, fr.dateline AS lastread\n\t\tFROM " . TABLE_PREFIX . "forums f\n\t\tLEFT JOIN " . TABLE_PREFIX . "forumsread fr ON (fr.fid = f.fid AND fr.uid = '{$mybb->user['uid']}')\n\t\tWHERE f.active != 0\n\t\tORDER BY pid, disporder\n\t");
}
while ($forum = $db->fetch_array($query)) {
    if ($mybb->user['uid'] == 0) {
        if (!empty($forumsread[$forum['fid']])) {
            $forum['lastread'] = $forumsread[$forum['fid']];
        }
    }
    $fcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
}
$forumpermissions = forum_permissions();
// Get the forum moderators if the setting is enabled.
$moderatorcache = array();
if ($mybb->settings['modlist'] != 0 && $mybb->settings['modlist'] != 'off') {
    $moderatorcache = $cache->read('moderators');
}
$excols = 'index';
$permissioncache['-1'] = '1';
$bgcolor = 'trow1';
// Decide if we're showing first-level subforums on the index page.
$showdepth = 2;
if ($mybb->settings['subforumsindex'] != 0) {
    $showdepth = 3;
}
$forum_list = build_forumbits();
$forums = $forum_list['forum_list'];
$plugins->run_hooks('index_end');
eval('$index = "' . $templates->get('index') . '";');
output_page($index);
Example #20
0
            $day_link = get_calendar_link($calendar['cid'], $calendar_year, $calendar_month, $day);
            // Is the current day
            if ($day . $calendar_month . $year == $today && $month == $calendar_month) {
                $day_class = "trow_sep";
            } else {
                if ($in_month == 0) {
                    $day_class = "trow1";
                } else {
                    $day_class = "trow2";
                }
            }
            eval("\$day_bits .= \"" . $templates->get("calendar_weekrow_day") . "\";");
            $day_birthdays = $day_events = "";
            ++$day;
        }
        if ($day_bits) {
            eval("\$calendar_rows .= \"" . $templates->get("calendar_weekrow") . "\";");
        }
        $day_bits = "";
    }
    $yearsel = '';
    for ($i = my_date("Y"); $i < my_date("Y") + 5; ++$i) {
        $yearsel .= "<option value=\"{$i}\">{$i}</option>\n";
    }
    if ($mybb->usergroup['canaddevents'] == 1) {
        eval("\$addevent = \"" . $templates->get("calendar_addeventlink") . "\";");
    }
    $plugins->run_hooks("calendar_end");
    eval("\$calendar = \"" . $templates->get("calendar") . "\";");
    output_page($calendar);
}
Example #21
0
        }
        $user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
        $user['profilelink'] = build_profile_link($user['username'], $user['uid']);
        if (in_array($user['uid'], $leaders_array)) {
            $leader = $lang->leader;
        } else {
            $leader = '';
        }
        // Checkbox for user management - only if current user is allowed
        $checkbox = '';
        if ($groupleader['canmanagemembers'] == 1) {
            eval("\$checkbox = \"" . $templates->get("managegroup_user_checkbox") . "\";");
        }
        eval("\$users .= \"" . $templates->get("managegroup_user") . "\";");
    }
    if (!$users) {
        eval("\$users = \"" . $templates->get("managegroup_no_users") . "\";");
    }
    $add_user = '';
    $remove_users = '';
    if ($groupleader['canmanagemembers'] == 1) {
        eval("\$add_user = \"" . $templates->get("managegroup_adduser") . "\";");
        eval("\$remove_users = \"" . $templates->get("managegroup_removeusers") . "\";");
    }
    if ($usergroup['type'] == 5 && $groupleader['caninvitemembers'] == 1) {
        eval("\$invite_user = \"" . $templates->get("managegroup_inviteuser") . "\";");
    }
    $plugins->run_hooks("managegroup_end");
    eval("\$manageusers = \"" . $templates->get("managegroup") . "\";");
    output_page($manageusers);
}
             $pcheck2[] = $tcheck['tid'];
         }
     }
     if (count($pcheck2) != count($pcheck)) {
         // One or more threads do not have posts after splitting
         error($lang->error_cantsplitall);
     }
     $inlineids = implode("|", $posts);
     if ($mybb->input['inlinetype'] == 'search') {
         clearinline($mybb->input['searchid'], 'search');
     } else {
         clearinline($tid, 'thread');
     }
     $forumselect = build_forum_jump("", $fid, 1, '', 0, true, '', "moveto");
     eval("\$splitposts = \"" . $templates->get("moderation_inline_splitposts") . "\";");
     output_page($splitposts);
     break;
     // Actually split the posts - Inline moderation
 // Actually split the posts - Inline moderation
 case "do_multisplitposts":
     // Verify incoming POST request
     verify_post_check($mybb->input['my_post_key']);
     $plist = array();
     $postlist = explode("|", $mybb->input['posts']);
     foreach ($postlist as $pid) {
         $pid = intval($pid);
         $plist[] = $pid;
     }
     if (!is_moderator_by_pids($plist, "canmanagethreads")) {
         error_no_permission();
     }
    static function show_archive()
    {
        global $db, $mybb, $templates, $lang, $theme, $footer, $headerinclude, $header, $charset;
        if (!dvz_shoutbox::access_view()) {
            return false;
        }
        header('Content-type: text/html; charset=' . $charset);
        add_breadcrumb($lang->dvz_sb_shoutbox, "index.php?action=shoutbox_archive");
        // moderation panel
        if (dvz_shoutbox::access_mod()) {
            if (isset($mybb->input['banlist']) && verify_post_check($mybb->input['postkey'])) {
                dvz_shoutbox::banlist_update($mybb->input['banlist']);
            }
            if (isset($mybb->input['days']) && verify_post_check($mybb->input['postkey'])) {
                if ($mybb->input['days'] == 'all') {
                    dvz_shoutbox::clear();
                } else {
                    $allowed = array(2, 7, 30, 90);
                    if (in_array($mybb->input['days'], $allowed)) {
                        dvz_shoutbox::clear($mybb->input['days']);
                    }
                }
            }
            $blocked_users = htmlspecialchars($mybb->settings['dvz_sb_blocked_users']);
            eval('$modoptions = "' . $templates->get("dvz_shoutbox_archive_modoptions") . '";');
        } else {
            $modoptions = null;
        }
        // pagination
        $shoutsTotal = dvz_shoutbox::count();
        $pageNum = (int) $mybb->input['page'];
        $perPage = (int) $mybb->settings['dvz_sb_num_archive'];
        $pages = ceil($shoutsTotal / $perPage);
        if (!$pageNum || $pageNum < 1 || $pageNum > $pages) {
            $pageNum = 1;
        }
        $start = ($pageNum - 1) * $perPage;
        if ($shoutsTotal > $perPage) {
            $multipage = multipage($shoutsTotal, $perPage, $pageNum, 'index.php?action=shoutbox_archive');
        }
        $data = dvz_shoutbox::get_multiple("ORDER by s.id DESC LIMIT {$start},{$perPage}");
        $archive = null;
        while ($row = $db->fetch_array($data)) {
            $archive .= dvz_shoutbox::render_shout($row, true);
        }
        $javascript = '
<script>
dvz_shoutbox.lang = [\'' . $lang->dvz_sb_delete_confirm . '\', \'' . str_replace('{ANTIFLOOD}', $mybb->settings['dvz_sb_antiflood'], $lang->dvz_sb_antiflood) . '\', \'' . $lang->dvz_sb_permissions . '\'];
</script>';
        eval('$content = "' . $templates->get("dvz_shoutbox_archive") . '";');
        output_page($content);
        exit;
    }
Example #24
0
$announcementarray = $db->fetch_array($query);
if (!$announcementarray) {
    error($lang->error_invalidannouncement);
}
// Gather usergroup data from the cache
// Field => Array Key
$data_key = array('title' => 'grouptitle', 'usertitle' => 'groupusertitle', 'stars' => 'groupstars', 'starimage' => 'groupstarimage', 'image' => 'groupimage', 'namestyle' => 'namestyle', 'usereputationsystem' => 'usereputationsystem');
foreach ($data_key as $field => $key) {
    $announcementarray[$key] = $groupscache[$announcementarray['usergroup']][$field];
}
$announcementarray['dateline'] = $announcementarray['startdate'];
$announcementarray['userusername'] = $announcementarray['username'];
$announcement = build_postbit($announcementarray, 3);
$announcementarray['subject'] = $parser->parse_badwords($announcementarray['subject']);
$lang->forum_announcement = $lang->sprintf($lang->forum_announcement, htmlspecialchars_uni($announcementarray['subject']));
if ($announcementarray['startdate'] > $mybb->user['lastvisit']) {
    $setcookie = true;
    if (isset($mybb->cookies['mybb']['announcements']) && is_scalar($mybb->cookies['mybb']['announcements'])) {
        $cookie = my_unserialize(stripslashes($mybb->cookies['mybb']['announcements']));
        if (isset($cookie[$announcementarray['aid']])) {
            $setcookie = false;
        }
    }
    if ($setcookie) {
        my_set_array_cookie('announcements', $announcementarray['aid'], $announcementarray['startdate'], -1);
    }
}
$plugins->run_hooks("announcements_end");
eval("\$forumannouncement = \"" . $templates->get("announcement") . "\";");
output_page($forumannouncement);
        if ($guestcount && $onlinemembers) {
            $onlinesep = $lang->comma;
        }
        $invisonline = '';
        if ($inviscount && $mybb->usergroup['canviewwolinvis'] != 1 && ($inviscount != 1 && $mybb->user['invisible'] != 1)) {
            $invisonline = $lang->sprintf($lang->users_browsing_thread_invis, $inviscount);
        }
        $onlinesep2 = '';
        if ($invisonline != '' && $guestcount) {
            $onlinesep2 = $lang->comma;
        }
        eval("\$usersbrowsing = \"" . $templates->get("showthread_usersbrowsing") . "\";");
    }
    $plugins->run_hooks("showthread_end");
    eval("\$showthread = \"" . $templates->get("showthread") . "\";");
    output_page($showthread);
}
/**
 * Build a navigation tree for threaded display.
 *
 * @param unknown_type $replyto
 * @param unknown_type $indent
 * @return unknown
 */
function buildtree($replyto = "0", $indent = "0")
{
    global $tree, $mybb, $theme, $mybb, $pid, $tid, $templates, $parser;
    if ($indent) {
        $indentsize = 13 * $indent;
    } else {
        $indentsize = 0;
Example #26
0
    <!DOCTYPE html><html dir="ltr" class="ltr_page" lang=en>
        <head>
            <meta charset="utf-8" />
            <link href="../modules/core/site.css" media="all" rel="stylesheet" type="text/css" />
            <title>Cypht Setup</title>
            <?php 
    page_style();
    ?>
        </head>
        <body>
            <form method="post">
                <table class="settings_table config_settings">
                    <?php 
    echo check_php();
    ?>
                    <?php 
    echo config_source($source);
    ?>
                    <?php 
    output_settings(read_config($source));
    ?>
                </table>
            </form>
        </body>
    </html>

<?php 
}
output_page('hm3.sample.ini');
Example #27
0
                $spaceused_severity = "medium";
            } else {
                $spaceused_severity = "high";
            }
            $overhalf = round($spaceused, 0) . "%";
            if ((int) $overhalf > 100) {
                $overhalf = "100%";
            }
        }
        if ($spaceused > 100) {
            $spaceused = 100;
            $spaceused2 = 0;
        }
        eval("\$pmspacebar = \"" . $templates->get("private_pmspace") . "\";");
    }
    $composelink = '';
    if ($mybb->usergroup['cansendpms'] == 1) {
        eval("\$composelink = \"" . $templates->get("private_composelink") . "\";");
    }
    $emptyexportlink = '';
    if ($mybb->user['totalpms'] > 0) {
        eval("\$emptyexportlink = \"" . $templates->get("private_emptyexportlink") . "\";");
    }
    $limitwarning = '';
    if ($mybb->usergroup['pmquota'] != "0" && $pmscount['total'] >= $mybb->usergroup['pmquota'] && $mybb->usergroup['cancp'] != 1) {
        eval("\$limitwarning = \"" . $templates->get("private_limitwarning") . "\";");
    }
    $plugins->run_hooks("private_end");
    eval("\$folder = \"" . $templates->get("private") . "\";");
    output_page($folder);
}
Example #28
0
                    $folder_label .= $lang->icon_hot;
                }
                // Is our thread visible?
                if ($thread['visible'] == 0) {
                    $bgcolor = 'trow_shaded';
                }
                if ($thread['closed'] == 1) {
                    $folder .= "lock";
                    $folder_label .= $lang->icon_lock;
                }
                $folder .= "folder";
                $lastpostdate = my_date('relative', $thread['lastpost']);
                $lastposter = $thread['lastposter'];
                $lastposteruid = $thread['lastposteruid'];
                if ($lastposteruid == 0) {
                    $lastposterlink = $lastposter;
                } else {
                    $lastposterlink = build_profile_link($lastposter, $lastposteruid);
                }
                $thread['replies'] = my_number_format($thread['replies']);
                $thread['views'] = my_number_format($thread['views']);
                $thread['author'] = build_profile_link($thread['username'], $thread['uid']);
                eval("\$latest_threads_threads .= \"" . $templates->get("usercp_latest_threads_threads") . "\";");
            }
        }
        eval("\$latest_threads = \"" . $templates->get("usercp_latest_threads") . "\";");
    }
    $plugins->run_hooks("usercp_end");
    eval("\$usercp = \"" . $templates->get("usercp") . "\";");
    output_page($usercp);
}
function akismet_show_confirm_page()
{
    global $mybb, $lang, $theme, $pid, $fid, $db, $headerinclude, $header, $footer;
    $pid = intval($pid);
    $fid = intval($fid);
    $query = $db->simple_select("posts", "subject", "pid='{$pid}'", 1);
    $post = $db->fetch_array($query);
    $post['subject'] = htmlspecialchars_uni($post['subject']);
    if (!$post) {
        error("Invalid Post ID.");
    }
    output_page("<html>\r\n<head>\r\n<title>{$mybb->settings['bbname']} - {$lang->mark_as_spam}</title>\r\n{$headerinclude}\r\n</head>\r\n<body>\r\n{$header}\r\n<form action=\"moderation.php\" method=\"post\">\r\n<input type=\"hidden\" name=\"my_post_key\" value=\"{$mybb->post_code}\" />\r\n<table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\">\r\n<tr>\r\n<td class=\"thead\" colspan=\"2\"><strong>{$post['subject']} - {$lang->mark_as_spam}</strong></td>\r\n</tr>\r\n<tr>\r\n<td class=\"trow1\" colspan=\"2\" align=\"center\">{$lang->confirm_mark_as_spam}</td>\r\n</tr>\r\n{$loginbox}\r\n</table>\r\n<br />\r\n<div align=\"center\"><input type=\"submit\" class=\"button\" name=\"submit\" value=\"{$lang->mark_as_spam}\" /></div>\r\n<input type=\"hidden\" name=\"action\" value=\"mark_as_spam\" />\r\n<input type=\"hidden\" name=\"pid\" value=\"{$pid}\" />\r\n<input type=\"hidden\" name=\"fid\" value=\"{$fid}\" />\r\n</form>\r\n{$footer}\r\n</body>\r\n</html>");
    exit;
}
Example #30
0
                $thread_link = $lang->sprintf($lang->postrep_given_thread, $thread_link, $subject);
                $link = get_post_link($reputation_vote['pid']) . "#pid{$reputation_vote['pid']}";
                $postrep_given = $lang->sprintf($lang->postrep_given, $link, $user['username'], $thread_link);
            }
        }
        // Does the current user have permission to delete this reputation? Show delete link
        $delete_link = '';
        if ($mybb->usergroup['issupermod'] == 1 || $mybb->usergroup['candeletereputations'] == 1 && $reputation_vote['adduid'] == $mybb->user['uid'] && $mybb->user['uid'] != 0) {
            eval("\$delete_link = \"" . $templates->get("reputation_vote_delete") . "\";");
        }
        $report_link = '';
        if ($mybb->user['uid'] != 0) {
            eval("\$report_link = \"" . $templates->get("reputation_vote_report") . "\";");
        }
        // Parse smilies in the reputation vote
        $reputation_parser = array("allow_html" => 0, "allow_mycode" => 0, "allow_smilies" => 1, "allow_imgcode" => 0, "filter_badwords" => 1);
        $reputation_vote['comments'] = $parser->parse_message($reputation_vote['comments'], $reputation_parser);
        if ($reputation_vote['comments'] == '') {
            $reputation_vote['comments'] = $lang->no_comment;
        }
        $plugins->run_hooks("reputation_vote");
        eval("\$reputation_votes .= \"" . $templates->get("reputation_vote") . "\";");
    }
    // If we don't have any reputations display a nice message.
    if (!$reputation_votes) {
        eval("\$reputation_votes = \"" . $templates->get("reputation_no_votes") . "\";");
    }
    $plugins->run_hooks("reputation_end");
    eval("\$reputation = \"" . $templates->get("reputation") . "\";");
    output_page($reputation);
}