function kaltura_process_options(&$config) { global $CFG; if (!empty($config->ceurl) && !empty($config->ceadminemail) && !empty($config->cecmspass)) { try { KalturaHelpers::importCE($config->ceurl, $config->ceadminemail, $config->cecmspass, $secret, $adminSecret, $partner); $entry = new stdClass(); $entry->plugin = "kaltura"; $entry->name = "secret"; $entry->value = $secret; insert_record("config_plugins", $entry); $entry->name = "adminsecret"; $entry->value = $adminSecret; insert_record("config_plugins", $entry); $entry->name = "partner_id"; $entry->value = $partner; insert_record("config_plugins", $entry); $entry = get_record("config_plugins", "plugin", "kaltura", "name", "server_uri"); $entry->value = $config->ceurl; update_record("config_plugins", $entry); } catch (Exception $exp) { redirect("{$CFG->wwwroot}/{$CFG->admin}/module.php?module=kaltura", get_string("registrationfailed", "kaltura") . $exp->getMessage(), 5); exit; } } else { if (empty($config->username) || empty($config->email) || empty($config->phone) || empty($config->descself) || empty($config->weburl) || empty($config->adult) || empty($config->purpose) || empty($config->webcontent)) { redirect("{$CFG->wwwroot}/{$CFG->admin}/module.php?module=kaltura&err=mand", get_string("registrationfailed", "kaltura"), 5); exit; } else { if (empty($config->accpetterms)) { redirect("{$CFG->wwwroot}/{$CFG->admin}/module.php?module=kaltura&err=terms", get_string("registrationfailed", "kaltura"), 5); exit; } else { try { KalturaHelpers::register($config->username, $config->email, $secret, $adminSecret, $partner, $config->phone, $config->purpose, $CFG->version, $config->descself, $config->weburl, $config->webcontent, $config->adult == "Yes" ? true : false); $entry = new stdClass(); $entry->plugin = "kaltura"; $entry->name = "secret"; $entry->value = $secret; insert_record("config_plugins", $entry); $entry->name = "adminsecret"; $entry->value = $adminSecret; insert_record("config_plugins", $entry); $entry->name = "partner_id"; $entry->value = $partner; insert_record("config_plugins", $entry); } catch (Exception $exp) { redirect("{$CFG->wwwroot}/{$CFG->admin}/module.php?module=kaltura", get_string("registrationfailed", "kaltura") . $exp->getMessage(), 5); exit; } } } } redirect("{$CFG->wwwroot}/{$CFG->admin}/module.php?module=kaltura", get_string("registrationsucced", "kaltura"), 5); exit; }