Beispiel #1
0
 /**
  * update_360051
  *
  * Copy default .htaccess configurations
  */
 public static function update_360051()
 {
     require_once AmpConfig::get('prefix') . '/lib/install.lib.php';
     if (!install_check_server_apache()) {
         debug_event('update', 'Not using Apache, update 360051 skipped.', '5');
         return true;
     }
     $htaccess_play_file = AmpConfig::get('prefix') . '/play/.htaccess';
     $htaccess_rest_file = AmpConfig::get('prefix') . '/rest/.htaccess';
     $htaccess_channel_file = AmpConfig::get('prefix') . '/channel/.htaccess';
     $ret = true;
     if (!is_readable($htaccess_play_file)) {
         $created = false;
         if (check_htaccess_play_writable()) {
             if (!install_rewrite_rules($htaccess_play_file, AmpConfig::get('raw_web_path'), false)) {
                 AmpError::add('general', T_('File copy error.'));
             } else {
                 $created = true;
             }
         }
         if (!$created) {
             AmpError::add('general', T_('Cannot copy default .htaccess file.') . ' Please copy <b>' . $htaccess_play_file . '.dist</b> to <b>' . $htaccess_play_file . '</b>.');
             $ret = false;
         }
     }
     if (!is_readable($htaccess_rest_file)) {
         $created = false;
         if (check_htaccess_rest_writable()) {
             if (!install_rewrite_rules($htaccess_rest_file, AmpConfig::get('raw_web_path'), false)) {
                 AmpError::add('general', T_('File copy error.'));
             } else {
                 $created = true;
             }
         }
         if (!$created) {
             AmpError::add('general', T_('Cannot copy default .htaccess file.') . ' Please copy <b>' . $htaccess_rest_file . '.dist</b> to <b>' . $htaccess_rest_file . '</b>.');
             $ret = false;
         }
     }
     if (!is_readable($htaccess_channel_file)) {
         $created = false;
         if (check_htaccess_channel_writable()) {
             if (!install_rewrite_rules($htaccess_channel_file, AmpConfig::get('raw_web_path'), false)) {
                 AmpError::add('general', T_('File copy error.'));
             } else {
                 $created = true;
             }
         }
         if (!$created) {
             AmpError::add('general', T_('Cannot copy default .htaccess file.') . ' Please copy <b>' . $htaccess_channel_file . '.dist</b> to <b>' . $htaccess_channel_file . '</b>.');
             $ret = false;
         }
     }
     return $ret;
 }
Beispiel #2
0
         }
     }
     // Now that it's inserted save the lang preference
     Preference::update('lang', '-1', AmpConfig::get('lang'));
     header('Location: ' . $web_path . "/install.php?action=show_create_config&local_db={$database}&local_host={$hostname}&local_port={$port}&htmllang={$htmllang}&charset={$charset}");
     break;
 case 'create_config':
     $download = !isset($_POST['write']);
     $download_htaccess_rest = isset($_POST['download_htaccess_rest']);
     $download_htaccess_play = isset($_POST['download_htaccess_play']);
     $write_htaccess_rest = isset($_POST['write_htaccess_rest']);
     $write_htaccess_play = isset($_POST['write_htaccess_play']);
     if ($write_htaccess_rest || $download_htaccess_rest) {
         $created_config = install_rewrite_rules($htaccess_rest_file, $_POST['web_path'], $download_htaccess_rest);
     } elseif ($write_htaccess_play || $download_htaccess_play) {
         $created_config = install_rewrite_rules($htaccess_play_file, $_POST['web_path'], $download_htaccess_play);
     } else {
         $created_config = install_create_config($download);
     }
     require_once 'templates/show_install_config.inc.php';
     break;
 case 'show_create_config':
     require_once 'templates/show_install_config.inc.php';
     break;
 case 'create_account':
     $results = parse_ini_file($configfile);
     AmpConfig::set_by_array($results, true);
     $password2 = scrub_in($_REQUEST['local_pass2']);
     if (!install_create_account($username, $password, $password2)) {
         require_once AmpConfig::get('prefix') . '/templates/show_install_account.inc.php';
         break;