Initial commit
This commit is contained in:
commit
43ad32700c
7085 changed files with 447606 additions and 0 deletions
24
modules/mybbnews/mybbnews.module.php
Normal file
24
modules/mybbnews/mybbnews.module.php
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
class module_mybbnews extends admin_module{
|
||||
|
||||
function get_info(){
|
||||
$info["name"]="MYBB News";
|
||||
$info["file"]="mybbnews";
|
||||
$info["author"]="genuineparts";
|
||||
$info["version"]="1.0.0";
|
||||
$info["url"]="http://www.austriachat.net";
|
||||
return $info;
|
||||
}
|
||||
|
||||
function install(){
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function uninstall(){
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
51
modules/mybbnews/mybbnews.plugins.php
Normal file
51
modules/mybbnews/mybbnews.plugins.php
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
If (!defined("in_astat")) {
|
||||
die("Dieses Script kann nicht ausserhalb des Frameworks laufen!");
|
||||
}
|
||||
class plugins_mybbnews{
|
||||
|
||||
function register_plugins($plugin){
|
||||
$plugin->use_hook('frontpage_mybbnews',array($this,"newsview"));
|
||||
$plugin->use_hook('navigation_mainmodule',array($this,"frontpage_nav"));
|
||||
}
|
||||
|
||||
function newsview(){
|
||||
global $db, $config;
|
||||
$this->tpl= new Smarty();
|
||||
$parser=new textparser(true);
|
||||
$root = $_SERVER['DOCUMENT_ROOT'] . $config["path"];
|
||||
$this->tpl->compile_dir = $root . '/core/template/templates_c';
|
||||
$this->tpl->cache_dir = $root . '/core/template/cache';
|
||||
$this->tpl->config_dir = $root . '/core/template/config';
|
||||
$this->tpl->caching = $config["caching"];
|
||||
$this->tpl->assign("path",$config["path"]."/");
|
||||
if(isset($config["theme"]) && is_dir($root . '/modules/mybbnews/templates/'.$config["theme"])){
|
||||
$this->tpl-> template_dir = $root . '/modules/mybbnews/templates/'.$config["theme"];
|
||||
}else{
|
||||
$this->tpl-> template_dir = $root . '/modules/mybbnews/templates/default';
|
||||
}
|
||||
$result=$db->query("SELECT n.*,t.*,( SELECT COUNT(`pid`) FROM `ab_posts` c WHERE c.`replyto`=n.`pid` AND c.`visible`='1') as count FROM `ab_posts` n LEFT JOIN `ab_threads` t ON t.`tid`=n.`tid` WHERE n.`fid`='2' AND n.`replyto`='0' AND n.`visible`='1' ORDER BY n.`dateline` DESC LIMIT 10");
|
||||
while($row=$db->fetch_array($result)){
|
||||
$row["year"]=date("Y",$row["dateline"]);
|
||||
$row["month"]=date("M",$row["dateline"]);
|
||||
$row["day"]=date("d",$row["dateline"]);
|
||||
$row["time"]=date("h:i",$row["dateline"]);
|
||||
$row["date"]=date("d.m.Y",$row["dateline"]);
|
||||
$row["text"]=$parser->parse(nl2br($row["message"]));
|
||||
$row["title"]=$parser->parse(nl2br($row["subject"]));
|
||||
$row["comments"]=$row["count"];
|
||||
$news[]=$row;
|
||||
}
|
||||
$this->tpl->assign('news', $news);
|
||||
return $this->tpl->fetch('news.tpl',"news");
|
||||
}
|
||||
|
||||
function frontpage_nav($mainmodule){
|
||||
global $db, $config,$mainmodule;
|
||||
$mainmodule.="<div id=\"frontpage_mybbnews\" class=\"lineitem\">News</div>";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
22
modules/mybbnews/templates/default/news.tpl
Normal file
22
modules/mybbnews/templates/default/news.tpl
Normal file
|
@ -0,0 +1,22 @@
|
|||
<h2>News</h2>
|
||||
{foreach from=$news item=n}
|
||||
<article class="entry">
|
||||
<header class="entry-header">
|
||||
<h2 class="entry-title">
|
||||
{$n.title}
|
||||
</h2>
|
||||
<div class="entry-meta">
|
||||
<ul>
|
||||
<li>{$n.date}</li>
|
||||
<span class="meta-sep">•</span>
|
||||
<li><a href="/np/{$n.username}">{$n.username}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
<div class="entry-content">
|
||||
<p>{$n.text}</p>
|
||||
</div>
|
||||
<p><small><a href="/forum/thread-{$n.pid}.html">{$n.comments} Kommentar(e)</a></small></p>
|
||||
</article> <!-- end entry -->
|
||||
{foreachelse}
|
||||
{/foreach}
|
Loading…
Add table
Add a link
Reference in a new issue