public function editUser($post) { $id = (int) $post['id']; $query = array('login' => trim($post['name']), 'access' => $post['access']); if ($post['pass'] !== '') { $query['pass'] = hashGenerate(strtolower(trim($_POST['pass']))); } Fx::db()->update(Fx::service_context()->namespace['user'], $query, array('id' => $id)); $name = $query['login']; if ($this->isSelfMethod()) { setSystemMessage('good', 'Данные пользователя <b>' . $name . '</b> были изменены'); load_url(); } else { return $query; } }
Fx::service_context()->config = array(); Fx::service_context()->config['db'] = $_POST['db']; if (Fx::db()->isConnect()) { $_SESSION['dbConfig'] = $_POST['db']; echo 1; } else { echo 0; } die; } if (isset($_POST['saveConfig'])) { $dbConfig = array('db' => $_SESSION['dbConfig'], 'project_name' => $_POST['project_name'], 'templating' => $_POST['templating']); Fx::service_context()->config = array_merge(Fx::service_context()->config, array('db' => array_merge(Fx::service_context()->config['db'], $_SESSION['dbConfig']), 'project_name' => $_POST['project_name'], 'templating' => $_POST['templating'])); if (Fx::db()->isConnect()) { $login = trim($_POST['user']['login']); $pass = hashGenerate(strtolower(trim($_POST['user']['pass']))); foreach ($manifest['baseCollection'] as $k => $v) { Fx::db()->createCollection(array('name' => Fx::service_context()->namespace[$k], 'row' => $v)); } $find = Fx::db()->find(Fx::service_context()->namespace['user'], array('login' => $login, 'pass' => $pass)); if (count($find)) { Fx::db()->update(Fx::service_context()->namespace['user'], array('access' => 0), array('id' => $find[0]['id'])); } else { Fx::db()->insert(Fx::service_context()->namespace['user'], array('login' => $login, 'pass' => $pass, 'access' => 0)); } Fx::io()->create_file(root . '/config.php'); Fx::io()->write(root . '/config.php', '<? return $config = ' . Fx::io()->arrayToString(Fx::service_context()->config) . '; ?>'); $folderFrom = root . '/install/templating/' . Fx::service_context()->config['templating'] . '/'; $folderTo = root . '/' . Fx::service_context()->config['folder']['template'] . '/'; if (!is_dir($folderTo)) { Fx::io()->create_dir($folderTo);