本文整理汇总了PHP中security::xss_clean方法的典型用法代码示例。如果您正苦于以下问题:PHP security::xss_clean方法的具体用法?PHP security::xss_clean怎么用?PHP security::xss_clean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类security
的用法示例。
在下文中一共展示了security::xss_clean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update($id)
{
if (request::is_ajax() and request::method() == 'post') {
$this->auto_render = FALSE;
$post = security::xss_clean($this->input->post());
$item = $this->item_model->find($id)->as_array();
if (!empty($_FILES['item-image']['name'])) {
$targetPath = 'assets/uploads/items/';
$filename = $_FILES['item-image']['name'];
$tempname = $_FILES['item-image']['tmp_name'];
$temp = explode(".", $filename);
$extension = end($temp);
if (!is_dir($targetPath)) {
mkdir($targetPath, 0700);
$salt = 'items-' . uniqid() . '-';
$targetFile = $targetPath . $salt . $filename;
$this->start_upload($targetFile, $tempname);
} else {
$salt = 'items-' . uniqid() . '-';
$targetFile = $targetPath . $salt . $filename;
$this->start_upload($targetFile, $tempname);
}
} else {
$targetFile = $item['image_file_name'];
}
$post = array("category_id" => $post['item-category'], "code" => $post['item-code'], "name" => $post['item-name'], "quantity" => $item['quantity'], "unit" => $post['item-unit'], "cost" => $post['item-cost'], "price" => $post['item-price'], "description" => $post['item-description'], "image_file_name" => $targetFile);
$this->item_model->update($post, $id);
log_helper::add("1", $this->user_log, $this->user_id, "Updated Item named " . $post['name']);
}
}
示例2: save
public function save()
{
if (request::is_ajax() && request::method() === 'post') {
$this->auto_render = FALSE;
$post = security::xss_clean($this->input->post());
log_helper::add("1", $this->user_log, $this->user_id, "Added New Purchase");
$this->purchase_model->insert($post);
}
}
示例3: save
public function save()
{
if (request::is_ajax() && request::method() === 'post') {
$this->auto_render = FALSE;
$post = security::xss_clean($this->input->post());
$latest = json_helper::convert($this->district_model->insert($post));
echo json_encode($latest);
}
}
示例4: save
public function save()
{
if (request::is_ajax() && request::method() === 'post') {
$this->auto_render = FALSE;
$post = security::xss_clean($this->input->post());
$officeBudget = arr::remove('currentBudget', $post);
if ($post['status'] == 'Approved') {
$this->budget_model->updateBudget($post['office_id'], $officeBudget);
echo $this->request_model->insert($post);
}
$this->request_model->insert($post);
log_helper::add("1", $this->user_log, $this->user_id, "Added New Request");
}
}
示例5: contact_info
public function contact_info()
{
if (request::is_ajax() && request::method() == 'post') {
$this->auto_render = FALSE;
//$settings = json_decode($this->setting_model->find(1)->configs);
//$this->template->settings = $settings;
$post = security::xss_clean($this->input->post());
$data = array("mobile" => $post["mobile"], "email" => $post["email"], "twitter" => $post["twitter"], "skype" => $post["skype"]);
$json = json_encode($data, TRUE);
$data_contact_info = array("contact_information" => $json);
log_helper::add("2", $this->user_log, $this->user_id, "Profile Contact Information was Successfully Updated");
$this->setting_model->update_user($this->auth->get_user()->id, $data_contact_info);
}
}
示例6: update
public function update($id)
{
if (request::is_ajax() && request::method() === 'post') {
$this->auto_render = FALSE;
$changes = "";
$post = security::xss_clean($this->input->post('name'));
$district = $this->district_model->find($id);
$changes .= custom_helper::compare_variable("District Name", $district->name, $post);
if ($changes != "") {
$changes = substr($changes, 0, -2) . '.';
}
$district->name = $post;
log_helper::add("1", $this->user_log, $this->user_id, "Updated a District. " . $changes);
echo json_encode($this->district_model->getOne($district->save($id)));
}
}
示例7: save_email
public function save_email()
{
if (request::is_ajax() && request::method() === 'post') {
$this->auto_render = FALSE;
$post = security::xss_clean($this->input->post());
$senderId = $this->auth->get_user()->id;
$receiver = $this->category_model->getOneUser($post['receiverId']);
$decodeUserInfo = json_decode($receiver[0]->user_information, TRUE);
$dataSent = array("email_data" => $post['content'], "subject" => $post['subject'], "receiver_id" => $post['receiverId'], "sender_id" => $senderId, "notif_viewed" => 0, "email_viewed" => 0, "email_deleted" => 0);
//print_r($post);exit;
//$this->auth->get_user()->id
$latest = $this->email_model->insert($dataSent);
log_helper::add("1", $this->user_log, $this->user_id, "Email Sent to " . $decodeUserInfo['fullname'] . ".");
// echo json_encode($latest);
}
}
示例8: save
public function save()
{
if (request::is_ajax() and request::method() === 'post') {
$this->auto_render = FALSE;
$office_id = Auth::instance()->get_user()->office_id;
$post = security::xss_clean($this->input->post());
$post['office_id'] = $office_id;
$post['status'] = 'Received';
$officeBudget = arr::remove('currentBudget', $post);
if ($post['status'] == 'Approved') {
$this->budget_model->updateBudget($post['office_id'], $officeBudget);
echo $this->request_model->insert($post);
}
log_helper::add("1", $this->user_log, $this->user_id, "Requested a Budget");
$this->request_model->insert($post);
}
}
示例9: update
public function update($id)
{
if (request::is_ajax() && request::method() == 'post') {
$this->auto_render = FALSE;
$changes = "";
$post = security::xss_clean($this->input->post());
$category = $this->category_model->find($id);
$changes .= custom_helper::compare_variable("Category Name", $category->name, $post['name']);
$changes .= custom_helper::compare_variable("Category Description", $category->description, $post['description']);
if ($changes != "") {
$changes = substr($changes, 0, -2) . '.';
}
//print_r($changes);exit;
$category->name = $post['name'];
$category->description = $post['description'];
log_helper::add("1", $this->user_log, $this->user_id, "Updated a Category. " . $changes);
echo $category->save();
}
}
示例10: save
public function save()
{
if (request::is_ajax() && request::method() === 'post') {
$this->auto_render = FALSE;
$post = security::xss_clean($this->input->post());
$request_id = arr::remove('request_id', $post);
foreach ($post as $key => $value) {
$this->transaction_model->{$key} = $value;
}
$budget = $this->budget_model->where('office_id', $post['office_id'])->find();
$budget_left = (double) $budget->amount_left - (double) $post['amount_paid'];
$this->budget_model->updateBudget($post['office_id'], $budget_left);
$request = $this->request_model->find($request_id);
$request->grand_total = $post['amount_left'];
$request->save();
log_helper::add("1", $this->user_log, $this->user_id, "Added New Transaction.");
echo $this->transaction_model->save();
}
}
示例11: update
public function update($id)
{
if (request::is_ajax() && request::method() === 'post') {
$this->auto_render = FALSE;
$post = security::xss_clean($this->input->post());
$office = $this->office_model->with('district')->find($id);
$district = $this->district_model->find($post['district_id']);
$changes = "";
$changes .= custom_helper::compare_variable("Office Name", $office->name, $post['name']);
$changes .= custom_helper::compare_variable("District Name", $office->district->name, $district->name);
if ($changes != "") {
$changes = substr($changes, 0, -2) . '.';
}
$office->district_id = $post['district_id'];
$office->name = $post['name'];
log_helper::add("1", $this->user_log, $this->user_id, "Updated an Office. " . $changes);
echo json_encode($office->save()->as_array());
}
}
示例12: save
public function save()
{
if (request::is_ajax() && request::method() === 'post') {
$this->auto_render = FALSE;
$post = security::xss_clean($this->input->post());
$items = $post['items'];
arr::remove('items', $post);
foreach ($post as $key => $value) {
$this->purchase_model->{$key} = $value;
}
$last_purchase = $this->purchase_model->save();
if ($last_purchase->id) {
$i = 0;
foreach ($items as $key => $value) {
$items[$key]['purchase_id'] = $last_purchase->id;
$this->item_stock_model->insert($items[$i]);
$i++;
}
}
}
}
示例13: update
public function update($id)
{
if (request::is_ajax() && request::method() === 'post') {
$this->auto_render = FALSE;
$post = security::xss_clean($this->input->post());
$supplier = $this->supplier_model->find($id);
$changes = "";
$changes .= custom_helper::compare_variable("Supplier Name", $supplier->name, $post['name']);
$changes .= custom_helper::compare_variable("Supplier Representative", $supplier->representative, $post['representative']);
$changes .= custom_helper::compare_variable("Supplier Contact Number", $supplier->contact_number, $post['contact_number']);
$changes .= custom_helper::compare_variable("Supplier Email", $supplier->email, $post['email']);
$changes .= custom_helper::compare_variable("Supplier Address", $supplier->address, $post['address']);
if ($changes != "") {
$changes = substr($changes, 0, -2) . '.';
}
foreach ($post as $key => $value) {
$supplier->{$key} = $value;
}
log_helper::add("1", $this->user_log, $this->user_id, "Updated a Supplier. " . $changes);
echo $supplier->save();
}
}
示例14: index
public function index()
{
$requested_url = $this->session->get('requested_url');
$this->template->content = new View('login/login_view');
$user = ORM::factory('user');
if ($this->auth->auto_login()) {
if (isset($requested_url)) {
url::redirect($requested_url);
}
url::redirect('/dashboard');
}
if ($_POST) {
$remember = FALSE;
$credentials = security::xss_clean($this->input->post());
if ($user->username_exists($credentials['username'])) {
if (isset($credentials['remember'])) {
$remember = TRUE;
}
if ($this->auth->login($credentials['username'], $credentials['password'], $remember)) {
$role = $this->auth->get_user()->roles[1]->name;
if ($role === 'admin') {
if (isset($requested_url)) {
return url::redirect($requested_url);
}
return url::redirect('/dashboard');
} else {
return url::redirect('/office/dashboard');
}
} else {
$this->session->set_flash('error', 'Username/Password incorrect.');
url::redirect('/auth');
}
} else {
$this->session->set_flash('error', 'Username does not exist! Contact your administrator.');
url::redirect('/auth');
}
}
}
示例15: update
public function update($id)
{
if (request::is_ajax() and request::method() === 'post') {
$this->auto_render = FALSE;
$post = security::xss_clean($this->input->post());
$officeBudget = $this->budget_model->find($id);
$transactionTotal = $this->transaction_model->getTransactionTotal($officeBudget->office_id);
if ($transactionTotal) {
$transactionTotal = (double) $transactionTotal[0]->sum;
$amount_given = (double) $post['amount_given'];
if ($amount_given > $transactionTotal) {
$post['amount_left'] = $amount_given - $transactionTotal;
} else {
echo -1;
return;
}
}
foreach ($post as $key => $value) {
$officeBudget->{$key} = $value;
}
log_helper::add("2", $this->user_log, $this->user_id, "Updated an Office Budget.");
echo $officeBudget->save();
}
}