Esempio n. 1
1
function edit_note($id)
{
    if ((string) (int) $id != $id) {
        _die("Invalid ID");
    }
    include "lib/tags.php";
    $post_data =& $_POST;
    foreach (array('ID', 'title', 'contents', 'tags', 'time', 'slug') as $key) {
        $post_data[$key] = pg_escape_string(@$post_data[$key]);
    }
    $post_data['tags'] = clean_tags($post_data['tags']);
    if (trim($post_data['slug']) == '') {
        $post_data['slug'] = make_slug($post_data['title']);
    }
    if (!($time = strtotime(@$post_data['time']))) {
        $time = date("Y-m-d H:i:s O", time());
    } else {
        $time = date("Y-m-d H:i:s O", $time);
    }
    $result = db("UPDATE public.\"notes\" SET \"title\" = '{$post_data['title']}',\n\t\t\t\"contents\" ='{$post_data['contents']}', \"tags\" = '{$post_data['tags']}',\n\t\t\t\"slug\" ='{$post_data['slug']}'\n\t\t\tWHERE \"ID\" = " . pg_escape_string($id));
    if ($result) {
        if (!rebuild_tags()) {
            _die("There was an error rebuilding the tag cloud data.\n\t\t\t\t<a href=\"" . _l("/edit/{$id}") . "\">Go back &rarr;");
        }
        _die("Edit successfull. <a href=\"" . _l("/edit/{$id}") . "\">continue editing &rarr;");
    } else {
        _die("There was an unexpected error.");
    }
}
Esempio n. 2
0
 function analysis_update($values, $other_fields = "")
 {
     global $dbh, $pmb_notice_img_folder_id, $opac_url_base, $pmb_notice_img_pics_max_size;
     global $pmb_map_activate, $pmb_newrecord_timeshift;
     // clean des vieilles nouveautés
     if ($pmb_newrecord_timeshift) {
         $req_old = "UPDATE notices SET notice_date_is_new ='', notice_is_new=0, update_date=update_date where notice_date_is_new !='0000-00-00 00:00:00' and (notice_date_is_new < now() - interval {$pmb_newrecord_timeshift} day )";
         mysql_query($req_old, $dbh);
     }
     if (is_array($values)) {
         $this->analysis_biblio_level = 'a';
         $this->analysis_hierar_level = '2';
         $this->analysis_typdoc = $values['typdoc'];
         $this->analysis_statut = $values['statut'];
         $this->analysis_commentaire_gestion = $values['f_commentaire_gestion'];
         $this->analysis_thumbnail_url = $values['f_thumbnail_url'];
         $this->analysis_tit1 = $values['f_tit1'];
         $this->analysis_tit2 = $values['f_tit2'];
         $this->analysis_tit3 = $values['f_tit3'];
         $this->analysis_tit4 = $values['f_tit4'];
         $this->analysis_n_gen = $values['f_n_gen'];
         $this->analysis_n_contenu = $values['f_n_contenu'];
         $this->analysis_n_resume = $values['f_n_resume'];
         $this->analysis_indexint = $values['f_indexint_id'];
         $this->analysis_index_l = $values['f_indexation'];
         $this->analysis_lien = $values['f_lien'];
         $this->analysis_eformat = $values['f_eformat'];
         $this->analysis_pages = $values['pages'];
         $this->analysis_signature = $values['signature'];
         $this->analysis_indexation_lang = $values['indexation_lang'];
         $this->notice_is_new = $values['notice_is_new'];
         // insert de year à partir de la date de parution du bulletin
         if ($this->date_date) {
             $this->analysis_year = substr($this->date_date, 0, 4);
         }
         $this->date_parution_perio = $this->date_date;
         // construction de la requête :
         $data = "typdoc='" . $this->analysis_typdoc . "'";
         $data .= ", statut='" . $this->analysis_statut . "'";
         $data .= ", tit1='" . $this->analysis_tit1 . "'";
         $data .= ", tit3='" . $this->analysis_tit3 . "'";
         $data .= ", tit4='" . $this->analysis_tit4 . "'";
         $data .= ", year='" . $this->analysis_year . "'";
         $data .= ", npages='" . $this->analysis_pages . "'";
         $data .= ", n_contenu='" . $this->analysis_n_contenu . "'";
         $data .= ", n_gen='" . $this->analysis_n_gen . "'";
         $data .= ", n_resume='{$this->analysis_n_resume}'";
         $data .= ", lien='" . $this->analysis_lien . "'";
         $data .= ", eformat='" . $this->analysis_eformat . "'";
         $data .= ", indexint='" . $this->analysis_indexint . "'";
         $data .= ", index_l='" . clean_tags($this->analysis_index_l) . "'";
         $data .= ", niveau_biblio='" . $this->analysis_biblio_level . "'";
         $data .= ", niveau_hierar='" . $this->analysis_hierar_level . "'";
         $data .= ", commentaire_gestion='" . $this->analysis_commentaire_gestion . "'";
         $data .= ", thumbnail_url='" . $this->analysis_thumbnail_url . "'";
         $data .= ", signature='" . $this->analysis_signature . "'";
         $data .= ", date_parution='" . $this->date_parution_perio . "'";
         $data .= ", indexation_lang='" . $this->analysis_indexation_lang . "'";
         $data .= ", notice_is_new='" . $this->notice_is_new . "' \n\t\t\t{$other_fields}";
         $result = 0;
         if (!$this->analysis_id) {
             // si c'est une création
             // fabrication de la requête finale
             $requete = "INSERT INTO notices SET {$data} , create_date=sysdate(), update_date=sysdate() ";
             $myQuery = pmb_mysql_query($requete, $dbh);
             $this->analysis_id = pmb_mysql_insert_id($dbh);
             if ($myQuery) {
                 $result = $this->analysis_id;
             }
             // si l'insertion est OK, il faut créer l'entrée dans la table 'analysis'
             if ($this->analysis_id) {
                 // autorité personnalisées
                 $authperso = new authperso_notice($this->analysis_id);
                 $authperso->save_form();
                 // map
                 if ($pmb_map_activate) {
                     $map = new map_edition_controler(TYPE_RECORD, $this->analysis_id);
                     $map->save_form();
                     $map_info = new map_info($this->analysis_id);
                     $map_info->save_form();
                 }
                 // Mise à jour des index de la notice
                 notice::majNoticesTotal($this->analysis_id);
                 audit::insert_creation(AUDIT_NOTICE, $this->analysis_id);
                 $requete = 'INSERT INTO analysis SET';
                 $requete .= ' analysis_bulletin=' . $this->id_bulletinage;
                 $requete .= ', analysis_notice=' . $this->analysis_id;
                 $myQuery = pmb_mysql_query($requete, $dbh);
             }
         } else {
             $requete = "UPDATE notices SET {$data} , update_date=sysdate() WHERE notice_id='" . $this->analysis_id . "' LIMIT 1";
             $myQuery = pmb_mysql_query($requete, $dbh);
             // autorité personnalisées
             $authperso = new authperso_notice($this->analysis_id);
             $authperso->save_form();
             // map
             if ($pmb_map_activate) {
                 $map = new map_edition_controler(TYPE_RECORD, $this->analysis_id);
                 $map->save_form();
                 $map_info = new map_info($this->analysis_id);
                 $map_info->save_form();
             }
             // Mise à jour des index de la notice
             notice::majNoticesTotal($this->analysis_id);
             audit::insert_modif(AUDIT_NOTICE, $this->analysis_id);
             if ($myQuery) {
                 $result = $this->analysis_id;
             }
         }
         // vignette de la notice uploadé dans un répertoire
         $id = $this->analysis_id;
         if ($_FILES['f_img_load']['name'] && $pmb_notice_img_folder_id) {
             $poids_fichier_max = 1024 * 1024;
             //Limite la taille de l'image à 1 Mo
             $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'";
             $res = pmb_mysql_query($req, $dbh);
             if (pmb_mysql_num_rows($res)) {
                 $rep = pmb_mysql_fetch_object($res);
                 $filename_output = $rep->repertoire_path . "img_" . $id;
             }
             if (($fp = @fopen($_FILES['f_img_load']['tmp_name'], "rb")) && $filename_output) {
                 $image = "";
                 $size = 0;
                 $flag = true;
                 while (!feof($fp)) {
                     $image .= fread($fp, 4096);
                     $size = strlen($image);
                     if ($size > $poids_fichier_max) {
                         $flag = false;
                         break;
                     }
                 }
                 if ($flag) {
                     if ($img = imagecreatefromstring($image)) {
                         if (!($pmb_notice_img_pics_max_size * 1)) {
                             $pmb_notice_img_pics_max_size = 100;
                         }
                         $redim = false;
                         if (imagesx($img) >= imagesy($img)) {
                             if (imagesx($img) <= $pmb_notice_img_pics_max_size) {
                                 $largeur = imagesx($img);
                                 $hauteur = imagesy($img);
                             } else {
                                 $redim = true;
                                 $largeur = $pmb_notice_img_pics_max_size;
                                 $hauteur = $largeur * imagesy($img) / imagesx($img);
                             }
                         } else {
                             if (imagesy($img) <= $pmb_notice_img_pics_max_size) {
                                 $hauteur = imagesy($img);
                                 $largeur = imagesx($img);
                             } else {
                                 $redim = true;
                                 $hauteur = $pmb_notice_img_pics_max_size;
                                 $largeur = $hauteur * imagesx($img) / imagesy($img);
                             }
                         }
                         if ($redim) {
                             $dest = imagecreatetruecolor($largeur, $hauteur);
                             imagecopyresampled($dest, $img, 0, 0, 0, 0, $largeur, $hauteur, imagesx($img), imagesy($img));
                             imagepng($dest, $filename_output);
                             imagedestroy($dest);
                         } else {
                             imagepng($img, $filename_output);
                         }
                         imagedestroy($img);
                         $thumbnail_url = $opac_url_base . "getimage.php?noticecode=&vigurl=&notice_id=" . $id;
                         $req = "update notices set  thumbnail_url='" . $thumbnail_url . "' where notice_id ='" . $id . "'";
                         $res = pmb_mysql_query($req, $dbh);
                     }
                 }
             }
         }
         return $result;
     }
     //if(is_array($values))
 }
