summaryrefslogtreecommitdiff
path: root/includes/sys_user.php
blob: 53976f5a73f655f9783ebf7e113390d7e73266a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php

function User_Nick_render($user_source) {
  global $user, $privileges;
  if($user['UID'] == $user_source['UID'] || in_array('user_shifts_admin', $privileges))
    return '<a href="' . page_link_to('user_myshifts') . '&amp;id=' . $user_source['UID'] . '">' . htmlspecialchars($user_source['Nick']) . '</a>';
  else
    return htmlspecialchars($user_source['Nick']);
}


/**
 * Available T-Shirt sizes
 */
$tshirt_sizes = array (
  '' => "Please select...",
  'S' => "S",
  'M' => "M",
  'L' => "L",
  'XL' => "XL",
  '2XL' => "2XL",
  '3XL' => "3XL",
  '4XL' => "4XL",
  '5XL' => "5XL",
  'S-G' => "S Girl",
  'M-G' => "M Girl",
  'L-G' => "L Girl",
  'XL-G' => "XL Girl"
);

function UID2Nick($UID) {
  if ($UID > 0)
    $SQL = "SELECT Nick FROM `User` WHERE UID='" . sql_escape($UID) . "'";
  else
    $SQL = "SELECT Name FROM `Groups` WHERE UID='" . sql_escape($UID) . "'";

  $Erg = sql_select($SQL);

  if (count($Erg) > 0) {
    if ($UID > 0)
      return $Erg[0]['Nick'];
    else
      return "Group-" . $Erg[0]['Name'];
  } else {
    if ($UID == -1)
      return "Guest";
    else
      return "UserID $UID not found";
  }
}

function TID2Type($TID) {
  global $con;

  $SQL = "SELECT Name FROM `EngelType` WHERE TID='" . sql_escape($TID) . "'";
  $Erg = mysql_query($SQL, $con);

  if (mysql_num_rows($Erg))
    return mysql_result($Erg, 0);
  else
    return "";
}

function ReplaceSmilies($neueckig) {
  $neueckig = str_replace(";o))", "<img src=\"pic/smiles/icon_redface.gif\">", $neueckig);
  $neueckig = str_replace(":-))", "<img src=\"pic/smiles/icon_redface.gif\">", $neueckig);
  $neueckig = str_replace(";o)", "<img src=\"pic/smiles/icon_wind.gif\">", $neueckig);
  $neueckig = str_replace(":)", "<img src=\"pic/smiles/icon_smile.gif\">", $neueckig);
  $neueckig = str_replace(":-)", "<img src=\"pic/smiles/icon_smile.gif\">", $neueckig);
  $neueckig = str_replace(":(", "<img src=\"pic/smiles/icon_sad.gif\">", $neueckig);
  $neueckig = str_replace(":-(", "<img src=\"pic/smiles/icon_sad.gif\">", $neueckig);
  $neueckig = str_replace(":o(", "<img src=\"pic/smiles/icon_sad.gif\">", $neueckig);
  $neueckig = str_replace(":o)", "<img src=\"pic/smiles/icon_lol.gif\">", $neueckig);
  $neueckig = str_replace(";o(", "<img src=\"pic/smiles/icon_cry.gif\">", $neueckig);
  $neueckig = str_replace(";(", "<img src=\"pic/smiles/icon_cry.gif\">", $neueckig);
  $neueckig = str_replace(";-(", "<img src=\"pic/smiles/icon_cry.gif\">", $neueckig);
  $neueckig = str_replace("8)", "<img src=\"pic/smiles/icon_rolleyes.gif\">", $neueckig);
  $neueckig = str_replace("8o)", "<img src=\"pic/smiles/icon_rolleyes.gif\">", $neueckig);
  $neueckig = str_replace(":P", "<img src=\"pic/smiles/icon_evil.gif\">", $neueckig);
  $neueckig = str_replace(":-P", "<img src=\"pic/smiles/icon_evil.gif\">", $neueckig);
  $neueckig = str_replace(":oP", "<img src=\"pic/smiles/icon_evil.gif\">", $neueckig);
  $neueckig = str_replace(";P", "<img src=\"pic/smiles/icon_mad.gif\">", $neueckig);
  $neueckig = str_replace(";oP", "<img src=\"pic/smiles/icon_mad.gif\">", $neueckig);
  $neueckig = str_replace("?)", "<img src=\"pic/smiles/icon_question.gif\">", $neueckig);

  return $neueckig;
}

function GetPictureShow($UID) {
  global $con;

  $SQL = "SELECT `show` FROM `UserPicture` WHERE `UID`='" . sql_escape($UID) . "'";
  $res = mysql_query($SQL, $con);

  if (mysql_num_rows($res) == 1)
    return mysql_result($res, 0, 0);
  else
    return "";
}

function displayPicture($UID, $height = "30") {
  global $url, $ENGEL_ROOT;

  if ($height > 0)
    return ("<div class=\"avatar\"><img src=\"" . $url . $ENGEL_ROOT . "ShowUserPicture.php?UID=$UID\" height=\"$height\" alt=\"picture of USER$UID\" class=\"photo\"></div>");
  else
    return ("<div class=\"avatar\"><img class=\"avatar\" src=\"" . $url . $ENGEL_ROOT . "ShowUserPicture.php?UID=$UID\" alt=\"picture of USER$UID\"></div>");
}

function displayavatar($UID, $height = "30") {
  global $con, $url, $ENGEL_ROOT;

  if (GetPictureShow($UID) == 'Y')
    return "&nbsp;" . displayPicture($UID, $height);

  $user = sql_select("SELECT * FROM `User` WHERE `UID`=" . sql_escape($UID) . " LIMIT 1");
  if (count($user) > 0)
    if ($user[0]['Avatar'] > 0)
    return '<div class="avatar">' . ("&nbsp;<img src=\"pic/avatar/avatar" . $user[0]['Avatar'] . ".gif\">") . '</div>';
}

function UIDgekommen($UID) {
  global $con;

  $SQL = "SELECT `Gekommen` FROM `User` WHERE UID='" . sql_escape($UID) . "'";
  $Erg = mysql_query($SQL, $con);

  if (mysql_num_rows($Erg))
    return mysql_result($Erg, 0);
  else
    return "0";
}
?>