} $script_display_field = PMA_getTablesInfo(); $tab_column = PMA_getColumnsInfo(); $script_tables = PMA_getScriptTabs(); $tables_pk_or_unique_keys = PMA_getPKOrUniqueKeys(); $tables_all_keys = PMA_getAllKeys(); $classes_side_menu = PMA_returnClassNamesFromMenuButtons(); $display_page = -1; $selected_page = null; if (isset($_REQUEST['query'])) { $display_page = PMA_getDefaultPage($_REQUEST['db']); } else { if (!empty($_REQUEST['page'])) { $display_page = $_REQUEST['page']; } else { $display_page = PMA_getLoadingPage($_REQUEST['db']); } } if ($display_page != -1) { $selected_page = PMA_getPageName($display_page); } $tab_pos = PMA_getTablePositions($display_page); $script_contr = PMA_getScriptContr(); $params = array('lang' => $GLOBALS['lang']); if (isset($_GET['db'])) { $params['db'] = $_GET['db']; } $response = PMA\libraries\Response::getInstance(); $response->getFooter()->setMinimal(); $header = $response->getHeader(); $header->setBodyId('pmd_body');
/** * Test for testGetLoadingPage() when there is no default page * * @return void */ public function testGetLoadingPageWithNoDefaultPage() { $db = 'db'; $first_pg = '1'; $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock(); $dbi->expects($this->at(0))->method('fetchResult')->with("SELECT `page_nr` FROM `pmadb`.`pdf_pages`" . " WHERE `db_name` = '" . $db . "'" . " AND `page_descr` = '" . $db . "'", null, null, 2, PMA_DatabaseInterface::QUERY_STORE)->will($this->returnValue(array())); $dbi->expects($this->at(1))->method('fetchResult')->with("SELECT MIN(`page_nr`) FROM `pmadb`.`pdf_pages`" . " WHERE `db_name` = '" . $db . "'", null, null, 2, PMA_DatabaseInterface::QUERY_STORE)->will($this->returnValue(array($first_pg))); $GLOBALS['dbi'] = $dbi; $result = PMA_getLoadingPage($db); $this->assertEquals($first_pg, $result); }
/** * Test for testGetLoadingPage() when there is no default page * * @return void */ public function testGetLoadingPageWithNoDefaultPage() { $db = 'db'; $first_pg = '1'; $dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock(); $dbi->expects($this->exactly(2))->method('fetchResult')->willReturnOnConsecutiveCalls(array(), array($first_pg)); $dbi->expects($this->any())->method('escapeString')->will($this->returnArgument(0)); $GLOBALS['dbi'] = $dbi; $result = PMA_getLoadingPage($db); $this->assertEquals($first_pg, $result); }