Example #1
0
 /**
  * @param $surveyId
  */
 public function add_survey_hit($surveyId)
 {
     global $prefs, $user;
     if (StatsLib::is_stats_hit()) {
         $this->surveysTable->update(array('taken' => $this->surveysTable->increment(1), 'lastTaken' => $this->now), array('surveyId' => $surveyId));
     }
 }
Example #2
0
 /**
  * @param $url
  */
 function add_featured_link_hit($url)
 {
     global $prefs, $user;
     if (StatsLib::is_stats_hit()) {
         $query = "update `tiki_featured_links` set `hits` = `hits` + 1 where `url` = ?";
         $result = $this->query($query, array($url));
     }
 }
Example #3
0
 function add_article_hit($articleId)
 {
     global $prefs, $user;
     if (StatsLib::is_stats_hit()) {
         $query = "update `tiki_articles` set `nbreads`=`nbreads`+1 where `articleId`=?";
         $result = $this->query($query, array($articleId));
     }
     return true;
 }
Example #4
0
 /**
  * @param $id
  * @return bool
  */
 function add_gallery_hit($id)
 {
     global $prefs, $user;
     if (StatsLib::is_stats_hit()) {
         $query = "update `tiki_galleries` set `hits`=`hits`+1 where `galleryId`=?";
         $result = $this->query($query, array((int) $id));
     }
     $query = "select `user` from `tiki_galleries` where `galleryId`=?";
     $owner = $this->getOne($query, array((int) $id));
     TikiLib::events()->trigger('tiki.imagegallery.view', array('type' => 'imagegallery', 'object' => $id, 'user' => $user, 'owner' => $owner));
     return true;
 }
Example #5
0
 /**
  * @param $pageName
  * @return bool
  */
 function add_hit($pageName)
 {
     global $prefs;
     if (StatsLib::is_stats_hit()) {
         $pages = $this->table('tiki_pages');
         $pages->update(array('hits' => $pages->increment(1)), array('pageName' => $pageName));
     }
     return true;
 }
Example #6
0
 function add_file_gallery_hit($id)
 {
     global $prefs, $user;
     if (StatsLib::is_stats_hit()) {
         $fileGalleries = $this->table('tiki_file_galleries');
         $fileGalleries->update(array('hits' => $fileGalleries->increment(1)), array('galleryId' => (int) $id));
     }
     return true;
 }
Example #7
0
 public function add_item_attachment_hit($id)
 {
     global $prefs, $user;
     if (StatsLib::is_stats_hit()) {
         $attachments = $this->attachments();
         $attachments->update(array('hits' => $attachments->increment(1)), array('attId' => (int) $id));
     }
     return true;
 }
Example #8
0
 /**
  * @param $faqId
  */
 function add_faq_hit($faqId)
 {
     global $prefs, $user;
     if (StatsLib::is_stats_hit()) {
         $query = "update `tiki_faqs` set `hits`=`hits`+1 where `faqId`=?";
         $result = $this->query($query, array($faqId));
     }
 }
Example #9
0
<?php

// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
//this script may only be included - so its better to die if called directly.
$access->check_script($_SERVER['SCRIPT_NAME'], basename(__FILE__));
if ($prefs['feature_referer_stats'] == 'y') {
    if (isset($_SERVER['HTTP_REFERER'])) {
        $pref = parse_url($_SERVER['HTTP_REFERER']);
        if (isset($pref['host']) && !strstr($_SERVER['SERVER_NAME'], $pref['host'])) {
            $tikilib->register_referer($pref['host'], $_SERVER['HTTP_REFERER']);
        }
    }
}
if (StatsLib::is_stats_hit()) {
    if (!isset($section) or $section != 'chat' and $section != 'livesupport') {
        $statslib = TikiLib::lib('stats');
        $statslib->add_pageview();
    }
}
Example #10
0
 /**
  * @param $threadId
  * @return bool
  */
 function comment_add_hit($threadId)
 {
     global $prefs, $user;
     if (StatsLib::is_stats_hit()) {
         require_once 'lib/search/refresh-functions.php';
         $comments = $this->table('tiki_comments');
         $comments->update(array('hits' => $comments->increment(1)), array('threadId' => (int) $threadId));
         refresh_index("forum post", $threadId);
     }
     return true;
 }
Example #11
0
 /**
  * add_blog_post_hit Add a hit for the blog post $postId
  *
  * @param int $postId
  * @access public
  * @return boolean unconditionnal true
  */
 function add_blog_post_hit($postId)
 {
     global $prefs, $user;
     if (StatsLib::is_stats_hit()) {
         $query = "update `tiki_blog_posts` set `hits` = `hits`+1 where `postId`=?";
         $result = $this->query($query, array((int) $postId));
     }
     return true;
 }
Example #12
0
 /**
  * @param $categId
  */
 function dir_add_category_hit($categId)
 {
     global $prefs, $user;
     if (StatsLib::is_stats_hit()) {
         $query = "update `tiki_directory_categories` set `hits`=`hits`+1 where `categId`=?";
         $this->query($query, array((int) $categId));
     }
 }
Example #13
0
 /**
  * @param $object
  * @param $type
  * @param null $id
  * @return bool
  */
 public function stats_hit($object, $type, $id = null)
 {
     if (empty($object) || empty($type) || !StatsLib::is_stats_hit()) {
         return false;
     }
     list($month, $day, $year) = explode(',', $this->date_format("%m,%d,%Y"));
     $dayzero = $this->make_time(0, 0, 0, $month, $day, $year);
     if (!is_null($id)) {
         $object = $id . "?" . $object;
     }
     $cant = $this->getOne("select count(*) from `tiki_stats` where `object`=? and `type`=? and `day`=?", array($object, $type, (int) $dayzero));
     if ($cant) {
         $query = "update `tiki_stats` set `hits`=`hits`+1 where `object`=? and `type`=? and `day`=?";
     } else {
         $query = "insert into `tiki_stats` (`object`,`type`,`day`,`hits`) values(?,?,?,1)";
     }
     return $this->query($query, array($object, $type, (int) $dayzero), -1, -1, false);
 }