Example #1
0
 protected function _setPostVars($post, $trim = true, $merge = false)
 {
     if (!$merge || $merge && empty($this->postVars)) {
         $this->postVars = $trim === true ? Funclib::trimValues($post) : $post;
     } else {
         if ($merge && !empty($this->postVars)) {
             $this->postVars = array_merge($this->postVars, $trim === true ? Funclib::trimValues($post) : $post);
         }
     }
 }
Example #2
0
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* @author Ronny Bansemer
*/
session_start();
if (!empty($_SESSION['unternehmenid'])) {
    require '../include/constants.php';
    require INCLUDE_PATH . '/class/roh/mailer.php';
    require INCLUDE_PATH . '/class/funclib.php';
    require INCLUDE_PATH . '/class/email.php';
    require INCLUDE_PATH . '/class/querybuild.php';
    require INCLUDE_PATH . '/class/database.php';
    require INCLUDE_PATH . '/class/charhandling.php';
    DB::init(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE);
    $url = Funclib::trimValues($_GET);
    if (!empty($url['id'])) {
        $filename = 'all-statusmessages-from-sensor';
        $typ = 1;
        DB::query('SELECT
                        `sensorid`
                    FROM
                        `sensoren`
                    WHERE
                        `unternehmenid` = ?
                    AND
                        `sensorid` = ?', 2);
        DB::setParam($_SESSION['unternehmenid'], 'int');
        DB::setParam($url['id'], 'str');
        DB::exec();
    } else {
Example #3
0
print $sensor['name'];
?>
      <br />
      <label>device description:</label>
      <?php 
print $sensor['beschreibung'];
?>
      <br />
      <label>connect interval:</label>
       <?php 
print Funclib::secondsToPeriods($sensor['intervall']);
?>
       <br />
      <label>device data max age:</label>
       <?php 
print Funclib::secondsToPeriods($sensor['maxage']);
?>
      <div class="var">
         <table cellpadding="0">
            <colgroup>
               <col width="120"/>
               <col width="110"/>
               <col width="300"/>
            </colgroup>
            <thead>
               <tr>
                  <th>name of variable</th>
                  <th>type of value</th>
                  <th>variable description</th>
               </tr>
            </thead>
Example #4
0
                     `d1`.`nummerid` = ?
                 AND
                     `d2`.`unternehmenid` = ?', 2);
     DB::setParam($this->_post('id'), 'int');
     DB::setParam($_SESSION['unternehmenid'], 'int');
     DB::exec();
     if (DB::numRows() == 0) {
         $this->_jsonOutput(2, 'the sms account does not exist');
     }
     $allowonid = $this->_post('id');
 case 'create_sms':
     if ($this->_post('name') && strlen($this->_post('name')) > 0) {
         if ($this->_post('aktion') == 'create_sms') {
             $allowonid = '';
         }
         if (Funclib::checkAccountName($this->_post('name'), 2, $allowonid)) {
             if (is_numeric($this->_post('number'))) {
                 DB::query('SELECT
                              `gatewayid`
                          FROM
                              `sms_gateways`
                          WHERE
                              `gatewayid` = ?
                          AND
                              `unternehmenid` = ?', 2);
                 DB::setParam($this->_post('gatewayid'), 'int');
                 DB::setParam($_SESSION['unternehmenid'], 'int');
                 DB::exec();
                 if (DB::numRows() == 1) {
                     if ($this->_post('aktion') == 'create_sms') {
                         DB::query('INSERT INTO `sms`
Example #5
0
                     `connector`)
                VALUES
                    (?, ?, ?, ?, ?)', 5);
     DB::setParam($id, 'int');
     DB::setParam($options['variableids'][$k], 'int');
     DB::setParam($options['operatoren'][$k], 'int');
     DB::setParam($options['werte'][$k], 'str');
     DB::setParam(is_numeric($this->postVars['connectors'][$k]) ? $this->postVars['connectors'][$k] : '-1', 'str');
     DB::exec();
     $settings .= '#' . $variables[$options['variableids'][$k]] . ' ' . $operators[$options['operatoren'][$k]] . ' ' . $options['werte'][$k] . ' ' . (is_numeric($this->postVars['connectors'][$k]) ? $connectors[$this->postVars['connectors'][$k]] : '') . ' ';
 }
 if ($this->postVars['microblogCondition'] == 1 && count($microblogCondition) > 0) {
     require INCLUDE_PATH . '/class/oauth.php';
     require INCLUDE_PATH . '/class/streamoauth.php';
     foreach ($microblogCondition as $k => $v) {
         Funclib::sendStreamMessage($data[1][$v]['baseurl'], $data[1][$v]['name'], $data[1][$v]['authurl'], $data[1][$v]['requesturl'], $data[1][$v]['accessurl'], $data[1][$v]['costumerkey'], $data[1][$v]['costumersecret'], $data[1][$v]['oauth_token'], $data[1][$v]['oauth_token_secret'], $data[1][$v]['maxlength'], $_SESSION['unternehmenid'], $settings);
     }
 }
 foreach ($this->postVars['messages'] as $k => $v) {
     DB::query('INSERT INTO `condition_texts`
                    (`conditionid`,
                     `text`)
                VALUES
                    (?, ?)', 2);
     DB::setParam($id, 'int');
     DB::setParam($v[0], 'str');
     $id2 = DB::exec(true);
     foreach ($v[1] as $k2 => $v2) {
         DB::query('INSERT INTO `condition_texts_accounts`
                       (`textid`,
                        `accountid`,
Example #6
0
                                $accid =& $v['text'][$i]['accountids'][$j];
                                $acc =& $accounts[$type][$accid];
                                $accName[] = $acc['name'];
                                switch ($type) {
                                    case 0:
                                        Funclib::sendAlarmMail($acc['email'], $acc['name'], $data['unternehmenid'], $m);
                                        break;
                                    case 1:
                                        Funclib::sendStreamMessage($acc['apibase'], $acc['name'], $acc['authurl'], $acc['requesturl'], $acc['accessurl'], $acc['costumerkey'], $acc['costumersecret'], $acc['oauth_token'], $acc['oauth_token_secret'], $acc['maxlength'], $data['unternehmenid'], $m);
                                        break;
                                    case 2:
                                        Funclib::sendSMS($acc['url'], $acc['nummer'], $acc['name'], $acc['gatewayname'], $acc['maxlength'], $data['unternehmenid'], $m);
                                        break;
                                }
                            }
                            Funclib::messageLog($data['unternehmenid'], $m, implode(', ', $accName));
                        }
                        if ($v['dolock']) {
                            Funclib::lockCondition($data['unternehmenid'], $k);
                            Funclib::insertError($data['unternehmenid'], $signatur, 'now publish condition "' . $v['name'] . '" is locked. Please delete this message to unlock this condition.', 0, $k);
                        }
                    } else {
                        Funclib::insertError($data['unternehmenid'], $signatur, 'couldn\'t execute publish condition "' . $v['name'] . '". Reason: condition is locked', 1);
                    }
                }
            } else {
                Funclib::insertError($data['unternehmenid'], $signatur, 'couldn\'t execute publish condition "' . $v['name'] . '". Reason: not all required variables are set', 1);
            }
        }
    }
}
Example #7
0
    }
    $sw->reset();
    $c = $sw->ge - $sw->a_s * $sw->e_p_s;
    $search = array('#' . date('d.m.Y') . '#', '#' . date('d.m.Y', time() - 86400) . '#');
    $replace = array('Today', 'Yesterday');
    while (DB::nextResult()) {
        ?>
   <p class="listing">
      <span><?php 
        print '#' . $c . ' [' . preg_replace($search, $replace, DB::result('zeit')) . ']';
        ?>
 via <?php 
        print DB::result('accounts');
        ?>
</span>
      <?php 
        print Funclib::keywordUrl($keywords, DB::result('text'));
        ?>
   </p>
<?php 
        $c--;
    }
    if ($sw->gs > 1) {
        print '<p class="seitenwechsel"><strong>page:</strong> ' . $sw->siteChange() . '</p>';
    }
} else {
    print '<p class="nonexist">there are still no messages available</p>';
}
?>
</div>
Example #8
0
switch ($this->_post('aktion')) {
    case 'delete_fehler':
        DB::query('SELECT
                        `conditionid`
                    FROM
                        `fehler_log`
                    WHERE
                        `logid` = ?
                    AND
                        `unternehmenid` = ?', 2);
        DB::setParam($this->_post('logid'), 'int');
        DB::setParam($_SESSION['unternehmenid'], 'int');
        DB::exec();
        if (DB::numRows() == 1) {
            DB::nextResult();
            Funclib::lockCondition($_SESSION['unternehmenid'], DB::result('conditionid'), true);
            DB::query('DELETE FROM
                           `fehler_log`
                       WHERE
                           `logid` = ?', 1);
            DB::setParam($this->_post('logid'), 'int');
            DB::exec();
        } else {
            $this->_jsonOutput(2, 'the chosen error message does not exist');
        }
        break;
    case 'delete_event':
        DB::query('SELECT
                        `logid`
                    FROM
                        `events_log`
Example #9
0
<?php

/*
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* @author Ronny Bansemer
*/
if (!$this->_getContentParam('logout')) {
    if ($this->_postExists()) {
        switch ($this->_post('aktion')) {
            case 'login':
                $login = Funclib::checkLogin($this->_post('unternehmen'), $this->_post('passwort'));
                switch ($login) {
                    case -1:
                        $this->_setMessage(array(0, 'you have set a wrong password/username'));
                        break;
                    case 0:
                        $this->_setMessage(array(0, 'you have set a wrong password/username'));
                        break;
                    default:
                        $_SESSION['UISauthLevel'] = 0;
                        $_SESSION['unternehmenid'] = $login;
                        $this->_reload();
                }
                break;
        }
    }
} else {
    session_destroy();
    $this->_reload('/start');
Example #10
0
}
?>
<div class="pvorlage1" style="position: relative;">
   <span class="pheading">Message log (last 20 messages)</span>
<?php 
DB::moveBufferToCurrentResult('messages');
if (DB::numRows() > 0) {
    $search = array('#' . date('d.m.Y') . '#', '#' . date('d.m.Y', time() - 86400) . '#');
    $replace = array('Today', 'Yesterday');
    while (DB::nextResult()) {
        ?>
   <p class="listing">
      <span><?php 
        print '[' . preg_replace($search, $replace, DB::result('zeit')) . ']';
        ?>
 via <?php 
        print DB::result('accounts');
        ?>
</span>
      <?php 
        print Funclib::keywordUrl(array(), DB::result('text'));
        ?>
   </p>
<?php 
    }
} else {
    print '<p class="nonexist">there are still no messages available</p>';
}
?>
</div>