set_file('header_handle','header.html'); $template -> set_file('menu_handle','menu.html'); $template -> set_file('calendar_handle', 'calendar.html'); $template -> set_file('page_handle', basename($_SERVER['PHP_SELF'],'.php').'.html'); //$template -> set_file('right_handle','right.html'); $template -> set_file('footer_handle','footer.html'); include_once("include/menu.php"); $Date = getdate(); $InformationObj = new Information(); list(,,$Events) = $InformationObj->GetMonthlyEvents($DataObj, ($_SESSION['selmonth'] ? $_SESSION['selmonth'] : $Date['mon']), ($_SESSION['selyear'] ? $_SESSION['selyear'] : $Date['year'])); $Calendar = new Calendar($template, "ro",'','',($_SESSION['selmonth'] ? $_SESSION['selmonth'] : $Date['mon']),($_SESSION['selyear'] ? $_SESSION['selyear'] : $Date['year']),'calendar_handle', $Events); $Calendar->GenerateCalendar(); $template->parse('calendar_output','calendar_handle'); $template->set_var('CALENDAR', $template->get_var('calendar_output')); $RegExp = "/[^a-zA-ZăîâşţĂÎÂŞŢ+0-9-\_?!.,<>\s\/\"=&;:%\@\(\)]/"; // Mijloc // ------------------------------------------------ $query = mysql_query("set names UTF-8"); $template->set_block('header_handle','fast_links','fast_links_result'); $template->set_block('header_handle','other_links','other_links_result'); $template->set_block('header_handle','rapid_block','rapid_result'); include("include/header.php"); $template->set_block('page_handle','doc_row_block','doc_row_result'); $template->set_block('page_handle','documente_block','documente_result'); $template->set_block('page_handle', 'events_mult_block', 'events_mult_result'); $template->set_block('page_handle', 'td_block', 'td_result'); $template->set_block('page_handle','evenimente_month_block','evenimente_month_result'); $template->set_block('page_handle', 'evenimente_block', 'evenimente_result'); $template->set_block('page_handle','titlu_block','titlu_result'); $template->set_block('page_handle','index_titlu_block','index_titlu_result'); $template->set_block('page_handle','index_mult_block','index_mult_result'); $template->set_block('page_handle','atd_block','atd_result'); $template->set_block('page_handle','atr_block','atr_result'); $template->set_block('page_handle','alte_articole_block','alte_articole_result'); $template->set_block('page_handle', 'more_block', 'more_result'); $template->set_block('page_handle', 'hr_block', 'hr_result'); $template->set_block('page_handle', 'news_image_block', 'news_image_result'); $template->set_block('page_handle', 'news_block', 'news_result'); $template->set_block('page_handle', 'news_group_block', 'news_group_result'); $template->set_block('page_handle','mult_block','mult_result'); $template->set_block('page_handle','articol_block','articol_result'); $template->set_block('page_handle','activitate_block','activitate_result'); $template->set_block('page_handle', 'noutati_block', 'noutati_result'); $template->set_block('page_handle', 'activitati_block', 'activitati_result'); $template->set_block('page_handle', 'index_block', 'index_result'); $template->set_block('page_handle', 'page_block', 'page_result'); $template->set_var(Array('CAUTA' => $_GET['q'] ? $_GET['q'] : 'cauta')); $template->set_var(Array( 'CONTINUT_ACTIV' => '', 'noutati_result' => '', 'activitati_result' => '', 'SEARCH_RESULT' => '', 'articol_result' => '', 'alte_articole_result' => '', )); if ($_GET['q']) { $template->set_var(Array('alte_articole_result' => '')); $Sql = "select * from articole where (titlu like ('%" . preg_replace($RegExp, "", $_GET['q']) . "%') or lung like ('%" . preg_replace($RegExp, "", $_GET['q']) . "%')) and status = 1"; $SqlResult = mysql_query($Sql); $template->set_var(Array('SEARCH_RESULT' => '

Rezultat cautare

')); $First = true; $template->set_var(Array('SECTION' => '

Pagini

