* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/blockedlog/admin/fingerprints.php * \ingroup blockedlog * \brief Page setup for blockedlog module */ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/authority.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; $langs->load("admin"); $langs->load("other"); $langs->load("blockedlog"); if (! $user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $showonlyerrors = GETPOST('showonlyerrors','int'); $block_static = new BlockedLog($db); if($action === 'downloadblockchain') { $auth = new BlockedLogAuthority($db); $bc = $auth->getLocalBlockChain(); header('Content-Type: application/octet-stream'); header("Content-Transfer-Encoding: Binary"); header("Content-disposition: attachment; filename=\"" .$auth->signature. ".certif\""); echo $bc; exit; } else if($action === 'downloadcsv') { $res = $db->query("SELECT rowid,tms,action,amounts,element,fk_object,date_object,ref_object,signature,fk_user FROM ".MAIN_DB_PREFIX."blockedlog ORDER BY rowid ASC"); if($res) { $signature = $block_static->getSignature(); header('Content-Type: application/octet-stream'); header("Content-Transfer-Encoding: Binary"); header("Content-disposition: attachment; filename=\"" .$signature. ".csv\""); print $langs->transnoentities('Id') .';'.$langs->transnoentities('Timestamp') .';'.$langs->transnoentities('Action') .';'.$langs->transnoentities('Amounts') .';'.$langs->transnoentities('Element') .';'.$langs->transnoentities('ObjectId') .';'.$langs->transnoentities('Date') .';'.$langs->transnoentities('Ref') .';'.$langs->transnoentities('Fingerprint') .';'.$langs->transnoentities('User')."\n"; while($obj = $db->fetch_object($res)) { print $obj->rowid .';'.$obj->tms .';'.$obj->action .';'.$obj->amounts .';'.$obj->element .';'.$obj->fk_object .';'.$obj->date_object .';'.$obj->ref_object .';'.$obj->signature .';'.$obj->fk_user."\n"; } exit; } else{ setEventMessage($db->lasterror, 'errors'); } } /* * View */ $blocks = $block_static->getLog('all', 0, GETPOST('all') ? 0 : 50); $form=new Form($db); llxHeader('',$langs->trans("BlockedLogSetup")); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog'),$linkback); $head=blockedlogadmin_prepare_head(); dol_fiche_head($head, 'fingerprints', '', -1); print $langs->trans("FingerprintsDesc")."
\n"; print '
'; print '
'; print ' '.$langs->trans('ShowAllFingerPrintsMightBeTooLong').''; print ' | '.$langs->trans('ShowAllFingerPrintsErrorsMightBeTooLong').''; print ' | '.$langs->trans('DownloadBlockChain').''; print ' | '.$langs->trans('DownloadLogCSV').''; print '
'; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; foreach($blocks as &$block) { $checksignature = $block->checkSignature(); $object_link = $block->getObjectLink(); if(!$showonlyerrors || $block->error>0) { print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; } } print '
'.$langs->trans('#').''.$langs->trans('Date').''.$langs->trans('Author').''.$langs->trans('Action').''.$langs->trans('Ref').''.$langs->trans('Element').''.$langs->trans('Amount').''.$langs->trans('DataOfArchivedEvent').''.$langs->trans('Fingerprint').'
'.$block->id.''.dol_print_date($block->tms,'dayhour').''.$block->getUser().''.$langs->trans('log'.$block->action).''.$block->ref_object.''.$object_link.''.price($block->amounts).''.img_info($langs->trans('ShowDetails')).''; print $form->textwithpicto(dol_trunc($block->signature, '12'), $block->signature); print ''; print $block->error == 0 ? img_picto($langs->trans('OkCheckFingerprintValidity'), 'tick') : img_picto($langs->trans('KoCheckFingerprintValidity'), 'statut8'); if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) { print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black') ); } print '
'; ?> global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) { ?>
'; llxFooter(); $db->close();