178 lines
5.6 KiB
PHP
178 lines
5.6 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
/* $Id: admin_viewreports.php 8 2009-01-11 06:02:53Z john $ */
|
||
|
|
|
||
|
|
$page = "admin_general1";
|
||
|
|
include "admin_header.php";
|
||
|
|
|
||
|
|
if(isset($_POST['task'])) { $task = $_POST['task']; } elseif(isset($_GET['task'])) { $task = $_GET['task']; } else { $task = "main"; }
|
||
|
|
|
||
|
|
|
||
|
|
// DELETE SINGLE REPORT
|
||
|
|
if($task == "delete") {
|
||
|
|
|
||
|
|
|
||
|
|
$delete = $_POST['delete'];
|
||
|
|
if(count($delete) != 0) {
|
||
|
|
|
||
|
|
$reports_query = "SELECT * FROM community_wall, se_users WHERE community_wall.userid=se_users.user_id AND wid IN(".implode(",", $delete).") ORDER BY wid DESC";
|
||
|
|
echo $reports_query;
|
||
|
|
$query= $database->database_query($reports_query);
|
||
|
|
while($row= $database->database_fetch_array($query))
|
||
|
|
{
|
||
|
|
$path=$_SERVER["DOCUMENT_ROOT"]."/wall/include/wall/images/upload/".$row['userid']."/".$row["img_name"];
|
||
|
|
@unlink($path);
|
||
|
|
$database->database_query("DELETE FROM community_wall WHERE wid='".$row["wid"]."'");
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
function general()
|
||
|
|
{
|
||
|
|
global $ads, $database, $task;
|
||
|
|
if(isset($_POST['p'])) { $p = $_POST['p']; } elseif(isset($_GET['p'])) { $p = $_GET['p']; } else { $p = 1; }
|
||
|
|
if(isset($_POST['usage'])) { $usage = $_POST['usage']; } elseif(isset($_GET['usage'])) { $usage = $_GET['usage']; } else { $usage = ""; }
|
||
|
|
|
||
|
|
if(isset($_POST['from'])) { $from = $_POST['from']; } elseif(isset($_GET['from'])) { $from = $_GET['from']; } else { $from = ""; }
|
||
|
|
|
||
|
|
|
||
|
|
?>
|
||
|
|
|
||
|
|
<h2>Community Wall</h2>
|
||
|
|
All posts from the Community Wall<br /><br />
|
||
|
|
<table cellpadding="0" cellspacing="0" align="center">
|
||
|
|
<tbody><tr>
|
||
|
|
<td align="center">
|
||
|
|
<div class="box">
|
||
|
|
<form action="community_wall.php" method="get">
|
||
|
|
<table cellpadding="0" cellspacing="0" align="center">
|
||
|
|
<tbody><tr>
|
||
|
|
|
||
|
|
<td valign="top">Usage<br><select class="text" name="usage"><option></option><option value="1" <?php if($usage=="1"){?>selected="selected"<?php }?>>Everywhere</option><option value="0" <?php if($usage=="0"){?>selected="selected"<?php }?>>Wall Only</option></select> </td>
|
||
|
|
<td valign="top">User<br><input type="text" name="from" value="<?php echo $from;?>"> </td>
|
||
|
|
|
||
|
|
<td valign="bottom"><input type="submit" class="button" value="Filter"></td>
|
||
|
|
<input type="hidden" name="s" value="id">
|
||
|
|
|
||
|
|
</tr>
|
||
|
|
</tbody></table></form>
|
||
|
|
</div>
|
||
|
|
</td></tr></tbody></table>
|
||
|
|
|
||
|
|
<?
|
||
|
|
|
||
|
|
if($usage!="")
|
||
|
|
{
|
||
|
|
if($usage=="0")
|
||
|
|
{
|
||
|
|
$permission="AND (userpermission=".$usage." OR userpermission IS NULL)";
|
||
|
|
}
|
||
|
|
else{
|
||
|
|
$permission="AND userpermission=".$usage;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
else{$permission="";}
|
||
|
|
if($from!="")
|
||
|
|
{
|
||
|
|
$usert=" AND se_users.user_username LIKE'%".$from."%'";
|
||
|
|
}
|
||
|
|
else{$usert="";}
|
||
|
|
$reports_query = "SELECT * FROM community_wall, se_users WHERE community_wall.userid=se_users.user_id ".$permission.$usert." ORDER BY wid DESC";
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
$total_users = $database->database_num_rows($database->database_query($reports_query));
|
||
|
|
|
||
|
|
// MAKE USER PAGES
|
||
|
|
$users_per_page = 100;
|
||
|
|
|
||
|
|
|
||
|
|
$page_vars = make_page($total_users, $users_per_page, $p);
|
||
|
|
|
||
|
|
$page_array = Array();
|
||
|
|
for($x=0;$x<=$page_vars[2]-1;$x++) {
|
||
|
|
if($x+1 == $page_vars[1]) { $link = "1"; } else { $link = "0"; }
|
||
|
|
$page_array[$x] = Array('page' => $x+1,
|
||
|
|
'link' => $link);
|
||
|
|
}
|
||
|
|
|
||
|
|
$reports_query .= " LIMIT $page_vars[0], $users_per_page ";
|
||
|
|
|
||
|
|
?><br />
|
||
|
|
<br />
|
||
|
|
<?php
|
||
|
|
for($i=1; $i<=$page_vars[2]; $i++)
|
||
|
|
{
|
||
|
|
if($i==$p){
|
||
|
|
echo $i." ";
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
?><a href="community_wall.php?p=<?php echo $i;?>&usage=<?php echo $usage;?>&from=<?php echo $from;?>"><?php echo $i;?></a> <?php
|
||
|
|
}
|
||
|
|
}
|
||
|
|
?><br /><br />
|
||
|
|
|
||
|
|
<form action="community_wall.php" method="POST" onsubmit="return confirm('Are you sure you want to delete these items?')">
|
||
|
|
|
||
|
|
<table cellpadding="0" cellspacing="0" class="list" width="100%">
|
||
|
|
|
||
|
|
<tr><td class="header"><input type="checkbox" name="select_all" id="checkall"></td><td class="header"><strong>Picture</strong></td><td class="header"><strong>Message</strong></td><td class="header"><strong>User</strong></td><td class="header">Date</td></tr>
|
||
|
|
<?php
|
||
|
|
|
||
|
|
$query= $database->database_query($reports_query);
|
||
|
|
while($row= $database->database_fetch_array($query))
|
||
|
|
{
|
||
|
|
?><tr><td valign="top"><input type="checkbox" name="delete[]" value="<?php echo $row["wid"];?>"></td><td valign="top"><img src="<?php echo "/wall/include/wall/images/upload/".$row['userid']."/".$row["img_name"];?>" style="max-width:410px; height:auto;"></td><td valign="top"><?=$row["msg"]?><br>
|
||
|
|
<br>
|
||
|
|
<?php if($row["userpermission"]==1){?>User grants permission for Bateworld to use this photo anywhere.
|
||
|
|
<?php }else{?>This photo is for the wall only.
|
||
|
|
<?php }?>
|
||
|
|
</td>
|
||
|
|
|
||
|
|
<td valign="top"><a href="/profile.php?user=<?php echo $row["user_username"];?>"><?php echo $row["user_username"];?></a></td><td valign="top"><?php echo date("F j, Y", strtotime($row["datecreated"]));?></td></tr>
|
||
|
|
|
||
|
|
<?
|
||
|
|
}?></table><input type="hidden" name="task" value="delete">
|
||
|
|
<input type="submit" value="Delete"></form>
|
||
|
|
|
||
|
|
<script language='JavaScript'>
|
||
|
|
<!---
|
||
|
|
jQuery("#checkall").click(function(){
|
||
|
|
jQuery('input:checkbox').not(this).prop('checked', this.checked);
|
||
|
|
});
|
||
|
|
// -->
|
||
|
|
</script>
|
||
|
|
|
||
|
|
|
||
|
|
<?
|
||
|
|
}
|
||
|
|
// CONSTRUCT QUERY USING FILTERS
|
||
|
|
|
||
|
|
|
||
|
|
if($f_object != "") { $where_clause[] = "se_reports.report_object='$f_object'"; }
|
||
|
|
if($f_reason != "") { $where_clause[] = "se_reports.report_reason='$f_reason'"; }
|
||
|
|
if($f_details != "") { $where_clause[] = " se_reports.report_details LIKE '%$f_details%'"; }
|
||
|
|
if(count($where_clause) != 0) { $reports_query .= " WHERE ".implode(" AND ", $where_clause); }
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
// ASSIGN VARIABLES AND SHOW VIEW REPORTS PAGE
|
||
|
|
$smarty->assign('total_reports', $total_reports);
|
||
|
|
$smarty->assign('pages', $page_array);
|
||
|
|
$smarty->assign('reports', $report_array);
|
||
|
|
$smarty->assign('i', $i);
|
||
|
|
$smarty->assign('u', $u);
|
||
|
|
$smarty->assign('p', $page_vars[1]);
|
||
|
|
$smarty->assign('s', $s);
|
||
|
|
$smarty->assign('f_object', $f_object);
|
||
|
|
$smarty->assign('f_reason', $f_reason);
|
||
|
|
$smarty->assign('f_details', $f_details);
|
||
|
|
include "admin_footer.php";
|
||
|
|
?>
|