Пример #1
0
 function getCurrentDoc()
 {
     $this->currentDoc = "";
     //on peut récup déjà un certain nombre d'infos...
     $this->currentDoc["id"] = $this->listeDocs[$this->current]->explnum_id;
     $this->params["explnum_id"] = $this->listeDocs[$this->current]->explnum_id;
     $this->currentDoc["titre"] = $this->listeDocs[$this->current]->explnum_nom;
     $req_expl = "select explnum_id from explnum ";
     $req_expl .= "where explnum_id = " . $this->listeDocs[$this->current]->explnum_id . " and ";
     $terms = explode(" ", $this->params["user_query"]);
     if (sizeof($terms > 0)) {
         $req_expl .= "(";
     }
     $search = '';
     for ($i = 0; $i < sizeof($terms); $i++) {
         if ($search != "") {
             $search .= " or ";
         }
         $search .= "explnum_index_sew LIKE '%" . $terms[$i] . "%'";
     }
     if ($search != "") {
         $req_expl .= $search;
     }
     if (sizeof($terms > 0)) {
         $req_expl .= ")";
     }
     $searchInExplnum = pmb_mysql_query($req_expl);
     if (pmb_mysql_num_rows($searchInExplnum) == 0) {
         $this->currentDoc["searchterms"] = "";
     } else {
         $this->currentDoc["searchterms"] = $this->params["user_query"];
     }
     //on récupère le chemin
     if ($this->listeDocs[$this->current]->explnum_url != "") {
         //c'est une url
         $this->currentDoc["path"] = $this->listeDocs[$this->current]->explnum_url;
     } elseif ($this->listeDocs[$this->current]->explnum_repertoire != 0) {
         //il est en répertoire d'upload
         $rep = new upload_folder($this->listeDocs[$this->current]->explnum_repertoire);
         $this->currentDoc["path"] = $rep->repertoire_path . "/" . $this->listeDocs[$this->current]->explnum_nomfichier;
     } else {
         //il est en base
         //faudra revoir ce truc
         $this->currentDoc["path"] = "";
     }
     //dans le cadre d'une URL, on doit récup le mimetype...
     if ($this->listeDocs[$this->current]->explnum_url) {
         if (file_exists($this->visionneuse_path . "/conf/mime_magic.txt")) {
             $fp = fopen($this->visionneuse_path . "/conf/mime_magic.txt", "r");
             $mimetype_file = fread($fp, filesize($this->visionneuse_path . "/conf/mime_magic.txt"));
             fclose($fp);
             if ($mimetype_file == "") {
                 $mimetype_file = get_cfg_var("mime_magic.magicfile");
             }
         } else {
             $mimetype_file = get_cfg_var("mime_magic.magicfile");
         }
         $finfo = finfo_open(FILEINFO_MIME, $mimetype_file);
         $mime_magic = finfo_file($finfo, $this->listeDocs[$this->current]->explnum_url);
         $this->currentDoc["mimetype"] = strpos($mime_magic, ";") > 0 ? substr($mime_magic, 0, strpos($mime_magic, ";")) : $mime_magic;
     } else {
         //sinon il a déjà été détecté et est présent en base...
         $this->currentDoc["mimetype"] = $this->listeDocs[$this->current]->explnum_mimetype;
     }
     //pour la conversion on y ajoute l'extension
     $ext = '';
     $ext = $this->listeDocs[$this->current]->explnum_extfichier;
     if (!$ext && $this->listeDocs[$this->current]->explnum_nomfichier) {
         $ext = substr($this->listeDocs[$this->current]->explnum_nomfichier, strrpos($this->listeDocs[$this->current]->explnum_nomfichier, '.') * 1 + 1);
     }
     if (!$ext && $this->listeDocs[$this->current]->explnum_url) {
         $ext = substr($this->listeDocs[$this->current]->explnum_url, strrpos($this->listeDocs[$this->current]->explnum_url, '.') * 1 + 1);
     }
     $this->currentDoc['extension'] = $ext;
     //on récup la notice associée...
     if ($this->listeDocs[$this->current]->explnum_notice) {
         $this->currentDoc["desc"] = aff_notice($this->listeDocs[$this->current]->explnum_notice, 1, 1, 0, "", 0, 1);
     } else {
         $this->currentDoc["desc"] = bulletin_affichage($this->listeDocs[$this->current]->explnum_bulletin, "visionneuse");
     }
     preg_match_all("/(<a href=[\"'][^#][^>]*>)(.*?)<\\/a>/", $this->currentDoc["desc"], $lop);
     for ($i = 0; $i < sizeof($lop[0]); $i++) {
         $plop = explode($lop[0][$i], $this->currentDoc["desc"]);
         $this->currentDoc["desc"] = implode($lop[2][$i], $plop);
     }
     return $this->currentDoc;
 }
