Query("UPDATE ".TABLE_CATTEKST." SET naam = '".$oDatabase->Escape($POST['cattekst_naam'])."', tekst = '".$oDatabase->Escape($POST['cattekst_tekst'])."', meta_pagetitle = '".$oDatabase->Escape($POST['meta_pagetitle'])."', meta_description = '".$oDatabase->Escape($POST['meta_description'])."', meta_keywords = '".$oDatabase->Escape($POST['meta_keywords'])."' WHERE id=".(int)$POST['cattekst_id'], DB_MODE_RESULT); } /* function to insert CatTekst @param $POST - unedited version of $_POST */ public function insertCatTekst($POST) { global $oDatabase; $oDatabase->Query("INSERT INTO ".TABLE_CATTEKST." (naam, tekst, meta_pagetitle, meta_description, meta_keywords) VALUES ( '".$oDatabase->Escape($POST['cattekst_naam'])."', '".$oDatabase->Escape($POST['cattekst_tekst'])."', '".$oDatabase->Escape($POST['meta_pagetitle'])."', '".$oDatabase->Escape($POST['meta_description'])."', '".$oDatabase->Escape($POST['meta_keywords'])."')", DB_MODE_SINGLE); return true; } /* function to delete CatTekst @param $iLinkid */ public function deleteCatTekst($iLinkid) { if (!is_numeric($iLinkid)) { return false; } global $oDatabase; return $oDatabase->Query("DELETE FROM ".TABLE_CATTEKST." WHERE id=".(int)$iLinkid, DB_MODE_RESULT); } public function getAllCatTekst() { global $oDatabase; return $oDatabase->Query(" SELECT * FROM ".TABLE_CATTEKST."", DB_MODE_ROWS); } /* Links */ /* function to edit linkcategory-name and weight */ public function setCatNameWeight($iCatid, $sCatname, $iWeight) { if (!is_numeric($iCatid)) { return false; } if (!is_numeric($iWeight)) { return false; } global $oDatabase; return $oDatabase->Query("update ".TABLE_LINKCATEGORY." set name='".$oDatabase->Escape($sCatname)."', weight=".(int)$iWeight." where linkcategoryid=".(int)$iCatid, DB_MODE_RESULT); } /* function to insert categories @param $POST - unedited version of $_POST */ public function insertCategory($POST) { if (!is_numeric($POST['category_weight'])) { return false; } global $oDatabase; $oDatabase->Query("insert into ".TABLE_LINKCATEGORY." (name, weight) VALUES ( '".$oDatabase->Escape($POST['category_name'])."', ".(int)$POST['category_weight'].")", DB_MODE_SINGLE); return true; } /* function to delete categories @param $POST - unedited version of $_POST */ public function deleteCategory($iCatid) { if (!is_numeric($iCatid)) { return false; } global $oDatabase; $bResult = $oDatabase->Query("delete from ".TABLE_LINK." where linkcategoryid=".(int)$iCatid, DB_MODE_RESULT); if (!$bResult) { return false; } return $oDatabase->Query("delete from ".TABLE_LINKCATEGORY." where linkcategoryid=".(int)$iCatid, DB_MODE_RESULT); } /* function to edit links @param $POST - unedited version of $_POST */ public function setLink($POST) { if (!is_numeric($POST['link_linkid'])) { return false; } if (!is_numeric($POST['link_weight'])) { return false; } global $oDatabase; return $oDatabase->Query("update ".TABLE_LINK." set url = '".$oDatabase->Escape($POST['link_url'])."', anchor = '".$oDatabase->Escape($POST['link_anchor'])."', weight=".(int)$POST['link_weight']." where linkid=".(int)$POST['link_linkid'], DB_MODE_RESULT); } /* function to insert links @param $POST - unedited version of $_POST */ public function insertLink($POST) { if (!is_numeric($POST['link_categoryid'])) { return false; } if (!is_numeric($POST['link_weight'])) { return false; } global $oDatabase; $oDatabase->Query("insert into ".TABLE_LINK." (url, anchor, linkcategoryid, weight) VALUES ( '".$oDatabase->Escape($POST['link_url'])."', '".$oDatabase->Escape($POST['link_anchor'])."', ".(int)$POST['link_categoryid'].", ".(int)$POST['link_weight'].")", DB_MODE_SINGLE); return true; } /* function to delete links @param $iLinkid */ public function deleteLink($iLinkid) { if (!is_numeric($iLinkid)) { return false; } global $oDatabase; return $oDatabase->Query("delete from ".TABLE_LINK." where linkid=".(int)$iLinkid, DB_MODE_RESULT); } public function getLinks($outerjoin = false) { global $oDatabase; if ($outerjoin) { return $oDatabase->Query(" select ".TABLE_LINK.".linkid, ".TABLE_LINK.".url, ".TABLE_LINK.".anchor, ".TABLE_LINK.".weight as linkweight, ".TABLE_LINKCATEGORY.".name as catname, ".TABLE_LINKCATEGORY.".weight as catweight, ".TABLE_LINKCATEGORY.".linkcategoryid as linkcatid from ".TABLE_LINK." RIGHT OUTER JOIN ".TABLE_LINKCATEGORY." ON ".TABLE_LINK.".linkcategoryid = ".TABLE_LINKCATEGORY.".linkcategoryid order by catweight,linkweight asc", DB_MODE_ROWS); } return $oDatabase->Query(" select ".TABLE_LINK.".linkid, ".TABLE_LINK.".url, ".TABLE_LINK.".anchor, ".TABLE_LINK.".weight as linkweight, ".TABLE_LINKCATEGORY.".name as catname, ".TABLE_LINKCATEGORY.".weight as catweight, ".TABLE_LINKCATEGORY.".linkcategoryid as linkcatid from ".TABLE_LINK.",".TABLE_LINKCATEGORY." where ".TABLE_LINK.".linkcategoryid = ".TABLE_LINKCATEGORY.".linkcategoryid order by catweight,linkweight asc", DB_MODE_ROWS); } // prolly never used, it will fail anyway (no downloadcount) public function incLinkCounter($iLid) { global $oDatabase; return $oDatabase->Query("update ".TABLE_LINKS." set downloadcount = downloadcount+1 where downloadid=".(int)$iLid." limit 1", DB_MODE_SINGLE); } }