1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-14 17:39:46 +01:00

Bugtracker #4645, #4646, #4647, #4848 - optimisations in list_new plugin - thanks Father B

This commit is contained in:
e107steved 2009-01-06 21:30:37 +00:00
parent 93a3ea9948
commit dc2b62ad48
3 changed files with 72 additions and 42 deletions

View File

@ -11,25 +11,31 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/list.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/list.php,v $
| $Revision: 1.2 $ | $Revision: 1.3 $
| $Date: 2008-12-11 22:38:06 $ | $Date: 2009-01-06 21:30:28 $
| $Author: e107steved $ | $Author: e107steved $
+---------------------------------------------------------------+ +---------------------------------------------------------------+
*/ */
require_once("../../class2.php"); require_once("../../class2.php");
$listplugindir = e_PLUGIN."list_new/"; $listplugindir = e_PLUGIN."list_new/";
//get language file //get language file
$lan_file = $listplugindir."languages/".e_LANGUAGE.".php"; include_lan($listplugindir."languages/".e_LANGUAGE.".php");
include_once(file_exists($lan_file) ? $lan_file : $listplugindir."languages/English.php");
if (!plugInstalled('list_new')) if (!plugInstalled('list_new'))
{ {
header("Location: ".e_BASE."index.php"); header("Location: ".e_BASE."index.php");
exit; exit;
} }
require_once($listplugindir."list_shortcodes.php"); require_once($listplugindir."list_shortcodes.php");
require_once($listplugindir."list_class.php"); if (!is_object($rc))
$rc = new listclass; {
require_once($listplugindir . "list_class.php");
$rc = new listclass;
}
require_once(e_HANDLER."form_handler.php"); require_once(e_HANDLER."form_handler.php");
$rs = new form; $rs = new form;
e107_require_once(e_HANDLER.'arraystorage_class.php'); e107_require_once(e_HANDLER.'arraystorage_class.php');
@ -39,7 +45,7 @@ unset($text);
require_once(HEADERF); require_once(HEADERF);
global $tp; global $tp,$list_pref;
// check query // check query
if(e_QUERY) if(e_QUERY)
@ -50,6 +56,7 @@ if(e_QUERY)
$mode = $qs[0]; $mode = $qs[0];
} }
} }
if(isset($mode) && $mode == "new") if(isset($mode) && $mode == "new")
{ {
$mode = "new_page"; $mode = "new_page";
@ -59,13 +66,17 @@ else
$mode = "recent_page"; //default to 'page' $mode = "recent_page"; //default to 'page'
} }
$list_pref = $rc -> getListPrefs(); if(!isset($list_pref))
{
$list_pref = $rc->getListPrefs();
}
$sections = $rc -> prepareSection($mode); $sections = $rc -> prepareSection($mode);
$arr = $rc -> prepareSectionArray($mode, $sections); $arr = $rc -> prepareSectionArray($mode, $sections);
$text = ""; $text = "";
$timelapse = 0; $timelapse = 0;
if(isset($qs[0]) && $qs[0] == "new"){ if(isset($qs[0]) && $qs[0] == "new")
{
if(isset($list_pref['new_page_timelapse']) && $list_pref['new_page_timelapse']){ if(isset($list_pref['new_page_timelapse']) && $list_pref['new_page_timelapse']){
if(isset($list_pref['new_page_timelapse_days']) && is_numeric($list_pref['new_page_timelapse_days'])){ if(isset($list_pref['new_page_timelapse_days']) && is_numeric($list_pref['new_page_timelapse_days'])){
$days = $list_pref['new_page_timelapse_days']; $days = $list_pref['new_page_timelapse_days'];
@ -96,18 +107,22 @@ $LIST_COL_COLS = $list_pref[$mode."_colomn"];
$LIST_COL_CELLWIDTH = round((100/$list_pref[$mode."_colomn"]),0); $LIST_COL_CELLWIDTH = round((100/$list_pref[$mode."_colomn"]),0);
$text .= $LIST_COL_START; $text .= $LIST_COL_START;
if($list_pref[$mode."_welcometext"]){ if($list_pref[$mode."_welcometext"])
{
$LIST_COL_WELCOMETEXT = $tp -> toHTML($list_pref[$mode."_welcometext"]); $LIST_COL_WELCOMETEXT = $tp -> toHTML($list_pref[$mode."_welcometext"]);
$text .= preg_replace("/\{(.*?)\}/e", '$\1', $LIST_COL_WELCOME); $text .= preg_replace("/\{(.*?)\}/e", '$\1', $LIST_COL_WELCOME);
} }
$k=0; $k=0;
for($i=0;$i<count($arr);$i++){ for($i=0;$i<count($arr);$i++)
{
unset($rowswitch); unset($rowswitch);
if($arr[$i][1] == "1"){ if($arr[$i][1] == "1")
{
$sectiontext = $rc -> show_section_list($arr[$i], $mode); $sectiontext = $rc -> show_section_list($arr[$i], $mode);
if($sectiontext != ""){ if($sectiontext != "")
if( intval($k/$list_pref[$mode."_colomn"]) == $k/$list_pref[$mode."_colomn"] ){ {
if( intval($k/$list_pref[$mode."_colomn"]) == $k/$list_pref[$mode."_colomn"] )
{
$rowswitch = $LIST_COL_ROWSWITCH; $rowswitch = $LIST_COL_ROWSWITCH;
} }
$text .= (isset($rowswitch) ? $rowswitch : ""); $text .= (isset($rowswitch) ? $rowswitch : "");

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/list_new_menu.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/list_new_menu.php,v $
| $Revision: 1.2 $ | $Revision: 1.3 $
| $Date: 2008-12-11 22:38:06 $ | $Date: 2009-01-06 21:30:28 $
| $Author: e107steved $ | $Author: e107steved $
+---------------------------------------------------------------+ +---------------------------------------------------------------+
*/ */
@ -24,36 +24,44 @@ if (!plugInstalled('list_new'))
return; return;
} }
global $sysprefs, $tp, $eArrayStorage; global $sysprefs, $tp, $eArrayStorage, $list_pref, $rc;
$listplugindir = e_PLUGIN."list_new/"; $listplugindir = e_PLUGIN . "list_new/";
unset($text); unset($text);
require_once($listplugindir."list_shortcodes.php"); require_once($listplugindir."list_shortcodes.php");
//get language file // get language file
$lan_file = $listplugindir."languages/".e_LANGUAGE.".php"; include_lan($listplugindir . "languages/" . e_LANGUAGE . ".php");
include_once(file_exists($lan_file) ? $lan_file : $listplugindir."languages/English.php");
require_once($listplugindir."list_class.php"); if (!is_object($rc))
$rc = new listclass; {
require_once($listplugindir . "list_class.php");
$rc = new listclass;
}
if(!isset($list_pref))
{
$list_pref = $rc->getListPrefs();
}
$list_pref = $rc -> getListPrefs();
$mode = "new_menu"; $mode = "new_menu";
$sections = $rc -> prepareSection($mode); $sections = $rc->prepareSection($mode);
$arr = $rc -> prepareSectionArray($mode, $sections); $arr = $rc->prepareSectionArray($mode, $sections);
// display the sections
//display the sections
$text = ""; $text = "";
for($i=0;$i<count($arr);$i++){ for($i = 0;$i < count($arr);$i++)
if($arr[$i][1] == "1"){ {
$sectiontext = $rc -> show_section_list($arr[$i], $mode); if ($arr[$i][1] == "1")
if($sectiontext != ""){ {
$sectiontext = $rc->show_section_list($arr[$i], $mode);
if ($sectiontext != "")
{
$text .= $sectiontext; $text .= $sectiontext;
} }
} }
} }
$caption = (isset($list_pref[$mode."_caption"]) && $list_pref[$mode."_caption"] ? $list_pref[$mode."_caption"] : LIST_MENU_1); $caption = (isset($list_pref[$mode."_caption"]) && $list_pref[$mode."_caption"] ? $list_pref[$mode."_caption"] : LIST_MENU_1);
$ns -> tablerender($caption, $text, 'list_new'); $ns->tablerender($caption, $text, 'list_new');
unset($text); unset($text);
?> ?>

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/list_recent_menu.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/list_recent_menu.php,v $
| $Revision: 1.3 $ | $Revision: 1.4 $
| $Date: 2008-12-11 22:38:06 $ | $Date: 2009-01-06 21:30:28 $
| $Author: e107steved $ | $Author: e107steved $
+---------------------------------------------------------------+ +---------------------------------------------------------------+
*/ */
@ -25,19 +25,26 @@ if (!plugInstalled('list_new'))
} }
global $sysprefs, $tp, $eArrayStorage; global $sysprefs, $tp, $eArrayStorage, $list_pref, $rc;
$listplugindir = e_PLUGIN."list_new/"; $listplugindir = e_PLUGIN."list_new/";
unset($text); unset($text);
require_once($listplugindir."list_shortcodes.php"); require_once($listplugindir."list_shortcodes.php");
//get language file //get language file
$lan_file = $listplugindir."languages/".e_LANGUAGE.".php"; include_lan($listplugindir."languages/".e_LANGUAGE.".php");
include_once(file_exists($lan_file) ? $lan_file : $listplugindir."languages/English.php");
require_once($listplugindir."list_class.php");
$rc = new listclass;
$list_pref = $rc -> getListPrefs(); if (!is_object($rc))
{
require_once($listplugindir . "list_class.php");
$rc = new listclass;
}
if(!isset($list_pref))
{
$list_pref = $rc->getListPrefs();
}
$mode = "recent_menu"; $mode = "recent_menu";
$sections = $rc -> prepareSection($mode); $sections = $rc -> prepareSection($mode);
$arr = $rc -> prepareSectionArray($mode, $sections); $arr = $rc -> prepareSectionArray($mode, $sections);