Changeset 23821 for trunk/admin/include/themes.class.php
- Timestamp:
- Jul 7, 2013, 1:28:12 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/themes.class.php
r23248 r23821 222 222 } 223 223 224 if (!$this->deltree(PHPWG_THEMES_PATH.$theme_id)) 225 { 226 $this->send_to_trash(PHPWG_THEMES_PATH.$theme_id); 227 } 224 deltree(PHPWG_THEMES_PATH.$theme_id, PHPWG_THEMES_PATH . 'trash'); 228 225 break; 229 226 … … 642 639 elseif (is_dir($path)) 643 640 { 644 if (!$this->deltree($path)) 645 { 646 $this->send_to_trash($path); 647 } 641 deltree($path, PHPWG_THEMES_PATH . 'trash'); 648 642 } 649 643 } … … 665 659 666 660 /** 667 * delete $path directory668 * @param string - path669 */670 function deltree($path)671 {672 if (is_dir($path))673 {674 $fh = opendir($path);675 while ($file = readdir($fh))676 {677 if ($file != '.' and $file != '..')678 {679 $pathfile = $path . '/' . $file;680 if (is_dir($pathfile))681 {682 $this->deltree($pathfile);683 }684 else685 {686 @unlink($pathfile);687 }688 }689 }690 closedir($fh);691 return @rmdir($path);692 }693 }694 695 /**696 * send $path to trash directory697 * @param string - path698 */699 function send_to_trash($path)700 {701 $trash_path = PHPWG_THEMES_PATH . 'trash';702 if (!is_dir($trash_path))703 {704 @mkdir($trash_path);705 $file = @fopen($trash_path . '/.htaccess', 'w');706 @fwrite($file, 'deny from all');707 @fclose($file);708 }709 while ($r = $trash_path . '/' . md5(uniqid(rand(), true)))710 {711 if (!is_dir($r))712 {713 @rename($path, $r);714 break;715 }716 }717 }718 719 /**720 661 * Sort functions 721 662 */
Note: See TracChangeset
for help on using the changeset viewer.