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

Move list_new functionality for downloads in to download plugin

This commit is contained in:
bugrain
2009-05-04 19:57:48 +00:00
parent 86424a142f
commit 78c7030698
3 changed files with 74 additions and 75 deletions

View File

@@ -1,18 +1,21 @@
<?php <?php
/* /*
* e107 website system + ----------------------------------------------------------------------------+
* | e107 website system
* Copyright (C) 2001-2008 e107 Inc (e107.org) |
* Released under the terms and conditions of the | ©Steve Dunstan 2001-2002
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) | http://e107.org
* | jalist@e107.org
* Download e_list Handler |
* | Released under the terms and conditions of the
* $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/section/list_download.php,v $ | GNU General Public License (http://gnu.org).
* $Revision: 1.4 $ |
* $Date: 2009-01-28 08:48:14 $ | $Source: /cvs_backup/e107_0.8/e107_plugins/download/e_list.php,v $
* $Author: lisa_ $ | $Revision: 1.1 $
* | $Date: 2009-05-04 19:57:23 $
| $Author: bugrain $
|
+----------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
@@ -39,15 +42,15 @@ class list_download
$bullet = $this->parent->getBullet($this->parent->settings['icon']); $bullet = $this->parent->getBullet($this->parent->settings['icon']);
$qry = "SELECT d.download_id, d.download_name, d.download_author, d.download_datestamp, $qry = "SELECT d.download_id, d.download_name, d.download_author, d.download_datestamp,
dc.download_category_id, dc.download_category_name, dc.download_category_class dc.download_category_id, dc.download_category_name, dc.download_category_class
FROM #download AS d FROM #download AS d
LEFT JOIN #download_category AS dc ON d.download_category=dc.download_category_id LEFT JOIN #download_category AS dc ON d.download_category=dc.download_category_id
WHERE dc.download_category_class REGEXP '".e_CLASS_REGEXP."' AND d.download_class REGEXP '".e_CLASS_REGEXP."' AND d.download_active != '0' ".$qry." WHERE dc.download_category_class REGEXP '".e_CLASS_REGEXP."' AND d.download_class REGEXP '".e_CLASS_REGEXP."' AND d.download_active != '0' ".$qry."
ORDER BY download_datestamp DESC LIMIT 0,".intval($this->parent->settings['amount'])." "; ORDER BY download_datestamp DESC LIMIT 0,".intval($this->parent->settings['amount'])." ";
$downloads = $this->parent->e107->sql->db_Select_gen($qry); $downloads = $this->parent->e107->sql->db_Select_gen($qry);
if($downloads == 0) if($downloads == 0)
{ {
$list_data = LIST_DOWNLOAD_2; $list_data = LIST_DOWNLOAD_2;
} }
@@ -70,11 +73,10 @@ class list_download
} }
//return array with 'records', (global)'caption', 'display' //return array with 'records', (global)'caption', 'display'
return array( return array(
'records'=>$list_data, 'records'=>$list_data,
'caption'=>$list_caption, 'caption'=>$list_caption,
'display'=>$list_display 'display'=>$list_display
); );
} }
} }
?> ?>

View File

@@ -9,9 +9,9 @@
* List Language * List Language
* *
| $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/languages/English.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/languages/English.php,v $
| $Revision: 1.6 $ | $Revision: 1.7 $
| $Date: 2009-01-27 21:34:02 $ | $Date: 2009-05-04 19:57:48 $
| $Author: lisa_ $ | $Author: bugrain $
* *
*/ */
@@ -48,12 +48,9 @@ define("LIST_COMMENT_5", "poll");
define("LIST_COMMENT_6", "docs"); define("LIST_COMMENT_6", "docs");
define("LIST_COMMENT_7", "bugtrack"); define("LIST_COMMENT_7", "bugtrack");
define("LIST_COMMENT_8", "content"); define("LIST_COMMENT_8", "content");
define("LIST_COMMENT_9", "download"); define("LIST_COMMENT_9", "");
define("LIST_COMMENT_10", "ideas"); define("LIST_COMMENT_10", "ideas");
define("LIST_DOWNLOAD_1", "downloads");
define("LIST_DOWNLOAD_2", "no downloads");
define("LIST_MEMBER_1", "members"); define("LIST_MEMBER_1", "members");
define("LIST_MEMBER_2", "no members"); define("LIST_MEMBER_2", "no members");

