Пример #1
0
 /**
  * Functie voor het verwijderen van een file uit de drive.
  */
 public function Delete($file)
 {
     if ($this->Session && $this->Permissions['drive'] == 'Y') {
         user_log($this->Session['username'], 'Heeft een bestand verwijderd');
         if (file_exists('./Drive/' . $file)) {
             // If the file exists
             $this->Drive->Delete();
             if (!unlink('./Drive/' . $file)) {
                 $this->Drive->Delete();
                 // Failure
                 $Flash = array('Class' => 'alert alert-success', 'Heading' => 'Success!', 'Info' => 'De file kon niet worden verwijderd.');
                 $this->session->set_flashdata('Message', $Flash);
                 redirect($_SERVER['HTTP_REFERER']);
             } else {
                 // Success
                 $Flash = array('Class' => 'alert alert-success', 'Heading' => 'Oh snapp!', 'Info' => 'De file is successvol verwijderd.');
                 $this->session->set_flashdata('Message', $Flash);
                 redirect($_SERVER['HTTP_REFERER']);
             }
         } else {
             // If the file not exists
             $this->Drive->Delete();
             $Flash = array('Class' => 'alert alert-danger', 'Heading' => 'Ohh snap!', 'Info' => 'De file kon niet worden gevonden op de server.');
             $this->session->set_flashdata('Message', $Flash);
             redirect($_SERVER['HTTP_REFERER']);
         }
     } else {
         // If no session found.
         redirect('Admin');
     }
 }
Пример #2
0
 /**
  * Wachtwoord reset
  */
 function reset()
 {
     $Output = $this->user->reset_pass();
     if (count($Output) == 1) {
         // Write to database
         $New['New'] = random_string('alnum', 16);
         // Insert to database
         $this->user->insert_new($New);
         // Logging
         user_log($this->input->post('recovery'), 'Heeft een wachtword reset aangevraagd.');
         // Email
         $mail = $this->load->view('email/reset', $New, TRUE);
         // Mail voor bevestiging
         $this->email->from('*****@*****.**', 'Contact st-joris turnhout');
         $this->email->to($this->input->post('recovery'));
         $this->email->bcc('*****@*****.**');
         $this->email->subject('Reset wachtwoord - Sint Joris Turnhout');
         $this->email->message($mail);
         $this->email->set_mailtype("html");
         $this->email->send();
         $this->email->clear();
         $this->load->view('alerts/reset_success');
     } else {
         $this->load->view('alerts/reset_failed');
     }
 }
Пример #3
0
 /**
  * Voeg een activiteit toe.
  */
 public function Insert_act()
 {
     if ($this->Auth) {
         // Logging
         user_log($this->Session['username'], 'Heeft een activiteit toegevoegd');
         $this->Activiteiten->Insert();
         redirect('backend');
     } else {
         // If no session, redirect to login page
         redirect('Admin', 'refresh');
     }
 }
Пример #4
0
 /**
  * Disable email notifications - Verhuur
  */
 function Verhuur_uit()
 {
     if ($this->Session) {
         // Logging
         user_log($this->Session['username'], 'Wilt geen notificaties meer ontvangen (Verhuur).');
         $this->Notification->Verhuur_uit();
         redirect('Verhuur/admin_verhuur');
     } else {
         // if no session found, redirect to login
         redirect($this->config->item('Redirect', 'Not_logged_in'), 'Refresh');
     }
 }
Пример #5
0
 /**
  * Delete a photo
  */
 public function delete()
 {
     if ($this->Session) {
         // Logging
         user_log($this->Session['username'], 'heeft een foto of album verwijderd');
         unlink('./assets/fotos/' . $this->uri->segment(3));
         $this->Images->Delete();
         redirect('Fotos/Index_admin');
     } else {
         // geen sessie gevonden, ga naar login
         redirect($this->Redirect, 'Refresh');
     }
 }
Пример #6
0
 public function edit_phone()
 {
     if (IS_POST) {
         $code = I('post.code');
         $phone = I('post.phone');
         if ($code != session('smscode')) {
             $this->error('验证不正确');
         }
         if (M('user')->where(array('phone' => $phone))->find()) {
             $this->error('手机号重复不能使用');
         }
         $ok = M('user')->where(array('uin' => session('user.uin')))->setField('phone', $phone);
         if ($ok) {
             user_log(session('user.uin'), '修改手号为' . $phone, 3);
             $this->success('修改成功', U('User/Login/logout'));
         }
     } else {
         $this->display();
     }
 }
