Beispiel #1
0
 /**
  * Test for PMA\libraries\File::read
  *
  * @param string $file file string
  *
  * @return void
  * @dataProvider compressedFiles
  */
 public function testReadCompressed($file)
 {
     $file = new PMA\libraries\File($file);
     $file->setDecompressContent(true);
     $file->open();
     $this->assertEquals("TEST FILE\n", $file->read(100));
     $file->close();
 }
Beispiel #2
0
 // When a select field is nullified, it's not present in $_REQUEST
 // so initialize it; this way, the foreach($multi_edit_columns) will process it
 foreach ($multi_edit_columns_name as $key => $val) {
     if (!isset($multi_edit_columns[$key])) {
         $multi_edit_columns[$key] = '';
     }
 }
 // Iterate in the order of $multi_edit_columns_name,
 // not $multi_edit_columns, to avoid problems
 // when inserting multiple entries
 $insert_fail = false;
 foreach ($multi_edit_columns_name as $key => $column_name) {
     $current_value = $multi_edit_columns[$key];
     // Note: $key is an md5 of the fieldname. The actual fieldname is
     // available in $multi_edit_columns_name[$key]
     $file_to_insert = new PMA\libraries\File();
     $file_to_insert->checkTblChangeForm($key, $rownumber);
     $possibly_uploaded_val = $file_to_insert->getContent();
     if ($possibly_uploaded_val !== false) {
         $current_value = $possibly_uploaded_val;
     }
     // Apply Input Transformation if defined
     if (!empty($mime_map[$column_name]) && !empty($mime_map[$column_name]['input_transformation'])) {
         $filename = 'libraries/plugins/transformations/' . $mime_map[$column_name]['input_transformation'];
         if (is_file($filename)) {
             include_once $filename;
             $classname = PMA_getTransformationClassName($filename);
             /** @var IOTransformationsPlugin $transformation_plugin */
             $transformation_plugin = new $classname();
             $transformation_options = PMA_Transformation_getOptions($mime_map[$column_name]['input_transformation_options']);
             $current_value = $transformation_plugin->applyTransformation($current_value, $transformation_options);
Beispiel #3
0
 /**
  * Test for PMA\libraries\File::getContent
  *
  * @param string $file file string
  *
  * @return void
  * @dataProvider compressedFiles
  */
 public function testBinaryContent($file)
 {
     $data = '0x' . bin2hex(file_get_contents($file));
     $file = new PMA\libraries\File($file);
     $this->assertEquals($data, $file->getContent());
 }