Example #1
0
     echo json_encode($result);
     exit;
 } else {
     if (matches($getpost['R'], 'images')) {
         $result = array();
         $images_model = new FileImage($database);
         $images = $images_model->All('ORDER BY ID DESC');
         $files = new File($database);
         $i = 0;
         if (!isset($getpost['N'])) {
             $result[$i++] = array(0 => 0, 1 => "None", 2 => "i/none64.png", 3 => '<div><span class="enormous">X</span></div>');
         }
         if (!false_or_null($images)) {
             foreach ($images as $s) {
                 // Return available image file ids
                 $f = $files->Get($s['r_File']);
                 if (!false_or_null($f)) {
                     $tname = $files->ThumbName($f);
                     $result[$i++] = array(0 => intval($s['ID']), 1 => $f['Name'] . ' #' . $f['ID'] . ' ' . $s['Width'] . 'x' . $s['Height'], 2 => $files->ThumbName($f), 3 => $f['ID'], 4 => '<img src="' . $tname . '"><div>' . $f['Name'] . ' (#' . $item['ID'] . ')</div><div class="json-stat-image">' . $stats . '</div>');
                 }
             }
         }
         echo json_encode($result);
         exit;
     } else {
         // Catch-all generic response for table
         if (file_exists('model/' . $getpost['R'] . '.php')) {
             $classname = $getpost['R'];
             $result = array();
             $model = new $classname($database);
             $rows = $model->All();
Example #2
0
 public function GetFile($fi)
 {
     global $database;
     $fm = new File($database);
     return $fm->Get($fi['r_File']);
 }