Dotclear

Changeset 620


Ignore:
Timestamp:
12/31/08 02:11:59 (15 years ago)
Author:
Moe
Message:

Contribute 1.0-alpha6 :

  • added editable fields on the post edit page
  • added filter to My Meta values
Location:
plugins/contribute
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • plugins/contribute/_admin.php

    r614 r620  
    4646     public static function adminBeforePostUpdate($cur,$post_id) 
    4747     { 
     48          $meta = new dcMeta($GLOBALS['core']); 
     49           
     50          try 
     51          { 
     52               if (isset($_POST['contribute_author'])) 
     53               { 
     54                    $meta->delPostMeta($post_id,'contribute_author'); 
     55                    $meta->setPostMeta($post_id,'contribute_author', 
     56                         $_POST['contribute_author']); 
     57               } 
     58                
     59               if (isset($_POST['contribute_mail'])) 
     60               { 
     61                    $meta->delPostMeta($post_id,'contribute_mail'); 
     62                    $meta->setPostMeta($post_id,'contribute_mail', 
     63                         $_POST['contribute_mail']); 
     64               } 
     65                
     66               if (isset($_POST['contribute_site'])) 
     67               { 
     68                    $meta->delPostMeta($post_id,'contribute_site'); 
     69                    $meta->setPostMeta($post_id,'contribute_site', 
     70                         $_POST['contribute_site']); 
     71               }     
     72          } 
     73          catch (Exception $e) 
     74          { 
     75               $core->error->add($e->getMessage()); 
     76          } 
     77           
    4878          if (isset($_POST['contribute_delete_author']) 
    4979               && ($_POST['contribute_delete_author'] == '1')) 
    5080          { 
    51                $meta = new dcMeta($GLOBALS['core']); 
    52                 
    5381               try 
    5482               { 
     
    76104          $site = ($post) ? $meta->getMetaStr($post->post_meta,'contribute_site') : ''; 
    77105           
    78           $infos = array(); 
     106          $str = ''; 
    79107           
    80108          if (!empty($author)) 
    81           { 
    82                // fixme : display fields 
    83                $infos[] = sprintf(__('Post submitted by %s'),$author); 
    84  
    85                if (!empty($mail)) 
    86                { 
    87                     $infos[] = sprintf(__('Email address : %s'),'<a href="mailto:'.$mail.'">'.$mail.'</a>'); 
    88                } 
     109          {          
     110               $str .=  '<p>'. 
     111               '<label class="classic" for="contribute_author">'. 
     112               __('Author:'). 
     113               form::field('contribute_author',10,255,html::escapeHTML($author),'maximal'). 
     114               '</label>'. 
     115               '</p>'; 
     116                
    89117               if (!empty($site)) 
    90118               { 
    91                     # prevent malformed URLs 
    92                     # inspirated by /dotclear/inc/clearbricks/net.http/class.net.http.php 
    93                     $parsed_url = @parse_url($site); 
    94                     if ($parsed_url != false) 
    95                     { 
    96                          $host = '['.$parsed_url['host'].']'; 
    97                     } 
    98                     else 
    99                     { 
    100                          $host = ''; 
    101                     } 
    102                     $infos[] = sprintf(__('Website : %s'),'<a href="'.$site.'">'.$host.'</a>'); 
    103                } 
    104                if (!empty($infos)) 
    105                { 
    106                     $infos = '<ul><li>'.implode('</li><li>',$infos).'</li></ul>'; 
     119                    $link = '<br />'.'<a href="mailto:'.html::escapeHTML($mail).'">'. 
     120                         __('send email').'</a>'; 
    107121               } 
    108122               else 
    109123               { 
    110                     $infos = ''; 
    111                }               
     124                    $link = ''; 
     125               } 
     126                
     127               $str .=  '<p>'. 
     128               '<label class="classic" for="contribute_mail">'. 
     129               __('Email:'). 
     130               form::field('contribute_mail',10,255,html::escapeHTML($mail),'maximal'). 
     131               '</label>'. 
     132               $link. 
     133               '</p>'; 
     134                
     135               # prevent malformed URLs 
     136               # inspirated by /dotclear/inc/clearbricks/net.http/class.net.http.php 
     137               if (!empty($site)) 
     138               { 
     139                    $parsed_url = @parse_url($site); 
     140                    $host = (($parsed_url != false) ? '['.$parsed_url['host'].']' : ''); 
     141                    $link = '<br />'. 
     142                         '<a href="'.html::escapeHTML($site).'">'.$host.'</a>'; 
     143               } 
     144               else 
     145               { 
     146                    $link = ''; 
     147               } 
     148                
     149               $str .=  '<p>'. 
     150               '<label class="classic" for="contribute_site">'. 
     151               __('Web site:'). 
     152               form::field('contribute_site',10,255,html::escapeHTML($site),'maximal'). 
     153               '</label>'. 
     154               $link. 
     155               '</p>'; 
    112156                
    113157               echo 
    114158               '<div id="planet-infos">'.'<h3>'.('Contribute').'</h3>'. 
    115                $infos. 
     159               $str. 
    116160               '<p>'. 
    117161               '<label class="classic" for="contribute_delete_author">'. 
  • plugins/contribute/_define.php

    r614 r620  
    2626     /* Description*/                "Allow visitors to contribute to your blog", 
    2727     /* Author */                    "Moe (http://gniark.net/)", 
    28      /* Version */                   '1.0-alpha5', 
     28     /* Version */                   '1.0-alpha6', 
    2929     /* Permissions */               'admin' 
    3030); 
  • plugins/contribute/_public.php

    r614 r620  
    4848          $_ctx->contribute->selected_tags = array(); 
    4949           
     50          # Metadata 
    5051          if ($core->plugins->moduleExists('metadata')) 
    5152          { 
     
    5758          } 
    5859           
     60          # My Meta 
    5961          if ($core->plugins->moduleExists('mymeta')) 
    6062          { 
     
    129131                              } 
    130132                         } 
     133                         # /My Meta 
    131134                    } 
    132135                    # empty post 
     
    157160                         # My Meta 
    158161                         $post->mymeta = array(); 
     162                         # /My Meta 
    159163                          
    160164                         # formats 
     
    169173                               
    170174                              if ((isset($_POST['post_format'])) 
    171                               && in_array($_POST['post_format'],$core->getFormaters())) 
     175                                   && in_array($_POST['post_format'],$core->getFormaters())) 
    172176                              { 
    173177                                   $post->post_format = $_POST['post_format']; 
     
    324328                              foreach ($_ctx->contribute->mymeta->getAll() as $k => $v) 
    325329                              { 
    326                                    if ($v->enabled) 
     330                                   if ($v->enabled && isset($_POST['mymeta_'.$k]) 
     331                                        && in_array($k,$mymeta_values)) 
    327332                                   { 
    328                                         if (isset($_POST['mymeta_'.$k])) 
    329                                         { 
    330                                              if (in_array($k,$mymeta_values)) 
    331                                              { 
    332                                                   $post->mymeta[$k] = $_POST['mymeta_'.$k]; 
    333                                              } 
    334                                         } 
     333                                        $post->mymeta[$k] = $_POST['mymeta_'.$k]; 
    335334                                   } 
    336335                              } 
     
    483482                                        && ($core->blog->settings->contribute_allow_mymeta === true)) 
    484483                                   { 
    485                                         $_ctx->contribute->mymeta->setMeta($post_id,$_POST); 
    486                                         // fixme : filter My Meta values 
     484                                        foreach ($_ctx->contribute->mymeta->getAll() as $k => $v) 
     485                                        { 
     486                                             if ($v->enabled && isset($_POST['mymeta_'.$k]) 
     487                                                  && in_array($k,$mymeta_values)) 
     488                                             { 
     489                                                  $meta->setPostMeta($post_id,$k,$_POST['mymeta_'.$k]); 
     490                                             } 
     491                                        } 
    487492                                   } 
     493                                   # /My Meta 
    488494                              } 
    489                                
    490                                
    491                                
    492                               $separator = '?'; 
    493                               if ($core->blog->settings->url_scan == 'query_string') 
    494                               {$separator = '&';} 
    495495                               
    496496                              # send email notification 
  • plugins/contribute/index.php

    r614 r620  
    182182                    <?php echo(__('Only the users with the following permissions on this blog are shown:')); ?> 
    183183               </p> 
    184                <ul class="form-note"> 
     184               <ul> 
    185185                    <li><!-- usage --><?php echo(__('manage their own entries and comments')); ?></li> 
    186186               </ul> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map