Project

General

Profile

« Previous | Next » 

Revision 1914

Added by Dietmar over 11 years ago

! /admin/pages/ add/change to new Translate class
add a default.ini with a list of protected basenames,
and a PagesEnvironment to force writing the accessfile forever

View differences:

branches/2.8.x/CHANGELOG
12 12
===============================================================================
13 13

  
14 14

  
15
07 Jun-2013 Build 1914 Dietmar Woellbrink (Luisehahne)
16
! /admin/pages/  add/change to new Translate class
17
  add a default.ini with a list of protected basenames, 
18
  and a PagesEnvironment to force writing the accessfile forever
15 19
07 Jun-2013 Build 1913 Dietmar Woellbrink (Luisehahne)
16 20
! /admin/addons/  change to new Translate class
17 21
07 Jun-2013 Build 1912 Dietmar Woellbrink (Luisehahne)
branches/2.8.x/wb/admin/skel/themes/htt/settings.htt
114 114

  
115 115
<!-- BEGIN show_checkbox_2_block -->
116 116
		<div class="mbox sub-row">
117
		<label class="setting_name">{TEXT_MANAGE_SECTIONS}:</label>
117
		<label class="setting_name">{HEADING_MANAGE_SECTIONS}:</label>
118 118
			<span>
119 119
			<input class="radio"  type="radio" name="manage_sections" id="manage_sections_true" value="true"{MANAGE_SECTIONS_ENABLED} />
120 120
		<label for="manage_sections_true">{TEXT_ENABLED}</label>
branches/2.8.x/wb/admin/skel/themes/htt/pages_settings.htt
60 60
                <span class="overlib" {p_menu_filename} ><img src="{THEME_URL}/icons/help_16.png" alt="TEXT_SEO_TITLE" /></span>
61 61
				<input type="text" id="seo_title" name="seo_title" value="{SEO_TITLE}" />
62 62
			</div>
63
			<div class="{PAGE_EXTENDET_HIDE}">
63
			<div id="extented0" style="{PAGE_EXTENDET_HIDE}">
64 64
				<label for="menu_icon_0">{TEXT_MENU_ICON_0}:</label>
65 65
                <span class="overlib" {p_menu_icon0_dir} ><img src="{THEME_URL}/icons/help_16.png" alt="TEXT_MENU_ICON_0" /></span>
66 66
					<select id="menu_icon_0" name="menu_icon_0">
......
70 70
				<!-- END menu_icon0_list_block -->
71 71
				</select>
72 72
			</div>
73
			<div class="{PAGE_EXTENDET_HIDE}">
73
			<div id="extented1" style="{PAGE_EXTENDET_HIDE}">
74 74
				<label for="menu_icon_1" >{TEXT_MENU_ICON_1}:</label>
75 75
                <span class="overlib" {p_menu_icon1_dir} ><img src="{THEME_URL}/icons/help_16.png" alt="TEXT_MENU_ICON_1" /></span>
76 76
					<select id="menu_icon_1" name="menu_icon_1">
......
244 244
			<input type="submit" name="submit" value="{TEXT_SAVE}" />
245 245
			<input type="submit" name="back_submit" value="{TEXT_SAVE_BACK}" />
246 246
			<span style="padding-left: 2em;"><input type="reset" name="reset" value="{TEXT_RESET}" />
247
			<input type="submit" name="extendet_submit" value="{TEXT_EXTENDED}" /></span>
247
			<input type="submit" value="{TEXT_EXTENDED}" id="{VISIBILITY}_extended" name="extendet_submit" /></span>
248 248
		</div>
249 249
	</div>
250 250
</form>
branches/2.8.x/wb/admin/pages/settings.php
4 4
 * @category        admin
5 5
 * @package         pages
6 6
 * @author          Ryan Djurovich, WebsiteBaker Project
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker2.org/
7
 * @copyright       2009-2013, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10 10
 * @platform        WebsiteBaker 2.8.x
11 11
 * @requirements    PHP 5.2.2 and higher
......
86 86
		}
87 87
	} // end of function parent_list
88 88
/* -------------------------------------------------------------------------------------*/
89
	$mLang = ModLanguage::getInstance();
90
	$mLang->setLanguage(dirname(__FILE__).'/languages/', LANGUAGE, DEFAULT_LANGUAGE);
89
//	$mLang = ModLanguage::getInstance();
90
//	$mLang->setLanguage(dirname(__FILE__).'/languages/', LANGUAGE, DEFAULT_LANGUAGE);
91
	$mLang = Translate::getinstance();
92
	$mLang->enableAddon('admin\pages');
91 93
	$sDisabled = ' disabled="disabled"';
92 94
	$sSelected = ' selected="selected"';
93 95
	$sChecked  = ' checked="checked"';
