<?php

defined('SYSPATH') or die('No direct access allowed.');
/**
 * Gallery - a web based photo album viewer and editor
 * Copyright (C) 2000-2013 Bharat Mediratta
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA  02110-1301, USA.
 */
$access_token = Session::instance()->get("g3_client_access_token");
$site = Kohana::config("core.gallery3_site");
G3Remote::instance($site, $access_token);
Ejemplo n.º 2
0
 private function _get_tag_block()
 {
     $response = G3Remote::instance()->get_resource("tag", array("limit" => "15"));
     if ($response->status == "OK") {
         $v = new View("tag_block.html");
         $v->tags = $response->tags;
         $v->max_count = $response->tags[0]->count;
     } else {
         $v = "";
     }
     return $v;
 }
Ejemplo n.º 3
0
 private static function _get($url, $_data_array = array(), $extra_headers = array())
 {
     $_data_raw = self::_encode_data($_data_array, $extra_headers);
     $handle = G3Remote::_open_socket("{$url}?{$_data_raw}", "GET", $extra_headers);
     /* Read the web page into a buffer */
     return G3Remote::_get_response($handle);
 }
Ejemplo n.º 4
0
 public function delete($type)
 {
     $path = $this->input->get("path");
     if ($_POST) {
         try {
             $response = G3Remote::instance()->delete_resource("gallery/{$path}");
             print json_encode(array("result" => "success", "path" => $response->resource->parent_path, "type" => $type));
         } catch (Exception $e) {
             print json_encode(array("result" => "fail", "message" => $e->getMessage()));
         }
         return;
     } else {
         $response = G3Remote::instance()->get_resource("gallery/{$path}");
         $v = new View("delete.html");
         $v->title = $response->resource->title;
         $v->path = "delete_album/?path={$path}";
     }
     print json_encode(array("form" => (string) $v));
 }