Simple Download Monitor - Version 0.08

Version Description

  • Administrators can now delete download statistics from the Tools panel: A checkbox is shown next to each record, and a button for deleting checked records is provided at the bottom of the list. A button for deleting all records is also provided. This is true for both the global list and details list.

Note: This function is only allowed for users with a "delete_user" capability (by default, that means only Administrators).

Download this release

Release Info

Developer pepak.net
Plugin Icon 128x128 Simple Download Monitor
Version 0.08
Comparing to
See all releases

Code changes from version 0.07 to 0.08

Files changed (5) hide show
  1. lang/cs_CZ.mo +0 -0
  2. lang/cs_CZ.po +177 -51
  3. readme.txt +11 -1
  4. sdmon.css +0 -10
  5. simple-download-monitor.php +165 -42
lang/cs_CZ.mo CHANGED
Binary file
lang/cs_CZ.po CHANGED
@@ -2,7 +2,7 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Simple Download Monitor v0.04\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2009-11-24 16:50+0100\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Pepak <pepak@pepak.net>\n"
8
  "Language-Team: Pepak <pepak@pepak.net>\n"
@@ -16,145 +16,271 @@ msgstr ""
16
  "X-Poedit-Basepath: ..\n"
17
  "X-Poedit-SearchPath-0: ..\n"
18
 
19
- #: ../trunk/simple-download-monitor.php:236
20
- #: ../trunk/simple-download-monitor.php:513
 
 
 
 
 
 
21
  msgid "Simple Download Monitor options"
22
  msgstr "Simple Download Monitor - nastavení"
23
 
24
- #: ../trunk/simple-download-monitor.php:237
 
 
 
25
  msgid "Allowed directories"
26
  msgstr "Povolené adresáře"
27
 
28
- #: ../trunk/simple-download-monitor.php:238
 
 
 
29
  msgid "Only requested files whose full names (relative to document root) start with this regular expression will be processed. It is strongly recommended to place all downloadable files (and ONLY downloadable files) into a designated directory and then placing that directory's name followed by a slash here. It is possible to use the power of PREG to allow multiple directories, but make sure there are ONLY files which you are comfortable with malicious users downloading. Do not EVER allow directories which contain PHP files here! That could lead to disclosure of sensitive data, including username and password used to connect to WordPress database."
30
  msgstr "Zpracovávány budou pouze soubory, jejichž plná jména (relativní vůči kořenovému adresáři webu) začínají tímto regulárním výrazem. Silně doporučuji umístit všechny stažitelné soubory (a JENOM stažitelné soubory) do jednoho určeného adresáře a vepsat sem název tohoto adresáře zakončený lomítkem. Lze také využít všech možností, které dává PREG, pro povolení více adresářů, ale dejte si pozor, ať v nich jsou JEDINĚ soubory, u kterých vám nevadí, když si je stáhne útočník. NIKDY do těchto adresářů neukládejte žádné PHP soubory! To by mohlo vést k zveřejnění citlivých dat, včetně uživatelského jména a hesla pro připojení k databázi."
31
 
32
- #: ../trunk/simple-download-monitor.php:239
 
 
 
33
  msgid "Default value is <code>files/</code>, which only allows download from /files directory (the leading <code>/</code> is implicit)."
34
  msgstr "Výchozí hodnota je <code>files/</code>, která dovolí stahovat pouze soubory z adresáře /files (úvodní <code>/</code> je dosazeno automaticky)."
35
 
36
- #: ../trunk/simple-download-monitor.php:241
 
 
 
37
  msgid "Allowed extensions"
38
  msgstr "Povolené přípony"
39
 
40
- #: ../trunk/simple-download-monitor.php:242
 
 
 
41
  msgid "Only files with extensions matching this regular expressions will be processed. This is another important security value. Make sure you only add extensions which are safe for malicious users to have, e.g. archives and possibly images. Do NOT use any expression that could allow a user to download PHP files, even if you think it safe given the Allowed Directories option above."
42
  msgstr "Zpracovávány budou pouze soubory, jejichž přípony odpovídají tomuto regulárnímu výrazu. Jde o další důležitý bezpečnostní prvek. Dejte si pozor, ať jsou zde uvedeny pouze takové přípony, které nemohou být zneužity útočníky, tzn. komprimované archívy a případně obrázky. NEPOUŽÍVEJTE výrazy, které by mohly uživateli dovolit download PHP souborů, ani kdyby tyto soubory vylučovalo nastavení \"Povolené adresáře\" výše."
43
 
44
- #: ../trunk/simple-download-monitor.php:243
 
 
 
45
  msgid "Default value is <code>zip|rar|7z</code> which only allows download of files ending with <code>.zip</code>, <code>.rar</code> and <code>.7z</code> (the leading <code>.</code> is implicit)."
46
  msgstr "Výchozí hodnota je <code>zip|rar|7z</code>, která povolí pouze stahování souborů s příponou <code>.zip</code>, <code>.rar</code> a <code>.7z</code> (úvodní <code>.</code> je dosazena automaticky)."
47
 
48
- #: ../trunk/simple-download-monitor.php:245
49
- msgid "Inline files"
50
- msgstr "Soubory pro inline zobrazení"
51
-
52
- #: ../trunk/simple-download-monitor.php:246
53
- msgid "Files whose names match this regular expression will be displayed inline (within a HTML page) rather than downloaded."
54
- msgstr "Soubory, které vyhovují tomuto regulárnímu výrazu, budou zobrazeny inline (jako objekt - např. obrázek nebo video - uvnitř HTML stránky) místo aby se stahovaly."
55
-
56
- #: ../trunk/simple-download-monitor.php:247
57
- msgid "By default, this value is empty - no files will appear inline, all will be downloaded. You may want to place something like <code>\\.(jpe?g|gif|png|swf)$</code> here to make images and Flash videos appear inline."
58
- msgstr "Výchozí hodnotou je prázdný řetězec - všechny soubory se budou stahovat, žádný nebude zobrazen inline. Vepište sem něco jako <code>\\.(jpe?g|gif|png|swf)$</code> pro zobrazování obrázků a Flashů inline."
59
-
60
- #: ../trunk/simple-download-monitor.php:248
61
- msgid "Note: Unlike the options above, nothing is implied in this regular expression. You <em>must</em> use an explicit <code>\\.</code> to denote \"start of extension\", you <em>must</em> use an explicit <code>$</code> to mark \"end of filename\", etc."
62
- msgstr "Pozn.: Narozdíl od nastavení uvedených výše se do tohoto regulárního výrazu nic nedoplňuje. Pokud chcete vyznačit \"začátek přípony\", <em>musíte</em> sem napsat <code>\\.</code>; pokud chcete vyznačit \"konec názvu souboru\", <em>musíte</em> sem napsat <code>$</code>, a podobně."
63
-
64
- #: ../trunk/simple-download-monitor.php:250
65
  msgid "Store detailed logs?"
66
  msgstr "Ukládat detailní záznamy?"
67
 
68
- #: ../trunk/simple-download-monitor.php:251
 
 
 
69
  msgid "If detailed logs are allowed, various information (including exact time of download, user's IP address, referrer etc.) is stored. This can fill your database quickly if you have only a little space or a lot of popular downloads. Otherwise just the total numbers of downloads are stored, consuming significantly less space."
70
  msgstr "Pokud je tato volba zapnuta, ukládají se detailní informace (jako přesný čas, IP adresa uživatele nebo referer) o každém downloadu. To může rychle zahltit databázi, pokud máte jen málo prostoru nebo populární downloady. Normálně se ukládá jen celkový počet stažení, který zabírá podstatně méně místa."
71
 
72
- #: ../trunk/simple-download-monitor.php:252
 
 
 
73
  msgid "Use detailed statistics."
74
  msgstr "Používat detailní statistiky"
75
 
76
- #: ../trunk/simple-download-monitor.php:253
 
 
 
77
  msgid "Update settings"
78
  msgstr "Uložit nastavení"
79
 
80
- #: ../trunk/simple-download-monitor.php:358
 
 
 
81
  msgid "First"
82
  msgstr "První"
83
 
84
- #: ../trunk/simple-download-monitor.php:359
 
 
 
85
  msgid "Previous"
