public function postschanged() { $posts = tposts::i(); $this->lock(); $this->items = array(); //sort archive by months $linkgen = tlinkgenerator::i(); $db = litepublisher::$db; $res = $db->query("SELECT YEAR(posted) AS 'year', MONTH(posted) AS 'month', count(id) as 'count' FROM {$db->posts}\n where status = 'published' GROUP BY YEAR(posted), MONTH(posted) ORDER BY posted DESC "); while ($r = $db->fetchassoc($res)) { $this->date = mktime(0, 0, 0, $r['month'], 1, $r['year']); $this->items[$this->date] = array('idurl' => 0, 'url' => $linkgen->Createlink($this, 'archive', false), 'title' => tlocal::date($this->date, 'F Y'), 'year' => $r['year'], 'month' => $r['month'], 'count' => $r['count']); } $this->CreatePageLinks(); $this->unlock(); }
public function getmonth() { return tlocal::date($this->posted, 'M'); }
public function getdate() { $theme = ttheme::i(); return tlocal::date($this->posted, $theme->templates['content.post.templatecomments.comments.comment.date']); }
public function __get($name) { $item = ttheme::$vars['item']; switch ($name) { case 'status': return tlocal::get('commentstatus', $item['status']); case 'date': return tlocal::date(strtotime($item['posted'])); } return ''; }
protected function set_post(tpost $post) { extract($_POST, EXTR_SKIP); $post->title = $title; $cats = self::processcategories(); $cats = array_unique($cats); array_delete_value($cats, 0); array_delete_value($cats, ''); array_delete_value($cats, false); array_delete_value($cats, null); $post->categories = $cats; if ($post->id == 0 && litepublisher::$options->user > 1) { $post->author = litepublisher::$options->user; } if (isset($tags)) { $post->tagnames = $tags; } if (isset($icon)) { $post->icon = (int) $icon; } if (isset($idview)) { $post->idview = $idview; } if (isset($files)) { $files = trim($files, ', '); $post->files = tdatabase::str2array($files); } if (isset($date) && $date) { $post->posted = tadminhtml::getdatetime('date'); } if (isset($status)) { $post->status = $status == 'draft' ? 'draft' : 'published'; $post->comstatus = $comstatus; $post->pingenabled = isset($pingenabled); $post->idperm = (int) $idperm; if ($password != '') { $post->password = $password; } } if (isset($url)) { $post->url = $url; $post->title2 = $title2; $post->keywords = $keywords; $post->description = $description; $post->rawhead = $head; } $post->content = $raw; if (isset($excerpt)) { $post->excerpt = $excerpt; } if (isset($rss)) { $post->rss = $rss; } if (isset($more)) { $post->moretitle = $more; } if (isset($filtered)) { $post->filtered = $filtered; } if (isset($upd)) { $update = sprintf($this->lang->updateformat, tlocal::date(time()), $upd); $post->content = $post->rawcontent . "\n\n" . $update; } }
protected function getmyself() { $lang = tlocal::i('foaf'); $result = array(); if ($this->img != '') { $i = strrpos($this->img, '.'); $preview = substr($this->img, 0, $i) . '.preview' . substr($this->img, $i); $result[] = sprintf('<a rel="prettyPhoto" href="%s"><img src="%s" alt="profile" /></a>', $this->img, $preview); } if ($this->nick != '') { $result[] = "{$lang->nick} {$this->nick}"; } if ($this->dateOfBirth != '' && @sscanf($this->dateOfBirth, '%d-%d-%d', $y, $m, $d)) { $date = mktime(0, 0, 0, $m, $d, $y); $ldate = tlocal::date($date); $result[] = sprintf($lang->birthday, $ldate); } $result[] = $this->gender == 'female' ? $lang->female : $lang->male; if (!$this->country != '') { $result[] = $this->country; } if (!$this->region != '') { $result[] = $this->region; } if (!$this->city != '') { $result[] = $this->city; } $result[] = sprintf('<a rel="me" href="%s">Google profile</a>', $this->googleprofile); return implode("</li>\n<li>", $result); }
public static function datestr($date) { if ($date == '0000-00-00 00:00:00') { return tlocal::i()->noword; } return tlocal::date(strtotime($date), 'd F Y'); }
public function monthname() { return tlocal::date($this->getdate(), '%F'); }