Subversion Repositories ALCASAR

Rev

Rev 3037 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
2770 rexy 1
<?php
2
/**
3
 * XML Generation class
4
 *
5
 * PHP version 5
6
 *
7
 * @category  PHP
8
 * @package   PSI_XML
9
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
10
 * @copyright 2009 phpSysInfo
11
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
12
 * @version   SVN: $Id: class.XML.inc.php 699 2012-09-15 11:57:13Z namiltd $
13
 * @link      http://phpsysinfo.sourceforge.net
14
 */
15
 /**
16
 * class for generation of the xml
17
 *
18
 * @category  PHP
19
 * @package   PSI_XML
20
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
21
 * @copyright 2009 phpSysInfo
22
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
23
 * @version   Release: 3.0
24
 * @link      http://phpsysinfo.sourceforge.net
25
 */
26
class XML
27
{
28
    /**
29
     * Sysinfo object where the information retrieval methods are included
30
     *
31
     * @var PSI_Interface_OS
32
     */
33
    private $_sysinfo;
34
 
35
    /**
36
     * @var System
37
     */
38
    private $_sys = null;
39
 
40
    /**
41
     * xml object with the xml content
42
     *
43
     * @var SimpleXMLExtended
44
     */
45
    private $_xml;
46
 
47
    /**
48
     * object for error handling
49
     *
50
     * @var PSI_Error
51
     */
52
    private $_errors;
53
 
54
    /**
55
     * array with all enabled plugins (name)
56
     *
57
     * @var array
58
     */
59
    private $_plugins;
60
 
61
    /**
62
     * plugin name if pluginrequest
63
     *
64
     * @var string
65
     */
66
    private $_plugin = '';
67
 
68
    /**
69
     * generate the entire xml with all plugins or only a part of the xml (main or plugin)
70
     *
71
     * @var boolean
72
     */
73
    private $_complete_request = false;
74
 
75
    /**
76
     * doing some initial tasks
77
     * - generate the xml structure with the right header elements
78
     * - get the error object for error output
79
     * - get a instance of the sysinfo object
80
     *
81
     * @param boolean $complete   generate xml with all plugins or not
82
     * @param string  $pluginname name of the plugin
83
     *
84
     * @return void
85
     */
86
    public function __construct($complete = false, $pluginname = "", $blockname = false)
87
    {
88
        $this->_errors = PSI_Error::singleton();
2976 rexy 89
        $this->_plugin = $pluginname;
2770 rexy 90
        if ($complete) {
91
            $this->_complete_request = true;
92
        } else {
93
            $this->_complete_request = false;
94
        }
3100 rexy 95
        if (defined('PSI_EMU_PORT')) {
96
            $os = 'SSH';
97
        } elseif (defined('PSI_EMU_HOSTNAME')) {
2976 rexy 98
            $os = 'WINNT';
99
        } else {
100
            $os = PSI_OS;
101
        }
2770 rexy 102
        $this->_sysinfo = new $os($blockname);
103
        $this->_plugins = CommonFunctions::getPlugins();
104
        $this->_xmlbody();
105
    }
106
 
107
    /**
108
     * generate common information
109
     *
110
     * @return void
111
     */
112
    private function _buildVitals()
113
    {
114
        $vitals = $this->_xml->addChild('Vitals');
115
        $vitals->addAttribute('Hostname', $this->_sys->getHostname());
116
        $vitals->addAttribute('IPAddr', $this->_sys->getIp());
117
        $vitals->addAttribute('Kernel', $this->_sys->getKernel());
118
        $vitals->addAttribute('Distro', $this->_sys->getDistribution());
119
        $vitals->addAttribute('Distroicon', $this->_sys->getDistributionIcon());
120
        $vitals->addAttribute('Uptime', $this->_sys->getUptime());
121
        $vitals->addAttribute('Users', $this->_sys->getUsers());
122
        $vitals->addAttribute('LoadAvg', $this->_sys->getLoad());
123
        if ($this->_sys->getLoadPercent() !== null) {
124
            $vitals->addAttribute('CPULoad', $this->_sys->getLoadPercent());
125
        }
126
        if ($this->_sysinfo->getLanguage() !== null) {
127
            $vitals->addAttribute('SysLang', $this->_sysinfo->getLanguage());
128
        }
129
        if ($this->_sysinfo->getEncoding() !== null) {
130
            $vitals->addAttribute('CodePage', $this->_sysinfo->getEncoding());
131
        }
132
 
133
        //processes
134
        if (($procss = $this->_sys->getProcesses()) !== null) {
135
            if (isset($procss['*']) && (($procall = $procss['*']) > 0)) {
136
                $vitals->addAttribute('Processes', $procall);
137
                if (!isset($procss[' ']) || !($procss[' '] > 0)) { // not unknown
138
                    $procsum = 0;
139
                    if (isset($procss['R']) && (($proctmp = $procss['R']) > 0)) {
140
                        $vitals->addAttribute('ProcessesRunning', $proctmp);
141
                        $procsum += $proctmp;
142
                    }
143
                    if (isset($procss['S']) && (($proctmp = $procss['S']) > 0)) {
144
                        $vitals->addAttribute('ProcessesSleeping', $proctmp);
145
                        $procsum += $proctmp;
146
                    }
147
                    if (isset($procss['T']) && (($proctmp = $procss['T']) > 0)) {
148
                        $vitals->addAttribute('ProcessesStopped', $proctmp);
149
                        $procsum += $proctmp;
150
                    }
151
                    if (isset($procss['Z']) && (($proctmp = $procss['Z']) > 0)) {
152
                        $vitals->addAttribute('ProcessesZombie', $proctmp);
153
                        $procsum += $proctmp;
154
                    }
155
                    if (isset($procss['D']) && (($proctmp = $procss['D']) > 0)) {
156
                        $vitals->addAttribute('ProcessesWaiting', $proctmp);
157
                        $procsum += $proctmp;
158
                    }
159
                    if (($proctmp = $procall - $procsum) > 0) {
160
                        $vitals->addAttribute('ProcessesOther', $proctmp);
161
                    }
162
                }
163
            }
164
        }
2976 rexy 165
 
3100 rexy 166
        if (($os = $this->_sys->getOS()) == 'Android') {
167
            $vitals->addAttribute('OS', 'Linux');
168
        } elseif ($os == 'GNU') {
169
            $vitals->addAttribute('OS', 'Hurd');
2976 rexy 170
        } else {
3100 rexy 171
            $vitals->addAttribute('OS', $os);
2976 rexy 172
        }
2770 rexy 173
    }
174
 
175
    /**
176
     * generate the network information
177
     *
178
     * @return void
179
     */
180
    private function _buildNetwork()
181
    {
182
        $hideDevices = array();
183
        $network = $this->_xml->addChild('Network');
184
        if (defined('PSI_HIDE_NETWORK_INTERFACE')) {
185
            if (is_string(PSI_HIDE_NETWORK_INTERFACE)) {
186
                if (preg_match(ARRAY_EXP, PSI_HIDE_NETWORK_INTERFACE)) {
187
                    $hideDevices = eval(PSI_HIDE_NETWORK_INTERFACE);
188
                } else {
189
                    $hideDevices = array(PSI_HIDE_NETWORK_INTERFACE);
190
                }
191
            } elseif (PSI_HIDE_NETWORK_INTERFACE === true) {
192
                return;
193
            }
194
        }
195
        foreach ($this->_sys->getNetDevices() as $dev) {
3037 rexy 196
            if (defined('PSI_HIDE_NETWORK_INTERFACE_REGEX') && PSI_HIDE_NETWORK_INTERFACE_REGEX) {
197
                $hide = false;
198
                foreach ($hideDevices as $hidedev) {
199
                    if (preg_match('/^'.$hidedev.'$/', trim($dev->getName()))) {
200
                        $hide = true;
201
                        break;
202
                    }
203
                }
204
            } else {
205
                $hide =in_array(trim($dev->getName()), $hideDevices);
206
            }
207
            if (!$hide) {
2770 rexy 208
                $device = $network->addChild('NetDevice');
209
                $device->addAttribute('Name', $dev->getName());
3100 rexy 210
                $rxbytes = $dev->getRxBytes();
211
                $txbytes = $dev->getTxBytes();
212
                $device->addAttribute('RxBytes', $rxbytes);
213
                $device->addAttribute('TxBytes', $txbytes);
214
                if (defined('PSI_SHOW_NETWORK_ACTIVE_SPEED') && PSI_SHOW_NETWORK_ACTIVE_SPEED) {
215
                    if (($rxbytes == 0) && ($txbytes == 0)) {
216
                        $rxrate = $dev->getRxRate();
217
                        $txrate = $dev->getTxRate();
218
                        if (($rxrate !== null) || ($txrate !== null)) {
219
                            if ($rxrate !== null) {
220
                                $device->addAttribute('RxRate', $rxrate);
221
                            } else {
222
                                $device->addAttribute('RxRate', 0);
223
                            }
224
                            if ($txrate !== null) {
225
                                $device->addAttribute('TxRate', $txrate);
226
                            } else {
227
                                $device->addAttribute('TxRate', 0);
228
                            }
229
                        }
230
                    }
231
                }
2770 rexy 232
                $device->addAttribute('Err', $dev->getErrors());
233
                $device->addAttribute('Drops', $dev->getDrops());
234
                if (defined('PSI_SHOW_NETWORK_INFOS') && PSI_SHOW_NETWORK_INFOS && $dev->getInfo())
235
                    $device->addAttribute('Info', $dev->getInfo());
236
            }
237
        }
238
    }
239
 
240
    /**
241
     * generate the hardware information
242
     *
243
     * @return void
244
     */
245
    private function _buildHardware()
246
    {
247
        $hardware = $this->_xml->addChild('Hardware');
3037 rexy 248
        if (($machine = $this->_sys->getMachine()) != "") {
3100 rexy 249
            $machine = trim(preg_replace("/\s+/", " ", preg_replace("/^\s*[\/,]*/", "", preg_replace("/\/\s+,/", "/,", $machine)))); // remove leading slash or comma and unnecessary spaces
250
            if (preg_match('/, BIOS .*$/', $machine, $mbuf, PREG_OFFSET_CAPTURE)) {
251
                $comapos = $mbuf[0][1];
252
                $endstr = $mbuf[0][0];
253
                $offset = 0;
254
                while (($offset < $comapos)
255
                     && (($slashpos = strpos($machine, "/", $offset)) !== false)
256
                     && ($slashpos < $comapos)) {
257
                    $len1 = $comapos - $slashpos - 1;
258
                    $str1 = substr($machine, $slashpos + 1, $len1);
259
                    $begstr  = substr($machine, 0, $slashpos);
260
                    if ($len1 > 0) { // no empty
261
                        $str2 = substr($begstr, -$len1 - 1);
262
                    } else {
263
                        $str2 = " ";
264
                    }
265
                    if ((" ".$str1 === $str2) || ($str1 === $begstr)) { // duplicates
266
                        $machine = $begstr.$endstr;
267
                        break;
268
                    }
269
                    $offset = $slashpos + 1;
270
                }
3037 rexy 271
            }
272
 
273
            if ($machine != "") {
274
                $hardware->addAttribute('Name', $machine);
275
            }
2770 rexy 276
        }
3037 rexy 277
 
278
        if (defined('PSI_SHOW_VIRTUALIZER_INFO') && PSI_SHOW_VIRTUALIZER_INFO) {
279
            $virt = $this->_sys->getVirtualizer();
280
            $first = true;
281
            $virtstring = "";
282
            foreach ($virt as $virtkey=>$virtvalue) if ($virtvalue) {
283
                if ($first) {
284
                    $first = false;
285
                } else {
286
                    $virtstring .= ", ";
287
                }
288
                if ($virtkey === 'microsoft') {
289
                    $virtstring .= 'hyper-v';
290
                } elseif ($virtkey === 'kvm') {
291
                    $virtstring .= 'qemu-kvm';
292
                } elseif ($virtkey === 'oracle') {
293
                    $virtstring .= 'virtualbox';
294
                } elseif ($virtkey === 'zvm') {
295
                    $virtstring .= 'z/vm';
296
                } else {
297
                    $virtstring .= $virtkey;
298
                }
299
            }
300
            if ($virtstring !== "") {
301
                $hardware->addAttribute('Virtualizer', $virtstring);
302
            }
303
        }
304
 
2976 rexy 305
        $cpu = null;
306
        $vendortab = null;
307
        foreach ($this->_sys->getCpus() as $oneCpu) {
308
            if ($cpu === null) $cpu = $hardware->addChild('CPU');
309
            $tmp = $cpu->addChild('CpuCore');
310
            $tmp->addAttribute('Model', $oneCpu->getModel());
3037 rexy 311
            if ($oneCpu->getVoltage() > 0) {
312
                $tmp->addAttribute('Voltage', $oneCpu->getVoltage());
2976 rexy 313
            }
3037 rexy 314
            if ($oneCpu->getCpuSpeed() > 0) {
315
                $tmp->addAttribute('CpuSpeed', $oneCpu->getCpuSpeed());
316
            } elseif ($oneCpu->getCpuSpeed() == -1) {
317
                $tmp->addAttribute('CpuSpeed', 0); // core stopped
318
            }
319
            if ($oneCpu->getCpuSpeedMax() > 0) {
2976 rexy 320
                $tmp->addAttribute('CpuSpeedMax', $oneCpu->getCpuSpeedMax());
321
            }
3037 rexy 322
            if ($oneCpu->getCpuSpeedMin() > 0) {
2976 rexy 323
                $tmp->addAttribute('CpuSpeedMin', $oneCpu->getCpuSpeedMin());
324
            }
325
/*
326
            if ($oneCpu->getTemp() !== null) {
327
                $tmp->addAttribute('CpuTemp', $oneCpu->getTemp());
328
            }
329
*/
330
            if ($oneCpu->getBusSpeed() !== null) {
331
                $tmp->addAttribute('BusSpeed', $oneCpu->getBusSpeed());
332
            }
333
            if ($oneCpu->getCache() !== null) {
334
                $tmp->addAttribute('Cache', $oneCpu->getCache());
335
            }
336
            if ($oneCpu->getVirt() !== null) {
337
                $tmp->addAttribute('Virt', $oneCpu->getVirt());
338
            }
339
            if ($oneCpu->getVendorId() !== null) {
340
                if ($vendortab === null) $vendortab = @parse_ini_file(PSI_APP_ROOT."/data/cpus.ini", true);
3037 rexy 341
                $shortvendorid = $oneCpu->getVendorId();
2976 rexy 342
                if ($vendortab && ($shortvendorid != "") && isset($vendortab['manufacturer'][$shortvendorid])) {
343
                    $tmp->addAttribute('Manufacturer', $vendortab['manufacturer'][$shortvendorid]);
344
                }
345
            }
346
            if ($oneCpu->getBogomips() !== null) {
347
                $tmp->addAttribute('Bogomips', $oneCpu->getBogomips());
348
            }
349
            if ($oneCpu->getLoad() !== null) {
350
                $tmp->addAttribute('Load', $oneCpu->getLoad());
351
            }
352
        }
353
        $mem = null;
354
        foreach (System::removeDupsAndCount($this->_sys->getMemDevices()) as $dev) {
355
            if ($mem === null) $mem = $hardware->addChild('MEM');
356
            $tmp = $mem->addChild('Chip');
2770 rexy 357
            $tmp->addAttribute('Name', $dev->getName());
358
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
2976 rexy 359
                if ($dev->getCapacity() !== null) {
360
                    $tmp->addAttribute('Capacity', $dev->getCapacity());
361
                }
2770 rexy 362
                if ($dev->getManufacturer() !== null) {
363
                    $tmp->addAttribute('Manufacturer', $dev->getManufacturer());
364
                }
365
                if ($dev->getProduct() !== null) {
366
                    $tmp->addAttribute('Product', $dev->getProduct());
367
                }
2976 rexy 368
                if ($dev->getSpeed() !== null) {
369
                    $tmp->addAttribute('Speed', $dev->getSpeed());
370
                }
371
                if ($dev->getVoltage() !== null) {
372
                    $tmp->addAttribute('Voltage', $dev->getVoltage());
373
                }
374
                if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL && ($dev->getSerial() !== null)) {
375
                    $tmp->addAttribute('Serial', $dev->getSerial());
376
                }
2770 rexy 377
            }
378
            if ($dev->getCount() > 1) {
379
                $tmp->addAttribute('Count', $dev->getCount());
380
            }
381
        }
