예제 #1
0
function get_field_group($label, $text_inputs, $class = 'col-md-2 form-group')
{
    $output = '';
    $output .= Open('div', array('class' => $class));
    $output .= Open('div', array('class' => 'input-group'));
    $output .= tagcontent('span', $label, array('class' => 'input-group-addon'));
    foreach ($text_inputs as $attr_input) {
        $output .= input($attr_input);
    }
    $output .= Close('div');
    $output .= Close('div');
    return $output;
}
예제 #2
0
파일: api.php 프로젝트: suspended/jfx
        if ($type == '0') {
            $type = "buy";
        }
        $opent = $posh[0];
        $openp = $posh[2];
        $sl = $posh[6];
        $tp = $posh[7];
        $closet = $posh[8];
        $closep = $posh[9];
        $profit = $posh[10];
        $time = time(0);
        $account = $posh[11];
        // save or update in database
        // mysql_query("INSERT INTO orders VALUES('$id','$symbol','$volume','$type','$opent','$openp','$sl','$tp','$closet', '$closep', '$profit','$time','$account')");
        $closeadd = mysql_query("INSERT INTO orders VALUES('{$id}','{$symbol}','{$volume}','{$type}','{$opent}','{$openp}','{$sl}','{$tp}','{$closet}', '{$closep}', '{$profit}' , '{$time}' , '{$account}') ON DUPLICATE KEY UPDATE volume = '{$volume}', sl = '{$sl}', tp = '{$tp}', closet = '{$closet}', closep = '{$closep}', profit = '{$profit}'");
    }
}
// add balance to database
$result = mysql_query("SELECT `alias`,`linkmql` FROM users WHERE account = '{$account}'");
$row = mysql_fetch_row($result);
$alias = $row[0];
$linkmql = $row[1];
if (!empty($alias)) {
    $ok = mysql_query("INSERT INTO balance VALUES('{$account}','{$balance}','{$equity}','{$alias}','{$linkmql}','{$time}') ON DUPLICATE KEY UPDATE balance = '{$balance}', equity = '{$equity}', alias = '{$alias}', linkmql = '{$linkmql}', time = '{$time}'");
}
// db close connection
Close();
// end php code
//echo $close;
echo "[OK]";
die;
<?php 
echo info_msg('Lista de Estudiante');
echo Open('form', array('action' => base_url('estudiante/crt_estudiante/get_crud_emp'), 'method' => 'post'));
echo tagcontent('button', 'Cargar', array('name' => 'btnreportes', 'class' => 'btn btn-danger  col-md-1', 'id' => 'ajaxformbtn', 'type' => 'submit', 'data-target' => 'container-fluid'));
echo Close('form');
echo tagcontent('div', '', array('id' => 'container-fluid', 'class' => 'col-md-12'));
예제 #4
0
        ?>
"></button>
        <button type="button"  title = "Anular Solicitud"   data-target="opcion_elegida" id="ajaxpanelbtn" class="btn btn-danger fa fa-trash-o"  data-url="<?php 
        echo base_url('fisiatria/fisiatria/anular_view/' . $val->id);
        ?>
"></button>
        <?php 
        echo '</td>';
        echo Close('tr');
    }
}
echo '</tbody>';
echo '</table>';
echo '</div>';
echo "</div>";
echo Close('div');
?>

<style>

    #div1 {
        overflow:scroll;
        height:400px;
        width:100%;
    }
    #div1 table {
        width:100%;
    }
