Esempio n. 1
0
function show_procs($dbh)
{
    global $msg;
    global $charset;
    global $PMBuserid, $javascript_path, $form_notice_tpl;
    print "\n\t\t<script type=\"text/javascript\" src=\"" . $javascript_path . "/tablist.js\"></script>\n\t\t<a href=\"javascript:expandAll()\"><img src='./images/expand_all.gif' border='0' id=\"expandall\"></a>\n\t\t<a href=\"javascript:collapseAll()\"><img src='./images/collapse_all.gif' border='0' id=\"collapseall\"></a>\n\t\t";
    // affichage du tableau des procédures
    $requete = "SELECT idproc, name, requete, comment, autorisations, libproc_classement, num_classement FROM procs left join procs_classements on idproc_classement=num_classement ORDER BY libproc_classement,name ";
    $res = mysql_query($requete, $dbh);
    $nbr = mysql_num_rows($res);
    $class_prec = $msg[proc_clas_aucun];
    $buf_tit = "";
    $buf_class = 0;
    $parity = 1;
    for ($i = 0; $i < $nbr; $i++) {
        $row = mysql_fetch_row($res);
        $rqt_autorisation = explode(" ", $row[4]);
        if (($PMBuserid == 1 || array_search($PMBuserid, $rqt_autorisation) !== FALSE) && pmb_strtolower(pmb_substr(trim($row[2]), 0, 6)) == 'select') {
            $classement = $row[5];
            if ($class_prec != $classement) {
                if (!$row[5]) {
                    $row[5] = $msg[proc_clas_aucun];
                }
                if ($buf_tit) {
                    $buf_contenu = "<table><tr><th colspan=4>" . $buf_tit . "</th></tr>" . $buf_contenu . "</table>";
                    print gen_plus("procclass" . $buf_class, $buf_tit, $buf_contenu);
                    $buf_contenu = "";
                }
                $buf_tit = $row[5];
                $buf_class = $row[6];
                $class_prec = $classement;
            }
            if ($parity % 2) {
                $pair_impair = "even";
            } else {
                $pair_impair = "odd";
            }
            $parity++;
            $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./edit.php?categ=procs&sub=&action=execute&id_proc={$row['0']}';\" ";
            $buf_contenu .= "\n<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'>\n\t\t\t\t\t<td><strong>{$row['1']}</strong><br />\n\t\t\t\t\t\t<small>{$row['3']}</small></td>\n\t\t\t\t</tr>";
        }
    }
    $buf_contenu = "<table><tr><th colspan=4>" . $buf_tit . "</th></tr>" . $buf_contenu . "</table>";
    print gen_plus("procclass" . $buf_class, $buf_tit, $buf_contenu);
}
Esempio n. 2
0
 function store_in_tree($t, $search_linked_words)
 {
     // Mot ou expression ?
     if (!$t->sub && $t->word) {
         //C'est un mot
         // Synonyme activé && ce n'est pas une expression commence par '_xx*' ?
         if ($search_linked_words && !$this->start_with) {
             // Oui, Synonyme activé
             // C'est un littéral ?
             if ($t->literal) {
                 // Oui, c'est un littéral
                 // Recherche de synonymes
                 $synonymes = $this->get_synonymes($t->word);
                 $mots = $t->word;
                 // Y-a-t'il des synonymes ?
                 if ($synonymes) {
                     // Oui il y a des synonymes
                     // Pour chaque synonyme et le terme ajout à $t->sub
                     $op_sub = "";
                     foreach ($synonymes as $synonyme => $ponderation) {
                         $t->sub[] = new term($synonyme, 0, 0, 0, $op_sub, "", $ponderation);
                         $this->calcul_term($t->sub[count($t->sub) - 1], $synonyme, 0, $ponderation);
                         $op_sub = "or";
                     }
                     // Ajout du term force litéral à 1
                     $t->word = "";
                     $t->sub[] = new term($mots, 1, 0, 0, $op_sub, "", $t->pound);
                     $this->calcul_term($t->sub[count($t->sub) - 1], $mots, 1, $t->pound);
                     $op_sub = "or";
                 }
             } else {
                 // Non, ce n'est pas un littéral
                 // Recherche de synonymes
                 $synonymes = $this->get_synonymes($t->word);
                 $mots = $t->word;
                 $t->word = "";
                 // Y-a-t'il des synonymes ?
                 if ($synonymes) {
                     // Oui il y a des synonymes
                     foreach ($synonymes as $synonyme => $ponderation) {
                         $liste_mots[$synonyme] = $ponderation;
                     }
                 }
                 // Suite et, Non, il n'y a pas de synonyme
                 // Nettoyage des caractères
                 $mot_clean = convert_diacrit($mots);
                 $mot_clean = pmb_alphabetic('^a-z0-9\\s\\*', ' ', pmb_strtolower($mot_clean));
                 // Nettoyage des mots vides
                 $mot_clean_vide = $this->nettoyage_mot_vide($mot_clean);
                 // Pour chaque mot nettoyer
                 if (count($mot_clean_vide)) {
                     foreach ($mot_clean_vide as $word) {
                         // Recherche de synonymes
                         $synonymes_clean = $this->get_synonymes($word);
                         // Pour chaque synonyme et le terme ajout à $t->sub
                         if (count($synonymes_clean)) {
                             foreach ($synonymes_clean as $synonyme => $ponderation) {
                                 $liste_mots[$synonyme] = $ponderation;
                             }
                         }
                     }
                 }
                 // ajout des mots nettoyés
                 if (count($mot_clean_vide)) {
                     foreach ($mot_clean_vide as $word) {
                         $liste_mots[$word] = $t->pound;
                     }
                 }
                 if (!count($t->sub)) {
                     $op_sub = '';
                 } else {
                     $op_sub = "or";
                 }
                 if (count($liste_mots) > 1) {
                     $t->word = "";
                     // Plusieurs mots
                     foreach ($liste_mots as $word => $ponderation) {
                         $t->sub[] = new term($word, 0, 0, 0, $op_sub, "", $ponderation);
                         $this->calcul_term($t->sub[count($t->sub) - 1], $word, 0, $ponderation);
                         $op_sub = "or";
                     }
                     //$t->sub=$terms;
                 } elseif (count($liste_mots) == 1) {
                     // Un seul mot
                     foreach ($liste_mots as $word => $ponderation) {
                         $t->word = $word;
                     }
                 } else {
                     return;
                 }
             }
         } else {
             // Non, Synonyme désactivé
             // C'est un littéral ?
             if ($t->literal) {
                 // Oui, c'est un littéral
                 // plus rien à faire
             } else {
                 // Non, ce n'est pas un littéral
                 // Nettoyage des caractères
                 $mot_clean = convert_diacrit($t->word);
                 $mot_clean = pmb_alphabetic('^a-z0-9\\s\\*', ' ', pmb_strtolower($mot_clean));
                 // Nettoyage des mots vides
                 $mot_clean_vide = $this->nettoyage_mot_vide($mot_clean);
                 // Combien de mots reste-t-il ?
                 if (count($mot_clean_vide) > 1) {
                     $t->word = "";
                     // Plusieurs mots
                     if (!count($t->sub)) {
                         $op_sub = '';
                     } else {
                         $op_sub = "or";
                     }
                     foreach ($mot_clean_vide as $word) {
                         $terms[] = new term($word, 0, 0, 0, $op_sub, "", $ponderation);
                         $op_sub = "or";
                     }
                     $t->sub = $terms;
                 } elseif (count($mot_clean_vide) == 1) {
                     // Un seul mot
                     $t->word = $mot_clean_vide[0];
                 } else {
                     return;
                 }
             }
         }
     } elseif ($t->sub && !$t->word) {
         // C'est une expression :
         // Vider opérateur
         if (!count($this->tree)) {
             $t->operator = "";
         }
     } else {
         //	Ce n'est ni un mot, ni une exrssion: c'est rien
         return;
     }
     // Inscription dans l'arbre
     $this->tree[] = $t;
     //print "<pre>";print_r($this->tree);print"</pre>";
 }
