./dev/utils.js # js /* ######################################### */ /* ######################################### */ /* ########### upload CSS ################ */ /* ######################################### */ /* ######################################### */ .upload { padding: 3px; border: 1px double black; opacity: 0.7; border-radius: 5px; } .upload.dragover { border: 1px dashed black; opacity: 1.0; } /* ######################################### */ /* ######################################### */ /* ########### upload JS ################ */ /* ######################################### */ /* ######################################### */ function setdragging(target, on) { if (on) target.classList.add('dragover'); else target.classList.remove('dragover'); } function printResult(h) { let oOutput = document.getElementById('id_img-content'); oOutput.innerHTML = h; } function upload_drop(e) { e.preventDefault(); setdragging(e.currentTarget, false); if (e.dataTransfer == null) return; fileobj = e.dataTransfer.files[0]; ajax_file_upload(fileobj); } function upload_dragover(e) { e.preventDefault(); setdragging(e.currentTarget, true); printResult(''); } function upload_dragleave(e) { e.preventDefault(); setdragging(e.currentTarget, false); // let target = e.currentTarget; // printResult( 'leave '+target.id + " - " + e.clientX + ", " + e.clientY ); } function upload_dragend(e) { e.preventDefault(); setdragging(e.currentTarget, false); } function file_explorer() { let inp = document.getElementById('id_selectfile'); inp.click(); inp.onchange = function() { fileobj = document.getElementById('id_selectfile').files[0]; ajax_file_upload(fileobj); }; } function ajax_file_upload(file_obj) { if (file_obj == undefined) return; let form_data = new FormData(); form_data.append('file', file_obj); let xhttp = new XMLHttpRequest(); xhttp.open("POST", "./dev/upload.php", true); xhttp.onload = function(event) { if (xhttp.status == 200) { let oOutput = document.getElementById('id_img-content'); if (typeof oOutput.onplay === 'function') { oOutput.onplay(this.responseText); } else { printResult( "The Image" ); } } else { printResult( "Error " + xhttp.status + " occurred when trying to upload your file." ); } } xhttp.send(form_data); } /* ######################################### */ /* ######################################### */ /* ########### upload JS ################ */ /* ######################################### */ /* ######################################### */ require_once (DOKU_INC.'dev/tools.php'); execNoWait('sudo /root/.bash/sudo_www/ls_video.bash'); function getCurrentMediaDir() { if (array_key_exists('path', $_GET)) { $d = $_GET['path']; } if ($d == '') { $d = "../video"; } return $d; } === NAS Ambierle === Test 24/10/2023 ---- $d = getCurrentMediaDir(); echo ''."\n"; echo '
'; echo ' Dir : '.htmlspecialchars($d).'
'; echo '
'; echo ' '; echo '
'; echo '
';
include_once 'dev/geoplugin.php'; $br = " \\\\ \n"; function insertImg($p) { // $server = "https://".$_SERVER['HTTP_HOST']; // $url = $server."/js-test/?do=cv"; // return '{{'.getUrl().'/'.$p.'?62x84}}'; return ""; } function createTabDir($d) { $url = getUrl(); $eol = "\n"; //echo "Dir = ".$d.$br; if ( // $_SERVER['PHP_AUTH_USER'] != 'jeff' && //($d != '..') && strpos($d, '../video')!==0 && strpos($d, '../music')!==0 ) { return; } $dir = scandir($d); echo $eol; echo "| DIR "; $i = strrpos($d, '/'); if ($i !== false) { echo "| [[".$url.getDokuScript()."?id=".getDokuID()."&path=".urlencode(substr($d, 0, $i))."|.. ]] "; } else { echo "| [[".$url.getDokuScript()."?id=".getDokuID()."&path=|.. ]] "; } echo "|".$eol; foreach ($dir as $key => $v) { if ($v[0] == '.') continue; if ($v[0] == '@') continue; $ext = strtolower(strrchr($v, '.')); $filen= substr($v, 0, strrpos($v, '.')); $totpath = $d."/".$v; if ($d == '.') $totpath = $v; $isdir = is_dir($totpath); $jpgfound = ''; if (!$isdir && $ext == '.php') continue; if (!$isdir && !in_array($ext, array("", ".mp3", ".mp4", ".srt", ".avi", ".m4v", ".mkv"))) continue; if ($isdir) { $totpath2 = $totpath.'/cover.jpg'; if (file_exists($totpath2)) { $first=insertImg($totpath2); echo "| ".$first." "; } else { echo "| DIR "; } echo '| [['.$url.getDokuScript().'?id='.getDokuID().'&path='.urlencode($totpath).'|'.htmlspecialchars($totpath).']] '; } else { if ( is_link ( $totpath ) ) continue; if (file_exists($d."/".$filen.'.jpg')) { $first=insertImg($d."/".$filen.'.jpg'); echo "| ".$first." "; } else { echo "| ".$ext." "; } // onclick='evtClickFile(event)' $newname = '00'.base64_encode($v); $newpath = $d."/"; // .$newname.$ext $abspathdir = ""; // if ( $_SERVER['PHP_AUTH_USER'] == 'jeff' && !file_exists($newpath.'.link/'.$newname.$ext) && (strpos($d, '../video')===0)) { $output = ''; $retval=''; $abspathdir = $_SERVER['DOCUMENT_ROOT'].'/dokuwiki/'.$newpath; // echo "\n"; $cmd='/root/.bash/sudo_www/video_symlnk.bash "'.$abspathdir.'" "'.$newname.$ext.'" "'.$v.'"'; // escapeshellcmd $retval = exec( ( '/opt/bin/sudo '.$cmd ). " 2>&1", $output, $retval); echo "\n"; foreach ($output as $k => $v) { echo ' * '.$k.' -- '.$v."\n"; } echo "\n"; } // if (file_exists($d."/".$filen.'.jpg')) { $imdb=insertImg($d."/".$filen.'.jpg'); } $searchengine='allocine'; $imdb=' [[https://www.google.com/search?channel=nrow5&q='.$searchengine; $words = explode(' ', $filen); foreach ($words as $value) { if ($value=='-') continue; $imdb .= '+'.$value; $allocine .= '+'.$value; } $imdb=$imdb.'|'.$searchengine.']] '; if (file_exists($newpath.'.link/'.$newname.$ext)) echo '| [['.$url.'/dokuwiki/'.$newpath.'.link/'.$newname.$ext.'|'.htmlspecialchars($v).']] '; else echo '| £4£:'.$abspathdir.' | [['.$url.'/dokuwiki/'.$totpath.'|'.htmlspecialchars($v).']] '; } echo " | ".$imdb." |".$eol; } echo $eol.$eol; } $path = DOKU_INC.'dev/log-user-'.$_SERVER['PHP_AUTH_USER'].'.txt'; $yourip = getRealIpAddr(); $f = @fopen($path, 'a'); @fwrite($f, date('Y-m-d H:i:s').' == '.$_SERVER['PHP_AUTH_USER'].' == '.$yourip." ==\n"); @fclose($f); $d = getCurrentMediaDir(); createTabDir($d); // print_r(getDokuID()); echo "\n\n"; // echo "Lecteur de musique : [ ".getUrl()."/phpaudioplayer/" . " ]\n";
include_once 'dev/geoplugin.php'; $ip = getRealIpAddr(); $iploc = getIpLocation($ip); $svr = $_SERVER['SERVER_NAME']; $hostbyaddr = ''; if (filter_var($ip, FILTER_VALIDATE_IP)) { $hostbyaddr = gethostbyaddr ($ip); } echo "| Serveur | ". $svr ." |\n"; echo "| Script | ". getDokuScript() ." |\n"; echo "| Utilisateur | ". $_SERVER['PHP_AUTH_USER'] ." |\n"; echo "| Date | ". date("l - d/m/Y - H:i:s - e", time()) ." |\n"; echo "| Votre IP | ". $ip ." |\n"; echo "| Rev IP | ". $hostbyaddr ." |\n"; echo "| Pays | ". $iploc['countryName'] ." |\n"; echo "| GPS | ". $iploc['latitude']." ; ".$iploc['longitude'] ." |\n"; echo "| DistAmbierle | ". getDistanceFromLoc($iploc, 46.0916717, 3.9242403) ." km |\n"; echo "\n"; // print_r($_SERVER); ~~NOCACHE~~