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)  

create_update_node.php
Go to the documentation of this file.
1 <?php
24 require '../commons/base.inc.php';
25 foreach ((array)$_POST as $key => &$val) {
26  if (!isset($val)) {
27  continue;
28  }
29  $_POST[$key] = trim(
30  base64_decode($val)
31  );
32  unset($val);
33 }
34 if (!isset($_POST['fogverified'])) {
35  return;
36 }
37 if (isset($_POST['newNode'])) {
38  $exists = FOGCore::getClass('StorageNodeManager')
39  ->exists($_POST['ip'], '', 'ip');
40  if ($exists) {
41  return;
42  }
43  FOGCore::getClass('StorageNode')
44  ->set('name', trim($_POST['name']))
45  ->set('path', trim($_POST['path']))
46  ->set('ftppath', trim($_POST['ftppath']))
47  ->set('snapinpath', trim($_POST['snapinpath']))
48  ->set('sslpath', trim($_POST['sslpath']))
49  ->set('ip', trim($_POST['ip']))
50  ->set('maxClients', trim($_POST['maxClients']))
51  ->set('user', trim($_POST['user']))
52  ->set('pass', trim($_POST['pass']))
53  ->set('interface', trim($_POST['interface']))
54  ->set('bandwidth', trim($_POST['bandwidth']))
55  ->set('webroot', trim($_POST['webroot']))
56  ->set('isEnabled', '1')
57  ->save();
58 } elseif (isset($_POST['nodePass'])) {
59  foreach ((array)FOGCore::getClass('StorageNodeManager')
60  ->find(array('ip' => $_POST['ip'])) as &$Node
61  ) {
62  if (($Node->get('pass') === trim($_POST['pass'])) &&
63  ($Node->get('user') === trim($_POST['user']))) {
64  continue;
65  }
66  $Node
67  ->set('pass', trim($_POST['pass']))
68  ->set('user', trim($_POST['user']))
69  ->save();
70  unset($Node);
71  }
72 }
FOGBase\getClass
static getClass($class, $data='', $props=false)
Definition: fogbase.class.php:439
$exists
$exists
Definition: check_node_exists.php:26
$val
$val
Definition: check_node_exists.php:25