Пример #2
0
 public function show_issue_display($opened_expl = 0)
 {
     global $opac_notices_depliable;
     global $msg, $charset;
     $query = "select expl_bulletin from exemplaires where expl_id =" . $this->num_expl;
     $result = mysql_query($query);
     if (mysql_num_rows($result)) {
         $id_issue = mysql_result($result, 0, 0);
     }
     $serialcirc = new serialcirc($this->num_serialcirc);
     $content = bulletin_affichage($id_issue);
     $query = "select date_add('" . $this->serialcirc_expl['start_date_sql'] . "', interval " . $this->serialcirc['duration_before_send'] . " day)";
     $res = mysql_query($query);
     if (mysql_num_rows($res)) {
         $end_subscription = mysql_result($res, 0, 0);
         $query = "select datediff('" . $end_subscription . "',now())";
         $res = mysql_query($query);
         if (mysql_num_rows($res)) {
             $test = mysql_result($res, 0, 0);
         } else {
             $test = -1;
         }
         if ($test >= 0 && !serialcirc_empr_circ::is_subscribe($_SESSION['id_empr_session'], $this->num_expl)) {
             $form = "\n\t\t\t\t<input type='submit' class='bouton' value='" . htmlentities(sprintf($msg['serialcirc_subscribe_list'], formatdate($end_subscription)), ENT_QUOTES, $charset) . "' />";
         } else {
             $form = "\n\t\t\t\t<input type='submit' class='bouton' disabled='disabled' value='" . htmlentities(sprintf($msg['serialcirc_subscribe_list'], formatdate($end_subscription)), ENT_QUOTES, $charset) . "' />";
         }
     }
     $content .= "\n\t\t<div class='row'>&nbsp;</div>\n\t\t<div class='row'>\n\t\t\t<form action='empr.php?tab=serialcirc&lvl=list_abo' method='post' name='actions_form_" . $this->num_serialcirc . "_" . $this->num_expl . "' style='display:inline;'>\n\t\t\t\t<input type='hidden' name='id_serialcirc' value='" . htmlentities($this->num_serialcirc, ENT_QUOTES, $charset) . "'/>\n\t\t\t\t<input type='hidden' name='expl_id' value='" . htmlentities($this->num_expl, ENT_QUOTES, $charset) . "'/>\n\t\t\t\t<input type='hidden' name='actions_form_submit' value ='1' />\n\t\t\t\t<input type='hidden' name='subscription' value='1' />\n\t\t\t\t{$form}\n\t\t\t</form>";
     if ($serialcirc->allow_copy) {
         $content .= "&nbsp;\n\t\t\t<form action='empr.php?tab=serialcirc&lvl=list_virtual_abo&action=ask_copy' method='post' style='display:inline;'>\n\t\t\t\t<input type='hidden' name='expl_id' value='" . htmlentities($this->num_expl, ENT_QUOTES, $charset) . "'/>\n\t\t\t\t<input type='submit' class='bouton' value='" . htmlentities($msg['serialcirc_ask_copy'], ENT_QUOTES, $charset) . "' />\n\t\t\t</form>\n\t\t";
     }
     $content .= "\t\t\n\t\t</div>\n\t\t<div class='row'>&nbsp;</div>\n\t\t";
     if ($opac_notices_depliable) {
         if ($opened_expl == $this->num_expl) {
             $open = 1;
         } else {
             $open = 0;
         }
         $display = gen_plus("serialcirc_issue" . $id_issue, bulletin_header($id_issue), $content, $open);
     } else {
         $display = $content;
     }
     return $display;
 }