</style>
<script>
예제 #5
0
$css = array(base_url('resources/bootstrap-3.2.0/css/bootstrap.min.css'), base_url('resources/bootstrap-3.2.0/css/bootstrap-theme.css'), base_url('resources/js/libs/combobox/css/bootstrap-combobox.css'), base_url('assets/grocery_crud/css/ui/simple/jquery-ui-1.10.1.custom.min.css'), base_url('assets/grocery_crud/themes/datatables/css/demo_table_jui.css'), base_url('assets/grocery_crud/themes/datatables/css/datatables.css'), base_url('assets/grocery_crud/themes/datatables/css/jquery.dataTables.css'), base_url('resources/css/datepicker.css'), base_url('resources/js/libs/sco.js/css/sco.message.css'), base_url('resources/js/libs/jsPanel-bootstrap/source/jsPanel.css'), base_url('resources/js/libs/autosuggest/css/style.css'), base_url('resources/js/libs/pick-a-color/build/1.2.3/css/pick-a-color-1.2.3.min.css'), base_url('resources/css/style.css'));
echo csslink($css);
$js = array(base_url('assets/grocery_crud/js/jquery-1.10.2.min.js'), base_url('assets/grocery_crud/js/jquery_plugins/jquery.noty.js'), base_url('assets/grocery_crud/js/jquery_plugins/config/jquery.noty.config.js'), base_url('assets/grocery_crud/js/common/lazyload-min.js'), base_url('assets/grocery_crud/js/common/list.js'), base_url('assets/grocery_crud/themes/datatables/js/jquery.dataTables.min.js'), base_url('assets/grocery_crud/themes/datatables/js/datatables-extras.js'), base_url('assets/grocery_crud/themes/datatables/extras/TableTools/media/js/ZeroClipboard.js'), base_url('assets/grocery_crud/themes/datatables/extras/TableTools/media/js/TableTools.min.js'), base_url('assets/grocery_crud/js/jquery_plugins/ui/jquery-ui-1.10.3.custom.min.js'), base_url('resources/bootstrap-3.2.0/js/bootstrap.min.js'), base_url('resources/js/comunes/printThis.js'), base_url('resources/js/libs/sco.js/js/sco.valid.js'), base_url('resources/js/libs/sco.js/js/sco.modal.js'), base_url('resources/js/libs/sco.js/js/sco.message.js'), base_url('resources/js/libs/sco.js/js/sco.ajax.js'), base_url('resources/js/libs/jform/jquery.form.js'), base_url('resources/js/bootstrap-datepicker.js'), base_url('resources/js/bootstrap-datepicker.es.js'), base_url('resources/js/libs/autosuggest/bootstrap-typeahead.js'), base_url('resources/js/libs/autosuggest/hogan-2.0.0.js'), base_url('resources/js/libs/jsPanel/source/AC_RunActiveContent.js'), base_url('resources/js/libs/jsPanel-bootstrap/source/jquery.jspanel.bs-1.4.0.min.js'), base_url('resources/js/libs/combobox/js/bootstrap-combobox.js'), base_url('resources/js/libs/numeric/jquery.numeric.js'), base_url('resources/js/libs/combobox/js/bootstrap-combobox.js'), base_url('resources/js/libs/pick-a-color/build/dependencies/tinycolor-0.9.15.min.js'), base_url('resources/js/libs/pick-a-color/src/js/pick-a-color.js'), base_url('resources/js/comunes/jquery.blockUI.js'), base_url('resources/js/modules/comunes.js'), base_url('resources/sb_admin/js/plugins/metisMenu/metisMenu.min.js'), base_url('resources/sb_admin/js/sb-admin-2.js'));
echo jsload($js);
?>
  </head>
  <body class="skin-blue">
    <div class="wrapper">
        <?php 
$open_content_div = '';
$close_content_div = '';
echo $this->load->view('dasboard/navigation_lte', '', TRUE);
if (!empty($slidebar)) {
    echo $slidebar;
    $open_content_div = Open('div', array('class' => 'content-wrapper'));
    $close_content_div = Close('div');
}
/* Content Wrapper. Contains page content */
echo $open_content_div;
?>

        <!-- Content Header (Page header) -->
        <section class="content-header col-md-12" style="background: #ddd; margin-bottom: 5px; padding: 2px; border-bottom: solid 1px #ddddee">
<!--          <h1>
            Dashboard
            <small>Control panel</small>
          </h1>-->
                            <?php 
