Dotclear

Changeset 835


Ignore:
Timestamp:
03/02/09 22:07:05 (15 years ago)
Author:
Tomtom33
Message:

Added first version of admin page

Location:
plugins/community
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • plugins/community/_admin.php

    r811 r835  
    1515require dirname(__FILE__).'/_widgets.php'; 
    1616 
     17$_menu['System']->addItem( 
     18     __('Community'), 
     19     'plugin.php?p=community', 
     20     'index.php?pf=community/icon.png', 
     21     preg_match('/plugin.php\?p=community(&.*)?$/', 
     22     $_SERVER['REQUEST_URI']), 
     23     $core->auth->isSuperAdmin() 
     24); 
     25 
    1726?> 
  • plugins/community/_define.php

    r818 r835  
    1717          /* Description */             'Create a blog community while allowing users registrations', 
    1818          /* Author */                  'Tomtom (http://plugins.zenstyle.fr/)', 
    19           /* Version */                 '0.3', 
     19          /* Version */                 '0.4', 
    2020          /* Permissions */             'superadmin' 
    2121); 
  • plugins/community/_install.php

    r811 r835  
    1818  
    1919if (version_compare($i_version,$m_version,'>=')) { 
    20      //return; 
     20     return; 
    2121} 
    2222 
    2323$settings = new dcSettings($core,null); 
    2424$settings->setNamespace('community'); 
    25 $settings->put('community_activated',false,'boolean','Community activated'); 
     25$settings->put('community_enabled',false,'boolean','Community enabled'); 
    2626$settings->put('community_moderated',false,'boolean','Community moderated'); 
    2727$settings->put('community_admin_email','','string','Community administrator email'); 
  • plugins/community/_prepend.php

    r811 r835  
    1212 
    1313$__autoload['community'] = dirname(__FILE__).'/inc/class.community.php'; 
     14$__autoload['communityList']  = dirname(__FILE__).'/inc/lib.community.list.php'; 
    1415$__autoload['mail'] = CLEARBRICKS_PATH.'/mail/class.mail.php'; 
    1516 
  • plugins/community/_public.php

    r818 r835  
    7676                         $login = null; 
    7777                    } 
    78                     $_ctx->community = new community($core,$_ctx); 
     78                    $_ctx->community = new community($core); 
    7979                    $_ctx->community->logIn($login,$passwd,$key); 
    8080                    $_ctx->community = null; 
     
    100100          global $core,$_ctx; 
    101101 
    102           if (!$core->blog->settings->community_activated) { 
     102          if (!$core->blog->settings->community_enabled) { 
    103103               self::p404(); 
    104104               exit; 
    105105          } 
    106106 
    107           $_ctx->community = new community($core,$_ctx); 
     107          $_ctx->community = new community($core); 
    108108          $page = split('/',$args); 
    109109          if (count($page) >= 1) { 
  • plugins/community/default-templates/login.html

    r818 r835  
    8080           </p> 
    8181           <!-- Password --> 
    82            <p class="field"><label for="li_passwd">{{tpl:lang Passowrd}}&nbsp;</label> 
     82           <p class="field"><label for="li_passwd">{{tpl:lang Password}}&nbsp;</label> 
    8383           <input name="li_passwd" id="li_passwd" type="passwd" size="30" maxlength="255" 
    8484           value="" /> 
  • plugins/community/default-templates/profile.html

    r818 r835  
    7575        <fieldset> 
    7676           <!-- Login --> 
    77            <p class="field"><label for="p_login">{{tpl:lang Login}} 
     77           <p class="field"><label for="p_login" class="required">{{tpl:lang Login}} 
    7878           <span style="color: red">*</span>&nbsp;</label> 
    7979           <input name="p_login" id="p_login" type="text" size="30" maxlength="255" 
  • plugins/community/inc/class.community.php

    r818 r835  
    2121     protected $admin_email; 
    2222 
    23      public function __construct(&$core,&$_ctx) 
     23     public function __construct(&$core) 
    2424     { 
    2525          $this->core =& $core; 
    26           $this->_ctx =& $_ctx; 
    2726 
    2827          $this->err = array(); 
     
    5453          $account['tz'] = trim($_POST['su_tz']); 
    5554          $account['moderated'] = $this->moderated; 
     55          $account['creadt'] = time() + dt::getTimeOffset($account['tz']); 
    5656          $account['key'] = md5(trim($_POST['su_login'])); 
    5757           
     
    7777          if (count($this->err) == 0) { 
    7878               if ($this->moderated) { 
    79                     $this->sendModerationEmail($account); 
     79                    //$this->sendModerationEmail($account); 
    8080               } 
    8181               else { 
     
    9090     public function register($hash) 
    9191     { 
     92          $key = ''; 
    9293          foreach ($this->standby as $k => $v) { 
    93                $key = ($hash == $v['key']) ? $k : ''; 
     94               $key = ($hash == $v['key']) ? $k : $key; 
    9495          } 
    9596 
     
    114115               $cur->user_tz = $this->standby[$key]['tz']; 
    115116               $cur->user_options = serialize($user_options); 
    116                $cur->user_creadt = array('NOW()'); 
     117               $cur->user_creadt = array($this->standby[$key]['creadt']); 
    117118 
    118119               $cur->insert(); 
     
    154155                    setcookie('dc_community_'.$this->core->blog->id,$cookie_community,strtotime('+15 days')); 
    155156               } 
     157               $name = (string)dcUtils::getUserCN($this->core->auth->userID(),$this->core->auth->getInfo('user_name'),$this->core->auth->getInfo('user_firstname'),$this->core->auth->getInfo('user_displayname')); 
     158               $mail = $this->core->auth->getInfo('user_email'); 
     159               $site = $this->core->auth->getInfo('user_url'); 
     160               setrawcookie('comment_info',rawurlencode($name."\n".$mail."\n".$site),strtotime('+30 days')); 
    156161               if (isset($_POST['li_login_go'])) { 
    157162                    http::redirect($this->core->blog->url); 
     
    167172               unset($_COOKIE['dc_community_'.$this->core->blog->id]); 
    168173               setcookie('dc_community_'.$this->core->blog->id,false,-600); 
     174          } 
     175          if (isset($_COOKIE['comment_info'])) { 
     176               unset($_COOKIE['comment_info']); 
     177               setcookie('comment_info','',-600); 
    169178          } 
    170179          http::redirect($this->core->blog->url); 
     
    236245     } 
    237246 
     247     public function getStandbyUsers() 
     248     { 
     249          return $this->standby; 
     250     } 
     251      
     252     public function delete($id) 
     253     { 
     254          if (array_key_exists($id,$this->standby)) { 
     255               unset($this->standby[$id]); 
     256          } 
     257 
     258          $this->core->blog->settings->setNamespace('community'); 
     259          $this->core->blog->settings->put('community_standby',serialize($this->standby),'string'); 
     260     } 
     261 
    238262     protected function sendActivationEmail($account) 
    239263     { 
Note: See TracChangeset for help on using the changeset viewer.

Sites map