当前位置: 首页>>代码示例>>PHP>>正文


PHP Feed::get_user_feeds方法代码示例

本文整理汇总了PHP中Feed::get_user_feeds方法的典型用法代码示例。如果您正苦于以下问题:PHP Feed::get_user_feeds方法的具体用法?PHP Feed::get_user_feeds怎么用?PHP Feed::get_user_feeds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Feed的用法示例。


在下文中一共展示了Feed::get_user_feeds方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: vis_controller

function vis_controller()
{
    global $mysqli, $redis, $session, $route, $user, $feed_settings;
    $result = false;
    require "Modules/feed/feed_model.php";
    $feed = new Feed($mysqli, $redis, $feed_settings);
    require "Modules/vis/multigraph_model.php";
    $multigraph = new Multigraph($mysqli);
    $visdir = "vis/visualisations/";
    require "Modules/vis/vis_object.php";
    $write_apikey = "";
    $read_apikey = "";
    if ($session['read']) {
        $read_apikey = $user->get_apikey_read($session['userid']);
    }
    if ($session['write']) {
        $write_apikey = $user->get_apikey_write($session['userid']);
    }
    if ($route->format == 'html') {
        if ($route->action == 'list' && $session['write']) {
            $multigraphs = $multigraph->getlist($session['userid']);
            $feedlist = $feed->get_user_feeds($session['userid']);
            $result = view("Modules/vis/Views/vis_main_view.php", array('user' => $user->get($session['userid']), 'feedlist' => $feedlist, 'apikey' => $read_apikey, 'visualisations' => $visualisations, 'multigraphs' => $multigraphs));
        } else {
            if ($route->action == "auto") {
                $feedid = intval(get('feedid'));
                $datatype = $feed->get_field($feedid, 'datatype');
                if ($datatype == 0) {
                    $result = "Feed type or authentication not valid";
                }
                if ($datatype == 1) {
                    $route->action = 'graph';
                }
                if ($datatype == 2) {
                    $route->action = 'bargraph';
                }
                if ($datatype == 3) {
                    $route->action = 'histgraph';
                }
            }
        }
        while ($vis = current($visualisations)) {
            $viskey = key($visualisations);
            // If the visualisation has a set property called action
            // then override the visualisation key and use the set action instead
            if (isset($vis['action'])) {
                $viskey = $vis['action'];
            }
            if ($route->action == $viskey) {
                $array = array();
                $array['valid'] = true;
                if (isset($vis['options'])) {
                    foreach ($vis['options'] as $option) {
                        $key = $option[0];
                        $type = $option[2];
                        if (isset($option[3])) {
                            $default = $option[3];
                        } else {
                            $default = "";
                        }
                        if ($type == 0 || $type == 1 || $type == 2 || $type == 3) {
                            $feedid = (int) get($key);
                            if ($feedid) {
                                $f = $feed->get($feedid);
                                $array[$key] = $feedid;
                                $array[$key . 'name'] = $f['name'];
                                if ($f['userid'] != $session['userid']) {
                                    $array['valid'] = false;
                                }
                                if ($f['public']) {
                                    $array['valid'] = true;
                                }
                            } else {
                                $array['valid'] = false;
                            }
                        } else {
                            if ($type == 4) {
                                // Boolean not used at the moment
                                if (get($key) == true || get($key) == false) {
                                    $array[$key] = get($key);
                                } else {
                                    $array[$key] = $default;
                                }
                            } else {
                                if ($type == 5) {
                                    $array[$key] = preg_replace('/[^\\p{L}_\\p{N}\\s£$€¥]/u', '', get($key)) ? get($key) : $default;
                                } else {
                                    if ($type == 6) {
                                        $array[$key] = str_replace(',', '.', floatval(get($key) ? get($key) : $default));
                                    } else {
                                        if ($type == 7) {
                                            $array[$key] = intval(get($key) ? get($key) : $default);
                                        } else {
                                            if ($type == 8) {
                                                $mid = (int) get($key);
                                                if ($mid) {
                                                    $f = $multigraph->get($mid, $session['userid']);
                                                    $array[$key] = intval($mid ? $mid : $default);
                                                    if (!isset($f['feedlist'])) {
                                                        $array['valid'] = false;
//.........这里部分代码省略.........
开发者ID:jpsingleton,项目名称:emoncms,代码行数:101,代码来源:vis_controller.php

示例2: feed_controller

function feed_controller()
{
    global $mysqli, $redis, $session, $route, $feed_settings;
    $result = false;
    require_once "Modules/feed/feed_model.php";
    $feed = new Feed($mysqli, $redis, $feed_settings);
    if ($route->format == 'html') {
        if ($route->action == "list" && $session['write']) {
            $result = view("Modules/feed/Views/feedlist_view.php", array());
        } else {
            if ($route->action == "api" && $session['write']) {
                $result = view("Modules/feed/Views/feedapi_view.php", array());
            }
        }
    } else {
        if ($route->format == 'json') {
            // Public actions available on public feeds.
            if ($route->action == "list") {
                if ($session['read']) {
                    if (!isset($_GET['userid']) || isset($_GET['userid']) && $_GET['userid'] == $session['userid']) {
                        $result = $feed->get_user_feeds($session['userid']);
                    } else {
                        if (isset($_GET['userid']) && $_GET['userid'] != $session['userid']) {
                            $result = $feed->get_user_public_feeds(get('userid'));
                        }
                    }
                } else {
                    if (isset($_GET['userid'])) {
                        $result = $feed->get_user_public_feeds(get('userid'));
                    }
                }
            } elseif ($route->action == "create" && $session['write']) {
                $result = $feed->create($session['userid'], get('tag'), get('name'), get('datatype'), get('engine'), json_decode(get('options')));
            } elseif ($route->action == "updatesize" && $session['write']) {
                $result = $feed->update_user_feeds_size($session['userid']);
            } elseif ($route->action == "buffersize" && $session['write']) {
                $result = $feed->get_buffer_size();
                // To "fetch" multiple feed values in a single request
                // http://emoncms.org/feed/fetch.json?ids=123,567,890
            } elseif ($route->action == "fetch" && $session['read']) {
                $feedids = (array) explode(",", get('ids'));
                for ($i = 0; $i < count($feedids); $i++) {
                    $feedid = (int) $feedids[$i];
                    if ($feed->exist($feedid)) {
                        // if the feed exists
                        $result[$i] = $feed->get_value($feedid);
                        // null is a valid response
                    } else {
                        $result[$i] = false;
                    }
                    // false means feed not found
                }
            } else {
                $feedid = (int) get('id');
                // Actions that operate on a single existing feed that all use the feedid to select:
                // First we load the meta data for the feed that we want
                if ($feed->exist($feedid)) {
                    $f = $feed->get($feedid);
                    // if public or belongs to user
                    if ($f['public'] || $session['userid'] > 0 && $f['userid'] == $session['userid'] && $session['read']) {
                        if ($route->action == "timevalue") {
                            $result = $feed->get_timevalue($feedid);
                        } else {
                            if ($route->action == 'data') {
                                $skipmissing = 1;
                                $limitinterval = 1;
                                if (isset($_GET['skipmissing']) && $_GET['skipmissing'] == 0) {
                                    $skipmissing = 0;
                                }
                                if (isset($_GET['limitinterval']) && $_GET['limitinterval'] == 0) {
                                    $limitinterval = 0;
                                }
                                $result = $feed->get_data($feedid, get('start'), get('end'), get('interval'), $skipmissing, $limitinterval);
                            } else {
                                if ($route->action == "value") {
                                    $result = $feed->get_value($feedid);
                                } else {
                                    if ($route->action == "get") {
                                        $result = $feed->get_field($feedid, get('field'));
                                    } else {
                                        if ($route->action == "aget") {
                                            $result = $feed->get($feedid);
                                        } else {
                                            if ($route->action == 'histogram') {
                                                $result = $feed->histogram_get_power_vs_kwh($feedid, get('start'), get('end'));
                                            } else {
                                                if ($route->action == 'kwhatpower') {
                                                    $result = $feed->histogram_get_kwhd_atpower($feedid, get('min'), get('max'));
                                                } else {
                                                    if ($route->action == 'kwhatpowers') {
                                                        $result = $feed->histogram_get_kwhd_atpowers($feedid, get('points'));
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
//.........这里部分代码省略.........
开发者ID:ashokbasnet,项目名称:emoncms,代码行数:101,代码来源:feed_controller.php

示例3: DateTimeZone

$usertimezone = $user->get_timezone($session['userid']);
$now = DateTime::createFromFormat("U", $time);
$now->setTimezone(new DateTimeZone($usertimezone));
$now->setTime(23, 59, 59);
// at 23:59:59
$now->modify("last day of previous month");
$end = $now->format("U");
$endText = $now->format("YmdHis");
// today
$now->setTime(0, 0);
// at 00:00
$now->modify("first day of this month");
$start = $now->format("U");
$startText = $now->format("YmdHis");
// Get user feeds
$userfeeds = $feed->get_user_feeds($session['userid']);
$groups = array();
foreach ($userfeeds as $f) {
    $groups[$f['tag']][] = $f['id'];
}
echo "Starting export job ({$startText}-{$endText}) interval {$outinterval} for user '{$userid}'.\n";
$log->info("Starting export job ({$startText}-{$endText}) interval {$outinterval} for user '{$userid}'.\n");
// Get feed ids grouped by tags
foreach ($groups as $tag => $ids) {
    echo "    Processing '{$tag}' tag with feeds: " . implode(",", $ids) . "\n";
    $log->info("    Processing '{$tag}' tag with feeds: " . implode(",", $ids) . "\n");
    // Write to output stream
    $filename = $exportpath . "/" . $startText . "_" . $endText . "_" . $tag . "_" . implode("_", $ids) . ".csv";
    $fh = @fopen($filename, 'w');
    if (!$fh) {
        echo "ERROR: Cant create file '{$filename}'.\n";
开发者ID:alexfowler,项目名称:emoncms,代码行数:31,代码来源:export_montly_cron.php

示例4: vis_controller

function vis_controller()
{
    global $mysqli, $redis, $session, $route, $user, $feed_settings;
    $result = false;
    require "Modules/feed/feed_model.php";
    $feed = new Feed($mysqli, $redis, $feed_settings);
    require "Modules/vis/multigraph_model.php";
    $multigraph = new Multigraph($mysqli);
    $visdir = "vis/visualisations/";
    require "Modules/vis/vis_object.php";
    $write_apikey = "";
    $read_apikey = "";
    if ($session['read']) {
        $read_apikey = $user->get_apikey_read($session['userid']);
    }
    if ($session['write']) {
        $write_apikey = $user->get_apikey_write($session['userid']);
    }
    if ($route->format == 'html') {
        if ($route->action == 'list' && $session['write']) {
            $multigraphs = $multigraph->getlist($session['userid']);
            $feedlist = $feed->get_user_feeds($session['userid']);
            $result = view("Modules/vis/vis_main_view.php", array('user' => $user->get($session['userid']), 'feedlist' => $feedlist, 'apikey' => $read_apikey, 'visualisations' => $visualisations, 'multigraphs' => $multigraphs));
        } else {
            // and is used primarily for quick checking feeds from the feeds page.
            if ($route->action == "auto") {
                $feedid = (int) get('feedid');
                $route->action = 'graph';
            }
            while ($vis = current($visualisations)) {
                $viskey = key($visualisations);
                // If the visualisation has a set property called action
                // then override the visualisation key and use the set action instead
                if (isset($vis['action'])) {
                    $viskey = $vis['action'];
                }
                if ($route->action == $viskey) {
                    $array = array();
                    $array['valid'] = true;
                    if (isset($vis['options'])) {
                        foreach ($vis['options'] as $option) {
                            $key = $option[0];
                            $type = $option[1];
                            if (isset($option[2])) {
                                $default = $option[2];
                            } else {
                                $default = "";
                            }
                            if ($type == 0 || $type == 1 || $type == 2 || $type == 3) {
                                $feedid = (int) get($key);
                                if ($feedid) {
                                    $f = $feed->get($feedid);
                                    $array[$key] = $feedid;
                                    $array[$key . 'name'] = $f['name'];
                                    if ($f['userid'] != $session['userid']) {
                                        $array['valid'] = false;
                                        $array['error'] = "You dont have the required permission to view this feed";
                                    }
                                    if ($f['public']) {
                                        $array['valid'] = true;
                                    }
                                } else {
                                    $array['valid'] = false;
                                    $array['error'] = "Please select a feed";
                                }
                            }
                            // Boolean not used at the moment
                            if ($type == 4) {
                                if (get($key) == true || get($key) == false) {
                                    $array[$key] = get($key);
                                } else {
                                    $array[$key] = $default;
                                }
                            }
                            if ($type == 5) {
                                $array[$key] = preg_replace('/[^\\w\\s£$€¥]/', '', get($key)) ? get($key) : $default;
                            }
                            if ($type == 6) {
                                $array[$key] = str_replace(',', '.', floatval(get($key) ? get($key) : $default));
                            }
                            if ($type == 7) {
                                $array[$key] = intval(get($key) ? get($key) : $default);
                            }
                            # we need to either urlescape the colour, or just scrub out invalid chars. I'm doing the second, since
                            # we can be fairly confident that colours are eiter a hex or a simple word (e.g. "blue" or such)
                            if ($key == "colour") {
                                $array[$key] = preg_replace('/[^\\dA-Za-z]/', '', $array[$key]);
                            }
                        }
                    }
                    $array['apikey'] = $read_apikey;
                    $array['write_apikey'] = $write_apikey;
                    $result = view("Modules/" . $visdir . $viskey . ".php", $array);
                    if ($array['valid'] == false) {
                        $result .= "<div style='position:absolute; top:0px; left:0px; background-color:rgba(240,240,240,0.5); width:100%; height:100%; text-align:center; padding-top:100px;'><h3>" . $array['error'] . "</h3></div>";
                    }
                }
                next($visualisations);
            }
        }
//.........这里部分代码省略.........
开发者ID:roy13,项目名称:EMON,代码行数:101,代码来源:vis_controller.php

示例5: feed_controller

function feed_controller()
{
    global $mysqli, $redis, $session, $route, $feed_settings;
    $result = false;
    include "Modules/feed/feed_model.php";
    $feed = new Feed($mysqli, $redis, $feed_settings);
    if ($route->format == 'html') {
        if ($route->action == "list" && $session['write']) {
            $result = view("Modules/feed/Views/feedlist_view.php", array());
        }
        if ($route->action == "api" && $session['write']) {
            $result = view("Modules/feed/Views/feedapi_view.php", array());
        }
    }
    if ($route->format == 'json') {
        // Public actions available on public feeds.
        if ($route->action == "list") {
            if (!isset($_GET['userid']) && $session['read']) {
                $result = $feed->get_user_feeds($session['userid']);
            }
            if (isset($_GET['userid']) && $session['read'] && $_GET['userid'] == $session['userid']) {
                $result = $feed->get_user_feeds($session['userid']);
            }
            if (isset($_GET['userid']) && $session['read'] && $_GET['userid'] != $session['userid']) {
                $result = $feed->get_user_public_feeds(get('userid'));
            }
            if (isset($_GET['userid']) && !$session['read']) {
                $result = $feed->get_user_public_feeds(get('userid'));
            }
        } elseif ($route->action == "getid" && $session['read']) {
            $result = $feed->get_id($session['userid'], get('name'));
        } elseif ($route->action == "create" && $session['write']) {
            $result = $feed->create($session['userid'], get('name'), get('datatype'), get('engine'), json_decode(get('options')));
        } elseif ($route->action == "updatesize" && $session['write']) {
            $result = $feed->update_user_feeds_size($session['userid']);
            // To "fetch" multiple feed values in a single request
            // http://emoncms.org/feed/fetch.json?ids=123,567,890
        } elseif ($route->action == "fetch" && $session['read']) {
            $feedids = (array) explode(",", get('ids'));
            for ($i = 0; $i < count($feedids); $i++) {
                $feedid = (int) $feedids[$i];
                if ($feed->exist($feedid)) {
                    $result[$i] = (double) $feed->get_value($feedid);
                } else {
                    $result[$i] = "";
                }
            }
        } else {
            $feedid = (int) get('id');
            // Actions that operate on a single existing feed that all use the feedid to select:
            // First we load the meta data for the feed that we want
            if ($feed->exist($feedid)) {
                $f = $feed->get($feedid);
                // if public or belongs to user
                if ($f['public'] || $session['userid'] > 0 && $f['userid'] == $session['userid'] && $session['read']) {
                    if ($route->action == "value") {
                        $result = $feed->get_value($feedid);
                    }
                    if ($route->action == "timevalue") {
                        $result = $feed->get_timevalue_seconds($feedid);
                    }
                    if ($route->action == "get") {
                        $result = $feed->get_field($feedid, get('field'));
                    }
                    // '/[^\w\s-]/'
                    if ($route->action == "aget") {
                        $result = $feed->get($feedid);
                    }
                    if ($route->action == 'histogram') {
                        $result = $feed->histogram_get_power_vs_kwh($feedid, get('start'), get('end'));
                    }
                    if ($route->action == 'kwhatpower') {
                        $result = $feed->histogram_get_kwhd_atpower($feedid, get('min'), get('max'));
                    }
                    if ($route->action == 'kwhatpowers') {
                        $result = $feed->histogram_get_kwhd_atpowers($feedid, get('points'));
                    }
                    if ($route->action == 'data') {
                        $result = $feed->get_data($feedid, get('start'), get('end'), get('dp'));
                    }
                    if ($route->action == 'average') {
                        $result = $feed->get_average($feedid, get('start'), get('end'), get('interval'));
                    }
                    if ($route->action == 'history') {
                        $result = $feed->get_history($feedid, get('start'), get('end'), get('interval'));
                    }
                }
                // write session required
                if (isset($session['write']) && $session['write'] && $session['userid'] > 0 && $f['userid'] == $session['userid']) {
                    // Storage engine agnostic
                    if ($route->action == 'set') {
                        $result = $feed->set_feed_fields($feedid, get('fields'));
                    }
                    if ($route->action == "insert") {
                        $result = $feed->insert_data($feedid, time(), get("time"), get("value"));
                    }
                    if ($route->action == "update") {
                        $result = $feed->update_data($feedid, time(), get("time"), get('value'));
                    }
                    if ($route->action == "delete") {
//.........这里部分代码省略.........
开发者ID:barriquello,项目名称:simon,代码行数:101,代码来源:feed_controller.php

示例6: vis_controller

function vis_controller()
{
    global $mysqli, $redis, $session, $route, $user, $settings;
    $result = false;
    require "Modules/feed/feed_model.php";
    $feed = new Feed($mysqli, $redis, $settings);
    require "Modules/vis/multigraph_model.php";
    $multigraph = new Multigraph($mysqli);
    $visdir = "vis/visualisations/";
    /*
      1 - realtime
      2 - daily
      3 - histogram
      4 - boolean (not used uncomment line 122)
      5 - text
      6 - float value
      7 - int value
    */
    $visualisations = array('realtime' => array('options' => array(array('feedid', 1))), 'rawdata' => array('options' => array(array('feedid', 1), array('fill', 7, 0), array('units', 5, 'W'), array('colour', 5, 'EDC240'))), 'bargraph' => array('options' => array(array('feedid', 2), array('colour', 5, 'EDC240'))), 'timestoredaily' => array('options' => array(array('feedid', 1), array('units', 5, 'kWh'))), 'smoothie' => array('options' => array(array('feedid', 1), array('ufac', 6))), 'histgraph' => array('options' => array(array('feedid', 3), array('barwidth', 7, 50), array('start', 7, 0), array('end', 7, 0))), 'zoom' => array('options' => array(array('power', 1), array('kwhd', 2), array('currency', 5, '&pound;'), array('currency_after_val', 7, 0), array('pricekwh', 6, 0.14))), 'stacked' => array('options' => array(array('bottom', 2), array('top', 2))), 'stackedsolar' => array('options' => array(array('solar', 2), array('consumption', 2))), 'threshold' => array('options' => array(array('feedid', 3), array('thresholdA', 6, 500), array('thresholdB', 6, 2500))), 'simplezoom' => array('options' => array(array('power', 1), array('kwhd', 2))), 'orderbars' => array('options' => array(array('feedid', 2))), 'orderthreshold' => array('options' => array(array('feedid', 3), array('power', 1), array('thresholdA', 6, 500), array('thresholdB', 6, 2500))), 'editrealtime' => array('options' => array(array('feedid', 1))), 'editdaily' => array('options' => array(array('feedid', 2))), 'multigraph' => array('action' => 'multigraph', 'options' => array(array('mid', 7))), 'compare' => array('action' => 'compare', 'options' => array(array('powerx', 1), array('powery', 1))));
    $write_apikey = "";
    $read_apikey = "";
    if ($session['read']) {
        $read_apikey = $user->get_apikey_read($session['userid']);
    }
    if ($session['write']) {
        $write_apikey = $user->get_apikey_write($session['userid']);
    }
    if ($route->format == 'html') {
        if ($route->action == 'list' && $session['write']) {
            $multigraphs = $multigraph->getlist($session['userid']);
            $feedlist = $feed->get_user_feeds($session['userid']);
            $result = view("Modules/vis/vis_main_view.php", array('user' => $user->get($session['userid']), 'feedlist' => $feedlist, 'apikey' => $read_apikey, 'visualisations' => $visualisations, 'multigraphs' => $multigraphs));
        }
        // Auto - automatically selects visualisation based on datatype
        // and is used primarily for quick checking feeds from the feeds page.
        if ($route->action == "auto") {
            $feedid = intval(get('feedid'));
            $datatype = $feed->get_field($feedid, 'datatype');
            if ($datatype == 0) {
                $result = "Feed type or authentication not valid";
            }
            if ($datatype == 1) {
                $route->action = 'rawdata';
            }
            if ($datatype == 2) {
                $route->action = 'bargraph';
            }
            if ($datatype == 3) {
                $route->action = 'histgraph';
            }
        }
        while ($vis = current($visualisations)) {
            $viskey = key($visualisations);
            // If the visualisation has a set property called action
            // then override the visualisation key and use the set action instead
            if (isset($vis['action'])) {
                $viskey = $vis['action'];
            }
            if ($route->action == $viskey) {
                $array = array();
                $array['valid'] = true;
                if (isset($vis['options'])) {
                    foreach ($vis['options'] as $option) {
                        $key = $option[0];
                        $type = $option[1];
                        if (isset($option[2])) {
                            $default = $option[2];
                        } else {
                            $default = "";
                        }
                        if ($type == 1 || $type == 2 || $type == 3) {
                            $feedid = (int) get($key);
                            if ($feedid) {
                                $f = $feed->get($feedid);
                                $array[$key] = $feedid;
                                $array[$key . 'name'] = $f['name'];
                                if ($f['userid'] != $session['userid'] || $f['datatype'] != $type) {
                                    $array['valid'] = false;
                                }
                                if ($f['public'] && $f['datatype'] == $type) {
                                    $array['valid'] = true;
                                }
                            } else {
                                $array['valid'] = false;
                            }
                        }
                        // Boolean not used at the moment
                        if ($type == 4) {
                            if (get($key) == true || get($key) == false) {
                                $array[$key] = get($key);
                            } else {
                                $array[$key] = $default;
                            }
                        }
                        if ($type == 5) {
                            $array[$key] = preg_replace('/[^\\w\\s£$€¥]/', '', get($key)) ? get($key) : $default;
                        }
                        if ($type == 6) {
                            $array[$key] = str_replace(',', '.', floatval(get($key) ? get($key) : $default));
                        }
//.........这里部分代码省略.........
开发者ID:kenpi2b,项目名称:pkg-emoncms,代码行数:101,代码来源:vis_controller.php

示例7: event_controller

function event_controller()
{
    global $mysqli, $redis, $user, $session, $route, $timestore_adminkey;
    global $feed;
    include "Modules/feed/feed_model.php";
    $feed = new Feed($mysqli, $redis, $timestore_adminkey);
    require "Modules/event/event_model.php";
    $event = new Event($mysqli, $redis);
    $userid = $session['userid'];
    if ($route->action == 'add' && $session['write']) {
        $eventfeed = intval(get('eventfeed'));
        $eventtype = intval(get('eventtype'));
        $eventvalue = floatval(get('eventvalue'));
        $action = intval(get('action'));
        $setfeed = intval(get('setfeed'));
        $setemail = get('setemail');
        $setvalue = floatval(get('setvalue'));
        $callcurl = get('callcurl');
        $mutetime = get('mutetime');
        $priority = get('priority');
        $message = get('message');
        $mqtttopic = get('mqtttopic');
        $mqttqos = get('mqttqos');
        $event->add($userid, $eventfeed, $eventtype, $eventvalue, $action, $setfeed, $setemail, $setvalue, $callcurl, $message, $mutetime, $priority, $mqtttopic, $mqttqos);
        $result = "Event added";
    }
    if ($route->action == 'edit' && $session['write']) {
        $eventid = intval(get('eventid'));
        $eventfeed = intval(get('eventfeed'));
        $eventtype = intval(get('eventtype'));
        $eventvalue = floatval(get('eventvalue'));
        $action = intval(get('action'));
        $setfeed = intval(get('setfeed'));
        $setemail = get('setemail');
        $setvalue = floatval(get('setvalue'));
        $callcurl = get('callcurl');
        $mutetime = get('mutetime');
        $priority = get('priority');
        $message = get('message');
        $mqtttopic = get('mqtttopic');
        $mqttqos = get('mqttqos');
        $event->update($userid, $eventid, $eventfeed, $eventtype, $eventvalue, $action, $setfeed, $setemail, $setvalue, $callcurl, $message, $mutetime, $priority, $mqtttopic, $mqttqos);
        $result = "Event updated";
    } else {
        if ($route->action == 'delete' && $session['write']) {
            $id = intval(get('id'));
            $event->delete($userid, $id);
            $result = "Event deleted";
        } else {
            if ($route->action == 'status' && $session['write']) {
                $id = intval(get('id'));
                $status = intval(get('status'));
                $event->set_status($userid, $id, $status);
                $result = "Event deleted";
            } else {
                if ($route->action == 'test' && $session['write']) {
                    $id = intval(get('id'));
                    $feedid = intval(get('feedid'));
                    $event->test($userid, $id, $feedid);
                    $result = "Event Test Sent";
                } else {
                    if ($route->action == 'settings' && $session['write']) {
                        $settings = $event->get_settings($session['userid']);
                        $result = view("Modules/event/event_settings_view.php", array('settings' => $settings));
                    } else {
                        if ($route->action == 'savesettings' && $session['write']) {
                            // Store userlang in database
                            $prowlkey = post('prowlkey');
                            $nmakey = post('nmakey');
                            $smtpserver = post('smtpserver');
                            $smtpuser = post('smtpuser');
                            $salt = $user->get_salt($session['userid']);
                            $smtppassword = trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $salt, post('smtppassword'), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
                            $smtpport = preg_replace('/[^\\w\\s-]/', '', post('smtpport'));
                            $consumerkey = post('consumerkey');
                            $consumersecret = post('consumersecret');
                            $usertoken = post('usertoken');
                            $usersecret = post('usersecret');
                            $mqttbrokerip = post('mqttbrokerip');
                            $mqttbrokerport = post('mqttbrokerport');
                            $mqttusername = post('mqttusername');
                            $mqttpassword = trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $salt, post('mqttpassword'), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
                            $result = $event->set_settings($session['userid'], $prowlkey, $consumerkey, $consumersecret, $usertoken, $usersecret, $smtpserver, $smtpuser, $smtppassword, $smtpport, $nmakey, $mqttbrokerip, $mqttbrokerport, $mqttusername, $mqttpassword);
                        } else {
                            if ($session['write']) {
                                $list = $event->eventlist($userid);
                                $feeds = $feed->get_user_feeds($userid);
                                $result = view("Modules/event/event_list.php", array('event_list' => $list, 'feeds' => $feeds));
                            }
                        }
                    }
                }
            }
        }
    }
    return array('content' => $result);
}
开发者ID:euridium,项目名称:event,代码行数:97,代码来源:event_controller.php


注:本文中的Feed::get_user_feeds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。