/**
  * Flash a general message to the session data.
  *
  * This method allows you to conveniently pass messages to views.
  *
  * <code>
  *		// Redirect and flash messages to the session
  *		return Redirect::to('item_list')->with_message('Your item was added.');
  *
  *    // Flash a message with a type
  *		return Redirect::to('item_list')->with_message('Your item was added.', 'success');
  * </code>
  * 
  * @param  string $text
  * @param  string $type
  * @return Redirect
  */
 public function with_message($text, $type = '')
 {
     $messages = Session::get('messages', new TypedMessages());
     $messages->add_typed($text, $type);
     Session::flash('messages', $messages);
     return $this;
 }
Пример #2
0
 protected function getPersistentData($key, $default = false)
 {
     if (!in_array($key, self::$kSupportedKeys)) {
         self::errorLog('Unsupported key passed to getPersistentData.');
         return $default;
     }
     $session_var_name = $this->constructSessionVariableName($key);
     return Session::get($session_var_name, $default);
 }
Пример #3
0
 /**
  * Create a new login auth driver instance.
  *
  * @return void
  */
 public function __construct()
 {
     if (Session::started()) {
         $this->token = Session::get($this->token());
     }
     // If a token did not exist in the session for the user, we will attempt
     // to load the value of a "remember me" cookie for the driver, which
     // serves as a long-lived client side authenticator for the user.
     if (is_null($this->token)) {
         $this->token = $this->recall();
     }
 }
Пример #4
0
 public function __construct()
 {
     // If a session driver has been specified, we will bind an instance of the
     // module error message container. If an error instance
     // exists in the session, we will use that instance.
     if (!isset(static::$errors)) {
         if (Session::started() and Session::has('errors')) {
             static::$errors = Session::get('errors');
         } else {
             static::$errors = new Messages();
         }
     }
 }
Пример #5
0
 public function __construct($view, $data = array())
 {
     parent::__construct($view, $data);
     // If a session driver has been specified, we will bind an instance of the
     // message container to every view. If a container instance
     // exists in the session, we will use that instance.
     $key = 'messages';
     if (!isset($this->data[$key])) {
         if (Session::started() and Session::has($key)) {
             $this->data[$key] = Session::get($key);
         } else {
             $this->data[$key] = new TypedMessages();
         }
     }
 }
Пример #6
0
 /**
  * Create a new view instance.
  *
  * <code>
  *		// Create a new view instance
  *		$view = new View('home.index');
  *
  *		// Create a new view instance of a bundle's view
  *		$view = new View('admin::home.index');
  *
  *		// Create a new view instance with bound data
  *		$view = new View('home.index', array('name' => 'Taylor'));
  * </code>
  *
  * @param  string  $view
  * @param  array   $data
  * @return void
  */
 public function __construct($view, $data = array())
 {
     $this->view = $view;
     $this->data = $data;
     $this->path = $this->path($view);
     // If a session driver has been specified, we will bind an instance of the
     // validation error message container to every view. If an errors instance
     // exists in the session, we will use that instance.
     //
     // This makes error display in the view extremely convenient, since the
     // developer can always assume they have a message container instance
     // available to them in the view's variables.
     if (!isset($this->data['errors'])) {
         if (Session::started() and Session::has('errors')) {
             $this->data['errors'] = Session::get('errors');
         } else {
             $this->data['errors'] = new Messages();
         }
     }
 }
Пример #7
0
 /**
  * Create a new view instance.
  *
  * <code>
  *		// Create a new view instance
  *		$view = new View('home.index');
  *
  *		// Create a new view instance of a bundle's view
  *		$view = new View('admin::home.index');
  *
  *		// Create a new view instance with bound data
  *		$view = new View('home.index', array('name' => 'Taylor'));
  * </code>
  *
  * @param  string  $view
  * @param  array   $data
  * @return void
  */
 public function __construct($view, $data = array())
 {
     $this->view = $view;
     $this->data = $data;
     // In order to allow developers to load views outside of the normal loading
     // conventions, we'll allow for a raw path to be given in place of the
     // typical view name, giving total freedom on view loading.
     if (starts_with($view, 'path: ')) {
         $this->path = substr($view, 6);
     } else {
         $this->path = $this->path($view);
     }
     // If a session driver has been specified, we will bind an instance of the
     // validation error message container to every view. If an error instance
     // exists in the session, we will use that instance.
     if (!isset($this->data['errors'])) {
         if (Session::started() and Session::has('errors')) {
             $this->data['errors'] = Session::get('errors');
         } else {
             $this->data['errors'] = new Messages();
         }
     }
 }
 /**
  * {@inheritdoc}
  * */
 public function get($name)
 {
     return Session::get($this->namespace . '.' . $name);
 }
