function SQLtematres($DBCFG, $DB, $arrayInstallData = array()) { // Si se establecio un charset para la conexion if (@$DBCFG["DBcharset"]) { $DB->Execute("SET NAMES {$DBCFG['DBcharset']}"); } $prefix = $DBCFG["DBprefix"]; $result1 = $DB->Execute("CREATE TABLE `" . $prefix . "config` (\r\n\t\t `id` int(5) unsigned NOT NULL auto_increment,\r\n\t\t `titulo` varchar(255) NOT NULL default '',\r\n\t\t `autor` varchar(255) NOT NULL default '',\r\n\t\t `idioma` char(5) NOT NULL default 'es',\r\n\t\t `cobertura` text,\r\n\t\t `keywords` varchar(255) default NULL,\r\n\t\t `tipo` varchar(100) default NULL,\r\n\t\t `polijerarquia` tinyint(1) NOT NULL default '1',\r\n\t\t `cuando` date NOT NULL default '0000-00-00',\r\n\t\t `observa` text,\r\n\t\t `url_base` varchar(255) default NULL,\r\n\t\t PRIMARY KEY (`id`)\r\n\t\t) DEFAULT CHARSET=utf8 ENGINE=MyISAM ;"); //If create table --> insert data if ($result1) { $today = date("Y-m-d"); $url = str_replace("install.php", "", "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF']); $title = $arrayInstallData['title'] ? $DB->qstr(trim($arrayInstallData["title"]), get_magic_quotes_gpc()) : "'TemaTres'"; $author = $arrayInstallData['author'] ? $DB->qstr(trim($arrayInstallData["author"]), get_magic_quotes_gpc()) : "'TemaTres'"; $tematres_lang = $DB->qstr(trim($arrayInstallData["lang"]), get_magic_quotes_gpc()); $tematres_lang = $tematres_lang ? $tematres_lang : 'es'; $comment = ''; $result2 = $DB->Execute("INSERT INTO `" . $prefix . "config`\r\n\t\t\t(`id`, `titulo`, `autor`, `idioma`, `tipo`, `polijerarquia`, `cuando`, `observa`, `url_base`)\r\n\t\t\tVALUES (1, {$title}, {$author}, {$tematres_lang}, 'Controlled vocabulary', 2, '{$today}', NULL, '{$url}');"); } $result3 = $DB->Execute("CREATE TABLE `" . $prefix . "indice` (\r\n\t\t\t\t `tema_id` int(11) NOT NULL default '0',\r\n\t\t\t\t `indice` varchar(250) NOT NULL default '',\r\n\t\t\t\t PRIMARY KEY (`tema_id`),\r\n\t\t\t\t KEY `indice` (`indice`)\r\n\t\t\t\t) DEFAULT CHARSET=utf8 ENGINE=MyISAM COMMENT='indice de temas';"); $result4 = $DB->Execute("CREATE TABLE `" . $prefix . "notas` (\r\n\t\t\t\t `id` int(11) NOT NULL auto_increment,\r\n\t\t\t\t `id_tema` int(11) NOT NULL default '0',\r\n\t\t\t\t `tipo_nota` char(3) NOT NULL default 'NA',\r\n\t\t\t\t `lang_nota` varchar(7) default NULL,\r\n\t\t\t\t `nota` mediumtext NOT NULL,\r\n\t\t\t\t `cuando` datetime NOT NULL default '0000-00-00 00:00:00',\r\n\t\t\t\t `uid` int(5) NOT NULL default '0',\r\n\t\t\t\t PRIMARY KEY (`id`),\r\n\t\t\t\t KEY `id_tema` (`id_tema`),\r\n\t\t\t\t KEY `orden_notas` (`tipo_nota`,`lang_nota`),\r\n\t\t\t\t FULLTEXT `notas` (`nota`)\r\n\t\t\t\t) DEFAULT CHARSET=utf8 ENGINE=MyISAM ;"); $result5 = $DB->Execute("CREATE TABLE `" . $prefix . "tabla_rel` (\r\n\t\t\t\t `id_mayor` int(5) NOT NULL default '0',\r\n\t\t\t\t `id_menor` int(5) NOT NULL default '0',\r\n\t\t\t\t `t_relacion` tinyint(1) unsigned NOT NULL default '0',\r\n\t\t\t\t `rel_rel_id` int(22) NULL,\r\n\t\t\t\t `id` int(9) unsigned NOT NULL auto_increment,\r\n\t\t\t\t `uid` int(10) unsigned NOT NULL default '0',\r\n\t\t\t\t `cuando` datetime NOT NULL default '0000-00-00 00:00:00',\r\n\t\t\t\t PRIMARY KEY (`id`),\r\n\t\t\t\t UNIQUE KEY `NewIndex` (`id_mayor`,`id_menor`),\r\n\t\t\t\t KEY `unico` (`t_relacion`),\r\n\t\t\t\t KEY `id_menor` (`id_menor`),\r\n\t\t\t\t KEY `id_mayor` (`id_mayor`),\r\n\t\t\t\t KEY `rel_rel_id` (`rel_rel_id`)\r\n\t\t\t\t) DEFAULT CHARSET=utf8 ENGINE=MyISAM ;"); $result6 = $DB->Execute("CREATE TABLE `" . $prefix . "tema` (\r\n\t\t\t\t `tema_id` int(10) NOT NULL auto_increment,\r\n\t\t\t\t `code` VARCHAR( 150 ) NULL COMMENT 'code_term' ,\r\n\t\t\t\t `tema` varchar(250) default NULL,\r\n\t\t\t\t `tesauro_id` int(5) NOT NULL default '0',\r\n\t\t\t\t `uid` tinyint(3) unsigned NOT NULL default '0',\r\n\t\t\t\t `cuando` datetime NOT NULL default '0000-00-00 00:00:00',\r\n\t\t\t\t `uid_final` int(5) unsigned default NULL,\r\n\t\t\t\t `cuando_final` datetime default NULL,\r\n\t\t\t\t `estado_id` int(5) NOT NULL default '13',\r\n\t\t\t\t `cuando_estado` datetime NOT NULL default '0000-00-00 00:00:00',\r\n\t\t\t `isMetaTerm` BOOLEAN NOT NULL DEFAULT FALSE,\r\n\t\t\t\t PRIMARY KEY (`tema_id`),\r\n\t\t\t\t KEY ( `code` ),\r\n\t\t\t\t KEY `tema` (`tema`),\r\n\t\t\t\t KEY `cuando` (`cuando`,`cuando_final`),\r\n\t\t\t\t KEY `uid` (`uid`,`uid_final`),\r\n\t\t\t\t KEY `tesauro_id` (`tesauro_id`),\r\n\t\t\t\t KEY `estado_id` (`estado_id`),\r\n\t\t\t KEY `isMetaTerm` (`isMetaTerm`)\r\n\t\t\t\t) DEFAULT CHARSET=utf8 ENGINE=MyISAM ;"); $result61 = $DB->Execute("CREATE TABLE IF NOT EXISTS `" . $prefix . "term2tterm` (\r\n\t\t\t\t `tterm_id` int(22) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t `tvocab_id` int(22) NOT NULL,\r\n\t\t\t\t `tterm_url` varchar(200) NOT NULL,\r\n\t\t\t\t `tterm_uri` varchar(200) NOT NULL,\r\n\t\t\t\t `tterm_string` varchar(250) NOT NULL,\r\n\t\t\t\t `cuando` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\r\n\t\t\t\t `cuando_last` timestamp NULL DEFAULT NULL,\r\n\t\t\t\t `uid` int(22) NOT NULL,\r\n\t\t\t\t `tema_id` int(22) NOT NULL,\r\n\t\t\t\t PRIMARY KEY (`tterm_id`),\r\n\t\t\t\t KEY `tvocab_id` (`tvocab_id`,`cuando`,`cuando_last`,`uid`),\r\n\t\t\t\t KEY `tema_id` (`tema_id`),\r\n \t\t\t\t KEY `target_terms` (`tterm_string`)\r\n\t\t\t\t) DEFAULT CHARSET=utf8 ENGINE=MyISAM;"); $result62 = $DB->Execute("CREATE TABLE IF NOT EXISTS `" . $prefix . "tvocab` (\r\n\t\t\t\t `tvocab_id` int(22) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t `tvocab_label` varchar(150) NOT NULL,\r\n\t\t\t\t `tvocab_tag` varchar(20) NOT NULL,\r\n\t\t\t\t `tvocab_lang` VARCHAR( 5 ),\r\n\t\t\t\t `tvocab_title` varchar(200) NOT NULL,\r\n\t\t\t\t `tvocab_url` varchar(250) NOT NULL,\r\n\t\t\t\t `tvocab_uri_service` varchar(250) NOT NULL,\r\n\t\t\t\t `tvocab_status` tinyint(1) NOT NULL,\r\n\t\t\t\t `cuando` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\r\n\t\t\t\t `uid` int(22) NOT NULL,\r\n\t\t\t\t PRIMARY KEY (`tvocab_id`),\r\n\t\t\t\t KEY `uid` (`uid`),\r\n\t\t\t\t KEY `status` (`tvocab_status`)\r\n\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8;"); $result7 = $DB->Execute("CREATE TABLE `" . $prefix . "usuario` (\r\n\t\t\t\t `APELLIDO` varchar(150) default NULL,\r\n\t\t\t\t `NOMBRES` varchar(150) default NULL,\r\n\t\t\t\t `uid` int(9) unsigned default NULL,\r\n\t\t\t\t `cuando` date default NULL,\r\n\t\t\t\t `id` int(11) unsigned NOT NULL auto_increment,\r\n\t\t\t\t `mail` varchar(255) default NULL,\r\n\t\t\t\t `pass` varchar(60) NOT NULL default '',\r\n\t\t\t\t `orga` varchar(255) default NULL,\r\n\t\t\t\t `nivel` tinyint(1) unsigned NOT NULL default '2',\r\n\t\t\t\t `estado` set('ACTIVO','BAJA') NOT NULL default 'BAJA',\r\n\t\t\t\t `hasta` datetime NOT NULL default '0000-00-00 00:00:00',\r\n\t\t\t\t `user_activation_key` varchar(60) DEFAULT NULL,\r\n\t\t\t\t PRIMARY KEY (`id`),\r\n\t\t\t\t UNIQUE KEY `mail` (`mail`),\r\n\t\t\t\t KEY `pass` (`pass`),\r\n\t\t\t\t KEY `user_activation_key` (`user_activation_key`)\r\n\t\t\t\t) DEFAULT CHARSET=utf8 ENGINE=MyISAM ;"); $result9 = $DB->Execute("CREATE TABLE `" . $prefix . "values` (\r\n\t\t\t\t `value_id` int(11) NOT NULL auto_increment,\r\n\t\t\t\t `value_type` varchar(64) NOT NULL default '0',\r\n\t\t\t\t `value` longtext NOT NULL ,\r\n\t\t\t\t `value_order` tinyint(4) default NULL,\r\n\t\t\t\t `value_code` varchar(20) default NULL,\r\n\t\t\t\t PRIMARY KEY (`value_id`),\r\n\t\t\t\t KEY `value_type` (`value_type`)\r\n\t\t\t\t) DEFAULT CHARSET=utf8 ENGINE=MyISAM COMMENT='general values table';"); $result10 = $DB->Execute("CREATE TABLE `" . $prefix . "uri` (\r\n\t\t\t `uri_id` int(22) NOT NULL AUTO_INCREMENT,\r\n\t\t\t `tema_id` int(22) NOT NULL,\r\n\t\t\t `uri_type_id` int(22) NOT NULL,\r\n\t\t\t `uri` tinytext NOT NULL,\r\n\t\t\t `uid` int(22) NOT NULL,\r\n\t\t\t `cuando` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\r\n\t\t\t PRIMARY KEY (`uri_id`),\r\n\t\t\t KEY `tema_id` (`tema_id`)\r\n\t\t\t) CHARSET=utf8 ENGINE=MyISAM COMMENT='external URIs associated to terms';"); $result10 = $DB->Execute("INSERT INTO `" . $prefix . "values` (`value_id`, `value_type`, `value`, `value_order`, `value_code`) VALUES (2, 't_relacion', 'Termino relacionado', NULL, 'TR'),\r\n\t\t\t\t(3, 't_relacion', 'Termino superior', NULL, 'TG'),\r\n\t\t\t\t(4, 't_relacion', 'Usado por', NULL, 'UP'),\r\n\t\t\t\t(5, 't_relacion', 'Equivalencia parcial', NULL, 'EQ_P'),\r\n\t\t\t\t(6, 't_relacion', 'Equivalencia total', NULL, 'EQ'),\r\n\t\t\t\t(7, 't_relacion', 'No equivalencia', NULL, 'EQ_NO'),\r\n\t\t\t\t(8, 't_nota', 'Nota de alcance', 1, 'NA'),\r\n\t\t\t\t(9, 't_nota', 'Nota histórica', 2, 'NH'),\r\n\t\t\t\t(10, 't_nota', 'Nota bibliografica', 3, 'NB'),\r\n\t\t\t\t(11, 't_nota', 'Nota privada', 4, 'NP'),\r\n\t\t\t\t(1, 't_usuario', 'Admin', NULL, 'admin'),\r\n\t\t\t\t(12, 't_estado', 'termino candidato', 1, 'C'),\r\n\t\t\t\t(13, 't_estado', 'termino activo', 2, 'A'),\r\n\t\t\t\t(14, 't_estado', 'termino rechazado', 3, 'R'),\r\n\t\t\t\t(15, 't_nota', 'Nota catalográfica', 2, 'NC'),\r\n\t\t\t\t(16, 'config', '_USE_CODE', 1, '0'),\r\n\t\t\t\t(17, 'config', '_SHOW_CODE', 1, '0'),\r\n\t\t\t\t(18, 'config', 'CFG_MAX_TREE_DEEP', NULL, '3'),\r\n\t\t\t\t(19, 'config', 'CFG_VIEW_STATUS', NULL, '0'),\r\n\t\t\t\t(20, 'config', 'CFG_SIMPLE_WEB_SERVICE', NULL, '1'),\r\n\t\t\t\t(21, 'config', 'CFG_NUM_SHOW_TERMSxSTATUS', NULL, '200'),\r\n\t\t\t\t(22, 'config', 'CFG_MIN_SEARCH_SIZE', NULL, '2'),\r\n\t\t\t\t(23, 'config', '_SHOW_TREE', '1', '1'),\r\n\t\t\t\t(24, 'config', '_PUBLISH_SKOS', '1', '0'),\r\n\t\t\t\t(25,'4', 'Spelling variant', NULL, 'SP'),\r\n\t\t\t\t(26,'4', 'MisSpelling', NULL, 'MS'),\r\n\t\t\t\t(27,'3', 'Partitive', NULL, 'P'),\r\n\t\t\t\t(28,'3', 'Instance', NULL, 'I'),\r\n\t\t\t\t(30,'4', 'Abbreviation', NULL, 'AB'),\r\n\t\t\t\t(31,'4', 'Full form of the term', NULL, 'FT'),\r\n\t\t\t\t(32,'URI_TYPE', 'broadMatch', NULL, 'broadMatch'),\r\n\t\t\t\t(33,'URI_TYPE', 'closeMatch', NULL, 'closeMatch'),\r\n\t\t\t\t(34,'URI_TYPE', 'exactMatch', NULL, 'exactMatch'),\r\n\t\t\t\t(35,'URI_TYPE', 'relatedMatch', NULL, 'relatedMatch'),\r\n\t\t\t\t(36,'URI_TYPE', 'narrowMatch', NULL, 'narrowMatch'),\r\n\t\t\t\t(37,'DATESTAMP',now(), NULL,'NOTE_CHANGE'),\r\n\t\t\t\t(38,'DATESTAMP',now(), NULL,'TERM_CHANGE'),\r\n\t\t\t\t(39,'DATESTAMP',now(), NULL,'TTERM_CHANGE'),\r\n\t\t\t\t(40,'DATESTAMP',now(), NULL,'THES_CHANGE'),\r\n\t\t\t\t(41,'METADATA',NULL, 2,'dc:contributor'),\r\n\t\t\t\t(42,'METADATA',NULL, 5,'dc:publisher'),\r\n\t\t\t\t(43,'METADATA',NULL, 9,'dc:rights'),\r\n\t\t\t\t(44,'4', 'Hidden', NULL, 'H'),\r\n\t\t\t\t(45, 'config', 'CFG_SEARCH_METATERM', NULL, '0'),\r\n\t\t\t\t(46, 'config', 'CFG_ENABLE_SPARQL', NULL, '0'),\r\n\t\t\t\t(47, 'config', 'CFG_SUGGESTxWORD', NULL, '1')\r\n\t\t\t\t"); //If create table --> insert data if (is_object($result7)) { $admin_mail = $arrayInstallData['mail'] ? $DB->qstr(trim($arrayInstallData['mail']), get_magic_quotes_gpc()) : "'*****@*****.**'"; $admin_name = $arrayInstallData['name'] ? $DB->qstr(trim($arrayInstallData['name']), get_magic_quotes_gpc()) : "'admin name'"; $admin_surname = $arrayInstallData['s_name'] ? $DB->qstr(trim($arrayInstallData['s_name']), get_magic_quotes_gpc()) : "'admin sur name'"; $admin_pass = $arrayInstallData['password'] ? trim($arrayInstallData['password']) : "'admin'"; require_once T3_ABSPATH . 'common/include/fun.gral.php'; $admin_pass_hash = CFG_HASH_PASS == 1 ? t3_hash_password($admin_pass) : $admin_pass; $admin_pass_hash = $admin_pass_hash ? $DB->qstr(trim($admin_pass_hash), get_magic_quotes_gpc()) : "'admin'"; $result8 = $DB->Execute("INSERT INTO\r\n\t\t\t`" . $prefix . "usuario` (`APELLIDO`, `NOMBRES`, `uid`, `cuando`, `id`, `mail`, `pass`, `orga`, `nivel`, `estado`, `hasta`)\r\n\t\t\tVALUES\r\n\t\t\t({$admin_name},{$admin_surname}, 1, now(), 1, {$admin_mail},{$admin_pass_hash}, 'TemaTres', 1, 'ACTIVO', now())"); //echo $DB->ErrorMsg(); //Tematres installed if (is_object($result8)) { global $install_message; $return_true = '<div>'; $return_true .= '<h3>' . ucfirst(LABEL_bienvenida) . '</h3>'; $return_true .= '<p class="alert alert-success" role="alert">' . $install_message["306"] . '</p>'; //~ Not echo for security //~ $return_true .='<li>'.ucfirst(LABEL_mail).': '.$admin_mail.'</li>' ; //~ $return_true .= '<li>'.ucfirst(LABEL_pass).' : '.$admin_pass.'</li>' ; $return_true .= '</div>'; message($return_true); } } }
function setPassword($user_id, $user_pass, $to_hash = 0) { global $DBCFG; $user_pass = $to_hash == 1 ? t3_hash_password($user_pass) : $user_pass; $sql_update_pass = SQLo("update", "{$DBCFG['DBprefix']}usuario set pass= ? where id= ?", array($user_pass, $user_id)); return; }