0) { $strSelection = urldecode($strSelection); $strFileData = file_get_contents("{$strQueryDir}/{$strSelection}"); // Get the inputs: preg_match_all( "/declare\s+\@([A-Za-z0-9]{1,})\s+(.+)\s+=\s+\?;(\s+-- Default\:\s(.*))?/i", $strFileData, $varInputs); //Respond::json($varInputs); // Get the options defined in comments: preg_match_all( "/--\s+([A-Za-z0-9]{1,})\:\s+(.+)/i", $strFileData, $varOptionMatches); if (count($varOptionMatches[0]) > 0) { for ($i = 0; $i < count($varOptionMatches[0]); $i++) { $strKey = strtolower($varOptionMatches[1][$i]); $strValue = $varOptionMatches[2][$i]; $varOptions[$strKey] = $strValue; } } if (array_key_exists("allow", $varOptions)) { $intAllowed = 0; $strAllowedObjects = strtolower($varOptions["allow"]); $varAllowedObjects = explode(",", $strAllowedObjects); $varUserObjects = []; if (class_exists("UserAuth")) { $varUser = UserAuth::getUser(); if ($varUser !== null) { foreach (UserAuth::getUserGroups() as $strGroup) $varUserObjects[] = strtolower($strGroup); $varUserObjects[] = strtolower($varUser["cn"]); } } foreach ($varAllowedObjects as $strObject) if (in_array($strObject, $varUserObjects)) $intAllowed = 1; } $intRun = Request::getParam("run"); //if (Request::posts("run_query")) if ($intRun !== null && $intRun == 1 && $intAllowed == 1) { $varPosted = Request::getParams(); unset($varPosted["run"]); try { $varRows = $c->query("{$strQueryDir}/{$strSelection}", $varPosted); $strView = "files/views/{$strSelection}.php"; // Load a custom view if there is one: if (file_exists($strView)) { ob_clean(); require $strView; ob_end_flush(); exit; } } catch (Exception $x) { $strMessage = $x->getMessage(); $strError = $strMessage; $strError .= "\n\n"; $strFile = $x->getFile(); $intLine = $x->getLine(); $strError .= "#-1 {$strFile}({$intLine}): {$strMessage}\n"; $strError .= $x->getTraceAsString(); } } } // Fancier title processing: $strTitle = null; if (array_key_exists("title", $varOptions)) $strTitle = $varOptions["title"]; $strTitle = $strTitle ?? $strSelection ?? "Report"; ?> <?= $strTitle; ?>
No rows returned.
:
0): ?> 0) $strInputDefaultValue = $varInputs[4][$i]; ?>
The selected report requires being logged in as a user with permission to run it.
0): ?> $v) $varColumns[] = $k; ?>

    $v): ?>
  • :
  • Printed:
0) $strCellClass = $strRowClass; if (strlen($strNextCellClass) > 0) $strCellClass = $strNextCellClass; // Allow SQL data to controll next cell class with _next_cell_class column: if (preg_match("/^_next_cell_class/i", $col)) $strNextCellClass = $r[$col]; // Hide columns that begin with underscore: if ($col[0] == "_") continue; ?>
0): ?>