Location: PHPKode > scripts > IZI Filemanager > izi-filemanager/includes/functions.php
<?

function smarty_htmlspecialchars($html) {
  
  return htmlspecialchars($html, ENT_QUOTES);
}

function recursive_delete ($directory) {
  
  GLOBAL $base_dir;
  GLOBAL $dircounter;
  GLOBAL $filecounter;
  GLOBAL $report;
  
  if (!ereg("/$", $directory)) $directory .= "/";
  $delete = new fileman ($base_dir, $directory);
  foreach($delete->directories as $dir) {
    recursive_delete($directory . $dir->name);   
    $report .= "Diving into directory " . htmlspecialchars($directory) . htmlspecialchars($dir->name) . "<br>\n";
    $dircounter++;
    @rmdir($base_dir . $directory . $dir->name);
   $report .= "Removed directory " . htmlspecialchars($directory) . htmlspecialchars($dir->name) . "<br>\n";
  }
  foreach($delete->files as $fn) {
    $report .= "Deleted file " . htmlspecialchars($directory) . htmlspecialchars($fn->name) . "<br>\n";
    @unlink($base_dir . $directory . $fn->name);
    $filecounter++;
  }
  @rmdir($base_dir . $directory);
  $dircounter++;
  $report .= "Removed directory " . htmlspecialchars($directory) . "<br>\n";
}

function dec2hex($number, $length) {
  
  $hexval="";
  while ($number>0) {
    $remainder=$number%16;
    if ($remainder<10)
      $hexval=$remainder.$hexval;
    elseif ($remainder==10)
      $hexval="a".$hexval;
    elseif ($remainder==11)
      $hexval="b".$hexval;
    elseif ($remainder==12)
      $hexval="c".$hexval;
    elseif ($remainder==13)
      $hexval="d".$hexval;
    elseif ($remainder==14)
      $hexval="e".$hexval;
    elseif ($remainder==15)
      $hexval="f".$hexval;
   $number=floor($number/16);
  }
  while (strlen($hexval)<$length) $hexval="0".$hexval; 
  return $hexval;
}

function get_skins() {
  
  $i = 0;
  $template_dir = new fileman("templates", "/");
  foreach ($template_dir->directories as $skin_dir) {
    if (is_file("./templates/" . $skin_dir->name . "/skin_name.txt")) {
      $fp = fopen("templates/" . $skin_dir->name . "/skin_name.txt", "r");
      $skin_name = fread($fp, filesize("templates/" . $skin_dir->name . "/skin_name.txt"));
      $skin_name = htmlspecialchars($skin_name, ENT_QUOTES);
      $return_array[$i]['name'] = $skin_name;
      $return_array[$i]['id']   = $skin_dir->name; 
      $i++;
    }
  }
  return $return_array;
}
?>
Return current item: IZI Filemanager