To us, these are user driven (is it widgets) they create by selecting multiple media (today images, but down the line, other combinations) from the left hand table cell’s listing links.
… and it’s invitation to broaden the scope … so that today we start down the road towards the concept of what we’ll call …
“assembly media pairings” … where, so far, two, media selections get used to create another “widget” creation … so far …
… trying …
audio and video … ffmpeg helps add an audio soundtrack onto a video
text and image … textarea element with image background
audio and image … audio element with image background
video and image … video element with image background
we open within a popup window in Google Chrome (via selected slides) …
the recipient PHP constructs the wherewithal to construct Video *.mp4 data via (exec called) … ffmpeg -f concat -safe 0 -i list.txt -r 25 -pix_fmt yuv420p output.mp4
is able to display the Video (as a video/mp4 mimetype data) arrangement
… means by which we can offer a Video “assembly” now in the “eleventh draft”one_line_find.phpDocument Root Relative Folder Listing web application you can “crank up” below, yet again, if you, and your ilk, along with their family and friends, girls and boys, cousins and removalists (to get rid of those pesky second ones), Martians with visas, commentators and audience, filibusters and crime busters and ghost busters, attendees and abstainers, townfolk and countryfolk alike, like.
we open within a popup window in Google Chrome (via selected slides) …
the recipient PHP constructs the wherewithal to construct Animated GIF *.gif data via (exec called) … convert -delay 1000 -loop 0 [space delimited list of image filenames] output.gif
is able to display the Animated GIF (as an image/gif mimetype data) arrangement
… means by which we can offer an Animated GIF “assembly” now in the “tenth draft”one_line_find.phpDocument Root Relative Folder Listing web application you can “crank up” below, yet again, if you, and your ilk, along with their family and friends, girls and boys, cousins and removalists (to get rid of those pesky second ones), Martians with visas, commentators and audience, filibusters and crime busters, townfolk and countryfolk alike, like.
… issues where in the past we may have resorted to a …
crontab (and maybe curl) means to a solution … but we prefer, where possible …
there and then procedures within the PHP (ie. it has to be PHP to help) … as much as anything, because that way, all the parts to any solution, are self contained
… and for security purposes that PHP solution is best done using a form method=POST methodology, or, as we are sprouting here today (and we like a lot, and think it could help us out later with other such scenarios) … and our apologies for the tautology …
PHP Javascript Ajax Asynchronous Sleep Cleanup
… thinking we start explaining at the changed Javascript Ajax (to the original block of code) as per …
<?php echo ”
var gincv='', ganidn='';
function ajaxpdfit(incv) {
if (4 == 4) {
var anidn='' + incv.replace(/\\\\/g,'/').split(',')[0].split('/')[eval(-1 + incv.replace(/\\\\/g,'/').split(',')[0].split('/').length)].split('.')[0] + '_et-al_' + incv.split(',').length; // + '.pdf';
if (pdfwoo) {
if (!pdfwoo.closed) { pdfwoo.close(); pdfwoo=null; } else { pdfwoo.close(); pdfwoo=null; }
}
if (pptxwoo) {
if (!pptxwoo.closed) { pptxwoo.close(); pptxwoo=null; } else { pptxwoo.close(); pptxwoo=null; }
}
if (mswoo) {
if (!mswoo.closed) { mswoo.close(); mswoo=null; } else { mswoo.close(); mswoo=null; }
}
//incv=incv.replace(/\~\~/g, String.fromCharCode(92) + String.fromCharCode(10)); // new idea
if (('' + document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(incv) + '&apdfname=' + encodeURIComponent(anidn + '.pdf')).length > 800) { pdfzhr = new XMLHttpRequest();
pdfzform = new FormData();
pdfzform.append('anidnlist', incv);
pdfzform.append('anidn', anidn + '.abc');
//pdfzhr.onreadystatechange=noNeedToHangAround;
pdfzhr.open('post', './one_line_find.php', true);
pdfzhr.send(pdfzform);
ganidn=anidn;
gincv=noh(incv); // strips out any hashtagged caption data
setTimeout(function(){
pdfwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(gincv) + '&apdfname=' + encodeURIComponent(ganidn + '.pdf'),'_blank','top=20,left=' + eval(-700 + screen.width) + ',width=700,height=700');
pdfwoo.document.title='PDF (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
pptxwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?applist=' + encodeURIComponent(gincv) + '&appname=' + encodeURIComponent(ganidn + '.pptx'),'_blank','top=' + eval(-400 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
pptxwoo.document.title='PowerPoint (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
mswoo=window.open(document.URL.split('?')[0].split('#')[0] + '?amslist=' + encodeURIComponent(gincv) + '&amsname=' + encodeURIComponent(ganidn + '.docx'),'_blank','top=' + eval(-200 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
mswoo.document.title='Word (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
}, 5000);
} else {
pdfwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(incv) + '&apdfname=' + encodeURIComponent(anidn + '.pdf'),'_blank','top=20,left=' + eval(-700 + screen.width) + ',width=700,height=700');
pdfwoo.document.title='PDF (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
pptxwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?applist=' + encodeURIComponent(incv) + '&appname=' + encodeURIComponent(anidn + '.pptx'),'_blank','top=' + eval(-400 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
pptxwoo.document.title='PowerPoint (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
mswoo=window.open(document.URL.split('?')[0].split('#')[0] + '?amslist=' + encodeURIComponent(incv) + '&amsname=' + encodeURIComponent(anidn + '.docx'),'_blank','top=' + eval(-200 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
mswoo.document.title='Word (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
}
} else if (4 == 46) {
document.getElementById('apdflist').value=incv;
document.getElementById('apdfname').value='pdf' + Math.floor(Math.random() * 19897654) + '.pdf';
document.getElementById('thepdf').style.display='block';
document.getElementById('pdfsub').click();
} else if (4 == 47) {
document.getElementById('thepdf').style.display='block';
document.getElementById('thepdf').src=document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(incv) + '&apdfname=' + encodeURIComponent('pdf' + Math.floor(Math.random() * 19897654) + '.pdf');
} else {
pdfzhr = new XMLHttpRequest();
pdfzform = new FormData();
pdfzform.append('apdflist', incv);
pdfzform.append('apdfname', 'pdf' + Math.floor(Math.random() * 19897654) + '.pdf');
pdfzhr.onreadystatechange=statePdfChanged;
pdfzhr.open('post', './one_line_find.php', true);
pdfzhr.send(pdfzform);
}
}
“; ?>
… begging the question, at least for us, being …
What’s the go with …
//pdfzhr.onreadystatechange=noNeedToHangAround;
?
Well, the “A” of Ajax stands for “Asynchronous”, as a useful aspect to Javascript where logic does not have to flow from start to finish linearly, and jobs can multitask. That onreadystatechange idea analyzes what the recipient PHP replies, but in the case of a file cleanup …
it is optional (but preferable) if it happens at all, in the way we roll around here …
and that means as far as file cleanup goes, immediately the interim ascii flat file (used to flesh out the following $_GET[] array work …
<?php
$commentaries=[];
?>
…with hashtagged caption data that made the job too long for $_GET[] based navigation from the start) can be created by our recipient PHP Ajax “called upon” … then …
leaving the $_GET[] pass (we wait back at the client Javascript 5 seconds for via setTimeout logics, while the PHP sleeps much longer) time to avail themselves back up at the server with the use of that interim ascii flat file (while the asynchronous, and not waited upon, Ajax called PHP sleeps … presumably among the lions) … while …
back at the Ajax called PHP, having slept, and the interim file has lost it’s value, it can be deleted … sorrrrrryyyyyyy “interim file”
… as one example of how this “PHP Javascript Ajax Asynchronous Sleep Cleanup” idea set could be implemented.
… output document formats, created via pandoc, with the ability, in pandoc, to tailor slide “captions”, which, until today, had been hardwired to be the image slide filename.
We’ve decided to hashtag such user caption tailoring in hashtag data after the filenames passed over to the recipient PHP (which is the same as the originating PHP in “here’s looking at you” mode of thinking).
So where can the user enter these? The first option …
<?php echo ”
document.getElementById('prefix').innerHTML=document.getElementById('prefix').innerHTML.replace(':','<select ontouchstart=\"thismultiple(this);\" onmouseover=\"thismultiple(this);\" onclick=\"thismultiple(this);\" size=1 id=compsel title=\"Animated slideshow or PDF or PowerPoint or Word via slides possible selecting multiple images here.\" style=display:inline-block;width:28px; data-onblur=process(this); data-multiple><option id=firsttext onclick=addcommentary(); value=\"\">:</option></select>')
“; ?>
… of that relatively new dropdown for this is where we have decided to intervene …
<?php echo ”
var commentaries=[];
function addcommentary() {
needten=1;
var commadd=prompt('Optionally add to commentary. For new lines use ~~ characters. For multiple entries separate by , (ie. two blanks comma two blanks).', '');
if (commadd != null) {
var coms=commadd.split(' , ');
for (var ic=0; ic<coms.length; ic++) {
if (coms[ic].trim() != '') {
commentaries.push('#' + encodeURIComponent(coms[ic]));
}
}
}
}
“; ?>
And so, the “ninth draft”one_line_find.phpDocument Root Relative Folder Listing web application you can “crank up” below, yet again, if you, and your ilk, along with their family and friends, girls and boys, cousins and removalists (to get rid of those pesky second ones), Martians with visas, commentators and audience, townfolk and countryfolk alike, like.
Document Root Relative Folder Listing Links Word Tutorial
The word is, in workplaces all around Earth now, workers are unwrapping their Mars Bars and shaping to use …
Word
… huh?! Isn’t that a coincidence?! Who would have thunk it. They are constructing documents. So that being the case, do you think …
The barsoomian is, in workplaces all around Mars now, martians are unwrapping their Earth Bars and shaping to use …
Word
… to write haikus
? But if not, why not?!
As such, the creation of a “Word assembly” is our “fourth cab off the rank” as an output format offered to users trying out the recent select (ie. dropdown) “assemblies” we PowerPointized yesterday with Document Root Relative Folder Listing Links PowerPoint Tutorial. We use a window.open popup again, latching onto the PHP recipient code …
<?php
$pconvprefix='/bin/';
if (file_exists('/usr/local/bin/pandoc')) {
$pconvprefix='/usr/local/bin/';
} else if (!file_exists('/bin/pandoc')) {
$pconvprefix='';
}
Document Root Relative Folder Listing Links PDF Tutorial
Hopefully, all around the world, the idea of a …
PDF
… display is replacing the “paper hungry” “hardcopy printout” concept. As such, the creation of a “PDF assembly” is our “second cab off the rank” as an output format offered to users trying out the recent select (ie. dropdown) “assemblies” we started yesterday with Document Root Relative Folder Listing Links Assemblies Tutorial. We use a window.open popup again, latching onto the PHP recipient code …
<?php
$thingtoattendto='';
function shutdown() {
global $thingtoattendto;
// This is our shutdown function, in
// here we can do any last operations
// before the script is complete.
if ($thingtoattendto != '') {
sleep(145);
unlink($thingtoattendto);
}
}
$convprefix='/bin/';
if (file_exists('/usr/local/bin/convert')) {
$convprefix='/usr/local/bin/';
} else if (!file_exists('/bin/convert')) {
$convprefix='';
}
display … but we want to move on to the user being able to create their own what we are referring to as …
assemblies
To us, these are user driven (is it widgets) they create by selecting multiple media (today images, but down the line, other combinations) from the left hand table cell’s listing links. We do not ask anymore of that left hand cell’s workings, as it will get too complex, but we have a penchant for adding intelligence to hardcodings, and the hardcoding …
https://www.rjmprogramming.com.au/
… is ripe for the picking, with that “just moseying along there innocently” …
:
… a candidate for a new multiple mode select (ie dropdown) element …
Howevvvvvvvver, just to confuse, there is no onmouseover involved, but the Ajax work does, at least for non-mobile users, sort of, affect display data, in that when hovering over a link, they may see within the title attribute of that link, whatevvvvvvvvver …
yesterday’s Document Root Relative Folder Listing output was placed into a textarea element … clue 1
that textarea element we all admire for it’s textual data line feed talents and it’s talents for resizing capabilities … clue 2
that textarea element textual data is unembellishable (if that is a word) … clue 3
whereas your meek and mild div element, say, could overlay that textarea element, except for the right hand resizer, that is … clue 4
and the div element could latch onto that textarea basis of content and enhance filenames into filename links too (but am not sure about the Singing Glasses idea in the “talent quest section” … that seems a bridge too far) … clue 5
… leaving us clueless as to what else to say … chortle, chortle?!
Also helpful would be, to our minds …
still restrict the file specification to a “buttoned down” setting (because of security concerns) … but …
add complexity to the extension part …
<?php
$extbit='*.[tjpmwag][xpnopaid][etgvf34]*';
?>
…to allow relatively innocent media files and PDFs reach the file listing (tweaked a bit too) now …
<?php
$resis=str_replace($_SERVER['DOCUMENT_ROOT'],'',shell_exec('ls -lhgo ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $offdr . $extbit));
… scours that Document Root folder to find the index.php webpage code to display that Landing Page.
You can “abstract”, and we do also with our Difference Reporting, what that Document Root is as a folder path … bit forlorn we know, as we’ve shown what it is, probably, in many tutorial images … but the thing here is that a URL such as …
… is understood and gets you to our Landing Page as well, because to the public, Document Root is the limit of where they are allowed to surf … if you like Document Root is the left hand beach flag at Surfers Paradise (or perhaps the right hand beach flag in the Todd River … when it gets water, that is?!).
Okay, that’s one theme of today’s new PHP web application. The other we wrote out to ourself was …
One line ls -clt https://www.rjmprogramming.com.au/*.txt via find $_SERVER[‘DOCUMENT_ROOT’] -type d -name ‘*’
… as a presentation idea whereby just the one table row of data is used to present …
https://www.rjmprogramming.com.au/
dropdown of list of folders off Document Root (“abstracting” Document Root itself … ie. relative referencing)
a file specification (minus the path) of interest … we are, for now, locking in as …
*.txt
… as the input data, to the output data that is …
output folder listing (as for Linux and macOS)
The concept of “one table row” for a multiple file listing is a mute point, but in our defence …
the textarea it is presented in (via rows=1) is user resizable
the textarea it is presented in is given a title with line feeds for the whole report so that non-mobile users can see this on hovering over the textarea
This was a PHP project definitely needing the mildly better outcomes of PHP shell_exec (where multiple line outputs are possible) as distinct from exec where only the last output line is returned, but is the usual method we use around here.
Keeping the report to one row also asks for …
use of elements that have CSS styling display:inline; as a default (eg. span element) … or …
user supplying CSS display:inline; or display:inline-block; as applicable … and …
table cell text-align:right; came in handy … as well as …
select element “dynamic shrinker” …
function resizeSelect(sel) { // thanks to https://www.google.com/search?q=make+select+element+width+in+sympathy+with+length+of+its+value&rlz=1C5OZZY_en&oq=make+select+element+width+in+sympathy+with+length+of+its+value&gs_lcrp=EgZjaHJvbWUyBggAEEUYOdIBCTI3MzEzajBqNKgCALACAQ&sourceid=chrome&ie=UTF-8
// 1. Create a temporary span to measure text width
var tempSpan = document.createElement('span');
tempSpan.style.visibility = 'hidden';
tempSpan.style.position = 'absolute';
tempSpan.style.whiteSpace = 'pre';
// 2. Set font styles to match the select box
tempSpan.style.font = window.getComputedStyle(sel).font;
// 3. Set content to selected text
tempSpan.innerText = sel.options[sel.selectedIndex].text;
document.body.appendChild(tempSpan);
// 4. Update width (with extra space for the dropdown arrow)
sel.style.width = (tempSpan.offsetWidth + 30) + 'px';
document.body.removeChild(tempSpan);
}
The recent SVG Emoji Favicon HTML Entities Tutorial had us adding user interaction, but we think especially as far as the input type submit buttons were concerned, lacking style.
Especially on mobile platforms, on occasions without attention, and you add a background colour to your input type submit buttons you can end up with …
too small a button
white font
… double whammy bad scenario, which prompted us to get interested in some CSS …
numerical codepoint definition means to an Emoji definition in terms of web browser tab icon creation capabilities
… shone a light, a “lightbulb moment” for us, in terms of the fact that so many Emojis of interest are actually multiple HTML entity ones (eg. all the national flag emojis are actually made up of four HTML entities) and our initial textbox design of …
<?php echo ”
<input title='Emoji codepoint as web browser tab icon (ie. look up to see after clicking display)' type=number onchange=emnone(); onblur=emnone(); id=codepoint name=codepoint step='1' value='-1' min='-1'></input>
“; ?>
… should be able to become the more savvy (for multiple emojis now possible because of the logics behind the new textbox mentioned below) via this new Javascript …
<?php echo ”
/**
* Convert a string to HTML entities ... thanks to https://stackoverflow.com/questions/18749591/encode-html-entities-in-javascript
*/
String.prototype.toHtmlEntities = function() {
return this.replace(/./gm, function(s) {
// return \"\" + s.charCodeAt(0) + \";\";
return (s.match(/[a-z0-9\s]+/i)) ? s : \"\" + s.charCodeAt(0) + \";\";
});
};
function emnone() {
document.getElementById('anemoji').value='';
}
function cpit(otb) {
if (otb.value != '') {
if (otb.value.toHtmlEntities().indexOf('') != -1) {
} else if (otb.value.toHtmlEntities().indexOf('') != -1) {
document.getElementById('codepoint').type='text';
//alert('' + otb.value.toHtmlEntities().replace(/^\&\#/g,'').replace(/\;$/g,'').replace(/\;\&\#/g,'.'));
document.getElementById('codepoint').value='' + otb.value.toHtmlEntities().replace(/^\&\#/g,'').replace(/\;$/g,'').replace(/\;\&\#/g,'.');
} else {
document.getElementById('codepoint').value='';
for (var jj=0; jj<otb.value.length; jj++) {
if (document.getElementById('codepoint').value == '') {
document.getElementById('codepoint').value='' + otb.value.substring(jj).substring(0,1).charCodeAt();
} else {
document.getElementById('codepoint').type='text';
document.getElementById('codepoint').value+='.' + otb.value.substring(jj).substring(0,1).charCodeAt();
}
}
}
//alert(otb.value.toHtmlEntities());
}
}
“; ?>
… that supplements the web application user interaction possibilities via a new HTML textbox definition …
<?php echo ”
<input type=text placeholder=Emoji onblur=cpit(this); maxlength=4 value='' id=anemoji title='Emoji ... perhaps via control-command-space for macOS or Mac OS X, logo key + . (period) for Windows, control=space for iOS, top left + for Android keyboard ... but please note not all International codes work with XML 1.0'></input>
“; ?>
… and the new intelligence catered for via the more astute PHP …
Basically, we only offered cryptic (ie. address bar) ways the user could control the look of their web browser (but some, like Safari, do not support SVG content based) tab icon via …
codepoint number based emoji SVG icon content … and, as of today, also available to the user in the user input parts to the web application involves the optional use of a …
textarea … default “red hexagon” … based SVG that may work as suitable for a web browser tab icon (ie. not too big)
Is there anything as easy to arrange as the great HTML textarea element as far as “programming code as data” navigational purposes the way the static innerHTML …
… where you can plug just about anything, as is, into, at the onload event, and which can be magically converted into an appropriate textarea value attribute, the contents of which, is encodeURIComponent encrypted by the HTML form element hosting to arrive at the recipient in good condition?
favicon web browser tab icon … SVG type not accepted by all browsers and platforms …
dynamism … and today we start with another offshoot of thought regarding this, as well as …
document.title also showing in the web browser tab icon … universally accepted …
… ideas we wanted to get into by writing a pretty simple generic PHP helper emojiicon.php, we got a great heads up from regarding its logic, thanks, to dynamically create favicon.svg, currently looking like …
… in our nominated folder (so, so far not catering for a lot of online traffic … we’ll see) …
Well, we were re-researching the topic of Favicon (those images on the tabs of your web browser tabs) that we talked about when we presented Gimp Favicon via Logo Primer Tutorial, but we realize now, things have moved on with the web browsers supporting SVG svg+xml “favicons” so much better these days, that we’d better “get with the plan”, so to speak (though it might be better if I give that a rest for a minute).
…
…
…
…
…
…
…
…
…
…
…
…
Okay, minutes up!
With increased usage of SVG svg+xml text element solutions for things around here lately, we wondered whether there was a dynamic way to start using these SVG favicons, in some way. Then we thought of our SVG Clock work. At first we thought a favicon that is a relevant timestamp, but realized the impost on the web server is too big for that, and so we set out to present a local start time of the SVG Clock for a user of this web application. The SVG favicon basis is so simple …
Stick the SVG file in Document Root folder, and replace “11:54” with the relevant timestamp and we’re away, right? Yes, sort of, but there is the little matter of the relevant favicon link statement existing as a non-dynamic call to that SVG in the head section of the webpage.
Bit onerous, huh? But, what did work for us was to have a static starting wrong favicon SVG link (in head) statement that now goes in the parental svg_clock.htmlSVG Network Clock …
… those Page Visibility API ideas you might equate to “minimize” concepts, that originated when GUIs were left to deal with how to present the representation of an application when it is no longer front and center in front of the user as an opened up window. We’d “minimize” back down to the desktop icon or toolbar view of the application. Web browsers can have tabs for this equivalent purpose, and we can improve the usefulness of a web application that can still be useful when “minimized” out of the top viewing tab. Date and time themed web applications can be your more obvious candidate for usefulness here. Just present a form of “digital clock readout” and your web applications like our SVG Network Clock can still be a source of information, even when “minimized”. We think that is an improvement?!
MAMP Timekeeping Web Application Desktop Application Tutorial
We figured that an improvement on the progress with our Timekeeping web application of the recent MAMP Timekeeping Web Application Audio Broadcast Tutorial would be to mention what macOS or Mac OS X Desktop Application is topmost when the screenshot is taken. When thinking about solutions for this, there was not much time before thinking turned to …
Apple Script, which has its GUI Apple “look” … but also …
Apple Script PHP shell_exec and (macOS Terminal) command line accessible osascript command line “look” too
… and excellent resources such as this excellent one to read that made us realize a PHP codeline such as …
<?php
$tma="";
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'script.jxa')) {
// Thanks to https://stackoverflow.com/questions/5292204/macosx-get-foremost-window-title
$scris="var seApp = Application(\"System Events\");
var oProcess = seApp.processes.whose({frontmost: true})[0];
var appName = oProcess.displayedName();
var url;
var title;
switch(appName) {
case \"Safari\":
url = Application(appName).documents[0].url();
title = Application(appName).documents[0].name();
break;
case \"Opera\":
url = Application(appName).windows[0].activeTab().url();
title = Application(appName).windows[0].activeTab().name();
break;
case \"Google Chrome\":
url = Application(appName).windows[0].activeTab().url();
title = Application(appName).windows[0].activeTab().name();
break;
case \"Google Chrome Canary\", \"Chromium\":
url = Application(appName).windows[0].activeTab().url();
title = Application(appName).windows[0].activeTab().name();
break;
default:
title = oProcess.
windows().
find(w => w.attributes.byName(\"AXMain\").value() === true).
attributes.
byName(\"AXTitle\").
value()
}
offer an optional audio broadcasting piece of functionality … presented via a new 📢 (📢) emoji button, that might accompany …
notifications
… when a screenshot is taken. As good as notifications are, it could be that the user is beavering away with their head down at work as the screenshot is taken, but welcome the audio queue that a Timekeeping screenshot has been taken. As well as that, with this new audio broadcasting, the *.aiff audio files created are available to share via email or SMS using the Web Share API interfacing code. This involved changes to …
MAMP Timekeeping Web Application Web Share Personalization Tutorial
Your words, helped out by some computer derived detail data, can help personalize your work using the Quarter Hour Timekeeping web application of yesterday’s MAMP Timekeeping Web Application Web Share API Tutorial which, at least with the Safari browser (and a whole lot of other macOS conditions), now integrates with the Web Share API to attach images to prepared emails with a “body blurb”. It is that prepared “body blurb” we are trying to refine, today, should the user attach any of those Timekeeper screenshot files created via macOS screencapture command.
This is because these screenshot file names, by our convention, are of the format …
screen-yyyymmdd-hhmi.jpg
… within the macOS MAMP‘s $_SERVER[‘DOCUMENT_ROOT’] folder (though the path to the file is unavailable to File API File object programmers).
That, teamed with the fact that individual user comments linked to any one quarter hour screenshot image has an ID attribute of the form …
tatd_yyyymmdd_hhmi
… and you have modified Javascript helping the user to tailor better personalized and detail email or SMS communications using the changedmacos_say_record.js external Javascript via …
var wsadate=new Date();
var lfd=String.fromCharCode(10);
function getwsadate(dd, mm, yyyy, hh, mi) {
wsadate=new Date(yyyy, eval(-1 + eval('' + mm)), dd, hh, mi, 0, 0);
var outdstr=wsadate.toDateString() + ' ' + wsadate.toTimeString();
outdstr=outdstr.replace('Sun ', 'Sunday ').replace('Mon ', 'Monday ').replace('Tue ', 'Tuesday ').replace('Wed ', 'Wednesday ').replace('Thu ', 'Thursday ').replace('Fri ', 'Friday ').replace('Sat ', 'Saturday ');
outdstr=outdstr.replace(':00 ', ' ').replace(' Jan ', ' January ').replace(' Feb ', ' February ').replace(' Mar ', ' March ').replace(' Apr ', ' April ').replace(' Jun ', ' June ').replace(' Jul ', ' July ').replace(' Aug ', ' August ').replace(' Sep ', ' September ').replace(' Oct ', ' October ').replace(' Nov ', ' November ').replace(' Dec ', ' December ');
//console.log('tatd_' + yyyy + mm + dd + '_' + hh + mi);
if (document.getElementById('tatd_' + yyyy + mm + dd + '_' + hh + mi)) {
//console.log('yes tatd_' + yyyy + mm + dd + '_' + hh + mi);
if (document.getElementById('tatd_' + yyyy + mm + dd + '_' + hh + mi).value.trim() != '') {
outdstr+=' ' + String.fromCharCode(10) + '"' + document.getElementById('tatd_' + yyyy + mm + dd + '_' + hh + mi).value + '"';
} else if (document.getElementById('tatd_' + yyyy + mm + dd + '_' + hh + mi).innerHTML.trim() != '') {
outdstr+=' ' + String.fromCharCode(10) + '"' + document.getElementById('tatd_' + yyyy + mm + dd + '_' + hh + mi).innerHTML + '"';
}
}
lfd='';
return outdstr + String.fromCharCode(10);
}
async function atclick() {
const files = document.getElementById('files').files;
var moressi='', ifl=0, lessssi='';
lessssi=moressi;
while (lessssi.indexOf(String.fromCharCode(10)) != -1) {
lessssi=lessssi.replace(String.fromCharCode(10), ' ');
}
// feature detecting navigator.canShare() also implies
// the same for the navigator.share()
if (!navigator.canShare) {
//if (document.URL.indexOf('localhost') != -1) { alert('Can not share'); }
document.getElementById('output').textContent = `Your browser doesn't support the Web Share API.`;
return;
//} else {
//if (document.URL.indexOf('localhost') != -1) { alert('Can Share'); }
}
if (navigator.canShare({ files })) {
try {
console.log('Can share');
await navigator.share({
files,
title: 'Timekeeping screenshots' + lessssi + ' or media or documents',
text: 'Timekeeping screenshots' + moressi + ' perhaps?! Take a look at media or documents below' + String.fromCharCode(10) + String.fromCharCode(10)
});
document.getElementById('output').textContent = 'Shared!';
} catch (error) {
document.getElementById('output').textContent = `Error: ${error.message}`;
}
} else {
//if (document.URL.indexOf('localhost') != -1) { alert('Cannot share'); }
document.getElementById('output').textContent = `Your system doesn't support sharing these files.`;
}
lfd=String.fromCharCode(10);
}
the changed HTML and Javascriptquarter_hour_timer.html (we still ask you to download to MAMP‘s $_SERVER[‘DOCUMENT_ROOT’] “HTMLCSS” subfolder) Web Application supervisor …
<script type='text/javascript' src='//www.rjmprogramming.com.au/web_share_api_test.js?populate=as_necessary' defer></script>
… nicely
… but as we’ve warned before you may need all these for total success for the Timekeeping Quarter Hour Timer web application (that can screenshot, can create notification when screenshot taken, and have audio commentary, and share screenshot image(s) or Timekeeper URL) …
… sitting up at the Document Root of your public domain, that “?ongoing=” based $_GET[‘ongoing’] argument deliberate, effectively asking the code to look out for “on the fly” HTML elements created within an execution run of the webpage.
<script type='text/javascript'>
var commentary_array=['textarea', 'You can enter comments about this screenshot here %value%outerHTML%@yyyymmdd%hhmm%.', 'img', 'Timekeeper screenshot here %id%@yyyymmdd%hhmm%.'];
</script>
… where the first field describes an HTML element attribute to first look at, the optional second is a stand by attribute, followed by “date extraction” fields to match with numerical data found so as to substitute the blue parts with a “date and timestamp” string.
not necessarily frontmost … but benefitting from any …
notification reminders separate from web activities and webpage focus issues can help tell the user when they might want to turn back attention to the timekeeping screenshot recording
This needs PHP to work and it needs real access via PHP exec function to underlying operating system commands. When this happens, we still try to offer a public RJM Programming interface but this interface is far less useful if you have not downloaded to your local Apache/PHP/MySql local web server (such as a MAMP one) as per …
settle for mobile platforms never being able to screenshot, on this round of looking, and redirecting to the “Monthly Chronicler” web application (of (the unchanged) monthly_chronicler.html we ask you to download to MAMP‘s $_SERVER[‘DOCUMENT_ROOT’] “HTMLCSS” subfolder) …
<script>
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPod|iPad|Opera Mini|IEMobile/i)) {
document.write("<scri" + "pt> location.href='./monthly_chronicler.html'; </scr" + "ipt> <style> a.adate { border:1px solid green; background-color:#f0f0f0; border-radius:50px; } </style> <table id=mtable style=display:none;width:95%;><tr><th><input style=width:450px; placeholder='' id=iask type=text value=''></input><</th><th><input onclick=\" document.getElementById('mtable').style.display='none'; document.getElementById('mybod').style.opacity='1.0'; postask(document.getElementById('iask'));\" type=button value=OK></input></th><th><input onclick=\"document.getElementById('iask').value=''; document.getElementById('mtable').style.display='none'; document.getElementById('mybod').style.opacity='1.0'; \" type=button value=Cancel></input></th></tr></table>");
}
</script>
… dumbing down, but working more reliably, using “Javascript writes Javascript” methodology
Again, feel free to try the changedquarter_hour_timer.html (we ask you to download to MAMP‘s $_SERVER[‘DOCUMENT_ROOT’] “HTMLCSS” subfolder) Timekeeping Web Application suited to macOS (or Mac OS X) “screencapture” command line usage, is helped out by a “mobile platform check” changedquarter_hour_timer.php PHP (we ask you to download to MAMP‘s $_SERVER[‘DOCUMENT_ROOT’] “HTMLCSS” subfolder) for you to try out on your MAMP macOS environment, or all showing up at an RJM Programming public domain webpage, in an iframe element, visible now.
… which you may glean has a Windows “fallback” position (with that “copy” codeline). Why? Well, we found a .Net framework “exe creation via bat” using ScreenCapture.bat (thanks to this useful link) created black screen shots. Probably a privilege thing or PHP exec thing, but we’ve opted for the workaround, which is just “Windows talk” …
write Windows batch scapcontinuous.bat as a continuous fifteen minute user of the .Net Framework (ScreenCapture.exe) derived from above
set up a task via “Task Schedular” (please ignore the warts ‘n all “garden path” schtask ideas in the video below) that has an action “C:\MAMP\htdocs\scapcontinuous.bat” and starts when the Windows user logs in and takes (successful) screen shots at 14 and 29 and 44 and 59 minutes (in the hour) times
Take a more detailed look at “warts ‘n all” crab progression towards the Windows (client) solution, below …
This bit of functionality works (interfacing) both with MAMP and with the public RJM Programming domain incarnation of the Timekeeping web application, so that could be interesting. It can interface via …
… modes of use. In action, should you create an iCal file this way, the web application will download the resultant .ics file into your Downloads folder and to interface into your default online Calendar application double click that Downloads folder file to complete the Calendar integration …
function icalpostit(tl, tg) {
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
var hh = today.getHours();
var minm = today.getMinutes(); //January is 0!
//if (icalavailable) { alert('is ' + ('' + yyyy + ('00' + mm).slice(-2) + ('00' + dd).slice(-2) ) + ' >= ' + tl.substring(1)); }
if ((document.getElementById('yics').value.indexOf('all') != -1 || tl.substring(1) >= ('' + yyyy + ('00' + mm).slice(-2) + ('00' + dd).slice(-2) )) && icalavailable && document.getElementById('yics').value != '') {
if (document.getElementById('yics').value.indexOf('nw') != -1) {
icald=tl.substring(1) + ':' + ('00' + hh).slice(-2) + ('00' + minm).slice(-2) + '59';
icalg=tg;
if (icalwo != null) { icalwo.close(); icalwo=null; }
icalwo=window.open('../PHP/ics_attachment.php','_blank','top=100,left=100,width=740,height=800');
if (1 == 1) {
setTimeout(icalw, 3000);
} else {
icalwo.document.getElementById('datestart').value=icald;
icalwo.document.getElementById('dateend').value=icald;
icalwo.document.getElementById('eventwords').value=icalg.replace(/\<br\>/g, String.fromCharCode(10)).replace(/\<Br\>/g, String.fromCharCode(10)).replace(/\<BR\>/g, String.fromCharCode(10));
if (document.URL.indexOf('localhost') != -1) {
var jcald=icalg.replace(/\<br\>/g, String.fromCharCode(10)).replace(/\<Br\>/g, String.fromCharCode(10)).replace(/\<BR\>/g, String.fromCharCode(10)).replace(/\ \;>/g, ' ');
while (jcald.indexOf(String.fromCharCode(10)) != -1) { jcald=jcald.replace(String.fromCharCode(10),' '); }
icalwo.document.getElementById('title').value=jcald;
} else {
icalwo.document.getElementById('title').value='Calendar event at ' + icald;
}
icalwo.document.getElementById('description').value='Calendar event at ' + icald;
icalwo.document.getElementById('address').value=document.URL.split('?')[0].split('#')[0];
icalwo.document.getElementById('mmdatestart').value=icald.substring(4,6);
icalwo.document.getElementById('mmdateend').value=icald.substring(4,6);
icalwo.document.getElementById('dddatestart').value=icald.substring(6,8);
icalwo.document.getElementById('dddateend').value=icald.substring(6,8);
icalwo.document.getElementById('ssdatestart').value='59';
icalwo.document.getElementById('ssdateend').value='59';
icalwo.document.getElementById('yyyydatestart').value=icald.substring(0,4);
icalwo.document.getElementById('yyyydateend').value=icald.substring(0,4);
if ( ('' + today.getTimezoneOffset()).replace('null','').replace('undefined','') != '' ) {
//alert(('' + eval(eval('' + qd.getTimezoneOffset()) / 60.0)).replace('.00','').replace('.0',''));
icalwo.document.getElementById('tz').value=('' + eval(eval('' + today.getTimezoneOffset()) / 60.0)).replace('.00','').replace('.0','');
}
//icalwo.document.getElementById('pform').onsubmit=function() { window.opener.document.getElementById('icalstatus').innerHTML=' '; return true; };
Mac OS MAMP Timekeeping Web Application PHP Calendar Contenteditable Tutorial
We’ve spoken quite a bit in the past about the joys of involving the “contenteditable=true” attribute for HTML elements that have an “innerHTML” (ie. they have a formalized end tag arrangement eg. div, span, p, td, th etcetera) and with today’s work which extends that started with yesterday’s Mac OS MAMP Timekeeping Web Application PHP Calendar Past Tutorial it is the turn of a set of “p” elements it helps out today.
The scenario is that yesterday’s work did not allow for “orphaned screenshots” of the past be allowed to be brought back into play to “annotate them” and in so doing “give them a home”. This led us to …
allow for a new “Infill Earlier Days All Screenshots” button augment yesterday‘s “Infill Earlier Days Just Annotated Screenshots” button …
the pressing of that new “Infill Earlier Days All Screenshots” button causes all screenshot 15 minute entries relevant to the current year be displayed in the calendar … but then it occurred to us users might want to “annotate them” … but how? …
in the PHP we introduced code …
<?php
if (isset($_GET['yourta'])) {
$dru="http://" . $_SERVER['SERVER_NAME'] . "" . str_replace("~","",str_replace(":443~","",str_replace(":80~","",(":" . $_SERVER['SERVER_PORT'] . "~")))) . "/";
$cet="";
if (strlen($_GET['yourta']) != 0) { $cet=" contenteditable=true onblur=repostit(this); onfocus=wopen(event,false); "; }
// blah blah blah
$ccpre="
?>
… to, when an “orphaned” screen shot image is happened upon, allows …
contenteditable=true “does its stuff” turning might might have been a pretty unintelligent HTML element into a “textarea” type collector of user input, and then that onblur event logic’s “midair feeling” Ajax/FormData “recursive feeling” methodology …
function repostit(ih) {
var ihis=(ih.innerText || ih.contentWindow || ih.contentDocument);
var pathpart=ih.id;
if (ihis != '') {
var xzhr = new XMLHttpRequest();
var xform=new FormData();
xform.append('myta',ihis);
xform.append(pathpart.split('.')[0].replace('ip_','screen-').replace('_','-'),'');
xzhr.open('post','./quarter_hour_timer.php',true);
xzhr.send(xform);
}
}
… which can cement that (newly user entered) annotation into future permanency in the “Yearly Report Calendar” section
… feel to it all. Today, we improve on the latter “restrictiveness” issue, within yesterday’s “Yearly Report Calendar” new functionality, by looking back into the current calendar year’s “past” with respect to the date of using the web application, whether that be …
screen captures from days in the current calendar year’s “past”
text entries made and remembered (in window.localStorage) in the current calendar year’s “past”
if ($bcontis != "''" && $bcontis != "") {
if ($htmlis == '') {
$htmlis="<html><head><script type=text/javascript> var imois=null, iwo=null; function wopen(event,overvsout) { if (!overvsout) { if (imois == event.target) { imois=null; } return; } imois=event.target; setTimeout(postwopen, 2000); } function postwopen() { var pois=imois; if (pois.outerHTML.indexOf('URL(') != -1) { window.open(pois.outerHTML.split('URL(')[1].split(')')[0].replace(String.fromCharCode(34),'').replace(String.fromCharCode(34),''),'_blank','top=50,left=50,width=600,height=600'); } }</script></head><body onload=\" var huhg=''; if (parent.document.getElementById('" . $idcali . "')) { huhg='" . $ccpre . $bcontis . $ccpost . "'; while (huhg.indexOf(String.fromCharCode(10)) != -1) { huhg=huhg.replace(String.fromCharCode(10),'<br>'); } parent.document.getElementById('" . $idcali . "').innerHTML+=huhg; } \"></body></html>";
} else if (strpos($htmlis, $bcontis) === false) {
$htmlis=str_replace("+=huhg; }", "+=huhg; huhg='" . $ccpre . $bcontis . $ccpost . "'; while (huhg.indexOf(String.fromCharCode(10)) != -1) { huhg=huhg.replace(String.fromCharCode(10),'<br>'); } parent.document.getElementById('" . $idcali . "').innerHTML+=huhg; }", $htmlis);
}
}
}
}
if ($htmlis != "") { echo $htmlis; }
}
}
}
}
}
}
// blah else if blah else if blah
?>
… which you may notice implements a “long hover” window.open scenario (using non-mobile platforms) for screenshot images on the calendar by combining the use of …
global variables …
var imois=null;
var iwo=null;
onmouseover event logic …
Call
onmouseover=wopen(event,true);
setTimeout delays …
Called
function wopen(event,overvsout) {
if (!overvsout) {
if (imois == event.target) {
imois=null;
}
return;
}
imois=event.target;
setTimeout(postwopen, 2000);
}
function postwopen() { //pois) {
if (imois) {
var pois=imois;
if (pois.outerHTML.indexOf('URL(') != -1) {
if (iwo) { iwo.close(); iwo=null; }
iwo = window.open(pois.outerHTML.split('URL(')[1].split(')')[0].replace(String.fromCharCode(34), '').replace(String.fromCharCode(34), ''), '_blank', 'top=50,left=50,width=600,height=600');
}
}
}
onmouseout event logic …
Call
onmouseout=wopen(event,false);
… so that this logic is not responsible for clobbering the default “hover” shows of the “p” element “title” attribute with the onmouseover event for non-mobile platforms.
Mac OS MAMP Timekeeping Web Application PHP Image Metadata Tutorial
In our opinion, what would make the day before yesterday’s Mac OS MAMP Timekeeping Web Application PHP Intranet Tutorial “Timekeeping Web Application” cooler would be to add to the intelligence of the screen capture images, ahead of other data related improvements to come.
We’ve spoken in the past about Exif in that respect but PHP has Iptc image metadata functions we can call on …
iptcembed to embed new metadata into an existant image from those associated “caption” textarea elements we offer
iptcparse to extract old metadata from an existant image into those associated “caption” textarea elements we offer
This metadata can be like a database source we use moving forward on this project, meaning the one image data entity can suffice for both visual and textual usage purposes.
Mac OS X MAMP Timekeeping Web Application Email Tutorial
The practicalities of yesterday’s (Mac OS X MAMP Timekeeping Web Application Primer Tutorial) timekeeping Mac OS X Web Application, left as they are, would leave you with a somewhat useful web application whose use is only for the here and now, but what if you want it to be more accountable? Well, that is when we, here, at RJM Programming, like to use that tried and trusted email form of communication.
Today’s email methods spurn the use of server-side intervention, at least for now. So what is available to us as tools, if we don’t include Ajax nor jQuery in that list? Well, we have, to our minds …
the body section of that email can have a clipboard image pasted into it, for which we can utilize HTML5 canvas element’s toDataURL() method, teamed up with a window.open popup window of the toDataURL image data, which can be selected and copied, optionally, by the user themselves, should they wish this to make their email more self explanatory
We rely on the crontab functionality, being as there is no server-side help, to create the image file, whose contents eventually go to make up the contents that can be selected and copied and pasted by the user into the body section of the email (and sent off to whosoever they feel like sending it too, as you have the full power of the email client available to you with the interaction you have with an actual email client program).
Here is the HTML and Javascript quarter_hour_timer.html which changed to cater for today’s email functionality in this way, and, as per the Stop Press from yesterday, we’ll also have a live run link here today.
Mac OS X MAMP Timekeeping Web Application Primer Tutorial
Sometimes when you program, especially for administrative type functionality, there are useful programs to write, that are able to become web applications, but in a limited set of platforms. So it is today with our timekeeping web application that relies on …
MAMP installed to, in our case, /Applications/MAMP/htdocs/ (as is mentioned in the relevant crontab background task that snapshots the user’s screen every quarter hour) that maps to the MAMP web application URL http://localhost:8888/ … or …
crontab directory mention that corresponds to a URL call of our web application like for our Google Chrome example (where the directory below, used, could be a place of your choosing (that matches what is in your crontab task entry)) …
file:///Applications/MAMP/htdocs/quarter_hour_timer.html?localplace=
… or just, via the web browser’s File -> Open File menu …
file:///Applications/MAMP/htdocs/quarter_hour_timer.html
… pretty restrictive, huh? … but pretty useful for our quarter hour timekeeping purposes today.
We want to have a web application that is running at the user’s discretion, and when first fired up, looks for outputs from crontab tasks above …
… for the current day in question and if existant show …
a date and time stamp +
the snapshot of what you were doing at the quarter hour, that is clickable to make bigger for more in depth viewing +
an HTML textarea element in which you can optionally type in more specifics about that quarter hour
So, as much as we like to think of Mac OS X Terminal application’s BSD (a unix derivative) operating system, as being a lot like Linux, there are some commands and usage that …
adds Mac OS X specific command line functionality to a Linux or unix base set of functionality, like for today’s screencapture command … and we’ve included another such example, below, with the command say featuring in Mac OS X Text to English Speech Primer Tutorial as shown below
changes switches on Linux or unix commands
won’t have some Linux or unix commands that other platforms do
In the great tradition of behoving … we behove … we behove thee quarter_hour_timer.html if you like, my liege. On this occasion you’ll have gleaned that there is no live run link, because the RJM Programming web server is not Mac OS X … so command line screencapture has no meaning for a CentOS web server’s operating system command line. You’ll see in the code that rather than use “Client Pre-emptive Iframe” concepts to check for existence of crontab screen capture images, we, instead use the onerror event for HTML img elements to check for non-existance.
Stop Press
Just noticed that, perhaps, after all, a live run from the RJM Programming website can make sense if you have a Mac OS X laptop, for instance, that is running that suggested crontab entry as explained in tutorial above. That type of live run managed to latch on to our local crontab screencaptures on my MacBook Pro.
Text to English Speech via Mac OS X’s command line say command used by PHP via exec to make say.php (which is useful as a download to a Mac OS X laptop using MAMP) which, today, does not have a live run because the web server of domain rjmprogramming.com.au is a CentOS Linux server … Linux equivalent of Mac OS X’s say? … read here
Trying to present this brought up the usual movie production problem with iMovie overlaying the audio on top of the video (though you may want to try, and you could start reading with this link) versus QuickTime Player talent to catch both audio and video tracks (and that we ended up using), but not of the “screen goings on”, alas versus MPlayer OSX Extended which can play separately but not two tracks on top and doesn’t do any reconstituting … so …
Improved on our inhouse Video/Audio synchronizing efforts by allowing audio_video.html supervisor (changed in this way) be able to be called to press one of its preconceived synchronization buttons onload which we do with (the newly added) Macbeth Act 1 Scene 1 … in a small celebration of the Bard … who, am thinking (in that Falstaff way), would have got a huge chuckle out of “anonymous” instead of “anon” during the Three Witches scene … we had to do something to say Happy Birthday
Along the way we tried filming the MacBook Pro with the iPad to a YouTube …
… but weren’t happy with the audio quality, alas (too/two).
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
we open within a popup window in Google Chrome (via selected slides) …
the recipient PHP constructs the wherewithal to construct Video *.mp4 data via (exec called) … ffmpeg -f concat -safe 0 -i list.txt -r 25 -pix_fmt yuv420p output.mp4
is able to display the Video (as a video/mp4 mimetype data) arrangement
… means by which we can offer a Video “assembly” now in the “eleventh draft”one_line_find.phpDocument Root Relative Folder Listing web application you can “crank up” below, yet again, if you, and your ilk, along with their family and friends, girls and boys, cousins and removalists (to get rid of those pesky second ones), Martians with visas, commentators and audience, filibusters and crime busters and ghost busters, attendees and abstainers, townfolk and countryfolk alike, like.
we open within a popup window in Google Chrome (via selected slides) …
the recipient PHP constructs the wherewithal to construct Animated GIF *.gif data via (exec called) … convert -delay 1000 -loop 0 [space delimited list of image filenames] output.gif
is able to display the Animated GIF (as an image/gif mimetype data) arrangement
… means by which we can offer an Animated GIF “assembly” now in the “tenth draft”one_line_find.phpDocument Root Relative Folder Listing web application you can “crank up” below, yet again, if you, and your ilk, along with their family and friends, girls and boys, cousins and removalists (to get rid of those pesky second ones), Martians with visas, commentators and audience, filibusters and crime busters, townfolk and countryfolk alike, like.
… issues where in the past we may have resorted to a …
crontab (and maybe curl) means to a solution … but we prefer, where possible …
there and then procedures within the PHP (ie. it has to be PHP to help) … as much as anything, because that way, all the parts to any solution, are self contained
… and for security purposes that PHP solution is best done using a form method=POST methodology, or, as we are sprouting here today (and we like a lot, and think it could help us out later with other such scenarios) … and our apologies for the tautology …
PHP Javascript Ajax Asynchronous Sleep Cleanup
… thinking we start explaining at the changed Javascript Ajax (to the original block of code) as per …
<?php echo ”
var gincv='', ganidn='';
function ajaxpdfit(incv) {
if (4 == 4) {
var anidn='' + incv.replace(/\\\\/g,'/').split(',')[0].split('/')[eval(-1 + incv.replace(/\\\\/g,'/').split(',')[0].split('/').length)].split('.')[0] + '_et-al_' + incv.split(',').length; // + '.pdf';
if (pdfwoo) {
if (!pdfwoo.closed) { pdfwoo.close(); pdfwoo=null; } else { pdfwoo.close(); pdfwoo=null; }
}
if (pptxwoo) {
if (!pptxwoo.closed) { pptxwoo.close(); pptxwoo=null; } else { pptxwoo.close(); pptxwoo=null; }
}
if (mswoo) {
if (!mswoo.closed) { mswoo.close(); mswoo=null; } else { mswoo.close(); mswoo=null; }
}
//incv=incv.replace(/\~\~/g, String.fromCharCode(92) + String.fromCharCode(10)); // new idea
if (('' + document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(incv) + '&apdfname=' + encodeURIComponent(anidn + '.pdf')).length > 800) { pdfzhr = new XMLHttpRequest();
pdfzform = new FormData();
pdfzform.append('anidnlist', incv);
pdfzform.append('anidn', anidn + '.abc');
//pdfzhr.onreadystatechange=noNeedToHangAround;
pdfzhr.open('post', './one_line_find.php', true);
pdfzhr.send(pdfzform);
ganidn=anidn;
gincv=noh(incv); // strips out any hashtagged caption data
setTimeout(function(){
pdfwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(gincv) + '&apdfname=' + encodeURIComponent(ganidn + '.pdf'),'_blank','top=20,left=' + eval(-700 + screen.width) + ',width=700,height=700');
pdfwoo.document.title='PDF (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
pptxwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?applist=' + encodeURIComponent(gincv) + '&appname=' + encodeURIComponent(ganidn + '.pptx'),'_blank','top=' + eval(-400 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
pptxwoo.document.title='PowerPoint (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
mswoo=window.open(document.URL.split('?')[0].split('#')[0] + '?amslist=' + encodeURIComponent(gincv) + '&amsname=' + encodeURIComponent(ganidn + '.docx'),'_blank','top=' + eval(-200 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
mswoo.document.title='Word (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
}, 5000);
} else {
pdfwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(incv) + '&apdfname=' + encodeURIComponent(anidn + '.pdf'),'_blank','top=20,left=' + eval(-700 + screen.width) + ',width=700,height=700');
pdfwoo.document.title='PDF (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
pptxwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?applist=' + encodeURIComponent(incv) + '&appname=' + encodeURIComponent(anidn + '.pptx'),'_blank','top=' + eval(-400 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
pptxwoo.document.title='PowerPoint (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
mswoo=window.open(document.URL.split('?')[0].split('#')[0] + '?amslist=' + encodeURIComponent(incv) + '&amsname=' + encodeURIComponent(anidn + '.docx'),'_blank','top=' + eval(-200 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
mswoo.document.title='Word (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
}
} else if (4 == 46) {
document.getElementById('apdflist').value=incv;
document.getElementById('apdfname').value='pdf' + Math.floor(Math.random() * 19897654) + '.pdf';
document.getElementById('thepdf').style.display='block';
document.getElementById('pdfsub').click();
} else if (4 == 47) {
document.getElementById('thepdf').style.display='block';
document.getElementById('thepdf').src=document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(incv) + '&apdfname=' + encodeURIComponent('pdf' + Math.floor(Math.random() * 19897654) + '.pdf');
} else {
pdfzhr = new XMLHttpRequest();
pdfzform = new FormData();
pdfzform.append('apdflist', incv);
pdfzform.append('apdfname', 'pdf' + Math.floor(Math.random() * 19897654) + '.pdf');
pdfzhr.onreadystatechange=statePdfChanged;
pdfzhr.open('post', './one_line_find.php', true);
pdfzhr.send(pdfzform);
}
}
“; ?>
… begging the question, at least for us, being …
What’s the go with …
//pdfzhr.onreadystatechange=noNeedToHangAround;
?
Well, the “A” of Ajax stands for “Asynchronous”, as a useful aspect to Javascript where logic does not have to flow from start to finish linearly, and jobs can multitask. That onreadystatechange idea analyzes what the recipient PHP replies, but in the case of a file cleanup …
it is optional (but preferable) if it happens at all, in the way we roll around here …
and that means as far as file cleanup goes, immediately the interim ascii flat file (used to flesh out the following $_GET[] array work …
<?php
$commentaries=[];
?>
…with hashtagged caption data that made the job too long for $_GET[] based navigation from the start) can be created by our recipient PHP Ajax “called upon” … then …
leaving the $_GET[] pass (we wait back at the client Javascript 5 seconds for via setTimeout logics, while the PHP sleeps much longer) time to avail themselves back up at the server with the use of that interim ascii flat file (while the asynchronous, and not waited upon, Ajax called PHP sleeps … presumably among the lions) … while …
back at the Ajax called PHP, having slept, and the interim file has lost it’s value, it can be deleted … sorrrrrryyyyyyy “interim file”
… as one example of how this “PHP Javascript Ajax Asynchronous Sleep Cleanup” idea set could be implemented.
… output document formats, created via pandoc, with the ability, in pandoc, to tailor slide “captions”, which, until today, had been hardwired to be the image slide filename.
We’ve decided to hashtag such user caption tailoring in hashtag data after the filenames passed over to the recipient PHP (which is the same as the originating PHP in “here’s looking at you” mode of thinking).
So where can the user enter these? The first option …
<?php echo ”
document.getElementById('prefix').innerHTML=document.getElementById('prefix').innerHTML.replace(':','<select ontouchstart=\"thismultiple(this);\" onmouseover=\"thismultiple(this);\" onclick=\"thismultiple(this);\" size=1 id=compsel title=\"Animated slideshow or PDF or PowerPoint or Word via slides possible selecting multiple images here.\" style=display:inline-block;width:28px; data-onblur=process(this); data-multiple><option id=firsttext onclick=addcommentary(); value=\"\">:</option></select>')
“; ?>
… of that relatively new dropdown for this is where we have decided to intervene …
<?php echo ”
var commentaries=[];
function addcommentary() {
needten=1;
var commadd=prompt('Optionally add to commentary. For new lines use ~~ characters. For multiple entries separate by , (ie. two blanks comma two blanks).', '');
if (commadd != null) {
var coms=commadd.split(' , ');
for (var ic=0; ic<coms.length; ic++) {
if (coms[ic].trim() != '') {
commentaries.push('#' + encodeURIComponent(coms[ic]));
}
}
}
}
“; ?>
And so, the “ninth draft”one_line_find.phpDocument Root Relative Folder Listing web application you can “crank up” below, yet again, if you, and your ilk, along with their family and friends, girls and boys, cousins and removalists (to get rid of those pesky second ones), Martians with visas, commentators and audience, townfolk and countryfolk alike, like.
Document Root Relative Folder Listing Links Word Tutorial
The word is, in workplaces all around Earth now, workers are unwrapping their Mars Bars and shaping to use …
Word
… huh?! Isn’t that a coincidence?! Who would have thunk it. They are constructing documents. So that being the case, do you think …
The barsoomian is, in workplaces all around Mars now, martians are unwrapping their Earth Bars and shaping to use …
Word
… to write haikus
? But if not, why not?!
As such, the creation of a “Word assembly” is our “fourth cab off the rank” as an output format offered to users trying out the recent select (ie. dropdown) “assemblies” we PowerPointized yesterday with Document Root Relative Folder Listing Links PowerPoint Tutorial. We use a window.open popup again, latching onto the PHP recipient code …
<?php
$pconvprefix='/bin/';
if (file_exists('/usr/local/bin/pandoc')) {
$pconvprefix='/usr/local/bin/';
} else if (!file_exists('/bin/pandoc')) {
$pconvprefix='';
}
Document Root Relative Folder Listing Links PDF Tutorial
Hopefully, all around the world, the idea of a …
PDF
… display is replacing the “paper hungry” “hardcopy printout” concept. As such, the creation of a “PDF assembly” is our “second cab off the rank” as an output format offered to users trying out the recent select (ie. dropdown) “assemblies” we started yesterday with Document Root Relative Folder Listing Links Assemblies Tutorial. We use a window.open popup again, latching onto the PHP recipient code …
<?php
$thingtoattendto='';
function shutdown() {
global $thingtoattendto;
// This is our shutdown function, in
// here we can do any last operations
// before the script is complete.
if ($thingtoattendto != '') {
sleep(145);
unlink($thingtoattendto);
}
}
$convprefix='/bin/';
if (file_exists('/usr/local/bin/convert')) {
$convprefix='/usr/local/bin/';
} else if (!file_exists('/bin/convert')) {
$convprefix='';
}
display … but we want to move on to the user being able to create their own what we are referring to as …
assemblies
To us, these are user driven (is it widgets) they create by selecting multiple media (today images, but down the line, other combinations) from the left hand table cell’s listing links. We do not ask anymore of that left hand cell’s workings, as it will get too complex, but we have a penchant for adding intelligence to hardcodings, and the hardcoding …
https://www.rjmprogramming.com.au/
… is ripe for the picking, with that “just moseying along there innocently” …
:
… a candidate for a new multiple mode select (ie dropdown) element …
Howevvvvvvvver, just to confuse, there is no onmouseover involved, but the Ajax work does, at least for non-mobile users, sort of, affect display data, in that when hovering over a link, they may see within the title attribute of that link, whatevvvvvvvvver …
yesterday’s Document Root Relative Folder Listing output was placed into a textarea element … clue 1
that textarea element we all admire for it’s textual data line feed talents and it’s talents for resizing capabilities … clue 2
that textarea element textual data is unembellishable (if that is a word) … clue 3
whereas your meek and mild div element, say, could overlay that textarea element, except for the right hand resizer, that is … clue 4
and the div element could latch onto that textarea basis of content and enhance filenames into filename links too (but am not sure about the Singing Glasses idea in the “talent quest section” … that seems a bridge too far) … clue 5
… leaving us clueless as to what else to say … chortle, chortle?!
Also helpful would be, to our minds …
still restrict the file specification to a “buttoned down” setting (because of security concerns) … but …
add complexity to the extension part …
<?php
$extbit='*.[tjpmwag][xpnopaid][etgvf34]*';
?>
…to allow relatively innocent media files and PDFs reach the file listing (tweaked a bit too) now …
<?php
$resis=str_replace($_SERVER['DOCUMENT_ROOT'],'',shell_exec('ls -lhgo ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $offdr . $extbit));
… scours that Document Root folder to find the index.php webpage code to display that Landing Page.
You can “abstract”, and we do also with our Difference Reporting, what that Document Root is as a folder path … bit forlorn we know, as we’ve shown what it is, probably, in many tutorial images … but the thing here is that a URL such as …
… is understood and gets you to our Landing Page as well, because to the public, Document Root is the limit of where they are allowed to surf … if you like Document Root is the left hand beach flag at Surfers Paradise (or perhaps the right hand beach flag in the Todd River … when it gets water, that is?!).
Okay, that’s one theme of today’s new PHP web application. The other we wrote out to ourself was …
One line ls -clt https://www.rjmprogramming.com.au/*.txt via find $_SERVER[‘DOCUMENT_ROOT’] -type d -name ‘*’
… as a presentation idea whereby just the one table row of data is used to present …
https://www.rjmprogramming.com.au/
dropdown of list of folders off Document Root (“abstracting” Document Root itself … ie. relative referencing)
a file specification (minus the path) of interest … we are, for now, locking in as …
*.txt
… as the input data, to the output data that is …
output folder listing (as for Linux and macOS)
The concept of “one table row” for a multiple file listing is a mute point, but in our defence …
the textarea it is presented in (via rows=1) is user resizable
the textarea it is presented in is given a title with line feeds for the whole report so that non-mobile users can see this on hovering over the textarea
This was a PHP project definitely needing the mildly better outcomes of PHP shell_exec (where multiple line outputs are possible) as distinct from exec where only the last output line is returned, but is the usual method we use around here.
Keeping the report to one row also asks for …
use of elements that have CSS styling display:inline; as a default (eg. span element) … or …
user supplying CSS display:inline; or display:inline-block; as applicable … and …
table cell text-align:right; came in handy … as well as …
select element “dynamic shrinker” …
function resizeSelect(sel) { // thanks to https://www.google.com/search?q=make+select+element+width+in+sympathy+with+length+of+its+value&rlz=1C5OZZY_en&oq=make+select+element+width+in+sympathy+with+length+of+its+value&gs_lcrp=EgZjaHJvbWUyBggAEEUYOdIBCTI3MzEzajBqNKgCALACAQ&sourceid=chrome&ie=UTF-8
// 1. Create a temporary span to measure text width
var tempSpan = document.createElement('span');
tempSpan.style.visibility = 'hidden';
tempSpan.style.position = 'absolute';
tempSpan.style.whiteSpace = 'pre';
// 2. Set font styles to match the select box
tempSpan.style.font = window.getComputedStyle(sel).font;
// 3. Set content to selected text
tempSpan.innerText = sel.options[sel.selectedIndex].text;
document.body.appendChild(tempSpan);
// 4. Update width (with extra space for the dropdown arrow)
sel.style.width = (tempSpan.offsetWidth + 30) + 'px';
document.body.removeChild(tempSpan);
}
we open within a popup window in Google Chrome (via selected slides) …
the recipient PHP constructs the wherewithal to construct Animated GIF *.gif data via (exec called) … convert -delay 1000 -loop 0 [space limited list of image filenames] output.gif
is able to display the Animated GIF (as an image/gif mimetype data) arrangement
… means by which we can offer an Animated GIF “assembly” now in the “tenth draft”one_line_find.phpDocument Root Relative Folder Listing web application you can “crank up” below, yet again, if you, and your ilk, along with their family and friends, girls and boys, cousins and removalists (to get rid of those pesky second ones), Martians with visas, commentators and audience, filibusters and crime busters and ghost busters, townfolk and countryfolk alike, like.
… issues where in the past we may have resorted to a …
crontab (and maybe curl) means to a solution … but we prefer, where possible …
there and then procedures within the PHP (ie. it has to be PHP to help) … as much as anything, because that way, all the parts to any solution, are self contained
… and for security purposes that PHP solution is best done using a form method=POST methodology, or, as we are sprouting here today (and we like a lot, and think it could help us out later with other such scenarios) … and our apologies for the tautology …
PHP Javascript Ajax Asynchronous Sleep Cleanup
… thinking we start explaining at the changed Javascript Ajax (to the original block of code) as per …
<?php echo ”
var gincv='', ganidn='';
function ajaxpdfit(incv) {
if (4 == 4) {
var anidn='' + incv.replace(/\\\\/g,'/').split(',')[0].split('/')[eval(-1 + incv.replace(/\\\\/g,'/').split(',')[0].split('/').length)].split('.')[0] + '_et-al_' + incv.split(',').length; // + '.pdf';
if (pdfwoo) {
if (!pdfwoo.closed) { pdfwoo.close(); pdfwoo=null; } else { pdfwoo.close(); pdfwoo=null; }
}
if (pptxwoo) {
if (!pptxwoo.closed) { pptxwoo.close(); pptxwoo=null; } else { pptxwoo.close(); pptxwoo=null; }
}
if (mswoo) {
if (!mswoo.closed) { mswoo.close(); mswoo=null; } else { mswoo.close(); mswoo=null; }
}
//incv=incv.replace(/\~\~/g, String.fromCharCode(92) + String.fromCharCode(10)); // new idea
if (('' + document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(incv) + '&apdfname=' + encodeURIComponent(anidn + '.pdf')).length > 800) { pdfzhr = new XMLHttpRequest();
pdfzform = new FormData();
pdfzform.append('anidnlist', incv);
pdfzform.append('anidn', anidn + '.abc');
//pdfzhr.onreadystatechange=noNeedToHangAround;
pdfzhr.open('post', './one_line_find.php', true);
pdfzhr.send(pdfzform);
ganidn=anidn;
gincv=noh(incv); // strips out any hashtagged caption data
setTimeout(function(){
pdfwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(gincv) + '&apdfname=' + encodeURIComponent(ganidn + '.pdf'),'_blank','top=20,left=' + eval(-700 + screen.width) + ',width=700,height=700');
pdfwoo.document.title='PDF (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
pptxwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?applist=' + encodeURIComponent(gincv) + '&appname=' + encodeURIComponent(ganidn + '.pptx'),'_blank','top=' + eval(-400 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
pptxwoo.document.title='PowerPoint (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
mswoo=window.open(document.URL.split('?')[0].split('#')[0] + '?amslist=' + encodeURIComponent(gincv) + '&amsname=' + encodeURIComponent(ganidn + '.docx'),'_blank','top=' + eval(-200 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
mswoo.document.title='Word (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
}, 5000);
} else {
pdfwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(incv) + '&apdfname=' + encodeURIComponent(anidn + '.pdf'),'_blank','top=20,left=' + eval(-700 + screen.width) + ',width=700,height=700');
pdfwoo.document.title='PDF (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
pptxwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?applist=' + encodeURIComponent(incv) + '&appname=' + encodeURIComponent(anidn + '.pptx'),'_blank','top=' + eval(-400 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
pptxwoo.document.title='PowerPoint (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
mswoo=window.open(document.URL.split('?')[0].split('#')[0] + '?amslist=' + encodeURIComponent(incv) + '&amsname=' + encodeURIComponent(anidn + '.docx'),'_blank','top=' + eval(-200 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
mswoo.document.title='Word (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
}
} else if (4 == 46) {
document.getElementById('apdflist').value=incv;
document.getElementById('apdfname').value='pdf' + Math.floor(Math.random() * 19897654) + '.pdf';
document.getElementById('thepdf').style.display='block';
document.getElementById('pdfsub').click();
} else if (4 == 47) {
document.getElementById('thepdf').style.display='block';
document.getElementById('thepdf').src=document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(incv) + '&apdfname=' + encodeURIComponent('pdf' + Math.floor(Math.random() * 19897654) + '.pdf');
} else {
pdfzhr = new XMLHttpRequest();
pdfzform = new FormData();
pdfzform.append('apdflist', incv);
pdfzform.append('apdfname', 'pdf' + Math.floor(Math.random() * 19897654) + '.pdf');
pdfzhr.onreadystatechange=statePdfChanged;
pdfzhr.open('post', './one_line_find.php', true);
pdfzhr.send(pdfzform);
}
}
“; ?>
… begging the question, at least for us, being …
What’s the go with …
//pdfzhr.onreadystatechange=noNeedToHangAround;
?
Well, the “A” of Ajax stands for “Asynchronous”, as a useful aspect to Javascript where logic does not have to flow from start to finish linearly, and jobs can multitask. That onreadystatechange idea analyzes what the recipient PHP replies, but in the case of a file cleanup …
it is optional (but preferable) if it happens at all, in the way we roll around here …
and that means as far as file cleanup goes, immediately the interim ascii flat file (used to flesh out the following $_GET[] array work …
<?php
$commentaries=[];
?>
…with hashtagged caption data that made the job too long for $_GET[] based navigation from the start) can be created by our recipient PHP Ajax “called upon” … then …
leaving the $_GET[] pass (we wait back at the client Javascript 5 seconds for via setTimeout logics, while the PHP sleeps much longer) time to avail themselves back up at the server with the use of that interim ascii flat file (while the asynchronous, and not waited upon, Ajax called PHP sleeps … presumably among the lions) … while …
back at the Ajax called PHP, having slept, and the interim file has lost it’s value, it can be deleted … sorrrrrryyyyyyy “interim file”
… as one example of how this “PHP Javascript Ajax Asynchronous Sleep Cleanup” idea set could be implemented.
… output document formats, created via pandoc, with the ability, in pandoc, to tailor slide “captions”, which, until today, had been hardwired to be the image slide filename.
We’ve decided to hashtag such user caption tailoring in hashtag data after the filenames passed over to the recipient PHP (which is the same as the originating PHP in “here’s looking at you” mode of thinking).
So where can the user enter these? The first option …
<?php echo ”
document.getElementById('prefix').innerHTML=document.getElementById('prefix').innerHTML.replace(':','<select ontouchstart=\"thismultiple(this);\" onmouseover=\"thismultiple(this);\" onclick=\"thismultiple(this);\" size=1 id=compsel title=\"Animated slideshow or PDF or PowerPoint or Word via slides possible selecting multiple images here.\" style=display:inline-block;width:28px; data-onblur=process(this); data-multiple><option id=firsttext onclick=addcommentary(); value=\"\">:</option></select>')
“; ?>
… of that relatively new dropdown for this is where we have decided to intervene …
<?php echo ”
var commentaries=[];
function addcommentary() {
needten=1;
var commadd=prompt('Optionally add to commentary. For new lines use ~~ characters. For multiple entries separate by , (ie. two blanks comma two blanks).', '');
if (commadd != null) {
var coms=commadd.split(' , ');
for (var ic=0; ic<coms.length; ic++) {
if (coms[ic].trim() != '') {
commentaries.push('#' + encodeURIComponent(coms[ic]));
}
}
}
}
“; ?>
And so, the “ninth draft”one_line_find.phpDocument Root Relative Folder Listing web application you can “crank up” below, yet again, if you, and your ilk, along with their family and friends, girls and boys, cousins and removalists (to get rid of those pesky second ones), Martians with visas, commentators and audience, townfolk and countryfolk alike, like.
Document Root Relative Folder Listing Links Word Tutorial
The word is, in workplaces all around Earth now, workers are unwrapping their Mars Bars and shaping to use …
Word
… huh?! Isn’t that a coincidence?! Who would have thunk it. They are constructing documents. So that being the case, do you think …
The barsoomian is, in workplaces all around Mars now, martians are unwrapping their Earth Bars and shaping to use …
Word
… to write haikus
? But if not, why not?!
As such, the creation of a “Word assembly” is our “fourth cab off the rank” as an output format offered to users trying out the recent select (ie. dropdown) “assemblies” we PowerPointized yesterday with Document Root Relative Folder Listing Links PowerPoint Tutorial. We use a window.open popup again, latching onto the PHP recipient code …
<?php
$pconvprefix='/bin/';
if (file_exists('/usr/local/bin/pandoc')) {
$pconvprefix='/usr/local/bin/';
} else if (!file_exists('/bin/pandoc')) {
$pconvprefix='';
}
Document Root Relative Folder Listing Links PDF Tutorial
Hopefully, all around the world, the idea of a …
PDF
… display is replacing the “paper hungry” “hardcopy printout” concept. As such, the creation of a “PDF assembly” is our “second cab off the rank” as an output format offered to users trying out the recent select (ie. dropdown) “assemblies” we started yesterday with Document Root Relative Folder Listing Links Assemblies Tutorial. We use a window.open popup again, latching onto the PHP recipient code …
<?php
$thingtoattendto='';
function shutdown() {
global $thingtoattendto;
// This is our shutdown function, in
// here we can do any last operations
// before the script is complete.
if ($thingtoattendto != '') {
sleep(145);
unlink($thingtoattendto);
}
}
$convprefix='/bin/';
if (file_exists('/usr/local/bin/convert')) {
$convprefix='/usr/local/bin/';
} else if (!file_exists('/bin/convert')) {
$convprefix='';
}
display … but we want to move on to the user being able to create their own what we are referring to as …
assemblies
To us, these are user driven (is it widgets) they create by selecting multiple media (today images, but down the line, other combinations) from the left hand table cell’s listing links. We do not ask anymore of that left hand cell’s workings, as it will get too complex, but we have a penchant for adding intelligence to hardcodings, and the hardcoding …
https://www.rjmprogramming.com.au/
… is ripe for the picking, with that “just moseying along there innocently” …
:
… a candidate for a new multiple mode select (ie dropdown) element …
Howevvvvvvvver, just to confuse, there is no onmouseover involved, but the Ajax work does, at least for non-mobile users, sort of, affect display data, in that when hovering over a link, they may see within the title attribute of that link, whatevvvvvvvvver …
yesterday’s Document Root Relative Folder Listing output was placed into a textarea element … clue 1
that textarea element we all admire for it’s textual data line feed talents and it’s talents for resizing capabilities … clue 2
that textarea element textual data is unembellishable (if that is a word) … clue 3
whereas your meek and mild div element, say, could overlay that textarea element, except for the right hand resizer, that is … clue 4
and the div element could latch onto that textarea basis of content and enhance filenames into filename links too (but am not sure about the Singing Glasses idea in the “talent quest section” … that seems a bridge too far) … clue 5
… leaving us clueless as to what else to say … chortle, chortle?!
Also helpful would be, to our minds …
still restrict the file specification to a “buttoned down” setting (because of security concerns) … but …
add complexity to the extension part …
<?php
$extbit='*.[tjpmwag][xpnopaid][etgvf34]*';
?>
…to allow relatively innocent media files and PDFs reach the file listing (tweaked a bit too) now …
<?php
$resis=str_replace($_SERVER['DOCUMENT_ROOT'],'',shell_exec('ls -lhgo ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $offdr . $extbit));
… scours that Document Root folder to find the index.php webpage code to display that Landing Page.
You can “abstract”, and we do also with our Difference Reporting, what that Document Root is as a folder path … bit forlorn we know, as we’ve shown what it is, probably, in many tutorial images … but the thing here is that a URL such as …
… is understood and gets you to our Landing Page as well, because to the public, Document Root is the limit of where they are allowed to surf … if you like Document Root is the left hand beach flag at Surfers Paradise (or perhaps the right hand beach flag in the Todd River … when it gets water, that is?!).
Okay, that’s one theme of today’s new PHP web application. The other we wrote out to ourself was …
One line ls -clt https://www.rjmprogramming.com.au/*.txt via find $_SERVER[‘DOCUMENT_ROOT’] -type d -name ‘*’
… as a presentation idea whereby just the one table row of data is used to present …
https://www.rjmprogramming.com.au/
dropdown of list of folders off Document Root (“abstracting” Document Root itself … ie. relative referencing)
a file specification (minus the path) of interest … we are, for now, locking in as …
*.txt
… as the input data, to the output data that is …
output folder listing (as for Linux and macOS)
The concept of “one table row” for a multiple file listing is a mute point, but in our defence …
the textarea it is presented in (via rows=1) is user resizable
the textarea it is presented in is given a title with line feeds for the whole report so that non-mobile users can see this on hovering over the textarea
This was a PHP project definitely needing the mildly better outcomes of PHP shell_exec (where multiple line outputs are possible) as distinct from exec where only the last output line is returned, but is the usual method we use around here.
Keeping the report to one row also asks for …
use of elements that have CSS styling display:inline; as a default (eg. span element) … or …
user supplying CSS display:inline; or display:inline-block; as applicable … and …
table cell text-align:right; came in handy … as well as …
select element “dynamic shrinker” …
function resizeSelect(sel) { // thanks to https://www.google.com/search?q=make+select+element+width+in+sympathy+with+length+of+its+value&rlz=1C5OZZY_en&oq=make+select+element+width+in+sympathy+with+length+of+its+value&gs_lcrp=EgZjaHJvbWUyBggAEEUYOdIBCTI3MzEzajBqNKgCALACAQ&sourceid=chrome&ie=UTF-8
// 1. Create a temporary span to measure text width
var tempSpan = document.createElement('span');
tempSpan.style.visibility = 'hidden';
tempSpan.style.position = 'absolute';
tempSpan.style.whiteSpace = 'pre';
// 2. Set font styles to match the select box
tempSpan.style.font = window.getComputedStyle(sel).font;
// 3. Set content to selected text
tempSpan.innerText = sel.options[sel.selectedIndex].text;
document.body.appendChild(tempSpan);
// 4. Update width (with extra space for the dropdown arrow)
sel.style.width = (tempSpan.offsetWidth + 30) + 'px';
document.body.removeChild(tempSpan);
}
… issues where in the past we may have resorted to a …
crontab (and maybe curl) means to a solution … but we prefer, where possible …
there and then procedures within the PHP (ie. it has to be PHP to help) … as much as anything, because that way, all the parts to any solution, are self contained
… and for security purposes that PHP solution is best done using a form method=POST methodology, or, as we are sprouting here today (and we like a lot, and think it could help us out later with other such scenarios) … and our apologies for the tautology …
PHP Javascript Ajax Asynchronous Sleep Cleanup
… thinking we start explaining at the changed Javascript Ajax (to the original block of code) as per …
<?php echo ”
var gincv='', ganidn='';
function ajaxpdfit(incv) {
if (4 == 4) {
var anidn='' + incv.replace(/\\\\/g,'/').split(',')[0].split('/')[eval(-1 + incv.replace(/\\\\/g,'/').split(',')[0].split('/').length)].split('.')[0] + '_et-al_' + incv.split(',').length; // + '.pdf';
if (pdfwoo) {
if (!pdfwoo.closed) { pdfwoo.close(); pdfwoo=null; } else { pdfwoo.close(); pdfwoo=null; }
}
if (pptxwoo) {
if (!pptxwoo.closed) { pptxwoo.close(); pptxwoo=null; } else { pptxwoo.close(); pptxwoo=null; }
}
if (mswoo) {
if (!mswoo.closed) { mswoo.close(); mswoo=null; } else { mswoo.close(); mswoo=null; }
}
//incv=incv.replace(/\~\~/g, String.fromCharCode(92) + String.fromCharCode(10)); // new idea
if (('' + document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(incv) + '&apdfname=' + encodeURIComponent(anidn + '.pdf')).length > 800) { pdfzhr = new XMLHttpRequest();
pdfzform = new FormData();
pdfzform.append('anidnlist', incv);
pdfzform.append('anidn', anidn + '.abc');
//pdfzhr.onreadystatechange=noNeedToHangAround;
pdfzhr.open('post', './one_line_find.php', true);
pdfzhr.send(pdfzform);
ganidn=anidn;
gincv=noh(incv); // strips out any hashtagged caption data
setTimeout(function(){
pdfwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(gincv) + '&apdfname=' + encodeURIComponent(ganidn + '.pdf'),'_blank','top=20,left=' + eval(-700 + screen.width) + ',width=700,height=700');
pdfwoo.document.title='PDF (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
pptxwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?applist=' + encodeURIComponent(gincv) + '&appname=' + encodeURIComponent(ganidn + '.pptx'),'_blank','top=' + eval(-400 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
pptxwoo.document.title='PowerPoint (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
mswoo=window.open(document.URL.split('?')[0].split('#')[0] + '?amslist=' + encodeURIComponent(gincv) + '&amsname=' + encodeURIComponent(ganidn + '.docx'),'_blank','top=' + eval(-200 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
mswoo.document.title='Word (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
}, 5000);
} else {
pdfwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(incv) + '&apdfname=' + encodeURIComponent(anidn + '.pdf'),'_blank','top=20,left=' + eval(-700 + screen.width) + ',width=700,height=700');
pdfwoo.document.title='PDF (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
pptxwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?applist=' + encodeURIComponent(incv) + '&appname=' + encodeURIComponent(anidn + '.pptx'),'_blank','top=' + eval(-400 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
pptxwoo.document.title='PowerPoint (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
mswoo=window.open(document.URL.split('?')[0].split('#')[0] + '?amslist=' + encodeURIComponent(incv) + '&amsname=' + encodeURIComponent(anidn + '.docx'),'_blank','top=' + eval(-200 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
mswoo.document.title='Word (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
}
} else if (4 == 46) {
document.getElementById('apdflist').value=incv;
document.getElementById('apdfname').value='pdf' + Math.floor(Math.random() * 19897654) + '.pdf';
document.getElementById('thepdf').style.display='block';
document.getElementById('pdfsub').click();
} else if (4 == 47) {
document.getElementById('thepdf').style.display='block';
document.getElementById('thepdf').src=document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(incv) + '&apdfname=' + encodeURIComponent('pdf' + Math.floor(Math.random() * 19897654) + '.pdf');
} else {
pdfzhr = new XMLHttpRequest();
pdfzform = new FormData();
pdfzform.append('apdflist', incv);
pdfzform.append('apdfname', 'pdf' + Math.floor(Math.random() * 19897654) + '.pdf');
pdfzhr.onreadystatechange=statePdfChanged;
pdfzhr.open('post', './one_line_find.php', true);
pdfzhr.send(pdfzform);
}
}
“; ?>
… begging the question, at least for us, being …
What’s the go with …
//pdfzhr.onreadystatechange=noNeedToHangAround;
?
Well, the “A” of Ajax stands for “Asynchronous”, as a useful aspect to Javascript where logic does not have to flow from start to finish linearly, and jobs can multitask. That onreadystatechange idea analyzes what the recipient PHP replies, but in the case of a file cleanup …
it is optional (but preferable) if it happens at all, in the way we roll around here …
and that means as far as file cleanup goes, immediately the interim ascii flat file (used to flesh out the following $_GET[] array work …
<?php
$commentaries=[];
?>
…with hashtagged caption data that made the job too long for $_GET[] based navigation from the start) can be created by our recipient PHP Ajax “called upon” … then …
leaving the $_GET[] pass (we wait back at the client Javascript 5 seconds for via setTimeout logics, while the PHP sleeps much longer) time to avail themselves back up at the server with the use of that interim ascii flat file (while the asynchronous, and not waited upon, Ajax called PHP sleeps … presumably among the lions) … while …
back at the Ajax called PHP, having slept, and the interim file has lost it’s value, it can be deleted … sorrrrrryyyyyyy “interim file”
… as one example of how this “PHP Javascript Ajax Asynchronous Sleep Cleanup” idea set could be implemented.
… output document formats, created via pandoc, with the ability, in pandoc, to tailor slide “captions”, which, until today, had been hardwired to be the image slide filename.
We’ve decided to hashtag such user caption tailoring in hashtag data after the filenames passed over to the recipient PHP (which is the same as the originating PHP in “here’s looking at you” mode of thinking).
So where can the user enter these? The first option …
<?php echo ”
document.getElementById('prefix').innerHTML=document.getElementById('prefix').innerHTML.replace(':','<select ontouchstart=\"thismultiple(this);\" onmouseover=\"thismultiple(this);\" onclick=\"thismultiple(this);\" size=1 id=compsel title=\"Animated slideshow or PDF or PowerPoint or Word via slides possible selecting multiple images here.\" style=display:inline-block;width:28px; data-onblur=process(this); data-multiple><option id=firsttext onclick=addcommentary(); value=\"\">:</option></select>')
“; ?>
… of that relatively new dropdown for this is where we have decided to intervene …
<?php echo ”
var commentaries=[];
function addcommentary() {
needten=1;
var commadd=prompt('Optionally add to commentary. For new lines use ~~ characters. For multiple entries separate by , (ie. two blanks comma two blanks).', '');
if (commadd != null) {
var coms=commadd.split(' , ');
for (var ic=0; ic<coms.length; ic++) {
if (coms[ic].trim() != '') {
commentaries.push('#' + encodeURIComponent(coms[ic]));
}
}
}
}
“; ?>
And so, the “ninth draft”one_line_find.phpDocument Root Relative Folder Listing web application you can “crank up” below, yet again, if you, and your ilk, along with their family and friends, girls and boys, cousins and removalists (to get rid of those pesky second ones), Martians with visas, commentators and audience, townfolk and countryfolk alike, like.
Document Root Relative Folder Listing Links Word Tutorial
The word is, in workplaces all around Earth now, workers are unwrapping their Mars Bars and shaping to use …
Word
… huh?! Isn’t that a coincidence?! Who would have thunk it. They are constructing documents. So that being the case, do you think …
The barsoomian is, in workplaces all around Mars now, martians are unwrapping their Earth Bars and shaping to use …
Word
… to write haikus
? But if not, why not?!
As such, the creation of a “Word assembly” is our “fourth cab off the rank” as an output format offered to users trying out the recent select (ie. dropdown) “assemblies” we PowerPointized yesterday with Document Root Relative Folder Listing Links PowerPoint Tutorial. We use a window.open popup again, latching onto the PHP recipient code …
<?php
$pconvprefix='/bin/';
if (file_exists('/usr/local/bin/pandoc')) {
$pconvprefix='/usr/local/bin/';
} else if (!file_exists('/bin/pandoc')) {
$pconvprefix='';
}
Document Root Relative Folder Listing Links PDF Tutorial
Hopefully, all around the world, the idea of a …
PDF
… display is replacing the “paper hungry” “hardcopy printout” concept. As such, the creation of a “PDF assembly” is our “second cab off the rank” as an output format offered to users trying out the recent select (ie. dropdown) “assemblies” we started yesterday with Document Root Relative Folder Listing Links Assemblies Tutorial. We use a window.open popup again, latching onto the PHP recipient code …
<?php
$thingtoattendto='';
function shutdown() {
global $thingtoattendto;
// This is our shutdown function, in
// here we can do any last operations
// before the script is complete.
if ($thingtoattendto != '') {
sleep(145);
unlink($thingtoattendto);
}
}
$convprefix='/bin/';
if (file_exists('/usr/local/bin/convert')) {
$convprefix='/usr/local/bin/';
} else if (!file_exists('/bin/convert')) {
$convprefix='';
}
display … but we want to move on to the user being able to create their own what we are referring to as …
assemblies
To us, these are user driven (is it widgets) they create by selecting multiple media (today images, but down the line, other combinations) from the left hand table cell’s listing links. We do not ask anymore of that left hand cell’s workings, as it will get too complex, but we have a penchant for adding intelligence to hardcodings, and the hardcoding …
https://www.rjmprogramming.com.au/
… is ripe for the picking, with that “just moseying along there innocently” …
:
… a candidate for a new multiple mode select (ie dropdown) element …
Howevvvvvvvver, just to confuse, there is no onmouseover involved, but the Ajax work does, at least for non-mobile users, sort of, affect display data, in that when hovering over a link, they may see within the title attribute of that link, whatevvvvvvvvver …
yesterday’s Document Root Relative Folder Listing output was placed into a textarea element … clue 1
that textarea element we all admire for it’s textual data line feed talents and it’s talents for resizing capabilities … clue 2
that textarea element textual data is unembellishable (if that is a word) … clue 3
whereas your meek and mild div element, say, could overlay that textarea element, except for the right hand resizer, that is … clue 4
and the div element could latch onto that textarea basis of content and enhance filenames into filename links too (but am not sure about the Singing Glasses idea in the “talent quest section” … that seems a bridge too far) … clue 5
… leaving us clueless as to what else to say … chortle, chortle?!
Also helpful would be, to our minds …
still restrict the file specification to a “buttoned down” setting (because of security concerns) … but …
add complexity to the extension part …
<?php
$extbit='*.[tjpmwag][xpnopaid][etgvf34]*';
?>
…to allow relatively innocent media files and PDFs reach the file listing (tweaked a bit too) now …
<?php
$resis=str_replace($_SERVER['DOCUMENT_ROOT'],'',shell_exec('ls -lhgo ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $offdr . $extbit));
… scours that Document Root folder to find the index.php webpage code to display that Landing Page.
You can “abstract”, and we do also with our Difference Reporting, what that Document Root is as a folder path … bit forlorn we know, as we’ve shown what it is, probably, in many tutorial images … but the thing here is that a URL such as …
… is understood and gets you to our Landing Page as well, because to the public, Document Root is the limit of where they are allowed to surf … if you like Document Root is the left hand beach flag at Surfers Paradise (or perhaps the right hand beach flag in the Todd River … when it gets water, that is?!).
Okay, that’s one theme of today’s new PHP web application. The other we wrote out to ourself was …
One line ls -clt https://www.rjmprogramming.com.au/*.txt via find $_SERVER[‘DOCUMENT_ROOT’] -type d -name ‘*’
… as a presentation idea whereby just the one table row of data is used to present …
https://www.rjmprogramming.com.au/
dropdown of list of folders off Document Root (“abstracting” Document Root itself … ie. relative referencing)
a file specification (minus the path) of interest … we are, for now, locking in as …
*.txt
… as the input data, to the output data that is …
output folder listing (as for Linux and macOS)
The concept of “one table row” for a multiple file listing is a mute point, but in our defence …
the textarea it is presented in (via rows=1) is user resizable
the textarea it is presented in is given a title with line feeds for the whole report so that non-mobile users can see this on hovering over the textarea
This was a PHP project definitely needing the mildly better outcomes of PHP shell_exec (where multiple line outputs are possible) as distinct from exec where only the last output line is returned, but is the usual method we use around here.
Keeping the report to one row also asks for …
use of elements that have CSS styling display:inline; as a default (eg. span element) … or …
user supplying CSS display:inline; or display:inline-block; as applicable … and …
table cell text-align:right; came in handy … as well as …
select element “dynamic shrinker” …
function resizeSelect(sel) { // thanks to https://www.google.com/search?q=make+select+element+width+in+sympathy+with+length+of+its+value&rlz=1C5OZZY_en&oq=make+select+element+width+in+sympathy+with+length+of+its+value&gs_lcrp=EgZjaHJvbWUyBggAEEUYOdIBCTI3MzEzajBqNKgCALACAQ&sourceid=chrome&ie=UTF-8
// 1. Create a temporary span to measure text width
var tempSpan = document.createElement('span');
tempSpan.style.visibility = 'hidden';
tempSpan.style.position = 'absolute';
tempSpan.style.whiteSpace = 'pre';
// 2. Set font styles to match the select box
tempSpan.style.font = window.getComputedStyle(sel).font;
// 3. Set content to selected text
tempSpan.innerText = sel.options[sel.selectedIndex].text;
document.body.appendChild(tempSpan);
// 4. Update width (with extra space for the dropdown arrow)
sel.style.width = (tempSpan.offsetWidth + 30) + 'px';
document.body.removeChild(tempSpan);
}
… output document formats, created via pandoc, with the ability, in pandoc, to tailor slide “captions”, which, until today, had been hardwired to be the image slide filename.
We’ve decided to hashtag such user caption tailoring in hashtag data after the filenames passed over to the recipient PHP (which is the same as the originating PHP in “here’s looking at you” mode of thinking).
So where can the user enter these? The first option …
<?php echo ”
document.getElementById('prefix').innerHTML=document.getElementById('prefix').innerHTML.replace(':','<select ontouchstart=\"thismultiple(this);\" onmouseover=\"thismultiple(this);\" onclick=\"thismultiple(this);\" size=1 id=compsel title=\"Animated slideshow or PDF or PowerPoint or Word via slides possible selecting multiple images here.\" style=display:inline-block;width:28px; data-onblur=process(this); data-multiple><option id=firsttext onclick=addcommentary(); value=\"\">:</option></select>')
“; ?>
… of that relatively new dropdown for this is where we have decided to intervene …
<?php echo ”
var commentaries=[];
function addcommentary() {
needten=1;
var commadd=prompt('Optionally add to commentary. For new lines use ~~ characters. For multiple entries separate by , (ie. two blanks comma two blanks).', '');
if (commadd != null) {
var coms=commadd.split(' , ');
for (var ic=0; ic<coms.length; ic++) {
if (coms[ic].trim() != '') {
commentaries.push('#' + encodeURIComponent(coms[ic]));
}
}
}
}
“; ?>
And so, the “ninth draft”one_line_find.phpDocument Root Relative Folder Listing web application you can “crank up” below, yet again, if you, and your ilk, along with their family and friends, girls and boys, cousins and removalists (to get rid of those pesky second ones), Martians with visas, commentators and audience, townfolk and countryfolk alike, like.
Document Root Relative Folder Listing Links Word Tutorial
The word is, in workplaces all around Earth now, workers are unwrapping their Mars Bars and shaping to use …
Word
… huh?! Isn’t that a coincidence?! Who would have thunk it. They are constructing documents. So that being the case, do you think …
The barsoomian is, in workplaces all around Mars now, martians are unwrapping their Earth Bars and shaping to use …
Word
… to write haikus
? But if not, why not?!
As such, the creation of a “Word assembly” is our “fourth cab off the rank” as an output format offered to users trying out the recent select (ie. dropdown) “assemblies” we PowerPointized yesterday with Document Root Relative Folder Listing Links PowerPoint Tutorial. We use a window.open popup again, latching onto the PHP recipient code …
<?php
$pconvprefix='/bin/';
if (file_exists('/usr/local/bin/pandoc')) {
$pconvprefix='/usr/local/bin/';
} else if (!file_exists('/bin/pandoc')) {
$pconvprefix='';
}
Document Root Relative Folder Listing Links PDF Tutorial
Hopefully, all around the world, the idea of a …
PDF
… display is replacing the “paper hungry” “hardcopy printout” concept. As such, the creation of a “PDF assembly” is our “second cab off the rank” as an output format offered to users trying out the recent select (ie. dropdown) “assemblies” we started yesterday with Document Root Relative Folder Listing Links Assemblies Tutorial. We use a window.open popup again, latching onto the PHP recipient code …
<?php
$thingtoattendto='';
function shutdown() {
global $thingtoattendto;
// This is our shutdown function, in
// here we can do any last operations
// before the script is complete.
if ($thingtoattendto != '') {
sleep(145);
unlink($thingtoattendto);
}
}
$convprefix='/bin/';
if (file_exists('/usr/local/bin/convert')) {
$convprefix='/usr/local/bin/';
} else if (!file_exists('/bin/convert')) {
$convprefix='';
}
display … but we want to move on to the user being able to create their own what we are referring to as …
assemblies
To us, these are user driven (is it widgets) they create by selecting multiple media (today images, but down the line, other combinations) from the left hand table cell’s listing links. We do not ask anymore of that left hand cell’s workings, as it will get too complex, but we have a penchant for adding intelligence to hardcodings, and the hardcoding …
https://www.rjmprogramming.com.au/
… is ripe for the picking, with that “just moseying along there innocently” …
:
… a candidate for a new multiple mode select (ie dropdown) element …
Howevvvvvvvver, just to confuse, there is no onmouseover involved, but the Ajax work does, at least for non-mobile users, sort of, affect display data, in that when hovering over a link, they may see within the title attribute of that link, whatevvvvvvvvver …
yesterday’s Document Root Relative Folder Listing output was placed into a textarea element … clue 1
that textarea element we all admire for it’s textual data line feed talents and it’s talents for resizing capabilities … clue 2
that textarea element textual data is unembellishable (if that is a word) … clue 3
whereas your meek and mild div element, say, could overlay that textarea element, except for the right hand resizer, that is … clue 4
and the div element could latch onto that textarea basis of content and enhance filenames into filename links too (but am not sure about the Singing Glasses idea in the “talent quest section” … that seems a bridge too far) … clue 5
… leaving us clueless as to what else to say … chortle, chortle?!
Also helpful would be, to our minds …
still restrict the file specification to a “buttoned down” setting (because of security concerns) … but …
add complexity to the extension part …
<?php
$extbit='*.[tjpmwag][xpnopaid][etgvf34]*';
?>
…to allow relatively innocent media files and PDFs reach the file listing (tweaked a bit too) now …
<?php
$resis=str_replace($_SERVER['DOCUMENT_ROOT'],'',shell_exec('ls -lhgo ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $offdr . $extbit));
… scours that Document Root folder to find the index.php webpage code to display that Landing Page.
You can “abstract”, and we do also with our Difference Reporting, what that Document Root is as a folder path … bit forlorn we know, as we’ve shown what it is, probably, in many tutorial images … but the thing here is that a URL such as …
… is understood and gets you to our Landing Page as well, because to the public, Document Root is the limit of where they are allowed to surf … if you like Document Root is the left hand beach flag at Surfers Paradise (or perhaps the right hand beach flag in the Todd River … when it gets water, that is?!).
Okay, that’s one theme of today’s new PHP web application. The other we wrote out to ourself was …
One line ls -clt https://www.rjmprogramming.com.au/*.txt via find $_SERVER[‘DOCUMENT_ROOT’] -type d -name ‘*’
… as a presentation idea whereby just the one table row of data is used to present …
https://www.rjmprogramming.com.au/
dropdown of list of folders off Document Root (“abstracting” Document Root itself … ie. relative referencing)
a file specification (minus the path) of interest … we are, for now, locking in as …
*.txt
… as the input data, to the output data that is …
output folder listing (as for Linux and macOS)
The concept of “one table row” for a multiple file listing is a mute point, but in our defence …
the textarea it is presented in (via rows=1) is user resizable
the textarea it is presented in is given a title with line feeds for the whole report so that non-mobile users can see this on hovering over the textarea
This was a PHP project definitely needing the mildly better outcomes of PHP shell_exec (where multiple line outputs are possible) as distinct from exec where only the last output line is returned, but is the usual method we use around here.
Keeping the report to one row also asks for …
use of elements that have CSS styling display:inline; as a default (eg. span element) … or …
user supplying CSS display:inline; or display:inline-block; as applicable … and …
table cell text-align:right; came in handy … as well as …
select element “dynamic shrinker” …
function resizeSelect(sel) { // thanks to https://www.google.com/search?q=make+select+element+width+in+sympathy+with+length+of+its+value&rlz=1C5OZZY_en&oq=make+select+element+width+in+sympathy+with+length+of+its+value&gs_lcrp=EgZjaHJvbWUyBggAEEUYOdIBCTI3MzEzajBqNKgCALACAQ&sourceid=chrome&ie=UTF-8
// 1. Create a temporary span to measure text width
var tempSpan = document.createElement('span');
tempSpan.style.visibility = 'hidden';
tempSpan.style.position = 'absolute';
tempSpan.style.whiteSpace = 'pre';
// 2. Set font styles to match the select box
tempSpan.style.font = window.getComputedStyle(sel).font;
// 3. Set content to selected text
tempSpan.innerText = sel.options[sel.selectedIndex].text;
document.body.appendChild(tempSpan);
// 4. Update width (with extra space for the dropdown arrow)
sel.style.width = (tempSpan.offsetWidth + 30) + 'px';
document.body.removeChild(tempSpan);
}
Document Root Relative Folder Listing Links Word Tutorial
The word is, in workplaces all around Earth now, workers are unwrapping their Mars Bars and shaping to use …
Word
… huh?! Isn’t that a coincidence?! Who would have thunk it. They are constructing documents. So that being the case, do you think …
The barsoomian is, in workplaces all around Mars now, martians are unwrapping their Earth Bars and shaping to use …
Word
… to write haikus
? But if not, why not?!
As such, the creation of a “Word assembly” is our “fourth cab off the rank” as an output format offered to users trying out the recent select (ie. dropdown) “assemblies” we PowerPointized yesterday with Document Root Relative Folder Listing Links PowerPoint Tutorial. We use a window.open popup again, latching onto the PHP recipient code …
<?php
$pconvprefix='/bin/';
if (file_exists('/usr/local/bin/pandoc')) {
$pconvprefix='/usr/local/bin/';
} else if (!file_exists('/bin/pandoc')) {
$pconvprefix='';
}
Document Root Relative Folder Listing Links PDF Tutorial
Hopefully, all around the world, the idea of a …
PDF
… display is replacing the “paper hungry” “hardcopy printout” concept. As such, the creation of a “PDF assembly” is our “second cab off the rank” as an output format offered to users trying out the recent select (ie. dropdown) “assemblies” we started yesterday with Document Root Relative Folder Listing Links Assemblies Tutorial. We use a window.open popup again, latching onto the PHP recipient code …
<?php
$thingtoattendto='';
function shutdown() {
global $thingtoattendto;
// This is our shutdown function, in
// here we can do any last operations
// before the script is complete.
if ($thingtoattendto != '') {
sleep(145);
unlink($thingtoattendto);
}
}
$convprefix='/bin/';
if (file_exists('/usr/local/bin/convert')) {
$convprefix='/usr/local/bin/';
} else if (!file_exists('/bin/convert')) {
$convprefix='';
}
display … but we want to move on to the user being able to create their own what we are referring to as …
assemblies
To us, these are user driven (is it widgets) they create by selecting multiple media (today images, but down the line, other combinations) from the left hand table cell’s listing links. We do not ask anymore of that left hand cell’s workings, as it will get too complex, but we have a penchant for adding intelligence to hardcodings, and the hardcoding …
https://www.rjmprogramming.com.au/
… is ripe for the picking, with that “just moseying along there innocently” …
:
… a candidate for a new multiple mode select (ie dropdown) element …
Howevvvvvvvver, just to confuse, there is no onmouseover involved, but the Ajax work does, at least for non-mobile users, sort of, affect display data, in that when hovering over a link, they may see within the title attribute of that link, whatevvvvvvvvver …
yesterday’s Document Root Relative Folder Listing output was placed into a textarea element … clue 1
that textarea element we all admire for it’s textual data line feed talents and it’s talents for resizing capabilities … clue 2
that textarea element textual data is unembellishable (if that is a word) … clue 3
whereas your meek and mild div element, say, could overlay that textarea element, except for the right hand resizer, that is … clue 4
and the div element could latch onto that textarea basis of content and enhance filenames into filename links too (but am not sure about the Singing Glasses idea in the “talent quest section” … that seems a bridge too far) … clue 5
… leaving us clueless as to what else to say … chortle, chortle?!
Also helpful would be, to our minds …
still restrict the file specification to a “buttoned down” setting (because of security concerns) … but …
add complexity to the extension part …
<?php
$extbit='*.[tjpmwag][xpnopaid][etgvf34]*';
?>
…to allow relatively innocent media files and PDFs reach the file listing (tweaked a bit too) now …
<?php
$resis=str_replace($_SERVER['DOCUMENT_ROOT'],'',shell_exec('ls -lhgo ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $offdr . $extbit));
… scours that Document Root folder to find the index.php webpage code to display that Landing Page.
You can “abstract”, and we do also with our Difference Reporting, what that Document Root is as a folder path … bit forlorn we know, as we’ve shown what it is, probably, in many tutorial images … but the thing here is that a URL such as …
… is understood and gets you to our Landing Page as well, because to the public, Document Root is the limit of where they are allowed to surf … if you like Document Root is the left hand beach flag at Surfers Paradise (or perhaps the right hand beach flag in the Todd River … when it gets water, that is?!).
Okay, that’s one theme of today’s new PHP web application. The other we wrote out to ourself was …
One line ls -clt https://www.rjmprogramming.com.au/*.txt via find $_SERVER[‘DOCUMENT_ROOT’] -type d -name ‘*’
… as a presentation idea whereby just the one table row of data is used to present …
https://www.rjmprogramming.com.au/
dropdown of list of folders off Document Root (“abstracting” Document Root itself … ie. relative referencing)
a file specification (minus the path) of interest … we are, for now, locking in as …
*.txt
… as the input data, to the output data that is …
output folder listing (as for Linux and macOS)
The concept of “one table row” for a multiple file listing is a mute point, but in our defence …
the textarea it is presented in (via rows=1) is user resizable
the textarea it is presented in is given a title with line feeds for the whole report so that non-mobile users can see this on hovering over the textarea
This was a PHP project definitely needing the mildly better outcomes of PHP shell_exec (where multiple line outputs are possible) as distinct from exec where only the last output line is returned, but is the usual method we use around here.
Keeping the report to one row also asks for …
use of elements that have CSS styling display:inline; as a default (eg. span element) … or …
user supplying CSS display:inline; or display:inline-block; as applicable … and …
table cell text-align:right; came in handy … as well as …
select element “dynamic shrinker” …
function resizeSelect(sel) { // thanks to https://www.google.com/search?q=make+select+element+width+in+sympathy+with+length+of+its+value&rlz=1C5OZZY_en&oq=make+select+element+width+in+sympathy+with+length+of+its+value&gs_lcrp=EgZjaHJvbWUyBggAEEUYOdIBCTI3MzEzajBqNKgCALACAQ&sourceid=chrome&ie=UTF-8
// 1. Create a temporary span to measure text width
var tempSpan = document.createElement('span');
tempSpan.style.visibility = 'hidden';
tempSpan.style.position = 'absolute';
tempSpan.style.whiteSpace = 'pre';
// 2. Set font styles to match the select box
tempSpan.style.font = window.getComputedStyle(sel).font;
// 3. Set content to selected text
tempSpan.innerText = sel.options[sel.selectedIndex].text;
document.body.appendChild(tempSpan);
// 4. Update width (with extra space for the dropdown arrow)
sel.style.width = (tempSpan.offsetWidth + 30) + 'px';
document.body.removeChild(tempSpan);
}
All around the boardrooms of the world, as we speak …
PowerPoint
… slideshow presentations will be taking place. As such, the creation of a “PowerPoint assembly” is our “third cab off the rank” as an output format offered to users trying out the recent select (ie. dropdown) “assemblies” we PDFized yesterday with Document Root Relative Folder Listing Links PDF Tutorial. We use a window.open popup again, latching onto the PHP recipient code …
<?php
$pconvprefix='/bin/';
if (file_exists('/usr/local/bin/pandoc')) {
$pconvprefix='/usr/local/bin/';
} else if (!file_exists('/bin/pandoc')) {
$pconvprefix='';
}
… exciting to us, here, in that it can work with a web browser such as Google Chrome even though, up at the RJM Programming web server we have no application installed which can display a PowerPoint *.pptx slideshow presentation file, but we do back at macOS because we installed LibreOffice, and so, in our case …
we open a popup in Google Chrome (via selected slides) …
the recipient PHP constructs the wherewithal to construct PowerPoint *.pptx data via (exec called) … pandoc presentation.md -o output.pptx
… and from there …
the PHP uses the header arrangements implied by the code above … but where it …
is unable to display, but still shows a download link …
Document Root Relative Folder Listing Links PDF Tutorial
Hopefully, all around the world, the idea of a …
PDF
… display is replacing the “paper hungry” “hardcopy printout” concept. As such, the creation of a “PDF assembly” is our “second cab off the rank” as an output format offered to users trying out the recent select (ie. dropdown) “assemblies” we started yesterday with Document Root Relative Folder Listing Links Assemblies Tutorial. We use a window.open popup again, latching onto the PHP recipient code …
<?php
$thingtoattendto='';
function shutdown() {
global $thingtoattendto;
// This is our shutdown function, in
// here we can do any last operations
// before the script is complete.
if ($thingtoattendto != '') {
sleep(145);
unlink($thingtoattendto);
}
}
$convprefix='/bin/';
if (file_exists('/usr/local/bin/convert')) {
$convprefix='/usr/local/bin/';
} else if (!file_exists('/bin/convert')) {
$convprefix='';
}
display … but we want to move on to the user being able to create their own what we are referring to as …
assemblies
To us, these are user driven (is it widgets) they create by selecting multiple media (today images, but down the line, other combinations) from the left hand table cell’s listing links. We do not ask anymore of that left hand cell’s workings, as it will get too complex, but we have a penchant for adding intelligence to hardcodings, and the hardcoding …
https://www.rjmprogramming.com.au/
… is ripe for the picking, with that “just moseying along there innocently” …
:
… a candidate for a new multiple mode select (ie dropdown) element …
Howevvvvvvvver, just to confuse, there is no onmouseover involved, but the Ajax work does, at least for non-mobile users, sort of, affect display data, in that when hovering over a link, they may see within the title attribute of that link, whatevvvvvvvvver …
yesterday’s Document Root Relative Folder Listing output was placed into a textarea element … clue 1
that textarea element we all admire for it’s textual data line feed talents and it’s talents for resizing capabilities … clue 2
that textarea element textual data is unembellishable (if that is a word) … clue 3
whereas your meek and mild div element, say, could overlay that textarea element, except for the right hand resizer, that is … clue 4
and the div element could latch onto that textarea basis of content and enhance filenames into filename links too (but am not sure about the Singing Glasses idea in the “talent quest section” … that seems a bridge too far) … clue 5
… leaving us clueless as to what else to say … chortle, chortle?!
Also helpful would be, to our minds …
still restrict the file specification to a “buttoned down” setting (because of security concerns) … but …
add complexity to the extension part …
<?php
$extbit='*.[tjpmwag][xpnopaid][etgvf34]*';
?>
…to allow relatively innocent media files and PDFs reach the file listing (tweaked a bit too) now …
<?php
$resis=str_replace($_SERVER['DOCUMENT_ROOT'],'',shell_exec('ls -lhgo ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $offdr . $extbit));
… scours that Document Root folder to find the index.php webpage code to display that Landing Page.
You can “abstract”, and we do also with our Difference Reporting, what that Document Root is as a folder path … bit forlorn we know, as we’ve shown what it is, probably, in many tutorial images … but the thing here is that a URL such as …
… is understood and gets you to our Landing Page as well, because to the public, Document Root is the limit of where they are allowed to surf … if you like Document Root is the left hand beach flag at Surfers Paradise (or perhaps the right hand beach flag in the Todd River … when it gets water, that is?!).
Okay, that’s one theme of today’s new PHP web application. The other we wrote out to ourself was …
One line ls -clt https://www.rjmprogramming.com.au/*.txt via find $_SERVER[‘DOCUMENT_ROOT’] -type d -name ‘*’
… as a presentation idea whereby just the one table row of data is used to present …
https://www.rjmprogramming.com.au/
dropdown of list of folders off Document Root (“abstracting” Document Root itself … ie. relative referencing)
a file specification (minus the path) of interest … we are, for now, locking in as …
*.txt
… as the input data, to the output data that is …
output folder listing (as for Linux and macOS)
The concept of “one table row” for a multiple file listing is a mute point, but in our defence …
the textarea it is presented in (via rows=1) is user resizable
the textarea it is presented in is given a title with line feeds for the whole report so that non-mobile users can see this on hovering over the textarea
This was a PHP project definitely needing the mildly better outcomes of PHP shell_exec (where multiple line outputs are possible) as distinct from exec where only the last output line is returned, but is the usual method we use around here.
Keeping the report to one row also asks for …
use of elements that have CSS styling display:inline; as a default (eg. span element) … or …
user supplying CSS display:inline; or display:inline-block; as applicable … and …
table cell text-align:right; came in handy … as well as …
select element “dynamic shrinker” …
function resizeSelect(sel) { // thanks to https://www.google.com/search?q=make+select+element+width+in+sympathy+with+length+of+its+value&rlz=1C5OZZY_en&oq=make+select+element+width+in+sympathy+with+length+of+its+value&gs_lcrp=EgZjaHJvbWUyBggAEEUYOdIBCTI3MzEzajBqNKgCALACAQ&sourceid=chrome&ie=UTF-8
// 1. Create a temporary span to measure text width
var tempSpan = document.createElement('span');
tempSpan.style.visibility = 'hidden';
tempSpan.style.position = 'absolute';
tempSpan.style.whiteSpace = 'pre';
// 2. Set font styles to match the select box
tempSpan.style.font = window.getComputedStyle(sel).font;
// 3. Set content to selected text
tempSpan.innerText = sel.options[sel.selectedIndex].text;
document.body.appendChild(tempSpan);
// 4. Update width (with extra space for the dropdown arrow)
sel.style.width = (tempSpan.offsetWidth + 30) + 'px';
document.body.removeChild(tempSpan);
}
Document Root Relative Folder Listing Media Pairings Tutorial
Document Root Relative Folder Listing Media Pairings Tutorial
Onto the day before yesterday’s Document Root Relative Folder Listing Links Video Tutorial, and it’s work with …
… and it’s invitation to broaden the scope … so that today we start down the road towards the concept of what we’ll call …
… trying …
… using the PHP …
<?php
if (isset($_GET['nonims']) && isset($_GET['nonimsname'])) {
$htmlassembly='';
$vis='';
$tis='';
$mis='';
$sis='';
$zis='';
$iis='';
$listis=str_replace('+',' ',urldecode($_GET['nonims']));
$hashis='';
if (strpos($listis, '#') !== false) {
if (strpos(str_replace('#audio/','',str_replace('#video/','',$listis)), '#') === false) {
// ffmpeg -i video.mp4 -i audio.aac -c:v copy -c:a copy output.mp4
$vis=$_SERVER['DOCUMENT_ROOT'] . explode(',', explode('#video/', $listis)[0])[-1 + sizeof( explode(',', explode('#video/', $listis)[0]))];
$ais=$_SERVER['DOCUMENT_ROOT'] . explode(',', explode('#audio/', $listis)[0])[-1 + sizeof( explode(',', explode('#audio/', $listis)[0]))];
//file_put_contents('xx.xx',$fconvprefix . 'ffmpeg -i ' . $vis . ' -i ' . $ais . ' -c:v copy -c:a copy ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('.cba','.mp4',basename(str_replace('+',' ',urldecode($_GET['nonimsname'])))));
//exec($fconvprefix . 'ffmpeg -i ' . $vis . ' -i ' . $ais . ' -c:v copy -c:a copy ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('.cba','.mp4',basename(str_replace('+',' ',urldecode($_GET['nonimsname'])))) . ' 2> ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . "x.err" . ' > ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . "x.ok");
exec($fconvprefix . 'ffmpeg -i ' . $vis . ' -i ' . $ais . ' -c:v copy -c:a copy ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('.cba','.mp4',basename(str_replace('+',' ',urldecode($_GET['nonimsname'])))));
} else if (strpos(str_replace('#text/','',str_replace('#image/','',$listis)), '#') === false) {
$mis=str_replace('jpg','jpeg',explode(',',explode('#image/', $listis)[1])[0]);
$tis=$_SERVER['DOCUMENT_ROOT'] . explode(',', explode('#text/', $listis)[0])[-1 + sizeof( explode(',', explode('#text/', $listis)[0]))];
$iis=$_SERVER['DOCUMENT_ROOT'] . explode(',', explode('#image/', $listis)[0])[-1 + sizeof( explode(',', explode('#image/', $listis)[0]))];
} else if (strpos(str_replace('#audio/','',str_replace('#image/','',$listis)), '#') === false) {
$mis=str_replace('jpg','jpeg',explode(',',explode('#image/', $listis)[1])[0]);
$ais=str_replace('jpg','jpeg',explode(',',explode('#audio/', $listis)[1])[0]);
$sis=$_SERVER['DOCUMENT_ROOT'] . explode(',', explode('#audio/', $listis)[0])[-1 + sizeof( explode(',', explode('#audio/', $listis)[0]))];
$iis=$_SERVER['DOCUMENT_ROOT'] . explode(',', explode('#image/', $listis)[0])[-1 + sizeof( explode(',', explode('#image/', $listis)[0]))];
} else if (strpos(str_replace('#video/','',str_replace('#image/','',$listis)), '#') === false) {
$mis=str_replace('jpg','jpeg',explode(',',explode('#image/', $listis)[1])[0]);
$ais=str_replace('jpg','jpeg',explode(',',explode('#video/', $listis)[1])[0]);
$zis=$_SERVER['DOCUMENT_ROOT'] . explode(',', explode('#video/', $listis)[0])[-1 + sizeof( explode(',', explode('#video/', $listis)[0]))];
$iis=$_SERVER['DOCUMENT_ROOT'] . explode(',', explode('#image/', $listis)[0])[-1 + sizeof( explode(',', explode('#image/', $listis)[0]))];
}
}
$origname=$_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('+',' ',urldecode($_GET['nonimsname']));
//file_put_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('+',' ',urldecode($_GET['nonimsname'])), $htmlassembly);
//if (strpos(('' . $origname . '~'), '.cba~') !== false && $origname != $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('+',' ',urldecode($_GET['nonimsname']))) {
//unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('+',' ',urldecode($_GET['nonimsname'])));
//}
if ($zis != '') {
echo '<html><body style="background:linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(data:image/' . $mis . ';base64,' . base64_encode(file_get_contents($iis)) . ');background-repeat:no-repeat;background-size:contain;background-position:right top;"><video style=opacity:0.7; controls><source type=video/' . $ais . ' src="data:video/' . $ais . ';base64,' . base64_encode(file_get_contents($zis)) . '"></source></video></body></html>';
//unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('.cba','.mp4',basename(str_replace('+',' ',urldecode($_GET['nonimsname'])))));
} else if ($sis != '') {
echo '<html><body style="background:url(data:image/' . $mis . ';base64,' . base64_encode(file_get_contents($iis)) . ');background-repeat:no-repeat;background-size:contain;background-position:right bottom;"><audio controls><source type=audio/' . $ais . ' src="data:audio/' . $ais . ';base64,' . base64_encode(file_get_contents($sis)) . '"></source></audio></body></html>';
//unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('.cba','.mp4',basename(str_replace('+',' ',urldecode($_GET['nonimsname'])))));
} else if ($tis != '') {
echo '<html><body><textarea style="text-shadow:-1px 1px 1px #ff2d95;width:99%;height:99%;background:linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(data:image/' . $mis . ';base64,' . base64_encode(file_get_contents($iis)) . ');background-repeat:no-repeat;background-size:contain;">' . file_get_contents($tis) . '</textarea></body></html>';
//unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('.cba','.mp4',basename(str_replace('+',' ',urldecode($_GET['nonimsname'])))));
} else if ($vis != '') {
if (531 == 53) {
echo '<html><body><video style=width:80%; controls><source type=video/mp4 src="' . str_replace($_SERVER['DOCUMENT_ROOT'],'',$_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('.cba','.mp4',basename(str_replace('+',' ',urldecode($_GET['nonimsname']))))) . '"></source></video></body></html>';
//unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('.cba','.mp4',basename(str_replace('+',' ',urldecode($_GET['nonimsname'])))));
} else if (5 == 5) {
echo '<html><body><video style=width:80%; controls><source type=video/mp4 src="data:video/mp4;base64,' . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('.cba','.mp4',basename(str_replace('+',' ',urldecode($_GET['nonimsname'])))))) . '"></source></video></body></html>';
unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('.cba','.mp4',basename(str_replace('+',' ',urldecode($_GET['nonimsname'])))));
} else if (1 == 1) {
//file_put_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('+',' ',urldecode($_GET['nonimsname'])), $htmlassembly);
// header video/mp4
header('Content-Type: video/mp4');
header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Length: ' . strlen($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('.cba','.mp4',basename(str_replace('+',' ',urldecode($_GET['nonimsname']))))));
header("Content-Disposition: inline; filename=" . basename($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('.cba','.mp4',basename(str_replace('+',' ',urldecode($_GET['nonimsname']))))));
echo file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('.cba','.mp4',basename(str_replace('+',' ',urldecode($_GET['nonimsname'])))));
unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('.cba','.mp4',basename(str_replace('+',' ',urldecode($_GET['nonimsname'])))));
exit;
} else {
echo "<html><body onload=\"var woowoo=window.open('','_blank','top=200,left=200,width=500,height=500'); woowoo.document.write('<html><body>" . $htmlassembly . "</body></html>');\"></body></html>";
}
}
exit;
}
?>
… along the way in the “twelfth draft” one_line_find.php Document Root Relative Folder Listing web application you can “crank up” below.
Previous relevant Document Root Relative Folder Listing Links Video Tutorial is shown below.
Document Root Relative Folder Listing Links Video Tutorial
Onto yesterday’s Document Root Relative Folder Listing Links Animated GIF Tutorial‘s “assembly” list of …
… “assembly” functionality, turning to the great ffmpeg product’s command line …
ffmpeg -f concat -safe 0 -i list.txt -r 25 -pix_fmt yuv420p output.mp4
… used within the procedure involving our Document Root Relative Folder Listing web application …
ffmpeg -f concat -safe 0 -i list.txt -r 25 -pix_fmt yuv420p output.mp4
… and from there …
<?php
if (isset($_GET['avideolist']) && isset($_GET['avideoname'])) {
$dname="input.mp4";
$_GET['avideolist']=oururlencode($_GET['avideolist']);
$themd=str_replace(",","'\nduration 10\nfile '" . $_SERVER['DOCUMENT_ROOT'], "file '" . $_SERVER['DOCUMENT_ROOT'] . str_replace('+',' ',urldecode($_GET['avideolist']))) . "'";
file_put_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace(".mp4",".vvv",str_replace('+',' ',urldecode($_GET['avideoname'])))), $themd);
exec($fconvprefix . 'ffmpeg -f concat -safe 0 -i ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace(".mp4",".vvv",str_replace('+',' ',urldecode($_GET['avideoname'])))) . ' -r 25 -pix_fmt yuv420p ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['avideoname']))));
$hsofar="<html><body><video controls><source src=\"/tmp/" . basename(str_replace('+',' ',urldecode($_GET['avideoname']))) . "\" type=\"video/mp4\" data-base=data:video/mp4;base64," . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['avideoname']))))) . "></source></video></body></html>";
unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace(".mp4",".vvv",str_replace('+',' ',urldecode($_GET['avideoname'])))));
if (4 == 4) {
header('Content-Type: video/mp4');
header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Length: ' . strlen(file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['avideoname']))))));
header("Content-Disposition: inline; filename=" . $dname);
echo file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['avideoname']))));
unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['avideoname']))));
exit;
} else {
echo $hsofar;
$thingtoattendto=$_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['avideoname'])));
register_shutdown_function('shutdown');
//sleep(45);
//unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['avideoname']))));
shutdown() and exit;
}
}
?>
…implied by the code above … and here it …
… means by which we can offer a Video “assembly” now in the “eleventh draft” one_line_find.php Document Root Relative Folder Listing web application you can “crank up” below, yet again, if you, and your ilk, along with their family and friends, girls and boys, cousins and removalists (to get rid of those pesky second ones), Martians with visas, commentators and audience, filibusters and crime busters and ghost busters, attendees and abstainers, townfolk and countryfolk alike, like.
Previous relevant Document Root Relative Folder Listing Links Animated GIF Tutorial is shown below.
Document Root Relative Folder Listing Links Animated GIF Tutorial
We continue on from yesterday’s PHP Javascript Ajax Asynchronous Sleep Cleanup Tutorial “useful sidestep”, to add to the current crop of “assemblies” …
… “assembly” functionality, turning back to ImageMagick‘s brilliant “convert” command line command idea …
… used within the procedure involving our Document Root Relative Folder Listing web application …
convert -delay 1000 -loop 0 [space delimited list of image filenames] output.gif
… and from there …
<?php
if (isset($_GET['agiflist']) && isset($_GET['agifname'])) {
$dname="input.gif";
$_GET['agiflist']=oururlencode($_GET['agiflist']);
$dname=explode('.', basename(explode(',', str_replace('+',' ',urldecode($_GET['agiflist'])))[0]))[0] . '_et-al_' . sizeof(explode(',',str_replace('+',' ',urldecode($_GET['agiflist'])))) . '.gif';
file_put_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace(".gif",".uuu",str_replace('+',' ',urldecode($_GET['agifname'])))), str_replace(","," " . $_SERVER['DOCUMENT_ROOT'], $_SERVER['DOCUMENT_ROOT'] . str_replace('+',' ',urldecode($_GET['agiflist']))));
exec($convprefix . 'convert -delay 1000 -loop 0 ' . file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace(".gif",".uuu",str_replace('+',' ',urldecode($_GET['agifname']))))) . ' ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['agifname']))));
$hsofar="<html><body><img src=\"/tmp/" . basename(str_replace('+',' ',urldecode($_GET['agifname']))) . "\" data-base=data:image/gif;base64," . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['agifname']))))) . "></img></body></html>";
unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace(".gif",".uuu",str_replace('+',' ',urldecode($_GET['agifname'])))));
if (4 == 4) {
header('Content-Type: image/gif');
header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Length: ' . strlen(file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['agifname']))))));
header("Content-Disposition: inline; filename=" . $dname);
echo file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['agifname']))));
unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['agifname']))));
exit;
} else {
echo $hsofar;
$thingtoattendto=$_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['agifname'])));
register_shutdown_function('shutdown');
//sleep(45);
//unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['agifname']))));
shutdown() and exit;
}
}
?>
…implied by the code above … and here it …
… means by which we can offer an Animated GIF “assembly” now in the “tenth draft” one_line_find.php Document Root Relative Folder Listing web application you can “crank up” below, yet again, if you, and your ilk, along with their family and friends, girls and boys, cousins and removalists (to get rid of those pesky second ones), Martians with visas, commentators and audience, filibusters and crime busters, townfolk and countryfolk alike, like.
Previous relevant PHP Javascript Ajax Asynchronous Sleep Cleanup Tutorial is shown below.
PHP Javascript Ajax Asynchronous Sleep Cleanup Tutorial
Yesterday’s Document Root Relative Folder Listing Links Caption Tutorial work had within it’s changes features to do with …
… issues where in the past we may have resorted to a …
… and for security purposes that PHP solution is best done using a form method=POST methodology, or, as we are sprouting here today (and we like a lot, and think it could help us out later with other such scenarios) … and our apologies for the tautology …
… thinking we start explaining at the changed Javascript Ajax (to the original block of code) as per …
<?php echo ”
var gincv='', ganidn='';
function ajaxpdfit(incv) {
if (4 == 4) {
var anidn='' + incv.replace(/\\\\/g,'/').split(',')[0].split('/')[eval(-1 + incv.replace(/\\\\/g,'/').split(',')[0].split('/').length)].split('.')[0] + '_et-al_' + incv.split(',').length; // + '.pdf';
if (pdfwoo) {
if (!pdfwoo.closed) { pdfwoo.close(); pdfwoo=null; } else { pdfwoo.close(); pdfwoo=null; }
}
if (pptxwoo) {
if (!pptxwoo.closed) { pptxwoo.close(); pptxwoo=null; } else { pptxwoo.close(); pptxwoo=null; }
}
if (mswoo) {
if (!mswoo.closed) { mswoo.close(); mswoo=null; } else { mswoo.close(); mswoo=null; }
}
//incv=incv.replace(/\~\~/g, String.fromCharCode(92) + String.fromCharCode(10)); // new idea
if (('' + document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(incv) + '&apdfname=' + encodeURIComponent(anidn + '.pdf')).length > 800) {
pdfzhr = new XMLHttpRequest();
pdfzform = new FormData();
pdfzform.append('anidnlist', incv);
pdfzform.append('anidn', anidn + '.abc');
//pdfzhr.onreadystatechange=noNeedToHangAround;
pdfzhr.open('post', './one_line_find.php', true);
pdfzhr.send(pdfzform);
ganidn=anidn;
gincv=noh(incv); // strips out any hashtagged caption data
setTimeout(function(){
pdfwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(gincv) + '&apdfname=' + encodeURIComponent(ganidn + '.pdf'),'_blank','top=20,left=' + eval(-700 + screen.width) + ',width=700,height=700');
pdfwoo.document.title='PDF (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
pptxwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?applist=' + encodeURIComponent(gincv) + '&appname=' + encodeURIComponent(ganidn + '.pptx'),'_blank','top=' + eval(-400 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
pptxwoo.document.title='PowerPoint (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
mswoo=window.open(document.URL.split('?')[0].split('#')[0] + '?amslist=' + encodeURIComponent(gincv) + '&amsname=' + encodeURIComponent(ganidn + '.docx'),'_blank','top=' + eval(-200 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
mswoo.document.title='Word (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
}, 5000);
} else {
pdfwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(incv) + '&apdfname=' + encodeURIComponent(anidn + '.pdf'),'_blank','top=20,left=' + eval(-700 + screen.width) + ',width=700,height=700');
pdfwoo.document.title='PDF (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
pptxwoo=window.open(document.URL.split('?')[0].split('#')[0] + '?applist=' + encodeURIComponent(incv) + '&appname=' + encodeURIComponent(anidn + '.pptx'),'_blank','top=' + eval(-400 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
pptxwoo.document.title='PowerPoint (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
mswoo=window.open(document.URL.split('?')[0].split('#')[0] + '?amslist=' + encodeURIComponent(incv) + '&amsname=' + encodeURIComponent(anidn + '.docx'),'_blank','top=' + eval(-200 + screen.height) + ',left=' + eval(-500 + screen.width) + ',width=300,height=200');
mswoo.document.title='Word (if not appearing try Download icon at top right and try opening via Open As from Downloads folder newest file)';
}
} else if (4 == 46) {
document.getElementById('apdflist').value=incv;
document.getElementById('apdfname').value='pdf' + Math.floor(Math.random() * 19897654) + '.pdf';
document.getElementById('thepdf').style.display='block';
document.getElementById('pdfsub').click();
} else if (4 == 47) {
document.getElementById('thepdf').style.display='block';
document.getElementById('thepdf').src=document.URL.split('?')[0].split('#')[0] + '?apdflist=' + encodeURIComponent(incv) + '&apdfname=' + encodeURIComponent('pdf' + Math.floor(Math.random() * 19897654) + '.pdf');
} else {
pdfzhr = new XMLHttpRequest();
pdfzform = new FormData();
pdfzform.append('apdflist', incv);
pdfzform.append('apdfname', 'pdf' + Math.floor(Math.random() * 19897654) + '.pdf');
pdfzhr.onreadystatechange=statePdfChanged;
pdfzhr.open('post', './one_line_find.php', true);
pdfzhr.send(pdfzform);
}
}
“; ?>
… begging the question, at least for us, being …
Well, the “A” of Ajax stands for “Asynchronous”, as a useful aspect to Javascript where logic does not have to flow from start to finish linearly, and jobs can multitask. That onreadystatechange idea analyzes what the recipient PHP replies, but in the case of a file cleanup …
<?php
$commentaries=[];
function oururlencode($instis) {
global $commentaries;
$interim=urldecode($instis);
$origim=str_replace('+',' ',$interim);
$intcs=explode(',', $interim);
$found=false;
for ($j=0; $j<sizeof($intcs); $j++) {
if ($j == 0) {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(explode('#',$intcs[$j])[0]) . '_et-al_' . sizeof($intcs) . '.abc')) {
$instis=file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(explode('#',$intcs[$j])[0]) . '_et-al_' . sizeof($intcs) . '.abc');
$interim=urldecode($instis);
$origim=str_replace('+',' ',$interim);
$intcs=explode(',', $interim);
}
}
array_push($commentaries, '');
}
for ($j=0; $j<sizeof($intcs); $j++) {
$found=false;
if (strpos($intcs[$j], '#') !== false) {
$oneword=explode(' ',trim(explode('#', $intcs[$j])[1]))[0];
if ($oneword != '' && strpos($oneword, '.') !== false && substr($oneword . ' ',0,1) == '/') {
if (strpos($origim, $oneword) != '') {
$found=true;
}
}
if ($found) {
$commentaries[$j].=' ' . str_replace("~~",chr(92) . chr(10),substr(trim(explode('#', $intcs[$j])[1]),strlen($oneword))); // fix perhaps
}
}
}
for ($j=0; $j<sizeof($intcs); $j++) {
$jj=0;
while ($commentaries[$jj] != '') {
$jj++;
}
$found=false;
if (strpos($intcs[$j], '#') !== false) {
$oneword=explode(' ',trim(explode('#', $intcs[$j])[1]))[0];
if ($oneword != '' && strpos($oneword, '.') !== false && substr($oneword . ' ',0,1) == '/') {
if (strpos($origim, $oneword) != '') {
$found=true;
}
}
if (!$found) {
$commentaries[$jj].=' ' . str_replace("~~",chr(92) . chr(10),explode('#', $intcs[$j])[1]); // fix perhaps
}
$interim=str_replace($intcs[$j],explode('#', $intcs[$j])[0],$interim);
}
}
return urlencode($interim);
}
?>
…with hashtagged caption data that made the job too long for $_GET[] based navigation from the start) can be created by our recipient PHP Ajax “called upon” … then …
<?php
if (isset($_POST['anidnlist']) && isset($_POST['anidn'])) {
file_put_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('+',' ',urldecode($_POST['anidn'])), str_replace('+',' ',urldecode($_POST['anidnlist'])));
sleep(60);
if (strpos(('' . str_replace('+',' ',urldecode($_POST['anidn'])) . '~'), '.abc~') !== false) {
unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . str_replace('+',' ',urldecode($_POST['anidn'])));
}
exit;
}
?>
… as one example of how this “PHP Javascript Ajax Asynchronous Sleep Cleanup” idea set could be implemented.
Previous relevant Document Root Relative Folder Listing Links Caption Tutorial is shown below.
Document Root Relative Folder Listing Links Caption Tutorial
After yesterday’s Document Root Relative Folder Listing Links Word Tutorial we had both …
… output document formats, created via pandoc, with the ability, in pandoc, to tailor slide “captions”, which, until today, had been hardwired to be the image slide filename.
We’ve decided to hashtag such user caption tailoring in hashtag data after the filenames passed over to the recipient PHP (which is the same as the originating PHP in “here’s looking at you” mode of thinking).
So where can the user enter these? The first option …
<?php echo ”
document.getElementById('prefix').innerHTML=document.getElementById('prefix').innerHTML.replace(':','<select ontouchstart=\"thismultiple(this);\" onmouseover=\"thismultiple(this);\" onclick=\"thismultiple(this);\" size=1 id=compsel title=\"Animated slideshow or PDF or PowerPoint or Word via slides possible selecting multiple images here.\" style=display:inline-block;width:28px; data-onblur=process(this); data-multiple><option id=firsttext onclick=addcommentary(); value=\"\">:</option></select>')
“; ?>
… of that relatively new dropdown for this is where we have decided to intervene …
<?php echo ”
var commentaries=[];
function addcommentary() {
needten=1;
var commadd=prompt('Optionally add to commentary. For new lines use ~~ characters. For multiple entries separate by , (ie. two blanks comma two blanks).', '');
if (commadd != null) {
var coms=commadd.split(' , ');
for (var ic=0; ic<coms.length; ic++) {
if (coms[ic].trim() != '') {
commentaries.push('#' + encodeURIComponent(coms[ic]));
}
}
}
}
“; ?>
And so, the “ninth draft” one_line_find.php Document Root Relative Folder Listing web application you can “crank up” below, yet again, if you, and your ilk, along with their family and friends, girls and boys, cousins and removalists (to get rid of those pesky second ones), Martians with visas, commentators and audience, townfolk and countryfolk alike, like.
Previous relevant Document Root Relative Folder Listing Links Word Tutorial is shown below.
Document Root Relative Folder Listing Links Word Tutorial
The word is, in workplaces all around Earth now, workers are unwrapping their Mars Bars and shaping to use …
Word
… huh?! Isn’t that a coincidence?! Who would have thunk it. They are constructing documents. So that being the case, do you think …
? But if not, why not?!
As such, the creation of a “Word assembly” is our “fourth cab off the rank” as an output format offered to users trying out the recent select (ie. dropdown) “assemblies” we PowerPointized yesterday with Document Root Relative Folder Listing Links PowerPoint Tutorial. We use a window.open popup again, latching onto the PHP recipient code …
<?php
$pconvprefix='/bin/';
if (file_exists('/usr/local/bin/pandoc')) {
$pconvprefix='/usr/local/bin/';
} else if (!file_exists('/bin/pandoc')) {
$pconvprefix='';
}
if (isset($_GET['amslist']) && isset($_GET['amsname'])) {
$dname="input.docx";
$themd=str_replace(",","\n" . $_SERVER['DOCUMENT_ROOT'], $_SERVER['DOCUMENT_ROOT'] . str_replace('+',' ',urldecode($_GET['amslist'])));
$thelines=explode("\n", $themd);
$themd="";
for ($i=0; $i<sizeof($thelines); $i++) {
if ($i == 0) {
$dname=explode('.', basename($thelines[$i]))[0] . '_et-al_' . sizeof($thelines) . '.docx';
}
if ($i == (-1 + sizeof($thelines))) {
$themd.='![' . basename($thelines[$i]) . "](" . $thelines[$i] . ")";
} else {
$themd.='![' . basename($thelines[$i]) . "](" . $thelines[$i] . ")\n\n---\n\n";
}
}
file_put_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace(".docx",".yyy",str_replace('+',' ',urldecode($_GET['amsname'])))), $themd);
exec($pconvprefix . 'pandoc ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace(".docx",".yyy",str_replace('+',' ',urldecode($_GET['amsname'])))) . ' -o ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['amsname']))));
$hsofar="<html><body><object data=\"/tmp/" . basename(str_replace('+',' ',urldecode($_GET['amsname']))) . "\" type=\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\" data-base=data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64," . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['amsname']))))) . "></object></body></html>";
unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace(".docx",".yyy",str_replace('+',' ',urldecode($_GET['amsname'])))));
if (4 == 4) {
header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Length: ' . strlen(file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['amsname']))))));
header("Content-Disposition: inline; filename=" . $dname);
echo file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['amsname']))));
unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['amsname']))));
exit;
} else {
echo $hsofar;
$thingtoattendto=$_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['amsname'])));
register_shutdown_function('shutdown');
//sleep(45);
//unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['amsname']))));
shutdown() and exit;
}
}
?>
… engendering that same frisson of excitement we got yesterday, with Document Root Relative Folder Listing Links PowerPoint Tutorial … as (for us here on macOS) …
pandoc presentation.md -o output.docx
… and from there …
Cute, huh?!?!
The “eighth draft” one_line_find.php Document Root Relative Folder Listing web application you can “crank up” below, yet again, if you, and your ilk, along with their family and friends, girls and boys, cousins and removalists (to get rid of those pesky second ones), Martians with visas, townfolk and countryfolk alike, like.
Previous relevant Document Root Relative Folder Listing Links PDF Tutorial is shown below.
Document Root Relative Folder Listing Links PDF Tutorial
Hopefully, all around the world, the idea of a …
PDF
… display is replacing the “paper hungry” “hardcopy printout” concept. As such, the creation of a “PDF assembly” is our “second cab off the rank” as an output format offered to users trying out the recent select (ie. dropdown) “assemblies” we started yesterday with Document Root Relative Folder Listing Links Assemblies Tutorial. We use a window.open popup again, latching onto the PHP recipient code …
<?php
$thingtoattendto='';
function shutdown() {
global $thingtoattendto;
// This is our shutdown function, in
// here we can do any last operations
// before the script is complete.
if ($thingtoattendto != '') {
sleep(145);
unlink($thingtoattendto);
}
}
$convprefix='/bin/';
if (file_exists('/usr/local/bin/convert')) {
$convprefix='/usr/local/bin/';
} else if (!file_exists('/bin/convert')) {
$convprefix='';
}
if (isset($_GET['apdflist']) && isset($_GET['apdfname'])) {
file_put_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace(".pdf",".xxx",str_replace('+',' ',urldecode($_GET['apdfname'])))), str_replace(",","\n" . $_SERVER['DOCUMENT_ROOT'], $_SERVER['DOCUMENT_ROOT'] . str_replace('+',' ',urldecode($_GET['apdflist']))));
exec($convprefix . 'convert @' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace(".pdf",".xxx",str_replace('+',' ',urldecode($_GET['apdfname'])))) . ' ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['apdfname']))));
$hsofar="<html><body><object data=\"/tmp/" . basename(str_replace('+',' ',urldecode($_GET['apdfname']))) . "\" type=\"application/pdf\" data-base=data:application/pdf;base64," . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['apdfname']))))) . "></object></body></html>";
unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace(".pdf",".xxx",str_replace('+',' ',urldecode($_GET['apdfname'])))));
if (4 == 4) {
header('Content-Type: application/pdf');
header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Length: ' . strlen(file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['apdfname']))))));
header("Content-Disposition: inline; filename=input.pdf");
echo file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['apdfname']))));
unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['apdfname']))));
exit;
} else {
echo $hsofar;
$thingtoattendto=$_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['apdfname'])));
register_shutdown_function('shutdown');
//sleep(45);
//unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "tmp" . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['apdfname']))));
shutdown() and exit;
}
}
?>
… using ImageMagick‘s brilliant “convert” command line command idea …
as the backbone as to how in the “sixth draft” one_line_find.php Document Root Relative Folder Listing web application you can “crank up” below, yet again, if you, and your ilk, along with their family and friends, townfolk and countryfolk alike, like.
Previous relevant Document Root Relative Folder Listing Links Assemblies Tutorial is shown below.
Document Root Relative Folder Listing Links Assemblies Tutorial
So far, with the Document Root Relative Folder Listing work of recent times, up until the day before yesterday’s Document Root Relative Folder Listing Links Ajax Tutorial, it’s been mainly …
To us, these are user driven (is it widgets) they create by selecting multiple media (today images, but down the line, other combinations) from the left hand table cell’s listing links. We do not ask anymore of that left hand cell’s workings, as it will get too complex, but we have a penchant for adding intelligence to hardcodings, and the hardcoding …
… is ripe for the picking, with that “just moseying along there innocently” …
… a candidate for a new multiple mode select (ie dropdown) element …
<?php echo ”
document.getElementById('prefix').innerHTML=document.getElementById('prefix').innerHTML.replace(':','<select ontouchstart=\"thismultiple(this);\" onmouseover=\"thismultiple(this);\" onclick=\"thismultiple(this);\" size=1 id=compsel title=\"Animated slideshow via slides possible selecting multiple images here.\" style=display:inline-block;width:28px; onblur=process(this); data-multiple><option value=\"\">:</option></select>')
“; ?>
… means by which a user can specify “assembly components”.
Our simplest first “cab off the rank” here is a Javascript animated sequence, so far 4 second duration slides in a slideshow popup window, as per …
<?php echo ”
var lastretval='', origprefix='', wesayso=false, needten=0, sofarval='', woo=null;
function agifit(incsv) {
if (incsv != '') {
var myimgs=incsv.split(',');
if (woo) {
if (!woo.closed) { woo=woo; } else { woo.close(); woo=null; }
}
if (!woo) {
woo=window.open('','_blank','top=50,left=50,width=800,height=800');
woo.document.write('<ht' + 'ml><he' + 'ad>' + myimgs[0] + '<ti' + 'tle></ti' + 'tle><scr' + 'ipt type=text/javascript> var jimg=0, imgs=(\"' + incsv + '\").split(String.fromCharCode(44)), kimg=eval(\"\" + imgs.length); function startit() { jimg++; jimg=eval(jimg % kimg); document.body.style.background=' + \"'url(' + imgs[jimg] + ')'\" + '; document.title=' + \"'' + imgs[jimg] + ''\" + '; document.body.style.backgroundRepeat=\"no-repeat\"; document.body.style.backgroundSize=\"contain\"; } setInterval(startit,4000); </scri' + 'pt></head><body id=xbody style=background:url(' + myimgs[0] + ');background-repeat:no-repeat;background-size:contain;></body></html>');
if (origprefix != '') { document.getElementById('prefix').innerHTML=origprefix; wesayso=true; needten=0; sofarval=''; lastretval=''; }
return woo;
}
}
needten=0;
return null;
}
function monitorsel() {
var yesdo=true;
if (needten > 10) { setTimeout(monitorsel, 2000); return ''; }
var osel=document.getElementById('compsel');
var retval='', delim='';
if (sofarval != '') { delim=','; retval=sofarval; }
for (var i=0; i<osel.length; i++) { if (osel.options[i].selected) { if (osel.options[i].value != '') { if ((',' + sofarval + ',').indexOf(',' + osel.options[i].value + ',') == -1) { retval+=delim + osel.options[i].value; delim=','; } } } }
if (document.getElementById('compsel')) {
if (retval != '') {
if (retval != '' && retval.indexOf(',') == -1) {
needten=0;
}
if (lastretval != retval) {
lastretval=retval;
sofarval=retval;
needten=0;
} else if (needten < 10) {
needten++;
} else {
yesdo=false;
needten++;
if (agifit(sofarval)) {
if (origprefix != '') { document.getElementById('prefix').innerHTML=origprefix; wesayso=true; needten=0; sofarval=''; lastretval=''; }
}
}
}
if (yesdo) { setTimeout(monitorsel, 2000); }
}
}
function thismultiple(osel) {
if (document.getElementById('lefttd').outerHTML.split('>')[0].indexOf('overflow') == -1 || wesayso) {
wesayso=false;
document.getElementById('lefttd').style.overflowY='visible';
osel.style.height='30px';
osel.setAttribute('multiple', 'true');
setTimeout(monitorsel, 2000);
}
}
function massage(tv) {
var tscnt=0, itv=0, ihis='', uids=[], addthese='';
var tlls=tv.split('<br>');
for (itv=eval(-1 + tlls.length); itv>=0; itv--) {
if (tlls[itv].indexOf(' /') != -1) {
if (document.getElementById('prefix') && !document.getElementById('compsel')) {
if (document.getElementById('prefix').innerHTML.replace('p://','s://').indexOf('s://') != -1) {
document.getElementById('prefix').innerHTML=document.getElementById('prefix').innerHTML.replace(':','<select ontouchstart=\"thismultiple(this);\" onmouseover=\"thismultiple(this);\" onclick=\"thismultiple(this);\" size=1 id=compsel title=\"Animated slideshow via slides possible selecting multiple images here.\" style=display:inline-block;width:28px; onblur=process(this); data-multiple><option value=\"\">:</option></select>')
}
}
uids=tlls[itv].split(' /');
ihis=tlls[itv].replace(tlls[itv].split(' /')[0] + ' ','');
if (eval('' + uids.length) == 3) {
ajaxs.unshift('/' + uids[2]);
//alert('0:' + outwo('/' + uids[2]) + ' ... ' + '/' + uids[2]);
if (outwo('/' + uids[2]).replace(' ','IMAGE/') == 'IMAGE/') {
addthese+='<option value=\"/' + uids[2] + '\">/' + uids[2] + '</option>';
}
if (outwo('/' + uids[2]) == 'IMAGE/' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) && 1 == 1) {
tv=tv.replace(tlls[itv].split(' /')[0] + ' ' + ihis, tlls[itv].split(' /')[0] + ' <span id=\"' + encodeURIComponent('/' + uids[2]) + '\" title=\"\" style=text-decoration:underline; onmouseover=showit(this); onmouseout=hideit(this); ontouchmove=showit(this); ontouchend=hideitlater(this); href=# data-href=\"/' + uids[2] + '\">' + ihis.split('%20-')[0].split(' -')[0] + '</span>');
} else {
tv=tv.replace(tlls[itv].split(' /')[0] + ' ' + ihis, tlls[itv].split(' /')[0] + ' <a id=\"' + encodeURIComponent('/' + uids[2]) + '\" title=\"\" target=_blank onmouseover=showit(this); onmouseout=hideit(this); ontouchmove=showit(this); ontouchend=hideitlater(this) href=\"/' + uids[2] + '\">' + ihis.split('%20-')[0].split(' -')[0] + '</a>');
}
} else {
ajaxs.unshift(ihis.split('%20-')[0].split(' -')[0]);
//alert('1:' + outwo((ihis.split('%20-')[0].split(' -')[0])) + ' ... ' + (ihis.split('%20-')[0].split(' -')[0]));
if (outwo(ihis.split('%20-')[0].split(' -')[0]).replace(' ','IMAGE/') == 'IMAGE/') {
addthese+='<option value=\"' + (ihis.split('%20-')[0].split(' -')[0]) + '\">' + (ihis.split('%20-')[0].split(' -')[0]) + '</option>';
}
if (outwo(ihis.split('%20-')[0].split(' -')[0]) == 'IMAGE/' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) && 1 == 1) {
tv=tv.replace(tlls[itv].split(' /')[0] + ' ' + ihis, tlls[itv].split(' /')[0] + ' <span id=\"' + encodeURIComponent(ihis.split('%20-')[0].split(' -')[0]) + '\" title=\"\" style=text-decoration:underline; onmouseover=showit(this); onmouseout=hideit(this); ontouchmove=showit(this); ontouchend=hideitlater(this); href=# data-href=\"' + ihis.split('%20-')[0].split(' -')[0] + '\">' + ihis.split('%20-')[0].split(' -')[0] + '</span>');
} else {
tv=tv.replace(tlls[itv].split(' /')[0] + ' ' + ihis, tlls[itv].split(' /')[0] + ' <a id=\"' + encodeURIComponent(ihis.split('%20-')[0].split(' -')[0]) + '\" title=\"\" target=_blank onmouseover=showit(this); onmouseout=hideit(this); ontouchmove=showit(this); ontouchend=hideitlater(this); href=\"' + ihis.split('%20-')[0].split(' -')[0] + '\">' + ihis.split('%20-')[0].split(' -')[0] + '</a>');
}
}
}
}
if (addthese != '') {
document.getElementById('compsel').innerHTML+=addthese;
origprefix=document.getElementById('prefix').innerHTML; //.replace(' data-multiple', ' multiple data-multiple');
}
setInterval(function(){ var onerect=document.getElementById('djc').getBoundingClientRect(), tworect=document.getElementById('jc').getBoundingClientRect(); if (Math.abs(eval(eval(('' + onerect.height) - eval('' + tworect.height)))) > 20) { document.getElementById('djc').style.height='' + tworect.height + 'px'; document.getElementById('djc').style.width='' + eval(-20 + tworect.width) + 'px'; } }, 6000);
setTimeout(doajaxs, 1000);
return tv;
}
“; ?>
… in the “fifth draft” one_line_find.php Document Root Relative Folder Listing web application you can “crank up” below, yet again, if you, and your ilk, along with their family and friends, like.
Previous relevant Document Root Relative Folder Listing Links Ajax Tutorial is shown below.
Document Root Relative Folder Listing Links Ajax Tutorial
It was “faux Ajax day” with yesterday’s Document Root Relative Folder Listing Links Before and On Click Tutorial, but today …
Howevvvvvvvver, just to confuse, there is no onmouseover involved, but the Ajax work does, at least for non-mobile users, sort of, affect display data, in that when hovering over a link, they may see within the title attribute of that link, whatevvvvvvvvver …
file "[a link href]"
… can “value add”, via Ajax logic, into the “up until now just an ls (underlying operating system command) based file listing” report.
Ajax is great here, as helping a subprocess that can be …
… supplementing the primary workflow, if you will, but probably not too impactive, we’re hoping …
<?php echo ”
var ajaxs=[], zhr=null, zform=null;
function massage(tv) {
var tscnt=0, itv=0, ihis='', uids=[];
var tlls=tv.split('<br>');
for (itv=eval(-1 + tlls.length); itv>=0; itv--) {
if (tlls[itv].indexOf(' /') != -1) {
uids=tlls[itv].split(' /');
ihis=tlls[itv].replace(tlls[itv].split(' /')[0] + ' ','');
if (eval('' + uids.length) == 3) {
ajaxs.unshift('/' + uids[2]);
if (outwo('/' + uids[2]) == 'IMAGE/' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) && 1 == 1) {
tv=tv.replace(tlls[itv].split(' /')[0] + ' ' + ihis, tlls[itv].split(' /')[0] + '	<span id=\"' + encodeURIComponent('/' + uids[2]) + '\" title=\"\" style=text-decoration:underline; onmouseover=showit(this); onmouseout=hideit(this); ontouchmove=showit(this); ontouchend=hideitlater(this); href=# data-href=\"/' + uids[2] + '\">' + ihis.split('%20-')[0].split(' -')[0] + '</span>');
} else {
tv=tv.replace(tlls[itv].split(' /')[0] + ' ' + ihis, tlls[itv].split(' /')[0] + '	<a id=\"' + encodeURIComponent('/' + uids[2]) + '\" title=\"\" target=_blank onmouseover=showit(this); onmouseout=hideit(this); ontouchmove=showit(this); ontouchend=hideitlater(this) href=\"/' + uids[2] + '\">' + ihis.split('%20-')[0].split(' -')[0] + '</a>');
}
} else {
ajaxs.unshift(ihis.split('%20-')[0].split(' -')[0]);
if (outwo(ihis.split('%20-')[0].split(' -')[0]) == 'IMAGE/' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) && 1 == 1) {
tv=tv.replace(tlls[itv].split(' /')[0] + ' ' + ihis, tlls[itv].split(' /')[0] + '	<span id=\"' + encodeURIComponent(ihis.split('%20-')[0].split(' -')[0]) + '\" title=\"\" style=text-decoration:underline; onmouseover=showit(this); onmouseout=hideit(this); ontouchmove=showit(this); ontouchend=hideitlater(this); href=# data-href=\"' + ihis.split('%20-')[0].split(' -')[0] + '\">' + ihis.split('%20-')[0].split(' -')[0] + '</span>');
} else {
tv=tv.replace(tlls[itv].split(' /')[0] + ' ' + ihis, tlls[itv].split(' /')[0] + '	<a id=\"' + encodeURIComponent(ihis.split('%20-')[0].split(' -')[0]) + '\" title=\"\" target=_blank onmouseover=showit(this); onmouseout=hideit(this); ontouchmove=showit(this); ontouchend=hideitlater(this); href=\"' + ihis.split('%20-')[0].split(' -')[0] + '\">' + ihis.split('%20-')[0].split(' -')[0] + '</a>');
}
}
}
}
setInterval(function(){ var onerect=document.getElementById('djc').getBoundingClientRect(), tworect=document.getElementById('jc').getBoundingClientRect(); if (Math.abs(eval(eval(('' + onerect.height) - eval('' + tworect.height)))) > 20) { document.getElementById('djc').style.height='' + tworect.height + 'px'; document.getElementById('djc').style.width='' + eval(-20 + tworect.width) + 'px'; } }, 6000);
setTimeout(doajaxs, 1000);
return tv;
}
function stateChanged() {
if (zhr.readyState == 4) {
if (zhr.status == 200) {
var rawhtml = zhr.response;
var spans=rawhtml.split('</span');
var ps=rawhtml.split('</p');
if (eval('' + ps.length) == 2 && eval('' + spans.length) == 2) {
document.getElementById(spans[0].split('>')[eval(-1 + spans[0].split('>').length)]).title+=ps[0].split('>')[eval(-1 + ps[0].split('>').length)];
}
setTimeout(doajaxs, 1000);
}
}
}
function doajaxs() {
var nexttogo='';
for (var ii=0; ii<ajaxs.length; ii++) {
if (nexttogo == '' && ajaxs[ii] != '') {
nexttogo=ajaxs[ii];
ajaxs[ii]='';
}
}
if (nexttogo != '') {
zhr = new XMLHttpRequest();
zform = new FormData();
zform.append('ajaxid', encodeURIComponent(nexttogo));
zform.append('ajaxurl', nexttogo);
zhr.onreadystatechange=stateChanged;
zhr.open('post', './one_line_find.php', true);
zhr.send(zform);
}
}
“; ?>
… Javascript calling logic using PHP recipient code …
<?php
if (isset($_POST['ajaxurl']) && isset($_POST['ajaxid'])) {
echo "<html><body><span>" . $_POST['ajaxid'] . '</span><p>' . str_replace($_SERVER['DOCUMENT_ROOT'],'',shell_exec('file "' . $_SERVER['DOCUMENT_ROOT'] . str_replace('+',' ',urldecode($_POST['ajaxurl'])) . '"')) . "</p></body></html>";
exit;
}
?>
… in the “fourth draft” one_line_find.php Document Root Relative Folder Listing web application you can “crank up” below, yet again, if you, and your ilk, like.
Previous relevant Document Root Relative Folder Listing Links Before and On Click Tutorial is shown below.
Document Root Relative Folder Listing Links Before and On Click Tutorial
Today’s work has an Ajax feel to it, despite the fact we use no Ajax type Javascript code, onto yesterday’s Document Root Relative Folder Listing Links Tutorial onclick event logics, we guess, because …
… calling via …
<?php echo ”
tv=tv.replace(tlls[itv].split(' /')[0] + ' ' + ihis, tlls[itv].split(' /')[0] + '	<a target="_blank" onmouseover=showit(this); onmouseout=hideit(this); ontouchmove=showit(this); ontouchend=hideitlater(this); href=\"' + ihis.split('%20-')[0].split(' -')[0] + '\">' + ihis.split('%20-')[0].split(' -')[0] + '</a>');
“; ?>
… calling on …
<?php echo ”
function showit(ioi) {
document.getElementById('mymediatr').innerHTML=mytrih;
if (ioi.outerHTML.indexOf('<span') != -1) {
outwo(ioi.getAttribute('data-href'));
} else {
outwo(ioi.href);
}
}
function hideit(ioi) {
document.getElementById('mymediatr').innerHTML=mytrih;
}
function hideitlater(ioi) {
if (2 == 5) {
setTimeout(function(){
document.getElementById('mymediatr').innerHTML=mytrih;
}, 15000);
}
}
“; ?>
Along the way we decided, in very Ajaxy thinking, on mobile, to be less disruptive with navigations after a click, so as to stay on the original webpage more often, in the “third draft” one_line_find.php Document Root Relative Folder Listing web application you can “crank up” below, yet again, if you like.
Previous relevant Document Root Relative Folder Listing Links Tutorial is shown below.
Document Root Relative Folder Listing Links Tutorial
Regular readers will “know the drill” with today’s work, on top of yesterday’s Document Root Relative Folder Listing Tutorial.
The new word in the posting title is …
Links
… and those regular readers would know …
… leaving us clueless as to what else to say … chortle, chortle?!
Also helpful would be, to our minds …
<?php
$extbit='*.[tjpmwag][xpnopaid][etgvf34]*';
?>
…to allow relatively innocent media files and PDFs reach the file listing (tweaked a bit too) now …
<?php
$resis=str_replace($_SERVER['DOCUMENT_ROOT'],'',shell_exec('ls -lhgo ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $offdr . $extbit));
?>
… in the “second draft” one_line_find.php Document Root Relative Folder Listing web application you can “crank up” below, again, if you like.
Previous relevant Document Root Relative Folder Listing Tutorial is shown below.
Document Root Relative Folder Listing Tutorial
The Apache web server has, for it’s PHP environment, if that is it’s server language, the concept of …
Document Root
… so that, for the website of the webpage you are reading from now, a URL such as our RJM Programming’s Landing Page’s URL …
https://www.rjmprogramming.com.au/
… scours that Document Root folder to find the index.php webpage code to display that Landing Page.
You can “abstract”, and we do also with our Difference Reporting, what that Document Root is as a folder path … bit forlorn we know, as we’ve shown what it is, probably, in many tutorial images … but the thing here is that a URL such as …
/index.php
… is understood and gets you to our Landing Page as well, because to the public, Document Root is the limit of where they are allowed to surf … if you like Document Root is the left hand beach flag at Surfers Paradise (or perhaps the right hand beach flag in the Todd River … when it gets water, that is?!).
Okay, that’s one theme of today’s new PHP web application. The other we wrote out to ourself was …
… as a presentation idea whereby just the one table row of data is used to present …
*.txt
… as the input data, to the output data that is …
The concept of “one table row” for a multiple file listing is a mute point, but in our defence …
This was a PHP project definitely needing the mildly better outcomes of PHP shell_exec (where multiple line outputs are possible) as distinct from exec where only the last output line is returned, but is the usual method we use around here.
Keeping the report to one row also asks for …
function resizeSelect(sel) { // thanks to https://www.google.com/search?q=make+select+element+width+in+sympathy+with+length+of+its+value&rlz=1C5OZZY_en&oq=make+select+element+width+in+sympathy+with+length+of+its+value&gs_lcrp=EgZjaHJvbWUyBggAEEUYOdIBCTI3MzEzajBqNKgCALACAQ&sourceid=chrome&ie=UTF-8
// 1. Create a temporary span to measure text width
var tempSpan = document.createElement('span');
tempSpan.style.visibility = 'hidden';
tempSpan.style.position = 'absolute';
tempSpan.style.whiteSpace = 'pre';
// 2. Set font styles to match the select box
tempSpan.style.font = window.getComputedStyle(sel).font;
// 3. Set content to selected text
tempSpan.innerText = sel.options[sel.selectedIndex].text;
document.body.appendChild(tempSpan);
// 4. Update width (with extra space for the dropdown arrow)
sel.style.width = (tempSpan.offsetWidth + 30) + 'px';
document.body.removeChild(tempSpan);
}
… in the “proof of concept” one_line_find.php first draft Document Root Relative Folder Listing web application you can “crank up” below if you like …
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.