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.
| 1. / 2. / ...
<?php
// ClanSphere 2007 - www.clansphere.net
// $Id: recent.php 213 2006-08-15 15:27:56Z hajo $
$cs_lang = cs_translate('news');
$select = 'ne.news_id AS news_id, ne.news_headline AS news_headline, ne.news_time AS news_time';
$public = 'ne.news_public > '0' AND cat.categories_access <= '' . $account['access_news'] . ''';
$order = 'ne.news_time DESC';
$tables = 'news ne INNER JOIN {pre}_categories cat ON ne.categories_id = cat.categories_id';
$cs_news = cs_sql_select(__FILE__,$tables,$select,$public,'ne.news_time DESC',0,4);
if(empty($cs_news)) {
echo $cs_lang['no_data'];
}
else {
$data = array();
$run = 0;
foreach ($cs_news AS $news) {
$data['news'][$run]['news_time'] = cs_date('unix',$news['news_time'],1);
$short = strlen($news['news_headline']) <= 15 ? $news['news_headline'] : substr($news['news_headline'],0,15) . '...';
$data['news'][$run]['news_url'] = cs_url('news','view','id=' . $news['news_id']);
$data['news'][$run]['news_short'] = cs_secure($short);
$data['news'][$run]['news_headline'] = cs_secure($news['news_headline']);
$run++;
}
echo cs_subtemplate(__FILE__,$data,'news','navlist');
}
$news_limit = 8;
$cat_id = empty($_REQUEST['where']) ? 0 : $_REQUEST['where'];
$where = "nws.news_public > 0 AND cat.categories_access <= '" . $account['access_news'] . "'";
if(!empty($cat_id)) {
settype($cat_id,'integer');
$where .= " AND cat.categories_id = '" . $cat_id . "'";
}
$start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
$newsmod = "categories_mod = 'news' AND categories_access <= '" . $account['access_news'] . "'";
$cat_data = cs_sql_select(__FILE__,'categories','*',$newsmod,'categories_name',0,0);
$data['head']['dropdown'] = cs_dropdown('where','categories_name',$cat_data,$cat_id,'categories_id');
$data['head']['button'] = cs_html_vote('submit',$cs_lang['show'],'submit');
$join = 'news nws INNER JOIN {pre}_categories cat ON nws.categories_id = cat.categories_id';
$news_count = cs_sql_count(__FILE__,$join,$where,'news_id');
$data['head']['pages'] = cs_pages('news','recent',$news_count,$start,$cat_id,0,$news_limit);
$from = 'news nws INNER JOIN {pre}_users usr ON nws.users_id = usr.users_id ';
$from .= 'INNER JOIN {pre}_categories cat ON nws.categories_id = cat.categories_id';
$select = 'nws.news_id AS news_id, nws.news_headline AS news_headline, nws.news_time AS news_time, nws.news_text AS news_text, nws.news_pictures AS news_pictures, nws.users_id AS users_id, usr.users_nick AS users_nick, nws.categories_id AS categories_id, cat.categories_picture AS categories_picture, cat.categories_name AS categories_name';
$order = 'news_attached DESC, news_time DESC';
$cs_news = cs_sql_select(__FILE__,$from,$select,$where,$order,$start,$news_limit);
$news_loop = count($cs_news);
for($run = 0; $run < $news_loop; $run++) {
$cs_news[$run]['news_headline'] = cs_secure($cs_news[$run]['news_headline']);
$cs_news[$run]['news_time'] = cs_date('unix',$cs_news[$run]['news_time'],1);
$cs_news[$run]['news_text'] = cs_secure($cs_news[$run]['news_text'],1,1,1,1);
$cs_user = cs_secure($cs_news[$run]['users_nick']);
$cs_news[$run]['users_link'] = cs_link($cs_user,'users','view','id=' . $cs_news[$run]['users_id']);
$where3 = "comments_mod = 'news' AND comments_fid = '" . $cs_news[$run]['news_id'] . "'";
$cs_news[$run]['comments_count'] = cs_sql_count(__FILE__,'comments',$where3);
$start = floor($cs_news[$run]['comments_count'] / ($account['users_limit'] +1)) * $account['users_limit'];
$cs_news_com_count = $cs_news[$run]['comments_count'] - $start;
$cs_news[$run]['comments_link'] = cs_link($cs_lang['comments'],'news','view','id=' . $cs_news[$run]['news_id'] . '&start=' . $start . '#com' . $cs_news_com_count);
$cs_news[$run]['categories_name'] = cs_secure($cs_news[$run]['categories_name']);
$cs_news[$run]['if']['catimg'] = empty($cs_news[$run]['categories_picture']) ? false : true;
$cs_news[$run]['url_catimg'] = empty($cs_news[$run]['if']['catimg']) ? '' : 'uploads/categories/'.$cs_news[$run]['categories_picture'];
if(!empty($cs_news[$run]['news_pictures'])) {
$cs_news[$run]['news_text'] .= cs_html_hr('100%');
$news_pics = explode("n",$cs_news[$run]['news_pictures']);
foreach($news_pics AS $pic) {
$link = cs_html_img('uploads/news/thumb-' . $pic);
$cs_news[$run]['news_text'] .= cs_html_link('uploads/news/picture-' . $pic,$link) . ' ';
}
}
}
$data['news'] = $cs_news;
echo cs_subtemplate(__FILE__,$data,'news','recent');
?> |