Exemplo n.º 1
0
function asb_statistics_build_template($args)
{
    extract($args);
    global ${$template_var}, $mybb, $cache, $templates, $lang;
    // Load global and custom language phrases
    if (!$lang->asb_addon) {
        $lang->load('asb_addon');
    }
    // get forum statistics
    $statistics = $cache->read("stats");
    $statistics['numthreads'] = my_number_format($statistics['numthreads']);
    $statistics['numposts'] = my_number_format($statistics['numposts']);
    $statistics['numusers'] = my_number_format($statistics['numusers']);
    $newestmember = "<strong>{$lang->asb_stats_no_one}</strong>";
    if ($statistics['lastusername']) {
        if ($settings['format_username']) {
            $last_user = get_user($statistics['lastuid']);
            $last_username = format_name($last_user['username'], $last_user['usergroup'], $last_user['displaygroup']);
        } else {
            $last_username = $statistics['lastusername'];
        }
        $newestmember = build_profile_link($last_username, $statistics['lastuid']);
    }
    eval("\$" . $template_var . " = \"" . $templates->get('asb_statistics') . "\";");
    return true;
}
/**
 * Constructs the usercp misc menu.
 *
 */
function usercp_menu_misc()
{
    global $db, $mybb, $templates, $theme, $usercpmenu, $lang, $collapsed, $collapsedimg;
    $draftstart = $draftend = $draftcount = '';
    $query = $db->simple_select("posts", "COUNT(*) AS draftcount", "visible='-2' AND uid='" . $mybb->user['uid'] . "'");
    $count = $db->fetch_array($query);
    if ($count['draftcount'] > 0) {
        $draftstart = "<strong>";
        $draftend = "</strong>";
        $draftcount = "(" . my_number_format($count['draftcount']) . ")";
    }
    $profile_link = get_profile_link($mybb->user['uid']);
    eval("\$usercpmenu .= \"" . $templates->get("usercp_nav_misc") . "\";");
}
Exemplo n.º 3
0
function build_user_view_card($user, $view, &$i)
{
    global $user_view_fields;
    ++$i;
    if ($i == 3) {
        $i = 1;
    }
    // Loop through fields user wants to show
    foreach ($view['fields'] as $field) {
        if (!$user_view_fields[$field]) {
            continue;
        }
        $view_field = $user_view_fields[$field];
        // Special conditions for avatar
        if ($field == "avatar") {
            $avatar = $user['view']['avatar'];
        } else {
            if ($field == "controls") {
                $controls = $user['view']['controls'];
            } else {
                if ($field != "username") {
                    if (isset($user['view'][$field])) {
                        $value = $user['view'][$field];
                    } else {
                        $value = $user[$field];
                    }
                    if ($field == "postnum") {
                        $value = my_number_format($value);
                    }
                    $user_details[] = "<strong>{$view_field['title']}:</strong> {$value}";
                }
            }
        }
    }
    // Floated to the left or right?
    if ($i == 1) {
        $float = "left";
    } else {
        $float = "right";
    }
    // And build the final card
    $card = "<fieldset id=\"uid_{$user['uid']}\" style=\"width: 47%; float: {$float};\">\n";
    $card .= "<legend><input type=\"checkbox\" class=\"checkbox\" name=\"inlinemod_{$user['uid']}\" id=\"inlinemod_{$user['uid']}\" value=\"1\" onclick=\"\$('uid_{$user['uid']}').toggleClassName('inline_selected');\" /> {$user['view']['username']}</legend>\n";
    if ($avatar) {
        $card .= "<div class=\"user_avatar\">{$avatar}</div>\n";
    }
    if ($user_details) {
        $card .= "<div class=\"user_details\">" . implode("<br />", $user_details) . "</div>\n";
    }
    if ($controls) {
        $card .= "<div class=\"float_right\" style=\"padding: 4px;\">{$controls}</div>\n";
    }
    $card .= "</fieldset>";
    return $card;
}
Exemplo n.º 4
0
    redirect("private.php", $lang->redirect_pmfoldersupdated);
}
if ($mybb->input['action'] == "empty") {
    if ($mybb->user['totalpms'] == 0) {
        error($lang->error_nopms);
    }
    $plugins->run_hooks("private_empty_start");
    $foldersexploded = explode("\$%%\$", $mybb->user['pmfolders']);
    $folderlist = '';
    foreach ($foldersexploded as $key => $folders) {
        $folderinfo = explode("**", $folders, 2);
        $fid = $folderinfo[0];
        $foldername = get_pm_folder_name($fid, $folderinfo[1]);
        $query = $db->simple_select("privatemessages", "COUNT(*) AS pmsinfolder", " folder='{$fid}' AND uid='" . $mybb->user['uid'] . "'");
        $thing = $db->fetch_array($query);
        $foldercount = my_number_format($thing['pmsinfolder']);
        eval("\$folderlist .= \"" . $templates->get("private_empty_folder") . "\";");
    }
    $plugins->run_hooks("private_empty_end");
    eval("\$folders = \"" . $templates->get("private_empty") . "\";");
    output_page($folders);
}
if ($mybb->input['action'] == "do_empty" && $mybb->request_method == "post") {
    // Verify incoming POST request
    verify_post_check($mybb->get_input('my_post_key'));
    $plugins->run_hooks("private_do_empty_start");
    $emptyq = '';
    $mybb->input['empty'] = $mybb->get_input('empty', MyBB::INPUT_ARRAY);
    $keepunreadq = '';
    if ($mybb->get_input('keepunread', MyBB::INPUT_INT) == 1) {
        $keepunreadq = " AND status!='0'";
Exemplo n.º 5
0
     if ($nummodqueuethreads > 0 || $mybb->usergroup['issupermod'] == 1) {
         $query = $db->simple_select("threads", "COUNT(tid) AS unapprovedthreads", "visible='0' {$flist_queue_threads}");
         $unapproved_threads = $db->fetch_field($query, "unapprovedthreads");
         if ($unapproved_threads > 0) {
             $query = $db->simple_select("threads", "tid, subject, uid, username, dateline", "visible='0' {$flist_queue_threads}", array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => 1));
             $thread = $db->fetch_array($query);
             $thread['date'] = my_date('relative', $thread['dateline']);
             $thread['profilelink'] = build_profile_link($thread['username'], $thread['uid']);
             $thread['link'] = get_thread_link($thread['tid']);
             $thread['subject'] = $thread['fullsubject'] = $parser->parse_badwords($thread['subject']);
             if (my_strlen($thread['subject']) > 25) {
                 $post['subject'] = my_substr($thread['subject'], 0, 25) . "...";
             }
             $thread['subject'] = htmlspecialchars_uni($thread['subject']);
             $thread['fullsubject'] = htmlspecialchars_uni($thread['fullsubject']);
             $unapproved_threads = my_number_format($unapproved_threads);
             eval("\$latest_thread = \"" . $templates->get("modcp_lastthread") . "\";");
         } else {
             eval("\$latest_thread = \"" . $templates->get("modcp_awaitingmoderation_none") . "\";");
         }
         eval("\$awaitingthreads = \"" . $templates->get("modcp_awaitingthreads") . "\";");
     }
     if (!empty($awaitingattachments) || !empty($awaitingposts) || !empty($awaitingthreads)) {
         eval("\$awaitingmoderation = \"" . $templates->get("modcp_awaitingmoderation") . "\";");
     }
 }
 $latestfivemodactions = '';
 if (($nummodlogs > 0 || $mybb->usergroup['issupermod'] == 1) && $mybb->usergroup['canviewmodlogs'] == 1) {
     $where = '';
     if ($tflist_modlog) {
         $where = "WHERE (t.fid <> 0 {$tflist_modlog}) OR (!l.fid)";
Exemplo n.º 6
0
 }
 $join_requests = '';
 if ($joinrequests[$usergroup['gid']] > 1 && $usergroup['type'] == 4) {
     $join_requests = " <small><a href=\"index.php?module=user-groups&amp;action=join_requests&amp;gid={$usergroup['gid']}\"><span style=\"color: red;\">({$joinrequests[$usergroup['gid']]} {$lang->outstanding_join_request})</span></a></small>";
 } else {
     if ($joinrequests[$usergroup['gid']] == 1 && $usergroup['type'] == 4) {
         $join_requests = " <small><a href=\"index.php?module=user-groups&amp;action=join_requests&amp;gid={$usergroup['gid']}\"><span style=\"color: red;\">({$joinrequests[$usergroup['gid']]} {$lang->outstanding_join_request})</span></a></small>";
     }
 }
 $form_container->output_cell("<div class=\"float_right\">{$icon}</div><div><strong><a href=\"index.php?module=user-groups&amp;action=edit&amp;gid={$usergroup['gid']}\">" . htmlspecialchars_uni($usergroup['title']) . "</a></strong>{$join_requests}<br /><small>" . htmlspecialchars_uni($usergroup['description']) . "{$leaders_list}</small></div>");
 if (!$primaryusers[$usergroup['gid']]) {
     $primaryusers[$usergroup['gid']] = 0;
 }
 $numusers = $primaryusers[$usergroup['gid']];
 $numusers += $secondaryusers[$usergroup['gid']];
 $form_container->output_cell(my_number_format($numusers), array("class" => "align_center"));
 if ($usergroup['showforumteam'] == 1) {
     $form_container->output_cell("<input type=\"text\" name=\"disporder[{$usergroup['gid']}]\" value=\"{$usergroup['disporder']}\" class=\"text_input align_center\" style=\"width: 80%;\" />", array("class" => "align_center"));
 } else {
     $form_container->output_cell("&nbsp;", array("class" => "align_center"));
 }
 $popup = new PopupMenu("usergroup_{$usergroup['gid']}", $lang->options);
 $popup->add_item($lang->edit_group, "index.php?module=user-groups&amp;action=edit&amp;gid={$usergroup['gid']}");
 $popup->add_item($lang->list_users, "index.php?module=user-users&amp;action=search&amp;results=1&amp;conditions[usergroup]={$usergroup['gid']}");
 if ($joinrequests[$usergroup['gid']] > 0 && $usergroup['type'] == 4) {
     $popup->add_item($lang->join_requests, "index.php?module=user-groups&amp;action=join_requests&amp;gid={$usergroup['gid']}");
 }
 $popup->add_item($lang->group_leaders, "index.php?module=user-groups&amp;action=leaders&amp;gid={$usergroup['gid']}");
 if ($usergroup['type'] > 1) {
     $popup->add_item($lang->delete_group, "index.php?module=user-groups&amp;action=delete&amp;gid={$usergroup['gid']}&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_group_deletion}')");
 }
Exemplo n.º 7
0
/**
 * @param array $user
 * @param array $view
 * @param DefaultTable $table
 */
function build_user_view_table($user, $view, &$table)
{
    global $user_view_fields;
    foreach ($view['fields'] as $field) {
        if (!$user_view_fields[$field]) {
            continue;
        }
        $view_field = $user_view_fields[$field];
        $field_options = array();
        if ($view_field['align']) {
            $field_options['class'] = "align_" . $view_field['align'];
        }
        if ($user['view'][$field]) {
            $value = $user['view'][$field];
        } else {
            $value = $user[$field];
        }
        if ($field == "postnum") {
            $value = my_number_format($user[$field]);
        }
        $table->construct_cell($value, $field_options);
    }
    $table->construct_cell("<input type=\"checkbox\" class=\"checkbox\" name=\"inlinemod_{$user['uid']}\" id=\"inlinemod_{$user['uid']}\" value=\"1\" onclick=\"\$('#uid_{$user['uid']}').toggleClass('inline_selected');\" />");
    $table->construct_row();
}
Exemplo n.º 8
0
 // Format the user's 'total' reputation
 if ($user['reputation'] < 0) {
     $total_class = "_minus";
 } elseif ($user['reputation'] > 0) {
     $total_class = "_plus";
 } else {
     $total_class = "_neutral";
 }
 // Figure out how many reps have come from posts / 'general'
 // Posts
 $query = $db->simple_select("reputation", "COUNT(rid) AS rep_posts", "uid = '" . $user['uid'] . "' AND pid > 0");
 $rep_post_count = $db->fetch_field($query, "rep_posts");
 $rep_posts = my_number_format($rep_post_count);
 // General
 // We count how many reps in total, then subtract the reps from posts
 $rep_members = my_number_format($total_reputation - $rep_post_count);
 // Is negative reputation disabled? If so, tell the user
 if ($mybb->settings['negrep'] == 0) {
     $neg_rep_info = $lang->neg_rep_disabled;
 }
 if ($mybb->settings['posrep'] == 0) {
     $pos_rep_info = $lang->pos_rep_disabled;
 }
 if ($mybb->settings['neurep'] == 0) {
     $neu_rep_info = $lang->neu_rep_disabled;
 }
 $perpage = (int) $mybb->settings['repsperpage'];
 if ($perpage < 1) {
     $perpage = 15;
 }
 // Check if we're browsing a specific page of results
 }
 if ($session->ipaddress == $data['ip'] || $mybb->user['regip'] == $data['ip'] || $mybb->user['lastip'] == $data['ip']) {
     $isyou = "(You)";
 } else {
     $isyou = "";
 }
 if (isset($mybb->input['page']) && $mybb->input['page'] !== 1) {
     $num = $mybb->input['page'] * 10;
 } else {
     $num = 0;
 }
 $i = ++$number + $num;
 $table->construct_cell("<strong>" . $i . "</strong>", array('width' => '1%'));
 $table->construct_cell("<a href=\"index.php?module=cloudflare-whois&amp;action=lookup&amp;server=" . $data['ip'] . "\" target=\"_blank\">" . $data['ip'] . "</a> " . $isyou, array('width' => '25%'));
 $table->construct_cell($data['classification'], array('width' => '25%'));
 $table->construct_cell(my_number_format($data['hits']), array('width' => '25%'));
 if (function_exists('geoip_record_by_name')) {
     $ip_record = @geoip_record_by_name($data['ip']);
     if ($ip_record) {
         $ipaddress_location = null;
         if ($ip_record['city']) {
             $ipaddress_location .= htmlspecialchars_uni($ip_record['city']) . $lang->comma . ' ';
         }
         $ipaddress_location .= htmlspecialchars_uni($ip_record['country_name']);
         $table->construct_cell('<a href="https://maps.google.com/maps?q=' . urlencode($ipaddress_location) . '" target="_blank">' . $ipaddress_location . '</a>', array('width' => '25%'));
     } else {
         $table->construct_cell('N/A', array('width' => '25%'));
     }
 }
 if ($mybb->settings['cloudflare_showdns'] == "1") {
     $table->construct_cell(gethostbyaddr($data['ip']), array('width' => '25%'));
Exemplo n.º 10
0
    $query = $db->query("\n\t\tSELECT COUNT(p.pid) AS posts, p.username AS postusername, u.uid, u.username, u.usergroup, u.displaygroup\n\t\tFROM " . TABLE_PREFIX . "posts p\n\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=p.uid)\n\t\tWHERE tid='" . $tid . "' AND {$show_posts}\n\t\tGROUP BY u.uid, p.username, u.uid, u.username, u.usergroup, u.displaygroup\n\t\t" . $sortsql . "\n\t");
    while ($poster = $db->fetch_array($query)) {
        if ($poster['username'] == '') {
            $poster['username'] = $poster['postusername'];
        }
        $poster_name = format_name($poster['username'], $poster['usergroup'], $poster['displaygroup']);
        if ($poster['uid']) {
            $onclick = "opener.location.href='" . get_profile_link($poster['uid']) . "'; return false;";
        }
        $profile_link = build_profile_link($poster_name, $poster['uid'], '_blank', $onclick);
        $numposts += $poster['posts'];
        eval("\$whoposted .= \"" . $templates->get("misc_whoposted_poster") . "\";");
        $altbg = alt_trow();
    }
    $numposts = my_number_format($numposts);
    $poster['posts'] = my_number_format($poster['posts']);
    eval("\$whop = \"" . $templates->get("misc_whoposted", 1, 0) . "\";");
    echo $whop;
    exit;
} elseif ($mybb->input['action'] == "smilies") {
    $smilies = '';
    if (!empty($mybb->input['popup']) && !empty($mybb->input['editor'])) {
        // make small popup list of smilies
        $editor = preg_replace('#([^a-zA-Z0-9_-]+)#', '', $mybb->get_input('editor'));
        $e = 1;
        $class = "trow1";
        $smilies = "<tr>";
        $smilies_cache = $cache->read("smilies");
        if (is_array($smilies_cache)) {
            $extra_class = ' smilie_pointer';
            foreach ($smilies_cache as $smilie) {
Exemplo n.º 11
0
        // Show avatar
        if ($user['avatar'] != '') {
            $user['avatar'] = htmlspecialchars_uni($user['avatar']);
            $avatar_dimensions = explode("|", $user['avatardimensions']);
            if ($avatar_dimensions[0] && $avatar_dimensions[1]) {
                list($max_width, $max_height) = explode("x", my_strtolower($mybb->settings['memberlistmaxavatarsize']));
                if ($avatar_dimensions[0] > $max_width || $avatar_dimensions[1] > $max_height) {
                    require_once MYBB_ROOT . "inc/functions_image.php";
                    $scaled_dimensions = scale_image($avatar_dimensions[0], $avatar_dimensions[1], $max_width, $max_height);
                    $avatar_width_height = "width=\"{$scaled_dimensions['width']}\" height=\"{$scaled_dimensions['height']}\"";
                } else {
                    $avatar_width_height = "width=\"{$avatar_dimensions[0]}\" height=\"{$avatar_dimensions[1]}\"";
                }
            }
            eval("\$user['avatar'] = \"" . $templates->get("memberlist_user_avatar") . "\";");
        } else {
            $user['avatar'] = "";
        }
        $user['regdate'] = my_date($mybb->settings['dateformat'], $user['regdate']) . ", " . my_date($mybb->settings['timeformat'], $user['regdate']);
        $user['lastvisit'] = my_date($mybb->settings['dateformat'], $user['lastactive']) . ", " . my_date($mybb->settings['timeformat'], $user['lastactive']);
        $user['postnum'] = my_number_format($user['postnum']);
        eval("\$users .= \"" . $templates->get("memberlist_user") . "\";");
    }
    // Do we have no results?
    if (!$users) {
        $users = "<tr>\n<td colspan=\"" . $colspan . "\" align=\"center\" class=\"trow1\">{$lang->error_no_members}</td>\n</tr>";
    }
    $plugins->run_hooks("memberlist_end");
    eval("\$memberlist = \"" . $templates->get("memberlist") . "\";");
    output_page($memberlist);
}
Exemplo n.º 12
0
function generate_growth_string($number)
{
    global $lang, $cp_style;
    if ($number === null) {
        return "";
    }
    $number = (int) $number;
    $friendly_number = my_number_format(abs($number));
    if ($number > 0) {
        $growth_string = "(<img src=\"./styles/{$cp_style}/images/icons/increase.png\" alt=\"{$lang->increase}\" title=\"{$lang->increase}\" style=\"vertical-align: middle; margin-top: -2px;\" /> {$friendly_number})";
    } elseif ($number == 0) {
        $growth_string = "(<img src=\"./styles/{$cp_style}/images/icons/no_change.png\" alt=\"{$lang->no_change}\" title=\"{$lang->no_change}\" style=\"vertical-align: middle; margin-top: -2px;\" /> {$friendly_number})";
    } else {
        $growth_string = "(<img src=\"./styles/{$cp_style}/images/icons/decrease.png\" alt=\"{$lang->decrease}\" title=\"{$lang->decrease}\" style=\"vertical-align: middle; margin-top: -2px;\" /> {$friendly_number})";
    }
    return $growth_string;
}
Exemplo n.º 13
0
function get_user_info_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups, $parser, $displaygroupfields;
    $lang->load("member");
    $input = Tapatalk_Input::filterXmlInput(array('user_name' => Tapatalk_Input::STRING, 'user_id' => Tapatalk_Input::INT), $xmlrpc_params);
    if ($mybb->usergroup['canviewprofiles'] == 0) {
        error_no_permission();
    }
    if (isset($input['user_id']) && !empty($input['user_id'])) {
        $uid = $input['user_id'];
    } elseif (!empty($input['user_name'])) {
        $query = $db->simple_select("users", "uid", "username='******'user_name_esc']}'");
        $uid = $db->fetch_field($query, "uid");
    } else {
        $uid = $mybb->user['uid'];
    }
    if ($mybb->user['uid'] != $uid) {
        $memprofile = get_user($uid);
    } else {
        $memprofile = $mybb->user;
    }
    if (!$memprofile['uid']) {
        error($lang->error_nomember);
    }
    // Get member's permissions
    $memperms = user_permissions($memprofile['uid']);
    if (!$memprofile['displaygroup']) {
        $memprofile['displaygroup'] = $memprofile['usergroup'];
    }
    // Grab the following fields from the user's displaygroup
    $displaygroupfields = array("title", "usertitle", "stars", "starimage", "image", "usereputationsystem");
    $displaygroup = usergroup_displaygroup($memprofile['displaygroup']);
    // Get the user title for this user
    unset($usertitle);
    unset($stars);
    if (trim($memprofile['usertitle']) != '') {
        // User has custom user title
        $usertitle = $memprofile['usertitle'];
    } elseif (trim($displaygroup['usertitle']) != '') {
        // User has group title
        $usertitle = $displaygroup['usertitle'];
    } else {
        // No usergroup title so get a default one
        $query = $db->simple_select("usertitles", "*", "", array('order_by' => 'posts', 'order_dir' => 'DESC'));
        while ($title = $db->fetch_array($query)) {
            if ($memprofile['postnum'] >= $title['posts']) {
                $usertitle = $title['title'];
                $stars = $title['stars'];
                $starimage = $title['starimage'];
                break;
            }
        }
    }
    // User is currently online and this user has permissions to view the user on the WOL
    $timesearch = TIME_NOW - $mybb->settings['wolcutoffmins'] * 60;
    $query = $db->simple_select("sessions", "location,nopermission", "uid='{$uid}' AND time>'{$timesearch}'", array('order_by' => 'time', 'order_dir' => 'DESC', 'limit' => 1));
    $session = $db->fetch_array($query);
    if (($memprofile['invisible'] != 1 || $mybb->usergroup['canviewwolinvis'] == 1 || $memprofile['uid'] == $mybb->user['uid']) && !empty($session)) {
        // Fetch their current location
        $lang->load("online");
        require_once MYBB_ROOT . "inc/functions_online.php";
        $activity = fetch_wol_activity($session['location'], $session['nopermission']);
        /*unset($activity['tid']);
          unset($activity['fid']);
          unset($activity['pid']);
          unset($activity['eid']);
          unset($activity['aid']);*/
        $location = strip_tags(build_friendly_wol_location($activity));
        $location_time = my_date($mybb->settings['timeformat'], $memprofile['lastactive']);
        $online = true;
    } else {
        $online = false;
    }
    // Get custom fields start
    $custom_fields_list = array();
    if ($memprofile['birthday']) {
        $membday = explode("-", $memprofile['birthday']);
        if ($memprofile['birthdayprivacy'] != 'none') {
            if ($membday[0] && $membday[1] && $membday[2]) {
                $lang->membdayage = $lang->sprintf($lang->membdayage, get_age($memprofile['birthday']));
                if ($membday[2] >= 1970) {
                    $w_day = date("l", mktime(0, 0, 0, $membday[1], $membday[0], $membday[2]));
                    $membday = format_bdays($mybb->settings['dateformat'], $membday[1], $membday[0], $membday[2], $w_day);
                } else {
                    $bdayformat = fix_mktime($mybb->settings['dateformat'], $membday[2]);
                    $membday = mktime(0, 0, 0, $membday[1], $membday[0], $membday[2]);
                    $membday = date($bdayformat, $membday);
                }
                $membdayage = $lang->membdayage;
            } elseif ($membday[2]) {
                $membday = mktime(0, 0, 0, 1, 1, $membday[2]);
                $membday = date("Y", $membday);
                $membdayage = '';
            } else {
                $membday = mktime(0, 0, 0, $membday[1], $membday[0], 0);
                $membday = date("F j", $membday);
                $membdayage = '';
            }
        }
        if ($memprofile['birthdayprivacy'] == 'age') {
            $membday = $lang->birthdayhidden;
        } else {
            if ($memprofile['birthdayprivacy'] == 'none') {
                $membday = $lang->birthdayhidden;
                $membdayage = '';
            }
        }
        $custom_fields_list[] = new xmlrpcval(array('name' => new xmlrpcval(basic_clean($lang->date_of_birth), 'base64'), 'value' => new xmlrpcval(basic_clean("{$membday} {$membdayage}"), 'base64')), 'struct');
    }
    // thank you/like field
    global $mobiquo_config;
    $prefix = $mobiquo_config['thlprefix'];
    if ($mybb->settings[$prefix . 'enabled'] == "1") {
        $lang->load("thankyoulike");
        if ($mybb->settings[$prefix . 'thankslike'] == "like") {
            $lang->tyl_total_tyls_given = $lang->tyl_total_likes_given;
            $lang->tyl_total_tyls_rcvd = $lang->tyl_total_likes_rcvd;
        } else {
            if ($mybb->settings[$prefix . 'thankslike'] == "thanks") {
                $lang->tyl_total_tyls_given = $lang->tyl_total_thanks_given;
                $lang->tyl_total_tyls_rcvd = $lang->tyl_total_thanks_rcvd;
            }
        }
        $daysreg = (TIME_NOW - $memprofile['regdate']) / (24 * 3600);
        $tylpd = $memprofile['tyl_unumtyls'] / $daysreg;
        $tylpd = round($tylpd, 2);
        if ($tylpd > $memprofile['tyl_unumtyls']) {
            $tylpd = $memprofile['tyl_unumtyls'];
        }
        $tylrcvpd = $memprofile['tyl_unumrcvtyls'] / $daysreg;
        $tylrcvpd = round($tylrcvpd, 2);
        if ($tylrcvpd > $memprofile['tyl_unumrcvtyls']) {
            $tylrcvpd = $memprofile['tyl_unumrcvtyls'];
        }
        // Get total tyl and percentage
        $options = array("limit" => 1);
        $query = $db->simple_select($prefix . "stats", "*", "title='total'", $options);
        $total = $db->fetch_array($query);
        if ($total['value'] == 0) {
            $percent = "0";
            $percent_rcv = "0";
        } else {
            $percent = $memprofile['tyl_unumtyls'] * 100 / $total['value'];
            $percent = round($percent, 2);
            $percent_rcv = $memprofile['tyl_unumrcvtyls'] * 100 / $total['value'];
            $percent_rcv = round($percent_rcv, 2);
        }
        if ($percent > 100) {
            $percent = 100;
        }
        if ($percent_rcv > 100) {
            $percent_rcv = 100;
        }
        $memprofile['tyl_unumtyls'] = my_number_format($memprofile['tyl_unumtyls']);
        $memprofile['tyl_unumrcvtyls'] = my_number_format($memprofile['tyl_unumrcvtyls']);
        $tylpd_percent_total = $lang->sprintf($lang->tyl_tylpd_percent_total, my_number_format($tylpd), $tyl_thankslikes_given, $percent);
        $tylrcvpd_percent_total = $lang->sprintf($lang->tyl_tylpd_percent_total, my_number_format($tylrcvpd), $tyl_thankslikes_rcvd, $percent_rcv);
        addCustomField($lang->tyl_total_tyls_given, "{$memprofile['tyl_unumtyls']} ({$tylpd_percent_total})", $custom_fields_list);
        addCustomField($lang->tyl_total_tyls_rcvd, "{$memprofile['tyl_unumrcvtyls']} ({$tylrcvpd_percent_total})", $custom_fields_list);
    }
    if ($memprofile['timeonline'] > 0) {
        $timeonline = nice_time($memprofile['timeonline']);
        addCustomField($lang->timeonline, $timeonline, $custom_fields_list);
    }
    if ($mybb->settings['usereferrals'] == 1 && $memprofile['referrals'] > 0) {
        addCustomField($lang->members_referred, $memprofile['referrals'], $custom_fields_list);
    }
    if ($memperms['usereputationsystem'] == 1 && $displaygroup['usereputationsystem'] == 1 && $mybb->settings['enablereputation'] == 1 && ($mybb->settings['posrep'] || $mybb->settings['neurep'] || $mybb->settings['negrep'])) {
        addCustomField($lang->reputation, $memprofile['reputation'], $custom_fields_list);
    }
    if ($mybb->settings['enablewarningsystem'] != 0 && $memperms['canreceivewarnings'] != 0 && ($mybb->usergroup['canwarnusers'] != 0 || $mybb->user['uid'] == $memprofile['uid'] && $mybb->settings['canviewownwarning'] != 0)) {
        $warning_level = round($memprofile['warningpoints'] / $mybb->settings['maxwarningpoints'] * 100);
        if ($warning_level > 100) {
            $warning_level = 100;
        }
        addCustomField($lang->warning_level, $warning_level . '%', $custom_fields_list);
    }
    if ($memprofile['website']) {
        $memprofile['website'] = htmlspecialchars_uni($memprofile['website']);
        addCustomField($lang->homepage, $memprofile['website'], $custom_fields_list);
    }
    if ($memprofile['icq']) {
        addCustomField($lang->icq_number, $memprofile['icq'], $custom_fields_list);
    }
    if ($memprofile['aim']) {
        addCustomField($lang->aim_screenname, $memprofile['aim'], $custom_fields_list);
    }
    if ($memprofile['yahoo']) {
        addCustomField($lang->yahoo_id, $memprofile['yahoo'], $custom_fields_list);
    }
    if ($memprofile['msn']) {
        addCustomField($lang->msn, $memprofile['msn'], $custom_fields_list);
    }
    $query = $db->simple_select("userfields", "*", "ufid='{$uid}'");
    $userfields = $db->fetch_array($query);
    if ($mybb->usergroup['cancp'] == 1 || $mybb->usergroup['issupermod'] == 1 || $mybb->usergroup['canmodcp'] == 1) {
        $field_hidden = '1=1';
    } else {
        $field_hidden = "hidden=0";
    }
    $query = $db->simple_select("profilefields", "*", "{$field_hidden}", array('order_by' => 'disporder'));
    while ($customfield = $db->fetch_array($query)) {
        $thing = explode("\n", $customfield['type'], "2");
        $type = trim($thing[0]);
        $field = "fid{$customfield['fid']}";
        $useropts = explode("\n", $userfields[$field]);
        $customfieldval = $comma = '';
        if (is_array($useropts) && ($type == "multiselect" || $type == "checkbox")) {
            $customfieldval = $userfields[$field];
        } else {
            $customfieldval = $parser->parse_badwords($userfields[$field]);
        }
        $customfield['name'] = htmlspecialchars_uni($customfield['name']);
        if ($customfieldval) {
            addCustomField($customfield['name'], $customfieldval, $custom_fields_list);
        }
    }
    if ($memprofile['signature'] && ($memprofile['suspendsignature'] == 0 || $memprofile['suspendsigtime'] < TIME_NOW)) {
        $sig_parser = array("allow_html" => $mybb->settings['sightml'], "allow_mycode" => $mybb->settings['sigmycode'], "allow_smilies" => $mybb->settings['sigsmilies'], "allow_imgcode" => $mybb->settings['sigimgcode'], "me_username" => $memprofile['username'], "filter_badwords" => 1);
        $memprofile['signature'] = $parser->parse_message($memprofile['signature'], $sig_parser);
        $lang->users_signature = $lang->sprintf($lang->users_signature, $memprofile['username']);
        addCustomField($lang->users_signature, $memprofile['signature'], $custom_fields_list);
    }
    // Get custom fields end
    $query = $db->simple_select("banned", "uid", "uid='{$uid}'");
    $isbanned = !!$db->fetch_field($query, "uid");
    $xmlrpc_user_info = array('user_id' => new xmlrpcval($memprofile['uid'], 'string'), 'username' => new xmlrpcval(basic_clean($memprofile['username']), 'base64'), 'user_name' => new xmlrpcval(basic_clean($memprofile['username']), 'base64'), 'user_type' => check_return_user_type($memprofile['username']), 'post_count' => new xmlrpcval($memprofile['postnum'], 'int'), 'reg_time' => new xmlrpcval(mobiquo_iso8601_encode($memprofile['regdate']), 'dateTime.iso8601'), 'timestamp_reg' => new xmlrpcval($memprofile['regdate'], 'string'), 'last_activity_time' => new xmlrpcval(mobiquo_iso8601_encode($memprofile['lastactive']), 'dateTime.iso8601'), 'timestamp' => new xmlrpcval($memprofile['lastactive'], 'string'), 'is_online' => new xmlrpcval($online, 'boolean'), 'accept_pm' => new xmlrpcval($memprofile['receivepms'], 'boolean'), 'display_text' => new xmlrpcval($usertitle, 'base64'), 'icon_url' => new xmlrpcval(absolute_url($memprofile['avatar']), 'string'), 'current_activity' => new xmlrpcval($location, 'base64'));
    if ($mybb->usergroup['canmodcp'] == 1 && $uid != $mybb->user['uid']) {
        $xmlrpc_user_info['can_ban'] = new xmlrpcval(ture, 'boolean');
    }
    if ($isbanned) {
        $xmlrpc_user_info['is_ban'] = new xmlrpcval(ture, 'boolean');
    }
    $xmlrpc_user_info['custom_fields_list'] = new xmlrpcval($custom_fields_list, 'array');
    return new xmlrpcresp(new xmlrpcval($xmlrpc_user_info, 'struct'));
}
Exemplo n.º 14
0
                 $progress = ceil($email['sentcount'] / $email['totalcount'] * 100);
                 if ($progress > 100) {
                     $progress = 100;
                 }
                 $status = "{$lang->delivering} ({$progress}%)";
             }
         }
     }
     $table->construct_cell($status, array("class" => "align_center"));
     if ($email['status'] != 0) {
         $delivery_date = my_date($mybb->settings['dateformat'], $email['senddate']);
     } else {
         $delivery_date = $lang->na;
     }
     $table->construct_cell($delivery_date, array("class" => "align_center"));
     $table->construct_cell(my_number_format($email['totalcount']), array("class" => "align_center"));
     if (TIME_NOW >= $email['senddate'] && $email['status'] > 1) {
         $table->construct_cell("<a href=\"index.php?module=user-mass_mail&amp;action=cancel&amp;mid={$email['mid']}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->mass_mail_cancel_confirmation}')\">{$lang->cancel}</a>", array("width" => 100, "colspan" => 2, "class" => "align_center"));
     } else {
         $table->construct_cell("<a href=\"index.php?module=user-mass_mail&amp;action=edit&amp;mid={$email['mid']}\">{$lang->edit}</a>", array("width" => 100, "class" => "align_center"));
         $table->construct_cell("<a href=\"index.php?module=user-mass_mail&amp;action=delete&amp;mid={$email['mid']}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->mass_mail_deletion_confirmation}')\">{$lang->delete}</a>", array("width" => 100, "class" => "align_center"));
     }
     $table->construct_row();
 }
 if ($table->num_rows() == 0) {
     $table->construct_cell($lang->no_unsent_messages, array('colspan' => 6));
     $table->construct_row();
     $no_results = true;
 }
 $table->output($lang->mass_mail_queue);
 $page->output_footer();
