Changeset 4 for www/share/playlist.php


Ignore:
Timestamp:
Jan 14, 2008, 9:48:39 PM (17 years ago)
Author:
george
Message:

Upraveno: Změna přístupu k databázi na třídu rozšířenou mysqli.
Upraveno: Sjednocení
Upraveno: Změna kódování všech stránek na UTF-8.
Odstraňeno: Staré nepotřebné soubory.

Location:
www
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • www

    • Property svn:ignore set to
      config.php
      php_script_error.log
  • www/share/playlist.php

    r1 r4  
    1 <?
    2 include('../is/db.php');
     1<?php
     2include('../global.php');
    33// Omezení na online/offline uµivatele
    4 DB_Init('localhost','root','','is');
    54
    6 DB_Query('SELECT id FROM hosts WHERE online=1 AND block=0 AND user>0');
     5$DbResult = $Database->query('SELECT id FROM hosts WHERE online=1 AND block=0 AND user>0');
    76$Vyber = '';
    87$Podminka = '';
    9 while($Row = DB_Row()) $Vyber .= $Row['id'].',';
    10   $Podminka .= ' AND (host IN ('.substr($Vyber,0,-1).'))';
     8while($Row = $DbResult->fetch_array())
     9  $Vyber .= $Row['id'].',';
     10$Podminka .= ' AND (host IN ('.substr($Vyber,0,-1).'))';
    1111//echo($Podminka.'<br>');
    1212
    13 DB_Init('localhost', 'root', '', 'share');
     13$Database->select_db('share');
    1414
    1515// Maximální vnoøení
     
    1919function PlnaCesta($Row)
    2020{
    21   global $MaxNesting;
     21  global $MaxNesting, $Database;
     22 
    2223  // Vyhledání cesty
    2324  $Otec = $Row['parent'];
    2425  $Cesta = ''; //$Row['name'];
    25   DB_Save();
    2626  $i = 0;
    2727  while(($Otec>1)&&($i<$MaxNesting))
    2828  {
    29     DB_Query("SELECT id,name,parent FROM items WHERE id=$Otec");
    30     $Row = DB_Row();
     29    $DbResult = $Database->query("SELECT id,name,parent FROM items WHERE id=$Otec");
     30    $Row = $DbResult->fetch_array();
    3131    $Cesta = $Row['name'].'\\'.$Cesta;
    3232    $Otec = $Row['parent'];
    3333    $i++;
    3434  }
    35   DB_Load();
    3635  if($i >= $MaxNesting) $Cesta = '?'.'\\'.$Cesta;
    3736  return('\\\\'.$Cesta);
    3837}
    3938
     39function mime_content_type($FileName)
     40{
     41  //$FileInfo = new finfo(FILEINFO_MIME);
     42  //return($FileInfo->file($FileName));
     43  return('');
     44}
     45
    4046$Name = 'playlist.m3u';
    41 Header('Content-type: '+mime_content_type($Name));
     47Header('Content-type: audio/x-mpegurl');
    4248Header('Content-Disposition: attachment; filename='.$Name);
    4349echo("#EXTM3U\n");
    4450$Parent = '0';
    4551$Dir = '';
    46 DB_Select('items', '*', 'ext="mp3"'.$Podminka); //.' LIMIT 0,1000');
    47 while($Row = DB_Row())
     52$DbResult = $Database->select('items', '*', 'ext="mp3"'.$Podminka); //.' LIMIT 0,1000');
     53while($Row = $DbResult->fetch_array())
    4854{
    49   DB_Save();
    5055  if($Parent != $Row['parent']) $Dir = PlnaCesta($Row); //echo('d'.PlnaCesta($Row)."\n");
    5156  $Parent = $Row['parent'];
    5257  echo($Dir.$Row['name'].'.'.$Row['ext']."\n");
    53   DB_Load();
    5458}
    5559
Note: See TracChangeset for help on using the changeset viewer.