[ Index ] |
PHP Cross Reference of Yamoon 0.9.0 |
[Summary view] [Print] [Text view]
1 <?php 2 require_once ('Yamoon/Global.php'); 3 include ('header.php'); 4 5 $host_id = $_GET['host_id']; 6 $company_id = $_GET['company_id']; 7 8 // ============ DELETE 9 if (isset($_GET['action']) && $_GET['action'] == "delete") { 10 $message = ''; 11 $timeout = $config->redir_timeout; 12 $host = new Host($config, $host_id); 13 if ($host->delete()) { 14 $message = "Host '".$host->name."' deleted!"; 15 } else { 16 $timeout = $config->redir_timeout_error; 17 $message = "Host '".$host->name."' cannot be deleted! Assure there's no probe with it."; 18 } 19 $link = "company.php?company_id=".$company_id."&action=edit"; 20 include ('message.php'); 21 22 // ============ INSERT 23 } else if (isset($_GET['action']) && $_GET['action'] == "insert") { 24 $message = ""; 25 $timeout = $config->redir_timeout; 26 if (isset($_GET['company_id']) && $_GET['company_id'] != "" && 27 isset($_GET['hostname']) && $_GET['hostname'] != "") { 28 $company_id = $_GET['company_id']; 29 $name = $_GET['hostname']; 30 $ip = $_GET['hostip']; 31 $host = new Host($config); 32 if ($host->create($company_id, $name, $ip)) 33 $message = "Host created!"; 34 else { 35 $timeout = $config->redir_timeout_error; 36 $message = "Cannot create duplicated hosts!"; 37 } 38 } else { 39 $timeout = $config->redir_timeout_error; 40 $message = "Cannot create a host without a name!"; 41 } 42 $link = "company.php?action=edit&company_id=".$company_id; 43 include ('message.php'); 44 45 // ============ SAVE 46 } else if (isset($_GET['action']) && $_GET['action'] == "save") { 47 $host = new Host($config, $host_id); 48 $message = ""; 49 $timeout = $config->redir_timeout; 50 if (isset($_GET['company_id']) && $_GET['company_id'] != "" && 51 isset($_GET['hostname']) && $_GET['hostname'] != "") { 52 $company_id = $_GET['company_id']; 53 $host->name = $_GET['hostname']; 54 $host->ip = $_GET['hostip']; 55 $host->update(); 56 $message = "Host data updated!"; 57 } else { 58 $timeout = $config->redir_timeout_error; 59 $message = "Cannot update a host without a name!"; 60 } 61 $link = "company.php?action=edit&company_id=".$company_id; 62 include ('message.php'); 63 64 // ============ EDIT 65 } else { 66 $host = new Host($config, $host_id); 67 if ($company_id != $host->company->id) { 68 $link = "company.php?action=edit&company_id=".$company_id; 69 $message = "This host does not belongs to that company!"; 70 $timeout = $config->redir_timeout; 71 include ('message.php'); 72 } else { 73 ?> 74 75 <p> 76 <form action="host.php"> 77 <input type=hidden name=action value=save> 78 <input type=hidden name=host_id value="<?php print $host->id ?>"> 79 <input type=hidden name=company_id value="<?php print $company_id ?>"> 80 <table> 81 <tr> 82 <td class='title'>Host</td><td class='field'><input name=hostname value="<?php print $host->name ?>"></td> 83 </tr> 84 <tr> 85 <td class='title'>IP</td><td class='field'><input name=hostip value="<?php print $host->ip ?>"></td> 86 </tr> 87 <tr> 88 <td class='field' colspan=2><input type=submit value="Update"></td> 89 </tr> 90 </table> 91 </form> 92 <p> 93 94 <?php 95 } 96 } 97 include ('footer.php'); 98 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sat Feb 19 17:29:53 2005 | Cross-referenced by PHPXref 0.6 |