Esempio n. 3
0
}
if (!$id) {
    header("Location: " . BASE_URL . "/post/list");
    exit;
}
if (!empty($_POST["old_tags"]) && empty($_POST["tag_field"])) {
    header("Location: " . BASE_URL . "/post/view/" . $id);
    exit;
}
$user_id = 1;
if (isset($_COOKIE['user_id'])) {
    $user_id = $_COOKIE['user_id'];
}
$old_tags = mysql_real_escape_string($_POST["old_tags"]);
$tags = trim(strtolower(mysql_real_escape_string($_POST["tag_field"])));
$tags = clean_tags($tags);
$source = mysql_real_escape_string($_POST["source_field"]);
$rating = mysql_real_escape_string($_POST["rating"]);
$group = mysql_real_escape_string($_POST["group_field"]);
$frommain = mysql_real_escape_string($_POST["from_main"]);
$parent_post = abs($_POST["parent_post"]);
$urlregex = "^(https?|ftp)\\:\\/\\/([a-z0-9+!*(),;?&=\$_.-]+(\\:[a-z0-9+!*(),;?&=\$_.-]+)?@)?[a-z0-9+\$_-]+(\\.[a-z0-9+\$_-]+)*(\\:[0-9]{2,5})?(\\/([a-z0-9+\$_-]\\.?)+)*\\/?(\\?[a-z+&\$_.-][a-z0-9;:@/&%=+\$_.-]*)?(#[a-z_.-][a-z0-9+\$_.-]*)?\$";
if (!eregi($urlregex, $source)) {
    $source = "";
}
if ($tags != $old_tags) {
    $sql = "INSERT INTO `tag_histories`(id, \n\t\t\t\t\t\t\t\t\t\t\timage_id, \n\t\t\t\t\t\t\t\t\t\t\ttags, \n\t\t\t\t\t\t\t\t\t\t\tuser_id, \n\t\t\t\t\t\t\t\t\t\t\tdate_set, \n\t\t\t\t\t\t\t\t\t\t\tuser_ip) \n\t\t\t\t\tVALUES(NULL, \n\t\t\t\t\t\t   '" . $id . "', \n\t\t\t\t\t\t   '" . $tags . "', \n\t\t\t\t\t\t   '" . $user_id . "', \n\t\t\t\t\t\t   '" . date('Y-m-d H:i:s') . "', \n\t\t\t\t\t\t   '" . $_SERVER['REMOTE_ADDR'] . "')";
    mysql_query($sql);
}
$tag_search = str_replace(" ", "', '", $tags);
$tags = explode(" ", $tags);
Esempio n. 4
0
<?php

