WassUp Real Time Analytics - Version 1.4.8

Version Description

Download this release

Release Info

Developer michelem
Plugin Icon 128x128 WassUp Real Time Analytics
Version 1.4.8
Comparing to
See all releases

Code changes from version 1.4.5 to 1.4.8

Files changed (11) hide show
  1. language/it_IT.mo +0 -0
  2. language/wassup.pot +829 -0
  3. lib/action.php +29 -31
  4. lib/akismet.class.php +0 -388
  5. lib/main.php +330 -305
  6. lib/settings.php +107 -113
  7. lib/spy.php +0 -28
  8. lib/wassup.class.php +294 -0
  9. readme.txt +9 -8
  10. wassup.css +3 -1
  11. wassup.php +738 -607
language/it_IT.mo ADDED
Binary file
language/wassup.pot ADDED
@@ -0,0 +1,829 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WassUp 1.4.6\n"
4
+ "POT-Creation-Date: \n"
5
+ "PO-Revision-Date: 2008-02-18 12:53+0100\n"
6
+ "Last-Translator: Michele <michele@befree.it>\n"
7
+ "Language-Team: \n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=utf-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "X-Poedit-KeywordsList: __;_e\n"
12
+ "X-Poedit-Basepath: .\n"
13
+ "X-Poedit-SearchPath-0: /home/m1k/Desktop/wassup_translation/trunk\n"
14
+
15
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:32
16
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:381
17
+ msgid "Sorry, Wassup requires SECRET_KEY constant declared in wp-config.php... Please read <a href='http://www.wpwp.org/download'>documentation</a> for more info..."
18
+ msgstr "Mi spiace, ma Wassup richiede la costante SECRET_KEY dichiarata nel file wp-config.php...Per favore leggi la <a href='http://www.wpwp.org/download'>documentazione</a> per informazioni..."
19
+
20
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:38
21
+ msgid "Sorry, Wassup requires WordPress 2.2 or higher to work"
22
+ msgstr "Mi spiace, ma Wassup richiede almeno Wordpress 2.2 per funzionare"
23
+
24
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:259
25
+ msgid "Hide Search"
26
+ msgstr "Nascondi ricerca"
27
+
28
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:262
29
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:800
30
+ msgid "Search"
31
+ msgstr "Ricerca"
32
+
33
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:267
34
+ msgid "Hide TopTen"
35
+ msgstr "Nascondi TopTen"
36
+
37
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:270
38
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:800
39
+ msgid "Show TopTen"
40
+ msgstr "Mostra TopTen"
41
+
42
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:276
43
+ msgid "Collapse All"
44
+ msgstr "Raggruppa tutti"
45
+
46
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:279
47
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:551
48
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:763
49
+ msgid "Expand All"
50
+ msgstr "Espandi tutti"
51
+
52
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:284
53
+ msgid "Expand Cronology"
54
+ msgstr ""
55
+
56
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:287
57
+ msgid "Collapse Cronology"
58
+ msgstr ""
59
+
60
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:370
61
+ msgid "Visitor Details"
62
+ msgstr ""
63
+
64
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:373
65
+ msgid "Spy Visitors"
66
+ msgstr ""
67
+
68
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:373
69
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:555
70
+ msgid "SPY Visitors"
71
+ msgstr ""
72
+
73
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:374
74
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:472
75
+ msgid "Current Visitors Online"
76
+ msgstr ""
77
+
78
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:375
79
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:45
80
+ msgid "Options"
81
+ msgstr ""
82
+
83
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:473
84
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:556
85
+ msgid "Legend"
86
+ msgstr ""
87
+
88
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:473
89
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:556
90
+ msgid "Logged-in Users"
91
+ msgstr ""
92
+
93
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:473
94
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:556
95
+ msgid "Comments Authors"
96
+ msgstr ""
97
+
98
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:473
99
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:556
100
+ msgid "Spiders/bots"
101
+ msgstr ""
102
+
103
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:477
104
+ msgid "Visitors online"
105
+ msgstr ""
106
+
107
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:492
108
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:841
109
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/main.php:600
110
+ msgid "From your blog"
111
+ msgstr ""
112
+
113
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:495
114
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:844
115
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/main.php:603
116
+ msgid "Direct hit"
117
+ msgstr ""
118
+
119
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:513
120
+ msgid "LOGGED IN USER"
121
+ msgstr ""
122
+
123
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:514
124
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:517
125
+ msgid "COMMENT AUTHOR"
126
+ msgstr ""
127
+
128
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:558
129
+ msgid "Pause"
130
+ msgstr ""
131
+
132
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:559
133
+ msgid "Play"
134
+ msgstr ""
135
+
136
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:647
137
+ msgid "Latest hits"
138
+ msgstr ""
139
+
140
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:678
141
+ msgid "WassUp recording is disabled"
142
+ msgstr ""
143
+
144
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:688
145
+ msgid "records deleted"
146
+ msgstr ""
147
+
148
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:696
149
+ msgid "hide chart"
150
+ msgstr ""
151
+
152
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:696
153
+ msgid "Hide the chart and site usage"
154
+ msgstr ""
155
+
156
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:699
157
+ msgid "show chart"
158
+ msgstr ""
159
+
160
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:699
161
+ msgid "Show the chart and site usage"
162
+ msgstr ""
163
+
164
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:701
165
+ msgid "Summary for the last"
166
+ msgstr ""
167
+
168
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:704
169
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:190
170
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:200
171
+ msgid "24 hours"
172
+ msgstr ""
173
+
174
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:705
175
+ msgid "7 days"
176
+ msgstr ""
177
+
178
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:706
179
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:192
180
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:202
181
+ msgid "1 month"
182
+ msgstr ""
183
+
184
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:707
185
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:195
186
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:205
187
+ msgid "1 year"
188
+ msgstr ""
189
+
190
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:710
191
+ msgid "Items per page"
192
+ msgstr ""
193
+
194
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:716
195
+ msgid "Show items by"
196
+ msgstr ""
197
+
198
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:719
199
+ msgid "Spider"
200
+ msgstr ""
201
+
202
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:720
203
+ msgid "NO Spider"
204
+ msgstr ""
205
+
206
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:721
207
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:93
208
+ msgid "Spam"
209
+ msgstr ""
210
+
211
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:722
212
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:94
213
+ msgid "NO Spam"
214
+ msgstr ""
215
+
216
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:723
217
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:95
218
+ msgid "NO Spam NO Spider"
219
+ msgstr ""
220
+
221
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:724
222
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:96
223
+ msgid "Users logged in"
224
+ msgstr ""
225
+
226
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:725
227
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:97
228
+ msgid "Comment authors"
229
+ msgstr ""
230
+
231
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:726
232
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:98
233
+ msgid "Referer from search engine"
234
+ msgstr ""
235
+
236
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:727
237
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:99
238
+ msgid "Referer from ext link"
239
+ msgstr ""
240
+
241
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:728
242
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:90
243
+ msgid "Everything"
244
+ msgstr ""
245
+
246
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:741
247
+ msgid "Visits"
248
+ msgstr ""
249
+
250
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:742
251
+ msgid "Pageviews"
252
+ msgstr ""
253
+
254
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:743
255
+ msgid "Pages/Visits"
256
+ msgstr ""
257
+
258
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:746
259
+ msgid "Spams"
260
+ msgstr ""
261
+
262
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:754
263
+ msgid "Too few records to print chart"
264
+ msgstr ""
265
+
266
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:764
267
+ msgid "Collapse Chronology"
268
+ msgstr ""
269
+
270
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:784
271
+ msgid "Spam Options"
272
+ msgstr ""
273
+
274
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:786
275
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:125
276
+ msgid "Enable/Disable Spam Check on Records"
277
+ msgstr ""
278
+
279
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:787
280
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:128
281
+ msgid "Record Akismet comment spam attempts"
282
+ msgstr ""
283
+
284
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:788
285
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:129
286
+ msgid "Record referrer spam attempts"
287
+ msgstr ""
288
+
289
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:789
290
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:112
291
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:140
292
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:209
293
+ msgid "Save Settings"
294
+ msgstr ""
295
+
296
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:796
297
+ msgid "Filter by marked IP"
298
+ msgstr ""
299
+
300
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:796
301
+ msgid "show marked items"
302
+ msgstr ""
303
+
304
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:797
305
+ msgid "Searched for"
306
+ msgstr ""
307
+
308
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:798
309
+ msgid "Auto refresh in"
310
+ msgstr ""
311
+
312
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:798
313
+ msgid "seconds"
314
+ msgstr ""
315
+
316
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:857
317
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:862
318
+ msgid "delete"
319
+ msgstr ""
320
+
321
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:857
322
+ msgid "Delete ALL marked records with this IP"
323
+ msgstr ""
324
+
325
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:859
326
+ msgid "unmark"
327
+ msgstr ""
328
+
329
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:859
330
+ msgid "UnMark IP"
331
+ msgstr ""
332
+
333
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:862
334
+ msgid "Delete this record"
335
+ msgstr ""
336
+
337
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:864
338
+ msgid "mark"
339
+ msgstr ""
340
+
341
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:864
342
+ msgid "Mark IP"
343
+ msgstr ""
344
+
345
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:867
346
+ msgid "show raw table"
347
+ msgstr ""
348
+
349
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:867
350
+ msgid "Show the items as raw table"
351
+ msgstr ""
352
+
353
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1436
354
+ msgid "WassUp Plugin table has reached maximum size!"
355
+ msgstr ""
356
+
357
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1437
358
+ msgid "Hi"
359
+ msgstr ""
360
+
361
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1437
362
+ msgid "you have received this email because your WassUp Database table at your Wordpress blog"
363
+ msgstr ""
364
+
365
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1437
366
+ msgid "has reached the maximum value you set in the options menu"
367
+ msgstr ""
368
+
369
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1438
370
+ msgid "This is only a reminder, please take the actions you want in the WassUp options menu"
371
+ msgstr ""
372
+
373
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1438
374
+ msgid "This alert now will be removed and you will be able to set a new one"
375
+ msgstr ""
376
+
377
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1439
378
+ msgid "Thank you for using WassUp plugin. Check if there is a new version available here:"
379
+ msgstr ""
380
+
381
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1439
382
+ msgid "Have a nice day!"
383
+ msgstr ""
384
+
385
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1736
386
+ msgid "Error getting table details"
387
+ msgstr ""
388
+
389
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1744
390
+ #, php-format
391
+ msgid "Delete any existing table %s"
392
+ msgstr ""
393
+
394
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1755
395
+ #, php-format
396
+ msgid "Table structure of table %s"
397
+ msgstr ""
398
+
399
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1763
400
+ #, php-format
401
+ msgid "Error with SHOW CREATE TABLE for %s."
402
+ msgstr ""
403
+
404
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1770
405
+ #, php-format
406
+ msgid "Error getting table structure of %s"
407
+ msgstr ""
408
+
409
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1778
410
+ #, php-format
411
+ msgid "Data contents of table %s"
412
+ msgstr ""
413
+
414
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1839
415
+ #, php-format
416
+ msgid "End of data contents of table %s"
417
+ msgstr ""
418
+
419
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1874
420
+ msgid "Last searched terms"
421
+ msgstr ""
422
+
423
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1887
424
+ msgid "Last referers"
425
+ msgstr ""
426
+
427
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1900
428
+ msgid "Top Browsers"
429
+ msgstr ""
430
+
431
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1913
432
+ msgid "Top OS"
433
+ msgstr ""
434
+
435
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1935
436
+ msgid "visitor(s) online"
437
+ msgstr ""
438
+
439
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1938
440
+ msgid "logged-in user(s)"
441
+ msgstr ""
442
+
443
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1942
444
+ msgid "comment author(s)"
445
+ msgstr ""
446
+
447
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1944
448
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:2097
449
+ msgid "powered by"
450
+ msgstr ""
451
+
452
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1976
453
+ msgid "What title for the widget (default \"Visitors Online\")"
454
+ msgstr ""
455
+
456
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1977
457
+ msgid "What style sheet class for &lt;ul&gt; attribute (default \"links\")"
458
+ msgstr ""
459
+
460
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1978
461
+ msgid "How many characters left? (For template compatibility - default 18)"
462
+ msgstr ""
463
+
464
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1979
465
+ msgid "Check if you want to show logged-in online users (default Yes)"
466
+ msgstr ""
467
+
468
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1980
469
+ msgid "Check if you want to show comment-author online users (default Yes)"
470
+ msgstr ""
471
+
472
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1981
473
+ msgid "Check if you want to show some last search referers (default Yes)"
474
+ msgstr ""
475
+
476
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1982
477
+ msgid "How many search referers want to show (default 5)"
478
+ msgstr ""
479
+
480
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1983
481
+ msgid "Check if you want to show some last external referers (default Yes)"
482
+ msgstr ""
483
+
484
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1984
485
+ msgid "How many external referers want to show (default 5)"
486
+ msgstr ""
487
+
488
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1985
489
+ msgid "Check if you want to show top browsers (default Yes)"
490
+ msgstr ""
491
+
492
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1986
493
+ msgid "How many top browsers want to show (default 5)"
494
+ msgstr ""
495
+
496
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1987
497
+ msgid "Check if you want to show top operating systems (default Yes)"
498
+ msgstr ""
499
+
500
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:1988
501
+ msgid "How many top operating systems want to show (default 5)"
502
+ msgstr ""
503
+
504
+ #: /home/m1k/Desktop/wassup_translation/trunk/wassup.php:2006
505
+ msgid "Wassup Widget"
506
+ msgstr ""
507
+
508
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:29
509
+ msgid "ATTENTION! Your WassUp table have reached the maximum value you set, I disabled the alert, you can re-enable it here."
510
+ msgstr ""
511
+
512
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:46
513
+ msgid "You can add a sidebar Widget with some useful statistics information by activating the"
514
+ msgstr ""
515
+
516
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:47
517
+ msgid "Wassup Widget in the Widgets menu option"
518
+ msgstr ""
519
+
520
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:48
521
+ msgid "Select the options you want for the WassUp plugin"
522
+ msgstr ""
523
+
524
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:52
525
+ msgid "General Setup"
526
+ msgstr ""
527
+
528
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:53
529
+ msgid "Statistics Recording"
530
+ msgstr ""
531
+
532
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:54
533
+ msgid "Manage Files & Database"
534
+ msgstr ""
535
+
536
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:60
537
+ msgid "Your default screen resolution (browser width)"
538
+ msgstr ""
539
+
540
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:61
541
+ msgid "Default screen resolution (in pixels)"
542
+ msgstr ""
543
+
544
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:69
545
+ msgid "Set minimum users level which can view and manage WassUp plugin (default Administrators)"
546
+ msgstr ""
547
+
548
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:72
549
+ msgid "Administrators"
550
+ msgstr ""
551
+
552
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:73
553
+ msgid "Contributors"
554
+ msgstr ""
555
+
556
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:74
557
+ msgid "Authors"
558
+ msgstr ""
559
+
560
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:77
561
+ msgid "Visit Detail Settings"
562
+ msgstr ""
563
+
564
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:78
565
+ msgid "Chart type - How many axes:"
566
+ msgstr ""
567
+
568
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:80
569
+ msgid "One"
570
+ msgstr ""
571
+
572
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:81
573
+ msgid "Two"
574
+ msgstr ""
575
+
576
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:85
577
+ msgid "Set how many minutes wait for automatic page refresh"
578
+ msgstr ""
579
+
580
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:85
581
+ msgid "Current Visitors Online and Visitors Details"
582
+ msgstr ""
583
+
584
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:86
585
+ msgid "refresh minutes (default 3)"
586
+ msgstr ""
587
+
588
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:88
589
+ msgid "Show visitor details for"
590
+ msgstr ""
591
+
592
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:91
593
+ msgid "Spiders"
594
+ msgstr ""
595
+
596
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:92
597
+ msgid "NO Spiders"
598
+ msgstr ""
599
+
600
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:102
601
+ msgid "Number of items per page"
602
+ msgstr ""
603
+
604
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:112
605
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:140
606
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:209
607
+ msgid "Reset"
608
+ msgstr ""
609
+
610
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:112
611
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:140
612
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:209
613
+ msgid "Reset to Default Settings"
614
+ msgstr ""
615
+
616
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:116
617
+ msgid "Statistics Recording Settings"
618
+ msgstr ""
619
+
620
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:117
621
+ msgid "Enable/Disable Recording"
622
+ msgstr ""
623
+
624
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:118
625
+ msgid "Checkbox to record statistics for each type of \"visitor\""
626
+ msgstr ""
627
+
628
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:120
629
+ msgid "Record logged in users"
630
+ msgstr ""
631
+
632
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:121
633
+ msgid "Record spiders and bots"
634
+ msgstr ""
635
+
636
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:122
637
+ msgid "Record attack/exploit attempts (libwww-perl agent)"
638
+ msgstr ""
639
+
640
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:125
641
+ msgid "(WARNING: if you experience blog slows down, please try to disable spam check)"
642
+ msgstr ""
643
+
644
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:126
645
+ msgid "Checkbox to record statistics for each type of \"spam\""
646
+ msgstr ""
647
+
648
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:132
649
+ msgid "Enter source IPs to exclude from recording"
650
+ msgstr ""
651
+
652
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:134
653
+ msgid "comma separated value (ex: 127.0.0.1, 10.0.0.1, etc...)"
654
+ msgstr ""
655
+
656
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:135
657
+ msgid "Enter requested URLs to exclude from recording"
658
+ msgstr ""
659
+
660
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:137
661
+ msgid "comma separated value, don't put the entire url, only the last path or some word to exclude (ex: /category/wordpress, 2007, etc...)"
662
+ msgstr ""
663
+
664
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:144
665
+ msgid "Temporary files location folder"
666
+ msgstr ""
667
+
668
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:146
669
+ msgid "\"Save path\" directory for storing temporary files used to track visitor activity"
670
+ msgstr ""
671
+
672
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:155
673
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:164
674
+ msgid "WARNING"
675
+ msgstr ""
676
+
677
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:155
678
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:164
679
+ msgid "Directory does not exist or is not writable. Please enter a different path above or change \"session.save_path\" in \"php.ini\" to point to a valid, writable folder"
680
+ msgstr ""
681
+
682
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:161
683
+ msgid "Note: To adjust, change the above path or edit \"sessions.save_path\" in"
684
+ msgstr ""
685
+
686
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:170
687
+ msgid "Use absolute directory paths only. This value is usually"
688
+ msgstr ""
689
+
690
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:174
691
+ msgid "Select actions for table growth"
692
+ msgstr ""
693
+
694
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:175
695
+ msgid "WassUp table grows very fast (especially if your blog is frequently visited), I recommend you to delete old records sometimes. You can select any option below to reset it, delete old records automatically or manually. (If you haven't database space problems you can leave the table as is)"
696
+ msgstr ""
697
+
698
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:176
699
+ msgid "Current WassUp table usage is"
700
+ msgstr ""
701
+
702
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:181
703
+ msgid "records"
704
+ msgstr ""
705
+
706
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:184
707
+ msgid "Alert me"
708
+ msgstr ""
709
+
710
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:184
711
+ msgid "email to"
712
+ msgstr ""
713
+
714
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:184
715
+ msgid "when table reaches"
716
+ msgstr ""
717
+
718
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:186
719
+ msgid "Empty table"
720
+ msgstr ""
721
+
722
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:186
723
+ msgid "export table in SQL format"
724
+ msgstr ""
725
+
726
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:187
727
+ msgid "Automatically delete records older than:"
728
+ msgstr ""
729
+
730
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:189
731
+ msgid "Don't delete anything"
732
+ msgstr ""
733
+
734
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:191
735
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:201
736
+ msgid "1 week"
737
+ msgstr ""
738
+
739
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:193
740
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:203
741
+ msgid "3 months"
742
+ msgstr ""
743
+
744
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:194
745
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:204
746
+ msgid "6 months"
747
+ msgstr ""
748
+
749
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:197
750
+ msgid "Delete NOW records older than:"
751
+ msgstr ""
752
+
753
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/settings.php:199
754
+ msgid "Action is NOT undoable"
755
+ msgstr ""
756
+
757
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/action.php:86
758
+ msgid "TOP QUERY"
759
+ msgstr ""
760
+
761
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/action.php:96
762
+ msgid "TOP REFERER"
763
+ msgstr ""
764
+
765
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/action.php:124
766
+ msgid "TOP REQUEST"
767
+ msgstr ""
768
+
769
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/action.php:136
770
+ msgid "TOP BROWSER"
771
+ msgstr ""
772
+
773
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/action.php:148
774
+ msgid "TOP OS"
775
+ msgstr ""
776
+
777
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/action.php:160
778
+ msgid "This top ten doesn't include Spam records"
779
+ msgstr ""
780
+
781
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/main.php:85
782
+ msgid "Next"
783
+ msgstr ""
784
+
785
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/main.php:87
786
+ msgid "Previous"
787
+ msgstr ""
788
+
789
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/main.php:120
790
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/main.php:124
791
+ msgid "It is necessary to specify the"
792
+ msgstr ""
793
+
794
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/main.php:120
795
+ msgid "number of pages"
796
+ msgstr ""
797
+
798
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/main.php:124
799
+ msgid "limit of items"
800
+ msgstr ""
801
+
802
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/main.php:124
803
+ msgid "to show per page"
804
+ msgstr ""
805
+
806
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/main.php:209
807
+ msgid "Pages"
808
+ msgstr ""
809
+
810
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/main.php:630
811
+ msgid "No visitor activity"
812
+ msgstr ""
813
+
814
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/main.php:782
815
+ msgid "Last 24 Hours"
816
+ msgstr ""
817
+
818
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/main.php:788
819
+ msgid "Last 7 Days"
820
+ msgstr ""
821
+
822
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/main.php:794
823
+ msgid "Last Month"
824
+ msgstr ""
825
+
826
+ #: /home/m1k/Desktop/wassup_translation/trunk/lib/main.php:800
827
+ msgid "Last Year"
828
+ msgstr ""
829
+
lib/action.php CHANGED
@@ -1,25 +1,20 @@
1
  <?php
2
- if (!defined('WASSUPFOLDER')) {
3
- define('WASSUPFOLDER', dirname(__FILE__), TRUE);
4
- }
5
  if (!defined('ABSPATH')) {
6
- define ('ABSPATH', substr(WASSUPFOLDER,0,strpos(WASSUPFOLDER,'/wp-content/')+1));
7
  }
8
  include_once(ABSPATH. 'wp-blog-header.php');
9
  if (!function_exists('get_bloginfo')) {
10
- include_once(ABSPATH.'wp-config.php');
11
  }
12
 
13
- include_once(WASSUPFOLDER. '/main.php');
14
  $siteurl = get_bloginfo('siteurl');
15
  $wpurl = get_bloginfo('wpurl');
16
  $table_name = $wpdb->prefix . "wassup";
17
 