')); while ($fetch = mysql_fetch_array($SqlResult)) { if (!$First) { $template->set_var('SECTION' , ''); } $template->set_var(Array( 'ARTICOL_CURENT_TITLU' => $fetch['titlu'], 'ARTICOL_CURENT_DATA' => 'Informatie adaugata la ' . str_replace("ţ", "t", strftime("%d-%m-%Y", strtotime($fetch['adddate']))), 'ARTICOL_CURENT_CONTINUT' => stripslashes(substr($fetch['scurt'], 0, 500)), 'ARTICOL_CURENT_LINK' => '/index.php?cat='. $fetch['categ'] .'&id='.$fetch['id'] )); $template->parse('titlu_result','titlu_block',false); $template->parse('mult_result','mult_block',false); $template->parse('articol_result','articol_block', true); $First = false; } $NrRows += mysql_num_rows($SqlResult); $Sql = "select * from noutati where (titlu like ('%" . preg_replace($RegExp, "", $_GET['q']) . "%') or lung like ('%" . preg_replace($RegExp, "", $_GET['q']) . "%')) and status = 1"; $SqlResult = mysql_query($Sql); $First = true; $template->set_var(Array('SECTION' => '

Noutati

')); while ($fetch = mysql_fetch_array($SqlResult)) { if (!$First) { $template->set_var('SECTION' , ''); } $template->set_var(Array( 'ARTICOL_CURENT_TITLU' => $fetch['titlu'], 'ARTICOL_CURENT_DATA' => 'Informatie adaugata la ' . str_replace("ţ", "t", strftime("%d-%m-%Y", strtotime($fetch['adddate']))), 'ARTICOL_CURENT_CONTINUT' => stripslashes(substr($fetch['scurt'], 0, 500)), 'ARTICOL_CURENT_LINK' => '/index.php?cat='. $fetch['categ'] .'&id='.$fetch['id'] . '&type=news' )); $template->parse('titlu_result','titlu_block',false); $template->parse('mult_result','mult_block',false); $template->parse('articol_result','articol_block', true); $First = false; } $NrRows += mysql_num_rows($SqlResult); $Sql = "select * from evenimente where (titlu like ('%" . preg_replace($RegExp, "", $_GET['q']) . "%') or lung like ('%" . preg_replace($RegExp, "", $_GET['q']) . "%')) and status = 1"; $SqlResult = mysql_query($Sql); $First = true; $template->set_var(Array('SECTION' => '

Evenimente

