| 1 | 
        
            552
         | 
        
            thorn
         | 
        <?php
  | 
      
      
        | 2 | 
        
         | 
        
         | 
        
  | 
      
      
        | 3 | 
        
            554
         | 
        
            Ruebenwurz
         | 
        // $Id$
  | 
      
      
        | 4 | 
        
            552
         | 
        
            thorn
         | 
        
  | 
      
      
        | 5 | 
        
         | 
        
         | 
        /*
  | 
      
      
        | 6 | 
        
         | 
        
         | 
        
  | 
      
      
        | 7 | 
        
         | 
        
         | 
         Website Baker Project <http://www.websitebaker.org/>
  | 
      
      
        | 8 | 
        
         | 
        
         | 
         Copyright (C) 2004-2008, Ryan Djurovich
  | 
      
      
        | 9 | 
        
         | 
        
         | 
        
  | 
      
      
        | 10 | 
        
         | 
        
         | 
         Website Baker is free software; you can redistribute it and/or modify
  | 
      
      
        | 11 | 
        
         | 
        
         | 
         it under the terms of the GNU General Public License as published by
  | 
      
      
        | 12 | 
        
         | 
        
         | 
         the Free Software Foundation; either version 2 of the License, or
  | 
      
      
        | 13 | 
        
         | 
        
         | 
         (at your option) any later version.
  | 
      
      
        | 14 | 
        
         | 
        
         | 
        
  | 
      
      
        | 15 | 
        
         | 
        
         | 
         Website Baker is distributed in the hope that it will be useful,
  | 
      
      
        | 16 | 
        
         | 
        
         | 
         but WITHOUT ANY WARRANTY; without even the implied warranty of
  | 
      
      
        | 17 | 
        
         | 
        
         | 
         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  | 
      
      
        | 18 | 
        
         | 
        
         | 
         GNU General Public License for more details.
  | 
      
      
        | 19 | 
        
         | 
        
         | 
        
  | 
      
      
        | 20 | 
        
         | 
        
         | 
         You should have received a copy of the GNU General Public License
  | 
      
      
        | 21 | 
        
         | 
        
         | 
         along with Website Baker; if not, write to the Free Software
  | 
      
      
        | 22 | 
        
         | 
        
         | 
         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  | 
      
      
        | 23 | 
        
         | 
        
         | 
        
  | 
      
      
        | 24 | 
        
         | 
        
         | 
        */
  | 
      
      
        | 25 | 
        
         | 
        
         | 
        
  | 
      
      
        | 26 | 
        
            715
         | 
        
            doc
         | 
        /**
  | 
      
      
        | 27 | 
        
         | 
        
         | 
        	PHP ROUTINES FOR THE UPGRADE SCRIPT
  | 
      
      
        | 28 | 
        
         | 
        
         | 
        **/
  | 
      
      
        | 29 | 
        
         | 
        
         | 
        // this function checks the basic configurations of an existing WB intallation
  | 
      
      
        | 30 | 
        
         | 
        
         | 
        function status_msg($message, $class='check', $element='span') {
 | 
      
      
        | 31 | 
        
         | 
        
         | 
        	// returns a status message
  | 
      
      
        | 32 | 
        
         | 
        
         | 
        	echo '<'.$element .' class="' .$class .'">' .$message .'</' .$element.'>';
  | 
      
      
        | 33 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 34 | 
        
            552
         | 
        
            thorn
         | 
        
  | 
      
      
        | 35 | 
        
            715
         | 
        
            doc
         | 
        function check_baseline_configuration() {
 | 
      
      
        | 36 | 
        
         | 
        
         | 
        	// check if config.php file exists and contains values
  | 
      
      
        | 37 | 
        
         | 
        
         | 
        	status_msg('config.php: ');
 | 
      
      
        | 38 | 
        
         | 
        
         | 
        	@include('config.php');
 | 
      
      
        | 39 | 
        
         | 
        
         | 
        	if(defined('WB_PATH')) {
 | 
      
      
        | 40 | 
        
         | 
        
         | 
        		status_msg('OK', 'ok');
 | 
      
      
        | 41 | 
        
         | 
        
         | 
        	} else {
 | 
      
      
        | 42 | 
        
         | 
        
         | 
        		// output error message and return error status
  | 
      
      
        | 43 | 
        
         | 
        
         | 
        		status_msg('FAILED', 'error');
 | 
      
      
        | 44 | 
        
         | 
        
         | 
        		status_msg('<strong>Error:</strong><br />No valid config.php found in: "<em>'
 | 
      
      
        | 45 | 
        
         | 
        
         | 
        			.dirname(__FILE__).'</em>"<br />Please check if this script is placed in the WB root directory '
  | 
      
      
        | 46 | 
        
         | 
        
         | 
        			.'and check/correct the config.php file before proceeding.<br /><br />You can not proceed before this error is fixed!!!'
  | 
      
      
        | 47 | 
        
         | 
        
         | 
        			, 'warning', 'div');
  | 
      
      
        | 48 | 
        
         | 
        
         | 
        		return -1;
  | 
      
      
        | 49 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 50 | 
        
            552
         | 
        
            thorn
         | 
        
  | 
      
      
        | 51 | 
        
            715
         | 
        
            doc
         | 
        	// check if the WB 2.7 installation files were already uploaded via FTP
  | 
      
      
        | 52 | 
        
         | 
        
         | 
        	status_msg(', WB 2.7 core files uploaded: ');
 | 
      
      
        | 53 | 
        
         | 
        
         | 
        	@include(WB_PATH .'/framework/functions.php');
  | 
      
      
        | 54 | 
        
         | 
        
         | 
        	@include(WB_PATH .'/admin/interface/version.php');
  | 
      
      
        | 55 | 
        
         | 
        
         | 
        	if(defined('VERSION') && VERSION == '2.7'
 | 
      
      
        | 56 | 
        
         | 
        
         | 
        		&& function_exists('get_variable_content')
 | 
      
      
        | 57 | 
        
         | 
        
         | 
        		&& file_exists(WB_PATH .'/modules/menu_link/languages/DE.php')
  | 
      
      
        | 58 | 
        
         | 
        
         | 
        		&& file_exists(WB_PATH .'/modules/output_filter/filter-routines.php')
  | 
      
      
        | 59 | 
        
         | 
        
         | 
        		&& file_exists(WB_PATH .'/modules/captcha_control/languages/DE.php')
  | 
      
      
        | 60 | 
        
         | 
        
         | 
        		&& file_exists(WB_PATH .'/modules/jsadmin/jsadmin_backend_include.php')
  | 
      
      
        | 61 | 
        
         | 
        
         | 
        		&& file_exists(WB_PATH .'/admin/admintools/tool.php')
  | 
      
      
        | 62 | 
        
         | 
        
         | 
        		&& file_exists(WB_PATH .'/admin/interface/er_levels.php')) {
 | 
      
      
        | 63 | 
        
         | 
        
         | 
        		status_msg('OK','ok');
 | 
      
      
        | 64 | 
        
         | 
        
         | 
        	} else {
 | 
      
      
        | 65 | 
        
         | 
        
         | 
        		// output a warning and return error status
  | 
      
      
        | 66 | 
        
         | 
        
         | 
        		status_msg('FAILED','error');
 | 
      
      
        | 67 | 
        
         | 
        
         | 
        		status_msg('<strong>Error:</strong><br />Some of the Website Baker 2.7 core files were not found.'
 | 
      
      
        | 68 | 
        
         | 
        
         | 
        			.'<br />Please upload all core files (except config.php and folder /install) contained in the WB 2.7 installation package first.'
  | 
      
      
        | 69 | 
        
         | 
        
         | 
        			.'<br /><br />You can not proceed before this error is fixed!!!'
  | 
      
      
        | 70 | 
        
         | 
        
         | 
        			, 'warning', 'div');
  | 
      
      
        | 71 | 
        
         | 
        
         | 
        		return -1;
  | 
      
      
        | 72 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 73 | 
        
         | 
        
         | 
        
  | 
      
      
        | 74 | 
        
         | 
        
         | 
        	// check database connection
  | 
      
      
        | 75 | 
        
         | 
        
         | 
        	$wb_version = '';
  | 
      
      
        | 76 | 
        
         | 
        
         | 
        	status_msg(', Database connection: ');
 | 
      
      
        | 77 | 
        
         | 
        
         | 
        	if(class_exists('database')) {
 | 
      
      
        | 78 | 
        
         | 
        
         | 
        		$db = new database;
  | 
      
      
        | 79 | 
        
         | 
        
         | 
        		$table = TABLE_PREFIX .'settings';
  | 
      
      
        | 80 | 
        
         | 
        
         | 
        		$wb_version = @$db->get_one("SELECT value FROM $table WHERE name = 'wb_version' LIMIT 1");
 | 
      
      
        | 81 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 82 | 
        
         | 
        
         | 
        	if($wb_version) {
 | 
      
      
        | 83 | 
        
         | 
        
         | 
        		status_msg('OK', 'ok');
 | 
      
      
        | 84 | 
        
         | 
        
         | 
        	} else {
 | 
      
      
        | 85 | 
        
         | 
        
         | 
        		// output error message and return error status
  | 
      
      
        | 86 | 
        
         | 
        
         | 
        		status_msg('FAILED', 'error');
 | 
      
      
        | 87 | 
        
         | 
        
         | 
        		status_msg('<strong>Error:</strong><br />Unable to obtain the WB version stored in the database of your existing installation.'
 | 
      
      
        | 88 | 
        
         | 
        
         | 
        			.'<br />Make sure that the database class is available and the connection data in the config.php file is correct '
  | 
      
      
        | 89 | 
        
         | 
        
         | 
        			.'and your database is not corrupted.<br />To check if your database is corrupted, you can use a tool like '
  | 
      
      
        | 90 | 
        
         | 
        
         | 
        			.'<a href="http://www.phpmyadmin.net/" target="_blank">phpMyAdmin</a>.'
  | 
      
      
        | 91 | 
        
         | 
        
         | 
        			.'<br /><br />You can not proceed before this error is fixed!!!'
  | 
      
      
        | 92 | 
        
         | 
        
         | 
        			, 'warning', 'div');
  | 
      
      
        | 93 | 
        
         | 
        
         | 
        		return -1;
  | 
      
      
        | 94 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 95 | 
        
         | 
        
         | 
        
  | 
      
      
        | 96 | 
        
         | 
        
         | 
        	// check WB version in database is 2.6.7
  | 
      
      
        | 97 | 
        
         | 
        
         | 
        	status_msg(', WB version (database): ');
 | 
      
      
        | 98 | 
        
         | 
        
         | 
        	if($wb_version == '2.6.7') {
 | 
      
      
        | 99 | 
        
         | 
        
         | 
        		status_msg('2.6.7 (OK)', 'ok');
 | 
      
      
        | 100 | 
        
         | 
        
         | 
        	} else {
 | 
      
      
        | 101 | 
        
         | 
        
         | 
        		// output a warning
  | 
      
      
        | 102 | 
        
         | 
        
         | 
        		status_msg($wb_version .' (required 2.6.7)', 'error');
  | 
      
      
        | 103 | 
        
         | 
        
         | 
        		status_msg('<strong>Warning:</strong><br />The extracted version number from the database is ' .$wb_version .' (required 2.6.7).'
 | 
      
      
        | 104 | 
        
         | 
        
         | 
        			.'<br />If the extracted database version is lower than 2.6.7, please upgrade first to Website Baker 2.6.7 and then to 2.7.'
  | 
      
      
        | 105 | 
        
         | 
        
         | 
        			.'<br />If the obtained database version is higher or equal to 2.7, you do not need to execute this script.'
  | 
      
      
        | 106 | 
        
         | 
        
         | 
        			.'<br /><br />You can not proceed before this error is fixed!!!'
  | 
      
      
        | 107 | 
        
         | 
        
         | 
        			, 'warning', 'div');
  | 
      
      
        | 108 | 
        
         | 
        
         | 
        		return -1;
  | 
      
      
        | 109 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 110 | 
        
         | 
        
         | 
        	return 0;
  | 
      
      
        | 111 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 112 | 
        
         | 
        
         | 
        
  | 
      
      
        | 113 | 
        
            552
         | 
        
            thorn
         | 
        ?>
  | 
      
      
        | 114 | 
        
         | 
        
         | 
        
  | 
      
      
        | 115 | 
        
         | 
        
         | 
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  | 
      
      
        | 116 | 
        
         | 
        
         | 
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  | 
      
      
        | 117 | 
        
         | 
        
         | 
        <head>
  | 
      
      
        | 118 | 
        
            715
         | 
        
            doc
         | 
        <title>Upgrade script from Website Baker v2.6.7 to Website Baker v2.7</title>
  | 
      
      
        | 119 | 
        
            692
         | 
        
            doc
         | 
        
  | 
      
      
        | 120 | 
        
         | 
        
         | 
        <style type="text/css">
  | 
      
      
        | 121 | 
        
            715
         | 
        
            doc
         | 
        body {
 | 
      
      
        | 122 | 
        
         | 
        
         | 
        	margin:0;
  | 
      
      
        | 123 | 
        
         | 
        
         | 
        	padding:0;
  | 
      
      
        | 124 | 
        
         | 
        
         | 
        	border:0;
  | 
      
      
        | 125 | 
        
         | 
        
         | 
        	background: #EBF7FC;
  | 
      
      
        | 126 | 
        
         | 
        
         | 
        	color:#000;
  | 
      
      
        | 127 | 
        
         | 
        
         | 
          font-family: 'Trebuchet MS', Verdana, Arial, Helvetica, Sans-Serif;
  | 
      
      
        | 128 | 
        
         | 
        
         | 
        	font-size: small;
  | 
      
      
        | 129 | 
        
         | 
        
         | 
        	height:101%;
  | 
      
      
        | 130 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 131 | 
        
            692
         | 
        
            doc
         | 
        
  | 
      
      
        | 132 | 
        
            715
         | 
        
            doc
         | 
        #container {
 | 
      
      
        | 133 | 
        
         | 
        
         | 
        	width:85%;
  | 
      
      
        | 134 | 
        
         | 
        
         | 
        	background: #9ACBF1 url(admin/interface/background.png) repeat-x;
  | 
      
      
        | 135 | 
        
         | 
        
         | 
        	border:1px solid #000;
  | 
      
      
        | 136 | 
        
         | 
        
         | 
        	color:#000;
  | 
      
      
        | 137 | 
        
         | 
        
         | 
        	margin:2em auto;
  | 
      
      
        | 138 | 
        
         | 
        
         | 
        	padding:0 15px;
  | 
      
      
        | 139 | 
        
         | 
        
         | 
        	min-height: 500px;
  | 
      
      
        | 140 | 
        
         | 
        
         | 
        	text-align:left;
  | 
      
      
        | 141 | 
        
            692
         | 
        
            doc
         | 
        }
  | 
      
      
        | 142 | 
        
         | 
        
         | 
        
  | 
      
      
        | 143 | 
        
         | 
        
         | 
        p { line-height:1.5em; }
 | 
      
      
        | 144 | 
        
         | 
        
         | 
        
  | 
      
      
        | 145 | 
        
            715
         | 
        
            doc
         | 
        h1,h2,h3,h4,h5,h6 {
 | 
      
      
        | 146 | 
        
         | 
        
         | 
        	font-family: Verdana, Arial, Helvetica, sans-serif;
  | 
      
      
        | 147 | 
        
         | 
        
         | 
        	color: #369;
  | 
      
      
        | 148 | 
        
         | 
        
         | 
        	margin-top: 1.0em;
  | 
      
      
        | 149 | 
        
         | 
        
         | 
        	margin-bottom: 0.1em;
  | 
      
      
        | 150 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 151 | 
        
         | 
        
         | 
        
  | 
      
      
        | 152 | 
        
         | 
        
         | 
        h1 { font-size:150%; }
 | 
      
      
        | 153 | 
        
         | 
        
         | 
        h2 { font-size: 130%; border-bottom: 1px #CCC solid; }
 | 
      
      
        | 154 | 
        
         | 
        
         | 
        h3 { font-size: 120%; }
 | 
      
      
        | 155 | 
        
         | 
        
         | 
        
  | 
      
      
        | 156 | 
        
         | 
        
         | 
        .ok, .error { font-weight:bold; }
 | 
      
      
        | 157 | 
        
         | 
        
         | 
        .ok { color:green; }
 | 
      
      
        | 158 | 
        
         | 
        
         | 
        .error { color:red; }
 | 
      
      
        | 159 | 
        
         | 
        
         | 
        .check { color:#555; }
 | 
      
      
        | 160 | 
        
         | 
        
         | 
        
  | 
      
      
        | 161 | 
        
         | 
        
         | 
        .red { background-color:#FF0000 }
 | 
      
      
        | 162 | 
        
         | 
        
         | 
        .green { background-color:#00FF00 }
 | 
      
      
        | 163 | 
        
         | 
        
         | 
        
  | 
      
      
        | 164 | 
        
         | 
        
         | 
        .warning {
 | 
      
      
        | 165 | 
        
         | 
        
         | 
        	width: 98%;
  | 
      
      
        | 166 | 
        
         | 
        
         | 
        	background:#FFDBDB;
  | 
      
      
        | 167 | 
        
         | 
        
         | 
        	padding:0.2em;
  | 
      
      
        | 168 | 
        
         | 
        
         | 
        	margin-top:0.5em;
  | 
      
      
        | 169 | 
        
         | 
        
         | 
        	border: 1px solid black;
  | 
      
      
        | 170 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 171 | 
        
            692
         | 
        
            doc
         | 
        </style>
  | 
      
      
        | 172 | 
        
            552
         | 
        
            thorn
         | 
        </head>
  | 
      
      
        | 173 | 
        
         | 
        
         | 
        <body>
  | 
      
      
        | 174 | 
        
            715
         | 
        
            doc
         | 
        <div id="container">
  | 
      
      
        | 175 | 
        
         | 
        
         | 
        <img src="admin/interface/logo.png" alt="Website Baker Logo" />
  | 
      
      
        | 176 | 
        
         | 
        
         | 
        
  | 
      
      
        | 177 | 
        
         | 
        
         | 
        <h1>Website Baker Upgrade</h1>
  | 
      
      
        | 178 | 
        
         | 
        
         | 
        <p>This script is for <strong>upgrading an existing v2.6.7</strong> installation to the latest Website Baker <strong>version 2.7</strong>. The upgrade script checks the configuration of your installed Website Baker system and alters the existing WB database to reflect the changes introduced with WB 2.7.</p>
  | 
      
      
        | 179 | 
        
         | 
        
         | 
        
  | 
      
      
        | 180 | 
        
            692
         | 
        
            doc
         | 
        <?php
  | 
      
      
        | 181 | 
        
            715
         | 
        
            doc
         | 
        if(!isset($_POST['backup_confirmed'])) {
 | 
      
      
        | 182 | 
        
         | 
        
         | 
        ?>
  | 
      
      
        | 183 | 
        
         | 
        
         | 
        <h2>Step 1: Check existing installation</h2>
  | 
      
      
        | 184 | 
        
         | 
        
         | 
        <p>Checking the configuration of your existing Website Baker installation:<br />
  | 
      
      
        | 185 | 
        
         | 
        
         | 
        <?php
  | 
      
      
        | 186 | 
        
         | 
        
         | 
        // check the basic Website Baker installation before proceeding
  | 
      
      
        | 187 | 
        
         | 
        
         | 
        if(check_baseline_configuration() != 0) die;
  | 
      
      
        | 188 | 
        
         | 
        
         | 
        status_msg('<p>Congratulations: You have passed all the required pre-checks.', 'ok');
 | 
      
      
        | 189 | 
        
         | 
        
         | 
        ?>
  | 
      
      
        | 190 | 
        
         | 
        
         | 
        
  | 
      
      
        | 191 | 
        
         | 
        
         | 
        <h2>Step 2: Create a backup of your existing data</h2>
  | 
      
      
        | 192 | 
        
         | 
        
         | 
        <p>It is highly recommended to <strong>create a manual backup</strong> of the entire <strong>/pages folder</strong> and the <strong>MySQL database</strong> before proceeding. The upgrade script is not sufficiently tested at the moment and should therefore only be used for testing purposes!!! Please confirm the disclaimer before starting this script.</p>
  | 
      
      
        | 193 | 
        
         | 
        
         | 
        
  | 
      
      
        | 194 | 
        
         | 
        
         | 
        <form name="send" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
  | 
      
      
        | 195 | 
        
         | 
        
         | 
        <textarea cols="80" rows="5">DISCLAIMER: The Website Baker upgrade script is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. One needs to confirm that a manual backup of the /pages folder (including all files and subfolders contained in it) and backup of the entire Website Baker MySQL database was created before you can proceed.</textarea>
  | 
      
      
        | 196 | 
        
         | 
        
         | 
        <br /><br /><input name="backup_confirmed" type="checkbox" value="confirmed" /> I confirm that a manual backup of the /pages folder and the MySQL database was created.
  | 
      
      
        | 197 | 
        
         | 
        
         | 
        <br /><br /><input name="send" type="submit" value="Start upgrade script" />
  | 
      
      
        | 198 | 
        
         | 
        
         | 
        </form>
  | 
      
      
        | 199 | 
        
         | 
        
         | 
        <br />
  | 
      
      
        | 200 | 
        
         | 
        
         | 
        
  | 
      
      
        | 201 | 
        
         | 
        
         | 
        <?php
  | 
      
      
        | 202 | 
        
         | 
        
         | 
        if(isset($_POST['send'])) {
 | 
      
      
        | 203 | 
        
         | 
        
         | 
        	status_msg('<strong>Notice:</strong><br />You need to confirm that you have created a manual backup of the /pages directory and the MySQL database before you can proceed.', 'warning', 'div');
 | 
      
      
        | 204 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 205 | 
        
         | 
        
         | 
        ?>
  | 
      
      
        | 206 | 
        
         | 
        
         | 
        <br /><br />
  | 
      
      
        | 207 | 
        
         | 
        
         | 
        <?php
  | 
      
      
        | 208 | 
        
         | 
        
         | 
        } else {
 | 
      
      
        | 209 | 
        
            692
         | 
        
            doc
         | 
        /**
  | 
      
      
        | 210 | 
        
            715
         | 
        
            doc
         | 
        	THE WEBSITE BAKER UPGRADE SCRIPT STARTS HERE
  | 
      
      
        | 211 | 
        
         | 
        
         | 
        **/
  | 
      
      
        | 212 | 
        
         | 
        
         | 
        require('config.php');
 | 
      
      
        | 213 | 
        
         | 
        
         | 
        require(WB_PATH.'/framework/functions.php');
  | 
      
      
        | 214 | 
        
            692
         | 
        
            doc
         | 
        ?>
  | 
      
      
        | 215 | 
        
            715
         | 
        
            doc
         | 
        <h2>Step 3: Upgrading the existing Website Baker installation to WB 2.7</h2>
  | 
      
      
        | 216 | 
        
         | 
        
         | 
        <p>will upgrade Website Baker 2.6.5 / 2.6.7 to version 2.7</p>
  | 
      
      
        | 217 | 
        
            692
         | 
        
            doc
         | 
        <?php
  | 
      
      
        | 218 | 
        
            552
         | 
        
            thorn
         | 
        
  | 
      
      
        | 219 | 
        
         | 
        
         | 
        $OK   = '<span class="green">OK</span>';
  | 
      
      
        | 220 | 
        
         | 
        
         | 
        $FAIL = '<span class="red">failed</span>';
  | 
      
      
        | 221 | 
        
         | 
        
         | 
        
  | 
      
      
        | 222 | 
        
         | 
        
         | 
        
  | 
      
      
        | 223 | 
        
         | 
        
         | 
        /**********************************************************
  | 
      
      
        | 224 | 
        
         | 
        
         | 
         *  - modules-based search
  | 
      
      
        | 225 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 226 | 
        
         | 
        
         | 
        function db_add_search_key_value($key, $value) {
 | 
      
      
        | 227 | 
        
         | 
        
         | 
        	global $database; global $OK; global $FAIL;
  | 
      
      
        | 228 | 
        
            596
         | 
        
            thorn
         | 
        	$table = TABLE_PREFIX.'search';
  | 
      
      
        | 229 | 
        
         | 
        
         | 
        	$query = $database->query("SELECT value FROM $table WHERE name = '$key' LIMIT 1");
 | 
      
      
        | 230 | 
        
            552
         | 
        
            thorn
         | 
        	if($query->numRows() > 0) {
 | 
      
      
        | 231 | 
        
         | 
        
         | 
        		echo "$key: allready there. $OK.<br />";
  | 
      
      
        | 232 | 
        
         | 
        
         | 
        		return true;
  | 
      
      
        | 233 | 
        
         | 
        
         | 
        	} else {
 | 
      
      
        | 234 | 
        
            596
         | 
        
            thorn
         | 
        		$database->query("INSERT INTO $table (name,value,extra) VALUES ('$key', '$value', '')");
 | 
      
      
        | 235 | 
        
            648
         | 
        
            thorn
         | 
        		echo (mysql_error()?mysql_error().'<br />':'');
  | 
      
      
        | 236 | 
        
            596
         | 
        
            thorn
         | 
        		$query = $database->query("SELECT value FROM $table WHERE name = '$key' LIMIT 1");
 | 
      
      
        | 237 | 
        
            552
         | 
        
            thorn
         | 
        		if($query->numRows() > 0) {
 | 
      
      
        | 238 | 
        
         | 
        
         | 
        			echo "$key: $OK.<br />";
  | 
      
      
        | 239 | 
        
         | 
        
         | 
        			return true;
  | 
      
      
        | 240 | 
        
         | 
        
         | 
        		} else {
 | 
      
      
        | 241 | 
        
         | 
        
         | 
        			echo "$key: $FAIL!<br />";
  | 
      
      
        | 242 | 
        
         | 
        
         | 
        			return false;
  | 
      
      
        | 243 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 244 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 245 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 246 | 
        
            644
         | 
        
            thorn
         | 
        function db_add_field($field, $table, $desc) {
 | 
      
      
        | 247 | 
        
         | 
        
         | 
        	global $database; global $OK; global $FAIL;
  | 
      
      
        | 248 | 
        
            648
         | 
        
            thorn
         | 
        	echo "<u>Adding field '$field' to table '$table'</u><br />";
  | 
      
      
        | 249 | 
        
            644
         | 
        
            thorn
         | 
        	$table = TABLE_PREFIX.$table;
  | 
      
      
        | 250 | 
        
         | 
        
         | 
        	$query = $database->query("DESCRIBE $table '$field'");
 | 
      
      
        | 251 | 
        
         | 
        
         | 
        	if($query->numRows() == 0) { // add field
 | 
      
      
        | 252 | 
        
         | 
        
         | 
        		$query = $database->query("ALTER TABLE $table ADD $field $desc");
 | 
      
      
        | 253 | 
        
            648
         | 
        
            thorn
         | 
        		echo (mysql_error()?mysql_error().'<br />':'');
  | 
      
      
        | 254 | 
        
            644
         | 
        
            thorn
         | 
        		$query = $database->query("DESCRIBE $table '$field'");
 | 
      
      
        | 255 | 
        
            648
         | 
        
            thorn
         | 
        		echo (mysql_error()?mysql_error().'<br />':'');
  | 
      
      
        | 256 | 
        
            644
         | 
        
            thorn
         | 
        		if($query->numRows() > 0) {
 | 
      
      
        | 257 | 
        
         | 
        
         | 
        			echo "'$field' added. $OK.<br />";
  | 
      
      
        | 258 | 
        
         | 
        
         | 
        		} else {
 | 
      
      
        | 259 | 
        
         | 
        
         | 
        			echo "adding '$field' $FAIL!<br />";
  | 
      
      
        | 260 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 261 | 
        
         | 
        
         | 
        	} else {
 | 
      
      
        | 262 | 
        
         | 
        
         | 
        		echo "'$field' allready there. $OK.<br />";
  | 
      
      
        | 263 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 264 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 265 | 
        
            552
         | 
        
            thorn
         | 
        
  | 
      
      
        | 266 | 
        
         | 
        
         | 
        echo "<br /><u>Adding module_order and max_excerpt to search-table</u><br />";
  | 
      
      
        | 267 | 
        
         | 
        
         | 
        // module_order - in which order to show the search-results
  | 
      
      
        | 268 | 
        
         | 
        
         | 
        // max_excerpt - how many lines of excerpt to print per matching page
  | 
      
      
        | 269 | 
        
         | 
        
         | 
        
  | 
      
      
        | 270 | 
        
         | 
        
         | 
        $cfg = array(
  | 
      
      
        | 271 | 
        
         | 
        
         | 
        	'module_order' => 'faqbaker,manual,wysiwyg',
  | 
      
      
        | 272 | 
        
         | 
        
         | 
        	'max_excerpt' => '15'
  | 
      
      
        | 273 | 
        
         | 
        
         | 
        );
  | 
      
      
        | 274 | 
        
         | 
        
         | 
        foreach($cfg as $key=>$value) {
 | 
      
      
        | 275 | 
        
         | 
        
         | 
        	db_add_search_key_value($key, $value);
  | 
      
      
        | 276 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 277 | 
        
         | 
        
         | 
        
  | 
      
      
        | 278 | 
        
            644
         | 
        
            thorn
         | 
        echo "<br /><u>Adding some internal config-elements to search-table</u><br />";
  | 
      
      
        | 279 | 
        
         | 
        
         | 
        // These are global config-elements which don't appear in settings-page. Change them in the database if needed.
  | 
      
      
        | 280 | 
        
         | 
        
         | 
        // cfg_show_description - whether to show page-description on the results page (true/false), def: true
  | 
      
      
        | 281 | 
        
         | 
        
         | 
        // cfg_search_description - whether to search in page-description (true/false), def: true [only used while searching title/link/description/keywords]
  | 
      
      
        | 282 | 
        
         | 
        
         | 
        // cfg_search_keywords - whether to search in page-keywords (true/false), def: true [only used while searching title/link/description/keywords]
  | 
      
      
        | 283 | 
        
         | 
        
         | 
        // cfg_enable_old_search - use old search-method, too (true/false), def: true [use old method as fallback]
  | 
      
      
        | 284 | 
        
         | 
        
         | 
        $cfg = array(
  | 
      
      
        | 285 | 
        
         | 
        
         | 
        	'cfg_show_description' => 'true',
  | 
      
      
        | 286 | 
        
         | 
        
         | 
        	'cfg_search_description' => 'true',
  | 
      
      
        | 287 | 
        
         | 
        
         | 
        	'cfg_search_keywords' => 'true',
  | 
      
      
        | 288 | 
        
         | 
        
         | 
        	'cfg_enable_old_search' => 'true'
  | 
      
      
        | 289 | 
        
         | 
        
         | 
        );
  | 
      
      
        | 290 | 
        
         | 
        
         | 
        foreach($cfg as $key=>$value) {
 | 
      
      
        | 291 | 
        
         | 
        
         | 
        	db_add_search_key_value($key, $value);
  | 
      
      
        | 292 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 293 | 
        
            552
         | 
        
            thorn
         | 
        
  | 
      
      
        | 294 | 
        
         | 
        
         | 
        echo "<br /><u>Changing results_loop in search-table</u><br />";
  | 
      
      
        | 295 | 
        
         | 
        
         | 
        // adding [EXCERPT]
  | 
      
      
        | 296 | 
        
         | 
        
         | 
        
  | 
      
      
        | 297 | 
        
         | 
        
         | 
        $query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'results_loop' LIMIT 1");
 | 
      
      
        | 298 | 
        
         | 
        
         | 
        if($query->numRows() > 0) {
 | 
      
      
        | 299 | 
        
         | 
        
         | 
        	$fetch_results_loop = $query->fetchRow();
  | 
      
      
        | 300 | 
        
         | 
        
         | 
        	$string = $fetch_results_loop['value'];
  | 
      
      
        | 301 | 
        
         | 
        
         | 
        	if(preg_match("/\[EXCERPT\]/", $string)) {
 | 
      
      
        | 302 | 
        
         | 
        
         | 
        		echo "[EXCERPT] is allready there. $OK.<br />";
  | 
      
      
        | 303 | 
        
         | 
        
         | 
        	} else {
 | 
      
      
        | 304 | 
        
         | 
        
         | 
        		$string = preg_replace("/10px;\">\[DESCRIPTION\]/", "5px;\">[DESCRIPTION]", $string);
 | 
      
      
        | 305 | 
        
         | 
        
         | 
        		$string .= "<tr><td colspan=\"2\" style=\"text-align: justify; padding-bottom: 10px;\">[EXCERPT]</td></tr>";
  | 
      
      
        | 306 | 
        
         | 
        
         | 
        		$string = addslashes($string);
  | 
      
      
        | 307 | 
        
         | 
        
         | 
        		$database->query("UPDATE ".TABLE_PREFIX."search SET name='results_loop',value='".$string."',extra='' WHERE name = 'results_loop' LIMIT 1");
 | 
      
      
        | 308 | 
        
            648
         | 
        
            thorn
         | 
        		echo (mysql_error()?mysql_error().'<br />':'');
  | 
      
      
        | 309 | 
        
            552
         | 
        
            thorn
         | 
        		$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'results_loop' LIMIT 1");
 | 
      
      
        | 310 | 
        
         | 
        
         | 
        		if($query->numRows() > 0) {
 | 
      
      
        | 311 | 
        
         | 
        
         | 
        			$fetch_results_loop = $query->fetchRow();
  | 
      
      
        | 312 | 
        
         | 
        
         | 
        			$string = $fetch_results_loop['value'];
  | 
      
      
        | 313 | 
        
         | 
        
         | 
        			if(preg_match("/\[EXCERPT\]/", $string)) {
 | 
      
      
        | 314 | 
        
         | 
        
         | 
        				echo "[EXCERPT] added. $OK.<br />";
  | 
      
      
        | 315 | 
        
         | 
        
         | 
        			} else {
 | 
      
      
        | 316 | 
        
         | 
        
         | 
        				echo "adding [EXCERPT] $FAIL!<br />";
  | 
      
      
        | 317 | 
        
         | 
        
         | 
        			}
  | 
      
      
        | 318 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 319 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 320 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 321 | 
        
         | 
        
         | 
        
  | 
      
      
        | 322 | 
        
         | 
        
         | 
        echo "<br /><u>Changing \"Header:\" in search-table</u><br />";
  | 
      
      
        | 323 | 
        
         | 
        
         | 
        // adding [SEARCH_PATH]
  | 
      
      
        | 324 | 
        
         | 
        
         | 
        
  | 
      
      
        | 325 | 
        
         | 
        
         | 
        $query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'header' LIMIT 1");
 | 
      
      
        | 326 | 
        
         | 
        
         | 
        if($query->numRows() > 0) {
 | 
      
      
        | 327 | 
        
         | 
        
         | 
        	$fetch_header = $query->fetchRow();
  | 
      
      
        | 328 | 
        
         | 
        
         | 
        	$string = $fetch_header['value'];
  | 
      
      
        | 329 | 
        
         | 
        
         | 
        	if(preg_match("/\[SEARCH_PATH\]/", $string)) {
 | 
      
      
        | 330 | 
        
         | 
        
         | 
        		echo "[SEARCH_PATH] is allready there. $OK.<br />";
  | 
      
      
        | 331 | 
        
         | 
        
         | 
        	} else {
 | 
      
      
        | 332 | 
        
         | 
        
         | 
        		$string = preg_replace("/<input type=\"text\" name=\"string\" value=\"\[SEARCH_STRING\]\" style=\"width: 100%;\" \/>/", "<input type=\"hidden\" name=\"search_path\" value=\"[SEARCH_PATH]\" /><input type=\"text\" name=\"string\" value=\"[SEARCH_STRING]\" style=\"width: 100%;\" />", $string);
 | 
      
      
        | 333 | 
        
         | 
        
         | 
        		$string = addslashes($string);
  | 
      
      
        | 334 | 
        
         | 
        
         | 
        		$database->query("UPDATE ".TABLE_PREFIX."search SET name='header',value='".$string."',extra='' WHERE name = 'header' LIMIT 1");
 | 
      
      
        | 335 | 
        
            648
         | 
        
            thorn
         | 
        		echo (mysql_error()?mysql_error().'<br />':'');
  | 
      
      
        | 336 | 
        
            552
         | 
        
            thorn
         | 
        		$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'header' LIMIT 1");
 | 
      
      
        | 337 | 
        
         | 
        
         | 
        		if($query->numRows() > 0) {
 | 
      
      
        | 338 | 
        
         | 
        
         | 
        			$fetch_header = $query->fetchRow();
  | 
      
      
        | 339 | 
        
         | 
        
         | 
        			$string = $fetch_header['value'];
  | 
      
      
        | 340 | 
        
         | 
        
         | 
        			if(preg_match("/\[SEARCH_PATH\]/", $string)) {
 | 
      
      
        | 341 | 
        
         | 
        
         | 
        				echo "[SEARCH_PATH] added. $OK.<br />";
  | 
      
      
        | 342 | 
        
         | 
        
         | 
        			} else {
 | 
      
      
        | 343 | 
        
         | 
        
         | 
        				echo "adding [SEARCH_PATH] $FAIL!<br />";
  | 
      
      
        | 344 | 
        
         | 
        
         | 
        			}
  | 
      
      
        | 345 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 346 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 347 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 348 | 
        
         | 
        
         | 
        
  | 
      
      
        | 349 | 
        
            714
         | 
        
            Ruebenwurz
         | 
        
  | 
      
      
        | 350 | 
        
            552
         | 
        
            thorn
         | 
        /**********************************************************
  | 
      
      
        | 351 | 
        
         | 
        
         | 
         *  - publish-by-date
  | 
      
      
        | 352 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 353 | 
        
         | 
        
         | 
        // Add fields "publ_start" and "publ_end" to table "sections"
  | 
      
      
        | 354 | 
        
         | 
        
         | 
        // check if fields are present
  | 
      
      
        | 355 | 
        
            644
         | 
        
            thorn
         | 
        db_add_field('publ_start', 'sections', "INT NOT NULL DEFAULT '0'");
 | 
      
      
        | 356 | 
        
         | 
        
         | 
        db_add_field('publ_end', 'sections', "INT NOT NULL DEFAULT '0'");
 | 
      
      
        | 357 | 
        
            552
         | 
        
            thorn
         | 
        
  | 
      
      
        | 358 | 
        
         | 
        
         | 
        
  | 
      
      
        | 359 | 
        
            566
         | 
        
            thorn
         | 
        /**********************************************************
  | 
      
      
        | 360 | 
        
         | 
        
         | 
         *  - core-module menu_link
  | 
      
      
        | 361 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 362 | 
        
         | 
        
         | 
        // create table
  | 
      
      
        | 363 | 
        
         | 
        
         | 
        $table = TABLE_PREFIX ."mod_menu_link";
  | 
      
      
        | 364 | 
        
         | 
        
         | 
        $database->query("DROP TABLE IF EXISTS `$table`");
 | 
      
      
        | 365 | 
        
         | 
        
         | 
        $database->query("
 | 
      
      
        | 366 | 
        
         | 
        
         | 
        	CREATE TABLE `$table` (
  | 
      
      
        | 367 | 
        
         | 
        
         | 
        		`section_id` INT(11) NOT NULL DEFAULT '0',
  | 
      
      
        | 368 | 
        
         | 
        
         | 
        		`page_id` INT(11) NOT NULL DEFAULT '0',
  | 
      
      
        | 369 | 
        
         | 
        
         | 
        		`target_page_id` INT(11) NOT NULL DEFAULT '0',
  | 
      
      
        | 370 | 
        
            575
         | 
        
            thorn
         | 
        		`anchor` VARCHAR(255) NOT NULL DEFAULT '0' ,
  | 
      
      
        | 371 | 
        
            701
         | 
        
            thorn
         | 
        		`extern` VARCHAR(255) NOT NULL DEFAULT '' ,
  | 
      
      
        | 372 | 
        
            566
         | 
        
            thorn
         | 
        		PRIMARY KEY (`section_id`)
  | 
      
      
        | 373 | 
        
         | 
        
         | 
        	)
  | 
      
      
        | 374 | 
        
         | 
        
         | 
        ");
  | 
      
      
        | 375 | 
        
         | 
        
         | 
        // fetch all menu_link-pages in $pages
  | 
      
      
        | 376 | 
        
         | 
        
         | 
        $pages = array();
  | 
      
      
        | 377 | 
        
         | 
        
         | 
        $table_p = TABLE_PREFIX.'pages';
  | 
      
      
        | 378 | 
        
         | 
        
         | 
        $table_s = TABLE_PREFIX.'sections';
  | 
      
      
        | 379 | 
        
            580
         | 
        
            thorn
         | 
        $table_mm = TABLE_PREFIX ."mod_menu_link";
  | 
      
      
        | 380 | 
        
         | 
        
         | 
        
  | 
      
      
        | 381 | 
        
         | 
        
         | 
        $query_page = $database->query("SELECT p.*, s.section_id FROM $table_p AS p, $table_s AS s WHERE p.page_id=s.page_id AND s.module = 'menu_link'");
 | 
      
      
        | 382 | 
        
            566
         | 
        
            thorn
         | 
        if($query_page->numRows() > 0) {
 | 
      
      
        | 383 | 
        
         | 
        
         | 
        	while($page = $query_page->fetchRow()) {
 | 
      
      
        | 384 | 
        
         | 
        
         | 
        		$pages[$page['page_id']]['page_details'] = $page;
  | 
      
      
        | 385 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 386 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 387 | 
        
            648
         | 
        
            thorn
         | 
        if($pages!=array())
  | 
      
      
        | 388 | 
        
         | 
        
         | 
        	echo "<br /><u>Convert menu_links</u><br />";
  | 
      
      
        | 389 | 
        
         | 
        
         | 
        
  | 
      
      
        | 390 | 
        
            566
         | 
        
            thorn
         | 
        // get all related files with content from pages/ in $pages, too
  | 
      
      
        | 391 | 
        
         | 
        
         | 
        function list_files_dirs($dir, $depth=true, $files=array(), $dirs=array()) {
 | 
      
      
        | 392 | 
        
         | 
        
         | 
        	$dh=opendir($dir);
  | 
      
      
        | 393 | 
        
         | 
        
         | 
        	while(($file = readdir($dh)) !== false) {
 | 
      
      
        | 394 | 
        
         | 
        
         | 
        		if($file == '.' || $file == '..') {
 | 
      
      
        | 395 | 
        
         | 
        
         | 
        			continue;
  | 
      
      
        | 396 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 397 | 
        
         | 
        
         | 
        		if(is_dir($dir.'/'.$file)) {
 | 
      
      
        | 398 | 
        
         | 
        
         | 
        			if($depth) {
 | 
      
      
        | 399 | 
        
         | 
        
         | 
        				$dirs[] = $dir.'/'.$file;
  | 
      
      
        | 400 | 
        
         | 
        
         | 
        				list($files, $dirs) = list_files_dirs($dir.'/'.$file, $depth, $files, $dirs);
  | 
      
      
        | 401 | 
        
         | 
        
         | 
        			}
  | 
      
      
        | 402 | 
        
         | 
        
         | 
        		} else {
 | 
      
      
        | 403 | 
        
         | 
        
         | 
        			$files[] = $dir.'/'.$file;
  | 
      
      
        | 404 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 405 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 406 | 
        
         | 
        
         | 
        	closedir($dh);
  | 
      
      
        | 407 | 
        
         | 
        
         | 
        	natcasesort($files);
  | 
      
      
        | 408 | 
        
         | 
        
         | 
        	natcasesort($dirs);
  | 
      
      
        | 409 | 
        
         | 
        
         | 
        	return(array($files, $dirs));
  | 
      
      
        | 410 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 411 | 
        
         | 
        
         | 
        list($files, $dirs) = list_files_dirs(WB_PATH.PAGES_DIRECTORY);
  | 
      
      
        | 412 | 
        
         | 
        
         | 
        foreach($files as $file) {
 | 
      
      
        | 413 | 
        
         | 
        
         | 
        	if(($content = implode('', file($file))) !== FALSE) {
 | 
      
      
        | 414 | 
        
         | 
        
         | 
        		if(preg_match('/\$page_id = (\d+)/', $content, $matches)) {
 | 
      
      
        | 415 | 
        
         | 
        
         | 
        			if(array_key_exists($matches[1], $pages)) {
 | 
      
      
        | 416 | 
        
         | 
        
         | 
        				$pages[$matches[1]]['file_content'] = $content;
  | 
      
      
        | 417 | 
        
         | 
        
         | 
        				$pages[$matches[1]]['filename'] = $file;
  | 
      
      
        | 418 | 
        
         | 
        
         | 
        			}
  | 
      
      
        | 419 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 420 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 421 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 422 | 
        
            580
         | 
        
            thorn
         | 
        unset($files); unset($dirs);
  | 
      
      
        | 423 | 
        
            566
         | 
        
            thorn
         | 
        // try to convert old menu_links to new ones
  | 
      
      
        | 424 | 
        
         | 
        
         | 
        foreach($pages as $p) {
 | 
      
      
        | 425 | 
        
         | 
        
         | 
        	$page = $p['page_details'];
  | 
      
      
        | 426 | 
        
         | 
        
         | 
        	$file_content = $p['file_content'];
  | 
      
      
        | 427 | 
        
         | 
        
         | 
        	$filename = $p['filename'];
  | 
      
      
        | 428 | 
        
         | 
        
         | 
        	$link = $p['page_details']['link'];
  | 
      
      
        | 429 | 
        
            580
         | 
        
            thorn
         | 
        	$parent_pid = $p['page_details']['parent'];
  | 
      
      
        | 430 | 
        
            579
         | 
        
            thorn
         | 
        	$page_id = $p['page_details']['page_id'];
  | 
      
      
        | 431 | 
        
            580
         | 
        
            thorn
         | 
        	$section_id = $p['page_details']['section_id'];
  | 
      
      
        | 432 | 
        
         | 
        
         | 
        	$menu_title = $p['page_details']['menu_title'];
  | 
      
      
        | 433 | 
        
            562
         | 
        
            Ruebenwurz
         | 
        
  | 
      
      
        | 434 | 
        
            580
         | 
        
            thorn
         | 
        	// calculate link from wb_pages.parent and menu_title
  | 
      
      
        | 435 | 
        
         | 
        
         | 
        	$cur_link = '';
  | 
      
      
        | 436 | 
        
         | 
        
         | 
        	if($parent_pid != '0' && $query_link = $database->query("SELECT link FROM $table_p WHERE page_id = '$parent_pid'")) {
 | 
      
      
        | 437 | 
        
         | 
        
         | 
        		$res = $query_link->fetchRow();
  | 
      
      
        | 438 | 
        
         | 
        
         | 
        		$cur_link .= $res['link'];
  | 
      
      
        | 439 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 440 | 
        
         | 
        
         | 
        	$cur_link .= '/'.page_filename($menu_title);
  | 
      
      
        | 441 | 
        
         | 
        
         | 
        echo "found: $cur_link<br />";
  | 
      
      
        | 442 | 
        
         | 
        
         | 
        	$database->query("UPDATE $table_p SET link = '$cur_link' WHERE page_id = '$page_id'");
 | 
      
      
        | 443 | 
        
            648
         | 
        
            thorn
         | 
        	echo (mysql_error()?'mySQL: '.mysql_error().'<br />':'');
  | 
      
      
        | 444 | 
        
            580
         | 
        
            thorn
         | 
        
  | 
      
      
        | 445 | 
        
         | 
        
         | 
        	$new_filenames[$page_id]['file'] = WB_PATH.PAGES_DIRECTORY.$cur_link.PAGE_EXTENSION;
  | 
      
      
        | 446 | 
        
         | 
        
         | 
        	$new_filenames[$page_id]['link'] = $cur_link;
  | 
      
      
        | 447 | 
        
         | 
        
         | 
        	$new_filenames[$page_id]['menu'] = $menu_title;
  | 
      
      
        | 448 | 
        
         | 
        
         | 
        
  | 
      
      
        | 449 | 
        
         | 
        
         | 
        	// delete old access files in pages
  | 
      
      
        | 450 | 
        
         | 
        
         | 
        	if(file_exists($filename)) {
 | 
      
      
        | 451 | 
        
         | 
        
         | 
        		if(!is_writable(WB_PATH.PAGES_DIRECTORY.'/')) {
 | 
      
      
        | 452 | 
        
         | 
        
         | 
        			echo "Cannot delete access file in pages/ - permission denied ($FAIL)<br />";
  | 
      
      
        | 453 | 
        
         | 
        
         | 
        		} else {
 | 
      
      
        | 454 | 
        
         | 
        
         | 
        			unlink($filename);
  | 
      
      
        | 455 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 456 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 457 | 
        
         | 
        
         | 
        
  | 
      
      
        | 458 | 
        
         | 
        
         | 
        	// make entry in wb_mod_menu_link
  | 
      
      
        | 459 | 
        
         | 
        
         | 
        	if($query_pid = $database->query("SELECT page_id FROM $table_p WHERE page_id != '$page_id' AND link = '$link'")) {
 | 
      
      
        | 460 | 
        
            579
         | 
        
            thorn
         | 
        		$res = $query_pid->fetchRow();
  | 
      
      
        | 461 | 
        
         | 
        
         | 
        		$target_page_id = $res['page_id'];
  | 
      
      
        | 462 | 
        
            701
         | 
        
            thorn
         | 
        		$extern = '';
  | 
      
      
        | 463 | 
        
         | 
        
         | 
        		if(strpos($link, '://') !== FALSE || strpos($link, 'mailto:') !== FALSE) {
 | 
      
      
        | 464 | 
        
         | 
        
         | 
        			$target_page_id=-1;
  | 
      
      
        | 465 | 
        
         | 
        
         | 
        			$extern=addslashes($link);
  | 
      
      
        | 466 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 467 | 
        
         | 
        
         | 
        		$database->query("INSERT INTO $table_mm (page_id, section_id, target_page_id, anchor, extern) VALUES ('$page_id', '$section_id', '$target_page_id', '0', '$extern')");
 | 
      
      
        | 468 | 
        
            648
         | 
        
            thorn
         | 
        		echo (mysql_error()?'mySQL: '.mysql_error().'<br />':'');
  | 
      
      
        | 469 | 
        
            579
         | 
        
            thorn
         | 
        	}
  | 
      
      
        | 470 | 
        
            580
         | 
        
            thorn
         | 
        }
  | 
      
      
        | 471 | 
        
         | 
        
         | 
        // create new access files in pages/; make directories as needed
  | 
      
      
        | 472 | 
        
         | 
        
         | 
        foreach($pages as $p) {
 | 
      
      
        | 473 | 
        
         | 
        
         | 
        	$page_id = $p['page_details']['page_id'];
  | 
      
      
        | 474 | 
        
         | 
        
         | 
        	$filename = $new_filenames[$page_id]['file'];
  | 
      
      
        | 475 | 
        
         | 
        
         | 
        	$menu_title = $new_filenames[$page_id]['menu'];
  | 
      
      
        | 476 | 
        
         | 
        
         | 
        	$link = $new_filenames[$page_id]['link'];
  | 
      
      
        | 477 | 
        
         | 
        
         | 
        	$content = $p['file_content'];
  | 
      
      
        | 478 | 
        
         | 
        
         | 
        	$level = $p['page_details']['level'];
  | 
      
      
        | 479 | 
        
         | 
        
         | 
        	$depth = '';
  | 
      
      
        | 480 | 
        
         | 
        
         | 
        	for($i=0; $i<=$level; $i++)
  | 
      
      
        | 481 | 
        
         | 
        
         | 
        		$depth .= '../';
  | 
      
      
        | 482 | 
        
         | 
        
         | 
        	$content = preg_replace('#((../)+)config\.php#', "{$depth}config.php", $content);
 | 
      
      
        | 483 | 
        
         | 
        
         | 
        	while(file_exists($filename)) {
 | 
      
      
        | 484 | 
        
         | 
        
         | 
        		echo "Cannot create '$filename' - file exist. Renamed to: ";
  | 
      
      
        | 485 | 
        
         | 
        
         | 
        		$menu_title .= '_';
  | 
      
      
        | 486 | 
        
         | 
        
         | 
        		$link .= '_';
  | 
      
      
        | 487 | 
        
         | 
        
         | 
        		$filename = WB_PATH.PAGES_DIRECTORY.$link.PAGE_EXTENSION;
  | 
      
      
        | 488 | 
        
         | 
        
         | 
        		echo "$filename<br />";
  | 
      
      
        | 489 | 
        
         | 
        
         | 
        		$database->query("UPDATE $table_p SET link='$link', menu_title='$menu_title' WHERE page_id = '$page_id'");
 | 
      
      
        | 490 | 
        
         | 
        
         | 
        		echo mysql_error()?'mySQL: '.mysql_error().'<br />':'';
  | 
      
      
        | 491 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 492 | 
        
         | 
        
         | 
        	// check if we need to create a subdir somewhere
  | 
      
      
        | 493 | 
        
         | 
        
         | 
        	$dirs = array();
  | 
      
      
        | 494 | 
        
         | 
        
         | 
        	while(dirname($link) != '/') {
 | 
      
      
        | 495 | 
        
         | 
        
         | 
        		$link = dirname($link);
  | 
      
      
        | 496 | 
        
         | 
        
         | 
        		$dirs[] = WB_PATH.PAGES_DIRECTORY.$link;
  | 
      
      
        | 497 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 498 | 
        
         | 
        
         | 
        	foreach(array_reverse($dirs) as $dir) {
 | 
      
      
        | 499 | 
        
         | 
        
         | 
        		if(!file_exists($dir)) {
 | 
      
      
        | 500 | 
        
         | 
        
         | 
        			mkdir($dir, OCTAL_DIR_MODE);
  | 
      
      
        | 501 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 502 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 503 | 
        
         | 
        
         | 
        	// create new file in pages/
  | 
      
      
        | 504 | 
        
         | 
        
         | 
        	if($handle=fopen($filename, "wb")) {
 | 
      
      
        | 505 | 
        
         | 
        
         | 
        		if(!fwrite($handle, $content)) {
 | 
      
      
        | 506 | 
        
         | 
        
         | 
        			echo "Cannot write to $filename - ($FAIL)<br />";
  | 
      
      
        | 507 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 508 | 
        
         | 
        
         | 
        		fclose($handle);
  | 
      
      
        | 509 | 
        
         | 
        
         | 
        	} else {
 | 
      
      
        | 510 | 
        
         | 
        
         | 
        		echo "Cannot create $filename - ($FAIL)<br />";
  | 
      
      
        | 511 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 512 | 
        
         | 
        
         | 
        
  | 
      
      
        | 513 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 514 | 
        
            566
         | 
        
            thorn
         | 
        
  | 
      
      
        | 515 | 
        
            627
         | 
        
            doc
         | 
        // some code missing to regenerate page_title from link/filename
  | 
      
      
        | 516 | 
        
         | 
        
         | 
        // for_all_pages: if filename($page_title) != basename($link) {
 | 
      
      
        | 517 | 
        
         | 
        
         | 
        //   rename $page_title to basename($link)
  | 
      
      
        | 518 | 
        
         | 
        
         | 
        // }
  | 
      
      
        | 519 | 
        
         | 
        
         | 
        // This must be done after menu_link-upgrade
  | 
      
      
        | 520 | 
        
         | 
        
         | 
        //
  | 
      
      
        | 521 | 
        
         | 
        
         | 
        // Should we really do this? - must be checked
  | 
      
      
        | 522 | 
        
         | 
        
         | 
        
  | 
      
      
        | 523 | 
        
            714
         | 
        
            Ruebenwurz
         | 
        
  | 
      
      
        | 524 | 
        
            596
         | 
        
            thorn
         | 
        /**********************************************************
  | 
      
      
        | 525 | 
        
         | 
        
         | 
         *  - asp - Advanced Spam Protection
  | 
      
      
        | 526 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 527 | 
        
         | 
        
         | 
        echo "<br /><u>Adding table mod_captcha_control</u><br />";
  | 
      
      
        | 528 | 
        
         | 
        
         | 
        $table = TABLE_PREFIX.'mod_captcha_control';
  | 
      
      
        | 529 | 
        
         | 
        
         | 
        $database->query("DROP TABLE IF EXISTS `$table`");
 | 
      
      
        | 530 | 
        
         | 
        
         | 
        $database->query("CREATE TABLE `$table` (
 | 
      
      
        | 531 | 
        
         | 
        
         | 
        	`enabled_captcha` VARCHAR(1) NOT NULL DEFAULT '1',
  | 
      
      
        | 532 | 
        
         | 
        
         | 
        	`enabled_asp` VARCHAR(1) NOT NULL DEFAULT '1',
  | 
      
      
        | 533 | 
        
         | 
        
         | 
        	`captcha_type` VARCHAR(255) NOT NULL DEFAULT 'calc_text',
  | 
      
      
        | 534 | 
        
         | 
        
         | 
        	`asp_session_min_age` INT(11) NOT NULL DEFAULT '20',
  | 
      
      
        | 535 | 
        
         | 
        
         | 
        	`asp_view_min_age` INT(11) NOT NULL DEFAULT '10',
  | 
      
      
        | 536 | 
        
            642
         | 
        
            thorn
         | 
        	`asp_input_min_age` INT(11) NOT NULL DEFAULT '5',
  | 
      
      
        | 537 | 
        
         | 
        
         | 
        	`ct_text` LONGTEXT NOT NULL DEFAULT ''
  | 
      
      
        | 538 | 
        
            596
         | 
        
            thorn
         | 
        	)"
  | 
      
      
        | 539 | 
        
         | 
        
         | 
        );
  | 
      
      
        | 540 | 
        
         | 
        
         | 
        $database->query("
 | 
      
      
        | 541 | 
        
         | 
        
         | 
        	INSERT INTO `$table`
  | 
      
      
        | 542 | 
        
         | 
        
         | 
        		(`enabled_captcha`, `enabled_asp`, `captcha_type`)
  | 
      
      
        | 543 | 
        
         | 
        
         | 
        	VALUES
  | 
      
      
        | 544 | 
        
         | 
        
         | 
        		('1', '1', 'calc_text')
 | 
      
      
        | 545 | 
        
         | 
        
         | 
        ");
  | 
      
      
        | 546 | 
        
            566
         | 
        
            thorn
         | 
        
  | 
      
      
        | 547 | 
        
            714
         | 
        
            Ruebenwurz
         | 
        
  | 
      
      
        | 548 | 
        
            648
         | 
        
            thorn
         | 
        /**********************************************************
  | 
      
      
        | 549 | 
        
         | 
        
         | 
         *  - multi-group
  | 
      
      
        | 550 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 551 | 
        
         | 
        
         | 
        db_add_field('groups_id', 'users', "VARCHAR( 255 ) NOT NULL DEFAULT '0' AFTER group_id");
 | 
      
      
        | 552 | 
        
         | 
        
         | 
        $table = TABLE_PREFIX.'users';
  | 
      
      
        | 553 | 
        
         | 
        
         | 
        if($query_group = $database->query("SELECT user_id,group_id,groups_id FROM $table")) {
 | 
      
      
        | 554 | 
        
         | 
        
         | 
        	while($group = $query_group->fetchRow()) {
 | 
      
      
        | 555 | 
        
         | 
        
         | 
        		if($group['groups_id'] == '0') {
 | 
      
      
        | 556 | 
        
         | 
        
         | 
        			if($database->query("UPDATE $table SET groups_id = group_id WHERE user_id = {$group['user_id']}")) {
 | 
      
      
        | 557 | 
        
         | 
        
         | 
        				echo 'groups_id updated successfully<br>';
  | 
      
      
        | 558 | 
        
         | 
        
         | 
        			}
  | 
      
      
        | 559 | 
        
         | 
        
         | 
        			echo mysql_error().'<br />';
  | 
      
      
        | 560 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 561 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 562 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 563 | 
        
            566
         | 
        
            thorn
         | 
        
  | 
      
      
        | 564 | 
        
            648
         | 
        
            thorn
         | 
        
  | 
      
      
        | 565 | 
        
            714
         | 
        
            Ruebenwurz
         | 
        /**********************************************************
  | 
      
      
        | 566 | 
        
         | 
        
         | 
         *  -Javascript Admin
  | 
      
      
        | 567 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 568 | 
        
         | 
        
         | 
        echo "<br /><u>Adding table mod_jsadmin</u><br />";
  | 
      
      
        | 569 | 
        
         | 
        
         | 
        $table = TABLE_PREFIX ."mod_jsadmin";
  | 
      
      
        | 570 | 
        
         | 
        
         | 
        $database->query("DROP TABLE IF EXISTS `$table`");
 | 
      
      
        | 571 | 
        
            648
         | 
        
            thorn
         | 
        
  | 
      
      
        | 572 | 
        
            714
         | 
        
            Ruebenwurz
         | 
        $database->query("
 | 
      
      
        | 573 | 
        
         | 
        
         | 
        	CREATE TABLE `$table` (
  | 
      
      
        | 574 | 
        
         | 
        
         | 
            `id` INT(11) NOT NULL DEFAULT '0',
  | 
      
      
        | 575 | 
        
         | 
        
         | 
        		`name` VARCHAR(255) NOT NULL DEFAULT '0',
  | 
      
      
        | 576 | 
        
         | 
        
         | 
        		`value` INT(11) NOT NULL DEFAULT '0',
  | 
      
      
        | 577 | 
        
         | 
        
         | 
           	PRIMARY KEY (`id`)
  | 
      
      
        | 578 | 
        
         | 
        
         | 
        	)
  | 
      
      
        | 579 | 
        
         | 
        
         | 
        ");
  | 
      
      
        | 580 | 
        
            552
         | 
        
            thorn
         | 
        
  | 
      
      
        | 581 | 
        
            714
         | 
        
            Ruebenwurz
         | 
        global $database;
  | 
      
      
        | 582 | 
        
         | 
        
         | 
        $database->query("INSERT INTO ".$table." (id,name,value) VALUES ('1','mod_jsadmin_persist_order','0')");
 | 
      
      
        | 583 | 
        
         | 
        
         | 
        $database->query("INSERT INTO ".$table." (id,name,value) VALUES ('2','mod_jsadmin_ajax_order_pages','0')");
 | 
      
      
        | 584 | 
        
         | 
        
         | 
        $database->query("INSERT INTO ".$table." (id,name,value) VALUES ('3','mod_jsadmin_ajax_order_sections','0')");
 | 
      
      
        | 585 | 
        
         | 
        
         | 
        
  | 
      
      
        | 586 | 
        
         | 
        
         | 
        
  | 
      
      
        | 587 | 
        
         | 
        
         | 
        /**********************************************************
  | 
      
      
        | 588 | 
        
         | 
        
         | 
         *  - Output Filter
  | 
      
      
        | 589 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 590 | 
        
         | 
        
         | 
        echo "<br /><u>Adding table mod_outputfilter</u><br />";
  | 
      
      
        | 591 | 
        
         | 
        
         | 
        $table = TABLE_PREFIX .'mod_output_filter';
  | 
      
      
        | 592 | 
        
         | 
        
         | 
        $database->query("DROP TABLE IF EXISTS `$table`");
 | 
      
      
        | 593 | 
        
         | 
        
         | 
        
  | 
      
      
        | 594 | 
        
         | 
        
         | 
        $database->query("CREATE TABLE `$table` (
 | 
      
      
        | 595 | 
        
         | 
        
         | 
        	`email_filter` VARCHAR(1) NOT NULL DEFAULT '0',
  | 
      
      
        | 596 | 
        
         | 
        
         | 
        	`mailto_filter` VARCHAR(1) NOT NULL DEFAULT '0',
  | 
      
      
        | 597 | 
        
         | 
        
         | 
        	`at_replacement` VARCHAR(255) NOT NULL DEFAULT '(at)',
  | 
      
      
        | 598 | 
        
         | 
        
         | 
        	`dot_replacement` VARCHAR(255) NOT NULL DEFAULT '(dot)'
  | 
      
      
        | 599 | 
        
         | 
        
         | 
        	)"
  | 
      
      
        | 600 | 
        
         | 
        
         | 
        );
  | 
      
      
        | 601 | 
        
         | 
        
         | 
        
  | 
      
      
        | 602 | 
        
         | 
        
         | 
        // add default values to the module table
  | 
      
      
        | 603 | 
        
         | 
        
         | 
        $database->query("INSERT INTO ".TABLE_PREFIX
 | 
      
      
        | 604 | 
        
         | 
        
         | 
        	."mod_output_filter (email_filter, mailto_filter, at_replacement, dot_replacement) VALUES ('0', '0', '(at)', '(dot)')");
 | 
      
      
        | 605 | 
        
         | 
        
         | 
        
  | 
      
      
        | 606 | 
        
         | 
        
         | 
        
  | 
      
      
        | 607 | 
        
         | 
        
         | 
        /**********************************************************
  | 
      
      
        | 608 | 
        
         | 
        
         | 
         *  - Form Modul
  | 
      
      
        | 609 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 610 | 
        
            648
         | 
        
            thorn
         | 
        db_add_field('success_email_subject', 'mod_form_settings', "VARCHAR(255) NOT NULL AFTER `email_subject`");
 | 
      
      
        | 611 | 
        
         | 
        
         | 
        db_add_field('success_email_text', 'mod_form_settings', "TEXT NOT NULL AFTER `email_subject`");
 | 
      
      
        | 612 | 
        
         | 
        
         | 
        db_add_field('success_email_from', 'mod_form_settings', "VARCHAR(255) NOT NULL AFTER `email_subject`");
 | 
      
      
        | 613 | 
        
         | 
        
         | 
        db_add_field('success_email_to', 'mod_form_settings', "TEXT NOT NULL AFTER `email_subject`");
 | 
      
      
        | 614 | 
        
         | 
        
         | 
        db_add_field('success_page', 'mod_form_settings', "TEXT NOT NULL AFTER `email_subject`");
 | 
      
      
        | 615 | 
        
            644
         | 
        
            thorn
         | 
        db_add_field('email_fromname', 'mod_form_settings', "VARCHAR( 255 ) NOT NULL AFTER email_from");
 | 
      
      
        | 616 | 
        
         | 
        
         | 
        db_add_field('success_email_fromname', 'mod_form_settings', "VARCHAR( 255 ) NOT NULL AFTER success_email_from");
 | 
      
      
        | 617 | 
        
            560
         | 
        
            Ruebenwurz
         | 
        
  | 
      
      
        | 618 | 
        
         | 
        
         | 
        echo "<BR><B>Deleting field success_message from table mod_form_settings</B><BR>";
  | 
      
      
        | 619 | 
        
         | 
        
         | 
        
  | 
      
      
        | 620 | 
        
         | 
        
         | 
        if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_form_settings` DROP `success_message`")) {
 | 
      
      
        | 621 | 
        
         | 
        
         | 
        	echo 'Database field success_message droped successfully<br>';
  | 
      
      
        | 622 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 623 | 
        
         | 
        
         | 
        echo mysql_error().'<br />';
  | 
      
      
        | 624 | 
        
         | 
        
         | 
        
  | 
      
      
        | 625 | 
        
         | 
        
         | 
        // These are the default setting
  | 
      
      
        | 626 | 
        
         | 
        
         | 
        $success_page = 'none';
  | 
      
      
        | 627 | 
        
         | 
        
         | 
        $success_email_to = '';
  | 
      
      
        | 628 | 
        
         | 
        
         | 
        $success_email_text = 'Thank you for submitting your form on '.WEBSITE_TITLE;
  | 
      
      
        | 629 | 
        
         | 
        
         | 
        $success_email_text = addslashes($success_email_text);
  | 
      
      
        | 630 | 
        
         | 
        
         | 
        $success_email_subject = 'You have submitted a form';
  | 
      
      
        | 631 | 
        
         | 
        
         | 
        
  | 
      
      
        | 632 | 
        
         | 
        
         | 
        // Insert default settings into database
  | 
      
      
        | 633 | 
        
         | 
        
         | 
        $query_dates = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_settings where section_id != 0 and page_id != 0");
 | 
      
      
        | 634 | 
        
         | 
        
         | 
        while($result = $query_dates->fetchRow()) {
 | 
      
      
        | 635 | 
        
         | 
        
         | 
        
  | 
      
      
        | 636 | 
        
         | 
        
         | 
        	echo "<B>Add default settings data to database for form section_id= ".$result['section_id']."</b><BR>";
  | 
      
      
        | 637 | 
        
         | 
        
         | 
        	$section_id = $result['section_id'];
  | 
      
      
        | 638 | 
        
         | 
        
         | 
        
  | 
      
      
        | 639 | 
        
         | 
        
         | 
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_form_settings` SET `success_page` = '$success_page' WHERE `section_id` = $section_id")) {
 | 
      
      
        | 640 | 
        
         | 
        
         | 
        		echo 'Database data success_page added successfully<br>';
  | 
      
      
        | 641 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 642 | 
        
         | 
        
         | 
        	echo mysql_error().'<br />';
  | 
      
      
        | 643 | 
        
         | 
        
         | 
        
  | 
      
      
        | 644 | 
        
         | 
        
         | 
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_form_settings` SET `success_email_to` = '$success_email_to' WHERE `section_id` = $section_id")) {
 | 
      
      
        | 645 | 
        
         | 
        
         | 
        		echo 'Database data success_email_to added successfully<br>';
  | 
      
      
        | 646 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 647 | 
        
         | 
        
         | 
        	echo mysql_error().'<br />';
  | 
      
      
        | 648 | 
        
         | 
        
         | 
        
  | 
      
      
        | 649 | 
        
         | 
        
         | 
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_form_settings` SET `success_email_text` = '$success_email_text' WHERE `section_id` = $section_id")) {
 | 
      
      
        | 650 | 
        
         | 
        
         | 
        		echo 'Database data success_email_text added successfully<br>';
  | 
      
      
        | 651 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 652 | 
        
         | 
        
         | 
        	echo mysql_error().'<br />';
  | 
      
      
        | 653 | 
        
         | 
        
         | 
        
  | 
      
      
        | 654 | 
        
         | 
        
         | 
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_form_settings` SET `success_email_subject` = '$success_email_subject' WHERE `section_id` = $section_id")) {
 | 
      
      
        | 655 | 
        
         | 
        
         | 
        		echo 'Database data success_email_subject added successfully<br>';
  | 
      
      
        | 656 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 657 | 
        
         | 
        
         | 
        	echo mysql_error().'<br />';
  | 
      
      
        | 658 | 
        
         | 
        
         | 
        
  | 
      
      
        | 659 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 660 | 
        
         | 
        
         | 
        
  | 
      
      
        | 661 | 
        
         | 
        
         | 
        // copy field email_to to success_email_from
  | 
      
      
        | 662 | 
        
         | 
        
         | 
        $query_dates = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_settings where section_id != 0 and page_id != 0");
 | 
      
      
        | 663 | 
        
         | 
        
         | 
        while($result = $query_dates->fetchRow()) {
 | 
      
      
        | 664 | 
        
         | 
        
         | 
        
  | 
      
      
        | 665 | 
        
         | 
        
         | 
        	echo "<B>Copying field email_to to success_email_from for form section_id= ".$result['section_id']."</B><BR>";
  | 
      
      
        | 666 | 
        
         | 
        
         | 
        	$section_id = $result['section_id'];
  | 
      
      
        | 667 | 
        
         | 
        
         | 
        
  | 
      
      
        | 668 | 
        
         | 
        
         | 
        	$success_email_from = $result['email_to'];
  | 
      
      
        | 669 | 
        
         | 
        
         | 
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_form_settings` SET `success_email_from` = '$success_email_from' WHERE `section_id` = $section_id")) {
 | 
      
      
        | 670 | 
        
         | 
        
         | 
        		echo 'Copyied field email_to to success_email_from successfully<br>';
  | 
      
      
        | 671 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 672 | 
        
         | 
        
         | 
        	echo mysql_error().'<br />';
  | 
      
      
        | 673 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 674 | 
        
         | 
        
         | 
        
  | 
      
      
        | 675 | 
        
         | 
        
         | 
        
  | 
      
      
        | 676 | 
        
            714
         | 
        
            Ruebenwurz
         | 
        /**********************************************************
  | 
      
      
        | 677 | 
        
         | 
        
         | 
         *  - News Modul
  | 
      
      
        | 678 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 679 | 
        
            644
         | 
        
            thorn
         | 
        db_add_field('published_when', 'mod_news_posts', "INT NOT NULL AFTER `commenting`");
 | 
      
      
        | 680 | 
        
         | 
        
         | 
        db_add_field('published_until', 'mod_news_posts', "INT NOT NULL AFTER `published_when`");
 | 
      
      
        | 681 | 
        
            562
         | 
        
            Ruebenwurz
         | 
        
  | 
      
      
        | 682 | 
        
         | 
        
         | 
        // These are the default setting
  | 
      
      
        | 683 | 
        
         | 
        
         | 
        $header = '<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"98%\">';
  | 
      
      
        | 684 | 
        
         | 
        
         | 
        $post_loop = '<tr class=\"post_top\">
  | 
      
      
        | 685 | 
        
         | 
        
         | 
        <td class=\"post_title\"><a href=\"[LINK]\">[TITLE]</a></td>
  | 
      
      
        | 686 | 
        
         | 
        
         | 
        <td class=\"post_date\">[MODI_TIME], [MODI_DATE]</td>
  | 
      
      
        | 687 | 
        
         | 
        
         | 
        </tr>
  | 
      
      
        | 688 | 
        
         | 
        
         | 
        <tr>
  | 
      
      
        | 689 | 
        
         | 
        
         | 
        <td class=\"post_short\" colspan=\"2\">
  | 
      
      
        | 690 | 
        
         | 
        
         | 
        [SHORT]
  | 
      
      
        | 691 | 
        
         | 
        
         | 
        <a href=\"[LINK]\">[TEXT_READ_MORE]</a>
  | 
      
      
        | 692 | 
        
         | 
        
         | 
        </td>
  | 
      
      
        | 693 | 
        
         | 
        
         | 
        </tr>';
  | 
      
      
        | 694 | 
        
         | 
        
         | 
        $post_header = addslashes('<table cellpadding="0" cellspacing="0" border="0" width="100%">
 | 
      
      
        | 695 | 
        
         | 
        
         | 
        <tr>
  | 
      
      
        | 696 | 
        
         | 
        
         | 
        <td height="30"><h1>[TITLE]</h1></td>
  | 
      
      
        | 697 | 
        
         | 
        
         | 
        <td rowspan="3" style="display: [DISPLAY_IMAGE]"><img src="[GROUP_IMAGE]" alt="[GROUP_TITLE]" /></td>
  | 
      
      
        | 698 | 
        
         | 
        
         | 
        </tr>
  | 
      
      
        | 699 | 
        
         | 
        
         | 
        <tr>
  | 
      
      
        | 700 | 
        
         | 
        
         | 
        <td valign="top"><b>Posted by [DISPLAY_NAME] ([USERNAME]) on [PUBL_DATE]</b></td>
  | 
      
      
        | 701 | 
        
         | 
        
         | 
        </tr>
  | 
      
      
        | 702 | 
        
         | 
        
         | 
        <tr style="display: [DISPLAY_GROUP]">
  | 
      
      
        | 703 | 
        
         | 
        
         | 
        <td valign="top"><a href="[BACK]">[PAGE_TITLE]</a> >> <a href="[BACK]?g=[GROUP_ID]">[GROUP_TITLE]</a></td>
  | 
      
      
        | 704 | 
        
         | 
        
         | 
        </tr>
  | 
      
      
        | 705 | 
        
         | 
        
         | 
        </table>
  | 
      
      
        | 706 | 
        
         | 
        
         | 
        <p style="text-align: justify;">');
  | 
      
      
        | 707 | 
        
         | 
        
         | 
        $post_footer = '</p><p>Last changed: [MODI_DATE] at [MODI_TIME]</p>
  | 
      
      
        | 708 | 
        
         | 
        
         | 
        <a href=\"[BACK]\">Back</a>';
  | 
      
      
        | 709 | 
        
         | 
        
         | 
        $comments_header = addslashes('<br /><br />
 | 
      
      
        | 710 | 
        
         | 
        
         | 
        <h2>Comments</h2>
  | 
      
      
        | 711 | 
        
         | 
        
         | 
        <table cellpadding="2" cellspacing="0" border="0" width="98%">');
  | 
      
      
        | 712 | 
        
         | 
        
         | 
        
  | 
      
      
        | 713 | 
        
         | 
        
         | 
        // Insert default settings into database
  | 
      
      
        | 714 | 
        
         | 
        
         | 
        $query_dates = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings where section_id != 0 and page_id != 0");
 | 
      
      
        | 715 | 
        
         | 
        
         | 
        while($result = $query_dates->fetchRow()) {
 | 
      
      
        | 716 | 
        
         | 
        
         | 
        
  | 
      
      
        | 717 | 
        
         | 
        
         | 
        	echo "<B>Add default settings data to database for news section_id= ".$result['section_id']."</b><BR>";
  | 
      
      
        | 718 | 
        
         | 
        
         | 
        	$section_id = $result['section_id'];
  | 
      
      
        | 719 | 
        
         | 
        
         | 
        
  | 
      
      
        | 720 | 
        
         | 
        
         | 
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `header` = '$header' WHERE `section_id` = $section_id")) {
 | 
      
      
        | 721 | 
        
         | 
        
         | 
        		echo 'Database data header added successfully<br>';
  | 
      
      
        | 722 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 723 | 
        
         | 
        
         | 
        	echo mysql_error().'<br />';
  | 
      
      
        | 724 | 
        
         | 
        
         | 
        
  | 
      
      
        | 725 | 
        
         | 
        
         | 
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_loop` = '$post_loop' WHERE `section_id` = $section_id")) {
 | 
      
      
        | 726 | 
        
         | 
        
         | 
        		echo 'Database data post_loop added successfully<br>';
  | 
      
      
        | 727 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 728 | 
        
         | 
        
         | 
        	echo mysql_error().'<br />';
  | 
      
      
        | 729 | 
        
         | 
        
         | 
        
  | 
      
      
        | 730 | 
        
         | 
        
         | 
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_header` = '$post_header' WHERE `section_id` = $section_id")) {
 | 
      
      
        | 731 | 
        
         | 
        
         | 
        		echo 'Database data post_header added successfully<br>';
  | 
      
      
        | 732 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 733 | 
        
         | 
        
         | 
        	echo mysql_error().'<br />';
  | 
      
      
        | 734 | 
        
         | 
        
         | 
        
  | 
      
      
        | 735 | 
        
         | 
        
         | 
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_footer` = '$post_footer' WHERE `section_id` = $section_id")) {
 | 
      
      
        | 736 | 
        
         | 
        
         | 
        		echo 'Database data post_footer added successfully<br>';
  | 
      
      
        | 737 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 738 | 
        
         | 
        
         | 
        	echo mysql_error().'<br />';
  | 
      
      
        | 739 | 
        
         | 
        
         | 
        
  | 
      
      
        | 740 | 
        
         | 
        
         | 
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_header` = '$comments_header' WHERE `section_id` = $section_id")) {
 | 
      
      
        | 741 | 
        
         | 
        
         | 
        		echo 'Database data comments_header added successfully<br>';
  | 
      
      
        | 742 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 743 | 
        
         | 
        
         | 
        	echo mysql_error().'<br />';
  | 
      
      
        | 744 | 
        
         | 
        
         | 
        
  | 
      
      
        | 745 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 746 | 
        
         | 
        
         | 
        
  | 
      
      
        | 747 | 
        
         | 
        
         | 
        // MIGRATING FIELD DATES to POSTED_WHEN
  | 
      
      
        | 748 | 
        
         | 
        
         | 
        $query_dates = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts where section_id != 0 and page_id != 0");
 | 
      
      
        | 749 | 
        
            648
         | 
        
            thorn
         | 
        if($query_dates->numRows() > 0) {
 | 
      
      
        | 750 | 
        
         | 
        
         | 
        	echo "<B>Copying field posted_when value to published_when</B><BR>";
  | 
      
      
        | 751 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 752 | 
        
            562
         | 
        
            Ruebenwurz
         | 
        while($result = $query_dates->fetchRow()) {
 | 
      
      
        | 753 | 
        
         | 
        
         | 
        	$pid = $result['post_id'];
  | 
      
      
        | 754 | 
        
         | 
        
         | 
        	$NEW_DATE = $result['posted_when'];
  | 
      
      
        | 755 | 
        
         | 
        
         | 
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_posts` SET `published_when` = '$NEW_DATE' WHERE `post_id` = $pid")) {
 | 
      
      
        | 756 | 
        
         | 
        
         | 
        		echo 'Copying posted_when value to published_when successfully<br>';
  | 
      
      
        | 757 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 758 | 
        
         | 
        
         | 
        	echo mysql_error().'<br />';
  | 
      
      
        | 759 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 760 | 
        
         | 
        
         | 
        
  | 
      
      
        | 761 | 
        
         | 
        
         | 
        
  | 
      
      
        | 762 | 
        
            714
         | 
        
            Ruebenwurz
         | 
        /**********************************************************
  | 
      
      
        | 763 | 
        
         | 
        
         | 
         *  - Add Admintools to Administrator group
  | 
      
      
        | 764 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 765 | 
        
         | 
        
         | 
        echo "<br /><u>Add Admintools to Adminsitrator group</u><br />";
  | 
      
      
        | 766 | 
        
         | 
        
         | 
        $full_system_permissions = 'pages,pages_view,pages_add,pages_add_l0,pages_settings,pages_modify,pages_intro,pages_delete,media,media_view,media_upload,media_rename,media_delete,media_create,addons,modules,modules_view,modules_install,modules_uninstall,templates,templates_view,templates_install,templates_uninstall,languages,languages_view,languages_install,languages_uninstall,settings,settings_basic,settings_advanced,access,users,users_view,users_add,users_modify,users_delete,groups,groups_view,groups_add,groups_modify,groups_delete,admintools';
  | 
      
      
        | 767 | 
        
         | 
        
         | 
        $database->query("UPDATE `".TABLE_PREFIX."groups` SET `system_permissions` = '$full_system_permissions' WHERE `name` = 'Administrators'");
 | 
      
      
        | 768 | 
        
            644
         | 
        
            thorn
         | 
        
  | 
      
      
        | 769 | 
        
         | 
        
         | 
        
  | 
      
      
        | 770 | 
        
            714
         | 
        
            Ruebenwurz
         | 
        /**********************************************************
  | 
      
      
        | 771 | 
        
         | 
        
         | 
         *  - Add Mailer Settings to settings table
  | 
      
      
        | 772 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 773 | 
        
         | 
        
         | 
        echo "<br /><u>Add Mailer Settings to settings table</u><br />";
  | 
      
      
        | 774 | 
        
         | 
        
         | 
        //delete rows to prevent double entries
  | 
      
      
        | 775 | 
        
         | 
        
         | 
        $database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_routine'");
 | 
      
      
        | 776 | 
        
         | 
        
         | 
        $database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'server_email'");
 | 
      
      
        | 777 | 
        
         | 
        
         | 
        $database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_default_sendername'");
 | 
      
      
        | 778 | 
        
         | 
        
         | 
        $database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_smtp_host'");
 | 
      
      
        | 779 | 
        
         | 
        
         | 
        $database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_smtp_auth'");
 | 
      
      
        | 780 | 
        
         | 
        
         | 
        $database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_smtp_username'");
 | 
      
      
        | 781 | 
        
         | 
        
         | 
        $database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_smtp_password'");
 | 
      
      
        | 782 | 
        
         | 
        
         | 
        //add new rows with default values
  | 
      
      
        | 783 | 
        
         | 
        
         | 
        $settings_rows=	"INSERT INTO `".TABLE_PREFIX."settings` "
  | 
      
      
        | 784 | 
        
         | 
        
         | 
        ." (name, value) VALUES "
  | 
      
      
        | 785 | 
        
         | 
        
         | 
        ." ('wbmailer_routine', 'phpmail'),"
 | 
      
      
        | 786 | 
        
         | 
        
         | 
        ." ('server_email', 'admin@yourdomain.com'),"		// avoid that mail provider (e.g. mail.com) reject mails like yourname@mail.com
 | 
      
      
        | 787 | 
        
         | 
        
         | 
        ." ('wbmailer_default_sendername', 'WB Mailer'),"
 | 
      
      
        | 788 | 
        
         | 
        
         | 
        ." ('wbmailer_smtp_host', ''),"
 | 
      
      
        | 789 | 
        
         | 
        
         | 
        ." ('wbmailer_smtp_auth', ''),"
 | 
      
      
        | 790 | 
        
         | 
        
         | 
        ." ('wbmailer_smtp_username', ''),"
 | 
      
      
        | 791 | 
        
         | 
        
         | 
        ." ('wbmailer_smtp_password', '')";
 | 
      
      
        | 792 | 
        
         | 
        
         | 
        $database->query($settings_rows);
  | 
      
      
        | 793 | 
        
            644
         | 
        
            thorn
         | 
        
  | 
      
      
        | 794 | 
        
            714
         | 
        
            Ruebenwurz
         | 
        
  | 
      
      
        | 795 | 
        
         | 
        
         | 
        /**********************************************************
  | 
      
      
        | 796 | 
        
         | 
        
         | 
         *  - Reload all addons
  | 
      
      
        | 797 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 798 | 
        
         | 
        
         | 
        
  | 
      
      
        | 799 | 
        
         | 
        
         | 
        //delete modules
  | 
      
      
        | 800 | 
        
         | 
        
         | 
        $database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'");
 | 
      
      
        | 801 | 
        
         | 
        
         | 
        // Load all modules
  | 
      
      
        | 802 | 
        
         | 
        
         | 
        if($handle = opendir(WB_PATH.'/modules/')) {
 | 
      
      
        | 803 | 
        
         | 
        
         | 
        	while(false !== ($file = readdir($handle))) {
 | 
      
      
        | 804 | 
        
         | 
        
         | 
        		if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') {
 | 
      
      
        | 805 | 
        
         | 
        
         | 
        			load_module(WB_PATH.'/modules/'.$file);
  | 
      
      
        | 806 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 807 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 808 | 
        
         | 
        
         | 
        	closedir($handle);
  | 
      
      
        | 809 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 810 | 
        
         | 
        
         | 
        echo '<br />Modules reloaded<br />';
  | 
      
      
        | 811 | 
        
         | 
        
         | 
        
  | 
      
      
        | 812 | 
        
         | 
        
         | 
        //delete templates
  | 
      
      
        | 813 | 
        
         | 
        
         | 
        $database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
 | 
      
      
        | 814 | 
        
         | 
        
         | 
        // Load all templates
  | 
      
      
        | 815 | 
        
         | 
        
         | 
        if($handle = opendir(WB_PATH.'/templates/')) {
 | 
      
      
        | 816 | 
        
         | 
        
         | 
        	while(false !== ($file = readdir($handle))) {
 | 
      
      
        | 817 | 
        
         | 
        
         | 
        		if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
 | 
      
      
        | 818 | 
        
         | 
        
         | 
        			load_template(WB_PATH.'/templates/'.$file);
  | 
      
      
        | 819 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 820 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 821 | 
        
         | 
        
         | 
        	closedir($handle);
  | 
      
      
        | 822 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 823 | 
        
         | 
        
         | 
        echo '<br />Templates reloaded<br />';
  | 
      
      
        | 824 | 
        
         | 
        
         | 
        
  | 
      
      
        | 825 | 
        
         | 
        
         | 
        //delete languages
  | 
      
      
        | 826 | 
        
         | 
        
         | 
        $database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
 | 
      
      
        | 827 | 
        
         | 
        
         | 
        // Load all languages
  | 
      
      
        | 828 | 
        
         | 
        
         | 
        if($handle = opendir(WB_PATH.'/languages/')) {
 | 
      
      
        | 829 | 
        
         | 
        
         | 
        	while(false !== ($file = readdir($handle))) {
 | 
      
      
        | 830 | 
        
         | 
        
         | 
        		if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
 | 
      
      
        | 831 | 
        
         | 
        
         | 
        			load_language(WB_PATH.'/languages/'.$file);
  | 
      
      
        | 832 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 833 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 834 | 
        
         | 
        
         | 
        	closedir($handle);
  | 
      
      
        | 835 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 836 | 
        
         | 
        
         | 
        echo '<br />Languages reloaded<br />';
  | 
      
      
        | 837 | 
        
         | 
        
         | 
        
  | 
      
      
        | 838 | 
        
         | 
        
         | 
        /**********************************************************
  | 
      
      
        | 839 | 
        
         | 
        
         | 
         *  - Set Version to WB 2.7
  | 
      
      
        | 840 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 841 | 
        
         | 
        
         | 
        echo "<br /><u>Set Version number to 2.7</u><br />";
  | 
      
      
        | 842 | 
        
         | 
        
         | 
        $version = '2.7';
  | 
      
      
        | 843 | 
        
         | 
        
         | 
        $database->query("UPDATE `".TABLE_PREFIX."settings` SET `value` = '$version' WHERE `name` = 'wb_version'");
 | 
      
      
        | 844 | 
        
         | 
        
         | 
        
  | 
      
      
        | 845 | 
        
         | 
        
         | 
        
  | 
      
      
        | 846 | 
        
         | 
        
         | 
        /**********************************************************
  | 
      
      
        | 847 | 
        
         | 
        
         | 
         *  - End of upgrade script
  | 
      
      
        | 848 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 849 | 
        
            552
         | 
        
            thorn
         | 
        echo "<br /><br />Done<br />";
  | 
      
      
        | 850 | 
        
         | 
        
         | 
        
  | 
      
      
        | 851 | 
        
            715
         | 
        
            doc
         | 
        }
  | 
      
      
        | 852 | 
        
            552
         | 
        
            thorn
         | 
        ?>
  | 
      
      
        | 853 | 
        
            715
         | 
        
            doc
         | 
        </div>
  | 
      
      
        | 854 | 
        
            552
         | 
        
            thorn
         | 
        </body>
  | 
      
      
        | 855 | 
        
            714
         | 
        
            Ruebenwurz
         | 
        </html>
  |