Dotclear

Changeset 1768 for plugins/private


Ignore:
Timestamp:
10/27/09 01:01:16 (14 years ago)
Author:
Osku
Message:

Private mode 1.1RC1 :

  • should fixe some tickets bugs (closes #140, #296)
Location:
plugins/private
Files:
2 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • plugins/private/_define.php

    r999 r1768  
    1717     /* Description*/    "Protect your blog with a password", 
    1818     /* Author */        "Osku and contributors", 
    19      /* Version */       '1.0.1', 
     19     /* Version */       '1.1RC1', 
    2020     /* Permissions */   'admin' 
    2121); 
  • plugins/private/_prepend.php

    r955 r1768  
    1919     $privatefeed = md5($core->blog->settings->blog_private_pwd); 
    2020     $core->url->register('feed',sprintf('%s-feed',$privatefeed),sprintf('^%s-feed/(.+)$',$privatefeed),array('urlPrivate','privateFeed')); 
     21     $core->url->register('pubfeed','feed','^feed/(.+)$',array('urlPrivate','publicFeed')); 
    2122} 
    2223?> 
  • plugins/private/_public.php

    r1000 r1768  
    3131          self::feed($args); 
    3232     } 
     33      
     34     public static function publicFeed($args) 
     35     { 
     36          global $core,$_ctx; 
     37           
     38          $type = null; 
     39          $params = array(); 
     40           
     41          $mime = 'application/xml'; 
     42           
     43          if (preg_match('#^rss2/xslt$#',$args,$m)) 
     44          { 
     45               # RSS XSLT stylesheet 
     46               self::serveDocument('rss2.xsl','text/xml'); 
     47               //exit; 
     48          } 
     49          elseif (preg_match('#^(atom|rss2)/comments/([0-9]+)$#',$args,$m)) 
     50          { 
     51               # Post comments feed 
     52               $type = $m[1]; 
     53          } 
     54          elseif (preg_match('#^(?:category/(.+)/)?(atom|rss2)(/comments)?$#',$args,$m)) 
     55          { 
     56               # All posts or comments feed 
     57               $type = $m[2]; 
     58          } 
     59           
     60 
     61          $tpl =  $type == '' ? 'atom' : $type; 
     62          $tpl .= '-pv.xml'; 
     63           
     64          if ($type == 'atom') { 
     65               $mime = 'application/atom+xml'; 
     66          } 
     67           
     68          header('X-Robots-Tag: '.context::robotsPolicy($core->blog->settings->robots_policy,'')); 
     69          $core->tpl->setPath($core->tpl->getPath(), dirname(__FILE__).'/default-templates'); 
     70          self::serveDocument($tpl,$mime); 
     71           
     72          return; 
     73     } 
    3374 
    3475     public static function callbackbidon($args) 
     
    70111          unset($urlp); 
    71112 
    72           if ($type == 'feed' || $type == 'spamfeed' || $type == 'hamfeed' || $type == 'trackback')  
     113          if ($type == 'feed' || $type == 'pubfeed' || $type == 'spamfeed' || $type == 'hamfeed' || $type == 'trackback')  
    73114          { 
    74115               return; 
     
    142183     public static function PrivateMsg($attr) 
    143184     { 
    144           return '<?php echo $core->blog->settings->blog_private_msg; ?>'; 
     185          $f = $GLOBALS['core']->tpl->getFilters($attr); 
     186          return '<?php echo '.sprintf($f,'$core->blog->settings->blog_private_msg').'; ?>'; 
    145187     } 
    146188 
  • plugins/private/index.php

    r955 r1768  
    2828 
    2929// Getting current parameters 
    30 $private_flag       = (boolean)$core->blog->settings->private_flag; 
    31 $private_conauto         = (boolean)$core->blog->settings->private_conauto; 
    32 $blog_private_title = $core->blog->settings->blog_private_title; 
    33 $blog_private_msg   = $core->blog->settings->blog_private_msg; 
     30$private_flag = (boolean)$core->blog->settings->private_flag; 
     31$private_conauto = (boolean)$core->blog->settings->private_conauto; 
     32$blog_private_title = $core->blog->settings->blog_private_title; 
     33$blog_private_msg = $core->blog->settings->blog_private_msg; 
    3434 
    3535if ($blog_private_title === null) { 
     
    3939if ($blog_private_msg === null) { 
    4040     $blog_private_msg = __('<p class="message">You need the password to view this blog.</p>'); 
    41 } 
    42  
    43 if (is_null($core->blog->settings->blog_private_pwd)) 
    44 { 
    45      $err = __('No password set.'); 
    4641} 
    4742 
     
    7873 
    7974          $core->blog->triggerBlog(); 
    80  
    81           $msg = __('Configuration successfully updated.'); 
     75          http::redirect($p_url.'&config=1'); 
    8276     } 
    8377 
     
    8781     } 
    8882} 
     83if ($core->blog->settings->blog_private_pwd === null) 
     84{ 
     85     $err = __('No password set.'); 
     86} 
    8987?> 
    9088<html> 
     
    9391</head> 
    9492<body> 
    95 <h2 style="padding:8px 0 8px 34px;background:url(index.php?pf=private/icon_32.png) no-repeat;"> 
    96 <?php echo html::escapeHTML($core->blog->name); ?> &rsaquo; <?php echo __('Private mode'); ?></h2> 
     93<?php  
    9794 
    98 <?php if (!empty($msg)) echo '<p class="message">'.$msg.'</p>'; ?> 
     95if (isset($_GET['config'])) { 
     96     echo '<p class="message">'.__('Configuration successfully updated.').'</p>'; 
     97} 
    9998 
    100 <?php if (!empty($err)) echo '<p class="error">'.$err.'</p>'; ?> 
     99if (!empty($err)) echo '<p class="error">'.$err.'</p>';  
    101100 
    102 <div id="private_options"> 
    103      <form method="post" action="plugin.php"> 
    104           <fieldset> 
    105                <legend><?php echo __('Plugin activation'); ?></legend> 
    106                     <div class="two-cols"> 
    107                     <div class="col"> 
    108                     <p class="field"> 
    109                          <?php echo form::checkbox('private_flag', 1, $private_flag); ?> 
    110                          <label class=" classic" for="private_flag"> <?php echo __('Enable Private mode');?></label> 
    111                     </p> 
    112                     <p><label class="required" title="<?php echo __('Required field');?>"> 
    113                          <?php echo __('New password:'); ?> 
    114                          <?php echo form::password('blog_private_pwd',30,255); ?> 
    115                     </label></p> 
    116                     <p><label class="required" title="<?php echo __('Required field');?>"> 
    117                          <?php echo __('Confirm password:'); ?> 
    118                          <?php echo form::password('blog_private_pwd_c',30,255); ?> 
    119                     </label></p> 
    120                     </div> 
    121                     <div class="col"> 
    122                     <p> 
    123                          <?php echo form::checkbox('private_conauto', 1, $private_conauto); ?> 
    124                          <label class=" classic" for="private_conauto"> <?php echo __('Propose automatic connection to visitors');?></label> 
    125                     </p> 
    126                     <p class="form-note"> 
    127                     <?php echo __('With this option, the password could be stored in a cookie.'); ?> 
    128                     <?php echo __('But it still remains a choice for the visitor.'); ?> 
    129                     </p> 
    130                     <p><?php  echo sprintf(__('Don\'t forget to add a <a href="%s">widget</a> allowing disconnection from the blog.'),'plugin.php?p=widgets'); ?></p> 
    131                     </div> 
    132                     </div> 
    133           </fieldset> 
    134           <fieldset class="constrained"> 
    135                <legend><?php echo __('Presentation options'); ?></legend> 
    136                     <p class="col"><label class="required" title="<?php echo __('Required field');?>"> 
    137                          <?php echo __('Private page title:');?> 
    138                          <?php echo form::field('blog_private_title',20,255,html::escapeHTML($blog_private_title),'maximal'); ?> 
    139                     </label></p> 
    140                     <p class="area"><label class="required" title="<?php echo __('Required field');?>"> 
    141                          <?php echo __('Private message:');?> 
    142                          <?php echo form::textarea('blog_private_msg',30,4,html::escapeHTML($blog_private_msg)); ?> 
    143                     </label></p> 
    144           </fieldset> 
     101echo '<h2>'.html::escapeHTML($core->blog->name).' &rsaquo; '.__('Private mode').'</h2>'; 
    145102 
    146           <p><input type="hidden" name="p" value="private" /> 
    147           <?php echo $core->formNonce(); ?> 
    148           <input type="submit" name="saveconfig" value="<?php echo __('Save configuration'); ?>" /></p> 
    149      </form> 
    150 </div> 
     103echo '<div id="private_options">'. 
     104     '<form method="post" action="'.$p_url.'">'. 
     105          '<fieldset>'. 
     106               '<legend>'. __('Plugin activation').'</legend>'. 
     107                    '<div class="two-cols">'. 
     108                    '<div class="col">'. 
     109                    '<p class="field">'. 
     110                         form::checkbox('private_flag', 1, $private_flag). 
     111                         '<label class=" classic" for="private_flag">'.__('Enable Private mode').'</label>'. 
     112                    '</p>'. 
     113                    '<p><label class="required" title="'.__('Required field').'">'. 
     114                         __('New password:'). 
     115                         form::password('blog_private_pwd',30,255). 
     116                    '</label></p>'. 
     117                    '<p><label class="required" title="'.__('Required field').'">'. 
     118                         __('Confirm password:'). 
     119                         form::password('blog_private_pwd_c',30,255). 
     120                    '</label></p>'. 
     121                    '</div>'. 
     122                    '<div class="col">'. 
     123                    '<p>'. 
     124                         form::checkbox('private_conauto', 1, $private_conauto). 
     125                         '<label class=" classic" for="private_conauto">'. __('Propose automatic connection to visitors').'</label>'. 
     126                    '</p>'. 
     127                    '<p class="form-note">'. 
     128                    __('With this option, the password could be stored in a cookie.'). 
     129                    __('But it still remains a choice for the visitor.'). 
     130                    '</p>'. 
     131                    '<p>'.sprintf(__('Don\'t forget to add a <a href="%s">widget</a> allowing disconnection from the blog.'),'plugin.php?p=widgets').'</p>'. 
     132                    '</div>'. 
     133                    '</div>'. 
     134          '</fieldset>'. 
     135          '<fieldset>'. 
     136               '<legend>'.__('Presentation options').'</legend>'. 
     137                    '<p class="col"><label class="required" title="'.__('Required field').'">'. 
     138                         __('Private page title:'). 
     139                         form::field('blog_private_title',20,255,html::escapeHTML($blog_private_title),'maximal'). 
     140                    '.</label></p>'. 
     141                    '<p class="area"><label class="required" title="'.__('Required field').'">'. 
     142                         __('Private message:'). 
     143                         form::textarea('blog_private_msg',30,4,html::escapeHTML($blog_private_msg)). 
     144                    '</label></p>'. 
     145          '</fieldset>'. 
     146 
     147          '<p>'.form::hidden(array('p'),'private'). 
     148          $core->formNonce(). 
     149          '<input type="submit" name="saveconfig" value="'.__('Save configuration').'" /></p>'. 
     150     '</form>'. 
     151'</div>'; 
     152?> 
    151153</body> 
    152154</html> 
  • plugins/private/locales/fr/main.po

    r955 r1768  
    1 # French translations for PACKAGE package. 
    2 # Copyright (C) 2008 THE PACKAGE'S COPYRIGHT HOLDER 
    3 # This file is distributed under the same license as the PACKAGE package. 
    4 # Greg <popech@gmail.com>, 2008. 
    5 # 
     1# Language: français 
     2# Module: private - 1.1RC1 
     3# Date: 2009-10-26 23:51:03 
     4# Translated with translater 1.3 
     5 
    66msgid "" 
    77msgstr "" 
    8 "Project-Id-Version: PACKAGE VERSION\n" 
    9 "Report-Msgid-Bugs-To: \n" 
    10 "POT-Creation-Date: 2008-11-25 23:01+0100\n" 
    11 "PO-Revision-Date: 2008-11-25 23:01+0100\n" 
    12 "Last-Translator: Greg <popech@gmail.com>\n" 
    13 "Language-Team: French\n" 
     8"Content-Type: text/plain; charset=UTF-8\n" 
     9"Project-Id-Version: private 1.1RC1\n" 
     10"POT-Creation-Date: \n" 
     11"PO-Revision-Date: 2009-10-26T23:51:03+00:00\n" 
     12"Last-Translator: Osku\n" 
     13"Language-Team: \n" 
    1414"MIME-Version: 1.0\n" 
    15 "Content-Type: text/plain; charset=ASCII\n" 
    1615"Content-Transfer-Encoding: 8bit\n" 
    17 "Plural-Forms: nplurals=2; plural=(n > 1);\n" 
    1816 
    19 #: _admin.php:14 index.php:91 index.php:95 
     17#: _admin.php:15 
     18#: index.php:90 
     19#: index.php:101 
    2020msgid "Private mode" 
    21 msgstr "Mode Privé" 
     21msgstr "Mode privé" 
    2222 
    23 #: index.php:35 
     23#: _public.php:146 
     24#: _public.php:156 
     25msgid "Wrong password" 
     26msgstr "Mot de passe incorrect" 
     27 
     28#: _public.php:165 
     29msgid "Disconnected" 
     30msgstr "Déconnecté(e)" 
     31 
     32#: _public.php:214 
     33msgid "Enable automatic connection" 
     34msgstr "Activer la connexion automatique" 
     35 
     36#: _widgets.php:21 
     37#: _widgets.php:22 
     38msgid "Blog logout" 
     39msgstr "Déconnexion du blog" 
     40 
     41#: _widgets.php:22 
     42msgid "Title:" 
     43msgstr "Titre :" 
     44 
     45#: _widgets.php:23 
     46msgid "Text:" 
     47msgstr "Texte :" 
     48 
     49#: _widgets.php:24 
     50msgid "Button:" 
     51msgstr "Bouton :" 
     52 
     53#: _widgets.php:24 
     54msgid "Disconnect" 
     55msgstr "Se déconnecter" 
     56 
     57#: _widgets.php:25 
     58msgid "Home page only" 
     59msgstr "Page d'accueil uniquement" 
     60 
     61#: index.php:36 
    2462msgid "Private blog" 
    2563msgstr "Blog privé" 
    2664 
    27 #: index.php:39 
     65#: index.php:40 
    2866msgid "<p class=\"message\">You need the password to view this blog.</p>" 
    2967msgstr "<p class=\"message\">Vous avez besoin du mot de passe pour visualiser le blog.</p>" 
    3068 
    31 #: index.php:44 
     69#: index.php:54 
     70msgid "No page title." 
     71msgstr "Aucun titre pour la page" 
     72 
     73#: index.php:58 
     74msgid "No private message." 
     75msgstr "Aucun message pour la page" 
     76 
     77#: index.php:69 
     78msgid "Passwords don't match" 
     79msgstr "Les mots de passe ne correspondent pas" 
     80 
     81#: index.php:85 
    3282msgid "No password set." 
    3383msgstr "Aucun mot de passe défini" 
    3484 
    35 #: index.php:58 
    36 msgid "No page title." 
    37 msgstr "Aucun titre pour la page" 
    38  
    39 #: index.php:62 
    40 msgid "No private message." 
    41 msgstr "Aucun message pour la page" 
    42  
    43 #: index.php:73 
    44 msgid "Passwords don't match" 
    45 msgstr "Les mots de passe ne correspondent pas" 
    46  
    47 #: index.php:80 
     85#: index.php:96 
    4886msgid "Configuration successfully updated." 
    4987msgstr "La configuration a été correctement enregistrée" 
    5088 
    51 #: index.php:104 
     89#: index.php:106 
    5290msgid "Plugin activation" 
    5391msgstr "Activation de l'extension" 
    5492 
    55 #: index.php:109 
     93#: index.php:111 
    5694msgid "Enable Private mode" 
    5795msgstr "Activer le mode Privé" 
    5896 
    59 #: index.php:111 index.php:115 index.php:135 index.php:139 
     97#: index.php:113 
     98#: index.php:117 
     99#: index.php:137 
     100#: index.php:141 
    60101msgid "Required field" 
    61102msgstr "Champ obligatoire" 
    62103 
    63 #: index.php:112 
     104#: index.php:114 
    64105msgid "New password:" 
    65 msgstr "" 
     106msgstr "Nouveau mot de passe :" 
    66107 
    67 #: index.php:116 
     108#: index.php:118 
    68109msgid "Confirm password:" 
    69 msgstr "Nouveau mot de passe:" 
     110msgstr "Confirmez le mot de passe :" 
    70111 
    71 #: index.php:123 
     112#: index.php:125 
    72113msgid "Propose automatic connection to visitors" 
    73114msgstr "Proposer la connexion automatique aux visiteurs" 
    74115 
    75 #: index.php:126 
     116#: index.php:128 
    76117msgid "With this option, the password could be stored in a cookie." 
    77118msgstr "Cette option permet la mémorisation du mot de passe dans un cookie." 
    78119 
    79 #: index.php:127 
     120#: index.php:129 
    80121msgid "But it still remains a choice for the visitor." 
    81122msgstr "Mais ceci reste toutefois à la discrétion du visiteur." 
    82123 
    83 #: index.php:129 
    84 #, php-format 
    85 msgid "" 
    86 "Don't forget to add a <a href=\"%s\">widget</a> allowing disconnection from " 
    87 "the blog." 
     124#: index.php:131 
     125msgid "Don't forget to add a <a href=\"%s\">widget</a> allowing disconnection from the blog." 
    88126msgstr "N'oubliez pas d'ajouter un <a href=\"%s\">widget</a> permettant la déconnexion du blog." 
    89127 
    90 #: index.php:134 
     128#: index.php:136 
    91129msgid "Presentation options" 
    92130msgstr "Options d'affichage" 
    93131 
    94 #: index.php:136 
     132#: index.php:138 
    95133msgid "Private page title:" 
    96 msgstr "Titre de la page privée " 
     134msgstr "Titre de la page privée" 
    97135 
    98 #: index.php:140 
     136#: index.php:142 
    99137msgid "Private message:" 
    100 msgstr "Message privé " 
     138msgstr "Message privé :" 
    101139 
    102 #: index.php:147 
     140#: index.php:149 
    103141msgid "Save configuration" 
    104142msgstr "Enregistrer la configuration" 
    105143 
    106 #: _public.php:104 _public.php:114 
    107 msgid "Wrong password" 
    108 msgstr "Mot de passe incorrect" 
    109  
    110 #: _public.php:123 
    111 msgid "Disconnected" 
    112 msgstr "Déconnecté(e)" 
    113  
    114 #: _public.php:170 
    115 msgid "Enable automatic connection" 
    116 msgstr "Activer la connexion automatique" 
    117  
    118 #: _widgets.php:20 _widgets.php:21 
    119 msgid "Blog logout" 
    120 msgstr "Déconnexion du blog" 
    121  
    122 #: _widgets.php:21 
    123 msgid "Title:" 
    124 msgstr "Titre:" 
    125  
    126 #: _widgets.php:22 
    127 msgid "Text:" 
    128 msgstr "Texte" 
    129  
    130 #: _widgets.php:23 
    131 msgid "Button:" 
    132 msgstr "Bouton" 
    133  
    134 #: _widgets.php:23 
    135 msgid "Disconnect" 
    136 msgstr "Se déconnecter" 
    137  
    138 #: _widgets.php:24 
    139 msgid "Home page only" 
    140 msgstr "Page d'accueil uniquement" 
Note: See TracChangeset for help on using the changeset viewer.

Sites map