コード例 #1
0
function SQLtermsXcantNT()
{
    global $DBCFG;
    $LABELdeepTerm = string2url(LABEL_ProfundidadTermino);
    return SQL("select", "t.tema_id,t.tema,t.isMetaTerm, LENGTH(i.indice) - LENGTH(REPLACE(i.indice, '|', '')) as deepLevel,count(r.id_menor) as cant,\r\n\tt.cuando,concat(u.APELLIDO,', ',u.NOMBRES) as user_data\r\n\tFROM {$DBCFG['DBprefix']}tema t, {$DBCFG['DBprefix']}usuario u,{$DBCFG['DBprefix']}tabla_rel r,{$DBCFG['DBprefix']}indice i\r\n\twhere\r\n\tt.tema_id=r.id_mayor\r\n\tand r.t_relacion='3'\r\n\tand i.tema_id=t.tema_id\r\n\tand u.id=t.uid\r\n\tgroup by t.tema_id\r\n\torder by cant desc,t.tema");
}
コード例 #2
0
ファイル: fun.html.php プロジェクト: jpgil/tematres-mirror
function HTMLadvancedSearchResult($array)
{
    //Ctrol lenght string
    $array[xstring] = secure_data(trim($array[xstring]), "sql");
    if (strlen(trim($array[xstring])) >= CFG_MIN_SEARCH_SIZE) {
        $sql = SQLadvancedSearch($array);
        $classMensaje = $sql[cant] ? 'information' : 'warning';
        $resumeResult = '<p id="adsearch" class=' . $classMensaje . '><strong>' . $sql[cant] . '</strong> ' . MSG_ResultBusca . ' <strong> "<em>' . stripslashes($array[xstring]) . '</em>"</strong></p>';
    } else {
        $sql[cant] = '0';
        $resumeResult = '<p id="adsearch" class="error">' . sprintf(MSG_minCharSerarch, stripslashes($array[xstring]), strlen($array[xstring]), CFG_MIN_SEARCH_SIZE - 1) . '</p>';
    }
    $body .= $resumeResult;
    if ($sql[cant] > 0) {
        $row_result .= '<div id="listaBusca"><ul>';
        while ($resulta_busca = mysqli_fetch_array($sql[datos])) {
            $ibusca = ++$ibusca;
            //Si no es un término preferido
            if ($resulta_busca[uf_tema_id]) {
                switch ($resulta_busca[t_relacion]) {
                    case '4':
                        //UF
                        $leyendaConector = USE_termino;
                        break;
                    case '5':
                        //Tipo relacion término equivalente parcialmente
                        $leyendaConector = '<acronym title="' . LABEL_termino_parcial_equivalente . '" lang="' . LANG . '">' . EQP_acronimo . '</acronym>';
                        break;
                    case '6':
                        //Tipo relacion término equivalente
                        $leyendaConector = '<acronym title="' . LABEL_termino_equivalente . '" lang="' . LANG . '">' . EQ_acronimo . '</acronym>';
                        break;
                    case '7':
                        //Tipo relacion término no equivalente
                        $leyendaConector = '<acronym title="' . LABEL_termino_no_equivalente . '" lang="' . LANG . '">' . NEQ_acronimo . '</acronym>';
                        break;
                    case '8':
                        //Tipo relacion término equivalente inexacta
                        $leyendaConector = '<acronym title="' . LABEL_termino_parcial_equivalente . '" lang="' . LANG . '">' . EQP_acronimo . '</acronym>';
                        break;
                }
                $row_result .= '<li><em><a title="' . LABEL_verDetalle . $resulta_busca[tema] . '" href="index.php?tema=' . $resulta_busca[uf_tema_id] . '&amp;/' . string2url($resulta_busca[uf_tema]) . '">' . $resulta_busca[uf_tema] . '</a></em> ' . $leyendaConector . ' <a title="' . LABEL_verDetalle . $resulta_busca[tema] . '" href="index.php?tema=' . $resulta_busca[tema_id] . '">' . $resulta_busca[tema] . '</a> </li>' . "\r\n";
            } else {
                $row_result .= '<li><a title="' . LABEL_verDetalle . $resulta_busca[tema] . '" href="index.php?tema=' . $resulta_busca[tema_id] . '&amp;/' . string2url($resulta_busca[tema]) . '">' . $resulta_busca[tema] . '</a></li>' . "\r\n";
            }
        }
        //fin del while
        $row_result .= '</ul>';
        $row_result .= '</div>';
    }
    // fin de if result
    return $body . $row_result;
}
コード例 #3
0
ファイル: fun.admin.php プロジェクト: jpgil/tematres-mirror
function do_mysql_dump($encode = "utf8")
{
    global $DBCFG;
    $tables = $DBCFG[DBprefix] . 'config,' . $DBCFG[DBprefix] . 'tema,' . $DBCFG[DBprefix] . 'tabla_rel,' . $DBCFG[DBprefix] . 'indice,' . $DBCFG[DBprefix] . 'usuario,' . $DBCFG[DBprefix] . 'notas,' . $DBCFG[DBprefix] . 'values,' . $DBCFG[DBprefix] . 'tvocab,' . $DBCFG[DBprefix] . 'term2tterm';
    $link = mysql_connect($DBCFG["Server"], $DBCFG["DBLogin"], $DBCFG["DBPass"]);
    mysql_select_db($DBCFG["DBName"], $link);
    /*
     * To UTF-8 databases
     */
    if ($encode == 'utf8') {
        mysql_query('SET NAMES utf8');
        mysql_query('SET CHARACTER SET utf8');
    }
    //get all of the tables
    if ($tables == '*') {
        $tables = array();
        $result = mysql_query('SHOW TABLES');
        while ($row = mysql_fetch_row($result)) {
            $tables[] = $row[0];
        }
    } else {
        $tables = is_array($tables) ? $tables : explode(',', $tables);
    }
    //cycle through
    foreach ($tables as $table) {
        $result = mysql_query('SELECT * FROM ' . $table);
        $num_fields = mysql_num_fields($result);
        $return .= 'DROP TABLE IF EXISTS ' . $table . '; ';
        $row2 = mysql_fetch_row(mysql_query('SHOW CREATE TABLE ' . $table));
        $return .= "\n\n" . $row2[1] . ";\n\n";
        for ($i = 0; $i < $num_fields; $i++) {
            while ($row = mysql_fetch_row($result)) {
                $return .= 'INSERT INTO ' . $table . ' VALUES(';
                for ($j = 0; $j < $num_fields; $j++) {
                    $row[$j] = addslashes($row[$j]);
                    $row[$j] = $data = arrayReplace(array("\n"), array("\\n"), $row[$j]);
                    if (isset($row[$j])) {
                        $return .= '"' . $row[$j] . '"';
                    } else {
                        $return .= '""';
                    }
                    if ($j < $num_fields - 1) {
                        $return .= ',';
                    }
                }
                $return .= ");\n";
            }
        }
        $return .= "\n\n\n";
    }
    sendFile($return, string2url('TemaTres-' . $_SESSION[CFGTitulo]) . '.sql');
}
コード例 #4
0
function do_mysql_dump($encode = "utf8")
{
    global $DBCFG;
    $tables = $DBCFG[DBprefix] . 'config,' . $DBCFG[DBprefix] . 'tema,' . $DBCFG[DBprefix] . 'tabla_rel,' . $DBCFG[DBprefix] . 'indice,' . $DBCFG[DBprefix] . 'usuario,' . $DBCFG[DBprefix] . 'notas,' . $DBCFG[DBprefix] . 'values,' . $DBCFG[DBprefix] . 'tvocab,' . $DBCFG[DBprefix] . 'term2tterm,' . $DBCFG[DBprefix] . 'uri';
    /*
     * To UTF-8 databases
     */
    if ($encode == 'utf8') {
        $setUTF = SQL("SET NAMES", "utf8");
        $setUTF1 = SQL("SET CHARACTER SET", "utf8");
    }
    //get  the tables
    $tables = explode(',', $tables);
    //cycle through
    foreach ($tables as $table) {
        $result = SQL('SELECT', ' * FROM ' . $table);
        $num_fields = $result->_numOfFields;
        $return .= 'DROP TABLE IF EXISTS ' . $table . '; ';
        $row2query = SQL('SHOW CREATE TABLE', $table);
        $row2data = $row2query->FetchRow();
        $return .= "\n\n" . $row2data["Create Table"] . ";\n\n";
        for ($i = 0; $i < $num_fields; $i++) {
            while ($row = $result->FetchRow()) {
                $return .= 'INSERT INTO ' . $table . ' VALUES(';
                for ($j = 0; $j < $num_fields; $j++) {
                    $row[$j] = addslashes($row[$j]);
                    $row[$j] = $data = arrayReplace(array("\n"), array("\\n"), $row[$j]);
                    if (isset($row[$j])) {
                        $return .= '"' . $row[$j] . '"';
                    } else {
                        $return .= '""';
                    }
                    if ($j < $num_fields - 1) {
                        $return .= ',';
                    }
                }
                $return .= ");\n";
            }
        }
        $return .= "\n\n\n";
    }
    sendFile($return, string2url('TemaTres-' . $_SESSION[CFGTitulo]) . '.sql');
}
コード例 #5
0
function sendMail($to_address, $subject, $message, $extra = array())
{
    require_once "mailer/class.phpmailer.php";
    $mail = new PHPMailer();
    /*
     * Exmple with SMTP from gmail
     *
    	$mail->IsSMTP();                                      // set mailer to use SMTP
    	$mail->Host = 'ssl://smtp.gmail.com';
    	$mail->Port = 465;
    	$mail->SMTPAuth = true;
    	$mail->Username = '******';
    	$mail->Password = '******';
    */
    $mail->From = 'tematres@' . string2url($_SESSION["CFGTitulo"]);
    $mail->CharSet = "UTF-8";
    $mail->AddAddress($to_address);
    $mail->WordWrap = 50;
    // set word wrap to 50 characters
    $mail->IsHTML(false);
    // set email format to HTML
    $mail->Subject = $subject;
    $mail->Body = $message;
    /*
     * Debug
     *
     $mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
     // 1 = errors and messages
     // 2 = messages only
    
    	error_reporting(E_ALL);
    	ini_set("display_errors", 1);
    	echo $mail->ErrorInfo;
    */
    return $mail->Send() ? true : false;
}
コード例 #6
0
ファイル: Core.php プロジェクト: oriolet/bootils
 public function string2url($string)
 {
     return string2url($string);
 }