')); while ($fetch = mysql_fetch_array($SqlResult)) { if (!$First) { $template->set_var('SECTION' , ''); } $template->set_var(Array( 'ARTICOL_CURENT_TITLU' => $fetch['titlu'], 'ARTICOL_CURENT_DATA' => 'Informatie adaugata la ' . str_replace("ţ", "t", strftime("%d
%B", strtotime($fetch['adddate']))), 'ARTICOL_CURENT_CONTINUT' => stripslashes(substr($fetch['scurt'], 0, 500)), 'ARTICOL_CURENT_LINK' => '/index.php?cat='. $fetch['categ'] .'&id='.$fetch['id'].'&type=events' )); $template->parse('titlu_result','titlu_block',false); $template->parse('mult_result','mult_block',false); $template->parse('articol_result','articol_block', true); $First = false; } $NrRows += mysql_num_rows($SqlResult); if (!$NrRows) $template->set_var('articol_result', 'Nu am gasit nici un articol pe baza criteriilor selectate'); $template->parse('page_result','page_block', false); $template->set_var('index_result',''); } else // not search ... display content { if (!$_GET['cat'] && ($_GET['type'] != 'events') && ($_GET['type'] != 'news') && $_GET['type'] != 'activities') // index page { if(DisplayNews($template)) $HasNews = true; if(DisplayEvents($template,1)) $HasEvents = true; if(DisplayActivitati($template)) $HasEvents = true; $template->set_var(Array( 'index_titlu_result' =>'', 'ARTICOL_CURENT_CONTINUT' =>'', )); if ($Article['scurt']) { if(strlen($Article['lung']) < 200) $template->set_var('index_mult_result',''); else $template->parse('index_mult_result','index_mult_block',false); } else { $template->set_var('index_mult_result',''); } if(!$HasNews && !$HasEvents) $template->set_var('INDEX','index'); else $template->set_var('INDEX','index_small'); $template->set_var('SECTION', ''); $extensions = '{*.gif,*.jpg,*.jpeg,*.png,*.JPG,*.JPEG,*.GIF,*.PNG,*.PDF,*.pdf,*.DOC,*.doc}'; //var_dump($_SERVER); $DocumentRoot = 'http://' . $_SERVER['HTTP_HOST']; if ($_SESSION['UserId'] > 0) { $Path = "files/private/"; chdir($Path); if(glob($extensions, GLOB_BRACE) > 2) foreach (glob($extensions, GLOB_BRACE) as $filename) { $Files[] = $Path . $filename; $Names[] = $filename; $Times[] = filemtime($filename); } chdir("../../"); } $Path = "files/publice/"; chdir($Path); foreach (glob($extensions, GLOB_BRACE) as $filename) { $Files[] = $Path . $filename; $Names[] = $filename; $Times[] = filemtime($filename); } @asort($Times, SORT_NUMERIC); chdir("../../"); $HasDocuments = false; if(is_array($Times) && count($Times) > 0) foreach($Times as $Key => $Value) { $extension = explode(".", $Names[$Key]); $ext = $extension[count($extension) - 1]; $Name = $extension[count($extension) - 2]; $template->set_var(Array( 'DOCUMENT_IMG' => '', 'DOCUMENT_LINK' => '' . preg_replace("/-/", " ", $Name) . '' )); $template->parse('doc_row_result','doc_row_block', true); $HasDocuments = true; } if($HasDocuments) $template->parse('documente_result','documente_block',false); else $template->set_var('documente_result',''); $template->parse('index_result','index_block', false); $template->set_var('page_result',''); } else // display a page or category { switch(intval($_GET['cat'])) { case '5': $Set = true; $template->set_file('formular_handle', 'formular.html'); $template->set_block('formular_handle','formular_block','formular_result'); $template->get_var('formular_block'); $template->parse('formular_result','formular_block',false); $template->set_var('CONTINUT_ACTIV', $template->get_var('formular_block')); default: if(DisplayEvents($template)) $HasEvents = true; if(!$Set) $template->set_var('CONTINUT_ACTIV',''); $template->set_var(Array('SEARCH_RESULT' => '', 'SECTION' => '')); if (!$_GET['type'] || ($_GET['type'] == 'art')) { if ($_GET['id']) { $Sql = "select * from articole where categ = " . intval($_GET['cat']) . ( $_GET['id'] ? ' and id = ' . intval($_GET['id']) : '') . " and status = 1 order by adddate desc"; $SqlResult = mysql_query($Sql); $First = mysql_fetch_array($SqlResult); $template->set_var('mult_result',''); if ($First) { $template->set_var(Array( 'ARTICOL_CURENT_TITLU' => strtoupper($First['titlu']), 'ARTICOL_CURENT_DATA' => 'Informatie adaugata la ' . str_replace("ţ", "t", strftime("%d-%m-%Y", strtotime($First['adddate']))), 'ARTICOL_CURENT_CONTINUT' => preg_replace($RegExp, "", (strlen($First['lung']) < 100) ? stripslashes(stripslashes($First['scurt'])) : stripslashes(stripslashes($First['lung']))), 'CAT' => $_GET['cat'], 'ID' => $_GET['id'], )); } else { $template->set_var(Array( 'ARTICOL_CURENT_TITLU' => 'Pagina este in constructie va rugam reveniti.', 'ARTICOL_CURENT_DATA' => '', 'ARTICOL_CURENT_CONTINUT' => '', )); } if(!trim($First['titlu'])) { $template->set_var('titlu_result', ''); } else { $template->parse('titlu_result','titlu_block', false); } $Sql = "select * from articole where categ = '" . intval($_GET['cat']) . "' and status = 1 order by adddate desc"; $SqlResult = mysql_query($Sql); if (mysql_num_rows($SqlResult) > 1) { $HasOnlyOneArticle = true; $Current = 1; $NoNewLine = true; if (mysql_num_rows($SqlResult) > 0) while ($Fetch = mysql_fetch_array($SqlResult)) { $HasOnlyOneArticle = false; $template->set_var(Array( 'ARTICOL_TITLU' => strtoupper($Fetch['titlu']), 'ARTICOL_DETALIU' => preg_replace($RegExp, "",stripslashes(stripslashes(substr($Fetch['scurt'], 0, 250) .'...'))), 'ID' => $Fetch['id'], 'CAT' => $_GET['cat'], 'TYPE' => $_GET['type'] ? '&type=' . $_GET['type'] : '' )); if(!trim($Fetch['titlu'])) { $template->set_var('titlu_result', ''); } else { $template->parse('titlu_result','titlu_block',false); } $template->parse('atr_result','atr_block', true); $Current ++; } } if (mysql_num_rows($SqlResult) <= 1) { $template->set_var('alte_articole_result',''); } else { $template->set_var('LABEL', 'articole'); $template->parse('alte_articole_result','alte_articole_block', false); } $template->parse('articol_result','articol_block',false); } else { //var_dump($_SESSION); if($isPrivate && !$Session['UserId']) { $template->set_var('articol_result','Pentru a putea vizualiza informatiile din aceasta sectiune va rugam sa va autentificati.

