Example #1
0
// start/stop controls for heyu
if (isset($_GET["daemon"]) && $authCheck->getUser()->getSecurityLevel() <= 2) {
    try {
        heyu_ctrl($config, $_GET["daemon"]);
    } catch (Exception $e) {
        gen_error("heyu " . $_GET["daemon"], $e->getMessage());
        exit;
    }
}
// get which page is open
$page = isset($_GET['page']) ? $_GET['page'] : "domus_home_page";
// set page title
$tpl->set('title', ucwords($page));
$tpl->set('page', $page);
// check if heyu is running, if true display modules
if (heyu_running()) {
    $dirname = dirname(__FILE__);
    require_once $dirname . DIRECTORY_SEPARATOR . 'include_globals.php';
    ## Load mod group types
    if ($config['themeview'] == 'typed') {
        $modgrouptypes =& $_SESSION['frontObj']->getTypedGroups()->getVisibleGroups();
    } else {
        $modgrouptypes =& $_SESSION['frontObj']->getGroups()->getVisibleGroups();
    }
    $tpl->set('groups', $modgrouptypes);
    if (!isset($_SESSION['configChecked']) || !$_SESSION['configChecked']) {
        header("Location: utility/setupverify.php?from=index");
        exit;
    }
    require_once CLASS_FILE_LOCATION . 'location.class.php';
    $locations = new location($heyuconf);
Example #2
0
/**
 * Heyu Control
 *
 * @param $action to undertake (start, stop, reload)
 */
function heyu_ctrl($config, $action)
{
    switch ($action) {
        case "start":
            $rs = execute_cmd("ps ax");
            if (count(preg_grep('/[h]eyu_relay/', $rs)) != 1) {
                execute_cmd($config['heyuexecreal'] . " start");
                sleep(2);
            }
            $rs = execute_cmd("ps ax");
            if (count(preg_grep('/[h]eyu_engine/', $rs)) != 1) {
                execute_cmd($config['heyuexecreal'] . " engine");
            }
            break;
        case "stop":
            if (heyu_running()) {
                execute_cmd($config['heyuexecreal'] . " stop");
            }
            break;
        case "restart":
            if (heyu_running()) {
                execute_cmd($config['heyuexecreal'] . " restart");
            }
            break;
    }
}
Example #3
0
 /**
  * run a scene
  * @url POST /runscene/$label
  */
 public function runScene($label)
 {
     ## error_log("Enter turnOn for - ".$label);
     require_once '.' . DIRECTORY_SEPARATOR . 'apiinclude.php';
     require_once '.' . DIRECTORY_SEPARATOR . 'include_globals.php';
     $config = $_SESSION['frontObj']->getConfig();
     if (!heyu_running()) {
         return array("status" => "heyu not running");
     }
     if ($label) {
         $aScene = $heyuconf->getSceneForLabel($this->myLogin->getUser(), $label, false);
         if ($aScene) {
             try {
                 heyu_action($config, "run", $aScene->getLabel());
             } catch (Exception $e) {
                 // noop
             }
             return array("status" => "done");
         } else {
             error_log("runScene no scene found " . $label);
         }
     }
     return array("status" => "not done");
 }