use sql statement
This commit is contained in:
parent
0b9849f4ed
commit
a175e88d66
1 changed files with 9 additions and 6 deletions
|
@ -16,6 +16,7 @@ namespace Dotclear\Plugin\lastBlogUpdate;
|
||||||
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcMedia;
|
use dcMedia;
|
||||||
|
use Dotclear\Database\Statement\SelectStatement;
|
||||||
use Dotclear\Helper\Date;
|
use Dotclear\Helper\Date;
|
||||||
use Dotclear\Helper\Html\Html;
|
use Dotclear\Helper\Html\Html;
|
||||||
use Dotclear\Plugin\widgets\WidgetsStack;
|
use Dotclear\Plugin\widgets\WidgetsStack;
|
||||||
|
@ -167,13 +168,15 @@ class Widgets
|
||||||
|
|
||||||
# Media
|
# Media
|
||||||
if ($w->media_show && $w->media_text) {
|
if ($w->media_show && $w->media_text) {
|
||||||
$rs = dcCore::app()->con->select(
|
$sql = new SelectStatement();
|
||||||
'SELECT media_upddt FROM ' . dcCore::app()->prefix . dcMedia::MEDIA_TABLE_NAME . ' ' .
|
$rs = $sql->from(dcCore::app()->prefix . dcMedia::MEDIA_TABLE_NAME)
|
||||||
"WHERE media_path='" . dcCore::app()->con->escapeStr(dcCore::app()->blog->settings->get('system')->get('public_path')) . "' " .
|
->column('media_upddt')
|
||||||
'ORDER BY media_upddt DESC ' . dcCore::app()->con->limit(1)
|
->where('media_path = ' . $sql->quote((string) dcCore::app()->blog->settings->get('system')->get('public_path')))
|
||||||
);
|
->order('media_upddt DESC')
|
||||||
|
->limit(1)
|
||||||
|
->select();
|
||||||
|
|
||||||
if (!$rs->isEmpty()) {
|
if (!is_null($rs) && !$rs->isEmpty()) {
|
||||||
$title = $w->media_title ? sprintf('<strong>%s</strong>', Html::escapeHTML($w->media_title)) : '';
|
$title = $w->media_title ? sprintf('<strong>%s</strong>', Html::escapeHTML($w->media_title)) : '';
|
||||||
$text = Date::str($w->media_text, (int) strtotime($rs->f('media_upddt')), dcCore::app()->blog->settings->get('system')->get('blog_timezone'));
|
$text = Date::str($w->media_text, (int) strtotime($rs->f('media_upddt')), dcCore::app()->blog->settings->get('system')->get('blog_timezone'));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue