/** * @see Form::validate() */ public function validate() { parent::validate(); // query if (empty($this->query)) { throw new UserInputException('query'); } // test regex if ($this->useRegex) { try { preg_match('/' . $this->query . '/', ''); } catch (SystemException $e) { throw new UserInputException('query', 'invalidRegex'); } } if ($this->searchVariableName) { $this->replace = 0; } // get results $results = LanguageEditor::search($this->query, $this->replace ? $this->replaceBy : null, $this->languageID ? $this->languageID : null, $this->useRegex, $this->caseSensitive, $this->searchVariableName); if (count($results)) { $languageItems = array(); foreach ($results as $result) { if (!isset($languageItems[$result['languageID']])) { $languageItems[$result['languageID']] = array(); } $languageItems[$result['languageID']][] = $result; } WCF::getTPL()->assign(array('languageItems' => $languageItems, 'languages' => WCF::getCache()->get('languages', 'languages'))); WCF::getTPL()->display('languageSearchResult'); exit; } else { WCF::getTPL()->assign('noMatches', true); } }