Dotclear

Changeset 749 for plugins/private


Ignore:
Timestamp:
02/07/09 19:56:46 (15 years ago)
Author:
Osku
Message:

Private blog 0.6 : allow automatic connection using cookie.

Location:
plugins/private
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • plugins/private/_define.php

    r694 r749  
    2020     /* Description*/    "Protect your blog with a password", 
    2121     /* Author */        "Osku", 
    22      /* Version */       '0.5', 
     22     /* Version */       '0.6', 
    2323     /* Permissions */   'admin' 
    2424); 
  • plugins/private/_public.php

    r694 r749  
    2020$core->tpl->addValue('PrivateReqPage',array('tplPrivate','PrivateReqPage')); 
    2121$core->tpl->addBlock('IfPrivateMsgError',array('tplPrivate','IfPrivateMsgError')); 
    22  
     22$core->tpl->addValue('PrivatePassRemember',array('tplPrivate','PrivatePassRemember')); 
    2323$core->tpl->addValue('PrivateMsgError',array('tplPrivate','PrivateMsgError')); 
    2424 
     
    8080          else 
    8181          { 
     82               // Add cookie test 
     83               $cookiepass="dc_blog_private_".$core->blog->id; 
     84               if (!empty($_COOKIE[$cookiepass])) { 
     85                    $cookiepassvalue=(($_COOKIE[$cookiepass]) == 
     86                                      $core->blog->settings->blog_private_pwd); 
     87               } else { 
     88                    $cookiepassvalue=false; 
     89               } 
    8290               if (!isset($_SESSION['sess_blog_private']) || $_SESSION['sess_blog_private'] == "") 
    8391               { 
     92                    if ($cookiepassvalue != false) { 
     93                         $_SESSION['sess_blog_private'] = $_COOKIE[$cookiepass]; 
     94                         setcookie($cookiepass,$_COOKIE[$cookiepass],time()+31536000,'/'); 
     95                         return; 
     96 
     97                    } 
    8498                    if (!empty($_POST['private_pass']))  
    8599                    { 
     
    87101                              { 
    88102                                   $_SESSION['sess_blog_private'] = md5($_POST['private_pass']); 
     103                                   if (!empty($_POST['pass_remember']))  
     104                                   { 
     105                                        setcookie($cookiepass,md5($_POST['private_pass']),time()+31536000,'/'); 
     106                                   } 
    89107                                   return; 
    90108                              } 
     
    148166     } 
    149167 
     168     public static function PrivatePassRemember($attr) 
     169     { 
     170          $res = '<p><label class="classic">'. 
     171               form::checkbox(array('pass_remember'),1,'','',2).' '. 
     172               __('Enable automatic connection').'</label></p>'; 
     173          return $res; 
     174     } 
     175 
    150176     public static function privateWidgets(&$w)  
    151177     { 
     
    168194          else 
    169195          { 
    170                return;         
     196               return; 
    171197          } 
    172198     } 
  • plugins/private/default-templates/private.html

    r570 r749  
    3838</tpl:IfPrivateMsgError> 
    3939{{tpl:PrivateMsg}} 
     40{{tpl:PrivatePassRemember}} 
    4041<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> 
    4142 
  • plugins/private/locales/_pot/main.pot

    r570 r749  
    99"Project-Id-Version: PACKAGE VERSION\n" 
    1010"Report-Msgid-Bugs-To: \n" 
    11 "POT-Creation-Date: 2008-11-25 23:01+0100\n" 
     11"POT-Creation-Date: 2009-02-07 19:49+0100\n" 
    1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 
    1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 
     
    1717"Content-Transfer-Encoding: 8bit\n" 
    1818 
    19 #: _admin.php:18 index.php:91 index.php:95 
     19#: _admin.php:18 index.php:92 index.php:96 
    2020msgid "Private mode" 
    2121msgstr "" 
     
    2929msgstr "" 
    3030 
    31 #: index.php:55 
     31#: index.php:47 
     32msgid "No password set." 
     33msgstr "" 
     34 
     35#: index.php:60 
    3236msgid "No page title." 
    3337msgstr "" 
    3438 
    35 #: index.php:59 
     39#: index.php:64 
    3640msgid "No private message." 
    3741msgstr "" 
    3842 
    39 #: index.php:69 
     43#: index.php:74 
    4044msgid "Passwords don't match" 
    4145msgstr "" 
    4246 
    43 #: index.php:76 
     47#: index.php:81 
    4448msgid "Configuration successfully updated." 
    4549msgstr "" 
    4650 
    47 #: index.php:85 
    48 msgid "No password set." 
    49 msgstr "" 
    50  
    51 #: index.php:104 
     51#: index.php:105 
    5252msgid "Plugin activation" 
    5353msgstr "" 
    5454 
    55 #: index.php:107 
     55#: index.php:108 
    5656msgid "Enable Private mode" 
    5757msgstr "" 
    5858 
    59 #: index.php:110 
     59#: index.php:111 
    6060msgid "New password:" 
    6161msgstr "" 
    6262 
    63 #: index.php:114 
     63#: index.php:115 
    6464msgid "Confirm password:" 
    6565msgstr "" 
    6666 
    67 #: index.php:119 
     67#: index.php:120 
    6868msgid "Presentation options" 
    6969msgstr "" 
    7070 
    71 #: index.php:121 
     71#: index.php:122 
    7272msgid "Private page title:" 
    7373msgstr "" 
    7474 
    75 #: index.php:125 
     75#: index.php:126 
    7676msgid "Private message:" 
    7777msgstr "" 
    7878 
    79 #: index.php:132 
     79#: index.php:133 
    8080msgid "Save configuration" 
    8181msgstr "" 
    8282 
    83 #: _public.php:49 
     83#: _public.php:109 _public.php:119 
    8484msgid "Wrong password" 
    8585msgstr "" 
    8686 
    87 #: _public.php:58 
     87#: _public.php:127 
    8888msgid "Disconnected" 
    8989msgstr "" 
    9090 
    91 #: _public.php:112 
     91#: _public.php:172 
     92msgid "Enable automatic connection" 
     93msgstr "" 
     94 
     95#: _public.php:190 
    9296msgid "Disconnect" 
    9397msgstr "" 
  • plugins/private/locales/fr/main.po

    r570 r749  
    8989msgstr "Déconnecté(e)" 
    9090 
     91#: _public.php:172 
     92msgid "Enable automatic connection" 
     93msgstr "Activer la connexion automatique" 
     94 
    9195#: _public.php:112 
    9296msgid "Disconnect" 
Note: See TracChangeset for help on using the changeset viewer.

Sites map