Skip to content

Commit febb89a

Browse files
committed
Added option to flush log entries
1 parent 852191f commit febb89a

File tree

4 files changed

+23
-8
lines changed

4 files changed

+23
-8
lines changed

Diff for: protected/extensions/CmsInput.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public function cleanEncode($str)
164164
*/
165165
public function stripClean($str)
166166
{
167-
return $this->xssClean($this->stripTags($str));
167+
return $this->stripTags($this->xssClean($str));
168168
}
169169

170170
/**

Diff for: protected/modules_core/admin/controllers/LoggingController.php

+7
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,11 @@ public function actionIndex()
8282
));
8383
}
8484

85+
public function actionFlush()
86+
{
87+
$this->forcePostRequest();
88+
Logging::model()->deleteAll();
89+
$this->redirect($this->createUrl('index'));
90+
}
91+
8592
}

Diff for: protected/modules_core/admin/views/logging/index.php

+12-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
<div class="panel-heading"><?php echo Yii::t('AdminModule.views_logging_index', '<strong>Error</strong> logging'); ?></div>
33
<div class="panel-body">
44

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

1112
<hr>
13+
14+
1215

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

3033
<h4 class="media-heading">
31-
<span class="label <?php echo $labelClass; ?>"><?php echo $entry->level; ?></span>&nbsp;
34+
<span class="label <?php echo $labelClass; ?>"><?php echo CHtml::encode($entry->level); ?></span>&nbsp;
3235
<?php echo date('r', $entry->logtime); ?>&nbsp;
33-
<span class="pull-right"><?php echo $entry->category; ?></span>
36+
<span class="pull-right"><?php echo CHtml::encode($entry->category); ?></span>
3437
</h4>
35-
<?php echo $entry->message; ?>
38+
<?php echo CHtml::encode($entry->message); ?>
3639
</div>
3740
</li>
3841

3942
<?php endforeach; ?>
4043
</ul>
4144

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

4350
<center>
4451
<?php

Diff for: protected/modules_core/notification/controllers/ListController.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,14 @@ public function actionIndex()
4343
{
4444

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

4848
// create database query
4949
$criteria = new CDbCriteria();
5050
if ($lastEntryId > 0) {
5151
// start from last entry id loaded
52-
$criteria->condition = 'id<' . $lastEntryId;
52+
$criteria->condition = 'id<:lastEntryId';
53+
$criteria->params = array(':lastEntryId' => $lastEntryId);
5354
}
5455
$criteria->order = 'seen ASC, created_at DESC';
5556
$criteria->limit = 6;

0 commit comments

Comments
 (0)