/**
 * Fetch the number of unapproved posts, formatted, from a forum
 *
 * @param array Array of information about the forum
 * @return array Array containing formatted string for posts and string for threads
 */
function get_forum_unapproved($forum)
{
    global $lang;
    $unapproved_threads = $unapproved_posts = '';
    // If the user is a moderator we need to fetch the count
    if (is_moderator($forum['fid'])) {
        // Forum has one or more unaproved posts, format language string accordingly
        if ($forum['unapprovedposts']) {
            if ($forum['unapprovedposts'] > 1) {
                $unapproved_posts_count = $lang->sprintf($lang->forum_unapproved_posts_count, $forum['unapprovedposts']);
            } else {
                $unapproved_posts_count = $lang->sprintf($lang->forum_unapproved_post_count, 1);
            }
            $unapproved_posts = " <span title=\"{$unapproved_posts_count}\">(" . my_number_format($forum['unapprovedposts']) . ")</span>";
        }
        // Forum has one or more unapproved threads, format language string accordingly
        if ($forum['unapprovedthreads']) {
            if ($forum['unapprovedthreads'] > 1) {
                $unapproved_threads_count = $lang->sprintf($lang->forum_unapproved_threads_count, $forum['unapprovedthreads']);
            } else {
                $unapproved_threads_count = $lang->sprintf($lang->forum_unapproved_thread_count, 1);
            }
            $unapproved_threads = " <span title=\"{$unapproved_threads_count}\">(" . my_number_format($forum['unapprovedthreads']) . ")</span>";
        }
    }
    return array("unapproved_posts" => $unapproved_posts, "unapproved_threads" => $unapproved_threads);
}
Exemplo n.º 16
0
    ?>
