public static function sendToDbNdx_static($id, $cont)
 {
     $dbc = XenForo_Application::get('db');
     $cont = serialize($cont);
     $cont = ProfileNdx_indexer_shared::mysql_escape_mimic_fromPhpDoc($cont, $dbc);
     $dbc->query("INSERT INTO kiror_index_profile VALUES ('" . $id . "','" . $cont . "')\n\t\t\t\t\t ON DUPLICATE KEY UPDATE things='" . $cont . "';");
 }
 /**
  * Lines 231 to 241 from \\(xf)/library/XenForo/ControllerPublic/Account.php
  * @override
  * 
  * Save profile data
  *
  * @return XenForo_ControllerResponse_Redirect
  */
 public function actionPersonalDetailsSave()
 {
     $returnValue = parent::actionPersonalDetailsSave();
     ProfileNdx_indexer_shared::updateDbTableUserIndex();
     return $returnValue;
 }
 public static function validateString($field, $value, $error)
 {
     ProfileNdx_indexer_shared::sendToDbNdx(XenForo_Application::get('db'), 'preprocessedStatistic', array());
     $data = $value->getNewData()['xf_option']['option_value'];
     if ($data == '') {
         return true;
     }
     $xfopt = explode(',', $data);
     $xfo = array();
     foreach ($xfopt as $k => $v) {
         $xfo[$k] = trim($v);
     }
     $var = $xfo;
     unset($k);
     unset($v);
     unset($xfo);
     unset($xfopt);
     $valids = ProfileNdx_indexer_shared::getCustomUserFieldsArray();
     $error = 'Failed when tried asserting the existance of these fields:';
     $errors = array();
     foreach ($var as $test) {
         if (!array_key_exists($test, $valids)) {
             $errors[] = ' <u><b>' . $test . '</b></u>,';
         }
     }
     foreach ($errors as $e) {
         $error .= $e;
     }
     $error = rtrim($error, ",");
     if (count($errors) > 0) {
         throw new XenForo_Exception($error, true);
     } else {
         return true;
     }
 }
 public function search($q)
 {
     if (trim($q) == '') {
         return array();
     }
     $rawProfiles = ProfileNdx_indexer_shared::recoverFromDbNdx('usersProfiles');
     $rawProfiles = $this->filterSearchInput($rawProfiles);
     $xfopt = XenForo_Application::get('options');
     $xfopt = $xfopt->searchable;
     $xfopt = explode(',', $xfopt);
     $xfo = array();
     foreach ($xfopt as $k => $v) {
         $xfo[$k] = trim($v);
     }
     $res = array();
     $cfDic = ProfileNdx_indexer_shared::getCustomUserFieldsArray();
     foreach ($rawProfiles as $userN => $info) {
         $match = array();
         foreach ($info as $id => $label) {
             if (in_array($id, $xfo)) {
                 $n = 0;
                 $thisLab = $cfDic[$id];
                 if (!is_array($label)) {
                     $label = array($label);
                 }
                 $searchable = array();
                 foreach ($label as $cufChng) {
                     $d = '';
                     if (array_key_exists($id . '_choice_' . $cufChng, $cfDic)) {
                         $d = $cfDic[$id . '_choice_' . $cufChng];
                     } else {
                         $d = $cufChng;
                     }
                     $searchable[] = $d;
                 }
                 $n = $this->repeatingTimes($this->plainifyArrayOfStrings($searchable), $q);
                 if ($n == 0) {
                     continue;
                 }
                 $match[$thisLab] = $n;
             }
         }
         $match['Total'] = array_sum($match);
         if ($match['Total'] > 0) {
             arsort($match);
             $res[] = array($match, array($userN, $rawProfiles[$userN]['username']));
         }
     }
     arsort($res);
     return $res;
 }
 public static function uninstall()
 {
     ProfileNdx_indexer_shared::clearDbNdx();
     ProfileNdx_search_engine::deleteSearchCacheTable();
     ProfileNdx_search_engine::deleteSearchLimitTable();
 }