Dotclear

Changeset 3033:5691f5e1ccc6


Ignore:
Timestamp:
07/03/15 13:14:05 (10 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Add with or without password filter rather than password order, add also format filter (xhtml, wiki, …). Addresses #1775

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • admin/posts.php

    r3031 r3033  
    8282     ); 
    8383 
     84     $password_combo = array( 
     85     '-' => '', 
     86     __('With password') => '1', 
     87     __('Without password') => '0' 
     88     ); 
     89 
    8490     # Months array 
    8591     $dt_m_combo = array_merge( 
     
    9197          array('-' => ''), 
    9298          dcAdminCombos::getLangsCombo($langs,false) 
     99     ); 
     100 
     101     # Post formats 
     102     $core_formaters = $core->getFormaters(); 
     103     $available_formats = array(); 
     104     foreach ($core_formaters as $editor => $formats) { 
     105          foreach ($formats as $format) { 
     106               $available_formats[$format] = $format; 
     107          } 
     108     } 
     109     $format_combo = array_merge( 
     110          array('-' => ''), 
     111          $available_formats 
    93112     ); 
    94113 
     
    101120     __('Selected') => 'post_selected', 
    102121     __('Number of comments') => 'nb_comment', 
    103      __('Number of trackbacks') => 'nb_trackback', 
    104      __('Password') => 'post_password' 
     122     __('Number of trackbacks') => 'nb_trackback' 
    105123     ); 
    106124 
     
    121139/* Get posts 
    122140-------------------------------------------------------- */ 
    123 $user_id = !empty($_GET['user_id']) ?   $_GET['user_id'] : ''; 
    124 $cat_id = !empty($_GET['cat_id']) ?     $_GET['cat_id'] : ''; 
    125 $status = isset($_GET['status']) ? $_GET['status'] : ''; 
    126 $selected = isset($_GET['selected']) ?  $_GET['selected'] : ''; 
    127 $attachment = isset($_GET['attachment']) ?   $_GET['attachment'] : ''; 
    128 $month = !empty($_GET['month']) ?       $_GET['month'] : ''; 
    129 $lang = !empty($_GET['lang']) ?         $_GET['lang'] : ''; 
     141$user_id = !empty($_GET['user_id']) ? $_GET['user_id'] : ''; 
     142$cat_id = !empty($_GET['cat_id']) ? $_GET['cat_id'] : ''; 
     143$status = isset($_GET['status']) ? $_GET['status'] : ''; 
     144$password = isset($_GET['password']) ? $_GET['password'] : ''; 
     145$selected = isset($_GET['selected']) ? $_GET['selected'] : ''; 
     146$attachment = isset($_GET['attachment']) ? $_GET['attachment'] : ''; 
     147$month = !empty($_GET['month']) ? $_GET['month'] : ''; 
     148$lang = !empty($_GET['lang']) ?    $_GET['lang'] : ''; 
     149$format = !empty($_GET['format']) ? $_GET['format'] : ''; 
    130150$sortby = !empty($_GET['sortby']) ?     $_GET['sortby'] : 'post_dt'; 
    131 $order = !empty($_GET['order']) ?       $_GET['order'] : 'desc'; 
     151$order = !empty($_GET['order']) ? $_GET['order'] : 'desc'; 
    132152 
    133153$show_filters = false; 
     
    145165$params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page); 
    146166$params['no_content'] = true; 
     167$params['where'] = ''; 
    147168 
    148169# - User filter 
     
    170191} 
    171192 
     193# - Password filter 
     194if ($password !== '' && in_array($password,$password_combo)) { 
     195     $params['where'] .= ' AND post_password IS '.($password ? 'NOT ' : '').'NULL '; 
     196     $show_filters = true; 
     197} else { 
     198     $password=''; 
     199} 
     200 
    172201# - Selected filter 
    173202if ($selected !== '' && in_array($selected,$selected_combo)) { 
     
    178207} 
    179208 
    180 # - Selected filter 
     209# - Attachment filter 
    181210if ($attachment !== '' && in_array($attachment,$attachment_combo)) { 
    182211     $params['media'] = $attachment; 
     
    202231} else { 
    203232     $lang=''; 
     233} 
     234 
     235# - Format filter 
     236if ($format !== '' && in_array($format,$format_combo)) { 
     237     $params['where'] .= " AND post_format = '".$format."' "; 
     238     $show_filters = true; 
     239} else { 
     240     $format=''; 
    204241} 
    205242 
     
    272309     '<p><label for="status" class="ib">'.__('Status:').'</label> ' . 
    273310     form::combo('status',$status_combo,$status).'</p> '. 
     311     '<p><label for="format" class="ib">'.__('Format:').'</label> '. 
     312     form::combo('format',$format_combo,$format).'</p>'. 
     313     '<p><label for="password" class="ib">'.__('Password:').'</label> '. 
     314     form::combo('password',$password_combo,$password).'</p>'. 
    274315     '</div>'. 
    275316 
     
    316357     form::hidden(array('cat_id'),$cat_id). 
    317358     form::hidden(array('status'),$status). 
     359     form::hidden(array('password'),$password). 
    318360     form::hidden(array('selected'),$selected). 
    319361     form::hidden(array('attachment'),$attachment). 
  • inc/core/class.dc.blog.php

    r2800 r3033  
    964964          } 
    965965 
     966          if (!empty($params['where'])) { 
     967               $strReq .= $params['where'].' '; 
     968          } 
     969 
    966970          if (!empty($params['sql'])) { 
    967971               $strReq .= $params['sql'].' '; 
  • locales/fr/main.po

    r3030 r3033  
    36513651msgstr "L'erreur suivante a été rencontrée lors de la tentative d'accès à la base de données :" 
    36523652 
     3653msgid "With password" 
     3654msgstr "Avec mot de passe" 
     3655 
     3656msgid "Without password" 
     3657msgstr "Sans mot de passe" 
     3658 
     3659msgid "Format:" 
     3660msgstr "Format :" 
     3661 
    36533662#~ msgid "visual" 
    36543663#~ msgstr "visuel" 
Note: See TracChangeset for help on using the changeset viewer.

Sites map