2976 rexy 382
        $pci = null;
383
        foreach (System::removeDupsAndCount($this->_sys->getPciDevices()) as $dev) {
384
            if ($pci === null) $pci = $hardware->addChild('PCI');
385
            $tmp = $pci->addChild('Device');
2770 rexy 386
            $tmp->addAttribute('Name', $dev->getName());
387
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
388
                if ($dev->getManufacturer() !== null) {
389
                    $tmp->addAttribute('Manufacturer', $dev->getManufacturer());
390
                }
391
                if ($dev->getProduct() !== null) {
392
                    $tmp->addAttribute('Product', $dev->getProduct());
393
                }
394
            }
395
            if ($dev->getCount() > 1) {
396
                $tmp->addAttribute('Count', $dev->getCount());
397
            }
398
        }
399
        $ide = null;
400
        foreach (System::removeDupsAndCount($this->_sys->getIdeDevices()) as $dev) {
401
            if ($ide === null) $ide = $hardware->addChild('IDE');
402
            $tmp = $ide->addChild('Device');
403
            $tmp->addAttribute('Name', $dev->getName());
404
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
405
                if ($dev->getCapacity() !== null) {
406
                    $tmp->addAttribute('Capacity', $dev->getCapacity());
407
                }
408
                if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL && ($dev->getSerial() !== null)) {
409
                    $tmp->addAttribute('Serial', $dev->getSerial());
410
                }
