{\r
$oldTS = strtotime($old_date);\r
$manager->notify('PreDateFoot',array('blog' => &$this, 'timestamp' => $oldTS));\r
- $tmp_footer = i18n::strftime(isset($template['DATE_FOOTER'])?$template['DATE_FOOTER']:'', $oldTS);\r
+
+ if ( !in_array('DATE_FOOTER', $template) || !empty($template['DATE_FOOTER']) )
+ {
+ $tmp_footer = i18n::formatted_datetime('', $oldTS);
+ }
+ else
+ {
+ $tmp_footer = i18n::formatted_datetime($template['DATE_FOOTER'], $oldTS);
+ }
$parser->parse($tmp_footer);\r
$manager->notify('PostDateFoot',array('blog' => &$this, 'timestamp' => $oldTS));\r
}\r
$manager->notify('PreDateHead',array('blog' => &$this, 'timestamp' => $timestamp));\r
// note, to use templatvars in the dateheader, the %-characters need to be doubled in\r
// order to be preserved by strftime\r
- $tmp_header = i18n::strftime((isset($template['DATE_HEADER']) ? $template['DATE_HEADER'] : null), $timestamp);\r
+ if ( !in_array('DATE_HEADER', $template) || !empty($template['DATE_HEADER']) )\r
+ {\r
+ $tmp_footer = i18n::formatted_datetime('', $timestamp);\r
+ }\r
+ else\r
+ {\r
+ $tmp_footer = i18n::formatted_datetime($template['DATE_FOOTER'], $timestamp);\r
+ }\r
+
$parser->parse($tmp_header);\r
$manager->notify('PostDateHead',array('blog' => &$this, 'timestamp' => $timestamp));\r
}\r
);\r
\r
$temp = TEMPLATE::fill($template['ARCHIVELIST_LISTITEM'],$data);\r
- echo i18n::strftime($temp,$current->itime);\r
+ echo i18n::formatted_datetime($temp, $current->itime);
return;\r
}\r
\r
if ( !$showFuture )\r
{\r
// don't show future items\r
- $query .= ' and i.itime<="' . i18n::formatted_datetime('mysql', $this->getCorrectTime()) . '"';\r
+ $query .= " and i.itime<='" . i18n::formatted_datetime('mysql', $this->getCorrectTime()) . "'";\r
}\r
\r
$query .= ' and i.inumber='.intval($value);\r
* Returns the requested comment\r
* \r
* @static\r
- * @param integer $commentid\r
+ * @param integer $commentid id for comment
* @return array comment information\r
* \r
*/\r
. 'WHERE cnumber = %d;';\r
\r
$query = sprintf($query, sql_table('comment'), sql_table('member'), (integer) $commentid);\r
+ $comments = sql_query($query);
\r
$aCommentInfo = sql_fetch_assoc($comments);\r
\r
- if ($aCommentInfo) {\r
+ if ( $aCommentInfo )
+ {
$aCommentInfo['timestamp'] = strtotime($aCommentInfo['ctime']);\r
}\r
\r
}\r
\r
/**\r
+ * COMMENT::prepare()
* Prepares a comment to be saved\r
*\r
* @static\r
+ * @param array $comment comment data
+ * @return array comment date
+ *
*/\r
function prepare($comment)\r
{\r
$comment['email'] = trim(strtr($comment['email'], "\'\"\n", '-- ') );\r
\r
// begin if: a comment userid is supplied, but does not have an "http://" or "https://" at the beginning - prepend an "http://"\r
- if ( !empty($comment['userid']) && (i18n::strpos($comment['userid'], 'http://') !== 0) && (i18n::strpos($comment['userid'], 'https://') !== 0) )\r
+ if ( array_key_exists('userid', $comment)
+ && !empty($comment['userid'])
+ && (i18n::strpos($comment['userid'], 'http://') !== 0)
+ && (i18n::strpos($comment['userid'], 'https://') !== 0) )
{\r
$comment['userid'] = 'http://' . $comment['userid'];\r
- } // end if\r
+ }
\r
$comment['body'] = COMMENT::prepareBody($comment['body']);\r
\r
}\r
\r
/**\r
+ * COMMENT::prepareBody()
* Prepares the body of a comment\r
*\r
* @ static\r
+ * @param string $body string for comment body
+ * @return string validate string for comment body
+ *
*/\r
- function prepareBody($body) {\r
-\r
+ function prepareBody($body)
+ {
# replaced ereg_replace() below with preg_replace(). ereg* functions are deprecated in PHP 5.3.0\r
# original ereg_replace: ereg_replace("\n.\n.\n", "\n", $body);\r
\r
* Creates a link code for unlinked URLs with different protocols\r
*\r
* @static\r
- * @param String $pre Prefix of comment\r
- * @param String $url URL\r
- * @param String $protocol http, mailto and so on\r
+ * @param string $pre Prefix of comment
+ * @param string $url URL
+ * @param string $protocol http, mailto and so on
+ * @return string string including anchor element and child text
+ *
*/\r
function createLinkCode($pre, $url, $protocol = 'http')\r
{\r
}\r
\r
/**\r
+ * COMMENT::prepareBody_cb()
* This method is a callback for creating link codes\r
- * @param array $match\r
- * @return string\r
+ *
+ * @param array $match elements for achor
+ * @return string including anchor element and child text
+ *
*/\r
function prepareBody_cb($match)\r
{\r
return self::createLinkCode($match[1], $match[2], 'http');\r
break;\r
}\r
+ return;
}\r
\r
}\r
\r
-?>\r
* Working with Time Zones\r
* @link http://www.w3.org/TR/timezone/\r
* \r
- * @param String $format time expression format\r
- * @param String $timestamp UNIX timestamp\r
+ * @param String $format time expression format\r
+ * @param String $timestamp UNIX timestamp\r
* @param Integer $offset timestamp offset\r
- * @return String formatted datetime\r
+ * @return String formatted datetime\r
*/\r
static public function formatted_datetime($format, $timestamp, $offset=0)\r
{\r