install.php 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * This script is included by main/admin/settings.lib.php and generally
  4. * includes things to execute in the main database (settings_current table)
  5. */
  6. $t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
  7. $t_options = Database::get_main_table(TABLE_MAIN_SETTINGS_OPTIONS);
  8. $sql = "INSERT INTO $t_settings
  9. (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable)
  10. VALUES
  11. ('bbb_plugin', '', 'radio', 'Extra', 'false', 'BigBlueButtonEnableTitle','BigBlueButtonEnableComment',NULL,NULL, 1)";
  12. Database::query($sql);
  13. $sql = "INSERT INTO $t_options (variable, value, display_text) VALUES ('bbb_plugin', 'true', 'Yes')";
  14. Database::query($sql);
  15. $sql = "INSERT INTO $t_options (variable, value, display_text) VALUES ('bbb_plugin', 'false', 'No')";
  16. Database::query($sql);
  17. $sql = "INSERT INTO $t_settings
  18. (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable)
  19. VALUES
  20. ('bbb_plugin_host', '', 'textfield', 'Extra', '192.168.0.100', 'BigBlueButtonHostTitle','BigBlueButtonHostComment',NULL,NULL, 1)";
  21. Database::query($sql);
  22. $sql = "INSERT INTO $t_settings
  23. (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable)
  24. VALUES
  25. ('bbb_plugin_salt', '', 'textfield', 'Extra', '', 'BigBlueButtonSecuritySaltTitle','BigBlueButtonSecuritySaltComment',NULL,NULL, 1)";
  26. Database::query($sql);
  27. $table = Database::get_main_table('plugin_bbb');
  28. $sql = "CREATE TABLE $table ( " .
  29. "id BIGINT unsigned NOT NULL auto_increment PRIMARY KEY, " .
  30. "course_id INT unsigned NOT NULL DEFAULT 0, " .
  31. "name VARCHAR(255) NOT NULL DEFAULT '', " .
  32. "meeting_name VARCHAR(255) NOT NULL DEFAULT '', " .
  33. "meeting_id VARCHAR(255) NOT NULL DEFAULT '', " .
  34. "attendee_pw VARCHAR(255) NOT NULL DEFAULT '', " .
  35. "moderator_pw VARCHAR(255) NOT NULL DEFAULT '', " .
  36. "auto_login VARCHAR(255) NOT NULL DEFAULT '', " .
  37. "new_window VARCHAR(255) NOT NULL DEFAULT '', " .
  38. "welcome_msg VARCHAR(255) NOT NULL DEFAULT '')";
  39. Database::query($sql);
  40. // update existing courses to add conference settings
  41. $t_courses = Database::get_main_table(TABLE_MAIN_COURSE);
  42. $sql = "SELECT id, code, db_name FROM $t_courses ORDER BY id";
  43. $res = Database::query($sql);
  44. while ($row = Database::fetch_assoc($res)) {
  45. $t_course = Database::get_course_table(TABLE_COURSE_SETTING,$row['db_name']);
  46. $sql = "SELECT value FROM $t_course WHERE variable = 'big_blue_button_meeting_name' ";
  47. $result = Database::query($sql);
  48. if (!Database::num_rows($result)) {
  49. $sql_course = "INSERT INTO $t_course (variable,value,category) VALUES ('big_blue_button_meeting_name','','plugins')";
  50. $r = Database::query($sql_course);
  51. }
  52. $sql = "SELECT value FROM $t_course WHERE variable = 'big_blue_button_attendee_password' ";
  53. $result = Database::query($sql);
  54. if (!Database::num_rows($result)) {
  55. $sql_course = "INSERT INTO $t_course (variable, value, category) VALUES ('big_blue_button_attendee_password','','plugins')";
  56. $r = Database::query($sql_course);
  57. }
  58. $sql = "SELECT value FROM $t_course WHERE variable = 'big_blue_button_moderator_password' ";
  59. $result = Database::query($sql);
  60. if (!Database::num_rows($result)) {
  61. $sql_course = "INSERT INTO $t_course (variable, value, category) VALUES ('big_blue_button_moderator_password','','plugins')";
  62. $r = Database::query($sql_course);
  63. }
  64. $sql = "SELECT value FROM $t_course WHERE variable = 'big_blue_button_welcome_message' ";
  65. $result = Database::query($sql);
  66. if (!Database::num_rows($result)) {
  67. $sql_course = "INSERT INTO $t_course (variable,value,category) VALUES ('big_blue_button_welcome_message','','plugins')";
  68. $r = Database::query($sql_course);
  69. }
  70. $t_tool = Database::get_course_table(TABLE_TOOL_LIST,$row['db_name']);
  71. $sql = "SELECT name FROM $t_tool WHERE name = 'videoconference' ";
  72. $result = Database::query($sql);
  73. if (!Database::num_rows($result)) {
  74. $sql_course = "INSERT INTO $t_tool VALUES (NULL, 'videoconference','../../plugin/bbb/start.php','visio.gif','".string2binary(api_get_setting('course_create_active_tools', 'videoconference'))."','0','squaregrey.gif','NO','_blank','plugin','0')";
  75. $r = Database::query($sql_course);
  76. }
  77. }