Ejemplo n.º 1
0
function cot_install_step3_setup()
{
    global $file;
    $config_contents = file_get_contents($file['config']);
    cot_install_config_replace($config_contents, 'admintheme', 'fusion');
    file_put_contents($file['config'], $config_contents);
}
Ejemplo n.º 2
0
     if (mb_strlen($user['email']) < 4 || !cot_check_email($user['email'])) {
         cot_error('aut_emailtooshort', 'user_email');
     }
     if (!file_exists($file['config_sample'])) {
         cot_error(cot_rc('install_error_missing_file', array('file' => $file['config_sample'])));
     }
     if (!cot_error_found()) {
         $config_contents = file_get_contents($file['config']);
         cot_install_config_replace($config_contents, 'defaultlang', $rlang);
         cot_install_config_replace($config_contents, 'defaulttheme', $rtheme);
         cot_install_config_replace($config_contents, 'defaultscheme', $rscheme);
         cot_install_config_replace($config_contents, 'mainurl', $cfg['mainurl']);
         $new_site_id = cot_unique(32);
         cot_install_config_replace($config_contents, 'site_id', $new_site_id);
         $new_secret_key = cot_unique(32);
         cot_install_config_replace($config_contents, 'secret_key', $new_secret_key);
         file_put_contents($file['config'], $config_contents);
         $ruserpass['user_passsalt'] = cot_unique(16);
         $ruserpass['user_passfunc'] = empty($cfg['hashfunc']) ? 'sha256' : $cfg['hashfunc'];
         $ruserpass['user_password'] = cot_hash($user['pass'], $ruserpass['user_passsalt'], $ruserpass['user_passfunc']);
         try {
             $db->insert($db_x . 'users', array('user_name' => $user['name'], 'user_password' => $ruserpass['user_password'], 'user_passsalt' => $ruserpass['user_passsalt'], 'user_passfunc' => $ruserpass['user_passfunc'], 'user_maingrp' => COT_GROUP_SUPERADMINS, 'user_country' => (string) $user['country'], 'user_email' => $user['email'], 'user_theme' => $rtheme, 'user_scheme' => $rscheme, 'user_lang' => $rlang, 'user_regdate' => time(), 'user_lastip' => $_SERVER['REMOTE_ADDR']));
             $user['id'] = $db->lastInsertId();
             $db->insert($db_x . 'groups_users', array('gru_userid' => (int) $user['id'], 'gru_groupid' => COT_GROUP_SUPERADMINS));
             $db->update($db_x . 'config', array('config_value' => $user['email']), "config_owner = 'core' AND config_name = 'adminemail'");
         } catch (PDOException $err) {
             cot_error(cot_rc('install_error_sql_script', array('msg' => $err->getMessage())));
         }
     }
     break;
 case 4: