function start_process() { global $ngg; if (!$this->valid_access()) { return; } switch ($this->method) { case 'search': //search for some images $this->result['images'] = array_merge((array) nggdb::search_for_images($this->term), (array) nggTags::find_images_for_tags($this->term, 'ASC')); break; case 'album': //search for some album //TODO : Get images for each gallery, could end in a big db query $this->result['album'] = nggdb::find_album($this->id); break; case 'gallery': //search for some gallery $this->result['images'] = $this->id == 0 ? nggdb::find_last_images(0, 100) : nggdb::get_gallery($this->id, $ngg->options['galSort'], $ngg->options['galSortDir'], true, 0, 0, true); break; case 'image': //search for some image $this->result['images'] = nggdb::find_image($this->id); break; case 'tag': //search for images based on tags $this->result['images'] = nggTags::find_images_for_tags($this->term, 'ASC'); break; case 'recent': //search for images based on tags $this->result['images'] = nggdb::find_last_images(0, $this->limit); break; case 'autocomplete': //return images, galleries or albums for autocomplete drop down list return $this->autocomplete(); break; case 'version': $this->result = array('stat' => 'ok', 'version' => $ngg->version); return; break; default: $this->result = array('stat' => 'fail', 'code' => '98', 'message' => 'Method not known.'); return false; break; } // result should be fine $this->result['stat'] = 'ok'; }