/** * Constructor. * @param int $status a Gallery Remote status code */ public static function factory($status = '') { $reply = new GalleryRemoteReply(); $reply->set('status', $status); $reply->set('status_text', ''); return $reply; }
public function index() { $input = Input::instance(); $reply = GalleryRemoteReply::factory(gallery_remote::GR_STAT_SUCCESS); if ($this->_check_protocol($input, $reply)) { $reply->set('debug_gallery_version', gallery::version_string()); $reply->set('debug_user', identity::active_user()->name); $reply->set('debug_user_type', 'Gallery_User'); $reply->set('debug_user_already_logged_in', identity::active_user()->id != identity::guest()->id ? '1' : ''); $reply->set('server_version', '2.15'); $cmd = trim($input->post('cmd')); if ($cmd == 'login') { $this->_login($input, $reply); } else { if (self::isloggedin()) { switch ($cmd) { case 'no-op': $reply->set('status_text', 'Noop command successful.'); $reply->send(); break; case 'fetch-albums': case 'fetch-albums-prune': $this->_fetch_albums_prune($input, $reply); break; case 'new-album': $this->_new_album($input, $reply); break; case 'album-properties': $this->_album_properties($input, $reply); break; case 'add-item': $this->_add_item($input, $reply); break; case 'move-album': $this->_move_album($input, $reply); break; case 'increment-view-count': $this->_increment_view_count($input, $reply); break; case 'image-properties': $this->_image_properties($input, $reply); break; case 'fetch-album-images': $this->_fetch_album_images($input, $reply); break; default: $reply->send(gallery_remote::UNKNOWN_CMD); } } else { $reply->send(gallery_remote::LOGIN_MISSING); } } } }