本文整理汇总了PHP中strip_empty_chars函数的典型用法代码示例。如果您正苦于以下问题:PHP strip_empty_chars函数的具体用法?PHP strip_empty_chars怎么用?PHP strip_empty_chars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strip_empty_chars函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_array
function get_array($start = '', $pos_cursor = 0)
{
global $dbh;
global $pmb_keyword_sep;
$liste_mots = array();
$liste_res = array();
$tags = array();
$liste_finale = array();
$deb_chaine = '';
$fin_chaine = '';
if (strlen($start) == $pos_cursor) {
$liste_mots = explode($pmb_keyword_sep, $start);
$mot = array_pop($liste_mots);
$deb_chaine = implode($pmb_keyword_sep, $liste_mots);
if (trim($deb_chaine) !== '') {
$deb_chaine .= $pmb_keyword_sep;
}
} else {
$liste_mots = explode($pmb_keyword_sep, substr($start, 0, $pos_cursor));
$mot = array_pop($liste_mots);
$deb_chaine = implode($pmb_keyword_sep, $liste_mots);
if (trim($deb_chaine) !== '') {
$deb_chaine .= $pmb_keyword_sep;
}
$liste_mots = explode($pmb_keyword_sep, substr($start, $pos_cursor));
array_shift($liste_mots);
$fin_chaine = $pmb_keyword_sep . implode($pmb_keyword_sep, $liste_mots);
}
$mot = trim($mot);
if ($mot === '') {
return $liste_finale;
}
$this->search_tag = $mot;
$requete = "select distinct index_l from notices where index_l is not null and index_l like '" . addslashes($mot) . "%' or index_l like '%" . $pmb_keyword_sep . addslashes($mot) . "%' ";
$res = mysql_query($requete, $dbh);
while ($mot_trouve = mysql_fetch_object($res)) {
$liste_tmp = explode($pmb_keyword_sep, $mot_trouve->index_l);
foreach ($liste_tmp as $v) {
if (strip_empty_chars(substr($v, 0, strlen($mot))) == strip_empty_chars($mot)) {
$liste_res[] = $v;
}
}
}
$liste_res = array_unique($liste_res);
asort($liste_res);
foreach ($liste_res as $v) {
$liste_finale[] = array($v => $deb_chaine . $v . $fin_chaine);
}
return $liste_finale;
}
示例2: maj_indexation
//.........这里部分代码省略.........
pmb_mysql_query($req_del, $dbh);
//la table pour les recherche exacte
$req_del = "delete from cms_editorial_fields_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "' and code_champ='" . $id . "' ";
pmb_mysql_query($req_del, $dbh);
}
}
}
//qu'est-ce qu'on met a jour ?
$tab_insert = array();
$tab_field_insert = array();
foreach ($tab_req as $k => $v) {
$r = pmb_mysql_query($v["rqt"], $dbh);
$tab_mots = array();
$tab_fields = array();
if (pmb_mysql_num_rows($r)) {
while ($tab_row = pmb_mysql_fetch_array($r, MYSQL_ASSOC)) {
if (isset($tab_row[$tab_languages[$k]])) {
$lang = $tab_row[$tab_languages[$k]];
unset($tab_row[$tab_languages[$k]]);
} else {
$lang = "";
}
foreach ($tab_row as $nom_champ => $liste_mots) {
if ($tab_code_champ[$k][$nom_champ]['marctype']) {
$marclist = new marc_list($tab_code_champ[$k][$nom_champ]['marctype']);
$liste_mots = $marclist->table[$liste_mots];
}
if ($liste_mots != '') {
$liste_mots = strip_tags($liste_mots);
$tab_tmp = array();
if (!in_array($k, $tab_keep_empty)) {
$tab_tmp = explode(' ', strip_empty_words($liste_mots));
} else {
$tab_tmp = explode(' ', strip_empty_chars(clean_string($liste_mots)));
}
// if($lang!="") $tab_tmp[]=$lang;
//la table pour les recherche exacte
if (!$tab_fields[$nom_champ]) {
$tab_fields[$nom_champ] = array();
}
$tab_fields[$nom_champ][] = array('value' => trim($liste_mots), 'lang' => $lang);
if (!$tab_code_champ[$k][$nom_champ]['no_words']) {
foreach ($tab_tmp as $mot) {
if (trim($mot)) {
$tab_mots[$nom_champ][$mot] = $lang;
}
}
}
}
}
}
}
foreach ($tab_mots as $nom_champ => $tab) {
$pos = 1;
foreach ($tab as $mot => $lang) {
//on cherche le mot dans la table de mot...
$num_word = 0;
$query = "select id_word from words where word = '" . $mot . "' and lang = '" . $lang . "'";
$result = pmb_mysql_query($query);
if (pmb_mysql_num_rows($result)) {
$num_word = pmb_mysql_result($result, 0, 0);
} else {
$dmeta = new DoubleMetaPhone($mot);
$stemming = new stemming($mot);
$element_to_update = "";
if ($dmeta->primary || $dmeta->secondary) {
示例3: import_new_notice_suite
//.........这里部分代码省略.........
if (mysql_num_rows($resultat)) {
$value = mysql_result($resultat, 0, 0);
$requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_genre},{$notice_id},{$value})";
mysql_query($requete, $dbh);
$done = TRUE;
}
}
//essai dans theme
if (!$done && $idc_theme) {
$requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_905[$i][$j]) . "' and notices_custom_champ={$idc_theme} ";
$resultat = mysql_query($requete, $dbh);
if (mysql_num_rows($resultat)) {
$value = mysql_result($resultat, 0, 0);
$requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_theme},{$notice_id},{$value})";
mysql_query($requete, $dbh);
$done = TRUE;
}
}
//essai dans discipline
if (!$done && $idc_discipline) {
$requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_905[$i][$j]) . "' and notices_custom_champ={$idc_discipline} ";
$resultat = mysql_query($requete, $dbh);
if (mysql_num_rows($resultat)) {
$value = mysql_result($resultat, 0, 0);
$requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_discipline},{$notice_id},{$value})";
mysql_query($requete, $dbh);
$done = TRUE;
}
}
//essai dans pays
if (!$done) {
$done_pa = FALSE;
if (!$done && $idc_pays) {
$i_pays = strip_empty_chars($info_905[$i][$j]);
$requete = "select notices_custom_list_value,notices_custom_list_lib from notices_custom_lists where notices_custom_champ={$idc_pays} ";
$resultat = mysql_query($requete, $dbh);
if (mysql_num_rows($resultat)) {
while ($row = mysql_fetch_object($resultat)) {
$r_pays = strip_empty_chars($row->notices_custom_list_lib);
if (strpos($i_pays, $r_pays) !== FALSE) {
$value = $row->notices_custom_list_value;
$requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_pays},{$notice_id},{$value})";
mysql_query($requete, $dbh);
$done_pa = TRUE;
break;
}
}
}
}
//essai dans periode
$done_pe = FALSE;
if (!$done && $idc_periode) {
$i_periode = strip_empty_chars($info_905[$i][$j]);
$requete = "select notices_custom_list_value,notices_custom_list_lib from notices_custom_lists where notices_custom_champ={$idc_periode} ";
$resultat = mysql_query($requete, $dbh);
if (mysql_num_rows($resultat)) {
while ($row = mysql_fetch_object($resultat)) {
$r_periode = strip_empty_chars($row->notices_custom_list_lib);
if (strpos($i_periode, $r_periode) !== FALSE) {
$value = $row->notices_custom_list_value;
$requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_periode},{$notice_id},{$value})";
mysql_query($requete, $dbh);
$done_pe = TRUE;
break;
}
}
示例4: getEnrichment
function getEnrichment($notice_id, $source_id, $type = "", $enrich_params = array())
{
$params = $this->get_source_params($source_id);
if ($params["PARAMETERS"]) {
//Affichage du formulaire avec $params["PARAMETERS"]
$vars = unserialize($params["PARAMETERS"]);
foreach ($vars as $key => $val) {
global ${$key};
${$key} = $val;
}
}
$enrichment = array();
//on renvoi ce qui est demandé... si on demande rien, on renvoi tout..
switch ($type) {
case str_replace(array(" ", "%", "-", "?", "!", ";", ",", ":"), "", strip_empty_chars(strtolower($libelle))):
default:
$enrichment[str_replace(array(" ", "%", "-", "?", "!", ";", ",", ":"), "", strip_empty_chars(strtolower($libelle)))]['content'] = $this->urlsInfos($notice_id, $source_id);
break;
}
$enrichment['source_label'] = sprintf($this->msg['urlslist_enrichment_source'], $source_name);
return $enrichment;
}
示例5: floor
print "<img src='../../images/jauge.png' width='{$state}' height='16px'></td></tr></table>";
// calcul pourcentage avancement
$percent = floor($start / $count * 100);
// affichage du % d'avancement et de l'état
print "<div align='center'>{$percent}%</div>";
require_once "{$class_path}/rdf/ontology.class.php";
$op = new ontology_parser("{$class_path}/rdf/skos_pmb.rdf");
$sh = new skos_handler($op);
while ($triple = pmb_mysql_fetch_object($r_sel)) {
$type = $sh->op->from_ns($sh->get_object_type($triple->subject_uri));
$q_ins = "insert ignore into rdfstore_index ";
$q_ins .= "set num_triple='" . $triple->num_triple . "', ";
$q_ins .= "subject_uri='" . addslashes($triple->subject_uri) . "', ";
$q_ins .= "subject_type='" . addslashes($type) . "', ";
$q_ins .= "predicat_uri='" . addslashes($triple->predicat_uri) . "', ";
$q_ins .= "num_object='" . $triple->num_object . "', ";
$q_ins .= "object_val ='" . addslashes($triple->object_val) . "', ";
$q_ins .= "object_index=' " . strip_empty_chars($triple->object_val) . " ', ";
$q_ins .= "object_lang ='" . addslashes($triple->object_lang) . "' ";
$r_ins = pmb_mysql_query($q_ins, $dbh);
}
$next = $start + $lot;
print "\n\t\t<form class='form-{$current_module}' name='current_state' action='./clean.php' method='post'>\n\t\t<input type='hidden' name='v_state' value=\"" . urlencode($v_state) . "\">\n\t\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t\t<input type='hidden' name='start' value=\"{$next}\">\n\t\t<input type='hidden' name='count' value=\"{$count}\">\n\t\t</form>\n\t\t<script type=\"text/javascript\"><!-- \n\t\tsetTimeout(\"document.forms['current_state'].submit()\",1000); \n\t\t-->\n\t\t</script>";
} else {
$spec = $spec - INDEX_RDFSTORE;
$not = pmb_mysql_query("select count(1) from rdfstore_triple where o_type=2", $dbh);
$compte = pmb_mysql_result($not, 0, 0);
$v_state .= "<br /><img src=../../images/d.gif hspace=3>" . htmlentities($msg['nettoyage_rdfstore_reindexation'], ENT_QUOTES, $charset) . " : ";
$v_state .= $compte . " " . htmlentities($msg['nettoyage_rdfstore_reindex_elt'], ENT_QUOTES, $charset);
print "\n\t\t<form class='form-{$current_module}' name='process_state' action='./clean.php' method='post'>\n\t\t<input type='hidden' name='v_state' value=\"" . urlencode($v_state) . "\">\n\t\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t\t</form>\n\t\t<script type=\"text/javascript\"><!--\n\t\t\tdocument.forms['process_state'].submit();\n\t\t\t-->\n\t\t</script>";
}
示例6: make_search
//.........这里部分代码省略.........
reset($var_table);
while (list($var_name, $var_value) = each($var_table)) {
$q[$k]["MAIN"] = str_replace("!!" . $var_name . "!!", $var_value, $q[$k]["MAIN"]);
$q[$k]["MULTIPLE_TERM"] = str_replace("!!" . $var_name . "!!", $var_value, $q[$k]["MULTIPLE_TERM"]);
}
}
$last_main_table = "";
// pour les listes, si un opérateur permet une valeur vide, il en faut une...
if ($this->op_empty[${$op}] && !is_array($field)) {
$field = array();
$field[0] = "";
}
// si sélection d'autorité et champ vide : on ne doit pas le prendre en compte
if (${$op} == 'AUTHORITY') {
$suppr = false;
foreach ($field as $k => $v) {
if ($v == 0) {
unset($field[$k]);
$suppr = true;
}
}
if ($suppr) {
$field = array_values($field);
}
}
//Pour chaque valeur du champ
for ($j = 0; $j < count($field); $j++) {
//Pour chaque requete
$field_origine = $field[$j];
for ($z = 0; $z < count($q) - 1; $z++) {
//Pour chaque valeur du cha
//Si le nettoyage de la saisie est demande
if ($q[$z]["KEEP_EMPTYWORD"]) {
$field[$j] = strip_empty_chars($field_origine);
} elseif ($q[$z]["REGDIACRIT"]) {
$field[$j] = strip_empty_words($field_origine);
} elseif ($q[$z]["DETECTDATE"]) {
$field[$j] = detectFormatDate($field_origine, $q[$z]["DETECTDATE"]);
}
$main = $q[$z]["MAIN"];
//Si il y a plusieurs termes possibles on construit la requete avec le terme !!multiple_term!!
if ($q[$z]["MULTIPLE_WORDS"]) {
$terms = explode(" ", $field[$j]);
//Pour chaque terme,
$multiple_terms = array();
for ($k = 0; $k < count($terms); $k++) {
$multiple_terms[] = str_replace("!!p!!", $terms[$k], $q[$z]["MULTIPLE_TERM"]);
}
$final_term = implode(" " . $q[$z]["MULTIPLE_OPERATOR"] . " ", $multiple_terms);
$main = str_replace("!!multiple_term!!", $final_term, $main);
//Si la saisie est un ISBN
} else {
if ($q[$z]["ISBN"]) {
//Code brut
$terms[0] = $field[$j];
//EAN ?
if (isEAN($field[$j])) {
//C'est un isbn ?
if (isISBN($field[$j])) {
$rawisbn = preg_replace('/-|\\.| /', '', $field[$j]);
//On envoi tout ce qu'on sait faire en matiere d'ISBN, en raw et en formatte, en 10 et en 13
$terms[1] = formatISBN($rawisbn, 10);
$terms[2] = formatISBN($rawisbn, 13);
$terms[3] = preg_replace('/-|\\.| /', '', $terms[1]);
$terms[4] = preg_replace('/-|\\.| /', '', $terms[2]);
}
示例7: update_index_tu
static function update_index_tu($tu_id)
{
global $dbh;
global $msg;
global $include_path;
if ($tu_id) {
$requete = "UPDATE titres_uniformes SET index_tu=";
$oeuvre = new titre_uniforme($tu_id);
$auteur = new auteur($oeuvre->num_author);
$index .= $oeuvre->name . " " . $oeuvre->tonalite . " " . $oeuvre->subject . " " . $oeuvre->place . " " . $oeuvre->history . " ";
$index .= $oeuvre->date . " " . $oeuvre->context . " " . $oeuvre->equinox . " " . $oeuvre->coordinates . " ";
$index .= $auteur->name . " " . $auteur->rejete . " ";
$req = "SELECT distrib_name FROM tu_distrib WHERE distrib_num_tu='{$tu_id}' ";
$res = mysql_query($req, $dbh);
if ($distrib = mysql_fetch_object($res)) {
$index .= $distrib->distrib_name . " ";
}
$req = "SELECT ref_name FROM tu_ref WHERE ref_num_tu='{$tu_id}' ";
$res = mysql_query($req, $dbh);
if ($ref = mysql_fetch_object($res)) {
$index .= $ref->ref_name . " ";
}
$requete .= "' " . addslashes(strip_empty_chars($index)) . " ' WHERE tu_id=" . $tu_id;
$result = mysql_query($requete, $dbh);
}
return;
}
示例8: majNoticesMotsGlobalIndex
//.........这里部分代码省略.........
if (isset($tab_row[$tab_languages[$k]])) {
$langage = $tab_row[$tab_languages[$k]];
unset($tab_row[$tab_languages[$k]]);
}
foreach ($tab_row as $nom_champ => $liste_mots) {
if (substr($nom_champ, 0, 10) == 'subst_for_') {
continue;
}
if ($tab_code_champ[$k][$nom_champ]['internal']) {
$langage = $indexation_lang;
}
if ($tab_code_champ[$k][$nom_champ]['marctype']) {
//on veut toutes les langues, pas seulement celle de l'interface...
$saved_lang = $lang;
$code = $liste_mots;
$dir = opendir($include_path . "/marc_tables");
while ($dir_lang = readdir($dir)) {
if ($dir_lang != "." && $dir_lang != ".." && $dir_lang != "CVS" && $dir_lang != ".svn" && is_dir($include_path . "/marc_tables/" . $dir_lang)) {
$lang = $dir_lang;
$marclist = new marc_list($tab_code_champ[$k][$nom_champ]['marctype']);
$liste_mots = $marclist->table[$code];
$tab_fields[$nom_champ][] = array('value' => trim($liste_mots), 'lang' => $lang, 'autorite' => $tab_row["subst_for_marc_" . $tab_code_champ[$k][$nom_champ]['marctype']]);
}
}
$lang = $saved_lang;
$liste_mots = "";
}
if ($liste_mots != '') {
$tab_tmp = array();
$liste_mots = strip_tags($liste_mots);
if (!in_array($k, $tab_keep_empty)) {
$tab_tmp = explode(' ', strip_empty_words($liste_mots));
} else {
$tab_tmp = explode(' ', strip_empty_chars(clean_string($liste_mots)));
}
// if($lang!="") $tab_tmp[]=$lang;
//la table pour les recherche exacte
if (!$tab_fields[$nom_champ]) {
$tab_fields[$nom_champ] = array();
}
if (!$tab_code_champ[$k][$nom_champ]['use_global_separator']) {
$tab_fields[$nom_champ][] = array('value' => trim($liste_mots), 'lang' => $langage, 'autorite' => $tab_row["subst_for_autorite_" . $tab_code_champ[$k][$nom_champ]['autorite']]);
} else {
$var_global_sep = $tab_code_champ[$k][$nom_champ]['use_global_separator'];
global ${$var_global_sep};
$tab_liste_mots = explode(${$var_global_sep}, $liste_mots);
if (count($tab_liste_mots)) {
foreach ($tab_liste_mots as $mot) {
$tab_fields[$nom_champ][] = array('value' => trim($mot), 'lang' => $langage, 'autorite' => $tab_row["subst_for_autorite_" . $tab_code_champ[$k][$nom_champ]['autorite']]);
}
}
}
if (!$tab_code_champ[$k][$nom_champ]['no_words']) {
foreach ($tab_tmp as $mot) {
if (trim($mot)) {
$langageKey = $langage;
if (!trim($langageKey)) {
$langageKey = "empty";
}
$tab_mots[$nom_champ][$langageKey][] = $mot;
}
}
}
}
}
}
示例9: import
function import($data)
{
global $dbh;
// check sur le type de la variable passee en parametre
if (!sizeof($data) || !is_array($data)) {
// si ce n'est pas un tableau ou un tableau vide, on retourne 0
return 0;
}
// tentative de recuperer l'id associee dans la base (implique que l'autorite existe)
// preparation de la requeªte
$long_maxi = pmb_mysql_field_len(pmb_mysql_query("SELECT ed_name FROM publishers limit 1"), 0);
$key = addslashes(rtrim(substr(preg_replace('/\\[|\\]/', '', rtrim(ltrim($data['name']))), 0, $long_maxi)));
$ville = addslashes(trim($data['ville']));
$adr = addslashes(trim($data['adr']));
$adr2 = addslashes(trim($data['adr2']));
$cp = addslashes(trim($data['cp']));
$pays = addslashes(trim($data['pays']));
$web = addslashes(trim($data['web']));
$ed_comment = addslashes(trim($data['ed_comment']));
if ($key == "") {
return 0;
}
/* on laisse tomber les editeurs sans nom !!! exact. FL*/
$query = "SELECT ed_id FROM publishers WHERE ed_name='{$key}' and ed_ville = '{$ville}' ";
$result = @pmb_mysql_query($query, $dbh);
if (!$result) {
die("can't SELECT publisher " . $query);
}
// resultat
// recuperation du resultat de la recherche
$tediteur = pmb_mysql_fetch_object($result);
// et recuperation eventuelle de l'id
if ($tediteur->ed_id) {
return $tediteur->ed_id;
}
// id non-recuperee, il faut creer la forme.
$query = "INSERT INTO publishers SET ed_name='{$key}', ed_ville = '{$ville}', ed_adr1 = '{$adr}', ed_comment='" . $ed_comment . "', ed_adr2='" . $adr2 . "', ed_cp='" . $cp . "', ed_pays='" . $pays . "', ed_web='" . $web . "', index_publisher=' " . strip_empty_chars($key) . " ' ";
$result = @pmb_mysql_query($query, $dbh);
if (!$result) {
die("can't INSERT into publisher : " . $query);
}
$id = pmb_mysql_insert_id($dbh);
audit::insert_creation(AUDIT_PUBLISHER, $id);
return $id;
}
示例10: htmlentities
}
print "<br /><br /><h2 align='center'>" . htmlentities($msg["nettoyage_reindex_publishers"], ENT_QUOTES, $charset) . "</h2>";
$query = mysql_query("SELECT ed_id as id, ed_name as publisher, ed_ville, ed_pays from publishers LIMIT {$start}, {$lot}");
if (mysql_num_rows($query)) {
// définition de l'état de la jauge
$state = floor($start / ($count / $jauge_size));
// mise à jour de l'affichage de la jauge
print "<table border='0' align='center' width='{$jauge_size}' cellpadding='0'><tr><td class='jauge'>";
print "<img src='../../images/jauge.png' width='{$state}' height='16'></td></tr></table>";
// calcul pourcentage avancement
$percent = floor($start / $count * 100);
// affichage du % d'avancement et de l'état
print "<div align='center'>{$percent}%</div>";
while ($row = mysql_fetch_object($query)) {
// constitution des pseudo-indexes
$ind_elt = strip_empty_chars($row->publisher . " " . $row->ed_ville . " " . $row->ed_pays);
$req_update = "UPDATE publishers ";
$req_update .= " SET index_publisher=' {$ind_elt} '";
$req_update .= " WHERE ed_id={$row->id} ";
$update = mysql_query($req_update);
}
mysql_free_result($query);
$next = $start + $lot;
print "\n\t\t\t\t<form class='form-{$current_module}' name='current_state' action='./clean.php' method='post'>\n\t\t\t\t<input type='hidden' name='v_state' value=\"" . urlencode($v_state) . "\">\n\t\t\t\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t\t\t\t<input type='hidden' name='start' value=\"{$next}\">\n\t\t\t\t<input type='hidden' name='count' value=\"{$count}\">\n\t\t\t\t<input type='hidden' name='index_quoi' value=\"EDITEURS\">\n\t\t\t\t</form>\n\t\t\t\t<script type=\"text/javascript\"><!-- \n\t\t\t\t\tsetTimeout(\"document.forms['current_state'].submit()\",1000); \n\t\t\t\t\t-->\n\t\t\t\t</script>";
} else {
// mise à jour de l'affichage de la jauge
print "<table border='0' align='center' width='{$table_size}' cellpadding='0'><tr><td class='jauge'>";
print "<img src='../../images/jauge.png' width='{$jauge_size}' height='16'></td></tr></table>";
print "<div align='center'>100%</div>";
$v_state .= "<br /><img src=../../images/d.gif hspace=3>" . htmlentities($msg["nettoyage_reindex_publishers"], ENT_QUOTES, $charset) . " {$count} " . htmlentities($msg["nettoyage_res_reindex_publishers"], ENT_QUOTES, $charset);
print "\n\t\t\t\t<form class='form-{$current_module}' name='current_state' action='./clean.php' method='post'>\n\t\t\t\t<input type='hidden' name='v_state' value=\"" . urlencode($v_state) . "\">\n\t\t\t\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t\t\t\t<input type='hidden' name='start' value='0'>\n\t\t\t\t<input type='hidden' name='count' value='0'>\n\t\t\t\t<input type='hidden' name='index_quoi' value=\"CATEGORIES\">\n\t\t\t\t</form>\n\t\t\t\t<script type=\"text/javascript\"><!-- \n\t\t\t\t\tsetTimeout(\"document.forms['current_state'].submit()\",1000); \n\t\t\t\t\t-->\n\t\t\t\t</script>";
示例11: import
function import($data)
{
// cette méthode prend en entrée un tableau constitué des informations éditeurs suivantes :
// $data['type'] type de l'autorité (70 , 71 ou 72)
// $data['name'] élément d'entrée de l'autorité
// $data['rejete'] élément rejeté
// $data['date'] dates de l'autorité
// $data['lieu'] lieu du congrès 210$e
// $data['ville'] ville du congrès
// $data['pays'] pays du congrès
// $data['subdivision'] 210$b
// $data['numero'] numero du congrès 210$d
// $data['voir_id'] id de la forme retenue (sans objet pour l'import de notices)
// $data['author_comment'] commentaire
// $data['authority_number'] Numéro d'autortité
// TODO gestion du dédoublonnage !
global $dbh;
global $opac_enrichment_bnf_sparql;
// check sur le type de la variable passée en paramètre
if (!sizeof($data) || !is_array($data)) {
// si ce n'est pas un tableau ou un tableau vide, on retourne 0
return 0;
}
// check sur les éléments du tableau (data['name'] ou data['rejete'] est requis).
$long_maxi_name = pmb_mysql_field_len(pmb_mysql_query("SELECT author_name FROM authors limit 1"), 0);
$long_maxi_rejete = pmb_mysql_field_len(pmb_mysql_query("SELECT author_rejete FROM authors limit 1"), 0);
$data['name'] = rtrim(substr(preg_replace('/\\[|\\]/', '', rtrim(ltrim($data['name']))), 0, $long_maxi_name));
$data['rejete'] = rtrim(substr(preg_replace('/\\[|\\]/', '', rtrim(ltrim($data['rejete']))), 0, $long_maxi_rejete));
if (!$data['name'] && !$data['rejete']) {
return 0;
}
// check sur le type d'autorité
if (!$data['type'] == 70 && !$data['type'] == 71 && !$data['type'] == 72) {
return 0;
}
// tentative de récupérer l'id associée dans la base (implique que l'autorité existe)
// préparation de la requête
$key0 = $data['type'];
$key1 = addslashes($data['name']);
$key2 = addslashes($data['rejete']);
$key3 = addslashes($data['date']);
$key4 = addslashes($data['subdivision']);
$key5 = addslashes($data['lieu']);
$key6 = addslashes($data['ville']);
$key7 = addslashes($data['pays']);
$key8 = addslashes($data['numero']);
$data['lieu'] = addslashes($data['lieu']);
$data['ville'] = addslashes($data['ville']);
$data['pays'] = addslashes($data['pays']);
$data['subdivision'] = addslashes($data['subdivision']);
$data['numero'] = addslashes($data['numero']);
$data['author_comment'] = addslashes($data['author_comment']);
$data['author_web'] = addslashes($data['author_web']);
$query = "SELECT author_id FROM authors WHERE author_type='{$key0}' AND author_name='{$key1}' AND author_rejete='{$key2}' AND author_date='{$key3}'";
if ($data["type"] > 70) {
$query .= " and author_subdivision='{$key4}' and author_lieu='{$key5}' and author_ville='{$key6}' and author_pays='{$key7}' and author_numero='{$key8}'";
}
$query .= " LIMIT 1";
$result = @pmb_mysql_query($query, $dbh);
if (!$result) {
die("can't SELECT in database");
}
// résultat
// récupération du résultat de la recherche
$aut = pmb_mysql_fetch_object($result);
// du résultat et récupération éventuelle de l'id
if ($aut->author_id) {
return $aut->author_id;
}
// id non-récupérée, il faut créer l'auteur
$query = "INSERT INTO authors SET author_type='{$key0}', ";
$query .= "author_name='{$key1}', ";
$query .= "author_rejete='{$key2}', ";
$query .= "author_date='{$key3}', ";
$query .= "author_lieu='" . $data['lieu'] . "', ";
$query .= "author_ville='" . $data['ville'] . "', ";
$query .= "author_pays='" . $data['pays'] . "', ";
$query .= "author_subdivision='" . $data['subdivision'] . "', ";
$query .= "author_numero='" . $data['numero'] . "', ";
$query .= "author_web='" . $data['author_web'] . "', ";
$query .= "author_comment='" . $data['author_comment'] . "', ";
$word_to_index = $key1 . " " . $key2 . " " . $data['lieu'] . " " . $data['ville'] . " " . $data['pays'] . " " . $data['numero'] . " " . $data["subdivision"];
if ($key0 == "72") {
$word_to_index .= " " . $key3;
}
$query .= "index_author=' " . strip_empty_chars($word_to_index) . " ' ";
$result = @pmb_mysql_query($query, $dbh);
if (!$result) {
die("can't INSERT into table authors :<br /><b>{$query}</b> ");
}
$id = pmb_mysql_insert_id($dbh);
audit::insert_creation(AUDIT_AUTHOR, $id);
return $id;
}
示例12: majNoticesGlobalIndex
function majNoticesGlobalIndex($notice, $NoIndex = 1, $contenuflux = "")
{
global $dbh;
pmb_mysql_query("delete from notices_global_index where num_notice = " . $notice . " AND no_index = " . $NoIndex, $dbh);
$titres = pmb_mysql_query("select index_serie, tnvol, index_wew, index_sew, index_l, index_matieres, n_gen, n_contenu, n_resume, index_n_gen, index_n_contenu, index_n_resume, eformat from notices where notice_id = " . $notice, $dbh);
$mesNotices = pmb_mysql_fetch_assoc($titres);
$tit = $mesNotices['index_wew'];
$indTit = $mesNotices['index_sew'];
$indMat = $mesNotices['index_matieres'];
$indL = $mesNotices['index_l'];
$indResume = $mesNotices['index_n_resume'];
$indGen = $mesNotices['index_n_gen'];
$indContenu = $mesNotices['index_n_contenu'];
$resume = $mesNotices['n_resume'];
$gen = $mesNotices['n_gen'];
$contenu = $mesNotices['n_contenu'];
$indSerie = $mesNotices['index_serie'];
$tvol = $mesNotices['tnvol'];
$eformatlien = $mesNotices['eformat'];
$infos_global = ' ';
$infos_global_index = " ";
pmb_mysql_query("insert into notices_global_index (num_notice, no_index, infos_global, index_infos_global) values(" . $notice . "," . $NoIndex . ",\n\tCONCAT(' " . addslashes($tvol) . " ','" . addslashes($tit) . " ','" . addslashes($resume) . " ','" . addslashes($gen) . " ','" . addslashes($contenu) . " ','" . addslashes($indL) . " '),\n\tCONCAT(' " . $indSerie . " ','" . addslashes($indTit) . " ','" . addslashes($indResume) . " ','" . addslashes($indGen) . " ','" . addslashes($indContenu) . " ','" . addslashes($indMat) . " '))", $dbh);
// Authors :
$auteurs = pmb_mysql_query("select author_name, author_rejete, index_author from authors, responsability WHERE responsability_author = author_id AND responsability_notice = {$notice}", $dbh);
$numA = pmb_mysql_num_rows($auteurs);
for ($j = 0; $j < $numA; $j++) {
$mesAuteurs = pmb_mysql_fetch_assoc($auteurs);
$infos_global .= $mesAuteurs['author_name'] . ' ' . $mesAuteurs['author_rejete'] . ' ';
$infos_global_index .= strip_empty_chars($mesAuteurs['author_name'] . ' ' . $mesAuteurs['author_rejete']) . " ";
}
pmb_mysql_free_result($auteurs);
// Nom du p�riodique associ�e � la notice de d�pouillement le cas �ch�ant :
$temp = pmb_mysql_query("select bulletin_notice, bulletin_titre, index_titre, index_wew, index_sew from analysis, bulletins, notices WHERE analysis_notice=" . $notice . " and analysis_bulletin = bulletin_id and bulletin_notice=notice_id", $dbh);
$numP = pmb_mysql_num_rows($temp);
if ($numP) {
// La notice appartient a un perdiodique, on selectionne le titre de p�riodique :
$mesTemp = pmb_mysql_fetch_assoc($temp);
$infos_global .= $mesTemp['index_wew'] . ' ' . $mesTemp['bulletin_titre'] . ' ' . $mesTemp['index_titre'] . ' ';
$infos_global_index .= strip_empty_words($mesTemp['index_wew'] . ' ' . $mesTemp['bulletin_titre'] . ' ' . $mesTemp['index_titre']) . " ";
}
pmb_mysql_free_result($temp);
// Categories :
$noeud = pmb_mysql_query("select notices_categories.num_noeud,libelle_categorie from notices_categories,categories where notcateg_notice = " . $notice . " and notices_categories.num_noeud=categories.num_noeud order by ordre_categorie", $dbh);
$numNoeuds = pmb_mysql_num_rows($noeud);
// Pour chaque noeud trouv�s on cherche les noeuds parents et les noeuds fils :
for ($j = 0; $j < $numNoeuds; $j++) {
// On met � jours la table notices_global_index avec le noeud trouv�:
$mesNoeuds = pmb_mysql_fetch_assoc($noeud);
$noeudInit = $mesNoeuds['num_noeud'];
$infos_global .= $mesNoeuds['libelle_categorie'] . " ";
$infos_global_index .= strip_empty_words($mesNoeuds['libelle_categorie']) . " ";
}
// Sous-collection :
$subColls = pmb_mysql_query("select sub_coll_name, index_sub_coll from notices, sub_collections WHERE subcoll_id = sub_coll_id AND notice_id = " . $notice, $dbh);
$numSC = pmb_mysql_num_rows($subColls);
for ($j = 0; $j < $numSC; $j++) {
$mesSubColl = pmb_mysql_fetch_assoc($subColls);
$infos_global .= $mesSubColl['index_sub_coll'] . ' ' . $mesSubColl['sub_coll_name'] . ' ';
$infos_global_index .= strip_empty_words($mesSubColl['index_sub_coll'] . ' ' . $mesSubColl['sub_coll_name']) . " ";
}
pmb_mysql_free_result($subColls);
// Indexation num�rique :
$indexNums = pmb_mysql_query("select indexint_name, indexint_comment, index_indexint from notices, indexint WHERE indexint = indexint_id AND notice_id = " . $notice, $dbh);
$numIN = pmb_mysql_num_rows($indexNums);
for ($j = 0; $j < $numIN; $j++) {
$mesindexNums = pmb_mysql_fetch_assoc($indexNums);
$infos_global .= $mesindexNums['indexint_name'] . ' ' . $mesindexNums['indexint_comment'] . ' ';
$infos_global_index .= strip_empty_words($mesindexNums['indexint_name'] . ' ' . $mesindexNums['indexint_comment']) . " ";
}
pmb_mysql_free_result($indexNums);
// Collection :
$Colls = pmb_mysql_query("select collection_name, index_coll from notices, collections WHERE coll_id = collection_id AND notice_id = " . $notice, $dbh);
$numCo = pmb_mysql_num_rows($Colls);
for ($j = 0; $j < $numCo; $j++) {
$mesColl = pmb_mysql_fetch_assoc($Colls);
$infos_global .= $mesColl['collection_name'] . ' ';
$infos_global_index .= strip_empty_words($mesColl['collection_name']) . " ";
}
pmb_mysql_free_result($Colls);
// Editeurs :
$editeurs = pmb_mysql_query("select ed_name, index_publisher from notices, publishers WHERE (ed1_id = ed_id OR ed2_id = ed_id) AND notice_id = " . $notice, $dbh);
$numE = pmb_mysql_num_rows($editeurs);
for ($j = 0; $j < $numE; $j++) {
$mesEditeurs = pmb_mysql_fetch_assoc($editeurs);
$infos_global .= $mesEditeurs['ed_name'] . ' ';
$infos_global_index .= strip_empty_chars($mesEditeurs['ed_name']) . " ";
}
pmb_mysql_free_result($editeurs);
pmb_mysql_free_result($titres);
// champ perso cherchable
$p_perso = new parametres_perso("notices");
$mots_perso = $p_perso->get_fields_recherche($notice);
if ($mots_perso) {
$infos_global .= $mots_perso . ' ';
$infos_global_index .= strip_empty_words($mots_perso) . " ";
}
// flux RSS éventuellement
$eformat = array();
$eformat = explode(' ', $eformatlien);
if ($eformat[0] == 'RSS' && $eformat[3] == '1') {
//.........这里部分代码省略.........
示例13: do_login
static function do_login($nom, $prenom)
{
global $dbh;
$nom_forate = str_replace(' ', '', strtolower(strip_empty_chars($nom)));
$prenom_forate = str_replace(' ', '', strtolower(strip_empty_chars($prenom)));
$empr_login = substr($prenom_forate, 0, 1) . $nom_forate;
$pb = 1;
$num_login = 1;
$empr_login2 = $empr_login;
while ($pb == 1) {
$q = "SELECT empr_login FROM empr WHERE empr_login='{$empr_login2}' LIMIT 1 ";
$r = mysql_query($q, $dbh);
$nb = mysql_num_rows($r);
if ($nb) {
$empr_login2 = $empr_login . $num_login;
$num_login++;
} else {
$pb = 0;
}
}
return $empr_login2;
}
示例14: maj
//.........这里部分代码省略.........
if (isset($tab_row[$this->tab_languages[$k]])) {
$langage = $tab_row[$this->tab_languages[$k]];
unset($tab_row[$this->tab_languages[$k]]);
}
foreach ($tab_row as $nom_champ => $liste_mots) {
if (substr($nom_champ, 0, 10) == 'subst_for_') {
continue;
}
if ($this->tab_code_champ[$k][$nom_champ]['internal']) {
$langage = $indexation_lang;
}
if ($this->tab_code_champ[$k][$nom_champ]['marctype']) {
//on veut toutes les langues, pas seulement celle de l'interface...
$saved_lang = $lang;
$code = $liste_mots;
$dir = opendir($include_path . "/marc_tables");
while ($dir_lang = readdir($dir)) {
if ($dir_lang != "." && $dir_lang != ".." && $dir_lang != "CVS" && $dir_lang != ".svn" && is_dir($include_path . "/marc_tables/" . $dir_lang)) {
$lang = $dir_lang;
$marclist = new marc_list($this->tab_code_champ[$k][$nom_champ]['marctype']);
$liste_mots = $marclist->table[$code];
$tab_fields[$nom_champ][] = array('value' => trim($liste_mots), 'lang' => $lang, 'autorite' => $tab_row["subst_for_marc_" . $this->tab_code_champ[$k][$nom_champ]['marctype']]);
}
}
$lang = $saved_lang;
$liste_mots = "";
}
if ($liste_mots != '') {
$liste_mots = strip_tags($liste_mots);
$tab_tmp = array();
if (!in_array($k, $this->tab_keep_empty)) {
$tab_tmp = explode(' ', strip_empty_words($liste_mots));
} else {
$tab_tmp = explode(' ', strip_empty_chars(clean_string($liste_mots)));
}
// if($lang!="") $tab_tmp[]=$lang;
//la table pour les recherche exacte
if (!$tab_fields[$nom_champ]) {
$tab_fields[$nom_champ] = array();
}
$tab_fields[$nom_champ][] = array('value' => trim($liste_mots), 'lang' => $langage, 'autorite' => $tab_row["subst_for_autorite_" . $this->tab_code_champ[$k][$nom_champ]['autorite']]);
if (!$this->tab_code_champ[$k][$nom_champ]['no_words']) {
foreach ($tab_tmp as $mot) {
if (trim($mot)) {
$tab_mots[$nom_champ][$mot] = $langage;
}
}
}
}
}
}
}
foreach ($tab_mots as $nom_champ => $tab) {
$memo_ss_champ = "";
$order_fields = 1;
$pos = 1;
foreach ($tab as $mot => $langage) {
$num_word = indexation::add_word($mot, $langage);
if ($num_word != 0) {
$tab_insert[] = "(" . $object_id . "," . $this->tab_code_champ[$k][$nom_champ]['champ'] . "," . $this->tab_code_champ[$k][$nom_champ]['ss_champ'] . "," . $num_word . "," . $this->tab_code_champ[$k][$nom_champ]['pond'] . ",{$order_fields},{$pos})";
$pos++;
if ($this->tab_code_champ[$k][$nom_champ]['ss_champ'] != $memo_ss_champ) {
$order_fields++;
}
$memo_ss_champ = $this->tab_code_champ[$k][$nom_champ]['ss_champ'];
}
示例15: getTypeOfEnrichment
function getTypeOfEnrichment($notice_id, $source_id)
{
$params = $this->get_source_params($source_id);
if ($params["PARAMETERS"]) {
//Affichage du formulaire avec $params["PARAMETERS"]
$vars = unserialize($params["PARAMETERS"]);
foreach ($vars as $key => $val) {
global ${$key};
${$key} = $val;
}
}
$type['type'] = array(array('code' => str_replace(array(" ", "%", "-", "?", "!", ";", ",", ":"), "", strip_empty_chars(strtolower($libelle))), 'label' => $libelle, 'infobulle' => $infobulle));
$type['source_id'] = $source_id;
return $type;
}