ERROR: ".$dirName." Path is not valid. Please edit settings
";
}
else
{
echo "ERROR: Contact an admin the Path is not valid.
";
}
return;
}
$lastUser = "";
$arUserTorrent = array();
$arListTorrent = array();
while($entry = readdir($handle))
{
if ($entry != "." && $entry != "..")
{
if (is_dir($dirName."/".$entry))
{
// don''t do a thing
}
else
{
if (ereg($file_filter, $entry))
{
$key = filemtime($dirName."/".$entry).md5($entry);
$arList[$key] = $entry;
}
}
}
}
// sort the files by date
krsort($arList);
$count = -1;
foreach($arList as $entry)
{
$count++;
$output = "";
$displayname = $entry;
$show_run = true;
$torrentowner = getOwner($entry);
$owner = IsOwner($cfg["user"], $torrentowner);
$kill_id = "";
$estTime = " ";
$alias = getAliasName($entry).".stat";
$af = new AliasFile($dirName.$alias, $torrentowner);
$timeStarted = "";
$torrentfilelink = "";
if(!file_exists($dirName.$alias))
{
$af->running = "2"; // file is new
$af->size = getDownloadSize($dirName.$entry);
$af->WriteFile();
}
if(strlen($entry) >= 47)
{
// needs to be trimmed
$displayname = substr($entry, 0, 44);
$displayname .= "...";
}
// find out if any screens are running and take their PID and make a KILL option
foreach ($runningTorrents as $key => $value)
{
$rt = new RunningTorrent($value);
if ($rt->statFile == $alias) {
if ($kill_id == "")
{
$kill_id = $rt->processId;
}
else
{
// there is more than one PID for this torrent
// Add it so it can be killed as well.
$kill_id .= "|".$rt->processId;
}
}
}
// Check to see if we have a pid without a process.
if (is_file($cfg["torrent_file_path"].$alias.".pid") && empty($kill_id))
{
// died outside of tf and pid still exists.
@unlink($cfg["torrent_file_path"].$alias.".pid");
if(($af->percent_done < 100) && ($af->percent_done >= 0))
{
// The file is not running and the percent done needs to be changed
$af->percent_done = ($af->percent_done+100)*-1;
}
$af->running = "0";
$af->time_left = "Torrent Died";
$af->up_speed = "";
$af->down_speed = "";
// write over the status file so that we can display a new status
$af->WriteFile();
}
if ($cfg["enable_torrent_download"])
{
$torrentfilelink = "
";
}
$hd = getStatusImage($af);
$output .= "
![]() | ";
$output .= "![]() | ";
$output .= "
".$cfg["user"].": "._TORRENTFILE." | ";
echo "Size | ";
echo ""._USER." | ";
echo ""._STATUS." | ";
echo ""._ESTIMATEDTIME." | ";
echo ""._ADMIN." | ";
echo "
"._TORRENTFILE." | ";
echo "Size | ";
echo ""._USER." | ";
echo ""._STATUS." | ";
echo ""._ESTIMATEDTIME." | ";
echo ""._ADMIN." | ";
echo "
: |
|