411
            }
412
            if ($dev->getCount() > 1) {
413
                $tmp->addAttribute('Count', $dev->getCount());
414
            }
415
        }
416
        $scsi = null;
417
        foreach (System::removeDupsAndCount($this->_sys->getScsiDevices()) as $dev) {
418
            if ($scsi === null) $scsi = $hardware->addChild('SCSI');
419
            $tmp = $scsi->addChild('Device');
420
            $tmp->addAttribute('Name', $dev->getName());
421
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
422
                if ($dev->getCapacity() !== null) {
423
                    $tmp->addAttribute('Capacity', $dev->getCapacity());
424
                }
425
                if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL && ($dev->getSerial() !== null)) {
426
                    $tmp->addAttribute('Serial', $dev->getSerial());
427
                }
428
            }
429
            if ($dev->getCount() > 1) {
430
                $tmp->addAttribute('Count', $dev->getCount());
431
            }
432
        }
433
        $nvme = null;
434
        foreach (System::removeDupsAndCount($this->_sys->getNvmeDevices()) as $dev) {
435
            if ($nvme === null) $nvme = $hardware->addChild('NVMe');
436
            $tmp = $nvme->addChild('Device');
437
            $tmp->addAttribute('Name', $dev->getName());
438
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
439
                if ($dev->getCapacity() !== null) {
440
                    $tmp->addAttribute('Capacity', $dev->getCapacity());
441
                }
442
                if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL && ($dev->getSerial() !== null)) {
443
                    $tmp->addAttribute('Serial', $dev->getSerial());
444
                }
