예제 #1
0
<?php

session_start();
if (!isset($_SESSION['RPirrigate_UserID']) && trim($_SERVER['REMOTE_ADDR']) != '127.0.0.1') {
    header('location: index.php?login');
    die;
}
if (!isset($_GET['id'])) {
    die;
}
include 'config/config.php';
$db = new DB_CONN();
$location = $db->select1_setting('Location');
$userID = $_SESSION['RPirrigate_UserID'];
$lang = $db->select1_setting('Language');
include 'languages/' . $lang . '/' . $lang . '.php';
$currModuleID = $_GET['id'];
//If module doesn't exist, go to Home
if (!$db->select1_module_exists($currModuleID)) {
    header('location: home.php');
    die;
}
$bannerMessage = "";
if (isset($_POST['Description'])) {
    $db->query_module_description_update($currModuleID, nl2br($_POST['Description']));
    $bannerMessage = LANG_module_BANNER_DESCRIPTION;
}
if (isset($_POST['ManualSave']) && $_POST['ManualSave'] == 'true') {
    $val = isset($_POST['ManualVAL']);
    $act = isset($_POST['ManualACT']);
    $db->query_module_manual_update($currModuleID, $act, $val);
예제 #2
0
<?php

session_start();
if (!isset($_SESSION['RPirrigate_UserID']) && trim($_SERVER['REMOTE_ADDR']) != '127.0.0.1') {
    header('location: index.php?login');
    die;
}
include 'config/config.php';
$db = new DB_CONN();
$userID = $_SESSION['RPirrigate_UserID'];
$lang = $db->select1_setting('Language');
include 'languages/' . $lang . '/' . $lang . '.php';
$bannerMessage = "";
if (isset($_POST['name']) && isset($_POST['description']) && isset($_POST['gpio']) && isset($_POST['throughtput'])) {
    $db->query_module_add($_POST['name'], $_POST['description'], $_POST['gpio'], $_POST['throughtput'], $_FILES['image']);
    $bannerMessage = LANG_modulenew_BANNER;
    //*** ALSO SEND SIGUSR1 TO THE DAEMON TO MAKE IT RELOAD SETTINGS!!
    $pid = $db->select1_daemon_pid();
    //Newer php version use SIG_NAME, newer SIGNAME
    if (defined('SIG_USR1')) {
        posix_kill($pid, SIG_USR1);
    } else {
        posix_kill($pid, SIGUSR1);
    }
    sleep(1);
    //let daemon reload and log
}
?>
<!DOCTYPE html>
<html>
  <head>
예제 #3
0
파일: index.php 프로젝트: scossa/RPirrigate
<?php

include 'config/config.php';
$db = new DB_CONN();
$lang = $db->select1_setting('Language');
include 'languages/' . $lang . '/' . $lang . '.php';
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>RPirrigate</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <link rel="stylesheet" href="misc/bootstrap.css" media="screen">
    <link rel="stylesheet" href="misc/bootswatch.min.css">
  </head>
  <body style="padding-top:0">

    <div class="container">


      <!-- Forms
      ================================================== -->
        <div class="row">
          <div class="col-lg-12">
            <div class="page-header"  style="text-align:center">
              <img src="misc/logo_200.png" />
            </div>
          </div>
        </div>
예제 #4
0
파일: login.php 프로젝트: scossa/RPirrigate
<?php

include 'config/config.php';
$db = new DB_CONN();
$user = $_POST['username'];
$pass = $_POST['password'];
$logged = $db->login($user, $pass);
if ($logged > 0) {
    session_start();
    $_SESSION['RPirrigate_UserID'] = $logged['UserID'];
    header('location: home.php');
    die;
} else {
    header('location: index.php?wrong');
    die;
}
예제 #5
0
<?php

session_start();
if (!isset($_SESSION['RPirrigate_UserID']) && trim($_SERVER['REMOTE_ADDR']) != '127.0.0.1') {
    header('location: index.php?login');
    die;
}
include 'config/config.php';
$db = new DB_CONN();
$lang = $db->select1_setting('Language');
$location = $db->select1_setting('Location');
$userID = $_SESSION['RPirrigate_UserID'];
$hashPWD = $db->select1_hash_password($userID);
$weather = $db->select1_setting("WeatherEnabled") == "1";
$bannerMessage = "";
//check that new language!=current language also
if (isset($_POST['ChangeLanguage']) && $_POST['ChangeLanguage'] != $lang) {
    $lang = $_POST['ChangeLanguage'];
    $db->set_setting('Language', $lang);
    $bannerMessage = "languagedone";
}
//include the file only afther eventual language change
include 'languages/' . $lang . '/' . $lang . '.php';
//workaround... because I didn't have the constants when changing language
if ($bannerMessage == "languagedone") {
    $bannerMessage = LANG_settings_BANNER_LANGUAGE;
}
if (isset($_POST['ChangeLocation']) && $_POST['ChangeLocation'] != $location) {
    $location = $_POST['ChangeLocation'];
    $db->set_setting('Location', $location);
    $bannerMessage = LANG_settings_BANNER_LOCATION;
예제 #6
0
파일: home.php 프로젝트: scossa/RPirrigate
<?php

session_start();
if (!isset($_SESSION['RPirrigate_UserID']) && trim($_SERVER['REMOTE_ADDR']) != '127.0.0.1') {
    header('location: index.php?login');
    die;
}
include 'config/config.php';
$db = new DB_CONN();
$lang = $db->select1_setting('Language');
$location = $db->select1_setting('Location');
$userID = $_SESSION['RPirrigate_UserID'];
include 'languages/' . $lang . '/' . $lang . '.php';
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>RPirrigate</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <link rel="stylesheet" href="misc/bootstrap.css" media="screen">
    <link rel="stylesheet" href="misc/bootswatch.min.css">
    <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
    <script src="//code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
    <?php 
if ($location != "") {
    ?>
      <script type="text/javascript">
        var loc = "<?php 
    echo $location;