Project

General

Profile

« Previous | Next » 

Revision 1759

Added by Dietmar about 12 years ago

! during Reformat/rebuild all existing access files in upgrade-script
root_parent will be set to page_id
! change multi-dimensional arrays (variables) to similar arrays in framework/functions.php

View differences:

branches/2.8.x/CHANGELOG
13 13

  
14 14

  
15 15

  
16
17 Sep-2012 Build 1759 Dietmar Woellbrink (Luisehahne)
17
! during Reformat/rebuild all existing access files in upgrade-script
18
  root_parent will be set to page_id
19
! change multi-dimensional arrays (variables) to similar arrays in framework/functions.php
16 20
16 Sep-2012 Build 1758 Dietmar Woellbrink (Luisehahne)
17 21
! forgot to upload the install.php from wysiwyg modul in Revision 1756
18 22
! correcting some more SEC_ANCHOR 
branches/2.8.x/wb/upgrade-script.php
446 446
/**********************************************************
447 447
 *  - Adding page_extended to settings table
448 448
 */
449
echo "Adding/updating ppage_extended to settings table";
449
echo "Adding/updating page_extended to settings table";
450 450
$cfg = array(
451 451
	'page_extended' => (defined('PAGE_EXTENDED') ? PAGE_EXTENDED : 'true'),
452 452
);
......
654 654
 ALTER TABLE `wb_pages` CHANGE `page_icon` `page_icon` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''
655 655
 */
656 656
	$dir = (WB_PATH.MEDIA_DIRECTORY);
657
	echo '<h4>Upgrade '.MEDIA_DIRECTORY.'/ index.php protect files</h4><br />';
657
	echo '<h4>Upgrade '.MEDIA_DIRECTORY.'/ index.php protect files</h4>';
658 658
	$array = rebuildFolderProtectFile($dir);
659 659
	if( sizeof( $array ) ){
660
		print '<br /><strong>Upgrade '.sizeof( $array ).' '.MEDIA_DIRECTORY.'/ protect files</strong>'." $OK<br />";
660
		print '<strong>Upgrade '.sizeof( $array ).' '.MEDIA_DIRECTORY.'/ protect files</strong>'." $OK<br />";
661 661
	} else {
662
		print '<br /><strong>Upgrade '.MEDIA_DIRECTORY.'/ protect files</strong>'." $FAIL!<br />";
662
		print '<<strong>Upgrade '.MEDIA_DIRECTORY.'/ protect files</strong>'." $FAIL!<br />";
663 663
		print implode ('<br />',$array);
664 664
	}
665 665

  
666 666
/**********************************************************
667 667
 * upgrade pages folder index access files
668 668
 */
669
	echo '<h4>Upgrade /pages/ index.php access files</h4><br />';
669
	echo '<h4>Upgrade /pages/ index.php access files</h4>';
670 670

  
671 671
    ///**********************************************************
672 672
    // *  - try to remove access files
......
674 674
	$sTempDir = (defined('PAGES_DIRECTORY') && (PAGES_DIRECTORY != '') ? PAGES_DIRECTORY : '');
675 675
	if(($sTempDir!='') && is_readable(WB_PATH.$sTempDir)==true) {
676 676
	 	if(rm_full_dir (WB_PATH.$sTempDir, true )==false) {
677
			$msg[] = '<strong>Could not delete existing access files</strong><br />';
677
			$msg[] = '<strong>Could not delete existing access files</strong>';
678 678
	 	} else {
679 679
			$msg[] = createFolderProtectFile(rtrim( WB_PATH.$sTempDir,'/') );
680 680
        }
......
684 684
    // *  - Reformat/rebuild all existing access files
685 685
    // */
686 686
    $msg[] = "All existing access files anew format";
687
    $sql = 'SELECT `page_id`,`link`, `level` FROM `'.TABLE_PREFIX.'pages` ORDER BY `link`';
688
    if (($res_pages = $database->query($sql)))
687
    $sql = 'SELECT `page_id`,`root_parent`,`link`, `level` FROM `'.TABLE_PREFIX.'pages` ORDER BY `link`';
688
    if (($oPage = $database->query($sql)))
689 689
    {
690 690
        $x = 0;
691
        while (($rec_page = $res_pages->fetchRow()))
691
        while (($page = $oPage->fetchRow(MYSQL_ASSOC)))
692 692
        {
693
            $filename = WB_PATH.PAGES_DIRECTORY.$rec_page['link'].PAGE_EXTENSION;
694
            $msg = create_access_file($filename, $rec_page['page_id'], $rec_page['level']);
693
            $sql = 'UPDATE `'.TABLE_PREFIX.'pages` '
694
                 . 'SET `root_parent`='.$page['page_id'].' WHERE page_id = '.$page['page_id'];
695
            if(!$database->query($sql)) {}
696
            $filename = WB_PATH.PAGES_DIRECTORY.$page['link'].PAGE_EXTENSION;
697
            $msg = create_access_file($filename, $page['page_id'], $page['level']);
695 698
            $x++;
696 699
        }
697
        $msg[] = '<strong>Number of the anew formatted access files: '.$x.'</strong><br />';
700
        $msg[] = '<strong>Number of new formatted access files: '.$x.'</strong>';
698 701
    }
699 702

  
700 703
	print implode ('<br />',$msg);
......
712 715
 * upgrade posts folder index protect files
713 716
 */
714 717
	$sPostsPath = WB_PATH.PAGES_DIRECTORY.'/posts';
715
	echo '<h4>Upgrade /posts/ index.php protect files</h4><br />';
718
	echo '<h4>Upgrade /posts/ index.php protect files</h4>';
716 719
	$array = rebuildFolderProtectFile($sPostsPath);
717 720
	if( sizeof( $array ) ){
718
		print '<br /><strong>Upgrade '.sizeof( $array ).' /posts/ protect files</strong>'." $OK<br />";
721
		print '<strong>Upgrade '.sizeof( $array ).' /posts/ protect files</strong>'." $OK<br />";
719 722
	} else {
720
		print '<br /><strong>Upgrade /posts/ protect files</strong>'." $FAIL!<br />";
723
		print '<strong>Upgrade /posts/ protect files</strong>'." $FAIL!<br />";
721 724
		print implode ('<br />',$array);
722 725
	}
723 726

  
......
851 854
		}
