From 9d1e622f2e1f0be0cfa8d74c949b5c0c5ddc512f Mon Sep 17 00:00:00 2001 From: jhangirn <[jahangirmaqsood.jm@gmail.com]> Date: Wed, 20 Jan 2021 10:05:23 +0500 Subject: [PATCH 1/3] in php file line 3216 to 3832 are updated, /views/templates/header_iframe.php Line #5- Variable defined in lower_snake_case,/views/templates/header.php Line #66- Variable defined in lower_snake_case --- application/controllers/form.php | 151 +++++++++++++----- application/views/templates/header.php | 20 +-- application/views/templates/header_iframe.php | 2 +- 3 files changed, 121 insertions(+), 52 deletions(-) diff --git a/application/controllers/form.php b/application/controllers/form.php index 689e42a..2745ee3 100644 --- a/application/controllers/form.php +++ b/application/controllers/form.php @@ -3211,7 +3211,8 @@ public function mapviewframe($slug) { * @access Inline * @author UbaidUllah Balti */ - private function getMapHtmlInfo($locations = array(), $headings = array(), $filter_attribute) { + private function getMapHtmlInfo($locations = array(), + $headings = array(), $filter_attribute) { if (isset($locations[0]['form_id'])) { $form_id = $locations[0]['form_id']; } else { @@ -3233,16 +3234,20 @@ private function getMapHtmlInfo($locations = array(), $headings = array(), $filt foreach ($locations as $form_item) { if (isset($form_item[$filter_attribute_value])) { - $category_name = (!empty($form_item[$filter_attribute_value])) ? $form_item[$filter_attribute_value] : "No " . ucfirst($filter_attribute_value); + $category_name = + (!empty($form_item[$filter_attribute_value])) ? $form_item[$filter_attribute_value] : + "No " . ucfirst($filter_attribute_value); $category_name = preg_replace('/[^a-zA-Z0-9_ \[\]\.\-]/s', '', $category_name); - if (isset($form_item[$filter_attribute_value]) && !empty($form_item[$filter_attribute_value])) { + if (isset($form_item[$filter_attribute_value]) && + !empty($form_item[$filter_attribute_value])) { if (!in_array($form_item[$filter_attribute_value], $only_once_category)) { $column_number++; $only_once_category[] = $form_item[$filter_attribute_value]; } $valueforarray = $form_item[$filter_attribute_value]; $valueforarray1 = str_replace(' ', '_', $valueforarray); - if (isset($map_saved_pins[$filter_attribute_value][$valueforarray1]) && $map_saved_pins[$filter_attribute_value][$valueforarray1] != '') { + if (isset($map_saved_pins[$filter_attribute_value][$valueforarray1]) && + $map_saved_pins[$filter_attribute_value][$valueforarray1] != '') { $pin_name = $map_saved_pins[$filter_attribute_value][$valueforarray1]; } else if (!in_array($valueforarray, $filter_exist_array)) { @@ -3258,7 +3263,8 @@ private function getMapHtmlInfo($locations = array(), $headings = array(), $filt $exist_alpha[$first_char] = '1'; $pin_name = $first_char . '1.png'; } - $pin_exist_for_cat = array_merge($pin_exist_for_cat, array($valueforarray => $pin_name)); + $pin_exist_for_cat = array_merge($pin_exist_for_cat, array($valueforarray + => $pin_name)); } else { if (array_key_exists($valueforarray, $pin_exist_for_cat)) { @@ -3288,24 +3294,43 @@ private function getMapHtmlInfo($locations = array(), $headings = array(), $filt //$info_window .= $headings[$i]."=>"; if ($headings[$i] == 'is_take_picture') {} else if ($headings[$i] == 'id') { - $query_img = "select image from zform_images where form_id='".$form_id."' AND zform_result_id ='".$form_item[$headings[$i]]."'"; + $query_img = "select image from zform_images where form_id='".$form_id." + ' AND zform_result_id ='".$form_item[$headings[$i]]."'"; $image_info = $this->db->query($query_img)->result_array(); if(!empty($image_info)){ $path = get_image_path($image_info[0]['image']); - $image_row .= "By ITU Government of Punjab - Pakistan'>"; + $image_row .= "By ITU Government of Punjab - Pakistan'>"; } } else if ($headings[$i] == 'image') { $path = get_image_path($form_item[$headings[$i]][0]['image']); - $image_row .= "By ITU Government of Punjab - Pakistan'>"; + $image_row .= "By ITU Government of Punjab - Pakistan'>"; } else if ($headings[$i] == 'created_datetime') { - $datetime_row .='DATE : ' . date('Y-m-d', strtotime($form_item[$headings[$i]])) . 'TIME : ' . date('H:i:s', strtotime($form_item[$headings[$i]])) . ''; + $datetime_row .='DATE : ' . date('Y-m-d', + strtotime($form_item[$headings[$i]])) . ' + TIME : ' . date('H:i:s', + strtotime($form_item[$headings[$i]])) . ''; } else { - $map_data .= preg_replace('/[^a-zA-Z0-9_ \[\]\.\-]/s', '', $headings[$i]) . ' : ' . preg_replace('/[^a-zA-Z0-9_ \[\]\.\-]/s', '', $form_item[$headings[$i]]) . '
\n'; + $map_data .= preg_replace('/[^a-zA-Z0-9_ \[\]\.\-]/s', '', + $headings[$i]) . ' : ' . preg_replace('/[^a-zA-Z0-9_ \[\]\.\-]/s', '', + $form_item[$headings[$i]]) . '
\n'; if($form_id == 551){ - $array_col = array('BUILDING NAME','NAME OF DIVISION','NAME OF MCS','BUILDING TYPE','ACTIVITY DATETIME'); - if(in_array(preg_replace("/[^A-Za-z0-9\-]/", " ", strtoupper(urldecode($headings[$i]))),$array_col)) - $data_row .= "" . preg_replace("/[^A-Za-z0-9\-]/", " ", strtoupper(urldecode($headings[$i]))) . " : " . preg_replace('/[^a-zA-Z0-9_ \[\]\.\-]/s', '', strtoupper($form_item[$headings[$i]])) . ""; + $array_col = array('BUILDING NAME', + 'NAME OF DIVISION','NAME OF MCS','BUILDING TYPE','ACTIVITY DATETIME'); + if(in_array(preg_replace("/[^A-Za-z0-9\-]/", " ", + strtoupper(urldecode($headings[$i]))),$array_col)) + $data_row .= "" . preg_replace(" + /[^A-Za-z0-9\-]/", " ", strtoupper(urldecode($headings[$i]))) . " + : " . preg_replace('/[^a-zA-Z0-9_ \[\]\.\-]/s', '', + strtoupper($form_item[$headings[$i]])) . ""; } $id = $form_item['id']; } @@ -3313,7 +3338,9 @@ private function getMapHtmlInfo($locations = array(), $headings = array(), $filt } $info_window = "".$image_row.$data_row."
"; $marker_date = $form_item['created_datetime']; - $final .='["' . $location[0] . '","' . $location[1] . '","' . $form_id . '","' . $icon_filename . '","' . $id . '","' . $category_name . '","' . $marker_date . '","'.$info_window.'"] ,'; + $final .='["' . $location[0] . '","' . $location[1] . '","' . $form_id . ' + ","' . $icon_filename . '","' . $id . '","' . $category_name . '","' . $marker_date . ' + ","'.$info_window.'"] ,'; } } @@ -3336,13 +3363,17 @@ private function getMapHtmlInfo($locations = array(), $headings = array(), $filt * @access Inline * @author UbaidUllah Balti */ - private function getMapHtmlInfoSingle($locations = array(), $headings = array(), $filter_attribute) { + private function getMapHtmlInfoSingle($locations = array(), + $headings = array(), $filter_attribute) { $final = ''; if (count($locations)) { foreach ($filter_attribute as $filter_attribute_value) { foreach ($locations as $form_item) { - $category_name = (!empty($form_item[$filter_attribute_value])) ? $form_item[$filter_attribute_value] : str_replace('_', " ", ucfirst($filter_attribute_value)); - $pin_name = (!empty($form_item[$filter_attribute_value])) ? substr($form_item[$filter_attribute_value], 0, 1) . '1' : "all_visit"; + $category_name = + (!empty($form_item[$filter_attribute_value])) ? $form_item[$filter_attribute_value] : + str_replace('_', " ", ucfirst($filter_attribute_value)); + $pin_name = (!empty($form_item[$filter_attribute_value])) ? + substr($form_item[$filter_attribute_value], 0, 1) . '1' : "all_visit"; if (!file_exists(FCPATH . "assets/images/map_pins/" . $pin_name)) { $icon_filename = base_url() . "assets/images/map_pins/default_pin.png"; } else { @@ -3363,19 +3394,33 @@ private function getMapHtmlInfoSingle($locations = array(), $headings = array(), } else if ($headings[$i] == 'image') { $path = $form_item[$headings[$i]][0]['image']; - $image_row = "By ITU Government of Punjab - Pakistan'>"; + $image_row = "By ITU Government of Punjab - Pakistan'>"; } else if ($headings[$i] == 'created_datetime') { - $datetime_row .='DATE : ' . date('Y-m-d', strtotime($form_item[$headings[$i]])) . 'TIME : ' . date('H:i:s', strtotime($form_item[$headings[$i]])) . ''; + $datetime_row .='DATE : ' . date('Y-m-d', + strtotime($form_item[$headings[$i]])) . ' + TIME : ' . date(' + H:i:s', strtotime($form_item[$headings[$i]])) . ''; } else { - $map_data .= preg_replace('/[^a-zA-Z0-9_ \[\]\.\-]/s', '', $headings[$i]) . ' : ' . preg_replace('/[^a-zA-Z0-9_ \[\]\.\-]/s', '', $form_item[$headings[$i]]) . '
\n'; - $data_row .= "" . preg_replace("/[^A-Za-z0-9\-]/", " ", strtoupper(urldecode($headings[$i]))) . " : " . preg_replace('/[^a-zA-Z0-9_ \[\]\.\-]/s', '', strtoupper($form_item[$headings[$i]])) . ""; + $map_data .= preg_replace('/[^a-zA-Z0-9_ \[\]\.\-]/s', + '', $headings[$i]) . ' : ' . preg_replace('/[^a-zA-Z0-9_ \[\]\.\-]/s', + '', $form_item[$headings[$i]]) . '
\n'; + $data_row .= "" . preg_replace("/[^A-Za-z0-9\-]/", " ", + strtoupper(urldecode($headings[$i]))) . " + : " . preg_replace('/[^a-zA-Z0-9_ \[\]\.\-]/s', + '', strtoupper($form_item[$headings[$i]])) . ""; $id = $form_item['id']; } } } $html_layout = $html_layout . $image_row . $data_row . $datetime_row; $html_layout .= ""; - $final .='["' . $location[0] . '","' . $location[1] . '","' . $html_layout . '","' . $icon_filename . '","' . $id . '","' . $category_name . '"] ,'; + $final .='["' . $location[0] . '","' . $location[1] . ' + ","' . $html_layout . '","' . $icon_filename . '","' . $id . ' + ","' . $category_name . '"] ,'; } } $final = substr($final, 0, -1); @@ -3408,13 +3453,15 @@ public function update($slug) { $request_app = $this->app_model->get_app($app_id); $app_general_setting = get_app_general_settings($app_id); $upgrade_from_google_play = 0; - if (isset($app_general_setting->upgrade_from_google_play) && $app_general_setting->upgrade_from_google_play == 1) { + if (isset($app_general_setting->upgrade_from_google_play) + && $app_general_setting->upgrade_from_google_play == 1) { $upgrade_from_google_play = 1; } $data['upgrade_from_google_play'] = $upgrade_from_google_play; $location_required = 1; - if (isset($app_general_setting->location_required) && $app_general_setting->location_required == 0) { + if (isset($app_general_setting->location_required) + && $app_general_setting->location_required == 0) { $location_required = 0; } $data['location_required'] = $location_required; @@ -3423,7 +3470,9 @@ public function update($slug) { if (!$this->acl->hasSuperAdmin()) { $login_data = $this->session->userdata('logged_in'); if ($request_app['department_id'] != $login_data['login_department_id']) { - $this->session->set_flashdata('validate', array('message' => "You don't have enough permissions to do this task.", 'type' => 'warning')); + $this->session->set_flashdata('validate', + array('message' => "You don't have enough permissions to do this task.", + 'type' => 'warning')); redirect(base_url() . 'apps'); } if ($request_app['user_id'] == $login_data['login_user_id']) { @@ -3489,7 +3538,8 @@ public function update($slug) { $data['post_url'] = $selected_form['post_url']; } if ($history_id) { - $history_rec = $this->form_model->get_form_history($form_id, $view_id, $history_id); + $history_rec = $this->form_model->get_form_history($form_id, + $view_id, $history_id); $data['description'] = $history_rec['description']; } $app = $this->app_model->get_app($app_id); @@ -3502,13 +3552,16 @@ public function update($slug) { $data['view_id'] = $view_id; $app_id = $selected_form['app_id']; if (!$this->acl->hasPermission('form', 'edit')) { - $this->session->set_flashdata('validate', array('message' => "You don't have enough permissions to do this task.", 'type' => 'warning')); + $this->session->set_flashdata('validate', array('message' => " + You don't have enough permissions to do this task.", + 'type' => 'warning')); redirect(base_url() . 'apps'); } $session_data = $this->session->userdata('logged_in'); session_to_page($session_data, $data); $data['active_tab'] = 'form_update'; - $data['pageTitle'] = $app['name'] . '-' . $selected_form['name'] . ' Edit-' . PLATFORM_NAME; + $data['pageTitle'] = $app['name'] . '-' . $selected_form['name'] . ' + Edit-' . PLATFORM_NAME; $this->load->view('templates/form_builder_header', $data); $this->load->view('form/update', $data); $this->load->view('templates/footer', $data); @@ -3614,7 +3667,8 @@ public function add($slug) { $data['app_id'] = $app_id; $data['app_name'] = $app['name']; if (!$this->acl->hasPermission('form', 'add')) { - $this->session->set_flashdata('validate', array('message' => "You don't have enough permissions to do this task.", 'type' => 'warning')); + $this->session->set_flashdata('validate', array('message' + => "You don't have enough permissions to do this task.", 'type' => 'warning')); redirect(base_url() . 'apps'); } $session_data = $this->session->userdata('logged_in'); @@ -3639,7 +3693,8 @@ public function add($slug) { $form_id = $this->db->insert_id(); updateDataBase($form_id, ""); //array parameters : action, description, before, after, app_id, app_name, form_id, form_name - $logary = array('action' => 'insert', 'description' => 'add new form', 'after' => json_encode($data)); + $logary = array('action' => 'insert', 'description' => 'add new form', 'after' + => json_encode($data)); addlog($logary); //Get last inserted form id $forms_by_app = $this->form_model->get_form_by_app($app_id); @@ -3663,7 +3718,10 @@ public function add($slug) { if (!$this->upload->do_upload('userfile_addform')) { $this->data['error'] = $this->upload->display_errors(); - $this->session->set_flashdata('validate', array('message' => $this->upload->display_errors() . ', Default icon has been embeded with your application.', 'type' => 'warning')); + $this->session->set_flashdata('validate', array('message' + => $this->upload + ->display_errors() . ', Default icon has been embeded with your application.', + 'type' => 'warning')); } else { //success $imageData = $this->upload->data(); @@ -3694,7 +3752,8 @@ public function add($slug) { ); $this->db->where('id', $form_id); $this->db->update('form', $change_next); - $this->session->set_flashdata('validate', array('message' => 'New form added successfully.', 'type' => 'success')); + $this->session->set_flashdata('validate', + array('message' => 'New form added successfully.', 'type' => 'success')); redirect(base_url() . 'app-form/' . $form_id); } @@ -3733,7 +3792,8 @@ public function movetoview($slug) { if($this->input->post()){ $form_id = $slug;//form_id which want to move to view - $view_id = $this->input->post('view_id');//view_id where want to move the selected form + $view_id = $this->input->post('view_id'); + //view_id where want to move the selected form $selected_form = $this->form_model->get_form($form_id,$view_id); $app_id = $selected_form['app_id']; $view_id_session = 0; @@ -3758,7 +3818,8 @@ public function movetoview($slug) { 'post_url' => $selected_form['post_url'] ); //file_write() - file_write($abs_path.'/'.$view_id.'_'.$file_name_html,$selected_form['full_description']); + file_write($abs_path.'/'.$view_id.' + _'.$file_name_html,$selected_form['full_description']); } else{ @@ -3771,7 +3832,8 @@ public function movetoview($slug) { 'full_description' => $selected_view_form['fv_full_description'], 'post_url' => $selected_view_form['fv_post_url'] ); - file_write($abs_path.'/'.$view_id.'_'.$file_name_html,$selected_view_form['fv_full_description']); + file_write($abs_path.'/'.$view_id.' + _'.$file_name_html,$selected_view_form['fv_full_description']); } @@ -3783,7 +3845,8 @@ public function movetoview($slug) { $this->db->insert('form_views', $form_move_data); } - $this->session->set_flashdata('validate', array('message' => 'Active form copied to your required view successfully', 'type' => 'success')); + $this->session->set_flashdata('validate', array('message' + => 'Active form copied to your required view successfully', 'type' => 'success')); redirect(base_url() . 'app-form/' . $form_id); } } else { @@ -3800,7 +3863,8 @@ public function copy($slug) { if ($this->session->userdata('logged_in')) { if($this->input->post()){ $form_id = $slug;//form_id which want to copy - $app_id = $this->input->post('app_id_popup');//app_id where want to copy the selected form + $app_id = $this->input->post('app_id_popup'); + //app_id where want to copy the selected form @@ -3829,14 +3893,17 @@ public function copy($slug) { ); $this->db->insert('form', $data); $form_id_new = $this->db->insert_id(); - $old_file = './assets/images/data/form_icons/' . $selected_form['app_id'] . '/formicon_' . $slug . '.png'; - $new_file = './assets/images/data/form_icons/' . $app_id . '/formicon_' . $form_id_new . '.png'; + $old_file = './assets/images/data/form_icons/' . $selected_form['app_id'] . ' + /formicon_' . $slug . '.png'; + $new_file = './assets/images/data/form_icons/' . $app_id . ' + /formicon_' . $form_id_new . '.png'; $old = umask(0); @mkdir('./assets/images/data/form_icons/' . $app_id, 0777); umask($old); copy($old_file, $new_file); //array parameters : action, description, before, after, app_id, app_name, form_id, form_name - $logary = array('action' => 'insert', 'description' => 'copy and add new form', 'after' => json_encode($data)); + $logary = array('action' => 'insert', 'description' + => 'copy and add new form', 'after' => json_encode($data)); addlog($logary); $file_name_html = "form_$form_id_new.html"; $change_next = array( @@ -3849,7 +3916,9 @@ public function copy($slug) { updateDataBase($form_id_new, $selected_form['description']); $abs_path = './assets/images/data/form_icons/' . $app_id; file_write($abs_path.'/'.$file_name_html, $selected_form['full_description']); - $this->session->set_flashdata('validate', array('message' => 'Form Copied successfully. Please click on save button for saving configuration', 'type' => 'success')); + $this->session->set_flashdata('validate', array('message' + => 'Form Copied successfully. Please click on save button for saving configuration', + 'type' => 'success')); redirect(base_url() . 'app-form/' . $form_id_new); } } else { diff --git a/application/views/templates/header.php b/application/views/templates/header.php index d65242f..f277f71 100644 --- a/application/views/templates/header.php +++ b/application/views/templates/header.php @@ -61,12 +61,12 @@