| lt;?$count_smiles = 3;/** * Замена по ограничению * @return (string) * By TLENS 26.09.2011 */function my_replace($var1, $var2, $str, $count = 0){ if ($count <= 0) { return str_replace($var1, $var2, $str); } $arr = explode($var1, $str); $c = sizeof($arr); if ($c <= $count) { return str_replace($var1, $var2, $str); } $result = (string)''; for ($i = 0; $i<$c; $i++) { if ($i < $count) { $result .= $arr[$i] . $var2; } else { $result .= $arr[$i] . ((($i + 1) < $c) ? $var1 : ''); } } return $result;}//-------------------------------------//function smiles($msg){ global $db, $set,$user, $count_smiles; $f_smiles=file(H."smiles/smiles.txt"); for ($i=0;$i<count($f_smiles);$i++) { $str_sm=explode(' ',trim($f_smiles[$i])); $str_sm2=''; for ($z=1;$z<count($str_sm);$z++) { if ($z>1){$str_sm2.=' ';} $str_sm2.=$str_sm[$z]; } $str_sm2=explode(',',$str_sm2); for ($i2=0;$i2<count($str_sm2);$i2++) { $str_sm2[$i2]=stripcslashes(htmlspecialchars($str_sm2[$i2])); $msg=str_replace("$str_sm2[$i2]", "<img src=\"/smiles/$str_sm[0].gif\" alt=\"\" />", $msg); } } $q=mysql_query("SELECT * FROM `user_smiles_spis`"); //Личные смайлы while($post = mysql_fetch_array($q)){ $msg = str_replace($post['sim'], '<a><img src="/smiles/usersmiles/'.$post['name'].'.gif" alt="'.$post['name'].'"/></a>', $msg); } if ($user['level']>3){ $f_smiles=file(H."smiles/smiles_mod.txt"); for ($i=0;$i<count($f_smiles);$i++) { $str_sm=explode(' ',trim($f_smiles[$i])); $str_sm2=''; for ($z=1;$z<count($str_sm);$z++) { if ($z>1){$str_sm2.=' ';} $str_sm2.=$str_sm[$z]; } $str_sm2=explode(',',$str_sm2); for ($i2=0;$i2<count($str_sm2);$i2++) { $str_sm2[$i2]=stripcslashes(htmlspecialchars($str_sm2[$i2])); $msg=my_replace("$str_sm2[$i2]", "<img src=\"/smiles/$str_sm[0].gif\" alt=\"\" />", $msg, $count_smiles); } }} return $msg;}function links_preg1($arr){return '<a href="'.$arr[1].'">'.$arr[2].'</a>';}function links_preg2($arr){return $arr[1].'<a href="'.$arr[2].'">'.$arr[2].'</a>'.$arr[4];}function links($msg){$msg=preg_replace_callback('~\[url=([^ \r\n\t`\'"]+)\](.*?)\[/url\]~iu', 'links_preg1', $msg);$msg=preg_replace_callback('~(^|\s)([a-z]+://([^ \r\n\t`\'"]+))(\s|$)~iu', 'links_preg2', $msg);return $msg;}$versiya = '4.0';function bbcodehightlight($arr){$arr[0]=html_entity_decode($arr[0], ENT_QUOTES, 'UTF-8');$arr[0]=preg_replace('#<img src="(.*?)" alt="(.*?)" />#sui', '\\2', $arr[0]);return '<div class="" style="overflow:scroll;clip:auto;max-width:480px;">'.preg_replace('#<code>(.*?)</code>#si', '\\1' ,highlight_string($arr[0],1)).'</div>'."\n";}function BBcode($msg){$msg=preg_replace('#\[b\](.*?)\[/b\]#si', '<span style="font-weight: bold;">\1</span>', $msg);$msg=preg_replace('#\[i\](.*?)\[/i\]#si', '<span style="font-style: italic;">\1</span>', $msg);$msg=preg_replace('#\[u\](.*?)\[/u\]#si', '<span style="text-decoration: underline;">\1</span>', $msg);$msg=preg_replace('#\[b\](.*?)\[/b\]#si', '<span style="font-weight: bold;">\1</span>', $msg);$msg=preg_replace('#\[i\](.*?)\[/i\]#si', '<span style="font-style: italic;">\1</span>', $msg);$msg=preg_replace('#\[q\](.*?)\[/q\]#si', '<span style="text-decoration: underline;">\1</span>', $msg);$msg=preg_replace('#\[del\](.*?)\[/del\]#si', '<del>\1</del>', $msg);$msg=preg_replace('#\[small\](.*?)\[/small\]#si', '<span style="font-size: small;">\1</span>', $msg);$msg=preg_replace('#\[big\](.*?)\[/big\]#si', '<span style="font-size: large;">\1</span>', $msg);$msg=preg_replace('#\[blink\](.*?)\[/blink\]#si', '<blink>\1</blink>', $msg);$msg=preg_replace('#\[red\](.*?)\[/red\]#si', '<span style="color:#FF0000;">\1</span>', $msg);$msg=preg_replace('#\[green\](.*?)\[/green\]#si', '<span style="color:#00FF00;">\1</span>', $msg);$msg=preg_replace('#\[blue\](.*?)\[/blue\]#si', '<span style="color:#0000FF;">\1</span>', $msg);$msg=preg_replace('#\[yellow\](.*?)\[/yellow\]#si', '<span style="color:#ffff22;">\1</span>', $msg);$msg=preg_replace('#\[fea\](.*?)\[/fea\]#si', '<span style="color:#FF00FF;">\1</span>', $msg);return $msg;}define('vb12', true);function br($msg,$br='<br />'){$msg=eregi_replace("((<br( ?/?)>)|\n|\r)+",$br, $msg);return $msg;}function page2($page2){$page2=str_replace('</body>','<div align="center"><small><a href="http://masteram.us">© -=ШАХТЕР=-</a></small></div></body>',$page2);$page2=str_replace('</card>','<div align="center"><small><a href="http://masteram.us">© -=ШАХТЕР=-</a></small></div></card>',$page2);return $page2;}if ((eregi('^/enter\.php',$_SERVER['SCRIPT_NAME']))||(eregi('^/index\.php',$_SERVER['SCRIPT_NAME']))){ob_start(page2);define('set2.0', true);}else if ((eregi('^'.dirname($_SERVER['PHP_SELF']).'/enter\.php',$_SERVER['SCRIPT_NAME']))||(eregi('^'.dirname($_SERVER['PHP_SELF']).'/index\.php',$_SERVER['SCRIPT_NAME']))){ob_start(page2);}function esc($text,$br=NULL){if ($br!=NULL)for ($i=0;$i<=31;$i++)$text=str_replace(chr($i), NULL, $text);else{for ($i=0;$i<10;$i++)$text=str_replace(chr($i), NULL, $text);for ($i=11;$i<20;$i++)$text=str_replace(chr($i), NULL, $text);for ($i=21;$i<=31;$i++)$text=str_replace(chr($i), NULL, $text);}return $text;}function text($str,$br=true,$html=true,$smiles=true,$links=true,$bbcode=true){if ($html==true)if ($smiles==true)$str=smiles($str);if ($links==true)$str=links($str);if ($bbcode==true)$str=bbcode($str);if ($br==true){$str=br($str);$str=esc($str);}else{$str=esc($str);}return $str;}function color_msg($text){global $db, $set,$user, $msg;if ($msg['color']==1)$text = '[red]'.$msg['msg'].'[/red]';elseif ($msg['color']==2)$text = '[blue]'.$msg['msg'].'[/blue]';elseif ($msg['color']==3)$text = '[fea]'.$msg['msg'].'[/fea]';elseif ($msg['color']==4)$text = '[green]'.$msg['msg'].'[/green]';return $text;}function bb_msg($text){global $db, $set,$user, $msg;if ($msg['bb']==1)$text = '[i]'.$text.'[/i]';elseif ($msg['bb']==2)$text = '[u]'.$text.'[/u]';elseif ($msg['bb']==3)$text = '[i][u]'.$text.'[/u][/i]';elseif ($msg['bb']==4)$text = '[b]'.$text.'[/b]';elseif ($msg['bb']==5)$text = '[i][b]'.$text.'[/b][/i]';elseif ($msg['bb']==6)$text = '[big]'.$text.'[/big]';return $text;}function emo_msg($text){global $db, $set,$user, $msg;if ($msg['emo']==1) $text = '[Радостно] '.$text;elseif ($msg['emo']==2) $text = '[Печально] '.$text;elseif ($msg['emo']==3) $text = '[Удивленно] '.$text;elseif ($msg['emo']==4) $text = '[Ласково] '.$text;elseif ($msg['emo']==5) $text = '[Смущенно] '.$text;elseif ($msg['emo']==6) $text = '[Кокетливо] '.$text;elseif ($msg['emo']==7) $text = '[Обиженно] '.$text;elseif ($msg['emo']==8) $text = '[Настойчиво] '.$text;elseif ($msg['emo']==9) $text = '[Шепотом] '.$text;elseif ($msg['emo']==10) $text = '[Задумчиво] '.$text;elseif ($msg['emo']==11) $text = '[Злобно] '.$text;return $text;}function antir($msg){global $db, $set,$user;$msg = str_replace("((http://))((([a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z;]{2,3}))|(([0-9]{1,3}\.){3}([0-9]{1,3})))((/|\?)[a-z0-9~#%&'_\+=:;\?\.-]*)*)", "".$set['antir']."", $msg);$msg=str_replace(".wab.","".$set['antir']."",$msg);$msg=str_replace(".com","".$set['antir']."",$msg);$msg=str_replace(".net","".$set['antir']."",$msg);$msg=str_replace(".org","".$set['antir']."",$msg);$msg=str_replace(".kz","".$set['antir']."",$msg);$msg=str_replace(".ua","".$set['antir']."",$msg);$msg=str_replace(".ru","".$set['antir']."",$msg);$msg=str_replace(",ru","".$set['antir']."",$msg);$msg=str_replace("-ru","".$set['antir']."",$msg);$msg=str_replace("-ru","".$set['antir']."",$msg);$msg=str_replace("_ru","".$set['antir']."",$msg);$msg=str_replace("-net","".$set['antir']."",$msg);$msg=str_replace(",net","".$set['antir']."",$msg);$msg=str_replace("-su","".$set['antir']."",$msg);$msg=str_replace("_su","".$set['antir']."",$msg);$msg=str_replace(".su","".$set['antir']."",$msg);$msg=str_replace(",su","".$set['antir']."",$msg);$msg=str_replace("-mobi","".$set['antir']."",$msg);$msg=str_replace("_mobi","".$set['antir']."",$msg);$msg=str_replace(".mobi","".$set['antir']."",$msg);$msg=str_replace(",mobi","".$set['antir']."",$msg);$msg=str_replace("-info","".$set['antir']."",$msg);$msg=str_replace("_info","".$set['antir']."",$msg);$msg=str_replace(".info","".$set['antir']."",$msg);$msg=str_replace(",info","".$set['antir']."",$msg);$msg=str_replace("-com","".$set['antir']."",$msg);$msg=str_replace("_com","".$set['antir']."",$msg);$msg=str_replace(".com","".$set['antir']."",$msg);$msg=str_replace(",com","".$set['antir']."",$msg);$msg=str_replace("-msk","".$set['antir']."",$msg);$msg=str_replace("_msk","".$set['antir']."",$msg);$msg=str_replace(".msk","".$set['antir']."",$msg);$msg=str_replace(",msk","".$set['antir']."",$msg);$msg=str_replace("-tk","".$set['antir']."",$msg);$msg=str_replace("_tk","".$set['antir']."",$msg);$msg=str_replace(".tk","".$set['antir']."",$msg);$msg=str_replace(",tk","".$set['antir']."",$msg);$msg=str_replace(".in","".$set['antir']."",$msg);$msg=str_replace("-cn","".$set['antir']."",$msg);$msg=str_replace("_cn","".$set['antir']."",$msg);$msg=str_replace(".cn","".$set['antir']."",$msg);$msg=str_replace(",cn","".$set['antir']."",$msg);$msg=str_replace("-biz","".$set['antir']."",$msg);$msg=str_replace("_biz","".$set['antir']."",$msg);$msg=str_replace(".biz","".$set['antir']."",$msg);$msg=str_replace(",biz","".$set['antir']."",$msg);$msg=str_replace("-h2m","".$set['antir']."",$msg);$msg=str_replace("_h2m","".$set['antir']."",$msg);$msg=str_replace(".h2m","".$set['antir']."",$msg);$msg=str_replace(",h2m","".$set['antir']."",$msg);$msg=str_replace("-wen","".$set['antir']."",$msg);$msg=str_replace("_wen","".$set['antir']."",$msg);$msg=str_replace(".wen","".$set['antir']."",$msg);$msg=str_replace(",wen","".$set['antir']."",$msg);$msg=str_replace("-ua","".$set['antir']."",$msg);$msg=str_replace("_ua","".$set['antir']."",$msg);$msg=str_replace(".ua","".$set['antir']."",$msg);$msg=str_replace(",ua","".$set['antir']."",$msg);return $msg;}function antim($text){$text=strtr($text,array('сука'=>'***','блядь'=>'***','блядь'=>'***','хуй'=>'***','пизда'=>'***','сучка'=>'***','пидор'=>'***','пидар'=>'***','пидор'=>'***','пидрила'=>'***','чмо'=>'***','ебать'=>'***','бля'=>'***'));return $text;}function url_replace($m) {if( !isset($m[3]) ) {return '<a href="' . $m[1] . '">' . $m[2] . '</a>';} else {return '<a href="' . $m[3] . '">' . $m[3] . '</a>';}}function img_replace($m) {if( !isset($m[3]) ) {return '<img src="' . $m[1] . '" alt="' . $m[2] . '">';} else {return '<img src="' . $m[3] . '" alt="' . $m[3] . '">';}}//------------------ Функция вставки BB-кода --------------------//function bb2($text){$text = preg_replace_callback('~\\[link=(http://.+?)\\](.+?)\\[/link\\]|(http://(www.)?[0-9a-z\.-]+\.[0-9a-z]{2,6}[0-9a-zA-Z/\?\.\~&_=/%-:#]*)~', 'url_replace', $text);$text = preg_replace_callback('~\\[imgs=(.+?)\\](.+?)\\[/imgs\\]|((www.)?[0-9a-z\.-]+\.[0-9a-z]{2,6}[0-9a-zA-Z/\?\.\~&_=/%-:#]*)~', 'img_replace', $text);return $text;}?> |
|