Kod php:
if ($vbulletin->options['vsachatbox_enable_product'])
{
if ($vbulletin->options['vsachatbox_script_locs']!='')
{
eval('$vsacb_locs = in_array(THIS_SCRIPT, array(misc,' . $vbulletin->options['vsachatbox_script_locs'] . '));');
}
else
{
eval('$vsacb_locs = !in_array(THIS_SCRIPT, array(vsachatbox));');
}
if (!function_exists('VSacb_userExcluded'))
{
function VSacb_userExcluded($vsacb_user)
{
return (VSacb_checkExcluded($vsacb_user['userid'], 'vsachatbox_excluded_users') || VSacb_checkExcluded($vsacb_user['usergroupid'], 'vsachatbox_excluded_groups'));
}
}
if (!function_exists('VSacb_checkExcluded'))
{
function VSacb_checkExcluded($vsacb_exc1, $vsacb_exc2)
{
global $vbulletin;
return in_array($vsacb_exc1, iif($vbulletin->options[$vsacb_exc2], explode(',', $vbulletin->options[$vsacb_exc2]), array()));
}
}
if (!function_exists('VSacb_RGBtoHex'))
{
function VSacb_RGBtoHex($par)
{
if (stristr($par, "rgb"))
{
$trash = array('rgb(',')',' ');
$req = str_ireplace($trash, "", $par);
$val = explode(",", $req);
$str = '';
foreach($val as $c)
{
$str .= substr(sprintf('0%x',$c),-2);
}
return '#'.$str;
}
else
{
return $par;
}
}
}
$vsacb_hasenoughposts = true;
if (($vbulletin->userinfo['posts'] < $vbulletin->options['vsachatbox_excluded_pc']) AND !can_moderate())
{
$vsacb_hasenoughposts = false;
}
if (in_array(THIS_SCRIPT, array($vsacb_locs)) AND !VSacb_userExcluded($vbulletin->userinfo) AND empty($vbulletin->userinfo['infractiongroupids']) AND $vsacb_hasenoughposts)
{
$vsacb_canmod = false;
if (is_member_of($vbulletin->userinfo, explode(',', $vbulletin->options['vsachatbox_can_mod'])))
{
$vsacb_canmod = true;
}
$vsacb_canedit = true;
if (is_member_of($vbulletin->userinfo, explode(',', $vbulletin->options['vsachatbox_cannot_edit'])) OR VSacb_userExcluded($vbulletin->userinfo))
{
$vsacb_canedit = false;
}
if ($vbulletin->options['vsachatbox_canviewonly']!='')
{
$vsachatbox_cantpost = '1,'.$vbulletin->options['vsachatbox_canviewonly'];
}
else
{
$vsachatbox_cantpost = '1';
}
$vsacb_cantpost = false;
if (is_member_of($vbulletin->userinfo, explode(',', $vsachatbox_cantpost)))
{
$vsacb_cantpost = true;
}
if ($vbulletin->options['vsachatbox_smiliestotal']!=0)
{
if ($vbulletin->options['vsachatbox_smilies_random'])
{
$vsacb_ordsmil = "ORDER BY RAND()";
}
else
{
$vsacb_ordsmil = "ORDER BY imagecategory.displayorder, imagecategory.title, smilie.displayorder";
}
$vbulletin->db->hide_errors();
$vsacb_get_smilies = $vbulletin->db->query_read_slave("
SELECT smilieid, smilietext, smiliepath, smilie.title, imagecategory.title AS category
FROM " . TABLE_PREFIX . "smilie AS smilie
LEFT JOIN " . TABLE_PREFIX . "imagecategory AS imagecategory USING(imagecategoryid)
$vsacb_ordsmil
LIMIT 0, ".$vbulletin->options['vsachatbox_smiliesinit']."
");
$vsacb_smilies_total = $vbulletin->db->num_rows($vsacb_get_smilies);
$vbulletin->db->data_seek($vsacb_get_smilies, 0);
$vsacb_i = 0;
$vsacb_smilie_bit = array();
while ($vsacb_smilie = $vbulletin->db->fetch_array($vsacb_get_smilies) AND ($vsacb_i++ < $vsacb_smilies_total))
{
$vsacb_smilie_id += 1;
if ($vsacb_smilie_id==1)
{
$vsacb_smilie_first = $vsacb_smilie['smiliepath'];
}
$vsacb_smilie_html = '<a style="display:block;margin:2px;overflow:hidden;width:'.$vbulletin->options['vsachatbox_smiliesclip'].'px;height:'.$vbulletin->options['vsachatbox_smiliesclip'].'px;" href="javascript:void(0);" onclick="return VSacb_insertSmilie(\''.str_replace("'", "\'", $vsacb_smilie['smilietext']).'\')"><img onmouseover="return VSacb_updateSmiliePreview(this.src);" src="'.$vsacb_smilie['smiliepath'].'" alt="'.$vsacb_smilie['title'].'" border="0" /></a>';
$vsacb_smilie_bit[] = '<td>'.$vsacb_smilie_html.'</td>';
if (sizeof($vsacb_smilie_bit) == $vbulletin->options['vsachatbox_smiliesperrow'])
{
$vsacb_smilie_cell = implode('', $vsacb_smilie_bit);
$vsacb_smilie_bits .= '<tr align="center">'.$vsacb_smilie_cell.'</tr>';
$vsacb_smilie_bit = array();
}
}
$vsacb_smilies_remaining = sizeof($vsacb_smilie_bit);
if ($vsacb_smilies_remaining > 0)
{
$vsacb_smilies_colrem = $vbulletin->options['vsachatbox_smiliesperrow'] - $vsacb_smilies_remaining;
$vsacb_smilie_bit[] = '<td colspan="'.$vsacb_smilies_colrem.'"> </td>';
$vsacb_smilie_cell = implode('', $vsacb_smilie_bit);
$vsacb_smilie_bits .= '<tr align="center" valign="bottom">'.$vsacb_smilie_cell.'</tr>';
}
$vbulletin->db->show_errors();
unset($vsacb_get_smilies, $vsacb_smilie);
$vsacb_smilies_init = '<table cellpadding="0" cellspacing="0" border="0" align="center">'.$vsacb_smilie_bits.'</table>';
}
$vbulletin->db->hide_errors();
$vsacb_get_newstat = $vbulletin->db->query_read("
SELECT id
FROM " . TABLE_PREFIX . "vsa_chatbox AS vsa_chatbox
WHERE dateline > '".$vbulletin->userinfo['lastvisit']."'
");
$vbulletin->db->show_errors();
if ($vbulletin->db->num_rows($vsacb_get_newstat)>0)
{
$vsacb_newstat = construct_phrase($vbphrase['vsacb_x_new_messages'], $vbulletin->db->num_rows($vsacb_get_newstat));
}
else
{
$vsacb_newstat = $vbphrase['vsacb_no_new_messages'];
}
if (vB_Template_Runtime::fetchStyleVar('body_color'))
{
$vsacb_colorfirstp = vB_Template_Runtime::fetchStyleVar('body_color');
}
else
{
$vsacb_color_acplist = explode(",",str_replace(" ","",$vbulletin->options['vsachatbox_textcolors']));
$vsacb_colorfirstp = $vsacb_color_acplist[0];
}
$vsacb_colorfirst = VSacb_RGBtoHex($vsacb_colorfirstp);
if ($vbulletin->options['vsachatbox_colors_enabled'])
{
$vsacb_colors_list = $vsacb_colorfirst.','.str_replace(" ","",$vbulletin->options['vsachatbox_textcolors']);
$vsacb_get_colors = explode(",", $vsacb_colors_list);
$vsacb_colors_total = sizeof($vsacb_get_colors);
$vsacb_color_bit = array();
foreach ($vsacb_get_colors AS $vsacb_color)
{
$vsacb_color_html = '<a style="display:block;margin:2px;overflow:hidden;border:1px solid #ACA899;width:10px;height:10px;background-color:'.$vsacb_color.'" href="javascript:void(0);" onclick="VSacb_updateColor(\''.$vsacb_color.'\');"> </a>';
$vsacb_color_bit[] = '<td class="colorbutton">'.$vsacb_color_html.'</td>';
if (sizeof($vsacb_color_bit) == 8)
{
$vsacb_color_cell = implode('', $vsacb_color_bit);
$vsacb_color_bits .= '<tr align="center">'.$vsacb_color_cell.'</tr>';
$vsacb_color_bit = array();
}
}
$vsacb_colors_remaining = sizeof($vsacb_color_bit);
if ($vsacb_colors_remaining > 0)
{
$vsacb_colors_colrem = 8 - $vsacb_colors_remaining;
$vsacb_color_bit[] = '<td class="colorbutton" colspan="'.$vsacb_colors_colrem.'"> </td>';
$vsacb_color_cell = implode('', $vsacb_color_bit);
$vsacb_color_bits .= '<tr align="center">'.$vsacb_color_cell.'</tr>';
}
unset($vsacb_get_colors, $vsacb_color);
$vsacb_colors = '<table cellpadding="0" cellspacing="0" border="0" align="center">'.$vsacb_color_bits.'</table>';
}
$vbulletin->input->clean_gpc('c', 'vsachatbox_txtsize', TYPE_UINT);
$vsacb_textsize_p = $vbulletin->GPC['vsachatbox_txtsize'];
if (!$vsacb_textsize_p)
{
$vsacb_textsize_p = 11;
}
$vsacb_sizelist = explode(',',str_replace(' ', '', $vbulletin->options['vsachatbox_textsizes']));
foreach ($vsacb_sizelist AS $vsacb_size)
{
eval('$vsacb_sizes .= " <option value=\"'.$vsacb_size.'\" " . iif($vsacb_textsize_p==$vsacb_size," selected=\"selected\"","").">'.$vsacb_size.'px</option> "."\n";');
}
$vsacb_textsize = $vsacb_textsize_p.'px';
$templater = vB_Template::Create('vsa_chatbox_input');
$templater->register('vsacb_cantpost', $vsacb_cantpost);
$templater->register('vsacb_smilies_init', $vsacb_smilies_init);
$templater->register('vsacb_colors', $vsacb_colors);
$templater->register('vsacb_smilie_first', $vsacb_smilie_first);
$templater->register('vsacb_textsize', $vsacb_textsize);
$templater->register('vsacb_colorfirst', $vsacb_colorfirst);
$vsachatbox_input = $templater->render();
$templater = vB_Template::Create('vsa_chatbox_status');
$templater->register('vsacb_sizes', $vsacb_sizes);
$templater->register('vsacb_cantpost', $vsacb_cantpost);
$vsachatbox_status = $templater->render();
$templater = vB_Template::Create('vsa_chatbox');
$templater->register('vsachatbox_input', $vsachatbox_input);
$templater->register('vsachatbox_status', $vsachatbox_status);
$templater->register('vsacb_locs', $vsacb_locs);
$templater->register('vsacb_newstat', $vsacb_newstat);
$templater->register('vsacb_textsize', $vsacb_textsize);
$templater->register('vsacb_colorfirst', $vsacb_colorfirst);
$templater->register('vsacb_cantpost', $vsacb_cantpost);
$templater->register('vsacb_canmod', $vsacb_canmod);
$vsachatbox = $templater->render();
$vsachatbox_man['vsachatbox'] = $templater->render();
vB_Template::preRegister('footer', $vsachatbox_man);
vB_Template::preRegister('FORUMHOME', $vsachatbox_man);
if ($vbulletin->options['vsachatbox_template_locs']!='')
{
$vsacb_templatelist_get = explode(',',$vbulletin->options['vsachatbox_template_locs']);
foreach ($vsacb_templatelist_get AS $vsacb_templatelist_item)
{
$vsacb_templatelist = ','.vB_Template::preRegister($vsacb_templatelist_item, $vsachatbox_man);
}
$vsacb_templatelist = substr($vsacb_templatelist, 1);
}
if (THIS_SCRIPT!='misc' && $vbulletin->styleid != $vbulletin->options['mobilestyleid_basic'] && $vbulletin->styleid != $vbulletin->options['mobilestyleid_advanced']) {
switch ($vbulletin->options['vsachatbox_page_loc'])
{
case 0: break;
case 1: $ad_location['global_below_navbar'] .= $vsachatbox; break;
case 2: $template_hook['forumhome_below_forums'] .= $vsachatbox; break;
case 3: $footer = $vsachatbox.$footer; break;
}
}
if (($vbulletin->options['vsachatbox_auto_prune']>0) AND $vbulletin->userinfo['userid'])
{
$vsacb_prunetime = TIMENOW - ($vbulletin->options['vsachatbox_auto_prune'] * 3600);
$vbulletin->db->hide_errors();
$vbulletin->db->query_write(" DELETE FROM " . TABLE_PREFIX . "vsa_chatbox WHERE dateline < '".$vsacb_prunetime."' ");
$vbulletin->db->show_errors();
}
}
if (!VSacb_userExcluded($vbulletin->userinfo) AND empty($vbulletin->userinfo['infractiongroupids']) AND !$vsacb_cantpost)
{
$vsacb_navbarlink = "<li><a href=\"misc.php?".$session['sessionurl_q']."do=cchatbox\">".$vbphrase['vsacb_chatbox_full']."</a></li>";
if ($vbulletin->options['vsachatbox_autoinsertlink'])
{
$template_hook['navbar_end'] .= $vsacb_navbarlink;
}
}
}