************************** */ require_once PHPOS_DIR . 'config/core.php'; require_once PHPOS_DIR . 'config/database.php'; require_once PHPOS_DIR . 'classes/class.phpos_filters.php'; if (file_exists(PHPOS_DIR . 'config/security_key.php')) { include PHPOS_DIR . 'config/security_key.php'; define('PHPOS_KEY', $phpos_key); } /* ************************** */ require_once PHPOS_DIR . 'controllers/databaseController.php'; require_once PHPOS_DIR . 'classes/class.users.php'; require_once PHPOS_DIR . 'classes/class.phpos_config.php'; $config = new phpos_config(); $config->set_id_user(); require_once PHPOS_DIR . 'classes/class.helpers.php'; require_once PHPOS_DIR . 'classes/class.phpos_logs.php'; $phpos_log = new phpos_logs(); /* ************************** */ define("PHPOS_SYSTEM_LANG", cfg::get('lang')); define("PHPOS_USER_LANG", cfg::uget('lang')); require_once PHPOS_DIR . 'classes/class.languages.php'; require_once PHPOS_DIR . 'controllers/languageController.php'; require_once PHPOS_DIR . 'common/functions.php'; require_once PHPOS_DIR . 'classes/class.api_wintask.php'; require_once PHPOS_DIR . 'classes/class.api_processes.php'; require_once PHPOS_DIR . 'controllers/helpersController.php';
define('PHPOS', true); define('PHPOS_DIR', '../'); define('PHPOS_URL', '../_phpos/'); define('PHPOS_WEBROOT', ''); define('PHPOS_WEBROOT_URL', ''); define('PHPOS_WEBROOT_DIR', '../../web/'); define('PHPOS_APPS_DIR', PHPOS_DIR . 'apps/'); define('PHPOS_APPS_URL', PHPOS_DIR . 'apps/'); define('PHPOS_IN_LOADER', true); require_once PHPOS_DIR . 'config/core.php'; require_once PHPOS_DIR . 'config/database.php'; // Load all classes and functions require_once PHPOS_DIR . 'controllers/databaseController.php'; require_once PHPOS_DIR . 'classes/class.users.php'; require_once PHPOS_DIR . 'classes/class.phpos_config.php'; $config = new phpos_config(); //$config->get_logged_user(); $config->set_id_user(); require_once PHPOS_DIR . 'classes/class.helpers.php'; define("PHPOS_SYSTEM_LANG", cfg::get('lang')); define("PHPOS_USER_LANG", cfg::uget('lang')); require_once PHPOS_DIR . 'classes/class.api_wintask.php'; require_once PHPOS_DIR . 'classes/class.api_processes.php'; require_once PHPOS_DIR . 'classes/class.languages.php'; require_once PHPOS_DIR . 'controllers/languageController.php'; require_once PHPOS_DIR . 'controllers/helpersController.php'; require_once PHPOS_DIR . 'classes/class.phpos_tasks.php'; if (!empty($_GET['action'])) { switch (filter::alfas($_GET['action'])) { case 'update': if (globalconfig('demo_mode') != 1 || is_root()) {
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'); } }
define('PHPOS_WEBROOT', ''); define('PHPOS_WEBROOT_URL', ''); define('PHPOS_WEBROOT_DIR', '../../web/'); define('PHPOS_APPS_DIR', PHPOS_DIR . 'apps/'); define('PHPOS_APPS_URL', PHPOS_DIR . 'apps/'); define('PHPOS_IN_LOADER', true); define('PHPOS_HOME_DIR', PHPOS_WEBROOT_DIR . 'home/'); define('PHPOS_HOME_URL', PHPOS_WEBROOT_URL . 'home/'); require_once PHPOS_DIR . 'config/core.php'; require_once PHPOS_DIR . 'config/database.php'; // Load all classes and functions require_once PHPOS_DIR . 'controllers/databaseController.php'; require_once PHPOS_DIR . 'classes/class.phpos_filters.php'; require_once PHPOS_DIR . 'classes/class.users.php'; require_once PHPOS_DIR . 'classes/class.phpos_config.php'; $config = new phpos_config(); $config->set_id_user(); require_once PHPOS_DIR . 'classes/class.helpers.php'; define("PHPOS_SYSTEM_LANG", cfg::get('lang')); define("PHPOS_USER_LANG", cfg::uget('lang')); require_once PHPOS_DIR . 'classes/class.api_wintask.php'; require_once PHPOS_DIR . 'classes/class.api_processes.php'; require_once PHPOS_DIR . 'classes/class.languages.php'; require_once PHPOS_DIR . 'controllers/helpersController.php'; define('THEME_DIR', PHPOS_WEBROOT_DIR . '_phpos/themes/' . globalconfig('theme') . '/'); define('THEME_URL', PHPOS_WEBROOT_URL . '_phpos/themes/' . globalconfig('theme') . '/'); require_once PHPOS_DIR . 'controllers/languageController.php'; require_once PHPOS_DIR . 'classes/class.phpos_tasks.php'; require_once PHPOS_DIR . 'classes/class.phpos_startmenu.php'; if (!empty($_GET['action'])) { switch (filter::alfas($_GET['action'])) {
if (!empty($_GET['lang'])) { $reqested_lang = filter::alfas($_GET['lang']); } elseif (!empty($_POST['lang'])) { $reqested_lang = filter::alfas($_POST['lang']); } $lang = new phpos_languages(); if (!empty($reqested_lang)) { if ($lang->lang_exists($reqested_lang)) { $login_language = $reqested_lang; $_SESSION['login_lang'] = $reqested_lang; } } $lang->lang_load($login_language); } else { $usr = new phpos_users(); $config = new phpos_config(); if ($usr->user_is_logged()) { $config->set_id_user($usr->get_logged_user()); } $usr->get_logged_user(); $access_level = $usr->get_access_level(); if (!empty($_GET['lang'])) { //$PHPOS_GLOBALCONFIG['lang'] = strtolower($_GET['lang']); //$PHPOS_USERCONFIG['lang'] = strtolower($_GET['lang']); $requested_lang = trim(filter::alfas(strtolower($_GET['lang']))); if ($langs->lang_exists($requested_lang)) { if ($config->get_global('demo_mode') != 1 || $access_level == 3) { $config->update_user('lang', $requested_lang); } else { $demo_lang = trim($requested_lang); $_SESSION['demo_lang'] = $demo_lang;
helper_result('update_user', 'error', txt('pass_length')); } else { $new_usr = new phpos_users(); $new_usr->set_id_user($user_id); $new_usr->get_user_by_id(); if (!empty($tmp_pass1)) { $new_usr->set_raw_pass($tmp_pass1); $new_pass = $new_usr->generate_password(); $new_usr->set_user_pass($new_pass); } $new_usr->set_user_type($tmp_type); $new_usr->set_user_email($tmp_email); $new_usr->set_is_active($tmp_active); //if($tmp_home != 1) $new_usr->set_nohome(); 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('update_user', 'ok', txt('updated')); helper_result('update_user_result', 'result', 'success'); helper_result('update_user_result', 'result', 'error'); } else { helper_result('update_user_result', 'result', 'error'); helper_result('update_user', 'error', txt('error')); } } } $_POST['action'] = null; } }
echo $layout->end('column'); echo $layout->column('50%'); $form->title(txt('usr_account_params'), '', ICONS . 'small_options.png'); $items = array('1' => txt('yes'), '0' => txt('no')); $form->radio('user_new_active', txt('active'), txt('dsc_users_account_active'), $items, $usr->get_is_active()); $items = array('1' => txt('user_user'), '2' => txt('user_admin')); $form->radio('user_new_type', 'Type', txt('dsc_users_account_type'), $items, $usr->get_user_type()); $languages = new phpos_languages(); $langs_array = $languages->get_lang_list(); $lang_items = array(); foreach ($langs_array as $lang_id) { $lang_data = $languages->get_lang_info($lang_id); $lang_name = $lang_data['eng_name'] . ' (' . $lang_data['local_name'] . ')'; $lang_items[$lang_id] = $lang_name; } $new_cfg = new phpos_config('no_get'); $new_cfg->set_id_user($user_id); $lang = $new_cfg->get_user('lang'); $form->select('user_new_lang', txt('language'), txt('dsc_users_account_lang'), $lang_items, $lang); $form->status(); $delete_action = "\n\t\t\t\$.messager.confirm('" . txt('delete') . "', '" . txt('delete_confirm') . "?', function(r){\n\t\t\tif (r){\n\t\t\t\tphpos.windowRefresh('" . WIN_ID . "', 'section:list,action:delete,delete_id:" . $user_id . "');\t\n\t\t\t}\n\t\t\t});\t"; $form->button(txt('delete'), $delete_action, 'cancel'); $form->submit('', txt('update'), 'edit_add'); //$form->button('', 'button', 'edit_add'); echo $form->render(); echo $layout->end('column'); echo $layout->clr(); echo $form->form_end(); // user info echo $layout->area_start(); include MY_APP_DIR . 'views/inc.account_info.php';
function globalconfig($config_name, $config_value = null) { $config = new phpos_config(); if ($config_value !== null) { $config->update_global($config_name, $config_value); } return $config->get_global($config_name); }