
<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: forum_attachment.php 23252 2011-06-28 09:34:48Z monkey $
 */

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}
$do=$_GET['do'];
if($do=='saveplaylist'){
	if($space['self']){
		$data=trim($_POST['data']);
		$idtype=trim($_GET['idtype']);
		$typeid=intval($_GET['typeid']);
		//echo $data;
		DB::insert('dzz_music_playlist',daddslashes(array('uid'=>$space['uid'],'username'=>$space['username'],'typeid'=>$typeid,'idtype'=>$idtype,'playlist'=>$data,'dateline'=>$_G['timestamp'])),1,1);
	}
	exit();
}elseif($do=='getplaylist'){
	$idtype=trim($_GET['idtype']);
	$typeid=intval($_GET['typeid']);
	if(!$playarr=dstripslashes(unserialize(stripslashes(DB::result_first("select playlist from ".DB::table('dzz_music_playlist')." where uid='{$space[uid]}' and idtype='{$idtype}' and typeid='{$typeid}'"))))){
		$playarr=array();
	}
	//print_r($playarr);
	echo $playlist=json_encode($playarr);
	exit();
}else{
	
	if(!$plugin=DB::fetch_first("select * from ".DB::table('dzz_plugin')." where identifier='{$identifier}'")){
		showmessage('plugin_nonexistence');
	}
	if($plugin['available']<1){
		exit(dzzlang('message','plugin_closed'));
	}
	
	define('PLUGIN_ROOT','dzz/plugin/'.$plugin['directory']);
	
	include dzztemplate($identifier.':index');
}
?>