Dotclear


Ignore:
Files:
8 added
24 edited

Legend:

Unmodified
Added
Removed
  • .hgsubstate

    r1624 r1693  
    1 f5e0517435fc94082b6acaad5f4f111252b6149f inc/libs/clearbricks 
     13811959404614e7014b897d3d3b96caad10e214f inc/libs/clearbricks 
  • admin/blog_pref.php

    r1636 r1698  
    580580               $user_url_p = '%1$s'; 
    581581          } 
    582            
     582 
     583          # Sort users list on user_id key 
     584          ksort($blog_users); 
     585 
     586          $post_type = $core->getPostTypes(); 
     587          $current_blog_id = $core->blog->id; 
     588          if ($blog_id != $core->blog->id) { 
     589               $core->setBlog($blog_id); 
     590          } 
     591 
    583592          foreach ($blog_users as $k => $v) 
    584593          { 
     
    586595               { 
    587596                    echo 
     597                    '<div class="user-perm">'. 
    588598                    '<h4>'.sprintf($user_url_p,html::escapeHTML($k)). 
    589599                    ' ('.html::escapeHTML(dcUtils::getUserCN( 
    590600                         $k, $v['name'], $v['firstname'], $v['displayname'] 
    591601                    )).')</h4>'; 
    592                      
    593                     echo '<ul class="nice">'; 
     602 
     603                    if ($core->auth->isSuperAdmin()) { 
     604                         echo  
     605                         '<p>'.__('Email:').' '. 
     606                         ($v['email'] != '' ? '<a href="mailto:'.$v['email'].'">'.$v['email'].'</a>' : __('(none)')). 
     607                         '</p>'; 
     608                    } 
     609 
     610                    echo 
     611                    '<h5>'.__('Publications on this blog:').'</h5>'. 
     612                    '<ul>'; 
     613                    foreach ($post_type as $type => $pt_info) { 
     614                         $params = array( 
     615                              'post_type' => $type, 
     616                              'user_id' => $k 
     617                              ); 
     618                         echo '<li>'.sprintf(__('%1$s: %2$s'),__($pt_info['label']),$core->blog->getPosts($params,true)->f(0)).'</li>'; 
     619                    } 
     620                    echo 
     621                    '</ul>'; 
     622 
     623                    echo 
     624                    '<h5>'.__('Permissions:').'</h5>'. 
     625                    '<ul>'; 
    594626                    if ($v['super']) { 
    595                          echo '<li>'.__('Super administrator').'</li>'; 
     627                         echo '<li class="user_super">'.__('Super administrator').'</li>'; 
    596628                    } else { 
    597629                         foreach ($v['p'] as $p => $V) { 
    598                               echo '<li>'.__($perm_types[$p]).'</li>'; 
     630                              echo '<li '.($p == 'admin' ? 'class="user_admin"' : '').'>'.__($perm_types[$p]).'</li>'; 
    599631                         } 
    600632                    } 
    601                     echo '</ul>'; 
     633                    echo  
     634                    '</ul>'; 
    602635                     
    603636                    if (!$v['super'] && $core->auth->isSuperAdmin()) { 
    604637                         echo  
    605638                         '<form action="users_actions.php" method="post">'. 
    606                          '<p><input type="submit" value="'.__('Change permissions').'" />'. 
     639                         '<p class="change-user-perm"><input type="submit" class="reset" value="'.__('Change permissions').'" />'. 
    607640                         form::hidden(array('redir'),'blog_pref.php?id='.$k). 
    608641                         form::hidden(array('action'),'perms'). 
     
    613646                         '</form>'; 
    614647                    } 
     648                    echo '</div>'; 
    615649               } 
     650          } 
     651          if ($current_blog_id != $core->blog->id) { 
     652               $core->setBlog($current_blog_id); 
    616653          } 
    617654     } 
  • admin/index.php

    r1620 r1699  
    6363     $core->auth->user_prefs->dashboard->put('quickentry',false,'boolean'); 
    6464} 
     65 
     66// Handle folded/unfolded sections in admin from user preferences 
     67$ws = $core->auth->user_prefs->addWorkspace('toggles'); 
     68if (!$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 
    6572 
    6673# Dashboard icons 
     
    210217 
    211218     if ($updater->getNotify() && $new_v) { 
    212           $message = 
    213           '<div><p>'.sprintf(__('Dotclear %s is available!'),$new_v).'</p> '. 
    214           '<ul><li><strong><a href="update.php">'.sprintf(__('Upgrade now'),$new_v).'</a></strong>'. 
    215           '</li><li><a href="update.php?hide_msg=1">'.__('Remind me later').'</a>'. 
    216           ($version_info ? ' </li><li><a href="'.$version_info.'">'.__('information about this version').'</a>' : ''). 
    217           '</li></ul></div>'; 
    218           dcPage::message($message,false,true); 
     219          echo 
     220          '<div class="dc-update"><h3>'.sprintf(__('Dotclear %s is available!'),$new_v).'</h3> '. 
     221          '<p><a class="button submit" href="update.php">'.sprintf(__('Upgrade now'),$new_v).'</a> '. 
     222          '<a href="update.php?hide_msg=1">'.__('Remind me later').'</a>'. 
     223          ($version_info ? ' </p>'. 
     224          '<p><a href="'.$version_info.'" class="info">'.__('information about this version').'</a>' : '').'</p>'. 
     225          '</div>'; 
    219226     } 
    220227} 
  • admin/js/_index.js

    r1638 r1699  
    7575     $('#quick h3').toggleWithLegend($('#quick').children().not('h3'),{ 
    7676          legend_click: true, 
    77           cookie: 'dcx_quick_entry' 
     77          user_pref: 'dcx_quick_entry' 
    7878     }); 
    7979}); 
  • admin/js/_post.js

    r1712 r1714  
    120120          // Hide some fields 
    121121          $('#notes-area label').toggleWithLegend($('#notes-area').children().not('label'),{ 
    122                cookie: 'dcx_post_notes', 
     122               user_pref: 'dcx_post_notes', 
    123123               legend_click:true, 
    124124               hide: $('#post_notes').val() == '' 
     
    129129          }); 
    130130          $('#post_lang').parent().children('label').toggleWithLegend($('#post_lang'),{ 
    131                cookie: 'dcx_post_lang', 
     131               user_pref: 'dcx_post_lang', 
    132132               legend_click: true 
    133133          }); 
    134134          $('#post_password').parent().children('label').toggleWithLegend($('#post_password'),{ 
    135                cookie: 'dcx_post_password', 
     135               user_pref: 'dcx_post_password', 
    136136               legend_click: true, 
    137137               hide: $('#post_password').val() == '' 
    138138          }); 
    139139          $('#post_status').parent().children('label').toggleWithLegend($('#post_status'),{ 
    140                cookie: 'dcx_post_status', 
     140               user_pref: 'dcx_post_status', 
    141141               legend_click: true 
    142142          }); 
    143143          $('#post_dt').parent().children('label').toggleWithLegend($('#post_dt').parent().children().not('label'),{ 
    144                cookie: 'dcx_post_dt', 
     144               user_pref: 'dcx_post_dt', 
    145145               legend_click: true 
    146146          }); 
    147147          $('#label_format').toggleWithLegend($('#label_format').parent().children().not('#label_format'),{ 
    148                cookie: 'dcx_post_format', 
     148               user_pref: 'dcx_post_format', 
    149149               legend_click: true 
    150150          }); 
    151151          $('#cat_id').parent().children('label').toggleWithLegend($('#cat_id'),{ 
    152                cookie: 'cat_id', 
     152               user_pref: 'cat_id', 
    153153               legend_click: true 
    154154          }); 
     
    158158          }); 
    159159          $('#post_url').parent().children('label').toggleWithLegend($('#post_url').parent().children().not('label'),{ 
    160                cookie: 'post_url', 
     160               user_pref: 'post_url', 
    161161               legend_click: true 
    162162          }); 
    163163          // We load toolbar on excerpt only when it's ready 
    164164          $('#excerpt-area label').toggleWithLegend($('#excerpt-area').children().not('label'),{ 
    165                cookie: 'dcx_post_excerpt', 
     165               user_pref: 'dcx_post_excerpt', 
    166166               legend_click: true, 
    167167               hide: $('#post_excerpt').val() == '' 
  • admin/js/common.js

    r1635 r1699  
    6363          img_off_src: dotclear.img_minus_src, 
    6464          img_off_alt: dotclear.img_minus_alt, 
     65          unfolded_sections: dotclear.unfolded_sections, 
    6566          hide: true, 
    6667          speed: 0, 
    6768          legend_click: false, 
    6869          fn: false, // A function called on first display, 
    69           cookie: false, 
    70           reverse_cookie: false // Reverse cookie behavior 
     70          user_pref: false, 
     71          reverse_user_pref: false, // Reverse cookie behavior 
     72          user_pref:false, 
     73          reverse_user_pref: false 
    7174     }; 
    7275     var p = jQuery.extend(defaults,s); 
     
    7881          p.hide = p.reverse_cookie; 
    7982     } 
    80  
     83      
     84     var set_user_pref = p.hide ^ p.reverse_user_pref; 
     85     if (p.user_pref && (p.user_pref in p.unfolded_sections)) { 
     86          p.hide = p.reverse_user_pref; 
     87     } 
    8188     var toggle = function(i,speed) { 
    8289          speed = speed || 0; 
     
    102109               } 
    103110          } 
    104  
    105111          p.hide = !p.hide; 
    106112     }; 
     
    125131          } 
    126132          $(ctarget).click(function() { 
     133               if (p.user_pref && set_user_pref) { 
     134                    if (p.hide ^ p.reverse_user_pref) { 
     135                         jQuery.post('services.php',  
     136                              {'f':'setSectionFold','section':p.user_pref,'value':1,xd_check: dotclear.nonce}, 
     137                              function(data) {}); 
     138                    } else { 
     139                         jQuery.post('services.php',  
     140                              {'f':'setSectionFold','section':p.user_pref,'value':0,xd_check: dotclear.nonce}, 
     141                              function(data) {}); 
     142                    } 
     143                    jQuery.cookie(p.user_pref,'',{expires: -1}); 
     144               } 
    127145               toggle(i,p.speed); 
    128146               return false; 
     
    348366     } 
    349367     $('#blog-menu h3:first').toggleWithLegend($('#blog-menu ul:first'), 
    350           $.extend({cookie:'dc_blog_menu'},menu_settings) 
     368          $.extend({user_pref:'dc_blog_menu'},menu_settings) 
    351369     ); 
    352370     $('#system-menu h3:first').toggleWithLegend($('#system-menu ul:first'), 
    353           $.extend({cookie:'dc_system_menu'},menu_settings) 
     371          $.extend({user_pref:'dc_system_menu'},menu_settings) 
    354372     ); 
    355373     $('#plugins-menu h3:first').toggleWithLegend($('#plugins-menu ul:first'), 
    356           $.extend({cookie:'dc_plugins_menu'},menu_settings) 
     374          $.extend({user_pref:'dc_plugins_menu'},menu_settings) 
    357375     ); 
    358376     $('#favorites-menu h3:first').toggleWithLegend($('#favorites-menu ul:first'), 
    359           $.extend({cookie:'dc_favorites_menu',hide:false,reverse_cookie:true},menu_settings) 
     377          $.extend({user_pref:'dc_favorites_menu',hide:false,reverse_user_pref:true},menu_settings) 
    360378     ); 
    361379 
  • admin/media.php

    r1678 r1681  
    231231$core->auth->user_prefs->addWorkspace('interface'); 
    232232$user_ui_enhanceduploader = $core->auth->user_prefs->interface->enhanceduploader; 
    233  
    234233 
    235234if (!isset($core->media)) { 
     
    343342if ($core_media_writable) 
    344343{ 
    345      echo '<div class="two-cols">'; 
     344     echo  
     345     '<h3>'.sprintf(__('In %s:'),($d == '' ? '“'.__('Media manager').'”' : '“'.$d.'”')).'</h3>'. 
     346     '<div class="media-action-box">'; 
    346347      
    347348     if ($user_ui_enhanceduploader) { 
    348349          echo 
    349           '<div class="col enhanced_uploader">'; 
     350          '<div class="enhanced_uploader">'; 
    350351     } else { 
    351352          echo 
    352           '<div class="col">'; 
    353      } 
    354  
    355      echo 
    356      '<div class="fieldset">'. 
    357      '<h3>'.__('Add files').'</h3>'. 
     353          '<div>'; 
     354     } 
     355 
     356     echo 
     357     '<h4>'.__('Add files').'</h4>'. 
    358358     '<p>'.__('Please take care to publish media that you own and that are not protected by copyright.').'</p>'. 
    359359     '<p class="max-sizer form-note info">&nbsp;'.__('Maximum file size allowed:').' '.files::size(DC_MAX_UPLOAD_SIZE).'</p>'. 
     
    391391     '<p style="clear:both;">'.form::hidden(array('d'),$d).'</p>'. 
    392392     '</form>'. 
    393      '</div></div>'; 
    394  
    395      echo 
    396      '<div class="col">'. 
    397      '<form class="clear fieldset" action="'.html::escapeURL($page_url).'" method="post">'. 
     393     '</div>'. 
     394     '</div>'; 
     395 
     396     echo 
     397     '<div class="media-action-box">'. 
     398     '<form action="'.html::escapeURL($page_url).'" method="post">'. 
    398399     '<div id="new-dir-f">'. 
    399      '<h3>'.__('New directory').'</h3>'. 
     400     '<h4>'.__('Create new directory').'</h4>'. 
    400401     $core->formNonce(). 
    401402     '<p><label for="newdir">'.__('Directory Name:').'</label>'. 
     
    404405     form::hidden(array('d'),html::escapeHTML($d)).'</p>'. 
    405406     '</div>'. 
    406      '</form></div>'; 
    407       
    408      echo '</div>'; 
    409 } 
     407     '</form>'. 
     408     '</div>'; 
     409     } 
    410410 
    411411# Empty remove form (for javascript actions) 
    412412echo 
    413 '<form id="media-remove-hide" action="'.html::escapeURL($page_url).'" method="post"><div class="clear">'. 
     413'<form id="media-remove-hide" action="'.html::escapeURL($page_url).'" method="post" class="hidden">'. 
     414'<div>'. 
    414415form::hidden('rmyes',1).form::hidden('d',html::escapeHTML($d)). 
    415416form::hidden('remove',''). 
    416417$core->formNonce(). 
    417 '</div></form>'; 
     418'</div>'. 
     419'</form>'; 
    418420 
    419421# Get zip directory 
     
    422424{ 
    423425     echo 
    424      '<p class="zip-dl"><a class="submit" href="'.html::escapeURL($page_url).'&amp;zipdl=1">'. 
    425      __('Download this directory as a zip file').'</a></p>'; 
     426     '<div class="media-action-box">'. 
     427     '<h4>'.__('Backup content').'</h4>'. 
     428     '<p>'.__('Compress this directory with its content as a zip file and download it.').'</p>'. 
     429     '<p><a class="submit" href="'.html::escapeURL($page_url).'&amp;zipdl=1">'. 
     430     __('Download').'</a></p>'. 
     431     '</div>'; 
    426432} 
    427433 
  • admin/post.php

    r1711 r1714  
    518518          "post_excerpt" => 
    519519               '<p class="area" id="excerpt-area"><label for="post_excerpt">'.__('Excerpt:').'<span class="form-note">'. 
    520                __('Add an introduction to the post.').'</span></label> '. 
     520               __('Introduction to the post.').'</span></label> '. 
    521521               form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt)). 
    522522               '</p>', 
     
    530530          "post_notes" => 
    531531               '<p class="area" id="notes-area"><label for="post_notes">'.__('Personal notes:').'<span class="form-note">'. 
    532                __('Add unpublished notes.').'</span></label>'. 
     532               __('Unpublished notes.').'</span></label>'. 
    533533               form::textarea('post_notes',50,5,html::escapeHTML($post_notes)). 
    534534               '</p>' 
  • admin/services.php

    r1538 r1699  
    2626$core->rest->addFunction('setPostMeta',array('dcRestMethods','setPostMeta')); 
    2727$core->rest->addFunction('searchMeta',array('dcRestMethods','searchMeta')); 
     28$core->rest->addFunction('setSectionFold',array('dcRestMethods','setSectionFold')); 
    2829 
    2930$core->rest->serve(); 
     
    412413          return $rsp; 
    413414     } 
     415      
     416     public static function setSectionFold($core,$get,$post) 
     417     { 
     418          if (empty($post['section'])) { 
     419               throw new Exception('No section name'); 
     420          } 
     421          if ($core->auth->user_prefs->toggles === null) { 
     422               $core->auth->user_prefs->addWorkspace('toggles'); 
     423          } 
     424          $section = $post['section']; 
     425          $status = isset($post['value']) && ($post['value'] != 0); 
     426          if ($core->auth->user_prefs->toggles->prefExists('unfolded_sections')) { 
     427               $toggles = explode(',',trim($core->auth->user_prefs->toggles->unfolded_sections)); 
     428          } else { 
     429               $toggles = array(); 
     430          } 
     431          $k = array_search($section,$toggles); 
     432          if ($status) { // true == Fold section ==> remove it from unfolded list 
     433               if ($k !== false) { 
     434                    unset($toggles[$k]); 
     435               }  
     436          } else { // false == unfold section ==> add it to unfolded list 
     437               if ($k === false) { 
     438                    $toggles[]=$section; 
     439               };  
     440          } 
     441          $core->auth->user_prefs->toggles->put('unfolded_sections',join(',',$toggles)); 
     442          return true; 
     443     } 
     444           
     445      
    414446} 
    415447?> 
  • admin/style/default.css

    r1678 r1698  
    797797     border: none; 
    798798} 
    799 .media-item { 
     799.media-item, .media-action-box { 
    800800     position: relative; 
    801801     border: 1px solid #ccc; 
     
    803803     padding: 1em; 
    804804     width: 300px; 
    805      height: 120px; 
    806805     display: inline-block; 
    807806     vertical-align: top; 
    808 } 
    809 div.media-list .media-item { 
     807     min-height: 120px 
    810808} 
    811809a.media-icon { 
     
    905903     margin-left: 0; 
    906904} 
     905/* in blog_pref */ 
     906.user-perm { 
     907     margin: 2em 0px; 
     908     background: transparent url(user.png) no-repeat left top; 
     909     width: 320px; 
     910     display: inline-block; 
     911     vertical-align: top; 
     912} 
     913.user-perm h4, .user-perm h5, .user-perm p, .user-perm ul, .user-perm li { 
     914     margin: .5em 0 .33em; 
     915     padding: 0; 
     916} 
     917.user-perm h4 { 
     918     padding-left: 28px; 
     919} 
     920.user-perm ul { 
     921     list-style-type: inside; 
     922} 
     923.user-perm li { 
     924     margin-left: 1em; 
     925     padding-left: 0; 
     926} 
     927.user-perm h5 { 
     928     margin:   1em 0 0 0; 
     929} 
     930li.user_super, li.user_admin { 
     931     margin-left: 0; 
     932     padding-left: 1em; 
     933     list-style: none; 
     934     background: transparent url(../images/superadmin.png) no-repeat -2px 2px; 
     935} 
     936li.user_admin { 
     937     background-image: url(../images/admin.png); 
     938} 
     939 
    907940/* -------------------------------------------------------------------- Themes */ 
    908941#themes { 
     
    11621195.success a { 
    11631196     color: #666; 
     1197} 
     1198.dc-update { 
     1199     padding: 1em 48px 0.5em 48px; 
     1200     margin-bottom: 1em; 
     1201     border-radius: 8px; 
     1202     background: #A2CBE9 url(msg-success.png) no-repeat .7em .7em; 
     1203} 
     1204.dc-update a { 
     1205     color: #000; 
     1206     border-color: #000; 
     1207     margin-right: 1em; 
     1208} 
     1209a.info { 
     1210     margin-left: 2em; 
     1211     font-weight: bold; 
    11641212} 
    11651213/* ------------------------------------------------------------------ navigation */ 
  • admin/style/jsToolBar/jsToolBar.css

    r1636 r1697  
    4848     width: 12em; 
    4949     margin-right: .6rem; 
     50     border: 1px solid #ccc;  
    5051} 
    5152.jstElements button { 
     
    7172     background: #dfdfdf; 
    7273} 
    73  
    74 .jstSpacer { 
    75      width : 2px; 
     74span.jstSpacer { 
     75     width : 6px; 
    7676     height: 28px; 
    7777     margin-right: 0; 
  • inc/admin/lib.dc.page.php

    r1655 r1699  
    114114          echo 
    115115          self::jsCommon(). 
     116          self::jsToggles(). 
    116117          $head; 
    117118 
     
    253254          echo 
    254255          self::jsCommon(). 
     256          self::jsToggles(). 
    255257          $head; 
    256258 
     
    444446     } 
    445447 
     448     public static function jsToggles() 
     449     { 
     450          if($GLOBALS['core']->auth->user_prefs->toggles) { 
     451               $unfolded_sections = explode(',',$GLOBALS['core']->auth->user_prefs->toggles->unfolded_sections); 
     452               foreach ($unfolded_sections as $k=>&$v) { 
     453                    if ($v == '') { 
     454                         unset($unfolded_sections[$k]); 
     455                    } else { 
     456                         $v = "'".html::escapeJS($v)."':true"; 
     457                    } 
     458               } 
     459          } else { 
     460               $unfolded_sections=array(); 
     461          } 
     462          return '<script type="text/javascript">'."\n". 
     463                         "//<![CDATA[\n". 
     464                         'dotclear.unfolded_sections = {'.join(",",$unfolded_sections)."};\n". 
     465                         "\n//]]>\n". 
     466                    "</script>\n"; 
     467     } 
     468      
    446469     public static function jsCommon() 
    447470     { 
     
    544567          self::jsVar('dotclear.msg.load_enhanced_uploader', 
    545568               __('Loading enhanced uploader, please wait.')). 
    546           "\n//]]>\n". 
     569               "\n//]]>\n". 
    547570          "</script>\n"; 
    548571     } 
     
    792815} 
    793816 
     817public static function jsToolMan() 
     818{ 
     819     return 
     820     '<script type="text/javascript" src="js/tool-man/core.js"></script>'. 
     821     '<script type="text/javascript" src="js/tool-man/events.js"></script>'. 
     822     '<script type="text/javascript" src="js/tool-man/css.js"></script>'. 
     823     '<script type="text/javascript" src="js/tool-man/coordinates.js"></script>'. 
     824     '<script type="text/javascript" src="js/tool-man/drag.js"></script>'. 
     825     '<script type="text/javascript" src="js/tool-man/dragsort.js"></script>'. 
     826     '<script type="text/javascript" src="js/dragsort-tablerows.js"></script>'; 
     827} 
     828 
    794829public static function jsMetaEditor() 
    795830{ 
  • inc/core/class.dc.blog.php

    r1620 r1689  
    199199     /** 
    200200     Updates comments and trackbacks counters in post table. Should be called 
    201      every time comments or trackbacks are added, removed or changed there status. 
     201     every time comments or trackbacks are added, removed or changed their status. 
    202202      
    203203     @param    ids       <b>mixed</b>        Comment(s) ID(s) 
     
    18801880     - cat_id: (integer or array) Get comments belonging to entries of given category ID 
    18811881     - comment_id: (integer) Get comment with given ID 
     1882     - comment_site: (string) Get comments with given comment_site 
    18821883     - comment_status: (integer) Get comments with given comment_status 
    18831884     - comment_trackback: (integer) Get only comments (0) or trackbacks (1) 
     
    19691970          if (isset($params['comment_id']) && $params['comment_id'] !== '') { 
    19701971               $strReq .= 'AND comment_id = '.(integer) $params['comment_id'].' '; 
     1972          } 
     1973           
     1974          if (isset($params['comment_site'])) { 
     1975               $comment_site = $this->con->escape(str_replace('*','%',$params['comment_site'])); 
     1976               $strReq .= "AND comment_site LIKE '".$comment_site."' "; 
    19711977          } 
    19721978           
  • inc/core/class.dc.core.php

    r1593 r1698  
    345345     } 
    346346      
    347      public function setPostType($type,$admin_url,$public_url) 
     347     public function setPostType($type,$admin_url,$public_url,$label='') 
    348348     { 
    349349          $this->post_types[$type] = array( 
    350350               'admin_url' => $admin_url, 
    351                'public_url' => $public_url 
     351               'public_url' => $public_url, 
     352               'label' => ($label != '' ? $label : $type) 
    352353          ); 
    353354     } 
     
    817818          $strReq = 
    818819          'SELECT U.user_id AS user_id, user_super, user_name, user_firstname, '. 
    819           'user_displayname, permissions '. 
     820          'user_displayname, user_email, permissions '. 
    820821          'FROM '.$this->prefix.'user U '. 
    821822          'JOIN '.$this->prefix.'permissions P ON U.user_id = P.user_id '. 
     
    826827               'UNION '. 
    827828               'SELECT U.user_id AS user_id, user_super, user_name, user_firstname, '. 
    828                "user_displayname, NULL AS permissions ". 
     829               "user_displayname, user_email, NULL AS permissions ". 
    829830               'FROM '.$this->prefix.'user U '. 
    830831               'WHERE user_super = 1 '; 
     
    841842                    'firstname' => $rs->user_firstname, 
    842843                    'displayname' => $rs->user_displayname, 
     844                    'email' => $rs->user_email, 
    843845                    'super' => (boolean) $rs->user_super, 
    844846                    'p' => $this->auth->parsePermissions($rs->permissions) 
  • inc/core/class.dc.trackback.php

    r1674 r1689  
    1414/** 
    1515@ingroup DC_CORE 
    16 @brief Trackbacks sender and server 
    17  
    18 Sends and receives trackbacks. Also handles trackbacks auto discovery. 
     16@brief Trackbacks/Pingbacks sender and server 
     17 
     18Sends and receives trackbacks/pingbacks. Also handles trackbacks/pingbacks auto discovery. 
    1919*/ 
    2020class dcTrackback 
     
    146146     } 
    147147     //@} 
     148      
     149     private function pingAlreadyDone($post_id, $from_url) 
     150     { 
     151          $params = array( 
     152               'post_id' => $post_id, 
     153               'comment_site' => $from_url, 
     154               'comment_trackback' => 1, 
     155          ); 
     156           
     157          $rs = $this->core->blog->getComments($params, true); 
     158          if ($rs && !$rs->isEmpty()) { 
     159               return ($rs->f(0)); 
     160          } 
     161           
     162          return false; 
     163     } 
     164      
     165     private function addBacklink($post_id, $url, $blog_name, $title, $excerpt, &$comment) 
     166     { 
     167          if (empty($blog_name)) { 
     168               $blog_name = 'Anonymous blog'; 
     169          } 
     170           
     171          $comment = 
     172          "<!-- TB -->\n". 
     173          '<p><strong>'.($title ? $title : $blog_name)."</strong></p>\n". 
     174          '<p>'.$excerpt.'</p>'; 
     175           
     176          $cur = $this->core->con->openCursor($this->core->prefix.'comment'); 
     177          $cur->comment_author = (string) $blog_name; 
     178          $cur->comment_site = (string) $url; 
     179          $cur->comment_content = (string) $comment; 
     180          $cur->post_id = $post_id; 
     181          $cur->comment_trackback = 1; 
     182          $cur->comment_status = $this->core->blog->settings->system->trackbacks_pub ? 1 : -1; 
     183          $cur->comment_ip = http::realIP(); 
     184           
     185          # --BEHAVIOR-- publicBeforeTrackbackCreate 
     186          $this->core->callBehavior('publicBeforeTrackbackCreate',$cur); 
     187          if ($cur->post_id) { 
     188               $comment_id = $this->core->blog->addComment($cur); 
     189                
     190               # --BEHAVIOR-- publicAfterTrackbackCreate 
     191               $this->core->callBehavior('publicAfterTrackbackCreate',$cur,$comment_id); 
     192          } 
     193     } 
    148194      
    149195     /// @name Receive trackbacks 
     
    176222          $charset = ''; 
    177223          $comment = ''; 
    178            
     224                     
    179225          $err = false; 
    180226          $msg = ''; 
     
    209255                    $msg = 'Trackbacks are not allowed for this post or weblog.'; 
    210256               } 
     257 
     258               $url = trim(html::clean($url)); 
     259               if ($this->pingAlreadyDone($post->post_id, $url)) { 
     260                    $err = true; 
     261                    $msg = 'The trackback has already been registered'; 
     262               } 
    211263          } 
    212264           
     
    216268                
    217269               if (!$charset) { 
    218                     $charset = mb_detect_encoding($title.' '.$excerpt.' '.$blog_name, 
    219                     'UTF-8,ISO-8859-1,ISO-8859-2,ISO-8859-3,'. 
    220                     'ISO-8859-4,ISO-8859-5,ISO-8859-6,ISO-8859-7,ISO-8859-8,'. 
    221                     'ISO-8859-9,ISO-8859-10,ISO-8859-13,ISO-8859-14,ISO-8859-15'); 
     270                    $charset = self::detectCharset($title.' '.$excerpt.' '.$blog_name); 
    222271               } 
    223272                
     
    244293               $blog_name = text::cutString($blog_name,60); 
    245294                
    246                $url = trim(html::clean($url)); 
    247                 
    248                if (!$blog_name) { 
    249                     $blog_name = 'Anonymous blog'; 
    250                } 
    251                 
    252                $comment = 
    253                "<!-- TB -->\n". 
    254                '<p><strong>'.($title ? $title : $blog_name)."</strong></p>\n". 
    255                '<p>'.$excerpt.'</p>'; 
    256                 
    257                $cur = $this->core->con->openCursor($this->core->prefix.'comment'); 
    258                $cur->comment_author = (string) $blog_name; 
    259                $cur->comment_site = (string) $url; 
    260                $cur->comment_content = (string) $comment; 
    261                $cur->post_id = $post_id; 
    262                $cur->comment_trackback = 1; 
    263                $cur->comment_status = $this->core->blog->settings->system->trackbacks_pub ? 1 : -1; 
    264                $cur->comment_ip = http::realIP(); 
    265                 
    266295               try 
    267296               { 
    268                     # --BEHAVIOR-- publicBeforeTrackbackCreate 
    269                     $this->core->callBehavior('publicBeforeTrackbackCreate',$cur); 
    270                     if ($cur->post_id) { 
    271                          $comment_id = $this->core->blog->addComment($cur); 
    272                           
    273                          # --BEHAVIOR-- publicAfterTrackbackCreate 
    274                          $this->core->callBehavior('publicAfterTrackbackCreate',$cur,$comment_id); 
    275                     } 
     297                    $this->addBacklink($post_id, $url, $blog_name, $title, $excerpt, $comment); 
    276298               } 
    277299               catch (Exception $e) 
     
    281303               } 
    282304          } 
    283            
    284            
    285           $debug_trace = 
    286           "  <debug>\n". 
    287           '    <title>'.$title."</title>\n". 
    288           '    <excerpt>'.$excerpt."</excerpt>\n". 
    289           '    <url>'.$url."</url>\n". 
    290           '    <blog_name>'.$blog_name."</blog_name>\n". 
    291           '    <charset>'.$charset."</charset>\n". 
    292           '    <comment>'.$comment."</comment>\n". 
    293           "  </debug>\n"; 
    294305           
    295306          $resp = 
     
    303314           
    304315          if (!empty($_POST['__debug'])) { 
    305                $resp .= $debug_trace; 
     316               $resp .=  
     317               "  <debug>\n". 
     318               '    <title>'.$title."</title>\n". 
     319               '    <excerpt>'.$excerpt."</excerpt>\n". 
     320               '    <url>'.$url."</url>\n". 
     321               '    <blog_name>'.$blog_name."</blog_name>\n". 
     322               '    <charset>'.$charset."</charset>\n". 
     323               '    <comment>'.$comment."</comment>\n". 
     324               "  </debug>\n"; 
    306325          } 
    307326           
     
    362381          } 
    363382 
     383          if ($this->pingAlreadyDone($posts->post_id, $from_url)) { 
     384               throw new Exception(__('Don\'t repeat yourself, please.'), 48); 
     385          } 
     386           
    364387          # OK. We've found our champion. Time to check the remote part. 
    365388          try { 
     
    381404               $remote_content = $http->getContent(); 
    382405 
    383                $charset = mb_detect_encoding($remote_content, 
    384                     'UTF-8,ISO-8859-1,ISO-8859-2,ISO-8859-3,'. 
    385                     'ISO-8859-4,ISO-8859-5,ISO-8859-6,ISO-8859-7,ISO-8859-8,'. 
    386                     'ISO-8859-9,ISO-8859-10,ISO-8859-13,ISO-8859-14,ISO-8859-15'); 
    387  
     406               $charset = self::getCharsetFromRequest($http->getHeader('content-type')); 
     407 
     408               if (!$charset) { 
     409                    $charset = self::detectCharset($remote_content); 
     410               } 
     411                
    388412               if (strtolower($charset) != 'utf-8') { 
    389413                    $remote_content = iconv($charset,'UTF-8',$remote_content); 
     
    416440               } 
    417441               if ($excerpt) { 
    418                     $excerpt = '(&#8230;) '.text::cutString(html::escapeHTML($excerpt),255).' (&#8230;)'; 
     442                    $excerpt = '(&#8230;) '.text::cutString(html::escapeHTML($excerpt),200).' (&#8230;)'; 
    419443               } 
    420444               else { 
    421                     $excerpt = '(??)'; 
    422                } 
    423  
    424                $comment = 
    425                "<!-- TB -->\n". 
    426                '<p><strong>'.$title."</strong></p>\n". 
    427                '<p>'.$excerpt.'</p>'; 
    428                 
    429                $cur = $this->core->con->openCursor($this->core->prefix.'comment'); 
    430                $cur->comment_author = 'Anonymous blog'; 
    431                $cur->comment_site = (string) $from_url; 
    432                $cur->comment_content = (string) $comment; 
    433                $cur->post_id = $posts->post_id; 
    434                $cur->comment_trackback = 1; 
    435                $cur->comment_status = $this->core->blog->settings->system->trackbacks_pub ? 1 : -1; 
    436                $cur->comment_ip = http::realIP(); 
    437                 
    438                # --BEHAVIOR-- publicBeforeTrackbackCreate 
    439                $this->core->callBehavior('publicBeforeTrackbackCreate',$cur); 
    440                if ($cur->post_id) { 
    441                     $comment_id = $this->core->blog->addComment($cur); 
    442                      
    443                     # --BEHAVIOR-- publicAfterTrackbackCreate 
    444                     $this->core->callBehavior('publicAfterTrackbackCreate',$cur,$comment_id); 
    445                } 
     445                    $excerpt = '(&#8230;)'; 
     446               } 
     447 
     448               $this->addBacklink($posts->post_id, $from_url, '', $title, $excerpt, $comment); 
    446449          } 
    447450          catch (Exception $e) { 
     
    464467     } 
    465468      
    466      private static function getCharsetFromRequest() 
    467      { 
    468           if (isset($_SERVER['CONTENT_TYPE'])) 
    469           { 
    470                if (preg_match('|charset=([a-zA-Z0-9-]+)|',$_SERVER['CONTENT_TYPE'],$m)) { 
     469     private static function getCharsetFromRequest($header = '') 
     470     { 
     471          if (!$header && isset($_SERVER['CONTENT_TYPE'])) { 
     472               $header = $_SERVER['CONTENT_TYPE']; 
     473          } 
     474           
     475          if ($header) { 
     476               if (preg_match('|charset=([a-zA-Z0-9-]+)|',$header,$m)) { 
    471477                    return $m[1]; 
    472478               } 
     
    475481          return null; 
    476482     } 
    477       
     483 
     484     private static function detectCharset($string) 
     485     { 
     486          return mb_detect_encoding($remote_content, 
     487                    'UTF-8,ISO-8859-1,ISO-8859-2,ISO-8859-3,'. 
     488                    'ISO-8859-4,ISO-8859-5,ISO-8859-6,ISO-8859-7,ISO-8859-8,'. 
     489                    'ISO-8859-9,ISO-8859-10,ISO-8859-13,ISO-8859-14,ISO-8859-15'); 
     490     } 
     491           
    478492     /// @name Trackbacks auto discovery 
    479493     //@{ 
  • inc/core/class.dc.xmlrpc.php

    r1674 r1688  
    16441644               throw new Exception(__('No valid source URL provided? Try again!'), 0); 
    16451645          } 
    1646            
     1646 
     1647          if (!(filter_var($to_url, FILTER_VALIDATE_URL) && preg_match('!^https?://!',$to_url))) { 
     1648               throw new Exception(__('No valid target URL provided? Try again!'), 0); 
     1649          } 
     1650 
     1651          if (html::sanitizeURL(urldecode($from_url)) == html::sanitizeURL(urldecode($to_url))) { 
     1652               throw new Exception(__('LOL!'), 0); 
     1653          } 
     1654           
     1655          # Time to get things done... 
    16471656          $this->setBlog(true); 
    16481657          $tb = new dcTrackback($this->core); 
  • inc/prepend.php

    r1468 r1694  
    220220$core->url->register('xmlrpc','xmlrpc','^xmlrpc/(.+)$',array('dcUrlHandlers','xmlrpc')); 
    221221 
    222 $core->setPostType('post','post.php?id=%d',$core->url->getURLFor('post','%s')); 
     222$core->setPostType('post','post.php?id=%d',$core->url->getURLFor('post','%s'),'Posts'); 
    223223 
    224224# Store upload_max_filesize in bytes 
  • locales/fr/main.po

    r1678 r1697  
    30383038msgstr "Billet précédent" 
    30393039 
    3040 msgid "Add an introduction to the post." 
    3041 msgstr "Ajoute une introduction au billet." 
    3042  
    3043 msgid "Add unpublished notes." 
    3044 msgstr "Ajoute des notes non publiées." 
     3040msgid "Introduction to the post." 
     3041msgstr "Introduction au billet." 
     3042 
     3043msgid "Unpublished notes." 
     3044msgstr "Notes non publiées." 
    30453045 
    30463046msgid "Edit basename:" 
     
    32863286msgstr "Modifier le %1$s de %2$s" 
    32873287 
    3288 msgid "Backup" 
    3289 msgstr "Sauvegarde" 
     3288msgid "Backup content" 
     3289msgstr "Sauvegarder le contenu" 
     3290 
     3291msgid "Create new directory" 
     3292msgstr "Créer un répertoire" 
     3293 
     3294msgid "In %s:" 
     3295msgstr "Dans %s :" 
     3296 
     3297msgid "Download" 
     3298msgstr "Télécharger" 
     3299 
     3300msgid "Compress this directory with its content as a zip file and download it." 
     3301msgstr "Compressez ce dossier et son contenu dans un fichier zip et téléchargez-le." 
     3302 
     3303msgid "Permissions:" 
     3304msgstr "Permissions :" 
     3305 
     3306msgid "Publications on this blog:" 
     3307msgstr "Publications sur ce blog :" 
     3308 
     3309msgid "Posts" 
     3310msgstr "Billets" 
     3311 
     3312msgid "%1$s: %2$s" 
     3313msgstr "%1$s : %2$s" 
  • locales/fr/plugins.po

    r1669 r1694  
    19871987msgid "Drag widgets here to remove them from this sidebar." 
    19881988msgstr "Glisser les widgets ici pour les retirer du volet." 
     1989 
     1990msgid "Pages" 
     1991msgstr "Pages" 
  • plugins/attachments/js/post.js

    r1606 r1699  
    11$(function() { 
    22     $('h5.s-attachments').toggleWithLegend($('.s-attachments').not('h5'),{ 
    3           cookie: 'dcx_attachments', 
     3          user_pref: 'dcx_attachments', 
    44          legend_click: true 
    55     }); 
  • plugins/pages/_prepend.php

    r1179 r1694  
    1717$core->url->register('pagespreview','pagespreview','^pagespreview/(.+)$',array('urlPages','pagespreview')); 
    1818 
    19 $core->setPostType('page','plugin.php?p=pages&act=page&id=%d',$core->url->getURLFor('pages','%s')); 
     19$core->setPostType('page','plugin.php?p=pages&act=page&id=%d',$core->url->getURLFor('pages','%s'),'Pages'); 
    2020 
    2121# We should put this as settings later 
  • plugins/pings/post.js

    r1606 r1699  
    1313          } 
    1414          $('h5.ping-services').toggleWithLegend($('p.ping-services'),{ 
    15                cookie: 'dcx_ping_services', 
     15               user_pref: 'dcx_ping_services', 
    1616               legend_click: true 
    1717          }); 
  • plugins/tags/js/post.js

    r1606 r1699  
    6060 
    6161     $('h5 .s-tags').toggleWithLegend($('.s-tags').not('label'),{ 
    62           cookie: 'post_tags', 
     62          user_pref: 'post_tags', 
    6363          legend_clik: true 
    6464     }); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map