Просмотр файла sys/fnc/k_files.php

Размер файла: 763B
  1. <?
  2. function k_files($dir=null)
  3. {
  4. global $set;
  5. if ($dir!=null){
  6. $path=(function_exists('iconv'))?iconv('windows-1251', 'utf-8', $dir):$dir;
  7. $path='/'.preg_replace('#^/+|/+$#i', null, $path).'/';
  8. $all= mysql_result(mysql_query("SELECT COUNT(*) FROM `loads_list` WHERE `path` LIKE '".my_esc($path)."%'"),0);
  9. $new= mysql_result(mysql_query("SELECT COUNT(*) FROM `loads_list` WHERE `path` LIKE '".my_esc($path)."%' AND `time` > '".(time()-60*60*$set['loads_new_file_hour'])."'"),0);
  10. }
  11. else
  12. {
  13. $all= mysql_result(mysql_query("SELECT COUNT(*) FROM `loads_list`"),0);
  14. $new= mysql_result(mysql_query("SELECT COUNT(*) FROM `loads_list` WHERE `time` > '".(time()-60*60*$set['loads_new_file_hour'])."'"),0);
  15. }
  16.  
  17. return ($new==0)?$all:"$all/<span class='new'>+$new</span>";
  18. }
  19. ?>