From 8fe9748e29d2efa9e4bf240415deac9707bf4b1c Mon Sep 17 00:00:00 2001 From: wilsonge Date: Wed, 15 Oct 2014 01:41:22 +0100 Subject: [PATCH 01/71] AJAX retrieval of posts take 2 --- mod_shoutbox/helper.php | 188 ++++++++++++++++++++++++++ mod_shoutbox/media/js/mod_shoutbox.js | 76 ++++++++++- mod_shoutbox/mod_shoutbox.php | 48 +------ mod_shoutbox/tmpl/default.php | 21 +++ 4 files changed, 288 insertions(+), 45 deletions(-) diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php index 53efb16..722ec12 100644 --- a/mod_shoutbox/helper.php +++ b/mod_shoutbox/helper.php @@ -16,6 +16,32 @@ */ class ModShoutboxHelper { + /** + * @var boolean Is the post being submitted by AJAX + * @since __DEPLOY_VERSION__ + */ + private static $ajax = false; + + /** + * Fetches the parameters of the shoutbox independently of the view + * so it can be used for the AJAX + * + * @param string $title The title of the module to retrieve + * + * @return JRegistry The parameters of the module + * + * @since __DEPLOY_VERSION__ + */ + public static function getParams($title = null) + { + jimport('joomla.application.module.helper'); + $module = JModuleHelper::getModule('mod_shoutbox', $title); + $moduleParams = new JRegistry; + $moduleParams->loadString($module->params); + + return $moduleParams; + } + /** * Retrieves the shouts from the database and returns them. Will return an error * message if the database retrieval fails. @@ -521,6 +547,168 @@ public static function randomnumber($digits) return (rand() % $range + $start); } + /** + * Method for submitting the post. Note AJAX suffix so it can take advantage of com_ajax + * + * @param string $instance The instance of the module. + * + * @return array The details of the post created. + * + * @throws RuntimeException + */ + public static function submitAjax($instance = 'mod_shoutbox') + { + static::$ajax = true; + + if (!get_magic_quotes_gpc()) + { + $app = JFactory::getApplication(); + $post = $app->input->post->get('jjshoutbox', array(), 'array'); + } + else + { + $post = JRequest::getVar('jjshoutbox', array(), 'post', 'array'); + } + + // Retrieve relevant parameters + if (!isset($post['title'])) + { + throw new RuntimeException("Couldn't assemble the necessary parameters for the module"); + } + + $instance = $post['title']; + $params = static::getParams($instance); + + // Make sure someone pressed shout and the post message isn't empty + if (isset($post['shout'])) + { + if (empty($post['message'])) + { + throw new RuntimeException ('The message body is empty'); + } + + return static::submitPost($post, $params); + } + + throw new RuntimeException ('There was an error processing the form. Please try again!'); + } + + /** + * Wrapper function for submitPost to allow PHP to submit a post + * + * @param JInput $post The filtered post superglobal. + * @param JRegistry $post The parameters for the module. + * + * @return mixed True on success, false on failure. + * + * @since __DEPLOY_VERSION__ + */ + public static function submitPhp($post, $params) + { + return static::submitPost($post, $params); + } + + /** + * Method for submitting the post + * + * @param JInput $post The filtered post superglobal. + * @param JRegistry $post The parameters for the module. + * + * @return mixed True on success outside of AJAX mode, false on failure. Integer on success when accessed via AJAX. + * + * @since __DEPLOY_VERSION__ + */ + private static function submitPost($post, $params) + { + // Get the user instance + $user = JFactory::getUser(); + $displayName = $params->get('loginname'); + $recaptcha = $params->get('recaptchaon', 1); + $swearCounter = $params->get('swearingcounter'); + $swearNumber = $params->get('swearingnumber'); + $securityQuestion = $params->get('securityquestion'); + + // If we submitted by PHP check for a session token + if (static::$ajax || $_SESSION['token'] == $post['token']) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + if ($recaptcha == 0) + { + // Recaptcha fields aren't in the JJ post space so we have to grab these separately + $input = JFactory::getApplication()->input; + $challengeField = $input->get('recaptcha_challenge_field', '', 'string'); + $responseField = $input->get('recaptcha_response_field', '', 'string'); + + // Check we have a valid response field + if (!isset($responseField) || isset($responseField) && $responseField) + { + return false; + } + + // Require Recaptcha Library + require_once JPATH_ROOT . '/media/mod_shoutbox/recaptcha/recaptchalib.php'; + + $resp = recaptcha_check_answer( + $params->get('recaptcha-private'), + $_SERVER["REMOTE_ADDR"], + $challengeField, + $responseField + ); + + if ($resp->is_valid) + { + $result = static::addShout($post, $user, $swearCounter, $swearNumber, $displayName); + + return $result; + } + else + { + return array('error' => $resp->error); + } + } + elseif ($securityQuestion == 0) + { + // Our maths security question is on + if (isset($post['sum1']) && isset($post['sum2'])) + { + $que_result = $post['sum1'] + $post['sum2']; + + if (isset($post['human'])) + { + if ($post['human'] == $que_result) + { + $result = static::addShout($post, $user, $swearCounter, $swearNumber, $displayName); + + return $result; + } + else + { + $errorMessage = JText::_('SHOUT_ANSWER_INCORRECT'); + + if (static::$ajax) + { + return array('error' => $errorMessage); + } + else + { + JFactory::getApplication()->enqueueMessage($errorMessage, 'error'); + } + + return false; + } + } + } + } + else + { + $result = static::addShout($post, $user, $swearCounter, $swearNumber, $displayName); + + return $result; + } + } + } + private static function createErrorMsg() { $i = 0; diff --git a/mod_shoutbox/media/js/mod_shoutbox.js b/mod_shoutbox/media/js/mod_shoutbox.js index 95b6ea3..4a797a4 100644 --- a/mod_shoutbox/media/js/mod_shoutbox.js +++ b/mod_shoutbox/media/js/mod_shoutbox.js @@ -42,4 +42,78 @@ function getCurserPosition(id){ pos = el.selectionStart; return pos; -} \ No newline at end of file +} + +function submitPost(name, title, recaptcha, maths, security, root) +{ + (function ($) { + // Assemble some commonly used vars + var textarea = $("textarea#jj_message"), + message = textarea.val(); + + // If no message body show an error message and stop + if(message == ""){ + $('.jj-shout-error').append('

Please enter a message!

').slideDown().show().delay(6000).queue(function(next){ + $(this).slideUp().hide(); + $('.inner-jj-error').remove(); + next(); + }); + var $elt = $('#shoutbox-submit').attr('disabled', true); + setTimeout(function (){ + $elt.attr('disabled', false); + }, 6000); + textarea.addClass('jj-redBorder').delay(6000).queue(function(next){ + $(this).removeClass('jj-redBorder'); + next(); + }); + return false; + } + + // Assemble variables to submit + var request = { + 'jjshoutbox[name]' : name, + 'jjshoutbox[message]' : message.replace(/\n/g, "
"), + 'jjshoutbox[shout]' : 'Shout!', + 'jjshoutbox[title]' : title, + }; + + request[security] = 1; + + if (recaptcha) + { + request["jjshoutbox[recaptcha_challenge_field]"] = $("input#recaptcha_challenge_field").val(); + request["jjshoutbox[recaptcha_response_field]"] = $("input#recaptcha_response_field").val(); + } + + // AJAX request + $.ajax({ + type: "POST", + url: root + "?option=com_ajax&module=shoutbox&method=submit&format=json", + data: request, + success:function(response){ + if (response.success) + { + // Empty the message value + textarea.val(''); + + // Empty the name value if there is one + if ($('#shoutbox-name').val()) + { + $('#shoutbox-name').val(''); + } + } + }, + error:function(ts){ + console.log(ts); + } + }); + + // Valid or not refresh recaptcha + if (recaptcha) + { + Recaptcha.reload(); + } + + return false; + }(jQuery)); +} diff --git a/mod_shoutbox/mod_shoutbox.php b/mod_shoutbox/mod_shoutbox.php index a012454..6483812 100644 --- a/mod_shoutbox/mod_shoutbox.php +++ b/mod_shoutbox/mod_shoutbox.php @@ -104,54 +104,14 @@ $post = JRequest::getVar('jjshout', array(), 'post', 'array'); } - if (isset($post['shout']) && !empty($post['message']) && $_SESSION['token'] == $post['token']) + if (isset($post['shout'])) { - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); - - if ($params->get('recaptchaon') == 0) + if (!empty($post['message'])) { - require_once JPATH_ROOT . '/media/mod_shoutbox/recaptcha/recaptchalib.php'; - - // The recaptcha fields don't have the jjshout namespace so grab them straight from the input - $resp = recaptcha_check_answer( - $params->get('recaptcha-private'), - $_SERVER["REMOTE_ADDR"], - $app->input->get('recaptcha_challenge_field', '', 'string'), - $app->input->get('recaptcha_response_field', '', 'string') - ); - - if ($resp->is_valid) - { - ModShoutboxHelper::postFiltering($post, $user, $swearcounter, $swearnumber, $displayName); - } - else - { - $error = $resp->error; - } + JFactory::getApplication()->enqueueMessage('The message body is empty', 'error'); } - elseif ($securityquestion == 0) - { - if (isset($post['sum1']) && isset($post['sum2'])) - { - $que_result = $post['sum1'] + $post['sum2']; - if (isset($post['human'])) - { - if ($post['human'] == $que_result) - { - ModShoutboxHelper::postFiltering($post, $user, $swearcounter, $swearnumber, $displayName); - } - else - { - JFactory::getApplication()->enqueueMessage(JText::_('SHOUT_ANSWER_INCORRECT'), 'error'); - } - } - } - } - else - { - ModShoutboxHelper::postFiltering($post, $user, $swearcounter, $swearnumber, $displayName); - } + ModShoutboxHelper::submitPhp($post, $params); } if (isset($post['delete'])) diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 2bb5206..1f0ded0 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -289,3 +289,24 @@ function textCounter(textarea, countdown, maxlimit) { ?> + From 80266fedade923429ccf5a2fab9e897afd8f946d Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sun, 26 Oct 2014 19:22:13 +0000 Subject: [PATCH 02/71] Add generic name param. Fix removal of all filtering --- mod_shoutbox/helper.php | 33 ++++++++++++++++++--------------- mod_shoutbox/mod_shoutbox.php | 11 ++++++----- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php index 27fa10d..d280198 100644 --- a/mod_shoutbox/helper.php +++ b/mod_shoutbox/helper.php @@ -133,17 +133,18 @@ public static function shouttitle($user, $ip) /** * Filters the posts before calling the add function. * - * @param int $shout The shout post. - * @param JUser $user The user id number. - * @param boolean $swearCounter Is the swear counter is on. - * @param int $swearNumber If the swear counter is on - how many swears are allowed. - * @param int $displayName The user display name. + * @param int $shout The shout post. + * @param JUser $user The user id number. + * @param boolean $swearCounter Is the swear counter is on. + * @param int $swearNumber If the swear counter is on - how many swears are allowed. + * @param int $displayName The user display name. + * @param JRegistry $params The parameters for the module * * @return void * * @since 1.1.2 */ - public static function postFiltering($shout, $user, $swearCounter, $swearNumber, $displayName) + public static function postFiltering($shout, $user, $swearCounter, $swearNumber, $displayName, $params) { $replace = '****'; @@ -159,12 +160,6 @@ public static function postFiltering($shout, $user, $swearCounter, $swearNumber, } else { - // Name is a required field. So return if the field is empty - if (empty($shout['name'])) - { - return; - } - if ($swearCounter == 0) { $before = substr_count($shout['name'], $replace); @@ -172,6 +167,14 @@ public static function postFiltering($shout, $user, $swearCounter, $swearNumber, $name = self::swearfilter($shout['name'], $replace); + if ($name == '') + { + // Retrieve Generic Name parameters + $params = static::getParams(); + $genericName = $params->get('genericname'); + $name = $genericName; + } + if ($swearCounter == 0) { $after = substr_count($name, $replace); @@ -659,7 +662,7 @@ private static function submitPost($post, $params) if ($resp->is_valid) { - $result = static::addShout($post, $user, $swearCounter, $swearNumber, $displayName); + $result = static::postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $params) return $result; } @@ -679,7 +682,7 @@ private static function submitPost($post, $params) { if ($post['human'] == $que_result) { - $result = static::addShout($post, $user, $swearCounter, $swearNumber, $displayName); + $result = static::postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $params) return $result; } @@ -703,7 +706,7 @@ private static function submitPost($post, $params) } else { - $result = static::addShout($post, $user, $swearCounter, $swearNumber, $displayName); + $result = static::postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $params) return $result; } diff --git a/mod_shoutbox/mod_shoutbox.php b/mod_shoutbox/mod_shoutbox.php index 03edd9c..0f0e391 100644 --- a/mod_shoutbox/mod_shoutbox.php +++ b/mod_shoutbox/mod_shoutbox.php @@ -12,14 +12,14 @@ require_once dirname(__FILE__) . '/helper.php'; $displayName = $params->get('loginname'); -$smile = $params->get('smile'); +$smile = $params->get('smile'); $swearcounter = $params->get('swearingcounter'); $swearnumber = $params->get('swearingnumber'); -$number = $params->get('maximum'); +$number = $params->get('maximum'); $submittext = $params->get('submittext'); $nonmembers = $params->get('nonmembers'); -$profile = $params->get('profile'); -$date = $params->get('date'); +$profile = $params->get('profile'); +$date = $params->get('date'); $securityquestion = $params->get('securityquestion'); $mass_delete = $params->get('mass_delete'); $permissions = $params->get('guestpost'); @@ -27,7 +27,8 @@ $bordercolour = $params->get('bordercolor', '#FF3C16'); $borderwidth = $params->get('borderwidth', '1'); $headercolor = $params->get('headercolor', '#D0D0D0'); -$bbcode = $params->get('bbcode', 0); +$bbcode = $params->get('bbcode', 0); +$genericName = $params->get('genericname'); // Add in jQuery if smilies are required $doc = JFactory::getDocument(); From 52b0f1ef14298a4487053adcf9da9c87afdab873 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sun, 26 Oct 2014 19:24:40 +0000 Subject: [PATCH 03/71] Bugs in previous commit --- mod_shoutbox/helper.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php index d280198..c71848e 100644 --- a/mod_shoutbox/helper.php +++ b/mod_shoutbox/helper.php @@ -170,7 +170,6 @@ public static function postFiltering($shout, $user, $swearCounter, $swearNumber, if ($name == '') { // Retrieve Generic Name parameters - $params = static::getParams(); $genericName = $params->get('genericname'); $name = $genericName; } @@ -662,7 +661,7 @@ private static function submitPost($post, $params) if ($resp->is_valid) { - $result = static::postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $params) + $result = static::postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $params); return $result; } @@ -682,7 +681,7 @@ private static function submitPost($post, $params) { if ($post['human'] == $que_result) { - $result = static::postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $params) + $result = static::postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $params); return $result; } @@ -706,7 +705,7 @@ private static function submitPost($post, $params) } else { - $result = static::postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $params) + $result = static::postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $params); return $result; } From 1cb6f36a9b673c60bfe5b836e84c6391d6aacf07 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sun, 26 Oct 2014 19:32:58 +0000 Subject: [PATCH 04/71] Fix remaining PHP errors --- mod_shoutbox/mod_shoutbox.php | 4 +++- mod_shoutbox/tmpl/default.php | 10 +++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mod_shoutbox/mod_shoutbox.php b/mod_shoutbox/mod_shoutbox.php index 0f0e391..9b041e5 100644 --- a/mod_shoutbox/mod_shoutbox.php +++ b/mod_shoutbox/mod_shoutbox.php @@ -20,7 +20,8 @@ $nonmembers = $params->get('nonmembers'); $profile = $params->get('profile'); $date = $params->get('date'); -$securityquestion = $params->get('securityquestion'); +$recaptcha = $params->get('recaptchaon', 1); +$securityQuestion = $params->get('securityquestion'); $mass_delete = $params->get('mass_delete'); $permissions = $params->get('guestpost'); $deletecolor = $params->get('deletecolor', '#FF0000'); @@ -29,6 +30,7 @@ $headercolor = $params->get('headercolor', '#D0D0D0'); $bbcode = $params->get('bbcode', 0); $genericName = $params->get('genericname'); +$title = $module->title; // Add in jQuery if smilies are required $doc = JFactory::getDocument(); diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 1f0ded0..2bd29e7 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -210,7 +210,7 @@ function textCounter(textarea, countdown, maxlimit) { get('recaptchaon') == 0) + if ($recaptcha == 0) { require_once JPATH_ROOT . '/media/mod_shoutbox/recaptcha/recaptchalib.php'; @@ -236,7 +236,7 @@ function textCounter(textarea, countdown, maxlimit) { } } - if ($securityquestion == 0) + if ($securityQuestion == 0) { $que_number1 = ModShoutboxHelper::randomnumber(1); $que_number2 = ModShoutboxHelper::randomnumber(1); ?> @@ -247,14 +247,14 @@ function textCounter(textarea, countdown, maxlimit) { get('recaptchaon') == 0 && $securityquestion == 0) + if ($recaptcha == 0 && $securityQuestion == 0) { // Shows warning if both security questions are enabled and logs to error file. JLog::add(JText::_('SHOUT_BOTH_SECURITY_ENABLED'), JLog::CRITICAL, 'mod_shoutbox'); JFactory::getApplication()->enqueueMessage(JText::_('SHOUT_BOTH_SECURITY_ENABLED'), 'error'); } ?> - get('recaptchaon')==0 && !$params->get('recaptcha-public')) || ($params->get('recaptchaon')==0 && !$params->get('recaptcha-private')) || ($params->get('recaptchaon')==0 && $securityquestion==0)) { echo 'disabled="disabled"'; }?> /> + get('recaptcha-public')) || ($recaptcha==0 && !$params->get('recaptcha-private')) || ($recaptcha==0 && $securityQuestion==0)) { echo 'disabled="disabled"'; }?> /> name;?>"; if($('#shoutbox-name').val() == ""){ - var name = ""; + var name = ""; } else{ var name = $('#shoutbox-name').val(); From 334d18f288b1d097cd47815b7c614365e9c0d66b Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sun, 26 Oct 2014 19:57:57 +0000 Subject: [PATCH 05/71] Yucky bugs --- mod_shoutbox/mod_shoutbox.php | 24 +++++++++++------------- mod_shoutbox/tmpl/default.php | 2 +- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/mod_shoutbox/mod_shoutbox.php b/mod_shoutbox/mod_shoutbox.php index 9b041e5..6d059dd 100644 --- a/mod_shoutbox/mod_shoutbox.php +++ b/mod_shoutbox/mod_shoutbox.php @@ -35,24 +35,22 @@ // Add in jQuery if smilies are required $doc = JFactory::getDocument(); -if ($smile == 1 || $smile == 2 || $bbcode == 0) +if (version_compare(JVERSION, '3.0.0', 'ge')) { - if (version_compare(JVERSION, '3.0.0', 'ge')) - { - JHtml::_('jquery.framework'); - } - else + JHtml::_('jquery.framework'); +} +else +{ + if (!JFactory::getApplication()->get('jquery')) { - if (!JFactory::getApplication()->get('jquery')) - { - JFactory::getApplication()->set('jquery', true); - JHtml::_('script', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'); - JHtml::_('script', 'mod_shoutbox/jquery-conflict.js', false, true); - } + JFactory::getApplication()->set('jquery', true); + JHtml::_('script', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'); + JHtml::_('script', 'mod_shoutbox/jquery-conflict.js', false, true); } - JHtml::_('script', 'mod_shoutbox/mod_shoutbox.js', false, true); } +JHtml::_('script', 'mod_shoutbox/mod_shoutbox.js', false, true); + // Set Date Format for when posted if ($date == 0) { diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 2bd29e7..1189a8a 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -305,7 +305,7 @@ function textCounter(textarea, countdown, maxlimit) { } - submitPost(name, '', , , '', ''); + submitPost(name, '', , , '', ''); return false; }); })(jQuery); From 6b98a8418505982f2c6980b120783a6e25649f96 Mon Sep 17 00:00:00 2001 From: George Wilson Date: Sat, 1 Nov 2014 01:39:59 +0000 Subject: [PATCH 06/71] Add wrapper function to getShouts for AJAX --- mod_shoutbox/helper.php | 73 +++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 28 deletions(-) diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php index 97dcd7f..5d20a40 100644 --- a/mod_shoutbox/helper.php +++ b/mod_shoutbox/helper.php @@ -16,18 +16,41 @@ */ class ModShoutboxHelper { + /** + * Wrapper function for when PHP gets the posts + * + * @param int $number The number of posts to retrieve from the database. + * @param string $message The error message to return if the database retrieval fails. + * + * @return array The shoutbox posts. + * + * @since 2.0 + */ + public static function getShoutsPhp($number, $message) + { + try + { + $shouts = $this->getShouts($number); + } + catch (Exception $e) + { + $shouts = self::createErrorMsg($message, $e); + } + + return $shouts; + } + /** * Retrieves the shouts from the database and returns them. Will return an error * message if the database retrieval fails. * * @param int $number The number of posts to retrieve from the database. - * @param string $message The error message to return if the database retrieval fails. * * @return array The shoutbox posts. * * @since 1.0 */ - public static function getShouts($number, $message) + private static function getShouts($number) { $shouts = array(); $db = JFactory::getDbo(); @@ -39,29 +62,17 @@ public static function getShouts($number, $message) if (!JError::$legacy) { - try - { - // Execute the query. - $rows = $db->loadObjectList(); - } - catch (Exception $e) - { - // Assemble Message and add log. - $shouts = self::createErrorMsg(); - - return $shouts; - } + // If we have an exception then we'll let it propogate up the chain + $rows = $db->loadObjectList(); } else { $rows = $db->loadObjectList(); + // If we have an error with JError then we'll create an exception ourselves if ($db->getErrorNum()) { - // Assemble Message and add log. - $shouts = self::createErrorMsg(); - - return $shouts; + throw new RuntimeException($db->getErrorMsg(), $db->getErrorNum()) } } @@ -522,20 +533,26 @@ public static function randomnumber($digits) return (rand() % $range + $start); } - private static function createErrorMsg() + /** + * Creates the error message to display to the user + * + * @param string $message The translated string to show to the user + * @param Exception $e The database exception when trying to retrieve the posts + * + * @return array An array + */ + private static function createErrorMsg($message, $e) { - $i = 0; - // Output error to shoutbox. - $shouts[$i] = new stdClass; - $shouts[$i]->name = 'Administrator'; - $shouts[$i]->when = JFactory::getDate()->format('Y-m-d H:i:s'); - $shouts[$i]->msg = $message; - $shouts[$i]->ip = 'System'; - $shouts[$i]->user_id = 0; + $shouts[0] = new stdClass; + $shouts[0]->name = 'Administrator'; + $shouts[0]->when = JFactory::getDate()->format('Y-m-d H:i:s'); + $shouts[0]->msg = $message; + $shouts[0]->ip = 'System'; + $shouts[0]->user_id = 0; // Add error to log. - JLog::add(JText::sprintf('SHOUT_DATABASE_ERROR', $e), JLog::CRITICAL, 'mod_shoutbox'); + JLog::add(JText::sprintf('SHOUT_DATABASE_ERROR', $e->getMessage()), JLog::CRITICAL, 'mod_shoutbox'); return $shouts; } From 4b327f5ce0a7e35091b39d3d6072c5c149531324 Mon Sep 17 00:00:00 2001 From: George Wilson Date: Sat, 1 Nov 2014 01:40:19 +0000 Subject: [PATCH 07/71] Use new getShoutsPhp --- mod_shoutbox/tmpl/default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 2bb5206..b0989ec 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -41,7 +41,7 @@ $shouts = array(); // Retrieves the shouts from the database - $shouts = ModShoutboxHelper::getShouts($number, $dataerror); + $shouts = ModShoutboxHelper::getShoutsPhp($number, $dataerror); $i = 0; // Counts the number of shouts retrieved from the database From 982a6fc104567217103d8e5c5120d87f5be49f43 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sat, 1 Nov 2014 01:54:33 +0000 Subject: [PATCH 08/71] Missed some conflicts merging in development --- mod_shoutbox/helper.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php index c56a4d0..a3be0d7 100644 --- a/mod_shoutbox/helper.php +++ b/mod_shoutbox/helper.php @@ -17,7 +17,6 @@ class ModShoutboxHelper { /** -<<<<<<< HEAD * @var boolean Is the post being submitted by AJAX * @since __DEPLOY_VERSION__ */ @@ -53,7 +52,6 @@ public static function getParams($title = null) * * @since 2.0 */ - public static function getShouts($number, $message) { try @@ -564,8 +562,6 @@ public static function randomnumber($digits) } /** -<<<<<<< HEAD -<<<<<<< HEAD * Method for submitting the post. Note AJAX suffix so it can take advantage of com_ajax * * @param string $instance The instance of the module. From c08058e17c792378d9af0c9aa67a32a909cf40e5 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sat, 1 Nov 2014 02:06:38 +0000 Subject: [PATCH 09/71] Add in the PHP for getting the shouts --- mod_shoutbox/helper.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php index a3be0d7..be3c3c4 100644 --- a/mod_shoutbox/helper.php +++ b/mod_shoutbox/helper.php @@ -66,6 +66,41 @@ public static function getShouts($number, $message) return $shouts; } + /* + * Wrapper function for getting the shouts in AJAX + * + * @param int $number The number of posts to retrieve from the database. + * @param string $message The error message to return if the database retrieval fails. + * + * @return array The shoutbox posts. + * + * @since 2.0 + */ + public static function getShoutsAjax() + { + // Get the number of posts from the "get" Request + if (!get_magic_quotes_gpc()) + { + $app = JFactory::getApplication(); + $request = $app->input->get->get('jjshoutbox', array(), 'array'); + } + else + { + $request = JRequest::getVar('jjshoutbox', array(), 'get', 'array'); + } + + $instance = $request['title']; + $params = static::getParams($instance); + + // The number of posts comes from the params for the module. + $number = $params->get('maximum'); + + // Get the shouts and let any exceptions propagate into com_ajax + $shouts = self::getShoutData($number); + + return $shouts; + } + /** * Retrieves the shouts from the database and returns them. Will return an error * message if the database retrieval fails. From 6f88ed25afb109d56ed7e99f461a36c2342b8180 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sat, 1 Nov 2014 02:09:08 +0000 Subject: [PATCH 10/71] Spaces -> tabs indenting --- mod_shoutbox/helper.php | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php index be3c3c4..6c01a18 100644 --- a/mod_shoutbox/helper.php +++ b/mod_shoutbox/helper.php @@ -42,7 +42,7 @@ public static function getParams($title = null) return $moduleParams; } - /* + /* * Wrapper function for getting the shouts in PHP * * @param int $number The number of posts to retrieve from the database. @@ -78,28 +78,28 @@ public static function getShouts($number, $message) */ public static function getShoutsAjax() { - // Get the number of posts from the "get" Request - if (!get_magic_quotes_gpc()) - { - $app = JFactory::getApplication(); - $request = $app->input->get->get('jjshoutbox', array(), 'array'); - } - else - { - $request = JRequest::getVar('jjshoutbox', array(), 'get', 'array'); - } + // Get the number of posts from the "get" Request + if (!get_magic_quotes_gpc()) + { + $app = JFactory::getApplication(); + $request = $app->input->get->get('jjshoutbox', array(), 'array'); + } + else + { + $request = JRequest::getVar('jjshoutbox', array(), 'get', 'array'); + } - $instance = $request['title']; - $params = static::getParams($instance); + $instance = $request['title']; + $params = static::getParams($instance); - // The number of posts comes from the params for the module. - $number = $params->get('maximum'); + // The number of posts comes from the params for the module. + $number = $params->get('maximum'); - // Get the shouts and let any exceptions propagate into com_ajax - $shouts = self::getShoutData($number); + // Get the shouts and let any exceptions propagate into com_ajax + $shouts = self::getShoutData($number); - return $shouts; - } + return $shouts; + } /** * Retrieves the shouts from the database and returns them. Will return an error @@ -758,7 +758,7 @@ private static function submitPost($post, $params) } } - /* + /* * Creates the error message to display to the user * * @param string $message The translated string to show to the user From 88048216c40c2a7c892dfd24dbc13117bdea7f45 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sat, 1 Nov 2014 02:13:19 +0000 Subject: [PATCH 11/71] Make a start on the ajax request --- mod_shoutbox/media/js/mod_shoutbox.js | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/mod_shoutbox/media/js/mod_shoutbox.js b/mod_shoutbox/media/js/mod_shoutbox.js index 4a797a4..6c440c5 100644 --- a/mod_shoutbox/media/js/mod_shoutbox.js +++ b/mod_shoutbox/media/js/mod_shoutbox.js @@ -117,3 +117,31 @@ function submitPost(name, title, recaptcha, maths, security, root) return false; }(jQuery)); } + +function getPost(title) +{ + (function ($) { + var request = { + 'jjshoutbox[title]' : title + }; + + // AJAX request + $.ajax({ + type: "GET", + url: root + "?option=com_ajax&module=shoutbox&method=getShouts&format=json", + data: request, + success:function(response) + { + if (response.success) + { + // Wipe the existing posts and then add in the latest ones in the response.data property + } + }, + error:function(ts){ + console.log(ts); + } + }); + + return false; + }(jQuery)); +} From 521d8d1a8adb5ab5a1ba8d8c76710c231a3e6b0f Mon Sep 17 00:00:00 2001 From: Lodder Date: Sat, 1 Nov 2014 10:44:02 +0000 Subject: [PATCH 12/71] single quotes, removed global vars, cleanup --- mod_shoutbox/media/js/mod_shoutbox.js | 35 +++++++++++++++------------ 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/mod_shoutbox/media/js/mod_shoutbox.js b/mod_shoutbox/media/js/mod_shoutbox.js index 6c440c5..eac6ade 100644 --- a/mod_shoutbox/media/js/mod_shoutbox.js +++ b/mod_shoutbox/media/js/mod_shoutbox.js @@ -9,7 +9,7 @@ function addSmiley(smiley, id) // If we are not passed an id, use the default 'jj_message'. if (!id) { - id = 'jj_message'; + var id = 'jj_message'; } // Get the position of the user in the text area @@ -26,12 +26,14 @@ function addSmiley(smiley, id) el.value = strBegin + " " + smiley + " " + strEnd; } -function getCurserPosition(id){ +function getCurserPosition(id) +{ var el = document.getElementById(id); var pos = 0; // IE Support - if (document.selection){ - el.focus (); + if (document.selection) + { + el.focus(); var Sel = document.selection.createRange(); var SelLength = document.selection.createRange().text.length; Sel.moveStart ('character', -el.value.length); @@ -39,8 +41,9 @@ function getCurserPosition(id){ } // Firefox support else if (el.selectionStart || el.selectionStart == '0') + { pos = el.selectionStart; - + } return pos; } @@ -48,11 +51,12 @@ function submitPost(name, title, recaptcha, maths, security, root) { (function ($) { // Assemble some commonly used vars - var textarea = $("textarea#jj_message"), - message = textarea.val(); + var textarea = $('#jj_message'), + var message = textarea.val(); // If no message body show an error message and stop - if(message == ""){ + if(message == "") + { $('.jj-shout-error').append('

Please enter a message!

').slideDown().show().delay(6000).queue(function(next){ $(this).slideUp().hide(); $('.inner-jj-error').remove(); @@ -81,14 +85,14 @@ function submitPost(name, title, recaptcha, maths, security, root) if (recaptcha) { - request["jjshoutbox[recaptcha_challenge_field]"] = $("input#recaptcha_challenge_field").val(); - request["jjshoutbox[recaptcha_response_field]"] = $("input#recaptcha_response_field").val(); + request['jjshoutbox[recaptcha_challenge_field]'] = $('input#recaptcha_challenge_field').val(); + request['jjshoutbox[recaptcha_response_field]'] = $('input#recaptcha_response_field').val(); } // AJAX request $.ajax({ - type: "POST", - url: root + "?option=com_ajax&module=shoutbox&method=submit&format=json", + type: 'POST', + url: root + '?option=com_ajax&module=shoutbox&method=submit&format=json', data: request, success:function(response){ if (response.success) @@ -127,8 +131,8 @@ function getPost(title) // AJAX request $.ajax({ - type: "GET", - url: root + "?option=com_ajax&module=shoutbox&method=getShouts&format=json", + type: 'GET', + url: root + '?option=com_ajax&module=shoutbox&method=getShouts&format=json', data: request, success:function(response) { @@ -137,7 +141,8 @@ function getPost(title) // Wipe the existing posts and then add in the latest ones in the response.data property } }, - error:function(ts){ + error:function(ts) + { console.log(ts); } }); From 2e1e47a9fd032cd7895460eda88b266a485cd88f Mon Sep 17 00:00:00 2001 From: George Wilson Date: Mon, 15 Dec 2014 09:11:27 +0000 Subject: [PATCH 13/71] Let there be full ajax --- mod_shoutbox/helper.php | 574 ++++++++++++++++++-------- mod_shoutbox/media/js/mod_shoutbox.js | 77 ++-- mod_shoutbox/mod_shoutbox.php | 49 +-- mod_shoutbox/tmpl/default.php | 179 +++----- mod_shoutbox/tmpl/default_message.php | 24 ++ 5 files changed, 527 insertions(+), 376 deletions(-) create mode 100644 mod_shoutbox/tmpl/default_message.php diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php index 6c01a18..fa2a7cb 100644 --- a/mod_shoutbox/helper.php +++ b/mod_shoutbox/helper.php @@ -20,7 +20,147 @@ class ModShoutboxHelper * @var boolean Is the post being submitted by AJAX * @since __DEPLOY_VERSION__ */ - private static $ajax = false; + public $ajax = false; + + /** + * @var JRegistry The parameters for the module. + * @since __DEPLOY_VERSION__ + */ + private $params = null; + + /** + * @var array The available smilies and their paths + * @since 1.2.0 + */ + public $smileys = array( + ':)' => 'media/mod_shoutbox/images/icon_e_smile.gif', + ':(' => 'media/mod_shoutbox/images/icon_e_sad.gif', + ':D' => 'media/mod_shoutbox/images/icon_e_biggrin.gif', + 'xD' => 'media/mod_shoutbox/images/icon_e_biggrin.gif', + ':p' => 'media/mod_shoutbox/images/icon_razz.gif', + ':P' => 'media/mod_shoutbox/images/icon_razz.gif', + ';)' => 'media/mod_shoutbox/images/icon_e_wink.gif', + ':S' => 'media/mod_shoutbox/images/icon_e_confused.gif', + ':@' => 'media/mod_shoutbox/images/icon_mad.gif', + ':O' => 'media/mod_shoutbox/images/icon_e_surprised.gif', + 'lol' => 'media/mod_shoutbox/images/icon_lol.gif', + ); + + /** + * Method for submitting the post. Note AJAX suffix so it can take advantage of com_ajax + * + * @return array The details of the post created. + * + * @since __DEPLOY_VERSION__ + * @throws RuntimeException + */ + public static function submitAjax() + { + if (!get_magic_quotes_gpc()) + { + $app = JFactory::getApplication(); + $post = $app->input->post->get('jjshout', array(), 'array'); + } + else + { + $post = JRequest::getVar('jjshout', array(), 'post', 'array'); + } + + // Retrieve relevant parameters + if (!isset($post['title'])) + { + throw new RuntimeException("Couldn't assemble the necessary parameters for the module"); + } + + $helper = new ModShoutboxHelper($post['title']); + $helper->ajax = true; + + // Make sure someone pressed shout and the post message isn't empty + if (isset($post['shout'])) + { + if (empty($post['message'])) + { + throw new RuntimeException ('The message body is empty'); + } + + $id = $helper->submitPost($post); + $shout = $helper->getAShout($id); + + $htmlOutput = $helper->renderPost($shout); + + // Return the HTML represetation, the id and the message contents + $result = array( + 'html' => $htmlOutput, + 'id' => $id, + 'message' => $shout->msg + ); + + return $result; + } + + throw new RuntimeException ('There was an error processing the form. Please try again!'); + } + + /** + * Method for getting the posts via AJAX. Note AJAX suffix so it can take advantage of com_ajax + * + * @return array The details of the post created. + * + * @since __DEPLOY_VERSION__ + * @throws RuntimeException + */ + public static function getPostsAjax() + { + if (!get_magic_quotes_gpc()) + { + $app = JFactory::getApplication(); + $post = $app->input->post->get('jjshout', array(), 'array'); + } + else + { + $post = JRequest::getVar('jjshout', array(), 'post', 'array'); + } + + // Retrieve required parameter + if (!isset($post['title'])) + { + throw new RuntimeException("Couldn't assemble the necessary parameters for the module"); + } + + $helper = new ModShoutboxHelper($post['title']); + $helper->ajax = true; + + $shouts = $helper->getShouts($helper->getParams()->get('maximum'), JText::_('SHOUT_DATABASEERRORSHOUT')); + + $htmlOutput = ''; + + foreach ($shouts as $shout) + { + $htmlOutput .= $helper->renderPost($shout); + } + + // Return the HTML representation, the id and the message contents + $result = array( + 'html' => $htmlOutput, + ); + + return $result; + + throw new RuntimeException ('There was an error processing the form. Please try again!'); + } + + /** + * Fetches the parameters of the shoutbox independently of the view + * so it can be used for the AJAX + * + * @param string $id The id of the module + * + * @since __DEPLOY_VERSION__ + */ + public function __construct($id) + { + $this->params = $this->getParams($id); + } /** * Fetches the parameters of the shoutbox independently of the view @@ -32,7 +172,7 @@ class ModShoutboxHelper * * @since __DEPLOY_VERSION__ */ - public static function getParams($title = null) + public function getParams($title = null) { jimport('joomla.application.module.helper'); $module = JModuleHelper::getModule('mod_shoutbox', $title); @@ -52,83 +192,92 @@ public static function getParams($title = null) * * @since 2.0 */ - public static function getShouts($number, $message) + public function getShouts($number, $message) { try { - $shouts = self::getShoutData($number); + $shouts = $this->getShoutData($number); } catch (Exception $e) { - $shouts = self::createErrorMsg($message, $e); + $shouts = $this->createErrorMsg($message, $e); } return $shouts; } - /* - * Wrapper function for getting the shouts in AJAX + /** + * Retrieves the shouts from the database and returns them. Will return an error + * message if the database retrieval fails. * * @param int $number The number of posts to retrieve from the database. - * @param string $message The error message to return if the database retrieval fails. * * @return array The shoutbox posts. * - * @since 2.0 + * @since 1.0 */ - public static function getShoutsAjax() + private function getShoutData($number) { - // Get the number of posts from the "get" Request - if (!get_magic_quotes_gpc()) + $db = JFactory::getDbo(); + $query = $db->getQuery(true); + $query->select('*') + ->from($db->quoteName('#__shoutbox')) + ->order($db->quoteName('id') . ' DESC'); + $db->setQuery($query, 0, $number); + + if (!JError::$legacy) { - $app = JFactory::getApplication(); - $request = $app->input->get->get('jjshoutbox', array(), 'array'); + // If we have an exception then we'll let it propagate up the chain + $rows = $db->loadObjectList(); } else { - $request = JRequest::getVar('jjshoutbox', array(), 'get', 'array'); - } - - $instance = $request['title']; - $params = static::getParams($instance); + $rows = $db->loadObjectList(); - // The number of posts comes from the params for the module. - $number = $params->get('maximum'); + // If we have an error with JError then we'll create an exception ourselves + if ($db->getErrorNum()) + { + throw new RuntimeException($db->getErrorMsg(), $db->getErrorNum()); + } + } - // Get the shouts and let any exceptions propagate into com_ajax - $shouts = self::getShoutData($number); + // Ensure the date formatting + foreach ($rows as $row) + { + $row->when = JFactory::getDate($row->when)->format('Y-m-d H:i:s'); + } - return $shouts; + return $rows; } /** * Retrieves the shouts from the database and returns them. Will return an error * message if the database retrieval fails. * - * @param int $number The number of posts to retrieve from the database. + * @param int $id The id of the post to retrieve. * - * @return array The shoutbox posts. + * @return object The shoutbox post. * - * @since 1.0 + * @since __DEPLOY_VERSION__ + * @throws RuntimeException */ - private static function getShoutData($number) + public function getAShout($id) { - $shouts = array(); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('*') - ->from($db->quoteName('#__shoutbox')) - ->order($db->quoteName('id') . ' DESC'); - $db->setQuery($query, 0, $number); + ->from($db->quoteName('#__shoutbox')) + ->where($db->quoteName('id') . ' = ' . $id); + $db->setQuery($query); if (!JError::$legacy) { - // If we have an exception then we'll let it propogate up the chain - $rows = $db->loadObjectList(); + // If we have an exception then we'll let it propagate up the chain + $row = $db->loadObject(); } else { - $rows = $db->loadObjectList(); + $row = $db->loadObject(); // If we have an error with JError then we'll create an exception ourselves if ($db->getErrorNum()) @@ -137,21 +286,10 @@ private static function getShoutData($number) } } - $i = 0; - - foreach ( $rows as $row ) - { - $shouts[$i] = new stdClass; - $shouts[$i]->id = $row->id; - $shouts[$i]->name = $row->name; - $shouts[$i]->when = JFactory::getDate($row->when)->format('Y-m-d H:i:s'); - $shouts[$i]->ip = $row->ip; - $shouts[$i]->msg = $row->msg; - $shouts[$i]->user_id = $row->user_id; - $i++; - } + // Format the when correctly + $row->when = JFactory::getDate($row->when)->format('Y-m-d H:i:s'); - return $shouts; + return $row; } /** @@ -162,15 +300,15 @@ private static function getShoutData($number) * * @return string The title to assign. * - * @since 1.0.1 + * @since 1.0.1 */ - public static function shouttitle($user, $ip) + public function shouttitle($user, $ip) { $title = null; if ($user->authorise('core.delete')) { - $title = 'title="' . $ip . '"'; + $title = ' title="' . $ip . '"'; } return $title; @@ -186,11 +324,11 @@ public static function shouttitle($user, $ip) * @param int $displayName The user display name. * @param JRegistry $params The parameters for the module * - * @return void + * @return integer The id of the inserted post * - * @since 1.1.2 + * @since 1.1.2 */ - public static function postFiltering($shout, $user, $swearCounter, $swearNumber, $displayName, $params) + public function postFiltering($shout, $user, $swearCounter, $swearNumber, $displayName, $params) { $replace = '****'; @@ -211,7 +349,7 @@ public static function postFiltering($shout, $user, $swearCounter, $swearNumber, $before = substr_count($shout['name'], $replace); } - $name = self::swearfilter($shout['name'], $replace); + $name = $this->swearfilter($shout['name'], $replace); if ($name == '') { @@ -236,7 +374,7 @@ public static function postFiltering($shout, $user, $swearCounter, $swearNumber, $before = substr_count($shout['message'], $replace); } - $message = self::swearfilter($shout['message'], $replace); + $message = $this->swearfilter($shout['message'], $replace); if ($swearCounter == 0) { @@ -248,7 +386,7 @@ public static function postFiltering($shout, $user, $swearCounter, $swearNumber, if ($swearCounter == 1 || $swearCounter == 0 && (($nameSwears + $messageSwears) <= $swearNumber)) { - self::addShout($name, $message, $ip); + return $this->addShout($name, $message, $ip); } } @@ -259,11 +397,11 @@ public static function postFiltering($shout, $user, $swearCounter, $swearNumber, * @param string $replace The thing to be replaced in the string. * @param string $string The string to be searched. * - * @return string join( $replace, $parts ) The string with the filtered parts. + * @return string join( $replace, $parts ) The string with the filtered parts. * - * @since 1.0 + * @since 1.0 */ - public static function stri_replace($find, $replace, $string) + private function stri_replace($find, $replace, $string) { $parts = explode(strtolower($find), strtolower($string)); $pos = 0; @@ -276,38 +414,20 @@ public static function stri_replace($find, $replace, $string) return( join($replace, $parts) ); } - - /** - * @var array The available smilies and their paths - * @since 1.2.0 - */ - public static $smileys = array( - ':)' => 'media/mod_shoutbox/images/icon_e_smile.gif', - ':(' => 'media/mod_shoutbox/images/icon_e_sad.gif', - ':D' => 'media/mod_shoutbox/images/icon_e_biggrin.gif', - 'xD' => 'media/mod_shoutbox/images/icon_e_biggrin.gif', - ':p' => 'media/mod_shoutbox/images/icon_razz.gif', - ':P' => 'media/mod_shoutbox/images/icon_razz.gif', - ';)' => 'media/mod_shoutbox/images/icon_e_wink.gif', - ':S' => 'media/mod_shoutbox/images/icon_e_confused.gif', - ':@' => 'media/mod_shoutbox/images/icon_mad.gif', - ':O' => 'media/mod_shoutbox/images/icon_e_surprised.gif', - 'lol' => 'media/mod_shoutbox/images/icon_lol.gif', - ); /** * Replaces all the bbcode in the message. * * @param string $message The message to be searched possibly with bbcode in. * - * @return string The message with the replaced bbcode code in. + * @return string The message with the replaced bbcode code in. * - * @since 1.5.0 + * @since 1.5.0 */ - public static function bbcodeFilter($message) + public function bbcodeFilter($message) { // Replace the smileys - foreach (static::$smileys as $smile => $url) + foreach ($this->smileys as $smile => $url) { $replace = '' . $smile . ''; $message = str_replace($smile, $replace, $message); @@ -338,15 +458,15 @@ public static function bbcodeFilter($message) * * @param string $id The id of the textarea to insert the smiley into * - * @return array $smilies The smiley images html code. + * @return array $smilies The smiley images html code. * - * @since 1.2 + * @since 1.2 */ - public static function smileyShow($id = 'jj_message') + public function smileyShow($id = 'jj_message') { $smilies = ''; - foreach (static::$smileys as $smile => $url) + foreach ($this->smileys as $smile => $url) { $smilies .= '' . $smile . ''; } @@ -360,11 +480,11 @@ public static function smileyShow($id = 'jj_message') * @param string $post The post to be searched. * @param string $replace The thing to be replace the swear words in the string. * - * @return string $post The post with the filtered swear words. + * @return string $post The post with the filtered swear words. * - * @since 1.0 + * @since 1.0 */ - public static function swearfilter($post, $replace) + public function swearfilter($post, $replace) { $myfile = 'modules/mod_shoutbox/swearWords.php'; @@ -388,7 +508,7 @@ public static function swearfilter($post, $replace) foreach ($swearwords as $key => $word ) { - $post = self::stri_replace($word, $replace, $post); + $post = $this->stri_replace($word, $replace, $post); } return $post; @@ -401,11 +521,11 @@ public static function swearfilter($post, $replace) * @param string $name The name of the user from the database. * @param int $user_id The id of the user. * - * @return string $profile_link The user name - with a profile link depending on parameters. + * @return string $profile_link The user name - with a profile link depending on parameters. * - * @since 1.2.0 + * @since 1.2.0 */ - public static function linkUser($profile, $name, $user_id) + public function linkUser($profile, $name, $user_id) { $profile_link = ''; @@ -471,11 +591,11 @@ public static function linkUser($profile, $name, $user_id) * @param string $message The name of the user from the database. * @param string $ip The ip of the user. * - * @return void + * @return integer The id of the inserted row * - * @since 1.0 + * @since 1.0 */ - public static function addShout($name, $message, $ip) + public function addShout($name, $message, $ip) { $db = JFactory::getDbo(); $config = JFactory::getConfig(); @@ -510,6 +630,8 @@ public static function addShout($name, $message, $ip) JLog::add(JText::sprintf('SHOUT_DATABASE_ERROR', $db->getErrorMsg()), JLog::CRITICAL, 'mod_shoutbox'); } } + + return $db->insertid(); } /** @@ -519,9 +641,9 @@ public static function addShout($name, $message, $ip) * * @return void * - * @since 1.0 + * @since 1.0 */ - public static function deletepost($id) + public function deletepost($id) { $db = JFactory::getDBO(); $query = $db->getQuery(true); @@ -547,9 +669,9 @@ public static function deletepost($id) * * @return void * - * @since 1.2.0 + * @since 1.2.0 */ - public static function deleteall($delete) + public function deleteall($delete) { $db = JFactory::getDBO(); $query = $db->getQuery(true); @@ -561,7 +683,7 @@ public static function deleteall($delete) foreach ($rows as $row) { - self::deletepost($row->id); + $this->deletepost($row->id); } } @@ -571,8 +693,10 @@ public static function deleteall($delete) * @param int $digits The number of digits long the number should be. * * @return int Random number with the number of digits specified by the input + * + * @since __DEPLOY_VERSION__ */ - public static function randomnumber($digits) + public function randomnumber($digits) { static $startseed = 0; @@ -597,88 +721,57 @@ public static function randomnumber($digits) } /** - * Method for submitting the post. Note AJAX suffix so it can take advantage of com_ajax + * Wrapper function for submitPost to allow PHP to submit a post * - * @param string $instance The instance of the module. + * @param JInput $post The filtered post superglobal. * - * @return array The details of the post created. + * @return void * - * @throws RuntimeException + * @since __DEPLOY_VERSION__ */ - public static function submitAjax($instance = 'mod_shoutbox') + public function submitPhp($post) { - static::$ajax = true; - - if (!get_magic_quotes_gpc()) - { - $app = JFactory::getApplication(); - $post = $app->input->post->get('jjshoutbox', array(), 'array'); - } - else + if (empty($post['message'])) { - $post = JRequest::getVar('jjshoutbox', array(), 'post', 'array'); + JFactory::getApplication()->enqueueMessage('The message body is empty', 'error'); + + return false; } - // Retrieve relevant parameters - if (!isset($post['title'])) + try { - throw new RuntimeException("Couldn't assemble the necessary parameters for the module"); + $this->submitPost($post); } - - $instance = $post['title']; - $params = static::getParams($instance); - - // Make sure someone pressed shout and the post message isn't empty - if (isset($post['shout'])) + catch (Exception $e) { - if (empty($post['message'])) - { - throw new RuntimeException ('The message body is empty'); - } - - return static::submitPost($post, $params); + JFactory::enqueueMessage($e->getMessage(), 'error'); } - - throw new RuntimeException ('There was an error processing the form. Please try again!'); - } - /** - * Wrapper function for submitPost to allow PHP to submit a post - * - * @param JInput $post The filtered post superglobal. - * @param JRegistry $post The parameters for the module. - * - * @return mixed True on success, false on failure. - * - * @since __DEPLOY_VERSION__ - */ - public static function submitPhp($post, $params) - { - return static::submitPost($post, $params); + return; } /** * Method for submitting the post * * @param JInput $post The filtered post superglobal. - * @param JRegistry $post The parameters for the module. * - * @return mixed True on success outside of AJAX mode, false on failure. Integer on success when accessed via AJAX. + * @return mixed Integer of the post inserted on success, false on failure. * * @since __DEPLOY_VERSION__ + * @throws RuntimeException */ - private static function submitPost($post, $params) + private function submitPost($post) { // Get the user instance $user = JFactory::getUser(); - $displayName = $params->get('loginname'); - $recaptcha = $params->get('recaptchaon', 1); - $swearCounter = $params->get('swearingcounter'); - $swearNumber = $params->get('swearingnumber'); - $securityQuestion = $params->get('securityquestion'); + $displayName = $this->params->get('loginname'); + $recaptcha = $this->params->get('recaptchaon', 1); + $swearCounter = $this->params->get('swearingcounter'); + $swearNumber = $this->params->get('swearingnumber'); + $securityQuestion = $this->params->get('securityquestion'); // If we submitted by PHP check for a session token - if (static::$ajax || $_SESSION['token'] == $post['token']) + if ($this->ajax || $_SESSION['token'] == $post['token']) { JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); @@ -699,7 +792,7 @@ private static function submitPost($post, $params) require_once JPATH_ROOT . '/media/mod_shoutbox/recaptcha/recaptchalib.php'; $resp = recaptcha_check_answer( - $params->get('recaptcha-private'), + $this->params->get('recaptcha-private'), $_SERVER["REMOTE_ADDR"], $challengeField, $responseField @@ -707,9 +800,7 @@ private static function submitPost($post, $params) if ($resp->is_valid) { - $result = static::postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $params); - - return $result; + return $this->postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $this->params); } else { @@ -725,37 +816,152 @@ private static function submitPost($post, $params) if (isset($post['human'])) { - if ($post['human'] == $que_result) + if ($post['human'] != $que_result) { - $result = static::postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $params); - - return $result; - } - else - { - $errorMessage = JText::_('SHOUT_ANSWER_INCORRECT'); - - if (static::$ajax) - { - return array('error' => $errorMessage); - } - else - { - JFactory::getApplication()->enqueueMessage($errorMessage, 'error'); - } - - return false; + throw new RuntimeException(JText::_('SHOUT_ANSWER_INCORRECT')); } + + return $this->postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $this->params); } } } else { - $result = static::postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $params); + return $this->postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $this->params); + } + } + } - return $result; + /** + * Renders the message contents with the special variables + * + * @param string $layout The layout to render for the post (defaults to 'default'). The sub layout will always be message + * + * @return string The rendered post contents + * + * @since __DEPLOY_VERSION__ + */ + public function renderPost($shout, $layout = 'default') + { + $path = JModuleHelper::getLayoutPath('mod_shoutbox', $layout . '_message'); + + // Start capturing output into a buffer + ob_start(); + + // Include the requested template filename in the local scope + // (this will execute the view logic). + include $path; + + // Done with the requested template; get the buffer and + // clear it. + $template = ob_get_contents(); + ob_end_clean(); + + $output = $this->processTemplate($template, $shout); + + return $output; + } + + /** + * Processes the template output and puts in the shout variables + * + * @param string $template The template variables + * @param array $shout The shout to inject into the template + * + * @return string The html for the post with the appropriate shout injected in + * + * @since __DEPLOY_VERSION__ + */ + private function processTemplate($template, $shout) + { + // Get user object + $user = JFactory::getUser(); + $message = $template; + + // Grab the bbcode and smiley params + $smile = $this->params->get('smile'); + $bbcode = $this->params->get('bbcode', 0); + + // Expression to search for in the message template ({{VAR}} + $regex = '/{(.*?)}/'; + + // Find all instances of plugin and put in $matches for loadposition + // $matches[0] is full pattern match, $matches[1] is the variable to replace + preg_match_all($regex, $template, $matches, PREG_SET_ORDER); + + foreach ($matches as $match) + { + switch (strtoupper($match[1])) + { + case 'TITLE': + $title = $this->shouttitle($user, $shout->ip); + $message = str_replace('{' . $match[1] . '}', $title, $message); + + break; + + case 'USER': + $profile_link = $this->linkUser($this->params->get('profile'), $shout->name, $shout->user_id); + + // Check if we need to do smiley or bbcode filtering + if ($smile == 0 || $bbcode == 0) + { + $user = $this->bbcodeFilter($profile_link); + } + else + { + $user = $profile_link; + } + + $message = str_replace('{' . $match[1] . '}', $user, $message); + break; + + case 'DATE': + switch ($this->params->get('date')) + { + case 0: + $show_date = "d/m/Y - "; + break; + case 1: + $show_date = "D m Y - "; + break; + case 3: + $show_date = "m/d/Y - "; + break; + case 4: + $show_date = "D j M - "; + break; + case 5: + $show_date = "D j M - "; + break; + default: + $show_date = ""; + break; + } + + $date = JHtml::date($shout->when, $show_date . 'H:i', true); + $message = str_replace('{' . $match[1] . '}', $date, $message); + break; + + case 'POSTID': + $id = $shout->id; + $message = str_replace('{' . $match[1] . '}', $id, $message); + break; + + case 'MESSAGE': + if ($smile == 0 || $smile == 1 || $smile == 2 || $bbcode == 0) + { + $post = $this->bbcodeFilter($shout->msg); + } + else + { + $post = nl2br($shout->msg); + } + + $message = str_replace('{' . $match[1] . '}', $post, $message); } } + + return $message; } /* @@ -765,8 +971,10 @@ private static function submitPost($post, $params) * @param Exception $e The database exception when trying to retrieve the posts * * @return array An array + * + * @since 2.0 */ - private static function createErrorMsg($message, $e) + private function createErrorMsg($message, $e) { // Output error to shoutbox. $shouts[0] = new stdClass; diff --git a/mod_shoutbox/media/js/mod_shoutbox.js b/mod_shoutbox/media/js/mod_shoutbox.js index b2b0434..7d7ca54 100644 --- a/mod_shoutbox/media/js/mod_shoutbox.js +++ b/mod_shoutbox/media/js/mod_shoutbox.js @@ -62,7 +62,7 @@ function submitPost(name, title, recaptcha, maths, security, root) (function ($) { // Assemble some commonly used vars var textarea = $('#jj_message'), - var message = textarea.val(); + message = textarea.val(); // If no message body show an error message and stop if(message == "") @@ -85,18 +85,18 @@ function submitPost(name, title, recaptcha, maths, security, root) // Assemble variables to submit var request = { - 'jjshoutbox[name]' : name, - 'jjshoutbox[message]' : message.replace(/\n/g, "
"), - 'jjshoutbox[shout]' : 'Shout!', - 'jjshoutbox[title]' : title, + 'jjshout[name]' : name, + 'jjshout[message]' : message.replace(/\n/g, "
"), + 'jjshout[shout]' : 'Shout!', + 'jjshout[title]' : title, }; request[security] = 1; if (recaptcha) { - request['jjshoutbox[recaptcha_challenge_field]'] = $('input#recaptcha_challenge_field').val(); - request['jjshoutbox[recaptcha_response_field]'] = $('input#recaptcha_response_field').val(); + request['jjshout[recaptcha_challenge_field]'] = $('input#recaptcha_challenge_field').val(); + request['jjshout[recaptcha_response_field]'] = $('input#recaptcha_response_field').val(); } // AJAX request @@ -115,6 +115,40 @@ function submitPost(name, title, recaptcha, maths, security, root) { $('#shoutbox-name').val(''); } + + // Refresh the output + getPosts(title, root) + } + }, + error:function(ts){ + console.log(ts); + } + }); + + return false; + }(jQuery)); +} + +function getPosts(title, root) +{ + (function ($) { + // Assemble variables to submit + var request = { + 'jjshout[title]' : title, + }; + + // AJAX request + $.ajax({ + type: 'POST', + url: root + '?option=com_ajax&module=shoutbox&method=getPosts&format=json', + data: request, + success:function(response){ + if (response.success) + { + $('#jjshoutboxoutput').empty().prepend($('
')); + + // Grab the html output and append it to the shoutbox message + $('.jj-shout-error').after(response.data.html); } }, error:function(ts){ @@ -131,32 +165,3 @@ function submitPost(name, title, recaptcha, maths, security, root) return false; }(jQuery)); } - -function getPost(title) -{ - (function ($) { - var request = { - 'jjshoutbox[title]' : title - }; - - // AJAX request - $.ajax({ - type: 'GET', - url: root + '?option=com_ajax&module=shoutbox&method=getShouts&format=json', - data: request, - success:function(response) - { - if (response.success) - { - // Wipe the existing posts and then add in the latest ones in the response.data property - } - }, - error:function(ts) - { - console.log(ts); - } - }); - - return false; - }(jQuery)); -} diff --git a/mod_shoutbox/mod_shoutbox.php b/mod_shoutbox/mod_shoutbox.php index 0df1f07..94fec1e 100644 --- a/mod_shoutbox/mod_shoutbox.php +++ b/mod_shoutbox/mod_shoutbox.php @@ -11,6 +11,10 @@ require_once dirname(__FILE__) . '/helper.php'; +$title = $module->title; +$helper = new ModShoutboxHelper($title); +$params = $helper->getParams(); + $displayName = $params->get('loginname'); $smile = $params->get('smile'); $swearcounter = $params->get('swearingcounter'); @@ -30,7 +34,13 @@ $headercolor = $params->get('headercolor', '#D0D0D0'); $bbcode = $params->get('bbcode', 0); $genericName = $params->get('genericname'); -$title = $module->title; + +// Shows warning if both security questions are enabled and logs to error file. +if ($recaptcha == 0 && $securityQuestion == 0) +{ + JLog::add(JText::_('SHOUT_BOTH_SECURITY_ENABLED'), JLog::CRITICAL, 'mod_shoutbox'); + $app->enqueueMessage(JText::_('SHOUT_BOTH_SECURITY_ENABLED'), 'error'); +} // Assemble the factory variables needed $doc = JFactory::getDocument(); @@ -53,32 +63,6 @@ JHtml::_('script', 'mod_shoutbox/mod_shoutbox.js', false, true); -// Set Date Format for when posted -if ($date == 0) -{ - $show_date = "d/m/Y - "; -} -elseif ($date == 1) -{ - $show_date = "D m Y - "; -} -elseif ($date == 3) -{ - $show_date = "m/d/Y - "; -} -elseif ($date == 4) -{ - $show_date = "D j M - "; -} -elseif ($date == 5) -{ - $show_date = "Y/m/d - "; -} -else -{ - $show_date = ""; -} - $dataerror = JText::_('SHOUT_DATABASEERRORSHOUT'); // Import JLog class @@ -106,12 +90,7 @@ if (isset($post['shout'])) { - if (!empty($post['message'])) - { - JFactory::getApplication()->enqueueMessage('The message body is empty', 'error'); - } - - ModShoutboxHelper::submitPhp($post, $params); + $helper->submitPhp($post); } if (isset($post['delete'])) @@ -121,7 +100,7 @@ if ($user->authorise('core.delete')) { - ModShoutboxHelper::deletepost($deletepostnumber); + $helper->deletepost($deletepostnumber); } } @@ -142,7 +121,7 @@ } if ($user->authorise('core.delete')) { - ModShoutboxHelper::deleteall($delete); + $helper->deleteall($delete); } } else diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 7d160bb..074e66e 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -35,82 +35,20 @@
-
+ + getShouts($number, $dataerror); ?> - // Counts the number of shouts retrieved from the database - $actualnumber = count($shouts); + + - if ($actualnumber == 0) - { - // Display shout empty message if there are no posts - ?> +

- -
- name, $shouts[$i]->user_id); - ?> -

ip); ?>> - - when, $show_date . 'H:i', true); - - if ($user->authorise('core.delete')) - { - ?> -
- - - -
- -

-

- msg); - } - else - { - echo nl2br($shouts[$i]->msg); - } - ?> -