Пример #9
0
 /**
  * Method for displaying all notifications that have been added on the previous request.
  *
  * <code>
  *		// Add a info notification that will show for 3 seconds with a close button
  *		echo Notification::show();
  * </code>
  * 
  * @author Nick <*****@*****.**>
  */
 public static function show()
 {
     $notifications = Session::get('notifications');
     if (count($notifications) > 0) {
         return View::make('admin::layouts.notifications')->with('notifications', $notifications);
     }
 }
Пример #10
0
 public function getOpenChats()
 {
     // TODO: Remove hack
     $chats = Session::get('chats', array(2));
     // Testing hack
     $chats_content = array();
     foreach ($chats as $chat) {
         $chats_content[$chat] = $this->messages($chat)->get();
     }
     return $chats_content;
 }
Пример #11
0
 /**
  * __construct
  *
  * @return void
  */
 public function __construct()
 {
     $this->errors = Session::has('errors') ? Session::get('errors') : new Messages();
 }
Пример #12
0
 private static function _do_user($user)
 {
     // Set the user.
     unset($user['UsersPassword']);
     Me::set($user);
     // Set the account.
     $account_id = Session::get('AccountId');
     Me::set_account(\Accounts::get_by_id($account_id));
 }
Пример #13
0
 public static function required_database_version($type = 'mysql', $version = '5.0')
 {
     // Server version
     if ($type == 'mysql') {
         // Retrieve the database settings from the session
         $server = Session::get('mysql_hostname') . ':' . Session::get('mysql_port');
         $username = Session::get('mysql_username');
         $password = Session::get('mysql_password');
         if (empty($port) or !is_integer($port)) {
             $port = 3306;
         }
         if (!empty($server) and !empty($username) and !empty($password)) {
             // Connect to MySQL
             if ($db = @mysql_connect($server, $username, $password)) {
                 //self::$mysql_server_version = @mysql_get_server_info($db);
                 $mysql_server_version = preg_replace('/[^0-9\\.]/', '', @mysql_get_server_info($db));
                 // Close the connection
                 @mysql_close($db);
                 // If the MySQL server version is at least version 5 return TRUE, else FALSE
                 return $mysql_server_version >= $version ? TRUE : FALSE;
             } else {
                 @mysql_close($db);
                 return false;
             }
         }
         return false;
     }
     if ($type == 'posertgere') {
         return false;
     }
 }
Пример #14
0
 public function __construct()
 {
     if (Session::started()) {
         $this->token = Session::get($this->token());
     }
     if (is_null($this->token)) {
         $this->token = $this->recall();
     }
 }
Пример #15
0
 public static function old($key = null, $default = null)
 {
     return array_get(Session::get(Input::old_input, array()), $key, $default);
 }
Пример #16
0
 /**
  * Shopping cart initializer.
  *
  * @access   public
  * @return   void
  */
 public function __construct($cart_name = null)
 {
     // Store the cart name.
     //
     $this->cart_name = is_null($cart_name) ? Config::get('cartify::cart.cart_name') : $cart_name;
     // Grab the shopping cart array from the session.
     //
     array_set($this->cart_contents, $this->cart_name, Session::get($this->cart_name));
     // We don't have any cart session, set some base values.
     //
     if (is_null(array_get($this->cart_contents, $this->cart_name, null))) {
         array_set($this->cart_contents, $this->cart_name, array('cart_total' => 0, 'total_items' => 0));
     }
 }
