Project

General

Profile

« Previous | Next » 

Revision 1890

Added by Dietmar over 11 years ago

  1. bugfix and update form module set version to 2.9.1
    ! update code module set version to 2.8.4
    ! update wysiwyg module set version to 2.9.1

View differences:

branches/2.8.x/CHANGELOG
13 13

  
14 14

  
15 15

  
16
19 Mar-2013 Build 1890 Dietmar Woellbrink (Luisehahne)
17
# bugfix and update form module set version to 2.9.1 
18
! update code module set version to 2.8.4 
19
! update wysiwyg module set version to 2.9.1 
16 20
19 Mar-2013 Build 1889 Dietmar Woellbrink (Luisehahne)
17 21
# bugfix solved sections block update
18 22
! update sections table change some varchar to int(11)
branches/2.8.x/wb/upgrade-script.php
691 691
    if($bDebugModus) {
692 692
        echo implode(PHP_EOL,$aDebugMessage);
693 693
    }
694
    echo '</div>';
695
}
694 696

  
695
	$aDebugMessage = array();
696
	/**********************************************************
697
     *   `confirm_code` VARCHAR(32) NOT NULL DEFAULT '',
698
     *   `confirm_timeout` INT(11) NOT NULL DEFAULT '0',
699
     */
700
	echo "<h4>Change field structure on table users</h4>";
701
	$table_name = TABLE_PREFIX.'users';
702
	$field_name = 'confirm_code';
703
	$description = "VARCHAR( 32 ) NOT NULL DEFAULT '' AFTER `password` ";
704
    add_modify_field_in_database($table_name,$field_name,$description);
705

  
706
	$table_name = TABLE_PREFIX.'users';
707
	$field_name = 'confirm_timeout';
708
	$description = "INT(11) NOT NULL DEFAULT '0' AFTER `confirm_code` ";
709
    add_modify_field_in_database($table_name,$field_name,$description);
710

  
711
    if($bDebugModus) {
712
        echo implode(PHP_EOL,$aDebugMessage);
713
    }
714

  
697
if(version_compare(WB_REVISION, REVISION, '<='))
698
{
715 699
    $aDebugMessage = array();
700
    echo '<h3>Step '.(++$stepID).': Updating structure in table users/groups</h3>';
716 701
	/**********************************************************
717
     * Modify Administrator on groups table
718
     */
702
	 * Modify Administrator on groups table
703
	 */
704
	echo '<div style="margin-left:2em;">';
719 705
	echo "<h4>Update group Administrator on table groups</h4>";
720 706
	$aDebugMessage[] = "<span>Modify Administrator on groups table</span>";
721 707
	$sModulePermissions = '';
......
741 727
    }
742 728
    echo '</div>';
743 729

  
744
}
730
    /**********************************************************
731
	$aDebugMessage = array();
732
	/**********************************************************
733
 *   `confirm_code` VARCHAR(32) NOT NULL DEFAULT '',
734
 *   `confirm_timeout` INT(11) NOT NULL DEFAULT '0',
735
 */
736
	echo '<div style="margin-left:2em;">';
737
	echo "<h4>Change field structure on table users</h4>";
738
	$table_name = TABLE_PREFIX.'users';
739
	$field_name = 'confirm_code';
740
	$description = "VARCHAR( 32 ) NOT NULL DEFAULT '' AFTER `password` ";
741
    add_modify_field_in_database($table_name,$field_name,$description);
745 742

  
746
if(version_compare(WB_REVISION, REVISION, '<'))
747
{
743
	$table_name = TABLE_PREFIX.'users';
744
	$field_name = 'confirm_timeout';
745
	$description = "INT(11) NOT NULL DEFAULT '0' AFTER `confirm_code` ";
746
    add_modify_field_in_database($table_name,$field_name,$description);
747

  
748
    if($bDebugModus) {
749
        echo implode(PHP_EOL,$aDebugMessage);
750
    }
751
    echo '</div>';
748 752
    $aDebugMessage = array();
749
    echo '<h3>Step '.(++$stepID).': Updating group_id in table users</h3>';
750
    /**********************************************************
753

  
754
   /**********************************************************
751 755
    * Updating group_id in table users
752 756
    */
753
        echo '<div style="margin-left:2em;">';
757
	echo '<div style="margin-left:2em;">';
758
	echo "<h4>Change field structure on table users</h4>";
754 759
        $aUsers = array();
755 760
		// Get existing values
756 761
        $sql  = 'SELECT * FROM `'.TABLE_PREFIX.'users` ' ;
......
784 789
                $aDebugMessage[] = $database->is_error()==false ? $sMessage." $OK<br />" : $sMessage." $FAIL!<br />";
785 790
        }
786 791
        unset($aUsers);
787

  
788 792
    $aDebugMessage[] = '</div>';