445
            }
446
            if ($dev->getCount() > 1) {
447
                $tmp->addAttribute('Count', $dev->getCount());
448
            }
449
        }
2976 rexy 450
        $usb = null;
451
        foreach (System::removeDupsAndCount($this->_sys->getUsbDevices()) as $dev) {
452
            if ($usb === null) $usb = $hardware->addChild('USB');
453
            $tmp = $usb->addChild('Device');
454
            $tmp->addAttribute('Name', $dev->getName());
455
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
456
                if ($dev->getManufacturer() !== null) {
457
                    $tmp->addAttribute('Manufacturer', $dev->getManufacturer());
458
                }
459
                if ($dev->getProduct() !== null) {
460
                    $tmp->addAttribute('Product', $dev->getProduct());
461
                }
462
                if ($dev->getSpeed() !== null) {
463
                    $tmp->addAttribute('Speed', $dev->getSpeed());
464
                }
465
                if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL && ($dev->getSerial() !== null)) {
466
                    $tmp->addAttribute('Serial', $dev->getSerial());
467
                }
468
            }
469
            if ($dev->getCount() > 1) {
470
                $tmp->addAttribute('Count', $dev->getCount());
471
            }
472
        }
2770 rexy 473
        $tb = null;
474
        foreach (System::removeDupsAndCount($this->_sys->getTbDevices()) as $dev) {
475
            if ($tb === null) $tb = $hardware->addChild('TB');
476
            $tmp = $tb->addChild('Device');
477
            $tmp->addAttribute('Name', $dev->getName());
478
            if ($dev->getCount() > 1) {
479
                $tmp->addAttribute('Count', $dev->getCount());
480
            }
481
        }
482
        $i2c = null;
483
        foreach (System::removeDupsAndCount($this->_sys->getI2cDevices()) as $dev) {
484
            if ($i2c === null) $i2c = $hardware->addChild('I2C');
485
            $tmp = $i2c->addChild('Device');
486
            $tmp->addAttribute('Name', $dev->getName());
487
            if ($dev->getCount() > 1) {
488
                $tmp->addAttribute('Count', $dev->getCount());
489
            }
490
        }
491
    }
492
 
493
    /**
494
     * generate the memory information
495
     *
496
     * @return void
497
     */
498
    private function _buildMemory()
499
    {
500
        $memory = $this->_xml->addChild('Memory');
501
        $memory->addAttribute('Free', $this->_sys->getMemFree());
502
        $memory->addAttribute('Used', $this->_sys->getMemUsed());
503
        $memory->addAttribute('Total', $this->_sys->getMemTotal());
504
        $memory->addAttribute('Percent', $this->_sys->getMemPercentUsed());
505
        if (($this->_sys->getMemApplication() !== null) || ($this->_sys->getMemBuffer() !== null) || ($this->_sys->getMemCache() !== null)) {
506
            $details = $memory->addChild('Details');
507
            if ($this->_sys->getMemApplication() !== null) {
508
                $details->addAttribute('App', $this->_sys->getMemApplication());
509
                $details->addAttribute('AppPercent', $this->_sys->getMemPercentApplication());
510
            }
511
            if ($this->_sys->getMemBuffer() !== null) {
512
                $details->addAttribute('Buffers', $this->_sys->getMemBuffer());
513
                $details->addAttribute('BuffersPercent', $this->_sys->getMemPercentBuffer());
514
            }
515
            if ($this->_sys->getMemCache() !== null) {
516
                $details->addAttribute('Cached', $this->_sys->getMemCache());
517
                $details->addAttribute('CachedPercent', $this->_sys->getMemPercentCache());
518
            }
519
        }
520
        if (count($this->_sys->getSwapDevices()) > 0) {
521
            $swap = $memory->addChild('Swap');
522
            $swap->addAttribute('Free', $this->_sys->getSwapFree());
523
            $swap->addAttribute('Used', $this->_sys->getSwapUsed());
524
            $swap->addAttribute('Total', $this->_sys->getSwapTotal());
525
            $swap->addAttribute('Percent', $this->_sys->getSwapPercentUsed());
526
            $i = 1;
527
            foreach ($this->_sys->getSwapDevices() as $dev) {
528
                $swapMount = $swap->addChild('Mount');
529
                $this->_fillDevice($swapMount, $dev, $i++);
530
            }
531
        }
532
    }