require_once 'hibbity/dbinfo.php';
if (USER_LEVEL < TAG_EDIT) {
    header("Location: " . BASE_URL . "/aliases/list");
    exit;
}
$id = abs($_POST["alias_id"]);
if (!isset($_POST['oldtag']) || empty($_POST['oldtag']) || (!isset($_POST['newtag']) || empty($_POST['newtag']))) {
    header("Location: " . BASE_URL . "/aliases/list");
    exit;
}
$oldtag = trim(strtolower(mysql_real_escape_string($_POST["oldtag"])));
$newtag = trim(strtolower(mysql_real_escape_string($_POST['newtag'])));
$reason = mysql_real_escape_string($_POST['reason']);
$oldtag = clean_tags($oldtag);
$newtag = clean_tags($newtag);
$sql = "INSERT IGNORE INTO `tags`(tag) VALUES('" . $newtag . "')";
mysql_query($sql);
if (!$id) {
    $sql = "INSERT INTO `aliases`(oldtag, newtag, reason) VALUES('" . $oldtag . "', '" . $newtag . "', '" . $reason . "')";
    mysql_query($sql);
} else {
    $sql = "UPDATE `aliases` SET oldtag = '" . $oldtag . "', newtag = '" . $newtag . "', reason = '" . $reason . "' WHERE id = " . $id;
    mysql_query($sql);
}
header("Location: " . BASE_URL . "/aliases/list");
 function update_in_database($id_notice = 0)
 {
     global $dbh;
     global $pmb_synchro_rdf;
     $new_notice = 2;
     $notice_retour = $id_notice;
     if (!$id_notice) {
         $retour = array(2, 0);
         return $retour;
     }
     //synchro_rdf
     if ($pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
         $synchro_rdf->delRdf($notice_retour, 0);
     }
     // traitement des titres uniformes
     global $pmb_use_uniform_title;
     if ($pmb_use_uniform_title) {
         if (count($this->titres_uniformes)) {
             $ntu = new tu_notice($id_notice);
             $ntu->update($this->titres_uniformes);
         }
     }
     for ($i = 0; $i < 2; $i++) {
         if ($this->editors[$i]['id']) {
             $editor_ids[$i] = $this->editors[$i]['id'];
         } else {
             $editor_ids[$i] = editeur::import($this->editors[$i]);
         }
     }
     if ($this->collection["id"]) {
         $collection_id = $this->collection["id"];
     } else {
         $this->collection['parent'] = $editor_ids[0];
         $collection_id = collection::import($this->collection);
     }
     if ($this->subcollection["id"]) {
         $subcollection_id = $this->subcollection["id"];
     } else {
         $this->subcollection['coll_parent'] = $collection_id;
         $subcollection_id = subcollection::import($this->subcollection);
         $serie_id = serie::import(stripslashes($this->serie));
     }
     /* traitement de Dewey */
     if (!$this->internal_index) {
         if (!$this->dewey["new_comment"]) {
             $this->dewey["new_comment"] = "";
         }
         if (!$this->dewey["new_pclass"]) {
             $this->dewey["new_pclass"] = "";
         }
         $this->internal_index = indexint::import(clean_string($this->dewey[0]), clean_string($this->dewey["new_comment"]), clean_string($this->dewey["new_pclass"]));
     }
     $date_parution_z3950 = notice::get_date_parution($this->year);
     /* Origine de la notice */
     $this->orinot_id = origine_notice::import($this->origine_notice);
     if ($this->orinot_id == 0) {
         $this->orinot_id = 1;
     }
     $sql_ins = "update notices set\n\t\t\ttypdoc           \t='" . $this->document_type . "',\n\t\t\tcode        \t        ='" . $this->isbn . "',\t            \n\t\t\ttit1                    ='" . $this->titles[0] . "',             \n\t\t\ttit2                    ='" . $this->titles[1] . "',             \n\t\t\ttit3                    ='" . $this->titles[2] . "',             \n\t\t\ttit4                    ='" . $this->titles[3] . "',             \n\t\t\ttparent_id              ='" . $serie_id . "',                    \n\t\t\ttnvol                   ='" . $this->nbr_in_serie . "',          \n\t\t\ted1_id                  =" . $editor_ids[0] . " ,                \n\t\t\ted2_id                  =" . $editor_ids[1] . " ,                \n\t\t\tyear                    ='" . $this->year . "',                  \n\t\t\tnpages                  ='" . $this->page_nbr . "',              \n\t\t\till                     ='" . $this->illustration . "',          \n\t\t\tsize                    ='" . $this->size . "',                  \n\t\t\taccomp                  ='" . $this->accompagnement . "',        \n\t\t\tcoll_id                 =" . $collection_id . " ,                \n\t\t\tsubcoll_id              =" . $subcollection_id . " ,             \n\t\t\tnocoll                  ='" . $this->nbr_in_collection . "',     \n\t\t\tmention_edition         ='" . $this->mention_edition . "',       \n\t\t\tn_gen                   ='" . $this->general_note . "',          \n\t\t\tn_contenu               ='" . $this->content_note . "',          \n\t\t\tn_resume                ='" . $this->abstract_note . "',         \n\t\t\tindexint                ='" . $this->internal_index . "',          \n\t\t\tstatut\t\t\t\t\t='" . $this->statut . "',\n\t\t\tcommentaire_gestion\t\t='" . $this->commentaire_gestion . "',\n\t\t\tindexation_lang\t\t\t='" . $this->indexation_lang . "',\n\t\t\tthumbnail_url\t\t\t='" . $this->thumbnail_url . "',\n\t\t\tindex_l                 ='" . clean_tags($this->free_index) . "',                \n\t\t\tniveau_biblio           ='" . $this->bibliographic_level . "',   \n\t\t\tniveau_hierar           ='" . $this->hierarchic_level . "',      \n\t\t\tlien                    ='" . $this->link_url . "',              \n\t\t\teformat                 ='" . $this->link_format . "',           \n\t\t\torigine_catalogage      ='" . $this->orinot_id . "',             \n\t\t\tprix                    ='" . $this->prix . "',\n\t\t\tdate_parution \t\t\t='" . $date_parution_z3950 . "'             \n\t\t\twhere notice_id='{$id_notice}' ";
     //echo "<pre>";
     //print_r($this->aut_array);
     //echo "</pre>";
     //echo $sql_ins."<br />";
     //echo "<pre>";
     //print_r($this->categories);
     //echo "</pre>";
     //exit;
     $sql_result_ins = pmb_mysql_query($sql_ins) or die("Couldn't update notices : " . $sql_ins);
     $notice_retour = $id_notice;
     audit::insert_modif(AUDIT_NOTICE, $id_notice);
     // purge de la base des responsabilités de la notice intégrée...
     if ($notice_retour) {
         $rqt_del = "delete from responsability where responsability_notice='{$notice_retour}'";
         $sql_result_del = pmb_mysql_query($rqt_del) or die("Couldn't purge table responsability : " . $rqt_del);
     }
     $rqt_ins = "insert into responsability (responsability_author, responsability_notice, responsability_fonction, responsability_type, responsability_ordre) VALUES ";
     for ($i = 0; $i < sizeof($this->aut_array); $i++) {
         $aut['id'] = clean_string($this->aut_array[$i]['id']);
         $aut['name'] = clean_string($this->aut_array[$i]['entree']);
         $aut['rejete'] = clean_string($this->aut_array[$i]['rejete']);
         $aut['date'] = clean_string($this->aut_array[$i]['date']);
         $aut['type'] = $this->aut_array[$i]['type_auteur'];
         $aut['subdivision'] = clean_string($this->aut_array[$i]['subdivision']);
         $aut['numero'] = clean_string($this->aut_array[$i]['numero']);
         $aut['lieu'] = clean_string($this->aut_array[$i]['lieu']);
         $aut['ville'] = clean_string($this->aut_array[$i]['ville']);
         $aut['pays'] = clean_string($this->aut_array[$i]['pays']);
         $aut['web'] = clean_string($this->aut_array[$i]['web']);
         $aut['author_comment'] = clean_string($this->aut_array[$i]['author_comment']);
         $aut['authority_number'] = clean_string($this->aut_array[$i]['authority_number']);
         /* Origine de l'autorité : on reprend les infos d'origine de la notice pour les attribuées aux origines des autorités */
         $id_origine_auth = 0;
         $id_origine_auth = origin_authorities::import($this->origine_notice);
         if ($id_origine_auth == 0) {
             $id_origine_auth = 1;
         }
         // import de l'autorité auteur si elle n'existe pas et conservation des infos sur l'origine de l'autorité
         if ($aut['authority_number'] != '' && $id_origine_auth) {
             $this->aut_array[$i]["id"] = $this->insert_authority_infos($aut['authority_number'], "author", $id_origine_auth, $aut);
         }
         if (!$this->aut_array[$i]["id"]) {
             $this->aut_array[$i]["id"] = auteur::import($aut);
         }
         if ($this->aut_array[$i]["id"]) {
             $rqt = $rqt_ins . " (" . $this->aut_array[$i]["id"] . "," . $notice_retour . ",'" . $this->aut_array[$i]['fonction'] . "'," . $this->aut_array[$i]['responsabilite'] . "," . $i . ") ";
             $res_ins = pmb_mysql_query($rqt, $dbh);
         }
     }
     // traitement des categories
     if ($this->categorisation_type == "categorisation_auto") {
         traite_categories_enreg($notice_retour, $this->categories);
     } else {
         $rqt_del = "delete from notices_categories where notcateg_notice='{$notice_retour}' ";
         $res_del = @pmb_mysql_query($rqt_del, $dbh);
         $rqt_ins = "insert into notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES ";
         $rqt_ins_values = array();
         foreach ($this->categories as $i => $category) {
             $id_categ = $category['categ_id'];
             if ($id_categ) {
                 $rqt_ins_values[] = " ('{$notice_retour}','{$id_categ}', {$i}) ";
             }
         }
         $rqt_ins .= implode(",", $rqt_ins_values);
         $res_ins = @pmb_mysql_query($rqt_ins, $dbh);
     }
     // traitement des langues
     // langues de la publication
     $rqt_del = "delete from notices_langues where num_notice='{$notice_retour}' ";
     $res_del = pmb_mysql_query($rqt_del, $dbh);
     if (is_array($this->language_code) && count($this->language_code)) {
         $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES ";
         foreach ($this->language_code as $ordre_lang => $code_lang) {
             if ($code_lang) {
                 $rqt = $rqt_ins . " ('{$notice_retour}',0, '{$code_lang}', {$ordre_lang}) ";
                 $res_ins = @pmb_mysql_query($rqt, $dbh);
             }
         }
     }
     // langues originales
     if (is_array($this->original_language_code) && count($this->original_language_code)) {
         $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES ";
         foreach ($this->original_language_code as $ordre_lang => $code_lang) {
             if ($code_lang) {
                 $rqt = $rqt_ins . " ('{$notice_retour}',1, '{$code_lang}', {$ordre_lang}) ";
                 $res_ins = @pmb_mysql_query($rqt, $dbh);
             }
         }
     }
     //Traitement des champs personnalisés (du formulaire !!!)
     $p_perso = new parametres_perso("notices");
     $nberrors = $p_perso->check_submited_fields();
     $p_perso->rec_fields_perso($notice_retour);
     //Traitement import perso
     global $notice_id, $notice_org, $notice_type_org;
     if (function_exists('z_recup_noticeunimarc_suite') && function_exists('recup_noticeunimarc_suite')) {
         //Suppression des champs persos
         $requete = "delete from notices_custom_values where notices_custom_origine=" . $notice_retour;
         @pmb_mysql_query($requete);
         $notice_id = $notice_retour;
         z_recup_noticeunimarc_suite($notice_org);
         z_import_new_notice_suite();
     }
     // Mise à jour des index de la notice
     notice::majNotices($notice_retour);
     // Mise à jour de la table notices_global_index
     notice::majNoticesGlobalIndex($notice_retour);
     // Mise à jour de la table notices_mots_global_index
     notice::majNoticesMotsGlobalIndex($notice_retour);
     //Documents numériques
     foreach ($this->doc_nums as $doc_num) {
         if (!$doc_num["a"]) {
             continue;
         }
         explnum_add_from_url($notice_retour, $this->bull_id, $doc_num["b"], $doc_num["a"], false, $this->source_id, $doc_num["f"], '', $doc_num["s"]);
     }
     //synchro_rdf
     if ($pmb_synchro_rdf) {
         $synchro_rdf->addRdf($notice_retour, 0);
     }
     $retour = array($new_notice, $notice_retour);
     return $retour;
 }
