Merge branch 'master' of git@github.com:gallery/gallery3-contrib into talmdal
This commit is contained in:
commit
972230ffde
@ -48,13 +48,15 @@ class Admin_ContactOwner_Controller extends Admin_Controller {
|
||||
$str_contactbutton = Input::instance()->post("owner_button_text");
|
||||
$str_contactemail = Input::instance()->post("owner_email");
|
||||
$str_contactname = Input::instance()->post("owner_name");
|
||||
$str_messageheader = Input::instance()->post("message_header");
|
||||
|
||||
// Save Settings.
|
||||
module::set_var("contactowner", "contact_owner_link", $ownerLink);
|
||||
module::set_var("contactowner", "contact_user_link", $userLink);
|
||||
module::set_var("contactowner", "contact_button_text", $str_contactbutton);
|
||||
module::set_var("contactowner", "contact_owner_email", $str_contactemail );
|
||||
module::set_var("contactowner", "contact_owner_name", $str_contactname );
|
||||
module::set_var("contactowner", "contact_owner_email", $str_contactemail);
|
||||
module::set_var("contactowner", "contact_owner_name", $str_contactname);
|
||||
module::set_var("contactowner", "contact_owner_header", $str_messageheader);
|
||||
message::success(t("Your Settings Have Been Saved."));
|
||||
|
||||
// Load Admin page.
|
||||
@ -86,9 +88,12 @@ class Admin_ContactOwner_Controller extends Admin_Controller {
|
||||
$add_contacts->input("owner_button_text")->label(t("Contact Owner Link Text"))->value(module::get_var("contactowner", "contact_button_text"));
|
||||
$add_contacts->input("owner_email")->label(t("Owner Email Address"))->value(module::get_var("contactowner", "contact_owner_email"));
|
||||
$add_contacts->input("owner_name")->label(t("Owner Name"))->value(module::get_var("contactowner", "contact_owner_name"));
|
||||
|
||||
|
||||
$message_prefs = $form->group("messagePrefs");
|
||||
$message_prefs->input("message_header")->label(t("Email Message Header"))->value(module::get_var("contactowner", "contact_owner_header"));
|
||||
|
||||
// Add a save button to the form.
|
||||
$add_contacts->submit("SaveSettings")->value(t("Save"));
|
||||
$form->submit("SaveSettings")->value(t("Save"));
|
||||
|
||||
// Return the newly generated form.
|
||||
return $form;
|
||||
|
@ -85,46 +85,70 @@ class ContactOwner_Controller extends Controller {
|
||||
// Process the data from the form into an email,
|
||||
// then send the email.
|
||||
|
||||
// Copy the data from the email from into a couple of variables.
|
||||
$str_emailsubject = Input::instance()->post("email_subject");
|
||||
$str_emailtoid = Input::instance()->post("email_to_id");
|
||||
$str_emailfrom = Input::instance()->post("email_from");
|
||||
$str_emailbody = Input::instance()->post("email_body");
|
||||
// Make sure the form was submitted.
|
||||
if ($_POST) {
|
||||
// Set up some rules to validate the form against.
|
||||
$post = new Validation($_POST);
|
||||
$post->add_rules('email_from', 'required', 'valid::email');
|
||||
$post->add_rules('email_subject', 'required');
|
||||
$post->add_rules('email_body', 'required');
|
||||
|
||||
// If the form was filled out properly then...
|
||||
if ($post->validate()) {
|
||||
// Copy the data from the email form into a couple of variables.
|
||||
$str_emailsubject = Input::instance()->post("email_subject");
|
||||
$str_emailtoid = Input::instance()->post("email_to_id");
|
||||
$str_emailfrom = Input::instance()->post("email_from");
|
||||
$str_emailbody = Input::instance()->post("email_body");
|
||||
|
||||
// Add in some <br> tags to the message body where ever there are line breaks.
|
||||
$str_emailbody = str_replace("\n", "\n<br/>", $str_emailbody);
|
||||
// Add in some <br> tags to the message body where ever there are line breaks.
|
||||
$str_emailbody = str_replace("\n", "\n<br/>", $str_emailbody);
|
||||
|
||||
// Gallery's Sendmail library doesn't allow for custom from addresses,
|
||||
// so add the from email to the beginning of the message body instead.
|
||||
$str_emailbody = "Message Sent From " . $str_emailfrom . "\r\n\r\n<br/><br/>" . $str_emailbody;
|
||||
// Gallery's Sendmail library doesn't allow for custom from addresses,
|
||||
// so add the from email to the beginning of the message body instead.
|
||||
// Also add in the admin-defined message header.
|
||||
$str_emailbody = module::get_var("contactowner", "contact_owner_header") . "<br/>\r\n" . "Message Sent From " . $str_emailfrom . "<br/>\r\n<br/>\r\n" . $str_emailbody;
|
||||
|
||||
// Figure out where the email is going to.
|
||||
$str_emailto = "";
|
||||
if ($str_emailtoid == -1) {
|
||||
// If the email id is "-1" send the message to a pre-determined
|
||||
// owner email address.
|
||||
$str_emailto = module::get_var("contactowner", "contact_owner_email");
|
||||
} else {
|
||||
// or else grab the email from the user table.
|
||||
$userDetails = ORM::factory("user")
|
||||
->where("id", "=", $str_emailtoid)
|
||||
->find_all();
|
||||
$str_emailto = $userDetails[0]->email;
|
||||
// Figure out where the email is going to.
|
||||
$str_emailto = "";
|
||||
if ($str_emailtoid == -1) {
|
||||
// If the email id is "-1" send the message to a pre-determined
|
||||
// owner email address.
|
||||
$str_emailto = module::get_var("contactowner", "contact_owner_email");
|
||||
} else {
|
||||
// or else grab the email from the user table.
|
||||
$userDetails = ORM::factory("user")
|
||||
->where("id", "=", $str_emailtoid)
|
||||
->find_all();
|
||||
$str_emailto = $userDetails[0]->email;
|
||||
}
|
||||
|
||||
// Send the email message.
|
||||
Sendmail::factory()
|
||||
->to($str_emailto)
|
||||
->subject($str_emailsubject)
|
||||
->header("Mime-Version", "1.0")
|
||||
->header("Content-type", "text/html; charset=utf-8")
|
||||
->message($str_emailbody)
|
||||
->send();
|
||||
|
||||
// Display a message telling the visitor that their email has been sent.
|
||||
$template = new Theme_View("page.html", "other", "Contact");
|
||||
$template->content = new View("contactowner_emailform.html");
|
||||
$template->content->sendmail_form = t("Your Message Has Been Sent.");
|
||||
print $template;
|
||||
} else {
|
||||
// Display a message telling the visitor that their email has been not been sent,
|
||||
// along with the reason(s) why.
|
||||
$template = new Theme_View("page.html", "other", "Contact");
|
||||
$template->content = new View("contactowner_emailform.html");
|
||||
$template->content->sendmail_form = t("Your Message Has Not Been Sent.");
|
||||
$template->content->sendmail_form = $template->content->sendmail_form . "<br/><br/>" . t("Reason(s):") . "<br/>";
|
||||
foreach($post->errors('form_error_messages') as $error) {
|
||||
$template->content->sendmail_form = $template->content->sendmail_form . " - " . t($error) . "<br/>";
|
||||
}
|
||||
print $template;
|
||||
}
|
||||
}
|
||||
|
||||
// Send the email message.
|
||||
Sendmail::factory()
|
||||
->to($str_emailto)
|
||||
->subject($str_emailsubject)
|
||||
->header("Mime-Version", "1.0")
|
||||
->header("Content-type", "text/html; charset=utf-8")
|
||||
->message($str_emailbody)
|
||||
->send();
|
||||
|
||||
// Display a message telling the visitor that their email has been sent.
|
||||
$template = new Theme_View("page.html", "other", "Contact");
|
||||
$template->content = new View("contactowner_emailform.html");
|
||||
$template->content->sendmail_form = t("Your Message Has Been Sent.");
|
||||
print $template;
|
||||
}
|
||||
}
|
||||
}
|
35
modules/contactowner/helpers/contactowner_installer.php
Normal file
35
modules/contactowner/helpers/contactowner_installer.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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 contactowner_installer {
|
||||
static function install() {
|
||||
// Set some default values
|
||||
module::set_var("contactowner", "contact_owner_link", false);
|
||||
module::set_var("contactowner", "contact_user_link", true);
|
||||
module::set_var("contactowner", "contact_button_text", "Email The Webmaster");
|
||||
module::set_var("contactowner", "contact_owner_name", "Webmaster");
|
||||
module::set_var("contactowner", "contact_owner_header", "You have received a message through your website:");
|
||||
|
||||
module::set_version("contactowner", 2);
|
||||
}
|
||||
|
||||
static function uninstall() {
|
||||
module::delete("contactowner");
|
||||
}
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
name = "ContactOwner"
|
||||
description = "Allows visitors to send the website owner an email."
|
||||
version = 1
|
||||
version = 2
|
||||
|
@ -33,13 +33,9 @@ class Admin_DownloadFullsize_Controller extends Admin_Controller {
|
||||
|
||||
// Figure out which boxes where checked
|
||||
$dlLinks_array = Input::instance()->post("DownloadLinkOptions");
|
||||
$tButton = false;
|
||||
$fButton = false;
|
||||
$download_original_button = false;
|
||||
for ($i = 0; $i < count($dlLinks_array); $i++) {
|
||||
if ($dlLinks_array[$i] == "tButton") {
|
||||
$tButton = true;
|
||||
}
|
||||
if ($dlLinks_array[$i] == "fButton") {
|
||||
$fButton = true;
|
||||
}
|
||||
@ -56,7 +52,6 @@ class Admin_DownloadFullsize_Controller extends Admin_Controller {
|
||||
}
|
||||
|
||||
// Save Settings.
|
||||
module::set_var("downloadfullsize", "tButton", $tButton);
|
||||
module::set_var("downloadfullsize", "fButton", $fButton);
|
||||
message::success(t("Your Selection Has Been Saved."));
|
||||
|
||||
@ -74,8 +69,7 @@ class Admin_DownloadFullsize_Controller extends Admin_Controller {
|
||||
array("id" => "g-download-fullsize-adminForm"));
|
||||
|
||||
// Make an array for the different types of download links.
|
||||
$linkOptions["fButton"] = array(t("Show Floppy Disk Link"), module::get_var("downloadfullsize", "fButton"));
|
||||
$linkOptions["tButton"] = array(t("Show Text Download Text Link"), module::get_var("downloadfullsize", "tButton"));
|
||||
$linkOptions["fButton"] = array(t("Show Floppy Disk Picture Link"), module::get_var("downloadfullsize", "fButton"));
|
||||
|
||||
// Setup a few checkboxes on the form.
|
||||
$add_links = $form->group("DownloadLinks");
|
||||
|
51
modules/downloadfullsize/helpers/downloadfullsize_block.php
Normal file
51
modules/downloadfullsize/helpers/downloadfullsize_block.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?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 downloadfullsize_block_Core {
|
||||
static function get_site_list() {
|
||||
return array("downloadfullsize" => t("Download Item"));
|
||||
}
|
||||
|
||||
static function get($block_id, $theme) {
|
||||
$item = $theme->item;
|
||||
switch ($block_id) {
|
||||
case "downloadfullsize":
|
||||
|
||||
// If Item is movie then...
|
||||
if ($item && $item->is_movie() && access::can("view_full", $item)) {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-download-fullsize";
|
||||
$block->title = t("Download Movie");
|
||||
$block->content = new View("downloadfullsize_block.html");
|
||||
return $block;
|
||||
}
|
||||
|
||||
// If Item is photo then...
|
||||
if ($item && $item->is_photo() && access::can("view_full", $item)) {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-download-fullsize";
|
||||
$block->title = t("Download Photo");
|
||||
$block->content = new View("downloadfullsize_block.html");
|
||||
return $block;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
@ -23,33 +23,4 @@ class downloadfullsize_theme {
|
||||
$theme->css("downloadfullsize_menu.css");
|
||||
}
|
||||
}
|
||||
|
||||
static function sidebar_blocks($theme) {
|
||||
$item = $theme->item();
|
||||
if ($item && $item->is_movie() && access::can("view_full", $item)) {
|
||||
if (module::get_var("downloadfullsize", "tButton")) {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-download-fullsize";
|
||||
$block->title = t("Download");
|
||||
$block->content = new View("downloadfullsize_block.html");
|
||||
|
||||
$block->content->item = ORM::factory("item", 1);
|
||||
|
||||
return $block;
|
||||
}
|
||||
}
|
||||
|
||||
if ($item && $item->is_photo() && access::can("view_full", $item)) {
|
||||
if (module::get_var("downloadfullsize", "tButton")) {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-download-fullsize";
|
||||
$block->title = t("Download");
|
||||
$block->content = new View("downloadfullsize_block.html");
|
||||
|
||||
$block->content->item = ORM::factory("item", 1);
|
||||
|
||||
return $block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<? if ($theme->item->is_photo()) { ?>
|
||||
<div class="g-download-fullsize-block">
|
||||
<a href="<?= url::site("downloadfullsize/send/$theme->item") ?>"
|
||||
<a href="<?= url::site("downloadfullsize/send/{$theme->item->id}") ?>"
|
||||
title="<?= t("Download Photo") ?>"
|
||||
class="g-button ui-icon-left ui-state-default ui-corner-all"><?= t("Download Fullsize Image") ?></a>
|
||||
</div>
|
||||
@ -10,9 +10,9 @@
|
||||
|
||||
<? if ($theme->item->is_movie()) { ?>
|
||||
<div class="g-download-fullsize-block">
|
||||
<a href="<?= url::site("downloadfullsize/send/$theme->item") ?>"
|
||||
<a href="<?= url::site("downloadfullsize/send/{$theme->item->id}") ?>"
|
||||
title="<?= t("Download Video") ?>"
|
||||
class="g-button ui-icon-left ui-state-default ui-corner-all"><?= t("Download Video") ?></a>
|
||||
class="g-button ui-icon-left ui-state-default ui-corner-all"><?= t("Download Movie") ?></a>
|
||||
</div>
|
||||
<? } ?>
|
||||
|
||||
|
Reference in New Issue
Block a user