'' 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"; if($show_nav) { $mapa=$data[type]; echo "".$categories[$mapa][$language_data[lang]]." » \n"; } echo $data[headline]; echo "

\n"; if (strlen ( $data[para01]) >= $article_summary_length) { echo "

".rtrim(strrev(strstr(strrev(substr(strip_tags($data[para01]), 0, $article_summary_length)), " "))," \."),"...

\n"; } $url_replace = array("?",":","!","&"," ","'",",","."); echo "

$language_data[complete_article]

\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 "
"; if(!$hideheadline) { echo "

\n"; if($show_nav) { $mapa=$data[type]; echo "".$categories[$mapa][$language_data[lang]]." » \n"; } echo $data[headline]; echo "

\n"; } if($data[date]!='' && !$nodate ) { get_date(); echo "

",$fdate,"

\n"; } // echo $data[para01],"\n"; // echo rtrim(strrev(strstr(strrev(substr(strip_tags($data[para01], "

"), 0, $article_summary_length)), "

"))," \."),"...\n"; $more_tag = strstr($data[para01],""); if ($more_tag) { $text = explode('', $data[para01], 2); echo $text[0]; echo "

$language_data[complete_article]

\n"; } elseif (strlen ( $data[para01]) >= $article_summary_length) { echo strrev(strstr(strrev(substr($data[para01], 0, $article_summary_length)), ">p/<")),"\n\n"; echo "

$language_data[complete_article]

\n"; } else { echo $data[para01]; } 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 "

\n"; if($show_nav) { $mapa=$data[type]; echo "".$categories[$mapa][$language_data[lang]]." » \n"; } echo $data[headline]; echo "

\n"; } /* if($data[date]!='' && !$nodate ) { get_date(); echo "

",$fdate,"

\n"; } */ if ($data[image]!="" && $no_images!="1") { $image_count++; if ($image_count%2==0) { $align="img_right"; $float="right"; } else { $align="img_left"; $float="left"; } if($data[url]) { echo "
\n"; echo "

",$data[caption],"

\n"; } else { echo "
\n"; echo "

",$data[caption],"

\n"; } } echo $data[para01],"\n"; /* if($data[send_email]==t) { echo "
"; }*/ // Check to see if there are threads which pertain to specified entry_id $query_thread = "SELECT * FROM ".$language_data[threads]." WHERE entry_id='".$data[entry_id]."' ORDER BY thread_id ASC;"; $result_thread = pg_Exec($db, $query_thread); $totalrows_thread = pg_NumRows($result_thread); for ($s = 0; $s < $totalrows_thread; $s++) { $data_thread = pg_fetch_array($result_thread, $s); print_thread(); if($totalrows_thread-1==$s) {echo "";} } } } } function web_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, $hideheadline, $thread_headline, $thread_graphic, $thread_body, $thread_reorder; if(!$news_width) { $news_width="100%"; } $mimetype = array ( htm => "htm.png", pdf => "pdf.png", doc => "word.png", xls => "excel.png", ppt => "powerpoint.png", pps => "powerpoint.png", rtf => "richtext.png", sxw => "ooo_writer.png", sxc => "ooo_calc.png", sxi => "ooo_impress.png", sdw => "ooo_writer.png", sdc => "ooo_calc.png", sdd => "ooo_impress.png", wmv => "video.png", asx => "video.png"); if($entry_id) { $query = "SELECT * FROM ".$language_data[entries]." WHERE entry_id='$entry_id' AND hide <> 't'"; // Check to see if there are threads which pertain to specified entry_id $query_thread = "SELECT * FROM ".$language_data[threads]." WHERE entry_id='$entry_id' ORDER BY thread_id ASC;"; $result = pg_Exec($db, $query); $result_thread = pg_Exec($db, $query_thread); $data = pg_fetch_array($result, 0); $totalrows_thread = pg_NumRows($result_thread); // mapa and show_nav stuff is a dirty hack for displaying html via css. // Not sure what I'm going to do with this. if(!$mapa) {$mapa=$data[type];} if($show_nav=="1" && $cssfile=="") { echo "

» ".$language_data[home]." » ".$categories[$mapa][$language_data[lang]]."

".$language_data[printer_friendly]."
\n"; $arrow = "» "; } 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[date]!='' && !$nodate ) { get_date(); echo "

",$fdate,"

