本文整理汇总了PHP中pmb_preg_replace函数的典型用法代码示例。如果您正苦于以下问题:PHP pmb_preg_replace函数的具体用法?PHP pmb_preg_replace怎么用?PHP pmb_preg_replace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pmb_preg_replace函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_datas
public function get_datas()
{
global $opac_url_base;
global $opac_show_book_pics;
global $opac_book_pics_url;
$datas = parent::get_datas();
$notices = $datas['records'];
$query = "select notice_id,tit1,thumbnail_url,code from notices where notice_id in(" . implode(",", $notices) . ")";
$result = pmb_mysql_query($query);
$notices = array();
if (pmb_mysql_num_rows($result)) {
while ($row = pmb_mysql_fetch_object($result)) {
if ($opac_show_book_pics == '1' && ($opac_book_pics_url || $row->thumbnail_url)) {
$code_chiffre = pmb_preg_replace('/-|\\.| /', '', $row->code);
$url_image = $opac_book_pics_url;
$url_image = $opac_url_base . "getimage.php?url_image=" . urlencode($url_image) . "¬icecode=!!noticecode!!&vigurl=" . urlencode($row->thumbnail_url);
if ($row->thumbnail_url) {
$url_vign = $row->thumbnail_url;
} else {
if ($code_chiffre) {
$url_vign = str_replace("!!noticecode!!", $code_chiffre, $url_image);
} else {
$url_vign = $opac_url_base . "images/vide.png";
}
}
}
$notices[] = array('title' => $row->tit1, 'link' => $opac_url_base . "?lvl=notice_display&id=" . $row->notice_id, 'vign' => $url_vign);
}
}
return array('records' => $notices);
}
示例2: get_datas
public function get_datas()
{
global $opac_show_book_pics;
global $opac_book_pics_url;
global $opac_url_base;
//on commence par récupérer l'identifiant retourné par le sélecteur...
if ($this->parameters['selector'] != "") {
for ($i = 0; $i < count($this->selectors); $i++) {
if ($this->selectors[$i]['name'] == $this->parameters['selector']) {
$selector = new $this->parameters['selector']($this->selectors[$i]['id']);
break;
}
}
$notice = $selector->get_value();
if (is_array($notice)) {
$notice = $notice[0];
}
if ($notice) {
$group_metadatas = parent::get_group_metadatas();
$datas = array();
$notice_class = new notice($notice);
if ($opac_show_book_pics == '1' && ($opac_book_pics_url || $notice_class->thumbnail_url)) {
$code_chiffre = pmb_preg_replace('/-|\\.| /', '', $notice_class->code);
$url_image = $opac_book_pics_url;
$url_image = $opac_url_base . "getimage.php?url_image=" . urlencode($url_image) . "¬icecode=!!noticecode!!&vigurl=" . urlencode($notice_class->thumbnail_url);
if ($notice_class->thumbnail_url) {
$url_vign = $notice_class->thumbnail_url;
} else {
if ($code_chiffre) {
$url_vign = str_replace("!!noticecode!!", $code_chiffre, $url_image);
} else {
$url_vign = $opac_url_base . "images/vide.png";
}
}
}
$datas = array('id' => $notice_class->id, 'title' => $notice_class->tit1, 'link' => $this->get_constructed_link("notice", $notice_class->id), 'logo_url' => $url_vign, 'header' => $notice_class->notice_header, 'resume' => $notice_class->n_resume, 'content' => $content, 'type' => 'notice');
$datas["details"] = $datas;
$datas = array_merge($datas, parent::get_datas());
$datas['link'] = $this->get_constructed_link("notice", $notice_class->id);
foreach ($group_metadatas as $i => $metadatas) {
if (is_array($metadatas["metadatas"])) {
foreach ($metadatas["metadatas"] as $key => $value) {
try {
$group_metadatas[$i]["metadatas"][$key] = H2o::parseString($value)->render($datas);
} catch (Exception $e) {
}
}
}
}
return $group_metadatas;
}
}
return false;
}
示例3: render
public function render($datas)
{
global $opac_notice_affichage_class;
global $opac_show_book_pics;
global $opac_book_pics_url;
global $opac_book_pics_msg;
if (!$opac_notice_affichage_class) {
$opac_notice_affichage_class = "notice_affichage";
}
//on rajoute nos éléments...
//le titre
$render_datas = array();
$render_datas['title'] = $datas["title"];
$render_datas['records'] = array();
if (is_array($datas["records"])) {
foreach ($datas["records"] as $notice) {
//on calcule les templates pour chaque notices...
$notice_class = new $opac_notice_affichage_class($notice);
$notice_class->do_header();
if ($notice_class->notice->niveau_biblio != "b") {
$notice_id = $notice_class->notice_id;
$is_bulletin = false;
} else {
$notice_id = $notice_class->bulletin_id;
$is_bulletin = true;
}
if ($opac_show_book_pics == '1' && ($opac_book_pics_url || $notice_class->notice->thumbnail_url)) {
$code_chiffre = pmb_preg_replace('/-|\\.| /', '', $notice_class->notice->code);
$url_image = $opac_book_pics_url;
$url_image = $opac_url_base . "getimage.php?url_image=" . urlencode($url_image) . "¬icecode=!!noticecode!!&vigurl=" . urlencode($notice_class->notice->thumbnail_url);
if ($notice_class->notice->thumbnail_url) {
$url_vign = $notice_class->notice->thumbnail_url;
} else {
if ($code_chiffre) {
$url_vign = str_replace("!!noticecode!!", $code_chiffre, $url_image);
} else {
$url_vign = $opac_url_base . "images/vide.png";
}
}
}
$infos = array('id' => $notice_id, 'title' => $notice_class->notice->tit1, 'vign' => $url_vign, 'header' => $notice_class->notice_header, 'link' => $this->get_constructed_link("notice", $notice_id, $is_bulletin));
if ($this->parameters['used_template']) {
$tpl = new notice_tpl_gen($this->parameters['used_template']);
$infos['content'] = $tpl->build_notice($notice);
} else {
$notice_class->do_isbd();
$infos['content'] = $notice_class->notice_isbd;
}
$render_datas['records'][] = $infos;
}
}
//on rappelle le tout...
return parent::render($render_datas);
}
示例4: render
public function render($records)
{
$datas = array();
global $opac_url_base;
global $opac_show_book_pics;
global $opac_book_pics_url;
global $opac_notice_affichage_class;
if (!$opac_notice_affichage_class) {
$opac_notice_affichage_class = "notice_affichage";
}
if (is_array($records['records']) && count($records['records'])) {
$query = "select notice_id,tit1,thumbnail_url,code from notices where notice_id in (" . implode(",", $records['records']) . ") order by field( notice_id, " . implode(",", $records['records']) . ")";
$result = pmb_mysql_query($query);
if ($result && pmb_mysql_num_rows($result)) {
while ($row = pmb_mysql_fetch_object($result)) {
if ($opac_show_book_pics == '1' && ($opac_book_pics_url || $row->thumbnail_url)) {
$code_chiffre = pmb_preg_replace('/-|\\.| /', '', $row->code);
$url_image = $opac_book_pics_url;
$url_image = $opac_url_base . "getimage.php?url_image=" . urlencode($url_image) . "¬icecode=!!noticecode!!&vigurl=" . urlencode($row->thumbnail_url);
if ($row->thumbnail_url) {
$url_vign = $row->thumbnail_url;
} else {
if ($code_chiffre) {
$url_vign = str_replace("!!noticecode!!", $code_chiffre, $url_image);
} else {
$url_vign = get_url_icon("vide.png", 1);
}
}
}
$notice_class = new $opac_notice_affichage_class($row->notice_id, "");
$notice_class->do_header();
if ($this->parameters['used_template']) {
$tpl = new notice_tpl_gen($this->parameters['used_template']);
$content = $tpl->build_notice($row->notice_id);
} else {
$notice_class->do_isbd();
$content = $notice_class->notice_isbd;
}
$datas[] = array('id' => $row->notice_id, 'title' => $row->tit1, 'link' => $this->get_constructed_link("notice", $row->notice_id), 'vign' => $url_vign, 'header' => $notice_class->notice_header, 'content' => $content);
}
}
}
$datas = array('title' => $records['title'], 'records' => $datas);
return parent::render($datas);
}
示例5: get_items_datas
/**
* Génération de la structure de données representant les items de type notice
* @return array
*/
protected function get_items_datas($items)
{
global $pmb_opac_url, $pmb_keyword_sep;
global $opac_show_book_pics, $opac_book_pics_url;
$records = array();
if (count($items)) {
foreach ($items as $item) {
$notice = new notice($item);
$record = array();
$record["num_notice"] = $notice->id;
$record["title"] = $notice->tit1;
$record["summary"] = $notice->n_resume;
$record["content"] = $notice->n_resume;
$record["url"] = $pmb_opac_url . "index.php?lvl=notice_display&id=" . $notice->id;
if ($notice->code || $notice->thumbnail_url) {
if ($opac_show_book_pics == '1' && ($opac_book_pics_url || $notice->thumbnail_url)) {
$code_chiffre = pmb_preg_replace('/-|\\.| /', '', $notice->code);
$url_image = $opac_book_pics_url;
$url_image = $pmb_opac_url . "getimage.php?url_image=" . urlencode($url_image) . "&noticecode=!!noticecode!!&vigurl=" . urlencode($notice->thumbnail_url);
if ($notice->thumbnail_url) {
$logo_url = $notice->thumbnail_url;
} else {
$logo_url = str_replace("!!noticecode!!", $code_chiffre, $url_image);
}
} else {
$logo_url = "";
}
}
$record["logo_url"] = $logo_url;
$record["publication_date"] = $notice->date_parution;
$record["descriptors"] = $notice->categories;
$record["tags"] = $notice->index_l ? explode($pmb_keyword_sep, $notice->index_l) : "";
$records[] = $record;
}
}
return $records;
}
示例6: window_title
function window_title($title = 'PMB')
{
$title = pmb_preg_replace('/\\"/m', "'", $title);
return "<script type='text/javascript'>document.title=\"{$title}\";window.status=\"{$title}\";</script>";
}
示例7: get_picture_url
/**
* Retourne l'URL calculée de l'image
* @return string
*/
public function get_picture_url()
{
if (!$this->picture_url && ($this->get_code() || $this->get_thumbnail_url())) {
global $opac_show_book_pics, $opac_book_pics_url;
global $opac_url_base;
if ($opac_show_book_pics == '1' && ($opac_book_pics_url || $this->get_thumbnail_url())) {
if ($this->get_thumbnail_url()) {
$this->picture_url = $this->get_thumbnail_url();
} else {
$code_chiffre = pmb_preg_replace('/-|\\.| /', '', $this->get_code());
$url_image = $opac_book_pics_url;
$url_image = $opac_url_base . "getimage.php?url_image=" . urlencode($url_image) . "¬icecode=!!noticecode!!&vigurl=" . urlencode($this->get_thumbnail_url());
$this->picture_url = str_replace("!!noticecode!!", $code_chiffre, $url_image);
}
}
}
if (!$this->picture_url) {
$this->picture_url = get_url_icon("no_image.jpg");
}
return $this->picture_url;
}
示例8: test_other_query
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]}'";
//.........这里部分代码省略.........
示例9: get_abbreviation
/**
* Getter
*
* @return string
* @access public
*/
public function get_abbreviation()
{
return pmb_preg_replace('/\\s+/', '', $this->abbreviation);
}
示例10: get_datas
public function get_datas()
{
global $opac_url_base;
global $opac_show_book_pics;
global $opac_book_pics_url;
global $dbh;
//on commence par récupérer le type et le sous-type de page...
$type_page_opac = cms_module_common_datasource_typepage_opac::get_type_page();
$subtype_page_opac = cms_module_common_datasource_typepage_opac::get_subtype_page();
if ($type_page_opac && $subtype_page_opac) {
$group_metadatas = parent::get_group_metadatas();
$datas = array();
$query = $this->get_query();
if ($query) {
$post = $_POST;
$get = $_GET;
if ($post['lvl']) {
$niveau = $post['lvl'];
} elseif ($get['lvl']) {
$niveau = $get['lvl'];
} else {
$niveau = '';
}
$result = pmb_mysql_query($query, $dbh);
while ($row = pmb_mysql_fetch_object($result)) {
$datas["id"] = $row->id;
$datas["title"] = $row->title;
$datas["resume"] = $row->resume;
if ($opac_show_book_pics == '1' && ($opac_book_pics_url || $row->logo_url)) {
$code_chiffre = pmb_preg_replace('/-|\\.| /', '', $row->code);
$url_image = $opac_book_pics_url;
$url_image = $opac_url_base . "getimage.php?url_image=" . urlencode($url_image) . "¬icecode=!!noticecode!!&vigurl=" . urlencode($row->logo_url);
if ($row->logo_url) {
$url_vign = $row->logo_url;
} else {
if ($code_chiffre) {
$url_vign = str_replace("!!noticecode!!", $code_chiffre, $url_image);
} else {
$url_vign = $opac_url_base . "images/vide.png";
}
}
}
$datas["logo_url"] = $url_vign;
$datas["link"] = $opac_url_base . "index.php?lvl=" . $niveau . "&id=" . $row->id;
$datas["type"] = $row->type;
}
}
$datas["details"] = array('type_page' => cms_module_common_datasource_typepage_opac::get_label($type_page_opac), 'subtype_page' => cms_module_common_datasource_typepage_opac::get_label($subtype_page_opac));
$datas = array_merge($datas, parent::get_datas());
foreach ($group_metadatas as $i => $metadatas) {
if (is_array($metadatas["metadatas"])) {
foreach ($metadatas["metadatas"] as $key => $value) {
try {
$group_metadatas[$i]["metadatas"][$key] = H2o::parseString($value)->render($datas);
} catch (Exception $e) {
}
}
}
}
return $group_metadatas;
}
return false;
}
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:63,代码来源:cms_module_metadatas_datasource_metadatas_page_opac.class.php
示例11: strip_empty_chars_thesaurus
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;
}
示例12: do_image
function do_image(&$entree, $depliable)
{
global $charset;
global $opac_show_book_pics;
global $opac_book_pics_url;
global $opac_book_pics_msg;
global $opac_url_base;
global $msg;
if ($this->notice->code || $this->notice->thumbnail_url) {
if ($opac_show_book_pics == '1' && ($opac_book_pics_url || $this->notice->thumbnail_url)) {
$code_chiffre = pmb_preg_replace('/-|\\.| /', '', $this->notice->code);
$url_image = $opac_book_pics_url;
$url_image = $opac_url_base . "getimage.php?url_image=" . urlencode($url_image) . "¬icecode=!!noticecode!!&vigurl=" . urlencode($this->notice->thumbnail_url);
$hauteur_vig = "";
if (strpos($this->notice->thumbnail_url, "AFFICHES_VIGNETTES") !== false) {
$hauteur_vig = "";
} else {
$hauteur_vig = " height=\"150px\" ";
}
if ($depliable) {
$image = "<img src='" . $opac_url_base . "images/vide.png' hspace='4' vspace='2' {$hauteur_vig} isbn='" . $code_chiffre . "' url_image='" . $url_image . "' border='1px solid #ccccff' vigurl=\"" . $this->notice->thumbnail_url . "\" alt='" . $msg["opac_notice_vignette_alt"] . "'/>";
} else {
if ($this->notice->thumbnail_url) {
$url_image_ok = $this->notice->thumbnail_url;
$title_image_ok = "";
} else {
$url_image_ok = str_replace("!!noticecode!!", $code_chiffre, $url_image);
$title_image_ok = htmlentities($opac_book_pics_msg, ENT_QUOTES, $charset);
}
if (!trim($title_image_ok)) {
$title_image_ok = htmlentities($this->notice->tit1, ENT_QUOTES, $charset);
}
$image = "<img src='" . $url_image_ok . "' title=\"" . $title_image_ok . "\" {$hauteur_vig} align='right' hspace='4' vspace='2' alt='" . $msg["opac_notice_vignette_alt"] . "'/>";
}
} else {
$image = "";
}
if ($image) {
$entree = "<table width='100%'><tr><td>{$image}</td></tr><tr><td>{$entree}</td></tr></table>";
} else {
$entree = "<table width='100%'><tr><td>{$entree}</td></tr></table>";
}
} else {
$entree = "<table width='100%'><tr><td>{$entree}</td></tr></table>";
}
}
示例13: print_resume
//.........这里部分代码省略.........
if ($this->ed1 != "") {
$print = str_replace("!!ed1!!", "<b>{$msg['ed1_start']}</b>" . $this->ed1 . "<br />", $print);
} else {
$print = str_replace("!!ed1!!", "", $print);
}
if ($this->ed2 != "") {
$print = str_replace("!!ed2!!", "<b>{$msg['ed2_start']}</b>" . $this->ed2 . "<br />", $print);
} else {
$print = str_replace("!!ed2!!", "", $print);
}
if ($this->coll != "") {
$print = str_replace("!!coll!!", "<b>{$msg['coll_start']}</b>" . $this->coll . "<br />", $print);
} else {
$print = str_replace("!!coll!!", "", $print);
}
if ($this->subcoll != "") {
$print = str_replace("!!subcoll!!", "<b>{$msg['subcoll_start']}</b>" . $this->subcoll . "<br />", $print);
} else {
$print = str_replace("!!subcoll!!", "", $print);
}
if ($this->year != "") {
$print = str_replace("!!year!!", "<b>{$msg['year_start']}</b>" . $this->year . "<br />", $print);
} else {
$print = str_replace("!!year!!", "", $print);
}
if ($this->nocoll != "") {
$print = str_replace("!!nocoll!!", "<b>{$msg['nocoll_start']}</b>" . $this->nocoll . "<br />", $print);
} else {
$print = str_replace("!!nocoll!!", "", $print);
}
if ($this->code != "") {
// Si c'est un livre, c'est magique alors on affiche l'image tirée de chez amazon europe.
if ($this->typdoc == 'a' && $opac_show_book_pics == '1') {
$code_chiffre = pmb_preg_replace('/-|\\.| /', '', $this->code);
//if (@fopen("http://images-eu.amazon.com/images/P/".$code_chiffre.".08.MZZZZZZZ.jpg","r"))
if (isISBN($this->code)) {
$print = str_replace("!!image_petit!!", "<img src='http://images-eu.amazon.com/images/P/" . $code_chiffre . ".08.MZZZZZZZ.jpg' align='right' hspace='4' vspace='2'>", $print);
} else {
$print = str_replace("!!image_petit!!", "", $print);
}
} else {
$print = str_replace("!!image_petit!!", "", $print);
}
$print = str_replace("!!code!!", "<b>{$msg['code_start']}</b>" . $this->code . "<br />", $print);
} else {
$print = str_replace("!!image_petit!!", "", $print);
$print = str_replace("!!code!!", "", $print);
}
if ($this->npages != "") {
$print = str_replace("!!npages!!", "<b>{$msg['npages_start']}</b>" . $this->npages . "<br />", $print);
} else {
$print = str_replace("!!npages!!", "", $print);
}
if ($this->ill != "") {
$print = str_replace("!!ill!!", "<b>{$msg['ill_start']}</b>" . $this->ill . "<br />", $print);
} else {
$print = str_replace("!!ill!!", "", $print);
}
if ($this->size != "") {
$print = str_replace("!!size!!", "<b>{$msg['size_start']}</b>" . $this->size . "<br />", $print);
} else {
$print = str_replace("!!size!!", "", $print);
}
if ($this->accomp != "") {
$print = str_replace("!!accomp!!", "<b>{$msg['accomp_start']}</b>" . $this->accomp . "<br />", $print);
} else {
示例14: getData
function getData()
{
global $dbh;
global $msg;
if ($this->id_expl == 0 && $this->cb_expl == "") {
// aucun identifiant. on retourne un tableau vide
$this->id_empr = 0;
$this->id_expl = 0;
$this->pret_date = "";
$this->pret_retour = "";
$this->cb_expl = "";
$this->type_doc = "";
$this->statut_doc = "";
$this->titre_auteur = "";
$this->owner = "";
$this->date_pret_display = "";
$this->date_retour_display = "";
$this->etat = 0;
$this->display = $msg[4052];
} else {
$sql_dates = " date_format(pret_date, '" . $msg["format_date"] . "') as aff_pret_date, ";
$sql_dates .= " date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour, ";
$sql_dates .= " IF(pret_retour>sysdate(),0,1) as retard ";
if ($this->id_expl != 0) {
$requete = "SELECT pret_idempr, pret_idexpl, pret_date, pret_retour, expl_cb, expl_typdoc, expl_statut, tit1, expl_owner, {$sql_dates} FROM pret, exemplaires, notices WHERE pret_idexpl='" . $this->id_expl . "' and pret_idexpl=expl_id and expl_notice=notice_id LIMIT 1 ";
} else {
$requete = "SELECT pret_idempr, pret_idexpl, pret_date, pret_retour, expl_cb, expl_typdoc, tit1, expl_owner, {$sql_dates} FROM pret, exemplaires, notices, authors WHERE expl_cb='" . $this->cb_expl . "' and pret_idexpl=expl_id and expl_notice=notice_id LIMIT 1 ";
}
$result = @pmb_mysql_query($requete, $dbh);
if (pmb_mysql_num_rows($result)) {
$temp = pmb_mysql_fetch_object($result);
pmb_mysql_free_result($result);
$this->id_empr = $temp->pret_idempr;
$this->id_expl = $temp->pret_idexpl;
$this->pret_date = $temp->pret_date;
$this->pret_retour = $temp->pret_retour;
$this->cb_expl = $temp->expl_cb;
$requete = "select tdoc_libelle from docs_type where idtyp_doc='" . $temp->expl_typdoc . "' ";
$result = @pmb_mysql_query($requete, $dbh);
$typdoc = pmb_mysql_fetch_object($result);
pmb_mysql_free_result($result);
$this->type_doc = $typdoc->tdoc_libelle;
$requete = "select statut_libelle from docs_statut where idstatut='" . $temp->expl_statut . "' ";
$result = @pmb_mysql_query($requete, $dbh);
$statdoc = pmb_mysql_fetch_object($result);
pmb_mysql_free_result($result);
$this->statut_doc = $statdoc->statut_libelle;
$this->titre_auteur = $temp->tit1;
$requete = "select lender_libelle from lenders where idlender='" . $temp->expl_owner . "' ";
$result = @pmb_mysql_query($requete, $dbh);
$lender = pmb_mysql_fetch_object($result);
pmb_mysql_free_result($result);
$this->owner = $lender->lender_libelle;
$this->date_pret_display = $temp->aff_pret_date;
$this->date_retour_display = $temp->aff_pret_retour;
$this->etat = 1;
$this->display = "Prêt existant";
} else {
// pas de prêt avec cette clé : on va aller chercher le expl_cb avec l'id ou l'inverse
$long_maxi_cb_expl = pmb_mysql_field_len(pmb_mysql_query("SELECT expl_cb FROM exemplaires limit 1"), 0);
$this->cb_expl = rtrim(substr(pmb_preg_replace('/\\[|\\]/', '', rtrim(ltrim($this->cb_expl))), 0, $long_maxi_cb_expl));
if ($this->id_expl == 0) {
/* ici la recherche de l'id_expl */
$query = "SELECT expl_id, expl_cb FROM exemplaires WHERE expl_cb='{$key_cb_expl}' LIMIT 1 ";
} else {
/* ici la recherche du cb à partir de l'id */
$query = "SELECT expl_id, expl_cb FROM exemplaires WHERE expl_id='" . $this->id_expl . "' LIMIT 1 ";
}
$result = @pmb_mysql_query($query, $dbh) or die("can't SELECT exemplaires " . $query);
if (pmb_mysql_num_rows($result) == 0) {
/* on n'a trouvé aucun exemplaire */
$this->id_empr = 0;
$this->id_expl = 0;
$this->pret_date = "";
$this->pret_retour = "";
$this->cb_expl = "";
$this->type_doc = "";
$this->statut_doc = "";
$this->titre_auteur = "";
$this->owner = "";
$this->date_pret_display = "";
$this->date_retour_display = "";
$this->etat = 3;
$this->display = "Exemplaire introuvable";
} else {
$expl = pmb_mysql_fetch_object($result);
$this->id_expl = $expl->expl_id;
$this->cb_expl = $expl->expl_cb;
$this->pret_retour = "";
$this->type_doc = "";
$this->statut_doc = "";
$this->titre_auteur = "";
$this->owner = "";
$this->date_pret_display = "";
$this->date_retour_display = "";
$this->etat = 2;
$this->display = "Prêt possible, inexistant avec cette clé";
}
}
}
//.........这里部分代码省略.........
示例15: open_restore_stream
function open_restore_stream()
{
global $backup_dir;
$dir = pmb_preg_replace('/\\/\\s$|\\/$/', '', $backup_dir);
if (!$dir) {
$dir = '.';
}
$in_file = $dir . '/' . $this->filename . $this->extension;
$this->fptr = @fopen($in_file, 'rb');
if ($this->fptr) {
$this->buffer = fread($this->fptr, filesize($in_file));
fclose($this->fptr);
return TRUE;
} else {
$this->buffer = '';
return FALSE;
}
}