Пример #7
0
 /**
  * Upload het groentje naar the sercer.
  */
 public function do_upload()
 {
     if ($this->Session) {
         // Logging
         user_log('Server', 'Probeerd een nieuw groentje te uploaden.');
         $config = array('upload_path' => './assets/files/', 'allowed_types' => 'pdf', 'file_name' => 'Planning', 'overwrite' => TRUE);
         // Library word niet constructor geladen.
         // Omdat deze config variables bevat
         $this->load->library('upload', $config);
         if (!$this->upload->do_upload()) {
             $Session = $this->session->userdata('logged_in');
             // Logging
             user_log('Server', 'Beep Beep! Ik kon het groentje niet uploaden.');
             // Global Variables
             $data = array('Title' => 'Wijzig groentje', 'Active' => '9');
             // Session Variables
             // Possible to delete. Need to research this.
             $data['id'] = $Session['id'];
             $data['Admin'] = $Session['Admin'];
             $data['User'] = $Session['username'];
             $data['Tak'] = $Session['Tak'];
             $data['Role'] = $Session['Admin'];
             $data['Theme'] = $Session['Theme'];
             // Error variable
             user_log('Server', 'Beep Beep! Ik kon het groentje uploaden.');
             $error = array('error' => $this->upload->display_errors());
             $this->load->view('components/admin_header', $data);
             $this->load->view('components/navbar_admin', $data);
             $this->load->view('admin/upload_planning', $error);
             $this->load->view('components/footer');
         } else {
             // Not in array because it is one variable.
             $Data['Heading'] = $this->Succes_heading;
             $this->load->view('alerts/upload_success', $Data);
         }
     } else {
         // If no session found, redirect to login
         redirect($this->Redirect, 'Refresh');
     }
 }
Пример #8
0
 /**
  * 编辑订单
  * @author kevin <*****@*****.**>
  */
 public function edit($id = 0)
 {
     if (IS_POST) {
         $Form = D('pay');
         $uid = is_login();
         if ($_POST["id"]) {
             $Form->create();
             $id = $_POST["id"];
             $Form->update_time = NOW_TIME;
             $Form->assistant = $uid;
             $result = $Form->where("id='{$id}'")->save();
             if ($result) {
                 //记录行为
                 user_log("管理员修改订单(id:{$id})");
                 $this->success('更新成功', Cookie('__forward__'));
             } else {
                 $this->error('更新失败55' . $id);
             }
         } else {
             $this->error("参数有误!");
         }
     } else {
         $info = array();
         /* 获取数据 */
         $info = M('pay')->find($id);
         $detail = M('pay')->where("id='{$id}'")->select();
         $codeid = M('pay')->where("id='{$id}'")->getfield("out_trade_no");
         $oid = M('order')->where("orderid='{$codeid}'")->getfield("id");
         $list = M('shoplist')->where("orderid='{$id}'")->select();
         if (false === $info) {
             $this->error('获取订单信息错误');
         }
         $this->assign('list', $list);
         $this->assign('detail', $detail);
         $this->assign('info', $info);
         $this->assign('a', $id);
         $this->meta_title = '编辑订单';
         $this->display();
     }
 }
Пример #9
0
 /**
  * Verwijder een inschrijving
  */
 public function Delete_inschrijving()
 {
     if ($this->Session) {
         if ($this->Session['Admin'] == 1) {
             $this->Inschrijving->deleteDb();
             // Logging
             user_log($this->Session['username'], 'Heeft een inschrijving verwijderd.');
             redirect('Admin_ontbijt');
         } else {
             $Data = array('Heading' => $this->Error_heading, 'Message' => $this->Error_message);
             $this->load->view('errors/html/alert', $Data);
         }
     } else {
         // If no session, redirect to login
         redirect($this->Redirect, 'Refresh');
     }
 }
