/[smecontribs]/rpms/smeserver-awstats/contribs10/smeserver-awstats-1.4-bz12324_sm2_initial.patch
ViewVC logotype

Contents of /rpms/smeserver-awstats/contribs10/smeserver-awstats-1.4-bz12324_sm2_initial.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Tue Mar 21 13:07:03 2023 UTC (13 months, 4 weeks ago) by michel
Branch: MAIN
CVS Tags: smeserver-awstats-1_4-8_el7_sme, smeserver-awstats-1_4-10_el7_sme, smeserver-awstats-1_4-9_el7_sme, HEAD
* Mon Mar 20 2023 Michel Begue <mab974@misouk.com> 1.4-8.sme
- Initial release for server-manager (sm2) [SME: 12324]

1 diff -urN smeserver-awstats-1.4.old/createlinks smeserver-awstats-1.4/createlinks
2 --- smeserver-awstats-1.4.old/createlinks 2023-02-12 22:30:35.000000000 +0400
3 +++ smeserver-awstats-1.4/createlinks 2023-03-21 12:37:58.758000000 +0400
4 @@ -27,6 +27,12 @@
5 event_link("navigation-conf", $event, "50");
6 templates2events("/etc/crontab", $event );
7 event_link("awstats-upgrade", $event, "02");
8 +# for smeserver-manager (in smeserver-awstats-update)
9 +safe_symlink('restart', "root/etc/e-smith/events/$event/services2adjust/smanager");
10 +event_link('navigation2-conf', "$event", '80');
11 +event_link('routes2-conf', "$event", '80');
12 +event_link('locales2-conf', "$event", '80');
13 +safe_symlink("/usr/share/awstats/wwwroot/icon" , 'root/usr/share/smanager/themes/default/public/images/awstats/icon');
14
15 use esmith::Build::Backup qw(:all);
16 backup_includes("smeserver-awstats", qw(
17 diff -urN smeserver-awstats-1.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Awstats.pm smeserver-awstats-1.4/root/usr/share/smanager/lib/SrvMngr/Controller/Awstats.pm
18 --- smeserver-awstats-1.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Awstats.pm 1970-01-01 04:00:00.000000000 +0400
19 +++ smeserver-awstats-1.4/root/usr/share/smanager/lib/SrvMngr/Controller/Awstats.pm 2023-03-21 11:16:34.566000000 +0400
20 @@ -0,0 +1,350 @@
21 +package SrvMngr::Controller::Awstats;
22 +
23 +#----------------------------------------------------------------------
24 +# heading : Administration
25 +# description : Web statistics
26 +# navigation : 4000 4350
27 +#
28 +# menu : A
29 +#
30 +# name : awstats, method : get, url : /awstats, ctlact : awstats#main
31 +# name : awstats2, method : get, url : /awstats2, ctlact : awstats#do_display
32 +# name : awstatsc, method : post, url : /awstats, ctlact : awstats#do_display
33 +# name : awstatsu, method : post, url : /awstats2, ctlact : awstats#do_update
34 +# name : awstats3, method : get, url : /awstats3, ctlact : awstats#do_update
35 +#
36 +# routes : end
37 +#----------------------------------------------------------------------
38 +use strict;
39 +use warnings;
40 +
41 +use Mojo::Base 'Mojolicious::Controller';
42 +
43 +use Locale::gettext;
44 +use SrvMngr::I18N;
45 +use SrvMngr qw(theme_list init_session);
46 +
47 +use POSIX qw(strftime);
48 +
49 +use esmith::DomainsDB;
50 +use esmith::ConfigDB;
51 +
52 +our $ddb = esmith::DomainsDB->open || die "Couldn't open domains db";
53 +our $cdb = esmith::ConfigDB->open || die "Couldn't open configuration db";
54 +our $awsdirdata="/home/e-smith/files/users/admin/home/awstats";
55 +
56 +our $REGEXP_DOMAIN = qq([a-zA-Z0-9\-\.]+);
57 +
58 +sub main {
59 +
60 + my $c = shift;
61 + $c->app->log->info($c->log_req);
62 +
63 + my %aws_datas = ();
64 + my $title = $c->l('aws_FORM_TITLE');
65 +
66 + $aws_datas{trt} = 'LST';
67 +
68 + my $rec = $cdb->get('AWStats');
69 + $aws_datas{status} = $rec->prop('status')|| 'disabled';
70 + $aws_datas{mailstatus} = ( $rec->prop('mailstatus') || 'disabled' );
71 + $aws_datas{ftpstatus} = ( $rec->prop('ftpstatus') || 'disabled' );
72 + $aws_datas{username} = $c->session->{username} || 'unknown';
73 +
74 + my @domains;
75 +
76 +# if ( $aws_datas->{status} ne 'enabled' ) {
77 + for ($ddb->domains()) {
78 + my $domain = $_->key;
79 +
80 + next unless ( -d "$awsdirdata/$domain" );
81 +
82 + my $ns = $_->prop('Nameservers') || 'internet';
83 +
84 + $domain = $1 if ($domain =~ /^($REGEXP_DOMAIN)$/);
85 + my $awstats = 'Empty';
86 + if (system("/bin/ls $awsdirdata/$domain/ | /bin/grep '.txt' > /dev/null 2>&1") == 0 ) {
87 + $awstats = 'Show';
88 + }
89 + my $status = 'active';
90 + #if ( ????system == 0 ) { // T O D O inactive domains//
91 + # $status = 'inactive';
92 + #}
93 +
94 + push @domains,
95 + { Domain => $_->key, $_->props,
96 + Nameservers => $ns,
97 + AWStats => $awstats,
98 + Status => $status
99 + }
100 + }
101 +
102 + if (open (ST, "/var/log/httpd/awstats_lr")) {
103 + $aws_datas{logres} = <ST>;
104 + close (ST);
105 + }
106 +# }
107 +
108 + $c->stash( title => $title, aws_datas => \%aws_datas, domains => \@domains );
109 + $c->render(template => 'awstats');
110 +}
111 +
112 +
113 +sub do_display {
114 +
115 + my $c = shift;
116 + $c->app->log->info($c->log_req);
117 +
118 + my %aws_datas = ();
119 + my $title = $c->l('aws_FORM_TITLE');
120 + my $result;
121 +
122 + my $trt = $c->param('trt') || 'LST';
123 + my $domain = $c->param('Domain');
124 +
125 + if ( $trt eq 'SHW' ) {
126 + $aws_datas{periodrep} = 'month';
127 + $aws_datas{monthrep} = strftime( "%m", localtime );
128 + $aws_datas{yearrep} = strftime( "%Y", localtime );
129 + $aws_datas{domain} = $domain;
130 + $result = _get_awst( $c, \%aws_datas );
131 + }
132 +
133 + if ( $trt eq 'CNF' ) {
134 + my $rec = $cdb->get('AWStats');
135 + if ($rec) {
136 + $aws_datas{status} = $rec->prop('status')|| 'disabled';
137 + $aws_datas{mailstatus} = ( $rec->prop('mailstatus') || 'disabled' );
138 + $aws_datas{ftpstatus} = ( $rec->prop('ftpstatus') || 'disabled' );
139 + $aws_datas{freq} = $rec->prop('Freq')|| '5m';
140 + $aws_datas{barSize} = $rec->prop('BarSize')|| 'medium';
141 + $aws_datas{language} = $rec->prop('Language')|| 'auto';
142 + $aws_datas{maxNbOfDomain} = $rec->prop('MaxNbOfDomain')|| '50';
143 + $aws_datas{maxNbOfHosts} = $rec->prop('MaxNbOfHostsShown')|| '100';
144 + $aws_datas{maxNbOfKeywords} = $rec->prop('MaxNbOfKeywordsShown')|| '50';
145 + $aws_datas{maxNbOfPage} = $rec->prop('MaxNbOfPageShown')|| '200';
146 + $aws_datas{maxNbOfReferer} = $rec->prop('MaxNbOfRefererShown')|| '50';
147 + $aws_datas{maxNbOfRobot} = $rec->prop('MaxNbOfRobotShown')|| '25';
148 + $aws_datas{minHitPage} = $rec->prop('MinHitFile')|| '1';
149 + $aws_datas{minHitHost} = $rec->prop('MinHitHost')|| '1';
150 + $aws_datas{minHitKeyword} = $rec->prop('MinHitKeyword')|| '1';
151 + $aws_datas{minHitRefer} = $rec->prop('MinHitRefer')|| '1';
152 + $aws_datas{minHitRobot} = $rec->prop('MinHitRobot')|| '1';
153 + $aws_datas{rawlog} = $rec->prop('Rawlog')|| 'no';
154 + $aws_datas{skipExternalIP} = $rec->prop('SkipExternalIP')|| 'yes';
155 + $aws_datas{skipLocalIP} = $rec->prop('SkipLocalIP')|| 'yes';
156 + $aws_datas{skipLocalNetworks} = $rec->prop('SkipLocalNetworks')|| 'no';
157 + $aws_datas{userFramesWhenCGI} = $rec->prop('UserFramesWhenCGI')|| 'no';
158 + $aws_datas{username} = $c->session->{username} || 'unknown';
159 + }
160 + }
161 +
162 + $aws_datas{trt} = $trt;
163 + $aws_datas{domain} = $domain;
164 + $c->stash( title => $title .' '. $domain, aws_datas => \%aws_datas, modul => $result );
165 + $c->render(template => 'awstats');
166 +
167 +}
168 +
169 +
170 +sub do_update {
171 +
172 + my $c = shift;
173 + $c->app->log->info($c->log_req);
174 +
175 + my $rt = $c->current_route;
176 + my $trt = $c->param('trt') || 'SHWP';
177 + my $title = $c->l('aws_FORM_TITLE');
178 +
179 + my %aws_datas = ();
180 + $aws_datas{trt} = $trt;
181 + my ($res, $result) = '';
182 +
183 + if ( $trt eq 'UPD' ) {
184 +
185 + my $status = $c->param('Status');
186 + my $mailstatus = $c->param('Mailstatus');
187 + my $ftpstatus = $c->param('Ftpstatus');
188 + my $freq = $c->param('Freq');
189 + my $skipLocalIP = $c->param('SkipLocalIP');
190 + my $skipExternalIP = $c->param('SkipExternalIP');
191 + my $skipLocalNetworks = $c->param('SkipLocalNetworks');
192 + my $userFramesWhenCGI = $c->param('UserFramesWhenCGI');
193 + my $language = $c->param('Language');
194 + my $rawlog = $c->param('Rawlog');
195 + my $barSize = $c->param('BarSize');
196 +
197 + my $maxNbOfDomain = $c->param('MaxNbOfDomain');
198 + my $maxNbOfHosts = $c->param('MaxNbOfHosts');
199 + my $minHitHost = $c->param('MinHitHost');
200 + my $maxNbOfPages = $c->param('MaxNbOfPages');
201 + my $minHitPage = $c->param('MinHitPage');
202 + my $maxNbOfRobot = $c->param('MaxNbOfRobot');
203 + my $minHitRobot = $c->param('MinHitRobot');
204 + my $maxNbOfReferer = $c->param('MaxNbOfReferer');
205 + my $minHitRefer = $c->param('MinHitRefer');
206 + my $maxNbOfKeywords = $c->param('MaxNbOfKeywords');
207 + my $minHitKeyword = $c->param('MinHitKeyword');
208 +
209 + #$result = 'blocked';
210 +
211 + if ($maxNbOfDomain =~ /^([0-9]+)$/) {
212 + $maxNbOfDomain = $1;
213 + } else {
214 + $result .= $c->l('FIELD_INVALID_CHARS') .' : '. $maxNbOfDomain .'<br>';
215 + }
216 + if ($maxNbOfHosts =~ /^([0-9]+)$/) {
217 + $maxNbOfHosts = $1;
218 + } else {
219 + $result .= $c->l('FIELD_INVALID_CHARS') .' : '. $maxNbOfHosts .'<br>';
220 + }
221 +
222 + if ($minHitHost =~ /^([0-9]+)$/) {
223 + $minHitHost = $1;
224 + } else {
225 + $result .= $c->l('FIELD_INVALID_CHARS') .' : '. $minHitHost .'<br>';
226 + }
227 + $maxNbOfDomain = 1 if $maxNbOfDomain < 1;
228 + $maxNbOfHosts = 1 if $maxNbOfHosts < 1;
229 + $minHitHost = 1 if $minHitHost < 1;
230 + $maxNbOfPages = 1 if $maxNbOfPages < 1;
231 + $minHitPage = 1 if $minHitPage < 1;
232 + $maxNbOfRobot = 1 if $maxNbOfRobot < 1;
233 + $minHitRobot = 1 if $minHitRobot < 1;
234 + $maxNbOfReferer = 1 if $maxNbOfReferer < 1;
235 + $minHitRefer = 1 if $minHitRefer < 1;
236 + $maxNbOfKeywords = 1 if $maxNbOfKeywords < 1;
237 + $minHitKeyword = 1 if $minHitKeyword < 1;
238 +
239 + # controls
240 +
241 + $res ='';
242 + if ( ! $result ) {
243 + my $rec = $cdb->get('AWStats');
244 + if ($rec) {
245 + $rec->set_prop('status', $status); ;
246 + $rec->set_prop('mailstatus', $mailstatus); ;
247 + $rec->set_prop('ftpstatus', $ftpstatus); ;
248 + $rec->set_prop('Freq', $freq);
249 + $rec->set_prop('BarSize',$barSize );
250 + $rec->set_prop('Language', $language);
251 + $rec->set_prop('MaxNbOfDomain', $maxNbOfDomain);
252 + $rec->set_prop('MaxNbOfHostsShown', $maxNbOfHosts);
253 + $rec->set_prop('MaxNbOfKeywordsShown', $maxNbOfKeywords);
254 + $rec->set_prop('MaxNbOfPageShown', $maxNbOfPages);
255 + $rec->set_prop('MaxNbOfRefererShown', $maxNbOfReferer);
256 + $rec->set_prop('MaxNbOfRobotShown', $maxNbOfRobot);
257 + $rec->set_prop('MinHitFile', $minHitPage);
258 + $rec->set_prop('MinHitHost', $minHitHost);
259 + $rec->set_prop('MinHitKeyword', $minHitKeyword);
260 + $rec->set_prop('MinHitRefer', $minHitRefer);
261 + $rec->set_prop('MinHitRobot', $minHitRobot);
262 + $rec->set_prop('Rawlog', $rawlog);
263 + $rec->set_prop('SkipExternalIP', $skipExternalIP);
264 + $rec->set_prop('SkipLocalIP', $skipLocalIP);
265 + $rec->set_prop('SkipLocalNetworks', $skipLocalNetworks);
266 + $rec->set_prop('UserFramesWhenCGI', $userFramesWhenCGI);
267 + }
268 +
269 + if ( system( '/sbin/e-smith/signal-event awstats-update &' ) != 0 ) {
270 + $result = ($c->l('aws_ERROR_CONFIG_UPDATE') . " $trt");
271 + } else {
272 + # sleep (2);
273 + $res = 'OK';
274 + $result = $c->l('aws_CONFIG_SUCCESSFULLY_MODIFIED');
275 + }
276 + }
277 + }
278 +
279 + if ( $trt eq 'SHWP' ) {
280 + $aws_datas{periodrep} = $c->param('databasebreak');
281 + $aws_datas{monthrep} = $c->param('month');
282 + $aws_datas{yearrep} = $c->param('year');
283 + $aws_datas{domain} = $c->param('config') || 'None';
284 +
285 + $result = _get_awst( $c, \%aws_datas );
286 +
287 + $c->stash( title => $title .' '. $aws_datas{domain}, aws_datas => \%aws_datas, modul => $result );
288 + return $c->render( 'awstats' );
289 + }
290 +
291 + # common parts
292 +
293 + if ($res ne 'OK') {
294 + $c->stash( error => $result );
295 + $c->stash( title => $title, aws_datas => \%aws_datas );
296 + return $c->render( 'awstats' );
297 + }
298 +
299 +# $cdb = esmith::ConfigDB->open();
300 +
301 + my $message = "'AWStats configuration' update ($trt) DONE";
302 + $c->app->log->info($message);
303 + $c->flash( success => $result );
304 + $c->redirect_to('/awstats');
305 +}
306 +
307 +
308 +sub _get_awst {
309 +
310 + my ($c, $aws_datas) = @_;
311 +
312 + my $periodrep = $aws_datas->{periodrep};
313 + my $yearrep = $aws_datas->{yearrep};
314 + my $monthrep = $aws_datas->{monthrep};
315 + my $domain = $aws_datas->{domain};
316 +
317 + my $res;
318 +
319 + $domain = $1 if ($domain =~ /^($REGEXP_DOMAIN)$/);
320 + $periodrep = $1 if ($periodrep =~ /^([A-Za-z]+)$/);
321 + $monthrep = $1 if ($monthrep =~ /^([A-Za-z\-]+)$/);
322 + $yearrep = $1 if ($yearrep =~ /^([0-9]+)$/);
323 +
324 + # cli awstats.pl call
325 + $res = `/etc/e-smith/web/panels/manager/cgi-bin/.awstats/awstats.pl -databasebreak=$periodrep -month=$monthrep -year=$yearrep -config="${domain}" -lang=auto -output`;
326 +
327 + # change awstats link for this controller
328 + $res =~ s|action="/cgi-bin/awstats.pl?|action="/smanager/awstats3?trt=SHWP&|;
329 + # change DirIcons for sm2 public one
330 + $res =~ s|\.\./\.\./awstats|\./images/awstats/icon|g;
331 +
332 + return $res;
333 +}
334 +
335 +
336 +sub freq_options_list {
337 +
338 + my $c = shift;
339 + return [[ '5 ' . $c->l('MINUTES') => '5m'],
340 + [ '10 ' . $c->l('MINUTES') => '10m'],
341 + [ '15 ' . $c->l('MINUTES') => '15m'],
342 + [ '30 ' . $c->l('MINUTES') => '30m'],
343 + [ '1 ' . $c->l('HOUR') => '1h'],
344 + [ '2 ' . $c->l('HOURS') => '2h'],
345 + [ '4 ' . $c->l('HOURS') => '4h'],
346 + [ '8 ' . $c->l('HOURS') => '8h'],
347 + [ '12 ' . $c->l('HOURS') => '12h']];
348 +}
349 +
350 +
351 +sub language_options_list {
352 +
353 + my $c = shift;
354 + return [[ 'Auto Detect' => 'auto' ],
355 + ['English' => 'en' ],
356 + ['French', => 'fr' ],
357 + ['Dutch' => 'nl' ],
358 + ['Spanish' => 'es' ],
359 + ['Italian' => 'it' ],
360 + ['German', => 'de' ],
361 + ['Polish', => 'pl' ],
362 + ['Greek' => 'gr' ],
363 + ['Czech' => 'cz' ],
364 + ['Portuguese' => 'pt' ]];
365 +}
366 +
367 +
368 +1
369 +
370 +__END__
371 diff -urN smeserver-awstats-1.4.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Awstats/awstats_en.lex smeserver-awstats-1.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Awstats/awstats_en.lex
372 --- smeserver-awstats-1.4.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Awstats/awstats_en.lex 1970-01-01 04:00:00.000000000 +0400
373 +++ smeserver-awstats-1.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Awstats/awstats_en.lex 2023-02-11 21:08:23.000000000 +0400
374 @@ -0,0 +1,37 @@
375 +'aws_FORM_TITLE' => 'Show or Configure Awstats Statistics',
376 +'aws_BUTTON_CONFIGURE' => 'Configure AWStats',
377 +'aws_STATS_NOTE' => 'Note: A Domain is not shown in the list below until after midnight on the day statistics are available. To force the display sooner, browse to the website to create some stats, then resave awstats settings.',
378 +'aws_DOMAINS_TITLE' => 'List of Domains viewable by admin',
379 +'aws_DISABLED' => 'AWStats is disabled.',
380 +'aws_UPDATED' => 'Updated on [_1] in [_2] secs. [_3] new logs processed.',
381 +'aws_COPYRIGHT' => 'Copyright neddix.de, Stuttgart',
382 +'aws_CONTENT' => 'Content',
383 +'aws_CONFIG_TITLE' => 'Configure AWStats Sme version',
384 +'aws_LABEL_STATUS' => 'State',
385 +'aws_REPORTED' => 'Reported period',
386 +'aws_STATUS' => 'status',
387 +'aws_MAILSTATUS' => 'Awstats Mail status',
388 +'aws_FTPSTATUS' => 'Awstats Ftp status',
389 +'aws_FREQUENCY' => 'Launch frequency',
390 +'aws_NO_LOCAL_IP' => 'Ignore hits from your local network',
391 +'aws_NO_EXTERNAL_IP' => 'Ignore hits from your external IP or network',
392 +'aws_YES_EXT_IP' => 'Yes, external IP',
393 +'aws_YES_EXT_IP_MSK' => 'Yes, external IP/Netmask',
394 +'aws_NO_LOCAL' => 'Ignore hits from local networks as defined in the \'Local networks\' panel',
395 +'aws_FRAME' => 'Show report in HTML frames',
396 +'aws_LANGUAGE' => 'Default language',
397 +'aws_RAWLOG' => 'Enable plugin \'Rawlog\'',
398 +'aws_MAX_DOMAINS' => 'Max. number of domains shown',
399 +'aws_MAX_HOSTS' => 'Max. number of hosts shown',
400 +'aws_MIN_HIT_HOSTS' => 'Only show hosts with at least these hits:',
401 +'aws_MAX_PAGES' => 'Max. number of pages shown',
402 +'aws_MIN_HIT_PAGES' => 'Only show pages with at least these hits:',
403 +'aws_MAX_ROBOTS' => 'Max. number of robots shown',
404 +'aws_MIN_HIT_ROBOT' => 'Only show robots with at least these hits:',
405 +'aws_MAX_REFERER' => 'Max. number of referrers shown',
406 +'aws_MIN_HIT_REFERER' => 'Only show referrers with at least these hits:',
407 +'aws_MAX_KEYWORDS' => 'Max. number of keywords shown',
408 +'aws_MIN_HIT_KEYWORDS' => 'Only show keywords with at least these hits:',
409 +'aws_BAR_SIZE' => 'Graphics bar size',
410 +'aws_CONFIG_SUCCESSFULLY_MODIFIED' => 'Configuration has been updated successfully.<br>Please note, that changed ignore-rules will only effect processing of future logs.',
411 +'aws_ERROR_CONFIG_UPDATE' => 'Error: internal failure while updating awstats configuration.',
412 diff -urN smeserver-awstats-1.4.old/root/usr/share/smanager/themes/default/public/images/awstats/README smeserver-awstats-1.4/root/usr/share/smanager/themes/default/public/images/awstats/README
413 --- smeserver-awstats-1.4.old/root/usr/share/smanager/themes/default/public/images/awstats/README 1970-01-01 04:00:00.000000000 +0400
414 +++ smeserver-awstats-1.4/root/usr/share/smanager/themes/default/public/images/awstats/README 2023-03-21 11:59:58.788000000 +0400
415 @@ -0,0 +1 @@
416 +# link to original awstats icon directory for sm2
417 diff -urN smeserver-awstats-1.4.old/root/usr/share/smanager/themes/default/templates/awstats.html.ep smeserver-awstats-1.4/root/usr/share/smanager/themes/default/templates/awstats.html.ep
418 --- smeserver-awstats-1.4.old/root/usr/share/smanager/themes/default/templates/awstats.html.ep 1970-01-01 04:00:00.000000000 +0400
419 +++ smeserver-awstats-1.4/root/usr/share/smanager/themes/default/templates/awstats.html.ep 2023-02-24 00:01:33.000000000 +0400
420 @@ -0,0 +1,34 @@
421 +% layout 'default', title => "Sme server 2 - AWStats";
422 +
423 +% content_for 'module' => begin
424 + <div id='module' class='module awstats-panel'>
425 + % if ($config->{debug} == 1) {
426 + <p>
427 + %= dumper $c->current_route
428 + %= dumper $aws_datas
429 + </p>
430 + % }
431 + % if ( stash 'warning' ) {
432 + <br><div class=sme-warning>
433 + %= $c->render_to_string(inline => stash 'warning')
434 + </div>
435 + %}
436 + % if ( stash 'error' ) {
437 + <br><div class=sme-error>
438 + %= $c->render_to_string(inline => stash 'error')
439 + </div>
440 + %}
441 +
442 + <h1><%= $title%></h1>
443 +
444 + % if ($aws_datas->{trt} eq 'CNF') {
445 + %= include 'partials/_aws_cnf'
446 + %} elsif ($aws_datas->{trt} eq 'SHW' or $aws_datas->{trt} eq 'SHWP') {
447 + %= include 'partials/_aws_shw'
448 + %} elsif ($aws_datas->{trt} eq 'UPD') {
449 + %= include 'partials/_aws_cnf'
450 + %} else {
451 + %= include 'partials/_aws_list'
452 + %}
453 + </div>
454 +% end
455 diff -urN smeserver-awstats-1.4.old/root/usr/share/smanager/themes/default/templates/partials/1-awstats_en.lex smeserver-awstats-1.4/root/usr/share/smanager/themes/default/templates/partials/1-awstats_en.lex
456 --- smeserver-awstats-1.4.old/root/usr/share/smanager/themes/default/templates/partials/1-awstats_en.lex 1970-01-01 04:00:00.000000000 +0400
457 +++ smeserver-awstats-1.4/root/usr/share/smanager/themes/default/templates/partials/1-awstats_en.lex 2023-02-28 21:52:16.000000000 +0400
458 @@ -0,0 +1,37 @@
459 +'aws_FORM_TITLE' => 'Show or Configure Awstats Statistics',
460 +'aws_BUTTON_CONFIGURE' => 'Configure AWStats',
461 +'aws_STATS_NOTE' => 'Note: A Domain is not shown in the list below until after midnight on the day statistics are available. To force the display sooner, browse to the website to create some stats, then resave awstats settings.',
462 +'aws_DOMAINS_TITLE' => 'List of Domains viewable by admin',
463 +'aws_DISABLED' => 'AWStats is disabled.',
464 +'aws_UPDATED' => 'Updated on [_1] in [_2] secs. [_3] new logs processed.',
465 +'aws_COPYRIGHT' => 'Copyright neddix.de, Stuttgart',
466 +'aws_CONTENT' => 'Content',
467 +'aws_CONFIG_TITLE' => 'Configure AWStats Sme version',
468 +'aws_LABEL_STATUS' => 'State',
469 +'aws_REPORTED' => 'Reported period',
470 +'aws_STATUS' => 'status',
471 +'aws_MAILSTATUS' => 'Awstats Mail status',
472 +'aws_FTPSTATUS' => 'Awstats Ftp status',
473 +'aws_FREQUENCY' => 'Launch frequency',
474 +'aws_NO_LOCAL_IP' => 'Ignore hits from your local network',
475 +'aws_NO_EXTERNAL_IP' => 'Ignore hits from your external IP or network',
476 +'aws_YES_EXT_IP' => 'Yes, external IP',
477 +'aws_YES_EXT_IP_MSK' => 'Yes, external IP/Netmask',
478 +'aws_NO_LOCAL' => 'Ignore hits from local networks as defined in the \'Local networks\' panel',
479 +'aws_FRAME' => 'Show report in HTML frames',
480 +'aws_LANGUAGE' => 'Default language',
481 +'aws_RAWLOG' => 'Enable plugin \'Rawlog\'',
482 +'aws_MAX_DOMAINS' => 'Max. number of domains shown',
483 +'aws_MAX_HOSTS' => 'Max. number of hosts shown',
484 +'aws_MIN_HIT_HOSTS' => 'Only show hosts with at least these hits:',
485 +'aws_MAX_PAGES' => 'Max. number of pages shown',
486 +'aws_MIN_HIT_PAGES' => 'Only show pages with at least these hits:',
487 +'aws_MAX_ROBOTS' => 'Max. number of robots shown',
488 +'aws_MIN_HIT_ROBOT' => 'Only show robots with at least these hits:',
489 +'aws_MAX_REFERER' => 'Max. number of referrers shown',
490 +'aws_MIN_HIT_REFERER' => 'Only show referrers with at least these hits:',
491 +'aws_MAX_KEYWORDS' => 'Max. number of keywords shown',
492 +'aws_MIN_HIT_KEYWORDS' => 'Only show keywords with at least these hits:',
493 +'aws_BAR_SIZE' => 'Graphics bar size',
494 +'aws_CONFIG_SUCCESSFULLY_MODIFIED' => 'Configuration has been updated successfully.<br>Please note, that changed ignore-rules will only effect processing of future logs.',
495 +'aws_ERROR_CONFIG_UPDATE' => 'Error: internal failure while updating awstats configuration.',
496 diff -urN smeserver-awstats-1.4.old/root/usr/share/smanager/themes/default/templates/partials/_aws_cnf.html.ep smeserver-awstats-1.4/root/usr/share/smanager/themes/default/templates/partials/_aws_cnf.html.ep
497 --- smeserver-awstats-1.4.old/root/usr/share/smanager/themes/default/templates/partials/_aws_cnf.html.ep 1970-01-01 04:00:00.000000000 +0400
498 +++ smeserver-awstats-1.4/root/usr/share/smanager/themes/default/templates/partials/_aws_cnf.html.ep 2023-02-15 12:36:15.000000000 +0400
499 @@ -0,0 +1,139 @@
500 +<div id='aws_conf'>
501 + %= form_for '/awstats2' => (method => 'POST') => begin
502 + <h2><%=l 'aws_CONFIG_TITLE'%></h2>
503 + <p><span class=label>
504 + %=l 'aws_STATUS', class => 'label'
505 + </span><span class=data>
506 + % param 'Status' => $aws_datas->{status} unless param 'Status';
507 + %= select_field 'Status' => [[(l 'ENABLED') => 'enabled'], [ (l 'DISABLED') => 'disabled']], class => 'input'
508 + </span><span class=label2>
509 + %=l 'aws_MAILSTATUS'
510 + </span><span class=data>
511 + % param 'Mailstatus' => $aws_datas->{mailstatus} unless param 'Mailstatus';
512 + %= select_field 'Mailstatus' => [[(l 'ENABLED') => 'enabled'], [ (l 'DISABLED') => 'disabled']], class => 'input'
513 + </span><span class=label2>
514 + %=l 'aws_FTPSTATUS'
515 + </span><span class=data>
516 + % param 'Ftpstatus' => $aws_datas->{ftpstatus} unless param 'Ftpstatus';
517 + %= select_field 'Ftpstatus' => [[(l 'ENABLED') => 'enabled'], [ (l 'DISABLED') => 'disabled']], class => 'input'
518 + </span></p>
519 + <p><span class=label>
520 + %=l 'aws_FREQUENCY'
521 + </span><span class=data>
522 + % param 'Freq' => $aws_datas->{freq} unless param 'Freq';
523 + %= select_field 'Freq', $c->freq_options_list(), class => 'input'
524 + </span></p>
525 + <p><span class=label>
526 + %=l 'aws_NO_LOCAL_IP', class => 'label'
527 + </span><span class=data>
528 + % param 'SkipLocalIP' => $aws_datas->{skipLocalIP} unless param 'SkipLocalIP';
529 + %= select_field 'SkipLocalIP' => [[ (l 'YES') => 'yes'], [ (l 'NO') => 'no']], class => 'input'
530 + </span></p>
531 + <p><span class=label>
532 + %=l 'aws_NO_EXTERNAL_IP', class => 'label'
533 + </span><span class=data>
534 + % param 'SkipExternalIP' => $aws_datas->{skipExternalIP} unless param 'SkipExternalIP';
535 + %= select_field 'SkipExternalIP' => [[(l 'NO') => 'no'], [(l 'aws_YES_EXT_IP') => 'yes'], [(l 'aws_YES_EXT_IP_MSK') => 'mask']], class => 'input'
536 + </span></p>
537 + <p><span class=label>
538 + %=l 'aws_NO_LOCAL', class => 'label'
539 + </span><span class=data>
540 + % param 'SkipLocalNetworks' => $aws_datas->{skipLocalNetworks} unless param 'SkipLocalNetworks';
541 + %= select_field 'SkipLocalNetworks' => [[ (l 'YES') => 'yes'], [ (l 'NO') => 'no']], class => 'input'
542 + </span></p>
543 + <p><span class=label>
544 + %=l 'aws_FRAME', class => 'label'
545 + </span><span class=data>
546 + % param 'UserFramesWhenCGI' => $aws_datas->{userFramesWhenCGI} unless param 'UserFramesWhenCGI';
547 + %= select_field 'UserFramesWhenCGI' => [[ (l 'YES') => 'yes'], [ (l 'NO') => 'no']], class => 'input'
548 + </span></p>
549 + <p><span class=label>
550 + %=l 'aws_LANGUAGE'
551 + </span><span class=data>
552 + % param 'Language' => $aws_datas->{language} unless param 'Language';
553 + %= select_field 'Language', $c->language_options_list(), class => 'input'
554 + </span></p>
555 + <p><span class=label>
556 + %=l 'aws_RAWLOG', class => 'label'
557 + </span><span class=data>
558 + % param 'Rawlog' => $aws_datas->{rawlog} unless param 'Rawlog';
559 + %= select_field 'Rawlog' => [[ (l 'YES') => 'yes'], [ (l 'NO') => 'no']], class => 'input'
560 + </span></p>
561 + <p><span class=label>
562 + %=l 'aws_MAX_DOMAINS', class => 'label'
563 + </span><span class=data>
564 + % param 'MaxNbOfDomain' => $aws_datas->{maxNbOfDomain} unless param 'MaxNbOfDomain';
565 + %= text_field 'MaxNbOfDomain' => size => '5', class => 'input'
566 + </span></p>
567 + <p><span class=label>
568 + %=l 'aws_MAX_HOSTS', class => 'label'
569 + </span><span class=data>
570 + % param 'MaxNbOfHosts' => $aws_datas->{maxNbOfHosts} unless param 'MaxNbOfHosts';
571 + %= text_field 'MaxNbOfHosts' => size => '5', class => 'input'
572 + </span>
573 + <span class=label>
574 + %=l 'aws_MIN_HIT_HOSTS', class => 'label'
575 + </span><span class=data>
576 + % param 'MinHitHost' => $aws_datas->{minHitHost} unless param 'MinHitHost';
577 + %= text_field 'MinHitHost' => size => '5', class => 'input'
578 + </span></p>
579 + <p><span class=label>
580 + %=l 'aws_MAX_PAGES', class => 'label'
581 + </span><span class=data>
582 + % param 'MaxNbOfPages' => $aws_datas->{maxNbOfPage} unless param 'MaxNbOfPages';
583 + %= text_field 'MaxNbOfPages' => size => '5', class => 'input'
584 + </span>
585 + <span class=label>
586 + %=l 'aws_MIN_HIT_PAGES', class => 'label'
587 + </span><span class=data>
588 + % param 'MinHitPAge' => $aws_datas->{minHitPage} unless param 'MinHitPAge';
589 + %= text_field 'MinHitPAge' => size => '5', class => 'input'
590 + </span></p>
591 + <p><span class=label>
592 + %=l 'aws_MAX_ROBOTS', class => 'label'
593 + </span><span class=data>
594 + % param 'MaxNbOfRobot' => $aws_datas->{maxNbOfRobot} unless param 'MaxNbOfRobot';
595 + %= text_field 'MaxNbOfRobot' => size => '5', class => 'input'
596 + </span>
597 + <span class=label>
598 + %=l 'aws_MIN_HIT_ROBOT', class => 'label'
599 + </span><span class=data>
600 + % param 'MinHitRobot' => $aws_datas->{minHitRobot} unless param 'MinHitRobot';
601 + %= text_field 'MinHitRobot' => size => '5', class => 'input'
602 + </span></p>
603 + <p><span class=label>
604 + %=l 'aws_MAX_REFERER', class => 'label'
605 + </span><span class=data>
606 + % param 'MaxNbOfReferer' => $aws_datas->{maxNbOfReferer} unless param 'MaxNbOfReferer';
607 + %= text_field 'MaxNbOfReferer' => size => '5', class => 'input'
608 + </span>
609 + <span class=label>
610 + %=l 'aws_MIN_HIT_REFERER' => size => '5', class => 'label'
611 + </span><span class=data>
612 + % param 'MinHitRefer' => $aws_datas->{minHitRefer} unless param 'MinHitRefer';
613 + %= text_field 'MinHitRefer' => size => '5', class => 'input'
614 + </span></p>
615 + <p><span class=label>
616 + %=l 'aws_MAX_KEYWORDS', class => 'label'
617 + </span><span class=data>
618 + % param 'MaxNbOfKeywords' => $aws_datas->{maxNbOfKeywords} unless param 'MaxNbOfKeywords';
619 + %= text_field 'MaxNbOfKeywords' => size => '5', class => 'input'
620 + </span>
621 + <span class=label>
622 + %=l 'aws_MIN_HIT_KEYWORDS', class => 'label'
623 + </span><span class=data>
624 + % param 'MinHitKeyword' => $aws_datas->{minHitKeyword} unless param 'MinHitKeyword';
625 + %= text_field 'MinHitKeyword' => size => '5', class => 'input'
626 + </span></p>
627 + <p><span class=label>
628 + %=l 'aws_BAR_SIZE', class => 'label'
629 + </span><span class=data>
630 + % param 'BarSize' => $aws_datas->{barSize} unless param 'BarSize';
631 + %= select_field 'BarSize' => [[(l 'MEDIUM') => 'medium'], [(l 'SMALL') => 'small'], [(l 'LARGE') => 'large']], class => 'input'
632 + </span></p>
633 + <div class='center'>
634 + %= submit_button $c->l('SAVE'), class => 'action'
635 + </div>
636 + %= hidden_field 'trt' => 'UPD'
637 + %end
638 +</div>
639 diff -urN smeserver-awstats-1.4.old/root/usr/share/smanager/themes/default/templates/partials/_aws_list.html.ep smeserver-awstats-1.4/root/usr/share/smanager/themes/default/templates/partials/_aws_list.html.ep
640 --- smeserver-awstats-1.4.old/root/usr/share/smanager/themes/default/templates/partials/_aws_list.html.ep 1970-01-01 04:00:00.000000000 +0400
641 +++ smeserver-awstats-1.4/root/usr/share/smanager/themes/default/templates/partials/_aws_list.html.ep 2023-02-22 22:09:35.000000000 +0400
642 @@ -0,0 +1,74 @@
643 +<div id='aws_list'>
644 +
645 + %= form_for '/awstats' => (method => 'POST') => begin
646 + %= submit_button l('aws_BUTTON_CONFIGURE'), class => 'action'
647 + %= hidden_field 'trt' => 'CNF'
648 + <p>
649 + % if ( $aws_datas->{status} ne 'enabled' ) {
650 + <h4><%= $c->l('aws_DISABLED') %></h4>
651 + % if ($aws_datas->{username} eq 'admin' and $aws_datas->{mailstatus} eq 'enabled') {
652 + <br>No WEB stats but <b>MAIL stats</b> are available -> <a href='awstats2?CsrfDef=TOKEN&trt=SHW&Domain=mail'> Here...</a><br>
653 + % }
654 + % if ($aws_datas->{username} eq 'admin' and $aws_datas->{ftpstatus} eq 'enabled') {
655 + <br>No WEB stats but <b>FTP stats</b> are available -> <a href='awstats2?CsrfDef=TOKEN&trt=SHW&Domain=ftp'> Here...</a><br>
656 + % }
657 + % } else {
658 + <h2><%= $c->l('aws_DOMAINS_TITLE') %></h2>
659 +
660 + %=l 'aws_STATS_NOTE'
661 +
662 + <table class="sme-border"><tbody>
663 + <tr><th class='sme-border'>
664 + %=l 'DOMAIN_NAME'
665 + </th><th class='sme-border'>
666 + %=l 'DESCRIPTION_BRIEF'
667 + </th><th class='sme-border'>
668 + %=l 'aws_CONTENT'
669 + </th><th class='sme-border'>AWStats</th>
670 + <th class='sme-border'>
671 + %=l 'aws_LABEL_STATUS'
672 + </th></tr>
673 +
674 + % foreach my $domain ( @$domains ) {
675 + <tr>
676 + %= t td => (class => 'sme-border') => $domain->{Domain}
677 + %= t td => (class => 'sme-border') => $domain->{'Description'}
678 + %= t td => (class => 'sme-border') => $domain->{'Content'}
679 + % my $actionShow = l("$domain->{AWStats}");
680 + % if ( $domain->{AWStats} eq 'Show' ) {
681 + % $actionShow = "<a href='awstats2?CsrfDef=TOKEN&trt=SHW&Domain=" . $domain->{Domain} . "'>" . l("$domain->{AWStats}") . "</a>";
682 + % }
683 + <td class='sme-border'><%= $c->render_to_string(inline => $actionShow) %></td>
684 + %= t td => (class => 'sme-border') => $domain->{'Status'}
685 + </tr>
686 + % }
687 + % if ( $aws_datas->{mailstatus} eq 'enabled' ) {
688 + <tr>
689 + %= t td => (class => 'sme-border') => 'mail'
690 + %= t td => (class => 'sme-border') => 'Qmail stats'
691 + %= t td => (class => 'sme-border') => ''
692 + % my $actionShow = "<a href='awstats2?CsrfDef=TOKEN&trt=SHW&Domain=mail'>Show...</a>";
693 + <td class='sme-border'><%= $c->render_to_string(inline => $actionShow) %></td>
694 + %= t td => (class => 'sme-border') => 'active'
695 + </tr>
696 + % }
697 +
698 + % if ( $aws_datas->{ftpstatus} eq 'enabled' ) {
699 + <tr>
700 + %= t td => (class => 'sme-border') => 'ftp'
701 + %= t td => (class => 'sme-border') => 'Ftp stats'
702 + %= t td => (class => 'sme-border') => ''
703 + % my $actionShow = "<a href='awstats2?CsrfDef=TOKEN&trt=SHW&Domain=ftp'>Show...</a>";
704 + <td class='sme-border'><%= $c->render_to_string(inline => $actionShow) %></td>
705 + %= t td => (class => 'sme-border') => 'active'
706 + </tr>
707 + % }
708 + </tbody></table>
709 + </p>
710 + %}
711 + % if ( $aws_datas->{logres} ) {
712 + <p>Web stats: <%= $c->render_to_string(inline => $aws_datas->{logres}) %></p>
713 + %}
714 + <p><%= $c->l( 'aws_COPYRIGHT') %></p>
715 + % end
716 +</div>
717 diff -urN smeserver-awstats-1.4.old/root/usr/share/smanager/themes/default/templates/partials/_aws_shw.html.ep smeserver-awstats-1.4/root/usr/share/smanager/themes/default/templates/partials/_aws_shw.html.ep
718 --- smeserver-awstats-1.4.old/root/usr/share/smanager/themes/default/templates/partials/_aws_shw.html.ep 1970-01-01 04:00:00.000000000 +0400
719 +++ smeserver-awstats-1.4/root/usr/share/smanager/themes/default/templates/partials/_aws_shw.html.ep 2023-03-20 21:40:51.000000000 +0400
720 @@ -0,0 +1,4 @@
721 +<div id='aws_shw'>
722 + %= $c->render_to_string(inline => $modul)
723 + %=l 'aws_COPYRIGHT'
724 +</div>

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed