Revision 1484
Added by Dietmar over 13 years ago
functions.php | ||
---|---|---|
707 | 707 |
{ |
708 | 708 |
global $admin, $MESSAGE; |
709 | 709 |
$retVal = array(); |
710 |
if( ($sAbsDir=='') || ($sAbsDir == WB_PATH) ) { return $retVal;} |
|
710 |
$wb_path = rtrim(str_replace('\/\\', '/', WB_PATH), '/'); |
|
711 |
if( ($sAbsDir=='') || ($sAbsDir == $wb_path) ) { return $retVal;} |
|
711 | 712 |
|
712 | 713 |
if ( $make_dir==true ) { |
713 | 714 |
// Check to see if the folder already exists |
... | ... | |
727 | 728 |
{ |
728 | 729 |
// if(file_exists($sAbsDir.'/index.php')) { unlink($sAbsDir.'/index.php'); } |
729 | 730 |
// Create default "index.php" file |
730 |
$rel_pages_dir = str_replace(WB_PATH, '', dirname($sAbsDir) );
|
|
731 |
$rel_pages_dir = str_replace($wb_path, '', dirname($sAbsDir) );
|
|
731 | 732 |
$step_back = str_repeat( '../', substr_count($rel_pages_dir, '/')+1 ); |
732 | 733 |
|
733 | 734 |
$sResponse = $_SERVER['SERVER_PROTOCOL'].' 301 Moved Permanently'; |
... | ... | |
742 | 743 |
"\t".'header(\'Location: '.WB_URL.'/index.php\');'."\n". |
743 | 744 |
'// *************************************************'."\n"; |
744 | 745 |
$filename = $sAbsDir.'/index.php'; |
746 |
|
|
745 | 747 |
// write content into file |
746 |
if ($handle = fopen($filename, 'w')) { |
|
747 |
fwrite($handle, $content); |
|
748 |
fclose($handle); |
|
749 |
change_mode($filename, 'file'); |
|
748 |
if(is_writable($filename)) { |
|
749 |
if(file_put_contents($filename, $content)) { |
|
750 |
print 'create => '.str_replace( $wb_path,'',$filename).'<br />'; |
|
751 |
change_mode($filename, 'file'); |
|
752 |
} |
|
750 | 753 |
} |
751 |
// $admin->print_success($MESSAGE['MEDIA']['DIR_MADE']); |
|
752 | 754 |
} else { |
753 |
// $admin->print_error($MESSAGE['GENERIC_BAD_PERMISSIONS']); |
|
754 | 755 |
$retVal[] = $MESSAGE['GENERIC_BAD_PERMISSIONS']; |
755 | 756 |
} |
756 | 757 |
return $retVal; |
757 | 758 |
} |
758 | 759 |
|
759 |
// Rebuild new protected files in the given directory and subs |
|
760 | 760 |
function rebuildFolderProtectFile($dir='') |
761 | 761 |
{ |
762 |
$retVal = array(); |
|
762 |
$retVal = array(); |
|
763 |
$dir = rtrim(str_replace('\/\\', '/', $dir), '/'); |
|
763 | 764 |
try { |
764 |
$iterator = new RecursiveDirectoryIterator($dir); |
|
765 |
foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::SELF_FIRST) as $file) |
|
766 |
{ |
|
767 |
if ($file->isDir()) { |
|
768 |
$protect_file = ($file->getPathname()); |
|
769 |
$retVal[] = createFolderProtectFile($protect_file,false); |
|
770 |
} else { |
|
771 |
// print ($file->getPathname())."<br />"; |
|
772 |
} |
|
773 |
} |
|
774 |
} catch ( Exception $e ) { |
|
775 |
$retVal[] = $MESSAGE['MEDIA_DIR_ACCESS_DENIED']; |
|
776 |
} |
|
777 |
|
|
778 |
$retVal = array_merge($retVal); |
|
779 |
return $retVal; |
|
765 |
$files = array(); |
|
766 |
$files[] = $dir; |
|
767 |
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir)) as $fileInfo){ |
|
768 |
$files[] = $fileInfo->getPath(); |
|
769 |
} |
|
770 |
$files = array_unique($files); |
|
771 |
foreach( $files as $file){ |
|
772 |
$protect_file = rtrim(str_replace('\/\\', '/', $file), '/'); |
|
773 |
$retVal[] = createFolderProtectFile($protect_file,false); |
|
774 |
} |
|
775 |
} catch ( Exception $e ) { |
|
776 |
$retVal[] = $MESSAGE['MEDIA_DIR_ACCESS_DENIED']; |
|
777 |
} |
|
778 |
return $retVal; |
|
780 | 779 |
} |
781 | 780 |
|
782 | 781 |
// Create a new file in the pages directory |
Also available in: Unified diff
move fixes 2.8.2 to 2.8.3
fixes will be shown in an extra readme
an package with the fixed files will be created
for all users who downloaded the 2.8.2 before 29 Jul-2011