49 lines
1.5 KiB
PHP
49 lines
1.5 KiB
PHP
<?php
|
|
global $session;
|
|
If (!defined("INBCWE")) {
|
|
die("Dieses Script kann nicht ausserhalb des Frameworks laufen!");
|
|
}
|
|
$session->page_begin("PM Module", FALSE);
|
|
|
|
use Smarty\Smarty;
|
|
|
|
class ajaxpm extends ajax_module{
|
|
|
|
function ajax(){
|
|
global $module,$config,$db,$cache, $session;
|
|
if($session->userdata['uid']!=0){
|
|
$this->tpl= new Smarty();
|
|
$root = $_SERVER['DOCUMENT_ROOT'] . $config["path"];
|
|
$this->tpl->setCompileDir($root . '/core/template/templates_c');
|
|
$this->tpl->setCacheDir($root . '/core/template/cache');
|
|
$this->tpl->setConfigDir($root . '/core/template/config');
|
|
If($config["caching"]==1){
|
|
$this->tpl->setCaching(Smarty::CACHING_LIFETIME_SAVED);
|
|
}
|
|
$this->tpl->assign("path",$config["path"]."/");
|
|
if(isset($config["theme"]) && is_dir($root . '/modules/ajaxpm/templates/'.$config["theme"])){
|
|
$this->tpl-> setTemplateDir($root . '/modules/ajaxpm/templates/'.$config["theme"]);
|
|
}else{
|
|
$this->tpl-> setTemplateDir($root . '/modules/ajaxpm/templates/default');
|
|
}
|
|
$mybb=$cache->read('mybbconfig');
|
|
$result = $db->query("SELECT `unreadpms` as `count` FROM `" . $mybb["prefix"] . "users` WHERE `uid`='".$session->userdata['fuid']."'");
|
|
$row = $db->fetch_array($result, MYSQL_ASSOC);
|
|
if($row["count"]>1){
|
|
$pmcount=$row["count"];
|
|
$s="s";
|
|
}elseif($row["count"]==1){
|
|
$pmcount="one";
|
|
$s="";
|
|
}else{
|
|
exit();
|
|
}
|
|
$this->tpl->assign('pmcount',$pmcount);
|
|
$this->tpl->assign('s',$s);
|
|
echo $this->tpl->fetch('ajaxpm.tpl');
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
?>
|