public function updateAnime() { return $this->execute(function () { $keyword = Input::get('keyword'); $mal_id = Input::get('mal_id'); $hum_id = Input::has('hum_id') ? Input::get('hum_id') : null; if (!empty($keyword) && !empty($mal_id)) { $scraper = new AnimeDataScraper(); $result = $scraper->get($mal_id, $keyword, $hum_id); if (!empty($result)) { $scraper->save($result); return View::make('mod_panel')->nest('update_msg', 'child.alerts', array('msg_type' => 'success', 'msg' => 'You succesfully updated <strong>' . $result["title"] . '</strong> to the masterani.me database.')); } } return View::make('mod_panel')->nest('update_msg', 'child.alerts', array('msg_type' => 'warning', 'msg' => 'Didn\'t find any anime matching the keyword/id!')); }); }
public static function manageListAccount($site, $username, $password) { if (Sentry::check()) { switch ($site) { case 'myanimelist': $data = new AnimeDataScraper(); if ($data->authMAL($username, $password)) { return '<div class="alert alert-success alert-dismissable"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <strong>Success!</strong> Myanimelist account has been connected. </div>'; } return '<div class="alert alert-error alert-dismissable"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <strong>Error!</strong>Failed to connect with myanimelist (check username, password or site could be offline) </div>'; case 'hummingbird': $data = new AnimeDataScraper(); if ($data->authHummingbird($username, $password)) { return '<div class="alert alert-success alert-dismissable"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <strong>Success!</strong> Hummingbird account has been connected. </div>'; } return '<div class="alert alert-error alert-dismissable"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <strong>Error!</strong>Failed to connect with hummingbird (check username, password or site could be offline) </div>'; default: return 'Site must be myanimelist or hummingbird'; } } return 'Must be logged in.'; }