spsp_editor /admin/app/controllers/musics_controller.php

Language PHP Lines 493
MD5 Hash 2efae988d690ba6e4cc30296632accf8 Estimated Cost $7,525 (why?)
Repository https://bitbucket.org/fxrialab/spsp_editor View Raw File View Project SPDX
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
<?php
class MusicsController extends AppController
{
	var $name='Musics';
	var $components = array('Pagination');
	var $helpers = array('Pagination', 'error');
	function manageusermusic()
	{
		$this->checkSession();
		$this->layout = 'default_user';
	}
	
	function view_musicgroup($id=null , $uid=null)
	{
		$this->checkSession();
		$this->layout = 'default_user';
	}
	function usermusicdetails($pid=null)
	{
		$this->checkSession();
		$this->layout = 'default_user';
		
	}

	function add_music()
	{
		$this->checkSession();
		$this->layout = 'default_user';
				
	/* Grtting the Music caltegory*/
		$music_cat = array();
		$music_cat[0] = "Select Category";
		$select_music_category = mysql_query("Select * from music_categories");
		while($select_music_category_res = mysql_fetch_array($select_music_category))
		{
			$music_cat[$select_music_category_res['id']] = $select_music_category_res['music_cat_name'] ;
		}
		$this->set('music_category',$music_cat);
		
	}
	function addmusicstep2()
	{
		$this->checkSession();
		$this->layout = 'default_user';
		
		if (!empty($this->data))
		{
			$this->data['Music']['user_id'] = $_REQUEST['musicuser'];
			if($_REQUEST['category']==0)
				$this->data['Music']['music_categorie_id'] = 1;
				
			$this->data['Music']['music_categorie_id'] = $_REQUEST['category'];
			
			if ($this->Music->save($this->data))
			{
				$music_id = $this->Music->getLastInsertId();
				$this->redirect('/musics/add_musicstep2?uid='.$_REQUEST['musicuser'].'&pid='.$music_id);
			}
	  	}
		
	}
	function add_musicstep2()
	{
		$this->checkSession();
		$this->layout = 'default_user';
	}
	function delete_musicgroup($id=null)
	{
		$this->checkSession();
		if(isset($_REQUEST['box']))
		{
		/////IF SEARCH IS COLLECTIVE OR CHOSEN BY ADMIN SELECTION//////
		
			$arr = $_REQUEST['box'];
			foreach($arr as $key => $value)
			{
				$sql_det = "delete from `musics` where `user_id` = '".$value."'";
				$res_det = mysql_query($sql_det);
			}
		}
		////IF DELETE IS FOR A SPECIFIC USER////
		else
		{
			$user_id=$_REQUEST['id'];
			$this->data['Music']['menu'] = $_REQUEST['menu'];
			$sql_det = "delete from `musics` where `user_id` = '".$user_id."'";
			$res_det = mysql_query($sql_det);
		}
		//$user_id=$_REQUEST['id'];
		$this->data['Music']['menu'] = $_REQUEST['menu'];
		if(isset($_REQUEST['page']))
		{
			$page = $_REQUEST['page'];
		}
		$this->flash('The post with id: '.$id.' has been deleted.', '/posts');
		$this->redirect('/musics/manageusermusic?menu='.$this->data['Music']['menu'].'&page='.$page);
	}
	