Esempio n. 6
0
 $requete .= ", coll_id='{$t_notice['coll_id']}'";
 $requete .= ", subcoll_id='{$t_notice['subcoll_id']}'";
 $requete .= ", year='{$t_notice['year']}'";
 $requete .= ", nocoll='{$t_notice['nocoll']}'";
 $requete .= ", mention_edition='{$t_notice['mention_edition']}'";
 $requete .= ", code='{$t_notice['code']}'";
 $requete .= ", npages='{$t_notice['npages']}'";
 $requete .= ", ill='{$t_notice['ill']}'";
 $requete .= ", size='{$t_notice['size']}'";
 $requete .= ", prix='{$t_notice['prix']}'";
 $requete .= ", accomp='{$t_notice['accomp']}'";
 $requete .= ", n_gen='{$t_notice['n_gen']}'";
 $requete .= ", n_contenu='{$t_notice['n_contenu']}'";
 $requete .= ", n_resume='{$t_notice['n_resume']}'";
 $requete .= ", indexint='{$t_notice['indexint']}'";
 $requete .= ", index_l='" . clean_tags($f_indexation) . "'";
 $requete .= ", lien='{$t_notice['lien']}'";
 $requete .= ", eformat='{$t_notice['eformat']}'";
 $requete .= ", niveau_biblio='{$t_notice['b_level']}'";
 $requete .= ", niveau_hierar='{$t_notice['h_level']}'";
 $requete .= ", statut='{$t_notice['statut']}'";
 $requete .= ", commentaire_gestion='{$t_notice['commentaire_gestion']}'";
 $requete .= ", thumbnail_url='{$t_notice['thumbnail_url']}'";
 $requete .= ", signature='{$t_notice['signature']}'";
 $requete .= ", date_parution='{$date_parution_notice}'";
 $requete .= ", indexation_lang='{$t_notice['indexation_lang']}'";
 $requete .= ", notice_is_new='{$t_notice['notice_is_new']}'";
 $requete .= $req_notice_date_is_new;
 $requete .= $postrequete;
 $result = pmb_mysql_query($requete, $dbh);
 //traitement audit
