Location: PHPKode > projects > Kwalbum > kwalbum/pages/AdminMissingFilesPage.html.php
<?php
/*
 * Created on Sep 24, 2008
 * 2.0
 */
require_once 'include/funcGetImageCode.php';
?>
<big><b><a href='<?=$url?>p=Admin'>Admin Options:</a> Check for Missing Files</b></big>
<p>
base directory: <?=PICS_PATH?>
<table border='0'>
<?php
$i = 0;
while ($item = $result->fetch_array(MYSQLI_ASSOC))
{
	$missing = '';
	switch ($item['ItemTypeId'])
	{
		case DESCRIPTION_ONLY:
			break;
		case IMAGETYPE_JPEG:
			if (!file_exists(PICS_PATH.$item['ItemPath'].'t/'.$item['ItemFilename']))
				$missing .= 'thumbnail&nbsp;missing<br/>';
			elseif (!filesize(PICS_PATH.$item['ItemPath'].'t/'.$item['ItemFilename']))
				$missing .= 'thumbnail&nbsp;0&nbsp;bytes';
			if (!file_exists(PICS_PATH.$item['ItemPath'].'r/'.$item['ItemFilename']))
				$missing .= 'resize&nbsp;missing<br/>';
			elseif (!filesize(PICS_PATH.$item['ItemPath'].'r/'.$item['ItemFilename']))
				$missing .= 'resize&nbsp;0&nbsp;bytes';
		default:
			if (!file_exists(PICS_PATH.$item['ItemPath'].$item['ItemFilename']))
				$missing .= 'original&nbsp;missing<br/>';
			elseif (!filesize(PICS_PATH.$item['ItemPath'].$item['ItemFilename']))
				$missing .= 'original&nbsp;0&nbsp;bytes';
	}
	if ($missing)
	{
		$highlight = ++$i % 2;
		echo "<tr><td ".($highlight ? "class='cell'" : "align='center'").">{$missing}</td>" .
			"<td ".($highlight ? "class='cell'" : "align='center'").">".GetImageCode($item['ItemPath'], $item['ItemFilename'], $item['ItemTypeId'])."</td>" .
			"<td ".($highlight ? "class='cell'" : "align='center'").">{$item['ItemPath']}<a href='{$url}i={$item['ItemId']}'>{$item['ItemFilename']}</a></td>" .
			"<td ".($highlight ? "class='cell'" : "align='center'").">$item[ItemDate]<br/>$item[ItemTime]</td>" .
			"<td ".($highlight ? "class='cell'" : "align='center'").">$item[Location]</td>";
		echo '</tr>';
		flush();
	}
}
?>
</table>
<?=(0 == $i ? 'No items were found that are missing files.  Hurray!' : null)?>
</p>
Return current item: Kwalbum