0) { $banimg = array_merge($_SESSION['imagebans'], $GLOBALS['imagebans']); $banimg = array_unique($banimg); sort($banimg); $images = array(); $ids = array(); $ids[] = 0; $ccx = count($users); for ($cc=0;$cc<$ccx;$cc++) { $users[$cc]['userid'] += 0; if (!empty($users[$cc]['image'])) { if (!CheckImageBanned($users[$cc]['image'], $banimg)) $images[] = $users[$cc]['image']; } if (!empty($users[$cc]['userid'])) { $ids[] = $users[$cc]['userid']; } } if ($_SESSION['chats'][$id]['noimg'] != true) { $images = ScaleImageSize($images); } $query = "SELECT u.skype,u.id,u.prefs,u.aim,u.ym,u.icq,u.jabber,u.msn,u.email,u.site, char_length(u.profile) as profile, COALESCE(u.country, 'XX') as country2, COALESCE(c.name, 'Unknown') as country FROM {$GLOBALS['sql_prefix']}users as u LEFT JOIN {$GLOBALS['sql_prefix']}country_names as c ON (u.country=c.name2) WHERE ("; foreach ($ids as $idx) { $query .= "u.id='{$idx}' OR "; } $query = ereg_replace(' OR $', ')', $query); $contacts = array(); $rez = SQL_SingleQuery($query, NULL, __FILE__.' : '.__LINE__.' : '.__FUNCTION__); $num = SQL_NumRows($rez); for($i=0;$i<$num;$i++) { $row = SQL_FetchAssoc($rez, $i); $contacts[$row['id']] = $row; } SQL_FreeResult($rez); $ifind = array( '{URL}', '{WIDTH}', '{HEIGHT}', '{SWIDTH}', '{SHEIGHT}', '{TEXT}' ); for ($cc=0;$cc{$users[$cc]['image']}"; if (!$users[$cc]['link']) $userimage = $users[$cc]['image']; if (!$users[$cc]['username']) $users[$cc]['username'] = $GLOBALS['chat']['s_defaulthandle']; $username = "".UTF8Entities($users[$cc]['username']).''; if (!$users[$cc]['link']) $username = UTF8Entities($users[$cc]['username']); $repl = array( $userimage, $users[$cc]['link'], $username, str_replace('{LEVEL}', '', $contact), UTF8Entities($users[$cc]['ident']), UTF8Entities($users[$cc]['posttime']), UTF8Entities($users[$cc]['idlesecond']), UTF8Entities(round($users[$cc]['idlesecond']/60)), UTF8Entities(round($users[$cc]['idlesecond']/3600)) ); if (CheckFlags('*', 'MmZX')) { $repl[] = str_replace('{LEVEL}', $GLOBALS['level'], str_replace('{IDENT}', UTF8Entities($users[$cc]['ident']), $GLOBALS['chattheme']['userlistentry']['ban'])); } else { $repl[] = ''; } if (FindIgnore($users[$cc]['ident'], $id)) $repl[] = str_replace('{LEVEL}', $GLOBALS['level'], str_replace('{IDENT}', UTF8Entities($users[$cc]['ident']), $GLOBALS['chattheme']['userlistentry']['unignore'])); else $repl[] = str_replace('{LEVEL}', $GLOBALS['level'], str_replace('{IDENT}', UTF8Entities($users[$cc]['ident']), $GLOBALS['chattheme']['userlistentry']['ignore'])); $out .= str_replace($find, $repl, $buf); } } $find = array( "|

[\r\n]*
|is", "|
[\r\n]*
|is" ); $repl = array( '

', '
' ); return preg_replace($find, $repl, $out); } function AddToUserlist($id=0) { if ($id == 0) $id = $GLOBALS['id']; $id = SQL_EscapeString($id)+0; $new_link = SQL_EscapeOrNullString($_SESSION['chats'][$id]['link'] ? $_SESSION['chats'][$id]['link'] : $_SESSION['chats'][0]['link']); $new_img = SQL_EscapeOrNullString($_SESSION['chats'][$id]['image'] ? $_SESSION['chats'][$id]['image'] : $_SESSION['chats'][0]['image']); $new_name = SQL_EscapeOrNullString($_SESSION['chats'][$id]['username'] ? $_SESSION['chats'][$id]['username'] : $_SESSION['chats'][0]['username']); $new_ident = SQL_EscapeOrNullString($_SESSION['chats'][$id]['ident'] ? $_SESSION['chats'][$id]['ident'] : $_SESSION['chats'][0]['ident']); $new_id = SQL_EscapeOrNullInt($_SESSION['chats'][$id]['id'] ? $_SESSION['chats'][$id]['id'] : $_SESSION['chats'][0]['id']); $rez = SQL_Begin(); $extra = ''; if (CheckFlags($GLOBALS['chat']['prefs'], 'U')) $extra = "OR username={$new_name}"; SQL_Query("DELETE FROM {$GLOBALS['sql_prefix']}userlist WHERE chat={$id} AND (userid={$new_id} {$extra} OR ident={$new_ident} OR posttime<(now() - INTERVAL '{$GLOBALS['chat']['timeout']} minutes'))", $rez, __FILE__.' : '.__LINE__.' : '.__FUNCTION__); SQL_Query("INSERT INTO {$GLOBALS['sql_prefix']}userlist (chat,username,link,image,ident,userid) VALUES ($id,$new_name,$new_link,$new_img,$new_ident,$new_id)", $rez, __FILE__.' : '.__LINE__.' : '.__FUNCTION__); SQL_Commit($rez); } function RemoveFromUserlist($id=0, $uid=0, $ident=0) { if ($id == 0) $id = $GLOBALS['id']; $id = intval($id); if ($uid == 0) $uid = PChoose($_SESSION['chats'][$id]['id'], $_SESSION['chats'][0]['id']); $uid = intval($uid); if ($uid < 1) $uid = 'null'; if ($ident == 0) $ident = PChoose($_SESSION['chats'][$id]['ident'], $_SESSION['chats'][0]['ident']); $ident = SQL_EscapeOrNullString($ident); SQL_EmptyQuery("DELETE FROM {$GLOBALS['sql_prefix']}userlist WHERE chat=$id AND (userid=$uid OR ident=$ident OR posttime<(now() - INTERVAL '{$GLOBALS['chat']['timeout']} minutes'))", __FILE__.' : '.__LINE__.' : '.__FUNCTION__); } ?>