require_once("include/header.php");
require_once("include/left.php");
$num_visible_root_hierarchy = mysql_execute("SELECT COUNT(hierarchy_id) FROM hierarchy WHERE parent_id = 0 AND hyde = 0", "0" );
$percentage_root_menu = 100 / $num_visible_root_hierarchy;
$percentage_root_menu = round( $percentage_root_menu, 0) . "%";
$smarty->assign( "percentage_root_menu", $percentage_root_menu );
$current_section = "";
if ( isset( $_POST["current_section"] ) ) $current_section = $_POST["current_section"];
if ( isset( $_GET["current_section"] ) ) $current_section = $_GET["current_section"];
$smarty->assign( "current_section", $current_section );
$hierarchy = getHierarchyData( $current_section);
$hierarchy_description = getHierarchyDescriptionData( $current_section, $current_language );
$login_required = $hierarchy["login_required"];
$smarty->assign("login_required", $login_required);
$section_gallery_size = $hierarchy["gallery_size"];
$smarty->assign("section_gallery_size", $section_gallery_size);
$section_gallery_items = $hierarchy["gallery_items"];
$smarty->assign("section_gallery_items", $section_gallery_items);
$section_level = $hierarchy["level"];
$smarty->assign("section_level", $section_level);
$show_summary = $hierarchy["show_summary"];
$smarty->assign("show_summary", $show_summary);
$min_paragraph_for_summary = $hierarchy["min_paragraph_for_summary"];
$smarty->assign("min_paragraph_for_summary", $min_paragraph_for_summary);
// DATI PER GESTIONE BLOG
$blogMaxPageBefore = 5;
$blogMaxPageAfter = 5;
$blog_enabled = $hierarchy["blog_enabled"];
$smarty->assign("blog_enabled", $blog_enabled);
$page = 1;
if ( isset( $_POST["page"] ) ) $page = $_POST["page"];
if ( isset( $_GET["page"] ) ) $page = $_GET["page"];
$smarty->assign( "page", $page );
$blogNumRecords = getNumParagraphsOfHierarchy( $current_section );
$smarty->assign("blogNumRecords",$blogNumRecords);
$blogNumPages = 2; //ceil( $blogNumRecords / $hierarchy["post_per_page"] );
$smarty->assign("blogNumPages",$blogNumPages);
$blogCurrentPage = (!$page) ? 1 : (int)$page;
$smarty->assign("blogCurrentPage",$blogCurrentPage);
if ( $blogCurrentPage != $blogNumPages ) $blogNextPage = $blogCurrentPage+1;
else $blogNextPage = $blogNumPages;
$smarty->assign("blogNextPage", $blogNextPage);
if ( $blogCurrentPage > 1 ) $blogPreviousPage = $blogCurrentPage-1;
else $blogPreviousPage = 1;
$smarty->assign("blogPreviousPage", $blogPreviousPage);
if ( $blogNumPages > 0 ){
$blogPaging = array();
$base_url = "section.php";
$blogPaging["0"] = array (
"type"=>"first",
"href"=>"$base_url?page=1¤t_section=" . $current_section,
"title"=>"first page",
"text"=>"«" );
$j=1;
for( $i = $blogCurrentPage - $blogMaxPageBefore; $i < $blogCurrentPage + $blogMaxPageAfter; $i++) {
if ( ( $i <= $blogNumPages) && ( $i > 0 ) && ( $j <= ( $blogMaxPageBefore + $blogMaxPageAfter ) ) ){
$j++;
if( $i == $blogCurrentPage ) {
$blogPaging[$i] = array (
"type"=>"current",
"href"=>"$base_url?page=$i¤t_section=" . $current_section,
"title"=>"current page",
"text"=>$i );
} else {
$blogPaging[$i] = array (
"type"=>"normal",
"href"=>"$base_url?page=$i¤t_section=" . $current_section,
"title"=>"go to page " . $i,
"text"=>$i );
}
}
} // CHIUSURA FOR
$blogPaging[] = array (
"type"=>"last",
"href"=>"$base_url?page=$blogNumPages¤t_section=" . $current_section,
"title"=>"last page",
"text"=>"»" );
$smarty->assign("blogPaging", $blogPaging);
}
// FINE DATI PER GESTIONE BLOG
$user_can_view = false;
if ( $_SESSION["logged"] == false ) $user_can_view = false;
if ( $_SESSION["logged"] == true ){
// L'utente ha il permesso per questa sezione
if ( $_SESSION["user_group_id"] != "" )
{
$return_value = mysql_execute ("SELECT COUNT(hierarchy_id) FROM hierarchy_user_group WHERE hierarchy_id = " . $current_section . " AND user_group_id = " . $_SESSION["user_group_id"], "0" );
if ( $return_value >= 1 ) $user_can_view = true;
else $user_can_view = false;
} else {
$user_can_view = false;
}
$smarty->assign("user_group_id", $_SESSION["user_group_id"]);
}
if ( $login_required == 1 && $user_can_view == false ){
echo "";
echo "";
}
if ( $current_section!="" ){
$name_current_section = $hierarchy_description["name"];
$smarty->assign("name_current_section", $name_current_section);
/********************************************
*** VISUALIZZO I DATI DELLA SEZIONE ***
********************************************/
$rootTitle = html_entity_decode( $hierarchy_description["title"] );
$smarty->assign("rootTitle", $rootTitle);
$rootSubTitle = html_entity_decode( $hierarchy_description["subtitle"] );
$smarty->assign("rootSubTitle", $rootSubTitle);
$rootContent = html_entity_decode( $hierarchy_description["content"] );
$smarty->assign("rootContent", $rootContent);
$browser_title = html_entity_decode( $hierarchy_description["browser_title"] );
$smarty->assign("browser_title", $browser_title);
$meta_keywords = html_entity_decode( $hierarchy_description["meta_keywords"] );
$smarty->assign("meta_keywords", $meta_keywords);
$meta_description = html_entity_decode( $hierarchy_description["meta_description"] );
$smarty->assign("meta_description", $meta_description);
$rootCreateDate = html_entity_decode( $hierarchy_description["create_date"] );
$smarty->assign("rootCreateDate", $rootCreateDate);
$rootEditDate = html_entity_decode( $hierarchy_description["edit_date"] );
$smarty->assign("rootEditDate", $rootEditDate);
/***********************************
*** DELLA SEZIONE PRENDO LE FOTO ***
***********************************/
$section_num_photo = getNumImagesOfHierarchy( $current_section );
$smarty->assign("section_num_photo", $section_num_photo);
$images = getImagesOfHierarchy( $current_section, $current_language );
$smarty->assign("images", $images);
/**********************************
*** DELLA SEZIONE PRENDO I FILE ***
**********************************/
$section_num_file = mysql_execute ("SELECT COUNT(file_id) FROM file WHERE content_id = " . $current_section, "0");
$smarty->assign("section_num_file", $section_num_file);
$files = getFilesOfHierarchy( $current_section );
$smarty->assign("files", $files);
/**************************
*** VISUALIZZO SOMMARIO ***
**************************/
$count_paragraph = getNumParagraphsOfHierarchy( $current_section );
$smarty->assign("count_paragraph", $count_paragraph);
$query_sommario = "
SELECT
P.paragraph_id,
PD.title
FROM
paragraph AS P,
paragraph_description AS PD
WHERE " .
" P.paragraph_id = PD.paragraph_id AND " .
" P.hierarchy_id = " . $current_section . " AND " .
" P.hide = 0 AND " .
" PD.language_id = " . $current_language . " ORDER BY P.ordering ASC";
$exec_sommario = mysql_query( $query_sommario );
$count_sommario = 1;
$arr_sommario = array();
while ($results_sommario = mysql_fetch_row( $exec_sommario ) ){
$id_paragraph = $results_sommario[0];
$title = html_entity_decode( $results_sommario[1] );
$count_sommario++;
array_push( $arr_sommario, array(
"id_paragraph"=>$id_paragraph,
"title"=>$title
) );
$smarty->assign("arr_sommario", $arr_sommario);
}
/*******************************************
*** visualizzo i PARAGRAFI della SEZIONE ***
********************************************/
$paragraph_data = array();
$images = array();
foreach( getParagraphsOfHierarchy( $current_section, $current_language, $page ) as $paragraph ){
/**********************************************
*** di ogni PARAGRAFO prendo il FORM/MODULO ***
***********************************************/
$form = getFormOfParagraph( $paragraph["paragraph_id"] );
$js_calendar = "";
$js_required_fields = "";
if ( count( $form ) > 0 ){
if ( isset( $form["inputs"] ) ){
$js_required_fields = generateJsRequiredFields( $form["form"]["form_id"] );
foreach( $form["inputs"] as $input ){
if ( $input["type"] == "date_ddmmyyyy" ){
$js_calendar .='
Calendar.setup({
ifFormat : "%d/%m/%Y", // format of the input field
showsTime : false, // will display a time selector
inputField : "' . $input["system_name"] . '", // ID of the input field
showsTime : false,
button : "btn_' . $input["system_name"] . '" // ID of the button
});';
}
if ( $input["type"] == "date_mmyyyy" ){
$js_calendar .='
Calendar.setup({
ifFormat : "%m/%Y", // format of the input field
showsTime : false, // will display a time selector
inputField : "' . $input["system_name"] . '", // ID of the input field
showsTime : false,
button : "btn_' . $input["system_name"] . '" // ID of the button
});';
}
}
}
}
array_push( $paragraph_data, array(
"id"=>$paragraph["paragraph_id"],
"paragraph_id"=>$paragraph["paragraph_id"],
"title"=>$paragraph["title"],
"sub_title"=>$paragraph["subtitle"],
"subtitle"=>$paragraph["subtitle"],
"create_date"=>$paragraph["create_date"],
"edit_date"=>$paragraph["edit_date"],
"content"=>html_entity_decode( $paragraph["content"] ),
"content_full"=>html_entity_decode( $paragraph["content_full"] ),
"continue"=>$paragraph["continue"],
"gallery_size"=>$paragraph["gallery_size"],
"gallery_items"=>$paragraph["gallery_items"],
"num_photo"=>count( $paragraph["images"] ),
"num_file"=>count( $paragraph["files"] ),
"images"=>$paragraph["images"],
"files"=>$paragraph["files"],
"exist_image_for_paragraph"=>existImageForParagraph( $paragraph["paragraph_id"] ),
"image_for_paragraph"=>getImageForParagraph( $paragraph["paragraph_id"] ),
"form"=>$form,
"num_form"=>count( $form ),
"js_calendar"=>$js_calendar,
"js_required_fields"=>$js_required_fields
) );
$smarty->assign("paragraph", $paragraph_data);
$count_paragraph++;
} // WHILE
} // if
$arr_box_subsection = array();
//***************************************************
//** PRENDO LE SOTTOSEZIONI DELLA SEZIONE CORRENTE **
//***************************************************
$query = "
SELECT
H.hierarchy_id,
HD.name
FROM
hierarchy AS H,
hierarchy_description AS HD
WHERE
H.hyde = 0 AND
H.hierarchy_id = HD.hierarchy_id AND
HD.language_id = " . $current_language . " AND
H.parent_id = " . $current_section .
" ORDER BY H.ordering ";
$exec = mysql_query ( $query );
while ( $result = mysql_fetch_assoc( $exec ) ){
$hierarchy_id = $result["hierarchy_id"];
$hierarchy_name = $result["name"];
array_push( $arr_box_subsection, array(
"hierarchy_id"=>$hierarchy_id,
"hierarchy_name"=>$hierarchy_name
) );
}
$num_subsection = count( $arr_box_subsection );
$smarty->assign("num_subsection", $num_subsection);
$smarty->assign("arr_box_subsection", $arr_box_subsection);
//**************************
//** SALVATAGGIO COMMENTO **
//**************************
$oper = "";
if ( isset( $_GET["oper"] ) ) $oper = $_GET["oper"];
if ( isset( $_POST["oper"] ) ) $oper = $_POST["oper"];
$smarty->assign("comment_msg", -1);
if ( $oper == "save_comment" ){
$comment_approve_required = mysql_execute("SELECT comment_approve_required FROM hierarchy WHERE hierarchy_id = " . $current_section, "0" );
if ( $comment_approve_required ) $comment_approved = 0;
else $comment_approved = 1;
$bol_comment = false;
$comment_firstname = $_POST["comment_firstname"];
$comment_lastname = $_POST["comment_lastname"];
$comment_email = $_POST["comment_email"];
$comment_website = $_POST["comment_website"];
$comment_title = $_POST["comment_title"];
$comment_content = $_POST["comment_content"];
$comment_create_date = date("Y/m/d H:i:s");
$comment_edit_date = date("Y/m/d H:i:s");
$ip_user = $REMOTE_ADDR;
$host_user = gethostbyaddr($ip_user);
if ( $comment_firstname == "" || $comment_email == "" || $comment_title == "" || $comment_content == "" ){
$bol_comment = false;
$smarty->assign("comment_msg", 0); // Impossibile salvare il commento mancano uno o più dati obbligatori
} else {
$bol_comment = true;
$smarty->assign("comment_msg", 1); // Complimenti, il tuo commento è stato salvato correttamente
if ( $comment_approve_required ) $smarty->assign("comment_msg", 2); // Il tuo commento è stato salvato correttamente, tuttavia è necessaria l'approvazione dall'amministratore del portale
$query = "
INSERT INTO comment (
commentable_object_id,
title,
content,
firstname,
lastname,
email,
website,
create_date,
edit_date,
ip_user,
host_user,
approved
) VALUES (" .
$current_section . ", " .
"\"" . $comment_title . "\", " .
"\"" . $comment_content . "\", " .
"\"" . $comment_firstname . "\", " .
"\"" . $comment_lastname . "\", " .
"\"" . $comment_email . "\", " .
"\"" . $comment_website . "\", " .
"\"" . $comment_create_date . "\", " .
"\"" . $comment_edit_date . "\", " .
"\"" . $ip_user . "\", " .
"\"" . $host_user . "\", " .
"\"" . $comment_approved . "\"" .
")";
mysql_query( $query );
$comment_id = mysql_insert_id();
}
// MANDO L'EMAIL ALL'AMMINISTRATORE
$sender_email = mysql_execute ("SELECT valore FROM settings WHERE proprieta = 'sender_email_comment'", "0" );
$sender_id = mysql_execute ( "SELECT sender_id FROM sender WHERE email = \"" . $sender_email . "\"", "0" );
$sender_smtp = mysql_execute ("SELECT smtp FROM sender WHERE sender_id = " . $sender_id, "0" );
$sender_name = mysql_execute ("SELECT name FROM sender WHERE sender_id = " . $sender_id, "0" );
$site_name = mysql_execute ( "SELECT valore FROM settings WHERE proprieta = 'portal_name'" , "0" );
$subject = $site_name . ": nuovo commento";
$path_site_frontend = mysql_execute("SELECT valore FROM settings WHERE proprieta = 'path_site_frontend'","0");
$approved_link = "http://www.bestcms.it/op-comment.php?a=" . md5( $comment_id ) . "&b=" . md5( $sender_email ) . "&c=" . md5( $sender_name ) . "&d=" . md5("approved") . "&e=" . md5( $license_id );
$not_approved_link = "http://www.bestcms.it/op-comment.php?a=" . md5( $comment_id ) . "&b=" . md5( $sender_email ) . "&c=" . md5( $sender_name ) . "&d=" . md5("not_approved") . "&e=" . md5( $license_id );
$body = "";
$body .= "";
$body .= "Titolo: " . $comment_title . "
";
$body .= "Commento: " . $comment_content . "
";
$body .= "Nome: " . $comment_firstname . "
";
$body .= "Cognome: " . $comment_lastname . "
";
$body .= "Email utente: " . $comment_email . "
";
$body .= "Sito web utente: " . $comment_website . "
";
$body .= "Data inserimento: " . $comment_create_date . "
";
$body .= "IP utente: " . $ip_user . "
";
$body .= "Host utente: " . $host_user . "
";
$body .= "
";
$body .= "Approva il commento effettuando un click sul seguente link:
";
$body .= "" . $approved_link . "
";
$body .= "
";
$body .= "Disapprova il commento effettuando un click sul seguente link:
";
$body .= "" . $not_approved_link . "
";
$body .= "
";
$body .= "";
$body = html_entity_decode( $body );
$recipients = $sender_name . " <" . $sender_email . ">";
$headers = "FROM: " . $sender_name . " <" . $sender_email . ">\n";
$headers .= "X-Mailer: PHP\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "Content-Transfer-Encoding: 7bit\n\n";
error_reporting(0);
mail( $recipients, $subject, $body, $headers );
/*
echo "recipients: " . $recipients . "
";
echo "subject: " . $subject . "
";
echo "body: " . $body . "
";
echo "headers: " . $headers . "
";
*/
error_reporting(2047);
}
// FINE SALVATAGGIO COMMENTO
//***********************
//** GESTIONE COMMENTI **
//***********************
$comment_enabled = mysql_execute("SELECT comment_enabled FROM hierarchy WHERE hierarchy_id = " . $current_section, "0" );
$smarty->assign("comment_enabled", $comment_enabled);
if ( $comment_enabled ){
$arr_comments = array();
$query = "
SELECT
comment_id,
user_id,
title,
content,
firstname,
lastname,
email,
website,
create_date,
edit_date
FROM
comment
WHERE
commentable_object_id = " . $current_section . " AND
not_approved = 0 AND
approved = 1
ORDER BY comment_id";
$exec = mysql_query( $query );
$num_comments = mysql_affected_rows();
$smarty->assign("num_comments", $num_comments);
while ( $result = mysql_fetch_assoc ( $exec ) ){
$comment_id = $result["comment_id"];
$user_id = $result["user_id"];
$title = $result["title"];
$content = $result["content"];
$firstname = $result["firstname"];
$lastname = $result["lastname"];
$email = $result["email"];
$website = $result["website"];
$create_date = $result["create_date"];
$edit_date = $result["edit_date"];
array_push ( $arr_comments, array(
"comment_id"=>$comment_id,
"user_id"=>$user_id,
"title"=>$title,
"content"=>$content,
"firstname"=>$firstname,
"lastname"=>$lastname,
"email"=>$email,
"website"=>$website,
"create_date"=>$create_date,
"edit_date"=>$edit_date
) );
}
$smarty->assign("arr_comments", $arr_comments);
}
// FINE GESTIONE COMMENTI
//****************************************
//** GESTIONE COLLEGAMENTI ALLE SEZIONI **
//****************************************
$show_topic_index = mysql_execute ( "SELECT show_topic_index FROM hierarchy WHERE hierarchy_id = " . $current_section, "0" );
$smarty->assign("show_topic_index", $show_topic_index);
$previous_hierarchy_id = mysql_execute ( "SELECT previous_hierarchy_id FROM hierarchy WHERE hierarchy_id = " . $current_section, "0" );
$previous_hierarchy_name = mysql_execute ( "SELECT name FROM hierarchy_description WHERE hierarchy_id = " . $previous_hierarchy_id . " AND language_id = " . $current_language, "0" );
$smarty->assign("previous_hierarchy_name", $previous_hierarchy_name);
$smarty->assign("previous_hierarchy_id", $previous_hierarchy_id);
$next_hierarchy_id = mysql_execute ( "SELECT next_hierarchy_id FROM hierarchy WHERE hierarchy_id = " . $current_section, "0" );
$next_hierarchy_name = mysql_execute ( "SELECT name FROM hierarchy_description WHERE hierarchy_id = " . $next_hierarchy_id . " AND language_id = " . $current_language, "0" );
$smarty->assign("next_hierarchy_name", $next_hierarchy_name);
$smarty->assign("next_hierarchy_id", $next_hierarchy_id);
$index_hierarchy_id = mysql_execute ( "SELECT index_hierarchy_id FROM hierarchy WHERE hierarchy_id = " . $current_section, "0" );
$index_hierarchy_name = mysql_execute ( "SELECT name FROM hierarchy_description WHERE hierarchy_id = " . $index_hierarchy_id . " AND language_id = " . $current_language, "0" );
$smarty->assign("index_hierarchy_name", $index_hierarchy_name);
$smarty->assign("index_hierarchy_id", $index_hierarchy_id);
// FINE GESTIONE COLLEGAMENTI ALLE SEZIONI
//***************
//** PARAMETRI **
//***************
$parameter = array();
$query = "
SELECT
P.name,
PV.value,
HP.hierarchy_id
FROM (
hierarchy_parameter AS HP
INNER JOIN
parameter AS P
ON (
HP.parameter_id = P.parameter_id
)
) INNER JOIN
parameter_value AS PV
ON (
P.parameter_id = PV.parameter_id
) AND (
HP.parameter_value_id = PV.parameter_value_id
) WHERE (
HP.hierarchy_id = " . $current_section . ")";
$exec = mysql_query( $query );
while ( $result = mysql_fetch_assoc( $exec ) ){
$parameter_name = $result["name"];
$parameter_value = $result["value"];
array_push( $parameter, array(
"name"=>$parameter_name,
"value"=>$parameter_value
) );
}
$smarty->assign("parameter", $parameter);
// FINE PARAMETRI
// ***********************************
// ** SALVATAGGIO DEI DATI DEL FORM **
// ***********************************
if ( isset( $_POST["form_oper"] ) && $_POST["form_oper"] == "save_form" ){
$form_id = $_POST["form_id"];
$form = getFormData( $form_id );
$arr_input = getInputsOfForm( $form );
// METTO IN SESSIONE I DATI DEI CAMPI DI INPUT
foreach( $arr_input as $input ){
if ( $input["type"] != "label" ){
$_SESSION[$input["system_name"]] = $_POST[$input["system_name"]];
}
}
// SE E' L'ULTIMO FORM INVIO L'EMAIL E SALVO TUTTI I DATI
if ( $form["is_last_form"] ){
$last_form_id = $form["form_id"];
$form_data_id = mysql_execute("SELECT MAX(form_data_id)+1 FROM form_data", "0" );
if ( $form_data_id == "" ) $form_data_id = 1;
// SALVO TUTTI I DATI
array_push( $binded_form, getFormData( $form["form_id"] ) );
getAllBindedForm( $form["form_id"] );
// la funzione getAllBindedForm restituisci tutti i form collegati ma non quello finale quindi lo aggiungo manualmente
// $binded_form sta in fn_input.php
$date_insert = date("Y-m-d H:i");
foreach ( $binded_form as $form ){
foreach( getInputsOfForm( $form ) as $input ){
if ( $input["random_number"] ){
$value = rand(100000, 999999 );
$_SESSION[$input["system_name"]] = $value;
}
else {
if ( $input["type"] != "label" ){
$value = $_SESSION[$input["system_name"]];
} else {
$value = "";
}
}
$query = "INSERT INTO form_data (
form_data_id,
form_id,
input_id,
last_form_id,
value,
date_insert
) VALUES (" .
$form_data_id . ", " .
$form["form_id"] . ", " .
$input["input_id"] . ", " .
$last_form_id . ", " .
"\"" . $value . "\"," .
"\"" . $date_insert . "\"" .
")";
mysql_query( $query );
}
if ( $form["save_as_user"] ) saveFormAsUser( $form["form_id"], $form["user_group_id"] );
if ( $form["is_last_form"] ){
// MANDO L'EMAIL ALL' INDIRIZZO SPECIFICATO NELL'ULTIMO FORM
$sender_smtp = mysql_execute ("SELECT smtp FROM sender WHERE sender_id = " . $form["sender_id"], "0" );
$sender_name = mysql_execute ("SELECT name FROM sender WHERE sender_id = " . $form["sender_id"], "0" );
$sender_email = mysql_execute ("SELECT email FROM sender WHERE sender_id = " . $form["sender_id"], "0" );
$receiver_email = mysql_execute ("SELECT email FROM sender WHERE sender_id = " . $form["receiver_id"], "0" );
$site_name = mysql_execute ( "SELECT valore FROM settings WHERE proprieta = 'portal_name'" , "0" );
$language_acronym = mysql_execute( "SELECT acronym FROM language WHERE language_id = " . $current_language, "0" );
$subject_email = $form["description"][$language_acronym]["subject_email"];
$body_email = $form["description"][$language_acronym]["body_email"];
$subject = $subject_email;
$html_message = htmlspecialchars( stripslashes( $body_email ) );
foreach( getInputsOfForm( $form ) as $input ){
if ( strpos( $html_message, "{@" . $input["system_name"] . "@}" ) === false ){
} else {
$html_message = str_replace( "{@" . $input["system_name"] . "@}", $_SESSION[$input["system_name"]], $html_message );
}
}
$message = "";
$message .= "";
$message .= $html_message . "
";
$message .= "";
$message = html_entity_decode( $message );
$recipients = $receiver_email . " <" . $receiver_email . ">";
$headers = "FROM: " . $sender_name . " <" . $sender_email . ">\n";
$headers .= "X-Mailer: PHP\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "Content-Transfer-Encoding: 7bit\n\n";
error_reporting(0);
mail( $recipients, $subject, $message, $headers );
/*
echo "recipients: " . $recipients . "
";
echo "subject: " . $subject . "
";
echo "body: " . $message . "
";
echo "headers: " . $headers . "
";
*/
error_reporting(2047);
// VERIFICO SE DEVO SPEDIRE L'EMAIL ANKE ALL'UTENTE
if ( $form["send_email_to_user"] ){
// Cerco il campo di tipo "email"
foreach ( $binded_form as $form ){
foreach( getInputsOfForm( $form ) as $input ){
if ( $input["type"] == "email" ){
$user_email = $_SESSION[$input["system_name"]];
// INVIO L'EMAIL ALL'INDIRIZZO TROVATO
$recipients = $user_email . " <" . $user_email . ">";
$headers = "FROM: " . $sender_name . " <" . $sender_email . ">\n";
$headers .= "X-Mailer: PHP\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "Content-Transfer-Encoding: 7bit\n\n";
error_reporting(0);
mail( $recipients, $subject, $message, $headers );
error_reporting(2047);
/*
echo "recipients: " . $recipients . "
";
echo "subject: " . $subject . "
";
echo "body: " . $message . "
";
echo "headers: " . $headers . "
";
*/
}
}
}
}
}
}
}
}
//**********************
//** PAGINE RISERVATE **
//**********************
$arr_reserved_pages = array();
if ( isset ( $_SESSION["user_group_id"] ) && $_SESSION["user_group_id"] != "" ){
$query = "
SELECT
HD.hierarchy_id,
HD.name,
HD.title
FROM
hierarchy_user_group AS HUG,
hierarchy_description AS HD,
hierarchy AS H
WHERE
HUG.user_group_id IN (" . $_SESSION["user_group_id"] . ")
AND HD.hierarchy_id = HUG.hierarchy_id
AND HD.hierarchy_id = H.hierarchy_id
AND HUG.hierarchy_id = H.hierarchy_id
AND H.login_required = 1
AND HD.language_id = " . $current_language . "
AND H.hyde = 0
ORDER BY H.ordering, HD.name ASC";
$exec = mysql_query( $query );
$num_reserved_pages = mysql_affected_rows();
while ( $result = mysql_fetch_assoc( $exec ) ){
$hierarchy_id = $result["hierarchy_id"];
$hierarchy_name = $result["name"];
$hierarchy_title = $result["title"];
array_push( $arr_reserved_pages, array(
"hierarchy_id"=>$hierarchy_id,
"hierarchy_name"=>$hierarchy_name,
"hierarchy_title"=>$hierarchy_title
));
}
}
$num_reserved_pages = count( $arr_reserved_pages );
$smarty->assign("arr_reserved_pages", $arr_reserved_pages);
$smarty->assign("num_reserved_pages", $num_reserved_pages);
/*********
** NEWS **
**********/
/*
$section_news = array();
$query = "
SELECT
N.news_id,
N.news_category_id,
ND.title,
ND.subtitle,
DATE_FORMAT( N.start_date, '%d-%m-%Y %H:%i') AS start_date,
DATE_FORMAT( N.end_date, '%d-%m-%Y %H:%i') AS end_date,
ND.abstract,
ND.content,
ND.meta_description,
ND.meta_keywords,
N.gallery_size,
N.gallery_items
FROM
news AS N,
news_description AS ND
WHERE " .
" N.news_id = ND.news_id AND " .
$where .
" N.end_date > \"" . date("Y-m-d H:i") . "\" AND " .
" ND.language_id = " . $current_language . " ORDER BY N.start_date DESC LIMIT 0,3";
$exec = mysql_query( $query );
while ( $result = mysql_fetch_assoc( $exec ) ){
$section_news[] = $result;
}
$smarty->assign("section_news", $section_news);
*/
$smarty->display('section.tpl');
require_once("include/footer.php");
?>