예제 #1
0
파일: index.php 프로젝트: TheFox/phpdl
 smartyAssignMenu($smarty, $user);
 $dbh = dbConnect();
 $users = getDbTable($dbh, 'users');
 $packet = new dlpacket($CONFIG['DB_HOST'], $CONFIG['DB_NAME'], $CONFIG['DB_USER'], $CONFIG['DB_PASS']);
 $stack = '';
 $res = mysql_query("select id from packets where archive = '1' order by id desc;", $dbh);
 $packetNum = mysql_num_rows($res);
 $packetC = 0;
 while ($row = mysql_fetch_assoc($res)) {
     if ($packet->reloadById($row['id'])) {
         $packetC++;
         $packet->loadFiles();
         $packetFilesFinished = $packet->filesFinished();
         $packetFilesC = $packet->filesC();
         $packetFilesFinishedPercent = 0;
         $packetFilesErrorsTypes = $packet->getFilesErrorsTypes();
         if ($packetFilesC) {
             $packetFilesFinishedPercent = (int) ($packetFilesFinished / $packetFilesC * 100);
         }
         $trClass = '';
         $status = array();
         if (!$packet->get('stime')) {
             $status[] = 'not started';
         } elseif ($packet->get('stime') && !$packet->get('ftime')) {
             $status[] = 'not finished';
         } elseif ($packet->get('stime') && $packet->get('ftime')) {
             $trClass = 'packetHasFinished';
             $status[] = 'finished';
         }
         if ($packetFilesErrorsTypes) {
             $trClass = 'packetHasError';