예제 #1
0
 public function index()
 {
     try {
         // If a logged in user type the login url then redirect him to the dashboard page.
         $login_status = $this->session->userdata("admin_loggedin");
         if (!empty($login_status)) {
             redirect(admin_base_url() . "dashboard/");
         }
         //Posted login form//
         if ($_POST) {
             $posted = array();
             $posted["txt_user_name"] = trim($this->input->post("txt_user_name"));
             $posted["txt_password"] = trim($this->input->post("txt_password"));
             $chk_remember = $this->input->post("chk_remember");
             $this->form_validation->set_rules('txt_user_name', 'user name', 'required');
             $this->form_validation->set_rules('txt_password', 'password', 'required');
             if ($this->form_validation->run() == FALSE) {
                 //Display the add form with posted values within it//
                 $this->data["posted"] = $posted;
             } else {
                 $this->load->model("User_login", "mod_ul");
                 $info = array();
                 $info["s_user_name"] = $posted["txt_user_name"];
                 $info["s_password"] = $posted["txt_password"];
                 // $loggedin=$this->mod_ul->login($info);
                 $loggedin = $this->mod_ul->backend_user_login($info);
                 if (!empty($loggedin)) {
                     $mix_data = $this->session->userdata('admin_loggedin');
                     if ($chk_remember) {
                         setcookie('acs_login_username', $info["s_user_name"], time() + 60 * 60 * 24 * 365, '/', '', '');
                         setcookie('acs_login_password', $info["s_password"], time() + 60 * 60 * 24 * 365, '/', '', '');
                     } else {
                         setcookie('acs_login_username', '', time() + 60 * 60 * 24 * 365, '/', '', '');
                         setcookie('acs_login_password', '', time() + 60 * 60 * 24 * 365, '/', '', '');
                     }
                     if (decrypt($mix_data['user_type']) != 0) {
                         set_success_msg(addslashes(t('Thanks for login ! Please change your current password')));
                     }
                     redirect(admin_base_url() . "dashboard/");
                 } else {
                     set_error_msg($this->cls_msg["invalid_login"]);
                     $this->data["posted"] = $posted;
                 }
             }
         }
         //end Posted login form//
         unset($loggedin);
         $this->render("index", true);
     } catch (Exception $err_obj) {
         show_error($err_obj->getMessage());
     }
 }
예제 #2
0
 public function remove_information($i_id = 0)
 {
     try {
         $i_ret_ = 0;
         /*don't change*/
         $pageno = $this->input->post("h_pageno");
         ///the pagination page no, to return at the same page/*don't change*/
         /////Deleting What?//////
         $s_del_these = $this->input->post("h_list");
         switch ($s_del_these) {
             case "all":
                 $i_ret_ = $this->obj_mod->delete_info(-1);
                 break;
             default:
                 ///Deleting selected,page ///
                 //////First consider the posted ids, if found then take $i_id value////
                 $id = !$i_id ? $this->input->post("chk_del") : $i_id;
                 ///may be an array of IDs or single id
                 if (is_array($id) && !empty($id)) {
                     ///////////Deleting Information///////
                     $tot = count($id) - 1;
                     while ($tot >= 0) {
                         $i_ret_ = $this->obj_mod->delete_info(decrypt($id[$tot]));
                         $tot--;
                     }
                 } elseif ($id > 0) {
                     $i_ret_ = $this->obj_mod->delete_info(decrypt($id));
                 }
                 break;
         }
         unset($s_del_these, $id, $tot);
         if ($i_ret_) {
             set_success_msg($this->cls_msg["delete_succ"]);
         } else {
             set_error_msg($this->cls_msg["delete_err"]);
         }
         redirect($this->pathtoclass . "show_list" . ($pageno ? "/" . $pageno : ""));
     } catch (Exception $err_obj) {
         show_error($err_obj->getMessage());
     }
 }
