Показать сообщение отдельно

  #7  
Старый 26.07.2009, 08:22
PaCo
Постоянный
Регистрация: 06.02.2008
Сообщений: 494
Провел на форуме:
1754802

Репутация: 380
По умолчанию

Цитата:
Сообщение от Myload  
перезалил проверь
http://slil.ru/27859809
Да в прошлый раз файл был таки битый, вот после дезенда:
PHP код:
<?php
/*********************/
/*                   */
/*  Version : 5.1.0  */
/*  Author  : RM     */
/*  Comment : 071223 */
/*                   */
/*********************/

function parse_tpl$tpl$vars )
{
    
preg_match_all"|{{([0-9a-z_ ]*?)(\\(.*?\\))?}}|si"$tpl$matches );
    foreach ( 
$matches[1] as $i => $k )
    {
        if ( 
substr$k010 ) == "if_exists " )
        {
            if ( 
trim$vars[substr$k10 )] ) == "" )
            {
                
$tpl preg_replace"|{{".$k."}}.*?{{end ".$k."}}|si"""$tpl );
            }
            else
            {
                
$tpl str_replace"{{".$k."}}"""$tpl );
                
$tpl str_replace"{{end ".$k."}}"""$tpl );
            }
            unset( 
str_replace"{{end ".$k."}}"""$tpl )[$i] );
        }
        if ( 
substr$k014 ) == "if_not_exists " )
        {
            if ( 
trim$vars[substr$k14 )] ) != "" )
            {
                
$tpl preg_replace"|{{".$k."}}.*?{{end ".$k."}}|si"""$tpl );
            }
            else
            {
                
$tpl str_replace"{{".$k."}}"""$tpl );
                
$tpl str_replace"{{end ".$k."}}"""$tpl );
            }
            unset( 
str_replace"{{end ".$k."}}"""$tpl )[$i] );
        }
        if ( 
strpos$tpl"{{end ".$k."}}" ) && is_array$vars[$k] ) )
        {
            
$replace "";
            
$tpl1 substr$tplstrpos$tpl"{{".$k.$matches[2][$i]."}}" ) + strlen"{{".$k.$matches[2][$i]."}}" ), strpos$tpl"{{end ".$k."}}" ) - strpos$tpl"{{".$k.$matches[2][$i]."}}" ) - strlen"{{".$k.$matches[2][$i]."}}" ) );
            if ( 
trim$matches[2][$i] ) != "" )
            {
                
$params trim$matches[2][$i], "()" );
                
preg_match"|([0-9]*),(.*)|si"$params$matches1 );
                
$n = ( integer )$matches1[1];
                
$delimiter $matches1[2];
                
$delimiter trim$delimiter"\"'" );
            }
            
$cnt 0;
            
$cnt_all 0;
            foreach ( 
$vars[$k] as $v )
            {
                ++
$cnt_all;
                ++
$cnt;
                
$replace .= parse_tpl$tpl1$v );
                if ( !( 
$cnt == ( integer )$n ) && !( $cnt_all count$vars[$k] ) ) )
                {
                    
$replace .= $delimiter;
                    
$cnt 0;
                }
            }
            
$tpl str_replacesubstr$tplstrpos$tpl"{{".$k.$matches[2][$i]."}}" ), strpos$tpl"{{end ".$k."}}" ) + strlen"{{end ".$k."}}" ) - strpos$tpl"{{".$k.$matches[2][$i]."}}" ) ), $replace$tpl );
            unset( 
str_replacesubstr$tplstrpos$tpl"{{".$k.$matches[2][$i]."}}" ), strpos$tpl"{{end ".$k."}}" ) + strlen"{{end ".$k."}}" ) - strpos$tpl"{{".$k.$matches[2][$i]."}}" ) ), $replace$tpl )[$i] );
        }
        else if ( 
strpos$tpl"{{end ".$k."}}" ) )
        {
            
$tpl str_replacesubstr$tplstrpos$tpl"{{".$k.$matches[2][$i]."}}" ), strpos$tpl"{{end ".$k."}}" ) + strlen"{{end ".$k."}}" ) - strpos$tpl"{{".$k.$matches[2][$i]."}}" ) ), ""$tpl );
            unset( 
str_replacesubstr$tplstrpos$tpl"{{".$k.$matches[2][$i]."}}" ), strpos$tpl"{{end ".$k."}}" ) + strlen"{{end ".$k."}}" ) - strpos$tpl"{{".$k.$matches[2][$i]."}}" ) ), ""$tpl )[$i] );
        }
    }
    foreach ( 
$matches[1] as $i => $k )
    {
        if ( isset( 
$vars[$k] ) )
        {
            
$tpl str_replace"{{".$k.$matches[2][$i]."}}"$vars[$k], $tpl );
            unset( 
str_replace"{{".$k.$matches[2][$i]."}}"$vars[$k], $tpl )[$i] );
        }
    }
    return 
