Ejemplo n.º 1
0
function b_mysearch_last_search_show()
{
    include_once XOOPS_ROOT_PATH . '/modules/mysearch/include/functions.php';
    $mysearch_handler =& xoops_getmodulehandler('searches', 'mysearch');
    $visiblekeywords = 0;
    $block = array();
    $visiblekeywords = mysearch_getmoduleoption('showindex');
    if ($visiblekeywords > 0) {
        $block['visiblekeywords'] = $visiblekeywords;
        $totalcount = $mysearch_handler->getCount();
        $start = 0;
        $critere = new Criteria('mysearchid', 0, '<>');
        $critere->setSort('datesearch');
        $critere->setLimit($visiblekeywords);
        $critere->setStart($start);
        $critere->setOrder('DESC');
        $tmpmysearch = new searches();
        $elements = $mysearch_handler->getObjects($critere);
        foreach ($elements as $oneelement) {
            $search = array();
            $search['keyword'] = $oneelement->getVar('keyword');
            $search['date'] = formatTimestamp(strtotime($oneelement->getVar('datesearch')));
            $search['uid'] = $oneelement->getVar('keyword');
            $search['uname'] = $tmpmysearch->uname($oneelement->getVar('uid'));
            $search['link'] = "<a href='" . XOOPS_URL . '/search.php?query=' . $oneelement->getVar('keyword') . "&action=results' target='_blank'>";
            $block['searches'][] = $search;
            unset($search);
        }
    }
    return $block;
}
Ejemplo n.º 2
0
function b_mysearch_stats_show()
{
    include_once XOOPS_ROOT_PATH . "/modules/mysearch/include/functions.php";
    $mysearch_handler =& xoops_getmodulehandler('searches', 'mysearch');
    $block = array();
    $visiblekeywords = mysearch_getmoduleoption('showindex');
    if ($visiblekeywords > 0) {
        $keywords_count = mysearch_getmoduleoption('admincount');
        // Total keywords count
        $block['total_keywords'] = $mysearch_handler->getCount();
        // Most searched elements
        $elements = $mysearch_handler->getMostSearched(0, $keywords_count);
        foreach ($elements as $keywordid => $datas) {
            $block['mostsearched'][] = array('keyword' => $datas['keyword'], 'count' => $datas['count']);
        }
    }
    return $block;
}
function b_mysearch_big_user_show()
{
    include_once XOOPS_ROOT_PATH . "/modules/mysearch/include/functions.php";
    $mysearch_handler =& xoops_getmodulehandler('searches', 'mysearch');
    $block = array();
    $visiblekeywords = mysearch_getmoduleoption('showindex');
    if ($visiblekeywords > 0) {
        $tmpmysearch = new searches();
        $keywords_count = mysearch_getmoduleoption('admincount');
        // Total keywords count
        $block['total_keywords'] = $mysearch_handler->getCount();
        // Biggest users
        $elements = $mysearch_handler->getBiggestContributors(0, $keywords_count);
        foreach ($elements as $oneuser => $onecount) {
            $block['biggesusers'][] = array('uid' => $oneuser, 'uname' => $tmpmysearch->uname($oneuser), 'count' => $onecount);
        }
    }
    return $block;
}
Ejemplo n.º 4
0
function mysearch_search($queryarray, $andor, $limit, $offset, $userid)
{
    global $xoopsUser;
    include_once XOOPS_ROOT_PATH . '/modules/mysearch/include/functions.php';
    include_once XOOPS_ROOT_PATH . '/modules/mysearch/class/blacklist.php';
    $mysearch_handler =& xoops_getmodulehandler('searches', 'mysearch');
    $banned = array();
    $banned = mysearch_getmoduleoption('bannedgroups');
    $uid = 0;
    $datesearch = date('Y-m-d H:i:s');
    if (is_object($xoopsUser)) {
        $groups = $xoopsUser->getGroups();
        $uid = $xoopsUser->getVar('uid');
    } else {
        $groups = array(XOOPS_GROUP_ANONYMOUS);
    }
    $blacklist = new mysearch_blacklist();
    $blacklist->getAllKeywords();
    // Load keywords from blacklist
    $queryarray = $blacklist->remove_blacklisted($queryarray);
    $count = count($queryarray);
    if (count(array_intersect($groups, $banned)) == 0 && $userid == 0) {
        // If it's not a banned user and if we are not viewing someone's profile
        if (is_array($queryarray) && $count > 0) {
            for ($i = 0; $i < $count; $i++) {
                $mysearch = $mysearch_handler->create(true);
                $mysearch->setVar('uid', $uid);
                $mysearch->setVar('datesearch', $datesearch);
                $mysearch->setVar('keyword', $queryarray[$i]);
                $res = $mysearch_handler->insert($mysearch);
            }
        }
    }
    return '';
}
Ejemplo n.º 5
0
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
include_once '../../../include/cp_header.php';
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
include_once XOOPS_ROOT_PATH . '/modules/mysearch/admin/functions.php';
include_once XOOPS_ROOT_PATH . '/modules/mysearch/include/functions.php';
if (file_exists(XOOPS_ROOT_PATH . '/modules/mysearch/language/' . $xoopsConfig['language'] . '/main.php')) {
    include_once XOOPS_ROOT_PATH . '/modules/mysearch/language/' . $xoopsConfig['language'] . '/main.php';
} else {
    include_once XOOPS_ROOT_PATH . '/modules/mysearch/language/english/main.php';
}
/**
 * Module's parameters
 */
$keywords_count = mysearch_getmoduleoption('admincount');
// **********************************************************************************************************************************************
// **** Main
// **********************************************************************************************************************************************
$op = 'default';
if (isset($_POST['op'])) {
    $op = $_POST['op'];
} elseif (isset($_GET['op'])) {
    $op = $_GET['op'];
}
$mysearch_handler =& xoops_getmodulehandler('searches', 'mysearch');
$myts =& MyTextSanitizer::getInstance();
switch ($op) {
    /**
     * Remove datas by keyword or by date
     */
Ejemplo n.º 6
0
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
include "../../mainfile.php";
$xoopsOption['template_main'] = 'mysearch_index.html';
include_once XOOPS_ROOT_PATH . '/header.php';
include_once XOOPS_ROOT_PATH . '/modules/mysearch/include/functions.php';
$mysearch_handler =& xoops_getmodulehandler('searches', 'mysearch');
$visiblekeywords = 0;
$visiblekeywords = mysearch_getmoduleoption('showindex');
$xoopsTpl->assign('visiblekeywords', $visiblekeywords);
if ($visiblekeywords > 0) {
    $totalcount = $mysearch_handler->getCount();
    $start = isset($_GET['start']) ? intval($_GET['start']) : 0;
    $critere = new Criteria('keyword');
    $critere->setSort('datesearch');
    $critere->setLimit($visiblekeywords);
    $critere->setStart($start);
    $critere->setOrder('DESC');
    include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
    $pagenav = new XoopsPageNav($totalcount, $visiblekeywords, $start, 'start', '');
    $xoopsTpl->assign('pagenav', $pagenav->renderNav());
    $elements = $mysearch_handler->getObjects($critere);
    foreach ($elements as $oneelement) {
        $xoopsTpl->append('keywords', array('keyword' => $oneelement->getVar('keyword'), 'date' => formatTimestamp(strtotime($oneelement->getVar('datesearch')))));