page_begin("PM Module", FALSE); 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->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/ajaxpm/templates/'.$config["theme"])){ $this->tpl-> template_dir = $root . '/modules/ajaxpm/templates/'.$config["theme"]; }else{ $this->tpl-> template_dir = $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'); } } } ?>