"Gimnaziu", "2"=>"Liceu", "3"=>"Facultate"); $tipuri_invers = array("gimnaziu"=>"1", "liceu"=>"2", "facultate"=>"3"); include "_config.php"; include (BASE."functii/conectare.php"); include (BASE."functii/rezolva_belele.php"); //include (BASE."functii/fo_sesiune.php"); include (BASE."functii/luna.php"); include (BASE."functii/inceput_str.php"); include (BASE."functii/tip_fisier.php"); //conectareala baza de date include (BASE."include/fa_conectare.php"); include BASE."include/paginatie_bamse.php";//nu este include BASE."functii/data_romaneasca.php"; include BASE."functii/scoatere.php"; //verificare sid daca exista //tratare_sesiune($db); //include BASE."referate/_switch_subdom.php"; // daca e sesiune, schimba calea // vedem daca am primit ceva pe get $titlu_afisare = ""; $materie = $_GET['materie']; $tip = $_GET['tip']; // il trimitem explicit: gimnaziu, liceu, facultate $autor = $_GET['autor']; $top = $_GET['top']; $afisez_plus = "Media"; $afisez_materia = "Materia"; $afisez_titlul = "Titlul referatului"; // scoatem toate materiile si facem un array bun $query = "select id_materie, nume from referat_materie where stare = 1"; $result = pg_query($query); $materii = array(); while ($line = pg_fetch_object($result)){ $materii[$line->id_materie] = $line->nume; } // if (isset($_GET['o'])){ $o = rezolva_belele($_GET['o'], 3); switch ($o){ case "titlu": case "materie": $directie = "asc"; break; default: $directie = "desc"; break; } $order_by = "$o $directie"; }else{ $order_by = "id_referat desc"; } if (isset($materie)){ $materie = (int) $materie; $query = "select nume from referat_materie where id_materie = $materie"; $result = pg_query($query); if ($result) if (pg_num_rows($result)>0){ $nume_materie = pg_result($result, 0, 0); if (!isset($pag)) $pag = 1; // paginatie $paginatie_bamse = new paginate_bms(); $paginatie_bamse->tip_sql = 1; $paginatie_bamse->sql = "select count(id_referat) from referate where materie = $materie and stare = 1"; $paginatie_bamse->nr_inreg = $nr_inreg; $paginatie_bamse->cale_poze = "http://$domeniu/imgs/"; $offset = $paginatie_bamse->calculate_offset(); $paginatie = $paginatie_bamse->paginate(); // end paginatie $afisez_plus = "$afisez_plus"; $afisez_titlul = "$afisez_titlul"; $referate_afisare = get_referate_by_materie($materie, 1, $order_by, $nr_inreg, $offset); $titlu_afisare = "Referate $nume_materie"; } } /*if (isset($tip)){ $tip = $tipuri_invers[strtolower($tip)]; if ($tip != null){ if (!isset($pag)) $pag = 1; // paginatie $paginatie_bamse = new paginate_bms(); $paginatie_bamse->tip_sql = 1; $paginatie_bamse->sql = "select count(id_referat) from referate where tip = $tip and stare = 1"; $paginatie_bamse->nr_inreg = $nr_inreg; $paginatie_bamse->cale_poze = "http://$domeniu/imgs/"; $offset = $paginatie_bamse->calculate_offset(); $paginatie = $paginatie_bamse->paginate(); // end paginatie $afisez_plus = "$afisez_plus"; $afisez_materia = "$afisez_materia"; $afisez_titlul = "$afisez_titlul"; $referate_afisare = get_referate_by_tip($tip, 1, $order_by, $nr_inreg, $offset); $titlu_afisare = "Referate pentru ".$tipuri[$tip]; } }*/ if (isset($autor)){ if (!isset($pag)) $pag = 1; // paginatie $paginatie_bamse = new paginate_bms(); $paginatie_bamse->tip_sql = 1; $paginatie_bamse->sql = "select count(id_referat) from referate where trim(autor) = $autor and stare = 1"; $paginatie_bamse->nr_inreg = $nr_inreg; $paginatie_bamse->cale_poze = "http://$domeniu/imgs/"; $offset = $paginatie_bamse->calculate_offset(); $paginatie = $paginatie_bamse->paginate(); // end paginatie $referate_afisare = get_referate_by_autor($autor, 1, "id_referat desc", $nr_inreg, $offset); $titlu_afisare = "Referate postate de ".$autor; $afisez_date = $referate_afisare->media; } if (isset($top)){ // paginatie $paginatie_bamse = new paginate_bms(); $paginatie_bamse->tip_sql = 1; $paginatie_bamse->sql = "select count(id_referat) from referate where stare = 1"; $paginatie_bamse->nr_inreg = $nr_inreg; $paginatie_bamse->cale_poze = "http://$domeniu/imgs/"; $offset = $paginatie_bamse->calculate_offset(); $paginatie = $paginatie_bamse->paginate(); // end paginatie switch ($top){ case 'ultimele': $referate_afisare = get_referate_by_ultimele(1, $nr_inreg, $offset); $titlu_afisare = "Ultimele referate"; $afisez_plus = "Data"; break; case 'download': $referate_afisare = get_referate_by_downloaduri(1, $nr_inreg, $offset); $titlu_afisare = "Cele mai descarcate referate"; $afisez_plus = "Descarcari"; break; case 'accesari': $referate_afisare = get_referate_by_accesari(1, $nr_inreg, $offset); $titlu_afisare = "Cele mai citite referate"; $afisez_plus = "Accesari"; break; case 'medie': $referate_afisare = get_referate_by_medie(1, $nr_inreg, $offset); $titlu_afisare = "Cele mai bine cotate referate"; break; } } if ($titlu_afisare == ""){ if (!isset($pag)) $pag = 1; // paginatie $paginatie_bamse = new paginate_bms(); $paginatie_bamse->tip_sql = 1; $paginatie_bamse->sql = "select count(id_referat) from referate where stare = 1"; $paginatie_bamse->nr_inreg = $nr_inreg; $paginatie_bamse->cale_poze = "http://$domeniu/imgs/"; $offset = $paginatie_bamse->calculate_offset(); $paginatie = $paginatie_bamse->paginate(); // end paginatie $referate_afisare = get_referate_by_ultimele(1, $nr_inreg, $offset); $titlu_afisare = "Referat Liceu"; } $description_plus = $titlu_afisare; if (!$_SERVER['QUERY_STRING']){ include("htm_index.php"); }else { include("htm_index_nou.php"); } ?>