From 826efbbec4927d1a72974e1ea8b6df95c07063d0 Mon Sep 17 00:00:00 2001 From: "Jehan-Guillaume (ioguix) de Rorthais" Date: Fri, 17 Aug 2012 14:38:50 +0200 Subject: [PATCH] Remove the report feature from PPA (will be a plugin) Starting with PPA 5.1, Reports will be available as plugins. --- INSTALL | 14 +- classes/Misc.php | 38 +-- classes/Reports.php | 139 ---------- conf/config.inc.php-dist | 14 - display.php | 23 -- images/themes/default/Report.png | Bin 405 -> 0 bytes images/themes/default/Reports.png | Bin 339 -> 0 bytes lang/afrikaans.php | 13 - lang/arabic.php | 13 - lang/catalan.php | 13 - lang/chinese-sim.php | 11 - lang/chinese-tr.php | 13 - lang/chinese-utf8-zh_CN.php | 13 - lang/chinese-utf8-zh_TW.php | 13 - lang/czech.php | 13 - lang/danish.php | 13 - lang/dutch.php | 12 - lang/english.php | 13 - lang/french.php | 13 - lang/galician.php | 13 - lang/german.php | 13 - lang/greek.php | 13 - lang/hebrew.php | 13 - lang/hungarian.php | 13 - lang/italian.php | 13 - lang/japanese.php | 13 - lang/lithuanian.php | 13 - lang/mongol.php | 12 - lang/polish.php | 13 - lang/portuguese-br.php | 13 - lang/portuguese-pt.php | 13 - lang/romanian.php | 13 - lang/russian-utf8.php | 13 - lang/russian.php | 13 - lang/slovak.php | 13 - lang/spanish.php | 13 - lang/swedish.php | 13 - lang/turkish.php | 13 - lang/ukrainian.php | 13 - reports.php | 435 ------------------------------ sql.php | 26 +- sql/reports-pgsql.sql | 27 -- 42 files changed, 16 insertions(+), 1112 deletions(-) delete mode 100644 classes/Reports.php delete mode 100644 images/themes/default/Report.png delete mode 100644 images/themes/default/Reports.png delete mode 100644 reports.php delete mode 100644 sql/reports-pgsql.sql diff --git a/INSTALL b/INSTALL index 75d6e338..56c202a6 100644 --- a/INSTALL +++ b/INSTALL @@ -24,13 +24,7 @@ phpPgAdmin Installation Guide If you mess up the configuration file, you can recover it from the config.inc.php-dist file. -3. Set up the reports database. - - If you want to enable reports (which are a useful feature) then go to - the 'sql' subdirectory and view the SQL script for your database. It - will contain instructions on how to set up the reports database. - -4. If you run your PHP installation in safe mode, in order that the database +3. If you run your PHP installation in safe mode, in order that the database dump feature can work correctly, you need to set the 'safe_mode_allowed_env_vars' php.ini variable to include the PGPASSWORD and PGUSER environmental variables and the safe_mode_exec_dir to include /usr/bin (or wherever the pg_dump @@ -49,7 +43,7 @@ phpPgAdmin Installation Guide Lastly, if you run phpPgAdmin in safe mode, very long running imports, exports and transactions may time out and be aborted. -5. Enable the statistics collector in PostgreSQL. phpPgAdmin will display +4. Enable the statistics collector in PostgreSQL. phpPgAdmin will display table and index performance and usage statistics if you have enabled the PostgreSQL statistics collector. To enable the collector, uncomment the following lines in your postgresql.conf and enable them: @@ -59,10 +53,10 @@ phpPgAdmin Installation Guide stats_block_level = true stats_row_level = true -6. Browse to the phpPgAdmin installation using a web browser. You might +5. Browse to the phpPgAdmin installation using a web browser. You might need cookies enabled for phpPgAdmin to work. -7. IMPORTANT - SECURITY +6. IMPORTANT - SECURITY PostgreSQL by default does not require you to use a password to log in. We STRONGLY recomment that you enable md5 passwords for local connections diff --git a/classes/Misc.php b/classes/Misc.php index 0910fd04..504e7f26 100644 --- a/classes/Misc.php +++ b/classes/Misc.php @@ -67,15 +67,6 @@ 'subject' => 'server' )); break; - case 'report': - $vars = array( - 'url' => 'reports.php', - 'params' => array( - 'server' => $_REQUEST['server'], - 'subject' => 'report', - 'report' => $_REQUEST['report'] - )); - break; case 'role': $vars = array('params' => array( 'server' => $_REQUEST['server'], @@ -181,6 +172,16 @@ 'column' => $_REQUEST['column'] )); break; + // case 'plugin': + // $vars = array('params' => array( + // 'server' => $_REQUEST['server'], + // 'subject' => 'plugin', + // 'plugin' => $_REQUEST['plugin'], + // 'database' => $_REQUEST['database'], + // 'schema' => $_REQUEST['schema'], + // 'action' => $_REQUEST['action'] + // )); + // break; default: return false; } @@ -718,7 +719,6 @@ break; case 'server': - case 'report': $hide_users = !$data->isSuperUser(); $tabs = array ( 'databases' => array ( @@ -786,13 +786,6 @@ 'hide' => (!$this->isDumpEnabled()), 'icon' => 'Export', ), - 'reports' => array ( - 'title' => $lang['strreports'], - 'url' => 'reports.php', - 'urlvars' => array('subject' => 'server'), - 'hide' => !$conf['show_reports'], - 'icon' => 'Reports', - ), )); break; case 'database': @@ -1488,15 +1481,6 @@ } if ($subject == 'server') $done = true; - if (isset($_REQUEST['report']) && !$done) { - $trail['report'] = array( - 'title' => $lang['strreport'], - 'text' => $_REQUEST['report'], - 'url' => $this->getHREFSubject('report'), - 'icon' => 'Report' - ); - } - if (isset($_REQUEST['database']) && !$done) { $trail['database'] = array( 'title' => $lang['strdatabase'], @@ -1514,7 +1498,7 @@ 'icon' => 'Roles' ); } - if ($subject == 'database' || $subject == 'role' || $subject == 'report') $done = true; + if ($subject == 'database' || $subject == 'role') $done = true; if (isset($_REQUEST['schema']) && !$done) { $trail['schema'] = array( diff --git a/classes/Reports.php b/classes/Reports.php deleted file mode 100644 index 0688f35a..00000000 --- a/classes/Reports.php +++ /dev/null @@ -1,139 +0,0 @@ -reports_db = $conf['reports_db']; - } - if (isset($conf['reports_schema'])) { - $this->reports_schema = $conf['reports_schema']; - } - if (isset($conf['reports_table'])) { - $this->reports_table = $conf['reports_table']; - } - - // Check to see if the reports database exists - $rs = $data->getDatabase($this->reports_db); - if ($rs->recordCount() != 1) $status = -1; - else { - // Create a new database access object. - $this->driver = $misc->getDatabaseAccessor($this->reports_db); - // Reports database should have been created in public schema - $this->driver->setSchema($this->reports_schema); - $status = 0; - } - } - - /** - * Finds all reports - * @return A recordset - */ - function getReports() { - global $conf, $misc; - // Filter for owned reports if necessary - if ($conf['owned_reports_only']) { - $server_info = $misc->getServerInfo(); - $filter['created_by'] = $server_info['username']; - $ops = array('created_by' => '='); - } - else $filter = $ops = array(); - - $sql = $this->driver->getSelectSQL($this->reports_table, - array('report_id', 'report_name', 'db_name', 'date_created', 'created_by', 'descr', 'report_sql', 'paginate'), - $filter, $ops, array('db_name' => 'asc', 'report_name' => 'asc')); - - return $this->driver->selectSet($sql); - } - - /** - * Finds a particular report - * @param $report_id The ID of the report to find - * @return A recordset - */ - function getReport($report_id) { - $sql = $this->driver->getSelectSQL($this->reports_table, - array('report_id', 'report_name', 'db_name', 'date_created', 'created_by', 'descr', 'report_sql', 'paginate'), - array('report_id' => $report_id), array('report_id' => '='), array()); - - return $this->driver->selectSet($sql); - } - - /** - * Creates a report - * @param $report_name The name of the report - * @param $db_name The name of the database - * @param $descr The comment on the report - * @param $report_sql The SQL for the report - * @param $paginate The report should be paginated - * @return 0 success - */ - function createReport($report_name, $db_name, $descr, $report_sql, $paginate) { - global $misc; - $server_info = $misc->getServerInfo(); - $temp = array( - 'report_name' => $report_name, - 'db_name' => $db_name, - 'created_by' => $server_info['username'], - 'report_sql' => $report_sql, - 'paginate' => $paginate ? 'true' : 'false', - ); - if ($descr != '') $temp['descr'] = $descr; - - return $this->driver->insert($this->reports_table, $temp); - } - - /** - * Alters a report - * @param $report_id The ID of the report - * @param $report_name The name of the report - * @param $db_name The name of the database - * @param $descr The comment on the report - * @param $report_sql The SQL for the report - * @param $paginate The report should be paginated - * @return 0 success - */ - function alterReport($report_id, $report_name, $db_name, $descr, $report_sql, $paginate) { - global $misc; - $server_info = $misc->getServerInfo(); - $temp = array( - 'report_name' => $report_name, - 'db_name' => $db_name, - 'created_by' => $server_info['username'], - 'report_sql' => $report_sql, - 'paginate' => $paginate ? 'true' : 'false', - 'descr' => $descr - ); - - return $this->driver->update($this->reports_table, $temp, - array('report_id' => $report_id)); - } - - /** - * Drops a report - * @param $report_id The ID of the report to drop - * @return 0 success - */ - function dropReport($report_id) { - return $this->driver->delete($this->reports_table, array('report_id' => $report_id)); - } - - } -?> diff --git a/conf/config.inc.php-dist b/conf/config.inc.php-dist index ed553b1c..6b36d176 100644 --- a/conf/config.inc.php-dist +++ b/conf/config.inc.php-dist @@ -111,20 +111,6 @@ // Display "system" objects? $conf['show_system'] = false; - // Display reports feature? For this feature to work, you must - // install the reports database as explained in the INSTALL file. - $conf['show_reports'] = true; - - // Database and table for reports - $conf['reports_db'] = 'phppgadmin'; - $conf['reports_schema'] = 'public'; - $conf['reports_table'] = 'ppa_reports'; - - // Only show owned reports? - // Note: This does not prevent people from accessing other reports by - // other means. - $conf['owned_reports_only'] = false; - // Minimum length users can set their password to. $conf['min_password_length'] = 1; diff --git a/display.php b/display.php index dbeb2ecd..92496434 100644 --- a/display.php +++ b/display.php @@ -448,10 +448,6 @@ $misc->printTitle($lang['strselect']); $type = 'SELECT'; } - else if (isset($_REQUEST['report'])) { - $misc->printTitle($lang['strselect']); - $type = 'SELECT'; - } else { $misc->printTitle($lang['strbrowse']); $type = 'TABLE'; @@ -499,7 +495,6 @@ if (isset($object)) $gets .= "&" . urlencode($subject) . '=' . urlencode($object); if (isset($subject)) $gets .= "&subject=" . urlencode($subject); if (isset($_REQUEST['query'])) $gets .= "&query=" . urlencode($_REQUEST['query']); - if (isset($_REQUEST['report'])) $gets .= "&report=" . urlencode($_REQUEST['report']); if (isset($_REQUEST['count'])) $gets .= "&count=" . urlencode($_REQUEST['count']); if (isset($_REQUEST['return'])) $gets .= "&return=" . urlencode($_REQUEST['return']); if (isset($_REQUEST['search_path'])) $gets .= "&search_path=" . urlencode($_REQUEST['search_path']); @@ -515,7 +510,6 @@ if (isset($object)) $_gets[$subject] = $object; if (isset($subject)) $_gets['subject'] = $subject; if (isset($_REQUEST['query'])) $_gets['query'] = $_REQUEST['query']; - if (isset($_REQUEST['report'])) $_gets['report'] = $_REQUEST['report']; if (isset($_REQUEST['count'])) $_gets['count'] = $_REQUEST['count']; if (isset($_REQUEST['return'])) $_gets['return'] = $_REQUEST['return']; if (isset($_REQUEST['search_path'])) $_gets['search_path'] = $_REQUEST['search_path']; @@ -739,23 +733,6 @@ 'content' => $lang['strexpand'] ); - // Create report - if (isset($_REQUEST['query']) && ($subject !== 'report') && $conf['show_reports'] && isset($rs) && is_object($rs) && $rs->recordCount() > 0) { - $navlinks['createreport'] = array ( - 'attr'=> array ( - 'href' => array ( - 'url' => 'reports.php', - 'urlvars' => array_merge($fields, array( - 'action' => 'create', - 'report_sql' => $_REQUEST['query'], - 'paginate' => isset($_REQUEST['paginate'])? $_REQUEST['paginate']:'f' - )) - ) - ), - 'content' => $lang['strcreatereport'] - ); - } - // Create view and download if (isset($_REQUEST['query']) && isset($rs) && is_object($rs) && $rs->recordCount() > 0) { diff --git a/images/themes/default/Report.png b/images/themes/default/Report.png deleted file mode 100644 index f9158b9a02d899fa802621243df3d0b64cf3b8d0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 405 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G_YAk0{w5<>&kwEkwaWrmT&d!4-5>9N}eu`Ar`%NCvEg%4is?p|F-s~ z#NuiH8pX6CesI^dYz<{vX5iYjVnIUYWF^N=wk-mGdKEHTM9TiPi=CYPTPIBTaMYS< zd^~4z&&jlDwg_az-#3!t`;q(gckQC{mVXvnGZ-Gouvk!g^>J;E2FoHR#?}ejT0D1X z98&RVe5$f6a(!rH)SsoF&Az=comaHde%@Q3=b8>&Hgn!5rCB^TFy7N*o}6^7so3Yt zhq#Jhu>_&t%g^uRdDp*v6N7%?=_9kXl?W}qeiyajwQ!ixar7%8C zGW^ba%JY+ceuCPq-mm%5!OZz?sT)nE@2&g6tiQPK=d9BUE=QbV3iIYHU+cT4MP*4t xYeSRAqYAzCYeS40-krRdXnOruWGSN^L&mFroJukae*goJ!PC{xWt~$(698}>rz-#e diff --git a/images/themes/default/Reports.png b/images/themes/default/Reports.png deleted file mode 100644 index 4a403e070c32a1be865b83d74dac2e83cf9fab11..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 339 zcmV-Z0j&OsP)`^WGXjQ=z6va>Lh z=VgH`z-a)(*I$1aRxMk~aQ^sVoK66`^gp^w;0F8y+62-}s!QMofE1DA61V|>paziY z5)2n0yTrBlC{`D&YBazM#J_+4VYp;@lL=7#FIemkkp2x~{{gZ8VH)t~-(L)uMAn_b z>Vm~JI+zCVbFgE$WNx)C*fzNBAo>r4MmJ!3ZBcF}x=WHhF3Ib?h1CVqin*~HfbNn-)!Ja&{(getReport($_REQUEST['report_id']); - if ($_REQUEST['action'] == 'edit') { - $_POST['report_name'] = $report->fields['report_name']; - $_POST['db_name'] = $report->fields['db_name']; - $_POST['descr'] = $report->fields['descr']; - $_POST['report_sql'] = $report->fields['report_sql']; - if ($report->fields['paginate'] == 't') { - $_POST['paginate'] = TRUE; - } - } - - // Get a list of available databases - $databases = $data->getDatabases(); - - $_REQUEST['report'] = $report->fields['report_name']; - $misc->printTrail('report'); - $misc->printTitle($lang['stredit']); - $misc->printMsg($msg); - - echo "
\n"; - echo $misc->form; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
{$lang['strname']}_maxNameLen}\" value=\"", - htmlspecialchars($_POST['report_name']), "\" />
{$lang['strdatabase']}
{$lang['strcomment']}
{$lang['strsql']}
\n"; - echo "\n"; - echo "

