App: apps - Page: browse
PHP
browse.php
|
HTML
browse.pad
|
Result
|
<?php
$title = 'Browse Application';
// Get the apps directory $appsDir = dirname(APP) . '/';
// Get requested app, directory and file from query string $app = $_GET['app'] ?? ''; $dir = $_GET['dir'] ?? ''; $file = $_GET['file'] ?? '';
$appPath = ''; $appDirs = []; $appFiles = []; $source = ''; $currentFile = ''; $parentDir = '';
// Validate app name (security: prevent directory traversal) if ($app && preg_match('/^[a-zA-Z0-9_-]+$/', $app)) {
$appPath = $appsDir . $app . '/';
if (is_dir($appPath)) {
$title = "Browse: $app";
// Validate and set current directory $currentDir = $appPath; if ($dir && preg_match('/^[a-zA-Z0-9_\-\/]+$/', $dir)) { $testPath = $appPath . $dir . '/'; if (is_dir($testPath) && strpos(realpath($testPath), realpath($appPath)) === 0) { $currentDir = $testPath; $title = "Browse: $app/$dir";
// Calculate parent directory if (strpos($dir, '/') !== false) { $parentDir = dirname($dir); } else { $parentDir = ''; } } } elseif ($dir) { // Invalid dir, reset $dir = ''; }
// Scan current directory for files and subdirectories $items = scandir($currentDir);
foreach ($items as $item) { // Skip hidden files and . / .. if ($item[0] === '.') continue;
$itemPath = $currentDir . $item; $relativePath = ($dir ? $dir . '/' : '') . $item;
if (is_dir($itemPath)) { $appDirs[] = [ 'name' => $item, 'path' => $relativePath ]; } else { $ext = pathinfo($item, PATHINFO_EXTENSION); // Only show source files if (in_array($ext, ['php', 'pad', 'json', 'xml', 'html', 'js', 'css'])) { $appFiles[] = [ 'path' => $relativePath, 'name' => $item, 'ext' => $ext ]; } } }
// Sort directories and files by name usort($appDirs, function($a, $b) { return strcasecmp($a['name'], $b['name']); }); usort($appFiles, function($a, $b) { return strcasecmp($a['name'], $b['name']); });
// If a file is requested, load its source if ($file && preg_match('/^[a-zA-Z0-9_\-\/\.]+$/', $file)) { $filePath = $appPath . $file;
if (file_exists($filePath) && strpos(realpath($filePath), realpath($appPath)) === 0) { $currentFile = $file; $source = padColorsFile($filePath); } } } }
$dirCount = count($appDirs); $fileCount = count($appFiles); $hasParent = ($dir !== '');
?>
|
<style> .browse-page { text-align: left; display: inline-block; } .browse-container { display: flex; gap: 20px; } .file-list { min-width: 150px; } .file-list ul { list-style: none; padding: 0; margin: 0; } .file-list li { padding: 2px 0; } .file-list a { text-decoration: none; } .file-list a:hover { text-decoration: underline; } .file-list .current { font-weight: bold; } .file-list .dir { font-weight: bold; } .file-list .parent a { font-size: 1.4em; font-weight: bold; } .source-view { overflow-x: auto; } .source-view pre { background: #f8f8f8; padding: 10px; border: 1px solid #ddd; margin: 0; } .back-link { margin-bottom: 10px; } .path-info { color: #666; margin-bottom: 5px; } </style>
<div class="browse-page">
{if $app ne ''}
<div class="browse-container">
<div class="file-list"> <ul> {if $hasParent} <li class="parent"> {if $parentDir ne ''} <a href="?browse&app={$app}&dir={$parentDir}">..</a> @else@ <a href="?browse&app={$app}">..</a> {/if} </li> {/if} {appDirs} <li class="dir"><a href="?browse&app={$app}&dir={$path}">{$name}/</a></li> {/appDirs} {appFiles} {if $currentFile eq $path} <li class="current">{$name}</li> {/if} {if $currentFile ne $path} <li><a href="?browse&app={$app}&dir={$dir}&file={$path}">{$name}</a></li> {/if} {/appFiles} </ul> </div>
{if $currentFile ne ''} <div class="source-view"> <h3>{$currentFile}</h3> {!source} </div> {/if}
</div>
{/if}
{if $app eq ''} <p>No application specified. <a href="?index">Return to applications list</a>.</p> {/if} </div>
|
|
App: sequence - Page: check/if
PHP
|
HTML
check/if.pad
|
Result
|
|
{sequence '5;10;15;20', name='q1'} {sequence '15;20;25;30', name='q2'} {sequence '15;20', name='q3'}
{if q3 eq sequence:intersection ( q1, q2 )} ok @else@ nok {/if} {if q3 eq sequence:intersection ( q1, [15,20,25,30] )} ok @else@ nok {/if} {if q3 eq sequence:intersection ( [5,10,15,20], q2 )} ok @else@ nok {/if} {if q3 eq sequence:intersection ( [5,10,15,20], [15,20,25,30] )} ok @else@ nok {/if}
{if q3 ne sequence:intersection ( q1, q2 )} nok @else@ ok {/if} {if q3 ne sequence:intersection ( q1, [15,20,25,30] )} nok @else@ ok {/if} {if q3 ne sequence:intersection ( [5,10,15,20], q2 )} nok @else@ ok {/if} {if q3 ne sequence:intersection ( [5,10,15,20], [15,20,25,30] )} nok @else@ ok {/if}
<hr>
{sequence '3..5', name='abc'}
{if 4 in abc } ok @else@ nok {/if} {if 6 in abc } nok @else@ ok {/if}
<hr>
{if 3 eq sequence:count(abc)} ok @else@ nok {/if} {if sequence:count(abc) eq 4} nok @else@ ok {/if}
<hr>
{if 3 in sequence:count(abc)} ok @else@ nok {/if} {if 4 in sequence:count(abc)} nok @else@ ok {/if}
{sequence '8..10', name='q1'} {sequence '1..10', name='q2'}
<hr>
{if q1 eq sequence:last(q2,3)} ok @else@ nok {/if} {if q1 ne sequence:last(q2,3)} nok @else@ ok {/if}
<hr>
{if [9,10] ne sequence:last ( q2, 2) } nok @else@ ok {/if} {if [8,9] eq sequence:last ( [7,8,9], 2) } ok @else@ nok {/if}
|
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
|
App: demo - Page: clock
PHP
|
HTML
clock.pad
|
Result
|
|
<p>Current date and time information.</p>
<h2>Current Time</h2>
<div class="counter" style="font-size: 36px;"> {clock 'l, F j, Y'}<br> {clock 'g:i:s A'} </div>
<h2>Time Formats</h2>
<table> <tr> <th>Format</th> <th>Value</th> </tr> <tr> <td>12-hour format</td> <td>{clock 'g:i:s A'}</td> </tr> <tr> <td>24-hour format</td> <td>{clock 'H:i:s'}</td> </tr> <tr> <td>ISO 8601</td> <td>{clock 'c'}</td> </tr> <tr> <td>RFC 2822</td> <td>{clock 'r'}</td> </tr> <tr> <td>Unix Timestamp</td> <td>{clock 'U'}</td> </tr> </table>
<h2>Calendar Information</h2>
<table> <tr> <th>Property</th> <th>Value</th> </tr> <tr> <td>Day of Week</td> <td>{clock 'l'}</td> </tr> <tr> <td>Month</td> <td>{clock 'F'}</td> </tr> <tr> <td>Year</td> <td>{clock 'Y'}</td> </tr> <tr> <td>Day of Year</td> <td>{clock 'z' | + 1} of {if {clock 'L'} eq 1}366@else@365{/if}</td> </tr> <tr> <td>Week of Year</td> <td>{clock 'W'}</td> </tr> <tr> <td>Days in This Month</td> <td>{clock 't'}</td> </tr> <tr> <td>Days Remaining in Year</td> <td>{if {clock 'L'} eq 1}{echo 365 - {clock 'z'}}@else@{echo 364 - {clock 'z'}}{/if}</td> </tr> <tr> <td>Leap Year</td> <td>{if {clock 'L'} eq 1}Yes@else@No{/if}</td> </tr> <tr> <td>Timezone</td> <td>{date_default_timezone_get}</td> </tr> </table>
|
Current date and time information.
Current Time
Sunday, January 18, 2026
9:01:49 AM
Time Formats
| Format |
Value |
| 12-hour format |
9:01:49 AM |
| 24-hour format |
09:01:49 |
| ISO 8601 |
2026-01-18T09:01:49+00:00 |
| RFC 2822 |
Sun, 18 Jan 2026 09:01:49 +0000 |
| Unix Timestamp |
1768726909 |
Calendar Information
| Property |
Value |
| Day of Week |
Sunday |
| Month |
January |
| Year |
2026 |
| Day of Year |
18 of 365 |
| Week of Year |
03 |
| Days in This Month |
31 |
| Days Remaining in Year |
347 |
| Leap Year |
No |
| Timezone |
UTC |
|
App: manual - Page: constructs/else_1
| HTML |
RESULT |
{if 2 > 1} true @else@ false {/if}
| true | {if 1 > 2} true @else@ false {/if}
| false |
App: manual - Page: constructs/else_2
| HTML |
RESULT |
{data 'myArray1'} [1,2,3] {/data}
| | {myArray1} Occurence {$myArray1} <br> @else@ No occurences {/myArray1}
| Occurence 1
Occurence 2
Occurence 3
| {data 'myArray2'} [] {/data}
| | {myArray2} Occurence {$myArray2} <br> @else@ Nothing to see here {/myArray2}
| Nothing to see here |
App: manual - Page: constructs/else_4
PHP
constructs/else_4.php
|
HTML
constructs/else_4.pad
|
Result
|
<?php
$myVar = FALSE;
?>
|
{myVar} true @else@ false {/myVar}
|
false
|
App: manual - Page: content/5
| HTML |
RESULT |
{content 'myContent'} This is the true content. <br> @else@ This is the false content. <br> {/content}
| | {true content='myContent', merge='replace'} This is the true base content <br> @else@ This is the false base content <br> {/true}
| This is the true content.
| {true content='myContent', merge='top'} This is the true base content <br> @else@ This is the false base content <br> {/true}
| This is the true content.
This is the true base content
| {true content='myContent', merge='bottom'} This is the true base content <br> @else@ This is the false base content <br> {/true}
| This is the true base content
This is the true content.
| {false content='myContent', merge='replace'} This is the true base content <br> @else@ This is the false base content <br> {/false}
| This is the false content.
| {false content='myContent', merge='top'} This is the true base content <br> @else@ This is the false base content <br> {/false}
| This is the false content.
This is the false base content
| {false content='myContent', merge='bottom'} This is the true base content <br> @else@ This is the false base content <br> {/false}
| This is the false base content
This is the false content.
|
App: manual - Page: content/7
| HTML |
RESULT |
{content 'myContent'} true: This is the @content@ content. <br> @else@ false: This is the @content@ content. <br> {/content}
| | {true content='myContent'} true @else@ false {/true}
| true: This is the
true
content.
| {false content='myContent'} true @else@ false {/false}
| false: This is the
false
content.
|
| HTML |
RESULT |
{content 'myContent'} true @else@ false {/content}
| | {true content='myContent'} true: This is the @content@ content. <br> @else@ false: This is the @content@ content. <br> {/true}
| true: This is the
true
content.
| {false content='myContent'} true: This is the @content@ content. <br> @else@ false: This is the @content@ content. <br> {/false}
| false: This is the
false
content.
|
App: check - Page: db/array
PHP
db/array.php
|
HTML
db/array.pad
|
Result
|
<?php
$array_1 = db ("array name, phone from staff where phone like '%4%'");
$array_2 = db ("array * from staff where name like '%x%'");
?>
|
<h3>array, found</h3>
<table border=1> {array_1} <tr> <td>{$name}</td> <td>{$phone}</td> </tr> @else@ <tr> <td>Nothing</td> <td>Found</td> </tr> {/array_1} </table>
<h3>array, no records found</h3>
<table border=1> {array_2} <tr> <td>{$name}</td> <td>{$phone}</td> </tr> @else@ <tr> <td>Nothing</td> <td>Found</td> </tr> {/array_2} </table>
|
array, found
| bob |
555-3425 |
| jim |
555-4364 |
| joe |
555-3422 |
| jerry |
555-4973 |
array, no records found
|
App: check - Page: db/array2
PHP
|
HTML
db/array2.pad
|
Result
|
|
<h3>array, found</h3>
<table border=1> {array "name, phone from staff where phone like '%4%'"} <tr> <td>{$name}</td> <td>{$phone}</td> </tr> @else@ <tr> <td>Nothing</td> <td>Found</td> </tr> {/array} </table>
<h3>array, no records found</h3>
<table border=1> {array "* from staff where name like '%x%'"} <tr> <td>{$name}</td> <td>{$phone}</td> </tr> @else@ <tr> <td>Nothing</td> <td>Found</td> </tr> {/array} </table>
|
array, found
| bob |
555-3425 |
| jim |
555-4364 |
| joe |
555-3422 |
| jerry |
555-4973 |
array, no records found
|
App: check - Page: db/check
PHP
db/check.php
|
HTML
db/check.pad
|
Result
|
<?php
$check_1 = db ("check staff where name = 'jim'");
$check_2 = db ("check staff where name = 'john'");
?>
|
<h3>check, found</h3>
{if $check_1} <p>Jim works here</p> @else@ <p>Jim does not work here</p> {/if}
<h3>check, not found</h3>
{if $check_2} <p>John works here</p> @else@ <p>John does not work here</p> {/if}
|
check, found
Jim works here
check, not found
John does not work here
|
App: check - Page: db/check2
PHP
|
HTML
db/check2.pad
|
Result
|
|
<h3>check, found</h3>
{check "staff where name = 'jim'"} <p>Jim works here</p> @else@ <p>Jim does not work here</p> {/check}
<h3>check, not found</h3>
{check "staff where name = 'john'"} <p>John works here</p> @else@ <p>John does not work here</p> {/check}
|
check, found
Jim works here
check, not found
John does not work here
|
App: check - Page: db/record
PHP
db/record.php
|
HTML
db/record.pad
|
Result
|
<?php
$record_1 = db ("record * from staff where name = 'jim'");
$record_2 = db ("record * from staff where name = 'john'");
?>
|
<h3>record, found</h3> {record_1} <p>Jim's phone number is {$phone},<br> his salary is {$salary}</p> @else@ <p>Jim does not work here</p> {/record_1}
<h3>record, not found</h3> {record_2} <p>John's phone number is {$phone},<br> his salary is {$salary}</p> @else@ <p>John does not work here</p> {/record_2}
|
record, found
Jim's phone number is 555-4364,
his salary is 2000.00
record, not found
John does not work here
|
App: check - Page: db/record2
PHP
|
HTML
db/record2.pad
|
Result
|
|
<h3>record, found</h3> {record "* from staff where name = 'jim'"} <p>Jim's phone number is {$phone}, his salary is {$salary}</p> @else@ <p>Jim does not work here</p> {/record}
<h3>record, not found</h3> {record "* from staff where name = 'john'"} <p>John's phone number is {$phone}, his salary is {$salary}</p> @else@ <p>John does not work here</p> {/record}
|
record, found
Jim's phone number is 555-4364, his salary is 2000.00
record, not found
John does not work here
|
App: check - Page: functions/between
PHP
|
HTML
functions/between.pad
|
Result
|
|
{if 10 range (20, 40) } NOK @else@ ok {/if} {if 20 range (20, 40) } ok @else@ NOK {/if} {if 30 range (20, 40) } ok @else@ NOK {/if} {if 40 range (20, 40) } ok @else@ NOK {/if} {if 50 range (20, 40) } NOK @else@ ok {/if}
|
ok
ok
ok
ok
ok
|
|