// insert /*insert query*/ $db->query_write("\n\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "phrase\n\t\t\t\t\t(languageid, varname, text, fieldname, product, username, dateline, version)\n\t\t\t\tVALUES\n\t\t\t\t\t(" . $vbulletin->GPC['languageid'] . ",\n\t\t\t\t\t'" . $db->escape_string($phrase['varname']) . "',\n\t\t\t\t\t'" . $db->escape_string($phrase['text']) . "',\n\t\t\t\t\t'" . $db->escape_string($phrase['fieldname']) . "',\n\t\t\t\t\t'" . $db->escape_string($phrase['product']) . "',\n\t\t\t\t\t'" . $db->escape_string($vbulletin->userinfo['username']) . "',\n\t\t\t\t\t" . TIMENOW . ",\n\t\t\t\t\t'" . $db->escape_string($full_product_info["{$phrase['product']}"]['version']) . "')\n\t\t\t"); } } exec_header_redirect("language.php?" . $vbulletin->session->vars['sessionurl'] . "do=rebuild&goto=" . urlencode("phrase.php?" . $vbulletin->session->vars['sessionurl'] . "do=search")); } // ############################################################################# if ($_POST['do'] == 'replace') { $vbulletin->input->clean_array_gpc('p', array('searchstring' => TYPE_STR, 'replacestring' => TYPE_STR, 'languageid' => TYPE_INT)); if (empty($vbulletin->GPC['searchstring']) or empty($vbulletin->GPC['replacestring'])) { print_stop_message('please_complete_required_fields'); } // do a rather clever query to find what phrases to display $phraseids = '0'; $phrases = $db->query_read("\n\t\tSELECT\n\t\t\tIF(pcust.phraseid IS NULL, pmast.phraseid, pcust.phraseid) AS phraseid,\n\t\t\tIF(pcust.phraseid IS NULL, pmast.text, pcust.text) AS xtext\n\t\tFROM " . TABLE_PREFIX . "phrase AS pmast\n\t\tLEFT JOIN " . TABLE_PREFIX . "phrase AS pcust ON (\n\t\t\tpcust.varname = pmast.varname AND\n\t\t\tpcust.fieldname = pmast.fieldname AND\n\t\t\tpcust.languageid = " . $vbulletin->GPC['languageid'] . "\n\t\t)\n\t\tWHERE pmast.languageid = -1\n\t\tHAVING " . fetch_field_like_sql($vbulletin->GPC['searchstring'], 'xtext', false, true) . "\n\t"); while ($phrase = $db->fetch_array($phrases)) { $phraseids .= ",{$phrase['phraseid']}"; } $db->free_result($phrases); // now do a simple query to actually fetch the data $phrasearray = array(); $phrases = $db->query_read("\n\t\tSELECT phrase.*, language.title\n\t\tFROM " . TABLE_PREFIX . "phrase AS phrase\n\t\tLEFT JOIN " . TABLE_PREFIX . "language AS language USING(languageid)\n\t\tWHERE phrase.phraseid IN({$phraseids})\n\t"); if ($db->num_rows($phrases) == 0) { print_stop_message('no_phrases_matched_your_query'); } while ($phrase = $db->fetch_array($phrases)) { $phrasearray["{$phrase['fieldname']}"]["{$phrase['varname']}"]["{$phrase['languageid']}"] = $phrase; } unset($phrase); $db->free_result($phrases);
} // do a rather clever query to find what phrases to display $phraseids = '0'; $phrases = $db->query_read(" SELECT IF(pcust.phraseid IS NULL, pmast.phraseid, pcust.phraseid) AS phraseid, IF(pcust.phraseid IS NULL, pmast.text, pcust.text) AS xtext FROM " . TABLE_PREFIX . "phrase AS pmast LEFT JOIN " . TABLE_PREFIX . "phrase AS pcust ON ( pcust.varname = pmast.varname AND pcust.fieldname = pmast.fieldname AND pcust.languageid = " . $vbulletin->GPC['languageid'] . " ) WHERE pmast.languageid = -1 HAVING " . fetch_field_like_sql($vbulletin->GPC['searchstring'], 'xtext', false, true) . " "); while ($phrase = $db->fetch_array($phrases)) { $phraseids .= ",$phrase[phraseid]"; } $db->free_result($phrases); // now do a simple query to actually fetch the data $phrasearray = array(); $phrases = $db->query_read(" SELECT phrase.*, language.title FROM " .TABLE_PREFIX . "phrase AS phrase LEFT JOIN " . TABLE_PREFIX . "language AS language USING(languageid) WHERE phrase.phraseid IN($phraseids) ");