\n"; - echo "\n"; - echo "

\n"; - echo "fields['report_id']}\" />\n"; - echo "
\n"; - } - - /** - * Saves changes to a report - */ - function doSaveEdit() { - global $reportsdb, $lang; - - if (!isset($_POST['report_name'])) $_POST['report_name'] = ''; - if (!isset($_POST['db_name'])) $_POST['db_name'] = ''; - if (!isset($_POST['descr'])) $_POST['descr'] = ''; - if (!isset($_POST['report_sql'])) $_POST['report_sql'] = ''; - - // Check that they've given a name and a definition - if ($_POST['report_name'] == '') doEdit($lang['strreportneedsname']); - elseif ($_POST['report_sql'] == '') doEdit($lang['strreportneedsdef']); - else { - $status = $reportsdb->alterReport($_POST['report_id'], $_POST['report_name'], $_POST['db_name'], - $_POST['descr'], $_POST['report_sql'], isset($_POST['paginate'])); - if ($status == 0) - doDefault($lang['strreportcreated']); - else - doEdit($lang['strreportcreatedbad']); - } - } - - /** - * Display read-only properties of a report - */ - function doProperties($msg = '') { - global $data, $reportsdb, $misc; - global $lang; - - $report = $reportsdb->getReport($_REQUEST['report_id']); - - $_REQUEST['report'] = $report->fields['report_name']; - $misc->printTrail('report'); - $misc->printTitle($lang['strproperties']); - $misc->printMsg($msg); - - if ($report->recordCount() == 1) { - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
{$lang['strname']}", $misc->printVal($report->fields['report_name']), "
{$lang['strdatabase']}", $misc->printVal($report->fields['db_name']), "
{$lang['strcomment']}", $misc->printVal($report->fields['descr']), "
{$lang['strpaginate']}", $misc->printVal($report->fields['paginate'], 'yesno', array('align' => 'left')), "
{$lang['strsql']}", $misc->printVal($report->fields['report_sql']), "
\n"; - } - else echo "

