Closed (fixed)
Project:
Kaltura
Version:
6.x-2.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Oct 2010 at 13:19 UTC
Updated:
21 Jan 2011 at 09:20 UTC
Using the Kaltura CE configuration pane, enter bogus info and try to force an error. The resulting page will be a syntax error.
It has to do with if the var $ex->Message() is defined. It apparently isn't.
So I made a more generic error message instead:
Corrected:
/*
* helper function that process the partner registration for kaltura CE
*
* if registration successful, the partner details are saved as system variables (drupal DB) and
* the user is being redirected to the modules settings page where he should see the details inserted
* and a configuration test which says that the configuraion works
*/
function import_ce()
{
try
{
$url = $_REQUEST['ce_url'];
$email = $_REQUEST['ce_admin_email'];
$password = $_REQUEST['ce_cms_password'];
$kConfig = new KalturaConfiguration(0);
$kConfig->serviceUrl = $url;
$kClient = new KalturaClient($kConfig);
$res = $kClient -> partner -> getSecrets(1, $email, $password);
$partner = 1;
$secret = $kPartner -> secret;
$adminSecret = $kPartner -> adminSecret;
variable_set('kaltura_partner_id', $res->id);
variable_set('kaltura_subp_id', $res->id."00");
variable_set('kaltura_secret', $res->secret);
variable_set('kaltura_admin_secret', $res->adminSecret);
variable_set('kaltura_local_registration', 1);
variable_set('kaltura_server_url', $url);
variable_set('kaltura_partner_cms_email', $res->adminEmail);
variable_set('kaltura_partner_cms_password', $password);
variable_set('kaltura_partner_url2', $_REQUEST['partner_url2']);
variable_set('kaltura_notification_type', 0);
// variable_set('kaltura_content_categories', implode(',', $_REQUEST['kaltura_content_categories']));
kaltura_update_kaltura_partner(2, $partner->notificationUrl);
// kaltura_create_widgets_for_partner($partner->id, $secret);
drupal_set_message('Congratulations! You have successfully installed the All in One Video Module and registered for the Kaltura Partner Program.');
drupal_goto('admin/settings/kaltura/general');
}
catch(Exception $ex)
{
//drupal_set_message($ex->Message(), 'error');
drupal_set_message('Error connecting to the Kaltura server at ' . $url, 'error'); // <-- corrected because there is no $ex->Message()
}
}
Comments
Comment #1
socialnicheguru commentedGreat. this is a great fix.
Comment #2
xurizaemonThanks jghyde. A couple of issues with the above, so applied an improved fix.
1. There's no
$ex->Message(), but there is$ex->getMessage(). PHP Exception docs.2. The previous approach displayed raw HTML retrieved from a remote site without escaping (your suggested fix also resolved this). This way we can actually see if a helpful exception message was returned from Kaltura Client.
Comment #3
jghyde commentedgrobot--
Thanks for explaining all of that. I guess I should have looked inside the $ex object.
So you are proposing changing the last line of my suggested fix to:
Great improvement if it works.
Joe
Comment #4
xurizaemonYeah something like that.
t() + %placeholder means that returned HTML will be escaped so we don't get nasty HTML appearing.
This is in 6.x-2.x CVS already so please test kaltura-6.x-2.x-dev.tar.gz
and re-open this issue if it doesn't work.