Пример #1
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $media_convert = MediaConvert::where('state', '!=', 'done')->get();
     foreach ($media_convert as $convert) {
         $response = $this->getConvertInfo($convert->file_id, '-' . $convert->preset);
         $info_decode_all = json_decode($response, true);
         if ($info_decode_all["data"] == 100) {
             $file = MediaLike::where('id', '=', $convert->file_id)->first();
             if ($convert->preset == "400") {
                 $re = $this->getConvertProcess($convert->media_id . '/' . $file->path . '-400.mp4');
             } elseif ($convert->preset == "700") {
                 $re = $this->getConvertProcess($convert->media_id . '/' . $file->path . '-700.mp4');
             }
             $convert->state = "done";
             $file->type = "conv";
             if ($convert->preset == "400") {
                 $file->preset_four = true;
             } elseif ($convert->preset == "700") {
                 $file->preset_seven = true;
             }
             $file->save();
         } elseif ($info_decode_all["data"] < 1) {
             $convert->state = "process";
         }
         $convert->percent = $info_decode_all["data"];
         $convert->save();
     }
 }
Пример #2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $media_id = $this->option('media');
     $media_files = MediaLike::where('media_id', '=', $media_id)->get();
     $download_folder = '/home/mfs/Downloads/transmission/completed/' . $media_id;
     foreach ($media_files as $file) {
         //$new_file = new MediaAdd;
         //$new_file->path = $download_folder;
         //$new_file->media_id = $media_id;
         //$new_file->name = str_replace("#", "", $bs . $file[0]);
         //$new_file->size = $file[3];
         $filepath = $download_folder . '/' . $this->mb_escapeshellarg($file->path);
         $new_name = str_replace("#", "", $filepath);
         if ($filepath != $new_name) {
             $old_folder = $download_folder . '/' . $file->path;
             $new_folder = $download_folder . '/' . str_replace("#", "", $file->path);
             shell_exec("mv {$old_folder} {$new_folder}");
             shell_exec("mv {$filepath} {$new_name}");
             $filepath = $new_name;
         }
         if ($this->getFast($filepath)) {
             $out_meta = shell_exec("qtfaststart {$filepath} 2>&1");
             sleep(5);
         }
         $fi_size = shell_exec("stat -c '%s' {$filepath} 2>&1");
         $file->size_or = (int) $fi_size;
         if (file_exists($download_folder . '/' . str_replace("#", "", $file->path))) {
             if ((int) $fi_size > 15032385536) {
                 $file->cksum = '-';
             } else {
                 $cksum = shell_exec("python3.2 /var/www/data/crc32sum.py {$filepath} 2>&1");
                 $file->cksum = $cksum;
             }
             $file->save();
         }
     }
     //$transmission = new Vohof\Transmission($config);
     //$remove = $transmission->remove($hash);
 }
