Unverified Commit 42ed27ea authored by rubofvil's avatar rubofvil Committed by GitHub
Browse files

Merge pull request #30 from ixiam/1.x-dev

Adapt to the new version CiviCRM 5 and better coding standars
parents b884b66b c092dab1
......@@ -6,16 +6,18 @@
* payment processor for their payment processors.
*/
use CRM_Redsys_ExtensionUtil as E;
require_once 'CRM/Core/Payment.php';
require_once 'includes/apiRedsys.php';
class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
CONST REDSYS_CURRENCY_EURO = 978;
CONST REDSYS_LANGUAGE_SPANISH = 1;
CONST REDSYS_LANGUAGE_BASQUE = 13;
CONST REDSYS_LANGUAGE_CATALAN = 3;
CONST REDSYS_LANGUAGE_GALICIAN = 12;
CONST REDSYS_TRANSACTION_TYPE_OPERATION_STANDARD = 0;
const REDSYS_CURRENCY_EURO = 978;
const REDSYS_LANGUAGE_SPANISH = 1;
const REDSYS_LANGUAGE_BASQUE = 13;
const REDSYS_LANGUAGE_CATALAN = 3;
const REDSYS_LANGUAGE_GALICIAN = 12;
const REDSYS_TRANSACTION_TYPE_OPERATION_STANDARD = 0;
/**
* We only need one instance of this object. So we use the singleton
......@@ -24,14 +26,14 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
* @var object
* @static
*/
static private $_singleton = null;
static private $_singleton = NULL;
/**
* mode of operation: live or test
*
* @var object
*/
protected $_mode = null;
protected $_mode = NULL;
/**
* Processor type label.
......@@ -42,7 +44,7 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
*
* @var string
*/
public $_processorName = null;
public $_processorName = NULL;
/**
* Constructor
......@@ -52,9 +54,9 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
* @return void
*/
function __construct($mode, &$paymentProcessor) {
$this->_mode = $mode;
$this->_paymentProcessor = $paymentProcessor;
$this->_processorName = 'Redsys';
$this->_mode = $mode;
$this->_paymentProcessor = $paymentProcessor;
$this->_processorName = 'Redsys';
}
/**
......@@ -68,7 +70,7 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
*/
static function &singleton($mode, &$paymentProcessor) {
$processorName = $paymentProcessor["name"];
if (self::$_singleton[$processorName] === NULL ) {
if (self::$_singleton[$processorName] === NULL) {
self::$_singleton[$processorName] = new self($mode, $paymentProcessor);
}
return self::$_singleton[$processorName];
......@@ -85,15 +87,16 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
$error = array();
if (empty($this->_paymentProcessor["user_name"])) {
$error[] = ts( "Merchant Code is not set in the Redsys Payment Processor settings." );
$error[] = E::ts("Merchant Code is not set in the Redsys Payment Processor settings.");
}
if (empty($this->_paymentProcessor["password"])) {
$error[] = ts( "Merchant Password is not set in the Redsys Payment Processor settings." );
$error[] = E::ts("Merchant Password is not set in the Redsys Payment Processor settings.");
}
if (!empty($error)) {
return implode("<p>", $error);
} else {
}
else {
return NULL;
}
}
......@@ -104,8 +107,8 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
*
* @param type $params
*/
function doDirectPayment( &$params ) {
CRM_Core_Error::fatal( ts( "This function is not implemented" ) );
function doDirectPayment(&$params) {
CRM_Core_Error::fatal(E::ts("This function is not implemented"));
}
/**
......@@ -117,13 +120,14 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
$config = CRM_Core_Config::singleton();
if ($component != 'contribute' && $component != 'event') {
CRM_Core_Error::fatal(ts('Component is invalid'));
CRM_Core_Error::fatal(E::ts('Component is invalid'));
}
if( array_key_exists( 'webform_redirect_success', $params ) ) {
if (array_key_exists('webform_redirect_success', $params)) {
$returnURL = $params['webform_redirect_success'];
$cancelURL = $params['webform_redirect_cancel'];
} else {
}
else {
$url = ($component == 'event') ? 'civicrm/event/register' : 'civicrm/contribute/transact';
$cancel = ($component == 'event') ? '_qf_Register_display' : '_qf_Main_display';
$returnURL = CRM_Utils_System::url($url,
......@@ -131,7 +135,6 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
TRUE, NULL, FALSE
);
$cancelUrlString = "$cancel=1&cancel=1&qfKey={$params['qfKey']}";
if (CRM_Utils_Array::value('is_recur', $params)) {
$cancelUrlString .= "&isRecur=1&recurId={$params['contributionRecurID']}&contribId={$params['contributionID']}";
......@@ -173,32 +176,33 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
TRUE, NULL, FALSE, TRUE
);
// Force http if set
// Force http if set.
$redsys_settings = CRM_Core_BAO_Setting::getItem("Redsys Settings", 'redsys_settings');
if($redsys_settings['ipn_http'] == '1')
if ($redsys_settings['ipn_http'] == '1')
$merchantUrl = preg_replace('/^https:/i', 'http:', $merchantUrl);
// The payment processor id can be named payment_processor (contribution pages)
if( array_key_exists( 'payment_processor', $params ) ) {
// The payment processor id can be named payment_processor (contribution pages).
if (array_key_exists('payment_processor', $params)) {
$paymentProcessorId = $params['payment_processor'];
} elseif( array_key_exists( 'payment_processor_id', $params ) ) {
}
elseif (array_key_exists('payment_processor_id', $params)) {
$paymentProcessorId = $params['payment_processor_id'];
}
// Get the terminal for this payment processor
if( array_key_exists('merchant_terminal_' . $paymentProcessorId, $redsys_settings) ) {
if( $redsys_settings['merchant_terminal_' . $paymentProcessorId] ) {
// Get the terminal for this payment processor.
if(array_key_exists('merchant_terminal_' . $paymentProcessorId, $redsys_settings)) {
if ($redsys_settings['merchant_terminal_' . $paymentProcessorId]) {
$merchantTerminal = $redsys_settings['merchant_terminal_' . $paymentProcessorId];
}
}
// Use the default terminal if the processor doesn't have an assigned one
if( ! $merchantTerminal ) {
if(!$merchantTerminal) {
$merchantTerminal = empty($redsys_settings['merchant_terminal']) ? 1 :
$redsys_settings['merchant_terminal'];
}
$miObj = new RedsysAPI;
$miObj = new RedsysAPI();
$miObj->setParameter("Ds_Merchant_Amount", $params["amount"] * 100);
$miObj->setParameter("Ds_Merchant_Order", strval(self::formatAmount($params["contributionID"], 12)));
$miObj->setParameter("Ds_Merchant_MerchantCode", $this->_paymentProcessor["user_name"]);
......@@ -209,14 +213,14 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
$miObj->setParameter("Ds_Merchant_UrlOK", $returnURL);
$miObj->setParameter("Ds_Merchant_UrlKO", $cancelURL);
$miObj->setParameter("Ds_Merchant_ProductDescription", $params["contributionType_name"]);
$miObj->setParameter("Ds_Merchant_Titular", $params["first_name"] . " " . $params["last_name"] );
$miObj->setParameter("Ds_Merchant_Titular", $params["first_name"] . " " . $params["last_name"]);
$miObj->setParameter("Ds_Merchant_ConsumerLanguage", self::REDSYS_LANGUAGE_SPANISH);
$version = "HMAC_SHA256_V1";
$signature = $miObj->createMerchantSignature($this->_paymentProcessor["password"]);
// Print the tpl to redirect and send POST variables to RedSys Getaway
// Print the tpl to redirect and send POST variables to RedSys Getaway.
$template = CRM_Core_Smarty::singleton();
$tpl = 'CRM/Core/Payment/Redsys.tpl';
......@@ -235,9 +239,9 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
$input = $ids = $objects = array();
$ipn = new CRM_Core_Payment_RedsysIPN();
// load vars in $input, &ids
// Load vars in $input, &ids.
$ipn->getInput($input, $ids);
CRM_Core_Error::debug_log_message("Redsys IPN Response: Parameteres received \n input: " . print_r($input, TRUE) . "\n ids: " . print_r($ids, TRUE) );
CRM_Core_Error::debug_log_message("Redsys IPN Response: Parameteres received \n input: " . print_r($input, TRUE) . "\n ids: " . print_r($ids, TRUE));
$paymentProcessorID = $this->_paymentProcessor['id'];
if (!$ipn->validateData($this->_paymentProcessor, $input, $ids, $objects, TRUE, $paymentProcessorID)) {
......@@ -257,4 +261,5 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
static function trimAmount($amount, $pad = '0'){
return ltrim(trim($amount), $pad);
}
}
......@@ -54,7 +54,7 @@ class CRM_Core_Payment_RedsysIPN extends CRM_Core_Payment_BaseIPN {
$contribution = &$objects['contribution'];
if (!$recur) {
if (str_replace(",", "", $contribution->total_amount) != str_replace(",", "", $input['amount']) ) {
if (str_replace(",", "", $contribution->total_amount) != str_replace(",", "", $input['amount'])) {
CRM_Core_Error::debug_log_message("Amount values dont match between database and IPN request");
echo "Failure: Amount values dont match between database and IPN request<p>";
return FALSE;
......@@ -64,14 +64,14 @@ class CRM_Core_Payment_RedsysIPN extends CRM_Core_Payment_BaseIPN {
$transaction = new CRM_Core_Transaction();
if ($input['Ds_Response'] != self::REDSYS_RESPONSE_CODE_ACCEPTED) {
$error = self::trimAmount($input['Ds_Response']);
if(array_key_exists($error, $this->_errors)) {
if (array_key_exists($error, $this->_errors)) {
$input['reasonCode'] = $this->_errors[$error];
}
CRM_Core_Error::debug_log_message("Redsys IPN Response: About to cancel contr \n input: " . print_r($input, TRUE) . "\n ids: " . print_r($ids, TRUE) . "\n objects: " . print_r($objects, TRUE) );
CRM_Core_Error::debug_log_message("Redsys IPN Response: About to cancel contr \n input: " . print_r($input, TRUE) . "\n ids: " . print_r($ids, TRUE) . "\n objects: " . print_r($objects, TRUE));
return $this->cancelled($objects, $transaction, $input);
}
// check if contribution is already completed, if so we ignore this ipn
// Check if contribution is already completed, if so we ignore this ipn.
if ($contribution->contribution_status_id == 1) {
$transaction->commit();
CRM_Core_Error::debug_log_message("returning since contribution has already been handled");
......@@ -79,28 +79,28 @@ class CRM_Core_Payment_RedsysIPN extends CRM_Core_Payment_BaseIPN {
return TRUE;
}
CRM_Core_Error::debug_log_message("Redsys IPN Response: About complete trans \n input: " . print_r($input, TRUE) . "\n ids: " . print_r($ids, TRUE) . "\n objects: " . print_r($objects, TRUE) );
CRM_Core_Error::debug_log_message("Redsys IPN Response: About complete trans \n input: " . print_r($input, TRUE) . "\n ids: " . print_r($ids, TRUE) . "\n objects: " . print_r($objects, TRUE));
return $this->completeTransaction($input, $ids, $objects, $transaction, $recur);
}
function getInput(&$input, &$ids) {
$input = array(
// GET Parameters
'module' => self::retrieve('md', 'String', 'GET', true),
'component' => self::retrieve('md', 'String', 'GET', true),
'qfKey' => self::retrieve('qfKey', 'String', 'GET', false),
'contributionID' => self::retrieve('contributionID', 'String', 'GET', true),
'contactID' => self::retrieve('contactID', 'String', 'GET', true),
'eventID' => self::retrieve('eventID', 'String', 'GET', false),
'participantID' => self::retrieve('participantID', 'String', 'GET', false),
'membershipID' => self::retrieve('membershipID', 'String', 'GET', false),
'contributionPageID' => self::retrieve('contributionPageID', 'String', 'GET', false),
'relatedContactID' => self::retrieve('relatedContactID', 'String', 'GET', false),
'onBehalfDupeAlert' => self::retrieve('onBehalfDupeAlert', 'String', 'GET', false),
// POST Parameters
'Ds_SignatureVersion' => self::retrieve('Ds_SignatureVersion', 'String', 'POST', true),
'Ds_MerchantParameters' => self::retrieve('Ds_MerchantParameters', 'String', 'POST', true),
'Ds_Signature' => self::retrieve('Ds_Signature', 'String', 'POST', true),
// GET Parameters.
'module' => self::retrieve('md', 'String', 'GET', TRUE),
'component' => self::retrieve('md', 'String', 'GET', TRUE),
'qfKey' => self::retrieve('qfKey', 'String', 'GET', FALSE),
'contributionID' => self::retrieve('contributionID', 'String', 'GET', TRUE),
'contactID' => self::retrieve('contactID', 'String', 'GET', TRUE),
'eventID' => self::retrieve('eventID', 'String', 'GET', FALSE),
'participantID' => self::retrieve('participantID', 'String', 'GET', FALSE),
'membershipID' => self::retrieve('membershipID', 'String', 'GET', FALSE),
'contributionPageID' => self::retrieve('contributionPageID', 'String', 'GET', FALSE),
'relatedContactID' => self::retrieve('relatedContactID', 'String', 'GET', FALSE),
'onBehalfDupeAlert' => self::retrieve('onBehalfDupeAlert', 'String', 'GET', FALSE),
// POST Parameters.
'Ds_SignatureVersion' => self::retrieve('Ds_SignatureVersion', 'String', 'POST', TRUE),
'Ds_MerchantParameters' => self::retrieve('Ds_MerchantParameters', 'String', 'POST', TRUE),
'Ds_Signature' => self::retrieve('Ds_Signature', 'String', 'POST', TRUE),
);
$decodecResponseJson = $this->_redsysAPI->decodeMerchantParameters($input["Ds_MerchantParameters"]);
$decodecResponse = json_decode($decodecResponseJson);
......@@ -129,23 +129,23 @@ class CRM_Core_Payment_RedsysIPN extends CRM_Core_Payment_BaseIPN {
function validateData($paymentProcessor, &$input, &$ids, &$objects, $required = TRUE, $paymentProcessorID = NULL) {
$signatureNotif = $this->_redsysAPI->createMerchantSignatureNotif($paymentProcessor["password"], $input["Ds_MerchantParameters"]);
if($input['Ds_MerchantCode'] != $paymentProcessor["user_name"]){
if ($input['Ds_MerchantCode'] != $paymentProcessor["user_name"]) {
CRM_Core_Error::debug_log_message("Redsys Response param Ds_MerchantCode incorrect");
return false;
return FALSE;
}
if ($signatureNotif !== $input['Ds_Signature']){
if ($signatureNotif !== $input['Ds_Signature']) {
CRM_Core_Error::debug_log_message("Redsys signature doesn't match");
return false;
return FALSE;
}
return parent::validateData($input, $ids, $objects, $required, $paymentProcessorID);
}
static function retrieve($name, $type, $location = 'POST', $abort = true) {
static $store = null;
$value = CRM_Utils_Request::retrieve($name, $type, $store, false, null, $location);
if ($abort && $value === null) {
static function retrieve($name, $type, $location = 'POST', $abort = TRUE) {
static $store = NULL;
$value = CRM_Utils_Request::retrieve($name, $type, $store, FALSE, NULL, $location);
if ($abort && $value === NULL) {
CRM_Core_Error::debug_log_message("Could not find an entry for $name in $location");
echo "Failure: Missing Parameter<p>";
exit();
......@@ -153,7 +153,7 @@ class CRM_Core_Payment_RedsysIPN extends CRM_Core_Payment_BaseIPN {
return $value;
}
static function trimAmount($amount, $pad = '0'){
static function trimAmount($amount, $pad = '0') {
return ltrim(trim($amount), $pad);
}
......
<?php
require_once 'CRM/Core/Form.php';
use CRM_Redsys_ExtensionUtil as E;
class CRM_Redsys_Form_Settings extends CRM_Core_Form {
public function buildQuickForm() {
......@@ -8,17 +9,17 @@ class CRM_Redsys_Form_Settings extends CRM_Core_Form {
$this->add('text', 'merchant_terminal', 'Merchant Terminal', array('size' => 5));
$paymentProcessors = $this->getPaymentProcessors();
foreach( $paymentProcessors as $paymentProcessor ) {
$settingCode = 'merchant_terminal_' . $paymentProcessor[ "id" ];
$settingTitle = $paymentProcessor[ "name" ] . " (" .
( $paymentProcessor["is_test"] == 0 ? "Live" : "Test" ) . ")";
foreach ($paymentProcessors as $paymentProcessor) {
$settingCode = 'merchant_terminal_' . $paymentProcessor["id"];
$settingTitle = $paymentProcessor["name"] . " (" .
($paymentProcessor["is_test"] == 0 ? "Live" : "Test") . ")";
$this->add('text', $settingCode, $settingTitle, array('size' => 5));
}
$this->addButtons(array(
array(
'type' => 'submit',
'name' => ts('Submit'),
'name' => E::ts('Submit'),
'isDefault' => TRUE,
),
));
......@@ -38,30 +39,32 @@ class CRM_Redsys_Form_Settings extends CRM_Core_Form {
$values = $this->exportValues();
$redsys_settings['ipn_http'] = $values['ipn_http'];
$redsys_settings['merchant_terminal'] = $values['merchant_terminal'];
$paymentProcessors = $this->getPaymentProcessors();
foreach( $paymentProcessors as $paymentProcessor ) {
$settingId = 'merchant_terminal_' . $paymentProcessor[ "id" ];
foreach ($paymentProcessors as $paymentProcessor) {
$settingId = 'merchant_terminal_' . $paymentProcessor["id"];
$redsys_settings[$settingId] = $values[$settingId];
}
CRM_Core_BAO_Setting::setItem($redsys_settings, "Redsys Settings", 'redsys_settings');
CRM_Core_Session::setStatus(ts('Redsys Settings Saved', array( 'domain' => 'com.ixiam.payment.redsys')), 'Configuration Updated', 'success');
CRM_Core_Session::setStatus(E::ts('Redsys Settings Saved', array('domain' => 'com.ixiam.payment.redsys')), 'Configuration Updated', 'success');
parent::postProcess();
}
public function getPaymentProcessors() {
// Get the Redsys payment processor type
$redsysName = array( 'name' => 'Redsys' );
$paymentProcessorType = civicrm_api3( 'PaymentProcessorType', 'getsingle', $redsysName );
// Get the Redsys payment processor type.
$redsysName = array('name' => 'Redsys');
$paymentProcessorType = civicrm_api3('PaymentProcessorType', 'getsingle', $redsysName);
// Get the payment processors of Redsys type
// Get the payment processors of Redsys type.
$redsysType = array(
'payment_processor_type_id' => $paymentProcessorType[ 'id' ],
'is_active' => 1 );
$paymentProcessors = civicrm_api3( 'PaymentProcessor', 'get', $redsysType );
'payment_processor_type_id' => $paymentProcessorType['id'],
'is_active' => 1,
);
$paymentProcessors = civicrm_api3('PaymentProcessor', 'get', $redsysType);
return $paymentProcessors["values"];
}
}
<?php
use CRM_Redsys_ExtensionUtil as E;
/**
* Collection of upgrade steps.
*/
......@@ -18,21 +20,21 @@ class CRM_Redsys_Upgrader extends CRM_Redsys_Upgrader_Base {
private static function buildMenu(){
$query = "SELECT id FROM `civicrm_navigation` WHERE name = 'CiviContribute'";
$dao = CRM_Core_DAO::executeQuery($query);
if($dao->fetch()){
if ($dao->fetch()) {
$menu_params = array(
'label' => ts('Redsys Settings', array( 'domain' => 'com.ixiam.payment.redsys')),
'label' => E::ts('Redsys Settings', array('domain' => 'com.ixiam.payment.redsys')),
'url' => 'civicrm/redsys/settings',
'permission' => array('administer OfflinePay'),
'permission_operator' => 'AND',
'has_separator' => '1',
'is_active' => '1',
'parent_id' => $dao->id
'parent_id' => $dao->id,
);
$parent = CRM_Core_BAO_Navigation::add($menu_params);
// also reset navigation
CRM_Core_Menu::store( );
CRM_Core_BAO_Navigation::resetNavigation( );
// Also reset navigation.
CRM_Core_Menu::store();
CRM_Core_BAO_Navigation::resetNavigation();
}
$dao->free();
}
......
<?php
// AUTO-GENERATED FILE -- Civix may overwrite any changes made to this file
use CRM_Redsys_ExtensionUtil as E;
/**
* Base class which provides helpers to execute upgrade logic
......@@ -175,7 +176,7 @@ class CRM_Redsys_Upgrader_Base {
$currentRevision = $this->getCurrentRevision();
foreach ($this->getRevisions() as $revision) {
if ($revision > $currentRevision) {
$title = ts('Upgrade %1 to revision %2', array(
$title = E::ts('Upgrade %1 to revision %2', array(
1 => $this->extensionName,
2 => $revision,
));
......
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Package: com.ixiam.payment.redsys
Copyright (C) 2018, Ruben <r.pineda@ixiam.com>
Licensed under the GNU Affero Public License 3.0 (below).
-------------------------------------------------------------------------------
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
......@@ -7,17 +13,15 @@
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
......@@ -26,44 +30,34 @@ them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
......@@ -72,7 +66,7 @@ modification follow.
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
......@@ -549,35 +543,45 @@ to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you