HEX
Server: Apache/2.4.25 (Debian)
System: Linux server17 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
User: web37 (1062)
PHP: 7.4.30
Disabled: show_source, highlight_file, apache_child_terminate, apache_get_modules, apache_note, apache_setenv, virtual, dl, disk_total_space, posix_getpwnam, posix_getpwuid, posix_mkfifo, posix_mknod, posix_setpgid, posix_setsid, posix_setuid, posix_uname, proc_nice, openlog, syslog, pfsockopen
Upload Files
File: /var/www/web37/htdocs/lovetalk/admin/blog.php
<?php

include "includes.php";

Configuration::getControlPanel()->accessOrRedirect();

// Load the main template
$mainT = Configuration::getControlPanel()->getMainTemplate();
$mainT->pagetitle = l10n("blog_title", "Blog");
//$mainT->stylesheets = array("css/comments.css");
$mainT->content = "";
$contentT = new Template("templates/common/box.php");
$contentT->cssClass = "blog";
$contentT->content = "";

// Show the category and post selectors
$selectorsT = new Template("templates/blog/selectors.php");
$selectorsT->categories = $imSettings['blog']['posts_cat'];
$selectorsT->selectedCategory = @$_GET['category'];
$selectorsT->posts = $imSettings['blog']['posts'];
if (isset($_GET['category'])) {
	$selectorsT->categoryPosts = $imSettings['blog']['posts_cat'][$_GET['category']];
	$selectorsT->selectedPost = @$_GET['post'];
}
$contentT->content .= $selectorsT->render();

$topic = false;
if (isset($_GET['category']) && isset($_GET['post'])) {
	$data = $imSettings['blog'];
	$topic = new ImTopic($data['file_prefix'] . 'pc' . $_GET['post'], "../");
	$posturl = 'blog.php?category=' . $_GET['category'] . '&post=' . $_GET['post'];
	$topic->setPostUrl($posturl);

	switch($data['sendmode']) {
		case "file":
			$topic->loadXML($data['folder']);
		break;
	}

	// Take care of the actions
	if (isset($_GET['disable'])) {
        $n = (int)$_GET['disable'];
        $c = $topic->comments->get($n);
        if (count($c) != 0) {
            $c['approved'] = "0";
            $topic->comments->edit($n, $c);
            $topic->save();
        }
    }

    if (isset($_GET['enable'])) {
        $n = (int)$_GET['enable'];
        $c = $topic->comments->get($n);
        if (count($c) != 0) {
            $c['approved'] = "1";
            $topic->comments->edit($n, $c);
            $topic->save();
        }
    }

    if (isset($_GET['delete'])) {
        $topic->comments->delete((int)$_GET['delete']);
        $topic->save();
    }

    if (isset($_GET['unabuse'])) {
        $n = (int)$_GET['unabuse'];
        $c = $topic->comments->get($n);
        if (count($c)) {
            $c['abuse'] = "0";
            $topic->comments->edit($n, $c);
            $topic->save();
        }
    }

    if (isset($_GET['disable']) || isset($_GET['enable']) || isset($_GET['delete']) || isset($_GET['unabuse'])) {
        echo "<script type=\"text/javascript\">window.location.href='" . $posturl . "';</script>\n";
        exit();
    }

	// Show the summary
	$rating = $topic->getRating();
	$ratingT = new Template("templates/comments/summary.php");
	$ratingT->vote = $rating["rating"];
	$ratingT->count = $rating["count"];
	$ratingT->hasRating = $data['comment_type'] != "comment";
	$contentT->content .= $ratingT->render();
	if ($topic->hasComments()) {
		// Show the comments
		$commentsT = new Template("templates/comments/comments.php");
		$commentsT->comments = $topic->comments->comments;
		$commentsT->siteUrl = $imSettings['general']['url'];
		$commentsT->posturl = $posturl . "&";
		$commentsT->rating = $data['comment_type'] != "comment";
		$contentT->content .= $commentsT->render();
	}

}

$mainT->content = $contentT->render();
echo $mainT->render();