Пример #3
0
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $response = curl_exec($ch);
    $tor = json_decode($response, true);
    $state = 'stop';
    echo '<pre>';
    print_r($tor);
    echo '</pre>';
});
Route::get('test02', function () {
    $filepath = '/home/mfs/Downloads/transmission/completed/31/Frozen.2013.720p.WEB-DL.H264-PublicHD/Frozen.2013.720p.WEB-DL.H264-PublicHD.mkv';
    echo shell_exec("stat -c '%s' {$filepath} 2>&1");
});
Route::post('test3', function () {
    $media = Media::where('title', 'LIKE', '%.meta%')->where('state', '=', 'done')->get();
    foreach ($media as $m) {
        $mediafiles = MediaLike::where('media_id', '=', $m->id)->get();
        foreach ($mediafiles as $mf) {
            $mf->delete();
        }
        $userm = UserMedia::where('media_id', '=', $m->id)->get();
        foreach ($userm as $mm) {
            $mm->delete();
        }
        $m->delete();
    }
});
Route::get('test4', function () {
    $media_users = UserMedia::where('media_id', '=', '11')->get();
    foreach ($media_users as $media_user) {
        $user = User::where('id', '=', $media_user->user_id)->first();
        $user_cat = Category::where('id', '=', $user->category_id)->first();
Пример #4
0
					<a href="/torrent/{{$user_media->uni_id}}d={{$folder->folder_id}}&b={{$current}}"><p>{{ $folder->name }}</p></a>
				</li>
@endforeach
				
		    </ul>
		</div>
			<?php 
if (!$media->downloading() && $media->max_file_id != 0) {
    $thumb_views = array();
    $frames = 13;
    for ($k = 1; $k < $frames; $k++) {
        $thumb_set["thumb"] = 'snaps/thumbs/' . $media->id . '/' . $media->max_file_id . '/' . $k . '.jpg';
        $thumb_set["big"] = 'snaps/big/' . $media->id . '/' . $media->max_file_id . '/' . $k . '.jpg';
        $thumb_views[] = $thumb_set;
    }
    $files_vid = MediaLike::where('media_id', '=', $media->id)->where('type', '=', 'vid')->where('type', '=', 'vid-conv')->get();
    foreach ($files_vid as $file_vid) {
        $thumb_set["thumb"] = 'snaps/thumbs/' . $media->id . '/' . $file_vid->id . '/1.jpg';
        $thumb_set["big"] = 'snaps/big/' . $media->id . '/' . $file_vid->id . '/1.jpg';
        $thumb_views[] = $thumb_set;
    }
}
?>
		<div id="bottom">
			@if($media->downloading())
			<div id="con" style="background: #f5f5f5;overflow: hidden;height:150px;">
					<div style="text-align:center; margin:0 auto; ">
						<div class="stat-bt" style="display:inline-block;margin-top:5px;vertical-align: middle;">
								<input type="text" value="0" data-width="135" data-height="135" class="knob">		
						</div>
						<div  style="display:inline-block;vertical-align: middle;margin-left:10px;"> 
Пример #5
0
 public function profile_likes($username)
 {
     $user = User::where('username', '=', $username)->first();
     $medias = MediaLike::where('user_id', '=', $user->id)->orderBy('created_at', 'desc')->paginate(Config::get('site.num_results_per_page'));
     $is_user_profile = false;
     if (!Auth::guest() && Auth::user()->id == $user->id) {
         $is_user_profile = true;
     }
     $user_points = DB::table('points')->where('user_id', '=', $user->id)->sum('points');
     $data = array('user' => $user, 'media' => $medias, 'likes' => true, 'settings' => Setting::first(), 'is_user_profile' => $is_user_profile, 'user_points' => $user_points);
     return View::make('Theme::user', $data);
 }
Пример #6
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function delete($id)
 {
     $media = Media::find($id);
     if ($media->user_id == Auth::user()->id || Auth::user()->admin == 1) {
         $media_flags = MediaFlag::where('media_id', '=', $id)->get();
         foreach ($media_flags as $media_flag) {
             $media_flag->delete();
         }
         $media_likes = MediaLike::where('media_id', '=', $id)->get();
         foreach ($media_likes as $media_like) {
             $media_like->delete();
         }
         $comments = Comment::where('media_id', '=', $id)->get();
         foreach ($comments as $comment) {
             $comment_votes = CommentVote::where('comment_id', '=', $comment->id)->get();
             foreach ($comment_votes as $comment_vote) {
                 $comment_vote->delete();
             }
             $comment_flags = CommentFlag::where('comment_id', '=', $comment->id)->get();
             foreach ($comment_flags as $comment_flag) {
                 $comment_flag->delete();
             }
             $comment->delete();
         }
         // if the media type is a gif we need to remove the animation file too.
         if (strpos($media->pic_url, '.gif') > 0) {
             if (file_exists(Config::get('site.uploads_dir') . 'images/' . str_replace(".gif", "-animation.gif", $media->pic_url))) {
                 unlink(Config::get('site.uploads_dir') . 'images/' . str_replace(".gif", "-animation.gif", $media->pic_url));
             }
         }
         // remove the image
         if (file_exists(Config::get('site.uploads_dir') . 'images/' . $media->pic_url)) {
             unlink(Config::get('site.uploads_dir') . 'images/' . $media->pic_url);
         }
         $media->delete();
     }
     return Redirect::to('admin?section=media')->with(array('note' => Lang::get('lang.delete_success'), 'note_type' => 'success'));
 }
Пример #7
0
 public function profile_likes($username)
 {
     $user = User::where('username', '=', $username)->first();
     $medias = MediaLike::where('user_id', '=', $user->id)->orderBy('created_at', 'desc')->paginate(Config::get('site.num_results_per_page'));
     $data = array('user' => $user, 'media' => $medias, 'likes' => true);
     return View::make('user.index', $data);
 }
Пример #8
0
$user_url = '#_';
$username = Lang::get('lang.anonymous');
$user_avatar = Config::get('site.uploads_dir') . 'avatars/default.jpg';
?>
	  		@endif

				<a href="{{ $user_url }}"><img src="{{ $user_avatar }}" class="img-circle user-avatar-medium" /></a><h2 class="item-title"><a href="{{ URL::to('media') . '/' . $item->slug; }}" alt="{{ $item->title }}">{{{ stripslashes($item->title) }}}</a></h2>
				<div class="item-details">
					<p class="details">{{ Lang::get('lang.submitted_by') }}: <a href="{{ $user_url }}">{{ $username}}</a> {{ Lang::get('lang.submitted_on') }} {{ date("F j, Y", strtotime($item->created_at)) }}</p>
					<p class="home-like-count"><i class="fa {{ $settings->like_icon }}"></i> <span>{{ count($item->media_likes) }}</span></p>
					<p class="home-comment-count"><i class="fa fa-comments"></i> {{ count($item->comments) }}</p>
					<p class="home-view-count"><i class="fa fa-eye"></i> @if(isset($view_increment) && $view_increment == true ){{ $item->views + 1 }}@else{{ $item->views }}@endif </p>
				</div>
				@if(!Auth::guest())
					<?php 
$liked = MediaLike::where('user_id', '=', Auth::user()->id)->where('media_id', '=', $item->id)->first();
?>
 
				@endif
				<div class="home-media-like @if(isset($liked->id)) active @endif" data-authenticated="@if(Auth::guest()){{ 'false' }}@else{{ 'true' }}@endif" data-id="{{ $item->id }}"><i class="fa {{ $settings->like_icon }}"></i></div>
			
		</div>

		<div class="clear"></div>

		@if($item->nsfw != 0 && Auth::guest())

			<div class="nsfw-container">
				<h1>NSFW!</h1>
				<p>This content has been marked as Not Safe For Work, login to view this content</p>
				<div class="nsfw-login-signup">
Пример #9
0
    /**
     * Execute the console command.
     *
     * @return void
     */
    public function fire()
    {
        include_once "/opt/nginx/html/laravel/vendor/SmartImage.class.php";
        try {
            $hash = $this->option('hash');
            $media = Media::where('hash', '=', $hash)->first();
            if ($media->files()->count() == 0) {
                echo "files";
                $url = 'http://s01.okaydrive.com/rt/plugins/httprpc/action.php';
                $myvars = 'mode=info&hash=' . $hash;
                $ch = curl_init($url);
                $username = '******';
                $password = '******';
                curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
                curl_setopt($ch, CURLOPT_POST, 1);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $myvars);
                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
                curl_setopt($ch, CURLOPT_HEADER, 0);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                $response = curl_exec($ch);
                $torrent_info = json_decode($response, true);
                $url = 'http://s01.okaydrive.com/rt/plugins/httprpc/action.php';
                $myvars = 'mode=fls&hash=' . $hash;
                $ch = curl_init($url);
                $username = '******';
                $password = '******';
                curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
                curl_setopt($ch, CURLOPT_POST, 1);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $myvars);
                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
                curl_setopt($ch, CURLOPT_HEADER, 0);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                $response = curl_exec($ch);
                $torrent_files = json_decode($response, true);
                $files = $torrent_files;
                if (!empty($files)) {
                    echo "not empty";
                    echo count($files);
                    $ignore_first_folder = true;
                    $id = 1;
                    $paths = array();
                    foreach ($files as $file) {
                        if ($torrent_info[3] != 0) {
                            $fd = parse_url(basename(str_replace("#", "", $torrent_info[2])) . '/' . str_replace("#", "", $file[0]));
                        } else {
                            $fd = parse_url(str_replace("#", "", $file[0]));
                        }
                        $path_parts = pathinfo($fd['path']);
                        $dirs = explode("/", $path_parts['dirname']);
                        for ($i = 0; $i <= count($dirs); $i++) {
                            if (isset($dirs[$i]) && $dirs[$i] != '.') {
                                $full_path = $this->fullpath($dirs, $i);
                                if (array_key_exists($full_path, $paths)) {
                                } else {
                                    $paths[$full_path]["id"] = $id;
                                    $paths[$full_path]["name"] = $dirs[$i];
                                    $prev_path = $this->fullpath($dirs, $i - 1);
                                    if (!isset($paths[$prev_path]["id"])) {
                                        $pv_p = 0;
                                    } else {
                                        $pv_p = $paths[$prev_path]["id"];
                                    }
                                    $new_folder = new MediaFlag();
                                    $new_folder->name = $dirs[$i];
                                    $new_folder->folder_id = $id;
                                    $new_folder->in = $pv_p;
                                    $new_folder->media_id = $media->id;
                                    $new_folder->save();
                                    $id++;
                                }
                            } elseif (isset($dirs[$i]) && $dirs[$i] == '.') {
                                //echo $path_parts["basename"].' 0';
                                $new_file = new MediaLike();
                                if ($torrent_info[3] != 0) {
                                    $new_file->path = basename(str_replace("#", "", $torrent_info[2])) . '/' . str_replace("#", "", $file[0]);
                                } else {
                                    $new_file->path = str_replace("#", "", $file[0]);
                                }
                                $new_file->name = $path_parts["basename"];
                                $new_file->type = $this->getExt($new_file->path);
                                $new_file->in = 0;
                                $new_file->size = $file[3];
                                $new_file->media_id = $media->id;
                                //$like->user_id = Auth::user()->id;
                                $new_file->save();
                                $ignore_first_folder = false;
                            } else {
                                if (isset($dirs[$i - 1]) && $dirs[$i - 1] != '.') {
                                    $full_path = $this->fullpath($dirs, $i - 1);
                                    //echo $path_parts["basename"].' '.$paths[$full_path]["id"];
                                    $new_file = new MediaLike();
                                    if ($torrent_info[3] != 0) {
                                        $new_file->path = basename(str_replace("#", "", $torrent_info[2])) . '/' . str_replace("#", "", $file[0]);
                                    } else {
                                        $new_file->path = str_replace("#", "", $file[0]);
                                    }
                                    $new_file->type = $this->getExt($new_file->path);
                                    $new_file->name = $path_parts["basename"];
                                    $new_file->in = $paths[$full_path]["id"];
                                    $new_file->size = $file[3];
                                    $new_file->media_id = $media->id;
                                    //$like->user_id = Auth::user()->id;
                                    $new_file->save();
                                }
                            }
                        }
                    }
                    $media["ignore_first"] = $ignore_first_folder;
                    $media->save();
                }
            }
            $files_local = $media->getFiles();
            if (!empty($files_local)) {
                echo "pro";
                $media_id = $media->id;
                shell_exec('nohup php /opt/nginx/html/artisan check:files --media=' . $media_id . ' > /dev/null 2>&1 & echo $!');
                $max_file_id = null;
                $max_file_size = 0;
                foreach ($files_local as $file) {
                    if ($file->type == "vid" || $file->type == "vid-conv") {
                        if ($file->size > $max_file_size) {
                            $max_file_size = $file->size;
                            $max_file_id = $file->id;
                        }
                    }
                }
                $media->max_file_id = $max_file_id;
                $media->save();
                $fast = false;
                foreach ($files_local as $file) {
                    if ($file->type == "vid" || $file->type == "vid-conv") {
                        if ($file->type == "vid") {
                            $fast = $this->getFast($file->path);
                        }
                        if ($file->id == $max_file_id) {
                            $info = $this->makeThumbs($media->id, $file->id, $media->id . '/' . $file->path, $fast, 13);
                        } else {
                            $info = $this->makeThumbs($media->id, $file->id, $media->id . '/' . $file->path, $fast, 1);
                        }
                        if (!empty($info) && $info != null) {
                            $info_decode_all = json_decode($info, true);
                            $info_decode = $info_decode_all["data"];
                            $new_fileinfo = new FileInfo();
                            $new_fileinfo->file_id = $file->id;
                            $new_fileinfo->media_id = $media->id;
                            $new_fileinfo->video_duration = $info_decode["video_duration"];
                            $new_fileinfo->video_codec_name = $info_decode["video_codec_name"];
                            $new_fileinfo->video_width = $info_decode["video_width"];
                            $new_fileinfo->video_height = $info_decode["video_height"];
                            $new_fileinfo->video_height = $info_decode["video_height"];
                            $new_fileinfo->video_ratio = $info_decode["video_ratio"];
                            $new_fileinfo->video_fps = $info_decode["video_fps"];
                            $new_fileinfo->audio_codec_name = $info_decode["audio_codec_name"];
                            $new_fileinfo->audio_bit_rate = $info_decode["audio_bit_rate"];
                            $new_fileinfo->save();
                        }
                    } elseif ($file->type == "img") {
                        //$this->setimages($file->name ,$media->id . '/'. $file->path);
                        $file_path_thumb = '/opt/nginx/html/public/cache/thumbs/' . $file->id . '.jpg';
                        $full_path = '/home/mfs/Downloads/transmission/completed/' . $media->id . '/' . $file->path;
                        if (file_exists($file_path_thumb)) {
                            unlink($file_path_thumb);
                        }
                        try {
                            $img = new SmartImage($full_path);
                            $img->resize(130, 130, true);
                            $img->saveImage($file_path_thumb, 85);
                        } catch (Exception $e) {
                            $full_path = '/home/mfs/Downloads/transmission/image.png';
                            $img = new SmartImage($full_path);
                            $img->saveImage($file_path_thumb, 85);
                        }
                        //file_put_contents($file_path_thumb, $file_img_tmp);
                    }
                }
                sleep(10);
                $save_base_thumbs = "/opt/nginx/html/public/snaps/thumbs/";
                $save_base_big = "/opt/nginx/html/public/snaps/big/";
                foreach ($files_local as $file) {
                    if ($file->type == "vid" || $file->type == "vid-conv") {
                        $snap_big_path = $save_base_big . $media->id;
                        if (!file_exists($snap_big_path)) {
                            mkdir($snap_big_path, 0775, true);
                        }
                        $snap_big_path_full = $snap_big_path . '/' . $file->id;
                        if (!file_exists($snap_big_path_full)) {
                            mkdir($snap_big_path_full, 0775, true);
                        }
                        $snap_thumb_path = $save_base_thumbs . $media->id;
                        if (!file_exists($snap_thumb_path)) {
                            mkdir($snap_thumb_path, 0775, true);
                        }
                        $snap_thumb_path_full = $snap_thumb_path . '/' . $file->id;
                        if (!file_exists($snap_thumb_path_full)) {
                            mkdir($snap_thumb_path_full, 0775, true);
                        }
                        if ($media->max_file_id != $file->id) {
                            $file_get = '/opt/nginx/html/laravel/public/snaps/' . $media->id . '/' . $file->id . '/1.jpg';
                            $snap_big_path_full_file = $snap_big_path_full . '/1.jpg';
                            $snap_thumb_path_full_file = $snap_thumb_path_full . '/1.jpg';
                            if (file_exists($snap_big_path_full_file)) {
                            } else {
                                try {
                                    $file_img = file_get_contents($file_get);
                                    file_put_contents($snap_big_path_full_file, $file_img);
                                    $img = new SmartImage($snap_big_path_full_file);
                                    $img->resize(130, 130, true);
                                    $img->saveImage($snap_thumb_path_full_file, 85);
                                } catch (Exception $e) {
                                    $img = new SmartImage('/opt/nginx/html/app/commands/1.png');
                                    $img->resize(130, 130, true);
                                    $img->saveImage($snap_thumb_path_full_file, 85);
                                }
                            }
                        } elseif ($media->max_file_id == $file->id) {
                            $frames = 13;
                            for ($k = 1; $k < $frames; $k++) {
                                $snap_big_path_full_file = $snap_big_path_full . '/' . $k . '.jpg';
                                $snap_thumb_path_full_file = $snap_thumb_path_full . '/' . $k . '.jpg';
                                $file_get = '/opt/nginx/html/laravel/public/snaps/' . $media->id . '/' . $file->id . '/' . $k . '.jpg';
                                if (file_exists($snap_big_path_full_file)) {
                                } else {
                                    try {
                                        $file_img = file_get_contents($file_get);
                                        file_put_contents($snap_big_path_full_file, $file_img);
                                        $img = new SmartImage($snap_big_path_full_file);
                                        $img->resize(130, 130, true);
                                        $img->saveImage($snap_thumb_path_full_file, 85);
                                    } catch (Exception $e) {
                                        $img = new SmartImage('/opt/nginx/html/app/commands/1.png');
                                        $img->resize(130, 130, true);
                                        $img->saveImage($snap_thumb_path_full_file, 85);
                                    }
                                }
                            }
                        }
                    }
                }
                while (MediaLike::where('media_id', '=', $media->id)->where('cksum', '=', '')->count() != 0) {
                    sleep(1);
                }
                $media["state"] = 'done';
                $media->save();
                $media_users = $media->usersMedia();
                foreach ($media_users as $media_user) {
                    try {
                        $user_this = User::where('id', '=', $media_user->user_id)->first();
                        if (isset($user_this->email) && $user_this->ea) {
                            require_once '/opt/nginx/html/vendor/php-aws-ses-master/src/ses.php';
                            $ses = new SimpleEmailService('AKIAJNUKDR6WQV2PJLEA', 'Q0p4SCDdHK5QddvUICYj/xMfoAbcxa7buuRYTJyY');
                            $m = new SimpleEmailServiceMessage();
                            $m->addTo($user_this->email);
                            $m->setFrom('DATAS Support <*****@*****.**>');
                            $m->setSubject('Your files are ready to download.');
                            $html = '<table class="yiv7962433916container" align="center" cellspacing="0" border="0" cellpadding="0" width="580" bgcolor="#FFFFFF" style="width:580px;background-color:#FFF;border-top:1px solid #DDD;border-bottom:1px solid #DDD;" id="yui_3_13_0_1_1397466773730_2821">
												<tbody id="yui_3_13_0_1_1397466773730_2820"><tr id="yui_3_13_0_1_1397466773730_2819">
													<td class="yiv7962433916title" style="padding-top:34px;padding-left:39px;padding-right:39px;text-align:left;border-left-width:1px;border-left-style:solid;border-left-color:#DDD;border-right-width:1px;border-right-style:solid;border-right-color:#DDD;" id="yui_3_13_0_1_1397466773730_2818">
														<h2 style="font-family:Helvetica Neue, Arial, Helvetica, sans-serif;font-size:30px;color:#262626;font-weight:normal;margin-top:0;margin-bottom:13px;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;letter-spacing:0;" id="yui_3_13_0_1_1397466773730_2817">Your file is ready!</h2>
														<h3 style="font-family:Helvetica Neue, Arial, Helvetica, sans-serif;font-size:16px;color:#3e434a;font-weight:normal;margin-top:0;margin-bottom:19px;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;line-height:25px;" id="yui_3_13_0_1_1397466773730_2824">The file <b>' . $media->title . '</b> has been downloaded and ready to Play, Download, Convert or Stream.</h3>
													</td>
												</tr>
												<tr id="yui_3_13_0_1_1397466773730_2831">
													<td class="yiv7962433916cta" align="left" style="background-color:#F1FAFE;font-size:14px;color:#1f1f1f;border-top-width:1px;border-top-style:solid;border-top-color:#DAE3EA;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:#DAE3EA;border-left-width:1px;border-left-style:solid;border-left-color:#DDD;border-right-width:1px;border-right-style:solid;border-right-color:#DDD;margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:20px;padding-bottom:20px;padding-right:39px;padding-left:39px;text-align:left;" id="yui_3_13_0_1_1397466773730_2830">
														<table cellspacing="0" border="0" cellpadding="0" width="500" align="left">
															<tbody><tr>
																<td width="24"></td>
																<td class="yiv7962433916link" align="left" style="font-family:Helvetica Neue, Arial, Helvetica, sans-serif;padding-left:9px;font-size:14px;"><strong><a rel="nofollow" style="color:#2b6cb5;font-family:Arial;font-size:12px;" target="_blank" href="https://okaydrive.com/torrent/' . $media_user->uni_id . '">Click here to go to your file</a></strong></td>
															</tr>
														</tbody></table>
													</td>
												</tr>
												<tr id="yui_3_13_0_1_1397466773730_2827">
													<td class="yiv7962433916footer" style="color:#797c80;font-size:12px;border-left-width:1px;border-left-style:solid;border-left-color:#DDD;border-right-width:1px;border-right-style:solid;border-right-color:#DDD;padding-top:23px;padding-left:39px;padding-right:13px;padding-bottom:23px;text-align:left;" id="yui_3_13_0_1_1397466773730_2826">
														<p style="font-family:Helvetica Neue, Arial, Helvetica, sans-serif;margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:13px;padding-right:0;padding-left:0;line-height:20px;" id="yui_3_13_0_1_1397466773730_2832">
															You can login with <a rel="nofollow" style="font-weight:bold;text-decoration:none;color:inherit;cursor:default;">' . $user_this->username . '</a> at <a rel="nofollow" target="_blank" href="https://okaydrive.com" id="yui_3_13_0_1_1397466773730_2833">https://okaydrive.com</a>
														</p>
														<p style="font-family:Helvetica Neue, Arial, Helvetica, sans-serif;margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:13px;padding-right:0;padding-left:0;line-height:20px;" id="yui_3_13_0_1_1397466773730_2825">Want some help with using our site? Simply reply to this email or email us - support@okaydrive.com. Email alerts are enabled by default, you may disable email alerts in your account settings.</p>
													</td>
												</tr>
												<tr>
											</tr></tbody></table>';
                            $m->setMessageFromString('', $html);
                            $ses->sendEmail($m);
                        }
                    } catch (Exception $e) {
                    }
                }
            }
        } catch (Exception $e) {
            file_put_contents('/home/mfs/l.log', $e);
        }
    }
Пример #10
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function delete($id)
 {
     $media = Media::find($id);
     if ($media->user_id == Auth::user()->id || Auth::user()->admin == 1) {
         $media_flags = MediaFlag::where('media_id', '=', $id)->get();
         foreach ($media_flags as $media_flag) {
             $media_flag->delete();
         }
         $media_likes = MediaLike::where('media_id', '=', $id)->get();
         foreach ($media_likes as $media_like) {
             $media_like->delete();
         }
         $comments = Comment::where('media_id', '=', $id)->get();
         foreach ($comments as $comment) {
             $comment_votes = CommentVote::where('comment_id', '=', $comment->id)->get();
             foreach ($comment_votes as $comment_vote) {
                 $comment_vote->delete();
             }
             $comment_flags = CommentFlag::where('comment_id', '=', $comment->id)->get();
             foreach ($comment_flags as $comment_flag) {
                 $comment_flag->delete();
             }
             $comment->delete();
         }
         $arrayPicUrl = explode("/", $media->pic_url);
         // if the media type is a gif we need to remove the animation file too.
         if (strpos($media->pic_url, '.gif') > 0) {
             \Cloudinary\Uploader::destroy(Constant::FOLDER_CLOUDINARY . '/' . $arrayPicUrl[0] . '/' . pathinfo(str_replace(".gif", "-animation.gif", $media->pic_url), PATHINFO_FILENAME));
         }
         // remove the image
         \Cloudinary\Uploader::destroy(Constant::FOLDER_CLOUDINARY . '/' . $arrayPicUrl[0] . '/' . pathinfo($media->pic_url, PATHINFO_FILENAME));
         $media->delete();
     }
     return Redirect::to('admin?section=media')->with(array('note' => Lang::get('lang.delete_success'), 'note_type' => 'success'));
 }
Пример #11
0
 public function getFiles()
 {
     return MediaLike::where('media_id', '=', $this->id)->get();
 }