コード例 #1
0
ファイル: page.php プロジェクト: StudsPro/islandpeeps.com
 public function addeditPage($Data, $page_id)
 {
     $page_synonums = $Data['page_title'];
     $page_synonums = $this->createpagesynonums($page_id, $page_synonums);
     $query = $this->db->query("select page_synonums from tbl_pages where id!=" . $page_id . " and page_synonums='" . $page_synonums . "'");
     $RsCount = $query->result_array();
     if (count($RsCount) == 0) {
         if ($page_id == 0) {
             //id, menu_icon, page_title, detailed_description, status, video,page_synonums
             $sqlstr = "Insert into tbl_pages (page_synonums, page_title, detailed_description, status)\n\t\t\t\t\t\tvalues('" . $page_synonums . "','" . StriptStr($Data['page_title']) . "','" . StriptStr($Data['detailed_description']) . "','1')";
         } else {
             $sqlstr = "update tbl_pages set page_synonums='" . $page_synonums . "',page_title='" . StriptStr($Data['page_title']) . "',\n                        detailed_description='" . StriptStr($Data['detailed_description']) . "', status='" . $Data['status'] . "' where id=" . $page_id;
         }
         $this->db->query($sqlstr);
         return "ins";
     } else {
         return 0;
     }
 }
コード例 #2
0
ファイル: region.php プロジェクト: StudsPro/islandpeeps.com
 public function addeditRegion($Data, $id)
 {
     $ragion_map = "";
     $flag = "";
     $query = $this->db->query("select region_name from tbl_regions where id!=" . $id . " and region_name='" . $Data['region_name'] . "'");
     $RsCount = $query->result_array();
     if (count($RsCount) == 0) {
         if ($_FILES['db_flag']['name'] != "") {
             $val = $_FILES['db_flag'];
             $strDirectory = SITE_UPLOADPATH;
             @chmod($strDirectory, 0777);
             $val['name'] = mktime() . removeSpace($val['name']);
             move_uploaded_file($val['tmp_name'], $strDirectory . $val['name']);
             @chmod($strDirectory . $val['name'], 0644);
             $FileNameArray = pathinfo('upload/' . $val['name']);
             if ($FileNameArray['extension'] == 'mp4' || $FileNameArray['extension'] == 'mov' || $FileNameArray['extension'] == 'dat') {
                 $this->mpeg2Mp4('upload/' . $val['name'], $FileNameArray['filename']);
             }
             if ($arrSize[0] != '') {
                 foreach ($arrSize as $tmpSize) {
                     $thName = str_replace(":", "_", $tmpSize);
                     $tmpArr = explode(':', $tmpSize);
                     $strFileName = $strDirectory . $thName . $val['name'];
                 }
             }
             if ($id > 0) {
                 $flag = "flag='" . $val['name'] . "',";
             } else {
                 $flag = $val['name'];
             }
         }
         if ($_FILES['db_ragion_map']['name'] != "") {
             $val = $_FILES['db_ragion_map'];
             $strDirectory = SITE_UPLOADPATH;
             @chmod($strDirectory, 0777);
             $val['name'] = mktime() . removeSpace($val['name']);
             move_uploaded_file($val['tmp_name'], $strDirectory . $val['name']);
             @chmod($strDirectory . $val['name'], 0644);
             $FileNameArray = pathinfo('upload/' . $val['name']);
             if ($FileNameArray['extension'] == 'mp4' || $FileNameArray['extension'] == 'mov' || $FileNameArray['extension'] == 'dat') {
                 $this->mpeg2Mp4('upload/' . $val['name'], $FileNameArray['filename']);
             }
             if ($arrSize[0] != '') {
                 foreach ($arrSize as $tmpSize) {
                     $thName = str_replace(":", "_", $tmpSize);
                     $tmpArr = explode(':', $tmpSize);
                     $strFileName = $strDirectory . $thName . $val['name'];
                     //$this->objThumb->create_thumbnail($strDirectory.$val['name'], $strFileName,$tmpArr[0],$tmpArr[1]);
                 }
             }
             if ($id > 0) {
                 $ragion_map = "ragion_map='" . $val['name'] . "',";
             } else {
                 $ragion_map = $val['name'];
             }
         }
         if ($id == 0) {
             $sqlstr = "Insert into tbl_regions (region_name, region_title, independenceday, description, flag, flag_desc, population, image, cover_image, longitude, latitude, ragion_map, status) values('" . StriptStr($Data['region_name']) . "','" . StriptStr($Data['region_title']) . "',\n\t\t\t\t\t'" . StriptStr($Data['independenceday']) . "','" . StriptStr($Data['description']) . "','" . StriptStr($flag) . "','" . StriptStr($Data['flag_desc']) . "','" . StriptStr($Data['population']) . "','" . StriptStr($Data['image']) . "','" . StriptStr($Data['cover_image']) . "','" . StriptStr($Data['longitude']) . "','" . StriptStr($Data['latitude']) . "','" . $ragion_map . "','1')";
         } else {
             $sqlstr = "update tbl_regions set  \n\t\t\t\t\tregion_name='" . StriptStr($Data['region_title']) . "', \n\t\t\t\t\tregion_title='" . StriptStr($Data['region_title']) . "', \n\t\t\t\t\tindependenceday='" . StriptStr($Data['region_title']) . "', \n\t\t\t\t\tdescription='" . StriptStr($Data['region_title']) . "', \n\t\t\t\t\t" . $flag . " flag_desc='" . StriptStr($Data['region_title']) . "', \n\t\t\t\t\tpopulation='" . StriptStr($Data['region_title']) . "', \n\t\t\t\t\timage='" . StriptStr($Data['region_title']) . "', \n\t\t\t\t\tcover_image='" . StriptStr($Data['region_title']) . "', \n\t\t\t\t\tlongitude='" . StriptStr($Data['region_title']) . "', \n\t\t\t\t\tlatitude='" . StriptStr($Data['region_title']) . "', \n\t\t\t\t\t" . $ragion_map . " status='" . $Data['status'] . "' where id=" . $id;
         }
         $this->db->query($sqlstr);
         return "ins";
     } else {
         return 0;
     }
 }