mirror of
https://github.com/e107inc/e107.git
synced 2025-08-08 23:56:58 +02:00
new module creation
This commit is contained in:
44
e107_plugins/content/search/search_advanced.php
Normal file
44
e107_plugins/content/search/search_advanced.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/search/search_advanced.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:08 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
$advanced['cat']['type'] = 'dropdown';
|
||||
$advanced['cat']['text'] = LAN_SEARCH_63.':';
|
||||
$advanced['cat']['list'][] = array('id' => 'all', 'title' => LAN_SEARCH_51);
|
||||
|
||||
$advanced_caption['id'] = 'cat';
|
||||
$advanced_caption['title']['all'] = CONT_SCH_LAN_2;
|
||||
|
||||
if ($sql -> db_Select("pcontent", "content_id, content_heading", "LEFT(content_parent,1)='0'")) {
|
||||
while ($row = $sql -> db_Fetch()) {
|
||||
$advanced['cat']['list'][] = array('id' => $row['content_id'], 'title' => $row['content_heading']);
|
||||
$advanced_caption['title'][$row['content_id']] = $row['content_heading'];
|
||||
}
|
||||
}
|
||||
|
||||
$advanced['date']['type'] = 'date';
|
||||
$advanced['date']['text'] = LAN_SEARCH_68.':';
|
||||
|
||||
$advanced['match']['type'] = 'dropdown';
|
||||
$advanced['match']['text'] = LAN_SEARCH_52.':';
|
||||
$advanced['match']['list'][] = array('id' => 0, 'title' => LAN_SEARCH_53);
|
||||
$advanced['match']['list'][] = array('id' => 1, 'title' => LAN_SEARCH_54);
|
||||
|
||||
?>
|
21
e107_plugins/content/search/search_comments.php
Normal file
21
e107_plugins/content/search/search_comments.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
$comments_title = 'Content';
|
||||
$comments_type_id = 'pcontent';
|
||||
$comments_return['content'] = "p.content_id, p.content_heading, p.content_parent";
|
||||
$comments_table['content'] = "LEFT JOIN #pcontent AS p ON c.comment_type='pcontent' AND p.content_id = c.comment_item_id";
|
||||
function com_search_pcontent($row) {
|
||||
global $con;
|
||||
$datestamp = $con -> convert_date($row['comment_datestamp'], "long");
|
||||
$res['link'] = e_PLUGIN."content/content.php?content.".$row['content_id'];
|
||||
$res['pre_title'] = CONT_SCH_LAN_3.': ';
|
||||
$res['title'] = $row['content_heading'];
|
||||
$res['summary'] = $row['comment_comment'];
|
||||
preg_match("/([0-9]+)\.(.*)/", $row['comment_author'], $user);
|
||||
$res['detail'] = LAN_SEARCH_7."<a href='user.php?id.".$user[1]."'>".$user[2]."</a>".LAN_SEARCH_8.$datestamp;
|
||||
return $res;
|
||||
}
|
||||
|
||||
?>
|
84
e107_plugins/content/search/search_parser.php
Normal file
84
e107_plugins/content/search/search_parser.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/search/search_parser.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:08 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
// advanced
|
||||
$advanced_where = "";
|
||||
if (isset($_GET['cat']) && is_numeric($_GET['cat'])) {
|
||||
$advanced_where .= " content_parent='".$_GET['cat']."' AND";
|
||||
}
|
||||
|
||||
if (isset($_GET['time']) && is_numeric($_GET['time'])) {
|
||||
$advanced_where .= " content_datestamp ".($_GET['on'] == 'new' ? '>=' : '<=')." '".(time() - $_GET['time'])."' AND";
|
||||
}
|
||||
|
||||
if (isset($_GET['match']) && $_GET['match']) {
|
||||
$search_fields = array('content_heading');
|
||||
} else {
|
||||
$search_fields = array('content_heading', 'content_subheading', 'content_summary', 'content_text');
|
||||
}
|
||||
|
||||
// basic
|
||||
$return_fields = 'content_id, content_heading, content_subheading, content_summary, content_text, content_datestamp, content_parent, content_author';
|
||||
$weights = array('1.2', '0.9', '0.6', '0.6');
|
||||
$no_results = LAN_198;
|
||||
$where = "content_class IN (".USERCLASS_LIST.") AND".$advanced_where;
|
||||
$order = array('content_datestamp' => DESC);
|
||||
|
||||
$ps = $sch -> parsesearch('pcontent', $return_fields, $search_fields, $weights, 'search_content', $no_results, $where, $order);
|
||||
$text .= $ps['text'];
|
||||
$results = $ps['results'];
|
||||
|
||||
|
||||
function search_content($row) {
|
||||
global $con, $sql;
|
||||
$res['link'] = e_PLUGIN."content/content.php?content.".$row['content_id'];
|
||||
$res['pre_title'] = "";
|
||||
$res['title'] = $row['content_heading'];
|
||||
$res['summary'] = $row['content_summary'].' '.$row['content_text'];
|
||||
|
||||
//get category heading
|
||||
if($row['content_parent'] == '0'){
|
||||
$qry = "
|
||||
SELECT c.content_heading
|
||||
FROM pcontent as c
|
||||
WHERE c.content_id = '".$row['content_id']."' ";
|
||||
}elseif(strpos($row['content_parent'], "0.") !== FALSE){
|
||||
$tmp = explode(".", $row['content_parent']);
|
||||
$qry = "
|
||||
SELECT c.content_heading
|
||||
FROM pcontent as c
|
||||
WHERE c.content_id = '".intval($tmp[1])."' ";
|
||||
}else{
|
||||
$qry = "
|
||||
SELECT c.*, p.*
|
||||
FROM pcontent as c
|
||||
LEFT JOIN pcontent as p ON p.content_id = c.content_parent
|
||||
WHERE c.content_id = '".$row['content_id']."' ";
|
||||
}
|
||||
|
||||
$sql -> db_Select_gen($qry);
|
||||
$cat = $sql -> db_Fetch();
|
||||
|
||||
$res['detail'] = LAN_SEARCH_3.$con -> convert_date($row['content_datestamp'], "long")." ".CONT_SCH_LAN_4." ".$cat['content_heading'];
|
||||
return $res;
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user