public function postAdminAccount() { $data = Input::all(); //return View::make('install.done'); try { $user = Sentry::createUser(array('email' => $data['email'], 'password' => $data['password'], 'activated' => true, 'first_name' => $data['first_name'], 'last_name' => $data['last_name'])); $group = Sentry::findGroupByName('admin'); $user->addGroup($group); $quicknote = new \Quicknote(); $quicknote->user_id = $user->id; $quicknote->save(); $userProfile = new \UserProfile(); $userProfile->id = $user->id; $userProfile->save(); $imageResult = App::make('AuthController')->{'createUserImage'}($user->id, $data['first_name'][0], $data['last_name'][0]); $installationDate = date('Y-m-d H:i:s'); $installationHost = Request::server('PATH_INFO'); $new92fiveConfig = new NewConfig(); $new92fiveConfig->toFile(app_path() . '/config/92five.php', ['install' => true, 'version' => '1.0', 'installationDate' => $installationDate, 'installationHost' => $installationHost]); return View::make('install.done'); } catch (Exception $e) { Log::error('Something Went Wrong in Install Controller Repository - addUserWithDetails():' . $e->getMessage()); throw new Exception('Something Went Wrong in Install Controller Repository - addUserWithDetails()'); } }
public function write($item, $value, $environment, $group, $namespace = null) { $path = $this->getPath($environment, $group, $item, $namespace); if (!$path) { return false; } $contents = $this->files->get($path); $contents = $this->rewriter->toContent($contents, [$item => $value]); return !($this->files->put($path, $contents) === false); }
/** * Update Mail Settings * @return Redirect */ public function postEmailSettings() { try { $data = \Input::all(); $newMailConfig = new NewConfig(); if ($data['encryption'] == 'null') { $data['encryption'] = null; } $newMailConfig->toFile(app_path() . '/config/mail.php', ['host' => $data['host'], 'port' => $data['port'], 'from.address' => $data['senderaddress'], 'from.name' => $data['sendername'], 'username' => $data['username'], 'password' => $data['password'], 'encryption' => $data['encryption']]); return \Redirect::to('dashboard/admin')->with('status', 'success')->with('message', 'Settings Updated'); } catch (\Exception $e) { \Log::error('Something Went Wrong in Admin Controller - postEmailSettings():' . $e->getMessage()); return \Redirect::to('dashboard/admin')->with('status', 'error')->with('message', 'Something Went Wrong'); } }
public function testToContent() { $writer = new Rewrite(); /* * Rewrite a single level string */ $contents = file_get_contents(__DIR__ . '../../fixtures/Config/sample-config.php'); $contents = $writer->toContent($contents, ['url' => 'http://octobercms.com']); $result = eval('?>' . $contents); $this->assertTrue(is_array($result)); $this->assertArrayHasKey('url', $result); $this->assertEquals('http://octobercms.com', $result['url']); /* * Rewrite a second level string */ $contents = $writer->toContent($contents, ['memcached.host' => '69.69.69.69']); $result = eval('?>' . $contents); $this->assertArrayHasKey('memcached', $result); $this->assertArrayHasKey('host', $result['memcached']); $this->assertEquals('69.69.69.69', $result['memcached']['host']); /* * Rewrite a third level string */ $contents = $writer->toContent($contents, ['connections.mysql.host' => '127.0.0.1']); $result = eval('?>' . $contents); $this->assertArrayHasKey('connections', $result); $this->assertArrayHasKey('mysql', $result['connections']); $this->assertArrayHasKey('host', $result['connections']['mysql']); $this->assertEquals('127.0.0.1', $result['connections']['mysql']['host']); /* * Test alternative quoting */ $contents = $writer->toContent($contents, ['timezone' => 'The Fifth Dimension']); $contents = $writer->toContent($contents, ['timezoneAgain' => 'The "Sixth" Dimension']); $result = eval('?>' . $contents); $this->assertArrayHasKey('timezone', $result); $this->assertArrayHasKey('timezoneAgain', $result); $this->assertEquals('The Fifth Dimension', $result['timezone']); $this->assertEquals('The "Sixth" Dimension', $result['timezoneAgain']); /* * Rewrite a boolean */ $contents = $writer->toContent($contents, ['debug' => false]); $contents = $writer->toContent($contents, ['debugAgain' => true]); $contents = $writer->toContent($contents, ['bullyIan' => true]); $contents = $writer->toContent($contents, ['booLeeIan' => false]); $contents = $writer->toContent($contents, ['memcached.weight' => false]); $contents = $writer->toContent($contents, ['connections.pgsql.password' => true]); $result = eval('?>' . $contents); $this->assertArrayHasKey('debug', $result); $this->assertArrayHasKey('debugAgain', $result); $this->assertArrayHasKey('bullyIan', $result); $this->assertArrayHasKey('booLeeIan', $result); $this->assertFalse($result['debug']); $this->assertTrue($result['debugAgain']); $this->assertTrue($result['bullyIan']); $this->assertFalse($result['booLeeIan']); $this->assertArrayHasKey('memcached', $result); $this->assertArrayHasKey('weight', $result['memcached']); $this->assertFalse($result['memcached']['weight']); $this->assertArrayHasKey('connections', $result); $this->assertArrayHasKey('pgsql', $result['connections']); $this->assertArrayHasKey('password', $result['connections']['pgsql']); $this->assertTrue($result['connections']['pgsql']['password']); /* * Rewrite an integer */ $contents = $writer->toContent($contents, ['aNumber' => 69]); $result = eval('?>' . $contents); $this->assertArrayHasKey('aNumber', $result); $this->assertEquals(69, $result['aNumber']); }