Beispiel #1
0
function show_forum_rank($posts, $level)
{
    global $locale, $forum_mod_rank_cache, $forum_rank_cache, $settings;
    $res = "";
    if ($settings['forum_ranks']) {
        if (!$forum_rank_cache) {
            forum_rank_cache();
        }
        if ($level > 101) {
            if (is_array($forum_mod_rank_cache) && count($forum_mod_rank_cache)) {
                for ($i = 0; $i < count($forum_mod_rank_cache) && !$res; $i++) {
                    if ($level == $forum_mod_rank_cache[$i]['rank_apply']) {
                        $res = $forum_mod_rank_cache[$i]['rank_title'] . "<br />\n<img src='" . RANKS . $forum_mod_rank_cache[$i]['rank_image'] . "' alt='' style='border:0' />";
                    }
                }
            }
        }
        if (!$res) {
            if (is_array($forum_rank_cache) && count($forum_rank_cache)) {
                for ($i = 0; $i < count($forum_rank_cache); $i++) {
                    if ($posts >= $forum_rank_cache[$i]['rank_posts']) {
                        $res = $forum_rank_cache[$i]['rank_title'] . "<br />\n<img src='" . RANKS . $forum_rank_cache[$i]['rank_image'] . "' alt='' style='border:0' />";
                    }
                }
                if (!$res) {
                    $res = $forum_rank_cache[0]['rank_title'] . "<br />\n<img src='" . RANKS . $forum_rank_cache[0]['rank_image'] . "' alt='' style='border:0' />";
                }
            }
        }
    }
    return $res;
}
function show_forum_rank($posts, $level, $group = '')
{
    // Pimped for Group Ranks
    global $locale, $forum_mod_rank_cache, $forum_group_rank_cache, $forum_rank_cache, $settings;
    $res = "";
    if ($settings['forum_ranks']) {
        if (!$forum_rank_cache) {
            forum_rank_cache();
        }
        if ($level > nMEMBER) {
            if (is_array($forum_mod_rank_cache) && count($forum_mod_rank_cache)) {
                for ($i = 0; $i < count($forum_mod_rank_cache) && !$res; $i++) {
                    if ($level == $forum_mod_rank_cache[$i]['rank_apply']) {
                        $res = $forum_mod_rank_cache[$i]['rank_title'] . "<br />\n<img src='" . RANKS . $forum_mod_rank_cache[$i]['rank_image'] . "' alt='' style='border:0' />";
                    }
                }
            }
        }
        # Group Ranks: ->
        if (!$res) {
            if ($group != '') {
                if (is_array($forum_group_rank_cache) && count($forum_group_rank_cache)) {
                    for ($i = 0; $i < count($forum_group_rank_cache) && !$res; $i++) {
                        if (in_array($forum_group_rank_cache[$i]['rank_group'], explode(".", $group))) {
                            $res = $forum_group_rank_cache[$i]['rank_title'] . "<br />\n<img src='" . RANKS . $forum_group_rank_cache[$i]['rank_image'] . "' alt='' style='border:0' />";
                        }
                    }
                }
            }
        }
        # <-
        if (!$res) {
            if (is_array($forum_rank_cache) && count($forum_rank_cache)) {
                for ($i = 0; $i < count($forum_rank_cache); $i++) {
                    if ($posts >= $forum_rank_cache[$i]['rank_posts']) {
                        $res = $forum_rank_cache[$i]['rank_title'] . "<br />\n<img src='" . RANKS . $forum_rank_cache[$i]['rank_image'] . "' alt='' style='border:0' />";
                    }
                }
                if (!$res) {
                    $res = $forum_rank_cache[0]['rank_title'] . "<br />\n<img src='" . RANKS . $forum_rank_cache[0]['rank_image'] . "' alt='' style='border:0' />";
                }
            }
        }
    }
    return $res;
}
Beispiel #3
0
function show_forum_rank($posts, $level, $groups)
{
    global $locale, $settings, $forum_mod_rank_cache, $forum_post_rank_cache, $forum_special_rank_cache;
    $res = "";
    if ($settings['forum_ranks']) {
        if (!$forum_post_rank_cache) {
            forum_rank_cache();
        }
        // Moderator ranks
        if ($level > 101 && is_array($forum_mod_rank_cache) && count($forum_mod_rank_cache)) {
            for ($i = 0; $i < count($forum_mod_rank_cache) && !$res; $i++) {
                if ($level == $forum_mod_rank_cache[$i]['rank_apply']) {
                    $res = $forum_mod_rank_cache[$i]['rank_title'] . "<br />\n<img src='" . RANKS . $forum_mod_rank_cache[$i]['rank_image'] . "' alt='' style='border:0' /><br />";
                }
            }
        }
        // Special ranks
        if ($groups != "" && is_array($forum_special_rank_cache) && count($forum_special_rank_cache)) {
            for ($i = 0; $i < count($forum_special_rank_cache); $i++) {
                if (in_array($forum_special_rank_cache[$i]['rank_apply'], explode(".", $groups))) {
                    $res .= $forum_special_rank_cache[$i]['rank_title'] . "<br />\n<img src='" . RANKS . $forum_special_rank_cache[$i]['rank_image'] . "' alt='' style='border:0' /><br />";
                }
            }
        }
        // Post count ranks
        if (!$res && is_array($forum_post_rank_cache) && count($forum_post_rank_cache)) {
            for ($i = 0; $i < count($forum_post_rank_cache); $i++) {
                if ($posts >= $forum_post_rank_cache[$i]['rank_posts']) {
                    $res = $forum_post_rank_cache[$i]['rank_title'] . "<br />\n<img src='" . RANKS . $forum_post_rank_cache[$i]['rank_image'] . "' alt='' style='border:0' /><br />";
                }
            }
            if (!$res) {
                $res .= $forum_post_rank_cache[0]['rank_title'] . "<br />\n<img src='" . RANKS . $forum_post_rank_cache[0]['rank_image'] . "' alt='' style='border:0' /><br />";
            }
        }
    }
    return $res;
}
Beispiel #4
0
 /**
  * Get HTML source of forum rank images of a member
  * @param int   $posts  The number of posts of the member
  * @param int   $level  The level of the member
  * @param array $groups The groups of the member
  * @return string HTML source of forum rank images
  */
 public static function show_forum_rank($posts, $level, $groups)
 {
     global $forum_settings;
     $ranks = array();
     if (!$forum_settings['forum_ranks']) {
         return '';
     }
     $image = 0;
     if ($forum_settings['forum_rank_style'] == 1) {
         $image = 1;
     }
     $forum_rank_cache = forum_rank_cache();
     $forum_rank_css_class = array('-101' => 'label-member', '-102' => 'label-mod', '-103' => 'label-super-admin');
     $forum_rank_icon_class = array('-101' => 'fa fa-user fa-fw', '-102' => 'fa fa-shield fa-fw', '-103' => 'fa fa-shield fa-fw');
     // Moderator ranks
     if ($level < USER_LEVEL_MEMBER) {
         foreach ($forum_rank_cache['mod'] as $rank) {
             if ($level == $rank['rank_apply']) {
                 $ranks[] = $rank;
                 break;
             }
         }
     }
     // Special ranks
     if (!empty($groups)) {
         if (!is_array($groups)) {
             $groups = explode(".", $groups);
         }
         foreach ($forum_rank_cache['special'] as $rank) {
             if (in_array($rank['rank_apply'], $groups)) {
                 $ranks[] = $rank;
             }
         }
     }
     // Post count ranks
     if (!$ranks) {
         foreach ($forum_rank_cache['post'] as $rank) {
             if ($posts >= $rank['rank_posts']) {
                 $ranks[] = $rank;
             }
         }
         if (!$ranks) {
             $ranks[] = $forum_rank_cache['post'][0];
         }
     }
     $res = '';
     foreach ($ranks as $rank) {
         if ($image) {
             $res .= $rank['rank_title'] . "<br />\n<img src='" . RANKS . $rank['rank_image'] . "' alt='' style='border:0' /><br />";
         } else {
             $res .= "<label class='label " . (!empty($forum_rank_css_class[$rank['rank_apply']]) ? $forum_rank_css_class[$rank['rank_apply']] : "label-default") . " '><i class='" . $forum_rank_icon_class[$rank['rank_apply']] . "'></i> " . $rank['rank_title'] . "</label>\n";
         }
     }
     return $res;
 }