Пример #17
0
 /**
  * Create a new module instance.
  *
  * <code>
  *      // Create a new module instance
  *      $module = new Modules\Module('registration');
  *
  *      // Create a new module instance with a path
  *      $module = new Modules\Module('registration', 'registration/extended');
  *
  *      // Create a new module instance with a full path
  *      $module = new Modules\Module('registration', 'path: /var/www/project/registration');
  * </code>
  *
  * @param  string  $module
  * @param  string  $path
  * @return void
  */
 public function __construct($module_slug, $path = null)
 {
     $this->slug = $module_slug;
     $ins = \Laravel\Config::get('installed_modules.' . $module_slug);
     $this->installed = isset($ins) and !empty($ins) ? true : false;
     $this->enabled = \Laravel\Bundle::exists($this->slug);
     $this->installer = Installer::make($module_slug);
     // if path starts with "path: "
     // its a custom path
     if (!isset($path)) {
         $this->path = path('bundle') . $this->slug . DS;
     } else {
         if (starts_with($path, 'path: ')) {
             $this->path = substr($path, 6);
         } else {
             // sets the path to modules
             // folder + path
             // module with different folder name?
             $this->path = path('bundle') . $path;
         }
     }
     // If a session driver has been specified, we will bind an instance of the
     // module error message container. If an error instance
     // exists in the session, we will use that instance.
     if (!isset($this->errors)) {
         if (Session::started() and Session::has('errors')) {
             $this->errors = Session::get('errors');
         } else {
             $this->errors = new Messages();
         }
     }
 }
