public function store()
 {
     // return Input::all();
     $emailRule = Auth::guest() ? 'required' : '';
     $rules = ['name' => 'required|min:6', 'url' => 'required|url|min:11', 'email' => $emailRule];
     $messages = ['name.required' => Config::get('site.validate.name.required'), 'name.min' => Config::get('site.validate.name.min'), 'url.required' => Config::get('site.validate.url.required'), 'url.url' => Config::get('site.validate.url.url'), 'url.min' => Config::get('site.validate.url.min'), 'email.required' => Config::get('site.validate.email.required')];
     $validator = Validator::make(Input::all(), $rules, $messages);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     // Extracts the YouTube ID from various URL structures
     $name = Input::get('name');
     $url = Input::get('url');
     if (preg_match('%(?:youtube(?:-nocookie)?\\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\\.be/)([^"&?/ ]{11})%i', $url, $match)) {
         $id = $match[1];
         $image_url = "http://img.youtube.com/vi/{$id}/hqdefault.jpg";
     } else {
         return Redirect::back()->withMessage(Config::get('site.message.youtube-failed'));
     }
     $storedMP4 = MP4::whereName(Input::get('name'))->first();
     if ($storedMP4) {
         if (Request::ajax()) {
             $response = [];
             $response['success'] = true;
             $response['url'] = "/mp4/{$storedMP3->id}";
             return $response;
         }
         return Redirect::to("mp4/{$storedMP4->id}");
     }
     // Check if there's a user logged in. If not, use the admin ID.
     $admin_id = User::whereAdmin(1)->first()->id;
     $user_id = Auth::check() ? Auth::user()->id : $admin_id;
     // Insert the infos in the database
     $mp4 = new MP4();
     $mp4->name = Input::get('name');
     $mp4->youtube_id = $id;
     $mp4->image = $image_url;
     $mp4->user_id = $user_id;
     $mp4->category_id = Input::get('cat');
     $mp4->description = Input::get('description');
     $mp4->save();
     if (App::environment() == 'production') {
         TKPM::tweet($mp4, 'mp4');
     }
     if (Auth::guest() && Input::has('email')) {
         $mp4->userEmail = Input::get('email');
         $data = ['mp4' => $mp4, 'subject' => 'Felisitasyon!!! Ou fèk mete yon nouvo mizik'];
         TKPM::sendMail('emails.user.guest4', $data, 'guest4');
     } else {
         // Send a  email to the new user letting them know their video has been uploaded
         $data = ['mp4' => $mp4, 'subject' => 'Felisitasyon!!! Ou fèk mete yon nouvo videyo'];
         TKPM::sendMail('emails.user.mp4', $data, 'mp4');
     }
     Cache::flush();
     return Redirect::to('mp4/' . $mp4->id);
 }
Beispiel #2
0
				class="btn btn-danger">
				<i class="fa fa-trash-o"></i>
	  			<span class="hidden-484">Efase</span>
			</a>

			<a
				class="btn btn-default"
				href="/mp4/{{ $mp4->id }}/edit">
				<i class="fa fa-edit"></i>
	  			<span class="hidden-484">Modifye</span>
			</a>

			@endif

			<?php 
TKPM::vote('MP4', $mp4->id, $mp4->vote_up, $mp4->vote_down);
?>

	  	@endif
	</div>

	<hr>
	<form class="form-horizontal" role="form">
	  	<div class="form-group">
	    	<label
	    		for="linktext"
	    		class="col-sm-4 control-label">
	    		<i class="fa fa-video-camera"></i>
	    		Lyen Videyo a: </label>
	    	<div class="col-sm-8">
	      	<input
Beispiel #3
0
    public static function seo($object, $type, $author)
    {
        if ($type === 'user') {
            // $image = URL::to("/uploads/images/{$object->image}");
            $image = TKPM::asset($object->image, 'images');
            if ($object->username) {
                $url = URL::to("/@{$object->username}");
            } else {
                $url = URL::to("/u/{$object->id}");
            }
        }
        if ($type === 'mp3' || $type === 'mp4') {
            $url = URL::to("/{$type}/{$object->id}");
            if ($type === 'mp3') {
                $image = TKPM::asset($object->image, 'images');
            } else {
                $image = $object->image;
            }
        }
        if ($type === 'cat') {
            $url = URL::to("/{$type}/{$object->slug}");
            $image = '';
        }
        ?>

	<link rel="canonical" href="<?php 
        echo $url;
        ?>
" />
	<meta name="description" content="<?php 
        echo $object->description;
        ?>
"/>

	<!-- Open Graph -->
	<meta property="og:title" content="<?php 
        echo $author;
        ?>
 <?php 
        echo $object->name;
        ?>
" />
	<meta property="og:description" content="<?php 
        echo $object->description;
        ?>
" />
	<meta property="og:url" content="<?php 
        echo $url;
        ?>
" />
	<meta property="og:image" content="<?php 
        echo $image;
        ?>
" />
	<!-- / Open Graph -->

	<!-- Twitter description -->
	<meta name="twitter:text:description" content="<?php 
        echo $object->description;
        ?>
">

	<?php 
    }
 private function tweetMail($id, $obj, $action = null)
 {
     if ($mp3->price == 'paid') {
         // Send an email to the new user letting them know their music has been uploaded
         $data = ['mp3' => $mp3, 'subject' => 'Felisitasyon!!! Ou fèk mete yon nouvo mizik pou vann.'];
         TKPM::sendMail('emails.user.buy', $data, 'mp3');
     } elseif (Auth::guest() && Input::has('email')) {
         $mp3->userEmail = Input::get('email');
         $data = ['mp3' => $mp3, 'subject' => 'Felisitasyon!!! Ou fèk mete yon nouvo mizik'];
         TKPM::sendMail('emails.user.guest3', $data, 'guest3');
     }
     // Send an email to the new user letting them know their music has been uploaded
     $data = ['mp3' => $mp3, 'subject' => 'Felisitasyon!!! Ou fèk mete yon nouvo mizik'];
     TKPM::sendMail('emails.user.mp3', $data, 'mp3');
     if (!App::isLocal()) {
         TKPM::tweet($mp3, 'mp3');
     }
 }
