Revision 1477
Added by Dietmar over 13 years ago
functions.php | ||
---|---|---|
703 | 703 |
} |
704 | 704 |
|
705 | 705 |
// Create a new directory and/or protected file in the given directory |
706 |
function createFolderProtectFile($relative='',$make_dir=true)
|
|
706 |
function createFolderProtectFile($sAbsDir='',$make_dir=true)
|
|
707 | 707 |
{ |
708 | 708 |
global $admin, $MESSAGE; |
709 | 709 |
$retVal = array(); |
710 |
if($relative=='') { return $retVal;}
|
|
710 |
if( ($sAbsDir=='') || ($sAbsDir == WB_PATH) ) { return $retVal;}
|
|
711 | 711 |
|
712 | 712 |
if ( $make_dir==true ) { |
713 | 713 |
// Check to see if the folder already exists |
714 |
if(file_exists($relative)) {
|
|
714 |
if(file_exists($sAbsDir)) {
|
|
715 | 715 |
// $admin->print_error($MESSAGE['MEDIA_DIR_EXISTS']); |
716 |
$retVal[] = basename($relative).'::'.$MESSAGE['MEDIA_DIR_EXISTS'];
|
|
716 |
$retVal[] = basename($sAbsDir).'::'.$MESSAGE['MEDIA_DIR_EXISTS'];
|
|
717 | 717 |
} |
718 |
if ( !make_dir($relative) ) {
|
|
718 |
if ( !make_dir($sAbsDir) ) {
|
|
719 | 719 |
// $admin->print_error($MESSAGE['MEDIA_DIR_NOT_MADE']); |
720 |
$retVal[] = basename($relative).'::'.$MESSAGE['MEDIA_DIR_NOT_MADE']; |
|
720 |
$retVal[] = basename($sAbsDir).'::'.$MESSAGE['MEDIA_DIR_NOT_MADE']; |
|
721 |
} else { |
|
722 |
change_mode($sAbsDir); |
|
721 | 723 |
} |
722 | 724 |
} |
723 | 725 |
|
724 |
change_mode($relative); |
|
725 |
if( is_writable($relative) ) |
|
726 |
if( is_writable($sAbsDir) ) |
|
726 | 727 |
{ |
727 |
if(file_exists($relative.'/index.php')) { unlink($relative.'/index.php'); }
|
|
728 |
// if(file_exists($sAbsDir.'/index.php')) { unlink($sAbsDir.'/index.php'); }
|
|
728 | 729 |
// Create default "index.php" file |
729 |
$rel_pages_dir = str_replace(WB_PATH, '', dirname($relative) );
|
|
730 |
$rel_pages_dir = str_replace(WB_PATH, '', dirname($sAbsDir) );
|
|
730 | 731 |
$step_back = str_repeat( '../', substr_count($rel_pages_dir, '/')+1 ); |
731 | 732 |
|
732 | 733 |
$sResponse = $_SERVER['SERVER_PROTOCOL'].' 301 Moved Permanently'; |
... | ... | |
740 | 741 |
"\t".'header(\''.$sResponse.'\');'."\n". |
741 | 742 |
"\t".'header(\'Location: '.WB_URL.'/index.php\');'."\n". |
742 | 743 |
'// *************************************************'."\n"; |
743 |
$filename = $relative.'/index.php';
|
|
744 |
$filename = $sAbsDir.'/index.php';
|
|
744 | 745 |
// write content into file |
745 | 746 |
if ($handle = fopen($filename, 'w')) { |
746 | 747 |
fwrite($handle, $content); |
... | ... | |
1422 | 1423 |
if(!function_exists('url_encode')){ |
1423 | 1424 |
function url_encode($string) { |
1424 | 1425 |
$string = html_entity_decode($string,ENT_QUOTES,'UTF-8'); |
1425 |
$entities = array('%20', '%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D', '%2B', '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D');
|
|
1426 |
$replacements = array(' ','!', '*', "'", "(", ")", ";", ":", "@", "&", "=", "+", "$", ",", "/", "?", "%", "#", "[", "]");
|
|
1427 |
return str_replace($entities, $replacements, rawurlencode($string));
|
|
1426 |
$entities = array('%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D', '%2B', '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D'); |
|
1427 |
$replacements = array('!', '*', "'", "(", ")", ";", ":", "@", "&", "=", "+", "$", ",", "/", "?", "%", "#", "[", "]"); |
|
1428 |
return str_replace($entities,$replacements, rawurlencode($string)); |
|
1428 | 1429 |
} |
1429 | 1430 |
} |
Also available in: Unified diff
! update DA language (Tks to Achrist)
! update some languages variables (Tks to Rübenwurzel, Testör)
! move function url_encode from admin/pages to framework/functions.php
! add missing svn properties in some headerinfos
! font-size correction in wb_theme (Tks to Rübenwurzel)