533
 
534
    /**
535
     * fill a xml element with atrributes from a disk device
536
     *
537
     * @param SimpleXmlExtended $mount Xml-Element
538
     * @param DiskDevice        $dev   DiskDevice
3037 rexy 539
     * @param int               $i     counter
2770 rexy 540
     *
3037 rexy 541
     * @return void
2770 rexy 542
     */
543
    private function _fillDevice(SimpleXMLExtended $mount, DiskDevice $dev, $i)
544
    {
545
        $mount->addAttribute('MountPointID', $i);
2976 rexy 546
        if ($dev->getFsType()!=="") {
547
            $mount->addAttribute('FSType', $dev->getFsType());
548
        }
2770 rexy 549
        $mount->addAttribute('Name', $dev->getName());
550
        $mount->addAttribute('Free', sprintf("%.0f", $dev->getFree()));
551
        $mount->addAttribute('Used', sprintf("%.0f", $dev->getUsed()));
552
        $mount->addAttribute('Total', sprintf("%.0f", $dev->getTotal()));
2976 rexy 553
        $percentUsed = $dev->getPercentUsed();
554
        $mount->addAttribute('Percent', $percentUsed);
555
        if ($dev->getPercentInodesUsed() !== null) {
556
            $mount->addAttribute('Inodes', $dev->getPercentInodesUsed());
557
        }
2770 rexy 558
        if ($dev->getIgnore() > 0) $mount->addAttribute('Ignore', $dev->getIgnore());
3037 rexy 559
        if (PSI_SHOW_MOUNT_OPTION) {
2770 rexy 560
            if ($dev->getOptions() !== null) {
561
                $mount->addAttribute('MountOptions', preg_replace("/,/", ", ", $dev->getOptions()));
562
            }
563
        }
3037 rexy 564
        if (PSI_SHOW_MOUNT_POINT && ($dev->getMountPoint() !== null)) {
2770 rexy 565
            $mount->addAttribute('MountPoint', $dev->getMountPoint());
566
        }
567
    }
568
 
569
    /**
570
     * generate the filesysteminformation
571
     *
572
     * @return void
573
     */
574
    private function _buildFilesystems()
575
    {
2976 rexy 576
        $hideMounts = $hideFstypes = $hideDisks = $ignoreFree = $ignoreTotal = $ignoreUsage = $ignoreThreshold = array();
2770 rexy 577
        if (defined('PSI_HIDE_MOUNTS') && is_string(PSI_HIDE_MOUNTS)) {
578
            if (preg_match(ARRAY_EXP, PSI_HIDE_MOUNTS)) {
579
                $hideMounts = eval(PSI_HIDE_MOUNTS);
580
            } else {
581
                $hideMounts = array(PSI_HIDE_MOUNTS);
582
            }
583
        }
584
        if (defined('PSI_HIDE_FS_TYPES') && is_string(PSI_HIDE_FS_TYPES)) {
585
            if (preg_match(ARRAY_EXP, PSI_HIDE_FS_TYPES)) {
586
                $hideFstypes = eval(PSI_HIDE_FS_TYPES);
587
            } else {
588
                $hideFstypes = array(PSI_HIDE_FS_TYPES);
589
            }
590
        }
591
        if (defined('PSI_HIDE_DISKS')) {
592
            if (is_string(PSI_HIDE_DISKS)) {
593
                if (preg_match(ARRAY_EXP, PSI_HIDE_DISKS)) {
594
                    $hideDisks = eval(PSI_HIDE_DISKS);
595
                } else {
596
                    $hideDisks = array(PSI_HIDE_DISKS);
597
                }
598
            } elseif (PSI_HIDE_DISKS === true) {
599
                return;
600
            }
601
        }
602
        if (defined('PSI_IGNORE_FREE') && is_string(PSI_IGNORE_FREE)) {
603
            if (preg_match(ARRAY_EXP, PSI_IGNORE_FREE)) {
604
                $ignoreFree = eval(PSI_IGNORE_FREE);
605
            } else {
606
                $ignoreFree = array(PSI_IGNORE_FREE);
607
            }
608
        }
2976 rexy 609
        if (defined('PSI_IGNORE_TOTAL') && is_string(PSI_IGNORE_TOTAL)) {
610
            if (preg_match(ARRAY_EXP, PSI_IGNORE_TOTAL)) {
611
                $ignoreTotal = eval(PSI_IGNORE_TOTAL);
612
            } else {
613
                $ignoreTotal = array(PSI_IGNORE_TOTAL);
614
            }
615
        }
2770 rexy 616
        if (defined('PSI_IGNORE_USAGE') && is_string(PSI_IGNORE_USAGE)) {
617
            if (preg_match(ARRAY_EXP, PSI_IGNORE_USAGE)) {
618
                $ignoreUsage = eval(PSI_IGNORE_USAGE);
619
            } else {
620
                $ignoreUsage = array(PSI_IGNORE_USAGE);
621
            }
622
        }
623
        if (defined('PSI_IGNORE_THRESHOLD_FS_TYPES') && is_string(PSI_IGNORE_THRESHOLD_FS_TYPES)) {
624
            if (preg_match(ARRAY_EXP, PSI_IGNORE_THRESHOLD_FS_TYPES)) {
625
                $ignoreThreshold = eval(PSI_IGNORE_THRESHOLD_FS_TYPES);
626
            } else {
627
                $ignoreThreshold = array(PSI_IGNORE_THRESHOLD_FS_TYPES);
628
            }
629
        }
630
        $fs = $this->_xml->addChild('FileSystem');
3037 rexy 631
        $i = 1;
2770 rexy 632
        foreach ($this->_sys->getDiskDevices() as $disk) {
633
            if (!in_array($disk->getMountPoint(), $hideMounts, true) && !in_array($disk->getFsType(), $hideFstypes, true) && !in_array($disk->getName(), $hideDisks, true)) {
634
                $mount = $fs->addChild('Mount');
635
                if (in_array($disk->getFsType(), $ignoreThreshold, true)) {
2976 rexy 636
                    $disk->setIgnore(4);
637
                } elseif (in_array($disk->getMountPoint(), $ignoreUsage, true)) {
2770 rexy 638
                    $disk->setIgnore(3);
2976 rexy 639
                } elseif (in_array($disk->getMountPoint(), $ignoreTotal, true)) {
2770 rexy 640
                    $disk->setIgnore(2);
641
                } elseif (in_array($disk->getMountPoint(), $ignoreFree, true)) {
642
                    $disk->setIgnore(1);
643
                }
644
                $this->_fillDevice($mount, $disk, $i++);
645
            }
646
        }
647
    }
