summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2013-02-15 12:55:16 -0500
committerBharat Mediratta <bharat@menalto.com>2013-02-15 12:57:42 -0500
commit264e1e82b23f622e9a79f7834cfcbfb536eac4f6 (patch)
treef77d0a923761d0a1d34ec4856ea91a9ab951c19c /modules
parent6089374891407dda5da27bbceb9aa774004737b6 (diff)
Digibug up and vanished. Move the module to contrib for now. This
will leave the module active in any existing installs that had it active, but that shouldn't cause any negative impact. Fixes #2002.
Diffstat (limited to 'modules')
-rw-r--r--modules/digibug/config/digibug.php29
-rw-r--r--modules/digibug/controllers/admin_digibug.php27
-rw-r--r--modules/digibug/controllers/digibug.php121
-rw-r--r--modules/digibug/helpers/digibug_event.php52
-rw-r--r--modules/digibug/helpers/digibug_installer.php51
-rw-r--r--modules/digibug/helpers/digibug_theme.php24
-rw-r--r--modules/digibug/images/digibug_logo.pngbin17296 -> 0 bytes
-rw-r--r--modules/digibug/js/digibug.js43
-rw-r--r--modules/digibug/models/digibug_proxy.php22
-rw-r--r--modules/digibug/module.info7
-rw-r--r--modules/digibug/tests/Digibug_Controller_Test.php74
-rw-r--r--modules/digibug/views/admin_digibug.html.php20
-rw-r--r--modules/digibug/views/digibug_form.html.php13
13 files changed, 0 insertions, 483 deletions
diff --git a/modules/digibug/config/digibug.php b/modules/digibug/config/digibug.php
deleted file mode 100644
index 9412ca96..00000000
--- a/modules/digibug/config/digibug.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.");
-/**
- * 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.
- */
-/**
- * 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(
- "Digibug1" => array("low" => "65.249.152.0", "high" => "65.249.159.255"),
- "Digibug2" => array("low" => "208.122.55.0", "high" => "208.122.55.255")
-);
diff --git a/modules/digibug/controllers/admin_digibug.php b/modules/digibug/controllers/admin_digibug.php
deleted file mode 100644
index 50f6f832..00000000
--- a/modules/digibug/controllers/admin_digibug.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.");
-/**
- * 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.
- */
-class Admin_Digibug_Controller extends Admin_Controller {
- public function index() {
- $v = new Admin_View("admin.html");
- $v->page_title = t("Digibug");
- $v->content = new View("admin_digibug.html");
- print $v;
- }
-} \ No newline at end of file
diff --git a/modules/digibug/controllers/digibug.php b/modules/digibug/controllers/digibug.php
deleted file mode 100644
index 19199188..00000000
--- a/modules/digibug/controllers/digibug.php
+++ /dev/null
@@ -1,121 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.");
-/**
- * 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.
- */
-class Digibug_Controller extends Controller {
- const ALLOW_PRIVATE_GALLERY = true;
-
- public function print_photo($id) {
- access::verify_csrf();
- $item = ORM::factory("item", $id);
- access::required("view", $item);
-
- if (access::group_can(identity::everybody(), "view_full", $item)) {
- $full_url = $item->file_url(true);
- $thumb_url = $item->thumb_url(true);
- } else {
- $proxy = ORM::factory("digibug_proxy");
- $proxy->uuid = random::hash();
- $proxy->item_id = $item->id;
- $proxy->save();
- $full_url = url::abs_site("digibug/print_proxy/full/$proxy->uuid/$item->id");
- $thumb_url = url::abs_site("digibug/print_proxy/thumb/$proxy->uuid/$item->id");
- }
-
- $v = new View("digibug_form.html");
- $v->order_params = array(
- "digibug_api_version" => "100",
- "company_id" => module::get_var("digibug", "company_id"),
- "event_id" => module::get_var("digibug", "event_id"),
- "cmd" => "addimg",
- "partner_code" => "69",
- "return_url" => url::abs_site("digibug/close_window"),
- "num_images" => "1",
- "image_1" => $full_url,
- "thumb_1" => $thumb_url,
- "image_height_1" => $item->height,
- "image_width_1" => $item->width,
- "thumb_height_1" => $item->thumb_height,
- "thumb_width_1" => $item->thumb_width,
- "title_1" => html::purify($item->title));
-
- print $v;
- }
-
- public function print_proxy($type, $uuid) {
- // If its a request for the full size then make sure we are coming from an
- // authorized address
- if ($type == "full") {
- $remote_addr = ip2long(Input::instance()->server("REMOTE_ADDR"));
- if ($remote_addr === false) {
- throw new Kohana_404_Exception();
- }
- $config = Kohana::config("digibug");
-
- $authorized = false;
- foreach ($config["ranges"] as $ip_range) {
- $low = ip2long($ip_range["low"]);
- $high = ip2long($ip_range["high"]);
- $authorized = $low !== false && $high !== false &&
- $low <= $remote_addr && $remote_addr <= $high;
- if ($authorized) {
- break;
- }
- }
- if (!$authorized) {
- throw new Kohana_404_Exception();
- }
- }
-
- $proxy = ORM::factory("digibug_proxy")->where("uuid", "=", $uuid)->find();
- if (!$proxy->loaded() || !$proxy->item->loaded()) {
- throw new Kohana_404_Exception();
- }
-
- $file = $type == "full" ? $proxy->item->file_path() : $proxy->item->thumb_path();
- if (!file_exists($file)) {
- throw new Kohana_404_Exception();
- }
-
- // We don't need to save the session for this request
- Session::instance()->abort_save();
-
- if (!TEST_MODE) {
- // Dump out the image
- header("Content-Type: {$proxy->item->mime_type}");
- Kohana::close_buffers(false);
- $fd = fopen($file, "rb");
- fpassthru($fd);
- fclose($fd);
- }
-
- $this->_clean_expired();
- }
-
- public function close_window() {
- print "<script type=\"text/javascript\">window.close();</script>";
- }
-
- private function _clean_expired() {
- db::build()
- ->delete("digibug_proxies")
- ->where("request_date", "<=", db::expr("(CURDATE() - INTERVAL 90 DAY)"))
- ->limit(20)
- ->execute();
- }
-} \ No newline at end of file
diff --git a/modules/digibug/helpers/digibug_event.php b/modules/digibug/helpers/digibug_event.php
deleted file mode 100644
index eaebc87b..00000000
--- a/modules/digibug/helpers/digibug_event.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.");
-/**
- * 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.
- */
-class digibug_event_Core {
- static function admin_menu($menu, $theme) {
- $menu->get("settings_menu")
- ->append(Menu::factory("link")
- ->id("digibug_menu")
- ->label(t("Digibug"))
- ->url(url::site("admin/digibug")));
- }
-
- static function site_menu($menu, $theme) {
- $item = $theme->item();
- if ($item && $item->type == "photo") {
- $menu->get("options_menu")
- ->append(Menu::factory("link")
- ->id("digibug")
- ->label(t("Print with Digibug"))
- ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf"))
- ->css_id("g-print-digibug-link")
- ->css_class("g-print-digibug-link ui-icon-print"));
- }
- }
-
- static function context_menu($menu, $theme, $item) {
- if ($item->type == "photo") {
- $menu->get("options_menu")
- ->append(Menu::factory("link")
- ->id("digibug")
- ->label(t("Print with Digibug"))
- ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf"))
- ->css_class("g-print-digibug-link ui-icon-print"));
- }
- }
-}
diff --git a/modules/digibug/helpers/digibug_installer.php b/modules/digibug/helpers/digibug_installer.php
deleted file mode 100644
index be88b5ec..00000000
--- a/modules/digibug/helpers/digibug_installer.php
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.");
-/**
- * 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.
- */
-class digibug_installer {
- static function install() {
- Database::instance()
- ->query("CREATE TABLE {digibug_proxies} (
- `id` int(9) NOT NULL AUTO_INCREMENT,
- `uuid` char(32) NOT NULL,
- `request_date` TIMESTAMP NOT NULL DEFAULT current_timestamp,
- `item_id` int(9) NOT NULL,
- PRIMARY KEY (`id`))
- DEFAULT CHARSET=utf8;");
-
- module::set_var("digibug", "company_id", "3153");
- module::set_var("digibug", "event_id", "8491");
- }
-
- static function upgrade($version) {
- if ($version == 1) {
- module::clear_var("digibug", "default_company_id");
- module::clear_var("digibug", "default_event_id");
- module::clear_var("digibug", "basic_default_company_id");
- module::clear_var("digibug", "basic_event_id");
- module::set_var("digibug", "company_id", "3153");
- module::set_var("digibug", "event_id", "8491");
- module::set_version("digibug", $version = 2);
- }
- }
-
- static function uninstall() {
- Database::instance()->query("DROP TABLE IF EXISTS {digibug_proxies}");
- module::delete("digibug");
- }
-}
diff --git a/modules/digibug/helpers/digibug_theme.php b/modules/digibug/helpers/digibug_theme.php
deleted file mode 100644
index e3795c3b..00000000
--- a/modules/digibug/helpers/digibug_theme.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.");
-/**
- * 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.
- */
-class digibug_theme_Core {
- static function head($theme) {
- return $theme->script("digibug.js");
- }
-}
diff --git a/modules/digibug/images/digibug_logo.png b/modules/digibug/images/digibug_logo.png
deleted file mode 100644
index 5eac2c7d..00000000
--- a/modules/digibug/images/digibug_logo.png
+++ /dev/null
Binary files differ
diff --git a/modules/digibug/js/digibug.js b/modules/digibug/js/digibug.js
deleted file mode 100644
index 46ddac52..00000000
--- a/modules/digibug/js/digibug.js
+++ /dev/null
@@ -1,43 +0,0 @@
-$(document).ready(function() {
- $(".g-print-digibug-link").click(function(e) {
- e.preventDefault();
- return digibug_popup(e.currentTarget.href, { width: 800, height: 600 } );
- });
-});
-
-function digibug_popup(url, options) {
- options = $.extend({
- /* default options */
- width: '800',
- height: '600',
- target: 'dbPopWin',
- scrollbars: 'yes',
- resizable: 'no',
- menuBar: 'no',
- addressBar: 'yes'
- }, options);
-
- // center the window by default.
- if (!options.winY) {
- options.winY = screen.height / 2 - options.height / 2;
- };
- if (!options.winX) {
- options.winX = screen.width / 2 - options.width / 2;
- };
-
- open(
- url,
- options['target'],
- 'width= ' + options.width +
- ',height=' + options.height +
- ',top=' + options.winY +
- ',left=' + options.winX +
- ',scrollbars=' + options.scrollbars +
- ',resizable=' + options.resizable +
- ',menubar=' + options.menuBar +
- ',location=' + options.addressBar
- );
-
- return false;
-
-}
diff --git a/modules/digibug/models/digibug_proxy.php b/modules/digibug/models/digibug_proxy.php
deleted file mode 100644
index 18c77d49..00000000
--- a/modules/digibug/models/digibug_proxy.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.");
-/**
- * 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.
- */
-class Digibug_Proxy_Model_Core extends ORM {
- protected $belongs_to = array("item");
-}
diff --git a/modules/digibug/module.info b/modules/digibug/module.info
deleted file mode 100644
index 5e5ca10f..00000000
--- a/modules/digibug/module.info
+++ /dev/null
@@ -1,7 +0,0 @@
-name = "Digibug"
-description = "Digibug Photo Printing Module"
-version = 2
-author_name = "Gallery Team"
-author_url = "http://codex.galleryproject.org/Gallery:Team"
-info_url = "http://codex.galleryproject.org/Gallery3:Modules:digibug"
-discuss_url = "http://galleryproject.org/forum_module_digibug"
diff --git a/modules/digibug/tests/Digibug_Controller_Test.php b/modules/digibug/tests/Digibug_Controller_Test.php
deleted file mode 100644
index 3b3ceba2..00000000
--- a/modules/digibug/tests/Digibug_Controller_Test.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.");
-/**
- * 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.
- */
-class Digibug_Controller_Test extends Gallery_Unit_Test_Case {
- private $_server;
-
- public function setup() {
- $this->_server = $_SERVER;
- }
-
- public function teardown() {
- $_SERVER = $this->_server;
- }
-
- private function _get_proxy() {
- $album = test::random_album();
- $photo = test::random_photo($album);
-
- access::deny(identity::everybody(), "view_full", $album);
- access::deny(identity::registered_users(), "view_full", $album);
-
- $proxy = ORM::factory("digibug_proxy");
- $proxy->uuid = random::hash();
- $proxy->item_id = $photo->id;
- return $proxy->save();
- }
-
- public function digibug_request_thumb_test() {
- $proxy = $this->_get_proxy();
-
- $controller = new Digibug_Controller();
- $controller->print_proxy("thumb", $proxy->uuid);
- }
-
- public function digibug_request_full_malicious_ip_test() {
- $_SERVER["REMOTE_ADDR"] = "123.123.123.123";
- try {
- $controller = new Digibug_Controller();
- $controller->print_proxy("full", $this->_get_proxy()->uuid);
- $this->assert_true(false, "Should have failed with an 404 exception");
- } catch (Kohana_404_Exception $e) {
- // expected behavior
- }
- }
-
- public function digibug_request_full_authorized_ip_test() {
- $config = Kohana::config("digibug");
- $this->assert_true(!empty($config), "The Digibug config is empty");
-
- $ranges = array_values($config["ranges"]);
- $low = ip2long($ranges[0]["low"]);
- $high = ip2long($ranges[0]["high"]);
-
- $_SERVER["REMOTE_ADDR"] = long2ip(rand($low, $high));
- $controller = new Digibug_Controller();
- $controller->print_proxy("full", $this->_get_proxy()->uuid);
- }
-}
diff --git a/modules/digibug/views/admin_digibug.html.php b/modules/digibug/views/admin_digibug.html.php
deleted file mode 100644
index d673b116..00000000
--- a/modules/digibug/views/admin_digibug.html.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.") ?>
-<div class="g-block">
- <img src="<?= url::file("modules/digibug/images/digibug_logo.png") ?>" alt="Digibug logo" class="g-right"/>
- <h1> <?= t("Digibug photo printing") ?> </h1>
- <div class="g-block-content">
- <p>
- <?= t("Turn your photos into a wide variety of prints, gifts and games!") ?>
- </p>
- <ul>
- <li class="g-module-status g-success">
- <?= t("You're ready to print photos!") ?>
- </li>
- </ul>
- <p>
- <?= t("You don't need an account with Digibug, but if you <a href=\"%signup_url\">register with Digibug</a> and enter your Digibug id in the <a href=\"%advanced_settings_url\">Advanced Settings</a> page you can make money off of your photos!",
- array("signup_url" => "http://www.digibug.com/signup.php",
- "advanced_settings_url" => html::mark_clean(url::site("admin/advanced_settings")))) ?>
- </p>
- </div>
-</div>
diff --git a/modules/digibug/views/digibug_form.html.php b/modules/digibug/views/digibug_form.html.php
deleted file mode 100644
index af5a88b4..00000000
--- a/modules/digibug/views/digibug_form.html.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.") ?>
-<html>
- <body>
- <?= form::open("http://www.digibug.com/dapi/order.php") ?>
- <? foreach ($order_params as $key => $value): ?>
- <?= form::hidden($key, $value) ?>
- <? endforeach ?>
- </form>
- <script type="text/javascript">
- document.forms[0].submit();
- </script>
- </body>
-</html>