function get_most_view_movie() { Doo::loadClass('Movie'); $mv = new Movie(); $mostview = array(); $cache_name = "get_most_view_movie"; $mostview = $this->cache->get($cache_name); if (!$mostview || $this->clearcache) { $query = "select (select sum(total) FROM cron_trending_view b where a.stats_id = b.stats_id) as totalx, stats_id, param, total \n\t\t\t\t from cron_trending_view a where tipe = 'new_vod' OR tipe = 'tovi' GROUP BY stats_id ORDER BY totalx desc LIMIT 50"; $rs = $this->dbAAA2()->fetchAll($query); /* $filter = "ga:pagePath=~^/stats/view/tovi* || ga:pagePath=~^/stats/view/vod"; $this->requestReportData(Doo::conf()->ga_profile['uid'], array('pagePath','pageTitle'), array('pageviews'),array('-pageviews'), $filter, date("Y-m-d",strtotime ( '-30 day' )), date("Y-m-d"),1, 30);*/ //foreach($this->getResults() as $result) foreach ($rs as $result) { $param = json_decode($result['param'], true); //$mn = str_replace(' - UseeTV','',$result->getPageTitle()); $mv_metadata = $mv->get_movie_detail_by_vodId($param['vod_id']); //var_dump($mv_metadata); exit; if (!$mv_metadata) { continue; } $mostview[] = array('data' => $mv_metadata, 'view' => $result['totalx'], 'buy' => $mv->get_total_order_by_void($param['vod_id'])); } $this->cache->set($cache_name, $mostview, $this->cache_time); } return $mostview; }
private function CreateMovie() { $movie = new Movie(); $data = array(); $data['title'] = $_POST['title']; $url = $this->uploadImage($_FILES['poster']); if ($url != false) { $data['poster'] = $url; } $data['rating'] = $_POST['rating']; $data['description'] = $_POST['description']; $data['genre'] = $_POST['genre']; $data['type'] = $_POST['type']; $data['year'] = $_POST['year']; $data['release_time'] = $_POST['release_time']; $data['run_time'] = $_POST['run_time']; $data['keyword'] = $_POST['keyword']; $img = $this->uploadImage($_FILES['big_picture']); if ($img != false) { $data['big_picture'] = $img; } if (!empty($_POST['parent'])) { $sql = mysql_query("SELECT * FROM Movies WHERE title LIKE '%" . $_POST['parent'] . "%'"); $result = mysql_fetch_assoc($sql); $data['parent_id'] = $result['id']; } else { $data['parent_id'] = 0; } $movie->setMovie($data); return $movie; }
public function try_load_movie($movie_id, &$plugin_cookies) { // hd_print(__METHOD__ . ': ' . print_r($plugin_cookies, true)) ; HD::print_backtrace(); if (!$this->base_url) { $this->base_url = EmplexerConfig::getInstance()->getPlexBaseUrl($plugin_cookies, $this); } $url = $this->base_url . $movie_id; $xml = HD::getAndParseXmlFromUrl($url); $movie = new Movie($movie_id); // $movie->set_data("American",'The American','Alone among assassins, Jack is a master craftsman. When a job in Sweden ends more harshly than expected for this American abroad, he vows to his contact Larry that his next assignment will be his last. Jack reports to the Italian countryside, where he holes up in a small town and relishes being away from death for a spell. The assignment, as specified by a Belgian woman, Mathilde, is in the offing as a weapon is constructed. Surprising himself, Jack seeks out the friendship of local priest Father Benedetto and pursues romance with local woman Clara. But by stepping out of the shadows, Jack may be tempting fate.','http://192.168.2.9:32400/library/metadata/4376/thumb/1342928192',1050,'2010','Anton Corbijn','Hiporã', // "George Clooney \n Jack,Thekla Reuten|Mathilde,Bruce Altman|Larry,Violante Placido|Clara|,Paolo Bonacelli|Father Benedetto",'Crime,Drama,Suspense,Thriller',6.4000000953674299,10,'R','USA','1 real'); $grandparentTitle = (string) $xml->Video->attributes()->grandparentTitle; $title = $grandparentTitle ? "Episode " . (string) $xml->Video->attributes()->index . ' : ' . (string) $xml->Video->attributes()->title : (string) $xml->Video->attributes()->title; // (string)$xml->Video->attributes()->summary $movie->set_data($name = $grandparentTitle, $name_original = $title, $description = (string) $xml->Video->attributes()->summary, $poster_url = $this->base_url . '/photo/:/transcode?width=' . THUMB_WIDTH . '&height=' . THUMB_HEIGHT . '&url=' . $this->base_url . (string) $xml->Video->attributes()->thumb, $length_min = (double) $xml->Video->attributes()->duration / 1000 / 60, $year = (string) $xml->Video->attributes()->year, $directors_str = $this->geDirectorStr($xml), $scenarios_str = null, $actors_str = $this->getRolesStr($xml), $genres_str = $this->getGenreStr($xml), $rate_imdb = (double) $xml->Video->attributes()->rating, $rate_kinopoisk = null, $rate_mpaa = (string) $xml->Video->attributes()->contentRating, $country = $this->getCountryStr($xml), $budget = null); $tab = ' '; $details = array('Video' => '_', $tab . 'Bitrate' => (string) $xml->Video->Media->attributes()->bitrate, $tab . 'Width' => (string) $xml->Video->Media->attributes()->width, $tab . 'Height' => (string) $xml->Video->Media->attributes()->height, $tab . 'Aspect Ratio' => (string) $xml->Video->Media->attributes()->aspectRatio, $tab . 'Video Resolution' => (string) $xml->Video->Media->attributes()->videoResolution, $tab . 'Video Frame Rate' => (string) $xml->Video->Media->attributes()->videoFrameRate, $tab . 'Container' => (string) $xml->Video->Media->attributes()->container, $tab . 'Codec' => (string) $xml->Video->Media->attributes()->videoCodec); $movie->details = $details; $httpVidelUrl = EmplexerConfig::getInstance()->getPlexBaseUrl($plugin_cookies, $this) . (string) $xml->Video->Media->Part->attributes()->key; $nfsVideoUrl = 'nfs://' . $plugin_cookies->plexIp . ':' . (string) $xml->Video->Media->Part->attributes()->file; if ($plugin_cookies->connectionMethod == 'smb') { $smbVideoUrl = 'smb://' . $plugin_cookies->userName . ':' . $plugin_cookies->password . '@' . $plugin_cookies->plexIp . '/' . (string) $xml->Video->Media->Part->attributes()->file; $videoUrl[SMB_CONNECTION_TYPE] = $smbVideoUrl; } $videoUrl[HTTP_CONNECTION_TYPE] = $httpVidelUrl; $videoUrl[NFS_CONNECTION_TYPE] = $nfsVideoUrl; $v = $videoUrl[$plugin_cookies->connectionMethod]; hd_print(__METHOD__ . ":-----------videoUrl = {$v}-----------"); $movie->add_series_data(1, $movie->name, $v, true); // hd_print(__METHOD__ . ':' . print_r($movie, true)); $this->set_cached_movie($movie); hd_print(print_r($this, true)); }
public function testChargeChildren() { $toystory = new Movie('Toy Story', Movie::CHILDREN); $this->assertEquals(1.5, $toystory->getCharge(2)); $this->assertEquals(1.5, $toystory->getCharge(3)); $this->assertEquals(3, $toystory->getCharge(4)); }
public function processMovies() { if ($this->site->lookupimdb == 1) { $movie = new Movie($this->echooutput); $movie->processMovieReleases(); } }
public function post_save() { $movie = new Movie(); $movie->nombre = Input::get('nombre'); $movie->duracion = Input::get('duracion'); $movie->save(); return Redirect::to('movie'); }
protected function buildDomainObject($row) { $movie = new Movie(); $movie->setId($row['mov_id']); $movie->setTitle($row['mov_title']); $movie->setDescriptionS($row['mov_description_short']); return $movie; }
public function crawl() { $dir = $this->getOption('dir'); $minSize = $this->getOption('minSize'); $cachedir = $this->getOption('cachedir'); $photodir = $this->getOption('photodir'); $cacheage = $this->getOption('cacheage'); if (!is_dir($dir)) { throw new Crawler_Exception('Directory not found: ' . $dir); return false; } $files = $this->exe(sprintf('find %s -size +%s', $dir, $minSize)); $movies = array(); $cnt = 0; foreach ($files as $file) { if (strtolower(pathinfo($file, PATHINFO_EXTENSION)) == 'vob') { $file = dirname($file); //trigger_error('Think this is a DVD. Using: '. $file, E_USER_NOTICE); if (basename($file) == 'VIDEO_TS') { $file = dirname($file); //trigger_error('Think this is a DVD. Using: '. $file, E_USER_NOTICE); } } $cnt++; $relativeFile = substr($file, strlen($dir) + 1); $slug = Movie::fileslug($file); $cacheFile = $cachedir . '/' . $slug . '.json'; #$imgFile = $photodir.'/'.$slug.'.jpg'; $imgFile = Movie::imageFromFile($file, $photodir); if (file_exists($cacheFile) && filemtime($cacheFile) > time() - $cacheage) { // Load cache $movies[$relativeFile] = json_decode(file_get_contents($cacheFile), true); } else { $Movie = new Movie($file); $details = $Movie->getDetails(); if (false === $details) { echo 'No movie info found for: ' . $Movie->cleanedName . ', ' . $file . "\n"; } else { // Use this $movies[$relativeFile] = $details; // Save photo if (!file_exists($imgFile) && !empty($details['photo'])) { if (false === $this->wget($details['photo'], $imgFile)) { trigger_error('wget error', E_USER_ERROR); return false; } } // Save cache file_put_contents($cacheFile, json_encode($details)); } } // if ($cnt > 5) { // break; // } } return $movies; }
protected function buildDomainObject($row) { $movie = new Movie(); $movie->setId($row['mov_id']); $movie->setContent($row['mov_description_short']); if (array_key_exists('cat_id', $row)) { // Find and set the associated category $categoryId = $row['cat_id']; $category = $this->categoryDAO->find($categoryId); $movie->setcategory($category); } return $movie; }
private function beforeInsert() { $this->log_content = Callback::searchMovie($this->query); foreach ($this->getContent() as $movie_info) { if (!Movie::model()->with('attributes')->find('tmdb_id=:id', array(':id' => $movie_info['imdb_id']))) { $movie = new Movie(); $movie->setUrlKey($movie_info); $movie->tmdb_id = $movie_info['id']; $movie->imdb_id = $movie_info['imdb_id']; $movie->save(); } } }
public function scrape() { $cinema = $this->get_cinema(); $id_cidade = $this->get_id_cidade_do_site(); $id_cinema = $this->get_id_cinema_do_site(); $url = "http://www.cinemark.com.br/horarios/?cidade={$id_cidade}&cine1={$id_cinema}"; $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_URL, $url); curl_setopt($curl_handle, CURLOPT_REFERER, "http://cinemark.com.br/home.html"); curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Firefox'); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); $buffer = curl_exec($curl_handle); curl_close($curl_handle); if (!empty($buffer)) { phpQuery::newDocument($buffer); //tabela de excecoes dos horarios $this->excecoes = pq('#legenda #legenda_meio div.b'); $content = pq('#cont_esq'); $cine = pq('#titulo', $content); $prog = pq('#prog_hora_meio'); $filmes = pq('div.a ,div.b, div.premiere, div.xd', $prog); foreach ($filmes as $key => $value) { $filme = new Movie(); $filme->name = trim(pq('div.titulo a', $value)->text()); $filme->age = trim(pq('input', $value)->attr('value')); $legenda = pq('div.legenda span', $value)->attr('onmouseover'); $legenda = strtolower($legenda); $pattern = '(legendado|dublado|nacional)'; preg_match($pattern, $legenda, $matches); $legenda = trim($matches[0]); $filme->subtitle = $legenda; $horarios = pq('div.horas > span', $value); foreach ($horarios as $key => $value) { $horario = pq($value)->text(); if (!empty($horario)) { //recupera a legenda que identifica o dia que o filme vai passar ou não. $excecao_horario = pq('span:gt(' . $key . '):first', pq($value)->parent())->attr('onmouseover'); if ($this->tem_sessao_hoje($excecao_horario)) { $horario = str_replace("h", ":", $horario); $filme->set_showtime($horario); } } } if ($filme->showtimes) { $cinema->set_movie($filme); } } return $cinema; } }
/** * Remove a movie. * @param Movie $movie * @param string $photopath * @param string $coverpath */ public function remove($movie, $photopath = false, $coverpath = false) { if (!$photopath) { global $photopath; } if (!$coverpath) { global $coverpath; } $m = $this->database->load("movies", $movie->id); if ($m) { $this->database->trash($m); // Remove its photo and cover $movie->removePhoto($photopath); $movie->removeCover($coverpath); } }
public function run() { $faker = Faker::create(); foreach (range(1, 20) as $index) { Movie::create(['title' => $faker->sentence(), 'year' => $faker->year($max = 'now'), 'poster_url' => str_replace('public', '', $faker->image($dir = 'public/img', $width = 125, $height = 200)), 'description' => $faker->paragraph(2), 'director' => $faker->name(), 'stars' => $faker->name() . ', ' . $faker->name(), 'note' => $faker->numberBetween($min = 0, $max = 5), 'genre' => $faker->sentence(1), 'watched' => $faker->boolean($chanceOfGettingTrue = 30)]); } }
public static function get_link($movieId) { $link = self::find_by_id($movieId); $exists = $link ? true : false; if ($link && days_from_now($link->timestamp) < LINK_UPDATE_DAYS) { // good } else { $exists = $link ? true : false; $movie = Movie::find_by_id($movieId); $link = new YouTube(); $link->id = $movieId; $link->timestamp = gen_timestamp(); $title = urlencode($movie->title); $endpoint = "https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=10&q={$title}&type=video&videoCategoryId=30&key=AIzaSyBOaDIBNUCfbthPQ0XSZScnqI8jyxJ9G5Q"; $m = self::getData($endpoint); foreach ($m->items as $mov) { $desc = $mov->snippet->description; if (levenshtein($title, $mov->snippet->title) < 2) { foreach ($castArr as $actor) { if (strpos($desc, $actor) !== false) { $link->videoId = $mov->id->videoId; break 2; // break out of both foreach loops } } } } if ($exists) { $link->update(); } else { $link->create(); } } return $link; }
public function run() { DB::table('movies')->delete(); Movie::create(array('title' => 'Man of steel', 'releaseDate' => date('2013-06-19'), 'genre' => 'Fantasy', 'synopsis' => 'A young journalist is forced to confront his secret extraterrestrial heritage when Earth is invaded by members of his race.', 'poster' => 'http://ia.media-imdb.com/images/M/MV5BMjI5OTYzNjI0Ml5BMl5BanBnXkFtZTcwMzM1NDA1OQ@@._V1_SY317_CR1,0,214,317_.jpg')); Movie::create(array('title' => 'Star Trek Into Darkness', 'releaseDate' => date('2013-06-12'), 'genre' => 'Fantasy', 'synopsis' => 'After the crew of the Enterprise find an unstoppable force of terror from within their own organization, Captain Kirk leads a manhunt to a war-zone world to capture a one man weapon of mass destruction.', 'poster' => 'http://ia.media-imdb.com/images/M/MV5BMTk2NzczOTgxNF5BMl5BanBnXkFtZTcwODQ5ODczOQ@@._V1_SX214_.jpg')); Movie::create(array('title' => 'Monstres Academy', 'releaseDate' => date('2013-07-10'), 'genre' => 'Animation', 'synopsis' => "A look at the relationship between Mike and Sulley during their days at Monsters University -- when they weren't necessarily the best of friends.", 'poster' => 'http://ia.media-imdb.com/images/M/MV5BMTUyODgwMDU3M15BMl5BanBnXkFtZTcwOTM4MjcxOQ@@._V1_SX214_.jpg')); }
protected function buildDomainObject($row) { $movie = new Movie(); $movie->setId($row['mov_id']); $movie->setTitle($row['mov_title']); $movie->setDecriptionShort($row['mov_description_short']); $movie->setDecriptionLong($row['mov_description_long']); $movie->setDirector($row['mov_director']); $movie->setYear($row['mov_year']); $movie->setImage($row['mov_image']); if (array_key_exists('id_categorie', $row)) { $categoryID = $row['cat_id']; $category = $this->categoryDAO->find($categoryId); $movie->setCategory($category); } return $movie; }
public static function createMovieFromDbRow($row) { $matchNetflix = array(); preg_match('/^"(.*?)"/', $row['netflixJSON'], $matchNetflix); $netflixId = $matchNetflix[1]; $imdbJSON = utf8_encode($row['imdbJSON']); $imdbJSON = Utils::fixJSON($imdbJSON); $movie = new Movie($row['name'], $row['rNetflix'], $netflixId, $row['year'], $row['imageURL']); $movie->populateFromIMDB(json_decode($imdbJSON, true)); if ($DEGUB) { Utils::checkJSONError($movie->mName); } $rottenJSON = Utils::fixJSON($row['rottenJSON']); $rottenJSON = json_decode($rottenJSON, true); $similarLink = $rottenJSON['links']['similar']; $movie->populateFromRottenTomatoes($similarLink, $row['rRotTomCritic'], $row['rRotTomViewer'], $rottenJSON['id']); return $movie; }
public static function find_movies($user_id = 0) { global $database; $sql = "SELECT m.* FROM movies m INNER JOIN alerts a ON a.id = m.id WHERE a.user_id = {$user_id}"; $movies = Movie::find_by_sql($sql); foreach ($movies as $movie) { if ($alert = static::find($user_id, $movie->id)) { $movie->alert = $alert; } } return !empty($movies) ? $movies : false; }
public function testIncrement() { $movie = new Movie(); $movie->set("score", 60); $this->assertEquals($movie->get("score"), 60); $movie->increment("score", 10); $this->assertEquals($movie->get("score"), 70); $movie->increment("score", -5); $this->assertEquals($movie->get("score"), 65); }
public function getMoviesFromDb($columnsNames = ["id", "name", "description", "rating"]) { if (is_array($columnsNames) && !empty($columnsNames)) { $columns = implode(",", $columnsNames); $sqlQuery = "SELECT " . $columns . " FROM movies"; $conn = parent::getConnection(); $result = $conn->query($sqlQuery); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $movie = new Movie(parent::getConnection()); if (array_key_exists("id", $row)) { $movie->setId($row["id"]); } if (array_key_exists("name", $row)) { $movie->setName($row["name"]); } if (array_key_exists("description", $row)) { $movie->setDescription($row["description"]); } if (array_key_exists("rating", $row)) { $movie->setRating($row["rating"]); } $this->setArrayWithMovies($movie); } } } }
public function create_movie_list() { $db = new Database(); $movie = new Movie($db); if (isset($_GET['cat'])) { $cat = $_GET['cat']; $values = $movie->find_movie_by_cat($cat); } elseif (isset($_GET['dir'])) { $dir = $_GET['dir']; $values = $movie->find_movie_by_director($dir); } elseif (isset($_GET['cat']) && isset($_GET['dir'])) { throw new Exception("Please search either by director's name or by categories"); } // Create a list of movie ids $list = array(); for ($i = 0; $i < count($values); $i++) { array_push($list, $values[$i]['id']); } $_SESSION["movie_list"] = $list; $db = NULL; $this->create_url_from_list(); }
public function doInsert() { global $baseDir; $movies_array = JSONParser::parseJSON($baseDir . '\\mysite\\inTheatre.json'); //9 items for ($i = 0; $i < count($movies_array); $i++) { $movie = Movie::create(); $movie = $movies_array[$i]; $movie->MovieListPageID = $this->ID; $movie->write(); } return $this->redirectBack(); }
public static function parseJSON($url) { $data = file_get_contents($url); $de_json = json_decode($data, TRUE); $count_json = count($de_json); //3 Objects $movies = $de_json[0]['movies']; $count_movies = count($movies); $movies_array = array(); for ($i = 0; $i < $count_movies; $i++) { $movie_json = $movies[$i]; $Title = $movie_json['title']; $Countries = implode(', ', $movie_json['countries']); $Locations = implode(', ', $movie_json['filmingLocations']); $Genres = implode(', ', $movie_json['genres']); $Languages = implode(', ', $movie_json['languages']); $Metascore = $movie_json['metascore']; $Rated = $movie_json['rated']; $Runtime = implode(', ', $movie_json['runtime']); $Directors = $movie_json['directors'][0]['name']; $Rating = $movie_json['rating']; $Plot = $movie_json['plot']; $SimplePlot = $movie_json['simplePlot']; $WritersArray = $movie_json['writers']; $writers_array = array(); foreach ($WritersArray as $Writer) { array_push($writers_array, $Writer['name']); } $Writers = implode(', ', $writers_array); $UrlPoster = $movie_json['urlPoster']; $movie = Movie::create(); $movie->Title = $Title; $movie->Countries = $Countries; $movie->Locations = $Locations; $movie->Genres = $Genres; $movie->Languages = $Languages; $movie->Metascore = $Metascore; $movie->Rated = $Rated; $movie->Runtime = $Runtime; $movie->Directors = $Directors; $movie->Rating = $Rating; $movie->Plot = $Plot; $movie->SimplePlot = $SimplePlot; $movie->Writers = $Writers; $movie->UrlPoster = $UrlPoster; array_push($movies_array, $movie); } //var_dump(Movie::custom_database_fields('Movie')); //var_dump($movie_json['countries'][0]); return $movies_array; }
public function getMemberHome() { date_default_timezone_set(config::$timezone); $today = date("Y-m-d"); // Holding watched movies id $watchedMovies = Order::where('member_id', '=', Session::get('member_id'))->select('movie_id')->get()->toArray(); // Building query whare id = ? or id = ? so on $ids = 'id = ?'; for ($i = 1; $i < count($watchedMovies); $i++) { $ids .= ' or id = ?'; } $memberWatchedMovies = Movie::orWhereRaw($ids, $watchedMovies)->get(); return View::make('adminArea/home/member-dashboard')->with('newMovies', Movie::orderBy('id', 'desc')->get()->take(20))->with('watchedMovies', $memberWatchedMovies); }
public static function Instance() { if (self::$instance === null) { try { $selmovie = isset($_SESSION['SelectedMovie']) ? $_SESSION['SelectedMovie'] : null; if ($selmovie === null || !is_object($selmovie)) { return null; } self::$instance = new Movie($selmovie->chanid, $selmovie->starttime); } catch (Exception $e) { return null; } } if (self::$instance->isLoaded()) { return self::$instance; } return null; }
/** * Store a newly created resource in storage. * * @return Response */ public function omdbUpdate($id) { if (Request::format() == 'json') { } $rev = Movie::find($id); $rev->fl_dir_ar_id = Input::get('info.Director'); $rev->fl_writer = Input::get('info.Writer'); $rev->fl_stars = Input::get('info.Actors'); $rev->fl_outline = Input::get('info.Plot'); $rev->fl_genre = Input::get('info.Genre'); $rev->fl_duration = Input::get('info.Runtime'); $rev->fl_country = Input::get('info.Country'); $rev->fl_imdbID = Input::get('info.imdbID'); $rev->fl_imdbRating = Input::get('info.imdbRating'); $rev->fl_imdbVotes = Input::get('info.imdbVotes'); $rev->fl_metascore = Input::get('info.Metascore'); $rev->save(); }
public function __construct() { $selectedItem = Param('selectedMovie'); if ($selectedItem != null) { list($chanid, $starttime) = explode(".", $selectedItem); if (is_numeric($chanid) && is_numeric($starttime)) { $_SESSION['SelectedMovie'] = new Movie($chanid, $starttime); if (Param("init") == "true") { $_SESSION['list'] = null; } } } $this->movie = Movie::Instance(); $this->list = null; if ($this->movie !== null) { $this->list = $this->movie->getList(Param('startAgain')); $this->handleActions(); $this->movie->fillViewbag($this->Viewbag()); } }
public static function DeadLineFinished() { date_default_timezone_set(config::$timezone); $today = date("Y-m-d"); $orders = Order::where('to', '<', $today)->where('status', '=', 1)->orderBy('id', 'desc')->get(); $info = array(); $x = 0; foreach ($orders as $order) { $single = array(); $single['email'] = User::where('details_id', '=', $order->member->id)->where('user_level', '=', 'member')->get()->first()->email; $single['movie name'] = Movie::where("id", '=', $order->movie_id)->get()->first()->name; $single['first name'] = Member::where("id", '=', $order->member_id)->get()->first()->first_name; $single['last name'] = Member::where("id", '=', $order->member_id)->get()->first()->last_name; $info[$x++] = $single; } foreach ($info as $member) { Mail::send('emails.deadlinefinishedorder', array('first_name' => $member['first name'], 'last_name' => $member['last name'], 'movie' => $member['movie name']), function ($message) use($member) { $message->to($member['email'], $member['first name'])->subject('DVD Rental Notification'); }); } return "Email has been successfully sent."; }
public static function get_link($movieId) { $link = self::find_by_id($movieId); $exists = $link ? true : false; if ($link && days_from_now($link->timestamp) < LINK_UPDATE_DAYS) { // good } else { $exists = $link ? true : false; $movie = Movie::find_by_id($movieId); $link = new Netflix(); $link->id = $movieId; $link->timestamp = gen_timestamp(); $years_from_search = array(); $links_from_search = array(); $titles_from_search = array(); $html = file_get_contents("http://instantwatcher.com/titles?q=" . urlencode($movie->title)); $matches = strallpos($html, "<span class=\"releaseYear\">"); $link_matches = strallpos($html, "location.href"); $title_matches = strallpos($html, "class=\"title-list-item-link"); if (sizeof($matches) == sizeof($link_matches)) { for ($i = 0; $i < sizeof($matches); $i++) { $years_from_search[] = substr($html, $matches[$i] + 26, 4); $links_from_search[] = str_replace('Player?movieid=', 'Movie/', strstr(substr($html, $link_matches[$i] + 17), "'", true)); $titles_from_search[] = substr(strstr(strstr(substr($html, $title_matches[$i]), ">"), "</a>", true), 1); if ($years_from_search[$i] == $movie->year && levenshtein($titles_from_search[$i], $movie->title) < 2) { $link->link = $links_from_search[$i]; break; } } } if ($exists) { $link->update(); } else { $link->create(); } } return $link; }
<?php if (!$page->users->isLoggedIn()) { $page->show403(); } $m = new Movie(); if (!isset($_GET["id"])) { $_GET["id"] = 1; } $user = $page->users->getById($page->users->currentUserId()); $cpapi = $user['cp_api']; $cpurl = $user['cp_url']; $page->smarty->assign('cpapi', $cpapi); $page->smarty->assign('cpurl', $cpurl); $data = $m->getUpcoming($_GET["id"]); //print_r(json_decode($data["info"])->movies);die(); if (!$data || $data["info"] == "") { $page->smarty->assign("nodata", "No upcoming data."); } else { $data = json_decode($data["info"]); if (isset($data->error)) { $page->smarty->assign("nodata", $data->error); } else { if (!isset($data->movies)) { $page->smarty->assign("nodata", 'Unspecified error.'); } else { $page->smarty->assign('data', $data->movies); switch ($_GET["id"]) { case Movie::SRC_BOXOFFICE: $page->title = "Box Office"; break;