Esempio n. 7
0
     foreach ($categ_order as $old_order) {
         $var_categid = "f_categ_id{$old_order}";
         if ($var_categid) {
             $f_categ[] = array('id' => ${$var_categid}, 'ordre' => $order);
             $order++;
         }
     }
 } else {
     for ($i = 0; $i < $max_categ; $i++) {
         $var_categid = "f_categ_id{$i}";
         $f_categ[] = array('id' => ${$var_categid}, 'ordre' => $i);
     }
 }
 $table['categ'] = $f_categ;
 $table['indexint'] = $f_indexint_id;
 $table['index_l'] = clean_tags($f_indexation);
 $table['lien'] = $f_lien;
 $table['eformat'] = $f_eformat;
 $table['niveau_biblio'] = $b_level;
 $table['niveau_hierar'] = $h_level;
 $table['ill'] = $f_ill;
 $table['size'] = $f_size;
 $table['prix'] = $f_prix;
 $table['accomp'] = $f_accomp;
 $table['npages'] = $f_npages;
 $table['indexation_lang'] = $indexation_lang;
 if ($table['date_date'] == '0000-00-00' || !isset($date_date_lib)) {
     $table['year'] = "";
 } else {
     $table['year'] = substr($table['date_date'], 0, 4);
 }
Esempio n. 8
0
function process_content($content)
{
    global $QData;
    global $ShownAds;
    global $AdsId;
    global $beginend;
    /* verifying */
    if (is_feed() || strpos($content, '<!--NoAds-->') !== false || strpos($content, '<!--OffAds-->') !== false || is_single() && !get_option('AppPost') || is_page() && !get_option('AppPage') || is_home() && !get_option('AppHome') || is_category() && !get_option('AppCate') || is_archive() && !get_option('AppArch') || is_tag() && !get_option('AppTags') || is_user_logged_in() && get_option('AppLogg')) {
        $content = clean_tags($content);
        return $content;
    }
    $AdsToShow = get_option('AdsDisp');
    if (strpos($content, '<!--OffWidget-->') === false) {
        for ($i = 1; $i <= $QData['AdsWid']; $i++) {
            $wadsid = sanitize_title(str_replace(array('(', ')'), '', sprintf($QData['AdsWidName'], $i)));
            $AdsToShow -= is_active_widget(true, $wadsid) ? 1 : 0;
        }
    }
    if ($ShownAds >= $AdsToShow) {
        $content = clean_tags($content);
        return $content;
    }
    if (!count($AdsId)) {
        for ($i = 1; $i <= $QData['Ads']; $i++) {
            $tmp = trim(get_option('AdsCode' . $i));
            if (!empty($tmp)) {
                array_push($AdsId, $i);
            }
        }
    }
    if (!count($AdsId)) {
        $content = clean_tags($content);
        return $content;
    }
    /* ... Tidy up content ... */
    $content = str_replace("<p></p>", "##QA-TP1##", $content);
    $content = str_replace("<p>&nbsp;</p>", "##QA-TP2##", $content);
    $offdef = strpos($content, '<!--OffDef-->') !== false;
    if (!$offdef) {
        $AdsIdCus = array();
        $cusads = 'CusAds';
        $cusrnd = 'CusRnd';
        $more1 = get_option('MoreAds');
        $more2 = get_option('MoreRnd');
        $lapa1 = get_option('LapaAds');
        $lapa2 = get_option('LapaRnd');
        $begn1 = get_option('BegnAds');
        $begn2 = get_option('BegnRnd');
        $midd1 = get_option('MiddAds');
        $midd2 = get_option('MiddRnd');
        $endi1 = get_option('EndiAds');
        $endi2 = get_option('EndiRnd');
        $rc = 3;
        for ($i = 1; $i <= $rc; $i++) {
            $para1[$i] = get_option('Par' . $i . 'Ads');
            $para2[$i] = get_option('Par' . $i . 'Rnd');
            $para3[$i] = get_option('Par' . $i . 'Nup');
            $para4[$i] = get_option('Par' . $i . 'Con');
        }
        $imge1 = get_option('Img1Ads');
        $imge2 = get_option('Img1Rnd');
        $imge3 = get_option('Img1Nup');
        $imge4 = get_option('Img1Con');
        if ($begn2 == 0) {
            $b1 = $cusrnd;
        } else {
            $b1 = $cusads . $begn2;
            array_push($AdsIdCus, $begn2);
        }
        if ($more2 == 0) {
            $r1 = $cusrnd;
        } else {
            $r1 = $cusads . $more2;
            array_push($AdsIdCus, $more2);
        }
        if ($midd2 == 0) {
            $m1 = $cusrnd;
        } else {
            $m1 = $cusads . $midd2;
            array_push($AdsIdCus, $midd2);
        }
        if ($lapa2 == 0) {
            $g1 = $cusrnd;
        } else {
            $g1 = $cusads . $lapa2;
            array_push($AdsIdCus, $lapa2);
        }
        if ($endi2 == 0) {
            $b2 = $cusrnd;
        } else {
            $b2 = $cusads . $endi2;
            array_push($AdsIdCus, $endi2);
        }
        for ($i = 1; $i <= $rc; $i++) {
            if ($para2[$i] == 0) {
                $b3[$i] = $cusrnd;
            } else {
                $b3[$i] = $cusads . $para2[$i];
                array_push($AdsIdCus, $para2[$i]);
            }
        }
        if ($imge2 == 0) {
            $b4 = $cusrnd;
        } else {
            $b4 = $cusads . $imge2;
            array_push($AdsIdCus, $imge2);
        }
        if ($midd1 && strpos($content, '<!--OffMiddle-->') === false) {
            if (substr_count(strtolower($content), '</p>') >= 2) {
                $sch = "</p>";
                $content = str_replace("</P>", $sch, $content);
                $arr = explode($sch, $content);
                $nn = 0;
                $mm = strlen($content) / 2;
                for ($i = 0; $i < count($arr); $i++) {
                    $nn += strlen($arr[$i]) + 4;
                    if ($nn > $mm) {
                        if ($mm - ($nn - strlen($arr[$i])) > $nn - $mm && $i + 1 < count($arr)) {
                            $arr[$i + 1] = '<!--' . $m1 . '-->' . $arr[$i + 1];
                        } else {
                            $arr[$i] = '<!--' . $m1 . '-->' . $arr[$i];
                        }
                        break;
                    }
                }
                $content = implode($sch, $arr);
            }
        }
        if ($more1 && strpos($content, '<!--OffAfMore-->') === false) {
            $mmr = '<!--' . $r1 . '-->';
            $postid = get_the_ID();
            $content = str_replace('<span id="more-' . $postid . '"></span>', $mmr, $content);
        }
        if ($begn1 && strpos($content, '<!--OffBegin-->') === false) {
            $content = '<!--' . $b1 . '-->' . $content;
        }
        if ($endi1 && strpos($content, '<!--OffEnd-->') === false) {
            $content = $content . '<!--' . $b2 . '-->';
        }
        if ($lapa1 && strpos($content, '<!--OffBfLastPara-->') === false) {
            $sch = "<p>";
            $content = str_replace("<P>", $sch, $content);
            $arr = explode($sch, $content);
            if (count($arr) > 2) {
                $content = implode($sch, array_slice($arr, 0, count($arr) - 1)) . '<!--' . $g1 . '-->' . $sch . $arr[count($arr) - 1];
            }
        }
        for ($i = $rc; $i >= 1; $i--) {
            if ($para1[$i]) {
                $sch = "</p>";
                $content = str_replace("</P>", $sch, $content);
                $arr = explode($sch, $content);
                if ((int) $para3[$i] < count($arr)) {
                    $content = implode($sch, array_slice($arr, 0, $para3[$i])) . $sch . '<!--' . $b3[$i] . '-->' . implode($sch, array_slice($arr, $para3[$i]));
                } elseif ($para4[$i]) {
                    $content = implode($sch, $arr) . '<!--' . $b3[$i] . '-->';
                }
            }
        }
        if ($imge1) {
            $sch = "<img";
            $bch = ">";
            $cph = "[/caption]";
            $csa = "</a>";
            $content = str_replace("<IMG", $sch, $content);
            $content = str_replace("</A>", $csa, $content);
            $arr = explode($sch, $content);
            if ((int) $imge3 < count($arr)) {
                $trr = explode($bch, $arr[$imge3]);
                if (count($trr) > 1) {
                    $tss = explode($cph, $arr[$imge3]);
                    $ccp = count($tss) > 1 ? strpos(strtolower($tss[0]), '[caption ') === false : false;
                    $tuu = explode($csa, $arr[$imge3]);
                    $cdu = count($tuu) > 1 ? strpos(strtolower($tuu[0]), '<a href') === false : false;
                    if ($imge4 && $ccp) {
                        $arr[$imge3] = implode($cph, array_slice($tss, 0, 1)) . $cph . "\r\n" . '<!--' . $b4 . '-->' . "\r\n" . implode($cph, array_slice($tss, 1));
                    } else {
                        if ($cdu) {
                            $arr[$imge3] = implode($csa, array_slice($tuu, 0, 1)) . $csa . "\r\n" . '<!--' . $b4 . '-->' . "\r\n" . implode($csa, array_slice($tuu, 1));
                        } else {
                            $arr[$imge3] = implode($bch, array_slice($trr, 0, 1)) . $bch . "\r\n" . '<!--' . $b4 . '-->' . "\r\n" . implode($bch, array_slice($trr, 1));
                        }
                    }
                }
                $content = implode($sch, $arr);
            }
        }
    }
    /* ... Tidy up content ... */
    $content = '<!--EmptyClear-->' . $content . "\n" . '<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>';
    $content = clean_tags($content, true);
    $ismany = !is_single() && !is_page();
    $showall = get_option('AppMaxA');
    /* ... Replace Beginning/Middle/End Ads1-10 ... */
    if (!$offdef) {
        for ($i = 1; $i <= count($AdsIdCus); $i++) {
            if ($showall || !$ismany || $beginend != $i) {
                if (strpos($content, '<!--' . $cusads . $AdsIdCus[$i - 1] . '-->') !== false && in_array($AdsIdCus[$i - 1], $AdsId)) {
                    $content = replace_ads($content, $cusads . $AdsIdCus[$i - 1], $AdsIdCus[$i - 1]);
                    $AdsId = del_element($AdsId, array_search($AdsIdCus[$i - 1], $AdsId));
                    $ShownAds += 1;
                    if ($ShownAds >= $AdsToShow || !count($AdsId)) {
                        $content = clean_tags($content);
                        return $content;
                    }
                    $beginend = $i;
                    if (!$showall && $ismany) {
                        break;
                    }
                }
            }
        }
    }
    /* ... Replace Ads1 to Ads10 ... */
    if ($showall || !$ismany) {
        $tcn = count($AdsId);
        $tt = 0;
        for ($i = 1; $i <= $tcn; $i++) {
            if (strpos($content, '<!--Ads' . $AdsId[$tt] . '-->') !== false) {
                $content = replace_ads($content, 'Ads' . $AdsId[$tt], $AdsId[$tt]);
                $AdsId = del_element($AdsId, $tt);
                $ShownAds += 1;
                if ($ShownAds >= $AdsToShow || !count($AdsId)) {
                    $content = clean_tags($content);
                    return $content;
                }
            } else {
                $tt += 1;
            }
        }
    }
    /* ... Replace Beginning/Middle/End random Ads ... */
    if (strpos($content, '<!--' . $cusrnd . '-->') !== false && ($showall || !$ismany)) {
        $tcx = count($AdsId);
        $tcy = substr_count($content, '<!--' . $cusrnd . '-->');
        for ($i = $tcx; $i <= $tcy - 1; $i++) {
            array_push($AdsId, -1);
        }
        shuffle($AdsId);
        for ($i = 1; $i <= $tcy; $i++) {
            $content = replace_ads($content, $cusrnd, $AdsId[0]);
            $AdsId = del_element($AdsId, 0);
            $ShownAds += 1;
            if ($ShownAds >= $AdsToShow || !count($AdsId)) {
                $content = clean_tags($content);
                return $content;
            }
        }
    }
    /* ... Replace RndAds ... */
    if (strpos($content, '<!--RndAds-->') !== false && ($showall || !$ismany)) {
        $AdsIdTmp = array();
        shuffle($AdsId);
        for ($i = 1; $i <= $AdsToShow - $ShownAds; $i++) {
            if ($i <= count($AdsId)) {
                array_push($AdsIdTmp, $AdsId[$i - 1]);
            }
        }
        $tcx = count($AdsIdTmp);
        $tcy = substr_count($content, '<!--RndAds-->');
        for ($i = $tcx; $i <= $tcy - 1; $i++) {
            array_push($AdsIdTmp, -1);
        }
        shuffle($AdsIdTmp);
        for ($i = 1; $i <= $tcy; $i++) {
            $tmp = $AdsIdTmp[0];
            $content = replace_ads($content, 'RndAds', $AdsIdTmp[0]);
            $AdsIdTmp = del_element($AdsIdTmp, 0);
            if ($tmp != -1) {
                $ShownAds += 1;
            }
            if ($ShownAds >= $AdsToShow || !count($AdsIdTmp)) {
                $content = clean_tags($content);
                return $content;
            }
        }
    }
    /* ... That's it. DONE :) ... */
    $content = clean_tags($content);
    return $content;
}
Esempio n. 9
0
 static function majNotices_clean_tags($notice = 0, $with_reindex = true)
 {
     global $dbh;
     $requete = "select index_l ,notice_id from notices where index_l is not null and index_l!='' ";
     if ($notice) {
         $requete .= " and notice_id = {$notice} ";
     }
     $res = pmb_mysql_query($requete, $dbh);
     if ($res && pmb_mysql_num_rows($res)) {
         while ($r = pmb_mysql_fetch_object($res)) {
             $val = clean_tags($r->index_l);
             $requete = "update notices set index_l='" . addslashes($val) . "' where notice_id=" . $r->notice_id;
             pmb_mysql_query($requete, $dbh);
             if ($with_reindex && $val != $r->index_l) {
                 //On réindexe la notice si le nettoyage à réalisé des changements
                 notice::majNoticesTotal($r->notice_id);
             }
         }
     }
 }
