1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 14:46:56 +02:00

Issue #927 - e_frontpage.php upgraded to v2.x specifications.

This commit is contained in:
Cameron
2015-03-15 13:27:37 -07:00
parent 15398155b2
commit 52845adf1b
4 changed files with 90 additions and 24 deletions

View File

@@ -2,15 +2,12 @@
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Copyright (C) 2008-2015 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Administration Area - Front page
*
* $URL$
* $Id$
*
*/
/**
@@ -38,11 +35,11 @@ $mes = e107::getMessage();
$frontPref = e107::pref('core'); // Get prefs
// Get list of possible options for front page
$front_page['news'] = array('page' => 'news.php', 'title' => ADLAN_0);
//$front_page['download'] = array('page' => 'download.php', 'title' => ADLAN_24); // Its a plugin now
$front_page['news'] = array('page' => 'news.php', 'title' => ADLAN_0); // TODO Move to e107_plugins/news
$front_page['wmessage'] = array('page' => 'index.php', 'title' => ADLAN_28);
if($sql->db_Select('page', 'page_id, page_title', "menu_name=''"))
if($sql->db_Select('page', 'page_id, page_title', "menu_name=''")) // TODO Move to e107_plugins/page
{
$front_page['custom']['title'] = FRTLAN_30;
while($row = $sql->db_Fetch())
@@ -52,7 +49,7 @@ if($sql->db_Select('page', 'page_id, page_title', "menu_name=''"))
}
// Now let any plugins add to the options - must append to the $front_page array as above
if(varset($frontPref['e_frontpage_list']))
if(varset($frontPref['e_frontpage_list'])) // v1.x spec.
{
foreach($frontPref['e_frontpage_list'] as $val)
{
@@ -63,6 +60,12 @@ if(varset($frontPref['e_frontpage_list']))
}
}
//v2.x spec.
$new = e107::getAddonConfig('e_frontpage');
foreach($new as $k=>$v)
{
$front_page[$k] = $v;
}
// Make sure links relative to SITEURL
@@ -243,19 +246,23 @@ if(isset($_POST['fp_save_new']))
}
$temp = array('order' => intval($_POST['fp_order']), 'class' => $_POST['class'], 'page' => $frontpage_value, 'force' => trim($forcepage_value));
if($temp['order'] == 0)
{ // New index to add
if($temp['order'] == 0) // New index to add
{
$ind = 0;
for($i = 1; $i <= count($fp_settings); $i ++)
{
if($fp_settings[$i]['class'] == $temp['class'])
$ind = $i;
}
if($ind)
{
$mes->addDebug(print_a($fp_settings,true));
$mes->addError( "duplicate definition for class: ".$ind); //TODO LAN
unset($fp_settings[$ind]); // Knock out duplicate definition for class
echo "duplicate definition for class: ".$ind."<br />";
}
array_unshift($fp_settings, $temp); // Deliberately add twice
array_unshift($fp_settings, $temp); // ....because re-indexed from zero
unset($fp_settings[0]); // Then knock out index zero
@@ -306,6 +313,8 @@ if($fp_update_prefs)
$corePrefs->set('frontpage', $fp_list);
$corePrefs->set('frontpage_force', $fp_force);
$result = $corePrefs->save(FALSE, TRUE);
$mes->addDebug("<h4>Home</h4>".print_a($fp_list, true));
$mes->addDebug("<h4>Post-Login</h4>".print_a($fp_force, true));
}
@@ -510,7 +519,7 @@ class frontpage
</div>
</div>
<div class='buttons-bar center'>
<div class='buttons-bar center form-inline'>
".$this->frm->hidden('fp_order', $rule_info['order'])."
".FRTLAN_43.": ".e107::getUserClass()->uc_dropdown('class', $rule_info['class'], 'public,guest,member,admin,main,classes')."
".$this->frm->admin_button('fp_save_new', LAN_UPDATE, 'update')."
@@ -608,12 +617,14 @@ class frontpage
</td>
<td>
";
$text .= $this->frm->select_open($ob_name.'_multipage['.$front_key.']');
$text .= $this->frm->select_open($ob_name.'_multipage['.$front_key.']', 'size=xxlarge');
foreach($front_value['page'] as $multipage_key => $multipage_value)
{
$text .= "\n".$this->frm->option($multipage_value['title'], $multipage_key, ($current_setting == $multipage_value['page']))."\n";
}
$text .= $this->frm->select_close();
$text .= "</td>";
}
else

View File

@@ -0,0 +1,27 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2015 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
if (!defined('e107_INIT')) { exit; }
//v2.x spec.
class download_frontpage // include plugin-folder in the name.
{
function config()
{
$frontPage = array('page' => '{e_PLUGIN}download/download.php', 'title' => LAN_PLUGIN_DOWNLOAD_NAME);
return $frontPage;
}
}
?>

View File

@@ -2,11 +2,27 @@
if (!defined('e107_INIT')) { exit; }
e107::lan('forum', 'English_front');
// e107::lan('forum', 'English_front');
/**
* @todo - extend array to allow selection of any main forum, as well as the forum front page
*/
$front_page['forum'] = array('page' => $PLUGINS_DIRECTORY.'forum/forum.php', 'title' => LAN_PLUGIN_FORUM_NAME);
// $front_page['forum'] = array('page' =>'{e_PLUGIN}forum/forum.php', 'title' => LAN_PLUGIN_FORUM_NAME);
//v2.x spec.
class forum_frontpage // include plugin-folder in the name.
{
function config()
{
$frontPage = array(
'title' => LAN_PLUGIN_FORUM_NAME,
'page' => '{e_PLUGIN}forum/forum.php',
);
return $frontPage;
}
}
?>

View File

@@ -16,20 +16,32 @@
*/
if (!defined('e107_INIT')) { exit; }
if (!e107::isInstalled('newsfeed'))
e107::includeLan(e_PLUGIN.'newsfeed/languages/'.e_LANGUAGE.'_frontpage.php');
//v2.x spec.
class newsfeed_frontpage // include plugin-folder in the name.
{
return;
}
function config()
{
$frontPage = array();
$frontPage['title'] = LAN_PLUGIN_NEWSFEEDS_NAME; // .': '.vartrue($row['content_heading']); LAN_PLUGIN_NEWSFEEDS_NAME ?
$frontPage['page'][] = array('page' => '{e_PLUGIN}newsfeed/newsfeed.php', 'title' => NWSF_FP_2);
include_lan(e_PLUGIN.'newsfeed/languages/'.e_LANGUAGE.'_frontpage.php');
if (e107::getDb()->select("newsfeed", "newsfeed_id, newsfeed_name"))
{
while ($row = e107::getDb()->fetch())
{
$frontPage['page'][] = array('page' => '{e_PLUGIN}newsfeed/newsfeed.php?show.'.$row['newsfeed_id'], 'title' => $row['newsfeed_name']);
}
}
$front_page['newsfeed']['title'] = NWSF_FP_1.': '.vartrue($row['content_heading']);
$front_page['newsfeed']['page'][] = array('page' => $PLUGINS_DIRECTORY.'newsfeed/newsfeed.php', 'title' => NWSF_FP_2);
if ($sql -> db_Select("newsfeed", "newsfeed_id, newsfeed_name")) {
while ($row = $sql -> db_Fetch()) {
$front_page['newsfeed']['page'][] = array('page' => $PLUGINS_DIRECTORY.'newsfeed/newsfeed.php?show.'.$row['newsfeed_id'], 'title' => $row['newsfeed_name']);
return $frontPage;
}
}
?>