function fb_app_admin_form_submit in Drupal for Facebook 6.3
Same name and namespace in other branches
- 6.2 fb_app.admin.inc \fb_app_admin_form_submit()
- 7.3 fb_app.admin.inc \fb_app_admin_form_submit()
1 string reference to 'fb_app_admin_form_submit'
- fb_app_edit_form in ./
fb_app.admin.inc - Builds the form used to edit an application.
File
- ./
fb_app.admin.inc, line 211
Code
function fb_app_admin_form_submit($form, &$form_state) {
$fb_app = (object) $form_state['values'];
$fb_app->data = serialize($fb_app->fb_app_data);
// Get namespace, name from facebook.
fb_admin_get_app_info($fb_app);
$orig_app = $form['#fb_app'];
if ($orig_app->fba_id) {
// Updating.
db_query("UPDATE {fb_app} SET label='%s', status = %d, apikey='%s', secret='%s', id='%s', canvas='%s', title='%s',data='%s' WHERE fba_id = %d", $fb_app->label, $fb_app->status, $fb_app->id, $fb_app->secret, $fb_app->id, $fb_app->namespace, $fb_app->name, $fb_app->data, $orig_app->fba_id);
watchdog('fb_app', 'Updated Facebook Application %label.', array(
'%label' => $fb_app->label,
), WATCHDOG_NOTICE, l(t('view apps'), FB_PATH_ADMIN_APPS));
drupal_set_message(t('Saved changes to Facebook application %title (%label).', array(
'%title' => $fb_app->name,
'%label' => $fb_app->label,
)));
// Should we just go ahead and flush the cache here automatically?
drupal_set_message(t('Recommended: <a href=!cache_url>clear cached data</a> after changing Facebook app settings.', array(
'!cache_url' => url('admin/settings/performance'),
)), 'warning');
}
else {
// Inserting.
db_query("INSERT INTO {fb_app} (label, status, apikey, secret, id, canvas, title, data) VALUES ('%s', %d, '%s', '%s', '%s', '%s', '%s', '%s')", $fb_app->label, $fb_app->status, $fb_app->id, $fb_app->secret, $fb_app->id, $fb_app->namespace, $fb_app->name, $fb_app->data);
watchdog('fb_app', 'Created Facebook Application %label.', array(
'%label' => $fb_app->label,
), WATCHDOG_NOTICE, l(t('view apps'), FB_PATH_ADMIN_APPS));
drupal_set_message(t('Created facebook application %title (%label).', array(
'%label' => $fb_app->label,
'%title' => $fb_app->name,
)));
}
if ($fb_app->status) {
fb_app_set_app_properties($fb_app);
// Set callback URL, etc.
}
$form_state['redirect'] = FB_PATH_ADMIN;
}