Beispiel #1
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 '';
}
Beispiel #2
0
             $keywords = $blacklist->getAllKeywords();
             $blacklist->addkeywords($keyword);
             $blacklist->store();
         }
     }
     redirect_header('index.php?op=stats', 2, _AM_MYSEARCH_DBUPDATED);
     break;
     /**
      * Actions on the blacklist (add or remove keyword(s))
      */
 /**
  * Actions on the blacklist (add or remove keyword(s))
  */
 case 'MetagenBlackList':
     include_once XOOPS_ROOT_PATH . '/modules/mysearch/class/blacklist.php';
     $blacklist = new mysearch_blacklist();
     $keywords = $blacklist->getAllKeywords();
     if (isset($_POST['go']) && $_POST['go'] == _AM_MYSEARCH_DELETE) {
         foreach ($_POST['blacklist'] as $black_id) {
             $blacklist->delete($black_id);
         }
         $blacklist->store();
     } else {
         if (isset($_POST['go']) && $_POST['go'] == _AM_MYSEARCH_BLACKLIST_ADD) {
             $p_keywords = $_POST['keywords'];
             $keywords = explode("\n", $p_keywords);
             foreach ($keywords as $keyword) {
                 if (xoops_trim($keyword) != '') {
                     $blacklist->addkeywords(xoops_trim($keyword));
                 }
             }