{$term}", $string); } /** * Sends a signal to a process */ function doSignal() { global $data, $lang; $status = $data->sendSignal($_REQUEST['pid'], $_REQUEST['signal']); if ($status == 0) doProcesses($lang['strsignalsent']); else doProcesses($lang['strsignalsentbad']); } /** * 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 "
\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 "\n"; $curr = $rs->fields['type']; echo "", $rs->recordCount(), " ", $lang['strobjects'], "
\n"; } else echo "{$lang['strnoobjects']}
\n"; } } /** * Displays options for database download */ function doExport($msg = '') { global $data, $misc; global $lang; $misc->printTrail('database'); $misc->printTabs('database','export'); $misc->printMsg($msg); echo "\n"; } /** * Show the current status of all database variables */ function doVariables() { global $data, $misc; global $lang; // Fetch the variables from the database $variables = $data->getVariables(); $misc->printTrail('database'); $misc->printTabs('database','variables'); $columns = array( 'variable' => array( 'title' => $lang['strname'], 'field' => field('name'), ), 'value' => array( 'title' => $lang['strsetting'], 'field' => field('setting'), ), ); $actions = array(); $misc->printTable($variables, $columns, $actions, 'database-variables', $lang['strnodata']); } /** * Show all current database connections and any queries they * are running. */ function doProcesses($msg = '') { global $data, $misc; global $lang; $misc->printTrail('database'); $misc->printTabs('database','processes'); $misc->printMsg($msg); if (strlen($msg) === 0) { echo "{$lang['strentersql']}
\n"; echo "\n"; // Default focus $misc->setFocus('forms[0].query'); } function doTree() { global $misc, $data, $lang; $reqvars = $misc->getRequestVars('database'); $tabs = $misc->getNavTabs('database'); $items = $misc->adjustTabsForTree($tabs); $attrs = array( 'text' => field('title'), 'icon' => field('icon'), 'action' => url(field('url'), $reqvars, field('urlvars', array()) ), 'branch' => url(field('url'), $reqvars, field('urlvars'), array('action' => 'tree') ), ); $misc->printTree($items, $attrs, 'database'); exit; } require('./admin.php'); /* shortcuts: these functions exit the script */ if ($action == 'tree') doTree(); if ($action == 'refresh_locks') currentLocks(true); if ($action == 'refresh_processes') currentProcesses(true); /* normal flow */ if ($action == 'locks' or $action == 'processes') { $scripts .= ""; $refreshTime = $conf['ajax_refresh'] * 1000; $scripts .= "\n"; } $misc->printHeader($lang['strdatabase'], $scripts); $misc->printBody(); switch ($action) { case 'find': if (isset($_REQUEST['term'])) doFind(false); else doFind(true); break; case 'sql': doSQL(); break; case 'variables': doVariables(); break; case 'processes': doProcesses(); break; case 'locks': doLocks(); break; case 'export': doExport(); break; case 'signal': doSignal(); break; default: if (adminActions($action, 'database') === false) doSQL(); break; } $misc->printFooter(); ?>