\n"; } if ($data[image]!="" && $no_images!="1") { $image_count++; if ($image_count%2==0) { $align="img_right"; $float="right"; } else { $align="img_left"; $float="left"; } if($data[url]) { echo "
\n"; echo "

",$data[caption],"

\n"; } else { echo "
\n"; echo "

",$data[caption],"

\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 "

» ".$language_data[home]."".$language_data[printer_friendly]."

\n"; } for ($i = 0; $i < $totalrows; $i++) { $data = pg_fetch_array ($result, $i); if(!$hideheadline) { 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 "

\n"; } if($data[date]!='' && !$nodate ) { get_date(); echo "

",$fdate,"

\n"; } if($data[icon] && !$entry_id && $no_images!="1") { if(!$float) {$float="align=\"left\"";} echo "\n"; } if (strstr($data[para01],"")) { $excerpt=$data[para01]; $excerpt_array=explode('',$excerpt); $data[para01]=$excerpt_array[0]; echo $data[para01],"\n"; echo "

$language_data[complete_article]

\n"; } elseif ( strlen ( $data[para01]) >= $article_summary_length) { echo "

".rtrim(strrev(strstr(strrev(substr(strip_tags($data[para01]), 0, $article_summary_length)), " "))," \."),"...

\n"; if($data[document] && $data[document]!="none") { document_link(); } echo "

$language_data[complete_article]

\n"; } else { echo $data[para01],"\n"; if($data[document] && $data[document]!="none") { document_link(); } } } } } } function web_content_new() { 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, $hideheadline, $thread_headline, $thread_graphic, $thread_body, $thread_reorder; if(!$news_width) { $news_width="100%"; } $mimetype = array ( htm => "htm.png", pdf => "pdf.png", doc => "word.png", xls => "excel.png", ppt => "powerpoint.png", pps => "powerpoint.png", rtf => "richtext.png", sxw => "ooo_writer.png", sxc => "ooo_calc.png", sxi => "ooo_impress.png", sdw => "ooo_writer.png", sdc => "ooo_calc.png", sdd => "ooo_impress.png", wmv => "video.png", asx => "video.png"); if($entry_id) { $query = "SELECT * FROM ".$language_data[entries]." WHERE entry_id='$entry_id'"; // Check to see if there are threads which pertain to specified entry_id $query_thread = "SELECT * FROM ".$language_data[threads]." WHERE entry_id='$entry_id' ORDER BY thread_id ASC;"; $result = pg_Exec($db, $query); $result_thread = pg_Exec($db, $query_thread); $data = pg_fetch_array($result, 0); $totalrows_thread = pg_NumRows($result_thread); // mapa and show_nav stuff is a dirty hack for displaying html via css. // Not sure what I'm going to do with this. if(!$mapa) {$mapa=$data[type];} if($show_nav=="1" && $cssfile=="") { echo "

» ".$language_data[home]." » ".$categories[$mapa][$language_data[lang]]."

".$language_data[printer_friendly]."
\n"; $arrow = "» "; } 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[date]!='' && !$nodate ) { get_date(); echo "

",$fdate,"

\n"; } if ($data[image]!="" && $no_images!="1") { $image_count++; if ($image_count%2==0) { $align="img_right"; $float="right"; } else { $align="img_left"; $float="left"; } if($data[url]) { echo "
\n"; echo "

",$data[caption],"

\n"; } else { echo "
\n"; echo "

",$data[caption],"

\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 "

» ".$language_data[home]."".$language_data[printer_friendly]."

\n"; } for ($i = 0; $i < $totalrows; $i++) { $data = pg_fetch_array ($result, $i); if(!$hideheadline) { 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 "

\n"; } if($data[date]!='' && !$nodate ) { get_date(); echo "

",$fdate,"

\n"; } if($data[icon] && !$entry_id && $no_images!="1") { if(!$float) {$float="align=\"left\"";} echo "\n"; } if (strlen ( $data[para01]) >= $article_summary_length) { echo "

".rtrim(strrev(strstr(strrev(substr(strip_tags($data[para01]), 0, $article_summary_length)), " "))," \."),"...

\n"; if($data[document] && $data[document]!="none") { document_link(); } $url_replace = array("?",":","!","&"," ","'",",","."); echo "

$language_data[complete_article]

\n"; } else { echo $data[para01],"\n"; if($data[document] && $data[document]!="none") { document_link(); } } } } } } ?>