Пример #18
0
 /**
  * Unserialize the model's field data from a session
  */
 private static function unserialize_from_session()
 {
     if (Session::has('serialized_field_data[' . get_called_class() . ']')) {
         static::$field_data = unserialize(Session::get('serialized_field_data[' . get_called_class() . ']'));
     }
 }
 public static function calcSessionQuotationCurrentValue($upTo)
 {
     $price = 0;
     // Init stage
     $layout = \Laravel\Session::get('quote_layout');
     $price = $layout->cost;
     $deliveryData = self::calcDeliver();
     $price = $price + $deliveryData['price'];
     if ($upTo == "init") {
         return (double) $price;
     }
     // Customise stage - Stage 1
     $price = $price + \Laravel\Session::get('quote_customise_swap_window', 0) * QuotationPriceAdjustments::getPrice('swap_window_wall');
     $price = $price + \Laravel\Session::get('quote_customise_swap_wall', 0) * QuotationPriceAdjustments::getPrice('swap_wall_window');
     $price = $price + \Laravel\Session::get('quote_customise_extra_door', 0) * QuotationPriceAdjustments::getPrice('add_extra_door');
     $price = $price + \Laravel\Session::get('quote_customise_fanlight', 0) * QuotationPriceAdjustments::getPrice('add_fanlight_window');
     $price = $price + \Laravel\Session::get('quote_customise_half_window', 0) * QuotationPriceAdjustments::getPrice('add_half_window');
     $price = $price + \Laravel\Session::get('quote_customise_picture_window', 0) * QuotationPriceAdjustments::getPrice('add_1820_window');
     if ($upTo == "customise") {
         return (double) $price;
     }
     // Decking / Flyover stage - Stage 2
     $price = $price + \Laravel\Session::get('quote_decking_composite_deck_910_910', 0) * QuotationPriceAdjustments::getPrice('composite_deck_910_910');
     $price = $price + \Laravel\Session::get('quote_decking_composite_deck_910_1820', 0) * QuotationPriceAdjustments::getPrice('composite_deck_910_1820');
     $price = $price + \Laravel\Session::get('quote_decking_composite_deck_910_2730', 0) * QuotationPriceAdjustments::getPrice('composite_deck_910_2730');
     $price = $price + \Laravel\Session::get('quote_decking_flyover_roof_910_910', 0) * QuotationPriceAdjustments::getPrice('flyover_roof_910_910');
     $price = $price + \Laravel\Session::get('quote_decking_flyover_roof_910_1820', 0) * QuotationPriceAdjustments::getPrice('flyover_roof_910_1820');
     $price = $price + \Laravel\Session::get('quote_decking_flyover_roof_910_2730', 0) * QuotationPriceAdjustments::getPrice('flyover_roof_910_2730');
     if ($upTo == "deckingflyover") {
         return (double) $price;
     }
     // Electrics stage - Stage 3
     $price = $price + \Laravel\Session::get('quote_electrics_double_sockets_450', 0) * QuotationPriceAdjustments::getPrice('electrics_double_sockets_450');
     $price = $price + \Laravel\Session::get('quote_electrics_double_sockets_1150', 0) * QuotationPriceAdjustments::getPrice('electrics_double_sockets_1150');
     $price = $price + \Laravel\Session::get('quote_electrics_light_switch', 0) * QuotationPriceAdjustments::getPrice('electrics_light_switch');
     $price = $price + \Laravel\Session::get('quote_electrics_panel_heater', 0) * QuotationPriceAdjustments::getPrice('electrics_panel_heater');
     $price = $price + \Laravel\Session::get('quote_electrics_double_floor_socket', 0) * QuotationPriceAdjustments::getPrice('electrics_double_floor_socket');
     $price = $price + \Laravel\Session::get('quote_electrics_fused_spur_socket', 0) * QuotationPriceAdjustments::getPrice('electrics_fused_spur_socket');
     if ($upTo == "electrics") {
         return (double) $price;
     }
     // Electrics stage - Stage 4
     $price = $price + \Laravel\Session::get('quote_internals_silver_aluminium_venitian_blind_no_screws', 0) * QuotationPriceAdjustments::getPrice('silver_aluminium_venitian_blind_no_screws');
     $price = $price + \Laravel\Session::get('quote_internals_recessed_blinds', 0) * QuotationPriceAdjustments::getPrice('recessed_blinds');
     $price = $price + \Laravel\Session::get('quote_internals_internal_910_partition_wall', 0) * QuotationPriceAdjustments::getPrice('internal_910_partition_wall');
     $price = $price + \Laravel\Session::get('quote_internals_internal_door_dividing_studio', 0) * QuotationPriceAdjustments::getPrice('internal_door_dividing_studio');
     $price = $price + \Laravel\Session::get('quote_internals_internal_wall_corner_post', 0) * QuotationPriceAdjustments::getPrice('internal_wall_corner_post');
     if ($upTo == "interior") {
         return (double) $price;
     }
     // Other stage - Stage 5
     $price = $price + \Laravel\Session::get('quote_other_decoupled_floor', 0) * QuotationPriceAdjustments::getPrice('other_decoupled_floor');
     $price = $price + \Laravel\Session::get('quote_other_aquastep_oak_floor', 0) * QuotationPriceAdjustments::getPrice('other_aquastep_oak_floor');
     $price = $price + \Laravel\Session::get('quote_other_walls_to_timber', 0) * QuotationPriceAdjustments::getPrice('other_walls_to_timber');
     $price = $price + \Laravel\Session::get('quote_other_taller_walls', 0) * QuotationPriceAdjustments::getPrice('other_taller_walls');
     $price = $price + \Laravel\Session::get('quote_other_entry_steps', 0) * QuotationPriceAdjustments::getPrice('other_entry_steps');
     $price = $price + \Laravel\Session::get('quote_other_entry_handrail', 0) * QuotationPriceAdjustments::getPrice('other_entry_handrail');
     $price = $price + \Laravel\Session::get('quote_other_skirt', 0) * QuotationPriceAdjustments::getPrice('other_skirt');
     if ($upTo == "other") {
         return (double) $price;
     }
     return $price;
 }
 private function saveQuote(Customer $customer)
 {
     // Create new or update existing
     if (\Laravel\Session::get('quote_id')) {
         $quote = Quotation::find(\Laravel\Session::get('quote_id'));
     } else {
         $quote = new Quotation();
         $quote->quick_access_code = md5(md5($customer->id) . time() . md5($quote->id));
     }
     $quote->customer_id = $customer->id;
     $quote->quotation_layouts_id = \Laravel\Session::get('quote_layout_id');
     $quote->postcode = \Laravel\Session::get('quote_postcode');
     $quote->price = Quotation::calcSessionQuotationCurrentValue();
     $quote->quote_customise_swap_window = \Laravel\Session::get('quote_customise_swap_window');
     $quote->quote_customise_swap_wall = \Laravel\Session::get('quote_customise_swap_wall');
     $quote->quote_customise_extra_door = \Laravel\Session::get('quote_customise_extra_door');
     $quote->quote_customise_fanlight = \Laravel\Session::get('quote_customise_fanlight');
     $quote->quote_customise_half_window = \Laravel\Session::get('quote_customise_half_window');
     $quote->quote_customise_picture_window = \Laravel\Session::get('quote_customise_picture_window');
     $quote->quote_decking_composite_deck_910_910 = \Laravel\Session::get('quote_decking_composite_deck_910_910');
     $quote->quote_decking_composite_deck_910_1820 = \Laravel\Session::get('quote_decking_composite_deck_910_1820');
     $quote->quote_decking_composite_deck_910_2730 = \Laravel\Session::get('quote_decking_composite_deck_910_2730');
     $quote->quote_decking_flyover_roof_910_910 = \Laravel\Session::get('quote_decking_flyover_roof_910_910');
     $quote->quote_decking_flyover_roof_910_1820 = \Laravel\Session::get('quote_decking_flyover_roof_910_1820');
     $quote->quote_decking_flyover_roof_910_2730 = \Laravel\Session::get('quote_decking_flyover_roof_910_2730');
     $quote->quote_electrics_double_sockets_450 = \Laravel\Session::get('quote_electrics_double_sockets_450');
     $quote->quote_electrics_double_sockets_1150 = \Laravel\Session::get('quote_electrics_double_sockets_1150');
     $quote->quote_electrics_light_switch = \Laravel\Session::get('quote_electrics_light_switch');
     $quote->quote_electrics_panel_heater = \Laravel\Session::get('quote_electrics_panel_heater');
     $quote->quote_electrics_double_floor_socket = \Laravel\Session::get('quote_electrics_double_floor_socket');
     $quote->quote_electrics_fused_spur_socket = \Laravel\Session::get('quote_electrics_fused_spur_socket');
     $quote->quote_internals_silver_aluminium_venitian_blind_no_screws = \Laravel\Session::get('quote_internals_silver_aluminium_venitian_blind_no_screws');
     $quote->quote_internals_recessed_blinds = \Laravel\Session::get('quote_internals_recessed_blinds');
     $quote->quote_internals_internal_910_partition_wall = \Laravel\Session::get('quote_internals_internal_910_partition_wall');
     $quote->quote_internals_internal_door_dividing_studio = \Laravel\Session::get('quote_internals_internal_door_dividing_studio');
     $quote->quote_internals_internal_wall_corner_post = \Laravel\Session::get('quote_internals_internal_wall_corner_post');
     $quote->quote_other_decoupled_floor = \Laravel\Session::get('quote_other_decoupled_floor');
     $quote->quote_other_aquastep_oak_floor = \Laravel\Session::get('quote_other_aquastep_oak_floor');
     $quote->quote_other_walls_to_timber = \Laravel\Session::get('quote_other_walls_to_timber');
     $quote->quote_other_taller_walls = \Laravel\Session::get('quote_other_taller_walls');
     $quote->quote_other_entry_steps = \Laravel\Session::get('quote_other_entry_steps');
     $quote->quote_other_entry_handrail = \Laravel\Session::get('quote_other_entry_handrail');
     $quote->quote_other_skirt = \Laravel\Session::get('quote_other_skirt');
     $quote->save();
     return $quote;
 }
Пример #21
0
 public function validate_test_db_connection()
 {
     $this->adm_lang = Session::get('adm_lang');
     $this->messages['test_db_connection'] = __('install::lang.Unable to connect to database')->get($this->adm_lang);
     return Installer::test_db_connection(Input::all());
 }