$relativepathdetail = $objectref . '/' . $objectref . '-detail.pdf'; // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png") $fileimage = $file . '_preview.png'; // If PDF has 1 page $fileimagebis = $file . '_preview-0.pdf.png'; // If PDF has more than one page $relativepathimage = $relativepath . '_preview.png'; $var = true; // Si fichier PDF existe if (file_exists($file)) { $encfile = urlencode($file); print '<table class="nobordernopadding" width="100%">'; print '<tr class="liste_titre"><td colspan="4">' . $langs->trans("Documents") . '</td></tr>'; print '<tr ' . $bc[$var] . '><td>' . $langs->trans("Proposal") . ' PDF</td>'; print '<td><a data-ajax="false" href="' . DOL_URL_ROOT . '/document.php?modulepart=propal&file=' . urlencode($relativepath) . '">' . $object->ref . '.pdf</a></td>'; print '<td align="right">' . dol_print_size(dol_filesize($file)) . '</td>'; print '<td align="right">' . dol_print_date(dol_filemtime($file), 'dayhour') . '</td>'; print '</tr>'; print "</table>\n"; // Conversion du PDF en image png si fichier png non existant if (!file_exists($fileimage) && !file_exists($fileimagebis) || filemtime($fileimage) < filemtime($file)) { if (class_exists("Imagick")) { $ret = dol_convert_file($file, 'png', $fileimage); if ($ret < 0) { $error++; } } else { $langs->load("errors"); print '<font class="error">' . $langs->trans("ErrorNoImagickReadimage") . '</font>'; } }
/** * Show list of documents in a directory * * @param string $upload_dir Directory that was scanned * @param array $filearray Array of files loaded by dol_dir_list function before calling this function * @param string $modulepart Value for modulepart used by download wrapper * @param string $param Parameters on sort links * @param int $forcedownload Force to open dialog box "Save As" when clicking on file * @param string $relativepath Relative path of docs (autodefined if not provided) * @param int $permtodelete Permission to delete * @param int $useinecm Change output for use in ecm module * @param int $textifempty Text to show if filearray is empty * @param int $maxlength Maximum length of file name shown * @param string $url Full url to use for click links ('' = autodetect) * @return int <0 if KO, nb of files shown if OK */ function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath = '', $permtodelete = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $url = '') { global $user, $conf, $langs; global $bc; global $sortfield, $sortorder; dol_syslog(get_class($this) . '::list_of_autoecmfiles upload_dir=' . $upload_dir . ' modulepart=' . $modulepart); // Show list of documents if (empty($useinecm)) { print load_fiche_titre($langs->trans("AttachedFiles")); } if (empty($url)) { $url = $_SERVER["PHP_SELF"]; } print '<table width="100%" class="nobordernopadding">'; print '<tr class="liste_titre">'; $sortref = "fullname"; if ($modulepart == 'invoice_supplier') { $sortref = 'level1name'; } print_liste_field_titre($langs->trans("Ref"), $url, $sortref, "", $param, 'align="left"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Documents2"), $url, "name", "", $param, 'align="left"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Size"), $url, "size", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Date"), $url, "date", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre('', '', ''); print '</tr>'; // To show ref or specific information according to view to show (defined by $module) if ($modulepart == 'company') { include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; $object_instance = new Societe($this->db); } else { if ($modulepart == 'invoice') { include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; $object_instance = new Facture($this->db); } else { if ($modulepart == 'invoice_supplier') { include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; $object_instance = new FactureFournisseur($this->db); } else { if ($modulepart == 'propal') { include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; $object_instance = new Propal($this->db); } else { if ($modulepart == 'supplier_proposal') { include_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php'; $object_instance = new SupplierProposal($this->db); } else { if ($modulepart == 'order') { include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; $object_instance = new Commande($this->db); } else { if ($modulepart == 'order_supplier') { include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; $object_instance = new CommandeFournisseur($this->db); } else { if ($modulepart == 'contract') { include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; $object_instance = new Contrat($this->db); } else { if ($modulepart == 'product') { include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; $object_instance = new Product($this->db); } else { if ($modulepart == 'tax') { include_once DOL_DOCUMENT_ROOT . '/compta/sociales/class/chargesociales.class.php'; $object_instance = new ChargeSociales($this->db); } else { if ($modulepart == 'project') { include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; $object_instance = new Project($this->db); } else { if ($modulepart == 'fichinter') { include_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php'; $object_instance = new Fichinter($this->db); } else { if ($modulepart == 'user') { include_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; $object_instance = new User($this->db); } } } } } } } } } } } } } $var = true; foreach ($filearray as $key => $file) { if (!is_dir($file['name']) && $file['name'] != '.' && $file['name'] != '..' && $file['name'] != 'CVS' && !preg_match('/\\.meta$/i', $file['name'])) { // Define relative path used to store the file $relativefile = preg_replace('/' . preg_quote($upload_dir . '/', '/') . '/', '', $file['fullname']); //var_dump($file); $id = 0; $ref = ''; $label = ''; // To show ref or specific information according to view to show (defined by $module) if ($modulepart == 'company') { preg_match('/(\\d+)\\/[^\\/]+$/', $relativefile, $reg); $id = isset($reg[1]) ? $reg[1] : ''; } if ($modulepart == 'invoice') { preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg); $ref = isset($reg[1]) ? $reg[1] : ''; } if ($modulepart == 'invoice_supplier') { preg_match('/([^\\/]+)\\/[^\\/]+$/', $relativefile, $reg); $ref = isset($reg[1]) ? $reg[1] : ''; if (is_numeric($ref)) { $id = $ref; $ref = ''; } } // $ref may be also id with old supplier invoices if ($modulepart == 'propal') { preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg); $ref = isset($reg[1]) ? $reg[1] : ''; } if ($modulepart == 'supplier_proposal') { preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg); $ref = isset($reg[1]) ? $reg[1] : ''; } if ($modulepart == 'order') { preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg); $ref = isset($reg[1]) ? $reg[1] : ''; } if ($modulepart == 'order_supplier') { preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg); $ref = isset($reg[1]) ? $reg[1] : ''; } if ($modulepart == 'contract') { preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg); $ref = isset($reg[1]) ? $reg[1] : ''; } if ($modulepart == 'product') { preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg); $ref = isset($reg[1]) ? $reg[1] : ''; } if ($modulepart == 'tax') { preg_match('/(\\d+)\\/[^\\/]+$/', $relativefile, $reg); $id = isset($reg[1]) ? $reg[1] : ''; } if ($modulepart == 'project') { preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg); $ref = isset($reg[1]) ? $reg[1] : ''; } if ($modulepart == 'fichinter') { preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg); $ref = isset($reg[1]) ? $reg[1] : ''; } if ($modulepart == 'user') { preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg); $id = isset($reg[1]) ? $reg[1] : ''; } if (!$id && !$ref) { continue; } $found = 0; if (!empty($this->cache_objects[$modulepart . '_' . $id . '_' . $ref])) { $found = 1; } else { //print 'Fetch '.$id." - ".$ref.'<br>'; if ($id) { $result = $object_instance->fetch($id); } else { //fetchOneLike looks for objects with wildcards in its reference. //It is useful for those masks who get underscores instead of their actual symbols //fetchOneLike requires some info in the object. If it doesn't have it, then 0 is returned //that's why we look only look fetchOneLike when fetch returns 0 if (!($result = $object_instance->fetch('', $ref))) { $result = $object_instance->fetchOneLike($ref); } } if ($result > 0) { // Save object into a cache $found = 1; $this->cache_objects[$modulepart . '_' . $id . '_' . $ref] = clone $object_instance; } if ($result == 0) { $found = 1; $this->cache_objects[$modulepart . '_' . $id . '_' . $ref] = 'notfound'; unset($filearray[$key]); } } if (!$found > 0 || !is_object($this->cache_objects[$modulepart . '_' . $id . '_' . $ref])) { continue; } // We do not show orphelins files $var = !$var; print '<tr ' . $bc[$var] . '>'; print '<td>'; if ($found > 0 && is_object($this->cache_objects[$modulepart . '_' . $id . '_' . $ref])) { print $this->cache_objects[$modulepart . '_' . $id . '_' . $ref]->getNomUrl(1, 'document'); } else { print $langs->trans("ObjectDeleted", $id ? $id : $ref); } print '</td>'; print '<td>'; //print "XX".$file['name']; //$file['name'] must be utf8 print '<a data-ajax="false" href="' . DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart; if ($forcedownload) { print '&attachment=1'; } print '&file=' . urlencode($relativefile) . '">'; print img_mime($file['name'], $file['name'] . ' (' . dol_print_size($file['size'], 0, 0) . ')') . ' '; print dol_trunc($file['name'], $maxlength, 'middle'); print '</a>'; print "</td>\n"; print '<td align="right">' . dol_print_size($file['size'], 1, 1) . '</td>'; print '<td align="center">' . dol_print_date($file['date'], "dayhour") . '</td>'; print '<td align="right">'; if (!empty($useinecm)) { print '<a data-ajax="false" href="' . DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart; } if ($forcedownload) { print '&attachment=1'; } print '&file=' . urlencode($relativefile) . '">'; print img_view() . '</a> '; //if ($permtodelete) print '<a href="'.$url.'?id='.$object->id.'§ion='.$_REQUEST["section"].'&action=delete&urlfile='.urlencode($file['name']).'">'.img_delete().'</a>'; //else print ' '; print "</td></tr>\n"; } } if (count($filearray) == 0) { print '<tr ' . $bc[false] . '><td colspan="4">'; if (empty($textifempty)) { print $langs->trans("NoFileFound"); } else { print $textifempty; } print '</td></tr>'; } print "</table>"; // Fin de zone }
$obj = $db->fetch_object($resql); if ($obj) { $var = !$var; print "<tr " . $bc[$var] . ">"; print "<td>" . $obj->df . "</td>\n"; print '<td align="center">' . $obj->cc . '</td>'; print '<td align="center">'; print '<a href="' . $_SERVER["PHP_SELF"] . '?action=builddoc&page=' . $page . '&month=' . $obj->month . '&year=' . $obj->year . '">' . img_picto($langs->trans('GenerateReport'), 'filenew') . '</a>'; print '</td>'; $name = "actions-" . $obj->month . "-" . $obj->year . ".pdf"; $relativepath = $name; $file = $conf->agenda->dir_temp . "/" . $name; if (file_exists($file)) { print '<td align="center"><a data-ajax="false" href="' . DOL_URL_ROOT . '/document.php?page=' . $page . '&file=' . urlencode($relativepath) . '&modulepart=actionsreport">' . img_pdf() . '</a></td>'; print '<td align="center">' . dol_print_date(dol_filemtime($file), 'dayhour') . '</td>'; print '<td align="center">' . dol_print_size(dol_filesize($file)) . '</td>'; } else { print '<td> </td>'; print '<td> </td>'; print '<td> </td>'; } print "</tr>\n"; } $i++; } print "</table>"; $db->free($resql); } else { dol_print_error($db); } llxFooter();
print '<tr><td>'.$langs->trans("ECMCreationUser").'</td><td>'; $userecm=new User($db); $userecm->fetch($ecmdir->fk_user_c); print $userecm->getNomUrl(1); print '</td></tr>'; print '<tr><td>'.$langs->trans("ECMCreationDate").'</td><td>'; print dol_print_date($ecmdir->date_c,'dayhour'); print '</td></tr>'; print '<tr><td>'.$langs->trans("ECMDirectoryForFiles").'</td><td>'; print '/ecm/'.$relativepath; print '</td></tr>'; print '<tr><td>'.$langs->trans("ECMNbOfDocs").'</td><td>'; print sizeof($filearray); print '</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td>'; print dol_print_size($totalsize); print '</td></tr>'; if ($_GET["action"] == 'edit') { print '<tr><td colspan="2" align="center">'; print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">'; print ' '; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print '</td></tr>'; } print '</table>'; if ($_GET["action"] == 'edit') { print '</form>'; } print '</div>';
print '<td>' . $langs->trans("FilesUpdated") . '</td>'; print '<td align="center">' . $langs->trans("ExpectedChecksum") . '</td>'; print '<td align="center">' . $langs->trans("CurrentChecksum") . '</td>'; print '<td align="right">' . $langs->trans("Size") . '</td>'; print '<td align="right">' . $langs->trans("DateModification") . '</td>'; print '</tr>' . "\n"; $var = true; $tmpfilelist = dol_sort_array($file_list['updated'], 'filename'); if (is_array($tmpfilelist) && count($tmpfilelist)) { foreach ($tmpfilelist as $file) { $var = !$var; print '<tr ' . $bc[$var] . '>'; print '<td>' . $file['filename'] . '</td>' . "\n"; print '<td align="center">' . $file['expectedmd5'] . '</td>' . "\n"; print '<td align="center">' . $file['md5'] . '</td>' . "\n"; print '<td align="right">' . dol_print_size(dol_filesize(DOL_DOCUMENT_ROOT . '/' . $file['filename'])) . '</td>' . "\n"; print '<td align="right">' . dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT . '/' . $file['filename']), 'dayhour') . '</td>' . "\n"; print "</tr>\n"; } } else { print '<tr ' . $bc[false] . '><td colspan="5">' . $langs->trans("None") . '</td></tr>'; } print '</table>'; } else { print 'Error: Failed to found dolibarr_htdocs_dir into XML file ' . $xmlfile; $error++; } } else { print 'Error: Failed to parse XML for input file ' . $xmlfile; $error++; }
/** * Show list of documents in a directory * @param upload_dir Directory that was scanned * @param filearray Array of files loaded by dol_dir_list function before calling this function * @param modulepart Value for modulepart used by download wrapper * @param param Parameters on sort links * @param forcedownload Force to open dialog box "Save As" when clicking on file * @param relativepath Relative path of docs (autodefined if not provided) * @param permtodelete Permission to delete * @param useinecm Change output for use in ecm module * @param textifempty Text to show if filearray is empty * @param maxlength Maximum length of file name shown * @return int <0 if KO, nb of files shown if OK */ function list_of_autoecmfiles($upload_dir,$filearray,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0) { global $user, $conf, $langs; global $bc; global $sortfield, $sortorder; // Affiche liste des documents existant if (empty($useinecm)) print_titre($langs->trans("AttachedFiles")); //else { $bc[true]=''; $bc[false]=''; }; $url=$_SERVER["PHP_SELF"]; print '<table width="100%" class="nobordernopadding">'; print '<tr class="liste_titre">'; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Documents2"),$_SERVER["PHP_SELF"],"name","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Size"),$_SERVER["PHP_SELF"],"size","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"date","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre('','',''); print '</tr>'; if ($modulepart == 'invoice') { include_once(DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'); $object_static=new Facture($this->db); } if ($modulepart == 'invoice_supplier') { include_once(DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'); $object_static=new FactureFournisseur($this->db); } $var=true; foreach($filearray as $key => $file) { if (!is_dir($file['name']) && $file['name'] != '.' && $file['name'] != '..' && $file['name'] != 'CVS' && ! preg_match('/\.meta$/i',$file['name'])) { // Define relative path used to store the file $relativefile=preg_replace('/'.preg_quote($upload_dir.'/','/').'/','',$file['fullname']); //print 'eeee'.$relativefile; //var_dump($file); $var=!$var; print '<tr '.$bc[$var].'>'; print '<td>'; $id='';$ref=''; if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=$reg[1]; $object_static->fetch('',$ref); //print $relativefile.'rr'.$id; print $object_static->getNomUrl(1,'document'); } if ($modulepart == 'invoice_supplier') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=$reg[1]; $object_static->fetch($id); //print $relativefile.'rr'.$id; print $object_static->getNomUrl(1,'document'); } print '</td>'; print '<td>'; //print "XX".$file['name']; //$file['name'] must be utf8 print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart; if ($forcedownload) print '&attachment=1'; print '&file='.urlencode($relativefile).'">'; print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' '; print dol_trunc($file['name'],$maxlength,'middle'); print '</a>'; print "</td>\n"; print '<td align="right">'.dol_print_size($file['size'],1,1).'</td>'; print '<td align="center">'.dol_print_date($file['date'],"dayhour").'</td>'; print '<td align="right">'; if (! empty($useinecm)) print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart; if ($forcedownload) print '&attachment=1'; print '&file='.urlencode($relativefile).'">'; print img_view().'</a> '; //if ($permtodelete) print '<a href="'.$url.'?id='.$object->id.'§ion='.$_REQUEST["section"].'&action=delete&urlfile='.urlencode($file['name']).'">'.img_delete().'</a>'; //else print ' '; print "</td></tr>\n"; } } if (sizeof($filearray) == 0) { print '<tr '.$bc[$var].'><td colspan="4">'; if (empty($textifempty)) print $langs->trans("NoFileFound"); else print $textifempty; print '</td></tr>'; } print "</table>"; // Fin de zone }
$theKey = htmlentities(base64_decode($_GET['key'])); $theserver = $MEMCACHE_SERVERS[(int)$_GET['server']]; list($h,$p) = explode(':',$theserver); $r = sendMemcacheCommand($h,$p,'get '.$theKey); print $langs->trans("PrefixForKeysInCache").': '.session_name().'_'.'<br>'; print '<br>'; print <<<EOB <table class="border" width="100%"><tbody> <tr><th>Server<th>Key</th><th>Value</th><th>Delete</th></tr> EOB; echo "<tr><td class=td-0>",$theserver,"</td><td class=td-0>",$theKey, " <br/>flag:",$r['VALUE'][$theKey]['stat']['flag'], " <br/>Size:",dol_print_size($r['VALUE'][$theKey]['stat']['size'],1), "</td><td>",chunk_split($r['VALUE'][$theKey]['value'],40),"</td>", '<td><a href="',$PHP_SELF,'&op=5&server=',(int)$_GET['server'],'&key=',base64_encode($theKey),"\">Delete</a></td>","</tr>"; echo <<<EOB </tbody></table> EOB; break; case 5: // item delete if (!isset($_GET['key']) || !isset($_GET['server'])){ echo "No key set!"; break; } $theKey = htmlentities(base64_decode($_GET['key'])); $theserver = $MEMCACHE_SERVERS[(int)$_GET['server']]; list($h,$p) = explode(':',$theserver); $r = sendMemcacheCommand($h,$p,'delete '.$theKey);