예제 #1
0
 function finishedAction()
 {
     $request = new Bolts_Request($this->getRequest());
     $username = $request->username;
     $users_table = new Users();
     $user = $users_table->fetchByUsername($username);
     $password = substr(md5(rand(50000, 100000)), 0, 8);
     if (!is_null($user)) {
         $user->password = $password;
         $user->save();
         $this->view->username = $username;
         $this->view->password = $password;
         // we should never need this again, so we remove access to it.
         $roles_resources_table = new RolesResources();
         $where = $roles_resources_table->getAdapter()->quoteInto("module = ? ", "bolts");
         $where .= $roles_resources_table->getAdapter()->quoteInto(" and controller = ? ", "Install");
         $roles_resources_table->delete($where);
         $modules_table = new Modules("core");
         $modules_table->upgradeDatabase("bolts");
     } else {
         die("Somehow the admin user didn't get created or didn't get sent with the request. This is bad. Really, really bad.");
     }
 }
예제 #2
0
	$databases = new Zend_Config_Ini($config_file, 'databases');
	$dbAdapters = array();
	foreach ($databases->db as $config_name => $db)
	{
		$dbAdapters[$config_name] = Zend_Db::factory($db->adapter, $db->config->toArray());
		if ((boolean)$db->config->default)
		{
			Zend_Db_Table::setDefaultAdapter($dbAdapters[$config_name]);
		}
	}
	// Store the adapter for use anywhere in our app
	$registry = Zend_Registry::getInstance();
	$registry->set('dbAdapters', $dbAdapters);
	// check for database changes
	$modules_table = new Modules('core');
	$modules_table->upgradeDatabase("default");
	$modules_table->setDefaultConfig("default");
	$config_table = new Config();
	$config_array = $config_table->fetchall()->toArray();
	foreach ($config_array as $config_param)
	{
		Zend_Registry::set($config_param['ckey'], $config_param['value']);
	}
	// // Make session use the DB
	// Zend_Session::setSaveHandler(new RivetyCore_SessionSaveHandler());
	// Zend_Session::start();
	// Get the list of modules from the db
	$modules_table = new Modules('modules');
	$enabled_modules = $modules_table->fetchAll("is_enabled = 1");
	if (count($enabled_modules) > 0)
	{
예제 #3
0
	function finishedAction()
	{
		$request = new RivetyCore_Request($this->getRequest());
		$username = $request->username;
		$users_table = new Users();
		$user = $users_table->fetchByUsername($username);
		$password = substr(md5(rand(50000, 100000)), 0, 8);
		if (!is_null($user))
		{
			// TODO: check the referrer !
			// if this page is reloaded, the admin password is going to get reset to something random, and this page is going to get redirected - CRITICAL FIX

			$user->password = $password;
			$user->save();
			$this->view->username = $username;
			$this->view->password = $password;

			// we should never need this again, so we remove access to it.
			$roles_resources_table = new RolesResources();
			$where  = $roles_resources_table->getAdapter()->quoteInto("module = ? ", "default");
			$where .= $roles_resources_table->getAdapter()->quoteInto(" and controller = ? ", "Install");
			$roles_resources_table->delete($where);
			$modules_table = new Modules('core');
			$modules_table->upgradeDatabase('default');
		}
		else
		{
			die("Error creating admin user. Please check for errors in /logs/RivetyCore_log");
		}
		$this->view->admin_theme_url = "/core/default/views/admin/default";
		$this->view->admin_theme_global_path = Zend_Registry::get('basepath') . "/themes/admin/default/global";
	}
예제 #4
0
파일: header.php 프로젝트: jaybill/Bolts
 $constants = new Constants();
 set_include_path(get_include_path() . PATH_SEPARATOR . $config['application']['addtl_includes']);
 $databases = new Zend_Config_Ini($config_file, 'databases');
 $dbAdapters = array();
 foreach ($databases->db as $config_name => $db) {
     $dbAdapters[$config_name] = Zend_Db::factory($db->adapter, $db->config->toArray());
     if ((bool) $db->config->default) {
         Zend_Db_Table::setDefaultAdapter($dbAdapters[$config_name]);
     }
 }
 // Store the adapter for use anywhere in our app
 $registry = Zend_Registry::getInstance();
 $registry->set('dbAdapters', $dbAdapters);
 // check for database changes
 $modules_table = new Modules("core");
 $modules_table->upgradeDatabase("bolts");
 $modules_table->setDefaultConfig("bolts");
 $config_table = new Config();
 $config_array = $config_table->fetchall()->toArray();
 foreach ($config_array as $config_param) {
     Zend_Registry::set($config_param['ckey'], $config_param['value']);
 }
 // Make session use the DB
 Zend_Session::setSaveHandler(new Bolts_SessionSaveHandler());
 Zend_Session::start();
 // set up nuts
 $modules_table = new Modules("nuts");
 $enabled_modules = $modules_table->fetchAll("is_enabled = 1");
 if (count($enabled_modules) > 0) {
     foreach ($enabled_modules as $module) {
         $full_dir = $module_dir . "/" . $module->id;