86
  msgstr "Předchozí"
87
 
88
- #: ../trunk/simple-download-monitor.php:364
 
 
 
89
  msgid "Next"
90
  msgstr "Další"
91
 
92
- #: ../trunk/simple-download-monitor.php:365
 
 
 
93
  msgid "Last"
94
  msgstr "Poslední"
95
 
96
- #: ../trunk/simple-download-monitor.php:380
97
- #: ../trunk/simple-download-monitor.php:445
98
- #: ../trunk/simple-download-monitor.php:513
99
- #: ../trunk/simple-download-monitor.php:514
 
 
 
 
 
 
 
 
 
 
 
 
100
  msgid "Simple Download Monitor"
101
  msgstr "Simple Download Monitor"
102
 
103
- #: ../trunk/simple-download-monitor.php:381
 
 
 
104
  msgid "Nonexistent downloads"
105
  msgstr "Neexistující soubory"
106
 
107
- #: ../trunk/simple-download-monitor.php:381
 
 
 
108
  msgid "All downloads"
109
  msgstr "Všechny downloady"
110
 
111
- #: ../trunk/simple-download-monitor.php:382
 
 
 
112
  msgid "Show all downloads"
113
  msgstr "Zobrazit všechny soubory"
114
 
115
- #: ../trunk/simple-download-monitor.php:382
 
 
 
116
  msgid "Show nonexistent downloads"
117
  msgstr "Zobrazit neexistující soubory"
118
 
119
- #: ../trunk/simple-download-monitor.php:393
 
 
 
120
  msgid "Filename"
121
  msgstr "Název souboru"
122
 
123
- #: ../trunk/simple-download-monitor.php:394
 
 
 
124
  msgid "Download count"
125
  msgstr "Počet stažení"
126
 
127
- #: ../trunk/simple-download-monitor.php:395
 
 
 
128
  msgid "Last date"
129
  msgstr "Poslední datum"
130
 
131
- #: ../trunk/simple-download-monitor.php:446
 
 
 
132
  #, php-format
133
  msgid "Detailed data for <strong>%s</strong>:"
134
  msgstr "Detailní data pro <strong>%s</strong>:"
135
 
136
- #: ../trunk/simple-download-monitor.php:447
 
 
 
137
  #, php-format
138
  msgid "Total number of downloads: <strong>%d</strong>."
139
  msgstr "Celkový počet stažení: <strong>%d</strong>."
140
 
141
- #: ../trunk/simple-download-monitor.php:459
 
 
 
142
  msgid "Date"
143
  msgstr "Datum"
144
 
145
- #: ../trunk/simple-download-monitor.php:460
 
 
 
146
  msgid "IP address"
147
  msgstr "IP adresa"
148
 
149
- #: ../trunk/simple-download-monitor.php:461
 
 
 
150
  msgid "Referer"
151
  msgstr "Referer"
152
 
153
- #: ../trunk/simple-download-monitor.php:462
 
 
 
154
  msgid "Username"
155
  msgstr "Uživatel"
156
 
157
- #: ../trunk/simple-download-monitor.php:491
 
 
 
158
  msgid "Return to full list."
159
  msgstr "Návrat do úplného seznamu"
160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  msgstr ""
3
  "Project-Id-Version: Simple Download Monitor v0.04\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2009-11-29 18:10+0100\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Pepak <pepak@pepak.net>\n"
8
  "Language-Team: Pepak <pepak@pepak.net>\n"
16
  "X-Poedit-Basepath: ..\n"
17
  "X-Poedit-SearchPath-0: ..\n"
18
 
19
+ #: ../tags/0.05/simple-download-monitor.php:226
20
+ #: ../tags/0.05/simple-download-monitor.php:496
21
+ #: ../tags/0.06/simple-download-monitor.php:226
22
+ #: ../tags/0.06/simple-download-monitor.php:498
23
+ #: ../tags/0.07/simple-download-monitor.php:236
24
+ #: ../tags/0.07/simple-download-monitor.php:513
25
+ #: ../trunk/simple-download-monitor.php:237
26
+ #: ../trunk/simple-download-monitor.php:636
27
  msgid "Simple Download Monitor options"
28
  msgstr "Simple Download Monitor - nastavení"
29
 
30
+ #: ../tags/0.05/simple-download-monitor.php:227
31
+ #: ../tags/0.06/simple-download-monitor.php:227
32
+ #: ../tags/0.07/simple-download-monitor.php:237
33
+ #: ../trunk/simple-download-monitor.php:238
34
  msgid "Allowed directories"
35
  msgstr "Povolené adresáře"
36
 
37
+ #: ../tags/0.05/simple-download-monitor.php:228
38
+ #: ../tags/0.06/simple-download-monitor.php:228
39
+ #: ../tags/0.07/simple-download-monitor.php:238
40
+ #: ../trunk/simple-download-monitor.php:239
41
  msgid "Only requested files whose full names (relative to document root) start with this regular expression will be processed. It is strongly recommended to place all downloadable files (and ONLY downloadable files) into a designated directory and then placing that directory's name followed by a slash here. It is possible to use the power of PREG to allow multiple directories, but make sure there are ONLY files which you are comfortable with malicious users downloading. Do not EVER allow directories which contain PHP files here! That could lead to disclosure of sensitive data, including username and password used to connect to WordPress database."
42
  msgstr "Zpracovávány budou pouze soubory, jejichž plná jména (relativní vůči kořenovému adresáři webu) začínají tímto regulárním výrazem. Silně doporučuji umístit všechny stažitelné soubory (a JENOM stažitelné soubory) do jednoho určeného adresáře a vepsat sem název tohoto adresáře zakončený lomítkem. Lze také využít všech možností, které dává PREG, pro povolení více adresářů, ale dejte si pozor, ať v nich jsou JEDINĚ soubory, u kterých vám nevadí, když si je stáhne útočník. NIKDY do těchto adresářů neukládejte žádné PHP soubory! To by mohlo vést k zveřejnění citlivých dat, včetně uživatelského jména a hesla pro připojení k databázi."
43
 
44
+ #: ../tags/0.05/simple-download-monitor.php:229
45
+ #: ../tags/0.06/simple-download-monitor.php:229
46
+ #: ../tags/0.07/simple-download-monitor.php:239
47
+ #: ../trunk/simple-download-monitor.php:240
48
  msgid "Default value is <code>files/</code>, which only allows download from /files directory (the leading <code>/</code> is implicit)."
49
  msgstr "Výchozí hodnota je <code>files/</code>, která dovolí stahovat pouze soubory z adresáře /files (úvodní <code>/</code> je dosazeno automaticky)."
50
 
51
+ #: ../tags/0.05/simple-download-monitor.php:231
52
+ #: ../tags/0.06/simple-download-monitor.php:231
53
+ #: ../tags/0.07/simple-download-monitor.php:241
54
+ #: ../trunk/simple-download-monitor.php:242
55
  msgid "Allowed extensions"
56
  msgstr "Povolené přípony"
57
 
58
+ #: ../tags/0.05/simple-download-monitor.php:232
59
+ #: ../tags/0.06/simple-download-monitor.php:232
60
+ #: ../tags/0.07/simple-download-monitor.php:242
61
+ #: ../trunk/simple-download-monitor.php:243
62
  msgid "Only files with extensions matching this regular expressions will be processed. This is another important security value. Make sure you only add extensions which are safe for malicious users to have, e.g. archives and possibly images. Do NOT use any expression that could allow a user to download PHP files, even if you think it safe given the Allowed Directories option above."
63
  msgstr "Zpracovávány budou pouze soubory, jejichž přípony odpovídají tomuto regulárnímu výrazu. Jde o další důležitý bezpečnostní prvek. Dejte si pozor, ať jsou zde uvedeny pouze takové přípony, které nemohou být zneužity útočníky, tzn. komprimované archívy a případně obrázky. NEPOUŽÍVEJTE výrazy, které by mohly uživateli dovolit download PHP souborů, ani kdyby tyto soubory vylučovalo nastavení \"Povolené adresáře\" výše."
64
 
