').' 1 ? ' colspan="'.$colspan.'"' : '').($rowspan > 1 ? ' rowspan="'.$rowspan.'"' : '').($width && !defined('IN_MOBILE') ? ' width="'.$width.'"' : '').'>';
}
function parseaudio($url, $width = 400) {
$url = addslashes($url);
if(!in_array(strtolower(substr($url, 0, 6)), array('http:/', 'https:', 'ftp://', 'rtsp:/', 'mms://')) && !preg_match('/^static\//', $url) && !preg_match('/^data\//', $url)) {
return dhtmlspecialchars($url);
}
$type = fileext($url);
$randomid = random(3);
return '';
}
function parsemedia($params, $url) {
$params = explode(',', $params);
if(preg_match('/^(auto|100%|[0-9]{1,2}%)$/', $params[1], $matches)) {
$width = $matches[1];
} else {
$width = ($params[1] > 0 && $params[1] < 8192) ? intval($params[1]) : 800;
}
if(preg_match('/^(auto|100%|[0-9]{1,2}%)$/', $params[2], $matches)) {
$height = $matches[1];
} else {
$height = ($params[2] > 0 && $params[2] < 4096) ? intval($params[2]) : 600;
}
$width = defined('IN_MOBILE') ? '100%' : $width;
$height = defined('IN_MOBILE') ? 'auto' : $height;
$url = addslashes($url);
if(!in_array(strtolower(substr($url, 0, 6)), array('http:/', 'https:', 'ftp://', 'rtsp:/', 'mms://')) && !preg_match('/^static\//', $url) && !preg_match('/^data\//', $url)) {
return dhtmlspecialchars($url);
}
if($flv = parseflv($url, $width, $height)) {
return $flv;
}
if(in_array(count($params), array(3, 4))) {
$type = fileext($url);
$url = str_replace(array('<', '>'), '', str_replace('\\"', '\"', $url));
if(in_array($params[0], array('rtsp', 'mms'))) {
$mediaid = 'media_'.random(3);
return $params[0] == 'rtsp' ? ' ' : '';
}
$audio = array('aac', 'flac', 'ogg', 'mp3', 'm4a', 'weba', 'wma', 'mid', 'wav', 'ra', 'ram');
$video = array('rm', 'rmvb', 'flv', 'swf', 'asf', 'asx', 'wmv', 'avi', 'mpg', 'mpeg', 'mp4', 'm4v', '3gp', 'ogv', 'webm', 'mov');
if (in_array($type, $audio)) {
return parseaudio($url, $width);
} else if (in_array($type, $video)) {
$randomid = random(3);
return '';
} else {
return ''.$url.'';
}
}
return;
}
function bbcodeurl($url, $tags) {
if(!preg_match("/<.+?>/s", $url)) {
if(!in_array(strtolower(substr($url, 0, 6)), array('http:/', 'https:', 'ftp://', 'rtsp:/', 'mms://')) && !preg_match('/^static\//', $url) && !preg_match('/^data\//', $url)) {
$url = 'http://'.$url;
}
return str_replace(array('submit', 'member.php?mod=logging'), array('', ''), str_replace('{url}', addslashes($url), $tags));
} else {
return ' '.$url;
}
}
function jammer() {
$randomstr = '';
for($i = 0; $i < mt_rand(5, 15); $i++) {
$randomstr .= chr(mt_rand(32, 59)).' '.chr(mt_rand(63, 126));
}
return mt_rand(0, 1) ? ''.$randomstr.''."\r\n" :
"\r\n".''.$randomstr.'';
}
function highlightword($text, $words, $prepend) {
$text = str_replace('\"', '"', $text);
foreach($words AS $key => $replaceword) {
$text = str_replace($replaceword, ''.$replaceword.'', $text);
}
return "$prepend$text";
}
function parseflv($url, $width = 0, $height = 0) {
global $_G;
$lowerurl = strtolower($url);
$flv = $iframe = $imgurl = '';
if(empty($_G['setting']['parseflv']) || !is_array($_G['setting']['parseflv'])) {
return FALSE;
}
foreach($_G['setting']['parseflv'] as $script => $checkurl) {
$check = FALSE;
foreach($checkurl as $row) {
if(strpos($lowerurl, $row) !== FALSE) {
$check = TRUE;
break;
}
}
if($check) {
@include_once libfile('media/'.$script, 'function');
if(function_exists('media_'.$script)) {
list($flv, $iframe, $url, $imgurl) = call_user_func('media_'.$script, $url, $width, $height);
}
break;
}
}
if($flv || $iframe) {
if(!$width && !$height) {
return array('flv' => $flv, 'iframe' => $iframe, 'imgurl' => $imgurl);
} else {
$width = addslashes($width);
$height = addslashes($height);
$flv = addslashes($flv);
$iframe = addslashes($iframe);
$randomid = 'flv_'.random(3);
$player_iframe = $iframe ? "\"\"" : '';
$player_flv = $flv ? "AC_FL_RunContent('width', '$width', 'height', '$height', 'allowNetworking', 'internal', 'allowScriptAccess', 'never', 'src', '$flv', 'quality', 'high', 'bgcolor', '#ffffff', 'wmode', 'transparent', 'allowfullscreen', 'true')" : '';
$player = (!empty($player_iframe) && !empty($player_flv)) ? "detectHtml5Support() ? $player_iframe : $player_flv" : (empty($player_iframe) ? $player_flv : $player_iframe);
return '';
}
} else {
return FALSE;
}
}
function parseimg($width, $height, $src, $lazyload, $pid, $extra = '') {
global $_G, $aimgs;
static $styleoutput = null;
if($_G['setting']['domainwhitelist_affectimg']) {
$tmp = parse_url($src);
if(!empty($tmp['host']) && !iswhitelist($tmp['host'])) {
return $src;
}
}
if(strstr($src, 'file:') || substr($src, 1, 1) == ':') {
return $src;
}
if($width > $_G['setting']['imagemaxwidth']) {
$height = intval($_G['setting']['imagemaxwidth'] * $height / $width);
$width = $_G['setting']['imagemaxwidth'];
if(defined('IN_MOBILE')) {
$extra = '';
} else {
$extra = 'onmouseover="img_onmouseoverfunc(this)" onclick="zoom(this)" style="cursor:pointer"';
}
}
$attrsrc = !IS_ROBOT && $lazyload ? 'file' : 'src';
$rimg_id = random(5);
$aimgs[$pid][] = $rimg_id;
$guestviewthumb = !empty($_G['setting']['guestviewthumb']['flag']) && empty($_G['uid']);
$img = '';
if($guestviewthumb) {
if(!isset($styleoutput)) {
$img .= guestviewthumbstyle();
$styleoutput = true;
}
$img .= '';
} else {
if(defined('IN_MOBILE')) {
$img = ' 0 ? ' width="'.$width.'"' : '').($height > 0 ? ' height="'.$height.'"' : '').' src="{url}" border="0" alt="" />';
} else {
$img = ' 0 ? ' width="'.$width.'"' : '').($height > 0 ? ' height="'.$height.'"' : '').' '.$attrsrc.'="{url}" '.($extra ? $extra.' ' : '').'border="0" alt="" />';
}
}
$code = bbcodeurl($src, $img);
if($guestviewthumb) {
$code = str_replace('{loginurl}', 'member.php?mod=logging&action=login', $code);
}
return $code;
}
function parsesmiles(&$message) {
global $_G;
static $enablesmiles;
if($enablesmiles === null) {
$enablesmiles = false;
if(!empty($_G['cache']['smilies']) && is_array($_G['cache']['smilies'])) {
foreach($_G['cache']['smilies']['replacearray'] AS $key => $smiley) {
$_G['cache']['smilies']['replacearray'][$key] = ' ';
}
$enablesmiles = true;
}
}
$enablesmiles && $message = preg_replace($_G['cache']['smilies']['searcharray'], $_G['cache']['smilies']['replacearray'], $message, $_G['setting']['maxsmilies']);
return $message;
}
function parsepostbg($bgimg, $pid) {
global $_G;
static $postbg;
if($postbg[$pid]) {
return '';
}
loadcache('postimg');
foreach($_G['cache']['postimg']['postbg'] as $postbg) {
if($postbg['url'] != $bgimg) {
continue;
}
$bgimg = dhtmlspecialchars(basename($bgimg), ENT_QUOTES);
$postbg[$pid] = true;
$_G['forum_posthtml']['header'][$pid] .= '';
break;
}
return '';
}
function parsepassword($password, $pid) {
global $_G;
static $postpw = array();
if($postpw[$pid]) {
return '';
}
$postpw[$pid] = true;
if(empty($_G['cookie']['postpw_'.$pid]) || $_G['cookie']['postpw_'.$pid] != md5($password)) {
$_G['forum_discuzcode']['passwordlock'][$pid] = 1;
}
return '';
}
function guestviewthumbstyle() {
static $styleoutput = null;
$return = '';
if ($styleoutput === null) {
global $_G;
$return = '';
$styleoutput = true;
}
return $return;
}
?> |