{$lang['strinvalidparam']}

\n"; - - $urlvars = array ('server' => $_REQUEST['server']); - if (isset($_REQUEST['schema'])) $urlvars['schema'] = $_REQUEST['schema']; - if (isset($_REQUEST['database'])) $urlvars['database'] = $_REQUEST['database']; - - $navlinks = array ( - 'showall' => array ( - 'attr'=> array ( - 'href' => array ( - 'url' => 'reports.php', - 'urlvars' => $urlvars - ) - ), - 'content' => $lang['strshowallreports'] - ), - 'alter' => array ( - 'attr'=> array ( - 'href' => array ( - 'url' => 'reports.php', - 'urlvars' => array_merge($urlvars, array( - 'action' => 'edit', - 'report_id' => $report->fields['report_id'] - )) - ) - ), - 'content' => $lang['stredit'] - ), - 'exec' => array ( - 'attr'=> array ( - 'href' => array ( - 'url' => 'sql.php', - 'urlvars' => array_merge($urlvars, array( - 'subject' => 'report', - 'report' => $report->fields['report_name'], - 'return' => 'report', - 'database' => $report->fields['db_name'], - 'reportid' => $report->fields['report_id'], - 'paginate' => $report->fields['paginate'] - )) - ) - ), - 'content' => $lang['strexecute'] - ) - ); - $misc->printNavLinks($navlinks, 'reports-properties'); - } - - /** - * Displays a screen where they can enter a new report - */ - function doCreate($msg = '') { - global $data, $reportsdb, $misc; - global $lang; - - if (!isset($_REQUEST['report_name'])) $_REQUEST['report_name'] = ''; - 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'); - $misc->printTitle($lang['strcreatereport']); - $misc->printMsg($msg); - - echo "
\n"; - echo $misc->form; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
{$lang['strname']}_maxNameLen}\" value=\"", - htmlspecialchars($_REQUEST['report_name']), "\" />
{$lang['strdatabase']}
{$lang['strcomment']}
{$lang['strsql']}
\n"; - echo "\n"; - echo "

