if (!$value) { continue; } if (($GLOBALS['banword'] = $filterService->comprise($value)) !== false) { Showmsg('content_wordsfb'); } $tempKeywords[] = array('keyword' => $value, 'vieworder' => intval($new_view['vieworder'][$key]), 'fromtype' => 'custom', 'posttime' => $timestamp); } if ($tempKeywords) { $db->update("INSERT INTO pw_searchhotwords(keyword,vieworder,fromtype,posttime) VALUES " . S::sqlMulti($tempKeywords)); } $hotwordsconfig['shownum'] = abs(intval($hotwordsconfig['shownum'])); $hotwordsconfig['invokeperiod'] = abs(intval($hotwordsconfig['invokeperiod'])); $autoInvoke = array('isOpne' => $hotwordsconfig['openautoinvoke'], 'period' => $hotwordsconfig['invokeperiod']); L::loadClass('hotwordssearcher', 'search/userdefine'); $hotwordsServer = new PW_HotwordsSearcher(); $hotwordsServer->update($autoInvoke, $hotwordsconfig['shownum']); if (!$hotwordsconfig['shownum']) { setConfig('db_hotwords', ''); } if (!$hotwordsconfig['invokeperiod']) { pwQuery::delete('pw_searchhotwords', 'fromtype=:id', array('auto')); } $config['hotwordsconfig'] = $hotwordsconfig ? serialize($hotwordsconfig) : ''; setConfig('db_opensch', $config['opensch']); setConfig('db_openbuildattachs', $config['openbuildattachs']); setConfig('db_maxresult', $config['maxresult']); setConfig('db_schwait', $config['schwait']); setConfig('db_hotwordsconfig', $config['hotwordsconfig']); setConfig('db_filterids', $config['filterids']); setConfig('db_operate_log', $config['operate_log']);
function updateHotwords() { global $db_hotwordsconfig, $db_hotwordlasttime, $timestamp; if (!$db_hotwordsconfig) { return false; } $_config = unserialize($db_hotwordsconfig); if (!$_config['openautoinvoke']) { return false; } $_timeNode = 90000; if ($timestamp - $db_hotwordlasttime < $_timeNode) { return false; } $_autoInvoke = array('isOpne' => $_config['openautoinvoke'], 'period' => $_config['invokeperiod']); L::loadClass('hotwordssearcher', 'search/userdefine'); $hotwordsServer = new PW_HotwordsSearcher(); $hotwordsServer->update($_autoInvoke, $_config['shownum']); return true; }