Changeset 1378

Show
Ignore:
Timestamp:
11/28/08 23:07:20 (6 weeks ago)
Author:
MattRead
Message:

update blogroll

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • plugins/blogroll/trunk/blogroll.plugin.php

    r1377 r1378  
    192192            if(isset($form->quick_url) && $form->quick_url->value != '') { 
    193193                $data= $this->get_info_from_url($form->quick_url->value); 
    194  
    195                 if (!$data) { 
    196                     Session::error( _t("Could not find information for {$form->quick_url->value}", 'blogroll') ); 
    197                     Utils::redirect( URL::get( 'admin', 'page=publish&content_type=blogroll' ) ); 
    198                     exit; 
     194                if ( $data ) { 
     195                    $data = array_map( create_function('$a', 'return InputFilter::filter($a);'), $data ); 
     196                    $post->title= $data['name']; 
     197                    $post->info->url= $data['url']; 
     198                    $post->content= $data['description']; 
     199                    $post->info->feedurl= $data['feed']; 
     200                    $post->slug= Utils::slugify($data['name']); 
     201                    $post->status= Post::status('published'); 
    199202                } 
    200                 $data = array_map( create_function('$a', 'return InputFilter::filter($a);'), $data ); 
    201                 $post->title= $data['name']; 
    202                 $post->info->url= $data['url']; 
    203                 $post->content= $data['description']; 
    204                 $post->info->feedurl= $data['feed']; 
    205                 $post->slug= Utils::slugify($data['name']); 
    206                 $post->status= Post::status('published'); 
    207  
    208             } else { 
    209                 foreach ($this->info_fields as $field_name) { 
    210                     $post->info->$field_name= $form->$field_name->value; 
     203                else { 
     204                    Session::error( _t("Could not find information for {$form->quick_url->value}. Please enter the information manually.", 'blogroll') ); 
     205                    $post->info->url = $form->quick_url->value; 
     206                    return; 
    211207                } 
     208            } 
     209            foreach ($this->info_fields as $field_name) { 
     210                $post->info->$field_name= $form->$field_name->value; 
    212211            } 
    213212        } 
     
    773772                } 
    774773                Options::set( 'blogroll__last_update', gmdate( 'D, d M Y G:i:s e' ) ); 
     774                return true; 
    775775            }  
    776776            else { 
     
    778778                return false; 
    779779            } 
    780             return true; 
    781         } 
     780        } 
     781        return $success; 
    782782    } 
    783783