UploadNoplugin.class.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Provides upload functionalities for the import plugins
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. if (! defined('PHPMYADMIN')) {
  9. exit;
  10. }
  11. /* Get the transformations interface */
  12. require_once 'libraries/plugins/UploadInterface.int.php';
  13. /**
  14. * Implementation for no plugin
  15. *
  16. * @package PhpMyAdmin
  17. */
  18. class UploadNoplugin implements UploadInterface
  19. {
  20. /**
  21. * Gets the specific upload ID Key
  22. *
  23. * @return string ID Key
  24. */
  25. public static function getIdKey()
  26. {
  27. return 'noplugin';
  28. }
  29. /**
  30. * Returns upload status.
  31. *
  32. * This is implementation when no webserver support exists,
  33. * so it returns just zeroes.
  34. *
  35. * @param string $id upload id
  36. *
  37. * @return array|null
  38. */
  39. public static function getUploadStatus($id)
  40. {
  41. global $SESSION_KEY;
  42. if (trim($id) == "") {
  43. return null;
  44. }
  45. if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {
  46. $_SESSION[$SESSION_KEY][$id] = array(
  47. 'id' => $id,
  48. 'finished' => false,
  49. 'percent' => 0,
  50. 'total' => 0,
  51. 'complete' => 0,
  52. 'plugin' => UploadNoplugin::getIdKey()
  53. );
  54. }
  55. $ret = $_SESSION[$SESSION_KEY][$id];
  56. return $ret;
  57. }
  58. }
  59. ?>