enable() public static method

Actually enables tracking. This needs to be done after all underlaying code is initialized.
public static enable ( ) : void
return void
Ejemplo n.º 1
0
    if (isset($response) && $response->isAjax() && $token_mismatch) {
        $response->setRequestStatus(false);
        $response->addJSON('message', Message::error(__('Error: Token mismatch')));
        exit;
    }
} else {
    // end if !defined('PMA_MINIMUM_COMMON')
    // load user preferences
    $GLOBALS['PMA_Config']->loadUserPreferences();
}
// remove sensitive values from session
$GLOBALS['PMA_Config']->set('blowfish_secret', '');
$GLOBALS['PMA_Config']->set('Servers', '');
$GLOBALS['PMA_Config']->set('default_server', '');
/* Tell tracker that it can actually work */
Tracker::enable();
/**
 * @global boolean $GLOBALS['is_ajax_request']
 * @todo should this be moved to the variables init section above?
 *
 * Check if the current request is an AJAX request, and set is_ajax_request
 * accordingly.  Suppress headers, footers and unnecessary output if set to
 * true
 */
if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
    $GLOBALS['is_ajax_request'] = true;
} else {
    $GLOBALS['is_ajax_request'] = false;
}
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
    PMA_fatalError(__("GLOBALS overwrite attempt"));
 /**
  * Test for Tracker::isTracked()
  *
  * @return void
  * @test
  */
 public function testIsTracked()
 {
     $attr = new \ReflectionProperty('PMA\\libraries\\Tracker', 'enabled');
     $attr->setAccessible(true);
     $attr->setValue(false);
     $this->assertFalse(Tracker::isTracked("", ""));
     Tracker::enable();
     $_SESSION['relation'][$GLOBALS['server']]['PMA_VERSION'] = PMA_VERSION;
     $_SESSION['relation'][$GLOBALS['server']]['trackingwork'] = false;
     $this->assertFalse(Tracker::isTracked("", ""));
     $_SESSION['relation'][$GLOBALS['server']]['trackingwork'] = true;
     $this->assertTrue(Tracker::isTracked("pma_test_db", "pma_test_table"));
     $this->assertFalse(Tracker::isTracked("pma_test_db", "pma_test_table2"));
 }