PageRenderTime 46ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/patches/Servicios/sbin/www/rc/nowplaying.php

https://github.com/frisco82/HMR600.com-Firmware
PHP | 116 lines | 107 code | 6 blank | 3 comment | 18 complexity | 4291697e61b3892e1d5d51f3b6044192 MD5 | raw file
  1. <?
  2. error_reporting(0);
  3. session_start();
  4. $_SESSION['redirect'] = $_SERVER['REQUEST_URI'];
  5. include "../chooselang.php";
  6. include '/tmp/lang.php';
  7. $file = "/usr/local/etc/setup.php";
  8. $fp = fopen($file, 'r');
  9. $fileData = fread($fp, filesize($file));
  10. fclose($fp);
  11. $line = explode("\n", $fileData);
  12. $i = 1;
  13. while ($i <= 5) {
  14. $dataPair = explode('=', $line[$i]);
  15. if ($dataPair[0] == "Login" && $dataPair[1] == "true") {
  16. if ($_SESSION['loggedIn'] != 1) {
  17. //header("Location:../login_form.php");
  18. echo "<script>document.location.href='../login_form.php'</script>";
  19. exit;
  20. }
  21. }
  22. $i++;
  23. }
  24. exec("echo -n '*' >> /tmp/ir");
  25. usleep(300000);
  26. $file1 = "/tmp/nowstatus";
  27. $fp1 = fopen($file1, 'r');
  28. $fileData1 = fread($fp1, filesize($file1));
  29. fclose($fp1);
  30. $line1 = explode("\n", $fileData1);
  31. $type = $line1[1];
  32. $playing = substr(strrchr($line1[2], '/'), 1);
  33. if (substr($line1[2], 0, 12) == "/tmp/myshare"){ //for NetShare
  34. $cur_dir = substr($line1[2], 12, strrpos($line1[2], '/')-12);
  35. $playing_file = '../media3'.rawurlencode($cur_dir).'/'.rawurlencode($playing);
  36. $path = '../media3'.$cur_dir;
  37. }else{ //for HDD files
  38. $cur_dir = substr($line1[2], 18, strrpos($line1[2], '/')-18);
  39. $playing_file = '../media2'.rawurlencode($cur_dir).'/'.rawurlencode($playing);
  40. $path = '../media2'.$cur_dir;
  41. //echo "<script>alert('$path');</script>";
  42. }
  43. $file_without_ext = substr($playing, 0, strrpos($playing, '.'));
  44. //echo "<script>alert('$file_without_ext');</script>";
  45. $shufl_seq = $line1[3];
  46. $repeat = $line1[4];
  47. $time = $line1[5];
  48. ?>
  49. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  50. <html xmlns="http://www.w3.org/1999/xhtml" >
  51. <head>
  52. <title>XtreamerPro</title>
  53. <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
  54. <meta name="apple-mobile-web-app-capable" content="yes" />
  55. <meta names="apple-mobile-web-app-status-bar-style" content="black-translucent" />
  56. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  57. <link href="statics/styles/general.css" rel="stylesheet" type="text/css" />
  58. <script src="statics/scripts/panel_funcs.js"></script>
  59. <script src="statics/scripts/global.js"></script>
  60. </head>
  61. <body>
  62. <img id="progressImg" src="statics/images/wifi_icon.png" />
  63. <map name="nowplayingPage">
  64. <area shape="rect" coords="112,1,2,63" title="<?echo $STR_Sub_panel;?>" href="#" onclick="goTo('fGotosub')">
  65. <area shape="rect" coords="317,2,205,65" title="<?echo $STR_Refresh;?>" href="#" onclick="goTo('fShowNowPlaying')">
  66. <area shape="rect" coords="200,0,116,117" title="<?echo $STR_Main;?>" href="#" onclick="goTo('fShowMainControl')">
  67. <area shape="rect" coords="42,68,-1,113" title="Previous" href="#" onclick="goTo('fPrevious')">
  68. <area shape="rect" coords="111,66,44,115" title="Play/Pause" href="#" onclick="goTo('fPlay')">
  69. <area shape="rect" coords="261,67,205,115" title="Stop" href="#" onclick="goTo('fStop')">
  70. <area shape="rect" coords="318,69,263,115" title="Next" href="#" onclick="goTo('fNext')">
  71. </map>
  72. <img src="statics/images/nowplaying.png" border="0" usemap="#nowplayingPage"/>
  73. <div id="cover">
  74. <?if($type == "Video"){
  75. if(file_exists($path.'/'. $file_without_ext. '.jpg')){
  76. echo "<a href='$path/$file_without_ext.jpg'><img src='$path/$file_without_ext.jpg' width='146px' height='213px' title='$playing' border='0' /></a>";
  77. }else if(file_exists($path.'/Cover.jpg')){
  78. echo "<a href='$path/Cover.jpg'><img src='$path/Cover.jpg' width='146px' height='213px' title='$playing' border='0' /></a>";
  79. }else if(file_exists($path.'/folder.jpg')){
  80. echo "<a href='$path/folder.jpg'><img src='$path/folder.jpg' width='146px' height='213px' title='$playing' border='0' /></a>";
  81. }else{
  82. echo "<a href='statics/images/movie_coverart.png'><img src='statics/images/movie_coverart.png' width='146px' height='213px' title='Video' border='0' /></a>";
  83. }
  84. }else if($type == "Music"){
  85. if(file_exists('../mp3jacket')){
  86. echo "<a href='../mp3jacket'><img src='../mp3jacket' width='146px' height='213px' title='Audio' border='0' /></a>";
  87. }else{
  88. echo "<a href='statics/images/music_coverart.png'><img src='statics/images/music_coverart.png' width='146px' height='213px' title='Audio' border='0' /></a>";
  89. }
  90. }else if($type == "Photo"){
  91. echo "<a href='$playing_file'><img src='$playing_file' width='146px' height='213px' title='$playing' border='0' /></a>";
  92. }
  93. ?>
  94. </div>
  95. <div id="nowplayingproperties">
  96. <div class="ttl">Title:</div>
  97. <div id="npName"><?echo "<a href='$playing_file'>$playing</a>";?></div>
  98. <br />
  99. <div class="ttl">Time:</div>
  100. <div id="nptime"><?echo $time;?></div>
  101. <br />
  102. <div class="ttl">Shuffle:</div>
  103. <div id="shuffle"><?echo $shufl_seq;?></div>
  104. <br />
  105. <div class="ttl">Repeat:</div>
  106. <div id="repeat"><?echo $repeat;?></div>
  107. </div>
  108. <iframe name='gframe' width=0 height=0 style="display:none"></iframe>
  109. </body>
  110. </html>