Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1032 from gburton/1.0.7.13
Browse files Browse the repository at this point in the history
1.0.7.13
  • Loading branch information
gburton authored Jan 11, 2021
2 parents ea152f8 + 7426734 commit 090c3fc
Show file tree
Hide file tree
Showing 75 changed files with 2,493 additions and 2,053 deletions.
68 changes: 33 additions & 35 deletions admin/action_recorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
$modules_list = [['id' => '', 'text' => TEXT_ALL_MODULES]];

$modules_query = tep_db_query("SELECT DISTINCT module FROM action_recorder ORDER BY module");
while ($module = tep_db_fetch_array($modules_query)) {
while ($module = $modules_query->fetch_assoc()) {
$modules[] = $module['module'];

$modules_list[] = [
Expand All @@ -46,10 +46,10 @@
}

$action = $_GET['action'] ?? '';

$OSCOM_Hooks->call('action_recorder', 'preAction');

if (tep_not_null($action)) {
if (!Text::is_empty($action)) {
switch ($action) {
case 'expire':
$expired_entries = 0;
Expand All @@ -68,7 +68,7 @@
}
}
}

$OSCOM_Hooks->call('action_recorder', 'expireAction');

$messageStack->add_session(sprintf(SUCCESS_EXPIRED_ENTRIES, $expired_entries), 'success');
Expand All @@ -78,32 +78,30 @@
break;
}
}

$OSCOM_Hooks->call('action_recorder', 'postAction');

require 'includes/template_top.php';
?>

<div class="row">
<div class="col-12 col-sm-6">
<h1 class="display-4 mb-2"><?php echo HEADING_TITLE; ?></h1>
<h1 class="display-4 mb-2"><?= HEADING_TITLE ?></h1>
</div>
<div class="col-8 col-sm-4">
<?php
echo tep_draw_form('search', 'action_recorder.php', '', 'get');
echo tep_draw_input_field('search', null, 'placeholder="' . TEXT_FILTER_SEARCH . '"', null, null, 'class="form-control form-control-sm mb-1"');
echo tep_draw_hidden_field('module') . tep_hide_session_id();
echo '</form>';
echo tep_draw_form('filter', 'action_recorder.php', '', 'get');
echo tep_draw_pull_down_menu('module', $modules_list, null, 'onchange="this.form.submit();"', 'class="form-control form-control-sm"');
echo tep_draw_hidden_field('search') . tep_hide_session_id();
echo '</form>';
<?=
tep_draw_form('search', 'action_recorder.php', '', 'get'),
tep_draw_input_field('search', null, 'placeholder="' . TEXT_FILTER_SEARCH . '"', 'text', null, 'class="form-control form-control-sm mb-1"'),
tep_draw_hidden_field('module'), tep_hide_session_id(),
'</form>',
tep_draw_form('filter', 'action_recorder.php', '', 'get'),
tep_draw_pull_down_menu('module', $modules_list, null, 'onchange="this.form.submit();"', 'class="form-control form-control-sm"'),
tep_draw_hidden_field('search'), tep_hide_session_id(),
'</form>'
?>
</div>
<div class="col-4 col-sm-2">
<?php
echo tep_draw_bootstrap_button(IMAGE_DELETE, 'fas fa-trash', tep_href_link('action_recorder.php', 'action=expire' . (isset($_GET['module']) && in_array($_GET['module'], $modules) ? '&module=' . $_GET['module'] : '')), 'primary', null, 'btn-danger btn-block btn-sm');
?>
<?= tep_draw_bootstrap_button(IMAGE_DELETE, 'fas fa-trash', tep_href_link('action_recorder.php', 'action=expire' . (isset($_GET['module']) && in_array($_GET['module'], $modules) ? '&module=' . $_GET['module'] : '')), 'primary', null, 'btn-danger btn-block btn-sm') ?>
</div>
</div>

