mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 11:50:30 +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:
11
class2.php
11
class2.php
@@ -930,11 +930,18 @@ if(!defined("THEME_LAYOUT"))
|
|||||||
if(is_array($cusPagePref) && count($cusPagePref)>0) // check if we match a page in layout custompages.
|
if(is_array($cusPagePref) && count($cusPagePref)>0) // check if we match a page in layout custompages.
|
||||||
{
|
{
|
||||||
//e_SELF.(e_QUERY ? '?'.e_QUERY : '');
|
//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)
|
foreach($cusPagePref as $lyout=>$cusPageArray)
|
||||||
{
|
{
|
||||||
if(!is_array($cusPageArray)) { continue; }
|
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)
|
foreach($cusPageArray as $kpage)
|
||||||
{
|
{
|
||||||
if(substr($kpage, -1) === '!' )
|
if(substr($kpage, -1) === '!' )
|
||||||
|
@@ -91,6 +91,7 @@ class core_index_index_controller extends eController
|
|||||||
// Former Welcome Message front-page. Should be handled by current theme layout
|
// Former Welcome Message front-page. Should be handled by current theme layout
|
||||||
elseif($location == 'index.php' || $location == 'url:/' || $location == 'route:/' || $location == '/')
|
elseif($location == 'index.php' || $location == 'url:/' || $location == 'route:/' || $location == '/')
|
||||||
{
|
{
|
||||||
|
define('e_FRONTPAGE', true);
|
||||||
$this->_forward('front');
|
$this->_forward('front');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -112,6 +113,7 @@ class core_index_index_controller extends eController
|
|||||||
{
|
{
|
||||||
throw new eException('Infinite loop detected while dispatching front page.', 2);
|
throw new eException('Infinite loop detected while dispatching front page.', 2);
|
||||||
}
|
}
|
||||||
|
define('e_FRONTPAGE', true);
|
||||||
$this->_forward($request->getRoute());
|
$this->_forward($request->getRoute());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -132,7 +134,7 @@ class core_index_index_controller extends eController
|
|||||||
{
|
{
|
||||||
throw new eException('Infinite loop detected while dispatching front page.', 2);
|
throw new eException('Infinite loop detected while dispatching front page.', 2);
|
||||||
}
|
}
|
||||||
|
define('e_FRONTPAGE', true);
|
||||||
$this->_forward($request->getRoute(), $qstr);
|
$this->_forward($request->getRoute(), $qstr);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -155,7 +157,7 @@ class core_index_index_controller extends eController
|
|||||||
->setLegacyQstring($qstr);
|
->setLegacyQstring($qstr);
|
||||||
|
|
||||||
$request->routed = true;
|
$request->routed = true;
|
||||||
|
define('e_FRONTPAGE', true);
|
||||||
eFront::isLegacy('{e_BASE}'.$page);
|
eFront::isLegacy('{e_BASE}'.$page);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@@ -4,37 +4,41 @@
|
|||||||
|
|
||||||
function wmessage_shortcode($parm)
|
function wmessage_shortcode($parm)
|
||||||
{
|
{
|
||||||
|
$e107 = e107::getInstance();
|
||||||
global $e107, $e107cache, $pref;
|
$e107cache = e107::getCache();
|
||||||
|
$pref = e107::getPref();
|
||||||
|
|
||||||
$prefwmsc = varset($pref['wmessage_sc'], FALSE);
|
$prefwmsc = varset($pref['wmessage_sc'], FALSE);
|
||||||
if (($prefwmsc && $parm == 'header') || (!$prefwmsc && ($parm !='header')) )
|
if (($prefwmsc && $parm == 'header') || (!$prefwmsc && ($parm !='header')) )
|
||||||
{ // Two places it might be invoked - allow one or the other
|
{ // Two places it might be invoked - allow one or the other
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($parm != 'force')
|
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;
|
if (in_array($fk,$uc_array))
|
||||||
break;
|
{
|
||||||
|
$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 (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
|
// Actually want to display a welcome message here
|
||||||
global $ns;
|
global $ns;
|
||||||
|
@@ -53,7 +53,7 @@
|
|||||||
<core name="displayname_maxlength">15</core>
|
<core name="displayname_maxlength">15</core>
|
||||||
<core name="displayrendertime">0</core>
|
<core name="displayrendertime">0</core>
|
||||||
<core name="displaysql">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="download_email">0</core>
|
||||||
<core name="e_jslib_browser_cache">0</core>
|
<core name="e_jslib_browser_cache">0</core>
|
||||||
<core name="e_jslib_core"><![CDATA[array (
|
<core name="e_jslib_core"><![CDATA[array (
|
||||||
|
@@ -2,16 +2,14 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* 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
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
* News frontend
|
* News frontend
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/index.php,v $
|
* $URL$
|
||||||
* $Revision$
|
* $Id$
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// BOOTSTRAP START
|
// BOOTSTRAP START
|
||||||
|
Reference in New Issue
Block a user