PageRenderTime 110ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 1ms

/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/install.php

https://github.com/EthanBlast/Glam-Star-Life
PHP | 401 lines | 360 code | 30 blank | 11 comment | 30 complexity | aa4aa28f2bc9928f5ed431c5d9f795b2 MD5 | raw file
  1. <?php
  2. // Modify error reporting levels
  3. error_reporting(E_ALL ^ E_NOTICE);
  4. // Let everyone know we are installing
  5. define('BB_INSTALLING', true);
  6. // Load bbPress
  7. require_once('../bb-load.php');
  8. // Instantiate the install class
  9. require_once( BB_PATH . 'bb-admin/includes/class.bb-install.php' );
  10. $bb_install = new BB_Install(__FILE__);
  11. $bb_install->header();
  12. ?>
  13. <script type="text/javascript" charset="utf-8">
  14. function toggleNote(target) {
  15. var targetObj = document.getElementById(target);
  16. if (targetObj.style.display == 'none') {
  17. targetObj.style.display = 'block';
  18. } else {
  19. targetObj.style.display = 'none';
  20. }
  21. }
  22. function toggleBlock(toggleObj, target) {
  23. var targetObj = document.getElementById(target);
  24. if (toggleObj.checked) {
  25. targetObj.style.display = 'block';
  26. } else {
  27. targetObj.style.display = 'none';
  28. }
  29. }
  30. function toggleValue(toggleObj, target, offValue, onValue) {
  31. var targetObj = document.getElementById(target);
  32. if (toggleObj.checked) {
  33. targetObj.value = onValue;
  34. } else {
  35. targetObj.value = offValue;
  36. }
  37. }
  38. </script>
  39. <?php
  40. switch ($bb_install->step) {
  41. case -1:
  42. $bb_install->messages();
  43. $bb_install->intro();
  44. break;
  45. default:
  46. $bb_install->step_header(0);
  47. if ($bb_install->step === 0) {
  48. ?>
  49. <form action="install.php" method="post">
  50. <?php
  51. $bb_install->messages();
  52. $bb_install->get_language_selector();
  53. $bb_install->input_buttons('forward_0_0', false, 1);
  54. ?>
  55. </form>
  56. <?php
  57. } else {
  58. $bb_install->sanitize_form_data();
  59. }
  60. $bb_install->step_footer();
  61. $bb_install->step_header(1);
  62. if ($bb_install->step === 1) {
  63. switch($bb_install->step_status[1]) {
  64. case 'incomplete':
  65. ?>
  66. <form action="install.php" method="post">
  67. <?php
  68. $bb_install->messages();
  69. ?>
  70. <fieldset>
  71. <?php
  72. $bb_install->input_text('bbdb_name');
  73. $bb_install->input_text('bbdb_user');
  74. $bb_install->input_text('bbdb_password');
  75. $bb_install->select_language();
  76. $bb_install->input_toggle('toggle_1');
  77. ?>
  78. <div class="toggle" id="toggle_1_target" style="<?php echo esc_attr( 'display:' . $bb_install->data[$bb_install->step]['form']['toggle_1']['display'] ); ?>;">
  79. <?php
  80. $bb_install->input_text('bbdb_host');
  81. $bb_install->input_text('bbdb_charset');
  82. $bb_install->input_text('bbdb_collate');
  83. //$bb_install->input_text('bb_auth_key');
  84. //$bb_install->input_text('bb_secure_auth_key');
  85. //$bb_install->input_text('bb_logged_in_key');
  86. //$bb_install->input_text('bb_nonce_key');
  87. $bb_install->input_text('bb_table_prefix', 'ltr');
  88. ?>
  89. </div>
  90. </fieldset>
  91. <?php
  92. $bb_install->input_buttons('forward_1_0');
  93. ?>
  94. </form>
  95. <?php
  96. break;
  97. case 'manual':
  98. ?>
  99. <form action="install.php" method="post">
  100. <?php
  101. $bb_install->messages();
  102. $bb_install->hidden_step_inputs();
  103. ?>
  104. <fieldset>
  105. <?php
  106. $bb_install->textarea('config', 'ltr');
  107. ?>
  108. </fieldset>
  109. <?php
  110. $bb_install->input_buttons('forward_1_1', 'back_1_1');
  111. ?>
  112. </form>
  113. <?php
  114. break;
  115. case 'complete':
  116. ?>
  117. <form action="install.php" method="post">
  118. <?php
  119. $bb_install->messages();
  120. $bb_install->input_buttons('forward_1_2', false, 2);
  121. ?>
  122. </form>
  123. <?php
  124. break;
  125. }
  126. }
  127. $bb_install->step_footer();
  128. $bb_install->step_header(2);
  129. if ($bb_install->step === 2) {
  130. switch ($bb_install->step_status[2]) {
  131. case 'incomplete':
  132. ?>
  133. <form action="install.php" method="post">
  134. <?php
  135. $bb_install->messages();
  136. ?>
  137. <fieldset>
  138. <?php
  139. bb_nonce_field('bbpress-installer');
  140. $bb_install->input_toggle('toggle_2_0');
  141. ?>
  142. </fieldset>
  143. <div class="toggle" id="toggle_2_0_target" style="<?php echo esc_attr( 'display:' . $bb_install->data[$bb_install->step]['form']['toggle_2_0']['display'] ); ?>;">
  144. <fieldset>
  145. <?php
  146. $bb_install->input_toggle('toggle_2_1');
  147. ?>
  148. </fieldset>
  149. <div class="toggle" id="toggle_2_1_target" style="<?php echo esc_attr( 'display:' . $bb_install->data[$bb_install->step]['form']['toggle_2_1']['display'] ); ?>;">
  150. <fieldset>
  151. <legend><?php _e('Cookies'); ?></legend>
  152. <p><?php _e('Integrating cookies allows you and your users to login to either your bbPress or your WordPress site and be automatically logged into both.'); ?></p>
  153. <p><?php _e('You may need to make changes to your WordPress configuration once installation is complete. See the "WordPress Integration" section of the bbPress administration area when you are done.'); ?></p>
  154. <?php
  155. $bb_install->input_text('wp_siteurl', 'ltr');
  156. $bb_install->input_text('wp_home', 'ltr');
  157. $bb_install->input_text('wp_auth_key');
  158. $bb_install->input_text('wp_auth_salt');
  159. $bb_install->input_text('wp_secure_auth_key');
  160. $bb_install->input_text('wp_secure_auth_salt');
  161. $bb_install->input_text('wp_logged_in_key');
  162. $bb_install->input_text('wp_logged_in_salt');
  163. ?>
  164. </fieldset>
  165. </div>
  166. <fieldset>
  167. <?php
  168. $bb_install->input_toggle('toggle_2_2');
  169. ?>
  170. </fieldset>
  171. <div class="toggle" id="toggle_2_2_target" style="<?php echo esc_attr( 'display:' . $bb_install->data[$bb_install->step]['form']['toggle_2_2']['display'] ); ?>;">
  172. <fieldset>
  173. <legend><?php _e('User database'); ?></legend>
  174. <p><?php _e('Integrating your WordPress database user tables allows you to store user data in one location, instead of having separate user data for both bbPress and WordPress.'); ?></p>
  175. <?php
  176. $bb_install->input_text('wp_table_prefix', 'ltr');
  177. $bb_install->input_text('wordpress_mu_primary_blog_id', 'ltr');
  178. $bb_install->input_toggle('toggle_2_3');
  179. ?>
  180. </fieldset>
  181. <div class="toggle" id="toggle_2_3_target" style="<?php echo esc_attr( 'display:' . $bb_install->data[$bb_install->step]['form']['toggle_2_3']['display'] ); ?>;">
  182. <fieldset>
  183. <legend><?php _e('Separate user database settings'); ?></legend>
  184. <p><?php _e('Most of the time these settings are <em>not</em> required. Look before you leap!'); ?></p>
  185. <p><?php _e('If required, then all settings except for the character set must be specified.'); ?></p>
  186. <?php
  187. $bb_install->input_text('user_bbdb_name');
  188. $bb_install->input_text('user_bbdb_user');
  189. $bb_install->input_text('user_bbdb_password');
  190. $bb_install->input_text('user_bbdb_host');
  191. $bb_install->input_text('user_bbdb_charset');
  192. $bb_install->input_text('user_bbdb_collate');
  193. ?>
  194. </fieldset>
  195. <fieldset>
  196. <legend><?php _e('Custom user tables'); ?></legend>
  197. <p><?php _e('Only set these options if your integrated user tables do not fit the usual mould of <em>wp_user</em> and <em>wp_usermeta</em>.'); ?></p>
  198. <?php
  199. $bb_install->input_text('custom_user_table');
  200. $bb_install->input_text('custom_user_meta_table');
  201. ?>
  202. </fieldset>
  203. </div>
  204. </div>
  205. </div>
  206. <?php
  207. $bb_install->input_buttons('forward_2_0');
  208. ?>
  209. </form>
  210. <script type="text/javascript" charset="utf-8">
  211. function updateWordPressOptionURL () {
  212. var siteURLInputValue = document.getElementById('wp_siteurl').value;
  213. if (siteURLInputValue && siteURLInputValue.substr(-1,1) != '/') {
  214. siteURLInputValue += '/';
  215. }
  216. var authSaltAnchor = document.getElementById('getAuthSaltOption');
  217. var secureAuthSaltAnchor = document.getElementById('getSecureAuthSaltOption');
  218. var loggedInSaltAnchor = document.getElementById('getLoggedInSaltOption');
  219. if (siteURLInputValue) {
  220. authSaltAnchor.href = siteURLInputValue + 'wp-admin/options.php';
  221. secureAuthSaltAnchor.href = siteURLInputValue + 'wp-admin/options.php';
  222. loggedInSaltAnchor.href = siteURLInputValue + 'wp-admin/options.php';
  223. } else {
  224. authSaltAnchor.href = '';
  225. secureAuthSaltAnchor.href = '';
  226. loggedInSaltAnchor.href = '';
  227. }
  228. }
  229. var siteURLInput = document.getElementById('wp_siteurl');
  230. if (siteURLInput.value) {
  231. updateWordPressOptionURL();
  232. }
  233. siteURLInput.onkeyup = updateWordPressOptionURL;
  234. siteURLInput.onblur = updateWordPressOptionURL;
  235. siteURLInput.onclick = updateWordPressOptionURL;
  236. siteURLInput.onchange = updateWordPressOptionURL;
  237. </script>
  238. <?php
  239. break;
  240. case 'complete':
  241. ?>
  242. <form action="install.php" method="post">
  243. <?php
  244. $bb_install->messages();
  245. ?>
  246. <fieldset>
  247. <?php
  248. bb_nonce_field('bbpress-installer');
  249. ?>
  250. </fieldset>
  251. <?php
  252. $bb_install->hidden_step_inputs();
  253. $bb_install->input_buttons('forward_2_1', 'back_2_1', 3);
  254. ?>
  255. </form>
  256. <?php
  257. break;
  258. }
  259. }
  260. $bb_install->step_footer();
  261. $bb_install->step_header(3);
  262. if ($bb_install->step === 3) {
  263. switch($bb_install->step_status[3]) {
  264. case 'incomplete':
  265. ?>
  266. <form action="install.php" method="post">
  267. <?php
  268. $bb_install->messages();
  269. ?>
  270. <fieldset>
  271. <?php
  272. bb_nonce_field('bbpress-installer');
  273. ?>
  274. </fieldset>
  275. <?php
  276. $bb_install->hidden_step_inputs(2);
  277. ?>
  278. <fieldset>
  279. <?php
  280. $bb_install->input_text('name');
  281. $bb_install->input_text('uri', 'ltr');
  282. if ($bb_install->populate_keymaster_user_login_from_user_tables()) {
  283. echo $bb_install->strings[3]['scripts']['changeKeymasterEmail'];
  284. $bb_install->select('keymaster_user_login');
  285. $bb_install->input_hidden('keymaster_user_email');
  286. } else {
  287. $bb_install->input_text('keymaster_user_login');
  288. $bb_install->input_text('keymaster_user_email', 'ltr');
  289. }
  290. $bb_install->input_hidden('keymaster_user_type');
  291. if (!$bb_install->database_tables_are_installed()) {
  292. $bb_install->input_text('forum_name');
  293. }
  294. ?>
  295. </fieldset>
  296. <?php
  297. $bb_install->input_buttons('forward_3_0');
  298. ?>
  299. </form>
  300. <?php
  301. break;
  302. case 'complete':
  303. ?>
  304. <form action="install.php" method="post">
  305. <?php
  306. $bb_install->messages();
  307. ?>
  308. <fieldset>
  309. <?php
  310. bb_nonce_field('bbpress-installer');
  311. ?>
  312. </fieldset>
  313. <?php
  314. $bb_install->hidden_step_inputs(2);
  315. $bb_install->hidden_step_inputs(); // The current step (3) is assumed here
  316. $bb_install->input_buttons('forward_3_1', 'back_3_1', 4);
  317. ?>
  318. </form>
  319. <?php
  320. break;
  321. }
  322. }
  323. $bb_install->step_footer();
  324. if ($bb_install->step === 4) {
  325. $bb_install->step_header(4);
  326. $bb_install->messages();
  327. if ($bb_install->step_status[4] == 'complete') {
  328. ?>
  329. <p><?php _e('You can now log in with the following details:'); ?></p>
  330. <dl>
  331. <dt><?php _e('Username:'); ?></dt>
  332. <dd><code><?php echo esc_html( $bb_install->data[3]['form']['keymaster_user_login']['value'] ); ?></code></dd>
  333. <dt><?php _e('Password:'); ?></dt>
  334. <dd><code><?php echo esc_html( $bb_install->data[4]['form']['keymaster_user_password']['value'] ); ?></code></dd>
  335. <dt><?php _e('Site address:'); ?></dt>
  336. <dd dir="ltr"><a href="<?php bb_uri(); ?>"><?php bb_uri(null, null, BB_URI_CONTEXT_TEXT); ?></a></dd>
  337. </dl>
  338. <?php
  339. if ($bb_install->data[3]['form']['keymaster_user_type']['value'] == 'bbPress') {
  340. ?>
  341. <p><?php _e('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you. If you lose it, you will have to delete the tables from the database yourself, and re-install bbPress.'); ?></p>
  342. <?php
  343. }
  344. }
  345. ?>
  346. <form action="<?php bb_uri(null, null, BB_URI_CONTEXT_FORM_ACTION); ?>">
  347. <fieldset>
  348. <?php
  349. $bb_install->input_toggle('toggle_4');
  350. ?>
  351. <div class="toggle" id="toggle_4_target" style="display:none;">
  352. <?php
  353. if ($bb_install->data[4]['form']['error_log']['value']) {
  354. $bb_install->textarea('error_log');
  355. }
  356. $bb_install->textarea('installation_log');
  357. ?>
  358. </div>
  359. </fieldset>
  360. </form>
  361. <?php
  362. $bb_install->step_footer();
  363. } else {
  364. //? >
  365. // <div id="step4" class="closed"></div>
  366. //<?php
  367. }
  368. break;
  369. }
  370. $bb_install->footer();
  371. ?>