/** * Searches for a named database object */ function doFind($confirm = true, $msg = '') { global $data, $misc; global $lang, $conf; if (!isset($_REQUEST['term'])) { $_REQUEST['term'] = ''; } if (!isset($_REQUEST['filter'])) { $_REQUEST['filter'] = ''; } $misc->printTrail('database'); $misc->printTabs('database', 'find'); $misc->printMsg($msg); echo "<form action=\"database.php\" method=\"post\">\n"; echo "<p><input name=\"term\" value=\"", htmlspecialchars($_REQUEST['term']), "\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" />\n"; // Output list of filters. This is complex due to all the 'has' and 'conf' feature possibilities echo "<select name=\"filter\">\n"; echo "\t<option value=\"\"", $_REQUEST['filter'] == '' ? ' selected="selected"' : '', ">{$lang['strallobjects']}</option>\n"; echo "\t<option value=\"SCHEMA\"", $_REQUEST['filter'] == 'SCHEMA' ? ' selected="selected"' : '', ">{$lang['strschemas']}</option>\n"; echo "\t<option value=\"TABLE\"", $_REQUEST['filter'] == 'TABLE' ? ' selected="selected"' : '', ">{$lang['strtables']}</option>\n"; echo "\t<option value=\"VIEW\"", $_REQUEST['filter'] == 'VIEW' ? ' selected="selected"' : '', ">{$lang['strviews']}</option>\n"; echo "\t<option value=\"SEQUENCE\"", $_REQUEST['filter'] == 'SEQUENCE' ? ' selected="selected"' : '', ">{$lang['strsequences']}</option>\n"; echo "\t<option value=\"COLUMN\"", $_REQUEST['filter'] == 'COLUMN' ? ' selected="selected"' : '', ">{$lang['strcolumns']}</option>\n"; echo "\t<option value=\"RULE\"", $_REQUEST['filter'] == 'RULE' ? ' selected="selected"' : '', ">{$lang['strrules']}</option>\n"; echo "\t<option value=\"INDEX\"", $_REQUEST['filter'] == 'INDEX' ? ' selected="selected"' : '', ">{$lang['strindexes']}</option>\n"; echo "\t<option value=\"TRIGGER\"", $_REQUEST['filter'] == 'TRIGGER' ? ' selected="selected"' : '', ">{$lang['strtriggers']}</option>\n"; echo "\t<option value=\"CONSTRAINT\"", $_REQUEST['filter'] == 'CONSTRAINT' ? ' selected="selected"' : '', ">{$lang['strconstraints']}</option>\n"; echo "\t<option value=\"FUNCTION\"", $_REQUEST['filter'] == 'FUNCTION' ? ' selected="selected"' : '', ">{$lang['strfunctions']}</option>\n"; echo "\t<option value=\"DOMAIN\"", $_REQUEST['filter'] == 'DOMAIN' ? ' selected="selected"' : '', ">{$lang['strdomains']}</option>\n"; if ($conf['show_advanced']) { echo "\t<option value=\"AGGREGATE\"", $_REQUEST['filter'] == 'AGGREGATE' ? ' selected="selected"' : '', ">{$lang['straggregates']}</option>\n"; echo "\t<option value=\"TYPE\"", $_REQUEST['filter'] == 'TYPE' ? ' selected="selected"' : '', ">{$lang['strtypes']}</option>\n"; echo "\t<option value=\"OPERATOR\"", $_REQUEST['filter'] == 'OPERATOR' ? ' selected="selected"' : '', ">{$lang['stroperators']}</option>\n"; echo "\t<option value=\"OPCLASS\"", $_REQUEST['filter'] == 'OPCLASS' ? ' selected="selected"' : '', ">{$lang['stropclasses']}</option>\n"; echo "\t<option value=\"CONVERSION\"", $_REQUEST['filter'] == 'CONVERSION' ? ' selected="selected"' : '', ">{$lang['strconversions']}</option>\n"; echo "\t<option value=\"LANGUAGE\"", $_REQUEST['filter'] == 'LANGUAGE' ? ' selected="selected"' : '', ">{$lang['strlanguages']}</option>\n"; } echo "</select>\n"; echo "<input type=\"submit\" value=\"{$lang['strfind']}\" />\n"; echo $misc->form; echo "<input type=\"hidden\" name=\"action\" value=\"find\" /></p>\n"; echo "</form>\n"; // Default focus $misc->setFocus('forms[0].term'); // If a search term has been specified, then perform the search // and display the results, grouped by object type if ($_REQUEST['term'] != '') { $rs = $data->findObject($_REQUEST['term'], $_REQUEST['filter']); if ($rs->recordCount() > 0) { $curr = ''; while (!$rs->EOF) { // Output a new header if the current type has changed, but not if it's just changed the rule type if ($rs->fields['type'] != $curr) { // Short-circuit in the case of changing from table rules to view rules; table cols to view cols; // table constraints to domain constraints if ($rs->fields['type'] == 'RULEVIEW' && $curr == 'RULETABLE') { $curr = $rs->fields['type']; } elseif ($rs->fields['type'] == 'COLUMNVIEW' && $curr == 'COLUMNTABLE') { $curr = $rs->fields['type']; } elseif ($rs->fields['type'] == 'CONSTRAINTTABLE' && $curr == 'CONSTRAINTDOMAIN') { $curr = $rs->fields['type']; } else { if ($curr != '') { echo "</ul>\n"; } $curr = $rs->fields['type']; echo "<h3>"; switch ($curr) { case 'SCHEMA': echo $lang['strschemas']; break; case 'TABLE': echo $lang['strtables']; break; case 'VIEW': echo $lang['strviews']; break; case 'SEQUENCE': echo $lang['strsequences']; break; case 'COLUMNTABLE': case 'COLUMNVIEW': echo $lang['strcolumns']; break; case 'INDEX': echo $lang['strindexes']; break; case 'CONSTRAINTTABLE': case 'CONSTRAINTDOMAIN': echo $lang['strconstraints']; break; case 'TRIGGER': echo $lang['strtriggers']; break; case 'RULETABLE': case 'RULEVIEW': echo $lang['strrules']; break; case 'FUNCTION': echo $lang['strfunctions']; break; case 'TYPE': echo $lang['strtypes']; break; case 'DOMAIN': echo $lang['strdomains']; break; case 'OPERATOR': echo $lang['stroperators']; break; case 'CONVERSION': echo $lang['strconversions']; break; case 'LANGUAGE': echo $lang['strlanguages']; break; case 'AGGREGATE': echo $lang['straggregates']; break; case 'OPCLASS': echo $lang['stropclasses']; break; } echo "</h3>"; echo "<ul>\n"; } } switch ($curr) { case 'SCHEMA': echo "<li><a href=\"redirect.php?subject=schema&{$misc->href}&schema=", $misc->printVal($rs->fields['name']), "\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'TABLE': echo "<li>"; echo "<a href=\"tables.php?subject=schema&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['schemaname']), "</a>."; echo "<a href=\"redirect.php?subject=table&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "&table=", urlencode($rs->fields['name']), "\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'VIEW': echo "<li>"; echo "<a href=\"views.php?subject=schema&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['schemaname']), "</a>."; echo "<a href=\"redirect.php?subject=view&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "&view=", urlencode($rs->fields['name']), "\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'SEQUENCE': echo "<li>"; echo "<a href=\"sequences.php?subject=schema&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['schemaname']), "</a>."; echo "<a href=\"sequences.php?subject=sequence&action=properties&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "&sequence=", urlencode($rs->fields['name']), "\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'COLUMNTABLE': echo "<li>"; echo "<a href=\"redirect.php?subject=schema&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['schemaname']), "</a>."; echo "<a href=\"tblproperties.php?subject=table&{$misc->href}&table=", urlencode($rs->fields['relname']), "&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['relname']), "</a>."; echo "<a href=\"colproperties.php?{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "&table=", urlencode($rs->fields['relname']), "&column=", urlencode($rs->fields['name']), "\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'COLUMNVIEW': echo "<li>"; echo "<a href=\"redirect.php?subject=schema&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['schemaname']), "</a>."; echo "<a href=\"viewproperties.php?subject=view&{$misc->href}&view=", urlencode($rs->fields['relname']), "&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['relname']), "</a>."; echo "<a href=\"colproperties.php?{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "&view=", urlencode($rs->fields['relname']), "&column=", urlencode($rs->fields['name']), "\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'INDEX': echo "<li>"; echo "<a href=\"redirect.php?subject=schema&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['schemaname']), "</a>."; echo "<a href=\"redirect.php?subject=table&{$misc->href}&table=", urlencode($rs->fields['relname']), "&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['relname']), "</a>."; echo "<a href=\"indexes.php?{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "&table=", urlencode($rs->fields['relname']), "\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'CONSTRAINTTABLE': echo "<li>"; echo "<a href=\"redirect.php?subject=schema&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['schemaname']), "</a>."; echo "<a href=\"redirect.php?subject=table&{$misc->href}&table=", urlencode($rs->fields['relname']), "&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['relname']), "</a>."; echo "<a href=\"constraints.php?{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "&table=", urlencode($rs->fields['relname']), "\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'CONSTRAINTDOMAIN': echo "<li>"; echo "<a href=\"domains.php?subject=schema&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['schemaname']), "</a>."; echo "<a href=\"domains.php?action=properties&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "&domain=", urlencode($rs->fields['relname']), "\">", $misc->printVal($rs->fields['relname']), '.', _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'TRIGGER': echo "<li>"; echo "<a href=\"redirect.php?subject=schema&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['schemaname']), "</a>."; echo "<a href=\"redirect.php?subject=table&{$misc->href}&table=", urlencode($rs->fields['relname']), "&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['relname']), "</a>."; echo "<a href=\"triggers.php?{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "&table=", urlencode($rs->fields['relname']), "\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'RULETABLE': echo "<li>"; echo "<a href=\"redirect.php?subject=schema&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['schemaname']), "</a>."; echo "<a href=\"redirect.php?subject=table&{$misc->href}&table=", urlencode($rs->fields['relname']), "&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['relname']), "</a>."; echo "<a href=\"rules.php?subject=table&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "&reltype=table&table=", urlencode($rs->fields['relname']), "\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'RULEVIEW': echo "<li>"; echo "<a href=\"redirect.php?subject=schema&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['schemaname']), "</a>."; echo "<a href=\"redirect.php?subject=view&{$misc->href}&view=", urlencode($rs->fields['relname']), "&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['relname']), "</a>."; echo "<a href=\"rules.php?subject=view&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "&reltype=view&view=", urlencode($rs->fields['relname']), "\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'FUNCTION': echo "<li>"; echo "<a href=\"functions.php?subject=schema&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['schemaname']), "</a>."; echo "<a href=\"functions.php?action=properties&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "&function=", urlencode($rs->fields['name']), "&function_oid=", urlencode($rs->fields['oid']), "\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'TYPE': echo "<li>"; echo "<a href=\"types.php?subject=schema&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['schemaname']), "</a>."; echo "<a href=\"types.php?action=properties&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "&type=", urlencode($rs->fields['name']), "\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'DOMAIN': echo "<li>"; echo "<a href=\"domains.php?subject=schema&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['schemaname']), "</a>."; echo "<a href=\"domains.php?action=properties&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "&domain=", urlencode($rs->fields['name']), "\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'OPERATOR': echo "<li>"; echo "<a href=\"operators.php?subject=schema&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['schemaname']), "</a>."; echo "<a href=\"operators.php?action=properties&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "&operator=", urlencode($rs->fields['name']), "&operator_oid=", urlencode($rs->fields['oid']), "\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'CONVERSION': echo "<li>"; echo "<a href=\"conversions.php?subject=schema&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['schemaname']), "</a>."; echo "<a href=\"conversions.php?{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'LANGUAGE': echo "<li><a href=\"languages.php?{$misc->href}\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'AGGREGATE': echo "<li>"; echo "<a href=\"aggregates.php?subject=schema&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['schemaname']), "</a>."; echo "<a href=\"aggregates.php?{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'OPCLASS': echo "<li>"; echo "<a href=\"redirect.php?subject=schema&{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", $misc->printVal($rs->fields['schemaname']), "</a>."; echo "<a href=\"opclasses.php?{$misc->href}&schema=", urlencode($rs->fields['schemaname']), "\">", _highlight($misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; } $rs->moveNext(); } echo "</ul>\n"; echo "<p>", $rs->recordCount(), " ", $lang['strobjects'], "</p>\n"; } else { echo "<p>{$lang['strnoobjects']}</p>\n"; } } }
function _process(&$output, $mode, $latest) { global $form; //dd($output); if ($latest == 'unlimited') { $timelimit = false; } else { $timelimit = true; } print <<<EOS <div class='log'> EOS; foreach ($output as $line) { $line = trim($line); if ($timelimit) { $lt = sprintf("%3d", _logtime($line)); if ($lt >= 0) { if ($lt > $latest) { continue; } } } $cls = _highlight($line, $mode); print <<<EOS <pre class='code {$cls}'>{$lt} {$line}</pre> EOS; } print <<<EOS </div> EOS; }