fogproject  1.5.9
About: FOG is a Linux-based network computer cloning solution for Windows, Mac OSX and various Linux distributions that ties together a few open-source tools with a PHP-based web interface. FOG doesn’t use any boot disks, or CDs; everything is done via TFTP and PXE.
  Fossies Dox: fogproject-1.5.9.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

inventory.php
Go to the documentation of this file.
1 <?php
22 require '../commons/base.inc.php';
23 FOGCore::stripAndDecode($_REQUEST);
24 try {
26  false,
27  false,
28  false,
29  false,
30  false,
31  $_REQUEST['mac']
32  );
33  $Inventory = FOGCore::$Host->get('inventory');
34  if (!$Inventory instanceof Inventory
35  || !$Inventory->isValid()
36  ) {
37  $Inventory = FOGCore::getClass('Inventory')
38  ->set('hostID', FOGCore::$Host->get('id'));
39  }
40  foreach ($_REQUEST as $var => &$val) {
41  if ($var == 'hdinfo') {
42  preg_match(
43  '#model=(.*?),#i',
44  $val,
45  $hdmodel
46  );
47  preg_match(
48  '#fwrev=(.*?),#i',
49  $val,
50  $hdfirmware
51  );
52  preg_match(
53  '#serialno=.*#i',
54  $val,
55  $hdserial
56  );
57  $hdmodel = (
58  count($hdmodel) > 1 ?
59  trim($hdmodel[1]) :
60  ''
61  );
62  $hdfirmware = (
63  count($hdfirmware) > 1 ?
64  trim($hdfirmware[1]) :
65  ''
66  );
67  $hdserial = (
68  count($hdserial) ?
69  trim(
70  str_ireplace(
71  'serialno=',
72  '',
73  trim($hdserial[0])
74  )
75  ) :
76  ''
77  );
79  ->set('hdmodel', $hdmodel)
80  ->set('hdfirmware', $hdfirmware)
81  ->set('hdserial', $hdserial);
82  unset($var, $val);
83  continue;
84  }
85  $Inventory->set($var, $val);
86  unset($var, $val);
87  }
88  if (!$Inventory->save()) {
89  throw new Exception(
90  _('Failed to create inventory for this host')
91  );
92  }
93  echo _('Done');
94 } catch (Exception $e) {
95  echo $e->getMessage();
96 }
$Inventory
$Inventory
Definition: inventory.php:33
FOGBase\getClass
static getClass($class, $data='', $props=false)
Definition: fogbase.class.php:439
exit
catch(Exception $e) exit
Definition: inventory.php:94
$val
$val
Definition: check_node_exists.php:25
FOGBase\stripAndDecode
static stripAndDecode(&$item)
Definition: fogbase.class.php:2183
FOGBase\getHostItem
static getHostItem( $service=true, $encoded=false, $hostnotrequired=false, $returnmacs=false, $override=false, $mac=false)
Definition: fogbase.class.php:503
FOGBase\$Host
static $Host
Definition: fogbase.class.php:312
Inventory
Definition: inventory.class.php:23