Revision 1977
Added by Dietmar about 11 years ago
branches/2.8.x/CHANGELOG | ||
---|---|---|
11 | 11 |
! = Update/Change |
12 | 12 |
=============================================================================== |
13 | 13 |
|
14 |
06 Oct-2013 Build 1977 Dietmar Woellbrink (Luisehahne) |
|
15 |
! /framework/functions.php: started implementation of packet AccessFile in function rebuild_all_accessfiles() |
|
16 |
+ /framework/functions.php::rm_full_dir() added additional argument to set list of protected files |
|
17 |
! integrate the new processes into the upgrade-script.php |
|
18 |
+ extended checks and informations in /modules/MultiLingual/upgrade.php |
|
19 |
increasing version for module MultiLingual to 1.6.9 |
|
14 | 20 |
05 Oct-2013 Build 1976 Manuela v.d.Decken(DarkViper) |
15 | 21 |
# Packet AccessFile fixed indifferent handling of './..' directory entries |
16 | 22 |
04 Oct-2013 Build 1975 Dietmar Woellbrink (Luisehahne) |
17 |
! /install/sql/wb_search_data.sql recoding initial data for table `search` without primary index value
|
|
23 |
! /install/sql/wb_search_data.sql recoding initial data for table `search` without primary index value |
|
18 | 24 |
04 Oct-2013 Build 1974 Manuela v.d.Decken(DarkViper) |
19 | 25 |
! /framework/WbDatabase fixed little problem with multiple database connections |
20 | 26 |
03 Oct-2013 Build 1973 Manuela v.d.Decken(DarkViper) |
21 | 27 |
branches/2.8.x/wb/upgrade-script.php | ||
---|---|---|
116 | 116 |
$FAIL = ' <span class="error">FAILED</span> '; |
117 | 117 |
$DEFAULT_THEME = 'wb_theme'; |
118 | 118 |
|
119 |
$stepID = 0;
|
|
119 |
$stepID = 1;
|
|
120 | 120 |
$dirRemove = array( |
121 | 121 |
/* |
122 | 122 |
'[TEMPLATE]/allcss/', |
... | ... | |
679 | 679 |
add_modify_field_in_database($table_name,$field_name,$description); |
680 | 680 |
|
681 | 681 |
/********************************************************** |
682 |
* - Add field "page_code" to table "pages" |
|
683 |
* |
|
684 |
* will be done in upgrade.php of the module MultiLingual |
|
685 |
* until the module is integrated completely |
|
686 |
*/ |
|
687 |
// $table_name = TABLE_PREFIX.'pages'; |
|
688 |
// $field_name = 'page_code'; |
|
689 |
// $description = "INT NOT NULL DEFAULT '0' AFTER `language`"; |
|
690 |
// add_modify_field_in_database($table_name,$field_name,$description); |
|
691 |
|
|
692 |
/********************************************************** |
|
693 | 682 |
* - Add field "menu_icon_0" to table "pages" |
694 | 683 |
*/ |
695 | 684 |
$table_name = TABLE_PREFIX.'pages'; |
... | ... | |
897 | 886 |
/********************************************************** |
898 | 887 |
* upgrade media directory index protect files |
899 | 888 |
*/ |
900 |
$dir = (WB_PATH.MEDIA_DIRECTORY); |
|
901 | 889 |
echo '<h4>Upgrade media directory '.MEDIA_DIRECTORY.'/ index.php protect files</h4>'; |
902 |
$aDebugMessage = rebuildFolderProtectFile($dir);
|
|
890 |
$aDebugMessage = rebuildFolderProtectFile(); |
|
903 | 891 |
if( sizeof( $aDebugMessage ) ){ |
904 | 892 |
echo '<span><strong>Upgrade '.sizeof( $aDebugMessage ).' directory '.MEDIA_DIRECTORY.'/ protect files</strong></span>'." $OK<br />"; |
905 | 893 |
} else { |
... | ... | |
916 | 904 |
/********************************************************** |
917 | 905 |
* - Reformat/rebuild all existing access files |
918 | 906 |
*/ |
919 |
$sPagePath = (defined('PAGES_DIRECTORY') && (PAGES_DIRECTORY != '') ? PAGES_DIRECTORY : ''); |
|
920 |
$msg = rebuild_all_accessfiles(); |
|
921 |
$dir = (WB_PATH.PAGES_DIRECTORY); |
|
907 |
// $sPagePath = (defined('PAGES_DIRECTORY') && (PAGES_DIRECTORY != '') ? PAGES_DIRECTORY : ''); |
|
908 |
// $sPageDir = str_replace('\\','/',WB_PATH.$sPagePath); |
|
909 |
// $aProtectedFiles = array( |
|
910 |
// $sPageDir.'/intro.php', |
|
911 |
// $sPageDir.'/intro/intro.php', |
|
912 |
// ); |
|
913 |
$msg = rebuild_all_accessfiles($bDebugModus); |
|
922 | 914 |
// $aDebugMessage = rebuildFolderProtectFile($dir); |
923 | 915 |
echo '<strong>'.implode ('<br />',$msg).'</strong>'; |
924 | 916 |
echo '</div>'; |
branches/2.8.x/wb/admin/interface/version.php | ||
---|---|---|
51 | 51 |
|
52 | 52 |
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled) |
53 | 53 |
if(!defined('VERSION')) define('VERSION', '2.8.3'); |
54 |
if(!defined('REVISION')) define('REVISION', '1976');
|
|
54 |
if(!defined('REVISION')) define('REVISION', '1977');
|
|
55 | 55 |
if(!defined('SP')) define('SP', ''); |
branches/2.8.x/wb/framework/functions.php | ||
---|---|---|
24 | 24 |
// Define that this file has been loaded |
25 | 25 |
define('FUNCTIONS_FILE_LOADED', true); |
26 | 26 |
|
27 |
|
|
27 | 28 |
/** |
29 |
* Delete an Accessfiles Tree |
|
30 |
* @param string $sDirToDelete |
|
31 |
* @return boolean true/false |
|
32 |
* @description Delete all accessfiles and its depending directory tree |
|
33 |
* inside the given directory. |
|
34 |
*/ |
|
35 |
|
|
36 |
function DeleteAccessFilesTree($sDirToDelete) |
|
37 |
{ |
|
38 |
$sBaseDir = realpath($sDirToDelete); |
|
39 |
if( $sBaseDir !== false) { |
|
40 |
$sBaseDir = rtrim(str_replace('\\', '/', $sBaseDir), '/') . '/'; |
|
41 |
// scan start directory for access files |
|
42 |
foreach (glob($sBaseDir . '*.php', GLOB_MARK) as $sItem) { |
|
43 |
$sItem = str_replace('\\', '/', $sItem); |
|
44 |
try{ |
|
45 |
$oAccFile = new AccessFile($sItem); |
|
46 |
$oAccFile->delete(); |
|
47 |
}catch(AccessFileIsNoAccessfileException $e) { |
|
48 |
continue; |
|
49 |
} |
|
50 |
} |
|
51 |
return true; |
|
52 |
} |
|
53 |
return false; |
|
54 |
} |
|
55 |
|
|
56 |
/** |
|
28 | 57 |
* @description: recursively delete a non empty directory |
29 | 58 |
* @param string $directory : |
30 | 59 |
* @param bool $empty : true if you want the folder just emptied, but not deleted |
31 | 60 |
* false, or just simply leave it out, the given directory will be deleted, as well |
61 |
* @param array $aProtectedFiles optional list of protected files, full path needed |
|
32 | 62 |
* @return boolean: true/false |
33 | 63 |
* @from http://www.php.net/manual/de/function.rmdir.php#98499 |
34 | 64 |
*/ |
35 |
function rm_full_dir($directory, $empty = false) |
|
65 |
function rm_full_dir($directory, $empty = false, $aProtectedFiles = null)
|
|
36 | 66 |
{ |
67 |
$directory = rtrim(str_replace('\\','/',$directory),'/'); |
|
68 |
if($aProtectedFiles == null) { |
|
69 |
$aProtectedFiles = array(); |
|
70 |
} |
|
37 | 71 |
$iErrorReporting = error_reporting(0); |
38 |
if(substr($directory,-1) == "/") { |
|
39 |
$directory = substr($directory,0,-1); |
|
40 |
} |
|
41 |
// If suplied dirname is a file then unlink it |
|
72 |
|
|
42 | 73 |
if (is_file( $directory )&& is_writable( $directory )) { |
43 |
$retval = unlink($directory); |
|
44 |
clearstatcache(); |
|
45 |
error_reporting($iErrorReporting); |
|
46 |
return $retval; |
|
74 |
if(!in_array(($directory), $aProtectedFiles)) { |
|
75 |
$retval = unlink($directory); |
|
76 |
clearstatcache(); |
|
77 |
error_reporting($iErrorReporting); |
|
78 |
return $retval; |
|
79 |
}else { |
|
80 |
return true; |
|
81 |
} |
|
47 | 82 |
} |
48 | 83 |
if(!is_writable($directory) || !is_dir($directory)) { |
49 | 84 |
error_reporting($iErrorReporting); |
... | ... | |
59 | 94 |
{ |
60 | 95 |
$path = $directory . "/" . $contents; |
61 | 96 |
if(is_dir($path)) { |
62 |
rm_full_dir($path); |
|
97 |
rm_full_dir($path, false, $aProtectedFiles);
|
|
63 | 98 |
} else { |
64 |
unlink($path); |
|
65 |
clearstatcache(); |
|
99 |
if(!in_array($path, $aProtectedFiles)) { |
|
100 |
unlink($path); |
|
101 |
clearstatcache(); |
|
102 |
} |
|
66 | 103 |
} |
67 | 104 |
} |
68 | 105 |
} |
... | ... | |
670 | 707 |
{ |
671 | 708 |
global $admin, $MESSAGE; |
672 | 709 |
$retVal = array(); |
673 |
$wb_path = rtrim(str_replace('\/\\', '/', WB_PATH), '/'); |
|
674 |
if( ($sAbsDir=='') || ($sAbsDir == $wb_path) ) { return $retVal;} |
|
710 |
$wb_path = rtrim(str_replace('\/\\', '/', WB_PATH), '/'); |
|
711 |
$sAppPath = rtrim(str_replace('\/\\', '/', WB_PATH), '/').'/'; |
|
712 |
if( ($sAbsDir=='') || ($sAbsDir == $sAppPath) ) { return $retVal;} |
|
675 | 713 |
|
676 | 714 |
if ( $make_dir==true ) { |
677 | 715 |
// Check to see if the folder already exists |
678 | 716 |
if(is_readable($sAbsDir)) { |
679 | 717 |
$retVal[] = basename($sAbsDir).'::'.$MESSAGE['MEDIA_DIR_EXISTS']; |
680 | 718 |
} |
681 |
if (!is_dir($sAbsDir) && !make_dir($sAbsDir) ) {
|
|
719 |
if (!make_dir($sAbsDir) && !is_dir($sAbsDir) ) {
|
|
682 | 720 |
$retVal[] = basename($sAbsDir).'::'.$MESSAGE['MEDIA_DIR_NOT_MADE']; |
683 | 721 |
} else { |
684 | 722 |
change_mode($sAbsDir); |
... | ... | |
693 | 731 |
{ |
694 | 732 |
// if(file_exists($sAbsDir.'/index.php')) { unlink($sAbsDir.'/index.php'); } |
695 | 733 |
// Create default "index.php" file |
696 |
$rel_pages_dir = str_replace($wb_path, '', dirname($sAbsDir) );
|
|
697 |
$step_back = str_repeat( '../', substr_count($rel_pages_dir, '/')+1 );
|
|
734 |
$iBackSteps = substr_count(str_replace($sAppPath, '', $sAbsDir), '/');
|
|
735 |
$sIndexFile = str_repeat('../', $iBackSteps).'index.php';
|
|
698 | 736 |
$sResponse = $_SERVER['SERVER_PROTOCOL'].' 301 Moved Permanently'; |
699 | 737 |
$content = |
700 | 738 |
'<?php'."\n". |
... | ... | |
1407 | 1445 |
} |
1408 | 1446 |
|
1409 | 1447 |
if(!function_exists('rebuild_all_accessfiles')){ |
1410 |
function rebuild_all_accessfiles() { |
|
1448 |
function rebuild_all_accessfiles($bShowDetails=false ) {
|
|
1411 | 1449 |
global $database; |
1412 |
$retVal = array();
|
|
1450 |
$aRetval = array();
|
|
1413 | 1451 |
/** |
1414 | 1452 |
* try to remove access files and build new folder protect files |
1415 | 1453 |
*/ |
1416 |
$sTempDir = (defined('PAGES_DIRECTORY') && (PAGES_DIRECTORY != '') ? PAGES_DIRECTORY : ''); |
|
1417 |
if(($sTempDir!='') && is_writeable(WB_PATH.$sTempDir)==true) { |
|
1418 |
if(rm_full_dir (WB_PATH.$sTempDir, true )==false) { |
|
1419 |
$retVal[] = 'Could not delete existing access files'; |
|
1420 |
} |
|
1454 |
// $sTempDir = (defined('PAGES_DIRECTORY') && (PAGES_DIRECTORY != '') ? PAGES_DIRECTORY : '').'/'; |
|
1455 |
$sTreeToDelete = WbAdaptor::getInstance()->AppPath.WbAdaptor::getInstance()->PagesDir; |
|
1456 |
if(($sTreeToDelete!='') && is_writeable($sTreeToDelete)==true) { |
|
1457 |
// if(rm_full_dir (WB_PATH.$sTempDir, true, $aProtectedFiles )==false) { |
|
1458 |
// $aRetval[] = 'Could not delete existing access files'; |
|
1459 |
// } |
|
1460 |
DeleteAccessFilesTree($sTreeToDelete); |
|
1461 |
if($bShowDetails) { |
|
1462 |
$aRetval = array_merge($aRetval, AccessFileHelper::getDelTreeLog()); |
|
1463 |
} |
|
1421 | 1464 |
} |
1422 |
$retVal = createFolderProtectFile(rtrim( WB_PATH.PAGES_DIRECTORY,'/') ); |
|
1465 |
|
|
1466 |
$aRetval = array_merge($aRetval,createFolderProtectFile(rtrim( WB_PATH.PAGES_DIRECTORY,'/') )); |
|
1467 |
|
|
1423 | 1468 |
/** |
1424 | 1469 |
* Reformat/rebuild all existing access files |
1425 | 1470 |
*/ |
... | ... | |
1450 | 1495 |
create_access_file($filename, $page['page_id'], $page['level']); |
1451 | 1496 |
$x++; |
1452 | 1497 |
} |
1453 |
$retVal[] = 'Number of new formated access files: '.$x.'';
|
|
1498 |
$aRetval[] = 'Number of new formated access files: '.$x.'';
|
|
1454 | 1499 |
} |
1455 |
return $retVal;
|
|
1500 |
return $aRetval;
|
|
1456 | 1501 |
} |
1457 | 1502 |
} |
1458 | 1503 |
|
branches/2.8.x/wb/modules/MultiLingual/info.php | ||
---|---|---|
25 | 25 |
* @author Dietmar Wöllbrink <dietmar.woellbrink@websiteBaker.org> |
26 | 26 |
* @copyright Werner v.d.Decken <wkl@isteam.de> |
27 | 27 |
* @license http://www.gnu.org/licenses/gpl.html GPL License |
28 |
* @version 1.6.8
|
|
28 |
* @version 1.6.9
|
|
29 | 29 |
* @revision $Revision$ |
30 | 30 |
* @link $HeadURL$ |
31 | 31 |
* @lastmodified $Date$ |
... | ... | |
34 | 34 |
*/ |
35 | 35 |
|
36 | 36 |
$module_directory = 'MultiLingual'; |
37 |
$module_name = 'MultiLingual Switcher 1.6.8';
|
|
37 |
$module_name = 'MultiLingual Switcher 1.6.9';
|
|
38 | 38 |
$module_function = 'snippet'; |
39 |
$module_version = '1.6.8';
|
|
39 |
$module_version = '1.6.9';
|
|
40 | 40 |
$module_status = 'alpha'; |
41 | 41 |
$module_platform = '2.8.4'; |
42 | 42 |
$module_author = 'Luisehahne'; |
branches/2.8.x/wb/modules/MultiLingual/upgrade.php | ||
---|---|---|
25 | 25 |
* @author Dietmar Wöllbrink <dietmar.woellbrink@websiteBaker.org> |
26 | 26 |
* @copyright Werner v.d.Decken <wkl@isteam.de> |
27 | 27 |
* @license http://www.gnu.org/licenses/gpl.html GPL License |
28 |
* @version 1.6.8
|
|
28 |
* @version 1.6.9
|
|
29 | 29 |
* @revision $Revision$ |
30 | 30 |
* @link $HeadURL$ |
31 | 31 |
* @lastmodified $Date$ |
... | ... | |
41 | 41 |
} |
42 | 42 |
/* -------------------------------------------------------- */ |
43 | 43 |
|
44 |
// Work-out if we should check for existing page_code |
|
45 |
$sql = 'DESCRIBE `'.$database->TablePrefix.'pages` `page_code`'; |
|
46 |
$field_sql = $database->query($sql); |
|
47 |
$field_set = $field_sql->numRows(); |
|
48 |
$format = $field_sql->fetchRow(MYSQL_ASSOC) ; |
|
49 |
// upgrade only if old format |
|
50 |
if($format['Type'] == 'varchar(255)' ) |
|
51 |
{ |
|
52 |
$sql = 'SELECT `page_code`,`page_id` FROM `'.$database->TablePrefix.'pages` ORDER BY `page_id`'; |
|
53 |
if($query_code = $database->query($sql)) |
|
54 |
{ |
|
55 |
// extract page_id from old format |
|
56 |
$pattern = '/(?<=_)([0-9]{1,11})/s'; |
|
57 |
while( $page = $query_code->fetchRow(MYSQL_ASSOC)) |
|
58 |
{ |
|
59 |
preg_match($pattern, $page['page_code'], $array); |
|
60 |
$page_code = $array[0]; |
|
61 |
$page_id = $page['page_id']; |
|
62 |
$sql = 'UPDATE `'.$database->TablePrefix.'pages` SET '; |
|
63 |
$sql .= ((empty($array[0])) ? '`page_code` = 0 ' : '`page_code` = '.$page_code.' '); |
|
64 |
$sql .= 'WHERE `page_id` = '.$page_id; |
|
65 |
$database->query($sql); |
|
66 |
} |
|
67 |
$field_set = $database->field_modify('page_code', 'pages', 'INT(11) NOT NULL AFTER `modified_by`'); |
|
68 |
// $sql = 'ALTER TABLE `'.$database->TablePrefix.'pages` MODIFY COLUMN `page_code` INT(11) NOT NULL'; |
|
69 |
// $database->query($sql); |
|
70 |
} |
|
44 |
function mod_MultiLingual_upgrade($bDebug=false) { |
|
45 |
global $OK ,$FAIL; |
|
46 |
$database=WbDatabase::getInstance(); |
|
47 |
$msg = array(); |
|
48 |
$callingScript = $_SERVER["SCRIPT_NAME"]; |
|
49 |
// check if upgrade startet by upgrade-script to echo a message |
|
50 |
$tmp = 'upgrade-script.php'; |
|
51 |
$globalStarted = substr_compare($callingScript, $tmp,(0-strlen($tmp)),strlen($tmp)) === 0; |
|
52 |
// change table structure |
|
53 |
$sTable = $database->TablePrefix.'pages'; |
|
54 |
$sFieldName = 'page_code'; |
|
55 |
$sDescription = "INT NOT NULL DEFAULT '0' AFTER `language`"; |
|
56 |
if(!$database->field_add($sTable,$sFieldName,$sDescription)) { |
|
57 |
$msg[] = ''.$database->get_error(); |
|
58 |
} else { |
|
59 |
$msg[] = 'Field ( `page_code` ) description has been add successfully'." $OK"; |
|
60 |
} |
|
61 |
// Work-out if we should check old format for existing page_code |
|
62 |
$sql = 'DESCRIBE `'.$database->TablePrefix.'pages` `page_code`'; |
|
63 |
$field_sql = $database->query($sql); |
|
64 |
// $field_set = $field_sql->numRows(); |
|
65 |
$format = $field_sql->fetchRow(MYSQL_ASSOC) ; |
|
66 |
// upgrade only if old format |
|
67 |
if($format['Type'] == 'varchar(255)' ) |
|
68 |
{ |
|
69 |
$sql = 'SELECT `page_code`,`page_id` FROM `'.$database->TablePrefix.'pages` ORDER BY `page_id`'; |
|
70 |
if($query_code = $database->query($sql)) |
|
71 |
{ |
|
72 |
// extract page_id from old format |
|
73 |
$pattern = '/(?<=_)([0-9]{1,11})/s'; |
|
74 |
while( $page = $query_code->fetchRow(MYSQL_ASSOC)) |
|
75 |
{ |
|
76 |
preg_match($pattern, $page['page_code'], $array); |
|
77 |
$page_code = $array[0]; |
|
78 |
$page_id = $page['page_id']; |
|
79 |
$sql = 'UPDATE `'.$database->TablePrefix.'pages` SET '; |
|
80 |
$sql .= ((empty($array[0])) ? '`page_code` = 0 ' : '`page_code` = '.$page_code.' '); |
|
81 |
$sql .= 'WHERE `page_id` = '.$page_id; |
|
82 |
$database->query($sql); |
|
83 |
} |
|
84 |
$field_set = $database->field_modify($sTable,$sFieldName,$sDescription); |
|
85 |
$msg[] = 'Field ( `page_code` ) description has been changed successfully'." $OK"; |
|
86 |
// only for upgrade-script |
|
87 |
if($globalStarted) { |
|
88 |
if($bDebug) { |
|
89 |
echo '<strong>'.implode('<br />',$msg).'</strong><br />'; |
|
90 |
} |
|
91 |
} |
|
92 |
} else { |
|
93 |
$msg[] = ''.$database->get_error(); |
|
94 |
} |
|
95 |
} |
|
96 |
// |
|
97 |
$msg[] = 'MultiLingual upgrade successfull finished '; |
|
98 |
if($globalStarted) { |
|
99 |
echo "<strong>MultiLingual upgrade successfull finished $OK</strong><br />"; |
|
100 |
} |
|
101 |
return ( ($globalStarted==true ) ? $globalStarted : $msg); |
|
102 |
|
|
103 |
} |
|
104 |
// ------------------------------------ |
|
105 |
//$directory = dirname(__FILE__).'/'.'info.php'; |
|
106 |
//// update entry in table addons to new version |
|
107 |
//load_module($directory, $install = false); |
|
108 |
|
|
109 |
$bDebugModus = ((isset($bDebugModus)) ? $bDebugModus : false); |
|
110 |
// Don't show the messages twice |
|
111 |
if( is_array($msg = mod_MultiLingual_upgrade($bDebugModus))) { |
|
112 |
echo '<strong>'.implode('<br />',$msg).'</strong><br />'; |
|
71 | 113 |
} |
72 |
// |
|
73 |
$directory = dirname(__FILE__).'/'.'info.php'; |
|
74 |
// update entry in table addons to new version |
|
75 |
load_module($directory, $install = false); |
|
114 |
|
|
115 |
// ------------------------------------ |
Also available in: Unified diff
! /framework/functions.php: started implementation of packet AccessFile in function rebuild_all_accessfiles()
+ /framework/functions.php::rm_full_dir() added additional argument to set list of protected files
! integrate the new processes into the upgrade-script.php
+ extended checks and informations in /modules/MultiLingual/upgrade.php
increasing version for module MultiLingual to 1.6.9