getUrl().$this->getFolder() public function getBasePath() // vul de variabele bPATH::$this->getRoot().$this->getFolder() public function getErrorMssg() public function getSuccesMssg() public function setErrorMssg($reqMssg) public function setSuccesMssg($reqMssg) public function checkJavaScript() // deze checked of Javascript aan staat en vult een sessie public function cleanUrl($reqURL) // haal multiple slashes uit een url ---------------------------------------------------------------~~**~~------------------------------------------------------------*/ class algemeen { protected $FOLDER; protected $ROOT; protected $URL; protected $bURL; protected $bPATH; private $DBHOST; private $DBUSER; private $DBPASS; private $DB; public $errorMssg; public $succesMssg; public function __construct() { error_reporting(E_ALL); session_start(); if(isset($_POST['lc'])) { unset($_SESSION['mid']); } $_SESSION['js'] = (isset($_POST['js']))?$_POST['js']:((isset($_SESSION['js']))?$_SESSION['js']:''); if(strstr($_SERVER['HTTP_HOST'], 'localhost')) { $this->DBHOST = 'localhost'; $this->DBUSER = 'root'; $this->DBPASS = 'root'; $this->DB = 'voetchi'; } else { $this->DBHOST = 'db.voet-chi.nl'; $this->DBUSER = 'md116418db66012'; $this->DBPASS = '6B3bA4JK'; $this->DB = 'md116418db66012'; } @mysql_connect($this->DBHOST, $this->DBUSER, $this->DBPASS) or die("Kan geen connectie maken."); @mysql_select_db($this->DB) or die("Het is niet gelukt de database te selecteren."); if(!isset($_SESSION['langCode']) || empty($_SESSION['langCode'])) { $lc = $this->getLC(); } $_SESSION['langCode'] = (isset($_REQUEST['lc']))?$_REQUEST['lc']:((isset($_SESSION['langCode']))?$_SESSION['langCode']:$lc); if(empty($_SESSION['optimized'])) { $query = mysql_query("SHOW TABLES FROM ".$this->DB); if($rows = mysql_num_rows($query)) { for($i=0; $i<$rows; $i++) { $table = mysql_result($query, $i, 0); $query2 = mysql_query("SHOW TABLE STATUS FROM ".$this->DB." LIKE '".$table."'"); $result = @mysql_fetch_array($query2); if(isset($result)) { if($result['Data_free'] >= 500) { mysql_query("OPTIMIZE NO_WRITE_TO_BINLOG TABLE ".$table.""); } } } $_SESSION['optimized'] = 'done'; } } } // haalt de eerste taal op van de gegeven taallijst in de adm_settings tabel protected function getLC() { $query = mysql_query("SELECT taalLijst FROM adm_settings WHERE settingsId=1"); if($rows = mysql_num_rows($query)) { $taallijst = mysql_result($query, 0, 0); $arr = explode(';', $taallijst); } if(count($arr)>1) { return $arr[0]; } return $taallijst; } // geef aan welke adminsettings je wilt gebruiken protected function getAdmSettingsId() { if(isset($_SESSION['tpcLog']['admId'])) { $ADMID = $_SESSION['tpcLog']['admId']; } else { $ADMID = 1; } return $ADMID; } // haal de settings uit de adm_settings tabel protected function getAdmSettings() { $query = mysql_query("SELECT * FROM adm_settings WHERE settingsId=".$this->getAdmSettingsId()); if($rows = mysql_num_rows($query)) { $oSettings = mysql_fetch_object($query); return $oSettings; } else {$this->setErrorMssg('Het is niet gelukt de adminsettings op te halen. Alle bewerkingen zijn afgebroken.'); } } // haalt het gebruikerstype op protected function getTpcUserType() { $UTYPE = $_SESSION['tpcLog']['uType']; return $UTYPE; } // geef aan welke usersettings je wilt gebruiken protected function getTpcUserId() { $UID = $_SESSION['tpcLog']['uId']; return $UID; } // haal de settings uit de tpc_users tabel protected function getTpcUserSettings() { $query = mysql_query("SELECT * FROM tpc_users WHERE userId=".$this->getTpcUserId()); if($rows = mysql_num_rows($query)) { $oSettings = mysql_fetch_object($query); return $oSettings; } else {$this->setErrorMssg('Het is niet gelukt de usersettings op te halen. Alle bewerkingen zijn afgebroken.'); } } // geef aan welke settings je wilt gebruiken protected function getScSettingsId() { $SCID = $_SESSION['tpcLog']['scId']; return $SCID; } // haal de settings uit de sc_settings tabel protected function getScSettings() { $query = mysql_query("SELECT * FROM sc_settings WHERE settingsId=".$this->getScSettingsId()); if($rows = mysql_num_rows($query)) { $oSettings = mysql_fetch_object($query); return $oSettings; } else {$this->setErrorMssg('Het is niet gelukt de sitecreator settings op te halen. Alle bewerkingen zijn afgebroken.'); } } // geef aan welke settings je wilt gebruiken protected function getIbSettingsId() { if(isset($_SESSION['tpcLog']['ibId'])) { $IBID = $_SESSION['tpcLog']['ibId']; } else { $IBID = 1; } if(isset($_GET['ref']) || isset($_SESSION['ref'])) { if(!isset($_SESSION['ref'])) {$_SESSION['ref'] = 'editor'; } $IBID = 3; } return $IBID; } // haal de settings uit de ib_settings tabel protected function getIbSettings() { $query = mysql_query("SELECT * FROM ib_settings WHERE settingsId=".$this->getIbSettingsId()); if($rows = mysql_num_rows($query)) { $aSettings = mysql_fetch_object($query); return $aSettings; } else {$this->setErrorMssg('Het is niet gelukt de imgbrowser settings op te halen. Alle bewerkingen zijn afgebroken.'); } } // haal de adminmap op public function getFolder() { if(strstr($_SERVER['HTTP_HOST'], 'localhost')) { $this->FOLDER = '/voet_chi/tpcAdmin/'; } else { $this->FOLDER = '/tpcAdmin/'; } return $this->FOLDER; } // haal de sitemap op public function getSiteFolder() { if(strstr($_SERVER['HTTP_HOST'], 'localhost')) { $this->FOLDER = '/voet_chi/'; } else { $this->FOLDER = ''; } return $this->FOLDER; } // bepaal de root public function getRoot() { $this->ROOT = ($_SERVER['DOCUMENT_ROOT'])?$_SERVER['DOCUMENT_ROOT']:substr($_SERVER['SCRIPT_FILENAME'] , 0 , -strlen($_SERVER['PHP_SELF'])+1 ); return $this->ROOT; } // bepaal de url public function getUrl() { $this->URL = $_SERVER['HTTP_HOST']; return $this->URL; } // geeft basis url terug public function getBaseUrl() { $this->bURL = $this->cleanUrl('http://'.$this->getUrl().$this->getFolder()); return $this->bURL; } // geeft basis pad terug public function getBasePath() { $this->bPATH = $this->cleanUrl($this->getRoot().$this->getFolder()); return $this->bPATH; } public function getErrorMssg() { return $this->errorMssg; } public function getSuccesMssg() { return $this->succesMssg; } public function setErrorMssg($reqMssg) { $this->errorMssg = $reqMssg; } public function setSuccesMssg($reqMssg) { $this->succesMssg = $reqMssg; } // deze checked of Javascript aan staat en vult een sessie public function checkJavaScript() { if(!isset($_SESSION['js']) || empty($_SESSION['js'])) { $_SESSION['js'] = 'off'; ?>
curFileName = basename($_SERVER['PHP_SELF']); // if(isset($_GET['pid']) && $this->curFileName=="nieuws.php") { // $this->oPage = $this->getPageRow(); // } $this->oPage = $this->getPageRow(basename($_SERVER['PHP_SELF'])); $this->oAdm = $this->getAdmSettings('1'); if(isset($this->oPage->pageId)) { $this->aTags = $this->getPageTags($this->oPage->pageId); } } // toont de meta sitetitel public function showPageTitel() { echo (!empty($this->oPage->browserTitle)?$this->oPage->browserTitle:$this->oAdm->siteTitel); } // toont de meta description public function showPageDesc() { echo (!empty($this->oPage->pageDesc)?$this->oPage->pageDesc:$this->oAdm->shortDesc); } // toont de meta tags public function showPageTags() { echo (!is_array($this->aTags))?$this->oAdm->metaTags:implode(', ', $this->aTags); } // toont de inhoud van de betreffende pagina public function showContent() { if(!empty($this->oPage->sysPageLink)) { $query = mysql_query("SELECT pageLocation FROM sc_sys_pages WHERE sysPageId=".$this->oPage->sysPageLink); if($rows = mysql_num_rows($query)) { $page = mysql_result($query, 0, 0); include($page); } } else { if(isset($this->oPage->menuId) && $this->oPage->menuId==4) { echo '
'.$this->oPage->pageLabel.'
'; echo '
'.str_replace('[break]', '', stripslashes($this->oPage->pageContent)).'
'; } elseif(isset($this->oPage->menuId) && $this->oPage->menuId==5) { echo '
'.$this->oPage->pageLabel.'
'; echo '
'.stripslashes($this->oPage->pageContent).'
'; } else { echo stripslashes($this->oPage->pageContent); } } } // toont de inhoud public function x_showContent() { echo $this->oPage->pageContent; } // toont de rechterkant public function showRightSide() { $query = mysql_query("SELECT pageContent FROM sc_pages WHERE fileName='tekstrechts'"); if($rows = mysql_num_rows($query)) { $content = mysql_result($query, 0, 0); echo $content; } return false; } // toont het nieuwsblok public function showNews() { $query = mysql_query("SELECT pageContent FROM sc_pages WHERE fileName='nieuwskort'"); if($rows = mysql_num_rows($query)) { $content = mysql_result($query, 0, 0); echo $content; } return false; } public function showLocCode1() { $output = ""; $query = mysql_query("SELECT p.pageId, p.fileName, p.pageLabel FROM sc_menus as m, sc_menu_idx as i, sc_pages as p WHERE m.locCode='locCode1' AND m.menuId=i.menuId AND i.pageId=p.pageId AND i.parentId=0 AND p.pageStatus='online' ORDER BY pagePos"); if($rows = mysql_num_rows($query)) { for($i=0; $i<$rows; $i++) { $res = mysql_fetch_assoc($query); //$output .= "".utf8_decode($res['pageLabel'])."\n"; $output .= '
'.utf8_decode($res['pageLabel']).'
'."\n"; $output .= '
'; } return $output; } return false; } public function showSub() { $output = ""; if(!empty($this->oPage->menuId) && $this->oPage->menuId==4) { $query = mysql_query("SELECT m.pageId FROM sc_pages as p, sc_menu_idx as m WHERE m.parentId=3 AND m.pageId=p.pageId AND p.pageStatus='online' ORDER BY m.pagePos"); } elseif(!empty($this->oPage->menuId) && $this->oPage->menuId==5) { $query = mysql_query("SELECT m.pageId FROM sc_pages as p, sc_menu_idx as m WHERE m.parentId=4 AND m.pageId=p.pageId AND p.pageStatus='online' ORDER BY m.pagePos"); } else { $query = mysql_query("SELECT m.pageId FROM sc_pages as p, sc_menu_idx as m WHERE m.parentId=".((isset($_GET['pageId']) && $this->curFileName!='nieuws.php')?$this->oPage->parentId:$this->oPage->pageId)." AND m.pageId=p.pageId AND p.pageStatus='online' ORDER BY m.pagePos"); } if($rows = mysql_num_rows($query)) { for($i=0; $i<$rows; $i++) { $pageId = mysql_result($query, $i, 0); $query2 = mysql_query("SELECT * FROM sc_pages WHERE pageId=".$pageId); $res = mysql_fetch_assoc($query2); $output .= ''.(($this->oPage->pageId==$res['pageId'])?'':false).utf8_decode($res['pageLabel']).(($this->oPage->pageId==$res['pageId'])?'':false).''."\n"; } return $output; } return false; } public function showNieuwsKoppen() { $query = mysql_query("SELECT p.pageId, p.fileName, p.pageLabel FROM sc_menus as m, sc_menu_idx as i, sc_pages as p WHERE m.locCode='locCode3' AND m.menuId=i.menuId AND i.pageId=p.pageId AND i.parentId=0 AND p.pageStatus='online' ORDER BY pagePos DESC LIMIT 6"); if($rows = mysql_num_rows($query)) { $output = ""; for($i=0; $i<$rows; $i++) { $res = mysql_fetch_assoc($query); $output .= '
  • '.utf8_decode(ucfirst($res['pageLabel'])).'
  • '."\n"; } return $output; } return false; } public function showMenu() { $output = ''."\n"; if($this->curFileName=="diensten.php" || $this->curFileName=="consultancy.php" || $this->curFileName=="analyse.php" || $this->curFileName=="coaching_training.php" || $this->curFileName=="opleidingen_workshops.php") { $output .= ''."\n"; } return $output; } // geeft alle gegevens van een pagina terug in een object protected function getPageRow($fileName) { if(isset($_GET['pageId'])) { $query = mysql_query("SELECT p.*, i.parentId, i.menuId FROM sc_menu_idx as i, sc_pages as p WHERE i.pageId=p.pageId AND i.pageId=".$_GET['pageId']." AND p.pageStatus='online'"); } elseif(!empty($fileName) && $fileName!="nieuws.php") { $query = mysql_query("SELECT p.*, i.parentId FROM sc_menu_idx as i, sc_pages as p WHERE i.pageId=p.pageId AND p.fileName='".$fileName."' AND p.pageStatus='online'"); } elseif(!empty($fileName) && $fileName=="nieuws.php") { $query = mysql_query("SELECT p.*, i.parentId FROM sc_menus as m, sc_menu_idx as i, sc_pages as p WHERE m.locCode='locCode3' AND m.menuId=i.menuId AND i.pageId=p.pageId AND p.pageStatus='online' ORDER BY i.pagePos DESC LIMIT 1"); } else { return false; } if($rows = mysql_num_rows($query)) { $obj = mysql_fetch_object($query); //$obj->hasChild = $this->checkHasChild($obj->pageId); //$obj->depth = $this->checkDepth($obj->pageId); return $obj; } return false; } // haalt de zoekwoorden van een bepaalde pagina op protected function getPageTags($pageId) { $query = mysql_query("SELECT keyword FROM sc_keywords WHERE pageId=".$pageId." ORDER BY weight DESC"); if($rows = mysql_num_rows($query)) { $aTags = array(); for($i=0; $i<$rows; $i++) { $aTags[$i] = mysql_result($query, $i, 0); } return $aTags; } return false; } } ?>