Daca nu aveti creat utilizator va rugam sa ne contactati la office@sorec.org.ro.'); $template->set_var('alte_articole_result',''); } else { $Sql = "select * from articole where categ = " . intval($_GET['cat']) . " and status = 1 order by adddate desc"; $SqlResult = mysql_query($Sql); while($Article = mysql_fetch_array($SqlResult)) { $template->set_var(Array( 'ARTICOL_CURENT_TITLU' => strtoupper($Article['titlu']), 'ARTICOL_CURENT_DATA' => 'Informatie adaugata la ' . str_replace("ţ", "t", strftime("%d-%m-%Y", strtotime($Article['adddate']))), 'ARTICOL_CURENT_CONTINUT' => preg_replace($RegExp, "",$Article['scurt'] ? stripslashes(stripslashes($Article['scurt'])) : stripslashes(stripslashes($Article['lung']))) , 'ARTICOL_CURENT_LINK' => 'index.php?id=' . $Article['id'] . '&type=art&' . get_all_get_params(Array('id')) )); if(!trim($Article['titlu'])) { $template->set_var('titlu_result', ''); } else { $template->parse('titlu_result','titlu_block',false); } if ($Article['scurt']) { if(strlen($Article['lung']) < 200) $template->set_var('mult_result',''); else $template->parse('mult_result','mult_block',false); } else { $template->set_var('mult_result',''); } $template->parse('articol_result','articol_block', true); } if(mysql_num_rows($SqlResult) == 0) { $template->set_var(Array( 'ARTICOL_CURENT_TITLU' => 'Pagina e in constructie. Va rugam reveniti mai tarziu', 'ARTICOL_CURENT_DATA' => '', 'ARTICOL_CURENT_CONTINUT' => '', )); $template->set_var('articol_result','Pagina e in constructie. Va rugam reveniti mai tarziu'); } $template->set_var('alte_articole_result',''); } } } break; } if ($_GET['type'] == 'news') { $Sql = "select * from noutati where categ = " . intval($_GET['cat']) . ( $_GET['id'] ? ' and id = ' . intval($_GET['id']) : '') . " and status = 1 order by adddate desc limit 1"; $SqlResult = mysql_query($Sql); $First = mysql_fetch_array($SqlResult); $template->set_block('page_handle', 'mult_block','mult_result'); $template->set_var('mult_result',''); if ($First) { $template->set_var(Array( 'ARTICOL_CURENT_TITLU' => $First['titlu'], 'ARTICOL_CURENT_DATA' => 'Informatie adaugata la ' . str_replace("ţ", "t", strftime("%d-%m-%Y", strtotime($First['adddate']))), 'ARTICOL_CURENT_CONTINUT' => preg_replace($RegExp, "",stripslashes(stripslashes(strlen($First['lung']) > 100 ? $First['lung'] : $First['scurt']))), )); } else { $template->set_var(Array( 'ARTICOL_CURENT_TITLU' => 'Pagina e in constructie. Va rugam reveniti mai tarziu', 'ARTICOL_CURENT_DATA' => '', 'ARTICOL_CURENT_CONTINUT' => '', )); } $template->parse('titlu_result','titlu_block',false); $template->set_block('page_handle', 'mult_block','mult_result'); $template->set_var('mult_result',''); $template->set_var('atr_result',''); $template->set_var('alte_articole_result',''); $template->parse('articol_result','articol_block', false); if ($HasOnlyOneArticle) { $template->set_var('alte_articole_result',''); } else { $template->set_var('LABEL', 'noutati'); $template->parse('alte_articole_result','alte_articole_block', false); } } if ($_GET['type'] == 'activities') { $Sql = "select * from activitati where " . ( $_GET['id'] ? ' id = ' . intval($_GET['id']) : '') . " and status = 1 order by adddate desc limit 1"; $SqlResult = mysql_query($Sql); $First = mysql_fetch_array($SqlResult); $template->set_block('page_handle', 'mult_block','mult_result'); $template->set_var('mult_result',''); if ($First) { $template->set_var(Array( 'ARTICOL_CURENT_TITLU' => $First['titlu'], 'ARTICOL_CURENT_DATA' => 'Informatie adaugata la ' . str_replace("ţ", "t", strftime("%d-%m-%Y", strtotime($First['adddate']))), 'ARTICOL_CURENT_CONTINUT' => preg_replace($RegExp, "",stripslashes(stripslashes(strlen($First['lung']) > 100 ? $First['lung'] : $First['scurt']))), )); } else { $template->set_var(Array( 'ARTICOL_CURENT_TITLU' => 'Pagina e in constructie. Va rugam reveniti mai tarziu', 'ARTICOL_CURENT_DATA' => '', 'ARTICOL_CURENT_CONTINUT' => '', )); } $template->parse('titlu_result','titlu_block',false); $template->set_block('page_handle', 'mult_block','mult_result'); $template->set_var('mult_result',''); $template->set_var('atr_result',''); $template->set_var('alte_articole_result',''); $template->parse('articol_result','articol_block', false); if ($HasOnlyOneArticle) { $template->set_var('alte_articole_result',''); } else { $template->set_var('LABEL', 'noutati'); $template->parse('alte_articole_result','alte_articole_block', false); } } if ($_GET['type'] == 'events') { $Sql = "select * from evenimente where categ = " . intval($_GET['cat']) . ( $_GET['id'] ? ' and id = ' . intval($_GET['id']) : '') . " and status = 1 limit 1"; $SqlResult = mysql_query($Sql); $First = mysql_fetch_array($SqlResult); if ($First) { $template->set_var(Array( 'ARTICOL_CURENT_TITLU' => $First['titlu'], 'ARTICOL_CURENT_DATA' => $First['startdate'], 'ARTICOL_CURENT_CONTINUT' => preg_replace($RegExp, "",stripslashes(stripslashes(strlen($First['lung']) > 50 ? $First['lung'] : $First['scurt']))), )); } else { $template->set_var(Array( 'ARTICOL_CURENT_TITLU' => 'Pagina e in constructie. Va rugam reveniti mai tarziu', 'ARTICOL_CURENT_DATA' => '', 'ARTICOL_CURENT_CONTINUT' => '', )); } $template->parse('titlu_result','titlu_block',false); $template->set_block('page_handle', 'mult_block','mult_result'); $template->set_var('mult_result',''); $template->set_var('alte_articole_result',''); $template->parse('articol_result','articol_block', false); } $template->parse('page_result','page_block', false); $template->set_var('index_result',''); } } // ------------------------------------------------ include_once("include/right.php"); include_once("include/footer.php"); $template->pparse('page_output', 'header_handle'); $template->pparse('page_output', 'menu_handle'); $template->pparse('page_output', 'page_handle'); //$template->pparse('page_output', 'right_handle'); $template->pparse('page_output', 'footer_handle'); ?>