static function getMonthTotal($list, $month, $year, $extra_var)
 {
     $tot = 0;
     foreach ((array) $extra_var as $v) {
         $res[$v] = 0;
     }
     $nname = '1110';
     foreach ((array) $list as $t) {
         list($domname, $oldtime, $newtime) = explode(":", $t->nname);
         $cmonth = @strftime("%m", $oldtime);
         //dprint(strftime("%c" , "$oldtime"). ": "); dprint($t->traffic_usage); dprint("$cmonth <br> \n");
         //		dprint("$cmonth $month $t->traffic_usage <br>");
         $yy = @date("Y", $oldtime);
         if ($yy != $year) {
             continue;
         }
         if ($cmonth == $month) {
             $tot += $t->traffic_usage;
             foreach ((array) $extra_var as $v) {
                 $res[$v] += $t->{$v};
             }
             $nname = $oldtime;
         }
     }
     $montht = intToMonth($month);
     $res['nname'] = "{$year}.{$month}";
     $res['month'] = "{$montht} {$year}";
     $res['traffic_usage'] = $tot;
     return $res;
 }
Example #2
0
 include scriptPath . "/" . folderNews . "/include/language/" . pageLanguage . "/general.php";
 $metaTitle = $lNews["Archives"];
 include layoutPath . "/template/metaHeader.template.php";
 $content .= $metaHeader;
 $run = true;
 $today = getdate();
 $metaLinks = 0;
 for ($i = 0; $run; $i++) {
     // Get the day name
     $start = mktime(0, 0, 0, $today["mon"] - $i, 1, $today["year"]);
     $end = mktime(0, 0, 0, $today["mon"] - $i + 1, 1, $today["year"]);
     $result = $dbi->query("SELECT COUNT(*) FROM " . newsTableName . " WHERE posted>FROM_UNIXTIME({$start}) AND posted<FROM_UNIXTIME({$end})");
     if ($result->rows()) {
         list($metaCount) = $result->fetchrow_array();
         if ($metaCount > 0) {
             $metaTitle = intToMonth(date("m", $start)) . " " . date("Y", $start);
             $metaLink = scriptUrl . "/" . folderNews . "/" . fileNewsIndex . "?month=" . date("m", $start) . "&amp;year=" . date("Y", $start);
             $metaCount = $metaCount;
             include layoutPath . "/template/metaBody.template.php";
             $content .= $metaBody;
         }
     }
     // Are there more posts beyond this time?
     $result = $dbi->query("SELECT COUNT(*) FROM " . newsTableName . " WHERE posted<FROM_UNIXTIME({$end})");
     if ($result->rows()) {
         list($count) = $result->fetchrow_array();
         if ($count == 0) {
             $run = false;
         }
     }
 }
Example #3
0
 static function getMonthTotal($list, $month, $year, $extra_var)
 {
     $tot = 0;
     foreach ((array) $extra_var as $v) {
         $res[$v] = 0;
     }
     $nname = '1110';
     foreach ((array) $list as $t) {
         list($domname, $oldtime, $newtime) = explode(":", $t->nname);
         $cmonth = @strftime("%m", $oldtime);
         $yy = @date("Y", $oldtime);
         if ($yy != $year) {
             continue;
         }
         if ($cmonth == $month) {
             $tot += $t->traffic_usage;
             foreach ((array) $extra_var as $v) {
                 $res[$v] += $t->{$v};
             }
             $nname = $oldtime;
         }
     }
     $timestamp = mktime(0, 0, 0, $month, 1, $year);
     $month = intToMonth($month);
     $res['nname'] = "{$year} {$month}";
     $res['month'] = $timestamp;
     $res['traffic_usage'] = $tot;
     return $res;
 }
Example #4
0
 /** 
  * Print blog index.
  * @param	$categoryId	Identifier of category.
  */
 function printBlog($categoryId = -1)
 {
     global $dbi, $login, $site;
     if (!empty($this->id)) {
         if ($this->hasReadPermission()) {
             // Include language
             include scriptPath . "/" . folderBlog . "/include/language/" . $this->language . "/general.php";
             if (!empty($this->id)) {
                 // Get get values
                 $day = getGetValue("day");
                 $month = getGetValue("month");
                 $year = getGetValue("year");
                 // Add meta links
                 if ($this->hasAdministerPermission()) {
                     $site->addMetaLink(scriptUrl . "/" . folderBlog . "/" . fileBlogEdit . "?blogId=" . $this->id, $lBlog["EditBlog"], "edit");
                     $site->addMetaLink(scriptUrl . "/" . folderUsers . "/" . fileEditPermissions . "?moduleContentTypeId=" . blogContentId . "&amp;moduleContentId=" . $this->id, $lBlog["EditPermissions"], "permission");
                 }
                 $site->addMetaLink($this->getBlogLink(), "", "direct");
                 $site->addMetaLink($this->getBlogLink() . "&amp;print=1", "", "print");
                 $site->addMetaLink(scriptUrl . "/" . fileSendToFriend . "?url=" . urlencode($this->getBlogLink()) . "&amp;title=" . urlencode($this->title) . "&amp;summary=" . urlencode(validateTextLength($this->description, 100)), "", "recommend");
                 // Add navigation links
                 $site->addNavigationLink(scriptUrl . "/" . folderBlog . "/" . fileBlogIndex, $lBlogIndex["Header"]);
                 $site->addNavigationLink($this->getBlogLink(), $this->title);
                 if ($categoryId != -1) {
                     $category = new Category($categoryId);
                     $site->addNavigationLink(scriptUrl . "/" . folderBlog . "/" . fileBlog . "?blogId=" . $this->id . "&amp;categoryId=" . $categoryId, $categoryId == 0 ? $lBlogPost["Uncategorized"] : $category->title);
                 } else {
                     if (!empty($month) && !empty($year)) {
                         $site->addNavigationLink(scriptUrl . "/" . folderBlog . "/" . fileBlog . "?blogId=" . $this->id . "&amp;month=" . $month . "&amp;year=" . $year, intToMonth($month) . " " . $year);
                     }
                 }
                 // Register rss feeds
                 $site->registerRSSFeed(scriptUrl . "/" . folderBlog . "/" . fileBlogPostRSS . "?blogId=" . $this->id, $this->title);
                 $site->registerRSSFeed(scriptUrl . "/" . folderBlog . "/" . fileBlogCommentRSS . "?blogId=" . $this->id, $this->title . " - " . $lBlogPost["Comments"]);
                 // Set website path
                 $site->setPath(folderBlog);
                 // Print common header
                 $site->printHeader();
                 // Print blog body
                 $this->printBlogBody($categoryId);
                 // Print common footer
                 $site->printFooter();
             }
         } else {
             $login->printLoginForm();
             exit;
         }
     } else {
         redirect(scriptUrl . "/" . folderBlog . "/" . fileBlogIndex);
     }
 }