Revision 1537
Added by Dietmar almost 13 years ago
install.php | ||
---|---|---|
4 | 4 |
* @category modules |
5 | 5 |
* @package JsAdmin |
6 | 6 |
* @author WebsiteBaker Project, modified by Swen Uth for Website Baker 2.7 |
7 |
* @copyright (C) 2006, Stepan Riha |
|
8 |
* @copyright 2009-2011, Website Baker Org. e.V. |
|
7 |
* @copyright (C) 2006, Stepan Riha, 2009-2011, Website Baker Org. e.V. |
|
9 | 8 |
* @link http://www.websitebaker2.org/ |
10 | 9 |
* @license http://www.gnu.org/licenses/gpl.html |
11 | 10 |
* @platform WebsiteBaker 2.8.x |
... | ... | |
17 | 16 |
*/ |
18 | 17 |
|
19 | 18 |
// prevent this file from being accessed directly |
20 |
if(!defined('WB_PATH')) { exit('Cannot access this file directly'); } |
|
19 |
/* -------------------------------------------------------- */ |
|
20 |
if(defined('WB_PATH') == false) |
|
21 |
{ |
|
22 |
// Stop this file being access directly |
|
23 |
die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>'); |
|
24 |
} |
|
25 |
/* -------------------------------------------------------- */ |
|
21 | 26 |
|
22 | 27 |
// add new rows to table "settings" |
23 | 28 |
|
29 |
$msg = array (); |
|
24 | 30 |
$table = TABLE_PREFIX ."mod_jsadmin"; |
31 |
$jsadminDefault = array ( |
|
32 |
array ( 'id' => '1','name' => 'mod_jsadmin_persist_order','value' => '1' ), |
|
33 |
array ( 'id' => '2','name' => 'mod_jsadmin_ajax_order_pages','value' => '1' ), |
|
34 |
array ( 'id' => '3','name' => 'mod_jsadmin_ajax_order_sections','value' => '1' ), |
|
35 |
); |
|
36 |
|
|
25 | 37 |
$database->query("DROP TABLE IF EXISTS `$table`"); |
38 |
$sql = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_jsadmin` (' |
|
39 |
. ' `id` INT(11) NOT NULL DEFAULT \'0\',' |
|
40 |
. ' `name` VARCHAR(255) NOT NULL DEFAULT \'0\',' |
|
41 |
. ' `value` INT(11) NOT NULL DEFAULT \'0\',' |
|
42 |
. ' PRIMARY KEY ( `id` )' |
|
43 |
. ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci'; |
|
26 | 44 |
|
27 |
$database->query(" |
|
28 |
CREATE TABLE `$table` ( |
|
29 |
`id` INT(11) NOT NULL DEFAULT '0', |
|
30 |
`name` VARCHAR(255) NOT NULL DEFAULT '0', |
|
31 |
`value` INT(11) NOT NULL DEFAULT '0', |
|
32 |
PRIMARY KEY (`id`) |
|
33 |
) |
|
34 |
"); |
|
45 |
if($database->query($sql) ) { |
|
35 | 46 |
|
36 |
global $database; |
|
37 |
$database->query("INSERT INTO ".$table." (id,name,value) VALUES ('1','mod_jsadmin_persist_order','1')"); |
|
38 |
$database->query("INSERT INTO ".$table." (id,name,value) VALUES ('2','mod_jsadmin_ajax_order_pages','1')"); |
|
39 |
$database->query("INSERT INTO ".$table." (id,name,value) VALUES ('3','mod_jsadmin_ajax_order_sections','1')"); |
|
47 |
for($x=0;$x<sizeof($jsadminDefault); $x++) { |
|
48 |
$sql = 'INSERT INTO '.$table.' SET '; |
|
49 |
$sql .= '`id`=\''.$jsadminDefault[$x]['id'].'\', '; |
|
50 |
$sql .= '`name`=\''.$jsadminDefault[$x]['name'].'\', '; |
|
51 |
$sql .= '`value`=\''.$jsadminDefault[$x]['value'].'\' '; |
|
52 |
if(!$database->query($sql) ) { $msg[] = $database->get_error();} |
|
53 |
} |
|
54 |
} else { |
|
55 |
$msg[] = $database->get_error(); |
|
56 |
} |
|
40 | 57 |
|
41 |
?> |
Also available in: Unified diff
continue updating headerinfos, adding upgrade scripts to module