$import_handle = @gzopen($import_file, 'r'); } else { $message = PMA\libraries\Message::error(__('You attempted to load file with unsupported compression ' . '(%s). Either support for it is not implemented or disabled ' . 'by your configuration.')); $message->addParam($compression); PMA_stopImport($message); } break; case 'application/zip': if ($cfg['ZipDump'] && @function_exists('zip_open')) { /** * Load interface for zip extension. */ include_once 'libraries/zip_extension.lib.php'; $zipResult = PMA_getZipContents($import_file); if (!empty($zipResult['error'])) { $message = PMA\libraries\Message::rawError($zipResult['error']); PMA_stopImport($message); } else { $import_text = $zipResult['data']; } } else { $message = PMA\libraries\Message::error(__('You attempted to load file with unsupported compression ' . '(%s). Either support for it is not implemented or disabled ' . 'by your configuration.')); $message->addParam($compression); PMA_stopImport($message); } break; case 'none': $import_handle = @fopen($import_file, 'r'); break; default: $message = PMA\libraries\Message::error(__('You attempted to load file with unsupported compression (%s). ' . 'Either support for it is not implemented or disabled by your ' . 'configuration.'));
/** * Builds and executes the db creation sql query */ $sql_query = 'CREATE DATABASE ' . PMA\libraries\Util::backquote($_POST['new_db']); if (!empty($_POST['db_collation'])) { list($db_charset) = explode('_', $_POST['db_collation']); if (in_array($db_charset, $mysql_charsets) && in_array($_POST['db_collation'], $mysql_collations[$db_charset])) { $sql_query .= ' DEFAULT' . PMA_generateCharsetQueryPart($_POST['db_collation']); } $db_collation_for_ajax = $_POST['db_collation']; unset($db_charset); } $sql_query .= ';'; $result = $GLOBALS['dbi']->tryQuery($sql_query); if (!$result) { $message = PMA\libraries\Message::rawError($GLOBALS['dbi']->getError()); // avoid displaying the not-created db name in header or navi panel $GLOBALS['db'] = ''; $GLOBALS['table'] = ''; /** * If in an Ajax request, just display the message with {@link PMA\libraries\Response} */ if ($GLOBALS['is_ajax_request'] == true) { $response = PMA\libraries\Response::getInstance(); $response->setRequestStatus(false); $response->addJSON('message', $message); } else { include_once 'index.php'; } } else { $message = PMA\libraries\Message::success(__('Database %1$s has been created.'));
/** * test rawError method * * @return void */ public function testRawError() { $this->object = new PMA\libraries\Message('', PMA\libraries\Message::ERROR); $this->object->setMessage('test<&>'); $this->object->setBBCode(false); $this->assertEquals($this->object, PMA\libraries\Message::rawError('test<&>')); }