예제 #3
0
 public function modify_information($i_id = 0)
 {
     $this->data['heading'] = t("Edit Information");
     $this->data['pathtoclass'] = $this->pathtoclass;
     $this->data['BREADCRUMB'] = array(addslashes(t('Edit Information')));
     $this->data['mode'] = 'edit';
     if ($_POST) {
         $posted = array();
         $posted["s_category"] = $this->input->post("s_category", true);
         $posted["s_category_description"] = $this->input->post("s_category_description", true);
         if (isset($_FILES['s_image']) && !empty($_FILES['s_image']['name'])) {
             $s_uploaded = get_file_uploaded(FCPATH . 'uploaded/category/', 's_image', '', '', 'jpeg|jpg|png|doc|docx|csv|xls|xlsx|pdf|txt');
             $arr_upload = explode('|', $s_uploaded);
         }
         if ($arr_upload[0] == 'ok') {
             $posted["s_image"] = $arr_upload[2];
         }
         $posted["s_date"] = $this->input->post("s_date", true);
         $posted["h_id"] = $this->input->post("h_id", true);
         $this->form_validation->set_rules('s_category', addslashes(t('category')), 'required|xss_clean');
         if ($this->form_validation->run() == FALSE) {
             /*if($arr_upload[0]==='err')
                   set_error_msg($arr_upload[2]);
               else
                   get_file_deleted($this->uploaddir,$arr_upload[2]);
               */
             //Display the add form with posted values within it//
             $this->data["posted"] = $posted;
         } else {
             $i_id = decrypt($posted["h_id"]);
             unset($posted["h_id"]);
             $i_aff = $this->acs_model->edit_data($this->tbl, $posted, array('i_id' => $i_id));
             if ($i_aff) {
                 /*
                 if($arr_upload[0]==='ok')
                 {
                     get_image_thumb($this->uploaddir.$posted["s_image"], $this->thumbdir, 'thumb_'.$posted["s_image"],$this->thumbHt,$this->thumbWd);
                 }
                 */
                 set_success_msg($this->cls_msg["save_succ"]);
                 redirect($this->pathtoclass . "show_list");
             } else {
                 set_error_msg($this->cls_msg["save_err"]);
             }
         }
     } else {
         // Fetch all the data
         $tmp = $this->acs_model->fetch_data($this->tbl, array('i_id' => decrypt($i_id)));
         $posted = $tmp[0];
         $posted['h_id'] = $i_id;
         $this->data['posted'] = $posted;
         $posted['h_mode'] = $this->data['mode'];
     }
     $this->render("category/add-edit");
 }
예제 #4
0
 public function modify_information($i_id = 0)
 {
     $this->data['heading'] = t("Edit Information");
     $this->data['pathtoclass'] = $this->pathtoclass;
     $this->data['BREADCRUMB'] = array(addslashes(t('Edit Information')));
     $this->data['mode'] = 'edit';
     if ($_POST) {
         $posted = array();
         $posted["s_name"] = $this->input->post("s_name", true);
         $posted["i_role"] = $this->input->post("i_role", true);
         $posted["i_status"] = $this->input->post("i_status", true);
         $posted["h_id"] = $this->input->post("h_id", true);
         $i_id = decrypt($posted["h_id"]);
         unset($posted["h_id"]);
         $i_aff = $this->acs_model->edit_data($this->tbl, $posted, array('i_id' => $i_id));
         if ($i_aff) {
             /*
             if($arr_upload[0]==='ok')
             {
                 get_image_thumb($this->uploaddir.$posted["s_image"], $this->thumbdir, 'thumb_'.$posted["s_image"],$this->thumbHt,$this->thumbWd);
             }
             */
             set_success_msg($this->cls_msg["save_succ"]);
             redirect($this->pathtoclass . "show_list");
         } else {
             set_error_msg($this->cls_msg["save_err"]);
         }
     } else {
         // Fetch all the data
         $tmp = $this->acs_model->fetch_data($this->tbl, array('i_id' => decrypt($i_id)));
         $posted = $tmp[0];
         $posted['h_id'] = $i_id;
         $this->data['posted'] = $posted;
         $posted['h_mode'] = $this->data['mode'];
     }
     $this->render("demo/add-edit");
 }