65
+ #: ../tags/0.05/simple-download-monitor.php:233
66
+ #: ../tags/0.06/simple-download-monitor.php:233
67
+ #: ../tags/0.07/simple-download-monitor.php:243
68
+ #: ../trunk/simple-download-monitor.php:244
69
  msgid "Default value is <code>zip|rar|7z</code> which only allows download of files ending with <code>.zip</code>, <code>.rar</code> and <code>.7z</code> (the leading <code>.</code> is implicit)."
70
  msgstr "Výchozí hodnota je <code>zip|rar|7z</code>, která povolí pouze stahování souborů s příponou <code>.zip</code>, <code>.rar</code> a <code>.7z</code> (úvodní <code>.</code> je dosazena automaticky)."
71
 
72
+ #: ../tags/0.05/simple-download-monitor.php:235
73
+ #: ../tags/0.06/simple-download-monitor.php:235
74
+ #: ../tags/0.07/simple-download-monitor.php:250
75
+ #: ../trunk/simple-download-monitor.php:251
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  msgid "Store detailed logs?"
77
  msgstr "Ukládat detailní záznamy?"
78
 
79
+ #: ../tags/0.05/simple-download-monitor.php:236
80
+ #: ../tags/0.06/simple-download-monitor.php:236
81
+ #: ../tags/0.07/simple-download-monitor.php:251
82
+ #: ../trunk/simple-download-monitor.php:252
83
  msgid "If detailed logs are allowed, various information (including exact time of download, user's IP address, referrer etc.) is stored. This can fill your database quickly if you have only a little space or a lot of popular downloads. Otherwise just the total numbers of downloads are stored, consuming significantly less space."
84
  msgstr "Pokud je tato volba zapnuta, ukládají se detailní informace (jako přesný čas, IP adresa uživatele nebo referer) o každém downloadu. To může rychle zahltit databázi, pokud máte jen málo prostoru nebo populární downloady. Normálně se ukládá jen celkový počet stažení, který zabírá podstatně méně místa."
85
 
86
+ #: ../tags/0.05/simple-download-monitor.php:237
87
+ #: ../tags/0.06/simple-download-monitor.php:237
88
+ #: ../tags/0.07/simple-download-monitor.php:252
89
+ #: ../trunk/simple-download-monitor.php:253
90
  msgid "Use detailed statistics."
91
  msgstr "Používat detailní statistiky"
92
 
93
+ #: ../tags/0.05/simple-download-monitor.php:238
94
+ #: ../tags/0.06/simple-download-monitor.php:238
95
+ #: ../tags/0.07/simple-download-monitor.php:253
96
+ #: ../trunk/simple-download-monitor.php:254
97
  msgid "Update settings"
98
  msgstr "Uložit nastavení"
99
 
100
+ #: ../tags/0.05/simple-download-monitor.php:343
101
+ #: ../tags/0.06/simple-download-monitor.php:343
102
+ #: ../tags/0.07/simple-download-monitor.php:358
103
+ #: ../trunk/simple-download-monitor.php:374
104
  msgid "First"
105
  msgstr "První"
106
 
107
+ #: ../tags/0.05/simple-download-monitor.php:344
108
+ #: ../tags/0.06/simple-download-monitor.php:344
109
+ #: ../tags/0.07/simple-download-monitor.php:359
110
+ #: ../trunk/simple-download-monitor.php:375
111
  msgid "Previous"
112
  msgstr "Předchozí"
113
 
114
+ #: ../tags/0.05/simple-download-monitor.php:349
115
+ #: ../tags/0.06/simple-download-monitor.php:349
116
+ #: ../tags/0.07/simple-download-monitor.php:364
117
+ #: ../trunk/simple-download-monitor.php:380
118
  msgid "Next"
119
  msgstr "Další"
120
 
121
+ #: ../tags/0.05/simple-download-monitor.php:350
122
+ #: ../tags/0.06/simple-download-monitor.php:350
123
+ #: ../tags/0.07/simple-download-monitor.php:365
124
+ #: ../trunk/simple-download-monitor.php:381
125
  msgid "Last"
126
  msgstr "Poslední"
127
 
128
+ #: ../tags/0.05/simple-download-monitor.php:365
129
+ #: ../tags/0.05/simple-download-monitor.php:428
130
+ #: ../tags/0.05/simple-download-monitor.php:496
131
+ #: ../tags/0.05/simple-download-monitor.php:497
132
+ #: ../tags/0.06/simple-download-monitor.php:365
133
+ #: ../tags/0.06/simple-download-monitor.php:430
134
+ #: ../tags/0.06/simple-download-monitor.php:498
135
+ #: ../tags/0.06/simple-download-monitor.php:499
136
+ #: ../tags/0.07/simple-download-monitor.php:380
137
+ #: ../tags/0.07/simple-download-monitor.php:445
138
+ #: ../tags/0.07/simple-download-monitor.php:513
139
+ #: ../tags/0.07/simple-download-monitor.php:514
140
+ #: ../trunk/simple-download-monitor.php:478
141
+ #: ../trunk/simple-download-monitor.php:555
142
+ #: ../trunk/simple-download-monitor.php:636
143
+ #: ../trunk/simple-download-monitor.php:637
144
  msgid "Simple Download Monitor"
145
  msgstr "Simple Download Monitor"
146
 
147
+ #: ../tags/0.05/simple-download-monitor.php:366
148
+ #: ../tags/0.06/simple-download-monitor.php:366
149
+ #: ../tags/0.07/simple-download-monitor.php:381
150
+ #: ../trunk/simple-download-monitor.php:479
151
  msgid "Nonexistent downloads"
152
  msgstr "Neexistující soubory"
153
 
154
+ #: ../tags/0.05/simple-download-monitor.php:366
155
+ #: ../tags/0.06/simple-download-monitor.php:366
156
+ #: ../tags/0.07/simple-download-monitor.php:381
157
+ #: ../trunk/simple-download-monitor.php:479
158
  msgid "All downloads"
159
  msgstr "Všechny downloady"
160
 
161
+ #: ../tags/0.05/simple-download-monitor.php:367
162
+ #: ../tags/0.06/simple-download-monitor.php:367
163
+ #: ../tags/0.07/simple-download-monitor.php:382
164
+ #: ../trunk/simple-download-monitor.php:480
165
  msgid "Show all downloads"
166
  msgstr "Zobrazit všechny soubory"
167
 
168
+ #: ../tags/0.05/simple-download-monitor.php:367
169
+ #: ../tags/0.06/simple-download-monitor.php:367
170
+ #: ../tags/0.07/simple-download-monitor.php:382
171
+ #: ../trunk/simple-download-monitor.php:480
172
  msgid "Show nonexistent downloads"
173
  msgstr "Zobrazit neexistující soubory"
174
 
175
+ #: ../tags/0.05/simple-download-monitor.php:378
176
+ #: ../tags/0.06/simple-download-monitor.php:378
177
+ #: ../tags/0.07/simple-download-monitor.php:393
178
+ #: ../trunk/simple-download-monitor.php:495
179
  msgid "Filename"
180
  msgstr "Název souboru"
181
 
182
+ #: ../tags/0.05/simple-download-monitor.php:379
183
+ #: ../tags/0.06/simple-download-monitor.php:379
184
+ #: ../tags/0.07/simple-download-monitor.php:394
185
+ #: ../trunk/simple-download-monitor.php:496
186
  msgid "Download count"
187
  msgstr "Počet stažení"
188
 
189
+ #: ../tags/0.05/simple-download-monitor.php:380
190
+ #: ../tags/0.06/simple-download-monitor.php:380
191
+ #: ../tags/0.07/simple-download-monitor.php:395
192
+ #: ../trunk/simple-download-monitor.php:497
193
  msgid "Last date"
194
  msgstr "Poslední datum"
195
 
196
+ #: ../tags/0.05/simple-download-monitor.php:429
197
+ #: ../tags/0.06/simple-download-monitor.php:431
198
+ #: ../tags/0.07/simple-download-monitor.php:446
199
+ #: ../trunk/simple-download-monitor.php:556
200
  #, php-format
201
  msgid "Detailed data for <strong>%s</strong>:"
202
  msgstr "Detailní data pro <strong>%s</strong>:"
203
 
204
+ #: ../tags/0.05/simple-download-monitor.php:430
205
+ #: ../tags/0.06/simple-download-monitor.php:432
206
+ #: ../tags/0.07/simple-download-monitor.php:447
207
+ #: ../trunk/simple-download-monitor.php:557
208
  #, php-format
