first commit
This commit is contained in:
72
plugins/convertforms/acymailing/acymailing.php
Normal file
72
plugins/convertforms/acymailing/acymailing.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Convert Forms
|
||||
* @version 3.2.12 Free
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
class plgConvertFormsAcyMailing extends \ConvertForms\Plugin
|
||||
{
|
||||
/**
|
||||
* Main method to store data to service
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function subscribe()
|
||||
{
|
||||
// Make sure there's a list selected
|
||||
if (!isset($this->lead->campaign->list) || empty($this->lead->campaign->list))
|
||||
{
|
||||
throw new Exception(JText::_('PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED'));
|
||||
}
|
||||
|
||||
$lists = $this->lead->campaign->list;
|
||||
$lists_v5 = [];
|
||||
$lists_v6 = [];
|
||||
|
||||
// Discover lists for each version. v6 lists starts with 6: prefix.
|
||||
foreach ($lists as $list)
|
||||
{
|
||||
// Is a v5 list
|
||||
if (strpos($list, '6:') === false)
|
||||
{
|
||||
$lists_v5[] = $list;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Is a v6 list
|
||||
$lists_v6[] = str_replace('6:', '', $list);
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
// Add user to AcyMailing 5 lists
|
||||
if (!empty($lists_v5))
|
||||
{
|
||||
ConvertFormsAcyMailingHelper::subscribe_v5($this->lead->email, $this->lead->params, $lists_v5, $this->lead->campaign->doubleoptin);
|
||||
}
|
||||
|
||||
// Add user to AcyMailing 6+ lists
|
||||
if (!empty($lists_v6))
|
||||
{
|
||||
ConvertFormsAcyMailingHelper::subscribe($this->lead->email, $this->lead->params, $lists_v6, $this->lead->campaign->doubleoptin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable service wrapper
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function loadWrapper()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
20
plugins/convertforms/acymailing/acymailing.xml
Normal file
20
plugins/convertforms/acymailing/acymailing.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension version="3.4.0" type="plugin" group="convertforms" method="upgrade">
|
||||
<name>PLG_CONVERTFORMS_ACYMAILING</name>
|
||||
<description>PLG_CONVERTFORMS_ACYMAILING_DESC</description>
|
||||
<version>1.0</version>
|
||||
<author>Tassos Marinos</author>
|
||||
<authorEmail>info@tassos.gr</authorEmail>
|
||||
<authorUrl>http://www.tassos.gr</authorUrl>
|
||||
<copyright>Copyright (c) 2020 Tassos Marinos</copyright>
|
||||
<license>GNU General Public License version 3, or later</license>
|
||||
<creationDate>November 2015</creationDate>
|
||||
<scriptfile>script.install.php</scriptfile>
|
||||
<files>
|
||||
<folder>language</folder>
|
||||
<filename plugin="acymailing">acymailing.php</filename>
|
||||
<filename>form.xml</filename>
|
||||
<filename>script.install.helper.php</filename>
|
||||
<filename>helper.php</filename>
|
||||
</files>
|
||||
</extension>
|
||||
19
plugins/convertforms/acymailing/form.xml
Normal file
19
plugins/convertforms/acymailing/form.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fieldset name="service">
|
||||
<field name="list" type="acymailing"
|
||||
label="PLG_CONVERTFORMS_ACYMAILING_LIST_ID"
|
||||
description="PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC"
|
||||
required="true"
|
||||
multiple="true"
|
||||
/>
|
||||
<field name="doubleoptin" type="radio"
|
||||
label="PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN"
|
||||
description="PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="0">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</form>
|
||||
173
plugins/convertforms/acymailing/helper.php
Normal file
173
plugins/convertforms/acymailing/helper.php
Normal file
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Convert Forms
|
||||
* @version 3.2.12 Free
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
class ConvertFormsAcyMailingHelper
|
||||
{
|
||||
/**
|
||||
* @deprecated Use subscribe()
|
||||
*/
|
||||
public static function subscribe_v6($email, $params, $lists, $doubleOptin = true)
|
||||
{
|
||||
self::subscribe($email, $params, $lists, $doubleOptin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribe method for AcyMailing v6
|
||||
*
|
||||
* @param array $lists
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function subscribe($email, $params, $lists, $doubleOptin = true)
|
||||
{
|
||||
if (!@include_once(JPATH_ADMINISTRATOR . '/components/com_acym/helpers/helper.php'))
|
||||
{
|
||||
throw new Exception(JText::sprintf('PLG_CONVERTFORMS_ACYMAILING_HELPER_CLASS_ERROR', 6));
|
||||
}
|
||||
|
||||
// Create user object
|
||||
$user = new stdClass();
|
||||
$user->email = $email;
|
||||
$user->confirmed = $doubleOptin ? 0 : 1;
|
||||
|
||||
$user_fields = array_change_key_case($params);
|
||||
|
||||
$user->name = isset($user_fields['name']) ? $user_fields['name'] : '';
|
||||
|
||||
// Load User Class
|
||||
$acym = acym_get('class.user');
|
||||
|
||||
// Check if exists
|
||||
$existing_user = $acym->getOneByEmail($email);
|
||||
|
||||
if ($existing_user)
|
||||
{
|
||||
$user->id = $existing_user->id;
|
||||
} else
|
||||
{
|
||||
// Save user to database only if it's a new user.
|
||||
if (!$user->id = $acym->save($user))
|
||||
{
|
||||
throw new Exception(JText::_('PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER'));
|
||||
}
|
||||
}
|
||||
|
||||
// Save Custom Fields
|
||||
$fieldClass = acym_get('class.field');
|
||||
|
||||
// getAllfields was removed in 7.7.4 and we must use getAll moving forward.
|
||||
$acy_fields_method = method_exists($fieldClass, 'getAllfields') ? 'getAllfields' : 'getAll';
|
||||
$acy_fields = $fieldClass->$acy_fields_method();
|
||||
|
||||
unset($user_fields['name']); // Name is already used during user creation.
|
||||
|
||||
$fields_to_store = [];
|
||||
|
||||
foreach ($user_fields as $paramKey => $paramValue)
|
||||
{
|
||||
// Check if paramKey it's a custom field
|
||||
$field_found = array_filter($acy_fields, function($field) use($paramKey) {
|
||||
return (strtolower($field->name) == $paramKey || $field->id == $paramKey);
|
||||
});
|
||||
|
||||
if ($field_found)
|
||||
{
|
||||
// Get the 1st occurence
|
||||
$field = array_shift($field_found);
|
||||
|
||||
// AcyMailing 6 needs field's ID to recognize a field.
|
||||
$fields_to_store[$field->id] = $paramValue;
|
||||
|
||||
// $paramValue output: array(1) { [0]=> string(2) "gr" }
|
||||
// AcyMailing will get the key as the value instead of "gr"
|
||||
// We combine to remove the keys in order to keep the values
|
||||
if (is_array($paramValue))
|
||||
{
|
||||
$fields_to_store[$field->id] = array_combine($fields_to_store[$field->id], $fields_to_store[$field->id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($fields_to_store)
|
||||
{
|
||||
$fieldClass->store($user->id, $fields_to_store);
|
||||
}
|
||||
|
||||
// Subscribe user to AcyMailing lists
|
||||
return $acym->subscribe($user->id, $lists);
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribe method for AcyMailing v5
|
||||
*
|
||||
* @param array $lists
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function subscribe_v5($email, $params, $lists, $doubleOptin = true)
|
||||
{
|
||||
if (!@include_once(JPATH_ADMINISTRATOR . '/components/com_acymailing/helpers/helper.php'))
|
||||
{
|
||||
throw new Exception(JText::sprintf('PLG_CONVERTFORMS_ACYMAILING_HELPER_CLASS_ERROR', 5));
|
||||
}
|
||||
|
||||
// Create user object
|
||||
$user = new stdClass();
|
||||
$user->email = $email;
|
||||
$user->confirmed = $doubleOptin ? false : true;
|
||||
|
||||
// Get Custrom Fields
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
$customFields = $db->setQuery(
|
||||
$db->getQuery(true)
|
||||
->select($db->quoteName('namekey'))
|
||||
->from($db->quoteName('#__acymailing_fields'))
|
||||
)->loadColumn();
|
||||
|
||||
if (is_array($customFields) && count($customFields))
|
||||
{
|
||||
foreach ($params as $key => $param)
|
||||
{
|
||||
if (in_array($key, $customFields))
|
||||
{
|
||||
$user->$key = $param;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$acymailing = acymailing_get('class.subscriber');
|
||||
$userid = $acymailing->subid($email);
|
||||
|
||||
// AcyMailing sends account confirmation e-mails even if the user exists, so we need
|
||||
// to run save() method only if the user actually is new.
|
||||
if (is_null($userid))
|
||||
{
|
||||
// Save user to database
|
||||
if (!$userid = $acymailing->save($user))
|
||||
{
|
||||
throw new Exception(JText::_('PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER'));
|
||||
}
|
||||
}
|
||||
|
||||
// Subscribe user to AcyMailing lists
|
||||
$lead = [];
|
||||
foreach($lists as $listId)
|
||||
{
|
||||
$lead[$listId] = ['status' => 1];
|
||||
}
|
||||
|
||||
return $acymailing->saveSubscription($userid, $lead);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convert Forms – AcyMailing Integration"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convert Forms – интеграция с Acymailing Joomla! разширение."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="Списък ID"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Изберете списъците, за които потребителят трябва да се абонира."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="В две стъпки"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Трябва ли потребителят да щракне линка в имейла за потвърждение, преди да бъде считан за абонат?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Потребителят не може да бъде създаден."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Моля, изберете списък в настройките на кампанията"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Integració Convert Forms - AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Integració entre Convert Forms i l'extensió de Joomla! AcyMailing."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="ID de llista"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Escull les llistes a les que s'hauria de subscriure l'usuari"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Doble confirmació d'entrada"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="L'usuari hauria de clicar a un correu de confirmació abans de ser considerat subscriptor?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="No es pot crear l'usuari."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Escull una llista a la configuració de la campanya"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convert Forms - integrace AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convert Forms - Integrace s rozšířením Acymailing pro Joomla!"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="Seznam ID"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Vyberte seznamy k jejiž odběru se uživatel přihlašuje."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Dvojité potvrzení souhlasu"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Měl by uživatel potvrdit kliknutím na odkaz v potvrzovacím e-mailu souhlas s odběrem?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Nevytvářet uživatele."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Prosím zvolte seznam v nastavení kampaní"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convert Forms - AcyMailing Integration"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convert Forms - Integration mit der Acymailing Joomla! Erweiterung."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="Listen ID"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Wählen Sie die Listen aus, zu denen der Benutzer hinzugefügt werden soll."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Doppeltes Opt-in"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Sollte der Nutzer auf einen Bestätigungs-Link in einer E-Mail klicken müssen, bevor er als Abonnent betrachtet wird?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Der Benutzer kann nicht erstellt werden."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Bitte eine Liste in den Kampagnen-Einstellungen auswählen"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convert Forms - Ενσωμάτωση AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convert Forms - Ενσωμάτωση με ένθεμα Acymailing Joomla!"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="Αναγνωριστικό λίστας"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Επιλέξτε τις λίστες στις οποίες πρέπει να εγγραφεί ο χρήστης."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Double Optin"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Πρέπει ο χρήστης να κάνει κλικ σε μήνυμα επιβεβαίωσης πριν θεωρηθεί συνδρομητής;"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Αδυναμία δημιουργίας χρήστη."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Επιλέξτε μια λίστα στις ρυθμίσεις καμπάνιας"
|
||||
@@ -0,0 +1,17 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convert Forms - AcyMailing Integration"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convert Forms - Integration with Acymailing Joomla! Extension."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="List ID"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Select the lists which the user should be subscribed to."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Double Optin"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Should the user have to click on a confirmation email before being considered as a subscriber?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Can't create user."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Please select a list in the campaign settings"
|
||||
PLG_CONVERTFORMS_ACYMAILING_HELPER_CLASS_ERROR="AcyMailing %d helper class not found. Make sure AcyMailing is installed and you've selected the correct AcyMailing list in the campaign settings."
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convert Forms - AcyMailing Integration"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convert Forms - Integration with Acymailing Joomla! Extension."
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="Acymailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="\"Formas de conversión\" - Integración con AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="\"Formularios de conversión\" - Integrar con extensión de Joomla! Acymailing."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="Lista ID"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Selecciona las listas a la que el usuario debe estar suscrito."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Optin doble"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="¿Debe el usuario hacer click en un email de confirmación antes de ser considerado subscriptor?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="No se puede crear el usuario"
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Por favor, seleccione una lista en la configuración de campaña"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convert Forms - AcyMailing integreerimine"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convert Forms - Integreerimine Acymailing Joomla! lisaga."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="Rühma ID"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Määra rühmad millega kasutaja liidetakse."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Kahekordne kinnitus"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Kas kasutaja peab klikkima kinnitusmeilis olemave lingile enne kui temast saab uudiskirja tellija?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Ei suuda luua kasutajat."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Määra rühm kampaania seadetes"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convert Forms - AcyMailing liitäntä"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convert Forms -integrointi Acymailing Joomla! laajennukseen."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="Luettelo ID"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Valitse luettelo ID, jonka käyttäjän tulee tilata"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Tupla varmistus"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Pitääkö käyttäjän avata vahvistusviesti ennen kuin hänet hyväksytään tilaajana?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Käyttäjää ei voi luoda."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Valitse luettelosta kampanja-asetuksissa"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convertisseur de formulaires - Intégration de AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convertisseur de formulaires - Intégration avec l'extension Joomla! AcyMailing."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="ID de la liste"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Sélectionnez les listes auxquelles l'utilisateur doit s'abonner."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Vérification par mail"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="L'utilisateur doit-il cliquer sur un mail de confirmation avant d'être considéré comme abonné ?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Impossible de créer un utilisateur"
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Merci de choisir une liste dans les réglages de la campagne"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Integrazione Convert Forms - AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Integrazione Convert Forms con l'estensione di Joomla! Acymailing."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="ID elenco"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Seleziona le liste a cui l'utente dovrebbe essere iscritto."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Doppio Opt-in"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="L'utente dovrebbe fare clic su una mail di conferma prima di essere considerato un iscritto?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Non posso creare l'utente."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Seleziona una lista nelle impostazioni di campagna"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Преобразовать формы - интеграция AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Преобразование форм - интеграция с расширением Joomla! Acymailing."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="Список идентификаторов"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Выберите списки, для которых пользователь должен быть зарегистрирован в качестве подписки."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Двойная проверка"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Нужно ли пользователю нажимать подтверждение по электронной почте перед регистрацией в качестве подписки?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Пользователь не может быть создан."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Пожалуйста, выберите список в настройках кампании."
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Konvertovať formuláre – integrácia AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Konvertovať formuláre – integrácia s Acymailing Joomla! Rozšírenie."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="ID zoznamu"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Vyberte zoznamy, na odber ktorých má byť používateľ prihlásený."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Double Optin"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Mal by používateľ kliknúť na potvrdzovací e-mail predtým, ako bude považovaný za odberateľa?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Nie je možné vytvoriť používateľa."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Vyberte zoznam v nastaveniach kampane"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="Acymailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convert Forms - AcyMailing Integration"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convert Forms - Integration med Acymailing Joomla! Komponent."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="List ID"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Välj listan användaren skall bli prenumerant till."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Dubbel Optin"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Skall användaren behöva klicka på ett konfirmation email innan han anses bli en prenumerant?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Kan inte skapa användare."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Vänligen välj en lista i kampanj inställningen"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Перетворити форми - інтеграція AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Перетворити форми - інтеграція з розширенням Acymailing Joomla!"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="Список ідентифікаторів"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Виберіть списки, для яких користувач повинен бути зареєстрований як підписка."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Подвійна перевірка"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Чи повинен користувач натиснути електронний лист для підтвердження, перш ніж зареєструватися як підписка?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Користувача не можна створити."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Виберіть список у налаштуваннях кампанії."
|
||||
637
plugins/convertforms/acymailing/script.install.helper.php
Normal file
637
plugins/convertforms/acymailing/script.install.helper.php
Normal file
@@ -0,0 +1,637 @@
|
||||
<?php
|
||||
/**
|
||||
* Installer Script Helper
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2016 Tassos Marinos All Rights Reserved
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.filesystem.file');
|
||||
jimport('joomla.filesystem.folder');
|
||||
|
||||
class PlgConvertformsAcymailingInstallerScriptHelper
|
||||
{
|
||||
public $name = '';
|
||||
public $alias = '';
|
||||
public $extname = '';
|
||||
public $extension_type = '';
|
||||
public $plugin_folder = 'system';
|
||||
public $module_position = 'status';
|
||||
public $client_id = 1;
|
||||
public $install_type = 'install';
|
||||
public $show_message = true;
|
||||
public $autopublish = true;
|
||||
public $db = null;
|
||||
public $app = null;
|
||||
public $installedVersion;
|
||||
|
||||
public function __construct(&$params)
|
||||
{
|
||||
$this->extname = $this->extname ?: $this->alias;
|
||||
$this->db = JFactory::getDbo();
|
||||
$this->app = JFactory::getApplication();
|
||||
$this->installedVersion = $this->getVersion($this->getInstalledXMLFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* Preflight event
|
||||
*
|
||||
* @param string
|
||||
* @param JAdapterInstance
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function preflight($route, $adapter)
|
||||
{
|
||||
if (!in_array($route, array('install', 'update')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
JFactory::getLanguage()->load('plg_system_novaraininstaller', JPATH_PLUGINS . '/system/novaraininstaller');
|
||||
|
||||
if ($this->show_message && $this->isInstalled())
|
||||
{
|
||||
$this->install_type = 'update';
|
||||
}
|
||||
|
||||
if ($this->onBeforeInstall() === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Preflight event
|
||||
*
|
||||
* @param string
|
||||
* @param JAdapterInstance
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function postflight($route, $adapter)
|
||||
{
|
||||
JFactory::getLanguage()->load($this->getPrefix() . '_' . $this->extname, $this->getMainFolder());
|
||||
|
||||
if (!in_array($route, array('install', 'update')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->onAfterInstall() === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($route == 'install' && $this->autopublish)
|
||||
{
|
||||
$this->publishExtension();
|
||||
}
|
||||
|
||||
if ($this->show_message)
|
||||
{
|
||||
$this->addInstalledMessage();
|
||||
}
|
||||
|
||||
JFactory::getCache()->clean('com_plugins');
|
||||
JFactory::getCache()->clean('_system');
|
||||
}
|
||||
|
||||
public function isInstalled()
|
||||
{
|
||||
if (!is_file($this->getInstalledXMLFile()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = $this->db->getQuery(true)
|
||||
->select('extension_id')
|
||||
->from('#__extensions')
|
||||
->where($this->db->quoteName('type') . ' = ' . $this->db->quote($this->extension_type))
|
||||
->where($this->db->quoteName('element') . ' = ' . $this->db->quote($this->getElementName()));
|
||||
$this->db->setQuery($query, 0, 1);
|
||||
$result = $this->db->loadResult();
|
||||
|
||||
return empty($result) ? false : true;
|
||||
}
|
||||
|
||||
public function getMainFolder()
|
||||
{
|
||||
switch ($this->extension_type)
|
||||
{
|
||||
case 'plugin' :
|
||||
return JPATH_SITE . '/plugins/' . $this->plugin_folder . '/' . $this->extname;
|
||||
|
||||
case 'component' :
|
||||
return JPATH_ADMINISTRATOR . '/components/com_' . $this->extname;
|
||||
|
||||
case 'module' :
|
||||
return JPATH_ADMINISTRATOR . '/modules/mod_' . $this->extname;
|
||||
|
||||
case 'library' :
|
||||
return JPATH_SITE . '/libraries/' . $this->extname;
|
||||
}
|
||||
}
|
||||
|
||||
public function getInstalledXMLFile()
|
||||
{
|
||||
return $this->getXMLFile($this->getMainFolder());
|
||||
}
|
||||
|
||||
public function getCurrentXMLFile()
|
||||
{
|
||||
return $this->getXMLFile(__DIR__);
|
||||
}
|
||||
|
||||
public function getXMLFile($folder)
|
||||
{
|
||||
switch ($this->extension_type)
|
||||
{
|
||||
case 'module' :
|
||||
return $folder . '/mod_' . $this->extname . '.xml';
|
||||
default :
|
||||
return $folder . '/' . $this->extname . '.xml';
|
||||
}
|
||||
}
|
||||
|
||||
public function foldersExist($folders = array())
|
||||
{
|
||||
foreach ($folders as $folder)
|
||||
{
|
||||
if (is_dir($folder))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function publishExtension()
|
||||
{
|
||||
switch ($this->extension_type)
|
||||
{
|
||||
case 'plugin' :
|
||||
$this->publishPlugin();
|
||||
|
||||
case 'module' :
|
||||
$this->publishModule();
|
||||
}
|
||||
}
|
||||
|
||||
public function publishPlugin()
|
||||
{
|
||||
$query = $this->db->getQuery(true)
|
||||
->update('#__extensions')
|
||||
->set($this->db->quoteName('enabled') . ' = 1')
|
||||
->where($this->db->quoteName('type') . ' = ' . $this->db->quote('plugin'))
|
||||
->where($this->db->quoteName('element') . ' = ' . $this->db->quote($this->extname))
|
||||
->where($this->db->quoteName('folder') . ' = ' . $this->db->quote($this->plugin_folder));
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
}
|
||||
|
||||
public function publishModule()
|
||||
{
|
||||
// Get module id
|
||||
$query = $this->db->getQuery(true)
|
||||
->select('id')
|
||||
->from('#__modules')
|
||||
->where($this->db->quoteName('module') . ' = ' . $this->db->quote('mod_' . $this->extname))
|
||||
->where($this->db->quoteName('client_id') . ' = ' . (int) $this->client_id);
|
||||
$this->db->setQuery($query, 0, 1);
|
||||
$id = $this->db->loadResult();
|
||||
|
||||
if (!$id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// check if module is already in the modules_menu table (meaning is is already saved)
|
||||
$query->clear()
|
||||
->select('moduleid')
|
||||
->from('#__modules_menu')
|
||||
->where($this->db->quoteName('moduleid') . ' = ' . (int) $id);
|
||||
$this->db->setQuery($query, 0, 1);
|
||||
$exists = $this->db->loadResult();
|
||||
|
||||
if ($exists)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get highest ordering number in position
|
||||
$query->clear()
|
||||
->select('ordering')
|
||||
->from('#__modules')
|
||||
->where($this->db->quoteName('position') . ' = ' . $this->db->quote($this->module_position))
|
||||
->where($this->db->quoteName('client_id') . ' = ' . (int) $this->client_id)
|
||||
->order('ordering DESC');
|
||||
$this->db->setQuery($query, 0, 1);
|
||||
$ordering = $this->db->loadResult();
|
||||
$ordering++;
|
||||
|
||||
// publish module and set ordering number
|
||||
$query->clear()
|
||||
->update('#__modules')
|
||||
->set($this->db->quoteName('published') . ' = 1')
|
||||
->set($this->db->quoteName('ordering') . ' = ' . (int) $ordering)
|
||||
->set($this->db->quoteName('position') . ' = ' . $this->db->quote($this->module_position))
|
||||
->where($this->db->quoteName('id') . ' = ' . (int) $id);
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
|
||||
// add module to the modules_menu table
|
||||
$query->clear()
|
||||
->insert('#__modules_menu')
|
||||
->columns(array($this->db->quoteName('moduleid'), $this->db->quoteName('menuid')))
|
||||
->values((int) $id . ', 0');
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
}
|
||||
|
||||
public function addInstalledMessage()
|
||||
{
|
||||
JFactory::getApplication()->enqueueMessage(
|
||||
JText::sprintf(
|
||||
JText::_($this->install_type == 'update' ? 'NRI_THE_EXTENSION_HAS_BEEN_UPDATED_SUCCESSFULLY' : 'NRI_THE_EXTENSION_HAS_BEEN_INSTALLED_SUCCESSFULLY'),
|
||||
'<strong>' . JText::_($this->name) . '</strong>',
|
||||
'<strong>' . $this->getVersion() . '</strong>',
|
||||
$this->getFullType()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getPrefix()
|
||||
{
|
||||
switch ($this->extension_type)
|
||||
{
|
||||
case 'plugin';
|
||||
return JText::_('plg_' . strtolower($this->plugin_folder));
|
||||
|
||||
case 'component':
|
||||
return JText::_('com');
|
||||
|
||||
case 'module':
|
||||
return JText::_('mod');
|
||||
|
||||
case 'library':
|
||||
return JText::_('lib');
|
||||
|
||||
default:
|
||||
return $this->extension_type;
|
||||
}
|
||||
}
|
||||
|
||||
public function getElementName($type = null, $extname = null)
|
||||
{
|
||||
$type = is_null($type) ? $this->extension_type : $type;
|
||||
$extname = is_null($extname) ? $this->extname : $extname;
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case 'component' :
|
||||
return 'com_' . $extname;
|
||||
|
||||
case 'module' :
|
||||
return 'mod_' . $extname;
|
||||
|
||||
case 'plugin' :
|
||||
default:
|
||||
return $extname;
|
||||
}
|
||||
}
|
||||
|
||||
public function getFullType()
|
||||
{
|
||||
return JText::_('NRI_' . strtoupper($this->getPrefix()));
|
||||
}
|
||||
|
||||
public function isPro()
|
||||
{
|
||||
$versionFile = __DIR__ . "/version.php";
|
||||
|
||||
// If version file does not exist we assume a PRO version
|
||||
if (!JFile::exists($versionFile))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Load version file
|
||||
require_once $versionFile;
|
||||
return (bool) $NR_PRO;
|
||||
}
|
||||
|
||||
public function getVersion($file = '')
|
||||
{
|
||||
$file = $file ?: $this->getCurrentXMLFile();
|
||||
|
||||
if (!is_file($file))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
$xml = JInstaller::parseXMLInstallFile($file);
|
||||
|
||||
if (!$xml || !isset($xml['version']))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
return $xml['version'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks wether the extension can be installed or not
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function canInstall()
|
||||
{
|
||||
|
||||
// The extension is not installed yet. Accept Install.
|
||||
if (!$installed_version = $this->getVersion($this->getInstalledXMLFile()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Path to extension's version file
|
||||
$versionFile = $this->getMainFolder() . "/version.php";
|
||||
$NR_PRO = true;
|
||||
|
||||
// If version file does not exist we assume we have a PRO version installed
|
||||
if (file_exists($versionFile))
|
||||
{
|
||||
require_once($versionFile);
|
||||
}
|
||||
|
||||
// The free version is installed. Accept install.
|
||||
if (!(bool)$NR_PRO)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Current package is a PRO version. Accept install.
|
||||
if ($this->isPro())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// User is trying to update from PRO version to FREE. Do not accept install.
|
||||
JFactory::getLanguage()->load($this->getPrefix() . '_' . $this->extname, __DIR__);
|
||||
|
||||
JFactory::getApplication()->enqueueMessage(
|
||||
JText::_('NRI_ERROR_PRO_TO_FREE'), 'error'
|
||||
);
|
||||
|
||||
JFactory::getApplication()->enqueueMessage(
|
||||
html_entity_decode(
|
||||
JText::sprintf(
|
||||
'NRI_ERROR_UNINSTALL_FIRST',
|
||||
'<a href="http://www.tassos.gr/joomla-extensions/' . $this->alias . '" target="_blank">',
|
||||
'</a>',
|
||||
JText::_($this->name)
|
||||
)
|
||||
), 'error'
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if current version is newer than the installed one
|
||||
* Used for Novarain Framework
|
||||
*
|
||||
* @return boolean [description]
|
||||
*/
|
||||
public function isNewer()
|
||||
{
|
||||
if (!$installed_version = $this->getVersion($this->getInstalledXMLFile()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$package_version = $this->getVersion();
|
||||
|
||||
return version_compare($installed_version, $package_version, '<=');
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method triggered before installation
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function onBeforeInstall()
|
||||
{
|
||||
if (!$this->canInstall())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method triggered after installation
|
||||
*/
|
||||
public function onAfterInstall()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete files
|
||||
*
|
||||
* @param array $folders
|
||||
*/
|
||||
public function deleteFiles($files = array())
|
||||
{
|
||||
foreach ($files as $key => $file)
|
||||
{
|
||||
JFile::delete($file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes folders
|
||||
*
|
||||
* @param array $folders
|
||||
*/
|
||||
public function deleteFolders($folders = array())
|
||||
{
|
||||
foreach ($folders as $folder)
|
||||
{
|
||||
if (!is_dir($folder))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
JFolder::delete($folder);
|
||||
}
|
||||
}
|
||||
|
||||
public function dropIndex($table, $index)
|
||||
{
|
||||
$db = $this->db;
|
||||
|
||||
// Check if index exists first
|
||||
$query = 'SHOW INDEX FROM ' . $db->quoteName('#__' . $table) . ' WHERE KEY_NAME = ' . $db->quote($index);
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
|
||||
if (!$db->loadResult())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove index
|
||||
$query = 'ALTER TABLE ' . $db->quoteName('#__' . $table) . ' DROP INDEX ' . $db->quoteName($index);
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
}
|
||||
|
||||
public function dropUnwantedTables($tables) {
|
||||
|
||||
if (!$tables) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($tables as $table) {
|
||||
$query = "DROP TABLE IF EXISTS #__".$this->db->escape($table);
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
}
|
||||
}
|
||||
|
||||
public function dropUnwantedColumns($table, $columns) {
|
||||
|
||||
if (!$columns || !$table) {
|
||||
return;
|
||||
}
|
||||
|
||||
$db = $this->db;
|
||||
|
||||
// Check if columns exists in database
|
||||
function qt($n) {
|
||||
return(JFactory::getDBO()->quote($n));
|
||||
}
|
||||
|
||||
$query = 'SHOW COLUMNS FROM #__'.$table.' WHERE Field IN ('.implode(",", array_map("qt", $columns)).')';
|
||||
$db->setQuery($query);
|
||||
$rows = $db->loadColumn(0);
|
||||
|
||||
// Abort if we don't have any rows
|
||||
if (!$rows) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Let's remove the columns
|
||||
$q = "";
|
||||
foreach ($rows as $key => $column) {
|
||||
$comma = (($key+1) < count($rows)) ? "," : "";
|
||||
$q .= "drop ".$this->db->escape($column).$comma;
|
||||
}
|
||||
|
||||
$query = "alter table #__".$table." $q";
|
||||
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
}
|
||||
|
||||
public function fetch($table, $columns = "*", $where = null, $singlerow = false) {
|
||||
if (!$table) {
|
||||
return;
|
||||
}
|
||||
|
||||
$db = $this->db;
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query
|
||||
->select($columns)
|
||||
->from("#__$table");
|
||||
|
||||
if (isset($where)) {
|
||||
$query->where("$where");
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
return ($singlerow) ? $db->loadObject() : $db->loadObjectList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the Novarain Framework
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function loadFramework()
|
||||
{
|
||||
if (is_file(JPATH_PLUGINS . '/system/nrframework/autoload.php'))
|
||||
{
|
||||
include_once JPATH_PLUGINS . '/system/nrframework/autoload.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-orders plugin after passed array of plugins
|
||||
*
|
||||
* @param string $plugin Plugin element name
|
||||
* @param array $lowerPluginOrder Array of plugin element names
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function pluginOrderAfter($lowerPluginOrder)
|
||||
{
|
||||
|
||||
if (!is_array($lowerPluginOrder) || !count($lowerPluginOrder))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$db = $this->db;
|
||||
|
||||
// Get plugins max order
|
||||
$query = $db->getQuery(true);
|
||||
$query
|
||||
->select($db->quoteName('b.ordering'))
|
||||
->from($db->quoteName('#__extensions', 'b'))
|
||||
->where($db->quoteName('b.element') . ' IN ("'.implode("\",\"",$lowerPluginOrder).'")')
|
||||
->order('b.ordering desc');
|
||||
|
||||
$db->setQuery($query);
|
||||
$maxOrder = $db->loadResult();
|
||||
|
||||
if (is_null($maxOrder))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get plugin details
|
||||
$query
|
||||
->clear()
|
||||
->select(array($db->quoteName('extension_id'), $db->quoteName('ordering')))
|
||||
->from($db->quoteName('#__extensions'))
|
||||
->where($db->quoteName('element') . ' = ' . $db->quote($this->alias));
|
||||
|
||||
$db->setQuery($query);
|
||||
$pluginInfo = $db->loadObject();
|
||||
|
||||
if (!isset($pluginInfo->ordering) || $pluginInfo->ordering > $maxOrder)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the new plugin order
|
||||
$object = new stdClass();
|
||||
$object->extension_id = $pluginInfo->extension_id;
|
||||
$object->ordering = ($maxOrder + 1);
|
||||
|
||||
try {
|
||||
$db->updateObject('#__extensions', $object, 'extension_id');
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
24
plugins/convertforms/acymailing/script.install.php
Normal file
24
plugins/convertforms/acymailing/script.install.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Convert Forms
|
||||
* @version 3.2.12 Free
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
require_once __DIR__ . '/script.install.helper.php';
|
||||
|
||||
class PlgConvertFormsAcyMailingInstallerScript extends PlgConvertFormsAcyMailingInstallerScriptHelper
|
||||
{
|
||||
public $name = 'PLG_CONVERTFORMS_ACYMAILING';
|
||||
public $alias = 'acymailing';
|
||||
public $extension_type = 'plugin';
|
||||
public $plugin_folder = "convertforms";
|
||||
public $show_message = false;
|
||||
}
|
||||
287
plugins/convertforms/emails/emails.php
Normal file
287
plugins/convertforms/emails/emails.php
Normal file
@@ -0,0 +1,287 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Convert Forms
|
||||
* @version 3.2.12 Free
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
class plgConvertFormsEmails extends JPlugin
|
||||
{
|
||||
/**
|
||||
* Form Object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
private $form;
|
||||
|
||||
/**
|
||||
* Auto loads the plugin language file
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Add plugin fields to the form
|
||||
*
|
||||
* @param JForm $form
|
||||
* @param object $data
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function onConvertFormsFormPrepareForm($form, $data)
|
||||
{
|
||||
$form->loadFile(__DIR__ . '/form/form.xml', false);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event triggered during fieldset rendering in the form editing page in the backend.
|
||||
*
|
||||
* @param string $fieldset_name The name of the fieldset is going to be rendered
|
||||
* @param string $fieldset The HTML output of the fieldset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onConvertFormsBackendFormPrepareFieldset($fieldset_name, &$fieldset)
|
||||
{
|
||||
if ($this->_name != $fieldset_name)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Proceed only if Mail Sending is disabled.
|
||||
if ((bool) \JFactory::getConfig()->get('mailonline'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$warning = '
|
||||
<div class="alert alert-error">
|
||||
<span class="icon-warning"></span>' .
|
||||
\JText::_('PLG_CONVERTFORMS_EMAILS_ERROR_MAIL_SENDING_DISABLED') . '
|
||||
</div>';
|
||||
|
||||
$fieldset = $warning . $fieldset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the final credentials with the auth code
|
||||
*
|
||||
* @param string $context The context of the content passed to the plugin (added in 1.6)
|
||||
* @param object $article A JTableContent object
|
||||
* @param bool $isNew If the content has just been created
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function onContentBeforeSave($context, $form, $isNew)
|
||||
{
|
||||
if ($context != 'com_convertforms.form')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_object($form) || !isset($form->params))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$params = json_decode($form->params);
|
||||
|
||||
if (!isset($params->emails))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Proceed only if Send Notifications option is enabled
|
||||
if ($params->sendnotifications != '1')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->form = clone $form;
|
||||
$this->form->params = $params;
|
||||
|
||||
foreach ($params->emails as $key => $email)
|
||||
{
|
||||
$keyToID = ((int) str_replace('emails', '', $key)) + 1;
|
||||
$error = JText::_('COM_CONVERTFORMS_EMAILS') . ' #' . $keyToID . ' - ';
|
||||
|
||||
$options = [
|
||||
'recipient' => ['COM_CONVERTFORMS_EMAILS_RECIPIENT', true, true],
|
||||
'subject' => ['COM_CONVERTFORMS_EMAILS_SUBJECT', false, true],
|
||||
'from_name' => ['COM_CONVERTFORMS_EMAILS_FROM', false, true],
|
||||
'from_email' => ['COM_CONVERTFORMS_EMAILS_FROM_EMAIL', true, true],
|
||||
'reply_to' => ['COM_CONVERTFORMS_EMAILS_REPLY_TO', true, false],
|
||||
'reply_to_name' => ['COM_CONVERTFORMS_EMAILS_REPLY_TO_NAME', false, false],
|
||||
'body' => ['COM_CONVERTFORMS_EMAILS_BODY', false, true],
|
||||
'attachments' => ['COM_CONVERTFORMS_EMAILS_ATTACHMENT', false, false]
|
||||
];
|
||||
|
||||
foreach ($options as $key => $option)
|
||||
{
|
||||
$acceptsCommaSeparatedValues = $option[1];
|
||||
$optionValues = $acceptsCommaSeparatedValues ? explode(',', $email->$key) : (array) $email->$key;
|
||||
|
||||
foreach ($optionValues as $optionValue)
|
||||
{
|
||||
$result = $this->validateOption($optionValue, $option[1], $option[2]);
|
||||
|
||||
if (is_string($result))
|
||||
{
|
||||
$form->setError($error . JText::_($option[0]) . ' - ' . $result);
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates string as an Email Notification option.
|
||||
*
|
||||
* @param string $string The option name as found in the xml file
|
||||
* @param bool $validateAsEmail If enabled, the option should be validated as an Email Address
|
||||
* @param bool $required If enabled, string should not be left blank
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function validateOption($string, $validateAsEmail = true, $required = true)
|
||||
{
|
||||
// Check if it's empty
|
||||
if ($required && (empty($string) || is_null($string)))
|
||||
{
|
||||
return JText::sprintf('PLG_CONVERTFORMS_EMAILS_ERROR_BLANK', $string);
|
||||
}
|
||||
|
||||
$string = trim($string);
|
||||
|
||||
// Check if has a valid field-based Smart Tag in the form: {field.field-name}
|
||||
$pattern = "#\{field.([^{}]*)\}#s";
|
||||
preg_match_all($pattern, $string, $result);
|
||||
|
||||
if (!empty($result[1]) && count($result[1]) > 0)
|
||||
{
|
||||
foreach ($result[1] as $key => $match)
|
||||
{
|
||||
// Keep only the actual field name
|
||||
list($field_name, $options) = explode('--', $result[1][$key]) + ['', ''];
|
||||
|
||||
if (!$this->formHasField(trim($field_name)))
|
||||
{
|
||||
return JText::sprintf('PLG_CONVERTFORMS_EMAILS_ERROR_UNKNOWN_SMART_TAG', $result[0][$key]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if has a valid Email Address info@mail.com
|
||||
if ($validateAsEmail && !empty($string))
|
||||
{
|
||||
// Check common email-based Smart Tags
|
||||
if (in_array($string, ['{user.email}', '{site.email}']))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!ConvertForms\Validate::email($string))
|
||||
{
|
||||
return JText::sprintf('PLG_CONVERTFORMS_EMAILS_ERROR_INVALID_EMAIL_ADDRESS', $string);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if given name exists as a form field
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function formHasField($name)
|
||||
{
|
||||
$name = strtolower($name);
|
||||
|
||||
foreach ($this->form->params->fields as $field)
|
||||
{
|
||||
if (!isset($field->name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strtolower($field->name) == $name)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// In case a sub Smart Tag is being used. Eg: {field.dropdown.label} to get dropdown's selected text.
|
||||
if (stripos($name, $field->name . '.') !== false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Content is passed by reference, but after the save, so no changes will be saved.
|
||||
*
|
||||
* @param string $submission The submission information object
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onConvertFormsSubmissionAfterSave($submission)
|
||||
{
|
||||
if (!isset($submission->form->sendnotifications) || !$submission->form->sendnotifications)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($submission->form->emails) || !is_array($submission->form->emails))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$emailCloakEnabled = PluginHelper::isEnabled('content', 'emailcloak');
|
||||
|
||||
// Send email queue
|
||||
foreach ($submission->form->emails as $key => $email)
|
||||
{
|
||||
// Disable cloaking of email addresses
|
||||
if ($emailCloakEnabled)
|
||||
{
|
||||
$email['body'] .= '{emailcloak=off}';
|
||||
}
|
||||
|
||||
// Trigger Content Plugins
|
||||
$email['body'] = \JHtml::_('content.prepare', $email['body']);
|
||||
|
||||
// Replace {variables}
|
||||
$email = ConvertForms\SmartTags::replace($email, $submission);
|
||||
|
||||
// Send mail
|
||||
$mailer = new NRFramework\Email($email);
|
||||
|
||||
if (!$mailer->send())
|
||||
{
|
||||
throw new \Exception($mailer->error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
plugins/convertforms/emails/emails.xml
Normal file
19
plugins/convertforms/emails/emails.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension version="3.4.0" type="plugin" group="convertforms" method="upgrade">
|
||||
<name>PLG_CONVERTFORMS_EMAILS</name>
|
||||
<description>PLG_CONVERTFORMS_EMAILS_DESC</description>
|
||||
<version>1.0</version>
|
||||
<author>Tassos Marinos</author>
|
||||
<authorEmail>info@tassos.gr</authorEmail>
|
||||
<authorUrl>http://www.tassos.gr</authorUrl>
|
||||
<copyright>Copyright (c)2011-2016 Tassos Marinos</copyright>
|
||||
<license>GNU General Public License version 3, or later</license>
|
||||
<creationDate>January 2017</creationDate>
|
||||
<scriptfile>script.install.php</scriptfile>
|
||||
<files>
|
||||
<folder>language</folder>
|
||||
<folder>form</folder>
|
||||
<filename plugin="emails">emails.php</filename>
|
||||
<filename>script.install.helper.php</filename>
|
||||
</files>
|
||||
</extension>
|
||||
57
plugins/convertforms/emails/form/fields.xml
Normal file
57
plugins/convertforms/emails/form/fields.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fieldset>
|
||||
<field name="recipient" type="text"
|
||||
label="COM_CONVERTFORMS_EMAILS_RECIPIENT"
|
||||
description="COM_CONVERTFORMS_EMAILS_RECIPIENT_DESC"
|
||||
hint="COM_CONVERTFORMS_EMAILS_RECIPIENT"
|
||||
class="show-smart-tags"
|
||||
default="{site.email}"
|
||||
required="true"
|
||||
/>
|
||||
<field name="subject" type="text"
|
||||
label="COM_CONVERTFORMS_EMAILS_SUBJECT"
|
||||
hint="COM_CONVERTFORMS_EMAILS_SUBJECT"
|
||||
class="show-smart-tags"
|
||||
default="New Submission #{submission.id}: Contact Form"
|
||||
required="true"
|
||||
/>
|
||||
<field name="from_name" type="text"
|
||||
label="COM_CONVERTFORMS_EMAILS_FROM"
|
||||
hint="COM_CONVERTFORMS_EMAILS_FROM"
|
||||
class="show-smart-tags"
|
||||
default="{site.name}"
|
||||
required="true"
|
||||
/>
|
||||
<field name="from_email" type="text"
|
||||
label="COM_CONVERTFORMS_EMAILS_FROM_EMAIL"
|
||||
hint="COM_CONVERTFORMS_EMAILS_FROM_EMAIL"
|
||||
class="show-smart-tags"
|
||||
default="{site.email}"
|
||||
required="true"
|
||||
/>
|
||||
<field name="reply_to" type="text"
|
||||
label="COM_CONVERTFORMS_EMAILS_REPLY_TO"
|
||||
hint="COM_CONVERTFORMS_EMAILS_REPLY_TO"
|
||||
class="show-smart-tags"
|
||||
/>
|
||||
<field name="reply_to_name" type="text"
|
||||
label="COM_CONVERTFORMS_EMAILS_REPLY_TO_NAME"
|
||||
hint="COM_CONVERTFORMS_EMAILS_REPLY_TO_NAME"
|
||||
class="show-smart-tags"
|
||||
/>
|
||||
<field name="body" type="textarea"
|
||||
label="COM_CONVERTFORMS_EMAILS_BODY"
|
||||
class="editorx show-smart-tags"
|
||||
filter="raw"
|
||||
required="true"
|
||||
default="{all_fields}"
|
||||
/>
|
||||
<field name="attachments" type="text"
|
||||
label="COM_CONVERTFORMS_EMAILS_ATTACHMENT"
|
||||
description="COM_CONVERTFORMS_EMAILS_ATTACHMENT_DESC"
|
||||
hint="images/myattachment.pdf"
|
||||
class="show-smart-tags"
|
||||
/>
|
||||
</fieldset>
|
||||
</form>
|
||||
47
plugins/convertforms/emails/form/fields/cfsubform.php
Normal file
47
plugins/convertforms/emails/form/fields/cfsubform.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Convert Forms
|
||||
* @version 3.2.12 Free
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JFormHelper::loadFieldClass('subform');
|
||||
|
||||
class JFormFieldCFSubform extends JFormFieldSubform
|
||||
{
|
||||
/**
|
||||
* Method to get the field input markup.
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.6
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// The following script toggles the required attribute for all Email Notification options.
|
||||
JFactory::getDocument()->addScriptDeclaration('
|
||||
jQuery(function($) {
|
||||
$("input[name=\'jform[sendnotifications]\']").on("change", function() {
|
||||
var enabled = $(this).is(":checked");
|
||||
var exclude_fields = $("input[id*=reply_to], input[id$=attachments]");
|
||||
var fields = $("#behavior-emails .subform-repeatable-group").find("input, textarea").not(exclude_fields);
|
||||
|
||||
if (enabled) {
|
||||
fields.attr("required", "required").addClass("required");
|
||||
} else {
|
||||
fields.removeAttr("required").removeClass("required");
|
||||
}
|
||||
});
|
||||
});
|
||||
');
|
||||
|
||||
return parent::getInput();
|
||||
}
|
||||
}
|
||||
26
plugins/convertforms/emails/form/form.xml
Normal file
26
plugins/convertforms/emails/form/form.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fieldset name="emails" label="COM_CONVERTFORMS_EMAILS" tab="behavior" addfieldpath="plugins/convertforms/emails/form/fields">
|
||||
|
||||
<field name="emails-free-note" type="note"
|
||||
class="alert alert-error"
|
||||
description="COM_CONVERTFORMS_EMAILS_FREE_NOTE"
|
||||
/>
|
||||
|
||||
<field name="sendnotifications" type="nrtoggle"
|
||||
label="COM_CONVERTFORMS_EMAILS_DESC"
|
||||
/>
|
||||
|
||||
<field name="emails" type="cfsubform"
|
||||
formsource="/plugins/convertforms/emails/form/fields.xml"
|
||||
hiddenLabel="true"
|
||||
multiple="true"
|
||||
buttons="false"
|
||||
max="1"
|
||||
showon="sendnotifications:1"
|
||||
default='{ "emails0": {} }'
|
||||
/>
|
||||
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
@@ -0,0 +1,13 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_EMAILS="Convert Forms – имейл нотификации"
|
||||
PLG_CONVERTFORMS_EMAILS_DESC="Изпращайте известия по имейл, когато потребителите изпратят формуляр."
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_BLANK="Задължително поле"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_UNKNOWN_SMART_TAG="Неизвестен смарт таг: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_INVALID_EMAIL_ADDRESS="Невалиден имейл адрес: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_MAIL_SENDING_DISABLED="<b>Изпращането на поща е изключено!</b> <br>За да можете да изпращате имейли, опцията за изпращане на поща в глобалните настройките за поща на Joomla!, трябва да бъде активирана."
|
||||
@@ -0,0 +1,13 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_EMAILS="Convert Forms - Notificacions per correu electrònic"
|
||||
PLG_CONVERTFORMS_EMAILS_DESC="Envia notificacions per correu electrònic quan els usuaris responen a un formulari."
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_BLANK="Camp requerit"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_UNKNOWN_SMART_TAG="Etiqueta intel·ligent desconeguda: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_INVALID_EMAIL_ADDRESS="Adreça de correu electrònic invàlida: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_MAIL_SENDING_DISABLED="<b>L'enviament de correus electrònics està desactivat!</b><br>Per poder enviar correus electrònics, la opció Enviar Correu electrònic dins la configuració Global de Joomla! ha d'estar activada."
|
||||
@@ -0,0 +1,13 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_EMAILS="Convert Forms - E-mailová upozornění"
|
||||
PLG_CONVERTFORMS_EMAILS_DESC="Poslat upozornění e-mailem, pokud uživatel odešle formulář"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_BLANK="Pole je povinné"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_UNKNOWN_SMART_TAG="Neznámý chytrý štítek: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_INVALID_EMAIL_ADDRESS="Nemplatný e-mailová adresa: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_MAIL_SENDING_DISABLED="<b>Odesílání e-mailů je vypnuté!</b><br>Pokud chcete odesílání e-mailů zprovoznit, musíte aktivovat volbu Odesílat e-maily, kterou najdete v sekci Nastavení mailu v Globálním nastavení Joomla!"
|
||||
@@ -0,0 +1,13 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_EMAILS="Convert Forms - Email Benachrichtigung"
|
||||
PLG_CONVERTFORMS_EMAILS_DESC="Email Benachrichtigung senden, wenn Benutzer ein Formular abschickt"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_BLANK="Feld ist erforderlich"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_UNKNOWN_SMART_TAG="Unbekanntes Smart Tag: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_INVALID_EMAIL_ADDRESS="Ungültige E-Mail-Adresse: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_MAIL_SENDING_DISABLED="<b> E-Mail-Versand ist deaktiviert! </b> <br> Um E-Mails versenden zu können, muss die Option E-Mail senden in den E-Mail-Einstellungen in der globalen Joomla! -Konfiguration aktiviert sein."
|
||||
@@ -0,0 +1,13 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_EMAILS="Convert Forms - Ειδοποιήσεις ηλεκτρονικού ταχυδρομείου"
|
||||
PLG_CONVERTFORMS_EMAILS_DESC="Στείλτε ειδοποιήσεις μέσω email όταν οι χρήστες αποστέλουν μια φόρμα."
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_BLANK="Το πεδίο είναι υποχρεωτικό"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_UNKNOWN_SMART_TAG="Άγνωστη έξυπνη ετικέτα: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_INVALID_EMAIL_ADDRESS="Μη έγκυρη διεύθυνση e-mail: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_MAIL_SENDING_DISABLED="<b>Η αποστολή αλληλογραφίας είναι απενεργοποιημένη!</b><br>Για να μπορείτε να στέλνετε μηνύματα, η επιλογή Αποστολή αλληλογραφίας βρίσκεται στις Ρυθμίσεις αλληλογραφίας του Joomla! Η καθολική διαμόρφωση πρέπει να είναι ενεργοποιημένη.."
|
||||
@@ -0,0 +1,13 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_EMAILS="Convert Forms - Email Notifications"
|
||||
PLG_CONVERTFORMS_EMAILS_DESC="Send email notifications when users submit a form."
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_BLANK="Field is required"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_UNKNOWN_SMART_TAG="Unknown Smart Tag: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_INVALID_EMAIL_ADDRESS="Invalid email address: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_MAIL_SENDING_DISABLED="<b>Mail sending is turned off!</b><br>In order to be able to send emails, the Send Mail option found under the Mail Settings in the Joomla! Global Configuration must be enabled."
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_EMAILS="Convert Forms - Email Notifications"
|
||||
PLG_CONVERTFORMS_EMAILS_DESC="Send email notifications when users submit a form."
|
||||
@@ -0,0 +1,13 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_EMAILS="\"Formas de conversión\" - Notificaciones por email"
|
||||
PLG_CONVERTFORMS_EMAILS_DESC="Envíe notificación por email cuando los usuarios envíen un formulario."
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_BLANK="Campo requerido"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_UNKNOWN_SMART_TAG="Smart Tag desconocido «%s»"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_INVALID_EMAIL_ADDRESS="Email incorrecto «%s»"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_MAIL_SENDING_DISABLED="¡El envío de correo está desactivado! Para poder enviar correos electrónicos, la opción Enviar correo se encuentra en la Configuración de correo en Joomla! La configuración global debe estar habilitada."
|
||||
@@ -0,0 +1,13 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_EMAILS="Convert Forms - E-mailide teated"
|
||||
PLG_CONVERTFORMS_EMAILS_DESC="Saada e-maili teade kui kasutaja sisestab vormi."
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_BLANK="Kohustuslik väli"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_UNKNOWN_SMART_TAG="Tundmatu nutikas-võtmesõna: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_INVALID_EMAIL_ADDRESS="Vigane e-maili aadress: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_MAIL_SENDING_DISABLED="<b>E-mailide saatmine on välja lülitatud!</b><br>Et e-maile saata, lülita Joomla üldistest seadetest see sisse."
|
||||
@@ -0,0 +1,13 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_EMAILS="Convert Forms - Sähköposti-ilmoitukset"
|
||||
PLG_CONVERTFORMS_EMAILS_DESC="Lähetä sähköposti-ilmoitus, kun käyttäjä lähettää lomakkeen."
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_BLANK="Kenttä vaaditaan"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_UNKNOWN_SMART_TAG="Tuntematon Smart Tag: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_INVALID_EMAIL_ADDRESS="Virheellinen sähköpostiosoite: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_MAIL_SENDING_DISABLED="<b>Sähköpostien lähettäminen on kytketty pois päältä! </b><br>Jotta voisit lähettää sähköpostia, Joomlan globaalit sähköpostiasetukset on otettava käyttöön."
|
||||
@@ -0,0 +1,13 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_EMAILS="Convertisseur de formulaires - Notifications par mail"
|
||||
PLG_CONVERTFORMS_EMAILS_DESC="Envoyer une notification par mail aux utilisateurs complétant le formulaire."
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_BLANK="Ce champ est requis"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_UNKNOWN_SMART_TAG="Smart tag inconnu : %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_INVALID_EMAIL_ADDRESS="Adresse de messagerie incorrecte : %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_MAIL_SENDING_DISABLED="<b>L'envoi de mails est désactivé !</b><br>Pour pouvoir les envoyer, vous devez activer l'option dans la Configuration générale de Joomla!"
|
||||
@@ -0,0 +1,13 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_EMAILS="Convert Forms - Notifiche Email"
|
||||
PLG_CONVERTFORMS_EMAILS_DESC="Invia una notifica via email quando un utente invia un modulo."
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_BLANK="Campo richiesto"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_UNKNOWN_SMART_TAG="Smart Tag sconosciuta: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_INVALID_EMAIL_ADDRESS="Indirizzo eMail errato: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_MAIL_SENDING_DISABLED="<b>L'invio di email è disabilitato!</b>Per abilitare la funzione di invio email, l'ozpione Invia Email deve essere attivata nel pannello di controllo di Joomla, alla voce Configurazione Globale."
|
||||
@@ -0,0 +1,13 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_EMAILS="Convert Forms - E-mail Notificaties"
|
||||
PLG_CONVERTFORMS_EMAILS_DESC="Stuur e-mail notificaties als gebruikers een formulier inzenden."
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_BLANK="Dit veld is vereist"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_UNKNOWN_SMART_TAG="Onbekende Smart Tag: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_INVALID_EMAIL_ADDRESS="Ongeldig e-mailadres: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_MAIL_SENDING_DISABLED="<b>Sturen van mail is uitgeschakeld!</b><br>Om e-mails te kunnen sturen moet de Send Mail optie in de Mail Instellingen in de Joomla! Global Configuration ingeschakeld zijn."
|
||||
@@ -0,0 +1,13 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_EMAILS="Plugin Formulários de Conversão - Notificações de E-mail"
|
||||
PLG_CONVERTFORMS_EMAILS_DESC="Envia notificações por e-mail quando os usuários enviarem um formulário."
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_BLANK="Campo obrigatório"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_UNKNOWN_SMART_TAG="Smart Tag desconhecida: 1%s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_INVALID_EMAIL_ADDRESS="Endereço de email inválido: 1%s"
|
||||
; PLG_CONVERTFORMS_EMAILS_ERROR_MAIL_SENDING_DISABLED="<b>Mail sending is turned off!</b><br>In order to be able to send emails, the Send Mail option found under the Mail Settings in the Joomla! Global Configuration must be enabled."
|
||||
@@ -0,0 +1,13 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_EMAILS="Преобразовать формы - Уведомление по электронной почте"
|
||||
PLG_CONVERTFORMS_EMAILS_DESC="Отправить уведомление по электронной почте, когда пользователь отправляет форму"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_BLANK="Поле обязательно для заполнения"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_UNKNOWN_SMART_TAG="Неизвестный смарт-тег: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_INVALID_EMAIL_ADDRESS="Неверный адрес электронной почты: %s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_MAIL_SENDING_DISABLED="<b> Отправка электронной почты деактивирована! </b> <br> Чтобы иметь возможность отправлять электронную почту, в настройках электронной почты в глобальной конфигурации Joomla! Должен быть установлен параметр Отправить электронную почту. быть активированным. "
|
||||
@@ -0,0 +1,13 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_EMAILS="Konvertovať formuláre – e-mailové upozornenia"
|
||||
PLG_CONVERTFORMS_EMAILS_DESC="Odosielať e-mailové upozornenia, keď používatelia odoslali formulár."
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_BLANK="Pole je povinné"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_UNKNOWN_SMART_TAG="Neznáma inteligentná značka:%s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_INVALID_EMAIL_ADDRESS="Neplatná emailová adresa:%s"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_MAIL_SENDING_DISABLED="<b>Odosielanie pošty je vypnuté! </b><br>Aby ste mohli posielať e-maily, možnosť Odoslať poštu sa nachádza v nastaveniach pošty v Joomla! Musí byť povolená globálna konfigurácia."
|
||||
@@ -0,0 +1,13 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_EMAILS="Перетворити форми - повідомлення електронною поштою"
|
||||
PLG_CONVERTFORMS_EMAILS_DESC="Надіслати сповіщення електронною поштою, коли користувач подає форму"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_BLANK="Поле обов'язкове"
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_UNKNOWN_SMART_TAG="Невідомий смарт-тег: %s "
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_INVALID_EMAIL_ADDRESS="Недійсна адреса електронної пошти: %s "
|
||||
PLG_CONVERTFORMS_EMAILS_ERROR_MAIL_SENDING_DISABLED="<b> Електронна пошта вимкнена! </B> <br> Щоб мати змогу надсилати електронні листи, у глобальній конфігурації Joomla! Потрібно встановити параметр"_QQ_" Надіслати електронну пошту "_QQ_". бути активованим. "
|
||||
637
plugins/convertforms/emails/script.install.helper.php
Normal file
637
plugins/convertforms/emails/script.install.helper.php
Normal file
@@ -0,0 +1,637 @@
|
||||
<?php
|
||||
/**
|
||||
* Installer Script Helper
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2016 Tassos Marinos All Rights Reserved
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.filesystem.file');
|
||||
jimport('joomla.filesystem.folder');
|
||||
|
||||
class PlgConvertformsEmailsInstallerScriptHelper
|
||||
{
|
||||
public $name = '';
|
||||
public $alias = '';
|
||||
public $extname = '';
|
||||
public $extension_type = '';
|
||||
public $plugin_folder = 'system';
|
||||
public $module_position = 'status';
|
||||
public $client_id = 1;
|
||||
public $install_type = 'install';
|
||||
public $show_message = true;
|
||||
public $autopublish = true;
|
||||
public $db = null;
|
||||
public $app = null;
|
||||
public $installedVersion;
|
||||
|
||||
public function __construct(&$params)
|
||||
{
|
||||
$this->extname = $this->extname ?: $this->alias;
|
||||
$this->db = JFactory::getDbo();
|
||||
$this->app = JFactory::getApplication();
|
||||
$this->installedVersion = $this->getVersion($this->getInstalledXMLFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* Preflight event
|
||||
*
|
||||
* @param string
|
||||
* @param JAdapterInstance
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function preflight($route, $adapter)
|
||||
{
|
||||
if (!in_array($route, array('install', 'update')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
JFactory::getLanguage()->load('plg_system_novaraininstaller', JPATH_PLUGINS . '/system/novaraininstaller');
|
||||
|
||||
if ($this->show_message && $this->isInstalled())
|
||||
{
|
||||
$this->install_type = 'update';
|
||||
}
|
||||
|
||||
if ($this->onBeforeInstall() === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Preflight event
|
||||
*
|
||||
* @param string
|
||||
* @param JAdapterInstance
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function postflight($route, $adapter)
|
||||
{
|
||||
JFactory::getLanguage()->load($this->getPrefix() . '_' . $this->extname, $this->getMainFolder());
|
||||
|
||||
if (!in_array($route, array('install', 'update')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->onAfterInstall() === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($route == 'install' && $this->autopublish)
|
||||
{
|
||||
$this->publishExtension();
|
||||
}
|
||||
|
||||
if ($this->show_message)
|
||||
{
|
||||
$this->addInstalledMessage();
|
||||
}
|
||||
|
||||
JFactory::getCache()->clean('com_plugins');
|
||||
JFactory::getCache()->clean('_system');
|
||||
}
|
||||
|
||||
public function isInstalled()
|
||||
{
|
||||
if (!is_file($this->getInstalledXMLFile()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = $this->db->getQuery(true)
|
||||
->select('extension_id')
|
||||
->from('#__extensions')
|
||||
->where($this->db->quoteName('type') . ' = ' . $this->db->quote($this->extension_type))
|
||||
->where($this->db->quoteName('element') . ' = ' . $this->db->quote($this->getElementName()));
|
||||
$this->db->setQuery($query, 0, 1);
|
||||
$result = $this->db->loadResult();
|
||||
|
||||
return empty($result) ? false : true;
|
||||
}
|
||||
|
||||
public function getMainFolder()
|
||||
{
|
||||
switch ($this->extension_type)
|
||||
{
|
||||
case 'plugin' :
|
||||
return JPATH_SITE . '/plugins/' . $this->plugin_folder . '/' . $this->extname;
|
||||
|
||||
case 'component' :
|
||||
return JPATH_ADMINISTRATOR . '/components/com_' . $this->extname;
|
||||
|
||||
case 'module' :
|
||||
return JPATH_ADMINISTRATOR . '/modules/mod_' . $this->extname;
|
||||
|
||||
case 'library' :
|
||||
return JPATH_SITE . '/libraries/' . $this->extname;
|
||||
}
|
||||
}
|
||||
|
||||
public function getInstalledXMLFile()
|
||||
{
|
||||
return $this->getXMLFile($this->getMainFolder());
|
||||
}
|
||||
|
||||
public function getCurrentXMLFile()
|
||||
{
|
||||
return $this->getXMLFile(__DIR__);
|
||||
}
|
||||
|
||||
public function getXMLFile($folder)
|
||||
{
|
||||
switch ($this->extension_type)
|
||||
{
|
||||
case 'module' :
|
||||
return $folder . '/mod_' . $this->extname . '.xml';
|
||||
default :
|
||||
return $folder . '/' . $this->extname . '.xml';
|
||||
}
|
||||
}
|
||||
|
||||
public function foldersExist($folders = array())
|
||||
{
|
||||
foreach ($folders as $folder)
|
||||
{
|
||||
if (is_dir($folder))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function publishExtension()
|
||||
{
|
||||
switch ($this->extension_type)
|
||||
{
|
||||
case 'plugin' :
|
||||
$this->publishPlugin();
|
||||
|
||||
case 'module' :
|
||||
$this->publishModule();
|
||||
}
|
||||
}
|
||||
|
||||
public function publishPlugin()
|
||||
{
|
||||
$query = $this->db->getQuery(true)
|
||||
->update('#__extensions')
|
||||
->set($this->db->quoteName('enabled') . ' = 1')
|
||||
->where($this->db->quoteName('type') . ' = ' . $this->db->quote('plugin'))
|
||||
->where($this->db->quoteName('element') . ' = ' . $this->db->quote($this->extname))
|
||||
->where($this->db->quoteName('folder') . ' = ' . $this->db->quote($this->plugin_folder));
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
}
|
||||
|
||||
public function publishModule()
|
||||
{
|
||||
// Get module id
|
||||
$query = $this->db->getQuery(true)
|
||||
->select('id')
|
||||
->from('#__modules')
|
||||
->where($this->db->quoteName('module') . ' = ' . $this->db->quote('mod_' . $this->extname))
|
||||
->where($this->db->quoteName('client_id') . ' = ' . (int) $this->client_id);
|
||||
$this->db->setQuery($query, 0, 1);
|
||||
$id = $this->db->loadResult();
|
||||
|
||||
if (!$id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// check if module is already in the modules_menu table (meaning is is already saved)
|
||||
$query->clear()
|
||||
->select('moduleid')
|
||||
->from('#__modules_menu')
|
||||
->where($this->db->quoteName('moduleid') . ' = ' . (int) $id);
|
||||
$this->db->setQuery($query, 0, 1);
|
||||
$exists = $this->db->loadResult();
|
||||
|
||||
if ($exists)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get highest ordering number in position
|
||||
$query->clear()
|
||||
->select('ordering')
|
||||
->from('#__modules')
|
||||
->where($this->db->quoteName('position') . ' = ' . $this->db->quote($this->module_position))
|
||||
->where($this->db->quoteName('client_id') . ' = ' . (int) $this->client_id)
|
||||
->order('ordering DESC');
|
||||
$this->db->setQuery($query, 0, 1);
|
||||
$ordering = $this->db->loadResult();
|
||||
$ordering++;
|
||||
|
||||
// publish module and set ordering number
|
||||
$query->clear()
|
||||
->update('#__modules')
|
||||
->set($this->db->quoteName('published') . ' = 1')
|
||||
->set($this->db->quoteName('ordering') . ' = ' . (int) $ordering)
|
||||
->set($this->db->quoteName('position') . ' = ' . $this->db->quote($this->module_position))
|
||||
->where($this->db->quoteName('id') . ' = ' . (int) $id);
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
|
||||
// add module to the modules_menu table
|
||||
$query->clear()
|
||||
->insert('#__modules_menu')
|
||||
->columns(array($this->db->quoteName('moduleid'), $this->db->quoteName('menuid')))
|
||||
->values((int) $id . ', 0');
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
}
|
||||
|
||||
public function addInstalledMessage()
|
||||
{
|
||||
JFactory::getApplication()->enqueueMessage(
|
||||
JText::sprintf(
|
||||
JText::_($this->install_type == 'update' ? 'NRI_THE_EXTENSION_HAS_BEEN_UPDATED_SUCCESSFULLY' : 'NRI_THE_EXTENSION_HAS_BEEN_INSTALLED_SUCCESSFULLY'),
|
||||
'<strong>' . JText::_($this->name) . '</strong>',
|
||||
'<strong>' . $this->getVersion() . '</strong>',
|
||||
$this->getFullType()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getPrefix()
|
||||
{
|
||||
switch ($this->extension_type)
|
||||
{
|
||||
case 'plugin';
|
||||
return JText::_('plg_' . strtolower($this->plugin_folder));
|
||||
|
||||
case 'component':
|
||||
return JText::_('com');
|
||||
|
||||
case 'module':
|
||||
return JText::_('mod');
|
||||
|
||||
case 'library':
|
||||
return JText::_('lib');
|
||||
|
||||
default:
|
||||
return $this->extension_type;
|
||||
}
|
||||
}
|
||||
|
||||
public function getElementName($type = null, $extname = null)
|
||||
{
|
||||
$type = is_null($type) ? $this->extension_type : $type;
|
||||
$extname = is_null($extname) ? $this->extname : $extname;
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case 'component' :
|
||||
return 'com_' . $extname;
|
||||
|
||||
case 'module' :
|
||||
return 'mod_' . $extname;
|
||||
|
||||
case 'plugin' :
|
||||
default:
|
||||
return $extname;
|
||||
}
|
||||
}
|
||||
|
||||
public function getFullType()
|
||||
{
|
||||
return JText::_('NRI_' . strtoupper($this->getPrefix()));
|
||||
}
|
||||
|
||||
public function isPro()
|
||||
{
|
||||
$versionFile = __DIR__ . "/version.php";
|
||||
|
||||
// If version file does not exist we assume a PRO version
|
||||
if (!JFile::exists($versionFile))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Load version file
|
||||
require_once $versionFile;
|
||||
return (bool) $NR_PRO;
|
||||
}
|
||||
|
||||
public function getVersion($file = '')
|
||||
{
|
||||
$file = $file ?: $this->getCurrentXMLFile();
|
||||
|
||||
if (!is_file($file))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
$xml = JInstaller::parseXMLInstallFile($file);
|
||||
|
||||
if (!$xml || !isset($xml['version']))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
return $xml['version'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks wether the extension can be installed or not
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function canInstall()
|
||||
{
|
||||
|
||||
// The extension is not installed yet. Accept Install.
|
||||
if (!$installed_version = $this->getVersion($this->getInstalledXMLFile()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Path to extension's version file
|
||||
$versionFile = $this->getMainFolder() . "/version.php";
|
||||
$NR_PRO = true;
|
||||
|
||||
// If version file does not exist we assume we have a PRO version installed
|
||||
if (file_exists($versionFile))
|
||||
{
|
||||
require_once($versionFile);
|
||||
}
|
||||
|
||||
// The free version is installed. Accept install.
|
||||
if (!(bool)$NR_PRO)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Current package is a PRO version. Accept install.
|
||||
if ($this->isPro())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// User is trying to update from PRO version to FREE. Do not accept install.
|
||||
JFactory::getLanguage()->load($this->getPrefix() . '_' . $this->extname, __DIR__);
|
||||
|
||||
JFactory::getApplication()->enqueueMessage(
|
||||
JText::_('NRI_ERROR_PRO_TO_FREE'), 'error'
|
||||
);
|
||||
|
||||
JFactory::getApplication()->enqueueMessage(
|
||||
html_entity_decode(
|
||||
JText::sprintf(
|
||||
'NRI_ERROR_UNINSTALL_FIRST',
|
||||
'<a href="http://www.tassos.gr/joomla-extensions/' . $this->alias . '" target="_blank">',
|
||||
'</a>',
|
||||
JText::_($this->name)
|
||||
)
|
||||
), 'error'
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if current version is newer than the installed one
|
||||
* Used for Novarain Framework
|
||||
*
|
||||
* @return boolean [description]
|
||||
*/
|
||||
public function isNewer()
|
||||
{
|
||||
if (!$installed_version = $this->getVersion($this->getInstalledXMLFile()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$package_version = $this->getVersion();
|
||||
|
||||
return version_compare($installed_version, $package_version, '<=');
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method triggered before installation
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function onBeforeInstall()
|
||||
{
|
||||
if (!$this->canInstall())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method triggered after installation
|
||||
*/
|
||||
public function onAfterInstall()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete files
|
||||
*
|
||||
* @param array $folders
|
||||
*/
|
||||
public function deleteFiles($files = array())
|
||||
{
|
||||
foreach ($files as $key => $file)
|
||||
{
|
||||
JFile::delete($file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes folders
|
||||
*
|
||||
* @param array $folders
|
||||
*/
|
||||
public function deleteFolders($folders = array())
|
||||
{
|
||||
foreach ($folders as $folder)
|
||||
{
|
||||
if (!is_dir($folder))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
JFolder::delete($folder);
|
||||
}
|
||||
}
|
||||
|
||||
public function dropIndex($table, $index)
|
||||
{
|
||||
$db = $this->db;
|
||||
|
||||
// Check if index exists first
|
||||
$query = 'SHOW INDEX FROM ' . $db->quoteName('#__' . $table) . ' WHERE KEY_NAME = ' . $db->quote($index);
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
|
||||
if (!$db->loadResult())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove index
|
||||
$query = 'ALTER TABLE ' . $db->quoteName('#__' . $table) . ' DROP INDEX ' . $db->quoteName($index);
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
}
|
||||
|
||||
public function dropUnwantedTables($tables) {
|
||||
|
||||
if (!$tables) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($tables as $table) {
|
||||
$query = "DROP TABLE IF EXISTS #__".$this->db->escape($table);
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
}
|
||||
}
|
||||
|
||||
public function dropUnwantedColumns($table, $columns) {
|
||||
|
||||
if (!$columns || !$table) {
|
||||
return;
|
||||
}
|
||||
|
||||
$db = $this->db;
|
||||
|
||||
// Check if columns exists in database
|
||||
function qt($n) {
|
||||
return(JFactory::getDBO()->quote($n));
|
||||
}
|
||||
|
||||
$query = 'SHOW COLUMNS FROM #__'.$table.' WHERE Field IN ('.implode(",", array_map("qt", $columns)).')';
|
||||
$db->setQuery($query);
|
||||
$rows = $db->loadColumn(0);
|
||||
|
||||
// Abort if we don't have any rows
|
||||
if (!$rows) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Let's remove the columns
|
||||
$q = "";
|
||||
foreach ($rows as $key => $column) {
|
||||
$comma = (($key+1) < count($rows)) ? "," : "";
|
||||
$q .= "drop ".$this->db->escape($column).$comma;
|
||||
}
|
||||
|
||||
$query = "alter table #__".$table." $q";
|
||||
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
}
|
||||
|
||||
public function fetch($table, $columns = "*", $where = null, $singlerow = false) {
|
||||
if (!$table) {
|
||||
return;
|
||||
}
|
||||
|
||||
$db = $this->db;
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query
|
||||
->select($columns)
|
||||
->from("#__$table");
|
||||
|
||||
if (isset($where)) {
|
||||
$query->where("$where");
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
return ($singlerow) ? $db->loadObject() : $db->loadObjectList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the Novarain Framework
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function loadFramework()
|
||||
{
|
||||
if (is_file(JPATH_PLUGINS . '/system/nrframework/autoload.php'))
|
||||
{
|
||||
include_once JPATH_PLUGINS . '/system/nrframework/autoload.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-orders plugin after passed array of plugins
|
||||
*
|
||||
* @param string $plugin Plugin element name
|
||||
* @param array $lowerPluginOrder Array of plugin element names
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function pluginOrderAfter($lowerPluginOrder)
|
||||
{
|
||||
|
||||
if (!is_array($lowerPluginOrder) || !count($lowerPluginOrder))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$db = $this->db;
|
||||
|
||||
// Get plugins max order
|
||||
$query = $db->getQuery(true);
|
||||
$query
|
||||
->select($db->quoteName('b.ordering'))
|
||||
->from($db->quoteName('#__extensions', 'b'))
|
||||
->where($db->quoteName('b.element') . ' IN ("'.implode("\",\"",$lowerPluginOrder).'")')
|
||||
->order('b.ordering desc');
|
||||
|
||||
$db->setQuery($query);
|
||||
$maxOrder = $db->loadResult();
|
||||
|
||||
if (is_null($maxOrder))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get plugin details
|
||||
$query
|
||||
->clear()
|
||||
->select(array($db->quoteName('extension_id'), $db->quoteName('ordering')))
|
||||
->from($db->quoteName('#__extensions'))
|
||||
->where($db->quoteName('element') . ' = ' . $db->quote($this->alias));
|
||||
|
||||
$db->setQuery($query);
|
||||
$pluginInfo = $db->loadObject();
|
||||
|
||||
if (!isset($pluginInfo->ordering) || $pluginInfo->ordering > $maxOrder)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the new plugin order
|
||||
$object = new stdClass();
|
||||
$object->extension_id = $pluginInfo->extension_id;
|
||||
$object->ordering = ($maxOrder + 1);
|
||||
|
||||
try {
|
||||
$db->updateObject('#__extensions', $object, 'extension_id');
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
24
plugins/convertforms/emails/script.install.php
Normal file
24
plugins/convertforms/emails/script.install.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Convert Forms
|
||||
* @version 3.2.12 Free
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
require_once __DIR__ . '/script.install.helper.php';
|
||||
|
||||
class PlgConvertFormsEmailsInstallerScript extends PlgConvertFormsEmailsInstallerScriptHelper
|
||||
{
|
||||
public $name = 'PLG_CONVERTFORMS_EMAILS';
|
||||
public $alias = 'emails';
|
||||
public $extension_type = 'plugin';
|
||||
public $plugin_folder = "convertforms";
|
||||
public $show_message = false;
|
||||
}
|
||||
84
plugins/convertforms/errorlogger/errorlogger.php
Normal file
84
plugins/convertforms/errorlogger/errorlogger.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Convert Forms
|
||||
* @version 3.2.12 Free
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use NRFramework\WebClient;
|
||||
use ConvertForms\Form;
|
||||
|
||||
class plgConvertFormsErrorLogger extends JPlugin
|
||||
{
|
||||
/**
|
||||
* Joomla Application Object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* Add plugin fields to the form
|
||||
*
|
||||
* @param JForm $form
|
||||
* @param object $data
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function onConvertFormsError($error, $category, $form_id, $data = null)
|
||||
{
|
||||
// Only on front-end
|
||||
if ($this->app->isClient('administrator'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($data['skip_error_logger']))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$user = JFactory::getUser();
|
||||
|
||||
// Get form's name
|
||||
$form_data = Form::load($form_id);
|
||||
$form_name = isset($form_data['name']) ? $form_data['name'] : 'Unknown Form';
|
||||
$form_name .= ' (' . $form_id . ')';
|
||||
|
||||
$error_message = '
|
||||
|
||||
Identity
|
||||
---------------------------------------------------------------------------
|
||||
Date Time: ' . JFactory::getDate() . '
|
||||
Error Category: ' . $category . '
|
||||
Error message: ' . $error . '
|
||||
Form: ' . $form_name . '
|
||||
Session ID: ' . JFactory::getSession()->getId() . '
|
||||
IP Address: ' . $this->app->input->server->get('REMOTE_ADDR') . '
|
||||
User Agent: ' . WebClient::getClient()->userAgent . '
|
||||
Device: ' . WebClient::getDeviceType() . '
|
||||
Logged In Username: ' . $user->username . '
|
||||
Logged In Name: ' . $user->name . '
|
||||
|
||||
Data
|
||||
---------------------------------------------------------------------------
|
||||
' . print_r($data, true) . '
|
||||
|
||||
Request Headers
|
||||
---------------------------------------------------------------------------
|
||||
' . print_r($this->app->input->server->getArray(), true) . '
|
||||
';
|
||||
|
||||
try {
|
||||
JLog::add($error_message, JLog::ERROR, 'convertforms_errors');
|
||||
} catch (\Throwable $th) {
|
||||
}
|
||||
}
|
||||
}
|
||||
18
plugins/convertforms/errorlogger/errorlogger.xml
Normal file
18
plugins/convertforms/errorlogger/errorlogger.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension version="3.4.0" type="plugin" group="convertforms" method="upgrade">
|
||||
<name>PLG_CONVERTFORMS_ERRORLOGGER</name>
|
||||
<description>PLG_CONVERTFORMS_ERRORLOGGER_DESC</description>
|
||||
<version>1.0</version>
|
||||
<author>Tassos Marinos</author>
|
||||
<authorEmail>info@tassos.gr</authorEmail>
|
||||
<authorUrl>http://www.tassos.gr</authorUrl>
|
||||
<copyright>Copyright (c) 2011-2019 Tassos Marinos</copyright>
|
||||
<license>GNU General Public License version 3, or later</license>
|
||||
<creationDate>January 2019</creationDate>
|
||||
<scriptfile>script.install.php</scriptfile>
|
||||
<files>
|
||||
<folder>language</folder>
|
||||
<filename plugin="errorlogger">errorlogger.php</filename>
|
||||
<filename>script.install.helper.php</filename>
|
||||
</files>
|
||||
</extension>
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2019 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ERRORLOGGER="Convert Forms – Дневник на грешките"
|
||||
PLG_CONVERTFORMS_ERRORLOGGER_DESC="Дневник на грешките при регистрация, грешки при подаване на формуляра и при показване на формуляр в сайта."
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2019 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ERRORLOGGER="Convert Forms - Registre d'errors"
|
||||
PLG_CONVERTFORMS_ERRORLOGGER_DESC="Registra els errors produïts durant la tramesa i el renderitzat de formularis a un arxiu de registre."
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2019 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ERRORLOGGER="Convert Forms - Záznam chyb"
|
||||
PLG_CONVERTFORMS_ERRORLOGGER_DESC="Logovat chyby, která nastanou v průběhu vyplňování nebo odesílání formuláře a ukládat je do souboru."
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2019 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ERRORLOGGER="Convert Forms - Fehlerprotokoll"
|
||||
PLG_CONVERTFORMS_ERRORLOGGER_DESC="Protokolliert Fehler, die während der Formularübermittlung und Formularwiedergabe erzeugt wurden, in einer Fehlerprotokolldatei. "
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2019 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ERRORLOGGER="Convert Forms - Καταγραφή σφαλμάτων"
|
||||
PLG_CONVERTFORMS_ERRORLOGGER_DESC="Σφάλματα καταγραφής, που δημιουργούνται κατά την υποβολή φόρμας και απόδοση φόρμας σε αρχείο καταγραφής σφαλμάτων."
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2019 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ERRORLOGGER="Convert Forms - Error Logger"
|
||||
PLG_CONVERTFORMS_ERRORLOGGER_DESC="Log errors errors produced during form submission and form rendering to an error log file."
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2019 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ERRORLOGGER="Convert Forms - Error Logger"
|
||||
PLG_CONVERTFORMS_ERRORLOGGER_DESC="Log errors errors produced during form submission and form rendering to an error log file."
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2019 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ERRORLOGGER="Convertir formularios - Registro de errores"
|
||||
PLG_CONVERTFORMS_ERRORLOGGER_DESC="Errores de registro de errores producidos durante el envío del formulario y la representación del formulario en un archivo de registro de errores."
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2019 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ERRORLOGGER="Convert Forms - Vigade logija"
|
||||
PLG_CONVERTFORMS_ERRORLOGGER_DESC="Logi vigasid mis võivad tekkida vormi andmete sisestamisel ja vormi loomisel."
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2019 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ERRORLOGGER="Convert Forms - Virherekisteröinti"
|
||||
PLG_CONVERTFORMS_ERRORLOGGER_DESC="Virhelogiin liitetyt virheet, jotka on tuotettu lomakkeen lähettämisen ja lomakkeen palautuksen yhteydessä."
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2019 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ERRORLOGGER="Convert Forms - Enregistrement des erreurs"
|
||||
PLG_CONVERTFORMS_ERRORLOGGER_DESC="Enregistre dans un fichier log les erreurs qui se produisent lors de la soumission ou du remplissage d'un formulaire."
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2019 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ERRORLOGGER="Convert Forms - Logger Errori"
|
||||
PLG_CONVERTFORMS_ERRORLOGGER_DESC="Trascrive su un file gli errori che avvengono quando si inviano moduli."
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2019 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ERRORLOGGER="Convert Forms - Fouten Logboek"
|
||||
PLG_CONVERTFORMS_ERRORLOGGER_DESC="Fouten die zich voordoen bij de werking en bij het inzenden van een formulier worden in een logbestand bewaard. "
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2019 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ERRORLOGGER="Конструктор форм - Журнал ошибок"
|
||||
PLG_CONVERTFORMS_ERRORLOGGER_DESC="Сохраняет в журнал ошибки, возникающие при отправке заявок или создании форм"
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2019 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ERRORLOGGER="Convert Forms - Error Logger"
|
||||
PLG_CONVERTFORMS_ERRORLOGGER_DESC="Zaznamenajte chyby vzniknuté počas odosielania formulára a vykresľovania formulára do súboru denníka chýb."
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2019 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ERRORLOGGER="Перетворити форми - журнал помилок"
|
||||
PLG_CONVERTFORMS_ERRORLOGGER_DESC="Помилки журналу, які виникають під час подання форми та коли форма надається в файл журналу помилок."
|
||||
637
plugins/convertforms/errorlogger/script.install.helper.php
Normal file
637
plugins/convertforms/errorlogger/script.install.helper.php
Normal file
@@ -0,0 +1,637 @@
|
||||
<?php
|
||||
/**
|
||||
* Installer Script Helper
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2016 Tassos Marinos All Rights Reserved
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.filesystem.file');
|
||||
jimport('joomla.filesystem.folder');
|
||||
|
||||
class PlgConvertformsErrorloggerInstallerScriptHelper
|
||||
{
|
||||
public $name = '';
|
||||
public $alias = '';
|
||||
public $extname = '';
|
||||
public $extension_type = '';
|
||||
public $plugin_folder = 'system';
|
||||
public $module_position = 'status';
|
||||
public $client_id = 1;
|
||||
public $install_type = 'install';
|
||||
public $show_message = true;
|
||||
public $autopublish = true;
|
||||
public $db = null;
|
||||
public $app = null;
|
||||
public $installedVersion;
|
||||
|
||||
public function __construct(&$params)
|
||||
{
|
||||
$this->extname = $this->extname ?: $this->alias;
|
||||
$this->db = JFactory::getDbo();
|
||||
$this->app = JFactory::getApplication();
|
||||
$this->installedVersion = $this->getVersion($this->getInstalledXMLFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* Preflight event
|
||||
*
|
||||
* @param string
|
||||
* @param JAdapterInstance
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function preflight($route, $adapter)
|
||||
{
|
||||
if (!in_array($route, array('install', 'update')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
JFactory::getLanguage()->load('plg_system_novaraininstaller', JPATH_PLUGINS . '/system/novaraininstaller');
|
||||
|
||||
if ($this->show_message && $this->isInstalled())
|
||||
{
|
||||
$this->install_type = 'update';
|
||||
}
|
||||
|
||||
if ($this->onBeforeInstall() === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Preflight event
|
||||
*
|
||||
* @param string
|
||||
* @param JAdapterInstance
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function postflight($route, $adapter)
|
||||
{
|
||||
JFactory::getLanguage()->load($this->getPrefix() . '_' . $this->extname, $this->getMainFolder());
|
||||
|
||||
if (!in_array($route, array('install', 'update')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->onAfterInstall() === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($route == 'install' && $this->autopublish)
|
||||
{
|
||||
$this->publishExtension();
|
||||
}
|
||||
|
||||
if ($this->show_message)
|
||||
{
|
||||
$this->addInstalledMessage();
|
||||
}
|
||||
|
||||
JFactory::getCache()->clean('com_plugins');
|
||||
JFactory::getCache()->clean('_system');
|
||||
}
|
||||
|
||||
public function isInstalled()
|
||||
{
|
||||
if (!is_file($this->getInstalledXMLFile()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = $this->db->getQuery(true)
|
||||
->select('extension_id')
|
||||
->from('#__extensions')
|
||||
->where($this->db->quoteName('type') . ' = ' . $this->db->quote($this->extension_type))
|
||||
->where($this->db->quoteName('element') . ' = ' . $this->db->quote($this->getElementName()));
|
||||
$this->db->setQuery($query, 0, 1);
|
||||
$result = $this->db->loadResult();
|
||||
|
||||
return empty($result) ? false : true;
|
||||
}
|
||||
|
||||
public function getMainFolder()
|
||||
{
|
||||
switch ($this->extension_type)
|
||||
{
|
||||
case 'plugin' :
|
||||
return JPATH_SITE . '/plugins/' . $this->plugin_folder . '/' . $this->extname;
|
||||
|
||||
case 'component' :
|
||||
return JPATH_ADMINISTRATOR . '/components/com_' . $this->extname;
|
||||
|
||||
case 'module' :
|
||||
return JPATH_ADMINISTRATOR . '/modules/mod_' . $this->extname;
|
||||
|
||||
case 'library' :
|
||||
return JPATH_SITE . '/libraries/' . $this->extname;
|
||||
}
|
||||
}
|
||||
|
||||
public function getInstalledXMLFile()
|
||||
{
|
||||
return $this->getXMLFile($this->getMainFolder());
|
||||
}
|
||||
|
||||
public function getCurrentXMLFile()
|
||||
{
|
||||
return $this->getXMLFile(__DIR__);
|
||||
}
|
||||
|
||||
public function getXMLFile($folder)
|
||||
{
|
||||
switch ($this->extension_type)
|
||||
{
|
||||
case 'module' :
|
||||
return $folder . '/mod_' . $this->extname . '.xml';
|
||||
default :
|
||||
return $folder . '/' . $this->extname . '.xml';
|
||||
}
|
||||
}
|
||||
|
||||
public function foldersExist($folders = array())
|
||||
{
|
||||
foreach ($folders as $folder)
|
||||
{
|
||||
if (is_dir($folder))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function publishExtension()
|
||||
{
|
||||
switch ($this->extension_type)
|
||||
{
|
||||
case 'plugin' :
|
||||
$this->publishPlugin();
|
||||
|
||||
case 'module' :
|
||||
$this->publishModule();
|
||||
}
|
||||
}
|
||||
|
||||
public function publishPlugin()
|
||||
{
|
||||
$query = $this->db->getQuery(true)
|
||||
->update('#__extensions')
|
||||
->set($this->db->quoteName('enabled') . ' = 1')
|
||||
->where($this->db->quoteName('type') . ' = ' . $this->db->quote('plugin'))
|
||||
->where($this->db->quoteName('element') . ' = ' . $this->db->quote($this->extname))
|
||||
->where($this->db->quoteName('folder') . ' = ' . $this->db->quote($this->plugin_folder));
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
}
|
||||
|
||||
public function publishModule()
|
||||
{
|
||||
// Get module id
|
||||
$query = $this->db->getQuery(true)
|
||||
->select('id')
|
||||
->from('#__modules')
|
||||
->where($this->db->quoteName('module') . ' = ' . $this->db->quote('mod_' . $this->extname))
|
||||
->where($this->db->quoteName('client_id') . ' = ' . (int) $this->client_id);
|
||||
$this->db->setQuery($query, 0, 1);
|
||||
$id = $this->db->loadResult();
|
||||
|
||||
if (!$id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// check if module is already in the modules_menu table (meaning is is already saved)
|
||||
$query->clear()
|
||||
->select('moduleid')
|
||||
->from('#__modules_menu')
|
||||
->where($this->db->quoteName('moduleid') . ' = ' . (int) $id);
|
||||
$this->db->setQuery($query, 0, 1);
|
||||
$exists = $this->db->loadResult();
|
||||
|
||||
if ($exists)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get highest ordering number in position
|
||||
$query->clear()
|
||||
->select('ordering')
|
||||
->from('#__modules')
|
||||
->where($this->db->quoteName('position') . ' = ' . $this->db->quote($this->module_position))
|
||||
->where($this->db->quoteName('client_id') . ' = ' . (int) $this->client_id)
|
||||
->order('ordering DESC');
|
||||
$this->db->setQuery($query, 0, 1);
|
||||
$ordering = $this->db->loadResult();
|
||||
$ordering++;
|
||||
|
||||
// publish module and set ordering number
|
||||
$query->clear()
|
||||
->update('#__modules')
|
||||
->set($this->db->quoteName('published') . ' = 1')
|
||||
->set($this->db->quoteName('ordering') . ' = ' . (int) $ordering)
|
||||
->set($this->db->quoteName('position') . ' = ' . $this->db->quote($this->module_position))
|
||||
->where($this->db->quoteName('id') . ' = ' . (int) $id);
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
|
||||
// add module to the modules_menu table
|
||||
$query->clear()
|
||||
->insert('#__modules_menu')
|
||||
->columns(array($this->db->quoteName('moduleid'), $this->db->quoteName('menuid')))
|
||||
->values((int) $id . ', 0');
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
}
|
||||
|
||||
public function addInstalledMessage()
|
||||
{
|
||||
JFactory::getApplication()->enqueueMessage(
|
||||
JText::sprintf(
|
||||
JText::_($this->install_type == 'update' ? 'NRI_THE_EXTENSION_HAS_BEEN_UPDATED_SUCCESSFULLY' : 'NRI_THE_EXTENSION_HAS_BEEN_INSTALLED_SUCCESSFULLY'),
|
||||
'<strong>' . JText::_($this->name) . '</strong>',
|
||||
'<strong>' . $this->getVersion() . '</strong>',
|
||||
$this->getFullType()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getPrefix()
|
||||
{
|
||||
switch ($this->extension_type)
|
||||
{
|
||||
case 'plugin';
|
||||
return JText::_('plg_' . strtolower($this->plugin_folder));
|
||||
|
||||
case 'component':
|
||||
return JText::_('com');
|
||||
|
||||
case 'module':
|
||||
return JText::_('mod');
|
||||
|
||||
case 'library':
|
||||
return JText::_('lib');
|
||||
|
||||
default:
|
||||
return $this->extension_type;
|
||||
}
|
||||
}
|
||||
|
||||
public function getElementName($type = null, $extname = null)
|
||||
{
|
||||
$type = is_null($type) ? $this->extension_type : $type;
|
||||
$extname = is_null($extname) ? $this->extname : $extname;
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case 'component' :
|
||||
return 'com_' . $extname;
|
||||
|
||||
case 'module' :
|
||||
return 'mod_' . $extname;
|
||||
|
||||
case 'plugin' :
|
||||
default:
|
||||
return $extname;
|
||||
}
|
||||
}
|
||||
|
||||
public function getFullType()
|
||||
{
|
||||
return JText::_('NRI_' . strtoupper($this->getPrefix()));
|
||||
}
|
||||
|
||||
public function isPro()
|
||||
{
|
||||
$versionFile = __DIR__ . "/version.php";
|
||||
|
||||
// If version file does not exist we assume a PRO version
|
||||
if (!JFile::exists($versionFile))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Load version file
|
||||
require_once $versionFile;
|
||||
return (bool) $NR_PRO;
|
||||
}
|
||||
|
||||
public function getVersion($file = '')
|
||||
{
|
||||
$file = $file ?: $this->getCurrentXMLFile();
|
||||
|
||||
if (!is_file($file))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
$xml = JInstaller::parseXMLInstallFile($file);
|
||||
|
||||
if (!$xml || !isset($xml['version']))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
return $xml['version'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks wether the extension can be installed or not
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function canInstall()
|
||||
{
|
||||
|
||||
// The extension is not installed yet. Accept Install.
|
||||
if (!$installed_version = $this->getVersion($this->getInstalledXMLFile()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Path to extension's version file
|
||||
$versionFile = $this->getMainFolder() . "/version.php";
|
||||
$NR_PRO = true;
|
||||
|
||||
// If version file does not exist we assume we have a PRO version installed
|
||||
if (file_exists($versionFile))
|
||||
{
|
||||
require_once($versionFile);
|
||||
}
|
||||
|
||||
// The free version is installed. Accept install.
|
||||
if (!(bool)$NR_PRO)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Current package is a PRO version. Accept install.
|
||||
if ($this->isPro())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// User is trying to update from PRO version to FREE. Do not accept install.
|
||||
JFactory::getLanguage()->load($this->getPrefix() . '_' . $this->extname, __DIR__);
|
||||
|
||||
JFactory::getApplication()->enqueueMessage(
|
||||
JText::_('NRI_ERROR_PRO_TO_FREE'), 'error'
|
||||
);
|
||||
|
||||
JFactory::getApplication()->enqueueMessage(
|
||||
html_entity_decode(
|
||||
JText::sprintf(
|
||||
'NRI_ERROR_UNINSTALL_FIRST',
|
||||
'<a href="http://www.tassos.gr/joomla-extensions/' . $this->alias . '" target="_blank">',
|
||||
'</a>',
|
||||
JText::_($this->name)
|
||||
)
|
||||
), 'error'
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if current version is newer than the installed one
|
||||
* Used for Novarain Framework
|
||||
*
|
||||
* @return boolean [description]
|
||||
*/
|
||||
public function isNewer()
|
||||
{
|
||||
if (!$installed_version = $this->getVersion($this->getInstalledXMLFile()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$package_version = $this->getVersion();
|
||||
|
||||
return version_compare($installed_version, $package_version, '<=');
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method triggered before installation
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function onBeforeInstall()
|
||||
{
|
||||
if (!$this->canInstall())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method triggered after installation
|
||||
*/
|
||||
public function onAfterInstall()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete files
|
||||
*
|
||||
* @param array $folders
|
||||
*/
|
||||
public function deleteFiles($files = array())
|
||||
{
|
||||
foreach ($files as $key => $file)
|
||||
{
|
||||
JFile::delete($file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes folders
|
||||
*
|
||||
* @param array $folders
|
||||
*/
|
||||
public function deleteFolders($folders = array())
|
||||
{
|
||||
foreach ($folders as $folder)
|
||||
{
|
||||
if (!is_dir($folder))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
JFolder::delete($folder);
|
||||
}
|
||||
}
|
||||
|
||||
public function dropIndex($table, $index)
|
||||
{
|
||||
$db = $this->db;
|
||||
|
||||
// Check if index exists first
|
||||
$query = 'SHOW INDEX FROM ' . $db->quoteName('#__' . $table) . ' WHERE KEY_NAME = ' . $db->quote($index);
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
|
||||
if (!$db->loadResult())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove index
|
||||
$query = 'ALTER TABLE ' . $db->quoteName('#__' . $table) . ' DROP INDEX ' . $db->quoteName($index);
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
}
|
||||
|
||||
public function dropUnwantedTables($tables) {
|
||||
|
||||
if (!$tables) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($tables as $table) {
|
||||
$query = "DROP TABLE IF EXISTS #__".$this->db->escape($table);
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
}
|
||||
}
|
||||
|
||||
public function dropUnwantedColumns($table, $columns) {
|
||||
|
||||
if (!$columns || !$table) {
|
||||
return;
|
||||
}
|
||||
|
||||
$db = $this->db;
|
||||
|
||||
// Check if columns exists in database
|
||||
function qt($n) {
|
||||
return(JFactory::getDBO()->quote($n));
|
||||
}
|
||||
|
||||
$query = 'SHOW COLUMNS FROM #__'.$table.' WHERE Field IN ('.implode(",", array_map("qt", $columns)).')';
|
||||
$db->setQuery($query);
|
||||
$rows = $db->loadColumn(0);
|
||||
|
||||
// Abort if we don't have any rows
|
||||
if (!$rows) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Let's remove the columns
|
||||
$q = "";
|
||||
foreach ($rows as $key => $column) {
|
||||
$comma = (($key+1) < count($rows)) ? "," : "";
|
||||
$q .= "drop ".$this->db->escape($column).$comma;
|
||||
}
|
||||
|
||||
$query = "alter table #__".$table." $q";
|
||||
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
}
|
||||
|
||||
public function fetch($table, $columns = "*", $where = null, $singlerow = false) {
|
||||
if (!$table) {
|
||||
return;
|
||||
}
|
||||
|
||||
$db = $this->db;
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query
|
||||
->select($columns)
|
||||
->from("#__$table");
|
||||
|
||||
if (isset($where)) {
|
||||
$query->where("$where");
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
return ($singlerow) ? $db->loadObject() : $db->loadObjectList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the Novarain Framework
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function loadFramework()
|
||||
{
|
||||
if (is_file(JPATH_PLUGINS . '/system/nrframework/autoload.php'))
|
||||
{
|
||||
include_once JPATH_PLUGINS . '/system/nrframework/autoload.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-orders plugin after passed array of plugins
|
||||
*
|
||||
* @param string $plugin Plugin element name
|
||||
* @param array $lowerPluginOrder Array of plugin element names
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function pluginOrderAfter($lowerPluginOrder)
|
||||
{
|
||||
|
||||
if (!is_array($lowerPluginOrder) || !count($lowerPluginOrder))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$db = $this->db;
|
||||
|
||||
// Get plugins max order
|
||||
$query = $db->getQuery(true);
|
||||
$query
|
||||
->select($db->quoteName('b.ordering'))
|
||||
->from($db->quoteName('#__extensions', 'b'))
|
||||
->where($db->quoteName('b.element') . ' IN ("'.implode("\",\"",$lowerPluginOrder).'")')
|
||||
->order('b.ordering desc');
|
||||
|
||||
$db->setQuery($query);
|
||||
$maxOrder = $db->loadResult();
|
||||
|
||||
if (is_null($maxOrder))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get plugin details
|
||||
$query
|
||||
->clear()
|
||||
->select(array($db->quoteName('extension_id'), $db->quoteName('ordering')))
|
||||
->from($db->quoteName('#__extensions'))
|
||||
->where($db->quoteName('element') . ' = ' . $db->quote($this->alias));
|
||||
|
||||
$db->setQuery($query);
|
||||
$pluginInfo = $db->loadObject();
|
||||
|
||||
if (!isset($pluginInfo->ordering) || $pluginInfo->ordering > $maxOrder)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the new plugin order
|
||||
$object = new stdClass();
|
||||
$object->extension_id = $pluginInfo->extension_id;
|
||||
$object->ordering = ($maxOrder + 1);
|
||||
|
||||
try {
|
||||
$db->updateObject('#__extensions', $object, 'extension_id');
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
24
plugins/convertforms/errorlogger/script.install.php
Normal file
24
plugins/convertforms/errorlogger/script.install.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Convert Forms
|
||||
* @version 3.2.12 Free
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
require_once __DIR__ . '/script.install.helper.php';
|
||||
|
||||
class PlgConvertFormsErrorLoggerInstallerScript extends PlgConvertFormsErrorLoggerInstallerScriptHelper
|
||||
{
|
||||
public $name = 'PLG_CONVERTFORMS_ERRORLOGGER';
|
||||
public $alias = 'errorlogger';
|
||||
public $extension_type = 'plugin';
|
||||
public $plugin_folder = "convertforms";
|
||||
public $show_message = false;
|
||||
}
|
||||
Reference in New Issue
Block a user