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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redCORE",
"version": "1.10.3",
"version": "1.11.0",
"description": "Rapid application development layer for Joomla!",
"main": "gulpfile.js",
"directories": {
Expand Down
49 changes: 49 additions & 0 deletions extensions/components/com_redcore/admin/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,55 @@
<option value="0">JNO</option>
</field>
</fieldset>
<fieldset name="REDCORE_WEBSERVICES_HISTORY_LOG_OPTIONS"
addfieldpath="/libraries/redcore/form/fields"
label="COM_REDCORE_CONFIG_WEBSERVICES_HISTORY_LOG_OPTIONS">
<field
name="enable_webservice_history_log"
class="btn-group"
type="radio"
default="0"
label="COM_REDCORE_CONFIG_SOAP_ENABLE_WEBSERVICE_HISTORY_LOG"
description="COM_REDCORE_CONFIG_SOAP_ENABLE_WEBSERVICE_HISTORY_LOG_DESC">
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="webservice_history_log_path"
type="text"
default="logs/com_redcore/webservice_history_log"
label="COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_PATH"
description="COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_PATH_DESC"
/>
<field
name="webservice_history_log_allowed_operations"
class="btn-group"
type="list"
multiple="true"
default="all"
label="COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION"
description="COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_DESC">
<option value="">JNONE</option>
<option value="all">COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_ALL</option>
<option value="create">COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_CREATE</option>
<option value="read list">COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_READ_LIST</option>
<option value="read item">COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_READ_ITEM</option>
<option value="update">COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_UPDATE</option>
<option value="delete">COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_DELETE</option>
<option value="task">COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_TASK</option>
<option value="documentation">COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_DOCUMENTATION</option>
</field>
<field
name="webservice_history_log_store_read_response"
class="btn-group"
type="radio"
default="1"
label="COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_STORE_READ_RESPONSE"
description="COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_STORE_READ_RESPONSE_DESC">
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
</fieldset>
<fieldset name="REDCORE_OAUTH2_SERVER_OPTIONS"
addfieldpath="/libraries/redcore/form/fields"
label="COM_REDCORE_CONFIG_OAUTH2_SERVER_OPTIONS">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
/**
* @package Redcore.Backend
* @subpackage Controllers
*
* @copyright Copyright (C) 2008 - 2016 redCOMPONENT.com. All rights reserved.
* @license GNU General Public License version 2 or later, see LICENSE.
*/

defined('_JEXEC') or die;

/**
* Webservice History Log Controller
*
* @package Redcore.Backend
* @subpackage Controllers
* @since 1.4
*/
class RedcoreControllerWebservice_History_Log extends RControllerForm
{
/**
* Method to publish a list of items
*
* @return void
*/
public function getFileData()
{
// Check for request forgeries
JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN'));

// Get items to copy from the request.
$id = JFactory::getApplication()->input->get('id', 0, 'int');
$table = RTable::getAdminInstance('Webservice_History_Log');
$table->load($id);

echo file_get_contents(JPATH_ROOT . '/' . $table->file_name);

JFactory::getApplication()->close();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
<?php
/**
* @package Redcore.Backend
* @subpackage Controllers
*
* @copyright Copyright (C) 2008 - 2016 redCOMPONENT.com. All rights reserved.
* @license GNU General Public License version 2 or later, see LICENSE.
*/

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

/**
* Webservice History Logs Controller
*
* @package Redcore.Backend
* @subpackage Controllers
* @since 1.0
*/
class RedcoreControllerWebservice_History_Logs extends RControllerAdmin
{
/**
* Download Response Data.
*
* @return mixed True if successful, false otherwise.
*/
public function downloadResponseData()
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

// Get items to remove from the request.
$cid = JFactory::getApplication()->input->get('cid', array(), 'array');

if (!is_array($cid) || count($cid) < 1)
{
JLog::add(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), JLog::WARNING, 'jerror');
}
else
{
// Make sure the item ids are integers
jimport('joomla.utilities.arrayhelper');
ArrayHelper::toInteger($cid);

if (count($cid) > 1 && !extension_loaded('zlib'))
{
$cid = array($cid[0]);
}

$contentType = 'text/plain';
$content = '';

// Download single PHP file
if (count($cid) == 1)
{
/** @var RedcoreTableWebservice $table */
$table = RTable::getAdminInstance('Webservice_History_Log', array(), 'com_redcore');
$fileName = '';

if ($table && $table->load($cid[0]))
{
$path = JPATH_ROOT . '/' . $table->file_name;

if (is_file($path))
{
$fileName = substr(basename($path), 0, -3) . 'txt';
$content = file_get_contents($path);
$content = substr($content, 33);
}
}
}
// Download package of PHP files in a ZIP
else
{
/** @var RedcoreTableWebservice_History_Log $table */
$table = RTable::getAdminInstance('Webservice_History_Log', array(), 'com_redcore');
$app = JFactory::getApplication();
$contentType = 'application/zip';
$fileName = 'webservice_history_logs_' . (date('Y_m_d_H_i_s')) . '.zip';

$files = array();

foreach ($cid as $id)
{
$table->reset();

if ($table->load($id))
{
$path = JPATH_ROOT . '/' . $table->file_name;

if (is_file($path))
{
$content = file_get_contents($path);
$content = substr($content, 33);
$files[] = array(
'name' => substr(basename($path), 0, -3) . 'txt',
'data' => $content,
'time' => time()
);
}
}
}

$uniqueFile = uniqid('webservice_history_log_files_');
$zipFile = $app->get('tmp_path') . '/' . $uniqueFile . '.zip';

// Run the packager
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
$delete = JFolder::files($app->get('tmp_path') . '/', $uniqueFile, false, true);

if (!empty($delete))
{
if (!JFile::delete($delete))
{
// JFile::delete throws an error
$this->setError(JText::_('COM_REDCORE_WEBSERVICES_ERR_ZIP_DELETE_FAILURE'));
$this->setRedirect($this->getRedirectToListRoute());

return false;
}
}

$packager = JArchive::getAdapter('zip');

if (!$packager)
{
$this->setError(JText::_('COM_REDCORE_WEBSERVICES_ERR_ZIP_ADAPTER_FAILURE'));
$this->setRedirect($this->getRedirectToListRoute());

return false;
}
elseif (!$packager->create($zipFile, $files))
{
$this->setError(JText::_('COM_REDCORE_WEBSERVICES_ERR_ZIP_CREATE_FAILURE'));
$this->setRedirect($this->getRedirectToListRoute());

return false;
}

$content = file_get_contents($zipFile);
}

if ($content)
{
// Send the headers
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-type: " . $contentType . "; charset=UTF-8");
header("Content-Disposition: attachment; filename=\"" . $fileName . "\";");

// Send the file
echo $content;

JFactory::getApplication()->close();
}
}

// Set redirect
$this->setRedirect($this->getRedirectToListRoute());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ COM_REDCORE_WEBSERVICES_DOWNLOAD_XML="Download XML"
COM_REDCORE_WEBSERVICES_ERR_ZIP_ADAPTER_FAILURE="Zip adapter failure"
COM_REDCORE_WEBSERVICES_ERR_ZIP_CREATE_FAILURE="Zip create failure"
COM_REDCORE_WEBSERVICES_ERR_ZIP_DELETE_FAILURE="Zip delete failure"
COM_REDCORE_WEBSERVICE_VERSION_SELECT="Select version"

; OAuth Clients
COM_REDCORE_OAUTH_CLIENTS="OAuth Clients"
Expand Down Expand Up @@ -540,3 +541,45 @@ COM_REDCORE_PAYMENT_REFUND_PAYMENT_FAILED="Refund payment failed: %s"
COM_REDCORE_PAYMENT_DELETE_PAYMENT="Delete payment from gateway"
COM_REDCORE_PAYMENT_DELETE_PAYMENT_SUCCESS="Delete payment from gateway success"
COM_REDCORE_PAYMENT_DELETE_PAYMENT_FAILED="Delete payment from gateway failed: %s"

; Webservice History Logs
COM_REDCORE_WEBSERVICES_HISTORY_LOGS_PLUGIN_LABEL_WARNING="redCORE Webservice History Log feature is switched off. Please go to redCORE configuration and activate the feature. %s."
COM_REDCORE_WEBSERVICE_HISTORY_LOGS_TITLE="Webservice History Logs"
COM_REDCORE_WEBSERVICE_HISTORY_LOGS_CREATED_DATE_LABEL="Created"
COM_REDCORE_WEBSERVICE_HISTORY_LOGS_OPERATION_LABEL="Operation"
COM_REDCORE_WEBSERVICE_HISTORY_LOGS_EXECUTION_TIME_LABEL="Time"
COM_REDCORE_WEBSERVICE_HISTORY_LOGS_EXECUTION_MEMORY_LABEL="Memory"
COM_REDCORE_WEBSERVICE_HISTORY_LOGS_MESSAGES_LABEL="Messages"
COM_REDCORE_WEBSERVICE_HISTORY_LOGS_AUTHENTICATION_USER_LABEL="Auth user"
COM_REDCORE_WEBSERVICE_HISTORY_LOGS_USING_SOAP="using SOAP"
COM_REDCORE_WEBSERVICE_HISTORY_LOGS="Webservice History"
COM_REDCORE_WEBSERVICE_HISTORY_LOGS_SELECT_SOAP="- Using SOAP -"
COM_REDCORE_WEBSERVICE_HISTORY_LOGS_DOWNLOAD_RESPONSE_DATA="Download Response Data"
COM_REDCORE_WEBSERVICE_HISTORY_LOGS_GET_RESPONSE_LABEL="Get Payload"
COM_REDCORE_WEBSERVICE_HISTORY_LOG_OPERATION_SELECT="Operation"
COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_ALL="All"
COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_CREATE="Create"
COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_READ="Read"
COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_UPDATE="Update"
COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_DELETE="Delete"
COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_TASK="Task"
COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_READ_LIST="Read List"
COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_READ_ITEM="Read Item"
COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_DOCUMENTATION="Documentation"
COM_REDCORE_WEBSERVICE_HISTORY_LOGS_START_TIME="Start time"
COM_REDCORE_WEBSERVICE_HISTORY_LOGS_END_TIME="End time"
COM_REDCORE_WEBSERVICE_HISTORY_LOG_TITLE="Webservice History Log"
COM_REDCORE_WEBSERVICE_HISTORY_LOG_OPERATION_LABEL="Operation"
COM_REDCORE_WEBSERVICE_HISTORY_LOG_AUTHENTICATION_LABEL="Authentication"
COM_REDCORE_WEBSERVICE_HISTORY_LOG_AUTHENTICATION_USER_LABEL="Auth User"
COM_REDCORE_WEBSERVICE_HISTORY_LOG_METHOD_LABEL="Method"
COM_REDCORE_WEBSERVICE_HISTORY_LOG_USING_SOAP_LABEL="Using Soap"
COM_REDCORE_WEBSERVICE_HISTORY_LOG_EXECUTION_TIME_LABEL="Execution time"
COM_REDCORE_WEBSERVICE_HISTORY_LOG_EXECUTION_MEMORY_LABEL="Execution memory"
COM_REDCORE_WEBSERVICE_HISTORY_LOG_STATUS_LABEL="Status"
COM_REDCORE_WEBSERVICE_HISTORY_LOG_CREATED_BY_LABEL="Created by"
COM_REDCORE_WEBSERVICE_HISTORY_LOG_CREATED_DATE_LABEL="Created time"
COM_REDCORE_WEBSERVICE_HISTORY_LOG_URL_LABEL="URL"
COM_REDCORE_WEBSERVICE_HISTORY_LOG_MESSAGES_LABEL="Messages"
COM_REDCORE_WEBSERVICE_HISTORY_LOG_FILE_LABEL="File"

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ COM_REDCORE_DASHBOARD="redCORE Dashboard"
COM_REDCORE_CONFIGURATION="Configuration"
COM_REDCORE_TRANSLATIONS="Translations"
COM_REDCORE_WEBSERVICES="Webservices"
COM_REDCORE_WEBSERVICE_HISTORY_LOGS="Webservice History"
COM_REDCORE_OAUTH_CLIENTS="OAuth Clients"
COM_REDCORE_PAYMENTS="Payments"

Expand Down Expand Up @@ -134,4 +135,15 @@ COM_REDCORE_CONFIG_PAYMENT_ENABLE_CHART_SANDBOX_PAYMENTS_DESC="Enable if chart s
; General
REDCORE_GENERAL_OPTIONS="General options"
REDCORE_GENERAL_DOMAIN_LABEL="Domain"
REDCORE_GENERAL_DOMAIN_DESC="Current domain for use in CLI notification"
REDCORE_GENERAL_DOMAIN_DESC="Current domain for use in CLI notification"

; Webservice History Log
COM_REDCORE_CONFIG_WEBSERVICES_HISTORY_LOG_OPTIONS="Webservice History Log options"
COM_REDCORE_CONFIG_SOAP_ENABLE_WEBSERVICE_HISTORY_LOG="Enable Webservice History Log"
COM_REDCORE_CONFIG_SOAP_ENABLE_WEBSERVICE_HISTORY_LOG_DESC="Enable Webservice History Log"
COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_PATH="History Log Path"
COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_PATH_DESC="Starting from your site root path, this path will be used to store webservice history log request and response data"
COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_STORE_READ_RESPONSE="Store Read response"
COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_STORE_READ_RESPONSE_DESC="Read responses are big in their nature and are very often, so storing them by default might present a huge disk consumption. If turned off response body will not be in the file log."
COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION="Log Operations"
COM_REDCORE_CONFIG_SOAP_WEBSERVICE_HISTORY_LOG_OPERATION_DESC="Only selected operations will be logged"
10 changes: 10 additions & 0 deletions extensions/components/com_redcore/admin/layouts/sidebar.bs3.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@
</h4>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a href="<?php echo JRoute::_('index.php?option=com_redcore&view=webservice_history_logs') ?>">
<i class="icon-globe"></i>
<?php echo JText::_('COM_REDCORE_WEBSERVICE_HISTORY_LOGS') ?>
</a>
</h4>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
Expand Down
9 changes: 9 additions & 0 deletions extensions/components/com_redcore/admin/layouts/sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@
</a>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a href="<?php echo JRoute::_('index.php?option=com_redcore&view=webservice_history_logs') ?>" class="accordion-toggle text-error">
<h5>
<i class="icon-dashboard"></i><?php echo JText::_('COM_REDCORE_WEBSERVICE_HISTORY_LOGS') ?>
</h5>
</a>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a href="<?php echo JRoute::_('index.php?option=com_redcore&view=oauth_clients') ?>" class="accordion-toggle text-error">
Expand Down
Loading