Project

General

Profile

« Previous | Next » 

Revision 1702

Added by Dietmar over 12 years ago

! /framework/class.frontend.php
! set $_SESSION['HTTP_REFERER'] to WB_URL if menu url is a registered page
! set some header("Location:.. to new method send_header(

View differences:

class.frontend.php
4 4
 * @category        framework
5 5
 * @package         frontend
6 6
 * @author          Ryan Djurovich, 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
......
40 40

  
41 41
	public $page_access_denied;
42 42
	public $page_no_active_sections;
43
	
43

  
44 44
	// website settings
45 45
	public $website_title,$website_description,$website_keywords,$website_header,$website_footer;
46 46

  
47 47
	// ugly database stuff
48 48
	public $extra_where_sql, $sql_where_language;
49
	
49

  
50 50
	public function __construct() {
51 51
		parent::__construct(SecureForm::FRONTEND);
52 52
	}
......
98 98
				// Check if we should redirect or include page inline
99 99
				if(HOMEPAGE_REDIRECTION) {
100 100
					// Redirect to page
101
					header("Location: ".$this->page_link($this->default_link));
102
					exit();
101
//					header("Location: ".$this->page_link($this->default_link));
102
//					exit();
103
					$this->send_header($this->page_link($this->default_link));
103 104
				} else {
104 105
					// Include page inline
105 106
					$this->page_id = $this->default_page_id;
......
191 192
			// Page link
192 193
			$this->link=$this->page_link($this->page['link']);
193 194
			$_SESSION['PAGE_ID'] = $this->page_id;
194
			$_SESSION['HTTP_REFERER'] = $this->link;
195
            $bCanRedirect = ($this->visibility == 'registered' || $this->visibility == 'privat');
196
			$_SESSION['HTTP_REFERER'] = $bCanRedirect != true ? $this->link : WB_URL;
195 197

  
196 198
		// End code to set details as either variables of constants
197 199
		}
......
226 228
					// User isnt allowed on this page so tell them
227 229
					$this->page_access_denied=true;
228 230
				}
229
				
231

  
230 232
			}
231 233
		}
232 234
		// check if there is at least one active section
......
261 263
		} elseif(SEARCH == 'private' AND $this->is_authenticated() == true) {
262 264
			define('SHOW_SEARCH', true);
263 265
		} elseif(SEARCH == 'registered' AND $this->is_authenticated() == true) {
264
			define('SHOW_SEARCH', true);	
266
			define('SHOW_SEARCH', true);
265 267
		} else {
266 268
			define('SHOW_SEARCH', false);
267 269
		}
......
286 288
 * @return void
287 289
 * @history 100216 17:00:00 optimise errorhandling, speed, SQL-strict
288 290
 */
289
	public function preprocess(&$content)
290
	{
291
		global $database;
292
		$replace_list = array();
293
		$pattern = '/\[wblink([0-9]+)\]/isU';
294
		if(preg_match_all($pattern,$content,$ids))
295
		{
296
			foreach($ids[1] as $key => $page_id)
297
			{
298
				$replace_list[$page_id] = $ids[0][$key];
299
			}
300
			foreach($replace_list as $page_id => $tag)
301
			{
302
				$sql = 'SELECT `link` FROM `'.TABLE_PREFIX.'pages` WHERE `page_id` = '.(int)$page_id;
303
				$link = $database->get_one($sql);
304
				if(!is_null($link))
305
				{
306
					$link = $this->page_link($link);
307
					$content = str_replace($tag, $link, $content);
308
				}
309
			}
310
		}
311
	}
291
     public function preprocess(&$content)
292
     {
293
    //   do nothing
294
     }
312 295

  
313
/*
314
	function preprocess(&$content) {
315
		global $database;
316
		// Replace [wblink--PAGE_ID--] with real link
317
		$pattern = '/\[wblink(.+?)\]/s';
318
		preg_match_all($pattern,$content,$ids);
319
		foreach($ids[1] AS $page_id) {
320
			$pattern = '/\[wblink'.$page_id.'\]/s';
321
			// Get page link
322
			$get_link = $database->query("SELECT link FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id' LIMIT 1");
323
			$fetch_link = $get_link->fetchRow();
324
			$link = $this->page_link($fetch_link['link']);
325
			$content = preg_replace($pattern,$link,$content);
326
		}
327
	}
328
*/
329 296
	public function menu() {
330 297
		global $wb;
331 298
	   if (!isset($wb->menu_number)) {
......
363 330
	   }
364 331
	   $wb->show_menu();
365 332
	}
366
	
333

  
367 334
	public function show_menu() {
368 335
		global $database;
369 336
		if ($this->menu_start_level>0) {
......
451 418
	}
452 419
}
453 420

  
454
?>

Also available in: Unified diff