Changeset 23821 for trunk/admin/include/languages.class.php
- Timestamp:
- Jul 7, 2013, 1:28:12 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/languages.class.php
r20449 r23821 113 113 pwg_query($query); 114 114 115 if (!$this->deltree(PHPWG_ROOT_PATH.'language/'.$language_id)) 116 { 117 $this->send_to_trash(PHPWG_ROOT_PATH.'language/'.$language_id); 118 } 115 deltree(PHPWG_ROOT_PATH.'language/'.$language_id, PHPWG_ROOT_PATH.'language/trash'); 119 116 break; 120 117 … … 382 379 elseif (is_dir($path)) 383 380 { 384 if (!$this->deltree($path)) 385 { 386 $this->send_to_trash($path); 387 } 381 deltree($path, PHPWG_ROOT_PATH.'language/trash'); 388 382 } 389 383 } … … 407 401 408 402 /** 409 * delete $path directory410 * @param string - path411 */412 function deltree($path)413 {414 if (is_dir($path))415 {416 $fh = opendir($path);417 while ($file = readdir($fh))418 {419 if ($file != '.' and $file != '..')420 {421 $pathfile = $path . '/' . $file;422 if (is_dir($pathfile))423 {424 $this->deltree($pathfile);425 }426 else427 {428 @unlink($pathfile);429 }430 }431 }432 closedir($fh);433 return @rmdir($path);434 }435 }436 437 /**438 * send $path to trash directory439 * @param string - path440 */441 function send_to_trash($path)442 {443 $trash_path = PHPWG_ROOT_PATH . 'language/trash';444 if (!is_dir($trash_path))445 {446 @mkdir($trash_path);447 $file = @fopen($trash_path . '/.htaccess', 'w');448 @fwrite($file, 'deny from all');449 @fclose($file);450 }451 while ($r = $trash_path . '/' . md5(uniqid(rand(), true)))452 {453 if (!is_dir($r))454 {455 @rename($path, $r);456 break;457 }458 }459 }460 461 /**462 403 * Sort functions 463 404 */
Note: See TracChangeset
for help on using the changeset viewer.