getError() public method

Returns possible error message.
public getError ( ) : Message | null
return Message | null error message
Exemplo n.º 1
0
} else {
    if (isset($_POST['submit_get_json'])) {
        $settings = PMA_loadUserprefs();
        $response = PMA\libraries\Response::getInstance();
        $response->addJSON('prefs', json_encode($settings['config_data']));
        $response->addJSON('mtime', $settings['mtime']);
        exit;
    } else {
        if (isset($_POST['submit_import'])) {
            // load from JSON file
            $json = '';
            if (isset($_POST['import_type']) && $_POST['import_type'] == 'text_file' && isset($_FILES['import_file']) && $_FILES['import_file']['error'] == UPLOAD_ERR_OK && is_uploaded_file($_FILES['import_file']['tmp_name'])) {
                $import_handle = new File($_FILES['import_file']['tmp_name']);
                $import_handle->checkUploadedFile();
                if ($import_handle->isError()) {
                    $error = $import_handle->getError();
                } else {
                    // read JSON from uploaded file
                    $json = $import_handle->getRawContent();
                }
            } else {
                // read from POST value (json)
                $json = isset($_POST['json']) ? $_POST['json'] : null;
            }
            // hide header message
            $_SESSION['userprefs_autoload'] = true;
            $config = json_decode($json, true);
            $return_url = isset($_POST['return_url']) ? $_POST['return_url'] : null;
            if (!is_array($config)) {
                if (!isset($error)) {
                    $error = __('Could not import configuration');
Exemplo n.º 2
0
     */
    if (@is_link($import_file)) {
        $import_file = 'none';
    }
} elseif (empty($import_file) || !is_uploaded_file($import_file)) {
    $import_file = 'none';
}
// Do we have file to import?
if ($import_file != 'none' && !$error) {
    /**
     *  Handle file compression
     */
    $import_handle = new File($import_file);
    $import_handle->checkUploadedFile();
    if ($import_handle->isError()) {
        PMA_stopImport($import_handle->getError());
    }
    $import_handle->setDecompressContent(true);
    $import_handle->open();
    if ($import_handle->isError()) {
        PMA_stopImport($import_handle->getError());
    }
} elseif (!$error) {
    if (!isset($import_text) || empty($import_text)) {
        $message = PMA\libraries\Message::error(__('No data was received to import. Either no file name was ' . 'submitted, or the file size exceeded the maximum size permitted ' . 'by your PHP configuration. See [doc@faq1-16]FAQ 1.16[/doc].'));
        PMA_stopImport($message);
    }
}
// so we can obtain the message
//$_SESSION['Import_message'] = $message->getDisplay();
// Convert the file's charset if necessary