'' ORDER BY ".$sort."";
} else {
$query = "SELECT icon FROM ".$language_data[entries]." where entry_id='".$entry_id."'";
}
$result = pg_Exec($db, $query);
$totalrows = pg_NumRows($result);
if ($totalrows!=0) {
$data = pg_fetch_array ($result, 0);
if ($data[icon]!="") {
$icon_dimensions = getimagesize("$site_path/graphics/sm/$data[icon]");
}
if ($echo=="true") {
echo $data[icon];
} else {
$icon = $data[icon];
return $icon_dimensions;
return $icon;
}
}
}
function img_content() {
global $cssfile, $offset, $no_images, $nodate, $result_thread, $totalrows_thread, $perm, $QUERY_STRING, $PHP_SELF, $doc_root, $categories, $mapa, $show_nav, $data, $data_thread, $fdate, $edit_button, $entry_id, $language_data, $db, $passed_cat_secondary, $passed_cat_type, $cat_type, $sort, $limit, $thread_limit, $show_news, $article_summary_length, $img_dimensions, $img, $site_path;
// If the passed in category type exists then use it to query the database.
// If the category type ends up being empty, set it to 2, which is usually news.
if($passed_cat_type!='') {
$cat_type="$passed_cat_type";
} else {
$cat_type=0;
}
// If the passed in category type exists then use it to query the database.
if($passed_cat_secondary!='') {$cat_secondary = "OR type='$passed_cat_secondary'"; }
if(!$entry_id) {
$query = "SELECT image FROM ".$language_data[entries]." where type='".$cat_type."' ".$cat_secondary." AND image <> '' ORDER BY ".$sort."";
} else {
$query = "SELECT image FROM ".$language_data[entries]." where entry_id='".$entry_id."'";
}
$result = pg_Exec($db, $query);
$totalrows = pg_NumRows($result);
if ($totalrows!=0) {
$data = pg_fetch_array ($result, 0);
if ($data[image]!="") {
$img=$data[image];
$img_dimensions = getimagesize("$site_path/graphics/$data[image]");
}
}
}
function aces_remove_accents( $string )
{
$string = htmlentities($string);
return preg_replace("/&([a-z])[a-z]+;/i","$1",$string);
}
function random_article() {
global $cssfile, $offset, $no_images, $nodate, $result_thread, $totalrows_thread, $perm, $QUERY_STRING, $PHP_SELF, $doc_root, $categories, $mapa, $show_nav, $data, $data_thread, $fdate, $edit_button, $language_data, $db, $passed_cat_secondary, $passed_cat_type, $cat_type, $sort, $limit, $thread_limit, $show_news, $article_summary_length, $passed_entry_id;
// If $offset is set below zero (invalid) or empty, set to zero
if(!$limit) {
$limit = 1;
}
// If the passed in category type exists then use it to query the database.
// If the category type ends up being empty, set it to 0, which is usually news.
if($passed_cat_type!='') {
$cat_type="$passed_cat_type";
} else {
$cat_type=0;
}
if($passed_entry_id) {
$entry_id=$passed_entry_id;
$query = "SELECT * FROM ".$language_data[entries]." where entry_id='".$entry_id."';";
$result = pg_Exec($db, $query);
$totalrows = 1;
$num = 0;
} else {
// If the passed in category type exists then use it to query the database.
if($passed_cat_secondary!='') {$cat_secondary = "OR type='$passed_cat_secondary'"; }
$query = "SELECT * FROM ".$language_data[entries]." where type='".$cat_type."' ".$cat_secondary.";";
$result = pg_Exec($db, $query);
$totalrows = pg_NumRows($result);
srand((double)microtime()*1000000);
$randval = rand(0,$totalrows-1);
$num = $randval;
}
// if there are no entries, display the no_news string from the language files.
if ($totalrows==0 && !$entry_id) {
echo $language_data[no_news];
} else {
$data = pg_fetch_array($result, $num);
echo "
\n";
}
}
function text_content() {
global $cssfile, $offset, $no_images, $nodate, $result_thread, $totalrows_thread, $perm, $QUERY_STRING, $PHP_SELF, $doc_root, $categories, $mapa, $show_nav, $data, $data_thread, $fdate, $edit_button, $entry_id, $language_data, $db, $passed_cat_secondary, $passed_cat_type, $cat_type, $sort, $limit, $thread_limit, $show_news, $article_summary_length;
// If $offset is set below zero (invalid) or empty, set to zero
if (empty($offset) || $offset < 0) {
$offset=0;
}
// default limits of database query and summary length.
if($show_news) {
$limit=10;
$article_summary_length=300;
}
if(!$limit) {
$limit = 1;
}
if(!$thread_limit) {
$thread_limit = 50;
}
// If no sort values are specified by the client script, set to DESCENDING.
if ($sort==""){
$sort = "date DESC";
}
if($offset==""){
$offset = "0";
}
// If the passed in category type exists then use it to query the database.
// If the category type ends up being empty, set it to 0, which is usually news.
if($passed_cat_type!='') {
$cat_type="$passed_cat_type";
} else {
$cat_type=0;
}
// If the passed in category type exists then use it to query the database.
if($passed_cat_secondary!='') {$cat_secondary = "OR type='$passed_cat_secondary'"; }
$sort_test = "SELECT sort FROM ".$language_data[entries]." where type='".$cat_type."' ".$cat_secondary." AND hide <> 't' LIMIT 1;";
$sort_result = pg_Exec($db, $sort_test);
if($sort_result) {
$sort_data = pg_fetch_array ($sort_result, 0);
}
if($sort_data[sort]=='') { $sort = "date DESC"; }
$query = "SELECT * FROM ".$language_data[entries]." where type='".$cat_type."' ".$cat_secondary." AND hide <> 't' ORDER BY ".$sort." OFFSET $offset LIMIT $limit;";
$result = pg_Exec($db, $query);
$totalrows = pg_NumRows($result);
// srand((double)microtime()*1000000);
// $randval = rand(0,$totalrows);
// $num = $randval;
// if there are no entries, display the no_news string from the language files.
if ($totalrows==0 && !$entry_id) {
echo $language_data[no_news];
} else {
// Now retrieve records for current page
// Check to see if we are explicitly calling on a particular entry_id (permalink)
// from a menu or headline or article.
for ($i = 0; $i < $totalrows; $i++) {
$data = pg_fetch_array ($result, $i);
echo "
";
}
}
}
function all_content() {
global $cssfile, $offset, $no_images, $nodate, $result_thread, $totalrows_thread, $perm, $QUERY_STRING, $PHP_SELF, $doc_root, $categories, $mapa, $show_nav, $data, $data_thread, $fdate, $edit_button, $entry_id, $language_data, $db, $passed_cat_secondary, $passed_cat_type, $cat_type, $sort, $limit, $thread_limit, $show_news, $article_summary_length;
// If $offset is set below zero (invalid) or empty, set to zero
if (empty($offset) || $offset < 0) {
$offset=0;
}
// default limits of database query and summary length.
if($show_news) {
$limit=10;
$article_summary_length=300;
}
if(!$limit) {
$limit = 1;
}
if(!$thread_limit) {
$thread_limit = 50;
}
// If no sort values are specified by the client script, set to DESCENDING.
if ($sort==""){
$sort = "date DESC";
}
if($offset==""){
$offset = "0";
}
// If the passed in category type exists then use it to query the database.
// If the category type ends up being empty, set it to 2, which is usually news.
if($passed_cat_type!='') {
$cat_type="$passed_cat_type";
} else {
$cat_type=2;
}
// If the passed in category type exists then use it to query the database.
if($passed_cat_secondary!='') {$cat_secondary = "OR type='$passed_cat_secondary'"; }
$query = "SELECT * FROM ".$language_data[entries]." where type='".$cat_type."' ".$cat_secondary." AND hide <> '1' ORDER BY ".$sort." OFFSET $offset LIMIT $limit;";
$result = pg_Exec($db, $query);
$totalrows = pg_NumRows($result);
// srand((double)microtime()*1000000);
// $randval = rand(0,$totalrows);
// $num = $randval;
// if there are no entries, display the no_news string from the language files.
if ($totalrows==0 && !$entry_id) {
echo $language_data[no_news];
} else {
// Now retrieve records for current page
// Make sure that image_count is initialized to zero
if (!$image_count) {$image_count = 0;}
// Check to see if we are explicitly calling on a particular entry_id (permalink)
// from a menu or headline or article.
for ($i = 0; $i < $totalrows; $i++) {
$data = pg_fetch_array ($result, $i);
if(!$hideheadline) {
echo "
$arrow",$data[headline],"\n";
// show the edit button if we are in admin mode. If a malicious user passes edit_button,
// then it will show, although it will not do anything. The logic is contained in the admin area.
if ($edit_button) {
echo "\n";
}
if($sort_button) {
echo "";
}
echo "
\n";
}
}
if($data[icon] && !$entry_id && $no_images!="1") {
if(!$float) {$float="align=\"left\"";}
echo "\n";
}
echo $data[para01],"\n";
if($data[send_email]==t) {
echo "";
}
if($data[document] && $data[document]!="none") {
document_link();
}
if($thread_reorder) {
for ($i = 0; $i < $totalrows_thread; $i++) {
$data_thread = pg_fetch_array($result_thread, $i);
print_thread_elements();
}
} else {
for ($i = 0; $i < $totalrows_thread; $i++) {
$data_thread = pg_fetch_array($result_thread, $i);
print_thread();
}
}
} else {
// If $offset is set below zero (invalid) or empty, set to zero
if (empty($offset) || $offset < 0) {
$offset=0;
}
// default limits of database query and summary length.
if($show_news) {
$limit=10;
$article_summary_length=300;
}
if(!$limit) {
$limit = 1;
}
if(!$thread_limit) {
$thread_limit = 50;
}
// If no sort values are specified by the client script, set to DESCENDING.
if ($sort==""){
$sort = "date DESC";
}
if($offset==""){
$offset = "0";
}
// If the passed in category type exists then use it to query the database.
// If the category type ends up being empty, set it to 2, which is usually news.
if($passed_cat_type!='') {
$cat_type=$passed_cat_type;
} else {
$cat_type=2;
}
// If the passed in category type exists then use it to query the database.
if($passed_cat_secondary!='') {$cat_secondary = "OR type='$passed_cat_secondary'"; }
$query = "SELECT * FROM ".$language_data[entries]." where type='".$cat_type."' ".$cat_secondary." AND hide <> 't' ORDER BY ".$sort." OFFSET $offset LIMIT $limit;";
$result = pg_Exec($db, $query);
$totalrows = pg_NumRows($result);
// srand((double)microtime()*1000000);
// $randval = rand(0,$totalrows);
// $num = $randval;
// if there are no entries, display the no_news string from the language files.
if ($totalrows==0 && !$entry_id) {
echo $language_data[no_news];
} else {
// Now retrieve records for current page
// Make sure that image_count is initialized to zero
if (!$image_count) {$image_count = 0;}
// Check to see if we are explicitly calling on a particular entry_id (permalink)
// from a menu or headline or article.
if($show_nav && $cssfile=="") {
echo "
\n";
if($show_nav) {
$mapa=$data[type];
echo "".$categories[$mapa][$language_data[lang]]." » \n";
}
echo $data[headline];
// show the edit button if we are in admin mode. If a malicious user passes edit_button,
// then it will show, although it will not do anything. The logic is contained in the admin area.
if ($edit_button) {
echo " \n";
}
echo "
$arrow",$data[headline],"\n";
// show the edit button if we are in admin mode. If a malicious user passes edit_button,
// then it will show, although it will not do anything. The logic is contained in the admin area.
if ($edit_button) {
echo "\n";
}
if($sort_button) {
echo "";
}
echo "
\n";
}
}
if($data[icon] && !$entry_id && $no_images!="1") {
if(!$float) {$float="align=\"left\"";}
echo "\n";
}
echo $data[para01],"\n";
if($data[send_email]==t) {
echo "";
}
if($data[document] && $data[document]!="none") {
document_link();
}
if($thread_reorder) {
for ($i = 0; $i < $totalrows_thread; $i++) {
$data_thread = pg_fetch_array($result_thread, $i);
print_thread_elements();
}
} else {
for ($i = 0; $i < $totalrows_thread; $i++) {
$data_thread = pg_fetch_array($result_thread, $i);
print_thread();
}
}
} else {
// If $offset is set below zero (invalid) or empty, set to zero
if (empty($offset) || $offset < 0) {
$offset=0;
}
// default limits of database query and summary length.
if($show_news) {
$limit=10;
$article_summary_length=300;
}
if(!$limit) {
$limit = 1;
}
if(!$thread_limit) {
$thread_limit = 50;
}
// If no sort values are specified by the client script, set to DESCENDING.
if ($sort==""){
$sort = "date DESC";
}
if($offset==""){
$offset = "0";
}
// If the passed in category type exists then use it to query the database.
// If the category type ends up being empty, set it to 2, which is usually news.
if($passed_cat_type!='') {
$cat_type=$passed_cat_type;
} else {
$cat_type=2;
}
// If the passed in category type exists then use it to query the database.
if($passed_cat_secondary!='') {$cat_secondary = "OR type='$passed_cat_secondary'"; }
$query = "SELECT * FROM ".$language_data[entries]." where type='".$cat_type."' ".$cat_secondary." AND hide <> 't' ORDER BY ".$sort." OFFSET $offset LIMIT $limit;";
$result = pg_Exec($db, $query);
$totalrows = pg_NumRows($result);
// srand((double)microtime()*1000000);
// $randval = rand(0,$totalrows);
// $num = $randval;
// if there are no entries, display the no_news string from the language files.
if ($totalrows==0 && !$entry_id) {
echo $language_data[no_news];
} else {
// Now retrieve records for current page
// Make sure that image_count is initialized to zero
if (!$image_count) {$image_count = 0;}
// Check to see if we are explicitly calling on a particular entry_id (permalink)
// from a menu or headline or article.
if($show_nav && $cssfile=="") {
echo "
\n";
if($show_nav) {
$mapa=$data[type];
echo "".$categories[$mapa][$language_data[lang]]." » \n";
}
echo $data[headline];
// show the edit button if we are in admin mode. If a malicious user passes edit_button,
// then it will show, although it will not do anything. The logic is contained in the admin area.
if ($edit_button) {
echo " \n";
}
echo "