209
  msgid "Total number of downloads: <strong>%d</strong>."
210
  msgstr "Celkový počet stažení: <strong>%d</strong>."
211
 
212
+ #: ../tags/0.05/simple-download-monitor.php:442
213
+ #: ../tags/0.06/simple-download-monitor.php:444
214
+ #: ../tags/0.07/simple-download-monitor.php:459
215
+ #: ../trunk/simple-download-monitor.php:573
216
  msgid "Date"
217
  msgstr "Datum"
218
 
219
+ #: ../tags/0.05/simple-download-monitor.php:443
220
+ #: ../tags/0.06/simple-download-monitor.php:445
221
+ #: ../tags/0.07/simple-download-monitor.php:460
222
+ #: ../trunk/simple-download-monitor.php:574
223
  msgid "IP address"
224
  msgstr "IP adresa"
225
 
226
+ #: ../tags/0.05/simple-download-monitor.php:444
227
+ #: ../tags/0.06/simple-download-monitor.php:446
228
+ #: ../tags/0.07/simple-download-monitor.php:461
229
+ #: ../trunk/simple-download-monitor.php:575
230
  msgid "Referer"
231
  msgstr "Referer"
232
 
233
+ #: ../tags/0.05/simple-download-monitor.php:445
234
+ #: ../tags/0.06/simple-download-monitor.php:447
235
+ #: ../tags/0.07/simple-download-monitor.php:462
236
+ #: ../trunk/simple-download-monitor.php:576
237
  msgid "Username"
238
  msgstr "Uživatel"
239
 
240
+ #: ../tags/0.05/simple-download-monitor.php:474
241
+ #: ../tags/0.06/simple-download-monitor.php:476
242
+ #: ../tags/0.07/simple-download-monitor.php:491
243
+ #: ../trunk/simple-download-monitor.php:614
244
  msgid "Return to full list."
245
  msgstr "Návrat do úplného seznamu"
246
 
247
+ #: ../tags/0.07/simple-download-monitor.php:245
248
+ #: ../trunk/simple-download-monitor.php:246
249
+ msgid "Inline files"
250
+ msgstr "Soubory pro inline zobrazení"
251
+
252
+ #: ../tags/0.07/simple-download-monitor.php:246
253
+ #: ../trunk/simple-download-monitor.php:247
254
+ msgid "Files whose names match this regular expression will be displayed inline (within a HTML page) rather than downloaded."
255
+ msgstr "Soubory, které vyhovují tomuto regulárnímu výrazu, budou zobrazeny inline (jako objekt - např. obrázek nebo video - uvnitř HTML stránky) místo aby se stahovaly."
256
+
257
+ #: ../tags/0.07/simple-download-monitor.php:247
258
+ #: ../trunk/simple-download-monitor.php:248
259
+ msgid "By default, this value is empty - no files will appear inline, all will be downloaded. You may want to place something like <code>\\.(jpe?g|gif|png|swf)$</code> here to make images and Flash videos appear inline."
260
+ msgstr "Výchozí hodnotou je prázdný řetězec - všechny soubory se budou stahovat, žádný nebude zobrazen inline. Vepište sem něco jako <code>\\.(jpe?g|gif|png|swf)$</code> pro zobrazování obrázků a Flashů inline."
261
+
262
+ #: ../tags/0.07/simple-download-monitor.php:248
263
+ #: ../trunk/simple-download-monitor.php:249
264
+ msgid "Note: Unlike the options above, nothing is implied in this regular expression. You <em>must</em> use an explicit <code>\\.</code> to denote \"start of extension\", you <em>must</em> use an explicit <code>$</code> to mark \"end of filename\", etc."
265
+ msgstr "Pozn.: Narozdíl od nastavení uvedených výše se do tohoto regulárního výrazu nic nedoplňuje. Pokud chcete vyznačit \"začátek přípony\", <em>musíte</em> sem napsat <code>\\.</code>; pokud chcete vyznačit \"konec názvu souboru\", <em>musíte</em> sem napsat <code>$</code>, a podobně."
266
+
267
+ #: ../trunk/simple-download-monitor.php:520
268
+ #: ../trunk/simple-download-monitor.php:599
269
+ msgid "Delete"
270
+ msgstr "Smazat"
271
+
272
+ #: ../trunk/simple-download-monitor.php:528
273
+ #: ../trunk/simple-download-monitor.php:607
274
+ msgid "Delete Checked"
275
+ msgstr "Smazat vybrané"
276
+
277
+ #: ../trunk/simple-download-monitor.php:529
278
+ #: ../trunk/simple-download-monitor.php:610
279
+ msgid "Delete All"
280
+ msgstr "Smazat všechny"
281
+
282
+ #: ../trunk/simple-download-monitor.php:529
283
+ #: ../trunk/simple-download-monitor.php:610
284
+ msgid "Yes, I am sure"
285
+ msgstr "Ano, chci to udělat"
286
+
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: files, counter, count, tracking, download monitor, monitor, downloads, download
5
  Requires at least: 2.8.0
6
  Tested up to: 2.8.4
7
- Stable tag: 0.07
8
 
9
  Count the number of downloads without having to maintain a comprehensive download page.
10
 
@@ -84,6 +84,16 @@ webhosting.
84
 
85
  == Changelog ==
86
 
 
 
 
 
 
 
 
 
 
 
87
  = 0.07 =
88
  * Simple Download Monitor now allows inline content, e.g. images and
89
  videos that display within pages rather than download as a file.
4
  Tags: files, counter, count, tracking, download monitor, monitor, downloads, download
5
  Requires at least: 2.8.0
6
  Tested up to: 2.8.4
7
+ Stable tag: 0.08
8
 
9
  Count the number of downloads without having to maintain a comprehensive download page.
10
 
84
 
85
  == Changelog ==
86
 
87
+ = 0.08 =
88
+ * Administrators can now delete download statistics from the Tools panel:
89
+ A checkbox is shown next to each record, and a button for deleting checked
90
+ records is provided at the bottom of the list. A button for deleting all
91
+ records is also provided. This is true for both the global list and
92
+ details list.
93
+
94
+ Note: This function is only allowed for users with a "delete_user"
95
+ capability (by default, that means only Administrators).
96
+
97
  = 0.07 =
98
  * Simple Download Monitor now allows inline content, e.g. images and
99
  videos that display within pages rather than download as a file.
sdmon.css DELETED
@@ -1,10 +0,0 @@
1
- #sdmon .sdmon-rownum { width: 3ex; text-align: right; }
2
- #sdmon .sdmon-filename { }
3
- #sdmon .sdmon-count { text-align: right; }
4
- #sdmon .sdmon-date { width: 24ex; text-align: center; }
5
- #sdmon .sdmon-nonex { width: 5ex; text-align: center; }
6
- #sdmon .sdmon-ipaddr { }
7
- #sdmon .sdmon-referer { }
8
- #sdmon .sdmon-username { }
9
- #sdmon th {text-align: center; }
10
- #sdmon th, #sdmon td { padding-left: 1ex; padding-right: 1ex; }
 
 
 
 
 
 
 
 
 
 
simple-download-monitor.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Simple Download Monitor
5
  Plugin URI: http://www.pepak.net/wordpress/simple-download-monitor-plugin
6
  Description: Count the number of downloads without having to maintain a comprehensive download page.
7
- Version: 0.07
8
  Author: Pepak
9
  Author URI: http://www.pepak.net
10
  */
@@ -31,11 +31,12 @@ if (!class_exists('SimpleDownloadMonitor'))
31
  class SimpleDownloadMonitor
