<?php
/************************
VIP自定义模板首页
 ************************/

use Model\Website\Model_EvUserAd;
use Model\Website\Model_UserLink;
use SelfVendor\SelfSpecial;

header('content-type:text/html;charset=gbk');
$username=$_REQUEST['username']?trim($_REQUEST['username']):'';

$channelPageTag = 'home';

require_once('./setting.php');
require_once(SYSTEM_ROOT.'include/smarty_setting.php');
require_once('../include/dom_wl.php');
require_once('../include/city.php');
require_once('../include/district.php');
$index_page = 1;
require_once(SYSTEM_ROOT.'include/public.php');
require_once(SYSTEM_ROOT.'include/channel_info.php');

SelfSpecial::rule80(USER_ID);

if (isset($settingPublicVersionInfo)) {
    if (SITE_VIP) {
        if ($settingPublicVersionInfo && !$settingPublicVersionInfo->fn_is_pc_site) {
            if (defined('TESTER') && TESTER) {
                echo '(付费用户)无电脑站访问权限,程序中止!';
            } else {
                http_response_code(502);
            }
            exit();
        }
    } elseif ($settingPublicVersionInfo->id == 50) {
        if ($settingPublicVersionInfo && !$settingPublicVersionInfo->fn_is_pc_site) {
            if (defined('TESTER') && TESTER) {
                echo '(免费用户)无电脑站访问权限,程序中止!';
            } else {
                http_response_code(502);
            }
            exit();
        }
    }
}

$username =	$_POST['user_name'] ? trim($_POST['user_name']) : '';
$userpwd  =	$_POST['password']  ? trim($_POST['password'])  : '';

//友情链接
$link_info_arr = Model_UserLink::getList();
if ($link_info_arr) {
    $link_info_arr = Model_Public::newObjToArray($link_info_arr);
}

//广告
if ($model_id>63 || $model_id==55 || $user_tag->is_tj == 1) {
    $ad_type1 = Model_EvUserAd::getInfo(
        [],
        "channel_id=0 && guanggao_id=1 && end_time>='".DATE_STR."'"
    );
    if ($ad_type1) {
        $ad_type1 = (array)$ad_type1;
    }

    $ad_type2 = Model_EvUserAd::getList(
        [
            'where' => "channel_id=0 && guanggao_id=2 && end_time>='".DATE_STR."'",
        ]
    );
    if ($ad_type2) {
        $ad_type2 = Model_Public::newObjToArray($ad_type2);
    }

    $ad_type3 = Model_EvUserAd::getInfo(
        [],
        "channel_id=0 && guanggao_id=3 && end_time>='".DATE_STR."'"
    );
    if ($ad_type3) {
        $ad_type3            = (array)$ad_type3;
        $ad_type3['content'] = get_info_con3($ad_type3['content']);
    }
} else {
    $ad_type1 = get_ad1($user_id);
    $ad_type2 = get_ad2($user_id);
    $ad_type3 = get_ad3($user_id);
    $ad_type3['content'] = get_info_con3($ad_type3['content']);
}

