1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-30 19:30:25 +02:00

Improved Front page detection, themes now have an option to assign layout to frontpage via spacial keyword FRONTPAGE

This commit is contained in:
secretr
2011-12-02 16:33:31 +00:00
parent 5432fe98c0
commit 1b83f6a5e4
5 changed files with 35 additions and 24 deletions

View File

@@ -930,11 +930,18 @@ if(!defined("THEME_LAYOUT"))
if(is_array($cusPagePref) && count($cusPagePref)>0) // check if we match a page in layout custompages.
{
//e_SELF.(e_QUERY ? '?'.e_QUERY : '');
$c_url = e_REQUEST_URL.(e_QUERY ? '?'.e_QUERY : '');// mod_rewrite support
$c_url = str_replace(array('&'), array('&'), e_REQUEST_URL);//.(e_QUERY ? '?'.e_QUERY : '');// mod_rewrite support
foreach($cusPagePref as $lyout=>$cusPageArray)
{
if(!is_array($cusPageArray)) { continue; }
// NEW - Front page template check - early
if(in_array('FRONTPAGE', $cusPageArray) && ($c_url == SITEURL || rtrim($c_url, '/') == SITEURL.'index.php'))
{
$def = $lyout;
break;
}
foreach($cusPageArray as $kpage)
{
if(substr($kpage, -1) === '!' )

View File

@@ -91,6 +91,7 @@ class core_index_index_controller extends eController
// Former Welcome Message front-page. Should be handled by current theme layout
elseif($location == 'index.php' || $location == 'url:/' || $location == 'route:/' || $location == '/')
{
define('e_FRONTPAGE', true);
$this->_forward('front');
return;
}
@@ -112,6 +113,7 @@ class core_index_index_controller extends eController
{
throw new eException('Infinite loop detected while dispatching front page.', 2);
}
define('e_FRONTPAGE', true);
$this->_forward($request->getRoute());
return;
}
@@ -132,7 +134,7 @@ class core_index_index_controller extends eController
{
throw new eException('Infinite loop detected while dispatching front page.', 2);
}
define('e_FRONTPAGE', true);
$this->_forward($request->getRoute(), $qstr);
return;
@@ -155,7 +157,7 @@ class core_index_index_controller extends eController
->setLegacyQstring($qstr);
$request->routed = true;
define('e_FRONTPAGE', true);
eFront::isLegacy('{e_BASE}'.$page);
return $this;
}

View File

@@ -4,37 +4,41 @@
function wmessage_shortcode($parm)
{
global $e107, $e107cache, $pref;
$e107 = e107::getInstance();
$e107cache = e107::getCache();
$pref = e107::getPref();
$prefwmsc = varset($pref['wmessage_sc'], FALSE);
if (($prefwmsc && $parm == 'header') || (!$prefwmsc && ($parm !='header')) )
{ // Two places it might be invoked - allow one or the other
return;
}
if ($parm != 'force')
{
$full_url = 'news.php'; // Set a default in case
$front_qry = '';
$uc_array = explode(',', USERCLASS_LIST);
if(varset($pref['frontpage']))
{
foreach ($pref['frontpage'] as $fk => $fp)
$full_url = 'news.php'; // Set a default in case
$front_qry = '';
$uc_array = explode(',', USERCLASS_LIST);
if(varset($pref['frontpage']))
{
if (in_array($fk,$uc_array))
foreach ($pref['frontpage'] as $fk => $fp)
{
$full_url = $fp;
break;
if (in_array($fk,$uc_array))
{
$full_url = $fp;
break;
}
}
list($front_url, $front_qry) = explode('?', $full_url.'?'); // extra '?' ensure the array is filled
}
list($front_url, $front_qry) = explode('?', $full_url.'?'); // extra '?' ensure the array is filled
}
}
if (strpos($front_url, 'http') === FALSE) $front_url = SITEURL.$front_url;
if (($parm == 'force') || ((e_SELF == $front_url) && (($parm == 'ignore_query') || (e_QUERY == $front_qry))))
if (deftrue('e_FRONTPAGE') || ($parm == 'force') || ((e_SELF == $front_url) && (($parm == 'ignore_query') || (e_QUERY == $front_qry))))
{
// Actually want to display a welcome message here
global $ns;

View File

@@ -53,7 +53,7 @@
<core name="displayname_maxlength">15</core>
<core name="displayrendertime">0</core>
<core name="displaysql">0</core>
<core name="displaythemeinfo">0</core>
<core name="displaythemeinfo">1</core>
<core name="download_email">0</core>
<core name="e_jslib_browser_cache">0</core>
<core name="e_jslib_core"><![CDATA[array (

View File

@@ -2,16 +2,14 @@
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Copyright (C) 2008-2011 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* News frontend
*
* $Source: /cvs_backup/e107_0.8/index.php,v $
* $Revision$
* $Date$
* $Author$
* $URL$
* $Id$
*/
// BOOTSTRAP START