Revision 1889
Added by Luisehahne over 12 years ago
| branches/2.8.x/CHANGELOG | ||
|---|---|---|
| 11 | 11 |
! = Update/Change |
| 12 | 12 |
=============================================================================== |
| 13 | 13 |
|
| 14 |
|
|
| 15 |
|
|
| 16 |
19 Mar-2013 Build 1889 Dietmar Woellbrink (Luisehahne) |
|
| 17 |
# bugfix solved sections block update |
|
| 18 |
! update sections table change some varchar to int(11) |
|
| 19 |
+ upgradeHelper class for better module upgrade |
|
| 14 | 20 |
12 Mar-2013 Build 1888 Dietmar Woellbrink (Luisehahne) |
| 15 | 21 |
# fixed Deprecated: preg_replace(): modules\show_menu2\include.php |
| 16 | 22 |
The /e modifier is deprecated, replaced with preg_replace_callback |
| branches/2.8.x/wb/upgrade-script.php | ||
|---|---|---|
| 74 | 74 |
// database tables including in WB package |
| 75 | 75 |
$aPackage = array ( |
| 76 | 76 |
'settings','groups','addons','pages','sections','search','users', |
| 77 |
'mod_captcha_control','mod_jsadmin','mod_menu_link','mod_output_filter','mod_wrapper','mod_wysiwyg', |
|
| 78 |
// 'mod_code','mod_droplets', |
|
| 79 |
// 'mod_form_fields','mod_form_settings','mod_form_submissions', |
|
| 80 |
// 'mod_news_comments','mod_news_groups','mod_news_posts','mod_news_settings', |
|
| 77 |
'mod_captcha_control','mod_jsadmin','mod_menu_link','mod_output_filter','mod_wrapper','mod_wysiwyg' |
|
| 81 | 78 |
); |
| 82 | 79 |
|
| 83 | 80 |
$OK = ' <span class="ok">OK</span> '; |
| ... | ... | |
| 207 | 204 |
* @return |
| 208 | 205 |
*/ |
| 209 | 206 |
function add_modify_field_in_database($sTable,$sField,$sDescription){
|
| 210 |
global $database,$OK,$FAIL,$bDebugModus; |
|
| 207 |
global $OK,$FAIL,$bDebugModus; |
|
| 208 |
$database=WbDatabase::getInstance(); |
|
| 211 | 209 |
$aDebugMessage = array(); |
| 212 | 210 |
if(!$database->field_exists($sTable,$sField)) {
|
| 213 | 211 |
$aDebugMessage[] = "<span>Adding field $sField to $sTable table</span>"; |
| ... | ... | |
| 222 | 220 |
return; |
| 223 | 221 |
} |
| 224 | 222 |
|
| 225 |
/** |
|
| 226 |
* check existings tables for upgrade or install |
|
| 227 |
* |
|
| 228 |
* check_wb_tables() |
|
| 229 |
* |
|
| 230 |
* @return |
|
| 231 |
*/ |
|
| 232 |
function check_wb_tables() |
|
| 233 |
{
|
|
| 234 |
global $database,$aPackage; |
|
| 235 |
|
|
| 236 |
// if prefix inludes '_' or '%' |
|
| 237 |
$search_for = addcslashes ( TABLE_PREFIX, '%_' ); |
|
| 238 |
$get_result = $database->query( 'SHOW TABLES LIKE "'.$search_for.'%"'); |
|
| 239 |
|
|
| 240 |
// $get_result = $database->query( "SHOW TABLES FROM ".DB_NAME); |
|
| 241 |
$all_tables = array(); |
|
| 242 |
$aTable = array(); |
|
| 243 |
if($get_result->numRows() > 0) |
|
| 244 |
{
|
|
| 245 |
while ($data = $get_result->fetchRow()) {
|
|
| 246 |
$tmp = preg_replace('/^'.preg_quote(TABLE_PREFIX, '/').'/s', '', $data[0]);
|
|
| 247 |
if(in_array($tmp,$aPackage)) {
|
|
| 248 |
$all_tables[] = $tmp; |
|
| 249 |
} else {
|
|
| 250 |
$aTable[] = $tmp; |
|
| 251 |
} |
|
| 252 |
} |
|
| 253 |
} |
|
| 254 |
|
|
| 255 |
return array_merge ( $all_tables, $aTable ); |
|
| 256 |
} |
|
| 257 |
|
|
| 258 |
// check existing tables |
|
| 259 |
$all_tables = check_wb_tables(); |
|
| 260 |
|
|
| 261 | 223 |
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 262 | 224 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 263 | 225 |
<head> |
| ... | ... | |
| 402 | 364 |
exit(); |
| 403 | 365 |
} |
| 404 | 366 |
|
| 405 |
// check again all tables, to get a new array |
|
| 406 |
// if(sizeof($all_tables) < sizeof($aTable)) { $all_tables = check_wb_tables(); }
|
|
| 407 | 367 |
/********************************************************** |
| 408 | 368 |
* - check tables coming with WebsiteBaker |
| 409 | 369 |
*/ |
| 410 |
$check_text = 'total '; |
|
| 411 |
// $check_tables = mysqlCheckTables( DB_NAME ) ; |
|
| 412 |
$aTable = array(); |
|
| 413 |
foreach ($all_tables as $data) {
|
|
| 414 |
$tmp = str_replace(TABLE_PREFIX, '', $data); |
|
| 415 |
if(in_array($tmp,$aPackage)) {
|
|
| 416 |
$aTable[] = $tmp; |
|
| 417 |
} |
|
| 418 |
} |
|
| 419 |
|
|
| 420 |
if( (sizeof($all_tables) >= sizeof($aPackage)) && (sizeof($aTable) == sizeof($aPackage)) ) |
|
| 421 |
{
|
|
| 422 |
echo '<h4 style="margin-left:0;">NOTICE: Your database '.$database->DbName.' has '.sizeof($all_tables).' '.$check_text.' tables from '.sizeof($aPackage).' included in package '.$OK.'</h4>'; |
|
| 423 |
} |
|
| 424 |
else |
|
| 425 |
{
|
|
| 370 |
$aMissingTables = UpgradeHelper::existsAllTables($aPackage); |
|
| 371 |
if( sizeof($aMissingTables) == 0){
|
|
| 372 |
echo '<h4 style="margin-left:0;">NOTICE: '.sizeof($aPackage).' total tables included in package are successful installed your database `'.$database->DbName.'` '.$OK.'</h4>'; |
|
| 373 |
} else {
|
|
| 426 | 374 |
status_msg('<strong>:</strong><br />can\'t run Upgrade, missing tables', 'warning', 'div');
|
| 427 | 375 |
echo '<h4>Missing required tables. You can install them in backend->addons->modules.<br />'; |
| 428 | 376 |
echo 'Or if you uploaded per FTP install possible by backend->addons->modules->advanced.<br />'; |
| 429 | 377 |
echo 'First rename or delete the upgrade-script.php, so the script can\'t start automatically by backend<br />'; |
| 430 |
echo 'After installing missing tables upload and run again upgrade-script.php</h4>'; |
|
| 431 |
$result = array_diff ( $aPackage, $aTable ); |
|
| 432 |
|
|
| 433 |
echo '<h4 class="warning"><br />'; |
|
| 434 |
while ( list ( $key, $val ) = each ( $result ) ) |
|
| 435 |
{
|
|
| 436 |
echo 'TABLE ´'.TABLE_PREFIX.$val.'´ '.$FAIL.'<br>'; |
|
| 437 |
} |
|
| 438 |
|
|
| 439 |
echo '<br /></h4>'; |
|
| 378 |
echo 'After installing missing tables upload and run again upgrade-script.php<br /><br /></h4>'; |
|
| 379 |
echo '<h4 class="warning">'; |
|
| 380 |
echo 'Missing required tables.<br /><br />'; |
|
| 381 |
echo 'TABLE `'.implode('` missing! '.$FAIL.'<br />TABLE `',$aMissingTables).'` missing! '.$FAIL;
|
|
| 382 |
echo '<br /><br /></h4>'; |
|
| 440 | 383 |
echo '<br /><br />'; |
| 441 | 384 |
if(isset($_SERVER['SCRIPT_NAME'])) {
|
| 442 | 385 |
echo '<form action="'.$_SERVER['SCRIPT_NAME'].'/">'; |
| ... | ... | |
| 465 | 408 |
$aDebugMessage[] = '<div style="margin-left:2em;">'; |
| 466 | 409 |
$aDebugMessage[] = "<br /><span><strong>Adding default_theme to settings table</strong></span>"; |
| 467 | 410 |
// db_update_key_value('settings', 'default_theme', $DEFAULT_THEME);
|
| 468 |
$aDebugMessage[] = (db_update_key_value( 'settings', 'default_theme', $DEFAULT_THEME ) ? " $OK<br />" : " $FAIL!<br />"); |
|
| 411 |
$cfg = array( |
|
| 412 |
'default_theme' => defined('DEFAULT_THEME')&& (DEFAULT_THEME!='') ? DEFAULT_THEME : $DEFAULT_THEME
|
|
| 413 |
); |
|
| 414 |
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />"); |
|
| 469 | 415 |
$aDebugMessage[] = '</div>'; |
| 470 | 416 |
|
| 471 | 417 |
if($bDebugModus) {
|
| 472 | 418 |
echo implode(PHP_EOL,$aDebugMessage); |
| 473 | 419 |
} |
| 474 | 420 |
$aDebugMessage = array(); |
| 475 |
echo'<h3>Step '.(++$stepID).': Updating tables included in package</h3>';
|
|
| 421 |
echo'<h3>Step '.(++$stepID).': Updating core table included in package</h3>';
|
|
| 476 | 422 |
/********************************************************** |
| 477 | 423 |
* - Adding field sec_anchor to settings table |
| 478 | 424 |
*/ |
| ... | ... | |
| 480 | 426 |
echo "<h4>Adding/updating entries on table settings</h4>"; |
| 481 | 427 |
$aDebugMessage[] = "<span>Adding/updating sec_anchor to settings table</span>"; |
| 482 | 428 |
$cfg = array( |
| 483 |
'sec_anchor' => defined('SEC_ANCHOR') ? SEC_ANCHOR : 'section_'
|
|
| 429 |
'sec_anchor' => defined('SEC_ANCHOR')&& (SEC_ANCHOR!='') ? SEC_ANCHOR : 'section_'
|
|
| 484 | 430 |
); |
| 485 | 431 |
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />"); |
| 486 | 432 |
|
| ... | ... | |
| 489 | 435 |
*/ |
| 490 | 436 |
$aDebugMessage[] = "<span>Adding/updating redirect timer to settings table</span>"; |
| 491 | 437 |
$cfg = array( |
| 492 |
'redirect_timer' => defined('REDIRECT_TIMER') ? REDIRECT_TIMER : '1500'
|
|
| 438 |
'redirect_timer' => defined('REDIRECT_TIMER')&& (REDIRECT_TIMER!='') ? REDIRECT_TIMER : '1500'
|
|
| 493 | 439 |
); |
| 494 | 440 |
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />"); |
| 495 | 441 |
|
| 496 | 442 |
/********************************************************** |
| 443 |
* - Adding default_time_formatr to settings table |
|
| 444 |
*/ |
|
| 445 |
$aDebugMessage[] = "<span>Adding/updating default_time_format to settings table</span>"; |
|
| 446 |
$cfg = array( |
|
| 447 |
'default_time_format' => defined('DEFAULT_TIME_FORMAT')&& (DEFAULT_TIME_FORMAT!='') ? DEFAULT_TIME_FORMAT : 'h:i A'
|
|
| 448 |
); |
|
| 449 |
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />"); |
|
| 450 |
|
|
| 451 |
/********************************************************** |
|
| 497 | 452 |
* - Adding rename_files_on_upload to settings table |
| 498 | 453 |
*/ |
| 499 | 454 |
$aDebugMessage[] = "<span>Adding/Updating rename_files_on_upload to settings table</span>"; |
| 500 | 455 |
$cfg = array( |
| 501 |
'rename_files_on_upload' => (defined('RENAME_FILES_ON_UPLOAD') ? RENAME_FILES_ON_UPLOAD : 'ph.*?,cgi,pl,pm,exe,com,bat,pif,cmd,src,asp,aspx,js')
|
|
| 456 |
'rename_files_on_upload' => (defined('RENAME_FILES_ON_UPLOAD')&& (RENAME_FILES_ON_UPLOAD!='') ? RENAME_FILES_ON_UPLOAD : 'ph.*?,cgi,pl,pm,exe,com,bat,pif,cmd,src,asp,aspx,js')
|
|
| 502 | 457 |
); |
| 503 | 458 |
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />"); |
| 504 | 459 |
|
| ... | ... | |
| 507 | 462 |
*/ |
| 508 | 463 |
$aDebugMessage[] = "<span>Adding/updating mediasettings to settings table</span>"; |
| 509 | 464 |
$cfg = array( |
| 510 |
'mediasettings' => (defined('MEDIASETTINGS') ? MEDIASETTINGS : ''),
|
|
| 465 |
'mediasettings' => (defined('MEDIASETTINGS')&& (MEDIASETTINGS!='') ? MEDIASETTINGS : ''),
|
|
| 511 | 466 |
); |
| 512 | 467 |
|
| 513 | 468 |
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />"); |
| ... | ... | |
| 528 | 483 |
*/ |
| 529 | 484 |
$aDebugMessage[] = "<span>Adding/updating page_icon_dir to settings table</span>"; |
| 530 | 485 |
$cfg = array( |
| 531 |
'page_icon_dir' => (defined('PAGE_ICON_DIR') ? PAGE_ICON_DIR : '/templates/*/title_images'),
|
|
| 486 |
'page_icon_dir' => (defined('PAGE_ICON_DIR')&& (PAGE_ICON_DIR!='') ? PAGE_ICON_DIR : '/templates/*/title_images'),
|
|
| 532 | 487 |
); |
| 533 | 488 |
|
| 534 | 489 |
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />"); |
| ... | ... | |
| 547 | 502 |
*/ |
| 548 | 503 |
$aDebugMessage[] = "<span>Adding/updating wbmail_signature to settings table</span>"; |
| 549 | 504 |
$cfg = array( |
| 550 |
'wbmail_signature' => (defined('WBMAIL_SIGNATURE') ? WBMAIL_SIGNATURE : '')
|
|
| 505 |
'wbmail_signature' => (defined('WBMAIL_SIGNATURE')&& (WBMAIL_SIGNATURE!='') ? WBMAIL_SIGNATURE : '')
|
|
| 551 | 506 |
); |
| 552 | 507 |
|
| 553 | 508 |
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />"); |
| ... | ... | |
| 596 | 551 |
echo ($database->query($sql)) ? " $OK<br />" : " $FAIL!<br />"; |
| 597 | 552 |
} |
| 598 | 553 |
|
| 599 |
echo "<h4>Adding/updating field on table mod_menu_link</h4>";
|
|
| 554 |
echo "<h4>Adding/updating field on table mod_menu_link</h4>";
|
|
| 600 | 555 |
/********************************************************** |
| 601 | 556 |
* - Add field "redirect_type" to table "mod_menu_link" |
| 602 | 557 |
* has to be moved later to upgrade.php in modul menu_link, because modul can be removed |
| ... | ... | |
| 604 | 559 |
$table_name = TABLE_PREFIX.'mod_menu_link'; |
| 605 | 560 |
$field_name = 'redirect_type'; |
| 606 | 561 |
$description = "INT NOT NULL DEFAULT '301' AFTER `target_page_id`"; |
| 607 |
add_modify_field_in_database($table_name,$field_name,$description);
|
|
| 562 |
add_modify_field_in_database($table_name,$field_name,$description);
|
|
| 608 | 563 |
|
| 609 | 564 |
if($bDebugModus) {
|
| 610 | 565 |
echo implode(PHP_EOL,$aDebugMessage); |
| ... | ... | |
| 618 | 573 |
$table_name = TABLE_PREFIX.'pages'; |
| 619 | 574 |
$field_name = 'page_trail'; |
| 620 | 575 |
$description = "VARCHAR( 255 ) NOT NULL DEFAULT ''"; |
| 621 |
add_modify_field_in_database($table_name,$field_name,$description);
|
|
| 576 |
add_modify_field_in_database($table_name,$field_name,$description);
|
|
| 622 | 577 |
|
| 623 | 578 |
/********************************************************** |
| 624 | 579 |
* - Add field "page_icon" to table "pages" |
| ... | ... | |
| 725 | 680 |
$aDebugMessage[] = "<span>Modify field module on sections table</span>"; |
| 726 | 681 |
$aDebugMessage[] = ($database->field_modify($table_name, 'module', $description) ? " $OK<br />" : " $FAIL!<br />"); |
| 727 | 682 |
$aDebugMessage[] = "<span>Modify field block on sections table</span>"; |
| 683 |
$description = "int(11) NOT NULL DEFAULT '1'"; |
|
| 728 | 684 |
$aDebugMessage[] = ($database->field_modify($table_name, 'block', $description) ? " $OK<br />" : " $FAIL!<br />"); |
| 685 |
$description = "int(11) NOT NULL DEFAULT '0'"; |
|
| 729 | 686 |
$aDebugMessage[] = "<span>Modify field publ_start on sections table</span>"; |
| 730 | 687 |
$aDebugMessage[] = ($database->field_modify($table_name, 'publ_start', $description) ? " $OK<br />" : " $FAIL!<br />"); |
| 731 | 688 |
$aDebugMessage[] = "<span>Modify field publ_end on sections table</span>"; |
| ... | ... | |
| 786 | 743 |
|
| 787 | 744 |
} |
| 788 | 745 |
|
| 789 |
if(version_compare(WB_REVISION, '1800', '<'))
|
|
| 746 |
if(version_compare(WB_REVISION, REVISION, '<'))
|
|
| 790 | 747 |
{
|
| 791 | 748 |
$aDebugMessage = array(); |
| 792 |
/********************************************************** |
|
| 793 |
* This part with changing in mod_wysiwyg will be removed in the final version |
|
| 794 |
* special workout for the tester |
|
| 795 |
* - Remove/add PRIMARY KEY from/to "section_id" from table "mod_wysiwygs" |
|
| 796 |
*/ |
|
| 797 |
$aDebugMessage[] = '<div style="margin-left:2em;">'; |
|
| 798 |
|
|
| 799 |
$sTable = TABLE_PREFIX.'mod_wysiwyg'; |
|
| 800 |
$field_name = 'wysiwyg_id'; |
|
| 801 |
if($database->field_exists($sTable, 'wysiwyg_id')) {
|
|
| 802 |
if($database->index_exists($sTable, 'PRIMARY')) {
|
|
| 803 |
$aDebugMessage[] = "<span>Remove PRIMARY KEY from table mod_wysiwyg.wysiwyg_id</span>"; |
|
| 804 |
$aDebugMessage[] = $database->index_remove($sTable, 'PRIMARY') ? " $OK<br />" : " $FAIL!<br />"; |
|
| 805 |
} |
|
| 806 |
$aDebugMessage[] = "<span>Remove field 'wysiwyg_id' from table mod_wysiwyg</span>"; |
|
| 807 |
$aDebugMessage[] = $database->field_remove($sTable, 'wysiwyg_id') ? " $OK<br />" : " $FAIL!<br />"; |
|
| 808 |
} |
|
| 809 |
|
|
| 810 |
$aDebugMessage[] = "<br /><span>Create PRIMARY KEY ( `section_id` ) on table mod_wysiwygs.</span>"; |
|
| 811 |
$aDebugMessage[] = $database->index_add($sTable, '', 'section_id', 'PRIMARY') ? " $OK<br />" : " $FAIL!<br />"; |
|
| 812 |
$aDebugMessage[] = '</div>'; |
|
| 813 |
|
|
| 814 |
if($bDebugModus) {
|
|
| 815 |
// $aDebugMessage[] = |
|
| 816 |
echo implode(PHP_EOL,$aDebugMessage); |
|
| 817 |
} |
|
| 818 |
} |
|
| 819 |
|
|
| 820 |
if(version_compare(WB_REVISION, REVISION, '<=')) |
|
| 821 |
{
|
|
| 822 |
$aDebugMessage = array(); |
|
| 823 | 749 |
echo '<h3>Step '.(++$stepID).': Updating group_id in table users</h3>'; |
| 824 | 750 |
/********************************************************** |
| 825 | 751 |
* Updating group_id in table users |
| ... | ... | |
| 955 | 881 |
$msg = '<br /><br />Following files are deprecated, outdated or a security risk and |
| 956 | 882 |
can not be removed automatically.<br /><br />Please delete them |
| 957 | 883 |
using FTP and restart upgrade-script!<br /><br />'.$msg.'<br />'; |
| 958 |
status_msg($msg, 'error warning', 'div');
|
|
| 884 |
status_msg($msg, 'error warning', 'div');
|
|
| 959 | 885 |
echo '<p style="font-size:120%;"><strong>WARNING: The upgrade script failed ...</strong></p>'; |
| 960 | 886 |
|
| 961 | 887 |
echo '<form action="'.$_SERVER['SCRIPT_NAME'].'">'; |
| ... | ... | |
| 968 | 894 |
</html>"; |
| 969 | 895 |
exit; |
| 970 | 896 |
} |
| 971 |
}
|
|
| 897 |
}
|
|
| 972 | 898 |
|
| 973 | 899 |
|
| 974 | 900 |
/********************************************************** |
| ... | ... | |
| 1039 | 965 |
* upgrade modules if newer version is available |
| 1040 | 966 |
* $aModuleList list of proofed modules |
| 1041 | 967 |
*/ |
| 1042 |
$aModuleList = array('news','wysiwyg','form');
|
|
| 968 |
// $aModuleList = array('wysiwyg','news','form','captcha_control','output_filter');
|
|
| 969 |
$aModuleList = array('wysiwyg','form');
|
|
| 1043 | 970 |
if(sizeof($aModuleList)) |
| 1044 | 971 |
{
|
| 1045 | 972 |
echo '<h3>Step '.(++$stepID).': Upgrade proofed modules</h3>'; |
| ... | ... | |
| 1097 | 1024 |
if( ($handle = opendir(WB_PATH.'/modules/')) ) {
|
| 1098 | 1025 |
while(false !== ($file = readdir($handle))) {
|
| 1099 | 1026 |
if($file != '' && substr($file, 0, 1) != '.' && is_dir(WB_PATH.'/modules/'.$file) ) {
|
| 1100 |
$iFound++;
|
|
| 1027 |
$iFound++;
|
|
| 1101 | 1028 |
$iLoaded = load_module(WB_PATH.'/modules/'.$file ) ? $iLoaded+1 : $iLoaded; |
| 1102 |
// upgrade_module($file, true);
|
|
| 1029 |
// upgrade_module($file, true); |
|
| 1103 | 1030 |
} |
| 1104 | 1031 |
} |
| 1105 | 1032 |
closedir($handle); |
| 1106 | 1033 |
} |
| 1107 | 1034 |
echo '<strong><span>'.$iLoaded.' Modules reloaded,</span> found '.$iFound.' directories in folder /modules/</strong><br />'; |
| 1108 | 1035 |
|
| 1109 |
$iFound = 0;
|
|
| 1110 |
$iLoaded = 0;
|
|
| 1036 |
$iFound = 0;
|
|
| 1037 |
$iLoaded = 0;
|
|
| 1111 | 1038 |
////delete templates |
| 1112 | 1039 |
//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
|
| 1113 | 1040 |
// Load all templates |
| ... | ... | |
| 1115 | 1042 |
while(false !== ($file = readdir($handle))) {
|
| 1116 | 1043 |
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
|
| 1117 | 1044 |
|
| 1118 |
$iFound++;
|
|
| 1045 |
$iFound++;
|
|
| 1119 | 1046 |
$iLoaded = (load_template(WB_PATH.'/templates/'.$file)==true) ? $iLoaded+1 : $iLoaded; |
| 1120 | 1047 |
|
| 1121 | 1048 |
} |
| ... | ... | |
| 1124 | 1051 |
} |
| 1125 | 1052 |
echo '<strong><span>'.$iLoaded.' Templates reloaded,</span> found '.$iFound.' directories in folder /templates/</strong><br />'; |
| 1126 | 1053 |
|
| 1127 |
$iFound = 0;
|
|
| 1128 |
$iLoaded = 0;
|
|
| 1054 |
$iFound = 0;
|
|
| 1055 |
$iLoaded = 0;
|
|
| 1129 | 1056 |
////delete languages |
| 1130 | 1057 |
//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
|
| 1131 | 1058 |
// Load all languages |
| 1132 | 1059 |
if( ($handle = opendir(WB_PATH.'/languages/')) ) {
|
| 1133 | 1060 |
while(false !== ($file = readdir($handle))) {
|
| 1134 | 1061 |
if($file != '' AND (preg_match('#^([A-Z]{2}.php)#', basename($file)))) {
|
| 1135 |
$iFound++;
|
|
| 1062 |
$iFound++;
|
|
| 1136 | 1063 |
$iLoaded = load_language(WB_PATH.'/languages/'.$file) ? $iLoaded+1 : $iLoaded; |
| 1137 | 1064 |
} |
| 1138 | 1065 |
} |
| 1139 | 1066 |
closedir($handle); |
| 1140 | 1067 |
} |
| 1141 | 1068 |
echo '<strong><span>'.$iLoaded.' Languages reloaded,</span> found '.$iFound.' files in folder /languages/</strong><br />'; |
| 1142 |
echo '</div>';
|
|
| 1069 |
echo '</div>';
|
|
| 1143 | 1070 |
|
| 1144 | 1071 |
/********************************************************** |
| 1145 | 1072 |
* - install new droplets |
| 1146 | 1073 | |
| branches/2.8.x/wb/admin/pages/sections_save.php | ||
|---|---|---|
| 7 | 7 |
* @author Ryan Djurovich, WebsiteBaker Project |
| 8 | 8 |
* @copyright 2004-2009, Ryan Djurovich |
| 9 | 9 |
* @copyright 2009-2012, Website Baker Org. e.V. |
| 10 |
* @link http://www.websitebaker2.org/
|
|
| 10 |
* @link http://www.websitebaker2.org/
|
|
| 11 | 11 |
* @license http://www.gnu.org/licenses/gpl.html |
| 12 | 12 |
* @platform WebsiteBaker 2.8.x |
| 13 | 13 |
* @requirements PHP 5.2.2 and higher |
| 14 | 14 |
* @version $Id$ |
| 15 |
* @filesource $HeadURL$
|
|
| 15 |
* @filesource $HeadURL$
|
|
| 16 | 16 |
* @lastmodified $Date$ |
| 17 | 17 |
* |
| 18 | 18 |
*/ |
| ... | ... | |
| 23 | 23 |
require_once(WB_PATH."/include/jscalendar/jscalendar-functions.php"); |
| 24 | 24 |
/**/ |
| 25 | 25 |
// Create new admin object |
| 26 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 26 |
if(!class_exists('admin')) {
|
|
| 27 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 28 |
} |
|
| 27 | 29 |
// suppress to print the header, so no new FTAN will be set |
| 28 | 30 |
$admin = new admin('Pages', 'pages_modify',false);
|
| 29 | 31 |
|
| ... | ... | |
| 32 | 34 |
$admin->send_header('Location: '.ADMIN_URL.'/pages/index.php');
|
| 33 | 35 |
exit(0); |
| 34 | 36 |
} |
| 35 |
|
|
| 36 | 37 |
// Get page id |
| 37 |
if(!isset($_GET['page_id']) || !is_numeric($_GET['page_id'])) {
|
|
| 38 |
$iPageId = (isset($_GET['page_id']) ? intval($_GET['page_id']) : 0); |
|
| 39 |
if(!$iPageId) {
|
|
| 38 | 40 |
$admin->send_header("Location: index.php");
|
| 39 | 41 |
exit(0); |
| 40 |
} else {
|
|
| 41 |
$page_id = (int)$_GET['page_id']; |
|
| 42 | 42 |
} |
| 43 |
|
|
| 44 |
if (!$admin->checkFTAN()) |
|
| 45 |
{
|
|
| 43 |
if (!$admin->checkFTAN()) {
|
|
| 46 | 44 |
$admin->print_header(); |
| 47 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],ADMIN_URL.'/pages/sections.php?page_id='.$page_id);
|
|
| 45 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],ADMIN_URL.'/pages/sections.php?page_id='.$iPageId);
|
|
| 48 | 46 |
} |
| 49 |
/* |
|
| 50 |
if( (!($page_id = $admin->checkIDKEY('page_id', 0, $_SERVER['REQUEST_METHOD']))) )
|
|
| 51 |
{
|
|
| 52 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']); |
|
| 53 |
exit(); |
|
| 54 |
} |
|
| 55 |
*/ |
|
| 56 | 47 |
|
| 57 | 48 |
// After check print the header |
| 58 | 49 |
$admin->print_header(); |
| 50 |
$sBackLink = ADMIN_URL.'/pages/sections.php?page_id='.$iPageId; |
|
| 59 | 51 |
|
| 60 |
$sBackLink = ADMIN_URL.'/pages/sections.php?page_id='.$page_id; |
|
| 61 |
|
|
| 62 | 52 |
// Get perms |
| 63 | 53 |
// Get page details |
| 64 | 54 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` '; |
| 65 |
$sql .= 'WHERE page_id = '.$page_id.''; |
|
| 66 |
|
|
| 67 |
if($oPage = $database->query($sql)){
|
|
| 68 |
$results_array = $oPage->fetchRow(); |
|
| 69 |
} else {
|
|
| 70 |
$admin->print_error($database->get_error()); |
|
| 71 |
$aMsg = array(); |
|
| 72 |
$aMsg[] = $MESSAGE['GENERIC_NOT_UPGRADED']; |
|
| 73 |
if($results->numRows() == 0) {
|
|
| 55 |
$sql .= 'WHERE `page_id`='.$iPageId; |
|
| 56 |
$aMsg = array(); |
|
| 57 |
if(($oPage = $database->query($sql))) {
|
|
| 58 |
if(!$oPage->numRows()) {
|
|
| 74 | 59 |
$aMsg[] = $MESSAGE['PAGES_NOT_FOUND']; |
| 75 |
} |
|
| 60 |
}else {
|
|
| 61 |
if(!($aPage = $oPage->fetchRow())) {
|
|
| 62 |
$aMsg[] = $MESSAGE['PAGES_NOT_FOUND']; |
|
| 63 |
} |
|
| 64 |
} |
|
| 65 |
}else {
|
|
| 76 | 66 |
if($database->is_error()) {
|
| 77 | 67 |
$aMsg[] = $database->get_error(); |
| 78 | 68 |
} |
| 69 |
} |
|
| 70 |
if(sizeof($aMsg)>0) {
|
|
| 71 |
array_unshift($aMsg, $MESSAGE['GENERIC_NOT_UPGRADED']); |
|
| 79 | 72 |
$admin->print_error(implode('<br />',$aMsg), $sBackLink );
|
| 73 |
exit; |
|
| 80 | 74 |
} |
| 81 | 75 |
|
| 82 |
$old_admin_users = explode(',', $results_array['admin_users']);
|
|
| 83 |
$old_admin_groups = explode(',', $results_array['admin_groups']);
|
|
| 84 |
$in_old_group = false; |
|
| 85 |
foreach($admin->get_groups_id() as $cur_gid){
|
|
| 86 |
if (in_array($cur_gid, $old_admin_groups)) {
|
|
| 87 |
$in_old_group = TRUE; |
|
| 88 |
} |
|
| 76 |
if(!$admin->ami_group_member($aPage['admin_users']) && |
|
| 77 |
!$admin->is_group_match($admin->get_groups_id(), $aPage['admin_groups'])) |
|
| 78 |
{
|
|
| 79 |
$admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS'], $sBackLink); |
|
| 89 | 80 |
} |
| 90 |
if((!$in_old_group) && !is_numeric(array_search($admin->get_user_id(), $old_admin_users))) {
|
|
| 91 |
$admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']); |
|
| 92 |
} |
|
| 93 | 81 |
|
| 94 | 82 |
// Set module permissions |
| 95 |
$module_permissions = $_SESSION['MODULE_PERMISSIONS']; |
|
| 83 |
// $module_permissions = $_SESSION['MODULE_PERMISSIONS'];
|
|
| 96 | 84 |
$aMsg = array(); |
| 97 | 85 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'sections` '; |
| 98 |
$sql .= 'WHERE page_id = '.$page_id.' '; |
|
| 99 |
$sql .= 'ORDER BY position ASC'; |
|
| 100 |
|
|
| 86 |
$sql .= 'WHERE `page_id`='.$iPageId.' '; |
|
| 87 |
$sql .= 'ORDER BY `position` ASC'; |
|
| 101 | 88 |
if(!($oSection = $database->query($sql))) {
|
| 102 | 89 |
$aMsg = array(); |
| 103 | 90 |
$aMsg[] = $MESSAGE['GENERIC_NOT_UPGRADED']; |
| ... | ... | |
| 105 | 92 |
$aMsg[] = $database->get_error(); |
| 106 | 93 |
} |
| 107 | 94 |
$admin->print_error(implode('<br />',$aMsg), $sBackLink );
|
| 95 |
exit; |
|
| 108 | 96 |
} |
| 109 | 97 |
|
| 110 |
$aSqlSection = array(); |
|
| 111 |
// Loop through sections and set sql values for update |
|
| 112 |
while($section = $oSection->fetchRow(MYSQL_ASSOC)) {
|
|
| 113 |
|
|
| 114 |
$section_id = $section['section_id']; |
|
| 115 |
$sid = 'wb'.$section_id; |
|
| 116 |
|
|
| 117 |
$dst = date('I') ? ' UTC' : ''; // daylight saving time? date('P')
|
|
| 118 |
|
|
| 119 |
$iBlock = $admin->get_post_escaped('block'.$section_id);
|
|
| 120 |
$iBlock = ($iBlock==null) ? $section['block'] : $iBlock; |
|
| 121 |
|
|
| 122 |
$sStartDate = $admin->get_post_escaped('start_date'.$section_id);;
|
|
| 123 |
$sStartDate = ($sStartDate==null)||($sStartDate=='') ? 0 : jscalendar_to_timestamp($sStartDate)-TIMEZONE; |
|
| 124 |
|
|
| 125 |
$sEndDate = $admin->get_post_escaped('end_date'.$section_id);
|
|
| 126 |
$sEndDate = ($sEndDate==null)||($sEndDate=='') ? 0 : jscalendar_to_timestamp($sEndDate)-TIMEZONE; |
|
| 127 |
|
|
| 128 |
$aSqlSection[$sid][] = 'UPDATE `'.TABLE_PREFIX.'sections` SET '; |
|
| 129 |
$aSqlSection[$sid][] .= '`block`= \''.$iBlock.'\', '; |
|
| 130 |
$aSqlSection[$sid][] .= '`module` = \''.$section['module'].'\', '; |
|
| 131 |
$aSqlSection[$sid][] .= '`publ_start` = \''.$sStartDate.'\','; |
|
| 132 |
$aSqlSection[$sid][] .= '`publ_end` = \''.$sEndDate.'\' '; |
|
| 133 |
$aSqlSection[$sid][] .= 'WHERE `section_id` = \''.$section_id.'\' '; |
|
| 98 |
$aSql = array(); |
|
| 99 |
// Loop through sections and build sql statements for update |
|
| 100 |
while($section = $oSection->fetchRow(MYSQL_ASSOC)) |
|
| 101 |
{
|
|
| 102 |
$section_id = $section['section_id']; |
|
| 103 |
$sid = 'wb'.$section_id; |
|
| 104 |
$dst = date('I') ? ' UTC' : ''; // daylight saving time? date('P')
|
|
| 105 |
$iBlock = $admin->get_post_escaped('block'.$section_id);
|
|
| 106 |
// be sure it's numeric, can failed if block is disabled |
|
| 107 |
$iBlock = (is_numeric($iBlock) ? $iBlock : $section['block']); |
|
| 108 |
//workout set block to default if you add a section |
|
| 109 |
$iBlock = ( ( $iBlock!==0 ) ? $iBlock : '1'); |
|
| 110 |
$sStartDate = $admin->get_post_escaped('start_date'.$section_id);
|
|
| 111 |
$sStartDate = ($sStartDate==null)||($sStartDate=='') ? 0 : jscalendar_to_timestamp($sStartDate)-TIMEZONE; |
|
| 112 |
$sEndDate = $admin->get_post_escaped('end_date'.$section_id);
|
|
| 113 |
$sEndDate = ($sEndDate==null)||($sEndDate=='') ? 0 : jscalendar_to_timestamp($sEndDate)-TIMEZONE; |
|
| 114 |
$aSql[] = 'UPDATE `'.TABLE_PREFIX.'sections` ' |
|
| 115 |
. 'SET `block`=\''.(int)$iBlock.'\', ' |
|
| 116 |
. '`module`=\''.$section['module'].'\', ' |
|
| 117 |
. '`publ_start`=\''.$sStartDate.'\',' |
|
| 118 |
. '`publ_end`=\''.$sEndDate.'\' ' |
|
| 119 |
. 'WHERE `section_id`='.(int)$section_id; |
|
| 134 | 120 |
} |
| 135 |
|
|
| 136 |
foreach( $aSqlSection as $sid ) {
|
|
| 137 |
|
|
| 138 |
$sql = implode('',$sid);
|
|
| 139 |
if(!($oSection = $database->query($sql))) {
|
|
| 140 |
$aMsg = array(); |
|
| 141 |
$aMsg[] = $MESSAGE['GENERIC_NOT_UPGRADED']; |
|
| 142 |
if($database->is_error()) {
|
|
| 143 |
$aMsg[] = $database->get_error(); |
|
| 144 |
} |
|
| 145 |
$admin->print_error(implode('<br />',$aMsg), $sBackLink );
|
|
| 146 |
} |
|
| 121 |
// Update all of the sql statements |
|
| 122 |
foreach( $aSql as $sSql ) {
|
|
| 123 |
if(!$database->query($sSql)) {
|
|
| 124 |
$aMsg = array(); |
|
| 125 |
$aMsg[] = $MESSAGE['GENERIC_NOT_UPGRADED']; |
|
| 126 |
if($database->is_error()) {
|
|
| 127 |
$aMsg[] = $database->get_error(); |
|
| 128 |
} |
|
| 129 |
$admin->print_error(implode('<br />',$aMsg), $sBackLink );
|
|
| 130 |
} |
|
| 147 | 131 |
} |
| 148 | 132 |
|
| 149 | 133 |
$admin->print_success($MESSAGE['PAGES_SECTIONS_PROPERTIES_SAVED'], $sBackLink ); |
| 150 |
|
|
| 151 | 134 |
// Print admin footer |
| 152 | 135 |
$admin->print_footer(); |
| branches/2.8.x/wb/admin/pages/modify.php | ||
|---|---|---|
| 210 | 210 |
$section_id = $section['section_id']; |
| 211 | 211 |
$module = $section['module']; |
| 212 | 212 |
//Have permission? |
| 213 |
if(!is_numeric(array_search($module, $module_permissions))) |
|
| 214 |
{
|
|
| 213 |
if(!is_numeric(array_search($module, $module_permissions))) {
|
|
| 215 | 214 |
// Include the modules editing script if it exists |
| 216 |
if(file_exists(WB_PATH.'/modules/'.$module.'/modify.php')) |
|
| 217 |
{
|
|
| 215 |
if(file_exists(WB_PATH.'/modules/'.$module.'/modify.php')) {
|
|
| 218 | 216 |
print /* '<a name="'.$section_id.'"></a>'. */"\n"; |
| 219 | 217 |
// output block name if blocks are enabled |
| 220 |
if (SECTION_BLOCKS) {
|
|
| 221 |
if (isset($block[$section['block']]) && trim(strip_tags(($block[$section['block']]))) != '') |
|
| 222 |
{
|
|
| 218 |
// if (SECTION_BLOCKS) {
|
|
| 219 |
if (isset($block[$section['block']]) && trim(strip_tags(($block[$section['block']]))) != '') {
|
|
| 223 | 220 |
$block_name = htmlentities(strip_tags($block[$section['block']])); |
| 224 | 221 |
} else {
|
| 225 |
if ($section['block'] == 1) |
|
| 226 |
{
|
|
| 222 |
if ($section['block'] == 1) {
|
|
| 227 | 223 |
$block_name = $TEXT['MAIN']; |
| 228 | 224 |
} else {
|
| 229 | 225 |
$block_name = '#' . (int) $section['block']; |
| 230 | 226 |
} |
| 231 | 227 |
} |
| 232 |
|
|
| 233 |
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' ) ? 'id="'.SEC_ANCHOR.$section['section_id'].'"' : 'section_'.$section_id); |
|
| 228 |
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' ) ? 'id="'.SEC_ANCHOR.$section['section_id'].'"' : 'section_'.$section_id); |
|
| 234 | 229 |
print '<div class="section-info" '.$sec_anchor.' ><b>' . $TEXT['BLOCK'] . ': </b>' . $block_name; |
| 235 | 230 |
print '<b> Modul: </b>' . $section['module']." "; |
| 236 | 231 |
print '<b> ID: </b>' . $section_id."</div>\n"; |
| 237 |
|
|
| 238 |
} |
|
| 232 |
// } |
|
| 239 | 233 |
require(WB_PATH.'/modules/'.$module.'/modify.php'); |
| 240 | 234 |
} |
| 241 | 235 |
} |
| 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', '1888');
|
|
| 54 |
if(!defined('REVISION')) define('REVISION', '1889');
|
|
| 55 | 55 |
if(!defined('SP')) define('SP', '');
|
| branches/2.8.x/wb/framework/WbDatabase.php | ||
|---|---|---|
| 41 | 41 |
private $_db_handle = null; // readonly from outside |
| 42 | 42 |
private $_db_name = ''; |
| 43 | 43 |
protected $sTablePrefix = ''; |
| 44 |
protected $sCharset = 'utf8';
|
|
| 44 |
protected $sCharset = ''; |
|
| 45 | 45 |
protected $connected = false; |
| 46 | 46 |
protected $error = ''; |
| 47 | 47 |
protected $error_type = ''; |
| ... | ... | |
| 489 | 489 |
// Run a query |
| 490 | 490 |
function query($statement, $dbHandle) {
|
| 491 | 491 |
$this->_db_handle = $dbHandle; |
| 492 |
$this->result = mysql_query($statement, $this->_db_handle); |
|
| 492 |
$this->result = @mysql_query($statement, $this->_db_handle); |
|
| 493 |
if($this->result === false) {
|
|
| 494 |
if(DEBUG) {
|
|
| 495 |
throw new WbDatabaseException(mysql_error($this->_db_handle)); |
|
| 496 |
}else{
|
|
| 497 |
throw new WbDatabaseException('Error in SQL-Statement');
|
|
| 498 |
} |
|
| 499 |
} |
|
| 493 | 500 |
$this->error = mysql_error($this->_db_handle); |
| 494 | 501 |
return $this->result; |
| 495 | 502 |
} |
| branches/2.8.x/wb/framework/initialize.php | ||
|---|---|---|
| 142 | 142 |
$db['port'] = isset($db['port']) ? $db['port'] : '3306'; |
| 143 | 143 |
$db['port'] = ($db['port'] != '3306') ? $db['port'] : ''; |
| 144 | 144 |
$db['name'] = isset($db['name']) ? $db['name'] : 'dummy'; |
| 145 |
$db['charset'] = isset($db['charset']) ? $db['charset'] : 'utf8';
|
|
| 145 |
$db['charset'] = isset($db['charset']) ? trim($db['charset']) : '';
|
|
| 146 | 146 |
$db['table_prefix'] = (isset($db['table_prefix']) ? $db['table_prefix'] : ''); |
| 147 | 147 |
if(!defined('TABLE_PREFIX')) { define('TABLE_PREFIX', $db['table_prefix']); }
|
| 148 | 148 |
if($sRetvalType == 'dsn') {
|
| branches/2.8.x/wb/framework/class.wb.php | ||
|---|---|---|
| 86 | 86 |
* @return array Associative array containing the different components |
| 87 | 87 |
* |
| 88 | 88 |
*/ |
| 89 |
public function mb_parse_url($url) {
|
|
| 90 |
$encodedUrl = preg_replace('%[^:/?#&=\.]+%usDe', 'urlencode(\'$0\')', $url);
|
|
| 91 |
$components = parse_url($encodedUrl); |
|
| 92 |
foreach ($components as &$component) |
|
| 93 |
$component = urldecode($component); |
|
| 94 |
return $components; |
|
| 89 |
public function mb_parse_url($url) {
|
|
| 90 |
$encodedUrl = preg_replace_callback('%[^:/?#&=\.]+%usD',
|
|
| 91 |
create_function('$aMatches', ';return urlencode($aMatches[0]);'),
|
|
| 92 |
/* 'urlencode(\'$0\')', */ |
|
| 93 |
$url); |
|
| 94 |
$components = parse_url($encodedUrl); |
|
| 95 |
foreach ($components as &$component) |
|
| 96 |
$component = urldecode($component); |
|
| 97 |
return $components; |
|
| 95 | 98 |
} |
| 96 | 99 |
|
| 97 | 100 |
/* **************** |
| ... | ... | |
| 107 | 110 |
{
|
| 108 | 111 |
if( $groups_list1 == '' ) { return false; }
|
| 109 | 112 |
if( $groups_list2 == '' ) { return false; }
|
| 110 |
if( !is_array($groups_list1) ) |
|
| 111 |
{
|
|
| 113 |
if( !is_array($groups_list1) ) {
|
|
| 112 | 114 |
$groups_list1 = explode(',', $groups_list1);
|
| 113 | 115 |
} |
| 114 |
if( !is_array($groups_list2) ) |
|
| 115 |
{
|
|
| 116 |
if( !is_array($groups_list2) ) {
|
|
| 116 | 117 |
$groups_list2 = explode(',', $groups_list2);
|
| 117 | 118 |
} |
| 118 | 119 |
$matches = array_intersect( $groups_list1, $groups_list2); |
| branches/2.8.x/wb/framework/UpgradeHelper.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
/** |
|
| 4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
|
| 5 |
* |
|
| 6 |
* This program is free software: you can redistribute it and/or modify |
|
| 7 |
* it under the terms of the GNU General Public License as published by |
|
| 8 |
* the Free Software Foundation, either version 3 of the License, or |
|
| 9 |
* (at your option) any later version. |
|
| 10 |
* |
|
| 11 |
* This program is distributed in the hope that it will be useful, |
|
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 14 |
* GNU General Public License for more details. |
|
| 15 |
* |
|
| 16 |
* You should have received a copy of the GNU General Public License |
|
| 17 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 18 |
*/ |
|
| 19 |
|
|
| 20 |
/** |
|
| 21 |
* UpgradeHelper.php |
|
| 22 |
* |
|
| 23 |
* @category Core |
|
| 24 |
* @package Core_Upgrade |
|
| 25 |
* @copyright Werner v.d.Decken <wkl@isteam.de> |
|
| 26 |
* @author Werner v.d.Decken <wkl@isteam.de> |
|
| 27 |
* @license http://www.gnu.org/licenses/gpl.html GPL License |
|
| 28 |
* @version 0.0.1 |
|
| 29 |
* @revision $Revision: $ |
|
| 30 |
* @link $HeadURL: $ |
|
| 31 |
* @lastmodified $Date: $ |
|
| 32 |
* @since File available since 17.03.2013 |
|
| 33 |
* @description some helper function for upgrade-script.php |
|
| 34 |
*/ |
|
| 35 |
class UpgradeHelper {
|
|
| 36 |
|
|
| 37 |
public static function existsAllTables(array $aPackage) |
|
| 38 |
{
|
|
| 39 |
$aPackage = array_flip($aPackage); |
|
| 40 |
$oDb = WbDatabase::getInstance(); |
|
| 41 |
$sPattern = addcslashes ( $oDb->TablePrefix, '%_' ); |
|
| 42 |
if(($oTables = $oDb->query( 'SHOW TABLES LIKE "'.$sPattern.'%"'))) {
|
|
| 43 |
while($aTable = $oTables->fetchRow(MYSQL_NUM)) {
|
|
| 44 |
$sTable = preg_replace('/^'.preg_quote($oDb->TablePrefix, '/').'/s', '', $aTable[0]);
|
|
| 45 |
if(isset($aPackage[$sTable])) {
|
|
| 46 |
unset($aPackage[$sTable]); |
|
| 47 |
} |
|
| 48 |
} |
|
| 49 |
} |
|
| 50 |
return array_flip($aPackage); |
|
| 51 |
} |
|
| 52 |
|
|
| 53 |
|
|
| 54 |
} // end of class UpgradeHelper |
|
| 55 |
|
|
| branches/2.8.x/wb/install/sql/websitebaker.sql | ||
|---|---|---|
| 83 | 83 |
`page_id` int(11) NOT NULL DEFAULT '0', |
| 84 | 84 |
`position` int(11) NOT NULL DEFAULT '0', |
| 85 | 85 |
`module` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
|
| 86 |
`block` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
|
|
| 87 |
`publ_start` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '0',
|
|
| 88 |
`publ_end` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '0',
|
|
| 86 |
`block` int(11) NOT NULL DEFAULT '1',
|
|
| 87 |
`publ_start` int(11) NOT NULL DEFAULT '0',
|
|
| 88 |
`publ_end` int(11) NOT NULL DEFAULT '0',
|
|
| 89 | 89 |
PRIMARY KEY (`section_id`) |
| 90 | 90 |
) {TABLE_ENGINE};
|
| 91 | 91 |
-- |
| branches/2.8.x/wb/modules/admin.php | ||
|---|---|---|
| 199 | 199 |
// unset($print_info_banner); |
| 200 | 200 |
unset($template); |
| 201 | 201 |
|
| 202 |
if (SECTION_BLOCKS) {
|
|
| 203 |
if (isset($block[$section['block']]) && trim(strip_tags(($block[$section['block']]))) != '') |
|
| 204 |
{
|
|
| 202 |
// if (SECTION_BLOCKS) {
|
|
| 203 |
if (isset($block[$section['block']]) && trim(strip_tags(($block[$section['block']]))) != '') {
|
|
| 205 | 204 |
$block_name = htmlentities(strip_tags($block[$section['block']])); |
| 206 | 205 |
} else {
|
| 207 | 206 |
if ($section['block'] == 1) {
|
| ... | ... | |
| 210 | 209 |
$block_name = '#' . (int) $section['block']; |
| 211 | 210 |
} |
| 212 | 211 |
} |
| 213 |
|
|
| 214 |
$sec_anchor = '#'.(defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' ) ? SEC_ANCHOR.$section_id : 'section_'.$section_id ); |
|
| 212 |
$sec_anchor = '#'.(defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' ) ? SEC_ANCHOR.$section_id : 'section_'.$section_id ); |
|
| 215 | 213 |
//print '<div class="section-info" ><b>' . $TEXT['BLOCK'] . ': </b>' . $block_name; |
| 216 | 214 |
print '<div class="section-info" '.$sec_anchor.' ><b>' . $TEXT['BLOCK'] . ': </b>' . $block_name; |
| 217 | 215 |
print '<b> Modul: </b>' . $section['module']." "; |
| 218 | 216 |
print '<b> ID: </b>' . $section_id."</div>\n"; |
| 219 |
} |
|
| 220 |
|
|
| 217 |
// } |
|
| 221 | 218 |
} // |
| 222 | 219 |
|
| 223 | 220 |
// Work-out if the developer wants us to update the timestamp for when the page was last modified |
Also available in: Unified diff
! update sections table change some varchar to int(11)
+ upgradeHelper class for better module upgrade