include ("db/als_setting.dat");
include ("db/news_set.dat");
include ("lang/$lang.php");
$set = $_GET['set'];
$mc = $_GET['mc'];
$cm = $_GET['cm'];
$page = $_GET['page'];
$id = $_GET['id'];
$do = $_GET['do'];
if (empty($set))
{
$set = $glav_module;
if (ereg("&mc=",$glav_module))
{
$q = explode("&",$glav_module);
$set = $q[0];
$mc = str_replace("mc=","",$q[1]);
}
}
$loader="<img src='images/loading.gif' border=0 title='Автоматическое перенаправление...'><script language='Javascript'>function reload() {location = \"als_design.php\"}; setTimeout('reload()', 2400);</script>";
$als_set="<?php
\$maxname = \"".$_POST["maxname"]."\";
\$maxmail = \"".$_POST["maxmail"]."\";
\$maxmsgt = \"".$_POST["maxmsgt"]."\";
\$maxkey = \"".$_POST["antispam"]."\";
\$mailref = \"".$_POST["mailref"]."\";
\$c_image = \"".$_POST["c_image"]."\";
\$c_dd = \"".$_POST["c_dd"]."\";
\$c_ht = \"".$_POST["c_ht"]."\";
\$c_hs = \"".$_POST["c_hs"]."\";
\$_a['ngbinvert'] = \"".$_POST["ngbinvert"]."\";
\$_a['ngbpp'] = \"".$_POST["ngbpp"]."\";
\$name_tpl = \"".$_POST["tpls"]."\";
\$_a['anons'] = \"".$_POST["anons"]."\";
\$_a['lgbinvert'] = \"".$_POST["lgbinvert"]."\";
\$_a['lgbpp'] = \"".$_POST["lgbpp"]."\";
?>";
function deltree($folder){
if (is_dir($folder)){
$handle = opendir($folder);
while ($subfile = readdir($handle)){
if ($subfile == '.'or $subfile == '..') continue;
if (is_file($subfile)) unlink("{$folder}/{$subfile}");
else deltree("{$folder}/{$subfile}");
}
closedir($handle);
rmdir ($folder);
}
else unlink($folder);
}
function lisense_key($d) {
$d = ($_SERVER['HTTP_HOST']);
$d = str_replace ("www.","",$d);
$sv=strtoupper(md5(md5($d)));
return substr($sv,27,1).substr($sv,26,1).substr($sv,4,1).'-'.substr($sv,15,4).substr($sv,24,1).'-'.substr($sv,1,2).substr($sv,8,3).'-'.substr($sv,3,5).'-'.substr($sv,25,3).substr($sv,2,2);
}
function rfile($url) {
$f = @fopen($url,"r");
$content = @fread($f,filesize($url));
fclose($f);
return $content;
}
function alias_exist($a) {
$f = file("../set/db/menu.dat");
foreach ($f as $v)
{
$e = explode("::",$v);
$alias[] = $e[1];
}
if(in_array($a,$alias)) return true;
else return false;}
function alias_exist_ed($a) {
global $f;
$f = file("../set/db/menu.dat");
foreach ($f as $v) {
$e = explode("::",$v);
$alias[] = $e[1];
$ids[$e[1]] = $e[0];
}
if(in_array($a,$alias) &&$ids[$a]!=$_POST['id']) return true;
else return false;
}
function pins_gen($n) {
for($i=0;$i<$n;$i++) {
$_p = md5(time().rand().$i);
$pins[] = strtoupper(substr($_p,0,5).'-'.substr($_p,5,5).'-'.substr($_p,10,5).'-'.substr($_p,15,5));
}
return $pins;
}
function sh_sbm($msg,$title) {
print"<html><title>$title</title><HEAD<META content='text/html; charset=windows-1251' http-equiv=Content-Type><STYLE> a {color:#307DBC} body {font-size:12; font-family: tahoma;}</STYLE></HEAD><body><center>$msg<br></body></html>";
return true;}
function tree($elements,$parent,$ots,$count){
for($j = 0;$j <$count;$j++){
if( trim($elements[$j][3]) == $parent ){
echo('<option value="'.$elements[$j][0].'">'.$ots.trim($elements[$j][2]).'</option>');
tree($elements,$elements[$j][0],$ots."<b>. . </b>",$count);}}}
function tree_ed($elements,$parent,$ots,$count,$selected){
for($j = 0;$j <$count;$j++) {
if( trim($elements[$j][3]) == $parent ){
if ( trim($elements[$j][0]) == $selected )
echo('<option value="'.$elements[$j][0].'" selected>'.$ots.trim($elements[$j][2]).'</option>');
else echo('<option value="'.$elements[$j][0].'">'.$ots.trim($elements[$j][2]).'</option>');
tree_ed($elements,$elements[$j][0],$ots." ",$count,$selected);}}}
if (!function_exists('file_put_contents'))
{
function file_put_contents ($filename,$content){
if ($fp = @fopen($filename,'w'))
{
$result = fwrite($fp,$content);
fclose ($fp);
return $result;}
else{
return false;
}}}
function get_full_path($id,$array,$path){
global $t;
if ($id != 0) {
foreach ($array as $e) {
$elem = explode ('::',trim($e));
if ($id == $elem[0]) {
$path = " <img src='tpl/defalt/images/img10.gif' border=0> <a href='".$elem[1].".html'>".$elem[2]."</a>".$path ;
get_full_path($elem[3],$array,$path);
}
}
}else $t = $path;
}
function addSpace($num) {$strlen=17-strlen($num);$space=null;while($strlen) {$space.=" ";$strlen--;}return $space.$num;}
function read_file($path)
{if(!is_file($path))return false;
elseif(!filesize($path))return array();
elseif($array=file($path))return $array;
else while(!$array=file($path))sleep(1);
return $array;}
function normal_numeric($number)
{if(!isset($number))return false;
else{$strlen=strlen($number);
$new=null;
for ($i=$strlen-1;$i>-1;$i--)
{$n = $i;$n++;if(strstr($n/3,"."))$new.=$number[$strlen-1-$i];
else if($n!=$strlen)$new.= " ".$number[$strlen-1-$i];
else$new.=$number[$strlen-1-$i];}
return $new;}}
class Count_kw{
var $origin_arr;
var $modif_arr;
var $min_word_length = 3;
function explode_str_on_words($text)
{
$search = array ("'<script[^>]*?>.*?</script>'si","'<[\/\!]*?[^<>]*?>'si","'([\r\n])[\s]+'","'&(quot|#34);'i","'&(amp|#38);'i","'&(lt|#60);'i","'&(gt|#62);'i","'&(nbsp|#160);'i","'&(iexcl|#161);'i","'&(cent|#162);'i","'&(pound|#163);'i","'&(copy|#169);'i","'ё'","'&#(\d+);'e");
$replace = array ("е"," "," ","\\1 ","\" "," "," "," "," ",chr(161),chr(162),chr(163),chr(169),"chr(\\1)");
$text = preg_replace ($search,$replace,$text);
$del_symbols = array(
",",".",";",":","\"","#","\$","%","^","!","@","`","~","*","-","=","+","\\","|","/",">","<","(",")","&","?","№","\t","\r","\n","{","}","[","]","'","“","”","•","как","для","что","или","это","этих","всех","вас","они","оно","еще","когда","где","эта","лишь","уже","вам","нет","если","надо","все","так","его","чем","при","даже","мне","есть","раз","два","если","порно","секс","сама","сам","том","ему","изза","0","1","2","3","4","5","6","7","8","9"
);
$text = str_replace($del_symbols,array(" "),$text);
$text = ereg_replace("( +)"," ",$text);
$this->origin_arr = explode(" ",trim($text));
return $this->origin_arr;}
function count_words(){
$tmp_arr = array();
foreach ($this->origin_arr as $val){
if (strlen($val)>=$this->min_word_length){
$val = strtolower($val);
if (array_key_exists($val,$tmp_arr)){
$tmp_arr[$val]++;}
else{
$tmp_arr[$val] = 1;}}}
arsort ($tmp_arr);
$this->modif_arr = $tmp_arr;}
function get_keywords($text){
$ckwr ="12";
$this->explode_str_on_words($text);
$this->count_words();
$arr = array_slice($this->modif_arr,0,$ckwr);
$str = "";
foreach ($arr as $key=>$val){
$str .= $key .", ";}
return trim(substr($str,0,strlen($str)-2));
}
}