	function managehotmusic()
	{
		$this->checkSession();
		$this->layout = 'default_user';
		
	}
	function edithotmusic()
	{
		$this->checkSession();
		$this->layout = 'default_user';
		
		
		$music_cat = array();
		$music_cat[0] = "Select Category";
		$select_music_category = mysql_query("Select * from music_categories");
		while($select_music_category_res = mysql_fetch_array($select_music_category))
		{
			$music_cat[$select_music_category_res['id']] = $select_music_category_res['music_cat_name'] ;
		}
		$this->set('music_category',$music_cat);

	}
	function saveedithotmusic()
	{
		$update_sql = "Update music_hot set title='".$_REQUEST['mustitle']."' , music_id =".$_REQUEST['musicinfo']." where id=".$_REQUEST['hid']."";
		mysql_query($update_sql);
		$this->redirect('/musics/edithotmusicphoto?id='.$_REQUEST['hid']);
	}
	function edithotmusicphoto()
	{
		$this->checkSession();
		$this->layout = 'default_user';
	}
	function listenhotmusic()
	{
		$this->checkSession();
		$this->layout = 'default_user';
	}
	function delhotmusic()
	{
		$this->checkSession();
		$this->layout = 'default_user';
		/* delete hot music */
		$delhot = mysql_query("Delete From music_hot where id=".$_REQUEST['id']."");
		
		$this->redirect('/musics/managehotmusic?menu='.$_REQUEST['menu']);

	}
	function delete_hotmusicgroup()
	{
		$this->checkSession();
		if(isset($_REQUEST['box']))
		{
		/////IF SEARCH IS COLLECTIVE OR CHOSEN BY ADMIN SELECTION//////
		
			$arr = $_REQUEST['box'];
			foreach($arr as $key => $value)
			{
				$sql_det = "delete from `music_hot` where `id` = '".$value."'";
				$res_det = mysql_query($sql_det);
			}
		}
		////IF DELETE IS FOR A SPECIFIC USER////
		else
		{
			$user_id=$_REQUEST['id'];
			$this->data['Music']['menu'] = $_REQUEST['menu'];
			 $sql_det = "delete from `music_hot` where `id` = '".$user_id."'";
			$res_det = mysql_query($sql_det);
		}
		//$user_id=$_REQUEST['id'];
		$this->data['Music']['menu'] = $_REQUEST['menu'];
		if(isset($_REQUEST['page']))
		{
			$page = $_REQUEST['page'];
		}
		$this->flash('The post with id: '.$id.' has been deleted.', '/posts');
		$this->redirect('/musics/managehotmusic?menu='.$this->data['Music']['menu'].'&page='.$page);
	}
	function add_hotmusic()
	{
		$this->checkSession();
		$this->layout = 'default_user';
				
	/* Grtting the Music caltegory*/
		$music_cat = array();
		$music_cat[0] = "Select Category";
		$select_music_category = mysql_query("Select * from music_categories");
		while($select_music_category_res = mysql_fetch_array($select_music_category))
		{
			$music_cat[$select_music_category_res['id']] = $select_music_category_res['music_cat_name'] ;
		}
		$this->set('music_category',$music_cat);
		
	}
	function addhotmusicstep2()
	{
		$this->checkSession();
		$this->layout = 'default_user';
		//pr($_REQUEST);
		/* Insert into table name */
		$inserhot = "INSERT INTO `music_hot` ( `id` , `title` , `music_desc` , `file_name` , `url` , `music_id` )
						VALUES ('', '".$_REQUEST['hottitle']."', '', '', '', '".$_REQUEST['musicinfo']."')" ;
		$inserhot_res = mysql_query($inserhot);	
		$inserhot_res_id = mysql_insert_id();			
		$this->redirect('/musics/edithotmusicphoto?id='.$inserhot_res_id);
		
	}
	function managefeaturedmusic()
	{
		$this->checkSession();
		$this->layout = 'default_user';
	}
	
	function delete_featuredmusicgroup()
	{
		$this->checkSession();
		if(isset($_REQUEST['box']))
		{
		/////IF SEARCH IS COLLECTIVE OR CHOSEN BY ADMIN SELECTION//////
		
			$arr = $_REQUEST['box'];
			foreach($arr as $key => $value)
			{
				$sql_det = "delete from `music_featured` where `id` = '".$value."'";
				$res_det = mysql_query($sql_det);
			}
		}
		////IF DELETE IS FOR A SPECIFIC USER////
		else
		{
			$user_id=$_REQUEST['id'];
			$this->data['Music']['menu'] = $_REQUEST['menu'];
			 $sql_det = "delete from `music_featured` where `id` = '".$user_id."'";
			$res_det = mysql_query($sql_det);
		}
		//$user_id=$_REQUEST['id'];
		$this->data['Music']['menu'] = $_REQUEST['menu'];
		if(isset($_REQUEST['page']))
		{
			$page = $_REQUEST['page'];
		}
		$this->flash('The post with id: '.$id.' has been deleted.', '/posts');
		$this->redirect('/musics/managefeaturedmusic?menu='.$this->data['Music']['menu'].'&page='.$page);

	}
	function delfeaturedmusic()
	{
		$this->checkSession();
		$this->layout = 'default_user';
		/* delete hot music */
		$delhot = mysql_query("Delete From music_featured where id=".$_REQUEST['id']."");
		
		$this->redirect('/musics/managefeaturedmusic?menu='.$_REQUEST['menu']);

	}
	function listenfeaturedmusic()
	{
		$this->checkSession();
		$this->layout = 'default_user';
	}
	function editfeaturedmusic()
	{
		$this->checkSession();
		$this->layout = 'default_user';
				$music_cat = array();
		$music_cat[0] = "Select Category";
		$select_music_category = mysql_query("Select * from music_categories");
		while($select_music_category_res = mysql_fetch_array($select_music_category))
		{
			$music_cat[$select_music_category_res['id']] = $select_music_category_res['music_cat_name'] ;
		}
		$this->set('music_category',$music_cat);

	}
	function saveeditfeaturedmusic()
	{
		$update_sql = "Update music_featured set title='".$_REQUEST['mustitle']."' , music_id =".$_REQUEST['musicinfo']." where id=".$_REQUEST['hid']."";
		mysql_query($update_sql);
		$this->redirect('/musics/editfeaturedmusicphoto?id='.$_REQUEST['hid']);
	}
	function editfeaturedmusicphoto()
	{
		$this->checkSession();
		$this->layout = 'default_user';

	}
	function managemusiccategory()
	{
		$this->checkSession();
		$this->layout = 'default_user';
	}
	function editmusiccategory()
	{
		$this->checkSession();
		$this->layout = 'default_user';
				/* Get the category name*/
		$category_sql = "select * from music_categories where id=".$_REQUEST['id']."";
		$category_res = mysql_fetch_array(mysql_query($category_sql));
		$this->set('catname', $category_res['music_cat_name']);
		$this->set('catid', $category_res['id']);

		/**/

	}
	function saveeditcategory()
	{
		$this->checkSession();
		$this->layout = 'default_user';
		
		/* Updation Table name */
		if($_REQUEST['cattitle']!="")
		{
			$update_sql = "Update music_categories set music_cat_name='".$_REQUEST['cattitle']."' where id = ".$_REQUEST['cid']."";
			mysql_query($update_sql);
		}	
		$this->redirect('/musics/editfeaturedmusiccat?id='.$_REQUEST['cid']);
		/**/
		
	}
	function editfeaturedmusiccat()
	{
		$this->checkSession();
		$this->layout = 'default_user';
	}
	
