Permalink
Browse files

Merge branch 'master' of github.com:gallery/gallery3-contrib

  • Loading branch information...
2 parents f2d5a4c + e7ababf commit 60f1a289e18464c36037c62c9ee6788427c74330 @bharat bharat committed Jan 22, 2012
Showing 748 changed files with 34,976 additions and 3,979 deletions.
@@ -19,7 +19,6 @@
*/
include("Mail.php");
include("Mail/mime.php");
-include("HTTP/Request.php");
class Gallery3 {
var $url;
@@ -64,6 +63,7 @@ static function factory($url=null, $token=null) {
*/
public function __construct() {
$this->data = new stdClass();
+ $this->data->entity = new stdClass();
$this->token = null;
$this->url = null;
}
@@ -169,7 +169,55 @@ public function load() {
}
class Gallery3_Helper {
+ static $instance = null;
+
static function request($method, $url, $token=null, $params=array(), $file=null) {
+ if (!isset(self::$instance)) {
+ @include("HTTP/Request2.php");
+ if (class_exists("HTTP_Request2")) {
+ self::$instance = new Gallery3_Helper_HTTP_Request2();
+ } else {
+ include("HTTP/Request.php");
+ self::$instance = new Gallery3_Helper_HTTP_Request();
+ }
+ }
+ return self::$instance->request($method, $url, $token, $params, $file);
+ }
+}
+
+class Gallery3_Helper_HTTP_Request2 {
+ function request($method, $url, $token, $params, $file) {
+ $req = new HTTP_Request2($url);
+ $req->setMethod($method == "get" ? 'GET' : 'POST');
+ $req->setHeader("X-Gallery-Request-Method", $method);
+ if ($token) {
+ $req->setHeader("X-Gallery-Request-Key", $token);
+ }
+ foreach ($params as $key => $value) {
+ $req->addPostParameter($key, is_string($value) ? $value : json_encode($value));
+ }
+ if ($file) {
+ $req->addUpload("file", $file, basename($file), mime_content_type($file));
+ }
+ $response = $req->send();
+ $status = $response->getStatus();
+
+ switch ($status) {
+ case 200:
+ case 201:
+ return json_decode($response->getBody());
+
+ case 403:
+ throw new Gallery3_Forbidden_Exception($response->getBody(),$status);
+
+ default:
+ throw new Gallery3_Exception($response->getBody(),$status);
+ }
+ }
+}
+
+class Gallery3_Helper_HTTP_Request {
+ function request($method, $url, $token, $params, $file) {
$req = new HTTP_Request($url);
$req->setMethod($method == "get" ? HTTP_REQUEST_METHOD_GET : HTTP_REQUEST_METHOD_POST);
$req->addHeader("X-Gallery-Request-Method", $method);
@@ -22,7 +22,16 @@
'RemoteMovie' , 'getItemFromResp' , 'getItemsFromResp']
from datetime import datetime
-import json , weakref , types , os , mimetypes , re
+import weakref , types , os , mimetypes , re
+try:
+ import json
+except:
+ try:
+ import simplejson
+ except ImportError , e:
+ raise ImportError('You must have either the "json" or "simplejson"'
+ 'library installed!')
+
class BaseRemote(object):
def __init__(self , respObj , weakGalObj , weakParent=None):
@@ -26,7 +26,15 @@
RemoteImage , Tag
from urllib import quote , urlencode
from uuid import uuid4
-import urllib2 , os , json
+import urllib2 , os
+try:
+ import json
+except:
+ try:
+ import simplejson
+ except ImportError , e:
+ raise ImportError('You must have either the "json" or "simplejson"'
+ 'library installed!')
class Gallery3(object):
"""
@@ -129,7 +137,6 @@ def getRespFromUri(self , uri , kwargs={}):
uri(str) : The uri string defining the resource on the defined host
"""
url = self._buildUrl(uri , kwargs)
- print url
return self.getRespFromUrl(url)
def addAlbum(self , parent , albumName , title , description=''):
@@ -21,4 +21,4 @@
from G3Items import *
from Gallery3 import *
-__version__ = '0.1.4'
+__version__ = '0.1.5'
@@ -0,0 +1,28 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+* Gallery - a web based photo album viewer and editor
+* Copyright (C) 2000-2009 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.
+*/
+class About_Controller extends Controller {
+ public function index() {
+ $template = new Theme_View("page.html", "other", "About");
+ $template->css("about.css");
+ $template->page_title = t("Gallery :: About");
+ $template->content = new View("about.html");
+ print $template;
+ }
+}
@@ -0,0 +1,61 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 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.
+ */
+class Admin_About_Controller extends Admin_Controller {
+ public function index() {
+ print $this->_get_view();
+ }
+
+ public function handler() {
+ access::verify_csrf();
+
+ $form = $this->_get_form();
+ if ($form->validate()) {
+ module::set_var(
+ "about", "code", $form->about->about_code->value);
+ module::set_var(
+ "about", "title", $form->about->about_title->value);
+ module::set_var (
+ "about", "hidden", $form->about->about_hidden->value);
+ message::success(t("Your settings have been saved."));
+ url::redirect("admin/about");
+ }
+
+ print $this->_get_view($form);
+ }
+
+ private function _get_view($form=null) {
+ $v = new Admin_View("admin.html");
+ $v->content = new View("admin_about.html");
+ $v->content->form = empty($form) ? $this->_get_form() : $form;
+ return $v;
+ }
+
+ private function _get_form() {
+ $form = new Forge("admin/about/handler", "", "post", array("id" => "g-admin-form"));
+ $group = $form->group("about");
+ $group->input("about_title")->label(t('Enter the headline.'))->value(module::get_var("about", "title"));
+ $group->textarea("about_code")->label(t('Enter the standard HTML code you want on the page.'))->value(module::get_var("about", "code"));
+ $group->checkbox("about_hidden")->label(t("Hide link"))
+ ->checked(module::get_var("about", "hidden", false) == 1);
+ $group->submit("submit")->value(t("Save"));
+
+ return $form;
+ }
+}
@@ -0,0 +1,2 @@
+table.about { text-align: center; width:500px; }
+table.about caption { font-size: 1.5em; padding: 0.2em; }
@@ -0,0 +1,39 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 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.
+ */
+class about_block_Core {
+ static function get_site_list() {
+ return array("about" => t("About page"));
+ }
+
+ static function get($block_id, $theme) {
+ $block = "";
+ switch ($block_id) {
+ case "about":
+ if ($theme->item()) {
+ $block = new Block();
+ $block->css_id = "g-metadata";
+ $block->title = module::get_var("about", "title");
+ $block->content = new View("about_block.html");
+ }
+ break;
+ }
+ return $block;
+ }
+}
@@ -0,0 +1,37 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 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.
+ */
+class about_event_Core {
+ static function admin_menu($menu, $theme) {
+ $menu->get("settings_menu")
+ ->append(Menu::factory("link")
+ ->id("about_menu")
+ ->label(t("About page"))
+ ->url(url::site("admin/about")));
+ }
+
+ static function site_menu($menu, $theme) {
+ if (module::get_var("about", "hidden") != true) {
+ $menu->add_after("home", Menu::factory("link")
+ ->id("about")
+ ->label(t("About"))
+ ->url(url::site("about/")));
+ }
+ }
+}
@@ -0,0 +1,26 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 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.
+ */
+class about_installer {
+ static function deactivate() {
+ module::clear_var("about", "title");
+ module::clear_var("about", "code");
+ module::clear_var("about", "hidden");
+ }
+}
@@ -0,0 +1,7 @@
+name = "About"
+description = "About page and detail."
+author_name = "floridave"
+author_url = "http://codex.gallery2.org/User:Floridave"
+info_url = "http://codex.gallery2.org/Gallery3:Modules:about"
+discuss_url = "http://gallery.menalto.com/forum_module_about"
+version = 1
@@ -0,0 +1,3 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<h1><?= module::get_var("about", "title"); ?></h1>
+<?= module::get_var("about", "code"); ?>
@@ -0,0 +1,2 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<?= module::get_var("about", "code"); ?>
@@ -0,0 +1,5 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div id="g-admin-code-block">
+ <h2><?= t("About Page Administration") ?></h2>
+ <?= $form ?>
+</div>
@@ -1,3 +1,7 @@
name = "About this Album"
description = "Show some simple, specific and useful info about a given album"
version = 1
+author_name = ""
+author_url = ""
+info_url = "http://codex.gallery2.org/Gallery3:Modules:about_this_album"
+discuss_url = "http://gallery.menalto.com/forum_module_about_this_album"
@@ -1,3 +1,7 @@
name = "About this Photo"
description = "Show some simple, specific and useful info about a given photo"
version = 3
+author_name = ""
+author_url = ""
+info_url = "http://codex.gallery2.org/Gallery3:Modules:about_this_photo"
+discuss_url = "http://gallery.menalto.com/forum_module_about_this_photo"
@@ -0,0 +1,29 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 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.
+ */
+/**
+ * PHP Mail Configuration parameters
+ * from => email address that appears as the from address
+ * line-length => word wrap length (PHP documentations suggest no larger tha 70 characters
+ * reply-to => what goes into the reply to header
+ */
+$config["ranges"] = array(
+ "Addthis1" => array("low" => "65.249.152.0", "high" => "65.249.159.255"),
+ "Addthis2" => array("low" => "208.122.55.0", "high" => "208.122.55.255")
+);
Oops, something went wrong.

0 comments on commit 60f1a28

Please sign in to comment.