5 Jappix - An open social platform
6 This is the store configuration POST handler (manager)
8 -------------------------------------------------
12 Last revision: 28/12/10
16 // Someone is trying to hack us?
17 if(!defined('JAPPIX_BASE'))
21 if(isset($_POST['upload'])) {
23 $name_music = $_FILES['music_file']['name'];
24 $temp_music = $_FILES['music_file']['tmp_name'];
26 // Any special name submitted?
27 if(isset($_POST['music_title']) && !empty($_POST['music_title'])) {
29 $music_title = $_POST['music_title'];
31 // Get the file extension
32 $ext_music = getFileExt($name_music);
37 // Add the artist name?
38 if(isset($_POST['music_artist']) && !empty($_POST['music_artist'])) {
40 $music_artist = $_POST['music_artist'];
42 // Add the current POST var to the global string
43 $name_music .= $_POST['music_artist'].' - ';
46 // Add the music title
47 $name_music .= $_POST['music_title'];
49 // Add the album name?
50 if(isset($_POST['music_album']) && !empty($_POST['music_album'])) {
52 $music_album = $_POST['music_album'];
54 // Add the current POST var to the global string
55 $name_music .= ' ['.$_POST['music_album'].']';
59 $name_music .= '.'.$ext_music;
62 // Music path with new name
63 $path_music = JAPPIX_BASE.'/store/music/'.$name_music;
66 if(!isSafe($name_music) || $_FILES['music_file']['error'] || !move_uploaded_file($temp_music, $path_music)) { ?>
68 <p class="info smallspace fail"><?php _e("The music could not be received, please retry!"); ?></p>
73 else if(!preg_match('/^(.+)(\.(og(g|a)|mp3|wav))$/i', $name_music)) {
74 // Remove the image file
75 if(file_exists($path_music))
79 <p class="info smallspace fail"><?php _e("This is not a valid music file, please encode in Ogg Vorbis, MP3 or WAV!"); ?></p>
83 // The file has been sent
86 <p class="info smallspace success"><?php _e("Your music has been added!"); ?></p>
89 // Reset the form vars
97 else if(isset($_POST['remove']))