예제 #5
0
 public function menu_permission($enc_menu_id = '')
 {
     //echo 'politique de confidentialité';
     try {
         $this->data['title'] = "Menu setting";
         //Browser Title
         $this->data['heading'] = "Menu Permission";
         $this->data['pathtoclass'] = $this->pathtoclass;
         $this->data['mode'] = "add";
         $i_menu_id = decrypt($enc_menu_id);
         //Submitted Form//
         if ($_POST) {
             $posted = array();
             $posted['txt_action'] = $this->input->post('txt_action');
             $posted['txt_link'] = $this->input->post('txt_link');
             $posted['h_id'] = $this->input->post('h_id');
             $posted['txt_extra_action'] = $this->input->post('txt_extra_action');
             $data = array();
             $s_actions = '';
             if (!empty($posted['txt_action'])) {
                 foreach ($posted['txt_action'] as $key => $val) {
                     if ($val != '') {
                         $s_actions .= $val . '||';
                         $data[$key]['s_action'] = $val;
                         $data[$key]['s_link'] = $posted['txt_link'][$key];
                         $data[$key]['h_id'] = $posted['h_id'][$key];
                     }
                 }
             }
             if (!empty($posted['txt_extra_action'])) {
                 foreach ($posted['txt_extra_action'] as $val) {
                     $s_actions .= $val . '||';
                 }
             }
             $s_actions = rtrim($s_actions, '|');
             //pr($data,1);
             // Edit menu table set all action like Add ||  Edit || Status
             $this->mod_menu->edit_info(array('s_action_permit' => $s_actions), $i_menu_id);
             $info = array();
             if (!empty($data)) {
                 $info['i_menu_id'] = $i_menu_id;
                 $info['i_user_type'] = 0;
                 foreach ($data as $val) {
                     $info['s_action'] = $val['s_action'];
                     $info['s_link'] = $val['s_link'];
                     if ($val['h_id'] == -1) {
                         $i_aff = $this->mod_menu->add_menu_permit($info);
                     } else {
                         $i_aff = $this->mod_menu->edit_menu_permit($info, $val['h_id']);
                     }
                 }
             }
             if ($i_aff) {
                 //saved successfully
                 set_success_msg($this->cls_msg["save_succ_permit"]);
                 redirect($this->pathtoclass . "menu_permission/" . $enc_menu_id);
             } else {
                 //Not saved, show the form again
                 set_error_msg($this->cls_msg["save_err_permit"]);
             }
         } else {
             $s_where = " WHERE i_menu_id=" . decrypt($enc_menu_id) . " AND (i_user_type=0 OR i_user_type=-99)";
             $info = $this->mod_menu->fetch_menu_permission($s_where);
             $actions = array();
             $temp_action = array();
             if (!empty($info)) {
                 foreach ($info as $key => $val) {
                     $temp_action[] = $val['s_action'];
                     $actions[$key]['txt_action'] = $val['s_action'];
                     $actions[$key]['txt_link'] = $val['s_link'];
                     $actions[$key]['h_id'] = $val['id'];
                 }
             }
             $this->data['actions'] = json_encode($actions);
             $info_menu = $this->mod_menu->fetch_this($i_menu_id);
             $all_action = explode('||', $info_menu['s_action_permit']);
             $this->data['extra_action'] = array_diff($all_action, $temp_action);
             unset($all_action, $temp_action, $info_menu, $actions);
             $s_where = " WHERE i_id=" . decrypt($enc_menu_id) . " ";
             $info_menu = $this->mod_menu->fetch_sub_menu($s_where);
             if (!empty($info_menu) && count($info_menu) == 1) {
                 preg_match('~^(.*\\/).*~', $info_menu[0]['s_link'], $matches);
                 $this->data['controler_link'] = $matches[1];
             }
         }
         $this->data['i_menu_id'] = decrypt($enc_menu_id);
         $this->data['BREADCRUMB'] = array(addslashes('Menu Permission'));
         /* $this->data['arr_status'] =   array(0=>'Keep',1=>'Add'); */
         $this->data['posted'] = $posted;
         //end Submitted Form//
         $this->render("menu_setting/menu_permission");
     } catch (Exception $err_obj) {
         show_error($err_obj->getMessage());
     }
 }
