Dotclear

Changeset 2382


Ignore:
Timestamp:
06/21/10 18:13:15 (13 years ago)
Author:
JcDenis
Message:

postExpired 0.3.1

  • Fixed user rights
  • Fixed (again) PHP 5.3 compatibility
  • Fixed typo
Location:
plugins/postExpired
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • plugins/postExpired/_admin.php

    r2330 r2382  
    1313if (!defined('DC_CONTEXT_ADMIN')){return;} 
    1414 
     15if (!$core->auth->check('usage,contentadmin',$core->blog->id)) { return; } 
     16 
    1517# Admin behaviors 
    1618$core->addBehavior('adminPostHeaders',array('postExpiredAdmin','header')); 
     
    3032          # Getting categories 
    3133          $categories_combo = array( 
    32                __('not changed') => '', 
    33                __('uncategorized') => '.' 
     34               __('Not changed') => '', 
     35               __('Uncategorized') => '.' 
    3436          ); 
    3537          try { 
     
    5052     { 
    5153          return array( 
    52                __('not changed') => '', 
    53                __('pending') => '.-2', 
    54                __('unpublished') => '.0' 
     54               __('Not changed') => '', 
     55               __('Pending') => '.-2', 
     56               __('Unpublished') => '.0' 
    5557          ); 
    5658     } 
     
    5961     { 
    6062          return array( 
    61                __('not changed') => '', 
    62                __('selected') => '.1', 
    63                __('not selected') => '.0' 
     63               __('Not changed') => '', 
     64               __('Selected') => '.1', 
     65               __('Not selected') => '.0' 
    6466          ); 
    6567     } 
     
    7577          global $core; 
    7678          $expired_date = $expired_status = $expired_cat = $expired_selected = ''; 
     79          $can_edit = true; 
    7780 
    7881          if ($post) 
    7982          { 
     83               $can_edit = $post->isEditable(); 
    8084               $rs_date = $core->meta->getMetadata(array('meta_type'=>'postexpired','limit'=>1,'post_id'=>$post->post_id)); 
    8185               if (!$rs_date->isEmpty()) 
     
    96100          echo  
    97101          '<h3 id="postexpired-form-title">'.__('Expired date').'</h3>'. 
    98           '<div id="postexpired-form-content">'. 
    99           '<p><label>'.__('Date:'). 
    100           form::field('post_expired_date',16,16,$expired_date,'',3). 
    101           '</label></p>'. 
    102           '<p><label>'.__('Change status on expire:'). 
    103           form::combo('post_expired_status',self::statusCombo(),$expired_status,'',3). 
    104           '</label></p>'. 
    105           '<p><label>'.__('Change category on expire:'). 
    106           form::combo('post_expired_cat',self::categoriesCombo(),$expired_cat,'',3). 
    107           '</label></p>'. 
    108           '<p><label>'.__('Change selection on expire:'). 
    109           form::combo('post_expired_selected',self::selectedCombo(),$expired_selected,'',3). 
    110           '</label></p>'; 
     102          '<div id="postexpired-form-content">'; 
     103           
     104          if (!$can_edit && $post) 
     105          { 
     106               $status = (string) array_search($expired_status,self::statusCombo()); 
     107               $category = (string) array_search($expired_cat,self::categoriesCombo()); 
     108               $selected = (string) array_search($expired_selected,self::selectedCombo()); 
     109                
     110               echo 
     111               '<p>'.__('Date:').' '.$expired_date.'</p>'. 
     112               '<p>'.__('Status:').' '.$status.'</p>'. 
     113               '<p>'.__('Category:').' '.$category.'</p>'. 
     114               '<p>'.__('Selected:').' '.$selected.'</p>'; 
     115          } 
     116          else 
     117          { 
     118               echo  
     119               '<p><label>'.__('Date:'). 
     120               form::field('post_expired_date',16,16,$expired_date,'',3). 
     121               '</label></p>'. 
     122               '<p><label>'.__('Change status on expire:'). 
     123               form::combo('post_expired_status',self::statusCombo(),$expired_status,'',3). 
     124               '</label></p>'. 
     125               '<p><label>'.__('Change category on expire:'). 
     126               form::combo('post_expired_cat',self::categoriesCombo(),$expired_cat,'',3). 
     127               '</label></p>'. 
     128               '<p><label>'.__('Change selection on expire:'). 
     129               form::combo('post_expired_selected',self::selectedCombo(),$expired_selected,'',3). 
     130               '</label></p>'; 
     131          } 
    111132           
    112133          # --BEHAVIOR-- adminPostExpiredFormSidebar 
     
    116137     } 
    117138      
    118      public static function set(&$cur,&$post_id) 
     139     public static function set($cur,$post_id) 
    119140     { 
    120141          global $core; 
     
    169190     } 
    170191      
    171      public static function combo(&$args) 
    172      { 
    173           if ($GLOBALS['core']->auth->check('usage,contentadmin',$GLOBALS['core']->blog->id)) 
    174           { 
    175                $args[0][__('Expired entries')][__('add expired date')] = 'postexpired_add'; 
    176           } 
    177           if ($GLOBALS['core']->auth->check('delete,contentadmin',$GLOBALS['core']->blog->id)) 
    178           { 
    179                $args[0][__('Expired entries')][__('remove expired date')] = 'postexpired_remove'; 
    180           } 
    181      } 
    182       
    183      public static function action(&$core,$posts,$action,$redir) 
     192     public static function combo($args) 
     193     { 
     194          global $core; 
     195          if ($core->auth->check('usage,contentadmin',$core->blog->id)) 
     196          { 
     197               $args[0][__('Expired entries')][__('Add expired date')] = 'postexpired_add'; 
     198          } 
     199          if ($core->auth->check('delete,contentadmin',$core->blog->id)) 
     200          { 
     201               $args[0][__('Expired entries')][__('Remove expired date')] = 'postexpired_remove'; 
     202          } 
     203     } 
     204      
     205     public static function action($core,$posts,$action,$redir) 
    184206     { 
    185207          if ($action == 'action_postexpired_add') 
     
    252274                    while ($rs->fetch()) 
    253275                    { 
    254                          self::del($rs->post_id); 
     276                         if ($post->isEditable()) 
     277                         { 
     278                              self::del($rs->post_id); 
     279                         } 
    255280                    } 
    256281                     
  • plugins/postExpired/_define.php

    r2330 r2382  
    1717     /* Description*/         "Change entries options at a given date", 
    1818     /* Author */             "JC Denis", 
    19      /* Version */            '0.3', 
    20      /* Permissions */        'contentadmin' 
     19     /* Version */            '0.3.1', 
     20     /* Permissions */        'usage,contentadmin' 
    2121); 
    22      /* date */          #20100608 
     22     /* date */          #20100621 
    2323?> 
  • plugins/postExpired/_public.php

    r2330 r2382  
    1616__('This entry has no expirion date'); 
    1717 
    18 if (in_array($core->url->type,array('default','feed'))){ 
    19      $core->addBehavior('publicBeforeDocument',array('publicBehaviorPostExpired','unpublishExpiredEntries')); 
     18if (in_array($core->url->type,array('default','feed'))){ //launch update only on home page and feed 
     19     $core->addBehavior('publicBeforeDocument',array('publicBehaviorPostExpired','updateExpiredEntries')); 
    2020} 
    2121$core->addBehavior('coreBlogGetPosts',array('publicBehaviorPostExpired','coreBlogGetPosts')); 
     
    2727class publicBehaviorPostExpired 
    2828{ 
    29      public static function unpublishExpiredEntries($core) 
     29     public static function updateExpiredEntries($core) 
    3030     { 
    3131          # Get expired dates and post_id 
     
    139139     } 
    140140 
    141      public static function coreBlogGetPosts(&$rs) 
     141     public static function coreBlogGetPosts($rs) 
    142142     { 
    143143          $rs->extend('rsExtPostExpiredPublic'); 
     
    147147class rsExtPostExpiredPublic extends rsExtPost 
    148148{ 
    149      public static function postExpiredDate(&$rs,$absolute_urls=false) 
    150      { 
    151           if (!$rs->postexpired[$rs->post_id]) 
     149     public static function postExpiredDate($rs,$absolute_urls=false) 
     150     { 
     151          if (!$rs->postexpired[$rs->post_id]) //memory 
    152152          { 
    153153               $params = array( 
  • plugins/postExpired/locales/fr/main.lang.php

    r2187 r2382  
    11<?php 
    2 // Language: français  
    3 // Module: postExpired - 0.2 
    4 // Date: 2010-04-14 02:18:31  
    5 // Translated with dcTranslater - 1.3  
    6  
    7 #_admin.php:33 
    8 #_admin.php:51 
    9 #_admin.php:60 
    10 $GLOBALS['__l10n']['not changed'] = 'inchangé'; 
     2// Language: Français  
     3// Module: postExpired - 0.3.1 
     4// Date: 2010-06-21 16:01:48  
     5// Translated with dcTranslater - 1.4  
    116 
    127#_admin.php:34 
    13 $GLOBALS['__l10n']['uncategorized'] = 'non catégorisé'; 
     8#_admin.php:54 
     9#_admin.php:63 
     10$GLOBALS['__l10n']['Not changed'] = 'Inchangé'; 
    1411 
    15 #_admin.php:97 
     12#_admin.php:55 
     13$GLOBALS['__l10n']['Pending'] = 'En attente'; 
     14 
     15#_admin.php:56 
     16$GLOBALS['__l10n']['Unpublished'] = 'Non publié'; 
     17 
     18#_admin.php:65 
     19$GLOBALS['__l10n']['Not selected'] = 'Non sélectionné'; 
     20 
     21#_admin.php:101 
    1622$GLOBALS['__l10n']['Expired date'] = 'Date de péremption'; 
    1723 
    18 #_admin.php:102 
    19 #_admin.php:270 
     24#_admin.php:122 
     25#_admin.php:302 
    2026$GLOBALS['__l10n']['Change status on expire:'] = 'Changer de status à cette date :'; 
    2127 
    22 #_admin.php:105 
    23 #_admin.php:273 
     28#_admin.php:125 
     29#_admin.php:305 
    2430$GLOBALS['__l10n']['Change category on expire:'] = 'Changer da catégorie à cette date :'; 
    2531 
    26 #_admin.php:108 
    27 #_admin.php:276 
    28 $GLOBALS['__l10n']['Change selection on expire:'] = 'Changer la selecion à cette date :'; 
     32#_admin.php:128 
     33#_admin.php:308 
     34$GLOBALS['__l10n']['Change selection on expire:'] = 'Changer la sélection à cette date :'; 
    2935 
    30 #_admin.php:173 
    31 #_admin.php:176 
     36#_admin.php:197 
     37#_admin.php:201 
    3238$GLOBALS['__l10n']['Expired entries'] = 'Billets périmés'; 
    3339 
    34 #_admin.php:173 
    35 $GLOBALS['__l10n']['add expired date'] = 'ajouter des dates de péremption'; 
     40#_admin.php:197 
     41$GLOBALS['__l10n']['Add expired date'] = 'Ajouter une date de péremption'; 
    3642 
    37 #_admin.php:176 
    38 $GLOBALS['__l10n']['remove expired date'] = 'retirer des dates de péremption'; 
     43#_admin.php:201 
     44$GLOBALS['__l10n']['Remove expired date'] = 'Retirer une date de péremption'; 
    3945 
    40 #_admin.php:264 
     46#_admin.php:296 
    4147$GLOBALS['__l10n']['Add expired date to entries'] = 'Ajouter une date de péremption aux billets'; 
    4248 
    43 #_admin.php:265 
    44 $GLOBALS['__l10n']['It will be added only if there is no expired date on entry.'] = 'Ajouter uniquement si il n\'y a pas de date de péremption sur le billet.'; 
     49#_admin.php:297 
     50$GLOBALS['__l10n']['It will be added only if there is no expired date on entry.'] = 'Ajouté uniquement si il n\'y a pas de date de péremption sur le billet.'; 
    4551 
    46 #_admin.php:307 
     52#_admin.php:341 
    4753$GLOBALS['__l10n']['Remove selected expired date from entries'] = 'Retirer les dates de péremption sélectionnées des billets'; 
    4854 
    49 #_admin.php:310 
     55#_admin.php:345 
    5056$GLOBALS['__l10n']['No expired date for selected entries'] = 'Pas de date de peremption sur les billets sélectionnés'; 
    5157 
    52 #_admin.php:318 
     58#_admin.php:353 
    5359$GLOBALS['__l10n']['Following expired date have been found in selected entries:'] = 'Les dates de péremption suivante ont été trouvé sur les billets sélectionnés :'; 
    5460 
    55 #_public.php:16 
     61#_public.php:15 
    5662$GLOBALS['__l10n']['Expired on'] = 'Expire le'; 
    5763 
    58 #_public.php:17 
    59 $GLOBALS['__l10n']['This entry has no expirion date'] = 'Ce billet n\'a pas de date d\'expiration'; 
     64#_public.php:16 
     65$GLOBALS['__l10n']['This entry has no expirion date'] = 'Ce billet n\'a pas de date de péremption'; 
    6066 
    6167?> 
  • plugins/postExpired/locales/fr/main.po

    r2187 r2382  
    1 # Language: français 
    2 # Module: postExpired - 0.2 
    3 # Date: 2010-04-14 02:18:31 
    4 # Translated with translater 1.3 
     1# Language: Français 
     2# Module: postExpired - 0.3.1 
     3# Date: 2010-06-21 16:01:48 
     4# Translated with translater 1.4 
    55 
    66msgid "" 
    77msgstr "" 
    88"Content-Type: text/plain; charset=UTF-8\n" 
    9 "Project-Id-Version: postExpired 0.2\n" 
     9"Project-Id-Version: postExpired 0.3.1\n" 
    1010"POT-Creation-Date: \n" 
    11 "PO-Revision-Date: 2010-04-14T02:18:31+00:00\n" 
     11"PO-Revision-Date: 2010-06-21T16:01:48+00:00\n" 
    1212"Last-Translator: JC Denis\n" 
    1313"Language-Team: \n" 
     
    1515"Content-Transfer-Encoding: 8bit\n" 
    1616 
    17 #: _admin.php:33 
    18 #: _admin.php:51 
    19 #: _admin.php:60 
    20 msgid "not changed" 
    21 msgstr "inchangé" 
     17#: _admin.php:34 
     18#: _admin.php:54 
     19#: _admin.php:63 
     20msgid "Not changed" 
     21msgstr "Inchangé" 
    2222 
    23 #: _admin.php:34 
    24 msgid "uncategorized" 
    25 msgstr "non catégorisé" 
     23#: _admin.php:55 
     24msgid "Pending" 
     25msgstr "En attente" 
    2626 
    27 #: _admin.php:97 
     27#: _admin.php:56 
     28msgid "Unpublished" 
     29msgstr "Non publié" 
     30 
     31#: _admin.php:65 
     32msgid "Not selected" 
     33msgstr "Non sélectionné" 
     34 
     35#: _admin.php:101 
    2836msgid "Expired date" 
    2937msgstr "Date de péremption" 
    3038 
    31 #: _admin.php:102 
    32 #: _admin.php:270 
     39#: _admin.php:122 
     40#: _admin.php:302 
    3341msgid "Change status on expire:" 
    3442msgstr "Changer de status à cette date :" 
    3543 
    36 #: _admin.php:105 
    37 #: _admin.php:273 
     44#: _admin.php:125 
     45#: _admin.php:305 
    3846msgid "Change category on expire:" 
    3947msgstr "Changer da catégorie à cette date :" 
    4048 
    41 #: _admin.php:108 
    42 #: _admin.php:276 
     49#: _admin.php:128 
     50#: _admin.php:308 
    4351msgid "Change selection on expire:" 
    44 msgstr "Changer la selecion à cette date :" 
     52msgstr "Changer la sélection à cette date :" 
    4553 
    46 #: _admin.php:173 
    47 #: _admin.php:176 
     54#: _admin.php:197 
     55#: _admin.php:201 
    4856msgid "Expired entries" 
    4957msgstr "Billets périmés" 
    5058 
    51 #: _admin.php:173 
    52 msgid "add expired date" 
    53 msgstr "ajouter des dates de péremption" 
     59#: _admin.php:197 
     60msgid "Add expired date" 
     61msgstr "Ajouter une date de péremption" 
    5462 
    55 #: _admin.php:176 
    56 msgid "remove expired date" 
    57 msgstr "retirer des dates de péremption" 
     63#: _admin.php:201 
     64msgid "Remove expired date" 
     65msgstr "Retirer une date de péremption" 
    5866 
    59 #: _admin.php:264 
     67#: _admin.php:296 
    6068msgid "Add expired date to entries" 
    6169msgstr "Ajouter une date de péremption aux billets" 
    6270 
    63 #: _admin.php:265 
     71#: _admin.php:297 
    6472msgid "It will be added only if there is no expired date on entry." 
    65 msgstr "Ajouter uniquement si il n'y a pas de date de péremption sur le billet." 
     73msgstr "Ajouté uniquement si il n'y a pas de date de péremption sur le billet." 
    6674 
    67 #: _admin.php:307 
     75#: _admin.php:341 
    6876msgid "Remove selected expired date from entries" 
    6977msgstr "Retirer les dates de péremption sélectionnées des billets" 
    7078 
    71 #: _admin.php:310 
     79#: _admin.php:345 
    7280msgid "No expired date for selected entries" 
    7381msgstr "Pas de date de peremption sur les billets sélectionnés" 
    7482 
    75 #: _admin.php:318 
     83#: _admin.php:353 
    7684msgid "Following expired date have been found in selected entries:" 
    7785msgstr "Les dates de péremption suivante ont été trouvé sur les billets sélectionnés :" 
    7886 
    79 #: _public.php:16 
     87#: _public.php:15 
    8088msgid "Expired on" 
    8189msgstr "Expire le" 
    8290 
    83 #: _public.php:17 
     91#: _public.php:16 
    8492msgid "This entry has no expirion date" 
    85 msgstr "Ce billet n'a pas de date d'expiration" 
     93msgstr "Ce billet n'a pas de date de péremption" 
    8694 
  • plugins/postExpired/release.txt

    r2330 r2382  
    11todo 
    22 * Add option to add/remove tag 
     3 
     40.3.1 20100621 
     5 * Fixed user rights 
     6 * Fixed (again) PHP 5.3 compatibility 
     7 * Fixed typo 
    38 
    490.3 20100608 
Note: See TracChangeset for help on using the changeset viewer.

Sites map