Guest User

Untitled

a guest
Oct 17th, 2024
44
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. <?php
  2.  
  3. defined('_VALID') or die('Restricted Access!');
  4.  
  5.  
  6.  
  7. function get_thumb_url($vid)
  8.  
  9. {
  10.  
  11. global $config;
  12.  
  13.  
  14.  
  15. $index = intval( ($vid - 1) / $config['max_thumb_folders'] );
  16.  
  17. $tmb_folder = 'tmb';
  18.  
  19. if ($index !== 0) {
  20.  
  21. $tmb_folder = 'tmb'.$index;
  22.  
  23. }
  24.  
  25.  
  26.  
  27. $output = $config['BASE_URL'].'/media/videos/'.$tmb_folder.'/'.$vid;
  28.  
  29.  
  30.  
  31. return $output;
  32.  
  33. }
  34.  
  35.  
  36.  
  37. function get_thumb_dir($vid)
  38.  
  39. {
  40.  
  41. global $config;
  42.  
  43.  
  44.  
  45. $index = intval( ($vid - 1) / $config['max_thumb_folders'] );
  46.  
  47. $tmb_folder = 'tmb';
  48.  
  49. if ($index !== 0) {
  50.  
  51. $tmb_folder = 'tmb'.$index;
  52.  
  53. }
  54.  
  55. $path = $config['BASE_DIR'].'/media/videos/'.$tmb_folder;
  56.  
  57.  
  58.  
  59. if (!file_exists($path)) {
  60.  
  61. mkdir($path, 0777, true);
  62.  
  63. }
  64.  
  65.  
  66.  
  67. $output = $path.'/'.$vid;
  68.  
  69.  
  70.  
  71. return $output;
  72.  
  73. }
  74.  
  75.  
  76.  
  77. function delete_directory($dirname) {
  78.  
  79. if (is_dir($dirname))
  80.  
  81. $dir_handle = opendir($dirname);
  82.  
  83. if (!$dir_handle)
  84.  
  85. return false;
  86.  
  87. while($file = readdir($dir_handle)) {
  88.  
  89. if ($file != "." && $file != "..") {
  90.  
  91. if (!is_dir($dirname."/".$file))
  92.  
  93. unlink($dirname."/".$file);
  94.  
  95. else
  96.  
  97. delete_directory($dirname.'/'.$file);
  98.  
  99. }
  100.  
  101. }
  102.  
  103. closedir($dir_handle);
  104.  
  105. rmdir($dirname);
  106.  
  107. return true;
  108.  
  109. }
  110.  
  111.  
  112.  
  113. ?>
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment