вывод ника function Nick matches out null if is_array matches id match

 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
/* вывод ника */
function Nick ($matches) {
$out = null;
if (is_array ($matches)) {
$id = $matches[1];
}
else {
$id = $matches;
}
$query = DB :: $dbs -> query ("SELECT `id`,`nick`,`sex`,`last`,`mosh`,`nickcolor1`,`nickcolor2` FROM `us` WHERE (`id`='" . $id . "')");
if ($query -> rowCount () != 0) {
$u = $query -> fetch ();
$out .= '<a href="/us' . $u['id'] . '" style="text-decoration:none;color:black;"><img src="/files/ico/'. ( $u['last'] > ( time () - 3600) ? ( file_exists ($_SERVER['DOCUMENT_ROOT'] . '/files/ico/' . $u['id'] . '.png') ? $u['id']: ( $u['sex']=='Муж' ? 'mon' : 'jon' ) ) : ( $u['sex'] == 'Муж' ? 'mof' : 'jof' ) ) .'.png?' . $u['id'] . '" alt="*" style="width:18px;height:18px;"/><b>' . (isset ($u['nickcolor1'], $u['nickcolor2']) ? gradient ($u['nick'], $u['nickcolor1'], $u['nickcolor2']) :$u['nick'] ) . '</b></a>';
if ($u['mosh']!=0) {
$out .= ' <font color="green">[<font color="red"><b>мошенник</b></font>]</font>';
}
} else {
$out = '<img src="/files/ico/mon.png" alt="*" style="width:18px;height:18px;"/><b>Гость</a></b>';
}
return $out;
}
/* конец ника */