789 793

  
790 794
    if($bDebugModus) {
......
966 970
	 * $aModuleList list of proofed modules
967 971
	 */
968 972
//	$aModuleList = array('wysiwyg','news','form','captcha_control','output_filter');
969
	$aModuleList = array('wysiwyg','form');
973
	$aModuleList = array('wysiwyg','form','code');
970 974
	if(sizeof($aModuleList)) 
971 975
	{
972
	    echo '<h3>Step '.(++$stepID).': Upgrade proofed modules</h3>';
976
		echo '<h3>Step '.(++$stepID).': Upgrade proofed modules</h3>';
973 977
		foreach($aModuleList as $sModul) {
974 978
			if(file_exists(WB_PATH.'/modules/'.$sModul.'/upgrade.php')) {
975 979
				$currModulVersion = get_modul_version ($sModul, false);
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', '1889');
54
if(!defined('REVISION')) define('REVISION', '1890');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/modules/wysiwyg/info.php
4 4
 * @category        modules
5 5
 * @package         wysiwyg
6 6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2012, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker2.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10 10
 * @platform        WebsiteBaker 2.8.3
11 11
 * @requirements    PHP 5.2.2 and higher
12 12
 * @version         $Id$
13
 * @filesource		$HeadURL$
13
 * @filesource      $HeadURL$
14 14
 * @lastmodified    $Date$
15 15
 *
16 16
 */
......
24 24
$module_directory = 'wysiwyg';
25 25
$module_name = 'WYSIWYG';
26 26
$module_function = 'page';
27
$module_version = '2.9.0';
28
$module_platform = '2.8.2';
27
$module_version = '2.9.1';
28
$module_platform = '2.8.4';
29 29
$module_author = 'Ryan Djurovich';
30 30
$module_license = 'GNU General Public License';
31 31
$module_description = 'This module allows you to edit the contents of a page using a graphical editor';
32 32

  
branches/2.8.x/wb/modules/wysiwyg/install.php
22 22
} else {
23 23
	// Create table
24 24

  
25
$database->SqlImport(dirname(__FILE__).'/sql/mod_wysiwyg.sql',TABLE_PREFIX,false);
25
$database->SqlImport(dirname(__FILE__).'/sql/mod_wysiwyg.sql','',false);
26 26

  
27 27
// remove old version of search (deprecated)
28 28

  
branches/2.8.x/wb/modules/wysiwyg/upgrade.php
5 5
 * @package         wysiwyg
6 6
 * @author          WebsiteBaker Project
7 7
 * @copyright       2009-2012, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
8
 * @link            http://www.websitebaker2.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10 10
 * @platform        WebsiteBaker 2.8.3
11 11
 * @requirements    PHP 5.2.2 and higher
12
 * @version      	$Id$
13
 * @filesource		$HeadURL$
12
 * @version         $Id$
13
 * @filesource      $HeadURL$
14 14
 * @lastmodified    $Date$
15 15
 *
16 16
 */
......
22 22
}
23 23
/* -------------------------------------------------------- */
24 24

  
25
if(!function_exists('mod_wysiwyg_upgrade'))
26
{
27
	function mod_wysiwyg_upgrade () {
28
		global $database,$bDebugModus;
25
	function mod_wysiwyg_upgrade ($bDebug=false) {
26
		global $OK ,$FAIL;
27
		$database=WbDatabase::getInstance();
28
		$msg = array();
29 29
		$callingScript = $_SERVER["SCRIPT_NAME"];
30 30
		// check if upgrade startet by upgrade-script to echo a message
31 31
		$tmp = 'upgrade-script.php';
32 32
		$globalStarted = substr_compare($callingScript, $tmp,(0-strlen($tmp)),strlen($tmp)) === 0;
33

  
34
		$msg = array();
33
// check for missing tables, if true stop the upgrade
35 34
		$aTable = array('mod_wysiwyg');
36
		for($x=0; $x<sizeof($aTable);$x++) {
37
			if(($sOldType = $database->getTableEngine(TABLE_PREFIX.$aTable[$x]))) {
38
				if(('myisam' != strtolower($sOldType))) {
39
					if(!$database->query('ALTER TABLE `'.TABLE_PREFIX.$aTable[$x].'` Engine = \'MyISAM\' ')) {
40
						$msg[] = $database->get_error();
41
					} else{
42
						$msg[] = 'TABLE `'.TABLE_PREFIX.$aTable[$x].'` changed to Engine = \'MyISAM\'';
35
		$aPackage = UpgradeHelper::existsAllTables($aTable);
36
		if( sizeof($aPackage) > 0){
37
			$msg[] =  'TABLE '.implode(' missing! '.$FAIL.'<br />TABLE ',$aPackage).' missing! '.$FAIL;
38
			$msg[] = 'WYSIWYG upgrade failed '." $FAIL";
39
			if($globalStarted) {
40
				echo '<strong>'.implode('<br />',$msg).'</strong><br />';
41
			}
42
			return ( ($globalStarted==true ) ? $globalStarted : $msg);
43
		} else {
44
			for($x=0; $x<sizeof($aTable);$x++) {
45
				if(($sOldType = $database->getTableEngine($database->TablePrefix.$aTable[$x]))) {
46
					if(('myisam' != strtolower($sOldType))) {
47
						if(!$database->query('ALTER TABLE `'.$database->TablePrefix.$aTable[$x].'` Engine = \'MyISAM\' ')) {
48
							$msg[] = $database->get_error();
49
						} else{
50
							$msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` changed to Engine = \'MyISAM\''." $OK";
51
						}
52
					} else {
53
						 $msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` has Engine = \'MyISAM\''." $OK";
43 54
					}
44 55
				} else {
45
					 $msg[] = 'TABLE `'.TABLE_PREFIX.$aTable[$x].'` has Engine = \'MyISAM\'';
56
					$msg[] = $database->get_error();
46 57
				}
58
			}
59
// add change or missing index
60
			$sTable = $database->TablePrefix.'mod_wysiwyg';
61
			if($database->index_exists($sTable, 'PRIMARY')) {
62
				$sql = 'ALTER TABLE `'.$database->DbName.'`.`'.$sTable.'` DROP PRIMARY KEY';
63
				if(!$database->query($sql)) {
64
					$msg[] = ''.$database->get_error();
65
				}
66
			}
67
			if(!$database->index_add($sTable, '', 'section_id', 'PRIMARY')) {
68
				$msg[] = ''.$database->get_error();
47 69
			} else {
48
				$msg[] = $database->get_error();
70
				$msg[] = 'Create PRIMARY KEY ( `section_id` )'." $OK";
49 71
			}
50
		}
51

  
52
		$sTable = TABLE_PREFIX.'mod_wysiwyg';
53
		if($database->index_exists($sTable, 'PRIMARY')) {
54
			$sql = 'ALTER TABLE `'.$database->DbName.'`.`'.$sTable.'` DROP PRIMARY KEY';
55
			if(!$database->query($sql)) {
56
			    $msg[] = ''.$database->get_error().'';
72
// change table structure
73
			$sTable = $database->TablePrefix.'mod_wysiwyg';
74
			$sDescription = 'LONGTEXT NOT NULL';
75
			$sFieldName = 'text';
76
			if(!$database->field_modify($sTable,$sFieldName,$sDescription)) {
77
				$msg[] = ''.$database->get_error();
78
			} else {
79
				$msg[] = 'Field ( `text` ) description has been changed successfully'." $OK";
57 80
			}
58
		}
59

  
60
		if(!$database->index_add($sTable, '', 'section_id', 'PRIMARY')) {
61
			$msg[] = ''.$database->get_error().'';
62
		} else {
63
		    $msg[] = 'Create PRIMARY KEY ( `section_id` )';
64
		}
65

  
66
		// change internal absolute links into relative links
67
		$sTable = TABLE_PREFIX.'mod_wysiwyg';
68
		$sql  = 'UPDATE `'.$sTable.'` ';
69
		$sql .= 'SET `content` = REPLACE(`content`, \'"'.WB_URL.MEDIA_DIRECTORY.'\', \'"{SYSVAR:MEDIA_REL}\')';
70
		if (!$database->query($sql)) {
71
			$msg[] = ''.$database->get_error().'';
72
		} else {
73
		    $msg[] = 'Change internal absolute links into relative links';
74
		}
75
		// only for $callingScript upgrade-script.php
76
		if($globalStarted) {
77
			if($bDebugModus) {
78
				foreach($msg as $title) {
79
				    echo '<strong>'.$title.'</strong><br />';
81
			$sFieldName = 'content';
82
			if(!$database->field_modify($sTable,$sFieldName,$sDescription)) {
83
				$msg[] = ''.$database->get_error();
84
			} else {
85
				$msg[] = 'Field ( `content` ) description has been changed successfully'." $OK";
86
			}
87
// change internal absolute links into relative links
88
			$sTable = $database->TablePrefix.'mod_wysiwyg';
89
			$sql  = 'UPDATE `'.$sTable.'` ';
90
			$sql .= 'SET `content` = REPLACE(`content`, \'"'.WB_URL.MEDIA_DIRECTORY.'\', \'"{SYSVAR:MEDIA_REL}\')';
91
			if (!$database->query($sql)) {
92
				$msg[] = ''.$database->get_error();
93
			} else {
94
				$msg[] = 'Change internal absolute links into relative links'." $OK";
95
			}
96
// only for $callingScript upgrade-script.php
97
			if($globalStarted) {
98
				if($bDebug) {
99
					echo '<strong>'.implode('<br />',$msg).'</strong><br />';
80 100
				}
81 101
			}
82 102
		}
83
		return $msg;
103
		$msg[] = 'WYSIWYG upgrade successfull finished'." $OK";
104
		if($globalStarted) {
105
			echo "<strong>WYSIWYG upgrade successfull finished $OK</strong><br />";
106
		}
107
		return ( ($globalStarted==true ) ? $globalStarted : $msg);
84 108
	}
109
// ------------------------------------
110
$bDebugModus = ((isset($bDebugModus)) ? $bDebugModus : false);
111
if( is_array($msg = mod_wysiwyg_upgrade($bDebugModus)) ) {
112
	echo '<strong>'.implode('<br />',$msg).'</strong><br />';
85 113
}
86
// ------------------------------------
87

  
88
$msg = mod_wysiwyg_upgrade();
89 114

  
branches/2.8.x/wb/modules/form/info.php
24 24
$module_directory = 'form';
25 25
$module_name = 'Form';
26 26
$module_function = 'page';
27
$module_version = '2.9.1';
27
$module_version = '2.9.2';
28 28
$module_platform = '2.8.4';
29 29
$module_author = 'Ryan Djurovich & Rudolph Lartey - additions John Maats - PCWacht, dev-team';
30 30
$module_license = 'GNU General Public License';
31 31

  
branches/2.8.x/wb/modules/form/install.php
21 21
	throw new IllegalFileException();
22 22
} else {
23 23
// Create tables
24
$database->SqlImport(dirname(__FILE__).'/sql/form284db.sql',TABLE_PREFIX,false);
24
	$sError = array();
25
	// Create table
26
	if(!$database->SqlImport(dirname(__FILE__).'/sql/form284db.sql','',false)){
27
		$sError[] = $database->get_error();
28
	}
25 29
}
branches/2.8.x/wb/modules/form/sql/form284db.sql
37 37
  `footer` text{TABLE_COLLATION} NOT NULL,
38 38
  `email_to` text{TABLE_COLLATION} NOT NULL,
39 39
  `email_from` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
40
  `email_fromname` varchar(255{TABLE_COLLATION}) NOT NULL DEFAULT '',
40
  `email_fromname` varchar(255){TABLE_COLLATION}) NOT NULL DEFAULT '',
41 41
  `email_subject` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
42 42
  `success_page` text{TABLE_COLLATION} NOT NULL,
43 43
  `success_email_to` text{TABLE_COLLATION} NOT NULL,
branches/2.8.x/wb/modules/form/view.php
151 151
	}
152 152

  
153 153
// do not use sec_anchor, can destroy some layouts
154
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$fetch_settings['section_id'] : 'section_'.$section_id );
154
//$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$fetch_settings['section_id'] : 'section_'.$section_id );
155 155

  
156 156
	// Get list of fields
157 157
	$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'mod_form_fields` ';
158 158

  
branches/2.8.x/wb/modules/form/upgrade.php
1 1
<?php
2 2
/**
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 4
 *
4
 * @category        module
5
 * @package         Form
6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2012, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id$
13
 * @filesource		$HeadURL$
14
 * @lastmodified    $Date$
15
 * @description
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 17
 */
17 18

  
19
/**
20
 * upgrade.php
21
 * 
22
 * @category     Module
23
 * @package      Module_form
24
 * @subpackage   upgrade
25
 * @author       Dietmar Wöllbrink <dietmar.woellbrink@websitebaker.org>
26
 * @author       Werner v.d.Decken <wkl@isteam.de>
27
 * @copyright    Werner v.d.Decken <wkl@isteam.de>
28
 * @license      http://www.gnu.org/licenses/gpl.html   GPL License
29
 * @version      0.0.1
30
 * @revision     $Revision$
31
 * @link         $HeadURL$
32
 * @lastmodified $Date$
33
 * @since        File available since 17.01.2013
34
 * @description  xyz
35
 * 
36
 */
37

  
18 38
/* -------------------------------------------------------- */
19 39
// Must include code to stop this file being accessed directly
20
if(!defined('WB_PATH')) {
40
if(!defined('WB_URL')) {
21 41
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
22 42
	throw new IllegalFileException();
23 43
}
24 44
/* -------------------------------------------------------- */
25 45

  
26
if(!function_exists('mod_form_upgrade'))
27
{
28
    function mod_form_upgrade() {
29
        $msg = array();
30
        global $database,$bDebugModus;
31
        $callingScript = $_SERVER["SCRIPT_NAME"];
32
        // check if upgrade startet by upgrade-script to echo a message
33
        $tmp = 'upgrade-script.php';
34
        $globalStarted = substr_compare($callingScript, $tmp,(0-strlen($tmp)),strlen($tmp)) === 0;
35
        $aTable = array('mod_form_fields','mod_form_settings','mod_form_submissions');
36
        for($x=0; $x<sizeof($aTable);$x++) {
37
        	if(($sOldType = $database->getTableEngine(TABLE_PREFIX.$aTable[$x]))) {
38
        		if(('myisam' != strtolower($sOldType))) {
39
        			if(!$database->query('ALTER TABLE `'.TABLE_PREFIX.$aTable[$x].'` Engine = \'MyISAM\' ')) {
40
        				$msg[] = $database->get_error();
41
        			} else{
42
                        $msg[] = 'TABLE `'.TABLE_PREFIX.$aTable[$x].'` changed to Engine = \'MyISAM\'';
43
        			}
44
        		} else {
45
                 $msg[] = 'TABLE `'.TABLE_PREFIX.$aTable[$x].'` has Engine = \'MyISAM\'';
46
        		}
47
        	} else {
48
        		$msg[] = $database->get_error();
49
        	}
50
        }
46
//if(!function_exists('mod_form_upgrade')){
47
	function mod_form_upgrade($bDebug=false) {
48
		global $OK ,$FAIL;
49
		$database=WbDatabase::getInstance();
50
		$msg = array();
51
		$callingScript = $_SERVER["SCRIPT_NAME"];
52
		// check if upgrade startet by upgrade-script to echo a message
53
		$tmp = 'upgrade-script.php';
54
		$globalStarted = substr_compare($callingScript, $tmp,(0-strlen($tmp)),strlen($tmp)) === 0;
55
// check for missing tables, if true stop the upgrade
56
		$aTable = array('mod_form_fields','mod_form_settings','mod_form_submissions');
57
		$aPackage = UpgradeHelper::existsAllTables($aTable);
58
		if( sizeof($aPackage) > 0){
59
			$msg[] =  'TABLE '.implode(' missing! '.$FAIL.'<br />TABLE ',$aPackage).' missing! '.$FAIL;
60
			$msg[] = 'Form upgrade failed'." $FAIL";
61
			if($globalStarted) {
62
				echo '<strong>'.implode('<br />',$msg).'</strong><br />';
63
			}
64
			return ( ($globalStarted==true ) ? $globalStarted : $msg);
65
		} else {
66
			for($x=0; $x<sizeof($aTable);$x++) {
67
				if(($sOldType = $database->getTableEngine($database->TablePrefix.$aTable[$x]))) {
68
					if(('myisam' != strtolower($sOldType))) {
69
						if(!$database->query('ALTER TABLE `'.$database->TablePrefix.$aTable[$x].'` Engine = \'MyISAM\' ')) {
70
							$msg[] = $database->get_error();
71
						} else{
72
							$msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` changed to Engine = \'MyISAM\''." $OK";
73
						}
74
					} else {
75
						$msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` has Engine = \'MyISAM\''." $OK";
76
					}
77
				} else {
78
					$msg[] = $database->get_error();
79
				}
80
			}
81
			$table_name = $database->TablePrefix.'mod_form_settings';
82
			$field_name = 'perpage_submissions';
83
			$description = "INT NOT NULL DEFAULT '10' AFTER `max_submissions`";
84
			if(!$database->field_exists($table_name,$field_name)) {
85
				$database->field_add($table_name, $field_name, $description);
86
				$msg[] = 'Add field `perpage_submissions` AFTER `max_submissions`';
87
			} else {
88
				$msg[] = 'Field `perpage_submissions` already exists'." $OK";
89
			}
90
// only for upgrade-script
91
			if($globalStarted) {
92
				if($bDebug) {
93
					echo '<strong>'.implode('<br />',$msg).'</strong><br />';
94
				}
95
			}
96
		}
97
		$msg[] = 'Form upgrade successfull finished ';
98
		if($globalStarted) {
99
			echo "<strong>Form upgrade successfull finished $OK</strong><br />";
100
		}
101
		return ( ($globalStarted==true ) ? $globalStarted : $msg);
102
	}
103
//}
104
// ------------------------------------
51 105

  
52
        $table_name = TABLE_PREFIX.'mod_form_settings';
53
        $field_name = 'perpage_submissions';
54
        $description = "INT NOT NULL DEFAULT '10' AFTER `max_submissions`";
55
        if(!$database->field_exists($table_name,$field_name)) {
56
        	$database->field_add($table_name, $field_name, $description);
57
            $msg[] = 'Add field `perpage_submissions` AFTER `max_submissions`';
58
        } else {
59
            $msg[] = 'Field `perpage_submissions` already exists';
60
        }
61

  
62
        // only for upgrade-script
63
        if($globalStarted) {
64
            if($bDebugModus) {
65
                foreach($msg as $title) {
66
                    echo '<strong>'.$title.'</strong><br />';
67
                }
68
            }
69
        }
70
        return $msg;
71
    }
106
$bDebugModus = ((isset($bDebugModus)) ? $bDebugModus : false);
107
if( is_array($msg = mod_form_upgrade($bDebugModus))) {
108
	echo '<strong>'.implode('<br />',$msg).'</strong><br />';
72 109
}
73
// ------------------------------------
74

  
75
$msg = mod_form_upgrade();
76 110

  
branches/2.8.x/wb/modules/code/sql/mod_code.sql
1
-- phpMyAdmin SQL Dump
2
-- Erstellungszeit: 15. Mrz 2013 um 18:21
3
-- Server-Version: 5.5.27
4
--
5
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
6
SET time_zone = "+00:00";
7
-- --------------------------------------------------------
8
-- Database structure for WebsiteBaker core
9
--
10
-- Replacements: {TABLE_PREFIX}, {TABLE_ENGINE}, {TABLE_COLLATION}
11
--
12
-- --------------------------------------------------------
13
--
14
-- Tabellenstruktur für Tabelle `{TABLE_PREFIX}mod_code`
15
--
16
DROP TABLE IF EXISTS `{TABLE_PREFIX}mod_code`;
17
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}mod_code` (
18
  `section_id` int(11) NOT NULL DEFAULT '0',
19
  `page_id` int(11) NOT NULL DEFAULT '0',
20
  `content` text{TABLE_COLLATION} NOT NULL DEFAULT '',
21
  PRIMARY KEY (`section_id`)
22
){TABLE_ENGINE};
23
-- EndOfFile
branches/2.8.x/wb/modules/code/info.php
4 4
 * @category        modules
5 5
 * @package         code
6 6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8 8
 * @link			http://www.websitebaker2.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10 10
 * @platform        WebsiteBaker 2.8.x
......
24 24
}
25 25
/* -------------------------------------------------------- */
26 26

  
27
$module_directory	= 'code';
28
$module_name		= 'Code';
29
$module_function	= 'page';
30
$module_version		= '2.8.3';
31
$module_platform	= '2.7 | 2.8.x';
32
$module_author		= 'Ryan Djurovich';
33
$module_license		= 'GNU General Public License';
34
$module_description	= 'This module allows you to execute PHP commands (limit access to users you trust!!)';
35

  
27
$module_directory   = 'code';
28
$module_name        = 'Code';
29
$module_function    = 'page';
30
$module_version     = '2.8.4';
31
$module_platform    = '2.8.4';
32
$module_author      = 'Ryan Djurovich';
33
$module_license     = 'GNU General Public License';
34
$module_description = 'This module allows you to execute PHP commands (limit access to users you trust!!)';
branches/2.8.x/wb/modules/code/save.php
4 4
 * @category        modules
5 5
 * @package         code
6 6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8 8
 * @link			http://www.websitebaker2.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10 10
 * @platform        WebsiteBaker 2.8.x
......
32 32
$admin->print_header();
33 33
// Update the mod_wysiwygs table with the contents
34 34
if(isset($_POST['content'])) {
35

  
36

  
35 37
	$tags = array('<?php', '?>' , '<?', '<?=');
36 38
	$content = $admin->add_slashes(str_replace($tags, '', $_POST['content']));
39

  
37 40
	$query = "UPDATE ".TABLE_PREFIX."mod_code SET content = '$content' WHERE section_id = '$section_id'";
38 41
	$database->query($query);	
42

  
39 43
}
40 44

  
41 45
// Check if there is a database error, otherwise say successful
42 46
if($database->is_error()) {
43 47
	$admin->print_error($database->get_error(), $js_back);
44 48
} else {
45
	$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
49
	$admin->print_success($MESSAGE['PAGES_SAVED'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
46 50
}
47 51

  
48 52
// Print admin footer
branches/2.8.x/wb/modules/code/search.php
1
<?php
2
/**
3
 *
4
 * @category        frontend
5
 * @package         search
6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.3
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id: search.php 1652 2012-03-27 10:35:26Z Luisehahne $
13
 * @filesource		$HeadURL: http://svn.websitebaker2.org/branches/2.8.x/wb/admin/users/save.php $
14
 * @lastmodified    $Date: 2011-01-10 13:21:47 +0100 (Mo, 10. Jan 2011) $
15
 *
16
 */
17
/* -------------------------------------------------------- */
18
// Must include code to stop this file being accessed directly
19
if(!defined('WB_PATH')) {
20
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
21
	throw new IllegalFileException();
22
}
23
/* -------------------------------------------------------- */
24

  
25
function code_search($func_vars) {
26
	extract($func_vars, EXTR_PREFIX_ALL, 'func');
27
	static $search_sql = FALSE;
28
	if(function_exists('search_make_sql_part')) {
29
		if($search_sql===FALSE)
30
			$search_sql = search_make_sql_part($func_search_url_array, $func_search_match, array('`content`'));
31
	} else {
32
		$search_sql = '1=1';
33
	}
34
	
35
	// how many lines of excerpt we want to have at most
36
	$max_excerpt_num = $func_default_max_excerpt;
37
	$divider = ".";
38
	$result = false;
39
	
40
	// we have to get 'content' instead of 'text', because strip_tags() dosen't remove scripting well.
41
	// scripting will be removed later on automatically
42
	$table = TABLE_PREFIX."mod_code";
43
	$query = $func_database->query("
44
		SELECT content
45
		FROM $table
46
		WHERE section_id='$func_section_id'
47
	");
48

  
49
	if($query->numRows() > 0) {
50
		if($res = $query->fetchRow()) {
51
			$mod_vars = array(
52
				'page_link' => $func_page_link,
53
				'page_link_target' => "#wb_section_$func_section_id",
54
				'page_title' => $func_page_title,
55
				'page_description' => $func_page_description,
56
				'page_modified_when' => $func_page_modified_when,
57
				'page_modified_by' => $func_page_modified_by,
58
				'text' => $res['content'].$divider,
59
				'max_excerpt_num' => $max_excerpt_num
60
			);
61
			if(print_excerpt2($mod_vars, $func_vars)) {
62
				$result = true;
63
			}
64
		}
65
	}
66
	return $result;
67
}
branches/2.8.x/wb/modules/code/install.php
4 4
 * @category        modules
5 5
 * @package         code
6 6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker2.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10 10
 * @platform        WebsiteBaker 2.8.x
11 11
 * @requirements    PHP 5.2.2 and higher
12
 * @version      	$Id: install.php 1374 2011-01-10 12:21:47Z Luisehahne $
13
 * @filesource		$HeadURL: http://svn.websitebaker2.org/branches/2.8.x/wb/modules/code/install.php $
12
 * @version         $Id: install.php 1374 2011-01-10 12:21:47Z Luisehahne $
13
 * @filesource      $HeadURL: http://svn.websitebaker2.org/branches/2.8.x/wb/modules/code/install.php $
14 14
 * @lastmodified    $Date: 2011-01-10 13:21:47 +0100 (Mo, 10. Jan 2011) $
15 15
 *
16 16
 */
17 17

  
18 18
/* -------------------------------------------------------- */
19
if(defined('WB_PATH') == false)
20
{
21
	// Stop this file being access directly
22
		die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
23
}
24
/* -------------------------------------------------------- */
25

  
26
if(defined('WB_URL'))
27
{
28

  
19
// Must include code to stop this file being accessed directly
20
if(!defined('WB_PATH')) {
21
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
22
	throw new IllegalFileException();
23
} else {
24
	$database = WbDatabase::getInstance();
25
	$sError = '';
29 26
	// Create table
30
	$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_code`");
31
	$mod_code = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_code` ('
32
		. ' `section_id` INT NOT NULL DEFAULT \'0\','
33
		. ' `page_id` INT NOT NULL DEFAULT \'0\','
34
		. ' `content` TEXT NOT NULL,'
35
		. ' PRIMARY KEY ( `section_id` )'
36
		. ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
37
	$database->query($mod_code);
38

  
39
    $mod_search = "SELECT * FROM ".TABLE_PREFIX."search  WHERE value = 'code'";
40
    $insert_search = $database->query($mod_search);
41
    if( $insert_search->numRows() == 0 )
42
    {
43
    	// Insert info into the search table
44
    	// Module query info
45
    	$field_info = array();
46
    	$field_info['page_id'] = 'page_id';
47
    	$field_info['title'] = 'page_title';
48
    	$field_info['link'] = 'link';
49
    	$field_info['description'] = 'description';
50
    	$field_info['modified_when'] = 'modified_when';
51
    	$field_info['modified_by'] = 'modified_by';
52
    	$field_info = serialize($field_info);
53
    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('module', 'code', '$field_info')");
54
    	// Query start
55
    	$query_start_code = "SELECT [TP]pages.page_id, [TP]pages.page_title,	[TP]pages.link, [TP]pages.description, [TP]pages.modified_when, [TP]pages.modified_by	FROM [TP]mod_code, [TP]pages WHERE ";
56
    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_start', '$query_start_code', 'code')");
57
    	// Query body
58
    	$query_body_code = " [TP]pages.page_id = [TP]mod_code.page_id AND [TP]mod_code.content [O] \'[W][STRING][W]\' AND [TP]pages.searching = \'1\'";
59
    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_body', '$query_body_code', 'code')");
60
    	// Query end
61
    	$query_end_code = "";
62
    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_end', '$query_end_code', 'code')");
63

  
64
    	// Insert blank row (there needs to be at least on row for the search to work)
65
    	$database->query("INSERT INTO ".TABLE_PREFIX."mod_code (page_id,section_id) VALUES ('0','0')");
66

  
67
    }
27
	if(!$database->SqlImport(dirname(__FILE__).'/sql/mod_code.sql','',false)){
28
		$sError = $database->get_error();
29
	}
68 30
}
branches/2.8.x/wb/modules/code/upgrade.php
4 4
 * @category        modules
5 5
 * @package         code
6 6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8 8
 * @link            http://www.websitebaker2.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10 10
 * @platform        WebsiteBaker 2.8.x
......
16 16
 */
17 17
// Must include code to stop this file being access directly
18 18
/* -------------------------------------------------------- */
19
if(defined('WB_PATH') == false)
20
{
21
	// Stop this file being access directly
22
		die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
19
// Must include code to stop this file being accessed directly
20
if(!defined('WB_URL')) {
21
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
22
	throw new IllegalFileException();
23 23
}
24 24
/* -------------------------------------------------------- */
25 25

  
26
$msg = '';
27
$sTable = TABLE_PREFIX.'mod_code';
28
if(($sOldType = $database->getTableEngine($sTable))) {
29
	if(('myisam' != strtolower($sOldType))) {
30
		if(!$database->query('ALTER TABLE `'.$sTable.'` Engine = \'MyISAM\' ')) {
31
			$msg = $database->get_error();
26
	function mod_code_upgrade($bDebug=false) {
27
		global $OK ,$FAIL;
28
		$database=WbDatabase::getInstance();
29
		$msg = array();
30
		$callingScript = $_SERVER["SCRIPT_NAME"];
31
		// check if upgrade startet by upgrade-script to echo a message
32
		$tmp = 'upgrade-script.php';
33
		$globalStarted = substr_compare($callingScript, $tmp,(0-strlen($tmp)),strlen($tmp)) === 0;
34
// check for missing tables, if true stop the upgrade
35
		$aTable = array('mod_code');
36
		$aPackage = UpgradeHelper::existsAllTables($aTable);
37
		if( sizeof($aPackage) > 0){
38
			$msg[] =  'TABLE '.implode(' missing! '.$FAIL.'<br />TABLE ',$aPackage).' missing! '.$FAIL;
39
			$msg[] = 'Code upgrade failed'." $FAIL";
40
			if($globalStarted) {
41
				echo '<strong>'.implode('<br />',$msg).'</strong><br />';
42
			}
43
			return ( ($globalStarted==true ) ? $globalStarted : $msg);
44
		} else {
45
			for($x=0; $x<sizeof($aTable);$x++) {
46
				if(($sOldType = $database->getTableEngine($database->TablePrefix.$aTable[$x]))) {
47
					if(('myisam' != strtolower($sOldType))) {
48
						if(!$database->query('ALTER TABLE `'.$database->TablePrefix.$aTable[$x].'` Engine = \'MyISAM\' ')) {
49
							$msg[] = $database->get_error();
50
						} else{
51
							$msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` changed to Engine = \'MyISAM\''." $OK";
52
						}
53
					} else {
54
						$msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` has Engine = \'MyISAM\''." $OK";
55
					}
56
				} else {
57
					$msg[] = $database->get_error();
58
				}
59
			}
60
// only for upgrade-script
61
			if($globalStarted) {
62
				if($bDebug) {
63
					echo '<strong>'.implode('<br />',$msg).'</strong><br />';
64
				}
65
			}
32 66
		}
67
		$msg[] = 'Code upgrade successfull finished '." $OK";
68
		if($globalStarted) {
69
			echo "<strong>Code upgrade successfull finished $OK</strong><br />";
70
		}
71
		return ( ($globalStarted==true ) ? $globalStarted : $msg);
33 72
	}
34
} else {
35
	$msg = $database->get_error();
73
// ------------------------------------
74

  
75
$bDebugModus = ((isset($bDebugModus)) ? $bDebugModus : false);
76
// Don't show the messages twice
77
if( is_array($msg = mod_code_upgrade($bDebugModus)) ) {
78
	echo '<strong>'.implode('<br />',$msg).'</strong><br />';
36 79
}
37
// ------------------------------------
branches/2.8.x/wb/modules/code/add.php
15 15
 *
16 16
 */
17 17

  
18
// Must include code to stop this file being access directly
19 18
/* -------------------------------------------------------- */
20
if(defined('WB_PATH') == false)
21
{
22
	// Stop this file being access directly
23
		die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
24
}
25
/* -------------------------------------------------------- */
19
// Must include code to stop this file being accessed directly
20
if(!defined('WB_PATH')) {
21
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
22
	throw new IllegalFileException();
23
} else {
26 24
// Insert an extra row into the database
27 25
$database->query("INSERT INTO ".TABLE_PREFIX."mod_code (page_id,section_id) VALUES ('$page_id','$section_id')");
26
}

Also available in: Unified diff