32
  {
33
 
34
- const VERSION = '0.07';
35
  const PREFIX = 'sdmon_';
36
  const PREG_DELIMITER = '`';
37
  const GET_PARAM = 'sdmon';
38
  const RECORDS_PER_PAGE = 20;
 
39
 
40
  protected $plugin_url = '';
41
  protected $plugin_dir = '';
@@ -186,9 +187,9 @@ if (!class_exists('SimpleDownloadMonitor'))
186
  {
187
  $moFile = $this->plugin_dir . "/lang/" . $currentLocale . ".mo";
188
  if(@file_exists($moFile) && is_readable($moFile))
189
- load_textdomain('simple-download-monitor', $moFile);
190
  }
191
- //load_plugin_textdomain('simple-download-monitor', $this->plugin_dir . '/lang');
192
  if (isset($_GET[self::GET_PARAM]) && ($filename = $_GET[self::GET_PARAM]))
193
  {
194
  if ($this->Download($filename))
@@ -233,24 +234,24 @@ if (!class_exists('SimpleDownloadMonitor'))
233
  ?>
234
  <div class="wrap">
235
  <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
236
- <h2><?php echo __('Simple Download Monitor options', 'simple-download-monitor'); ?></h2>
237
- <h3><?php echo __('Allowed directories', 'simple-download-monitor'); ?></h3>
238
- <p><?php echo __("Only requested files whose full names (relative to document root) start with this regular expression will be processed. It is strongly recommended to place all downloadable files (and ONLY downloadable files) into a designated directory and then placing that directory's name followed by a slash here. It is possible to use the power of PREG to allow multiple directories, but make sure there are ONLY files which you are comfortable with malicious users downloading. Do not EVER allow directories which contain PHP files here! That could lead to disclosure of sensitive data, including username and password used to connect to WordPress database.", 'simple-download-monitor'); ?></p>
239
- <p><?php echo __("Default value is <code>files/</code>, which only allows download from /files directory (the leading <code>/</code> is implicit).", 'simple-download-monitor'); ?></p>
240
  <p><input type="text" name="<?php echo self::PREFIX; ?>directories" value="<?php echo attribute_escape($directories); ?>" /></p>
241
- <h3><?php echo __('Allowed extensions', 'simple-download-monitor'); ?></h3>
242
- <p><?php echo __('Only files with extensions matching this regular expressions will be processed. This is another important security value. Make sure you only add extensions which are safe for malicious users to have, e.g. archives and possibly images. Do NOT use any expression that could allow a user to download PHP files, even if you think it safe given the Allowed Directories option above.', 'simple-download-monitor'); ?></p>
243
- <p><?php echo __("Default value is <code>zip|rar|7z</code> which only allows download of files ending with <code>.zip</code>, <code>.rar</code> and <code>.7z</code> (the leading <code>.</code> is implicit).", 'simple-download-monitor'); ?></p>
244
  <p><input type="text" name="<?php echo self::PREFIX; ?>extensions" value="<?php echo attribute_escape($extensions); ?>" /></p>
245
- <h3><?php echo __('Inline files', 'simple-download-monitor'); ?></h3>
246
- <p><?php echo __('Files whose names match this regular expression will be displayed inline (within a HTML page) rather than downloaded.', 'simple-download-monitor'); ?></p>
247
- <p><?php echo __("By default, this value is empty - no files will appear inline, all will be downloaded. You may want to place something like <code>\.(jpe?g|gif|png|swf)$</code> here to make images and Flash videos appear inline.", 'simple-download-monitor'); ?></p>
248
- <p><?php echo __('Note: Unlike the options above, nothing is implied in this regular expression. You <em>must</em> use an explicit <code>\.</code> to denote "start of extension", you <em>must</em> use an explicit <code>$</code> to mark "end of filename", etc.', 'simple-download-monitor'); ?></p>
249
  <p><input type="text" name="<?php echo self::PREFIX; ?>inline" value="<?php echo attribute_escape($inline); ?>" /></p>
250
- <h3><?php echo __("Store detailed logs?", 'simple-download-monitor'); ?></h3>
251
- <p><?php echo __("If detailed logs are allowed, various information (including exact time of download, user's IP address, referrer etc.) is stored. This can fill your database quickly if you have only a little space or a lot of popular downloads. Otherwise just the total numbers of downloads are stored, consuming significantly less space.", 'simple-download-monitor'); ?></p>
252
- <p><label for="<?php echo self::PREFIX; ?>detailed"><input type="checkbox" name="<?php echo self::PREFIX; ?>detailed" value="1" <?php if ($detailed) echo 'checked="checked" '; ?>/> <?php echo __('Use detailed statistics.', 'simple-download-monitor'); ?></label></p>
253
- <div class="submit"><input type="submit" name="SimpleDownloadMonitor_Submit" value="<?php echo __("Update settings", 'simple-download-monitor') ?>" /></div>
254
  </form>
255
  </div><?php
256
  }
@@ -263,6 +264,21 @@ if (!class_exists('SimpleDownloadMonitor'))
263
  $flags = isset($_GET['flags']) ? intval($_GET['flags']) : 0;
264
  $detailed = get_option(self::PREFIX . 'detailed');
265
  $options = array('download' => $download, 'from' => $from, 'order' => $order, 'flags' => $flags);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
  if ($detailed && $download)
267
  $this->DetailedDownloadList($options);
268
  else
@@ -355,19 +371,101 @@ if (!class_exists('SimpleDownloadMonitor'))
355
  $pages = array();
356
  if ($from > 0)
357
  {
358
- $pages[] = '<a href="' . $this->GetUrlForList(array_merge($options, array('from'=>0))) . '">' . __("First", 'simple-download-monitor') . '</a>';
359
- $pages[] = '<a href="' . $this->GetUrlForList(array_merge($options, array('from'=>($from>self::RECORDS_PER_PAGE ? $from-self::RECORDS_PER_PAGE : 0)))) . '">' . __("Previous", 'simple-download-monitor') . '</a>';
360
  }
361
 
362
  if (($from + self::RECORDS_PER_PAGE) < $count)
363
  {
364
- $pages[] = '<a href="' . $this->GetUrlForList(array_merge($options, array('from'=>$from+self::RECORDS_PER_PAGE))) . '">' . __("Next", 'simple-download-monitor') . '</a>';
365
- $pages[] = '<a href="' . $this->GetUrlForList(array_merge($options, array('from'=>$count-self::RECORDS_PER_PAGE))) . '">' . __("Last", 'simple-download-monitor') . '</a>';
366
  }
367
  $result = $pages ? '<div class="pages-list">' . implode(' ', $pages) . '</div>' : '';
368
  return $result;
369
  }
370
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
371
  protected function DownloadList($options)
372
  {
373
  global $wpdb;
@@ -377,22 +475,27 @@ if (!class_exists('SimpleDownloadMonitor'))
377
  $detailed = get_option(self::PREFIX . 'detailed');
378
  ?>
379
  <div class="wrap">
380
- <h2><?php echo __('Simple Download Monitor', 'simple-download-monitor'); ?></h2>
381
- <h3><?php echo ($options['flags'] & self::FLAGS_NOTEXISTING) ? __('Nonexistent downloads', 'simple-download-monitor') : __('All downloads', 'simple-download-monitor'); ?></h3>
382
- <p><a href="<?php echo $this->GetUrlForList(array_merge($options, array('from' => 0, 'flags' => $options['flags']^self::FLAGS_NOTEXISTING))); ?>"><?php echo ($options['flags'] & self::FLAGS_NOTEXISTING) ? __('Show all downloads', 'simple-download-monitor') : __('Show nonexistent downloads', 'simple-download-monitor'); ?></a></p>
 
 
 
383
  <table id="sdmon">
384
  <colgroup>
385
  <col class="sdmon-rownum" align="right" width="32" />
386
  <col class="sdmon-filename" />
387
  <col class="sdmon-count" align="right" width="64" />
388
  <col class="sdmon-date" align="center" />
 
389
  </colgroup>
390
  <thead>
391
  <tr>
392
  <th>&nbsp;</th>
393
- <th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_NAME ))); ?>"><?php echo __("Filename", 'simple-download-monitor'); ?></a></th>
394
- <th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_COUNT))); ?>"><?php echo __("Download count", 'simple-download-monitor'); ?></a></th>
395
- <th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_DATE ))); ?>"><?php echo __("Last date", 'simple-download-monitor'); ?></a></th>
 
396
  </tr>
397
  </thead>
398
  <tbody><?php
@@ -414,12 +517,18 @@ if (!class_exists('SimpleDownloadMonitor'))
414
  <td><?php if ($detailed): ?><a href="<?php echo $this->GetUrlForList(array('download' => $download)); ?>"><?php endif; echo htmlspecialchars($filename); if ($detailed): ?></a><?php endif; ?></td>
