File: D:/HostingSpaces/RClaassen/stay-on-track.nl/wwwroot/includes/maintekst.php
<?php
function fnGetTekst($sPagina, $oDBCon) {
$bToonPagina = true;
$sContent = "";
$sTypeTekst = "";
$sSelect = " SELECT ";
$sSelect .= " pa_id, ";
$sSelect .= " pa_tekst, ";
$sSelect .= " pa_aantal_regels, ";
$sSelect .= " pa_beveiligd, ";
$sSelect .= " pa_type_id ";
$sSelect .= " FROM tbl_paginas ";
$sSelect .= " WHERE pa_bestandsnaam = '" . $sPagina . "' ";
$sSelect .= " LIMIT 1;";
$rsContent = $oDBCon->query($sSelect);
if($rsContent && $arContent = $rsContent->fetch_array()) {
$iPaId = $arContent['pa_id'];
$sContent = $arContent['pa_tekst'];
$iAantalRegels = $arContent['pa_aantal_regels'];
$iBeveiligd = $arContent['pa_beveiligd'];
$iTypeId = $arContent['pa_type_id'];
$sSQL = " SELECT ";
$sSQL .= " pt_tekst ";
$sSQL .= " FROM tbl_pagina_types ";
$sSQL .= " WHERE pt_type_id = '" . $iTypeId . "';";
$rsContent = $oDBCon->query($sSQL);
if($rsContent && $arContent = $rsContent->fetch_array()) {
$sTypeTekst = $arContent['pt_tekst'];
}
$sTypeTekst .= fnGetVacatures($oDBCon);
if($iBeveiligd > 0) {
$bToonPagina = false;
if($_SESSION['iLidId'] > 0) {
$sSQL = " SELECT ";
$sSQL .= " rp_groep_id ";
$sSQL .= " FROM tbl_rechten_paginas ";
$sSQL .= " INNER JOIN tbl_groepsleden ";
$sSQL .= " ON gl_groeps_id = rp_groep_id ";
$sSQL .= " WHERE gl_lid_id = '" . $_SESSION['iLidId'] . "' ";
$sSQL .= " AND rp_pagina_id = '" . $iPaId . "' ";
$sSQL .= " LIMIT 1; ";
$rsGroepen = $oDBCon->query($sSQL);
if($rsGroepen && $arGroepId = $rsGroepen->fetch_assoc()) {
if(intval($arGroepId['rp_groep_id']) > 0) {
$bToonPagina = true;
}
}
}
}
if($bToonPagina === false) {
$sSelect = " SELECT ";
$sSelect .= " pa_id, ";
$sSelect .= " pa_tekst, ";
$sSelect .= " pa_beveiligd, ";
$sSelect .= " pa_type_id ";
$sSelect .= " FROM tbl_paginas ";
$sSelect .= " WHERE pa_bestandsnaam = 'verboden_toegang'";
$sSelect .= " LIMIT 1;";
$rsContent = $oDBCon->query($sSelect);
if($rsContent && $arContent = $rsContent->fetch_array()) {
$iPaId = $arContent['pa_id'];
$sContent = $arContent['pa_tekst'];
$iBeveiligd = $arContent['pa_beveiligd'];
$iTypeId = $arContent['pa_type_id'];
}
}
} else {
$sSelect = " INSERT INTO ";
$sSelect .= " tbl_paginas ";
$sSelect .= " SET ";
$sSelect .= " pa_bestandsnaam = '" . $sPagina . "', ";
$sSelect .= " pa_tekst = '', ";
$sSelect .= " pa_sorteer_id = '0' ";
$oDBCon->query($sSelect);
}
$_SESSION['bToonPagina'] = $bToonPagina;
$arReturn = Array();
$arReturn[0] = $sContent;
$arReturn[1] = $iTypeId;
$arReturn[2] = $iAantalRegels;
$arReturn[3] = $sTypeTekst;
return $arReturn;
}
function fnGetVacatures($oDBCon) {
$sJoboffers = "";
$sSelect = " SELECT ";
$sSelect .= " id, ";
$sSelect .= " titel ";
$sSelect .= " FROM sot_joboffers ";
$sSelect .= " ORDER BY id DESC ";
$rsJoboffers = $oDBCon->query($sSelect);
if($rsJoboffers) {
$sJoboffers .= '<br /> <br /><b>Vacatures</b><ul>';
while($arJoboffers = $rsJoboffers->fetch_array()) {
$sJoboffers .= '<li>';
$sJoboffers .= '<a href="/vacatures/index.php/frontend/vacatures/details/' . $arJoboffers['id'] . '">';
$sJoboffers .= $arJoboffers['titel'];
$sJoboffers .= '</a>';
$sJoboffers .= '</li>';
}
$sJoboffers .= '</ul>';
}
return $sJoboffers;
}