Exemple #1
0
function video_embed($post)
{
    $link = $post['link'];
    if (empty($link)) {
        echo 'Не указана ссылка на видео';
        return;
    }
    $video = get_video_id($link);
    $video = '<iframe width="470" height="264" src="http://www.youtube.com/embed/' . $video . '" frameborder="0" allowfullscreen></iframe>';
    return $video;
}
Exemple #2
0
 public function save_bz()
 {
     $this->tpl_name = "";
     if ($_REQUEST["movie"]) {
         $video_info = get_video_id($_REQUEST["movie"]);
         if ($video_info['id']) {
             $video_data = get_video_data($video_info['id'], $video_info['type']);
             $_REQUEST["movie1"] = $video_info['id'];
             $_REQUEST["movie1_type"] = $video_info['type'];
             $_REQUEST["movie1_thumb"] = $video_data['b_thumbnail'];
         }
     }
     if ($_REQUEST["startup_name"]) {
         $_REQUEST["startup_id"] = "";
     }
     if ($_REQUEST["s_id"] > 0) {
         $_REQUEST["id"] = $_REQUEST["s_id"];
     }
     $_REQUEST["user_id_bz"] = $_SESSION["s"]["id"];
     $_id = $this->Startup_service->add($_REQUEST);
     if ($_id) {
         $this->Startup_service->del_category($_id);
         if ($_REQUEST["market_1"]) {
             $this->Startup_service->add_category($_id, $_REQUEST["market_1"]);
         }
         if ($_REQUEST["market_2"]) {
             $this->Startup_service->add_category($_id, $_REQUEST["market_2"]);
         }
         if ($_REQUEST["market_3"]) {
             $this->Startup_service->add_category($_id, $_REQUEST["market_3"]);
         }
         $this->Startup_service->del_date($_id);
         if ($_REQUEST["founded"]) {
             $this->Startup_service->add_date($_id, $_REQUEST["founded"], 0);
         }
         for ($d = 1; $d < $_REQUEST["cnt_date"] + 1; $d++) {
             if ($_REQUEST["update_" . $d]) {
                 $this->Startup_service->add_date($_id, $_REQUEST["update_" . $d], 1, $_REQUEST["update_des_" . $d]);
             }
         }
         $this->Startup_service->del_article($_id);
         for ($a = 1; $a < $_REQUEST["cnt_article"] + 1; $a++) {
             if ($_REQUEST["article_" . $a]) {
                 $this->Startup_service->add_article($_id, $_REQUEST["article_" . $a], $_REQUEST["article_t_" . $a]);
             }
         }
         if ($_REQUEST["pic_1"]) {
             $img_temp_name = str_replace(" ", "", $_REQUEST['pic_1']);
             $ck = substr($img_temp_name, 0, 1);
             if ($ck == '/') {
                 $img_temp_name = substr($img_temp_name, 1, strlen($img_temp_name) - 1);
             }
             $file_ext = explode('.', $img_temp_name);
             $file_ext = '.' . $file_ext[sizeof($file_ext) - 1];
             $original_file = $this->settings->root_path . $img_temp_name;
             $copy_file = $this->settings->root_path . 'media/service/1_' . $_id . $file_ext;
             //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
             copy($original_file, $copy_file);
             unlink($original_file);
             $_pic = '/media/service/1_' . $_id . $file_ext;
             $this->Startup_service->add_picture($_id, $_pic);
         }
         $res["id"] = $_id;
         echo json_encode($res);
     }
 }
