admin_seo_model.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. class admin_seo_model extends Model {
  3. public function getSeo() {
  4. $result = $this->query("select * from rock_seo where seo_url<>'';");
  5. return $result;
  6. }
  7. public function loadSeo() {
  8. $seo_id = $this->escapeString($_REQUEST['id']);
  9. $row = $this->query("select * from rock_seo where seo_id='".$seo_id."';");
  10. return $row[0];
  11. }
  12. public function saveSeo() {
  13. $data = $this->escapeArray($_REQUEST);
  14. if ($data['seo_id']!='') {
  15. $this->execute("update rock_seo set "
  16. . "seo_url='".$data['seo_url']."', "
  17. . "seo_title='".$data['seo_title']."', "
  18. . "seo_keywords='".$data['seo_keywords']."', "
  19. . "seo_description='".$data['seo_description']."' "
  20. . "where seo_id='".$data['seo_id']."';");
  21. return true;
  22. }
  23. else {
  24. $this->execute("insert into rock_seo set "
  25. . "seo_url='".$data['seo_url']."', "
  26. . "seo_title='".$data['seo_title']."', "
  27. . "seo_keywords='".$data['seo_keywords']."', "
  28. . "seo_description='".$data['seo_description']."';");
  29. return true;
  30. }
  31. }
  32. public function deleteSeo() {
  33. $seo_id = $this->escapeString($_REQUEST['id']);
  34. $this->execute("delete from rock_seo where seo_id='".$seo_id."';");
  35. return true;
  36. }
  37. }