예제 #6
0
 public function account_information($i_id)
 {
     try {
         $this->data['title'] = addslashes(t("Edit Account Details"));
         $this->data['heading'] = addslashes(t("Edit Account"));
         $this->data['pathtoclass'] = $this->pathtoclass;
         $loggedin = $this->session->userdata('admin_loggedin');
         // check if the user only can edit his information or super admin can do it
         redirect($this->pathtoclass);
         $arr_where = array('i_id' => decrypt($i_id));
         ////////////Submitted Form///////////
         if ($_POST) {
             $posted = array();
             $posted["s_first_name"] = trim($this->input->post("s_first_name"));
             $posted["s_last_name"] = trim($this->input->post("s_last_name"));
             $posted["s_email"] = trim($this->input->post("s_email"));
             $posted["s_address"] = trim($this->input->post("s_address"));
             $posted["s_contact_number"] = trim($this->input->post("s_contact_number"));
             $this->form_validation->set_rules('s_first_name', addslashes(t('first name')), 'required');
             $this->form_validation->set_rules('s_last_name', addslashes(t('last name')), 'required');
             $this->form_validation->set_rules('s_email', addslashes(t('Email')), 'required');
             if ($this->form_validation->run() == FALSE) {
                 ////////Display the add form with posted values within it////
                 $this->data["posted"] = $posted;
             } else {
                 $info = array();
                 $info["s_first_name"] = $posted["s_first_name"];
                 $info["s_last_name"] = $posted["s_last_name"];
                 $info["s_email"] = $posted["s_email"];
                 $info["s_address"] = $posted["s_address"];
                 $info["s_contact_number"] = $posted["s_contact_number"];
                 //print_r($info); exit;
                 //$i_aff=$this->mod_rect->edit_info($info,decrypt($posted["h_id"]));
                 $user_table = $this->db->USER;
                 $arr_where = array('i_id' => decrypt($posted["h_id"]));
                 $i_aff = $this->mod_common->common_edit_info($user_table, $info, $arr_where);
                 if ($i_aff) {
                     set_success_msg($this->cls_msg["save_succ"]);
                     redirect($this->pathtoclass . "account_information/" . $i_id);
                 } else {
                     $this->data["posted"] = $posted;
                     set_error_msg($this->cls_msg["save_err"]);
                 }
                 unset($info, $posted, $i_aff);
             }
         } else {
             $info = $this->user_model->fetch_this(decrypt($i_id));
             $posted = array();
             //$posted["txt_country"]  = trim($info["s_country"]);
             $posted = $info;
             $posted["h_id"] = $i_id;
             $posted["i_id"] = decrypt($i_id);
             $this->data["posted"] = $posted;
             unset($info, $posted);
         }
         ////////////end Submitted Form///////////
         $this->render("my_account/account-edit");
     } catch (Exception $err_obj) {
         show_error($err_obj->getMessage());
     }
 }