" <?php 
    if (!$odetail->is_returned) {
        ?>
selected="selected"<?php 
    }
    ?>
>No</option>
									</select>
								</td>
								<td>$<?php 
    echo my_number_format($odetail->amount);
    ?>
</td>
								<td>$<?php 
    echo my_number_format($odetail->refunded_amount);
    ?>
</td>
								<td><?php 
    echo $odetail->name;
    ?>
</td>
							</tr>
					<?php 
}
?>
					<tr><td>&nbsp;</td></tr>
					<tr><td colspan="4"><input type="checkbox" name="notify" value="<?php 
echo $object->email;
?>
" checked="checked"/> Notify customer of these refunds <span class="help_text">(E-mail will be sent to <?php 
Exemplo n.º 17
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);
}
Exemplo n.º 18
0
}
if ($mybb->settings['awactialert'] == 1 && $mybb->usergroup['cancp'] == 1) {
    $awaitingusers = $cache->read('awaitingactivation');
    if (isset($awaitingusers['time']) && $awaitingusers['time'] + 86400 < TIME_NOW) {
        $cache->update_awaitingactivation();
        $awaitingusers = $cache->read('awaitingactivation');
    }
    if (!empty($awaitingusers['users'])) {
        $awaitingusers = (int) $awaitingusers['users'];
    } else {
        $awaitingusers = 0;
    }
    if ($awaitingusers < 1) {
        $awaitingusers = 0;
    } else {
        $awaitingusers = my_number_format($awaitingusers);
    }
    if ($awaitingusers > 0) {
        if ($awaitingusers == 1) {
            $awaiting_message = $lang->awaiting_message_single;
        } else {
            $awaiting_message = $lang->sprintf($lang->awaiting_message_plural, $awaitingusers);
        }
        if ($admincplink) {
            $awaiting_message .= $lang->sprintf($lang->awaiting_message_link, $mybb->settings['bburl'], $admin_dir);
        }
        eval('$awaitingusers = "' . $templates->get('global_awaiting_activation') . '";');
    } else {
        $awaitingusers = '';
    }
}
Exemplo n.º 19
0
/**
 * Fetch the attachments for a specific post and parse inline [attachment=id] code.
 * Note: assumes you have $attachcache, an array of attachments set up.
 *
 * @param int $id The ID of the item.
 * @param array $post The post or item passed by reference.
 */
