pIsConnected = true; $this->pResourceLink = mysql_connect($this->pHost, $this->pUser, $this->pPassword); if (!$this->mNoError()) { $this->pIsConnected = false; $tmpOutput = false; } return $tmpOutput; } function mSelect() { mysql_select_db($this->pDatabase, $this->pResourceLink); return $this->mNoError(); } // MySQL 4.0> gets the total amount of rows without the limit x,y function mGetFoundRows() { $tmpSQL = "SELECT FOUND_ROWS() AS total_rows"; $result = mysql_query($tmpSQL, $this->pResourceLink); $tmpRecordA = mysql_fetch_array($result, MYSQL_ASSOC); return $tmpRecordA['total_rows']; } // private function mNoError() { $tmpOutput = true; //default true, otherwise when error occurs: false if (mysql_errno($this->pResourceLink)>0) { $this->pOperationOutput .= mysql_errno($this->pResourceLink) . ": " . mysql_error($this->pResourceLink) . "
"; $tmpOutput = false; } return $tmpOutput; } function mCleanStringForDb($stringIn) { $stringIn = trim($stringIn); if ((substr($stringIn,0,1) == "\"") && (substr($stringIn,-1,1) == "\"")) { $stringIn = trim($stringIn); $stringIn = substr($stringIn,1,strlen($stringIn)-2); if (substr($stringIn,-2) == "\"\"") { $stringIn = substr($stringIn,0,strlen($stringIn)-1); } } return addslashes($stringIn); } // function added 23 nov 2006 function mGetInsertId() { return mysql_insert_id ($this->pResourceLink); } // function added 3 dec 2006 function mGetNumRows() { return $this->pNumRows; } // function added 12 mei 2006 function mExecuteQuery($SQLIn) { $this->pLastQuery = $SQLIn; $result = mysql_query($this->pLastQuery,$this->pResourceLink); $this->pRecordsInResult = Array(); if (mysql_errno($this->pResourceLink)>0) { $this->pError = true; print "
";
					print $this->mGetErrorInfo();
					print "
"; } else { $this->pError = false; while (@$tmpRecordA = mysql_fetch_array($result, MYSQL_ASSOC)) { $this->pRecordsInResult[] = $tmpRecordA; } if (strpos(strtolower($SQLIn), "select") !== false ) { $this->pNumRows = mysql_num_rows($result); } } @mysql_free_result($result); /* print "
";
				print $SQLIn;
				print_r($tmpOutput);
				print "
"; */ return $this->pRecordsInResult; } function mGetErrorInfo() { return mysql_errno($this->pResourceLink) . ": " . mysql_error($this->pResourceLink) . " query:".$this->pLastQuery."
"; } } ?>pDBO = new dbClass(); $this->pDBO->mConnect(); $this->pDBO->mSelect(); session_start(); } function mGetSmarty() { $tmpSmartyO = new Smarty(); $tmpSmartyO->template_dir = CMS_BASE.'smarty/sources/templates'; $tmpSmartyO->compile_dir = CMS_BASE.'smarty/sources/templates_c'; $tmpSmartyO->cache_dir = CMS_BASE.'smarty/sources/cache'; $tmpSmartyO->config_dir = CMS_BASE.'smarty/sources/configs'; return $tmpSmartyO; } function mRender($recordIn = null,$templateIn, $forceArrayAsValueIn = false) { /* print "
";
					print_r($recordIn);
					print "
"; */ foreach($recordIn AS $key=>$value) { if (is_array($value) && !$forceArrayAsValueIn) { print "Error: baseClass.mRender: trying to render data with template:".$templateIn; print "
"; print "recordIn is array with multiple records, use baseClass.mRenderMultiple"; print "
"; print "RecordIn
"; print "
";
					print_r($recordIn);
					print "
"; print "Halted at key:".$key." value:"; print "
";
					print_r($value);
					print "
"; exit; } } $tmpHTML = ""; if ($recordIn == 0) { $recordIn = Array(); } $tmpSmartyO = baseClass::mGetSmarty(); foreach($recordIn AS $key=>$value) { $tmpSmartyO->assign($key, $value); } echo $tmpSmartyO->fetch($templateIn); } function mRenderMail($recordIn = null,$templateIn, $forceArrayAsValueIn = false) { /* print "
";
					print_r($recordIn);
					print "
"; */ foreach($recordIn AS $key=>$value) { if (is_array($value) && !$forceArrayAsValueIn) { print "Error: baseClass.mRender: trying to render data with template:".$templateIn; print "
"; print "recordIn is array with multiple records, use baseClass.mRenderMultiple"; print "
"; print "RecordIn
"; print "
";
					print_r($recordIn);
					print "
"; print "Halted at key:".$key." value:"; print "
";
					print_r($value);
					print "
"; exit; } } $tmpHTML = ""; if ($recordIn == 0) { $recordIn = Array(); } $tmpSmartyO = baseClass::mGetSmarty(); foreach($recordIn AS $key=>$value) { $tmpSmartyO->assign($key, $value); } return $tmpSmartyO->fetch($templateIn); } function mRenderMultiple($recordsIn = null,$templateIn) { if ($recordsIn == null) { $recordsIn = Array(); } $tmpHTML = ""; foreach($recordsIn AS $tmpRecord) { $tmpSmartyO = baseClass::mGetSmarty(); foreach($tmpRecord AS $key=>$value) { $tmpSmartyO->assign($key, $value); } $tmpHTML .= $tmpSmartyO->fetch($templateIn); } return $tmpHTML; } // maakt een JSON (Javascript object notation) string van een array function mArrayToJSON($tmpArrayIn) { $tmpRecords = Array(); foreach ($tmpArrayIn AS $key=>$value) { $tmpValueString = ""; if (is_array($value)) { $tmpPropertiesB = Array(); foreach ($value AS $key2=>$value2) { $tmpPropertiesB[] = '"'.$key2.'": "'.$value2.'"'; } $tmpValueString = "{".implode(",", $tmpPropertiesB)."}"; } else { $tmpValueString = '"'.$value.'"'; } //$tmpPropertiesA[] = '"'.$key.'": '.$tmpValueString; $tmpRecords[] = $tmpValueString; } $tmpPropertiesString = implode(",", $tmpRecords); $tmpJSON = '['. $tmpPropertiesString . ']'; return $tmpJSON; } /** * Displays a debug message * @param mixed de te printen info (array of string) */ function mTrace($msgIn) { print "
"; print "DEBUG msg:"; print "
";
			
			 
			if (is_array($msgIn)) {
				print_r($msgIn);
			} else {
				print $msgIn;
			}
			print "
"; } } ?>