function iCMS_plugins_calendar($vars, &$iCMS) { $y = $_GET['y']; $m = $_GET['m']; list($nowy, $nowm) = explode('-', get_date('', 'Y-m')); $calendar = array(); $calendar['year'] = $y ? $y : $nowy; $calendar['month'] = $m ? $m : $nowm; $calendar['days'] = calendar($calendar['month'], $calendar['year']); $calendar['nextmonth'] = $calendar['month'] + 1 > 12 ? 1 : $calendar['month'] + 1; $calendar['premonth'] = $calendar['month'] - 1 < 1 ? 12 : $calendar['month'] - 1; $calendar['nextyear'] = $calendar['year'] + 1; $calendar['preyear'] = $calendar['year'] - 1; $calendar['cur_date'] = get_date('', 'Y n.j D'); $iCMS->value('SELF', __SELF__); $iCMS->value('calendar', $calendar); $iCMS->output('calendar', plugin::tpl('calendar')); }
function iCMS_plugins_archives($vars, &$iCMS) { $rs = iCMS_DB::getArray("SELECT A.pubdate FROM `#iCMS@__article` AS A,#iCMS@__forum AS F WHERE A.status='1' AND A.fid=F.fid AND F.status='1' ORDER BY pubdate DESC"); $_count = count($rs); for ($i = 0; $i < $_count; $i++) { $article[] = get_date($rs[$i]['pubdate'], 'Y-m'); } $arr = array_count_values($article); $i = 0; foreach ($arr as $key => $val) { list($y, $m) = explode('-', $key); $archive[$i]['url'] = $y . '_' . $m; $archive[$i]['date'] = "{$y}年{$m}月"; $archive[$i]['count'] = $val; $i++; } $iCMS->value('archive', $archive); $iCMS->output('archive', plugin::tpl('archives')); }
function iCMS_plugins_message($vars, &$iCMS) { if (isset($vars['call'])) { if ($vars['call'] == 'form') { echo $iCMS->output('form', plugin::tpl('message')); exit; } } else { $maxperpage = isset($vars['row']) ? (int) $vars['row'] : "20"; $cacheTime = isset($vars['time']) ? (int) $vars['time'] : -1; $offset = 0; if ($vars['page']) { $total = iCMS_DB::getValue("SELECT count(*) FROM `#iCMS@__plugins_message` WHERE `status`='0'"); $pagenav = isset($vars['pagenav']) ? $vars['pagenav'] : "pagenav"; $pnstyle = isset($vars['pnstyle']) ? $vars['pnstyle'] : 0; $offset = $iCMS->multi(array('total' => $total, 'perpage' => $maxperpage, 'unit' => $iCMS->language('page:message'), 'nowindex' => $GLOBALS['page'], 'pagenav' => $pagenav, 'pnstyle' => $pnstyle)); } $iscache = true; if ($vars['cache'] == false || isset($vars['page'])) { $iscache = false; $rs = ''; } else { $cacheName = 'message/cache'; $rs = $iCMS->getCache($cacheName); } if (empty($rs)) { $rs = iCMS_DB::getArray("SELECT * FROM `#iCMS@__plugins_message` WHERE `status`='0' order by `id` DESC LIMIT {$offset},{$maxperpage}"); for ($i = 0; $i < count($rs); $i++) { if ($rs[$i]['reply']) { $rs[$i]['reply'] = '<strong>' . $iCMS->language('reply:admin') . '</strong>' . $rs[$i]['reply']; } } $iscache && $iCMS->SetCache($cacheName, $rs, $cacheTime); } return $rs; } }
function doIndex() { global $iCMS; $iCMS->output('index', plugin::tpl('message')); }