Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/com_tjnotifications/admin/controllers/notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class TjnotificationsControllerNotification extends FormController
public function save($key = null, $urlVar = '')
{
// Check for request forgeries.
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken() or Factory::getApplication()->close();

// Initialise variables.
$app = Factory::getApplication();
Expand Down Expand Up @@ -407,7 +407,7 @@ public function cancel($key = null)
public function add($key = null, $urlVar = null)
{
// Check for request forgeries
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken() or Factory::getApplication()->close();

$input = Factory::getApplication()->input;
$extension = $input->get('extension', '', 'STRING');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function getModel($name = 'Notification', $prefix = 'TjnotificationsModel
public function delete()
{
// Check for request forgeries
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken() or Factory::getApplication()->close();

$mainframe = Factory::getApplication();
$input = $mainframe->input;
Expand Down
2 changes: 1 addition & 1 deletion src/com_tjnotifications/admin/controllers/subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct()
public function save($key = null, $urlVar = '')
{
// Check for request forgeries.
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken() or Factory::getApplication()->close();

// Initialise variables.
$app = Factory::getApplication();
Expand Down
2 changes: 1 addition & 1 deletion src/com_tjnotifications/admin/helpers/tjnotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Filesystem\Path;
use Joomla\Filesystem\Path;
use Joomla\CMS\Helper\ContentHelper;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,16 +311,3 @@ COM_TJNOTIFICATIONS_SETTINGS_WEBHOOK_URL_LABEL="Webhook URL"
COM_TJNOTIFICATIONS_SETTINGS_WEBHOOK_URL_DESC="Enter URL for your Webhook notification"
COM_TJNOTIFICATIONS_TEMPLATE_ERR_MSG_CUSTOM_WEBHOOK_URLS="Please add custom webhook URL or use global webhook URL"
COM_TJNOTIFICATIONS_TEMPLATE_ERR_MSG_GLOBAL_WEBHOOK_URLS="Please add webhook URLs in the global config or add custom webhook URL."

; Error messages
COM_TJNOTIFICATIONS_TEMPLATE_ERR_MSG_WEBHOOK_BODY_REQUIRED="Webhook body is required when webhook is enabled."
COM_TJNOTIFICATIONS_TEMPLATE_ERR_MSG_WEBHOOK_LANGUAGE_REQUIRED="Language selection is required when webhook is enabled."
COM_TJNOTIFICATIONS_TEMPLATE_ERR_MSG_EMAIL_BODY_REQUIRED="Email body is required when email is enabled."
COM_TJNOTIFICATIONS_TEMPLATE_ERR_MSG_EMAIL_SUBJECT_REQUIRED="Email subject is required when email is enabled."
COM_TJNOTIFICATIONS_TEMPLATE_ERR_MSG_EMAIL_LANGUAGE_REQUIRED="Language selection is required when email is enabled."
COM_TJNOTIFICATIONS_TEMPLATE_ERR_MSG_SMS_BODY_REQUIRED="SMS body is required when SMS is enabled."
COM_TJNOTIFICATIONS_TEMPLATE_ERR_MSG_SMS_LANGUAGE_REQUIRED="Language selection is required when SMS is enabled."
COM_TJNOTIFICATIONS_TEMPLATE_ERR_MSG_PUSH_BODY_REQUIRED="Push body is required when push is enabled."
COM_TJNOTIFICATIONS_TEMPLATE_ERR_MSG_PUSH_LANGUAGE_REQUIRED="Language selection is required when push is enabled."
COM_TJNOTIFICATIONS_TEMPLATE_ERR_MSG_WHATSAPP_BODY_REQUIRED="WhatsApp body is required when WhatsApp is enabled."
COM_TJNOTIFICATIONS_TEMPLATE_ERR_MSG_WHATSAPP_LANGUAGE_REQUIRED="Language selection is required when WhatsApp is enabled."
9 changes: 4 additions & 5 deletions src/com_tjnotifications/admin/models/fields/backends.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

FormHelper::loadFieldClass('list');
use Joomla\CMS\Form\Field\ListField;

/**
* Supports an HTML select list of backends
*
* @since 2.0.0
*/
class JFormFieldBackends extends JFormFieldList
class JFormFieldBackends extends ListField
{
/**
* The form field type.
Expand All @@ -34,7 +33,7 @@ class JFormFieldBackends extends JFormFieldList
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
* @return array An array of HTMLHelper options.
*
* @since 2.0.0
*/
Expand All @@ -55,7 +54,7 @@ protected function getOptions()
/**
* Method to get a list of options for a list input externally and not from xml.
*
* @return array An array of JHtml options.
* @return array An array of HTMLHelper options.
*
* @since 2.1
*/
Expand Down
7 changes: 3 additions & 4 deletions src/com_tjnotifications/admin/models/fields/clients.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,19 @@
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;

FormHelper::loadFieldClass('list');
use Joomla\CMS\Form\Field\ListField;

/**
* Custom field to list all client of tjnotification
*
* @since 2.0.1
*/
class JFormFieldClients extends JFormFieldList
class JFormFieldClients extends ListField
{
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
* @return array An array of HTMLHelper options.
*
* @since 2.0.1
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @since 2.0.1
*/

class JFormFieldMobilenumberfields extends JFormFieldGroupedList
class JFormFieldMobilenumberfields extends GroupedlistField
{
/**
* The form field type.
Expand Down Expand Up @@ -54,7 +54,10 @@
protected function getGroups()
{
// Load fields helper
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');
$fieldsHelperPath = JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php';
if (file_exists($fieldsHelperPath)) {
require_once $fieldsHelperPath;

Check warning on line 59 in src/com_tjnotifications/admin/models/fields/mobilenumberfields.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace "require_once" with namespace import mechanism through the "use" keyword.

See more on https://sonarcloud.io/project/issues?id=techjoomla_TJ-Notifications&issues=AZsMj1HjlrCm82IUc4OC&open=AZsMj1HjlrCm82IUc4OC&pullRequest=180
}

// Get custom field names by users
$customFieldnames = FieldsHelper::getFields('com_users.user');
Expand Down
9 changes: 4 additions & 5 deletions src/com_tjnotifications/admin/models/fields/platforms.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

FormHelper::loadFieldClass('list');
use Joomla\CMS\Form\Field\ListField;

/**
* Supports an HTML select list of platforms
*
* @since 2.0.0
*/
class JFormFieldPlatforms extends JFormFieldList
class JFormFieldPlatforms extends ListField
{
/**
* The form field type.
Expand All @@ -34,7 +33,7 @@ class JFormFieldPlatforms extends JFormFieldList
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
* @return array An array of HTMLHelper options.
*
* @since 2.0.0
*/
Expand All @@ -53,7 +52,7 @@ protected function getOptions()
/**
* Method to get a list of options for a list input externally and not from xml.
*
* @return array An array of JHtml options.
* @return array An array of HTMLHelper options.
*
* @since 2.1
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;

FormHelper::loadFieldClass('list');
use Joomla\CMS\Form\Field\ListField;

/**
* Supports an HTML select list of backends
*
* @since 2.0.0
*/
class JFormFieldTjnotificationsbackends extends JFormFieldList
class JFormFieldTjnotificationsbackends extends ListField
{
/**
* The form field type.
Expand All @@ -34,7 +33,7 @@ class JFormFieldTjnotificationsbackends extends JFormFieldList
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
* @return array An array of HTMLHelper options.
*
* @since 2.0.0
*/
Expand Down
49 changes: 26 additions & 23 deletions src/com_tjnotifications/admin/models/forms/emailfields.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,33 @@
name="id"
type="hidden" />

<field
name="language"
type="contentlanguage"
label="JFIELD_LANGUAGE_LABEL"
description="COM_TJNOTIFICATIONS_NOTIFICATION_LANGUAGE_DESC"
>
<option value="*">JALL</option>
</field>
<field
name="language"
type="contentlanguage"
label="JFIELD_LANGUAGE_LABEL"
description="COM_TJNOTIFICATIONS_NOTIFICATION_LANGUAGE_DESC"
required="true"
>
<option value="*">JALL</option>
</field>

<field
name="subject"
type="textarea"
label="COM_TJNOTIFICATIONS_FIELD_EMAIL_SUBJECT_LABEL"
description="COM_TJNOTIFICATIONS_FIELD_EMAIL_SUBJECT_DESC"
/>
<field
name="subject"
type="textarea"
label="COM_TJNOTIFICATIONS_FIELD_EMAIL_SUBJECT_LABEL"
description="COM_TJNOTIFICATIONS_FIELD_EMAIL_SUBJECT_DESC"
required="true"
/>

<field
name="body"
type="editor"
label="COM_TJNOTIFICATIONS_FIELD_EMAIL_BODY_LABEL"
description="COM_TJNOTIFICATIONS_FIELD_EMAIL_BODY_DESC"
buttons="true"
filter="JComponentHelper::filterText"
height="150px"
/>
<field
name="body"
type="editor"
label="COM_TJNOTIFICATIONS_FIELD_EMAIL_BODY_LABEL"
description="COM_TJNOTIFICATIONS_FIELD_EMAIL_BODY_DESC"
buttons="true"
filter="\Joomla\CMS\Component\ComponentHelper::filterText"
height="150px"
required="true"
/>
</fieldset>
</form>
38 changes: 20 additions & 18 deletions src/com_tjnotifications/admin/models/forms/pushfields.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,26 @@
name="id"
type="hidden" />

<field
name="language"
type="contentlanguage"
label="JFIELD_LANGUAGE_LABEL"
description="COM_TJNOTIFICATIONS_NOTIFICATION_LANGUAGE_DESC"
>
<option value="*">JALL</option>
</field>
<field
name="language"
type="contentlanguage"
label="JFIELD_LANGUAGE_LABEL"
description="COM_TJNOTIFICATIONS_NOTIFICATION_LANGUAGE_DESC"
required="true"
>
<option value="*">JALL</option>
</field>

<field
name="body"
type="textarea"
label="COM_TJNOTIFICATIONS_FIELD_PUSH_BODY_LABEL"
description="COM_TJNOTIFICATIONS_FIELD_PUSH_BODY_DESC"
rows="10"
cols="150"
filter="JComponentHelper::filterText"
class="validate-json"
/>
<field
name="body"
type="textarea"
label="COM_TJNOTIFICATIONS_FIELD_PUSH_BODY_LABEL"
description="COM_TJNOTIFICATIONS_FIELD_PUSH_BODY_DESC"
rows="10"
cols="150"
filter="\Joomla\CMS\Component\ComponentHelper::filterText"
class="validate-json"
required="true"
/>
</fieldset>
</form>
38 changes: 20 additions & 18 deletions src/com_tjnotifications/admin/models/forms/smsfields.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,27 @@
name="id"
type="hidden" />

<field
name="language"
type="contentlanguage"
label="JFIELD_LANGUAGE_LABEL"
description="COM_TJNOTIFICATIONS_NOTIFICATION_LANGUAGE_DESC"
>
<option value="*">JALL</option>
</field>
<field
name="language"
type="contentlanguage"
label="JFIELD_LANGUAGE_LABEL"
description="COM_TJNOTIFICATIONS_NOTIFICATION_LANGUAGE_DESC"
required="true"
>
<option value="*">JALL</option>
</field>

<field
name="body"
type="textarea"
label="COM_TJNOTIFICATIONS_FIELD_SMS_BODY_LABEL"
description="COM_TJNOTIFICATIONS_FIELD_SMS_BODY_DESC"
rows="10"
cols="150"
filter="JComponentHelper::filterText"
onchange="tjnotificationsAdmin.notification.validateSmsLength(this)"
/>
<field
name="body"
type="textarea"
label="COM_TJNOTIFICATIONS_FIELD_SMS_BODY_LABEL"
description="COM_TJNOTIFICATIONS_FIELD_SMS_BODY_DESC"
rows="10"
cols="150"
filter="\Joomla\CMS\Component\ComponentHelper::filterText"
required="true"
onchange="tjnotificationsAdmin.notification.validateSmsLength(this)"
/>

<field
name="provider_template_id"
Expand Down
Loading