| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- class admin_pages_model extends Model {
-
-
- public function getPages() {
- $result = $this->query("select * from azonics_pages where page_status<>'0';");
- return $result;
- }
-
-
- public function loadPage() {
- $page_id = $this->escapeString($_REQUEST['id']);
- $row = $this->query("select * from azonics_pages where page_id='".$page_id."';");
- return $row[0];
- }
-
-
- public function savePage() {
- $data = $this->escapeArray($_REQUEST);
-
- if ($data['page_id']!='') {
- if ($_FILES['page_banner']['tmp_name']!=='') {
- $fname = 'banner_'.time().'.jpg';
- $path = 'static/uploads/thumbs/';
- move_uploaded_file($_FILES['page_banner']['tmp_name'],$path.$fname);
- $this->execute("UPDATE azonics_pages SET page_banner='".$path.$fname."' WHERE page_id='".$data['page_id']."';");
- }
- $this->execute("update azonics_pages set "
- . "page_slug='".$data['page_slug']."', "
- . "page_title='".$data['page_title']."', "
- . "page_content='".$data['page_content']."', "
- . "right_title='".$data['right_title']."', "
- . "seo_keywords='".$data['seo_keywords']."', "
- . "seo_description='".$data['seo_description']."', "
- . "right_content='".$data['right_content']."' "
- . "where page_id='".$data['page_id']."';");
-
- return true;
- }
- else {
- if ($_FILES['page_banner']['tmp_name']!=='') {
- $fname = 'banner_'.time().'.jpg';
- $path = 'static/uploads/thumbs/';
- move_uploaded_file($_FILES['page_banner']['tmp_name'],$path.$fname);
- }
-
- $this->execute("insert into azonics_pages set "
- . "page_slug='".$data['page_slug']."', "
- . "page_title='".$data['page_title']."', "
- . "page_content='".$data['page_content']."', "
- . "right_title='".$data['right_title']."', "
- . "right_content='".$data['right_content']."', "
- . "seo_keywords='".$data['seo_keywords']."', "
- . "seo_description='".$data['seo_description']."', "
- . "page_status='1', page_banner='".$path.$fname."', "
- . "page_user='".$_SESSION['admin_user']->admin_id."';");
- return true;
- }
- }
-
-
- public function deletePage() {
- $page_id = $this->escapeString($_REQUEST['id']);
- $this->execute("update azonics_pages set page_status='0' where page_id='".$page_id."';");
- return true;
- }
-
-
- }
|