Esempio n. 3
0
 function getDataAbc()
 {
     global $dbh, $filtre_select;
     $this->titles = array();
     $tbCorrespondance = array();
     $ongletInc = 0;
     $req = $this->getQuery();
     $resultat = pmb_mysql_query($req);
     if ($nb_notices = pmb_mysql_num_rows($resultat)) {
         while ($r = pmb_mysql_fetch_object($resultat)) {
             if (pmb_substr($r->notice_id, 0, pmb_strlen("es)")) == "es" && $filtre_select != 2) {
                 // si cataloguée, on ne l'affiche pas. sauf si on filtre par fonds externe ($filtre_select!=2)
                 if ($this->get_doublon_ex($this->extract_external_id($r->notice_id))) {
                     continue;
                 }
             }
             $letter = pmb_substr(trim(pmb_strtolower($r->index_sew)), 0, 1);
             //On classe selon la première lettre
             if (is_numeric($letter)) {
                 $letter = "0";
             }
             if (isset($tbCorrespondance[$letter])) {
                 $tbCorrespondance[$letter]["qt"]++;
                 $tbCorrespondance[$letter]["lastTitle"] = trim($r->index_sew);
                 $onglet = $tbCorrespondance[$letter]["onglet"];
             } else {
                 $ongletInc++;
                 $ongletSubInc = 1;
                 $tbCorrespondance[$letter]["qt"] = 1;
                 $tbCorrespondance[$letter]["onglet"] = $ongletInc;
                 if (is_numeric($letter)) {
                     $this->onglets_contens[$ongletInc]["label"] = "0 - 9";
                 } elseif ($letter == " ") {
                     // les inclassables
                     $this->onglets_contens[$ongletInc]["label"] = " # ";
                 } else {
                     $this->onglets_contens[$ongletInc]["label"] = " " . pmb_strtoupper($letter) . " ";
                 }
                 $this->onglets_contens[$ongletInc]["letter"][] = $letter;
                 $onglet = $ongletInc;
             }
             //Sous-onglet
             if (!isset($this->onglets_sub_contens[$onglet][$ongletSubInc])) {
                 $this->onglets_sub_contens[$onglet][$ongletSubInc]["label"] = pmb_strtoupper(trim($r->index_sew));
             }
             $this->onglets_sub_contens[$onglet][$ongletSubInc]["id"][] = $r->notice_id;
             $this->onglets_sub_contens[$onglet][$ongletSubInc]["last_label"] = pmb_strtoupper(trim($r->index_sew));
             if (count($this->onglets_sub_contens[$onglet][$ongletSubInc]["id"]) == $this->max_per_onglet) {
                 $ongletSubInc++;
             }
             //On mémorise le couple onglet/sous-onglet pour la recherche ajax
             $t = array();
             $t["onglet"] = $onglet . '_' . $ongletSubInc;
             $t["label"] = pmb_strtoupper(trim($r->index_sew));
             $t["title"] = $r->tit1;
             $t["id"] = $r->notice_id;
             if (pmb_substr($r->notice_id, 0, pmb_strlen("es)")) == "es") {
                 // 				$this->titles[]="xxxxxxxxx";
                 // 				print $r->notice_id;
             } else {
                 $this->titles[] = $t;
             }
         }
         //On transforme les labels
         foreach ($this->onglets_sub_contens as $onglet => $myOnglet) {
             foreach ($myOnglet as $ongletSub => $myOngletSub) {
                 $lastOngletSub = $ongletSub;
                 if ($ongletSub == 1) {
                     $this->onglets_sub_contens[$onglet][$ongletSub]["label"] = pmb_substr($this->onglets_sub_contens[$onglet][$ongletSub]["label"], 0, 1);
                 } else {
                     $mesTermes = $this->difference_label($this->onglets_sub_contens[$onglet][$ongletSub - 1]["last_label"], $this->onglets_sub_contens[$onglet][$ongletSub]["label"]);
                     $this->onglets_sub_contens[$onglet][$ongletSub - 1]["last_label"] = $mesTermes[0];
                     $this->onglets_sub_contens[$onglet][$ongletSub]["label"] = $mesTermes[1];
                 }
             }
             //On retravaille le dernier
             $mesTermes = $this->difference_label($this->onglets_sub_contens[$onglet][$lastOngletSub]["label"], $this->onglets_sub_contens[$onglet][$lastOngletSub]["last_label"]);
             $this->onglets_sub_contens[$onglet][$lastOngletSub]["last_label"] = $mesTermes[1];
         }
     }
 }
