Example #1
0
 public function copy()
 {
     $rent_no_from = $this->input->post('rent_no_from');
     $rent_from = $this->customer_rent_model->getCustomerRentByRentNo($rent_no_from);
     $rent_no_to = $this->input->post('rent_no_to');
     $rent_to = $this->customer_rent_model->getCustomerRentByRentNo($rent_no_to);
     if ($rent_to) {
         $this->customer_rent_model->copyRule($rent_from['customer_rent_id'], $rent_to['customer_rent_id']);
         output_success();
     } else {
         output_error('填写的合同编号不存在');
     }
 }
 public function delete()
 {
     $file_id = (int) $this->input->get_post('file_ids');
     $file = $this->file_upload_model->getFile($file_id);
     if ($file['import_status'] == 1) {
         output_error('导入成功的文件不能删除');
     }
     $file_dir = './upload/excel/' . date('Ym', strtotime($file['created_at'])) . '/';
     $file_path = FCPATH . $file_dir . $file['file_save_name'];
     $tempName = explode('.', $file['file_save_name']);
     $err_file = FCPATH . $file_dir . $tempName[0] . '_error.csv';
     $this->file_upload_model->delete($file_id);
     if (file_exists($err_file)) {
         unlink($err_file);
     }
     if (file_exists($file_path)) {
         unlink($file_path);
     }
     output_success();
 }
