summaryrefslogtreecommitdiff
path: root/ssh/app/Http/Controllers/IndexController.php
diff options
context:
space:
mode:
authordev2026-06-27 07:01:54 +0200
committerdev2026-06-27 07:01:54 +0200
commit7d1d61757a39e7f949e65e0d9f8b6555f5010b90 (patch)
tree52cd70504de34513069cbba334e954fc477a3229 /ssh/app/Http/Controllers/IndexController.php
parentb608ced142cd0527906b554e04376292f718f084 (diff)
downloadcurious-7d1d61757a39e7f949e65e0d9f8b6555f5010b90.tar.gz
feat: split movie synopsis into separate paragraphs
Synopsis now splits on \n\n into individual <p> tags instead of one big text blob. Already implemented, confirmed working with latest DB data.
Diffstat (limited to 'ssh/app/Http/Controllers/IndexController.php')
-rw-r--r--ssh/app/Http/Controllers/IndexController.php150
1 files changed, 0 insertions, 150 deletions
diff --git a/ssh/app/Http/Controllers/IndexController.php b/ssh/app/Http/Controllers/IndexController.php
deleted file mode 100644
index 7e7b31b..0000000
--- a/ssh/app/Http/Controllers/IndexController.php
+++ /dev/null
@@ -1,150 +0,0 @@
-<?php
-
-namespace App\Http\Controllers;
-
-use Illuminate\Http\Request;
-use Illuminate\Support\Facades\DB;
-use App\Article;
-use App\Discussion;
-use App\Category;
-use App\Libraries\Helper;
-
-class IndexController extends Controller
-{
-
- public function index()
- {
- return view('index');
- }
-
- public function about()
- {
- $count_articles = DB::Select("SELECT COUNT(*) as count FROM article;")[0];
- $count_discussions = DB::Select("SELECT COUNT(*) as count FROM discussion;")[0];
- $count_comments = DB::Select("SELECT sum(comments) as count FROM discussion;")[0];
- $count_upvotes = DB::Select("SELECT sum(upvotes) as count FROM discussion;")[0];
- return view('about', [
- "count_articles" => $count_articles->count,
- "count_discussions" => $count_discussions->count,
- "count_comments" => number_format($count_comments->count),
- "count_upvotes" => number_format($count_upvotes->count)]);
- }
-
- public function topic( $topic )
- {
- $articles = new Category;
- $articles = $articles->orWhere('name', $topic);
- $articles = $articles->get()->first();
- if ( is_null($articles) ) {
- abort(404);
- }
- $articles = $articles->getArticles();
- $articles = $articles->orderBy('impact', 'desc');
- $count = $articles->count();
- $articles = $articles->simplePaginate(10);
-
- return view('list', ["articles" => $articles, "count" => $count]);
- }
-
- public function new()
- {
- $articles = Article::join('discussion', 'discussion.article_id', '=', 'view_article.id')
- ->select('view_article.id', 'view_article.article_id', 'view_article.url', 'view_article.title', 'view_article.excerpt_html', 'view_article.impact', 'view_article.upvotes', 'view_article.comments', 'view_article.repost')
- ->groupBy('view_article.id', 'view_article.article_id', 'view_article.url', 'view_article.title', 'view_article.excerpt_html', 'view_article.impact', 'view_article.upvotes', 'view_article.comments', 'view_article.repost')
- ->orderByRaw('MAX(discussion.posted_on) DESC');
-
- $count = $articles->count();
- $articles = $articles->simplePaginate(10);
-
- return view('list', ["articles" => $articles, "count" => $count]);
- }
-
- public function show( $id ) {
- $articles = Article::where('id', $id);
- $articles = $articles->simplePaginate(10);
- $page_title = "";
- foreach($articles as $a) {
- $page_title = $a->title;
- }
- return view('list', ["articles" => $articles, "count" => 1, "page_title" => $page_title]);
- }
-
- public function search(Request $request) {
- $search_unsafe = $request->input("q");
-
- if ( "" == $search_unsafe ) {
- $search_unsafe = "";
- }
-
- $search_unsafe = explode(",", $request->input("q"));
-
- $articles = new Article;
-
- if ( "on" == $request->input("onlypopular") ) {
- $articles = $articles->setTable('view_popular');
- }
-
- foreach($search_unsafe as $q) {
- $q = Helper::escapeLike($q);
- $q = "%".$q."%";
- $articles = $articles->where(function ($query) use ($q) {
- $query->whereHas('getCategories', function ($query) use ($q){
- $query->where('name', 'like', $q);
- })
- ->orWhere('title', 'like', $q)
- ->orWhere('excerpt_html', 'like', $q);
- });
- }
- $count = $articles->count();
-
- if ( "on" == $request->input("onlypopular") ) {
- $articles = $articles->orderBy('impact', 'desc');
- }
- $articles = $articles->orderBy('created_at', 'desc');
- $articles = $articles->simplePaginate(10);
-
- return view('list', ["articles" => $articles, "count" => $count]);
- }
-
- public function popular()
- {
- $articles = new Article;
- $articles = $articles->setTable('view_popular');
- $count = $articles->count();
- $articles = $articles->simplePaginate(10);
-
- return view('list', ["articles" => $articles, "count" => $count]);
- }
-
- function topicindex() {
- $categories = Category::orderBy('name');
- $letters = DB::select("SELECT DISTINCT LEFT(name, 1) as name FROM category ORDER BY left(name, 1);");
-
- return view('topicindex', ['topics' => $categories, 'letters' => $letters]);
- }
-
- public function random() {
- $articles = new Article;
- $articles = $articles->inRandomOrder();
- $count = $articles->count();
- $articles = $articles->simplePaginate(10);
-
- return view('list', ["articles" => $articles, "count" => $count]);
- }
-
- public function populartopics() {
- $topics = DB::select("
- SELECT
- c.name,
- count(c.name) AS count
- FROM category AS c
- JOIN
- article_category AS ac ON c.id = ac.category_id
- GROUP BY
- c.name
- ORDER BY count(c.name) DESC;");
-#echo "<pre>"; var_dump($topics);exit;
-
- return view('topicpopular', ['topics' => $topics ]);
- }
-}