diff --git a/README.md b/README.md
index 4814632..8f78981 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,6 @@
Shoutbox
========
+
JoomJunk Shoutbox - A PHP shoutbox designed for use on Joomla sites
Please see the changelog for detailed information about recent changes
diff --git a/changelog.php b/changelog.php
index a516775..3c6976d 100644
--- a/changelog.php
+++ b/changelog.php
@@ -14,6 +14,20 @@
- -> Removed
! -> Note
+Version 3.0.0
++ 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
+^ Other small PHP enhancements
+
+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/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/fade.php b/mod_shoutbox/fields/fade.php
new file mode 100644
index 0000000..864b457
--- /dev/null
+++ b/mod_shoutbox/fields/fade.php
@@ -0,0 +1,106 @@
+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);
+ }
+ }
+
+ 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("' . $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 ) {
+ public.fadeOut();
+ private.fadeOut();
+ }
+ else {
+ public.fadeIn();
+ private.fadeIn();
+ }
+
+ });
+
+ });
+ ';
+
+ $doc->addScriptDeclaration($js);
+
+ if (version_compare(JVERSION, '3.0.0', 'ge'))
+ {
+ return '
';
+ }
+
+ return '';
+ }
+
+ /**
+ * @return mixed
+ */
+ protected function getInput()
+ {
+ return;
+ }
+
+}
diff --git a/mod_shoutbox/fields/index.html b/mod_shoutbox/fields/index.html
index 94906bc..528901e 100644
--- a/mod_shoutbox/fields/index.html
+++ b/mod_shoutbox/fields/index.html
@@ -1 +1 @@
-
+
diff --git a/mod_shoutbox/helper.php b/mod_shoutbox/helper.php
index 08606b3..172ec7f 100644
--- a/mod_shoutbox/helper.php
+++ b/mod_shoutbox/helper.php
@@ -1,7 +1,7 @@
'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
+ * 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 function getParams($title = null)
+ {
+ jimport('joomla.application.module.helper');
+ $module = JModuleHelper::getModule('mod_shoutbox', $title);
+ $moduleParams = new JRegistry;
+ $moduleParams->loadString($module->params);
+
+ return $moduleParams;
+ }
+
+ /*
* Wrapper function for getting the shouts in PHP
*
* @param int $number The number of posts to retrieve from the database.
@@ -26,15 +192,15 @@ class ModShoutboxHelper
*
* @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;
@@ -50,19 +216,18 @@ public static function getShouts($number, $message)
*
* @since 1.0
*/
- private static function getShoutData($number)
+ private function getShoutData($number)
{
- $shouts = array();
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('*')
- ->from($db->quoteName('#__shoutbox'))
- ->order($db->quoteName('id') . ' DESC');
+ ->from($db->quoteName('#__shoutbox'))
+ ->order($db->quoteName('id') . ' DESC');
$db->setQuery($query, 0, $number);
if (!JError::$legacy)
{
- // If we have an exception then we'll let it propogate up the chain
+ // If we have an exception then we'll let it propagate up the chain
$rows = $db->loadObjectList();
}
else
@@ -76,21 +241,55 @@ private static function getShoutData($number)
}
}
- $i = 0;
+ // Ensure the date formatting
+ foreach ($rows as $row)
+ {
+ $row->when = JFactory::getDate($row->when)->format('Y-m-d H:i:s');
+ }
- foreach ( $rows as $row )
+ return $rows;
+ }
+
+ /**
+ * Retrieves the shouts from the database and returns them. Will return an error
+ * message if the database retrieval fails.
+ *
+ * @param int $id The id of the post to retrieve.
+ *
+ * @return object The shoutbox post.
+ *
+ * @since __DEPLOY_VERSION__
+ * @throws RuntimeException
+ */
+ public function getAShout($id)
+ {
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true);
+ $query->select('*')
+ ->from($db->quoteName('#__shoutbox'))
+ ->where($db->quoteName('id') . ' = ' . $id);
+ $db->setQuery($query);
+
+ if (!JError::$legacy)
{
- $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++;
+ // If we have an exception then we'll let it propagate up the chain
+ $row = $db->loadObject();
}
+ else
+ {
+ $row = $db->loadObject();
- return $shouts;
+ // If we have an error with JError then we'll create an exception ourselves
+ if ($db->getErrorNum())
+ {
+ throw new RuntimeException($db->getErrorMsg(), $db->getErrorNum());
+ }
+ }
+
+ // Format the when correctly
+ $row->when = JFactory::getDate($row->when)->format('Y-m-d H:i:s');
+
+ return $row;
}
/**
@@ -101,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;
@@ -118,46 +317,48 @@ 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
+ * @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)
+ public function postFiltering($shout, $user, $swearCounter, $swearNumber, $displayName, $params)
{
$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
{
- // Name is a required field. So return if the field is empty
- if (empty($shout['name']))
+ if ($swearCounter == 1)
{
- return;
+ $before = substr_count($shout['name'], $replace);
}
- if ($swearCounter == 0)
+ $name = $this->swearfilter($shout['name'], $replace);
+
+ if ($name == '')
{
- $before = substr_count($shout['name'], $replace);
+ // Retrieve Generic Name parameters
+ $genericName = $params->get('genericname');
+ $name = $genericName;
}
- $name = self::swearfilter($shout['name'], $replace);
-
- if ($swearCounter == 0)
+ if ($swearCounter == 1)
{
$after = substr_count($name, $replace);
$nameSwears = ($after - $before);
@@ -168,24 +369,28 @@ public static function postFiltering($shout, $user, $swearCounter, $swearNumber,
}
}
- if ($swearCounter == 0)
+ if ($swearCounter == 1)
{
$before = substr_count($shout['message'], $replace);
}
- $message = self::swearfilter($shout['message'], $replace);
+ $message = $this->swearfilter($shout['message'], $replace);
- if ($swearCounter == 0)
+ if ($swearCounter == 1)
{
$after = substr_count($message, $replace);
$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 == 1 || $swearCounter == 0 && (($nameSwears + $messageSwears) <= $swearNumber))
+ if ($swearCounter == 0 || $swearCounter == 1 && (($nameSwears + $messageSwears) <= $swearNumber))
{
- self::addShout($name, $message, $ip);
+ return $this->addShout($name, $message, $ip);
}
}
@@ -196,11 +401,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;
@@ -213,38 +418,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 = '';
$message = str_replace($smile, $replace, $message);
@@ -275,15 +462,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 .= '';
}
@@ -297,11 +484,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';
@@ -325,7 +512,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;
@@ -338,11 +525,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 = '';
@@ -356,14 +543,7 @@ public static function linkUser($profile, $name, $user_id)
elseif ($profile == 2)
{
// Kunena Profile Link
- if (class_exists('KunenaFactory') && class_exists('KunenaProfileKunena')) {
- $kUser = KunenaFactory::getUser()->userid;
- $kLink = KunenaProfileKunena::getProfileURL($kUser);
- }
- else {
- $kLink = null;
- }
- $profile_link = '' . $name . '';
+ $profile_link = '' . $name . '';
}
elseif ($profile == 3)
{
@@ -408,11 +588,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();
@@ -447,6 +627,8 @@ public static function addShout($name, $message, $ip)
JLog::add(JText::sprintf('SHOUT_DATABASE_ERROR', $db->getErrorMsg()), JLog::CRITICAL, 'mod_shoutbox');
}
}
+
+ return $db->insertid();
}
/**
@@ -456,9 +638,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);
@@ -484,9 +666,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);
@@ -498,7 +680,7 @@ public static function deleteall($delete)
foreach ($rows as $row)
{
- self::deletepost($row->id);
+ $this->deletepost($row->id);
}
}
@@ -508,8 +690,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;
@@ -534,14 +718,252 @@ public static function randomnumber($digits)
}
/**
+ * Wrapper function for submitPost to allow PHP to submit a post
+ *
+ * @param JInput $post The filtered post superglobal.
+ *
+ * @return void
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function submitPhp($post)
+ {
+ if (empty($post['message']))
+ {
+ JFactory::getApplication()->enqueueMessage('The message body is empty', 'error');
+
+ return false;
+ }
+
+ try
+ {
+ $this->submitPost($post);
+ }
+ catch (Exception $e)
+ {
+ JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');
+ }
+
+ return;
+ }
+
+ /**
+ * Method for submitting the post
+ *
+ * @param JInput $post The filtered post superglobal.
+ *
+ * @return mixed Integer of the post inserted on success, false on failure.
+ *
+ * @since __DEPLOY_VERSION__
+ * @throws RuntimeException
+ */
+ private function submitPost($post)
+ {
+ // Get the user instance
+ $user = JFactory::getUser();
+ $displayName = $this->params->get('loginname', 'user');
+ $securityType = $this->params->get('securitytype', 0);
+ $swearCounter = $this->params->get('swearingcounter');
+ $swearNumber = $this->params->get('swearingnumber');
+
+ // 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 ($securityType == 1)
+ {
+ // 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');
+
+ // Require Recaptcha Library
+ require_once JPATH_ROOT . '/media/mod_shoutbox/recaptcha/recaptchalib.php';
+
+ $resp = recaptcha_check_answer(
+ $this->params->get('recaptcha-private'),
+ $_SERVER["REMOTE_ADDR"],
+ $challengeField,
+ $responseField
+ );
+
+ if ($resp->is_valid)
+ {
+ return $this->postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $this->params);
+ }
+
+ // Invalid submission of post. Throw an error.
+ throw new RuntimeException($resp->error);
+ }
+ elseif ($securityType == 2)
+ {
+ // 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)
+ {
+ throw new RuntimeException(JText::_('SHOUT_ANSWER_INCORRECT'));
+ }
+
+ return $this->postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $this->params);
+ }
+ }
+ }
+ else
+ {
+ return $this->postFiltering($post, $user, $swearCounter, $swearNumber, $displayName, $this->params);
+ }
+ }
+ }
+
+ /**
+ * 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', 1);
+
+ // 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 == 1)
+ {
+ $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 == 1)
+ {
+ $post = $this->bbcodeFilter($shout->msg);
+ }
+ else
+ {
+ $post = nl2br($shout->msg);
+ }
+
+ $message = str_replace('{' . $match[1] . '}', $post, $message);
+ }
+ }
+
+ return $message;
+ }
+
+ /*
* 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
+ *
+ * @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/language/en-GB/en-GB.mod_shoutbox.ini b/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini
index 14a7514..b410d67 100644
--- a/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini
+++ b/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini
@@ -1,7 +1,7 @@
; $Id: en-GB.mod_shoutbox.ini 00001 05.03.2012 01.47.30 $
; Mod mod_shoutbox (mod_shoutbox)
; @date 15.03.2012
-; @Copyright Copyright (C) 2011 - 2014 JoomJunk. All rights reserved.
+; @Copyright Copyright (C) 2011 - 2015 JoomJunk. All rights reserved.
; @http://www.gnu.org/licenses/gpl-3.0.html
; Note : All ini files need to be saved as UTF-8
@@ -21,16 +21,18 @@ SHOUT_GUESTLABEL="Usergroups allowed to shout"
SHOUT_GUESTDESC="Select what permissions group is allowed to make posts in the shoutbox."
SHOUT_SHOW_DATE="Show date"
SHOUT_SHOW_DATEDESC="Select whether or not you would like the date of the shout to be shown"
-SHOUT_DATE_ENGLAND_BACKSLASH="31/01/2014"
-SHOUT_DATE_SPACE="Sat 01 2014"
+SHOUT_DATE_ENGLAND_BACKSLASH="31/01/2015"
+SHOUT_DATE_SPACE="Sat 01 2015"
SHOUT_DATE_SPACE_OPTION_TWO="Sat 31 Jan"
-SHOUT_DATE_AMERICAN_BACKSLASH="01/31/2014"
-SHOUT_DATE_REVERSED="2014/01/31"
+SHOUT_DATE_AMERICAN_BACKSLASH="01/31/2015"
+SHOUT_DATE_REVERSED="2015/01/31"
SHOUT_DONT_SHOW="Don't Show"
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"
@@ -56,8 +58,11 @@ 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_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"
@@ -67,14 +72,14 @@ 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_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_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"
+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"
@@ -98,4 +103,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"
diff --git a/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.sys.ini b/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.sys.ini
index adee712..96da455 100644
--- a/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.sys.ini
+++ b/mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.sys.ini
@@ -1,7 +1,7 @@
; $Id: en-GB.mod_shoutbox.sys.ini 00001 05.03.2012 01.47.30 $
; Mod mod_shoutbox (mod_shoutbox)
; @date 15.03.2012
-; @Copyright (C) Copyright (C) 2011 - 2014 JoomJunk. All rights reserved.
+; @Copyright (C) Copyright (C) 2011 - 2015 JoomJunk. All rights reserved.
; @http://www.gnu.org/licenses/gpl-3.0.html
; Note : All ini files need to be saved as UTF-8
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..d010c39 100644
--- a/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini
+++ b/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini
@@ -1,7 +1,7 @@
; $Id: it-IT.mod_shoutbox.ini 00001 05.03.2012 01.47.30 $
; Mod mod_shoutbox (mod_shoutbox)
; @date 15.03.2012
-; @Copyright Copyright (C) 2011 - 2014 JoomJunk. All rights reserved.
+; @Copyright Copyright (C) 2011 - 2015 JoomJunk. All rights reserved.
; @http://www.gnu.org/licenses/gpl-3.0.html
; Note : All ini files need to be saved as UTF-8
@@ -21,16 +21,18 @@ SHOUT_GUESTLABEL="Gruppi permesso di gridare"
SHOUT_GUESTDESC="Scegliere che gruppi è permesso di fare post in shoutbox."
SHOUT_SHOW_DATE="Visualizza Data"
SHOUT_SHOW_DATEDESC="Select whether or not you would like the date of the shout to be shown"
-SHOUT_DATE_ENGLAND_BACKSLASH="31/01/2014"
-SHOUT_DATE_SPACE="Sat 01 2014"
+SHOUT_DATE_ENGLAND_BACKSLASH="31/01/2015"
+SHOUT_DATE_SPACE="Sat 01 2015"
SHOUT_DATE_SPACE_OPTION_TWO="Sab 31 Gen"
-SHOUT_DATE_AMERICAN_BACKSLASH="01/31/2014"
-SHOUT_DATE_REVERSED="2014/01/31"
+SHOUT_DATE_AMERICAN_BACKSLASH="01/31/2015"
+SHOUT_DATE_REVERSED="2015/01/31"
SHOUT_DONT_SHOW="Non visualizzare"
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"
@@ -56,8 +58,11 @@ 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_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"
@@ -67,14 +72,14 @@ 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_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_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"
+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"
@@ -91,7 +96,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"
@@ -99,4 +103,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"
diff --git a/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.sys.ini b/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.sys.ini
index 860b01d..ad9d1ba 100644
--- a/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.sys.ini
+++ b/mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.sys.ini
@@ -1,7 +1,7 @@
; $Id: it-IT.mod_shoutbox.sys.ini 00001 05.03.2012 01.47.30 $
; Mod mod_shoutbox (mod_shoutbox)
; @date 15.03.2012
-; @Copyright (C) Copyright (C) 2011 - 2014 JoomJunk. All rights reserved.
+; @Copyright (C) Copyright (C) 2011 - 2015 JoomJunk. All rights reserved.
; @http://www.gnu.org/licenses/gpl-3.0.html
; Note : All ini files need to be saved as UTF-8
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..b227b3a 100644
--- a/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini
+++ b/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini
@@ -1,7 +1,7 @@
; $Id: nl-NL.mod_shoutbox.ini 00001 05.03.2012 01.47.30 $
; Mod mod_shoutbox (mod_shoutbox)
; @date 15.03.2012
-; @Copyright Copyright (C) 2011 - 2014 JoomJunk. All rights reserved.
+; @Copyright Copyright (C) 2011 - 2015 JoomJunk. All rights reserved.
; @http://www.gnu.org/licenses/gpl-3.0.html
; Note : All ini files need to be saved as UTF-8
@@ -21,16 +21,18 @@ SHOUT_GUESTLABEL="Gebruikersgroepen toegestaan om berichten te plaatsen"
SHOUT_GUESTDESC="Selecteer welke gebruikersgroepen toegestaan zijn om berichten te plaatsen in de shoutbox."
SHOUT_SHOW_DATE="Toon datum"
SHOUT_SHOW_DATEDESC="Selecteer of de datum moet worden weergegeven in de shoutbox"
-SHOUT_DATE_ENGLAND_BACKSLASH="31/01/2014"
-SHOUT_DATE_SPACE="Zat 01 2014"
+SHOUT_DATE_ENGLAND_BACKSLASH="31/01/2015"
+SHOUT_DATE_SPACE="Zat 01 2015"
SHOUT_DATE_SPACE_OPTION_TWO="Zat 31 Jan"
-SHOUT_DATE_AMERICAN_BACKSLASH="01/31/2014"
-SHOUT_DATE_REVERSED="2014/01/311"
+SHOUT_DATE_AMERICAN_BACKSLASH="01/31/2015"
+SHOUT_DATE_REVERSED="2015/01/311"
SHOUT_DONT_SHOW="Verberg"
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"
@@ -56,8 +58,11 @@ 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_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"
@@ -67,14 +72,14 @@ 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_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_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"
+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"
@@ -98,3 +103,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"
diff --git a/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.sys.ini b/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.sys.ini
index 289f70c..6898367 100644
--- a/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.sys.ini
+++ b/mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.sys.ini
@@ -1,7 +1,7 @@
; $Id: nl-NL.mod_shoutbox.sys.ini 00001 05.03.2012 01.47.30 $
; Mod mod_shoutbox (mod_shoutbox)
; @date 15.03.2012
-; @Copyright (C) Copyright (C) 2011 - 2014 JoomJunk. All rights reserved.
+; @Copyright (C) Copyright (C) 2011 - 2015 JoomJunk. All rights reserved.
; @http://www.gnu.org/licenses/gpl-3.0.html
; Note : All ini files need to be saved as UTF-8
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..0a9ba88 100644
--- a/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini
+++ b/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini
@@ -1,7 +1,7 @@
; $Id: pl-PL.mod_shoutbox.ini 00001 12.03.2014 01.47.30 $
; Mod mod_shoutbox (mod_shoutbox)
; @date 12.03.2014
-; @Copyright Copyright (C) 2011 - 2014 JoomJunk. All rights reserved.
+; @Copyright Copyright (C) 2011 - 2015 JoomJunk. All rights reserved.
; @http://www.gnu.org/licenses/gpl-3.0.html
; Note : All ini files need to be saved as UTF-8
@@ -21,16 +21,18 @@ SHOUT_GUESTLABEL="Grupy"
SHOUT_GUESTDESC="Wybierz grupy użytkowników, które mają uprawnienia do używania czata"
SHOUT_SHOW_DATE="Pokaż datę"
SHOUT_SHOW_DATEDESC="Wybierz, czy data ma się pokazywać"
-SHOUT_DATE_ENGLAND_BACKSLASH="31/01/2014"
-SHOUT_DATE_SPACE="So 01 2014"
+SHOUT_DATE_ENGLAND_BACKSLASH="31/01/2015"
+SHOUT_DATE_SPACE="So 01 2015"
SHOUT_DATE_SPACE_OPTION_TWO="So 31 Sty"
-SHOUT_DATE_AMERICAN_BACKSLASH="01/31/2014"
-SHOUT_DATE_REVERSED="2014/01/31"
+SHOUT_DATE_AMERICAN_BACKSLASH="01/31/2015"
+SHOUT_DATE_REVERSED="2015/01/31"
SHOUT_DONT_SHOW="Nie pokazuj"
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ń\""
@@ -56,8 +58,11 @@ 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_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"
@@ -67,14 +72,14 @@ 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_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_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"
+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"
@@ -98,4 +103,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"
diff --git a/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.sys.ini b/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.sys.ini
index 9fc92a2..33ea85a 100644
--- a/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.sys.ini
+++ b/mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.sys.ini
@@ -1,7 +1,7 @@
; $Id: pl-PL.mod_shoutbox.sys.ini 00001 12.03.2014 01.47.30 $
; Mod mod_shoutbox (mod_shoutbox)
; @date 12.03.2014
-; @Copyright (C) Copyright (C) 2011 - 2014 JoomJunk. All rights reserved.
+; @Copyright (C) Copyright (C) 2011 - 2015 JoomJunk. All rights reserved.
; @http://www.gnu.org/licenses/gpl-3.0.html
; Note : All ini files need to be saved as UTF-8
diff --git a/mod_shoutbox/media/css/mod_shoutbox.css b/mod_shoutbox/media/css/mod_shoutbox.css
index a58dd4c..1182c21 100644
--- a/mod_shoutbox/media/css/mod_shoutbox.css
+++ b/mod_shoutbox/media/css/mod_shoutbox.css
@@ -1,21 +1,33 @@
/**
* @package JJ_Shoutbox
- * @copyright Copyright (C) 2011 - 2014 JoomJunk. All rights reserved.
+ * @copyright Copyright (C) 2011 - 2015 JoomJunk. All rights reserved.
* @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;
+ margin: 0;
}
#jjshoutboxform input {
margin-top: 5px;
color: #000;
width: 100%;
- padding: 5px 0;
+ min-height: 30px;
+}
+#jjshoutboxform p {
+ margin: 4px 0;
}
#jjshoutboxoutput {
height: 200px;
@@ -26,29 +38,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 +72,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: 70px;
+ 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: 50%; }
-#jjshoutbox .jj_input { width: 50%; }
-#jjshoutbox .jj_admin_label { width: 30%; }
#jjshoutbox .jj_admin_button {
width: 65%;
min-width: 90px;
@@ -72,17 +102,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 +129,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 +143,11 @@
/**
Non-bootstrap styling for BB Code
**/
-#jjshoutbox #jj_smiley_box{
- margin: 10px 0 10px 0;
+#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/media/js/mod_shoutbox.js b/mod_shoutbox/media/js/mod_shoutbox.js
index 82990e3..3049498 100644
--- a/mod_shoutbox/media/js/mod_shoutbox.js
+++ b/mod_shoutbox/media/js/mod_shoutbox.js
@@ -1,14 +1,18 @@
/**
* @package JJ_Shoutbox
- * @copyright Copyright (C) 2011 - 2014 JoomJunk. All rights reserved.
+ * @copyright Copyright (C) 2011 - 2015 JoomJunk. All rights reserved.
* @license GPL v3.0 or later http://www.gnu.org/licenses/gpl-3.0.html
*/
+var JJgetPosts = null;
+var JJsubmitPost = null;
+
function addSmiley(smiley, id) {
// If we are not passed an id, use the default 'jj_message'.
- if (!id) {
- id = 'jj_message';
+ if (!id)
+ {
+ var id = 'jj_message';
}
// Get the position of the user in the text area
@@ -25,41 +29,223 @@ function addSmiley(smiley, id) {
el.value = strBegin + " " + smiley + " " + strEnd;
}
-function getCurserPosition(id) {
-
- var el = document.getElementById(id);
+function getCurserPosition(id)
+{
+ var el = document.getElementById(id);
var pos = 0;
// IE Support
- if (document.selection) {
+ if (document.selection)
+ {
el.focus();
- var Sel = document.selection.createRange();
- var SelLength = document.selection.createRange().text.length;
-
+ var Sel = document.selection.createRange();
+ var SelLength = document.selection.createRange().text.length;
Sel.moveStart ('character', -el.value.length);
pos = Sel.text.length - SelLength;
}
// Firefox support
- else if (el.selectionStart || el.selectionStart == '0') {
+ else if (el.selectionStart || el.selectionStart == '0')
+ {
pos = el.selectionStart;
}
return pos;
}
+function textCounter(textarea, countdown, maxlimit, alertLength, warnLength, shoutRemainingText)
+{
+ textareaid = document.getElementById(textarea);
+ var charsLeft = document.getElementById('charsLeft');
+
+ if (textareaid.value.length > maxlimit)
+ {
+ textareaid.value = textareaid.value.substring(0, maxlimit);
+ }
+ else
+ {
+ charsLeft.innerHTML = (maxlimit-textareaid.value.length)+' ' + shoutRemainingText;
+ }
+
+ if (maxlimit-textareaid.value.length > alertLength)
+ {
+ charsLeft.style.color = "Black";
+ }
+ if (maxlimit-textareaid.value.length <= alertLength && maxlimit-textareaid.value.length > warnLength)
+ {
+ charsLeft.style.color = "Orange";
+ }
+ if (maxlimit-textareaid.value.length <= warnLength)
+ {
+ charsLeft.style.color = "Red";
+ }
+}
+
+/**
+ * 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($) {
- // SlideToggle for smilies
- (function() {
+
+ // SMILEY SLIDETOGGLE
+ $('#jj_btn').on('click', function(e) {
+ e.preventDefault();
+ $(this).toggleClass('rotated');
+ $('#jj_smiley_box').stop(true, false).slideToggle();
+ });
+
+
+ // SUBMIT POST
+ JJsubmitPost = function(name, title, securityType, security, root)
+ {
+ // Assemble some commonly used vars
+ var 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 = {
+ 'jjshout[name]' : name,
+ 'jjshout[message]' : message.replace(/\n/g, " "),
+ 'jjshout[shout]' : 'Shout!',
+ 'jjshout[title]' : title,
+ };
+
+ request[security] = 1;
+
+ if (securityType == 1)
+ {
+ request['recaptcha_challenge_field'] = $('input#recaptcha_challenge_field').val();
+ request['recaptcha_response_field'] = $('input#recaptcha_response_field').val();
+ }
+
+ if (securityType == 2)
+ {
+ 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',
+ url: 'index.php?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('');
+ }
+
+ // Refresh the output
+ JJgetPosts(title, root)
+ }
+ },
+ error:function(ts){
+ console.log(ts);
+ }
+ });
+
+ // Valid or not refresh recaptcha
+ if (securityType == 1)
+ {
+ Recaptcha.reload();
+ }
+
+ // Valid or not refresh maths values and empty answer
+ if (securityType == 2)
+ {
+ 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;
+ }
+
+
+ // GET POSTS
+ JJgetPosts = function(title, root, sound)
+ {
- var smileyBox = $('#jj_smiley_box');
- var jj_btn = $('#jj_btn');
+ // Get the ID of the last shout
+ var lastID = getLastID();
- jj_btn.on('click', function(e) {
- e.preventDefault();
- $(this).toggleClass('rotated');
- smileyBox.stop(true, false).slideToggle();
+ // Assemble variables to submit
+ var request = {
+ 'jjshout[title]' : title,
+ };
+
+ // AJAX request
+ $.ajax({
+ type: 'POST',
+ url: 'index.php?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);
+
+ // Get the ID of the last shout after the output has been updated
+ var newLastID = getLastID();
+
+ // Play notification sound if enabled
+ if (sound == 1 && newLastID > lastID)
+ {
+ document.getElementById('jjshoutbox-audio').play();
+ }
+ }
+ },
+ error:function(ts){
+ console.log(ts);
+ }
});
+
+ return false;
+ }
+
+ // Get the last ID of the shoutbox output
+ function getLastID()
+ {
+ var lastId = $('#jjshoutboxoutput').find('.shout-header:first-child').data('shout-id');
- })();
-
-});
\ No newline at end of file
+ return lastId;
+ }
+});
diff --git a/mod_shoutbox/media/sounds/notification.mp3 b/mod_shoutbox/media/sounds/notification.mp3
new file mode 100644
index 0000000..9f23457
Binary files /dev/null and b/mod_shoutbox/media/sounds/notification.mp3 differ
diff --git a/mod_shoutbox/media/sounds/notification.ogg b/mod_shoutbox/media/sounds/notification.ogg
new file mode 100644
index 0000000..ec60bcb
Binary files /dev/null and b/mod_shoutbox/media/sounds/notification.ogg differ
diff --git a/mod_shoutbox/mod_shoutbox.php b/mod_shoutbox/mod_shoutbox.php
index dfd46be..8ed401c 100644
--- a/mod_shoutbox/mod_shoutbox.php
+++ b/mod_shoutbox/mod_shoutbox.php
@@ -1,7 +1,7 @@
get('loginname');
+$title = $module->title;
+$helper = new ModShoutboxHelper($title);
+$params = $helper->getParams();
+
+$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');
-$securityquestion = $params->get('securityquestion');
-$mass_delete = $params->get('mass_delete');
+$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');
$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);
+$sound = $params->get('sound', 1);
+$genericName = $params->get('genericname');
+$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');
// Assemble the factory variables needed
$doc = JFactory::getDocument();
$user = JFactory::getUser();
$app = JFactory::getApplication();
-// Add in jQuery if required
-if ($smile == 1 || $smile == 2 || $bbcode == 0)
-{
- 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.1/jquery.min.js');
- JHtml::_('script', 'mod_shoutbox/jquery-conflict.js', false, true);
- }
- }
-
- 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)
+// 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))
{
- $show_date = "D m Y - ";
+ $form = 'uk-form';
+ $button_group = 'uk-button-group';
+ $button = 'uk-button';
+ $button_danger = ' uk-button-danger';
}
-elseif ($date == 3)
+else
{
- $show_date = "m/d/Y - ";
+ $form = null;
+ $button_group = 'btn-group';
+ $button = 'btn';
+ $button_danger = ' btn-danger';
}
-elseif ($date == 4)
-{
- $show_date = "D j M - ";
-}
-elseif ($date == 5)
+
+// Import jQuery
+if (version_compare(JVERSION, '3.0.0', 'ge'))
{
- $show_date = "Y/m/d - ";
+ JHtml::_('jquery.framework');
}
else
{
- $show_date = "";
+ 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);
+ }
}
+JHtml::_('script', 'mod_shoutbox/mod_shoutbox.js', false, true);
+
$dataerror = JText::_('SHOUT_DATABASEERRORSHOUT');
// Import JLog class
@@ -105,54 +107,9 @@
$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)
- {
- 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;
- }
- }
- 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);
- }
+ $helper->submitPhp($post);
}
if (isset($post['delete']))
@@ -162,11 +119,11 @@
if ($user->authorise('core.delete'))
{
- ModShoutboxHelper::deletepost($deletepostnumber);
+ $helper->deletepost($deletepostnumber);
}
}
- if ($mass_delete == 0 && (isset($post['deleteall'])))
+ if ($mass_delete == 1 && (isset($post['deleteall'])))
{
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
$delete = $post['valueall'];
@@ -183,7 +140,7 @@
}
if ($user->authorise('core.delete'))
{
- ModShoutboxHelper::deleteall($delete);
+ $helper->deleteall($delete);
}
}
else
diff --git a/mod_shoutbox/mod_shoutbox.xml b/mod_shoutbox/mod_shoutbox.xml
index 8537d9a..ef15633 100644
--- a/mod_shoutbox/mod_shoutbox.xml
+++ b/mod_shoutbox/mod_shoutbox.xml
@@ -3,11 +3,11 @@
JJ ShoutboxJoomJunk05-Mar-2012
- Copyright (C) 2011 - 2014 JoomJunk
+ Copyright (C) 2011 - 2015 JoomJunkhttp://www.gnu.org/licenses/gpl-3.0.htmladmin@joomjunk.co.ukhttp://www.joomjunk.co.uk
- 2.0.1
+ 3.0.0-beta3JJSHOUTBOX_DESCRIPTION
@@ -39,6 +39,7 @@
imagesjsrecaptcha
+ sounds
@@ -68,7 +69,7 @@
-