Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke / Raven CMS CMS Wiki
Author Message
neralex
Site Admin



Joined: Aug 22, 2007
Posts: 1772

PostPosted: Mon Oct 26, 2015 9:03 am Reply with quote

Since some weeks i'm working on the theme for my radio page to get it ready for bootstrap and i stumbled again over a very old problem.

Anyone who has intensively engaged with creating themes knows how it works to hide the left/right blocks for modules and other definded areas in the themeheader() function but it exists one area which is out of this control - the module error pages (module not found, restricted area etc.). These error pages are a hard-coded part in the modules.php but there is nothing what you can use in a theme to hide the left blocks.

To solve this problem i created a simple definition before each "$pagetitle = ..." codeline. There are 4 places which need this modifiaction.

php Code:
} else {

define('MODULE_ERROR', true); # << added definition
$pagetitle = '- ' . _RESTRICTEDAREA;
include_once 'header.php';
OpenTable();
echo '<div class="text-center"><span class="thick">' , _RESTRICTEDAREA , '</span><br />'
, _GOBACK , '</div>';
CloseTable();
include_once 'footer.php';
die();
}


After that we can use it now in the themeheader() function of a theme like this:

php Code:
if ($name !='Forums' && $name !='xyz' && !defined('MODULE_ERROR')) {

blocks(left);
}


I don't know how it will work in RavenCMS but if should follow the module-structure the same way as in RN25x, then it would be a helpful modification to declare something like this in order to create themes without left blocks.

BTW: After a lot of work on wordpress in the last months for customers i'm so happy to be back in RN and change my own shizzle. It's a feeling to get back the control and it feels soo good!

RavensScripts

_________________
Github: RavenNuke

Last edited by neralex on Tue Nov 17, 2015 2:30 pm; edited 3 times in total 
View user's profile Send private message
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6433

PostPosted: Mon Oct 26, 2015 11:49 am Reply with quote

Thanks, neralex! Can you list the 4 places where this needs to change for anyone else who might want to do this?

_________________
I search, therefore I exist...
nukeSEO - nukeFEED - nukePIE - nukeSPAM - nukeWYSIWYG
 
View user's profile Send private message
neralex







PostPosted: Mon Oct 26, 2015 12:30 pm Reply with quote

... for sure, this is my modules.php:

php Code:
<?php

/************************************************************************/
/* PHP-NUKE: Advanced Content Management System */
/* ============================================ */
/* */
/* Copyright (c) 2002 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/* */
/************************************************************************/
/********************************************************/
/* NSN Groups */
/* By: NukeScripts Network (webmaster@nukescripts.net) */
/* http://www.nukescripts.net */
/* Copyright © 2000-2005 by NukeScripts Network */
/********************************************************/
/************************************************************************/
/* Additional code clean-up, performance enhancements, and W3C and */
/* XHTML compliance fixes by Raven and Montego. */
/************************************************************************/

define('MODULE_FILE', true);
require_once 'mainfile.php';

$module = 1;
if (!isset($name)) $name = '';
$name = addslashes(check_html(trim($name), 'nohtml')); //Fixes SQL Injection
/////////////////
if(!defined('XHR')) include_once 'includes/RWS_WhoIsWhere/wiw.inc.php';
/////////////////
if(!isset($file)) { $file = 'index'; }
if(isset($name)) {
if(stristr($name, 'http://')) { die('Hi and Bye'); }
if(stristr($file, 'http://')) { die('Hi and Bye'); }
$modstring = strtolower($_SERVER['QUERY_STRING']);
if(stripos_clone($modstring, '&user=') AND ($name == 'Private_Messages' || $name == 'Forums' || $name == 'Members_List')) header('Location: index.php');
global $nukeuser, $db, $prefix;
$nukeuser = base64_decode($user);
$nukeuser = addslashes($nukeuser);
$result = $db->sql_query('SELECT * FROM `'.$prefix.'_modules` WHERE `title` = \'' . $name . '\'');
$row = $db->sql_fetchrow($result);
$mod_active = intval($row['active']);
$view = intval($row['view']);
$groups = $row['groups'];
$mod_group = intval($row['mod_group']);
if(($mod_active == 1) OR (isset($admin) AND is_admin($admin))) {
if(!isset($file)) { $file = 'index'; }
if(preg_match('/\.\./', $name) || preg_match('/\.\./', $file)) {
$pagetitle = '- '._SOCOOL;
include_once 'header.php';
OpenTable();
echo '<div class="text-center"><span class="thick">' , _SOCOOL , '</span><br />'
, _GOBACK , '</div>';
CloseTable();
include_once 'footer.php';
die();
} else {
$ThemeSel = get_theme();
if(file_exists('themes/' . $ThemeSel . '/modules/' . $name . '/' . $file . '.php')) {
$modpath = 'themes/' . $ThemeSel . '/';
} else {
$modpath = '';
}
$modpath .= 'modules/' . $name . '/' . $file . '.php';
if(file_exists($modpath)) {
// The module's $view describes the accessibility of the module:
// 0 - All Visitors
// 1 - Registered Users Only
// 2 - Administrators Only
// 3 - Paid Subscribers Only
// 4 - NSN Groups Only
// *Note: Admins can see all access levels.
// *Note for the Users Group/Points system: If a module is set to Registered Users Only, but has a non-zero
// mod_group value, then the module is only available to those users who have enough points to be in that
// Users Group.

$canView = ($view == 0) || // all visitors
($view == 1 && isset($user) && // registered user and
($mod_group <= 0 || is_group($user, $name))) || // (no points needed OR user has points)
(isset($admin) && is_admin($admin)) || // is admin
($view == 3 && paid()) || // paid subscriber
($view >= 4 && in_groups($groups)); // NSN Groups user

if ($canView) {
include_once($modpath);
} else {
define('MODULE_ERROR', true); # << added definition
$pagetitle = '- ' . _RESTRICTEDAREA;
include_once 'header.php';
OpenTable();
echo '<div class="text-center"><span class="thick">' , _RESTRICTEDAREA , '</span><br />'
, _GOBACK , '</div>';
CloseTable();
include_once 'footer.php';
die();
}
} else {
define('MODULE_ERROR', true); # << added definition
$pagetitle = '- ' . _FILENOTFOUND;
include_once 'header.php';
OpenTable();
echo '<div class="text-center"><span class="thick">' , _FILENOTFOUND , '</span><br />'
, _GOBACK , '</div>';
CloseTable();
include_once 'footer.php';
die ();
}
}
} else {
define('MODULE_ERROR', true); # << added definition
$pagetitle = '- ' . _MODULENOTACTIVE;
include_once 'header.php';
OpenTable();
echo '<div class="text-center">' , _MODULENOTACTIVE , '<br />'
, _GOBACK , '</div>';
CloseTable();
include_once 'footer.php';
die ();
}
} else {
define('MODULE_ERROR', true); # << added definition
$pagetitle = '- ' . _MODULENOTFOUND;
include_once 'header.php';
OpenTable();
echo '<div class="text-center">' , _MODULENOTFOUND , '<br />'
, _GOBACK , '</div>';
CloseTable();
include_once 'footer.php';
die ();
}

if(!function_exists('stripos_clone')) {
function stripos_clone($haystack, $needle, $offset=0) {
return strpos(strtoupper($haystack), strtoupper($needle), $offset);
}
}

?>
 
kguske







PostPosted: Mon Oct 26, 2015 3:23 pm Reply with quote

Thanks. This highlights the need for an error page function...
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke / Raven CMS CMS Wiki

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©