Beispiel #5
0
				class="btn btn-danger">
				<i class="fa fa-trash-o"></i>
				<span class="hidden-484">Efase</span>
			</a>

			<a
				class="btn btn-default"
				href="/mp3/{{ $mp3->id }}/edit">
				<i class="fa fa-edit"></i>
				<span class="hidden-484">Modifye</span>
			</a>

			@endif

			<?php 
TKPM::vote('MP3', $mp3->id, $mp3->vote_up, $mp3->vote_down);
?>

	  	@endif

	</div>
	<hr>
	<form class="form-horizontal" role="form">
	  	<div class="form-group">
	    	<label
	    		for="linktext"
	    		class="col-sm-4 control-label">
	    		<i class="fa fa-music"></i>
	    		Lyen paj sa a: </label>
	    	<div class="col-sm-8">
	      	<input
@extends('layout.nosidebar')

@section('content')

@section('seo')
<?php 
TKPM::seo($user, 'user', $author);
?>
@stop

@section('title')
 	{{ $title }}
@stop

@include('user.profile-stats')

<div class="col-sm-8">

	@if ( Session::has('message') )
		<div class="alert alert-info fade in" role="alert">
      		<button type="button" class="close" data-dismiss="alert">
      			<span aria-hidden="true">×</span>
      			<span class="sr-only">Fèmen</span>
      		</button>
      		<h3>{{ Session::get('message') }}</h3>
    	</div>
	@endif

	<div class="bg-danger">

		@if( $errors )
 public function getPlayMP3($id)
 {
     $mp3 = MP3::published()->whereId($id)->first();
     if ($mp3->price == 'paid') {
         return Redirect::to("/mp3/buy/{$mp3->id}")->withMessage(Config::get('site.message.cant-play'));
     }
     TKPM::stream($mp3);
 }
Beispiel #8
0
@extends('layout.main')

@section('title')
{{ $title }}
@stop

@section('seo')
<?php 
TKPM::seo($cat, 'cat', $author);
?>
@stop

@section('content')

	<div class="col-sm-8">

		<div class="row bg-black">
			<h2 class="text-center">{{ $title }}</h2>
		</div>

		<hr>

		@if( $results->count() > 0 )
		@include('cats.grid-12')

		<div class="col-sm-12 text-center">

			@if ( $mp3count > 0 )

			<p>
				<a
 public function boughtMP3s()
 {
     $user = Auth::user();
     $mp3count = $user->mp3s()->count();
     $mp4count = $user->mp4s()->count();
     $mp3playcount = $user->mp3s()->sum('play');
     $mp3downloadcount = $user->mp3s()->sum('download');
     $mp4downloadcount = $user->mp4s()->sum('download');
     $mp3ViewsCount = $user->mp3s()->sum('views');
     $mp4ViewsCount = $user->mp4s()->sum('views');
     $firstname = TKPM::firstName($user->name);
     $bought_mp3s = $user->bought()->get(['mp3_id']);
     $mp3s = [];
     $mp3_ids = [];
     foreach ($bought_mp3s as $bought_mp3) {
         $mp3_ids[] = $bought_mp3->mp3_id;
     }
     if ($mp3_ids) {
         $mp3s = MP3::find($mp3_ids)->reverse();
     }
     $bought_mp3s_count = $bought_mp3s->count();
     $title = "Ou achte {$bought_mp3s_count} mizik";
     return View::make('user.bought-mp3')->with('title', $title)->with('mp3s', $mp3s)->with('first_name', $firstname)->with('mp3count', $mp3count)->with('mp4count', $mp4count)->with('mp3playcount', $mp3playcount)->with('mp3downloadcount', $mp3downloadcount)->with('mp4downloadcount', $mp4downloadcount)->with('mp3ViewsCount', $mp3ViewsCount)->with('mp4ViewsCount', $mp4ViewsCount)->with('user', $user)->withBoughtCount($bought_mp3s_count);
 }