*/
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('THEME_DIR', PHPOS_WEBROOT_DIR . '_phpos/themes/' . globalconfig('theme') . '/');
 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');
     }
 }
Example #3
0
            } 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;
    }
}
// my update
    } 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;
            }
        }
function myconfig($config_name, $config_value = null)
{
    $usr = new phpos_users();
    $config = new phpos_config();
    if ($usr->user_is_logged()) {
        $config->set_id_user($usr->get_logged_user());
        return $config->get_user($config_name);
    }
}