if (!empty($top_nav_actions)) {
    echo $top_nav_actions;
}
예제 #6
0
<?php

echo Open('table', array('class' => 'table table-striped'));
echo Open('tr', array('ng-repeat' => 'grupo in grupos'));
echo tagcontent('td', '{{grupo}}');
echo Close('tr');
echo Close('table');
예제 #7
0
echo LineBreak(1, array('style' => 'clear:both'));
echo tagcontent('span', '', array('class' => 'glyphicon glyphicon-plus', 'style' => 'font-size:20px')) . tagcontent('span', '&emsp;Mucho M&aacute;s..', array('style' => 'font-size:20px'));
echo Close('div');
echo Open('div', array('class' => 'col-md-5'));
$message = $this->session->userdata('message');
if (!empty($message)) {
    echo tagcontent('strong', $message, array('class' => 'text-danger'));
    $this->session->unset_userdata('message');
}
echo tagcontent('strong', validation_errors(), array('class' => 'text-danger'));
echo tagcontent('span', 'Ingreso al Sistema', array('class' => 'login_title1'));
echo tagcontent('div', 'Ingresa con tu usuario y contrase&ntilde;a', array('class' => '')) . '</br>';
echo Open('form', array('method' => 'post', 'action' => base_url('login/verifylogin'), 'class' => 'form-horizontal col-md-12', 'role' => 'form', 'style' => ''));
echo Open('div', array('class' => 'form-group'));
echo input(array('id' => "username", 'name' => "username", 'type' => "text", 'class' => "form-control", 'placeholder' => "Username", 'required' => '', 'autofocus' => ''));
echo Close('div');
echo Open('div', array('class' => 'form-group'));
echo input(array('id' => "passowrd", 'name' => "password", 'type' => "password", 'class' => "form-control", 'placeholder' => "Password", 'required' => ''));
echo Close('div');
//                    echo tagcontent('label', 'Ingrese con su usuario y contrase&ntilde;a', array('class'=>'checkbox'));
echo Open('div', array('class' => 'form-group'));
echo tagcontent('button', 'Ingresar a Billingsof <span class="fa fa-sign-in fa-f5"></span>', array('class' => 'btn btn-lg btn-success'));
echo Close('div');
echo Close('form');
/* container */
echo Close('div');
echo Close('div');
/* container */
echo Close('body');
echo Close('html');
 private function close()
 {
     if ($db != null) {
         $db . Close();
     }
 }