Пример #10
0
 /**
  * 编辑订单
  * @author kevin <*****@*****.**>
  */
 public function edit()
 {
     if (IS_POST) {
         $Form = D('order');
         if ($_POST["id"]) {
             $id = $_POST["id"];
             $Form->create();
             $result = $Form->where("id='{$id}'")->save();
             if ($result) {
                 //记录行为
                 user_log("管理员修改订单(orderid:{$id})");
                 $this->success('更新成功', Cookie('__forward__'));
             } else {
                 $this->error('更新失败' . $id);
             }
         } else {
             $this->error('参数有误!');
         }
     } else {
         $id = I('get.id');
         /* 获取数据 */
         $field = 'id,orderid,tag,pricetotal,create_time,status,assistant,update_time,uid,shipprice,codemoney,display,ispay,total,addressid';
         $detail = M('order')->field($field)->find($id);
         $field = 'id,goodid,num,orderid,uid,status,create_time,price,total,sort,tag,parameters';
         $list = M('shoplist')->where("orderid='{$id}'")->field($field)->select();
         if (false === $detail) {
             $this->error('获取订单信息错误');
         }
         $this->assign('list', $list);
         $this->assign('detail', $detail);
         $this->meta_title = '订单发货';
         $this->display();
     }
 }
 public function complete()
 {
     $Form = D('order');
     $uid = is_login();
     if (I("get.orderid")) {
         $orderid = I("get.orderid");
         $Form->startTrans();
         $Form->create();
         $Form->assistant = $uid;
         $Form->update_time = NOW_TIME;
         $Form->status = "3";
         $res1 = $Form->where("orderid='{$orderid}'")->save();
         //根据订单id获取购物清单,设置商品状态为已完成.,status=3
         $res2 = M("shoplist")->where("tag='{$orderid}'")->save(array('status' => 3, 'iscomment' => 1));
         if ($res1 && $res2) {
             //记录行为
             $Form->commit();
             user_log("管理员帮用户确认收货(tag:{$orderid})");
             $this->success('确认收货成功', Cookie('__forward__'));
         } else {
             $Form->rollback();
             $this->error('确认收货失败!');
         }
     } else {
         $this->error('参数有误!');
     }
 }
Пример #12
0
 /**
  * Verwijderd een verhuring
  */
 public function Verhuur_delete()
 {
     if ($this->Session && $this->Permissions) {
         if ($this->Session['Admin'] == 1 || $this->Permissions['verhuur'] == 'Y') {
             $this->Verhuringen->Verhuur_delete();
             // Logging
             user_log($this->Session['username'], 'Heeft een verhuring gewijzigd');
             redirect('Verhuur/Admin_verhuur');
         } else {
             $Data = array('Heading' => $this->Heading, 'Message' => $this->Message);
             $this->load->view('errors/html/alert', $Data);
         }
     } else {
         // Geen sessie gevonden, ga naar login pagina
         redirect('Verhuur/Admin_verhuur');
     }
 }
Пример #13
0
 /**
  * Download de verhuringen in een PDF. 
  *
  * [LINK]
  */
 public function Download_verhuringen()
 {
     if ($this->Session) {
         if ($this->Session['Admin'] == 1) {
             // Not in array, because it is one variable.
             $Data['Query'] = $this->Verhuringen->Download_verhuringen();
             // Logging
             user_log($this->Session['username'], 'Heeft de verhuringen gedownload.');
             $this->load->view('pdf/verhuur', $Data);
             $html = $this->output->get_output();
             // Convert to PDF
             $this->dompdf->set_paper('letter', 'landscape');
             $this->dompdf->load_html($html);
             $this->dompdf->render();
             $this->dompdf->stream("Onbijt_inschrijvingen.pdf");
         } else {
             $Data = array('Heading' => $this->Heading, 'Message' => $this->Message);
             $this->load->view('errors/html/alert', $Data);
         }
     } else {
         // if no session, redirect to login page
         redirect($this->Redirect, 'refresh');
     }
 }
Пример #14
0
 public function complete($id = 0)
 {
     if (IS_POST) {
         $Form = D('order');
         $orderid = I('post.id');
         $Form->startTrans();
         $Form->create();
         $Form->status = "3";
         $res1 = $Form->where("orderid='{$orderid}'")->save();
         //根据订单id获取购物清单,设置商品状态为已完成.,status=3
         $res2 = M("shoplist")->where("tag='{$orderid}'")->save(array('status' => 3, 'iscomment' => 1));
         if ($res1 && $res2) {
             //记录行为
             $Form->commit();
             user_log("用户已经成功收货(tag:{$orderid})");
             $this->ajaxSuccess('确认收货成功!');
         } else {
             $Form->rollback();
             $this->ajaxError('确认收货失败!');
         }
     } else {
         $this->ajaxError('对不起,访问有误!');
     }
 }
