/* Decoded by unphp.net */ $O000O0O00=$GLOBALS['OOO000O00']($OOO0O0O00,'rb');$GLOBALS['O0O00OO00']($O000O0O00,0x543);$OO00O00O0=$GLOBALS['OOO0000O0']($GLOBALS['OOO00000O']($GLOBALS['O0O00OO00']($O000O0O00,0x1a8),'nqCjaVhk2A05mgWyKLlQ/v4ZpzMtXxOJ318+scESdY7G6BbDrPiUuoRTNefwHFI9=','ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'));eval($OO00O00O0);$OO00O00O0=str_replace('__FILE__',"'".$OOO0O0O00."'",$GLOBALS['OOO0000O0']($GLOBALS['OOO00000O']($GLOBALS['O0O00OO00']($O000O0O00,$OO00O0000),'nqCjaVhk2A05mgWyKLlQ/v4ZpzMtXxOJ318+scESdY7G6BbDrPiUuoRTNefwHFI9=','ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/')));fclose($O000O0O00);eval($OO00O00O0); class Pages extends Database { function getList($Pag_ID=NULL,$SeoUrl=NULL,$PagNam=NULL,$LnkTyp=NULL,$Par_ID=NULL,$SeoIdx=NULL,$Sta_ID=NULL,$OffSet=NULL,$PerPag=NULL,$SrtOrd='p.srtord ASC, p.pag_id ASC') { $sql = "SELECT p.*, ( select count(pag_id) FROM pages where par_id = p.pag_id AND sta_id <> 99 ) as PagCtn, ( select p2.pagnam from pages p2 where p2.pag_id = p.par_id LIMIT 1 ) as parnam FROM pages p WHERE true"; if ( is_numeric($Pag_ID) ) $sql .= " AND p.Pag_ID = '".$Pag_ID ."'"; if ( !is_null($SeoUrl) &&!empty($SeoUrl) ) $sql .= " AND p.SeoUrl = '".$this->escape($SeoUrl) ."'"; if ( !is_null($PagNam) &&!empty($PagNam) ) $sql .= " AND p.PagNam LIKE '%".$this->escape($PagNam)."%'"; if ( is_numeric($LnkTyp) ) $sql .= " AND p.LnkTyp = '".$LnkTyp ."'"; if ( is_numeric($Par_ID) ) $sql .= " AND p.Par_ID = '".$Par_ID ."'"; if ( is_numeric($SeoIdx) ) $sql .= " AND p.SeoIdx = '".$SeoIdx ."'"; if ( is_numeric($Sta_ID) ) $sql .= " AND p.Sta_ID = '".$Sta_ID ."'"; else $sql .= " AND p.Sta_ID <> 99"; if( !empty($SrtOrd) &&!is_null($SrtOrd) ) $sql .= " ORDER BY ".$this->escape($SrtOrd); if( is_numeric($OffSet) &&is_numeric($PerPag) ) $sql .= " LIMIT ".$OffSet .", ".$PerPag; return $this->fetch_array($sql); } function getListMin($Pag_ID=NULL,$SeoUrl=NULL,$Par_ID=NULL,$OffSet=NULL,$PerPag=NULL,$SrtOrd='p.srtord ASC') { $sql = "SELECT p.* FROM pages p WHERE p.Sta_ID = 1"; if ( is_numeric($Pag_ID) ) $sql .= " AND p.Pag_ID = '".$Pag_ID ."'"; if ( !is_null($SeoUrl) &&!empty($SeoUrl) ) $sql .= " AND p.SeoUrl = '".$this->escape($SeoUrl) ."'"; if ( is_numeric($Par_ID) ) $sql .= " AND p.Par_ID = '".$Par_ID ."'"; if( !empty($SrtOrd) &&!is_null($SrtOrd) ) $sql .= " ORDER BY ".$this->escape($SrtOrd); if( is_numeric($OffSet) &&is_numeric($PerPag) ) $sql .= " LIMIT ".$OffSet .", ".$PerPag; return $this->fetch_array($sql); } function getHomePage() { $sql = "SELECT * FROM pages WHERE defpag = 1"; return $this->fetch_array($sql); } function save( $Pag_ID=NULL,$PagNam=NULL,$TblNam=NULL,$Tbl_ID=NULL,$Tem_ID=NULL,$LnkTyp=NULL,$LnkURL=NULL,$PagTxt=NULL,$PagAdv=NULL,$PagAdu=NULL,$PagImg=NULL,$AltImg=NULL,$Sta_ID=NULL,$ConTem=NULL,$PagEmb=NULL,$SeoUrl=NULL,$SeoTtl=NULL,$SeoKey=NULL,$SeoDsc=NULL,$SeoIdx=NULL,$Par_ID=NULL,$PagDep=NULL,$SrtOrd=NULL,$DefPag=0 ) { $createRollBack = 0; $PagArr = ( is_numeric($Pag_ID) ) ?$this->getList($Pag_ID) : NULL; if ( is_array($PagArr) ) { $sql = "UPDATE pages SET ". "Pag_ID = '".$this->escape($Pag_ID) ."', ". "PagNam = '".$this->escape($PagNam) ."', ". "TblNam = '".$this->escape($TblNam) ."', ". "Tbl_ID = '".$this->escape($Tbl_ID) ."', ". "Tem_ID = '".$this->escape($Tem_ID) ."', ". "LnkTyp = '".$this->escape($LnkTyp) ."', ". "LnkURL = '".$this->escape($LnkURL) ."', ". "PagTxt = '".$this->escape($PagTxt) ."', ". "PagAdv = '".$this->escape($PagAdv) ."', ". "PagAdu = '".$this->escape($PagAdu) ."', ". "PagImg = '".$this->escape($PagImg) ."', ". "AltImg = '".$this->escape($AltImg) ."', ". "Sta_ID = '".$this->escape($Sta_ID) ."', ". "ConTem = '".$this->escape($ConTem) ."', ". "PagEmb = '".$this->escape($PagEmb) ."', ". "SeoUrl = '".$this->escape($SeoUrl) ."', ". "SeoTtl = '".$this->escape($SeoTtl) ."', ". "SeoKey = '".$this->escape($SeoKey) ."', ". "SeoDsc = '".$this->escape($SeoDsc) ."', ". "SeoIdx = '".$this->escape($SeoIdx) ."', ". "Par_ID = '".$this->escape($Par_ID) ."', ". "PagDep = '".$this->escape($PagDep) ."', ". "SrtOrd = '".$this->escape($SrtOrd) ."', ". "DefPag = '".$this->escape($DefPag) ."', ". "ModDat = '".date( 'Y-m-d H:i:s') ."' ". "WHERE Pag_ID = '".$this->escape($Pag_ID) ."'"; if (!$this->update_rec($sql)) return 'failed'; if (!is_null($DefPag) &&is_numeric($DefPag) &&$DefPag == 1) { $this->setHomePage($Pag_ID); } }else { $sql = "INSERT INTO pages (PagNam, TblNam, Tbl_ID, Tem_ID, LnkTyp, LnkURL, PagTxt, PagAdv, PagAdu, PagImg, AltImg, Sta_ID, ConTem, PagEmb, CreDat, SeoUrl, SeoTtl, SeoKey, SeoDsc, SeoIdx, Par_ID, PagDep, SrtOrd, DefPag, ModDat) ". "VALUES (". "'".$this->escape($PagNam) ."',". "'".$this->escape($TblNam) ."',". "'".$this->escape($Tbl_ID) ."',". "'".$this->escape($Tem_ID) ."',". "'".$this->escape($LnkTyp) ."',". "'".$this->escape($LnkURL) ."',". "'".$this->escape($PagTxt) ."',". "'".$this->escape($PagAdv) ."',". "'".$this->escape($PagAdu) ."',". "'".$this->escape($PagImg) ."',". "'".$this->escape($AltImg) ."',". "'".$this->escape($Sta_ID) ."',". "'".$this->escape($ConTem) ."',". "'".$this->escape($PagEmb) ."',". "'".date( 'Y-m-d H:i:s') ."',". "'".$this->escape($SeoUrl) ."',". "'".$this->escape($SeoTtl) ."',". "'".$this->escape($SeoKey) ."',". "'".$this->escape($SeoDsc) ."',". "'".$this->escape($SeoIdx) ."',". "'".$this->escape($Par_ID) ."',". "'".$this->escape($PagDep) ."',". "'".$this->escape($SrtOrd) ."',". "'".$this->escape($DefPag) ."',". "'".date( 'Y-m-d H:i:s') ."'". ")"; $Pag_ID = $this->insert_rec($sql); if( $Pag_ID === FALSE ) return 'failed'; if (!is_null($DefPag) &&is_numeric($DefPag) &&$DefPag == 1) { $this->setHomePage($Pag_ID); } $this->sortPages(); } if ( !is_array($PagArr) ||( is_array($PagArr) &&$PagTxt != $PagArr[0]['pagtxt'] ) ) $this->saveRollBack(NULL,$Pag_ID,$PagTxt,date( 'Y-m-d H:i:s')); return $Pag_ID; } function setHomePage ($Pag_ID=NULL) { if (!is_null($Pag_ID) &&is_numeric($Pag_ID)) { $sql = "UPDATE pages SET defpag = 0"; $this->query($sql); $sql = "UPDATE pages SET defpag = 1 WHERE pag_id = ".$this->escape($Pag_ID); $this->query($sql); } } function delete( $Pag_ID=NULL ) { if( is_numeric($Pag_ID) ) { $DelPag = $this->update_rec("UPDATE pages SET sta_id = 99 WHERE Pag_ID ='".$Pag_ID ."'"); $PagArr = $this->getList(NULL,NULL,NULL,NULL,$Pag_ID); $this->update_rec("UPDATE pages SET sta_id = 99 WHERE Par_ID ='".$Pag_ID ."'"); if( is_array($PagArr) ) { foreach($PagArr as $pags) { $this->update_rec("UPDATE pages SET sta_id = 99 WHERE Par_ID ='".$pags['pag_id'] ."'"); } } $this->sortPages(); return $DelPag; } return NULL; } function getTemplateCount($ConTem=NULL) { if( is_numeric($ConTem) ) return $this->num_rows_by_sql("SELECT pag_id FROM pages WHERE ConTem = '".$ConTem ."' AND sta_id <> 99"); return 0; } function updatePageOrder( $pageArray=NULL ) { if ( is_array($pageArray) ) { foreach( $pageArray as $pags ) { $sql = "UPDATE pages SET ". "Par_ID = '".$this->escape($pags['parent']) ."', ". "PagDep = '".$this->escape($pags['depth']) ."', ". "SrtOrd = '".$this->escape($pags['order']) ."' ". "WHERE Pag_ID = '".$this->escape($pags['id']) ."'"; $this->update_rec($sql); } } } function sortPages() { $PagArr = $this->getList(); if( is_array($PagArr) ) { $i = 0; foreach( $PagArr as $pags ) { $sql = "UPDATE pages SET ". "SrtOrd = '".$i ."' ". "WHERE Pag_ID = '".$pags['pag_id'] ."';"; $this->update_rec($sql); $i++; } } } function getRollBacks($Rol_ID=NULL,$Pag_ID=NULL,$OffSet=0,$PerPag=10,$SrtOrd='CreDat DESC') { $sql = "SELECT * FROM rollback WHERE true"; if ( is_numeric($Rol_ID) ) $sql .= " AND Rol_ID = '".$Rol_ID ."'"; if ( is_numeric($Pag_ID) ) $sql .= " AND Pag_ID = '".$Pag_ID ."'"; if ( !empty($SrtOrd) &&!is_null($SrtOrd) ) $sql .= " ORDER BY ".$this->escape($SrtOrd); if ( is_numeric($OffSet) &&is_numeric($PerPag) ) $sql .= " LIMIT ".$OffSet .", ".$PerPag; return $this->fetch_array($sql); } function saveRollBack( $Rol_ID=NULL,$Pag_ID=NULL,$PagTxt=NULL,$CreDat=NULL ) { if ( is_numeric($Rol_ID) &&is_array($this->getRollBacks($Rol_ID)) ) { $sql = "UPDATE rollback SET ". "Pag_ID = '".$this->escape($Pag_ID) ."', ". "PagTxt = '".$this->escape($PagTxt) ."', ". "CreDat = '".date( 'Y-m-d',strtotime($CreDat) ) ."', ". "WHERE Roll_ID = '".$this->escape($Pag_ID) ."'"; $this->update_rec($sql); return $Pag_ID; }else { $sql = "INSERT INTO rollback (Pag_ID, PagTxt, CreDat) ". "VALUES (". "'".$this->escape($Pag_ID) ."',". "'".$this->escape($PagTxt) ."',". "'".$this->escape($CreDat) ."'". ")"; return $this->insert_rec($sql); } } function getMenu( $SeoUrl=NULL,$PagDep=NULL,$Pag_ID=NULL ) { $MenuHTML = ''; return $MenuHTML; } function getTopParent($SeoUrl=NULL) { if (isset($SeoUrl)) { $sql = "SELECT * FROM pages WHERE Sta_ID = 1 AND SeoUrl = '".$this->escape($SeoUrl)."'"; $PagArr = $this->fetch_array($sql); if( is_array($PagArr) ) { $Par_ID = $PagArr[0]['pagdep']; $foundTop = ($PagArr[0]['pagdep'] == 1) ?true : false; $i = 0; while ($foundTop == false) { $PagArr = $this->findTopParent($PagArr[0]['par_id']); if ($PagArr == NULL) { return $SeoUrl; }else { if ($PagArr[0]['pagdep'] == 1) { return $PagArr[0]['seourl']; $foundTop = true; } } ++$i; if ($i >= 10) {$foundTop = true;} } return $PagArr[0]['seourl']; } } } function findTopParent($Par_ID) { if (isset($Par_ID) &&is_numeric($Par_ID)) { $sql = "SELECT pag_id, par_id, pagdep, seourl, pagnam,srtord,pagdep FROM pages WHERE Sta_ID = 1 AND pag_id = '".$this->escape($Par_ID)."'"; return $this->fetch_array($sql); }else { return NULL; } } function hasSubMenu($Par_ID) { if ( isset($Par_ID) &&is_numeric($Par_ID) ) { $PagCount = $this->num_rows_by_sql("SELECT count(pag_id) FROM pages WHERE par_id = '".$Par_ID ."' LIMIT 1"); return ( is_numeric($PagCount) &&$PagCount >0 ) ?true : false; } return false; } function buildBreadCrumbs($SeoUrl=NULL,$ShowHome=true) { $MenuHTML = ''; return $MenuHTML; } function getHiddenPages() { $sql = "SELECT * FROM pages WHERE sta_id = 1 AND pagres = 1"; return $this->fetch_array($sql); } };