Changeset 189

Show
Ignore:
Timestamp:
06/18/06 12:02:50 (2 years ago)
Author:
eadiaz
Message:

More secure version.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/public_html/post.php

    r149 r189  
    7979 
    8080  if (!$bm_users->is_logged_in()) { 
    81           $bm_home = $_GET['page']
     81          $bm_home = $bm_page
    8282          $login_url = 'login.php?from=post'; 
    8383          $action = ''; 
     
    9696  } 
    9797 
    98   if (empty($_POST) || empty($_POST['step'])) 
     98  $step = intval($_POST['step']); 
     99  if (empty($_POST) || $step == 0) 
    99100  { 
    100101          $step = 1; 
    101           if (!empty($_GET['url'])) { 
    102                   $smarty->assign('url', $_GET['url']); 
     102          $url = $_GET['url']; 
     103          if (!empty($url)) 
     104          { 
     105                  $smarty->assign('url', $url); 
    103106          } 
    104107          else { 
     
    121124 
    122125         $bm_errors = 0; 
     126         $step = $_POST['step']; 
    123127         $memes = new memes($bm_db, $bm_user, $bm_promo_level); 
    124128         if ($_POST['step'] == 1) { 
     
    129133                         $url = ''; 
    130134                 } 
    131                  $smarty->assign('content_type',  $_POST['content_type']); 
     135                 $content_type = $_POST['content_type']; 
     136                 $smarty->assign('content_type',  $content_type); 
    132137                 if (empty($title)) { 
    133138                         $smarty->assign('error_title', true); 
     
    140145                 if (!empty($url)) { 
    141146                         $smarty->assign('url', check_plain($url)); 
    142                          if (!check_url($url)) { 
     147                         if (check_url($url) == 0) { 
     148                                 echo "bad url = $url"; 
    143149                                 $smarty->assign('error_url', true); 
    144150                                 $bm_errors++; 
     
    189195                 $smarty->assign('meme_tags', check_plain($meme_tags)); 
    190196                 $smarty->assign('favicon', $favicon); 
    191                  $smarty->assign('micro_content', get_youtube($url)); 
     197                 $smarty->assign('gravatar', get_gravatar($bm_url, $bm_users->get_user_email(), 16));  
     198                 $video = get_youtube($url); 
     199                 $smarty->assign('micro_content', $video); 
     200                 if (empty($video)) 
     201                         $smarty->assign('page_image', 'http://img.simpleapi.net/small/'.$url); 
    192202                 $smarty->assign('debates', $_POST['debates']); 
    193203                 if ($bm_errors == 0) { 
     
    222232                         $smarty->assign('meme_tags', check_plain($meme_tags)); 
    223233                         $smarty->assign('cats', $bm_options); 
    224                          $smarty->assign('micro_content', get_youtube($url)); 
     234                         $smarty->assign('gravatar', get_gravatar($bm_url, $bm_users->get_user_email(), 16));  
     235                         $video = get_youtube($url); 
     236                         $smarty->assign('micro_content', $video); 
     237                         if (empty($video)) 
     238                                 $smarty->assign('page_image', 'http://img.simpleapi.net/small/'.$url); 
    225239                         $smarty->assign('favicon', $favicon); 
    226240                 } 
     
    229243                         $_POST['user_id'] = $bm_users->get_user_id(); 
    230244                         $memes->add_meme($_POST); 
     245                         $smarty->clear_all_cache(); 
    231246             $title = $_POST['title']; 
    232247                         $url   = $_POST['url'];