\n"; - echo "\n"; - echo "

\n"; - echo "
\n"; - } - - /** - * Actually creates the new report in the database - */ - function doSaveCreate() { - global $reportsdb, $lang; - - if (!isset($_POST['report_name'])) $_POST['report_name'] = ''; - if (!isset($_POST['db_name'])) $_POST['db_name'] = ''; - if (!isset($_POST['descr'])) $_POST['descr'] = ''; - if (!isset($_POST['report_sql'])) $_POST['report_sql'] = ''; - - // Check that they've given a name and a definition - if ($_POST['report_name'] == '') doCreate($lang['strreportneedsname']); - elseif ($_POST['report_sql'] == '') doCreate($lang['strreportneedsdef']); - else { - $status = $reportsdb->createReport($_POST['report_name'], $_POST['db_name'], - $_POST['descr'], $_POST['report_sql'], isset($_POST['paginate'])); - if ($status == 0) - doDefault($lang['strreportcreated']); - else - doCreate($lang['strreportcreatedbad']); - } - } - - /** - * Show confirmation of drop and perform actual drop - */ - function doDrop($confirm) { - global $reportsdb, $misc; - global $lang; - - if ($confirm) { - // Fetch report from the database - $report = $reportsdb->getReport($_REQUEST['report_id']); - - $_REQUEST['report'] = $report->fields['report_name']; - $misc->printTrail('report'); - $misc->printTitle($lang['strdrop']); - - echo "

