Dotclear

Changeset 955 for plugins/private


Ignore:
Timestamp:
03/29/09 16:10:50 (14 years ago)
Author:
Osku
Message:

Private mode 1.0 finally

Location:
plugins/private
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • plugins/private/_admin.php

    r863 r955  
    11<?php 
    22# -- BEGIN LICENSE BLOCK ---------------------------------- 
    3 # This file is part of Private mode, a plugin for Dotclear. 
     3# 
     4# This file is part of Private mode, a plugin for Dotclear 2. 
    45#  
    5 # Copyright (c) 2008, 2009 Osku 
    6 #  
    7 # Licensed under the GPL version 2.0 license. 
     6# Copyright (c) 2008-2009 Osku and contributors 
     7## Licensed under the GPL version 2.0 license. 
    88# A copy of this license is available in LICENSE file or at 
    99# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
     10# 
    1011# -- END LICENSE BLOCK ------------------------------------ 
    1112 
  • plugins/private/_define.php

    r866 r955  
    11<?php 
    22# -- BEGIN LICENSE BLOCK ---------------------------------- 
    3 # This file is part of Private mode, a plugin for Dotclear. 
     3# 
     4# This file is part of Private mode, a plugin for Dotclear 2. 
    45#  
    5 # Copyright (c) 2008, 2009 Osku 
    6 #  
    7 # Licensed under the GPL version 2.0 license. 
     6# Copyright (c) 2008-2009 Osku and contributors 
     7## Licensed under the GPL version 2.0 license. 
    88# A copy of this license is available in LICENSE file or at 
    99# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
     10# 
    1011# -- END LICENSE BLOCK ------------------------------------ 
    1112 
     
    1516     /* Name */          "Private mode", 
    1617     /* Description*/    "Protect your blog with a password", 
    17      /* Author */        "Osku", 
    18      /* Version */       '0.7-rc1', 
     18     /* Author */        "Osku and contributors", 
     19     /* Version */       '1.0', 
    1920     /* Permissions */   'admin' 
    2021); 
  • plugins/private/_prepend.php

    r863 r955  
    11<?php 
    22# -- BEGIN LICENSE BLOCK ---------------------------------- 
    3 # This file is part of Private mode, a plugin for Dotclear. 
     3# 
     4# This file is part of Private mode, a plugin for Dotclear 2. 
    45#  
    5 # Copyright (c) 2008, 2009 Osku 
    6 #  
    7 # Licensed under the GPL version 2.0 license. 
     6# Copyright (c) 2008-2009 Osku and contributors 
     7## Licensed under the GPL version 2.0 license. 
    88# A copy of this license is available in LICENSE file or at 
    99# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
     10# 
    1011# -- END LICENSE BLOCK ------------------------------------ 
    1112 
  • plugins/private/_public.php

    r866 r955  
    11<?php 
    22# -- BEGIN LICENSE BLOCK ---------------------------------- 
    3 # This file is part of Private mode, a plugin for Dotclear. 
     3# 
     4# This file is part of Private mode, a plugin for Dotclear 2. 
    45#  
    5 # Copyright (c) 2008, 2009 Osku 
    6 #  
    7 # Licensed under the GPL version 2.0 license. 
     6# Copyright (c) 2008-2009 Osku and contributors 
     7## Licensed under the GPL version 2.0 license. 
    88# A copy of this license is available in LICENSE file or at 
    99# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
     10# 
    1011# -- END LICENSE BLOCK ------------------------------------ 
    1112 
     
    7677          else 
    7778          { 
    78                // Add cookie test 
     79               // Add cookie test (automatic login) 
    7980               $cookiepass="dc_privateblog_cookie_".$core->blog->id; 
    8081               if (!empty($_COOKIE[$cookiepass])) { 
     
    8889                    if ($cookiepassvalue != false) { 
    8990                         $_SESSION['sess_blog_private'] = $_COOKIE[$cookiepass]; 
    90                          //setcookie($cookiepass,$_COOKIE[$cookiepass],time()+31536000,'/'); 
    9191                         return; 
    9292 
     
    165165     public static function PrivatePassRemember($attr) 
    166166     { 
    167           $res = '<p><label class="classic">'. 
    168                form::checkbox(array('pass_remember'),1,'','',2).' '. 
    169                __('Enable automatic connection').'</label></p>'; 
    170           return $res; 
     167          if ($core->blog->settings->private_conauto) 
     168          { 
     169               $res = '<p><label class="classic">'. 
     170                    form::checkbox(array('pass_remember'),1,'','',2).' '. 
     171                    __('Enable automatic connection').'</label></p>'; 
     172               return $res; 
     173          } 
     174          else 
     175          { 
     176               return; 
     177          } 
    171178     } 
    172179 
  • plugins/private/_widgets.php

    r863 r955  
    11<?php 
    22# -- BEGIN LICENSE BLOCK ---------------------------------- 
    3 # This file is part of Private mode, a plugin for Dotclear. 
     3# 
     4# This file is part of Private mode, a plugin for Dotclear 2. 
    45#  
    5 # Copyright (c) 2008, 2009 Osku 
    6 #  
    7 # Licensed under the GPL version 2.0 license. 
     6# Copyright (c) 2008-2009 Osku and contributors 
     7## Licensed under the GPL version 2.0 license. 
    88# A copy of this license is available in LICENSE file or at 
    99# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
     10# 
    1011# -- END LICENSE BLOCK ------------------------------------ 
    1112 
     
    1920        { 
    2021                $widgets->create('privateblog',__('Blog logout'),array('tplPrivate','privateWidgets')); 
    21                 $widgets->privateblog->setting('title',__('Title:'),''); 
     22                $widgets->privateblog->setting('title',__('Title:'),__('Blog logout')); 
    2223                $widgets->privateblog->setting('text',__('Text:'),'','textarea'); 
    2324                $widgets->privateblog->setting('label',__('Button:'),__('Disconnect')); 
  • plugins/private/default-templates/private.html

    r749 r955  
    11<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
    22"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
     3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{{tpl:BlogLanguage}}" lang="{{tpl:BlogLanguage}}"> 
    44<head> 
    55  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    66  <meta name="MSSmartTagsPreventParsing" content="TRUE" /> 
    77  <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" /> 
    8   <title>{{tpl:PrivatePageTitle encode_html="1"}}  - {{tpl:BlogName encode_html="1"}}</title> 
     8  <title>{{tpl:PrivatePageTitle encode_html="1"}}</title> 
    99   
    1010  <style type="text/css"> 
     
    2727  input { border-width : 1px; } 
    2828 
    29   p.error {color:#c00} 
     29  p.error {color : #c00; } 
    3030  </style> 
    3131</head> 
    3232 
    3333<body> 
     34 
    3435<form action="{{tpl:PrivateReqPage}}" method="post"> 
    3536 <h2>{{tpl:PrivatePageTitle}}</h2> 
     37 
    3638<tpl:IfPrivateMsgError> 
    3739<p class="error">{{tpl:PrivateMsgError}}</p> 
    3840</tpl:IfPrivateMsgError> 
     41 
    3942{{tpl:PrivateMsg}} 
     43 
    4044{{tpl:PrivatePassRemember}} 
    41 <p><label>{{tpl:lang Password:}} <input name="private_pass" id="private_pass" type="password" size="30" maxlength="255" value="" tabindex="1" /></label> <input type="submit" class="submit" value="ok" /></p> 
     45 
     46<p><label>{{tpl:lang Password:}} <input type="password" name="private_pass" id="private_pass"  value=""  
     47tabindex="1" /></label> <input type="submit" value="ok" /></p> 
    4248 
    4349</form> 
     50 
    4451</body> 
    4552</html> 
  • plugins/private/index.php

    r866 r955  
    11<?php 
    22# -- BEGIN LICENSE BLOCK ---------------------------------- 
    3 # This file is part of Private mode, a plugin for Dotclear. 
     3# 
     4# This file is part of Private mode, a plugin for Dotclear 2. 
    45#  
    5 # Copyright (c) 2008, 2009 Osku 
    6 #  
    7 # Licensed under the GPL version 2.0 license. 
     6# Copyright (c) 2008-2009 Osku and contributors 
     7## Licensed under the GPL version 2.0 license. 
    88# A copy of this license is available in LICENSE file or at 
    99# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
     10# 
    1011# -- END LICENSE BLOCK ------------------------------------ 
    1112 
     
    1516               $core->blog->settings->setNameSpace('private'); 
    1617 
    17                // Maintenance is not active by default 
     18               // Private mode is not active by default 
    1819               $core->blog->settings->put('private_flag',false,'boolean'); 
     20               $core->blog->settings->put('private_conauto',false,'boolean'); 
    1921               $core->blog->triggerBlog(); 
    2022               http::redirect(http::getSelfURI()); 
     
    2729// Getting current parameters 
    2830$private_flag       = (boolean)$core->blog->settings->private_flag; 
     31$private_conauto         = (boolean)$core->blog->settings->private_conauto; 
    2932$blog_private_title = $core->blog->settings->blog_private_title; 
    3033$blog_private_msg   = $core->blog->settings->blog_private_msg; 
     
    4851     { 
    4952          $private_flag = (empty($_POST['private_flag']))?false:true; 
     53          $private_conauto = (empty($_POST['private_conauto']))?false:true; 
    5054          $blog_private_title = $_POST['blog_private_title']; 
    5155          $blog_private_msg = $_POST['blog_private_msg']; 
     
    6165 
    6266          $core->blog->settings->setNamespace('private'); 
    63           $core->blog->settings->put('private_flag',$private_flag,'boolean'); 
     67          $core->blog->settings->put('private_flag',$private_flag,'boolean','Protect your blog with a password'); 
     68          $core->blog->settings->put('private_conauto',$private_conauto,'boolean','Allow automatic connection'); 
    6469          $core->blog->settings->put('blog_private_title',$blog_private_title,'string','Private page title'); 
    6570          $core->blog->settings->put('blog_private_msg',$blog_private_msg,'string','Private message'); 
     
    95100<?php if (!empty($err)) echo '<p class="error">'.$err.'</p>'; ?> 
    96101 
    97 <div id="offline_options"> 
     102<div id="private_options"> 
    98103     <form method="post" action="plugin.php"> 
    99104          <fieldset> 
    100105               <legend><?php echo __('Plugin activation'); ?></legend> 
     106                    <div class="two-cols"> 
     107                    <div class="col"> 
    101108                    <p class="field"> 
    102109                         <?php echo form::checkbox('private_flag', 1, $private_flag); ?> 
     
    105112                    <p><label class="required" title="<?php echo __('Required field');?>"> 
    106113                         <?php echo __('New password:'); ?> 
    107                          <?php echo form::password('blog_private_pwd',20,255); ?> 
     114                         <?php echo form::password('blog_private_pwd',30,255); ?> 
    108115                    </label></p> 
    109116                    <p><label class="required" title="<?php echo __('Required field');?>"> 
    110117                         <?php echo __('Confirm password:'); ?> 
    111                          <?php echo form::password('blog_private_pwd_c',20,255); ?> 
     118                         <?php echo form::password('blog_private_pwd_c',30,255); ?> 
    112119                    </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> 
    113133          </fieldset> 
    114134          <fieldset class="constrained"> 
  • plugins/private/locales/_pot/main.pot

    r749 r955  
    99"Project-Id-Version: PACKAGE VERSION\n" 
    1010"Report-Msgid-Bugs-To: \n" 
    11 "POT-Creation-Date: 2009-02-07 19:49+0100\n" 
     11"POT-Creation-Date: 2009-03-29 15:10+0200\n" 
    1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 
    1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 
    1414"Language-Team: LANGUAGE <LL@li.org>\n" 
    1515"MIME-Version: 1.0\n" 
    16 "Content-Type: text/plain; charset=CHARSET\n" 
     16"Content-Type: text/plain; charset=ASCII\n" 
    1717"Content-Transfer-Encoding: 8bit\n" 
    1818 
    19 #: _admin.php:18 index.php:92 index.php:96 
     19#: _admin.php:14 index.php:91 index.php:95 
    2020msgid "Private mode" 
    2121msgstr "" 
    2222 
    23 #: index.php:38 
     23#: index.php:35 
    2424msgid "Private blog" 
    2525msgstr "" 
    2626 
    27 #: index.php:42 
     27#: index.php:39 
    2828msgid "<p class=\"message\">You need the password to view this blog.</p>" 
    2929msgstr "" 
    3030 
    31 #: index.php:47 
     31#: index.php:44 
    3232msgid "No password set." 
    3333msgstr "" 
    3434 
    35 #: index.php:60 
     35#: index.php:58 
    3636msgid "No page title." 
    3737msgstr "" 
    3838 
    39 #: index.php:64 
     39#: index.php:62 
    4040msgid "No private message." 
    4141msgstr "" 
    4242 
    43 #: index.php:74 
     43#: index.php:73 
    4444msgid "Passwords don't match" 
    4545msgstr "" 
    4646 
    47 #: index.php:81 
     47#: index.php:80 
    4848msgid "Configuration successfully updated." 
    4949msgstr "" 
    5050 
    51 #: index.php:105 
     51#: index.php:104 
    5252msgid "Plugin activation" 
    5353msgstr "" 
    5454 
    55 #: index.php:108 
     55#: index.php:109 
    5656msgid "Enable Private mode" 
    5757msgstr "" 
    5858 
    59 #: index.php:111 
     59#: index.php:111 index.php:115 index.php:135 index.php:139 
     60msgid "Required field" 
     61msgstr "" 
     62 
     63#: index.php:112 
    6064msgid "New password:" 
    6165msgstr "" 
    6266 
    63 #: index.php:115 
     67#: index.php:116 
    6468msgid "Confirm password:" 
    6569msgstr "" 
    6670 
    67 #: index.php:120 
     71#: index.php:123 
     72msgid "Propose automatic connection to visitors" 
     73msgstr "" 
     74 
     75#: index.php:126 
     76msgid "With this option, the password could be stored in a cookie." 
     77msgstr "" 
     78 
     79#: index.php:127 
     80msgid "But it still remains a choice for the visitor." 
     81msgstr "" 
     82 
     83#: index.php:129 
     84#, php-format 
     85msgid "" 
     86"Don't forget to add a <a href=\"%s\">widget</a> allowing disconnection from " 
     87"the blog." 
     88msgstr "" 
     89 
     90#: index.php:134 
    6891msgid "Presentation options" 
    6992msgstr "" 
    7093 
    71 #: index.php:122 
     94#: index.php:136 
    7295msgid "Private page title:" 
    7396msgstr "" 
    7497 
    75 #: index.php:126 
     98#: index.php:140 
    7699msgid "Private message:" 
    77100msgstr "" 
    78101 
    79 #: index.php:133 
     102#: index.php:147 
    80103msgid "Save configuration" 
    81104msgstr "" 
    82105 
    83 #: _public.php:109 _public.php:119 
     106#: _public.php:104 _public.php:114 
    84107msgid "Wrong password" 
    85108msgstr "" 
    86109 
    87 #: _public.php:127 
     110#: _public.php:123 
    88111msgid "Disconnected" 
    89112msgstr "" 
    90113 
    91 #: _public.php:172 
     114#: _public.php:170 
    92115msgid "Enable automatic connection" 
    93116msgstr "" 
    94117 
    95 #: _public.php:190 
     118#: _widgets.php:20 _widgets.php:21 
     119msgid "Blog logout" 
     120msgstr "" 
     121 
     122#: _widgets.php:21 
     123msgid "Title:" 
     124msgstr "" 
     125 
     126#: _widgets.php:22 
     127msgid "Text:" 
     128msgstr "" 
     129 
     130#: _widgets.php:23 
     131msgid "Button:" 
     132msgstr "" 
     133 
     134#: _widgets.php:23 
    96135msgid "Disconnect" 
    97136msgstr "" 
    98137 
    99138#: _widgets.php:24 
    100 msgid "Blog logout" 
    101 msgstr "" 
    102  
    103 #: _widgets.php:25 
    104 msgid "Title:" 
    105 msgstr "" 
    106  
    107 #: _widgets.php:26 
    108139msgid "Home page only" 
    109140msgstr "" 
  • plugins/private/locales/fr/main.po

    r749 r955  
    1717"Plural-Forms: nplurals=2; plural=(n > 1);\n" 
    1818 
    19 #: _admin.php:18 index.php:91 index.php:95 
     19#: _admin.php:14 index.php:91 index.php:95 
    2020msgid "Private mode" 
    2121msgstr "Mode Privé" 
    2222 
    23 #: index.php:38 
     23#: index.php:35 
    2424msgid "Private blog" 
    2525msgstr "Blog privé" 
    2626 
    27 #: index.php:42 
     27#: index.php:39 
    2828msgid "<p class=\"message\">You need the password to view this blog.</p>" 
    2929msgstr "<p class=\"message\">Vous avez besoin du mot de passe pour visualiser le blog.</p>" 
    3030 
    31 #: index.php:55 
     31#: index.php:44 
     32msgid "No password set." 
     33msgstr "Aucun mot de passe défini" 
     34 
     35#: index.php:58 
    3236msgid "No page title." 
    3337msgstr "Aucun titre pour la page" 
    3438 
    35 #: index.php:59 
     39#: index.php:62 
    3640msgid "No private message." 
    3741msgstr "Aucun message pour la page" 
    3842 
    39 #: index.php:69 
     43#: index.php:73 
    4044msgid "Passwords don't match" 
    4145msgstr "Les mots de passe ne correspondent pas" 
    4246 
    43 #: index.php:76 
     47#: index.php:80 
    4448msgid "Configuration successfully updated." 
    4549msgstr "La configuration a été correctement enregistrée" 
    46  
    47 #: index.php:85 
    48 msgid "No password set." 
    49 msgstr "Aucun mot de passe défini" 
    5050 
    5151#: index.php:104 
     
    5353msgstr "Activation de l'extension" 
    5454 
    55 #: index.php:107 
     55#: index.php:109 
    5656msgid "Enable Private mode" 
    5757msgstr "Activer le mode Privé" 
    5858 
    59 #: index.php:110 
     59#: index.php:111 index.php:115 index.php:135 index.php:139 
     60msgid "Required field" 
     61msgstr "Champ obligatoire" 
     62 
     63#: index.php:112 
    6064msgid "New password:" 
     65msgstr "" 
     66 
     67#: index.php:116 
     68msgid "Confirm password:" 
    6169msgstr "Nouveau mot de passe:" 
    6270 
    63 #: index.php:114 
    64 msgid "Confirm password:" 
    65 msgstr "Confirmez le mot de passe:" 
     71#: index.php:123 
     72msgid "Propose automatic connection to visitors" 
     73msgstr "Proposer la connexion automatique aux visiteurs" 
    6674 
    67 #: index.php:119 
     75#: index.php:126 
     76msgid "With this option, the password could be stored in a cookie." 
     77msgstr "Cette option permet la mémorisation du mot de passe dans un cookie." 
     78 
     79#: index.php:127 
     80msgid "But it still remains a choice for the visitor." 
     81msgstr "Mais ceci reste toutefois à la discrétion du visiteur." 
     82 
     83#: index.php:129 
     84#, php-format 
     85msgid "" 
     86"Don't forget to add a <a href=\"%s\">widget</a> allowing disconnection from " 
     87"the blog." 
     88msgstr "N'oubliez pas d'ajouter un <a href=\"%s\">widget</a> permettant la déconnexion du blog." 
     89 
     90#: index.php:134 
    6891msgid "Presentation options" 
    6992msgstr "Options d'affichage" 
    7093 
    71 #: index.php:121 
     94#: index.php:136 
    7295msgid "Private page title:" 
    73 msgstr "Titre de la page privée" 
     96msgstr "Titre de la page privée " 
    7497 
    75 #: index.php:125 
     98#: index.php:140 
    7699msgid "Private message:" 
    77 msgstr "Message privé" 
     100msgstr "Message privé " 
    78101 
    79 #: index.php:132 
     102#: index.php:147 
    80103msgid "Save configuration" 
    81104msgstr "Enregistrer la configuration" 
    82105 
    83 #: _public.php:49 
     106#: _public.php:104 _public.php:114 
    84107msgid "Wrong password" 
    85108msgstr "Mot de passe incorrect" 
    86109 
    87 #: _public.php:58 
     110#: _public.php:123 
    88111msgid "Disconnected" 
    89112msgstr "Déconnecté(e)" 
    90113 
    91 #: _public.php:172 
     114#: _public.php:170 
    92115msgid "Enable automatic connection" 
    93116msgstr "Activer la connexion automatique" 
    94117 
    95 #: _public.php:112 
     118#: _widgets.php:20 _widgets.php:21 
     119msgid "Blog logout" 
     120msgstr "Déconnexion du blog" 
     121 
     122#: _widgets.php:21 
     123msgid "Title:" 
     124msgstr "Titre:" 
     125 
     126#: _widgets.php:22 
     127msgid "Text:" 
     128msgstr "Texte" 
     129 
     130#: _widgets.php:23 
     131msgid "Button:" 
     132msgstr "Bouton" 
     133 
     134#: _widgets.php:23 
    96135msgid "Disconnect" 
    97136msgstr "Se déconnecter" 
    98137 
    99138#: _widgets.php:24 
    100 msgid "Blog logout" 
    101 msgstr "Déconnexion du blog" 
    102  
    103 #: _widgets.php:25 
    104 msgid "Title:" 
    105 msgstr "Titre:" 
    106  
    107 #: _widgets.php:26 
    108139msgid "Home page only" 
    109140msgstr "Page d'accueil uniquement" 
Note: See TracChangeset for help on using the changeset viewer.

Sites map