function postSave($id = 0) { $trackUri = $this->data['trackUri']; //$rules = $this->validateForm(); $rules = Slideshow::$rules; $validator = Validator::make(Input::all(), $rules); if ($validator->passes()) { $data = $this->getDataPost('slideshow'); if (!is_null(Input::file('file'))) { $file = Input::file('file'); $destinationPath = './uploads/slideshow/'; $filename = $file->getClientOriginalName(); $extension = $file->getClientOriginalExtension(); //if you need extension of the file $newfilename = SiteHelpers::seoUrl(trim(Input::get('slideshow_name'))) . '_' . time() . '.' . $extension; $uploadSuccess = Input::file('file')->move($destinationPath, $newfilename); if ($uploadSuccess) { $data['slideshow_image'] = $newfilename; $orgFile = $destinationPath . '/' . $newfilename; $thumbFile = $destinationPath . '/thumb/' . $newfilename; SiteHelpers::resizewidth("1140", $orgFile, $thumbFile); if (Input::get('slideshow_id') != "") { $data_old = $this->model->getRow(Input::get('slideshow_id')); @unlink(ROOT . '/uploads/slideshow/' . $data_old->slideshow_image); @unlink(ROOT . '/uploads/slideshow/thumb/' . $data_old->slideshow_image); } } } $data['slideshow_alias'] = SiteHelpers::seoUrl(trim($data['slideshow_name'])); $data['created'] = time(); $ID = $this->model->insertRow($data, Input::get('slideshow_id')); // Input logs if (Input::get('slideshow_id') == '') { $this->inputLogs("New Entry row with ID : {$ID} , Has Been Save Successfull"); $id = SiteHelpers::encryptID($ID); } else { $this->inputLogs(" ID : {$ID} , Has Been Changed Successfull"); } // Redirect after save $md = str_replace(" ", "+", Input::get('md')); $redirect = !is_null(Input::get('apply')) ? 'Slideshow/add/' . $id . '?md=' : 'Slideshow?md='; return Redirect::to($redirect)->with('message', SiteHelpers::alert('success', Lang::get('core.note_success'))); } else { return Redirect::to('Slideshow/add/' . $id . '?md=')->with('message', SiteHelpers::alert('error', Lang::get('core.note_error')))->withErrors($validator)->withInput(); } }
function postSave($id = 0) { $rules = array(); $validator = Validator::make(Input::all(), $rules); if ($validator->passes()) { $data = $this->validatePost('tb_blogcategories'); $data['alias'] = SiteHelpers::seoUrl(trim(Input::get('name'))); $ID = $this->model->insertRow($data, Input::get('CatID')); // Input logs if (Input::get('CatID') == '') { $this->inputLogs("New Entry row with ID : {$ID} , Has Been Save Successfull"); } else { $this->inputLogs(" ID : {$ID} , Has Been Changed Successfull"); } // Redirect after save return Redirect::to('blogcategories')->with('message', SiteHelpers::alert('success', Lang::get('core.note_success'))); } else { return Redirect::to('blogcategories/add/' . $id)->with('message', SiteHelpers::alert('error', Lang::get('core.note_error')))->withErrors($validator)->withInput(); } }
function postSave($id = 0) { $trackUri = $this->data['trackUri']; //$rules = $this->validateForm(); $validator = Validator::make(Input::all(), Ncategories::$rules); SiteHelpers::globalXssClean(); if ($validator->passes()) { if (!is_null(Input::file('file'))) { $file = Input::file('file'); $destinationPath = ROOT . '/uploads/categories/'; $filename = $file->getClientOriginalName(); $extension = $file->getClientOriginalExtension(); //if you need extension of the file $newfilename = Input::get('CategoryName') . '_' . time() . '.' . $extension; $uploadSuccess = Input::file('file')->move($destinationPath, $newfilename); if ($uploadSuccess) { $data['Picture'] = $newfilename; $orgFile = $destinationPath . '/' . $newfilename; $thumbFile = $destinationPath . '/thumb/' . $newfilename; //SiteHelpers::cropImage($this->img_width , $this->img_height , $orgFile , $extension, $thumbFile); SiteHelpers::resizewidth("180", $orgFile, $thumbFile); if (Input::get('action') != "") { $data_old = $this->model->getRow(Input::get('action')); @unlink(ROOT . '/uploads/categories/' . $data_old->Picture); @unlink(ROOT . '/uploads/categories/thumb/' . $data_old->Picture); } } } $data['postion'] = Input::get('postion'); $data['CategoryName'] = Input::get('CategoryName'); $data['Description'] = Input::get('Description'); $data['lang'] = $this->lang; $data['created'] = time(); $data['status'] = Input::get('status'); $data['alias'] = SiteHelpers::seoUrl(trim($data['CategoryName'])); $data['keywords'] = Input::get('keywords'); $data['seo_meta'] = Input::get('seo_meta'); //$data = $this->validatePost('categories'); $ID = $this->model->insertRow($data, Input::get('CategoryID')); // Input logs if (Input::get('CategoryID') == '') { $this->inputLogs("New Entry row with ID : {$ID} , Has Been Save Successfull"); $id = SiteHelpers::encryptID($ID); } else { $this->inputLogs(" ID : {$ID} , Has Been Changed Successfull"); } // Redirect after save //$md = str_replace(" ","+",Input::get('md')); $redirect = !is_null(Input::get('apply')) ? 'Ncategories/add/' . $id : 'Ncategories?md='; return Redirect::to($redirect)->with('message', SiteHelpers::alert('success', Lang::get('core.note_success'))); } else { return Redirect::to('Ncategories/add/' . $id)->with('message', SiteHelpers::alert('error', Lang::get('core.note_error')))->withErrors($validator)->withInput(); } }
function postSave(Request $request) { $validator = Validator::make($request->all(), Aboutus::$rules); if ($validator->passes()) { $data = $this->getDataPost('aboutus'); //print_r($data);die; $type_pro = !isset($data['aboutus_id']) ? "add" : "edit"; $data['aboutus_alias'] = \SiteHelpers::seoUrl(trim($data['aboutus_name'])); $data = \SiteHelpers::processTimeUpdate($type_pro, $data); if (!is_null(\Input::file('file'))) { $file = \Input::file('file'); $destinationPath = './uploads/aboutus/'; $filename = $file->getClientOriginalName(); $extension = $file->getClientOriginalExtension(); //if you need extension of the file $newfilename = 'aboutus_' . time() . '.' . $extension; $uploadSuccess = \Input::file('file')->move($destinationPath, $newfilename); if ($uploadSuccess) { $data['aboutus_image'] = $newfilename; $orgFile = $destinationPath . '/' . $newfilename; $thumbFile = $destinationPath . '/thumb/' . $newfilename; //SiteHelpers::resizewidth("213",$orgFile,$thumbFile); \SiteHelpers::resize_crop_image('600', '450', $orgFile, $thumbFile); if ($type_pro == "edit") { $data_old = $this->model->getRow(\Input::get('aboutus_id')); @unlink(ROOT . '/uploads/aboutus/' . $data_old->aboutus_image); @unlink(ROOT . '/uploads/aboutus/thumb/' . $data_old->aboutus_image); } } } $id = $this->model->insertRow($data, \Input::get('aboutus_id')); if (!is_null($request->input('apply'))) { $return = 'aboutus/update/' . $id . '?return=' . self::returnUrl(); } else { $return = 'aboutus?return=' . self::returnUrl(); } // Insert logs into database if ($request->input('aboutus_id') == '') { \SiteHelpers::auditTrail($request, 'New Data with ID ' . $id . ' Has been Inserted !'); } else { \SiteHelpers::auditTrail($request, 'Data with ID ' . $id . ' Has been Updated !'); } return Redirect::to($return)->with('messagetext', \Lang::get('core.note_success'))->with('msgstatus', 'success'); } else { $id = \Input::get('aboutus_id') ? \Input::get('aboutus_id') : ""; return Redirect::to('aboutus/update/' . $id)->with('messagetext', \Lang::get('core.note_error'))->with('msgstatus', 'error')->withErrors($validator)->withInput(); } }
function postSave($id = 0) { $trackUri = $this->data['trackUri']; $rules = Nproducts::$rules; //print_r(Input::all());die; $validator = Validator::make(Input::all(), $rules); //SiteHelpers::globalXssClean(); if ($validator->passes()) { $data = $this->getDataPost('products'); if (!is_null(Input::file('file'))) { $file = Input::file('file'); $destinationPath = './uploads/products/'; $filename = $file->getClientOriginalName(); $extension = $file->getClientOriginalExtension(); //if you need extension of the file $newfilename = Input::get('ProductName') . '_' . time() . '.' . $extension; $uploadSuccess = Input::file('file')->move($destinationPath, $newfilename); if ($uploadSuccess) { $data['image'] = $newfilename; $orgFile = $destinationPath . '/' . $newfilename; $thumbFile = $destinationPath . '/thumb/' . $newfilename; SiteHelpers::resizewidth("152", $orgFile, $thumbFile); if (Input::get('action') != "") { $data_old = $this->model->getRow(Input::get('action')); @unlink(ROOT . '/uploads/products/' . $data_old->Picture); @unlink(ROOT . '/uploads/products/thumb/' . $data_old->Picture); } } } $data['SupplierID'] = "1"; $data['created'] = time(); $data['slug'] = SiteHelpers::seoUrl(trim($data['ProductName'])); $data['created'] = time(); $ID = $this->model->insertRow($data, Input::get('ProductID')); if (Input::file('multi_file')[0] != "") { $model_img_pro = new Imagesproduct(); $rm_image = Input::get('remove_image'); $arr_img_rm = $rm_image != "" ? $rm_image : array(); foreach ($_FILES['multi_file']['tmp_name'] as $key => $tmp_name) { $file_name = $_FILES['multi_file']['name'][$key]; if (!in_array($file_name, $arr_img_rm)) { $file_size = $_FILES['multi_file']['size'][$key]; $file_tmp = $_FILES['multi_file']['tmp_name'][$key]; $file_type = $_FILES['multi_file']['type'][$key]; $explode_name = explode(".", $file_name); $path_image = './uploads/images_product/'; $newname = "image_" . $key . time() . '.' . $explode_name[1]; if (move_uploaded_file($file_tmp, $path_image . $newname)) { $model_img_pro->insertRow(array("name" => $newname, "id_product" => $ID), ""); SiteHelpers::resizewidth("300", $path_image . $newname, $path_image . "thumb/" . $newname); } } } } // Input logs if (Input::get('ProductID') == '') { $this->inputLogs("New Entry row with ID : {$ID} , Has Been Save Successfull"); $id = SiteHelpers::encryptID($ID); } else { $this->inputLogs(" ID : {$ID} , Has Been Changed Successfull"); } // Redirect after save $md = str_replace(" ", "+", Input::get('md')); $redirect = !is_null(Input::get('apply')) ? 'Nproducts/add/' . $id . $trackUri : 'Nproducts' . $trackUri; return Redirect::to($redirect)->with('message', SiteHelpers::alert('success', Lang::get('core.note_success'))); } else { return Redirect::to('Nproducts/add/' . $id)->with('message', SiteHelpers::alert('error', Lang::get('core.note_error')))->withErrors($validator)->withInput(); } }
function postSave($id = 0) { $rules = array('title' => 'required', 'content' => 'required'); $validator = Validator::make(Input::all(), $rules); if ($validator->passes()) { //$content = Input::get('content'); $data = $this->getDataPost('tb_pages'); /*if(Input::get('pageID') ==1) { $filename = public_path() ."protected/app/views/pages/template/home.blade.php"; } else { $filename = public_path() ."protected/app/views/pages/template/".Input::get('filename').".blade.php"; } */ /* $fp=fopen($filename,"w+"); fwrite($fp,$content); fclose($fp); */ // $groups = Groups::all(); //$access = array(); /*foreach($groups as $group) { $access[$group->group_id] = (isset($_POST['group_id'][$group->group_id]) ? '1' : '0'); }*/ //$data['access'] = json_encode($access); //$data['allow_guest'] = Input::get('allow_guest'); //$data['template'] = Input::get('template'); $data['alias'] = "pages/" . SiteHelpers::seoUrl(trim($data['title'])) . "-"; $data['created'] = time(); $id = $this->model->insertRow($data, Input::get('pageID')); $alias = $data['alias'] . $id . ".html"; DB::table('tb_pages')->where('pageID', '=', $id)->update(array('alias' => $alias)); self::createRouters(); return Redirect::to('pages')->with('message', SiteHelpers::alert('success', Lang::get('core.note_success'))); } else { return Redirect::to('pages/add/' . $id)->with('message', SiteHelpers::alert('error', Lang::get('core.note_error')))->withErrors($validator)->withInput(); } }
public function postCategoriessave(Request $request) { $rules = array(); $validator = Validator::make($request->all(), $rules); if ($validator->passes()) { $data = array('name' => trim($request->input('name')), 'enable' => 1); $data['alias'] = \SiteHelpers::seoUrl(trim($request->input('name'))); if ($request->input('CatID') == '') { \DB::table('tb_blogcategories')->insert($data); } else { \DB::table('tb_blogcategories')->where('CatID', $request->input('CatID'))->update($data); } return redirect('blog/categories')->with('messagetext', \Lang::get('core.note_success'))->with('msgstatus', 'success'); } else { return redirect('blog/categories')->with('messagetext', \Lang::get('core.note_error'))->with('msgstatus', 'error')->withErrors($validator)->withInput(); } }
public function postSuatin() { if (!Session::has('customer') || Input::get('post_id') == '') { return Redirect::to(''); } $rules = array('post_name' => 'required', 'post_code' => 'required|max:10', 'post_category' => 'required|Numeric', 'post_link' => 'required', 'post_price' => 'required|Numeric', 'post_price_promotion' => 'Numeric', 'phone' => 'required', 'post_image' => 'mimes:gif,png,jpg,jpeg|max:20000'); if (CNF_RECAPTCHA == 'true') { $rules['recaptcha_response_field'] = 'required|recaptcha'; } $validator = Validator::make(Input::all(), $rules); if ($validator->passes()) { $ses_cus = Session::get('customer'); $customer = DB::table('customer')->where('customer_id', '=', $ses_cus['id'])->first(); $data = $this->getDataPost('post'); $data['created'] = time(); $data['customer_id'] = $ses_cus['id']; $data['post_slug'] = SiteHelpers::seoUrl(trim($data['post_name'])); $data['active'] = 1; $data['status'] = 1; unset($data['lang']); $mdPost = new Post(); if (!is_null(Input::file('post_image'))) { $file = Input::file('post_image'); $destinationPath = './uploads/post/'; $filename = $file->getClientOriginalName(); $extension = $file->getClientOriginalExtension(); //if you need extension of the file $newfilename = SiteHelpers::seoUrl(trim($data['post_name'])) . '_' . time() . '.' . $extension; $uploadSuccess = Input::file('post_image')->move($destinationPath, $newfilename); if ($uploadSuccess) { $data['post_image'] = $newfilename; $orgFile = $destinationPath . '/' . $newfilename; $thumbFile = $destinationPath . '/thumb/' . $newfilename; SiteHelpers::resize_crop_image('169', '166', $orgFile, $thumbFile); $data_old = $mdPost->getRow(Input::get('post_id')); @unlink(ROOT . '/uploads/advertise/' . $data_old->post_image); @unlink(ROOT . '/uploads/advertise/thumb/' . $data_old->post_image); } } else { unset($data['post_image']); } $ID = $mdPost->insertRow($data, $data['post_id']); return Redirect::to('thong-bao.html')->with('message', SiteHelpers::alert('success', 'Thao tác thành công ! Bài đăng của bạn đang chờ duyệt !')); } else { $input_rd = Input::all(); unset($input_rd['post_image']); return Redirect::back()->with('message_dangtin', SiteHelpers::alert('error', 'Vui lòng xác nhận các thông tin bên dưới'))->with('input', $input_rd)->withErrors($validator)->withInput(); } }