-
Notifications
You must be signed in to change notification settings - Fork 0
/
~app.php
13 lines (7 loc) · 50.8 KB
/
~app.php
1
2
3
4
5
6
7
<?php function getfirstchar($s0){ return ff_letter_first($s0); } function getpinyin($str,$ishead=0,$isclose=1){ return ff_pinyin($str,$ishead=0,$isclose=1); } function getsitepath($filename){ return get_site_path($filename); } function getbaseurl($baseurl,$url){ return get_base_url($baseurl,$url); } function getfile($url){ return ff_file_get_contents($url); } function getvoddata($rule,$html){ return ff_preg_match($rule,$html); } function getvodall($rule,$html){ return ff_preg_match_all($rule,$html); } function getreurl($listurl){ return ff_krsort_url($listurl); } function getreplace($arr){ return ff_implode_rule($arr); } function getrole($str){ return ff_replace_rule($str); } function getrandstr($string){ return ff_rand_str($string); } function getpicurl($file){ return ff_img_url($file); } function getpicurl_s($file){ return ff_img_url_small($file); } function getplayurl($vodid){ return ff_play_url($vodid,0,1); } function getactorurl($str,$type="actor"){ return ff_search_url($str,$type); } function ppvodurl($model,$params,$indexphp,$redirect=false,$suffix=false){ return UU($model,$params,$redirect=false,$suffix=false); }; function getletter($file='vod',$str=''){ return ff_letter_url($file='vod',$str=''); } function ppvodpage($currentPage,$totalPages,$halfPer=5,$url,$pagego){ return getpage($currentPage,$totalPages,$halfPer=5,$url,$pagego); } function getqvodname($jiname){ return ff_qvod_name($jiname); } function read_file($l1){ return @file_get_contents($l1); } function write_file($l1, $l2=''){ $dir = dirname($l1); if(!is_dir($dir)){ mkdirss($dir); } return @file_put_contents($l1, $l2); } function mkdirss($dirs,$mode=0777) { if(!is_dir($dirs)){ mkdirss(dirname($dirs), $mode); return @mkdir($dirs, $mode); } return true; } function arr2file($filename, $arr=''){ if(is_array($arr)){ $con = var_export($arr,true); } else{ $con = $arr; } $con = "<?php\nreturn $con;\n?>"; write_file($filename, $con); } function get_http_url(){ return htmlspecialchars("http://".$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"]); } function get_site_path($filename){ $basepath = $_SERVER['PHP_SELF']; $basepath = substr($basepath,0,strpos($basepath,$filename)); return $basepath; } function get_base_url($baseurl,$url){ if("#" == $url){ return ""; }elseif(FALSE !== stristr($url,"http://")){ return $url; }elseif( "/" == substr($url,0,1) ){ $tmp = parse_url($baseurl); return $tmp["scheme"]."://".$tmp["host"].$url; }else{ $tmp = pathinfo($baseurl); return $tmp["dirname"]."/".$url; } } function get_domain($url){ preg_match("|http://(.*)\/|isU", $url, $arr_domain); return $arr_domain[1]; } function u2g($str){ return iconv("UTF-8","GBK",$str); } function g2u($str){ return iconv("GBK","UTF-8//ignore",$str); } function t2js($l1, $l2=1){ $I1 = str_replace(array("\r", "\n"), array('', '\n'), addslashes($l1)); return $l2 ? "document.write(\"$I1\");" : $I1; } function nr($str){ $str = str_replace(array("<nr/>","<rr/>"),array("\n","\r"),$str); return trim($str); } function nb($str){ $str = str_replace(" ",' ',$str); $str = str_replace(" ",' ',$str); $str = ereg_replace("[\r\n\t ]{1,}",' ',$str); return trim($str); } function msubstr($str, $start=0, $length, $suffix=false){ return ff_msubstr(eregi_replace('<[^>]+>','',ereg_replace("[\r\n\t ]{1,}",' ',nb($str))),$start,$length,'utf-8',$suffix); } function ff_msubstr($str, $start=0, $length, $charset="utf-8", $suffix=true){ $re['utf-8'] = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/"; $re['gb2312'] = "/[\x01-\x7f]|[\xb0-\xf7][\xa0-\xfe]/"; $re['gbk'] = "/[\x01-\x7f]|[\x81-\xfe][\x40-\xfe]/"; $re['big5'] = "/[\x01-\x7f]|[\x81-\xfe]([\x40-\x7e]|\xa1-\xfe])/"; preg_match_all($re[$charset], $str, $match); $length_new = $length; for($i=$start; $i<$length; $i++){ if (ord($match[0][$i]) > 0xa0){ }else{ $length_new++; $length_chi++; } } if($length_chi<$length){ $length_new = $length+($length_chi/2); } $slice = join("",array_slice($match[0], $start, $length_new)); if($suffix && $slice != $str){ return $slice."…"; } return $slice; } function ff_pinyin($str,$ishead=0,$isclose=1){ $str = u2g($str); global $pinyins; $restr = ''; $str = trim($str); $slen = strlen($str); if($slen<2){ return $str; } if(count($pinyins)==0){ $fp = fopen('./Lib/Common/pinyin.dat','r'); while(!feof($fp)){ $line = trim(fgets($fp)); $pinyins[$line[0].$line[1]] = substr($line,3,strlen($line)-3); } fclose($fp); } for($i=0;$i<$slen;$i++){ if(ord($str[$i])>0x80){ $c = $str[$i].$str[$i+1]; $i++; if(isset($pinyins[$c])){ if($ishead==0){ $restr .= $pinyins[$c]; } else{ $restr .= $pinyins[$c][0]; } }else{ } }else if( eregi("[a-z0-9]",$str[$i]) ){ $restr .= $str[$i]; } else{ } } if($isclose==0){ unset($pinyins); } return $restr; } function ff_letter_first($s0){ $firstchar_ord=ord(strtoupper($s0{0})); if (($firstchar_ord>=65 and $firstchar_ord<=91)or($firstchar_ord>=48 and $firstchar_ord<=57)) return $s0{0}; $s=iconv("UTF-8","gb2312", $s0); $asc=ord($s{0})*256+ord($s{1})-65536; if($asc>=-20319 and $asc<=-20284)return "A"; if($asc>=-20283 and $asc<=-19776)return "B"; if($asc>=-19775 and $asc<=-19219)return "C"; if($asc>=-19218 and $asc<=-18711)return "D"; if($asc>=-18710 and $asc<=-18527)return "E"; if($asc>=-18526 and $asc<=-18240)return "F"; if($asc>=-18239 and $asc<=-17923)return "G"; if($asc>=-17922 and $asc<=-17418)return "H"; if($asc>=-17417 and $asc<=-16475)return "J"; if($asc>=-16474 and $asc<=-16213)return "K"; if($asc>=-16212 and $asc<=-15641)return "L"; if($asc>=-15640 and $asc<=-15166)return "M"; if($asc>=-15165 and $asc<=-14923)return "N"; if($asc>=-14922 and $asc<=-14915)return "O"; if($asc>=-14914 and $asc<=-14631)return "P"; if($asc>=-14630 and $asc<=-14150)return "Q"; if($asc>=-14149 and $asc<=-14091)return "R"; if($asc>=-14090 and $asc<=-13319)return "S"; if($asc>=-13318 and $asc<=-12839)return "T"; if($asc>=-12838 and $asc<=-12557)return "W"; if($asc>=-12556 and $asc<=-11848)return "X"; if($asc>=-11847 and $asc<=-11056)return "Y"; if($asc>=-11055 and $asc<=-10247)return "Z"; return 0;} function ff_file_get_contents($url,$timeout=10,$referer){ if(function_exists('curl_init')){ $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT,$timeout); if($referer){ curl_setopt ($ch, CURLOPT_REFERER, $referer); } $content = curl_exec($ch); curl_close($ch); if($content){ return $content; } } $ctx = stream_context_create(array('http'=>array('timeout'=>$timeout))); $content = @file_get_contents($url, 0, $ctx); if($content){ return $content; } return false; } function ff_preg_match($rule,$html){ $arr = explode('$$$',$rule); if(count($arr) == 2){ preg_match('/'.$arr[1].'/', $html, $data); return $data[$arr[0]].''; }else{ preg_match('/'.$rule.'/', $html, $data); return $data[1].''; } } function ff_preg_match_all($rule,$html){ $arr = explode('$$$',$rule); if(count($arr) == 2){ preg_match_all('/'.$arr[1].'/', $html, $data); return $data[$arr[0]]; }else{ preg_match_all('/'.$rule.'/', $html, $data); return $data[1]; } } function ff_krsort_url($listurl){ krsort($listurl); foreach($listurl as $val){ $list[]=$val; } return $list; } function ff_implode_rule($arr){ foreach($arr as $val){ $array[] = trim(stripslashes($val)); } return implode('|||',$array); } function ff_replace_rule($str){ $arr1 = array('?','"','(',')','[',']','.','/',':','*','||'); $arr2 = array('\?','\"','\(','\)','\[','\]','\.','\/','\:','.*?','(.*?)'); return str_replace('\[$ppvod\]','([\s\S]*?)',str_replace($arr1,$arr2,$str)); } function ff_rand_str($string){ $arr=C('play_collect_content'); $all=iconv_strlen($string,'utf-8'); $len=floor(mt_rand(0,$all-1)); $str=msubstr($string,0,$len); $str2=msubstr($string,$len,$all); return $str.$arr[array_rand($arr,1)].$str2; } function ff_bind_id($key){ $bindcache = F('_xml/bind'); return $bindcache[$key]; } function ff_tag_auto($title,$content){ $data = ff_file_get_contents('http://keyword.discuz.com/related_kw.html?ics=utf-8&ocs=utf-8&title='.rawurlencode($title).'&content='.rawurlencode(msubstr($content,0,500))); if($data) { $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($parser, $data, $values, $index); xml_parser_free($parser); $kws = array(); foreach($values as $valuearray) { if($valuearray['tag'] == 'kw') { if(strlen($valuearray['value']) > 3){ $kws[] = trim($valuearray['value']); } }elseif($valuearray['tag'] == 'ekw'){ $kws[] = trim($valuearray['value']); } } return implode(' ',$kws); } return false; } function ff_xml_vodname($vodname){ $vodname = str_replace(array('【','】','(',')','(',')','{','}'),array('[',']','[',']','[',']','[',']'),$vodname); $vodname = preg_replace('/\[([a-z][A-Z])\]|([a-z][A-Z])版/i','',$vodname); $vodname = preg_replace('/TS清晰版|枪版|抢先版|HD|BD|TV|DVD|VCD|TS|\/版|\[\]/i','',$vodname); return trim($vodname); } function ff_xml_vodactor($vodactor){ return str_replace(array(',','/',',','|','、'),',',$vodactor); } function getlistid($str){ $arr = list_search(F('_ppvod/list'),'list_name='.$str); if(empty($arr)){ return 0; }else{ return $arr[0]['list_id']; } } function getlistname($cid,$type='list_name'){ $arr=list_search(F('_ppvod/list'),'list_id='.$cid); if(is_array($arr)){ return $arr[0][$type]; }else{ return '未知ID'.$cid; } } function getlistson($pid){ $tree=list_search(F('_ppvod/listtree'),'list_id='.$pid); if(!empty($tree[0]['son'])){ return false; }else{ return true; } } function getlistsqlin($cid){ $tree = list_search(F('_ppvod/listtree'),'list_id='.$cid); if (!empty($tree[0]['son'])) { foreach($tree[0]['son'] as $val){ $arr['vod_cid'][] = $val['list_id']; } $channel = implode(',', $arr['vod_cid']); return array('IN',''.$channel.''); } return $cid; } function getlistarr($cid,$type='list_id'){ $tree = list_search(F('_ppvod/listtree'),'list_id='.$cid); if(!empty($tree[0]['son'])){ foreach($tree[0]['son'] as $val){$param[]=$val[$type];} return $param; }else{ return false; } } function getlistarr_tag($cids){ foreach($cids as $key=>$value){ if(getlistson($value)){ $cid .= ','.$value; }else{ $cidin = getlistsqlin($value); $cid .= ','.$cidin[1]; } } $cidarr = explode(',',$cid); unset($cidarr[0]); $cidarr = array_unique($cidarr); return $cidarr; } function getcount($cid){ $where = array(); if(999 == $cid){ $rs = M("Vod"); $where['vod_cid'] = array('gt',0); $where['vod_addtime'] = array('gt',getxtime(1)); $count = $rs->where($where)->count('vod_id'); }elseif(0 == $cid){ $rs = M("Vod"); $where['vod_cid'] = array('gt',0); $count = $rs->where($where)->count('vod_id'); }else{ $sid = getlistname($cid,'list_sid'); if ($sid == '2'){ $where['news_cid'] = getlistsqlin($cid); $where['news_status'] = 1; $rs = M("News"); $count = $rs->where($where)->count('news_id'); }else{ $where['vod_cid'] = getlistsqlin($cid); $where['vod_status'] = 1; $rs = M("Vod"); $count = $rs->where($where)->count('vod_id'); } } return $count+0; } function getsidname($sid){ if ($sid==1){ return 'vod'; }elseif ($sid==2){ return 'news'; }elseif ($sid==3){ return 'special'; }else{ return 'url'; } } function ff_sid($sidname){ if ($sidname == 'vod'){ return 1; }elseif ($sidname == 'news'){ return 2; }elseif($sidname == 'special'){ return 3; }else{ return 9; } } function getxtime($day){ $day = intval($day); return mktime(23,59,59,date("m"),date("d")-$day,date("y")); } function getcolor($str,$color){ if(empty($color)){ return $str; }else{ return '<font color="'.$color.'">'.$str.'</font>'; } } function getcolordate($type='Y-m-d H:i:s',$time,$color='red'){ if((time()-$time)>86400){ return date($type,$time); }else{ return '<font color="'.$color.'">'.date($type,$time).'</font>'; } } function ff_qvod_name($jiname){ $jiname = ff_preg_match('3$$$(.*)\|(.*)\|(.*)\.(.*)\|',$jiname); return $jiname; } function getjifen($fen){ $array = explode('.',$fen); return '<strong>'.$array[0].'</strong>.'.$array[1]; } function getpage($currentPage,$totalPages,$halfPer=5,$url,$pagego){ $linkPage .= ( $currentPage > 1 ) ? '<a href="'.str_replace('{!page!}',1,$url).'" class="pagegbk">首页</a> <a href="'.str_replace('{!page!}',($currentPage-1),$url).'" class="pagegbk">上一页</a> ' : '<em>首页</em> <em>上一页</em> '; for($i=$currentPage-$halfPer,$i>1||$i=1,$j=$currentPage+$halfPer,$j<$totalPages||$j=$totalPages;$i<$j+1;$i++){ $linkPage .= ($i==$currentPage)?'<span>'.$i.'</span> ':'<a href="'.str_replace('{!page!}',$i,$url).'">'.$i.'</a> '; } $linkPage .= ( $currentPage < $totalPages ) ? '<a href="'.str_replace('{!page!}',($currentPage+1),$url).'" class="pagegbk">下一页</a> <a href="'.str_replace('{!page!}',$totalPages,$url).'" class="pagegbk">尾页</a>' : '<em>下一页</em> <em>尾页</em>'; if(!empty($pagego)){ $linkPage .=' <input type="input" name="page" id="page" size=4 class="pagego"/><input type="button" value="跳 转" onclick="'.$pagego.'" class="pagebtn" />'; } return str_replace('-1'.C('html_file_suffix'),C('html_file_suffix'),str_replace('index1'.C('html_file_suffix'),'',$linkPage)); } function get_maxpage($currentpage,$totalpages){ if ($currentpage > $totalpages){ $currentpage = $totalpages; } return $currentpage; } function ff_hot_key($string){ if(C('url_html')){ return '<script type="text/javascript" src="'.C('site_path').'Runtime/Js/hotkey.js" charset="utf-8"></script>'; } $array_hot = array(); foreach(explode(chr(13),trim($string)) as $key=>$value){ $array = explode('|',$value); if($array[1]){ $array_hot[$key] = '<a href="'.$array[1].'" target="_blank">'.trim($array[0]).'</a>'; }else{ $array_hot[$key] = '<a href="'.UU('Home-vod/search',array('wd'=>urlencode(trim($value))),false,true).'">'.trim($value).'</a>'; } } return implode(' ',$array_hot); } function ff_get_hits($sidname,$type='hits',$array,$js=true){ if((C('url_html') && $js) || $type=='insert'){ return '<script type="text/javascript" src="'.C('site_path').'index.php?s=hits-show-id-'.$array[$sidname.'_id'].'-type-'.$type.'-sid-'.$sidname.'" charset="utf-8"></script>'; }else{ return $array[$type]; } } function ff_arrays2array($array){ static $result_array=array(); foreach($array as $value){ if(is_array($value)){ ff_arrays2array($value); }else{ $result_array[]=$value; } } return $result_array; } function UU($model,$params,$redirect=false,$suffix=false){ if(C('url_rewrite')){ if($params['p'] != '{!page!}'){ $params['p'] = 1; } if($model == 'Home-vod/show'){ $reurl = str_replace(array('$id','$page','$wd','$area','$language','$actor','$director','$year','$letter','$order'),array($params['id'],$params['p'],$params['wd'],$params['area'],$params['language'],$params['actor'],$params['director'],$params['year'],$params['letter'],$params['order']),C('rewrite_vodlist')); }elseif($model == 'Home-vod/read'){ $reurl = str_replace('$id',$params['id'],C('rewrite_voddetail')); }elseif($model == 'Home-vod/play'){ $reurl = str_replace(array('$id','$sid','$pid'),array($params['id'],$params['sid'],$params['pid']),C('rewrite_vodplay')); }elseif($model == 'Home-vod/search'){ $reurl = str_replace(array('$wd','$page','$area','$language','$actor','$director','$year','$letter','$order'),array($params['wd'],$params['p'],$params['area'],$params['language'],$params['actor'],$params['director'],$params['year'],$params['letter'],$params['order']),C('rewrite_vodsearch')); }elseif($model == 'Home-tag/show'){ $reurl = str_replace(array('$wd','$page'),array($params['wd'],$params['p']),C('rewrite_vodtag')); }elseif($model == 'Home-news/show'){ $reurl = str_replace(array('$id','$page'),array($params['id'],$params['p']),C('rewrite_newslist')); }elseif($model == 'Home-news/read'){ $reurl = str_replace('$id',$params['id'],C('rewrite_newsdetail')); }elseif($model == 'Home-news/search'){ $reurl = str_replace(array('$wd','$page'),array($params['wd'],$params['p']),C('rewrite_newssearch')); }elseif($model == 'Home-tag/shown'){ $reurl = str_replace(array('$wd','$page'),array($params['wd'],$params['p']),C('rewrite_newstag')); }elseif($model == 'Home-special/show'){ $reurl = str_replace('$page',$params['p'],C('rewrite_specialshow')); }elseif($model == 'Home-special/read'){ $reurl = str_replace('$id',$params['id'],C('rewrite_specialdetail')); }elseif($model == 'Home-gb/show'){ $reurl = str_replace(array('$id','$page'),array($params['id'],$params['p']),C('rewrite_guestbook')); }elseif($model == 'Home-my/show'){ $reurl = str_replace('$id',$params['id'],C('rewrite_mytpl')); }elseif($model == 'Home-map/show'){ $reurl = str_replace(array('$id','$limit'),array($params['id'],$params['limit']),C('rewrite_map')); } if($reurl){ return $reurl.C('url_html_suffix'); }else{ return str_replace('index.php?s=/Home-','',U($model,$params,$redirect,$suffix)); } } $reurl = str_replace('Home-','',str_replace('index.php?s=/','index.php?s=',U($model,$params,$redirect,$suffix))); if(!C('url_html')){ return str_replace('index.php','',$reurl); } return $reurl; }; function getadsurl($str,$charset="utf-8"){ return '<script type="text/javascript" src="'.C('site_path').C('admin_ads_file').'/'.$str.'.js" charset="'.$charset.'"></script>'; } function str_replace_dir($urldir,$id,$cid,$name){ $old = array('{listid}','{listdir}','{pinyin}','{id}','{md5}',C('html_file_suffix')); $new = array($cid,getlistname($cid,'list_dir'),ff_pinyin($name),$id,md5($id),''); return str_replace($old,$new,$urldir); } function ff_list_url($sid,$arrurl,$page){ if(C('url_html') && C('url_html_list') && in_array($sid,array('vod','news'))){ $showurl = C('site_path').str_replace('index'.C('html_file_suffix'),'',ff_list_url_dir($sid,$arrurl['id'],$page).C('html_file_suffix')); return $showurl; }else{ if($page > 1){ $arrurl['p'] = '{!page!}'; } $showurl = UU('Home-'.$sid.'/show',$arrurl,false,true); } return $showurl; } function ff_list_url_dir($sid,$cid,$page){ if('vod' == $sid){ $listdir = str_replace_dir(C('url_vodlist'),$id,$cid,$name); }else{ $listdir = str_replace_dir(C('url_newslist'),$id,$cid,$name); } if($page > 1){ $listdir .= '-{!page!}'; } return $listdir; } function ff_data_url($sid,$id,$cid,$name,$page,$jumpurl){ if ($jumpurl) { return $jumpurl; } if(C('url_html')){ $readurl = C('site_path').str_replace('index'.C('html_file_suffix'),'',ff_data_url_dir($sid,$id,$cid,$name,$page).C('html_file_suffix')); return $readurl; } $arrurl['id'] = $id; if($page > 1){ $arrurl['p'] = '{!page!}'; } return UU('Home-'.$sid.'/read',$arrurl,false,true); } function ff_data_url_dir($sid,$id,$cid,$name,$page){ if('special' == $sid){ return trim(C('url_special').$id); } if('vod' == $sid){ $datadir = str_replace_dir(C('url_voddata'),$id,$cid,$name); }else{ $datadir = str_replace_dir(C('url_newsdata'),$id,$cid,$name); } if($page > 1){ $datadir .= '-{!page!}'; } return $datadir; } function ff_play_url($id,$sid,$pid,$cid,$name){ if(C('url_html') && C('url_html_play')){ $playurl = C('site_path').str_replace('index'.C('html_file_suffix'),'',ff_play_url_dir($id,$sid,$pid,$cid,$name).C('html_file_suffix')); if(C('url_html_play') == 1){ $playurl .= '?'.$id.'-'.$sid.'-'.$pid; } }else{ $playurl = UU('Home-vod/play',array('id'=>$id,'sid'=>$sid,'pid'=>$pid),false,true); } return $playurl; } function ff_play_url_dir($id,$sid,$pid,$cid,$name){ $playdir = str_replace_dir(C('url_play'),$id,$cid,$name); if(C('url_html_play') == 2){ $playdir .= '-'.$id.'-'.$sid.'-'.$pid; } return $playdir; } function ff_special_url($page){ if(C('url_html')){ return C('site_path').str_replace('index'.C('html_file_suffix'),'',ff_special_url_dir($page).C('html_file_suffix')); }else{ return UU('Home-special/show','',false,true); } } function ff_special_url_dir($page){ $listdir = trim(C('url_special')).'index'; if($page > 1){ $listdir .= '-{!page!}'; } return $listdir; } function ff_img_url($file,$content,$number=1){ if(!$file){ return ff_img_url_preg($file,$content,$number); } if(strpos($file,'http://') !== false){ return $file; } $prefix = C('upload_http_prefix'); if(!empty($prefix)){ return $prefix.$file; }else{ return C('site_path').C('upload_path').'/'.$file; } } function ff_img_url_small($file,$content,$number=1){ if(!$file){ return ff_img_url_preg($file,$content,$number); } if(strpos($file,'http://') !== false){ return $file; } $prefix = C('upload_http_prefix'); if(!empty($prefix)){ return $prefix.$file; }else{ return C('site_path').C('upload_path').'-s/'.$file; } } function ff_img_url_preg($file,$content,$number=1){ preg_match_all('/<img(.*?)src="(.*?)(?=")/si',$content,$imgarr); preg_match_all('/(?<=src=").*?(?=")/si',implode('" ',$imgarr[0]).'" ',$imgarr); $countimg = count($imgarr); if($number > $countimg){ $number = $countimg; } return $imgarr[0][($number-1)]; } function ff_tag_url($str,$sid=''){ if($sid==2){ return UU('Home-tag/shown',array('wd'=>urlencode($str)),false,true); }else{ return UU('Home-tag/show',array('wd'=>urlencode($str)),false,true); } } function ff_content_url($content,$array_tag='',$sid=''){ if($array_tag){ foreach($array_tag as $key=>$value){ $content = str_replace($value['tag_name'],'<a href="'.ff_tag_url($value['tag_name'],$sid).'">'.$value['tag_name'].'</a>',$content); } } return $content; } function ff_mytpl_url($tplname){ $tplname = str_replace(array('my_','.html'),'',$tplname); if(C('url_html')){ return C('site_path').C('url_mytpl').$tplname.C('html_file_suffix'); } return UU('Home-my/show',array('id'=>trim($tplname)),false,true); } function ff_map_url($tplname){ if(C('url_html')){ return C('site_path').C('url_map').$tplname.'.xml'; } $limit = 30; if($tplname != 'rss'){ $limit = 100; } return UU('Home-map/show',array('id'=>$tplname,'limit'=>$limit),false,true); } function ff_letter_url($file='vod',$str=''){ if(C('url_html')){ $index='index.html'; }else{ $index='index.php'; } for($i=1;$i<=26;$i++){ $url = UU('Home-'.$file.'/search',array('id'=>chr($i+64),'x'=>'letter'),false,true); $str.='<a href="'.$url.'" class="letter_on">'.chr($i+64).'</a>'; } return $str; } function ff_search_url($str,$type="actor",$sidname='vod',$action='search'){ $array = array(); $str = str_replace(array('/','|',',',','),' ',$str); $arr = explode(' ',$str); foreach($arr as $key=>$val){ $array[$key] = '<a href="'.UU('Home-'.$sidname.'/'.$action,array($type=>urlencode($val)),false,true).'" target="_blank">'.$val.'</a>'; } return implode(' ',$array); } function ff_play_url_end($vod_url){ $array = array(); $arr_server = explode('$$$',trim($vod_url)); foreach($arr_server as $key=>$value){ $array[$key] = array(count(explode(chr(13),str_replace(array("\r\n", "\n", "\r"),chr(13),$value))),$key); } $max_key = max($array); $array = explode(chr(13),str_replace(array("\r\n", "\n", "\r"),chr(13),$arr_server[$max_key[1]])); $arr_url = explode('$',end($array)); if($arr_url[1]){ return array($max_key[1],$max_key[0],$arr_url[0],$arr_url[1]); }else{ return array($max_key[1],$max_key[0],'第'.$max_key[0].'集',$arr_url[0]); } } function ff_param_url(){ $where = array(); $where['id'] = intval($_REQUEST['id']); $where['page'] = !empty($_GET['p']) ? intval($_GET['p']) : 1; $where['year'] = intval($_REQUEST['year']); $where['language'] = htmlspecialchars(urldecode(trim($_REQUEST['language']))); $where['area'] = htmlspecialchars(urldecode(trim($_REQUEST['area']))); $where['letter'] = htmlspecialchars($_REQUEST['letter']); $where['actor'] = htmlspecialchars(urldecode(trim($_REQUEST['actor']))); $where['director'] = htmlspecialchars(urldecode(trim($_REQUEST['director']))); $where['limit'] = !empty($_GET['limit']) ? intval($_GET['limit']) : 10; $where['wd'] = htmlspecialchars(urldecode(trim($_REQUEST['wd']))); $where['order'] = ff_order_by($_GET['order']); $where['sid'] = intval($_REQUEST['sid']); return $where; } function ff_param_jump($where){ if($where['id']){ $jumpurl['id'] = $where['id']; } if($where['wd']){ $jumpurl['wd'] = urlencode($where['wd']); } if($where['area']){ $jumpurl['area'] = urlencode($where['area']); } if($where['language']){ $jumpurl['language'] = urlencode($where['language']); } if($where['actor']){ $jumpurl['actor'] = urlencode($where['actor']); } if($where['director']){ $jumpurl['director'] = urlencode($where['director']); } if($where['year']){ $jumpurl['year'] = $where['year']; } if($where['letter']){ $jumpurl['letter'] = $where['letter']; } if($where['order'] != 'addtime' && $where['order']){ $jumpurl['order'] = $where['order']; } $jumpurl['p'] = ''; return $jumpurl; } function ff_order_by($order = 'addtime'){ if(empty($order)){ return 'addtime'; } $arrorder['addtime'] = 'addtime'; $arrorder['id'] = 'id'; $arrorder['hits'] = 'hits'; $arrorder['stars'] = 'stars'; $arrorder['up'] = 'up'; $arrorder['down'] = 'down'; $arrorder['gold'] = 'gold'; $arrorder['golder'] = 'golder'; $arrorder['year'] = 'year'; $arrorder['letter'] = 'letter'; return $arrorder[trim($order)]; } function ff_param_lable($tag = ''){ $param = array(); $array = explode(';',str_replace('num:','limit:',$tag)); foreach ($array as $v){ list($key,$val) = explode(':',trim($v)); $param[trim($key)] = trim($val); } return $param; } function ff_mysql_vod($tag){ $search = array();$where = array(); $tag = ff_param_lable($tag); $field = !empty($tag['field']) ? $tag['field'] : '*'; $limit = !empty($tag['limit']) ? $tag['limit'] : '10'; $order = !empty($tag['order']) ? $tag['order'] : 'vod_addtime'; if(C('data_cache_vodforeach') && C('currentpage') < 2 ){ $data_cache_name = md5(C('data_cache_foreach').implode(',',$tag)); $data_cache_content = S($data_cache_name); if($data_cache_content){ return $data_cache_content; } } $where['vod_status'] = array('eq',1); if ($tag['ids']) { $where['vod_id'] = array('in',$tag['ids']); } if ($tag['day']) { $where['vod_addtime'] = array('gt',getxtime($tag['day'])); } if ($tag['hits']) { $hits = explode(',',$tag['hits']); if (count($hits) > 1) { $where['vod_hits'] = array('between',$hits[0].','.$hits[1]); }else{ $where['vod_hits'] = array('gt',$hits[0]); } } if ($tag['cid']) { $cids = explode(',',trim($tag['cid'])); if (count($cids)>1) { $where['vod_cid'] = array('in',getlistarr_tag($cids)); }else{ $where['vod_cid'] = getlistsqlin($tag['cid']); } } if ($tag['stars']) { $where['vod_stars'] = array('in',$tag['stars']); } if ($tag['letter']) { $where['vod_letter'] = array('in',$tag['letter']); } if ($tag['year']) { $where['vod_year'] = array('eq',$tag['year']); } if ($tag['area']) { $where['vod_area'] = array('eq',''.$tag['area'].''); } if ($tag['language']) { $where['vod_language'] = array('eq',''.$tag['language'].''); } if ($tag['name']) { $where['vod_name'] = array('like','%'.$tag['name'].'%'); } if ($tag['title']) { $where['vod_title'] = array('like','%'.$tag['title'].'%'); } if ($tag['actor']) { $where['vod_actor'] = array('like','%'.$tag['actor'].'%'); } if ($tag['director']) { $where['vod_director'] = array('like','%'.$tag['director'].'%'); } if ($tag['play']) { $where['vod_play'] = array('eq',$tag['play']); } if ($tag['inputer']) { $where['vod_inputer'] = array('eq',$tag['inputer']); } if ($tag['wd']) { $search['vod_name'] = array('like','%'.$tag['wd'].'%'); $search['vod_title'] = array('like','%'.$tag['wd'].'%'); $search['vod_actor'] = array('like','%'.$tag['wd'].'%'); $search['vod_director'] = array('like','%'.$tag['wd'].'%'); $search['_logic'] = 'or'; $where['_complex'] = $search; } if($tag['lz'] == 1){ $where['vod_continu'] = array('neq','0'); }elseif($tag['lz'] == 2){ $where['vod_continu'] = 0; } if ($tag['up']) { $up = explode(',',$tag['up']); if (count($up)>1) { $where['vod_up'] = array('between',$up[0].','.$up[1]); }else{ $where['vod_up'] = array('gt',$up[0]); } } if ($tag['down']) { $down = explode(',',$tag['down']); if (count($down)>1) { $where['vod_down'] = array('between',$down[0].','.$down[1]); }else{ $where['vod_down'] = array('gt',$down[0]); } } if ($tag['gold']) { $gold = explode(',',$tag['gold']); if (count($gold)>1) { $where['vod_gold'] = array('between',$gold[0].','.$gold[1]); }else{ $where['vod_gold'] = array('gt',$gold[0]); } } if ($tag['golder']) { $golder = explode(',',$tag['golder']); if (count($golder)>1) { $where['vod_golder'] = array('between',$golder[0].','.$golder[1]); }else{ $where['vod_golder'] = array('gt',$golder[0]); } } if($tag['tag']){ $where['tag_sid'] = 1; $where['tag_name'] = $tag['tag']; $rs = D('TagView'); }else{ $rs = M('Vod'); } if($tag['page']){ $count = $rs->where($where)->count('vod_id');if(!$count){return false;} $totalpages = ceil($count/$limit); $currentpage = get_maxpage(C('currentpage'),$totalpages); $pageurl = C('jumpurl'); $pages = '共'.$count.'部影片 当前:'.$currentpage.'/'.$totalpages.'页 '.getpage($currentpage,$totalpages,C('home_pagenum'),$pageurl,'pagego(\''.$pageurl.'\','.$totalpages.')'); $list = $rs->field($field)->where($where)->order($order)->limit($limit)->page($currentpage)->select(); $list[0]['count'] = count($list); $list[0]['page'] = $pages; }else{ $list = $rs->field($field)->where($where)->order($order)->limit($limit)->select(); } foreach($list as $key=>$val){ $list[$key]['list_id'] = $list[$key]['vod_cid']; $list[$key]['list_name'] = getlistname($list[$key]['list_id'],'list_name'); $list[$key]['list_url'] = getlistname($list[$key]['list_id'],'list_url'); $list[$key]['vod_readurl'] = ff_data_url('vod',$list[$key]['vod_id'],$list[$key]['vod_cid'],$list[$key]['vod_name'],1,$list[$key]['vod_jumpurl']); $list[$key]['vod_playurl'] = ff_play_url($list[$key]['vod_id'],0,1,$list[$key]['vod_cid'],$list[$key]['vod_name']); $list[$key]['vod_picurl'] = ff_img_url($list[$key]['vod_pic'],$list[$key]['vod_content']); $list[$key]['vod_picurl_small'] = ff_img_url_small($list[$key]['vod_pic'],$list[$key]['vod_content']); } if(C('data_cache_vodforeach') && C('currentpage') < 2 ){ S($data_cache_name,$list,intval(C('data_cache_vodforeach'))); } return $list; } function ff_mysql_news($tag){ $search = array();$where = array(); $tag = ff_param_lable($tag); $field = !empty($tag['field']) ? $tag['field'] : '*'; $limit = !empty($tag['limit']) ? $tag['limit'] : '10'; $order = !empty($tag['order']) ? $tag['order'] : 'news_addtime'; if(C('data_cache_newsforeach') && C('currentpage') < 2 ){ $data_cache_name = md5(C('data_cache_foreach').implode(',',$tag)); $data_cache_content = S($data_cache_name); if($data_cache_content){ return $data_cache_content; } } $where['news_status'] = array('eq',1); if ($tag['ids']) { $where['news_id'] = array('in',$tag['ids']); } if ($tag['day']) { $where['news_addtime'] = array('gt',getxtime($tag['day'])); } if ($tag['hits']) { $hits = explode(',',$tag['hits']); if (count($hits) > 1) { $where['news_hits'] = array('between',$hits[0].','.$hits[1]); }else{ $where['news_hits'] = array('gt',$hits[0]); } } if ($tag['cid']) { $cids = explode(',',trim($tag['cid'])); if (count($cids)>1) { $where['news_cid'] = array('in',getlistarr_tag($cids)); }else{ $where['news_cid'] = getlistsqlin($tag['cid']); } } if ($tag['stars']) { $where['news_stars'] = array('in',$tag['stars']); } if ($tag['letter']) { $where['news_letter'] = array('in',$tag['letter']); } if ($tag['name']) { $where['news_name'] = array('like','%'.$tag['name'].'%'); } if ($tag['title']) { $where['news_title'] = array('like','%'.$tag['title'].'%'); } if ($tag['wd']) { $search['news_name'] = array('like','%'.$tag['wd'].'%'); $search['news_inputer'] = array('like','%'.$tag['wd'].'%'); $search['_logic'] = 'or'; $where['_complex'] = $search; } if ($tag['up']) { $up = explode(',',$tag['up']); if (count($up)>1) { $where['news_up'] = array('between',$up[0].','.$up[1]); }else{ $where['news_up'] = array('gt',$up[0]); } } if ($tag['down']) { $down = explode(',',$tag['down']); if (count($down)>1) { $where['news_down'] = array('between',$down[0].','.$down[1]); }else{ $where['news_down'] = array('gt',$down[0]); } } if ($tag['gold']) { $gold = explode(',',$tag['gold']); if (count($gold)>1) { $where['news_gold'] = array('between',$gold[0].','.$gold[1]); }else{ $where['news_gold'] = array('gt',$gold[0]); } } if ($tag['golder']) { $golder = explode(',',$tag['golder']); if (count($golder)>1) { $where['news_golder'] = array('between',$golder[0].','.$golder[1]); }else{ $where['news_golder'] = array('gt',$golder[0]); } } if($tag['tag']){ $where['tag_sid'] = 2; $where['tag_name'] = $tag['tag']; $rs = D('TagnewsView'); }else{ $rs = M('News'); } if($tag['page']){ $count = $rs->where($where)->count('news_id');if(!$count){return false;} $totalpages = ceil($count/$limit); $currentpage = get_maxpage(C('currentpage'),$totalpages); $pageurl = C('jumpurl'); $pages = '共'.$count.'篇资讯 当前:'.$currentpage.'/'.$totalpages.'页 '.getpage($currentpage,$totalpages,C('home_pagenum'),$pageurl,'pagego(\''.$pageurl.'\','.$totalpages.')'); $list = $rs->field($field)->where($where)->order($order)->limit($limit)->page($currentpage)->select(); $list[0]['count'] = count($list); $list[0]['page'] = $pages; }else{ $list = $rs->field($field)->where($where)->order($order)->limit($limit)->select(); } foreach($list as $key=>$val){ $list[$key]['list_id'] = $list[$key]['news_cid']; $list[$key]['list_name'] = getlistname($list[$key]['list_id'],'list_name'); $list[$key]['list_url'] = getlistname($list[$key]['list_id'],'list_url'); $list[$key]['news_readurl'] = ff_data_url('news',$list[$key]['news_id'],$list[$key]['news_cid'],$list[$key]['news_name'],1,$list[$key]['news_jumpurl']); $list[$key]['news_picurl'] = ff_img_url($list[$key]['news_pic'],$list[$key]['news_content']); $list[$key]['news_picurl_small'] = ff_img_url_small($list[$key]['news_pic'],$list[$key]['news_content']); } if(C('data_cache_newsforeach') && C('currentpage') < 2 ){ S($data_cache_name,$list,intval(C('data_cache_newsforeach'))); } return $list; } function ff_mysql_special($tag){ $search = array();$where = array(); $tag = ff_param_lable($tag); $field = !empty($tag['field']) ? $tag['field'] : '*'; $limit = !empty($tag['limit']) ? $tag['limit'] : '10'; $order = !empty($tag['order']) ? $tag['order'] : 'special_addtime'; if(C('data_cache_specialforeach') && C('currentpage') < 2 ){ $data_cache_name = md5(C('data_cache_foreach').implode(',',$tag)); $data_cache_content = S($data_cache_name); if($data_cache_content){ return $data_cache_content; } } $where['special_status'] = array('eq',1); if ($tag['ids']) { $where['special_id'] = array('in',$tag['ids']); } if ($tag['hits']) { $hits = explode(',',$tag['hits']); if (count($hits) > 1) { $where['special_hits'] = array('between',$hits[0].','.$hits[1]); }else{ $where['special_hits'] = array('gt',$hits[0]); } } if ($tag['name']) { $where['special_name'] = array('like','%'.$tag['name'].'%'); } $rs = M('Special'); if($tag['page']){ $count = $rs->where($where)->count('special_id');if(!$count){return false;} $totalpages = ceil($count/$limit); $currentpage = get_maxpage(C('currentpage'),$totalpages); $pageurl = C('jumpurl'); $pages = '共'.$count.'篇专题 当前:'.$currentpage.'/'.$totalpages.'页 '.getpage($currentpage,$totalpages,C('home_pagenum'),$pageurl,'pagego(\''.$pageurl.'\','.$totalpages.')'); $list = $rs->field($field)->where($where)->order($order)->limit($limit)->page($currentpage)->select(); $list[0]['count'] = count($list); $list[0]['page'] = $pages; }else{ $list = $rs->field($field)->where($where)->order($order)->limit($limit)->select(); } foreach($list as $key=>$val){ $list[$key]['special_readurl'] = ff_data_url('special',$list[$key]['special_id'],0,$list[$key]['special_name'],1,''); $list[$key]['special_logo'] = ff_img_url($list[$key]['special_logo'],$list[$key]['special_content']); $list[$key]['special_banner'] = ff_img_url_small($list[$key]['special_banner'],$list[$key]['special_content']); } if(C('data_cache_specialforeach') && C('currentpage') < 2 ){ S($data_cache_name,$list,intval(C('data_cache_specialforeach'))); } return $list; } function get_client_ip(){ if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")) $ip = getenv("HTTP_CLIENT_IP"); else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown")) $ip = getenv("HTTP_X_FORWARDED_FOR"); else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown")) $ip = getenv("REMOTE_ADDR"); else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown")) $ip = $_SERVER['REMOTE_ADDR']; else $ip = "unknown"; return($ip); } function h($text, $tags = null){ $text = trim($text); $text = preg_replace('/<!--?.*-->/','',$text); $text = preg_replace('/<\?|\?'.'>/','',$text); $text = preg_replace('/<script?.*\/script>/','',$text); $text = str_replace('[','[',$text); $text = str_replace(']',']',$text); $text = str_replace('|','|',$text); $text = preg_replace('/\r?\n/','',$text); $text = preg_replace('/<br(\s\/)?'.'>/i','[br]',$text); $text = preg_replace('/(\[br\]\s*){10,}/i','[br]',$text); while(preg_match('/(<[^><]+)( lang|on|action|background|codebase|dynsrc|lowsrc)[^><]+/i',$text,$mat)){ $text=str_replace($mat[0],$mat[1],$text); } while(preg_match('/(<[^><]+)(window\.|javascript:|js:|about:|file:|document\.|vbs:|cookie)([^><]*)/i',$text,$mat)){ $text=str_replace($mat[0],$mat[1].$mat[3],$text); } if(empty($tags)) { $tags = 'table|td|th|tr|i|b|u|strong|img|p|br|div|strong|em|ul|ol|li|dl|dd|dt|a'; } $text = preg_replace('/<('.$tags.')( [^><\[\]]*)>/i','[\1\2]',$text); $text = preg_replace('/<\/?(html|head|meta|link|base|basefont|body|bgsound|title|style|script|form|iframe|frame|frameset|applet|id|ilayer|layer|name|script|style|xml)[^><]*>/i','',$text); while(preg_match('/<([a-z]+)[^><\[\]]*>[^><]*<\/\1>/i',$text,$mat)){ $text=str_replace($mat[0],str_replace('>',']',str_replace('<','[',$mat[0])),$text); } while(preg_match('/(\[[^\[\]]*=\s*)(\"|\')([^\2=\[\]]+)\2([^\[\]]*\])/i',$text,$mat)){ $text=str_replace($mat[0],$mat[1].'|'.$mat[3].'|'.$mat[4],$text); } while(preg_match('/\[[^\[\]]*(\"|\')[^\[\]]*\]/i',$text,$mat)){ $text=str_replace($mat[0],str_replace($mat[1],'',$mat[0]),$text); } $text = str_replace('<','<',$text); $text = str_replace('>','>',$text); $text = str_replace('"','"',$text); $text = str_replace('[','<',$text); $text = str_replace(']','>',$text); $text = str_replace('|','"',$text); $text = str_replace(' ',' ',$text); return $text; } function build_count_rand ($number,$length=4,$mode=1) { if($mode==1 && $length<strlen($number) ) { return false; } $rand = array(); for($i=0; $i<$number; $i++) { $rand[] = rand_string($length,$mode); } $unqiue = array_unique($rand); if(count($unqiue)==count($rand)) { return $rand; } $count = count($rand)-count($unqiue); for($i=0; $i<$count*3; $i++) { $rand[] = rand_string($length,$mode); } $rand = array_slice(array_unique ($rand),0,$number); return $rand; } function remove_xss($val) { $val = preg_replace('/([\x00-\x08,\x0b-\x0c,\x0e-\x19])/', '', $val); $search = 'abcdefghijklmnopqrstuvwxyz'; $search .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $search .= '1234567890!@#$%^&*()'; $search .= '~`";:?+/={}[]-_|\'\\'; for ($i = 0; $i < strlen($search); $i++) { $val = preg_replace('/(&#[xX]0{0,8}'.dechex(ord($search[$i])).';?)/i', $search[$i], $val); $val = preg_replace('/(�{0,8}'.ord($search[$i]).';?)/', $search[$i], $val); } $ra1 = array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'style', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base'); $ra2 = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload'); $ra = array_merge($ra1, $ra2); $found = true; while ($found == true) { $val_before = $val; for ($i = 0; $i < sizeof($ra); $i++) { $pattern = '/'; for ($j = 0; $j < strlen($ra[$i]); $j++) { if ($j > 0) { $pattern .= '('; $pattern .= '(&#[xX]0{0,8}([9ab]);)'; $pattern .= '|'; $pattern .= '|(�{0,8}([9|10|13]);)'; $pattern .= ')*'; } $pattern .= $ra[$i][$j]; } $pattern .= '/i'; $replacement = substr($ra[$i], 0, 2).'<x>'.substr($ra[$i], 2); $val = preg_replace($pattern, $replacement, $val); if ($val_before == $val) { $found = false; } } } return $val; } function list_to_tree($list, $pk='id',$pid = 'pid',$child = '_child',$root=0) { $tree = array(); if(is_array($list)) { $refer = array(); foreach ($list as $key => $data) { $refer[$data[$pk]] =& $list[$key]; } foreach ($list as $key => $data) { $parentId = $data[$pid]; if ($root == $parentId) { $tree[] =& $list[$key]; }else{ if (isset($refer[$parentId])) { $parent =& $refer[$parentId]; $parent[$child][] =& $list[$key]; } } } } return $tree; } function list_search($list,$condition) { if(is_string($condition)) parse_str($condition,$condition); $resultSet = array(); foreach ($list as $key=>$data){ $find = false; foreach ($condition as $field=>$value){ if(isset($data[$field])) { if(0 === strpos($value,'/')) { $find = preg_match($value,$data[$field]); }elseif($data[$field]==$value){ $find = true; } } } if($find) $resultSet[] = &$list[$key]; } return $resultSet; } function byte_format($size, $dec=2) { $a = array("B", "KB", "MB", "GB", "TB", "PB"); $pos = 0; while ($size >= 1024) { $size /= 1024; $pos++; } return round($size,$dec)." ".$a[$pos]; } function list_sort_by($list,$field, $sortby='asc') { if(is_array($list)){ $refer = $resultSet = array(); foreach ($list as $i => $data) $refer[$i] = &$data[$field]; switch ($sortby) { case 'asc': asort($refer); break; case 'desc': arsort($refer); break; case 'nat': natcasesort($refer); break; } foreach ( $refer as $key=> $val) $resultSet[] = &$list[$key]; return $resultSet; } return false; } return array ( 'app_debug' => false, 'app_domain_deploy' => false, 'app_sub_domain_deploy' => false, 'app_plugin_on' => false, 'app_file_case' => false, 'app_group_depr' => '.', 'app_group_list' => 'Admin,Home,Plus,User', 'app_autoload_reg' => false, 'app_autoload_path' => 'Think.Util.', 'app_config_list' => array ( 0 => 'taglibs', 1 => 'routes', 2 => 'tags', 3 => 'htmls', 4 => 'modules', 5 => 'actions', ), 'cookie_expire' => 3600, 'cookie_domain' => '', 'cookie_path' => '/', 'cookie_prefix' => '', 'default_app' => '@', 'default_group' => 'Home', 'default_module' => 'Index', 'default_action' => 'index', 'default_charset' => 'utf-8', 'default_timezone' => 'PRC', 'default_ajax_return' => 'JSON', 'default_theme' => 'defalut', 'default_lang' => 'zh-cn', 'db_type' => 'mysql', 'db_host' => 'feifeidb.db.11090633.hostedresource.com', 'db_name' => 'feifeidb', 'db_user' => 'feifeidb', 'db_pwd' => 'QUANfeifei%941', 'db_port' => '3306', 'db_prefix' => 'ff_', 'db_suffix' => '', 'db_fieldtype_check' => true, 'db_fields_cache' => true, 'db_charset' => 'utf8', 'db_deploy_type' => 0, 'db_rw_separate' => false, 'data_cache_time' => -1, 'data_cache_compress' => false, 'data_cache_check' => false, 'data_cache_type' => 'file', 'data_cache_path' => './Runtime/Temp/', 'data_cache_subdir' => true, 'data_path_level' => 2, 'error_message' => '您浏览的页面暂时发生了错误!请稍后再试~', 'error_page' => '', 'html_cache_on' => false, 'html_cache_time' => 0, 'html_read_type' => 0, 'html_file_suffix' => '.html', 'lang_switch_on' => true, 'lang_auto_detect' => false, 'log_exception_record' => true, 'log_record' => false, 'log_file_size' => 2097152, 'log_record_level' => array ( 0 => 'EMERG', 1 => 'ALERT', 2 => 'CRIT', 3 => 'ERR', ), 'page_rollpage' => 5, 'page_listrows' => 20, 'session_auto_start' => true, 'show_run_time' => false, 'show_adv_time' => false, 'show_db_times' => false, 'show_cache_times' => false, 'show_use_mem' => false, 'show_page_trace' => false, 'show_error_msg' => true, 'tmpl_engine_type' => 'Think', 'tmpl_detect_theme' => false, 'tmpl_template_suffix' => '.html', 'tmpl_content_type' => 'text/html', 'tmpl_cachfile_suffix' => '.php', 'tmpl_deny_func_list' => 'echo,exit', 'tmpl_parse_string' => '', 'tmpl_l_delim' => '{', 'tmpl_r_delim' => '}', 'tmpl_var_identify' => 'array', 'tmpl_strip_space' => false, 'tmpl_cache_on' => false, 'tmpl_cache_time' => -1, 'tmpl_action_error' => './Public/jump/jumpurl.html', 'tmpl_action_success' => './Public/jump/jumpurl.html', 'tmpl_trace_file' => './Lib/ThinkPHP/Tpl/PageTrace.tpl.php', 'tmpl_exception_file' => './Lib/ThinkPHP/Tpl/ThinkException.tpl.php', 'tmpl_file_depr' => '_', 'taglib_begin' => '<', 'taglib_end' => '>', 'taglib_load' => true, 'taglib_build_in' => 'cx', 'taglib_pre_load' => '', 'tag_nested_level' => 3, 'tag_extend_parse' => '', 'token_on' => true, 'token_name' => '__hash__', 'token_type' => 'md5', 'url_case_insensitive' => true, 'url_router_on' => false, 'url_route_rules' => array ( ), 'url_model' => '3', 'url_pathinfo_model' => 2, 'url_pathinfo_depr' => '-', 'url_html_suffix' => '.html', 'var_group' => 'g', 'var_module' => 'm', 'var_action' => 'a', 'var_router' => 'r', 'var_page' => 'p', 'var_template' => 't', 'var_language' => 'l', 'var_ajax_submit' => 'ajax', 'var_pathinfo' => 's', 'site_name' => '影视窝', 'site_path' => '/', 'site_url' => 'http://yingshiwo/', 'site_keywords' => '影视窝,快播,百度影音,高清电影,2013最新电影,电影,电视剧,权力的游戏,被解放的姜戈,新编辑部故事', 'site_description' => '及时收集最新最精彩影视作品', 'site_email' => '[email protected]', 'site_copyright' => '本网站为非赢利性站点,本网站所有内容均来源于互联网相关站点自动搜索采集信息,相关链接已经注明来源。', 'site_hot' => '新编辑部故事
唐山大地震
神探高伦布[粤语]
射天狼
权力的游戏
神探伽利略2
被解救的姜戈', 'site_tongji' => '', 'site_icp' => 'ICP备2010111号', 'url_num_admin' => '18', 'admin_time_edit' => true, 'admin_ads_file' => 'Runtime/js', 'admin_order_type' => 'addtime', 'admin_time_limit' => '300', 'home_pagenum' => '3', 'home_pagego' => 'pagego', 'rewrite_vodlist' => '/vod-show-id-$id-p-$page', 'rewrite_voddetail' => '/vod-read-id-$id', 'rewrite_vodplay' => '/vod-play-id-$id-sid-$sid-pid-$pid', 'rewrite_vodsearch' => '/vod-search-wd-$wd-p-$page', 'rewrite_vodtag' => '/tag-show-wd-$wd-p-$page', 'rewrite_newslist' => '/news-show-id-$id-p-$page', 'rewrite_newsdetail' => '/news-read-id-$id', 'rewrite_newssearch' => '/news-search-wd-$wd-p-$page', 'rewrite_newstag' => '/tag-shown-wd-$wd-p-$page', 'rewrite_speciallist' => '/special-show-p-$page', 'rewrite_specialdetail' => '/special-read-id-$id', 'rewrite_guestbook' => '/gb-show-p-$page', 'rewrite_map' => '/map-show-id-$id-limit-$limit', 'rewrite_mytpl' => '/my-show-id-$id', 'data_cache_vod' => '86400', 'data_cache_news' => '0', 'data_cache_special' => '0', 'data_cache_foreach' => '510cf584e9edf', 'data_cache_vodforeach' => '0', 'data_cache_newsforeach' => '0', 'data_cache_specialforeach' => '0', 'html_cache_index' => '1', 'html_cache_list' => '1.5', 'html_cache_content' => '12', 'html_cache_play' => '12', 'html_cache_iframe' => '12', 'html_cache_ajax' => '12', '_htmls_' => array ( 'home:index:index' => array ( 0 => '{:action}', 1 => 3600, ), 'home:vod:show' => array ( 0 => '{:module}_{:action}/{$_SERVER.REQUEST_URI|md5}', 1 => 5400, ), 'home:news:show' => array ( 0 => '{:module}_{:action}/{$_SERVER.REQUEST_URI|md5}', 1 => 5400, ), 'home:vod:read' => array ( 0 => '{:module}_{:action}/{id|md5}', 1 => 43200, ), 'home:news:read' => array ( 0 => '{:module}_{:action}/{$_SERVER.REQUEST_URI|md5}', 1 => 43200, ), 'home:vod:play' => array ( 0 => '{:module}_{:action}/{$_SERVER.REQUEST_URI|md5}', 1 => 43200, ), 'home:my:show' => array ( 0 => '{:module}_{:action}/{$_SERVER.REQUEST_URI|md5}', 1 => 43200, ), ), 'upload_path' => 'Uploads', 'upload_style' => 'Y-m-d', 'upload_class' => 'jpg,gif,png,jpeg', 'upload_thumb' => false, 'upload_thumb_w' => '120', 'upload_thumb_h' => '140', 'upload_water' => false, 'upload_water_img' => './Public/images/water.gif', 'upload_water_pct' => '75', 'upload_water_pos' => '9', 'upload_http' => false, 'upload_http_down' => '30', 'upload_http_prefix' => '', 'upload_ftp' => false, 'upload_ftp_host' => '', 'upload_ftp_user' => '', 'upload_ftp_pass' => '', 'upload_ftp_port' => '', 'upload_ftp_dir' => '', 'play_show' => '0', 'play_width' => '640', 'play_height' => '460', 'play_qvod' => 'http://www.kuaibo.com/download.html', 'play_bdhd' => 'http://player.baidu.com/', 'play_playad' => '', 'play_second' => 0, 'play_language' => '粤语,台语,国语,韩语,日语,英语', 'play_area' => '中国,美国,内地,香港,台湾,大陆,韩国,日本,英国,法国,德国,意大利,加拿大,西班牙', 'play_year' => '2013,2012,2011,2010,2009,2008,2007,2006,2005,2004,2003,2002,2001,2000,1999,1998,1997,1996,1995,1994,1993,1992', 'play_server' => array ( 'down_a' => 'http://www.yingshiwo.com', ), 'play_urllist' => '1', 'play_collect_time' => '2', 'play_collect_name' => '0', 'play_collect' => false, 'play_collect_content' => array ( 0 => '', ), 'url_html' => '0', 'url_dir_a' => '2', 'url_dir_b' => '5', 'url_time' => '2', 'url_number' => '20', 'url_vodlist' => '{listdir}/index.html', 'url_voddata' => '{listdir}/{id}/index.html', 'url_vodplay' => 'vod/player/', 'url_newslist' => '{listdir}/index.html', 'url_newsdata' => '{listdir}/{id}/index.html', 'url_play' => '{listdir}/{id}/play.html', 'url_html_list' => '1', 'url_html_play' => '0', 'url_rewrite' => '0', 'url_map' => 'detail/', 'url_mytpl' => 'detail/', 'url_special' => 'detail/', 'user_gbcm' => false, 'user_second' => '60', 'user_replace' => '她妈|它妈|他妈|你妈|去死|贱人', 'user_gbnum' => '8', 'user_cmnum' => '5', 'user_vcode' => '1', 'user_register' => '0', 'html_home_suffix' => '.html', 'upload_ftp_del' => '0', 'rand_hits' => '99', 'rand_updown' => '99', 'rand_gold' => '8', 'rand_golder' => '8', 'rand_tag' => '1', 'user_post' => '0', 'user_check' => '0', 'user_auth_key' => 'ffvod', 'not_auth_action' => 'index,show,add,top,left,main', 'require_auth_module' => 'Admin,List,Vod,News,User,Collect,Data,Upload,Link,Ads,Cache,Create,Tpl,Cm,Gb,Tag,Special,Nav,Side,Pic', 'play_player' => array ( 'qvod' => array ( 0 => '00', 1 => '快播高清', ), 'bdhd' => array ( 0 => '01', 1 => '百度影音', ), 'yuku' => array ( 0 => '02', 1 => '优酷视频', ), 'tudou' => array ( 0 => '03', 1 => '土豆视频', ), 'qiyi' => array ( 0 => '04', 1 => '奇艺高清', ), 'pvod' => array ( 0 => '05', 1 => '皮皮高清', ), 'baofeng' => array ( 0 => '06', 1 => '暴风影音', ), 'sinahd' => array ( 0 => '07', 1 => '新浪视频', ), 'sohu' => array ( 0 => '08', 1 => '搜狐视频', ), 'ku6' => array ( 0 => '09', 1 => '酷六视频', ), 'qq' => array ( 0 => '10', 1 => '腾讯视频', ), 'web9' => array ( 0 => '11', 1 => '久久影音', ), 'gvod' => array ( 0 => '12', 1 => '迅播高清', ), 'down' => array ( 0 => '13', 1 => '影片下载', ), 'swf' => array ( 0 => '14', 1 => 'Swf动画', ), 'flv' => array ( 0 => '15', 1 => 'Flv视频', ), 'pptv' => array ( 0 => '16', 1 => 'PPTV视频', ), 'pplive' => array ( 0 => '17', 1 => 'PPTV直播', ), 'letv' => array ( 0 => '18', 1 => '乐视视频', ), 'cntv' => array ( 0 => '21', 1 => 'cntv高清', ), 'cool' => array ( 0 => '22', 1 => '酷播高清', ), 'media' => array ( 0 => '19', 1 => 'Media Player', ), 'real' => array ( 0 => '20', 1 => 'Real Player', ), ), ); ?>