18
- if ( $_GET['hash'] != wp_hash('wassup')) {
19
- echo "Nothing to do here";
20
- } else {
21
  //Retrieve command-line arguments...
22
- $max_char_len = ($_GET['width']/10);
23
  if (isset($_GET['to_date'])) $to_date = urlencode(attribute_escape($_GET['to_date']));
24
  else $to_date = wassup_get_time();
25
  if (isset($_GET['from_date'])) $from_date = urlencode(attribute_escape($_GET['from_date']));
@@ -29,10 +24,14 @@ if ( $_GET['hash'] != wp_hash('wassup')) {
29
 
30
  // ACTION: DELETE ON THE FLY FROM VISITOR DETAILS VIEW
31
  if ($_GET['action'] == "delete") {
32
- $wpdb->query($wpdb->prepare("DELETE FROM $table_name WHERE wassup_id='%s'", urlencode(attribute_escape($_GET['id']))));
 
 
 
 
33
  // ACTION: RUN SPY VIEW
34
  } elseif ($_GET['action'] == "spy") {
35
- //echo 'Starting spy from directory '.WASSUPFOLDER.' ABSPATH='.ABSPATH.'...<br />'; //debug...
36
  spyview($from_date,$to_date,$rows);
37
  // ACTION: SUMMARY PIE CHART
38
  } elseif ($_GET['action'] == "piechart") {
@@ -41,10 +40,10 @@ if ( $_GET['hash'] != wp_hash('wassup')) {
41
  $Tot->tableName = $table_name;
42
  $Tot->from_date = $from_date;
43
  $Tot->to_date = $to_date;
44
- $items_pie[] = $Tot->calc_tot("items_by_type", $search, "spam");
45
- $items_pie[] = $Tot->calc_tot("items_by_type", $search, "searchengine");
46
- $items_pie[] = $Tot->calc_tot("items_by_type", $search, "referrer");
47
- $items_pie[] = $Tot->calc_tot("items_by_type", $search, "direct");
48
  echo "<div align='center'><img src=http://chart.apis.google.com/chart?cht=p3&chco=0000ff&chs=600x300&chl=Spam|Search%20Engine|Referrer|Direct&chd=".chart_data($items_pie, null, null, null, 'pie')."></div>";
49
  // ACTION: DISPLAY RAW RECORDS
50
  } elseif ($_GET['action'] == "displayraw") {
@@ -59,30 +58,32 @@ if ( $_GET['hash'] != wp_hash('wassup')) {
59
  if ($rt->search != "") echo "<li>Search: ".$rt->search."</li>";
60
  if ($rt->os != "") echo "<li>OS: ".$rt->os."</li>";
61
  if ($rt->browser != "") echo "<li>Browser: ".$rt->browser."</li>";
62
- if ($rt->language != "") echo "<li>Labguage: ".$rt->language."</li>";
63
  }
64
  echo "<ul>
65
  </div>";
66
  // ACTION: RUN TOP TEN
67
  } elseif ($_GET['action'] == "topten") {
 
 
68
  //#get top 10 searches...
69
- $ch_search = $wpdb->get_results("SELECT count(search) as top_search, search, referrer FROM $table_name WHERE search!='' AND spam='0' AND timestamp BETWEEN $from_date AND $to_date GROUP BY search ORDER BY top_search DESC LIMIT 10");
70
  //#get top 10 requests...
71
- $ch_urlreq = $wpdb->get_results("SELECT count(urlrequested) as top_urlrequested, urlrequested FROM $table_name WHERE urlrequested!='' AND spam='0' AND timestamp BETWEEN $from_date AND $to_date GROUP BY urlrequested ORDER BY top_urlrequested DESC LIMIT 10");
72
  //#get top 50 referrers...will be narrowed down to 10
73
  //# with exclusion of wpurl referrals...
74
- $ch_referer = $wpdb->get_results("SELECT count(referrer) as top_referrer, referrer FROM $table_name WHERE referrer!='' AND spam='0' AND referrer NOT LIKE '%".$siteurl."%' AND searchengine='' AND timestamp BETWEEN $from_date AND $to_date GROUP BY referrer ORDER BY top_referrer DESC LIMIT 50");
75
  //#get top 10 browsers...
76
- $ch_browser = $wpdb->get_results("SELECT count(browser) as top_browser, browser FROM $table_name WHERE browser!='' AND spam='0' AND browser NOT LIKE '%N/A%' AND timestamp BETWEEN $from_date AND $to_date GROUP BY browser ORDER BY top_browser DESC LIMIT 10");
77
  //#get top 10 operating systems...
78
- $ch_os = $wpdb->get_results("SELECT count(os) as top_os, os FROM $table_name WHERE os!='' AND os NOT LIKE '%N/A%' AND spam='0' AND timestamp BETWEEN $from_date AND $to_date GROUP BY os ORDER BY top_os DESC LIMIT 10");
79
  ?>
80
  <div>
81
- <table border=0>
82
  <tr valign="top">
83
  <td width="25%">
84
  <ul class="charts">
85
- <li class="chartsT">TOP QUERY</li>
86
  <?php
87
  $char_len = round($max_char_len*.30,0);
88
  foreach ($ch_search as $chS) {
@@ -92,7 +93,7 @@ if ( $_GET['hash'] != wp_hash('wassup')) {
92
  </td>
93
  <td width="20%">
94
  <ul class="charts">
95
- <li class="chartsT">TOP REFERER</li>
96
  <?php
97
  $char_len = round($max_char_len*.22,0);
98
  $rec_count=0; //# of referrer records output...
@@ -100,13 +101,11 @@ if ( $_GET['hash'] != wp_hash('wassup')) {
100
  if ($rec_count < 10) { //limits output to 10...
101
  //# exclude $wpurl from search results...
102
  //# ...$siteurl already excluded in db query.
103
- //if (!eregi($siteurl, $chR->referrer) {
104
  if ($wpurl == $siteurl || !eregi($wpurl,$chR->referrer)) {
105
  print '<li class="charts">'.$chR->top_referrer.': ';
106
  print '<a href="'.$chR->referrer.'" title="'.$chR->referrer.'" target="_BLANK">';
107
  //#cut "http://" from shown url, then truncate
108
  //# instead of using stringShortener...
109
- //print stringShortener($chR->referrer,round($max_char_len*.25,0)).'</a>'."\n";
110
  print substr(preg_replace('/^'.preg_quote('http://','/').'/i', '', $chR->referrer),0,$char_len);
111
  if (strlen($chR->referrer) > ($char_len + 7)) {
112
  print '...';
@@ -120,7 +119,7 @@ if ( $_GET['hash'] != wp_hash('wassup')) {
120
  </td>
121
  <td width="25%">
122
  <ul class="charts">
123
- <li class="chartsT">TOP REQUEST</li>
124
  <?php
125
  $char_len = round($max_char_len*.28,0);
126
  foreach ($ch_urlreq as $chU) {
@@ -132,7 +131,7 @@ if ( $_GET['hash'] != wp_hash('wassup')) {
132
  </td>
133
  <td width="16%">
134
  <ul class="charts">
135
- <li class="chartsT">TOP BROWSER</li>
136
  <?php
137
  $char_len = round($max_char_len*.17,0);
138
  foreach ($ch_browser as $chB) {
@@ -144,7 +143,7 @@ if ( $_GET['hash'] != wp_hash('wassup')) {
144
  </td>
145
  <td width="14%">
146
  <ul class="charts">
147
- <li class="chartsT">TOP OS</li>
148
  <?php
149
  $char_len = round($max_char_len*.15,0);
150
  foreach ($ch_os as $chO) {
@@ -159,6 +158,5 @@ if ( $_GET['hash'] != wp_hash('wassup')) {
159
  <?php if ($wassup_settings['wassup_spamcheck'] == 1) { print '<span style="font-size:6pt;">* '.__("This top ten doesn't include Spam records","wassup").'</span>'; } ?>
160
  </div>
161
  <?php
162
- }
163
  }
164
  ?>
1
  <?php
 
 
 
2
  if (!defined('ABSPATH')) {
3
+ define ('ABSPATH', substr(__FILE__,0,strpos(__FILE__,'/wp-content/')+1));
4
  }
5
  include_once(ABSPATH. 'wp-blog-header.php');
6
  if (!function_exists('get_bloginfo')) {
7
+ include_once(ABSPATH.'wp-config.php');
8
  }
9
 
10
+ include_once(dirname(__FILE__). '/main.php');
11
  $siteurl = get_bloginfo('siteurl');
12
  $wpurl = get_bloginfo('wpurl');
13
  $table_name = $wpdb->prefix . "wassup";
14
 
15
+
 
 
16
  //Retrieve command-line arguments...
17
+ $max_char_len = (urlencode(attribute_escape($_GET['width']))/10);
18
  if (isset($_GET['to_date'])) $to_date = urlencode(attribute_escape($_GET['to_date']));
19
  else $to_date = wassup_get_time();
20
  if (isset($_GET['from_date'])) $from_date = urlencode(attribute_escape($_GET['from_date']));
24
 
25
  // ACTION: DELETE ON THE FLY FROM VISITOR DETAILS VIEW
26
  if ($_GET['action'] == "delete") {
27
+ if (method_exists($wpdb,'prepare')) {
28
+ $wpdb->query($wpdb->prepare("DELETE FROM $table_name WHERE wassup_id='%s'", urlencode(attribute_escape($_GET['id']))));
29
+ } else {
30
+ $wpdb->query("DELETE FROM $table_name WHERE wassup_id='".urlencode(attribute_escape($_GET['id']))."'");
31
+ }
32
  // ACTION: RUN SPY VIEW
33
  } elseif ($_GET['action'] == "spy") {
34
+ //echo 'Starting spy from directory '.dirname(__FILE__).' ABSPATH='.ABSPATH.'...<br />'; //debug...
35
  spyview($from_date,$to_date,$rows);
36
  // ACTION: SUMMARY PIE CHART
37
  } elseif ($_GET['action'] == "piechart") {
40
  $Tot->tableName = $table_name;
41
  $Tot->from_date = $from_date;
42
  $Tot->to_date = $to_date;
43
+ $items_pie[] = $Tot->calc_tot("count", $search, "AND spam>0", "DISTINCT");
44
+ $items_pie[] = $Tot->calc_tot("count", $search, "AND searchengine!='' AND spam=0", "DISTINCT");
45
+ $items_pie[] = $Tot->calc_tot("count", $search, "AND searchengine='' AND referrer NOT LIKE '%".$this->WpUrl."%' AND referrer!='' AND spam=0", "DISTINCT");
46
+ $items_pie[] = $Tot->calc_tot("count", $search, "AND searchengine='' AND (referrer LIKE '%".$this->WpUrl."%' OR referrer='') AND spam=0", "DISTINCT");
47
  echo "<div align='center'><img src=http://chart.apis.google.com/chart?cht=p3&chco=0000ff&chs=600x300&chl=Spam|Search%20Engine|Referrer|Direct&chd=".chart_data($items_pie, null, null, null, 'pie')."></div>";
48
  // ACTION: DISPLAY RAW RECORDS
49
  } elseif ($_GET['action'] == "displayraw") {
58
  if ($rt->search != "") echo "<li>Search: ".$rt->search."</li>";
59
  if ($rt->os != "") echo "<li>OS: ".$rt->os."</li>";
60
  if ($rt->browser != "") echo "<li>Browser: ".$rt->browser."</li>";
61
+ if ($rt->language != "") echo "<li>Language: ".$rt->language."</li>";
62
  }
63
  echo "<ul>
64
  </div>";
65
  // ACTION: RUN TOP TEN
66
  } elseif ($_GET['action'] == "topten") {
67
+ $siteurl = parse_url($siteurl);
68
+ $siteurl = $siteurl['host'];
69
  //#get top 10 searches...
70
+ $ch_search = $wpdb->get_results("SELECT count(search) as top_search, search, referrer FROM $table_name WHERE search!='' AND spam=0 AND timestamp BETWEEN $from_date AND $to_date GROUP BY search ORDER BY top_search DESC LIMIT 10");
71
  //#get top 10 requests...
72
+ $ch_urlreq = $wpdb->get_results("SELECT count(urlrequested) as top_urlrequested, urlrequested FROM $table_name WHERE urlrequested!='' AND spam=0 AND timestamp BETWEEN $from_date AND $to_date GROUP BY urlrequested ORDER BY top_urlrequested DESC LIMIT 10");
73
  //#get top 50 referrers...will be narrowed down to 10
74
  //# with exclusion of wpurl referrals...
75
+ $ch_referer = $wpdb->get_results("SELECT count(referrer) as top_referrer, referrer FROM $table_name WHERE referrer!='' AND spam=0 AND referrer NOT LIKE '%".$siteurl."%' AND searchengine='' AND timestamp BETWEEN $from_date AND $to_date GROUP BY referrer ORDER BY top_referrer DESC LIMIT 50");
76
  //#get top 10 browsers...
77
+ $ch_browser = $wpdb->get_results("SELECT count(browser) as top_browser, browser FROM $table_name WHERE browser!='' AND spam=0 AND browser NOT LIKE '%N/A%' AND timestamp BETWEEN $from_date AND $to_date GROUP BY browser ORDER BY top_browser DESC LIMIT 10");
78
  //#get top 10 operating systems...
79
+ $ch_os = $wpdb->get_results("SELECT count(os) as top_os, os FROM $table_name WHERE os!='' AND os NOT LIKE '%N/A%' AND spam=0 AND timestamp BETWEEN $from_date AND $to_date GROUP BY os ORDER BY top_os DESC LIMIT 10");
80
  ?>
81
  <div>
82
+ <table width="100%" border=0>
83
  <tr valign="top">
84
  <td width="25%">
85
  <ul class="charts">
86
+ <li class="chartsT"><?php _e("TOP QUERY", "wassup") ?></li>
87
  <?php
88
  $char_len = round($max_char_len*.30,0);
89
  foreach ($ch_search as $chS) {
93
  </td>
94
  <td width="20%">
95
  <ul class="charts">
96
+ <li class="chartsT"><?php _e("TOP REFERER", "wassup") ?></li>
97
  <?php
98
  $char_len = round($max_char_len*.22,0);
99
  $rec_count=0; //# of referrer records output...
101
  if ($rec_count < 10) { //limits output to 10...
102
  //# exclude $wpurl from search results...
103
  //# ...$siteurl already excluded in db query.
 
104
  if ($wpurl == $siteurl || !eregi($wpurl,$chR->referrer)) {
105
  print '<li class="charts">'.$chR->top_referrer.': ';
106
  print '<a href="'.$chR->referrer.'" title="'.$chR->referrer.'" target="_BLANK">';
107
  //#cut "http://" from shown url, then truncate
108
  //# instead of using stringShortener...
 
109
  print substr(preg_replace('/^'.preg_quote('http://','/').'/i', '', $chR->referrer),0,$char_len);
110
  if (strlen($chR->referrer) > ($char_len + 7)) {
111
  print '...';
119
  </td>
120
  <td width="25%">
121
  <ul class="charts">
122
+ <li class="chartsT"><?php _e("TOP REQUEST", "wassup") ?></li>
123
  <?php
124
  $char_len = round($max_char_len*.28,0);
125
  foreach ($ch_urlreq as $chU) {
131
  </td>
132
  <td width="16%">
133
  <ul class="charts">
134
+ <li class="chartsT"><?php _e("TOP BROWSER", "wassup") ?></li>
135
  <?php
136
  $char_len = round($max_char_len*.17,0);
137
  foreach ($ch_browser as $chB) {
143
  </td>
144
  <td width="14%">
145
  <ul class="charts">
146
+ <li class="chartsT"><?php _e("TOP OS", "wassup") ?></li>
147
  <?php
148
  $char_len = round($max_char_len*.15,0);
149
  foreach ($ch_os as $chO) {
158
  <?php if ($wassup_settings['wassup_spamcheck'] == 1) { print '<span style="font-size:6pt;">* '.__("This top ten doesn't include Spam records","wassup").'</span>'; } ?>
159
  </div>
160
  <?php
 
161
  }
162
  ?>
lib/akismet.class.php DELETED
@@ -1,388 +0,0 @@
1
- <?php
2
- /**
3
- * 01.07.2008 22:32:28est
4
- *
5
- * Akismet PHP4 class
6
- *
7
- * <b>Usage</b>
8
- * <code>
9
- * $comment = array(
10
- * 'author' => 'viagra-test-123',
11
- * 'email' => 'test@example.com',
12
- * 'website' => 'http://www.example.com/',
13
- * 'body' => 'This is a test comment',
14
- * 'permalink' => 'http://yourdomain.com/yourblogpost.url',
15
- * );
16
- *
17
- * $akismet = new Akismet('http://www.yourdomain.com/', 'YOUR_WORDPRESS_API_KEY', $comment);
18
- *
19
- * if($akismet->errorsExist()) {
20
- * echo"Couldn't connected to Akismet server!";
21
- * } else {
22
- * if($akismet->isSpam()) {
23
- * echo"Spam detected";
24
- * } else {
25
- * echo"yay, no spam!";
26
- * }
27
- * }
28
- * </code>
29
- *
30
- * @author Bret Kuhns {@link www.miphp.net}
31
- * @link http://www.miphp.net/blog/view/new_akismet_class/
32
- * @version 0.3.4
33
- * @license http://www.opensource.org/licenses/mit-license.php MIT License
34
- */
35
-
36
-
37
-
38
- // Error constants
39
- define("AKISMET_SERVER_NOT_FOUND", 0);
40
- define("AKISMET_RESPONSE_FAILED", 1);
41
- define("AKISMET_INVALID_KEY", 2);
42
-
43
-
44
-
45
- // Base class to assist in error handling between Akismet classes
46
- class AkismetObject {
47
- var $errors = array();
48
-
49
-
50
- /**
51
- * Add a new error to the errors array in the object
52
- *
53
- * @param String $name A name (array key) for the error
54
- * @param String $string The error message
55
- * @return void
56
- */
57
- // Set an error in the object
58
- function setError($name, $message) {
59
- $this->errors[$name] = $message;
60
- }
61
-
62
-
63
- /**
64
- * Return a specific error message from the errors array
65
- *
66
- * @param String $name The name of the error you want
67
- * @return mixed Returns a String if the error exists, a false boolean if it does not exist
68
- */
69
- function getError($name) {
70
- if($this->isError($name)) {
71
- return $this->errors[$name];
72
- } else {
73
- return false;
74
- }
75
- }
76
-
77
-
78
- /**
79
- * Return all errors in the object
80
- *
81
- * @return String[]
82
- */
83
- function getErrors() {
84
- return (array)$this->errors;
85
- }
86
-
87
-
88
- /**
89
- * Check if a certain error exists
90
- *
91
- * @param String $name The name of the error you want
92
- * @return boolean
93
- */
94
- function isError($name) {
95
- return isset($this->errors[$name]);
96
- }
97
-
98
-
99
- /**
100
- * Check if any errors exist
101
- *
102
- * @return boolean
103
- */
104
- function errorsExist() {
105
- return (count($this->errors) > 0);
106
- }
107
-
108
-
109
- }
110
-
111
-
112
-
113
-
114
-
115
- // Used by the Akismet class to communicate with the Akismet service
116
- class AkismetHttpClient extends AkismetObject {
117
- var $akismetVersion = '1.1';
118
- var $con;
119
- var $host;
120
- var $port;
121
- var $apiKey;
122
- var $blogUrl;
123
- var $errors = array();
124
-
125
-
126
- // Constructor
127
- function AkismetHttpClient($host, $blogUrl, $apiKey, $port = 80) {
128
- $this->host = $host;
129
- $this->port = $port;
130
- $this->blogUrl = $blogUrl;
131
- $this->apiKey = $apiKey;
132
- }
133
-
134
-
135
- // Use the connection active in $con to get a response from the server and return that response
136
- function getResponse($request, $path, $type = "post", $responseLength = 1160) {
137
- $this->_connect();
138
-
139
- if($this->con && !$this->isError(AKISMET_SERVER_NOT_FOUND)) {
140
- $request =
141
- strToUpper($type)." /{$this->akismetVersion}/$path HTTP/1.1\r\n" .
142
- "Host: ".((!empty($this->apiKey)) ? $this->apiKey."." : null)."{$this->host}\r\n" .
143
- "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n" .
144
- "Content-Length: ".strlen($request)."\r\n" .
145
- "User-Agent: Akismet PHP4 Class\r\n" .
146
- "\r\n" .
147
- $request
148
- ;
149
- $response = "";
150
-
151
- @fwrite($this->con, $request);
152
-
153
- while(!feof($this->con)) {
154
- $response .= @fgets($this->con, $responseLength);
155
- }
156
-
157
- $response = explode("\r\n\r\n", $response, 2);
158
- return $response[1];
159
- } else {
160
- $this->setError(AKISMET_RESPONSE_FAILED, "The response could not be retrieved.");
161
- }
162
-
163
- $this->_disconnect();
164
- }
165
-
166
-
167
- // Connect to the Akismet server and store that connection in the instance variable $con
168
- function _connect() {
169
- if(!($this->con = @fsockopen($this->host, $this->port))) {
170
- $this->setError(AKISMET_SERVER_NOT_FOUND, "Could not connect to akismet server.");
171
- }
172
- }
173
-
174
-
175
- // Close the connection to the Akismet server
176
- function _disconnect() {
177
- @fclose($this->con);
178
- }
179
-
180
-
181
- }
182
-
183
-
184
-
185
-
186
-
187
- // The controlling class. This is the ONLY class the user should instantiate in
188
- // order to use the Akismet service!
189
- class Akismet extends AkismetObject {
190
- var $apiPort = 80;
191
- var $akismetServer = 'rest.akismet.com';
192
- var $akismetVersion = '1.1';
193
- var $http;
194
-
195
- var $ignore = array(
196
- 'HTTP_COOKIE',
197
- 'HTTP_X_FORWARDED_FOR',
198
- 'HTTP_X_FORWARDED_HOST',
199
- 'HTTP_MAX_FORWARDS',
200
- 'HTTP_X_FORWARDED_SERVER',
201
- 'REDIRECT_STATUS',
202
- 'SERVER_PORT',
203
- 'PATH',
204
- 'DOCUMENT_ROOT',
205
- 'SERVER_ADMIN',
206
- 'QUERY_STRING',
207
- 'PHP_SELF',
208
- 'argv'
209
- );
210
-
211
- var $blogUrl = "";
212
- var $apiKey = "";
213
- var $comment = array();
214
-
215
-
216
- /**
217
- * Constructor
218
- *
219
- * Set instance variables, connect to Akismet, and check API key
220
- *
221
- * @param String $blogUrl The URL to your own blog
222
- * @param String $apiKey Your wordpress API key
223
- * @param String[] $comment A formatted comment array to be examined by the Akismet service
224
- * @return Akismet
225
- */
226
- function Akismet($blogUrl, $apiKey, $comment = array()) {
227
- $this->blogUrl = $blogUrl;
228
- $this->apiKey = $apiKey;
229
- $this->setComment($comment);
230
-
231
- // Connect to the Akismet server and populate errors if they exist
232
- $this->http = new AkismetHttpClient($this->akismetServer, $blogUrl, $apiKey);
233
- if($this->http->errorsExist()) {
234
- $this->errors = array_merge($this->errors, $this->http->getErrors());
235
- }
236
-
237
- // Check if the API key is valid
238
- if(!$this->_isValidApiKey($apiKey)) {
239
- $this->setError(AKISMET_INVALID_KEY, "Your Akismet API key is not valid.");
240
- }
241
- }
242
-
243
-
244
- /**
245
- * Query the Akismet and determine if the comment is spam or not
246
- *
247
- * @return boolean
248
- */
249
- function isSpam() {
250
- $response = $this->http->getResponse($this->_getQueryString(), 'comment-check');
251
-
252
- return ($response == "true");
253
- }
254
-
255
-
256
- /**
257
- * Submit this comment as an unchecked spam to the Akismet server
258
- *
259
- * @return void
260
- */
261
- function submitSpam() {
262
- $this->http->getResponse($this->_getQueryString(), 'submit-spam');
263
- }
264
-
265
-
266
- /**
267
- * Submit a false-positive comment as "ham" to the Akismet server
268
- *
269
- * @return void
270
- */
271
- function submitHam() {
272
- $this->http->getResponse($this->_getQueryString(), 'submit-ham');
273
- }
274
-
275
-
276
- /**
277
- * Manually set the comment value of the instantiated object.
278
- *
279
- * @param Array $comment
280
- * @return void
281
- */
282
- function setComment($comment) {
283
- $this->comment = $comment;
284
- if(!empty($comment)) {
285
- $this->_formatCommentArray();
286
- $this->_fillCommentValues();
287
- }
288
- }
289
-
290
-
291
- /**
292
- * Returns the current value of the object's comment array.
293
- *
294
- * @return Array
295
- */
296
- function getComment() {
297
- return $this->comment;
298
- }
299
-
300
-
301
- /**
302
- * Check with the Akismet server to determine if the API key is valid
303
- *
304
- * @access Protected
305
- * @param String $key The Wordpress API key passed from the constructor argument
306
- * @return boolean
307
- */
308
- function _isValidApiKey($key) {
309
- $keyCheck = $this->http->getResponse("key=".$this->apiKey."&blog=".$this->blogUrl, 'verify-key');
310
-
311
- return ($keyCheck == "valid");
312
- }
313
-
314
-
315
- /**
316
- * Format the comment array in accordance to the Akismet API
317
- *
318
- * @access Protected
319
- * @return void
320
- */
321
- function _formatCommentArray() {
322
- $format = array(
323
- 'type' => 'comment_type',
324
- 'author' => 'comment_author',
325
- 'email' => 'comment_author_email',
326
- 'website' => 'comment_author_url',
327
- 'body' => 'comment_content'
328
- );
329
-
330
- foreach($format as $short => $long) {
331
- if(isset($this->comment[$short])) {
332
- $this->comment[$long] = $this->comment[$short];
333
- unset($this->comment[$short]);
334
- }
335
- }
336
- }
337
-
338
-
339
- /**
340
- * Fill any values not provided by the developer with available values.
341
- *
342
- * @return void
343
- */
344
- function _fillCommentValues() {
345
- if(!isset($this->comment['user_ip'])) {
346
- $this->comment['user_ip'] = ($_SERVER['REMOTE_ADDR'] != getenv('SERVER_ADDR')) ? $_SERVER['REMOTE_ADDR'] : getenv('HTTP_X_FORWARDED_FOR');
347
- }
348
- if(!isset($this->comment['user_agent'])) {
349
- $this->comment['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
350
- }
351
- if(!isset($this->comment['referrer'])) {
352
- $this->comment['referrer'] = $_SERVER['HTTP_REFERER'];
353
- }
354
- if(!isset($this->comment['blog'])) {
355
- $this->comment['blog'] = $this->blogUrl;
356
- }
357
- }
358
-
359
-
360
- /**
361
- * Build a query string for use with HTTP requests
362
- *
363
- * @access Protected
364
- * @return String
365
- */
366
- function _getQueryString() {
367
- foreach($_SERVER as $key => $value) {
368
- if(!in_array($key, $this->ignore)) {
369
- if($key == 'REMOTE_ADDR') {
370
- $this->comment[$key] = $this->comment['user_ip'];
371
- } else {
372
- $this->comment[$key] = $value;
373
- }
374
- }
375
- }
376
-
377
- $query_string = '';
378
-
379
- foreach($this->comment as $key => $data) {
380
- $query_string .= $key . '=' . urlencode(stripslashes($data)) . '&';
381
- }
382
-
383
- return $query_string;
384
- }
385
-
386
-
387
- }
388
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/main.php CHANGED
@@ -9,193 +9,211 @@ Script Version: 0.3.2
9
  Author: Victor De la Rocha
10
  Author URI: http://www.mis-algoritmos.com
11
  */
12
- /*Default values*/
13
- var $total_pages = null;
14
- var $limit = null;
15
- var $target = "";
16
- var $page = 1;
17
- var $adjacents = 2;
18
- var $showCounter = false;
19
- var $className = "pagination";
20
- var $parameterName = "pages";
21
- var $urlF = false;//urlFriendly
22
-
23
- /*Buttons next and previous*/
24
- var $nextT = "Next";
25
- var $nextI = "&#187;"; //&#9658;
26
- var $prevT = "Previous";
27
- var $prevI = "&#171;"; //&#9668;
28
-
29
- /*****/
30
- var $calculate = false;
31
-
32
- #Total items
33
- function items($value){$this->total_pages = intval($value);}
34
-
35
- #how many items to show per page
36
- function limit($value){$this->limit = intval($value);}
37
-
38
- #Page to sent the page value
39
- function target($value){$this->target = $value;}
40
-
41
- #Current page
42
- function currentPage($value){$this->page = intval($value);}
43
-
44
- #How many adjacent pages should be shown on each side of the current page?
45
- function adjacents($value){$this->adjacents = intval($value);}
46
-
47
- #show counter?
48
- function showCounter($value=""){$this->showCounter=($value===true)?true:false;}
49
-
50
- #to change the class name of the pagination div
51
- function changeClass($value=""){$this->className=$value;}
52
-
53
- function nextLabel($value){$this->nextT = $value;}
54
- function nextIcon($value){$this->nextI = $value;}
55
- function prevLabel($value){$this->prevT = $value;}
56
- function prevIcon($value){$this->prevI = $value;}
57
-
58
- #to change the class name of the pagination div
59
- function parameterName($value=""){$this->parameterName=$value;}
60
-
61
- #to change urlFriendly
62
- function urlFriendly($value="%"){
63
- if(eregi('^ *$',$value)){
64
- $this->urlF=false;
65
- return false;
66
- }
67
- $this->urlF=$value;
68
- }
69
-
70
- var $pagination;
71
-
72
- function pagination(){}
73
- function show(){
74
- if(!$this->calculate)
75
- if($this->calculate())
76
- echo "<div class=\"$this->className\">$this->pagination</div>";
77
- }
78
- function get_pagenum_link($id){
79
- if(strpos($this->target,'?')===false)
80
- if($this->urlF)
81
- return str_replace($this->urlF,$id,$this->target);
82
- else
83
- return "$this->target?$this->parameterName=$id";
84
- else
85
- return "$this->target&$this->parameterName=$id";
86
- }
87
-
88
- function calculate(){
89
- $this->pagination = "";
90
- $this->calculate == true;
91
- $error = false;
92
- if($this->urlF and $this->urlF != '%' and strpos($this->target,$this->urlF)===false){
93
- //Es necesario especificar el comodin para sustituir
94
- echo "Especificaste un wildcard para sustituir, pero no existe en el target<br />";
95
- $error = true;
96
- }elseif($this->urlF and $this->urlF == '%' and strpos($this->target,$this->urlF)===false){
97
- echo "Es necesario especificar en el target el comodin % para sustituir el n�mero de p�gina<br />";
98
- $error = true;
99
- }
100
- if($this->total_pages == null){
101
- echo "It is necessary to specify the <strong>number of pages</strong> (\$class->items(1000))<br />";
102
- $error = true;
103
- }
104
- if($this->limit == null){
105
- echo "It is necessary to specify the <strong>limit of items</strong> to show per page (\$class->limit(10))<br />";
106
- $error = true;
107
- }
108
- if($error)return false;
109
-
110
- $n = trim($this->nextT.' '.$this->nextI);
111
- $p = trim($this->prevI.' '.$this->prevT);
112
-
113
- /* Setup vars for query. */
114
- if($this->page)
115
- $start = ($this->page - 1) * $this->limit; //first item to display on this page
116
  else
117
- $start = 0; //if no page var is given, set start to 0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
 
119
- /* Setup page vars for display. */
120
- if ($this->page == 0) $this->page = 1; //if no page var is given, default to 1.
121
- $prev = $this->page - 1; //previous page is page - 1
122
- $next = $this->page + 1; //next page is page + 1
123
- $lastpage = ceil($this->total_pages/$this->limit); //lastpage is = total pages / items per page, rounded up.
124
- $lpm1 = $lastpage - 1; //last page minus 1
125
-
126
- /*
127
- Now we apply our rules and draw the pagination object.
128
- We're actually saving the code to a variable in case we want to draw it more than once.
129
- */
130
-
131
- if($lastpage > 1){
132
- //anterior button
133
- if($this->page > 1)
134
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($prev)."\">$p</a>";
135
- else
136
- $this->pagination .= "<span class=\"disabled\">$p</span>";
137
- //pages
138
- if ($lastpage < 7 + ($this->adjacents * 2)){//not enough pages to bother breaking it up
139
- for ($counter = 1; $counter <= $lastpage; $counter++){
140
- if ($counter == $this->page)
141
- $this->pagination .= "<span class=\"current\">$counter</span>";
142
- else
143
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
144
- }
145
- }
146
- elseif($lastpage > 5 + ($this->adjacents * 2)){//enough pages to hide some
147
- //close to beginning; only hide later pages
148
- if($this->page < 1 + ($this->adjacents * 2)){
149
- for ($counter = 1; $counter < 4 + ($this->adjacents * 2); $counter++){
150
- if ($counter == $this->page)
151
- $this->pagination .= "<span class=\"current\">$counter</span>";
152
- else
153
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
154
- }
155
- $this->pagination .= "...";
156
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($lpm1)."\">$lpm1</a>";
157
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($lastpage)."\">$lastpage</a>";
158
- }
159
- //in middle; hide some front and some back
160
- elseif($lastpage - ($this->adjacents * 2) > $this->page && $this->page > ($this->adjacents * 2)){
161
- $this->pagination .= "<a href=\"".$this->get_pagenum_link(1)."\">1</a>";
162
- $this->pagination .= "<a href=\"".$this->get_pagenum_link(2)."\">2</a>";
163
- $this->pagination .= "...";
164
- for ($counter = $this->page - $this->adjacents; $counter <= $this->page + $this->adjacents; $counter++)
165
- if ($counter == $this->page)
166
- $this->pagination .= "<span class=\"current\">$counter</span>";
167
- else
168
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
169
- $this->pagination .= "...";
170
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($lpm1)."\">$lpm1</a>";
171
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($lastpage)."\">$lastpage</a>";
172
- }
173
- //close to end; only hide early pages
174
- else{
175
- $this->pagination .= "<a href=\"".$this->get_pagenum_link(1)."\">1</a>";
176
- $this->pagination .= "<a href=\"".$this->get_pagenum_link(2)."\">2</a>";
177
- $this->pagination .= "...";
178
- for ($counter = $lastpage - (2 + ($this->adjacents * 2)); $counter <= $lastpage; $counter++)
179
  if ($counter == $this->page)
180
  $this->pagination .= "<span class=\"current\">$counter</span>";
181
  else
182
  $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
183
- }
184
- }
185
- //siguiente button
186
- if ($this->page < $counter - 1)
187
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($next)."\">$n</a>";
188
- else
189
- $this->pagination .= "<span class=\"disabled\">$n</span>";
190
- if($this->showCounter)$this->pagination .= "<div class=\"pagination_data\">($this->total_pages Pages)</div>";
191
- }
192
-
193
- return true;
194
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  } //end class pagination
196
  } //end if !class_exists('pagination')
197
 
198
-
199
  if (!class_exists('Detector')) { //in case another app uses this class...
200
  //
201
  // Detector class (c) Mohammad Hafiz bin Ismail 2006
@@ -217,7 +235,7 @@ class Detector {
217
  var $town;
218
  var $state;
219
  var $country;
220
- var $ccode;
221
  var $longitude;
222
  var $latitude;
223
  var $ipaddress;
@@ -287,7 +305,7 @@ class Detector {
287
  $os = "Mac OS"; $version = "";
288
  } elseif (preg_match("/(?:Windows95|Windows 95|Win95|Win 95)/",$useragent,$match)) {
289
  $os = "Windows"; $version = "95";
290
- } elseif (preg_match("/(?:Windows98|Windows 98|Win98|Win 98)/",$useragent,$match)) {
291
  $os = "Windows"; $version = "98";
292
  } elseif (preg_match("/(?:WindowsCE|Windows CE|WinCE|Win CE)/",$useragent,$match)) {
293
  $os = "Windows"; $version = "CE";
@@ -335,8 +353,12 @@ class Detector {
335
  $browser = "iCab";
336
  } elseif (preg_match("/^Mozilla(?:.*)compatible;\sMSIE\s([0-9\.]+)/",$useragent,$match)) {
337
  $browser = "MSIE";
338
- } elseif (preg_match("/^Mozilla(?:.*)\(Macintosh(?:.*)Safari\/([0-9\.]+)/",$useragent,$match)) {
 
 
339
  $browser = "Safari";
 
 
340
  } elseif (preg_match("/^Mozilla(?:.*)\(Macintosh(?:.*)OmniWeb\/v([0-9\.]+)/",$useragent,$match)) {
341
  $browser = "Omniweb";
342
  } elseif (preg_match("/^Mozilla(?:.*)\(compatible; Google Desktop/",$useragent,$match)) {
@@ -579,10 +601,10 @@ function spyview ($from_date="",$to_date="",$rows="999") {
579
  $referrer = '<a href="'.$cv->referrer.'" target=_"BLANK">'.stringShortener($cv->referrer, round($max_char_len*.9,0)).'</a>';
580
  }
581
  } else {
582
- $referrer = "Direct hit";
583
- }
584
- } else {
585
- $referrer = "From your blog";
586
  }
587
  // User is logged in or is a comment's author
588
  if ($cv->username != "" AND $cv->comment_author != "") {
@@ -609,7 +631,7 @@ function spyview ($from_date="",$to_date="",$rows="999") {
609
  } else {
610
  //display "no activity" periodically so we know spy is running...
611
  if ((int)$to_date%7 == 0 ) {
612
- echo '<div class="sum-spy"><span class="det3">'.gmdate("H:i:s",$to_date).' - No visitor activity &nbsp; &nbsp; :-( &nbsp; </span></div>';
613
  }
614
  } //end if !empty($qryC)
615
  } //end function spyview
@@ -640,74 +662,83 @@ function roundup($value) {
640
  return (ceil(intval($value)/pow(10, $dg))*pow(10, $dg)+pow(10, $dg));
641
  }
642
 
643
- function chart_data($values, $pages=null, $atime=null, $type, $charttype=null) {
644
- // Port of JavaScript from http://code.google.com/apis/chart/
645
- // http://james.cridland.net/code
646
-
647
- // First, find the maximum value from the values given
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
648
 
649
- $maxValue = roundup(max(array_merge($values, $pages)));
650
- //$maxValue = roundup(max($values));
651
- $halfValue = ($maxValue/2);
652
- //$maxPage = roundup(max($pages));
653
- //$halfPage = ($maxPage/2);
654
-
655
- // A list of encoding characters to help later, as per Google's example
656
- $simpleEncoding = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
657
-
658
- $chartData = "s:";
659
-
660
- if ($charttype == "main") {
661
- for ($i = 0; $i < count($values); $i++) {
662
- $currentValue = $values[$i];
663
- $currentTime = $atime[$i];
664
- $label_time.=ereg_replace(" ", "+", $currentTime)."|";
665
-
666
- if ($currentValue > -1) {
667
- $chartData.=substr($simpleEncoding,61*($currentValue/$maxValue),1);
668
- }
669
- else {
670
- $chartData.='_';
671
- }
672
- }
673
- // Add pageviews line to the chart
674
- if (count($pages) != 0) {
675
- $chartData.=",";
676
- for ($i = 0; $i < count($pages); $i++) {
677
- $currentPage = $pages[$i];
678
- $currentTime = $atime[$i];
679
-
680
- if ($currentPage > -1) {
681
- $chartData.=substr($simpleEncoding,61*($currentPage/$maxValue),1);
682
- }
683
- else {
684
- $chartData.='_';
685
- }
686
- }
687
- }
688
- // Return the chart data - and let the Y axis to show the maximum value
689
- return $chartData."&chxt=x,y&chxl=0:|".$label_time."|1:|0|".$halfValue."|".$maxValue."&chxs=0,6b6b6b,9";
690
-
691
- } else {
692
- for ($i = 0; $i < count($values); $i++) {
693
- $currentValue = $values[$i];
694
- $currentTime = $atime[$i];
695
- $label_time.=ereg_replace(" ", "+", $currentTime)."|";
696
-
697
- if ($currentValue > -1) {
698
- $chartData.=substr($simpleEncoding,61*($currentValue/$maxValue),1);
699
- }
700
- else {
701
- $chartData.='_';
702
- }
703
- }
704
- return $chartData."&chxt=x,y&chxl=0:|".$label_time."|1:|0|".$halfValue."|".$maxValue."&chxs=0,6b6b6b,9";
705
- }
706
 
707
- }
708
 
709
- // This is the new MAIN QUERY e COUNT ITEMS queries done by php class
710
  class MainItems {
 
711
  var $tableName;
712
  var $searchString;
713
  var $from_date;
@@ -716,16 +747,18 @@ class MainItems {
716
  var $ItemsType;
717
  var $Limit;
718
  var $Last;
719
- var $Marked_ip;
720
  var $WpUrl;
721
 
722
- function calc_tot($Type, $Search="", $pertype="") {
 
723
  global $wpdb;
724
  $this->ItemsType = $Type;
725
  $this->searchString = $Search;
726
 
 
727
  if ($Search != "") { $ss = " AND (ip LIKE '%".$this->searchString."%' OR hostname LIKE '%".$this->searchString."%' OR urlrequested LIKE '%".$this->searchString."%' OR agent LIKE '%".$this->searchString."%' OR referrer LIKE '%".$this->searchString."%') "; }
728
 
 
729
  switch ($Type) {
730
  // This is the MAIN query to show the chronology
731
  case "main":
@@ -733,87 +766,79 @@ class MainItems {
733
  return $qry;
734
  break;
735
  // These are the queries to count the items hits/pages/spam
736
- case "items":
737
- $itemstot = $wpdb->get_var("SELECT COUNT(DISTINCT wassup_id) AS itemstot FROM ".$this->tableName." WHERE wassup_id IS NOT NULL AND timestamp BETWEEN ".$this->from_date." AND ".$this->to_date." $ss ".$this->whereis);
738
  return $itemstot;
739
  break;
740
- case "pages":
741
- $pagestot = $wpdb->get_var("SELECT COUNT(wassup_id) AS pagestot FROM ".$this->tableName." WHERE wassup_id IS NOT NULL AND timestamp BETWEEN ".$this->from_date." AND ".$this->to_date." $ss ".$this->whereis);
742
- return $pagestot;
743
- break;
744
- case "spam":
745
- $spamtot = $wpdb->get_var("SELECT COUNT(wassup_id) AS spamtot FROM ".$this->tableName." WHERE wassup_id IS NOT NULL AND spam>0 AND timestamp BETWEEN ".$this->from_date." AND ".$this->to_date." $ss ".$this->whereis);
746
- return $spamtot;
747
- break;
748
- case "items_by_type":
749
- switch ($pertype) {
750
- case "spam":
751
- $items_type = "spam>0";
752
- break;
753
- case "marked":
754
- $items_type = "ip LIKE '%".$this->Marked_ip."%'";
755
- break;
756
- case "searchengine":
757
- $items_type = "searchengine!='' AND spam=0";
758
- break;
759
- case "referrer":
760
- $items_type = "searchengine='' AND referrer NOT LIKE '%".$this->WpUrl."%' AND referrer!='' AND spam=0";
761
- break;
762
- case "direct":
763
- $items_type = "searchengine='' AND (referrer LIKE '%".$this->WpUrl."%' OR referrer='') AND spam=0";
764
- break;
765
- }
766
- $itemstot_by_type = $wpdb->get_var("SELECT COUNT(DISTINCT wassup_id) AS itemstot FROM ".$this->tableName." WHERE wassup_id IS NOT NULL AND $items_type AND timestamp BETWEEN ".$this->from_date." AND ".$this->to_date." $ss ".$this->whereis);
767
- return $itemstot_by_type;
768
- break;
769
  }
770
  }
771
 
772
- function TheChart($Ctype, $Res, $Search="") {
 
 
 
773
  global $wpdb;
774
  $this->searchString = $Search;
775
  $this->Last = $Ctype;
 
776
  switch ($Ctype) {
777
  case 1:
778
- $label = "Last 24 Hours";
779
  $strto = "24 hours";
780
- $cc = "%H";
781
- $cd = "%H:00";
782
  break;
783
  case 7:
784
- $label = "Last 7 Days";
785
  $strto = "7 days";
786
- $cc = "%d";
787
- $cd = "%a %d %b";
788
  break;
789
  case 30:
790
- $label = "Last Month";
791
  $strto = "30 days";
792
- $cc = "%d";
793
- $cd = "%d %b";
794
  break;
795
  case 365:
796
- $label = "Last Year";
797
  $strto = "12 months";
798
- $cc = "%m";
799
- $cd = "%b %Y";
800
  break;
801
  }
 
 
802
  if ($Search != "") { $ss = " AND (ip LIKE '%".$this->searchString."%' OR hostname LIKE '%".$this->searchString."%' OR urlrequested LIKE '%".$this->searchString."%' OR agent LIKE '%".$this->searchString."%' OR referrer LIKE '%".$this->searchString."%') "; }
803
- $hour_todate = $this->to_date;
804
- $hour_fromdate = strtotime("-".$strto, $hour_todate);
805
- $aitems = $wpdb->get_results("SELECT COUNT(DISTINCT wassup_id) as items, COUNT(wassup_id) as pages, DATE_FORMAT(FROM_UNIXTIME(timestamp), '$cd') as thedate FROM ".$this->tableName." WHERE wassup_id IS NOT NULL AND timestamp BETWEEN $hour_fromdate AND $hour_todate ".$this->whereis." $ss GROUP BY DATE_FORMAT(FROM_UNIXTIME(timestamp), '$cc') ORDER BY timestamp", ARRAY_A);
806
- foreach ($aitems as $bhits) {
807
- $ahits[] = $bhits['items'];
808
- $apages[] = $bhits['pages'];
809
- $atime[] = $bhits['thedate'];
810
- }
811
 
 
 
 
 
 
 
 
 
 
 
 
 
812
  echo "<div id='placeholder' align='center'>
813
- <img src=http://chart.apis.google.com/chart?chtt=".urlencode($label)."&chls=4,1,0|2,6,2&chco=0077cc,FF6D06&chm=B,14568A30,0,0,0&chg=10,20,2,5&cht=lc&chs=".$Res."x125&chd=".chart_data($ahits, $apages, $atime, $cc, "main").">
814
  </div>";
815
  }
816
 
817
  }
818
 
 
 
 
 
 
 
 
 
 
 
 
819
  ?>
9
  Author: Victor De la Rocha
10
  Author URI: http://www.mis-algoritmos.com
11
  */
12
+ /*Default values*/
13
+ var $total_pages;
14
+ var $limit;
15
+ var $target;
16
+ var $page;
17
+ var $adjacents;
18
+ var $showCounter;
19
+ var $className;
20
+ var $parameterName;
21
+ var $urlF ;
22
+
23
+ /*Buttons next and previous*/
24
+ var $nextT;
25
+ var $nextI;
26
+ var $prevT;
27
+ var $prevI;
28
+
29
+ /*****/
30
+ var $calculate;
31
+
32
+ #Total items
33
+ function items($value){$this->total_pages = intval($value);}
34
+
35
+ #how many items to show per page
36
+ function limit($value){$this->limit = intval($value);}
37
+
38
+ #Page to sent the page value
39
+ function target($value){$this->target = $value;}
40
+
41
+ #Current page
42
+ function currentPage($value){$this->page = intval($value);}
43
+
44
+ #How many adjacent pages should be shown on each side of the current page?
45
+ function adjacents($value){$this->adjacents = intval($value);}
46
+
47
+ #show counter?
48
+ function showCounter($value=""){$this->showCounter=($value===true)?true:false;}
49
+
50
+ #to change the class name of the pagination div
51
+ function changeClass($value=""){$this->className=$value;}
52
+
53
+ function nextLabel($value){$this->nextT = $value;}
54
+ function nextIcon($value){$this->nextI = $value;}
55
+ function prevLabel($value){$this->prevT = $value;}
56
+ function prevIcon($value){$this->prevI = $value;}
57
+
58
+ #to change the class name of the pagination div
59
+ function parameterName($value=""){$this->parameterName=$value;}
60
+
61
+ #to change urlFriendly
62
+ function urlFriendly($value="%"){
63
+ if(eregi('^ *$',$value)){
64
+ $this->urlF=false;
65
+ return false;
66
+ }
67
+ $this->urlF=$value;
68
+ }
69
+
70
+ var $pagination;
71
+
72
+ function pagination(){
73
+ /*Set Default values*/
74
+ $this->total_pages = null;
75
+ $this->limit = null;
76
+ $this->target = "";
77
+ $this->page = 1;
78
+ $this->adjacents = 2;
79
+ $this->showCounter = false;
80
+ $this->className = "pagination";
81
+ $this->parameterName = "pages";
82
+ $this->urlF = false;//urlFriendly
83
+
84
+ /*Buttons next and previous*/
85
+ $this->nextT = __("Next","wassup");
86
+ $this->nextI = "&#187;"; //&#9658;
87
+ $this->prevT = __("Previous","wassup");
88
+ $this->prevI = "&#171;"; //&#9668;
89
+
90
+ $this->calculate = false;
91
+ }
92
+ function show(){
93
+ if(!$this->calculate)
94
+ if($this->calculate())
95
+ echo "<div class=\"$this->className\">$this->pagination</div>";
96
+ }
97
+ function get_pagenum_link($id){
98
+ if(strpos($this->target,'?')===false)
99
+ if($this->urlF)
100
+ return str_replace($this->urlF,$id,$this->target);
101
+ else
102
+ return "$this->target?$this->parameterName=$id";
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  else
104
+ return "$this->target&$this->parameterName=$id";
105
+ }
106
+
107
+ function calculate(){
108
+ $this->pagination = "";
109
+ $this->calculate == true;
110
+ $error = false;
111
+ if($this->urlF and $this->urlF != '%' and strpos($this->target,$this->urlF)===false){
112
+ //Es necesario especificar el comodin para sustituir
113
+ echo 'Especificaste un wildcard para sustituir, pero no existe en el target<br />';
114
+ $error = true;
115
+ }elseif($this->urlF and $this->urlF == '%' and strpos($this->target,$this->urlF)===false){
116
+ echo 'Es necesario especificar en el target el comodin';
117
+ $error = true;
118
+ }
119
+ if($this->total_pages == null){
120
+ echo __("It is necessary to specify the","wassup")." <strong>".__("number of pages","wassup")."</strong> (\$class->items(1000))<br />";
121
+ $error = true;
122
+ }
123
+ if($this->limit == null){
124
+ echo __("It is necessary to specify the","wassup")." <strong>".__("limit of items","wassup")."</strong> ".__("to show per page","wassup")." (\$class->limit(10))<br />";
125
+ $error = true;
126
+ }
127
+ if($error)return false;
128
 
129
+ $n = trim($this->nextT.' '.$this->nextI);
130
+ $p = trim($this->prevI.' '.$this->prevT);
131
+
132
+ /* Setup vars for query. */
133
+ if($this->page)
134
+ $start = ($this->page - 1) * $this->limit; //first item to display on this page
135
+ else
136
+ $start = 0; //if no page var is given, set start to 0
137
+
138
+ /* Setup page vars for display. */
139
+ if ($this->page == 0) $this->page = 1; //if no page var is given, default to 1.
140
+ $prev = $this->page - 1; //previous page is page - 1
141
+ $next = $this->page + 1; //next page is page + 1
142
+ $lastpage = ceil($this->total_pages/$this->limit); //lastpage is = total pages / items per page, rounded up.
143
+ $lpm1 = $lastpage - 1; //last page minus 1
144
+
145
+ /*
146
+ Now we apply our rules and draw the pagination object.
147
+ We're actually saving the code to a variable in case we want to draw it more than once.
148
+ */
149
+
150
+ if($lastpage > 1){
151
+ //anterior button
152
+ if($this->page > 1)
153
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($prev)."\">$p</a>";
154
+ else
155
+ $this->pagination .= "<span class=\"disabled\">$p</span>";
156
+ //pages
157
+ if ($lastpage < 7 + ($this->adjacents * 2)){//not enough pages to bother breaking it up
158
+ for ($counter = 1; $counter <= $lastpage; $counter++){
159
+ if ($counter == $this->page)
160
+ $this->pagination .= "<span class=\"current\">$counter</span>";
161
+ else
162
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
163
+ }
164
+ }
165
+ elseif($lastpage > 5 + ($this->adjacents * 2)){//enough pages to hide some
166
+ //close to beginning; only hide later pages
167
+ if($this->page < 1 + ($this->adjacents * 2)){
168
+ for ($counter = 1; $counter < 4 + ($this->adjacents * 2); $counter++){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  if ($counter == $this->page)
170
  $this->pagination .= "<span class=\"current\">$counter</span>";
171
  else
172
  $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
173
+ }
174
+ $this->pagination .= "...";
175
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($lpm1)."\">$lpm1</a>";
176
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($lastpage)."\">$lastpage</a>";
177
+ }
178
+ //in middle; hide some front and some back
179
+ elseif($lastpage - ($this->adjacents * 2) > $this->page && $this->page > ($this->adjacents * 2)){
180
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link(1)."\">1</a>";
181
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link(2)."\">2</a>";
182
+ $this->pagination .= "...";
183
+ for ($counter = $this->page - $this->adjacents; $counter <= $this->page + $this->adjacents; $counter++)
184
+ if ($counter == $this->page)
185
+ $this->pagination .= "<span class=\"current\">$counter</span>";
186
+ else
187
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
188
+ $this->pagination .= "...";
189
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($lpm1)."\">$lpm1</a>";
190
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($lastpage)."\">$lastpage</a>";
191
+ }
192
+ //close to end; only hide early pages
193
+ else{
194
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link(1)."\">1</a>";
195
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link(2)."\">2</a>";
196
+ $this->pagination .= "...";
197
+ for ($counter = $lastpage - (2 + ($this->adjacents * 2)); $counter <= $lastpage; $counter++)
198
+ if ($counter == $this->page)
199
+ $this->pagination .= "<span class=\"current\">$counter</span>";
200
+ else
201
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
202
+ }
203
+ }
204
+ //siguiente button
205
+ if ($this->page < $counter - 1)
206
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($next)."\">$n</a>";
207
+ else
208
+ $this->pagination .= "<span class=\"disabled\">$n</span>";
209
+ if($this->showCounter)$this->pagination .= "<div class=\"pagination_data\">($this->total_pages ".__("Pages","wassup").")</div>";
210
+ }
211
+
212
+ return true;
213
+ }
214
  } //end class pagination
215
  } //end if !class_exists('pagination')
216
 
 
217
  if (!class_exists('Detector')) { //in case another app uses this class...
218
  //
219
  // Detector class (c) Mohammad Hafiz bin Ismail 2006
235
  var $town;
236
  var $state;
237
  var $country;
238
+ var $Ctimeformatode;
239
  var $longitude;
240
  var $latitude;
241
  var $ipaddress;
305
  $os = "Mac OS"; $version = "";
306
  } elseif (preg_match("/(?:Windows95|Windows 95|Win95|Win 95)/",$useragent,$match)) {
307
  $os = "Windows"; $version = "95";
308
+ } elseif (preg_match("/(?:Windows98|Windows 98|Win98|Win 98|Win 9x)/",$useragent,$match)) {
309
  $os = "Windows"; $version = "98";
310
  } elseif (preg_match("/(?:WindowsCE|Windows CE|WinCE|Win CE)/",$useragent,$match)) {
311
  $os = "Windows"; $version = "CE";
353
  $browser = "iCab";
354
  } elseif (preg_match("/^Mozilla(?:.*)compatible;\sMSIE\s([0-9\.]+)/",$useragent,$match)) {
355
  $browser = "MSIE";
356
+ } elseif (preg_match("/^(?:.*)compatible;\sMSIE\s([0-9\.]+)/",$useragent,$match)) {
357
+ $browser = "MSIE";
358
+ } elseif (preg_match("/^Mozilla(?:.*)(?:.*)Safari/",$useragent,$match)) {
359
  $browser = "Safari";
360
+ //} elseif (preg_match("/^Mozilla(?:.*)\(Windows(?:.*)Safari\/([0-9\.]+)/",$useragent,$match)) {
361
+ // $browser = "Safari";
362
  } elseif (preg_match("/^Mozilla(?:.*)\(Macintosh(?:.*)OmniWeb\/v([0-9\.]+)/",$useragent,$match)) {
363
  $browser = "Omniweb";
364
  } elseif (preg_match("/^Mozilla(?:.*)\(compatible; Google Desktop/",$useragent,$match)) {
601
  $referrer = '<a href="'.$cv->referrer.'" target=_"BLANK">'.stringShortener($cv->referrer, round($max_char_len*.9,0)).'</a>';
602
  }
603
  } else {
604
+ $referrer = __('From your blog','wassup');
605
+ }
606
+ } else {
607
+ $referrer = __('Direct hit','wassup');
608
  }
609
  // User is logged in or is a comment's author
610
  if ($cv->username != "" AND $cv->comment_author != "") {
631
  } else {
632
  //display "no activity" periodically so we know spy is running...
633
  if ((int)$to_date%7 == 0 ) {
634
+ echo '<div class="sum-spy"><span class="det3">'.gmdate("H:i:s",$to_date).' - '.__("No visitor activity","wassup").' &nbsp; &nbsp; :-( &nbsp; </span></div>';
635
  }
636
  } //end if !empty($qryC)
637
  } //end function spyview
662
  return (ceil(intval($value)/pow(10, $dg))*pow(10, $dg)+pow(10, $dg));
663
  }
664
 
665
+ function chart_data($Wvisits, $pages=null, $atime=null, $type, $charttype=null, $axes=null) {
666
+ // Port of JavaScript from http://code.google.com/apis/chart/
667
+ // http://james.cridland.net/code
668
+ // First, find the maximum value from the values given
669
+ if ($axes == 1) {
670
+ $maxValue = roundup(max(array_merge($Wvisits, $pages)));
671
+ //$maxValue = roundup(max($Wvisits));
672
+ $halfValue = ($maxValue/2);
673
+ $maxPage = $maxValue;
674
+ } else {
675
+ $maxValue = roundup(max($Wvisits));
676
+ $halfValue = ($maxValue/2);
677
+ $maxPage = roundup(max($pages));
678
+ $halfPage = ($maxPage/2);
679
+ }
680
+
681
+ // A list of encoding characters to help later, as per Google's example
682
+ $simpleEncoding = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
683
+
684
+ $chartData = "s:";
685
+
686
+ // Chart type has two datasets
687
+ if ($charttype == "main") {
688
+ for ($i = 0; $i < count($Wvisits); $i++) {
689
+ $currentValue = $Wvisits[$i];
690
+ $currentTime = $atime[$i];
691
+ $label_time.=ereg_replace(" ", "+", $currentTime)."|";
692
+
693
+ if ($currentValue > -1) {
694
+ $chartData.=substr($simpleEncoding,61*($currentValue/$maxValue),1);
695
+ } else {
696
+ $chartData.='_';
697
+ }
698
+ }
699
+ // Add pageviews line to the chart
700
+ if (count($pages) != 0) {
701
+ $chartData.=",";
702
+ for ($i = 0; $i < count($pages); $i++) {
703
+ $currentPage = $pages[$i];
704
+ $currentTime = $atime[$i];
705
+
706
+ if ($currentPage > -1) {
707
+ $chartData.=substr($simpleEncoding,61*($currentPage/$maxPage),1);
708
+ } else {
709
+ $chartData.='_';
710
+ }
711
+ }
712
+ }
713
+ // Return the chart data - and let the Y axis to show the maximum value
714
+ if ($axes == 1) {
715
+ return $chartData."&chxt=x,y&chxl=0:|".$label_time."|1:|0|".$halfValue."|".$maxValue."&chxs=0,6b6b6b,9";
716
+ } else {
717
+ return $chartData."&chxt=x,y,r&chxl=0:|".$label_time."|1:|0|".$halfValue."|".$maxValue."|2:|0|".$halfPage."|".$maxPage."&chxs=0,6b6b6b,9";
718
+ }
719
 
720
+ // Chart type has one one dataset
721
+ // It's unused in 1.4.5
722
+ } else {
723
+ for ($i = 0; $i < count($Wvisits); $i++) {
724
+ $currentValue = $Wvisits[$i];
725
+ $currentTime = $atime[$i];
726
+ $label_time.=ereg_replace(" ", "+", $currentTime)."|";
727
+
728
+ if ($currentValue > -1) {
729
+ $chartData.=substr($simpleEncoding,61*($currentValue/$maxValue),1);
730
+ } else {
731
+ $chartData.='_';
732
+ }
733
+ }
734
+ return $chartData."&chxt=x,y&chxl=0:|".$label_time."|1:|0|".$halfValue."|".$maxValue."&chxs=0,6b6b6b,9";
735
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
736
 
737
+ }
738
 
739
+ // Used to show main visitors details query, to count items and to extract data for main chart
740
  class MainItems {
741
+ // declare variables
742
  var $tableName;
743
  var $searchString;
744
  var $from_date;
747
  var $ItemsType;
748
  var $Limit;
749
  var $Last;
 
750
  var $WpUrl;
751
 
752
+ // Function to show main query and count items
753
+ function calc_tot($Type, $Search="", $specific_where_clause=null, $distinct_type=null) {
754
  global $wpdb;
755
  $this->ItemsType = $Type;
756
  $this->searchString = $Search;
757
 
758
+ // Add the Search variable to the WHERE clause
759
  if ($Search != "") { $ss = " AND (ip LIKE '%".$this->searchString."%' OR hostname LIKE '%".$this->searchString."%' OR urlrequested LIKE '%".$this->searchString."%' OR agent LIKE '%".$this->searchString."%' OR referrer LIKE '%".$this->searchString."%') "; }
760
 
761
+ // Switch by every (global) items type (visits, pageviews, spams, etc...)
762
  switch ($Type) {
763
  // This is the MAIN query to show the chronology
764
  case "main":
766
  return $qry;
767
  break;
768
  // These are the queries to count the items hits/pages/spam
769
+ case "count":
770
+ $itemstot = $wpdb->get_var("SELECT COUNT(".$distinct_type." wassup_id) AS itemstot FROM ".$this->tableName." WHERE wassup_id IS NOT NULL ".$specific_where_clause." AND timestamp BETWEEN ".$this->from_date." AND ".$this->to_date." $ss ".$this->whereis);
771
  return $itemstot;
772
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
773
  }
774
  }
775
 
776
+ // $Ctype = chart's type by time
777
+ // $Res = resolution
778
+ // $Search = string to add to where clause
779
+ function TheChart($Ctype, $Res, $Search="", $axes_type) {
780
  global $wpdb;
781
  $this->searchString = $Search;
782
  $this->Last = $Ctype;
783
+ // Options by chart type
784
  switch ($Ctype) {
785
  case 1:
786
+ $label = __("Last 24 Hours", "wassup");
787
  $strto = "24 hours";
788
+ $Ctimeformat = "%H";
789
+ $x_axes_label = "%H:00";
790
  break;
791
  case 7:
792
+ $label = __("Last 7 Days", "wassup");
793
  $strto = "7 days";
794
+ $Ctimeformat = "%d";
795
+ $x_axes_label = "%a %d %b";
796
  break;
797
  case 30:
798
+ $label = __("Last Month", "wassup");
799
  $strto = "30 days";
800
+ $Ctimeformat = "%d";
801
+ $x_axes_label = "%d %b";
802
  break;
803
  case 365:
804
+ $label = __("Last Year", "wassup");
805
  $strto = "12 months";
806
+ $Ctimeformat = "%m";
807
+ $x_axes_label = "%b %Y";
808
  break;
809
  }
810
+
811
+ // Add Search variable to WHERE clause
812
  if ($Search != "") { $ss = " AND (ip LIKE '%".$this->searchString."%' OR hostname LIKE '%".$this->searchString."%' OR urlrequested LIKE '%".$this->searchString."%' OR agent LIKE '%".$this->searchString."%' OR referrer LIKE '%".$this->searchString."%') "; }
 
 
 
 
 
 
 
 
813
 
814
+ $hour_todate = $this->to_date;
815
+ $hour_fromdate = strtotime("-".$strto, $hour_todate);
816
+
817
+ $aitems = $wpdb->get_results("SELECT COUNT(DISTINCT wassup_id) as items, COUNT(wassup_id) as pages, DATE_FORMAT(FROM_UNIXTIME(timestamp), '$x_axes_label') as thedate FROM ".$this->tableName." WHERE wassup_id IS NOT NULL AND timestamp BETWEEN $hour_fromdate AND $hour_todate ".$this->whereis." $ss GROUP BY DATE_FORMAT(FROM_UNIXTIME(timestamp), '$Ctimeformat') ORDER BY timestamp", ARRAY_A);
818
+ // Extract arrays for Visits, Pages and X_Axis_Label
819
+ foreach ($aitems as $bhits) {
820
+ $ahits[] = $bhits['items'];
821
+ $apages[] = $bhits['pages'];
822
+ $atime[] = $bhits['thedate'];
823
+ }
824
+
825
+ // Print the main chart in visitors details view
826
  echo "<div id='placeholder' align='center'>
827
+ <img src='http://chart.apis.google.com/chart?chtt=".urlencode($label)."&chls=4,1,0|2,6,2&chco=0077cc,FF6D06&chm=B,14568A30,0,0,0&chg=10,20,2,5&cht=lc&chs=".$Res."x125&chd=".chart_data($ahits, $apages, $atime, $Ctimeformat, "main", $axes_type)."'>
828
  </div>";
829
  }
830
 
831
  }
832
 
833
+ // Class to check if a previous comment with a specific IP was detected as SPAM by Akismet default plugin
834
+ class CheckComment {
835
+ var $tablePrefix;
836
+
837
+ function isSpammer ($authorIP) {
838
+ global $wpdb;
839
+ $spam_comment = $wpdb->get_var("SELECT COUNT(comment_ID) AS spam_comment FROM ".$this->tablePrefix."comments WHERE comment_author_IP='$authorIP' AND comment_approved='spam'");
840
+ return $spam_comment;
841
+ }
842
+ }
843
+
844
  ?>
lib/settings.php CHANGED
@@ -4,7 +4,9 @@
4
  ?>
5
  <?php
6
  $to_date = wassup_get_time();
7
- $from_date = @strtotime($_POST['delete_manual'], $to_date);
 
 
8
  if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name) {
9
  if ($_POST['delete_manual'] != "") {
10
  $wpdb->query("DELETE FROM $table_name WHERE timestamp<'$from_date'");
@@ -25,22 +27,23 @@
25
 
26
  $adminemail = get_bloginfo('admin_email');
27
 
28
- if ($wassup_settings['wassup_remind_flag'] == 2) {
29
  $alert_msg = '<p style="color:red;font-weight:bold;">'.__('ATTENTION! Your WassUp table have reached the maximum value you set, I disabled the alert, you can re-enable it here.','wassup').'</p>';
30
- $wassup_settings['wassup_remind_flag'] = 0;
31
- update_option('wassup_settings', $wassup_settings);
32
  }
33
  $alertstyle = 'color:red; background-color:#ffd;';
34
  ?>
35
-
36
- <script type="text/javascript">
37
- $(function() {
38
- $('#tab_container > ul').tabs({ fxFade: true, fxSpeed: 'fast' });
39
- });
40
- </script>
41
-
42
  <style type="text/css">
43
- h3 { margin-bottom:0px; padding-bottom:5px; color:#333; }
 
 
44
  form p { margin-top:0px; padding-top:0px; padding-left:15px; }
45
  </style>
46
  <h2><?php _e('Options','wassup'); ?></h2>
@@ -48,150 +51,141 @@
48
  <a href="/wp-admin/widgets.php"><?php _e('Wassup Widget in the Widgets menu option','wassup'); ?></a>.</p>
49
  <p style="padding:10px 0 10px 0;"><?php _e('Select the options you want for the WassUp plugin','wassup'); ?></p>
50
 
51
- <form action="" method="post">
52
  <div id="tab_container">
53
- <ul>
54
- <li><a href="#fragment-1"><span>Basic</span></a></li>
55
- <li><a href="#fragment-2"><span>Visitor Details</span></a></li>
56
- <li><a href="#fragment-3"><span>Statistics Recording</span></a></li>
57
- <li><a href="#fragment-4"><span>Actions for DB Table</span></a></li>
58
  </ul>
59
 
60
- <div id="fragment-1">
 
61
  <!-- //Added by Helene D. to use more browser width to display visitor detail... -->
62
  <br /><h3><?php _e('Your default screen resolution (browser width)','wassup'); ?></h3>
63
- <p><?php _e('Default screen resolution (in pixels)','wassup'); ?>:
64
- <select name='wassup_screen_res' style="width: 90px">
65
- <option value='640' <?php if ($wassup_settings['wassup_screen_res'] == "640") { print "SELECTED"; } ?>> 640</option>
66
- <option value='800' <?php if ($wassup_settings['wassup_screen_res'] == "800") { print "SELECTED"; } ?>> 800</option>
67
- <option value='1024' <?php if ($wassup_settings['wassup_screen_res'] == "1024") { print "SELECTED"; } ?>> 1024</option>
68
- <option value='1200' <?php if ($wassup_settings['wassup_screen_res'] == "1200") { print "SELECTED"; } ?>> 1200</option>
69
  </select>
70
  </p>
71
  <br /><h3><?php _e('Set minimum users level which can view and manage WassUp plugin (default Administrators)','wassup'); ?></h3>
72
  <p><select name="wassup_userlevel">
73
- <option value="">--</option>
74
- <option value="8" <?php if($wassup_settings['wassup_userlevel'] == "8") echo 'SELECTED'; ?>><?php _e('Administrators','wassup'); ?></option>
75
- <option value="6" <?php if($wassup_settings['wassup_userlevel'] == "6") print "SELECTED"; ?>><?php _e('Contributors','wassup'); ?></option>
76
- <option value="2" <?php if($wassup_settings['wassup_userlevel'] == "2") print "SELECTED"; ?>><?php _e('Authors','wassup'); ?></option>
77
  </select></p><br />
78
- <h3><?php _e('Set how many minutes wait for automatic page refresh (Current Visitors Online and Visitors Details)','wassup'); ?></h3>
79
- <p><input type="text" name="wassup_refresh" size="2" value="<?php print $wassup_settings['wassup_refresh']; ?>" /> <?php _e('refresh minutes (default 3)','wassup'); ?></p><br />
80
- </div>
81
 
82
- <div id="fragment-2">
83
- <br /><h3><?php _e('Show visitor details for','wassup'); ?>: <select name='wassup_default_type'>
84
- <option value='everything' <?php if ($wassup_settings['wassup_default_type'] == "everything") { print "SELECTED"; } ?>>Everything</option>
85
- <option value='spider' <?php if ($wassup_settings['wassup_default_type'] == "spider") { print "SELECTED"; } ?>>Spiders</option>
86
- <option value='nospider' <?php if ($wassup_settings['wassup_default_type'] == "nospider") { print "SELECTED"; } ?>>NO Spiders</option>
87
- <option value='spam' <?php if ($wassup_settings['wassup_default_type'] == "spam") { print "SELECTED"; } ?>>Spam</option>
88
- <option value='nospam' <?php if ($wassup_settings['wassup_default_type'] == "nospam") { print "SELECTED"; } ?>>NO Spam</option>
89
- <option value='nospamspider' <?php if ($wassup_settings['wassup_default_type'] == "nospamspider") { print "SELECTED"; } ?>>NO Spam NO Spider</option>
90
- <option value='loggedin' <?php if ($wassup_settings['wassup_default_type'] == "loggedin") { print "SELECTED"; } ?>>Users logged in</option>
91
- <option value='comauthor' <?php if ($wassup_settings['wassup_default_type'] == "comauthor") { print "SELECTED"; } ?>>Comment authors</option>
92
- <option value='searchengine' <?php if ($wassup_settings['wassup_default_type'] == "searchengine") { print "SELECTED"; } ?>>Referer from search engine</option>
93
- <option value='referrer' <?php if ($wassup_settings['wassup_default_type'] == "referrer") { print "SELECTED"; } ?>>Referer from ext link</option>
94
- </select>
95
- </h3>
96
- <br /><h3><?php _e('Number of items per page','wassup'); ?>: <select name='wassup_default_limit'>
97
- <option value='10' <?php if ($wassup_settings['wassup_default_limit'] == "10") { print "SELECTED"; } ?>>10</option>
98
- <option value='20' <?php if ($wassup_settings['wassup_default_limit'] == "20") { print "SELECTED"; } ?>>20</option>
99
- <option value='50' <?php if ($wassup_settings['wassup_default_limit'] == "50") { print "SELECTED"; } ?>>50</option>
100
- <option value='100' <?php if ($wassup_settings['wassup_default_limit'] == "100") { print "SELECTED"; } ?>>100</option>
101
- </select>
102
- </h3>
103
- <br />
104
- </div>
105
 
106
- <div id="fragment-3">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  <br /><h3><?php _e('Statistics Recording Settings','wassup'); ?></h3>
108
- <p> <input type="checkbox" name="wassup_active" value="1" <?php if($wassup_settings['wassup_active'] == 1) print "CHECKED"; ?> /> <strong><?php _e('Enable/Disable Recording','wassup'); ?></strong></p>
109
- <p style="margin-top:5px;"> <strong> Checkbox to record statistics for each type of "visitor"</strong><br />
110
  <span style="padding-left:25px;padding-top:0;margin-top:0;display:block;clear:left;">
111
- <input type="checkbox" name="wassup_loggedin" value="1" <?php if($wassup_settings['wassup_loggedin'] == 1) print "CHECKED"; ?> /> Record logged in users<br />
112
- <input type="checkbox" name="wassup_spider" value="1" <?php if($wassup_settings['wassup_spider'] == 1) print "CHECKED"; ?> /> Record spiders and bots<br />
113
- <input type="checkbox" name="wassup_attack" value="1" <?php if($wassup_settings['wassup_attack'] == 1) print "CHECKED"; ?> /> Record attack/exploit attempts (libwww-perl agent)<br />
114
  </span>
115
  </p>
116
- <br /><p><input type="checkbox" name="wassup_spamcheck" value="1" <?php if($wassup_settings['wassup_spamcheck'] == 1 ) print "CHECKED"; ?> /> <strong><?php _e('Enable/Disable Spam Check on Records','wassup'); ?></strong></p>
117
  <p style="margin-top:5px;"> <strong> <?php _e('Checkbox to record statistics for each type of "spam"','wassup'); ?></strong><br />
118
  <span style="padding-left:25px;padding-top:0;margin-top:0;display:block;clear:left;">
119
- <input type="checkbox" name="wassup_spam" value="1" <?php if($wassup_settings['wassup_spam'] == 1) print "CHECKED"; ?> /> <?php _e('Record Akismet comment spam attempts','wassup'); ?><br />
120
- <input type="checkbox" name="wassup_refspam" value="1" <?php if($wassup_settings['wassup_refspam'] == 1) print "CHECKED"; ?> /> <?php _e('Record referrer spam attempts','wassup'); ?><br />
121
  </span>
122
  </p>
123
  <br /><p><strong><?php _e('Enter source IPs to exclude from recording','wassup'); ?></strong>:
124
  <br /><span style="padding-left:10px;display:block;clear:left;">
125
- <textarea name="wassup_exclude" rows="4" cols="40"><?php print $wassup_settings['wassup_exclude']; ?></textarea></span>comma separated value (ex: 127.0.0.1, 10.0.0.1, etc...)</p>
126
- <br /><p>
127
- <?php
128
- echo '<strong>'.__('"Save path" directory for storing temporary files to track visitors who have cookies disabled','wassup').'</strong>:';
129
- $sessionpath = wGetSessionpath();
130
- if (!empty($wassup_settings['wassup_savepath']) && $wassup_settings['wassup_savepath'] != $sessionpath ) {
131
- $sessionpath = $wassup_settings['wassup_savepath'];
132
- }
 
 
 
 
 
133
  //$sessionpath = "/fakefolder/temp"; //#debug
134
  $sessionstyle = '';
135
  //# check that session_save_path exists and is writable...
136
- if ( !file_exists($sessionpath)) {
137
- $sessionwarn = '<small style="'.$alertstyle.' font-weight:bold; padding-left:5px;"><span style="text-decoration:blink;">'.__('WARNING','wassup').'!</span> '.__('Directory does not exist or is not writable. Please modify above path or edit "session.save_path" in "php.ini" to point to a valid, writable folder','wassup').'.</small>';
138
  $sessionstyle = $alertstyle;
139
  } else {
140
- //#check that the directory is writable...
141
- $sessiontestfile = $sessionpath."/temp".time().'.txt';
142
- if (@touch($sessiontestfile)) {
143
- $sessionwarn ='<small style="padding-left:5px;">'.__('Note: To adjust, change the above path or edit "sessions.save_path" in','wassup').' "php.ini".</small>';
144
- unlink($sessiontestfile);
145
- } else {
146
- $sessionwarn = '<small style="'.$alertstyle.' font-weight:bold; padding-left:5px;"><span style="text-decoration:blink;">'.__('WARNING','wassup').'!</span> '.__('Directory does not exist or is not writable. Please modify above path or edit "session.save_path" in "php.ini" to point to a valid, writable folder','wassup').'.</small>';
147
- $sessionstyle = $alertstyle;
148
- }
149
-
150
  }
151
  echo '<textarea name="wassup_savepath" rows="1" style="width:550px;padding-left:25px;clear:left; '.$sessionstyle.'">'.$sessionpath.'</textarea>'."\n";
152
  echo '<br />&nbsp;&nbsp;'.__('Use absolute directory paths only. This value is usually','wassup').' "/tmp".'."\n";
153
  echo '<br />'.$sessionwarn."\n";
154
  ?>
155
- </p>
156
- <br />
157
- </div>
158
-
159
- <div id="fragment-4">
160
  <br /><h3><?php _e('Select actions for table growth','wassup'); ?></h3>
161
- <p><?php _e("WassUp table grows very fast (especially if your blog is frequently visited), I recommend you to delete some old records sometimes. You can select any option below to reset it, delete old records automatically or manually. (If you haven't database space problems you can leave the table as is)","wassup"); ?><p>
162
  <p><?php _e('Current WassUp table usage is','wassup');
163
  print ': <strong>';
164
- if ( (int)$tusage >= (int)$wassup_settings['wassup_remind_mb']) {
165
  print '<span style="'.$alertstyle.'">'.$tusage.'</span>';
166
  } else { print $tusage; }
167
  print ' Mb</strong> ('.$data_rows.' '.__('records','wassup').')</p>'."\n";
168
  print $alert_msg; ?>
169
- <br /><p><input type="checkbox" name="wassup_remind_flag" value="1" <?php if ($wassup_settings['wassup_remind_flag'] == 1) print "CHECKED"; ?>>
170
- <strong><?php _e('Alert me','wassup'); ?></strong> (<?php _e('email to','wassup'); ?>: <strong><?php print $adminemail; ?></strong>) <?php _e('when table reaches','wassup'); ?> <input type="text" name="wassup_remind_mb" size="3" value="<?php print $wassup_settings['wassup_remind_mb']; ?>"> Mb</p>
171
  <p><input type="checkbox" name="wassup_empty" value="1">
172
  <strong><?php _e('Empty table','wassup'); ?></strong> (<a href="?<?php print $_SERVER['QUERY_STRING']; ?>&export=1"><?php _e('export table in SQL format','wassup'); ?></a>)</p>
173
- <br /><p><strong>Automatically delete records older than:</strong>
174
  <select name="delete_auto">
175
- <option value="never" <?php if($wassup_settings['delete_auto'] == "never") print "SELECTED"; ?>>Don't delete anything</option>
176
- <option value="-1 day" <?php if($wassup_settings['delete_auto'] == "-1 day") print "SELECTED"; ?>>24 hours</option>
177
- <option value="-1 week" <?php if($wassup_settings['delete_auto'] == "-1 week") print "SELECTED"; ?>>1 week</option>
178
- <option value="-1 month" <?php if($wassup_settings['delete_auto'] == "-1 month") print "SELECTED"; ?>>1 month</option>
179
- <option value="-3 months" <?php if($wassup_settings['delete_auto'] == "-3 months") print "SELECTED"; ?>>3 months</option>
180
- <option value="-6 months" <?php if($wassup_settings['delete_auto'] == "-6 months") print "SELECTED"; ?>>6 months</option>
181
- <option value="-1 year" <?php if($wassup_settings['delete_auto'] == "-1 year") print "SELECTED"; ?>>1 year</option>
182
  </select></p>
183
- <br /><p>Delete NOW records older than:
184
  <select name="delete_manual">
185
- <option value="never">Action is NOT undoable</option>
186
- <option value="-1 day">24 hours</option>
187
- <option value="-1 week">1 week</option>
188
- <option value="-1 month">1 month</option>
189
- <option value="-3 months">3 months</option>
190
- <option value="-6 months">6 months</option>
191
- <option value="-1 year">1 year</option>
192
  </select></p>
193
- <br />
194
- </div>
195
- </div>
196
- <p style="padding-left:0;padding-top:15px;"><input type="submit" name="submit" value="<?php _e('Save Settings','wassup'); ?>" />&nbsp;<input type="reset" name="reset" value="<?php _e('Reset','wassup'); ?>" /> - <input type="submit" name="reset-to-default" value="Reset to Default Settings" /></p><br />
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  </form>
 
4
  ?>
5
  <?php
6
  $to_date = wassup_get_time();
7
+ if ( isset($_POST['delete_manual'])) {
8
+ $from_date = @strtotime($_POST['delete_manual'], $to_date);
9
+ }
10
  if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name) {
11
  if ($_POST['delete_manual'] != "") {
12
  $wpdb->query("DELETE FROM $table_name WHERE timestamp<'$from_date'");
27
 
28
  $adminemail = get_bloginfo('admin_email');
29
 
30
+ if ($wassup_options->wassup_remind_flag == 2) {
31
  $alert_msg = '<p style="color:red;font-weight:bold;">'.__('ATTENTION! Your WassUp table have reached the maximum value you set, I disabled the alert, you can re-enable it here.','wassup').'</p>';
32
+ $wassup_options->wassup_remind_flag = 0;
33
+ $wassup_options->saveSettings();
34
  }
35
  $alertstyle = 'color:red; background-color:#ffd;';
36
  ?>
37
+ <?php //# moved to wassup.php add_wassup_css() function
38
+ //<script type="text/javascript">
39
+ //$(function() {
40
+ // $('#tab_container > ul').tabs({ fxFade: true, fxSpeed: 'fast' });
41
+ //});
42
+ //</script> ?>
 
43
  <style type="text/css">
44
+ h3 { margin-bottom:0px; padding-bottom:5px; color:#333; }
45
+ #fragment-1,#fragment-2,#fragment-3,#fragment-4 { background-color: #dee; }
46
+ #tab_container ul li { min-width:60px; display:inline; }
47
  form p { margin-top:0px; padding-top:0px; padding-left:15px; }
48
  </style>
49
  <h2><?php _e('Options','wassup'); ?></h2>
51
  <a href="/wp-admin/widgets.php"><?php _e('Wassup Widget in the Widgets menu option','wassup'); ?></a>.</p>
52
  <p style="padding:10px 0 10px 0;"><?php _e('Select the options you want for the WassUp plugin','wassup'); ?></p>
53
 
 
54
  <div id="tab_container">
55
+ <ul style="clear:both;">
56
+ <li><a href="#fragment-1"><span><?php _e("General Setup", "wassup") ?></span></a></li>
57
+ <li<?php if ($_GET['tab'] == "2" || isset($_POST['submit-options2'])) { echo ' class="ui-tabs-selected"';} ?>><a href="#fragment-2"><span><?php _e("Statistics Recording", "wassup") ?></span></a></li>
58
+ <li<?php if ($_GET['tab'] == "3" || isset($_POST['submit-options3'])) { echo ' class="ui-tabs-selected"';} ?>><a href="#fragment-3"><span><?php _e("Manage Files & Database", "wassup") ?></span></a></li>
59
+ <li<?php if ($_GET['tab'] == "4" || isset($_POST['submit-options4'])) { echo ' class="ui-tabs-selected"';} ?>><a href="#fragment-4"><span><?php _e("Uninstall", "wassup") ?></span></a></li>
60
  </ul>
61
 
62
+ <form action="" method="post">
63
+ <div id="fragment-1">
64
  <!-- //Added by Helene D. to use more browser width to display visitor detail... -->
65
  <br /><h3><?php _e('Your default screen resolution (browser width)','wassup'); ?></h3>
66
+ <p><strong><?php _e('Default screen resolution (in pixels)','wassup'); ?></strong>:
67
+ <select name='wassup_screen_res' style="width: 90px;">
68
+ <?php $wassup_options->showFormOptions("wassup_screen_res"); ?>
 
 
 
69
  </select>
70
  </p>
71
  <br /><h3><?php _e('Set minimum users level which can view and manage WassUp plugin (default Administrators)','wassup'); ?></h3>
72
  <p><select name="wassup_userlevel">
73
+ <?php $wassup_options->showFormOptions("wassup_userlevel"); ?>
 
 
 
74
  </select></p><br />
 
 
 
75
 
76
+ <br /><h3><?php _e('Visit Detail Settings','wassup'); ?></h3>
77
+ <p><strong><?php _e('Chart type - How many axes','wassup'); ?></strong>:
78
+ <select name='wassup_chart_type'>
79
+ <?php $wassup_options->showFormOptions("wassup_chart_type"); ?>
80
+ </select>
81
+ </p><br />
82
+ <p>
83
+ <strong><?php echo __('Set how many minutes wait for automatic page refresh','wassup').'</strong> ('.__('Current Visitors Online and Visitors Details','wassup').'):'; ?>
84
+ <input type="text" name="wassup_refresh" size="2" value="<?php print $wassup_options->wassup_refresh; ?>" /> <?php _e('refresh minutes (default 3)','wassup'); ?></p><br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
+ <p><strong><?php _e('Show visitor details for','wassup'); ?></strong>:
87
+ <select name='wassup_default_type'>
88
+ <?php $wassup_options->showFormOptions("wassup_default_type"); ?>
89
+ </select>
90
+ </p><br />
91
+ <p><strong><?php _e('Number of items per page','wassup'); ?></strong>:
92
+ <select name='wassup_default_limit'>
93
+ <?php $wassup_options->showFormOptions("wassup_default_limit"); ?>
94
+ </select>
95
+ </p>
96
+ <br /><br />
97
+ <p style="padding-left:0;padding-top:15px;"><input type="submit" name="submit-options" value="<?php _e('Save Settings','wassup'); ?>" />&nbsp;<input type="reset" name="reset" value="<?php _e('Reset','wassup'); ?>" /> - <input type="submit" name="reset-to-default" value="<?php _e("Reset to Default Settings", "wassup"); ?>" /></p><br />
98
+ </div>
99
+
100
+ <div id="fragment-2">
101
  <br /><h3><?php _e('Statistics Recording Settings','wassup'); ?></h3>
102
+ <p> <input type="checkbox" name="wassup_active" value="1" <?php if($wassup_options->wassup_active == 1) print "CHECKED"; ?> /> <strong><?php _e('Enable/Disable Recording','wassup'); ?></strong></p>
103
+ <p style="margin-top:5px;"> <strong> <?php _e("Checkbox to record statistics for each type of \"visitor\"", "wassup") ?></strong><br />
104
  <span style="padding-left:25px;padding-top:0;margin-top:0;display:block;clear:left;">
105
+ <input type="checkbox" name="wassup_loggedin" value="1" <?php if($wassup_options->wassup_loggedin == 1) print "CHECKED"; ?> /> <?php _e("Record logged in users", "wassup") ?><br />
106
+ <input type="checkbox" name="wassup_spider" value="1" <?php if($wassup_options->wassup_spider == 1) print "CHECKED"; ?> /> <?php _e("Record spiders and bots", "wassup") ?><br />
107
+ <input type="checkbox" name="wassup_attack" value="1" <?php if($wassup_options->wassup_attack == 1) print "CHECKED"; ?> /> <?php _e("Record attack/exploit attempts (libwww-perl agent)", "wassup") ?><br />
108
  </span>
109
  </p>
110
+ <br /><p><input type="checkbox" name="wassup_spamcheck" value="1" <?php if($wassup_options->wassup_spamcheck == 1 ) print "CHECKED"; ?> /> <strong><?php _e('Enable/Disable Spam Check on Records','wassup'); ?></strong></p>
111
  <p style="margin-top:5px;"> <strong> <?php _e('Checkbox to record statistics for each type of "spam"','wassup'); ?></strong><br />
112
  <span style="padding-left:25px;padding-top:0;margin-top:0;display:block;clear:left;">
113
+ <input type="checkbox" name="wassup_spam" value="1" <?php if($wassup_options->wassup_spam == 1) print "CHECKED"; ?> /> <?php _e('Record Akismet comment spam attempts','wassup'); ?> (check if an IP has previous comments as spam)<br />
114
+ <input type="checkbox" name="wassup_refspam" value="1" <?php if($wassup_options->wassup_refspam == 1) print "CHECKED"; ?> /> <?php _e('Record referrer spam attempts','wassup'); ?><br />
115
  </span>
116
  </p>
117
  <br /><p><strong><?php _e('Enter source IPs to exclude from recording','wassup'); ?></strong>:
118
  <br /><span style="padding-left:10px;display:block;clear:left;">
119
+ <textarea name="wassup_exclude" rows="4" cols="40"><?php print $wassup_options->wassup_exclude; ?></textarea></span><?php _e("comma separated value (ex: 127.0.0.1, 10.0.0.1, etc...)", "wassup") ?></p>
120
+ <br /><p><strong><?php _e('Enter requested URLs to exclude from recording','wassup'); ?></strong>:
121
+ <br /><span style="padding-left:10px;display:block;clear:left;">
122
+ <textarea name="wassup_exclude_url" rows="4" cols="40"><?php print $wassup_options->wassup_exclude_url; ?></textarea></span><?php _e("comma separated value, don't put the entire url, only the last path or some word to exclude (ex: /category/wordpress, 2007, etc...)", "wassup") ?></p>
123
+ <br /><br />
124
+ <p style="padding-left:0;padding-top:15px;"><input type="submit" name="submit-options2" value="<?php _e('Save Settings','wassup'); ?>" />&nbsp;<input type="reset" name="reset" value="<?php _e('Reset','wassup'); ?>" /> - <input type="submit" name="reset-to-default" value="<?php _e("Reset to Default Settings", "wassup"); ?>" /></p><br />
125
+ </div>
126
+
127
+ <div id="fragment-3"><br />
128
+ <h3><?php _e('Temporary files location folder','wassup'); ?></h3>
129
+ <?php
130
+ echo '<p><strong>'.__('"Save path" directory for storing temporary files used to track visitor activity','wassup').'</strong>:</p>';
131
+ $sessionpath = $wassup_options->getSavepath();
132
  //$sessionpath = "/fakefolder/temp"; //#debug
133
  $sessionstyle = '';
134
  //# check that session_save_path exists and is writable...
135
+ if ($wassup_options->isWritableFolder($sessionpath) == false) {
136
+ $sessionwarn = '<small style="'.$alertstyle.' font-weight:bold; padding-left:5px;"><span style="text-decoration:blink;">'.__('WARNING','wassup').'!</span> '.__('Directory does not exist or is not writable. Please enter a different path above or change "session.save_path" in "php.ini" to point to a valid, writable folder','wassup').'.</small>';
137
  $sessionstyle = $alertstyle;
138
  } else {
139
+ $sessionwarn ='<small style="padding-left:5px;">'.__('Note: To adjust, change the above path or edit "sessions.save_path" in','wassup').' "php.ini".</small>';
 
 
 
 
 
 
 
 
 
140
  }
141
  echo '<textarea name="wassup_savepath" rows="1" style="width:550px;padding-left:25px;clear:left; '.$sessionstyle.'">'.$sessionpath.'</textarea>'."\n";
142
  echo '<br />&nbsp;&nbsp;'.__('Use absolute directory paths only. This value is usually','wassup').' "/tmp".'."\n";
143
  echo '<br />'.$sessionwarn."\n";
144
  ?>
145
+ </p> <br />
 
 
 
 
146
  <br /><h3><?php _e('Select actions for table growth','wassup'); ?></h3>
147
+ <p><?php _e("WassUp table grows very fast (especially if your blog is frequently visited), I recommend you to delete old records sometimes. You can select any option below to reset it, delete old records automatically or manually. (If you haven't database space problems you can leave the table as is)","wassup"); ?><p>
148
  <p><?php _e('Current WassUp table usage is','wassup');
149
  print ': <strong>';
150
+ if ( (int)$tusage >= (int)$wassup_options->wassup_remind_mb) {
151
  print '<span style="'.$alertstyle.'">'.$tusage.'</span>';
152
  } else { print $tusage; }
153
  print ' Mb</strong> ('.$data_rows.' '.__('records','wassup').')</p>'."\n";
154
  print $alert_msg; ?>
155
+ <br /><p><input type="checkbox" name="wassup_remind_flag" value="1" <?php if ($wassup_options->wassup_remind_flag == 1) print "CHECKED"; ?>>
156
+ <strong><?php _e('Alert me','wassup'); ?></strong> (<?php _e('email to','wassup'); ?>: <strong><?php print $adminemail; ?></strong>) <?php _e('when table reaches','wassup'); ?> <input type="text" name="wassup_remind_mb" size="3" value="<?php print $wassup_options->wassup_remind_mb; ?>"> Mb</p>
157
  <p><input type="checkbox" name="wassup_empty" value="1">
158
  <strong><?php _e('Empty table','wassup'); ?></strong> (<a href="?<?php print $_SERVER['QUERY_STRING']; ?>&export=1"><?php _e('export table in SQL format','wassup'); ?></a>)</p>
159
+ <br /><p><strong><?php _e("Automatically delete records older than:", "wassup") ?></strong>
160
  <select name="delete_auto">
161
+ <?php $wassup_options->showFormOptions("delete_auto"); ?>
 
 
 
 
 
 
162
  </select></p>
163
+ <br /><p><?php _e("Delete NOW records older than:", "wassup") ?>
164
  <select name="delete_manual">
165
+ <option value="never"><?php _e("Action is NOT undoable", "wassup") ?> &nbsp;</option>
166
+ <option value="-1 day"><?php _e("24 hours", "wassup") ?></option>
167
+ <option value="-1 week"><?php _e("1 week", "wassup") ?></option>
168
+ <option value="-1 month"><?php _e("1 month", "wassup") ?></option>
169
+ <option value="-3 months"><?php _e("3 months", "wassup") ?></option>
170
+ <option value="-6 months"><?php _e("6 months", "wassup") ?></option>
171
+ <option value="-1 year"><?php _e("1 year", "wassup") ?></option>
172
  </select></p>
173
+ <br /><br />
174
+ <p style="padding-left:0;padding-top:15px;"><input type="submit" name="submit-options3" value="<?php _e('Save Settings','wassup'); ?>" />&nbsp;<input type="reset" name="reset" value="<?php _e('Reset','wassup'); ?>" /> - <input type="submit" name="reset-to-default" value="<?php _e("Reset to Default Settings", "wassup"); ?>" /></p><br />
175
+ </div>
176
+
177
+ <div id="fragment-4"><br />
178
+ <h3><?php _e('Want to uninstall WassUp?', 'wassup') ;?></h3>
179
+ <p><?php _e('No problem. Before you deactivate this plugin, check the box below to cleanup any data that was collected by WassUp that could be left behind.', 'wassup') ;?></p><br />
180
+ <p><input type="checkbox" name="wassup_uninstall" value="1" <?php if ($wassup_options->wassup_uninstall == 1 ) print "CHECKED"; ?> /> <strong><?php _e('Permanently remove WassUp data and settings from Wordpress','wassup'); ?></strong></p>
181
+ <?php if ($wassup_options->wassup_uninstall == 1) { ?>
182
+ <small style="<?php echo $alertstyle.'font-weight:bold; margin-left:20px;'; ?>"><span style="text-decoration:blink;padding-left:5px;"><?php _e("WARNING","wassup"); ?>! </span><?php _e("All WassUp data and settings will be deleted upon deactivation of this plugin","wassup"); ?>.</small><br />
183
+ <?php } ?>
184
+ <br /><p><?php _e("This action cannot be undone. Before uninstalling WassUp, you should backup your Wordpress database first. WassUp data is stored in the table", "wassup"); ?> <strong>wp_wassup</strong>.</p>
185
+
186
+ <br /><p><?php _e("To help improve this plugin, we would appreciate your feedback at","wassup"); ?> <a href="http://www.wpwp.org">www.wpwp.org</a>.</p>
187
+ <br /><br />
188
+ <p style="padding-left:0;padding-top:15px;"><input type="submit" name="submit-options4" value="<?php _e('Save Settings','wassup'); ?>" />&nbsp;<input type="reset" name="reset" value="<?php _e('Reset','wassup'); ?>" /> - <input type="submit" name="reset-to-default" value="<?php _e("Reset to Default Settings", "wassup"); ?>" /></p><br />
189
+ </div>
190
  </form>
191
+ </div>
lib/spy.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
- if (!defined('WASSUPFOLDER')) {
3
- define('WASSUPFOLDER', dirname(__FILE__), TRUE);
4
- }
5
- if (!defined('ABSPATH')) {
6
- define ('ABSPATH', substr(WASSUPFOLDER,0,strpos(WASSUPFOLDER,'/wp-content/')+1));
7
- }
8
- include_once(ABSPATH. 'wp-blog-header.php');
9
- if (!function_exists('get_bloginfo')) {
10
- include_once(ABSPATH.'wp-config.php');
11
- }
12
- include_once(WASSUPFOLDER. '/main.php');
13
- $table_name = $wpdb->prefix . "wassup";
14
-
15
- if ( $_GET['hash'] != wp_hash('wassup')) {
16
- echo "Nothing to do here";
17
- } else {
18
-
19
- //Retrieve command-line arguments...
20
- if (isset($_GET['to_date'])) $to_date = urlencode(attribute_escape($_GET['to_date']));
21
- else $to_date = wassup_get_time();
22
- if (isset($_GET['from_date'])) $from_date = urlencode(attribute_escape($_GET['from_date']));
23
- else $from_date = ($to_date - 3);
24
- if (isset($_GET['rows'])) $rows = urlencode(attribute_escape($_GET['rows']));
25
- else $rows = 999;
26
- //echo 'Starting spy from directory '.WASSUPFOLDER.' ABSPATH='.ABSPATH.'...<br />'; //debug...
27
- spyview($from_date,$to_date,$rows);
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/wassup.class.php ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* #######
3
+ * ## wassupOptions - A PHP Class for Wassup plugin option settings.
4
+ * ## Contains variables and functions used to set or change wassup
5
+ * ## settings in Wordpress' wp_options table and to output those
6
+ * ## values for use in forms.
7
+ * ## Author: Helene D. 2/24/08
8
+ */
9
+ class wassupOptions {
10
+ /* general/detail settings */
11
+ var $wassup_refresh = "3";
12
+ var $wassup_userlevel = "8";
13
+ var $wassup_screen_res = "800";
14
+ var $wassup_default_type = "";
15
+ var $wassup_default_limit = "10";
16
+
17
+ /* recording settings */
18
+ var $wassup_active = "1";
19
+ var $wassup_loggedin = "1";
20
+ var $wassup_spider = "1";
21
+ var $wassup_attack = "1";
22
+ var $wassup_exclude;
23
+ var $wassup_exclude_url;
24
+
25
+ /* spam settings */
26
+ var $wassup_spamcheck;
27
+ var $wassup_spam;
28
+ var $wassup_refspam;
29
+
30
+ /* table/file management settings */
31
+ var $wassup_savepath;
32
+ var $delete_auto;
33
+ var $delete_auto_size;
34
+ var $wassup_remind_mb;
35
+ var $wassup_remind_flag;
36
+ var $wassup_uninstall; //new - for complete uninstall of wassup
37
+
38
+ /* chart display settings */
39
+ var $wassup_chart;
40
+ var $wassup_chart_type;
41
+
42
+ /* widget settings */
43
+ var $wassup_widget_title;
44
+ var $wassup_widget_ulclass;
45
+ var $wassup_widget_loggedin;
46
+ var $wassup_widget_comauth;
47
+ var $wassup_widget_search;
48
+ var $wassup_widget_searchlimit;
49
+ var $wassup_widget_ref;
50
+ var $wassup_widget_reflimit;
51
+ var $wassup_widget_topbr;
52
+ var $wassup_widget_topbrlimit;
53
+ var $wassup_widget_topos;
54
+ var $wassup_widget_toposlimit;
55
+ var $wassup_widget_chars;
56
+
57
+ /* temporary action settings */
58
+ var $wassup_alert_message; //new - used to display alerts
59
+ var $wmark;
60
+ var $wip;
61
+
62
+ /* Constructor */
63
+ function wassupoptions() {
64
+ //# initialize class variables with current options
65
+ //# or with defaults if none
66
+ $this->loadSettings();
67
+ }
68
+
69
+ /* Methods */
70
+ function loadDefaults() {
71
+ $this->wassup_active = "1";
72
+ $this->wassup_loggedin = "1";
73
+ $this->wassup_spider = "1";
74
+ $this->wassup_attack = "1";
75
+ $this->wassup_spamcheck = "1";
76
+ $this->wassup_spam = "1";
77
+ $this->wassup_refspam = "1";
78
+ $this->wassup_exclude = "";
79
+ $this->wassup_exclude_url = "";
80
+ $this->wassup_savepath = null;
81
+ $this->wassup_chart = "1";
82
+ $this->wassup_chart_type = "2";
83
+ $this->delete_auto = "never";
84
+ $this->delete_auto_size = "0";
85
+ $this->wassup_remind_mb = "0";
86
+ $this->wassup_remind_flag = "0";
87
+ $this->wassup_refresh = "3";
88
+ $this->wassup_userlevel = "8";
89
+ $this->wassup_screen_res = "800";
90
+ $this->wassup_default_type = "everything";
91
+ $this->wassup_default_limit = "10";
92
+ $this->wassup_widget_title = "Visitors Online";
93
+ $this->wassup_widget_ulclass = "links";
94
+ $this->wassup_widget_loggedin = "1";
95
+ $this->wassup_widget_comauth = "1";
96
+ $this->wassup_widget_search = "1";
97
+ $this->wassup_widget_searchlimit = "5";
98
+ $this->wassup_widget_ref = "1";
99
+ $this->wassup_widget_reflimit = "5";
100
+ $this->wassup_widget_topbr = "1";
101
+ $this->wassup_widget_topbrlimit = "5";
102
+ $this->wassup_widget_topos = "1";
103
+ $this->wassup_widget_toposlimit = "5";
104
+ $this->wassup_widget_chars = "18";
105
+ $this->wassup_alert_message = "";
106
+ $this->wassup_uninstall = "0";
107
+ }
108
+
109
+ //#Load class variables with current options or with defaults
110
+ function loadSettings() {
111
+ //# load class variables with current options or load
112
+ //# default settings if no options set.
113
+ $options_array = get_option('wassup_settings');
114
+ if (empty($options_array)) {
115
+ $this->loadDefaults();
116
+ } else {
117
+ foreach ($options_array as $optionkey => $optionvalue) {
118
+ //if (isset($this->$optionkey)) { //returns false for null values
119
+ if (array_key_exists($optionkey,$this)) {
120
+ $this->$optionkey = $optionvalue;
121
+ }
122
+ }
123
+ }
124
+ return true;
125
+ }
126
+
127
+ //#Save class variables to the Wordpress options table
128
+ function saveSettings() {
129
+ //# convert class variables into an array and save using
130
+ //# Wordpress functions, "update_option" or "add_option"
131
+ //#convert class into array...
132
+ $settings_array = array();
133
+ foreach (array_keys(get_class_vars(get_class($this))) as $k) {
134
+ $settings_array[$k] = $this->$k;
135
+ }
136
+ //#save array to options table...
137
+ $options_check = get_option('wassup_settings');
138
+ if (empty($options_check)) {
139
+ add_option('wassup_settings', $settings_array, 'Options for WassUp');
140
+ } else {
141
+ update_option('wassup_settings', $settings_array);
142
+ }
143
+ return true;
144
+ }
145
+
146
+ function deleteSettings() {
147
+ //#delete the contents of the options table...
148
+ delete_option('wassup_settings');
149
+ }
150
+
151
+ //#Return an array containing all possible values of the given
152
+ //# class variable, $key. For use in form validation, etc.
153
+ function getItemOptions($key="",$meta="") {
154
+ $item_options = array();
155
+ $item_options_meta = array();
156
+ if ($key == "wassup_screen_res") {
157
+ $item_options = array("640","800","1024","1200");
158
+ $item_options_meta = array("&nbsp;640",
159
+ "&nbsp;800",
160
+ "1024",
161
+ "1200");
162
+ } elseif ($key == "wassup_userlevel") {
163
+ $item_options = array("","8","6","2");
164
+ $item_options_meta = array("--",
165
+ __("Administrators","wassup"),
166
+ __("Contributors","wassup"),
167
+ __("Authors","wassup"));
168
+ } elseif ($key == "wassup_chart_type") {
169
+ $item_options = array("1","2");
170
+ $item_options_meta = array(
171
+ __("One - two lines chart one axis","wassup"),
172
+ __("Two - two lines chart two axes","wassup"));
173
+ } elseif ($key == "wassup_default_type") {
174
+ $item_options = array("everything","spiders","nospider","spam","nospam","nospamspider","comauthor","searchengine","referrer");
175
+ $item_options_meta = array(
176
+ __("Everything","wassup"),
177
+ __("Spiders","wassup"),
178
+ __("No spider","wassup"),
179
+ __("Spam","wassup"),
180
+ __("No Spam","wassup"),
181
+ __("No Spam, No Spider","wassup"),
182
+ __("Comment authors","wassup"),
183
+ __("Referer from search engine","wassup"),
184
+ __("Referer from ext link","wassup"));
185
+ } elseif ($key == "wassup_default_limit") {
186
+ $item_options = array("10","20","50","100");
187
+ $item_options_meta = array("&nbsp;10",
188
+ "&nbsp;20",
189
+ "&nbsp;50",
190
+ "100");
191
+ } elseif ($key == "delete_auto") {
192
+ $item_options = array("never","-1 day","-1 week","-1 month","-3 months","-6 months","-1 year");
193
+ $item_options_meta = array(
194
+ __("Don't delete anything","wassup"),
195
+ __("24 hours","wassup"),
196
+ __("1 week","wassup"),
197
+ __("1 month","wassup"),
198
+ __("3 months","wassup"),
199
+ __("6 months","wassup"),
200
+ __("1 year","wassup"));
201
+ } elseif (!empty($key)) { //enable/disable is default
202
+ $item_options = array("1","0");
203
+ $item_options_meta = array("Enable","Disable");
204
+ }
205
+ if ($meta == "meta") {
206
+ return $item_options_meta;
207
+ } else {
208
+ return $item_options;
209
+ }
210
+ } //end getItemValues
211
+
212
+ //#generates <options> tags for the given class variable, $itemkey
213
+ //# for use in a <select> form.
214
+ function showFormOptions ($itemkey="") {
215
+ $form_items =$this->getItemOptions($itemkey);
216
+ $form_items_meta = $this->getItemOptions($itemkey,"meta");
217
+ if (count($form_items) > 1) {
218
+ $i = 0;
219
+ foreach ($form_items as $k => $option_item) {
220
+ echo "\n\t\t".'<option value="'.$option_item.'"';
221
+ if ($this->$itemkey == $option_item) { echo ' SELECTED>'; }
222
+ else { echo '>'; }
223
+ echo $form_items_meta[$k].'&nbsp;&nbsp;</option>';
224
+ }
225
+ }
226
+ } //end showFormOptions
227
+
228
+ //#Return current PHP session.save_path value (pathname portion)
229
+ function getSessionpath() {
230
+ $sessionpath = session_save_path();
231
+ if (strpos($sessionpath, ";") !== FALSE) {
232
+ $sessionpath = substr($sessionpath, strpos($sessionpath, ";")+1);
233
+ }
234
+ return rtrim($sessionpath,"/");
235
+ }
236
+
237
+ //#Return the value of class variable, wassup_savepath, if not null
238
+ //# or return PHP session.save_path (pathname portion)
239
+ function getSavepath() {
240
+ if (empty($this->wassup_savepath)) {
241
+ return $this->getSessionpath();
242
+ } else {
243
+ return $this->wassup_savepath;
244
+ }
245
+ }
246
+
247
+ //#Sets the class variable, wassup_savepath, with the given
248
+ //# value $savepath
249
+ function setSavepath($savepath="") {
250
+ $savepath = rtrim($savepath,"/");
251
+ if (empty($savepath) || $savepath == $this->getSessionpath()) {
252
+ $this->wassup_savepath = NULL;
253
+ } else {
254
+ $this->wassup_savepath = $savepath;
255
+ }
256
+ }
257
+
258
+ //#Return true if the given directory path exists and is writable
259
+ function isWritableFolder($folderpath="") {
260
+ $folderpath=trim($folderpath); //remove white spaces
261
+ if (!empty($folderpath) && file_exists($folderpath)) {
262
+ $testfile = rtrim($folderpath,"/")."/temp".time().'.txt';
263
+ //#check that the directory is writable...
264
+ if (@touch($testfile)) { unlink($testfile); }
265
+ else { return false; }
266
+ } else {
267
+ return false;
268
+ }
269
+ return true;
270
+ }
271
+
272
+ //#show a system message in Wassup Admin menus
273
+ function showMessage($message="") {
274
+ if (empty($message) && !empty($this->wassup_alert_message)) {
275
+ $message = $this->wassup_alert_message;
276
+ }
277
+ //#check for error message/notice message
278
+ if (stristr($message,"error") !== FALSE || stristr($message,"problem") !== FALSE) {
279
+ echo '<div class="fade error" id="wassup-error"><p style="color:#d00;padding-left:5px;">'.$message;
280
+ //print_r($this); // #debug
281
+ echo '</p></div>'."\n";
282
+ } else {
283
+ echo '<div class="fade updated" id="wassup-message"><p style="color:#040;padding-left:5px;">'.$message;
284
+ //print_r($this); // #debug
285
+ echo '</p></div>'."\n";
286
+ }
287
+ } //end showMessage
288
+
289
+ function showError($message="") {
290
+ $this->showMessage($message);
291
+ }
292
+ } //end class wassupOptions
293
+
294
+ ?>
readme.txt CHANGED
@@ -1,17 +1,15 @@
1
  === Plugin Name ===
2
  Contributors: michelem, helened
3
- Donate link: http://www.michelem.org/
4
  Tags: tracker, tracking, statistics, analyze, web, realtime, stats, ajax, visitors, visits, online users, details, seo, admin, spy, visitors, widgets, widget, sidebar
5
- Requires at least: 2.3
6
- Tested up to: 2.3.2 - 2.3.1 - 2.3
7
- Stable tag: 1.4.5
8
 
9
  Wordpress plugin to analyze your visitors traffic with real time stats, chart and a lot of chronological informations. It has sidebar Widget support to show current online visitors and other statistics.
10
 
11
  == Description ==
12
 
13
- WORPDRESS 2.2 USERS NOW YOU COULD INSTALL WASSUP USING THE 1.4.5-wp2.2 BRANCH: http://www.wpwp.org/download
14
-
15
  WassUp is a new Wordpress plugin to track your visitors in real time. It has a very readable and fancy admin console to keep tracks of your blog's users visits.
16
  It has a "current visitors online" view and a more detailed "visitors details" view where you can know almost everything your users are doing on your blog, it's very useful for SEO or statistics maniacs. Now it comes with a new "Spy" view in Ajax like the Digg Spy.
17
  The aim of WassUp is the knowledge of what your visitors do when they surf your blog, it is not intended to show grouped statistics for periods like visitors per day, pageviews per months and so on (there are many others tools to better gain that, like Google Analytics). With WassUp you'll get a cronology of your blog's visits with a lot of details for each single user session.
@@ -86,11 +84,14 @@ Installation:
86
 
87
  Upgrading:
88
 
89
- If you upgrade from a previous version is recommended to disable plugin before you overwrite the directory and then re-activate the plugin. (It's not needed but it should be better)
 
 
 
90
 
91
  Usage:
92
 
93
- When you activate the plugin, it works "as is". You don't have anything to do. Wait your visitors hit your blog and start seeing details (click the dashboard and go to WassUp page)
94
 
95
  Usage of wassup_sidebar function:
96
 
1
  === Plugin Name ===
2
  Contributors: michelem, helened
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=michele%40befree%2eit&item_name=wp%2dstatpress&no_shipping=0&no_note=1&tax=0&currency_code=EUR&lc=IT&bn=PP%2dDonationsBF&charset=UTF%2d8
4
  Tags: tracker, tracking, statistics, analyze, web, realtime, stats, ajax, visitors, visits, online users, details, seo, admin, spy, visitors, widgets, widget, sidebar
5
+ Requires at least: 2.2
6
+ Tested up to: 2.3.2 - 2.3.1 - 2.3 - 2.2
7
+ Stable tag: 1.4.8
8
 
9
  Wordpress plugin to analyze your visitors traffic with real time stats, chart and a lot of chronological informations. It has sidebar Widget support to show current online visitors and other statistics.
10
 
11
  == Description ==
12
 
 
 
13
  WassUp is a new Wordpress plugin to track your visitors in real time. It has a very readable and fancy admin console to keep tracks of your blog's users visits.
14
  It has a "current visitors online" view and a more detailed "visitors details" view where you can know almost everything your users are doing on your blog, it's very useful for SEO or statistics maniacs. Now it comes with a new "Spy" view in Ajax like the Digg Spy.
15
  The aim of WassUp is the knowledge of what your visitors do when they surf your blog, it is not intended to show grouped statistics for periods like visitors per day, pageviews per months and so on (there are many others tools to better gain that, like Google Analytics). With WassUp you'll get a cronology of your blog's visits with a lot of details for each single user session.
84
 
85
  Upgrading:
86
 
87
+ - Disable the WassUp plugin
88
+ - Delete totally the directory "wassup" in your plugins dir
89
+ - Download and unzip the new WassUp file into the plugins dir
90
+ - Enable the WassUp plugin
91
 
92
  Usage:
93
 
94
+ When you activate (as described in "Installation") the plugin, it works "as is". You don't have anything to do. Wait your visitors hit your blog and start seeing details (click the dashboard and go to WassUp page)
95
 
96
  Usage of wassup_sidebar function:
97
 
wassup.css CHANGED
@@ -37,7 +37,9 @@
37
  border: 1px solid #EEE;
38
  color: #DDD;
39
  }
40
-
 
 
41
  .sum {
42
  position: relative;
43
  clear: left;
37
  border: 1px solid #EEE;
38
  color: #DDD;
39
  }
40
+ .legend {
41
+ font-size: 11px;
42
+ }
43
  .sum {
44
  position: relative;
45
  clear: left;
wassup.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WassUp
4
  Plugin URI: http://www.wpwp.org
5
  Description: Wordpress plugin to analyze your visitors traffic with real time stats, chart and a lot of chronological informations. It has sidebar Widget support to show current online visitors and other statistics.
6
- Version: 1.4.5
7
  Author: Michele Marcucci
8
  Author URI: http://www.michelem.org/
9
 
@@ -16,8 +16,9 @@ http://www.gnu.org/licenses/gpl.txt
16
  if (preg_match('#'.basename(__FILE__) .'#', $_SERVER['PHP_SELF'])) {
17
  die('Permission Denied! You are not allowed to call this page directly.');
18
  }
19
- $version = "1.4.5";
20
  define('WASSUPFOLDER', dirname(plugin_basename(__FILE__)), TRUE);
 
21
  require_once(dirname(__FILE__).'/lib/main.php');
22
  $wpurl = get_bloginfo('wpurl');
23
 
@@ -25,110 +26,117 @@ if (isset($_GET['export'])) {
25
  export_wassup();
26
  }
27
 
28
- function wassup_activation_error() {
29
- echo '<p><strong>' . __("Sorry, Wassup requires WordPress 2.3 or higher to work.","wassup") . '</strong></p>';
30
- }
31
-
32
  global $wp_version;
33
- //#This works only in WP2.3 or higher
34
- if (version_compare($wp_version, '2.3', '<')) {
35
- add_action('admin_notices', wassup_activation_error());
36
- exit(1);
 
 
 
 
 
 
 
 
 
 
37
  } else {
38
- register_activation_hook( __FILE__, 'wassup_install' );
 
39
  add_action('admin_head', 'add_wassup_css');
40
- add_action('init', 'add_wassup_scripts');
41
  add_action('wp_head', 'add_wassup_meta_info');
 
42
  add_action("widgets_init", "wassup_widget_init");
43
  add_action('admin_menu', 'wassup_add_pages');
44
  add_action('send_headers', 'wassupAppend');
45
  }
46
 
47
- //#initial wassup settings for options this is here because
48
- //I need it in more then one function (using global)
49
- $defaultWdata = array(
50
- 'wassup_active' => "1",
51
- 'wassup_loggedin' => "1",
52
- 'wassup_spider' => "1",
53
- 'wassup_attack' => "1",
54
- 'wassup_spamcheck' => "1",
55
- 'wassup_spam' => "1",
56
- 'wassup_refspam' => "1",
57
- 'wassup_exclude' => "",
58
- 'wassup_savepath' => null,
59
- 'wassup_chart' => "1",
60
- 'delete_auto' => "never",
61
- 'delete_auto_size' => "0",
62
- 'wassup_remind_mb' => "0",
63
- 'wassup_remind_flag' => "0",
64
- 'wassup_refresh' => "3",
65
- 'wassup_userlevel' => "8",
66
- 'wassup_screen_res' => "800",
67
- 'wassup_default_type' => "everything",
68
- 'wassup_default_limit' => "10",
69
- 'wassup_widget_title' => "Visitors Online",
70
- 'wassup_widget_ulclass' => "links",
71
- 'wassup_widget_loggedin' => "1",
72
- 'wassup_widget_comauth' => "1",
73
- 'wassup_widget_search' => "1",
74
- 'wassup_widget_searchlimit' => "5",
75
- 'wassup_widget_ref' => "1",
76
- 'wassup_widget_reflimit' => "5",
77
- 'wassup_widget_topbr' => "1",
78
- 'wassup_widget_topbrlimit' => "5",
79
- 'wassup_widget_topos' => "1",
80
- 'wassup_widget_toposlimit' => "5",
81
- 'wassup_widget_chars' => "18"
82
- );
83
-
84
- //#add initial options and create table when Wassup activated
85
  function wassup_install() {
86
- global $wpdb, $defaultWdata;
87
- //### add/update wassup settings to Wordpress options table
88
- $wassup_settings = get_option('wassup_settings');
89
- if (empty($wassup_settings)) {
90
- //# initialize wassup settings to default values
91
- add_option('wassup_settings', $defaultWdata, 'Options for WassUp');
92
- } else {
93
- //# update wassup settings for 'spamcheck', 'refspam', and 'spam'
94
- if (!isset($wassup_settings['wassup_spamcheck'])) {
95
- $wassup_settings['wassup_spamcheck'] = "1";
96
- //#set wassup_spamcheck=0 if wassup_refspam=0 and wassup_spam=0
97
- if (!isset($wassup_settings['wassup_spam']) && !isset($wassup_settings['wassup_refspam'])) {
98
- $wassup_settings['wassup_spam'] = "1";
99
- $wassup_settings['wassup_refspam'] = "1";
100
- } elseif ( $wassup_settings['wassup_spam'] == "0" && $wassup_settings['wassup_refspam'] == "0" ) {
101
- $wassup_settings['wassup_spamcheck'] = "0";
102
- }
103
- }
104
  //# update wassup settings for 'savepath' (default is null)
105
- if (!isset($wassup_settings['wassup_savepath'])) {
106
- $wassup_settings['wassup_savepath'] = null;
107
- //$wassup_settings['wassup_savepath'] = "/tmp"; #debug
108
  }
109
- //#save wassup settings changes
110
- update_option('wassup_settings', $wassup_settings);
111
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
- //### create/upgrade wassup table
114
- $table_name = $wpdb->prefix . "wassup";
115
- if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
116
- CreateTable();
117
- } else {
118
- UpdateTable();
119
- }
120
  } //#end function wassup_install
121
 
122
- $wassup_settings = get_option('wassup_settings');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
 
124
  function add_wassup_meta_info() {
125
  global $version;
126
  print '<meta name="wassup-version" content="'.$version.'" />';
127
  }
128
 
129
- //Add jquery AJAX library and dependent scripts for all Wassup admin menus...
130
- function add_wassup_scripts() {
 
131
  global $wpurl;
 
 
132
  if (stristr($_GET['page'],'wassup') !== FALSE) {
133
  if ( function_exists('wp_deregister_script')) {
134
  wp_deregister_script('jquery'); //removes old jquery vers.
@@ -145,23 +153,29 @@ function add_wassup_scripts() {
145
  wp_enqueue_script('thickbox', $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/thickbox/thickbox.js', array('jquery'), '3');
146
  }
147
  }
 
 
 
 
 
 
 
 
 
148
  }
149
 
150
  //Add the wassup stylesheet and other javascripts...
151
  function add_wassup_css() {
152
- global $wpurl;
153
- $hash = wp_hash('wassup');
154
  $plugin_page = attribute_escape($_GET['page']);
 
155
  if (stristr($plugin_page,'wassup') !== FALSE) { $plugin_page="wassup"; }
156
  //Add css and javascript to wassup menu pages only...
157
  if ($plugin_page == "wassup") {
158
- $wassup_settings = get_option('wassup_settings');
159
- //$siteurl = get_bloginfo('siteurl'); //not used
160
- //$wpurl = get_bloginfo('wpurl'); //global
161
-
162
- echo '<link rel="stylesheet" href="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/wassup.css'.'" type="text/css" />';
163
- echo '<link rel="stylesheet" href="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/thickbox/thickbox.css'.'" type="text/css" />';
164
- echo '<link rel="stylesheet" href="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/ui.tabs.css'.'" type="text/css" />';
165
 
166
  if ($_GET['page'] != "wassup-options" AND $_GET['page'] != "wassup-spy") { ?>
167
  <script type='text/javascript'>
@@ -169,7 +183,7 @@ if ($_GET['page'] != "wassup-options" AND $_GET['page'] != "wassup-spy") { ?>
169
  function selfRefresh(){
170
  location.href='?<?php print $_SERVER['QUERY_STRING']; ?>';
171
  }
172
- setTimeout('selfRefresh()', <?php print ($wassup_settings['wassup_refresh'] * 60000); ?>);
173
  //]]>
174
  </script>
175
 
@@ -205,7 +219,7 @@ if ($_GET['page'] != "wassup-options" AND $_GET['page'] != "wassup-spy") { ?>
205
  //<![CDATA[
206
  window.onload=WindowLoad;
207
  function WindowLoad(event) {
208
- ActivateCountDown("CountDownPanel", <?php print ($wassup_settings['wassup_refresh'] * 60); ?>);
209
  }
210
  //]]>
211
  </script>
@@ -226,7 +240,7 @@ if ($_GET['page'] != "wassup-options" AND $_GET['page'] != "wassup-spy") { ?>
226
  $("a.deleteID").click(function(){
227
  var id = $(this).attr('id');
228
  $.ajax({
229
- url: "<?php echo $wpurl; ?>/wp-content/plugins/<?php echo WASSUPFOLDER; ?>/lib/action.php?action=delete&hash=<?php echo $hash; ?>&id=" + id,
230
  async: false
231
  })
232
  $("div.delID" + id).fadeOut("slow");
@@ -234,35 +248,35 @@ if ($_GET['page'] != "wassup-options" AND $_GET['page'] != "wassup-spy") { ?>
234
  });
235
  $("a.show-search").toggle(function(){
236
  $("div.search-ip").slideDown("slow");
237
- $("a.show-search").html("<a href='#' class='show-search'>Hide Search</a>");
238
  },function() {
239
  $("div.search-ip").slideUp("slow");
240
- $("a.show-search").html("<a href='#' class='show-search'>Search</a>");
241
  return false;
242
  });
243
  $("a.show-topten").toggle(function(){
244
  $("div.topten").slideDown("slow");
245
- $("a.show-topten").html("<a href='#' class='show-topten'>Hide TopTen</a>");
246
  },function() {
247
  $("div.topten").slideUp("slow");
248
- $("a.show-topten").html("<a href='#' class='show-topten'>Show TopTen</a>");
249
  return false;
250
  });
251
 
252
  $("a.toggle-all").toggle(function() {
253
  $("div.togglenavi").slideDown("slow");
254
- $("a.toggle-all").html("<a href='#' class='toggle-all'>Collapse All</a>");
255
  },function() {
256
  $("div.togglenavi").slideUp("slow");
257
- $("a.toggle-all").html("<a href='#' class='toggle-all'>Expand All</a>");
258
  return false;
259
  });
260
  $("a.toggle-allcrono").toggle(function() {
261
  $("div.togglecrono").slideUp("slow");
262
- $("a.toggle-allcrono").html("<a href='#' class='toggle-allcrono'>Expand Cronology</a>");
263
  },function() {
264
  $("div.togglecrono").slideDown("slow");
265
- $("a.toggle-allcrono").html("<a href='#' class='toggle-allcrono'>Collapse Cronology</a>");
266
  return false;
267
  });
268
  }); //end jQuery(document).ready
@@ -288,15 +302,31 @@ if ($_GET['page'] != "wassup-options" AND $_GET['page'] != "wassup-spy") { ?>
288
  </script>
289
 
290
  <?php
291
- if ($_GET['page'] == "wassup-spy") {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  ?>
293
  <script type="text/javascript">
 
294
  jQuery(document).ready(function($){
295
  $('#spyContainer > div:gt(4)').fadeEachDown(); // initial fade
296
  $('#spyContainer').spy({
297
  limit: 10,
298
  fadeLast: 5,
299
- ajax: '<?php echo $wpurl."/wp-content/plugins/".WASSUPFOLDER."/lib/action.php?action=spy&hash=$hash"; ?>',
300
  timeout: 2000,
301
  'timestamp': myTimestamp,
302
  fadeInSpeed: 1100 });
@@ -325,8 +355,8 @@ if ($_GET['page'] == "wassup-spy") {
325
 
326
  //put WassUp in the top-level admin menu and add submenus....
327
  function wassup_add_pages() {
328
- $wassup_settings = get_option('wassup_settings');
329
- $userlevel = $wassup_settings['wassup_userlevel'];
330
  if (empty($userlevel)) { $userlevel = 8; }
331
  // add the default submenu first (important!)...
332
  add_submenu_page(WASSUPFOLDER, __('Visitor Details', 'wassup'), __('Visitor Details', 'wassup'), $userlevel, WASSUPFOLDER, 'WassUp'); //<-- WASSUPFOLDER needed here for directory names that include a version number...
@@ -338,55 +368,75 @@ function wassup_add_pages() {
338
  }
339
 
340
  function WassUp() {
341
- global $wpdb, $version, $wpurl, $defaultWdata;
342
- $hash = wp_hash('wassup');
343
- $table_name = $wpdb->prefix . "wassup";
344
- $wassup_settings = get_option('wassup_settings');
 
 
 
 
 
 
345
  // RUN THE SAVE/RESET OPTIONS
346
- if (isset($_POST['submit'])) {
 
 
 
347
  if ($_POST['wassup_remind_flag'] == 1 AND $_POST['wassup_remind_mb'] == "") {
348
- $wassup_settings['wassup_remind_flag'] = $_POST['wassup_remind_flag'];
349
- $wassup_settings['wassup_remind_mb'] = 10;
350
  } else {
351
- $wassup_settings['wassup_remind_flag'] = $_POST['wassup_remind_flag'];
352
- $wassup_settings['wassup_remind_mb'] = $_POST['wassup_remind_mb'];
353
  }
354
- $wassup_settings['wassup_active'] = $_POST['wassup_active'];
355
- $wassup_settings['wassup_loggedin'] = $_POST['wassup_loggedin'];
356
- $wassup_settings['wassup_spider'] = $_POST['wassup_spider'];
357
- $wassup_settings['wassup_attack'] = $_POST['wassup_attack'];
358
- $wassup_settings['wassup_spamcheck'] = $_POST['wassup_spamcheck'];
359
- $wassup_settings['wassup_spam'] = $_POST['wassup_spam'];
360
- $wassup_settings['wassup_refspam'] = $_POST['wassup_refspam'];
361
- $wassup_settings['wassup_exclude'] = $_POST['wassup_exclude'];
362
- $wassup_settings['delete_auto'] = $_POST['delete_auto'];
363
- $wassup_settings['delete_auto_size'] = $_POST['delete_auto_size'];
364
- $wassup_settings['wassup_screen_res'] = $_POST['wassup_screen_res'];
365
- $wassup_settings['wassup_refresh'] = $_POST['wassup_refresh'];
366
- $wassup_settings['wassup_userlevel'] = $_POST['wassup_userlevel'];
367
- $wassup_settings['wassup_default_type'] = $_POST['wassup_default_type'];
368
- $wassup_settings['wassup_default_limit'] = $_POST['wassup_default_limit'];
369
- if ( $_POST['wassup_savepath'] != $wassup_settings['wassup_savepath'] ) {
370
- if ( empty($_POST['wassup_savepath']) || rtrim($_POST['wassup_savepath'],"/") == wGetSessionpath() ) {
371
- $wassup_settings['wassup_savepath'] = NULL;
 
 
372
  } else {
373
- $wassup_settings['wassup_savepath'] = rtrim($_POST['wassup_savepath'],"/");
374
  }
375
  }
376
- update_option('wassup_settings', $wassup_settings);
 
 
 
 
 
 
 
377
  } elseif (isset($_POST['submit-spam'])) {
378
- $wassup_settings['wassup_spamcheck'] = $_POST['wassup_spamcheck'];
379
- $wassup_settings['wassup_spam'] = $_POST['wassup_spam'];
380
- $wassup_settings['wassup_refspam'] = $_POST['wassup_refspam'];
381
- update_option('wassup_settings', $wassup_settings);
382
- } elseif (isset($_POST['reset-to-default'])) {
383
- print_r($defaultWdata);
384
- delete_option('wassup_settings');
385
- update_option('wassup_settings', $defaultWdata);
386
- $wassup_settings = get_option('wassup_settings');
387
- }
388
-
 
389
 
 
390
  if ($_GET['page'] == "wassup-spy") {
391
  $class_spy="class='current'";
392
  } elseif ($_GET['page'] == "wassup-options") {
@@ -398,32 +448,44 @@ function WassUp() {
398
  }
399
 
400
  //for stringShortener calculated values and max-width...-Helene D. 11/27/07, 12/6/07
401
- if (!empty($wassup_settings['wassup_screen_res'])) {
402
- $screen_res_size = (int) $wassup_settings['wassup_screen_res'];
403
  } else {
404
  $screen_res_size = 670;
405
  }
406
  $max_char_len = ($screen_res_size)/10;
407
  $screen_res_size = $screen_res_size+20; //for wrap margins...
408
 
409
- //moved max-width to single "wrap" div and removed it from
410
- // the individual spans and divs in style.php...
411
- print '<div class="wrap" style="max-width:'.$screen_res_size.'px;" >';
412
- //#moved CreateTable/UpdateTable to "wassup_install" function...
413
-
414
  //for generating page link urls....
415
  //$wpurl = get_bloginfo('wpurl'); //global
416
  $siteurl = get_bloginfo('siteurl');
417
 
418
- if ($_GET['page'] == "wassup-online") {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
419
  $to_date = wassup_get_time();
420
  $from_date = strtotime('-3 minutes', $to_date);
421
- print '<h2>Current Visitors Online</h2>';
422
- print '<p style="font-size:11px">Legend: <span class="box-log">&nbsp;&nbsp;</span> Logged-in Users <span class="box-aut">&nbsp;&nbsp;</span> Comments Authors <span class="box-spider">&nbsp;&nbsp;</span> Spiders/bots</p><br />'."\n";
423
- print '<p style="font-size:11px;"><a href="#" class="toggle-all">Expand All</a></p>';
424
  $currenttot = $wpdb->get_var("SELECT COUNT(DISTINCT wassup_id) as currenttot FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date");
425
  $currenttot = $currenttot+0; //set to integer
426
- print "<p style='font-size:11px;'>Visitors online: <strong>".$currenttot."</strong></p><br />";
427
  if ($currenttot > 0) {
428
  $qryC = $wpdb->get_results("SELECT id, wassup_id, max(timestamp) as max_timestamp, ip, hostname, searchengine, urlrequested, agent, referrer, spider, username, comment_author FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date GROUP BY ip ORDER BY max_timestamp DESC");
429
  foreach ($qryC as $cv) {
@@ -438,10 +500,10 @@ function WassUp() {
438
  $referrer = '<a href="'.$cv->referrer.'" target=_"BLANK">'.stringShortener($cv->referrer, round($max_char_len*.9,0)).'</a>';
439
  }
440
  } else {
441
- $referrer = "Direct hit";
442
  }
443
  } else {
444
- $referrer = "From your blog";
445
  }
446
  $numurl = $wpdb->get_var("SELECT COUNT(DISTINCT id) as numurl FROM $table_name WHERE wassup_id='".$cv->wassup_id."'");
447
  ?>
@@ -459,11 +521,11 @@ function WassUp() {
459
  <?php // User is logged in or is a comment's author
460
  if ($cv->username != "" OR $cv->comment_author != "") {
461
  if ($cv->username != "") {
462
- $Ousername = '<li class="users"><span class="indent-li-agent">LOGGED IN USER: <strong>'.$cv->username.'</strong></span></li>';
463
- $Ocomment_author = '<li class="users"><span class="indent-li-agent">COMMENT AUTHOR: <strong>'.$cv->comment_author.'</strong></span></li>';
464
  $unclass = "userslogged";
465
  } elseif ($cv->comment_author != "") {
466
- $Ocomment_author = '<li class="users"><span class="indent-li-agent">COMMENT AUTHOR: <strong>'.$cv->comment_author.'</strong></span></li>';
467
  $unclass = "users";
468
  }
469
  ?>
@@ -496,26 +558,26 @@ function WassUp() {
496
  print '</div>';
497
  print '<p class="sum-footer"></p>';
498
  } //end foreach qryC
499
- } //end if currenttot
500
- print '<br /><p style="font-size:11px;"><a href="#" class="toggle-all">Expand All</a></p>';
501
 
502
- // HERE IS THE SPY MODE VIEW
503
- } elseif ($_GET['page'] == "wassup-spy") {
504
- print '<h2>SPY Visitors</h2>';
505
- print '<p style="font-size:11px">Legend: <span class="box-log">&nbsp;&nbsp;</span> Logged-in Users <span class="box-aut">&nbsp;&nbsp;</span> Comments Authors <span class="box-spider">&nbsp;&nbsp;</span> Spiders/bots</p><br />'."\n";
506
- print '<div>';
507
- print '<a href="#?" onclick="return pauseSpy();"><span id="spy-pause">Pause</span></a> ';
508
- print '<a href="#?" onclick="return playSpy();"><span id="spy-play">Play</span></a>';
509
- print '<br />&nbsp;<br /></div>'."\n";
510
- print '<div id="spyContainer">'."\n".'<!-- spyContainer is empty -->'."\n";
511
- //display the last few hits here. The rest will be added via spy.js
 
512
  $to_date = (wassup_get_time()-2);
513
  $from_date = ($to_date - 12*(60*60)); //display last 10 visits in 12 hours...
514
- spyview($from_date,$to_date,10);
515
- print '</div>';
516
- echo "<br />";
517
 
518
- // HERE IS THE OPTIONS VIEW
519
  } elseif($_GET['page'] == "wassup-options") {
520
  //#moved content to external include file, "settings.php"
521
  //# to make "wassup" code easier to read and modify
@@ -523,59 +585,68 @@ echo "<br />";
523
  include(dirname(__FILE__).'/lib/settings.php'); ?>
524
 
525
  <?php // HERE IS THE MAIN/DETAILS VIEW
526
- } else {
 
 
 
 
527
 
528
- $search = attribute_escape($_GET['search']);
529
- $res = (int) $wassup_settings['wassup_screen_res'];
530
  if (empty($res)) $res=620;
531
  elseif ($res < 800) $res=620;
532
  elseif ($res < 1024) $res=740;
533
  elseif ($res < 1200) $res=1000;
534
  else $res=1000;
535
-
536
- if (isset($_GET['wmark'])) {
537
- if ($_GET['wmark'] == 0) {
538
- $wassup_settings['wmark'] = "0";
539
- $wassup_settings['wip'] = "";
540
- } else {
541
- $wassup_settings['wmark'] = "1";
542
- $wassup_settings['wip'] = attribute_escape($_GET['wip']);
543
- }
544
- update_option('wassup_settings', $wassup_settings);
545
- }
546
- if (isset($_GET['wchart'])) {
547
- if ($_GET['wchart'] == 0) {
548
- $wassup_settings['wassup_chart'] = 0;
549
- } else {
550
- $wassup_settings['wassup_chart'] = 1;
 
 
 
 
551
  }
552
- update_option('wassup_settings', $wassup_settings);
553
- }
554
-
555
- if ($wassup_settings['wassup_default_limit'] != '' AND !isset($_GET['limit'])) {
556
- $items = $wassup_settings['wassup_default_limit'];
557
- } elseif(isset($_GET['limit'])) {
558
- $items = htmlentities(attribute_escape($_GET['limit']));
559
  } else {
560
- $items = 10;
561
  }
 
562
 
563
- if ($wassup_settings['wassup_default_type'] != '' AND !isset($_GET['type'])) {
564
- $type = $wassup_settings['wassup_default_type'];
565
- } else {
566
  $type = htmlentities(attribute_escape($_GET['type']));
 
 
567
  }
568
-
569
  if ($type == 'spider') {
570
  $whereis = " AND spider!=''";
571
  } elseif ($type == 'nospider') {
572
  $whereis = " AND spider=''";
573
- } elseif ($type == 'spam') {
574
- $whereis = " AND spam>0";
575
- } elseif ($type == 'nospam') {
576
- $whereis = " AND spam=0";
577
- } elseif ($type == 'nospamspider') {
578
- $whereis = " AND spam=0 AND spider=''";
579
  } elseif ($type == 'searchengine') {
580
  $whereis = " AND searchengine!='' AND search!=''";
581
  } elseif ($type == 'referrer') {
@@ -586,17 +657,31 @@ echo "<br />";
586
  $whereis = " AND username!=''";
587
  }
588
 
589
- $pages = 1;
590
- if(isset($_GET['pages']) and is_numeric($_GET['pages']) and $pages = $_GET['pages']) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
591
  $limit = " LIMIT ".(($pages-1)*$items).",$items";
592
  } else {
593
  $limit = " LIMIT $items";
594
  }
595
 
596
- print "<h2>Latest hits</h2>";
597
- $to_date = wassup_get_time();
598
- if ($_GET['last'] == "") $last = 1; else $last = htmlentities(attribute_escape($_GET['last']));
599
- $from_date = strtotime('-'.$last.' day', $to_date);
600
 
601
  // Instantiate class to count items
602
  $Tot = New MainItems;
@@ -607,99 +692,107 @@ echo "<br />";
607
  $Tot->Limit = $limit;
608
  $Tot->WpUrl = $wpurl;
609
 
610
- $itemstot = $Tot->calc_tot("items", $search);
611
- $pagestot = $Tot->calc_tot("pages", $search);
612
- $spamtot = $Tot->calc_tot("spam", $search);
613
  // Check if some records was marked
614
- if ($wassup_settings['wmark'] == 1) {
615
- $Tot->Marked_ip = $wassup_settings['wip'];
616
- $markedtot = $Tot->calc_tot("items_by_type", $search, "marked");
617
  }
618
-
619
-
620
- $new_limit = eregi_replace("\&limit=".$_GET['limit']."", "", $_SERVER['QUERY_STRING']);
621
- $new_type = eregi_replace("\&type=".$_GET['type']."", "", $_SERVER['QUERY_STRING']);
622
- $new_last = eregi_replace("\&last=".$_GET['last']."", "", $_SERVER['QUERY_STRING']);
623
-
624
- if ($wassup_settings['wassup_active'] != 1) {
625
- print "<p style='color: red; font-weight: bold;'>WassUp recording is disabled</p>";
626
  }
 
627
  // DELETE EVERY RECORD MARKED BY IP
628
- if ($_GET['deleteMARKED'] == 1) {
629
  $rec_deleted = $wpdb->get_var("SELECT COUNT(ip) as deleted FROM $table_name WHERE ip='".urlencode(attribute_escape($_GET['dip']))."'");
630
- $wpdb->query($wpdb->prepare("DELETE FROM $table_name WHERE ip='%s'", urlencode(attribute_escape($_GET['dip']))));
631
- echo "<p><strong>".$rec_deleted." records deleted</strong></p>";
632
- }
633
- echo "<table width='100%'>
634
- <tr>
635
- <td>
636
- <form><p style=\"font-size: 11px;\">";
637
- if ($wassup_settings['wassup_chart'] == 1) {
638
- echo "<a href='?page=".WASSUPFOLDER."&wchart=0' style='text-decoration:none;'><img src='$wpurl/wp-content/plugins/".WASSUPFOLDER."/img/chart_delete.png' style='padding:0px 6px 0 0;' alt='hide chart' title='Hide the chart and site usage'></a>";
639
- } else {
640
- echo "<a href='?page=".WASSUPFOLDER."&wchart=1' style='text-decoration:none;'><img src='$wpurl/wp-content/plugins/".WASSUPFOLDER."/img/chart_add.png' style='padding:0px 6px 0 0;' alt='show chart' title='Show the chart and site usage'></a>";
641
- }
642
- echo "Summary for the last <select style=\"font-size: 11px;\" name='last' onChange='window.location.href=this.options[this.selectedIndex].value;'>
643
- <option value='?$new_last&last=1'".($_GET['last'] == 1 ? " SELECTED" : "").">24 hours</option>
644
- <option value='?$new_last&last=7'".($_GET['last'] == 7 ? " SELECTED" : "").">7 days</option>
645
- <option value='?$new_last&last=30'".($_GET['last'] == 30 ? " SELECTED" : "").">1 month</option>
646
- <option value='?$new_last&last=365'".($_GET['last'] == 365 ? " SELECTED" : "").">1 year</option>
647
- </select></p>
648
- </td>
649
- <td align='right'><p style=\"font-size: 11px;\">Items per page: <select name='navi' style=\"font-size: 11px;\" onChange='window.location.href=this.options[this.selectedIndex].value;'>
650
- <option value='?$new_limit&limit=10'".($items == 10 ? " SELECTED" : "").">10</option>
651
- <option value='?$new_limit&limit=20'".($items == 20 ? " SELECTED" : "").">20</option>
652
- <option value='?$new_limit&limit=50'".($items == 50 ? " SELECTED" : "").">50</option>
653
- <option value='?$new_limit&limit=100'".($items == 100 ? " SELECTED" : "").">100</option>
654
- </select> - Show items by: <select style=\"font-size: 11px;\" name='type' onChange='window.location.href=this.options[this.selectedIndex].value;'>
655
- <option value='?page=".WASSUPFOLDER."'>--</option>
656
- <option value='?$new_type&type=spider'".($type == "spider" ? " SELECTED" : "").">Spider</option>
657
- <option value='?$new_type&type=nospider'".($type == "nospider" ? " SELECTED" : "").">NO Spider</option>
658
- <option value='?$new_type&type=spam'".($type == "spam" ? " SELECTED" : "").">Spam</option>
659
- <option value='?$new_type&type=nospam'".($type == "nospam" ? " SELECTED" : "").">NO Spam</option>
660
- <option value='?$new_type&type=nospamspider'".($type == "nospamspider" ? " SELECTED" : "").">NO Spam NO Spider</option>
661
- <option value='?$new_type&type=loggedin'".($type == "loggedin" ? " SELECTED" : "").">Users logged in</option>
662
- <option value='?$new_type&type=comauthor'".($type == "comauthor" ? " SELECTED" : "").">Comment's authors</option>
663
- <option value='?$new_type&type=searchengine'".($type == "searchengine" ? " SELECTED" : "").">Referer from search engine</option>
664
- <option value='?$new_type&type=referrer'".($type == "referrer" ? " SELECTED" : "").">Referer from ext link</option>
665
- <option value='?$new_type&type=everything'".($type == "everything" ? " SELECTED" : "").">Everything</option>
666
- </select>
667
- </p>
668
- </form>
669
- </td>
670
- </tr>
671
- </table>
672
- ";
673
-
674
- if ($wassup_settings['wassup_chart'] == 1) {
675
- // Print Site Usage
676
- //#print useage/google chart only on page 1...
677
- //if (!isset($_GET['pages']) || (int)$_GET['pages'] < 2) {
678
- echo "
679
- <div class='main-tabs'>
680
- <div id='usage'>
681
- <ul>
682
- <li><span style='border-bottom: 2px solid #0077CC;'>".$itemstot."</span> <small>Visits</small></li>
683
- <li><span style='border-bottom: 2px dashed #FF6D06;'>".$pagestot."</span> <small>Pageviews</small></li>
684
- <li><span>".@number_format(($pagestot/$itemstot), 2)."</span> <small>Pages/Visits</small></li>
685
- <li><span><a href=\"#TB_inline?height=55&width=400&inlineId=hiddenspam\" class=\"thickbox\">".$spamtot."</a></span> <span>(".@number_format(($spamtot*100/$pagestot), 2)."%)</span> <small>Spams</small></li>
686
- </ul>";
687
- // Print the Google chart!
688
- if ($pagestot > 20) {
689
- echo $Tot->TheChart($last, $res, attribute_escape($_GET['search']))."";
690
- } else {
691
- echo "<div id='placeholder' align='center'><p style='padding-top:50px;'>Waiting for some data to print chart...</p></div>";
692
- }
693
- echo "
694
- </div>
695
- </div>";
696
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
697
 
698
  if ($_GET['limit'] == 10 OR $_GET['limit'] == 20 OR !isset($_GET['limit'])) {
699
  $expcol = '
700
  <table width="100%"><tr>
701
- <td align="left" style="font-size: 11px;"><a href="#" class="toggle-all">'.__('Expand All','wassup').'</a></td>
702
- <td align="right" style="font-size: 11px;"><a href="#" class="toggle-allcrono">'.__('Collapse Chronology','wassup').'</a></td>
703
  </tr></table><br />';
704
  }
705
 
@@ -719,21 +812,25 @@ echo "<br />";
719
  // hidden spam options
720
  ?>
721
  <div id="hiddenspam" style="display:none;">
722
- <h2>Spam Options</h2>
723
  <form action="" method="post">
724
- <p><input type="checkbox" name="wassup_spamcheck" value="1" <?php if($wassup_settings['wassup_spamcheck'] == 1 ) print "CHECKED"; ?> /> <strong><?php _e('Enable/Disable Spam Check on Records','wassup'); ?></strong></p>
725
- <p style="padding-left:30px;"><input type="checkbox" name="wassup_spam" value="1" <?php if($wassup_settings['wassup_spam'] == 1) print "CHECKED"; ?> /> <?php _e('Record Akismet comment spam attempts','wassup'); ?></p>
726
- <p style="padding-left:30px;"><input type="checkbox" name="wassup_refspam" value="1" <?php if($wassup_settings['wassup_refspam'] == 1) print "CHECKED"; ?> /> <?php _e('Record referrer spam attempts','wassup'); ?></p>
727
  <p style="padding-left:0;"><input type="submit" name="submit-spam" value="<?php _e('Save Settings','wassup'); ?>" /></p>
728
  </form>
729
  </div>
730
- <table width="100%">
731
- <tr>
732
- <td align="left" style="font-size: 11px;"><?php if ($wassup_settings['wmark'] == 1) echo "<a href='?".$_SERVER['QUERY_STRING']."&search=".$wassup_settings['wip']."' title='Filter by marked IP'><strong>$markedtot</strong> visits marked</a> - "; if ($search != "") print "Searched for: <strong>$search</strong> - "; ?>Auto refresh in <span id="CountDownPanel"></span> seconds</td>
733
-
734
- <td align="right" style="font-size: 11px;"><a href="<?php echo $wpurl."/wp-content/plugins/".WASSUPFOLDER."/lib/action.php?height=400&width=$res&action=topten&hash=$hash&from_date=$from_date&to_date=$to_date"; ?>" class="thickbox">Show TopTen</a> - <a href="#" class='show-search'>Search</a></td>
735
- </tr>
736
- </table>
 
 
 
 
737
  <div class="search-ip" style="display: none;">
738
  <table border=0 width="100%">
739
  <tr valign="top">
@@ -746,7 +843,6 @@ echo "<br />";
746
  </tr>
747
  </table>
748
  </div>
749
- <!-- end Top Ten -->
750
  <?php
751
  //# Detailed List of Wassup Records...
752
  print $expcol;
@@ -773,33 +869,34 @@ echo "<br />";
773
  $referrer = '<a href="'.$rk->referrer.'" target="_BLANK">'.stringShortener($rk->referrer, round($max_char_len*.9,0)).'</a>';
774
  }
775
  } else {
776
- $referrer = "From your blog";
777
- }
778
- } else {
779
- $referrer = "Direct hit";
780
  }
781
  $numurl = $wpdb->get_var("SELECT COUNT(DISTINCT id) as numurl FROM $table_name WHERE wassup_id='".$rk->wassup_id."'");
782
  if ($rk->hostname != "") $hostname = $rk->hostname; else $hostname = "unknown";
783
  ?>
784
 
785
- <div class="delID<?php echo $rk->wassup_id ?>">
786
- <div class="<?php if ($wassup_settings['wmark'] == 1 AND $wassup_settings['wip'] == $ip[0]) echo "sum-nav-mark"; else echo "sum-nav"; ?>">
787
 
788
- <p class="delbut">
789
- <?php // Mark/Unmark IP
790
- if ($wassup_settings['wmark'] == 1 AND $wassup_settings['wip'] == $ip[0]) { ?>
791
- <a href="?<?php echo $_SERVER['QUERY_STRING'] ?>&deleteMARKED=1&dip=<?php print $ip[0]; ?>" style="text-decoration:none;"><img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/cross.png'; ?>" alt="delete" title="Delete EVERY records marked by this IP from DB"></a>
 
792
  <a href="?page=<?php echo WASSUPFOLDER; ?>&wmark=0" style="text-decoration:none;">
793
- <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/error_delete.png'; ?>" alt="mark" title="UnMark IP">
794
- </a>
795
- <?php } else { ?>
796
- <a href="#" class="deleteID" id="<?php echo $rk->wassup_id ?>" style="text-decoration:none;"><img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/cross.png'; ?>" alt="delete" title="Delete record from DB"></a>
797
  <a href="?<?php echo $_SERVER['QUERY_STRING'] ?>&wmark=1&wip=<?php print $ip[0]; ?>" style="text-decoration:none;">
798
- <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/error_add.png'; ?>" alt="mark" title="Mark IP">
799
- </a>
800
- <?php } ?>
801
- <a href="<?php echo $wpurl."/wp-content/plugins/".WASSUPFOLDER."/lib/action.php?height=400&width=$res&action=displayraw&hash=$hash&wassup_id=".$rk->wassup_id.""; ?>" class="thickbox"><img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/database_table.png'; ?>" alt="show raw table" title="Show the items as raw table"></a>
802
- </p>
803
 
804
  <span class="sum-box"><?php if ($numurl >= 2) { ?><a href="#" class="showhide" id="<?php echo $rk->id ?>"><?php print $ip[0]; ?></a><? } else { ?><?php print $ip[0]; ?><?php } ?></span>
805
  <span class="sum-date"><?php print $datetimeF; ?></span>
@@ -869,15 +966,26 @@ echo "<br />";
869
  <?php // Referer is a SPAM
870
  if ($rk->spam > 0) { ?>
871
  <ul class="spam">
872
- <li class="spam"><span class="indent-li-agent">Probably SPAM! <?php if ($rk->spam==1) { ?>(Akismet Spam)<?php } elseif ($rk->spam==2) { ?>(Referer Spam)<?php } ?></span></li>
 
 
 
 
873
  </ul>
874
  <?php } ?>
875
- <?php // User os/broswer/language
876
- if ($rk->os != "" OR $rk->browser != "") {
877
  ?>
878
  <ul class="agent">
879
- <li class="agent"><span class="indent-li-agent"><?php if ($rk->language != "") { ?><img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/flags/'.strtolower($rk->language).'.png'; ?>" alt="<?php print strtolower($rk->language); ?>" title="Language: <?php print strtolower($rk->language); ?>"><?php } ?> OS: <strong><?php print $rk->os; ?></strong></span></li>
880
- <li class="agent">BROWSER: <strong><?php print $rk->browser; ?></strong></li>
 
 
 
 
 
 
 
881
  </ul>
882
  <?php } ?>
883
 
@@ -915,10 +1023,12 @@ echo "<br />";
915
  print $expcol;
916
  }
917
 
918
- } //end MAIN/DETAILS VIEW
 
 
919
 
920
- print "<p><small>WassUp ver: $version - Check the official <a href='http://www.wpwp.org' target='_BLANK'>WassUp</a> page for updates, bug reports and your hints to improve it</small></p>";
921
- print "</div>";
922
  } //end function Wassup
923
 
924
  function CreateTable() {
@@ -953,54 +1063,8 @@ function CreateTable() {
953
  } //end function createTable
954
 
955
  function UpdateTable() {
956
- global $wpdb, $wassup_settings;
957
  $table_name = $wpdb->prefix . "wassup";
958
- // Upgrade from version < 1.1b
959
- if ($wpdb->get_var("SHOW COLUMNS FROM $table_name LIKE 'username'") == "") {
960
- $sql_add_username = "ALTER TABLE {$table_name} ADD COLUMN username VARCHAR( 50 ) NULL";
961
- $wpdb->query( $sql_add_username );
962
- }
963
- if ($wpdb->get_var("SHOW COLUMNS FROM $table_name LIKE 'comment_author'") == "") {
964
- $sql_add_comment_author = "ALTER TABLE {$table_name} ADD COLUMN comment_author VARCHAR( 50 ) NULL";
965
- $wpdb->query( $sql_add_comment_author );
966
- }
967
- // Upgrade from version < 1.1.4b
968
- $Freferrer = $wpdb->get_results("show columns from $table_name LIKE 'referrer'");
969
- foreach ($Freferrer as $ff) {
970
- if (eregi("varchar", $ff->Type)) {
971
- $sql_alter_referrer = "ALTER TABLE {$table_name} CHANGE referrer referrer TEXT NULL";
972
- $wpdb->query( $sql_alter_referrer );
973
- }
974
- }
975
- // Upgrade from version < 1.2b
976
- $Fsearchpage = $wpdb->get_results("show columns from $table_name LIKE 'searchpage'");
977
- foreach ($Fsearchpage as $ss) {
978
- if ($ss->Default == "") {
979
- $sql_alter_searchpage = "ALTER TABLE {$table_name} CHANGE searchpage searchpage INT( 11 ) NULL DEFAULT '0'";
980
- $wpdb->query( $sql_alter_searchpage );
981
- }
982
- }
983
- $Fuseragent = $wpdb->get_results("show columns from $table_name LIKE 'agent'");
984
- foreach ($Fuseragent as $ua) {
985
- if ($ua->Type != "varchar(255)") {
986
- $sql_alter_useragent = "ALTER TABLE {$table_name} CHANGE agent agent varchar(255) NULL";
987
- $wpdb->query( $sql_alter_useragent );
988
- }
989
- }
990
- $Fbrowser = $wpdb->get_results("show columns from $table_name LIKE 'browser'");
991
- foreach ($Fbrowser as $br) {
992
- if ($br->Type != "varchar(50)") {
993
- $sql_alter_browser = "ALTER TABLE {$table_name} CHANGE browser browser varchar(50) NULL";
994
- $wpdb->query( $sql_alter_browser );
995
- }
996
- }
997
- $Fspider = $wpdb->get_results("show columns from $table_name LIKE 'spider'");
998
- foreach ($Fspider as $sp) {
999
- if ($sp->Type != "varchar(50)") {
1000
- $sql_alter_spider = "ALTER TABLE {$table_name} CHANGE spider spider varchar(50) NULL";
1001
- $wpdb->query( $sql_alter_spider );
1002
- }
1003
- }
1004
  // Upgrade from version < 1.3.9
1005
  if ($wpdb->get_var("SHOW COLUMNS FROM $table_name LIKE 'spam'") == "") {
1006
  $sql_add_spam = "ALTER TABLE {$table_name} ADD COLUMN spam VARCHAR( 50 ) DEFAULT '0'";
@@ -1010,9 +1074,14 @@ function UpdateTable() {
1010
 
1011
  //Track visitors and save record in wassup table
1012
  function wassupAppend() {
1013
- global $wpdb, $wassup_id, $wp_query, $HTTP_COOKIE_VARS, $screen_res, $wassup_settings, $wpurl;
 
 
 
 
1014
  $siteurl = get_bloginfo('siteurl');
1015
  $table_name = $wpdb->prefix . "wassup"; //moved;
 
1016
 
1017
  if (!is_admin()) { //exclude wordpress admin page visits
1018
 
@@ -1029,7 +1098,39 @@ function wassupAppend() {
1029
  $ipAddress = $IP;
1030
  }
1031
  }
1032
- $urlRequested = (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1033
  $referrer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');
1034
  $userAgent = (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '');
1035
  $language = (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? attribute_escape($_SERVER['HTTP_ACCEPT_LANGUAGE']) : '');
@@ -1038,13 +1139,25 @@ function wassupAppend() {
1038
  $comment_user = utf8_encode($_COOKIE['comment_author_'.COOKIEHASH]);
1039
 
1040
  $timestamp = wassup_get_time(); //Add a timestamp to visit...
 
1041
 
1042
  //#####Start recording visit....
1043
  //## wassup is activated and IP not on exclusion list...
1044
- if ($wassup_settings['wassup_active'] == 1) { //(moved)
1045
- if (empty($wassup_settings['wassup_exclude']) ||
1046
- strstr($wassup_settings['wassup_exclude'],$ipAddress) == FALSE) {
1047
-
 
 
 
 
 
 
 
 
 
 
 
1048
  //### Exclude requests for themes, plugins, and favicon from recordings
1049
  if (stristr($urlRequested,"favicon.ico") === FALSE) { //moved
1050
  if (stristr($urlRequested,"/wp-content/plugins") === FALSE || stristr($urlRequested,"forum") !== FALSE ) { //moved and modified to allow forum requests
@@ -1067,9 +1180,9 @@ function wassupAppend() {
1067
  //if ($spider != '') { $os=''; $browser=''; }
1068
 
1069
  //# More recording exclusion controls (moved to avoid unneeded spam testing)
1070
- if ($wassup_settings['wassup_loggedin'] == 1 || !is_user_logged_in() ) {
1071
- if ($wassup_settings['wassup_spider'] == 1 || $spider == '') {
1072
- if ($wassup_settings['wassup_attack'] == 1 || stristr($userAgent,"libwww-perl") === FALSE ) {
1073
 
1074
  //#===================================================
1075
  //###Start visitor tracking with "session"...
@@ -1087,18 +1200,19 @@ function wassupAppend() {
1087
  //
1088
  //### Check if this is an ongoing visit or a new hit...
1089
  //# Test for valid savepath directory before session_start()
1090
- //# Note: a read-only savepath directory can cause errors here.
1091
- if (!empty($wassup_settings['wassup_savepath'])) {
1092
- $sessionpath = $wassup_settings['wassup_savepath'];
1093
- } else {
1094
- $sessionpath = wGetSessionpath();
1095
- }
1096
- if ( file_exists($sessionpath)) {
1097
- //#reset sessionpath to value set in options...
1098
- if ( $sessionpath != wGetSessionpath() ) {
1099
  session_save_path($sessionpath);
1100
  }
1101
  session_start(); //required to use/update $_SESSION
 
 
 
 
 
 
 
1102
  //#confirm that session is started...
1103
  if (isset($_SESSION)) {
1104
  if (isset($_SESSION['wassup_id'])) {
@@ -1143,7 +1257,10 @@ function wassupAppend() {
1143
  }
1144
  } elseif (isset($_COOKIE['wassup_id'])) {
1145
  $wassup_id = $_COOKIE['wassup_id'];
1146
- }
 
 
 
1147
  //#create cookie when bad session_savepath or when "session" is not available
1148
  if (empty($wassup_id)) {
1149
  //$wassup_id = md5(uniqid(rand(), true));
@@ -1189,85 +1306,60 @@ function wassupAppend() {
1189
  //# some useragents to exclude from spam checking...
1190
  $goodbots = array('Google','Yahoo!', 'SummizeFeedReader'); //omit
1191
 
1192
- if ( $wassup_settings['wassup_spamcheck'] == 1 ) {
1193
- //
1194
- //# No duplicate spam testing in same session unless there
1195
- //# is a forum page request or comment...
1196
- if (isset($spamresult) && stristr($urlRequested,"comment") === FALSE && stristr($urlRequested,"forum") === FALSE && empty($comment_user) && empty($_POST['comment'])) {
1197
- $spam = $spamresult;
1198
-
1199
- //# No spam check on known bots (google, yahoo,...) unless
1200
- //# there is a comment or forum page request...
1201
- } elseif ( empty($spider) || array_search($spider,$goodbots) === FALSE || stristr($urlRequested,"comment") !== FALSE || stristr($urlRequested,"forum") !== FALSE || !empty($comment_user) ) {
 
 
 
 
 
 
 
 
 
 
 
1202
 
1203
- //#first check for referrer spam (faster, if positive)
1204
- //#...but skip when referrer is own blog ($siteurl/$wpurl)
1205
- if (!empty($referrer)) {
1206
- if (!stristr($referrer,$wpurl) && !stristr($referrer,$siteurl)) {
1207
- // Do a control if it is Referrer Spam
1208
- if (wGetSpamRef($referrer) == 1) { $spam = 2; }
1209
- }
1210
- }
1211
-
1212
- //#lastly check for comment spammers using Akismet API
1213
- // Start Akismet integration to prevent spam records
1214
- $akismet_key = get_option('wordpress_api_key');
1215
- if (!empty($akismet_key) && ($spam == 0 || !empty($comment_user)) || is_feed()) {
1216
- $comment_user_email = utf8_encode($_COOKIE['comment_author_email_'.COOKIEHASH]);
1217
- $comment_user_url = utf8_encode($_COOKIE['comment_author_url_'.COOKIEHASH]);
1218
- include(dirname(__FILE__).'/lib/akismet.class.php');
1219
-
1220
- // load array with comment data
1221
- $Acomment = array(
1222
- 'author' => $comment_user,
1223
- 'email' => $comment_user_email,
1224
- 'website' => $comment_user_url,
1225
- 'body' => $_POST["comment"],
1226
- 'permalink' => $urlRequested,
1227
- 'user_ip' => $ipAddress,
1228
- 'user_agent' => $userAgent
1229
- );
1230
-
1231
- // instantiate an instance of the class
1232
- $akismet = new Akismet($wpurl, $akismet_key, $Acomment);
1233
-
1234
- // Check if it's spam
1235
- if ( $akismet->isSpam() ) {
1236
- $spam = 1;
1237
- }
1238
- // test for errors
1239
- // no need for error checks...spam=0 already set by default
1240
- //if($akismet->errorsExist()) {
1241
- // returns true if any errors exist
1242
- //if($akismet->isError('AKISMET_INVALID_KEY')) {
1243
- // $spam = 0;
1244
- //} elseif($akismet->isError('AKISMET_RESPONSE_FAILED')) {
1245
- // $spam = 0;
1246
- //} elseif($akismet->isError('AKISMET_SERVER_NOT_FOUND')) {
1247
- // $spam = 0;
1248
- //}
1249
- //}
1250
- //end if akismet_key
1251
- } else {
1252
- //#no akismet key...check for known spammers using
1253
- //# wGetSpamRef() with $hostname in place of
1254
- //# $referrer...
1255
- if ( $spam == 0) {
1256
- if (!empty($hostname) && $hostname != "unknown") {
1257
- if (wGetSpamRef($hostname) == 1) { $spam = 1; }
1258
- }
1259
- }
1260
- } //end else akismet_key
1261
 
1262
  // #save spam results in session...
1263
- if ( file_exists($sessionpath)) {
1264
- @session_start(); //required to access $_SESSION
1265
- $_SESSION['spamresult'] = $spam;
1266
- @session_write_close();
1267
  }
1268
 
1269
  } //end else $spamresult
1270
- } //end if wassup_spamcheck
1271
 
1272
  // Personally used to debug
1273
  if ($current_user->user_email == "michele@befree.it") {
@@ -1275,30 +1367,56 @@ function wassupAppend() {
1275
 
1276
  //### Record visit in wassup table...
1277
  //## Final exclusion control is spam...
1278
- if ($spam == 0 OR ($wassup_settings['wassup_spam'] == 1 AND $spam == 1) OR ($wassup_settings['wassup_refspam'] == 1 AND $spam == 2)) {
1279
-
1280
- $insert = $wpdb->query( $wpdb->prepare("INSERT INTO $table_name (wassup_id, timestamp, ip, hostname, urlrequested, agent, referrer, search, searchpage, os, browser, language, screen_res, searchengine, spider, feed, username, comment_author, spam)
1281
- VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s )",
1282
- $wassup_id,
1283
- $timestamp,
1284
- attribute_escape($ipAddress),
1285
- attribute_escape($hostname),
1286
- attribute_escape($urlRequested),
1287
- attribute_escape($userAgent),
1288
- attribute_escape($referrer),
1289
- $search_phrase,
1290
- $searchpage,
1291
- $os,
1292
- $browser,
1293
- $language[0],
1294
- $screen_res,
1295
- $searchengine,
1296
- $spider,
1297
- $feed,
1298
- attribute_escape($logged_user),
1299
- attribute_escape($comment_user),
1300
- $spam
1301
- ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1302
 
1303
  } //end if wassup_spam
1304
  } //end if dup_urlrequest == 0
@@ -1313,13 +1431,13 @@ function wassupAppend() {
1313
 
1314
  //### Purge old records from wassup table
1315
  //automatic database cleanup of old records...
1316
- if ($wassup_settings['delete_auto'] != "") {
1317
  // do purge every few visits to keep wassup fast...
1318
  if ( ((int)$timestamp)%5 == 0 ) {
1319
  //use visit timestamp instead of current time for
1320
  // delete parameter
1321
  //$to_date = wassup_get_time();
1322
- $from_date = strtotime($wassup_settings['delete_auto'], $timestamp);
1323
  if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name AND $wpdb->get_var("SELECT COUNT(id) FROM $table_name WHERE timestamp<'$from_date'") > 0) {
1324
  $wpdb->query("DELETE FROM $table_name WHERE timestamp<'$from_date'");
1325
  $wpdb->query("OPTIMIZE TABLE $table_name");
@@ -1328,11 +1446,12 @@ function wassupAppend() {
1328
  } //end if delete_auto
1329
 
1330
  } //end if wassup_exclude
 
1331
  } //end if wassup_active
1332
  } //end if !is_admin
1333
 
1334
  //### Notify admin if alert is set and wassup table > alert
1335
- if ($wassup_settings['wassup_remind_flag'] == 1) {
1336
  // check database size every few visits to keep wassup fast...
1337
  if ( (time())%7 == 0 ) {
1338
  $table_status = $wpdb->get_results("SHOW TABLE STATUS LIKE '$table_name'");
@@ -1340,18 +1459,22 @@ function wassupAppend() {
1340
  $data_lenght = $fstatus->Data_length;
1341
  }
1342
  $tusage = ($data_lenght/1024/1024);
1343
- if ($tusage > $wassup_settings['wassup_remind_mb']) {
1344
  $recipient = get_bloginfo('admin_email');
1345
  $sender = get_bloginfo('name').' <wassup_noreply@'.parse_url(get_bloginfo('siteurl'),PHP_URL_HOST).'>';
1346
- $subject = "[ALERT] WassUp Plugin table has reached maximum size!";
1347
- $message = "Hi,\nyou have received this email because your WassUp Database table at your Wordpress blog (".get_bloginfo('url').") had reached the maximum value you set in the options menu (".$wassup_settings['wassup_remind_mb']." Mb).\n\nThis is only a reminder, please take the actions you want in the WassUp options menu (".get_bloginfo('url')."/wp-admin/admin.php?page=wassup-options).\n\nThis alert now will be removed and you will be able to set a new one.\n\nThank you for using WassUp plugin. Check if there is a new version available here: http://wordpress.org/extend/plugins/wassup/\n\nHave a nice day!";
1348
- mail($recipient, $subject, $message, "From: $sender");
1349
- $wassup_settings['wassup_remind_flag'] = 2;
1350
- update_option('wassup_settings', $wassup_settings);
 
 
 
1351
 
1352
  }
1353
  }
1354
  } //if wassup_remind_flag
 
1355
  } //end function wassupAppend()
1356
 
1357
  function wGetQueryPairs($url){
@@ -1424,7 +1547,8 @@ function seReferer($ref = false){
1424
 
1425
  function wGetSE($referrer = null){
1426
  $key = null;
1427
- $lines = array("Alice|search.alice.it|qs|","Google|www.google.|q|","Google Groups|groups.google.|q|", "Google Images|images.google.|prev|", "Yahoo|search.yahoo.com|p|",
 
1428
  "Virgilio|search.virgilio.it|qs|","Arianna|arianna.libero.it|query|","Altavista|.altavista.com|q|","Kataweb|kataweb.it|q|",
1429
  "Il Trovatore|categorie.iltrovatore.it|query|","Il Trovatore|search.iltrovatore.it|q|","2020Search|2020search.c|us|st|pn|1|",
1430
  "abcsearch.com|abcsearch.com|terms|","100Links|100links.supereva.it|q|","Alexa|alexa.com|q|","Alltheweb|alltheweb.com|q|",
@@ -1435,7 +1559,7 @@ function wGetSE($referrer = null){
1435
  "Overture|overture.com|Keywords|","Supereva|supereva.it|q|","Teoma|teoma.com|q|","Tiscali|search-dyn.tiscali.|key|","Voil|voila.fr|kw|",
1436
  "Web|web.de|su|","Clarence|search.clarence.com|q|","Gazzetta|search.gazzetta.it|q|","PagineGialle|paginegialle.it|qs|",
1437
  "Jumpy|servizi.mediaset.it|searchWord|","ItaliaPuntoNet|italiapuntonet.net|search|","StartNow|search.startnow.|q|","Search|search.it|srctxt|",
1438
- "Search|search.com|q|");
1439
  foreach($lines as $line_num => $se) {
1440
  list($nome,$url,$key,$lang)=explode("|",$se);
1441
  if(@strpos($referrer,$url)===FALSE) continue;
@@ -1460,7 +1584,7 @@ function wGetSE($referrer = null){
1460
  }
1461
 
1462
  function wGetSpider($agent = null){
1463
- $agent=str_replace(" ","",$agent);
1464
  $key = null;
1465
  $lines = array("Wordpress Pingback/Trackback|Wordpress|", "Alexa|ia_archiver|","Ask.com/Teoma|AskJeeves/Teoma)|","Biz360|Biz360|","Naver|NaverBot|","Naver|Cowbot|","cURL|curl/|","Google|Googlebot/|",
1466
  "Google|googlebot/|","Google Images|Googlebot-Image|","LookSmart|grub-client|","Yahoo!|slurp@inktomi|","Yahoo!|Yahoo!Slurp|",
@@ -1468,7 +1592,7 @@ function wGetSpider($agent = null){
1468
  "Yahoo FeedSeeker|YahooFeedSeeker|","Java|Java/|","relevantNOISE|www.relevantnoise.com|","Voila|VoilaBot|","IRLIRLbot/|","Snapbot|Snap|",
1469
  "ichiro|ichiro|", "shelob|shelob|", "Google AdSense|Mediapartners-Google|", "Seekbot|HTTPFetcher|", "CommentTracker|CommentTracker|",
1470
  "Bloglines|bloglines|", "Italian Blog Rankings|blogbabel", "Ask Jeeves/Teoma|ask|", "Akregator|Akregator|", "NewsGatorOnline|NewsGatorOnline|", "Rojo|rojo|", "FeedTools|feedtools|",
1471
- "Feedfetcher-Google|Feedfetcher-google|", "AideRSS|AideRSS|", "psbot|psbot|", "Ruby|Rfeedfinder|", "everyfeed-spider|everyfeed-spider", "Attentio/Nutch|Attentio",
1472
  "Megite2.0|Megite.com|", "radianrss|RadianRSS|", "Sitemap Generator|Sitemap Generator|", "Feedshow|Feedshow|", "ABCdatos|ABCdatos|", "Acme.Spider|Due|", "Ahoy!|Ahoy!|",
1473
  "Alkaline|AlkalineBOT|", "appie|Appie|", "Arachnophilia|Arachnophilia|", "Araneo|Araneo/0.7|", "AraybOt|AraybOt/1.0|", "ArchitextSpider|ArchitextSpider|",
1474
  "ARIADNE|Due|", "ASpider|ASpider/0.09|", "Atomz.com|Atomz/1.0|", "AURESYS|AURESYS/1.0|", "BackRub|BackRub/*.*|", "BBot|bbot/0.100|", "Big|Big|", "Bjaaland|Bjaaland/0.5|",
@@ -1515,7 +1639,13 @@ function wGetSpider($agent = null){
1515
  "disco/Nutch|disco/Nutch", "StackRambler|StackRambler|", "MagpieRSS|MagpieRSS|", "WebAlta|WebAlta|", "NewsAlloy|NewsAlloy|",
1516
  "WikioFeedBot|WikioFeedBot|", "Strategic Board Bot |Strategic Board Bot |", "Mail.ru|Mail.ru|", "OpiDig|OpiDig|", "webcollage|webcollage|",
1517
  "R6_FeedFetcher|R6_FeedFetcher|", "UniversalFeedParser|UniversalFeedParser|", "Syndic8|Syndic8|", "BlogBot|BlogBot|", "W3C_Validator|W3C_Validator|",
1518
- "Runnk RSS aggregator|Runnk|", "RssBandit|RssBandit|");
 
 
 
 
 
 
1519
  foreach($lines as $line_num => $spider) {
1520
  list($nome,$key)=explode("|",$spider);
1521
  if(@strpos(strtolower($agent),strtolower($key))===FALSE) continue;
@@ -1595,16 +1725,6 @@ function wGetSpamRef($referrer) {
1595
  return null;
1596
  } //end function wGetSpamRef()
1597
 
1598
- //# Get current session_save_path value and return the pathname portion
1599
- //# - Helene D. 1/14/08.
1600
- function wGetSessionpath() {
1601
- $sessionpath = session_save_path();
1602
- if (strpos($sessionpath, ";") !== FALSE) {
1603
- $sessionpath = substr($sessionpath, strpos($sessionpath, ";")+1);
1604
- }
1605
- return rtrim($sessionpath,"/");
1606
- }
1607
-
1608
  function export_wassup() {
1609
  global $wpdb, $table_name;
1610
  $table_name = $wpdb->prefix . "wassup";
@@ -1750,6 +1870,7 @@ function backup_table($table, $segment = 'none') {
1750
  print $sql;
1751
  } // end backup_table()
1752
 
 
1753
  function wassup_widget_init() {
1754
 
1755
  if ( !function_exists('register_sidebar_widget') )
@@ -1776,12 +1897,12 @@ function wassup_widget($wargs) {
1776
 
1777
  // Widget TOP Searches
1778
  if ($wassup_settings['wassup_widget_search'] == 1) {
1779
- $query_det = $wpdb->get_results("SELECT search, referrer FROM $table_name WHERE search!='' GROUP BY search ORDER BY timestamp DESC LIMIT $searchlimit");
1780
  if (count($query_det) > 0) {
1781
- print "$before_title Last searched terms $after_title";
1782
  print "<ul class='$ulclass'>";
1783
  foreach ($query_det as $sref) {
1784
- print "<li>- <a href='".htmlentities($sref->referrer)."' target='_BLANK'>".stringShortener($sref->search, $chars)."</a></li>";
1785
  }
1786
  print "</ul>";
1787
  }
@@ -1789,60 +1910,66 @@ function wassup_widget($wargs) {
1789
 
1790
  // Widget TOP Referers
1791
  if ($wassup_settings['wassup_widget_ref'] == 1) {
1792
- $query_ref = $wpdb->get_results("SELECT referrer FROM $table_name WHERE searchengine='' AND referrer!='' AND referrer NOT LIKE '$wpurl%' GROUP BY referrer ORDER BY timestamp DESC LIMIT $reflimit");
1793
  if (count($query_ref) > 0) {
1794
- print "$before_title Last referers $after_title";
1795
  print "<ul class='$ulclass'>";
1796
  foreach ($query_ref as $eref) {
1797
- print "<li>- <a href='".htmlentities($eref->referrer)."' target='_BLANK'>".stringShortener(eregi_replace("http://", "", htmlentities($eref->referrer)), $chars)."</a></li>";
1798
  }
1799
  print "</ul>";
1800
  }
1801
  }
1802
 
1803
- // Widget TOP Browsers
1804
- if ($wassup_settings['wassup_widget_topbr'] == 1) {
1805
- $query_topbr = $wpdb->get_results("SELECT count(browser) as top_browser, browser FROM $table_name WHERE browser!='' AND browser NOT LIKE '%N/A%' GROUP BY browser ORDER BY top_browser DESC LIMIT $topbrlimit");
1806
- if (count($query_topbr) > 0) {
1807
- print "$before_title Top Browsers $after_title";
1808
- print "<ul class='$ulclass'>";
1809
- foreach ($query_topbr as $etopbr) {
1810
- print "<li>- ".stringShortener($etopbr->browser, $chars)."</li>";
1811
- }
1812
- print "</ul>";
1813
- }
1814
- }
1815
 
1816
- // Widget TOP Oses
1817
- if ($wassup_settings['wassup_widget_topos'] == 1) {
1818
- $query_topos = $wpdb->get_results("SELECT count(os) as top_os, os FROM $table_name WHERE os!='' AND os NOT LIKE '%N/A%' GROUP BY os ORDER BY top_os DESC LIMIT $toposlimit");
1819
- if (count($query_topos) > 0) {
1820
- print "$before_title Top OS $after_title";
1821
- print "<ul class='$ulclass'>";
1822
- foreach ($query_topos as $etopos) {
1823
- print "<li>- ".stringShortener($etopos->os, $chars)."</li>";
1824
- }
1825
- print "</ul>";
1826
- }
1827
- }
1828
 
1829
- // Widget Visitors Online
1830
- print $before_title . $title . $after_title;
1831
- print "<ul class='$ulclass'>";
1832
- $currenttot = $wpdb->get_var("SELECT COUNT(DISTINCT wassup_id) as currenttot FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date ");
1833
- $currentlogged = $wpdb->get_var("SELECT COUNT(DISTINCT wassup_id) as currentlogged FROM $table_name WHERE username!=''AND timestamp BETWEEN $from_date AND $to_date");
1834
- $currentauth = $wpdb->get_var("SELECT COUNT(DISTINCT wassup_id) as currentauth FROM $table_name WHERE comment_author!='' AND username=''AND timestamp BETWEEN $from_date AND $to_date");
1835
- if ((int)$currenttot < 10) $currenttot = "0".$currenttot;
1836
- print "<li><strong style='padding:0 4px 0 4px;background:#ddd;color:#777'>".$currenttot."</strong> visitor(s) online</li>";
1837
- if ((int)$currentlogged > 0 AND $wassup_settings['wassup_widget_loggedin'] == 1) {
1838
- if ((int)$currentlogged < 10) $currentlogged = "0".$currentlogged;
1839
- print "<li><strong style='padding:0 4px 0 4px;background:#e7f1c8;color:#777'>".$currentlogged."</strong> logged-in user(s)</li>";
1840
- }
1841
- if ((int)$currentauth > 0 AND $wassup_settings['wassup_widget_comauth'] == 1) {
1842
- if ((int)$currentauth < 10) $currentauth = "0".$currentauth;
1843
- print "<li><strong style='padding:0 4px 0 4px;background:#fbf9d3;color:#777'>".$currentauth."</strong> comment author(s)</li>";
 
 
 
 
 
 
1844
  }
1845
- print "<li style='font-size:6pt; color:#bbb;'>powered by <a style='color:#777;' href='http://www.wpwp.org' title='WassUp - Real Time Visitors Tracking'>WassUp</a></li>";
1846
  print "</ul>";
1847
  print $after_widget;
1848
  }
@@ -1851,7 +1978,7 @@ function wassup_widget_control() {
1851
  //global $_POST;
1852
  $wassup_settings = get_option('wassup_settings');
1853
 
1854
- if (isset($_POST['submit']))
1855
  {
1856
  $wassup_settings['wassup_widget_title'] = $_POST['wassup_widget_title'];
1857
  $wassup_settings['wassup_widget_ulclass'] = $_POST['wassup_widget_ulclass'];
@@ -1874,22 +2001,20 @@ function wassup_widget_control() {
1874
  ?>
1875
  <div class="wrap" style="text-align:left">
1876
  <h3>Wassup Widget</h3>
1877
- <form action="" method="post">
1878
- <p style="text-align:left"><input type="text" name="wassup_widget_title" size="20" value="<?php echo $wassup_settings['wassup_widget_title'] ?>" /> What title for the widget (default "Visitors Online")</p>
1879
- <p style="text-align:left"><input type="text" name="wassup_widget_ulclass" size="3" value="<?php echo $wassup_settings['wassup_widget_ulclass'] ?>" /> What style sheet class for &lt;ul&gt; attribute (default "links")</p>
1880
- <p style="text-align:left"><input type="text" name="wassup_widget_chars" size="3" value="<?php echo $wassup_settings['wassup_widget_chars'] ?>" /> How many characters left? (For template compatibility - default 18)</p>
1881
- <p style="text-align:left"><input type="checkbox" name="wassup_widget_loggedin" value="1"<?php if ($wassup_settings['wassup_widget_loggedin'] == 1) echo "CHECKED"; ?> /> Check if you want to show logged-in online users (default Yes)</p>
1882
- <p style="text-align:left"><input type="checkbox" name="wassup_widget_comauth" value="1" <?php if ($wassup_settings['wassup_widget_comauth'] == 1) echo "CHECKED"; ?> /> Check if you want to show comment-author online users (default Yes)</p>
1883
- <p style="text-align:left"><input type="checkbox" name="wassup_widget_search" value="1" <?php if ($wassup_settings['wassup_widget_search'] == 1) echo "CHECKED"; ?> /> Check if you want to show some last search referers (default Yes)</p>
1884
- <p style="text-align:left"><input type="text" name="wassup_widget_searchlimit" size="3" value="<?php echo $wassup_settings['wassup_widget_searchlimit'] ?>" /> How many search referers want to show (default 5)</p>
1885
- <p style="text-align:left"><input type="checkbox" name="wassup_widget_ref" value="1" <?php if ($wassup_settings['wassup_widget_ref'] == 1) echo "CHECKED"; ?> /> Check if you want to show some last external referers (default Yes)</p>
1886
- <p style="text-align:left"><input type="text" name="wassup_widget_reflimit" size="3" value="<?php echo $wassup_settings['wassup_widget_reflimit'] ?>" /> How many external referers want to show (default 5)</p>
1887
- <p style="text-align:left"><input type="checkbox" name="wassup_widget_topbr" value="1" <?php if ($wassup_settings['wassup_widget_topbr'] == 1) echo "CHECKED"; ?> /> Check if you want to show top browsers (default Yes)</p>
1888
- <p style="text-align:left"><input type="text" name="wassup_widget_topbrlimit" size="3" value="<?php echo $wassup_settings['wassup_widget_topbrlimit'] ?>" /> How many top browsers want to show (default 5)</p>
1889
- <p style="text-align:left"><input type="checkbox" name="wassup_widget_topos" value="1" <?php if ($wassup_settings['wassup_widget_topos'] == 1) echo "CHECKED"; ?> /> Check if you want to show top operating systems (default Yes)</p>
1890
- <p style="text-align:left"><input type="text" name="wassup_widget_toposlimit" size="3" value="<?php echo $wassup_settings['wassup_widget_toposlimit'] ?>" /> How many top operating systems want to show (default 5)</p>
1891
- <p style="text-align:left"><input type="submit" name="submit" value="Save Settings" /></p>
1892
- </form>
1893
  </div>
1894
  <?php
1895
  }
@@ -1899,8 +2024,8 @@ function wassup_widget_control() {
1899
  if ($wassup_settings['wassup_userlevel'] == "") {
1900
  $wassup_settings['wassup_userlevel'] = 8;
1901
  update_option('wassup_settings', $wassup_settings);
1902
- }
1903
- if ($wassup_settings['wassup_refresh'] == "") {
1904
  $wassup_settings['wassup_refresh'] = 3;
1905
  update_option('wassup_settings', $wassup_settings);
1906
  }
@@ -1933,7 +2058,7 @@ function wassup_sidebar($before_widget='', $after_widget='', $before_title='', $
1933
  print "$before_title Last searched terms $after_title";
1934
  print "<ul class='$ulclass'>";
1935
  foreach ($query_det as $sref) {
1936
- print "<li>- <a href='".$sref->referrer."' target='_BLANK'>".stringShortener($sref->search, $chars)."</a></li>";
1937
  }
1938
  print "</ul>";
1939
  }
@@ -1945,7 +2070,7 @@ function wassup_sidebar($before_widget='', $after_widget='', $before_title='', $
1945
  print "$before_title Last referers $after_title";
1946
  print "<ul class='$ulclass'>";
1947
  foreach ($query_ref as $eref) {
1948
- print "<li>- <a href='".$eref->referrer."' target='_BLANK'>".stringShortener(eregi_replace("http://", "", $eref->referrer), $chars)."</a></li>";
1949
  }
1950
  print "</ul>";
1951
  }
@@ -1957,7 +2082,7 @@ function wassup_sidebar($before_widget='', $after_widget='', $before_title='', $
1957
  print "$before_title Top Browsers $after_title";
1958
  print "<ul class='$ulclass'>";
1959
  foreach ($query_topbr as $etopbr) {
1960
- print "<li>- ".stringShortener($etopbr->browser, $chars)."</li>";
1961
  }
1962
  print "</ul>";
1963
  }
@@ -1969,17 +2094,23 @@ function wassup_sidebar($before_widget='', $after_widget='', $before_title='', $
1969
  print "$before_title Top OS $after_title";
1970
  print "<ul class='$ulclass'>";
1971
  foreach ($query_topos as $etopos) {
1972
- print "<li>- ".stringShortener($etopos->os, $chars)."</li>";
1973
  }
1974
  print "</ul>";
1975
  }
1976
  }
1977
 
 
 
 
 
 
 
 
 
 
1978
  print $before_title . $title . $after_title;
1979
  print "<ul class='$ulclass'>";
1980
- $currenttot = $wpdb->get_var("SELECT COUNT(DISTINCT wassup_id) as currenttot FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date ");
1981
- $currentlogged = $wpdb->get_var("SELECT COUNT(DISTINCT wassup_id) as currentlogged FROM $table_name WHERE username!=''AND timestamp BETWEEN $from_date AND $to_date");
1982
- $currentauth = $wpdb->get_var("SELECT COUNT(DISTINCT wassup_id) as currentauth FROM $table_name WHERE comment_author!='' AND username=''AND timestamp BETWEEN $from_date AND $to_date");
1983
  if ((int)$currenttot < 10) $currenttot = "0".$currenttot;
1984
  print "<li><strong style='padding:0 4px 0 4px;background:#ddd;color:#777'>".$currenttot."</strong> visitor(s) online</li>";
1985
  if ((int)$currentlogged > 0 AND $wassup_settings['wassup_widget_loggedin'] == 1) {
@@ -1991,7 +2122,7 @@ function wassup_sidebar($before_widget='', $after_widget='', $before_title='', $
1991
  if ((int)$currentauth < 10) $currentauth = "0".$currentauth;
1992
  print "<li><strong style='padding:0 4px 0 4px;background:#fbf9d3;color:#777'>".$currentauth."</strong> comment author(s)</li>";
1993
  }
1994
- print "<li style='font-size:6pt; color:#bbb;'>powered by <a style='color:#777;' href='http://www.wpwp.org/' title='WassUp - Real Time Visitors Tracking'>WassUp</a></li>";
1995
  print "</ul>";
1996
  print $after_widget;
1997
  }
3
  Plugin Name: WassUp
4
  Plugin URI: http://www.wpwp.org
5
  Description: Wordpress plugin to analyze your visitors traffic with real time stats, chart and a lot of chronological informations. It has sidebar Widget support to show current online visitors and other statistics.
6
+ Version: 1.4.8
7
  Author: Michele Marcucci
8
  Author URI: http://www.michelem.org/
9
 
16
  if (preg_match('#'.basename(__FILE__) .'#', $_SERVER['PHP_SELF'])) {
17
  die('Permission Denied! You are not allowed to call this page directly.');
18
  }
19
+ $version = "1.4.8";
20
  define('WASSUPFOLDER', dirname(plugin_basename(__FILE__)), TRUE);
21
+ require_once(dirname(__FILE__).'/lib/wassup.class.php');
22
  require_once(dirname(__FILE__).'/lib/main.php');
23
  $wpurl = get_bloginfo('wpurl');
24
 
26
  export_wassup();
27
  }
28
 
 
 
 
 
29
  global $wp_version;
30
+
31
+ /*
32
+ if (!defined('SECRET_KEY')) {
33
+ function wassup_warning() {
34
+ echo "
35
+ <div id='wassup-warning' class='updated fade-ff0000'><p><strong style='color:#c00;padding:5px;'>".__("Sorry, Wassup requires SECRET_KEY constant declared in wp-config.php... Please read <a href='http://www.wpwp.org/download'>documentation</a> for more info...","wassup").".</strong></p></div>";
36
+ }
37
+ add_action('admin_notices', 'wassup_warning');
38
+ return;
39
+ }
40
+ */
41
+ //#This works only in WP2.2 or higher
42
+ if (version_compare($wp_version, '2.2', '<')) {
43
+ wp_die( '<strong style="color:#c00;background-color:#dff;padding:5px;">'.__("Sorry, Wassup requires WordPress 2.2 or higher to work","wassup").'.</strong>');
44
  } else {
45
+ register_activation_hook(__FILE__, 'wassup_install');
46
+ register_deactivation_hook(__FILE__, 'wassup_uninstall');
47
  add_action('admin_head', 'add_wassup_css');
 
48
  add_action('wp_head', 'add_wassup_meta_info');
49
+ add_action('init', 'wassup_init');
50
  add_action("widgets_init", "wassup_widget_init");
51
  add_action('admin_menu', 'wassup_add_pages');
52
  add_action('send_headers', 'wassupAppend');
53
  }
54
 
55
+ //#add initial options and create table when Wassup activated
56
+ // -Helene D. 2/26/08.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  function wassup_install() {
58
+ global $wpdb;
59
+
60
+ //### Add/update wassup settings in Wordpress options table
61
+ $wassup_options = new wassupOptions; //#settings initialized here
62
+ //
63
+ //### For upgrade of Wassup, manually initialize any new settings
64
+ //# initialize settings for 'spamcheck', 'refspam', and 'spam'
65
+ if (!isset($wassup_options->wassup_spamcheck)) {
66
+ $wassup_options->wassup_spamcheck = "0";
67
+ //#set wassup_spamcheck=0 if wassup_refspam=0 and wassup_spam=0
68
+ if (!isset($wassup_options->wassup_spam) && !isset($wassup_options->wassup_refspam)) {
69
+ $wassup_options->wassup_spam = "1";
70
+ $wassup_options->wassup_refspam = "1";
71
+ } elseif ( $wassup_options->wassup_spam == "0" && $wassup_options->wassup_refspam == "0" ) {
72
+ $wassup_options->wassup_spamcheck = "0";
73
+ }
74
+ }
 
75
  //# update wassup settings for 'savepath' (default is null)
76
+ if (!isset($wassup_options->wassup_savepath)) {
77
+ $wassup_options->wassup_savepath = null;
 
78
  }
79
+ //# display google chart by default for upgrades from 1.4.4
80
+ if (!isset($wassup_options->wassup_chart)) {
81
+ $wassup_options->wassup_chart = 1;
82
+ }
83
+ //$wassup_options->wassup_savepath = "/fakedirectory"; //#debug
84
+ $wassup_options->saveSettings();
85
+
86
+ //### Detect problems with WassUp install and show warning
87
+ //#
88
+ //#Check for problems with 'session_savepath' and disable
89
+ //# recording, if found. -Helene D. 2/24/08
90
+ $sessionpath = $wassup_options->getSavepath();
91
+ if ($wassup_options->isWritableFolder($sessionpath) == false) {
92
+ if ($wassup_options->wassup_active == "1") {
93
+ $wassup_options->wassup_active = "0";
94
+ $wassup_options->wassup_alert_message = __('WassUp has detected a problem with "session.save_path" setting in your Wordpress/PHP configuration. Statistics logging has been disabled as a result. To fix, go to admin menu, "Wassup-->Options-->Manage Files & Database" and modify "Temporary files location folder".','wassup');
95
+ } else {
96
+ $wassup_options->wassup_alert_message = __('WassUp has detected a problem with "session.save_path" setting in your Wordpress/PHP configuration. Please fix by modifying "Temporary files location folder" in admin menu, "Wassup-->Options-->Manage Files & Database".','wassup');
97
+ }
98
+ $wassup_options->saveSettings();
99
+ }
100
+ //# TODO:
101
+ //###Detect known incompatible plugins like "wp_cache" and disable
102
+ //# recordings and show warning message...
103
 
104
+ //### Create/upgrade wassup table
105
+ $table_name = $wpdb->prefix . "wassup";
106
+ if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
107
+ CreateTable();
108
+ } else {
109
+ UpdateTable();
110
+ }
111
  } //#end function wassup_install
112
 
113
+ $wassup_settings = get_option('wassup_settings'); //temp only..
114
+ $wassup_options = new wassupOptions;
115
+ //$wassup_options->loadSettings(); //done automatically
116
+
117
+ //#Completely remove all wassup tables and options from Wordpress when
118
+ //# the 'wassup_uninstall' option is set and plugin is deactivated.
119
+ //# -Helene D. 2/26/08
120
+ function wassup_uninstall() {
121
+ global $wassup_options, $wpdb;
122
+ if ($wassup_options->wassup_uninstall == "1") {
123
+ $table_name = $wpdb->prefix . "wassup";
124
+ $wpdb->query("DROP TABLE $table_name");
125
+ $wassup_options->deleteSettings();
126
+ }
127
+ } //#end function wassup_uninstall
128
 
129
  function add_wassup_meta_info() {
130
  global $version;
131
  print '<meta name="wassup-version" content="'.$version.'" />';
132
  }
133
 
134
+ //# Load jquery AJAX library and dependent javascripts plus the
135
+ //# language/localization files for Wassup admin menus...
136
+ function wassup_init() {
137
  global $wpurl;
138
+
139
+ //### Add wassup scripts...
140
  if (stristr($_GET['page'],'wassup') !== FALSE) {
141
  if ( function_exists('wp_deregister_script')) {
142
  wp_deregister_script('jquery'); //removes old jquery vers.
153
  wp_enqueue_script('thickbox', $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/thickbox/thickbox.js', array('jquery'), '3');
154
  }
155
  }
156
+
157
+ //Loading language file...
158
+ //Doesn't work if the plugin file has its own directory.
159
+ //Let's make it our way... load_plugin_textdomain() searches only in the wp-content/plugins dir.
160
+ $currentLocale = get_locale();
161
+ if(!empty($currentLocale)) {
162
+ $moFile = dirname(__FILE__) . "/language/" . $currentLocale . ".mo";
163
+ if(@file_exists($moFile) && is_readable($moFile)) load_textdomain('wassup', $moFile);
164
+ }
165
  }
166
 
167
  //Add the wassup stylesheet and other javascripts...
168
  function add_wassup_css() {
169
+ global $wpurl, $wassup_options;
 
170
  $plugin_page = attribute_escape($_GET['page']);
171
+
172
  if (stristr($plugin_page,'wassup') !== FALSE) { $plugin_page="wassup"; }
173
  //Add css and javascript to wassup menu pages only...
174
  if ($plugin_page == "wassup") {
175
+ //$wassup_settings = get_option('wassup_settings');
176
+ echo '<link rel="stylesheet" href="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/wassup.css'.'" type="text/css" />';
177
+ echo '<link rel="stylesheet" href="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/thickbox/thickbox.css'.'" type="text/css" />';
178
+ echo '<link rel="stylesheet" href="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/ui.tabs.css'.'" type="text/css" />';
 
 
 
179
 
180
  if ($_GET['page'] != "wassup-options" AND $_GET['page'] != "wassup-spy") { ?>
181
  <script type='text/javascript'>
183
  function selfRefresh(){
184
  location.href='?<?php print $_SERVER['QUERY_STRING']; ?>';
185
  }
186
+ setTimeout('selfRefresh()', <?php print ($wassup_options->wassup_refresh * 60000); ?>);
187
  //]]>
188
  </script>
189
 
219
  //<![CDATA[
220
  window.onload=WindowLoad;
221
  function WindowLoad(event) {
222
+ ActivateCountDown("CountDownPanel", <?php print ($wassup_options->wassup_refresh * 60); ?>);
223
  }
224
  //]]>
225
  </script>
240
  $("a.deleteID").click(function(){
241
  var id = $(this).attr('id');
242
  $.ajax({
243
+ url: "<?php echo $wpurl; ?>/wp-content/plugins/<?php echo WASSUPFOLDER; ?>/lib/action.php?action=delete&whash=<?php echo $whash; ?>&id=" + id,
244
  async: false
245
  })
246
  $("div.delID" + id).fadeOut("slow");
248
  });
249
  $("a.show-search").toggle(function(){
250
  $("div.search-ip").slideDown("slow");
251
+ $("a.show-search").html("<a href='#' class='show-search'><?php _e("Hide Search", "wassup") ?></a>");
252
  },function() {
253
  $("div.search-ip").slideUp("slow");
254
+ $("a.show-search").html("<a href='#' class='show-search'><?php _e("Search", "wassup") ?></a>");
255
  return false;
256
  });
257
  $("a.show-topten").toggle(function(){
258
  $("div.topten").slideDown("slow");
259
+ $("a.show-topten").html("<a href='#' class='show-topten'><?php _e("Hide TopTen", "wassup") ?></a>");
260
  },function() {
261
  $("div.topten").slideUp("slow");
262
+ $("a.show-topten").html("<a href='#' class='show-topten'><?php _e("Show TopTen", "wassup") ?></a>");
263
  return false;
264
  });
265
 
266
  $("a.toggle-all").toggle(function() {
267
  $("div.togglenavi").slideDown("slow");
268
+ $("a.toggle-all").html("<a href='#' class='toggle-all'><?php _e("Collapse All", "wassup") ?></a>");
269
  },function() {
270
  $("div.togglenavi").slideUp("slow");
271
+ $("a.toggle-all").html("<a href='#' class='toggle-all'><?php _e("Expand All", "wassup") ?></a>");
272
  return false;
273
  });
274
  $("a.toggle-allcrono").toggle(function() {
275
  $("div.togglecrono").slideUp("slow");
276
+ $("a.toggle-allcrono").html("<a href='#' class='toggle-allcrono'><?php _e("Expand Cronology", "wassup") ?></a>");
277
  },function() {
278
  $("div.togglecrono").slideDown("slow");
279
+ $("a.toggle-allcrono").html("<a href='#' class='toggle-allcrono'><?php _e("Collapse Cronology", "wassup") ?></a>");
280
  return false;
281
  });
282
  }); //end jQuery(document).ready
302
  </script>
303
 
304
  <?php
305
+ if ($_GET['page'] == "wassup-options") {
306
+ //#Current active tabs are indentified after page reload with
307
+ //# either $_GET['tab']=N or $_POST['submit-optionsN'] where
308
+ //# N=tab number. The tab is then activated directly in
309
+ //# "settings.php" with <li class="ui-tabs-selected">
310
+ ?>
311
+ <script type="text/javascript">
312
+ //<![CDATA[
313
+ jQuery(document).ready(function($) {
314
+ $('#tab_container > ul').tabs({
315
+ fx: { obacity: 'toggle', duration: 'fast' } });
316
+ });
317
+ //]]>
318
+ </script>
319
+ <?php
320
+ } elseif ($_GET['page'] == "wassup-spy") {
321
  ?>
322
  <script type="text/javascript">
323
+ //<![CDATA[
324
  jQuery(document).ready(function($){
325
  $('#spyContainer > div:gt(4)').fadeEachDown(); // initial fade
326
  $('#spyContainer').spy({
327
  limit: 10,
328
  fadeLast: 5,
329
+ ajax: '<?php echo $wpurl."/wp-content/plugins/".WASSUPFOLDER."/lib/action.php?action=spy&whash=$whash"; ?>',
330
  timeout: 2000,
331
  'timestamp': myTimestamp,
332
  fadeInSpeed: 1100 });
355
 
356
  //put WassUp in the top-level admin menu and add submenus....
357
  function wassup_add_pages() {
358
+ global $wassup_options;
359
+ $userlevel = $wassup_options->wassup_userlevel;
360
  if (empty($userlevel)) { $userlevel = 8; }
361
  // add the default submenu first (important!)...
362
  add_submenu_page(WASSUPFOLDER, __('Visitor Details', 'wassup'), __('Visitor Details', 'wassup'), $userlevel, WASSUPFOLDER, 'WassUp'); //<-- WASSUPFOLDER needed here for directory names that include a version number...
368
  }
369
 
370
  function WassUp() {
371
+ global $wpdb, $version, $wpurl, $wassup_options;
372
+ /*
373
+ if ( !defined('SECRET_KEY') ) {
374
+ echo "<div id='wassup-warning' class='updated fade-ff0000' style='padding:25px;'><p><strong style='color:#c00;'>".__("Sorry, Wassup requires SECRET_KEY constant declared in wp-config.php... Please read <a href='http://www.wpwp.org/download'>documentation</a> for more info...","wassup").".</strong></p></div>";
375
+ }
376
+ $hash = wp_hash(SECRET_KEY);
377
+ */
378
+ $table_name = $wpdb->prefix . "wassup";
379
+ $wassup_options->loadSettings(); //needed in case "update_option is run elsewhere in wassup (widget)
380
+
381
  // RUN THE SAVE/RESET OPTIONS
382
+ $admin_message="";
383
+ if (isset($_POST['submit-options']) ||
384
+ isset($_POST['submit-options2']) ||
385
+ isset($_POST['submit-options3'])) {
386
  if ($_POST['wassup_remind_flag'] == 1 AND $_POST['wassup_remind_mb'] == "") {
387
+ $wassup_options->wassup_remind_flag = $_POST['wassup_remind_flag'];
388
+ $wassup_options->wassup_remind_mb = 10;
389
  } else {
390
+ $wassup_options->wassup_remind_flag = $_POST['wassup_remind_flag'];
391
+ $wassup_options->wassup_remind_mb = $_POST['wassup_remind_mb'];
392
  }
393
+ $wassup_options->wassup_active = $_POST['wassup_active'];
394
+ $wassup_options->wassup_chart_type = $_POST['wassup_chart_type'];
395
+ $wassup_options->wassup_loggedin = $_POST['wassup_loggedin'];
396
+ $wassup_options->wassup_spider = $_POST['wassup_spider'];
397
+ $wassup_options->wassup_attack = $_POST['wassup_attack'];
398
+ $wassup_options->wassup_spamcheck = $_POST['wassup_spamcheck'];
399
+ $wassup_options->wassup_spam = $_POST['wassup_spam'];
400
+ $wassup_options->wassup_refspam = $_POST['wassup_refspam'];
401
+ $wassup_options->wassup_exclude = $_POST['wassup_exclude'];
402
+ $wassup_options->wassup_exclude_url = $_POST['wassup_exclude_url'];
403
+ $wassup_options->delete_auto = $_POST['delete_auto'];
404
+ $wassup_options->delete_auto_size = $_POST['delete_auto_size'];
405
+ $wassup_options->wassup_screen_res = $_POST['wassup_screen_res'];
406
+ $wassup_options->wassup_refresh = $_POST['wassup_refresh'];
407
+ $wassup_options->wassup_userlevel = $_POST['wassup_userlevel'];
408
+ $wassup_options->wassup_default_type = $_POST['wassup_default_type'];
409
+ $wassup_options->wassup_default_limit = $_POST['wassup_default_limit'];
410
+ if ( $_POST['wassup_savepath'] != $wassup_options->wassup_savepath ) {
411
+ if (empty($_POST['wassup_savepath']) || rtrim($_POST['wassup_savepath'],"/") == $wassup_options->getSessionpath()) {
412
+ $wassup_options->wassup_savepath = NULL;
413
  } else {
414
+ $wassup_options->setSavepath($_POST['wassup_savepath']);
415
  }
416
  }
417
+ if ($wassup_options->saveSettings()) {
418
+ $admin_message = __("Wassup options updated successfully","wassup")."." ;
419
+ }
420
+ } elseif (isset($_POST['submit-options4'])) { //uninstall checkbox
421
+ $wassup_options->wassup_uninstall = $_POST['wassup_uninstall'];
422
+ if ($wassup_options->saveSettings()) {
423
+ $admin_message = __("Wassup uninstall option updated successfully","wassup")."." ;
424
+ }
425
  } elseif (isset($_POST['submit-spam'])) {
426
+ $wassup_options->wassup_spamcheck = $_POST['wassup_spamcheck'];
427
+ $wassup_options->wassup_spam = $_POST['wassup_spam'];
428
+ $wassup_options->wassup_refspam = $_POST['wassup_refspam'];
429
+ if ($wassup_options->saveSettings()) {
430
+ $admin_message = __("Wassup spam options updated successfully","wassup")."." ;
431
+ }
432
+ } elseif (isset($_POST['reset-to-default'])) {
433
+ $wassup_options->loadDefaults();
434
+ if ($wassup_options->saveSettings()) {
435
+ $admin_message = __("Wassup options updated successfully","wassup")."." ;
436
+ }
437
+ }
438
 
439
+ //#sets current tab style for Wassup admin submenu?
440
  if ($_GET['page'] == "wassup-spy") {
441
  $class_spy="class='current'";
442
  } elseif ($_GET['page'] == "wassup-options") {
448
  }
449
 
450
  //for stringShortener calculated values and max-width...-Helene D. 11/27/07, 12/6/07
451
+ if (!empty($wassup_options->wassup_screen_res)) {
452
+ $screen_res_size = (int) $wassup_options->wassup_screen_res;
453
  } else {
454
  $screen_res_size = 670;
455
  }
456
  $max_char_len = ($screen_res_size)/10;
457
  $screen_res_size = $screen_res_size+20; //for wrap margins...
458
 
 
 
 
 
 
459
  //for generating page link urls....
460
  //$wpurl = get_bloginfo('wpurl'); //global
461
  $siteurl = get_bloginfo('siteurl');
462
 
463
+ //#display an admin message or an alert. This must be above "wrap"
464
+ //# div. -Helene D. 2/26/08.
465
+ if (!empty($admin_message)) {
466
+ $wassup_options->showMessage($admin_message);
467
+ } elseif (!empty($wassup_options->wassup_alert_message)) {
468
+ $wassup_options->showMessage();
469
+ //#show alert message only once, so remove it here...
470
+ $wassup_options->wassup_alert_message = "";
471
+ $wassup_options->saveSettings();
472
+ }
473
+
474
+ //moved max-width to single "wrap" div and removed it from
475
+ // the individual spans and divs in style.php... ?>
476
+ <div class="wrap" style="max-width:<?php echo $screen_res_size; ?>px;" >
477
+
478
+ <?php // HERE IS THE VISITORS ONLINE VIEW
479
+ if ($_GET['page'] == "wassup-online") { ?>
480
+ <h2><?php _e("Current Visitors Online", "wassup"); ?></h2>
481
+ <p class="legend"><?php echo __("Legend", "wassup").': <span class="box-log">&nbsp;&nbsp;</span> '.__("Logged-in Users", "wassup").' <span class="box-aut">&nbsp;&nbsp;</span> '.__("Comments Authors", "wassup").' <span class="box-spider">&nbsp;&nbsp;</span> '.__("Spiders/bots", "wassup"); ?></p><br />
482
+ <p class="legend"><a href="#" class="toggle-all"><?php _e("Expand All","wassup"); ?></a></p>
483
+ <?php
484
  $to_date = wassup_get_time();
485
  $from_date = strtotime('-3 minutes', $to_date);
 
 
 
486
  $currenttot = $wpdb->get_var("SELECT COUNT(DISTINCT wassup_id) as currenttot FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date");
487
  $currenttot = $currenttot+0; //set to integer
488
+ print "<p class='legend'>".__("Visitors online", "wassup").": <strong>".$currenttot."</strong></p><br />";
489
  if ($currenttot > 0) {
490
  $qryC = $wpdb->get_results("SELECT id, wassup_id, max(timestamp) as max_timestamp, ip, hostname, searchengine, urlrequested, agent, referrer, spider, username, comment_author FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date GROUP BY ip ORDER BY max_timestamp DESC");
491
  foreach ($qryC as $cv) {
500
  $referrer = '<a href="'.$cv->referrer.'" target=_"BLANK">'.stringShortener($cv->referrer, round($max_char_len*.9,0)).'</a>';
501
  }
502
  } else {
503
+ $referrer = __("From your blog", "wassup");
504
  }
505
  } else {
506
+ $referrer = __("Direct hit", "wassup");
507
  }
508
  $numurl = $wpdb->get_var("SELECT COUNT(DISTINCT id) as numurl FROM $table_name WHERE wassup_id='".$cv->wassup_id."'");
509
  ?>
521
  <?php // User is logged in or is a comment's author
522
  if ($cv->username != "" OR $cv->comment_author != "") {
523
  if ($cv->username != "") {
524
+ $Ousername = '<li class="users"><span class="indent-li-agent">'.__("LOGGED IN USER", "wassup").': <strong>'.$cv->username.'</strong></span></li>';
525
+ $Ocomment_author = '<li class="users"><span class="indent-li-agent">'.__("COMMENT AUTHOR", "wassup").': <strong>'.$cv->comment_author.'</strong></span></li>';
526
  $unclass = "userslogged";
527
  } elseif ($cv->comment_author != "") {
528
+ $Ocomment_author = '<li class="users"><span class="indent-li-agent">'.__("COMMENT AUTHOR", "wassup").': <strong>'.$cv->comment_author.'</strong></span></li>';
529
  $unclass = "users";
530
  }
531
  ?>
558
  print '</div>';
559
  print '<p class="sum-footer"></p>';
560
  } //end foreach qryC
561
+ } //end if currenttot ?>
562
+ <br /><p class="legend"><a href="#" class="toggle-all"><?php _e("Expand All", "wassup"); ?></a></p>
563
 
564
+ <?php // HERE IS THE SPY MODE VIEW
565
+ } elseif ($_GET['page'] == "wassup-spy") { ?>
566
+ <h2><?php _e("SPY Visitors", "wassup"); ?></h2>
567
+ <p class="legend"><?php echo __("Legend", "wassup").': <span class="box-log">&nbsp;&nbsp;</span> '.__("Logged-in Users", "wassup").' <span class="box-aut">&nbsp;&nbsp;</span> '.__("Comments Authors", "wassup").' <span class="box-spider">&nbsp;&nbsp;</span> '.__("Spiders/bots", "wassup"); ?></p><br />
568
+ <div>
569
+ <a href="#?" onclick="return pauseSpy();"><span id="spy-pause"><?php _e("Pause", "wassup"); ?></span></a>
570
+ <a href="#?" onclick="return playSpy();"><span id="spy-play"><?php _e("Play", "wassup"); ?></span></a>
571
+ <br />&nbsp;<br /></div>
572
+ <div id="spyContainer">
573
+ <?php
574
+ //display the last few hits here. The rest will be added by spy.js
575
  $to_date = (wassup_get_time()-2);
576
  $from_date = ($to_date - 12*(60*60)); //display last 10 visits in 12 hours...
577
+ spyview($from_date,$to_date,10); ?>
578
+ </div><br />
 
579
 
580
+ <?php // HERE IS THE OPTIONS VIEW
581
  } elseif($_GET['page'] == "wassup-options") {
582
  //#moved content to external include file, "settings.php"
583
  //# to make "wassup" code easier to read and modify
585
  include(dirname(__FILE__).'/lib/settings.php'); ?>
586
 
587
  <?php // HERE IS THE MAIN/DETAILS VIEW
588
+ } else { ?>
589
+ <h2><?php _e("Latest hits", "wassup"); ?></h2>
590
+ <?php if ($wassup_options->wassup_active != 1) { ?>
591
+ <p style="color:red; font-weight:bold;"><?php _e("WassUp recording is disabled", "wassup"); ?></p>
592
+ <?php }
593
 
594
+ $res = (int) $wassup_options->wassup_screen_res;
 
595
  if (empty($res)) $res=620;
596
  elseif ($res < 800) $res=620;
597
  elseif ($res < 1024) $res=740;
598
  elseif ($res < 1200) $res=1000;
599
  else $res=1000;
600
+
601
+ //## GET parameters that change options settings
602
+ if (isset($_GET['wchart']) || isset($_GET['wmark'])) {
603
+ if (isset($_GET['wchart'])) {
604
+ if ($_GET['wchart'] == 0) {
605
+ $wassup_options->wassup_chart = 0;
606
+ } else {
607
+ $wassup_options->wassup_chart = 1;
608
+ }
609
+ }
610
+ if (isset($_GET['wmark'])) {
611
+ if ($_GET['wmark'] == 0) {
612
+ $wassup_options->wmark = "0";
613
+ $wassup_options->wip = "";
614
+ } else {
615
+ $wassup_options->wmark = "1";
616
+ $wassup_options->wip = attribute_escape($_GET['wip']);
617
+ }
618
+ }
619
+ $wassup_options->saveSettings();
620
  }
621
+
622
+ //## GET params that filter detail display
623
+ //
624
+ //## Filter detail list by date range...
625
+ $to_date = wassup_get_time();
626
+ if (isset($_GET['last']) && $_GET['last'] != "") {
627
+ $last = htmlentities(attribute_escape($_GET['last']));
628
  } else {
629
+ $last = 1;
630
  }
631
+ $from_date = strtotime('-'.$last.' day', $to_date);
632
 
633
+ //## Filter detail lists by visitor type...
634
+ if (isset($_GET['type'])) {
 
635
  $type = htmlentities(attribute_escape($_GET['type']));
636
+ } elseif ($wassup_options->wassup_default_type != '') {
637
+ $type = $wassup_options->wassup_default_type;
638
  }
639
+ $whereis="";
640
  if ($type == 'spider') {
641
  $whereis = " AND spider!=''";
642
  } elseif ($type == 'nospider') {
643
  $whereis = " AND spider=''";
644
+ } elseif ($type == 'spam') {
645
+ $whereis = " AND spam>0";
646
+ } elseif ($type == 'nospam') {
647
+ $whereis = " AND spam=0";
648
+ } elseif ($type == 'nospamspider') {
649
+ $whereis = " AND spam=0 AND spider=''";
650
  } elseif ($type == 'searchengine') {
651
  $whereis = " AND searchengine!='' AND search!=''";
652
  } elseif ($type == 'referrer') {
657
  $whereis = " AND username!=''";
658
  }
659
 
660
+ //## Filter detail lists by a specific page and number
661
+ //# of items per page...
662
+ //#number of items on page
663
+ $items = 10; //default
664
+ if (isset($_GET['limit']) && is_numeric($_GET['limit'])) {
665
+ //$items = htmlentities(attribute_escape($_GET['limit']));
666
+ $items = $_GET['limit'];
667
+ } elseif ($wassup_options->wassup_default_limit != '') {
668
+ $items = $wassup_options->wassup_default_limit;
669
+ }
670
+ if ((int)$items < 1 ) { $items = 10; }
671
+ //# current page selections
672
+ if (isset($_GET['pages']) && is_numeric($_GET['pages'])) {
673
+ $pages = (int)$_GET['pages'];
674
+ } else {
675
+ $pages = 1;
676
+ }
677
+ if ( $pages > 1 ) {
678
  $limit = " LIMIT ".(($pages-1)*$items).",$items";
679
  } else {
680
  $limit = " LIMIT $items";
681
  }
682
 
683
+ //## Filter detail lists by a searched item
684
+ $search = attribute_escape($_GET['search']);
 
 
685
 
686
  // Instantiate class to count items
687
  $Tot = New MainItems;
692
  $Tot->Limit = $limit;
693
  $Tot->WpUrl = $wpurl;
694
 
695
+ $itemstot = $Tot->calc_tot("count", $search, null, "DISTINCT");
696
+ $pagestot = $Tot->calc_tot("count", $search, null, null);
697
+ $spamtot = $Tot->calc_tot("count", $search, "AND spam>0");
698
  // Check if some records was marked
699
+ if ($wassup_options->wmark == "1") {
700
+ $markedtot = $Tot->calc_tot("count", $search, "AND ip LIKE '%".$wassup_options->wip."%'", "DISTINCT");
 
701
  }
702
+ // Check if some records was searched
703
+ if (!empty($search)) {
704
+ $searchtot = $Tot->calc_tot("count", $search, null, "DISTINCT");
 
 
 
 
 
705
  }
706
+
707
  // DELETE EVERY RECORD MARKED BY IP
708
+ if ($_GET['deleteMARKED'] == "1") {
709
  $rec_deleted = $wpdb->get_var("SELECT COUNT(ip) as deleted FROM $table_name WHERE ip='".urlencode(attribute_escape($_GET['dip']))."'");
710
+ if (method_exists($wpdb,'prepare')) {
711
+ $wpdb->query($wpdb->prepare("DELETE FROM $table_name WHERE ip='%s'", urlencode(attribute_escape($_GET['dip']))));
712
+ } else {
713
+ $wpdb->query("DELETE FROM $table_name WHERE ip='".urlencode(attribute_escape($_GET['dip']))."'");
714
+ }
715
+ echo '<p><strong>'.$rec_deleted.' '.__('records deleted','wassup').'</strong></p>';
716
+ } ?>
717
+ <form><table width="100%">
718
+ <tr>
719
+ <td>
720
+ <p class="legend">
721
+ <?php if ($wassup_options->wassup_chart == "1") { ?>
722
+ <a href="<?php echo '?page='.WASSUPFOLDER.'&wchart=0&last='.$last.'&limit='.$_GET['limit'].'&type='.$_GET['type'].'&search='.$_GET['search'].'&pages='.$_GET['pages']; ?>" style="text-decoration:none;">
723
+ <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/chart_delete.png" style="padding:0px 6px 0 0;" alt="'.__('hide chart','wassup').'" title="'.__('Hide the chart and site usage','wassup'); ?>" /></a>
724
+ <?php } else { ?>
725
+ <a href="<?php echo '?page='.WASSUPFOLDER.'&wchart=1&last='.$last.'&limit='.$_GET['limit'].'&type='.$_GET['type'].'&search='.$_GET['search'].'&pages='.$_GET['pages']; ?>" style="text-decoration:none;">
726
+ <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/chart_add.png" style="padding:0px 6px 0 0;" alt="'.__('show chart','wassup').'" title="'.__('Show the chart and site usage','wassup'); ?>" /></a>
727
+ <?php }
728
+
729
+ //## Show selectable detail filters...
730
+ $new_limit = eregi_replace("\&limit=".$_GET['limit']."", "", $_SERVER['QUERY_STRING']);
731
+ $new_last = eregi_replace("\&last=".$_GET['last']."", "", $_SERVER['QUERY_STRING']);
732
+ _e('Summary for the last','wassup'); ?>
733
+ <select style="font-size: 11px;" name="last" onChange="window.location.href=this.options[this.selectedIndex].value;">
734
+ <?php echo "
735
+ <option value='?$new_last&last=1'".($_GET['last'] == 1 ? " SELECTED" : "").">".__('24 hours','wassup')."</option>
736
+ <option value='?$new_last&last=7'".($_GET['last'] == 7 ? " SELECTED" : "").">".__('7 days','wassup')."</option>
737
+ <option value='?$new_last&last=30'".($_GET['last'] == 30 ? " SELECTED" : "").">".__('1 month','wassup')."</option>
738
+ <option value='?$new_last&last=365'".($_GET['last'] == 365 ? " SELECTED" : "").">".__('1 year','wassup')."</option>"; ?>
739
+ </select></p>
740
+ </td>
741
+ <td align="right"><p style="font-size: 11px;"><?php _e('Items per page','wassup'); ?>: <select name="navi" style="font-size: 11px;" onChange="window.location.href=this.options[this.selectedIndex].value;">
742
+ <?php echo "
743
+ <option value='?$new_limit&limit=10'".($items == 10 ? " SELECTED" : "").">10</option>
744
+ <option value='?$new_limit&limit=20'".($items == 20 ? " SELECTED" : "").">20</option>
745
+ <option value='?$new_limit&limit=50'".($items == 50 ? " SELECTED" : "").">50</option>
746
+ <option value='?$new_limit&limit=100'".($items == 100 ? " SELECTED" : "").">100</option>"; ?>
747
+ </select> - <?php _e('Show items by','wassup'); ?>: <select style="font-size: 11px;" name="type" onChange="window.location.href=this.options[this.selectedIndex].value;">
748
+ <option value="?page=<?php echo WASSUPFOLDER; ?>">--</option>
749
+ <?php echo "
750
+ <option value='?page=".WASSUPFOLDER."&type=spider'".($type == "spider" ? " SELECTED" : "").">".__('Spider','wassup')."</option>
751
+ <option value='?page=".WASSUPFOLDER."&type=nospider'".($type == "nospider" ? " SELECTED" : "").">".__('NO Spider','wassup')."</option>
752
+ <option value='?page=".WASSUPFOLDER."&type=spam'".($type == "spam" ? " SELECTED" : "").">".__('Spam','wassup')."</option>
753
+ <option value='?page=".WASSUPFOLDER."&type=nospam'".($type == "nospam" ? " SELECTED" : "").">".__('NO Spam','wassup')."</option>
754
+ <option value='?page=".WASSUPFOLDER."&type=nospamspider'".($type == "nospamspider" ? " SELECTED" : "").">".__('NO Spam NO Spider','wassup')."</option>
755
+ <option value='?page=".WASSUPFOLDER."&type=loggedin'".($type == "loggedin" ? " SELECTED" : "").">".__('Users logged in','wassup')."</option>
756
+ <option value='?page=".WASSUPFOLDER."&type=comauthor'".($type == "comauthor" ? " SELECTED" : "").">".__('Comment authors','wassup')."</option>
757
+ <option value='?page=".WASSUPFOLDER."&type=searchengine'".($type == "searchengine" ? " SELECTED" : "").">".__('Referer from search engine','wassup')."</option>
758
+ <option value='?page=".WASSUPFOLDER."&type=referrer'".($type == "referrer" ? " SELECTED" : "").">".__('Referer from ext link','wassup')."</option>
759
+ <option value='?page=".WASSUPFOLDER."&type=everything'".($type == "everything" ? " SELECTED" : "").">".__('Everything','wassup')."</option>"; ?>
760
+ </select>
761
+ </p>
762
+ </td>
763
+ </tr>
764
+ </table>
765
+ </form>
766
+
767
+ <?php // Print Site Usage
768
+ if ($wassup_options->wassup_chart == 1) { ?>
769
+ <div class='main-tabs'>
770
+ <div id='usage'>
771
+ <ul>
772
+ <li><span style="border-bottom:2px solid #0077CC;"><?php echo $itemstot; ?></span> <small><?php _e('Visits','wassup'); ?></small></li>
773
+ <li><span style="border-bottom:2px dashed #FF6D06;"><?php echo $pagestot; ?></span> <small><?php _e('Pageviews','wassup'); ?></small></li>
774
+ <li><span><?php echo @number_format(($pagestot/$itemstot), 2); ?></span> <small><?php _e('Pages/Visits','wassup'); ?></small></li>
775
+ <?php // Print spam usage only if enabled
776
+ if ($wassup_options->wassup_spamcheck == 1) { ?>
777
+ <li><span><a href="#TB_inline?height=180&width=300&inlineId=hiddenspam" class="thickbox"><?php echo $spamtot; ?></a></span> <span>(<?php echo @number_format(($spamtot*100/$pagestot), 2); ?>%)</span> <small><?php _e('Spams','wassup'); ?></small></li>
778
+ <?php } ?>
779
+ </ul>
780
+ <?php
781
+ // Print the Google chart!
782
+ if ($pagestot > 20) {
783
+ echo $Tot->TheChart($last, $res, attribute_escape($_GET['search']), $wassup_options->wassup_chart_type)."";
784
+ } else {
785
+ echo '<div id="placeholder" align="center"><p style="padding-top:50px;">'.__('Too few records to print chart','wassup').'...</p></div>';
786
+ } ?>
787
+ </div>
788
+ </div>
789
+ <?php } //end if wassup_chart == 1
790
 
791
  if ($_GET['limit'] == 10 OR $_GET['limit'] == 20 OR !isset($_GET['limit'])) {
792
  $expcol = '
793
  <table width="100%"><tr>
794
+ <td align="left" class="legend"><a href="#" class="toggle-all">'.__('Expand All','wassup').'</a></td>
795
+ <td align="right" class="legend"><a href="#" class="toggle-allcrono">'.__('Collapse Chronology','wassup').'</a></td>
796
  </tr></table><br />';
797
  }
798
 
812
  // hidden spam options
813
  ?>
814
  <div id="hiddenspam" style="display:none;">
815
+ <h2><?php _e('Spam Options','wassup'); ?></h2>
816
  <form action="" method="post">
817
+ <p><input type="checkbox" name="wassup_spamcheck" value="1" <?php if($wassup_options->wassup_spamcheck == 1 ) print "CHECKED"; ?> /> <strong><?php _e('Enable/Disable Spam Check on Records','wassup'); ?></strong></p>
818
+ <p style="padding-left:30px;"><input type="checkbox" name="wassup_spam" value="1" <?php if($wassup_options->wassup_spam == 1) print "CHECKED"; ?> /> <?php _e('Record Akismet comment spam attempts','wassup'); ?></p>
819
+ <p style="padding-left:30px;"><input type="checkbox" name="wassup_refspam" value="1" <?php if($wassup_options->wassup_refspam == 1) print "CHECKED"; ?> /> <?php _e('Record referrer spam attempts','wassup'); ?></p>
820
  <p style="padding-left:0;"><input type="submit" name="submit-spam" value="<?php _e('Save Settings','wassup'); ?>" /></p>
821
  </form>
822
  </div>
823
+ <table width="100%">
824
+ <tr>
825
+ <td align="left" class="legend">
826
+ <?php
827
+ if ($wassup_options->wmark == 1) echo '<a href="?'.$_SERVER['QUERY_STRING'].'&search='.$wassup_options->wip.'" title="'.__('Filter by marked IP','wassup').'"><strong>'.$markedtot.'</strong> '.__('show marked items','wassup').'</a> - ';
828
+ if (!empty($search)) print "<strong>$searchtot</strong>".__('Searched for','wassup').": <strong>$search</strong> - ";
829
+ echo __('Auto refresh in','wassup').' <span id="CountDownPanel"></span> '.__('seconds','wassup'); ?>
830
+ </td>
831
+ <td align="right" class="legend"><a href="<?php echo $wpurl."/wp-content/plugins/".WASSUPFOLDER."/lib/action.php?height=400&width=$res&action=topten&from_date=$from_date&to_date=$to_date"; ?>" class="thickbox"><?php _e('Show Top Ten','wassup'); ?></a> - <a href="#" class='show-search'><?php _e('Search','wassup'); ?></a></td>
832
+ </tr>
833
+ </table>
834
  <div class="search-ip" style="display: none;">
835
  <table border=0 width="100%">
836
  <tr valign="top">
843
  </tr>
844
  </table>
845
  </div>
 
846
  <?php
847
  //# Detailed List of Wassup Records...
848
  print $expcol;
869
  $referrer = '<a href="'.$rk->referrer.'" target="_BLANK">'.stringShortener($rk->referrer, round($max_char_len*.9,0)).'</a>';
870
  }
871
  } else {
872
+ $referrer = __('From your blog','wassup');
873
+ }
874
+ } else {
875
+ $referrer = __('Direct hit','wassup');
876
  }
877
  $numurl = $wpdb->get_var("SELECT COUNT(DISTINCT id) as numurl FROM $table_name WHERE wassup_id='".$rk->wassup_id."'");
878
  if ($rk->hostname != "") $hostname = $rk->hostname; else $hostname = "unknown";
879
  ?>
880
 
881
+ <div class="delID<?php echo $rk->wassup_id ?>">
882
+ <div class="<?php if ($wassup_options->wmark == 1 AND $wassup_options->wip == $ip[0]) echo "sum-nav-mark"; else echo "sum-nav"; ?>">
883
 
884
+ <p class="delbut">
885
+ <?php // Mark/Unmark IP
886
+ if ($wassup_options->wmark == 1 AND $wassup_options->wip == $ip[0]) { ?>
887
+ <a href="?<?php echo $_SERVER['QUERY_STRING'] ?>&deleteMARKED=1&dip=<?php print $ip[0]; ?>" style="text-decoration:none;">
888
+ <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/cross.png" alt="'.__('delete','wassup').'" title="'.__('Delete ALL marked records with this IP','wassup'); ?>" /></a>
889
  <a href="?page=<?php echo WASSUPFOLDER; ?>&wmark=0" style="text-decoration:none;">
890
+ <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/error_delete.png" alt="'.__('unmark','wassup').'" title="'.__('UnMark IP','wassup'); ?>" /></a>
891
+ <?php } else { ?>
892
+ <a href="#" class="deleteID" id="<?php echo $rk->wassup_id ?>" style="text-decoration:none;">
893
+ <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/cross.png" alt="'.__('delete','wassup').'" title="'.__('Delete this record','wassup'); ?>" /></a>
894
  <a href="?<?php echo $_SERVER['QUERY_STRING'] ?>&wmark=1&wip=<?php print $ip[0]; ?>" style="text-decoration:none;">
895
+ <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/error_add.png" alt="'.__('mark','wassup').'" title="'.__('Mark IP','wassup'); ?>" /></a>
896
+ <?php } ?>
897
+ <a href="<?php echo $wpurl."/wp-content/plugins/".WASSUPFOLDER."/lib/action.php?height=400&width=$res&action=displayraw&wassup_id=".$rk->wassup_id.""; ?>" class="thickbox">
898
+ <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/database_table.png" alt="'.__('show raw table','wassup').'" title="'.__('Show the items as raw table','wassup'); ?>" /></a>
899
+ </p>
900
 
901
  <span class="sum-box"><?php if ($numurl >= 2) { ?><a href="#" class="showhide" id="<?php echo $rk->id ?>"><?php print $ip[0]; ?></a><? } else { ?><?php print $ip[0]; ?><?php } ?></span>
902
  <span class="sum-date"><?php print $datetimeF; ?></span>
966
  <?php // Referer is a SPAM
967
  if ($rk->spam > 0) { ?>
968
  <ul class="spam">
969
+ <li class="spam"><span class="indent-li-agent">
970
+ <?php _e("Probably SPAM!","wassup");
971
+ if ($rk->spam==1) { echo '(Akismet '.__("Spam","wassup").')'; }
972
+ elseif ($rk->spam==2) { echo '('.__("Referer Spam","wassup").')'; } ?>
973
+ </span></li>
974
  </ul>
975
  <?php } ?>
976
+ <?php // User os/browser/language
977
+ if ($rk->spider == "" AND ($rk->os != "" OR $rk->browser != "")) {
978
  ?>
979
  <ul class="agent">
980
+ <li class="agent"><span class="indent-li-agent">
981
+ <?php if ($rk->language != "") { ?>
982
+ <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/flags/'.strtolower($rk->language).'.png'.'" alt="'.strtolower($rk->language).'" title="'.__("Language","wassup").': '.strtolower($rk->language); ?>" />
983
+ <?php }
984
+ _e("OS","wassup"); ?>: <strong><?php print $rk->os; ?></strong></span></li>
985
+ <li class="agent"><?php _e("BROWSER","wassup"); ?>: <strong><?php print $rk->browser; ?></strong></li>
986
+ <?php if ($rk->screen_res != "") { ?>
987
+ <li class="agent"><?php _e("RESOLUTION","wassup"); ?>: <strong><?php print $rk->screen_res; ?></strong></li>
988
+ <?php } ?>
989
  </ul>
990
  <?php } ?>
991
 
1023
  print $expcol;
1024
  }
1025
 
1026
+ } //end MAIN/DETAILS VIEW ?>
1027
+
1028
+ <p><small>WassUp ver: <?php echo $version.' - '.__("Check the official","wassup").' <a href="http://www.wpwp.org" target="_BLANK">WassUp</a> '.__("page for updates, bug reports and your hints to improve it","wassup").' - <a href="http://trac.wpwp.org/wiki/Documentation" title="Wassup '.__("User Guide documentation","wassup").'">Wassup '.__("User Guide documentation","wassup").'</a>'; ?></small></p>
1029
 
1030
+ </div> <!-- end wrap -->
1031
+ <?php
1032
  } //end function Wassup
1033
 
1034
  function CreateTable() {
1063
  } //end function createTable
1064
 
1065
  function UpdateTable() {
1066
+ global $wpdb;
1067
  $table_name = $wpdb->prefix . "wassup";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1068
  // Upgrade from version < 1.3.9
1069
  if ($wpdb->get_var("SHOW COLUMNS FROM $table_name LIKE 'spam'") == "") {
1070
  $sql_add_spam = "ALTER TABLE {$table_name} ADD COLUMN spam VARCHAR( 50 ) DEFAULT '0'";
1074
 
1075
  //Track visitors and save record in wassup table
1076
  function wassupAppend() {
1077
+ global $wpdb, $wpurl, $wassup_options; //removed unused globals
1078
+ /*
1079
+ // don't do anything if SECRET_KEY is missing
1080
+ if (defined('SECRET_KEY')) {
1081
+ */
1082
  $siteurl = get_bloginfo('siteurl');
1083
  $table_name = $wpdb->prefix . "wassup"; //moved;
1084
+ $wassup_settings = get_option('wassup_settings');
1085
 
1086
  if (!is_admin()) { //exclude wordpress admin page visits
1087
 
1098
  $ipAddress = $IP;
1099
  }
1100
  }
1101
+ // Get the visitor's resolution, TODO
1102
+ /*
1103
+ if(isset($HTTP_COOKIE_VARS["users_resolution"])) {
1104
+ $screen_res = $HTTP_COOKIE_VARS["users_resolution"];
1105
+ } else { //means cookie is not found set it using Javascript
1106
+ ?>
1107
+ <script language="javascript">
1108
+ <!--
1109
+ writeCookie();
1110
+
1111
+ function writeCookie()
1112
+ {
1113
+ var today = new Date();
1114
+ var the_date = new Date("December 31, 2023");
1115
+ var the_cookie_date = the_date.toGMTString();
1116
+ var the_cookie = "users_resolution="+ screen.width +"x"+ screen.height;
1117
+ var the_cookie = the_cookie + ";expires=" + the_cookie_date;
1118
+ document.cookie=the_cookie
1119
+
1120
+ location = '<?php echo $_SERVER['REQUEST_URI']; ?>';
1121
+ }
1122
+ //-->
1123
+ </script>
1124
+ <?php
1125
+ $screen_res = $HTTP_COOKIE_VARS["users_resolution"];
1126
+ }
1127
+ */
1128
+
1129
+ if (isset($_SERVER['REQUEST_URI']) && !ereg("^/$", $_SERVER['REQUEST_URI'])) {
1130
+ $urlRequested = eregi_replace("/$", "", clean_url($_SERVER['REQUEST_URI']));
1131
+ } else {
1132
+ $urlRequested = clean_url($_SERVER['REQUEST_URI']);
1133
+ }
1134
  $referrer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');
1135
  $userAgent = (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '');
1136
  $language = (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? attribute_escape($_SERVER['HTTP_ACCEPT_LANGUAGE']) : '');
1139
  $comment_user = utf8_encode($_COOKIE['comment_author_'.COOKIEHASH]);
1140
 
1141
  $timestamp = wassup_get_time(); //Add a timestamp to visit...
1142
+ $flag_exclude_url = 0;
1143
 
1144
  //#####Start recording visit....
1145
  //## wassup is activated and IP not on exclusion list...
1146
+ if ($wassup_options->wassup_active == 1) { //(moved)
1147
+ if (empty($wassup_options->wassup_exclude) ||
1148
+ strstr($wassup_options->wassup_exclude,$ipAddress) == FALSE) {
1149
+
1150
+ //## check if url requested is not on exclusion list...
1151
+ if (!empty($wassup_options->wassup_exclude_url)) {
1152
+ $exclude_url_list = explode(",", $wassup_options->wassup_exclude_url);
1153
+ foreach ($exclude_url_list as $exclude_url) {
1154
+ if (stristr($urlRequested, trim($exclude_url)) !== FALSE) {
1155
+ $flag_exclude_url = 1;
1156
+ }
1157
+ }
1158
+ }
1159
+ if ($flag_exclude_url != 1) {
1160
+
1161
  //### Exclude requests for themes, plugins, and favicon from recordings
1162
  if (stristr($urlRequested,"favicon.ico") === FALSE) { //moved
1163
  if (stristr($urlRequested,"/wp-content/plugins") === FALSE || stristr($urlRequested,"forum") !== FALSE ) { //moved and modified to allow forum requests
1180
  //if ($spider != '') { $os=''; $browser=''; }
1181
 
1182
  //# More recording exclusion controls (moved to avoid unneeded spam testing)
1183
+ if ($wassup_options->wassup_loggedin == 1 || !is_user_logged_in() ) {
1184
+ if ($wassup_options->wassup_spider == 1 || $spider == '') {
1185
+ if ($wassup_options->wassup_attack == 1 || stristr($userAgent,"libwww-perl") === FALSE ) {
1186
 
1187
  //#===================================================
1188
  //###Start visitor tracking with "session"...
1200
  //
1201
  //### Check if this is an ongoing visit or a new hit...
1202
  //# Test for valid savepath directory before session_start()
1203
+ $sessionpath = $wassup_options->getSavepath();
1204
+ if ($wassup_options->isWritableFolder($sessionpath)) {
1205
+ if ( $sessionpath != $wassup_options->getSessionpath() ) {
 
 
 
 
 
 
1206
  session_save_path($sessionpath);
1207
  }
1208
  session_start(); //required to use/update $_SESSION
1209
+
1210
+ // Prevent Session Fixation attack (http://shiflett.org/articles/session-fixation)
1211
+ if (!isset($_SESSION['initiated'])) {
1212
+ session_regenerate_id();
1213
+ $_SESSION['initiated'] = true;
1214
+ }
1215
+
1216
  //#confirm that session is started...
1217
  if (isset($_SESSION)) {
1218
  if (isset($_SESSION['wassup_id'])) {
1257
  }
1258
  } elseif (isset($_COOKIE['wassup_id'])) {
1259
  $wassup_id = $_COOKIE['wassup_id'];
1260
+ $sessionpath = ""; //bad sessionpath
1261
+ } else {
1262
+ $sessionpath = ""; //bad sessionpath
1263
+ }
1264
  //#create cookie when bad session_savepath or when "session" is not available
1265
  if (empty($wassup_id)) {
1266
  //$wassup_id = md5(uniqid(rand(), true));
1306
  //# some useragents to exclude from spam checking...
1307
  $goodbots = array('Google','Yahoo!', 'SummizeFeedReader'); //omit
1308
 
1309
+ if ( $wassup_options->wassup_spamcheck == 1 ) {
1310
+ //#first check for referrer spam (faster, if positive)
1311
+ //#...but skip when referrer is own blog ($siteurl/$wpurl)
1312
+ if (!empty($referrer) && $wassup_options->wassup_refspam == 1) {
1313
+ if (stristr($referrer,$wpurl) === FALSE && stristr($referrer,$siteurl) === FALSE) {
1314
+ // Do a control if it is Referrer Spam
1315
+ if (wGetSpamRef($referrer) == 1) {
1316
+ $spam = 2;
1317
+ $spamresult = $spam;
1318
+ }
1319
+ }
1320
+ }
1321
+ $spam = $spamresult;
1322
+
1323
+ //
1324
+ //# No duplicate spam testing in same session unless there
1325
+ //# is a forum page request or comment...
1326
+ if (isset($spamresult) && stristr($urlRequested,"comment") === FALSE && stristr($urlRequested,"forum") === FALSE && empty($comment_user) && empty($_POST['comment'])) {
1327
+ //# No spam check on known bots (google, yahoo,...) unless
1328
+ //# there is a comment or forum page request...
1329
+ } elseif ( empty($spider) || array_search($spider,$goodbots) === FALSE || stristr($urlRequested,"comment") !== FALSE || stristr($urlRequested,"forum") !== FALSE || !empty($comment_user) ) {
1330
 
1331
+ // Try to search for previous spammer detected by akismet with same IP
1332
+ if (!empty($ipAddress) && $spam == 0 && $wassup_options->wassup_spam == 1) {
1333
+ $checkauthor = New CheckComment;
1334
+ $checkauthor->tablePrefix = $wpdb->prefix;
1335
+ $spammerIP = $checkauthor->isSpammer($ipAddress);
1336
+ if ( $spammerIP > 0)
1337
+ $spam = 1;
1338
+ $spamresult = $spam;
1339
+ }
1340
+ }
1341
+
1342
+ if ( $spam == 0) {
1343
+ if (!empty($hostname) && $hostname != "unknown") {
1344
+ if (wGetSpamRef($hostname) == 1) {
1345
+ $spam = 1;
1346
+ }
1347
+ $spamresult = $spam;
1348
+ } else {
1349
+ //#missing hostname means don't record
1350
+ //# spam result in session...
1351
+ unset($spamresult);
1352
+ }
1353
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1354
 
1355
  // #save spam results in session...
1356
+ if (isset($spamresult) && !empty($sessionpath)) {
1357
+ @session_start(); //required to access $_SESSION
1358
+ $_SESSION['spamresult'] = $spamresult;
1359
+ @session_write_close();
1360
  }
1361
 
1362
  } //end else $spamresult
 
1363
 
1364
  // Personally used to debug
1365
  if ($current_user->user_email == "michele@befree.it") {
1367
 
1368
  //### Record visit in wassup table...
1369
  //## Final exclusion control is spam...
1370
+ if ($spam == 0 OR ($wassup_options->wassup_spam == 1 AND $spam == 1) OR ($wassup_options->wassup_refspam == 1 AND $spam == 2)) {
1371
+
1372
+ if (method_exists($wpdb,'prepare')) {
1373
+ $insert = $wpdb->query( $wpdb->prepare("INSERT INTO $table_name (wassup_id, timestamp, ip, hostname, urlrequested, agent, referrer, search, searchpage, os, browser, language, screen_res, searchengine, spider, feed, username, comment_author, spam)
1374
+ VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s )",
1375
+ attribute_escape($wassup_id),
1376
+ attribute_escape($timestamp),
1377
+ attribute_escape($ipAddress),
1378
+ attribute_escape($hostname),
1379
+ attribute_escape($urlRequested),
1380
+ attribute_escape($userAgent),
1381
+ attribute_escape($referrer),
1382
+ attribute_escape($search_phrase),
1383
+ attribute_escape($searchpage),
1384
+ attribute_escape($os),
1385
+ attribute_escape($browser),
1386
+ attribute_escape($language[0]),
1387
+ attribute_escape($screen_res),
1388
+ attribute_escape($searchengine),
1389
+ attribute_escape($spider),
1390
+ attribute_escape($feed),
1391
+ attribute_escape($logged_user),
1392
+ attribute_escape($comment_user),
1393
+ attribute_escape($spam)
1394
+ ));
1395
+ } else {
1396
+ $insert = $wpdb->query("INSERT INTO " . $table_name .
1397
+ " (wassup_id, timestamp, ip, hostname, urlrequested, agent, referrer, search, searchpage, os, browser, language, screen_res, searchengine, spider, feed, username, comment_author, spam) " .
1398
+ "VALUES (
1399
+ '".attribute_escape($wassup_id)."',
1400
+ '".attribute_escape($timestamp)."',
1401
+ '".attribute_escape($ipAddress)."',
1402
+ '".attribute_escape($hostname)."',
1403
+ '".attribute_escape($urlRequested)."',
1404
+ '".attribute_escape($userAgent)."',
1405
+ '".attribute_escape($referrer)."',
1406
+ '".attribute_escape($search_phrase)."',
1407
+ '".attribute_escape($searchpage)."',
1408
+ '".attribute_escape($os)."',
1409
+ '".attribute_escape($browser)."',
1410
+ '".attribute_escape($language[0])."',
1411
+ '".attribute_escape($screen_res)."',
1412
+ '".attribute_escape($searchengine)."',
1413
+ '".attribute_escape($spider)."',
1414
+ '".attribute_escape($feed)."',
1415
+ '".attribute_escape($logged_user)."',
1416
+ '".attribute_escape($comment_user)."',
1417
+ '".attribute_escape($spam)."'
1418
+ )");
1419
+ }
1420
 
1421
  } //end if wassup_spam
1422
  } //end if dup_urlrequest == 0
1431
 
1432
  //### Purge old records from wassup table
1433
  //automatic database cleanup of old records...
1434
+ if ($wassup_options->delete_auto != "") {
1435
  // do purge every few visits to keep wassup fast...
1436
  if ( ((int)$timestamp)%5 == 0 ) {
1437
  //use visit timestamp instead of current time for
1438
  // delete parameter
1439
  //$to_date = wassup_get_time();
1440
+ $from_date = strtotime($wassup_options->delete_auto, $timestamp);
1441
  if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name AND $wpdb->get_var("SELECT COUNT(id) FROM $table_name WHERE timestamp<'$from_date'") > 0) {
1442
  $wpdb->query("DELETE FROM $table_name WHERE timestamp<'$from_date'");
1443
  $wpdb->query("OPTIMIZE TABLE $table_name");
1446
  } //end if delete_auto
1447
 
1448
  } //end if wassup_exclude
1449
+ } //end if wassup_exclude_url
1450
  } //end if wassup_active
1451
  } //end if !is_admin
1452
 
1453
  //### Notify admin if alert is set and wassup table > alert
1454
+ if ($wassup_options->wassup_remind_flag == 1) {
1455
  // check database size every few visits to keep wassup fast...
1456
  if ( (time())%7 == 0 ) {
1457
  $table_status = $wpdb->get_results("SHOW TABLE STATUS LIKE '$table_name'");
1459
  $data_lenght = $fstatus->Data_length;
1460
  }
1461
  $tusage = ($data_lenght/1024/1024);
1462
+ if ($tusage > $wassup_options->wassup_remind_mb) {
1463
  $recipient = get_bloginfo('admin_email');
1464
  $sender = get_bloginfo('name').' <wassup_noreply@'.parse_url(get_bloginfo('siteurl'),PHP_URL_HOST).'>';
1465
+ $subject = "[ALERT]".__('WassUp Plugin table has reached maximum size!','wassup');
1466
+ $message = __('Hi','wassup').",\n".__('you have received this email because your WassUp Database table at your Wordpress blog','wassup')." (".get_bloginfo('url').") ".__('has reached the maximum value you set in the options menu','wassup')." (".$wassup_options->wassup_remind_mb." Mb).\n\n";
1467
+ $message .= __('This is only a reminder, please take the actions you want in the WassUp options menu','wassup')." (".get_bloginfo('url')."/wp-admin/admin.php?page=wassup-options).\n\n".__('This alert now will be removed and you will be able to set a new one','wassup').".\n\n";
1468
+ $message .= __('Thank you for using WassUp plugin. Check if there is a new version available here:','wassup')." http://wordpress.org/extend/plugins/wassup/\n\n".__('Have a nice day!','wassup')."\n";
1469
+ mail($recipient, $subject, $message, "From: $sender");
1470
+ $wassup_options->wassup_remind_flag = 2;
1471
+ $wassup_options->saveSettings();
1472
+ //update_option('wassup_settings', $wassup_settings);
1473
 
1474
  }
1475
  }
1476
  } //if wassup_remind_flag
1477
+ //} //if SECRET_KEY
1478
  } //end function wassupAppend()
1479
 
1480
  function wGetQueryPairs($url){
1547
 
1548
  function wGetSE($referrer = null){
1549
  $key = null;
1550
+ $lines = array("Alice|search.alice.it|qs|", "Google|www.google.|as_q|", "Google|www.google.|q|", "Google Groups|groups.google.|q|",
1551
+ "Google Images|images.google.|prev|", "Yahoo|search.yahoo.com|p|", "Google Blog|blogsearch.google.|as_q|", "Google Blog|blogsearch.google.|q|",
1552
  "Virgilio|search.virgilio.it|qs|","Arianna|arianna.libero.it|query|","Altavista|.altavista.com|q|","Kataweb|kataweb.it|q|",
1553
  "Il Trovatore|categorie.iltrovatore.it|query|","Il Trovatore|search.iltrovatore.it|q|","2020Search|2020search.c|us|st|pn|1|",
1554
  "abcsearch.com|abcsearch.com|terms|","100Links|100links.supereva.it|q|","Alexa|alexa.com|q|","Alltheweb|alltheweb.com|q|",
1559
  "Overture|overture.com|Keywords|","Supereva|supereva.it|q|","Teoma|teoma.com|q|","Tiscali|search-dyn.tiscali.|key|","Voil|voila.fr|kw|",
1560
  "Web|web.de|su|","Clarence|search.clarence.com|q|","Gazzetta|search.gazzetta.it|q|","PagineGialle|paginegialle.it|qs|",
1561
  "Jumpy|servizi.mediaset.it|searchWord|","ItaliaPuntoNet|italiapuntonet.net|search|","StartNow|search.startnow.|q|","Search|search.it|srctxt|",
1562
+ "Search|search.com|q|", "Good Search|goodsearch.com|Keywords|");
1563
  foreach($lines as $line_num => $se) {
1564
  list($nome,$url,$key,$lang)=explode("|",$se);
1565
  if(@strpos($referrer,$url)===FALSE) continue;
1584
  }
1585
 
1586
  function wGetSpider($agent = null){
1587
+ $agent=str_replace(" ","",$agent);
1588
  $key = null;
1589
  $lines = array("Wordpress Pingback/Trackback|Wordpress|", "Alexa|ia_archiver|","Ask.com/Teoma|AskJeeves/Teoma)|","Biz360|Biz360|","Naver|NaverBot|","Naver|Cowbot|","cURL|curl/|","Google|Googlebot/|",
1590
  "Google|googlebot/|","Google Images|Googlebot-Image|","LookSmart|grub-client|","Yahoo!|slurp@inktomi|","Yahoo!|Yahoo!Slurp|",
1592
  "Yahoo FeedSeeker|YahooFeedSeeker|","Java|Java/|","relevantNOISE|www.relevantnoise.com|","Voila|VoilaBot|","IRLIRLbot/|","Snapbot|Snap|",
1593
  "ichiro|ichiro|", "shelob|shelob|", "Google AdSense|Mediapartners-Google|", "Seekbot|HTTPFetcher|", "CommentTracker|CommentTracker|",
1594
  "Bloglines|bloglines|", "Italian Blog Rankings|blogbabel", "Ask Jeeves/Teoma|ask|", "Akregator|Akregator|", "NewsGatorOnline|NewsGatorOnline|", "Rojo|rojo|", "FeedTools|feedtools|",
1595
+ "Feedfetcher-Google|Feedfetcher-google|", "AideRSS|AideRSS|", "psbot|psbot|", "Ruby|Rfeedfinder|", "everyfeed-spider|everyfeed-spider", "Attentio/Nutch|Attention",
1596
  "Megite2.0|Megite.com|", "radianrss|RadianRSS|", "Sitemap Generator|Sitemap Generator|", "Feedshow|Feedshow|", "ABCdatos|ABCdatos|", "Acme.Spider|Due|", "Ahoy!|Ahoy!|",
1597
  "Alkaline|AlkalineBOT|", "appie|Appie|", "Arachnophilia|Arachnophilia|", "Araneo|Araneo/0.7|", "AraybOt|AraybOt/1.0|", "ArchitextSpider|ArchitextSpider|",
1598
  "ARIADNE|Due|", "ASpider|ASpider/0.09|", "Atomz.com|Atomz/1.0|", "AURESYS|AURESYS/1.0|", "BackRub|BackRub/*.*|", "BBot|bbot/0.100|", "Big|Big|", "Bjaaland|Bjaaland/0.5|",
1639
  "disco/Nutch|disco/Nutch", "StackRambler|StackRambler|", "MagpieRSS|MagpieRSS|", "WebAlta|WebAlta|", "NewsAlloy|NewsAlloy|",
1640
  "WikioFeedBot|WikioFeedBot|", "Strategic Board Bot |Strategic Board Bot |", "Mail.ru|Mail.ru|", "OpiDig|OpiDig|", "webcollage|webcollage|",
1641
  "R6_FeedFetcher|R6_FeedFetcher|", "UniversalFeedParser|UniversalFeedParser|", "Syndic8|Syndic8|", "BlogBot|BlogBot|", "W3C_Validator|W3C_Validator|",
1642
+ "Runnk RSS aggregator|Runnk|", "RssBandit|RssBandit|", "Sphere Scout|Sphere Scout|", "BlogPulseLive|BlogPulseLive|", "AMZNKAssocBot|AMZNKAssocBot|",
1643
+ "Yandex|Yandex|", "heritrix|heritrix|", "gsinfobot|gsinfobot|", "FeedHub FeedFetcher|FeedHub|", "WikioPxyFeedBo|WikioPxyFeedBo|",
1644
+ "KindOpener|KindOpener|", "AlbertBot|AlbertBot|", "Nutch/Nutch|Nutch/Nutch|", "Lsearch/sondeur|Lsearch/sondeur|", "OWPBot|OWPBot|",
1645
+ "Feed::Find|Feed::Find|", "eZ publish Link Validator|eZ publish Link Validator|", "R6_CommentReade|R6_CommentReade|",
1646
+ "Strategic Board Bot|Strategic Board Bot|", "OSSE Scanner|OSSE Scanner|", "PECL::HTTP|PECL::HTTP|", "GetRight|GetRight|", "yacybot|yacybot|",
1647
+ "GurujiBot|GurujiBot|", "Missigua Locator|Missigua Locator|", "ISC Systems iRc Search|ISC Systems iRc Search|", "whiteiexpres/Nutch|whiteiexpres/Nutch|",
1648
+ "kalooga/kalooga|kalooga/kalooga|", "Bookdog|Bookdog|", "webLyzard|webLyzard", "EnaBot|EnaBot|");
1649
  foreach($lines as $line_num => $spider) {
1650
  list($nome,$key)=explode("|",$spider);
1651
  if(@strpos(strtolower($agent),strtolower($key))===FALSE) continue;
1725
  return null;
1726
  } //end function wGetSpamRef()
1727
 
 
 
 
 
 
 
 
 
 
 
1728
  function export_wassup() {
1729
  global $wpdb, $table_name;
1730
  $table_name = $wpdb->prefix . "wassup";
1870
  print $sql;
1871
  } // end backup_table()
1872
 
1873
+ // START initializing Widget
1874
  function wassup_widget_init() {
1875
 
1876
  if ( !function_exists('register_sidebar_widget') )
1897
 
1898
  // Widget TOP Searches
1899
  if ($wassup_settings['wassup_widget_search'] == 1) {
1900
+ $query_det = $wpdb->get_results("SELECT search, referrer FROM $table_name WHERE search!='' GROUP BY search ORDER BY timestamp DESC LIMIT ".attribute_escape($searchlimit)."");
1901
  if (count($query_det) > 0) {
1902
+ print "$before_title ".__('Last searched terms','wassup')." $after_title";
1903
  print "<ul class='$ulclass'>";
1904
  foreach ($query_det as $sref) {
1905
+ print "<li>- <a href='".attribute_escape($sref->referrer)."' target='_BLANK'>".stringShortener($sref->search, $chars)."</a></li>";
1906
  }
1907
  print "</ul>";
1908
  }
1910
 
1911
  // Widget TOP Referers
1912
  if ($wassup_settings['wassup_widget_ref'] == 1) {
1913
+ $query_ref = $wpdb->get_results("SELECT referrer FROM $table_name WHERE searchengine='' AND referrer!='' AND referrer NOT LIKE '$wpurl%' GROUP BY referrer ORDER BY timestamp DESC LIMIT ".attribute_escape($reflimit)."");
1914
  if (count($query_ref) > 0) {
1915
+ print "$before_title ".__('Last referers','wassup')." $after_title";
1916
  print "<ul class='$ulclass'>";
1917
  foreach ($query_ref as $eref) {
1918
+ print "<li>- <a href='".attribute_escape($eref->referrer)."' target='_BLANK'>".stringShortener(eregi_replace("http://", "", attribute_escape($eref->referrer)), $chars)."</a></li>";
1919
  }
1920
  print "</ul>";
1921
  }
1922
  }
1923
 
1924
+ // Widget TOP Browsers
1925
+ if ($wassup_settings['wassup_widget_topbr'] == 1) {
1926
+ $query_topbr = $wpdb->get_results("SELECT count(browser) as top_browser, browser FROM $table_name WHERE browser!='' AND browser NOT LIKE '%N/A%' GROUP BY browser ORDER BY top_browser DESC LIMIT ".attribute_escape($topbrlimit)."");
1927
+ if (count($query_topbr) > 0) {
1928
+ print "$before_title ".__('Top Browsers','wassup')." $after_title";
1929
+ print "<ul class='$ulclass'>";
1930
+ foreach ($query_topbr as $etopbr) {
1931
+ print "<li>- ".stringShortener($etopbr->browser, $chars)."</li>";
1932
+ }
1933
+ print "</ul>";
1934
+ }
1935
+ }
1936
 
1937
+ // Widget TOP Oses
1938
+ if ($wassup_settings['wassup_widget_topos'] == 1) {
1939
+ $query_topos = $wpdb->get_results("SELECT count(os) as top_os, os FROM $table_name WHERE os!='' AND os NOT LIKE '%N/A%' GROUP BY os ORDER BY top_os DESC LIMIT ".attribute_escape($toposlimit)."");
1940
+ if (count($query_topos) > 0) {
1941
+ print "$before_title ".__('Top OS','wassup')." $after_title";
1942
+ print "<ul class='$ulclass'>";
1943
+ foreach ($query_topos as $etopos) {
1944
+ print "<li>- ".stringShortener($etopos->os, $chars)."</li>";
1945
+ }
1946
+ print "</ul>";
1947
+ }
1948
+ }
1949
 
1950
+ // Widget Visitors Online
1951
+ $TotWid = New MainItems;
1952
+ $TotWid->tableName = $table_name;
1953
+ $TotWid->from_date = $from_date;
1954
+ $TotWid->to_date = $to_date;
1955
+
1956
+ $currenttot = $TotWid->calc_tot("count", null, null, "DISTINCT");
1957
+ $currentlogged = $TotWid->calc_tot("count", null, "AND username!=''", "DISTINCT");
1958
+ $currentauth = $TotWid->calc_tot("count", null, "AND comment_author!='' AND username=''", "DISTINCT");
1959
+
1960
+ print $before_title . $title . $after_title;
1961
+ print "<ul class='$ulclass'>";
1962
+ if ((int)$currenttot < 10) $currenttot = "0".$currenttot;
1963
+ print "<li><strong style='padding:0 4px 0 4px;background:#ddd;color:#777'>".$currenttot."</strong> ".__('visitor(s) online','wassup')."</li>";
1964
+ if ((int)$currentlogged > 0 AND $wassup_settings['wassup_widget_loggedin'] == 1) {
1965
+ if ((int)$currentlogged < 10) $currentlogged = "0".$currentlogged;
1966
+ print "<li><strong style='padding:0 4px 0 4px;background:#e7f1c8;color:#777'>".$currentlogged."</strong> ".__('logged-in user(s)','wassup')."</li>";
1967
+ }
1968
+ if ((int)$currentauth > 0 AND $wassup_settings['wassup_widget_comauth'] == 1) {
1969
+ if ((int)$currentauth < 10) $currentauth = "0".$currentauth;
1970
+ print "<li><strong style='padding:0 4px 0 4px;background:#fbf9d3;color:#777'>".$currentauth."</strong> ".__('comment author(s)','wassup')."</li>";
1971
  }
1972
+ print "<li style='font-size:6pt; color:#bbb;'>".__("powered by", "wassup")." <a style='color:#777;' href='http://www.wpwp.org' title='WassUp - Real Time Visitors Tracking'>WassUp</a></li>";
1973
  print "</ul>";
1974
  print $after_widget;
1975
  }
1978
  //global $_POST;
1979
  $wassup_settings = get_option('wassup_settings');
1980
 
1981
+ if (isset($_POST['wassup-submit']))
1982
  {
1983
  $wassup_settings['wassup_widget_title'] = $_POST['wassup_widget_title'];
1984
  $wassup_settings['wassup_widget_ulclass'] = $_POST['wassup_widget_ulclass'];
2001
  ?>
2002
  <div class="wrap" style="text-align:left">
2003
  <h3>Wassup Widget</h3>
2004
+ <p style="text-align:left"><input type="text" name="wassup_widget_title" size="20" value="<?php echo $wassup_settings['wassup_widget_title'] ?>" /> <?php _e("What title for the widget (default \"Visitors Online\")", "wassup") ?></p>
2005
+ <p style="text-align:left"><input type="text" name="wassup_widget_ulclass" size="3" value="<?php echo $wassup_settings['wassup_widget_ulclass'] ?>" /> <?php _e("What style sheet class for &lt;ul&gt; attribute (default \"links\")", "wassup") ?></p>
2006
+ <p style="text-align:left"><input type="text" name="wassup_widget_chars" size="3" value="<?php echo $wassup_settings['wassup_widget_chars'] ?>" /> <?php _e("How many characters left? (For template compatibility - default 18)", "wassup") ?></p>
2007
+ <p style="text-align:left"><input type="checkbox" name="wassup_widget_loggedin" value="1"<?php if ($wassup_settings['wassup_widget_loggedin'] == 1) echo "CHECKED"; ?> /> <?php _e("Check if you want to show logged-in online users (default Yes)", "wassup") ?></p>
2008
+ <p style="text-align:left"><input type="checkbox" name="wassup_widget_comauth" value="1" <?php if ($wassup_settings['wassup_widget_comauth'] == 1) echo "CHECKED"; ?> /> <?php _e("Check if you want to show comment-author online users (default Yes)", "wassup") ?></p>
2009
+ <p style="text-align:left"><input type="checkbox" name="wassup_widget_search" value="1" <?php if ($wassup_settings['wassup_widget_search'] == 1) echo "CHECKED"; ?> /> <?php _e("Check if you want to show some last search referers (default Yes)", "wassup") ?></p>
2010
+ <p style="text-align:left"><input type="text" name="wassup_widget_searchlimit" size="3" value="<?php echo $wassup_settings['wassup_widget_searchlimit'] ?>" /> <?php _e("How many search referers want to show (default 5)", "wassup") ?></p>
2011
+ <p style="text-align:left"><input type="checkbox" name="wassup_widget_ref" value="1" <?php if ($wassup_settings['wassup_widget_ref'] == 1) echo "CHECKED"; ?> /> <?php _e("Check if you want to show some last external referers (default Yes)", "wassup") ?></p>
2012
+ <p style="text-align:left"><input type="text" name="wassup_widget_reflimit" size="3" value="<?php echo $wassup_settings['wassup_widget_reflimit'] ?>" /> <?php _e("How many external referers want to show (default 5)", "wassup") ?></p>
2013
+ <p style="text-align:left"><input type="checkbox" name="wassup_widget_topbr" value="1" <?php if ($wassup_settings['wassup_widget_topbr'] == 1) echo "CHECKED"; ?> /> <?php _e("Check if you want to show top browsers (default Yes)", "wassup") ?></p>
2014
+ <p style="text-align:left"><input type="text" name="wassup_widget_topbrlimit" size="3" value="<?php echo $wassup_settings['wassup_widget_topbrlimit'] ?>" /> <?php _e("How many top browsers want to show (default 5)", "wassup") ?></p>
2015
+ <p style="text-align:left"><input type="checkbox" name="wassup_widget_topos" value="1" <?php if ($wassup_settings['wassup_widget_topos'] == 1) echo "CHECKED"; ?> /> <?php _e("Check if you want to show top operating systems (default Yes)", "wassup") ?></p>
2016
+ <p style="text-align:left"><input type="text" name="wassup_widget_toposlimit" size="3" value="<?php echo $wassup_settings['wassup_widget_toposlimit'] ?>" /> <?php _e("How many top operating systems want to show (default 5)", "wassup") ?></p>
2017
+ <p style="text-align:left"><input type="hidden" name="wassup-submit" id="wassup-submit" value="1" /></p>
 
 
2018
  </div>
2019
  <?php
2020
  }
2024
  if ($wassup_settings['wassup_userlevel'] == "") {
2025
  $wassup_settings['wassup_userlevel'] = 8;
2026
  update_option('wassup_settings', $wassup_settings);
2027
+ }
2028
+ if ($wassup_settings['wassup_refresh'] == "") {
2029
  $wassup_settings['wassup_refresh'] = 3;
2030
  update_option('wassup_settings', $wassup_settings);
2031
  }
2058
  print "$before_title Last searched terms $after_title";
2059
  print "<ul class='$ulclass'>";
2060
  foreach ($query_det as $sref) {
2061
+ print "<li>- <a href='".attribute_escape($sref->referrer)."' target='_BLANK'>".stringShortener(attribute_escape($sref->search), $chars)."</a></li>";
2062
  }
2063
  print "</ul>";
2064
  }
2070
  print "$before_title Last referers $after_title";
2071
  print "<ul class='$ulclass'>";
2072
  foreach ($query_ref as $eref) {
2073
+ print "<li>- <a href='".attribute_escape($eref->referrer)."' target='_BLANK'>".stringShortener(eregi_replace("http://", "", attribute_escape($eref->referrer)), $chars)."</a></li>";
2074
  }
2075
  print "</ul>";
2076
  }
2082
  print "$before_title Top Browsers $after_title";
2083
  print "<ul class='$ulclass'>";
2084
  foreach ($query_topbr as $etopbr) {
2085
+ print "<li>- ".stringShortener(attribute_escape($etopbr->browser), $chars)."</li>";
2086
  }
2087
  print "</ul>";
2088
  }
2094
  print "$before_title Top OS $after_title";
2095
  print "<ul class='$ulclass'>";
2096
  foreach ($query_topos as $etopos) {
2097
+ print "<li>- ".stringShortener(attribute_escape($etopos->os), $chars)."</li>";
2098
  }
2099
  print "</ul>";
2100
  }
2101
  }
2102
 
2103
+ $TotWid = New MainItems;
2104
+ $TotWid->tableName = $table_name;
2105
+ $TotWid->from_date = $from_date;
2106
+ $TotWid->to_date = $to_date;
2107
+
2108
+ $currenttot = $TotWid->calc_tot("count", null, null, "DISTINCT");
2109
+ $currentlogged = $TotWid->calc_tot("count", null, "AND username!=''", "DISTINCT");
2110
+ $currentauth = $TotWid->calc_tot("count", null, "AND comment_author!=''' AND username=''", "DISTINCT");
2111
+
2112
  print $before_title . $title . $after_title;
2113
  print "<ul class='$ulclass'>";
 
 
 
2114
  if ((int)$currenttot < 10) $currenttot = "0".$currenttot;
2115
  print "<li><strong style='padding:0 4px 0 4px;background:#ddd;color:#777'>".$currenttot."</strong> visitor(s) online</li>";
2116
  if ((int)$currentlogged > 0 AND $wassup_settings['wassup_widget_loggedin'] == 1) {
2122
  if ((int)$currentauth < 10) $currentauth = "0".$currentauth;
2123
  print "<li><strong style='padding:0 4px 0 4px;background:#fbf9d3;color:#777'>".$currentauth."</strong> comment author(s)</li>";
2124
  }
2125
+ print "<li style='font-size:6pt; color:#bbb;'>".__("powered by", "wassup")." <a style='color:#777;' href='http://www.wpwp.org/' title='WassUp - Real Time Visitors Tracking'>WassUp</a></li>";
2126
  print "</ul>";
2127
  print $after_widget;
2128
  }