PageRenderTime 58ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/ui.lib.php

https://gitlab.com/x33n/ampache
PHP | 728 lines | 475 code | 112 blank | 141 comment | 86 complexity | 5f47c6e1ea21a31fb29a485fdd96e856 MD5 | raw file
  1. <?php
  2. /* vim:set softtabstop=4 shiftwidth=4 expandtab: */
  3. /**
  4. *
  5. * This contains functions that are generic, and display information
  6. * things like a confirmation box, etc and so forth
  7. *
  8. *
  9. * LICENSE: GNU General Public License, version 2 (GPLv2)
  10. * Copyright 2001 - 2015 Ampache.org
  11. *
  12. * This program is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU General Public License v2
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  24. *
  25. */
  26. /**
  27. * show_confirmation
  28. *
  29. * shows a confirmation of an action
  30. *
  31. * @param string $title The Title of the message
  32. * @param string $text The details of the message
  33. * @param string $next_url Where to go next
  34. * @param integer $cancel T/F show a cancel button that uses return_referrer()
  35. * @return void
  36. */
  37. function show_confirmation($title,$text,$next_url,$cancel=0,$form_name='confirmation',$visible=true)
  38. {
  39. if (substr_count($next_url,AmpConfig::get('web_path'))) {
  40. $path = $next_url;
  41. } else {
  42. $path = AmpConfig::get('web_path') . "/$next_url";
  43. }
  44. require AmpConfig::get('prefix') . '/templates/show_confirmation.inc.php';
  45. } // show_confirmation
  46. function sse_worker($url)
  47. {
  48. echo '<script type="text/javascript">';
  49. echo "sse_worker('$url');";
  50. echo "</script>\n";
  51. }
  52. /**
  53. * return_referer
  54. * returns the script part of the referer address passed by the web browser
  55. * this is not %100 accurate. Also because this is not passed by us we need
  56. * to clean it up, take the filename then check for a /admin/ and dump the rest
  57. */
  58. function return_referer()
  59. {
  60. $referer = $_SERVER['HTTP_REFERER'];
  61. if (substr($referer, -1)=='/') {
  62. $file = 'index.php';
  63. } else {
  64. $file = basename($referer);
  65. /* Strip off the filename */
  66. $referer = substr($referer,0,strlen($referer)-strlen($file));
  67. }
  68. if (substr($referer,strlen($referer)-6,6) == 'admin/') {
  69. $file = 'admin/' . $file;
  70. }
  71. return $file;
  72. } // return_referer
  73. /**
  74. * get_location
  75. * This function gets the information about a person's current location.
  76. * This is used for A) sidebar highlighting & submenu showing and B) titlebar
  77. * information. It returns an array of information about what they are currently
  78. * doing.
  79. * Possible array elements
  80. * ['title'] Text name for the page
  81. * ['page'] actual page name
  82. * ['section'] name of the section we are in, admin, browse etc (submenu)
  83. */
  84. function get_location()
  85. {
  86. $location = array();
  87. if (strlen($_SERVER['PHP_SELF'])) {
  88. $source = $_SERVER['PHP_SELF'];
  89. } else {
  90. $source = $_SERVER['REQUEST_URI'];
  91. }
  92. /* Sanatize the $_SERVER['PHP_SELF'] variable */
  93. $source = str_replace(AmpConfig::get('raw_web_path'), "", $source);
  94. $location['page'] = preg_replace("/^\/(.+\.php)\/?.*/","$1",$source);
  95. switch ($location['page']) {
  96. case 'index.php':
  97. $location['title'] = T_('Home');
  98. break;
  99. case 'upload.php':
  100. $location['title'] = T_('Upload');
  101. break;
  102. case 'localplay.php':
  103. $location['title'] = T_('Local Play');
  104. break;
  105. case 'randomplay.php':
  106. $location['title'] = T_('Random Play');
  107. break;
  108. case 'playlist.php':
  109. $location['title'] = T_('Playlist');
  110. break;
  111. case 'search.php':
  112. $location['title'] = T_('Search');
  113. break;
  114. case 'preferences.php':
  115. $location['title'] = T_('Preferences');
  116. break;
  117. case 'admin/index.php':
  118. $location['title'] = T_('Admin-Catalog');
  119. $location['section'] = 'admin';
  120. break;
  121. case 'admin/catalog.php':
  122. $location['title'] = T_('Admin-Catalog');
  123. $location['section'] = 'admin';
  124. break;
  125. case 'admin/users.php':
  126. $location['title'] = T_('Admin-User Management');
  127. $location['section'] = 'admin';
  128. break;
  129. case 'admin/mail.php':
  130. $location['title'] = T_('Admin-Mail Users');
  131. $location['section'] = 'admin';
  132. break;
  133. case 'admin/access.php':
  134. $location['title'] = T_('Admin-Manage Access Lists');
  135. $location['section'] = 'admin';
  136. break;
  137. case 'admin/preferences.php':
  138. $location['title'] = T_('Admin-Site Preferences');
  139. $location['section'] = 'admin';
  140. break;
  141. case 'admin/modules.php':
  142. $location['title'] = T_('Admin-Manage Modules');
  143. $location['section'] = 'admin';
  144. break;
  145. case 'browse.php':
  146. $location['title'] = T_('Browse Music');
  147. $location['section'] = 'browse';
  148. break;
  149. case 'albums.php':
  150. $location['title'] = T_('Albums');
  151. $location['section'] = 'browse';
  152. break;
  153. case 'artists.php':
  154. $location['title'] = T_('Artists');
  155. $location['section'] = 'browse';
  156. break;
  157. case 'stats.php':
  158. $location['title'] = T_('Statistics');
  159. break;
  160. default:
  161. $location['title'] = '';
  162. break;
  163. } // switch on raw page location
  164. return $location;
  165. } // get_location
  166. /**
  167. * show_preference_box
  168. * This shows the preference box for the preferences pages.
  169. */
  170. function show_preference_box($preferences)
  171. {
  172. require AmpConfig::get('prefix') . '/templates/show_preference_box.inc.php';
  173. } // show_preference_box
  174. /**
  175. * show_album_select
  176. * This displays a select of every album that we've got in Ampache (which can be
  177. * hella long). It's used by the Edit page and takes a $name and a $album_id
  178. */
  179. function show_album_select($name='album',$album_id=0,$allow_add=false,$song_id=0)
  180. {
  181. static $album_id_cnt = 0;
  182. // Generate key to use for HTML element ID
  183. if ($song_id) {
  184. $key = "album_select_" . $song_id;
  185. } else {
  186. $key = "album_select_c" . ++$album_id_cnt;
  187. }
  188. // Added ID field so we can easily observe this element
  189. echo "<select name=\"$name\" id=\"$key\">\n";
  190. $sql = "SELECT `id`, `name`, `prefix`, `disk` FROM `album` ORDER BY `name`";
  191. $db_results = Dba::read($sql);
  192. while ($r = Dba::fetch_assoc($db_results)) {
  193. $selected = '';
  194. $album_name = trim($r['prefix'] . " " . $r['name']);
  195. if ($r['disk'] >= 1) {
  196. $album_name .= ' [Disk ' . $r['disk'] . ']';
  197. }
  198. if ($r['id'] == $album_id) {
  199. $selected = "selected=\"selected\"";
  200. }
  201. echo "\t<option value=\"" . $r['id'] . "\" $selected>" . scrub_out($album_name) . "</option>\n";
  202. } // end while
  203. if ($allow_add) {
  204. // Append additional option to the end with value=-1
  205. echo "\t<option value=\"-1\">" . T_('Add New') . "...</option>\n";
  206. }
  207. echo "</select>\n";
  208. } // show_album_select
  209. /**
  210. * show_artist_select
  211. * This is the same as show_album_select except it's *gasp* for artists! How
  212. * inventive!
  213. */
  214. function show_artist_select($name='artist', $artist_id=0, $allow_add=false, $song_id=0, $allow_none=false)
  215. {
  216. static $artist_id_cnt = 0;
  217. // Generate key to use for HTML element ID
  218. if ($song_id) {
  219. $key = $name . "_select_" . $song_id;
  220. } else {
  221. $key = $name . "_select_c" . ++$artist_id_cnt;
  222. }
  223. echo "<select name=\"$name\" id=\"$key\">\n";
  224. if ($allow_none) {
  225. echo "\t<option value=\"-2\"></option>\n";
  226. }
  227. $sql = "SELECT `id`, `name`, `prefix` FROM `artist` ORDER BY `name`";
  228. $db_results = Dba::read($sql);
  229. while ($r = Dba::fetch_assoc($db_results)) {
  230. $selected = '';
  231. $artist_name = trim($r['prefix'] . " " . $r['name']);
  232. if ($r['id'] == $artist_id) {
  233. $selected = "selected=\"selected\"";
  234. }
  235. echo "\t<option value=\"" . $r['id'] . "\" $selected>" . scrub_out($artist_name) . "</option>\n";
  236. } // end while
  237. if ($allow_add) {
  238. // Append additional option to the end with value=-1
  239. echo "\t<option value=\"-1\">Add New...</option>\n";
  240. }
  241. echo "</select>\n";
  242. } // show_artist_select
  243. /**
  244. * show_tvshow_select
  245. * This is the same as show_album_select except it's *gasp* for tvshows! How
  246. * inventive!
  247. */
  248. function show_tvshow_select($name='tvshow', $tvshow_id=0, $allow_add=false, $season_id=0, $allow_none=false)
  249. {
  250. static $tvshow_id_cnt = 0;
  251. // Generate key to use for HTML element ID
  252. if ($season_id) {
  253. $key = $name . "_select_" . $season_id;
  254. } else {
  255. $key = $name . "_select_c" . ++$tvshow_id_cnt;
  256. }
  257. echo "<select name=\"$name\" id=\"$key\">\n";
  258. if ($allow_none) {
  259. echo "\t<option value=\"-2\"></option>\n";
  260. }
  261. $sql = "SELECT `id`, `name` FROM `tvshow` ORDER BY `name`";
  262. $db_results = Dba::read($sql);
  263. while ($r = Dba::fetch_assoc($db_results)) {
  264. $selected = '';
  265. if ($r['id'] == $tvshow_id) {
  266. $selected = "selected=\"selected\"";
  267. }
  268. echo "\t<option value=\"" . $r['id'] . "\" $selected>" . scrub_out($r['name']) . "</option>\n";
  269. } // end while
  270. if ($allow_add) {
  271. // Append additional option to the end with value=-1
  272. echo "\t<option value=\"-1\">Add New...</option>\n";
  273. }
  274. echo "</select>\n";
  275. } // show_tvshow_select
  276. function show_tvshow_season_select($name='tvshow_season', $season_id, $allow_add=false, $video_id=0, $allow_none=false)
  277. {
  278. if (!$season_id)
  279. return false;
  280. $season = new TVShow_Season($season_id);
  281. static $season_id_cnt = 0;
  282. // Generate key to use for HTML element ID
  283. if ($video_id) {
  284. $key = $name . "_select_" . $video_id;
  285. } else {
  286. $key = $name . "_select_c" . ++$season_id_cnt;
  287. }
  288. echo "<select name=\"$name\" id=\"$key\">\n";
  289. if ($allow_none) {
  290. echo "\t<option value=\"-2\"></option>\n";
  291. }
  292. $sql = "SELECT `id`, `season_number` FROM `tvshow_season` WHERE `tvshow` = ? ORDER BY `season_number`";
  293. $db_results = Dba::read($sql, array($season->tvshow));
  294. while ($r = Dba::fetch_assoc($db_results)) {
  295. $selected = '';
  296. if ($r['id'] == $season_id) {
  297. $selected = "selected=\"selected\"";
  298. }
  299. echo "\t<option value=\"" . $r['id'] . "\" $selected>" . scrub_out($r['season_number']) . "</option>\n";
  300. } // end while
  301. if ($allow_add) {
  302. // Append additional option to the end with value=-1
  303. echo "\t<option value=\"-1\">Add New...</option>\n";
  304. }
  305. echo "</select>\n";
  306. }
  307. /**
  308. * show_catalog_select
  309. * Yet another one of these buggers. this shows a drop down of all of your
  310. * catalogs.
  311. */
  312. function show_catalog_select($name='catalog',$catalog_id=0,$style='', $allow_none=false)
  313. {
  314. echo "<select name=\"$name\" style=\"$style\">\n";
  315. $sql = "SELECT `id`, `name` FROM `catalog` ORDER BY `name`";
  316. $db_results = Dba::read($sql);
  317. if ($allow_none) {
  318. echo "\t<option value=\"-1\">" . T_('None') . "</option>\n";
  319. }
  320. while ($r = Dba::fetch_assoc($db_results)) {
  321. $selected = '';
  322. if ($r['id'] == $catalog_id) {
  323. $selected = "selected=\"selected\"";
  324. }
  325. echo "\t<option value=\"" . $r['id'] . "\" $selected>" . scrub_out($r['name']) . "</option>\n";
  326. } // end while
  327. echo "</select>\n";
  328. } // show_catalog_select
  329. /**
  330. * show_album_select
  331. * This displays a select of every album that we've got in Ampache (which can be
  332. * hella long). It's used by the Edit page and takes a $name and a $album_id
  333. */
  334. function show_license_select($name='license',$license_id=0,$song_id=0)
  335. {
  336. static $license_id_cnt = 0;
  337. // Generate key to use for HTML element ID
  338. if ($song_id) {
  339. $key = "license_select_" . $song_id;
  340. } else {
  341. $key = "license_select_c" . ++$license_id_cnt;
  342. }
  343. // Added ID field so we can easily observe this element
  344. echo "<select name=\"$name\" id=\"$key\">\n";
  345. $sql = "SELECT `id`, `name` FROM `license` ORDER BY `name`";
  346. $db_results = Dba::read($sql);
  347. echo "\t<option value=\"-1\"></option>\n";
  348. while ($r = Dba::fetch_assoc($db_results)) {
  349. $selected = '';
  350. if ($r['id'] == $license_id) {
  351. $selected = "selected=\"selected\"";
  352. }
  353. echo "\t<option value=\"" . $r['id'] . "\" $selected>" . $r['name'] . "</option>\n";
  354. } // end while
  355. echo "</select>\n";
  356. } // show_license_select
  357. /**
  358. * show_user_select
  359. * This one is for users! shows a select/option statement so you can pick a user
  360. * to blame
  361. */
  362. function show_user_select($name,$selected='',$style='')
  363. {
  364. echo "<select name=\"$name\" style=\"$style\">\n";
  365. echo "\t<option value=\"\">" . T_('All') . "</option>\n";
  366. $sql = "SELECT `id`,`username`,`fullname` FROM `user` ORDER BY `fullname`";
  367. $db_results = Dba::read($sql);
  368. while ($row = Dba::fetch_assoc($db_results)) {
  369. $select_txt = '';
  370. if ($row['id'] == $selected) {
  371. $select_txt = 'selected="selected"';
  372. }
  373. // If they don't have a full name, revert to the username
  374. $row['fullname'] = $row['fullname'] ? $row['fullname'] : $row['username'];
  375. echo "\t<option value=\"" . $row['id'] . "\" $select_txt>" . scrub_out($row['fullname']) . "</option>\n";
  376. } // end while users
  377. echo "</select>\n";
  378. } // show_user_select
  379. /**
  380. * show_playlist_select
  381. * This one is for playlists!
  382. */
  383. function show_playlist_select($name,$selected='',$style='')
  384. {
  385. echo "<select name=\"$name\" style=\"$style\">\n";
  386. echo "\t<option value=\"\">" . T_('None') . "</option>\n";
  387. $sql = "SELECT `id`,`name` FROM `playlist` ORDER BY `name`";
  388. $db_results = Dba::read($sql);
  389. $nb_items = Dba::num_rows($db_results);
  390. $index = 1;
  391. $already_selected = false;
  392. while ($row = Dba::fetch_assoc($db_results)) {
  393. $select_txt = '';
  394. if (!$already_selected && ($row['id'] == $selected || $index == $nb_items)) {
  395. $select_txt = 'selected="selected"';
  396. $already_selected = true;
  397. }
  398. echo "\t<option value=\"" . $row['id'] . "\" $select_txt>" . scrub_out($row['name']) . "</option>\n";
  399. ++$index;
  400. } // end while users
  401. echo "</select>\n";
  402. } // show_playlist_select
  403. function xoutput_headers()
  404. {
  405. $output = isset($_REQUEST['xoutput']) ? $_REQUEST['xoutput'] : 'xml';
  406. if ($output == 'xml') {
  407. header("Content-type: text/xml; charset=" . AmpConfig::get('site_charset'));
  408. header("Content-Disposition: attachment; filename=ajax.xml");
  409. } else {
  410. header("Content-type: application/json; charset=" . AmpConfig::get('site_charset'));
  411. }
  412. header("Expires: Tuesday, 27 Mar 1984 05:00:00 GMT");
  413. header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  414. header("Cache-Control: no-store, no-cache, must-revalidate");
  415. header("Pragma: no-cache");
  416. }
  417. function xoutput_from_array($array, $callback = false, $type = '')
  418. {
  419. $output = isset($_REQUEST['xoutput']) ? $_REQUEST['xoutput'] : 'xml';
  420. if ($output == 'xml') {
  421. return xml_from_array($array, $callback, $type);
  422. } elseif ($output == 'raw') {
  423. $outputnode = $_REQUEST['xoutputnode'];
  424. return $array[$outputnode];
  425. } else {
  426. return json_from_array($array, $callback, $type);
  427. }
  428. }
  429. // FIXME: This should probably go in XML_Data
  430. /**
  431. * xml_from_array
  432. * This takes a one dimensional array and creates a XML document from it. For
  433. * use primarily by the ajax mojo.
  434. */
  435. function xml_from_array($array, $callback = false, $type = '')
  436. {
  437. $string = '';
  438. // If we weren't passed an array then return
  439. if (!is_array($array)) { return $string; }
  440. // The type is used for the different XML docs we pass
  441. switch ($type) {
  442. case 'itunes':
  443. foreach ($array as $key=>$value) {
  444. if (is_array($value)) {
  445. $value = xoutput_from_array($value, true, $type);
  446. $string .= "\t\t<$key>\n$value\t\t</$key>\n";
  447. } else {
  448. if ($key == "key") {
  449. $string .= "\t\t<$key>$value</$key>\n";
  450. } elseif (is_int($value)) {
  451. $string .= "\t\t\t<key>$key</key><integer>$value</integer>\n";
  452. } elseif ($key == "Date Added") {
  453. $string .= "\t\t\t<key>$key</key><date>$value</date>\n";
  454. } elseif (is_string($value)) {
  455. /* We need to escape the value */
  456. $string .= "\t\t\t<key>$key</key><string><![CDATA[$value]]></string>\n";
  457. }
  458. }
  459. } // end foreach
  460. return $string;
  461. case 'xspf':
  462. foreach ($array as $key=>$value) {
  463. if (is_array($value)) {
  464. $value = xoutput_from_array($value, true, $type);
  465. $string .= "\t\t<$key>\n$value\t\t</$key>\n";
  466. } else {
  467. if ($key == "key") {
  468. $string .= "\t\t<$key>$value</$key>\n";
  469. } elseif (is_numeric($value)) {
  470. $string .= "\t\t\t<$key>$value</$key>\n";
  471. } elseif (is_string($value)) {
  472. /* We need to escape the value */
  473. $string .= "\t\t\t<$key><![CDATA[$value]]></$key>\n";
  474. }
  475. }
  476. } // end foreach
  477. return $string;
  478. default:
  479. foreach ($array as $key => $value) {
  480. // No numeric keys
  481. if (is_numeric($key)) {
  482. $key = 'item';
  483. }
  484. if (is_array($value)) {
  485. // Call ourself
  486. $value = xoutput_from_array($value, true);
  487. $string .= "\t<content div=\"$key\">$value</content>\n";
  488. } else {
  489. /* We need to escape the value */
  490. $string .= "\t<content div=\"$key\"><![CDATA[$value]]></content>\n";
  491. }
  492. // end foreach elements
  493. }
  494. if (!$callback) {
  495. $string = '<?xml version="1.0" encoding="utf-8" ?>' .
  496. "\n<root>\n" . $string . "</root>\n";
  497. }
  498. return UI::clean_utf8($string);
  499. }
  500. } // xml_from_array
  501. function json_from_array($array, $callback = false, $type = '')
  502. {
  503. return json_encode($array);
  504. }
  505. /**
  506. * xml_get_header
  507. * This takes the type and returns the correct xml header
  508. */
  509. function xml_get_header($type)
  510. {
  511. switch ($type) {
  512. case 'itunes':
  513. $header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" .
  514. "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"\n" .
  515. "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" .
  516. "<plist version=\"1.0\">\n" .
  517. "<dict>\n" .
  518. " <key>Major Version</key><integer>1</integer>\n" .
  519. " <key>Minor Version</key><integer>1</integer>\n" .
  520. " <key>Application Version</key><string>7.0.2</string>\n" .
  521. " <key>Features</key><integer>1</integer>\n" .
  522. " <key>Show Content Ratings</key><true/>\n" .
  523. " <key>Tracks</key>\n" .
  524. " <dict>\n";
  525. return $header;
  526. case 'xspf':
  527. $header = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" .
  528. "<!-- XML Generated by Ampache v." . AmpConfig::get('version') . " -->";
  529. "<playlist version = \"1\" xmlns=\"http://xspf.org/ns/0/\">\n ".
  530. "<title>Ampache XSPF Playlist</title>\n" .
  531. "<creator>" . AmpConfig::get('site_title') . "</creator>\n" .
  532. "<annotation>" . AmpConfig::get('site_title') . "</annotation>\n" .
  533. "<info>". AmpConfig::get('web_path') ."</info>\n" .
  534. "<trackList>\n\n\n\n";
  535. return $header;
  536. default:
  537. $header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
  538. return $header;
  539. }
  540. } //xml_get_header
  541. /**
  542. * xml_get_footer
  543. * This takes the type and returns the correct xml footer
  544. */
  545. function xml_get_footer($type)
  546. {
  547. switch ($type) {
  548. case 'itunes':
  549. $footer = " </dict>\n" .
  550. "</dict>\n" .
  551. "</plist>\n";
  552. return $footer;
  553. case 'xspf':
  554. $footer = " </trackList>\n" .
  555. "</playlist>\n";
  556. return $footer;
  557. default:
  558. break;
  559. }
  560. } // xml_get_footer
  561. /**
  562. * toggle_visible
  563. * This is identical to the javascript command that it actually calls
  564. */
  565. function toggle_visible($element)
  566. {
  567. echo '<script type="text/javascript">';
  568. echo "toggleVisible('$element');";
  569. echo "</script>\n";
  570. } // toggle_visible
  571. function display_notification($message, $timeout = 5000)
  572. {
  573. echo "<script type='text/javascript'>";
  574. echo "displayNotification('" . $message . "', " . $timeout . ");";
  575. echo "</script>\n";
  576. }
  577. /**
  578. * print_bool
  579. * This function takes a boolean value and then prints out a friendly text
  580. * message.
  581. */
  582. function print_bool($value)
  583. {
  584. if ($value) {
  585. $string = '<span class="item_on">' . T_('On') . '</span>';
  586. } else {
  587. $string = '<span class="item_off">' . T_('Off') . '</span>';
  588. }
  589. return $string;
  590. } // print_bool
  591. /**
  592. * show_now_playing
  593. * This shows the now playing templates and does some garbage collecion
  594. * this should really be somewhere else
  595. */
  596. function show_now_playing()
  597. {
  598. Session::gc();
  599. Stream::gc_now_playing();
  600. $web_path = AmpConfig::get('web_path');
  601. $results = Stream::get_now_playing();
  602. require_once AmpConfig::get('prefix') . '/templates/show_now_playing.inc.php';
  603. } // show_now_playing
  604. function show_table_render($render = false, $force = false)
  605. {
  606. // Include table render javascript only once
  607. if ($force || !defined('TABLE_RENDERED')) {
  608. define('TABLE_RENDERED', 1);
  609. ?>
  610. <script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/tabledata.js" language="javascript" type="text/javascript"></script>
  611. <?php if (isset($render) && $render) { ?>
  612. <script language="javascript" type="text/javascript">sortPlaylistRender();</script>
  613. <?php
  614. }
  615. }
  616. }