Afficher la pageAnciennes révisionsLiens de retourHaut de page Cette page est en lecture seule. Vous pouvez afficher le texte source, mais ne pourrez pas le modifier. Contactez votre administrateur si vous pensez qu'il s'agit d'une erreur. <PRELOAD> ./dev/utils.js # js </PRELOAD> <CSS> /* ######################################### */ /* ######################################### */ /* ########### upload CSS ################ */ /* ######################################### */ /* ######################################### */ .upload { padding: 3px; border: 1px double black; opacity: 0.7; border-radius: 5px; } .upload.dragover { border: 1px dashed black; opacity: 1.0; } </CSS> <JS> /* ######################################### */ /* ######################################### */ /* ########### 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( "<img src='"+ this.responseText +"' alt='The Image' />" ); } } else { printResult( "Error " + xhttp.status + " occurred when trying to upload your file." ); } } xhttp.send(form_data); } </JS> <php> /* ######################################### */ /* ######################################### */ /* ########### 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; } </php> === NAS Ambierle === Test 24/10/2023 ---- <grid> <col sm="12"> <panel type="primary" title="Vidéos" icon="glyphicon glyphicon-home"> <php> $d = getCurrentMediaDir(); echo '<script>'."\n"; echo 'var_currentMediaDir = "'.$d.'";'."\n"; echo 'function onupload(e) {'."\n"; // echo 'document.getElementById("id_img-content").innerHTML = e+"<br>"+var_currentMediaDir;'."\n"; echo 'document.getElementById("id_img-content").innerHTML = "<img src=\""+e+"\" />";'."\n"; echo '}'."\n"; echo '</script>'."\n"; echo '<div id="id_drop_file_zone" style="width:15em; text-align:center;" ondrop="upload_drop(event)" ondragover="upload_dragover(event)" ondragend="upload_dragend(event)" ondragleave="upload_dragleave(event)" class="bg-info upload">'; echo ' <span>Dir : '.htmlspecialchars($d).'</span><br>'; echo ' <input type="button" style="display:none;" value="Select File" onclick="file_explorer();" /><br>'; echo ' <input type="file" style="display:none;" id="id_selectfile" />'; echo '</div>'; echo '<div id="id_img-content" onplay="onupload(event)"></div>'; </php> <phpwikify> 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 "<img src=\"".$p."\" width='93' height='126'>"; } 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 "| <html>".$first."</html> "; } 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 "| <html>".$first."</html> "; } else { echo "| <html><span id='".base64_encode($v)."' >".$ext."</span></html> "; } // 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"; </phpwikify> <html> <script> class cInfoTable { constructor( modalId ) { this.modalId = modalId; } showModal(title, body) { document.getElementById(this.modalId+'_body').innerHTML = body; document.getElementById(this.modalId+'_title').innerHTML = title; document.getElementById(this.modalId+'_btnclose').onclick = this.hideModal; jQuery('#'+this.modalId).on('hidden.bs.modal', function() { this.iInfoTable.focusoutModal(); } ); jQuery('#'+this.modalId).modal(); document.getElementById(this.modalId).iInfoTable = this; // this.input1.select(); this.input1.focus(); } hideModal() { jQuery('#'+this.modalId).modal('hide'); } focusoutModal() { } evtClick2() { // pevent let modalId = 'truc'; let msg = 'body'; msg += '<input id="_id8989" type="text" name="inp_name" value="inp_value" class="edit input-sm" size="4" />'+"\n"; //msg += this.printTableForm( ); msg += '<div class="modal-footer">'; msg += '<button id="'+modalId+'-ButtonCancel" type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>'; msg += '<button id="'+modalId+'-ButtonOk" type="button" class="btn btn-primary">Ok</button>'; msg += '</div>'; iInfoTable.showModal('titre', msg); let btnmodal = document.getElementById(modalId+'-ButtonOk'); btnmodal.onclick = function(e) { this.navTable.clickNewItemOk(e, this); }; btnmodal.navTable = this; } clickNewItemOk(e, btnmodal) { } printModal(title, msg) { let s=''; s += '<div class="bs-wrap bs-wrap-modal modal" id="'+this.modalId+'" role="dialog" tabindex="-1" data-labelledby="'+title+'">'; s += ' <div class="bs-wrap modal-dialog modal-lg" role="document">'; s += ' <div class="bs-wrap modal-content">'; s += ' <div class="bs-wrap modal-header">'; s += ' <button id="'+this.modalId+'_btnclose" type="button" class="close btn btn-default" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>'; s += ' <h4 id="'+this.modalId+'_title" class="bs-wrap modal-title">'+title+'</h4>'; s += ' </div>'; s += ' <div id="'+this.modalId+'_body" class="bs-wrap modal-body">'; s += ' '+msg; s += ' </div>'; s += ' </div>'; s += ' </div>'; s += '</div>'; return s; } } window.addEventListener("load", function(event) { iInfoTable = new cInfoTable('modal-infos'); let elementModals = document.getElementById("panel_modals"); elementModals.innerHTML += iInfoTable.printModal("modal-infos", '', ''); }); </script> </html> <html><div id="panel_modals"></div></html> </panel> </col> </grid> <grid> <col sm="4"> <panel type="warning" title="Test PHP" > <phpwikify> 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); </phpwikify> </panel> </col> <col sm="4"> <panel type="warning" title="..." > </panel> </col> </grid> ~~NOCACHE~~ accueil.txt Dernière modification : 2023/10/24 20:10de dokuwiki_jeff