Example #1
0
 /**
  * Setup the layout used by the controller.
  *
  * @return void
  */
 protected function setupLayout()
 {
     if (!is_null($this->layout)) {
         if (Request::Ajax()) {
             $this->layout = View::make('layouts.ajax');
         } else {
             $this->layout = View::make($this->layout);
         }
         $this->layout->content = " ";
     }
 }
 public function status()
 {
     if (!\Request::Ajax()) {
         return \View::make('404');
     } else {
         $id = \Input::get('id');
         $val = \Input::get('value');
         $data = array('show' => $val);
         $this->cate->update($id, $data);
         // return \Respone::json(array('status'=>''))
     }
 }
    if (Auth::check()) {
        return Redirect::to('/');
    }
});
/*
|--------------------------------------------------------------------------
| CSRF Protection Filter
|--------------------------------------------------------------------------
|
| The CSRF filter is responsible for protecting your application against
| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/
Route::filter('csrf', function () {
});
/**
 * Custom 404 page
 */
App::missing(function ($exception) {
    //    return Response::view('error404', array(), 404);
});
App::error(function (Exception $exception) {
    //    return Response::view('error404', array(), 404);
});
Route::filter('role_access', function () {
    var_dump(Auth::user()->role);
    if (!Request::Ajax() && Auth::user()->role !== 'admin' && Auth::user()->role !== 'client') {
        return View::make('access_denied');
    }
});
Example #4
0
    $error_logs_dir = storage_path() . '/logs';
    // send the error to me and pascal
    $error = md5($exception->getMessage() . ' 2554');
    $error_file = $error_logs_dir . '/error_' . $error . '.log';
    if (!file_exists($error_file)) {
        file_put_contents($error_file, $exception->getMessage());
        $fileNumber = Session::get('fileNumber');
        $error_txt = "File #: " . $fileNumber . "\n";
        $error_txt .= "File: " . $exception->getFile() . ":" . $exception->getLine() . "\n\n";
        $error_txt .= nl2br($exception->getMessage());
        # PRZ
        @mail('*****@*****.**', 'Error occured: ' . $exception->getFile(), $error_txt, "From: error@" . $_SERVER['HTTP_HOST']);
    }
});
App::missing(function ($exception) {
    if (Request::Ajax()) {
        $layout = \View::make('layouts.ajax');
    } else {
        $layout = \View::make('layouts.master');
    }
    $layout->content = \View::make('error404');
    return Response::make($layout, 404);
});
/*
|--------------------------------------------------------------------------
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
| to the user if maintenance mode is in effect for the application.
Example #5
0
    		{
    			if (beforeelemet.data('step-number'))
    			{
    				var stepnumber = beforeelemet.data('step-number');

    				//jQuery('*[data-step-number="step3"]').ScrollTo();
    				jQuery('.wizard-content',beforeelemet).slideUp(function(){ jQuery(element).ScrollTo(); });

    			}
    			//    			jQuery(beforeelemet).scrollUp();
    		}
    	}

    }
    <?php 
if (!Request::Ajax()) {
    ?>
    	jQuery('#returning_check_box').on('change',function(){
    		var checked = jQuery(this).is(':checked');

    		if (checked)
    		{
    			jQuery('#returning_client').removeClass('hidden');
    		}
    		else
    		jQuery('#returning_client').addClass('hidden');

    	});
    	jQuery('.form-content').on('submit', 'form.ajaxcheck', function(e){
    		e.preventDefault();
    		form = this;
Example #6
0
 public function UpdateClientDocument()
 {
     $this->layout->hide_returning_customer = true;
     $this->layout->hide_greeting = true;
     $product_id = intval(Input::get('pid'));
     if ($product_id) {
         $this->System_UpdateClientDocument_By_Product($product_id);
         // success
         if (Request::Ajax()) {
             return array('success' => true);
         } else {
             return "1";
         }
     }
 }
Example #7
0
 /**
  * This function is called when you are only updating your documents.
  * It will send the product id in the GET request ?pid=<product>,
  * it does check purchased documents before updating status so if anyone figures out how our system works they still can not give documents to them self.
  * @return array|string
  */
 public function UpdateClientDocument()
 {
     $this->layout->hide_returning_customer = true;
     $this->layout->hide_greeting = true;
     $Client = $this->GetClientFromSession(true);
     // make sure this client has purchased this product
     $product_id = intval(Input::get('pid'));
     if ($product_id && intval($Client->TProperties->products_already_purchased) & $product_id) {
         $this->System_UpdateClientDocument_By_Product($product_id);
         // success
         if (Request::Ajax()) {
             return array('success' => true);
         } else {
             return "1";
         }
     } else {
         if (Request::Ajax()) {
             return array('success' => false);
         } else {
             return "0";
         }
     }
 }
