/** * Function to convert UNIX time to formatted time string */ function art_formatTimestamp($time, $format = "c", $timeoffset = null) { $artConfig = art_load_config(); if (strtolower($format) == "reg" || strtolower($format) == "") { $format = "c"; } if ((strtolower($format) == "custom" || strtolower($format) == "c") && !empty($artConfig["formatTimestamp_custom"])) { $format = $artConfig["formatTimestamp_custom"]; } xoops_load("xoopslocal"); return XoopsLocal::formatTimestamp($time, $format, $timeoffset); }
/** * Function to convert UNIX time to formatted time string */ function newbb_formatTimestamp($time, $format = "c", $timeoffset = "") { load_functions("locale"); $newbbConfig = newbb_load_config(); $format = strtolower($format); if ($format == "reg" || $format == "") { $format = "c"; } if (($format == "custom" || $format == "c") && !empty($newbbConfig["formatTimestamp_custom"])) { $format = $newbbConfig["formatTimestamp_custom"]; } return XoopsLocal::formatTimestamp($time, $format, $timeoffset); }
/** * Function to convert UNIX time to formatted time string */ function newbb_formatTimestamp($time, $format = "c", $timeoffset = "") { xoops_load("xoopslocal"); require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.config.php"; $newbbConfig = newbb_loadConfig(); $format = strtolower($format); if ($format == "reg" || $format == "") { $format = "c"; } if (($format == "custom" || $format == "c") && !empty($newbbConfig["formatTimestamp_custom"])) { $format = $newbbConfig["formatTimestamp_custom"]; } return XoopsLocal::formatTimestamp($time, $format, $timeoffset); }
/** * @param string $dateFormat * @param string $format * * @return string */ public function datesub($dateFormat = '', $format = 'S') { if (empty($dateformat)) { $dateFormat = $this->publisher->getConfig('format_date'); } xoops_load('XoopsLocal'); return XoopsLocal::formatTimestamp($this->getVar('datesub', $format), $dateFormat); }
/** * @param string $dateFormat * @param string $format * * @return string */ public function datesub($dateFormat = 's', $format = "S") { xoops_load('XoopsLocal'); return XoopsLocal::formatTimestamp($this->getVar('datesub', $format), $dateFormat); }
/** * Function to display formatted times in user timezone */ function formatTimestamp($time, $format = 'l', $timeoffset = '') { xoops_load('XoopsLocal'); return XoopsLocal::formatTimestamp($time, $format, $timeoffset); }
function forum_formatTimestamp($time, $format = "c", $timeoffset = "") { if(strtolower($format) == "reg" || strtolower($format) == "") { $format = "c"; } if( (strtolower($format) == "custom" || strtolower($format) == "c") && !empty($GLOBALS["xoopsModuleConfig"]["formatTimestamp_custom"]) ) { $format = $GLOBALS["xoopsModuleConfig"]["formatTimestamp_custom"]; } load_functions("locale"); return XoopsLocal::formatTimestamp($time, $format, $timeoffset); if(class_exists("XoopsLocal") && is_callable(array("XoopsLocal", "formatTimestamp")) && defined("_TODAY")){ return XoopsLocal::formatTimestamp($time, $format, $timeoffset); } global $xoopsConfig, $xoopsUser; if(strtolower($format) == "rss" || strtolower($format) == "r"){ $TIME_ZONE = ""; if(!empty($GLOBALS['xoopsConfig']['server_TZ'])){ $server_TZ = abs(intval($GLOBALS['xoopsConfig']['server_TZ']*3600.0)); $prefix = ($GLOBALS['xoopsConfig']['server_TZ']<0)?" -":" +"; $TIME_ZONE = $prefix.date("Hi",$server_TZ); } $date = gmdate("D, d M Y H:i:s", intval($time)).$TIME_ZONE; return $date; } $usertimestamp = xoops_getUserTimestamp($time, $timeoffset); switch (strtolower($format)) { case 's': $datestring = _SHORTDATESTRING; break; case 'm': $datestring = _MEDIUMDATESTRING; break; case 'mysql': $datestring = "Y-m-d H:i:s"; break; case 'rss': $datestring = "r"; break; case 'l': $datestring = _DATESTRING; break; case 'c': case 'custom': default: forum_load_lang_file("main", "xforum"); $current_timestamp = xoops_getUserTimestamp(time(), $timeoffset); if(date("Ymd", $usertimestamp) == date("Ymd", $current_timestamp)){ $datestring = _MD_TODAY; }elseif(date("Ymd", $usertimestamp+24*60*60) == date("Ymd", $current_timestamp)){ $datestring = _MD_YESTERDAY; }elseif(date("Y", $usertimestamp) == date("Y", $current_timestamp)){ $datestring = _MD_MONTHDAY; }else{ $datestring = _MD_YEARMONTHDAY; } break; } return date($datestring, $usertimestamp); }
$tpl->assign('channel_desc', htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)); $tpl->assign('channel_lastbuild', XoopsLocal::formatTimestamp(time(), 'rss')); $tpl->assign('channel_webmaster', $xoopsConfig['adminmail']); $tpl->assign('channel_editor', $xoopsConfig['adminmail']); if ($categoryid != -1) { $channel_category .= " > " . $categoryObj->name(); } $tpl->assign('channel_category', htmlspecialchars($channel_category)); $tpl->assign('channel_generator', $publisher->getModule()->name()); $tpl->assign('channel_language', _LANGCODE); $tpl->assign('image_url', XOOPS_URL . '/images/logo.gif'); $dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.gif'); if (empty($dimention[0])) { $width = 140; $height = 140; } else { $width = $dimention[0] > 140 ? 140 : $dimention[0]; $dimention[1] = $dimention[1] * $width / $dimention[0]; $height = $dimention[1] > 140 ? $dimention[1] * $dimention[0] / 140 : $dimention[1]; } $tpl->assign('image_width', $width); $tpl->assign('image_height', $height); $sarray = $publisher->getHandler('item')->getAllPublished(10, 0, $categoryid); if (is_array($sarray)) { $count = $sarray; foreach ($sarray as $item) { $tpl->append('items', array('title' => htmlspecialchars($item->title(), ENT_QUOTES), 'link' => $item->getItemUrl(), 'guid' => $item->getItemUrl(), 'pubdate' => XoopsLocal::formatTimestamp($item->getVar('datesub'), 'rss'), 'description' => htmlspecialchars($item->getBlockSummary(300, true), ENT_QUOTES))); } } } $tpl->display('db:publisher_rss.html');
function formatTimestamp($time, $format = "l", $timeoffset = "") { if (is_callable(array("XoopsLocal", "formatTimestamp"))) { return XoopsLocal::formatTimestamp($time, $format, $timeoffset); // Or // return xoops_local("formatTimestamp", $time, $format, $timeoffset); } global $xoopsConfig, $xoopsUser; $usertimestamp = xoops_getUserTimestamp($time, $timeoffset); switch (strtolower($format)) { case 's': $datestring = _SHORTDATESTRING; break; case 'm': $datestring = _MEDIUMDATESTRING; break; case 'mysql': $datestring = "Y-m-d H:i:s"; break; case 'rss': $datestring = "r"; break; case 'l': $datestring = _DATESTRING; break; default: if ($format != '') { $datestring = $format; } else { $datestring = _DATESTRING; } break; } return ucfirst(date($datestring, $usertimestamp)); }
$modversion['blocks'][$i]['template'] = "publisher_items_menu.html"; $i++; $modversion['blocks'][$i]['file'] = "latest_files.php"; $modversion['blocks'][$i]['name'] = _MI_PUBLISHER_LATESTFILES; $modversion['blocks'][$i]['description'] = _MI_PUBLISHER_LATESTFILES_DSC; $modversion['blocks'][$i]['show_func'] = "publisher_latest_files_show"; $modversion['blocks'][$i]['edit_func'] = "publisher_latest_files_edit"; $modversion['blocks'][$i]['options'] = "0|datesub|5|0"; $modversion['blocks'][$i]['template'] = "publisher_latest_files.html"; $i++; $modversion['blocks'][$i]['file'] = "date_to_date.php"; $modversion['blocks'][$i]['name'] = _MI_PUBLISHER_DATE_TO_DATE; $modversion['blocks'][$i]['description'] = _MI_PUBLISHER_DATE_TO_DATE_DSC; $modversion['blocks'][$i]['show_func'] = "publisher_date_to_date_show"; $modversion['blocks'][$i]['edit_func'] = "publisher_date_to_date_edit"; $modversion['blocks'][$i]['options'] = XoopsLocal::formatTimestamp(time(), 'm/j/Y') . "|" . XoopsLocal::formatTimestamp(time(), 'm/j/Y'); $modversion['blocks'][$i]['template'] = "publisher_date_to_date.html"; $i++; $modversion['blocks'][$i]['file'] = "items_columns.php"; $modversion['blocks'][$i]['name'] = _MI_PUBLISHER_COLUMNS; $modversion['blocks'][$i]['description'] = _MI_PUBLISHER_COLUMNS_DSC; $modversion['blocks'][$i]['show_func'] = "publisher_items_columns_show"; $modversion['blocks'][$i]['edit_func'] = "publisher_items_columns_edit"; $modversion['blocks'][$i]['options'] = "2|0|4|256|normal"; $modversion['blocks'][$i]['template'] = "publisher_items_columns.html"; $i++; $modversion['blocks'][$i]['file'] = "latest_news.php"; $modversion['blocks'][$i]['name'] = _MI_PUBLISHER_LATEST_NEWS; $modversion['blocks'][$i]['description'] = _MI_PUBLISHER_LATEST_NEWS_DSC; $modversion['blocks'][$i]['show_func'] = "publisher_latest_news_show"; $modversion['blocks'][$i]['edit_func'] = "publisher_latest_news_edit";
$criteria->add(new Criteria('status', 2), 'AND'); $criteria->add(new Criteria('datesub', time(), '<='), 'AND'); $criteria->setSort('datesub'); $criteria->setOrder('DESC'); //Get all articles dates as an array to save memory $items = $publisher->getHandler('item')->getAll($criteria, array('datesub'), false); $itemsCount = count($items); if (!($itemsCount > 0)) { redirect_header(XOOPS_URL, 2, _MD_PUBLISHER_NO_TOP_PERMISSIONS); exit; } else { $years = array(); $months = array(); $i = 0; foreach ($items as $item) { $time = XoopsLocal::formatTimestamp($item['datesub'], 'mysql', $useroffset); if (preg_match("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $time, $datetime)) { $this_year = intval($datetime[1]); $this_month = intval($datetime[2]); if (empty($lastyear)) { $lastyear = $this_year; } if ($lastmonth == 0) { $lastmonth = $this_month; $months[$lastmonth]['string'] = $months_arr[$lastmonth]; $months[$lastmonth]['number'] = $lastmonth; } if ($lastyear != $this_year) { $years[$i]['number'] = $lastyear; $years[$i]['months'] = $months; $months = array();