/** * Show the form for creating a new resource. * GET /frontend/publicmeme/create * * @return Response */ public function memes($slug = null, $per_page = "5") { if ($slug != null) { try { $meme = Meme::where('slug', '=', $slug)->firstOrFail(); } catch (Exception $e) { App::abort(404); } $title = $meme->name . " : Пушкице"; $articles = MemeInstance::where('published', '=', 1)->where('meme_id', '=', $meme->id)->orderBy('created_at', 'desc')->paginate($per_page); } else { $title = "Меме генератор : Пушкице"; $articles = MemeInstance::where('published', '=', 1)->orderBy('created_at', 'desc')->paginate($per_page); } View::share('title', strip_tags($title)); //$articles = News::inCategories(Config::get('settings.homepage'))->where('published', '=', 2)->where('post_type', '=', 1)->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->distinct('permalink')->groupBy('news.id')->orderBy('news.created_at', 'desc')->take(10)->get(); $featured = News::where('published', '=', 2)->where('featured', '=', 1)->where('post_type', '=', 1)->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->orderBy('created_at', 'desc')->take(3)->get(); $results = News::inCategories(Config::get('settings.results'))->where('published', '=', 2)->where('post_type', '=', 1)->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->distinct('permalink')->groupBy('news.id')->orderBy('news.created_at', 'desc')->take(4)->get(); $featuredImage = News::inCategories(array(25))->where('published', '=', 2)->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->where('post_type', '=', 1)->distinct('permalink')->groupBy('news.id')->orderBy('news.created_at', 'desc')->take(3)->get(); $didYouKnow = News::inCategories(array(30))->where('published', '=', 2)->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->where('post_type', '=', 1)->distinct('permalink')->groupBy('news.id')->orderBy('news.created_at', 'desc')->take(3)->get(); $magazine = News::inCategories(Config::get('settings.magazine'))->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->where('published', '=', 2)->where('post_type', '=', 1)->distinct('permalink')->groupBy('news.id')->orderBy('news.created_at', 'desc')->take(4)->get(); $ourComment = News::inCategories(array(17))->where('published', '=', 2)->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->where('post_type', '=', 1)->distinct('permalink')->groupBy('news.id')->orderBy('news.created_at', 'desc')->take(4)->get(); $feed = getFeed('http://bazaznanja.puskice.org/feed/qa.rss', 4); $poll = null; $poll = Poll::where('published', '=', '1')->where('end_date', '>', date("Y-m-d H:i:s", strtotime('now')))->where('created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->first(); if (isset($poll->id)) { $poll->pollOptions; } $meta = "\t<meta property='og:image' content='" . Config::get('settings.defaultImg') . "'/>\n\t\t\t\t\t\t<meta property='og:title' content='" . __("Меме генератор | Пушкице | Тачка спајања студената ФОН-а") . "'/>\n\t\t\t\t\t\t<meta property='fb:app_id' content='355697367892039'/>\n\t\t\t\t\t\t<meta property='og:site_name' content='" . __("Пушкице - ФОН Андерграунд") . "'/>\n\t\t\t\t\t\t<meta property='og:type' content='article'/>\n\t\t\t\t\t\t<meta property='og:url' content='" . _l(Request::root() . "/memes/") . "'/>\n\t\t\t\t\t\t<meta property='og:description' content='" . __("Меме генератор | Пушкице") . "' />\n\t\t\t\t\t\t<meta name='twitter:card' content='summary_large_image'>\n\t\t\t\t\t\t<meta name='twitter:site' content='" . __("Пушкице - ФОН Андерграунд") . "'>\n\t\t\t\t\t\t<meta name='twitter:creator' content='@puskice'>\n\t\t\t\t\t\t<meta name='twitter:domain' content='puskice.org'>\n\t\t\t\t\t\t<meta name='twitter:app:name:iphone' content='" . __("Пушкице") . "'>\n\t\t\t\t\t\t<meta name='twitter:app:name:ipad' content='" . __("Пушкице") . "'>\n\t\t\t\t\t\t<meta name='twitter:title' content='" . __("Меме генератор | Пушкице") . "'>\n\t\t\t\t\t\t<meta name='twitter:description' content='" . __(strip_tags("Меме генератор")) . "'>\n\t\t\t\t\t\t<meta name='twitter:image' content='" . Config::get('settings.defaultImg') . "'>"; $data = array('articles' => $articles, 'featured' => $featured, 'results' => $results, 'ourComment' => $ourComment, 'magazine' => $magazine, 'featuredImage' => $featuredImage, 'didYouKnow' => $didYouKnow, 'feed' => $feed, 'poll' => $poll, 'meta' => $meta); $this->setLayout($data); $this->layout->center = View::make('frontend.content.memes', $data); }
/** * Show the form for creating a new resource. * * @return Response */ public function getIndex() { if (Session::get('user_level') < Config::get('cms.viewMemes')) { return Redirect::to(_l(URL::action('AdminHomeController@getIndex')))->with('message', Lang::get('admin.notPermitted'))->with('notif', 'warning'); } $this->setLayout(); if (Input::get('q')) { $memes = Meme::where('name', 'LIKE', '%' . Input::get('q') . '%')->orderBy('created_at', 'desc')->paginate(20); } else { $memes = Meme::orderBy('created_at', 'desc')->paginate(20); } View::share('title', Lang::get('admin.memeGenerator')); View::share('memes', $memes); $this->layout->content = View::make('backend.puskice.memes.index'); }