TOV logo

Trop za okoljsko vzgojo

  Aktualno
» Novice
» Ekodilema
» Kilođul
» Galerije
O tropu Literatura Povezave
» Skavtske
» Zelene
 
" . mysql_error()); $usernum = mysql_num_rows($q['userchk']); if(!isset($_POST['passw']) || $usernum == "0") { if($usernum == "1") { ?> :
:
" . mysql_error()); print $lang['msgNewsCommentAdded'] . "
[ $_POST['a'])) . "\">" . $lang['lblNewsBack'] . " ]"; */ } } } else { $q['userchk'] = mysql_query("SELECT * FROM $t_user WHERE user = '" . cn_dbEscape( $_POST['name'] ) . "' AND pass='" . cn_dbEscape( $_POST['passw'] ) . "' LIMIT 1", $link) or E( $lang['errorUserInfoCheck'] . "
" . mysql_error()); if(mysql_num_rows($q['userchk']) == "1") { // Post comment with protected username $_POST['name'] = cn_htmltrans($_POST['name'],'text'); $_POST['comment'] = cn_htmltrans($_POST['comment'],'text'); $q[ins_com] = mysql_query("INSERT INTO $t_coms (id, news_id, name, email, comment, date, ip) VALUES ('', '$_POST[a]', '$_POST[name]', '$_POST[email]', '$_POST[comment]', '$now', '$_SERVER[REMOTE_ADDR]')", $link) or E( $lang['errorNewsCommentInsert'] . "
" . mysql_error()); print $lang['msgNewsCommentAdded'] . "
[ $_POST['a'])) . "\"><< Nazaj ]"; } else { print $lang['errorNewsCommentPassword'] . "
[ << Nazaj ]"; } } } else { $q['info'] = mysql_query("SELECT * FROM $t_news WHERE id = '$_REQUEST[a]' LIMIT 1", $link) or E( $lang['errorNewsSelect'] . "
" . mysql_error()); $newsnum = mysql_num_rows($q['info']); } // If search is performed [v1.12] } elseif(isset($_REQUEST['s'])) { $q['info'] = mysql_query("SELECT * FROM $t_news WHERE content LIKE '%" . cn_dbEscape( $_REQUEST['s'] ) . "%' ORDER BY date DESC LIMIT $lims, $pgset", $link) or E( $lang['errorNewsSearch'] . "
" . mysql_error()); $newsnum = mysql_num_rows($q['info']); // Retrieve all news items } else { $extra = ""; if(!empty($c)) { $_REQUEST['c'] = "$c"; } if($_REQUEST['c'] != "") { $extra = "WHERE cat = '$_REQUEST[c]'"; } $q['cats'] = mysql_query("SELECT * FROM $t_cats ORDER BY name ASC", $link) or E( $lang['errorCategorySelect'] . "
" . mysql_error()); $catnum = mysql_num_rows($q['cats']); $q['info'] = mysql_query("SELECT * FROM $t_news $extra ORDER BY date DESC LIMIT $lims, $pgset", $link) or E( $lang['errorNewsSelect'] . "
" . mysql_error()); $q['countn'] = mysql_query("SELECT COUNT(id) as newscount FROM $t_news $extra", $link) or E( $lang['errorNewsSelect'] . "
" . mysql_error()); $newsnum = mysql_result($q['countn'],'newscount'); if($catnum > "1" && $set['catbox'] == "on") { ?>

"; } if(isset($q['info'])) { // $q[info] check // Retrieve array of images from database [v1.14] $q['images'] = mysql_query("SELECT id, filename, thumbname FROM $t_img", $link) or E( $lang['errorImagesSelect'] . "
" . mysql_error()); while($img = mysql_fetch_array($q['images'])) { if(empty($img['thumbname'])) { $imgarr[$img['id']] = $img['filename']; } else { $imgarr[$img['id']] = $img['thumbname']; } } // Begin output of news items while ($r = mysql_fetch_array($q['info'], MYSQL_ASSOC)) { $auid = $r['author']; $output = $set['output']; $r['subject'] = "$r[subject]"; $serv_tzone = (date("Z")/3600); // Format date to current timezone, using format setting specified $r['date'] = date("$set[dateform]", cn_zonechange("$serv_tzone", "$set[timezone]", "$r[date]")); // Print category name for current news item [v1.13] $catname = cn_getinfo($r['cat'],"name",$t_cats); $output = str_replace("{cat}", "$catname", $output); // Add line breaks to both content areas only [v1.13 fix] $content = str_replace("\n", "
\n", $r['content']); $content2 = str_replace("\n", "
\n", $r['content2']); // Replace image tags with proper images [v1.14] if(is_array($imgarr)) { foreach($imgarr as $imgid => $filename) { $content = str_replace("{img:$imgid}","" . cn_showImage($filename,"left") . "", $content); $content = str_replace("{img:$imgid|left}","" . cn_showImage($filename,"left") . "", $content); $content = str_replace("{img:$imgid|center}","" . cn_showImage($filename,"center") . "", $content); $content = str_replace("{img:$imgid|right}","" . cn_showImage($filename,"right") . "", $content); $content2 = str_replace("{img:$imgid}","" . cn_showImage($filename,"left") . "", $content2); $content2 = str_replace("{img:$imgid|left}","" . cn_showImage($filename,"left") . "", $content2); $content2 = str_replace("{img:$imgid|center}","" . cn_showImage($filename,"center") . "", $content2); $content2 = str_replace("{img:$imgid|right}","" . cn_showImage($filename,"right") . "", $content2); } } // Highlight searched item in returned news if search is performed and searches are allowed [v1.12] if(isset($_REQUEST['s'])) { $content = cn_highlight(stripslashes($content), $_REQUEST['s']); // case-insensitive or partial word search //$output = str_replace("$_REQUEST[s]", "$s", $output); // exact word search } // Summarize story option [v1.12] if($r['sumstory'] == "on" && isset($_REQUEST['a'])) { $output = str_replace("{news}", "$content
$content2", $output); } elseif($r['sumstory'] == "on") { $output = str_replace("{news}", "$content " . $lang['lblNewsReadMore'] . "", $output); } else { $output = str_replace("{news}", "$content", $output); } // Use Keywords and word filter if filter is turned "on" [v1.12] if($set['words'] == "on") { $q['words'] = mysql_query("SELECT * FROM $t_words ORDER BY word ASC", $link) or E( $lang['errorKeywordsSelect'] . "
" . mysql_error()); while ($w = mysql_fetch_array($q['words'], MYSQL_ASSOC)) { if($w['type'] == "link") { $w['replaced'] = "$w[word]"; } elseif($w['type'] == "picture") { $w['replaced'] = "\"$w[word]\""; } $output = str_replace($w['word'], $w['replaced'], $output); } } // Build user-defined source link [v1.12] if(empty($r['source']) || empty($r['sourceurl'])) { $output = str_replace("{source}", "", $output); } else { if(empty($set['source'])) { $setsource = "$r[source]"; $output = str_replace("{source}", "$setsource", $output); } else { $setsource = str_replace("{sname}", $r['source'], $set['source']); $setsource = str_replace("{surl}", $r['sourceurl'], $setsource); $output = str_replace("{source}", $setsource, $output); } } // Build user-defined author link [v1.12] if(empty($set['author'])) { $setauthor = "" . cn_getinfo($r['author']) . ""; $output = str_replace("{author}", "$setauthor", $output); } else { $setauthor = str_replace("{aemail}", "" . cn_getinfo($r['author'], "email") . "", $set['author']); $setauthor = str_replace("{aname}", "" . cn_getinfo($r['author']) . "", $setauthor); $output = str_replace("{author}", $setauthor, $output); } $output = str_replace("{subject}", $r['subject'], $output); $output = str_replace("{date}", $r['date'], $output); // Transform news output to HTML code $output = cn_htmltrans($output,'html'); // View/Post Comments Link [v1.12] if($set['comments'] == "on" && !isset($_REQUEST['a'])) { $q['comsn'] = mysql_query("SELECT COUNT(id) as comscount FROM $t_coms WHERE news_id = '$r[id]'", $link) or E( $lang['errorNewsCommentSelect'] . "
" . mysql_error()); $comsnum = mysql_result($q['comsn'],comscount); if(empty($set['coms_text'])) { $output = str_replace("{comments}", "$r['id'])) . "\">" .$lang['lblNewsPostComments'] . " ($comsnum)", $output); } else { $setcoms_text = str_replace("{cnum}", "$comsnum", $set['coms_text']); $output = str_replace("{comments}", "$r['id'])) . "\">$setcoms_text", $output); } } elseif(isset($_REQUEST['a'])) { //$output = str_replace("{comments}", "
[ '')) . "\">" . $lang['lblNewsReturn'] . " ]", $output); $output = str_replace("{comments}", "", $output); } else { $output = str_replace("{comments}", "", $output); } // Output formatted news echo $output; } // End While (output of news items) // If single article is viewed, and comments are turned "on", list comments [v1.12] if(isset($_REQUEST['a']) && $set['comments'] == "on") { $q['coms'] = mysql_query("SELECT * FROM $t_coms WHERE news_id = '$_REQUEST[a]' ORDER BY date ASC", $link) or E( $lang['errorNewsCommentSelect'] . "
" . mysql_error()); $comsnum = mysql_num_rows($q['coms']); if($comsnum != "0") { ?> () \n" . $lang['lblNewsCommentEmail'] . ": $c[email]
\n"; if( !empty( $c['website'] ) ) { echo $lang['lblNewsCommentWebsite'] . ": $c[website]
\n"; } echo $lang['lblNewsCommentText'] . ": " . stripslashes(nl2br($c['comment'])) . "
\n"; } } ?>
:

:

:

:

$pgset) { if ($pg != "1") { $pgn = $pg-1; print "$pgn,'c'=>$_REQUEST['c'],'a'=>'')) . "\">"; print $lang['lblPagePrev']; print "  "; } $totalpages = ceil($newsnum / $pgset); for ($loop = 1; ;$loop++) { if ($loop > $totalpages) { break; } if ($loop == $pg) { print "$loop"; print "  "; } else { print "$loop,'c'=>$_REQUEST['c'],'a'=>'')) . "\">"; print $loop; print ""; print "  "; } } } if ($pg < $totalpages) { $pgn = $pg+1; print "$pgn,'c'=>$_REQUEST['c'],'a'=>'')) . "\">"; print $lang['lblPageNext']; print ""; } } ?>