Example #8
0
 public function Post_Merchant_LFT_SaveFormData()
 {
     // associate the post fields with the actual fields in lead trac, and have nothing left to do.
     // voila.
     $Fields = Input::get('ltf');
     $Step = Input::get('merchant.step');
     $UpdateClientStatus = Input::get('merchant.status');
     $Required_Fields = explode('|', Input::get('merchant.fields'));
     $ValidationRules = array();
     /// here's our pages by step:
     $Pages = [];
     $Pages[1] = 'office/merchant';
     $Pages[2] = 'office/merchant/cart';
     $Page_Saved_From = isset($Pages[$Step]) && $Pages[$Step] ? $Pages[$Step] : $Pages[1];
     foreach ($Required_Fields as $Required_Field) {
         if (stristr($Required_Field, 'email')) {
             $ValidationRules['ltf.' . $Required_Field] = 'required|email';
         } else {
             if (Input::get('merchant.vr.' . $Required_Field)) {
                 $ValidationRules['ltf.' . $Required_Field] = Input::get('merchant.vr.' . $Required_Field);
             } else {
                 $ValidationRules['ltf.' . $Required_Field] = 'required|min:1';
             }
         }
     }
     $Validate = Validator::make(Input::all(), $ValidationRules);
     if ($Validate->fails()) {
         return Redirect::to($Page_Saved_From)->withErrors($Validate);
     }
     /// get the fields we're updating
     if (is_array($Fields)) {
         // we should update the tracking field to keep our client close ;0
         $Fields[$this->tracking_field_name] = $this->tracking_field_value;
         $Fields['SYSTEM_SIGNUP_TYPE'] = "MERCHANT";
         if (isset($Fields['HomeNumber'])) {
             $Fields['HomeNumber'] = str_replace(['(', ')', '-', ' '], ['', '', '', ''], $Fields['HomeNumber']);
         }
         $fileNumber = $this->leadtracapi->CreateOrUpdateClient($this->campaignId, $Fields, $this->Merchant_GetSelectedClientFileNumber());
         if ($fileNumber) {
             $this->Merchant_SetSelectedClient($fileNumber);
         } else {
             return $this->RedirectWithError($Page_Saved_From, "Error, Client File Number wasn't returned after being saved.");
         }
     } else {
         return $this->RedirectWithError($Page_Saved_From, "Error, you must provide which fields to update.");
     }
     /**
      * Check that we've got a file number before attempting to go any farther.
      */
     if ($fileNumber) {
         if (!is_array($UpdateClientStatus) && $UpdateClientStatus != "") {
             $UpdateClientStatus = array($UpdateClientStatus);
         }
         if (is_array($UpdateClientStatus)) {
             foreach ($UpdateClientStatus as $Status) {
                 // Update the client's status. to each of these (or it's just one)
             }
         }
         $this->Merchant_GetSelectedClient(false, false);
     }
     // reset our cached version to the newest
     switch (intval($Step)) {
         default:
         case 1:
             if (Request::Ajax()) {
                 $url = "office/merchant/cart/{$fileNumber}";
             } else {
                 $url = "office/merchant/signup/{$fileNumber}";
             }
             break;
     }
     return Redirect::to($url);
 }