Вход Регистрация
Файл: filters/f_filelink/filter.php
Строк: 42
<?php
/******************************************************************************/
//                                                                            //
//                             InstantCMS v1.10                               //
//                        http://www.instantcms.ru/                           //
//                                                                            //
//                   written by InstantCMS Team, 2007-2012                    //
//                produced by InstantSoft, (www.instantsoft.ru)               //
//                                                                            //
//                        LICENSED BY GNU/GPL v2                              //
//                                                                            //
/******************************************************************************/

    
function getDownLoadLink($file){

        
$file     preg_replace('/.+//'''trim($file));
        
$filefull htmlspecialchars(PATH.$file);

        if (
file_exists($filefull)){

            
$downloaded cmsCore::fileDownloadCount($file);
        
            
$filesize round(filesize($filefull)/10242);            

            
$link '<table border="0" cellpadding="2" cellspacing="0"><tr>';        
                
$link .= '<td width="16"><img src="/images/icons/download.gif" border="0"</td>';
                
$link .= '<td width=""><a href="/load/url='.$file.'" alt="Скачать">'.basename($file).'</a></td>';
                
$link .= '<td width="">| '.$filesize.' Kб</td>';
                
$link .= '<td width="">| Скачан: '.cmsCore::spellCount($downloaded'раз''раза''раз').'</td>';
            
$link .= '</tr></table>';

        } else {
            
$link 'Файл "'.$file.'" не найден!';
        }    

        return 
$link;

    }

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
function f_filelink(&$text){

        
//REPLACE FILE DOWNLOAD LINKS
         
$regex '/{(СКАЧАТЬ=)s*(.*?)}/i';
        
$matches = array();
        
preg_match_all$regex$text$matchesPREG_SET_ORDER );        
        foreach (
$matches as $elm) {    
            
$elm[0] = str_replace('{'''$elm[0]);
            
$elm[0] = str_replace('}'''$elm[0]);            
            
mb_parse_str$elm[0], $args );
            
$file=@$args['СКАЧАТЬ'];    
            if (
$file){        
                
$output getDownLoadLink($file);            
            } else { 
$output ''; }
            
$text str_replace('{СКАЧАТЬ='.$file.'}'$output$text );    
        }

        return 
true;
    }
?>
Онлайн: 1
Реклама