Skip to content

Commit

Permalink
move camera to devices IP Cam
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Jun 30, 2015
1 parent 17d07a8 commit 469847a
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 13 deletions.
3 changes: 2 additions & 1 deletion modules/devices/html/devices.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<a href="index.php?id=devices&type=snmp" ><button class="btn btn-default">SNMP</button></a>
<a href="index.php?id=devices&type=ups" ><button class="btn btn-default">UPS</button></a>
<a href="index.php?id=devices&type=hosts" ><button class="btn btn-default">Host monitoring</button></a>
<a href="index.php?id=devices&type=ipcam" ><button class="btn btn-default">IP Cam</button></a>
</[>

<?php
Expand All @@ -33,7 +34,7 @@
case 'sensors': include('modules/sensors/html/sensors.php'); break;
case 'ups': include('modules/ups/html/ups.php'); break;
case 'hosts': include('modules/hosts/html/hosts.php'); break;

case 'ipcam' : include('modules/ipcam/ipcam.php'); break;
}
?>

10 changes: 5 additions & 5 deletions modules/hosts/html/hosts_status.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
foreach ( $result as $a) {
?>
<tr>
<td> <img type="image" src="media/ico/Computer-icon.png" /></td>
<td><?php echo str_replace("host_","",$a["name"]);?></td>
<td><?php echo $a['last']; ?> ms</td>
<td></td>
<td><?php echo $a['status']; ?></td>
<td <?php echo $a['status'] == 'error' ? 'class="danger"' : '' ?>> <img type="image" src="media/ico/Computer-icon.png" /></td>
<td <?php echo $a['status'] == 'error' ? 'class="danger"' : '' ?>><?php echo str_replace("host_","",$a["name"]);?></td>
<td <?php echo $a['status'] == 'error' ? 'class="danger"' : '' ?>><?php echo $a['last']; ?> ms</td>
<td <?php echo $a['status'] == 'error' ? 'class="danger"' : '' ?>></td>
<td <?php echo $a['status'] == 'error' ? 'class="danger"' : '' ?>><?php echo $a['status']; ?></td>
</tr>

<?php
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 13 additions & 1 deletion modules/settings/camera.php → modules/ipcam/ipcam.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
if (!empty($name) && !empty($link) && ($_POST['add'] == "add")){
$db = new PDO('sqlite:dbf/nettemp.db');
$db->exec("INSERT OR IGNORE INTO camera (name, link) VALUES ('$name', '$link')") or die ($db->lastErrorMsg());
$fi = explode("/",$link);
$link = explode(":",$fi[2]);
$ip=$link[0];

$dbhost = new PDO("sqlite:dbf/hosts.db");
$dbhost->exec("INSERT OR IGNORE INTO hosts (name, ip, rom, type) VALUES ('host_cam_$name', '$ip', 'host_$name', 'ping')") or die ("cannot insert host to DB" );
$dbnew = new PDO("sqlite:db/host_$name.sql");
$dbnew->exec("CREATE TABLE def (time DATE DEFAULT (datetime('now','localtime')), value INTEEGER)");
$dbnew==NULL;

header("location: " . $_SERVER['REQUEST_URI']);
exit();
}
Expand Down Expand Up @@ -45,13 +55,13 @@
$sth->execute();
$result = $sth->fetchAll();
foreach ($result as $a) {
$link=$a['link'];
?>

<tr>
<td><img type="image" src="media/ico/Security-Camera-icon.png" /></td>
<td><?php echo $a["name"];?></td>
<td><?php echo $a["link"];?></td>

<form action="" method="post">

<input type="hidden" name="name_del" value="<?php echo $a["name"]; ?>" />
Expand All @@ -61,6 +71,8 @@
</tr>

<?php }


?>
</tbody>
</table>
Expand Down
1 change: 0 additions & 1 deletion modules/sensors/html/sensors.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,4 @@
<?php include("modules/sensors/html/sensors_settings.php"); ?>
<?php include("modules/relays/html/relays_settings.php"); ?>
<?php include("modules/sensors/html/sensors_new.php"); ?>
<?php //include("modules/sensors/html/sensors_device.php"); ?>

2 changes: 0 additions & 2 deletions modules/settings/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<a href="index.php?id=settings&type=time" ><button class="btn btn-default">Time</button></a>
<a href="index.php?id=settings&type=snmpd" ><button class="btn btn-default">SNMPD</button></a>
<a href="index.php?id=settings&type=lcd" ><button class="btn btn-default">LCD</button></a>
<a href="index.php?id=settings&type=camera" ><button class="btn btn-default">IP Cam</button></a>
</p>
<?php
$art = isset($_GET['type']) ? $_GET['type'] : '';
Expand All @@ -21,7 +20,6 @@
case 'gpio': include('modules/settings/gpio.php'); break;
case 'time': include('modules/settings/time.php'); break;
case 'snmpd': include('modules/settings/snmpd.php'); break;
case 'camera': include('modules/settings/camera.php'); break;
case 'lcd': include('modules/settings/lcd.php'); break;
case '1wire': include('modules/settings/1wire.php'); break;
}
Expand Down
6 changes: 3 additions & 3 deletions modules/status/html/status.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
<div class="masonry js-masonry" data-masonry-options='{ "isFitWidth": true }'>
<div id="res" class="item"><?php include_once('modules/sensors/html/sensor_status.php');
?></div>
<div class="item "><?php include('modules/status/html/cam1.php'); ?></div>
<div class="item "><?php include('modules/status/html/cam2.php'); ?></div>
<div class="item "><?php include('modules/status/html/cam3.php'); ?></div>
<div class="item "><?php include('modules/ipcam/cam1.php'); ?></div>
<div class="item "><?php include('modules/ipcam/cam2.php'); ?></div>
<div class="item "><?php include('modules/ipcam/cam3.php'); ?></div>
<div class="item"><?php include('modules/hosts/html/hosts_status.php'); ?></div>
<div class="item"><?php include('modules/gpio/html/gpio_status.php'); ?></div>
<div class="item"><?php include('modules/relays/html/relays_status.php'); ?></div>
Expand Down

0 comments on commit 469847a

Please sign in to comment.