function abm_target_tema($do, $tema_id, $tvocab_id, $tgetTerm_id, $tterm_id = "0") { global $DBCFG; $userId = $_SESSION[$_SESSION["CFGURL"]][ssuser_id]; $tema_id = secure_data($tema_id, "sql"); $tvocab_id = secure_data($tvocab_id, "sql"); $arrayVocab = ARRAYtargetVocabulary($tvocab_id); if (is_array($arrayVocab)) { switch ($do) { case 'A': require 'vocabularyservices.php'; $arrayTterm = xmlVocabulary2array($arrayVocab[tvocab_uri_service] . '?task=fetchTerm&arg=' . $tgetTerm_id); $arrayTterm[tterm_uri] = $arrayVocab[tvocab_uri_service] . '?task=fetchTerm&arg=' . $tgetTerm_id; $arrayTterm[tterm_url] = $arrayVocab[tvocab_url] . '?tema=' . $tgetTerm_id; /* $arrayTterm[tterm_string]=utf8_decode($arrayTterm[result][term]["string"]); */ $arrayTterm[tterm_string] = FixEncoding($arrayTterm[result][term]["string"]); $sql = SQL("insert", "into {$DBCFG['DBprefix']}term2tterm (tema_id,tvocab_id,tterm_url,tterm_uri,tterm_string,cuando,uid) \r\n\t\t\tvalues ('{$tema_id}','{$arrayVocab['tvocab_id']}','{$arrayTterm['tterm_url']}','{$arrayTterm['tterm_uri']}','{$arrayTterm['tterm_string']}',now(),'{$userId}')"); $target_relation_id = $sql[cant]; break; case 'B': //delete $sql = SQL("delete", "from {$DBCFG['DBprefix']}term2tterm where tterm_id='{$tterm_id}' and tema_id='{$tema_id}' and tvocab_id='{$tvocab_id}' limit 1"); $target_relation_id = $sql[cant]; break; case 'U': //update data require 'vocabularyservices.php'; //obtener datos locales del término $arrayTterm = ARRAYtargetTerm($tema_id, $tgetTerm_id); //obtener datos externos del término $arrayTterm = xmlVocabulary2array($arrayTterm[tterm_uri]); /* $arrayTterm[tterm_string]=utf8_decode($arrayTterm[result][term]["string"]); */ $arrayTterm[tterm_string] = FixEncoding($arrayTterm[result][term]["string"]); $sql = SQL("update", "{$DBCFG['DBprefix']}term2tterm set \r\n\t\ttterm_string='{$arrayTterm['tterm_string']}',\r\n\t\tcuando_last=now(),\r\n\t\tuid='{$userId}'\r\n\t\twhere tterm_id='{$tterm_id}' and tema_id='{$tema_id}' and tvocab_id='{$tvocab_id}' limit 1"); $target_relation_id = $sql[cant]; break; } } return $target_relation_id; }
function abm_target_tema($do, $tema_id, $tvocab_id, $tgetTerm_id, $tterm_id = "0") { global $DBCFG; global $DB; $userId = $_SESSION[$_SESSION["CFGURL"]][ssuser_id]; $tema_id = secure_data($tema_id, "int"); $tvocab_id = secure_data($tvocab_id, "int"); $arrayVocab = ARRAYtargetVocabulary($tvocab_id); $sendkey = ''; if (is_array($arrayVocab)) { switch ($do) { case 'A': //prevent duplicate require_once T3_ABSPATH . 'common/include/vocabularyservices.php'; $dataTterm = getURLdata($arrayVocab["tvocab_uri_service"] . '?task=fetchTerm&arg=' . $tgetTerm_id); $arrayTterm["tterm_uri"] = $arrayVocab["tvocab_uri_service"] . '?task=fetchTerm&arg=' . $tgetTerm_id; $arrayTterm["tterm_url"] = $arrayVocab["tvocab_url"] . '?tema=' . $tgetTerm_id; $arrayTterm["tterm_string"] = $DB->qstr(trim((string) $dataTterm->result->term->string), get_magic_quotes_gpc()); $sql = SQLo("insert", "into {$DBCFG['DBprefix']}term2tterm (tema_id,tvocab_id,tterm_url,tterm_uri,tterm_string,cuando,uid)\r\n\t\t\t\t\tvalues (?,?,?,?,{$arrayTterm['tterm_string']},now(),?)", array($tema_id, $arrayVocab[tvocab_id], $arrayTterm[tterm_url], $arrayTterm[tterm_uri], $userId)); $target_relation_id = $sql[cant]; break; case 'B': //delete $sql = SQLo("delete", "from {$DBCFG['DBprefix']}term2tterm where tterm_id=? and tema_id=? and tvocab_id=? limit 1", array($tterm_id, $tema_id, $tvocab_id)); $target_relation_id = "0"; break; case 'U': //update data require_once T3_ABSPATH . 'common/include/vocabularyservices.php'; //obtener datos locales del término $arrayTterm = ARRAYtargetTerm($tema_id, $tgetTerm_id); //obtener datos externos del término $dataTterm = getURLdata($arrayTterm["tterm_uri"]); $arrayTterm["tterm_string"] = $DB->qstr(trim((string) $dataTterm->result->term->string), get_magic_quotes_gpc()); $sql = SQLo("update", "{$DBCFG['DBprefix']}term2tterm set\r\n\t\ttterm_string={$arrayTterm['tterm_string']},\r\n\t\tcuando_last=now(),\r\n\t\tuid=?\r\n\t\twhere tterm_id=? and tema_id=? and tvocab_id=? limit 1", array($userId, $tterm_id, $tema_id, $tvocab_id)); $target_relation_id = $sql[cant]; break; } } return $target_relation_id; }