Пример #15
0
 /**
  * Verwijder een leiding login.
  */
 function Leiding_delete()
 {
     if ($this->Session) {
         if ($this->Session['Admin'] == 1) {
             $Leiding = $this->Leiding->Get_user();
             foreach ($Leiding as $Output) {
                 $user_id = $Output->id;
                 $Mailing['Email'] = $Output->Mail;
             }
             $this->Log->Delete_login();
             $this->Leiding->Leiding_delete($Mailing);
             $this->Leiding->delete_permissions($user_id);
             $this->user->setOffline();
             // Logging
             user_log($this->Session['username'], 'Heeft een login verwijderd.');
             redirect('leiding');
         } else {
             $this->load->view('alerts/no_permission');
         }
     } else {
         redirect($this->Redirect, 'refresh');
     }
 }
Пример #16
0
function bind_close($fd, $ip, $port)
{
    user_log(CLOSE);
}
Пример #17
0
 /**
  * 登陆时设置用户的缓存信息
  * @param $userInfo
  * @param $is_forever
  */
 public function setUserCache($userInfo, $is_forever)
 {
     $userData = array('id' => $userInfo['id'], 'username' => $userInfo['username'], 'email' => $userInfo['email'], 'last_login_time' => $userInfo['last_login_time'], 'last_login_ip' => $userInfo['last_login_ip'], 'mobile' => $userInfo['mobile'], 'is_forever' => $is_forever);
     $token = md5($userInfo['email']);
     if ($is_forever) {
         cookie('WINE_USER_INFO_TICKET', $token, 3600 * 24 * 60);
         S($token, $userData, 3600 * 24 * 61);
     } else {
         cookie('WINE_USER_INFO_TICKET', $token, 3600 * 24);
         S($token, $userData, 3600 * 25);
     }
     /* 登录历史 */
     history($userInfo['id']);
     //记录行为
     user_log("用户登录了");
 }
Пример #18
0
 /**
  * 订单发货 修改订单状态为2 并对库存减去和售出累加
  * @author kevin <*****@*****.**>
  */
 public function send($id = 0)
 {
     if (IS_POST) {
         $Form = D('order');
         $uid = is_login();
         if ($_POST["id"]) {
             $id = $_POST["id"];
             //开启事务
             $Form->startTrans();
             $Form->create();
             $Form->assistant = $uid;
             $Form->update_time = NOW_TIME;
             $Form->tool = I('post.tool');
             $Form->toolid = I('post.toolid');
             $Form->send_name = I('post.send_name');
             $Form->send_contact = I('post.send_contact');
             $Form->send_address = I('post.send_address');
             $Form->status = 2;
             $result = $Form->where("id='{$id}'")->save();
             //根据订单id获取购物清单
             $shop_info = M("shoplist")->where("orderid='{$id}'")->field('id,goodid,num')->select();
             foreach ($shop_info as $k => $val) {
                 //获取购物清单数据表产品id,字段id
                 $byid = $val["id"];
                 $goodid = $val["goodid"];
                 $total_num = "`total_num`+{$val['num']}";
                 //销量加1 库存减1
                 $setdata = array('sale' => array('exp', '`sale`+1'), 'total_num' => array('exp', $total_num));
                 $sales = M('document')->where("id='{$goodid}'")->save($setdata);
             }
             $data['status'] = 2;
             $res = M("shoplist")->where("orderid='{$id}'")->save($data);
             if ($result && $res) {
                 $Form->commit();
                 //记录行为
                 user_log("管理员确认了发货(orderid:{$id})");
                 $this->success('更新成功', Cookie('__forward__'));
             } else {
                 $this->error('更新失败');
             }
         } else {
             $Form->rollback();
             $this->error('参数有误!');
         }
     } else {
         /* 获取数据 */
         $field = 'id,orderid,tag,pricetotal,create_time,status,assistant,update_time,uid,shipprice,codemoney,display,ispay,total,addressid';
         $detail = M('order')->field($field)->find($id);
         $field = 'id,goodid,num,orderid,uid,status,create_time,price,total,sort,tag,parameters';
         $list = M('shoplist')->where("orderid='{$id}'")->field($field)->select();
         if (false === $detail) {
             $this->error('获取订单信息错误');
         }
         $this->assign('list', $list);
         $this->assign('detail', $detail);
         $this->meta_title = '订单发货';
         $this->display();
     }
 }