source: extensions/music_player/admin/admin_suppr.php @ 3329

Last change on this file since 3329 was 3329, checked in by flop25, 16 years ago

first commit

File size: 2.7 KB
RevLine 
[3329]1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4$m_p = get_plugin_data('music_player');
5
6global $conf, $template, $lang, $page;
7global $prefixeTable;
8        load_language('plugin.lang', $m_p->plugin_path);
9$mp_msgs = array();
10
11// +----------------------------------------+
12// |              Contenu                   |
13// +----------------------------------------+
14
15if (!isset($_POST['envoi']))
16{
17
18    $template->append('suppr', array('ID'=>$_GET['id']) );
19}
20
21elseif ($_POST['envoi']=="suppr")
22{
23
24 if ($_POST['type_suppr']=="suppr_folder")
25 {
26  $query = 'SELECT type FROM '.MP_PLAYLIST.' WHERE id IN (\''.$_POST['id'].'\') ;';
27  $result = pwg_query($query);
28  $typ = mysql_fetch_assoc($result);
29  if ($typ['type']=="local")
30  {
31    $query = 'SELECT url FROM '.MP_PLAYLIST.' WHERE id IN (\''.$_POST['id'].'\') ;';
32    $result = pwg_query($query);
33    $dt = mysql_fetch_assoc($result);
34    $filename="./plugins/music_player/music/".$dt['url']."/";
35    if (file_exists($filename))
36    {
37      if (is_dir($filename))
38     {
39      $id_dossier = opendir($filename);
40        while($element = readdir($id_dossier))
41        {
42          if ($element != "." && $element != "..")
43          unlink($filename."/".$element);
44        }
45       closedir($id_dossier);
46       rmdir($filename);
47       }
48     else unlink($filename);
49     } 
50  }//if local
51  elseif ($typ['type']=="externe")
52  {
53    $filename="./plugins/music_player/music/externe/".$_POST['id'].".php";
54    if (file_exists($filename))
55    {
56      unlink($filename);
57        }
58  }//if externe
59 
60  if (!file_exists($filename))
61  {
62  //$mp_msgs[] = $lang['mp_msg_suppr1'];
63  $page['infos'][]=l10n('mp_msg_suppr1');
64  }
65  else
66  {
67  //$mp_msgs[] = $lang['mp_msg_suppr2'];
68  $page['infos'][]=l10n('mp_msg_suppr2');
69  }
70 }
71 
72   $query = '
73DELETE FROM '.MP_PLAYLIST.'
74  WHERE id IN (\''.$_POST['id'].'\')
75;';
76  pwg_query($query);
77   $query = '
78DELETE FROM '.MP_MUSIC.'
79  WHERE pl_id IN (\''.$_POST['id'].'\')
80;';
81  pwg_query($query);
82 
83  //$mp_msgs[] = $lang['mp_msg_suppr3'];
84  $page['infos'][]=l10n('mp_msg_suppr3');
85}
86
87// +-----------------------------------------------------------------------+
88// |               affichage des msg                                       |
89// +-----------------------------------------------------------------------+
90/*
91if (count($mp_msgs) > 0)
92{
93  $template->append('mp_msgs',array());
94  foreach ($mp_msgs as $mp_msg)
95  {
96    $template->append('mp_msgs.mp_msg',
97                                 array('MP_MSG'=>$mp_msg));
98  }
99}
100*/
101$template->set_filename('plugin_admin_content', $m_p->plugin_path.'template/admin_suppr.tpl');
102$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
103
104
105?>
Note: See TracBrowser for help on using the repository browser.