Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace buyboard\Http\Controllers; use buyboard\Art; use buyboard\Contact; ..
Decoded Output download
<?php
namespace buyboard\Http\Controllers;
use buyboard\Art;
use buyboard\Contact;
use buyboard\Electronic;
use buyboard\EmployJobs;
use buyboard\Factor;
use buyboard\Home;
use buyboard\Http\config;
use buyboard\Http\Controllers\API\APIAddNewController;
use buyboard\MerchantContacts;
use buyboard\Mlk;
use buyboard\Motor;
use buyboard\PersonalStaff;
use buyboard\Tickets;
use buyboard\User;
use buyboard\UserServices;
use buyboard\WorkService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Session;
use Psy\Command\ListCommand;
class IFaceWebController extends Controller
{
public function __construct()
{
$this->apiContact = (new API\APIContactController());
$this->apiManage = (new API\APIManagerController());
$this->apiMotor = (new API\APIMotorController());
$this->apiMlk = (new API\APIMlkController());
$this->motors = $this->apiMotor->noAcceptsList();
$this->apiElec = (new API\APIElectronicController());
$this->apiEmploy = (new API\APIEmployJobController());
$this->apiHome = (new API\APIHomeController());
$this->apiDiscover = (new API\APIDiscoverController());
$this->apiPersonal = (new API\APIPersonalController());
$this->apiWorkService = (new API\APIWorkServiceController());
$this->apiPhoto = (new API\APIPhotoController());
$this->apiArt = (new API\APIArtController());
$this->apiLocation = (new API\APILocationController());
$this->categories = $this->apiLocation->index();
$this->locations = $this->apiLocation->indexLocation();
$this->apiProduct = (new API\APIProductController());
$this->apiShoppingCart = (new API\APIShoppingCartController());
$this->apiConfirm = (new API\APIConfirmController());
$this->apiSuggest = (new API\APITicketController());
$this->config = (new config());
$this->apiMerchant =(new API\APIMerchantController());
$this->apiLogin = (new API\APILoginController());
$this->apiAddnew = (new APIAddNewController());
}
// ==================== Discover =========================================
public function getDiscover($location ,$category ,$subCategory){
$category = str_replace('-' ,' ',$category);
$subCategory = str_replace('-' ,' ',$subCategory);
$location = str_replace('-' , ' ' ,$location);
$categoryId = $this->config->getcategoryid($category);
$subCategoryId = $this->config->getcategoryid($subCategory);
$locationId = $this->config->getCityId($location);
$records = $this->apiDiscover->getRecords(0 ,config::COUNT ,null ,$categoryId ,$subCategoryId ,$locationId);
$records = $this->apiDiscover->recordsEditDiscover($records);
return response()->view('discover',['records'=>$records ,'categoryName'=>$category ,'categoryId'=>$categoryId ,
'subcategoryName'=>$subCategory ,'subcategoryId'=>$subCategoryId ,
'locationName'=>$location ,'locationId'=>$locationId ,'key'=>null]);
}
public function getDiscover2($location ,$category ){
$category = str_replace('-' , ' ' ,$category);
$location = str_replace('-' , ' ' ,$location);
$categoryId = $this->config->getcategoryid($category);
$locationId = $this->config->getCityId($location);
$records = $this->apiDiscover->getRecords(0 ,config::COUNT ,null ,$categoryId ,null,$locationId);
$records = $this->apiDiscover->recordsEditDiscover($records);
return response()->view('discover',['records'=>$records,'categoryName'=>$category ,'categoryId'=>$categoryId,
'subcategoryName'=>null ,'subcategoryId'=>null
,'locationName'=>$location ,'locationId'=>$locationId ,'key'=>null]);
}
public function getDiscover3($location ){
$value = cookie::get('locName');
Cookie::queue("location", $value, 90);
$location = str_replace('-' , ' ' ,$location);
$locationId = $this->config->getCityId($location);
$records = $this->apiDiscover->getRecords(0 ,config::COUNT ,null ,null ,null ,$locationId);
$records = $this->apiDiscover->recordsEditDiscover($records);
return response()->view('discover',['records'=>$records ,'categoryName'=>null ,'categoryId'=>null,
'subcategoryName'=>null ,'subcategoryId'=>null
,'locationName'=>$location ,'locationId'=>$locationId ,'key'=>null]);
}
public function indexDiscover()
{
$value = Cookie::get('location');
if( $value == null) {
$location = '';
}else{
$location = $value;
}
return Redirect::to('/discover'.'/'.$location);
}
public function getRecords(Request $request )
{
$data = $request->all($this->apiManage->requestAll($request));
$start = $data['start'];
$category = $data['category'];
$subCategory = $data['subCategory'];
$key = $data['key'];
$location = $data['locationId'];
$records[] = null;
$records = $this->apiDiscover->getRecords($start, config::COUNTSCROLL ,$key , $category, $subCategory ,$location);
$records = $this->apiDiscover->recordsEditDiscover($records);
return $records;
}
public function search($location , $key ){
$locationName = str_replace('-' , ' ' ,$location);
$locationId = $this->config->getCityId($locationName);
$records = $this->apiDiscover->getRecords(0 ,config::COUNTSCROLL ,$key ,null ,null ,$locationId);
$records = $this->apiDiscover->recordsEditDiscover($records);
return response()->view('discover',['records'=>$records ,'categoryName'=>null ,'categoryId'=>null,
'subcategoryName'=>null ,'subcategoryId'=>null
,'locationName'=>$location ,'locationId'=>$locationId ,'key'=>$key]);
}
// ==================== Tell Me ==========================================
public function indexAdmin(){
return view('admin');
}
public function indexSupport(){
return view('support');
}
public function indexAbout(){
return view('about');
}
public function indexNewTicket(){
return view('newticket');
}
public function indexTicket(){
return view('ticket');
}
public function getTicket(Request $request){
$this->validate($request, [
'email' => 'required|Between:3,64|email',
'description'=> 'required',
]);
$page = 'emails.suggest';
Session::flash('message', 'Book successfully updated!');
$data = $request->all($this->apiManage->requestAll($request));
$result = $this->apiSuggest->getTicket($data);
$array = array('email'=>$data['email'],'result'=>$result ,'mobile'=>null ,'page'=>$page);
if($result != null){
$resultMail = $this->apiContact->sendMail($array);
if($resultMail != 0){
return redirect('ticket')->with('message' ,' ');
}else{
return redirect('ticket')->with('message' , '');
}
}
return redirect('newticket')->with('message', ' ');
}
// ==================== SHOW ==============================================
public function showPostDiscover($category ,$title ,$id)
{
$start = 0;
$count = 5;
$record = null;
$price = null;
$counter = 0;
$category = str_replace('-',' ',$category);
$categoryId = $this->config->getcategoryid($category);
$record = $this->apiManage->showRecordAllCategory($categoryId ,$id);
if ($record != null){
$subCategory = $record->sub_category;
$cityId = $record->city_id;
$service = $this->apiShoppingCart->showCarts($id ,$categoryId);
$record->sub_category =$this->config->getCategoryName($record->sub_category) ;
$city = $this->config->getNameCity($record->city_id);
$contact = $this->apiContact->show($record->contact_id);
$records = $this->apiDiscover->getRecords($start,$count , null,$categoryId ,$subCategory ,$cityId);
foreach ($records as $recordd)
{
if($recordd->record_id == $id)
{
unset($records[$counter]);
}
$counter = $counter + 1;
}
$records = $this->apiDiscover->recordsEditDiscover($records );
return view('show',['records'=>$records ,'id'=>$id ,'email' => $contact->email, 'mobile' => $contact->mobile,
'price'=>$record->price,'category' => $category,'record' => $record, 'zaman' => $this->config->durationString($record->created_at)
,'city'=>$city ,'service'=>$service ,'subCategory'=>$record->sub_category ]);
} else
return view('errors/503');
}
public function report(Request $request){
$data = $request->all($this->apiManage->requestAll($request));
$this->apiSuggest->getRepot($data);
return Redirect::back();
}
// ==================== ADD NEW ===========================================
public function indexAddNew()
{
return response()->view('addnew', ['categories' => $this->config->CATEGORIES, 'locations'=>$this->config->LOCATION]);
}
public function addNew(Request $request)
{
$sessionId = session()->getId();
$ip = getHostByName(getHostName());
$data = $request->all($this->apiManage->requestAll($request));
$result = $this->apiAddnew->addNew($data , $sessionId ,$ip);
return Redirect::to('manageRecord'.'/'.$result['category'] .'/'.$result['hash'] .'/'.$result['record']);
}
public function indexLogin(){
return $this->apiLogin->index();
}
// ================= ADD MERCHANT =======================================
public function indexNewMerchant(){
if(Auth::check()){
$email = Auth::user()->email;
return view('newMerchant',['email'=>$email]);
}
}
public function indexAddMerchant()
{
if (Auth::check()) {
$categoryId = null;
$message = null;
$email = Auth::user()->email;
$contact = $this->apiContact->getContactForEmail($email);
if ($contact) {
$record = $this->apiMerchant->findContactMerchant($contact->id);
if($record != null)
$categoryId = $record->category_id;
}else{
$message = ' ';
}
return view('addMerchant',['category'=>$categoryId ,'message'=>$message ]);
}
}
public function newMerchant(Request $request)
{
$this->validate($request, [
'email' => 'required|Between:3,64|email',
'title' => 'required|Between:3,30',
]);
$sessionId = session()->getId();
$ip = getHostByName(getHostName());
$data = $request->all($this->apiManage->requestAll($request));
$this->apiAddnew->addMerchant($data ,$sessionId ,$ip);
return Redirect::to('managemerchant');
}
public function manageMerchant(){
if(Auth::check()) {
$email = Auth::user()->email;
$name = Auth::user()->name;
if ($name == null and $email != null) {
$contact = $this->apiContact->getContactForEmail($email);
if ($contact != null) {
$records = $this->apiManage->getContactPosts($contact->id);
if ($records) {
foreach ($records as $record) {
$category = $this->config->getCategoryName($record->category);
$record->category = str_replace(' ', '-', $category);
$record->time = $this->config->durationString($record->created_at);
$record->city_id = $this->config->getNameCity($record->city_id);
$record->url = "http://" . $_SERVER['HTTP_HOST'] . '/' . 'manageRecord' . '/' . $record->category . '/' . $contact->hash . '/' . $record->id;
}
}
$record = $this->apiMerchant->findContactMerchant($contact->id);
$record->location_id = $this->config->getNameCity($record->location_id);
return view('managemerchant', ['record' => $record, 'contact' => $contact, 'records' => $records]);
}
}elseif($name)
return Redirect::to('special/form/admin');
}
return view('errors/503');
}
public function showPostMerchant($category , $title , $id)
{
$record = null;
$postsMerchant = null;
$category = str_replace('-',' ',$category);
$record = $this->apiMerchant->show($id);
if($record != null){
$city = $this->config->getNameCity($record->location_id);
$contact = $this->apiContact->show($record->contact_id);
// $postsMerchant = $this->apiManage->getContactPosts($contact->hash);
// $postsMerchant = $this->apiDiscover->recordsEditDiscover($postsMerchant);
return view('showMerchant',['records'=>$postsMerchant , 'id'=>$id,'email' => $contact->email, 'mobile' => $contact->mobile,
'category' => $category,'record' => $record, 'zaman' => $this->config->durationString($record->created_at)
,'city'=>$city ]);
}
return view('errors/503');
}
// public function destroyMerchant(Request $request){
//
// $hash = $request->get('hash');
// $id = $request->get('id');
//
//
// $merchant = $this->apiMerchant->find($id);
// if($merchant !=null){
// $contact = $this->apiContact->recoverContactFromHash($hash);
// if($merchant->contact_id == $contact->id) {
// $this->apiMerchant->destroy($id);
// $table = $this->config->getcategoryNameEn(null ,$merchant->category_id);
// $this->apiMerchant->deletePostsMerchant($merchant->sub_category_id , $contact->id ,$table);
// }
// }
// }
public function editMerchant(Request $request){
$data = $request->all($this->apiManage->requestAll($request));
$this->apiAddnew->editMerchant($data);
return Redirect::to('managemerchant');
// }
}
public function sendMaillInMerchant(Request $request){
Session::flash('message', 'Book successfully updated!');
$data = $request->all($this->apiManage->requestAll($request));
$this->apiContact->emailToUser($data);
return back()->with('message',' ');
}
// =================== GET CATEGORIES , LOCATION , PRODUCT =================
public function getcategories(){
return $this->config->getCategories();
}
public function getLocations(){
return $this->config->getLocation();
}
public function getProducts(){
$products = $this->config->getProduct();
return $products;
}
// ============ Manage =================================================
public function indexManage(){
if(Auth::check())
return Redirect::to('managemerchant');
return view('cArea');
}
public function showPostManage($category, $hash, $id)
{
$category = str_replace('-',' ',$category);
$categoryId = $this->config->getcategoryid($category);
$contact = $this->apiContact->recoverContactFromHash($hash);
$price =null;
$record = null;
if ($contact != null) {
$record = $this->apiManage->showManageRecordAllCategory($categoryId ,$id);
return view('manageRecord', ['contact' => $contact, 'category' => $category, 'record' => $record, 'price' => $record->price]);
}
return view('errors/503');
}
public function getContactPosts($hash)
{
$posts = null;
$contact = null;
$contact = $this->apiContact->recoverContactFromHash($hash);
if($contact != null){
$posts = $this->apiManage->getContactPosts($contact->id);
if(sizeof($posts)>= 1){
foreach ($posts as $post) {
$category = $this->config->getCategoryName($post->category);
$post->category = str_replace(' ','-',$category);
$post->time = $this->config->durationString($post->created_at);
$post->city_id = $this->config->getNameCity($post->city_id);
$post->url = "http://" . $_SERVER['HTTP_HOST'] .'/'. 'manageRecord' . '/' . $post->category .'/'. $contact->hash . '/' . $post->id;
}
return view('manage' , ['records'=>$posts,'message'=>'', 'contact'=>$contact]) ;}
else {
return view('manage', ['records'=>null, 'message'=>' ','contact'=>$contact]);
}
}
else{return view('errors/503');}
}
public function destroyManage(Request $request)
{
$data = $request->all($this->apiManage->requestAll($request));
$result = $this->apiAddnew->destroyfreePost($data);
if(isset($result['hash']))
return Redirect::to('manage/'.$result['hash']);
return Redirect::to('discover');
}
public function editRecord (Request $request)
{
$data = $request->all($this->apiManage->requestAll($request));
$array = $this->apiAddnew->editRecord($data ,null);
if($array['flag'] == null) {
$this->apiDiscover->destroy($array['categoryId'], $array['record']->id);
return Redirect::to('manageRecord/'.$array['category'] .'/' .$array['hash'] . '/' . $array['record']->id);
}else{
return Redirect::to('specil/form/admin');
}
}
public function sendMail(Request $request)
{
Session::flash('message', 'Book successfully updated!');
$data = $request->all($this->apiManage->requestAll($request));
$page = 'emails.email';
$array = array('email'=>$data['email'] ,'mobile'=>$data['mobile'] ,'result'=>null ,'page'=>$page);
$result = $this->apiContact->sendMail($array );
if($result != 0){
return redirect('cArea')->with('message', ' !');
}else
return redirect('cArea')->with('message', ' !');
}
// ========== Shoping Cart===============================================
public function cartAdd(Request $request)
{
$product = null;
$contact = null;
$records = null;
$factor = null;
$data = $request->all($this->apiManage->requestAll($request));
$array = $this->apiShoppingCart->finalAddToCart($data);
return view('shoppingAdd',['contact'=>$array['contact'] , 'sum'=>$array['sum'] ,'factor'=>$data['factor']]);
}
public function actionUserServices($factor_id ,$status,$totalPrice)
{
$products = null;
$shopping = $this->apiShoppingCart->findFactorId($factor_id);
if($shopping !=null) {
if ($status == 1) {
$this->apiShoppingCart->updateFactorUser($factor_id );
$products = $shopping->services;
$userServ = $this->apiShoppingCart->findUserService($factor_id);
if ($userServ == null) {
$userService = new UserServices();
$userService->id = $factor_id;
$userService->price = $totalPrice;
$userService->record_id = $shopping->record_id;
$userService->category_id = $shopping->category_id;
$userService->contact_id = $shopping->contact_id;
$userService->service_id = $products;
$this->apiShoppingCart->addService($userService);
$this->apiShoppingCart->addServiceToDiscover($shopping->record_id, $shopping->category_id, $products);
} else {
$this->apiShoppingCart->updateServiceIdUser($userServ);
$this->apiShoppingCart->addServiceToDiscover($shopping->record_id, $shopping->category_id, $products);
}
return 1;
}
}
return -1;
}
public function cartRemove($id)
{
$this->apiShoppingCart->removeCart($id);
}
// ===== Work With Photo =======================================================
public function addPhoto (Request $request){
$sessionId = session()->getId();
$photo = Input::file('photo');
$number = $request->get('numberPic');
$status = $request->get('status');
$photoFilename = null;
$name1 = substr($sessionId ,14,4);
$name2 =substr($sessionId ,25 ,4);
$counter = 0;
$photoOrder = null;
if($status == null) {
$filename1 = $photo->getClientOriginalName();
$exe = $photo->getClientOriginalExtension();
$filename1 = preg_replace('/\..+$/', '', str_replace('.'.$exe , ' ',$filename1));
$photoFilename = $this->apiPhoto->storeToTmpPhoto($photo, $name1.$filename1.$name2);
if ($photoFilename != null) {
$this->apiPhoto->insertToTempPhoto($photoFilename, $sessionId );
return response()->json('ok');
}
return response()->json('no');
}
elseif($status == 1){
$records = $this->apiPhoto->findRequestId($sessionId);
foreach($records as $record){
$counter = $counter + 1;
if($counter == $number){
$this->apiPhoto->deleteImageNumber($record->name ,$sessionId);
return 'complete delete';
}
}
return 'no session id';
}
}
public function leavingPage()
{
$sessionId = session()->getId();
$this->apiPhoto->leavingPage($sessionId);
$this->apiPhoto->destroyRecordTemp($sessionId);
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace buyboard\Http\Controllers;
use buyboard\Art;
use buyboard\Contact;
use buyboard\Electronic;
use buyboard\EmployJobs;
use buyboard\Factor;
use buyboard\Home;
use buyboard\Http\config;
use buyboard\Http\Controllers\API\APIAddNewController;
use buyboard\MerchantContacts;
use buyboard\Mlk;
use buyboard\Motor;
use buyboard\PersonalStaff;
use buyboard\Tickets;
use buyboard\User;
use buyboard\UserServices;
use buyboard\WorkService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Session;
use Psy\Command\ListCommand;
class IFaceWebController extends Controller
{
public function __construct()
{
$this->apiContact = (new API\APIContactController());
$this->apiManage = (new API\APIManagerController());
$this->apiMotor = (new API\APIMotorController());
$this->apiMlk = (new API\APIMlkController());
$this->motors = $this->apiMotor->noAcceptsList();
$this->apiElec = (new API\APIElectronicController());
$this->apiEmploy = (new API\APIEmployJobController());
$this->apiHome = (new API\APIHomeController());
$this->apiDiscover = (new API\APIDiscoverController());
$this->apiPersonal = (new API\APIPersonalController());
$this->apiWorkService = (new API\APIWorkServiceController());
$this->apiPhoto = (new API\APIPhotoController());
$this->apiArt = (new API\APIArtController());
$this->apiLocation = (new API\APILocationController());
$this->categories = $this->apiLocation->index();
$this->locations = $this->apiLocation->indexLocation();
$this->apiProduct = (new API\APIProductController());
$this->apiShoppingCart = (new API\APIShoppingCartController());
$this->apiConfirm = (new API\APIConfirmController());
$this->apiSuggest = (new API\APITicketController());
$this->config = (new config());
$this->apiMerchant =(new API\APIMerchantController());
$this->apiLogin = (new API\APILoginController());
$this->apiAddnew = (new APIAddNewController());
}
// ==================== Discover =========================================
public function getDiscover($location ,$category ,$subCategory){
$category = str_replace('-' ,' ',$category);
$subCategory = str_replace('-' ,' ',$subCategory);
$location = str_replace('-' , ' ' ,$location);
$categoryId = $this->config->getcategoryid($category);
$subCategoryId = $this->config->getcategoryid($subCategory);
$locationId = $this->config->getCityId($location);
$records = $this->apiDiscover->getRecords(0 ,config::COUNT ,null ,$categoryId ,$subCategoryId ,$locationId);
$records = $this->apiDiscover->recordsEditDiscover($records);
return response()->view('discover',['records'=>$records ,'categoryName'=>$category ,'categoryId'=>$categoryId ,
'subcategoryName'=>$subCategory ,'subcategoryId'=>$subCategoryId ,
'locationName'=>$location ,'locationId'=>$locationId ,'key'=>null]);
}
public function getDiscover2($location ,$category ){
$category = str_replace('-' , ' ' ,$category);
$location = str_replace('-' , ' ' ,$location);
$categoryId = $this->config->getcategoryid($category);
$locationId = $this->config->getCityId($location);
$records = $this->apiDiscover->getRecords(0 ,config::COUNT ,null ,$categoryId ,null,$locationId);
$records = $this->apiDiscover->recordsEditDiscover($records);
return response()->view('discover',['records'=>$records,'categoryName'=>$category ,'categoryId'=>$categoryId,
'subcategoryName'=>null ,'subcategoryId'=>null
,'locationName'=>$location ,'locationId'=>$locationId ,'key'=>null]);
}
public function getDiscover3($location ){
$value = cookie::get('locName');
Cookie::queue("location", $value, 90);
$location = str_replace('-' , ' ' ,$location);
$locationId = $this->config->getCityId($location);
$records = $this->apiDiscover->getRecords(0 ,config::COUNT ,null ,null ,null ,$locationId);
$records = $this->apiDiscover->recordsEditDiscover($records);
return response()->view('discover',['records'=>$records ,'categoryName'=>null ,'categoryId'=>null,
'subcategoryName'=>null ,'subcategoryId'=>null
,'locationName'=>$location ,'locationId'=>$locationId ,'key'=>null]);
}
public function indexDiscover()
{
$value = Cookie::get('location');
if( $value == null) {
$location = '';
}else{
$location = $value;
}
return Redirect::to('/discover'.'/'.$location);
}
public function getRecords(Request $request )
{
$data = $request->all($this->apiManage->requestAll($request));
$start = $data['start'];
$category = $data['category'];
$subCategory = $data['subCategory'];
$key = $data['key'];
$location = $data['locationId'];
$records[] = null;
$records = $this->apiDiscover->getRecords($start, config::COUNTSCROLL ,$key , $category, $subCategory ,$location);
$records = $this->apiDiscover->recordsEditDiscover($records);
return $records;
}
public function search($location , $key ){
$locationName = str_replace('-' , ' ' ,$location);
$locationId = $this->config->getCityId($locationName);
$records = $this->apiDiscover->getRecords(0 ,config::COUNTSCROLL ,$key ,null ,null ,$locationId);
$records = $this->apiDiscover->recordsEditDiscover($records);
return response()->view('discover',['records'=>$records ,'categoryName'=>null ,'categoryId'=>null,
'subcategoryName'=>null ,'subcategoryId'=>null
,'locationName'=>$location ,'locationId'=>$locationId ,'key'=>$key]);
}
// ==================== Tell Me ==========================================
public function indexAdmin(){
return view('admin');
}
public function indexSupport(){
return view('support');
}
public function indexAbout(){
return view('about');
}
public function indexNewTicket(){
return view('newticket');
}
public function indexTicket(){
return view('ticket');
}
public function getTicket(Request $request){
$this->validate($request, [
'email' => 'required|Between:3,64|email',
'description'=> 'required',
]);
$page = 'emails.suggest';
Session::flash('message', 'Book successfully updated!');
$data = $request->all($this->apiManage->requestAll($request));
$result = $this->apiSuggest->getTicket($data);
$array = array('email'=>$data['email'],'result'=>$result ,'mobile'=>null ,'page'=>$page);
if($result != null){
$resultMail = $this->apiContact->sendMail($array);
if($resultMail != 0){
return redirect('ticket')->with('message' ,' ');
}else{
return redirect('ticket')->with('message' , '');
}
}
return redirect('newticket')->with('message', ' ');
}
// ==================== SHOW ==============================================
public function showPostDiscover($category ,$title ,$id)
{
$start = 0;
$count = 5;
$record = null;
$price = null;
$counter = 0;
$category = str_replace('-',' ',$category);
$categoryId = $this->config->getcategoryid($category);
$record = $this->apiManage->showRecordAllCategory($categoryId ,$id);
if ($record != null){
$subCategory = $record->sub_category;
$cityId = $record->city_id;
$service = $this->apiShoppingCart->showCarts($id ,$categoryId);
$record->sub_category =$this->config->getCategoryName($record->sub_category) ;
$city = $this->config->getNameCity($record->city_id);
$contact = $this->apiContact->show($record->contact_id);
$records = $this->apiDiscover->getRecords($start,$count , null,$categoryId ,$subCategory ,$cityId);
foreach ($records as $recordd)
{
if($recordd->record_id == $id)
{
unset($records[$counter]);
}
$counter = $counter + 1;
}
$records = $this->apiDiscover->recordsEditDiscover($records );
return view('show',['records'=>$records ,'id'=>$id ,'email' => $contact->email, 'mobile' => $contact->mobile,
'price'=>$record->price,'category' => $category,'record' => $record, 'zaman' => $this->config->durationString($record->created_at)
,'city'=>$city ,'service'=>$service ,'subCategory'=>$record->sub_category ]);
} else
return view('errors/503');
}
public function report(Request $request){
$data = $request->all($this->apiManage->requestAll($request));
$this->apiSuggest->getRepot($data);
return Redirect::back();
}
// ==================== ADD NEW ===========================================
public function indexAddNew()
{
return response()->view('addnew', ['categories' => $this->config->CATEGORIES, 'locations'=>$this->config->LOCATION]);
}
public function addNew(Request $request)
{
$sessionId = session()->getId();
$ip = getHostByName(getHostName());
$data = $request->all($this->apiManage->requestAll($request));
$result = $this->apiAddnew->addNew($data , $sessionId ,$ip);
return Redirect::to('manageRecord'.'/'.$result['category'] .'/'.$result['hash'] .'/'.$result['record']);
}
public function indexLogin(){
return $this->apiLogin->index();
}
// ================= ADD MERCHANT =======================================
public function indexNewMerchant(){
if(Auth::check()){
$email = Auth::user()->email;
return view('newMerchant',['email'=>$email]);
}
}
public function indexAddMerchant()
{
if (Auth::check()) {
$categoryId = null;
$message = null;
$email = Auth::user()->email;
$contact = $this->apiContact->getContactForEmail($email);
if ($contact) {
$record = $this->apiMerchant->findContactMerchant($contact->id);
if($record != null)
$categoryId = $record->category_id;
}else{
$message = ' ';
}
return view('addMerchant',['category'=>$categoryId ,'message'=>$message ]);
}
}
public function newMerchant(Request $request)
{
$this->validate($request, [
'email' => 'required|Between:3,64|email',
'title' => 'required|Between:3,30',
]);
$sessionId = session()->getId();
$ip = getHostByName(getHostName());
$data = $request->all($this->apiManage->requestAll($request));
$this->apiAddnew->addMerchant($data ,$sessionId ,$ip);
return Redirect::to('managemerchant');
}
public function manageMerchant(){
if(Auth::check()) {
$email = Auth::user()->email;
$name = Auth::user()->name;
if ($name == null and $email != null) {
$contact = $this->apiContact->getContactForEmail($email);
if ($contact != null) {
$records = $this->apiManage->getContactPosts($contact->id);
if ($records) {
foreach ($records as $record) {
$category = $this->config->getCategoryName($record->category);
$record->category = str_replace(' ', '-', $category);
$record->time = $this->config->durationString($record->created_at);
$record->city_id = $this->config->getNameCity($record->city_id);
$record->url = "http://" . $_SERVER['HTTP_HOST'] . '/' . 'manageRecord' . '/' . $record->category . '/' . $contact->hash . '/' . $record->id;
}
}
$record = $this->apiMerchant->findContactMerchant($contact->id);
$record->location_id = $this->config->getNameCity($record->location_id);
return view('managemerchant', ['record' => $record, 'contact' => $contact, 'records' => $records]);
}
}elseif($name)
return Redirect::to('special/form/admin');
}
return view('errors/503');
}
public function showPostMerchant($category , $title , $id)
{
$record = null;
$postsMerchant = null;
$category = str_replace('-',' ',$category);
$record = $this->apiMerchant->show($id);
if($record != null){
$city = $this->config->getNameCity($record->location_id);
$contact = $this->apiContact->show($record->contact_id);
// $postsMerchant = $this->apiManage->getContactPosts($contact->hash);
// $postsMerchant = $this->apiDiscover->recordsEditDiscover($postsMerchant);
return view('showMerchant',['records'=>$postsMerchant , 'id'=>$id,'email' => $contact->email, 'mobile' => $contact->mobile,
'category' => $category,'record' => $record, 'zaman' => $this->config->durationString($record->created_at)
,'city'=>$city ]);
}
return view('errors/503');
}
// public function destroyMerchant(Request $request){
//
// $hash = $request->get('hash');
// $id = $request->get('id');
//
//
// $merchant = $this->apiMerchant->find($id);
// if($merchant !=null){
// $contact = $this->apiContact->recoverContactFromHash($hash);
// if($merchant->contact_id == $contact->id) {
// $this->apiMerchant->destroy($id);
// $table = $this->config->getcategoryNameEn(null ,$merchant->category_id);
// $this->apiMerchant->deletePostsMerchant($merchant->sub_category_id , $contact->id ,$table);
// }
// }
// }
public function editMerchant(Request $request){
$data = $request->all($this->apiManage->requestAll($request));
$this->apiAddnew->editMerchant($data);
return Redirect::to('managemerchant');
// }
}
public function sendMaillInMerchant(Request $request){
Session::flash('message', 'Book successfully updated!');
$data = $request->all($this->apiManage->requestAll($request));
$this->apiContact->emailToUser($data);
return back()->with('message',' ');
}
// =================== GET CATEGORIES , LOCATION , PRODUCT =================
public function getcategories(){
return $this->config->getCategories();
}
public function getLocations(){
return $this->config->getLocation();
}
public function getProducts(){
$products = $this->config->getProduct();
return $products;
}
// ============ Manage =================================================
public function indexManage(){
if(Auth::check())
return Redirect::to('managemerchant');
return view('cArea');
}
public function showPostManage($category, $hash, $id)
{
$category = str_replace('-',' ',$category);
$categoryId = $this->config->getcategoryid($category);
$contact = $this->apiContact->recoverContactFromHash($hash);
$price =null;
$record = null;
if ($contact != null) {
$record = $this->apiManage->showManageRecordAllCategory($categoryId ,$id);
return view('manageRecord', ['contact' => $contact, 'category' => $category, 'record' => $record, 'price' => $record->price]);
}
return view('errors/503');
}
public function getContactPosts($hash)
{
$posts = null;
$contact = null;
$contact = $this->apiContact->recoverContactFromHash($hash);
if($contact != null){
$posts = $this->apiManage->getContactPosts($contact->id);
if(sizeof($posts)>= 1){
foreach ($posts as $post) {
$category = $this->config->getCategoryName($post->category);
$post->category = str_replace(' ','-',$category);
$post->time = $this->config->durationString($post->created_at);
$post->city_id = $this->config->getNameCity($post->city_id);
$post->url = "http://" . $_SERVER['HTTP_HOST'] .'/'. 'manageRecord' . '/' . $post->category .'/'. $contact->hash . '/' . $post->id;
}
return view('manage' , ['records'=>$posts,'message'=>'', 'contact'=>$contact]) ;}
else {
return view('manage', ['records'=>null, 'message'=>' ','contact'=>$contact]);
}
}
else{return view('errors/503');}
}
public function destroyManage(Request $request)
{
$data = $request->all($this->apiManage->requestAll($request));
$result = $this->apiAddnew->destroyfreePost($data);
if(isset($result['hash']))
return Redirect::to('manage/'.$result['hash']);
return Redirect::to('discover');
}
public function editRecord (Request $request)
{
$data = $request->all($this->apiManage->requestAll($request));
$array = $this->apiAddnew->editRecord($data ,null);
if($array['flag'] == null) {
$this->apiDiscover->destroy($array['categoryId'], $array['record']->id);
return Redirect::to('manageRecord/'.$array['category'] .'/' .$array['hash'] . '/' . $array['record']->id);
}else{
return Redirect::to('specil/form/admin');
}
}
public function sendMail(Request $request)
{
Session::flash('message', 'Book successfully updated!');
$data = $request->all($this->apiManage->requestAll($request));
$page = 'emails.email';
$array = array('email'=>$data['email'] ,'mobile'=>$data['mobile'] ,'result'=>null ,'page'=>$page);
$result = $this->apiContact->sendMail($array );
if($result != 0){
return redirect('cArea')->with('message', ' !');
}else
return redirect('cArea')->with('message', ' !');
}
// ========== Shoping Cart===============================================
public function cartAdd(Request $request)
{
$product = null;
$contact = null;
$records = null;
$factor = null;
$data = $request->all($this->apiManage->requestAll($request));
$array = $this->apiShoppingCart->finalAddToCart($data);
return view('shoppingAdd',['contact'=>$array['contact'] , 'sum'=>$array['sum'] ,'factor'=>$data['factor']]);
}
public function actionUserServices($factor_id ,$status,$totalPrice)
{
$products = null;
$shopping = $this->apiShoppingCart->findFactorId($factor_id);
if($shopping !=null) {
if ($status == 1) {
$this->apiShoppingCart->updateFactorUser($factor_id );
$products = $shopping->services;
$userServ = $this->apiShoppingCart->findUserService($factor_id);
if ($userServ == null) {
$userService = new UserServices();
$userService->id = $factor_id;
$userService->price = $totalPrice;
$userService->record_id = $shopping->record_id;
$userService->category_id = $shopping->category_id;
$userService->contact_id = $shopping->contact_id;
$userService->service_id = $products;
$this->apiShoppingCart->addService($userService);
$this->apiShoppingCart->addServiceToDiscover($shopping->record_id, $shopping->category_id, $products);
} else {
$this->apiShoppingCart->updateServiceIdUser($userServ);
$this->apiShoppingCart->addServiceToDiscover($shopping->record_id, $shopping->category_id, $products);
}
return 1;
}
}
return -1;
}
public function cartRemove($id)
{
$this->apiShoppingCart->removeCart($id);
}
// ===== Work With Photo =======================================================
public function addPhoto (Request $request){
$sessionId = session()->getId();
$photo = Input::file('photo');
$number = $request->get('numberPic');
$status = $request->get('status');
$photoFilename = null;
$name1 = substr($sessionId ,14,4);
$name2 =substr($sessionId ,25 ,4);
$counter = 0;
$photoOrder = null;
if($status == null) {
$filename1 = $photo->getClientOriginalName();
$exe = $photo->getClientOriginalExtension();
$filename1 = preg_replace('/\..+$/', '', str_replace('.'.$exe , ' ',$filename1));
$photoFilename = $this->apiPhoto->storeToTmpPhoto($photo, $name1.$filename1.$name2);
if ($photoFilename != null) {
$this->apiPhoto->insertToTempPhoto($photoFilename, $sessionId );
return response()->json('ok');
}
return response()->json('no');
}
elseif($status == 1){
$records = $this->apiPhoto->findRequestId($sessionId);
foreach($records as $record){
$counter = $counter + 1;
if($counter == $number){
$this->apiPhoto->deleteImageNumber($record->name ,$sessionId);
return 'complete delete';
}
}
return 'no session id';
}
}
public function leavingPage()
{
$sessionId = session()->getId();
$this->apiPhoto->leavingPage($sessionId);
$this->apiPhoto->destroyRecordTemp($sessionId);
}
}
Function Calls
| None |
Stats
| MD5 | 1f24d8bb469553b68dbf5f2bb0929b60 |
| Eval Count | 0 |
| Decode Time | 110 ms |