Skip to content

Commit

Permalink
pull from server, as is. last timestamp is 9/17/2012
Browse files Browse the repository at this point in the history
  • Loading branch information
eaglstun committed Nov 29, 2017
0 parents commit 7a30187
Show file tree
Hide file tree
Showing 211 changed files with 30,114 additions and 0 deletions.
124 changes: 124 additions & 0 deletions controllers/admin/content.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?
class contentMVC extends Action{
function init(){
if(isset($_SESSION['userauth']) && $_SESSION['userauth'] & 64){
//all good
} else {
$this->Redirect();
}

$this->theme = "admin";

}

function indexAction(){

}

//viewing content by popularity
function popAction(){
$sort = (isset($_REQUEST['sort']) && $_REQUEST['sort'] == "DESC") ? "DESC" : "ASC" ;
$page = ( isset($_REQUEST['page']) ) ? $_REQUEST['page'] : "0" ;

$sql = "SELECT V.object, SUM(V.vote) as score, H.thumb, H.userid, U.user
FROM content_votes V
LEFT JOIN content_history H ON V.object = H.id
LEFT JOIN user_list U ON H.userid = U.id
GROUP BY object ORDER BY score $sort
LIMIT $page,40";

$res = $this->db->exec($sql);

$this->vars['list'] = $res;
$this->vars['sort'] = $sort;
$this->vars['sorto'] = ($sort == "ASC") ? "DESC" : "ASC" ;
$this->vars['page'] = $page;

$this->view = "admin/content-pop";
}

//viewing specific content details
function detAction(){
$id = $_REQUEST['id'];

$sql = "SELECT H.*, U.user FROM content_history H
LEFT JOIN user_list U
ON H.userid = U.id
WHERE H.id = '$id' LIMIT 1";
$res = $this->db->exec($sql);
$this->vars['det'] = $res[0];


//get voting info
$sql = "SELECT COUNT(*) as count, SUM(vote) as score
FROM content_votes WHERE object='$id'";
$res = $this->db->exec($sql);
$this->vars['votetotal'] = $res[0];

//get flagged info
$sql = "SELECT COUNT(*) as flags FROM content_flag WHERE object = '$id'";
$res = $this->db->exec($sql);
$this->vars['flags'] = $res[0]['flags'];

$this->view = "admin/content-detail";
}

//delete an image
function removeAction(){
$this->disableLayout();

$id = $_REQUEST['id'];

//load location of picture
$sql = "SELECT * FROM content_history
WHERE `id` = '$id' LIMIT 1";
$res = $this->db->exec($sql);
$res = $res[0];

//delete votes records
$sql = "DELETE FROM content_votes
WHERE `object` = '$id'";

$this->db->execute($sql);
dbug($sql);

//delete comments records
$sql = "DELETE FROM content_comments
WHERE `object` = '$id'";

$this->db->execute($sql);
dbug($sql);

//delete flags
$sql = "DELETE FROM content_flag
WHERE `object` = '$id'";

$this->db->execute($sql);
dbug($sql);

//delete location records
for($c = $res['tableCol']; $c <= $res['tableCol'] + 1; $c++ ){
for($r = $res['tableRow']; $r <= $res['tableRow'] + 1; $r++){
$tableX = str_pad( $c , 2, "0", STR_PAD_LEFT);
$tableY = str_pad( $r , 2, "0", STR_PAD_LEFT);

$table = "c".$tableX."r".$tableY;

$sql = "DELETE FROM mile_mile.$table
WHERE `historyId` = '$id'";

$this->db->execute($sql);
dbug($sql);
}
}


//delete master history record
$sql = "DELETE FROM content_history
WHERE `id` = '$id'";

$this->db->execute($sql);
dbug($sql);
}
}
?>
40 changes: 40 additions & 0 deletions controllers/fix.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?
class fixMVC extends Action{
function indexAction(){

}

//clear all history and mile entries ! oh noes
function eraseAction(){
/*
ob_end_clean();
$this->disableLayout();
//delete the history
$sql = "DELETE FROM history";
$this->db->execute($sql);
//delete the current active
$sql = "DELETE FROM user_currentActive";
$this->db->execute($sql);
//delete the friends
$sql = "DELETE FROM user_friends";
$this->db->execute($sql);
for($c=0; $c<63; $c++){
for($r=0; $r<63; $r++){
$col = str_pad($c, 2, '0', STR_PAD_LEFT);
$row = str_pad($r, 2, '0', STR_PAD_LEFT);
$sql = "DELETE FROM mile_mile.c".$col."r".$row;
echo $sql."<br>";
$this->db->execute($sql);
}
}
die();
*/
}
}
Loading

0 comments on commit 7a30187

Please sign in to comment.