예제 #9
0
function ShowChannel($url)
{
    global $cc, $format, $password, $PremiumUser, $quality, $username, $vlc, $windows, $cli;
    $query = $_GET["id"];
    if ($query) {
        $queryArr = explode(',', $query);
        $url = $queryArr[0];
        $disk = $queryArr[1];
    }
    $html = $cc->get($url);
    preg_match('/(flashvars.*?=.*?"&cid=.*?)(\\d+)(.*?")/i', $html, $cid);
    if (!isset($cid[2])) {
        Close("No channel id found");
    }
    // Retrieve rtmp stream info
    $cc->headers[] = "Referer: http://weeb.tv/static/player.swf";
    $response = $cc->post("http://weeb.tv/api/setPlayer", "cid={$cid['2']}&watchTime=0&firstConnect=1&ip=NaN");
    $result = explode("\r\n\r\n", $response, 2);
    $flashVars = explode("&", trim($result[1]));
    foreach ($flashVars as $flashVar) {
        $temp = explode("=", $flashVar);
        $name = strtolower($temp[0]);
        $Params[$name] = $temp[1];
    }
    //$rtmp         = str_replace("r8.", "r" . rand(1, 7) . ".", urldecode($Params["10"]));
    $rtmp = urldecode($Params["10"]);
    $playpath = urldecode($Params["11"]);
    $MultiBitrate = urldecode($Params["20"]);
    $PremiumUser = urldecode($Params["5"]);
    if ($MultiBitrate) {
        $playpath .= $quality;
    }
    $BlockType = urldecode($Params["13"]);
    print_r($Params);
    if ($BlockType != 0) {
        switch ($BlockType) {
            case 1:
                $BlockTime = urldecode($Params["14"]);
                $ReconnectionTime = urldecode($Params["16"]);
                echo '
				  
	  <?xml version="1.0" encoding="UTF8" ?>
	<rss version="2.0" xmlns:media="http://purl.org/dc/elements/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
    <item>
    <title>You have crossed free viewing limit. you have been blocked for $BlockTime minutes. try again in $ReconnectionTime minutes.</title>
    <link>' . $disk . 'xLiveCZ/category/rss/in.php</link>
	<media:thumbnail url="' . $disk . 'image/stop.gif" />
	<mediaDisplay name=photoView
	rowCount=5
	columnCount=6
	drawItemText="no"
	showHeader="no" 
	menuBorderColor="0:0:0"
	sideColorBottom="0:0:0"
	sideColorTop="0:0:0"
	itemImageXPC="10"
	itemOffsetXPC="7"
	backgroundColor="0:0:0"
	sliding="no"
	idleImageXPC="45"
	idleImageYPC="45"
	idleImageWidthPC="8,6"
	idleImageHeightPC="6"
	itemGapYPC="2"
	itemGapXPC="1.5"
	>
		<idleImage>' . $disk . 'image/busy0.png</idleImage>
		<idleImage>' . $disk . 'image/busy1.png</idleImage>
		<idleImage>' . $disk . 'image/busy2.png</idleImage>
		<idleImage>' . $disk . 'image/busy3.png</idleImage>
		<idleImage>' . $disk . 'image/busy4.png</idleImage>
		<idleImage>' . $disk . 'image/busy5.png</idleImage>
		<idleImage>' . $disk . 'image/busy6.png</idleImage>
		<idleImage>' . $disk . 'image/busy7.png</idleImage>
		<idleImage>' . $disk . 'image/busy8.png</idleImage>
		<idleImage>' . $disk . 'image/busy9.png</idleImage>
		<image redraw="no" offsetXPC="0" offsetYPC="0" widthPC="100" heightPC="18">' . $disk . 'backgrounds/top.png</image>
		<image redraw="no" offsetXPC="3" offsetYPC="3" widthPC="10" heightPC="14">' . $disk . 'image/international.png</image>
		<text align="center" offsetXPC="0" offsetYPC="-2" widthPC="100" heightPC="20" fontSize="30" backgroundColor=-1:-1:-1 foregroundColor=250:250:250>
Sport a zahraniční</text>
	</mediaDisplay>
    </item>
	</channel>
	</rss>
    ';
                break;
            case 11:
                echo '
	  <?xml version="1.0" encoding="UTF8" ?>
	<rss version="2.0" xmlns:media="http://purl.org/dc/elements/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
    <item>
    <title>Vycerpany pocet volnych slotu</title>
    <link>' . $disk . 'xLiveCZ/category/rss/in.php</link>
	<media:thumbnail url="' . $disk . 'image/stop.gif" />
	<mediaDisplay name=photoView
	rowCount=5
	columnCount=6
	drawItemText="no"
	showHeader="no" 
	menuBorderColor="0:0:0"
	sideColorBottom="0:0:0"
	sideColorTop="0:0:0"
	itemImageXPC="10"
	itemOffsetXPC="7"
	backgroundColor="0:0:0"
	sliding="no"
	idleImageXPC="45"
	idleImageYPC="45"
	idleImageWidthPC="8,6"
	idleImageHeightPC="6"
	itemGapYPC="2"
	itemGapXPC="1.5"
	>
		<idleImage>' . $disk . 'image/busy0.png</idleImage>
		<idleImage>' . $disk . 'image/busy1.png</idleImage>
		<idleImage>' . $disk . 'image/busy2.png</idleImage>
		<idleImage>' . $disk . 'image/busy3.png</idleImage>
		<idleImage>' . $disk . 'image/busy4.png</idleImage>
		<idleImage>' . $disk . 'image/busy5.png</idleImage>
		<idleImage>' . $disk . 'image/busy6.png</idleImage>
		<idleImage>' . $disk . 'image/busy7.png</idleImage>
		<idleImage>' . $disk . 'image/busy8.png</idleImage>
		<idleImage>' . $disk . 'image/busy9.png</idleImage>
		<image redraw="no" offsetXPC="0" offsetYPC="0" widthPC="100" heightPC="18">' . $disk . 'backgrounds/top.png</image>
		<image redraw="no" offsetXPC="3" offsetYPC="3" widthPC="10" heightPC="14">' . $disk . 'image/international.png</image>
		<text align="center" offsetXPC="0" offsetYPC="-2" widthPC="100" heightPC="20" fontSize="30" backgroundColor=-1:-1:-1 foregroundColor=250:250:250>
Sport a zahraniční</text>
	</mediaDisplay>
    </item>
	</channel>
	</rss>
    ';
                break;
            default:
                break;
        }
    }
    if (!isset($Params["73"])) {
        // Retrieve authentication token
        $response = $cc->post("http://weeb.tv/setplayer", "cid={$cid['2']}&watchTime=0&firstConnect=0&ip=NaN");
        $result = explode("\r\n\r\n", $response, 2);
        $flashVars = explode("&", trim($result[1]));
        foreach ($flashVars as $flashVar) {
            $temp = explode("=", $flashVar);
            $name = strtolower($temp[0]);
            $Params[$name] = $temp[1];
        }
    }
    if (isset($Params["73"])) {
        $token = $Params["73"];
    } else {
        Close("Server seems busy. please try after some time.");
    }
    qprintf($format, "RTMP Url", $rtmp);
    qprintf($format, "Playpath", $playpath);
    qprintf($format, "Token", $token);
    qprintf($format, "Premium", $PremiumUser ? "Yes" : "No");
    if ($username != "" && $password != "") {
        $token = "{$token};{$username};{$password}";
    } else {
        $token = "{$token};;";
    }
    $lnk = "" . $disk . "xLiveCZ/nova.sh?type=weeb&amp;url=" . $rtmp . "/" . $playpath . "&amp;w=http://static2.weeb.tv/player.swf&amp;p=http://weeb.tv&amp;y=" . $playpath . "&amp;j=" . $token . "";
    echo '
 <?xml version="1.0" encoding="UTF8" ?>
	<rss version="2.0" xmlns:media="http://purl.org/dc/elements/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
<item>
<title>Přehrát</title>
<link>' . $lnk . '</link>
<enclosure type="video/mp4" url="' . $lnk . '"/>
</item>
	</channel>
	</rss>
    ';
    //$basecmd = 'rtmpdump -r "' . $rtmp . "/" . $playpath . '" -W "http://static2.weeb.tv/player.swf" --weeb "' . $token . "\" --live";
    // $command = $basecmd . " | \"$vlc\" -";
    if ($cli->getParam('print')) {
        echo $basecmd;
        exit(0);
    }
    /*qprintf($format, "Command", $command);
      if ($rtmp && $token)
          if ($windows)
              runAsyncBatch($command, $filename);
          else
              exec($command);*/
}
<?php