-
- + + + renderPost($shout); ?> + +
getAuthorisedGroups(); // Convert the parameter string into an integer -$i=0; +$i = 0; + foreach($permissions as $permission) { $permissions[$i] = intval($permission); @@ -163,8 +102,7 @@ - +
@@ -173,38 +111,17 @@
- - -
'; - } + - echo '
' . ModShoutboxHelper::smileyshow() . '
'; - } ?> - +
smileyshow(); ?>
+ - if ($securityQuestion == 0) - { - $que_number1 = ModShoutboxHelper::randomnumber(1); - $que_number2 = ModShoutboxHelper::randomnumber(1); ?> + + randomnumber(1); ?> + randomnumber(1); ?> - - if ($recaptcha == 0 && $securityQuestion == 0) - { - // Shows warning if both security questions are enabled and logs to error file. - JLog::add(JText::_('SHOUT_BOTH_SECURITY_ENABLED'), JLog::CRITICAL, 'mod_shoutbox'); - $app->enqueueMessage(JText::_('SHOUT_BOTH_SECURITY_ENABLED'), 'error'); - } - ?> get('recaptcha-public')) || ($recaptcha==0 && !$params->get('recaptcha-private')) || ($recaptcha==0 && $securityQuestion==0)) { echo 'disabled="disabled"'; }?> />
- +
- +
- +
@@ -288,6 +197,27 @@ function textCounter(textarea, countdown, maxlimit) { + diff --git a/mod_shoutbox/tmpl/default_message.php b/mod_shoutbox/tmpl/default_message.php new file mode 100644 index 0000000..2630fd7 --- /dev/null +++ b/mod_shoutbox/tmpl/default_message.php @@ -0,0 +1,24 @@ + +
+ + {USER} - {DATE} + authorise('core.delete')) : ?> +
+ + + +
+ + +

{MESSAGE}

+
\ No newline at end of file From a73866e1ad054dcb31f67cdbc2a69e3cb33417d7 Mon Sep 17 00:00:00 2001 From: Lodder Date: Tue, 16 Dec 2014 19:33:05 +0000 Subject: [PATCH 14/71] wrapped functions in 1 DOM definition --- mod_shoutbox/media/js/mod_shoutbox.js | 40 +++++++++++++++------------ mod_shoutbox/tmpl/default.php | 14 ++++++---- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/mod_shoutbox/media/js/mod_shoutbox.js b/mod_shoutbox/media/js/mod_shoutbox.js index 7d7ca54..a83f7a3 100644 --- a/mod_shoutbox/media/js/mod_shoutbox.js +++ b/mod_shoutbox/media/js/mod_shoutbox.js @@ -4,6 +4,9 @@ * @license GPL v3.0 or later http://www.gnu.org/licenses/gpl-3.0.html */ +var getPosts = null; +var submitPost = null; + function addSmiley(smiley, id) { // If we are not passed an id, use the default 'jj_message'. @@ -49,17 +52,19 @@ function getCurserPosition(id) } jQuery(document).ready(function($) { - // SlideToggle for smilies + + + // SMILEY SLIDETOGGLE $('#jj_btn').on('click', function(e) { e.preventDefault(); $(this).toggleClass('rotated'); $('#jj_smiley_box').stop(true, false).slideToggle(); }); -}); - -function submitPost(name, title, recaptcha, maths, security, root) -{ - (function ($) { + + + // SUBMIT POST + submitPost = function(name, title, recaptcha, maths, security, root) + { // Assemble some commonly used vars var textarea = $('#jj_message'), message = textarea.val(); @@ -96,13 +101,13 @@ function submitPost(name, title, recaptcha, maths, security, root) if (recaptcha) { request['jjshout[recaptcha_challenge_field]'] = $('input#recaptcha_challenge_field').val(); - request['jjshout[recaptcha_response_field]'] = $('input#recaptcha_response_field').val(); + request['jjshout[recaptcha_response_field]'] = $('input#recaptcha_response_field').val(); } // AJAX request $.ajax({ type: 'POST', - url: root + '?option=com_ajax&module=shoutbox&method=submit&format=json', + url: 'index.php?option=com_ajax&module=shoutbox&method=submit&format=json', data: request, success:function(response){ if (response.success) @@ -126,12 +131,12 @@ function submitPost(name, title, recaptcha, maths, security, root) }); return false; - }(jQuery)); -} - -function getPosts(title, root) -{ - (function ($) { + } + + + // GET POSTS + getPosts = function(title, root) + { // Assemble variables to submit var request = { 'jjshout[title]' : title, @@ -140,7 +145,7 @@ function getPosts(title, root) // AJAX request $.ajax({ type: 'POST', - url: root + '?option=com_ajax&module=shoutbox&method=getPosts&format=json', + url: 'index.php?option=com_ajax&module=shoutbox&method=getPosts&format=json', data: request, success:function(response){ if (response.success) @@ -163,5 +168,6 @@ function getPosts(title, root) } return false; - }(jQuery)); -} + } + +}); diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 074e66e..c9676e5 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -218,8 +218,9 @@ function textCounter(textarea, countdown, maxlimit) - (function($){ - $( "#shoutbox-submit" ).click( function() { + jQuery(document).ready(function($) { + + $( "#shoutbox-submit" ).on('click', function() { guest){ ?> var name = "username;?>"; guest) { ?> @@ -236,10 +237,11 @@ function textCounter(textarea, countdown, maxlimit) submitPost(name, '', , , '', ''); return false; }); - })(jQuery); - - // Refresh the shoutbox posts every 10 seconds - TODO: Time should probably be a parameter as the will increase server resources doing this - setTimeout(getPosts(), 10000); + + // Refresh the shoutbox posts every 10 seconds - TODO: Time should probably be a parameter as the will increase server resources doing this + setTimeout(getPosts(), 10000); + + }); From 76638707e719484d2673ede723e5fa1bc112fd1e Mon Sep 17 00:00:00 2001 From: Lodder Date: Tue, 16 Dec 2014 19:57:21 +0000 Subject: [PATCH 15/71] made textCounter a function in the JS file --- mod_shoutbox/media/js/mod_shoutbox.js | 29 +++++++++++++++++++++++++++ mod_shoutbox/mod_shoutbox.php | 4 ++++ mod_shoutbox/tmpl/default.php | 27 ++++++++----------------- 3 files changed, 41 insertions(+), 19 deletions(-) diff --git a/mod_shoutbox/media/js/mod_shoutbox.js b/mod_shoutbox/media/js/mod_shoutbox.js index a83f7a3..1f477d2 100644 --- a/mod_shoutbox/media/js/mod_shoutbox.js +++ b/mod_shoutbox/media/js/mod_shoutbox.js @@ -51,6 +51,35 @@ function getCurserPosition(id) return pos; } +function textCounter(textarea, countdown, maxlimit, alertLength, warnLength, shoutRemainingText) +{ + textareaid = document.getElementById(textarea); + + if (textareaid.value.length > maxlimit) + { + textareaid.value = textareaid.value.substring(0, maxlimit); + } + else + { + document.getElementById('charsLeft').innerHTML = (maxlimit-textareaid.value.length)+' ' + shoutRemainingText; + } + + if (maxlimit-textareaid.value.length > alertLength) + { + document.getElementById('charsLeft').style.color = "Black"; + } + if (maxlimit-textareaid.value.length <= alertLength && maxlimit-textareaid.value.length > warnLength) + { + document.getElementById('charsLeft').style.color = "Orange"; + } + if (maxlimit-textareaid.value.length <= warnLength) + { + document.getElementById('charsLeft').style.color = "Red"; + } +} + + + jQuery(document).ready(function($) { diff --git a/mod_shoutbox/mod_shoutbox.php b/mod_shoutbox/mod_shoutbox.php index 94fec1e..3da41ef 100644 --- a/mod_shoutbox/mod_shoutbox.php +++ b/mod_shoutbox/mod_shoutbox.php @@ -34,6 +34,10 @@ $headercolor = $params->get('headercolor', '#D0D0D0'); $bbcode = $params->get('bbcode', 0); $genericName = $params->get('genericname'); +$alertLength = $params->get('alertlength', '50'); +$warnLength = $params->get('warnlength', '10'); +$messageLength = $params->get('messagelength', '200'); +$remainingLength = JText::_('SHOUT_REMAINING'); // Shows warning if both security questions are enabled and logs to error file. if ($recaptcha == 0 && $securityQuestion == 0) diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index c9676e5..73b4ff8 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -100,7 +100,14 @@ - +
@@ -197,24 +204,6 @@
From 795727855959c218fee6b73b360ed4107317c0df Mon Sep 17 00:00:00 2001 From: wilsonge Date: Thu, 25 Dec 2014 17:44:14 +0000 Subject: [PATCH 19/71] Fix maths question support with ajax --- mod_shoutbox/media/js/mod_shoutbox.js | 35 +++++++++++++++++++++++++-- mod_shoutbox/tmpl/default.php | 4 +-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/mod_shoutbox/media/js/mod_shoutbox.js b/mod_shoutbox/media/js/mod_shoutbox.js index e0839c3..1fce775 100644 --- a/mod_shoutbox/media/js/mod_shoutbox.js +++ b/mod_shoutbox/media/js/mod_shoutbox.js @@ -78,7 +78,14 @@ function textCounter(textarea, countdown, maxlimit, alertLength, warnLength, sho } } - +/** + * Returns a random integer number between min (inclusive) and max (exclusive) + */ +function getRandomArbitrary(min, max) { + var random = 0; + random = Math.random() * (max - min) + min; + return parseInt(random); +} jQuery(document).ready(function($) { @@ -133,6 +140,13 @@ jQuery(document).ready(function($) { request['jjshout[recaptcha_response_field]'] = $('input#recaptcha_response_field').val(); } + if (maths) + { + request['jjshout[sum1]'] = $('input[name="jjshout[sum1]"]').val(); + request['jjshout[sum2]'] = $('input[name="jjshout[sum2]"]').val(); + request['jjshout[human]'] = $('input[name="jjshout[human]"]').val(); + } + // AJAX request $.ajax({ type: 'POST', @@ -159,6 +173,24 @@ jQuery(document).ready(function($) { } }); + // Valid or not refresh recaptcha + if (recaptcha) + { + Recaptcha.reload(); + } + + // Valid or not refresh maths values and empty answer + if (maths) + { + var val1, val2; + val1 = getRandomArbitrary(0,9); + val2 = getRandomArbitrary(0,9); + $('input[name="jjshout[sum1]"]').val(val1); + $('input[name="jjshout[sum2]"]').val(val2); + $('label[for="math_output"]').text(val1 + ' + ' + val2); + $('input[name="jjshout[human]"]').val(''); + } + return false; } @@ -192,5 +224,4 @@ jQuery(document).ready(function($) { return false; } - }); diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 6f6dc35..27b394e 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -162,10 +162,10 @@ randomnumber(1); ?> randomnumber(1); ?> - + - + get('recaptcha-public')) || ($recaptcha==0 && !$params->get('recaptcha-private')) || ($recaptcha==0 && $securityQuestion==0)) { echo 'disabled="disabled"'; }?> /> From c537596abcdf4339d36a10b78a8ac61abff8dbf6 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Thu, 25 Dec 2014 23:05:25 +0000 Subject: [PATCH 20/71] Recaptcha works. Yay! --- mod_shoutbox/helper.php | 13 +++---------- mod_shoutbox/media/js/mod_shoutbox.js | 4 ++-- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php index fa2a7cb..2fe6076 100644 --- a/mod_shoutbox/helper.php +++ b/mod_shoutbox/helper.php @@ -782,12 +782,6 @@ private function submitPost($post) $challengeField = $input->get('recaptcha_challenge_field', '', 'string'); $responseField = $input->get('recaptcha_response_field', '', 'string'); - // Check we have a valid response field - if (!isset($responseField) || isset($responseField) && $responseField) - { - return false; - } - // Require Recaptcha Library require_once JPATH_ROOT . '/media/mod_shoutbox/recaptcha/recaptchalib.php'; @@ -802,10 +796,9 @@ private function submitPost($post) { return $this->postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $this->params); } - else - { - return array('error' => $resp->error); - } + + // Invalid submission of post. Throw an error. + throw new RuntimeException($resp->error); } elseif ($securityQuestion == 0) { diff --git a/mod_shoutbox/media/js/mod_shoutbox.js b/mod_shoutbox/media/js/mod_shoutbox.js index 1fce775..f6e1f74 100644 --- a/mod_shoutbox/media/js/mod_shoutbox.js +++ b/mod_shoutbox/media/js/mod_shoutbox.js @@ -136,8 +136,8 @@ jQuery(document).ready(function($) { if (recaptcha) { - request['jjshout[recaptcha_challenge_field]'] = $('input#recaptcha_challenge_field').val(); - request['jjshout[recaptcha_response_field]'] = $('input#recaptcha_response_field').val(); + request['recaptcha_challenge_field'] = $('input#recaptcha_challenge_field').val(); + request['recaptcha_response_field'] = $('input#recaptcha_response_field').val(); } if (maths) From 51bc9a1a20e2ec5ab61b70a3802318ea417b6585 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Thu, 25 Dec 2014 23:14:42 +0000 Subject: [PATCH 21/71] Upgrade version to 3.0.0-beta1 --- changelog.php | 3 +++ mod_shoutbox/mod_shoutbox.xml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/changelog.php b/changelog.php index a516775..3551eed 100644 --- a/changelog.php +++ b/changelog.php @@ -14,6 +14,9 @@ - -> Removed ! -> Note +Version 3.0.0 ++ Add AJAX submission of content + Version 2.0.1 - Removed a lot of word from swearwords.php ^ Tweak and cleanup of variables + Javascript diff --git a/mod_shoutbox/mod_shoutbox.xml b/mod_shoutbox/mod_shoutbox.xml index 8537d9a..a05d1cb 100644 --- a/mod_shoutbox/mod_shoutbox.xml +++ b/mod_shoutbox/mod_shoutbox.xml @@ -7,7 +7,7 @@ http://www.gnu.org/licenses/gpl-3.0.html admin@joomjunk.co.uk http://www.joomjunk.co.uk - 2.0.1 + 3.0.0-beta1 JJSHOUTBOX_DESCRIPTION From 9d4d3b5482f78ea40ec3a40f0fefa69f40cd8201 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Fri, 26 Dec 2014 01:11:19 +0000 Subject: [PATCH 22/71] Add 3.0.0 SQL files --- mod_shoutbox/sql/mysql/updates/3.0.0.sql | 1 + mod_shoutbox/sql/postgresql/updates/3.0.0.sql | 1 + 2 files changed, 2 insertions(+) create mode 100644 mod_shoutbox/sql/mysql/updates/3.0.0.sql create mode 100644 mod_shoutbox/sql/postgresql/updates/3.0.0.sql diff --git a/mod_shoutbox/sql/mysql/updates/3.0.0.sql b/mod_shoutbox/sql/mysql/updates/3.0.0.sql new file mode 100644 index 0000000..b2aa72c --- /dev/null +++ b/mod_shoutbox/sql/mysql/updates/3.0.0.sql @@ -0,0 +1 @@ +# Placeholder file for database changes for version 3.0.0 diff --git a/mod_shoutbox/sql/postgresql/updates/3.0.0.sql b/mod_shoutbox/sql/postgresql/updates/3.0.0.sql new file mode 100644 index 0000000..b2aa72c --- /dev/null +++ b/mod_shoutbox/sql/postgresql/updates/3.0.0.sql @@ -0,0 +1 @@ +# Placeholder file for database changes for version 3.0.0 From d0c24a473f308e2a648c0e260184c1fc7a89e1a7 Mon Sep 17 00:00:00 2001 From: Lodder Date: Sat, 27 Dec 2014 10:31:50 +0000 Subject: [PATCH 23/71] few tweaks and optimisation --- mod_shoutbox/media/js/mod_shoutbox.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mod_shoutbox/media/js/mod_shoutbox.js b/mod_shoutbox/media/js/mod_shoutbox.js index f6e1f74..11cf0bd 100644 --- a/mod_shoutbox/media/js/mod_shoutbox.js +++ b/mod_shoutbox/media/js/mod_shoutbox.js @@ -54,6 +54,7 @@ function getCurserPosition(id) function textCounter(textarea, countdown, maxlimit, alertLength, warnLength, shoutRemainingText) { textareaid = document.getElementById(textarea); + var charsLeft = document.getElementById('charsLeft'); if (textareaid.value.length > maxlimit) { @@ -61,29 +62,31 @@ function textCounter(textarea, countdown, maxlimit, alertLength, warnLength, sho } else { - document.getElementById('charsLeft').innerHTML = (maxlimit-textareaid.value.length)+' ' + shoutRemainingText; + charsLeft.innerHTML = (maxlimit-textareaid.value.length)+' ' + shoutRemainingText; } if (maxlimit-textareaid.value.length > alertLength) { - document.getElementById('charsLeft').style.color = "Black"; + charsLeft.style.color = "Black"; } if (maxlimit-textareaid.value.length <= alertLength && maxlimit-textareaid.value.length > warnLength) { - document.getElementById('charsLeft').style.color = "Orange"; + charsLeft.style.color = "Orange"; } if (maxlimit-textareaid.value.length <= warnLength) { - document.getElementById('charsLeft').style.color = "Red"; + charsLeft.style.color = "Red"; } } /** * Returns a random integer number between min (inclusive) and max (exclusive) */ -function getRandomArbitrary(min, max) { +function getRandomArbitrary(min, max) +{ var random = 0; random = Math.random() * (max - min) + min; + return parseInt(random); } From 32b177c157ddbed10def37e788f8ac2853ae20e5 Mon Sep 17 00:00:00 2001 From: Lodder Date: Sat, 27 Dec 2014 10:32:08 +0000 Subject: [PATCH 24/71] updated jQuery to 1.11.2 --- mod_shoutbox/mod_shoutbox.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod_shoutbox/mod_shoutbox.php b/mod_shoutbox/mod_shoutbox.php index 3da41ef..541e46f 100644 --- a/mod_shoutbox/mod_shoutbox.php +++ b/mod_shoutbox/mod_shoutbox.php @@ -60,7 +60,7 @@ if (!$app->get('jquery')) { $app->set('jquery', true); - $doc->addScript('//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'); + $doc->addScript('//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js'); JHtml::_('script', 'mod_shoutbox/jquery-conflict.js', false, true); } } From f749174c6ff481b2aaaf25c22311e837c964ecd9 Mon Sep 17 00:00:00 2001 From: Lodder Date: Sat, 27 Dec 2014 10:57:52 +0000 Subject: [PATCH 25/71] used BS btn-group class --- mod_shoutbox/helper.php | 16 +++++------ mod_shoutbox/media/js/mod_shoutbox.js | 2 +- mod_shoutbox/mod_shoutbox.php | 14 +++++----- mod_shoutbox/mod_shoutbox.xml | 38 +++++++++++++-------------- mod_shoutbox/tmpl/default.php | 27 ++++++++++--------- 5 files changed, 50 insertions(+), 47 deletions(-) diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php index 2fe6076..89e3df9 100644 --- a/mod_shoutbox/helper.php +++ b/mod_shoutbox/helper.php @@ -332,19 +332,19 @@ public function postFiltering($shout, $user, $swearCounter, $swearNumber, $displ { $replace = '****'; - if (!$user->guest && $displayName == 0) + if (!$user->guest && $displayName == 'real') { $name = $user->name; $nameSwears = 0; } - elseif (!$user->guest && $displayName == 1) + elseif (!$user->guest && $displayName == 'user') { $name = $user->username; $nameSwears = 0; } else { - if ($swearCounter == 0) + if ($swearCounter == 1) { $before = substr_count($shout['name'], $replace); } @@ -358,7 +358,7 @@ public function postFiltering($shout, $user, $swearCounter, $swearNumber, $displ $name = $genericName; } - if ($swearCounter == 0) + if ($swearCounter == 1) { $after = substr_count($name, $replace); $nameSwears = ($after - $before); @@ -764,18 +764,18 @@ private function submitPost($post) { // Get the user instance $user = JFactory::getUser(); - $displayName = $this->params->get('loginname'); - $recaptcha = $this->params->get('recaptchaon', 1); + $displayName = $this->params->get('loginname', 'user'); + $recaptcha = $this->params->get('recaptchaon', 0); $swearCounter = $this->params->get('swearingcounter'); $swearNumber = $this->params->get('swearingnumber'); - $securityQuestion = $this->params->get('securityquestion'); + $securityQuestion = $this->params->get('securityquestion', 0); // If we submitted by PHP check for a session token if ($this->ajax || $_SESSION['token'] == $post['token']) { JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - if ($recaptcha == 0) + if ($recaptcha == 1) { // Recaptcha fields aren't in the JJ post space so we have to grab these separately $input = JFactory::getApplication()->input; diff --git a/mod_shoutbox/media/js/mod_shoutbox.js b/mod_shoutbox/media/js/mod_shoutbox.js index 11cf0bd..c486416 100644 --- a/mod_shoutbox/media/js/mod_shoutbox.js +++ b/mod_shoutbox/media/js/mod_shoutbox.js @@ -86,7 +86,7 @@ function getRandomArbitrary(min, max) { var random = 0; random = Math.random() * (max - min) + min; - + return parseInt(random); } diff --git a/mod_shoutbox/mod_shoutbox.php b/mod_shoutbox/mod_shoutbox.php index 541e46f..3f77e8c 100644 --- a/mod_shoutbox/mod_shoutbox.php +++ b/mod_shoutbox/mod_shoutbox.php @@ -15,24 +15,24 @@ $helper = new ModShoutboxHelper($title); $params = $helper->getParams(); -$displayName = $params->get('loginname'); +$displayName = $params->get('loginname', 'user'); $smile = $params->get('smile'); -$swearcounter = $params->get('swearingcounter'); +$swearcounter = $params->get('swearingcounter', 1); $swearnumber = $params->get('swearingnumber'); $number = $params->get('maximum'); $submittext = $params->get('submittext'); $nonmembers = $params->get('nonmembers'); $profile = $params->get('profile'); $date = $params->get('date'); -$recaptcha = $params->get('recaptchaon', 1); -$securityQuestion = $params->get('securityquestion'); -$mass_delete = $params->get('mass_delete'); +$recaptcha = $params->get('recaptchaon', 0); +$securityQuestion = $params->get('securityquestion', 0); +$mass_delete = $params->get('mass_delete', 0); $permissions = $params->get('guestpost'); $deletecolor = $params->get('deletecolor', '#FF0000'); $bordercolour = $params->get('bordercolor', '#FF3C16'); $borderwidth = $params->get('borderwidth', '1'); $headercolor = $params->get('headercolor', '#D0D0D0'); -$bbcode = $params->get('bbcode', 0); +$bbcode = $params->get('bbcode', 1); $genericName = $params->get('genericname'); $alertLength = $params->get('alertlength', '50'); $warnLength = $params->get('warnlength', '10'); @@ -108,7 +108,7 @@ } } - if ($mass_delete == 0 && (isset($post['deleteall']))) + if ($mass_delete == 1 && (isset($post['deleteall']))) { JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); $delete = $post['valueall']; diff --git a/mod_shoutbox/mod_shoutbox.xml b/mod_shoutbox/mod_shoutbox.xml index a05d1cb..7c58100 100644 --- a/mod_shoutbox/mod_shoutbox.xml +++ b/mod_shoutbox/mod_shoutbox.xml @@ -79,10 +79,10 @@ - - - - + + + + @@ -103,13 +103,13 @@ - - - + + + - - - + + + @@ -119,23 +119,23 @@
- - - + + + - - - + + +
- - - + + +
diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 27b394e..79ac701 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -75,15 +75,15 @@
guest) + if ($displayName == 'real' && !$user->guest) { echo JText::_('SHOUT_NAME') . ":" . $user->name; } - elseif ($displayName == 1 && !$user->guest) + elseif ($displayName == 'user' && !$user->guest) { echo JText::_('SHOUT_NAME') . ":" . $user->username; } - elseif ($user->guest||($displayName == 2 && !$user->guest)) + elseif ($user->guest||($displayName == 'choose' && !$user->guest)) { ?> @@ -109,7 +109,7 @@ onKeyUp="textCounter('jj_message','messagecount',, , , '');" > - +
@@ -132,7 +132,7 @@ - + randomnumber(1); ?> randomnumber(1); ?> @@ -168,13 +168,13 @@ - get('recaptcha-public')) || ($recaptcha==0 && !$params->get('recaptcha-private')) || ($recaptcha==0 && $securityQuestion==0)) { echo 'disabled="disabled"'; }?> /> + get('recaptcha-public')) || ($recaptcha == 1 && !$params->get('recaptcha-private')) || ($recaptcha == 1 && $securityQuestion == 1)) { echo 'disabled="disabled"'; }?> /> authorise('core.delete')) { - if ($mass_delete == 0) + if ($mass_delete == 1) { ?>
@@ -210,9 +210,9 @@ jQuery(document).ready(function($) { $( "#shoutbox-submit" ).on('click', function() { - guest){ ?> + guest){ ?> var name = "username;?>"; - guest) { ?> + guest) { ?> var name = "name;?>"; if($('#shoutbox-name').val() == ""){ @@ -223,13 +223,16 @@ } - submitPost(name, '', , , '', ''); + submitPost(name, '', , , '', ''); return false; }); }); // Refresh the shoutbox posts every 10 seconds - TODO: Time should probably be a parameter as the will increase server resources doing this - setInterval(function(){getPosts('', '');}, 10000); + setInterval(function(){ + getPosts('', ''); + }, 10000); + From 56b553baa7d49b5f7cb7a1895e7f0c807acca837 Mon Sep 17 00:00:00 2001 From: Lodder Date: Sat, 27 Dec 2014 11:14:45 +0000 Subject: [PATCH 26/71] made getPosts interval a parameter --- mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini | 2 ++ mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini | 2 ++ mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini | 2 ++ mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini | 2 ++ mod_shoutbox/mod_shoutbox.php | 1 + mod_shoutbox/mod_shoutbox.xml | 7 ++++--- mod_shoutbox/tmpl/default.php | 2 +- 7 files changed, 14 insertions(+), 4 deletions(-) diff --git a/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini b/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini index 14a7514..597e750 100644 --- a/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini +++ b/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini @@ -31,6 +31,8 @@ SHOUT_SUBMITTEXT="Submit button text" SHOUT_SUBMITTEXTDESC="Type in the text that you like to be shown on the submit button" SHOUT_NONMEMBER="No permissions message" SHOUT_NONMEMBERDESC="The message that will be displayed to those who do not have permissions to use the shoutbox" +SHOUT_AUTO_REFRESH="Auto refresh (seconds)" +SHOUT_AUTO_REFRESH_DESC="Select how many seconds it takes for the auto refresh to retrieve new shouts" SHOUT_NAME="Name" SHOUT_DELETELABEL="Delete Button Colour" SHOUT_DELETEDESC="Select the colour of the delete button" diff --git a/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini b/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini index b0d288a..d1b8c98 100644 --- a/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini +++ b/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini @@ -31,6 +31,8 @@ SHOUT_SUBMITTEXT="Testo Bottone Invia" SHOUT_SUBMITTEXTDESC="Digitare il testo che si desidera venga visualizzato sul pulsante di invio" SHOUT_NONMEMBER="Nessun messaggio permesso" SHOUT_NONMEMBERDESC="Il messaggio che verrà visualizzato a coloro che non dispongono delle autorizzazioni per utilizzare la shoutbox" +SHOUT_AUTO_REFRESH="Auto refresh (seconds)" +SHOUT_AUTO_REFRESH_DESC="Select how many seconds it takes for the auto refresh to retrieve new shouts" SHOUT_NAME="Nome" SHOUT_DELETELABEL="Colore Bottone Cancella" SHOUT_DELETEDESC="Scegliere il colore del bottone cancella" diff --git a/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini b/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini index 8ccb3a3..3407cd6 100644 --- a/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini +++ b/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini @@ -31,6 +31,8 @@ SHOUT_SUBMITTEXT="Verzendknop tekst" SHOUT_SUBMITTEXTDESC="Geef de tekst op dat je op de verzendknop wilt hebben" SHOUT_NONMEMBER="Geen permissie bericht" SHOUT_NONMEMBERDESC="Het bericht dat aan de gebruikers zal worden getoond wanneer ze geen rechten hebben om de shoutbox te gebruiken" +SHOUT_AUTO_REFRESH="Auto refresh (seconds)" +SHOUT_AUTO_REFRESH_DESC="Select how many seconds it takes for the auto refresh to retrieve new shouts" SHOUT_NAME="Naam" SHOUT_DELETELABEL="Verwijderknop Kleur" SHOUT_DELETEDESC="Selecteer de kleur van de Verwijderknop" diff --git a/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini b/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini index bb6c1d2..81c7e49 100644 --- a/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini +++ b/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini @@ -31,6 +31,8 @@ SHOUT_SUBMITTEXT="Przycisk wysyłania tekstu" SHOUT_SUBMITTEXTDESC="Wpisz tu tekst, który ma się pojawić na przycisku wysyłania tekstu" SHOUT_NONMEMBER="Wiadomość o braku uprawnień" SHOUT_NONMEMBERDESC="Wiadomość, która będzie wyświetlona tym, którzy nie mają uprawnień do używania czatu." +SHOUT_AUTO_REFRESH="Auto refresh (seconds)" +SHOUT_AUTO_REFRESH_DESC="Select how many seconds it takes for the auto refresh to retrieve new shouts" SHOUT_NAME="Nazwa" SHOUT_DELETELABEL="Kolor przycisku \"Usuń\"" SHOUT_DELETEDESC="Wybierz kolor przycisku \"Usuń\"" diff --git a/mod_shoutbox/mod_shoutbox.php b/mod_shoutbox/mod_shoutbox.php index 3f77e8c..3828219 100644 --- a/mod_shoutbox/mod_shoutbox.php +++ b/mod_shoutbox/mod_shoutbox.php @@ -37,6 +37,7 @@ $alertLength = $params->get('alertlength', '50'); $warnLength = $params->get('warnlength', '10'); $messageLength = $params->get('messagelength', '200'); +$refresh = $params->get('refresh', 10) * 1000; $remainingLength = JText::_('SHOUT_REMAINING'); // Shows warning if both security questions are enabled and logs to error file. diff --git a/mod_shoutbox/mod_shoutbox.xml b/mod_shoutbox/mod_shoutbox.xml index 7c58100..129de93 100644 --- a/mod_shoutbox/mod_shoutbox.xml +++ b/mod_shoutbox/mod_shoutbox.xml @@ -77,8 +77,6 @@ - - @@ -92,11 +90,14 @@ - + + + + diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 79ac701..041ef23 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -231,7 +231,7 @@ // Refresh the shoutbox posts every 10 seconds - TODO: Time should probably be a parameter as the will increase server resources doing this setInterval(function(){ getPosts('', ''); - }, 10000); + }, ); From 2dbfbe708df470e591164158fe277b7fd7958e73 Mon Sep 17 00:00:00 2001 From: Lodder Date: Sun, 28 Dec 2014 12:42:06 +0000 Subject: [PATCH 27/71] update loginname value in update script --- mod_shoutbox/script.php | 52 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/mod_shoutbox/script.php b/mod_shoutbox/script.php index f93c59f..ca48bfb 100644 --- a/mod_shoutbox/script.php +++ b/mod_shoutbox/script.php @@ -92,6 +92,14 @@ public function preflight($type, $parent) { $this->update126(); } + + /** + * For extensions going from < version 3.0.0 we need to change the loginname field option values + */ + if (version_compare($oldRelease, '2.0.1', '<=')) + { + $this->update300(); + } } } @@ -422,4 +430,48 @@ protected function update126() unset($values); } } + + /** + * Function to update the params for the Shoutbox Version 2.0.1 updates + * + * @return void + * + * @since 3.0.0 + */ + protected function update300() + { + $modules = $this->getInstances(true); + + foreach ($modules as $module) + { + // Convert string to integer + $module = (int) $module; + + // Create array of params to change + $param = array(); + $param = $this->getParam('loginname', $module); + + if( $param == 0 ) + { + $set = 'real'; + } + elseif( $param == 1 ) + { + $set = 'user'; + } + else + { + $set = 'choose'; + } + + // Set the param values + $this->setParams($set, 'edit', $module); + + // Unset the array for the next loop + unset($param); + } + } + + + } From 5d0f5e4e5f6c39105ecab1419d24feb45668ef63 Mon Sep 17 00:00:00 2001 From: George Wilson Date: Sun, 28 Dec 2014 16:06:25 +0000 Subject: [PATCH 28/71] Fix the setting of the loginname param --- mod_shoutbox/script.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/mod_shoutbox/script.php b/mod_shoutbox/script.php index ca48bfb..a3bbcc5 100644 --- a/mod_shoutbox/script.php +++ b/mod_shoutbox/script.php @@ -432,7 +432,7 @@ protected function update126() } /** - * Function to update the params for the Shoutbox Version 2.0.1 updates + * Function to update the params for the Shoutbox Version 3.0.0 updates * * @return void * @@ -448,27 +448,28 @@ protected function update300() $module = (int) $module; // Create array of params to change - $param = array(); - $param = $this->getParam('loginname', $module); + $param = $this->getParam('loginname', $module); + $newParams = array(); - if( $param == 0 ) + if ($param == 0) { - $set = 'real'; + $newParams['loginname'] = 'real'; } - elseif( $param == 1 ) + elseif ($param == 1) { - $set = 'user'; + $newParams['loginname'] = 'user'; } - else + else { - $set = 'choose'; + $newParams['loginname'] = 'choose'; } // Set the param values - $this->setParams($set, 'edit', $module); + $this->setParams($newParams, 'edit', $module); // Unset the array for the next loop unset($param); + unset($newParams); } } From b505bb121d2a52ac4a843beb628ad276c7bfeeb9 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sun, 28 Dec 2014 19:00:53 +0000 Subject: [PATCH 29/71] Fix params where we have standardized off and on --- mod_shoutbox/script.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/mod_shoutbox/script.php b/mod_shoutbox/script.php index a3bbcc5..3f6f459 100644 --- a/mod_shoutbox/script.php +++ b/mod_shoutbox/script.php @@ -447,9 +447,11 @@ protected function update300() // Convert string to integer $module = (int) $module; - // Create array of params to change - $param = $this->getParam('loginname', $module); + // Initialise the values to be updated $newParams = array(); + + // Name to show is now a set of string values rather than numerical values. + $param = $this->getParam('loginname', $module); if ($param == 0) { @@ -464,6 +466,24 @@ protected function update300() $newParams['loginname'] = 'choose'; } + // To standardise off is 0 and on is 1. Swap some field names around. + $params = array('bbcode', 'swearingcounter', 'recaptchaon', 'securityquestion', 'mass_delete'); + + foreach ($params as $paramName) + { + $param = $this->getParam($paramName, $module); + + // If the param was 1 make it 0 and vice versa + if ($param == 0) + { + $newParams[$paramName] = 1; + } + else + { + $newParams[$paramName] = 0; + } + } + // Set the param values $this->setParams($newParams, 'edit', $module); From 87dac6d56957695a3d3a1aa0174823e2948baa17 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sun, 28 Dec 2014 19:16:58 +0000 Subject: [PATCH 30/71] Fixes places which were broken with new params --- mod_shoutbox/helper.php | 12 ++++++------ mod_shoutbox/mod_shoutbox.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php index 89e3df9..705b867 100644 --- a/mod_shoutbox/helper.php +++ b/mod_shoutbox/helper.php @@ -369,14 +369,14 @@ public function postFiltering($shout, $user, $swearCounter, $swearNumber, $displ } } - if ($swearCounter == 0) + if ($swearCounter == 1) { $before = substr_count($shout['message'], $replace); } $message = $this->swearfilter($shout['message'], $replace); - if ($swearCounter == 0) + if ($swearCounter == 1) { $after = substr_count($message, $replace); $messageSwears = ($after - $before); @@ -384,7 +384,7 @@ public function postFiltering($shout, $user, $swearCounter, $swearNumber, $displ $ip = $_SERVER['REMOTE_ADDR']; - if ($swearCounter == 1 || $swearCounter == 0 && (($nameSwears + $messageSwears) <= $swearNumber)) + if ($swearCounter == 0 || $swearCounter == 1 && (($nameSwears + $messageSwears) <= $swearNumber)) { return $this->addShout($name, $message, $ip); } @@ -873,7 +873,7 @@ private function processTemplate($template, $shout) // Grab the bbcode and smiley params $smile = $this->params->get('smile'); - $bbcode = $this->params->get('bbcode', 0); + $bbcode = $this->params->get('bbcode', 1); // Expression to search for in the message template ({{VAR}} $regex = '/{(.*?)}/'; @@ -896,7 +896,7 @@ private function processTemplate($template, $shout) $profile_link = $this->linkUser($this->params->get('profile'), $shout->name, $shout->user_id); // Check if we need to do smiley or bbcode filtering - if ($smile == 0 || $bbcode == 0) + if ($smile == 0 || $bbcode == 1) { $user = $this->bbcodeFilter($profile_link); } @@ -941,7 +941,7 @@ private function processTemplate($template, $shout) break; case 'MESSAGE': - if ($smile == 0 || $smile == 1 || $smile == 2 || $bbcode == 0) + if ($smile == 0 || $smile == 1 || $smile == 2 || $bbcode == 1) { $post = $this->bbcodeFilter($shout->msg); } diff --git a/mod_shoutbox/mod_shoutbox.php b/mod_shoutbox/mod_shoutbox.php index 3828219..ecb66ed 100644 --- a/mod_shoutbox/mod_shoutbox.php +++ b/mod_shoutbox/mod_shoutbox.php @@ -41,7 +41,7 @@ $remainingLength = JText::_('SHOUT_REMAINING'); // Shows warning if both security questions are enabled and logs to error file. -if ($recaptcha == 0 && $securityQuestion == 0) +if ($recaptcha == 1 && $securityQuestion == 1) { JLog::add(JText::_('SHOUT_BOTH_SECURITY_ENABLED'), JLog::CRITICAL, 'mod_shoutbox'); $app->enqueueMessage(JText::_('SHOUT_BOTH_SECURITY_ENABLED'), 'error'); From 8ecdd25a74a2ab59d068fb89ab056975e692fd83 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sun, 28 Dec 2014 19:52:07 +0000 Subject: [PATCH 31/71] Change storage engine to InnoDB. Fixes #113. --- mod_shoutbox/sql/mysql/install.mysql.utf8.sql | 2 +- mod_shoutbox/sql/mysql/updates/3.0.0.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mod_shoutbox/sql/mysql/install.mysql.utf8.sql b/mod_shoutbox/sql/mysql/install.mysql.utf8.sql index 0fd069f..6329d37 100644 --- a/mod_shoutbox/sql/mysql/install.mysql.utf8.sql +++ b/mod_shoutbox/sql/mysql/install.mysql.utf8.sql @@ -7,6 +7,6 @@ CREATE TABLE IF NOT EXISTS `#__shoutbox` ( `user_id` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; INSERT INTO `#__shoutbox` (`name`, `when`, `msg`, `user_id`) VALUES ('JoomJunk', '2012-01-16 20:00:00', 'Welcome to the Shoutbox', '0'); diff --git a/mod_shoutbox/sql/mysql/updates/3.0.0.sql b/mod_shoutbox/sql/mysql/updates/3.0.0.sql index b2aa72c..1e8c492 100644 --- a/mod_shoutbox/sql/mysql/updates/3.0.0.sql +++ b/mod_shoutbox/sql/mysql/updates/3.0.0.sql @@ -1 +1 @@ -# Placeholder file for database changes for version 3.0.0 +ALTER TABLE `#__shoutbox` ENGINE=InnoDB; \ No newline at end of file From 2b8537f2f7eecb328ce13ddfe663a5719a6da9e9 Mon Sep 17 00:00:00 2001 From: George Wilson Date: Tue, 6 Jan 2015 11:43:02 +0000 Subject: [PATCH 32/71] Add PHP length check. Fixes #129. --- mod_shoutbox/helper.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php index 705b867..b0a51d3 100644 --- a/mod_shoutbox/helper.php +++ b/mod_shoutbox/helper.php @@ -382,6 +382,10 @@ public function postFiltering($shout, $user, $swearCounter, $swearNumber, $displ $messageSwears = ($after - $before); } + // Ensure the max length of posts is the parameter value + $length = $this->params->get('messagelength', '200'); + $message = substr($message, 0, $length); + $ip = $_SERVER['REMOTE_ADDR']; if ($swearCounter == 0 || $swearCounter == 1 && (($nameSwears + $messageSwears) <= $swearNumber)) From 87918e7ec7e5d84ac8f6d94cb512846baaf7dbab Mon Sep 17 00:00:00 2001 From: Lodder Date: Tue, 20 Jan 2015 19:57:08 +0000 Subject: [PATCH 33/71] Fix shout not submitting is maths questions is disabled --- mod_shoutbox/helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php index b0a51d3..44d29e8 100644 --- a/mod_shoutbox/helper.php +++ b/mod_shoutbox/helper.php @@ -804,7 +804,7 @@ private function submitPost($post) // Invalid submission of post. Throw an error. throw new RuntimeException($resp->error); } - elseif ($securityQuestion == 0) + elseif ($securityQuestion == 1) { // Our maths security question is on if (isset($post['sum1']) && isset($post['sum2'])) From 0c16dd8b71a20b2eef6189843d563be73731552a Mon Sep 17 00:00:00 2001 From: Lodder Date: Tue, 20 Jan 2015 20:15:49 +0000 Subject: [PATCH 34/71] few styling tweaks --- mod_shoutbox/media/css/mod_shoutbox.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mod_shoutbox/media/css/mod_shoutbox.css b/mod_shoutbox/media/css/mod_shoutbox.css index a58dd4c..6c7d949 100644 --- a/mod_shoutbox/media/css/mod_shoutbox.css +++ b/mod_shoutbox/media/css/mod_shoutbox.css @@ -61,8 +61,8 @@ } #noguest { color: #FF0000; font-weight: bold; } #jjshoutbox .jj_error { color:red; font-weight:bold; } -#jjshoutbox .jj_label { width: 50%; } -#jjshoutbox .jj_input { width: 50%; } +#jjshoutbox .jj_label { width: 70px; display: inline-block; } +#jjshoutbox .jj_input { width: 80px; display: inline-block; } #jjshoutbox .jj_admin_label { width: 30%; } #jjshoutbox .jj_admin_button { width: 65%; @@ -112,7 +112,7 @@ Non-bootstrap styling for BB Code **/ #jjshoutbox #jj_smiley_box{ - margin: 10px 0 10px 0; + margin: 5px 0 10px; white-space: normal; } #jjshoutbox #jj_smiley_box img{ From df6a4ac78d57c55de3058769bcac2cf87ca843f6 Mon Sep 17 00:00:00 2001 From: Lodder Date: Tue, 20 Jan 2015 20:51:52 +0000 Subject: [PATCH 35/71] added option to hide smilies at first with slideToggle --- mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini | 3 ++- mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini | 3 ++- mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini | 3 ++- mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini | 3 ++- mod_shoutbox/mod_shoutbox.xml | 5 +++-- mod_shoutbox/tmpl/default.php | 9 ++++----- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini b/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini index 597e750..f280ad6 100644 --- a/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini +++ b/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini @@ -58,7 +58,8 @@ JON="On" JOFF="Off" SHOUT_SMILIES_ON="Enable but dont show" SHOUT_SMILIES_ON_FIXED="Enable and show" -SHOUT_SMILIES_ON_SLIDE="Enable with slideToggle" +SHOUT_SMILIES_ON_SLIDE_HIDE="SlideToggle (Hide at first)" +SHOUT_SMILIES_ON_SLIDE_SHOW="SlideToggle (Show at first)" SHOUT_SMILIES_DISABLE="Disable" SHOUT_BBCODELABEL="BBCode" SHOUT_BBCODEDESC="Select whether you would like to enable BBCode" diff --git a/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini b/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini index d1b8c98..55d80e9 100644 --- a/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini +++ b/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini @@ -58,7 +58,8 @@ JON="Attivo" JOFF="Disattivato" SHOUT_SMILIES_ON="Attiva ma non visualizza" SHOUT_SMILIES_ON_FIXED="Attiva e visualizza" -SHOUT_SMILIES_ON_SLIDE="Attiva con togli-slide" +SHOUT_SMILIES_ON_SLIDE_HIDE="Togli-slide (Hide at first)" +SHOUT_SMILIES_ON_SLIDE_SHOW="Togli-slide (Show at first)" SHOUT_SMILIES_DISABLE="Disabilita" SHOUT_BBCODELABEL="BBCode" SHOUT_BBCODEDESC="Select whether you would like to enable BBCode" diff --git a/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini b/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini index 3407cd6..71a0128 100644 --- a/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini +++ b/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini @@ -58,7 +58,8 @@ JON="Aan" JOFF="Uit" SHOUT_SMILIES_ON="Inschakelen maar verbergen" SHOUT_SMILIES_ON_FIXED="Inschakelen en laten zien" -SHOUT_SMILIES_ON_SLIDE="Inschakelen met slideToggle" +SHOUT_SMILIES_ON_SLIDE_HIDE="SlideToggle (Hide at first)" +SHOUT_SMILIES_ON_SLIDE_SHOW="SlideToggle (Show at first)" SHOUT_SMILIES_DISABLE="Uitschakelen" SHOUT_BBCODELABEL="BBCode" SHOUT_BBCODEDESC="Select whether you would like to enable BBCode" diff --git a/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini b/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini index 81c7e49..2811634 100644 --- a/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini +++ b/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini @@ -58,7 +58,8 @@ JON="Włączone" JOFF="Wyłączone" SHOUT_SMILIES_ON="Włączone, ale nie pokazuj" SHOUT_SMILIES_ON_FIXED="Włączone" -SHOUT_SMILIES_ON_SLIDE="Włączone z ukrywaniem" +SHOUT_SMILIES_ON_SLIDE_HIDE="SlideToggle (Hide at first)" +SHOUT_SMILIES_ON_SLIDE_SHOW="SlideToggle (Show at first)" SHOUT_SMILIES_DISABLE="Wyłączone" SHOUT_BBCODELABEL="BBCode" SHOUT_BBCODEDESC="Select whether you would like to enable BBCode" diff --git a/mod_shoutbox/mod_shoutbox.xml b/mod_shoutbox/mod_shoutbox.xml index 129de93..d4e913c 100644 --- a/mod_shoutbox/mod_shoutbox.xml +++ b/mod_shoutbox/mod_shoutbox.xml @@ -101,8 +101,9 @@ - - + + + diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 041ef23..857ccd8 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -120,14 +120,13 @@
- - + +
- +
- -
smileyshow(); ?>
+
smileyshow(); ?>
Date: Sat, 24 Jan 2015 15:39:47 +0000 Subject: [PATCH 36/71] security type now a selectbox --- mod_shoutbox/fields/fade.php | 75 +++++++++++++++++++ mod_shoutbox/helper.php | 7 +- .../language/en-GB/en-GB.mod_shoutbox.ini | 10 +-- .../language/it-IT/it-IT.mod_shoutbox.ini | 10 +-- .../language/nl-NL/nl_NL.mod_shoutbox.ini | 10 +-- .../language/pl-PL/pl-PL.mod_shoutbox.ini | 10 +-- mod_shoutbox/media/js/mod_shoutbox.js | 10 +-- mod_shoutbox/mod_shoutbox.php | 12 +-- mod_shoutbox/mod_shoutbox.xml | 21 +++--- mod_shoutbox/tmpl/default.php | 14 ++-- 10 files changed, 122 insertions(+), 57 deletions(-) create mode 100644 mod_shoutbox/fields/fade.php diff --git a/mod_shoutbox/fields/fade.php b/mod_shoutbox/fields/fade.php new file mode 100644 index 0000000..73dbf0f --- /dev/null +++ b/mod_shoutbox/fields/fade.php @@ -0,0 +1,75 @@ +addScriptDeclaration($js); + + } + + /** + * @return mixed + */ + protected function getInput() + { + return; + } + +} diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php index 44d29e8..1e7e83c 100644 --- a/mod_shoutbox/helper.php +++ b/mod_shoutbox/helper.php @@ -769,17 +769,16 @@ private function submitPost($post) // Get the user instance $user = JFactory::getUser(); $displayName = $this->params->get('loginname', 'user'); - $recaptcha = $this->params->get('recaptchaon', 0); + $securityType = $this->params->get('securitytype', 0); $swearCounter = $this->params->get('swearingcounter'); $swearNumber = $this->params->get('swearingnumber'); - $securityQuestion = $this->params->get('securityquestion', 0); // If we submitted by PHP check for a session token if ($this->ajax || $_SESSION['token'] == $post['token']) { JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - if ($recaptcha == 1) + if ($securityType == 1) { // Recaptcha fields aren't in the JJ post space so we have to grab these separately $input = JFactory::getApplication()->input; @@ -804,7 +803,7 @@ private function submitPost($post) // Invalid submission of post. Throw an error. throw new RuntimeException($resp->error); } - elseif ($securityQuestion == 1) + elseif ($securityType == 2) { // Our maths security question is on if (isset($post['sum1']) && isset($post['sum2'])) diff --git a/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini b/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini index f280ad6..ccbf4be 100644 --- a/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini +++ b/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini @@ -71,13 +71,13 @@ SHOUT_REMAINING="characters remaining" SHOUT_NOSCRIPT_THERE_IS_A="There is a " SHOUT_NOSCRIPT_CHARS_LIMIT=" character limit" SHOUT_SECURITY="Security" -SHOUT_SECURITY_QUESTION_LABEL="Security Maths Question" -SHOUT_SECURITY_QUESTION_DESC="Select whether or not you would like to add a simple security Maths question. Note that you can not use this in addition to reCaptcha" +SHOUT_SECURITY_TYPE="Security Type" +SHOUT_SECURITY_TYPE_DESC="Select whether you would like to use reCAPTCHA or a simple maths question" +SHOUT_NONE="None" +SHOUT_RECAPTCHA="reCAPTCHA" +SHOUT_MATHS_QUESTION="Maths Question" SHOUT_ANSWER_INCORRECT="Security answer is incorrect. Please try again." -SHOUT_BOTH_SECURITY_ENABLED="You cannot have the security question and reCaptcha enabled." SHOUT_RECAPTURE_CORRECT="You got it!" -SHOUT_RECAPTCHAON_LABEL="Recaptcha Enabled?" -SHOUT_RECAPTCHAON_DESC="Choose whether you would like recaptcha on or off" SHOUT_RECAPTCHA_PUBLIC_LABEL="Public Key" SHOUT_RECAPTCHA_PUBLIC_DESC="Please enter the recaptcha public key here" SHOUT_RECAPTCHA_PRIVATE_LABEL="Private Key" diff --git a/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini b/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini index 55d80e9..b15469c 100644 --- a/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini +++ b/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini @@ -71,13 +71,13 @@ SHOUT_REMAINING="caratteri rimasti" SHOUT_NOSCRIPT_THERE_IS_A="C'è un " SHOUT_NOSCRIPT_CHARS_LIMIT=" limite caratteri" SHOUT_SECURITY="Sicurezza" -SHOUT_SECURITY_QUESTION_LABEL="Domanda matematica di sicurezza" -SHOUT_SECURITY_QUESTION_DESC="Selezionare se si desidera aggiungere una semplice domanda di matematica di sicurezza. Si noti che non è possibile utilizzare questo in aggiunta a reCaptcha" +SHOUT_SECURITY_TYPE="Security Type" +SHOUT_SECURITY_TYPE_DESC="Select whether you would like to use reCAPTCHA or a simple maths question" +SHOUT_NONE="None" +SHOUT_RECAPTCHA="reCAPTCHA" +SHOUT_MATHS_QUESTION="Maths Question" SHOUT_ANSWER_INCORRECT="La risposta di sicurezza è sbagliata. Riprova." -SHOUT_BOTH_SECURITY_ENABLED="Non si può avere la domanda di sicurezza e reCaptcha abilitato." SHOUT_RECAPTURE_CORRECT="Ce l'hai fatta!" -SHOUT_RECAPTCHAON_LABEL="Abilitare Recaptcha?" -SHOUT_RECAPTCHAON_DESC="Scegliere se si desidera recaptcha Attivo o Disattivato" SHOUT_RECAPTCHA_PUBLIC_LABEL="Chiave Pubblica" SHOUT_RECAPTCHA_PUBLIC_DESC="Si prega di inserire la chiave pubblica reCAPTCHA qui" SHOUT_RECAPTCHA_PRIVATE_LABEL="Chiave privata" diff --git a/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini b/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini index 71a0128..2e5ff32 100644 --- a/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini +++ b/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini @@ -71,13 +71,13 @@ SHOUT_REMAINING="tekens over" SHOUT_NOSCRIPT_THERE_IS_A="Er is een" SHOUT_NOSCRIPT_CHARS_LIMIT="tekens limiet" SHOUT_SECURITY="Beveiliging" -SHOUT_SECURITY_QUESTION_LABEL="Beveilingsrekenvraag" -SHOUT_SECURITY_QUESTION_DESC="Selecteer of er een eenvoudige rekensom moet worden toegevoegd voor de beveiliging. Houdt in de gaten dat je dit niet kunt gebruiken in combinatie met reCaptcha" +SHOUT_SECURITY_TYPE="Security Type" +SHOUT_SECURITY_TYPE_DESC="Select whether you would like to use reCAPTCHA or a simple maths question" +SHOUT_NONE="None" +SHOUT_RECAPTCHA="reCAPTCHA" +SHOUT_MATHS_QUESTION="Maths Question" SHOUT_ANSWER_INCORRECT="Beveiligings-antwoord in niet juist. Probeer het opnieuw" -SHOUT_BOTH_SECURITY_ENABLED="De beveiligingsvraag en reCaptcha kunnen niet tegelijkertijd ingeschakeld zijn." SHOUT_RECAPTURE_CORRECT="Je hebt 'm!" -SHOUT_RECAPTCHAON_LABEL="Recaptcha Ingeschakeld?" -SHOUT_RECAPTCHAON_DESC="Kies of reCaptcha in- of uitgeschakeld moet worden" SHOUT_RECAPTCHA_PUBLIC_LABEL="Public Key" SHOUT_RECAPTCHA_PUBLIC_DESC="Voer de reCaptcha public key hier in" SHOUT_RECAPTCHA_PRIVATE_LABEL="Private Key" diff --git a/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini b/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini index 2811634..e5a0f56 100644 --- a/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini +++ b/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini @@ -71,13 +71,13 @@ SHOUT_REMAINING="znaków do wpisania" SHOUT_NOSCRIPT_THERE_IS_A="Pozostało " SHOUT_NOSCRIPT_CHARS_LIMIT=" znaków" SHOUT_SECURITY="Zabezpieczenia" -SHOUT_SECURITY_QUESTION_LABEL="Pytanie zabezpieczające" -SHOUT_SECURITY_QUESTION_DESC="Wybierz, czy chcesz użyć matematyczne pytanie zabezpieczające. Zauważ, że nie można go użyć jednocześnie z reCAPTCHA" +SHOUT_SECURITY_TYPE="Security Type" +SHOUT_SECURITY_TYPE_DESC="Select whether you would like to use reCAPTCHA or a simple maths question" +SHOUT_NONE="None" +SHOUT_RECAPTCHA="reCAPTCHA" +SHOUT_MATHS_QUESTION="Maths Question" SHOUT_ANSWER_INCORRECT="Niepoprawna odpowiedź na pytanie zabezpieczające. Spróbuj jeszcze raz." -SHOUT_BOTH_SECURITY_ENABLED="Pytanie zabezpieczające i reCAPTCHA nie mogą być aktywne jednocześnie." SHOUT_RECAPTURE_CORRECT="Poprawnie!" -SHOUT_RECAPTCHAON_LABEL="Włączyć reCAPTCHA?" -SHOUT_RECAPTCHAON_DESC="Wybierz czy chcesz włączyć reCAPTCHA czy nie" SHOUT_RECAPTCHA_PUBLIC_LABEL="Klucz publiczny" SHOUT_RECAPTCHA_PUBLIC_DESC="Tu wprowadź klucz publiczny reCAPTCHA" SHOUT_RECAPTCHA_PRIVATE_LABEL="Klucz prywatny" diff --git a/mod_shoutbox/media/js/mod_shoutbox.js b/mod_shoutbox/media/js/mod_shoutbox.js index c486416..d70ae0f 100644 --- a/mod_shoutbox/media/js/mod_shoutbox.js +++ b/mod_shoutbox/media/js/mod_shoutbox.js @@ -102,7 +102,7 @@ jQuery(document).ready(function($) { // SUBMIT POST - submitPost = function(name, title, recaptcha, maths, security, root) + submitPost = function(name, title, securityType, security, root) { // Assemble some commonly used vars var textarea = $('#jj_message'), @@ -137,13 +137,13 @@ jQuery(document).ready(function($) { request[security] = 1; - if (recaptcha) + if (securityType == 1) { request['recaptcha_challenge_field'] = $('input#recaptcha_challenge_field').val(); request['recaptcha_response_field'] = $('input#recaptcha_response_field').val(); } - if (maths) + if (securityType == 2) { request['jjshout[sum1]'] = $('input[name="jjshout[sum1]"]').val(); request['jjshout[sum2]'] = $('input[name="jjshout[sum2]"]').val(); @@ -177,13 +177,13 @@ jQuery(document).ready(function($) { }); // Valid or not refresh recaptcha - if (recaptcha) + if (securityType == 1) { Recaptcha.reload(); } // Valid or not refresh maths values and empty answer - if (maths) + if (securityType == 2) { var val1, val2; val1 = getRandomArbitrary(0,9); diff --git a/mod_shoutbox/mod_shoutbox.php b/mod_shoutbox/mod_shoutbox.php index ecb66ed..57a16db 100644 --- a/mod_shoutbox/mod_shoutbox.php +++ b/mod_shoutbox/mod_shoutbox.php @@ -24,8 +24,9 @@ $nonmembers = $params->get('nonmembers'); $profile = $params->get('profile'); $date = $params->get('date'); -$recaptcha = $params->get('recaptchaon', 0); -$securityQuestion = $params->get('securityquestion', 0); +$securitytype = $params->get('securitytype', 0); +$publicKey = $params->get('recaptcha-public'); +$privateKey = $params->get('recaptcha-private'); $mass_delete = $params->get('mass_delete', 0); $permissions = $params->get('guestpost'); $deletecolor = $params->get('deletecolor', '#FF0000'); @@ -40,13 +41,6 @@ $refresh = $params->get('refresh', 10) * 1000; $remainingLength = JText::_('SHOUT_REMAINING'); -// Shows warning if both security questions are enabled and logs to error file. -if ($recaptcha == 1 && $securityQuestion == 1) -{ - JLog::add(JText::_('SHOUT_BOTH_SECURITY_ENABLED'), JLog::CRITICAL, 'mod_shoutbox'); - $app->enqueueMessage(JText::_('SHOUT_BOTH_SECURITY_ENABLED'), 'error'); -} - // Assemble the factory variables needed $doc = JFactory::getDocument(); $user = JFactory::getUser(); diff --git a/mod_shoutbox/mod_shoutbox.xml b/mod_shoutbox/mod_shoutbox.xml index d4e913c..194ed81 100644 --- a/mod_shoutbox/mod_shoutbox.xml +++ b/mod_shoutbox/mod_shoutbox.xml @@ -7,7 +7,7 @@ http://www.gnu.org/licenses/gpl-3.0.html admin@joomjunk.co.uk http://www.joomjunk.co.uk - 3.0.0-beta1 + 3.0.0-beta2 JJSHOUTBOX_DESCRIPTION @@ -120,18 +120,15 @@ -
- - - - +
+ + + + + - - - - - - + +
diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 857ccd8..eb37d07 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -131,17 +131,17 @@ get('recaptcha-public') == '' || $params->get('recaptcha-private') == '') + if ($publicKey == '' || $privateKey == '') { echo JText::_('SHOUT_RECAPTCHA_KEY_ERROR'); } else { - $publickey = $params->get('recaptcha-public'); + $publickey = $publicKey; if (!isset($resp)) { @@ -158,7 +158,7 @@ } ?> - + randomnumber(1); ?> randomnumber(1); ?> @@ -167,7 +167,7 @@ - get('recaptcha-public')) || ($recaptcha == 1 && !$params->get('recaptcha-private')) || ($recaptcha == 1 && $securityQuestion == 1)) { echo 'disabled="disabled"'; }?> /> + /> - submitPost(name, '', , , '', ''); + submitPost(name, '', , '', ''); return false; }); }); - // Refresh the shoutbox posts every 10 seconds - TODO: Time should probably be a parameter as the will increase server resources doing this + // Refresh the shoutbox posts every X seconds setInterval(function(){ getPosts('', ''); }, ); From 60bce97ccbfc3abaf98d6b287ab600d49213ab38 Mon Sep 17 00:00:00 2001 From: Lodder Date: Sat, 24 Jan 2015 16:37:37 +0000 Subject: [PATCH 37/71] fixed Kunena profile link for logged out users --- mod_shoutbox/helper.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php index 1e7e83c..3e5ebc4 100644 --- a/mod_shoutbox/helper.php +++ b/mod_shoutbox/helper.php @@ -545,7 +545,14 @@ public function linkUser($profile, $name, $user_id) // Kunena Profile Link if (class_exists('KunenaFactory') && class_exists('KunenaProfileKunena')) { $kUser = KunenaFactory::getUser()->userid; - $kLink = KunenaProfileKunena::getProfileURL($kUser); + if($kUser != 0) + { + $kLink = KunenaProfileKunena::getProfileURL($kUser); + } + else + { + $kLink = JRoute::_('index.php?option=com_kunena&view=user&userid=' . $user_id . '&Itemid='); + } } else { $kLink = null; From 511f5328325c12c4c414c00fb566a843f4340ac6 Mon Sep 17 00:00:00 2001 From: Lodder Date: Sun, 25 Jan 2015 11:48:05 +0000 Subject: [PATCH 38/71] improved HTML markup + CSS + added sep styling tab --- mod_shoutbox/fields/fade.php | 2 + .../language/en-GB/en-GB.mod_shoutbox.ini | 2 +- .../language/it-IT/it-IT.mod_shoutbox.ini | 2 +- .../language/nl-NL/nl_NL.mod_shoutbox.ini | 2 +- .../language/pl-PL/pl-PL.mod_shoutbox.ini | 2 +- mod_shoutbox/media/css/mod_shoutbox.css | 85 +++++++++++++------ mod_shoutbox/mod_shoutbox.xml | 27 +++--- mod_shoutbox/tmpl/default.php | 2 +- mod_shoutbox/tmpl/default_message.php | 6 +- 9 files changed, 81 insertions(+), 49 deletions(-) diff --git a/mod_shoutbox/fields/fade.php b/mod_shoutbox/fields/fade.php index 73dbf0f..b753820 100644 --- a/mod_shoutbox/fields/fade.php +++ b/mod_shoutbox/fields/fade.php @@ -61,6 +61,8 @@ protected function getLabel() '; $doc->addScriptDeclaration($js); + + return "
"; } diff --git a/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini b/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini index ccbf4be..d9dfe4b 100644 --- a/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini +++ b/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini @@ -70,7 +70,7 @@ SHOUT_ERRORMESSAGE="There has been a error - please try posting again" SHOUT_REMAINING="characters remaining" SHOUT_NOSCRIPT_THERE_IS_A="There is a " SHOUT_NOSCRIPT_CHARS_LIMIT=" character limit" -SHOUT_SECURITY="Security" +SHOUT_STYLING="Styling" SHOUT_SECURITY_TYPE="Security Type" SHOUT_SECURITY_TYPE_DESC="Select whether you would like to use reCAPTCHA or a simple maths question" SHOUT_NONE="None" diff --git a/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini b/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini index b15469c..35c5b26 100644 --- a/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini +++ b/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini @@ -70,7 +70,7 @@ SHOUT_ERRORMESSAGE="C'è stato un errore - riprova la pubblicazione di nuovo" SHOUT_REMAINING="caratteri rimasti" SHOUT_NOSCRIPT_THERE_IS_A="C'è un " SHOUT_NOSCRIPT_CHARS_LIMIT=" limite caratteri" -SHOUT_SECURITY="Sicurezza" +SHOUT_STYLING="Styling" SHOUT_SECURITY_TYPE="Security Type" SHOUT_SECURITY_TYPE_DESC="Select whether you would like to use reCAPTCHA or a simple maths question" SHOUT_NONE="None" diff --git a/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini b/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini index 2e5ff32..a67d2cd 100644 --- a/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini +++ b/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini @@ -70,7 +70,7 @@ SHOUT_ERRORMESSAGE="Er is een fout opgetreden - Probeer het later nog eens" SHOUT_REMAINING="tekens over" SHOUT_NOSCRIPT_THERE_IS_A="Er is een" SHOUT_NOSCRIPT_CHARS_LIMIT="tekens limiet" -SHOUT_SECURITY="Beveiliging" +SHOUT_STYLING="Styling" SHOUT_SECURITY_TYPE="Security Type" SHOUT_SECURITY_TYPE_DESC="Select whether you would like to use reCAPTCHA or a simple maths question" SHOUT_NONE="None" diff --git a/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini b/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini index e5a0f56..9264056 100644 --- a/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini +++ b/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini @@ -70,7 +70,7 @@ SHOUT_ERRORMESSAGE="Wystąpił błąd - spróbuj jeszcze raz" SHOUT_REMAINING="znaków do wpisania" SHOUT_NOSCRIPT_THERE_IS_A="Pozostało " SHOUT_NOSCRIPT_CHARS_LIMIT=" znaków" -SHOUT_SECURITY="Zabezpieczenia" +SHOUT_STYLING="Styling" SHOUT_SECURITY_TYPE="Security Type" SHOUT_SECURITY_TYPE_DESC="Select whether you would like to use reCAPTCHA or a simple maths question" SHOUT_NONE="None" diff --git a/mod_shoutbox/media/css/mod_shoutbox.css b/mod_shoutbox/media/css/mod_shoutbox.css index 6c7d949..bd75e9c 100644 --- a/mod_shoutbox/media/css/mod_shoutbox.css +++ b/mod_shoutbox/media/css/mod_shoutbox.css @@ -4,18 +4,27 @@ * @license GPL v3.0 or later http://www.gnu.org/licenses/gpl-3.0.html */ -#jjshoutbox { margin: auto; } -#jjshoutboxform { margin: 0 auto; } +#jjshoutbox { + margin: auto; + width: 100%; +} +#jjshoutboxform { + margin: 0 auto; +} +#jjshoutbox > div, +#jjshoutbox textarea, +#jjshoutbox input { + box-sizing: border-box; +} #jjshoutboxform textarea { width: 100%; margin: 5px 0 0 0; - padding: 4px 0; } #jjshoutboxform input { margin-top: 5px; color: #000; width: 100%; - padding: 5px 0; + min-height: 30px; } #jjshoutboxoutput { height: 200px; @@ -26,29 +35,32 @@ margin-top: 5px; word-wrap: break-word; } -#jjshoutboxoutput div { - padding-bottom: 5px; -} -#jjshoutboxoutput input[type=submit]{ +#jjshoutboxoutput input[type=submit] { cursor: pointer; text-align: center; - font: bold 10px Arial, Helvetica, sans-serif; + font-family: inherit; + font-weight: bold; + font-size: 10px; text-decoration: none; background: none; padding: 0; margin: 0; border: 0; height: 15px; + vertical-align: top; } -#jjshoutboxoutput div h1 { - font-size: 12px; +#jjshoutboxoutput .shout-header { font-family: inherit; + font-size: 12px; + font-weight: bold; color: #000; text-transform: none; - margin: 8px 0; - line-height: 125%; + margin: 8px 0 0; + padding: 0 0 0 5px; + height: 20px; + line-height: 20px; } -#jjshoutboxoutput div h1 form { +#jjshoutboxoutput div form { display: inline-block; margin: 0; } @@ -57,13 +69,28 @@ font-family: inherit; text-align: left; color: #000; - margin: 5px 0; + margin: 5px 0 10px; + padding: 0 0 0 5px; +} +#noguest { + color: #FF0000; + font-weight: bold; +} +#jjshoutbox .jj_error { + color:red; + font-weight:bold; +} +#jjshoutbox .jj_label { + width: 70px; + display: inline-block; +} +#jjshoutbox .jj_input { + width: 80px; + display: inline-block; +} +#jjshoutbox .jj_admin_label { + width: 30%; } -#noguest { color: #FF0000; font-weight: bold; } -#jjshoutbox .jj_error { color:red; font-weight:bold; } -#jjshoutbox .jj_label { width: 70px; display: inline-block; } -#jjshoutbox .jj_input { width: 80px; display: inline-block; } -#jjshoutbox .jj_admin_label { width: 30%; } #jjshoutbox .jj_admin_button { width: 65%; min-width: 90px; @@ -72,17 +99,17 @@ border: 1px solid #CC0000; cursor: pointer; } -#jj_smiley_box{ +#jj_smiley_box { margin: 10px 0 10px 0; } -#jj_smiley_box img{ +#jj_smiley_box img { cursor: pointer; } -#jj_smiley_button{ +#jj_smiley_button { margin: 5px 0 0 0; float:right; } -#jj_btn{ +#jj_btn { display: block; cursor: pointer; padding: 2px 5px !important; @@ -99,10 +126,12 @@ } .jj_smiley { padding: 0 2px 0 2px; - border:none; + border: none; } -.outter_jj_smiley:hover { +#jj_smiley_box img:hover { background:none !important; + border: 0; + outline: 0; } #jjshoutboxform[type='number'] { padding: 4px 0px; @@ -111,11 +140,11 @@ /** Non-bootstrap styling for BB Code **/ -#jjshoutbox #jj_smiley_box{ +#jjshoutbox #jj_smiley_box { margin: 5px 0 10px; white-space: normal; } -#jjshoutbox #jj_smiley_box img{ +#jjshoutbox #jj_smiley_box img { cursor: pointer; padding: 2px; border:none; diff --git a/mod_shoutbox/mod_shoutbox.xml b/mod_shoutbox/mod_shoutbox.xml index 194ed81..a61ce01 100644 --- a/mod_shoutbox/mod_shoutbox.xml +++ b/mod_shoutbox/mod_shoutbox.xml @@ -7,7 +7,7 @@ http://www.gnu.org/licenses/gpl-3.0.html admin@joomjunk.co.uk http://www.joomjunk.co.uk - 3.0.0-beta2 + 3.0.0-beta1 JJSHOUTBOX_DESCRIPTION @@ -94,10 +94,6 @@ - - - - @@ -120,7 +116,18 @@
-
+
+ + + + +
+ +
+ + + + @@ -129,13 +136,7 @@ -
- -
- - - - +
diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index eb37d07..96db87b 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -12,7 +12,7 @@ border-color: ' . $bordercolour . '; border-width: ' . $borderwidth . 'px; } - #jjshoutboxoutput div h1 { + #jjshoutboxoutput .shout-header { background: ' . $headercolor . '; }'; diff --git a/mod_shoutbox/tmpl/default_message.php b/mod_shoutbox/tmpl/default_message.php index 2630fd7..0b5fe28 100644 --- a/mod_shoutbox/tmpl/default_message.php +++ b/mod_shoutbox/tmpl/default_message.php @@ -10,8 +10,8 @@ $user = JFactory::getUser(); ?>
- - {USER} - {DATE} +
+ {USER} - {DATE} authorise('core.delete')) : ?>
@@ -19,6 +19,6 @@
- +