예제 #7
0
 public function modify_information($i_id = 0)
 {
     try {
         $this->data['pathtoclass'] = $this->pathtoclass;
         $this->data['mode'] = "edit";
         $this->data['heading'] = addslashes(t("Admin Site Setting"));
         $this->data['BREADCRUMB'] = array('Site Setting');
         ////////////Submitted Form///////////
         if ($_POST) {
             $posted = array();
             $posted["h_id"] = trim($this->input->post("h_id"));
             $posted["txt_admin_email"] = trim($this->input->post("txt_admin_email"));
             $posted["txt_smtp_host"] = trim($this->input->post("txt_smtp_host"));
             $posted["txt_smtp_password"] = trim($this->input->post("txt_smtp_password"));
             $posted["txt_smtp_userid"] = trim($this->input->post("txt_smtp_userid"));
             $posted["i_records_per_page"] = trim($this->input->post("i_records_per_page"));
             $posted["i_project_posting_approval"] = $this->input->post("i_project_posting_approval");
             $posted["i_banner_speed"] = $this->input->post("i_banner_speed");
             $posted["i_featured_slider_speed"] = $this->input->post("i_featured_slider_speed");
             $posted["i_auto_slide_control"] = $this->input->post("i_auto_slide_control");
             $posted["i_featured_project_auto_slide_control"] = $this->input->post("i_featured_project_auto_slide_control");
             $posted["s_facebook_url"] = trim($this->input->post("s_facebook_url"));
             $posted["s_g_plus_url"] = trim($this->input->post("s_g_plus_url"));
             $posted["s_linked_in_url"] = trim($this->input->post("s_linked_in_url"));
             $posted["s_twitter_url"] = trim($this->input->post("s_twitter_url"));
             $posted["s_rss_feed_url"] = trim($this->input->post("s_rss_feed_url"));
             $this->form_validation->set_rules('txt_admin_email', addslashes(t('admin email')), 'trim|required|valid_email');
             $this->form_validation->set_rules('i_records_per_page', addslashes(t('number of records per page')), 'trim|required');
             /*$this->form_validation->set_rules('txt_smtp_host', 'smtp host', 'required');
                           $this->form_validation->set_rules('txt_smtp_password', 'smtp password', 'required');
             		$this->form_validation->set_rules('txt_smtp_userid', 'smtp user id', 'required');*/
             $info = array();
             if ($this->form_validation->run() == FALSE) {
                 $this->data["posted"] = $posted;
             } else {
                 $info["s_admin_email"] = $posted["txt_admin_email"];
                 /*$info["s_smtp_host"]		=   $posted["txt_smtp_host"];
                   $info["s_smtp_password"]	=   $posted["txt_smtp_password"];
                   $info["s_smtp_userid"]	  =   $posted["txt_smtp_userid"];*/
                 $info["i_records_per_page"] = $posted["i_records_per_page"];
                 $info["i_project_posting_approval"] = $posted["i_project_posting_approval"];
                 $info["i_banner_speed"] = $posted["i_banner_speed"];
                 $info["i_featured_slider_speed"] = $posted["i_featured_slider_speed"];
                 $info["i_auto_slide_control"] = $posted["i_auto_slide_control"];
                 $info["i_featured_project_auto_slide_control"] = $posted["i_featured_project_auto_slide_control"];
                 $info["s_facebook_url"] = $posted["s_facebook_url"];
                 $info["s_g_plus_url"] = $posted["s_g_plus_url"];
                 $info["s_linked_in_url"] = $posted["s_linked_in_url"];
                 $info["s_twitter_url"] = $posted["s_twitter_url"];
                 $info["s_rss_feed_url"] = $posted["s_rss_feed_url"];
                 $i_aff = $this->mod_rect->edit_info($info, decrypt($posted['h_id']));
                 if ($i_aff) {
                     set_success_msg($this->cls_msg["save_succ"]);
                     redirect($this->pathtoclass . "modify_information");
                 } else {
                     $this->data["posted"] = $posted;
                     set_error_msg($this->cls_msg["save_err"]);
                 }
                 unset($info, $posted);
             }
         } else {
             $info = $this->mod_rect->fetch_this("NULL");
             // This method id modified by Jagannath Samanta on 24 June 2011
             $posted = array();
             $posted["i_id"] = $info["i_id"];
             $posted["txt_admin_email"] = $info["s_admin_email"];
             $posted["txt_smtp_host"] = $info["s_smtp_host"];
             $posted["txt_smtp_password"] = $info["s_smtp_password"];
             $posted["txt_smtp_userid"] = $info["s_smtp_userid"];
             $posted["i_records_per_page"] = $info["i_records_per_page"];
             $posted["i_project_posting_approval"] = $info["i_project_posting_approval"];
             $posted["i_banner_speed"] = $info["i_banner_speed"];
             $posted["i_featured_slider_speed"] = $info["i_featured_slider_speed"];
             $posted["i_auto_slide_control"] = $info["i_auto_slide_control"];
             $posted["i_featured_project_auto_slide_control"] = $info["i_featured_project_auto_slide_control"];
             $posted["s_facebook_url"] = $info["s_facebook_url"];
             $posted["s_g_plus_url"] = $info["s_g_plus_url"];
             $posted["s_linked_in_url"] = $info["s_linked_in_url"];
             $posted["s_twitter_url"] = $info["s_twitter_url"];
             $posted["s_rss_feed_url"] = $info["s_rss_feed_url"];
             $posted["h_id"] = trim(encrypt($info["i_id"]));
             $this->data["posted"] = $posted;
             unset($info, $posted);
         }
         $this->render('site_setting/site_setting');
         ////Put the select statement here
     } catch (Exception $err_obj) {
         show_error($err_obj->getMessage());
     }
 }
예제 #8
0
 public function ajax_remove_information()
 {
     try {
         $i_id = decrypt($this->input->post("temp_id"));
         $i_rect = $this->mod_rect->delete_info($i_id);
         /*don't change*/
         if ($i_rect) {
             set_success_msg($this->cls_msg['delete_succ']);
             echo "ok";
         } else {
             set_error_msg($this->cls_msg['delete_err']);
             echo "error";
         }
         unset($info, $i_rect);
     } catch (Exception $err_obj) {
         show_error($err_obj->getMessage());
     }
 }