} else { $session->set('shoutboxtries', '1'); } } $rand1 = mt_rand(0, 10); $rand2 = mt_rand(0, 10); $total = intval($rand1 + $rand2); $mode = JRequest::getCmd('mode'); if (!$ipaccess) { switch ($mode) { case 'addshout': if (empty($homepage)) { echo $sbid; modShoutboxHelper::addShout($sbid, $name, $url, $text, $tag, $delshouts, $user_calc, $user_Control, $params); } break; case 'delshout': if ($maydelete) { modShoutboxHelper::delShout($shoutid); } break; } list($list, $lastid, $time) = modShoutboxHelper::getShouts($sbid, $shouts, $params); } //JHTML::_('behavior.mootools'); $module_base = JURI::base() . 'modules/mod_shoutbox/'; $doc =& JFactory::getDocument(); $doc->addStyleSheet($module_base . 'css/mod_shoutbox.css'); $doc->addScript($module_base . 'js/shoutbox.js'); require JModuleHelper::getLayoutPath('mod_shoutbox'); }
function jal_addData($sbid, $name, $url, $text, $delshouts, $user_calc, $user_Control, &$params) { $mainframe = JFactory::getApplication(); $user =& JFactory::getUser(); if ($user->get('guest') && !$params->get('post_guest')) { return; } $session =& JFactory::getSession(); if ($session->get('shoutcaptcha') != 'ok' || md5($user_calc . $params->get('phrase')) != $user_Control) { return; } if (intval($session->get('shoutboxtries')) > intval($params->get('captcha_tries'))) { return; } //filter some spam $url = $url == "http://" ? "" : htmlspecialchars($url); if ($params->get('url') == 0 && strlen($url) > 0) { return; } if ($user->get('guest') && substr_count($text, 'http://') > intval($params->get('guest_urls'))) { return; } //Banned Words $bwords = $params->get('banned'); $bwords = preg_split('[, ]', $bwords); //Censored Words $censored = $params->get('censored'); $censored = preg_split('[, ]', $censored); $db =& JFactory::getDBO(); $ip = $_SERVER['REMOTE_ADDR']; $name = strip_tags($name); $name = substr(trim($name), 0, 12); $text = strip_tags($text); $text = substr($text, 0, 500); $text = htmlspecialchars(trim($text)); foreach ($bwords as $badword) { if ($badword && strpos(strtolower($text), strtolower($badword)) !== false) { return; } } foreach ($censored as $badword) { $text = preg_replace("/\\b(" . str_replace('\\*', '\\w*?', preg_quote($badword)) . ")\\b/ie", "str_repeat('#', strlen('\\1'))", $text); } $name = empty($name) ? "Anonymous" : htmlspecialchars($name); $date =& JFactory::getDate(); $time = $date->toUnix(); $avatar = 0; if ($params->get('avatar')) { $avatar = htmlspecialchars(modShoutboxHelper::getAvatar($user, $params->get('avatar'), $params->get('dav'))); } $target = ''; if (strpos($text, JURI::base()) === false) { $target = ' target="_blank" rel="nofollow"'; } $text = preg_replace("`(http|ftp)+(s)?:(//)((\\w|\\.|\\-|_)+)(/)?(\\S+)?`i", "<a href=\"\\0\"{$target}>«link»</a>", $text); $text = preg_replace("`([-_a-z0-9]+(\\.[-_a-z0-9]+)*@[-a-z0-9]+(\\.[-a-z0-9]+)*\\.[a-z]{2,6})`i", "<a href=\"mailto:\\1\">«email»</a>", $text); $mainframe->triggerEvent('onBBCode_RenderText', array(&$text)); $mainframe->triggerEvent('onSmiley_RenderText', array(&$text)); $query = 'INSERT INTO #__shoutbox' . ' (sbid,time,name,avatar,url,text,ip) VALUES (' . $db->quote($sbid) . ', "' . $time . '", ' . $db->quote($name) . ', ' . $db->quote($avatar) . ', ' . $db->quote($url) . ', ' . $db->quote($text) . ', ' . $db->quote($ip) . ' )'; $db->setQuery($query); if (!$db->query()) { JError::raiseError(500, $db->stderr()); return false; } modShoutboxHelper::deleteOld($delshouts); }
<?php foreach ($list as $item) { ?> <li> <?php if ($item->avatar != '0') { ?> <div class="avatar"><img src="<?php echo $item->avatar; ?> " width="35" height="35" alt="avatar" /></div> <?php } ?> <span title="<?php echo modShoutboxHelper::time_since($item->time); ?> "><?php echo $item->url; ?> : </span><?php echo $item->text; ?> </li> <?php } ?> <?php } ?> </ul>