echo Open("form", array('method' => 'post', 'action' => base_url('enfermeria/signos_vitales/get_listado_turnos_dia'), 'class' => 'col-md-12'));
//Btn buscar paciente
echo Open('div', array('class' => 'input-group col-md-3'));
$searchbtn = tagcontent('button', 'Listar Turnos de Hoy<span class="glyphicon glyphicon-search"></span>', array('type' => 'submit', 'id' => 'ajaxformbtn2', 'data-target' => 'clientslistout', 'class' => 'btn btn-primary btn-sm'));
echo tagcontent('span', $searchbtn, array('class' => 'input-group-btn'));
echo Close('div');
echo Close("form");
예제 #11
0
function ShowChannel($url, $filename)
{
    global $cc, $cli, $format, $password, $PremiumUser, $quality, $username, $vlc, $windows;
    LogInfo("Retrieving info....");
    $cc->headers = $cc->headers();
    $cid = substr($url, strrpos($url, '/') + 1);
    if (!$cid) {
        Close("No channel id found");
    }
    // Retrieve rtmp stream info
    $cc->headers[] = "Referer: http://static.weeb.tv/player.swf";
    $Params = GetApiResponse($cc, "http://weeb.tv/api/setPlayer", "cid=" . $cid . "&watchTime=0&firstConnect=1&ip=NaN");
    if (isset($Params[0]) and $Params[0] <= 0) {
        Close("Server refused to send required parameters.");
    }
    $rtmp = $Params["10"];
    $playpath = $Params["11"];
    $MultiBitrate = $Params["20"];
    $PremiumUser = $Params["5"];
    if ($MultiBitrate) {
        $playpath .= $quality;
    }
    $BlockType = $Params["13"];
    if ($BlockType != 0) {
        switch ($BlockType) {
            case 1:
                $BlockTime = $Params["14"];
                $ReconnectionTime = $Params["16"];
                Close("You have crossed free viewing limit. you have been blocked for {$BlockTime} minutes. try again in {$ReconnectionTime} minutes.");
                break;
            case 11:
                Close("No free slots available");
                break;
            default:
                break;
        }
    }
    // Retrieve authentication token
    if (!isset($Params["73"])) {
        $Params = GetApiResponse($cc, "http://weeb.tv/api/setPlayer", "cid=" . $cid . "&watchTime=0&firstConnect=0&ip=NaN");
    }
    if (isset($Params["73"])) {
        $token = $Params["73"];
    } else {
        Close("Server seems busy, please try after some time.");
    }
    LogInfo(sprintf($format, "RTMP Url", $rtmp));
    LogInfo(sprintf($format, "Playpath", $playpath));
    LogInfo(sprintf($format, "Token", $token));
    LogInfo(sprintf($format, "Premium", $PremiumUser ? "Yes" : "No"));
    if ($username != "" && $password != "") {
        $token = "{$token};{$username};{$password}";
    }
    $filename = SafeFileName($filename);
    if (file_exists($filename . ".flv")) {
        unlink($filename . ".flv");
    }
    $basecmd = 'rtmpdump -r "' . $rtmp . "/" . $playpath . '" -W "http://static.weeb.tv/player.swf" --weeb "' . $token . "\" --live";
    $command = $basecmd . " | \"{$vlc}\" --meta-title \"{$filename}\" -";
    if ($cli->getParam('print')) {
        printf($basecmd);
        exit(0);
    }
    LogInfo(sprintf($format, "Command", $command));
    if ($rtmp && $token) {
        if ($windows) {
            RunAsyncBatch($command, $filename);
        } else {
            exec($command);
        }
    }
}
예제 #12
0
echo tagcontent("td", "<b>FECHA</b>");
echo tagcontent("td", "<b>DETALLE</b>");
echo tagcontent("td", "<b>CONTROLES</b>");
echo close("thead");
echo "<tbody id='table_evolucion'>";
if ($evolucion_terapia) {
    foreach ($evolucion_terapia as $tipo) {
        echo open("tr");
        echo "<td><input type='hidden' name='fechacomplicacion[]' value='" . $tipo->fecha . "'>" . $tipo->fecha . "</td>";
        echo "<td><input type='hidden' name='detallecomplicacion[]' value='" . $tipo->evolucion . "'>" . $tipo->evolucion . "</td>";
        echo "<td align='center'><a href='#' onclick='myDeleteFunctiontable3();'><i class='glyphicon glyphicon-remove'></i></a></td>";
        echo close("tr");
    }
}
echo "</tbody>";
echo Close("table");
/*if($evolucion_terapia){}*/
echo "<br><br>";
//echo close("div");
//echo close("div");
//echo close("div");
//echo 'czxczxcxz';
echo Open("div", array('class' => 'col-md-12'));
echo tagcontent('button', '<span class="glyphicon glyphicon-save"></span> Modificar', array('name' => 'btnreportes', 'class' => 'btn btn-success  col-md-4', 'id' => 'ajaxformbtn', 'type' => 'submit', 'data-target' => 'print'));
echo close("div");
echo close("div");
echo close("div");
echo tagcontent("div", '', array('id' => 'print', 'name' => 'print'));
?>
<script>
    var url = "<?php 
