C:\xampp\htdocs\kptv2\ro\news.tpl.php


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
<?php    
    
require_once($LIBPATH "utilfunc.php");
    require_once(
"../conf_/siteconf_.php");
    require_once(
"../admin/dbconn.php");
    
    
$year date(Y);
    
$month date(M);
    
    if(
$dbConn) {
        
$self="index.php?pg=news"//  If you use this code with a different page ( or file ) name then change this

        // how many rows to show per page
        
$rowsPerPage 10;

        
// by default we show first page
        
$pageNum 1;

        
// if $_GET['page'] defined, use it as page number
        
if(isset($_GET['page']))
        {
            
$pageNum $_GET['page'];
        }

        
// counting the offset
        
$offset = ($pageNum 1) * $rowsPerPage;

        
// Show ALL active news (current + archived) ordered by date+time desc.
        // Sticky items float to the top. ID DESC is the final tiebreaker so
        // items posted on the same date but without time info (legacy
        // 00:00:00) still appear newest-first by creation order.
        
$sql_all "SELECT * FROM stiri WHERE Activs = 1 ORDER BY Stickys DESC, Datas DESC, ID DESC";

        
$result_all = @mysql_query($sql_all);
        
$num_rows mysql_num_rows($result_all);

        
$sql "SELECT * FROM stiri WHERE Activs = 1 ORDER BY Stickys DESC, Datas DESC, ID DESC LIMIT $offset$rowsPerPage";

        
$result = @mysql_query($sql);
        
$numnow_rows mysql_num_rows($result);
        
        
$news "";
        if (
$numnow_rows == 0)    {

                
$news "<section id=\"not_found_text\">Momentan nu avem stiri</section>";

        }
        else {
            
$news .= "<section id=\"news_articles\">";

            while (
$row mysql_fetch_array($resultMYSQL_ASSOC)) {
                
$articleImage "";
                if (
$row['ImgID'] !== "")
                    
$articleImage .= '
                        <div>
                            <a href="index.php?pg=stire&amp;id=' 
$row['ID'] . '">
                                <img class="news_article_image" src="../images/stiri/' 
$row['Imagine'] .'" alt="'.$ra_page[0]->Titlu.'" onerror="this.src=\'../images/stiri/noimg.jpg\';">
                            </a>
                        </div>'
;

                
// Format date as "DD MonthRO YYYY HH:MM" using Romanian month names.
                // Time portion is only shown when it's not exactly midnight
                // (legacy DATE values become 00:00:00 after the column alter,
                // and we don't want to print bogus "00:00" for those).
                // Mark items older than 1 year as "Arhivat" (archived).
                
$dateRO '';
                
$isOutdated false;
                if (!empty(
$row['Datas']) && substr($row['Datas'], 010) !== '0000-00-00') {
                    
$ts strtotime($row['Datas']);
                    if (
$ts 0) {
                        
$mIdx = (int) date('n'$ts);
                        
$mName = isset($months[$mIdx]) ? $months[$mIdx] : date('M'$ts);
                        
$dateRO date('d'$ts) . ' ' $mName ' ' date('Y'$ts);
                        if (
date('H:i:s'$ts) !== '00:00:00') {
                            
$dateRO .= ' ' date('H:i'$ts);
                        }
                        
$isOutdated = (time() - $ts) > (365 86400);
                    }
                }
                
$outdatedClass $isOutdated ' news_outdated' '';
                
$outdatedBadge $isOutdated ' <span class="news_outdated_badge">Arhivat</span>' '';

                
$news .= '
                    <article class="news_article' 
$outdatedClass '">
                        <div class="content">
                            <div>
                                <a class="article_title" href="index.php?pg=stire&amp;id=' 
$row['ID'] . '"><b>' $row['Titlu'] . '</b></a>
                                <br>
                                <span class="news_date">' 
$dateRO '</span>' $outdatedBadge '
                                <br>
                                ' 
substr($row['Content_Short'], 0700) . '
                                <br><br>
                                <a href="index.php?pg=stire&amp;id=' 
$row['ID'] . '">
                                    <img class="image_button" src="../ro/images/icon-maimult_albume.png" data-srcover="../ro/images/icon-maimult_albume_w.png" alt="Click mai mult">
                                </a>
                            </div>
                            ' 
$articleImage '
                        </div>
                    </article>'
;
            }

            
$news .= "</section>";

            
// how many pages we have when using paging?
            
$maxPage ceil($num_rows/$rowsPerPage);

            
// creating 'previous' and 'next' link
            // plus 'first page' and 'last page' link

            // print 'previous' link only if we're not
            // on page one
            
if ($pageNum 1)
            {
                
$page $pageNum 1;
                
$prev " <a href=\"$self&amp;page=$page\">[Anterioara]</a> ";

                
$first " <a href=\"$self&amp;page=1\">[Prima]</a> ";
            } 
            else
            {
                
$prev  '<span>[Anterioara]</span>';       // we're on page one, don't enable 'previous' link
                
$first '<span>[Prima]</span>'// nor 'first page' link
            
}

            
// print 'next' link only if we're not
            // on the last page
            
if ($pageNum $maxPage)
            {
                
$page $pageNum 1;
                
$next " <a href=\"$self&amp;page=$page\">[Urmatoare]</a> ";

                
$last " <a href=\"$self&amp;page=$maxPage\">[Ultima pagina]</a> ";
            } 
            else
            {
                
$next '<span>[Urmatoare]</span>';      // we're on the last page, don't enable 'next' link
                
$last '<span>[Ultima pagina]</span>'// nor 'last page' link
            
}

            
// print the page navigation link
            //$articles .= "<tr><td align=\"center\" height=\"35\">" . $first . $prev . " Pagina&nbsp;&nbsp;<strong>$pageNum</strong>&nbsp;&nbsp;din&nbsp;&nbsp;<strong>$maxPage</strong>&nbsp;&nbsp;pagini " . $next . $last."</td></tr>";
            
$news .= "
                <section  id=\"pagination\">
                    <div>" 
$first $prev "</div>
                    <div>
                        Pagina
                        <strong>
$pageNum</strong>
                        din
                        <strong>
$maxPage</strong>
                        pagini
                    </div>
                    <div>" 
$next $last "</div>
                </section>"
;

        }

        
//mysql_free_result($result);
    
}
    
$title .="";
?>





<main class="page">
        <section class="adr2 breadcrumbs">
            <a href="index.php" class="adr2">Home</a> &raquo; Stiri
        </section>
        <section id="media_buttons">
            <!-- Go to www.addthis.com personalizat -->
            <div class="addthis-social-media">
                <a title="facebook" class="addthis_button_facebook" href="javascript:;">
                    <img alt="Facebook" src="/images/img_social/icon-share-fb.png" />
                </a>
                <a title="twitter" class="addthis_button_twitter" href="javascript:;">
                    <img alt="Twitter" src="/images/img_social/icon-share-twitter.png" />
                </a>
                <a title="email" target="_blank" class="addthis_button_email" href="javascript:;">
                    <img alt="email" src="/images/img_social/icon-share-email.png" />
                </a>
            </div>
            <div>
                Feed RSS:
                <a href="https://radio.kptv.ro/rss" target="_blank">
                    <img src="../rss/xml.gif" alt="RSS">
                </a>
            </div>
        </section>

        <?= $news?>

</main>
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586