Esempio n. 4
0
function test_other_query($n_res = 0, $n_gen = 0, $n_tit = 0, $n_mat = 0, $query, $operator = TRUE, $force_regexp = FALSE)
{
    // fonction d'analyse d'une recherche sur titre
    // la fonction retourne un tableau :
    $query_result = array('type' => 0, 'restr' => '', 'order' => '', 'display', 'nbr_rows' => 0);
    // $query_result['type'] = type de la requête :
    // 0 : rien (problème)
    // 1: match/against
    // 2: regexp
    // 3: regexp pure sans traitement
    // $query_result['restr'] = critères de restriction
    // $query_result['order'] = critères de tri
    // $query_result['nbr_rows'] = nombre de lignes qui matchent
    // $query_result['display'] = affichage en clair de la requête utilisateur
    // si operator TRUE La recherche est booléenne AND
    // si operator FALSE La recherche est booléenne OR
    // si force_regexp : la recherche est forcée en mode regexp
    $stopwords = FALSE;
    global $dbh;
    // initialisation opérateur
    $operator ? $dopt = 'AND' : ($dopt = 'OR');
    $query = pmb_strtolower($query);
    // espaces en début et fin
    $query = pmb_preg_replace('/^\\s+|\\s+$/', '', $query);
    // espaces en double
    $query = pmb_preg_replace('/\\s+/', ' ', $query);
    // contrôle de la requete
    if (!$query) {
        return $query_result;
    }
    // déterminer si la requête est une regexp
    // si c'est le cas, on utilise la saisie utilisateur sans modification
    // (on part du principe qu'il sait ce qu'il fait)
    if (pmb_preg_match('/\\^|\\$|\\[|\\]|\\.|\\*|\\{|\\}|\\|/', $query)) {
        // regexp pure : pas de modif de la saisie utilisateur
        $query_result['type'] = 3;
        if ($n_res) {
            $query_result['restr'] = "n_resume REGEXP '{$query}' OR n_contenu REGEXP '{$query}' ";
        } else {
            $query_result['restr'] = "";
        }
        if ($n_gen) {
            if ($query_result['restr']) {
                $query_result['restr'] .= " OR ";
            }
            $query_result['restr'] .= " n_gen REGEXP '{$query}'";
        }
        if ($n_tit) {
            if ($query_result['restr']) {
                $query_result['restr'] .= " OR ";
            }
            $query_result['restr'] .= " tit1 REGEXP '{$query}' OR tit2 REGEXP '{$query}' OR tit3 REGEXP '{$query}' OR tit4 REGEXP '{$query}' OR index_serie REGEXP '{$query}' ";
        }
        if ($n_mat) {
            if ($query_result['restr']) {
                $query_result['restr'] .= " OR ";
            }
            $query_result['restr'] .= " index_l REGEXP '{$query}' ";
        }
        $query_result['order'] = "index_serie ASC, tnvol ASC, index_sew ASC";
        $query_result['display'] = $query;
    } else {
        // nettoyage de la chaîne
        $query = pmb_preg_replace("/[\\(\\)\\,\\;\\'\\!\\-\\+]/", ' ', $query);
        // on supprime les mots vides
        $query = strip_empty_words($query);
        // contrôle de la requete
        if (!$query) {
            return $query_result;
        }
        // la saisie est splitée en un tableau
        $tab = pmb_split('/\\s+/', $query);
        // on cherche à détecter les mots de moins de 4 caractères (stop words)
        // si il y des mots remplissant cette condition, c'est la méthode regexp qui sera employée
        foreach ($tab as $dummykey => $word) {
            if (pmb_strlen($word) < 4) {
                $stopwords = TRUE;
                break;
            }
        }
        if ($stopwords || $force_regexp) {
            // méthode REGEXP
            $query_result['type'] = 2;
            // constitution du membre restricteur
            // premier mot
            if ($n_res) {
                $query_result['restr'] = "( n_resume REGEXP '{$tab[0]}' OR n_contenu REGEXP '{$tab[0]}' ";
            } else {
                $query_result['restr'] = "";
            }
            if ($n_gen) {
                if ($query_result['restr']) {
                    $query_result['restr'] .= " OR  n_gen REGEXP '{$tab[0]}'";
                } else {
                    $query_result['restr'] = "( n_gen REGEXP '{$tab[0]}'";
                }
            }
            if ($n_tit) {
                if ($query_result['restr']) {
                    $query_result['restr'] .= " OR tit1 REGEXP '{$tab[0]}' OR tit2 REGEXP '{$tab[0]}' OR tit3 REGEXP '{$tab[0]}' OR tit4 REGEXP '{$tab[0]}' OR index_serie REGEXP '{$tab[0]}'";
                } else {
                    $query_result['restr'] = "( tit1 REGEXP '{$tab[0]}' OR tit2 REGEXP '{$tab[0]}' OR tit3 REGEXP '{$tab[0]}' OR tit4 REGEXP '{$tab[0]}' OR index_serie REGEXP '{$tab[0]}' ";
                }
            }
            if ($n_mat) {
                if ($query_result['restr']) {
                    $query_result['restr'] .= " OR index_l REGEXP '{$tab[0]}' ";
                } else {
                    $query_result['restr'] = "( index_l REGEXP '{$tab[0]}' ";
                }
            }
            $query_result['restr'] .= ") ";
            //$query_result['restr'] = "(n_resume REGEXP '${tab[0]}'";
            //$query_result['restr'] .= " OR n_contenu REGEXP '$tab[0]')";
            $query_result['display'] = $tab[0];
            for ($i = 1; $i < sizeof($tab); $i++) {
                $query_suite = "";
                if ($n_res) {
                    $query_suite = " ( n_resume REGEXP '{$tab[$i]}' OR n_contenu REGEXP '{$tab[$i]}' ";
                }
                if ($n_gen) {
                    if ($query_suite) {
                        $query_suite .= " OR  n_gen REGEXP '{$tab[$i]}'";
                    } else {
                        $query_suite = "( n_gen REGEXP '{$tab[$i]}'";
                    }
                }
                if ($n_tit) {
                    if ($query_suite) {
                        $query_suite .= " OR tit1 REGEXP '{$tab[$i]}' OR tit2 REGEXP '{$tab[$i]}' OR tit3 REGEXP '{$tab[$i]}' OR tit4 REGEXP '{$tab[$i]}' OR index_serie REGEXP '{$tab[$i]}'";
                    } else {
                        $query_suite = "( tit1 REGEXP '{$tab[$i]}' OR tit2 REGEXP '{$tab[$i]}' OR tit3 REGEXP '{$tab[$i]}' OR tit4 REGEXP '{$tab[$i]}' OR index_serie REGEXP '{$tab[$i]}' ";
                    }
                }
                if ($n_mat) {
                    if ($query_suite) {
                        $query_suite .= " OR index_l REGEXP '{$tab[$i]}' ";
                    } else {
                        $query_suite = "( index_l REGEXP '{$tab[$i]}' ";
                    }
                }
                if ($query_suite) {
                    $query_suite .= " ) ";
                    $query_result['restr'] .= " {$dopt} " . $query_suite;
                }
                //$query_result['restr'] .= " $dopt (n_resume REGEXP '${tab[$i]}'";
                //$query_result['restr'] .= " OR n_contenu REGEXP '${tab[$i]}')";
                $query_result['display'] .= " {$dopt} {$tab[$i]}";
            }
            //echo "<br /><br /><br />".$query_result['restr']."<br /><br /><br />";
            // contitution de la clause de tri
            $query_result['order'] = "index_serie ASC, tnvol ASC, index_sew ASC";
        } else {
            // méthode FULLTEXT
            $query_result['type'] = 1;
            // membre restricteur
            if ($n_res) {
                $query_result['restr'] = "( MATCH (n_resume, n_contenu) AGAINST ('{$tab[0]}') ";
            } else {
                $query_result['restr'] = "";
            }
            if ($n_gen) {
                if ($query_result['restr']) {
                    $query_result['restr'] .= " OR MATCH (n_gen) AGAINST ('{$tab[0]}') ";
                } else {
                    $query_result['restr'] = "( MATCH (n_gen) AGAINST ('{$tab[0]}') ";
                }
            }
            if ($n_tit) {
                if ($query_result['restr']) {
                    $query_result['restr'] .= " OR MATCH (index_wew) AGAINST ('{$tab[0]}') ";
                } else {
                    $query_result['restr'] = "( MATCH (index_wew) AGAINST ('{$tab[0]}')  ";
                }
            }
            if ($n_mat) {
                if ($query_result['restr']) {
                    $query_result['restr'] .= " OR MATCH (index_matieres) AGAINST ('{$tab[0]}') ";
                } else {
                    $query_result['restr'] = "( MATCH (index_matieres) AGAINST ('{$tab[0]}') ";
                }
            }
            $query_result['restr'] .= ") ";
            //$query_result['restr'] = "MATCH (n_resume, n_contenu) AGAINST ('${tab[0]}')";
            $query_result['display'] = $tab[0];
            for ($i = 1; $i < sizeof($tab); $i++) {
                $query_suite = "";
                if ($n_res) {
                    $query_suite = " ( MATCH (n_resume, n_contenu) AGAINST ('{$tab[$i]}') ";
                }
                if ($n_gen) {
                    if ($query_suite) {
                        $query_suite .= " OR MATCH (n_gen) AGAINST ('{$tab[$i]}') ";
                    } else {
                        $query_suite = "( MATCH (n_gen) AGAINST ('{$tab[$i]}')";
                    }
                }
                if ($n_tit) {
                    if ($query_suite) {
                        $query_suite .= " OR MATCH (index_wew) AGAINST ('{$tab[$i]}') ";
                    } else {
                        $query_suite = "( MATCH (index_wew) AGAINST ('{$tab[$i]}') ";
                    }
                }
                if ($n_mat) {
                    if ($query_suite) {
                        $query_suite .= " OR MATCH (index_matieres) AGAINST ('{$tab[$i]}') ";
                    } else {
                        $query_suite = "( MATCH (index_matieres) AGAINST ('{$tab[$i]}') ";
                    }
                }
                if ($query_suite) {
                    $query_suite .= " ) ";
                    $query_result['restr'] .= " {$dopt} " . $query_suite;
                }
                //$query_result['restr'] .= " $dopt MATCH";
                //$query_result['restr'] .= " (n_resume, n_contenu)";
                //$query_result['restr'] .= " AGAINST ('${tab[$i]}')";
                $query_result['display'] .= " {$dopt} {$tab[$i]}";
            }
            // membre de tri
            $query_result['order'] = "index_serie ASC, tnvol ASC, index_sew ASC";
        }
    }
    // récupération du nombre de lignes
    $rws = "SELECT count(1) FROM notices WHERE {$query_result['restr']}";
    $result = @pmb_mysql_query($rws, $dbh);
    $query_result['nbr_rows'] = pmb_mysql_result($result, 0, 0);
    return $query_result;
}
Esempio n. 5
0
 $line = pmb_split("\n", $hp->final_query);
 $nb_element_avant = $myCart->nb_item;
 while (list($cle, $valeur) = each($line)) {
     if ($valeur != '') {
         if (pmb_strtolower(pmb_substr($valeur, 0, 6)) == "select" || pmb_strtolower(pmb_substr($valeur, 0, 6)) == "create") {
         } else {
             echo pmb_substr($valeur, 0, 6);
             error_message_history($msg['caddie_action_invalid_query'], $msg['requete_selection'], 1);
             exit;
         }
         $result_selection = mysql_query($valeur, $dbh);
         if (!$result_selection) {
             error_message_history($msg['caddie_action_invalid_query'], $msg['requete_echouee'] . mysql_error(), 1);
             exit;
         }
         if (pmb_strtolower(pmb_substr($valeur, 0, 6)) == "select") {
             $nb_element_a_ajouter += mysql_num_rows($result_selection);
             if (mysql_num_rows($result_selection)) {
                 while ($obj_selection = mysql_fetch_object($result_selection)) {
                     $myCart->add_item($obj_selection->object_id);
                 }
             }
             // fin if mysql_num_rows
             $myCart->compte_items();
         }
         // fin if rqt sélection
     }
     //fin valeur nonvide
 }
 // fin while list $cle
 $nb_element_apres = $myCart->nb_item;
