mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2025-01-27 06:18:29 +00:00
Allow captcha when submit a webllink (#223)
* allow captcha on submit web link allow captcha on submit web link (1/5) * allow captcha on submit web link allow captcha on submit web link (2/5) * allow captcha on submit web link allow captcha on submit web link (3/5) * allow captcha on submit web link allow captcha on submit web link (4/5) * allow captcha on submit web link allow captcha on submit web link (5/5) * CS fix CS fix * XML CS for https://github.com/joomla-extensions/weblinks/pull/223 Simple XML CS https://github.com/joomla-extensions/weblinks/pull/223 * update captcha message update captcha message like com_user, com_contatct #10931 * handle session data handle session data 1(/2) * handle session data handle session data (2/2) * move buttons down move buttons down * fix conflicts with #231 fix conflicts with #231 * fix conflicts with #231 fix conflicts with #231
This commit is contained in:
parent
77d2b1fbf9
commit
1680ec7b49
@ -5,6 +5,19 @@
|
||||
description="COM_WEBLINKS_COMPONENT_DESC"
|
||||
>
|
||||
|
||||
<field
|
||||
name="captcha"
|
||||
type="plugins"
|
||||
label="COM_WEBLINKS_FIELD_CAPTCHA_LABEL"
|
||||
description="COM_WEBLINKS_FIELD_CAPTCHA_DESC"
|
||||
default=""
|
||||
folder="captcha"
|
||||
filter="cmd"
|
||||
>
|
||||
<option value="">JOPTION_USE_DEFAULT</option>
|
||||
<option value="0">JOPTION_DO_NOT_USE</option>
|
||||
</field>
|
||||
|
||||
<field name="target" type="list"
|
||||
default="0"
|
||||
description="COM_WEBLINKS_FIELD_TARGET_DESC"
|
||||
|
@ -21,6 +21,8 @@ COM_WEBLINKS_ERROR_UNIQUE_ALIAS="Another web link from this category has the sam
|
||||
COM_WEBLINKS_FIELD_ALIAS_DESC="The alias is for internal use only. Leave this blank and Joomla will fill in a default value from the title. It has to be unique for each web link in the same category."
|
||||
COM_WEBLINKS_FIELD_CATEGORY_DESC="Choose a category for this Web link."
|
||||
COM_WEBLINKS_FIELD_CATEGORYCHOOSE_DESC="Please choose a Web Links category to display."
|
||||
COM_WEBLINKS_FIELD_CAPTCHA_DESC="Select the captcha plugin that will be used in the web link submit form. You may need to enter required information for your captcha plugin in the Plugin Manager.<br />If 'Use Default' is selected, make sure a captcha plugin is selected in Global Configuration."
|
||||
COM_WEBLINKS_FIELD_CAPTCHA_LABEL="Allow Captcha on Web Link"
|
||||
COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_DESC="Show/Hide the number of Web Links in each Category."
|
||||
COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL="# Web Links"
|
||||
COM_WEBLINKS_FIELD_CONFIG_COUNTCLICKS_DESC="If set to yes, the number of times the link has been clicked will be recorded."
|
||||
|
@ -227,11 +227,21 @@ class WeblinksControllerWeblink extends JControllerForm
|
||||
*/
|
||||
public function save($key = null, $urlVar = 'w_id')
|
||||
{
|
||||
// Get the application
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Get the data from POST
|
||||
$data = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// Save the data in the session.
|
||||
$app->setUserState('com_weblinks.edit.weblink.data', $data);
|
||||
$result = parent::save($key, $urlVar);
|
||||
|
||||
// If ok, redirect to the return page.
|
||||
if ($result)
|
||||
{
|
||||
// Flush the data from the session
|
||||
$app->setUserState('com_weblinks.edit.weblink.data', null);
|
||||
$this->setRedirect($this->getReturnPage());
|
||||
}
|
||||
|
||||
|
@ -89,6 +89,15 @@
|
||||
size="45"
|
||||
labelclass="control-label" />
|
||||
|
||||
<field
|
||||
name="captcha"
|
||||
type="captcha"
|
||||
label="COM_WEBLINKS_CAPTCHA_LABEL"
|
||||
description="COM_WEBLINKS_CAPTCHA_DESC"
|
||||
validate="captcha"
|
||||
namespace="weblink"
|
||||
/>
|
||||
|
||||
</fieldset>
|
||||
<fields name="metadata">
|
||||
<fieldset name="jmetadata"
|
||||
|
@ -14,6 +14,18 @@ JHtml::_('behavior.formvalidation');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
JHtml::_('behavior.modal', 'a.modal_jform_contenthistory');
|
||||
|
||||
$captchaEnabled = false;
|
||||
$captchaSet = $this->params->get('captcha', JFactory::getApplication()->get('captcha', '0'));
|
||||
|
||||
foreach (JPluginHelper::getPlugin('captcha') as $plugin)
|
||||
{
|
||||
if ($captchaSet === $plugin->name)
|
||||
{
|
||||
$captchaEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Create shortcut to parameters.
|
||||
$params = $this->state->get('params');
|
||||
?>
|
||||
@ -35,6 +47,31 @@ $params = $this->state->get('params');
|
||||
</h1>
|
||||
<?php endif; ?>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_weblinks&view=form&w_id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="adminForm" class="form-validate form-vertical">
|
||||
|
||||
<?php echo $this->form->renderField('title'); ?>
|
||||
<?php echo $this->form->renderField('alias'); ?>
|
||||
<?php echo $this->form->renderField('catid'); ?>
|
||||
<?php echo $this->form->renderField('url'); ?>
|
||||
<?php echo $this->form->renderField('tags'); ?>
|
||||
|
||||
<?php if ($params->get('save_history', 0)) : ?>
|
||||
<?php echo $this->form->renderField('version_note'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->user->authorise('core.edit.state', 'com_weblinks.weblink')) : ?>
|
||||
<?php echo $this->form->renderField('state'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $this->form->renderField('language'); ?>
|
||||
<?php echo $this->form->renderField('description'); ?>
|
||||
|
||||
<hr class="hr-condensed" />
|
||||
|
||||
<?php if ($captchaEnabled) : ?>
|
||||
<div class="btn-group">
|
||||
<?php echo $this->form->renderField('captcha'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="btn-toolbar">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" onclick="Joomla.submitbutton('weblink.save')">
|
||||
@ -53,23 +90,6 @@ $params = $this->state->get('params');
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<hr class="hr-condensed" />
|
||||
<?php echo $this->form->renderField('title'); ?>
|
||||
<?php echo $this->form->renderField('alias'); ?>
|
||||
<?php echo $this->form->renderField('catid'); ?>
|
||||
<?php echo $this->form->renderField('url'); ?>
|
||||
<?php echo $this->form->renderField('tags'); ?>
|
||||
|
||||
<?php if ($params->get('save_history', 0)) : ?>
|
||||
<?php echo $this->form->renderField('version_note'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->user->authorise('core.edit.state', 'com_weblinks.weblink')) : ?>
|
||||
<?php echo $this->form->renderField('state'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $this->form->renderField('language'); ?>
|
||||
<?php echo $this->form->renderField('description'); ?>
|
||||
|
||||
<input type="hidden" name="return" value="<?php echo $this->return_page;?>" />
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
|
@ -34,6 +34,8 @@ class WeblinksViewForm extends JViewLegacy
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
// Get the application
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Get model data.
|
||||
$this->state = $this->get('State');
|
||||
@ -59,6 +61,12 @@ class WeblinksViewForm extends JViewLegacy
|
||||
|
||||
if (!empty($this->item))
|
||||
{
|
||||
// Override the base weblink data with any data in the session.
|
||||
$temp = (array) $app->getUserState('com_weblinks.edit.weblink.data', array());
|
||||
foreach ($temp as $k => $v)
|
||||
{
|
||||
$this->item->$k = $v;
|
||||
}
|
||||
$this->form->bind($this->item);
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
|
||||
; Note : All ini files need to be saved as UTF-8 - No BOM
|
||||
|
||||
COM_WEBLINKS_CAPTCHA_LABEL="Captcha"
|
||||
COM_WEBLINKS_CAPTCHA_DESC="Please complete the security check."
|
||||
COM_WEBLINKS_CONTENT_TYPE_WEBLINK="Web Link"
|
||||
COM_WEBLINKS_CONTENT_TYPE_CATEGORY="Web Links Category"
|
||||
COM_WEBLINKS_DEFAULT_PAGE_TITLE="Web Links"
|
||||
|
Loading…
x
Reference in New Issue
Block a user