648
 
649
    /**
650
     * generate the motherboard information
651
     *
652
     * @return void
653
     */
654
    private function _buildMbinfo()
655
    {
656
        $mbinfo = $this->_xml->addChild('MBInfo');
657
        $temp = $fan = $volt = $power = $current = $other = null;
658
 
659
        if (sizeof(unserialize(PSI_MBINFO))>0) {
660
            foreach (unserialize(PSI_MBINFO) as $mbinfoclass) {
661
                $mbinfo_data = new $mbinfoclass();
662
                $mbinfo_detail = $mbinfo_data->getMBInfo();
663
 
664
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='temperature') foreach ($mbinfo_detail->getMbTemp() as $dev) {
665
                    if ($temp == null) {
666
                        $temp = $mbinfo->addChild('Temperature');
667
                    }
668
                    $item = $temp->addChild('Item');
669
                    $item->addAttribute('Label', $dev->getName());
670
                    $item->addAttribute('Value', $dev->getValue());
3037 rexy 671
                    $alarm = false;
2770 rexy 672
                    if ($dev->getMax() !== null) {
673
                        $item->addAttribute('Max', $dev->getMax());
3037 rexy 674
                        $alarm = true;
2770 rexy 675
                    }
3037 rexy 676
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
677
                        $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
2770 rexy 678
                    }
679
                }
680
 
681
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='fans') foreach ($mbinfo_detail->getMbFan() as $dev) {
682
                    if ($fan == null) {
683
                        $fan = $mbinfo->addChild('Fans');
684
                    }
685
                    $item = $fan->addChild('Item');
686
                    $item->addAttribute('Label', $dev->getName());
687
                    $item->addAttribute('Value', $dev->getValue());
3037 rexy 688
                    $alarm = false;
2770 rexy 689
                    if ($dev->getMin() !== null) {
690
                        $item->addAttribute('Min', $dev->getMin());
3037 rexy 691
                        $alarm = true;
2770 rexy 692
                    }
2976 rexy 693
                    if ($dev->getUnit() !== "") {
694
                        $item->addAttribute('Unit', $dev->getUnit());
695
                    }
3037 rexy 696
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
697
                        $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
2770 rexy 698
                    }
699
                }
700
 
701
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='voltage') foreach ($mbinfo_detail->getMbVolt() as $dev) {
702
                    if ($volt == null) {
703
                        $volt = $mbinfo->addChild('Voltage');
704
                    }
705
                    $item = $volt->addChild('Item');
706
                    $item->addAttribute('Label', $dev->getName());
707
                    $item->addAttribute('Value', $dev->getValue());
3037 rexy 708
                    $alarm = false;
2976 rexy 709
                    if (($dev->getMin() === null) || ($dev->getMin() != 0) || ($dev->getMax() === null) || ($dev->getMax() != 0)) {
710
                        if ($dev->getMin() !== null) {
711
                            $item->addAttribute('Min', $dev->getMin());
3037 rexy 712
                            $alarm = true;
2976 rexy 713
                        }
714
                        if ($dev->getMax() !== null) {
715
                            $item->addAttribute('Max', $dev->getMax());
3037 rexy 716
                            $alarm = true;
2976 rexy 717
                        }
2770 rexy 718
                    }
3037 rexy 719
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
720
                        $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
2770 rexy 721
                    }
722
                }
723
 
724
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='power') foreach ($mbinfo_detail->getMbPower() as $dev) {
725
                    if ($power == null) {
726
                        $power = $mbinfo->addChild('Power');
727
                    }
728
                    $item = $power->addChild('Item');
729
                    $item->addAttribute('Label', $dev->getName());
730
                    $item->addAttribute('Value', $dev->getValue());
3037 rexy 731
                    $alarm = false;
2770 rexy 732
                    if ($dev->getMax() !== null) {
733
                        $item->addAttribute('Max', $dev->getMax());
3037 rexy 734
                        $alarm = true;
2770 rexy 735
                    }
3037 rexy 736
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
737
                        $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
2770 rexy 738
                    }
739
                }
740
 
741
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='current') foreach ($mbinfo_detail->getMbCurrent() as $dev) {
742
                    if ($current == null) {
743
                        $current = $mbinfo->addChild('Current');
744
                    }
745
                    $item = $current->addChild('Item');
746
                    $item->addAttribute('Label', $dev->getName());
747
                    $item->addAttribute('Value', $dev->getValue());
3037 rexy 748
                    $alarm = false;
2976 rexy 749
                    if (($dev->getMin() === null) || ($dev->getMin() != 0) || ($dev->getMax() === null) || ($dev->getMax() != 0)) {
750
                        if ($dev->getMin() !== null) {
751
                            $item->addAttribute('Min', $dev->getMin());
3037 rexy 752
                            $alarm = true;
2976 rexy 753
                        }
754
                        if ($dev->getMax() !== null) {
755
                            $item->addAttribute('Max', $dev->getMax());
3037 rexy 756
                            $alarm = true;
2976 rexy 757
                        }
2770 rexy 758
                    }
3037 rexy 759
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
760
                        $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
2770 rexy 761
                    }
