// error_reporting (2047 );
include ('connection.config.inc.php');
// Include ezSQL core
include_once "ezsql/shared/ez_sql_core.php";
// Include ezSQL database specific component
include_once "ezsql/mysql/ez_sql_mysql.php";
// Initialise database object and establish a connection
// at the same time - db_user / db_password / db_name / db_host
$db = new ezSQL_mysql($user,$pass,$database,$host);
require_once("SafeSQL.class.php");
$safesql =& new SafeSQL_MySQL();
//
//require_once("functions.php");
// query to have prev. link identifier
// voor safe sql
$db->query("SELECT NOW()");
?>
class pagina {
/**
* construct
*/
function pagina($id=null){
global $db;
$this->db=$db;
if ($id){
// get 1 pagina uit de database met $id
$sql=" SELECT *
FROM Paginas
WHERE ID= " .$id ;
$row=$this->db->get_row($sql);
$this->ID=$row->ID;
$this->Link=$row->Link;
$this->Titel=$row->Titel;
$this->HoofdAfbeelding=$row->HoofdAfbeelding;
$this->Tekst=$row->Tekst;
$this->MetaTitel=$row->MetaTitel;
$this->MetaDescription=$row->MetaDescription;
$this->MetaKeys=$row->MetaKeys;
}
}
/**
* return array/object met id's, title
*/
function StatusAanpassen($id,$weergave){
$sql=" UPDATE Paginas SET Weergave= '".$weergave."'
WHERE ID='".$id."'";
if($this->db->query($sql))
{
return true;
}
else {
return false;
}
}
function getRows(){
$detail= $this->db->get_results("SELECT * FROM Paginas ORDER BY ID ASC ");
return $detail;
}
function getLinkOverzicht(){
$Link= $this->db->get_results("SELECT ID, Title FROM Paginas WHERE Weergave='Y' ");
return $Link;
}
function getPaginaTekst($id=null){
$Tekst= $this->db->get_row("SELECT * FROM Paginas WHERE ID='".$id."'");
return $Tekst;
}
function getPaginaDetail($id=null){
$Detail= $this->db->get_row("SELECT * FROM Paginas WHERE ID='".$id."'");
return $Detail;
}
function PaginaIdBestaan($paginaId){
$pageid= $this->db->get_row("SELECT ID FROM Paginas WHERE ID='".$paginaId."' ");
if($pageid !=''){
return $pageid;
}
else {
return false;
}
}
function zoeken($tekst){
$sql="SELECT a.ID, a.Link,a.Title
FROM `Paginas` a
WHERE a.Title LIKE '%".$tekst."%'
OR a.Tekst LIKE '%".$tekst."%'";
$Result= $this->db->get_results($sql);
return $Result;
}
function DisplayPaginaContent($portalid=null){
$pagina= $this->db->get_results("SELECT * FROM Paginas ORDER BY Volgorde ");
$html='';
$html .='
Paginabeheer // overzicht |
HOOFDMENUITEM TOEVOEGEN';
$tp=count($pagina)-1;
for($i=0;$i<=count($pagina)-1;$i++){
$html .='
|
'.$pagina[$i]->Titel.' | ';
## voor volgorde te aanpasen (boven zetten)
if($i > 0){
$html .=' '; } // image voor swap up
}
$html.=' | ';
$html.=' |
';
echo $html;
}
function delete($id){
if ($id){
if($this->db->query("DELETE FROM Paginas WHERE ID=".$id))
{
return true;
}
else {
return false;
}
}
}
/**
* insert of update item met $id in de tabel
*/
function save($id,$foto)
{
if ($id){
$sql=" UPDATE Paginas SET Title= '".$_POST['title']."',
Link ='".$_POST['link']."',
Tekst= '".$_POST['tekst']."',
MetaTitel='".$_POST['mt']."',";
if($foto !=''){
$sql .=" HeaderAfbeelding='".$foto."' ,";
}
$sql .=" MetaDescription='".$_POST['md']."',
MetaKeys='".$_POST['mk']."'
WHERE ID=".$id;
//echo $sql; exit;
if($this->db->query($sql))
{
return true;
}
else {
return false;
}
}
else {
//echo 'insert'; exit;
$sql=" INSERT INTO Paginas SET Title= '".$_POST['title']."',
Link ='".$_POST['link']."' ,
Tekst= '".$_POST['tekst']."',
MetaTitel='".$_POST['mt']."',
HeaderAfbeelding='".$foto."' ,
MetaDescription='".$_POST['md']."',
MetaKeys='".$_POST['mk']."'
";
if($this->db->query($sql))
{
return true;
}
else {
return false;
}
}
}
function DisplaySubPagina($paginaID){
$detail= $this->db->get_results("SELECT * FROM SubPaginas WHERE PaginaID=".$paginaID);
//print_r($detail);
echo $paginaID;
}
}
class nieuws {
/**
* construct
*/
function nieuws($id=null){
global $db;
$this->db=$db;
if ($id){
// get 1 pagina uit de database met $id
$sql=" SELECT *
FROM Nieuws
WHERE ID= " .$id ;
$row=$this->db->get_row($sql);
$this->ID=$row->ID;
$this->ID=$row->ID;
$this->Title=$row->Title;
$this->Tekst=$row->Tekst;
}
}
function getRows(){
$detail= $this->db->get_results("SELECT * FROM Nieuws ORDER BY ID DESC ");
return $detail;
}
function getPaginaTekst($id=null){
$Tekst= $this->db->get_row("SELECT ID,Title,Tekst FROM Nieuws WHERE ID='".$id."'");
return $Tekst;
}
function getPaginaDetail($id=null){
$Detail= $this->db->get_row("SELECT * FROM Nieuws WHERE ID='".$id."'");
return $Detail;
}
function delete($id){
if ($id){
if($this->db->query("DELETE FROM Nieuws WHERE ID=".$id))
{
return true;
}
else {
return false;
}
}
}
/**
* insert of update item met $id in de tabel
*/
function save($id=null){
if ($id){
$sql=" UPDATE Nieuws SET Title= '".$_POST['title']."',
Tekst= '".$_POST['tekst']."'
WHERE ID=".$id;
//echo $sql; exit;
if($this->db->query($sql))
{
return true;
}
else {
return false;
}
}
else {
$sql=" INSERT INTO Nieuws SET Title= '".$_POST['title']."',
Tekst= '".$_POST['tekst']."'
";
if($this->db->query($sql))
{
return true;
}
else {
return false;
}
}
}
}