Project

General

Profile

« Previous | Next » 

Revision 1291

Added by Dietmar almost 15 years ago

recoded function extract_permission in /framework/functions.php
change URL_HELP to http://www.websitebaker2.org/ in /framework/class.admin.php
recoded function preprocess in /framework/class.frontend.php
optimize function getVersion in /framework/addon.precheck.inc.php

View differences:

class.frontend.php
21 21
	exit(0);
22 22
}
23 23

  
24

  
25 24
require_once(WB_PATH.'/framework/class.wb.php');
26 25

  
27 26
class frontend extends wb {
......
221 220
		}
222 221
	}
223 222

  
224
	function get_website_settings() {
223
	function get_website_settings()
224
    {
225 225
		global $database;
226 226

  
227 227
		// set visibility SQL code
......
264 264
			define('SIGNUP_URL', WB_URL.'/account/signup.php');
265 265
		}
266 266
	}
267
	
267

  
268
/*
269
 * replace all "[wblink{page_id}]" with real links
270
 * @param string &$content : reference to global $content
271
 * @return void
272
 * @history 100216 17:00:00 optimise errorhandling, speed, SQL-strict
273
 */
274
	function preprocess(&$content)
275
	{
276
		global $database;
277
		$replace_list = array();
278
		$pattern = '/\[wblink([0-9]+)\]/isU';
279
		if(preg_match_all($pattern,$content,$ids))
280
		{
281
			foreach($ids[1] as $key => $page_id)
282
			{
283
				$replace_list[$page_id] = $ids[0][$key];
284
			}
285
			foreach($replace_list as $page_id => $tag)
286
			{
287
				$sql = 'SELECT `link` FROM `'.TABLE_PREFIX.'pages` WHERE `page_id` = '.(int)$page_id;
288
				$link = $database->get_one($sql);
289
				if(!is_null($link))
290
				{
291
					$link = $this->page_link($link);
292
					$content = str_replace($tag, $link, $content);
293
				}
294
			}
295
		}
296
	}
297

  
298
/*
268 299
	function preprocess(&$content) {
269 300
		global $database;
270 301
		// Replace [wblink--PAGE_ID--] with real link
......
279 310
			$content = preg_replace($pattern,$link,$content);
280 311
		}
281 312
	}
282
	
313
*/
283 314
	function menu() {
284 315
		global $wb;
285 316
	   if (!isset($wb->menu_number)) {

Also available in: Unified diff