Skip to content
Permalink
Browse files Browse the repository at this point in the history
Added option to flush log entries
  • Loading branch information
luke- committed Nov 28, 2014
1 parent 852191f commit febb89a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion protected/extensions/CmsInput.php
Expand Up @@ -164,7 +164,7 @@ public function cleanEncode($str)
*/
public function stripClean($str)
{
return $this->xssClean($this->stripTags($str));
return $this->stripTags($this->xssClean($str));
}

/**
Expand Down
Expand Up @@ -82,4 +82,11 @@ public function actionIndex()
));
}

public function actionFlush()
{
$this->forcePostRequest();
Logging::model()->deleteAll();
$this->redirect($this->createUrl('index'));
}

}
17 changes: 12 additions & 5 deletions protected/modules_core/admin/views/logging/index.php
Expand Up @@ -2,13 +2,16 @@
<div class="panel-heading"><?php echo Yii::t('AdminModule.views_logging_index', '<strong>Error</strong> logging'); ?></div>
<div class="panel-body">


<div>
<?php echo Yii::t('AdminModule.views_logging_index', 'Total {count} entries found.', array("{count}" => $itemCount)); ?>
<span
class="pull-right"><?php echo Yii::t('AdminModule.views_logging_index', 'Displaying {count} entries per page.', array("{count}" => $pageSize)); ?></span>

<span class="pull-right"><?php echo Yii::t('AdminModule.views_logging_index', 'Displaying {count} entries per page.', array("{count}" => $pageSize)); ?></span>
</div>

<hr>



<ul class="media-list">
<?php foreach ($entries as $entry) : ?>
Expand All @@ -28,17 +31,21 @@ class="pull-right"><?php echo Yii::t('AdminModule.views_logging_index', 'Display
?>

<h4 class="media-heading">
<span class="label <?php echo $labelClass; ?>"><?php echo $entry->level; ?></span>&nbsp;
<span class="label <?php echo $labelClass; ?>"><?php echo CHtml::encode($entry->level); ?></span>&nbsp;
<?php echo date('r', $entry->logtime); ?>&nbsp;
<span class="pull-right"><?php echo $entry->category; ?></span>
<span class="pull-right"><?php echo CHtml::encode($entry->category); ?></span>
</h4>
<?php echo $entry->message; ?>
<?php echo CHtml::encode($entry->message); ?>
</div>
</li>

<?php endforeach; ?>
</ul>

<?php if ($itemCount != 0): ?>
<div class="pull-right"><?php echo HHtml::postLink('Flush entries', array('flush'), array('class'=>'btn btn-danger')); ?></div>
<?php endif; ?>


<center>
<?php
Expand Down
Expand Up @@ -43,13 +43,14 @@ public function actionIndex()
{

// the id from the last entry loaded
$lastEntryId = Yii::app()->request->getParam('from');
$lastEntryId = (int) Yii::app()->request->getParam('from');

// create database query
$criteria = new CDbCriteria();
if ($lastEntryId > 0) {
// start from last entry id loaded
$criteria->condition = 'id<' . $lastEntryId;
$criteria->condition = 'id<:lastEntryId';
$criteria->params = array(':lastEntryId' => $lastEntryId);
}
$criteria->order = 'seen ASC, created_at DESC';
$criteria->limit = 6;
Expand Down

0 comments on commit febb89a

Please sign in to comment.