<?php /** * @package JJ_Shoutbox * @copyright Copyright (C) 2011 - 2016 JoomJunk. All rights reserved. * @license GPL v3.0 or later http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); JLoader::register('JFolder', JPATH_LIBRARIES . '/joomla/filesystem/folder.php'); require_once dirname(__FILE__) . '/helper.php'; $title = $module->title; $uniqueId = $module->id; $helper = new ModShoutboxHelper($title); $params = $helper->getParams(); $count = $helper->countShouts(); $displayName = $params->get('loginname', 'user'); $swearcounter = $params->get('swearingcounter', 1); $swearnumber = $params->get('swearingnumber'); $number = $params->get('maximum'); $profile = $params->get('profile'); $avatar = $params->get('avatar', 'none'); $date = $params->get('date'); $securitytype = $params->get('securitytype', 0); $siteKey = $params->get('recaptcha-public'); $secretKey = $params->get('recaptcha-private'); $recaptchaTheme = $params->get('recaptcha-theme', 'light'); $securityHide = $params->get('security-hide', 0); $mass_delete = $params->get('mass_delete', 0); $permissions = $params->get('guestpost'); $deletecolor = $params->get('deletecolor', '#FF0000'); $editcolor = $params->get('editcolor', '#444444');
public static function checkTimestampAjax() { $app = JFactory::getApplication(); $post = $app->input->post->get('jjshout', array(), '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; $id = 0; if (isset($post['id'])) { $id = $post['id']; } // Shout data $shoutData = $helper->getTimestampData($id); // Shout Unix timestamp $shoutTimestamp = JFactory::getDate($shoutData[0]->when)->toUnix(); // Current Unix timestamp $currentTimestamp = JFactory::getDate('now')->toUnix(); // Get difference in time and round to 1 decimal place $minutes = round(($currentTimestamp - $shoutTimestamp) / 60, 1); $result = null; if ($minutes < (int) $helper->getParams()->get('editown-time', 5)) { $htmlOutput = array(); foreach ($shoutData as $shout) { $htmlOutput[] = array('id' => $shout->id, 'name' => $shout->name, 'when' => $shout->when, 'ip' => $shout->ip, 'msg' => $shout->msg, 'user_id' => $shout->user_id); } $result = json_encode($htmlOutput); } return $result; }