Esempio n. 6
0
function strip_empty_chars_thesaurus($string)
{
    // traitement des diacritiques
    $string = convert_diacrit($string);
    // Mis en commentaire : qu'en est-il des caractères non latins ???
    // SUPPRIME DU COMMENTAIRE : ER : 12/05/2004 : ça fait tout merder...
    // RECH_14 : Attention : ici suppression des éventuels "
    //          les " ne sont plus supprimés
    $string = stripslashes($string);
    $string = pmb_alphabetic('^a-z0-9\\s', ' ', pmb_strtolower($string));
    // espaces en début et fin
    $string = pmb_preg_replace('/^\\s+|\\s+$/', '', $string);
    return $string;
}
 function make_proc()
 {
     global $msg;
     global $current_module;
     global $base_path;
     // récupération des champs à afficher
     if (count($this->print_field) == 0) {
         return "erreur";
     }
     // gestion de l'erreur a améliorer
     $champs = array();
     for ($i = 0; $i < count($this->print_field); $i++) {
         if (substr($this->print_field[$i], 0, 1) == "f") {
             if ($this->list_fields[substr($this->print_field[$i], 2)]["TABLE"] == "notices") {
                 $latable = "notices";
             } else {
                 $latable = "ta_" . $i;
             }
             $champs[] = $latable . "." . $this->list_fields[substr($this->print_field[$i], 2)]["CHAMP"] . " AS '" . addslashes($this->list_fields[substr($this->print_field[0], 2)]["TITLE"]) . "'";
         } else {
             $champs[] = "ncva_" . $i . ".notices_custom_" . $this->pp->t_fields[substr($this->print_field[$i], 2)]["DATATYPE"] . " AS '" . addslashes($this->pp->t_fields[substr($this->print_field[$i], 2)]["TITRE"]) . "'";
         }
     }
     $liste_champs = implode(", ", $champs);
     // récupération des tables
     $tables = array();
     $param = array("print_field" => "a", "fixed_params" => "f", "dynamic_params" => "d");
     foreach ($param as $key => $value) {
         for ($i = 0; $i < count($this->{$key}); $i++) {
             if (substr($this->{$key}[$i], 0, 1) == "f") {
                 // champs du fichier de configuration
                 // table principale
                 if ($this->list_fields[substr($this->{$key}[$i], 2)]["TABLE"] == "notices") {
                     $tables[] = "notices";
                 } else {
                     $tables[] = $this->list_fields[substr($this->{$key}[$i], 2)]["TABLE"] . " AS t" . $value . "_" . $i;
                 }
                 // jointures
                 for ($j = 0; $j < count($this->list_fields[substr($this->{$key}[$i], 2)]["JOINTURE"]); $j++) {
                     for ($k = 0; $k < count($this->list_fields[substr($this->{$key}[$i], 2)]["JOINTURE"][$j]["TABLE"]); $k++) {
                         if ($this->list_fields[substr($this->{$key}[$i], 2)]["JOINTURE"][$j]["TABLE"][$k]["NAME"] == "notices") {
                             $tables[] = "notices";
                         } else {
                             if ($this->list_fields[substr($this->{$key}[$i], 2)]["JOINTURE"][$j]["TABLE"][$k]["NAME"] != $this->list_fields[substr($this->{$key}[$i], 2)]["TABLE"]) {
                                 $tables[] = $this->list_fields[substr($this->{$key}[$i], 2)]["JOINTURE"][$j]["TABLE"][$k]["NAME"] . " AS t" . $value . "_j_" . $i;
                             }
                         }
                     }
                 }
             } else {
                 // champs perso
                 $tables[] = "notices_custom_values AS ncv" . $value . "_" . $i;
             }
         }
     }
     // éliminer les doublons
     $tables = array_unique($tables);
     $liste_tables = implode(", ", $tables);
     // construction des clauses
     $where = "";
     // jointures pour les champs a afficher
     $jointure = array();
     for ($i = 0; $i < count($this->print_field); $i++) {
         if (substr($this->print_field[$i], 0, 1) == "f") {
             for ($j = 0; $j < count($this->list_fields[substr($this->print_field[$i], 2)]["JOINTURE"]); $j++) {
                 if ($this->list_fields[substr($this->print_field[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["NAME"] == $this->list_fields[substr($this->print_field[$i], 2)]["TABLE"]) {
                     $tleft = "ta_" . $i;
                 } else {
                     if ($this->list_fields[substr($this->print_field[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["NAME"] == "notices") {
                         $tleft = "notices";
                     } else {
                         $tleft = "ta_j_" . $i;
                     }
                 }
                 if ($this->list_fields[substr($this->print_field[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["NAME"] == $this->list_fields[substr($this->print_field[$i], 2)]["TABLE"]) {
                     $tright = "ta_" . $i;
                 }
                 if ($this->list_fields[substr($this->print_field[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["NAME"] == "notices") {
                     $tright = "notices";
                 } else {
                     $tright = "ta_j_" . $i;
                 }
                 $jointure[] = $tleft . "." . $this->list_fields[substr($this->print_field[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["ID"][0]["value"] . "=" . $tright . "." . $this->list_fields[substr($this->print_field[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["ID"][0]["value"];
             }
         } else {
             // champs perso
             $jointure[] = "ncva_" . $i . ".notices_custom_origine = notices.notice_id";
             $jointure[] = "ncva_" . $i . ".notices_custom_champ = " . substr($this->print_field[$i], 2);
         }
     }
     // conditions fixes
     for ($i = 0; $i < count($this->fixed_params); $i++) {
         if (substr($this->fixed_params[$i], 0, 1) == "f") {
             for ($j = 0; $j < count($this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"]); $j++) {
                 if ($this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["NAME"] == $this->list_fields[substr($this->fixed_params[$i], 2)]["TABLE"]) {
                     $tleft = "tf_" . $i;
                 } else {
                     if ($this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["NAME"] == "notices") {
                         $tleft = "notices";
                     } else {
                         $tleft = "tf_j_" . $i;
                     }
                 }
                 if ($this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["NAME"] == $this->list_fields[substr($this->fixed_params[$i], 2)]["TABLE"]) {
                     $tright = "tf_" . $i;
                 }
                 if ($this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["NAME"] == "notices") {
                     $tright = "notices";
                 } else {
                     $tright = "tf_j_" . $i;
                 }
                 $jointure[] = $tleft . "." . $this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["ID"][0]["value"] . "=" . $tright . "." . $this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["ID"][0]["value"];
             }
             if ($this->list_fields[substr($this->fixed_params[$i], 2)]["TABLE"] == "notices") {
                 $tf = "notices";
             } else {
                 $tf = "tf_" . $i;
             }
             switch ($this->op_param[$i]) {
                 case "CONTAINS_ALL":
                     $op = " AND ";
                     $argu = explode(" ", $this->val_param[$i]);
                     for ($j = 0; $j < count($argu); $j++) {
                         $argu[$j] = $tf . "." . $this->list_fields[substr($this->fixed_params[$i], 2)]["INDEX"] . $this->operateur[$this->op_param[$i]]["DEB"] . pmb_strtolower(convert_diacrit($argu[$j])) . $this->operateur[$this->op_param[$i]]["FIN"];
                     }
                     $jointure[] = " (" . implode($op, $argu) . ") ";
                     break;
                 case "CONTAINS_AT_LEAST":
                     $op = " OR ";
                     $argu = explode(" ", $this->val_param[$i]);
                     for ($j = 0; $j < count($argu); $j++) {
                         $argu[$j] = $tf . "." . $this->list_fields[substr($this->fixed_params[$i], 2)]["INDEX"] . $this->operateur[$this->op_param[$i]]["DEB"] . pmb_strtolower(convert_diacrit($argu[$j])) . $this->operateur[$this->op_param[$i]]["FIN"];
                     }
                     $jointure[] = " (" . implode($op, $argu) . ") ";
                     break;
                 default:
                     $jointure[] = $tf . "." . $this->list_fields[substr($this->fixed_params[$i], 2)]["INDEX"] . $this->operateur[$this->op_param[$i]]["DEB"] . pmb_strtolower(convert_diacrit($this->val_param[$i])) . $this->operateur[$this->op_param[$i]]["FIN"];
             }
         } else {
             // champs perso
             $jointure[] = "ncvf_" . $i . ".notices_custom_origine = notices.notice_id";
             $jointure[] = "ncvf_" . $i . ".notices_custom_champ = " . substr($this->fixed_params[$i], 2);
             switch ($this->op_param[$i]) {
                 case "CONTAINS_ALL":
                     $op = " AND ";
                     $argu = explode(" ", $this->val_param[$i]);
                     for ($j = 0; $j < count($argu); $j++) {
                         $argu[$j] = "ncvf_" . $i . ".notices_custom_" . $this->pp->t_fields[substr($this->fixed_params[$i], 2)]["DATATYPE"] . $this->operateur[$this->op_param[$i]]["DEB"] . $argu[$j] . $this->operateur[$this->op_param[$i]]["FIN"];
                     }
                     $jointure[] = " (" . implode($op, $argu) . ") ";
                     break;
                 case "CONTAINS_AT_LEAST":
                     $op = " OR ";
                     $argu = explode(" ", $this->val_param[$i]);
                     for ($j = 0; $j < count($argu); $j++) {
                         $argu[$j] = "ncvf_" . $i . ".notices_custom_" . $this->pp->t_fields[substr($this->fixed_params[$i], 2)]["DATATYPE"] . $this->operateur[$this->op_param[$i]]["DEB"] . $argu[$j] . $this->operateur[$this->op_param[$i]]["FIN"];
                     }
                     $jointure[] = " (" . implode($op, $argu) . ") ";
                     break;
                 default:
                     $jointure[] = "ncvf_" . $i . ".notices_custom_" . $this->pp->t_fields[substr($this->fixed_params[$i], 2)]["DATATYPE"] . $this->operateur[$this->op_param[$i]]["DEB"] . $this->val_param[$i] . $this->operateur[$this->op_param[$i]]["FIN"];
             }
         }
     }
     // conditions dynamiques
     for ($i = 0; $i < count($this->dynamic_params); $i++) {
         if (substr($this->dynamic_params[$i], 0, 1) == "f") {
             for ($j = 0; $j < count($this->list_fields[substr($this->dynamic_params[$i], 2)]["JOINTURE"]); $j++) {
                 if ($this->list_fields[substr($this->dynamic_params[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["NAME"] == $this->list_fields[substr($this->dynamic_params[$i], 2)]["TABLE"]) {
                     $tleft = "td_" . $i;
                 } else {
                     if ($this->list_fields[substr($this->dynamic_params[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["NAME"] == "notices") {
                         $tleft = "notices";
                     } else {
                         $tleft = "td_j_" . $i;
                     }
                 }
                 if ($this->list_fields[substr($this->dynamic_params[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["NAME"] == $this->list_fields[substr($this->dynamic_params[$i], 2)]["TABLE"]) {
                     $tright = "td_" . $i;
                 }
                 if ($this->list_fields[substr($this->dynamic_params[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["NAME"] == "notices") {
                     $tright = "notices";
                 } else {
                     $tright = "td_j_" . $i;
                 }
                 $jointure[] = $tleft . "." . $this->list_fields[substr($this->dynamic_params[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["ID"][0]["value"] . "=" . $tright . "." . $this->list_fields[substr($this->dynamic_params[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["ID"][0]["value"];
             }
             if ($this->list_fields[substr($this->dynamic_params[$i], 2)]["TABLE"] == "notices") {
                 $td = "notices";
             } else {
                 $td = "td_" . $i;
             }
             $jointure[] = $td . "." . $this->list_fields[substr($this->dynamic_params[$i], 2)]["INDEX"] . $this->operateur[$this->op_var[$i]]["DEB"] . "!!d_" . $i . "!!" . $this->operateur[$this->op_var[$i]]["FIN"];
         } else {
             // champs perso
             $jointure[] = "ncvd_" . $i . ".notices_custom_origine = notices.notice_id";
             $jointure[] = "ncvd_" . $i . ".notices_custom_champ = " . substr($this->dynamic_params[$i], 2);
             $jointure[] = "ncvd_" . $i . ".notices_custom_" . $this->pp->t_fields[substr($this->dynamic_params[$i], 2)]["DATATYPE"] . $this->operateur[$this->op_var[$i]]["DEB"] . "!!d_" . $i . "!!" . $this->operateur[$this->op_var[$i]]["FIN"];
         }
     }
     $where .= implode(" AND ", $jointure);
     $requete = html_entity_decode("SELECT " . $liste_champs . " FROM " . $liste_tables . " WHERE " . $where);
     $param_var = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
     $param_var .= "<FIELDS>\n";
     for ($i = 0; $i < count($this->dynamic_params); $i++) {
         // A améliorer, pour l'instant tout est mis en type text !!!
         $param_var .= "<FIELD NAME=\"d_" . $i . "\" MANDATORY=\"yes\">\n";
         $param_var .= " <ALIAS><![CDATA[" . $this->val_var[$i] . "]]></ALIAS>\n";
         $param_var .= " <TYPE>text</TYPE>\n";
         $param_var .= " <OPTIONS FOR=\"text\">\n";
         $param_var .= " <SIZE>20</SIZE>\n";
         $param_var .= " <MAXSIZE>20</MAXSIZE>\n";
         $param_var .= " </OPTIONS>\n";
         $param_var .= " </FIELD>\n";
     }
     $param_var .= "</FIELDS>";
     // insertion de la procédure dans la base de données
     $dbh = connection_mysql();
     $req = "INSERT INTO procs (name, requete, comment, autorisations, parameters) VALUES ('" . $this->nom_proc . "', '" . addslashes($requete) . "', '" . $this->comment . "', '" . implode(" ", $this->userautorisation) . "', '" . addslashes($param_var) . "')";
     $result = pmb_mysql_query($req, $dbh);
     // on n'utilse pas le template prévu pour cette étape
     $create_proc_form = "\n<form class='form-{$current_module}' name='search_form' action='!!url!!' method='post'>\n\t<h3>" . $msg["create_proc"] . " (!!etape!!/5)</h3>\n\t<div class='form-contenu'>\n\t\t!!resultat!!\n\t</div>\n\t<div class='row'>\n\t\t<input type='submit' class='bouton' value='" . $msg["re_proc"] . "' onClick=\"this.form.etape.value=1; this.form.action='!!url_next!!'; this.form.page.value=''; \"/>\n\t</div>\n</form>";
     if ($result) {
         $resultat = $msg["proc_ok"];
     } else {
         $resultat = $msg["proc_fail"];
     }
     $create_proc_form = str_replace("!!resultat!!", $resultat, $create_proc_form);
     return $create_proc_form;
 }
Esempio n. 8
0
 function is_same_lib($categ_libelle, $categ_id)
 {
     $r = new category($categ_id);
     if (pmb_strtolower(convert_diacrit($r->libelle)) == pmb_strtolower(convert_diacrit($categ_libelle))) {
         return true;
     } else {
         return false;
     }
 }
Esempio n. 9
0
         if ($virgule) {
             $tri .= ", ";
         }
         // regarde si le champ est déjà dans la liste des champs à trier et le remplace si besoin
         $new_s = preg_replace("/{$sortfield}, /", "", $s);
         $new_s = preg_replace("/{$sortfield}/", "", $new_s);
         // ajoute la clause order by correcte
         $new_s = preg_replace("/order\\s+by\\s+/i", "order by {$tri}", $new_s);
         // replace l'ancienne chaîne par la nouvelle
         $valeur = str_replace($s, $new_s, $valeur);
     } else {
         $valeur .= " order by {$tri}";
     }
 }
 print pmb_bidi("<strong>{$msg['procs_ligne']} {$cle} </strong>:&nbsp;{$valeur}<br /><br />");
 if (pmb_strtolower(pmb_substr($valeur, 0, 6)) == "select" || pmb_strtolower(pmb_substr($valeur, 0, 6)) == "create") {
 } else {
     echo "rqt=" . $valeur . "=<br />";
     error_message_history("Requête invalide", "Vous ne pouvez tester que des requêtes de sélection", 1);
     exit;
 }
 if (!explain_requete($valeur)) {
     die("<br /><br />" . $valeur . "<br /><br />" . $msg["proc_param_explain_failed"] . "<br /><br />" . $erreur_explain_rqt);
 }
 $res = @pmb_mysql_query($valeur, $dbh);
 $nbr_lignes = @pmb_mysql_num_rows($res);
 $nbr_champs = @pmb_mysql_num_fields($res);
 if ($nbr_lignes) {
     echo "<table >";
     for ($i = 0; $i < $nbr_champs; $i++) {
         // ajout de liens pour trier les pages
Esempio n. 10
0
}
if ($idcaddie) {
    $myCart = new caddie($idcaddie);
    print pmb_bidi(aff_cart_titre($myCart));
    $droit = verif_droit_proc_caddie($id);
    switch ($action) {
        case 'form_proc':
            $hp = new parameters($id);
            $hp->gen_form("./catalog.php?categ=caddie&sub=pointage&moyen=selection&action=pointe_item&idcaddie={$idcaddie}&id={$id}");
            break;
        case 'pointe_item':
            if ($droit) {
                $hp = new parameters($id);
                $hp->get_final_query();
                echo "<hr />" . $hp->final_query . "<hr />";
                if (pmb_strtolower(pmb_substr($hp->final_query, 0, 6)) != "select") {
                    error_message_history($msg['caddie_action_invalid_query'], $msg['requete_echouee'], 1);
                    exit;
                }
                if (!explain_requete($hp->final_query)) {
                    die("<br /><br />" . $hp->final_query . "<br /><br />" . $msg["proc_param_explain_failed"] . "<br /><br />" . $erreur_explain_rqt);
                }
                $result_selection = pmb_mysql_query($hp->final_query, $dbh);
                if (!$result_selection) {
                    error_message_history($msg['caddie_action_invalid_query'], $msg['requete_echouee'] . pmb_mysql_error(), 1);
                    exit;
                }
                if (pmb_mysql_num_rows($result_selection)) {
                    while ($obj_selection = pmb_mysql_fetch_object($result_selection)) {
                        $myCart->pointe_item($obj_selection->object_id, $obj_selection->object_type);
                    }
Esempio n. 11
0
 static function gen_table_empty_word()
 {
     //ajout des mots pour remplir  $empty_word[]
     global $empty_word;
     mysql_query("delete from empty_words_calculs");
     $temp = "";
     $rqt_words_created = "select mot from mots,linked_mots where id_mot=num_mot and (type_lien=3 or type_lien=2)";
     $query_words_created = mysql_query($rqt_words_created);
     while ($result_words_created = mysql_fetch_object($query_words_created)) {
         $mot = convert_diacrit($result_words_created->mot);
         $words = pmb_alphabetic('^a-z0-9\\s\\*', ' ', pmb_strtolower($mot));
         $words = explode(" ", $words);
         //Variable de stockage des mots restants après supression des mots vides
         //Pour chaque mot
         for ($i = 0; $i < count($words); $i++) {
             $words[$i] = trim($words[$i]);
             //Vérification que ce n'est pas un mot vide
             if (in_array($words[$i], $empty_word) === false) {
                 //Si ce n'est pas un mot vide, on stoque
                 if ($words[$i]) {
                     $temp .= "\$empty_word[] = \"" . $words[$i] . "\";";
                 }
             }
         }
     }
     if ($temp) {
         //insertion dans la base de la date du jour, du code php et du nombre actuel de notices dans la base
         @mysql_query("insert into empty_words_calculs (date_calcul,php_empty_words,archive_calcul) values ('" . today() . "','" . $temp . "',1)");
     }
 }
Esempio n. 12
0
function strip_empty_words($string, $lg = 0)
{
    // on inclut le tableau des mots-vides pour la langue par defaut si elle n'est pas precisee
    // c'est normalement la langue de catalogage...
    // sinon on inclut le tableau des mots vides pour la langue precisee
    // si apres nettoyage des mots vide la chaine est vide alors on garde la chaine telle quelle (sans les accents)
    global $pmb_indexation_lang;
    //	global $lang;
    global $include_path;
    if (!$lg || $lg == $pmb_indexation_lang) {
        global $empty_word;
    } else {
        include "{$include_path}/marc_tables/{$lg}/empty_words";
    }
    //echo "<pre>";
    //print_r($empty_word);
    //echo "</pre>";
    // nettoyage de l'entree
    // traitement des diacritiques
    $string = convert_diacrit($string);
    // Mis en commentaire : qu'en est-il des caracteres non latins ???
    // SUPPRIME DU COMMENTAIRE : ER : 12/05/2004 : ça fait tout merder...
    // RECH_14 : Attention : ici suppression des eventuels "
    //          les " ne sont plus supprimes
    $string = stripslashes($string);
    $string = pmb_alphabetic('^a-z0-9\\s', ' ', pmb_strtolower($string));
    // remplacement espace  insécable 0xA0:	&nbsp;  	Non-breaking space
    $string = clean_nbsp($string);
    // espaces en debut et fin
    $string = pmb_preg_replace('/^\\s+|\\s+$/', '', $string);
    // espaces en double
    $string = pmb_preg_replace('/\\s+/', ' ', $string);
    $string_avant_mots_vides = $string;
    // suppression des mots vides
    if (is_array($empty_word)) {
        foreach ($empty_word as $dummykey => $word) {
            $word = convert_diacrit($word);
            $string = pmb_preg_replace("/^{$word}\$|^{$word}\\s|\\s{$word}\\s|\\s{$word}\$/i", ' ', $string);
            // RECH_14 : suppression des mots vides colles à des guillemets
            if (pmb_preg_match("/\"{$word}\\s/i", $string)) {
                $string = pmb_preg_replace("/\"{$word}\\s/i", '"', $string);
            }
            if (pmb_preg_match("/\\s{$word}\"/i", $string)) {
                $string = pmb_preg_replace("/\\s{$word}\"/i", '"', $string);
            }
        }
    }
    // re nettoyage des espaces generes
    // espaces en debut et fin
    $string = pmb_preg_replace('/^\\s+|\\s+$/', '', $string);
    // espaces en double
    $string = pmb_preg_replace('/\\s+/', ' ', $string);
    if (!$string) {
        $string = $string_avant_mots_vides;
        // re nettoyage des espaces generes
        // espaces en debut et fin
        $string = pmb_preg_replace('/^\\s+|\\s+$/', '', $string);
        // espaces en double
        $string = pmb_preg_replace('/\\s+/', ' ', $string);
    }
    return $string;
}
Esempio n. 13
0
         $error_message .= "<p>{$form_empr_login} : {$msg['empr_form_login']}</p>";
         $nberrors++;
     }
     $requete = "SELECT id_empr, empr_login FROM empr WHERE empr_login='******' and id_empr!='{$id}' ";
     $res = pmb_mysql_query($requete, $dbh);
     $nbr_lignes = pmb_mysql_num_rows($res);
     if ($nbr_lignes) {
         $error_message .= "<p>{$form_empr_login} : {$msg['empr_form_login_existant']}</p>";
         $nberrors++;
     }
 } else {
     $form_empr_login = pmb_substr($form_prenom, 0, 1) . $form_nom;
     $form_empr_login = str_replace(CHR(32), "", $form_empr_login);
     $form_empr_login = pmb_strtolower($form_empr_login);
     $form_empr_login = clean_string($form_empr_login);
     $form_empr_login = convert_diacrit(pmb_strtolower($form_empr_login));
     $form_empr_login = pmb_alphabetic('^a-z0-9\\.\\_\\-\\@', '', $form_empr_login);
     $form_empr_login_original = $form_empr_login;
     $pb = 1;
     $num_login = 1;
     while ($pb == 1) {
         $requete = "SELECT empr_login FROM empr WHERE empr_login='******' LIMIT 1 ";
         $res = pmb_mysql_query($requete, $dbh);
         $nbr_lignes = pmb_mysql_num_rows($res);
         if ($nbr_lignes) {
             $form_empr_login = $form_empr_login_original . $num_login;
             $num_login++;
         } else {
             $pb = 0;
         }
     }
Esempio n. 14
0
     if (!$nb_per_page) {
         $nb_per_page = $nb_per_page_select;
     }
     //parcours du tableau de mots, découpage en colonne et détermination des valeurs par rapport à la pagination et la lettre
     foreach ($words_for_syn as $key => $valeur_syn) {
         if ($valeur_syn != "") {
             if ($letter != 'My') {
                 if (preg_match("/^{$letter}/i", convert_diacrit(pmb_strtolower($valeur_syn)))) {
                     if ($compt >= ($page - 1) * $nb_per_page && $compt < $page * $nb_per_page) {
                         $affichage_mots .= "<a href='#' onClick=\"set_parent('" . $key . "','" . htmlentities(addslashes($valeur_syn), ENT_QUOTES, $charset) . "')\">";
                         $affichage_mots .= htmlentities($valeur_syn, ENT_QUOTES, $charset) . "</a><br />\n";
                     }
                     $compt++;
                 }
             } else {
                 if (pmb_substr($valeur_syn, 0, 1) == '0' || !array_search(convert_diacrit(pmb_strtolower(pmb_substr($valeur_syn, 0, 1))), $alphabet)) {
                     if ($compt >= ($page - 1) * $nb_per_page && $compt < $page * $nb_per_page) {
                         $affichage_mots .= "<a href='#' onClick=\"set_parent('" . $key . "','" . htmlentities(addslashes($valeur_syn), ENT_QUOTES, $charset) . "')\">";
                         $affichage_mots .= htmlentities($valeur_syn, ENT_QUOTES, $charset) . "</a><br />\n";
                     }
                 }
                 $compt++;
             }
         }
     }
     $affichage_mots .= "</div>";
     $affichage_mots .= "<div class='row'>&nbsp;</div><hr />\n";
     //affichage de la pagination
     $affichage_mots .= aff_pagination($baseurl . "&user_input={$user_input}&letter=" . $letter, $compt, $nb_per_page, $page);
     $affichage_mots .= "<div class='row'>&nbsp;</div>\n";
 }
Esempio n. 15
0
             // autre procédure
             $final_query = preg_replace("/CADDIE\\(.*[^\\)]\\)/i", implode(",", $liste_flag), $hp->final_query);
             $result_selection_flag = @pmb_mysql_query($final_query, $dbh);
             if ($result_selection_flag) {
                 $nb_elements_flag = pmb_mysql_affected_rows($dbh);
             } else {
                 $error_message_flag = pmb_mysql_error();
             }
         }
         // fin if autre procédure
     }
 }
 if ($elt_no_flag) {
     $liste_no_flag = $myCart->get_cart("NOFLAG");
     if (count($liste_no_flag)) {
         if (pmb_strtolower(pmb_substr($hp->final_query, 0, 6)) == 'insert') {
             // procédure insert
             for ($icount = 0; $icount < count($liste_no_flag); $icount++) {
                 $final_query = str_replace("CADDIE(NOTI)", $liste_no_flag[$icount], $hp->final_query);
                 $final_query = str_replace("CADDIE(EXPL)", $liste_no_flag[$icount], $final_query);
                 $final_query = str_replace("CADDIE(BULL)", $liste_no_flag[$icount], $final_query);
                 $result_selection_no_flag = @pmb_mysql_query($final_query, $dbh);
                 $nb_elts_traites = pmb_mysql_affected_rows($dbh);
                 if ($nb_elts_traites > 0) {
                     $nb_elements_no_flag += $nb_elts_traites;
                 }
             }
             // fin for
         } else {
             // autre procédure
             $final_query = preg_replace("/CADDIE\\(.*[^\\)]\\)/i", implode(",", $liste_no_flag), $hp->final_query);
Esempio n. 16
0
<?php

// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: shortcuts.php,v 1.10 2014-05-07 09:30:08 Alexandre Exp $
if (stristr($_SERVER['REQUEST_URI'], "shortcuts.php")) {
    die("no access");
}
if (!defined('SHORTCUTS')) {
    define('SHORTCUTS', 1);
    $escape = 27;
    print "\n<script type='text/javascript'>\n<!--\n// affichage des raccourcis\n\nfunction clean_raccourci() {\n\tsetTimeout(\"top.document.getElementById('keystatus').firstChild.nodeValue=' '\",1000);\n}\n\nfunction touche(e) {\n\tif (!e) var e = window.event;\n\tif (e.keyCode) key = e.keyCode;\n\t\telse if (e.which) key = e.which;\n\t\n\ttop.document.getElementById('keystatus').firstChild.nodeValue='{$msg['97']} - '+String.fromCharCode(key);\n\ttop.document.getElementById('keystatus').style.color='#FF0000';\n\tkey = String.fromCharCode(key);\n\tkey = key.toLowerCase();\n\tkey = key.charCodeAt(0);\n\n\t//Traitement des actions\n\tswitch(key) {\n\t\t//case " . ord("s") . ":\n\t\t//\tif (document.getElementById('btsubmit')) document.getElementById('btsubmit').focus();\n\t\t//\te.cancelBubble = true;\n\t\t//\tif (e.stopPropagation) { e.stopPropagation(); }\n\t\t//\tclean_raccourci();\n\t\t//\tbreak;\n\t\tdefault:\t\n\t\t\tswitch(key) {\n";
    if ($raclavier) {
        while (list($cle, $key) = each($raclavier)) {
            print "\t\t\t\tcase " . ord(pmb_strtolower($key[0])) . " : document.location='{$key['1']}'; break;\n";
        }
    }
    print "\t\t\t\tdefault : clean_raccourci(); break;\n";
    print "\t\t\t}\n\t}\n\tdocument.onkeydown=backhome;\n}\n\nfunction backhome(e){\n\tif (!e) var e = window.event;\n\tif (e.keyCode) key = e.keyCode;\n\t\telse if (e.which) key = e.which;\n\n\tif(key == {$escape}) {\n\t\tpropagate=true;\n\t\t//Récupération de l'objet d'origine\n\t\tif (e.target) origine=e.target; else origine=e.srcElement;\n\t    if (origine.getAttribute('completion')) {\n\t\t\tid=origine.getAttribute('id');\n\t\t\tif (document.getElementById('d'+id).style.display=='block') {\n\t\t\t\tpropagate=false;\n\t\t\t}\n\t\t}\t\t\n\t\tif (propagate) {\n\t\t\ttop.document.getElementById('keystatus').firstChild.nodeValue='{$msg['97']}';\n\t\t\ttop.document.getElementById('keystatus').style.color='#FF0000';\n\t\t\twindow.focus();\n\t\t\tdocument.onkeydown=touche;\n\t\t}\n\t}\t\n}\n\ndocument.onkeydown=backhome;\n\n\n\n\n//-->\n</script>\n\n";
}
# fin déclaration