chengkun
2025-04-18 1bb985f32f2efe0f9dd69f3cf29a1c809b1cf96d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<?php
class Smarty_Internal_Compile_Articleclass extends Smarty_Internal_CompileBase{
    public $required_attributes = array('item');
    public $optional_attributes = array('name', 'key', 'rec', 'urlstatic', 'len', 'pt_len', 'pd_len', 't_len','arcpic','arclist','r_news','classid','r_list');
    public $shorttag_order = array('from', 'item', 'key', 'name');
    public function compile($args, $compiler, $parameter){
        $_attr = $this->getAttributes($compiler, $args);
        $from = $_attr['from'];
        $item = $_attr['item'];
        if (!strncmp("\$_smarty_tpl->tpl_vars[$item]", $from, strlen($item) + 24)) {
            $compiler->trigger_template_error("item variable {$item} may not be the same variable as at 'from'", $compiler->lex->taglineno);
        }
        $OutputStr='global $db,$db_config,$config;$paramer='.ArrayToString($_attr,true).';
        $ParamerArr = GetSmarty($paramer,$_GET,$_smarty_tpl);
        $paramer = $ParamerArr[arr];
        $Purl =  $ParamerArr[purl];
        include PLUS_PATH."/group.cache.php";
 
        $group = array();
        if($paramer[\'classid\']){
            $classid = @explode(\',\',$paramer[\'classid\']);
            if(is_array($classid)){
                foreach($classid as $key=>$value){
                    $Info[\'id\']   = $value;
                    $Info[\'name\'] = $group_name[$value];
                    $group[] = $Info;
                }
            }
        }else if($paramer[\'rec\']){
            if(is_array($group_rec)){
                foreach($group_rec as $key=>$value){
                    $Info[\'id\']   = $value;
                    $Info[\'name\'] = $group_name[$value];
                    $group[] = $Info;
                }
            }
        }else if($paramer[\'r_news\']){
            if(is_array($group_recnews)){
                foreach($group_recnews as $key=>$value){
                    $Info[\'id\']   = $value;
                    $Info[\'name\'] = $group_name[$value];        
                    $group[] = $Info;
                }
            }
        }else{
            if(is_array($group_index)){
                foreach($group_index as $key=>$value){
                    $Info[\'id\']   = $value;
                    $Info[\'name\'] = $group_name[$value];
                    $group[] = $Info;
                }
            }
        }
        if(is_array($group)){
            foreach($group as $key=>$value){
              if($paramer[r_list]){
                  if(is_array($group_type)){
                      foreach($group_type as $k=>$v){           
                         if($value[\'id\']==strval($k)){
                            foreach($v as $ke=>$va){
                              $rs[\'id\']=$va;
                              $rs[\'name\']=$group_name[$va];
                              if($config[sy_news_rewrite]=="2"){
                                $rs[url] = $config[\'sy_weburl\']."/news/".$va."/";
                                }else{
                                  $rs[url]= Url(\'article\',array(\'c\'=>\'list\',"nid"=>$va),"1");
                                }
                              $r_list[] = $rs;
                            }
                          }
                      }
                  }
                 
                    $group[$key][r_list] = $r_list;
                    unset($r_list);
                }
                if(intval($paramer[len])>0){
                    $len = intval($paramer[len]);
                    $group[$key][name] = mb_substr($value[name],0,$len,"utf-8");
                }
                if($group_type[$value[\'id\']]){
                    $nids = $value[\'id\'].",".@implode(\',\',$group_type[$value[\'id\']]);
                }else{
                    $nids = $value[\'id\'];
                }
                if($config[sy_news_rewrite]=="2"){
                    $group[$key][url] = $config[\'sy_weburl\']."/news/".$value[id]."/";
                }else{
                     $group[$key][url] = Url(\'article\',array(\'c\'=>\'list\',"nid"=>$value[id]),"1");
 
 
                }
                if($config[did]){
                    $newswhere  =    " and (`did`=$config[did] OR `did` = -1)";
                }else{
                    $newswhere    =    " and (`did`=-1 OR `did`=0 OR did=\'\')";
                }
                if($paramer[arcpic]){
                    $query = $db->query("SELECT * FROM `$db_config[def]news_base` WHERE `nid` IN ($nids) AND `newsphoto`<>\'\' $newswhere  ORDER BY `starttime` DESC limit $paramer[arcpic]");
                    while($rs = $db->fetch_array($query)){
                        if(intval($paramer[pt_len])>0){
                            $len = intval($paramer[pt_len]);
                            $rs[title] = mb_substr($rs[title],0,$len,"utf-8");
                        }
 
                        if($rs[color]){
 
                            $rs[title] = "<font color=\'".$rs[color]."\'>".$rs[title]."</font>";
 
                        }
                        if(intval($paramer[pd_len])>0){
                            $len = intval($paramer[pd_len]);
                            $rs[description] = mb_substr($rs[description],0,$len,"utf-8");
                        }
                        foreach($group as $k=>$v){
                            if($v[id]==$rs[nid]){
                                $rs[name] = $v[name];
                            }
                        }
                        if($config[sy_news_rewrite]=="2"){
                            $rs["url"]=$config[\'sy_weburl\']."/news/".date("Ymd",$rs["datetime"])."/".$rs[id].".html";
                        }else{
                            $rs["url"] = Url("article",array("c"=>"show","id"=>$rs[id]),"1");
                        }
                        $picid[]=$rs[\'id\'];
                        $arcpic[] = $rs;
                    }
                    $group[$key][arcpic] = $arcpic;
                    unset($arcpic);
                }
                if($paramer[arclist]){
                    $query = $db->query("SELECT * FROM `$db_config[def]news_base` WHERE `nid` IN ($nids) $newswhere  ORDER BY `starttime` DESC limit $paramer[arclist]");
                    while($rs = $db->fetch_array($query)){
                        if(intval($paramer[t_len])>0){
                            $len = intval($paramer[t_len]);
                            $rs[title] = mb_substr($rs[title],0,$len,"utf-8");
                        }
 
                        if($rs[color]){
 
                            $rs[title] = "<font color=\'".$rs[color]."\'>".$rs[title]."</font>";
 
                        }
                        if(intval($paramer[d_len])>0){
                            $len = intval($paramer[d_len]);
                            $rs[description] = mb_substr($rs[description],0,$len,"utf-8");
                        }
                        foreach($group as $k=>$v){
                            if($v[id]==$rs[nid]){
                                $rs[name] = $v[name];
                            }
                        }
                        if($config[sy_news_rewrite]=="2"){
                            $rs["url"]=$config[\'sy_weburl\']."/news/".date("Ymd",$rs["datetime"])."/".$rs[id].".html";
                        }else{
                            $rs["url"] = Url("article",array("c"=>"show","id"=>$rs[id]),"1");
                        }
                        //去掉和图片资讯相同的一条,总条数是文字资讯条数加上图片资讯条数
                        if($paramer[arcpic]){
                            if(!in_array($rs[\'id\'],$picid)){
                               if(count($arclist)<($paramer[arclist]-1)){
                                    $arclist[] = $rs;
                                }
                            } 
                        }else{
                            if(count($arclist)<($paramer[arclist]-1)){
                                $arclist[] = $rs;
                            }
                        }
                    }
                    $group[$key][arclist] = $arclist;
                    unset($arclist);
                }
            }
        }';
        return SmartyOutputStr($this,$compiler,$_attr,'articleclass','$group',$OutputStr,'$group');
    }
}
 
 
class Smarty_Internal_Compile_Articleclasselse extends Smarty_Internal_CompileBase{
 
 
    public function compile($args, $compiler, $parameter){
 
 
        $_attr = $this->getAttributes($compiler, $args);
 
 
 
 
 
        list($openTag, $nocache, $item, $key) = $this->closeTag($compiler, array('articleclass'));
 
 
        $this->openTag($compiler, 'articleclasselse', array('articleclasselse', $nocache, $item, $key));
 
 
 
 
 
        return "<?php }\nif (!\$_smarty_tpl->tpl_vars[$item]->_loop) {\n?>";
 
 
    }
 
 
}
 
 
class Smarty_Internal_Compile_Articleclassclose extends Smarty_Internal_CompileBase{
 
 
    public function compile($args, $compiler, $parameter){
 
 
        $_attr = $this->getAttributes($compiler, $args);
 
 
        if ($compiler->nocache) {
 
 
            $compiler->tag_nocache = true;
 
 
        }
 
 
 
 
        list($openTag, $compiler->nocache, $item, $key) = $this->closeTag($compiler, array('articleclass', 'articleclasselse'));
 
 
 
 
 
        return "<?php } ?>";
 
 
    }
 
 
}