Revision 2104
Added by darkviper about 10 years ago
branches/2.8.x/CHANGELOG | ||
---|---|---|
11 | 11 |
! = Update/Change |
12 | 12 |
=============================================================================== |
13 | 13 |
|
14 |
20 Nov-2014 Build 2104 Manuela v.d.Decken(DarkViper) |
|
15 |
! complete rebuild of wb/install/ - changed to use import-struct.sql |
|
16 |
! change class WbDatabase from mysql to msqli |
|
17 |
! rework of WbDatabase::importSql() |
|
18 |
! function db_update_key_value() optimized for speed |
|
19 |
! field `settings_id`removed from table `settings` and new primary key set to `name` |
|
20 |
! update-script extended to modify table `settings` |
|
21 |
23 Sep-2014 Build 2103 Dietmar Woellbrink (Luisehahne) |
|
22 |
! undo invalid commit |
|
23 |
22 Sep-2014 Build 2102 Dietmar Woellbrink (Luisehahne) |
|
24 |
! invalid commit |
|
14 | 25 |
14 Feb-2014 Build 2101 Manuela v.d.Decken(DarkViper) |
15 | 26 |
# typofix of class name in class.login and depending files |
16 | 27 |
11 Feb-2014 Build 2100 Manuela v.d.Decken(DarkViper) |
branches/2.8.x/wb/upgrade-script.php | ||
---|---|---|
86 | 86 |
$oDb = WbDatabase::getInstance(); |
87 | 87 |
$oReg = WbAdaptor::getInstance(); |
88 | 88 |
UpgradeHelper::checkSetupFiles(str_replace('\\', '/', __DIR__).'/'); |
89 |
// --- modify table `settings` ----------------------------------------------------------- |
|
90 |
$oDb->removeField($oDb->TablePrefix.'settings', 'setting_id'); |
|
91 |
$oDb->addIndex($oDb->TablePrefix.'settings', 'PRIMARY', 'name', 'PRIMARY'); |
|
89 | 92 |
// --- set DEFAULT_THEME and restart if needed ------------------------------------------- |
90 | 93 |
if (isset($oReg->DefaultTheme) && trim($oReg->DefaultTheme, '/') != 'WbTheme') { |
91 | 94 |
db_update_key_value('settings', 'default_theme', 'WbTheme'); |
... | ... | |
128 | 131 |
if(!defined('WB_REVISION')) { define('WB_REVISION',''); } |
129 | 132 |
// database tables including in WB package |
130 | 133 |
$aPackage = array ( |
131 |
'settings','groups','addons','pages','sections','search','users', |
|
132 |
'mod_captcha_control','mod_jsadmin','mod_menu_link','mod_output_filter','mod_wrapper','mod_wysiwyg' |
|
134 |
'settings','groups','addons','pages','sections','search','users' |
|
133 | 135 |
); |
134 | 136 |
|
135 | 137 |
$OK = ' <span class="ok">OK</span> '; |
... | ... | |
768 | 770 |
$aDebugMessage[] = "<span>Modify field publ_end on sections table</span>"; |
769 | 771 |
$aDebugMessage[] = ($database->field_modify($table_name, 'publ_end', $description) ? " $OK<br />" : " $FAIL!<br />"); |
770 | 772 |
|
773 |
/********************************************************** |
|
774 |
* - Add field "title" to table sections |
|
775 |
*/ |
|
776 |
$table_name = TABLE_PREFIX.'sections'; |
|
777 |
$field_name = 'title'; |
|
778 |
$description = "VARCHAR( 255 ) NOT NULL DEFAULT 'Section-ID 0' "; |
|
779 |
add_modify_field_in_database($table_name,$field_name,$description); |
|
780 |
|
|
771 | 781 |
if($bDebugModus) { |
772 | 782 |
echo implode(PHP_EOL,$aDebugMessage); |
773 | 783 |
} else { |
... | ... | |
792 | 802 |
$sSystemPermissions .= 'modules,modules_advanced,modules_install,modules_uninstall,modules_view,pages,pages_add,pages_add_l0,pages_delete,pages_intro,pages_modify,pages_settings,pages_view,'; |
793 | 803 |
$sSystemPermissions .= 'preferences,preferences_view,settings,settings_advanced,settings_basic,settings_view,templates,templates_install,templates_uninstall,templates_view,users,users_add,users_delete,users_modify,users_view'; |
794 | 804 |
|
795 |
$sql = 'UPDATE `'.TABLE_PREFIX.'groups` ';
|
|
796 |
$sql .= 'SET `name` = \'Administrators\', ';
|
|
797 |
$sql .= '`system_permissions` = \''.$sSystemPermissions.'\', ';
|
|
798 |
$sql .= '`module_permissions` = \''.$sModulePermissions.'\', ';
|
|
799 |
$sql .= '`template_permissions` = \''.$sTemplatePermissions.'\' ';
|
|
800 |
$sql .= 'WHERE `group_id` = \'1\' ';
|
|
805 |
$sql = 'UPDATE `'.TABLE_PREFIX.'groups` '
|
|
806 |
. 'SET `name` = \'Administrators\', '
|
|
807 |
. '`system_permissions` = \''.$sSystemPermissions.'\', '
|
|
808 |
. '`module_permissions` = \''.$sModulePermissions.'\', '
|
|
809 |
. '`template_permissions` = \''.$sTemplatePermissions.'\' '
|
|
810 |
. 'WHERE `group_id` = \'1\' ';
|
|
801 | 811 |
$aDebugMessage[] = ($database->query($sql)) ? " $OK<br />" : " $FAIL!<br />"; |
802 | 812 |
if( ($admin->is_authenticated() == true) && ($admin->ami_group_member('1') ) ) { |
803 | 813 |
$_SESSION['SYSTEM_PERMISSIONS'] = array_merge($_SESSION['SYSTEM_PERMISSIONS'], explode(',', $sSystemPermissions)); |
branches/2.8.x/wb/admin/interface/version.php | ||
---|---|---|
51 | 51 |
|
52 | 52 |
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled) |
53 | 53 |
if(!defined('VERSION')) define('VERSION', '2.8.4'); |
54 |
if(!defined('REVISION')) define('REVISION', '2101');
|
|
54 |
if(!defined('REVISION')) define('REVISION', '2104');
|
|
55 | 55 |
if(!defined('SP')) define('SP', ''); |
branches/2.8.x/wb/framework/WbDatabase.php | ||
---|---|---|
33 | 33 |
|
34 | 34 |
/* -------------------------------------------------------- */ |
35 | 35 |
@define('DATABASE_CLASS_LOADED', true); |
36 |
/* define the old mysql consts for Backward compatibility */ |
|
37 |
if (!defined('MYSQL_ASSOC')) |
|
38 |
{ |
|
39 |
define('MYSQL_SEEK_LAST', -1); |
|
40 |
define('MYSQL_SEEK_FIRST', 0); |
|
41 |
define('MYSQL_ASSOC', 1); |
|
42 |
define('MYSQL_NUM', 2); |
|
43 |
define('MYSQL_BOTH', 3); |
|
44 |
define('MYSQL_CLIENT_COMPRESS', 32); |
|
45 |
define('MYSQL_CLIENT_IGNORE_SPACE', 256); |
|
46 |
define('MYSQL_CLIENT_INTERACTIVE', 1024); |
|
47 |
define('MYSQL_CLIENT_SSL', 2048); |
|
48 |
} |
|
36 | 49 |
|
37 | 50 |
class WbDatabase { |
38 | 51 |
|
... | ... | |
52 | 65 |
* __constructor |
53 | 66 |
* prevent from public instancing |
54 | 67 |
*/ |
55 |
private function __construct() {} |
|
68 |
final private function __construct() {}
|
|
56 | 69 |
/** |
57 | 70 |
* prevent from cloning |
58 | 71 |
*/ |
59 |
private function __clone() {} |
|
72 |
final private function __clone() {}
|
|
60 | 73 |
/** |
61 | 74 |
* get a valid instance of this class |
62 | 75 |
* @param string $sIdentifier selector for several different instances |
63 | 76 |
* @return WbDatabase object |
64 | 77 |
*/ |
65 |
public static function getInstance($sIdentifier = 'core') |
|
78 |
final public static function getInstance($sIdentifier = 'core')
|
|
66 | 79 |
{ |
67 | 80 |
if( !isset(self::$_oInstances[$sIdentifier])) { |
68 | 81 |
$c = __CLASS__; |
... | ... | |
76 | 89 |
* disconnect and kills an existing instance |
77 | 90 |
* @param string $sIdentifier selector for instance to kill |
78 | 91 |
*/ |
79 |
public static function killInstance($sIdentifier) |
|
92 |
final public static function killInstance($sIdentifier)
|
|
80 | 93 |
{ |
81 | 94 |
if($sIdentifier != 'core') { |
82 | 95 |
if( isset(self::$_oInstances[$sIdentifier])) { |
... | ... | |
105 | 118 |
$username = isset($aIni['user']) ? $aIni['user'] : ''; |
106 | 119 |
$password = isset($aIni['pass']) ? $aIni['pass'] : ''; |
107 | 120 |
$hostport = isset($aIni['port']) ? $aIni['port'] : '3306'; |
108 |
$hostport = $hostport == '3306' ? '' : ':'.$hostport;
|
|
121 |
$hostport = $hostport == '3306' ? null : $hostport;
|
|
109 | 122 |
$db_name = ltrim(isset($aIni['path']) ? $aIni['path'] : '', '/\\'); |
110 | 123 |
$sTmp = isset($aIni['query']) ? $aIni['query'] : ''; |
111 | 124 |
$aQuery = explode('&', $sTmp); |
... | ... | |
126 | 139 |
} else { |
127 | 140 |
throw new WbDatabaseException('Missing parameter: unable to connect database'); |
128 | 141 |
} |
129 |
$this->oDbHandle = @mysql_connect($hostname.$hostport, $username, $password, true);
|
|
142 |
$this->oDbHandle = @mysqli_connect($hostname, $username, $password, $db_name, $hostport);
|
|
130 | 143 |
if (!$this->oDbHandle) { |
131 |
throw new WbDatabaseException('unable to connect \''.$scheme.'://'.$hostname.$hostport.'\''); |
|
144 |
throw new WbDatabaseException('unable to connect \''.$scheme.'://'.$hostname.':'.$hostport.'\'');
|
|
132 | 145 |
} else { |
133 |
if (!@mysql_select_db($db_name, $this->oDbHandle)) { |
|
134 |
throw new WbDatabaseException('unable to select database \''.$db_name. |
|
135 |
'\' on \''.$scheme.'://'. |
|
136 |
$hostname.$hostport.'\'' |
|
137 |
); |
|
138 |
} else { |
|
139 |
if ($this->sCharset) { |
|
140 |
@mysql_query('SET NAMES \''.$this->sCharset.'\'', $this->oDbHandle); |
|
141 |
} |
|
142 |
$this->connected = true; |
|
143 |
} |
|
146 |
if ($this->sCharset) { |
|
147 |
@mysqli_query($this->oDbHandle, 'SET NAMES \''.$this->sCharset.'\''); |
|
148 |
} |
|
149 |
$this->connected = true; |
|
144 | 150 |
} |
145 | 151 |
return $this->connected; |
146 | 152 |
} |
... | ... | |
153 | 159 |
public function disconnect() |
154 | 160 |
{ |
155 | 161 |
if ($this->connected == true && $oInstance->sInstanceIdentifier != 'core') { |
156 |
mysql_close($this->oDbHandle); |
|
162 |
mysqli_close($this->oDbHandle);
|
|
157 | 163 |
$this->connected = false; |
158 | 164 |
return true; |
159 | 165 |
} |
... | ... | |
161 | 167 |
} |
162 | 168 |
/** |
163 | 169 |
* Alias for doQuery() |
170 |
* @deprecated from WB-2.8.5 and higher |
|
164 | 171 |
*/ |
165 | 172 |
public function query($statement) |
166 | 173 |
{ |
... | ... | |
173 | 180 |
*/ |
174 | 181 |
public function doQuery($statement) { |
175 | 182 |
$this->iQueryCount++; |
176 |
$mysql = new mysql(); |
|
177 |
$mysql->query($statement, $this->oDbHandle);
|
|
183 |
$mysql = new mysql($this->oDbHandle);
|
|
184 |
$mysql->query($statement); |
|
178 | 185 |
$this->set_error($mysql->error($this->oDbHandle)); |
179 |
if ($mysql->error($this->oDbHandle)) {
|
|
186 |
if ($mysql->error()) { |
|
180 | 187 |
return null; |
181 | 188 |
} else { |
182 | 189 |
return $mysql; |
... | ... | |
184 | 191 |
} |
185 | 192 |
/** |
186 | 193 |
* Alias for getOne() |
194 |
* @deprecated from WB-2.8.5 and higher |
|
187 | 195 |
*/ |
188 | 196 |
public function get_one( $statement ) |
189 | 197 |
{ |
... | ... | |
198 | 206 |
public function getOne( $statement ) |
199 | 207 |
{ |
200 | 208 |
$this->iQueryCount++; |
201 |
$fetch_row = mysql_fetch_array(mysql_query($statement, $this->oDbHandle));
|
|
209 |
$fetch_row = mysqli_fetch_array(mysqli_query($this->oDbHandle, $statement));
|
|
202 | 210 |
$result = $fetch_row[0]; |
203 |
$this->set_error(mysql_error($this->oDbHandle)); |
|
204 |
if (mysql_error($this->oDbHandle)) { |
|
211 |
$this->set_error(null); |
|
212 |
if (mysqli_error($this->oDbHandle)) { |
|
213 |
$this->set_error(mysqli_error($this->oDbHandle)); |
|
205 | 214 |
return null; |
206 | 215 |
} else { |
207 | 216 |
return $result; |
... | ... | |
209 | 218 |
} |
210 | 219 |
/** |
211 | 220 |
* Alias for setError() |
221 |
* @deprecated from WB-2.8.5 and higher |
|
212 | 222 |
*/ |
213 | 223 |
public function set_error($message = null) |
214 | 224 |
{ |
... | ... | |
225 | 235 |
} |
226 | 236 |
/** |
227 | 237 |
* Alias for isError |
238 |
* @deprecated from WB-2.8.5 and higher |
|
228 | 239 |
*/ |
229 | 240 |
public function is_error() |
230 | 241 |
{ |
... | ... | |
240 | 251 |
} |
241 | 252 |
/** |
242 | 253 |
* Alias for getError |
254 |
* @deprecated from WB-2.8.5 and higher |
|
243 | 255 |
*/ |
244 | 256 |
public function get_error() |
245 | 257 |
{ |
... | ... | |
278 | 290 |
break; |
279 | 291 |
case 'LastInsertId': |
280 | 292 |
case 'getLastInsertId': // << set deprecated |
281 |
$retval = mysql_insert_id($this->oDbHandle);
|
|
293 |
$retval = $this->getLastInsertId();
|
|
282 | 294 |
break; |
283 | 295 |
case 'DbName': |
284 | 296 |
case 'getDbName': // << set deprecated |
... | ... | |
306 | 318 |
*/ |
307 | 319 |
public function escapeString($unescaped_string) |
308 | 320 |
{ |
309 |
return mysql_real_escape_string($unescaped_string, $this->oDbHandle);
|
|
321 |
return mysqli_real_escape_string($this->oDbHandle, $unescaped_string);
|
|
310 | 322 |
} |
311 | 323 |
/** |
312 | 324 |
* Last inserted Id |
... | ... | |
314 | 326 |
*/ |
315 | 327 |
public function getLastInsertId() |
316 | 328 |
{ |
317 |
return mysql_insert_id($this->oDbHandle); |
|
329 |
return mysqli_insert_id($this->oDbHandle);
|
|
318 | 330 |
} |
319 | 331 |
/** |
320 | 332 |
* Alias for isField() |
333 |
* @deprecated from WB-2.8.5 and higher |
|
321 | 334 |
*/ |
322 | 335 |
public function field_exists($table_name, $field_name) |
323 | 336 |
{ |
... | ... | |
331 | 344 |
public function isField($table_name, $field_name) |
332 | 345 |
{ |
333 | 346 |
$sql = 'DESCRIBE `'.$table_name.'` `'.$field_name.'` '; |
334 |
$query = $this->query($sql, $this->oDbHandle);
|
|
347 |
$query = $this->doQuery($sql);
|
|
335 | 348 |
return ($query->numRows() != 0); |
336 | 349 |
} |
337 | 350 |
/** |
338 | 351 |
* Alias for isIndex() |
352 |
* @deprecated from WB-2.8.5 and higher |
|
339 | 353 |
*/ |
340 | 354 |
public function index_exists($table_name, $index_name, $number_fields = 0) |
341 | 355 |
{ |
... | ... | |
352 | 366 |
$number_fields = intval($number_fields); |
353 | 367 |
$keys = 0; |
354 | 368 |
$sql = 'SHOW INDEX FROM `'.$table_name.'`'; |
355 |
if (($res_keys = $this->doQuery($sql, $this->oDbHandle))) {
|
|
369 |
if (($res_keys = $this->doQuery($sql))) { |
|
356 | 370 |
while (($rec_key = $res_keys->fetchRow(MYSQL_ASSOC))) { |
357 | 371 |
if ( $rec_key['Key_name'] == $index_name ) { |
358 | 372 |
$keys++; |
... | ... | |
368 | 382 |
} |
369 | 383 |
/** |
370 | 384 |
* Alias for addField() |
385 |
* @deprecated from WB-2.8.5 and higher |
|
371 | 386 |
*/ |
372 | 387 |
public function field_add($table_name, $field_name, $description) |
373 | 388 |
{ |
... | ... | |
384 | 399 |
if (!$this->isField($table_name, $field_name)) { |
385 | 400 |
// add new field into a table |
386 | 401 |
$sql = 'ALTER TABLE `'.$table_name.'` ADD '.$field_name.' '.$description.' '; |
387 |
$query = $this->doQuery($sql, $this->oDbHandle);
|
|
388 |
$this->set_error(mysql_error($this->oDbHandle)); |
|
402 |
$query = $this->doQuery($sql); |
|
403 |
$this->set_error(mysqli_error($this->oDbHandle));
|
|
389 | 404 |
if (!$this->isError()) { |
390 | 405 |
return ( $this->isField($table_name, $field_name) ) ? true : false; |
391 | 406 |
} |
... | ... | |
396 | 411 |
} |
397 | 412 |
/** |
398 | 413 |
* Alias for modifyField() |
414 |
* @deprecated from WB-2.8.5 and higher |
|
399 | 415 |
*/ |
400 | 416 |
public function field_modify($table_name, $field_name, $description) |
401 | 417 |
{ |
... | ... | |
413 | 429 |
if ($this->isField($table_name, $field_name)) { |
414 | 430 |
// modify a existing field in a table |
415 | 431 |
$sql = 'ALTER TABLE `'.$table_name.'` MODIFY `'.$field_name.'` '.$description; |
416 |
$retval = ( $this->doQuery($sql, $this->oDbHandle) ? true : false);
|
|
417 |
$this->setError(mysql_error());
|
|
432 |
$retval = ( $this->doQuery($sql) ? true : false); |
|
433 |
$this->setError(mysqli_error($this->oDbHandle));
|
|
418 | 434 |
} |
419 | 435 |
return $retval; |
420 | 436 |
} |
421 | 437 |
/** |
422 | 438 |
* Alias for removeField() |
439 |
* @deprecated from WB-2.8.5 and higher |
|
423 | 440 |
*/ |
424 | 441 |
public function field_remove($table_name, $field_name) |
425 | 442 |
{ |
... | ... | |
442 | 459 |
} |
443 | 460 |
/** |
444 | 461 |
* Alias for addIndex() |
462 |
* @deprecated from WB-2.8.5 and higher |
|
445 | 463 |
*/ |
446 | 464 |
public function index_add($table_name, $index_name, $field_list, $index_type = 'KEY') |
447 | 465 |
{ |
... | ... | |
466 | 484 |
{ |
467 | 485 |
$sql = 'ALTER TABLE `'.$table_name.'` '; |
468 | 486 |
$sql .= 'DROP INDEX `'.$index_name.'`'; |
469 |
if (!$this->doQuery($sql, $this->oDbHandle)) { return false; }
|
|
487 |
if (!$this->doQuery($sql)) { return false; } |
|
470 | 488 |
} |
471 | 489 |
$sql = 'ALTER TABLE `'.$table_name.'` '; |
472 | 490 |
$sql .= 'ADD '.$index_type.' '; |
473 | 491 |
$sql .= $index_type == 'PRIMARY' ? 'KEY ' : '`'.$index_name.'` '; |
474 | 492 |
$sql .= '( '.$field_list.' ); '; |
475 |
if ($this->doQuery($sql, $this->oDbHandle)) { $retval = true; }
|
|
493 |
if ($this->doQuery($sql)) { $retval = true; } |
|
476 | 494 |
return $retval; |
477 | 495 |
} |
478 | 496 |
/** |
479 | 497 |
* Alias for removeIndex() |
498 |
* @deprecated from WB-2.8.5 and higher |
|
480 | 499 |
*/ |
481 | 500 |
public function index_remove($table_name, $index_name) |
482 | 501 |
{ |
... | ... | |
493 | 512 |
if ($this->isIndex($table_name, $index_name)) { |
494 | 513 |
// modify a existing field in a table |
495 | 514 |
$sql = 'ALTER TABLE `'.$table_name.'` DROP INDEX `'.$index_name.'`'; |
496 |
$retval = ( $this->doQuery($sql, $this->oDbHandle) ? true : false );
|
|
515 |
$retval = ( $this->doQuery($sql) ? true : false ); |
|
497 | 516 |
} |
498 | 517 |
return $retval; |
499 | 518 |
} |
500 | 519 |
/** |
501 | 520 |
* Alias for importSql() |
521 |
* @deprecated from WB-2.8.5 and higher |
|
502 | 522 |
*/ |
503 | 523 |
public function SqlImport($sSqlDump, |
504 | 524 |
$sTablePrefix = '', |
505 |
$bPreserve = true,
|
|
525 |
$sAction = 'install',
|
|
506 | 526 |
$sEngine = 'MyISAM', |
507 | 527 |
$sCollation = 'utf8_unicode_ci') |
508 | 528 |
{ |
509 | 529 |
return $this->importSql($sSqlDump, $sTablePrefix, $bPreserve, $sEngine, $sCollation); |
510 | 530 |
} |
511 | 531 |
/** |
512 |
* Import a standard *.sql dump file |
|
513 |
* @param string $sSqlDump link to the sql-dumpfile |
|
514 |
* @param string $sTablePrefix |
|
515 |
* @param bool $bPreserve set to true will ignore all DROP TABLE statements |
|
516 |
* @param string $sEngine can be 'MyISAM' or 'InnoDB' |
|
517 |
* @param string $sCollation one of the list of available collations |
|
518 |
* @return boolean true if import successful |
|
519 |
* @description Import a standard *.sql dump file<br /> |
|
520 |
* The file can include placeholders TABLE_PREFIX, TABLE_COLLATION and TABLE_ENGINE |
|
532 |
* Import an SQl-Dumpfile witch can include unlimited placeholders for values |
|
533 |
* @param mixed $mSqlDump can be string with filename or array with additional vars |
|
534 |
* @param string $sTablePrefix can be used to override settings from WbDatabase object |
|
535 |
* @param string $sAction 'install', 'uninstall', 'upgrade', 'repair |
|
536 |
* @param string $sEngine kind of table engine: MyIsam(default) |
|
537 |
* @param string $sCollation utf8_unicode_ci(default) |
|
538 |
* @return bool false on error |
|
521 | 539 |
*/ |
522 |
public function importSql($sSqlDump, |
|
523 |
$sTablePrefix = '', /* unused argument, for backward compatibility only! */ |
|
524 |
$bPreserve = true, |
|
525 |
$sEngine = 'MyISAM', |
|
526 |
$sCollation = 'utf8_unicode_ci') |
|
527 |
{ |
|
528 |
$sCollation = ($sCollation != '' ? $sCollation : 'utf8_unicode_ci'); |
|
529 |
$aCharset = preg_split('/_/', $sCollation, null, PREG_SPLIT_NO_EMPTY); |
|
530 |
$sEngine = 'ENGINE='.$sEngine.' DEFAULT CHARSET='.$aCharset[0].' COLLATE='.$sCollation; |
|
531 |
$sCollation = ' collate '.$sCollation; |
|
540 |
public function importSql( |
|
541 |
$mSqlDump, |
|
542 |
$sTablePrefix = '', // can override settings from WbDatabase object |
|
543 |
$sAction = 'install', // skip 'DROP TABLE' statements |
|
544 |
$sEngine = 'MyISAM', // the default table engine |
|
545 |
$sCollation = 'utf8_unicode_ci' // the default collation to use |
|
546 |
) |
|
547 |
{ |
|
532 | 548 |
$retval = true; |
533 | 549 |
$this->error = ''; |
534 |
$aSearch = array('{TABLE_PREFIX}','{TABLE_ENGINE}', '{TABLE_COLLATION}'); |
|
535 |
$aReplace = array($this->sTablePrefix, $sEngine, $sCollation); |
|
550 |
// sanitize arguments |
|
551 |
if (! is_string($sAction)) { |
|
552 |
$sAction = $sAction ? 'repair' : 'install'; |
|
553 |
} |
|
554 |
$aAllowedActions = array('install', 'uninstall', 'upgrade', 'repair'); |
|
555 |
$sAction = strtolower(preg_replace('/^.*?('.implode('|', $aAllowedActions).')(\.php)?$/iU', '$1', $sAction)); |
|
556 |
$sAction = (in_array($sAction, $aAllowedActions) ? $sAction : 'install'); |
|
557 |
$sTablePrefix = trim($sTablePrefix); |
|
558 |
$aEngineTypes = array( |
|
559 |
'csv' => 'CSV', |
|
560 |
'blackhole' => 'BLACKHOLE', |
|
561 |
'memory' => 'MEMORY', |
|
562 |
'myisam' => 'MyISAM', |
|
563 |
'innodb' => 'InnoDB', |
|
564 |
'archive' => 'ARCHIVE', |
|
565 |
'mrg_myisam' => 'MRG_MYISAM' |
|
566 |
); |
|
567 |
if (isset($aEngineTypes[strtolower($sEngine)])) { |
|
568 |
$sEngine = $aEngineTypes[strtolower($sEngine)]; |
|
569 |
} else { |
|
570 |
$sEngine = 'MyISAM'; |
|
571 |
} |
|
572 |
// test if selected collation is available. Otherwise select 'utf8_unicode_ci' |
|
573 |
$sql = 'SELECT COUNT(*) FROM `COLLATIONS` ' |
|
574 |
. 'WHERE `COLLATION_NAME`=\''.$sCollation.'\''; |
|
575 |
$sCollation = ($this->get_one($sql) ? $sCollation : 'utf8_unicode_ci'); |
|
576 |
$aTmp = preg_split('/_/', $sCollation, null, PREG_SPLIT_NO_EMPTY); |
|
577 |
$sCharset = $aTmp[0]; |
|
578 |
// define array of searches |
|
579 |
$aSearch = array( |
|
580 |
'/\{TABLE_PREFIX\}/', |
|
581 |
'/\{TABLE_COLLATION\}/', // deprecated from 2.8.4 |
|
582 |
'/\{FIELD_COLLATION\}/', // deprecated from 2.8.4 |
|
583 |
'/\{TABLE_ENGINE\}/', |
|
584 |
'/\{TABLE_ENGINE=([a-zA-Z_0-9]*)\}/', |
|
585 |
'/\{CHARSET\}/', |
|
586 |
'/\{COLLATION\}/' |
|
587 |
); |
|
588 |
// define array of replacements |
|
589 |
$aReplace = array( |
|
590 |
$sTablePrefix, |
|
591 |
' COLLATE {COLLATION}', // deprecated from 2.8.4 |
|
592 |
' COLLATE {COLLATION}', // deprecated from 2.8.4 |
|
593 |
' {ENGINE='.$sEngine.'}', |
|
594 |
' ENGINE=$1 DEFAULT CHARSET={CHARSET} COLLATION={COLLATION}', |
|
595 |
$sCharset, |
|
596 |
$sCollation |
|
597 |
); |
|
598 |
|
|
599 |
if (is_array($mSqlDump)) { |
|
600 |
// try to get dumpfile name |
|
601 |
if (!isset($mSqlDump['sSqlDump'])) { |
|
602 |
$this->error = 'missing index \'sSqlDump\' in $mSqlDump'; |
|
603 |
return false; |
|
604 |
} else { |
|
605 |
// get dumpfile name from array and then remove entry |
|
606 |
$sDumpFile = (string)$mSqlDump['sSqlDump']; |
|
607 |
unset($mSqlDump['sSqlDump']); |
|
608 |
// import all vars and it's values from array |
|
609 |
foreach ($mSqlDump as $sIndex => $sValue) { |
|
610 |
// transform varname into placeholder name ('sPageTitle' => 'PAGE_TITLE') |
|
611 |
$sIndex = strtoupper(preg_replace('/([a-z0-9])([A-Z])/', '\1_\2', ltrim($sIndex, 'a..z'))); |
|
612 |
// fill search/replace arrays |
|
613 |
$aSearch[] = '/\{'.$sIndex.'\}/'; |
|
614 |
$aReplace[] = $sValue ; |
|
615 |
} |
|
616 |
} |
|
617 |
} elseif (is_string($mSqlDump)) { |
|
618 |
$sDumpFile = (string)$mSqlDump; |
|
619 |
} else { |
|
620 |
$this->error = 'invalid argument $mSqlDump'; |
|
621 |
return false; |
|
622 |
} |
|
623 |
if (!is_readable($sDumpFile)) { |
|
624 |
$this->Error = 'unable to open \''.$sDumpFile.'\''; |
|
625 |
return false; |
|
626 |
} |
|
536 | 627 |
$sql = ''; |
537 |
$aSql = file($sSqlDump);
|
|
538 |
// $aSql[0] = preg_replace('/^\xEF\xBB\xBF/', '', $aSql[0]);
|
|
628 |
$aSql = file($sDumpFile, FILE_SKIP_EMPTY_LINES);
|
|
629 |
// remove possible ByteOrderMark
|
|
539 | 630 |
$aSql[0] = preg_replace('/^[\xAA-\xFF]{3}/', '', $aSql[0]); |
540 | 631 |
while (sizeof($aSql) > 0) { |
541 | 632 |
$sSqlLine = trim(array_shift($aSql)); |
542 | 633 |
if (!preg_match('/^[-\/]+.*/', $sSqlLine)) { |
543 | 634 |
$sql = $sql.' '.$sSqlLine; |
544 | 635 |
if ((substr($sql,-1,1) == ';')) { |
545 |
$sql = trim(str_replace( $aSearch, $aReplace, $sql)); |
|
546 |
if (!($bPreserve && preg_match('/^\s*DROP TABLE IF EXISTS/siU', $sql))) { |
|
547 |
if (!mysql_query($sql, $this->oDbHandle)) { |
|
548 |
$retval = false; |
|
549 |
$this->error = mysql_error($this->oDbHandle); |
|
550 |
unset($aSql); |
|
551 |
break; |
|
552 |
} |
|
553 |
} |
|
636 |
$sql = trim(preg_replace($aSearch, $aReplace, $sql)); |
|
637 |
$sAvailSqlObjects = 'TABLE|VIEW|INDEX|PROCEDURE|FUNCTION|TRIGGER|EVENT'; |
|
638 |
switch ($sAction) { |
|
639 |
case 'uninstall': // skip CREATE; execute DROP |
|
640 |
if (preg_match('/^\s*CREATE ('.$sAvailSqlObjects.') /siU', $sql)) { |
|
641 |
$sql = ''; |
|
642 |
continue; // read next statement |
|
643 |
} |
|
644 |
break; |
|
645 |
case 'upgrade': // skip DROP; execute CREATE |
|
646 |
case 'repair': // skip DROP; execute CREATE |
|
647 |
if (preg_match('/^\s*DROP ('.$sAvailSqlObjects.') /siU', $sql)) { |
|
648 |
$sql = ''; |
|
649 |
continue; // read next statement |
|
650 |
} |
|
651 |
break; |
|
652 |
default: // install: execute DROP; execute CREATE |
|
653 |
break; |
|
654 |
} |
|
655 |
if (!$this->doQuery($sql)) { |
|
656 |
$retval = false; |
|
657 |
$this->error = $this->getError(); |
|
658 |
unset($aSql); |
|
659 |
break; |
|
660 |
} |
|
554 | 661 |
$sql = ''; |
555 | 662 |
} |
556 | 663 |
} |
557 | 664 |
} |
558 | 665 |
return $retval; |
559 |
}
|
|
666 |
} // end of function importSql()
|
|
560 | 667 |
/** |
561 | 668 |
* retuns the type of the engine used for requested table |
562 | 669 |
* @param string $table name of the table, including prefix |
... | ... | |
565 | 672 |
public function getTableEngine($table) |
566 | 673 |
{ |
567 | 674 |
$retVal = false; |
568 |
$mysqlVersion = mysql_get_server_info($this->oDbHandle); |
|
675 |
$mysqlVersion = mysqli_get_server_info($this->oDbHandle);
|
|
569 | 676 |
$engineValue = (version_compare($mysqlVersion, '5.0') < 0) ? 'Type' : 'Engine'; |
570 | 677 |
$sql = 'SHOW TABLE STATUS FROM `' . $this->sDbName . '` LIKE \'' . $table . '\''; |
571 |
if (($result = $this->doQuery($sql, $this->oDbHandle))) {
|
|
678 |
if (($result = $this->doQuery($sql))) { |
|
572 | 679 |
if (($row = $result->fetchRow(MYSQL_ASSOC))) { |
573 | 680 |
$retVal = $row[$engineValue]; |
574 | 681 |
} |
... | ... | |
614 | 721 |
*/ |
615 | 722 |
class mysql { |
616 | 723 |
|
617 |
private $result = null; |
|
724 |
private $result = null;
|
|
618 | 725 |
private $oDbHandle = null; |
726 |
private $error = ''; |
|
619 | 727 |
|
728 |
public function __construct($oHandle) |
|
729 |
{ |
|
730 |
$this->oDbHandle = $oHandle; |
|
731 |
} |
|
620 | 732 |
/** |
621 | 733 |
* query sql statement |
622 | 734 |
* @param string $statement |
623 |
* @param object $dbHandle |
|
624 | 735 |
* @return object |
625 | 736 |
* @throws WbDatabaseException |
626 | 737 |
*/ |
627 |
function query($statement, $dbHandle)
|
|
738 |
function query($sStatement)
|
|
628 | 739 |
{ |
629 |
$this->oDbHandle = $dbHandle; |
|
630 |
$this->result = @mysql_query($statement, $this->oDbHandle); |
|
740 |
$this->result = @mysqli_query($this->oDbHandle, $sStatement); |
|
631 | 741 |
if ($this->result === false) { |
632 | 742 |
if (DEBUG) { |
633 |
throw new WbDatabaseException(mysql_error($this->oDbHandle)); |
|
743 |
throw new WbDatabaseException(mysqli_error($this->oDbHandle));
|
|
634 | 744 |
} else { |
635 | 745 |
throw new WbDatabaseException('Error in SQL-Statement'); |
636 | 746 |
} |
637 | 747 |
} |
638 |
$this->error = mysql_error($this->oDbHandle); |
|
748 |
$this->error = mysqli_error($this->oDbHandle);
|
|
639 | 749 |
return $this->result; |
640 | 750 |
} |
641 | 751 |
/** |
... | ... | |
645 | 755 |
*/ |
646 | 756 |
function numRows() |
647 | 757 |
{ |
648 |
return mysql_num_rows($this->result); |
|
758 |
return mysqli_num_rows($this->result);
|
|
649 | 759 |
} |
650 | 760 |
/** |
651 | 761 |
* fetchRow |
... | ... | |
655 | 765 |
*/ |
656 | 766 |
function fetchRow($typ = MYSQL_BOTH) |
657 | 767 |
{ |
658 |
return mysql_fetch_array($this->result, $typ); |
|
768 |
return mysqli_fetch_array($this->result, $typ);
|
|
659 | 769 |
} |
660 | 770 |
/** |
661 | 771 |
* fetchObject |
... | ... | |
667 | 777 |
function fetchObject($sClassName = null, array $aParams = null) |
668 | 778 |
{ |
669 | 779 |
if ($sClassName === null || class_exists($sClassName)) { |
670 |
return mysql_fetch_object($this->result, $sClassName, $aParams); |
|
780 |
return mysqli_fetch_object($this->result, $sClassName, $aParams);
|
|
671 | 781 |
} else { |
672 | 782 |
throw new WbDatabaseException('Class <'.$sClassName.'> not available on request of mysql_fetch_object()'); |
673 | 783 |
} |
... | ... | |
691 | 801 |
{ |
692 | 802 |
$pmax = $this->numRows() - 1; |
693 | 803 |
$p = (($position < 0 || $position > $pmax) ? $pmax : $position); |
694 |
return mysql_data_seek($this->result, $p); |
|
804 |
return mysqli_data_seek($this->result, $p);
|
|
695 | 805 |
} |
696 | 806 |
/** |
697 | 807 |
* freeResult |
... | ... | |
700 | 810 |
*/ |
701 | 811 |
function freeResult() |
702 | 812 |
{ |
703 |
return mysql_free_result($this->result); |
|
813 |
return mysqli_free_result($this->result);
|
|
704 | 814 |
} |
705 | 815 |
/** |
706 | 816 |
* Get error |
... | ... | |
737 | 847 |
} |
738 | 848 |
} |
739 | 849 |
$retval = true; |
740 |
foreach( $key as $index=>$val) |
|
741 |
{ |
|
742 |
$index = strtolower($index); |
|
743 |
$sql = 'SELECT COUNT(`setting_id`) ' |
|
744 |
. 'FROM `'.$oDb->TablePrefix.$table.'` ' |
|
745 |
. 'WHERE `name` = \''.$index.'\' '; |
|
746 |
if ($oDb->getOne($sql)) { |
|
747 |
$sql = 'UPDATE '; |
|
748 |
$sql_where = 'WHERE `name` = \''.$index.'\''; |
|
749 |
} else { |
|
750 |
$sql = 'INSERT INTO '; |
|
751 |
$sql_where = ''; |
|
752 |
} |
|
753 |
$sql .= '`'.$oDb->TablePrefix.$table.'` '; |
|
754 |
$sql .= 'SET `name` = \''.$index.'\', '; |
|
755 |
$sql .= '`value` = \''.$val.'\' '.$sql_where; |
|
850 |
$sNameValPairs = ''; |
|
851 |
foreach ($key as $index => $val) { |
|
852 |
$sNameValPairs .= ', (\''.$index.'\', \''.$val.'\')'; |
|
853 |
} |
|
854 |
$sValues = ltrim($sNameValPairs, ', '); |
|
855 |
if ($sValues != '') { |
|
856 |
$sql = 'REPLACE INTO `'.$oDb->TablePrefix.$table.'` (`name`, `value`) ' |
|
857 |
. 'VALUES '.$sValues; |
|
756 | 858 |
if (!$oDb->doQuery($sql)) { |
757 | 859 |
$retval = false; |
758 | 860 |
} |
759 |
}
|
|
861 |
}
|
|
760 | 862 |
return $retval; |
761 | 863 |
} |
branches/2.8.x/wb/install/sql/wb_search_data.sql | ||
---|---|---|
1 |
-- phpMyAdmin SQL Dump |
|
2 |
-- Date of creation: 2012-11-17 12:37am |
|
3 |
-- Server Version: 5.1.41 |
|
4 |
-- Revision $Revision$ |
|
5 |
-- Link $HeadURL$ |
|
6 |
-- Date of modified $Date$ |
|
7 |
-- initial data for table `{TABLE_PREFIX}search` |
|
8 |
-- |
|
9 |
INSERT INTO `{TABLE_PREFIX}search` SET |
|
10 |
`name`='header', |
|
11 |
`value`='<h1>[TEXT_SEARCH]</h1>\n<form name="searchpage" action="[WB_URL]/search/index.php" method="get">\n<table cellpadding="3" cellspacing="0" border="0" style="width:100%; max-width:500px">\n<tr>\n<td>\n<input type="hidden" name="search_path" value="[SEARCH_PATH]" />\n<input type="hidden" name="referrer" value="[REFERRER_ID]" />\n<input type="text" name="string" value="[SEARCH_STRING]" style="width: 100%;" />\n</td>\n<td width="100">\n<input type="submit" value="[TEXT_SEARCH]" style="width: 100%;" />\n</td>\n</tr>\n<tr>\n<td colspan="2">\n<input type="radio" name="match" id="match_all" value="all"[ALL_CHECKED] />\n<label for="match_all">[TEXT_ALL_WORDS]</label>\n<input type="radio" name="match" id="match_any" value="any"[ANY_CHECKED] />\n<label for="match_any">[TEXT_ANY_WORDS]</label>\n<input type="radio" name="match" id="match_exact" value="exact"[EXACT_CHECKED] />\n<label for="match_exact">[TEXT_EXACT_MATCH]</label>\n</td>\n</tr>\n</table>\n</form>\n<hr />', |
|
12 |
`extra`=''; |
|
13 |
INSERT INTO `{TABLE_PREFIX}search` SET |
|
14 |
`name`='footer', |
|
15 |
`value`='', |
|
16 |
`extra`=''; |
|
17 |
INSERT INTO `{TABLE_PREFIX}search` SET |
|
18 |
`name`='results_header', |
|
19 |
`value`='<p>[TEXT_RESULTS_FOR] <strong>[SEARCH_STRING]</strong>:</p>\n<div class="searchresults">', |
|
20 |
`extra`=''; |
|
21 |
INSERT INTO `{TABLE_PREFIX}search` SET |
|
22 |
`name`='results_loop', |
|
23 |
`value`='<h3 style="margin:10px 0 3px 0;"><a href="[LINK]">[TITLE]</a></h3>\n<div style="font-size:0.8em;">[TEXT_LAST_UPDATED_BY] [DISPLAY_NAME] [TEXT_ON] [DATE]</div>\n<p style="padding: 0 0 5px 0; margin: 2px 0 10px 0; border-bottom: 1px solid #777;">[DESCRIPTION].. [EXCERPT]</p>', |
|
24 |
`extra`=''; |
|
25 |
INSERT INTO `{TABLE_PREFIX}search` SET |
|
26 |
`name`='results_footer', |
|
27 |
`value`='</div>', |
|
28 |
`extra`=''; |
|
29 |
INSERT INTO `{TABLE_PREFIX}search` SET |
|
30 |
`name`='no_results', |
|
31 |
`value`='<p>[TEXT_NO_RESULTS]</p>', |
|
32 |
`extra`=''; |
|
33 |
INSERT INTO `{TABLE_PREFIX}search` SET |
|
34 |
`name`='module_order', |
|
35 |
`value`='wysiwyg', |
|
36 |
`extra`=''; |
|
37 |
INSERT INTO `{TABLE_PREFIX}search` SET |
|
38 |
`name`='max_excerpt', |
|
39 |
`value`='5', |
|
40 |
`extra`=''; |
|
41 |
INSERT INTO `{TABLE_PREFIX}search` SET |
|
42 |
`name`='time_limit', |
|
43 |
`value`='0', |
|
44 |
`extra`=''; |
|
45 |
INSERT INTO `{TABLE_PREFIX}search` SET |
|
46 |
`name`='cfg_enable_old_search', |
|
47 |
`value`='true', |
|
48 |
`extra`=''; |
|
49 |
INSERT INTO `{TABLE_PREFIX}search` SET |
|
50 |
`name`='cfg_search_keywords', |
|
51 |
`value`='true', |
|
52 |
`extra`=''; |
|
53 |
INSERT INTO `{TABLE_PREFIX}search` SET |
|
54 |
`name`='cfg_search_description', |
|
55 |
`value`='true', |
|
56 |
`extra`=''; |
|
57 |
INSERT INTO `{TABLE_PREFIX}search` SET |
|
58 |
`name`='cfg_show_description', |
|
59 |
`value`='true', |
|
60 |
`extra`=''; |
|
61 |
INSERT INTO `{TABLE_PREFIX}search` SET |
|
62 |
`name`='cfg_enable_flush', |
|
63 |
`value`='true', |
|
64 |
`extra`=''; |
|
65 |
INSERT INTO `{TABLE_PREFIX}search` SET |
|
66 |
`name`='template', |
|
67 |
`value`='', |
|
68 |
`extra`=''; |
|
69 |
-- End of file |
|
70 | 0 |
branches/2.8.x/wb/install/sql/websitebaker.sql | ||
---|---|---|
1 |
-- phpMyAdmin SQL Dump |
|
2 |
-- Date of creation: 2012-11-17 12:37am |
|
3 |
-- Server Version: 5.1.41 |
|
4 |
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; |
|
5 |
-- -------------------------------------------------------- |
|
6 |
-- Database structure for WebsiteBaker core |
|
7 |
-- |
|
8 |
-- Replacements: {TABLE_PREFIX}, {TABLE_ENGINE}, {TABLE_COLLATION} |
|
9 |
-- |
|
10 |
-- -------------------------------------------------------- |
|
11 |
-- |
|
12 |
-- Structure of table '{TABLE_PREFIX}addons' |
|
13 |
-- |
|
14 |
DROP TABLE IF EXISTS `{TABLE_PREFIX}addons`; |
|
15 |
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}addons` ( |
|
16 |
`addon_id` int(11) NOT NULL AUTO_INCREMENT, |
|
17 |
`type` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
18 |
`directory` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
19 |
`name` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
20 |
`description` text{TABLE_COLLATION} NOT NULL, |
|
21 |
`function` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
22 |
`version` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
23 |
`platform` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
24 |
`author` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
25 |
`license` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
26 |
PRIMARY KEY (addon_id) |
|
27 |
){TABLE_ENGINE}; |
|
28 |
-- |
|
29 |
-- Structure of table '{TABLE_PREFIX}groups' |
|
30 |
-- |
|
31 |
DROP TABLE IF EXISTS `{TABLE_PREFIX}groups`; |
|
32 |
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}groups` ( |
|
33 |
`group_id` int(11) NOT NULL AUTO_INCREMENT, |
|
34 |
`name` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
35 |
`system_permissions` text{TABLE_COLLATION} NOT NULL, |
|
36 |
`module_permissions` text{TABLE_COLLATION} NOT NULL, |
|
37 |
`template_permissions` text{TABLE_COLLATION} NOT NULL, |
|
38 |
PRIMARY KEY (`group_id`) |
|
39 |
){TABLE_ENGINE}; |
|
40 |
-- |
|
41 |
-- Structure of table '{TABLE_PREFIX}pages' |
|
42 |
-- |
|
43 |
DROP TABLE IF EXISTS `{TABLE_PREFIX}pages`; |
|
44 |
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}pages` ( |
|
45 |
`page_id` int(11) NOT NULL AUTO_INCREMENT, |
|
46 |
`parent` int(11) NOT NULL DEFAULT '0', |
|
47 |
`root_parent` int(11) NOT NULL DEFAULT '0', |
|
48 |
`level` int(11) NOT NULL DEFAULT '0', |
|
49 |
`link` varchar(255){TABLE_COLLATION} NOT NULL, |
|
50 |
`target` varchar(7){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
51 |
`page_title` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
52 |
`page_icon` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
53 |
`menu_title` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
54 |
`menu_icon_0` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
55 |
`menu_icon_1` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
56 |
`tooltip` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
57 |
`description` text{TABLE_COLLATION} NOT NULL, |
|
58 |
`keywords` text{TABLE_COLLATION} NOT NULL, |
|
59 |
`page_trail` varchar(255){TABLE_COLLATION} NOT NULL, |
|
60 |
`template` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
61 |
`visibility` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
62 |
`position` int(11) NOT NULL DEFAULT '0', |
|
63 |
`menu` int(11) NOT NULL DEFAULT '1', |
|
64 |
`language` varchar(5){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
65 |
`page_code` int(11) NOT NULL DEFAULT '0', |
|
66 |
`searching` int(11) NOT NULL DEFAULT '0', |
|
67 |
`admin_groups` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '1', |
|
68 |
`admin_users` varchar(512){TABLE_COLLATION} NOT NULL, |
|
69 |
`viewing_groups` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '1', |
|
70 |
`viewing_users` varchar(512){TABLE_COLLATION} NOT NULL, |
|
71 |
`modified_when` int(11) NOT NULL DEFAULT '0', |
|
72 |
`modified_by` int(11) NOT NULL DEFAULT '0', |
|
73 |
`custom01` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
74 |
`custom02` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
75 |
PRIMARY KEY (`page_id`) |
|
76 |
) {TABLE_ENGINE}; |
|
77 |
-- |
|
78 |
-- Structure of table '{TABLE_PREFIX}sections' |
|
79 |
-- |
|
80 |
DROP TABLE IF EXISTS `{TABLE_PREFIX}sections`; |
|
81 |
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}sections` ( |
|
82 |
`section_id` int(11) NOT NULL AUTO_INCREMENT, |
|
83 |
`page_id` int(11) NOT NULL DEFAULT '0', |
|
84 |
`position` int(11) NOT NULL DEFAULT '0', |
|
85 |
`module` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
86 |
`block` int(11) NOT NULL DEFAULT '1', |
|
87 |
`publ_start` int(11) NOT NULL DEFAULT '0', |
|
88 |
`publ_end` int(11) NOT NULL DEFAULT '0', |
|
89 |
PRIMARY KEY (`section_id`) |
|
90 |
) {TABLE_ENGINE}; |
|
91 |
-- |
|
92 |
-- Structure of table '{TABLE_PREFIX}users' |
|
93 |
-- |
|
94 |
DROP TABLE IF EXISTS `{TABLE_PREFIX}users`; |
|
95 |
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}users` ( |
|
96 |
`user_id` int(11) NOT NULL AUTO_INCREMENT, |
|
97 |
`group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'this field is set deprecated and never used in WB', |
|
98 |
`groups_id` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '0', |
|
99 |
`active` int(11) NOT NULL DEFAULT '0', |
|
100 |
`username` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
101 |
`password` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
102 |
`confirm_code` varchar(32){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
103 |
`confirm_timeout` int(11) NOT NULL DEFAULT '0', |
|
104 |
`remember_key` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
105 |
`last_reset` int(11) NOT NULL DEFAULT '0', |
|
106 |
`display_name` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
107 |
`email` text{TABLE_COLLATION} NOT NULL, |
|
108 |
`timezone` int(11) NOT NULL DEFAULT '0', |
|
109 |
`date_format` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
110 |
`time_format` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
111 |
`language` varchar(5){TABLE_COLLATION} NOT NULL DEFAULT 'EN', |
|
112 |
`home_folder` text{TABLE_COLLATION} NOT NULL, |
|
113 |
`login_when` int(11) NOT NULL DEFAULT '0', |
|
114 |
`login_ip` varchar(15){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
115 |
PRIMARY KEY (`user_id`) |
|
116 |
){TABLE_ENGINE}; |
|
117 |
-- |
|
118 |
-- Structure of table '{TABLE_PREFIX}settings' |
|
119 |
-- |
|
120 |
DROP TABLE IF EXISTS `{TABLE_PREFIX}settings`; |
|
121 |
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}settings` ( |
|
122 |
`setting_id` int(11) NOT NULL AUTO_INCREMENT, |
|
123 |
`name` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
124 |
`value` text{TABLE_COLLATION} NOT NULL, |
|
125 |
PRIMARY KEY (`setting_id`) |
|
126 |
){TABLE_ENGINE}; |
|
127 |
-- |
|
128 |
-- Structure of table `{TABLE_PREFIX}search` |
|
129 |
-- |
|
130 |
DROP TABLE IF EXISTS `{TABLE_PREFIX}search`; |
|
131 |
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}search` ( |
|
132 |
`search_id` int(11) NOT NULL AUTO_INCREMENT, |
|
133 |
`name` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
134 |
`value` text{TABLE_COLLATION} NOT NULL, |
|
135 |
`extra` text{TABLE_COLLATION} NOT NULL, |
|
136 |
PRIMARY KEY (`search_id`) |
|
137 |
){TABLE_ENGINE}; |
|
138 |
-- EndOfFile |
|
139 | 0 |
branches/2.8.x/wb/install/sql/install-struct.sql | ||
---|---|---|
1 |
-- phpMyAdmin SQL Dump |
|
2 |
-- Date of creation: 2012-11-17 12:37am |
|
3 |
-- Server Version: 5.1.41 |
|
4 |
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; |
|
5 |
-- -------------------------------------------------------- |
|
6 |
-- Database structure for WebsiteBaker core |
|
7 |
-- |
|
8 |
-- Replacements: {TABLE_PREFIX}, {TABLE_ENGINE}, {TABLE_COLLATION} |
|
9 |
-- |
|
10 |
-- -------------------------------------------------------- |
|
11 |
-- |
|
12 |
-- Structure of table '{TABLE_PREFIX}addons' |
|
13 |
-- |
|
14 |
DROP TABLE IF EXISTS `{TABLE_PREFIX}addons`; |
|
15 |
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}addons` ( |
|
16 |
`addon_id` int(11) NOT NULL AUTO_INCREMENT, |
|
17 |
`type` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
18 |
`directory` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
19 |
`name` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
20 |
`description` text{TABLE_COLLATION} NOT NULL, |
|
21 |
`function` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
22 |
`version` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
23 |
`platform` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
24 |
`author` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
25 |
`license` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
26 |
PRIMARY KEY (addon_id) |
|
27 |
){TABLE_ENGINE}; |
|
28 |
-- |
|
29 |
-- Structure of table '{TABLE_PREFIX}groups' |
|
30 |
-- |
|
31 |
DROP TABLE IF EXISTS `{TABLE_PREFIX}groups`; |
|
32 |
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}groups` ( |
|
33 |
`group_id` int(11) NOT NULL AUTO_INCREMENT, |
|
34 |
`name` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
35 |
`system_permissions` text{TABLE_COLLATION} NOT NULL, |
|
36 |
`module_permissions` text{TABLE_COLLATION} NOT NULL, |
|
37 |
`template_permissions` text{TABLE_COLLATION} NOT NULL, |
|
38 |
PRIMARY KEY (`group_id`) |
|
39 |
){TABLE_ENGINE}; |
|
40 |
-- |
|
41 |
-- Structure of table '{TABLE_PREFIX}pages' |
|
42 |
-- |
|
43 |
DROP TABLE IF EXISTS `{TABLE_PREFIX}pages`; |
|
44 |
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}pages` ( |
|
45 |
`page_id` int(11) NOT NULL AUTO_INCREMENT, |
|
46 |
`parent` int(11) NOT NULL DEFAULT '0', |
|
47 |
`root_parent` int(11) NOT NULL DEFAULT '0', |
|
48 |
`level` int(11) NOT NULL DEFAULT '0', |
|
49 |
`link` varchar(255){TABLE_COLLATION} NOT NULL, |
|
50 |
`target` varchar(7){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
51 |
`page_title` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
52 |
`page_icon` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
53 |
`menu_title` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
54 |
`menu_icon_0` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
55 |
`menu_icon_1` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
56 |
`tooltip` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
57 |
`description` text{TABLE_COLLATION} NOT NULL, |
|
58 |
`keywords` text{TABLE_COLLATION} NOT NULL, |
|
59 |
`page_trail` varchar(255){TABLE_COLLATION} NOT NULL, |
|
60 |
`template` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
61 |
`visibility` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
62 |
`position` int(11) NOT NULL DEFAULT '0', |
|
63 |
`menu` int(11) NOT NULL DEFAULT '1', |
|
64 |
`language` varchar(5){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
65 |
`page_code` int(11) NOT NULL DEFAULT '0', |
|
66 |
`searching` int(11) NOT NULL DEFAULT '0', |
|
67 |
`admin_groups` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '1', |
|
68 |
`admin_users` varchar(512){TABLE_COLLATION} NOT NULL, |
|
69 |
`viewing_groups` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '1', |
|
70 |
`viewing_users` varchar(512){TABLE_COLLATION} NOT NULL, |
|
71 |
`modified_when` int(11) NOT NULL DEFAULT '0', |
|
72 |
`modified_by` int(11) NOT NULL DEFAULT '0', |
|
73 |
`custom01` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
74 |
`custom02` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
75 |
PRIMARY KEY (`page_id`) |
|
76 |
) {TABLE_ENGINE}; |
|
77 |
-- |
|
78 |
-- Structure of table '{TABLE_PREFIX}sections' |
|
79 |
-- |
|
80 |
DROP TABLE IF EXISTS `{TABLE_PREFIX}sections`; |
|
81 |
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}sections` ( |
|
82 |
`section_id` int(11) NOT NULL AUTO_INCREMENT, |
|
83 |
`page_id` int(11) NOT NULL DEFAULT '0', |
|
84 |
`position` int(11) NOT NULL DEFAULT '0', |
|
85 |
`title` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
86 |
`module` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
87 |
`block` int(11) NOT NULL DEFAULT '1', |
|
88 |
`publ_start` int(11) NOT NULL DEFAULT '0', |
|
89 |
`publ_end` int(11) NOT NULL DEFAULT '0', |
|
90 |
PRIMARY KEY (`section_id`) |
|
91 |
) {TABLE_ENGINE}; |
|
92 |
-- |
|
93 |
-- Structure of table '{TABLE_PREFIX}users' |
|
94 |
-- |
|
95 |
DROP TABLE IF EXISTS `{TABLE_PREFIX}users`; |
|
96 |
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}users` ( |
|
97 |
`user_id` int(11) NOT NULL AUTO_INCREMENT, |
|
98 |
`group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'this field is set deprecated and never used in WB', |
|
99 |
`groups_id` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '0', |
|
100 |
`active` int(11) NOT NULL DEFAULT '0', |
|
101 |
`username` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
102 |
`password` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
103 |
`confirm_code` varchar(32){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
104 |
`confirm_timeout` int(11) NOT NULL DEFAULT '0', |
|
105 |
`remember_key` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
106 |
`last_reset` int(11) NOT NULL DEFAULT '0', |
|
107 |
`display_name` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
108 |
`email` text{TABLE_COLLATION} NOT NULL, |
|
109 |
`timezone` int(11) NOT NULL DEFAULT '0', |
|
110 |
`date_format` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
111 |
`time_format` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
112 |
`language` varchar(5){TABLE_COLLATION} NOT NULL DEFAULT 'EN', |
|
113 |
`home_folder` text{TABLE_COLLATION} NOT NULL, |
|
114 |
`login_when` int(11) NOT NULL DEFAULT '0', |
|
115 |
`login_ip` varchar(15){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
116 |
PRIMARY KEY (`user_id`) |
|
117 |
){TABLE_ENGINE}; |
|
118 |
-- |
|
119 |
-- Structure of table '{TABLE_PREFIX}settings' |
|
120 |
-- |
|
121 |
DROP TABLE IF EXISTS `{TABLE_PREFIX}settings`; |
|
122 |
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}settings` ( |
|
123 |
`name` varchar(255){TABLE_COLLATION} NOT NULL, |
|
124 |
`value` text{TABLE_COLLATION} NOT NULL, |
|
125 |
PRIMARY KEY (`name`) |
|
126 |
){TABLE_ENGINE}; |
|
127 |
-- |
|
128 |
-- Structure of table `{TABLE_PREFIX}search` |
|
129 |
-- |
|
130 |
DROP TABLE IF EXISTS `{TABLE_PREFIX}search`; |
|
131 |
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}search` ( |
|
132 |
`search_id` int(11) NOT NULL AUTO_INCREMENT, |
|
133 |
`name` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '', |
|
134 |
`value` text{TABLE_COLLATION} NOT NULL, |
|
135 |
`extra` text{TABLE_COLLATION} NOT NULL, |
|
136 |
PRIMARY KEY (`search_id`) |
|
137 |
){TABLE_ENGINE}; |
|
138 |
-- EndOfFile |
|
0 | 139 |
branches/2.8.x/wb/install/sql/install-data.sql | ||
---|---|---|
1 |
-- phpMyAdmin SQL Dump |
|
2 |
-- version 4.0.4.1 |
|
3 |
-- http://www.phpmyadmin.net |
|
4 |
-- |
|
5 |
-- Host: 127.0.0.1 |
|
6 |
-- Erstellungszeit: 17. Nov 2012 um 12:37 |
|
7 |
-- Server Version: 5.5.32 |
|
8 |
-- PHP-Version: 5.4.19 |
|
9 |
-- |
|
10 |
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; |
|
11 |
-- |
|
12 |
-- Daten für Tabelle `groups` |
|
13 |
-- |
|
14 |
INSERT INTO `{TABLE_PREFIX}groups` (`group_id`, `name`, `system_permissions`, `module_permissions`, `template_permissions`) VALUES |
|
15 |
(1, 'Administrators', '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', '', ''); |
|
16 |
-- |
|
17 |
-- Daten für Tabelle `search` |
|
18 |
-- |
|
19 |
INSERT INTO `{TABLE_PREFIX}search` (`name`, `value`, `extra`) VALUES |
|
20 |
('header', '<h1>[TEXT_SEARCH]</h1>\n<form name="searchpage" action="[WB_URL]/search/index.php" method="get">\n<table cellpadding="3" cellspacing="0" border="0" style="width:100%; max-width:500px">\n<tr>\n<td>\n<input type="hidden" name="search_path" value="[SEARCH_PATH]" />\n<input type="hidden" name="referrer" value="[REFERRER_ID]" />\n<input type="text" name="string" value="[SEARCH_STRING]" style="width: 100%;" />\n</td>\n<td width="100">\n<input type="submit" value="[TEXT_SEARCH]" style="width: 100%;" />\n</td>\n</tr>\n<tr>\n<td colspan="2">\n<input type="radio" name="match" id="match_all" value="all"[ALL_CHECKED] />\n<label for="match_all">[TEXT_ALL_WORDS]</label>\n<input type="radio" name="match" id="match_any" value="any"[ANY_CHECKED] />\n<label for="match_any">[TEXT_ANY_WORDS]</label>\n<input type="radio" name="match" id="match_exact" value="exact"[EXACT_CHECKED] />\n<label for="match_exact">[TEXT_EXACT_MATCH]</label>\n</td>\n</tr>\n</table>\n</form>\n<hr />', ''), |
|
21 |
('footer', '', ''), |
|
22 |
('results_header', '<p>[TEXT_RESULTS_FOR] <strong>[SEARCH_STRING]</strong>:</p>\n<div class="searchresults">', ''), |
|
23 |
('results_loop', '<h3 style="margin:10px 0 3px 0;"><a href="[LINK]">[TITLE]</a></h3>\n<div style="font-size:0.8em;">[TEXT_LAST_UPDATED_BY] [DISPLAY_NAME] [TEXT_ON] [DATE]</div>\n<p style="padding: 0 0 5px 0; margin: 2px 0 10px 0; border-bottom: 1px solid #777;">[DESCRIPTION].. [EXCERPT]</p>', ''), |
|
24 |
('results_footer', '</div>', ''), |
|
25 |
('no_results', '<p>[TEXT_NO_RESULTS]</p>', ''), |
|
26 |
('module_order', 'wysiwyg', ''), |
|
27 |
('max_excerpt', '15', ''), |
|
28 |
('time_limit', '0', ''), |
|
29 |
('cfg_enable_old_search', 'true', ''), |
|
30 |
('cfg_search_keywords', 'true', ''), |
|
31 |
('cfg_search_description', 'true', ''), |
|
32 |
('cfg_show_description', 'true', ''), |
|
33 |
('cfg_enable_flush', 'false', ''), |
|
34 |
('template', '', ''); |
|
35 |
-- |
|
36 |
-- Daten für Tabelle `settings` |
|
37 |
-- |
|
38 |
INSERT INTO `{TABLE_PREFIX}settings` (`name`, `value`) VALUES |
|
39 |
('website_description', ''), |
|
40 |
('website_keywords', ''), |
|
41 |
('website_header', ''), |
|
42 |
('website_footer', ''), |
|
43 |
('wysiwyg_style', 'font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;'), |
|
44 |
('er_level', ''), |
|
45 |
('sec_anchor', 'wb_'), |
|
46 |
('default_date_format', 'M d Y'), |
|
47 |
('default_time_format', 'g:i A'), |
|
48 |
('redirect_timer', '1500'), |
|
49 |
('home_folders', 'true'), |
|
50 |
('warn_page_leave', '1'), |
|
51 |
('default_template', 'round'), |
|
52 |
('default_theme', 'wb_theme'), |
|
53 |
('default_charset', 'utf-8'), |
|
54 |
('multiple_menus', 'true'), |
|
55 |
('page_level_limit', '4'), |
|
56 |
('intro_page', 'false'), |
|
57 |
('page_trash', 'inline'), |
|
58 |
('homepage_redirection', 'false'), |
|
59 |
('page_languages', 'true'), |
|
60 |
('wysiwyg_editor', 'fckeditor'), |
|
61 |
('manage_sections', 'true'), |
|
62 |
('section_blocks', 'true'), |
|
63 |
('smart_login', 'true'), |
|
64 |
('frontend_login', 'false'), |
|
65 |
('frontend_signup', 'false'), |
|
66 |
('search', 'public'), |
|
67 |
('page_extension', '.php'), |
|
68 |
('page_spacer', '-'), |
|
69 |
('pages_directory', '/pages'), |
|
70 |
('rename_files_on_upload', 'ph.*?,cgi,pl,pm,exe,com,bat,pif,cmd,src,asp,aspx,js'), |
|
71 |
('media_directory', '/media'), |
|
72 |
('wbmailer_routine', 'phpmail'), |
|
73 |
('wbmailer_default_sendername', 'WB Mailer'), |
|
74 |
('wbmailer_smtp_host', ''), |
|
75 |
('wbmailer_smtp_auth', ''), |
|
76 |
('wbmailer_smtp_username', ''), |
|
77 |
('wbmailer_smtp_password', ''), |
|
78 |
('fingerprint_with_ip_octets', '2'), |
|
79 |
('secure_form_module', ''), |
|
80 |
('mediasettings', ''), |
|
81 |
('page_icon_dir', '/templates/*/title_images'), |
|
82 |
('dev_infos', 'false'), |
|
83 |
('wbmail_signature', ''), |
|
84 |
('confirmed_registration', '1'), |
|
85 |
('page_extendet', 'true'), |
|
86 |
('system_locked', '0'), |
|
87 |
('password_crypt_loops', '12'), |
|
88 |
('password_hash_type', 'false'), |
|
89 |
('password_length', '10'), |
|
90 |
('password_use_types', '65535'); |
|
91 |
-- End of file |
|
0 | 92 |
branches/2.8.x/wb/install/save.php | ||
---|---|---|
39 | 39 |
include(dirname(__DIR__).'/framework/globalExceptionHandler.php'); |
40 | 40 |
include(dirname(__DIR__).'/framework/WbAutoloader.php'); |
41 | 41 |
WbAutoloader::doRegister(array('admin'=>'a', 'modules'=>'m', 'templates'=>'t', 'include'=>'i')); |
42 |
include(__DIR__.'/InstallHelper.php'); |
|
42 | 43 |
// register PHPMailer autoloader --- |
43 | 44 |
if (!function_exists('PHPMailerAutoload')) { |
44 | 45 |
require(dirname(__DIR__).'/include/phpmailer/PHPMailerAutoload.php'); |
... | ... | |
261 | 262 |
// End path and timezone details code |
262 | 263 |
|
263 | 264 |
// Get the default language |
264 |
$allowed_languages = array('BG','CA', 'CS', 'DA', 'DE', 'EN', 'ES', 'ET', 'FI', 'FR', 'HR', 'HU', 'IT', 'LV', 'NL', 'NO', 'PL', 'PT', 'RU','SE','SK','TR'); |
|
265 |
$sLanguageDirectory = dirname(__DIR__).'languages/'; |
|
266 |
$allowed_languages = array_keys(InstallHelper::getAvailableLanguages($sLanguageDirectory)); |
|
265 | 267 |
if(!isset($_POST['default_language']) OR !in_array($_POST['default_language'], $allowed_languages)) { |
266 | 268 |
set_error('Please select a valid default backend language','default_language'); |
267 | 269 |
} else { |
... | ... | |
400 | 402 |
."pass = \"".$database_password."\"\n" |
401 | 403 |
."host = \"".$database_host."\"\n" |
402 | 404 |
."port = \"3306\"\n" |
405 |
."socket = \"\"\n" |
|
403 | 406 |
."name = \"".$database_name."\"\n" |
404 | 407 |
."charset = \"utf8\"\n" |
405 | 408 |
."table_prefix = \"".$table_prefix."\"\n" |
... | ... | |
463 | 466 |
$sSecMod = (defined('SECURE_FORM_MODULE') && SECURE_FORM_MODULE != '') ? '.'.SECURE_FORM_MODULE : ''; |
464 | 467 |
$sSecMod = WB_PATH.'/framework/SecureForm'.$sSecMod.'.php'; |
465 | 468 |
require_once($sSecMod); |
469 |
require(ADMIN_PATH.'/interface/version.php'); |
|
470 |
|
|
471 |
/***************************** |
|
472 |
Begin Create Database Tables |
|
473 |
*****************************/ |
|
474 |
if (is_readable(__DIR__.'/sql/install-struct.sql')) { |
|
475 |
if (! $database->SqlImport(__DIR__.'/sql/install-struct.sql', TABLE_PREFIX, false)) { |
|
476 |
set_error('unable to import install-struct.sql'); |
|
477 |
} |
|
478 |
} |
|
479 |
if (is_readable(__DIR__.'/sql/install-data.sql')) { |
|
480 |
if (! $database->SqlImport(__DIR__.'/sql/install-data.sql', TABLE_PREFIX)) { |
|
481 |
set_error('unable to import install-data.sql'); |
|
482 |
} |
|
483 |
} |
|
484 |
$sql = // additional settings from install input |
|
485 |
'REPLACE INTO `'.TABLE_PREFIX.'settings` (`name`, `value`) VALUES ' |
|
486 |
. '(\'wb_version\', \''.VERSION.'\'), ' |
|
487 |
. '(\'website_title\', \''.$website_title.'\'), ' |
|
488 |
. '(\'default_language\', \''.$default_language.'\'), ' |
|
489 |
. '(\'app_name\', \'wb_'.$session_rand.'\'), ' |
|
490 |
. '(\'default_timezone\', \''.$default_timezone.'\'), ' |
|
491 |
. '(\'operating_system\', \''.$operating_system.'\'), ' |
|
492 |
. '(\'string_file_mode\', \''.$file_mode.'\'), ' |
|
493 |
. '(\'string_dir_mode\', \''.$dir_mode.'\'), ' |
|
494 |
. '(\'server_email\', \''.$admin_email.'\'), ' |
|
495 |
. '(\'wb_revision\', \''.REVISION.'\'), ' |
|
496 |
. '(\'wb_sp\', \''.SP.'\'), ' |
|
497 |
. '(\'groups_updated\', \''.time().'\')'; |
|
498 |
if (! ($database->query($sql))) { |
|
499 |
set_error('unable to write \'install presets\' into table \'settings\''); |
|
500 |
} |
|
501 |
$sql = // add the Admin user |
|
502 |
'INSERT INTO `'.TABLE_PREFIX.'users` ' |
|
503 |
.'SET `user_id`=1, ' |
|
504 |
. '`group_id`=1, ' |
|
505 |
. '`groups_id`=\'1\', ' |
|
506 |
. '`active`=\'1\', ' |
|
507 |
. '`username`=\''.$admin_username.'\', ' |
|
508 |
. '`password`=\''.md5($admin_password).'\', ' |
|
509 |
. '`email`=\''.$admin_email.'\', ' |
|
510 |
. '`timezone`=\''.$default_timezone.'\', ' |
|
511 |
. '`language`=\''.$default_language.'\', ' |
|
512 |
. '`display_name`=\'Administrator\''; |
|
513 |
if (! ($database->query($sql))) { |
|
514 |
set_error('unable to write Administrator account into table \'users\''); |
|
515 |
} |
|
516 |
/********************** |
|
517 |
END OF TABLES IMPORT |
|
518 |
**********************/ |
|
519 |
// initialize the system |
|
520 |
require_once(WB_PATH.'/framework/initialize.php'); |
|
466 | 521 |
require_once(WB_PATH.'/framework/class.admin.php'); |
467 |
|
|
522 |
/*********************** |
|
468 | 523 |
// Dummy class to allow modules' install scripts to call $admin->print_error |
469 |
class admin_dummy extends admin |
|
470 |
{ |
|
471 |
var $error=''; |
|
472 |
function print_error($message, $link = 'index.php', $auto_footer = true) |
|
473 |
{ |
|
474 |
$this->error=$message; |
|
475 |
} |
|
476 |
} |
|
477 |
|
|
478 |
// core tables only structure |
|
479 |
$sSqlFileName = dirname(__FILE__).'/sql/websitebaker.sql'; |
|
480 |
if(!$database->SqlImport($sSqlFileName,TABLE_PREFIX, false)) { set_error($database->get_error()); } |
|
481 |
|
|
482 |
require(ADMIN_PATH.'/interface/version.php'); |
|
483 |
|
|
484 |
$sql = 'INSERT INTO `'.TABLE_PREFIX.'settings` (`name`, `value`) VALUES ' |
|
485 |
. '(\'wb_version\', \''.VERSION.'\'), ' |
|
486 |
. '(\'website_title\', \''.$website_title.'\'), ' |
|
487 |
. '(\'website_description\', \'\'), ' |
|
488 |
. '(\'website_keywords\', \'\'), ' |
|
489 |
. '(\'website_header\', \'\'), ' |
|
490 |
. '(\'website_footer\', \'\'), ' |
|
491 |
. '(\'wysiwyg_style\', \'font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;\'), ' |
|
492 |
. '(\'er_level\', \'0\'), ' |
|
493 |
. '(\'default_language\', \''.$default_language.'\'), ' |
|
494 |
. '(\'app_name\', \'wb_'.$session_rand.'\'), ' |
|
495 |
. '(\'sec_anchor\', \'Sec\'), ' |
|
496 |
. '(\'server_timezone\', \'UTC\'), ' |
|
497 |
. '(\'default_timezone\', \''.$default_timezone.'\'), ' |
|
498 |
. '(\'default_date_format\', \'Y-m-d\'), ' |
|
499 |
. '(\'default_time_format\', \'h:i A\'), ' |
|
500 |
. '(\'redirect_timer\', \'1500\'), ' |
|
501 |
. '(\'home_folders\', \'false\'), ' |
|
502 |
. '(\'warn_page_leave\', \'1\'), ' |
|
503 |
. '(\'default_template\', \'round\'), ' |
|
504 |
. '(\'default_theme\', \'WbTheme\'), ' |
|
505 |
. '(\'default_charset\', \'utf-8\'), ' |
|
506 |
. '(\'multiple_menus\', \'true\'), ' |
|
507 |
. '(\'page_level_limit\', \'6\'), ' |
|
508 |
. '(\'intro_page\', \'false\'), ' |
|
509 |
. '(\'page_trash\', \'inline\'), ' |
|
510 |
. '(\'homepage_redirection\', \'false\'), ' |
|
511 |
. '(\'page_languages\', \'false\'), ' |
|
512 |
. '(\'wysiwyg_editor\', \'fckeditor\'), ' |
|
513 |
. '(\'manage_sections\', \'true\'), ' |
|
514 |
. '(\'section_blocks\', \'false\'), ' |
|
515 |
. '(\'smart_login\', \'false\'), ' |
|
516 |
. '(\'frontend_login\', \'false\'), ' |
|
517 |
. '(\'frontend_signup\', \'false\'), ' |
|
518 |
. '(\'search\', \'public\'), ' |
|
519 |
. '(\'page_extension\', \'.php\'), ' |
|
520 |
. '(\'page_spacer\', \'-\'), ' |
|
521 |
. '(\'pages_directory\', \'/pages\'), ' |
|
522 |
. '(\'rename_files_on_upload\', \'ph.*?,cgi,pl,pm,exe,com,bat,pif,cmd,src,asp,aspx,js,txt\'), ' |
|
523 |
. '(\'media_directory\', \'/media\'), ' |
|
524 |
. '(\'operating_system\', \''.$operating_system.'\'), ' |
|
525 |
. '(\'string_file_mode\', \''.$file_mode.'\'), ' |
|
526 |
. '(\'string_dir_mode\', \''.$dir_mode.'\'), ' |
|
527 |
. '(\'wbmailer_routine\', \'phpmail\'), ' |
|
528 |
. '(\'server_email\', \''.$admin_email.'\'), ' |
|
529 |
. '(\'wbmailer_default_sendername\', \'WebsiteBaker Mailer\'), ' |
|
530 |
. '(\'wbmailer_smtp_host\', \'\'), ' |
|
531 |
. '(\'wbmailer_smtp_auth\', \'\'), ' |
|
532 |
. '(\'wbmailer_smtp_username\', \'\'), ' |
|
533 |
. '(\'wbmailer_smtp_password\', \'\'), ' |
|
534 |
. '(\'fingerprint_with_ip_octets\', \'2\'), ' |
|
535 |
. '(\'secure_form_module\', \'\'), ' |
|
536 |
. '(\'mediasettings\', \'\'), ' |
|
537 |
. '(\'wb_revision\', \''.REVISION.'\'), ' |
|
538 |
. '(\'wb_sp\', \''.SP.'\'), ' |
|
539 |
. '(\'page_icon_dir\', \'/templates/*/title_images\'), ' |
|
540 |
. '(\'dev_infos\', \'false\'), ' |
|
541 |
. '(\'groups_updated\', \''.time().'\'), ' |
|
542 |
. '(\'wbmail_signature\', \'\'), ' |
|
543 |
. '(\'confirmed_registration\', \'1\'), ' |
|
544 |
. '(\'page_extendet\', \'true\'), ' |
|
545 |
. '(\'system_locked\', \'0\'), ' |
|
546 |
. '(\'password_crypt_loops\', \'12\'), ' |
|
547 |
. '(\'password_hash_type\', \'false\'), ' |
|
548 |
. '(\'password_length\', \'10\'), ' |
|
549 |
. '(\'password_use_types\', \''.(int)0xFFFF.'\') ' |
|
550 |
. ''; |
|
551 |
if(!$database->query($sql)) { set_error($database->get_error()); } |
|
552 |
|
|
553 |
// Admin group |
|
554 |
$full_system_permissions = 'access,addons,admintools,admintools_view,groups,groups_add,groups_delete,' |
|
555 |
. 'groups_modify,groups_view,languages,languages_install,languages_uninstall,' |
|
556 |
. 'languages_view,media,media_create,media_delete,media_rename,media_upload,' |
|
557 |
. 'media_view,modules,modules_advanced,modules_install,modules_uninstall,' |
|
558 |
. 'modules_view,pages,pages_add,pages_add_l0,pages_delete,pages_intro,' |
|
559 |
. 'pages_modify,pages_settings,pages_view,preferences,preferences_view,' |
|
560 |
. 'settings,settings_advanced,settings_basic,settings_view,templates,' |
|
561 |
. 'templates_install,templates_uninstall,templates_view,users,users_add,' |
|
562 |
. 'users_delete,users_modify,users_view'; |
|
563 |
$sql = 'INSERT INTO `'.TABLE_PREFIX.'groups` ' |
|
564 |
. 'SET `group_id` =1,' |
|
565 |
. '`name`=\'Administrators\',' |
|
566 |
. '`system_permissions`=\''.$full_system_permissions.'\',' |
|
567 |
. '`module_permissions`=\'\',' |
|
568 |
. '`template_permissions`=\'\''; |
|
569 |
if(!$database->query($sql)) { set_error($database->get_error()); } |
|
570 |
|
|
571 |
// Admin user |
|
572 |
$insert_admin_user = "INSERT INTO `".TABLE_PREFIX."users` VALUES (1, 1, '1', 1, '$admin_username', '".md5($admin_password)."', '', 0, '', 0, 'Administrator', '$admin_email', $default_timezone, '', '', '$default_language', '', 0, '');"; |
|
573 |
if(!$database->query($insert_admin_user)) { set_error($database->get_error()); } |
|
574 |
|
|
575 |
// Search layout default data |
|
576 |
$sSqlFileName = dirname(__FILE__).'/sql/wb_search_data.sql'; |
|
577 |
if(!$database->SqlImport($sSqlFileName,TABLE_PREFIX, false)) { set_error($database->get_error()); } |
|
578 |
|
|
579 |
require_once(WB_PATH.'/framework/initialize.php'); |
|
580 |
// |
|
524 |
***********************/ |
|
525 |
class admin_dummy extends admin |
|
526 |
{ |
|
527 |
public $error=''; |
|
528 |
public function print_error($message, $link = 'index.php', $auto_footer = true) |
|
529 |
{ |
|
530 |
$this->error=$message; |
|
531 |
} |
|
532 |
} |
|
581 | 533 |
// Include WB functions file |
582 | 534 |
require_once(WB_PATH.'/framework/functions.php'); |
583 | 535 |
// Re-connect to the database, this time using in-build database class |
... | ... | |
585 | 537 |
// Include the PclZip class file (thanks to |
586 | 538 |
require_once(WB_PATH.'/include/pclzip/pclzip.lib.php'); |
587 | 539 |
// Install add-ons |
588 |
if(file_exists(WB_PATH.'/install/modules')) { |
|
589 |
// Unpack pre-packaged modules |
|
590 |
} |
|
591 |
if(file_exists(WB_PATH.'/install/templates')) { |
|
592 |
// Unpack pre-packaged templates |
|
593 |
} |
|
594 |
if(file_exists(WB_PATH.'/install/languages')) { |
|
595 |
// Unpack pre-packaged languages |
|
596 |
} |
|
597 |
|
|
598 | 540 |
$admin=new admin_dummy('Start','',false,false); |
599 |
// Load addons into DB |
|
600 |
$dirs['modules'] = WB_PATH.'/modules/'; |
|
601 |
$dirs['templates'] = WB_PATH.'/templates/'; |
|
602 |
$dirs['languages'] = WB_PATH.'/languages/'; |
|
541 |
// Load addons and templates into DB |
|
542 |
$aScanDirs = array( |
|
543 |
'module' => dirname(__DIR__).'/modules/', |
|
544 |
'template' => dirname(__DIR__).'/templates/', |
|
545 |
'language' => dirname(__DIR__).'/languages/' |
|
546 |
); |
|
547 |
foreach ($aScanDirs as $sType => $sPath) { |
|
548 |
$sCommand = 'load_'.$sType; |
|
549 |
if ($sType != 'language') { |
|
550 |
foreach (glob($sPath, GLOB_ONLYDIR) as $sMatchingPath) { |
|
551 |
if ($sType == 'module') { |
|
552 |
$sCommand($sMatchingPath, true); |
|
553 |
if ($admin->error) { set_error($admin->error); } |
|
554 |
} elseif ($sType == 'template') { |
|
555 |
$sCommand($sMatchingPath); |
|
556 |
} |
|
557 |
} |
|
558 |
} else { |
|
559 |
foreach (glob(dirname(__DIR__).'/languages/??.php') as $sMatchingPath) { |
|
560 |
if (preg_match('/\/[A-Z]{2}\.php$/sU', $sMatchingPath)) { |
|
561 |
$sCommand($sMatchingPath); |
|
562 |
} |
|
563 |
} |
|
564 |
} |
|
565 |
} |
|
603 | 566 |
|
604 |
foreach($dirs AS $type => $dir) { |
|
605 |
if(($handle = opendir($dir))) { |
|
606 |
while(false !== ($file = readdir($handle))) { |
|
607 |
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') { |
|
608 |
// Get addon type |
|
609 |
if($type == 'modules') { |
|
610 |
load_module($dir.'/'.$file, true); |
|
611 |
// Pretty ugly hack to let modules run $admin->set_error |
|
612 |
// See dummy class definition admin_dummy above |
|
613 |
if ($admin->error!='') { |
|
614 |
set_error($admin->error); |
|
615 |
} |
|
616 |
} elseif($type == 'templates') { |
|
617 |
load_template($dir.'/'.$file); |
|
618 |
} elseif($type == 'languages') { |
|
619 |
load_language($dir.'/'.$file); |
|
620 |
} |
|
621 |
} |
|
622 |
} |
Also available in: Unified diff
! complete rebuild of wb/install/ - changed to use import-struct.sql
! change class WbDatabase from mysql to msqli
! rework of WbDatabase::importSql()
! function db_update_key_value() optimized for speed
! field `settings_id`removed from table `settings` and new primary key set to `name`
! update-script extended to modify table `settings`