fclose ($handle);
}
- if ($counter == 0 && file_exists ( VAR_FILES . $md5))
+ if ($counter == 0)
{
- unlink ( VAR_FILES . $md5);
+ if (file_exists (VAR_FILES . $md5))
+ unlink ( VAR_FILES . $md5);
+ if (file_exists (VAR_FILES . $md5 . '_count'))
unlink ( VAR_FILES . $md5. '_count');
}
}
foreach ($links_dir as $link)
{
- if (strcmp ($link, '.') == 0 || strcmp ($link, '..') == 0)
+ if (strcmp ($link, '.') == 0 || strcmp ($link, '..') == 0 ||
+ preg_match ('/\.tmp/i', "$link"))
continue;
/* Read link informations. */
$l = jirafeau_get_link ($link);
echo '</tr>';
foreach ($links_dir as $link)
{
- if (strcmp ($link, '.') == 0 || strcmp ($link, '..') == 0)
+ if (strcmp ($link, '.') == 0 || strcmp ($link, '..') == 0 ||
+ preg_match ('/\.tmp/i', "$link"))
continue;
/* Read link informations. */
$l = jirafeau_get_link ($link);
foreach ($links_dir as $link)
{
- if (strcmp ($link, '.') == 0 || strcmp ($link, '..') == 0)
+ if (strcmp ($link, '.') == 0 || strcmp ($link, '..') == 0 ||
+ preg_match ('/\.tmp/i', "$link"))
continue;
/* Read link informations. */
$l = jirafeau_get_link ($link);
- if ($l['time'] > 0 && $l['time'] < time ())
+ if ($l['time'] > 0 && $l['time'] < time () || // expired
+ !file_exists (VAR_FILES . $l['md5']) || // invalid
+ !file_exists (VAR_FILES . $l['md5'] . '_count')) // invalid
{
- echo 'HAAAA' . $l['time'] . '-->' . time ();
jirafeau_delete ($link);
$c++;
}