- <?php } ?>
- <a href="https://github.com/muchweb/simple-php-upload"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
- <script charset="utf-8">
- var target_form = document.getElementById('simpleupload-form'),
- target_ul = document.getElementById('simpleupload-ul'),
- target_input = document.getElementById('simpleupload-input');
-
- target_form.addEventListener('dragover', function (event) {
- event.preventDefault();
- }, false);
+ <?php
+ }
+
+ if ($settings['allow_external_refs']) {
+ ?>
+ <a href="https://github.com/muchweb/simple-php-upload" target="_blank"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
+ <?php
+ } else {
+ ?>
+ <a href="https://github.com/muchweb/simple-php-upload" target="_blank">Fork me on GitHub</a>
+ <?php
+ }
+ ?>
+ <script type="text/javascript">
+ <!--
+ // Init some variales to shorten code
+ var target_form = document.getElementById('simpleupload-form');
+ var target_ul = document.getElementById('simpleupload-ul');
+ var target_input = document.getElementById('simpleupload-input');
+ var settings_listfiles = <?=($settings['listfiles'] ? 'true' : 'false')?>;
+
+ /**
+ * Initializes the upload form
+ */
+ function init () {
+ // Register drag-over event listener
+ target_form.addEventListener('dragover', function (event) {
+ event.preventDefault();
+ }, false);
+
+ // ... and the drop event listener
+ target_form.addEventListener('drop', handleFiles, false);
+
+ // Register onchange-event function
+ target_input.onchange = function () {
+ addFileLi('Uploading...', '');
+ target_form.submit();
+ };
+ }
+
+ /**
+ * Adds given file in a new li-tag to target_ul list
+ *
+ * @param name Name of the file
+ * @param info Some more informations
+ */
+ function addFileLi (name, info) {
+ if (settings_listfiles == false) {
+ return;
+ }