function get_post_attachments($id, &$post)
{
    global $attachcache, $mybb, $theme, $templates, $forumpermissions, $lang;
    $validationcount = 0;
    $tcount = 0;
    $post['attachmentlist'] = $post['thumblist'] = $post['imagelist'] = '';
    if (isset($attachcache[$id]) && is_array($attachcache[$id])) {
        // This post has 1 or more attachments
        foreach ($attachcache[$id] as $aid => $attachment) {
            if ($attachment['visible']) {
                // There is an attachment thats visible!
                $attachment['filename'] = htmlspecialchars_uni($attachment['filename']);
                $attachment['filesize'] = get_friendly_size($attachment['filesize']);
                $ext = get_extension($attachment['filename']);
                if ($ext == "jpeg" || $ext == "gif" || $ext == "bmp" || $ext == "png" || $ext == "jpg") {
                    $isimage = true;
                } else {
                    $isimage = false;
                }
                $attachment['icon'] = get_attachment_icon($ext);
                $attachment['downloads'] = my_number_format($attachment['downloads']);
                if (!$attachment['dateuploaded']) {
                    $attachment['dateuploaded'] = $attachment['dateline'];
                }
                $attachdate = my_date('relative', $attachment['dateuploaded']);
                // Support for [attachment=id] code
                if (stripos($post['message'], "[attachment=" . $attachment['aid'] . "]") !== false) {
                    // Show as thumbnail IF image is big && thumbnail exists && setting=='thumb'
                    // Show as full size image IF setting=='fullsize' || (image is small && permissions allow)
                    // Show as download for all other cases
                    if ($attachment['thumbnail'] != "SMALL" && $attachment['thumbnail'] != "" && $mybb->settings['attachthumbnails'] == "yes") {
                        eval("\$attbit = \"" . $templates->get("postbit_attachments_thumbnails_thumbnail") . "\";");
                    } elseif (($attachment['thumbnail'] == "SMALL" && $forumpermissions['candlattachments'] == 1 || $mybb->settings['attachthumbnails'] == "no") && $isimage) {
                        eval("\$attbit = \"" . $templates->get("postbit_attachments_images_image") . "\";");
                    } else {
                        eval("\$attbit = \"" . $templates->get("postbit_attachments_attachment") . "\";");
                    }
                    $post['message'] = preg_replace("#\\[attachment=" . $attachment['aid'] . "]#si", $attbit, $post['message']);
                } else {
                    // Show as thumbnail IF image is big && thumbnail exists && setting=='thumb'
                    // Show as full size image IF setting=='fullsize' || (image is small && permissions allow)
                    // Show as download for all other cases
                    if ($attachment['thumbnail'] != "SMALL" && $attachment['thumbnail'] != "" && $mybb->settings['attachthumbnails'] == "yes") {
                        eval("\$post['thumblist'] .= \"" . $templates->get("postbit_attachments_thumbnails_thumbnail") . "\";");
                        if ($tcount == 5) {
                            $thumblist .= "<br />";
                            $tcount = 0;
                        }
                        ++$tcount;
                    } elseif (($attachment['thumbnail'] == "SMALL" && $forumpermissions['candlattachments'] == 1 || $mybb->settings['attachthumbnails'] == "no") && $isimage) {
                        eval("\$post['imagelist'] .= \"" . $templates->get("postbit_attachments_images_image") . "\";");
                    } else {
                        eval("\$post['attachmentlist'] .= \"" . $templates->get("postbit_attachments_attachment") . "\";");
                    }
                }
            } else {
                $validationcount++;
            }
        }
        if ($validationcount > 0 && is_moderator($post['fid'], "canviewunapprove")) {
            if ($validationcount == 1) {
                $postbit_unapproved_attachments = $lang->postbit_unapproved_attachment;
            } else {
                $postbit_unapproved_attachments = $lang->sprintf($lang->postbit_unapproved_attachments, $validationcount);
            }
            eval("\$post['attachmentlist'] .= \"" . $templates->get("postbit_attachments_attachment_unapproved") . "\";");
        }
        if ($post['thumblist']) {
            eval("\$post['attachedthumbs'] = \"" . $templates->get("postbit_attachments_thumbnails") . "\";");
        } else {
            $post['attachedthumbs'] = '';
        }
        if ($post['imagelist']) {
            eval("\$post['attachedimages'] = \"" . $templates->get("postbit_attachments_images") . "\";");
        } else {
            $post['attachedimages'] = '';
        }
        if ($post['attachmentlist'] || $post['thumblist'] || $post['imagelist']) {
            eval("\$post['attachments'] = \"" . $templates->get("postbit_attachments") . "\";");
        }
    }
}
Exemplo n.º 20
0
}
// Prepare the main templates for use
unset($admincplink);
// Load appropriate welcome block for the current logged in user
if ($mybb->user['uid'] != 0) {
    // User can access the admin cp and we're not hiding admin cp links, fetch it
    if ($mybb->usergroup['cancp'] == 1 && $mybb->config['hide_admin_links'] != 1) {
        eval("\$admincplink = \"" . $templates->get("header_welcomeblock_member_admin") . "\";");
    }
    if ($mybb->usergroup['canmodcp'] == 1) {
        eval("\$modcplink = \"" . $templates->get("header_welcomeblock_member_moderator") . "\";");
    }
    // Format the welcome back message
    $lang->welcome_back = $lang->sprintf($lang->welcome_back, $mybb->user['username'], $lastvisit);
    // Tell the user their PM usage
    $lang->welcome_pms_usage = $lang->sprintf($lang->welcome_pms_usage, my_number_format($mybb->user['pms_unread']), my_number_format($mybb->user['pms_total']));
    eval("\$welcomeblock = \"" . $templates->get("header_welcomeblock_member") . "\";");
} else {
    eval("\$welcomeblock = \"" . $templates->get("header_welcomeblock_guest") . "\";");
}
$unreadreports = '';
// This user is a moderator, super moderator or administrator
if ($mybb->usergroup['cancp'] == 1 || $mybb->user['ismoderator']) {
    // Read the reported posts cache
    $reported = $cache->read("reportedposts");
    // 0 or more reported posts currently exist
    if ($reported['unread'] > 0) {
        if ($reported['unread'] == 1) {
            $lang->unread_reports = $lang->unread_report;
        } else {
            $lang->unread_reports = $lang->sprintf($lang->unread_reports, $reported['unread']);
Exemplo n.º 21
0
/**
 * Constructs the usercp misc menu.
 *
 */
function usercp_menu_misc()
{
    global $db, $mybb, $templates, $theme, $usercpmenu, $lang, $collapsed, $collapsedimg;
    $draftstart = $draftend = '';
    $draftcount = $lang->ucp_nav_drafts;
    $query = $db->simple_select("posts", "COUNT(pid) AS draftcount", "visible = '-2' AND uid = '{$mybb->user['uid']}'");
    $count = $db->fetch_field($query, 'draftcount');
    if ($count > 0) {
        $draftcount = $lang->sprintf($lang->ucp_nav_drafts_active, my_number_format($count));
    }
    if ($mybb->settings['enableattachments'] != 0) {
        eval("\$attachmentop = \"" . $templates->get("usercp_nav_attachments") . "\";");
    }
    if (!isset($collapsedimg['usercpmisc'])) {
        $collapsedimg['usercpmisc'] = '';
    }
    if (!isset($collapsed['usercpmisc_e'])) {
        $collapsed['usercpmisc_e'] = '';
    }
    $profile_link = get_profile_link($mybb->user['uid']);
    eval("\$usercpmenu .= \"" . $templates->get("usercp_nav_misc") . "\";");
}
Exemplo n.º 22
0
function build_attachment_row($attachment, &$table, $use_form = false)
{
    global $mybb, $form;
    $attachment['filename'] = htmlspecialchars_uni($attachment['filename']);
    // Here we do a bit of detection, we want to automatically check for removal any missing attachments and any not assigned to a post uploaded > 24hours ago
    // Check if the attachment exists in the file system
    $checked = false;
    $title = $cell_class = '';
    if (!file_exists(MYBB_ROOT . $mybb->settings['uploadspath'] . "/{$attachment['attachname']}")) {
        $cell_class = "bad_attachment";
        $title = $lang->error_not_found;
        $checked = true;
    } elseif (!$attachment['pid'] && $attachment['dateuploaded'] < TIME_NOW - 60 * 60 * 24 && $attachment['dateuploaded'] != 0) {
        $cell_class = "bad_attachment";
        $title = $lang->error_not_attached;
        $checked = true;
    } else {
        if (!$attachment['tid'] && $attachment['pid']) {
            $cell_class = "bad_attachment";
            $title = $lang->error_does_not_exist;
            $checked = true;
        } else {
            if ($attachment['visible'] == 0) {
                $cell_class = "invisible_attachment";
            }
        }
    }
    if ($cell_class) {
        $cell_class .= " align_center";
    } else {
        $cell_class = "align_center";
    }
    if ($use_form == true && is_object($form)) {
        $table->construct_cell($form->generate_check_box('aids[]', $attachment['aid'], '', array('checked' => $checked)));
    }
    $table->construct_cell(get_attachment_icon(get_extension($attachment['filename'])), array('width' => 1));
    $table->construct_cell("<a href=\"../attachment.php?aid={$attachment['aid']}\" target=\"_blank\">{$attachment['filename']}</a>");
    $table->construct_cell(get_friendly_size($attachment['filesize']), array('class' => $cell_class));
    if ($attachment['user_username']) {
        $attachment['username'] = $attachment['username'];
    }
    $table->construct_cell(build_profile_link($attachment['username'], $attachment['uid'], "_blank"), array("class" => "align_center"));
    $table->construct_cell("<a href=\"../" . get_post_link($attachment['pid']) . "\" target=\"_blank\">" . htmlspecialchars_uni($attachment['subject']) . "</a>", array("class" => "align_center"));
    $table->construct_cell(my_number_format($attachment['downloads']), array("class" => "align_center"));
    if ($attachment['dateuploaded'] > 0) {
        $date = my_date($mybb->settings['dateformat'], $attachment['dateuploaded']) . ", " . my_date($mybb->settings['timeformat'], $attachment['dateuploaded']);
    } else {
        $date = $lang->unknown;
    }
    $table->construct_cell($date, array("class" => "align_center"));
    $table->construct_row();
}
Exemplo n.º 23
0
    $lang->stats_posts_threads = $lang->sprintf($lang->stats_posts_threads, my_number_format($stats['numposts']), my_number_format($stats['numthreads']));
    $lang->stats_numusers = $lang->sprintf($lang->stats_numusers, my_number_format($stats['numusers']));
    $lang->stats_newestuser = $lang->sprintf($lang->stats_newestuser, $newestmember);
    // Find out what the highest users online count is.
    $mostonline = $cache->read('mostonline');
    if ($onlinecount > $mostonline['numusers']) {
        $time = TIME_NOW;
        $mostonline['numusers'] = $onlinecount;
        $mostonline['time'] = $time;
        $cache->update('mostonline', $mostonline);
    }
    $recordcount = $mostonline['numusers'];
    $recorddate = my_date($mybb->settings['dateformat'], $mostonline['time']);
    $recordtime = my_date($mybb->settings['timeformat'], $mostonline['time']);
    // Then format that language string.
    $lang->stats_mostonline = $lang->sprintf($lang->stats_mostonline, my_number_format($recordcount), $recorddate, $recordtime);
    eval('$forumstats = "' . $templates->get('index_stats') . '";');
}
// Show the board statistics table only if one or more index statistics are enabled.
$boardstats = '';
if ($mybb->settings['showwol'] != 0 && $mybb->usergroup['canviewonline'] != 0 || $mybb->settings['showindexstats'] != 0 || $mybb->settings['showbirthdays'] != 0 && $bdaycount > 0) {
    if (!isset($stats) || isset($stats) && !is_array($stats)) {
        // Load the stats cache.
        $stats = $cache->read('stats');
    }
    $post_code_string = '';
    if ($mybb->user['uid']) {
        $post_code_string = '&amp;my_post_key=' . $mybb->post_code;
    }
    eval('$boardstats = "' . $templates->get('index_boardstats') . '";');
}
Exemplo n.º 24
0
                $messages = $db->fetch_array($query);
        }
        // the SUM() thing returns "" instead of 0
        if ($messages['pms_unread'] == "") {
            $messages['pms_unread'] = 0;
        }
        $lang->pms_received_new = $lang->sprintf($lang->pms_received_new, $mybb->user['username'], $messages['pms_unread']);
        eval("\$pms = \"" . $templates->get("portal_pms") . "\";");
    }
}
// Get Forum Statistics
if ($mybb->settings['portal_showstats'] != 0) {
    $stats = $cache->read("stats");
    $stats['numthreads'] = my_number_format($stats['numthreads']);
    $stats['numposts'] = my_number_format($stats['numposts']);
    $stats['numusers'] = my_number_format($stats['numusers']);
    if (!$stats['lastusername']) {
        $newestmember = "<strong>" . $lang->no_one . "</strong>";
    } else {
        $newestmember = build_profile_link($stats['lastusername'], $stats['lastuid']);
    }
    eval("\$stats = \"" . $templates->get("portal_stats") . "\";");
}
// Search box
if ($mybb->settings['portal_showsearch'] != 0) {
    eval("\$search = \"" . $templates->get("portal_search") . "\";");
}
// Get the online users
if ($mybb->settings['portal_showwol'] != 0 && $mybb->usergroup['canviewonline'] != 0) {
    $timesearch = TIME_NOW - $mybb->settings['wolcutoff'];
    $comma = '';
         $similar_thread['subject'] = $parser->parse_badwords($similar_thread['subject']);
         $similar_thread['subject'] = htmlspecialchars_uni($similar_thread['subject']);
         $similar_thread['threadlink'] = get_thread_link($similar_thread['tid']);
         $similar_thread['lastpostlink'] = get_thread_link($similar_thread['tid'], 0, "lastpost");
         $lastpostdate = my_date($mybb->settings['dateformat'], $similar_thread['lastpost']);
         $lastposttime = my_date($mybb->settings['timeformat'], $similar_thread['lastpost']);
         $lastposter = $similar_thread['lastposter'];
         $lastposteruid = $similar_thread['lastposteruid'];
         // Don't link to guest's profiles (they have no profile).
         if ($lastposteruid == 0) {
             $lastposterlink = $lastposter;
         } else {
             $lastposterlink = build_profile_link($lastposter, $lastposteruid);
         }
         $similar_thread['replies'] = my_number_format($similar_thread['replies']);
         $similar_thread['views'] = my_number_format($similar_thread['views']);
         eval("\$similarthreadbits .= \"" . $templates->get("showthread_similarthreads_bit") . "\";");
     }
     if ($count) {
         eval("\$similarthreads = \"" . $templates->get("showthread_similarthreads") . "\";");
     }
 }
 // Decide whether or not to show quick reply.
 $quickreply = '';
 if ($forumpermissions['canpostreplys'] != 0 && $mybb->user['suspendposting'] != 1 && ($thread['closed'] != 1 || is_moderator($fid)) && $mybb->settings['quickreply'] != 0 && $mybb->user['showquickreply'] != '0' && $forum['open'] != 0) {
     $query = $db->simple_select("posts", "pid", "tid='{$tid}'", array("order_by" => "pid", "order_dir" => "desc", "limit" => 1));
     $last_pid = $db->fetch_field($query, "pid");
     // Show captcha image for guests if enabled
     $captcha = '';
     if ($mybb->settings['captchaimage'] && !$mybb->user['uid']) {
         require_once MYBB_ROOT . 'inc/class_captcha.php';
    $table->construct_cell(htmlspecialchars_uni($mybb->settings['cloudflare_api']), array('width' => '200'));
    $table->construct_cell("<strong>CloudFlare Settings</strong>", array('width' => '25%'));
    $table->construct_cell("<a href=\"https://www.cloudflare.com/cloudflare-settings.html?z=" . $mybb->settings['cloudflare_domain'] . "\" target=\"_blank\">View/Modify</a>", array('width' => '25%'));
    $table->construct_row();
    $table->output("General Information");
    // Today
    $table = new Table();
    $table->construct_header("Page Views");
    $table->construct_cell(my_number_format($today_results['pageviews']));
    $table->construct_header("Unique Visitors");
    $table->construct_cell(my_number_format($today_results['uniques']));
    $table->construct_header("Bandwidth Usage");
    $table->construct_cell("Total: {$today_results['bandwidth']} ({$today_results['bandwidth_cached']} cached)");
    $table->construct_header("Threats");
    $table->construct_cell("<span style=\"color: red;font-weight:bold;\">{$today_results['threats']}</span>");
    $table->construct_row();
    $table->output("Todays Traffic");
    // Weekly
    $table = new Table();
    $table->construct_header("Page Views");
    $table->construct_cell(my_number_format($week_results['pageviews']));
    $table->construct_header('Unique Visitors');
    $table->construct_cell(my_number_format($week_results['uniques']));
    $table->construct_header('Bandwidth Usage');
    $table->construct_cell("Total: {$today_results['bandwidth']} ({$today_results['bandwidth_cached']} cached)");
    $table->construct_header('Threats');
    $table->construct_cell("<span style=\"color: red;font-weight:bold;\">{$week_results['threats']}</span>");
    $table->construct_row();
    $table->output('Weekly Traffic');
    $page->output_footer();
}
Exemplo n.º 27
0
             }
         }
         if ($customfieldval) {
             $customfield['name'] = htmlspecialchars_uni($customfield['name']);
             eval("\$customfields .= \"" . $templates->get("member_profile_customfields_field") . "\";");
             $bgcolor = alt_trow();
         }
     }
 }
 if ($customfields) {
     eval("\$profilefields = \"" . $templates->get("member_profile_customfields") . "\";");
 }
 $memprofile['postnum'] = my_number_format($memprofile['postnum']);
 $lang->ppd_percent_total = $lang->sprintf($lang->ppd_percent_total, my_number_format($ppd), $post_percent);
 $memprofile['threadnum'] = my_number_format($memprofile['threadnum']);
 $lang->tpd_percent_total = $lang->sprintf($lang->tpd_percent_total, my_number_format($tpd), $thread_percent);
 $formattedname = format_name($memprofile['username'], $memprofile['usergroup'], $memprofile['displaygroup']);
 $bannedbit = '';
 if ($memperms['isbannedgroup'] == 1 && $mybb->usergroup['canbanusers'] == 1) {
     // Fetch details on their ban
     $query = $db->simple_select('banned b LEFT JOIN ' . TABLE_PREFIX . 'users a ON (b.admin=a.uid)', 'b.*, a.username AS adminuser', "b.uid='{$uid}'", array('limit' => 1));
     $memban = $db->fetch_array($query);
     if ($memban['reason']) {
         $memban['reason'] = htmlspecialchars_uni($parser->parse_badwords($memban['reason']));
     } else {
         $memban['reason'] = $lang->na;
     }
     if ($memban['lifted'] == 'perm' || $memban['lifted'] == '' || $memban['bantime'] == 'perm' || $memban['bantime'] == '---') {
         $banlength = $lang->permanent;
         $timeremaining = $lang->na;
     } else {
Exemplo n.º 28
0
     eval("\$gotounread = \"" . $templates->get("forumdisplay_thread_gotounread") . "\";");
     $unreadpost = 1;
 } else {
     $folder_label .= $lang->icon_no_new;
 }
 if ($post['thread_replies'] >= $mybb->settings['hottopic'] || $post['thread_views'] >= $mybb->settings['hottopicviews']) {
     $folder .= "hot";
     $folder_label .= $lang->icon_hot;
 }
 if ($thread['thread_closed'] == 1) {
     $folder .= "lock";
     $folder_label .= $lang->icon_lock;
 }
 $folder .= "folder";
 $post['thread_replies'] = my_number_format($post['thread_replies']);
 $post['thread_views'] = my_number_format($post['thread_views']);
 if ($forumcache[$post['fid']]) {
     $post['forumlink'] = "<a href=\"" . get_forum_link($post['fid']) . "\">" . $forumcache[$post['fid']]['name'] . "</a>";
 } else {
     $post['forumlink'] = "";
 }
 if (!$post['subject']) {
     $post['subject'] = $post['message'];
 }
 if (my_strlen($post['subject']) > 50) {
     $post['subject'] = htmlspecialchars_uni(my_substr($post['subject'], 0, 50) . "...");
 } else {
     $post['subject'] = htmlspecialchars_uni($post['subject']);
 }
 // What we do here is parse the post using our post parser, then strip the tags from it
 $parser_options = array('allow_html' => 0, 'allow_mycode' => 1, 'allow_smilies' => 0, 'allow_imgcode' => 0, 'filter_badwords' => 1);
Exemplo n.º 29
0
/**
 * Build a post bit
 *
 * @param array The post data
 * @param int The type of post bit we're building (1 = preview, 2 = pm, 3 = announcement, else = post)
 * @return string The built post bit
 */
function build_postbit($post, $post_type = 0)
{
    global $db, $altbg, $theme, $mybb, $postcounter;
    global $titlescache, $page, $templates, $forumpermissions, $attachcache;
    global $lang, $ismod, $inlinecookie, $inlinecount, $groupscache, $fid;
    global $plugins, $parser, $cache, $ignored_users, $hascustomtitle;
    $hascustomtitle = 0;
    // Set default values for any fields not provided here
    foreach (array('subject_extra', 'attachments', 'button_rep', 'button_warn', 'button_reply_pm', 'button_replyall_pm', 'button_forward_pm', 'button_delete_pm') as $post_field) {
        if (empty($post[$post_field])) {
            $post[$post_field] = '';
        }
    }
    // Set up the message parser if it doesn't already exist.
    if (!$parser) {
        require_once MYBB_ROOT . "inc/class_parser.php";
        $parser = new postParser();
    }
    $unapproved_shade = '';
    if ($post['visible'] == 0 && $post_type == 0) {
        $altbg = $unapproved_shade = 'trow_shaded';
    } elseif ($altbg == 'trow1') {
        $altbg = 'trow2';
    } else {
        $altbg = 'trow1';
    }
    $post['fid'] = $fid;
    switch ($post_type) {
        case 1:
            // Message preview
            global $forum;
            $parser_options['allow_html'] = $forum['allowhtml'];
            $parser_options['allow_mycode'] = $forum['allowmycode'];
            $parser_options['allow_smilies'] = $forum['allowsmilies'];
            $parser_options['allow_imgcode'] = $forum['allowimgcode'];
            $parser_options['allow_videocode'] = $forum['allowvideocode'];
            $parser_options['me_username'] = $post['username'];
            $parser_options['filter_badwords'] = 1;
            $id = 0;
            break;
        case 2:
            // Private message
            global $message, $pmid;
            $parser_options['allow_html'] = $mybb->settings['pmsallowhtml'];
            $parser_options['allow_mycode'] = $mybb->settings['pmsallowmycode'];
            $parser_options['allow_smilies'] = $mybb->settings['pmsallowsmilies'];
            $parser_options['allow_imgcode'] = $mybb->settings['pmsallowimgcode'];
            $parser_options['allow_videocode'] = $mybb->settings['pmsallowvideocode'];
            $parser_options['me_username'] = $post['username'];
            $parser_options['filter_badwords'] = 1;
            $id = $pmid;
            break;
        case 3:
            // Announcement
            global $announcementarray, $message;
            $parser_options['allow_html'] = $announcementarray['allowhtml'];
            $parser_options['allow_mycode'] = $announcementarray['allowmycode'];
            $parser_options['allow_smilies'] = $announcementarray['allowsmilies'];
            $parser_options['allow_imgcode'] = 1;
            $parser_options['allow_videocode'] = 1;
            $parser_options['me_username'] = $post['username'];
            $parser_options['filter_badwords'] = 1;
            break;
        default:
            // Regular post
            global $forum, $thread, $tid;
            $oldforum = $forum;
            $id = intval($post['pid']);
            $parser_options['allow_html'] = $forum['allowhtml'];
            $parser_options['allow_mycode'] = $forum['allowmycode'];
            $parser_options['allow_smilies'] = $forum['allowsmilies'];
            $parser_options['allow_imgcode'] = $forum['allowimgcode'];
            $parser_options['allow_videocode'] = $forum['allowvideocode'];
            $parser_options['filter_badwords'] = 1;
            if (!$post['username']) {
                $post['username'] = $lang->guest;
            }
            if ($post['userusername']) {
                $parser_options['me_username'] = $post['userusername'];
            } else {
                $parser_options['me_username'] = $post['username'];
            }
            break;
    }
    // Sanatize our custom profile fields for use in templates, if people choose to use them
    foreach ($post as $post_field => $field_value) {
        if (substr($post_field, 0, 3) != 'fid') {
            continue;
        }
        $post[$post_field] = htmlspecialchars_uni($field_value);
    }
    if (!$postcounter) {
        // Used to show the # of the post
        if ($page > 1) {
            if (!$mybb->settings['postsperpage'] || (int) $mybb->settings['postsperpage'] < 1) {
                $mybb->settings['postsperpage'] = 20;
            }
            $postcounter = $mybb->settings['postsperpage'] * ($page - 1);
        } else {
            $postcounter = 0;
        }
        $post_extra_style = "border-top-width: 0;";
    } elseif ($mybb->input['mode'] == "threaded") {
        $post_extra_style = "border-top-width: 0;";
    } else {
        $post_extra_style = "margin-top: 5px;";
    }
    if (!$altbg) {
        // Define the alternate background colour if this is the first post
        $altbg = "trow1";
    }
    $postcounter++;
    // Format the post date and time using my_date
    $post['postdate'] = my_date($mybb->settings['dateformat'], $post['dateline']);
    $post['posttime'] = my_date($mybb->settings['timeformat'], $post['dateline']);
    // Dont want any little 'nasties' in the subject
    $post['subject'] = $parser->parse_badwords($post['subject']);
    // Pm's have been htmlspecialchars_uni()'ed already.
    if ($post_type != 2) {
        $post['subject'] = htmlspecialchars_uni($post['subject']);
    }
    if (empty($post['subject'])) {
        $post['subject'] = '&nbsp;';
    }
    $post['author'] = $post['uid'];
    // Get the usergroup
    if ($post['userusername']) {
        if (!$post['displaygroup']) {
            $post['displaygroup'] = $post['usergroup'];
        }
        $usergroup = $groupscache[$post['displaygroup']];
    } else {
        $usergroup = $groupscache[1];
    }
    if (!is_array($titlescache)) {
        $cached_titles = $cache->read("usertitles");
        if (!empty($cached_titles)) {
            foreach ($cached_titles as $usertitle) {
                $titlescache[$usertitle['posts']] = $usertitle;
            }
        }
        if (is_array($titlescache)) {
            krsort($titlescache);
        }
        unset($usertitle, $cached_titles);
    }
    // Work out the usergroup/title stuff
    $post['groupimage'] = '';
    if (!empty($usergroup['image'])) {
        $language = $mybb->settings['bblanguage'];
        if (!empty($mybb->user['language'])) {
            $language = $mybb->user['language'];
        }
        $usergroup['image'] = str_replace("{lang}", $language, $usergroup['image']);
        $usergroup['image'] = str_replace("{theme}", $theme['imgdir'], $usergroup['image']);
        eval("\$post['groupimage'] = \"" . $templates->get("postbit_groupimage") . "\";");
        if ($mybb->settings['postlayout'] == "classic") {
            $post['groupimage'] .= "<br />";
        }
    }
    if ($post['userusername']) {
        // This post was made by a registered user
        $post['username'] = $post['userusername'];
        $post['profilelink_plain'] = get_profile_link($post['uid']);
        $post['username_formatted'] = format_name($post['username'], $post['usergroup'], $post['displaygroup']);
        $post['profilelink'] = build_profile_link($post['username_formatted'], $post['uid']);
        if (trim($post['usertitle']) != "") {
            $hascustomtitle = 1;
        }
        if ($usergroup['usertitle'] != "" && !$hascustomtitle) {
            $post['usertitle'] = $usergroup['usertitle'];
        } elseif (is_array($titlescache) && !$usergroup['usertitle']) {
            reset($titlescache);
            foreach ($titlescache as $key => $titleinfo) {
                if ($post['postnum'] >= $key) {
                    if (!$hascustomtitle) {
                        $post['usertitle'] = $titleinfo['title'];
                    }
                    $post['stars'] = $titleinfo['stars'];
                    $post['starimage'] = $titleinfo['starimage'];
                    break;
                }
            }
        }
        if ($usergroup['stars']) {
            $post['stars'] = $usergroup['stars'];
        }
        if (empty($post['starimage'])) {
            $post['starimage'] = $usergroup['starimage'];
        }
        if ($post['starimage'] && $post['stars']) {
            // Only display stars if we have an image to use...
            $post['starimage'] = str_replace("{theme}", $theme['imgdir'], $post['starimage']);
            $post['userstars'] = '';
            for ($i = 0; $i < $post['stars']; ++$i) {
                $post['userstars'] .= "<img src=\"" . $post['starimage'] . "\" border=\"0\" alt=\"*\" />";
            }
            $post['userstars'] .= "<br />";
        }
        $postnum = $post['postnum'];
        $post['postnum'] = my_number_format($post['postnum']);
        // Determine the status to show for the user (Online/Offline/Away)
        $timecut = TIME_NOW - $mybb->settings['wolcutoff'];
        if ($post['lastactive'] > $timecut && ($post['invisible'] != 1 || $mybb->usergroup['canviewwolinvis'] == 1) && $post['lastvisit'] != $post['lastactive']) {
            eval("\$post['onlinestatus'] = \"" . $templates->get("postbit_online") . "\";");
        } else {
            if ($post['away'] == 1 && $mybb->settings['allowaway'] != 0) {
                eval("\$post['onlinestatus'] = \"" . $templates->get("postbit_away") . "\";");
            } else {
                eval("\$post['onlinestatus'] = \"" . $templates->get("postbit_offline") . "\";");
            }
        }
        if ($post['avatar'] != "" && ($mybb->user['showavatars'] != 0 || !$mybb->user['uid'])) {
            $post['avatar'] = htmlspecialchars_uni($post['avatar']);
            $avatar_dimensions = explode("|", $post['avatardimensions']);
            if ($avatar_dimensions[0] && $avatar_dimensions[1]) {
                list($max_width, $max_height) = explode("x", my_strtolower($mybb->settings['postmaxavatarsize']));
                if ($avatar_dimensions[0] > $max_width || $avatar_dimensions[1] > $max_height) {
                    require_once MYBB_ROOT . "inc/functions_image.php";
                    $scaled_dimensions = scale_image($avatar_dimensions[0], $avatar_dimensions[1], $max_width, $max_height);
                    $avatar_width_height = "width=\"{$scaled_dimensions['width']}\" height=\"{$scaled_dimensions['height']}\"";
                } else {
                    $avatar_width_height = "width=\"{$avatar_dimensions[0]}\" height=\"{$avatar_dimensions[1]}\"";
                }
            }
            eval("\$post['useravatar'] = \"" . $templates->get("postbit_avatar") . "\";");
            $post['avatar_padding'] = "padding-right: 10px;";
        } else {
            $post['useravatar'] = '';
            $post['avatar_padding'] = '';
        }
        eval("\$post['button_find'] = \"" . $templates->get("postbit_find") . "\";");
        if ($mybb->settings['enablepms'] == 1 && $post['receivepms'] != 0 && $mybb->usergroup['cansendpms'] == 1 && my_strpos("," . $post['ignorelist'] . ",", "," . $mybb->user['uid'] . ",") === false) {
            eval("\$post['button_pm'] = \"" . $templates->get("postbit_pm") . "\";");
        }
        if ($post_type != 3 && $mybb->settings['enablereputation'] == 1 && $mybb->settings['postrep'] == 1 && $mybb->usergroup['cangivereputations'] == 1 && $usergroup['usereputationsystem'] == 1 && ($mybb->settings['posrep'] || $mybb->settings['neurep'] || $mybb->settings['negrep']) && $post['uid'] != $mybb->user['uid']) {
            if (!$post['pid']) {
                $post['pid'] = 0;
            }
            eval("\$post['button_rep'] = \"" . $templates->get("postbit_rep_button") . "\";");
        }
        if ($post['website'] != "") {
            $post['website'] = htmlspecialchars_uni($post['website']);
            eval("\$post['button_www'] = \"" . $templates->get("postbit_www") . "\";");
        } else {
            $post['button_www'] = "";
        }
        if ($post['hideemail'] != 1 && $mybb->usergroup['cansendemail'] == 1) {
            eval("\$post['button_email'] = \"" . $templates->get("postbit_email") . "\";");
        } else {
            $post['button_email'] = "";
        }
        $post['userregdate'] = my_date($mybb->settings['regdateformat'], $post['regdate']);
        // Work out the reputation this user has (only show if not announcement)
        if ($post_type != 3 && $usergroup['usereputationsystem'] != 0 && $mybb->settings['enablereputation'] == 1) {
            $post['userreputation'] = get_reputation($post['reputation'], $post['uid']);
            eval("\$post['replink'] = \"" . $templates->get("postbit_reputation") . "\";");
        }
        // Showing the warning level? (only show if not announcement)
        if ($post_type != 3 && $mybb->settings['enablewarningsystem'] != 0 && $usergroup['canreceivewarnings'] != 0 && ($mybb->usergroup['canwarnusers'] != 0 || $mybb->user['uid'] == $post['uid'] && $mybb->settings['canviewownwarning'] != 0)) {
            $warning_level = round($post['warningpoints'] / $mybb->settings['maxwarningpoints'] * 100);
            if ($warning_level > 100) {
                $warning_level = 100;
            }
            $warning_level = get_colored_warning_level($warning_level);
            // If we can warn them, it's not the same person, and we're in a PM or a post.
            if ($mybb->usergroup['canwarnusers'] != 0 && $post['uid'] != $mybb->user['uid'] && ($post_type == 0 || $post_type == 2)) {
                eval("\$post['button_warn'] = \"" . $templates->get("postbit_warn") . "\";");
                $warning_link = "warnings.php?uid={$post['uid']}";
            } else {
                $warning_link = "usercp.php";
            }
            eval("\$post['warninglevel'] = \"" . $templates->get("postbit_warninglevel") . "\";");
        }
        eval("\$post['user_details'] = \"" . $templates->get("postbit_author_user") . "\";");
    } else {
        // Message was posted by a guest or an unknown user
        $post['profilelink'] = format_name($post['username'], 1);
        if ($usergroup['usertitle']) {
            $post['usertitle'] = $usergroup['usertitle'];
        } else {
            $post['usertitle'] = $lang->guest;
        }
        $usergroup['title'] = $lang->na;
        $post['userregdate'] = $lang->na;
        $post['postnum'] = $lang->na;
        $post['button_profile'] = '';
        $post['button_email'] = '';
        $post['button_www'] = '';
        $post['signature'] = '';
        $post['button_pm'] = '';
        $post['button_find'] = '';
        $post['onlinestatus'] = '';
        $post['replink'] = '';
        eval("\$post['user_details'] = \"" . $templates->get("postbit_author_guest") . "\";");
    }
    $post['button_edit'] = '';
    $post['button_quickdelete'] = '';
    $post['button_quote'] = '';
    $post['button_quickquote'] = '';
    $post['button_report'] = '';
    // For private messages, fetch the reply/forward/delete icons
    if ($post_type == 2 && $post['pmid']) {
        global $replyall;
        eval("\$post['button_reply_pm'] = \"" . $templates->get("postbit_reply_pm") . "\";");
        eval("\$post['button_forward_pm'] = \"" . $templates->get("postbit_forward_pm") . "\";");
        eval("\$post['button_delete_pm'] = \"" . $templates->get("postbit_delete_pm") . "\";");
        if ($replyall == true) {
            eval("\$post['button_replyall_pm'] = \"" . $templates->get("postbit_replyall_pm") . "\";");
        }
    }
    if (!$post_type) {
        // Figure out if we need to show an "edited by" message
        $post['editedmsg'] = '';
        if ($post['edituid'] != 0 && $post['edittime'] != 0 && $post['editusername'] != "" && ($mybb->settings['showeditedby'] != 0 && $usergroup['cancp'] == 0 || $mybb->settings['showeditedbyadmin'] != 0 && $usergroup['cancp'] == 1)) {
            $post['editdate'] = my_date($mybb->settings['dateformat'], $post['edittime']);
            $post['edittime'] = my_date($mybb->settings['timeformat'], $post['edittime']);
            $post['editnote'] = $lang->sprintf($lang->postbit_edited, $post['editdate'], $post['edittime']);
            $post['editedprofilelink'] = build_profile_link($post['editusername'], $post['edituid']);
            eval("\$post['editedmsg'] = \"" . $templates->get("postbit_editedby") . "\";");
        }
        if ((is_moderator($fid, "caneditposts") || $forumpermissions['caneditposts'] == 1 && $mybb->user['uid'] == $post['uid']) && $mybb->user['uid'] != 0) {
            eval("\$post['button_edit'] = \"" . $templates->get("postbit_edit") . "\";");
        }
        // Quick Delete button
        $can_delete = 0;
        if ($mybb->user['uid'] == $post['uid']) {
            if ($forumpermissions['candeletethreads'] == 1 && $postcounter == 1) {
                $can_delete = 1;
            } else {
                if ($forumpermissions['candeleteposts'] == 1 && $postcounter != 1) {
                    $can_delete = 1;
                }
            }
        }
        if ((is_moderator($fid, "candeleteposts") || $can_delete == 1) && $mybb->user['uid'] != 0) {
            eval("\$post['button_quickdelete'] = \"" . $templates->get("postbit_quickdelete") . "\";");
        }
        // Inline moderation stuff
        if ($ismod) {
            if (isset($mybb->cookies[$inlinecookie]) && my_strpos($mybb->cookies[$inlinecookie], "|" . $post['pid'] . "|")) {
                $inlinecheck = "checked=\"checked\"";
                $inlinecount++;
            } else {
                $inlinecheck = "";
            }
            eval("\$post['inlinecheck'] = \"" . $templates->get("postbit_inlinecheck") . "\";");
            if ($post['visible'] == 0) {
                $invisiblepost = 1;
            }
        } else {
            $post['inlinecheck'] = "";
        }
        $post['postlink'] = get_post_link($post['pid'], $post['tid']);
        eval("\$post['posturl'] = \"" . $templates->get("postbit_posturl") . "\";");
        global $forum, $thread;
        if ($forum['open'] != 0 && ($thread['closed'] != 1 || is_moderator($forum['fid']))) {
            eval("\$post['button_quote'] = \"" . $templates->get("postbit_quote") . "\";");
        }
        if ($forumpermissions['canpostreplys'] != 0 && ($thread['closed'] != 1 || is_moderator($fid)) && $mybb->settings['multiquote'] != 0 && $forum['open'] != 0 && !$post_type) {
            eval("\$post['button_multiquote'] = \"" . $templates->get("postbit_multiquote") . "\";");
        }
        if ($mybb->user['uid'] != "0") {
            eval("\$post['button_report'] = \"" . $templates->get("postbit_report") . "\";");
        }
        if ($mybb->settings['logip'] != "no") {
            if ($mybb->settings['logip'] == "show") {
                eval("\$post['iplogged'] = \"" . $templates->get("postbit_iplogged_show") . "\";");
            } else {
                if ($mybb->settings['logip'] == "hide" && is_moderator($fid, "canviewips")) {
                    eval("\$post['iplogged'] = \"" . $templates->get("postbit_iplogged_hiden") . "\";");
                } else {
                    $post['iplogged'] = "";
                }
            }
        } else {
            $post['iplogged'] = "";
        }
    } elseif ($post_type == 3) {
        if ($mybb->usergroup['issupermod'] == 1 || is_moderator($fid)) {
            eval("\$post['button_edit'] = \"" . $templates->get("announcement_edit") . "\";");
            eval("\$post['button_quickdelete'] = \"" . $templates->get("announcement_quickdelete") . "\";");
        }
    }
    if ($post['smilieoff'] == 1) {
        $parser_options['allow_smilies'] = 0;
    }
    // If we have incoming search terms to highlight - get it done.
    if (!empty($mybb->input['highlight'])) {
        $parser_options['highlight'] = $mybb->input['highlight'];
        $post['subject'] = $parser->highlight_message($post['subject'], $parser_options['highlight']);
    }
    $post['message'] = $parser->parse_message($post['message'], $parser_options);
    get_post_attachments($id, $post);
    if ($post['includesig'] != 0 && $post['username'] && $post['signature'] != "" && ($mybb->user['uid'] == 0 || $mybb->user['showsigs'] != 0) && ($post['suspendsignature'] == 0 || $post['suspendsignature'] == 1 && $post['suspendsigtime'] != 0 && $post['suspendsigtime'] < TIME_NOW) && $usergroup['canusesig'] == 1 && ($usergroup['canusesigxposts'] == 0 || $usergroup['canusesigxposts'] > 0 && $postnum > $usergroup['canusesigxposts'])) {
        $sig_parser = array("allow_html" => $mybb->settings['sightml'], "allow_mycode" => $mybb->settings['sigmycode'], "allow_smilies" => $mybb->settings['sigsmilies'], "allow_imgcode" => $mybb->settings['sigimgcode'], "me_username" => $post['username'], "filter_badwords" => 1);
        if ($usergroup['signofollow']) {
            $sig_parser['nofollow_on'] = 1;
        }
        $post['signature'] = $parser->parse_message($post['signature'], $sig_parser);
        eval("\$post['signature'] = \"" . $templates->get("postbit_signature") . "\";");
    } else {
        $post['signature'] = "";
    }
    $icon_cache = $cache->read("posticons");
    if ($post['icon'] > 0 && $icon_cache[$post['icon']]) {
        $icon = $icon_cache[$post['icon']];
        $icon['path'] = htmlspecialchars_uni($icon['path']);
        $icon['name'] = htmlspecialchars_uni($icon['name']);
        $post['icon'] = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" style=\"vertical-align: middle;\" />&nbsp;";
    } else {
        $post['icon'] = "";
    }
    $post_visibility = '';
    switch ($post_type) {
        case 1:
            // Message preview
            $post = $plugins->run_hooks("postbit_prev", $post);
            break;
        case 2:
            // Private message
            $post = $plugins->run_hooks("postbit_pm", $post);
            break;
        case 3:
            // Announcement
            $post = $plugins->run_hooks("postbit_announcement", $post);
            break;
        default:
            // Regular post
            $post = $plugins->run_hooks("postbit", $post);
            // Is this author on the ignore list of the current user? Hide this post
            $ignore_bit = '';
            if (is_array($ignored_users) && $post['uid'] != 0 && isset($ignored_users[$post['uid']]) && $ignored_users[$post['uid']] == 1) {
                $ignored_message = $lang->sprintf($lang->postbit_currently_ignoring_user, $post['username']);
                eval("\$ignore_bit = \"" . $templates->get("postbit_ignored") . "\";");
                $post_visibility = "display: none;";
            }
            break;
    }
    if ($mybb->settings['postlayout'] == "classic") {
        eval("\$postbit = \"" . $templates->get("postbit_classic") . "\";");
    } else {
        eval("\$postbit = \"" . $templates->get("postbit") . "\";");
    }
    $GLOBALS['post'] = "";
    return $postbit;
}
Exemplo n.º 30
0
 $todayrows = '';
 while ($online = $db->fetch_array($query)) {
     $invisiblemark = '';
     if ($online['invisible'] == 1) {
         $invisiblemark = "*";
     }
     if ($online['invisible'] != 1 || $mybb->usergroup['canviewwolinvis'] == 1 || $online['uid'] == $mybb->user['uid']) {
         $username = $online['username'];
         $username = format_name($username, $online['usergroup'], $online['displaygroup']);
         $online['profilelink'] = build_profile_link($username, $online['uid']);
         $onlinetime = my_date($mybb->settings['timeformat'], $online['lastactive']);
         eval("\$todayrows .= \"" . $templates->get("online_today_row") . "\";");
     }
 }
 $todaycount = my_number_format($todaycount);
 $invis_count = my_number_format($invis_count);
 if ($todaycount == 1) {
     $onlinetoday = $lang->member_online_today;
 } else {
     $onlinetoday = $lang->sprintf($lang->members_were_online_today, $todaycount);
 }
 if ($invis_count) {
     $string = $lang->members_online_hidden;
     if ($invis_count == 1) {
         $string = $lang->member_online_hidden;
     }
     $onlinetoday .= $lang->sprintf($string, $invis_count);
 }
 $multipage = multipage($todaycount, $perpage, $page, "online.php?action=today");
 $plugins->run_hooks("online_today_end");
 eval("\$today = \"" . $templates->get("online_today") . "\";");