Esempio n. 10
0
function make_oembed_template($res_body, $ori_url, &$can_save)
{
    if (empty($res_body)) {
        return null;
    }
    $data = json_decode($res_body);
    if (empty($data)) {
        return null;
    }
    $favicon_url = "http://www.appgame.com/favicon.ico";
    $provider_name = $data->provider_name;
    $provider_url = $data->provider_url;
    $image = $data->thumbnail_url;
    $title = $data->title;
    $content = $data->html;
    /*
    	//截断过长的html内容
            mb_internal_encoding("UTF-8");
    
    	if (mb_strlen($content) > 255) {
    		$content = remove_html_tag($content);
    	}
    */
    mb_internal_encoding("UTF-8");
    $content = clean_tags($content);
    //构造html模板
    $html = make_onebox_from_template($provider_url, $provider_name, $favicon_url, $ori_url, $title, $image, $content);
    $can_save = $image && $title && $content;
    return $html;
}
Esempio n. 11
0
<?php

/* Adds a post to the database */
if (!(isset($_POST) && @$_POST['title'] != '')) {
    _die("tpl/post_form.html");
}
include "lib/post.php";
include "lib/tags.php";
$post_data =& $_POST;
foreach (array('title', 'contents', 'tags', 'time', 'slug') as $key) {
    $post_data[$key] = pg_escape_string(@$post_data[$key]);
}
$post_data['tags'] = clean_tags($post_data['tags']);
if (trim($post_data['slug']) == '') {
    $post_data['slug'] = make_slug($post_data['title']);
}
if (!($time = strtotime(@$post_data['time']))) {
    $time = date("Y-m-d H:i:s O", time());
} else {
    $time = date("Y-m-d H:i:s O", $time);
}
if (db('INSERT INTO "public"."notes" ("title", "contents", "slug", "tags", "time") VALUES (' . "\n\t'{$post_data['title']}','{$post_data['contents']}','{$post_data['slug']}','{$post_data['tags']}','{$time}' )")) {
    add_tags($post_data['tags']);
    header('Location: ' . _l("/archive/{$_POST['slug']}"));
} else {
    _die("Some error occoured. Try again.");
}
Esempio n. 12
0
<?php

