jobberBase Community

Welcome to jobberBase Developer Community!

You are not logged in.

Announcement

Announcement for new users: in order to combat the ever increasing spam, we no longer allow new users to post links in the message body. This limitation is automatically lifted once a new user has a specific number of 'valid' posts.

You can post links like google.com which will be rendered as text but you will not be able to post messages that contain complete URLs like www.google.com

Thank you for your understanding!

#1 2009-02-17 15:07:42

elgreco
Member
Registered: 2008-10-16
Posts: 56

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 smile

Offline

#2 2009-02-18 01:51:55

Tokyoj
Senior Contributor
Registered: 2008-08-20
Posts: 311

Re: Fake Jobs on the admin Section

elgreco,
Thank you. I'll added your code and it works but one minor issue.

In mine,
<li>Total: {$reports.count}</li>
remains at the original '4', but doesn't increase with new reports. The # per job works fine.

A suggestion, IMHO, the ability to manually delete jobs from the list would be helpful. I image after 1,2,3 yrs the list might be pretty long. What do you think?


---------------
Tokyoj
"You can't build a reputation on what you're going to do." (Henry Ford)
"Insanity is doing the same thing over and over, expecting different results." (Albert Einstein)

Offline

#3 2009-02-18 09:28:27

elgreco
Member
Registered: 2008-10-16
Posts: 56

Re: Fake Jobs on the admin Section

hi!

The number Total is the total number of jobs posted as fake. it should increase in number if you report a new job. If you click on one existing job, it will just increase the count of it.

I will add the delete function in a while, but till then you can use the the manage jobs to deactivate or delete it. smile



Tokyoj wrote:

elgreco,
Thank you. I'll added your code and it works but one minor issue.

In mine,
<li>Total: {$reports.count}</li>
remains at the original '4', but doesn't increase with new reports. The # per job works fine.

A suggestion, IMHO, the ability to manually delete jobs from the list would be helpful. I image after 1,2,3 yrs the list might be pretty long. What do you think?

Offline

#4 2009-02-18 09:56:27

Tokyoj
Senior Contributor
Registered: 2008-08-20
Posts: 311

Re: Fake Jobs on the admin Section

Thanks for the clarification.


---------------
Tokyoj
"You can't build a reputation on what you're going to do." (Henry Ford)
"Insanity is doing the same thing over and over, expecting different results." (Albert Einstein)

Offline

#5 2009-11-04 05:14:58

F1Peace
Member
Registered: 2009-11-04
Posts: 1

Re: Fake Jobs on the admin Section

I followed the instructs above and all I get is a white screen in admin.
I'm using v1.8.

If I delete part 1 I see the admin page and if I click on the link # Fake Reports
I get The page you were looking for was not found.

Any help would be appreciated.

BTW.. shouldn't this be a part of Jobberbase by default?

Offline

#6 2009-11-04 09:19:17

navjotjsingh
Senior Contributor
From: Delhi, India
Registered: 2009-03-14
Posts: 230

Re: Fake Jobs on the admin Section

This should work in v1.8 albeit with a few tweaks (required only if you have customised job url structure or using database prefix)

Everything remains the same except use this page_spam.php:

<?php
class Spam
{
    function __construct()
    { }
 
    public function Reports()
    {
        global $db;
       
        $sql = 'SELECT count(distinct job_id) AS totalNumberOfReports
                                FROM '.DB_PREFIX.'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 '.DB_PREFIX.'spam_reports a join  '.DB_PREFIX.'jobs b
                                on a.job_id = b.id
                                join (
        select job_id,count(*) as counter  from '.DB_PREFIX.'spam_reports 
        group by job_id) as sp on a.job_id=sp.job_id ORDER BY  counter DESC';
          
        $result = $db->query($sql);
        
        $spam = '';
        while ($row = $result->fetch_assoc())
            $spam .= '<div>' . $row['counter'] .     '   <a href="' . BASE_URL . 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';
?>

This should work. I tested it and found it to be working.

Offline

Board footer

Powered by FluxBB