1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-20 21:32:09 +02:00

recode list_new plugin + e_list.php files

This commit is contained in:
lisa
2009-01-27 21:34:02 +00:00
parent 0659cacb63
commit dab9ef360c
19 changed files with 2213 additions and 1613 deletions

View File

@@ -1,43 +1,99 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Comment e_list Handler
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/section/list_comment.php,v $
* $Revision: 1.2 $
* $Date: 2009-01-27 21:34:02 $
* $Author: lisa_ $
*
*/
if (!defined('e107_INIT')) { exit; }
require_once(e_HANDLER."comment_class.php");
$cobj = new comment;
$LIST_CAPTION = $arr[0];
$LIST_DISPLAYSTYLE = ($arr[2] ? "" : "none");
$bullet = $this -> getBullet($arr[6], $mode);
$qry = '';
if($mode == "new_page" || $mode == "new_menu" ){
$lvisit = $this -> getlvisit();
$qry = "comment_datestamp>".$lvisit;
global $tp, $cobj;
if(!is_object($cobj))
{
require_once(e_HANDLER."comment_class.php");
$cobj = new comment;
}
$data = $cobj->getCommentData(intval($arr[7]), '0', $qry);
class list_comment
{
function list_comment($parent)
{
$this->parent = $parent;
}
foreach($data as $row){
$rowheading = $this -> parse_heading($row['comment_title'], $mode);
if($row['comment_url']){
$HEADING = "<a href='".$row['comment_url']."' title='".$row['comment_title']."'>".$tp -> toHTML($rowheading, TRUE)."</a>";
}else{
$HEADING = $tp -> toHTML($rowheading, TRUE);
}
$CATEGORY = '';
if($arr[4]){
if($row['comment_category_url']){
$CATEGORY = "<a href='".$row['comment_category_url']."'>".$row['comment_category_heading']."</a>";
}else{
$CATEGORY = $row['comment_category_heading'];
function getListData()
{
global $tp, $cobj;
$list_caption = $this->parent->settings['caption'];
$list_display = ($this->parent->settings['open'] ? "" : "none");
$bullet = $this->parent->getBullet($this->parent->settings['icon']);
$qry = '';
if($this->parent->mode == "new_page" || $this->parent->mode == "new_menu" )
{
$qry = "comment_datestamp>".$this->parent->getlvisit();
}
$data = $cobj->getCommentData(intval($this->parent->settings['amount']), '0', $qry);
if(empty($data))
{
$list_data = LIST_COMMENT_2;
}
else
{
$list_data = array();
foreach($data as $row)
{
$record = array();
$rowheading = $this->parent->parse_heading($row['comment_title']);
$record['icon'] = $bullet;
if($row['comment_url'])
{
$record['heading'] = "<a href='".$row['comment_url']."' title='".$row['comment_title']."'>".$this->parent->e107->tp->toHTML($rowheading, TRUE)."</a>";
}
else
{
$record['heading'] = $this->parent->e107->tp->toHTML($rowheading, TRUE);
}
$category = '';
if(varsettrue($this->parent->settings['category']))
{
if($row['comment_category_url'])
{
$record['category'] = "<a href='".$row['comment_category_url']."'>".$row['comment_category_heading']."</a>";
}
else
{
$record['category'] = $row['comment_category_heading'];
}
}
$record['author'] = (varsettrue($this->parent->settings['author']) ? $row['comment_author'] : '');
$record['date'] = (varsettrue($this->parent->settings['date']) ? $this->parent->getListDate($row['comment_datestamp']) : "");
$record['icon'] = $bullet;
$record['info'] = '';
$list_data[] = $record;
}
}
//return array with 'records', (global)'caption', 'display'
return array(
'records'=>$list_data,
'caption'=>$list_caption,
'display'=>$list_display
);
}
$AUTHOR = ($arr[3] ? $row['comment_author'] : '');
$DATE = ($arr[5] ? $this -> getListDate($row['comment_datestamp'], $mode) : "");
$ICON = $bullet;
$INFO = '';
$LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO );
}
?>

View File

@@ -1,45 +1,80 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Download e_list Handler
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/section/list_download.php,v $
* $Revision: 1.3 $
* $Date: 2009-01-27 21:34:02 $
* $Author: lisa_ $
*
*/
if (!defined('e107_INIT')) { exit; }
$LIST_CAPTION = $arr[0];
$LIST_DISPLAYSTYLE = ($arr[2] ? "" : "none");
if($mode == "new_page" || $mode == "new_menu" ){
$lvisit = $this -> getlvisit();
$qry = " AND download_datestamp>".$lvisit;
}else{
$qry = " ";
}
$bullet = $this -> getBullet($arr[6], $mode);
$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
FROM #download AS d
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."
ORDER BY download_datestamp DESC LIMIT 0,".intval($arr[7])." ";
$downloads = $sql -> db_Select_gen($qry);
if($downloads == 0)
class list_download
{
function list_download($parent)
{
$LIST_DATA = LIST_DOWNLOAD_2;
$this->parent = $parent;
}
else
{
while($row = $sql -> db_Fetch())
{
$rowheading = $this -> parse_heading($row['download_name'], $mode);
$ICON = $bullet;
$HEADING = "<a href='".e_BASE."download.php?view.".$row['download_id']."' title='".$row['download_name']."'>".$rowheading."</a>";
$AUTHOR = ($arr[3] ? $row['download_author'] : "");
$CATEGORY = ($arr[4] ? "<a href='".e_BASE."download.php?list.".$row['download_category_id']."'>".$row['download_category_name']."</a>" : "");
$DATE = ($arr[5] ? $this -> getListDate($row['download_datestamp'], $mode) : "");
$INFO = "";
$LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO );
}
function getListData()
{
$list_caption = $this->parent->settings['caption'];
$list_display = ($this->parent->settings['open'] ? "" : "none");
if($this->parent->mode == "new_page" || $this->parent->mode == "new_menu" )
{
$qry = " AND download_datestamp>".$this->parent->getlvisit();
}
else
{
$qry = '';
}
$bullet = $this->parent->getBullet($this->parent->settings['icon']);
$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
FROM #download AS d
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."
ORDER BY download_datestamp DESC LIMIT 0,".intval($this->parent->settings['amount'])." ";
$downloads = $this->parent->e107->sql->db_Select_gen($qry);
if($downloads == 0)
{
$list_data = LIST_DOWNLOAD_2;
}
else
{
$list_data = array();
while($row = $this->parent->e107->sql->db_Fetch())
{
$record = array();
$rowheading = $this->parent->parse_heading($row['download_name']);
$record['icon'] = $bullet;
$record['heading'] = "<a href='".e_BASE."download.php?view.".$row['download_id']."' title='".$row['download_name']."'>".$rowheading."</a>";
$record['author'] = (varsettrue($this->parent->settings['author']) ? $row['download_author'] : "");
$record['category'] = (varsettrue($this->parent->settings['category']) ? "<a href='".e_BASE."download.php?list.".$row['download_category_id']."'>".$row['download_category_name']."</a>" : "");
$record['date'] = (varsettrue($this->parent->settings['date']) ? $this->parent->getListDate($row['download_datestamp']) : "");
$record['info'] = "";
$list_data[] = $record;
}
}
//return array with 'records', (global)'caption', 'display'
return array(
'records'=>$list_data,
'caption'=>$list_caption,
'display'=>$list_display
);
}
}
?>

View File

@@ -1,34 +1,68 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Members e_list Handler
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/section/list_members.php,v $
* $Revision: 1.4 $
* $Date: 2009-01-27 21:34:02 $
* $Author: lisa_ $
*
*/
if (!defined('e107_INIT')) { exit; }
$LIST_CAPTION = $arr[0];
$LIST_DISPLAYSTYLE = ($arr[2] ? "" : "none");
if($mode == "new_page" || $mode == "new_menu" ){
$lvisit = $this -> getlvisit();
$qry = "user_join>".$lvisit." AND ";
}else{
$qry = " ";
class list_members
{
function list_members($parent)
{
$this->parent = $parent;
}
$qry .= " user_ban=0 ORDER BY user_join DESC LIMIT 0,".intval($arr[7]);
$bullet = $this -> getBullet($arr[6], $mode);
function getListData()
{
$list_caption = $this->parent->settings['caption'];
$list_display = ($this->parent->settings['open'] ? "" : "none");
if(!$sql -> db_Select("user", "user_id,user_name,user_join", $qry)){
$LIST_DATA = LIST_MEMBER_2;
}else{
while($row = $sql -> db_Fetch()){
$rowheading = $this -> parse_heading($row['user_name'], $mode);
$ICON = $bullet;
$HEADING = (USER ? "<a href='".e_BASE."user.php?id.".$row['user_id']."' title='".$row['user_name']."'>".$rowheading."</a>" : $rowheading);
$CATEGORY = "";
$AUTHOR = "";
$DATE = ($arr[5] ? $this -> getListDate($row['user_join'], $mode) : "");
$INFO = "";
$LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO );
$qry = '';
if($this->parent->mode == "new_page" || $this->parent->mode == "new_menu" )
{
$qry = "user_join>".$this->parent->getlvisit()." AND ";
}
$qry .= " user_ban=0 ORDER BY user_join DESC LIMIT 0,".intval($this->parent->settings['amount']);
$bullet = $this->parent->getBullet($this->parent->settings['icon']);
if(!$this->parent->e107->sql->db_Select_gen("SELECT user_id,user_name,user_join FROM #user WHERE ".$qry))
{
$list_data = LIST_MEMBER_2;
}
else
{
while($row = $this->parent->e107->sql->db_Fetch())
{
$record = array();
$rowheading = $this->parent->parse_heading($row['user_name']);
$record['icon'] = $bullet;
$record['heading'] = (USER ? "<a href='".e_BASE."user.php?id.".$row['user_id']."' title='".$row['user_name']."'>".$rowheading."</a>" : $rowheading);
$record['category'] = '';
$record['author'] = '';
$record['date'] = (varsettrue($this->parent->settings['date']) ? $this->parent->getListDate($row['user_join']) : "");
$record['info'] = '';
$list_data[] = $record;
}
}
//return array with 'records', (global)'caption', 'display'
return array(
'records'=>$list_data,
'caption'=>$list_caption,
'display'=>$list_display
);
}
}
?>

View File

@@ -1,62 +1,131 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* News e_list Handler
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/section/list_news.php,v $
* $Revision: 1.2 $
* $Date: 2009-01-27 21:34:02 $
* $Author: lisa_ $
*
*/
if (!defined('e107_INIT')) { exit; }
if($mode == "new_page" || $mode == "new_menu" ){
$lvisit = $this -> getlvisit();
$qry = " news_datestamp>".$lvisit;
}else{
$qry = " (news_start=0 || news_start < ".time().") AND (news_end=0 || news_end>".time().") ";
class list_news
{
function list_news($parent)
{
$this->parent = $parent;
}
$bullet = $this -> getBullet($arr[6], $mode);
$LIST_CAPTION = $arr[0];
$LIST_DISPLAYSTYLE = ($arr[2] ? "" : "none");
$qry = "
SELECT n.*, c.category_id AS news_category_id, c.category_name AS news_category_name, u.user_id AS news_author_id, u.user_name AS news_author_name
FROM #news AS n
LEFT JOIN #news_category AS c ON c.category_id = n.news_category
LEFT JOIN #user AS u ON n.news_author = u.user_id
WHERE ".$qry." AND n.news_class REGEXP '".e_CLASS_REGEXP."'
ORDER BY n.news_datestamp DESC LIMIT 0,".intval($arr[7])."
";
if(!$sql -> db_Select_gen($qry)){
$LIST_DATA = LIST_NEWS_2;
}else{
while($row = $sql -> db_Fetch()){
// Code from Lisa
// copied from the rss creation, but added here to make sure the url for the newsitem is to the news.php?item.X
// instead of the actual hyperlink that may have been added to a newstitle on creation
$search = array();
$replace = array();
$search[0] = "/\<a href=\"(.*?)\">(.*?)<\/a>/si";
$replace[0] = '\\2';
$search[1] = "/\<a href='(.*?)'>(.*?)<\/a>/si";
$replace[1] = '\\2';
$search[2] = "/\<a href='(.*?)'>(.*?)<\/a>/si";
$replace[2] = '\\2';
$search[3] = "/\<a href=&quot;(.*?)&quot;>(.*?)<\/a>/si";
$replace[3] = '\\2';
$search[4] = "/\<a href=&#39;(.*?)&#39;>(.*?)<\/a>/si";
$replace[4] = '\\2';
$search[5] = "/\<a href=&#039;(.*?)&#039;>(.*?)<\/a>/si";
$replace[5] = '\\2';
$news_title = preg_replace($search, $replace, $row['news_title']);
// End of code from Lisa
$rowheading = $this -> parse_heading($news_title, $mode);
$ICON = $bullet;
$HEADING = "<a href='".e_BASE."news.php?item.".$row['news_id']."' title='".$rowheading."'>".$rowheading."</a>";
$AUTHOR = ($arr[3] ? ($row['news_author'] == 0 ? $row['news_author'] : ($row['news_author_name'] ? "<a href='".e_BASE."user.php?id.".$row['news_author_id']."'>".$row['news_author_name']."</a>" : "") ) : "");
$CATEGORY = ($arr[4] ? "<a href='".e_BASE."news.php?cat.".$row['news_category_id']."'>".$row['news_category_name']."</a>" : "");
$DATE = ($arr[5] ? $this -> getListDate($row['news_datestamp'], $mode) : "");
$INFO = "";
$LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO );
function getListData()
{
if($this->parent->mode == "new_page" || $this->parent->mode == "new_menu" )
{
$qry = " n.news_datestamp>".$this->parent->getlvisit();
}
else
{
$qry = " (n.news_start=0 || n.news_start < ".time().") AND (n.news_end=0 || n.news_end>".time().") ";
}
$bullet = $this->parent->getBullet($this->parent->settings['icon']);
$list_caption = $this->parent->settings['caption'];
$list_display = (varsettrue($this->parent->settings['open']) ? '' : 'none');
$qry = "
SELECT n.*, c.category_id AS news_category_id, c.category_name AS news_category_name, u.user_id AS news_author_id, u.user_name AS news_author_name
FROM #news AS n
LEFT JOIN #news_category AS c ON c.category_id = n.news_category
LEFT JOIN #user AS u ON n.news_author = u.user_id
WHERE ".$qry." AND n.news_class REGEXP '".e_CLASS_REGEXP."'
ORDER BY n.news_datestamp DESC LIMIT 0,".intval($this->parent->settings['amount']);
if(!$this->parent->e107->sql->db_Select_gen($qry))
{
$list_data = LIST_NEWS_2;
}
else
{
$list_data = array();
while($row=$this->parent->e107->sql->db_Fetch())
{
$row['news_title'] = $this->parse_news_title($row['news_title']);
$rowheading = $this->parent->parse_heading($row['news_title']);
$record = array();
$record['icon'] = $bullet;
$record['heading'] = "<a href='".e_BASE."news.php?item.".$row['news_id']."' title='".$rowheading."'>".$rowheading."</a>";
$record['author'] = '';
if(varsettrue($this->parent->settings['author']))
{
if($row['news_author'] == 0)
{
$record['author'] = $row['news_author'];
}
else
{
if(varsettrue($row['news_author_name']))
{
$record['author'] = "<a href='".e_BASE."user.php?id.".$row['news_author_id']."'>".$row['news_author_name']."</a>";
}
}
}
$record['category'] = '';
if(varsettrue($this->parent->settings['category']))
{
$record['category'] = "<a href='".e_BASE."news.php?cat.".$row['news_category_id']."'>".$row['news_category_name']."</a>";
}
$record['date'] = '';
if(varsettrue($this->parent->settings['date']))
{
$record['date'] = $this->parent->getListDate($row['news_datestamp']);
}
$record['info'] = '';
//collect each result
$list_data[] = $record;
}
}
//return array with 'records', (global)'caption', 'display'
return array(
'records'=>$list_data,
'caption'=>$list_caption,
'display'=>$list_display
);
}
//helpers
function parse_news_title($title)
{
// copied from the rss creation, but added here to make sure the url for the newsitem is to the news.php?item.X
// instead of the actual hyperlink that may have been added to a newstitle on creation
$search = array();
$replace = array();
$search[0] = "/\<a href=\"(.*?)\">(.*?)<\/a>/si";
$replace[0] = '\\2';
$search[1] = "/\<a href='(.*?)'>(.*?)<\/a>/si";
$replace[1] = '\\2';
$search[2] = "/\<a href='(.*?)'>(.*?)<\/a>/si";
$replace[2] = '\\2';
$search[3] = "/\<a href=&quot;(.*?)&quot;>(.*?)<\/a>/si";
$replace[3] = '\\2';
$search[4] = "/\<a href=&#39;(.*?)&#39;>(.*?)<\/a>/si";
$replace[4] = '\\2';
$search[5] = "/\<a href=&#039;(.*?)&#039;>(.*?)<\/a>/si";
$replace[5] = '\\2';
return preg_replace($search, $replace, $title);
}
}
?>