Файл: include/function_thumbs.php
Строк: 40
<?php
defined('_VALID') or die('Restricted Access!');
function get_thumb_url($vid)
{
global $config;
$index = intval( ($vid - 1) / $config['max_thumb_folders'] );
$tmb_folder = 'tmb';
if ($index !== 0) {
$tmb_folder = 'tmb'.$index;
}
$output = $config['BASE_URL'].'/media/videos/'.$tmb_folder.'/'.$vid;
return $output;
}
function get_thumb_dir($vid)
{
global $config;
$index = intval( ($vid - 1) / $config['max_thumb_folders'] );
$tmb_folder = 'tmb';
if ($index !== 0) {
$tmb_folder = 'tmb'.$index;
}
$path = $config['BASE_DIR'].'/media/videos/'.$tmb_folder;
if (!file_exists($path)) {
mkdir($path, 0777, true);
}
$output = $path.'/'.$vid;
return $output;
}
function delete_directory($dirname) {
if (is_dir($dirname))
$dir_handle = opendir($dirname);
if (!$dir_handle)
return false;
while($file = readdir($dir_handle)) {
if ($file != "." && $file != "..") {
if (!is_dir($dirname."/".$file))
unlink($dirname."/".$file);
else
delete_directory($dirname.'/'.$file);
}
}
closedir($dir_handle);
rmdir($dirname);
return true;
}
?>