require_once 'hibbity/dbinfo.php';
if (USER_LEVEL < TAG_EDIT) {
    header("Location: " . BASE_URL . "/aliases/list");
    exit;
}
$id = abs($_POST["implication_id"]);
if (!isset($_POST['tag']) || empty($_POST['tag']) || (!isset($_POST['implies']) || empty($_POST['implies']))) {
    header("Location: " . BASE_URL . "/implications/list");
    exit;
}
$tag = trim(strtolower(mysql_real_escape_string($_POST["tag"])));
$implies = trim(strtolower(mysql_real_escape_string($_POST['implies'])));
$reason = mysql_real_escape_string($_POST['reason']);
$tag = clean_tags($tag);
$implies = clean_tags($implies);
$sql = "INSERT IGNORE INTO `tags`(tag) VALUES('" . $tag . "')";
mysql_query($sql);
$sql = "INSERT IGNORE INTO `tags`(tag) VALUES('" . $implies . "')";
mysql_query($sql);
if (!$id) {
    $sql = "INSERT INTO `implications`(tag, implies, reason) VALUES('" . $tag . "', '" . $implies . "', '" . $reason . "')";
    mysql_query($sql);
} else {
    $sql = "UPDATE `implications` SET tag = '" . $tag . "', implies = '" . $implies . "', reason = '" . $reason . "' WHERE id = " . $id;
    mysql_query($sql);
}
header("Location: " . BASE_URL . "/implications/list");
Esempio n. 13
0
<?php

