- /**
- * extention.func.php 用户自定义函数库
- *
- * @copyright (C) 2005-2010 PHPCMS
- * @license http://www.phpcms.cn/license/
- * @lastmodify 2010-10-27
- */
- function member_postion($username,$modelid){
- $username = $username?$username:param::get_cookie('_username');
- if(!$siteid) $siteid = 1;
- $CATEGORYS = getcache('category_content_'.$siteid, 'commons');
- $siteurl = siteurl($siteid);
- pc_base::load_model('content_model');
- $content_db = new content_model;
- if(!emptyempty($modelid)){
- if(is_array($modelid)){
- $datas = array();
- foreach($modelid as $v){
- $content_db->set_model($v);
- $infos = $content_db->listinfo(array('username'=>$username),'updatetime DESC',$page);
- $datas= array_merge($datas,$infos);
- }
- }else{
- $content_db->set_model($modelid);
- $datas = $content_db->listinfo(array('username'=>$username),'updatetime DESC',$page);
- }
- }else{
- $modellist = getcache('model', 'commons');
- $datas = array();
- foreach($modellist as $v){
- $content_db->set_model($v[modelid]);
- $infos = $content_db->listinfo(array('username'=>$username),'updatetime DESC',$page);
- $datas= array_merge($datas,$infos);
- }
- }
- return $datas;
- }
- function shejishi_postion($catid,$modelid){
- pc_base::load_model('category_model');
- $category_db = new category_model;
- if(is_array($catid)){
- $cat_childidinfo='';
- foreach($catid as $v){
- $cat_childid = $category_db->get_one(array('catid'=>$v),'arrchildid');
- $cat_childidinfo .= ','.$cat_childid['arrchildid'];
- }
- $new_cat_childidinfo = substr($cat_childidinfo,1,strlen($cat_childidinfo));
- $child_array = explode(",",$cat_childidinfo);
- $content_db = new content_model;
- foreach($child_array as $v){
- $infos = $category_db->get_one(array('modelid'=>$modelid,'catid'=>$v),'catid');
- if($infos){
- $model_info[]=$infos['catid']; //取出模型id为定义值的catid
- }
- }
- if(is_array($model_info)){
- $content_db->set_model($modelid);
- $datas = array();
- foreach($model_info as $v){
- $contents_info = $content_db->listinfo(array('catid'=>$v,'shejishi_pos'=>1),'updatetime DESC',$page,2);
- $datas= array_merge($datas,$contents_info);
- }
- }
- return $datas;
- }else{
- $cat_childid = $category_db->get_one(array('catid'=>$catid),'arrchildid');
- $child_array = explode(",",$cat_childid['arrchildid']);
- $content_db = new content_model;
- foreach($child_array as $v){
- $infos = $category_db->get_one(array('modelid'=>$modelid,'catid'=>$v),'catid');
- if($infos){
- $model_info[]=$infos['catid']; //取出模型id为定义值的catid
- }
- }
- if(is_array($model_info)){
- $content_db->set_model($modelid);
- $datas = array();
- foreach($model_info as $v){
- $contents_info = $content_db->listinfo(array('catid'=>$v,'shejishi_pos'=>1),'updatetime DESC',$page,2);
- $datas= array_merge($datas,$contents_info);
- }
- }
- return $datas;
- }
- }
- function shejishi_news($catid,$modelid){
- pc_base::load_model('category_model');
- $category_db = new category_model;
- $cat_childid = $category_db->get_one(array('catid'=>$catid),'arrchildid');
- $child_array = explode(",",$cat_childid['arrchildid']);
- $content_db = new content_model;
- foreach($child_array as $v){
- $infos = $category_db->get_one(array('modelid'=>$modelid,'catid'=>$v),'catid');
- if($infos){
- $model_info[]=$infos['catid']; //取出模型id为定义值的catid
- }
- }
- if(is_array($model_info)){
- $content_db->set_model($modelid);
- $datas = array();
- foreach($model_info as $v){
- $contents_info = $content_db->listinfo(array('catid'=>$v),'updatetime DESC');
- $datas= array_merge($datas,$contents_info);
- }
- }
- return $datas;
- }
- function pinpai_postion($catid,$modelid,$limit){
- pc_base::load_model('category_model');
- $category_db = new category_model;
- $cat_childid = $category_db->get_one(array('catid'=>$catid),'arrchildid');
- $child_array = explode(",",$cat_childid['arrchildid']);
- $content_db = new content_model;
- foreach($child_array as $v){
- $infos = $category_db->get_one(array('modelid'=>$modelid,'catid'=>$v),'catid');
- if($infos){
- $model_info[]=$infos['catid']; //取出模型id为定义值的catid
- }
- }
- if(is_array($model_info)){
- $content_db->set_model($modelid);
- $datas = array();
- foreach($model_info as $v){
- $contents_info = $content_db->listinfo(array('catid'=>$v),"updatetime DESC",0,$limit);
- $datas= array_merge($datas,$contents_info);
- }
- }
- return $datas;
- }
- function shejishipos_postion($catid,$shejishipos){
- $content_db = new content_model;
- $contents_info = $content_db->get_one2(array('catid'=>$catid,'shejishi_pos'=>$shejishipos), 'id', 'updatetime DESC', 'zhi_shejishi');
- if($contents_info['id']){
- $contents_description = $content_db->get_one2(array('catid'=>$catid,'shejishi_pos'=>$shejishipos,'id'=>$contents_info['id']), 'description,thumb,id,keywords', 'updatetime DESC', 'zhi_shejishi');
- $contetns_content = $content_db->get_one2(array('id'=>$contents_info['id']), 'content', '', 'zhi_shejishi_data');
- $data= array_merge($contents_description,$contetns_content);
- }
- return $data;
- }
- function pinpaipos_postion($catid,$pinpaipos){
- $content_db = new content_model;
- $contents_info = $content_db->get_one2(array('catid'=>$catid,'pinpai_pos'=>$pinpaipos), 'id', 'updatetime DESC', 'zhi_pinpai');
- if($contents_info['id']){
- $contents_description = $content_db->get_one2(array('catid'=>$catid,'pinpai_pos'=>$pinpaipos,'id'=>$contents_info['id']), '*', 'updatetime DESC', 'zhi_pinpai');
- $contetns_content = $content_db->get_one2(array('id'=>$contents_info['id']), '*', '', 'zhi_pinpai_data');
- $data= array_merge($contents_description,$contetns_content); //开源代码phpfensi.com
- }
- return $data;
- }
- function video_pos($data){
- if(''!=$data['catid'] && ''!=$data['id']){
- $content_db = new content_model;
- $contents_info = $content_db->get_one2(array('catid'=>$data['catid'],'id'=>$data['id']), 'video_url', 'updatetime DESC', 'zhi_video');
- return $contents_info;
- }else{
- return '';
- }
- }
- function contentpic_pos($catid,$modelid){
- pc_base::load_model('category_model');
- $brand_array = pc_base::load_config('ds_brand');
- $category_db = new category_model;
- if(in_array($catid,$brand_array['brand_news'])){
- $infos = $category_db->get_one(array('modelid'=>$modelid,'catid'=>'717'),'catid');
- return $infos;
- }
- else{
- $cat_parentid = $category_db->get_one(array('catid'=>$catid),'parentid');
- $cat_childid = $category_db->get_one(array('catid'=>$cat_parentid['parentid']),'arrchildid');
- $child_array = explode(",",$cat_childid['arrchildid']);
- $content_db = new content_model;
- foreach($child_array as $v){
- $infos = $category_db->get_one(array('modelid'=>$modelid,'catid'=>$v),'catid');
- if($infos){
- return $infos;
- }
- }
- }
- }