function edit_single_code($tema_id, $code)
{
    global $DBCFG;
    global $DB;
    $code = trim($code);
    $tema_id = secure_data($tema_id, "int");
    $ARRAYCode = ARRAYCode($code);
    //No cambi� nada
    if ($ARRAYCode[tema_id] == $tema_id) {
        //sin cambios
        $ARRAYCode["log"] = '0';
        return $ARRAYCode;
    } elseif ($ARRAYCode[tema_id]) {
        //error
        $ARRAYCode["log"] = '-1';
        return $ARRAYCode;
    } else {
        //cambios
        /* deprecated in version 1.21 > problemswtih set null
        		$code=(strlen($code)<1) ? 'NULL' : $code.strlen($code);
        		$sql=SQL("update","$DBCFG[DBprefix]tema set code='$code' where tema_id='$tema_id'");
        		$ARRAYCode=ARRAYCode($code);
        */
        if (strlen($code) < 1) {
            $sql = SQL("update", "{$DBCFG['DBprefix']}tema set code=NULL where tema_id={$tema_id}");
        } else {
            $code = $DB->qstr($code, get_magic_quotes_gpc());
            $sql = SQL("update", "{$DBCFG['DBprefix']}tema set code={$code} where tema_id={$tema_id}");
        }
        $ARRAYCode = ARRAYverTerminoBasico($tema_id);
        $ARRAYCode["log"] = '1';
        return $ARRAYCode;
    }
}
Example #2
0
function edit_single_code($tema_id, $code)
{
    global $DBCFG;
    $code = trim($code);
    $code = secure_data($code, "sql");
    $code = secure_data($code, "alnum");
    $ARRAYCode = ARRAYCode($code);
    //No cambió nada
    if ($ARRAYCode[tema_id] == $tema_id) {
        //sin cambios
        $ARRAYCode["log"] = '0';
        return $ARRAYCode;
    } elseif ($ARRAYCode[tema_id]) {
        //error
        $ARRAYCode["log"] = '-1';
        return $ARRAYCode;
    } else {
        //cambios
        $code = strlen($code) < 1 ? NULL : $code;
        $sql = SQL("update", "{$DBCFG['DBprefix']}tema set code='{$code}' where tema_id='{$tema_id}'");
        $ARRAYCode = ARRAYCode($code);
        $ARRAYCode["log"] = '1';
        return $ARRAYCode;
    }
}
 function addTermAssociations($skos)
 {
     foreach ($skos->xpath->query('skos:Concept[skos:related]') as $concept) {
         $subjectUri = $concept->getAttributeNodeNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'about');
         /*
           $term_id = fetchTermIdxNote($subjectUri->nodeValue);
         */
         $ARRAYterm = ARRAYCode($subjectUri->nodeValue);
         $term_id = $ARRAYterm[tema_id];
         foreach ($skos->xpath->query('./skos:related', $concept) as $related) {
             $objectUri = $related->getAttributeNodeNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'resource');
             /*
             	$RT_term_id = fetchTermIdxNote($objectUri->nodeValue);
             */
             $ARRAYterm = ARRAYCode($objectUri->nodeValue);
             $RT_term_id = $ARRAYterm[tema_id];
             if ($term_id && $RT_term_id) {
                 //echo $subjectUri->nodeValue.':'.$uri->nodeValue.'<br>';
                 ALTArelacionXId($term_id, $RT_term_id, '2');
             }
         }
     }
     return $this;
 }