| 1 |
<?php |
<?php |
| 2 |
|
|
| 3 |
// $Id: aggregation.module,v 1.4.2.17 2007/04/18 00:31:49 mistknight Exp $ |
// $Id: aggregation.module,v 1.4.2.18 2007/04/28 21:32:13 mistknight Exp $ |
| 4 |
|
|
| 5 |
/** |
/** |
| 6 |
* A number of defs to ease naming |
* A number of defs to ease naming |
| 32 |
} |
} |
| 33 |
} |
} |
| 34 |
|
|
| 35 |
|
// this is a helper function to sanitize the input |
| 36 |
|
function aggregation_sanitize_input($input) |
| 37 |
|
{ |
| 38 |
|
// this will remove all style attributes |
| 39 |
|
$regexp = '@([^;"]+)?(?<!):(?!\/\/(.+?)\/)((.*?)[^;"]+)(;)?@is'; |
| 40 |
|
$input = preg_replace($regexp, '', $input); |
| 41 |
|
$input = preg_replace('@[a-z]*=""@is', '', $input); // remove any unwanted style attributes |
| 42 |
|
|
| 43 |
|
$tags_to_strip = Array("script","embed","object","frameset","frame","iframe", "meta", "link", "style"); |
| 44 |
|
|
| 45 |
|
foreach ($tags_to_strip as $tag) |
| 46 |
|
$input = preg_replace("/<\/?" . $tag . "(.|\s)*?>/i","",$input); |
| 47 |
|
|
| 48 |
|
// everything should now be clean, return result |
| 49 |
|
|
| 50 |
|
return $input; |
| 51 |
|
} |
| 52 |
|
|
| 53 |
/** |
/** |
| 54 |
* Implementation of hook_perm(). |
* Implementation of hook_perm(). |
| 310 |
'#default_value' => $node->url, |
'#default_value' => $node->url, |
| 311 |
'#required' => TRUE, |
'#required' => TRUE, |
| 312 |
'#title' => t('Feed URL'), |
'#title' => t('Feed URL'), |
| 313 |
'#description' => t('Please provide the feed URL.') |
'#description' => t('Please provide the feed URL.'), |
| 314 |
|
'#maxlength' => 250, |
| 315 |
); |
); |
| 316 |
|
|
| 317 |
$form['authentication'] = array ( |
$form['authentication'] = array ( |
| 719 |
'#default_value' => $node->url, |
'#default_value' => $node->url, |
| 720 |
'#required' => FALSE, |
'#required' => FALSE, |
| 721 |
'#title' => t('Original URL'), |
'#title' => t('Original URL'), |
| 722 |
'#description' => t('Provide the URL of the original article if needed.') |
'#description' => t('Provide the URL of the original article if needed.'), |
| 723 |
|
'#maxlength' => 250, |
| 724 |
); |
); |
| 725 |
|
|
| 726 |
$form['link_to_original_url'] = array( |
$form['link_to_original_url'] = array( |
| 1318 |
$item_object->image_guid = $image_guid; |
$item_object->image_guid = $image_guid; |
| 1319 |
|
|
| 1320 |
$item_object->fid = $feed->nid; |
$item_object->fid = $feed->nid; |
| 1321 |
$item_object->title = $title; |
$item_object->title = check_plain($title); |
| 1322 |
$item_object->body = $body; |
$item_object->body = aggregation_sanitize_input($body); |
| 1323 |
$item_object->teaser = $teaser; |
$item_object->teaser = aggregation_sanitize_input($teaser); |
| 1324 |
$item_object->original_author = $original_author; |
$item_object->original_author = check_plain($original_author); |
| 1325 |
$item_object->url = is_null($original_item_url) ? '' : $original_item_url; |
$item_object->url = is_null($original_item_url) || !valid_url($original_item_url, TRUE) ? '' : $original_item_url; |
| 1326 |
$item_object->created = is_null($timestamp) ? time() : $timestamp; |
$item_object->created = is_null($timestamp) ? time() : $timestamp; |
| 1327 |
$item_object->type = 'aggregation_item'; |
$item_object->type = 'aggregation_item'; |
| 1328 |
|
|
| 1373 |
|
|
| 1374 |
$image_object = clone($item_object); |
$image_object = clone($item_object); |
| 1375 |
|
|
| 1376 |
$image_object->title = $image_array['title']; |
$image_object->title = check_plain($image_array['title']); |
| 1377 |
$image_object->body = $image_array['body']; |
$image_object->body = aggregation_sanitize_input($image_array['body']); |
| 1378 |
$image_object->teaser = $image_array['teaser']; |
$image_object->teaser = aggregation_sanitize_input($image_array['teaser']); |
| 1379 |
$image_object->description = ''; |
$image_object->description = ''; |
| 1380 |
$image_object->created = $image_array['timestamp']; |
$image_object->created = $image_array['timestamp']; |
| 1381 |
$image_object->type = 'image'; |
$image_object->type = 'image'; |