$tpl;
}

function 
show_main( )
{
    global 
$vars;
    global 
$_conf;
    
$tpl file_get_contents"tpl/main.htm" );
    
$copyright = @file_get_contents"http://www.flashscripts.org/copyright.php?mode=cat&catalog=".@urlencode$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI] ) );
    if ( 
strpos"_".$tpl"{{authors_link}}" ) )
    {
        
$tpl str_replace"{{authors_link}}"$copyright$tpl );
    }
    else if ( 
strpos"_".$tpl"</body>" ) )
    {
        
$tpl str_replace"</body>""<center>".$copyright."</center> </body>"$tpl );
    }
    else
    {
        
$tpl .= " <center>".$copyright."</center>";
    }
    
$tpl parse_tpl$tpl$vars );
    
$tpl preg_replace"|{{.*?}}|si"""$tpl );
    echo 
$tpl;
}

function 
check_backlink$backlink_url$code )
{
    
$url_arr parse_url$backlink_url );
    
$robot_meta false;
    
$site_zap false;
    
$dir_zap false;
    
$robots_txt = @file_get_contents"http://".$url_arr[host]."/robots.txt" );
    
$robots_txt_strings explode"\r\n"$robots_txt );
    foreach ( 
$robots_txt_strings as $line )
    {
        
$meta_rob = @get_meta_tags$backlink_url );
        if ( !
$meta_rob['robots'] && !ereg"NOFOLLOW"$meta_rob['robots'] ) || !ereg"NOINDEX"$meta_rob['robots'] ) )
        {
            continue;
        }
        
$robot_meta true;
        break;
    }
    
$fr explode"\r\n"$robots_txt );
    if ( 
count$fr ) )
    {
        foreach ( 
$fr as $stroka )
        {
            if ( 
preg_match"/Disallow:\\s*\\/\\s*\$/i"$stroka ) )
            {
                
$site_zap true;
            }
            
$ar explode"/"$url_arr[path] );
            
$i 0;
            while ( 
$i count$ar ) )
            {
                
$subdir $ar[$i];
                if ( 
preg_match"/Disallow:.*\\/".$subdir."/i"$stroka ) && $ar[$i] )
                {
                    
$dir_zap true;
                    
$sub_dir_error $subdir;
                }
                else
                {
                    ++
$i;
                }
            }
        }
    }
    if ( 
$robot_meta || $site_zap || $dir_zap )
    {
        return 
false;
    }
    if ( 
$fs = @fsockopen$url_arr[host], 80 ) )
    {
        
fputs$fs"GET ".( strlen$url_arr[path] ) ? $url_arr[path] : "/" ).( strlen$url_arr[query] ) ? "?".$url_arr[query] : "" ).( " HTTP/1.0\r\nHost: ".$url_arr[host]."\n\n" ) );
        
$page "";
        
$str "";
        while ( 
$str != "\r\n" && !feof$fs ) )
        {
            
$str fgets$fs2048 );
            
$page .= $str;
        }
        if ( 
< !strpos$page"200 OK" ) )
        {
            
fclose$fs );
            return 
false;
        }
        if ( 
strpos$page"html" ) )
        {
            
$page "";
            while ( !
feof$fs ) )
            {
                
$page .= fread$fs2048 );
            }
            
fclose$fs );
            
$page preg_replace"|<noindex[^>]*>.*?</noindex[^>]*>|si"""$page );
            
$page preg_replace"|<script[^>]*>.*?</script>|si"""$page );
            
$page preg_replace"|<!--.*?-->|si"""$page );
        }
        else
        {
            
fclose$fs );
            return 
false;
        }
    }
    else
    {
        return 
false;
    }
    if ( 
strpos"_".$page$code ) )
    {
        return 
true;
    }
    return 
false;
}

function 
is_picture$url )
{
    
$url_arr = @parse_url$url );
    
$host $url_arr[host];
    
$path $url_arr[path].( $url_arr[query] != "" "?".$url_arr[query] : "" );
    
$fp fsockopen$host80$a$b);
    if ( !
$fp )
    {
        return 
false;
    }
    
fputs$fp"GET ".$path." HTTP/1.0\r\nHost: {$host}\r\n\r\n" );
    
$page fread$fp1024 );
    
fclose$fp );
    if ( 
strpos$page"Content-Type: image" ) )
    {
        return 
true;
    }
    return 
false;
}

?>