", sprintf($lang['strconfdropreport'], $misc->printVal($report->fields['report_name'])), "

\n"; - - echo "
\n"; - echo $misc->form; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
\n"; - } - else { - $status = $reportsdb->dropReport($_POST['report_id']); - if ($status == 0) - doDefault($lang['strreportdropped']); - else - doDefault($lang['strreportdroppedbad']); - } - } - - /** - * Show default list of reports in the database - */ - function doDefault($msg = '') { - global $data, $misc, $reportsdb; - global $lang; - - $misc->printTrail('server'); - $misc->printTabs('server','reports'); - $misc->printMsg($msg); - - $reports = $reportsdb->getReports(); - - $columns = array( - 'report' => array( - 'title' => $lang['strreport'], - 'field' => field('report_name'), - 'url' => "reports.php?action=properties&{$misc->href}&", - 'vars' => array('report_id' => 'report_id'), - ), - 'database' => array( - 'title' => $lang['strdatabase'], - 'field' => field('db_name'), - ), - 'created' => array( - 'title' => $lang['strcreated'], - 'field' => field('date_created'), - ), - 'paginate' => array( - 'title' => $lang['strpaginate'], - 'field' => field('paginate'), - 'type' => 'yesno', - ), - 'actions' => array( - 'title' => $lang['stractions'], - ), - 'comment' => array( - 'title' => $lang['strcomment'], - 'field' => field('descr'), - ), - ); - - $actions = array( - 'run' => array( - 'content' => $lang['strexecute'], - 'attr'=> array ( - 'href' => array ( - 'url' => 'sql.php', - 'urlvars' => array ( - 'subject' => 'report', - 'return' => 'report', - 'report' => field('report_name'), - 'database' => field('db_name'), - 'reportid' => field('report_id'), - 'paginate' => field('paginate') - ) - ) - ) - ), - 'edit' => array( - 'content' => $lang['stredit'], - 'attr'=> array ( - 'href' => array ( - 'url' => 'reports.php', - 'urlvars' => array ( - 'action' => 'edit', - 'report_id' => field('report_id') - ) - ) - ) - ), - 'drop' => array( - 'content' => $lang['strdrop'], - 'attr'=> array ( - 'href' => array ( - 'url' => 'reports.php', - 'urlvars' => array ( - 'action' => 'confirm_drop', - 'report_id' => field('report_id') - ) - ) - ) - ), - ); - - $misc->printTable($reports, $columns, $actions, 'reports-reports', $lang['strnoreports']); - - $urlvars = array ('server' => $_REQUEST['server']); - if (isset($_REQUEST['database'])) $urlvars['database'] = $_REQUEST['database']; - if (isset($_REQUEST['schema'])) $urlvars['schema'] = $_REQUEST['schema']; - - $misc->printNavLinks(array ( - 'create' => array ( - 'attr'=> array ( - 'href' => array ( - 'url' => 'reports.php', - 'urlvars' => array_merge(array ( - 'action' => 'create' - ), $urlvars) - ) - ), - 'content' => $lang['strcreatereport'] - )), 'reports-reports' - ); - } - - $misc->printHeader($lang['strreports']); - $misc->printBody(); - - // Create a database accessor for the reports database - include_once('./classes/Reports.php'); - $reportsdb = new Reports($status); - if ($status != 0) { - $misc->printTrail('server'); - $misc->printTabs('server','reports'); - $misc->printMsg($lang['strnoreportsdb']); - } - else { - switch ($action) { - case 'save_edit': - if (isset($_POST['cancel'])) doDefault(); - else doSaveEdit(); - break; - case 'edit': - doEdit(); - break; - case 'properties': - doProperties(); - break; - case 'save_create': - if (isset($_POST['cancel'])) doDefault(); - else doSaveCreate(); - break; - case 'create': - doCreate(); - break; - case 'drop': - if (isset($_POST['drop'])) doDrop(false); - else doDefault(); - break; - case 'confirm_drop': - doDrop(true); - break; - default: - doDefault(); - break; - } - } - - $misc->printFooter(); - -?> diff --git a/sql.php b/sql.php index f69c2806..d2364fba 100644 --- a/sql.php +++ b/sql.php @@ -72,15 +72,7 @@ // We need to store the query in a session for editing purposes // We avoid GPC vars to avoid truncating long queries - // If we came from a report, we need to look up the query - if (isset($_REQUEST['subject']) && $_REQUEST['subject'] == 'report' ) { - global $data, $misc; - include_once('./classes/Reports.php'); - $reportsdb = new Reports($status); - $report = $reportsdb->getReport($_REQUEST['reportid']); - $_SESSION['sqlquery'] = $report->fields['report_sql']; - } - elseif (isset($_REQUEST['subject']) && $_REQUEST['subject'] == 'history') { + if (isset($_REQUEST['subject']) && $_REQUEST['subject'] == 'history') { // Or maybe we came from the history popup $_SESSION['sqlquery'] = $_SESSION['history'][$_REQUEST['server']][$_REQUEST['database']][$_GET['queryid']]['query']; } @@ -232,22 +224,6 @@ 'content' => $lang['streditsql'] ); - // Create report - if (($subject !== 'report') && $conf['show_reports'] && isset($rs) && is_object($rs) && $rs->recordCount() > 0) { - $navlinks['createreport'] = array ( - 'attr'=> array ( - 'href' => array ( - 'url' => 'reports.php', - 'urlvars' => array_merge($fields, array ( - 'action' => 'create', - 'report_sql' => $_SESSION['sqlquery'] - )) - ) - ), - 'content' => $lang['strcreatereport'] - ); - } - // Create view and download if (isset($_SESSION['sqlquery']) && 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 diff --git a/sql/reports-pgsql.sql b/sql/reports-pgsql.sql deleted file mode 100644 index 1272a762..00000000 --- a/sql/reports-pgsql.sql +++ /dev/null @@ -1,27 +0,0 @@ --- SQL script to create reports database for PostgreSQL --- --- To run, type: psql template1 < reports-pgsql.sql --- --- $Id: reports-pgsql.sql,v 1.4 2007/04/16 11:02:36 mr-russ Exp $ - -CREATE DATABASE phppgadmin; - -\connect phppgadmin - -CREATE TABLE ppa_reports ( - report_id SERIAL, - report_name varchar(255) NOT NULL, - db_name varchar(255) NOT NULL, - date_created date DEFAULT NOW() NOT NULL, - created_by varchar(255) NOT NULL, - descr text, - report_sql text NOT NULL, - paginate boolean NOT NULL, - PRIMARY KEY (report_id) -); - --- Allow everyone to do everything with reports. This may --- or may not be what you want. -GRANT SELECT,INSERT,UPDATE,DELETE ON ppa_reports TO PUBLIC; -GRANT SELECT,UPDATE ON ppa_reports_report_id_seq TO PUBLIC; - -- 2.39.5