<?PHP
//........................

$table = "$prefix" . "OBJECTS";
$editpage = "addobjects";
$return = "objects";

//........................

$SQL = "SELECT * from $table WHERE TITLE = ''";
$result = @mysql_query( $SQL ); while( $row = @mysql_fetch_array( $result ) ) {
        $dir = "../uploads/$row[ID]";
        removeDir($dir);
}

$sql = "DELETE FROM $table WHERE TITLE = ''";  mysql_query("$sql");

if (!empty($_GET['file'])) {
        $sql = "UPDATE $table SET MAINPHOTO = '$_GET[file]' WHERE ID = '$_GET[id]'";
        mysql_query("$sql");

}

//........................
?>

<form name="form" method="post" action="index.php?page=objects">

<span style="float:right;">

<input type="text" name="search" class="searchbox" style="width: 250px; margin-right: 5px;" value="<?php echo $_POST[search]; ?>">

<input type="submit" name="Submit" value="<?PHP /* (LANGUAGE) */ $t = "Search"; $f = "search"; include "langinc.php"; /* (LANGUAGE) */ ?>" class="deltabutton">

</span>

<h1><?PHP /* (LANGUAGE) */ $t = "Videos"; $f = "header"; include "langinc.php"; /* (LANGUAGE) */ ?></h1>

</form>

<form name="form" method="post" action="index.php?page=objects&delete=1">

<?php
//........................

include "delete.php";

if (!empty($_POST[search])) {
        $where = "WHERE MATCH (TITLE) AGAINST ('$_POST[search]' IN BOOLEAN MODE)";
}

if (empty($rowxxx[RECORDS]))
        $rowxxx[RECORDS] = 10;

$query1 = @mysql_query ("SELECT * FROM $table $where ORDER BY ID DESC");
$numrows = @mysql_num_rows ($query1);

if (!isset ($_GET['show']))
        $display = 1;
else
        $display = $_GET['show'];

$start = (($display * $rowxxx[RECORDS]) - $rowxxx[RECORDS]);
$query2 = @mysql_query ("SELECT * FROM $table $where ORDER BY ID DESC LIMIT $start,$rowxxx[RECORDS]");
while ($row = @mysql_fetch_array ($query2)) {     
$gotsomerecords = 1;

//........................
?>

<table style="margin-bottom: 15px;" width="100%" cellspacing="0" cellpadding="0">

<tr> 

<td class="primebox" width="100%">

<input title="<?PHP /* (LANGUAGE) */ $t = "Check to Delete"; $f = "checkboxtip"; include "langinc.php"; /* (LANGUAGE) */ ?>" style="float: right;" type="checkbox" name="<?php echo $row[ID]; ?>" value="<?php echo $row[ID]; ?>">

<span class="linklarge"><a href="index.php?page=<?php echo $editpage; ?>&id=<?php echo $row[ID]; ?>"> 

<?php echo $row[TITLE]; ?>

</a></span> 

<hr>

<a href="index.php?page=<?php echo $editpage; ?>&id=<?php echo $row[ID]; ?>&clone=1" title="<?PHP /* (LANGUAGE) */ $t = "Clone this Entry"; $f = "clonetip"; include "langinc.php"; /* (LANGUAGE) */ ?>"><img style="margin-top:5px;" class="thumb" src="http://<?php echo $_SERVER[HTTP_HOST]; ?>/webifycore/images/clone.png" width="32" height="32" border="0"></a>

<?php
//........................
$dir = opendir("../uploads/$row[ID]/thumbnails");
while ($file = readdir($dir)) {
        $pieces = explode(".", "$file");
        $ext = $pieces[1];
        if ($ext != htaccess && !empty($ext)) {
                if ($row[MAINPHOTO] == $file)
                        $mybutton = 'activethumb'; else $mybutton = 'thumb';
//........................
?>

<a title="<?PHP /* (LANGUAGE) */ $t = "Set this photo as the main photo"; $f = "setphototip"; include "langinc.php"; /* (LANGUAGE) */ ?>" href="index.php?page=objects&id=<?php echo $row[ID]; ?>&file=<?php echo $file; ?>"><img class="<?php echo $mybutton; ?>" src="../uploads/<?php echo $row[ID]; ?>/thumbnails/<?php echo $file; ?>" height="32" width="32" border="0"></a>

<?PHP 
        }
}
?>

</td>

</table>

<?php  } ?>

<?php
if (empty($gotsomerecords)) {
?>

<?PHP /* (LANGUAGE) */ $t = "No entries found. Click the <b>Add Video</b> button (above) to add your first video."; $f = "noentries"; include "langinc.php"; /* (LANGUAGE) */ ?>

<?PHP } else
        include "deletebar.php";
?>

</form>

<?PHP include "pagination.php"; ?>
