mirror of
https://github.com/e107inc/e107.git
synced 2025-03-14 01:19:44 +01:00
Created user/e_search addon and upgraded to v2 specs
This commit is contained in:
parent
60abccc1e2
commit
74a6cba8cd
@ -12,8 +12,10 @@
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
// MOVED TO user/e_search.php
|
||||
|
||||
/*
|
||||
|
||||
//TODO Move to e107_plugins/user/e_search.php and upgrade to v2.x spec.
|
||||
// advanced
|
||||
$advanced_where = "";
|
||||
if (isset($_GET['time']) && is_numeric($_GET['time'])) {
|
||||
|
78
e107_plugins/user/e_search.php
Normal file
78
e107_plugins/user/e_search.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2014 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* user/member e_search addon
|
||||
* replaces e107_handlers/search/: search_user.php, advanced_user.php,
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
// v2.x e_search addon.
|
||||
class user_search extends e_search // include plugin-folder in the name.
|
||||
{
|
||||
|
||||
function config()
|
||||
{
|
||||
$search = array(
|
||||
'name' => LAN_140,
|
||||
'table' => 'user',
|
||||
|
||||
'advanced' => array(
|
||||
'time' => array('type' => 'date', 'text' => LAN_SEARCH_62),
|
||||
),
|
||||
|
||||
'return_fields' => array('user_id', 'user_name', 'user_email', 'user_signature', 'user_join'),
|
||||
'search_fields' => array('user_name' => '1.2', 'user_signature' => '0.6'), // fields and weights.
|
||||
|
||||
'order' => array('user_join' => 'DESC'),
|
||||
'refpage' => 'user.php'
|
||||
);
|
||||
|
||||
return $search;
|
||||
}
|
||||
|
||||
/* Compile Database data for output */
|
||||
function compile($row)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$res = array();
|
||||
|
||||
$res['link'] = e107::getUrl()->create('user/profile/view', array(
|
||||
'id' => $row['user_id'],
|
||||
'name' => $row['user_name'])
|
||||
); //"user.php?id.".$row['user_id'];
|
||||
|
||||
$res['pre_title'] = $row['user_id']." | ";
|
||||
$res['title'] = $row['user_name'];
|
||||
$res['summary'] = $row['user_signature'] ? LAN_SEARCH_72.": ".$row['user_signature'] : LAN_SEARCH_73;
|
||||
$res['detail'] = LAN_SEARCH_74.": ".$tp->toDate($row['user_join'], "long");
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Advanced Where
|
||||
* @param $parm - data returned from $_GET
|
||||
*/
|
||||
function where($parm=null)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
$qry = "";
|
||||
|
||||
if (vartrue($parm['time']) && is_numeric($parm['time']))
|
||||
{
|
||||
$qry .= " user_join ".($_GET['on'] == 'new' ? '>=' : '<=')." '".(time() - $_GET['time'])."' AND";
|
||||
}
|
||||
|
||||
return $qry;
|
||||
}
|
||||
|
||||
}
|
@ -583,7 +583,7 @@ class search extends e_shortcode
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* BELOW CODE HAS BEEN MOVED TO e107_plugins/user/e_search.php)
|
||||
if(e107::getConfig('core')->get('user_reg')==1) // Only when user-registration is enabled.
|
||||
{
|
||||
if ($search_info['users'] = $this->search_info('users', 'core', false, array('sfile' => e_HANDLER.'search/search_user.php', 'qtype' => LAN_140, 'refpage' => 'user.php', 'advanced' => e_HANDLER.'search/advanced_user.php', 'id' => 'user'))) {
|
||||
@ -594,6 +594,7 @@ class search extends e_shortcode
|
||||
unset($search_info['users']);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
if ($search_info['pages'] = $this->search_info('pages', 'core', false, array('sfile' => e_HANDLER.'search/search_pages.php', 'qtype' => LAN_418, 'refpage' => 'page.php', 'advanced' => e_HANDLER.'search/advanced_pages.php', 'id' => 'pages'))) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user