| 12345678910111213141516171819202122232425262728293031323334 | 
							- <?php
 
- require_once('include/config.php');
 
- require_once('include/db.php');
 
- function dirlist($dir) {
 
- 	if (empty($dir)) {
 
- 		throw new Exception('Niepoprawne żądanie');
 
- 	}
 
- 	$images = get_dir_images($dir);
 
- 	if (!$images) {
 
- 		throw new Exception('Brak wyników');
 
- 	}
 
- 	$ord = 0;
 
- 	$res = [];
 
- 	foreach ($images as $image) {
 
- 		$res[] = array('id' => $image['id'], 'name' => $image['path'], 'ord' => $ord);
 
- 		$ord++;
 
- 	}
 
- 	return $res;
 
- }
 
- $output = [];
 
- try {
 
- 	$output = dirlist(@$_GET['dir']);
 
- } catch (Exception $e) {
 
- 	$output['error'] = true;
 
- 	$output['exception'] = $e;
 
- }
 
- header("Content-Type: application/json");
 
- echo json_encode($output);
 
- ?>
 
 
  |