415
  <td><?php echo $count; ?></td>
416
  <td><?php echo mysql2date('Y-m-d h:i:s', $date, TRUE); ?></td>
 
417
  </tr>
418
  </tbody><?php
419
  }
420
  }
421
  ?>
422
  </table>
 
 
 
 
 
423
  <?php echo $this->Paginator($options, $totalcount); ?>
424
  </div><?php
425
  }
@@ -436,15 +545,19 @@ if (!class_exists('SimpleDownloadMonitor'))
436
  list($id, $filename, $count) = $wpdb->get_row($wpdb->prepare("SELECT id, filename, download_count FROM ${table_downloads} WHERE id=%d", $download), ARRAY_N);
437
  if (!$id)
438
  {
439
- DownloadList($options);
 
440
  }
441
  else
442
  {
443
  ?>
444
  <div class="wrap">
445
- <h2><?php echo __('Simple Download Monitor', 'simple-download-monitor'); ?></h2>
446
- <h3><?php printf(__('Detailed data for <strong>%s</strong>:', 'simple-download-monitor'), $filename); ?></h3>
447
- <p><?php printf(__('Total number of downloads: <strong>%d</strong>.', 'simple-download-monitor'), $count); ?></p>
 
 
 
448
  <table id="sdmon">
449
  <colgroup>
450
  <col class="sdmon-rownum" align="right" width="32" />
@@ -452,14 +565,16 @@ if (!class_exists('SimpleDownloadMonitor'))
452
  <col class="sdmon-ipaddr" />
453
  <col class="sdmon-referer" />
454
  <col class="sdmon-username" />
 
455
  </colgroup>
456
  <thead>
457
  <tr>
458
  <th>&nbsp;</th>
459
- <th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_DATE ))); ?>"><?php echo __("Date", 'simple-download-monitor'); ?></a></th>
460
- <th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_IP ))); ?>"><?php echo __("IP address", 'simple-download-monitor'); ?></a></th>
461
- <th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_REFERER))); ?>"><?php echo __("Referer", 'simple-download-monitor'); ?></a></th>
462
- <th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_USER ))); ?>"><?php echo __("Username", 'simple-download-monitor'); ?></a></th>
 
463
  </tr>
464
  </thead>
465
  <tbody><?php
@@ -467,13 +582,13 @@ if (!class_exists('SimpleDownloadMonitor'))
467
  $where = $this->GetDetailWhere($flags);
468
  $orderby = $this->GetDetailOrderBy($order);
469
  $limit = $this->GetLimit($from);
470
- $sql = "SELECT download_date, ip, referer, userid, username FROM ${table_details} WHERE download=%d ${where} ${orderby} ${limit}";
471
  $totalcount = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM ${table_details} WHERE download=%d ${where}", $download));
472
  $results = $wpdb->get_results($wpdb->prepare($sql, $download), ARRAY_N);
473
  $rownum = intval($options['from']);
474
  foreach ($results as $row) {
475
  $rownum++;
476
- list($date, $ip, $referer, $userid, $username) = $row;
477
  ?>
478
  <tr>
479
  <td><?php echo $rownum; ?>.</td>
@@ -481,14 +596,22 @@ if (!class_exists('SimpleDownloadMonitor'))
481
  <td><?php echo htmlspecialchars($ip); ?></td>
482
  <td><?php echo htmlspecialchars($referer); ?></td>
483
  <td><?php echo htmlspecialchars($username); ?></td>
 
484
  </tr>
485
  </tbody><?php
486
  }
487
  }
488
  ?>
489
  </table>
 
 
 
 
 
 
 
490
  <?php echo $this->Paginator($options, $totalcount); ?>
491
- <p><a href="<?php echo $this->GetUrlForList(); ?>"><?php echo __('Return to full list.', 'simple-download-monitor'); ?></a></p>
492
  </div><?php
493
  }
494
 
@@ -510,8 +633,8 @@ if (!function_exists('SimpleDownloadMonitor_BuildAdminMenu'))
510
  global $sdmon;
511
  if (isset($sdmon))
512
  {
513
- $options_page = add_options_page(__('Simple Download Monitor options', 'simple-download-monitor'), __('Simple Download Monitor', 'simple-download-monitor'), 'manage_options', basename(__FILE__), array(&$sdmon, 'AdminPanel'));
514
- $tool_page = add_submenu_page('tools.php', __('Simple Download Monitor', 'simple-download-monitor'), __('Simple Download Monitor', 'simple-download-monitor'), 'read', basename(__FILE__), array(&$sdmon, 'ToolsPanel'));
515
  add_action('admin_head-'.$tool_page, array(&$sdmon, 'ActionHead'));
516
  }
517
  }
4
  Plugin Name: Simple Download Monitor
5
  Plugin URI: http://www.pepak.net/wordpress/simple-download-monitor-plugin
6
  Description: Count the number of downloads without having to maintain a comprehensive download page.
7
+ Version: 0.08
8
  Author: Pepak
9
  Author URI: http://www.pepak.net
10
  */
31
  class SimpleDownloadMonitor