コード例 #7
0
function HTMLadvancedSearchResult($array)
{
    //Ctrol lenght string
    $array[xstring] = trim($array[xstring]);
    if (strlen(trim($array[xstring])) >= CFG_MIN_SEARCH_SIZE) {
        $sql = SQLadvancedSearch($array);
        $sql_cant = SQLcount($sql);
        $classMensaje = $sql_cant > 0 ? 'info' : 'danger';
        $resumeResult = '<p id="adsearch" class="alert alert-' . $classMensaje . '" role="alert"><strong>' . $sql_cant . '</strong> ' . MSG_ResultBusca . ' <strong> "<em>' . stripslashes($array[xstring]) . '</em>"</strong></p>';
    } else {
        $sql_cant = '0';
        $resumeResult = '<p id="adsearch" class="error">' . sprintf(MSG_minCharSerarch, stripslashes($array[xstring]), strlen($array[xstring]), CFG_MIN_SEARCH_SIZE - 1) . '</p>';
    }
    $body .= $resumeResult;
    if ($sql_cant > 0) {
        $row_result .= '<div id="listaBusca"><ul class="list-unstyled" >';
        while ($resulta_busca = $sql->FetchRow()) {
            $ibusca = ++$ibusca;
            $css_class_MT = $resulta_busca["isMetaTerm"] == 1 ? ' class="metaTerm" ' : '';
            //Si no es un término preferido
            if ($resulta_busca[uf_tema_id]) {
                switch ($resulta_busca[t_relacion]) {
                    case '4':
                        //UF
                        $leyendaConector = USE_termino;
                        break;
                    case '5':
                        //Tipo relacion término equivalente parcialmente
                        $leyendaConector = '<acronym title="' . LABEL_termino_parcial_equivalente . '" lang="' . LANG . '">' . EQP_acronimo . '</acronym>';
                        break;
                    case '6':
                        //Tipo relacion término equivalente
                        $leyendaConector = '<acronym title="' . LABEL_termino_equivalente . '" lang="' . LANG . '">' . EQ_acronimo . '</acronym>';
                        break;
                    case '7':
                        //Tipo relacion término no equivalente
                        $leyendaConector = '<acronym title="' . LABEL_termino_no_equivalente . '" lang="' . LANG . '">' . NEQ_acronimo . '</acronym>';
                        break;
                    case '8':
                        //Tipo relacion término equivalente inexacta
                        $leyendaConector = '<acronym title="' . LABEL_termino_parcial_equivalente . '" lang="' . LANG . '">' . EQP_acronimo . '</acronym>';
                        break;
                }
                $row_result .= '<li><em><a title="' . LABEL_verDetalle . $resulta_busca[tema] . '" href="index.php?tema=' . $resulta_busca[uf_tema_id] . '&amp;/' . string2url($resulta_busca[uf_tema]) . '">' . $resulta_busca[uf_tema] . '</a></em> ' . $leyendaConector . ' <a title="' . LABEL_verDetalle . $resulta_busca[tema] . '" href="index.php?tema=' . $resulta_busca[tema_id] . '">' . $resulta_busca[tema] . '</a> </li>' . "\r\n";
            } else {
                $row_result .= '<li><a ' . $css_class_MT . ' title="' . LABEL_verDetalle . $resulta_busca[tema] . '" href="index.php?tema=' . $resulta_busca[tema_id] . '&amp;/' . string2url($resulta_busca[tema]) . '">' . $resulta_busca[tema] . '</a></li>' . "\r\n";
            }
        }
        //fin del while
        $row_result .= '</ul>';
        $row_result .= '</div>';
    }
    // fin de if result
    return $body . $row_result;
}