Dotclear

Changeset 1315:220e119ae6c8 for admin


Ignore:
Timestamp:
08/09/13 08:01:31 (12 years ago)
Author:
Dsls
Branch:
twig
Parents:
1158:9d7267aec27b (diff), 1314:99a1319b79fc (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge with default

Location:
admin
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • admin/auth.php

    r1310 r1315  
    44# This file is part of Dotclear 2. 
    55# 
    6 # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear 
     6# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear 
    77# Licensed under the GPL version 2.0 license. 
    88# See LICENSE file or 
     
    1414 
    1515# If we have a session cookie, go to index.php 
    16 if (isset($_SESSION['sess_user_id'])) 
    17 { 
     16if (isset($_SESSION['sess_user_id'])) { 
    1817     http::redirect('index.php'); 
    1918} 
     
    2322$dlang = http::getAcceptLanguage(); 
    2423$dlang = ($dlang == '' ? 'en' : $dlang); 
    25 if ($dlang != 'en' && preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$dlang)) 
    26 { 
     24if ($dlang != 'en' && preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$dlang)) { 
    2725     l10n::set(dirname(__FILE__).'/../locales/'.$dlang.'/main'); 
    2826} 
    29  
    30 $page_url = http::getHost().$_SERVER['REQUEST_URI']; 
    31  
    32 $change_pwd = $core->auth->allowPassChange() && isset($_POST['new_pwd']) && isset($_POST['new_pwd_c']) && isset($_POST['login_data']); 
    33 $login_data = !empty($_POST['login_data']) ? html::escapeHTML($_POST['login_data']) : null; 
    34 $recover = $core->auth->allowPassChange() && !empty($_REQUEST['recover']); 
    35 $safe_mode = !empty($_REQUEST['safe_mode']); 
    36 $akey = $core->auth->allowPassChange() && !empty($_GET['akey']) ? $_GET['akey'] : null; 
    37 $user_id = $user_pwd = $user_key = $user_email = null; 
    38 $err = $msg = null; 
    3927 
    4028# Auto upgrade 
     
    4331     try { 
    4432          if (($changes = dotclearUpgrade($core)) !== false) { 
    45                $msg = __('Dotclear has been upgraded.').'<!-- '.$changes.' -->'; 
    46           } 
    47      } catch (Exception $e) { 
    48           $err = $e->getMessage(); 
    49      } 
    50 } 
    51  
    52 # If we have POST login informations, go throug auth process 
    53 if (!empty($_POST['user_id']) && !empty($_POST['user_pwd'])) 
     33               $_ctx->setAlert(__('Dotclear has been upgraded.').'<!-- '.$changes.' -->'); 
     34          } 
     35     } 
     36     catch (Exception $e) { 
     37          $_ctx->addError($e->getMessage()); 
     38     } 
     39} 
     40 
     41/** 
     42Actions for authentication on admin pages 
     43*/ 
     44class adminPageAuth 
    5445{ 
    55      $user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null; 
    56      $user_pwd = !empty($_POST['user_pwd']) ? $_POST['user_pwd'] : null; 
    57 } 
    58 # If we have COOKIE login informations, go throug auth process 
    59 elseif (isset($_COOKIE['dc_admin']) && strlen($_COOKIE['dc_admin']) == 104) 
    60 { 
     46     # Send new password from recover email 
     47     public static function send($akey) 
     48     { 
     49          global $core, $_ctx; 
     50           
     51          $_ctx->akey = true; 
     52           
     53          try  { 
     54               $recover_res = $core->auth->recoverUserPassword($akey); 
     55                
     56               $subject = mb_encode_mimeheader('DotClear '.__('Your new password'),'UTF-8','B'); 
     57               $message = 
     58               __('Username:').' '.$recover_res['user_id']."\n". 
     59               __('Password:').' '.$recover_res['new_pass']."\n\n". 
     60               preg_replace('/\?(.*)$/','',http::getHost().$_SERVER['REQUEST_URI']); 
     61                
     62               $headers[] = 'From: dotclear@'.$_SERVER['HTTP_HOST']; 
     63               $headers[] = 'Content-Type: text/plain; charset=UTF-8;'; 
     64                
     65               mail::sendMail($recover_res['user_email'],$subject,$message,$headers); 
     66               $_ctx->setAlert(__('Your new password is in your mailbox.')); 
     67          } 
     68          catch (Exception $e) { 
     69               $_ctx->addError($e->getMessage()); 
     70          } 
     71     } 
     72      
     73     # Authentication process 
     74     public static function process($form,$user_id,$user_pwd,$user_key=null) 
     75     { 
     76          global $core, $_ctx; 
     77           
     78          # We check the user 
     79          $check_user = $core->auth->checkUser($user_id,$user_pwd,$user_key) === true; 
     80           
     81          $cookie_admin = http::browserUID(DC_MASTER_KEY.$user_id. 
     82               crypt::hmac(DC_MASTER_KEY,$user_pwd)).bin2hex(pack('a32',$user_id)); 
     83           
     84          if ($check_user && $core->auth->mustChangePassword()) 
     85          { 
     86               $form->login_data = join('/',array( 
     87                    base64_encode($user_id), 
     88                    $cookie_admin, 
     89                    $form->user_remember == '' ? '0' : '1' 
     90               )); 
     91                
     92               if (!$core->auth->allowPassChange()) { 
     93                    $_ctx->addError(__('You have to change your password before you can login.')); 
     94               } else { 
     95                    $_ctx->addError(__('In order to login, you have to change your password now.')); 
     96                    $_ctx->change_pwd = true; 
     97               } 
     98          } 
     99          elseif ($check_user && $form->safe_mode != '' && !$core->auth->isSuperAdmin())  
     100          { 
     101               $_ctx->addError(__('Safe Mode can only be used for super administrators.')); 
     102          } 
     103          elseif ($check_user) 
     104          { 
     105               $core->session->start(); 
     106               $_SESSION['sess_user_id'] = $user_id; 
     107               $_SESSION['sess_browser_uid'] = http::browserUID(DC_MASTER_KEY); 
     108                
     109               if ($form->blog != '') { 
     110                    $_SESSION['sess_blog_id'] = $form->blog; 
     111               } 
     112                
     113               if ($form->safe_mode != '' && $core->auth->isSuperAdmin()) { 
     114                    $_SESSION['sess_safe_mode'] = true; 
     115               } 
     116                
     117               if ($form->user_remember != '') { 
     118                    setcookie('dc_admin',$cookie_admin,strtotime('+15 days'),'','',DC_ADMIN_SSL); 
     119               } 
     120                
     121               http::redirect('index.php'); 
     122          } 
     123          else 
     124          { 
     125               if (isset($_COOKIE['dc_admin'])) { 
     126                    unset($_COOKIE['dc_admin']); 
     127                    setcookie('dc_admin',false,-600,'','',DC_ADMIN_SSL); 
     128               } 
     129               $_ctx->addError(__('Wrong username or password')); 
     130          } 
     131     } 
     132      
     133     # Login form action 
     134     public static function login($form) 
     135     { 
     136          global $_ctx; 
     137           
     138          if ($form->user_id != '' && $form->user_pwd != '') { 
     139               self::process($form,$form->user_id,$form->user_pwd); 
     140          } 
     141           
     142          # Send post values to form 
     143          $form->user_id = $form->user_id; 
     144     } 
     145 
     146     # Recover password form action 
     147     public static function recover($form) 
     148     { 
     149          global $core, $_ctx; 
     150           
     151          if ($form->user_id == '' || $form->user_email == '') { 
     152               return; 
     153          } 
     154           
     155          $user_id = $form->user_id; 
     156          $user_email = $form->user_email; 
     157          $page_url = http::getHost().$_SERVER['REQUEST_URI']; 
     158           
     159          try { 
     160               $recover_key = $core->auth->setRecoverKey($user_id,$user_email); 
     161                
     162               $subject = mail::B64Header('DotClear '.__('Password reset')); 
     163               $message = 
     164               __('Someone has requested to reset the password for the following site and username.')."\n\n". 
     165               $page_url."\n".__('Username:').' '.$user_id."\n\n". 
     166               __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.')."\n". 
     167               $page_url.'?akey='.$recover_key; 
     168                
     169               $headers[] = 'From: '.(defined('DC_ADMIN_MAILFROM') && DC_ADMIN_MAILFROM ? DC_ADMIN_MAILFROM : 'dotclear@local'); 
     170               $headers[] = 'Content-Type: text/plain; charset=UTF-8;'; 
     171                
     172               mail::sendMail($user_email,$subject,$message,$headers); 
     173               $_ctx->setAlert(sprintf(__('The e-mail was sent successfully to %s.'),$user_email)); 
     174          } 
     175          catch (Exception $e) { 
     176               $_ctx->addError($e->getMessage()); 
     177          } 
     178           
     179          # Send post values to form 
     180          $form->user_id = $form->user_id; 
     181          $form->user_email = $form->user_email; 
     182     } 
     183 
     184     # Change password form action 
     185     public static function change($form) 
     186     { 
     187          global $core, $_ctx; 
     188           
     189          if ($form->login_data) { 
     190               return; 
     191          } 
     192          $_ctx->change_pwd = true; 
     193           
     194          $new_pwd = (string) $form->new_pwd; 
     195          $new_pwd_c = (string) $form->new_pwd_c; 
     196           
     197          try { 
     198               $tmp_data = explode('/',$form->login_data); 
     199               if (count($tmp_data) != 3) { 
     200                    throw new Exception(); 
     201               } 
     202               $data = array( 
     203                    'user_id'=>base64_decode($tmp_data[0]), 
     204                    'cookie_admin'=>$tmp_data[1], 
     205                    'user_remember'=>$tmp_data[2]=='1' 
     206               ); 
     207               if ($data['user_id'] === false) { 
     208                    throw new Exception(); 
     209               } 
     210                
     211               # Check login informations 
     212               $check_user = false; 
     213               if (isset($data['cookie_admin']) && strlen($data['cookie_admin']) == 104) 
     214               { 
     215                    $user_id = substr($data['cookie_admin'],40); 
     216                    $user_id = @unpack('a32',@pack('H*',$user_id)); 
     217                    if (is_array($user_id)) 
     218                    { 
     219                         $user_id = $user_id[1]; 
     220                         $user_key = substr($data['cookie_admin'],0,40); 
     221                         $check_user = $core->auth->checkUser($user_id,null,$user_key) === true; 
     222                    } 
     223               } 
     224                
     225               if (!$core->auth->allowPassChange() || !$check_user) { 
     226                    $_ctx->change_pwd = false; 
     227                    throw new Exception(); 
     228               } 
     229                
     230               if ($new_pwd != $new_pwd_c) { 
     231                    throw new Exception(__("Passwords don't match")); 
     232               } 
     233                
     234               if ($core->auth->checkUser($user_id,$new_pwd) === true) { 
     235                    throw new Exception(__("You didn't change your password.")); 
     236               } 
     237                
     238               $cur = $core->con->openCursor($core->prefix.'user'); 
     239               $cur->user_change_pwd = 0; 
     240               $cur->user_pwd = $new_pwd; 
     241               $core->updUser($core->auth->userID(),$cur); 
     242                
     243               $core->session->start(); 
     244               $_SESSION['sess_user_id'] = $user_id; 
     245               $_SESSION['sess_browser_uid'] = http::browserUID(DC_MASTER_KEY); 
     246                
     247               if ($data['user_remember']) { 
     248                    setcookie('dc_admin',$data['cookie_admin'],strtotime('+15 days'),'','',DC_ADMIN_SSL); 
     249               } 
     250                
     251               http::redirect('index.php'); 
     252          } 
     253          catch (Exception $e) { 
     254               $_ctx->addError($e->getMessage()); 
     255          } 
     256           
     257          # Send post values to form 
     258          $form->login_data = $form->login_data; 
     259     } 
     260} 
     261 
     262# Form fields 
     263$form = new dcForm($core,'auth','auth.php'); 
     264$form 
     265     ->addField( 
     266          new dcFieldText('user_id','',array( 
     267               "label" => __('Username:')))) 
     268     ->addField( 
     269          new dcFieldPassword('user_pwd','',array( 
     270               "label" => __('Password:')))) 
     271     ->addField( 
     272          new dcFieldText('user_email','',array( 
     273               "label" => __('Email:')))) 
     274     ->addField( 
     275          new dcFieldPassword('new_pwd','',array( 
     276               "label" => __('New password:')))) 
     277     ->addField( 
     278          new dcFieldPassword('new_pwd_c','',array( 
     279               "label" => __('Confirm password:')))) 
     280     ->addField( 
     281          new dcFieldCheckbox ('user_remenber',1,array( 
     282               "label" => __('Remember my ID on this computer')))) 
     283     ->addField( 
     284          new dcFieldSubmit('auth_login',__('log in'),array( 
     285               'action' => array('adminPageAuth','login')))) 
     286     ->addField( 
     287          new dcFieldSubmit('auth_recover',__('recover'),array( 
     288               'action' => array('adminPageAuth','recover')))) 
     289     ->addField( 
     290          new dcFieldSubmit('auth_change',__('change'),array( 
     291               'action' => array('adminPageAuth','change')))) 
     292     ->addField( 
     293          new dcFieldHidden ('safe_mode','0')) 
     294     ->addField( 
     295          new dcFieldHidden ('recover','0')) 
     296     ->addField( 
     297          new dcFieldHidden ('login_data','')) 
     298     ->addField( 
     299          new dcFieldHidden ('blog','')); 
     300 
     301# Context variables 
     302$_ctx->allow_pass_change = $core->auth->allowPassChange(); 
     303$_ctx->change_pwd = $core->auth->allowPassChange() && $form->new_pwd != '' && $form->new_pwd_c != '' && $form->login_data != ''; 
     304$_ctx->recover = $form->recover = $core->auth->allowPassChange() && !empty($_REQUEST['recover']); 
     305$_ctx->setSafeMode(!empty($_REQUEST['safe_mode']));  
     306$form->safe_mode = !empty($_REQUEST['safe_mode']); 
     307$_ctx->akey = false; 
     308 
     309# If we have no POST login informations and have COOKIE login informations, go throug auth process 
     310if ($form->user_id == '' && $form->user_pwd == ''  
     311 && isset($_COOKIE['dc_admin']) && strlen($_COOKIE['dc_admin']) == 104) { 
     312 
    61313     # If we have a remember cookie, go through auth process with user_key 
    62314     $user_id = substr($_COOKIE['dc_admin'],40); 
    63315     $user_id = @unpack('a32',@pack('H*',$user_id)); 
    64      if (is_array($user_id)) 
    65      { 
     316      
     317     if (is_array($user_id)) { 
    66318          $user_id = $user_id[1]; 
    67319          $user_key = substr($_COOKIE['dc_admin'],0,40); 
    68           $user_pwd = null; 
    69      } 
    70      else 
    71      { 
    72           $user_id = null; 
    73      } 
    74 } 
    75  
    76 # Recover password 
    77 if ($recover && !empty($_POST['user_id']) && !empty($_POST['user_email'])) 
    78 { 
    79      $user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null; 
    80      $user_email = !empty($_POST['user_email']) ? $_POST['user_email'] : ''; 
    81      try 
    82      { 
    83           $recover_key = $core->auth->setRecoverKey($user_id,$user_email); 
    84            
    85           $subject = mail::B64Header('DotClear '.__('Password reset')); 
    86           $message = 
    87           __('Someone has requested to reset the password for the following site and username.')."\n\n". 
    88           $page_url."\n".__('Username:').' '.$user_id."\n\n". 
    89           __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.')."\n". 
    90           $page_url.'?akey='.$recover_key; 
    91            
    92           $headers[] = 'From: '.(defined('DC_ADMIN_MAILFROM') && DC_ADMIN_MAILFROM ? DC_ADMIN_MAILFROM : 'dotclear@local'); 
    93           $headers[] = 'Content-Type: text/plain; charset=UTF-8;'; 
    94            
    95           mail::sendMail($user_email,$subject,$message,$headers); 
    96           $msg = sprintf(__('The e-mail was sent successfully to %s.'),$user_email); 
    97      } 
    98      catch (Exception $e) 
    99      { 
    100           $err = $e->getMessage(); 
    101      } 
    102 } 
    103 # Send new password 
    104 elseif ($akey) 
    105 { 
    106      try 
    107      { 
    108           $recover_res = $core->auth->recoverUserPassword($akey); 
    109            
    110           $subject = mb_encode_mimeheader('DotClear '.__('Your new password'),'UTF-8','B'); 
    111           $message = 
    112           __('Username:').' '.$recover_res['user_id']."\n". 
    113           __('Password:').' '.$recover_res['new_pass']."\n\n". 
    114           preg_replace('/\?(.*)$/','',$page_url); 
    115            
    116           $headers[] = 'From: dotclear@'.$_SERVER['HTTP_HOST']; 
    117           $headers[] = 'Content-Type: text/plain; charset=UTF-8;'; 
    118            
    119           mail::sendMail($recover_res['user_email'],$subject,$message,$headers); 
    120           $msg = __('Your new password is in your mailbox.'); 
    121      } 
    122      catch (Exception $e) 
    123      { 
    124           $err = $e->getMessage(); 
    125      } 
    126 } 
    127 # Change password and retry to log 
    128 elseif ($change_pwd) 
    129 { 
    130      try 
    131      { 
    132           $tmp_data = explode('/',$_POST['login_data']); 
    133           if (count($tmp_data) != 3) { 
    134                throw new Exception(); 
    135           } 
    136           $data = array( 
    137                'user_id'=>base64_decode($tmp_data[0]), 
    138                'cookie_admin'=>$tmp_data[1], 
    139                'user_remember'=>$tmp_data[2]=='1' 
    140           ); 
    141           if ($data['user_id'] === false) { 
    142                throw new Exception(); 
    143           } 
    144            
    145      # Check login informations 
    146      $check_user = false; 
    147      if (isset($data['cookie_admin']) && strlen($data['cookie_admin']) == 104) 
    148      { 
    149           $user_id = substr($data['cookie_admin'],40); 
    150           $user_id = @unpack('a32',@pack('H*',$user_id)); 
    151           if (is_array($user_id)) 
    152           { 
    153                $user_id = $user_id[1]; 
    154                $user_key = substr($data['cookie_admin'],0,40); 
    155                $check_user = $core->auth->checkUser($user_id,null,$user_key) === true; 
    156           } 
    157      } 
    158       
    159           if (!$core->auth->allowPassChange() || !$check_user) { 
    160                $change_pwd = false; 
    161                throw new Exception(); 
    162           } 
    163            
    164           if ($_POST['new_pwd'] != $_POST['new_pwd_c']) { 
    165                throw new Exception(__("Passwords don't match")); 
    166           } 
    167            
    168           if ($core->auth->checkUser($user_id,$_POST['new_pwd']) === true) { 
    169                throw new Exception(__("You didn't change your password.")); 
    170           } 
    171            
    172           $cur = $core->con->openCursor($core->prefix.'user'); 
    173           $cur->user_change_pwd = 0; 
    174           $cur->user_pwd = $_POST['new_pwd']; 
    175           $core->updUser($core->auth->userID(),$cur); 
    176            
    177           $core->session->start(); 
    178           $_SESSION['sess_user_id'] = $user_id; 
    179           $_SESSION['sess_browser_uid'] = http::browserUID(DC_MASTER_KEY); 
    180            
    181           if ($data['user_remember']) 
    182           { 
    183                setcookie('dc_admin',$data['cookie_admin'],strtotime('+15 days'),'','',DC_ADMIN_SSL); 
    184           } 
    185            
    186           http::redirect('index.php'); 
    187      } 
    188      catch (Exception $e) 
    189      { 
    190           $err = $e->getMessage(); 
    191      } 
    192 } 
    193 # Try to log 
    194 elseif ($user_id !== null && ($user_pwd !== null || $user_key !== null)) 
    195 { 
    196      # We check the user 
    197      $check_user = $core->auth->checkUser($user_id,$user_pwd,$user_key) === true; 
    198       
    199      $cookie_admin = http::browserUID(DC_MASTER_KEY.$user_id. 
    200           crypt::hmac(DC_MASTER_KEY,$user_pwd)).bin2hex(pack('a32',$user_id)); 
    201       
    202      if ($check_user && $core->auth->mustChangePassword()) 
    203      { 
    204           $login_data = join('/',array( 
    205                base64_encode($user_id), 
    206                $cookie_admin, 
    207                empty($_POST['user_remember'])?'0':'1' 
    208           )); 
    209            
    210           if (!$core->auth->allowPassChange()) { 
    211                $err = __('You have to change your password before you can login.'); 
    212           } else { 
    213                $err = __('In order to login, you have to change your password now.'); 
    214                $change_pwd = true; 
    215           } 
    216      } 
    217      elseif ($check_user && !empty($_POST['safe_mode']) && !$core->auth->isSuperAdmin())  
    218      { 
    219           $err = __('Safe Mode can only be used for super administrators.'); 
    220      } 
    221      elseif ($check_user) 
    222      { 
    223           $core->session->start(); 
    224           $_SESSION['sess_user_id'] = $user_id; 
    225           $_SESSION['sess_browser_uid'] = http::browserUID(DC_MASTER_KEY); 
    226            
    227           if (!empty($_POST['blog'])) { 
    228                $_SESSION['sess_blog_id'] = $_POST['blog']; 
    229           } 
    230            
    231           if (!empty($_POST['safe_mode']) && $core->auth->isSuperAdmin()) { 
    232                $_SESSION['sess_safe_mode'] = true; 
    233           } 
    234            
    235           if (!empty($_POST['user_remember'])) { 
    236                setcookie('dc_admin',$cookie_admin,strtotime('+15 days'),'','',DC_ADMIN_SSL); 
    237           } 
    238            
    239           http::redirect('index.php'); 
    240      } 
    241      else 
    242      { 
    243           if (isset($_COOKIE['dc_admin'])) { 
    244                unset($_COOKIE['dc_admin']); 
    245                setcookie('dc_admin',false,-600,'','',DC_ADMIN_SSL); 
    246           } 
    247           $err = __('Wrong username or password'); 
    248      } 
     320          $user_pwd = ''; 
     321           
     322          adminPageAuth::process($form,$user_id,$user_pwd,$user_key); 
     323     } 
     324} 
     325# If we have an akey, go throug send password process 
     326elseif ($core->auth->allowPassChange() && !empty($_GET['akey'])) { 
     327     adminPageAuth::send($_GET['akey']); 
    249328} 
    250329 
    251330if (isset($_GET['user'])) { 
    252      $user_id = $_GET['user']; 
    253 } 
    254  
    255 header('Content-Type: text/html; charset=UTF-8'); 
     331     $form->user_id = $_GET['user']; 
     332} 
     333 
     334$form->setup(); 
     335 
     336$core->tpl->display('auth.html.twig'); 
    256337?> 
    257 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    258 <html xmlns="http://www.w3.org/1999/xhtml" 
    259 xml:lang="<?php echo $dlang; ?>" lang="<?php echo $dlang; ?>"> 
    260 <head> 
    261   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    262   <meta http-equiv="Content-Script-Type" content="text/javascript" /> 
    263   <meta http-equiv="Content-Style-Type" content="text/css" /> 
    264   <meta http-equiv="Content-Language" content="<?php echo $dlang; ?>" /> 
    265   <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" /> 
    266   <meta name="GOOGLEBOT" content="NOSNIPPET" /> 
    267   <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 
    268   <title><?php echo html::escapeHTML(DC_VENDOR_NAME); ?></title> 
    269    
    270 <?php 
    271 echo dcPage::jsLoadIE7(); 
    272 echo dcPage::jsCommon(); 
    273 ?> 
    274    
    275      <link rel="stylesheet" href="style/default.css" type="text/css" media="screen" /> 
    276        
    277   <?php 
    278   # --BEHAVIOR-- loginPageHTMLHead 
    279   $core->callBehavior('loginPageHTMLHead'); 
    280   ?> 
    281    
    282   <script type="text/javascript"> 
    283   //<![CDATA[ 
    284   $(window).load(function() { 
    285     var uid = $('input[name=user_id]'); 
    286     var upw = $('input[name=user_pwd]'); 
    287     uid.focus(); 
    288      
    289     if (upw.length == 0) { return; } 
    290      
    291     if ($.browser.mozilla) { 
    292       uid.keypress(processKey); 
    293     } else { 
    294       uid.keydown(processKey); 
    295     } 
    296     function processKey(evt) { 
    297       if (evt.keyCode == 13 && upw.val() == '') { 
    298          upw.focus(); 
    299          return false; 
    300       } 
    301       return true; 
    302     }; 
    303     $.cookie('dc_admin_test_cookie',true); 
    304     if ($.cookie('dc_admin_test_cookie')) { 
    305       $('#cookie_help').hide(); 
    306       $.cookie('dc_admin_test_cookie', '', {'expires': -1}); 
    307     } else { 
    308       $('#cookie_help').show(); 
    309     } 
    310     $('#issue #more').toggleWithLegend($('#issue').children().not('#more')); 
    311   }); 
    312   //]]> 
    313   </script> 
    314 </head> 
    315  
    316 <body id="dotclear-admin" class="auth"> 
    317  
    318 <form action="auth.php" method="post" id="login-screen"> 
    319 <h1><?php echo html::escapeHTML(DC_VENDOR_NAME); ?></h1> 
    320  
    321 <?php 
    322 if ($err) { 
    323      echo '<div class="error">'.$err.'</div>'; 
    324 } 
    325 if ($msg) { 
    326      echo '<p class="message">'.$msg.'</p>'; 
    327 } 
    328  
    329 if ($akey) 
    330 { 
    331      echo '<p><a href="auth.php">'.__('Back to login screen').'</a></p>'; 
    332 } 
    333 elseif ($recover) 
    334 { 
    335      echo 
    336      '<fieldset><legend>'.__('Request a new password').'</legend>'. 
    337      '<p><label for="user_id">'.__('Username:').'</label> '. 
    338      form::field(array('user_id','user_id'),20,32,html::escapeHTML($user_id)).'</p>'. 
    339       
    340      '<p><label for="user_email">'.__('Email:').'</label> '. 
    341      form::field(array('user_email','user_email'),20,255,html::escapeHTML($user_email)).'</p>'. 
    342       
    343      '<p><input type="submit" value="'.__('recover').'" />'. 
    344      form::hidden(array('recover'),1).'</p>'. 
    345      '</fieldset>'. 
    346       
    347      '<div id="issue">'. 
    348      '<p><a href="auth.php">'.__('Back to login screen').'</a></p></div>'; 
    349 } 
    350 elseif ($change_pwd) 
    351 { 
    352      echo 
    353      '<fieldset><legend>'.__('Change your password').'</legend>'. 
    354      '<p><label for="new_pwd">'.__('New password:').'</label> '. 
    355      form::password(array('new_pwd','new_pwd'),20,255).'</p>'. 
    356       
    357      '<p><label for="new_pwd_c">'.__('Confirm password:').'</label> '. 
    358      form::password(array('new_pwd_c','new_pwd_c'),20,255).'</p>'. 
    359      '</fielset>'. 
    360       
    361      '<p><input type="submit" value="'.__('change').'" />'. 
    362      form::hidden('login_data',$login_data).'</p>'; 
    363 } 
    364 else 
    365 { 
    366      if (is_callable(array($core->auth,'authForm'))) 
    367      { 
    368           echo $core->auth->authForm($user_id); 
    369      } 
    370      else 
    371      { 
    372           if ($safe_mode) { 
    373                echo '<fieldset>'; 
    374                echo '<legend>'.__('Safe mode login').'</legend>'; 
    375                echo  
    376                     '<p class="form-note info">'. 
    377                     __('This mode allows you to login without activating any of your plugins. This may be useful to solve compatibility problems').'&nbsp;<br />'. 
    378                     __('Disable or delete any plugin suspected to cause trouble, then log out and log back in normally.'). 
    379                     '</p>'; 
    380           } 
    381           else { 
    382                echo '<div class="fieldset">'; 
    383           } 
    384  
    385           echo 
    386           '<p><label for="user_id">'.__('Username:').'</label> '. 
    387           form::field(array('user_id','user_id'),20,32,html::escapeHTML($user_id)).'</p>'. 
    388            
    389           '<p><label for="user_pwd">'.__('Password:').'</label> '. 
    390           form::password(array('user_pwd','user_pwd'),20,255).'</p>'. 
    391            
    392           '<p>'. 
    393           form::checkbox(array('user_remember','user_remember'),1). 
    394           '<label for="user_remember" class="classic">'. 
    395           __('Remember my ID on this computer').'</label></p>'. 
    396            
    397           '<p><input class="add button" type="submit" value="'.__('log in').'" /></p>'; 
    398            
    399           if (!empty($_REQUEST['blog'])) { 
    400                echo form::hidden('blog',html::escapeHTML($_REQUEST['blog'])); 
    401           } 
    402           if($safe_mode) { 
    403                echo  
    404                form::hidden('safe_mode',1). 
    405                '</fieldset>'; 
    406           } 
    407           else { 
    408                echo '</div>'; 
    409           } 
    410           echo 
    411           '<p id="cookie_help" class="error">'.__('You must accept cookies in order to use the private area.').'</p>'; 
    412  
    413           echo '<div id="issue">'; 
    414            
    415           if ($safe_mode) { 
    416                echo 
    417                '<p><a href="auth.php" id="normal_mode_link">'.__('Get back to normal authentication').'</a></p>'; 
    418           } else { 
    419                echo '<p id="more"><strong>'.__('Connection issue?').'</strong></p>'; 
    420                if ($core->auth->allowPassChange()) { 
    421                     echo '<p><a href="auth.php?recover=1">'.__('I forgot my password').'</a></p>'; 
    422                } 
    423                echo '<p><a href="auth.php?safe_mode=1" id="safe_mode_link">'.__('I want to log in in safe mode').'</a></p>'; 
    424           } 
    425            
    426           echo '</div>'; 
    427      } 
    428 } 
    429 ?> 
    430 </form> 
    431 </body> 
    432 </html> 
  • admin/index.php

    r1280 r1315  
    44# This file is part of Dotclear 2. 
    55# 
    6 # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear 
     6# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear 
    77# Licensed under the GPL version 2.0 license. 
    88# See LICENSE file or 
     
    1313if (!empty($_GET['pf'])) { 
    1414     require dirname(__FILE__).'/../inc/load_plugin_file.php'; 
     15     exit; 
     16} 
     17if (!empty($_GET['tf'])) { 
     18     define('DC_CONTEXT_ADMIN',true); 
     19     require dirname(__FILE__).'/../inc/load_theme_file.php'; 
    1520     exit; 
    1621} 
     
    4348$plugins_install = $core->plugins->installModules(); 
    4449 
     50# Send plugins install messages to templates 
     51if (!empty($plugins_install['success'])) { 
     52     $_ctx->addMessagesList(__('Following plugins have been installed:'),$plugins_install['success']); 
     53} 
     54if (!empty($plugins_install['failure'])) { 
     55     $_ctx->addMessagesList(__('Following plugins have not been installed:'),$plugins_install['failure']); 
     56} 
     57 
     58# Send plugins errors messages to templates 
     59$_ctx->modules_errors = $core->auth->isSuperAdmin() ? $core->plugins->getErrors() : array(); 
     60 
     61# Send Dotclear updates notifications to tempaltes 
     62$_ctx->updater = array(); 
     63if ($core->auth->isSuperAdmin() && is_readable(DC_DIGESTS)) { 
     64 
     65     $updater = new dcUpdate(DC_UPDATE_URL,'dotclear',DC_UPDATE_VERSION,DC_TPL_CACHE.'/versions'); 
     66     $new_v = $updater->check(DC_VERSION); 
     67     $version_info = $new_v ? $updater->getInfoURL() : ''; 
     68      
     69     if ($updater->getNotify() && $new_v) { 
     70          $_ctx->updater = array( 
     71               'new_version'  => $new_v, 
     72               'version_info' => $version_info 
     73          ); 
     74     } 
     75} 
     76 
    4577# Check dashboard module prefs 
    4678$ws = $core->auth->user_prefs->addWorkspace('dashboard'); 
     79 
     80# Doclinks prefs 
    4781if (!$core->auth->user_prefs->dashboard->prefExists('doclinks')) { 
    4882     if (!$core->auth->user_prefs->dashboard->prefExists('doclinks',true)) { 
     
    5185     $core->auth->user_prefs->dashboard->put('doclinks',true,'boolean'); 
    5286} 
     87 
     88# Send doclinks to templates 
     89$_ctx->dashboard_doclinks = array(); 
     90if ($core->auth->user_prefs->dashboard->doclinks && !empty($__resources['doc'])) { 
     91     $_ctx->dashboard_doclinks = $__resources['doc']; 
     92} 
     93 
     94# Dcnews prefs 
    5395if (!$core->auth->user_prefs->dashboard->prefExists('dcnews')) { 
    5496     if (!$core->auth->user_prefs->dashboard->prefExists('dcnews',true)) { 
     
    5799     $core->auth->user_prefs->dashboard->put('dcnews',true,'boolean'); 
    58100} 
     101 
     102# Send dcnews to templates 
     103$_ctx->dashboard_dcnews = array(); 
     104if ($core->auth->user_prefs->dashboard->dcnews && !empty($__resources['rss_news'])) { 
     105     try 
     106     { 
     107          $feed_reader = new feedReader; 
     108          $feed_reader->setCacheDir(DC_TPL_CACHE); 
     109          $feed_reader->setTimeout(2); 
     110          $feed_reader->setUserAgent('Dotclear - http://www.dotclear.org/'); 
     111          $feed = $feed_reader->parse($__resources['rss_news']); 
     112          if ($feed) { 
     113               $items = array(); 
     114               $i = 1; 
     115               foreach ($feed->items as $item) { 
     116                    $items[] = array( 
     117                         'title' => $item->title, 
     118                         'link' => isset($item->link) ? $item->link : '', 
     119                         'date' => dt::dt2str(__('%d %B %Y'),$item->pubdate,'Europe/Paris'), 
     120                         'content' => html::clean($item->content) 
     121                    ); 
     122                    $i++; 
     123                    if ($i > 3) { break; } 
     124               } 
     125               $_ctx->dashboard_dcnews = $items; 
     126          } 
     127     } 
     128     catch (Exception $e) {} 
     129} 
     130 
     131# Quick entry prefs 
    59132if (!$core->auth->user_prefs->dashboard->prefExists('quickentry')) { 
    60133     if (!$core->auth->user_prefs->dashboard->prefExists('quickentry',true)) { 
     
    62135     } 
    63136     $core->auth->user_prefs->dashboard->put('quickentry',true,'boolean'); 
     137} 
     138 
     139# Send quick entry to templates 
     140$_ctx->dashboard_quickentry = false; 
     141if ($core->auth->user_prefs->dashboard->quickentry &&$core->auth->check('usage,contentadmin',$core->blog->id)) 
     142{ 
     143     $categories_combo = array('&nbsp;' => ''); 
     144     try { 
     145          $categories = $core->blog->getCategories(array('post_type'=>'post')); 
     146          while ($categories->fetch()) { 
     147               $categories_combo[$categories->cat_id] =  
     148                    str_repeat('&nbsp;&nbsp;',$categories->level-1). 
     149                    ($categories->level-1 == 0 ? '' : '&bull; '). 
     150                    html::escapeHTML($categories->cat_title); 
     151          } 
     152     } catch (Exception $e) { } 
     153      
     154     $form = new dcForm($core,array('quickentry','quick-entry'),'post.php'); 
     155     $form 
     156          ->addField( 
     157               new dcFieldText('post_title','', array( 
     158                    'size'         => 20, 
     159                    'required'     => true, 
     160                    'label'        => __('Title')))) 
     161          ->addField( 
     162               new dcFieldTextArea('post_content','', array( 
     163                    'required'     => true, 
     164                    'label'        => __("Content:")))) 
     165          ->addField( 
     166               new dcFieldCombo('cat_id','',$categories_combo,array( 
     167                    "label" => __('Category:')))) 
     168          ->addField( 
     169               new dcFieldSubmit('save',__('Save'),array( 
     170                    'action' => 'savePost'))) 
     171          ->addField( 
     172               new dcFieldHidden ('post_status',-2)) 
     173          ->addField( 
     174               new dcFieldHidden ('post_format',$core->auth->getOption('post_format'))) 
     175          ->addField( 
     176               new dcFieldHidden ('post_excerpt','')) 
     177          ->addField( 
     178               new dcFieldHidden ('post_lang',$core->auth->getInfo('user_lang'))) 
     179          ->addField( 
     180               new dcFieldHidden ('post_notes','')) 
     181     ; 
     182     if ($core->auth->check('publish',$core->blog->id)) { 
     183          $form->addField( 
     184               new dcFieldHidden ('save-publish',__('Save and publish'))); 
     185     } 
     186      
     187     $_ctx->dashboard_quickentry = true; 
    64188} 
    65189 
     
    118242} 
    119243 
    120 # Latest news for dashboard 
     244# Send dashboard icons to templates 
     245$icons = array(); 
     246foreach ($__dashboard_icons as $i) { 
     247     $icons[] = array( 
     248          'title'   => $i[0], 
     249          'url'     => $i[1], 
     250          'img'     => dc_admin_icon_url($i[2]) 
     251     ); 
     252} 
     253$_ctx->dashboard_icons = $icons; 
     254 
     255# Dashboard items 
    121256$__dashboard_items = new ArrayObject(array(new ArrayObject,new ArrayObject)); 
    122  
    123 # Documentation links 
    124 $dashboardItem = 0; 
    125 if ($core->auth->user_prefs->dashboard->doclinks) { 
    126      if (!empty($__resources['doc'])) 
    127      { 
    128           $doc_links = '<h3>'.__('Documentation and support').'</h3><ul>'; 
    129       
    130           foreach ($__resources['doc'] as $k => $v) { 
    131                $doc_links .= '<li><a href="'.$v.'" title="'.$k.' '.__('(external link)').'">'.$k.'</a></li>'; 
    132           } 
    133       
    134           $doc_links .= '</ul>'; 
    135           $__dashboard_items[$dashboardItem][] = $doc_links; 
    136           $dashboardItem++; 
    137      } 
    138 } 
    139  
    140 if ($core->auth->user_prefs->dashboard->dcnews) { 
    141      try 
    142      { 
    143           if (empty($__resources['rss_news'])) { 
    144                throw new Exception(); 
    145           } 
    146       
    147           $feed_reader = new feedReader; 
    148           $feed_reader->setCacheDir(DC_TPL_CACHE); 
    149           $feed_reader->setTimeout(2); 
    150           $feed_reader->setUserAgent('Dotclear - http://www.dotclear.org/'); 
    151           $feed = $feed_reader->parse($__resources['rss_news']); 
    152           if ($feed) 
    153           { 
    154                $latest_news = '<h3>'.__('Latest news').'</h3><dl id="news">'; 
    155                $i = 1; 
    156                foreach ($feed->items as $item) 
    157                { 
    158                     $dt = isset($item->link) ? '<a href="'.$item->link.'" title="'.$item->title.' '.__('(external link)').'">'. 
    159                          $item->title.'</a>' : $item->title; 
    160                 
    161                     if ($i < 3) { 
    162                          $latest_news .= 
    163                          '<dt>'.$dt.'</dt>'. 
    164                          '<dd><p><strong>'.dt::dt2str(__('%d %B %Y:'),$item->pubdate,'Europe/Paris').'</strong> '. 
    165                          '<em>'.text::cutString(html::clean($item->content),120).'...</em></p></dd>'; 
    166                     } else { 
    167                          $latest_news .= 
    168                          '<dt>'.$dt.'</dt>'. 
    169                          '<dd>'.dt::dt2str(__('%d %B %Y:'),$item->pubdate,'Europe/Paris').'</dd>'; 
    170                     } 
    171                     $i++; 
    172                     if ($i > 3) { break; } 
    173                } 
    174                $latest_news .= '</dl>'; 
    175                $__dashboard_items[$dashboardItem][] = $latest_news; 
    176                $dashboardItem++; 
    177           } 
    178      } 
    179      catch (Exception $e) {} 
    180 } 
    181  
    182257$core->callBehavior('adminDashboardItems', $core, $__dashboard_items); 
    183258 
     259# Send dashboard items to templates 
     260$items = array(); 
     261foreach ($__dashboard_items as $i) {     
     262     if ($i->count() > 0) { 
     263          foreach ($i as $v) { 
     264               $items[] = $v; 
     265          } 
     266     } 
     267} 
     268$_ctx->dashboard_items = $items; 
     269 
    184270# Dashboard content 
    185 $dashboardContents = ''; 
    186271$__dashboard_contents = new ArrayObject(array(new ArrayObject,new ArrayObject)); 
    187272$core->callBehavior('adminDashboardContents', $core, $__dashboard_contents); 
    188273 
    189 /* DISPLAY 
    190 -------------------------------------------------------- */ 
    191 dcPage::open(__('Dashboard'), 
    192      dcPage::jsToolBar(). 
    193      dcPage::jsLoad('js/_index.js'). 
    194      # --BEHAVIOR-- adminDashboardHeaders 
    195      $core->callBehavior('adminDashboardHeaders') 
    196 ); 
    197  
    198 echo '<h2>'.html::escapeHTML($core->blog->name).' &rsaquo; <span class="page-title">'.__('Dashboard').'</span></h2>'; 
    199  
    200 if ($core->auth->getInfo('user_default_blog') != $core->blog->id && $core->auth->blog_count > 1) { 
    201      echo 
    202      '<p><a href="index.php?default_blog=1" class="button">'.__('Make this blog my default blog').'</a></p>'; 
    203 } 
    204  
     274# Send dashboard contents to templates 
     275$contents = array(); 
     276foreach ($__dashboard_contents as $i) {  
     277     if ($i->count() > 0) { 
     278          foreach ($i as $v) { 
     279               $contents[] = $v; 
     280          } 
     281     } 
     282} 
     283$_ctx->dashboard_contents = $contents; 
     284 
     285# Blog status message 
    205286if ($core->blog->status == 0) { 
    206      echo '<p class="static-msg">'.__('This blog is offline').'</p>'; 
     287     $_ctx->addMessageStatic(__('This blog is offline')); 
    207288} elseif ($core->blog->status == -1) { 
    208      echo '<p class="static-msg">'.__('This blog is removed').'</p>'; 
    209 } 
    210  
     289     $_ctx->addMessageStatic(__('This blog is removed')); 
     290} 
     291 
     292# Config errors messages 
    211293if (!defined('DC_ADMIN_URL') || !DC_ADMIN_URL) { 
    212      echo 
    213      '<p class="static-msg">'. 
    214      sprintf(__('%s is not defined, you should edit your configuration file.'),'DC_ADMIN_URL'). 
    215      ' '.__('See <a href="http://dotclear.org/documentation/2.0/admin/config">documentation</a> for more information.'). 
    216      '</p>'; 
    217 } 
    218  
     294     $_ctx->addMessageStatic( 
     295          sprintf(__('%s is not defined, you should edit your configuration file.'),'DC_ADMIN_URL').' '. 
     296          __('See <a href="http://dotclear.org/documentation/2.0/admin/config">documentation</a> for more information.') 
     297     ); 
     298} 
    219299if (!defined('DC_ADMIN_MAILFROM') || !DC_ADMIN_MAILFROM) { 
    220      echo 
    221      '<p class="static-msg">'. 
    222      sprintf(__('%s is not defined, you should edit your configuration file.'),'DC_ADMIN_MAILFROM'). 
    223      ' '.__('See <a href="http://dotclear.org/documentation/2.0/admin/config">documentation</a> for more information.'). 
    224      '</p>'; 
    225 } 
    226  
    227 # Plugins install messages 
    228 if (!empty($plugins_install['success'])) 
    229 { 
    230      echo '<div class="static-msg">'.__('Following plugins have been installed:').'<ul>'; 
    231      foreach ($plugins_install['success'] as $k => $v) { 
    232           echo '<li>'.$k.'</li>'; 
    233      } 
    234      echo '</ul></div>'; 
    235 } 
    236 if (!empty($plugins_install['failure'])) 
    237 { 
    238      echo '<div class="error">'.__('Following plugins have not been installed:').'<ul>'; 
    239      foreach ($plugins_install['failure'] as $k => $v) { 
    240           echo '<li>'.$k.' ('.$v.')</li>'; 
    241      } 
    242      echo '</ul></div>'; 
    243 } 
    244  
    245 # Dashboard columns (processed first, as we need to know the result before displaying the icons.) 
    246 $dashboardItems = ''; 
    247  
    248 # Dotclear updates notifications 
    249 if ($core->auth->isSuperAdmin() && is_readable(DC_DIGESTS)) 
    250 { 
    251      $updater = new dcUpdate(DC_UPDATE_URL,'dotclear',DC_UPDATE_VERSION,DC_TPL_CACHE.'/versions'); 
    252      $new_v = $updater->check(DC_VERSION); 
    253      $version_info = $new_v ? $updater->getInfoURL() : ''; 
    254       
    255      if ($updater->getNotify() && $new_v) { 
    256           $dashboardItems .= 
    257           '<div id="upg-notify" class="static-msg"><p>'.sprintf(__('Dotclear %s is available!'),$new_v).'</p> '. 
    258           '<ul><li><strong><a href="update.php">'.sprintf(__('Upgrade now'),$new_v).'</a></strong>'. 
    259           '</li><li><a href="update.php?hide_msg=1">'.__('Remind me later').'</a>'. 
    260           ($version_info ? ' </li><li><a href="'.$version_info.'">'.__('information about this version').'</a>' : ''). 
    261           '</li></ul></div>'; 
    262      } 
    263 } 
    264  
    265 # Errors modules notifications 
    266 if ($core->auth->isSuperAdmin()) 
    267 { 
    268      $list = array(); 
    269      foreach ($core->plugins->getErrors() as $k => $error) { 
    270           $list[] = '<li>'.$error.'</li>'; 
    271      } 
    272       
    273      if (count($list) > 0) { 
    274           $dashboardItems .= 
    275           '<div id="module-errors" class="error"><p>'.__('Some plugins are installed twice:').'</p> '. 
    276           '<ul>'.implode("\n",$list).'</ul></div>'; 
    277      } 
    278       
    279 } 
    280  
    281 foreach ($__dashboard_items as $i) 
    282 {     
    283      if ($i->count() > 0) 
    284      { 
    285           $dashboardItems .= '<div>'; 
    286           foreach ($i as $v) { 
    287                $dashboardItems .= $v; 
    288           } 
    289           $dashboardItems .= '</div>'; 
    290      } 
    291 } 
    292  
    293 # Dashboard icons 
    294 echo '<div id="dashboard-main"'.($dashboardItems ? '' : ' class="fullwidth"').'><div id="icons">'; 
    295 foreach ($__dashboard_icons as $i) 
    296 { 
    297      echo 
    298      '<p><a href="'.$i[1].'"><img src="'.dc_admin_icon_url($i[2]).'" alt="" />'. 
    299      '<br /><span>'.$i[0].'</span></a></p>'; 
    300 } 
    301 echo '</div>'; 
    302  
    303 if ($core->auth->user_prefs->dashboard->quickentry) { 
    304      if ($core->auth->check('usage,contentadmin',$core->blog->id)) 
    305      { 
    306           $categories_combo = array('&nbsp;' => ''); 
    307           try { 
    308                $categories = $core->blog->getCategories(array('post_type'=>'post')); 
    309                while ($categories->fetch()) { 
    310                     $categories_combo[] = new formSelectOption( 
    311                          str_repeat('&nbsp;&nbsp;',$categories->level-1). 
    312                          ($categories->level-1 == 0 ? '' : '&bull; ').html::escapeHTML($categories->cat_title), 
    313                          $categories->cat_id 
    314                     ); 
    315                } 
    316           } catch (Exception $e) { } 
    317       
    318           echo 
    319           '<div id="quick">'. 
    320           '<h3>'.__('Quick entry').'</h3>'. 
    321           '<form id="quick-entry" action="post.php" method="post">'. 
    322           '<fieldset><legend>'.__('New entry').'</legend>'. 
    323           '<p class="col"><label for="post_title" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Title:'). 
    324           form::field('post_title',20,255,'','maximal'). 
    325           '</label></p>'. 
    326           '<p class="area"><label class="required" '. 
    327           'for="post_content"><abbr title="'.__('Required field').'">*</abbr> '.__('Content:').'</label> '. 
    328           form::textarea('post_content',50,7). 
    329           '</p>'. 
    330           '<p><label for="cat_id" class="classic">'.__('Category:').' '. 
    331           form::combo('cat_id',$categories_combo).'</label></p>'. 
    332           '<p><input type="submit" value="'.__('Save').'" name="save" /> '. 
    333           ($core->auth->check('publish',$core->blog->id) 
    334                ? '<input type="hidden" value="'.__('Save and publish').'" name="save-publish" />' 
    335                : ''). 
    336           $core->formNonce(). 
    337           form::hidden('post_status',-2). 
    338           form::hidden('post_format',$core->auth->getOption('post_format')). 
    339           form::hidden('post_excerpt',''). 
    340           form::hidden('post_lang',$core->auth->getInfo('user_lang')). 
    341           form::hidden('post_notes',''). 
    342           '</p>'. 
    343           '</fieldset>'. 
    344           '</form>'. 
    345           '</div>'; 
    346      } 
    347 } 
    348  
    349 foreach ($__dashboard_contents as $i) 
    350 {     
    351      if ($i->count() > 0) 
    352      { 
    353           $dashboardContents .= '<div>'; 
    354           foreach ($i as $v) { 
    355                $dashboardContents .= $v; 
    356           } 
    357           $dashboardContents .= '</div>'; 
    358      } 
    359 } 
    360 echo ($dashboardContents ? '<div id="dashboard-contents">'.$dashboardContents.'</div>' : ''); 
    361  
    362 echo '</div>'; 
    363  
    364 echo ($dashboardItems ? '<div id="dashboard-items">'.$dashboardItems.'</div>' : ''); 
    365  
    366 dcPage::close(); 
     300     $_ctx->addMessageStatic( 
     301          sprintf(__('%s is not defined, you should edit your configuration file.'),'DC_ADMIN_MAILFROM').' '. 
     302          __('See <a href="http://dotclear.org/documentation/2.0/admin/config">documentation</a> for more information.') 
     303     ); 
     304} 
     305 
     306$_ctx->fillPageTitle(__('Dashboard')); 
     307$core->tpl->display('index.html.twig'); 
    367308?> 
  • admin/plugin.php

    r1179 r1315  
    44# This file is part of Dotclear 2. 
    55# 
    6 # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear 
     6# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear 
    77# Licensed under the GPL version 2.0 license. 
    88# See LICENSE file or 
     
    1515dcPage::check('usage,contentadmin'); 
    1616 
     17$has_content = false; 
    1718$p_file = ''; 
    1819$p = !empty($_REQUEST['p']) ? $_REQUEST['p'] : null; 
    19 $popup = (integer) !empty($_REQUEST['popup']); 
    20  
    21 if ($popup) { 
    22      $open_f = array('dcPage','openPopup'); 
    23      $close_f = array('dcPage','closePopup'); 
    24 } else { 
    25      $open_f = array('dcPage','open'); 
    26      $close_f = array('dcPage','close'); 
    27 } 
     20$popup = $_ctx->popup = (integer) !empty($_REQUEST['popup']); 
    2821 
    2922if ($core->plugins->moduleExists($p)) { 
    3023     $p_file = $core->plugins->moduleRoot($p).'/index.php'; 
    3124} 
     25if (file_exists($p_file)) { 
    3226 
    33 if (file_exists($p_file)) 
    34 { 
    35      # Loading plugin 
     27//* Keep this for old style plugins using dcPage 
     28     if ($popup) { 
     29          $open_f = array('dcPage','openPopup'); 
     30          $close_f = array('dcPage','closePopup'); 
     31     } else { 
     32          $open_f = array('dcPage','open'); 
     33          $close_f = array('dcPage','close'); 
     34     } 
     35      
    3636     $p_info = $core->plugins->getModules($p); 
    37       
    3837     $p_url = 'plugin.php?p='.$p; 
    39       
    40      $p_title = 'no content - plugin'; 
    41      $p_head = ''; 
    42      $p_content = '<p>'.__('No content found on this plugin.').'</p>'; 
    43       
     38     $p_title = $p_head = $p_content = ''; 
     39//*/  
     40     # Get page content 
    4441     ob_start(); 
    4542     include $p_file; 
    4643     $res = ob_get_contents(); 
    4744     ob_end_clean(); 
    48       
    49      if (preg_match('|<head>(.*?)</head|ms',$res,$m)) { 
    50           if (preg_match('|<title>(.*?)</title>|ms',$m[1],$mt)) { 
    51                $p_title = $mt[1]; 
    52           } 
     45 
     46     # Check context and display 
     47     if ($_ctx->hasPageTitle() && !empty($res)) { 
     48          $has_content = true; 
     49          echo $res; 
     50     } 
     51//* Keep this for old style plugins using dcPage 
     52     elseif (!$_ctx->hasPageTitle()) { 
    5353           
    54           if (preg_match_all('|(<script.*?>.*?</script>)|ms',$m[1],$ms)) { 
    55                foreach ($ms[1] as $v) { 
    56                     $p_head .= $v."\n"; 
     54          if (preg_match('|<head>(.*?)</head|ms',$res,$m)) { 
     55               if (preg_match('|<title>(.*?)</title>|ms',$m[1],$mt)) { 
     56                    $p_title = $mt[1]; 
     57               } 
     58                
     59               if (preg_match_all('|(<script.*?>.*?</script>)|ms',$m[1],$ms)) { 
     60                    foreach ($ms[1] as $v) { 
     61                         $p_head .= $v."\n"; 
     62                    } 
     63               } 
     64                
     65               if (preg_match_all('|(<style.*?>.*?</style>)|ms',$m[1],$ms)) { 
     66                    foreach ($ms[1] as $v) { 
     67                         $p_head .= $v."\n"; 
     68                    } 
     69               } 
     70                
     71               if (preg_match_all('|(<link.*?/>)|ms',$m[1],$ms)) { 
     72                    foreach ($ms[1] as $v) { 
     73                         $p_head .= $v."\n"; 
     74                    } 
    5775               } 
    5876          } 
    5977           
    60           if (preg_match_all('|(<style.*?>.*?</style>)|ms',$m[1],$ms)) { 
    61                foreach ($ms[1] as $v) { 
    62                     $p_head .= $v."\n"; 
    63                } 
    64           } 
    65            
    66           if (preg_match_all('|(<link.*?/>)|ms',$m[1],$ms)) { 
    67                foreach ($ms[1] as $v) { 
    68                     $p_head .= $v."\n"; 
    69                } 
     78          if (preg_match('|<body.*?>(.+)</body>|ms',$res,$m)) { 
     79               $p_content = $m[1]; 
     80                
     81               call_user_func($open_f,$p_title,$p_head); 
     82               echo $p_content; 
     83               call_user_func($close_f); 
     84                
     85               $has_content = true; 
    7086          } 
    7187     } 
    72       
    73      if (preg_match('|<body.*?>(.+)</body>|ms',$res,$m)) { 
    74           $p_content = $m[1]; 
    75      } 
    76       
    77      call_user_func($open_f,$p_title,$p_head); 
    78      echo $p_content; 
    79      call_user_func($close_f); 
     88//*/ 
    8089} 
    81 else 
    82 { 
    83      call_user_func($open_f,__('Plugin not found')); 
    84       
    85      echo '<h2 class="page-title">'.__('Plugin not found').'</h2>'; 
    86       
    87      echo '<p>'.__('The plugin you reached does not exist or does not have an admin page.').'</p>'; 
    88       
    89      call_user_func($close_f); 
     90# No plugin or content found 
     91if (!$has_content) { 
     92     $_ctx->fillPageTitle(__('Plugin not found')); 
     93     $_ctx->addError(__('The plugin you reached does not exist or does not have an admin page.')); 
     94     $core->tpl->display('plugin.html.twig'); 
    9095} 
    9196?> 
  • admin/post.php

    r1312 r1315  
    44# This file is part of Dotclear 2. 
    55# 
    6 # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear 
     6# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear 
    77# Licensed under the GPL version 2.0 license. 
    88# See LICENSE file or 
     
    1515dcPage::check('usage,contentadmin'); 
    1616 
    17 $post_id = ''; 
    18 $cat_id = ''; 
    19 $post_dt = ''; 
    20 $post_format = $core->auth->getOption('post_format'); 
    21 $post_password = ''; 
    22 $post_url = ''; 
    23 $post_lang = $core->auth->getInfo('user_lang'); 
    24 $post_title = ''; 
    25 $post_excerpt = ''; 
    26 $post_excerpt_xhtml = ''; 
    27 $post_content = ''; 
    28 $post_content_xhtml = ''; 
    29 $post_notes = ''; 
    30 $post_status = $core->auth->getInfo('user_post_status'); 
    31 $post_selected = false; 
    32 $post_open_comment = $core->blog->settings->system->allow_comments; 
    33 $post_open_tb = $core->blog->settings->system->allow_trackbacks; 
     17function savePost($form) { 
     18     global $_ctx; 
     19     $_ctx->setAlert('save'); 
     20 
     21} 
     22 
     23function deletePost($form) { 
     24     print_r($form); exit; 
     25} 
    3426 
    3527$page_title = __('New entry'); 
     
    4739# If user can't publish 
    4840if (!$can_publish) { 
    49      $post_status = -2; 
     41     $form->post_status = -2; 
    5042} 
    5143 
     
    5547     $categories = $core->blog->getCategories(array('post_type'=>'post')); 
    5648     while ($categories->fetch()) { 
    57           $categories_combo[] = new formSelectOption( 
    58                str_repeat('&nbsp;&nbsp;',$categories->level-1).($categories->level-1 == 0 ? '' : '&bull; ').html::escapeHTML($categories->cat_title), 
    59                $categories->cat_id 
    60           ); 
     49          $categories_combo[$categories->cat_id] =  
     50               str_repeat('&nbsp;&nbsp;',$categories->level-1). 
     51               ($categories->level-1 == 0 ? '' : '&bull; '). 
     52               html::escapeHTML($categories->cat_title); 
    6153     } 
    6254} catch (Exception $e) { } 
     
    6456# Status combo 
    6557foreach ($core->blog->getAllPostStatus() as $k => $v) { 
    66      $status_combo[$v] = (string) $k; 
     58     $status_combo[$k] = $v; 
    6759} 
    68 $img_status_pattern = '<img class="img_select_option" alt="%1$s" title="%1$s" src="images/%2$s" />'; 
    6960 
    7061# Formaters combo 
     
    8879unset($rs); 
    8980 
    90 # Validation flag 
    91 $bad_dt = false; 
    92  
     81$form = new dcForm($core,'post','post.php'); 
     82$form 
     83     ->addField( 
     84          new dcFieldText('post_title','', array( 
     85               'size'         => 20, 
     86               'required'     => true, 
     87               'label'        => __('Title')))) 
     88     ->addField( 
     89          new dcFieldTextArea('post_excerpt','', array( 
     90               'cols'         => 50, 
     91               'rows'         => 5, 
     92               'label'        => __("Excerpt:")))) 
     93     ->addField( 
     94          new dcFieldTextArea('post_content','', array( 
     95               'required'     => true, 
     96               'label'        => __("Content:")))) 
     97     ->addField( 
     98          new dcFieldTextArea('post_notes','', array( 
     99               'label'        => __("Notes")))) 
     100     ->addField( 
     101          new dcFieldSubmit('save',__('Save'),array( 
     102               'action' => 'savePost'))) 
     103     ->addField( 
     104          new dcFieldSubmit('delete',__('Delete'),array( 
     105               'action' => 'deletePost'))) 
     106     ->addField( 
     107          new dcFieldCombo('post_status',$core->auth->getInfo('user_post_status'),$status_combo,array( 
     108               'disabled' => !$can_publish, 
     109               'label' => __('Entry status:')))) 
     110     ->addField( 
     111          new dcFieldCombo('cat_id','',$categories_combo,array( 
     112               "label" => __('Category:')))) 
     113     ->addField( 
     114          new dcFieldText('post_dt','',array( 
     115               "label" => __('Published on:')))) 
     116     ->addField( 
     117          new dcFieldCombo('post_format',$core->auth->getOption('post_format'),$formaters_combo,array( 
     118               "label" => __('Text formating:')))) 
     119     ->addField( 
     120          new dcFieldCheckbox ('post_open_comment',$core->blog->settings->system->allow_comments,array( 
     121               "label" => __('Accept comments')))) 
     122     ->addField( 
     123          new dcFieldCheckbox ('post_open_tb',$core->blog->settings->system->allow_trackbacks,array( 
     124               "label" => __('Accept trackbacks')))) 
     125     ->addField( 
     126          new dcFieldCheckbox ('post_selected',false,array( 
     127               "label" => __('Selected entry')))) 
     128     ->addField( 
     129          new dcFieldCombo ('post_lang',$core->auth->getInfo('user_lang'),$lang_combo, array( 
     130               "label" => __('Entry lang:')))) 
     131     ->addField( 
     132          new dcFieldHidden ('id','')) 
     133; 
    93134# Get entry informations 
    94135if (!empty($_REQUEST['id'])) 
     
    105146     else 
    106147     { 
    107           $post_id = $post->post_id; 
    108           $cat_id = $post->cat_id; 
    109           $post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); 
    110           $post_format = $post->post_format; 
    111           $post_password = $post->post_password; 
    112           $post_url = $post->post_url; 
    113           $post_lang = $post->post_lang; 
    114           $post_title = $post->post_title; 
    115           $post_excerpt = $post->post_excerpt; 
    116           $post_excerpt_xhtml = $post->post_excerpt_xhtml; 
    117           $post_content = $post->post_content; 
    118           $post_content_xhtml = $post->post_content_xhtml; 
    119           $post_notes = $post->post_notes; 
    120           $post_status = $post->post_status; 
    121           $post_selected = (boolean) $post->post_selected; 
    122           $post_open_comment = (boolean) $post->post_open_comment; 
    123           $post_open_tb = (boolean) $post->post_open_tb; 
     148          $form->id = $post->post_id; 
     149          $form->cat_id = $post->cat_id; 
     150          $form->post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); 
     151          $form->post_format = $post->post_format; 
     152          $form->post_password = $post->post_password; 
     153          $form->post_url = $post->post_url; 
     154          $form->post_lang = $post->post_lang; 
     155          $form->post_title = $post->post_title; 
     156          $form->post_excerpt = $post->post_excerpt; 
     157          $form->post_excerpt_xhtml = $post->post_excerpt_xhtml; 
     158          $form->post_content = $post->post_content; 
     159          $form->post_content_xhtml = $post->post_content_xhtml; 
     160          $form->post_notes = $post->post_notes; 
     161          $form->post_status = $post->post_status; 
     162          $form->post_selected = (boolean) $post->post_selected; 
     163          $form->post_open_comment = (boolean) $post->post_open_comment; 
     164          $form->post_open_tb = (boolean) $post->post_open_tb; 
     165          $form->can_edit_post = $post->isEditable(); 
     166          $form->can_delete= $post->isDeletable(); 
    124167           
    125           $page_title = __('Edit entry'); 
    126            
    127           $can_edit_post = $post->isEditable(); 
    128           $can_delete= $post->isDeletable(); 
    129            
    130           $next_rs = $core->blog->getNextPost($post,1); 
    131           $prev_rs = $core->blog->getNextPost($post,-1); 
    132            
    133           if ($next_rs !== null) { 
    134                $next_link = sprintf($post_link,$next_rs->post_id, 
    135                     html::escapeHTML($next_rs->post_title),__('next entry').'&nbsp;&#187;'); 
    136                $next_headlink = sprintf($post_headlink,'next', 
    137                     html::escapeHTML($next_rs->post_title),$next_rs->post_id); 
    138           } 
    139            
    140           if ($prev_rs !== null) { 
    141                $prev_link = sprintf($post_link,$prev_rs->post_id, 
    142                     html::escapeHTML($prev_rs->post_title),'&#171;&nbsp;'.__('previous entry')); 
    143                $prev_headlink = sprintf($post_headlink,'previous', 
    144                     html::escapeHTML($prev_rs->post_title),$prev_rs->post_id); 
    145           } 
    146            
    147           try { 
    148                $core->media = new dcMedia($core); 
    149           } catch (Exception $e) {} 
    150168     } 
    151169} 
    152170 
    153 # Format excerpt and content 
    154 if (!empty($_POST) && $can_edit_post) 
    155 { 
    156      $post_format = $_POST['post_format']; 
    157      $post_excerpt = $_POST['post_excerpt']; 
    158      $post_content = $_POST['post_content']; 
    159       
    160      $post_title = $_POST['post_title']; 
    161       
    162      $cat_id = (integer) $_POST['cat_id']; 
    163       
    164      if (isset($_POST['post_status'])) { 
    165           $post_status = (integer) $_POST['post_status']; 
    166      } 
    167       
    168      if (empty($_POST['post_dt'])) { 
    169           $post_dt = ''; 
    170      } else { 
    171           try 
    172           { 
    173                $post_dt = strtotime($_POST['post_dt']); 
    174                if ($post_dt == false || $post_dt == -1) { 
    175                     $bad_dt = true; 
    176                     throw new Exception(__('Invalid publication date')); 
    177                } 
    178                $post_dt = date('Y-m-d H:i',$post_dt); 
    179           } 
    180           catch (Exception $e) 
    181           { 
    182                $core->error->add($e->getMessage()); 
    183           } 
    184      } 
    185       
    186      $post_open_comment = !empty($_POST['post_open_comment']); 
    187      $post_open_tb = !empty($_POST['post_open_tb']); 
    188      $post_selected = !empty($_POST['post_selected']); 
    189      $post_lang = $_POST['post_lang']; 
    190      $post_password = !empty($_POST['post_password']) ? $_POST['post_password'] : null; 
    191       
    192      $post_notes = $_POST['post_notes']; 
    193       
    194      if (isset($_POST['post_url'])) { 
    195           $post_url = $_POST['post_url']; 
    196      } 
    197       
    198      $core->blog->setPostContent( 
    199           $post_id,$post_format,$post_lang, 
    200           $post_excerpt,$post_excerpt_xhtml,$post_content,$post_content_xhtml 
    201      ); 
    202 } 
    203  
    204 # Delete post 
    205 if (!empty($_POST['delete']) && $can_delete) 
    206 { 
    207      try { 
    208           # --BEHAVIOR-- adminBeforePostDelete 
    209           $core->callBehavior('adminBeforePostDelete',$post_id); 
    210           $core->blog->delPost($post_id); 
    211           http::redirect('posts.php'); 
    212      } catch (Exception $e) { 
    213           $core->error->add($e->getMessage()); 
    214      } 
    215 } 
    216  
    217 # Create or update post 
    218 if (!empty($_POST) && !empty($_POST['save']) && $can_edit_post && !$bad_dt) 
    219 { 
    220      $cur = $core->con->openCursor($core->prefix.'post'); 
    221       
    222      $cur->post_title = $post_title; 
    223      $cur->cat_id = ($cat_id ? $cat_id : null); 
    224      $cur->post_dt = $post_dt ? date('Y-m-d H:i:00',strtotime($post_dt)) : ''; 
    225      $cur->post_format = $post_format; 
    226      $cur->post_password = $post_password; 
    227      $cur->post_lang = $post_lang; 
    228      $cur->post_title = $post_title; 
    229      $cur->post_excerpt = $post_excerpt; 
    230      $cur->post_excerpt_xhtml = $post_excerpt_xhtml; 
    231      $cur->post_content = $post_content; 
    232      $cur->post_content_xhtml = $post_content_xhtml; 
    233      $cur->post_notes = $post_notes; 
    234      $cur->post_status = $post_status; 
    235      $cur->post_selected = (integer) $post_selected; 
    236      $cur->post_open_comment = (integer) $post_open_comment; 
    237      $cur->post_open_tb = (integer) $post_open_tb; 
    238       
    239      if (isset($_POST['post_url'])) { 
    240           $cur->post_url = $post_url; 
    241      } 
    242       
    243      # Update post 
    244      if ($post_id) 
    245      { 
    246           try 
    247           { 
    248                # --BEHAVIOR-- adminBeforePostUpdate 
    249                $core->callBehavior('adminBeforePostUpdate',$cur,$post_id); 
    250                 
    251                $core->blog->updPost($post_id,$cur); 
    252                 
    253                # --BEHAVIOR-- adminAfterPostUpdate 
    254                $core->callBehavior('adminAfterPostUpdate',$cur,$post_id); 
    255                 
    256                http::redirect('post.php?id='.$post_id.'&upd=1'); 
    257           } 
    258           catch (Exception $e) 
    259           { 
    260                $core->error->add($e->getMessage()); 
    261           } 
    262      } 
    263      else 
    264      { 
    265           $cur->user_id = $core->auth->userID(); 
    266            
    267           try 
    268           { 
    269                # --BEHAVIOR-- adminBeforePostCreate 
    270                $core->callBehavior('adminBeforePostCreate',$cur); 
    271                 
    272                $return_id = $core->blog->addPost($cur); 
    273                 
    274                # --BEHAVIOR-- adminAfterPostCreate 
    275                $core->callBehavior('adminAfterPostCreate',$cur,$return_id); 
    276                 
    277                http::redirect('post.php?id='.$return_id.'&crea=1'); 
    278           } 
    279           catch (Exception $e) 
    280           { 
    281                $core->error->add($e->getMessage()); 
    282           } 
    283      } 
    284 } 
     171$form->setup(); 
    285172 
    286173/* DISPLAY 
     
    294181} 
    295182 
    296 dcPage::open($page_title.' - '.__('Entries'), 
    297      dcPage::jsDatePicker(). 
    298      dcPage::jsToolBar(). 
    299      dcPage::jsModal(). 
    300      dcPage::jsMetaEditor(). 
    301      dcPage::jsLoad('js/_post.js'). 
    302      dcPage::jsConfirmClose('entry-form','comment-form'). 
    303      # --BEHAVIOR-- adminPostHeaders 
    304      $core->callBehavior('adminPostHeaders'). 
    305      dcPage::jsPageTabs($default_tab). 
    306      $next_headlink."\n".$prev_headlink 
    307 ); 
     183$_ctx 
     184     ->fillPageTitle(__('Entries'),'posts.php') 
     185     ->fillPageTitle($page_title) 
     186     ->default_tab = $default_tab; 
    308187 
    309 if (!empty($_GET['upd'])) { 
    310      dcPage::message(__('Entry has been successfully updated.')); 
    311 } 
    312 elseif (!empty($_GET['crea'])) { 
    313      dcPage::message(__('Entry has been successfully created.')); 
    314 } 
    315 elseif (!empty($_GET['attached'])) { 
    316      dcPage::message(__('File has been successfully attached.')); 
    317 } 
    318 elseif (!empty($_GET['rmattach'])) { 
    319      dcPage::message(__('Attachment has been successfully removed.')); 
    320 } 
    321  
    322 if (!empty($_GET['creaco'])) { 
    323      dcPage::message(__('Comment has been successfully created.')); 
    324 } 
    325  
    326 # XHTML conversion 
    327 if (!empty($_GET['xconv'])) 
    328 { 
    329      $post_excerpt = $post_excerpt_xhtml; 
    330      $post_content = $post_content_xhtml; 
    331      $post_format = 'xhtml'; 
    332       
    333      dcPage::message(__('Don\'t forget to validate your XHTML conversion by saving your post.')); 
    334 } 
    335  
    336 echo '<h2>'.html::escapeHTML($core->blog->name).' &rsaquo; '.'<a href="posts.php">'.__('Entries').'</a> &rsaquo; <span class="page-title">'; 
    337 if ($post_id) { 
    338      switch ($post_status) { 
    339           case 1: 
    340                $img_status = sprintf($img_status_pattern,__('published'),'check-on.png'); 
    341                break; 
    342           case 0: 
    343                $img_status = sprintf($img_status_pattern,__('unpublished'),'check-off.png'); 
    344                break; 
    345           case -1: 
    346                $img_status = sprintf($img_status_pattern,__('scheduled'),'scheduled.png'); 
    347                break; 
    348           case -2: 
    349                $img_status = sprintf($img_status_pattern,__('pending'),'check-wrn.png'); 
    350                break; 
    351           default: 
    352                $img_status = ''; 
    353      } 
    354      $edit_entry_str = __('Edit entry &ldquo;%s&rdquo;'); 
    355      echo sprintf($edit_entry_str, html::escapeHTML($post_title)).' '.$img_status; 
    356 } else { 
    357      echo $page_title; 
    358 } 
    359 echo '</span></h2>'; 
    360  
    361 if ($post_id && $post->post_status == 1) { 
    362      echo '<p><a href="'.$post->getURL().'" onclick="window.open(this.href);return false;" title="'.$post_title.' ('.__('new window').')'.'">'.__('Go to this entry on the site').' <img src="images/outgoing-blue.png" alt="" /></a></p>'; 
    363 } 
    364 if ($post_id) 
    365 { 
    366      echo '<p>'; 
    367      if ($prev_link) { echo $prev_link; } 
    368      if ($next_link && $prev_link) { echo ' - '; } 
    369      if ($next_link) { echo $next_link; } 
    370       
    371      # --BEHAVIOR-- adminPostNavLinks 
    372      $core->callBehavior('adminPostNavLinks',isset($post) ? $post : null); 
    373       
    374      echo '</p>'; 
    375 } 
    376  
    377 # Exit if we cannot view page 
    378 if (!$can_view_page) { 
    379      dcPage::helpBlock('core_post'); 
    380      dcPage::close(); 
    381      exit; 
    382 } 
    383  
    384 /* Post form if we can edit post 
    385 -------------------------------------------------------- */ 
    386 if ($can_edit_post) 
    387 { 
    388      echo '<div class="multi-part" title="'.($post_id ? __('Edit entry') : __('New entry')).'" id="edit-entry">'; 
    389      echo '<form action="post.php" method="post" id="entry-form">'; 
    390      echo '<div id="entry-wrapper">'; 
    391      echo '<div id="entry-content"><div class="constrained">'; 
    392       
    393      echo 
    394      '<p class="col"><label class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Title:').'</label>'. 
    395      form::field('post_title',20,255,html::escapeHTML($post_title),'maximal'). 
    396      '</p>'. 
    397       
    398      '<p class="area" id="excerpt-area"><label for="post_excerpt">'.__('Excerpt:').'</label> '. 
    399      form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt)). 
    400      '</p>'. 
    401       
    402      '<p class="area"><label class="required" '. 
    403      'for="post_content"><abbr title="'.__('Required field').'">*</abbr> '.__('Content:').'</label> '. 
    404      form::textarea('post_content',50,$core->auth->getOption('edit_size'),html::escapeHTML($post_content)). 
    405      '</p>'. 
    406       
    407      '<p class="area" id="notes-area"><label for="post_notes">'.__('Personal notes:').'</label>'. 
    408      form::textarea('post_notes',50,5,html::escapeHTML($post_notes)). 
    409      '</p>'; 
    410       
    411      # --BEHAVIOR-- adminPostForm 
    412      $core->callBehavior('adminPostForm',isset($post) ? $post : null); 
    413       
    414      echo 
    415      '<p>'. 
    416      ($post_id ? form::hidden('id',$post_id) : ''). 
    417      '<input type="submit" value="'.__('Save').' (s)" '. 
    418      'accesskey="s" name="save" /> '; 
    419      if ($post_id) { 
    420           $preview_url = 
    421           $core->blog->url.$core->url->getURLFor('preview',$core->auth->userID().'/'. 
    422           http::browserUID(DC_MASTER_KEY.$core->auth->userID().$core->auth->getInfo('user_pwd')). 
    423           '/'.$post->post_url); 
    424           echo '<a id="post-preview" href="'.$preview_url.'" class="button" accesskey="p">'.__('Preview').' (p)'.'</a> '; 
    425      } else { 
    426           echo 
    427           '<a id="post-cancel" href="index.php" class="button" accesskey="c">'.__('Cancel').' (c)</a>'; 
    428      } 
    429  
    430      echo 
    431      ($can_delete ? '<input type="submit" class="delete" value="'.__('Delete').'" name="delete" />' : ''). 
    432      $core->formNonce(). 
    433      '</p>'; 
    434       
    435      echo '</div></div>';          // End #entry-content 
    436      echo '</div>';      // End #entry-wrapper 
    437  
    438      echo '<div id="entry-sidebar">'; 
    439       
    440      echo 
    441      '<p><label for="cat_id">'.__('Category:'). 
    442      form::combo('cat_id',$categories_combo,$cat_id,'maximal'). 
    443      '</label></p>'. 
    444       
    445      '<p><label for="post_status">'.__('Entry status:'). 
    446      form::combo('post_status',$status_combo,$post_status,'','',!$can_publish). 
    447      '</label></p>'. 
    448       
    449      '<p><label for="post_dt">'.__('Published on:'). 
    450      form::field('post_dt',16,16,$post_dt,($bad_dt ? 'invalid' : '')). 
    451      '</label></p>'. 
    452       
    453      '<p><label for="post_format">'.__('Text formating:'). 
    454      form::combo('post_format',$formaters_combo,$post_format). 
    455      '</label>'. 
    456      '</p>'. 
    457      '<p>'.($post_id && $post_format != 'xhtml' ? '<a id="convert-xhtml" class="button" href="post.php?id='.$post_id.'&amp;xconv=1">'.__('Convert to XHTML').'</a>' : '').'</p>'. 
    458       
    459      '<p><label for="post_open_comment" class="classic">'.form::checkbox('post_open_comment',1,$post_open_comment).' '. 
    460      __('Accept comments').'</label></p>'. 
    461      ($core->blog->settings->system->allow_comments ?  
    462           (isContributionAllowed($post_id,strtotime($post_dt),true) ?  
    463                '' : 
    464                '<p class="form-note warn">'.__('Warning: Comments are not more accepted for this entry.').'</p>') :  
    465           '<p class="form-note warn">'.__('Warning: Comments are not accepted on this blog.').'</p>'). 
    466  
    467      '<p><label for="post_open_tb" class="classic">'.form::checkbox('post_open_tb',1,$post_open_tb).' '. 
    468      __('Accept trackbacks').'</label></p>'. 
    469      ($core->blog->settings->system->allow_trackbacks ?  
    470           (isContributionAllowed($post_id,strtotime($post_dt),false) ?  
    471                '' : 
    472                '<p class="form-note warn">'.__('Warning: Trackbacks are not more accepted for this entry.').'</p>') :  
    473           '<p class="form-note warn">'.__('Warning: Trackbacks are not accepted on this blog.').'</p>'). 
    474  
    475      '<p><label for="post_selected" class="classic">'.form::checkbox('post_selected',1,$post_selected).' '. 
    476      __('Selected entry').'</label></p>'. 
    477       
    478      '<p><label for="post_lang">'.__('Entry lang:'). 
    479      form::combo('post_lang',$lang_combo,$post_lang). 
    480      '</label></p>'. 
    481       
    482      '<p><label for="post_password">'.__('Entry password:'). 
    483      form::field('post_password',10,32,html::escapeHTML($post_password),'maximal'). 
    484      '</label></p>'. 
    485       
    486      '<div class="lockable">'. 
    487      '<p><label for="post_url">'.__('Basename:'). 
    488      form::field('post_url',10,255,html::escapeHTML($post_url),'maximal'). 
    489      '</label></p>'. 
    490      '<p class="form-note warn">'. 
    491      __('Warning: If you set the URL manually, it may conflict with another entry.'). 
    492      '</p>'. 
    493      '</div>'; 
    494       
    495      # --BEHAVIOR-- adminPostFormSidebar 
    496      $core->callBehavior('adminPostFormSidebar',isset($post) ? $post : null); 
    497       
    498      echo '</div>';      // End #entry-sidebar 
    499  
    500      echo '</form>'; 
    501       
    502      # --BEHAVIOR-- adminPostForm 
    503      $core->callBehavior('adminPostAfterForm',isset($post) ? $post : null); 
    504       
    505      echo '</div>'; 
    506       
    507      if ($post_id && $post->post_status == 1) { 
    508           echo '<p><a href="trackbacks.php?id='.$post_id.'" class="multi-part">'. 
    509           __('Ping blogs').'</a></p>'; 
    510      } 
    511       
    512 } 
    513  
    514  
    515 /* Comments and trackbacks 
    516 -------------------------------------------------------- */ 
    517 if ($post_id) 
    518 { 
    519      $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 
    520       
    521      $comments = $core->blog->getComments(array_merge($params,array('comment_trackback'=>0))); 
    522      $trackbacks = $core->blog->getComments(array_merge($params,array('comment_trackback'=>1))); 
    523       
    524      # Actions combo box 
    525      $combo_action = array(); 
    526      if ($can_edit_post && $core->auth->check('publish,contentadmin',$core->blog->id)) 
    527      { 
    528           $combo_action[__('publish')] = 'publish'; 
    529           $combo_action[__('unpublish')] = 'unpublish'; 
    530           $combo_action[__('mark as pending')] = 'pending'; 
    531           $combo_action[__('mark as junk')] = 'junk'; 
    532      } 
    533       
    534      if ($can_edit_post && $core->auth->check('delete,contentadmin',$core->blog->id)) 
    535      { 
    536           $combo_action[__('Delete')] = 'delete'; 
    537      } 
    538       
    539      # --BEHAVIOR-- adminCommentsActionsCombo 
    540      $core->callBehavior('adminCommentsActionsCombo',array(&$combo_action)); 
    541       
    542      $has_action = !empty($combo_action) && (!$trackbacks->isEmpty() || !$comments->isEmpty()); 
    543       
    544      echo 
    545      '<div id="comments" class="multi-part" title="'.__('Comments').'">'; 
    546       
    547      if ($has_action) { 
    548           echo '<form action="comments_actions.php" id="form-comments" method="post">'; 
    549      } 
    550       
    551      echo '<h3>'.__('Trackbacks').'</h3>'; 
    552       
    553      if (!$trackbacks->isEmpty()) { 
    554           showComments($trackbacks,$has_action,true); 
    555      } else { 
    556           echo '<p>'.__('No trackback').'</p>'; 
    557      } 
    558       
    559      echo '<h3>'.__('Comments').'</h3>'; 
    560      if (!$comments->isEmpty()) { 
    561           showComments($comments,$has_action); 
    562      } else { 
    563           echo '<p>'.__('No comment').'</p>'; 
    564      } 
    565       
    566      if ($has_action) { 
    567           echo 
    568           '<div class="two-cols">'. 
    569           '<p class="col checkboxes-helpers"></p>'. 
    570            
    571           '<p class="col right"><label for="action" class="classic">'.__('Selected comments action:').'</label> '. 
    572           form::combo('action',$combo_action). 
    573           form::hidden('redir','post.php?id='.$post_id.'&amp;co=1'). 
    574           $core->formNonce(). 
    575           '<input type="submit" value="'.__('ok').'" /></p>'. 
    576           '</div>'. 
    577           '</form>'; 
    578      } 
    579       
    580      echo '</div>'; 
    581 } 
    582  
    583 /* Add a comment 
    584 -------------------------------------------------------- */ 
    585 if ($post_id) 
    586 { 
    587      echo 
    588      '<div class="multi-part" id="add-comment" title="'.__('Add a comment').'">'. 
    589      '<h3>'.__('Add a comment').'</h3>'. 
    590       
    591      '<form action="comment.php" method="post" id="comment-form">'. 
    592      '<div class="constrained">'. 
    593      '<p><label for="comment_author" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Name:'). 
    594      form::field('comment_author',30,255,html::escapeHTML($core->auth->getInfo('user_cn'))). 
    595      '</label></p>'. 
    596       
    597      '<p><label for="comment_email">'.__('Email:'). 
    598      form::field('comment_email',30,255,html::escapeHTML($core->auth->getInfo('user_email'))). 
    599      '</label></p>'. 
    600       
    601      '<p><label for="comment_site">'.__('Web site:'). 
    602      form::field('comment_site',30,255,html::escapeHTML($core->auth->getInfo('user_url'))). 
    603      '</label></p>'. 
    604       
    605      '<p class="area"><label for="comment_content" class="required"><abbr title="'.__('Required field').'">*</abbr> '. 
    606      __('Comment:').'</label> '. 
    607      form::textarea('comment_content',50,8,html::escapeHTML('')). 
    608      '</p>'. 
    609       
    610      '<p>'.form::hidden('post_id',$post_id). 
    611      $core->formNonce(). 
    612      '<input type="submit" name="add" value="'.__('Save').'" /></p>'. 
    613      '</div>'. 
    614      '</form>'. 
    615      '</div>'; 
    616 } 
    617  
    618 # Controls comments or trakbacks capabilities 
    619 function isContributionAllowed($id,$dt,$com=true) 
    620 { 
    621      global $core; 
    622  
    623      if (!$id) { 
    624           return true; 
    625      } 
    626      if ($com) { 
    627           if (($core->blog->settings->system->comments_ttl == 0) ||  
    628                (time() - $core->blog->settings->system->comments_ttl*86400 < $dt)) { 
    629                return true; 
    630           } 
    631      } else { 
    632           if (($core->blog->settings->system->trackbacks_ttl == 0) ||  
    633                (time() - $core->blog->settings->system->trackbacks_ttl*86400 < $dt)) { 
    634                return true; 
    635           } 
    636      } 
    637      return false; 
    638 } 
    639  
    640 # Show comments or trackbacks 
    641 function showComments($rs,$has_action,$tb=false) 
    642 { 
    643      echo 
    644      '<table class="comments-list"><tr>'. 
    645      '<th colspan="2">'.__('Author').'</th>'. 
    646      '<th>'.__('Date').'</th>'. 
    647      '<th class="nowrap">'.__('IP address').'</th>'. 
    648      '<th>'.__('Status').'</th>'. 
    649      '<th>&nbsp;</th>'. 
    650      '</tr>'; 
    651       
    652      while($rs->fetch()) 
    653      { 
    654           $comment_url = 'comment.php?id='.$rs->comment_id; 
    655            
    656           $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; 
    657           switch ($rs->comment_status) { 
    658                case 1: 
    659                     $img_status = sprintf($img,__('published'),'check-on.png'); 
    660                     break; 
    661                case 0: 
    662                     $img_status = sprintf($img,__('unpublished'),'check-off.png'); 
    663                     break; 
    664                case -1: 
    665                     $img_status = sprintf($img,__('pending'),'check-wrn.png'); 
    666                     break; 
    667                case -2: 
    668                     $img_status = sprintf($img,__('junk'),'junk.png'); 
    669                     break; 
    670           } 
    671            
    672           echo 
    673           '<tr class="line'.($rs->comment_status != 1 ? ' offline' : '').'"'. 
    674           ' id="c'.$rs->comment_id.'">'. 
    675            
    676           '<td class="nowrap">'. 
    677           ($has_action ? form::checkbox(array('comments[]'),$rs->comment_id,'','','',0,'title="'.($tb ? __('select this trackback') : __('select this comment')).'"') : '').'</td>'. 
    678           '<td class="maximal">'.html::escapeHTML($rs->comment_author).'</td>'. 
    679           '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$rs->comment_dt).'</td>'. 
    680           '<td class="nowrap"><a href="comments.php?ip='.$rs->comment_ip.'">'.$rs->comment_ip.'</a></td>'. 
    681           '<td class="nowrap status">'.$img_status.'</td>'. 
    682           '<td class="nowrap status"><a href="'.$comment_url.'">'. 
    683           '<img src="images/edit-mini.png" alt="" title="'.__('Edit this comment').'" /></a></td>'. 
    684            
    685           '</tr>'; 
    686      } 
    687       
    688      echo '</table>'; 
    689 } 
    690  
    691 dcPage::helpBlock('core_post','core_wiki'); 
    692 dcPage::close(); 
     188$core->tpl->display('post.html.twig'); 
    693189?> 
  • admin/posts.php

    r1179 r1315  
    44# This file is part of Dotclear 2. 
    55# 
    6 # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear 
     6# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear 
    77# Licensed under the GPL version 2.0 license. 
    88# See LICENSE file or 
     
    1212 
    1313require dirname(__FILE__).'/../inc/admin/prepend.php'; 
    14  
     14global $_ctx; 
    1515dcPage::check('usage,contentadmin'); 
    1616 
     
    4848     # Filter form we'll put in html_block 
    4949     $users_combo = $categories_combo = array(); 
    50      $users_combo['-'] = $categories_combo['-'] = ''; 
    5150     while ($users->fetch()) 
    5251     { 
     
    6160     } 
    6261      
    63      $categories_combo[__('None')] = 'NULL'; 
     62 
     63# Getting categories 
     64$categories_combo = array(); 
     65try { 
     66     $categories = $core->blog->getCategories(array('post_type'=>'post')); 
    6467     while ($categories->fetch()) { 
    65           $categories_combo[str_repeat('&nbsp;&nbsp;',$categories->level-1).($categories->level-1 == 0 ? '' : '&bull; '). 
    66                html::escapeHTML($categories->cat_title). 
    67                ' ('.$categories->nb_post.')'] = $categories->cat_id; 
     68          $categories_combo[$categories->cat_id] =  
     69               str_repeat('&nbsp;&nbsp;',$categories->level-1). 
     70               ($categories->level-1 == 0 ? '' : '&bull; '). 
     71               html::escapeHTML($categories->cat_title); 
    6872     } 
    69       
     73} catch (Exception $e) { } 
    7074     $status_combo = array( 
    71      '-' => '' 
    7275     ); 
    7376     foreach ($core->blog->getAllPostStatus() as $k => $v) { 
    74           $status_combo[$v] = (string) $k; 
     77          $status_combo[(string) $k] = (string)$v; 
    7578     } 
    7679      
    7780     $selected_combo = array( 
    78      '-' => '', 
    79      __('selected') => '1', 
    80      __('not selected') => '0' 
     81     '1' => __('is selected'), 
     82     '0' => __('is not selected') 
    8183     ); 
    8284      
    8385     # Months array 
    84      $dt_m_combo['-'] = ''; 
    8586     while ($dates->fetch()) { 
    86           $dt_m_combo[dt::str('%B %Y',$dates->ts())] = $dates->year().$dates->month(); 
     87          $dt_m_combo[$dates->year().$dates->month()] = dt::str('%B %Y',$dates->ts()); 
    8788     } 
    8889      
    89      $lang_combo['-'] = ''; 
    9090     while ($langs->fetch()) { 
    9191          $lang_combo[$langs->post_lang] = $langs->post_lang; 
    9292     } 
    93       
    94      $sortby_combo = array( 
    95      __('Date') => 'post_dt', 
    96      __('Title') => 'post_title', 
    97      __('Category') => 'cat_title', 
    98      __('Author') => 'user_id', 
    99      __('Status') => 'post_status', 
    100      __('Selected') => 'post_selected' 
    101      ); 
    102       
    103      $order_combo = array( 
    104      __('Descending') => 'desc', 
    105      __('Ascending') => 'asc' 
    106      ); 
    10793} 
     94$form = new dcForm($core,'post','post.php'); 
     95 
    10896 
    10997# Actions combo box 
     
    138126$core->callBehavior('adminPostsActionsCombo',array(&$combo_action)); 
    139127 
    140 /* Get posts 
    141 -------------------------------------------------------- */ 
    142 $user_id = !empty($_GET['user_id']) ?   $_GET['user_id'] : ''; 
    143 $cat_id = !empty($_GET['cat_id']) ?     $_GET['cat_id'] : ''; 
    144 $status = isset($_GET['status']) ? $_GET['status'] : ''; 
    145 $selected = isset($_GET['selected']) ?  $_GET['selected'] : ''; 
    146 $month = !empty($_GET['month']) ?       $_GET['month'] : ''; 
    147 $lang = !empty($_GET['lang']) ?         $_GET['lang'] : ''; 
    148 $sortby = !empty($_GET['sortby']) ?     $_GET['sortby'] : 'post_dt'; 
    149 $order = !empty($_GET['order']) ?       $_GET['order'] : 'desc'; 
    150128 
    151 $show_filters = false; 
    152129 
    153 $page = !empty($_GET['page']) ? (integer) $_GET['page'] : 1; 
    154 $nb_per_page =  30; 
    155  
    156 if (!empty($_GET['nb']) && (integer) $_GET['nb'] > 0) { 
    157      if ($nb_per_page != $_GET['nb']) { 
    158           $show_filters = true; 
     130class monthdcFilterCombo extends dcFilterCombo { 
     131     public function applyFilter($params) { 
     132          $month=$this->avalues['values'][0]; 
     133          $params['post_month'] = substr($month,4,2); 
     134          $params['post_year'] = substr($month,0,4); 
    159135     } 
    160      $nb_per_page = (integer) $_GET['nb']; 
    161136} 
    162137 
    163 $params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page); 
    164 $params['no_content'] = true; 
     138class PostsFetcher extends dcListFetcher { 
    165139 
    166 # - User filter 
    167 if ($user_id !== '' && in_array($user_id,$users_combo)) { 
    168      $params['user_id'] = $user_id; 
    169      $show_filters = true; 
    170 } else { 
    171      $user_id=''; 
    172 } 
     140     public function getEntries($params,$offset,$limit) { 
     141          $params['limit'] = array($offset,$limit); 
     142          return $this->core->blog->getPosts($params); 
     143     } 
    173144 
    174 # - Categories filter 
    175 if ($cat_id !== '' && in_array($cat_id,$categories_combo)) { 
    176      $params['cat_id'] = $cat_id; 
    177      $show_filters = true; 
    178 } else { 
    179      $cat_id=''; 
    180 } 
    181  
    182 # - Status filter 
    183 if ($status !== '' && in_array($status,$status_combo)) { 
    184      $params['post_status'] = $status; 
    185      $show_filters = true; 
    186 } else { 
    187      $status=''; 
    188 } 
    189  
    190 # - Selected filter 
    191 if ($selected !== '' && in_array($selected,$selected_combo)) { 
    192      $params['post_selected'] = $selected; 
    193      $show_filters = true; 
    194 } else { 
    195      $selected=''; 
    196 } 
    197  
    198 # - Month filter 
    199 if ($month !== '' && in_array($month,$dt_m_combo)) { 
    200      $params['post_month'] = substr($month,4,2); 
    201      $params['post_year'] = substr($month,0,4); 
    202      $show_filters = true; 
    203 } else { 
    204      $month=''; 
    205 } 
    206  
    207 # - Lang filter 
    208 if ($lang !== '' && in_array($lang,$lang_combo)) { 
    209      $params['post_lang'] = $lang; 
    210      $show_filters = true; 
    211 } else { 
    212      $lang=''; 
    213 } 
    214  
    215 # - Sortby and order filter 
    216 if ($sortby !== '' && in_array($sortby,$sortby_combo)) { 
    217      if ($order !== '' && in_array($order,$order_combo)) { 
    218           $params['order'] = $sortby.' '.$order; 
    219      } else { 
    220           $order='desc'; 
     145     public function getEntriesCount($params) { 
     146          $count = $this->core->blog->getPosts($params,true); 
     147          return $count->f(0); 
    221148     } 
    222       
    223      if ($sortby != 'post_dt' || $order != 'desc') { 
    224           $show_filters = true; 
    225      } 
    226 } else { 
    227      $sortby='post_dt'; 
    228      $order='desc'; 
    229 } 
    230  
    231 # Get posts 
    232 try { 
    233      $posts = $core->blog->getPosts($params); 
    234      $counter = $core->blog->getPosts($params,true); 
    235      $post_list = new adminPostList($core,$posts,$counter->f(0)); 
    236 } catch (Exception $e) { 
    237      $core->error->add($e->getMessage()); 
    238149} 
    239150 
    240151/* DISPLAY 
    241152-------------------------------------------------------- */ 
    242 $starting_script = dcPage::jsLoad('js/_posts_list.js'); 
    243 if (!$show_filters) { 
    244      $starting_script .= dcPage::jsLoad('js/filter-controls.js'); 
    245 } 
     153$filterSet = new dcFilterSet($core,'fposts','posts.php'); 
    246154 
    247 dcPage::open(__('Entries'),$starting_script); 
     155$filterSet 
     156     ->addFilter(new dcFilterRichCombo( 
     157          'users',__('Author'), __('Author'), 'user_id', $users_combo,array( 
     158               'multiple' => true))) 
     159     ->addFilter(new dcFilterRichCombo( 
     160          'category',__('Category'), __('Category'), 'cat_id', $categories_combo)) 
     161     ->addFilter(new dcFilterRichCombo( 
     162          'post_status',__('Status'), __('Status'), 'post_status', $status_combo)) 
     163     ->addFilter(new dcFilterRichCombo( 
     164          'lang',__('Lang'), __('Lang'), 'post_lang', $lang_combo)) 
     165     ->addFilter(new dcFilterCombo( 
     166          'selected',__('Selected'), __('The post : '),'post_selected', $selected_combo)) 
     167     ->addFilter(new monthdcFilterCombo( 
     168          'month',__('Month'),__('Month'), 'post_month', $dt_m_combo,array('singleval' => 1))) 
     169     ->addFilter(new dcFilterText( 
     170          'search',__('Contains'),__('The entry contains'), 'search',20,255)); 
    248171 
    249 if (!$core->error->flag()) 
    250 { 
    251      echo  
    252      '<h2>'.html::escapeHTML($core->blog->name).' &rsaquo; <span class="page-title">'.__('Entries').'</span></h2>'. 
    253      '<p class="top-add"><a class="button add" href="post.php">'.__('New entry').'</a></p>'; 
    254       
    255      if (!$show_filters) { 
    256           echo '<p><a id="filter-control" class="form-control" href="#">'. 
    257           __('Filters').'</a></p>'; 
    258      } 
    259       
    260      echo 
    261      '<form action="posts.php" method="get" id="filters-form">'. 
    262      '<fieldset><legend>'.__('Filters').'</legend>'. 
    263      '<div class="three-cols">'. 
    264      '<div class="col">'. 
    265      '<label for="user_id">'.__('Author:'). 
    266      form::combo('user_id',$users_combo,$user_id).'</label> '. 
    267      '<label for="cat_id">'.__('Category:'). 
    268      form::combo('cat_id',$categories_combo,$cat_id).'</label> '. 
    269      '<label for="status">'.__('Status:'). 
    270      form::combo('status',$status_combo,$status).'</label> '. 
    271      '</div>'. 
    272       
    273      '<div class="col">'. 
    274      '<label for="selected">'.__('Selected:'). 
    275      form::combo('selected',$selected_combo,$selected).'</label> '. 
    276      '<label for="month">'.__('Month:'). 
    277      form::combo('month',$dt_m_combo,$month).'</label> '. 
    278      '<label for="lang">'.__('Lang:'). 
    279      form::combo('lang',$lang_combo,$lang).'</label> '. 
    280      '</div>'. 
    281       
    282      '<div class="col">'. 
    283      '<p><label for="sortby">'.__('Order by:'). 
    284      form::combo('sortby',$sortby_combo,$sortby).'</label> '. 
    285      '<label for="order">'.__('Sort:'). 
    286      form::combo('order',$order_combo,$order).'</label></p>'. 
    287      '<p><label for="nb" class="classic">'.  form::field('nb',3,3,$nb_per_page).' '. 
    288      __('Entries per page').'</label></p> '. 
    289      '<p><input type="submit" value="'.__('Apply filters').'" /></p>'. 
    290      '</div>'. 
    291      '</div>'. 
    292      '<br class="clear" />'. //Opera sucks 
    293      '</fieldset>'. 
    294      '</form>'; 
    295       
    296      # Show posts 
    297      $post_list->display($page,$nb_per_page, 
    298      '<form action="posts_actions.php" method="post" id="form-entries">'. 
    299       
    300      '%s'. 
    301       
    302      '<div class="two-cols">'. 
    303      '<p class="col checkboxes-helpers"></p>'. 
    304       
    305      '<p class="col right"><label for="action" class="classic">'.__('Selected entries action:').'</label> '. 
    306      form::combo('action',$combo_action). 
    307      '<input type="submit" value="'.__('ok').'" /></p>'. 
    308      form::hidden(array('user_id'),$user_id). 
    309      form::hidden(array('cat_id'),$cat_id). 
    310      form::hidden(array('status'),$status). 
    311      form::hidden(array('selected'),$selected). 
    312      form::hidden(array('month'),$month). 
    313      form::hidden(array('lang'),$lang). 
    314      form::hidden(array('sortby'),$sortby). 
    315      form::hidden(array('order'),$order). 
    316      form::hidden(array('page'),$page). 
    317      form::hidden(array('nb'),$nb_per_page). 
    318      $core->formNonce(). 
    319      '</div>'. 
    320      '</form>' 
    321      ); 
    322 } 
    323172 
    324 dcPage::helpBlock('core_posts'); 
    325 dcPage::close(); 
     173$lfetcher = new PostsFetcher($core); 
     174$lposts = new dcItemList ($core,array('lposts','form-entries'),$filterSet,$lfetcher,'posts_actions.php'); 
     175$lposts->addTemplate('posts_cols.html.twig'); 
     176 
     177$lposts 
     178     ->addColumn(new dcColumn('title',__('Title'),'post_title')) 
     179     ->addColumn(new dcColumn('cat',__('Category'),'cat_title')) 
     180     ->addColumn(new dcColumn('date',__('Date'),'post_date')) 
     181     ->addColumn(new dcColumn('datetime',__('Date and Time'),'post_dt')) 
     182     ->addColumn(new dcColumn('author',__('Author'),'user_id')) 
     183     ->addColumn(new dcColumn('status',__('Status'),'post_status')); 
     184 
     185 
     186$lposts->setup(); 
     187 
     188$_ctx 
     189     ->fillPageTitle(__('Entries'),'posts.php'); 
     190 
     191 
     192$core->tpl->display('posts.html.twig'); 
     193 
     194 
    326195?> 
  • admin/style/default.css

    r1155 r1315  
    44# This file is part of Dotclear 2. 
    55# 
    6 # Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear 
     6# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear 
    77# Licensed under the GPL version 2.0 license. 
    88# See LICENSE file or 
     
    1313 
    1414/* ------------------------------------------------------------------ html */ 
     15html { 
     16     font-size: 62.5%; 
     17} 
    1518body { 
    16      font: 75%/1.5em Helvetica,Arial,sans-serif; 
     19     font: 1.2rem/1.5 Helvetica,Arial,sans-serif; 
    1720     color: #333; 
    18      background: #f5f5f5; 
    19      margin: 0; 
    20      padding: 0; 
    21 } 
    22 body.auth { 
    2321     background: #fff; 
     22     margin: 0; 
     23     padding: 0; 
    2424} 
    2525 
     
    3838h1, h2, h3, h4, h5, h6, p { 
    3939     margin-top: 0; 
    40      margin-bottom: 0.6em; 
    41 } 
    42  
     40     margin-bottom: 1rem; 
     41} 
    4342h2 { 
    4443     color: #666; 
    45      font-size: 1.4em; 
    46      padding: 4px 0; 
     44     font-size: 1.8rem; 
     45     padding: 0 0 1.8rem; 
     46     font-weight: normal; 
     47} 
     48h2 a:link, h2 a:visited { 
     49     color: #666; 
     50     border-color: #000; 
    4751} 
    4852.page-title { 
    4953     color: #d30e60; 
    5054} 
     55#content > h2 { 
     56     padding: 0 1.8rem .6rem; 
     57     margin: 0 -1.8rem 1rem; 
     58     background: #fff url(dc_bg_title.png) repeat-x center bottom; 
     59} 
    5160h3 { 
    52      color: #333; 
    53      font-size: 1.2em; 
    54 } 
    55  
     61     color: #575859; 
     62     font-size: 1.4rem; 
     63} 
    5664p, div.p { 
    5765     margin: 0 0 1em 0; 
    5866} 
    59  
    6067hr { 
    6168     height: 1px; 
    62      border-width: 1px 0 0 0; 
     69     border-width: 1px 0 0; 
    6370     border-color: #999; 
    6471     border-style: solid; 
    6572} 
    66  
    6773pre, code { 
    6874     font: 100% "Andale Mono","Courier New",monospace; 
     
    8288} 
    8389 
    84  
    8590/* LAYOUT 
    8691-------------------------------------------------------- */ 
     
    9095     height: 3em; 
    9196     position: relative; 
     97     border-bottom: 4px solid #A2CBE9; 
    9298} 
    9399#prelude { 
    94      background: #575859; 
    95      line-height: 1.5em; 
    96      margin: 0; 
    97      padding: 0 1.7em 0 1em; 
     100     line-height: 1.9; 
     101     margin: 0; 
     102     padding: 0; 
    98103     overflow: hidden; 
    99104     position: absolute; 
    100      top: 1.2em; 
     105     top: 3em; 
    101106     left: 0; 
     107     background: #A2CBE9; 
     108     width: 14.5em; 
    102109     } 
    103110#prelude li { 
    104111     list-style-type: none; 
    105      margin: 0 1em 0 0; 
     112     margin: 0; 
    106113     background:transparent; 
    107      } 
     114} 
    108115#prelude li a { 
    109      color:#fff; 
    110      } 
     116     padding-left: 1.6rem; 
     117     background: #A2CBE9; 
     118     color: #000; 
     119     border-bottom-color: #A2CBE9; 
     120} 
    111121#top { 
    112122     margin: 0; 
    113123     padding: 0; 
    114      width: 13em; 
     124     width: 14.5em; 
    115125     float: left; 
     126     line-height: 3em; 
    116127} 
    117128#top h1 { 
    118129     padding: 0; 
    119130     margin: 0; 
    120      height: 3em; 
     131     height: 3.6rem; 
    121132     text-indent: -1000px; 
    122      background: transparent url(dc_logo.png) no-repeat 0 50%; 
     133     background: #575859 url(dc_logo.png) no-repeat 0 50%; 
    123134} 
    124135#top h1 a { 
    125136     position: absolute; 
    126      top: 3px; 
     137     top: 0; 
    127138     left: 0; 
    128      width: 130px; 
    129      height: 60px; 
     139     width: 14.5em; 
     140     height: 3.6rem; 
    130141     border: none; 
    131      outline: none; 
    132142     color: #fff; 
     143} 
     144#top h1 a:hover, #top h1 a:focus { 
     145     background: transparent url(dc_logo_hover.png) no-repeat 0 50%;   
    133146} 
    134147#info-boxes { 
    135148     background: #575859; 
    136      font-size: .95em; 
    137      height: 3em; 
     149     font-size: 1em; 
     150     line-height: 3em; 
    138151} 
    139152#info-box1 { 
    140153     margin: 0; 
    141      padding: .5em 3px 4px 0; 
     154     padding: 0 3px 0 1.8rem; 
    142155     color: #fff; 
    143      float: left; 
     156     display: inline-block; 
    144157     background: #575859; 
    145158} 
    146159#info-box2 { 
    147      margin: .1em 0 0 0; 
    148      padding: .5em 1.3em 4px 0; 
     160     margin: 0; 
     161     padding: 0 1.3em 0 0; 
    149162     color: #fff; 
    150163     float: right; 
    151164     text-align: right; 
    152165     background: #575859; 
    153      height: 2em; 
    154166} 
    155167#info-box1 p { 
     
    158170} 
    159171#info-box1 select { 
    160      width: 15em; 
     172     width: 14.5em; 
    161173} 
    162174#info-box1 a img, #info-box2 a img { 
     
    164176     padding-left: .3em; 
    165177     } 
    166 #info-box1 a, #info-box2 a { 
     178#info-boxes a { 
    167179     background: #575859; 
    168180     font-weight: bold; 
     
    178190} 
    179191#info-box2 a.active { 
    180      border-bottom-color: #f5f5f5; 
     192     border-bottom-color: #fff; 
    181193     margin: 0; 
    182194     padding: 1.2em .5em; 
    183      background-color: #f5f5f5; 
     195     background-color: #fff; 
    184196     color: #333; 
    185197     font-weight: bold; 
    186198} 
    187199#info-box2 span { 
    188      color: #575859; 
    189 } 
    190 /* prelude */ 
     200     color: #999; 
     201} 
     202/* main blocks */ 
    191203#wrapper { 
    192204     width: 100%; 
     
    195207     width: 100%; 
    196208     float: right; 
    197      margin-left: -13em; 
     209     margin-left: -14.5em; 
    198210     margin-top: 0; 
     211     background: #fff url(dc_bg.png); 
    199212} 
    200213#content { 
    201      margin: 1.5em 1.5em .5em 13em; 
    202      padding: 1em; 
     214     margin: 0 0 0 14.5em; 
     215     padding: .9rem 1.8rem 1.8rem; 
    203216     background: #fff; 
    204      border-radius: .5em; 
    205      border: 1px solid #ddd; 
    206217} 
    207218     /* Micro clearfix thx to Nicolas Gallagher */ 
     
    244255/* -------------------------------------------------------------- layout - onglets */ 
    245256.part-tabs ul { 
    246      padding: .3em 0 1px 1em; 
    247      border-bottom: 1px solid #999; 
     257     padding: .5em 0 .3em 1em; 
     258     border-bottom: 1px solid #ccc; 
    248259} 
    249260.part-tabs li { 
     
    253264} 
    254265.part-tabs li a { 
    255      padding: .3em 0.5em; 
     266     padding: .5em 0.5em; 
    256267     margin-right: .5em; 
    257      border: 1px solid #999; 
     268     border: 1px solid #ccc; 
    258269     border-bottom: none; 
    259270     background: #dfdfdf; 
    260271     text-decoration: none; 
    261      border-top-left-radius: .3em; 
    262      border-top-right-radius: .3em; 
    263272     color: #000; 
     273     background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #dfdfdf), color-stop(1, #fafafa) ); 
     274     background:-moz-linear-gradient( center top, #dfdfdf 5%, #fafafa 100% ); 
     275     filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf', endColorstr='#fafafa'); 
     276     background-color:#ededed; 
    264277} 
    265278.part-tabs li.part-tabs-link a { 
     
    273286.part-tabs li.part-tabs-active a { 
    274287     background: #fff; 
    275      border-bottom: 1px solid #fff; 
    276      color: #000; 
     288     border: 1px solid #d30e60; 
     289     color: #d30e60; 
    277290     font-weight: bold; 
     291     border-bottom-color: #fff; 
    278292} 
    279293/* ------------------------------------------------------------------ main-menu */ 
    280294#main-menu { 
    281      width: 13em; 
     295     width: 14.5em; 
    282296     float: left; 
    283      margin-top: 1.2em; 
    284      margin-bottom: .5em; 
     297     margin:0; 
     298     padding-top: .5em; 
     299     padding-bottom: 1em; 
     300     background: #f7f7f7; 
    285301} 
    286302#main-menu h3 { 
    287      margin: 0 0 0.5em; 
    288      padding: .5em 0 0 .5em; 
    289      text-transform: uppercase; 
     303     margin: 0; 
     304     padding: 1.2rem 0 1rem 2.2rem; 
     305     text-indent: -1.6rem; 
    290306     color: #666; 
    291      font-size: 1.1em; 
     307     font-size: 1.4rem; 
     308} 
     309#main-menu h3 img[alt="cacher"] { 
     310     vertical-align: top; 
    292311} 
    293312#main-menu ul { 
    294      font-size: .95em; 
    295      margin: 0 0 1em 0; 
     313     margin: 0 0 1.8rem 0; 
    296314     padding: 0; 
    297315     list-style: none; 
     
    300318     display: block; 
    301319     margin: 0.5em 0 0; 
    302      padding: .2em 0 0 32px; 
     320     padding: .3rem 0 0 30px; 
    303321     background-repeat: no-repeat; 
    304      background-position: 12px .4em; 
     322     background-position: 8px .3em; 
    305323} 
    306324#main-menu a { 
    307      font-weight: bold; 
     325     color: #333; 
     326     border-bottom-color: #ccc; 
    308327} 
    309328#main-menu .active a { 
    310329     border-bottom: none; 
    311      color: #333; 
     330     color: #d30e60; 
    312331} 
    313332#main-menu .active { 
    314      background-color: #fff; 
    315      padding: .4em 0 .1em 32px; 
    316      background-position: 12px .4em; 
    317      border-top: 1px solid #ddd; 
    318      border-bottom: 1px solid #ddd; 
    319      margin-right: -1px; 
    320 } 
    321 #favorites-menu { 
    322      margin: 0 0 2em; 
     333     font-weight: bolder; 
     334} 
     335#search-menu { 
     336     padding: .3rem .4rem 0; 
     337} 
     338#search-menu p { 
     339     display: inline-block; 
     340} 
     341#search-menu #q { 
     342     width: 12rem; 
     343     border-bottom-left-radius: .6em; 
     344     border-top-left-radius: .6em; 
     345     border-color: #999; 
     346     background: transparent url(search.png) no-repeat 4px center; 
     347     text-indent: 18px; 
     348     height: 2rem; 
     349     padding: 0 2px;  
     350} 
     351#search-menu input[type="submit"] { 
     352     padding: .1rem .3rem; 
     353     background: #dfdfdf; 
     354     border-color: #999; 
     355     color: #666; 
     356     border-bottom-right-radius: .6em; 
     357     border-top-right-radius: .6em; 
     358     text-shadow: none; 
     359     height: 2.2rem; 
     360     font-size: 1rem; 
     361     margin-left: -.5em; 
     362} 
     363#search-menu input[type="submit"]:hover, 
     364#search-menu input[type="submit"]:focus { 
     365     background: #575859; 
     366     color: #fff; 
     367} 
     368#favorites-menu, #blog-menu, #system-menu, #plugins-menu { 
     369     border-bottom: 1px dashed #A2CBE9; 
    323370} 
    324371#favorites-menu h3 { 
    325      color: #333; 
    326      text-transform: none; 
     372     color: #000; 
     373     font-variant: small-caps; 
    327374} 
    328375#favorites-menu a { 
    329376     color: #333; 
    330 } 
    331 #favorites-menu .active { 
    332      background-color: transparent; 
    333      border: none; 
    334 } 
    335 #favorites-menu .active a { 
    336      font-weight: bold; 
    337      color: #666; 
    338377} 
    339378/* ------------------------------------------------------------------ footer */ 
    340379#footer { 
    341380     clear: both; 
    342      padding: .75em .75em 0 0; 
     381     padding: .6rem 1.2rem .6rem 0; 
    343382     text-align: right; 
     383     border-top: .1rem solid #ccc; 
    344384} 
    345385#footer p { 
     
    347387     padding: 0 1em; 
    348388     text-align: center; 
    349      font-size: 1.1em; 
     389     font-size: 1em; 
    350390} 
    351391#footer a { 
    352392} 
    353393#footer p span.credit { 
    354      font-size: .85em; 
     394     font-size: 1rem; 
    355395     font-weight: normal; 
    356396} 
     
    360400     width: 18em; 
    361401     margin: 1.5em auto 0; 
    362      font-size: 1.1em; 
     402     font-size: 1.4rem; 
    363403} 
    364404#login-screen h1 { 
     
    367407     height: 50px; 
    368408     margin-bottom: .5em; 
    369      margin-left: .5em; 
     409     margin-left: 0; 
    370410} 
    371411#login-screen fieldset, #login-screen .fieldset { 
    372      border: 1px solid #999; 
     412     border: 1px solid #A8DC26; 
    373413     padding: 1em 1em 0 1em; 
    374414     border-radius: 4px; 
    375415} 
     416#login-screen legend { 
     417     border: 1px solid #A8DC26; 
     418} 
    376419#login-screen input[type=text], #login-screen input[type=password], #login-screen input[type=submit] { 
    377420     width: 100%; 
    378421} 
    379422#login-screen #issue { 
    380      margin-left: 1em; 
    381      font-size: 1em; 
     423     margin-left: 1.5rem; 
     424     font-size: 1.2rem; 
    382425} 
    383426#login-screen #issue strong {font-weight: normal;} 
     
    404447     width: 210px; 
    405448     text-align: center; 
    406      margin: 2em 0 0 0; 
     449     margin: 2em 0; 
    407450     display:inline-block; 
    408451} 
     
    436479     color: #666; 
    437480} 
    438  
    439481#dashboard-items { 
    440482     float: left; 
     
    482524} 
    483525#entry-content { 
    484      margin-right: 18em; 
     526     margin-right: 19em; 
     527     margin-left: 1.2rem; 
    485528} 
    486529#entry-sidebar { 
     
    542585     height: 500px; 
    543586} 
    544  
    545587#add-file-f { 
    546588     position: relative; 
     
    626668     display: inline; 
    627669} 
    628  
    629670#default-favs h3 { 
    630671     margin-top: 2em; 
    631672     margin-bottom: 1em; 
    632673} 
    633  
    634674.fav-list { 
    635675     list-style-type: none; 
     
    785825/* ------------------------------------------------------------------ contextual help */ 
    786826#help { 
    787      margin-top: 2em; 
     827     margin-top: 4em; 
    788828     background: #f5f5f5; 
    789829     z-index: 100; 
    790830} 
    791831#help-button { 
    792      position: fixed; 
    793      top: 3.2em; 
     832     background: transparent url(../images/page_help.png) no-repeat 6px center; 
     833     position: absolute; 
     834     top: 3.6rem; 
    794835     right: 0px; 
     836     padding: 0 2rem 0 3rem; 
    795837     cursor: pointer; 
    796      background: #fc3; 
    797      border: 1px solid #dde; 
    798      border-right: none; 
    799      font-size: 1.1em; 
    800      font-weight: bold; 
    801      text-transform: capitalize; 
    802      padding: .33em .75em .33em 1em; 
    803      border-radius: 1em 0 0 1em; 
    804      color: #444; 
     838     color: #2373A8; 
     839     line-height: 4.2rem; 
     840} 
     841#help-button span { 
     842     padding: .6rem 0 .1rem 0; 
     843     border-bottom: 1px solid #2373A8; 
    805844} 
    806845.help-box { 
     
    812851} 
    813852#content.with-help #help-button { 
    814      right: 282px; 
     853     right: 28.2rem; 
     854     background-color: #f5f5f5; 
     855     position: fixed; 
     856     border-top: 2px solid #FFD478; 
     857     border-left: 2px solid #FFD478; 
     858     border-bottom: 2px solid #FFD478; 
     859     border-bottom-left-radius: 1rem; 
     860     border-top-left-radius: 1rem; 
    815861} 
    816862#content.with-help #help { 
    817863     display: block; 
    818864     position: absolute; 
    819      top: 40px; 
     865     top: 3.6rem; 
    820866     right: 0; 
    821      width: 280px; 
    822      border-left: 2px solid #fc3; 
     867     width: 28rem; 
     868     border-left: 2px solid #FFD478; 
     869     border-top: 2px solid #FFD478; 
    823870     margin-top: 0; 
    824871     padding: 10px 0 0 0; 
     
    838885/* ------------------------------------------------------------------ popups */ 
    839886body.popup #wrapper, body.popup #top { 
    840      margin-top: -1.5em; 
     887     width: 100%; 
     888     padding: 0; 
     889} 
     890body.popup #wrapper { 
    841891     float: none; 
    842 } 
    843 body.popup #top h1 { 
    844      background: transparent; 
     892     margin:0; 
     893     display: block; 
     894} 
     895body.popup h1, body.popup #top { 
     896     margin: 0; 
     897     border-bottom: 1px solid; 
     898     font-weight: normal; 
     899     color: #fff; 
     900     background: #575859; 
     901     font-size: 1.5em; 
     902     text-indent: .6rem; 
     903     line-height: 1.3em; 
    845904} 
    846905body.popup #main { 
    847      margin-left: -35px; 
    848      margin-bottom: 1em; 
     906     margin-bottom: 1em 0; 
    849907} 
    850908body.popup #content { 
    851      margin-left: 35px; 
    852      margin-left: 2em;  /* 3.2 */ 
    853 } 
    854 body.popup #footer { 
    855      display: none; /* 3.2 */ 
     909     margin: 0; 
     910     padding: .6rem 0 !important; 
     911} 
     912body.popup #content h2 { 
     913     margin: 0 0 1em; 
    856914} 
    857915body.popup #footer p { 
    858      margin-left: 35px; 
    859916     border: none; 
    860917} 
     
    868925} 
    869926p.error, p.message, p.static-msg { 
    870      padding-top: 1em; 
    871      padding-bottom: 1em; 
     927     padding-top: 1rem; 
     928     padding-bottom: 1rem; 
    872929} 
    873930div.error, p.error { 
     
    883940div.static-msg a, p.static-msg a { 
    884941     color: #fff; 
     942} 
     943#content > .message, #content > .error { 
     944     margin-right: 14em 
     945} 
     946/* ------------------------------------------------------------------ navigation */ 
     947.anchor-nav { 
     948     background: #575859; 
     949     color: #fff; 
     950     padding: .4rem 1.2rem; 
     951     float: right; 
    885952} 
    886953/* ------------------------------------------------------------------ debug */ 
     
    924991     vertical-align: middle; 
    925992} 
    926  
    927993/* Si quelque chose a besoin d'être caché sauf pour les revues d'écran */ 
    928994.hidden { 
     
    9591025     overflow: auto; 
    9601026} 
    961  
    9621027.grid { 
    9631028     background: transparent repeat url('grid.png') 0 0; 
    9641029} 
    965  
    9661030.line p { 
    9671031     margin: 0; 
     
    9701034     color: #666; 
    9711035} 
    972  
    9731036ul.nice { 
    9741037     margin: 1em 0; 
     
    10051068-------------------------------------------------------- */ 
    10061069table { 
    1007      font-size: 1em; 
     1070     font-size: 1.2rem; 
    10081071     border-collapse: collapse; 
    10091072     margin: 0 0 1em 0; 
    10101073} 
    10111074tr.line:hover { 
    1012      background: #ddd; 
     1075     background: #f3f3f3; 
    10131076} 
    10141077caption { 
    10151078     color: #333; 
    1016      font-size: 1.2em; 
    10171079     font-weight: bold; 
    10181080     text-align: left; 
    10191081     margin-bottom: .5em; 
    10201082} 
     1083 
    10211084th, td { 
    10221085     border-width: 0 0 1px 0; 
    10231086     border-style: solid; 
    1024      border-color: #ccc; 
    1025      padding: 3px 5px; 
     1087     border-color: #e3e3e3; 
     1088     padding: .4rem .5rem; 
    10261089     vertical-align: top; 
    10271090} 
    10281091th { 
    10291092     text-align: left; 
    1030      border-bottom-color: #666; 
     1093     border-bottom-color: #aaa; 
    10311094} 
    10321095.noborder td, td.noborder, .noborder th, th.noborder { 
    10331096     border-width: 0; 
    10341097} 
    1035  
    10361098table .maximal, table.maximal { 
    10371099     width: 100%; 
     
    10401102     width: 1px; 
    10411103} 
    1042  
    10431104table .nowrap { 
    10441105     white-space: nowrap; 
     
    11311192     font-weight: normal; 
    11321193} 
    1133  
    11341194input, textarea, select { 
    11351195     background: #f9f9f9; 
     
    11371197     border-width: 1px; 
    11381198     border-style: solid; 
    1139      border-color: #000 #ccc #ccc #000; 
     1199     border-color: #666 #ccc #ccc #999; 
    11401200} 
    11411201input.invalid, textarea.invalid, select.invalid { 
     
    11461206} 
    11471207input, textarea, select, option { 
    1148      font: 1em "DejaVu Sans","Lucida Grande","Lucida Sans Unicode",Arial,sans-serif; 
     1208     font: 100% "DejaVu Sans","Lucida Grande","Lucida Sans Unicode",Arial,sans-serif; 
    11491209} 
    11501210input[type=text], input[type=password], textarea { 
     
    11521212     margin-right: .3em; 
    11531213} 
    1154 input[type=checkbox], input[type=radio] { 
    1155      border: none; 
    1156 } 
    11571214textarea { 
    11581215     padding: 2px 0; 
    11591216} 
    1160  
    1161 input[type=checkbox], input[type=radio] { 
     1217input[type=checkbox], input[type=radio], input[type=file] { 
     1218     border: none; 
    11621219     margin: 0; 
    11631220     padding: 0; 
    11641221     background: transparent; 
    11651222} 
    1166  
    11671223label { 
    11681224     display: block; 
     
    12101266     resize: vertical; 
    12111267} 
    1212  
    12131268label.required { 
    12141269     font-weight: bold; 
     
    12321287     display: inline; 
    12331288     position: absolute; 
    1234      left: 15em; 
     1289     left: 14.5em; 
    12351290     top: 0; 
    12361291} 
    1237  
    12381292label .maximal, textarea.maximal, input.maximal { 
    12391293     width: 100%; 
     
    12501304     padding-left: 20px; 
    12511305} 
    1252  
    1253 a#toggle-filters { 
    1254      font-weight: bold; 
    1255      background: url(../images/plus.png) no-repeat 0 0; 
    1256      padding-left: 20px; 
    1257 } 
    1258  
    1259 a#toggle-filters.opened { 
    1260      background: url(../images/minus.png) no-repeat 0 0; 
    1261 } 
    1262  
    12631306.constrained { 
    12641307     margin: 0; 
     
    12691312 
    12701313/* --------------------------------------------------------------- buttons */ 
    1271 h2 a.button { 
    1272      color: #333; 
    1273      font-weight: normal; 
    1274      font-size: .75em; 
    1275      vertical-align: middle; 
    1276 } 
    12771314/* commun */ 
    12781315input[type=submit], 
     
    12871324     text-align: center; 
    12881325     text-decoration: none; 
    1289      padding: .1em .5em 0 .5em; 
     1326     padding: .1em .5em; 
    12901327     text-shadow: 0 1px 1px rgba(0,0,0,.3); 
    12911328     border-radius: .2em; 
     
    13691406     content: "\ab\a0"; 
    13701407} 
    1371 a.button.add { 
    1372      border-radius: .5em; 
    1373      margin-bottom: .1em;      
    1374      background: #2C8FD1 url(../images/add.png) no-repeat 6px center; 
    1375      color: #fff; 
    1376      padding: .2em 16px .2em 30px; 
    1377      border: 1px solid #2373A8; 
    1378 } 
    1379 a.button.add:hover, a.button.add:focus { 
    1380      background-color: #2373A8; 
    1381 } 
     1408.button.add { 
     1409     background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #9dce2c), color-stop(1, #8cb82b) ); 
     1410     background:-moz-linear-gradient( center top, #9dce2c 5%, #8cb82b 100% ); 
     1411     filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#9dce2c', endColorstr='#8cb82b'); 
     1412     background-color:#9dce2c; 
     1413     border:1px solid #83c41a; 
     1414     padding:.6rem 1.8rem; 
     1415     text-shadow:1px 1px 0 #689324; 
     1416     color: #000; 
     1417     text-shadow: 1px 1px 0 #BBDB58; 
     1418     font-weight: normal; 
     1419     font-size: 1.4rem; 
     1420} 
     1421.button.add:hover, .button.add:focus { 
     1422     background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #8cb82b), color-stop(1, #9dce2c) ); 
     1423     background:-moz-linear-gradient( center top, #8cb82b 5%, #9dce2c 100% ); 
     1424     filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#8cb82b', endColorstr='#9dce2c'); 
     1425     background-color:#8cb82b; 
     1426     border:1px solid #83c41a; 
     1427} 
     1428.button-add:focus { 
     1429     outline: dotted 1px; 
     1430} 
     1431.button.add:active { 
     1432     position:relative; 
     1433     top:1px; 
     1434} 
     1435 
    13821436/* jQuery Autocomplete plugin */ 
    13831437.ac_results { 
     
    14131467} 
    14141468 
    1415 form#filters {font-size: 100%; background: #f0f0f0; padding: 1em; border-radius: .5em; border: 1px solid #ddd;} 
    1416 form#filters .margintop {padding-top: 1.33em;} 
    1417 form#filters ul, form#filters p {list-style-type:none;margin: 0; padding: 0 0 .5em 0; margin-left: 1em;} 
    1418 form#filters .col30 {border-left: 1px solid #999;} 
    1419 form#filters .col30 h3 {margin-left: 1em;} 
    1420  
    1421 p.line, li.line { position: relative; padding: 3px 0 0 28px; margin: 0 0 1em 0;} 
    1422 li.line input[type=submit] {position: absolute; left:0;top:0; padding: 0 .1em; margin: 0;} 
    1423 li.line input[type=checkbox], li.line input[type=checkbox] {position: absolute; left: 0; top: .2em; padding: 0 .1em; margin: 0;} 
    1424 li.line select { margin-right: 2em;} 
    1425 li.line label { display: block; width: 8em; float: left;} 
    1426 li.line label img {margin-right: 8px;} 
    1427 li.line span.or { 
    1428      text-align: right; 
    1429      margin-left: 5em; 
    1430      font-weight: bold; 
    1431 } 
    1432 p.line label.or + select {margin-left: 2em;} 
    1433 li.line { padding: 0 0 0 20px; height: 1em;} 
    1434 li.line label {width: auto;} 
    1435  
    1436 #available_filters input[type=submit] {padding: 0 .1em; margin-left: .5em;} 
    1437  
    1438 div.pagination span, div.pagination a { 
    1439      margin-right: 1em; 
    1440 } 
     1469/* --------------------------------------------------------------------------- 
     1470     Media queries vite fait en attendant la reprise complète du layout 
     1471---------------------------------------------------------------------------- */ 
     1472@media screen and (max-width: 920px) { 
     1473     #top, #top h1 a {width: 42px !important;overflow:hidden;} 
     1474} 
     1475@media screen and (max-width: 800px) { 
     1476     #top, #info-boxes, #info-box1, #info-box2 { 
     1477          display:inline-block; 
     1478          vertical-align:middle; 
     1479          margin:0; 
     1480          padding:0; 
     1481          line-height: 3.2rem; 
     1482     } 
     1483     #info-box1 select {width: 14rem;} 
     1484     #main-menu, #main, #content, #content h2, #entry-wrapper, #entry-sidebar, #entry-content, .two-cols .col, .two-cols .col:first-child { 
     1485     display:block; 
     1486     width: 98%; 
     1487     margin:0 auto; 
     1488     padding:0; 
     1489     float:none; 
     1490     text-align: left; 
     1491     clear: both; 
     1492     } 
     1493     #content { 
     1494          width: 100%; 
     1495          padding-top: .5em; 
     1496     } 
     1497} 
     1498@media screen and (max-width: 720px) { 
     1499     .smallscreen {display: none;} 
     1500     #help-button {width:20px; overflow: hidden;} 
     1501} 
     1502@media screen and (max-width: 492px) { 
     1503     #header {min-height:3.6rem;} 
     1504     #wrapper {font-size: 1.6rem;} 
     1505     .page-title, #info-boxes, .media-item {display: inline-block;} 
     1506     div.media-list .media-item {width: 90%; float: none} 
     1507     #top h1 a, #top {height: auto;} 
     1508     #info-box1 p.nomobile, label.nomobile {display: none;} 
     1509     #help-button {height:26px; width:26px; background-color: #A2CBE9; padding: 0; margin:0;font-size: 1rem;line-height: 68px} 
     1510} 
Note: See TracChangeset for help on using the changeset viewer.

Sites map