private function __activity()
 {
     global $wgOut, $wgUser, $wgRequest;
     wfProfileIn(__METHOD__);
     $op = $wgRequest->getVal('op', '');
     $lang = $wgRequest->getVal('lang');
     $cat = $wgRequest->getVal('cat');
     $year = $wgRequest->getVal('year', date('Y'));
     $month = $wgRequest->getVal('month', date('m'));
     $limit = $wgRequest->getVal('limit');
     $offset = $wgRequest->getVal('offset');
     $loop = $wgRequest->getVal('loop');
     $order = $wgRequest->getVal('order');
     $numOrder = $wgRequest->getVal('numOrder');
     $summary = $wgRequest->getVal('summary');
     $result = array('sEcho' => intval($loop), 'iTotalRecords' => 0, 'iTotalDisplayRecords' => 0, 'sColumns' => '', 'aaData' => array());
     if (empty($wgUser)) {
         return "";
     }
     if ($wgUser->isBlocked()) {
         return "";
     }
     if (!$wgUser->isLoggedIn()) {
         return "";
     }
     $params = array('year' => $year, 'month' => $month, 'lang' => $lang, 'cat' => $cat, 'order' => $order, 'limit' => $limit, 'offset' => $offset, 'summary' => $summary);
     if (empty($op)) {
         #error_log ( print_r($params, true) );
         $data = $this->mStats->getWikiActivity($params);
         if (!empty($result)) {
             $result['iTotalRecords'] = intval(count($data['res']));
             $result['iTotalDisplayRecords'] = isset($data['cnt']) ? intval($data['cnt']) : 0;
             $result['sColumns'] = 'id,dbname,title,url,users,edits,articles,lastedit,users_diff,edits_diff,articles_diff';
             $result['aaData'] = $result['iTotalRecords'] > 0 ? array_values($data['res']) : array();
         }
     } elseif ($op == 'xls') {
         $data = $this->mStats->getWikiActivity($params, 1);
         $XLSObj = new WikiStatsXLS($this, $data['res'], wfMsg('wikistats_active_useredits'));
         $XLSObj->makeWikiaActivity($params);
         exit;
     }
     wfProfileOut(__METHOD__);
     return json_encode($result);
 }
 private function showNamespaces()
 {
     global $wgUser, $wgContLang, $wgLang, $wgOut;
     #---
     $selectedNamespace = array();
     if (isset($this->mNS) && isset($this->mNamespaces) && isset($this->mPredefinedNamespaces)) {
         foreach ($this->mNS as $ns) {
             $selectedNamespace[$ns] = @$this->mNamespaces[$ns];
             if (empty($selectedNamespace[$ns])) {
                 $selectedNamespace[$ns] = @$this->mPredefinedNamespaces[$ns]['name'];
             }
         }
     }
     $this->mStats->setPageNS($this->mNS);
     if (empty($this->mXLS)) {
         wfProfileIn(__METHOD__);
         $menu = $this->showMenu('', 1);
         $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
         $oTmpl->set_vars(array("data" => $this->mStats->namespaceStatsFromDB(), "today" => date("Ym"), "today_day" => $this->mStats->getLatestNSStats(), "user" => $wgUser, "cityId" => $this->mCityId, "wgContLang" => $wgContLang, "wgLang" => $wgLang, "mStats" => $this->mStats, "userIsSpecial" => $this->userIsSpecial, "tableTitle" => $selectedNamespace));
         $wgOut->addHTML($menu);
         if ($this->mFromDate <= $this->mToDate) {
             $wgOut->addHTML($oTmpl->render("ns-table-stats"));
         }
         wfProfileOut(__METHOD__);
     } else {
         $data = $this->mStats->namespaceStatsFromDB();
         $XLSObj = new WikiStatsXLS($this->mStats, $data, wfMsg('wikistats_ns_statistics_legend'));
         $XLSObj->makeNamespaceStats($selectedNamespace);
     }
     #---
     return 1;
 }