예제 #13
0
            <input type="submit" value="Check">
            <input type="button" value="Clear" onclick="clearISBN()">
        </p>
    </form>
    <?php 
if ($isbn) {
    Open($conn);
    //$isbn = $_GET["isbn"];
    if (IsValidIsbn($isbn)) {
        $image = ISBNIsKnown($conn, $isbn) ? "tick.png" : "error.png";
    } else {
        $image = "alert.png";
        echo "<p class='centred-text'><strong>Invalid ISBN</strong></p>";
    }
    echo "<img id='result-image' class='centred-image' src='public/img/" . $image . "' width=64 height=64></img>";
    Close($conn);
}
?>
    <!-- 0306406152 ->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script src="public/js/ui.js"></script>
    <footer>
        <small>Created by Stephen Moon, 2015</small>
    </footer>
</body>
</html>


예제 #14
0
function ShowChannel($url, $filename)
{
    global $cc, $cli, $format, $vlc, $windows, $xxtea;
    qecho("Retrieving html . . .\n");
    $cc->headers = $cc->headers();
    // Retrieve channel id and primary key
    $timestamp = time();
    $player_id = $url;
    $init = $cc->get("http://tvplayer.playtv.fr/js/{$player_id}.js?_={$timestamp}");
    preg_match("/b:[^{]*?({[^}]+})/i", $init, $init);
    $init = json_decode(trim($init[1]));
    if (!$init) {
        Close("Unable to retrieve initialization parameters");
    }
    $a = pack("H*", $init->{'a'});
    $b = pack("H*", $init->{'b'});
    $xxtea->setKey("object");
    $params = json_decode(trim($xxtea->decrypt($b)));
    if (!$params) {
        Close("Unable to decode initialization parameters");
    }
    $key = $xxtea->decrypt(pack("H*", $params->{'k'}));
    $xxtea->setKey($key);
    $params = json_decode(trim($xxtea->decrypt($a)));
    $channel_id = $params->{'i'};
    $api_url = $params->{'u'};
    // Generate parameter request
    $request = json_encode(array('i' => $channel_id, 't' => $timestamp, 'h' => 'playtv.fr', 'a' => 5));
    $request = unpack("H*", $xxtea->encrypt($request));
    $request = $request[1];
    $cc->headers[] = "Referer: http://static.playtv.fr/swf/tvplayer.swf?r=18";
    $cc->headers[] = "x-flash-version: 11,4,402,265";
    $response = $cc->get($api_url . $request);
    // Decode server response
    $response = pack("H*", $response);
    $params = json_decode(trim($xxtea->decrypt($response)));
    if (!$params) {
        Close("Unable to decode server response");
    }
    if (isset($params->{'s'}[1])) {
        $streams = $params->{'s'}[0]->{'bitrate'} > $params->{'s'}[1]->{'bitrate'} ? $params->{'s'}[0] : $params->{'s'}[1];
    } else {
        $streams = $params->{'s'}[0];
    }
    $scheme = $streams->{'scheme'};
    $host = $streams->{'host'};
    $port = $streams->{'port'};
    $app = $streams->{'application'};
    $playpath = $streams->{'stream'};
    $token = $streams->{'token'};
    $title = $streams->{'title'};
    // Generate authentication token for rtmp server
    $t = $params->{'j'}->{'t'};
    $k = $params->{'j'}->{'k'};
    $xxtea->setKey("object");
    $key = $xxtea->decrypt(pack("H*", $k));
    $xxtea->setKey($key);
    $auth = unpack("H*", $xxtea->encrypt($t));
    $auth = $auth[1];
    if ($scheme == "http") {
        qprintf($format, "HTTP Url", "{$scheme}://{$host}" . (isset($port) ? ":{$port}" : "") . "/{$playpath}");
    } else {
        qprintf($format, "RTMP Url", "{$scheme}://{$host}" . (isset($port) ? ":{$port}" : "") . "/{$app}");
    }
    qprintf($format, "Playpath", $playpath);
    qprintf($format, "Auth", $auth);
    $filename = SafeFileName($filename);
    if (file_exists($filename . ".flv")) {
        unlink($filename . ".flv");
    }
    if ($scheme == "http") {
        $basecmd = "{$scheme}://{$host}" . (isset($port) ? ":{$port}" : "") . "/{$playpath}";
        $command = "\"{$vlc}\" --meta-title \"{$title}\" \"{$basecmd}\"";
    } else {
        $basecmd = "rtmpdump -r \"{$scheme}://{$host}" . (isset($port) ? ":{$port}" : "") . "/{$app}\" -a \"{$app}\" -s \"http://static.playtv.fr/swf/tvplayer.swf\" -p \"http://playtv.fr/television\" -C S:{$auth} " . (isset($token) ? "-T \"{$token}\" " : "") . "--live -y \"{$playpath}\"";
        $command = $basecmd . " | \"{$vlc}\" --meta-title \"{$title}\" -";
    }
    if ($cli->getParam('print')) {
        echo $basecmd;
        exit(0);
    }
    qprintf($format, "Command", $command);
    if ($host && $playpath && $auth) {
        if ($windows) {
            runAsyncBatch($command, $filename);
        } else {
            exec($command);
        }
    }
}
예제 #15
0
function Open($files, $keeplist = array())
{
    global $openfiles;
    global $archtmpdir, $subtmpdir;
    /* Open any of the given files */
    foreach ($files as $fn) {
        // If any of the files is already open, return true.
        $puh = $openfiles[$fn];
        if ($puh) {
            return $puh['dir'];
        }
    }
    #echo count($openfiles), " files open now...\n";
    if (count($openfiles) >= 2) {
        $oldest = '';
        $oldesttime = 999999999;
        foreach ($openfiles as $fn => $puh) {
            $keep = 0;
            foreach ($keeplist as $keepfn) {
                if ($fn == $keepfn) {
                    $keep = 1;
                    break;
                }
            }
            if ($keep) {
                continue;
            }
            if ($puh['time'] < $oldesttime) {
                $oldesttime = $puh['time'];
                $oldest = $fn;
            }
        }
        if ($oldest) {
            Close($oldest);
        }
    }
    $pick = '';
    foreach ($files as $fn) {
        if (ereg('\\.tar\\.gz$', $fn)) {
            $pick = $fn;
            break;
        }
    }
    if (!$pick) {
        reset($files);
        list($dummy, $pick) = each($files);
    }
    GoTmp();
    @mkdir($subtmpdir, 0700);
    chdir($subtmpdir);
    if (ereg('\\.tar\\.gz$', $pick)) {
        print "\ttar xfz ../" . shellfix($pick) . "\n";
        exec('tar xfz ../../' . shellfix($pick));
    } else {
        print "\tbzip2 -d < ../" . shellfix($pick) . "| tar xf -\n";
        exec('bzip2 -d < ../../' . shellfix($pick) . '| tar xf -');
    }
    $thisdir = exec('echo *');
    exec('mv * ../');
    chdir('..');
    global $timeind;
    $openfiles[$pick] = array('dir' => $thisdir, 'time' => ++$timeind);
    return $thisdir;
}