Exemplo n.º 1
0
 public static function profile_link($up_id = false, $name = "", $access_level = 1, $link = true, $linkurl = NULL)
 {
     global $__server;
     if ($name === "") {
         if (!login::$logged_in) {
             return "anonym";
         }
         $up_id = login::$user->player->id;
         $name = login::$user->player->data['up_name'];
         $access_level = login::$user->player->data['up_access_level'];
     }
     $at = access::type($access_level);
     $color_class = access::html_class($at);
     $name_f = ($format = access::html_format($at)) ? str_replace("%user", htmlspecialchars($name), $format) : htmlspecialchars($name);
     $icons = '';
     $icons_right = '';
     $contacts = login::$logged_in ? login::$info['contacts'] : false;
     if ($contacts) {
         if ($up_id == login::$user->player->id) {
             $icons .= '<img src="' . STATIC_LINK . '/other/myself_contact_small.gif" alt="(meg selv)" title="Deg selv" />';
         } elseif (isset($contacts[1][$up_id])) {
             $icons .= '<img src="' . STATIC_LINK . '/other/user_small.gif" alt="(kontakt)" title="Din kontakt" />';
         }
         if (isset($contacts[2][$up_id])) {
             $icons .= '<img src="' . STATIC_LINK . '/other/block.png" alt="(blokkert)" title="Blokkert" />';
         }
     }
     // deaktivert?
     if ($access_level == 0) {
         $icons_right .= '<img src="' . STATIC_LINK . '/other/kors_lite.png" alt="(deaktivert)" title="Deaktivert" class="deactivated" />';
     }
     // link
     if ($link) {
         $p = "";
         if (!$linkurl) {
             $linkurl = $__server['relative_path'] . '/p/' . rawurlencode($name) . '/' . $up_id;
             $p = ' title="Vis profil"';
         }
         return '<a href="' . $linkurl . '"' . $p . ' rel="' . $up_id . '" class="profile_link' . ($color_class ? ' ' . $color_class : '') . '">' . $icons . '<span>' . $name_f . '</span>' . $icons_right . '</a>';
     }
     // tekst
     return '<span rel="' . $up_id . '" class="profile_link' . ($color_class ? ' ' . $color_class : '') . '">' . $icons . '<span>' . $name_f . '</span>' . $icons_right . '</span>';
 }