mirror of https://github.com/BOINC/boinc.git
Filter import text
Added call to check_markup() function to ensure text being imported matches the input filter; Removed unused OG references from team import (DBOINCP-59)
This commit is contained in:
parent
dc0c8009ed
commit
b3f8c44c79
|
@ -570,7 +570,7 @@ function boincimport_teams() {
|
|||
//drupal_set_message(t('Teams already imported successfully'));
|
||||
//watchdog('boincimport', 'Teams already imported successfully', array(), WATCHDOG_INFO);
|
||||
//return;
|
||||
}
|
||||
}
|
||||
|
||||
require_once (drupal_get_path('module', 'pathauto') .'/pathauto.inc');
|
||||
|
||||
|
@ -2235,7 +2235,10 @@ function _boincimport_strip_bbcode($text) {
|
|||
* Function to properly encode strings.
|
||||
*/
|
||||
function _boincimport_text_sanitize($text) {
|
||||
$input_format = variable_get('boincimport_input_format', 0);
|
||||
$text = html_entity_decode($text, ENT_QUOTES, 'utf-8');
|
||||
// Be sure the text is filtered for the default input format
|
||||
$text = check_markup($text, $input_format);
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
$team_exists = db_query('SELECT team_id FROM {boincteam} WHERE team_id = %d', $boincteam->id);
|
||||
// FIXME: $team_exists==FALSE should be handled as an error and return an error code!
|
||||
|
||||
if($team_exists != FALSE && db_fetch_object($team_exists) == FALSE) {
|
||||
if ($team_exists != FALSE && db_fetch_object($team_exists) == FALSE) {
|
||||
$boincteam->description = _boincimport_text_sanitize($boincteam->description);
|
||||
$teaser = node_teaser($boincteam->description);
|
||||
|
||||
|
@ -40,9 +40,9 @@
|
|||
$node = array(
|
||||
'type' => 'team',
|
||||
'title' => $boincteam->name,
|
||||
'body' => '',
|
||||
'body' => $boincteam->description,
|
||||
'teaser' => $teaser,
|
||||
'uid' => get_drupal_id($boincteam->userid),
|
||||
'uid' => boincuser_lookup_uid($boincteam->userid),
|
||||
'path' => null,
|
||||
'status' => 1, // published or not - always publish
|
||||
'promote' => 0,
|
||||
|
@ -61,22 +61,10 @@
|
|||
else {
|
||||
echo 'Pathauto module is required!';
|
||||
exit;
|
||||
//$node['path'] = check_plain($boincteam->name);
|
||||
}
|
||||
|
||||
// Add special organic group properties
|
||||
$node['og_description'] = strip_tags($boincteam->description);
|
||||
$node['og_selective'] = OG_OPEN;
|
||||
$node['og_register'] = OG_REGISTRATION_NEVER;
|
||||
$node['og_directory'] = OG_DIRECTORY_CHOOSE_FALSE;
|
||||
$node['og_private'] = 0;
|
||||
|
||||
$node = (object) $node; // node_save requires an object form
|
||||
|
||||
$node->field_description[]['value'] = $boincteam->description;
|
||||
$node->field_url[]['value'] = $boincteam->url;
|
||||
$node->field_country[]['value'] = $boincteam->country;
|
||||
|
||||
$node->taxonomy[] = taxonomy_get_term($team_type_tid);
|
||||
|
||||
// Save the team node
|
||||
|
@ -95,9 +83,8 @@
|
|||
$team_members = db_query('SELECT uid FROM {boincuser} WHERE boinc_id IN(%s)', implode(',', $boincteam_member_ids));
|
||||
$team_admin = (int) db_result(db_query('SELECT uid FROM {boincuser} WHERE boinc_id=%d', $boincteam_admin));
|
||||
|
||||
// Assign team membership "subscriptions"
|
||||
while ($drupal_user = db_fetch_object($team_members)) {
|
||||
og_save_subscription($node->nid, $drupal_user->uid, array('is_active' => 1, 'is_admin' => (($drupal_user->uid == $team_admin) ? 1 : 0)));
|
||||
// Add action to take on member accounts?
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue