ERROR in Nesting. Depth -1 from %s, %s: %d [%s]
", $file, $func, $line, $msg); } $func_elapsed = sprintf("%9.4f", $elapsed - $timeFuncs[$nest]); break; default: $flag = 1; $pre = " | "; break; } if (strlen($AppRoot) && strpos($file, $AppRoot) >= 0) { $file = substr($file, strlen($AppRoot)); } // if ($nest < 0) // $nest = 0; // + Elapsed, // | + Function Elapsed // | | +tag, +nest, // | | | | +type, // | | | | | +timestamp, // | | | | | | +file, +line, // | | | | | | | | +whitespace // | | | | | | | | | +flag // | | | | | | | | | | +function, // | | | | | | | | | | | +user text. $o = sprintf("%9.4f, %9s, %03d, %2d, %s, %s, %-26s, %5s, %s%s%-24s, %s", $elapsed, $func_elapsed, $tag, $nest, $flag, date("H:i.s"), $file, $line, str_repeat(" ",$nest), $pre, $func, $msg); // Uncomment these when you need to see the details from the command line, but don't // want to generate the tracefile. // //if (!count($_SESSION)) // && $flag == TR_ENTRY) // zero if running from a command shell // printf("%s\n", $o); if (TRACELOG) { $fh = @fopen(TRACEPATH . "/" . TRACEFILE, "at"); if ($fh) { if ($flag == TR_ENTRY && $func == "") fprintf($fh, "\r\n\r\n"); fprintf($fh, "%s\n", $o); fclose($fh); } else { echo "Configuration Error, cannot write to trace file [" . TRACEPATH ."/" . TRACEFILE . "\n"; } } // Track the stack depth if ($flag == TR_ENTRY) $nest++; } function deleteFilesWithWildcard($directory, $pattern) { TraceProgram(__FILE__, __FUNCTION__, __LINE__, "del($directory, $pattern)", TR_ENTRY); if (!is_dir($directory)) { throw new InvalidArgumentException("Directory does not exist: $directory"); } $searchPath = rtrim($directory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $pattern; $files = glob($searchPath); if ($files === false) { throw new RuntimeException("Error reading files with glob()"); } // Delete each file foreach ($files as $file) { if (is_file($file)) { // Ensure it's a file, not a directory if (@unlink($file)) { TraceProgram(__FILE__, __FUNCTION__, __LINE__, "Deleted $file"); } else { TraceProgram(__FILE__, __FUNCTION__, __LINE__, "Delete Failed on $file"); } } } TraceProgram(__FILE__, __FUNCTION__, __LINE__, "", TR_EXIT); } function GetFolderUp(string $path): ?string { TraceProgram(__FILE__, __FUNCTION__, __LINE__, "", TR_ENTRY); if (trim($path) === '') { // Basic validation return null; // Empty path } $normalizedPath = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $path); // Normalize slashes for cross-platform compatibility $parent = dirname($normalizedPath); // Use dirname to get one level up if ($parent === '.' || $parent === DIRECTORY_SEPARATOR) { // If dirname returns '.' for relative paths, handle it $parent = null; // No parent directory } TraceProgram(__FILE__, __FUNCTION__, __LINE__, $parent, TR_EXIT); return $parent; } function GetPrevEvent($curItem = '') { global $EventsPath, $EventFormFields; TraceProgram(__FILE__, __FUNCTION__, __LINE__, "", TR_ENTRY); $prevEvent = ''; $ref = ($curItem != '') ? $curItem : date("Y-m-d"); $events = GetDocMap($EventsPath, $EventFormFields, 'ProgramDate'); TraceProgram(__FILE__, __FUNCTION__, __LINE__, "$ref: " . print_r($events, true)); foreach (array_keys($events) as $event) { if ($ref > $event) { $prevEvent = $event; } } TraceProgram(__FILE__, __FUNCTION__, __LINE__, $prevEvent, TR_EXIT); return $prevEvent; } function GetNextEvent($curItem = '') { global $EventsPath, $EventFormFields; TraceProgram(__FILE__, __FUNCTION__, __LINE__, "", TR_ENTRY); $nextEvent = ''; $ref = ($curItem != '') ? $curItem : date("Y-m-d"); $events = GetDocMap($EventsPath, $EventFormFields, 'ProgramDate'); foreach (array_keys($events) as $event) { if ($nextEvent == '') { if (($curItem == '') && ($ref <= $event)) { $nextEvent = $event; } else if (($curItem != '') && ($ref < $event)) { $nextEvent = $event; } } } TraceProgram(__FILE__, __FUNCTION__, __LINE__, "[$nextEvent]", TR_EXIT); return $nextEvent; } function EmitForm($formFields, $formData, $pathToArtifacts, $thisItem, $showNavigation = false) { global $PlacesPath, $PlaceFormFields; global $ProgChairPath, $ProgChairFormFields; TraceProgram(__FILE__, __FUNCTION__, __LINE__, "$pathToArtifacts, $thisItem", TR_ENTRY); $CK_EditorFieldIDs = array(); $showHR = false; printf("\n", TBL_BORDER); if ($showNavigation) { $prev = GetPrevEvent($thisItem); $next = GetNextEvent($thisItem); if ($prev != '') { $linkPrev = "<=="; } else { $linkPrev = "<=="; } if ($next != '') { $linkNext = "==>"; } else { $linkNext = "==>"; } printf("\n", $linkPrev, $linkNext); $showHR = true; } foreach ($formFields as $key => $data) { if ($data['bg']) { printf("\n"); $showHR = true; } printf("\n"); printf("\t\n", $key, $data['Label']); $value = ($formData[$key]) ?? $formFields[$key]['Default']; TraceProgram(__FILE__, __FUNCTION__, __LINE__, "[$value]"); switch ($data['FieldType']) { case 'text': if ($formFields[$key]['RW'] == 'W') { printf("\n", $key, $key, $value, $formFields[$key]['Placeholder']); } else { printf("\n", $value, $key, $key, $value, $formFields[$key]['Placeholder']); } break; case 'date': printf("\n", DateToMDY($value), $key, $key, $value); } printf("\n"); break; case 'time': printf("\n", $key, $key, $value); break; case 'bool': printf("\n", $key, $key, ($value) ? "checked" : ""); break; case 'html': printf("\n", $key, $key, $value); $CK_EditorFieldIDs[] = $key; break; case 'pix': printf("\n"); break; case 'chair': TraceProgram(__FILE__, __FUNCTION__, __LINE__, "pathToArtifacts: $pathToArtifacts"); //TraceProgram(__FILE__, __FUNCTION__, __LINE__, print_r($formFields, true)); $map = GetDocMap($ProgChairPath, $ProgChairFormFields, 'ProgramChair'); TraceProgram(__FILE__, __FUNCTION__, __LINE__, print_r($map, true)); TraceProgram(__FILE__, __FUNCTION__, __LINE__, print_r($formData, true)); printf(""); break; case 'place': TraceProgram(__FILE__, __FUNCTION__, __LINE__, "pathToArtifacts: $pathToArtifacts, 'placeName'"); //TraceProgram(__FILE__, __FUNCTION__, __LINE__, print_r($formFields, true)); $map = GetDocMap($PlacesPath, $PlaceFormFields, 'PlaceName'); TraceProgram(__FILE__, __FUNCTION__, __LINE__, print_r($map, true)); TraceProgram(__FILE__, __FUNCTION__, __LINE__, print_r($formData, true)); printf(""); break; default: TraceProgram(__FILE__, __FUNCTION__, __LINE__, "unexpected path from '" . $data['FieldType'] . "'"); break; } //printf("\t\n", $data['FieldType']); printf("\n"); } ?>
%s  Navigate  %s

%s\n"); if ($formFields[$key]['RW'] == 'W') { printf("\n", $key, $key, $value, ($formFields[$key]['RW'] != 'W') ? 'disabled' : ''); } else { printf("%s\n", $key, $key, $key ); if (isset($formData[$key])) { $pix = $formData[$key]; TraceProgram(__FILE__, __FUNCTION__, __LINE__, "key: $key, " . $pix); $fqfn = ($pix != '') ? $pathToArtifacts . '/' . $pix : ''; if (!file_exists($fqfn)) { $pix = $fqfn = ''; } } else { $pix = $fqfn = ''; } TraceProgram(__FILE__, __FUNCTION__, __LINE__, "pathToArtifacts: $pathToArtifacts, fqfn: $fqfn"); printf("
Preview
\n", $key, $fqfn, ($pix == '') ? 'none' : 'block'); if ($fqfn != '') { printf("", $thisItem, $key); } //printf("\n"); printf("
\n"); printf("\n"); printf("%s

   
=> $listOfItems = array(); $folderList = glob("$path/*"); TraceProgram(__FILE__, __FUNCTION__, __LINE__, "\n$path: " . print_r($folderList, true)); foreach ($folderList as $folder) { $listOfItems[] = basename($folder); } foreach ($listOfItems as $place) { //printf("[%s][%s]
\n", $path, $place); $fqPath = sprintf("%s/%s", $path, $place); TraceProgram(__FILE__, __FUNCTION__, __LINE__, $fqPath); $success = ReadTableData($fqPath, $formFields, $tag); TraceProgram(__FILE__, __FUNCTION__, __LINE__, $success); $name = $tag[$tagOfInterest] ?? 'untitled'; $map[$place] = $name; } TraceProgram(__FILE__, __FUNCTION__, __LINE__, "", TR_EXIT); return $map; } function DateToMDY($inDate) { TraceProgram(__FILE__, __FUNCTION__, __LINE__, "[$inDate]", TR_ENTRY); if ($inDate != '') { $parts = explode("-", $inDate); $mmddyyyy = sprintf("%s/%s/%s", $parts[1], $parts[2], $parts[0]); } else { $mmddyyyy = $inDate; } TraceProgram(__FILE__, __FUNCTION__, __LINE__, $mmddyyyy, TR_EXIT); return $mmddyyyy; } function TimeTo12HR($t) { $AMPM = ''; $parts = explode(':', $t); if ($parts[0] == '00') { $parts[0] = '12'; $AMPM = 'AM'; } else if ($parts[0] > 12) { $parts[0] -= 12; $AMPM = 'PM'; } return sprintf("%s %s", implode(':', $parts), $AMPM); } function EmitPageHeader($title, $subtitle = '') { $sub = ($subtitle != '') ? "
$subtitle" : ""; echo "
logo $title $sub
Go Admin
"; } function EmitHTMLStart($title) { global $ckEditor_FQFN; ?> Admin Center \n", $ckEditor_FQFN); ?> \n"; } function EmitBodyStart() { echo "\n"; } function EmitBodyEnd() { ?> \n"; $html .= GenerateTransactionInfo(); if ($helpTag) $html .= " Need help?\n"; $html .= "\n"; return $html; } function GenerateTransactionInfo($webIF = true) { global $time_start, $AppName, $link; // Show the CPU time for the transaction $time_end = microtime(true); $time_elapsed = sprintf("%3.3f", $time_end - $time_start); return sprintf("%s App v%s, transaction completed in %s seconds.", $AppName, AppVersion, $time_elapsed); } function EmitEvent($event) { global $EventsPath, $EventFormFields; global $PlacesPath, $PlaceFormFields; $EventPath = $EventsPath .'/'. $event . '/'; $success = ReadTableData($EventPath, $EventFormFields, $evData); $evData['ProgramDate'] = $event; printf("\n", TBL_BORDER); $prev = GetPrevEvent($event); $next = GetNextEvent($event); if ($prev != '') { $linkPrev = "<=="; } else { $linkPrev = "<=="; } if ($next != '') { $linkNext = "==>"; } else { $linkNext = "==>"; } printf("\n", $linkPrev, $linkNext); foreach ($EventFormFields as $key => $data) { if ($data['bg']) { printf("\n"); } printf("\n"); printf("\t\n", $key, $data['Label']); $value = $evData[$key] ?? $EventFormFields[$key]['Default']; switch ($data['FieldType']) { case 'text': printf("\n", $value); break; case 'date': printf("\n", DateToMDY($value)); break; case 'time': printf("\n", TimeTo12HR($value)); break; case 'bool': printf("\n", $key, ($value) ? "checked" : ""); break; case 'html': printf("\n", $value); break; case 'pix': TraceProgram(__FILE__, __FUNCTION__, __LINE__, "$key, $value"); $pix = $value; $fqfn = ($pix != '') ? $EventPath . '/' . $pix : ''; TraceProgram(__FILE__, __FUNCTION__, __LINE__, "$pix, $fqfn, $EventPath"); if (file_exists($fqfn)) { TraceProgram(__FILE__, __FUNCTION__, __LINE__, "EventPath: $EventPath, fqfn: $fqfn"); printf("\n"); } break; case 'chair': printf("\n", $value); break; case 'place': $refPlaceName = $evData[$key] ?? ''; printf("\n"); break; default: break; } printf("\n"); } ?>
%s  Navigate  %s

%s%s%s%s
Preview
\n", $key, $fqfn); printf("
%s\n"); //printf("%s
", $refPlaceName); $placeHash = GetDocMap($PlacesPath, $PlaceFormFields, 'PlaceName'); //printf("
%s
", print_r($placeHash, true)); foreach ($placeHash as $folder => $placeName) { // TraceProgram(__FILE__, __FUNCTION__, __LINE__, $formData[$key] . ", $folder => $placeName"); if ($placeName == $refPlaceName) { //printf("%s, %s
", $placeName, $folder); EmitPlace($folder); } } printf("
%s\n", print_r($evData, true)); printf("%s
%s
\n", $evData['PlaceName'], $evData['PlaceAddress']); $imgFQFN = sprintf("%s/%s/%s", $PlacesPath, $place, $evData['PlacePix']); printf("\n", $imgFQFN); } } /// EmitAdminFormType1 /// /// This is in the Editor_Event.php at the top of the file. /// /// This is the admin event manager form /// New item: [date picker] Pick Place: [Pick list] Pick Chair: [Pick list] /// Edit item: [Pick list] /// [Submit] [Reset] /// EmitAdminFormType2 /// /// Emit a small form for the Admin page /// New item: [ free form text ] /// Edit item: [ selection list ] /// [Submit] [Reset] /// Validate that the form is not empty in order to accept it. /// function EmitAdminFormType2($args) { TraceProgram(__FILE__, __FUNCTION__, __LINE__, "", TR_ENTRY); ?>
' onsubmit='return validateMyForm(event,this);' > ' />
' id='inp1' value='' size='50' />