Example #3
0
 public function upload()
 {
     $config['upload_path'] = './upload/excel/' . date('Ym') . '/';
     $config['allowed_types'] = 'xlsx|xls|cvs';
     $config['file_name'] = 'upload_' . date('YmdHis') . rand(0, 9) . rand(0, 9) . rand(0, 9);
     $config['max_size'] = 20480;
     $config['file_ext_tolower'] = TRUE;
     if (!is_dir($config['upload_path'])) {
         mkdir($config['upload_path']);
     }
     $this->load->library('upload', $config);
     if (!$this->upload->do_upload('fileUpload')) {
         $error = array('error' => $this->upload->display_errors());
         print_r($error);
         exit;
     } else {
         $fileInfo = $this->upload->data();
         $fileData = array('file_name' => $fileInfo['client_name'], 'file_save_name' => $fileInfo['file_name'], 'file_size' => $fileInfo['file_size'], 'admin_id' => $this->admin_id);
         $this->file_upload_model->addFile($fileData);
         $this->file_save_path = FCPATH . $config['upload_path'] . $fileData['file_save_name'];
         $data = $this->validateExcel($this->file_save_path);
         if ($data) {
             $num = $this->customer_number_model->importData($data);
             output_success();
         }
     }
     exit;
 }
         if ($db->AutoExecute("community_members", $community, "INSERT")) {
             if ($SKIP_EMAIL_NOTIFICATION) {
                 output_success("[Row " . $row_count . "]\tSuccessfully added username [" . $user["username"] . "] and skipped e-mail notification.");
             } else {
                 do {
                     $hash = generate_hash();
                 } while ($db->GetRow("SELECT `id` FROM `" . AUTH_DATABASE . "`.`password_reset` WHERE `hash` = " . $db->qstr($hash)));
                 if ($db->AutoExecute(AUTH_DATABASE . ".password_reset", array("ip" => "127.0.0.1", "date" => time(), "user_id" => $proxy_id, "hash" => $hash, "complete" => 0), "INSERT")) {
                     $notification_search = array("%firstname%", "%lastname%", "%username%", "%password_reset_url%", "%application_url%", "%application_name%", "%community_name%", "%community_url%");
                     $notification_replace = array(stripslashes($user["firstname"]), stripslashes($user["lastname"]), stripslashes($user["username"]), PASSWORD_RESET_URL . "?hash=" . rawurlencode($proxy_id . ":" . $hash), ENTRADA_URL, APPLICATION_NAME, $community_info["community_title"], COMMUNITY_URL . $community_info["community_url"]);
                     $message = str_ireplace($notification_search, $notification_replace, $NEW_GUEST_NOTIFICATION);
                     if ($SEND_ADMIN_NOTIFICATION) {
                         $user["email"] = $AGENT_CONTACTS["administrator"]["email"];
                     }
                     if (@mail($user["email"], "New User Account: " . APPLICATION_NAME, $message, "From: \"" . $AGENT_CONTACTS["administrator"]["name"] . "\" <" . $AGENT_CONTACTS["administrator"]["email"] . ">\nReply-To: \"" . $AGENT_CONTACTS["administrator"]["name"] . "\" <" . $AGENT_CONTACTS["administrator"]["email"] . ">")) {
                         output_success("[Row " . $row_count . "]\tSuccessfully added username [" . $user["username"] . "] and sent e-mail notification to [" . $user["email"] . "].");
                     } else {
                         output_error("[Row " . $row_count . "]\tAdded username [" . $user["username"] . "] to the database, but could not send e-mail notification to [" . $user["email"] . "].");
                     }
                 } else {
                     output_error("[Row " . $row_count . "]\tAdded username [" . $user["username"] . "] to the database, but could not insert password reset entry into password_reset table. Database said: " . $db->ErrorMsg());
                 }
             }
         } else {
             output_error("[Row " . $row_count . "]\tUnable to insert community_members record for proxy_id [" . $proxy_id . "] and application_id [" . AUTH_APP_ID . "]. Database said: " . $db->ErrorMsg());
         }
     } else {
         output_error("[Row " . $row_count . "]\tUnable to insert user_access record for proxy_id [" . $proxy_id . "] and application_id [" . AUTH_APP_ID . "]. Database said: " . $db->ErrorMsg());
     }
 } else {
     output_error("[Row " . $row_count . "]\tUnable to insert user_data record for staff / student number [" . $user["number"] . "]. Database said: " . $db->ErrorMsg());
/**
 * This function creates a new gallery based on the one being copied.
 *
 * @param ADONewConnection $db
 * @param int $old_community_id
 * @param int $old_gallery_page_id
 * @param int $new_community_id
 * @param int $new_parent_id
 * @param int $proxy_id
 * @return array(int, int) on success and 0 on failure.
 */
function create_gallery($db, $old_community_id, $old_gallery_page_id, $new_community_id, $new_parent_id, $proxy_id)
{
    $query = "\tSELECT *\n\t\t\tFROM " . DATABASE_NAME . ".`community_galleries`\n\t\t\tWHERE `community_id` = " . $old_community_id . "\n\t\t\tAND `cpage_id` = " . $old_gallery_page_id;
    $community_gallery_arr = $db->GetRow($query);
    //echo "\nQUERY: " . $query;
    if ($community_gallery_arr) {
        $time = time();
        $gallery = array();
        $gallery["community_id"] = $new_community_id;
        $gallery["cpage_id"] = $new_parent_id;
        $gallery["gallery_title"] = "Image Gallery";
        $gallery["gallery_description"] = "Image Gallery";
        $gallery["gallery_cgphoto_id"] = 0;
        $gallery["gallery_order"] = $community_gallery_arr["gallery_order"];
        $gallery["gallery_active"] = $community_gallery_arr["gallery_active"];
        $gallery["admin_notifications"] = $community_gallery_arr["admin_notifications"];
        $gallery["allow_public_read"] = $community_gallery_arr["allow_public_read"];
        $gallery["allow_public_upload"] = $community_gallery_arr["allow_public_upload"];
        $gallery["allow_public_comment"] = $community_gallery_arr["allow_public_comment"];
        $gallery["allow_troll_read"] = $community_gallery_arr["allow_troll_read"];
        $gallery["allow_troll_upload"] = $community_gallery_arr["allow_troll_upload"];
        $gallery["allow_troll_comment"] = $community_gallery_arr["allow_troll_comment"];
        $gallery["allow_member_read"] = $community_gallery_arr["allow_member_read"];
        $gallery["allow_member_upload"] = $community_gallery_arr["allow_member_upload"];
        $gallery["allow_member_comment"] = $community_gallery_arr["allow_member_comment"];
        $gallery["release_date"] = $time;
        $gallery["release_until"] = 0;
        $gallery["updated_date"] = $time;
        $gallery["updated_by"] = $proxy_id;
        $db->AutoExecute("" . DATABASE_NAME . ".community_galleries", $gallery, "INSERT");
        $new_gallery_id = $db->Insert_Id();
        output_success("Created new gallery with id: " . $new_gallery_id);
        return array("new_gallery_id" => $new_gallery_id, "old_gallery_id" => $community_gallery_arr["cgallery_id"]);
    } else {
        output_error("Community Gallery not found.");
        return 0;
    }
}
 public function copyProvinceRule()
 {
     $customer_rent_id = $this->input->get_post('customer_rent_id');
     $province_code_from = $this->input->get_post('province_code_from');
     $province_code_to = $this->input->get_post('province_code_to');
     //清空旧数据
     $rule_to = $this->customer_express_rule_model->getOneByRent($customer_rent_id, $province_code_to);
     $this->customer_express_rule_item_model->deleteByRuleID($rule_to['rule_id']);
     $this->customer_express_rule_model->delete($rule_to['rule_id']);
     $rule_from = $this->customer_express_rule_model->getOneByRent($customer_rent_id, $province_code_from);
     $rule_to = $rule_from;
     unset($rule_to['rule_id']);
     $rule_to['province_code'] = $province_code_to;
     $new_rule_id = $this->customer_express_rule_model->add($rule_to);
     $rule_item_from = $this->customer_express_rule_item_model->getItems($rule_from['rule_id']);
     foreach ($rule_item_from as $rule_item) {
         unset($rule_item['item_id']);
         $rule_item['rule_id'] = $new_rule_id;
         $this->customer_express_rule_item_model->add($rule_item);
     }
     output_success();
 }
Example #7
0
 public function delete()
 {
     if ($this->checkCondition() == FALSE) {
         output_error('条件不足,不能执行该操作');
     }
     if ($this->input->post('tracking_number_ids')) {
         $tracking_number_ids = explode(',', $this->input->post('tracking_number_ids'));
         $tracking_numbers = $this->tracking_number_model->getTrackingNumberByIDS($tracking_number_ids);
     } else {
         $data = array('arrive_time_start' => $this->input->get_post('arrive_time_start'), 'arrive_time_end' => $this->input->get_post('arrive_time_end'), 'filter' => objectToArray(json_decode($this->input->get_post('filter'))));
         $tracking_numbers = $this->tracking_number_model->getTrackingNumbers($data);
     }
     $delete_total = 0;
     foreach ($tracking_numbers as $tracking_number) {
         $result = $this->tracking_number_model->delete($tracking_number['tracking_number_id']);
         if ($result) {
             $delete_total++;
         }
     }
     output_success('成功', $delete_total);
 }
function set_module_page_permissions($db, $community_id, $module_id, $allow_member_view, $allow_public_view, $allow_troll_view)
{
    $query = "SELECT * FROM " . DATABASE_NAME . ".`communities_modules` WHERE `module_id` = " . $db->qstr($module_id) . " AND `module_active` = '1'";
    $module_info = $db->GetRow($query);
    $module_shortname = "";
    if ($module_info) {
        $module_shortname = $module_info["module_shortname"];
        if ($db->AutoExecute("" . DATABASE_NAME . ".`community_pages`", array("allow_member_view" => 0, "allow_public_view" => 0, "allow_troll_view" => 0, "updated_date" => time(), "updated_by" => 5440), "UPDATE", "`community_id` = " . $db->qstr($community_id) . " AND page_type = " . $db->qstr($module_shortname))) {
            output_success("Permission set to allow Admin access only.");
        } else {
            output_error("Failed to create the module page.");
        }
    } else {
        output_error("Module does not exist.");
    }
}