Exemple #3
0
 public function startup_add_step3()
 {
     if ($_REQUEST["id"]) {
         $ex = $this->Startup_service->get($_REQUEST["id"]);
     }
     $_id = $this->Startup_service->add($_REQUEST);
     if (!$_REQUEST["id"]) {
         $_REQUEST["id"] = $_id;
     }
     for ($i = 1; $i < 5; $i++) {
         $_ord = 'img' . $i;
         if ($_REQUEST[$_ord]) {
             if (strpos($_REQUEST[$_ord], '/temp/')) {
                 $img_temp_name = str_replace(" ", "", $_REQUEST[$_ord]);
                 $ck = substr($img_temp_name, 0, 1);
                 if ($ck == '/') {
                     $img_temp_name = substr($img_temp_name, 1, strlen($img_temp_name) - 1);
                 }
                 $file_ext = explode('.', $img_temp_name);
                 //$filename = basename($_FILES['file']['name']);
                 $file_ext = '.' . $file_ext[sizeof($file_ext) - 1];
                 $original_file = $this->settings->root_path . $img_temp_name;
                 $copy_file = $this->settings->root_path . 'media/service/' . $i . '_' . $_id . $file_ext;
                 $_REQUEST[$_ord] = '/media/service/' . $i . '_' . $_id . $file_ext;
                 $_REQUEST[$_ord . "_thumb"] = '/media/service/thumb/' . $i . '_' . $_id . $file_ext;
                 if ($ex[$_ord]) {
                     unlink(substr($ex[$_ord], 1));
                     unlink(substr($ex[$_ord . "_thumb"], 1));
                 }
                 //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
                 copy($original_file, $copy_file);
                 unlink($original_file);
                 GD2_make_thumb_x(180, 'thumb/', $copy_file);
             } else {
                 $_REQUEST[$_ord] = $ex[$_ord];
                 $_REQUEST[$_ord . "_thumb"] = $ex[$_ord . "_thumb"];
             }
         } else {
             $_REQUEST[$_ord] = '';
             $_REQUEST[$_ord . "_thumb"] = '';
             if ($ex[$_ord]) {
                 unlink(substr($ex[$_ord], 1));
                 unlink(substr($ex[$_ord . "_thumb"], 1));
             }
         }
     }
     for ($k = 1; $k < 5; $k++) {
         $_o = "movie" . $k;
         if ($_REQUEST[$_o]) {
             $video_info = get_video_id($_REQUEST[$_o]);
             if ($video_info['id']) {
                 $video_data = get_video_data($video_info['id'], $video_info['type']);
                 $_REQUEST[$_o] = $video_info['id'];
                 $_REQUEST[$_o . "_type"] = $video_info['type'];
                 $_REQUEST[$_o . "_thumb"] = $video_data['b_thumbnail'];
             } else {
                 $_REQUEST[$_o] = '';
                 $_REQUEST[$_o . "_type"] = '';
                 $_REQUEST[$_o . "_thumb"] = '';
             }
         }
     }
     for ($j = 1; $j < 5; $j++) {
         $_or = "gr" . $j;
         if ($_REQUEST[$_or]) {
             if (strpos($_REQUEST[$_or], '/temp/')) {
                 $img_temp_name = str_replace(" ", "", $_REQUEST[$_or]);
                 $ck = substr($img_temp_name, 0, 1);
                 if ($ck == '/') {
                     $img_temp_name = substr($img_temp_name, 1, strlen($img_temp_name) - 1);
                 }
                 $file_ext = explode('.', $img_temp_name);
                 //$filename = basename($_FILES['file']['name']);
                 $file_ext = '.' . $file_ext[sizeof($file_ext) - 1];
                 $original_file = $this->settings->root_path . $img_temp_name;
                 $copy_file = $this->settings->root_path . 'media/service/' . $_or . '_' . $_id . $file_ext;
                 $_REQUEST[$_or] = '/media/service/' . $_or . '_' . $_id . $file_ext;
                 $_REQUEST[$_or . "_thumb"] = '/media/service/thumb/' . $_or . '_' . $_id . $file_ext;
                 if ($ex[$_or]) {
                     unlink(substr($ex[$_or], 1));
                     unlink(substr($ex[$_or . "_thumb"], 1));
                 }
                 //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
                 copy($original_file, $copy_file);
                 unlink($original_file);
                 GD2_make_thumb_x(180, 'thumb/', $copy_file);
             } else {
                 $_REQUEST[$_or] = $ex[$_or];
                 $_REQUEST[$_or . "_thumb"] = $ex[$_or . "_thumb"];
             }
         } else {
             $_REQUEST[$_or . '_title'] = '';
             $_REQUEST[$_or . '_thumb'] = '';
             $_REQUEST[$_or] = '';
             if ($ex[$_or]) {
                 unlink(substr($ex[$_or], 1));
                 unlink(substr($ex[$_or . "_thumb"], 1));
             }
         }
     }
     $this->Startup_service->add($_REQUEST);
     $result["id"] = $_id;
     echo json_encode($result);
     $this->tpl_name = "";
 }
				<input name="url" type="text" class="form-control" placeholder="https://www.youtube.com/watch?v=d6kZ90_0eKc">
			</div>
			<div class="col-sm-2">
				<button type="submit" class="btn btn-primary">View</button>
			</div>
		</form>
	</div>

	<br />

	<?php 
if (!empty($_REQUEST['url'])) {
    ?>

		<?php 
    $video_info = get_video_info(get_video_id($_REQUEST['url']));
    ?>
		<?php 
    $fmt_list = explode(',', $video_info['fmt_list']);
    ?>
        <?php 
    $dashmpd = new SimpleXMLElement(fetch($video_info['dashmpd']));
    ?>

		<div class="row">
			<div class="col-sm-12">

				<h2><a href="https://www.youtube.com/watch?v=<?php 
    e($video_info['video_id']);
    ?>
"><?php 
    }
}
$casts = $casts_tmp;
$count = count($casts);
if ($pre_count != $count) {
    p('Already downloaded ' . ($pre_count - $count) . ' casts');
}
if (!$count) {
    p('Nothing new to download, dying');
    die;
}
p('Found ' . $count . ' casts');
$padding = 4;
foreach ($casts as $cast) {
    echo LD_NL . LD_NL;
    $video = get_video_id($cast);
    if (substr_count($video, '?')) {
        $video_id = substr($video, 0, strpos($video, '?'));
    } else {
        $video_id = $video;
    }
    if ($video_id === false) {
        p('Failed to get video id for cast=' . $cast);
        continue;
    }
    $out_name = str_replace(array('series/', 'lessons/'), array('', ''), $cast);
    $out_file = $directory . '/' . str_pad($video_id, $padding, '0', STR_PAD_LEFT) . '_' . str_replace('/', '_', $out_name) . '.mp4';
    if (file_exists($out_file)) {
        p('File exists for out_file=' . $out_file . ', skipping');
        continue;
    }