Esempio n. 1
0
 function edit($ctx)
 {
     _render('form');
     try {
         $channel_id = (string) $_GET['id'] !== '' ? intval($_GET['id']) : '';
         $m = Channel::get($channel_id);
         if (!$m) {
             _redirect($this->_list_url());
             return;
         }
         $wx_info = WxChannelInfo::get($channel_id);
         if ($_POST) {
             $f = $_POST['f'];
             // 生成二维码 每次保存都更新一次 但是如果已经发放了 其实不能更新的 因为会过期 所以,永久的不能更新 临时的更新可以处理
             $expire_type = intval($f['expire_type']);
             $expire_seconds = intval($f['expire_seconds']);
             $expire_seconds = max(0, $expire_seconds);
             $status = intval($f['status']);
             $wx_info = WxChannelInfo::qrcode_create($channel_id, $expire_type, $expire_seconds, $status);
             _redirect($this->_list_url());
         }
         $ctx->wx_info = $wx_info;
         $ctx->m = $m;
     } catch (Exception $e) {
         $msg = $e->getMessage();
         $ctx->errmsg = $msg;
         $ctx->m = $m;
         $ctx->wx_info = $wx_info;
     }
 }
Esempio n. 2
0
File: api.php Progetto: ha1t/epgrec
    public function channelInfo()
    {
        if (isset($_GET['channel_disc'])) {
            try {
                $channel = Channel::get($_GET['channel_disc']);
                $view = <<<EOD
<div class="prg_rec_cfg ui-corner-all">
<div class="prg_title">{$channel->name}</div>

<table>
<tr>
  <td>種別</td><td>{$channel->type}</td>
</tr>
<tr>
  <td>物理チャンネル</td><td>{$channel->channel}</td>
</tr>
<tr>
  <td>サービスID</td>
  <td>
<form method="post" action="channelSetSID.php">
<input type="text" name="n_sid" size="20" id="id_sid" value="{$channel->sid}" />
<input type="hidden" name="n_channel_disc" id="id_disc" value="{$channel->channel_disc}" />
</form>
  </td>
</tr>
</table>
</div>
EOD;
                echo $view;
            } catch (Exception $e) {
                echo 'Error:チャンネル情報の取得に失敗';
            }
        }
    }
Esempio n. 3
0
 static function check_channel_subscribe_keyword($keyword)
 {
     $channel_info = null;
     $channel_pattern = '#' . self::CHANNEL_SUBSCRIBE_PREFIE . '([a-zA-Z0-9]+)#';
     if (preg_match($channel_pattern, $keyword, $arr)) {
         if (isset($arr[1])) {
             $channel_id = $arr[1];
             // 先尝试根据pcode取
             $channel_info = Channel::get_by_code($channel_id);
             if (!$channel_info) {
                 $channel_info = Channel::get($channel_id);
             }
         }
     }
     return $channel_info;
 }
Esempio n. 4
0
 function get()
 {
     $profile_uid = intval($_GET['p']);
     $load = argc() > 1 && argv(1) == 'load' ? 1 : 0;
     header("Content-type: text/html");
     echo "<!DOCTYPE html><html><body>\r\n";
     /**
      * We can remove this hack once Internet Explorer recognises HTML5 natively
      */
     echo $_GET['msie'] == 1 ? '<div>' : '<section>';
     /**
      *
      * Grab the page inner contents by calling the content function from the profile module directly, 
      * but move any image src attributes to another attribute name. This is because 
      * some browsers will prefetch all the images for the page even if we don't need them.
      * The only ones we need to fetch are those for new page additions, which we'll discover
      * on the client side and then swap the image back.
      *
      */
     $mod = new Channel();
     $text = $mod->get($profile_uid, $load);
     $pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
     $replace = "<img\${1} dst=\"\${2}\"";
     //	$text = preg_replace($pattern, $replace, $text);
     /*
     	if(! $load) {
     		$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
     		$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
     		$text = preg_replace($pattern, $replace, $text);
     		$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
     		$text = preg_replace($pattern, $replace, $text);
     		$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
     		$text = preg_replace($pattern, $replace, $text);
         	$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
         	$text = preg_replace($pattern, $replace, $text);
     	}
     */
     /**
      * reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well
      */
     echo str_replace("\t", '       ', $text);
     echo $_GET['msie'] == 1 ? '</div>' : '</section>';
     echo "</body></html>\r\n";
     killme();
 }
Esempio n. 5
0
<?php

// 指定のチャンネルのsidを変更する
require_once 'config.php';
if (isset($_POST['sid']) && isset($_POST['channel_disc'])) {
    try {
        $channel = Channel::get($_POST['channel_disc']);
        $channel->setSID($_POST['sid']);
    } catch (Exception $e) {
        throw $e;
    }
}
Esempio n. 6
0
        $weekofday = $_POST['weekofday'];
        if ($weekofday != 7) {
            $options .= " AND WEEKDAY(starttime) = '" . $weekofday . "'";
        }
    }
}
$options .= " ORDER BY starttime ASC LIMIT 100";
$do_keyword = 0;
if ($search != "" || $type != "*" || $category_disc !== false || $station != 0) {
    $do_keyword = 1;
}
try {
    $db = DB::conn();
    $programs = Program::search($options, $args);
    foreach ($programs as $key => $program) {
        $channel = Channel::get($program['channel_disc']);
        $programs[$key]['station_name'] = $channel->name;
    }
} catch (Exception $e) {
    throw $e;
}
try {
    $k_category_name = "";
    $categories = $db->rows('SELECT * FROM ' . Category::TABLE);
    $first_category = array('id' => 0, 'name' => "すべて", 'selected' => $category_disc === false ? "selected" : "");
    foreach ($categories as $key => $category) {
        $categories[$key]['name'] = $category['name_jp'];
        $categories[$key]['selected'] = $category['category_disc'] === $category_disc ? "selected" : "";
        if ($category['category_disc'] === $category_disc) {
            $k_category_name = $category['name_jp'];
        }
Esempio n. 7
0
} else {
    if ($type == "GR") {
        $channel_map = ChannelMaster::$GR;
    } else {
        if ($type == "CS") {
            $channel_map = $CS_CHANNEL_MAP;
        }
    }
}
$db = DB::conn();
$st = 0;
$programs = array();
foreach ($channel_map as $channel_disc => $no_use) {
    $prev_end = $top_time;
    try {
        $channel = Channel::get($channel_disc);
        $items = $db->rows('SELECT * FROM Recorder_programTbl WHERE channel_disc = ? AND endtime > ? AND starttime < ? ORDER BY starttime ASC', array($channel_disc, date('Y-m-d H:i:s', $top_time), date('Y-m-d H:i:s', $last_time)));
        $programs[$st]["station_name"] = $channel->name;
        $programs[$st]["channel_disc"] = $channel->channel_disc;
        $programs[$st]['list'] = array();
        $num = 0;
        foreach ($items as $program) {
            // 前プログラムとの空きを調べる
            $start = strtotime($program['starttime']);
            if ($start - $prev_end > 0) {
                $height = ($start - $prev_end) * $settings->height_per_hour / 3600;
                $programs[$st]['list'][$num]['category_none'] = "none";
                $programs[$st]['list'][$num]['height'] = $height;
                $programs[$st]['list'][$num]['title'] = "";
                $programs[$st]['list'][$num]['starttime'] = "";
                $programs[$st]['list'][$num]['description'] = "";