Expand All @@ -113,11 +111,11 @@
<table class="table table-striped table-hover">
<thead class="thead-dark">
<tr>
<th><?php echo TABLE_HEADING_MODULE; ?></th>
<th><?php echo TABLE_HEADING_CUSTOMER; ?></th>
<th><?php echo TABLE_HEADING_SUCCESS; ?></th>
<th class="text-right"><?php echo TABLE_HEADING_DATE_ADDED; ?></th>
<th class="text-right"><?php echo TABLE_HEADING_ACTION; ?></th>
<th><?= TABLE_HEADING_MODULE ?></th>
<th><?= TABLE_HEADING_CUSTOMER ?></th>
<th><?= TABLE_HEADING_SUCCESS ?></th>
<th class="text-right"><?= TABLE_HEADING_DATE_ADDED ?></th>
<th class="text-right"><?= TABLE_HEADING_ACTION ?></th>
</tr>
</thead>
<tbody>
Expand All @@ -135,14 +133,14 @@
$actions_query_raw = "SELECT * FROM action_recorder " . (empty($filter) ? '' : " WHERE " . implode(" AND ", $filter)) . " ORDER BY date_added DESC";
$actions_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $actions_query_raw, $actions_query_numrows);
$actions_query = tep_db_query($actions_query_raw);
while ($actions = tep_db_fetch_array($actions_query)) {
while ($actions = $actions_query->fetch_assoc()) {
$module = $actions['module'];

$module_title = ${$module}->title ?? $actions['module'];

if (!isset($aInfo) && (!isset($_GET['aID']) || ($_GET['aID'] == $actions['id']))) {
$actions_extra_query = tep_db_query("select identifier from action_recorder where id = '" . (int)$actions['id'] . "'");
$actions_extra = tep_db_fetch_array($actions_extra_query);
$actions_extra_query = tep_db_query("SELECT identifier FROM action_recorder WHERE id = " . (int)$actions['id']);
$actions_extra = $actions_extra_query->fetch_assoc();

$aInfo_array = array_merge($actions, $actions_extra, ['module' => $module_title]);
$aInfo = new objectInfo($aInfo_array);
Expand All @@ -156,11 +154,11 @@
$icon = '<a href="' . tep_href_link('action_recorder.php', tep_get_all_get_params(['aID']) . 'aID=' . (int)$actions['id']) . '"><i class="fas fa-info-circle text-muted"></i></a>';
}
?>
<td><?php echo $module_title; ?></td>
<td><?php echo htmlspecialchars($actions['user_name']) . ' [' . (int)$actions['user_id'] . ']'; ?></td>
<td><?php echo ($actions['success'] == '1') ? '<i class="fas fa-check-circle text-success"></i>' : '<i class="fas fa-times-circle text-danger"></i>'; ?></td>
<td class="text-right"><?php echo tep_datetime_short($actions['date_added']); ?></td>
<td class="text-right"><?php echo $icon; ?></td>
<td><?= $module_title ?></td>
<td><?= htmlspecialchars($actions['user_name']) . ' [' . (int)$actions['user_id'] . ']' ?></td>
<td><?= ($actions['success'] == '1') ? '<i class="fas fa-check-circle text-success"></i>' : '<i class="fas fa-times-circle text-danger"></i>' ?></td>
<td class="text-right"><?= tep_datetime_short($actions['date_added']) ?></td>
<td class="text-right"><?= $icon ?></td>
</tr>
<?php
}
Expand All @@ -170,8 +168,8 @@
</div>

<div class="row my-1">
<div class="col"><?php echo $actions_split->display_count($actions_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_ENTRIES); ?></div>
<div class="col text-right mr-2"><?php echo $actions_split->display_links($actions_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], (isset($_GET['module']) && in_array($_GET['module'], $modules) && is_object(${$_GET['module']}) ? 'module=' . $_GET['module'] : null) . (empty($_GET['search']) ? null : '&search=' . $_GET['search'])); ?></div>
<div class="col"><?= $actions_split->display_count($actions_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_ENTRIES) ?></div>
<div class="col text-right mr-2"><?= $actions_split->display_links($actions_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], (isset($_GET['module']) && in_array($_GET['module'], $modules) && is_object(${$_GET['module']}) ? 'module=' . $_GET['module'] : null) . (empty($_GET['search']) ? null : '&search=' . $_GET['search'])) ?></div>
</div>
</div>

Expand All @@ -184,13 +182,13 @@
if (isset($aInfo) && is_object($aInfo)) {
$heading[] = ['text' => $aInfo->module];

$contents[] =['text' => TEXT_INFO_IDENTIFIER . ' ' . (!empty($aInfo->identifier) ? '<a href="' . tep_href_link('action_recorder.php', 'search=' . $aInfo->identifier) . '"><u>' . htmlspecialchars($aInfo->identifier) . '</u></a>': '(empty)')];
$contents[] =['text' => TEXT_INFO_IDENTIFIER . ' ' . (empty($aInfo->identifier) ? '(empty)' : '<a href="' . tep_href_link('action_recorder.php', 'search=' . $aInfo->identifier) . '"><u>' . htmlspecialchars($aInfo->identifier) . '</u></a>')];
$contents[] = ['text' => sprintf(TEXT_INFO_DATE_ADDED, tep_datetime_short($aInfo->date_added))];
}
break;
}

if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
if ( ([] !== $heading) && ([] !== $contents) ) {
echo '<div class="col-12 col-sm-4">';
$box = new box();
echo $box->infoBox($heading, $contents);
Expand Down
Loading

0 comments on commit 090c3fc

Please sign in to comment.