File manager - Edit - /home/jardides/Archives/dirsys/modules/pdf/f_pdf_index.php
Back
<?php header('Content-Type: text/html; charset=utf-8'); include 'mysql.php'; if(isset($_REQUEST["FONCTION"])){ if(isset($_REQUEST["ARGS"])) $args=utf8_decode($_REQUEST["ARGS"]); switch($_REQUEST["FONCTION"]){ case "folder": folder($args); break; case "doctype": doctype($args); break; case "identification": identification($args); break; case "index": index($args); break; case "get_documentIndex": get_documentIndex($args); break; //default: echo "Mauvaise fonction ! " . $_REQUEST['FONCTION']; break; } return; } function get_mySql(){ /* Ouverture de la connexion mySql */ $mysql = new mySql(); $mysql->getParam(); $mysql->openConnexion(); return $mysql; } /*********** index **************/ function index($args){ include 'pdf_cfg.php'; $mysql = get_mySql(); $arg = split("\|",$args); echo "<table class='index'><tr><td class='index'>"; echo "<b><u>Indexation</u></b><br>"; if($arg[0] == "add"){ if( $mysql->execQuery("insert into `index` (doctype_id, string_id, nom, no_page, relatif_string, relatif_id, relatif_cond) values ('$arg[1]','$arg[2]','$arg[3]','$arg[4]','$arg[5]','$arg[6]','$arg[7]')") == 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } } if($arg[0] == "del"){ if( $mysql->execQuery("delete from `index` where id='$arg[1]'") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } } if($arg[0] == "delIndex"){ if( $mysql->execQuery("delete from `index` where id='$arg[1]'") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } } /* Liste */ if($mysql->execQuery("select DISTINCT doctype_id from `index`") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } if($mysql->nbRow > 0){ foreach($mysql->row as $row){ $doctype = get_doctype($row['doctype_id'],"libelle"); $doctypeId = $row['doctype_id']; echo "<br><a href='#' class='indexLink' onClick='indexDetail(\"".$doctypeId."\");'><img src='pdf/img/index.png' class='indexImg'> ".$doctype['libelle']."</a>"; } } /* Detail */ echo "</td><td width='100px'> </td><td class='index'>"; if($arg[0] == "get"){ if($mysql->execQuery("select * from `index` where doctype_id = '".$arg[1]."'") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } echo "<table class='indexDetail'><tr class='indexDetail'><td></td><td>Nom</td><td>N° Page</td><td>N° Chaine</td><td>Relatif à</td><td>Relatif index</td></tr>"; $line = 0; if($mysql->nbRow > 0){ foreach($mysql->row as $row){ echo "<tr><td><img src='pdf/img/delete.gif' width='10px' onClick='index_delIndex(\"".$row['id']."\",\"$doctypeId\");'></td><td>".$row['nom']."</td><td>".$row['no_page']."</td><td>".$row['string_id']."</td><td>".$row['relatif_cond'].'|'.$row['relatif_string']."</td><td>".$row['relatif_id']."</td></tr>"; if($line == 1) $line = 0; $line++; } }else{ echo "<tr class='folderDocument_line_$line'><td colspan='3'><i><center>Aucun document</i></td></tr>"; } echo "</table>"; } echo "</td></tr></table>"; echo "<hr>"; echo "<b><u>Ajouter un index</b></u><div id='index_add_info' class='error'></div>"; echo "<table class='index_add'><tr><td class='index_title'>Nom</td><td class='index_title'>Type</td><td class='index_title'>N° Page</td><td class='index_title'>N° Chaine</td><td>Relatif à | <input type='checkbox' id='egal' onClick='checkCond(this.id);' checked='true'>Egal | <input type='checkbox' id='start' onClick='checkCond(this.id);'>Commence par</td><td>Relatif index</td></tr>"; $doctype = get_doctype(0,"all_libelle"); $selectDoctype = null; $selectDoctype = "<option></option>"; foreach($doctype as $docType) $selectDoctype .= "<option value='".$docType['id']."'>".$docType['libelle']."</option>"; echo "<tr><td><input type='text' id='nom'></td><td><select id='docType'>$selectDoctype</select></td><td><input type='text' size='3' id='noPage' value='1'></td><td><input type='text' size='3' id='noChaine'></td><td><input type='text' id='relatif'></td><td><input type='text' id='relatif_id' size='3'></td><td><a href='#' onClick='index_add();'>Ajouter</td></tr></table>"; echo "<hr>"; echo "<b><u>Supprimer un index</b></u><div id='index_add_info' class='error'></div>"; echo "<table class='index_del'><tr><td><u>Type</td><td><u>Nom</td></tr>"; if($mysql->execQuery("select * from `index`") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } if($mysql->nbRow > 0){ foreach($mysql->row as $row){ $doctype = get_doctype($row['doctype_id'],"libelle"); echo "<tr><td>".$doctype['libelle']."</td><td>".$row['nom']."</td><td><a href='#' onClick='index_del(\"".$row['id']."\");'>Supprimer</td></tr>"; } } echo "</table>"; /* Charger doc */ echo "<hr><b><u>Charger un document</b></u>"; if($arg[0] == "upload"){ echo "<br><b><u>Fichier recu</b></u>"; echo "<br>Fichier : $arg[1]<br>Tmp : $arg[2]<br>Type : $arg[3]<br>Taille : $arg[4]<br>Error : $arg[5]"; $fileTmp = 'upload/fichier.' . str_replace('application/','',$arg[3]); }else $fileTmp = ""; echo "<table class='index'>"; echo "<tr><td colspan='2'><i>Charger ou sélectionner un document pour analyse et visualisation</i></td></tr>"; echo "<tr><td><form method='post' enctype='multipart/form-data' action='$PHP_SELF'>Fichier a uploader</td><td><input type='file' id='file' name='file'> <input type='submit' value='Envoyer'></form></td></tr>"; $select = "<option value='$fileTmp'>$fileTmp</option>" . getFile("select"); if($select == -1) echo "Erreur getFile()"; echo "<tr><td>Fichier disponible</td><td><input type='hidden' value='$pdf[dirData]' id='dirData'><select id='file_s'>".$select."</select> <a href='#' onClick='loadFile(\"$pdf[dir]\");'>Charger</a></td></tr>"; echo "</tr></table>"; echo "<div id='infoFile'></div>"; } /*********** indentification ****/ function identification($args){ include 'pdf_cfg.php'; $mysql = get_mySql(); $arg = split("\|",$args); echo "<table class='identification'><tr><td class='identification'>"; echo "<b><u>Identification</u></b><br>"; if($arg[0] == "add"){ if( $mysql->execQuery("insert into identification (nom, doctype_id, folder_id, string_id, string_value, string_cond) values ('$arg[1]','$arg[2]','$arg[3]','$arg[4]','$arg[5]','$arg[6]')") == 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } } if($arg[0] == "del"){ if( $mysql->execQuery("delete from identification where id='$arg[1]'") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } } /* Liste */ if($mysql->execQuery("select * from identification") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } if($mysql->nbRow > 0){ foreach($mysql->row as $row) echo "<br><a href='#' class='identificationLink' onClick='identificationDetail(\"".$row['id']."\");'><img src='pdf/img/identification.gif' class='identificationImg'> ".$row['nom']."</a>"; } /* Detail */ echo "</td><td width='100px'> </td><td class='identification'>"; if($arg[0] == "get"){ if($mysql->execQuery("select * from identification where id = '".$arg[1]."'") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } echo "<table class='identificationDetail'><tr class='identificationDetail'><td>Type</td><td>Classeur</td><td>N° chaine</td><td>Chaine</td></tr>"; $line = 0; if($mysql->nbRow > 0){ foreach($mysql->row as $row){ $doctype = get_doctype($row['doctype_id'],"libelle"); $folder = get_folder($row['folder_id']); echo "<tr><td>".$doctype['libelle']."</td><td>".$folder['libelle']."</td><td>".$row['string_id']."</td><td>".$row['string_cond']."|".$row['string_value']."</td></tr>"; if($line == 1) $line = 0; $line++; } }else{ echo "<tr class='folderDocument_line_$line'><td colspan='3'><i><center>Aucun document</i></td></tr>"; } echo "</table>"; } echo "</td></tr></table>"; echo "<hr>"; echo "<b><u>Ajouter une identification</b></u><div id='identification_add_info' class='error'></div>"; echo "<table class='identification_add'><tr><td class='identification_title'>Nom</td><td class='identification_title'>Type</td><td class='identification_title'>Classeur</td><td class='identification_title'>N° Chaine</td><td class='identification_title'>Chaine | <input type='checkbox' id='egal' onClick='checkCond(this.id);' checked='true'>Egal | <input type='checkbox' id='start' onClick='checkCond(this.id);'>Commence par</td></tr>"; $doctype = get_doctype(0,"all_libelle"); $selectDoctype = null; $selectDoctype = "<option></option>"; foreach($doctype as $docType) $selectDoctype .= "<option value='".$docType['id']."'>".$docType['libelle']."</option>"; $folder = get_folder("all"); $selectFolder = null; $selectFolder = "<option></option>"; foreach($folder as $fold) $selectFolder .= "<option value='".$fold['id']."'>".$fold['libelle']."</option>"; echo "<tr><td><input type='text' id='identification_nom'></td><td><select id='docType'>$selectDoctype</select></td><td><select id='folder'>$selectFolder</select></td><td><input type='text' size='3' id='noChaine'></td><td><input type='text' id='chaine'></td><td><a href='#' onClick='identification_add();'>Ajouter</td></tr></table>"; echo "<hr>"; echo "<b><u>Supprimer une identification</b></u><div id='identification_add_info' class='error'></div>"; echo "<table class='identification_del'>"; if($mysql->execQuery("select * from identification") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } if($mysql->nbRow > 0){ foreach($mysql->row as $row) echo "<tr><td>".$row['nom']."</td><td><a href='#' onClick='identification_del(\"".$row['id']."\");'>Supprimer</td></tr>"; } echo "</table>"; /* Charger doc */ echo "<hr><b><u>Charger un document</b></u>"; if($arg[0] == "upload"){ echo "<br><b><u>Fichier recu</b></u>"; echo "<br>Fichier : $arg[1]<br>Tmp : $arg[2]<br>Type : $arg[3]<br>Taille : $arg[4]<br>Error : $arg[5]"; $fileTmp = 'upload/fichier.' . str_replace('application/','',$arg[3]); }else $fileTmp = ""; echo "<table class='identification'>"; echo "<tr><td colspan='2'><i>Charger ou sélectionner un document pour analyse et visualisation</i></td></tr>"; echo "<tr><td><form method='post' enctype='multipart/form-data' action='$PHP_SELF'>Fichier a uploader</td><td><input type='file' id='file' name='file'> <input type='submit' value='Envoyer'></form></td></tr>"; $select = "<option value='$fileTmp'>$fileTmp</option>" . getFile("select"); if($select == -1) echo "Erreur getFile()"; echo "<tr><td>Fichier disponible</td><td><input type='hidden' value='$pdf[dirData]' id='dirData'><select id='file_s'>".$select."</select> <a href='#' onClick='loadFile(\"$pdf[dir]\");'>Charger</a></td></tr>"; echo "</tr></table>"; echo "<div id='infoFile'></div>"; } /*********** docType ************/ function doctype($args){ $mysql = get_mySql(); $arg = split("\|",$args); echo "<table class='doctype'><tr><td class='doctype'>"; echo "<b><u>Type de document</u></b><br>"; if($arg[0] == "add"){ if( $mysql->execQuery("insert into doctype (nom, libelle, nommage) values ('$arg[1]','$arg[2]','$arg[3]')") == 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } } if($arg[0] == "del"){ if( $mysql->execQuery("delete from identification where doctype_id='$arg[1]'") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } if( $mysql->execQuery("delete from `index` where doctype_id='$arg[1]'") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } if( $mysql->execQuery("delete from document where doctype_id='$arg[1]'") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } if( $mysql->execQuery("delete from doctype where id='$arg[1]'") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } } if($mysql->execQuery("select * from doctype") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } if($mysql->nbRow > 0){ foreach($mysql->row as $row) echo "<br><a href='#' class='doctypeLink' onClick='doctypeDetail(\"".$row['id']."\");'><img src='pdf/img/doctype.gif' class='doctypeImg'> ".$row['libelle']."</a>"; } /* Detail */ echo "</td><td width='100px'> </td><td class='doctype'>"; if($arg[0] == "get"){ if($mysql->execQuery("select * from doctype where id = '".$arg[1]."'") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } echo "<table class='doctypeDetail'><tr class='doctypeDetail'><td>Nom</td><td>Libéllé</td><td>Nommage</td></tr>"; if($mysql->nbRow > 0){ foreach($mysql->row as $row) echo "<tr><td>".$row['nom']."</td><td>".$row['libelle']."</td><td>".$row['nommage']."</td></tr>"; } echo "</table>"; } echo "</td></tr></table>"; echo "<hr>"; echo "<b><u>Ajouter un type de document</b></u><div id='doctype_add_info' class='error'></div>"; echo "<table class='doctype_add'><tr><td class='doctype_title'>Nom</td><td class='doctype_title'>Libellé</td><td class='doctype_title'>Nommage</td></tr>"; $aide = "<br><u>Définie le nommage des fichiers relatif à ce type de document.</u><br><br>ex : Facture du [Date] où [Date] représente la valeur de l’index Date."; echo "<tr><td><input type='text' id='doctype_nom'></td><td><input type='text' id='doctype_libelle'></td><td><input type='text' id='doctype_nommage' onMouseOver='montre(\"$aide\");' onMouseOut='cache();'></td><td><a href='#' onClick='doctype_add();'>Ajouter</td></tr></table>"; echo "<hr>"; echo "<b><u>Supprimer un type de document</b></u><div id='doctype_add_info' class='error'></div>"; echo "<table class='doctype_del'>"; if($mysql->execQuery("select * from doctype") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } if($mysql->nbRow > 0){ foreach($mysql->row as $row) echo "<tr><td>".$row['libelle']."</td><td><a href='#' onClick='doctype_del(\"".$row['id']."\");'>Supprimer</td></tr>"; echo "<tr><td colspan='2'><i>Attention : toutes les relations assignées à ce type seront supprimées</td></tr></table>"; } /* echo "</td><td class='doctype'>"; if($arg[0] == "get"){ if($mysql->execQuery("select * from document where doctype_id = '".$arg[1]."'") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } echo "<table class='folderDocument'><tr class='folderDocument'><td>Nom</td><td>Type</td><td>Recu le</td></tr>"; $line = 0; if($mysql->nbRow > 0){ foreach($mysql->row as $row){ echo "<tr class='folderDocument_line_$line'><td><a href='#' onClick='viewDocument(\"".$row['path']."\");' class='documentLink'>".$row['nom']."</a></td><td>".$row['doctype_id']."</td><td>".$row['date_reception']."</td></tr>"; if($line == 1) $line = 0; $line++; } }else{ echo "<tr class='folderDocument_line_$line'><td colspan='3'><i><center>Aucun document</i></td></tr>"; } echo "</tr></table>"; } */ echo "</td></tr></table>"; echo "<div id='aide' class='aide'></div>"; } /*************** Folder **********************/ function folder($args){ $mysql = get_mySql(); $arg = split("\|",$args); echo "<table class='folder'><tr><td class='folder'>"; echo "<b><u>Classeurs</u></b><br>"; if($arg[0] == "add"){ if( $mysql->execQuery("insert into folder (nom, libelle) values ('$arg[1]','$arg[2]')") == 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } } if($arg[0] == "del"){ if( $mysql->execQuery("delete from document where folder_id='$arg[1]'") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } if( $mysql->execQuery("delete from folder where id='$arg[1]'") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } } /* Liste */ if($mysql->execQuery("select * from folder") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } if($mysql->nbRow > 0){ foreach($mysql->row as $row) echo "<br><a href='#' class='folderLink' onClick='folderDocument(\"".$row['id']."\");'><img src='pdf/img/folder.png' class='folderImg'> ".$row['libelle']."</a>"; } /* Detail */ echo "</td><td width='100px'> </td><td class='folder'>"; if($arg[0] == "get"){ if($mysql->execQuery("select * from document where folder_id = '".$arg[1]."'") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } echo "<table class='folderDocument'><tr class='folderDocument'><td>Nom</td><td>Type</td><td>Recu le</td></tr>"; $line = 0; if($mysql->nbRow > 0){ foreach($mysql->row as $row){ $doctype = get_doctype($row['doctype_id'],"libelle"); echo "<tr class='folderDocument_line_$line'><td><a href='#' onClick='viewDocument(\"".$row['id']."\",\"".$row['path']."\");' class='documentLink'>".$row['nom']."</a></td><td>".$doctype['libelle']."</td><td>".$row['date_reception']."</td></tr>"; if($line == 1) $line = 0; $line++; } }else{ echo "<tr class='folderDocument_line_$line'><td colspan='3'><i><center>Aucun document</i></td></tr>"; } echo "</tr></table>"; } echo "</td><td class='folder'><div id='documentIndex'></div></td></tr></table>"; echo "<hr>"; echo "<b><u>Ajouter un classeur</b></u><div id='folder_add_info' class='error'></div>"; echo "<table class='folder_add'><tr><td class='folder_title'>Nom</td><td class='folder_title'>Libellé</td></tr>"; echo "<tr><td><input type='text' id='folder_nom'></td><td><input type='text' id='folder_libelle'></td><td><a href='#' onClick='folder_add();'>Ajouter</td></tr></table>"; echo "<hr>"; echo "<b><u>Supprimer un classeur</b></u><div id='folder_add_info' class='error'></div>"; echo "<table class='folder_del'>"; if($mysql->execQuery("select * from folder") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } if($mysql->nbRow > 0){ foreach($mysql->row as $row) echo "<tr><td>".$row['libelle']."</td><td><a href='#' onClick='folder_del(\"".$row['id']."\");'>Supprimer</td></tr>"; echo "<tr><td colspan='2'><i>Attention : tous les documents contenu dans ce classeurs seront supprimés</td></tr></table>"; } } function get_documentIndex($document_id){ $mSql = get_mySql(); if($mSql->execQuery("select * from `document_index` where document_id='$document_id'") != 0){ echo "<label class='error'>".$mysql->error.":".$mysql->error_message."</label>"; return; } if($mSql->nbRow > 0){ echo "<table class='folderDocument'><tr class='folderDocument'><td>Nom</td><td>Valeur</td></tr>"; foreach($mSql->row as $row){ $index = get_index($row['index_id']); echo "<tr><td>".$index['nom']."</td><td>".$row['index_value']."</td></tr>"; } echo "<tr></table>"; } } function get_doctype($id,$type) { $mSql = get_mySql(); if($type == "libelle"){ if($mSql->execQuery("select libelle from doctype where id = '".$id."'") != 0){ echo "<label class='error'>".$mSql->error.":".$mSql->error_message."</label>"; return; } $row = $mSql->row[0]; } if($type == "all_libelle"){ if($mSql->execQuery("select id,libelle from doctype") != 0){ echo "<label class='error'>".$mSql->error.":".$mSql->error_message."</label>"; return; } $row = null; foreach($mSql->row as $r) $row[] = $r; } return $row; } function get_folder($id){ $mSql = get_mySql(); if($id != "all") $condition = "where id='$id'"; if($mSql->execQuery("select id,libelle from folder $condition") != 0){ echo "<label class='error'>".$mSql->error.":".$mSql->error_message."</label>"; return; } $row = null; if($id != "all"){ $row = $mSql->row[0]; }else{ foreach($mSql->row as $r) $row[] = $r; } return $row; } function getFile($type){ include 'pdf_cfg.php'; if( ! isset($pdf['dirData'])) return -1; if ($dir = @opendir($pdf['dirData']."/upload")) { while (($file = readdir($dir)) !== false) { if(is_file($pdf['dirData'] . "/upload/" . $file)) $filelist[] = $file; } closedir($dir); } else return "<option selected>Open ".$pdf['dirData']." impossible</option>"; if(sizeof($filelist) != '0'){ sort($filelist); if($type == "select"){ $option = null; foreach($filelist as $file) $option .= "<option value='upload/$file'>$file</option>"; return $option; } return $filelist; }else return "<option selected>Pas de fichier</option>"; } function get_index($index_id){ $mSql = get_mySql(); if($mSql->execQuery("select nom from `index` where id='$index_id'") != 0){ echo "<label class='error'>".$mSql->error.":".$mSql->error_message."</label>"; return; } $row = $mSql->row[0]; return $row; }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings