mirror of
https://github.com/e107inc/e107.git
synced 2025-08-22 06:03:27 +02:00
new module creation
This commit is contained in:
43
e107_plugins/list_new/section/list_comment.php
Normal file
43
e107_plugins/list_new/section/list_comment.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
$data = $cobj->getCommentData(intval($arr[7]), '0', $qry);
|
||||
|
||||
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'];
|
||||
}
|
||||
}
|
||||
$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 );
|
||||
}
|
||||
|
||||
?>
|
38
e107_plugins/list_new/section/list_download.php
Normal file
38
e107_plugins/list_new/section/list_download.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
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);
|
||||
|
||||
$mp = MPREFIX;
|
||||
$qry = "SELECT download_id, download_name, download_author, download_datestamp, {$mp}download_category.download_category_id, {$mp}download_category.download_category_name, {$mp}download_category.download_category_class FROM {$mp}download LEFT JOIN {$mp}download_category ON {$mp}download.download_category={$mp}download_category.download_category_id WHERE download_category_class REGEXP '".e_CLASS_REGEXP."' AND download_class REGEXP '".e_CLASS_REGEXP."' AND {$mp}download.download_active != '0' ".$qry." ORDER BY download_datestamp DESC LIMIT 0,".intval($arr[7])." ";
|
||||
|
||||
$downloads = $sql -> db_Select_gen($qry);
|
||||
if($downloads == 0) {
|
||||
$LIST_DATA = LIST_DOWNLOAD_2;
|
||||
}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'] : "");
|
||||
//$AUTHOR = ($arr[3] ? (USERID ? "<a href='".e_BASE."user.php?id.".$row['download_author_id']."'>".$row['download_author']."</a>" : $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 );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
34
e107_plugins/list_new/section/list_members.php
Normal file
34
e107_plugins/list_new/section/list_members.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
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 user_ban='0' AND ";
|
||||
}else{
|
||||
$qry = " ";
|
||||
}
|
||||
$qry .= " (user_class = '' || user_class REGEXP '".e_CLASS_REGEXP."') ORDER BY user_join DESC LIMIT 0,".intval($arr[7]);
|
||||
|
||||
$bullet = $this -> getBullet($arr[6], $mode);
|
||||
|
||||
if(!$sql -> db_Select("user", "*", $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 );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
62
e107_plugins/list_new/section/list_news.php
Normal file
62
e107_plugins/list_new/section/list_news.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
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().") ";
|
||||
}
|
||||
|
||||
$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="(.*?)">(.*?)<\/a>/si";
|
||||
$replace[3] = '\\2';
|
||||
$search[4] = "/\<a href='(.*?)'>(.*?)<\/a>/si";
|
||||
$replace[4] = '\\2';
|
||||
$search[5] = "/\<a href='(.*?)'>(.*?)<\/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 );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user