当前位置:首页 > CMS教程 > phpcms > 列表

【phpcms-v9】phpcms-v9中自定义全局函数文件:extention.func.php

发布:smiling 来源: PHP粉丝网  添加日期:2014-10-24 11:09:41 浏览: 评论:0 
  1. /**  
  2.  *  extention.func.php 用户自定义函数库  
  3.  *  
  4.  * @copyright           (C) 2005-2010 PHPCMS  
  5.  * @license             http://www.phpcms.cn/license/  
  6.  * @lastmodify          2010-10-27  
  7.  */   
  8.     function member_postion($username,$modelid){   
  9.         $username = $username?$username:param::get_cookie('_username');   
  10.         if(!$siteid$siteid = 1;   
  11.         $CATEGORYS = getcache('category_content_'.$siteid'commons');   
  12.         $siteurl = siteurl($siteid);   
  13.         pc_base::load_model('content_model');   
  14.         $content_db = new content_model;   
  15.         if(!emptyempty($modelid)){   
  16.             if(is_array($modelid)){   
  17.             $datas = array();   
  18.                 foreach($modelid as $v){   
  19.                     $content_db->set_model($v);   
  20.                      $infos = $content_db->listinfo(array('username'=>$username),'updatetime DESC',$page);   
  21.                      $datasarray_merge($datas,$infos);   
  22.                 }   
  23.             }else{   
  24.                  $content_db->set_model($modelid);   
  25.                  $datas = $content_db->listinfo(array('username'=>$username),'updatetime DESC',$page);   
  26.             }   
  27.         }else{   
  28.             $modellist = getcache('model''commons');   
  29.             $datas = array();   
  30.                 foreach($modellist as $v){   
  31.                     $content_db->set_model($v[modelid]);   
  32.                      $infos = $content_db->listinfo(array('username'=>$username),'updatetime DESC',$page);   
  33.                      $datasarray_merge($datas,$infos);   
  34.                 }   
  35.         }   
  36.         return $datas;       
  37.     }   
  38.        
  39.     function shejishi_postion($catid,$modelid){   
  40.         pc_base::load_model('category_model');   
  41.         $category_db = new category_model;   
  42.         if(is_array($catid)){   
  43.             $cat_childidinfo='';   
  44.             foreach($catid as $v){   
  45.                 $cat_childid = $category_db->get_one(array('catid'=>$v),'arrchildid');   
  46.                 $cat_childidinfo .= ','.$cat_childid['arrchildid'];   
  47.             }   
  48.             $new_cat_childidinfo = substr($cat_childidinfo,1,strlen($cat_childidinfo));   
  49.             $child_array = explode(",",$cat_childidinfo);   
  50.             $content_db = new content_model;   
  51.             foreach($child_array as $v){   
  52.                 $infos = $category_db->get_one(array('modelid'=>$modelid,'catid'=>$v),'catid');   
  53.                 if($infos){   
  54.                     $model_info[]=$infos['catid']; //取出模型id为定义值的catid   
  55.                 }   
  56.             }   
  57.             if(is_array($model_info)){   
  58.                 $content_db->set_model($modelid);   
  59.                 $datas = array();   
  60.                 foreach($model_info as $v){   
  61.                     $contents_info = $content_db->listinfo(array('catid'=>$v,'shejishi_pos'=>1),'updatetime DESC',$page,2);   
  62.                     $datasarray_merge($datas,$contents_info);   
  63.                 }   
  64.             }   
  65.             return $datas;   
  66.         }else{   
  67.             $cat_childid = $category_db->get_one(array('catid'=>$catid),'arrchildid');   
  68.             $child_array = explode(",",$cat_childid['arrchildid']);   
  69.              $content_db = new content_model;   
  70.             foreach($child_array as $v){   
  71.                 $infos = $category_db->get_one(array('modelid'=>$modelid,'catid'=>$v),'catid');   
  72.                 if($infos){   
  73.                     $model_info[]=$infos['catid']; //取出模型id为定义值的catid   
  74.                 }   
  75.             }   
  76.             if(is_array($model_info)){   
  77.                 $content_db->set_model($modelid);   
  78.                 $datas = array();   
  79.                 foreach($model_info as $v){   
  80.                     $contents_info = $content_db->listinfo(array('catid'=>$v,'shejishi_pos'=>1),'updatetime DESC',$page,2);   
  81.                     $datasarray_merge($datas,$contents_info);   
  82.                 }   
  83.             }   
  84.             return $datas;   
  85.         }   
  86.     }   
  87.     function shejishi_news($catid,$modelid){   
  88.          pc_base::load_model('category_model');   
  89.         $category_db = new category_model;   
  90.         $cat_childid = $category_db->get_one(array('catid'=>$catid),'arrchildid');   
  91.         $child_array = explode(",",$cat_childid['arrchildid']);   
  92.         $content_db = new content_model;   
  93.         foreach($child_array as $v){   
  94.             $infos = $category_db->get_one(array('modelid'=>$modelid,'catid'=>$v),'catid');   
  95.             if($infos){   
  96.                 $model_info[]=$infos['catid']; //取出模型id为定义值的catid   
  97.             }   
  98.         }   
  99.         if(is_array($model_info)){   
  100.             $content_db->set_model($modelid);   
  101.             $datas = array();   
  102.             foreach($model_info as $v){   
  103.                 $contents_info = $content_db->listinfo(array('catid'=>$v),'updatetime DESC');   
  104.                 $datasarray_merge($datas,$contents_info);   
  105.             }   
  106.         }   
  107.         return $datas;   
  108.     }   
  109.     function pinpai_postion($catid,$modelid,$limit){   
  110.         pc_base::load_model('category_model');   
  111.         $category_db = new category_model;   
  112.         $cat_childid = $category_db->get_one(array('catid'=>$catid),'arrchildid');   
  113.             $child_array = explode(",",$cat_childid['arrchildid']);   
  114.             $content_db = new content_model;   
  115.             foreach($child_array as $v){   
  116.                 $infos = $category_db->get_one(array('modelid'=>$modelid,'catid'=>$v),'catid');   
  117.                 if($infos){   
  118.                     $model_info[]=$infos['catid']; //取出模型id为定义值的catid   
  119.                 }   
  120.             }   
  121.             if(is_array($model_info)){   
  122.                 $content_db->set_model($modelid);   
  123.                 $datas = array();   
  124.                 foreach($model_info as $v){   
  125.                     $contents_info = $content_db->listinfo(array('catid'=>$v),"updatetime DESC",0,$limit);   
  126.                     $datasarray_merge($datas,$contents_info);   
  127.                 }   
  128.             }   
  129.             return $datas;   
  130.            
  131.     }   
  132.     function shejishipos_postion($catid,$shejishipos){   
  133.         $content_db = new content_model;   
  134.         $contents_info = $content_db->get_one2(array('catid'=>$catid,'shejishi_pos'=>$shejishipos), 'id''updatetime DESC''zhi_shejishi');   
  135.         if($contents_info['id']){   
  136.             $contents_description = $content_db->get_one2(array('catid'=>$catid,'shejishi_pos'=>$shejishipos,'id'=>$contents_info['id']), 'description,thumb,id,keywords''updatetime DESC''zhi_shejishi');   
  137.             $contetns_content = $content_db->get_one2(array('id'=>$contents_info['id']), 'content''''zhi_shejishi_data');   
  138.             $dataarray_merge($contents_description,$contetns_content);   
  139.         }   
  140.         return $data;   
  141.    }   
  142.    function pinpaipos_postion($catid,$pinpaipos){   
  143.         $content_db = new content_model;   
  144.         $contents_info = $content_db->get_one2(array('catid'=>$catid,'pinpai_pos'=>$pinpaipos), 'id''updatetime DESC''zhi_pinpai');   
  145.         if($contents_info['id']){   
  146.             $contents_description = $content_db->get_one2(array('catid'=>$catid,'pinpai_pos'=>$pinpaipos,'id'=>$contents_info['id']), '*''updatetime DESC''zhi_pinpai');   
  147.             $contetns_content = $content_db->get_one2(array('id'=>$contents_info['id']), '*''''zhi_pinpai_data');   
  148.             $dataarray_merge($contents_description,$contetns_content);  //开源代码phpfensi.com 
  149.         }   
  150.         return $data;   
  151.    }   
  152.       
  153.    function video_pos($data){   
  154.         if(''!=$data['catid'] && ''!=$data['id']){   
  155.             $content_db = new content_model;   
  156.             $contents_info = $content_db->get_one2(array('catid'=>$data['catid'],'id'=>$data['id']), 'video_url''updatetime DESC''zhi_video');   
  157.             return $contents_info;   
  158.         }else{   
  159.             return '';   
  160.         }   
  161.    }   
  162.       
  163.    function contentpic_pos($catid,$modelid){   
  164.         pc_base::load_model('category_model');   
  165.         $brand_array = pc_base::load_config('ds_brand');   
  166.         $category_db = new category_model;   
  167.         if(in_array($catid,$brand_array['brand_news'])){   
  168.             $infos = $category_db->get_one(array('modelid'=>$modelid,'catid'=>'717'),'catid');   
  169.             return $infos;   
  170.         }   
  171.         else{   
  172.         $cat_parentid = $category_db->get_one(array('catid'=>$catid),'parentid');   
  173.         $cat_childid = $category_db->get_one(array('catid'=>$cat_parentid['parentid']),'arrchildid');   
  174.         $child_array = explode(",",$cat_childid['arrchildid']);   
  175.         $content_db = new content_model;   
  176.         foreach($child_array as $v){   
  177.             $infos = $category_db->get_one(array('modelid'=>$modelid,'catid'=>$v),'catid');   
  178.             if($infos){   
  179.                 return $infos;   
  180.             }   
  181.         }   
  182.         }   
  183.    }

Tags: phpcms全局函数 extention func php

分享到: