Dotclear

Changeset 2468:d7fda5a0bd39 for admin


Ignore:
Timestamp:
10/21/13 09:08:36 (12 years ago)
Author:
Dsls
Branch:
twig
Children:
2593:6741802596a0, 2609:c26642f775e2
Parents:
2321:3ab5e6c3d301 (diff), 2466:e42d3233f080 (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 2.6

Location:
admin
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • admin/index.php

    r2313 r2468  
    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 
  • admin/index.php

    r2358 r2468  
    1515     exit; 
    1616} 
     17if (!empty($_GET['tf'])) { 
     18     define('DC_CONTEXT_ADMIN',true); 
     19     require dirname(__FILE__).'/../inc/load_theme_file.php'; 
     20     exit; 
     21} 
    1722 
    1823require dirname(__FILE__).'/../inc/admin/prepend.php'; 
     
    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} 
    59 if (!$core->auth->user_prefs->dashboard->prefExists('quickentry')) { 
    60      if (!$core->auth->user_prefs->dashboard->prefExists('quickentry',true)) { 
    61           $core->auth->user_prefs->dashboard->put('quickentry',false,'boolean','',null,true); 
    62      } 
    63      $core->auth->user_prefs->dashboard->put('quickentry',false,'boolean'); 
    64 } 
    65  
    66 // Handle folded/unfolded sections in admin from user preferences 
    67 $ws = $core->auth->user_prefs->addWorkspace('toggles'); 
    68 if (!$core->auth->user_prefs->toggles->prefExists('unfolded_sections')) { 
    69      $core->auth->user_prefs->toggles->put('unfolded_sections','','string','Folded sections in admin',null,true); 
    70 } 
    71  
    72  
    73 # Dashboard icons 
    74 $__dashboard_icons = new ArrayObject(); 
    75  
    76 $favs = $core->favs->getUserFavorites(); 
    77 $core->favs->appendDashboardIcons($__dashboard_icons); 
    78  
    79 # Check plugins and themes update from repository 
    80 function dc_check_store_update($mod, $url, $img, $icon) 
    81 { 
    82      $repo = new dcStore($mod, $url); 
    83      $upd = $repo->get(true); 
    84      if (!empty($upd)) { 
    85           $icon[0] .= '<br />'.sprintf(__('An update is available', '%s updates are available.', count($upd)),count($upd)); 
    86           $icon[1] .= '#update'; 
    87           $icon[2] = 'images/menu/'.$img.'-b-update.png'; 
    88      } 
    89 } 
    90 if (isset($__dashboard_icons['plugins'])) { 
    91      dc_check_store_update($core->plugins, $core->blog->settings->system->store_plugin_url, 'plugins', $__dashboard_icons['plugins']); 
    92 } 
    93 if (isset($__dashboard_icons['blog_theme'])) { 
    94      $themes = new dcThemes($core); 
    95      $themes->loadModules($core->blog->themes_path, null); 
    96      dc_check_store_update($themes, $core->blog->settings->system->store_theme_url, 'blog-theme', $__dashboard_icons['blog_theme']); 
    97 } 
    98  
    99 # Latest news for dashboard 
    100 $__dashboard_items = new ArrayObject(array(new ArrayObject(),new ArrayObject())); 
    101  
    102 $dashboardItem = 0; 
    103  
    104 if ($core->auth->user_prefs->dashboard->dcnews) { 
     101 
     102# Send dcnews to templates 
     103$_ctx->dashboard_dcnews = array(); 
     104if ($core->auth->user_prefs->dashboard->dcnews && !empty($__resources['rss_news'])) { 
    105105     try 
    106106     { 
    107           if (empty($__resources['rss_news'])) { 
    108                throw new Exception(); 
    109           } 
    110       
    111107          $feed_reader = new feedReader; 
    112108          $feed_reader->setCacheDir(DC_TPL_CACHE); 
     
    114110          $feed_reader->setUserAgent('Dotclear - http://www.dotclear.org/'); 
    115111          $feed = $feed_reader->parse($__resources['rss_news']); 
    116           if ($feed) 
    117           { 
    118                $latest_news = '<div class="box medium dc-box"><h3>'.__('Dotclear news').'</h3><dl id="news">'; 
     112          if ($feed) { 
     113               $items = array(); 
    119114               $i = 1; 
    120                foreach ($feed->items as $item) 
    121                { 
    122                     $dt = isset($item->link) ? '<a href="'.$item->link.'" class="outgoing" title="'.$item->title.'">'. 
    123                          $item->title.' <img src="images/outgoing-blue.png" alt="" /></a>' : $item->title; 
    124                 
    125                     if ($i < 3) { 
    126                          $latest_news .= 
    127                          '<dt>'.$dt.'</dt>'. 
    128                          '<dd><p><strong>'.dt::dt2str(__('%d %B %Y:'),$item->pubdate,'Europe/Paris').'</strong> '. 
    129                          '<em>'.text::cutString(html::clean($item->content),120).'...</em></p></dd>'; 
    130                     } else { 
    131                          $latest_news .= 
    132                          '<dt>'.$dt.'</dt>'. 
    133                          '<dd>'.dt::dt2str(__('%d %B %Y:'),$item->pubdate,'Europe/Paris').'</dd>'; 
    134                     } 
     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                    ); 
    135122                    $i++; 
    136                     if ($i > 2) { break; } 
     123                    if ($i > 3) { break; } 
    137124               } 
    138                $latest_news .= '</dl></div>'; 
    139                $__dashboard_items[$dashboardItem][] = $latest_news; 
    140                $dashboardItem++; 
     125               $_ctx->dashboard_dcnews = $items; 
    141126          } 
    142127     } 
     
    144129} 
    145130 
    146 # Documentation links 
    147 if ($core->auth->user_prefs->dashboard->doclinks) { 
    148      if (!empty($__resources['doc'])) 
    149      { 
    150           $doc_links = '<div class="box small dc-box"><h3>'.__('Documentation and support').'</h3><ul>'; 
     131# Quick entry prefs 
     132if (!$core->auth->user_prefs->dashboard->prefExists('quickentry')) { 
     133     if (!$core->auth->user_prefs->dashboard->prefExists('quickentry',true)) { 
     134          $core->auth->user_prefs->dashboard->put('quickentry',true,'boolean','',null,true); 
     135     } 
     136     $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) { } 
    151153      
    152           foreach ($__resources['doc'] as $k => $v) { 
    153                $doc_links .= '<li><a class="outgoing" href="'.$v.'" title="'.$k.'">'.$k. 
    154                ' <img src="images/outgoing-blue.png" alt="" /></a></li>'; 
    155           } 
     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     } 
    156186      
    157           $doc_links .= '</ul></div>'; 
    158           $__dashboard_items[$dashboardItem][] = $doc_links; 
    159           $dashboardItem++; 
    160      } 
    161 } 
    162  
     187     $_ctx->dashboard_quickentry = true; 
     188} 
     189 
     190# Dashboard icons 
     191$__dashboard_icons = new ArrayObject(); 
     192 
     193# Dashboard favorites 
     194$post_count = $core->blog->getPosts(array(),true)->f(0); 
     195$str_entries = ($post_count > 1) ? __('%d entries') : __('%d entry'); 
     196 
     197$comment_count = $core->blog->getComments(array(),true)->f(0); 
     198$str_comments = ($comment_count > 1) ? __('%d comments') : __('%d comment'); 
     199 
     200$ws = $core->auth->user_prefs->addWorkspace('favorites'); 
     201$count = 0; 
     202foreach ($ws->dumpPrefs() as $k => $v) { 
     203     // User favorites only 
     204     if (!$v['global']) { 
     205          $fav = unserialize($v['value']); 
     206          if (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)) { 
     207               if (dc_valid_fav($fav['url'])) { 
     208                    $count++; 
     209                    $title = ($fav['name'] == 'posts' ? sprintf($str_entries,$post_count) :  
     210                         ($fav['name'] == 'comments' ? sprintf($str_comments,$comment_count) : $fav['title'])); 
     211                    $__dashboard_icons[$fav['name']] = new ArrayObject(array(__($title),$fav['url'],$fav['large-icon'])); 
     212 
     213                    # Let plugins set their own title for favorite on dashboard 
     214                    $core->callBehavior('adminDashboardFavsIcon',$core,$fav['name'],$__dashboard_icons[$fav['name']]); 
     215               } 
     216          } 
     217     } 
     218}     
     219if (!$count) { 
     220     // Global favorites if any 
     221     foreach ($ws->dumpPrefs() as $k => $v) { 
     222          $fav = unserialize($v['value']); 
     223          if (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)) { 
     224               if (dc_valid_fav($fav['url'])) { 
     225                    $count++; 
     226                    $title = ($fav['name'] == 'posts' ? sprintf($str_entries,$post_count) :  
     227                         ($fav['name'] == 'comments' ? sprintf($str_comments,$comment_count) : $fav['title'])); 
     228                    $__dashboard_icons[$fav['name']] = new ArrayObject(array(__($title),$fav['url'],$fav['large-icon'])); 
     229 
     230                    # Let plugins set their own title for favorite on dashboard 
     231                    $core->callBehavior('adminDashboardFavsIcon',$core,$fav['name'],$__dashboard_icons[$fav['name']]); 
     232               } 
     233          } 
     234     } 
     235} 
     236if (!$count) { 
     237     // No user or global favorites, add "user pref" and "new entry" fav 
     238     if ($core->auth->check('usage,contentadmin',$core->blog->id)) { 
     239          $__dashboard_icons['new_post'] = new ArrayObject(array(__('New entry'),'post.php','images/menu/edit-b.png')); 
     240     } 
     241     $__dashboard_icons['prefs'] = new ArrayObject(array(__('My preferences'),'preferences.php','images/menu/user-pref-b.png')); 
     242} 
     243 
     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 
     256$__dashboard_items = new ArrayObject(array(new ArrayObject,new ArrayObject)); 
    163257$core->callBehavior('adminDashboardItems', $core, $__dashboard_items); 
    164258 
     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 
    165270# Dashboard content 
    166 $dashboardContents = ''; 
    167271$__dashboard_contents = new ArrayObject(array(new ArrayObject,new ArrayObject)); 
    168272$core->callBehavior('adminDashboardContents', $core, $__dashboard_contents); 
    169273 
    170 /* DISPLAY 
    171 -------------------------------------------------------- */ 
    172 dcPage::open(__('Dashboard'), 
    173      dcPage::jsToolBar(). 
    174      dcPage::jsLoad('js/_index.js'). 
    175      # --BEHAVIOR-- adminDashboardHeaders 
    176      $core->callBehavior('adminDashboardHeaders'), 
    177      dcPage::breadcrumb( 
    178           array( 
    179           __('Dashboard').' : '.html::escapeHTML($core->blog->name) => '' 
    180           ), 
    181           array('home_link' =>false) 
    182      ) 
    183 ); 
    184  
    185 # Dotclear updates notifications 
    186 if ($core->auth->isSuperAdmin() && is_readable(DC_DIGESTS)) 
    187 { 
    188      $updater = new dcUpdate(DC_UPDATE_URL,'dotclear',DC_UPDATE_VERSION,DC_TPL_CACHE.'/versions'); 
    189      $new_v = $updater->check(DC_VERSION); 
    190      $version_info = $new_v ? $updater->getInfoURL() : ''; 
    191  
    192      if ($updater->getNotify() && $new_v) { 
    193           echo 
    194           '<div class="dc-update"><h3>'.sprintf(__('Dotclear %s is available!'),$new_v).'</h3> '. 
    195           '<p><a class="button submit" href="update.php">'.sprintf(__('Upgrade now'),$new_v).'</a> '. 
    196           '<a class="button" href="update.php?hide_msg=1">'.__('Remind me later').'</a>'. 
    197           ($version_info ? ' </p>'. 
    198           '<p class="updt-info"><a href="'.$version_info.'">'.__('Information about this version').'</a>' : '').'</p>'. 
    199           '</div>'; 
    200      } 
    201 } 
    202  
    203 if ($core->auth->getInfo('user_default_blog') != $core->blog->id && $core->auth->getBlogCount() > 1) { 
    204      echo 
    205      '<p><a href="index.php?default_blog=1" class="button">'.__('Make this blog my default blog').'</a></p>'; 
    206 } 
    207  
     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 
    208286if ($core->blog->status == 0) { 
    209      echo '<p class="static-msg">'.__('This blog is offline').'.</p>'; 
     287     $_ctx->addMessageStatic(__('This blog is offline')); 
    210288} elseif ($core->blog->status == -1) { 
    211      echo '<p class="static-msg">'.__('This blog is removed').'.</p>'; 
    212 } 
    213  
     289     $_ctx->addMessageStatic(__('This blog is removed')); 
     290} 
     291 
     292# Config errors messages 
    214293if (!defined('DC_ADMIN_URL') || !DC_ADMIN_URL) { 
    215      echo 
    216      '<p class="static-msg">'. 
    217      sprintf(__('%s is not defined, you should edit your configuration file.'),'DC_ADMIN_URL'). 
    218      ' '.__('See <a href="http://dotclear.org/documentation/2.0/admin/config">documentation</a> for more information.'). 
    219      '</p>'; 
    220 } 
    221  
     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} 
    222299if (!defined('DC_ADMIN_MAILFROM') || !DC_ADMIN_MAILFROM) { 
    223      echo 
    224      '<p class="static-msg">'. 
    225      sprintf(__('%s is not defined, you should edit your configuration file.'),'DC_ADMIN_MAILFROM'). 
    226      ' '.__('See <a href="http://dotclear.org/documentation/2.0/admin/config">documentation</a> for more information.'). 
    227      '</p>'; 
    228 } 
    229  
    230 $err = array(); 
    231  
    232 # Check cache directory 
    233 if ( $core->auth->isSuperAdmin() ) { 
    234      if (!is_dir(DC_TPL_CACHE) || !is_writable(DC_TPL_CACHE)) { 
    235           $err[] = '<p>'.__("The cache directory does not exist or is not writable. You must create this directory with sufficient rights and affect this location to \"DC_TPL_CACHE\" in inc/config.php file.").'</p>'; 
    236      } 
    237 } else { 
    238      if (!is_dir(DC_TPL_CACHE) || !is_writable(DC_TPL_CACHE)) { 
    239           $err[] = '<p>'.__("The cache directory does not exist or is not writable. You should contact your administrator.").'</p>'; 
    240      } 
    241 } 
    242  
    243 # Check public directory 
    244 if ( $core->auth->isSuperAdmin() ) { 
    245      if (!is_dir($core->blog->public_path) || !is_writable($core->blog->public_path)) { 
    246           $err[] = '<p>'.__("There is no writable directory /public/ at the location set in about:config \"public_path\". You must create this directory with sufficient rights (or change this setting).").'</p>'; 
    247      } 
    248 } else { 
    249      if (!is_dir($core->blog->public_path) || !is_writable($core->blog->public_path)) { 
    250           $err[] = '<p>'.__("There is no writable root directory for the media manager. You should contact your administrator.").'</p>'; 
    251      } 
    252 } 
    253  
    254 # Error list 
    255 if (count($err) > 0) { 
    256      echo '<div class="error"><p><strong>Erreur&nbsp;:</strong></p>'. 
    257      '<ul><li>'.implode("</li><li>",$err).'</li></ul></div>'; 
    258 } 
    259  
    260 # Plugins install messages 
    261 if (!empty($plugins_install['success'])) 
    262 { 
    263      echo '<div class="success">'.__('Following plugins have been installed:').'<ul>'; 
    264      foreach ($plugins_install['success'] as $k => $v) { 
    265           echo '<li>'.$k.'</li>'; 
    266      } 
    267      echo '</ul></div>'; 
    268 } 
    269 if (!empty($plugins_install['failure'])) 
    270 { 
    271      echo '<div class="error">'.__('Following plugins have not been installed:').'<ul>'; 
    272      foreach ($plugins_install['failure'] as $k => $v) { 
    273           echo '<li>'.$k.' ('.$v.')</li>'; 
    274      } 
    275      echo '</ul></div>'; 
    276 } 
    277 # Errors modules notifications 
    278 if ($core->auth->isSuperAdmin()) 
    279 { 
    280      $list = $core->plugins->getErrors(); 
    281      if (!empty($list)) { 
    282           echo  
    283           '<div class="error" id="module-errors" class="error"><p>'.__('Errors have occured with following plugins:').'</p> '. 
    284           '<ul><li>'.implode("</li>\n<li>", $list).'</li></ul></div>'; 
    285      } 
    286 } 
    287  
    288 # Dashboard columns (processed first, as we need to know the result before displaying the icons.) 
    289 $dashboardItems = ''; 
    290  
    291 foreach ($__dashboard_items as $i) 
    292 {     
    293      if ($i->count() > 0) 
    294      { 
    295           $dashboardItems .= ''; 
    296           foreach ($i as $v) { 
    297                $dashboardItems .= $v; 
    298           } 
    299           $dashboardItems .= ''; 
    300      } 
    301 } 
    302  
    303 # Dashboard elements 
    304 echo '<div id="dashboard-main">'; 
    305  
    306 # Dashboard icons 
    307 echo '<div id="icons">'; 
    308 foreach ($__dashboard_icons as $i) 
    309 { 
    310      echo 
    311      '<p><a href="'.$i[1].'"><img src="'.dc_admin_icon_url($i[2]).'" alt="" />'. 
    312      '<br /><span>'.$i[0].'</span></a></p>'; 
    313 } 
    314 echo '</div>'; 
    315  
    316 if ($core->auth->user_prefs->dashboard->quickentry) { 
    317      if ($core->auth->check('usage,contentadmin',$core->blog->id)) 
    318      { 
    319           # Getting categories 
    320           $categories_combo = dcAdminCombos::getCategoriesCombo( 
    321                $core->blog->getCategories(array('post_type'=>'post')) 
    322           ); 
    323       
    324           echo 
    325           '<div id="quick">'. 
    326           '<h3>'.__('Quick entry').'</h3>'. 
    327           '<form id="quick-entry" action="post.php" method="post" class="fieldset">'. 
    328           '<h4>'.__('New entry').'</h4>'. 
    329           '<p class="col"><label for="post_title" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Title:').'</label>'. 
    330           form::field('post_title',20,255,'','maximal'). 
    331           '</p>'. 
    332           '<p class="area"><label class="required" '. 
    333           'for="post_content"><abbr title="'.__('Required field').'">*</abbr> '.__('Content:').'</label> '. 
    334           form::textarea('post_content',50,10). 
    335           '</p>'. 
    336           '<p><label for="cat_id" class="classic">'.__('Category:').'</label> '. 
    337           form::combo('cat_id',$categories_combo).'</p>'. 
    338           ($core->auth->check('categories', $core->blog->id) 
    339                ? '<div>'. 
    340                '<p id="new_cat" class="q-cat">'.__('Add a new category').'</p>'. 
    341                '<p class="q-cat"><label for="new_cat_title">'.__('Title:').'</label> '. 
    342                form::field('new_cat_title',30,255,'','').'</p>'. 
    343                '<p class="q-cat"><label for="new_cat_parent">'.__('Parent:').'</label> '. 
    344                form::combo('new_cat_parent',$categories_combo,'',''). 
    345                '</p>'. 
    346                '<p class="form-note info clear">'.__('This category will be created when you will save your post.').'</p>'. 
    347                '</div>' 
    348                : ''). 
    349           '<p><input type="submit" value="'.__('Save').'" name="save" /> '. 
    350           ($core->auth->check('publish',$core->blog->id) 
    351                ? '<input type="hidden" value="'.__('Save and publish').'" name="save-publish" />' 
    352                : ''). 
    353           $core->formNonce(). 
    354           form::hidden('post_status',-2). 
    355           form::hidden('post_format',$core->auth->getOption('post_format')). 
    356           form::hidden('post_excerpt',''). 
    357           form::hidden('post_lang',$core->auth->getInfo('user_lang')). 
    358           form::hidden('post_notes',''). 
    359           '</p>'. 
    360           '</form>'. 
    361           '</div>'; 
    362      } 
    363 } 
    364  
    365 foreach ($__dashboard_contents as $i) 
    366 {     
    367      if ($i->count() > 0) 
    368      { 
    369           $dashboardContents .= ''; 
    370           foreach ($i as $v) { 
    371                $dashboardContents .= $v; 
    372           } 
    373           $dashboardContents .= ''; 
    374      } 
    375 } 
    376  
    377 if ($dashboardContents != '' || $dashboardItems != '') { 
    378      echo  
    379      '<div id="dashboard-boxes">'. 
    380      '<div class="db-items">'.$dashboardItems.$dashboardContents.'</div>'. 
    381      '</div>';       
    382 } 
    383  
    384 echo '</div>'; #end dashboard-main 
    385 dcPage::helpBlock('core_dashboard'); 
    386 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->setBreadCrumb(__('Dashboard').' : '.html::escapeHTML($core->blog->name), false); 
     307$core->tpl->display('index.html.twig'); 
    387308?> 
  • admin/post.php

    r2313 r2468  
    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 
  • admin/post.php

    r2390 r2468  
    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; 
     17class PostActions  
     18{ 
     19     public static function savePost($form) { 
     20          global $_ctx, $core; 
     21          if (!$form->can_edit_post) { 
     22               return; 
     23          } 
     24          try { 
     25               $form->check($_ctx); 
     26               $form->cat_id = (integer) $form->cat_id; 
     27      
     28               if (!empty($form->post_dt)) { 
     29                    try 
     30                    { 
     31                         $post_dt = strtotime($form->post_dt); 
     32                         if ($post_dt == false || $post_dt == -1) { 
     33                              $bad_dt = true; 
     34                              throw new Exception(__('Invalid publication date')); 
     35                         } 
     36                         $form->post_dt = date('Y-m-d H:i',$post_dt); 
     37                    } 
     38                    catch (Exception $e) 
     39                    { 
     40                         $core->error->add($e->getMessage()); 
     41                    } 
     42               } 
     43               $post_excerpt = $form->post_excerpt; 
     44               $post_content = $form->post_content; 
     45               $post_excerpt_xhtml = ''; 
     46               $post_content_xhtml = ''; 
     47               $core->blog->setPostContent( 
     48                    $form->id,$form->post_format,$form->post_lang, 
     49                    $post_excerpt,$post_excerpt_xhtml,$post_content,$post_content_xhtml 
     50               ); 
     51               $form->post_excerpt = $post_excerpt; 
     52               $form->post_content = $post_content; 
     53               $form->post_excerpt_xhtml = $post_excerpt_xhtml; 
     54               $form->post_content_xhtml = $post_content_xhtml; 
     55                
     56               $cur = $core->con->openCursor($core->prefix.'post'); 
     57      
     58               $cur->post_title = $form->post_title; 
     59               $cur->cat_id = $form->cat_id ? $form->cat_id : null; 
     60               $cur->post_dt = $form->post_dt ? date('Y-m-d H:i:00',strtotime($form->post_dt)) : ''; 
     61               $cur->post_format = $form->post_format; 
     62               $cur->post_password = $form->post_password; 
     63               $cur->post_lang = $form->post_lang; 
     64               $cur->post_title = $form->post_title; 
     65               $cur->post_excerpt = $form->post_excerpt; 
     66               $cur->post_excerpt_xhtml = $form->post_excerpt_xhtml; 
     67               $cur->post_content = $form->post_content; 
     68               $cur->post_content_xhtml = $form->post_content_xhtml; 
     69               $cur->post_notes = $form->post_notes; 
     70               $cur->post_status = $form->post_status; 
     71               $cur->post_selected = (integer) $form->post_selected; 
     72               $cur->post_open_comment = (integer) $form->post_open_comment; 
     73               $cur->post_open_tb = (integer) $form->post_open_tb; 
     74      
     75               if (!empty($form->post_url)) { 
     76                    $cur->post_url = $form->post_url; 
     77               } 
     78      
     79               # Update post 
     80               if ($form->id) 
     81               { 
     82                    # --BEHAVIOR-- adminBeforePostUpdate 
     83                    $core->callBehavior('adminBeforePostUpdate',$cur,$form->id); 
     84                     
     85                    $core->blog->updPost($form->id,$cur); 
     86                     
     87                    # --BEHAVIOR-- adminAfterPostUpdate 
     88                    $core->callBehavior('adminAfterPostUpdate',$cur,$form->id); 
     89                    http::redirect('post.php?id='.$form->id.'&upd=1'); 
     90               } 
     91               else 
     92               { 
     93                    $cur->user_id = $core->auth->userID(); 
     94                                        # --BEHAVIOR-- adminBeforePostCreate 
     95                    $core->callBehavior('adminBeforePostCreate',$cur); 
     96                     
     97                    $return_id = $core->blog->addPost($cur); 
     98                     
     99                    # --BEHAVIOR-- adminAfterPostCreate 
     100                    $core->callBehavior('adminAfterPostCreate',$cur,$return_id); 
     101                     
     102                    http::redirect('post.php?id='.$return_id.'&crea=1'); 
     103               } 
     104 
     105          } catch (Exception $e) { 
     106               $_ctx->addError($e->getMessage()); 
     107          } 
     108     } 
     109     public static function deletePost($form) { 
     110          global $core,$_ctx; 
     111          if ($form->can_delete) { 
     112               try { 
     113                    $post_id = $form->id; 
     114                    $core->callBehavior('adminBeforePostDelete',$post_id); 
     115                    $core->blog->delPost($post_id); 
     116                    http::redirect('posts.php'); 
     117                    exit; 
     118               } catch (Exception $e) { 
     119                    $_ctx->addError($e->getMessage()); 
     120               } 
     121          } 
     122     } 
     123} 
    34124 
    35125$page_title = __('New entry'); 
    36  
     126$post_id=''; 
    37127$can_view_page = true; 
    38128$can_edit_post = $core->auth->check('usage,contentadmin',$core->blog->id); 
     
    47137# If user can't publish 
    48138if (!$can_publish) { 
    49      $post_status = -2; 
     139     $form->post_status = -2; 
    50140} 
    51141 
    52142# Getting categories 
    53 $categories_combo = dcAdminCombos::getCategoriesCombo( 
    54      $core->blog->getCategories(array('post_type'=>'post')) 
    55 ); 
    56  
    57 $status_combo = dcAdminCombos::getPostStatusesCombo(); 
    58  
    59 $img_status_pattern = '<img class="img_select_option" alt="%1$s" title="%1$s" src="images/%2$s" />'; 
     143$categories_combo = array('&nbsp;' => ''); 
     144try { 
     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# Status combo 
     155foreach ($core->blog->getAllPostStatus() as $k => $v) { 
     156     $status_combo[$k] = $v; 
     157} 
    60158 
    61159# Formaters combo 
    62 $formaters_combo = dcAdminCombos::getFormatersCombo(); 
     160foreach ($core->getFormaters() as $v) { 
     161     $formaters_combo[$v] = $v; 
     162} 
    63163 
    64164# Languages combo 
    65165$rs = $core->blog->getLangs(array('order'=>'asc')); 
    66 $lang_combo = dcAdminCombos::getLangsCombo($rs,true); 
    67  
    68 # Validation flag 
    69 $bad_dt = false; 
    70  
    71 # Trackbacks 
    72 $TB = new dcTrackback($core); 
    73 $tb_urls = $tb_excerpt = ''; 
    74  
     166$all_langs = l10n::getISOcodes(0,1); 
     167$lang_combo = array('' => '', __('Most used') => array(), __('Available') => l10n::getISOcodes(0,1)); 
     168while ($rs->fetch()) { 
     169     if (isset($all_langs[$rs->post_lang])) { 
     170          $lang_combo[__('Most used')][$rs->post_lang] = $all_langs[$rs->post_lang]; 
     171          unset($lang_combo[__('Available')][$rs->post_lang]); 
     172     } else { 
     173          $lang_combo[__('Most used')][$rs->post_lang] = $all_langs[$rs->post_lang]; 
     174     } 
     175} 
     176unset($all_langs); 
     177unset($rs); 
     178 
     179$form = new dcForm($core,'post','post.php'); 
     180$form 
     181     ->addField( 
     182          new dcFieldText('post_title','', array( 
     183               'maxlength'         => 255, 
     184               'required'     => true, 
     185               'label'        => __('Title:')))) 
     186     ->addField( 
     187          new dcFieldTextArea('post_excerpt','', array( 
     188               'cols'         => 50, 
     189               'rows'         => 5, 
     190               'label'        => __("Excerpt:").'<span class="form-note">'. 
     191               __('Add an introduction to the post.').'</span>'))) 
     192     ->addField( 
     193          new dcFieldTextArea('post_content','', array( 
     194               'required'     => true, 
     195               'label'        => __("Content:")))) 
     196     ->addField( 
     197          new dcFieldTextArea('post_notes','', array( 
     198               'label'        => __("Notes")))) 
     199     ->addField( 
     200          new dcFieldSubmit('save',__('Save'),array( 
     201               'action' => array('PostActions','savePost')))) 
     202     ->addField( 
     203          new dcFieldSubmit('delete',__('Delete'),array( 
     204               'action' => array('PostActions','deletePost')))) 
     205     ->addField( 
     206          new dcFieldCombo('post_status',$core->auth->getInfo('user_post_status'),$status_combo,array( 
     207               'disabled' => !$can_publish, 
     208               'label' => __('Entry status')))) 
     209     ->addField( 
     210          new dcFieldCombo('cat_id','',$categories_combo,array( 
     211               "label" => __('Category')))) 
     212     ->addField( 
     213          new dcFieldCombo('new_cat_parent','',$categories_combo,array( 
     214               "label" => __('Parent:')))) 
     215     ->addField( 
     216          new dcFieldText('new_cat_title','', array( 
     217               'maxlength'         => 255, 
     218               'label'        => __('Title')))) 
     219           
     220     ->addField( 
     221          new dcFieldText('post_dt','',array( 
     222               "label" => __('Publication date and hour')))) 
     223     ->addField( 
     224          new dcFieldCombo('post_format',$core->auth->getOption('post_format'),$formaters_combo,array( 
     225               "label" => __('Text formating')))) 
     226     ->addField( 
     227          new dcFieldCheckbox ('post_open_comment',$core->blog->settings->system->allow_comments,array( 
     228               "label" => __('Accept comments')))) 
     229     ->addField( 
     230          new dcFieldCheckbox ('post_open_tb',$core->blog->settings->system->allow_trackbacks,array( 
     231               "label" => __('Accept trackbacks')))) 
     232     ->addField( 
     233          new dcFieldCheckbox ('post_selected',array(1=>false),array( 
     234               "label" => __('Selected entry')))) 
     235     ->addField( 
     236          new dcFieldCombo ('post_lang',$core->auth->getInfo('user_lang'),$lang_combo, array( 
     237               "label" => __('Entry lang:')))) 
     238     ->addField( 
     239          new dcFieldText('post_password','',array( 
     240               "maxlength" => 32, 
     241               "label" => __('Entry password:')))) 
     242     ->addField( 
     243          new dcFieldText('post_url','',array( 
     244               "maxlength" => 255, 
     245               "label" => __('Basename:')))) 
     246     ->addField( 
     247          new dcFieldHidden ('id','')) 
     248; 
    75249# Get entry informations 
    76250if (!empty($_REQUEST['id'])) 
    77251{ 
    78      $page_title = __('Edit entry'); 
    79       
    80252     $params['post_id'] = $_REQUEST['id']; 
    81253      
     
    89261     else 
    90262     { 
    91           $post_id = $post->post_id; 
    92           $cat_id = $post->cat_id; 
    93           $post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); 
    94           $post_format = $post->post_format; 
    95           $post_password = $post->post_password; 
    96           $post_url = $post->post_url; 
    97           $post_lang = $post->post_lang; 
    98           $post_title = $post->post_title; 
    99           $post_excerpt = $post->post_excerpt; 
    100           $post_excerpt_xhtml = $post->post_excerpt_xhtml; 
    101           $post_content = $post->post_content; 
    102           $post_content_xhtml = $post->post_content_xhtml; 
    103           $post_notes = $post->post_notes; 
    104           $post_status = $post->post_status; 
    105           $post_selected = (boolean) $post->post_selected; 
    106           $post_open_comment = (boolean) $post->post_open_comment; 
    107           $post_open_tb = (boolean) $post->post_open_tb; 
    108            
    109           $can_edit_post = $post->isEditable(); 
    110           $can_delete= $post->isDeletable(); 
    111            
     263          $form->id = $post_id = $post->post_id; 
     264          $form->cat_id = $post->cat_id; 
     265          $form->post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); 
     266          $form->post_format = $post->post_format; 
     267          $form->post_password = $post->post_password; 
     268          $form->post_url = $post->post_url; 
     269          $form->post_lang = $post->post_lang; 
     270          $form->post_title = $post->post_title; 
     271          $form->post_excerpt = $post->post_excerpt; 
     272          $form->post_excerpt_xhtml = $post->post_excerpt_xhtml; 
     273          $form->post_content = $post->post_content; 
     274          $form->post_content_xhtml = $post->post_content_xhtml; 
     275          $form->post_notes = $post->post_notes; 
     276          $form->post_status = $post->post_status; 
     277          $form->post_selected = (boolean) $post->post_selected; 
     278          $form->post_open_comment = (boolean) $post->post_open_comment; 
     279          $form->post_open_tb = (boolean) $post->post_open_tb; 
     280          $form->can_edit_post = $post->isEditable(); 
     281          $form->can_delete= $post->isDeletable(); 
    112282          $next_rs = $core->blog->getNextPost($post,1); 
    113283          $prev_rs = $core->blog->getNextPost($post,-1); 
    114284           
    115285          if ($next_rs !== null) { 
    116                $next_link = sprintf($post_link,$next_rs->post_id, 
    117                     html::escapeHTML($next_rs->post_title),__('Next entry').'&nbsp;&#187;'); 
    118                $next_headlink = sprintf($post_headlink,'next', 
    119                     html::escapeHTML($next_rs->post_title),$next_rs->post_id); 
    120           } 
     286               $_ctx->next_post = array('id' => $next_rs->post_id,'title' => $next_rs->post_title); 
     287          } 
     288          if ($prev_rs !== null) { 
     289               $_ctx->prev_post = array('id' => $prev_rs->post_id,'title' => $prev_rs->post_title); 
     290          } 
     291          $page_title = __('Edit entry'); 
     292 
     293     } 
     294} 
     295if ($post_id) { 
     296     $_ctx->post_id = $post->post_id; 
     297 
     298     $_ctx->preview_url = 
     299          $core->blog->url.$core->url->getURLFor('preview',$core->auth->userID().'/'. 
     300          http::browserUID(DC_MASTER_KEY.$core->auth->userID().$core->auth->getInfo('user_pwd')). 
     301          '/'.$post->post_url); 
    121302           
    122           if ($prev_rs !== null) { 
    123                $prev_link = sprintf($post_link,$prev_rs->post_id, 
    124                     html::escapeHTML($prev_rs->post_title),'&#171;&nbsp;'.__('Previous entry')); 
    125                $prev_headlink = sprintf($post_headlink,'previous', 
    126                     html::escapeHTML($prev_rs->post_title),$prev_rs->post_id); 
    127           } 
    128            
    129           try { 
    130                $core->media = new dcMedia($core); 
    131           } catch (Exception $e) { 
    132                $core->error->add($e->getMessage()); 
    133           } 
    134  
    135           # Sanitize trackbacks excerpt 
    136           $tb_excerpt = empty($_POST['tb_excerpt']) ?  
    137                $post_excerpt_xhtml.' '.$post_content_xhtml : 
    138                $_POST['tb_excerpt']; 
    139           $tb_excerpt = html::decodeEntities(html::clean($tb_excerpt)); 
    140           $tb_excerpt = text::cutString(html::escapeHTML($tb_excerpt), 255); 
    141           $tb_excerpt = preg_replace('/\s+/ms', ' ', $tb_excerpt); 
    142      } 
    143 } 
    144 if (isset($_REQUEST['section']) && $_REQUEST['section']=='trackbacks') { 
    145      $anchor = 'trackbacks'; 
    146 } else { 
    147      $anchor = 'comments'; 
    148 }     
    149  
    150 $comments_actions_page = new dcCommentsActionsPage($core,'post.php',array('id' => $post_id, '_ANCHOR'=>$anchor,'section' => $anchor)); 
    151  
    152 if ($comments_actions_page->process()) { 
    153      return; 
    154 } 
    155  
    156 # Ping blogs 
    157 if (!empty($_POST['ping'])) 
    158 { 
    159      if (!empty($_POST['tb_urls']) && $post_id && $post_status == 1 && $can_edit_post) 
    160      { 
    161           $tb_urls = $_POST['tb_urls']; 
    162           $tb_urls = str_replace("\r", '', $tb_urls); 
    163           $tb_post_title = html::escapeHTML(trim(html::clean($post_title))); 
    164            
    165           foreach (explode("\n", $tb_urls) as $tb_url) 
    166           { 
    167                try { 
    168                     $TB->ping($tb_url, $post_id, $tb_post_title, $tb_excerpt, $post_url); 
    169                } catch (Exception $e) { 
    170                     $core->error->add($e->getMessage()); 
    171                } 
    172           } 
    173            
    174           if (!$core->error->flag()) { 
    175                dcPage::addSuccessNotice(__('All pings sent.')); 
    176                http::redirect('post.php?id='.$post_id.'&tb=1'); 
    177           } 
    178      } 
    179 } 
    180  
    181 # Format excerpt and content 
    182 elseif (!empty($_POST) && $can_edit_post) 
    183 { 
    184      $post_format = $_POST['post_format']; 
    185      $post_excerpt = $_POST['post_excerpt']; 
    186      $post_content = $_POST['post_content']; 
    187       
    188      $post_title = $_POST['post_title']; 
    189       
    190      $cat_id = (integer) $_POST['cat_id']; 
    191       
    192      if (isset($_POST['post_status'])) { 
    193           $post_status = (integer) $_POST['post_status']; 
    194      } 
    195       
    196      if (empty($_POST['post_dt'])) { 
    197           $post_dt = ''; 
    198      } else { 
    199           try 
    200           { 
    201                $post_dt = strtotime($_POST['post_dt']); 
    202                if ($post_dt == false || $post_dt == -1) { 
    203                     $bad_dt = true; 
    204                     throw new Exception(__('Invalid publication date')); 
    205                } 
    206                $post_dt = date('Y-m-d H:i',$post_dt); 
    207           } 
    208           catch (Exception $e) 
    209           { 
    210                $core->error->add($e->getMessage()); 
    211           } 
    212      } 
    213       
    214      $post_open_comment = !empty($_POST['post_open_comment']); 
    215      $post_open_tb = !empty($_POST['post_open_tb']); 
    216      $post_selected = !empty($_POST['post_selected']); 
    217      $post_lang = $_POST['post_lang']; 
    218      $post_password = !empty($_POST['post_password']) ? $_POST['post_password'] : null; 
    219       
    220      $post_notes = $_POST['post_notes']; 
    221       
    222      if (isset($_POST['post_url'])) { 
    223           $post_url = $_POST['post_url']; 
    224      } 
    225       
    226      $core->blog->setPostContent( 
    227           $post_id,$post_format,$post_lang, 
    228           $post_excerpt,$post_excerpt_xhtml,$post_content,$post_content_xhtml 
    229      ); 
    230 } 
    231  
    232 # Delete post 
    233 if (!empty($_POST['delete']) && $can_delete) 
    234 { 
    235      try { 
    236           # --BEHAVIOR-- adminBeforePostDelete 
    237           $core->callBehavior('adminBeforePostDelete',$post_id); 
    238           $core->blog->delPost($post_id); 
    239           http::redirect('posts.php'); 
    240      } catch (Exception $e) { 
    241           $core->error->add($e->getMessage()); 
    242      } 
    243 } 
    244  
    245 # Create or update post 
    246 if (!empty($_POST) && !empty($_POST['save']) && $can_edit_post && !$bad_dt) 
    247 { 
    248      # Create category 
    249      if (!empty($_POST['new_cat_title']) && $core->auth->check('categories', $core->blog->id)) { 
    250       
    251           $cur_cat = $core->con->openCursor($core->prefix.'category'); 
    252           $cur_cat->cat_title = $_POST['new_cat_title']; 
    253           $cur_cat->cat_url = ''; 
    254            
    255           $parent_cat = !empty($_POST['new_cat_parent']) ? $_POST['new_cat_parent'] : ''; 
    256            
    257           # --BEHAVIOR-- adminBeforeCategoryCreate 
    258           $core->callBehavior('adminBeforeCategoryCreate', $cur_cat); 
    259            
    260           $cat_id = $core->blog->addCategory($cur_cat, (integer) $parent_cat); 
    261            
    262           # --BEHAVIOR-- adminAfterCategoryCreate 
    263           $core->callBehavior('adminAfterCategoryCreate', $cur_cat, $cat_id); 
    264      } 
    265       
    266      $cur = $core->con->openCursor($core->prefix.'post'); 
    267       
    268      $cur->post_title = $post_title; 
    269      $cur->cat_id = ($cat_id ? $cat_id : null); 
    270      $cur->post_dt = $post_dt ? date('Y-m-d H:i:00',strtotime($post_dt)) : ''; 
    271      $cur->post_format = $post_format; 
    272      $cur->post_password = $post_password; 
    273      $cur->post_lang = $post_lang; 
    274      $cur->post_title = $post_title; 
    275      $cur->post_excerpt = $post_excerpt; 
    276      $cur->post_excerpt_xhtml = $post_excerpt_xhtml; 
    277      $cur->post_content = $post_content; 
    278      $cur->post_content_xhtml = $post_content_xhtml; 
    279      $cur->post_notes = $post_notes; 
    280      $cur->post_status = $post_status; 
    281      $cur->post_selected = (integer) $post_selected; 
    282      $cur->post_open_comment = (integer) $post_open_comment; 
    283      $cur->post_open_tb = (integer) $post_open_tb; 
    284       
    285      if (isset($_POST['post_url'])) { 
    286           $cur->post_url = $post_url; 
    287      } 
    288       
    289      # Update post 
    290      if ($post_id) 
    291      { 
    292           try 
    293           { 
    294                # --BEHAVIOR-- adminBeforePostUpdate 
    295                $core->callBehavior('adminBeforePostUpdate',$cur,$post_id); 
    296                 
    297                $core->blog->updPost($post_id,$cur); 
    298                 
    299                # --BEHAVIOR-- adminAfterPostUpdate 
    300                $core->callBehavior('adminAfterPostUpdate',$cur,$post_id); 
    301                dcPage::addSuccessNotice (sprintf(__('The post "%s" has been successfully updated'),html::escapeHTML($cur->post_title))); 
    302                http::redirect('post.php?id='.$post_id); 
    303           } 
    304           catch (Exception $e) 
    305           { 
    306                $core->error->add($e->getMessage()); 
    307           } 
    308      } 
    309      else 
    310      { 
    311           $cur->user_id = $core->auth->userID(); 
    312            
    313           try 
    314           { 
    315                # --BEHAVIOR-- adminBeforePostCreate 
    316                $core->callBehavior('adminBeforePostCreate',$cur); 
    317                 
    318                $return_id = $core->blog->addPost($cur); 
    319                 
    320                # --BEHAVIOR-- adminAfterPostCreate 
    321                $core->callBehavior('adminAfterPostCreate',$cur,$return_id); 
    322  
    323                dcPage::addSuccessNotice(__('Entry has been successfully created.')); 
    324                http::redirect('post.php?id='.$return_id); 
    325           } 
    326           catch (Exception $e) 
    327           { 
    328                $core->error->add($e->getMessage()); 
    329           } 
    330      } 
    331 } 
    332  
    333 # Getting categories 
    334 $categories_combo = dcAdminCombos::getCategoriesCombo( 
    335      $core->blog->getCategories(array('post_type'=>'post')) 
    336 ); 
     303      
     304     $form_comment = new dcForm($core,'add-comment','comment.php'); 
     305     $form_comment 
     306          ->addField( 
     307               new dcFieldText('comment_author','', array( 
     308                    'maxlength'         => 255, 
     309                    'required'     => true, 
     310                    'label'        => __('Name:')))) 
     311          ->addField( 
     312               new dcFieldText('comment_email','', array( 
     313                    'maxlength'         => 255, 
     314                    'required'     => true, 
     315                    'label'        => __('Email:')))) 
     316          ->addField( 
     317               new dcFieldText('comment_site','', array( 
     318                    'maxlength'         => 255, 
     319                    'label'        => __('Web site:')))) 
     320          ->addField( 
     321               new dcFieldTextArea('comment_content','', array( 
     322                    'required'     => true, 
     323                    'label'        => __('Comment:')))) 
     324          ->addField( 
     325               new dcFieldHidden('post_id',$post_id)) 
     326          ->addField( 
     327               new dcFieldSubmit('add',__('Save'),array( 
     328                    'action' => 'addComment'))) 
     329          ; 
     330 
     331      
     332} 
     333 
     334$form->setup(); 
     335 
     336$sidebar_blocks = new ArrayObject(array( 
     337     'status-box' => array( 
     338          'title' => __('Status'), 
     339          'items' => array('post_status','post_dt','post_lang','post_format')), 
     340     'metas-box' => array( 
     341          'title' => __('Ordering'), 
     342          'items' => array('post_selected','cat_id')), 
     343     'options-box' => array( 
     344          'title' => __('Options'), 
     345          'items' => array('post_open_comment','post_open_tb','post_password','post_url')) 
     346)); 
     347 
     348$main_blocks = new ArrayObject(array( 
     349     "post_title","post_excerpt","post_content","post_notes" 
     350)); 
     351 
     352 
     353$_ctx->sidebar_blocks = $sidebar_blocks; 
     354$_ctx->main_blocks = $main_blocks; 
     355 
    337356/* DISPLAY 
    338357-------------------------------------------------------- */ 
     
    344363     $default_tab = 'comments'; 
    345364} 
    346 elseif (!empty($_GET['tb'])) { 
    347      $default_tab = 'trackbacks'; 
    348 } 
    349  
    350 if ($post_id) { 
    351      switch ($post_status) { 
    352           case 1: 
    353                $img_status = sprintf($img_status_pattern,__('Published'),'check-on.png'); 
    354                break; 
    355           case 0: 
    356                $img_status = sprintf($img_status_pattern,__('Unpublished'),'check-off.png'); 
    357                break; 
    358           case -1: 
    359                $img_status = sprintf($img_status_pattern,__('Scheduled'),'scheduled.png'); 
    360                break; 
    361           case -2: 
    362                $img_status = sprintf($img_status_pattern,__('Pending'),'check-wrn.png'); 
    363                break; 
    364           default: 
    365                $img_status = ''; 
    366      } 
    367      $edit_entry_str = __('&ldquo;%s&rdquo;'); 
    368      $page_title_edit = sprintf($edit_entry_str, html::escapeHTML($post_title)).' '.$img_status; 
    369 } else { 
    370      $img_status = ''; 
    371 } 
    372  
    373  
    374 dcPage::open($page_title.' - '.__('Entries'), 
    375      dcPage::jsDatePicker(). 
    376      dcPage::jsToolBar(). 
    377      dcPage::jsModal(). 
    378      dcPage::jsMetaEditor(). 
    379      dcPage::jsLoad('js/_post.js'). 
    380      dcPage::jsConfirmClose('entry-form','comment-form'). 
    381      # --BEHAVIOR-- adminPostHeaders 
    382      $core->callBehavior('adminPostHeaders'). 
    383      dcPage::jsPageTabs($default_tab). 
    384      $next_headlink."\n".$prev_headlink, 
    385      dcPage::breadcrumb( 
     365$page_title_edit = __('Edit entry'); 
     366$_ctx 
     367     ->setBreadCrumb( 
    386368          array( 
    387369               html::escapeHTML($core->blog->name) => '', 
    388370               __('Entries') => 'posts.php', 
    389371               ($post_id ? $page_title_edit : $page_title) => '' 
    390           )) 
    391 ); 
     372     )) 
     373     ->default_tab = $default_tab; 
     374$_ctx->post_status = $form->post_status; 
     375$_ctx->post_title = $form->post_title; 
     376if ($form->post_status == 1) { 
     377     $_ctx->post_url = $post->getURL(); 
     378} 
    392379 
    393380if (!empty($_GET['upd'])) { 
    394      dcPage::success(__('Entry has been successfully updated.')); 
     381     $_ctx->setAlert(__('Entry has been successfully updated.')); 
    395382} 
    396383elseif (!empty($_GET['crea'])) { 
    397      dcPage::success(__('Entry has been successfully created.')); 
     384     $_ctx->setAlert(__('Entry has been successfully created.')); 
    398385} 
    399386elseif (!empty($_GET['attached'])) { 
    400      dcPage::success(__('File has been successfully attached.')); 
     387     $_ctx->setAlert(__('File has been successfully attached.')); 
    401388} 
    402389elseif (!empty($_GET['rmattach'])) { 
    403      dcPage::success(__('Attachment has been successfully removed.')); 
    404 } 
    405  
     390     $_ctx->setAlert(__('Attachment has been successfully removed.')); 
     391} 
    406392if (!empty($_GET['creaco'])) { 
    407      dcPage::success(__('Comment has been successfully created.')); 
    408 } 
    409 if (!empty($_GET['tbsent'])) { 
    410      dcPage::success(__('All pings sent.')); 
    411 } 
    412  
    413 # XHTML conversion 
    414 if (!empty($_GET['xconv'])) 
    415 { 
    416      $post_excerpt = $post_excerpt_xhtml; 
    417      $post_content = $post_content_xhtml; 
    418      $post_format = 'xhtml'; 
    419       
    420      dcPage::message(__('Don\'t forget to validate your XHTML conversion by saving your post.')); 
    421 } 
    422  
    423 if ($post_id && $post->post_status == 1) { 
    424      echo '<p><a class="onblog_link outgoing" href="'.$post->getURL().'" title="'.$post_title.'">'.__('Go to this entry on the site').' <img src="images/outgoing-blue.png" alt="" /></a></p>'; 
    425 } 
    426 if ($post_id) 
    427 { 
    428      echo '<p class="nav_prevnext">'; 
    429      if ($prev_link) { echo $prev_link; } 
    430      if ($next_link && $prev_link) { echo ' | '; } 
    431      if ($next_link) { echo $next_link; } 
    432       
    433      # --BEHAVIOR-- adminPostNavLinks 
    434      $core->callBehavior('adminPostNavLinks',isset($post) ? $post : null); 
    435       
    436      echo '</p>'; 
    437 } 
    438  
    439 # Exit if we cannot view page 
    440 if (!$can_view_page) { 
    441      dcPage::helpBlock('core_post'); 
    442      dcPage::close(); 
    443      exit; 
    444 } 
    445 /* Post form if we can edit post 
    446 -------------------------------------------------------- */ 
    447 if ($can_edit_post) 
    448 { 
    449      $sidebar_items = new ArrayObject(array( 
    450           'status-box' => array( 
    451                'title' => __('Status'), 
    452                'items' => array( 
    453                     'post_status' =>  
    454                          '<p class="entry-status"><label for="post_status">'.__('Entry status').' '.$img_status.'</label>'. 
    455                          form::combo('post_status',$status_combo,$post_status,'maximal','',!$can_publish). 
    456                          '</p>', 
    457                     'post_dt' =>  
    458                          '<p><label for="post_dt">'.__('Publication date and hour').'</label>'. 
    459                          form::field('post_dt',16,16,$post_dt,($bad_dt ? 'invalid' : '')). 
    460                          '</p>', 
    461                     'post_lang' => 
    462                          '<p><label for="post_lang">'.__('Entry language').'</label>'. 
    463                          form::combo('post_lang',$lang_combo,$post_lang). 
    464                          '</p>', 
    465                     'post_format' => 
    466                          '<div>'. 
    467                          '<h5 id="label_format"><label for="post_format" class="classic">'.__('Text formatting').'</label></h5>'. 
    468                          '<p>'.form::combo('post_format',$formaters_combo,$post_format,'maximal'). 
    469                          '</p>'. 
    470                          '<p class="format_control control_no_xhtml">'. 
    471                          '<a id="convert-xhtml" class="button'.($post_id && $post_format != 'wiki' ? ' hide' : '').'" href="post.php?id='.$post_id.'&amp;xconv=1">'. 
    472                          __('Convert to XHTML').'</a></p></div>')), 
    473           'metas-box' => array( 
    474                'title' => __('Filing'), 
    475                'items' => array( 
    476                     'post_selected' =>  
    477                          '<p><label for="post_selected" class="classic">'. 
    478                          form::checkbox('post_selected',1,$post_selected).' '. 
    479                          __('Selected entry').'</label></p>', 
    480                     'cat_id' => 
    481                          '<div>'. 
    482                          '<h5 id="label_cat_id">'.__('Category').'</h5>'. 
    483                          '<p><label for="cat_id">'.__('Category:').'</label>'. 
    484                          form::combo('cat_id',$categories_combo,$cat_id,'maximal'). 
    485                          '</p>'. 
    486                          ($core->auth->check('categories', $core->blog->id) ? 
    487                               '<div>'. 
    488                               '<h5 id="create_cat">'.__('Add a new category').'</h5>'. 
    489                               '<p><label for="new_cat_title">'.__('Title:').' '. 
    490                               form::field('new_cat_title',30,255,'','maximal').'</label></p>'. 
    491                               '<p><label for="new_cat_parent">'.__('Parent:').' '. 
    492                               form::combo('new_cat_parent',$categories_combo,'','maximal'). 
    493                               '</label></p>'. 
    494                               '</div>' 
    495                          : ''). 
    496                          '</div>')), 
    497           'options-box' => array( 
    498                'title' => __('Options'), 
    499                'items' => array( 
    500                     'post_open_comment_tb' => 
    501                          '<div>'. 
    502                          '<h5 id="label_comment_tb">'.__('Comments and trackbacks list').'</h5>'. 
    503                          '<p><label for="post_open_comment" class="classic">'. 
    504                          form::checkbox('post_open_comment',1,$post_open_comment).' '. 
    505                          __('Accept comments').'</label></p>'. 
    506                          ($core->blog->settings->system->allow_comments ?  
    507                               (isContributionAllowed($post_id,strtotime($post_dt),true) ?  
    508                                    '' : 
    509                                    '<p class="form-note warn">'. 
    510                                    __('Warning: Comments are not more accepted for this entry.').'</p>') :  
    511                               '<p class="form-note warn">'. 
    512                               __('Comments are not accepted on this blog so far.').'</p>'). 
    513                          '<p><label for="post_open_tb" class="classic">'. 
    514                          form::checkbox('post_open_tb',1,$post_open_tb).' '. 
    515                          __('Accept trackbacks').'</label></p>'. 
    516                          ($core->blog->settings->system->allow_trackbacks ?  
    517                               (isContributionAllowed($post_id,strtotime($post_dt),false) ?  
    518                                    '' : 
    519                                    '<p class="form-note warn">'. 
    520                                    __('Warning: Trackbacks are not more accepted for this entry.').'</p>') :  
    521                               '<p class="form-note warn">'.__('Trackbacks are not accepted on this blog so far.').'</p>'). 
    522                          '</div>', 
    523                     'post_password' => 
    524                          '<p><label for="post_password">'.__('Password').'</label>'. 
    525                          form::field('post_password',10,32,html::escapeHTML($post_password),'maximal'). 
    526                          '</p>', 
    527                     'post_url' => 
    528                          '<div class="lockable">'. 
    529                          '<p><label for="post_url">'.__('Edit basename').'</label>'. 
    530                          form::field('post_url',10,255,html::escapeHTML($post_url),'maximal'). 
    531                          '</p>'. 
    532                          '<p class="form-note warn">'. 
    533                          __('Warning: If you set the URL manually, it may conflict with another entry.'). 
    534                          '</p></div>' 
    535      )))); 
    536  
    537      $main_items = new ArrayObject(array( 
    538           "post_title" => 
    539                '<p class="col">'. 
    540                '<label class="required no-margin bold"><abbr title="'.__('Required field').'">*</abbr> '.__('Title:').'</label>'. 
    541                form::field('post_title',20,255,html::escapeHTML($post_title),'maximal'). 
    542                '</p>', 
    543            
    544           "post_excerpt" => 
    545                '<p class="area" id="excerpt-area"><label for="post_excerpt" class="bold">'.__('Excerpt:').' <span class="form-note">'. 
    546                __('Introduction to the post.').'</span></label> '. 
    547                form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt)). 
    548                '</p>', 
    549            
    550           "post_content" => 
    551                '<p class="area" id="content-area"><label class="required bold" '. 
    552                'for="post_content"><abbr title="'.__('Required field').'">*</abbr> '.__('Content:').'</label> '. 
    553                form::textarea('post_content',50,$core->auth->getOption('edit_size'),html::escapeHTML($post_content)). 
    554                '</p>', 
    555            
    556           "post_notes" => 
    557                '<p class="area" id="notes-area"><label for="post_notes" class="bold">'.__('Personal notes:').' <span class="form-note">'. 
    558                __('Unpublished notes.').'</span></label>'. 
    559                form::textarea('post_notes',50,5,html::escapeHTML($post_notes)). 
    560                '</p>' 
    561           ) 
    562      ); 
    563       
    564      # --BEHAVIOR-- adminPostFormItems 
    565      $core->callBehavior('adminPostFormItems',$main_items,$sidebar_items, isset($post) ? $post : null); 
    566  
    567      echo '<div class="multi-part" title="'.($post_id ? __('Edit entry') : __('New entry')).'" id="edit-entry">'; 
    568      echo '<form action="post.php" method="post" id="entry-form">'; 
    569      echo '<div id="entry-wrapper">'; 
    570      echo '<div id="entry-content"><div class="constrained">'; 
    571  
    572      echo '<h3 class="out-of-screen-if-js">'.__('Edit post').'</h3>'; 
    573       
    574      foreach ($main_items as $id => $item) { 
    575           echo $item; 
    576      } 
    577  
    578      # --BEHAVIOR-- adminPostForm (may be deprecated) 
    579      $core->callBehavior('adminPostForm',isset($post) ? $post : null); 
    580       
    581      echo 
    582      '<p class="border-top">'. 
    583      ($post_id ? form::hidden('id',$post_id) : ''). 
    584      '<input type="submit" value="'.__('Save').' (s)" '. 
    585      'accesskey="s" name="save" /> '; 
    586      if ($post_id) { 
    587           $preview_url = 
    588           $core->blog->url.$core->url->getURLFor('preview',$core->auth->userID().'/'. 
    589           http::browserUID(DC_MASTER_KEY.$core->auth->userID().$core->auth->getInfo('user_pwd')). 
    590           '/'.$post->post_url); 
    591           echo '<a id="post-preview" href="'.$preview_url.'" class="button" accesskey="p">'.__('Preview').' (p)'.'</a> '; 
    592      } else { 
    593           echo 
    594           '<a id="post-cancel" href="index.php" class="button" accesskey="c">'.__('Cancel').' (c)</a>'; 
    595      } 
    596  
    597      echo 
    598      ($can_delete ? '<input type="submit" class="delete" value="'.__('Delete').'" name="delete" />' : ''). 
    599      $core->formNonce(). 
    600      '</p>'; 
    601       
    602      echo '</div></div>';          // End #entry-content 
    603      echo '</div>';      // End #entry-wrapper 
    604  
    605      echo '<div id="entry-sidebar">'; 
    606       
    607      foreach ($sidebar_items as $id => $c) { 
    608           echo '<div id="'.$id.'" class="sb-box">'. 
    609                '<h4>'.$c['title'].'</h4>'; 
    610           foreach ($c['items'] as $e_name=>$e_content) { 
    611                echo $e_content; 
    612           } 
    613           echo '</div>'; 
    614      } 
    615       
    616       
    617      # --BEHAVIOR-- adminPostFormSidebar (may be deprecated) 
    618      $core->callBehavior('adminPostFormSidebar',isset($post) ? $post : null); 
    619      echo '</div>';      // End #entry-sidebar 
    620  
    621      echo '</form>'; 
    622       
    623      # --BEHAVIOR-- adminPostForm 
    624      $core->callBehavior('adminPostAfterForm',isset($post) ? $post : null); 
    625       
    626      echo '</div>'; 
    627 } 
    628  
    629 if ($post_id) 
    630 { 
    631      /* Comments 
    632      -------------------------------------------------------- */ 
    633  
    634      $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 
    635       
    636      $comments = $core->blog->getComments(array_merge($params,array('comment_trackback'=>0))); 
    637            
    638      echo 
    639      '<div id="comments" class="clear multi-part" title="'.__('Comments').'">'; 
    640      $combo_action = $comments_actions_page->getCombo();     
    641      $has_action = !empty($combo_action) && !$comments->isEmpty(); 
    642      echo  
    643      '<p class="top-add"><a class="button add" href="#comment-form">'.__('Add a comment').'</a></p>'; 
    644       
    645      if ($has_action) { 
    646           echo '<form action="post.php" id="form-comments" method="post">'; 
    647      } 
    648       
    649      echo '<h3>'.__('Comments').'</h3>'; 
    650      if (!$comments->isEmpty()) { 
    651           showComments($comments,$has_action); 
    652      } else { 
    653           echo '<p>'.__('No comment').'</p>'; 
    654      } 
    655       
    656      if ($has_action) { 
    657           echo 
    658           '<div class="two-cols">'. 
    659           '<p class="col checkboxes-helpers"></p>'. 
    660            
    661           '<p class="col right"><label for="action" class="classic">'.__('Selected comments action:').'</label> '. 
    662           form::combo('action',$combo_action). 
    663           form::hidden(array('section'),'comments'). 
    664           form::hidden(array('id'),$post_id). 
    665           $core->formNonce(). 
    666           '<input type="submit" value="'.__('ok').'" /></p>'. 
    667           '</div>'. 
    668           '</form>'; 
    669      } 
    670      /* Add a comment 
    671      -------------------------------------------------------- */ 
    672  
    673      echo 
    674      '<div class="fieldset clear">'. 
    675      '<h3>'.__('Add a comment').'</h3>'. 
    676       
    677      '<form action="comment.php" method="post" id="comment-form">'. 
    678      '<div class="constrained">'. 
    679      '<p><label for="comment_author" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Name:').'</label>'. 
    680      form::field('comment_author',30,255,html::escapeHTML($core->auth->getInfo('user_cn'))). 
    681      '</p>'. 
    682       
    683      '<p><label for="comment_email">'.__('Email:').'</label>'. 
    684      form::field('comment_email',30,255,html::escapeHTML($core->auth->getInfo('user_email'))). 
    685      '</p>'. 
    686       
    687      '<p><label for="comment_site">'.__('Web site:').'</label>'. 
    688      form::field('comment_site',30,255,html::escapeHTML($core->auth->getInfo('user_url'))). 
    689      '</p>'. 
    690       
    691      '<p class="area"><label for="comment_content" class="required"><abbr title="'.__('Required field').'">*</abbr> '. 
    692      __('Comment:').'</label> '. 
    693      form::textarea('comment_content',50,8,html::escapeHTML('')). 
    694      '</p>'. 
    695       
    696      '<p>'. 
    697      form::hidden('post_id',$post_id). 
    698      $core->formNonce(). 
    699      '<input type="submit" name="add" value="'.__('Save').'" /></p>'. 
    700      '</div>'. #constrained 
    701  
    702      '</form>'. 
    703      '</div>'. #add comment 
    704      '</div>'; #comments 
    705 } 
    706  
    707 if ($post_id && $post_status == 1) 
    708 { 
    709      /* Trackbacks 
    710      -------------------------------------------------------- */ 
    711  
    712      $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 
    713      $trackbacks = $core->blog->getComments(array_merge($params, array('comment_trackback' => 1))); 
    714       
    715      # Actions combo box 
    716      $combo_action = $comments_actions_page->getCombo();     
    717      $has_action = !empty($combo_action) && !$trackbacks->isEmpty(); 
    718       
    719      if (!empty($_GET['tb_auto'])) { 
    720           $tb_urls = implode("\n", $TB->discover($post_excerpt_xhtml.' '.$post_content_xhtml)); 
    721      } 
    722       
    723      # Display tab 
    724      echo 
    725      '<div id="trackbacks" class="clear multi-part" title="'.__('Trackbacks').'">'; 
    726       
    727      # tracbacks actions 
    728      if ($has_action) { 
    729           echo '<form action="post.php" id="form-trackbacks" method="post">'; 
    730      } 
    731       
    732      echo '<h3>'.__('Trackbacks received').'</h3>'; 
    733       
    734      if (!$trackbacks->isEmpty()) { 
    735           showComments($trackbacks, $has_action, true); 
    736      } else { 
    737           echo '<p>'.__('No trackback').'</p>'; 
    738      } 
    739       
    740      if ($has_action) { 
    741           echo 
    742           '<div class="two-cols">'. 
    743           '<p class="col checkboxes-helpers"></p>'. 
    744            
    745           '<p class="col right"><label for="action" class="classic">'.__('Selected trackbacks action:').'</label> '. 
    746           form::combo('action', $combo_action). 
    747           form::hidden('id',$post_id). 
    748           form::hidden(array('section'),'trackbacks'). 
    749           $core->formNonce(). 
    750           '<input type="submit" value="'.__('ok').'" /></p>'. 
    751           '</div>'. 
    752           '</form>'; 
    753      } 
    754       
    755      /* Add trackbacks 
    756      -------------------------------------------------------- */ 
    757      if ($can_edit_post && $post->post_status) { 
    758           echo 
    759           '<div class="fieldset clear">'; 
    760  
    761           echo 
    762           '<h3>'.__('Ping blogs').'</h3>'. 
    763           '<form action="post.php?id='.$post_id.'" id="trackback-form" method="post">'. 
    764           '<p><label for="tb_urls" class="area">'.__('URLs to ping:').'</label>'. 
    765           form::textarea('tb_urls', 60, 5, $tb_urls). 
    766           '</p>'. 
    767  
    768           '<p><label for="tb_excerpt" class="area">'.__('Excerpt to send:').'</label>'. 
    769           form::textarea('tb_excerpt', 60, 5, $tb_excerpt).'</p>'. 
    770  
    771           '<p>'. 
    772           $core->formNonce(). 
    773           '<input type="submit" name="ping" value="'.__('Ping blogs').'" />'. 
    774           (empty($_GET['tb_auto']) ?  
    775                '&nbsp;&nbsp;<a class="button" href="'. 
    776                'post.php?id='.$post_id.'&amp;tb_auto=1&amp;tb=1'. 
    777                '">'.__('Auto discover ping URLs').'</a>' 
    778           : ''). 
    779           '</p>'. 
    780           '</form>'; 
    781  
    782           $pings = $TB->getPostPings($post_id); 
    783  
    784           if (!$pings->isEmpty()) 
    785           { 
    786                echo '<h3>'.__('Previously sent pings').'</h3>'; 
    787                 
    788                echo '<ul class="nice">'; 
    789                while ($pings->fetch()) { 
    790                     echo 
    791                     '<li>'.dt::dt2str(__('%Y-%m-%d %H:%M'), $pings->ping_dt).' - '. 
    792                     $pings->ping_url.'</li>'; 
    793                } 
    794                echo '</ul>'; 
    795           } 
    796  
    797           echo '</div>'; 
    798      } 
    799  
    800      echo '</div>'; #trackbacks 
    801 } 
    802  
    803 # Controls comments or trakbacks capabilities 
    804 function isContributionAllowed($id,$dt,$com=true) 
    805 { 
    806      global $core; 
    807  
    808      if (!$id) { 
    809           return true; 
    810      } 
    811      if ($com) { 
    812           if (($core->blog->settings->system->comments_ttl == 0) ||  
    813                (time() - $core->blog->settings->system->comments_ttl*86400 < $dt)) { 
    814                return true; 
    815           } 
    816      } else { 
    817           if (($core->blog->settings->system->trackbacks_ttl == 0) ||  
    818                (time() - $core->blog->settings->system->trackbacks_ttl*86400 < $dt)) { 
    819                return true; 
    820           } 
    821      } 
    822      return false; 
    823 } 
    824  
    825 # Show comments or trackbacks 
    826 function showComments($rs,$has_action,$tb=false) 
    827 { 
    828      echo 
    829      '<div class="table-outer">'. 
    830      '<table class="comments-list"><tr>'. 
    831      '<th colspan="2" class="first">'.__('Author').'</th>'. 
    832      '<th>'.__('Date').'</th>'. 
    833      '<th class="nowrap">'.__('IP address').'</th>'. 
    834      '<th>'.__('Status').'</th>'. 
    835      '<th>'.__('Edit').'</th>'. 
    836      '</tr>'; 
    837      $comments = array(); 
    838      if (isset($_REQUEST['comments'])) { 
    839           foreach ($_REQUEST['comments'] as $v) { 
    840                $comments[(integer)$v]=true; 
    841           } 
    842      }               
    843       
    844      while($rs->fetch()) 
    845      { 
    846           $comment_url = 'comment.php?id='.$rs->comment_id; 
    847            
    848           $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; 
    849           switch ($rs->comment_status) { 
    850                case 1: 
    851                     $img_status = sprintf($img,__('Published'),'check-on.png'); 
    852                     break; 
    853                case 0: 
    854                     $img_status = sprintf($img,__('Unpublished'),'check-off.png'); 
    855                     break; 
    856                case -1: 
    857                     $img_status = sprintf($img,__('Pending'),'check-wrn.png'); 
    858                     break; 
    859                case -2: 
    860                     $img_status = sprintf($img,__('Junk'),'junk.png'); 
    861                     break; 
    862           } 
    863            
    864           echo 
    865           '<tr class="line'.($rs->comment_status != 1 ? ' offline' : '').'"'. 
    866           ' id="c'.$rs->comment_id.'">'. 
    867            
    868           '<td class="nowrap">'. 
    869           ($has_action ? form::checkbox(array('comments[]'),$rs->comment_id,isset($comments[$rs->comment_id]),'','',0,'title="'.($tb ? __('select this trackback') : __('select this comment')).'"') : '').'</td>'. 
    870           '<td class="maximal">'.html::escapeHTML($rs->comment_author).'</td>'. 
    871           '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$rs->comment_dt).'</td>'. 
    872           '<td class="nowrap"><a href="comments.php?ip='.$rs->comment_ip.'">'.$rs->comment_ip.'</a></td>'. 
    873           '<td class="nowrap status">'.$img_status.'</td>'. 
    874           '<td class="nowrap status"><a href="'.$comment_url.'">'. 
    875           '<img src="images/edit-mini.png" alt="" title="'.__('Edit this comment').'" /> '.__('Edit').'</a></td>'. 
    876            
    877           '</tr>'; 
    878      } 
    879       
    880      echo '</table></div>'; 
    881 } 
    882  
    883 dcPage::helpBlock('core_post','core_trackbacks','core_wiki'); 
    884 dcPage::close(); 
     393     $_ctx->setAlert(__('Comment has been successfully created.')); 
     394}     
     395      
     396$core->tpl->display('post.html.twig'); 
    885397?> 
  • admin/style/default.css

    r2313 r2468  
    1616*/ 
    1717/* --------------------------------------------------------------------------- 
     18                                                                                          START 
     19---------------------------------------------------------------------------- */ 
     20html { 
     21     font-size: 62.5%; 
     22     } 
     23body { 
     24     font-size: 12px; /* ie < 9 sucks */ 
     25     font-size: 1.2rem; 
     26     line-height: 1.5; 
     27     font-family: "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; 
     28     margin: 0; 
     29     padding: 0; 
     30     } 
     31/* --------------------------------------------------------------------------- 
    1832                                                                                     LAYOUTS 
    1933---------------------------------------------------------------------------- */ 
     34*, *:before, *:after { 
     35    -webkit-box-sizing: border-box; 
     36    -moz-box-sizing: border-box; 
     37    box-sizing: border-box; 
     38     } 
    2039#header { 
    2140     background: #676e78; 
     
    2443     width: 100%; 
    2544     display: table; 
     45     position: relative; 
    2646     } 
    2747#wrapper { 
     
    6989     top: 0; 
    7090     left: 14em; 
    71      width: 1em; 
     91     width: 15px; 
    7292     height: 100%; 
    7393     overflow: hidden; 
     
    123143     } 
    124144.two-cols .col:first-child, 
    125      .two-cols .col30.first-col { 
     145.two-cols .col30.first-col { 
    126146     margin-left: 0; 
    127147     margin-right: 2%; 
    128148     } 
    129149.two-cols .col:last-child, 
    130      .two-cols .col70.last-col { 
     150.two-cols .col70.last-col { 
    131151     margin-left: 2%; 
    132152     margin-right: 0; 
     
    145165     } 
    146166.three-cols .col:first-child { 
    147      width: 33.3%; 
    148167     margin-left: 0; 
    149168     } 
     
    153172     } 
    154173.two-boxes { 
    155      width: 47%; 
     174     width: 48.5%; 
    156175     } 
    157176.three-boxes { 
     
    162181     vertical-align: top; 
    163182     margin: 0 1.5% 1em; 
    164      -moz-box-sizing: border-box; 
    165      -webkit-box-sizing: border-box; 
    166      box-sizing: border-box; 
    167183     text-align: left; 
     184     } 
     185.two-boxes:nth-of-type(odd), .three-boxes:nth-of-type(3n+1) { 
     186     margin-left: 0; 
     187     } 
     188.two-boxes:nth-of-type(even), .three-boxes:nth-of-type(3n) { 
     189     margin-right: 0; 
    168190     } 
    169191/* ---------------------------------------------------------------- layout: popups */ 
     
    244266     display: inline-block; 
    245267     vertical-align: top; 
    246      margin: 0 1.5% 1em; 
    247      -moz-box-sizing: border-box; 
    248      -webkit-box-sizing: border-box; 
    249      box-sizing: border-box; 
     268     margin: 0 10px 10px; 
    250269     text-align: left; 
    251270     } 
    252271.box.small { 
    253      width: 320px; 
     272     width: 312px; 
    254273     } 
    255274.box.medium { 
    256      width: 660px; 
     275     width: 644px; 
    257276     } 
    258277.box.large { 
     
    268287                                                                                     HTML TAGS 
    269288---------------------------------------------------------------------------- */ 
    270 html { 
    271      font-size: 62.5%; 
    272      } 
    273289body { 
    274      font-size: 12px; /* ie < 9 sucks */ 
    275      font-size: 1.2rem; 
    276      line-height: 1.5; 
    277      font-family: "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; 
    278290     color: #333; 
    279291     background: #fff; 
    280      margin: 0; 
    281      padding: 0; 
    282292     } 
    283293/* ------------------------------------------------------------------ titres */ 
     
    291301     padding: 0 0 1.5em; 
    292302     font-weight: normal; 
     303     line-height: 1.25; 
    293304     } 
    294305/* fil d'ariane */ 
    295306#content > h2 { 
    296307     padding: 0 1em .5em 1em; 
    297      margin: 0 -1em .5em -1em; 
     308     margin: 0 -1em 1em -1em; 
    298309     background: #fff url(bg_h2.png) repeat-x center bottom; 
    299310     } 
     
    321332     } 
    322333h4, .as_h4 { 
    323      font-size: 14px; /* ie < 9 sucks */ 
    324      font-size: 1.4rem; 
     334     font-size: 1.16em; 
    325335     color: #676e78; 
    326336     } 
     
    341351     } 
    342352h5 { 
    343      font-size: 12px; /* ie < 9 sucks */ 
    344      font-size: 1.2rem; 
     353     font-size: 1em; 
    345354     font-weight: bold; 
    346355     color: #676e78; 
     
    368377     } 
    369378table { 
    370      font-size: 12px; /* ie < 9 sucks */ 
    371      font-size: 1.2rem; 
     379     font-size: 1em; 
    372380     border-collapse: collapse; 
    373381     margin: 0 0 1em 0; 
     
    419427     white-space: pre; 
    420428     white-space: -moz-pre-wrap; 
    421      white-space: -hp-pre-wrap; 
    422      white-space: -o-pre-wrap; 
    423      white-space: -pre-wrap; 
    424429     white-space: pre-wrap; 
    425430     white-space: pre-line; 
     
    456461input[type=button], input[type=reset], a.button, button, textarea, select, legend { 
    457462     border-radius: 3px;  
     463     max-width: 100%; 
    458464     } 
    459465form { 
     
    496502     } 
    497503input:focus, textarea:focus, select:focus { 
    498      -webkit-box-sizing: border-box; 
    499      -moz-box-sizing: border-box; 
    500      box-sizing: border-box; 
    501504     border-color: #9bca1c; 
    502505     } 
     
    594597     color: #900; 
    595598     font-size: 1.3em; 
     599     } 
     600label.bold { 
     601     text-transform: uppercase; 
     602     font-weight: bold; 
     603     margin-top: 2em; 
    596604     } 
    597605label.area, p.area { 
     
    730738     text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6); 
    731739     font-weight: normal; 
    732      font-size: 14px; /* ie < 9 sucks */ 
    733      font-size: 1.4rem; 
     740     font-size: 1.16em; 
    734741     } 
    735742.button.add:hover, .button.add:active, .button.add:focus { 
    736743     background-color: #9BCA1C; 
    737744     background-image: -webkit-gradient(linear, left top, left bottom, from(#9BCA1C), to(#bee74b)); 
    738      background-image: linear-gradient(top, #9BCA1C, #bee74b); 
     745     background-image: linear-gradient(#9BCA1C, #bee74b); 
    739746     border-color: #9BCA1C; 
    740747     } 
     
    799806     padding-top: 1em; 
    800807     padding-bottom: 1em; 
     808     margin-top: .5em; 
    801809     } 
    802810.error { 
     
    879887     } 
    880888#prelude li a { 
    881      padding: 3px 16px 3px 8px; /* ie < 9 sucks */ 
    882           padding: 3px 1.6rem 3px .8rem; 
     889     padding: 3px 16px 3px 8px; 
    883890     background: #A2CBE9; 
    884891     color: #000; 
     
    912919/* h1 */ 
    913920h1 { 
    914      text-indent: -1000px; 
     921     text-indent: 100%; 
    915922     width: 16.5em; 
    916923     } 
     
    919926     top: 0; 
    920927     left: 0; 
    921      width: 15em; 
    922      height: 36px; 
    923      /* ie < 9 sucks */ 
    924      height: 3.6rem; 
     928     width: 150px; 
     929     height: 3em; 
    925930     color: #fff; 
    926931     background: transparent url(dc_logos/b-dotclear120.png) no-repeat 0 6px; 
     
    979984     padding: 10px 0 10px 8px; 
    980985     color: #676e78; 
    981      font-size: 14px; /* ie < 9 sucks */ 
    982      font-size: 1.4rem; 
     986     font-size: 1.15em; 
    983987     } 
    984988#favorites-menu h3 { 
     
    10251029     } 
    10261030#search-menu * { 
    1027      height: 22px; /* ie < 9 sucks */ 
    1028      height: 2.2rem; 
     1031     height: 2em; 
    10291032     display: inline-block; 
    10301033     vertical-align: top; 
    1031      line-height: 22px; 
     1034     line-height: 24px; 
    10321035     } 
    10331036#search-menu p { 
     
    10351038     border-radius: .3em; 
    10361039     position: relative; 
     1040     width: 95%; 
    10371041     overflow: hidden; 
    10381042     } 
    10391043#qx { 
    1040      width: 124px; /* ie < 9 sucks */ 
    1041      width: 12.4rem; 
     1044     width: 80%; 
    10421045     border-bottom-left-radius: .3em; 
    10431046     border-top-left-radius: .3em; 
     
    10461049     padding: 0; 
    10471050     border: none; 
    1048      height: 22px; 
    1049      height: 2.2rem; 
     1051     height: 2em; 
    10501052     } 
    10511053#qx:focus { 
     
    10531055     } 
    10541056#search-menu input[type="submit"] { 
    1055      padding: 0 3px; 
    1056      padding: 0 .3rem; 
    1057      margin-left: -4px; 
     1057     padding: 0 .25em; 
     1058     margin-left: .33em; 
    10581059     background: #dfdfdf; 
    10591060     border-color: #999; 
     
    10661067     border: none; 
    10671068     border-left: 1px solid #999; 
    1068      font-size: 10px; /* ie < 9 sucks */ 
    1069      font-size: 1rem; 
     1069     font-size: .91em; 
     1070     float: right; 
    10701071     } 
    10711072#search-menu input[type="submit"]:hover, 
     
    10771078.part-tabs ul { 
    10781079     padding: .5em 0 0 1em; 
    1079      border-bottom: 1px solid #dfdfdf; 
    1080      line-height: 2; 
     1080     border-bottom: 1px solid #ccc; 
     1081     line-height: 1.8; 
    10811082     } 
    10821083.part-tabs li { 
     
    10851086     display: inline; 
    10861087     } 
     1088.part-tabs li:first-child a { 
     1089     border-top-left-radius: 3px; 
     1090     } 
     1091.part-tabs li:last-child a { 
     1092     border-top-right-radius: 3px; 
     1093     } 
    10871094.part-tabs li a { 
    1088      padding: .5em 2em; 
     1095     padding: .33em 1.5em; 
    10891096     margin-right: -1px; 
    10901097     border: 1px solid #ccc; 
     
    11081115     padding-left: 1em; 
    11091116     } 
     1117.pseudo-tabs { 
     1118     margin: -.75em 0 2em 0; 
     1119     border-bottom: 1px solid #bbb; 
     1120     display: table; 
     1121     width: 100%; 
     1122     padding: 0; 
     1123     line-height: 24px; 
     1124     border-collapse: collapse; 
     1125     } 
     1126.pseudo-tabs li { 
     1127     display: table-cell; 
     1128     border-width: 0 1px; 
     1129     border-style: solid; 
     1130     border-color: #ccc; 
     1131     padding: 0; 
     1132     margin: 0; 
     1133     text-align: center; 
     1134     } 
     1135.pseudo-tabs a { 
     1136     display: block; 
     1137     font-weight: bold; 
     1138     padding: 0 24px; 
     1139     border-bottom: none; 
     1140     } 
     1141.pseudo-tabs a:hover, .pseudo-tabs a:focus { 
     1142     background-color: #ecf0f1; 
     1143     color: #333; 
     1144     } 
     1145.pseudo-tabs a.active { 
     1146     background-color: #ecf0f1; 
     1147     color: #d30e60; 
     1148     } 
    11101149/* contextual help */ 
    11111150#help { 
     
    11211160     top: 0; 
    11221161     right: 0; 
    1123      width: 280px; /* ie < 9 sucks */ 
    1124      width: 28rem; 
     1162     width: 24em; 
    11251163     border-left: 2px solid #FFD478; 
    11261164     border-top: 2px solid #FFD478; 
     
    11371175     cursor: pointer; 
    11381176     color: #2373A8; 
    1139      line-height: 36px; /* ie < 9 sucks */ 
    1140      line-height: 3.6rem; 
     1177     line-height: 3; 
    11411178     } 
    11421179#help-button.floatable { 
     
    11491186     position: fixed; 
    11501187     top: 10px; 
     1188     -webkit-transform:translateZ(0);   /* Let GPU doing his job */ 
    11511189     } 
    11521190.no-js #help-button { 
     
    11571195     } 
    11581196#content.with-help #help-button { 
    1159      right: 280px; /* ie < 9 sucks */ 
    1160      right: 28rem; 
     1197     right: 24em; 
    11611198     background-color: #f5f5f5; 
    11621199     position: fixed; 
     
    13711408     width: 20em; 
    13721409     margin: 1.5em auto 0; 
    1373      font-size: 14px; /* ie < 9 sucks */ 
    1374      font-size: 1.4rem; 
     1410     font-size: 1.16em; 
    13751411     } 
    13761412#login-screen h1 { 
     
    13861422     padding: 1em 1em 0 1em; 
    13871423     background: #fff; 
     1424     margin-bottom: 0; 
    13881425     } 
    13891426#login-screen input[type=text], #login-screen input[type=password], #login-screen input[type=submit], 
     
    13921429     margin: 0; 
    13931430     padding: 5px 3px; 
    1394      -webkit-box-sizing: border-box;     
    1395      -moz-box-sizing: border-box; 
    1396      box-sizing: border-box; 
    13971431     } 
    13981432#login-screen input.login, #login-screen input.login:focus { 
     
    14031437#login-screen #issue { 
    14041438     margin-left: 1.33em; 
    1405      font-size: 12px; /* ie < 9 sucks */ 
    1406      font-size: 1.2rem; 
     1439     font-size: .91em; 
     1440     } 
     1441#issue p:first-child { 
     1442     text-align: right; 
    14071443     } 
    14081444#login-screen #issue strong { 
     
    14111447/* ------------------------------------------------------------------------- index.php */ 
    14121448#dashboard-main { 
    1413      padding: 1em 0; 
     1449     padding: 1em; 
     1450     text-align: center; 
    14141451     } 
    14151452/* raccourcis */ 
     
    14201457     } 
    14211458#icons p { 
    1422      width: 170px; 
     1459     width: 14em; 
    14231460     text-align: center; 
    14241461     margin: 1em 0 2em; 
     
    14541491/* billet rapide */ 
    14551492#quick { 
    1456      margin-top: 1em; 
    1457      padding-top: 1em; 
     1493     padding: 1em; 
     1494     max-width: 976px; 
     1495     margin: 0 auto; 
     1496     background: #f5f5f5; 
     1497     box-shadow: 0 1px 2px rgba(0, 0, 0, .2); 
     1498     text-align: left; 
    14581499     } 
    14591500#quick h3 { 
     
    14821523/* modules additionnels */ 
    14831524#dashboard-boxes { 
    1484      margin: 2em auto 1em; 
     1525     margin: 1em auto 1em; 
    14851526     padding-top: 2em; 
    14861527     } 
     
    15691610     } 
    15701611/* ------------------------------------------------------------------- blog_theme.php */ 
     1612/* pour les alignements verticaux */ 
     1613#theme-new, #theme-activate, #theme-deactivate { 
     1614     margin-left: -10px; 
     1615     margin-right: -10px; 
     1616     } 
    15711617.box.theme { 
    1572      margin: .5em; 
     1618     margin: 5px; 
    15731619     padding: 10px 10px 5px 10px; 
    15741620     border: 1px solid #dfdfdf; 
    1575      min-height: 295px; 
    15761621     position: relative; 
    15771622     } 
     
    15791624     background: #ecf0f1 url(texture.png); 
    15801625     } 
    1581 #theme-new .box.theme { 
    1582      width: 280px; 
    1583      } 
    1584 #theme-activate .box.theme { 
    1585      min-height: 330px; 
    1586      } 
    15871626.module-name { 
    15881627     margin-bottom: .5em; 
     
    15921631     } 
    15931632.module-sshot img { 
    1594      padding: .5em; 
     1633     padding: 5px; 
    15951634     background: #f7f7f7; 
    15961635     box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2); 
    15971636     border: 3px solid #fff; 
    1598      padding: .5em; 
    1599      } 
    1600 .theme .module-sshot img { 
    1601      max-width: 280px; /* pour ceux qui n'ont pas de miniature */ 
    1602      } 
    1603 #theme-new .theme .module-sshot img { 
    1604      max-width: 240px; /* pour ceux qui n'ont pas de miniature */ 
     1637     max-width: 100%; 
     1638     } 
     1639.module-actions { 
     1640     margin-top: 1em; 
     1641     } 
     1642.bloc-toggler { 
     1643     text-align: right; 
     1644     } 
     1645.bloc-toggler img { 
     1646     opacity: .4; 
     1647     } 
     1648.bloc-toggler img:hover { 
     1649     opacity: 1; 
     1650     } 
     1651.bloc-toggler a:focus img { 
     1652     opacity: 1; 
     1653     } 
     1654span.module-version:before { 
     1655     content: "- "; 
     1656     } 
     1657.toggle-bloc .mod-more { 
     1658     display: block; 
     1659     margin-left: 0; 
     1660     } 
     1661.box.theme input { 
     1662     margin-bottom: 1em; 
     1663     } 
     1664/** 
     1665Les screenshots des thèmes ont deux tailles possibles : 
     1666- dans Ajouter des thèmes : 240px (+ 10 padding image + 20 padding boîte + 6 bordure + 2 ombrage = 278) 
     1667- dans Thèmes installés : 280px (+ 10 padding-image + 20 padding-boîte + 2 ombrage = 318) 
     1668On adapte largeur et hauteur en fonction  
     1669*/ 
     1670#theme-new .box.theme { /* Ajouter un thème */ 
     1671     width: 278px; 
     1672     min-height: 275px; 
     1673     } 
     1674#theme-new .module-sshot img { /* Pour ceux qui n'ont pas de miniature on contraint l'image */ 
     1675     max-width: 240px; 
    16051676     max-height: 210px; 
    16061677     overflow: hidden; 
    16071678     } 
    1608 .module-actions { 
    1609      margin-top: 1em; 
    1610      } 
    1611 .bloc-toggler { 
    1612      text-align: right; 
    1613      } 
    1614 .bloc-toggler img { 
    1615      opacity: .4; 
    1616      } 
    1617 .bloc-toggler img:hover { 
    1618      opacity: 1; 
    1619      } 
    1620 .bloc-toggler a:focus img { 
    1621      opacity: 1; 
    1622      } 
    1623 span.module-version:before { 
    1624      content: "- "; 
    1625      } 
     1679#theme-deactivate .box.theme { /* Thèmes désactivés */ 
     1680     width: 278px; 
     1681     } 
     1682#theme-activate .box.theme { /* Thèmes installés */ 
     1683     width: 318px; 
     1684     min-height: 304px; 
     1685     max-width: 100%; 
     1686     } 
     1687#theme-deactivate .box.theme:hover { 
     1688     background: transparent url(dc_logos/sq-logo-32.png) no-repeat top right; 
     1689     } 
     1690/* si js est là, les infos viennent par dessus le screenshot */ 
    16261691.with-js #theme-new .module-infos.toggle-bloc, 
    16271692.with-js #theme-new .module-actions.toggle-bloc { 
    16281693     position: absolute; 
    1629      top: 138px; 
    16301694     left: 10px; 
    16311695     width: 239px; 
     1696     margin: 0; 
    16321697     padding: 10px; 
    16331698     background: rgba(250, 250, 250, .95); 
    16341699     } 
    16351700.with-js #theme-new .module-infos.toggle-bloc { 
    1636      top: 138px; 
     1701     top: 128px; 
    16371702     height: 80px; 
    16381703     border-top: 1px solid #e3e3e3; 
    16391704     } 
    16401705.with-js #theme-new .module-actions.toggle-bloc { 
    1641      top: 228px; 
    1642      height: 18px; 
    1643      margin: 0; 
     1706     top: 208px; 
     1707     height: 40px; 
    16441708     border-bottom: 1px solid #e3e3e3; 
    16451709     } 
    1646 .toggle-bloc .mod-more { 
    1647      display: block; 
    1648      margin-left: 0; 
    1649      } 
    1650 .box.current-theme { 
    1651      width: 652px; 
    1652      margin: .5em; 
    1653      padding: 10px 18px; 
     1710.with-js .module-sshot:hover { 
     1711     cursor: pointer; 
     1712     } 
     1713/* mise en forme pour la boîte du thème courant */ 
     1714.box.current-theme { /* Thème courant */ 
     1715     width: 646px; 
     1716     margin: 5px; 
     1717     padding: 20px 18px 6px; 
    16541718     background: #fff url(texture.png); 
    16551719     border: 1px solid #eee; 
    16561720     border-radius: .5em; 
    1657      min-height: 330px; 
     1721     min-height: 326px; 
    16581722     box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2); 
     1723     position: relative; 
     1724     } 
     1725.current-theme .module-sshot:hover { 
     1726     cursor: auto; 
    16591727     } 
    16601728.current-theme .module-sshot img { 
    16611729     float: left; 
    16621730     margin-right: 2em; 
    1663      margin-bottom: 1em; 
    1664      border: 3px solid #fff; 
    1665      padding: .5em; 
     1731     border: 9px solid #fff; 
     1732     padding: 5px; 
     1733     max-width: 308px; 
     1734     max-height: 273px; 
    16661735     } 
    16671736.current-theme .module-name { 
    16681737     color: #D33800; 
    1669      font-size: 1.33em; 
    1670      } 
    1671 .box.theme input { 
     1738     font-size: 1.5em; 
    16721739     margin-bottom: 1em; 
    16731740     } 
     
    16751742     width: auto; 
    16761743     overflow: hidden; 
    1677      padding-top: 3em; 
     1744     padding-top: 2em; 
    16781745     margin: 1.5em 0 2em; 
    16791746     background: transparent url(../images/minus-theme.png) no-repeat left top; 
     1747     } 
     1748.current-theme .actions-buttons { 
     1749     position: absolute; 
     1750     bottom: 0; 
     1751     right: 18px; 
    16801752     } 
    16811753/* ------------------------------------------------------------------ categories.php */ 
     
    17211793     float: right; 
    17221794     margin-top: -.2em; 
    1723      font-size: 11px; 
     1795     font-size: .91em; 
    17241796     } 
    17251797.cat-buttons select { 
     
    17501822     margin: 9px; 
    17511823     padding: 10px 12px 6px; 
    1752      width: 300px; 
     1824     width: 320px; 
    17531825     display: inline-block; 
    17541826     vertical-align: top; 
     
    17941866li.media-action a { 
    17951867     border: none; 
     1868     } 
     1869li.media-action a.attach-media { 
     1870     margin-right: 5px; 
    17961871     } 
    17971872li.media-action form { 
     
    19312006.upload-progress div { 
    19322007     width: 0; 
    1933      height: 1em; 
    1934      padding: .2em 0; 
    1935      font-size: 0.8em; 
     2008     height: 1.2em; 
    19362009     font-weight: bold; 
    1937      line-height: 1em; 
     2010     line-height: 1.2em; 
    19382011     text-align: right; 
    19392012     background: green url(loader.png) repeat-x left top; 
     
    19972070     padding: 4px 4px 0 20px; 
    19982071     } 
     2072.modules a.module-config { 
     2073     /* todo: add icon here */ 
     2074     padding: 4px 4px 0 20px; 
     2075     } 
    19992076#m_search { 
    20002077     background: transparent url(search.png) no-repeat 4px center; 
     
    20362113     margin-left: 0; 
    20372114     } 
    2038 #entry-content label { 
    2039      text-transform: uppercase; 
    2040      font-weight: bold; 
    2041      margin-top: 2em; 
    2042      display: inline-block; 
    2043      } 
    2044 #entry-content label:first-child { 
    2045      margin-top: 0; 
    2046      } 
    20472115#entry-sidebar { 
    20482116     width: 16em; 
     
    20502118     } 
    20512119#entry-sidebar h4 { 
    2052      font-size: 13px; 
    2053      font-size: 1.3rem; 
     2120     font-size: 1.08em; 
    20542121     margin-top: .3em; 
    20552122     } 
     
    21372204/* --------------------------------------------------------------------- user.php */ 
    21382205.blog-perm { 
     2206     padding-top: 2em; 
     2207     } 
     2208.blog-perm { 
    21392209     margin-top: 2em; 
    21402210     font-weight: bold; 
     
    21582228     font-size: 2em; 
    21592229     } 
     2230.guideline #content h2:first-child { 
     2231     margin-top: 0; 
     2232     padding-top: .5em; 
     2233     } 
    21602234.guideline h3 { 
    21612235     margin-top: 2em; 
     
    21682242     padding: 2px .5em; 
    21692243     } 
     2244.guideline #main-menu ul { 
     2245     margin: 0; 
     2246     padding: 0; 
     2247     font-weight: normal; 
     2248     } 
     2249.guideline #main-menu li { 
     2250     padding-left: 1em; 
     2251} 
    21702252/* ------------------------------------------------------------------------------------ 
    21712253                                                                                                    CLASSES 
     
    23312413     font-variant: small-caps; 
    23322414     } 
     2415.index li {margin-bottom: 3px;} 
    23332416.index a { 
    23342417     font-weight: bold; 
     
    25132596                                                                           UN POIL DE MEDIA QUERIES 
    25142597------------------------------------------------------------------------------------ */ 
    2515 @media screen and (max-width: 1000px) { 
     2598@media screen and (min-width: 117em) { 
     2599body { 
     2600     border: 1px solid #ccc; 
     2601     border-top-width: 0; 
     2602     } 
     2603} 
     2604@media screen and (min-width: 80em) { 
     2605html { 
     2606     background: #fff; 
     2607     } 
     2608body { 
     2609     max-width: 140em; 
     2610     margin: 0 auto; 
     2611     } 
     2612#wrapper { 
     2613     background: #F7F7F7 url(bg_wrapper.png) repeat-y 18em; 
     2614     } 
     2615#main { 
     2616     margin-left: -17em; 
     2617     } 
     2618#content { 
     2619     margin: 0 0 0 17em; 
     2620     } 
     2621#main-menu { 
     2622     width: 17em; 
     2623     } 
     2624#collapser { 
     2625     left: 17em; 
     2626     } 
     2627h1 { 
     2628     width: 19.5em; 
     2629     } 
     2630} 
     2631@media screen and (max-width: 61em) { 
    25162632#top-info-blog #switchblog { 
    25172633     max-width: 16em; 
     
    25202636     margin-left: 2em; 
    25212637     } 
    2522 } 
    2523 @media screen and (max-width: 960px) { 
    25242638#header { 
    25252639     display: block; 
     
    25612675     } 
    25622676} 
    2563 @media screen and (max-width: 700px) { 
     2677@media screen and (max-width: 48em) { 
     2678     #dashboard-boxes .box.medium, .box.medium, 
     2679     #dashboard-boxes .box.small, .box.small, 
     2680     #dashboard-boxes .box.large, .box.large { 
     2681     width: 95%; 
     2682     margin: 10px auto; 
     2683     } 
     2684} 
     2685@media screen and (max-width: 44em) { 
    25642686#help-button { 
    25652687     height: 26px; 
     
    25682690     padding: 0; 
    25692691     margin: 0; 
    2570      font-size: 10px; 
    2571      font-size: 1rem; 
     2692     font-size: .83em; 
    25722693     line-height: 68px; 
    25732694     overflow: hidden; 
     
    25762697     top: 77px; 
    25772698     } 
    2578 .one-box, .two-boxes, .two-boxes.odd, .two-boxes.even, .box, 
     2699.one-box, .two-boxes, .box, 
    25792700     .two-cols .col { 
    2580      width: 100%; 
     2701     width: 96%; 
    25812702     margin-left: 0; 
    25822703     margin-right: 0; 
    25832704     } 
     2705#entry-wrapper { 
     2706     float: none; 
     2707     width: 100%; 
     2708     margin-right: 0; 
     2709     } 
     2710#entry-content { 
     2711     margin-right: 0; 
     2712     margin-left: 0; 
     2713     } 
     2714#entry-sidebar { 
     2715     width: 100%; 
     2716     float: none; 
     2717     } 
    25842718} 
    2585 @media screen and (max-width: 600px) { 
     2719@media screen and (max-width: 38em) { 
    25862720#header h1, #header h1 a { 
    25872721     width: 42px !important; 
     
    25892723     } 
    25902724h1 a:link { 
    2591      background: transparent url(dc_logos/b-dotclear120.png) no-repeat -180px 6px; 
     2725     background: transparent url(dc_logos/b-dotclear120.png) no-repeat -270px 6px; 
    25922726     border-right: 1px solid #ccc; 
    25932727     } 
    25942728h1 a:hover, h1 a:focus { 
    2595      background: url(dc_logos/b-dotclear120.png) no-repeat -180px -94px; 
     2729     background: url(dc_logos/b-dotclear120.png) no-repeat -270px -94px; 
    25962730     border-right: 1px solid #A2CBE9; 
    25972731     } 
     
    26012735     width: 100%; 
    26022736     margin: 0; 
     2737     } 
     2738#dashboard-main { 
     2739     padding: 0; 
    26032740     } 
    26042741#main-menu a { 
     
    26172754     } 
    26182755#main #content > h2 { 
    2619      margin: 0; 
    2620      padding: 6px 30px 6px 0; 
    2621      } 
    2622 #dashboard-boxes .box.medium, 
    2623      #dashboard-boxes .box.small, 
    2624      #dashboard-boxes .box.large { 
    2625      width: 100%; 
     2756     margin: 0 -.5em 1em; 
     2757     padding: 6px 30px 4px .5em; 
     2758     } 
     2759#dashboard-boxes .box.medium, .box.medium, 
     2760     #dashboard-boxes .box.small, .box.small, 
     2761     #dashboard-boxes .box.large, .box.large { 
     2762     width: 95%; 
    26262763     margin: 10px auto; 
    26272764     } 
     2765.cell, #filters-form .cell { 
     2766     display: inline-block; 
     2767     border: none; 
     2768     padding: 1em; 
     2769     vertical-align: bottom; 
     2770     } 
    26282771} 
    2629 @media screen and (max-width: 420px) { 
     2772@media screen and (max-width: 26.5em) { 
    26302773h1, h1 a { 
    26312774     padding: 0; 
     
    26422785     margin-bottom: .5em; 
    26432786     } 
     2787#wrapper { 
     2788     font-size: 1.4em; 
     2789     } 
     2790#content.with-help #help-button { 
     2791     top: 120px; 
     2792     right: 20.5em; 
     2793     } 
     2794#content.with-help #help { 
     2795     font-size: 12px; 
     2796     } 
     2797p.top-add { 
     2798     margin-bottom: .5em; 
     2799     text-align: center; 
     2800     } 
     2801.multi-part { 
     2802     padding-left: 0; 
     2803     } 
     2804.part-tabs ul { 
     2805     margin: 1em 0; 
     2806     padding: 0 .5em; 
     2807     } 
     2808.part-tabs li a { 
     2809     display: block; 
     2810     width: 100%; 
     2811     } 
    26442812#icons p { 
    2645      width: 150px; 
    2646      } 
    2647 #content.with-help #help-button { 
    2648      top: 101px; 
     2813     width: 9em; 
     2814     padding: 1em .25em; 
     2815     } 
     2816.media-item { 
     2817     width: 90%; 
     2818     } 
     2819#theme-new, #theme-activate, #theme-deactivate { 
     2820     margin-left: 0; 
     2821     margin-right: 0; 
     2822     } 
     2823.box.current-theme { 
     2824     margin: 5px; 
     2825     padding: 10px; 
     2826     width: 100%; 
     2827     } 
     2828.current-theme .module-sshot img { 
     2829     margin: 0; 
     2830     float: none; 
     2831     max-width: 100%; 
     2832     } 
     2833table .maximal { 
     2834     min-width: 14em; 
     2835     } 
     2836th, td { 
     2837     padding: 0.3em 1em 0.3em 0; 
    26492838     } 
    26502839} 
Note: See TracChangeset for help on using the changeset viewer.

Sites map