mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 12:20:44 +02:00
Update front page handling
This commit is contained in:
@@ -1,44 +1,32 @@
|
|||||||
// $Id: wmessage.sc,v 1.4 2007-01-20 16:10:32 mrpete Exp $
|
// $Id: wmessage.sc,v 1.5 2007-07-31 19:25:26 e107steved Exp $
|
||||||
$prefwmsc = isset($pref['wmessage_sc']) && $pref['wmessage_sc'];
|
|
||||||
if (($prefwmsc && $parm == "header") || (!$prefwmsc && ($parm !='header')) ){
|
$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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
global $e107,$e107cache;
|
global $e107,$e107cache;
|
||||||
|
|
||||||
|
if ($parm != "force")
|
||||||
if (isset($pref['frontpage']['all']) && $pref['frontpage']['all']) {
|
{
|
||||||
$full_url = ((strpos($pref['frontpage']['all'], 'http') === FALSE) ? SITEURL : '').$pref['frontpage']['all'];
|
$full_url = 'news.php'; // Set a default in case
|
||||||
} else if (ADMIN) {
|
$uc_array = explode(',', USERCLASS_LIST);
|
||||||
$full_url = ((strpos($pref['frontpage']['254'], 'http') === FALSE) ? SITEURL : '').$pref['frontpage']['254'];
|
foreach ($pref['frontpage'] as $fk=>$fp)
|
||||||
} else if (USER) {
|
{
|
||||||
require_once(e_HANDLER.'userclass_class.php');
|
if (in_array($fk,$uc_array))
|
||||||
$class_list = get_userclass_list();
|
{
|
||||||
foreach ($class_list as $fp_class) {
|
$full_url = ((strpos($fp, 'http') === FALSE) ? SITEURL : '').$fp;
|
||||||
if (check_class($fp_class['userclass_id'])) {
|
break;
|
||||||
$full_url = ((strpos($pref['frontpage'][$fp_class['userclass_id']], 'http') === FALSE) ? SITEURL : '').$pref['frontpage'][$fp_class['userclass_id']];
|
}
|
||||||
$class_match = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$class_match) {
|
|
||||||
$full_url = ((strpos($pref['frontpage']['253'], 'http') === FALSE) ? SITEURL : '').$pref['frontpage']['253'];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$full_url = ((strpos($pref['frontpage']['252'], 'http') === FALSE) ? SITEURL : '').$pref['frontpage']['252'];
|
|
||||||
}
|
}
|
||||||
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($parm == "ignore_query"){
|
|
||||||
$front_qry = e_QUERY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($parm == "force"){
|
if (($parm == "force") || ((e_SELF == $front_url) && (($parm == "ignore_query") || (e_QUERY == $front_qry))))
|
||||||
$front_url = e_SELF;
|
{
|
||||||
$front_qry = e_QUERY;
|
// Actually want to display a welcome message here
|
||||||
}
|
|
||||||
|
|
||||||
if (e_SELF == $front_url && e_QUERY == $front_qry) {
|
|
||||||
global $sql, $pref, $tp, $ns;
|
global $sql, $pref, $tp, $ns;
|
||||||
|
|
||||||
|
|
||||||
@@ -49,7 +37,8 @@ if (($prefwmsc && $parm == "header") || (!$prefwmsc && ($parm !='header')) ){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!defined("WMFLAG")) {
|
if (!defined("WMFLAG"))
|
||||||
|
{
|
||||||
$qry = "
|
$qry = "
|
||||||
SELECT * FROM #generic
|
SELECT * FROM #generic
|
||||||
WHERE gen_type ='wmessage' AND gen_intdata IN (".USERCLASS_LIST.")";
|
WHERE gen_type ='wmessage' AND gen_intdata IN (".USERCLASS_LIST.")";
|
||||||
@@ -85,3 +74,5 @@ if (($prefwmsc && $parm == "header") || (!$prefwmsc && ($parm !='header')) ){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -12,8 +12,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/index.php,v $
|
| $Source: /cvs_backup/e107_0.8/index.php,v $
|
||||||
| $Revision: 1.2 $
|
| $Revision: 1.3 $
|
||||||
| $Date: 2007-05-02 19:47:47 $
|
| $Date: 2007-07-31 19:25:26 $
|
||||||
| $Author: e107steved $
|
| $Author: e107steved $
|
||||||
|
|
||||||
Mods for prioritised system
|
Mods for prioritised system
|
||||||
@@ -68,13 +68,12 @@ if (isset($pref['frontpage']['all']) && $pref['frontpage']['all'])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // This is the 'new' method - assumes $pref['frontpage'] is an ordered list of rules
|
{ // This is the 'new' method - assumes $pref['frontpage'] is an ordered list of rules
|
||||||
echo "Using new method: ".USERCLASS_LIST."<br />";
|
|
||||||
foreach ($pref['frontpage'] as $fk=>$fp)
|
foreach ($pref['frontpage'] as $fk=>$fp)
|
||||||
{
|
{
|
||||||
if (in_array($fk,$class_list))
|
if (in_array($fk,$class_list))
|
||||||
{
|
{
|
||||||
|
// Debateable whether we should append $query - we may be redirecting to a custom page, for example
|
||||||
$location = ((strpos($fp, 'http') === FALSE) ? e_BASE : '').$fp.$query;
|
$location = ((strpos($fp, 'http') === FALSE) ? e_BASE : '').$fp.$query;
|
||||||
echo "Redirecting to: ".$location."<br />";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,7 +82,6 @@ else
|
|||||||
|
|
||||||
if (!$location)
|
if (!$location)
|
||||||
{ // Try and use the 'old' method (this bit can go later)
|
{ // Try and use the 'old' method (this bit can go later)
|
||||||
echo "Using OLD METHOD<br />";
|
|
||||||
if (ADMIN)
|
if (ADMIN)
|
||||||
{
|
{
|
||||||
$location = ((strpos($pref['frontpage'][e_UC_ADMIN], 'http') === FALSE) ? e_BASE : '').$pref['frontpage'][e_UC_ADMIN].$query;
|
$location = ((strpos($pref['frontpage'][e_UC_ADMIN], 'http') === FALSE) ? e_BASE : '').$pref['frontpage'][e_UC_ADMIN].$query;
|
||||||
|
Reference in New Issue
Block a user