{MESSAGE}

\ No newline at end of file From a04c48ab7951b8106c2649981168c013998aa005 Mon Sep 17 00:00:00 2001 From: Lodder Date: Sun, 25 Jan 2015 11:49:49 +0000 Subject: [PATCH 39/71] updated copyright year --- mod_shoutbox/fields/check.php | 2 +- mod_shoutbox/fields/fade.php | 2 +- mod_shoutbox/helper.php | 2 +- mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini | 10 +++++----- .../language/en-GB/en-GB.mod_shoutbox.sys.ini | 2 +- mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini | 10 +++++----- .../language/it-IT/it-IT.mod_shoutbox.sys.ini | 2 +- mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini | 10 +++++----- .../language/nl-NL/nl_NL.mod_shoutbox.sys.ini | 2 +- mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini | 14 +++++++------- .../language/pl-PL/pl-PL.mod_shoutbox.sys.ini | 6 +++--- mod_shoutbox/media/css/mod_shoutbox.css | 2 +- mod_shoutbox/media/js/mod_shoutbox.js | 2 +- mod_shoutbox/mod_shoutbox.php | 2 +- mod_shoutbox/mod_shoutbox.xml | 2 +- mod_shoutbox/script.php | 2 +- mod_shoutbox/swearWords.php | 2 +- mod_shoutbox/tmpl/default.php | 2 +- mod_shoutbox/tmpl/default_message.php | 2 +- 19 files changed, 39 insertions(+), 39 deletions(-) diff --git a/mod_shoutbox/fields/check.php b/mod_shoutbox/fields/check.php index de52a40..b3ec4fa 100644 --- a/mod_shoutbox/fields/check.php +++ b/mod_shoutbox/fields/check.php @@ -1,7 +1,7 @@ JJ Shoutbox JoomJunk 05-Mar-2012 - Copyright (C) 2011 - 2014 JoomJunk + Copyright (C) 2011 - 2015 JoomJunk http://www.gnu.org/licenses/gpl-3.0.html admin@joomjunk.co.uk http://www.joomjunk.co.uk diff --git a/mod_shoutbox/script.php b/mod_shoutbox/script.php index 3f6f459..9ba577f 100644 --- a/mod_shoutbox/script.php +++ b/mod_shoutbox/script.php @@ -1,7 +1,7 @@ Date: Sun, 25 Jan 2015 11:55:39 +0000 Subject: [PATCH 40/71] BBCode button text now language strings --- mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini | 6 +++++- mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini | 7 +++++-- mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini | 4 ++++ mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini | 6 +++++- mod_shoutbox/tmpl/default.php | 8 ++++---- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini b/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini index 89fd2f8..a524505 100644 --- a/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini +++ b/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini @@ -101,4 +101,8 @@ SHOUT_SWEAR_FILE_NOT_FOUND="The swear filter file cannot be found" SHOUT_DATABASE_ERROR="There has been a database error: %s" SHOUT_MASS_DELETE_OPTION="Mass Delete Button" SHOUT_MASS_DELETE_OPTION_DESC="Select whether or not you would like to display the Mass Delete function (only admins can see this)" -WARNING_FREICHAT_IS_INSTALLED="Freichat appears to exist on your site. There are known conflicts with JJ Shoutbox and Freichat, therefore you cannot have both extensions installed." \ No newline at end of file +WARNING_FREICHAT_IS_INSTALLED="Freichat appears to exist on your site. There are known conflicts with JJ Shoutbox and Freichat, therefore you cannot have both extensions installed." +SHOUT_BBCODE_BOLD="B" +SHOUT_BBCODE_ITALIC="I" +SHOUT_BBCODE_UNDERLINE="U" +SHOUT_BBCODE_LINK="Link" \ No newline at end of file diff --git a/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini b/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini index 52cfada..91bf145 100644 --- a/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini +++ b/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini @@ -94,7 +94,6 @@ SHOUT_K2_BLOG_USERS="K2 - Blog" SHOUT_NO_USERS="Nessuno" SHOUT_LINK_PROFILE_ALLOW="Permetti agli ospiti di vedere il profilo" SHOUT_LINK_PROFILE_ALLOWDESC="Selezionare se si desidera consentire agli ospiti di essere in grado di fare clic sul nome agli autori di vedere il loro profilo" - SHOUT_MASS_DELETE="Eliminazione di massa" SHOUT_GREATER_THAN_ZERO="È necessario eliminare più di 0 urli" SHOUT_NOT_INT="È necessario eliminare un numero intero di urli" @@ -102,4 +101,8 @@ SHOUT_SWEAR_FILE_NOT_FOUND="Il file del filtro parolacce non può essere trovato SHOUT_DATABASE_ERROR="C'è stato un errore nel database: %s" SHOUT_MASS_DELETE_OPTION="Bottone cancellazione di massa" SHOUT_MASS_DELETE_OPTION_DESC="Selezionare se si desidera visualizzare la funzione di cancellazione di massa (solo gli amministratori possono vedere questo)" -WARNING_FREICHAT_IS_INSTALLED="Freichat appears to exist on your site. There are known conflicts with JJ Shoutbox and Freichat, therefore you cannot have both extensions installed." \ No newline at end of file +WARNING_FREICHAT_IS_INSTALLED="Freichat appears to exist on your site. There are known conflicts with JJ Shoutbox and Freichat, therefore you cannot have both extensions installed." +SHOUT_BBCODE_BOLD="B" +SHOUT_BBCODE_ITALIC="I" +SHOUT_BBCODE_UNDERLINE="U" +SHOUT_BBCODE_LINK="Link" \ No newline at end of file diff --git a/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini b/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini index 1091c48..58459b2 100644 --- a/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini +++ b/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini @@ -101,3 +101,7 @@ SHOUT_SWEAR_FILE_NOT_FOUND="Het vloekfilter bestand kan niet worden gevonden" SHOUT_DATABASE_ERROR="Er is een database fout : %s" SHOUT_MASS_DELETE_OPTION="Bulk verwijderingsknop" SHOUT_MASS_DELETE_OPTION_DESC="Selecteer of de Bulk Verwijderingsknop functie ingeschakeld moet worden (alleen administrators kunnen dit zien)" +SHOUT_BBCODE_BOLD="B" +SHOUT_BBCODE_ITALIC="I" +SHOUT_BBCODE_UNDERLINE="U" +SHOUT_BBCODE_LINK="Link" \ No newline at end of file diff --git a/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini b/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini index d58fef9..43e688a 100644 --- a/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini +++ b/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini @@ -101,4 +101,8 @@ SHOUT_SWEAR_FILE_NOT_FOUND="Plik z filtrem przekleństw nie został znaleziony" SHOUT_DATABASE_ERROR="Błąd bazy danych: %s" SHOUT_MASS_DELETE_OPTION="Masowe usuwanie wpisów" SHOUT_MASS_DELETE_OPTION_DESC="Wybierz, czy przycisk masowego usuwania wpisów ma być widoczny (tylko dla administratorów)" -WARNING_FREICHAT_IS_INSTALLED="Freichat appears to exist on your site. There are known conflicts with JJ Shoutbox and Freichat, therefore you cannot have both extensions installed." \ No newline at end of file +WARNING_FREICHAT_IS_INSTALLED="Freichat appears to exist on your site. There are known conflicts with JJ Shoutbox and Freichat, therefore you cannot have both extensions installed." +SHOUT_BBCODE_BOLD="B" +SHOUT_BBCODE_ITALIC="I" +SHOUT_BBCODE_UNDERLINE="U" +SHOUT_BBCODE_LINK="Link" \ No newline at end of file diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 5ef9a53..90dcfef 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -112,10 +112,10 @@
- - - - + + + +
From dcf71b0754d3cc3c18d53be5c2e0ae42dbe8cd1a Mon Sep 17 00:00:00 2001 From: Lodder Date: Sun, 25 Jan 2015 12:40:39 +0000 Subject: [PATCH 41/71] improved styling for UIKit based themes --- mod_shoutbox/media/css/mod_shoutbox.css | 2 +- mod_shoutbox/mod_shoutbox.php | 20 ++++++++++++++++++++ mod_shoutbox/tmpl/default.php | 18 +++++++++--------- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/mod_shoutbox/media/css/mod_shoutbox.css b/mod_shoutbox/media/css/mod_shoutbox.css index a14b119..92dc969 100644 --- a/mod_shoutbox/media/css/mod_shoutbox.css +++ b/mod_shoutbox/media/css/mod_shoutbox.css @@ -85,7 +85,7 @@ display: inline-block; } #jjshoutbox .jj_input { - width: 80px; + width: 70px; display: inline-block; } #jjshoutbox .jj_admin_label { diff --git a/mod_shoutbox/mod_shoutbox.php b/mod_shoutbox/mod_shoutbox.php index 9cdf161..9b727cb 100644 --- a/mod_shoutbox/mod_shoutbox.php +++ b/mod_shoutbox/mod_shoutbox.php @@ -46,6 +46,26 @@ $user = JFactory::getUser(); $app = JFactory::getApplication(); + +// Detect a UIKit based theme +$template = $app->getTemplate('template')->template; +$uikit = JPATH_SITE . '/templates/' . $template . '/warp/vendor/uikit/js/uikit.js'; +if(JFile::exists($uikit)) +{ + $form = 'uk-form'; + $button_group = 'uk-button-group'; + $button = 'uk-button'; + $button_danger = ' uk-button-danger'; +} +else +{ + $form = null; + $button_group = 'btn-group'; + $button = 'btn'; + $button_danger = ' btn-danger'; +} + +// Import jQuery if (version_compare(JVERSION, '3.0.0', 'ge')) { JHtml::_('jquery.framework'); diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 90dcfef..9c53f98 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -72,7 +72,7 @@ elseif (array_intersect($permissions, $access)) { ?> -
+ guest) @@ -111,11 +111,11 @@
-
- - - - +
+ + + +
@@ -123,7 +123,7 @@
- +
smileyshow(); ?>
@@ -167,7 +167,7 @@ - /> + />
- +
From b02f02f2358223d0021e9e43906a6c35463bc49b Mon Sep 17 00:00:00 2001 From: Lodder Date: Sun, 25 Jan 2015 12:54:39 +0000 Subject: [PATCH 42/71] fixed Kunena profile link for non-Kunena pages --- mod_shoutbox/helper.php | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php index 73ea2c2..4478d98 100644 --- a/mod_shoutbox/helper.php +++ b/mod_shoutbox/helper.php @@ -543,21 +543,7 @@ public function linkUser($profile, $name, $user_id) elseif ($profile == 2) { // Kunena Profile Link - if (class_exists('KunenaFactory') && class_exists('KunenaProfileKunena')) { - $kUser = KunenaFactory::getUser()->userid; - if($kUser != 0) - { - $kLink = KunenaProfileKunena::getProfileURL($kUser); - } - else - { - $kLink = JRoute::_('index.php?option=com_kunena&view=user&userid=' . $user_id . '&Itemid='); - } - } - else { - $kLink = null; - } - $profile_link = '' . $name . ''; + $profile_link = '' . $name . ''; } elseif ($profile == 3) { From 1b7e58dceaa965be9dab1af2bd2d5ad14a4f8a0f Mon Sep 17 00:00:00 2001 From: Lodder Date: Sun, 25 Jan 2015 17:40:36 +0000 Subject: [PATCH 43/71] markup and styling tweaks --- mod_shoutbox/media/css/mod_shoutbox.css | 5 ++++- mod_shoutbox/tmpl/default.php | 6 ++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mod_shoutbox/media/css/mod_shoutbox.css b/mod_shoutbox/media/css/mod_shoutbox.css index 92dc969..1182c21 100644 --- a/mod_shoutbox/media/css/mod_shoutbox.css +++ b/mod_shoutbox/media/css/mod_shoutbox.css @@ -18,7 +18,7 @@ } #jjshoutboxform textarea { width: 100%; - margin: 5px 0 0 0; + margin: 0; } #jjshoutboxform input { margin-top: 5px; @@ -26,6 +26,9 @@ width: 100%; min-height: 30px; } +#jjshoutboxform p { + margin: 4px 0; +} #jjshoutboxoutput { height: 200px; width: 100%; diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 9c53f98..0f5b236 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -77,11 +77,11 @@ // Displays the Name of the user if logged in unless stated in the parameters to be a input box if ($displayName == 'real' && !$user->guest) { - echo JText::_('SHOUT_NAME') . ":" . $user->name; + echo '

' . JText::_('SHOUT_NAME') . ": " . $user->name . '

'; } elseif ($displayName == 'user' && !$user->guest) { - echo JText::_('SHOUT_NAME') . ":" . $user->username; + echo '

' . JText::_('SHOUT_NAME') . ": " . $user->username . '

'; } elseif ($user->guest||($displayName == 'choose' && !$user->guest)) { @@ -90,8 +90,6 @@ '; - // Adds in session token to prevent re-posts and a security token to prevent CRSF attacks $_SESSION['token'] = uniqid("token", true); echo JHtml::_('form.token'); From edf73aaa4a2bee18a695d396a005845a5d72ef36 Mon Sep 17 00:00:00 2001 From: George Wilson Date: Mon, 26 Jan 2015 23:24:09 +0000 Subject: [PATCH 44/71] Simply the if's --- mod_shoutbox/tmpl/default.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 0f5b236..97d9a39 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -154,16 +154,15 @@ echo recaptcha_get_html($publickey, $error); } } - ?> - - + elseif ($securitytype == 2) + { randomnumber(1); ?> randomnumber(1); ?> - + /> From 01989a67fb0c158c7505d64977712814b3046b96 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sat, 31 Jan 2015 22:18:11 +0000 Subject: [PATCH 45/71] Import jQuery properly on 2.5 --- mod_shoutbox/fields/fade.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mod_shoutbox/fields/fade.php b/mod_shoutbox/fields/fade.php index f09ddc9..6b3c93e 100644 --- a/mod_shoutbox/fields/fade.php +++ b/mod_shoutbox/fields/fade.php @@ -26,7 +26,20 @@ class JFormFieldFade extends JFormField */ protected function getLabel() { - JHtml::_('jquery.framework'); + // Import jQuery + if (version_compare(JVERSION, '3.0.0', 'ge')) + { + JHtml::_('jquery.framework'); + } + else + { + if (!$app->get('jquery')) + { + $app->set('jquery', true); + $doc->addScript('//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js'); + JHtml::_('script', 'mod_shoutbox/jquery-conflict.js', false, true); + } + } $doc = JFactory::getDocument(); From 742481fa544f0db23e84a71c94f75e49933939ae Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sat, 31 Jan 2015 22:19:50 +0000 Subject: [PATCH 46/71] Copy paste fail in importing jQuery --- mod_shoutbox/fields/fade.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mod_shoutbox/fields/fade.php b/mod_shoutbox/fields/fade.php index 6b3c93e..d433a1b 100644 --- a/mod_shoutbox/fields/fade.php +++ b/mod_shoutbox/fields/fade.php @@ -33,6 +33,8 @@ protected function getLabel() } else { + $app = JFactory::getApplication(); + if (!$app->get('jquery')) { $app->set('jquery', true); From df682bfe31ee10bc2d1768e55818e1e4276b386c Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sat, 31 Jan 2015 22:20:58 +0000 Subject: [PATCH 47/71] One day I'll get the import correct --- mod_shoutbox/fields/fade.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mod_shoutbox/fields/fade.php b/mod_shoutbox/fields/fade.php index d433a1b..e0ffd2c 100644 --- a/mod_shoutbox/fields/fade.php +++ b/mod_shoutbox/fields/fade.php @@ -26,6 +26,9 @@ class JFormFieldFade extends JFormField */ protected function getLabel() { + $doc = JFactory::getDocument(); + $app = JFactory::getApplication(); + // Import jQuery if (version_compare(JVERSION, '3.0.0', 'ge')) { @@ -33,8 +36,6 @@ protected function getLabel() } else { - $app = JFactory::getApplication(); - if (!$app->get('jquery')) { $app->set('jquery', true); @@ -43,7 +44,6 @@ protected function getLabel() } } - $doc = JFactory::getDocument(); $js = ' jQuery(document).ready(function($) { From 23c10b0956311b0e8d84c2efe8ad420ca1e21476 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sat, 31 Jan 2015 22:30:11 +0000 Subject: [PATCH 48/71] Fix fade field on Joomla 2.5 --- mod_shoutbox/fields/fade.php | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/mod_shoutbox/fields/fade.php b/mod_shoutbox/fields/fade.php index e0ffd2c..03c187c 100644 --- a/mod_shoutbox/fields/fade.php +++ b/mod_shoutbox/fields/fade.php @@ -43,22 +43,32 @@ protected function getLabel() JHtml::_('script', 'mod_shoutbox/jquery-conflict.js', false, true); } } + + if (version_compare(JVERSION, '3.0.0', 'ge')) + { + $parent = '.control-group'; + } + else + { + $parent = 'li'; + } $js = ' jQuery(document).ready(function($) { - + var select = $("#jform_params_securitytype"); - var public = $("#jform_params_recaptcha_public-lbl").parents(".control-group"); - var private = $("#jform_params_recaptcha_private-lbl").parents(".control-group"); + + var public = $("#jform_params_recaptcha_public-lbl").parents("' . $parent . '"); + var private = $("#jform_params_recaptcha_private-lbl").parents("' . $parent . '"); if( select.val() == 0 || select.val() == 2 ) { public.hide(); private.hide(); } - + select.on("change", function() { - + var value = this.value; if( value == 0 || value == 2 ) { @@ -69,16 +79,20 @@ protected function getLabel() public.fadeIn(); private.fadeIn(); } - + }); - + }); '; - + $doc->addScriptDeclaration($js); - - return "
"; + if (version_compare(JVERSION, '3.0.0', 'ge')) + { + return '
'; + } + + return ''; } /** From a4f1833fa919de7e29cd6f6d7e2a9476e3cea2df Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sat, 31 Jan 2015 22:36:43 +0000 Subject: [PATCH 49/71] Namespace form fields --- mod_shoutbox/fields/check.php | 2 +- mod_shoutbox/fields/fade.php | 4 ++-- mod_shoutbox/mod_shoutbox.xml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mod_shoutbox/fields/check.php b/mod_shoutbox/fields/check.php index b3ec4fa..1709470 100644 --- a/mod_shoutbox/fields/check.php +++ b/mod_shoutbox/fields/check.php @@ -14,7 +14,7 @@ * @package JJ_Shoutbox * @since 2.0.0 */ -class JFormFieldCheck extends JFormField +class ShoutboxFormFieldCheck extends JFormField { /** * @var string diff --git a/mod_shoutbox/fields/fade.php b/mod_shoutbox/fields/fade.php index 03c187c..864b457 100644 --- a/mod_shoutbox/fields/fade.php +++ b/mod_shoutbox/fields/fade.php @@ -14,12 +14,12 @@ * @package JJ_Shoutbox * @since 3.0.0 */ -class JFormFieldFade extends JFormField +class ShoutboxFormFieldFade extends JFormField { /** * @var string */ - protected $type = 'Fade'; + protected $type = 'fade'; /** * @return string diff --git a/mod_shoutbox/mod_shoutbox.xml b/mod_shoutbox/mod_shoutbox.xml index 1e7efab..bdae80d 100644 --- a/mod_shoutbox/mod_shoutbox.xml +++ b/mod_shoutbox/mod_shoutbox.xml @@ -113,7 +113,7 @@ - +
@@ -135,7 +135,7 @@ - +
From 04e12209c29b6c3f840df81a33193a6593ce5a4a Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sat, 31 Jan 2015 22:45:41 +0000 Subject: [PATCH 50/71] Fix fatal error --- mod_shoutbox/tmpl/default.php | 1 + 1 file changed, 1 insertion(+) diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 97d9a39..9bb46ff 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -156,6 +156,7 @@ } elseif ($securitytype == 2) { + ?> randomnumber(1); ?> randomnumber(1); ?> From d0d00836c404342715abe0e5f1012abe7bbc002a Mon Sep 17 00:00:00 2001 From: Lodder Date: Sun, 1 Feb 2015 11:58:35 +0000 Subject: [PATCH 51/71] Update changelog.php --- changelog.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/changelog.php b/changelog.php index 3551eed..ab9cd48 100644 --- a/changelog.php +++ b/changelog.php @@ -15,7 +15,13 @@ ! -> Note Version 3.0.0 -+ Add AJAX submission of content ++ Integrated AJAX for submittin and retreiving posts ++ Initially hide smilies with toggle option ++ Added Bootstrap and UIKit styling support +# Fixed Freichat conflict +# Fixed Kunena profile links +^ Enhanced HTML markup +^ Other small PHP anhancements Version 2.0.1 - Removed a lot of word from swearwords.php From c3cbe7f6cd2a925a24fbf7eb212785a7e8e23e18 Mon Sep 17 00:00:00 2001 From: Lodder Date: Sun, 1 Feb 2015 12:26:51 +0000 Subject: [PATCH 52/71] populate new securitytype param from old value --- mod_shoutbox/script.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/mod_shoutbox/script.php b/mod_shoutbox/script.php index 9ba577f..821be3b 100644 --- a/mod_shoutbox/script.php +++ b/mod_shoutbox/script.php @@ -466,8 +466,26 @@ protected function update300() $newParams['loginname'] = 'choose'; } + + // Apply security param value to new securitytype param + $recaptcha = $this->getParam('recaptcha', $module); + $question = $this->getParam('securityquestion', $module); + + if ($recaptcha == 0) + { + $newParams['securitytype'] = 1; + } + elseif ($question == 0) + { + $newParams['securitytype'] = 2; + } + else + { + $newParams['securitytype'] = 0; + } + // To standardise off is 0 and on is 1. Swap some field names around. - $params = array('bbcode', 'swearingcounter', 'recaptchaon', 'securityquestion', 'mass_delete'); + $params = array('bbcode', 'swearingcounter', 'mass_delete'); foreach ($params as $paramName) { @@ -483,6 +501,7 @@ protected function update300() $newParams[$paramName] = 0; } } + // Set the param values $this->setParams($newParams, 'edit', $module); @@ -493,6 +512,4 @@ protected function update300() } } - - } From b0a911857cebbab2281632bcabafae1d2ce509c2 Mon Sep 17 00:00:00 2001 From: Lodder Date: Sun, 1 Feb 2015 12:28:45 +0000 Subject: [PATCH 53/71] removed freichat check --- mod_shoutbox/fields/check.php | 65 ----------------------------------- mod_shoutbox/mod_shoutbox.xml | 3 +- 2 files changed, 1 insertion(+), 67 deletions(-) delete mode 100644 mod_shoutbox/fields/check.php diff --git a/mod_shoutbox/fields/check.php b/mod_shoutbox/fields/check.php deleted file mode 100644 index 1709470..0000000 --- a/mod_shoutbox/fields/check.php +++ /dev/null @@ -1,65 +0,0 @@ -getQuery(true); - - $query->select(array('*')) - ->from($db->quoteName('#__extensions')) - ->where($db->quoteName('element') . ' = '. $db->quote('mod_freichatx')); - - $db->setQuery($query); - $result = $db->loadObjectList(); - - if($result) - { - // Detect Joomla version and render the message - if (version_compare(JVERSION, '3.0.0', 'ge')) - { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::_('WARNING_FREICHAT_IS_INSTALLED'), 'warning'); - } - else - { - return JError::raiseNotice( 100, JText::_('WARNING_FREICHAT_IS_INSTALLED') ); - } - } - - } - - /** - * @return mixed - */ - protected function getInput() - { - return; - } - -} diff --git a/mod_shoutbox/mod_shoutbox.xml b/mod_shoutbox/mod_shoutbox.xml index bdae80d..94cecc1 100644 --- a/mod_shoutbox/mod_shoutbox.xml +++ b/mod_shoutbox/mod_shoutbox.xml @@ -68,7 +68,7 @@ -
+
@@ -113,7 +113,6 @@ -
From 93b95e14f5dfb8432a201f86db62e9918208b9eb Mon Sep 17 00:00:00 2001 From: Lodder Date: Sun, 1 Feb 2015 15:42:12 +0000 Subject: [PATCH 54/71] play sound notification when new shout is displayed --- .../language/en-GB/en-GB.mod_shoutbox.ini | 2 ++ .../language/it-IT/it-IT.mod_shoutbox.ini | 2 ++ .../language/nl-NL/nl_NL.mod_shoutbox.ini | 2 ++ .../language/pl-PL/pl-PL.mod_shoutbox.ini | 2 ++ mod_shoutbox/media/js/mod_shoutbox.js | 8 +++++++- mod_shoutbox/media/sounds/pop.mp3 | Bin 0 -> 5041 bytes mod_shoutbox/mod_shoutbox.php | 1 + mod_shoutbox/mod_shoutbox.xml | 7 ++++++- mod_shoutbox/tmpl/default.php | 9 ++++++++- 9 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 mod_shoutbox/media/sounds/pop.mp3 diff --git a/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini b/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini index a524505..68c5cc6 100644 --- a/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini +++ b/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini @@ -61,6 +61,8 @@ SHOUT_SMILIES_ON_FIXED="Enable and show" SHOUT_SMILIES_ON_SLIDE_HIDE="SlideToggle (Hide at first)" SHOUT_SMILIES_ON_SLIDE_SHOW="SlideToggle (Show at first)" SHOUT_SMILIES_DISABLE="Disable" +SHOUT_SOUNDLABEL="Sound Notifications" +SHOUT_SOUNDDESC="Select whether or not you would like a sound notification when there's a new shout" SHOUT_BBCODELABEL="BBCode" SHOUT_BBCODEDESC="Select whether you would like to enable BBCode" SHOUT_DATABASEERRORSHOUT="There has been a database error" diff --git a/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini b/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini index 91bf145..c143030 100644 --- a/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini +++ b/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini @@ -61,6 +61,8 @@ SHOUT_SMILIES_ON_FIXED="Attiva e visualizza" SHOUT_SMILIES_ON_SLIDE_HIDE="Togli-slide (Hide at first)" SHOUT_SMILIES_ON_SLIDE_SHOW="Togli-slide (Show at first)" SHOUT_SMILIES_DISABLE="Disabilita" +SHOUT_SOUNDLABEL="Sound Notifications" +SHOUT_SOUNDDESC="Select whether or not you would like a sound notification when there's a new shout" SHOUT_BBCODELABEL="BBCode" SHOUT_BBCODEDESC="Select whether you would like to enable BBCode" SHOUT_DATABASEERRORSHOUT="C'è stato un errore nel database" diff --git a/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini b/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini index 58459b2..e956783 100644 --- a/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini +++ b/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini @@ -61,6 +61,8 @@ SHOUT_SMILIES_ON_FIXED="Inschakelen en laten zien" SHOUT_SMILIES_ON_SLIDE_HIDE="SlideToggle (Hide at first)" SHOUT_SMILIES_ON_SLIDE_SHOW="SlideToggle (Show at first)" SHOUT_SMILIES_DISABLE="Uitschakelen" +SHOUT_SOUNDLABEL="Sound Notifications" +SHOUT_SOUNDDESC="Select whether or not you would like a sound notification when there's a new shout" SHOUT_BBCODELABEL="BBCode" SHOUT_BBCODEDESC="Select whether you would like to enable BBCode" SHOUT_DATABASEERRORSHOUT="Er is een database fout" diff --git a/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini b/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini index 43e688a..5301002 100644 --- a/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini +++ b/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini @@ -61,6 +61,8 @@ SHOUT_SMILIES_ON_FIXED="Włączone" SHOUT_SMILIES_ON_SLIDE_HIDE="SlideToggle (Hide at first)" SHOUT_SMILIES_ON_SLIDE_SHOW="SlideToggle (Show at first)" SHOUT_SMILIES_DISABLE="Wyłączone" +SHOUT_SOUNDLABEL="Sound Notifications" +SHOUT_SOUNDDESC="Select whether or not you would like a sound notification when there's a new shout" SHOUT_BBCODELABEL="BBCode" SHOUT_BBCODEDESC="Select whether you would like to enable BBCode" SHOUT_DATABASEERRORSHOUT="Wystąpił błąd bazy danych" diff --git a/mod_shoutbox/media/js/mod_shoutbox.js b/mod_shoutbox/media/js/mod_shoutbox.js index 3ed1dc2..5266894 100644 --- a/mod_shoutbox/media/js/mod_shoutbox.js +++ b/mod_shoutbox/media/js/mod_shoutbox.js @@ -199,7 +199,7 @@ jQuery(document).ready(function($) { // GET POSTS - getPosts = function(title, root) + getPosts = function(title, root, sound) { // Assemble variables to submit var request = { @@ -218,6 +218,12 @@ jQuery(document).ready(function($) { // Grab the html output and append it to the shoutbox message $('.jj-shout-error').after(response.data.html); + + // Play notification sound if enabled + if (sound == 1) + { + document.getElementById('jjshoutbox-audio').play(); + } } }, error:function(ts){ diff --git a/mod_shoutbox/media/sounds/pop.mp3 b/mod_shoutbox/media/sounds/pop.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..d56da5f2d4ea50ec28a0ea9763ab9d12f789196e GIT binary patch literal 5041 zcmeZtF=l1}0satYe?K723d9Vm)28Wd#Gx${duSuM`(@}J^GS+r)klWL5AC@dx^3?h#U&LLTy!g5$=F-bg zEmc+R`q*()-FW%(^Pz8_ePCu_sekzMALBoUgoM8K54Jxf8~Xd%rZzY)SDtuMb=tNb zRtFy`rVd3`2Hi`qBq~`xu6X%;My^O;w|BLKakF9TjR_Je+lTq)+)nKoHDX||zpqr{U|Ly?m{ldi?|zgo4k`$1x6-8I3D#$jC1QOctX8ogN z3(q5ekBD46SRQ|D&xhmb_dR4!H_NzRk}Z575gb!L*ZuF)A7^jgT)DF3T(PO)+N|vl z&%K`guIlN-qYRA-0s#RYDq>tm6C0Sg3=~ar6Xw6-XlkA3DE{;4NBP*Ke_TxeXWiNG z^l8}qFAOT)T0W^ung9Rt+GZNH>`b9n3~S*3|Hdam)f}0d7)8#6hRzVN|Ns99d!SL% zbPu7F!*k2hr1_ri|NsA)BjcpxgjEre0t`VV3s?TkF%IGcCgu;^-Dwid0!I==wVhpp z-q#t2?hacgUJsP{qsQW}q#&TYKyP=Do|dtW(8i}d*J4+P^L)Awl>PtzgzQWebG^2N zRg)@nj0L)n?FWm331AGxz53sv>O0Xn@(qKu_Ueps^9Cn`{3vUnLjV{5 zGKf-cpj|a;KOzKxF%*&fzrip8r5-}akFo|j1V&?MpksiL{i88ND1-)Del&&#ItB>Y uKN>@XLTI4nM`LK9V}OwTqcKD%gplNcqb_s@pfLq3t!=uyW7I-iApij2>w63U literal 0 HcmV?d00001 diff --git a/mod_shoutbox/mod_shoutbox.php b/mod_shoutbox/mod_shoutbox.php index 9b727cb..de0daf5 100644 --- a/mod_shoutbox/mod_shoutbox.php +++ b/mod_shoutbox/mod_shoutbox.php @@ -34,6 +34,7 @@ $borderwidth = $params->get('borderwidth', '1'); $headercolor = $params->get('headercolor', '#D0D0D0'); $bbcode = $params->get('bbcode', 1); +$sound = $params->get('sound', 1); $genericName = $params->get('genericname'); $alertLength = $params->get('alertlength', '50'); $warnLength = $params->get('warnlength', '10'); diff --git a/mod_shoutbox/mod_shoutbox.xml b/mod_shoutbox/mod_shoutbox.xml index 94cecc1..32800ec 100644 --- a/mod_shoutbox/mod_shoutbox.xml +++ b/mod_shoutbox/mod_shoutbox.xml @@ -39,6 +39,7 @@ images js recaptcha + sounds @@ -91,7 +92,11 @@ - + + + + + diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 9bb46ff..7181f33 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -50,6 +50,13 @@
+ + + + +
', ''); + getPosts('', '', ''); }, ); From 4467c5c42708b9fd33dd84af5807adedc1277d35 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sun, 1 Feb 2015 18:05:24 +0000 Subject: [PATCH 55/71] Remove FreiChat check --- mod_shoutbox/fields/check.php | 65 ---------------------------------- mod_shoutbox/fields/index.html | 1 - mod_shoutbox/mod_shoutbox.xml | 2 -- mod_shoutbox/script.php | 23 ++++++++++++ 4 files changed, 23 insertions(+), 68 deletions(-) delete mode 100644 mod_shoutbox/fields/check.php delete mode 100644 mod_shoutbox/fields/index.html diff --git a/mod_shoutbox/fields/check.php b/mod_shoutbox/fields/check.php deleted file mode 100644 index de52a40..0000000 --- a/mod_shoutbox/fields/check.php +++ /dev/null @@ -1,65 +0,0 @@ -getQuery(true); - - $query->select(array('*')) - ->from($db->quoteName('#__extensions')) - ->where($db->quoteName('element') . ' = '. $db->quote('mod_freichatx')); - - $db->setQuery($query); - $result = $db->loadObjectList(); - - if($result) - { - // Detect Joomla version and render the message - if (version_compare(JVERSION, '3.0.0', 'ge')) - { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::_('WARNING_FREICHAT_IS_INSTALLED'), 'warning'); - } - else - { - return JError::raiseNotice( 100, JText::_('WARNING_FREICHAT_IS_INSTALLED') ); - } - } - - } - - /** - * @return mixed - */ - protected function getInput() - { - return; - } - -} diff --git a/mod_shoutbox/fields/index.html b/mod_shoutbox/fields/index.html deleted file mode 100644 index 94906bc..0000000 --- a/mod_shoutbox/fields/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/mod_shoutbox/mod_shoutbox.xml b/mod_shoutbox/mod_shoutbox.xml index 8537d9a..5bf8498 100644 --- a/mod_shoutbox/mod_shoutbox.xml +++ b/mod_shoutbox/mod_shoutbox.xml @@ -48,7 +48,6 @@ helper.php tmpl sql - fields @@ -115,7 +114,6 @@ -
diff --git a/mod_shoutbox/script.php b/mod_shoutbox/script.php index f93c59f..ba70ed9 100644 --- a/mod_shoutbox/script.php +++ b/mod_shoutbox/script.php @@ -92,6 +92,14 @@ public function preflight($type, $parent) { $this->update126(); } + + /** + * In 2.0.0 we fixed the Freichat broken compatability so remove the check form field + */ + if (version_compare($oldRelease, '2.0.1', '<=')) + { + $this->update202(); + } } } @@ -422,4 +430,19 @@ protected function update126() unset($values); } } + + /** + * Function to remove the fields directory + * + * @return void + * + * @since 2.0.2 + */ + protected function update202() + { + // Import dependencies + jimport('joomla.filesystem.folder'); + + JFolder::delete(JPATH_ROOT . '/modules/mod_shoutbox/fields'); + } } From 1a7956a752590c4170bcba521729b8c571354726 Mon Sep 17 00:00:00 2001 From: George Wilson Date: Sun, 1 Feb 2015 18:14:37 +0000 Subject: [PATCH 56/71] Update jQuery --- changelog.php | 4 ++++ mod_shoutbox/mod_shoutbox.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog.php b/changelog.php index a516775..19b92ec 100644 --- a/changelog.php +++ b/changelog.php @@ -14,6 +14,10 @@ - -> Removed ! -> Note +Version 2.0.2 +^ Updated to jQuery 1.11.2 +- Removed FreiChat check as this extension conflict is now fixed + Version 2.0.1 - Removed a lot of word from swearwords.php ^ Tweak and cleanup of variables + Javascript diff --git a/mod_shoutbox/mod_shoutbox.php b/mod_shoutbox/mod_shoutbox.php index dfd46be..c8db4a5 100644 --- a/mod_shoutbox/mod_shoutbox.php +++ b/mod_shoutbox/mod_shoutbox.php @@ -46,7 +46,7 @@ if (!$app->get('jquery')) { $app->set('jquery', true); - $doc->addScript('//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'); + $doc->addScript('//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js'); JHtml::_('script', 'mod_shoutbox/jquery-conflict.js', false, true); } } From df402100b533a4aa6dba1279595cc1fa3aa234b0 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sun, 1 Feb 2015 19:47:22 +0000 Subject: [PATCH 57/71] Typo's --- changelog.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog.php b/changelog.php index 49953e0..4fe4c18 100644 --- a/changelog.php +++ b/changelog.php @@ -16,13 +16,13 @@ Version 3.0.0 -+ Integrated AJAX for submittin and retreiving posts ++ Integrated AJAX for submitting and retrieving posts + Initially hide smilies with toggle option + Added Bootstrap and UIKit styling support # Fixed Freichat conflict # Fixed Kunena profile links ^ Enhanced HTML markup -^ Other small PHP anhancements +^ Other small PHP enhancements Version 2.0.2 ^ Updated to jQuery 1.11.2 From 9a3e5ae9517d61e4378998e5fe6dac7de4d7826f Mon Sep 17 00:00:00 2001 From: George Wilson Date: Sun, 1 Feb 2015 20:10:13 +0000 Subject: [PATCH 58/71] Turn off sound by default --- mod_shoutbox/mod_shoutbox.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod_shoutbox/mod_shoutbox.xml b/mod_shoutbox/mod_shoutbox.xml index 32800ec..be9429d 100644 --- a/mod_shoutbox/mod_shoutbox.xml +++ b/mod_shoutbox/mod_shoutbox.xml @@ -93,7 +93,7 @@ - + From a90e86cf08cb295d759f82361e861ab695a36105 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sun, 1 Feb 2015 18:05:24 +0000 Subject: [PATCH 59/71] Remove FreiChat check --- mod_shoutbox/fields/check.php | 65 ---------------------------------- mod_shoutbox/fields/index.html | 2 +- mod_shoutbox/mod_shoutbox.xml | 1 - mod_shoutbox/script.php | 24 +++++++++++++ 4 files changed, 25 insertions(+), 67 deletions(-) delete mode 100644 mod_shoutbox/fields/check.php diff --git a/mod_shoutbox/fields/check.php b/mod_shoutbox/fields/check.php deleted file mode 100644 index de52a40..0000000 --- a/mod_shoutbox/fields/check.php +++ /dev/null @@ -1,65 +0,0 @@ -getQuery(true); - - $query->select(array('*')) - ->from($db->quoteName('#__extensions')) - ->where($db->quoteName('element') . ' = '. $db->quote('mod_freichatx')); - - $db->setQuery($query); - $result = $db->loadObjectList(); - - if($result) - { - // Detect Joomla version and render the message - if (version_compare(JVERSION, '3.0.0', 'ge')) - { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::_('WARNING_FREICHAT_IS_INSTALLED'), 'warning'); - } - else - { - return JError::raiseNotice( 100, JText::_('WARNING_FREICHAT_IS_INSTALLED') ); - } - } - - } - - /** - * @return mixed - */ - protected function getInput() - { - return; - } - -} diff --git a/mod_shoutbox/fields/index.html b/mod_shoutbox/fields/index.html index 94906bc..9e0667b 100644 --- a/mod_shoutbox/fields/index.html +++ b/mod_shoutbox/fields/index.html @@ -1 +1 @@ - + \ No newline at end of file diff --git a/mod_shoutbox/mod_shoutbox.xml b/mod_shoutbox/mod_shoutbox.xml index 8537d9a..730f74b 100644 --- a/mod_shoutbox/mod_shoutbox.xml +++ b/mod_shoutbox/mod_shoutbox.xml @@ -115,7 +115,6 @@ -
diff --git a/mod_shoutbox/script.php b/mod_shoutbox/script.php index f93c59f..07b0e91 100644 --- a/mod_shoutbox/script.php +++ b/mod_shoutbox/script.php @@ -92,6 +92,14 @@ public function preflight($type, $parent) { $this->update126(); } + + /** + * In 2.0.0 we fixed the Freichat broken compatability so remove the check form field + */ + if (version_compare($oldRelease, '2.0.1', '<=')) + { + $this->update202(); + } } } @@ -422,4 +430,20 @@ protected function update126() unset($values); } } + + /** + * Function to remove the fields directory. We won't remove the entire folder as it's + * coming back in Shoutbox 3.x and if people upgrade in one go there might be issues + * + * @return void + * + * @since 2.0.2 + */ + protected function update202() + { + // Import dependencies + jimport('joomla.filesystem.file'); + + JFile::delete(JPATH_ROOT . '/modules/mod_shoutbox/fields/check.php'); + } } From 9ad719672b5f264b196ec184cf1b0f38c0218493 Mon Sep 17 00:00:00 2001 From: George Wilson Date: Sun, 1 Feb 2015 18:14:37 +0000 Subject: [PATCH 60/71] Update jQuery --- changelog.php | 4 ++++ mod_shoutbox/mod_shoutbox.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog.php b/changelog.php index a516775..19b92ec 100644 --- a/changelog.php +++ b/changelog.php @@ -14,6 +14,10 @@ - -> Removed ! -> Note +Version 2.0.2 +^ Updated to jQuery 1.11.2 +- Removed FreiChat check as this extension conflict is now fixed + Version 2.0.1 - Removed a lot of word from swearwords.php ^ Tweak and cleanup of variables + Javascript diff --git a/mod_shoutbox/mod_shoutbox.php b/mod_shoutbox/mod_shoutbox.php index dfd46be..c8db4a5 100644 --- a/mod_shoutbox/mod_shoutbox.php +++ b/mod_shoutbox/mod_shoutbox.php @@ -46,7 +46,7 @@ if (!$app->get('jquery')) { $app->set('jquery', true); - $doc->addScript('//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'); + $doc->addScript('//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js'); JHtml::_('script', 'mod_shoutbox/jquery-conflict.js', false, true); } } From 1427b62664fa7eaad6c60628b0004eecf0a7ca9c Mon Sep 17 00:00:00 2001 From: George Wilson Date: Sun, 1 Feb 2015 20:29:53 +0000 Subject: [PATCH 61/71] Missed a conflict --- mod_shoutbox/script.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mod_shoutbox/script.php b/mod_shoutbox/script.php index 7ad80c2..2bc72b9 100644 --- a/mod_shoutbox/script.php +++ b/mod_shoutbox/script.php @@ -100,17 +100,14 @@ public function preflight($type, $parent) { $this->update202(); } -<<<<<<< HEAD /** * For extensions going from < version 3.0.0 we need to change the loginname field option values */ - if (version_compare($oldRelease, '2.0.1', '<=')) + if (version_compare($oldRelease, '2.0.2', '<=')) { $this->update300(); } -======= ->>>>>>> development } } From 270f1580b81e6d1d2b5011400934b31cbc87a433 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Tue, 3 Feb 2015 00:52:00 +0000 Subject: [PATCH 62/71] Update copyright date and version number --- mod_shoutbox/helper.php | 2 +- mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini | 2 +- mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.sys.ini | 2 +- mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini | 2 +- mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.sys.ini | 2 +- mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini | 2 +- mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.sys.ini | 2 +- mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini | 2 +- mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.sys.ini | 2 +- mod_shoutbox/media/css/mod_shoutbox.css | 2 +- mod_shoutbox/media/js/mod_shoutbox.js | 2 +- mod_shoutbox/mod_shoutbox.php | 2 +- mod_shoutbox/mod_shoutbox.xml | 4 ++-- mod_shoutbox/script.php | 2 +- mod_shoutbox/swearWords.php | 2 +- mod_shoutbox/tmpl/default.php | 2 +- 16 files changed, 17 insertions(+), 17 deletions(-) diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php index 08606b3..f8e4532 100644 --- a/mod_shoutbox/helper.php +++ b/mod_shoutbox/helper.php @@ -1,7 +1,7 @@ JJ Shoutbox JoomJunk 05-Mar-2012 - Copyright (C) 2011 - 2014 JoomJunk + Copyright (C) 2011 - 2015 JoomJunk http://www.gnu.org/licenses/gpl-3.0.html admin@joomjunk.co.uk http://www.joomjunk.co.uk - 2.0.1 + 2.0.2 JJSHOUTBOX_DESCRIPTION diff --git a/mod_shoutbox/script.php b/mod_shoutbox/script.php index 07b0e91..4f51af0 100644 --- a/mod_shoutbox/script.php +++ b/mod_shoutbox/script.php @@ -1,7 +1,7 @@ Date: Tue, 3 Feb 2015 00:52:43 +0000 Subject: [PATCH 63/71] Add sql files for update --- mod_shoutbox/sql/mysql/updates/2.0.2.sql | 1 + mod_shoutbox/sql/postgresql/updates/2.0.2.sql | 1 + 2 files changed, 2 insertions(+) create mode 100644 mod_shoutbox/sql/mysql/updates/2.0.2.sql create mode 100644 mod_shoutbox/sql/postgresql/updates/2.0.2.sql diff --git a/mod_shoutbox/sql/mysql/updates/2.0.2.sql b/mod_shoutbox/sql/mysql/updates/2.0.2.sql new file mode 100644 index 0000000..31a4e33 --- /dev/null +++ b/mod_shoutbox/sql/mysql/updates/2.0.2.sql @@ -0,0 +1 @@ +# Placeholder file for database changes for version 2.0.2 diff --git a/mod_shoutbox/sql/postgresql/updates/2.0.2.sql b/mod_shoutbox/sql/postgresql/updates/2.0.2.sql new file mode 100644 index 0000000..31a4e33 --- /dev/null +++ b/mod_shoutbox/sql/postgresql/updates/2.0.2.sql @@ -0,0 +1 @@ +# Placeholder file for database changes for version 2.0.2 From a8dae07e14b1eb5b30e60bbf3fec254d3ae3ca8d Mon Sep 17 00:00:00 2001 From: George Wilson Date: Wed, 11 Feb 2015 11:33:22 +0000 Subject: [PATCH 64/71] Fix bug - thanks @betteryouthanme --- mod_shoutbox/helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php index 4478d98..172ec7f 100644 --- a/mod_shoutbox/helper.php +++ b/mod_shoutbox/helper.php @@ -741,7 +741,7 @@ public function submitPhp($post) } catch (Exception $e) { - JFactory::enqueueMessage($e->getMessage(), 'error'); + JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } return; From ae6fd67158c11c37ea858e3366c29f7a0ed4b6d4 Mon Sep 17 00:00:00 2001 From: Lodder Date: Thu, 12 Feb 2015 11:16:18 +0000 Subject: [PATCH 65/71] Used less generic function names --- mod_shoutbox/tmpl/default.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 7181f33..74cf5af 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -227,14 +227,14 @@ } - submitPost(name, '', , '', ''); + JJsubmitPost(name, '', , '', ''); return false; }); }); // Refresh the shoutbox posts every X seconds setInterval(function(){ - getPosts('', '', ''); + JJgetPosts('', '', ''); }, ); From 87e66ce5a856704af199777c5fe429bc9ce56d90 Mon Sep 17 00:00:00 2001 From: Lodder Date: Thu, 12 Feb 2015 11:17:17 +0000 Subject: [PATCH 66/71] Used less generic function names --- mod_shoutbox/media/js/mod_shoutbox.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mod_shoutbox/media/js/mod_shoutbox.js b/mod_shoutbox/media/js/mod_shoutbox.js index 5266894..70b8a13 100644 --- a/mod_shoutbox/media/js/mod_shoutbox.js +++ b/mod_shoutbox/media/js/mod_shoutbox.js @@ -4,8 +4,8 @@ * @license GPL v3.0 or later http://www.gnu.org/licenses/gpl-3.0.html */ -var getPosts = null; -var submitPost = null; +var JJgetPosts = null; +var JJsubmitPost = null; function addSmiley(smiley, id) { @@ -102,7 +102,7 @@ jQuery(document).ready(function($) { // SUBMIT POST - submitPost = function(name, title, securityType, security, root) + JJsubmitPost = function(name, title, securityType, security, root) { // Assemble some commonly used vars var textarea = $('#jj_message'), @@ -168,7 +168,7 @@ jQuery(document).ready(function($) { } // Refresh the output - getPosts(title, root) + JJgetPosts(title, root) } }, error:function(ts){ @@ -199,7 +199,7 @@ jQuery(document).ready(function($) { // GET POSTS - getPosts = function(title, root, sound) + JJgetPosts = function(title, root, sound) { // Assemble variables to submit var request = { From 2293b4c2f8a06b3e7bc5920d2d59a9ede56fd18e Mon Sep 17 00:00:00 2001 From: Lodder Date: Mon, 16 Feb 2015 14:54:53 +0000 Subject: [PATCH 67/71] Added CodeClimate analysis --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 4814632..38fe625 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ Shoutbox ======== + +[![Code Climate](https://codeclimate.com/github/JoomJunk/shoutbox/badges/gpa.svg)](https://codeclimate.com/github/JoomJunk/shoutbox) + JoomJunk Shoutbox - A PHP shoutbox designed for use on Joomla sites Please see the changelog for detailed information about recent changes From 531df0a635697512d8301bcd9437ab6440c21b22 Mon Sep 17 00:00:00 2001 From: "Charlie.lodder" Date: Fri, 20 Feb 2015 15:12:49 +0000 Subject: [PATCH 68/71] fixed sound notification for new shouts --- mod_shoutbox/media/js/mod_shoutbox.js | 17 ++++++++++++++++- mod_shoutbox/tmpl/default_message.php | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/mod_shoutbox/media/js/mod_shoutbox.js b/mod_shoutbox/media/js/mod_shoutbox.js index 70b8a13..3049498 100644 --- a/mod_shoutbox/media/js/mod_shoutbox.js +++ b/mod_shoutbox/media/js/mod_shoutbox.js @@ -201,6 +201,10 @@ jQuery(document).ready(function($) { // GET POSTS JJgetPosts = function(title, root, sound) { + + // Get the ID of the last shout + var lastID = getLastID(); + // Assemble variables to submit var request = { 'jjshout[title]' : title, @@ -219,8 +223,11 @@ jQuery(document).ready(function($) { // Grab the html output and append it to the shoutbox message $('.jj-shout-error').after(response.data.html); + // Get the ID of the last shout after the output has been updated + var newLastID = getLastID(); + // Play notification sound if enabled - if (sound == 1) + if (sound == 1 && newLastID > lastID) { document.getElementById('jjshoutbox-audio').play(); } @@ -233,4 +240,12 @@ jQuery(document).ready(function($) { return false; } + + // Get the last ID of the shoutbox output + function getLastID() + { + var lastId = $('#jjshoutboxoutput').find('.shout-header:first-child').data('shout-id'); + + return lastId; + } }); diff --git a/mod_shoutbox/tmpl/default_message.php b/mod_shoutbox/tmpl/default_message.php index c5ccd9c..908dfe8 100644 --- a/mod_shoutbox/tmpl/default_message.php +++ b/mod_shoutbox/tmpl/default_message.php @@ -10,7 +10,7 @@ $user = JFactory::getUser(); ?>
-
+
{USER} - {DATE} authorise('core.delete')) : ?>
From ea0691062174bbdc5a622b39da0661884ed3a2fa Mon Sep 17 00:00:00 2001 From: "Charlie.lodder" Date: Fri, 20 Feb 2015 15:21:34 +0000 Subject: [PATCH 69/71] changed sound + added OGG format --- mod_shoutbox/media/sounds/notification.mp3 | Bin 0 -> 6712 bytes mod_shoutbox/media/sounds/notification.ogg | Bin 0 -> 8955 bytes mod_shoutbox/media/sounds/pop.mp3 | Bin 5041 -> 0 bytes mod_shoutbox/tmpl/default.php | 3 ++- 4 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 mod_shoutbox/media/sounds/notification.mp3 create mode 100644 mod_shoutbox/media/sounds/notification.ogg delete mode 100644 mod_shoutbox/media/sounds/pop.mp3 diff --git a/mod_shoutbox/media/sounds/notification.mp3 b/mod_shoutbox/media/sounds/notification.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..9f23457dcdcb545f5d7879e861c4cee5cd313fc3 GIT binary patch literal 6712 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 b{DgLxLsl*nLXQ7-wfz%z^4F5Tt-#*_9b|sN literal 0 HcmV?d00001 diff --git a/mod_shoutbox/media/sounds/notification.ogg b/mod_shoutbox/media/sounds/notification.ogg new file mode 100644 index 0000000000000000000000000000000000000000..ec60bcb56ce4695f591d22dd56dc8520c5523cd6 GIT binary patch literal 8955 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 diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 74cf5af..a2cde77 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -53,7 +53,8 @@ From f618d71a304e31526d88a5d56b17090dcf909a3d Mon Sep 17 00:00:00 2001 From: Lodder Date: Mon, 23 Feb 2015 21:29:28 +0000 Subject: [PATCH 70/71] Updated changelog --- changelog.php | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.php b/changelog.php index 7e836a9..3c6976d 100644 --- a/changelog.php +++ b/changelog.php @@ -18,6 +18,7 @@ + Integrated AJAX for submitting and retrieving posts + Initially hide smilies with toggle option + Added Bootstrap and UIKit styling support ++ Added sound notifications for new shouts # Fixed Freichat conflict # Fixed Kunena profile links ^ Enhanced HTML markup From 97cda3a97a79510520ab1f3864b9f4a969bac64f Mon Sep 17 00:00:00 2001 From: George Wilson Date: Mon, 23 Feb 2015 21:29:53 +0000 Subject: [PATCH 71/71] Remove code checking Because it doesn't work without Joomla :P --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 38fe625..8f78981 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ Shoutbox ======== -[![Code Climate](https://codeclimate.com/github/JoomJunk/shoutbox/badges/gpa.svg)](https://codeclimate.com/github/JoomJunk/shoutbox) - JoomJunk Shoutbox - A PHP shoutbox designed for use on Joomla sites Please see the changelog for detailed information about recent changes