forked from gallery/gallery3-contrib
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of git://github.com/gallery/gallery3-contrib in…
…to rawphoto
- Loading branch information
Showing
86 changed files
with
7,201 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
table.about { text-align: center; width:500px; } | ||
table.about caption { font-size: 1.5em; padding: 0.2em; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/"))); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php defined("SYSPATH") or die("No direct script access.") ?> | ||
<?= module::get_var("about", "code"); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
<?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 Addthis_Controller extends Controller { | ||
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("addthis_proxy"); | ||
$proxy->uuid = md5(rand()); | ||
$proxy->item_id = $item->id; | ||
$proxy->save(); | ||
$full_url = url::abs_site("addthis/print_proxy/full/$proxy->uuid"); | ||
$thumb_url = url::abs_site("addthis/print_proxy/thumb/$proxy->uuid"); | ||
} | ||
|
||
$v = new View("addthis_form.html"); | ||
$v->order_parms = array( | ||
"addthis_api_version" => "100", | ||
"company_id" => module::get_var("addthis", "company_id"), | ||
"event_id" => module::get_var("addthis", "event_id"), | ||
"cmd" => "addimg", | ||
"partner_code" => "69", | ||
"return_url" => url::abs_site("addthis/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, $id) { | ||
// If its a request for the full size then make sure we are coming from an | ||
// authorized address | ||
if ($type == "full") { | ||
$remote_addr = ip2long($this->input->server("REMOTE_ADDR")); | ||
if ($remote_addr === false) { | ||
Kohana::show_404(); | ||
} | ||
$config = Kohana::config("addthis"); | ||
|
||
$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) { | ||
Kohana::show_404(); | ||
} | ||
} | ||
|
||
$proxy = ORM::factory("addthis_proxy", array("uuid" => $id)); | ||
if (!$proxy->loaded || !$proxy->item->loaded) { | ||
Kohana::show_404(); | ||
} | ||
|
||
$file = $type == "full" ? $proxy->item->file_path() : $proxy->item->thumb_path(); | ||
if (!file_exists($file)) { | ||
kohana::show_404(); | ||
} | ||
|
||
// We don't need to save the session for this request | ||
Session::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); | ||
|
||
// If the request was for the image and not the thumb, then delete the proxy. | ||
if ($type == "full") { | ||
$proxy->delete(); | ||
} | ||
} | ||
|
||
$this->_clean_expired(); | ||
} | ||
|
||
public function close_window() { | ||
print "<script type=\"text/javascript\">window.close();</script>"; | ||
} | ||
|
||
private function _clean_expired() { | ||
Database::instance()->query( | ||
"DELETE FROM {addthis_proxies} " . | ||
"WHERE request_date <= (CURDATE() - INTERVAL 10 DAY) " . | ||
"LIMIT 20"); | ||
} | ||
} |
Oops, something went wrong.