require_once 'hibbity/dbinfo.php';
if (USER_LEVEL < TAG_EDIT) {
    header("Location: " . BASE_URL . "/tags/list");
    exit;
}
$id = abs($_POST["tag_id"]);
if (!isset($_POST['name_field']) || empty($_POST['name_field']) || (!isset($_POST['tag_type']) || empty($_POST['tag_type']))) {
    header("Location: " . BASE_URL . "/tags/list");
    exit;
}
$tag_name = trim(strtolower(mysql_real_escape_string($_POST["name_field"])));
$tag_type = strtolower($_POST['tag_type']);
$tag_name = clean_tags($tag_name);
switch ($tag_type) {
    case 'normal':
    case 'character':
    case 'artist':
    case 'series':
    case 'company':
        break;
    default:
        $tag_type = 'normal';
        break;
}
if (!$id) {
    $sql = "INSERT INTO `tags`(tag, type) VALUES('" . $tag_name . "', '" . $tag_type . "')";
    mysql_query($sql);
} else {
    $sql = "UPDATE tags SET tag = '" . $tag_name . "', type = '" . $tag_type . "' WHERE id = " . $id;
Esempio n. 14
0
            $entry = null;
            for ($j = $i + 1; $j < $size_cf; $j++) {
                $entry[] = $conf_file[$j];
                if (preg_match("/<\\/\\s*agentless\\s*>/", $conf_file[$j], $match)) {
                    $i = $j++;
                    array_pop($entry);
                    sort($entry);
                    if (count($entry) == 5) {
                        $host_tag = clean_tags("host", $entry[2]);
                        if (array_key_exists($host_tag, $agentless_entry_ossec)) {
                            $host = explode("@", $host_tag);
                            $ip = $host[1];
                            $arguments = clean_tags("arguments", $entry[0]);
                            $frequency = clean_tags("frequency", $entry[1]);
                            $state = clean_tags("state", $entry[3]);
                            $type = clean_tags("type", $entry[4]);
                            Agentless::add_monitoring_entry($conn, $ip, $type, $frequency, $state, $arguments);
                        }
                    }
                    $entry = null;
                    $i = $j++;
                    break;
                }
            }
        } else {
            $i++;
        }
    }
}
$agentless_list = null;
$extra = !empty($search) ? $search . " ORDER BY {$order} {$limit}" : "ORDER BY {$order} {$limit}";