762
                }
763
 
764
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='other') foreach ($mbinfo_detail->getMbOther() as $dev) {
765
                    if ($other == null) {
766
                        $other = $mbinfo->addChild('Other');
767
                    }
768
                    $item = $other->addChild('Item');
769
                    $item->addAttribute('Label', $dev->getName());
770
                    $item->addAttribute('Value', $dev->getValue());
2976 rexy 771
                    if ($dev->getUnit() !== "") {
772
                        $item->addAttribute('Unit', $dev->getUnit());
773
                    }
2770 rexy 774
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
3037 rexy 775
                        $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
2770 rexy 776
                    }
777
                }
778
            }
779
        }
780
    }
781
 
782
    /**
783
     * generate the ups information
784
     *
785
     * @return void
786
     */
787
    private function _buildUpsinfo()
788
    {
789
        $upsinfo = $this->_xml->addChild('UPSInfo');
3037 rexy 790
        if (!defined('PSI_EMU_HOSTNAME') && defined('PSI_UPS_APCUPSD_CGI_ENABLE') && PSI_UPS_APCUPSD_CGI_ENABLE) {
2770 rexy 791
            $upsinfo->addAttribute('ApcupsdCgiLinks', true);
792
        }
793
        if (sizeof(unserialize(PSI_UPSINFO))>0) {
794
            foreach (unserialize(PSI_UPSINFO) as $upsinfoclass) {
795
                $upsinfo_data = new $upsinfoclass();
796
                $upsinfo_detail = $upsinfo_data->getUPSInfo();
797
                foreach ($upsinfo_detail->getUpsDevices() as $ups) {
798
                    $item = $upsinfo->addChild('UPS');
799
                    $item->addAttribute('Name', $ups->getName());
800
                    if ($ups->getModel() !== "") {
801
                        $item->addAttribute('Model', $ups->getModel());
802
                    }
803
                    if ($ups->getMode() !== "") {
804
                        $item->addAttribute('Mode', $ups->getMode());
805
                    }
806
                    if ($ups->getStartTime() !== "") {
807
                        $item->addAttribute('StartTime', $ups->getStartTime());
808
                    }
809
                    $item->addAttribute('Status', $ups->getStatus());
3037 rexy 810
                    if ($ups->getBeeperStatus() !== null) {
811
                        $item->addAttribute('BeeperStatus', $ups->getBeeperStatus());
812
                    }
2770 rexy 813
                    if ($ups->getTemperatur() !== null) {
814
                        $item->addAttribute('Temperature', $ups->getTemperatur());
815
                    }
816
                    if ($ups->getOutages() !== null) {
817
                        $item->addAttribute('OutagesCount', $ups->getOutages());
818
                    }
819
                    if ($ups->getLastOutage() !== null) {
820
                        $item->addAttribute('LastOutage', $ups->getLastOutage());
821
                    }
822
                    if ($ups->getLastOutageFinish() !== null) {
823
                        $item->addAttribute('LastOutageFinish', $ups->getLastOutageFinish());
824
                    }
825
                    if ($ups->getLineVoltage() !== null) {
826
                        $item->addAttribute('LineVoltage', $ups->getLineVoltage());
827
                    }
828
                    if ($ups->getLineFrequency() !== null) {
829
                        $item->addAttribute('LineFrequency', $ups->getLineFrequency());
830
                    }
831
                    if ($ups->getLoad() !== null) {
832
                        $item->addAttribute('LoadPercent', $ups->getLoad());
833
                    }
834
                    if ($ups->getBatteryDate() !== null) {
835
                        $item->addAttribute('BatteryDate', $ups->getBatteryDate());
836
                    }
837
                    if ($ups->getBatteryVoltage() !== null) {
838
                        $item->addAttribute('BatteryVoltage', $ups->getBatteryVoltage());
839
                    }
840
                    if ($ups->getBatterCharge() !== null) {
841
                        $item->addAttribute('BatteryChargePercent', $ups->getBatterCharge());
842
                    }
843
                    if ($ups->getTimeLeft() !== null) {
844
                        $item->addAttribute('TimeLeftMinutes', $ups->getTimeLeft());
845
                    }
846
                }
847
            }
848
        }
849
    }
850
 
851
    /**
852
     * generate the xml document
853
     *
854
     * @return void
855
     */
856
    private function _buildXml()
857
    {
2976 rexy 858
        if (($this->_plugin == '') || $this->_complete_request) {
2770 rexy 859
            if ($this->_sys === null) {
3037 rexy 860
                if (PSI_DEBUG) {
2770 rexy 861
                    // unstable version check
862
                    if (!is_numeric(substr(PSI_VERSION, -1))) {
3037 rexy 863
                        $this->_errors->addWarning("This is an unstable version of phpSysInfo, some things may not work correctly");
2770 rexy 864
                    }
865
 
866
                    // Safe mode check
867
                    $safe_mode = @ini_get("safe_mode") ? true : false;
868
                    if ($safe_mode) {
869
                        $this->_errors->addError("WARN", "PhpSysInfo requires to set off 'safe_mode' in 'php.ini'");
870
                    }
871
                    // Include path check
872
                    $include_path = @ini_get("include_path");
873
                    if ($include_path && ($include_path!="")) {
874
                        $include_path = preg_replace("/(:)|(;)/", "\n", $include_path);
875
                        if (preg_match("/^\.$/m", $include_path)) {
876
                            $include_path = ".";
877
                        }
878
                    }
879
                    if ($include_path != ".") {
880
                        $this->_errors->addError("WARN", "PhpSysInfo requires '.' inside the 'include_path' in php.ini");
881
                    }
882
                    // popen mode check
3037 rexy 883
                    if (defined("PSI_MODE_POPEN") && PSI_MODE_POPEN) {
2770 rexy 884
                        $this->_errors->addError("WARN", "Installed version of PHP does not support proc_open() function, popen() is used");
885
                    }
886
                }
887
                $this->_sys = $this->_sysinfo->getSys();
888
            }
889
            if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='vitals') $this->_buildVitals();
890
            if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='network') $this->_buildNetwork();