View File

@@ -9,9 +9,9 @@
* List Class * List Class
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/list_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/list_class.php,v $
* $Revision: 1.8 $ * $Revision: 1.9 $
* $Date: 2009-01-27 23:46:12 $ * $Date: 2009-05-04 19:57:48 $
* $Author: lisa_ $ * $Author: bugrain $
* *
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
@@ -37,10 +37,10 @@ class listclass
/** /**
* constructor * constructor
* *
* @param string $mode the mode of the caller (default, admin) * @param string $mode the mode of the caller (default, admin)
* @return void * @return void
* *
*/ */
function listclass($mode='') function listclass($mode='')
{ {
@@ -51,13 +51,13 @@ class listclass
//language //language
@include_lan($this->plugin_dir."languages/".e_LANGUAGE.".php"); @include_lan($this->plugin_dir."languages/".e_LANGUAGE.".php");
//template //template
if (is_readable(THEME."list_template.php")) if (is_readable(THEME."list_template.php"))
{ {
require_once(THEME."list_template.php"); require_once(THEME."list_template.php");
} }
else else
{ {
require_once($this->plugin_dir."list_template.php"); require_once($this->plugin_dir."list_template.php");
} }
@@ -74,15 +74,15 @@ class listclass
} }
//default sections (present in this list plugin) //default sections (present in this list plugin)
$this->defaultArray = array("news", "comment", "download", "members"); $this->defaultArray = array("news", "comment", "members");
} }
/** /**
* helper method, parse the template * helper method, parse the template
* *
* @param string $template the template to parse * @param string $template the template to parse
* @return string * @return string
* *
*/ */
function parseTemplate($template) function parseTemplate($template)
{ {
@@ -93,9 +93,9 @@ class listclass
/** /**
* get preferences, retrieve all preferences from core table * get preferences, retrieve all preferences from core table
* *
* @return array * @return array
* *
*/ */
function getListPrefs() function getListPrefs()
{ {
@@ -120,10 +120,10 @@ class listclass
/** /**
* prepareSection checks if the sections should be displayed * prepareSection checks if the sections should be displayed
* *
* @param string $mode the mode of the area (menu/page - new/recent) * @param string $mode the mode of the area (menu/page - new/recent)
* @return array * @return array
* *
*/ */
function prepareSection($mode) function prepareSection($mode)
{ {
@@ -143,10 +143,10 @@ class listclass
/** /**
* prepareSectionArray parses the preferences for each section * prepareSectionArray parses the preferences for each section
* *
* @param string $mode the mode of the area (menu/page - new/recent) * @param string $mode the mode of the area (menu/page - new/recent)
* @return array * @return array
* *
*/ */
function prepareSectionArray($mode) function prepareSectionArray($mode)
{ {
@@ -176,9 +176,9 @@ class listclass
/** /**
* getDefaultSections loads all default 'core' sections from the constructor * getDefaultSections loads all default 'core' sections from the constructor
* *
* @return void * @return void
* *
*/ */
function getDefaultSections() function getDefaultSections()
{ {
@@ -194,16 +194,16 @@ class listclass
//content needs this to split each main parent into separate sections //content needs this to split each main parent into separate sections
/** /**
* getContentSections loads all top level content categories * getContentSections loads all top level content categories
* *
* @param string $mode (default, add) * @param string $mode (default, add)
* @return void * @return void
* *
*/ */
function getContentSections($mode='') function getContentSections($mode='')
{ {
global $pref; global $pref;
if (!$content_install = isset($pref['plug_installed']['content'])) if (!$content_install = isset($pref['plug_installed']['content']))
{ {
return; return;
} }
@@ -232,9 +232,9 @@ class listclass
/** /**
* getSections loads all sections * getSections loads all sections
* *
* @return void * @return void
* *
*/ */
function getSections() function getSections()
{ {
@@ -265,9 +265,9 @@ class listclass
/** /**
* getDefaultPrefs retrieve all default preferences (if none present) * getDefaultPrefs retrieve all default preferences (if none present)
* *
* @return array * @return array
* *
*/ */
function getDefaultPrefs() function getDefaultPrefs()
{ {
@@ -398,10 +398,10 @@ class listclass
/** /**
* displaySection, prepare and render a section * displaySection, prepare and render a section
* *
* @param array $arr the array of preferences for this section * @param array $arr the array of preferences for this section
* @return string * @return string
* *
*/ */
function displaySection($arr) function displaySection($arr)
{ {
@@ -447,10 +447,10 @@ class listclass
/** /**
* parseRecord renders the items within a section * parseRecord renders the items within a section
* *
* @param string $area the area for display * @param string $area the area for display
* @return string * @return string
* *
*/ */
function parseRecord($area) function parseRecord($area)
{ {
@@ -485,9 +485,9 @@ class listclass
/** /**
* load_elist loads and checks all e_list.php files * load_elist loads and checks all e_list.php files
* *
* @return array * @return array
* *
*/ */
function load_elist() function load_elist()
{ {
@@ -532,10 +532,10 @@ class listclass
/** /**
* load_data calls the class from the e_list file and retrieves the data * load_data calls the class from the e_list file and retrieves the data
* *
* @param string $file the section to load (class name) * @param string $file the section to load (class name)
* @return array * @return array
* *
*/ */
function load_data($file) function load_data($file)
{ {
@@ -566,9 +566,9 @@ class listclass
/** /**
* get datestamp last visit * get datestamp last visit
* *
* @return int datestamp * @return int datestamp
* *
*/ */
function getlvisit() function getlvisit()
{ {
@@ -598,10 +598,10 @@ class listclass
/** /**
* get bullet icon, either use the icon set in admin or the default theme bullet * get bullet icon, either use the icon set in admin or the default theme bullet
* *
* @param string $icon the icon to use as set in admin * @param string $icon the icon to use as set in admin
* @return string $bullet * @return string $bullet
* *
*/ */
function getBullet($icon) function getBullet($icon)
{ {
@@ -636,10 +636,10 @@ class listclass
/** /**
* helper method, parse heading to specific length with postfix * helper method, parse heading to specific length with postfix
* *
* @param string $heading the heading from the item record * @param string $heading the heading from the item record
* @return string $heading the parsed heading * @return string $heading the parsed heading
* *
*/ */
function parse_heading($heading) function parse_heading($heading)
{ {
@@ -652,10 +652,10 @@ class listclass
/** /**
* helper method, format the date * helper method, format the date
* *
* @param int $datestamp the datestamp of the item record * @param int $datestamp the datestamp of the item record
* @return string the formatted date * @return string the formatted date
* *
*/ */
function getListDate($datestamp) function getListDate($datestamp)
{ {
@@ -690,9 +690,9 @@ class listclass
/** /**
* display timelapse element (on newpage) * display timelapse element (on newpage)
* *
* @return string the timelapse element * @return string the timelapse element
* *
*/ */
function displayTimelapse() function displayTimelapse()
{ {
@@ -731,9 +731,9 @@ class listclass
/** /**
* display the page (either recent or new) * display the page (either recent or new)
* *
* @return string * @return string
* *
*/ */
function displayPage() function displayPage()
{ {
@@ -744,7 +744,7 @@ class listclass
{ {
$this->list_pref = $this->getListPrefs(); $this->list_pref = $this->getListPrefs();
} }
//get sections //get sections
$this->sections = $this->prepareSection($this->mode); $this->sections = $this->prepareSection($this->mode);
$arr = $this->prepareSectionArray($this->mode); $arr = $this->prepareSectionArray($this->mode);
@@ -790,9 +790,9 @@ class listclass
/** /**
* display the menu (either recent or new) * display the menu (either recent or new)
* *
* @return string * @return string
* *
*/ */
function displayMenu() function displayMenu()
{ {