public function installer_db_set_data()
 {
     $root_time = time();
     include PHPOS_DIR . 'config/security_key.php';
     if (empty($phpos_key) || empty($_SESSION['phpos_install_data']['root_password1'])) {
         return false;
     }
     if ($_SESSION['phpos_install_data']['root_password1'] != $_SESSION['phpos_install_data']['root_password2']) {
         // not match
     }
     global $sql;
     require PHPOS_DIR . 'install/db_schema.php';
     if (is_array($insert)) {
         foreach ($insert as $table => $record) {
             if (!$sql->insert_array($record, $table)) {
                 $_SESSION['mysql_error'] = $sql->get_error('parse');
                 $this->set_sql_error('db_update');
                 return false;
             }
         }
     }
     $usr = new phpos_users();
     $usr->set_id_user(1);
     $usr->get_user_by_id();
     $usr->set_created_at($root_time);
     $usr->set_user_email($_SESSION['phpos_install_data']['cfg_email']);
     $usr->set_raw_pass($_SESSION['phpos_install_data']['root_password1']);
     $root_pwd = $usr->generate_password();
     $usr->set_user_pass($root_pwd);
     if ($usr->update()) {
         //echo 'uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu'.$root_pwd;
         $this->set_ok('db_update');
         // home dir
         if ($usr->create_home_dir()) {
             $this->set_ok('home_dir_ok');
         } else {
             $this->set_warn('home_dir_warn');
         }
         $t = time();
         // Save config
         $cfg = new phpos_config('phpos_config');
         $cfg->update_global('lang', $_SESSION['phpos_install_data']['cfg_lang']);
         $cfg->update_global('wallpaper', $_SESSION['phpos_install_data']['cfg_wallpaper']);
         $cfg->update_global('site_title', $_SESSION['phpos_install_data']['cfg_title']);
         $cfg->update_global('root_email', $_SESSION['phpos_install_data']['cfg_email']);
         $cfg->update_global('version', PHPOS_VERSION);
         $cfg->update_global('versionnumber', PHPOS_VERSIONNUMBER);
         $cfg->update_global('build', PHPOS_BUILD);
         $cfg->update_global('install_time', $t);
         $cfg->update_global('update_time', $t);
         //$cfg->update_global('key_copy', $phpos_key);
         $cfg->set_id_user(1);
         $cfg->update_user('lang', $_SESSION['phpos_install_data']['cfg_lang']);
         $cfg->update_user('wallpaper', $_SESSION['phpos_install_data']['cfg_wallpaper']);
         $cfg->update_user('wallpaper_type', 'global');
         return true;
     } else {
         $_SESSION['mysql_error'] = $sql->get_error('parse');
         $this->set_sql_error('db_update');
     }
 }
Esempio n. 2
0
         if ($pass_now_hash == $old_pass_hash) {
             $new_usr->set_raw_pass($tmp_pass1);
             $new_pass = $new_usr->generate_password();
             $new_usr->set_user_pass($new_pass);
         } else {
             $error = 1;
             helper_result('my_update_user_result', 'result', 'error');
             helper_result('my_update_user', 'error', txt('pass_old_wrong'));
         }
     } else {
         $error = 1;
         helper_result('my_update_user_result', 'result', 'error');
         helper_result('my_update_user', 'error', txt('pass_old_need'));
     }
 }
 $new_usr->set_user_email($tmp_email);
 //if($tmp_home != 1)	$new_usr->set_nohome();
 if ($error != 1) {
     if ($new_usr->update()) {
         /*
         $new_cfg = new phpos_config('no_get');
         $new_cfg->set_id_user($user_id);
         $new_cfg->update_user('lang', $tmp_lang);
         //$new_cfg->update_user('wallpaper', globalconfig('wallpaper'));
         */
         helper_result('my_update_user', 'ok', txt('updated'));
         helper_result('my_update_user_result', 'result', 'success');
         helper_result('my_update_user_result', 'result', 'error');
     } else {
         helper_result('my_update_user_result', 'result', 'error');
         helper_result('my_update_user', 'error', txt('error'));