PageRenderTime 63ms CodeModel.GetById 35ms RepoModel.GetById 0ms app.codeStats 0ms

/gp-templates/bootstrap/install.php

https://bitbucket.org/moodsdesign-ondemand/reglot
PHP | 107 lines | 96 code | 8 blank | 3 comment | 11 complexity | 34694e3baf208afcb249bad67b1445cc MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. gp_title(__('Install'));
  3. gp_breadcrumb(array(__('Install')));
  4. wp_enqueue_script('install');
  5. // include, do not require, as it's ok if file is not there
  6. @include_once 'gp-config.php';
  7. // these value are there, whether from previous config or defaults
  8. $config_defaults = array(
  9. 'GPDB_HOST' => defined('GPDB_HOST') ? GPDB_HOST : 'localhost',
  10. 'GPDB_CHARSET' => defined('GPDB_CHARSET') ? GPDB_CHARSET : 'utf8',
  11. 'GPDB_COLLATE' => defined('GPDB_COLLATE') ? GPDB_COLLATE : 'utf8_unicode_ci',
  12. 'gp_table_prefix' => isset($gp_table_prefix) ? $gp_table_prefix : 'rg_',
  13. 'CUSTOM_USER_TABLE' => defined('CUSTOM_USER_TABLE') ? CUSTOM_USER_TABLE : 'wp_users',
  14. 'CUSTOM_USER_META_TABLE' => defined('CUSTOM_USER_META_TABLE') ? CUSTOM_USER_META_TABLE : 'wp_usermeta'
  15. );
  16. // these values are only added if previous config was present
  17. if (defined('GPDB_NAME'))
  18. $config_defaults['GPDB_NAME'] = GPDB_NAME;
  19. if (defined('GPDB_USER'))
  20. $config_defaults['GPDB_USER'] = GPDB_USER;
  21. if (defined('GPDB_PASSWORD'))
  22. $config_defaults['GPDB_PASSWORD'] = GPDB_PASSWORD;
  23. if (defined('GP_AUTH_KEY'))
  24. $config_defaults['GP_AUTH_KEY'] = GP_AUTH_KEY;
  25. if (defined('GP_SECURE_AUTH_KEY'))
  26. $config_defaults['GP_SECURE_AUTH_KEY'] = GP_SECURE_AUTH_KEY;
  27. if (defined('GP_LOGGED_IN_KEY'))
  28. $config_defaults['GP_LOGGED_IN_KEY'] = GP_LOGGED_IN_KEY;
  29. if (defined('GP_NONCE_KEY'))
  30. $config_defaults['GP_NONCE_KEY'] = GP_NONCE_KEY;
  31. if (defined('CUSTOM_USER_TABLE')) {
  32. $config_defaults['gp_enable_wordpress_users'] = 'on';
  33. $wordpress_enabled = true;
  34. } else {
  35. $wordpress_enabled = false;
  36. }
  37. $config = array_merge($config_defaults, $config);
  38. gp_tmpl_header();
  39. ?>
  40. <section id="content">
  41. <h2><?php echo wptexturize(sprintf(__('Installation Process (phase %d of %d)'), 1, GP_TOT_INSTALL_PAGES)); ?></h2>
  42. <form action="" method="post">
  43. <dl>
  44. <dt><h3><?php echo __('Database Configuration'); ?></h3></dt>
  45. <dd>
  46. <label for="config[GPDB_NAME]"><?php _e('Database Name'); ?></label>
  47. <input type="text" name="config[GPDB_NAME]" value="<?php echo @$config['GPDB_NAME']; ?>" id="config[GPDB_NAME]"><br/>
  48. <label for="config[GPDB_USER]"><?php _e('Username'); ?></label>
  49. <input type="text" name="config[GPDB_USER]" value="<?php echo @$config['GPDB_USER']; ?>" id="config[GPDB_USER]"><br/>
  50. <label for="config[GPDB_PASSWORD]"><?php _e('Password'); ?></label>
  51. <input type="password" name="config[GPDB_PASSWORD]" value="<?php echo @$config['GPDB_PASSWORD']; ?>" id="config[GPDB_PASSWORD]"><br/>
  52. <label for="config[GPDB_HOST]"><?php _e('Server Host'); ?></label>
  53. <input type="text" name="config[GPDB_HOST]" value="<?php echo @$config['GPDB_HOST']; ?>" id="config[GPDB_HOST]"><br/>
  54. <label for="config[GPDB_CHARSET]"><?php _e('Default Character Set'); ?></label>
  55. <input type="text" name="config[GPDB_CHARSET]" value="<?php echo @$config['GPDB_CHARSET']; ?>" id="config[GPDB_CHARSET]"><br/>
  56. <label for="config[GPDB_COLLATE]"><?php _e('Default Collation'); ?></label>
  57. <input type="text" name="config[GPDB_COLLATE]" value="<?php echo @$config['GPDB_COLLATE']; ?>" id="config[GPDB_COLLATE]"><br/>
  58. <label for="config[gp_table_prefix]"><?php _e('GlotPress Table Prefix'); ?></label>
  59. <input type="text" name="config[gp_table_prefix]" value="<?php echo @$config['gp_table_prefix']; ?>" id="config[gp_table_prefix]"><br/>
  60. </dd>
  61. <br/>
  62. <dt><h3><?php echo __('Authentication Unique Keys'); ?></h3></dt>
  63. <dd>
  64. <label for="config[GP_AUTH_KEY]">GP_AUTH_KEY</label>
  65. <input type="text" name="config[GP_AUTH_KEY]" value="<?php echo @$config['GP_AUTH_KEY']; ?>" id="config[GP_AUTH_KEY]"><br/>
  66. <label for="config[GP_SECURE_AUTH_KEY]">GP_SECURE_AUTH_KEY</label>
  67. <input type="text" name="config[GP_SECURE_AUTH_KEY]" value="<?php echo @$config['GP_SECURE_AUTH_KEY']; ?>" id="config[GP_SECURE_AUTH_KEY]"><br/>
  68. <label for="config[GP_LOGGED_IN_KEY]">GP_LOGGED_IN_KEY</label>
  69. <input type="text" name="config[GP_LOGGED_IN_KEY]" value="<?php echo @$config['GP_LOGGED_IN_KEY']; ?>" id="config[GP_LOGGED_IN_KEY]"><br/>
  70. <label for="config[GP_NONCE_KEY]">GP_NONCE_KEY</label>
  71. <input type="text" name="config[GP_NONCE_KEY]" value="<?php echo @$config['GP_NONCE_KEY']; ?>" id="config[GP_NONCE_KEY]"><br/>
  72. <small><?php _e('You can generate these using the <a href="https://api.wordpress.org/secret-key/1.1/" target="_blank">WordPress.org secret-key service</a> page'); ?></small>
  73. </dd>
  74. <br/>
  75. <dt>
  76. <h3><input type="checkbox" name="config[gp_enable_wordpress_users]" value="on"<?php if ($wordpress_enabled) echo ' checked'; ?> id="check_enable_wordpress_users">
  77. <label for="config[gp_enable_wordpress_users]"><?php echo __('Enable WordPress User Base Integration'); ?></label></h3>
  78. </dt>
  79. <dd id="div_enable_wordpress_users"<?php if (!$wordpress_enabled) echo ' style="display: none;"'; ?>>
  80. <label for="config[CUSTOM_USER_TABLE]">User Table Name</label>
  81. <input type="text" name="config[CUSTOM_USER_TABLE]" value="<?php echo @$config['CUSTOM_USER_TABLE']; ?>" id="config[CUSTOM_USER_TABLE]"><br/>
  82. <label for="config[CUSTOM_USER_META_TABLE]">User Meta Table Name</label>
  83. <input type="text" name="config[CUSTOM_USER_META_TABLE]" value="<?php echo @$config['CUSTOM_USER_META_TABLE']; ?>" id="config[CUSTOM_USER_META_TABLE]"><br/>
  84. </dd>
  85. <br/>
  86. <dt><h3><?php echo __('Other Options'); ?></h3></dt>
  87. <dd>
  88. <label for="config[GP_LANG]"><?php echo __('GlotPress Language'); ?></label>
  89. <input type="text" name="config[GP_LANG]" value="" id="config[CUSTOM_USER_TABLE]"><br/>
  90. <small><?php _e('A corresponding MO file for the chosen language must be installed to <i>languages/</i>. Leave blank for English.'); ?></small>
  91. </dd>
  92. </dl>
  93. <?php echo gp_js_focus_on('config[GPDB_NAME]'); ?>
  94. <p>
  95. <input type="submit" name="submit" value="<?php echo esc_attr(__('Install')); ?>" id="submit" />
  96. </p>
  97. </form>
  98. </section>
  99. <?php gp_tmpl_footer(); ?>