Project

General

Profile

« Previous | Next » 

Revision 1754

Added by Dietmar about 12 years ago

  1. fixed Duplicate entry for key 'PRIMARY' if adding a new pageX
    search for ->page['root_parent'] == 0 in module and shoe_menu2 calls
    page['root_parent'] has always the page_id from the first adding new page in level

View differences:

branches/2.8.x/CHANGELOG
13 13

  
14 14

  
15 15

  
16
15 Sep-2012 Build 1754 Dietmar Woellbrink (Luisehahne)
17
# fixed Duplicate entry  for key 'PRIMARY' if adding a new  pageX
18
  search for ->page['root_parent'] == 0 in module and shoe_menu2 calls
19
  page['root_parent'] has always the page_id from the first adding new page in level  
16 20
15 Sep-2012 Build 1753 Dietmar Woellbrink (Luisehahne)
17 21
! remove summary="" in captcha tables frontend
18 22
! fixed calendar time, now all Calendar in WB shows right user TIMEZONE
branches/2.8.x/wb/admin/pages/settings_save.php
156 156
	$root_parent = root_parent($parent);
157 157
}
158 158
else {
159
	$level = '0';
160
	$root_parent = '0';
159
//	$level = '0';
160
//	$root_parent = '0';
161
// Work out level
162
    $level = level_count($page_id);
163
// Work out root parent
164
    $root_parent = root_parent($page_id);
161 165
}
162 166

  
163 167
// Work-out what the link should be
branches/2.8.x/wb/admin/pages/add.php
223 223
$position = 1;
224 224

  
225 225
// Add new record into the sections table
226
$database->query("INSERT INTO ".TABLE_PREFIX."sections (page_id,position,module,block) VALUES ('$page_id','$position', '$module','1')");
226
//$database->query("INSERT INTO ".TABLE_PREFIX."sections (page_id,position,module,block) VALUES ('$page_id','$position', '$module','1')");
227 227

  
228
// Get the section id
229
$section_id = $database->get_one("SELECT LAST_INSERT_ID()");
230

  
231
// Include the selected modules add file if it exists
232
if(file_exists(WB_PATH.'/modules/'.$module.'/add.php')) {
233
	require(WB_PATH.'/modules/'.$module.'/add.php');
228
// Insert module into DB
229
$sql  = 'INSERT INTO `'.TABLE_PREFIX.'sections` SET ';
230
$sql .= '`page_id` = '.(int)$page_id.', ';
231
$sql .= '`module` = \''.$module.'\', ';
232
$sql .= '`position` = '.(int)$position.', ';
233
$sql .= '`block` = \'1\', ';
234
$sql .= '`publ_start` = \'0\',';
235
$sql .= '`publ_end` = \'0\' ';
236
if($database->query($sql)) {
237
	// Get the section id
238
	$section_id = $database->get_one("SELECT LAST_INSERT_ID()");
239
	// Include the selected modules add file if it exists
240
	if(file_exists(WB_PATH.'/modules/'.$module.'/add.php'))
241
    {
242
		require(WB_PATH.'/modules/'.$module.'/add.php');
243
	}
234 244
}
235 245

  
236 246
// Check if there is a db error, otherwise say successful
237 247
if($database->is_error()) {
238
	$admin->print_error($database->get_error());
248
	$admin->print_error($database->get_error().' (sections)');
239 249
} else {
240 250
	$admin->print_success($MESSAGE['PAGES_ADDED'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
241 251
}
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1753');
54
if(!defined('REVISION')) define('REVISION', '1754');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/framework/functions.php
478 478
	global $database;
479 479
	// Get page details
480 480
	$sql = 'SELECT `parent`, `level` FROM `'.TABLE_PREFIX.'pages` WHERE `page_id` = '.$page_id;
481

  
481 482
	$query_page = $database->query($sql);
482 483
	$fetch_page = $query_page->fetchRow();
483 484
	$parent = $fetch_page['parent'];
484 485
	$level = $fetch_page['level'];
485 486
	if($level == 1) {
486 487
		return $parent;
487
	}elseif($parent == 0) {
488
	} elseif($parent == 0) {
488 489
		return $page_id;
489
	}else {	// Figure out what the root parents id is
490
	} else {	// Figure out what the root parents id is
490 491
		$parent_ids = array_reverse(get_parent_ids($page_id));
491 492
		return $parent_ids[0];
492 493
	}
branches/2.8.x/wb/modules/wysiwyg/upgrade.php
21 21
	throw new IllegalFileException();
22 22
}
23 23
/* -------------------------------------------------------- */
24

  
25 24
$msg = '';
26 25
$sTable = TABLE_PREFIX.'mod_wysiwyg';
27 26
if(($sOldType = $database->getTableEngine($sTable))) {
......
33 32
} else {
34 33
	$msg .= $database->get_error().'<br />';
35 34
}
35

  
36
$sql = 'ALTER TABLE `'.DB_NAME.'`.`'.$sTable.'` DROP PRIMARY KEY';
37
if(!$database->query($sql)) {
38
	$msg .= $database->get_error().'<br />';
39
}
40

  
41
$sql = 'ALTER TABLE `'.$sTable.'`  ADD `wysiwyg_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST';
42
if(!$database->query($sql)) {
43
	$msg .= $database->get_error().'<br />';
44
}
45

  
36 46
// change internal absolute links into relative links
37 47
$sTable = TABLE_PREFIX.'mod_wysiwyg';
38 48
$sql  = 'UPDATE `'.$sTable.'` ';
branches/2.8.x/wb/modules/wysiwyg/add.php
4 4
 * @category        modules
5 5
 * @package         wysiwyg
6 6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8 8
 * @link			http://www.websitebaker2.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10 10
 * @platform        WebsiteBaker 2.8.x
......
22 22
		die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
23 23
}
24 24
/* -------------------------------------------------------- */
25

  
25 26
// Insert an extra row into the database
26 27
$database->query("INSERT INTO ".TABLE_PREFIX."mod_wysiwyg (page_id,section_id) VALUES ('$page_id','$section_id')");
27

  

Also available in: Unified diff