891
            if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='hardware') $this->_buildHardware();
892
            if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='memory') $this->_buildMemory();
893
            if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='filesystem') $this->_buildFilesystems();
894
            if (!$this->_sysinfo->getBlockName() || in_array($this->_sysinfo->getBlockName(), array('voltage','current','temperature','fans','power','other'))) $this->_buildMbinfo();
895
            if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='ups') $this->_buildUpsinfo();
896
        }
897
        if (!$this->_sysinfo->getBlockName()) $this->_buildPlugins();
898
        $this->_xml->combinexml($this->_errors->errorsAddToXML($this->_sysinfo->getEncoding()));
899
    }
900
 
901
    /**
902
     * get the xml object
903
     *
904
     * @return SimpleXmlElement
905
     */
906
    public function getXml()
907
    {
908
        $this->_buildXml();
909
 
910
        return $this->_xml->getSimpleXmlElement();
911
    }
912
 
913
    /**
914
     * include xml-trees of the plugins to the main xml
915
     *
916
     * @return void
917
     */
918
    private function _buildPlugins()
919
    {
920
        $pluginroot = $this->_xml->addChild("Plugins");
2976 rexy 921
        if ((($this->_plugin != '') || $this->_complete_request) && count($this->_plugins) > 0) {
2770 rexy 922
            $plugins = array();
923
            if ($this->_complete_request) {
924
                $plugins = $this->_plugins;
925
            }
2976 rexy 926
            if (($this->_plugin != '')) {
2770 rexy 927
                $plugins = array($this->_plugin);
928
            }
929
            foreach ($plugins as $plugin) {
2976 rexy 930
                if (!$this->_complete_request || !defined('PSI_PLUGIN_'.strtoupper($plugin).'_WMI_HOSTNAME') ||
931
                   (defined('PSI_WMI_HOSTNAME') && (PSI_WMI_HOSTNAME == constant('PSI_PLUGIN_'.strtoupper($plugin).'_WMI_HOSTNAME')))) {
932
                    $object = new $plugin($this->_sysinfo->getEncoding());
933
                    $object->execute();
934
                    $oxml = $object->xml();
935
                    if (sizeof($oxml) > 0) {
936
                        $pluginroot->combinexml($oxml);
937
                    }
2770 rexy 938
                }
939
            }
940
        }
941
    }
942
 
943
    /**
944
     * build the xml structure where the content can be inserted
945
     *
946
     * @return void
947
     */
948
    private function _xmlbody()
949
    {
950
        $dom = new DOMDocument('1.0', 'UTF-8');
951
        $root = $dom->createElement("tns:phpsysinfo");
952
        $root->setAttribute('xmlns:tns', 'http://phpsysinfo.sourceforge.net/');
953
        $root->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
954
        $root->setAttribute('xsi:schemaLocation', 'http://phpsysinfo.sourceforge.net/ phpsysinfo3.xsd');
955
        $dom->appendChild($root);
956
        $this->_xml = new SimpleXMLExtended(simplexml_import_dom($dom), $this->_sysinfo->getEncoding());
957
 
958
        $generation = $this->_xml->addChild('Generation');
959
        $generation->addAttribute('version', PSI_VERSION_STRING);
960
        $generation->addAttribute('timestamp', time());
961
        $options = $this->_xml->addChild('Options');
962
        $options->addAttribute('tempFormat', defined('PSI_TEMP_FORMAT') ? strtolower(PSI_TEMP_FORMAT) : 'c');
963
        $options->addAttribute('byteFormat', defined('PSI_BYTE_FORMAT') ? strtolower(PSI_BYTE_FORMAT) : 'auto_binary');
964
        $options->addAttribute('datetimeFormat', defined('PSI_DATETIME_FORMAT') ? strtolower(PSI_DATETIME_FORMAT) : 'utc');
965
        if (defined('PSI_REFRESH')) {
3037 rexy 966
            $options->addAttribute('refresh', max(intval(PSI_REFRESH), 0));
2770 rexy 967
        } else {
968
            $options->addAttribute('refresh', 60000);
969
        }
970
        if (defined('PSI_FS_USAGE_THRESHOLD')) {
971
            if ((($fsut = intval(PSI_FS_USAGE_THRESHOLD)) >= 1) && ($fsut <= 99)) {
972
                $options->addAttribute('threshold', $fsut);
973
            }
974
        } else {
975
            $options->addAttribute('threshold', 90);
976
        }
977
        if (count($this->_plugins) > 0) {
2976 rexy 978
            if (($this->_plugin != '')) {
2770 rexy 979
                $plug = $this->_xml->addChild('UsedPlugins');
980
                $plug->addChild('Plugin')->addAttribute('name', $this->_plugin);
981
            } elseif ($this->_complete_request) {
982
                $plug = $this->_xml->addChild('UsedPlugins');
983
                foreach ($this->_plugins as $plugin) {
984
                    $plug->addChild('Plugin')->addAttribute('name', $plugin);
985
                }
986
/*
987
            } else {
988
                $plug = $this->_xml->addChild('UnusedPlugins');
989
                foreach ($this->_plugins as $plugin) {
990
                    $plug->addChild('Plugin')->addAttribute('name', $plugin);
991
                }
992
*/
993
            }
994
        }
995
    }
996
}