852 855
		closedir($handle);
853 856
	}
854
	echo '<br />Modules reloaded<br />';
857
	echo '<strong><br />Modules reloaded<br /></strong>';
855 858

  
856 859
	////delete templates
857 860
	//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
......
864 867
		}
865 868
		closedir($handle);
866 869
	}
867
	echo '<br />Templates reloaded<br />';
870
	echo '<strong><br />Templates reloaded<br /></strong>';
868 871

  
869 872
	////delete languages
870 873
	//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
......
877 880
		}
878 881
		closedir($handle);
879 882
	}
880
	echo '<br />Languages reloaded<br />';
883
	echo '<strong><br />Languages reloaded<br /></strong>';
881 884

  
882 885
/**********************************************************
883 886
 *  - install new droplets
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', '1758');
54
if(!defined('REVISION')) define('REVISION', '1759');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/framework/functions.php
410 410
	$retVal = false;
411 411
	if(!is_dir($dir_name))
412 412
    {
413
		// To create the folder with 0777 permissions, we need to set umask to zero.
414
		$oldumask = umask(0) ;
413 415
		$retVal = mkdir($dir_name, $dir_mode,$recursive);
416
		umask( $oldumask ) ;
414 417
	}
415 418
	return $retVal;
416 419
}
......
425 428
function change_mode($sName, $iMode = 0)
426 429
{
427 430
	$bRetval = true;
431
    $iErrorReporting = error_reporting(0);
428 432
	$iMode = intval($iMode) & 0777; // sanitize value
429 433
	if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
430 434
	{ // Only chmod if os is not windows
......
437 441
			$bRetval = chmod($sName, $iMode);
438 442
		}
439 443
	}
444
    error_reporting($iErrorReporting);
440 445
	return $bRetval;
441 446
}
442 447

  
......
480 485
	$sql = 'SELECT `parent`, `level` FROM `'.TABLE_PREFIX.'pages` WHERE `page_id` = '.$page_id;
481 486

  
482 487
	$query_page = $database->query($sql);
483
	$fetch_page = $query_page->fetchRow();
488
	$fetch_page = $query_page->fetchRow(MYSQL_ASSOC);
484 489
	$parent = $fetch_page['parent'];
485 490
	$level = $fetch_page['level'];
486 491
	if($level == 1) {
......
549 554
	// Get id's
550 555
	$sql = 'SELECT `page_id` FROM `'.TABLE_PREFIX.'pages` WHERE `parent` = '.$parent;
551 556
	if( ($query = $database->query($sql)) ) {
552
		while($fetch = $query->fetchRow()) {
557
		while($fetch = $query->fetchRow(MYSQL_ASSOC)) {
553 558
			$subs[] = $fetch['page_id'];
554 559
			// Get subs of this sub recursive
555 560
			$subs = get_subs($fetch['page_id'], $subs);
......
735 740
			// can only be dirs
736 741
			if(!file_exists($acces_file)) {
737 742
				if(!make_dir($acces_file)) {
738
					$admin->print_error($MESSAGE['PAGES']['CANNOT_CREATE_ACCESS_FILE_FOLDER']);
743
					$admin->print_error($MESSAGE['PAGES_CANNOT_CREATE_ACCESS_FILE_FOLDER']);
739 744
				}
740 745
			}
741 746
		}
......
765 770
		// Chmod the file
766 771
		change_mode($filename);
767 772
	} else {
768
		$admin->print_error($MESSAGE['PAGES']['CANNOT_CREATE_ACCESS_FILE']);
773
		$admin->print_error($MESSAGE['PAGES_CANNOT_CREATE_ACCESS_FILE']);
769 774
	}
770 775
	return;
771 776
 }
......
944 949
		$sql .= 'FROM `'.TABLE_PREFIX.'pages` WHERE `page_id`='.$page_id;
945 950
		$results = $database->query($sql);
946 951
		if($database->is_error())    { $admin->print_error($database->get_error()); }
947
		if($results->numRows() == 0) { $admin->print_error($MESSAGE['PAGES']['NOT_FOUND']); }
948
		$results_array = $results->fetchRow();
952
		if($results->numRows() == 0) { $admin->print_error($MESSAGE['PAGES_NOT_FOUND']); }
953
		$results_array = $results->fetchRow(MYSQL_ASSOC);
949 954
		$parent     = $results_array['parent'];
950 955
		$level      = $results_array['level'];
951 956
		$link       = $results_array['link'];
......
989 994
		if(file_exists($filename))
990 995
		{
991 996
			if(!is_writable(WB_PATH.PAGES_DIRECTORY.'/')) {
992
				$admin->print_error($MESSAGE['PAGES']['CANNOT_DELETE_ACCESS_FILE']);
997
				$admin->print_error($MESSAGE['PAGES_CANNOT_DELETE_ACCESS_FILE']);
993 998
			}else {
994 999
				unlink($filename);
995 1000
				if( file_exists($directory) &&

Also available in: Unified diff