/**
* Class to hold various commonly used functions
*
- * $Id: Misc.php,v 1.166 2007/12/11 14:17:17 ioguix Exp $
+ * $Id: Misc.php,v 1.167 2008/01/09 00:19:10 ioguix Exp $
*/
class Misc {
);
case 'server':
+ case 'report':
$server_info = $this->getServerInfo();
$hide_users = !$data->isSuperUser($server_info['username']);
$tmp = array (
'urlvars' => array('subject' => 'server'),
'hide' => !$conf['show_reports'],
'icon' => 'Reports',
- )
+ ),
));
return $tmp;
break;
}
if ($subject == 'server') $done = true;
+ if (isset($_REQUEST['report']) && !$done) {
+ $vars .= 'report='.urlencode($_REQUEST['report']).'&';
+ $trail['report'] = array(
+ 'title' => $lang['strreport'],
+ 'text' => $_REQUEST['report'],
+ 'url' => "reports.php?subject=report&{$vars}",
+ 'icon' => 'Report'
+ );
+ }
+
if (isset($_REQUEST['database']) && !$done) {
$vars .= 'database='.urlencode($_REQUEST['database']).'&';
$trail['database'] = array(
'icon' => 'Roles'
);
}
- if ($subject == 'database' || $subject == 'role') $done = true;
+ if ($subject == 'database' || $subject == 'role' || $subject == 'report') $done = true;
if (isset($_REQUEST['schema']) && !$done) {
$vars .= 'schema='.urlencode($_REQUEST['schema']).'&';
* @param $return_desc The return link name
* @param $page The current page
*
- * $Id: display.php,v 1.65 2007/11/29 23:23:56 ioguix Exp $
+ * $Id: display.php,v 1.66 2008/01/09 00:19:10 ioguix Exp $
*/
// Prevent timeouts on large exports (non-safe mode only)
urlencode($_REQUEST['page']), "\">{$lang['strexpand']}</a></li>\n";
// Create report
- if (isset($_REQUEST['query']) && $conf['show_reports'] && isset($rs) && is_object($rs) && $rs->recordCount() > 0)
+ if (isset($_REQUEST['query']) && ($subject !== 'report') && $conf['show_reports'] && isset($rs) && is_object($rs) && $rs->recordCount() > 0)
echo "\t<li><a href=\"reports.php?{$misc->href}&action=create&report_sql=",
urlencode($_REQUEST['query']), "\">{$lang['strcreatereport']}</a></li>\n";
/**
* List reports in a database
*
- * $Id: reports.php,v 1.33 2007/09/13 13:41:01 ioguix Exp $
+ * $Id: reports.php,v 1.34 2008/01/09 00:19:10 ioguix Exp $
*/
// Include application functions
global $lang;
if (!isset($_REQUEST['report_name'])) $_REQUEST['report_name'] = '';
- if (!isset($_REQUEST['db_name'])) $_REQUEST['db_name'] = (isset($_REQUEST['database']) ? $_REQUEST['database'] : '');
+ if (!isset($_REQUEST['db_name'])) $_REQUEST['db_name'] = '';
if (!isset($_REQUEST['descr'])) $_REQUEST['descr'] = '';
if (!isset($_REQUEST['report_sql'])) $_REQUEST['report_sql'] = '';
+ if (isset($_REQUEST['database'])) {
+ $_REQUEST['db_name'] = $_REQUEST['database'];
+ unset($_REQUEST['database']);
+ $misc->setForm();
+ }
+
$databases = $data->getDatabases();
$misc->printTrail('server');
* how many SQL statements have been strung together with semi-colons
* @param $query The SQL query string to execute
*
- * $Id: sql.php,v 1.41 2007/12/07 21:58:40 ioguix Exp $
+ * $Id: sql.php,v 1.42 2008/01/09 00:19:10 ioguix Exp $
*/
// Prevent timeouts on large exports (non-safe mode only)
exit;
}
+ $subject = isset($_REQUEST['subject'])? $_REQUEST['subject'] : '';
$misc->printHeader($lang['strqueryresults']);
$misc->printBody();
$misc->printTrail('database');
}
echo "<p>{$lang['strsqlexecuted']}</p>\n";
+
+ echo "<ul class=\"navlink\">\n";
+
+ // Return
+ if (isset($_REQUEST['return_url']) && isset($_REQUEST['return_desc']))
+ echo "\t<li><a href=\"{$_REQUEST['return_url']}\">{$_REQUEST['return_desc']}</a></li>\n";
- echo "<ul class=\"navlink\">\n\t<li><a href=\"database.php?database=", urlencode($_REQUEST['database']),
+ // Edit
+ echo "\t<li><a href=\"database.php?database=", urlencode($_REQUEST['database']),
"&server=", urlencode($_REQUEST['server']), "&action=sql&query=", urlencode($_REQUEST['query']), "\">{$lang['streditsql']}</a></li>\n";
- if ($conf['show_reports'] && isset($rs) && is_object($rs) && $rs->recordCount() > 0)
+
+ // Create report
+ if (($subject !== 'report') && $conf['show_reports'] && isset($rs) && is_object($rs) && $rs->recordCount() > 0)
echo "\t<li><a href=\"reports.php?{$misc->href}&action=create&report_sql=",
urlencode($_REQUEST['query']), "\">{$lang['strcreatereport']}</a></li>\n";
+
+ // Create view and download
+ if (isset($_REQUEST['query']) && isset($rs) && is_object($rs) && $rs->recordCount() > 0) {
+ // Report views don't set a schema, so we need to disable create view in that case
+ if (isset($_REQUEST['schema']))
+ echo "\t<li><a href=\"views.php?action=create&formDefinition=",
+ urlencode($_REQUEST['query']), "&{$misc->href}\">{$lang['strcreateview']}</a></li>\n";
+ echo "\t<li><a href=\"dataexport.php?query=", urlencode($_REQUEST['query']);
+ if (isset($_REQUEST['search_path']))
+ echo "&search_path=", urlencode($_REQUEST['search_path']);
+ echo "&{$misc->href}\">{$lang['strdownload']}</a></li>\n";
+ }
+
echo "</ul>\n";
$misc->printFooter();