	function delmusiccategory()
	{
		$this->checkSession();
		$this->layout = 'default_user';
		$delhot = mysql_query("Delete From music_categories where id=".$_REQUEST['id']."");
		$this->redirect('/musics/managemusiccategory?menu='.$_REQUEST['menu']);

	}
	function add_music_category()
	{
		$this->checkSession();
		$this->layout = 'default_user';
	}
	function savenewcategory()
	{
		$this->checkSession();
		$this->layout = 'default_user';
		
		/* Updation Table name */
		if($_REQUEST['cattitle']!="")
		{
			$update_sql = "insert into music_categories set music_cat_name='".$_REQUEST['cattitle']."'";
			mysql_query($update_sql);
			$catid = mysql_insert_id();
			$this->redirect('/musics/editfeaturedmusiccat?id='.$catid);
		}	
		/**/
		
	}
/*	function block_photogroup()
	{
	
		/////IF BLOCKING IS COLLECTIVE OR BY ADMIN SELECTION/////
		$this->checkSession();
		if(isset($_REQUEST['box']))
		{
			$arr = $_REQUEST['box'];
			foreach($arr as $key => $value)
			{
				$sql = "update `user_photo_albums` set `is_blocked` = '1' where `user_id` ='".$value."'";
				$res = mysql_query($sql);
				//$sql_user = "update `users` set `user_status` = '1' where `id` ='".$value."'";
				//$res_user = mysql_query($sql_user);
			}
		}
		////IF BLOCKING IS FOR A SPECIFIC USER////
		else
		{
		$qry="update `user_photo_albums` set `is_blocked`='1' where `user_id`='".$_REQUEST['id']."'";
		$res=mysql_query($qry);
		//$sql_user = "update `users` set `user_status` = '1' where `id` ='".$_REQUEST['id']."'";
		//$res_user = mysql_query($sql_user);
		}
		$this->data['UserPhotoAlbum']['menu'] = $_REQUEST['menu'];
		if(isset($_REQUEST['page']))
		{
			$page = $_REQUEST['page'];
		}
		else $page = 1;
		$this->redirect('/user_photo_albums/manageuserphoto?menu='.$this->data['UserPhotoAlbum']['menu'].'&page='.$page);
	
	}
	function active_photogroup()
	{
	
		/////IF BLOCKING IS COLLECTIVE OR BY ADMIN SELECTION/////
		$this->checkSession();
		if(isset($_REQUEST['box']))
		{
			$arr = $_REQUEST['box'];
			foreach($arr as $key => $value)
			{
				$sql = "update `user_photo_albums` set `is_blocked` = '0' where `user_id` ='".$value."'";
				$res = mysql_query($sql);
				//$sql_user = "update `users` set `user_status` = '0' where `id` ='".$value."'";
				//$res_user = mysql_query($sql_user);
			}
		}
		////IF BLOCKING IS FOR A SPECIFIC USER////
		else
		{
		$qry="update `user_photo_albums` set `is_blocked`='0' where `user_id`='".$_REQUEST['id']."'";
		$res=mysql_query($qry);
		//echo $sql_user = "update `users` set `user_status` = '0' where `id` ='".$_REQUEST['id']."'";
		//$res_user = mysql_query($sql_user);
		}
		$this->data['UserPhotoAlbum']['menu'] = $_REQUEST['menu'];
		if(isset($_REQUEST['page']))
		{
			$page = $_REQUEST['page'];
		}
		else $page = 1;
		$this->redirect('/user_photo_albums/manageuserphoto?menu='.$this->data['UserPhotoAlbum']['menu'].'&page='.$page);
	
	}
	function userphotodetails($pid=null)
	{
		$this->checkSession();
		$this->layout = 'default_user';
		
	}
	function bk_del_selected_image()
	{
		$this->checkSession();
		$this->layout = 'default_user';
		$directory = "../../user_img";

        
		### Deletion of the image file from the user_img directory
		$sel_img = mysql_fetch_array(mysql_query("select * from user_photo_albums where `user_id` = ".$_REQUEST['uid']." and `id` = ".$_REQUEST['pid'].""));

		$filename = $sel_img['pic_path'];
		$exp_filename = explode("/",$filename) ;
		$final_file = $exp_filename[4];
		$del_o = "../../../user_img/o/".$final_file;
		$del_l = "../../../user_img/l/".$final_file;
		$del_m = "../../../user_img/m/".$final_file;
			unlink($del_o);
			unlink($del_l);
			unlink($del_m);
			unlink($filename);
		###
		
		$qry = "delete from `user_photo_albums` where `user_id` = ".$_REQUEST['uid']." and `id` = ".$_REQUEST['pid']."";
		$res = mysql_query($qry);
		

		$nextId = mysql_query("Select * from `user_photo_albums` where `user_id` = ".$_REQUEST['uid']." and `id` > ".$_REQUEST['pid']." order by id asc");
		if(mysql_num_rows($nextId)>0)
		{
			//echo "Select * from `user_photo_albums` where `user_id` = ".$_REQUEST['uid']." and `id` > ".$_REQUEST['pid']." order by id asc";
			$next_id_arr = mysql_fetch_array($nextId);
			$next_id = $next_id_arr['id'];
		}
		else
		{
			$nextId = mysql_query("Select * from `user_photo_albums` where `user_id` = ".$_REQUEST['uid']." order by id asc");
			$next_id_arr = mysql_fetch_array($nextId);
			$next_id = $next_id_arr['id'];
	
		}	
		//$pid = $_REQUEST['pid']+1;
		$pid = $next_id;
		
		$this->flash('The Image with id: '.$id.' has been deleted.', '/user_photo_albums');
		$this->redirect('/user_photo_albums/userphotodetails?OffSet='.$_REQUEST['OffSet'].'&menu='.$_REQUEST['menu'].'&uid='.$_REQUEST['uid'].'&pid='.$pid.'&CurrentPage='.$_REQUEST['CurrentPage']);
		
		
	}
	function bk_block_selected_image()
	{
		$this->checkSession();
		$this->layout = 'default_user';
		echo $qry = "update `user_photo_albums` set `is_blocked` = '1' where `user_id` = ".$_REQUEST['uid']." and `id` = ".$_REQUEST['pid']."";
		$res = mysql_query($qry);
		$this->flash('The post with id: '.$id.' has been deleted.', '/posts');
		$this->redirect('/user_photo_albums/userphotodetails?OffSet='.$_REQUEST['OffSet'].'&menu='.$_REQUEST['menu'].'&uid='.$_REQUEST['uid'].'&pid='.$_REQUEST['pid'].'&CurrentPage='.$_REQUEST['CurrentPage']);
	}
	function bk_unblock_selected_image()
	{
		$this->checkSession();
		$this->layout = 'default_user';
		echo $qry = "update `user_photo_albums` set `is_blocked` = '0' where `user_id` = ".$_REQUEST['uid']." and `id` = ".$_REQUEST['pid']."";
		$res = mysql_query($qry);
		$this->flash('The post with id: '.$id.' has been deleted.', '/posts');
		$this->redirect('/user_photo_albums/userphotodetails?OffSet='.$_REQUEST['OffSet'].'&menu='.$_REQUEST['menu'].'&uid='.$_REQUEST['uid'].'&pid='.$_REQUEST['pid'].'&CurrentPage='.$_REQUEST['CurrentPage']);
	}
*/}
?>
Back to Top