if ($user_tag->is_tj == 1) { // 拖拽版

    // 获取行区块
    if (!empty($tj_tmp_set_info['row_type_ids'])) {
        $row_type_ids_arr = explode(',', $tj_tmp_set_info['row_type_ids']);
    }

    $smarty->assign($tj_tmp_set_info, $tj_tmp_set_info);
} else if ($MODELINFO['new_type']==7) {                       //论坛版
    require_once("../dom/bbs_setting.php");
    require_once("../dom/bbs_public_index.php");
    //模版区块移动
    if ($MODELINFO['is_move'] && trim($MODELINFO['move_qu_ids'])) {
        $main_id=get_main_id($model_id);
        $sql="select move_qu_ids from ev_user_model_move where user_id=".$user_id." and model_id=".$main_id;
        $move_qu_ids=$DB_Ev123->get_var($sql);

        $MODELINFO['move_qu_ids']=$move_qu_ids?: $MODELINFO['move_qu_ids'];
        $move_qu_arr=explode('#', $MODELINFO['move_qu_ids']);

        //隐藏的模块不要输出
        if ($hide_big_qu_ids && $move_qu_arr && (!$is_action || $user_name=='leedzs')) {
            $hide_big_qu_ids=str_replace($main_id.'_', '', $hide_big_qu_ids);
            $hide_big_qu_ids=str_replace("'", '', $hide_big_qu_ids);
            $tmp_hide_arr=explode(',', $hide_big_qu_ids);
            foreach ($move_qu_arr as $tmp_key => $tmp_move) {
                if (in_array(trim($tmp_move), $tmp_hide_arr)) {
                    unset($move_qu_arr[$tmp_key]);
                }
            }
        }

        $smarty->assign('move_qu_arr', $move_qu_arr);
    }
    //取页面所有模块
    $channel_all_arr = get_moduel_info($user_id, $model_id, 0, 0, 0, 0, $system_arr['is_english']);
    if ($channel_all_arr) {
        foreach ($channel_all_arr as $key => $val) {
            $smarty->assign($key, $val);
        }
    }
} else {
    //频道
    if ($model_id==10) {
        $channel_info_arr = get_navi_info($user_id, $user_name, 100, 5);
    } else if ($model_id==16) {
        $channel_info_arr = get_navi_info($user_id, $user_name, 100, 8);
    } else if ($model_id==17) {
        $channel_info_arr = get_navi_info($user_id, $user_name, 100, 10);
    } else if ($model_id==18) {
        $channel_info_arr = get_navi_info($user_id, $user_name, 100, 5);
    }

    $channel_info2 = $channel_info_arr[0];
    $channel_info3 = $channel_info_arr[1];
    $system_link = $channel_info_arr[2];
    if ($user_name=='hyn2010') {
        $channel_info3 = array();
    }

    //取页面所有模块
    $channel_all_arr = get_moduel_info($user_id, $model_id, 0, 0, 0, 0, $system_arr['is_english']);

    if (USER_ID == 561547) {
        if ($channel_all_arr) {
            foreach ($channel_all_arr as $k => $v) {
                if (is_array($v) && $v) {
                    foreach ($v as $k1 => $v1) {
                        if (is_array($v1) && $v1) {
                            foreach ($v1 as $k2 => $v2) {
                                if (is_string($v2)) {
                                    if (strpos($v2, 'http://img4.ev123.com/') !== false) {
                                        $channel_all_arr[$k][$k1][$k2] = str_replace('http://img4.ev123.com/', 'https://img4.ev123.com/', $v2);
                                    } elseif (strpos($v2, 'http://aimg8.dlszyht.net.cn/') !== false) {
                                        $channel_all_arr[$k][$k1][$k2] = str_replace('http://aimg8.dlszyht.net.cn/', 'https://aimg8.dlszyht.net.cn/', $v2);
                                    } elseif (strpos($v2, 'http://aimg5.dlszywz.com/') !== false) {
                                        $channel_all_arr[$k][$k1][$k2] = str_replace('http://aimg5.dlszywz.com/', 'https://aimg5.dlszywz.com/', $v2);
                                    } elseif (strpos($v2, 'http://aimg2.dlszywz.com/') !== false) {
                                        $channel_all_arr[$k][$k1][$k2] = str_replace('http://aimg2.dlszywz.com/', 'https://aimg2.dlszywz.com/', $v2);
                                    } elseif (strpos($v2, 'http://aimg3.dlszywz.com/') !== false) {
                                        $channel_all_arr[$k][$k1][$k2] = str_replace('http://aimg3.dlszywz.com/', 'https://aimg3.dlszywz.com/', $v2);
                                    } elseif (strpos($v2, 'http://aimg8.dlszywz.com/') !== false) {
                                        $channel_all_arr[$k][$k1][$k2] = str_replace('http://aimg8.dlszywz.com/', 'https://aimg8.dlszywz.com/', $v2);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    if ($model_id==217 || $model_id==250 || $model_id==308) {
        $qie_huan=get_moduel_info2($user_id, $model_id, 0, 0);
        $channel_all_arr=$qie_huan[0];
        $qie_huan_arr=$qie_huan[1];
        $qie_module_arr=$qie_huan[2];
        if ($qie_huan_arr) {
            foreach ($qie_huan_arr as $key => $qie) {
                $smarty->assign($key, $qie);
            }
        }
        $smarty->assign('qie_module_arr', $qie_module_arr);
    }

    if ($channel_all_arr) {
        foreach ($channel_all_arr as $key => $val) {
            if ($model_id==10) {
                if ($key=='top_second_module') {    //右侧第二模块
                    if ($val) {
                        foreach ($val as $k => $r) {
                            $second_module_arr[$k]['pic'] = $r['pic'];
                            $second_module_arr[$k]['link'] = $r['link'];
                            $second_module_arr[$k]['title'] = $r['title'];
                            $second_module_arr[$k]['content'] = cnsubstr(strip_tags($r['content']), 200);
                        }
                    }
                    $smarty->assign($key, $second_module_arr);
                } else if ($key=='top_left_pic') {    //右侧图片
                    $top_left_ad['pic'] = $val[0]['pic']?:'//img.ev123.com/pic/gs_2010/ad.gif';
                    $top_left_ad['url'] = $val[0]['url'];
                    $smarty->assign($key, $top_left_ad);
                } else {
                    $smarty->assign($key, $val);
                }
            } else if ($model_id==11) {
                if ($key=='left_pic') {
                    $maxImg = count($val);
                    $info_cnt = ceil(count($val)/3);
                    $tmp_arr = array();
                    foreach ($val as $k => $v) {
                        $tmp_arr[$k+1]['title'] = $v['title'];
                        $tmp_arr[$k+1]['link'] = $v['link'];
                        $tmp_arr[$k+1]['pic'] = $v['pic'];
                    }
                    $smarty->assign($key, $tmp_arr);
                } else if ($key=='left_focus_pic') {
                    foreach ($val as $k => $v) {
                        $focus_arr[$k]['pic'] = $v['pic'];
                        $focus_arr[$k]['name'] = $v['title'];
                        $focus_arr[$k]['url'] = $v['link'];
                    }
                    $smarty->assign($key, $focus_arr);
                } else {
                    $smarty->assign($key, $val);
                }
            } else if ($model_id==12) {
                if ($key=='center_intro') {
                    $intro_arr = get_con_results($val, '', '', 160, 32);
                    $smarty->assign($key, $intro_arr);
                } else {
                    $smarty->assign($key, $val);
                }
            } else if ($model_id==13) {
                if ($key=='show') {
                    $intro_arr = get_con_results($val, '', '', 180, 22);
                    $smarty->assign($key, $intro_arr);
                } else {
                    $smarty->assign($key, $val);
                }
            } else if ($model_id==14) {
                if ($key=='c_t_content') {
                    $intro_arr = get_con_results($val, '', '', 100, 26);
                    $smarty->assign($key, $intro_arr);
                } else if ($key=='intro_one') {
                    $val['content'] = cnsubstr(strip_tags($val[0]['content']), 400);
                    $smarty->assign($key, $val);
                } else {
                    $smarty->assign($key, $val);
                }
            } else if ($model_id==15) {
                if ($key=='company_show') {
                    foreach ($val as $k => $v) {
                        $focus_arr[$k]['pic'] = $v['pic'];
                        $focus_arr[$k]['name'] = $v['title'];
                        $focus_arr[$k]['url'] = $v['link'];
                    }
                    $smarty->assign($key, $focus_arr);
                } else if ($key=='news') {
                    $tmp_arr = get_con_results($val, '', '', 0, 40);
                    $smarty->assign($key, $tmp_arr);
                } else {
                    $smarty->assign($key, $val);
                }
            } else if ($model_id==16) {
                if ($key=='focus_pic') {
                    foreach ($val as $k => $v) {
                        $focus_arr[$k]['pic'] = $v['pic'];
                        $focus_arr[$k]['name'] = $v['title'];
                        $focus_arr[$k]['url'] = $v['link'];
                    }
                    $smarty->assign($key, $focus_arr);
                } else if ($key=='right_two') {
                    $intro_arr = get_con_results($val, '', '', 200, 8);
                    $smarty->assign($key, $intro_arr);
                } else {
                    $smarty->assign($key, $val);
                }
            } else if ($model_id==17) {
                if ($key=='right_focus') {
                    foreach ($val as $k => $v) {
                        $focus_arr[$k]['pic'] = $v['pic'];
                        $focus_arr[$k]['name'] = $v['title'];
                        $focus_arr[$k]['url'] = $v['link'];
                    }
                    $smarty->assign($key, $focus_arr);
                } else {
                    $smarty->assign($key, $val);
                }
            } else if ($model_id==18) {
                if ($key=='focus_pic') {
                    foreach ($val as $k => $v) {
                        $focus_arr[$k]['pic'] = $v['pic'];
                        $focus_arr[$k]['name'] = $v['title'];
                        $focus_arr[$k]['url'] = $v['link'];
                    }
                    $smarty->assign($key, $focus_arr);
                } else {
                    $smarty->assign($key, $val);
                }
            } else if ($model_id==20) {
                if ($key=='focus_pic') {
                    foreach ($val as $k => $v) {
                        $focus_arr[$k]['pic'] = $v['pic'];
                        $focus_arr[$k]['title'] = $v['title'];
                        $focus_arr[$k]['link'] = $v['link'];
                    }
                    $smarty->assign($key, $focus_arr);
                } else {
                    $smarty->assign($key, $val);
                }
            } else if ($model_id==21) {
                if ($key=='yewu_con') {
                    foreach ($val as $k => $v) {
                        $con_arr[$k]['title'] =$v['title'];
                        $con_arr[$k]['link'] =$v['link'];
                    }
                    $smarty->assign($key, $con_arr);
                } else if ($key=='center_con') {
                    foreach ($val as $k => $v) {
                        $con_arr2[$k]['title'] =$v['title'];
                        $con_arr2[$k]['link'] =$v['link'];
                        $con_arr2[$k]['pic'] =$v['pic'];
                        $con_arr2[$k]['content'] = get_info_con(cnsubstr(strip_tags($v['content']), 110));
                    }
                    $smarty->assign($key, $con_arr2);
                } else {
                    $smarty->assign($key, $val);
                }
            } else if ($model_id==22) {
                if ($key=='focus_pic') {
                    foreach ($val as $k => $v) {
                        $focus_arr[$k]['pic'] = $v['pic'];
                        $focus_arr[$k]['title'] = $v['title'];
                        $focus_arr[$k]['link'] = $v['link'];
                    }
                    $smarty->assign($key, $focus_arr);
                } else if ($key=='right_mod2_2') {
                    foreach ($val as $k => $v) {
                        $con_arr2[$k]['title'] =$v['title'];
                        $con_arr2[$k]['link'] =$v['link'];
                        $con_arr2[$k]['pic'] =$v['pic'];
                        $con_arr2[$k]['content'] = get_info_con(strip_tags(cnsubstr($v['content']), 110));
                    }
                    $smarty->assign($key, $con_arr2);
                } else if ($key=='left_mod2') {
                    $smarty->assign($key, $val);
                } else {
                    $smarty->assign($key, $val);
                }
            } else if ($model_id==23) {
                if ('right_mod1'==$key) {
                    $val[0]['content'] = cnsubstr(strip_tags($val[0]['content']), 400);
                }
                $smarty->assign($key, $val);
            } else if ($model_id==24) {
                if ('right_modu2'==$key) {
                    foreach ($val[0]['item'] as $k => $v) {
                        $con_arr2[0]['item'][$k]['short_title'] =cnsubstr($v['title'], 10);
                        $con_arr2[0]['item'][$k]['title'] =$v['title'];
                        $con_arr2[0]['item'][$k]['link'] =$v['link'];
                    }
                    $con_arr2[0]['title'] = $val[0]['title'];
                    $con_arr2[0]['link'] = $val[0]['link'];
                    $smarty->assign($key, $con_arr2);
                } else {
                    $smarty->assign($key, $val);
                }
            } else if ($model_id==25) {
                if ('left_mod1'==$key) {
                    $val[0]['content'] = cnsubstr(strip_tags($val[0]['content']), 360);
                }
                $smarty->assign($key, $val);
            } else if (26==$model_id) {
                if ('left_mod3'==$key) {
                    foreach ($val as $k => $v) {
                        $focus_arr[$k]['pic'] = $v['pic'];
                        $focus_arr[$k]['title'] = $v['title'];
                        $focus_arr[$k]['link'] = $v['link'];
                    }
                    $smarty->assign($key, $focus_arr);
                } else if ('left_mod1'==$key) {
                    $val[0]['content'] = cnsubstr(strip_tags($val[0]['content']), 450);
                    $smarty->assign($key, $val);
                } else if ('left_focus_pic'==$key) {
                    foreach ($val as $k => $v) {
                        $focus_arr2[$k]['pic'] = $v['pic'];
                        $focus_arr2[$k]['title'] = $v['title'];
                        $focus_arr2[$k]['link'] = $v['link'];
                    }
                    $smarty->assign($key, $focus_arr2);
                } else {
                    $smarty->assign($key, $val);
                }
            } else if (27==$model_id) {
                if ('cen_mod'==$key) {
                    $val[0]['content'] = cnsubstr(strip_tags($val[0]['content']), 300);
                    $val[0]['content'] = get_info_con($val[0]['content']);
                }
                $smarty->assign($key, $val);
            } else if (28==$model_id) {
                if ('focus_pic'==$key) {
                    foreach ($val as $k => $v) {
                        $focus_arr[$k]['pic'] = $v['pic'];
                        $focus_arr[$k]['title'] = $v['title'];
                        $focus_arr[$k]['link'] = $v['link'];
                    }
                    $smarty->assign($key, $focus_arr);
                } else {
                    $smarty->assign($key, $val);
                }
            } else if (29==$model_id) {
                if ('cen_mod1'==$key) {
                    $val[0]['content'] = cnsubstr(strip_tags($val[0]['content']), 400);
                }
                $smarty->assign($key, $val);
            } else if (30==$model_id) {
                if ('right_mod1_2'==$key) {
                    $val[0]['content'] = cnsubstr(strip_tags($val[0]['content']), 80);
                    $val[0]['content'] = get_info_con($val[0]['content']);
                }
                $smarty->assign($key, $val);
            } else if (33==$model_id) {
                if ('right_bot2'==$key) {
                    foreach ($val[0]['item'] as $k => $v) {
                        $arr=explode('#', get_info_con($v['title']));
                        $val[0]['item'][$k]['mingc'] =cnsubstr($arr[0], 16);
                        $val[0]['item'][$k]['jiage'] =$arr[1];
                        $val[0]['item'][$k]['title'] =$v['title'];
                        $val[0]['item'][$k]['link'] =$v['link'];
                    }
                    //print_r($val[0]);
                }
                if ('right_mod1'==$key || 'right_mod2'==$key) {
                    foreach ($val[0]['item'] as $k => $v) {
                        $val[0]['item'][$k]['title'] =get_info_con(cnsubstr(strip_tags($v['title']), 20));
                    }
                }
                if ('top_pic'==$key || 'top_pic2'==$key || 'top_pic3'==$key || 'top_pic4'==$key) {
                    $val[0]['content'] =get_info_con(cnsubstr(strip_tags($val[0]['content']), 30));
                }
                $smarty->assign($key, $val);
            } else if (34==$model_id) {
                if ('right_mod1'==$key) {
                    foreach ($val[0]['item'] as $k => $v) {
                        $val[0]['item'][$k]['title'] =get_info_con(cnsubstr(strip_tags($v['title']), 30));
                    }
                }
                if ('left_mod1'==$key) {
                    $val[0]['content'] = get_info_con2(cnsubstr(strip_tags($val[0]['content']), 201));
                }
                if ('left_mod2'==$key) {
                    $val[0]['content'] = get_info_con2(cnsubstr(strip_tags($val[0]['content']), 301));
                }

                $smarty->assign($key, $val);
            } else if (41==$model_id) {
                if ('top_mod1'==$key || 'top_mod2'==$key || 'top_mod3'==$key) {
                    $val[0]['content'] = get_info_con(cnsubstr(strip_tags($val[0]['content']), 30));
                }
                if ('left_mod1'==$key) {
                    $val[0]['content'] = get_info_con(cnsubstr(strip_tags($val[0]['content']), 200));
                }
                if ('right_mod'==$key) {
                    foreach ($val[0]['item'] as $k => $v) {
                        $val[0]['item'][$k]['title'] =get_info_con(cnsubstr($v['title'], 40));
                    }
                }
                //print_r($val);
                $smarty->assign($key, $val);
            } else if (43==$model_id) {
                if ('left_mod'==$key) {
                    foreach ($val[0]['item'] as $k => $v) {
                        $val[0]['item'][$k]['title'] =get_info_con(cnsubstr($v['title'], 20));
                    }
                }
                $smarty->assign($key, $val);
            } else if (44==$model_id) {
                if ('right_mod1'==$key) {
                    foreach ($val[0]['item'] as $k => $v) {
                        $val[0]['item'][$k]['title'] =get_info_con(cnsubstr($v['title'], 40));
                        $val[0]['item'][$k]['all_title'] =get_info_con($v['title']);
                    }
                }
                if ('right_mod'==$key) {
                    $val[0]['content'] = get_info_con(cnsubstr(strip_tags($val[0]['content']), 400));
                }
                if ('right_mod21'==$key) {
                    foreach ($val as $k => $v) {
                        $val[$k]['title'] = cnsubstr($v['title'], 20);
                        $val[$k]['all_title'] = $v['title'];
                    }
                }
                if ('left_mod2'==$key) {
                    foreach ($val as $key2 => $vl) {
                        foreach ($vl['item'] as $k => $v) {
                            $val[$key2]['item'][$k]['title'] =get_info_con(cnsubstr($v['title'], 20));
                            $val[$key2]['item'][$k]['all_title'] =get_info_con($v['title']);
                        }
                    }
                }

                if ('foot_mod1'==$key) {
                    foreach ($val as $key2 => $vl) {
                        foreach ($vl['item'] as $k => $v) {
                            $val[$key2]['item'][$k]['title'] =get_info_con(cnsubstr($v['title'], 24));
                            $val[$key2]['item'][$k]['all_title'] =get_info_con($v['title']);
                        }
                    }
                }

                $smarty->assign($key, $val);
            } else if (45==$model_id) {
                if ('left_mod1'==$key) {
                    foreach ($val as $k => $v) {
                        $val[$k]['title'] = get_info_con(cnsubstr($v['title'], 20));
                        $val[$k]['all_title'] = get_info_con($v['title']);
                        $val[$k]['content'] = get_info_con(cnsubstr(strip_tags($v['content']), 110));
                    }
                }
                if ('left_mod2'==$key) {
                    foreach ($val as $k => $v) {
                        $val[$k]['title'] = get_info_con(cnsubstr($v['title'], 40));
                        $val[$k]['all_title'] = get_info_con($v['title']);
                        $val[$k]['content'] = get_info_con(cnsubstr(strip_tags($v['content']), 400));
                    }
                }
                if ('right_mod1'==$key) {
                    foreach ($val as $k => $v) {
                        $val[$k]['title'] = get_info_con(cnsubstr($v['title'], 20));
                        $val[$k]['all_title'] = get_info_con($v['title']);
                        $val[$k]['content'] = get_info_con(cnsubstr(strip_tags($v['content']), 60));
                    }
                }
                $smarty->assign($key, $val);
            } else if (217==$model_id) {
                if ('d2qu'==$key) {
                    foreach ($val as $k => $v) {
                        $val[$k]['content'] = get_info_con(cnsubstr(strip_tags($v['content']), 110));
                    }
                }
                if ('b4qu'==$key) {
                    foreach ($val as $k => $v) {
                        $val[$k]['content'] = get_info_con(cnsubstr(strip_tags($v['content']), 110));
                    }
                }
                $smarty->assign($key, $val);
            } else if (47==$model_id) {
                if ('cent_mod2'==$key) {
                    foreach ($val[0]['item'] as $k => $v) {
                        $val[0]['item'][$k]['title'] =get_info_con(cnsubstr($v['title'], 24));
                        $val[0]['item'][$k]['all_title'] =get_info_con($v['title']);
                    }
                }
                if ('cent_mod1'==$key) {
                    $val[0]['content'] = get_info_con(cnsubstr(strip_tags($val[0]['content']), 600));
                }
                if ('cent_mod3'==$key) {
                    foreach ($val as $k => $v) {
                        $val[$k]['title'] = get_info_con(cnsubstr($v['title'], 20));
                        $val[$k]['all_title'] = get_info_con($v['title']);
                        $val[$k]['content'] = get_info_con(cnsubstr(strip_tags($v['content']), 140));
                    }
                }
                $smarty->assign($key, $val);
            } else if (49==$model_id) {
                if ('right_mod1'==$key) {
                    foreach ($val as $k => $v) {
                        $val[$k]['title'] = get_info_con(cnsubstr($v['title'], 20));
                        $val[$k]['all_title'] = get_info_con($v['title']);
                        $val[$k]['content'] = get_info_con(cnsubstr(strip_tags($v['content']), 66));
                    }
                }
                $smarty->assign($key, $val);
            } else if (50==$model_id) {
                if ('right_mod2'==$key) {
                    foreach ($val as $k => $v) {
                        $val[$k]['title'] = get_info_con(cnsubstr($v['title'], 24));
                        $val[$k]['all_title'] = get_info_con($v['title']);
                        $val[$k]['content'] = get_info_con(cnsubstr(strip_tags($v['content']), 110));
                    }
                }
                if ('cent_mod1'==$key) {
                    if (is_array($val[0]['item'])) {
                        foreach ($val[0]['item'] as $k => $v) {
                            $val[0]['item'][$k]['title'] =get_info_con(cnsubstr($v['title'], 34));
                            $val[0]['item'][$k]['all_title'] =get_info_con($v['title']);
                        }
                    }
                }
                $smarty->assign($key, $val);
            } else if (63==$model_id) {
                if ('left_mod1'==$key) {
                    foreach ($val as $k => $v) {
                        $val[$k]['content'] = get_info_con(cnsubstr($v['content'], 80));
                    }
                }
                if ('right_mod1'==$key) {
                    foreach ($val as $k => $v) {
                        $val[$k]['content'] = get_info_con(cnsubstr(strip_tags($v['content']), 50));
                    }
                }
                if ('right_mod2'==$key) {
                    foreach ($val[0]['item'] as $k => $v) {
                        $val[0]['item'][$k]['title'] =get_info_con(cnsubstr($v['title'], 28));
                        $val[0]['item'][$k]['all_title'] =get_info_con($v['title']);
                    }
                }
                $smarty->assign($key, $val);
            } else if (211==$model_id) {
                if ('cent_mod2'==$key) {
                    foreach ($val as $k => $v) {
                        $val[$k]['content'] = get_info_con(cnsubstr(strip_tags($v['content']), 120));
                    }
                }
                if ('cent_mod3'==$key) {
                    foreach ($val[0]['item'] as $k => $v) {
                        $val[0]['item'][$k]['title'] =get_info_con(cnsubstr($v['title'], 48));
                        $val[0]['item'][$k]['all_title'] =get_info_con($v['title']);
                    }
                }
                $smarty->assign($key, $val);
            } else if (215==$model_id) {
                if ('right_mod1'==$key) {
                    foreach ($val as $k => $v) {
                        $val[$k]['content'] = get_info_con(cnsubstr(strip_tags($v['content']), 30)).'...';
                    }
                }
                $smarty->assign($key, $val);
            } else if (217==$model_id) {
                if ('b4qu'==$key) {
                    $val[0]['content'] = get_info_con2(cnsubstr(strip_tags($val[0]['content']), 110));
                }
                $smarty->assign($key, $val);
            } else if (69==$model_id) {
                if ('b2qu'==$key) {
                    $val[0]['content'] = get_info_con2(cnsubstr(strip_tags($val[0]['content']), 50)).'...';
                }
                $smarty->assign($key, $val);
            } elseif (271==$model_id) {
                if ('b1qu'==$key) {
                    $val[0]['content'] = get_info_con2(cnsubstr(strip_tags($val[0]['content']), 270)).'...';
                }
                $smarty->assign($key, $val);
            } else if (285==$model_id) {
                if ('d1qu'==$key) {
                    $val[0]['content'] = get_info_con2(cnsubstr(strip_tags($val[0]['content']), 200)).'...';
                }
                $smarty->assign($key, $val);
            } else if (300==$model_id) {
                if ('a1qu'==$key) {
                    $val[0]['content'] = get_info_con2(cnsubstr(strip_tags($val[0]['content']), 150)).'...';
                    $val[1]['content'] = get_info_con2(cnsubstr(strip_tags($val[0]['content']), 150)).'...';
                }
                if ('b2qu'==$key) {
                    foreach ($val as $k => $record) {
                        $val[$k]['content'] = get_info_con2(cnsubstr(strip_tags($record['content']), 100)).'...';
                    }
                }
                $smarty->assign($key, $val);
            } else if (250==$model_id) {
                if ('a1qu'==$key || 'a3qu'==$key) {
                    $val[0]['content'] =get_info_con2(cnsubstr(strip_tags($val[0]['content']), 280)).'...';
                }
                if ('a2qu'==$key) {
                    $val[0]['content'] = get_info_con2(cnsubstr(strip_tags($val[0]['content']), 80)).'...';
                }
                $smarty->assign($key, $val);
            } else if (245==$model_id) {
                if ('a1qu'==$key) {
                    $val[0]['content'] = get_info_con2(cnsubstr(strip_tags($val[0]['content']), 220)).'...';
                }
                $smarty->assign($key, $val);
            } else if (303==$model_id) {
                if ('a1qu'==$key) {
                    foreach ($val as $k => $record) {
                        $val[$k]['content'] = htmlentities(strip_tags(get_info_con2(cnsubstr(strip_tags($record['content']), 130))), ENT_QUOTES, 'GB2312').'...';
                    }
                }
                $smarty->assign($key, $val);
            } else if (304==$model_id) {
                if ('c3qu'==$key || 'c2qu'==$key) {
                    $val[0]['title'] = get_info_con2(cnsubstr($val[0]['title'], 10));
                    foreach ($val[0]['item'] as $k => $v) {
                        $val[0]['item'][$k]['title'] =get_info_con(cnsubstr($v['title'], 30));
                    }
                }
                $smarty->assign($key, $val);
            } elseif (301==$model_id) {
                if ('a3qu'==$key) {
                    foreach ($val as $k => $v) {
                        $val[$k]['title'] =preg_replace("/(\s|&nbsp;)*/", "", get_info_con(cnsubstr($v['title'], 30)));
                    }
                }
                $smarty->assign($key, $val);
            } else {
                $smarty->assign($key, $val);
            }
        }
    }

    if ($model_id==23) {
        $sql = "select id from ev_user_channel where userid=".$user_id." and type=10 and is_show=1 order by id asc limit 1 ";
        $c_id = $DB_Ev123->get_var($sql);
        $big_arr = get_class_info($user_id, $c_id);
        $big_cla_arr = array();
        if ($big_arr) {
            foreach ($big_arr as $big) {
                $big_cla_arr[$big['parentid']][$big['id']] = $big['classname'];
            }
        }
        $smarty->assign('big_cla_arr', $big_cla_arr);
        $smarty->assign('pro_channel_id', $c_id);
    }
    if (29==$model_id) {
        $sql = "select * from user_online where userid=".$user_id." and (qq!='' or msn!='') order by id asc limit 1 ";
        $link_arr = $DB_Ev123->get_row($sql, 'O');
        if ($link_arr->qq) {
            $smarty->assign('user_qq', $link_arr->qq);
            $smarty->assign('is_qq', 1);
        } else if ($link_arr->msn) {
            $smarty->assign('user_qq', $link_arr->msn);
            $smarty->assign('is_qq', 2);
        }
    }

    if (33==$model_id) {
        //get_channel_info();
        $sql1 = "select id from ev_user_channel where is_show=1 and is_del=0 and type=10 and userid=".$user_id." limit 1 ";
        $channel_id = $DB_Ev123->get_var($sql1);
        $sql = "select id,classname from proclass
                where userid=".$user_id." and type=1 and is_del=0 order by order_sort desc,id asc limit 5";
        $big_arr = $DB_Product->get_results($sql);
        //print_r($big_arr);
        if ($big_arr) {
            $pro_arr = array();
            $i=0;
            $pro_info_arr = array();
            foreach ($big_arr as $big) {
                $pro_info = array();
                $pro_info = get_pro_info($user_id, $big['id'], 0, 0, 3);
                if ($pro_info) {
                    foreach ($pro_info as $pro) {
                        $pro_info_arr2[$big['id']][$pro['pid']]['proname'] = $pro['proname'];
                        $pro_info_arr2[$big['id']][$pro['pid']]['prounitprice'] = $pro['prounitprice'];
                        $pro_info_arr2[$big['id']][$pro['pid']]['pro1_url'] = '/'.$user_name.'/products/'.$pro['pid'].'.html';
                        if ($pro['propicpath']) {
                            $tmp_arr=explode(';', $pro['propicpath']);

                            $pro_info_arr2[$big['id']][$pro['pid']]['pic'] = Job_Pic::format(
                                [
                                    'type'   => 1,
                                    'pic'    => $tmp_arr[0],
                                    'width'  => 150,
                                    'height' => 150,
                                    'field'  => 'showPic',
                                ]
                            );
                        } else if ($pro['propicpath2']) {
                            $tmp_arr=explode(';', $pro['propicpath2']);

                            $pro_info_arr2[$big['id']][$pro['pid']]['pic'] = Job_Pic::format(
                                [
                                    'type'   => 1,
                                    'pic'    => $tmp_arr[0],
                                    'width'  => 150,
                                    'height' => 150,
                                    'field'  => 'showPic',
                                ]
                            );
                        } else if ($pro['propicpath3']) {
                            $tmp_arr=explode(';', $pro['propicpath3']);

                            $pro_info_arr2[$big['id']][$pro['pid']]['pic'] = Job_Pic::format(
                                [
                                    'type'   => 1,
                                    'pic'    => $tmp_arr[0],
                                    'width'  => 150,
                                    'height' => 150,
                                    'field'  => 'showPic',
                                ]
                            );
                        } else {
                            $pro_info_arr2[$big['id']][$pro['pid']]['pic'] = 'http://img.ev123.com/pic/detail2009/no_pic.gif';
                        }
                    }
                }
                $pro_info_arr[$big['id']]['classname']=$big['classname'];
                $pro_info_arr[$big['id']]['class_url']='/'.$user_name.'/products/'.$channel_id.'_'.$big['id'].'_0_1.html';
                $pro_info_arr[$big['id']]['num']=$i;
                $i++;
            }
        }
        $pro_url='/'.$user_name.'/products/'.$channel_id.'_0_0_1.html';
        $smarty->assign('pro_info_arr', $pro_info_arr);
        $smarty->assign('pro_info_arr2', $pro_info_arr2);
        //$smarty->assign('pro_url',$pro_url);
    }
    if (43==$model_id) {
        $sql = "select * from proinfo
                where userid=".$user_id." and is_del=0 and infostate='publish' order by order_sort desc,pid desc limit 8";
        $pro_info = $DB_Product->get_results($sql);
        //print_r($pro_info);
        //$pro_info = get_pro_info($user_id,0,0,0,3);
        if ($pro_info) {
            $pro_info_arr2=array();
            foreach ($pro_info as $pro) {
                $pro_info_arr2[$pro['pid']]['proname'] = $pro['proname'];
                $pro_info_arr2[$pro['pid']]['prounitprice'] = $pro['prounitprice'];
                $pro_info_arr2[$pro['pid']]['pro1_url'] = '/'.$user_name.'/products/'.$pro['pid'].'.html';
                if ($pro['propicpath']) {
                    $tmp_arr=explode(';', $pro['propicpath']);

                    $pro_info_arr2[$pro['pid']]['pic'] = Job_Pic::format(
                        [
                            'type'   => 1,
                            'pic'    => $tmp_arr[0],
                            'width'  => 150,
                            'height' => 150,
                            'field'  => 'showPic',
                        ]
                    );
                } else if ($pro['propicpath2']) {
                    $tmp_arr=explode(';', $pro['propicpath2']);

                    $pro_info_arr2[$pro['pid']]['pic'] = Job_Pic::format(
                        [
                            'type'   => 1,
                            'pic'    => $tmp_arr[0],
                            'width'  => 150,
                            'height' => 150,
                            'field'  => 'showPic',
                        ]
                    );
                } else if ($pro['propicpath3']) {
                    $tmp_arr=explode(';', $pro['propicpath3']);

                    $pro_info_arr2[$pro['pid']]['pic'] = Job_Pic::format(
                        [
                            'type'   => 1,
                            'pic'    => $tmp_arr[0],
                            'width'  => 150,
                            'height' => 150,
                            'field'  => 'showPic',
                        ]
                    );
                } else {
                    $pro_info_arr2[$pro['pid']]['pic'] = 'http://img.ev123.com/pic/detail2009/no_pic.gif';
                }
            }
            //print_r($pro_info_arr2);
        }

        $smarty->assign('pro_info_arr', $pro_info_arr2);
    }

    if (27==$model_id) {
        $show_channel_arr = array();
        if ($show_channel) {
            foreach ($show_channel as $chan) {
                $big_arr = array();
                $sub_arr = array();
                $sql = "select id,classname,parentid from proclass where userid=".$user_id." and channel_id=".$chan['id']." and type=2 and is_del=0 order by channel_id desc,order_sort desc,id asc limit 5 ";
                $sub_arr = $DB_Product->get_results($sql);
                $show_channel_arr3[$chan['id']] = $sub_arr;
                $show_channel_arr[$chan['id']]['name'] = $chan['name'];
            }
        }
        $smarty->assign('show_channel_arr3', $show_channel_arr3);
    }

    if (28==$model_id) {
        $show_channel = get_channel_info($user_id, 11, 6);
        $show_chan_arr = array();
        $doc_info_arr = array();
        $mod_pic_arr = $channel_all_arr['mod_pic'];
        if ($show_channel) {
            $x = 0;
            foreach ($show_channel as $show) {
                $doc_arr = array();
                $doc_arr = get_doc_info($user_id, 0, 0, $show['id'], '10');
                if ($doc_arr) {
                    $doc_info_arr[$show['id']] = $doc_arr;
                }
                $show_chan_arr[$show['id']]['name'] = $show['name'];
                $show_chan_arr[$show['id']]['pic'] = $mod_pic_arr[$x]['pic'];
                $show_chan_arr[$show['id']]['pic_link'] = $mod_pic_arr[$x]['link'];
                $x++;
            }
        }

        $smarty->assign('show_chan_arr', $show_chan_arr);
        $smarty->assign('doc_info_arr', $doc_info_arr);
    }

    if ($model_id==24) {
        $sql = "select id,name,type from ev_user_channel
                where is_show=1 and is_del=0 and (type=11 or type=14) and userid=".$user_id."
                order by order_sort desc,id asc limit 2 ";
        $show_channel = $DB_Ev123->get_results($sql);
        $show_channel_arr = array();
        if ($show_channel) {
            $i=1;
            foreach ($show_channel as $show) {
                if (11==$show['type']) {
                    $sql = "select id,title,content from ev_user_doc_content
                            where userid=".$user_id." and is_del=0 and infostate='publish' and channel_id=".$show['id']."
                            order by id desc limit 5";
                    $sh_arr = $DB_User_Doc->get_results($sql);
                    $show_channel_arr[$show['id']]['link'] = '/'.$user_name.'/vip_doc/'.$show['id'].'_0_0_1.html';
                } else {
                    $sql = "select id,title,content from serverinfo
                            where userid=".$user_id." and is_del=0 and infostate='publish' and channel_id=".$show['id']."
                            order by id desc limit 5" ;
                    $sh_arr = $DB_Server->get_results($sql);
                    $show_channel_arr[$show['id']]['link'] = '/'.$user_name.'/ser_'.$show['id'].'_0_1.html';
                }
                $sh_con_arr = array();
                if ($sh_arr) {
                    foreach ($sh_arr as $sh) {
                        $sh_con_arr[$sh['id']]['title'] = $sh['title'];
                        $sh_con_arr[$sh['id']]['content'] = cnsubstr(strip_tags($sh['content']), 90);
                        if (11==$show['type']) {
                            $sh_con_arr[$sh['id']]['link'] = '/'.$user_name.'/vip_doc/'.$sh['id'].'.html';
                        } else {
                            $sh_con_arr[$sh['id']]['link'] = '/'.$user_name.'/vip_ser/'.$sh['id'].'.html';
                        }
                    }
                }
                $show_channel_arr[$show['id']]['name'] = $show['name'];
                $show_channel_arr[$show['id']]['num'] = $i;
                $show_channel_arr[$show['id']]['con'] = $sh_con_arr;
                $i++;
            }
        }
        $smarty->assign('show_channel_arr', $show_channel_arr);
    }
    if (25==$model_id) {
        require_once(SYSTEM_ROOT.'dom/other25.php');
    }

    if ($username && $userpwd) {
        $sql="select id from user_user where user_name='".$username."' and password='".$userpwd."' and user_id=".$user_id;
        $user_user_id=$DB_Ev123->get_var($sql);
        if ($user_user_id) {
            $msg='登录成功';
        } else {
            $msg='用户名或密码错误';
        }
    }
    if ($model_id==18) {
        foreach ($channel_info2 as $key => $val) {
            if ($val['type']==10) {
                $aa = get_class_info($user_id, $key);
                if ($aa) {
                    $pro_info[$key] = $aa;
                }
            }
            if ($val['type']==11) {
                $bb = get_class_arr($user_id, $key);
                $doc_info[$key] = $bb;
            }
            if ($val['type']==14) {
                $cc = get_server_arr($user_id, $key);
                $ser_info[$key] = $cc;
            }
        }
    }
    $bbs_channel = $bbs_id;

    //物流
    /* if ($company_arr['bigclassid']==47) {
         $wl_type_arr=get_wl_class($user_id, $user_name);
         $wl_info_arr = array();
         $wl_info_arr2 = array();
         if ($wl_type_arr) {
             $wl_num = 0;
             foreach ($wl_type_arr as $key => $val) {
                 $wl_num++;
                 $wl_list_arr=get_wl_list($user_id, $user_name, $key, ' order by id desc limit 3');
                 $wl_info_arr[$wl_num] = $val['name'];
                 $wl_info_arr2[$wl_num] = $wl_list_arr;
             }
         }
 }*/

    $smarty->assign('system_link', $system_link);
    $smarty->assign('bbs_channel', $bbs_channel);
    $smarty->assign('msg', $msg);
    $smarty->assign('system_arr', $system_arr);
    $smarty->assign('channel_info_arr', $channel_info2);
    $smarty->assign('channel_info_arr2', $channel_info3);
    $smarty->assign('line_jobs', $line_jobs);
    $smarty->assign('user_name', $user_name);
    $smarty->assign('user_id', $user_id);
    $smarty->assign('user_user_id', $user_user_id);
    $smarty->assign('guest_chan_id', $guest_chan_id);
    $smarty->assign('end_chan', $end_chan);
    $smarty->assign('maxImg', $maxImg);
    $smarty->assign('info_cnt', $info_cnt);
    $smarty->assign('pro_info', $pro_info);
    $smarty->assign('doc_info', $doc_info);
    $smarty->assign('ser_info', $ser_info);
    $smarty->assign('wl_info_arr', $wl_info_arr);
    $smarty->assign('wl_info_arr2', $wl_info_arr2);
    $smarty->assign('wl_num', $wl_num);
    $smarty->assign('guest_title', $system_arr['guest_title']);
    $smarty->assign('company_arr', $company_arr);

    //模版区块移动
    if ($MODELINFO['is_move'] && trim($MODELINFO['move_qu_ids'])) {
        $main_id=get_main_id($model_id);
        $sql="select move_qu_ids from ev_user_model_move where user_id=".$user_id." and model_id=".$main_id;
        $move_qu_ids=$DB_Ev123->get_var($sql);

        $MODELINFO['move_qu_ids']=$move_qu_ids?: $MODELINFO['move_qu_ids'];
        $move_qu_arr=explode('#', $MODELINFO['move_qu_ids']);
        //隐藏的模块不要输出
        if ($hide_big_qu_ids && $move_qu_arr && (!$is_action || $user_name=='leedzs')) {
            $hide_big_qu_ids=str_replace($main_id.'_', '', $hide_big_qu_ids);
            $hide_big_qu_ids=str_replace("'", '', $hide_big_qu_ids);
            $tmp_hide_arr=explode(',', $hide_big_qu_ids);
            foreach ($move_qu_arr as $tmp_key => $tmp_move) {
                if (in_array(trim($tmp_move), $tmp_hide_arr)) {
                    unset($move_qu_arr[$tmp_key]);
                }
            }
        }
        $smarty->assign('move_qu_arr', $move_qu_arr);
    }
}


//广告
$smarty->assign('ad_type1', $ad_type1);
$smarty->assign('ad_type2', $ad_type2);
$smarty->assign('ad_type3', $ad_type3);
$smarty->assign('link_info_arr', $link_info_arr);
$smarty->assign('index_page', $index_page);
$smarty->assign('login_alert_no', 1);
if ($user_tag->is_tj == 1) {
    if (!WEB_SITE_STATUS && !$zz_userid && Job_Website::rule10($user_id)) {
        Util::redirect("/UD/feimirsku/Login.php?username={$user_name}", 1);
    }

    $smarty->display('tjNew/index.tpl');
} else {
    // 判断用户自定义样式类型
    $tmp_model_id=get_main_id($model_id);
    $sql = 'select id from ev_user_module where
            page="首页" and parentid=0  and model_id='. $tmp_model_id .' and channel_model=0';
    $tmp_model_ids_arr = $DB_Ev123->get_results($sql);
    if ($tmp_model_ids_arr) {
        foreach ($tmp_model_ids_arr as $k => $v) {
            $k==0 ? $model_ids=$v['id'] : $model_ids.=','. $v['id'];
        }
        $sql='select show_style from ev_user_module_set where
                module_id in ('. $model_ids .') and show_style in (10, 12, 14) and user_id=' .$user_id. ' group by show_style';
        $set_module_is_type = $DB_Ev123->get_results($sql);
        $smarty->assign('set_module_is_type', $set_module_is_type);
    }

    $smarty->display($dec[$model_id].'index.tpl');
}
