Пример #1
0
 function getStreamByAjax()
 {
     global $cfg, $setctl, $phpenv;
     $out = '<table width="96%" align="center" cellpadding="0" cellspacing="0" border="0">';
     $res = $this->getlast($cfg['laststreamscount']);
     $out .= '<tr><td width="90%"></td><td width="10%"></td></tr>';
     $cnt = 0;
     $rows = db_num_rows($res);
     while ($row = db_fetch_assoc($res)) {
         $cnt++;
         $f2 = new file2($row['id'], true);
         $out .= '<tr><td';
         if ($cnt != $rows) {
             $out .= ' colspan="2"';
         }
         $out .= ' nowrap="nowrap"><a class="';
         if ($row['active']) {
             $out .= 'filemarked';
         } else {
             $out .= 'wtext';
         }
         $out .= '" ' . $f2->mkalink() . '>';
         if ($row['active'] && $row['cpercent'] != 0) {
             $out .= lzero($row['cpercent']) . '% ';
             $maxlen = $cfg['laststreambreak'] - 3;
         } else {
             $maxlen = $cfg['laststreambreak'] + 3;
         }
         $out .= checkchs($f2->gentitle(array('title', 'artist'), $maxlen), false);
         $out .= '</a>';
         if ($cnt == $rows && $setctl->get('publicrssfeed')) {
             $out .= '</td><td valign="bottom" align="right">' . '<a href="' . $setctl->get('streamurl') . $phpenv['streamlocation'] . '?streamrss=rss.xml"><img src="' . getimagelink('rss.gif') . '" border="0" alt="RSS"/></a>';
         }
         $out .= '</td></tr>';
     }
     if (!$cnt) {
         $out .= '<tr><td>' . get_lang(10) . '</td></tr>';
     }
     $out .= '</table>';
     return $out;
 }