Dotclear

Changeset 877:e012da998f83


Ignore:
Timestamp:
08/16/12 14:13:27 (13 years ago)
Author:
Dsls <dsls@…>
Branch:
sexy
Message:

Entries passwords will be a dedicated plugin.

Files:
11 edited

Legend:

Unmodified
Added
Removed
  • admin/post.php

    r873 r877  
    1818$post_dt = ''; 
    1919$post_format = $core->auth->getOption('post_format'); 
    20 $post_password = ''; 
    2120$post_url = ''; 
    2221$post_lang = $core->auth->getInfo('user_lang'); 
     
    9089          $post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); 
    9190          $post_format = $post->post_format; 
    92           $post_password = $post->post_password; 
    9391          $post_url = $post->post_url; 
    9492          $post_lang = $post->post_lang; 
     
    149147     $post_selected = !empty($_POST['post_selected']); 
    150148     $post_lang = $_POST['post_lang']; 
    151      $post_password = !empty($_POST['post_password']) ? $_POST['post_password'] : null; 
    152149      
    153150     $post_notes = $_POST['post_notes']; 
     
    171168     $cur->post_dt = $post_dt ? date('Y-m-d H:i:00',strtotime($post_dt)) : ''; 
    172169     $cur->post_format = $post_format; 
    173      $cur->post_password = $post_password; 
    174170     $cur->post_lang = $post_lang; 
    175171     $cur->post_title = $post_title; 
     
    389385     '</label></p>'. 
    390386      
    391      '<p><label for="post_password">'.__('Entry password:'). 
    392      form::field('post_password',10,32,html::escapeHTML($post_password),'maximal'). 
    393      '</label></p>'. 
    394       
    395387     '<div class="lockable">'. 
    396388     '<p><label for="post_url">'.__('Basename:'). 
  • inc/admin/lib.pager.php

    r873 r877  
    9090          } 
    9191           
    92           $protected = ''; 
    93           if ($item->post_password) { 
    94                $protected = sprintf($img,__('protected'),'locker.png'); 
    95           } 
    96            
    9792          $selected = ''; 
    9893          if ($item->post_selected) { 
     
    111106          '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$item->post_dt).'</td>'. 
    112107          '<td class="nowrap">'.$item->user_id.'</td>'. 
    113           '<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.'</td>'. 
     108          '<td class="nowrap status">'.$img_status.' '.$selected.'</td>'. 
    114109          '</tr>'; 
    115110           
     
    180175          } 
    181176           
    182           $protected = ''; 
    183           if ($item->post_password) { 
    184                $protected = sprintf($img,__('protected'),'locker.png'); 
    185           } 
    186            
    187177          $selected = ''; 
    188178          if ($item->post_selected) { 
     
    200190          '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$item->post_dt).'</td>'. 
    201191          '<td class="nowrap">'.$item->user_id.'</td>'. 
    202           '<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.'</td>'. 
     192          '<td class="nowrap status">'.$img_status.' '.$selected.'</td>'. 
    203193          '</tr>'; 
    204194           
  • inc/core/class.dc.blog.php

    r875 r877  
    227227               $strReq = 
    228228               'SELECT P.post_id, P.blog_id, P.user_id, post_dt, '. 
    229                'post_tz, post_creadt, post_upddt, post_format, post_password, '. 
     229               'post_tz, post_creadt, post_upddt, post_format, '. 
    230230               'post_url, post_lang, post_title, '.$content_req. 
    231231               'post_type, post_meta, post_status, post_selected, post_position, '. 
     
    246246           
    247247          if (!$this->core->auth->check('contentadmin',$this->id)) { 
    248                $strReq .= 'AND ((post_status = 1 '; 
    249                 
    250                if ($this->without_password) { 
    251                     $strReq .= 'AND post_password IS NULL '; 
    252                } 
    253                $strReq .= ') '; 
     248               $strReq .= 'AND ((post_status = 1) '; 
    254249                
    255250               if ($this->core->auth->userID()) { 
     
    436431           
    437432          if (!$this->core->auth->check('contentadmin',$this->id)) { 
    438                $strReq .= 'AND ((post_status = 1 '; 
    439                 
    440                if ($this->without_password) { 
    441                     $strReq .= 'AND post_password IS NULL '; 
    442                } 
    443                $strReq .= ') '; 
     433               $strReq .= 'AND ((post_status = 1) '; 
    444434                
    445435               if ($this->core->auth->userID()) { 
     
    518508           
    519509          if (!$this->core->auth->check('contentadmin',$this->id)) { 
    520                $strReq .= 'AND ((post_status = 1 '; 
    521                 
    522                if ($this->without_password) { 
    523                     $strReq .= 'AND post_password IS NULL '; 
    524                } 
    525                $strReq .= ') '; 
     510               $strReq .= 'AND ((post_status = 1) '; 
    526511                
    527512               if ($this->core->auth->userID()) { 
     
    905890          } 
    906891           
    907           if ($cur->post_password === '') { 
    908                $cur->post_password = null; 
    909           } 
    910            
    911892          if ($cur->post_dt == '') { 
    912893               $offset = dt::getTimeOffset($this->core->auth->getInfo('user_tz')); 
  • inc/core/class.dc.meta.php

    r873 r877  
    317317           
    318318          if (!$this->core->auth->check('contentadmin',$this->core->blog->id)) { 
    319                $strReq .= 'AND ((post_status = 1 '; 
    320                 
    321                if ($this->core->blog->without_password) { 
    322                     $strReq .= 'AND post_password IS NULL '; 
    323                } 
    324                $strReq .= ') '; 
     319               $strReq .= 'AND ((post_status = 1) '; 
    325320                
    326321               if ($this->core->auth->userID()) { 
  • inc/core/class.dc.xmlrpc.php

    r873 r877  
    305305          } 
    306306           
    307           if (isset($struct['wp_password'])) { 
    308                $cur->post_password = $struct['wp_password']; 
    309           } 
    310            
    311307          $cur->post_type = 'post'; 
    312308          if (!empty($struct['post_type'])) { 
     
    398394          if (isset($struct['wp_slug'])) { 
    399395               $cur->post_url = $struct['wp_slug']; 
    400           } 
    401            
    402           if (isset($struct['wp_password'])) { 
    403                $cur->post_password = $struct['wp_password']; 
    404396          } 
    405397           
     
    728720                    "text_more"              => '', 
    729721                    "wp_slug"                => $post->post_url, 
    730                     "wp_password"            => $post->post_password, 
    731722                    "wp_author"              => $post->getAuthorCN(), 
    732723                    "wp_page_parent_id"      => 0, 
  • inc/dbschema/db-schema.php

    r852 r877  
    9191     ->post_creadt            ('timestamp',  0,   false,    'now()') 
    9292     ->post_upddt             ('timestamp',  0,   false,    'now()') 
    93      ->post_password          ('varchar',    32,  true,     null) 
    9493     ->post_type              ('varchar',    32,  false,    "'post'") 
    9594     ->post_format            ('varchar',    32,  false,    "'xhtml'") 
  • inc/public/lib.urlhandlers.php

    r876 r877  
    315315               { 
    316316                    $post_id = $_ctx->posts->post_id; 
    317                     $post_password = $_ctx->posts->post_password; 
    318                      
    319                     # Password protected entry 
    320                     if ($post_password != '' && !$_ctx->preview) 
    321                     { 
    322                          # Get passwords cookie 
    323                          if (isset($_COOKIE['dc_passwd'])) { 
    324                               $pwd_cookie = unserialize($_COOKIE['dc_passwd']); 
    325                          } else { 
    326                               $pwd_cookie = array(); 
    327                          } 
    328                           
    329                          # Check for match 
    330                          if ((!empty($_POST['password']) && $_POST['password'] == $post_password) 
    331                          || (isset($pwd_cookie[$post_id]) && $pwd_cookie[$post_id] == $post_password)) 
    332                          { 
    333                               $pwd_cookie[$post_id] = $post_password; 
    334                               setcookie('dc_passwd',serialize($pwd_cookie),0,'/'); 
    335                          } 
    336                          else 
    337                          { 
    338                               self::serveDocument('password-form.html','text/html',false); 
    339                               return; 
    340                          } 
    341                     } 
    342                      
    343317                    # The entry 
    344318                    self::serveDocument('post.html'); 
  • plugins/importExport/inc/flat/class.flat.import.php

    r841 r877  
    440440          } 
    441441           
    442           $post_password = $post->post_password ? (string) $post->post_password : null; 
    443            
    444442          $this->cur_post->post_id            = (integer) $post->post_id; 
    445443          $this->cur_post->blog_id            = (string) $post->blog_id; 
     
    449447          $this->cur_post->post_creadt        = (string) $post->post_creadt; 
    450448          $this->cur_post->post_upddt         = (string) $post->post_upddt; 
    451           $this->cur_post->post_password      = $post_password; 
    452449          $this->cur_post->post_type          = (string) $post->post_type; 
    453450          $this->cur_post->post_format        = (string) $post->post_format; 
  • plugins/pages/_public.php

    r727 r877  
    6161               { 
    6262                    $post_id = $_ctx->posts->post_id; 
    63                     $post_password = $_ctx->posts->post_password; 
    64                      
    65                     # Password protected entry 
    66                     if ($post_password != '' && !$_ctx->preview) 
    67                     { 
    68                          # Get passwords cookie 
    69                          if (isset($_COOKIE['dc_passwd'])) { 
    70                               $pwd_cookie = unserialize($_COOKIE['dc_passwd']); 
    71                          } else { 
    72                               $pwd_cookie = array(); 
    73                          } 
    74                           
    75                          # Check for match 
    76                          if ((!empty($_POST['password']) && $_POST['password'] == $post_password) 
    77                          || (isset($pwd_cookie[$post_id]) && $pwd_cookie[$post_id] == $post_password)) 
    78                          { 
    79                               $pwd_cookie[$post_id] = $post_password; 
    80                               setcookie('dc_passwd',serialize($pwd_cookie),0,'/'); 
    81                          } 
    82                          else 
    83                          { 
    84                               self::serveDocument('password-form.html','text/html',false); 
    85                               return; 
    86                          } 
    87                     } 
    88                      
    89                     $post_comment = 
    90                          isset($_POST['c_name']) && isset($_POST['c_mail']) && 
    91                          isset($_POST['c_site']) && isset($_POST['c_content']) && 
    92                          $_ctx->posts->commentsActive(); 
    93                      
    94                     # Posting a comment 
    95                     if ($post_comment) 
    96                     { 
    97                          # Spam trap 
    98                          if (!empty($_POST['f_mail'])) { 
    99                               http::head(412,'Precondition Failed'); 
    100                               header('Content-Type: text/plain'); 
    101                               echo "So Long, and Thanks For All the Fish"; 
    102                               # Exits immediately the application to preserve the server. 
    103                               exit; 
    104                          } 
    105                           
    106                          $name = $_POST['c_name']; 
    107                          $mail = $_POST['c_mail']; 
    108                          $site = $_POST['c_site']; 
    109                          $content = $_POST['c_content']; 
    110                          $preview = !empty($_POST['preview']); 
    111                           
    112                          if ($content != '') 
    113                          { 
    114                               if ($core->blog->settings->system->wiki_comments) { 
    115                                    $core->initWikiComment(); 
    116                               } else { 
    117                                    $core->initWikiSimpleComment(); 
    118                               } 
    119                               $content = $core->wikiTransform($content); 
    120                               $content = $core->HTMLfilter($content); 
    121                          } 
    122                           
    123                          $_ctx->comment_preview['content'] = $content; 
    124                          $_ctx->comment_preview['rawcontent'] = $_POST['c_content']; 
    125                          $_ctx->comment_preview['name'] = $name; 
    126                          $_ctx->comment_preview['mail'] = $mail; 
    127                          $_ctx->comment_preview['site'] = $site; 
    128                           
    129                          if ($preview) 
    130                          { 
    131                               # --BEHAVIOR-- publicBeforeCommentPreview 
    132                               $core->callBehavior('publicBeforeCommentPreview',$_ctx->comment_preview); 
    133                                
    134                               $_ctx->comment_preview['preview'] = true; 
    135                          } 
    136                          else 
    137                          { 
    138                               # Post the comment 
    139                               $cur = $core->con->openCursor($core->prefix.'comment'); 
    140                               $cur->comment_author = $name; 
    141                               $cur->comment_site = html::clean($site); 
    142                               $cur->comment_email = html::clean($mail); 
    143                               $cur->comment_content = $content; 
    144                               $cur->post_id = $_ctx->posts->post_id; 
    145                               $cur->comment_status = $core->blog->settings->system->comments_pub ? 1 : -1; 
    146                               $cur->comment_ip = http::realIP(); 
    147                                
    148                               $redir = $_ctx->posts->getURL(); 
    149                               $redir .= $core->blog->settings->system->url_scan == 'query_string' ? '&' : '?'; 
    150                                
    151                               try 
    152                               { 
    153                                    if (!text::isEmail($cur->comment_email)) { 
    154                                         throw new Exception(__('You must provide a valid email address.')); 
    155                                    } 
    156                                     
    157                                    # --BEHAVIOR-- publicBeforeCommentCreate 
    158                                    $core->callBehavior('publicBeforeCommentCreate',$cur); 
    159                                    if ($cur->post_id) {                          
    160                                         $comment_id = $core->blog->addComment($cur); 
    161                                     
    162                                         # --BEHAVIOR-- publicAfterCommentCreate 
    163                                         $core->callBehavior('publicAfterCommentCreate',$cur,$comment_id); 
    164                                    } 
    165                                     
    166                                    if ($cur->comment_status == 1) { 
    167                                         $redir_arg = 'pub=1'; 
    168                                    } else { 
    169                                         $redir_arg = 'pub=0'; 
    170                                    } 
    171                                     
    172                                    header('Location: '.$redir.$redir_arg); 
    173                               } 
    174                               catch (Exception $e) 
    175                               { 
    176                                    $_ctx->form_error = $e->getMessage(); 
    177                                    $_ctx->form_error; 
    178                               } 
    179                          } 
    180                     } 
    181                      
    18263                    # The entry 
    18364                    $core->tpl->setPath($core->tpl->getPath(), dirname(__FILE__).'/default-templates'); 
  • plugins/pages/list.php

    r578 r877  
    7979          } 
    8080           
    81           $protected = ''; 
    82           if ($this->rs->post_password) { 
    83                $protected = sprintf($img,__('protected'),'locker.png'); 
    84           } 
    85            
    8681          $selected = ''; 
    8782          if ($this->rs->post_selected) { 
     
    109104          '<td class="nowrap">'.$this->rs->nb_comment.'</td>'. 
    110105          '<td class="nowrap">'.$this->rs->nb_trackback.'</td>'. 
    111           '<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.' '.$attach.'</td>'. 
     106          '<td class="nowrap status">'.$img_status.' '.$selected.' '.$attach.'</td>'. 
    112107          '</tr>'; 
    113108           
  • plugins/pages/page.php

    r854 r877  
    1818$post_dt = ''; 
    1919$post_format = $core->auth->getOption('post_format'); 
    20 $post_password = ''; 
    2120$post_url = ''; 
    2221$post_lang = $core->auth->getInfo('user_lang'); 
     
    9594          $post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); 
    9695          $post_format = $post->post_format; 
    97           $post_password = $post->post_password; 
    9896          $post_url = $post->post_url; 
    9997          $post_lang = $post->post_lang; 
     
    161159     $post_open_tb = !empty($_POST['post_open_tb']); 
    162160     $post_lang = $_POST['post_lang']; 
    163      $post_password = !empty($_POST['post_password']) ? $_POST['post_password'] : null; 
    164161     $post_position = (integer) $_POST['post_position']; 
    165162      
     
    188185     $cur->post_dt = $post_dt ? date('Y-m-d H:i:00',strtotime($post_dt)) : ''; 
    189186     $cur->post_format = $post_format; 
    190      $cur->post_password = $post_password; 
    191187     $cur->post_lang = $post_lang; 
    192188     $cur->post_title = $post_title; 
     
    433429     form::combo('post_lang',$lang_combo,$post_lang).'</label></p>'. 
    434430      
    435      '<p><label for="post_password">'.__('Page password:'). 
    436      form::field('post_password',10,32,html::escapeHTML($post_password),'maximal'). 
    437      '</label></p>'. 
    438       
    439431     '<div class="lockable">'. 
    440432     '<p><label for="post_url">'.__('Basename:'). 
Note: See TracChangeset for help on using the changeset viewer.

Sites map