32
  {
33
 
34
+ const VERSION = '0.08';
35
  const PREFIX = 'sdmon_';
36
  const PREG_DELIMITER = '`';
37
  const GET_PARAM = 'sdmon';
38
  const RECORDS_PER_PAGE = 20;
39
+ const GETTEXT_REALM = 'simple-download-monitor';
40
 
41
  protected $plugin_url = '';
42
  protected $plugin_dir = '';
187
  {
188
  $moFile = $this->plugin_dir . "/lang/" . $currentLocale . ".mo";
189
  if(@file_exists($moFile) && is_readable($moFile))
190
+ load_textdomain(self::GETTEXT_REALM, $moFile);
191
  }
192
+ //load_plugin_textdomain(self::GETTEXT_REALM, $this->plugin_dir . '/lang');
193
  if (isset($_GET[self::GET_PARAM]) && ($filename = $_GET[self::GET_PARAM]))
194
  {
195
  if ($this->Download($filename))
234
  ?>
235
  <div class="wrap">
236
  <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
237
+ <h2><?php echo __('Simple Download Monitor options', self::GETTEXT_REALM); ?></h2>
238
+ <h3><?php echo __('Allowed directories', self::GETTEXT_REALM); ?></h3>
239
+ <p><?php echo __("Only requested files whose full names (relative to document root) start with this regular expression will be processed. It is strongly recommended to place all downloadable files (and ONLY downloadable files) into a designated directory and then placing that directory's name followed by a slash here. It is possible to use the power of PREG to allow multiple directories, but make sure there are ONLY files which you are comfortable with malicious users downloading. Do not EVER allow directories which contain PHP files here! That could lead to disclosure of sensitive data, including username and password used to connect to WordPress database.", self::GETTEXT_REALM); ?></p>
240
+ <p><?php echo __("Default value is <code>files/</code>, which only allows download from /files directory (the leading <code>/</code> is implicit).", self::GETTEXT_REALM); ?></p>
241
  <p><input type="text" name="<?php echo self::PREFIX; ?>directories" value="<?php echo attribute_escape($directories); ?>" /></p>
242
+ <h3><?php echo __('Allowed extensions', self::GETTEXT_REALM); ?></h3>
243
+ <p><?php echo __('Only files with extensions matching this regular expressions will be processed. This is another important security value. Make sure you only add extensions which are safe for malicious users to have, e.g. archives and possibly images. Do NOT use any expression that could allow a user to download PHP files, even if you think it safe given the Allowed Directories option above.', self::GETTEXT_REALM); ?></p>
244
+ <p><?php echo __("Default value is <code>zip|rar|7z</code> which only allows download of files ending with <code>.zip</code>, <code>.rar</code> and <code>.7z</code> (the leading <code>.</code> is implicit).", self::GETTEXT_REALM); ?></p>
245
  <p><input type="text" name="<?php echo self::PREFIX; ?>extensions" value="<?php echo attribute_escape($extensions); ?>" /></p>
246
+ <h3><?php echo __('Inline files', self::GETTEXT_REALM); ?></h3>
247
+ <p><?php echo __('Files whose names match this regular expression will be displayed inline (within a HTML page) rather than downloaded.', self::GETTEXT_REALM); ?></p>
248
+ <p><?php echo __("By default, this value is empty - no files will appear inline, all will be downloaded. You may want to place something like <code>\.(jpe?g|gif|png|swf)$</code> here to make images and Flash videos appear inline.", self::GETTEXT_REALM); ?></p>
249
+ <p><?php echo __('Note: Unlike the options above, nothing is implied in this regular expression. You <em>must</em> use an explicit <code>\.</code> to denote "start of extension", you <em>must</em> use an explicit <code>$</code> to mark "end of filename", etc.', self::GETTEXT_REALM); ?></p>
250
  <p><input type="text" name="<?php echo self::PREFIX; ?>inline" value="<?php echo attribute_escape($inline); ?>" /></p>
251
+ <h3><?php echo __("Store detailed logs?", self::GETTEXT_REALM); ?></h3>
252
+ <p><?php echo __("If detailed logs are allowed, various information (including exact time of download, user's IP address, referrer etc.) is stored. This can fill your database quickly if you have only a little space or a lot of popular downloads. Otherwise just the total numbers of downloads are stored, consuming significantly less space.", self::GETTEXT_REALM); ?></p>
253
+ <p><label for="<?php echo self::PREFIX; ?>detailed"><input type="checkbox" name="<?php echo self::PREFIX; ?>detailed" value="1" <?php if ($detailed) echo 'checked="checked" '; ?>/> <?php echo __('Use detailed statistics.', self::GETTEXT_REALM); ?></label></p>
254
+ <div class="submit"><input type="submit" name="SimpleDownloadMonitor_Submit" value="<?php echo __("Update settings", self::GETTEXT_REALM) ?>" /></div>
255
  </form>
256
  </div><?php
257
  }
264
  $flags = isset($_GET['flags']) ? intval($_GET['flags']) : 0;
265
  $detailed = get_option(self::PREFIX . 'detailed');
266
  $options = array('download' => $download, 'from' => $from, 'order' => $order, 'flags' => $flags);
267
+ if ($this->IsAdmin())
268
+ {
269
+ if (isset($_POST['SimpleDownloadMonitor_Delete']) && isset($_POST['SimpleDownloadMonitor_DeleteIds']) && is_array($_POST['SimpleDownloadMonitor_DeleteIds']))
270
+ {
271
+ $this->DeleteDownloads($_POST['SimpleDownloadMonitor_DeleteIds']);
272
+ }
273
+ elseif (isset($_POST['SimpleDownloadMonitor_DeleteAll']) && ($_POST['SimpleDownloadMonitor_DeleteAllReally'] == 'yes'))
274
+ {
275
+ $this->DeleteAllDownloads();
276
+ }
277
+ if (isset($_POST['SimpleDownloadMonitor_DeleteDetail']) && isset($_POST['SimpleDownloadMonitor_DeleteIds']) && is_array($_POST['SimpleDownloadMonitor_DeleteIds']))
278
+ {
279
+ $this->DeleteDownloadDetails($_POST['SimpleDownloadMonitor_DeleteIds']);
280
+ }
281
+ }
282
  if ($detailed && $download)
283
  $this->DetailedDownloadList($options);
284
  else
371
  $pages = array();
372
  if ($from > 0)
373
  {
374
+ $pages[] = '<a href="' . $this->GetUrlForList(array_merge($options, array('from'=>0))) . '">' . __("First", self::GETTEXT_REALM) . '</a>';
375
+ $pages[] = '<a href="' . $this->GetUrlForList(array_merge($options, array('from'=>($from>self::RECORDS_PER_PAGE ? $from-self::RECORDS_PER_PAGE : 0)))) . '">' . __("Previous", self::GETTEXT_REALM) . '</a>';
376
  }
377
 
378
  if (($from + self::RECORDS_PER_PAGE) < $count)
379
  {
380
+ $pages[] = '<a href="' . $this->GetUrlForList(array_merge($options, array('from'=>$from+self::RECORDS_PER_PAGE))) . '">' . __("Next", self::GETTEXT_REALM) . '</a>';
381
+ $pages[] = '<a href="' . $this->GetUrlForList(array_merge($options, array('from'=>$count-self::RECORDS_PER_PAGE))) . '">' . __("Last", self::GETTEXT_REALM) . '</a>';
382
  }
383
  $result = $pages ? '<div class="pages-list">' . implode(' ', $pages) . '</div>' : '';
384
  return $result;
385
  }
386
 
387
+ protected function IsAdmin()
388
+ {
389
+ if (current_user_can('delete_users'))
390
+ /*
391
+ global $user_level;
392
+ get_currentuserinfo();
393
+ if ($user_level >= 10)
394
+ */
395
+ return TRUE;
396
+ else
397
+ return FALSE;
398
+ }
399
+
400
+ protected function DeleteDownloadDetails($ids = array())
401
+ {
402
+ global $wpdb;
403
+ $ids = array_map('intval', $ids);
404
+ if ($ids)
405
+ {
406
+ $ids = implode(',', $ids);
407
+ $downloads = $this->table_downloads();
408
+ $details = $this->table_details();
409
+ $downloadids = array();
410
+ $sql = "SELECT DISTINCT download FROM ${details} WHERE id IN (${ids})";
411
+ $results = $wpdb->get_results($sql, ARRAY_N);
412
+ if (is_array($results))
413
+ foreach ($results as $row)
414
+ {
415
+ list($downloadid) = $row;
416
+ $downloadids[] = $downloadid;
417
+ }
418
+ if ($downloadids) {
419
+ $sql = "DELETE FROM ${details} WHERE id IN (${ids})";
420
+ $wpdb->query($sql);
421
+ foreach ($downloadids as $downloadid)
422
+ {
423
+ $sql = "SELECT COUNT(*), MAX(download_date) FROM ${details} WHERE download=%d";
424
+ $result = $wpdb->get_row($wpdb->prepare($sql, $downloadid), ARRAY_N);
425
+ if (is_array($result))
426
+ {
427
+ list($count, $date) = $result;
428
+ $sql = "UPDATE ${downloads} SET download_count=%d, last_date=%s WHERE id=%d";
429
+ $wpdb->query($wpdb->prepare($sql, $count, $date, $downloadid));
430
+ }
431
+ }
432
+ }
433
+ }
434
+ //wp_redirect($_SERVER['REQUEST_URI']);
435
+ //die();
436
+ }
437
+
438
+ protected function DeleteDownloads($ids = array())
439
+ {
440
+ global $wpdb;
441
+ $ids = array_map('intval', $ids);
442
+ if ($ids)
443
+ {
444
+ $ids = implode(',', $ids);
445
+ $downloads = $this->table_downloads();
446
+ $details = $this->table_details();
447
+ $sql = "DELETE FROM ${downloads} WHERE id IN (${ids})";
448
+ $wpdb->query($sql);
449
+ $sql = "DELETE FROM ${details} WHERE download IN (${ids})";
450
+ $wpdb->query($sql);
451
+ }
452
+ //wp_redirect($_SERVER['REQUEST_URI']);
453
+ //die();
454
+ }
455
+
456
+ protected function DeleteAllDownloads()
457
+ {
458
+ global $wpdb;
459
+ $downloads = $this->table_downloads();
460
+ $details = $this->table_details();
461
+ $sql = "DELETE FROM ${downloads}";
462
+ $wpdb->query($sql);
463
+ $sql = "DELETE FROM ${details}";
464
+ $wpdb->query($sql);
465
+ //wp_redirect($_SERVER['REQUEST_URI']);
466
+ //die();
467
+ }
468
+
469
  protected function DownloadList($options)
