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)  

caponetasking.class.php
Go to the documentation of this file.
1 <?php
22 class CaponeTasking extends FOGBase
23 {
29  protected $actions = array(
30  'dmi',
31  'imagelookup'
32  );
38  protected $imgTypes = array(
39  1 => 'n',
40  2 => 'mps',
41  3 => 'mpa',
42  4 => 'dd'
43  );
49  public function __construct()
50  {
51  parent::__construct();
52  switch (strtolower($_REQUEST['action'])) {
53  case 'dmi':
54  echo self::getSetting('FOG_PLUGIN_CAPONE_DMI');
55  break;
56  case 'imagelookup':
57  if (!isset($_REQUEST['key'])
58  || empty($_REQUEST['key'])
59  ) {
60  break;
61  }
62  try {
63  $strSetup = "%s|%s|%s|%s|%s|%s|%s";
64  ob_start();
65  foreach ((array)self::getClass('CaponeManager')
66  ->find(
67  array(
68  'key' => trim(base64_decode($_REQUEST['key']))
69  )
70  ) as &$Capone
71  ) {
72  $Image = $Capone->getImage();
73  if (!$Image->isValid()) {
74  continue;
75  }
76  $OS = $Image->getOS();
77  if (!$OS->isValid()) {
78  continue;
79  }
80  $StorageNode = $Image
81  ->getStorageGroup()
82  ->getOptimalStorageNode();
83  if (!$StorageNode->isValid()) {
84  continue;
85  }
86  $Image = $Capone->getImage();
87  $path = $Image->get('path');
88  $osid = $Image->get('osID');
89  $itid = $Image->get('imageTypeID');
90  $ptid = $Image->getPartitionType();
91  $format = $Image->get('format');
92  printf(
93  "%s\n",
94  base64_encode(
95  sprintf(
96  $strSetup,
97  $path,
98  $osid,
99  $this->imgTypes[$itid],
100  $ptid,
101  (int)$format,
102  sprintf(
103  '%s:%s',
104  $StorageNode->get('ip'),
105  $StorageNode->get('path')
106  ),
107  $StorageNode->get('ip')
108  )
109  )
110  );
111  unset($Capone);
112  }
113  throw new Exception(
114  (
115  ob_get_contents() ?
116  ob_get_clean() :
117  base64_encode(null)
118  )
119  );
120  } catch (Exception $e) {
121  echo $e->getMessage();
122  }
123  break;
124  }
125  }
126 }
CaponeTasking\__construct
__construct()
Definition: caponetasking.class.php:49
CaponeTasking\$actions
$actions
Definition: caponetasking.class.php:29
CaponeTasking
Definition: caponetasking.class.php:23
FOGBase
Definition: fogbase.class.php:25
$path
if(!is_string($_GET['path'])) $path
Definition: getfiles.php:31
CaponeTasking\$imgTypes
$imgTypes
Definition: caponetasking.class.php:38
$Image
$Image
Definition: hostinfo.php:37
FOGBase\getSetting
static getSetting($key)
Definition: fogbase.class.php:2063