Revision 95
Added by stefan about 20 years ago
| class.frontend.php | ||
|---|---|---|
| 47 | 47 |
// page database row |
| 48 | 48 |
var $page; |
| 49 | 49 |
var $page_id,$page_title,$menu_title,$parent,$root_parent,$level,$visibility; |
| 50 |
var $page_description,$page_keywords,$page_link_original,$page_link;
|
|
| 50 |
var $page_description,$page_keywords,$page_link; |
|
| 51 | 51 |
var $page_trail=array(); |
| 52 | 52 |
|
| 53 | 53 |
var $page_access_denied; |
| ... | ... | |
| 64 | 64 |
|
| 65 | 65 |
function page_select() {
|
| 66 | 66 |
global $page_id,$no_intro; |
| 67 |
$database=& $this->database;
|
|
| 67 |
global $database;
|
|
| 68 | 68 |
// We have no page id and are supposed to show the intro page |
| 69 | 69 |
if((INTRO_PAGE AND !isset($no_intro)) AND (!isset($page_id) OR !is_numeric($page_id))) {
|
| 70 | 70 |
// Since we have no page id check if we should go to intro page or default page |
| ... | ... | |
| 121 | 121 |
} |
| 122 | 122 |
|
| 123 | 123 |
function get_page_details() {
|
| 124 |
$database = & $this->database;
|
|
| 124 |
global $database;
|
|
| 125 | 125 |
if($this->page_id != 0) {
|
| 126 | 126 |
// Query page details |
| 127 | 127 |
$query_page = "SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '{$this->page_id}'";
|
| ... | ... | |
| 142 | 142 |
// Begin code to set details as either variables of constants |
| 143 | 143 |
// Page ID |
| 144 | 144 |
define('PAGE_ID', $this->page['page_id']);
|
| 145 |
$this->page_id=$this->page['page_id']; |
|
| 146 | 145 |
// Page Title |
| 147 | 146 |
define('PAGE_TITLE', $this->strip_slashes_dummy($this->page['page_title']));
|
| 148 | 147 |
$this->page_title=PAGE_TITLE; |
| ... | ... | |
| 180 | 179 |
// End code to set details as either variables of constants |
| 181 | 180 |
} |
| 182 | 181 |
|
| 183 |
// Work-out if any possible in-line search boxes should be shown |
|
| 184 |
if(SEARCH == 'public') {
|
|
| 185 |
define('SHOW_SEARCH', true);
|
|
| 186 |
} elseif(SEARCH == 'private' AND VISIBILITY == 'private') {
|
|
| 187 |
define('SHOW_SEARCH', true);
|
|
| 188 |
} elseif(SEARCH == 'private' AND $wb->is_authenticated() == true) {
|
|
| 189 |
define('SHOW_SEARCH', true);
|
|
| 190 |
} else {
|
|
| 191 |
define('SHOW_SEARCH', false);
|
|
| 192 |
} |
|
| 193 |
// Work-out if menu should be shown |
|
| 194 |
if(!defined('SHOW_MENU')) {
|
|
| 195 |
define('SHOW_MENU', true);
|
|
| 196 |
} |
|
| 197 |
// Work-out if login menu constants should be set |
|
| 198 |
if(FRONTEND_LOGIN) {
|
|
| 199 |
// Set login menu constants |
|
| 200 |
define('LOGIN_URL', WB_URL.'/account/login'.PAGE_EXTENSION);
|
|
| 201 |
define('LOGOUT_URL', WB_URL.'/account/logout'.PAGE_EXTENSION);
|
|
| 202 |
define('FORGOT_URL', WB_URL.'/account/forgot'.PAGE_EXTENSION);
|
|
| 203 |
define('PREFERENCES_URL', WB_URL.'/account/preferences'.PAGE_EXTENSION);
|
|
| 204 |
define('SIGNUP_URL', WB_URL.'/account/signup'.PAGE_EXTENSION);
|
|
| 205 |
} |
|
| 206 |
|
|
| 207 | 182 |
// Figure out what template to use |
| 208 | 183 |
if(!defined('TEMPLATE')) {
|
| 209 | 184 |
if(isset($this->page['template']) AND $this->page['template'] != '') {
|
| ... | ... | |
| 219 | 194 |
// Set the template dir |
| 220 | 195 |
define('TEMPLATE_DIR', WB_URL.'/templates/'.TEMPLATE);
|
| 221 | 196 |
|
| 222 |
// Check if user is allow to view this page |
|
| 197 |
// Check if user is allowed to view this page
|
|
| 223 | 198 |
if(VISIBILITY == 'private' OR VISIBILITY == 'registered') {
|
| 224 | 199 |
// Check if the user is authenticated |
| 225 | 200 |
if($this->is_authenticated() == false) {
|
| ... | ... | |
| 234 | 209 |
// User isnt allowed on this page so tell them |
| 235 | 210 |
$this->page_access_denied=true; |
| 236 | 211 |
} |
| 212 |
} |
|
| 213 |
|
|
| 214 |
function get_website_settings() {
|
|
| 215 |
global $database; |
|
| 216 |
|
|
| 217 |
// set visibility SQL code |
|
| 237 | 218 |
// never show no-vis, hidden or deleted pages |
| 238 | 219 |
$this->extra_where_sql = "visibility != 'none' AND visibility != 'hidden' AND visibility != 'deleted'"; |
| 239 | 220 |
// Set extra private sql code |
| ... | ... | |
| 246 | 227 |
} |
| 247 | 228 |
} |
| 248 | 229 |
$this->extra_where_sql .= $this->sql_where_language; |
| 249 |
} |
|
| 250 | 230 |
|
| 251 |
function get_website_settings() {
|
|
| 252 |
$database = & $this->database; |
|
| 253 |
// Get website settings (title, keywords, description, header, and footer) |
|
| 254 |
$query_settings = "SELECT name,value FROM ".TABLE_PREFIX."settings"; |
|
| 255 |
$get_settings = $database->query($query_settings); |
|
| 256 |
while($setting = $get_settings->fetchRow()) {
|
|
| 257 |
switch($setting['name']) {
|
|
| 258 |
case 'title': |
|
| 259 |
define('WEBSITE_TITLE', $this->strip_slashes_dummy($setting['value']));
|
|
| 260 |
$this->website_title=WEBSITE_TITLE; |
|
| 261 |
break; |
|
| 262 |
case 'description': |
|
| 263 |
if($page_description != '') {
|
|
| 264 |
define('WEBSITE_DESCRIPTION', $page_description);
|
|
| 265 |
} else {
|
|
| 266 |
define('WEBSITE_DESCRIPTION', $this->strip_slashes_dummy($setting['value']));
|
|
| 267 |
} |
|
| 268 |
$this->website_description=WEBSITE_DESCRIPTION; |
|
| 269 |
break; |
|
| 270 |
case 'keywords': |
|
| 271 |
if($page_keywords != '') {
|
|
| 272 |
define('WEBSITE_KEYWORDS', $this->strip_slashes_dummy($setting['value']).' '.$page_keywords);
|
|
| 273 |
} else {
|
|
| 274 |
define('WEBSITE_KEYWORDS', $this->strip_slashes_dummy($setting['value']));
|
|
| 275 |
} |
|
| 276 |
$this->website_keywords=WEBSITE_KEYWORDS; |
|
| 277 |
break; |
|
| 278 |
case 'header': |
|
| 279 |
define('WEBSITE_HEADER', $this->strip_slashes_dummy($setting['value']));
|
|
| 280 |
$this->website_header=WEBSITE_HEADER; |
|
| 281 |
break; |
|
| 282 |
case 'footer': |
|
| 283 |
define('WEBSITE_FOOTER', $this->strip_slashes_dummy($setting['value']));
|
|
| 284 |
$this->website_footer=WEBSITE_FOOTER; |
|
| 285 |
break; |
|
| 286 |
} |
|
| 231 |
// Work-out if any possible in-line search boxes should be shown |
|
| 232 |
if(SEARCH == 'public') {
|
|
| 233 |
define('SHOW_SEARCH', true);
|
|
| 234 |
} elseif(SEARCH == 'private' AND VISIBILITY == 'private') {
|
|
| 235 |
define('SHOW_SEARCH', true);
|
|
| 236 |
} elseif(SEARCH == 'private' AND $wb->is_authenticated() == true) {
|
|
| 237 |
define('SHOW_SEARCH', true);
|
|
| 238 |
} else {
|
|
| 239 |
define('SHOW_SEARCH', false);
|
|
| 287 | 240 |
} |
| 241 |
// Work-out if menu should be shown |
|
| 242 |
if(!defined('SHOW_MENU')) {
|
|
| 243 |
define('SHOW_MENU', true);
|
|
| 244 |
} |
|
| 245 |
// Work-out if login menu constants should be set |
|
| 246 |
if(FRONTEND_LOGIN) {
|
|
| 247 |
// Set login menu constants |
|
| 248 |
define('LOGIN_URL', WB_URL.'/account/login'.PAGE_EXTENSION);
|
|
| 249 |
define('LOGOUT_URL', WB_URL.'/account/logout'.PAGE_EXTENSION);
|
|
| 250 |
define('FORGOT_URL', WB_URL.'/account/forgot'.PAGE_EXTENSION);
|
|
| 251 |
define('PREFERENCES_URL', WB_URL.'/account/preferences'.PAGE_EXTENSION);
|
|
| 252 |
define('SIGNUP_URL', WB_URL.'/account/signup'.PAGE_EXTENSION);
|
|
| 253 |
} |
|
| 288 | 254 |
} |
| 289 | 255 |
|
| 290 | 256 |
function page_link($link){
|
| ... | ... | |
| 297 | 263 |
} |
| 298 | 264 |
|
| 299 | 265 |
function preprocess(&$content) {
|
| 300 |
$database = & $this->database;
|
|
| 266 |
global $database;
|
|
| 301 | 267 |
// Replace [wblink--PAGE_ID--] with real link |
| 302 | 268 |
$pattern = '/\[wblink(.+?)\]/s'; |
| 303 | 269 |
preg_match_all($pattern,$content,$ids); |
| ... | ... | |
| 360 | 326 |
} |
| 361 | 327 |
|
| 362 | 328 |
function show_menu() {
|
| 363 |
$database = & $this->database;
|
|
| 329 |
global $database;
|
|
| 364 | 330 |
if ($this->menu_recurse==0) |
| 365 | 331 |
return; |
| 366 | 332 |
// Check if we should add menu number check to query |
| ... | ... | |
| 414 | 380 |
// Get outside objects |
| 415 | 381 |
global $TEXT,$MENU,$HEADING,$MESSAGE; |
| 416 | 382 |
global $globals; |
| 417 |
$database = & $this->database;
|
|
| 383 |
global $database;
|
|
| 418 | 384 |
$admin = & $this; |
| 419 | 385 |
if ($this->page_access_denied==true) {
|
| 420 | 386 |
echo $MESSAGE['FRONTEND']['SORRY_NO_VIEWING_PERMISSIONS']; |
Also available in: Unified diff
Moved settings from config.php into database.
NOT FULLY WORKING!!!