470
  {
471
  global $wpdb;
475
  $detailed = get_option(self::PREFIX . 'detailed');
476
  ?>
477
  <div class="wrap">
478
+ <h2><?php echo __('Simple Download Monitor', self::GETTEXT_REALM); ?></h2>
479
+ <h3><?php echo ($options['flags'] & self::FLAGS_NOTEXISTING) ? __('Nonexistent downloads', self::GETTEXT_REALM) : __('All downloads', self::GETTEXT_REALM); ?></h3>
480
+ <p><a href="<?php echo $this->GetUrlForList(array_merge($options, array('from' => 0, 'flags' => $options['flags']^self::FLAGS_NOTEXISTING))); ?>"><?php echo ($options['flags'] & self::FLAGS_NOTEXISTING) ? __('Show all downloads', self::GETTEXT_REALM) : __('Show nonexistent downloads', self::GETTEXT_REALM); ?></a></p>
481
+ <?php if ($this->isAdmin()): ?>
482
+ <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
483
+ <?php endif; ?>
484
  <table id="sdmon">
485
  <colgroup>
486
  <col class="sdmon-rownum" align="right" width="32" />
487
  <col class="sdmon-filename" />
488
  <col class="sdmon-count" align="right" width="64" />
489
  <col class="sdmon-date" align="center" />
490
+ <col class="sdmon-tools" />
491
  </colgroup>
492
  <thead>
493
  <tr>
494
  <th>&nbsp;</th>
495
+ <th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_NAME ))); ?>"><?php echo __("Filename", self::GETTEXT_REALM); ?></a></th>
496
+ <th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_COUNT))); ?>"><?php echo __("Download count", self::GETTEXT_REALM); ?></a></th>
497
+ <th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_DATE ))); ?>"><?php echo __("Last date", self::GETTEXT_REALM); ?></a></th>
498
+ <th>&nbsp;</th>
499
  </tr>
500
  </thead>
501
  <tbody><?php
517
  <td><?php if ($detailed): ?><a href="<?php echo $this->GetUrlForList(array('download' => $download)); ?>"><?php endif; echo htmlspecialchars($filename); if ($detailed): ?></a><?php endif; ?></td>
518
  <td><?php echo $count; ?></td>
519
  <td><?php echo mysql2date('Y-m-d h:i:s', $date, TRUE); ?></td>
520
+ <td><?php if ($this->IsAdmin()): ?><input type="checkbox" name="SimpleDownloadMonitor_DeleteIds[]" value="<?php echo $download; ?>" /><label for="SimpleDownloadMonitor_DeleteIds[]"> <?php echo __('Delete', self::GETTEXT_REALM); ?></label><?php else: ?>&nbsp;<?php endif; ?></td>
521
  </tr>
522
  </tbody><?php
523
  }
524
  }
525
  ?>
526
  </table>
527
+ <?php if ($this->isAdmin()): ?>
528
+ <div><input type="submit" name="SimpleDownloadMonitor_Delete" value="<?php echo __('Delete Checked', self::GETTEXT_REALM); ?>" /></div>
529
+ <div><input type="submit" name="SimpleDownloadMonitor_DeleteAll" value="<?php echo __('Delete All', self::GETTEXT_REALM); ?>" /> - <input type="checkbox" name="SimpleDownloadMonitor_DeleteAllReally" value="yes" /><label for="SimpleDownloadMonitor_DeleteAllReally"> <?php echo __('Yes, I am sure', self::GETTEXT_REALM); ?></label></div>
530
+ </form>
531
+ <?php endif; ?>
532
  <?php echo $this->Paginator($options, $totalcount); ?>
533
  </div><?php
534
  }
545
  list($id, $filename, $count) = $wpdb->get_row($wpdb->prepare("SELECT id, filename, download_count FROM ${table_downloads} WHERE id=%d", $download), ARRAY_N);
546
  if (!$id)
547
  {
548
+ $this->DownloadList($options);
549
+ return;
550
  }
551
  else
552
  {
553
  ?>
554
  <div class="wrap">
555
+ <h2><?php echo __('Simple Download Monitor', self::GETTEXT_REALM); ?></h2>
556
+ <h3><?php printf(__('Detailed data for <strong>%s</strong>:', self::GETTEXT_REALM), $filename); ?></h3>
557
+ <p><?php printf(__('Total number of downloads: <strong>%d</strong>.', self::GETTEXT_REALM), $count); ?></p>
558
+ <?php if ($this->isAdmin()): ?>
559
+ <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
560
+ <?php endif; ?>
561
  <table id="sdmon">
562
  <colgroup>
563
  <col class="sdmon-rownum" align="right" width="32" />
565
  <col class="sdmon-ipaddr" />
566
  <col class="sdmon-referer" />
567
  <col class="sdmon-username" />
568
+ <col class="sdmon-tools" />
569
  </colgroup>
570
  <thead>
571
  <tr>
572
  <th>&nbsp;</th>
573
+ <th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_DATE ))); ?>"><?php echo __("Date", self::GETTEXT_REALM); ?></a></th>
574
+ <th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_IP ))); ?>"><?php echo __("IP address", self::GETTEXT_REALM); ?></a></th>
575
+ <th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_REFERER))); ?>"><?php echo __("Referer", self::GETTEXT_REALM); ?></a></th>
576
+ <th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_USER ))); ?>"><?php echo __("Username", self::GETTEXT_REALM); ?></a></th>
577
+ <th>&nbsp;</th>
578
  </tr>
579
  </thead>
580
  <tbody><?php
582
  $where = $this->GetDetailWhere($flags);
583
  $orderby = $this->GetDetailOrderBy($order);
584
  $limit = $this->GetLimit($from);
585
+ $sql = "SELECT id, download_date, ip, referer, userid, username FROM ${table_details} WHERE download=%d ${where} ${orderby} ${limit}";
586
  $totalcount = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM ${table_details} WHERE download=%d ${where}", $download));
587
  $results = $wpdb->get_results($wpdb->prepare($sql, $download), ARRAY_N);
588
  $rownum = intval($options['from']);
589
  foreach ($results as $row) {
590
  $rownum++;
591
+ list($id, $date, $ip, $referer, $userid, $username) = $row;
592
  ?>
593
  <tr>
594
  <td><?php echo $rownum; ?>.</td>
596
  <td><?php echo htmlspecialchars($ip); ?></td>
597
  <td><?php echo htmlspecialchars($referer); ?></td>
598
  <td><?php echo htmlspecialchars($username); ?></td>
599
+ <td><?php if ($this->IsAdmin()): ?><input type="checkbox" name="SimpleDownloadMonitor_DeleteIds[]" value="<?php echo $id; ?>" /><label for="SimpleDownloadMonitor_DeleteIds[]"> <?php echo __('Delete', self::GETTEXT_REALM); ?></label><?php else: ?>&nbsp;<?php endif; ?></td>
600
  </tr>
601
  </tbody><?php
602
  }
603
  }
604
  ?>
605
  </table>
606
+ <?php if ($this->isAdmin()): ?>
607
+ <div><input type="submit" name="SimpleDownloadMonitor_DeleteDetail" value="<?php echo __('Delete Checked', self::GETTEXT_REALM); ?>" /></div>
608
+ </form>
609
+ <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
610
+ <div><input type="submit" name="SimpleDownloadMonitor_Delete" value="<?php echo __('Delete All', self::GETTEXT_REALM); ?>" /> - <input type="checkbox" name="SimpleDownloadMonitor_DeleteIds[]" value="<?php echo $download; ?>" /> <?php echo __('Yes, I am sure', self::GETTEXT_REALM); ?></label></div>
611
+ </form>
612
+ <?php endif; ?>
613
  <?php echo $this->Paginator($options, $totalcount); ?>
614
+ <p><a href="<?php echo $this->GetUrlForList(); ?>"><?php echo __('Return to full list.', self::GETTEXT_REALM); ?></a></p>
615
  </div><?php
616
  }
617
 
633
  global $sdmon;
634
  if (isset($sdmon))
635
  {
636
+ $options_page = add_options_page(__('Simple Download Monitor options', SimpleDownloadMonitor::GETTEXT_REALM), __('Simple Download Monitor', SimpleDownloadMonitor::GETTEXT_REALM), 'manage_options', basename(__FILE__), array(&$sdmon, 'AdminPanel'));
637
+ $tool_page = add_submenu_page('tools.php', __('Simple Download Monitor', SimpleDownloadMonitor::GETTEXT_REALM), __('Simple Download Monitor', SimpleDownloadMonitor::GETTEXT_REALM), 'read', basename(__FILE__), array(&$sdmon, 'ToolsPanel'));
638
  add_action('admin_head-'.$tool_page, array(&$sdmon, 'ActionHead'));
639
  }
640
  }