// not an image } elseif (in_array($ext, $common_extensions)) { echo "<img class='thumb' src='img/thumb-" . $ext . ".png' alt='' />"; // special case for mol files } elseif ($ext === 'mol' && $_SESSION['prefs']['chem_editor'] && $_GET['mode'] === 'view') { // we need to escape \n in the mol file or we get unterminated string literal error in JS $mol = str_replace("\n", "\\n", file_get_contents(ELAB_ROOT . 'uploads/' . $uploads_data['long_name'])); echo "<div class='center'><script>\n showMol('" . $mol . "');\n </script></div>"; } else { // uncommon extension without a nice image to display echo "<img class='thumb' src='img/thumb.png' alt='' />"; } // now display the name + comment with icons echo "<div class='caption'><img src='img/attached.png' class='bot5px' alt='attached' /> "; echo "<a href='app/download.php?f=" . $uploads_data['long_name'] . "&name=" . $uploads_data['real_name'] . "' target='_blank'>" . $uploads_data['real_name'] . "</a>"; echo "<span class='smallgray' style='display:inline'> " . Tools::formatBytes(filesize('uploads/' . $uploads_data['long_name'])) . "</span><br>"; // if we are in view mode, we don't show the comment if it's the default text // this is to avoid showing 'Click to add a comment' where in fact you can't click to add a comment because // your are in view mode $comment = "<img src='img/comment.png' class='bot5px' alt='comment' />\n <p class='editable inline' id='filecomment_" . $uploads_data['id'] . "'>" . stripslashes($uploads_data['comment']) . "</p>"; if ($_GET['mode'] === 'edit' || $uploads_data['comment'] != 'Click to add a comment') { echo $comment; } echo "</div></div></div>"; } // end while echo "</div></div>"; } // end if there is at least one file uploaded // END DISPLAY FILES echo "</div>";
require_once 'inc/common.php'; $page_title = _('Export'); $selected_menu = null; try { switch ($_GET['what']) { case 'csv': $make = new \Elabftw\Elabftw\MakeCsv($_GET['id'], $_GET['type']); break; case 'zip': $make = new \Elabftw\Elabftw\MakeZip($_GET['id'], $_GET['type']); break; case 'pdf': $make = new \Elabftw\Elabftw\MakePdf($_GET['id'], $_GET['type']); break; default: throw new Exception(_('Bad type!')); } } catch (Exception $e) { require_once 'inc/head.php'; display_message('error', $e->getMessage()); require_once 'inc/footer.php'; exit; } // the pdf is shown directly, but for csv or zip we want a download page if ($_GET['what'] === 'csv' || $_GET['what'] === 'zip') { require_once 'inc/head.php'; echo "<div class='well' style='margin-top:20px'>"; echo "<p>" . _('Your file is ready:') . "<br>\n <a href='app/download.php?type=" . $_GET['what'] . "&f=" . $make->fileName . "&name=" . $make->getCleanName() . "' target='_blank'>\n <img src='img/download.png' alt='download' /> " . $make->getCleanName() . "</a>\n <span class='filesize'>(" . Tools::formatBytes(filesize($make->filePath)) . ")</span></p>"; echo "</div>"; require_once 'inc/footer.php'; }