From 6caabe28ab2839d20f70cff541713eeb8c57fc21 Mon Sep 17 00:00:00 2001 From: shizuki Date: Wed, 2 Jul 2008 01:05:19 +0000 Subject: [PATCH] Fix bug by nakahara21 git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@642 1ca29b6e-896d-4ea0-84a5-967f57386b96 --- trunk/NP_UpdateTime/NP_UpdateTime.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/trunk/NP_UpdateTime/NP_UpdateTime.php b/trunk/NP_UpdateTime/NP_UpdateTime.php index fcd4caf..2ad9bc3 100644 --- a/trunk/NP_UpdateTime/NP_UpdateTime.php +++ b/trunk/NP_UpdateTime/NP_UpdateTime.php @@ -1,6 +1,7 @@ createOption('DefautMode', _UPDATETIME_DEFAULT_MODE, 'select', '1', _UPDATETIME_DEFAULT_MODE_VALUE); $this->createOption('BeforeTime', _UPDATETIME_BEFORE_TIME, 'text', _UPDATETIME_BEFORE_TIME_VALUE); $this->createOption('AfterTime', _UPDATETIME_AFTER_TIME, 'text', _UPDATETIME_AFTER_TIME_VALUE); - $this->createOption('DateFormat', _UPDATETIME_DATE_FORMAT, 'text', 'Y-m-d H:i:s'); + $this->createOption('Locale', _UPDATETIME_DATE_LOCALE, 'text', 'ja_JP.' . _CHARSET); + $this->createOption('DateFormat', _UPDATETIME_DATE_FORMAT, 'text', '%Y-%m-%d %H:%M:%S'); $this->createOption('sLists', _UPDATETIME_S_LISTS, 'text', ''); $this->createOption('sItems', _UPDATETIME_S_ITEMS, 'text', '
  • '); @@ -105,9 +107,9 @@ class NP_UpdateTime extends NucleusPlugin $updateOver = _UPDATETIME_OVERWRITE; $recordOnly = _UPDATETIME_RECORDEONLY; $noAction = _UPDATETIME_NOACTION; - $printData = '

    ' . $updateMode . "

    \n" + $printData = '

    ' . $updateMode . "

    \n" . '' - . '
    \n" + . '
    \n" . '' . '
    \n" . '' @@ -127,6 +129,9 @@ class NP_UpdateTime extends NucleusPlugin $updatetime = mysqldate($data['blog']->getCorrectTime()); if ($recd == 2) { + $upQuery = 'UPDATE ' . sql_table('item') + . ' SET itime = ' . $updatetime + . ' WHERE inumber = ' . intval($data['itemid']); $upTimeQue = 'SELECT itime as result ' . 'FROM ' . sql_table('item') . ' WHERE inumber=' . intval($data['itemid']); @@ -134,10 +139,7 @@ class NP_UpdateTime extends NucleusPlugin . 'FROM ' . sql_table('plugin_rectime') . ' WHERE up_id = ' . intval($data['itemid']); $updatetime = '"' . quickQuery($upTimeQue) . '"'; - $tmptime = '"' . quickQuery($tmpTimeQue) . '"'; - $upQuery = 'UPDATE ' . sql_table('item') - . ' SET itime = ' . $updatetime - . ' WHERE inumber = ' . intval($data['itemid']); + $tmptime = '"' . quickQuery($tmpTimeQue) . '"'; if ($tmptime > $updatetime) { $updatetime = $tmptime; } @@ -149,7 +151,7 @@ class NP_UpdateTime extends NucleusPlugin $query = 'INSERT INTO ' . sql_table('plugin_rectime') . ' (up_id, updatetime) ' . 'VALUES' - . ' (' . intval($data['itemid']) . ', "' . $updatetime . '")'; + . ' (' . intval($data['itemid']) . ', ' . $updatetime . ')'; $res = sql_query($query); if (strpos($res, 'mySQL')) { return '

    Could not save data: ' . $res; @@ -219,6 +221,7 @@ class NP_UpdateTime extends NucleusPlugin function doTemplateVar(&$item) { + setlocale(LC_TIME, $this->getOption('Locale')); $query = 'SELECT' . ' r.up_id,' . ' UNIX_TIMESTAMP(r.updatetime) as updatetime,' @@ -231,7 +234,8 @@ class NP_UpdateTime extends NucleusPlugin . ' and r.up_id = i.inumber'; $res = sql_query($query); if ($row = mysql_fetch_assoc($res)) { - $data['utime'] = date($this->getOption('DateFormat'), $row['updatetime']); +// $data['utime'] = date($this->getOption('DateFormat'), $row['updatetime']); + $data['utime'] = strftime($this->getOption('DateFormat'), $row['updatetime']); if ($row['updatetime'] > $row['itemtime']) { echo TEMPLATE::fill($this->getOption('AfterTime'), $data); } elseif ($row['updatetime'] < $row['itemtime']) { -- 2.11.0