forked from dtouzeau/artica-1.5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
artica.repositories.php
executable file
·797 lines (584 loc) · 20.7 KB
/
artica.repositories.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
<?php
header("Pragma: no-cache");
header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
include_once('ressources/class.templates.inc');
include_once('ressources/class.ldap.inc');
include_once('ressources/class.users.menus.inc');
include_once('ressources/class.artica.inc');
include_once('ressources/class.mysql.inc');
$usersmenus=new usersMenus();
if($usersmenus->AsArticaAdministrator==false){header('location:users.index.php');exit;}
if(isset($_GET["main"])){main_switch();exit;}
if(isset($_GET["status"])){main_status();exit;}
if(isset($_GET["CheckEveryMinutes"])){SaveConf();exit;}
if(isset($_GET["ArticaUpdateInstallPackage"])){ArticaUpdateInstallPackage();exit;}
if(isset($_GET["auto_update_perform"])){auto_update_perform();exit;}
if(isset($_GET["PackageUninstall"])){uninstall_package();exit;}
if(isset($_GET["PackageUninstallRoolback"])){uninstall_rollback_package();exit;}
if(isset($_GET["apply_uninstall"])){uninstall_to_system();exit;}
if(isset($_GET["PackageInstall"])){install_package();exit;}
if(isset($_GET["PackageInstallRoolback"])){install_rollback_package();exit;}
if(isset($_GET["DeleteEvent"])){main_event_delete();exit;}
if(isset($_GET["apply_upgrade"])){upgrade_to_system();exit;}
if(isset($_GET["popup"])){popup();exit;}
//main_page();
main_js();
function main_js(){
$page=CurrentPageName();
$prefix=str_replace('.',"_",$page);
$tpl=new templates();
$title=$tpl->_ENGINE_parse_body('{repositories_manager}');
$default="LoadAjax('main_configapt','$page?main={$_GET["main"]}&hostname=$hostname')";
if(isset($_GET["show"])){
$default="LoadAjax('main_configapt','$page?main={$_GET["show"]}&hostname=$hostname')";
}
$html="
var {$prefix}timerID = null;
var {$prefix}timerID1 = null;
var {$prefix}tant=0;
var {$prefix}reste=0;
var {$prefix}timeout=0;
function LoadAptPage(){
YahooWinT(750,'$page?popup=yes','$title');
setTimeout(\"initapt()\",1000);
}
function initapt(){
if(!document.getElementById('main_configapt')){
if({$prefix}timeout<5){
{$prefix}timeout={$prefix}timeout+1;
setTimeout(\"initapt()\",1000);
return false;
}
}
{$prefix}ChargeLogs();
$default;
}
var x_refresh_events= function (obj) {
LoadAjax('main_configapt','artica.repositories.php?main=events&tab=events&hostname=')
}
var x_refresh_packages= function (obj) {
if(document.getElementById('p_queries')){
document.getElementById('search_p').value=document.getElementById('p_queries').value;
SearchPackage();
return false;
}
SearchPackage();
}
function PackageInfos(p){
YahooWin(700,'$page?main=package_info&pname='+ p);
}
function DeleteEvent(id){
var XHR = new XHRConnection();
XHR.appendData('DeleteEvent',id);
XHR.sendAndLoad('$page', 'GET',x_refresh_events);
}
function ShowEvent(id){
YahooWin(700,'$page?main=event&id='+ id);
}
function PackageInfosInstall(p){
YahooWin(700,'$page?main=package_info&pname='+ p+'&install=yes');
}
function apply_uninstall(){
if(confirm(document.getElementById('apply_uninstall_help').value)){
var XHR = new XHRConnection();
XHR.appendData('apply_uninstall','yes');
XHR.sendAndLoad('$page', 'GET',x_refresh_events);
}
}
function apply_upgrade(){
if(confirm(document.getElementById('apply_upgrade_help').value)){
var XHR = new XHRConnection();
XHR.appendData('apply_upgrade','yes');
XHR.sendAndLoad('$page', 'GET',x_refresh_events);
}
}
function PackageUninstall(p){
var XHR = new XHRConnection();
XHR.appendData('PackageUninstall',p);
XHR.sendAndLoad('$page', 'GET',x_refresh_packages);
PackageInfos(p)
}
function PackageInstall(p){
var XHR = new XHRConnection();
XHR.appendData('PackageInstall',p);
XHR.sendAndLoad('$page', 'GET',x_refresh_packages);
PackageInfosInstall(p);
}
function PackageUninstallRoolback(p){
var XHR = new XHRConnection();
XHR.appendData('PackageUninstallRoolback',p);
XHR.sendAndLoad('$page', 'GET',x_refresh_packages);
PackageInfos(p);
}
function PackageInstallRoolback(p){
var XHR = new XHRConnection();
XHR.appendData('PackageInstallRoolback',p);
XHR.sendAndLoad('$page', 'GET',x_refresh_packages);
PackageInfos(p);
}
function SearchPackageEnter(e){
if(checkEnter(e)){SearchPackage();}
}
function SearchPackage(){
var tab='';
var q=document.getElementById('search_p').value;
if(document.getElementById('switch')){tab=document.getElementById('switch').value;}
var err=document.getElementById('more_one_car').value;
if(q.length>1){
document.getElementById('error').innerHTML='';
LoadAjax('package_list','$page?main=list_packages&query='+q+'&tab='+tab);
LoadAjax('package_list_install','$page?main=list_install_packages&query='+q+'&tab='+tab);
}else{
document.getElementById('error').innerHTML=err;
}
}
function {$prefix}demarre(){
{$prefix}tant = {$prefix}tant+1;
{$prefix}reste=10-{$prefix}tant;
if ({$prefix}tant < 10 ) {
{$prefix}timerID = setTimeout(\"demarre()\",3000);
} else {
{$prefix}tant = 0;
//document.getElementById('wait').innerHTML='<img src=img/wait.gif>';
{$prefix}ChargeLogs();
{$prefix}demarre(); //la boucle demarre !
}
}
function {$prefix}ChargeLogs(){
LoadAjax('servinfosAPT','$page?status=yes&hostname={$_GET["hostname"]}');
}
LoadAptPage();
";
echo $html;
}
function popup(){
$html="
<H1>{repositories_manager}</H1>
<table style='width:650px' align=center>
<tr>
<td valign='top'>
<img src='img/256-apt.png'>
</td>
<td valign='top'><p class='caption'>{repositories_manager_explain}</p>
<div id='servinfosAPT'></div>
</td>
</tr>
<tr>
<td colspan=2><br>
<div id='main_configapt'>
</div>
</td>
</tr>
</table>
";
$tpl=new templates();
echo $tpl->_ENGINE_parse_body($html);
}
function packages_status(){
$q=new mysql();
$q->BuildTables();
$count=$q->COUNT_ROWS("debian_packages","artica_backup");
$html="<table style='width:100%'>
<tr>
<td width=1%><img src='img/icon_info.gif'></td>
<td nowrap width=1% nowrap><strong>{num_packages_installed}:</strong></td>
<td nowrap align='left'><strong style='color:red'>$count</strong></td>
</tr>
</table>
";
$tpl=new templates();
$sock=new sockets();
$datas=trim(@file_get_contents("/etc/artica-postfix/apt.upgrade.cache"));
if(preg_match('#nb:([0-9]+)\s+#is',$datas,$re)){
$services=$tpl->_ENGINE_parse_body(Paragraphe('i32.png',"{upgrade_your_system}","{$re[1]} {packages_to_upgrade}","javascript:Loadjs('artica.repositories.php?show=update')"));
$services="<br>".$services;
}
echo RoundedLightWhite($tpl->_ENGINE_parse_body("$html$services"));
}
function main_configapt(){
$artica=new artica_general();
$page=CurrentPageName();
$form="
<input type='hidden' id='more_one_car' value='{more_one_car}'>
<table style='width:100%'>
<tr>
<td width=1% nowrap' align='right'><strong>{package_name}</strong>:</td>
<td>" . Field_text('search_p',null,'width:190px',null,null,null,false,"SearchPackageEnter(event)")."</td>
<td nowrap><span id='error' style='color:red'></span></d>
<td><input type='button' value='{search} »' OnClick=\"javascript:SearchPackage();\"></td>
</tr>
</table>";
$form=RoundedLightGrey($form);
$html=main_tabs() . "<br><H5>{packages_list}</H5><br>$form<br>
<div id='package_list'>".main_package_list()."</div>
<div id='package_list_install'></div>
";
$tpl=new templates();
return $tpl->_ENGINE_parse_body($html);
}
function main_package_uninstall(){
$html=main_tabs()."
<table style='width:100%'>
<tr>
<td style='width:100%' valign='top'>
<H5>{uninstall_packages_list}</h5>
<input type='hidden' id='search_p' value=''>
</td>
<td width=1%>" . uninstall_Apply_uninstall()."</td>
</tr>
</table>
<div id='package_list'>".main_package_list()."</div>";
$tpl=new templates();
return $tpl->_ENGINE_parse_body($html);
}
function main_package_list(){
$q=new mysql();
if(strlen($_GET["query"])>1){
$que="WHERE (package_name LIKE '%{$_GET["query"]}%') OR (package_info LIKE '%{$_GET["query"]}%') OR (package_description LIKE '%{$_GET["query"]}%')";
}
if($_GET["tab"]=="uninstall_list"){
$que=null;
$que1=" WHERE (package_status='a-uu') OR (package_status='a-ii')";
}
$sql="SELECT * FROM `debian_packages` $que $que1 LIMIT 0 , 50";
$results=$q->QUERY_SQL($sql,'artica_backup');
$html="
<input type='hidden' id='p_queries' value='{$_GET["query"]}'>
<input type='hidden' id='switch' value='{$_GET["tab"]}'>
<table style='width:100%'>";
while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
$r=$ligne["package_status"];
$uri="<a href='#' OnClick=\"javascript:PackageInfos('{$ligne["package_name"]}')\">";
switch ($r) {
case 'rc':$img=imgtootltip('icon_mini_off.gif','{removed_package}');$uri=null;break;
case "ii":$img=imgtootltip('icon-mini-ok.gif','{installed_package}');break;
case "a-uu":$img=imgtootltip('icon_mini_read_off.gif','{to_be_uninstalled}');break;
case "a-ii":$img=imgtootltip('icon_mini_info.jpg','{to_be_installed}');break;
default:
break;
}
$html=$html."
<tr ". CellRollOver_jaune().">
<td width=1%><img src='img/fw_bold.gif'></td>
<td width=1%>$img</td>
<td width=1% nowrap><strong>$uri{$ligne["package_name"]}</strong></a></td>
<td width=99% nowrap><strong>$uri{$ligne["package_info"]}...</strong></a></td>
</tr>
";
}
$html=$html . "</table>";
$html="
<H5>{installed_on_system}</h5>
<div style='overflow-y:auto;width:100%;height:210px'>$html</div>";
$tpl=new templates();
return RoundedLightWhite($tpl->_ENGINE_parse_body($html));
}
function main_status(){
echo packages_status();
}
function main_switch(){
switch ($_GET["main"]) {
case "config":echo main_configapt();exit;break;
case "events":echo main_events();exit;break;
case "list":echo main_updatelist();exit;break;
case "list_packages":echo main_package_list();exit;break;
case "package_info":echo main_info_package();exit;break;
case "uninstall_list":echo main_package_uninstall();exit;break;
case "list_install_packages":echo main_package_install();exit;break;
case "event":echo main_event_zoom();exit;break;
case "update":echo main_update();exit;break;
default:echo main_configapt();exit;break;
}
}
function main_tabs(){
$page=CurrentPageName();
$array["config"]='{packages_list}';
$array["uninstall_list"]='{uninstall_packages_list}';
$array["events"]='{events}';
$array["update"]='{system_update}';
while (list ($num, $ligne) = each ($array) ){
if($_GET["main"]==$num){$class="id=tab_current";}else{$class=null;}
$html=$html . "<li><a href=\"javascript:LoadAjax('main_configapt','$page?main=$num&tab=$num&hostname={$_GET["hostname"]}')\" $class>$ligne</a></li>\n";
}
return "<div id=tablist>$html</div>";
}
function SaveConf(){
$artica=new artica_general();
while (list ($num, $ligne) = each ($_GET) ){
$artica->ArticaAutoUpdateConfig[$num]=$ligne;
}
$artica->SaveAutoUpdateConfig();
}
function main_info_package(){
$pname=$_GET["pname"];
$installed=IsPackageInstalled($pname);
$sql="SELECT package_status,package_description FROM debian_packages WHERE package_name='$pname'";
$q=new mysql();
$ligne=mysql_fetch_array($q->QUERY_SQL($sql,"artica_backup"));
$package_status=$ligne["package_status"];
if($installed){
$datas=$ligne["package_description"];
}else{
$sock=new sockets();
$datas=$sock->getfile("reposinfo:$pname");
}
$tbl=explode("\n",$datas);
$html="<table style='width:100%'>";
while (list ($num, $ligne) = each ($tbl) ){
if(trim($ligne)==null){continue;}
$html=$html."<tr>";
if(preg_match('#^(.+?):(.+)#',$ligne,$re)){
if($re[1]=="SHA256"){continue;}
if($re[1]=="SHA1"){continue;}
if($re[1]=="MD5sum"){continue;}
$html=$html."<td nowrap valign='top' align='right'><strong style='font-size:11px'>{$re[1]}</strong>:</td>
<td>{$re[2]}</td>";
}else{
$html=$html . "<td> </td><td>$ligne</td>";
}
$html=$html . "</tr>";
}
$html=$html . "</table>";
if($installed){
$delete=RoundedLightWhite(Paragraphe('folder-delete-64.png','{uninstall}','{uninstall_text}',"javascript:PackageUninstall(\"$pname\");","uninstall"));
if($package_status=="a-uu"){
$delete=RoundedLightWhite(Paragraphe('folder-quarantine.png','{rollback_uninstall}','{rollback_uninstall_text}',"javascript:PackageUninstallRoolback(\"$pname\");","uninstall"));
}
}else{
$delete=RoundedLightWhite(Paragraphe('64-folder-install.png','{install}','{install_text}',"javascript:PackageInstall(\"$pname\");","install"));
if($package_status=="a-ii"){
$delete=RoundedLightWhite(Paragraphe('folder-quarantine.png','{rollback_install}','{rollback_install_text}',"javascript:PackageInstallRoolback(\"$pname\");","install"));
}
}
$html="<H1>$pname</h1><br>
<table style='width:100%'>
<tr>
<td valign='top' width=99%>
".RoundedLightWhite("
<div style='overflow-y:auto;width:100%;height:300px'>$html</div>")."
</td>
<td valign='top' width=1%>
$delete
</td>
</tr>
</table>";
$tpl=new templates();
echo $tpl->_ENGINE_parse_body($html);
}
function uninstall_package(){
$pname=$_GET["PackageUninstall"];
writelogs("Mark $pname has uninstalled package...",__FUNCTION__,__FILE__);
$sql="UPDATE debian_packages SET package_status='a-uu' WHERE package_name='$pname'";
$q=new mysql();
$q->QUERY_SQL($sql,'artica_backup');
}
function install_package(){
$pname=$_GET["PackageInstall"];
if(strlen(PackageSTATUS($pname))>0){
$sql="UPDATE debian_packages SET package_status='a-ii' WHERE package_name='$pname'";
}else{
$sql="INSERT INTO debian_packages (package_status,package_name) VALUES('a-ii','$pname')";
}
writelogs("Mark $pname has install package...",__FUNCTION__,__FILE__);
$q=new mysql();
$q->QUERY_SQL($sql,'artica_backup');
}
function uninstall_rollback_package(){
$pname=$_GET["PackageUninstallRoolback"];
writelogs("Mark $pname has installed package...",__FUNCTION__,__FILE__);
$sql="UPDATE debian_packages SET package_status='ii' WHERE package_name='$pname'";
$q=new mysql();
$q->QUERY_SQL($sql,'artica_backup');
}
function install_rollback_package(){
$pname=$_GET["PackageInstallRoolback"];
$sql="DELETE FROM debian_packages WHERE package_name='$pname' AND package_status='a-ii' ";
$q=new mysql();
$q->QUERY_SQL($sql,'artica_backup');
}
function uninstall_Apply_uninstall(){
$tpl=new templates();
return $tpl->_ENGINE_parse_body(
"<input type='hidden' value='{apply_uninstall_help}' id='apply_uninstall_help'>".
Paragraphe('system-64.png','{apply_uninstall}','{apply_uninstall_text}','javascript:apply_uninstall()','apply_uninstall_text'));
}
function update_Apply_install(){
$tpl=new templates();
return $tpl->_ENGINE_parse_body(
"<input type='hidden' value='{apply_upgrade_help}' id='apply_upgrade_help'>".
Paragraphe('system-64.png','{apply_upgrade}','{apply_upgrade_text}','javascript:apply_upgrade()','apply_upgrade_text'));
}
function uninstall_to_system(){
$sock=new sockets();
$sock->getfile('reposuninstall');
}
function main_package_install(){
$sock=new sockets();
$date=date('Y-m-d h:i');
$tmpfile=dirname(__FILE__).'/ressources/logs/repos.query.'.md5($_GET["query"].$date).".cache";
if(file_exists($tmpfile)){
writelogs("return content of $tmpfile",__FUNCTION__,__FILE__);
return file_get_contents($tmpfile);
}
writelogs("apt-cache query {$_GET["query"]}",__FUNCTION__,__FILE__);
$datas=$sock->getfile('reposfind:'.$_GET["query"]);
$tbl=explode("\n",$datas);
writelogs("query {$_GET["query"]} result=".count($tbl),__FUNCTION__,__FILE__);
$html="<table style='width:100%'>";
while (list ($num, $ligne) = each ($tbl) ){
if(preg_match('#(.+?)\s+-\s+(.+)#',$ligne,$re)){
$count=$count+1;
$uri="<a href='#' OnClick=\"javascript:PackageInfosInstall('{$re[1]}')\">";
$html=$html."
<tr ". CellRollOver_jaune().">
<td width=1%><img src='img/fw_bold.gif'></td>
<td width=1%><img src='img/icon-mini-ok.gif'></td>
<td width=1% nowrap><strong>$uri{$re[1]}</strong></a></td>
<td width=99% nowrap><strong>$uri{$re[2]}...</strong></a></td>
</tr>";
}
}
$html=$html . "</table>";
$html="
<H5>{to_install_on_system}</h5>
<div style='overflow-y:auto;width:100%;height:210px'>$html</div>";
$tpl=new templates();
$w="<br>".RoundedLightWhite($tpl->_ENGINE_parse_body($html));
if($count>0){
writelogs("writing new file $tmpfile",__FUNCTION__,__FILE__);
$f = @fopen($tmpfile, 'w');
@fwrite($f, $w);
@fclose($f);
}
return $w;
}
function IsPackageInstalled($pname){
$sql="SELECT package_status FROM debian_packages WHERE package_name='$pname'";
$q=new mysql();
$ligne=mysql_fetch_array($q->QUERY_SQL($sql,'artica_backup'));
writelogs("$pname={$ligne["package_status"]}",__FUNCTION__,__FILE__);
if($ligne["package_status"]=='ii'){return true;}
return false;
}
function PackageSTATUS($pname){
$sql="SELECT package_status FROM debian_packages WHERE package_name='$pname'";
$q=new mysql();
$ligne=mysql_fetch_array($q->QUERY_SQL($sql,'artica_backup'));
return $ligne["package_status"];
}
function main_events(){
$html=main_tabs()."<H5>{events}</H5>
<div id='events'>" . main_events_list()."</div>";
$tpl=new templates();
return $tpl->_ENGINE_parse_body($html);
}
function main_event_delete(){
$id=$_GET["DeleteEvent"];
$sql="DELETE FROM debian_packages_logs WHERE ID='$id'";
$q=new mysql();
$q->QUERY_SQL($sql,'artica_backup');
}
function main_event_zoom(){
$id=$_GET["id"];
$sql="SELECT * FROM debian_packages_logs WHERE ID='$id'";
$q=new mysql();
$ligne=mysql_fetch_array($q->QUERY_SQL($sql,'artica_backup'));
$ev=$ligne["events"];
$html="<H5>{$ligne["zDate"]}:: {$ligne["package_name"]}</H5>
<textarea style='border:1px dotted #CCCCCC;width:100%;height:300px'>$ev</textarea>
";
$tpl=new templates();
return $tpl->_ENGINE_parse_body($html);
}
function main_events_list(){
$sql="SELECT * FROM debian_packages_logs ORDER BY zDate DESC";
$q=new mysql();
$results=$q->QUERY_SQL($sql,'artica_backup');
$html="<div style='width:100%;height:100px;overflow:auto'><table style='width:100%'>";
while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
$ligne["events"]=substr($ligne["events"],0,50);
$uri="<a href='#' OnClick=\"javascript:ShowEvent({$ligne["ID"]});\">";
$html=$html."
<tr ". CellRollOver_jaune().">
<td width=1%><img src='img/fw_bold.gif'></td>
<td width=1% nowrap>$uri{$ligne["install_type"]}</a></td>
<td width=1% nowrap>$uri{$ligne["zDate"]}</a></td>
<td width=1% nowrap><strong>$uri{$ligne["package_name"]}</strong></a></td>
<td width=99% nowrap><strong>$uri{$ligne["events"]}...</strong></a></td>
<td width=1% nowrap>".imgtootltip('ed_delete.gif','{delete} {events}',"DeleteEvent({$ligne["ID"]})")."</td>
</tr>
";
}
$html=$html . "</table></div>";
$tpl=new templates();
return RoundedLightWhite($tpl->_ENGINE_parse_body($html))."<br><h3>Artica {events}</h3>".main_events_artica_events();
}
function main_events_artica_events(){
$sock=new sockets();
$datas=$sock->getfile('aptarticaevents');
$tbl=explode("\n",$datas);
if(!is_array($tbl)){return null;}
$tbl=array_reverse($tbl);
$t="<table style='width:100%'>";
while (list ($num, $ligne) = each ($tbl) ){
if(trim($ligne)==null){continue;}
$ligne=htmlspecialchars($ligne);
$t=$t."
<tr ". CellRollOver_jaune().">
<td width=1% valign='top'><img src='img/fw_bold.gif'></td>
<td width=99%><code>$ligne</code></a></td>
</tr>";
}
$t="<div style='width:100%;height:200px;overflow:auto'>$t</table></div>";
$t=RoundedLightWhite($t);
$tpl=new templates();
return $tpl->_ENGINE_parse_body("$t");
}
function main_update(){
$sock=new sockets();
$datas=trim($sock->getFrameWork('cmd.php?aptcheck=yes'));
$html=main_tabs()."<table style='width:100%'>
<tr>
<td valign='top'>
<H5>{system_update}</H5>";
if(preg_match('#nb:([0-9]+)\s+#is',$datas,$re)){
$html=$html . RoundedLightYellow("
<table style='width:100%'>
<tr>
<td valign='top' width=1%><img src='img/48-infos.png'></td>
<td valign='top'>
<p style='font-size:12px;font-weight:bold'>{$re[1]} {packages_to_upgrade}</p>
</td>
</tr>
</table>");
$datas=str_replace($re[0],'',$datas);
}
$html=$html."</td>
<td valign='top'>".update_Apply_install()."</td>
</tr>
</table>";
$tbl=explode("\n",$datas);
$t="<table style='width:100%'>";
while (list ($num, $ligne) = each ($tbl) ){
if(trim($ligne)<>null){
$uri="<a href='#' OnClick=\"javascript:PackageInfos('$ligne')\">";
$t=$t."
<tr ". CellRollOver_jaune().">
<td width=1%><img src='img/fw_bold.gif'></td>
<td width=99% nowrap>$uri$ligne</a></td>
</tr>";
}
}
$t=$t . "</table>";
$t="<div style='width:100%;height:200px;overflow:auto'>$t</div>";
$t=RoundedLightWhite($t);
$tpl=new templates();
return $tpl->_ENGINE_parse_body("$html$t");
}
function upgrade_to_system(){
$sock=new sockets();
$sock->getFrameWork("cmd.php?aptupgrade=yes");
}
?>