function output($name) { global $INFO; $name = preg_replace('/[^a-zA-Z_\\-]+/', '', $name); $tpl = helper_plugin_blogtng_tools::getTplFile($name, 'comments'); if ($tpl === false) { return false; } $comment = $this; if ($comment->data['status'] == 'visible' || $comment->data['status'] == 'hidden' && $INFO['isadmin']) { $comment->num++; include $tpl; } }
function tpl_content($name, $type) { $whitelist = array('list', 'entry', 'feed'); if (!in_array($type, $whitelist)) { return false; } $tpl = helper_plugin_blogtng_tools::getTplFile($name, $type); if ($tpl !== false) { $entry = $this; include $tpl; } }
/** * Display a list of recent comments */ public function tpl_recentcomments($tpl = 'default', $num = 5, $blogs = array('default'), $types = array()) { // check template $tpl = helper_plugin_blogtng_tools::getTplFile($tpl, 'recentcomments'); if ($tpl === false) { return false; } if (!$this->sqlitehelper->ready()) { return false; } // prepare and execute query if (count($types)) { $types = $this->sqlitehelper->getDB()->quote_and_join($types, ','); $tquery = " AND B.source IN ({$types}) "; } else { $tquery = ""; } $blog_query = '(A.blog = ' . $this->sqlitehelper->getDB()->quote_and_join($blogs, ' OR A.blog = ') . ')'; $query = "SELECT A.pid as pid, page, title, cid\n FROM entries A, comments B\n WHERE {$blog_query}\n AND A.pid = B.pid\n {$tquery}\n AND B.status = 'visible'\n AND GETACCESSLEVEL(A.page) >= " . AUTH_READ . "\n ORDER BY B.created DESC\n LIMIT " . (int) $num; $res = $this->sqlitehelper->getDB()->query($query); if (!$this->sqlitehelper->getDB()->res2count($res)) { return false; } // no results found $res = $this->sqlitehelper->getDB()->res2arr($res); // print all hits using the template foreach ($res as $row) { /** @var helper_plugin_blogtng_entry $entry */ $entry = plugin_load('helper', 'blogtng_entry'); $entry->load_by_pid($row['pid']); $comment = $this->comment_by_cid($row['cid']); include $tpl; } return true; }
/** * @param $name * @param $type */ public function tpl_content($name, $type) { $whitelist = array('list', 'entry', 'feed', 'tagsearch'); if (!in_array($type, $whitelist)) { return; } $tpl = helper_plugin_blogtng_tools::getTplFile($name, $type); if ($tpl !== false) { /** @noinspection PhpUnusedLocalVariableInspection */ $entry = $this; //used in the included template include $tpl; } }