<?php
/*
+--------------------------------------------------------------------------
| Real Estate Watchdog Revision 1.1.8
| ========================================
| by Alex Toney, Tyler Anderson
| (c) 2004 - 2005 Z15.org
|
| ========================================
|
| Time: Mon Aug 27 01:47:27 PDT 2001
| Email: toneyalex@gmail.com
|
+---------------------------------------------------------------------------
|
| > This is here so i can implement this in classes
|
+--------------------------------------------------------------------------
*/
include '/classes/interfaces/admin.interface.php';
class admin implements admin{
public $time;
public $mysqlCapture=array();
public $UserType;
public $Exeception;
public $sqlDump;
public static $sqlCount;
public function ApproveCity($POST,$user){
foreach($POST as $post){
if ($post != 'approve'){
$this->sqlDump = mysql_fetch_object(mysql_query( "SELECT * FROM temp_citylist WHERE id='$post' LIMIT 1" ));
$this->mysqlCapture[1] = mysql_query("INSERT INTO citylist SET('','".$this->sqlDump->city."','".$this->sqlDump->state."','".$this->sqlDump->population."')" );
$this->mysqlCapture[2] = mysql_query("DELETE FROM temp_citylist WHERE id='$post' LIMIT 1") or die();
self::LogApproval($user,$this->GetUserType($user));
}
}
$this->CountSql();
}
public function ClearSpamDisputes($user){
try{
$this->mysqlCapture[1] = mysql_query("DELETE FROM spamdisputes");
$this->mysqlCapture[2] = mysql_query("INSERT INTO adminlog SET('','$user','Clear Spam');");
}
catch (Exception $e){
$e->getMessage($e);
}
if($this->mysqlCapture[1] == true){
return true;
}
else{
return false;
}
$this->CountSql();
}
public function DeleteAlerts($user){
try{
$this->mysqlCapture[1] = mysql_query("INSERT INTO adminlog SET('','$user','alerts');");
$this->mysqlCapture[2] = mysql_query("DELETE FROM alerts");
}
catch (Exception $e){
$e->getMessage($e);
}
$this->CountSql();
}
public function DeletePost($pid,$user){
$this->mysqlCapture[1] = mysql_query("INSERT INTO adminlog SET('','$user','alerts');");
if(is_array($pid)){
foreach($pid as $Delete => $key){
$this->mysqlCapture[2][$key] = mysql_query("DELETE FROM disputes WHERE dispute='$Delete';");
}
}
else{
$this->mysqlCapture[3] = mysql_query("DELETE FROM disputes WHERE dispute='$pid';");
}
$this->CountSql();
}
public function DeleteDispute($POST){
foreach( $POST as $post => $key){
if ($post != 'delete'){
mysql_query( "DELETE FROM disputes WHERE id='$post' LIMIT 1" ) or die();
}
}
$this->CountSql();
}
public function DeleteTempDispute($DisputeId){
$this->mysqlCapture[1] = mysql_query("INSERT INTO adminlog SET('','$user','alerts');");
if(is_array($DisputeId)){
foreach($DisputeId as $DisputeDelete => $key){
$this->mysqlCapture[2][$key] = mysql_query("DELETE FROM temp_disputes WHERE dispute = '$DisputeDelete';");
}
}
$this->mysqlCapture[3] = mysql_query("DELETE FROM temp_disputes WHERE dispute = '$DisputeDelete';");
$this->CountSql();
}
public function DeleteCompany($CompanyId,$AllUsers,$Disputes){
$this->mysqlCapture[1] = mysql_query("INSERT INTO adminlog SET('','$user','alerts');");
$this->mysqlCapture[2] = mysql_query("SELECT COUNT(*) as count FROM company_users WHERE company_id='$CompanyId'");
$this->mysqlCapture[3] = mysql_fetch_object($this->mysqlCapture[2]);
$this->mysqlCapture[4] = mysql_query("SELECT * FROM companies WHERE id='$CompanyId'");
$this->mysqlCapture[5] = mysql_fetch_object($this->mysqlCapture[4]);
if($AllUsers == true){
$this->mysqlCapture[6] = mysql_query("DELETE FROM company_users WHERE company_id='$CompanyId' LIMIT ".$this->mysqlCapture[3]->count."");
$this->mysqlCapture[7] = mysql_query("DELETE FROM companies WHERE id='$CompanyId'");
}
else{
$this->mysqlCapture[8] = mysql_query("DELETE FROM companies WHERE id='$CompanyId'");
}
if($Disputes == true){
$this->mysqlCapture[9] = mysql_query("SELECT COUNT(*) as count FROM disputes WHERE company='".$this->mysqlCapture[5]->company."'");
$this->mysqlCapture[10] = mysql_query("DELETE FROM disputes WHERE company='".$this->mysqlCapture[5]->company."' LIMIT ".$this->mysqlCapture[9]->count."");
return true;
}
elseif($Disputes == false){
$this->mysqlCapture[11] = mysql_query("SELECT COUNT(*) as count FROM disputes WHERE company='".$this->mysqlCapture[5]->company."'");
$this->mysqlCapture[12] = mysql_fetch_object($this->mysqlCapture[11]);
if($this->mysqlCapture[12]->count > 0){
return false;
}
else{
return true;
}
}
$this->CountSql();
}
public function DeleteCity($city){
$this->mysqlCapture[1] = mysql_query("INSERT INTO adminlog SET('','$user','city');");
if(is_array($city)){
foreach($city as $deleteCity => $key){
$this->mysqlCapture[2][$key] = mysql_query("DELETE FROM citylist WHERE $deleteCity LIMIT 1");
}
}
$this->CountSql();
}
public function DeleteUser($user,$disputes){
$this->mysqlCapture[1] = mysql_query("INSERT INTO adminlog SET('','$user','user');");
$this->mysqlCapture[2] = mysql_query();
$this->CountSql();
}
public function DeleteIpLog(){
$this->mysqlCapture[1] = mysql_query("INSERT INTO adminlog SET('','$user','iplog');");
$this->mysqlCapture[2] = mysql_query();
$this->mysqlCapture[3] = mysql_query("DELETE FROM iplog");
$this->CountSql();
}
public function DisputeList($page){
$this->CountSql();
}
public function GetUserType($username){
$this->UserType = mysql_fetch_object(mysql_query("SELECT type FROM users WHERE username = '$username'"));
$this->CountSql();
}
public function IpBlock($ip){
$this->CountSql();
}
public function LogApproval($username,$type){
$this->time = date("Y:M:D:h:i:s");
$this->mysqlCapture[1] = mysql_query("INSERT INTO approvelog SET('','$this->time','$type','$username')");
if($this->mysqlCapture[1] == true){
return true;
}
else{
return false;
}
$this->CountSql();
}
public function LogDelete($username,$type){
switch (strtolower($type)) {
case 'approve':
break;
default:
break;
}
$this->CountSql();
}
public function ModifyCompany(){
$this->CountSql();
}
public function ModifyUser(){
$this->CountSql();
}
public function ModifyPost($pid){
$this->CountSql();
}
public function NewAdmin(){
$this->CountSql();
}
public function MoneyLog(){
$this->CountSql();
}
public function SiteStats(){
$this->CountSql();
}
public function TempDisputeList(){
try{
include '/templates/temp_disputes.tpl';
}
catch (Exception $e){
$this->Exception[1][1] = $e->getMessage();
$this->Exception[1][2] = $e->getCode();
$this->Exception[1][3] = $e->getTrace();
$this->Exception[1][4] = $e->getLine();
}
if(!empty($this->Exception[1])){
}
$this->CountSql();
}
public function CountSql(){
foreach($this->mysqlCapture as $mysqlCount){
$this->sqlCount++;
mysql_free_result($mysqlCount);
}
$this->CountSql();
}
public function UserCount(){
$this->CountSql();
}
public function UserList(){
$this->CountSql();
}
public function ViewSpamDisputes(){
$this->CountSql();
}
public function ViewAlerts(){
$this->CountSql();
}
public function ViewApproveLogs(){
$this->CountSql();
}
public function ViewApproveCity(){
$this->CountSql();
}
public function ViewIpLog(){
try{
include '/templates/ip_log.tpl';
}
catch (Exception $e){
$this->Exception[1][1] = $e->getMessage();
$this->Exception[1][2] = $e->getCode();
$this->Exception[1][3] = $e->getTrace();
$this->Exception[1][4] = $e->getLine();
}
$this->CountSql();
}
public function ApproveCompany(){
$this->CountSql();
}
}