<?php
function integralop($integral,$uid) {
global $_SGLOBAL,$_SC;
if($_SC['music_integralset']=="1") {
$_SGLOBAL['db']->query('UPDATE '.tname('space').' SET credit=credit+'.intval($integral).' WHERE uid='.$uid);
}
}
function updatemyset($do=1,$type=1,$strvalue,$userid){
global $_SGLOBAL,$_SC;
if($do==1){
$query = $_SGLOBAL['db']->query("SELECT musictaste FROM ".tname( "space" )." WHERE uid=$userid");
return $_SGLOBAL['db']->fetch_array($query);
}else{
if($type==1){
$_SGLOBAL['db']->query("UPDATE ".tname( "space" )." SET musictaste='$strvalue' WHERE uid=$userid");
}
}
}
function checkboxis($ary,$str){
$ary = split(",",$ary);
if(in_array($str,$ary)) return ' checked="checked"';
}
function getarysvalue($chartstr,$stringv,$indexvalue){
$resultary = split($chartstr,$stringv);
return $resultary[$indexvalue];
}
function mycongener($str,$spaceuid,$arycount=5){
global $_SGLOBAL,$_SC;
$resultlist = array();
$query = $_SGLOBAL['db']->query("SELECT main.userid,COUNT(main.songid) as songcount,SUM(main.playtotal) as
songplay,album.albumcount,s.uid,s.username,s.name,s.namestatus,s.musictaste FROM ".tname( "musicbox" )." main left JOIN (SELECT userid,COUNT(albumid) as albumcount FROM ".tname(
"musicbox_album" )." GROUP BY userid) album ON (main.userid=album.userid) left JOIN ".tname( "space" )." s ON (main.userid=s.uid) WHERE main.userid<>$spaceuid GROUP BY
main.userid ORDER BY songcount DESC");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
realname_set($value['uid'],$value['username'],$value['name'],$value['namestatus']);
similar_text(str_replace("@@@",",",$str),$value['musictaste'],$ptemp);
$value['musictastep'] = $ptemp;
$resultlist[] = $value;
}
foreach ($resultlist as $key =>$value) {
$musictastep[$key] = $value['musictastep'];
}
@array_multisort($musictastep,SORT_DESC,$resultlist);
$resultlist = array_slice($resultlist,0,$arycount);
return $resultlist;
}
function getdatetoarray($table,$file,$wheresql){
global $_SGLOBAL;
$temparray = array();
$ttemp = array();
$query = $_SGLOBAL['db']->query("SELECT ".$file." FROM ".tname($table)." WHERE 1=1 ".$wheresql);
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$ttemp = split(",",$value[$file]);
$temparray = array_merge($temparray,$ttemp);
}
$temparray = array_merge($temparray,array("流行歌曲","舞曲","翻唱","怀旧","最新单曲","hip-hop","RandB","RAP","轻音乐","电影原声","动漫原声","HOUSE","迷幻","电子","爵士","古典
乐","交响乐","朋克","民谣","金属","摇滚","乡村","歌特","其他"));
$temparray=array_remove_empty($temparray);
$temparray=getalinkint($temparray,2);
return array_count_values($temparray);
}
function array_remove_empty($arr)
{
foreach ($arr as $key =>$value){
if($value==""){
unset($arr[$key]);
}
}
return $arr;
}
function getalinkint($namesrt,$type=-1){
$arr1 = array();
$arr1[25] = array("","流行歌曲","舞曲","翻唱","怀旧","最新单曲","hip-hop","RandB","RAP","轻音乐","电影原声","动漫原声","HOUSE","迷幻","电子","爵士","古典乐","交响乐","朋克","民
谣","金属","摇滚","乡村","歌特","其他");
if($type==-1){
for($i=1;$i<25;$i++){
if($arr1[25][$i]==$namesrt) return $i;
}
}else{
foreach ($namesrt as $key =>$value){
$isin = 0;
for($i=1;$i<25;$i++){
if($value==$arr1[25][$i]) $isin=1;
}
if($isin!=1) unset($namesrt[$key]);
}
return $namesrt;
}
}
function writeselectlist($type,$value)
{
$tempstr ="";
for($i=0;$i<=20;$i++){
$temp = "";
$temp = $type.$i;
if($temp==$value){
$tempstr.= '<option value="'.$temp.'" selected="selected">'.$temp.'</option>';
}else{
$tempstr.= '<option value="'.$temp.'">'.$temp.'</option>';
}
}
return $tempstr;
} |