/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $settings = $request->all();
     unset($settings['_token']);
     \Registry::store($settings);
     return redirect()->back()->with(array('status' => 'success', 'message' => 'Configuration mises à jour'));
 }
Beispiel #2
0
function load_class($className, $type = 'Core', $surpress = FALSE)
{
    // Now we need to make sure the user supplied some sort of path
    if (strpos($className, $type) === FALSE) {
        $className = $type . '\\' . $className;
    }
    // Make a lowercase version, and a storage name
    $class = strtolower($className);
    $store_name = str_replace('\\', '_', $class);
    // Check the registry for the class, If its there, then return the class
    $loaded = \Registry::load($store_name);
    if ($loaded !== NULL) {
        return $loaded;
    }
    // ---------------------------------------------------------
    // Class not in Registry, So we load it manually and then  |
    // store it in the registry for future static use          |
    // ---------------------------------------------------------
    // We need to find the file the class is stored in. Good thing the
    // Namespaces are pretty much paths to the class ;)
    $parts = explode('\\', $class);
    $last = count($parts) - 1;
    $parts[$last] = ucfirst($parts[$last]);
    // Build our filepath
    $file = implode(DS, $parts);
    $file = SYSTEM_PATH . DS . $file . '.php';
    // Include our file. If it doesnt exists, class is un-obtainable.
    require_once $file;
    //  Initiate the new class into a variable
    try {
        $Obj = new $className();
    } catch (\Exception $e) {
        $message = $e->getMessage();
        $Obj = FALSE;
    }
    // Display error?
    if (!is_object($Obj) && !$surpress) {
        show_error('class_init_failed', array($className, $message), E_ERROR);
    }
    // Store this new object in the registery
    \Registry::store($store_name, $Obj);
    // return the object.
    return $Obj;
}
Beispiel #3
0
 public function realm($instance = TRUE)
 {
     // Get our emulator from the Config File
     $emulator = ucfirst(config('emulator'));
     $class_name = "Emulator_" . $emulator;
     // Make sure we havent loaded the lib already
     $realm = \Registry::load($class_name);
     if ($realm !== NULL) {
         goto Instance;
     }
     // Init the class if it doesnt exist
     if (!class_exists('Wowlib', false)) {
         $this->_initWowlib();
     }
     // Add debug tracer
     \Debug::trace('Loading Realm from Wowlib', __FILE__, __LINE__);
     // Fetch the emulator class
     try {
         $realm = \Wowlib::getRealm(0, 'RDB');
     } catch (\Exception $e) {
         \Debug::silent_mode(false);
         $message = 'Wowlib Error: ' . $e->getMessage();
         // Add debug tracer
         \Debug::trace($message, __FILE__, __LINE__);
         show_error($message, false, E_ERROR);
     }
     // Store the class statically and return the class
     \Registry::store($class_name, $realm);
     // Instance
     Instance:
     if ($instance == TRUE) {
         $FB = get_instance();
         if (is_object($FB)) {
             $FB->realm = $realm;
         }
     }
     // We need to make sure the realm loaded ok, or thrown an error
     if (!is_object($realm)) {
         // Add debug tracer
         $message = 'Wowlib failed to fetch realm. Assuming the realm database is offline.';
         \Debug::trace($message, __FILE__, __LINE__);
         show_error($message, false, E_ERROR);
     } else {
         \Debug::trace('Successfully fetched the realm connection from the Wowlib', __FILE__, __LINE__);
     }
     return $realm;
 }