Topic: Fake Jobs on the admin Section
since it is nice to follow if there is any fake job reported..i made a small addon to check it out.
1. /admin/index.php add
// spam
case 'spam':
if(!isset($_SESSION['AdminId']))
{
redirect_to(BASE_URL);
exit;
}
require_once 'page_spam.php';
$flag = 1;
break;
2. in \admin\templates\header.tpl add after approx line 51
<li {if $current_category == 'spam'}class="selected"{/if}><a href="{$BASE_URL_ADMIN}spam">Fake Reports</a></li>
3. create page_spam.php in \admin\
<?php
class Spam
{
function __construct()
{ }
public function Reports()
{
global $db;
$sql = 'SELECT count(distinct job_id) AS totalNumberOfReports
FROM spam_reports';
$result = $db->query($sql);
$row = $result->fetch_assoc();
$totalNumberOfReports = $row['totalNumberOfReports'];
$sql = 'SELECT DISTINCT b.title AS title, b.company AS company, a.job_id AS job_id,sp.counter as counter
FROM spam_reports a join jobs b
on a.job_id = b.id
join (
select job_id,count(*) as counter from spam_reports
group by job_id) as sp on a.job_id=sp.job_id ORDER BY counter DESC';
//$sql = 'SELECT * from spam_reports';
// $sql = 'SELECT DISTINCT b.title AS title, b.company AS company, a.job_id AS job_id
// FROM spam_reports a, jobs b
// WHERE a.job_id = b.id';
$result = $db->query($sql);
$spam = '';
while ($row = $result->fetch_assoc())
$spam .= '<div>' . $row['counter'] . ' <a href="' . BASE_URL . 'job/' . $row['job_id'] . '/">' . $row['title'] . '</a> at '. $row['company'] .' </div>';
return array('spam' => $spam, 'count' => $totalNumberOfReports);
}
}
$spam = new Spam();
$smarty->assign('reports', $spam->Reports());
$smarty->assign('current_category', 'spam');
$template = 'spam.tpl';
?>
3. Create spam.tpl in \admin\templates
{include file="header.tpl"}
<div id="content">
<h3 class="page-heading">Fake Reports</h3>
<div id="accordion-list">
<h3>Jobs marked as Fake:</h3>
<ul>
<li>Total: {$reports.count}</li>
</ul>
<br />
Total | Job Title @ Company<br />
{$reports.spam}
</div>
</div><!-- #content -->
{include file="footer.tpl"}
the page is not translated...its just for use it..as it is ![]()