Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezhit.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezhit.php 9860 2003-07-10 08:17:50Z br $
5 //
6 // Definition of eZHit class
7 //
8 // Created on: <15-Sep-2000 14:40:06 bf>
9 //
10 // This source file is part of Exponential Basic, publishing software.
11 //
12 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
13 //
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
27 //
28
31
37 // include_once( "classes/ezdb.php" );
38
39 class eZHit
40 {
44 function __construct( $id=-1 )
45 {
46 $this->Time = 0;
47 if ( $id != -1 )
48 {
49 $this->ID = $id;
50 $this->get( $this->ID );
51 }
52 }
53
57 function store()
58 {
59 $db =& eZDB::globalDatabase();
60 $db->begin();
61
62 // lock the table
63 $db->lock( "eZLink_Hit" );
64
65 $nextID = $db->nextID( "eZLink_Hit", "ID" );
66
67 $res[] = $db->query( "INSERT INTO eZLink_Hit
68 ( RemoteIP, ID, Link, Time)
69 VALUES
70 ('$this->RemoteIP','$nextID','$this->Link','$this->Time')" );
71 $db->unlock();
72
73 eZDB::finish( $res, $db );
74 }
75
79 function update()
80 {
81 $db =& eZDB::globalDatabase();
82
83 $db->query( "UPDATE eZLink_Hit SET
84 RemoteIP='$this->RemoteIP',
85 Link='$this->Link',
86 WHERE ID='$this->ID'" );
87 }
88
92 function delete()
93 {
94 $db =& eZDB::globalDatabase();
95 $db->query( "DELETE FROM eZLink_Hit WHERE ID='$ID'" );
96 }
97
102 function &getLinkHits( $id )
103 {
104 $db =& eZDB::globalDatabase();
105 $db->query_single( $hit_array, "SELECT COUNT(ID) as Count FROM eZLink_Hit WHERE Link='$id'" );
106 $count = $hit_array[$db->fieldName( "Count" )];
107
108 return $count;
109 }
110
114 function get( $id )
115 {
116 $db =& eZDB::globalDatabase();
117 $db->array_query( $hit_array, "SELECT * FROM eZLink_Hit WHERE ID='$id'" );
118
119 return count( $hit_array );
120 }
121
125 function setLink( $value )
126 {
127 $this->Link = ( $value );
128 }
129
133 function setRemoteIP( $value )
134 {
135 $this->RemoteIP = ( $value );
136 }
137
141 function setTime( $timestsamp )
142 {
143 $this->Time = $timestsamp;
144 return $this->Time;
145 }
146
150 function id()
151 {
152 return $this->ID;
153 }
154
155
159 function link()
160 {
161 return $this->Link;
162 }
163
167 function time()
168 {
169 return $this->Time;
170 }
171
175 function remoteIP( )
176 {
177 return $this->RemoteIP;
178 }
179
180
181 var $ID;
182 var $Link;
183 var $Time;
184 var $RemoteIP;
185 }
186
187 ?>
eZDB\finish
static finish(&$resultArray, &$db)
Definition: ezdb.php:204
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZHit
Definition: ezhit.php:40
eZHit\$RemoteIP
$RemoteIP
Definition: ezhit.php:184
eZHit\update
update()
Definition: ezhit.php:79
eZHit\setRemoteIP
setRemoteIP( $value)
Definition: ezhit.php:133
eZHit\setTime
setTime( $timestsamp)
Definition: ezhit.php:141
eZHit\remoteIP
remoteIP()
Definition: ezhit.php:175
eZHit\id
id()
Definition: ezhit.php:150
eZHit\__construct
__construct( $id=-1)
Definition: ezhit.php:44
eZHit\$ID
$ID
Definition: ezhit.php:181
eZHit\setLink
setLink( $value)
Definition: ezhit.php:125
eZHit\$Link
$Link
Definition: ezhit.php:182
eZHit\link
link()
Definition: ezhit.php:159
eZHit\$Time
$Time
Definition: ezhit.php:183
eZHit\store
store()
Definition: ezhit.php:57
eZHit\getLinkHits
& getLinkHits( $id)
Definition: ezhit.php:102
eZHit\time
time()
Definition: ezhit.php:167
$id
$id
Definition: companytypelist.php:193
$db
$db
Definition: ezarticle/user/authorlist.php:53
$res
$res
Definition: ezstats/admin/cron.php:45
$count
$count
Definition: onlinetypelist.php:108
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.