......
103 105
	if( ($oPages = $database->query($sql)) ) {
104 106
		$aCurrentPage = $oPages->fetchRow(MYSQL_ASSOC);
105 107
		// Work-out if we should set seo_title
106
        $aCurrentPage['seo_title'] = basename($aCurrentPage['link']);
108
		$aCurrentPage['seo_title'] = basename($aCurrentPage['link']);
107 109
		// Work-out if we should check for existing page_code
108 110
		$field_set = isset($aCurrentPage['page_code']);
109 111
		if( !$admin->ami_group_member($aCurrentPage['admin_groups']) &&
......
136 138
	$oTpl->set_file('page', 'pages_settings.htt');
137 139
	$oTpl->set_block('page', 'main_block', 'main');
138 140
	$oTpl->set_var('FTAN', $admin->getFTAN());
139
//    $sShowIconDirText = $TEXT['EXPAND'].' ';
141
//    $sShowIconDirText = $mLang->TEXT_EXPAND'].' ';
140 142
	$sql = 'SELECT `value` FROM `'.TABLE_PREFIX.'settings` WHERE `name` = \'page_extendet\'';
141 143
//	if($page_extend = $database->get_one($sql)) {}
142 144
	$page_extend = (defined('PAGE_EXTENDET') ? filter_var(PAGE_EXTENDET, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) : false);
143
	$sShowIconDirText = ($page_extend==true) ? $TEXT['HIDE_ADVANCED'] : $TEXT['SHOW_ADVANCED'];
145
	$sShowIconDirText = ($page_extend==true) ? $mLang->TEXT_HIDE_ADVANCED : $mLang->TEXT_SHOW_ADVANCED;
144 146

  
145 147
	$oTpl->set_var(array(
146 148
			'PAGE_ID'              => $aCurrentPage['page_id'],
......
154 156
			'MODIFIED_BY'          => $user['display_name'],
155 157
			'MODIFIED_BY_USERNAME' => $user['username'],
156 158
			'MODIFIED_WHEN'        => $modified_ts,
157
			'TEXT_SAVE_BACK'       => $TEXT['SAVE'].' &amp; '.$TEXT['BACK'],
159
			'TEXT_SAVE_BACK'       => $mLang->TEXT_SAVE.' &amp; '.$mLang->TEXT_BACK,
158 160
			'TEXT_EXTENDED'        => $sShowIconDirText,
161
			'VISIBILITY'           => 'visibility',
159 162
			'ADMIN_URL'            => ADMIN_URL,
160 163
			'WB_URL'               => WB_URL,
161 164
			'THEME_URL'            => THEME_URL
......
207 210
	$sTemplate = ($aCurrentPage['template'] == '' ? DEFAULT_TEMPLATE : $aCurrentPage['template']);
208 211
	$sIconDir = str_replace('\\', '/', ((defined('PAGE_ICON_DIR') && PAGE_ICON_DIR != '') ? PAGE_ICON_DIR : MEDIA_DIRECTORY));
209 212
	$sIconDir = str_replace('/*', '/'.$sTemplate, $sIconDir);
210
	$bIconDirHide = ($page_extend==true) ? '' : 'hide';
213
	$bIconDirHide = ($page_extend==true) ? 'display:block;' : 'display:none;';
214

  
211 215
//	$oTpl->set_var('ICON_DIR', WB_REL.$sIconDir);
212 216
	$sHelp = replaceVars($mLang->HELP_PAGE_IMAGE_DIR, array('icon_dir'=>WB_REL.$sIconDir ) );
213 217

  
......
551 555
		}
552 556
		$aMenu = getTemplateInfo($aCurrentPage['template']);
553 557
		// set menu[1] as default if there's no entry in info.php
554
		$aMenu[1] = (!isset($aMenu[1]) OR ($aMenu[1] == '')) ? $TEXT['MAIN'] : $aMenu[1];
558
		$aMenu[1] = (!isset($aMenu[1]) OR ($aMenu[1] == '')) ? $mLang->TEXT_MAIN : $aMenu[1];
555 559
		$oTpl->set_block('show_menu_list_block', 'menu_list_block', 'menu_list');
556 560
		foreach($aMenu as $iIndex => $sMenuName) {
557 561
			$aVars = array();
branches/2.8.x/wb/admin/pages/default.ini
1
;<?php exit(); ?>
2
;###############################################################################
3
;###                                                                         ###
4
;###     configurable settings for admin/pages                               ###
5
;###                                                                         ###
6
;###############################################################################
7
;
8
[PagesEnvironment]
9
AccessFileOverwrite = true
10
;
11
[ProtectedNames]
12
List[]  = account
13
List[]  = framework
14
List[]  = include
15
List[]  = install
16
List[]  = languages
17
List[]  = modules
18
List[]  = search
19
List[]  = temp
20
List[]  = templates
21
List[]  = index
22
List[]  = config
23
List[]  = upgrade-script
24
List[]  = intro
25
;
branches/2.8.x/wb/admin/pages/settings_save.php
4 4
 * @category        admin
5 5
 * @package         pages
6 6
 * @author          Ryan Djurovich, WebsiteBaker Project
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker2.org/
7
 * @copyright       2009-2013, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
10
 * @platform        WebsiteBaker 2.8.4
11 11
 * @requirements    PHP 5.2.2 and higher
12 12
 * @version         $Id$
13 13
 * @filesource      $HeadURL$
......
26 26
}
27 27
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
28 28

  
29
$lang_dir = dirname(__FILE__).'/languages/';
30
$lang = file_exists($lang_dir.LANGUAGE.'.php') ? LANGUAGE : 'EN';
29
//$lang_dir = dirname(__FILE__).'/languages/';
30
//$lang = file_exists($lang_dir.LANGUAGE.'.php') ? LANGUAGE : 'EN';
31 31
//require_once($lang_dir.$lang.'.php');
32
if( !isset($TEXT['PAGE_LANG_LOADED']) ) { require($lang_dir.$lang.'.php'); }
32
//if( !isset($mLang->TEXT_PAGE_LANG_LOADED) ) { require($lang_dir.$lang.'.php'); }
33 33

  
34 34
// suppress to print the header, so no new FTAN will be set
35 35
$admin = new admin('Pages', 'pages_settings',false);
36 36
$pagetree_url = ADMIN_URL.'/pages/index.php';
37 37

  
38
$mLang = Translate::getinstance();
39
$mLang->enableAddon('admin\pages');
40

  
38 41
// Get page id
39 42
if(!isset($_POST['page_id']) || (isset($_POST['page_id']) && preg_match('/[^0-9a-z]/i',$_POST['page_id'])) )
40 43
{
......
45 48
//	$page_id = (int)$_POST['page_id']; || preg_match('/[^0-9a-f]/i',$_POST['page_id'])
46 49
	if((!($page_id = $admin->checkIDKEY('page_id')))) {
47 50
		$admin->print_header();
48
		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $pagetree_url);
51
		$admin->print_error($mLang->MESSAGE_GENERIC_SECURITY_ACCESS, $pagetree_url);
49 52
	}
50 53
}
51 54

  
......
60 63
if (!$admin->checkFTAN())
61 64
{
62 65
	$admin->print_header();
63
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$target_url);
66
	$admin->print_error($mLang->MESSAGE_GENERIC_SECURITY_ACCESS,$target_url);
64 67
}
65 68

  
66 69
// After check print the header
......
74 77
	$sql .= '`value`=\''.($val ? 'false' : 'true').'\' ';
75 78
	$sql .= (defined('PAGE_EXTENDET') ? 'WHERE `name`=\'page_extendet\'' : '');
76 79
    if($database->query($sql)) {
77
        // redirect to backend
80
// redirect to backend
78 81
echo "<p style=\"text-align:center;\"> If the script</strong> could not be start automatically.\n" .
79 82
     "Please click <a style=\"font-weight:bold;\" " .
80 83
     "href=\"".$target_url."\">on this link</a> to start the script!</p>\n";
......
96 99
if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
97 100

  
98 101
// Get values
99
$page_title = str_replace(array("[[", "]]"), '', htmlspecialchars($admin->get_post_escaped('page_title')));
100
$menu_title = str_replace(array("[[", "]]"), '', htmlspecialchars($admin->get_post_escaped('menu_title')));
101
$seo_title = str_replace(array("[[", "]]"), '', htmlspecialchars($admin->get_post_escaped('seo_title')));
102
//$page_title = str_replace(array("[[", "]]"), '', htmlspecialchars($admin->get_post_escaped('page_title')));
103
//$menu_title = str_replace(array("[[", "]]"), '', htmlspecialchars($admin->get_post_escaped('menu_title')));
104
//$seo_title = str_replace(array("[[", "]]"), '', htmlspecialchars($admin->get_post_escaped('seo_title')));
105
//$description = str_replace(array("[[", "]]"), '', htmlspecialchars($admin->add_slashes($admin->get_post('description'))));
106
//$keywords = str_replace(array("[[", "]]"), '', htmlspecialchars($admin->add_slashes($admin->get_post('keywords'))));
107

  
108
$page_title = ($admin->StripCodeFromText($admin->get_post('page_title')));
109
$menu_title = ($admin->StripCodeFromText($admin->get_post('menu_title')));
110
$seo_title = ($admin->StripCodeFromText($admin->get_post('seo_title')));
111
$description = ($admin->StripCodeFromText($admin->get_post('description')));
112
$keywords = ($admin->StripCodeFromText($admin->get_post('keywords')));
113

  
102 114
$page_code = intval($admin->get_post('page_code')) ;
103
$description = str_replace(array("[[", "]]"), '', htmlspecialchars($admin->add_slashes($admin->get_post('description'))));
104
$keywords = str_replace(array("[[", "]]"), '', htmlspecialchars($admin->add_slashes($admin->get_post('keywords'))));
105 115
$parent = intval($admin->get_post('parent')); // fix secunia 2010-91-3
106
$visibility = $admin->get_post_escaped('visibility');
116
$visibility = $admin->StripCodeFromText($admin->get_post('visibility'));
107 117
if (!in_array($visibility, array('public', 'private', 'registered', 'hidden', 'none'))) {$visibility = 'public';} // fix secunia 2010-93-3
108 118
$template = preg_replace('/[^a-z0-9_-]/i', "", $admin->get_post('template')); // fix secunia 2010-93-3
109 119
$template = (($template == DEFAULT_TEMPLATE ) ? '' : $template);
......
129 139
}
130 140
if($menu_title == '' || substr($menu_title,0,1)=='.')
131 141
{
132
	$admin->print_error($MESSAGE['PAGES_BLANK_MENU_TITLE'],$target_url);
142
	$admin->print_error($mLang->MESSAGE_PAGES_BLANK_MENU_TITLE,$target_url);
133 143
}
134 144
if($seo_title == '' || substr($seo_title,0,1)=='.')
135 145
{
......
139 149
// Get existing perms
140 150
$sql  = 'SELECT `parent`,`link`,`position`,`admin_groups`,`admin_users`,`menu_title` ';
141 151
$sql .= 'FROM `'.TABLE_PREFIX.'pages` WHERE `page_id`='.$page_id;
142

  
143 152
$results = $database->query($sql);
144 153

  
145 154
$results_array = $results->fetchRow(MYSQL_ASSOC);
......
151 160
	if(!$admin->ami_group_member($results_array['admin_groups']) &&
152 161
	   !$admin->is_group_match($admin->get_user_id(), $results_array['admin_users']))
153 162
	{
154
		$admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']);
163
		$admin->print_error($mLang->MESSAGE_PAGES_INSUFFICIENT_PERMISSIONS);
155 164
	}
156 165
	// Setup admin groups
157 166
	$aAdminGroups = (is_array($aAdminGroups) ? $aAdminGroups : array(1));
......
201 210
	$root_parent = root_parent($parent);
202 211
} else {
203 212
// Work out level
204
    $level = level_count($page_id);
213
	$level = level_count($page_id);
205 214
// Work out root parent
206
    $root_parent = root_parent($page_id);
215
	$root_parent = root_parent($page_id);
207 216
}
217
// preparing root_check to protect system directories and important files from being overwritten if PAGES_DIR = '/'
218
	$denied = false;
219
	$forbidden  = array();
220
	$aTempIniList  = array();
221
	$aTempIniList = parse_ini_file(dirname(__FILE__).'/default.ini',true);
222
	$bAccessFileOverwrite = $aTempIniList['PagesEnvironment']['AccessFileOverwrite'];
223
	$aTempIniList['ProtectedNames']['List'][] = (defined('ADMIN_DIRECTORY') ? trim(ADMIN_DIRECTORY,'/') : 'admin');
224
	$aTempIniList['ProtectedNames']['List'][] = (defined('MEDIA_DIRECTORY') ? trim(MEDIA_DIRECTORY,'/') : 'media');
225
	$aTempIniList['ProtectedNames']['List'][] = (defined('PAGES_DIRECTORY') ? trim(PAGES_DIRECTORY,'/') : 'pages');
226
	$forbidden = $aTempIniList['ProtectedNames'];
208 227

  
209 228
$link = '/'.page_filename($seo_title);
210

  
229
if( ($parent == '0') ) {
230
	if( defined('PAGES_DIRECTORY') && trim(PAGES_DIRECTORY,'/')=='' ) {
211 231
// Work-out what the link should be
212
if($parent == '0') {
213
	if($link == '/index' || $link == '/intro')
214
	{
215
		$link .= '_' .$page_id;
216
		$filename = WB_PATH.PAGES_DIRECTORY.$link .PAGE_EXTENSION;
217
	
218
	} else {
219
	    $filename = WB_PATH.PAGES_DIRECTORY.$link.PAGE_EXTENSION;
232
		$denied = in_array(trim($link,'/'), $forbidden['List']);
233
		if( $denied )
234
		{
235
//			$link .= '_' .$page_id;
236
			$admin->print_error($mLang->MESSAGE_PAGES_CANNOT_MODIFY_PROTECTED_FILE);
237
		}
220 238
	}
239
	$filename = WB_PATH.PAGES_DIRECTORY.$link.PAGE_EXTENSION;
221 240
} else {
222 241
	$parent_section = '';
223 242
	$parent_titles = array_reverse(get_parent_titles($parent));
224 243

  
225
	foreach($parent_titles AS $parent_title)
226
    {
244
	foreach($parent_titles AS $parent_title) {
227 245
		$parent_section .= '/'.page_filename($parent_title);
228 246
	}
229 247

  
230
	if($parent_section == '/')
231
    {
232
      $parent_section = '';
233
    }
234

  
248
	if($parent_section == '/') {
249
		$parent_section = '';
250
	}
235 251
	$link = $parent_section.$link;
236 252
	$filename = WB_PATH.PAGES_DIRECTORY.$link.PAGE_EXTENSION;
237 253
}
238 254

  
255
// $database = new database();
239 256
// Check if a page with same page filename exists
240
// $database = new database();
241
$sql = 'SELECT `page_id`,`page_title` FROM `'.TABLE_PREFIX.'pages` WHERE `link` = "'.$link.'" AND `page_id` != '.$page_id;
257
$sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'pages` '
258
     . 'WHERE `link` = \''.$link.'\' '
259
     .   'AND `page_id` != '.$page_id;
260
if( ($iSamePages = intval($database->get_one($sql))) > 0 ){
261
	$admin->print_error($mLang->MESSAGE_PAGES_PAGE_EXISTS, $target_url);
262
}
242 263

  
243
$get_same_page = $database->query($sql);
264
//if($get_same_page = $database->query($sql)){
265
//	if($get_same_page->numRows() > 0)
266
//	{
267
//		$admin->print_error($mLang->MESSAGE_PAGES_PAGE_EXISTS, $target_url);
268
//	}
269
//}
244 270

  
245
if($get_same_page->numRows() > 0)
246
{
247
	$admin->print_error($MESSAGE['PAGES_PAGE_EXISTS'], $target_url);
248
}
249

  
250 271
// Update page with new order
251
$sql = 'UPDATE `'.TABLE_PREFIX.'pages` SET `parent`='.$parent.', `position`='.$position.' WHERE `page_id`='.$page_id.'';
252
// $database = new database();
253
$database->query($sql);
272
//$sql = 'UPDATE `'.TABLE_PREFIX.'pages` SET `parent`='.$parent.', `position`='.$position.' WHERE `page_id`='.$page_id.'';
273
//$database->query($sql);
254 274

  
255 275
// Get page trail
256 276
$page_trail = get_page_trail($page_id);
......
261 281
	 .     '`page_title`=\''.$page_title.'\', '
262 282
	 .     '`tooltip`=\''.$page_title.'\', '
263 283
	 .     '`page_icon` =\''.$database->escapeString($sPageIcon).'\', '
264
	 .     '`menu_title`=\''.$menu_title.'\', '
284
	 .     '`menu_title`=\''.$database->escapeString($menu_title).'\', '
265 285
	 .     '`menu_icon_0` =\''.$database->escapeString($sMenuIcon0).'\', '
266 286
	 .     '`menu_icon_1` =\''.$database->escapeString($sMenuIcon1).'\', '
267 287
	 .     '`menu`='.$menu.', '
268 288
	 .     '`level`='.$level.', '
269 289
	 .     '`page_trail`=\''.$page_trail.'\', '
270 290
	 .     '`root_parent`='.$root_parent.', '
271
	 .     '`link`=\''.$link.'\', '
291
	 .     '`link`=\''.$database->escapeString($link).'\', '
272 292
	 .     '`template`=\''.$template.'\', '
273 293
	 .     '`target`=\''.$target.'\', '
274
	 .     '`description`=\''.$description.'\', '
275
	 .     '`keywords`=\''.$keywords.'\', '
294
	 .     '`description`=\''.$database->escapeString($description).'\', '
295
	 .     '`keywords`=\''.$database->escapeString($keywords).'\', '
276 296
	 .     '`position`='.$position.', '
277 297
	 .     '`visibility`=\''.$visibility.'\', '
278 298
	 .     '`searching`='.$searching.', '
......
301 321

  
302 322
// using standard function by core,
303 323
function fix_page_trail($page_id) {
304
	global $database,$admin,$target_url,$pagetree_url,$MESSAGE;
324
	global $database,$admin,$target_url,$pagetree_url,$mLang;
305 325

  
306 326
	$target_url = (isset($_POST['back_submit'])) ? $pagetree_url : $target_url;
307 327
	
308
	// Work out level
328
// Work out level
309 329
	$level = level_count($page_id);
310
	// Work out root parent
330
// Work out root parent
311 331
	$root_parent = root_parent($page_id);
312
	// Work out page trail
332
// Work out page trail
313 333
	$page_trail = get_page_trail($page_id);
314
	// Update page with new level and link
315
	$sql  = 'UPDATE `'.TABLE_PREFIX.'pages` SET ';
316
	$sql .= '`root_parent` = '.$root_parent.', ';
317
	$sql .= '`level` = '.$level.', ';
318
	$sql .= '`page_trail` = "'.$page_trail.'" ';
319
	$sql .= 'WHERE `page_id` = '.$page_id;
320 334

  
335
// Update page with new level and link
336
	$sql  = 'UPDATE `'.TABLE_PREFIX.'pages` '
337
	      . 'SET `root_parent` = '.$root_parent.', '
338
	      .     '`level` = '.$level.', '
339
	      .     '`page_trail` = \''.$page_trail.'\' '
340
	      .'WHERE `page_id` = '.$page_id;
341

  
321 342
	if($database->query($sql)) {
322
		$admin->print_success($MESSAGE['PAGES_SAVED_SETTINGS'], $target_url );
343
		$admin->print_success($mLang->MESSAGE_PAGES_SAVED_SETTINGS, $target_url );
323 344
	} else {
324 345
		$admin->print_error($database->get_error(), $target_url );
325 346
	}
......
339 360

  
340 361
$bCanCreateAcessFiles = make_dir(WB_PATH.PAGES_DIRECTORY);
341 362
$bCanCreateAcessFiles = (($bCanCreateAcessFiles==true) ? file_exists(WB_PATH) && is_writable(WB_PATH.PAGES_DIRECTORY) : false );
363

  
342 364
if( !$bCanCreateAcessFiles )
343 365
{
344
	$admin->print_error($MESSAGE['PAGES_CANNOT_CREATE_ACCESS_FILE'], $target_url);
366
	$admin->print_error($mLang->MESSAGE_PAGES_CANNOT_CREATE_ACCESS_FILE, $target_url);
345 367
} else {
346 368
// Create a new file in the /pages dir if title changed
347

  
348 369
	$old_filename = WB_PATH.PAGES_DIRECTORY.$old_link.PAGE_EXTENSION;
370
	$sub_pages = get_subs($page_id, array());
371
//	$sub_pages = get_subs($sub_pages['0'], array());
349 372

  
350
	// First check if we need to create a new file
351
	if(($old_link != $link) || (!file_exists($old_filename)))
352
	{
353
		// Delete old file
373
// First check if we need or force to create a new file
374
	if( ($old_link != $link) || (!file_exists($filename)) || ( $bAccessFileOverwrite==true ) ) {
375
// Delete old file
354 376
		$old_filename = WB_PATH.PAGES_DIRECTORY.$old_link.PAGE_EXTENSION;
355 377
		if(file_exists($old_filename))
356 378
		{
357 379
			unlink($old_filename);
358 380
		}
359

  
360
		// Create access file
381
// Create access file
361 382
		create_access_file($filename,$page_id,$level);
362 383
		if(!file_exists($filename)) {
363
			$admin->print_error($MESSAGE['PAGES_CANNOT_CREATE_ACCESS_FILE']);
384
			$admin->print_error($mLang->MESSAGE_PAGES_CANNOT_CREATE_ACCESS_FILE);
364 385
		}
365
		// Move a directory for this page
366
		if(is_readable(WB_PATH.PAGES_DIRECTORY.$old_link.'/') && is_dir(WB_PATH.PAGES_DIRECTORY.$old_link.'/'))
386
// Move a directory for this page
387
		if(is_writeable(WB_PATH.PAGES_DIRECTORY.$old_link.'/') && !is_dir(WB_PATH.PAGES_DIRECTORY.$link.'/'))
367 388
		{
368 389
			rename(WB_PATH.PAGES_DIRECTORY.$old_link.'/', WB_PATH.PAGES_DIRECTORY.$link.'/');
369 390
		}
370
		// Update any pages that had the old link with the new one
391
// Update any pages that had the old link with the new one
371 392
		$old_link_len = strlen($old_link);
372
		$sql = '';
373
		$query_subs = $database->query("SELECT page_id,link,level FROM ".TABLE_PREFIX."pages WHERE link LIKE '%$old_link/%' ORDER BY LEVEL ASC");
374

  
375
		if($query_subs->numRows() > 0)
376
		{
377
			while($sub = $query_subs->fetchRow())
393
// $query_subs = $database->query("SELECT page_id,link,level FROM ".TABLE_PREFIX."pages WHERE link LIKE '%$old_link/%' ORDER BY LEVEL ASC");
394
		$sql = 'SELECT `page_id`,`link`,`level` FROM `'.TABLE_PREFIX.'pages` '
395
		      .'WHERE `link` LIKE \'%'.$old_link.'/%\' '
396
		      .'ORDER BY `level` ASC ';
397
		if ($oResSubs = $database->query($sql) ) {
398
			if($oResSubs->numRows() > 0)
378 399
			{
379
				// Double-check to see if it contains old link
380
				if(substr($sub['link'], 0, $old_link_len) == $old_link) {
381
					// Get new link
382
					$replace_this = $old_link;
383
					$old_sub_link_len =strlen($sub['link']);
384
					$new_sub_link = $link.'/'.substr($sub['link'],$old_link_len+1,$old_sub_link_len);
385
					// Work out level
386
					$new_sub_level = level_count($sub['page_id']);
387
					// Update level and link
388
					$database->query("UPDATE ".TABLE_PREFIX."pages SET link = '$new_sub_link', level = '$new_sub_level' WHERE page_id = '".$sub['page_id']."' LIMIT 1");
389
					// Re-write the access file for this page
390
					$old_subpage_file = WB_PATH.PAGES_DIRECTORY.$new_sub_link.PAGE_EXTENSION;
391
					if(file_exists($old_subpage_file)) {
392
						unlink($old_subpage_file);
400
				while($sub = $oResSubs->fetchRow(MYSQL_ASSOC))
401
				{
402
					// Double-check to see if it contains old link
403
					if(substr($sub['link'], 0, $old_link_len) == $old_link) {
404
						// Get new link
405
						$replace_this = $old_link;
406
						$old_sub_link_len =strlen($sub['link']);
407
						$new_sub_link = $link.'/'.substr($sub['link'],$old_link_len+1,$old_sub_link_len);
408
						// Work out level
409
						$new_sub_level = level_count($sub['page_id']);
410
						// Update level and link
411
// $database->query("UPDATE ".TABLE_PREFIX."pages SET link = '$new_sub_link', level = '$new_sub_level' WHERE page_id = '".$sub['page_id']."' LIMIT 1");
412
						$sql = 'UPDATE `'.TABLE_PREFIX.'pages` SET '
413
						      .'`link` = \''.$new_sub_link.'\', '
414
						      .'`level` = '.(int)$new_sub_level.' '
415
						      .'WHERE `page_id` = '.$sub['page_id'];
416
						if( $database->query($sql) ) {
417
							// Re-write the access file for this page
418
							$old_subpage_file = WB_PATH.PAGES_DIRECTORY.$new_sub_link.PAGE_EXTENSION;
419
							if(file_exists($old_subpage_file)) {
420
								unlink($old_subpage_file);
421
							}
422
							$sAccessFile = WB_PATH.PAGES_DIRECTORY.$new_sub_link.PAGE_EXTENSION;
423
							create_access_file($sAccessFile, $sub['page_id'], $new_sub_level);
424
							if(!file_exists($sAccessFile)) {
425
								$admin->print_error($mLang->MESSAGE_PAGES_CANNOT_CREATE_ACCESS_FILE);
426
							} else {
427
							}
428
						}
393 429
					}
394
					$sAccessFile = WB_PATH.PAGES_DIRECTORY.$new_sub_link.PAGE_EXTENSION;
395
					create_access_file($sAccessFile, $sub['page_id'], $new_sub_level);
396
					if(!file_exists($sAccessFile)) {
397
						$admin->print_error($MESSAGE['PAGES_CANNOT_CREATE_ACCESS_FILE']);
398
					}
399

  
400 430
				}
401 431
			}
402 432
		}
403 433
	}
404 434
}
435
$dir = (WB_PATH.PAGES_DIRECTORY);
436
//$aDebugMessage = rebuildFolderProtectFile($dir);
437
//print '<pre style="text-align: left;"><strong>function '.__FUNCTION__.'( '.''.' );</strong>  basename: '.basename(__FILE__).'  line: '.__LINE__.' -> <br />';
438
//print_r( $aDebugMessage ); print '</pre>';
405 439

  
406 440
$admin->print_footer();
branches/2.8.x/wb/admin/pages/languages/EN.php
61 61

  
62 62
$MESSAGE['PAGES_LAST_MODIFIED'] = 'Last modification by';
63 63
$MESSAGE['PAGES_BLANK_SEO_TITLE'] = 'Please enter a Filename';
64
$MESSAGE['PAGES_CANNOT_CREATE_PROTECTED_FILE'] = 'Protected File, Page cannot be add!';
65
$MESSAGE['PAGES_CANNOT_MODIFY_PROTECTED_FILE'] = 'Geschützter Name, Page cannot be modified!';
64 66

  
65 67

  
66 68
$HELP['PAGE_IMAGE_DIR']  = '<p>The topical side picture path is<br /> <b>{{icon_dir}}</b>.</p>';
......
70 72

  
71 73
$HELP['PAGE_CODE']  = '<p>If you see this field, you have registered the module for the multilingual facility.</p>';
72 74
$HELP['PAGE_CODE'] .= '<p>The first step is to be provided a side tree like in the help described</p>';
73
$HELP['PAGE_CODE'] .= '<p><a href=\\\'http:\/\/www.websitebaker2.org/en/help/designer-guide/multilingual-websites.php\\\' target=\\\'_blank\\\'>Multilingual Websites</a></p>';
75
$HELP['PAGE_CODE'] .= '<p><a href=\\\'http:\/\/www.websitebaker.org/en/help/designer-guide/multilingual-websites.php\\\' target=\\\'_blank\\\'>Multilingual Websites</a></p>';
74 76
$HELP['PAGE_CODE'] .= '<p>The side linguistic tree is provided from the provided sides of the standard language (<i>Options</i>).</p>';
75 77
$HELP['PAGE_CODE'] .= '<p>They can update any time the side linguistic tree by click on the title! The assigned sides remain unchanged.</p>';
76 78
$HELP['PAGE_CODE'] .= '<p>If you have put a side into another language, confirm from this list the matching entry of the standard language</p>';
branches/2.8.x/wb/admin/pages/languages/DE.php
60 60
$TEXT['MENU_ICON_1_DIR']      = 'Verzeichnis Menübild hover';
61 61
$MESSAGE['PAGES_LAST_MODIFIED'] = 'Letze Änderung durch';
62 62
$MESSAGE['PAGES_BLANK_SEO_TITLE'] = 'Bitte geben Sie einen Dateinamen ein';
63
$MESSAGE['PAGES_ADDED'] = 'Seite wurde erfolgreich hinzugefügt';
64
$MESSAGE['PAGES_SAVED_SETTINGS'] = 'Seite wurde erfolgreich geändert!';
65
$MESSAGE['PAGES_CANNOT_CREATE_PROTECTED_FILE'] = 'Geschützter Name, Seite kann nicht hinzugefügt werden!';
66
$MESSAGE['PAGES_CANNOT_MODIFY_PROTECTED_FILE'] = 'Geschützter Name, Seite kann nicht geändert werden!';
63 67

  
64 68
$HELP['PAGE_IMAGE_DIR']  = '<p>Der aktuelle Seitenbildpfad ist<br /> <b>{{icon_dir}}</b>.</p>';
65 69
$HELP['PAGE_IMAGE_DIR'] .='<p>Als Systemadministrator können Sie das Verzeichnis für Seiten-/Menuebilder unter <i>Optionen</i> <i>Erweiterte Optionen</i> in <i>Servereinstellung</i> ändern.</p>';
......
68 72

  
69 73
$HELP['PAGE_CODE']  = '<p>Wenn Sie dieses Feld sehen, haben Sie das Modul für die Mehrsprachigkeit registriert.</p>';
70 74
$HELP['PAGE_CODE'] .= '<p>Der erste Schritt ist einen Seitenbaum, wie in der WebsiteBaker Hilfe beschrieben, zu erstellen</p>';
71
$HELP['PAGE_CODE'] .= '<p>Link: <a href=\\\'http:\/\/www.websitebaker2.org/de/hilfe/designerhandbuch/mehrsprachige-webseiten.php\\\' target=\\\'_blank\\\'>Mehrsprachige Webseiten</a></p>';
75
$HELP['PAGE_CODE'] .= '<p>Link: <a href=\\\'http:\/\/www.websitebaker.org/de/hilfe/designerhandbuch/mehrsprachige-webseiten.php\\\' target=\\\'_blank\\\'>Mehrsprachige Webseiten</a></p>';
72 76
$HELP['PAGE_CODE'] .= '<p>Der Seitensprachbaum wird aus den erstellten Seiten der Standardsprache (Standardeinstellungen in <i>Optionen</i>) erstellt.</p>';
73 77
$HELP['PAGE_CODE'] .= '<p>Sie können jederzeit den Standard Seitensprachbaum durch Klick auf den Titeltext aktualisieren! Die zugewiesenen Seiten bleiben unverändert.</p>';
74 78
$HELP['PAGE_CODE'] .= '<p>Wenn sie eine Seite in einer anderen Sprache angelegt haben, bestätigen Sie aus dieser Liste den dazugehörigen Eintrag der Standardsprache.</p>';
branches/2.8.x/wb/admin/pages/modify.php
4 4
 * @category        admin
5 5
 * @package         pages
6 6
 * @author          Ryan Djurovich, WebsiteBaker Project
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
7
 * @copyright       2009-2013, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
10
 * @platform        WebsiteBaker 2.8.4
11 11
 * @requirements    PHP 5.2.2 and higher and higher
12 12
 * @version         $Id$
13
 * @filesource		$HeadURL$
13
 * @filesource      $HeadURL$
14 14
 * @lastmodified    $Date$
15 15
 *
16 16
 */
......
205 205
$query_sections = $database->query($sql);
206 206
if($query_sections->numRows() > 0)
207 207
{
208
	while($section = $query_sections->fetchRow())
208
	while($section = $query_sections->fetchRow(MYSQL_ASSOC))
209 209
    {
210 210
		$section_id = $section['section_id'];
211 211
		$module = $section['module'];
......
225 225
							$block_name = '#' . (int) $section['block'];
226 226
						}
227 227
					}
228
					$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? 'id="'.SEC_ANCHOR.$section['section_id'].'"' : 'section_'.$section_id);
229
					print '<div class="section-info" '.$sec_anchor.' ><b>' . $TEXT['BLOCK'] . ': </b>' . $block_name;
228
					$sSectionIdPrefix = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? SEC_ANCHOR : 'Sec');
229
					print '<div class="section-info" id="'.$sSectionIdPrefix.$section['section_id'].'" ><b>' . $TEXT['BLOCK'] . ': </b>' . $block_name;
230 230
					print '<b>  Modul: </b>' . $section['module']." ";
231 231
					print '<b>  ID: </b>' . $section_id."</div>\n";
232 232
//				}
branches/2.8.x/wb/admin/pages/sections.php
4 4
 * @category        admin
5 5
 * @package         pages
6 6
 * @author          Ryan Djurovich, WebsiteBaker Project
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker2.org/
7
 * @copyright       2009-2013, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10 10
 * @platform        WebsiteBaker 2.8.x
11 11
 * @requirements    PHP 5.2.2 and higher
......
40 40

  
41 41
// Include the WB functions file
42 42
if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
43
$mLang = Translate::getinstance();
44
$mLang->enableAddon('admin\pages');
43 45

  
44 46
$action = 'show';
45 47
// Get page id
......
89 91
				require_once(WB_PATH.'/framework/class.order.php');
90 92
				$order = new order(TABLE_PREFIX.'sections', 'position', 'section_id', 'page_id');
91 93
				$order->clean($page_id);
92
				$format = $TEXT['SECTION'].' %d  %s %s '.strtolower( $TEXT['DELETED']);
93
				$message = sprintf ($format,$section_id,strtoupper($modulname),strtolower($TEXT['SUCCESS']));
94
				$format = $mLang->TEXT_SECTION.' %d  %s %s '.strtolower( $mLang->TEXT_DELETED);
95
				$message = sprintf ($format,$section_id,strtoupper($modulname),strtolower($mLang->TEXT_SUCCESS));
94 96
				if($admin_header) { $admin->print_header(); }
95 97
				$admin_header = false;
96 98
				unset($_POST);
......
98 100
			}
99 101
        } else {
100 102
			if($admin_header) { $admin->print_header(); }
101
			$admin->print_error($module.' '.strtolower($TEXT['NOT_FOUND']),$backlink);
103
			$admin->print_error($module.' '.strtolower($mLang->TEXT_NOT_FOUND),$backlink);
102 104
        }
103 105

  
104 106
		break;
......
221 223
		}
222 224
		foreach($block as $iIndex=>$sBlockTitle) {
223 225
			if(trim($sBlockTitle) == '' ) {
224
			 $block[$iIndex] = $TEXT['BLOCK'].'_'.$iIndex;
226
			 $block[$iIndex] = $mLang->TEXT_BLOCK.'_'.$iIndex;
225 227
			}
226 228
		}
227 229
	}else {
228 230
		// Make our own menu list
229
		$block = array(1, $TEXT['MAIN']);
231
		$block = array(1, $mLang->TEXT_MAIN);
230 232
	}
231 233
		/*-- load css files with jquery --*/
232 234
		// include jscalendar-setup
......
250 252
						'PAGE_ID' => $results_array['page_id'],
251 253
						// 'PAGE_IDKEY' => $admin->getIDKEY($results_array['page_id']),
252 254
						'PAGE_IDKEY' => $results_array['page_id'],
253
						'TEXT_PAGE' => $TEXT['PAGE'],
255
						'TEXT_PAGE' => $mLang->TEXT_PAGE,
254 256
						'PAGE_TITLE' => ($results_array['page_title']),
255 257
						'MENU_TITLE' => ($results_array['menu_title']),
256
						'TEXT_CURRENT_PAGE' => $TEXT['CURRENT_PAGE'],
257
						'TEXT_LAST_MODIFIED' => $TEXT['LAST_UPDATED_BY'],
258
						'TEXT_CURRENT_PAGE' => $mLang->TEXT_CURRENT_PAGE,
259
						'TEXT_LAST_MODIFIED' => $mLang->TEXT_LAST_UPDATED_BY,
258 260
						'HEADING_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
259 261
						'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE'],
260
						'TEXT_CHANGE_SETTINGS' => $TEXT['CHANGE_SETTINGS'],
261
						'TEXT_ADD_SECTION' => $TEXT['ADD_SECTION'],
262
						'TEXT_SECTION' => $TEXT['SECTION'],
262
						'TEXT_CHANGE_SETTINGS' => $mLang->TEXT_CHANGE_SETTINGS,
263
						'TEXT_ADD_SECTION' => $mLang->TEXT_ADD_SECTION,
264
						'TEXT_SECTION' => $mLang->TEXT_SECTION,
263 265
						'TEXT_ID' => 'ID',
264
						'TEXT_TYPE' => $TEXT['TYPE'],
265
						'TEXT_BLOCK' => $TEXT['BLOCK'],
266
						'TEXT_TYPE' => $mLang->TEXT_TYPE,
267
						'TEXT_BLOCK' => $mLang->TEXT_BLOCK,
266 268
						'TEXT_PUBL_START_DATE' => $TEXT{'PUBL_START_DATE'},
267
						'TEXT_PUBL_END_DATE' => $TEXT['PUBL_END_DATE'],
268
						'TEXT_ACTIONS' => $TEXT['ACTIONS'],
269
						'TEXT_PUBL_END_DATE' => $mLang->TEXT_PUBL_END_DATE,
270
						'TEXT_ACTIONS' => $mLang->TEXT_ACTIONS,
269 271
						'MODIFIED_BY'          => $user['display_name'],
270 272
						'MODIFIED_BY_USERNAME' => $user['username'],
271 273
						'MODIFIED_WHEN'        => $modified_ts,
......
330 332
		if($query_sections->numRows() > 0)
331 333
		{
332 334
			$num_sections = $query_sections->numRows();
333
			while($section = $query_sections->fetchRow())
335
			while($section = $query_sections->fetchRow(MYSQL_ASSOC))
334 336
		    {
335 337
				if(!is_numeric(array_search($section['module'], $module_permissions)))
336 338
		        {
......
344 346
					{
345 347
						$edit_page = '';
346 348
					}
347
					$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? SEC_ANCHOR : 'section_');
349
					$sSectionIdPrefix = ( defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? SEC_ANCHOR : 'Sec');
348 350
					$edit_page_0 = '<a id="sid'.$section['section_id'].'" href="'.ADMIN_URL.'/pages/modify.php?page_id='.$results_array['page_id'];
349
					$edit_page_1  = ($sec_anchor!='') ? '#'.$sec_anchor.$section['section_id'].'">' : '">';
351
					$edit_page_1  = ($sSectionIdPrefix!='') ? '#'.$sSectionIdPrefix.$section['section_id'].'">' : '">';
350 352
					$edit_page_1 .= $section['module'].'</a>';
351 353
					if(SECTION_BLOCKS)
352 354
		            {
......
421 423
		            {
422 424
						$tpl->set_var('VALUE_PUBL_START', '');
423 425
					} else {
424
						$tpl->set_var('VALUE_PUBL_START', date($jscal_format, $section['publ_start']));
426
						$tpl->set_var('VALUE_PUBL_START', date($jscal_format, $section['publ_start']+TIMEZONE));
425 427
					}
426 428
					// set calendar start values
427 429
					if($section['publ_end']==0)
428 430
		            {
429 431
						$tpl->set_var('VALUE_PUBL_END', '');
430 432
					} else {
431
						$tpl->set_var('VALUE_PUBL_END', date($jscal_format, $section['publ_end']));
433
						$tpl->set_var('VALUE_PUBL_END', date($jscal_format, $section['publ_end']+TIMEZONE));
432 434
					}
433 435
					// Insert icons up and down
434 436
					if($section['position'] != 1 )
......
545 547
		$sql  = 'SELECT `section_id` FROM `'.TABLE_PREFIX.'sections` ';
546 548
		$sql .= 'WHERE `page_id` = '.$page_id.' AND `module` = "menu_link"';
547 549
		$query_sections = $database->query($sql);
548
		$tpl->set_var('TEXT_PLEASE_SELECT', $TEXT['NONE']);
550
		$tpl->set_var('TEXT_PLEASE_SELECT', $mLang->TEXT_NONE);
549 551
		if($query_sections->numRows() == 0)
550 552
		{
551
			$tpl->set_var('TEXT_PLEASE_SELECT', $TEXT['PLEASE_SELECT']);
553
			$tpl->set_var('TEXT_PLEASE_SELECT', $mLang->TEXT_PLEASE_SELECT);
552 554
			// Modules list
553 555
		    $sql  = 'SELECT `name`,`directory`,`type` FROM `'.TABLE_PREFIX.'addons` ';
554 556
		    $sql .= 'WHERE `type` = "module" AND `function` = "page" AND `directory` != "menu_link" ';
......
581 583
		// Insert language text and messages
582 584
		$tpl->set_var(array(
583 585
							'TEXT_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
584
							'TEXT_ARE_YOU_SURE' => $TEXT['ARE_YOU_SURE'],
585
							'TEXT_TYPE' => $TEXT['TYPE'],
586
							'TEXT_ADD' => $TEXT['ADD'],
587
							'TEXT_SAVE' =>  $TEXT['SAVE'],
586
							'TEXT_ARE_YOU_SURE' => $mLang->TEXT_ARE_YOU_SURE,
587
							'TEXT_TYPE' => $mLang->TEXT_TYPE,
588
							'TEXT_ADD' => $mLang->TEXT_ADD,
589
							'TEXT_SAVE' =>  $mLang->TEXT_SAVE,
588 590
							'TEXTLINK_MODIFY_PAGE' => $HEADING['MODIFY_PAGE'],
589
							'TEXT_CALENDAR' => $TEXT['CALENDAR'],
590
							'TEXT_DELETE_DATE' => $TEXT['DELETE_DATE'],
591
							'TEXT_ADD_SECTION' => $TEXT['ADD_SECTION'],
592
							'TEXT_MOVE_UP' => $TEXT['MOVE_UP'],
593
							'TEXT_MOVE_DOWN' => $TEXT['MOVE_DOWN']
591
							'TEXT_CALENDAR' => $mLang->TEXT_CALENDAR,
592
							'TEXT_DELETE_DATE' => $mLang->TEXT_DELETE_DATE,
593
							'TEXT_ADD_SECTION' => $mLang->TEXT_ADD_SECTION,
594
							'TEXT_MOVE_UP' => $mLang->TEXT_MOVE_UP,
595
							'TEXT_MOVE_DOWN' => $mLang->TEXT_MOVE_DOWN
594 596
							)
595 597
						);
596 598
		$tpl->parse('main', 'main_block', false);
branches/2.8.x/wb/admin/pages/add.php
4 4
 * @category        admin
5 5
 * @package         pages
6 6
 * @author          Ryan Djurovich, WebsiteBaker Project
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
7
 * @copyright       2009-2013, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10 10
 * @platform        WebsiteBaker 2.8.x
11 11
 * @requirements    PHP 5.2.2 and higher
12 12
 * @version         $Id$
13
 * @filesource		$HeadURL$
13
 * @filesource      $HeadURL$
14 14
 * @lastmodified    $Date$
15 15
 *
16 16
 */
17 17

  
18
// Create new admin object and print admin header
19
//require('../../config.php');
20
//require_once(WB_PATH.'/framework/class.admin.php');
21
// Create new admin object and print admin header
22 18
if(!defined('WB_URL'))
23 19
{
24 20
    $config_file = realpath('../../config.php');
......
27 23
    	require($config_file);
28 24
    }
29 25
}
26
// Create new admin object and print admin header
30 27
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
28
$mLang = Translate::getinstance();
29
$mLang->enableAddon('admin\pages');
30

  
31 31
// suppress to print the header, so no new FTAN will be set
32 32
$admin = new admin('Pages', 'pages_add', false);
33 33
if (!$admin->checkFTAN())
34 34
{
35 35
	$admin->print_header();
36
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
36
	$admin->print_error($mLang->MESSAGE_GENERIC_SECURITY_ACCESS);
37 37
}
38 38

  
39 39
// Include the WB functions file
40 40
require_once(WB_PATH.'/framework/functions.php');
41 41

  
42 42
// Get values
43
//$title = $admin->get_post_escaped('title');
44
//$title = htmlspecialchars($title);
45
$title = str_replace(array("[[", "]]"), '', htmlspecialchars($admin->get_post_escaped('title')));
43
//$title = str_replace(array("[[", "]]"), '', htmlspecialchars($admin->get_post_escaped('title')));
44
$title = ($admin->StripCodeFromText($admin->get_post('title')));
46 45
$module = preg_replace('/[^a-z0-9_-]/i', "", $admin->get_post('type')); // fix secunia 2010-93-4
47 46
$parent = intval($admin->get_post('parent')); // fix secunia 2010-91-2
48 47
$visibility = $admin->get_post('visibility');
......
63 62
if ($parent!=0) {
64 63
	if (!$admin->get_page_permission($parent,'admin'))
65 64
    {
66
        $admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']);
65
        $admin->print_error($mLang->MESSAGE_PAGES_INSUFFICIENT_PERMISSIONS);
67 66
    }
68 67

  
69 68
} elseif (!$admin->get_permission('pages_add_l0','system'))
70 69
{
71
	$admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']);
70
	$admin->print_error($mLang->MESSAGE_PAGES_INSUFFICIENT_PERMISSIONS);
72 71
}
73 72

  
74 73
// check module permissions:
75 74
if (!$admin->get_permission($module, 'module'))
76 75
{
77
	$admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']);
76
	$admin->print_error($mLang->MESSAGE_PAGES_INSUFFICIENT_PERMISSIONS);
78 77
}
79 78

  
80 79
// Validate data
81 80
if($title == '' || substr($title,0,1)=='.')
82 81
{
83
	$admin->print_error($title.'::'.$MESSAGE['PAGES_BLANK_PAGE_TITLE']);
82
	$admin->print_error($title.'::'.$mLang->MESSAGE_PAGES_BLANK_PAGE_TITLE);
84 83
}
85 84

  
86 85
// Check to see if page created has needed permissions
......
96 95
	}
97 96
	if ($admin_perm_ok == false)
98 97
    {
99
		$admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']);
98
		$admin->print_error($mLang->MESSAGE_PAGES_INSUFFICIENT_PERMISSIONS);
100 99
	}
101 100
	$admin_perm_ok = false;
102 101
	foreach ($viewing_groups as $view_group)
......
108 107
	}
109 108
	if ($admin_perm_ok == false)
110 109
    {
111
		$admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']);
110
		$admin->print_error($mLang->MESSAGE_PAGES_INSUFFICIENT_PERMISSIONS);
112 111
	}
113 112
}
114 113

  
115 114
$admin_groups = implode(',', $admin_groups);
116 115
$viewing_groups = implode(',', $viewing_groups);
117 116

  
117
// preparing root_check to protect system directories and important files from being overwritten if PAGES_DIR = '/'
118
$denied = false;
119
$forbidden  = array();
120
$aTempIniList  = array();
121
$aTempIniList = parse_ini_file(dirname(__FILE__).'/default.ini',true);
122
$bAccessFileOverwrite = $aTempIniList['PagesEnvironment']['AccessFileOverwrite'];
123
$aTempIniList['ProtectedNames']['List'][] = (defined('ADMIN_DIRECTORY') ? trim(ADMIN_DIRECTORY,'/') : 'admin');
124
$aTempIniList['ProtectedNames']['List'][] = (defined('MEDIA_DIRECTORY') ? trim(MEDIA_DIRECTORY,'/') : 'media');
125
$aTempIniList['ProtectedNames']['List'][] = (defined('PAGES_DIRECTORY') ? trim(PAGES_DIRECTORY,'/') : 'pages');
126
$forbidden = $aTempIniList['ProtectedNames'];
127

  
128
$link = '/'.page_filename($title);
118 129
// Work-out what the link and page filename should be
119 130
if($parent == '0')
120 131
{
121
	$link = '/'.page_filename($title);
122 132
	// rename menu titles: index && intro to prevent clashes with intro page feature and WB core file /pages/index.php
123
	if($link == '/index' || $link == '/intro')
124
    {
125
		$sTmpFile = WB_PATH .PAGES_DIRECTORY .$link.PAGE_EXTENSION;
126
		$link .= (file_exists($sTmpFile)) ? '_0' : '';
127
		$filename = WB_PATH .PAGES_DIRECTORY .$link .PAGE_EXTENSION;
128
	} else {
129
		$filename = WB_PATH.PAGES_DIRECTORY.$link.PAGE_EXTENSION;
133
	if( defined('PAGES_DIRECTORY') && trim(PAGES_DIRECTORY,'/')=='' ) {
134
// Work-out what the link should be
135
		$denied = in_array(trim($link,'/'), $forbidden['List']);
136
		if( $denied )
137
		{
138
//			$link .= '_'.$iNextPageId;
139
			$admin->print_error($mLang->MESSAGE_PAGES_CANNOT_CREATE_PROTECTED_FILE);
140
		}
130 141
	}
142
	$filename = WB_PATH.PAGES_DIRECTORY.$link.PAGE_EXTENSION;
131 143

  
132 144
} else {
133 145
	$parent_section = '';
......
143 155
}
144 156

  
145 157
// Check if a page with same page filename exists
146
$get_same_page = $database->query("SELECT page_id FROM ".TABLE_PREFIX."pages WHERE link = '$link'");
147
if($get_same_page->numRows() > 0 OR file_exists(WB_PATH.PAGES_DIRECTORY.$link.PAGE_EXTENSION) OR file_exists(WB_PATH.PAGES_DIRECTORY.$link.'/'))
148
{
158
//$get_same_page = $database->query("SELECT page_id FROM ".TABLE_PREFIX."pages WHERE link = '$link'");
159
//if($get_same_page->numRows() > 0 OR file_exists(WB_PATH.PAGES_DIRECTORY.$link.PAGE_EXTENSION) OR file_exists(WB_PATH.PAGES_DIRECTORY.$link.'/'))
160
//{
161
//	$admin->print_error($MESSAGE['PAGES_PAGE_EXISTS']);
162
//}
163
$bLinkExists = file_exists(WB_PATH.PAGES_DIRECTORY.$link.PAGE_EXTENSION) || file_exists(WB_PATH.PAGES_DIRECTORY.$link);
164

  
165
// UNLOCK TABLES
166
$sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'pages` '
167
     . 'WHERE `link` = \''.$link.'\' ';
168
if( (($iSamePages = intval($database->get_one($sql))) > 0) || $bLinkExists ){
149 169
	$admin->print_error($MESSAGE['PAGES_PAGE_EXISTS']);
150 170
}
151 171

  
......
170 190
}
171 191

  
172 192
// Insert page into pages table
173
$sql  = 'INSERT INTO `'.TABLE_PREFIX.'pages` SET ';
174
$sql .= '`parent` = '.$parent.', ';
193
$sql  = 'INSERT INTO `'.TABLE_PREFIX.'pages` ';
194
$sql .= 'SET `parent` = '.$parent.', ';
175 195
$sql .= '`target` = "_top", ';
176 196
$sql .= '`page_title` = "'.$title.'", ';
177 197
$sql .= '`menu_title` = "'.$title.'", ';
......
187 207
$sql .= '`admin_groups` = "'.$admin_groups.'", ';
188 208
$sql .= '`viewing_groups` = "'.$viewing_groups.'"';
189 209

  
190
$database->query($sql);
191

  
192
if($database->is_error())
193
{
194
	$admin->print_error($database->get_error());
210
if(!$database->query($sql)) {
211
	if($database->is_error())
212
	{
213
		$admin->print_error($database->get_error());
214
	}
195 215
}
196 216

  
197 217
// Get the page id
198
$page_id = $database->get_one("SELECT LAST_INSERT_ID()");
199

  
218
//$page_id = $database->get_one("SELECT LAST_INSERT_ID()");
219
$page_id = $database->LastInsertId;
200 220
// Work out level
201 221
$level = level_count($page_id);
202 222
// Work out root parent
......
204 224
// Work out page trail
205 225
$page_trail = get_page_trail($page_id);
206 226

  
227
/*
228
$database->query("UPDATE ".TABLE_PREFIX."pages SET link = '$link', level = '$level', root_parent = '$root_parent', page_trail = '$page_trail' WHERE page_id = '$page_id'");
229
*/
207 230
// Update page with new level and link
208 231
$sql  = 'UPDATE `'.TABLE_PREFIX.'pages` SET ';
209 232
$sql .= '`root_parent` = '.$root_parent.', ';
210 233
$sql .= '`level` = '.$level.', ';
211
$sql .= '`link` = "'.$link.'", ';
212
$sql .= '`page_trail` = "'.$page_trail.'"';
213
$sql .= ((defined('PAGE_LANGUAGES') && PAGE_LANGUAGES)
214
         && $field_set
215
         && ($language == DEFAULT_LANGUAGE)
216
         && class_exists('m_MultiLingual_Lib')
217
         ? ', `page_code` = '.(int)$page_id.' ' : ' ');
234
$sql .= '`link` = \''.$link.'\', ';
235
$sql .= '`page_trail` = \''.$page_trail.'\'';
236
$sql .= ((defined('PAGE_LANGUAGES') && PAGE_LANGUAGES) && $field_set && ($language == DEFAULT_LANGUAGE)
237
                                    && class_exists('m_MultiLingual_Lib') ? ', `page_code` = '.(int)$page_id.' ' : ' ');
218 238
$sql .= 'WHERE `page_id` = '.$page_id;
219 239
$database->query($sql);
220
/*
221
$database->query("UPDATE ".TABLE_PREFIX."pages SET link = '$link', level = '$level', root_parent = '$root_parent', page_trail = '$page_trail' WHERE page_id = '$page_id'");
222
*/
223 240
if($database->is_error())
224 241
{
225 242
	$admin->print_error($database->get_error());
......
230 247

  
231 248
// Add new record into the sections table
232 249
// Insert module into DB
233
$sql  = 'INSERT INTO `'.TABLE_PREFIX.'sections` SET ';
234
$sql .= '`page_id` = '.(int)$page_id.', ';
250
$sql  = 'INSERT INTO `'.TABLE_PREFIX.'sections` ';
251
$sql .= 'SET `page_id` = '.(int)$page_id.', ';
235 252
$sql .= '`module` = \''.$module.'\', ';
236 253
$sql .= '`position` = '.(int)$position.', ';
237 254
$sql .= '`block` = \'1\', ';
......
251 268
create_access_file($filename, $page_id, $level);
252 269

  
253 270
if(!file_exists($filename)) {
254
	$admin->print_error($MESSAGE['PAGES_CANNOT_CREATE_ACCESS_FILE']);
271
	$admin->print_error($mLang->MESSAGE_PAGES_CANNOT_CREATE_ACCESS_FILE);
255 272
}
256 273

  
257 274
// Check if there is a db error, otherwise say successful
258 275
if($database->is_error()) {
259 276
	$admin->print_error($database->get_error().' (sections)');
260 277
} else {
261
	$admin->print_success($MESSAGE['PAGES_ADDED'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
278
	$admin->print_success($mLang->MESSAGE_PAGES_ADDED, ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
262 279
}
263 280

  
281
$mLang->disableAddon();
264 282
// Print admin footer
265 283
$admin->print_footer();
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', '1913');
54
if(!defined('REVISION')) define('REVISION', '1914');
55 55
if(!defined('SP')) define('SP', '');

Also available in: Unified diff