Changes in [1713:e29741a2433d:1714:28737e5f6607]
- Files:
-
- 8 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
.hgsubstate
r1624 r1693 1 f5e0517435fc94082b6acaad5f4f111252b6149f inc/libs/clearbricks1 3811959404614e7014b897d3d3b96caad10e214f inc/libs/clearbricks -
admin/blog_pref.php
r1636 r1698 580 580 $user_url_p = '%1$s'; 581 581 } 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 583 592 foreach ($blog_users as $k => $v) 584 593 { … … 586 595 { 587 596 echo 597 '<div class="user-perm">'. 588 598 '<h4>'.sprintf($user_url_p,html::escapeHTML($k)). 589 599 ' ('.html::escapeHTML(dcUtils::getUserCN( 590 600 $k, $v['name'], $v['firstname'], $v['displayname'] 591 601 )).')</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>'; 594 626 if ($v['super']) { 595 echo '<li >'.__('Super administrator').'</li>';627 echo '<li class="user_super">'.__('Super administrator').'</li>'; 596 628 } else { 597 629 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>'; 599 631 } 600 632 } 601 echo '</ul>'; 633 echo 634 '</ul>'; 602 635 603 636 if (!$v['super'] && $core->auth->isSuperAdmin()) { 604 637 echo 605 638 '<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').'" />'. 607 640 form::hidden(array('redir'),'blog_pref.php?id='.$k). 608 641 form::hidden(array('action'),'perms'). … … 613 646 '</form>'; 614 647 } 648 echo '</div>'; 615 649 } 650 } 651 if ($current_blog_id != $core->blog->id) { 652 $core->setBlog($current_blog_id); 616 653 } 617 654 } -
admin/index.php
r1620 r1699 63 63 $core->auth->user_prefs->dashboard->put('quickentry',false,'boolean'); 64 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 65 72 66 73 # Dashboard icons … … 210 217 211 218 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>'; 219 226 } 220 227 } -
admin/js/_index.js
r1638 r1699 75 75 $('#quick h3').toggleWithLegend($('#quick').children().not('h3'),{ 76 76 legend_click: true, 77 cookie: 'dcx_quick_entry'77 user_pref: 'dcx_quick_entry' 78 78 }); 79 79 }); -
admin/js/_post.js
r1712 r1714 120 120 // Hide some fields 121 121 $('#notes-area label').toggleWithLegend($('#notes-area').children().not('label'),{ 122 cookie: 'dcx_post_notes',122 user_pref: 'dcx_post_notes', 123 123 legend_click:true, 124 124 hide: $('#post_notes').val() == '' … … 129 129 }); 130 130 $('#post_lang').parent().children('label').toggleWithLegend($('#post_lang'),{ 131 cookie: 'dcx_post_lang',131 user_pref: 'dcx_post_lang', 132 132 legend_click: true 133 133 }); 134 134 $('#post_password').parent().children('label').toggleWithLegend($('#post_password'),{ 135 cookie: 'dcx_post_password',135 user_pref: 'dcx_post_password', 136 136 legend_click: true, 137 137 hide: $('#post_password').val() == '' 138 138 }); 139 139 $('#post_status').parent().children('label').toggleWithLegend($('#post_status'),{ 140 cookie: 'dcx_post_status',140 user_pref: 'dcx_post_status', 141 141 legend_click: true 142 142 }); 143 143 $('#post_dt').parent().children('label').toggleWithLegend($('#post_dt').parent().children().not('label'),{ 144 cookie: 'dcx_post_dt',144 user_pref: 'dcx_post_dt', 145 145 legend_click: true 146 146 }); 147 147 $('#label_format').toggleWithLegend($('#label_format').parent().children().not('#label_format'),{ 148 cookie: 'dcx_post_format',148 user_pref: 'dcx_post_format', 149 149 legend_click: true 150 150 }); 151 151 $('#cat_id').parent().children('label').toggleWithLegend($('#cat_id'),{ 152 cookie: 'cat_id',152 user_pref: 'cat_id', 153 153 legend_click: true 154 154 }); … … 158 158 }); 159 159 $('#post_url').parent().children('label').toggleWithLegend($('#post_url').parent().children().not('label'),{ 160 cookie: 'post_url',160 user_pref: 'post_url', 161 161 legend_click: true 162 162 }); 163 163 // We load toolbar on excerpt only when it's ready 164 164 $('#excerpt-area label').toggleWithLegend($('#excerpt-area').children().not('label'),{ 165 cookie: 'dcx_post_excerpt',165 user_pref: 'dcx_post_excerpt', 166 166 legend_click: true, 167 167 hide: $('#post_excerpt').val() == '' -
admin/js/common.js
r1635 r1699 63 63 img_off_src: dotclear.img_minus_src, 64 64 img_off_alt: dotclear.img_minus_alt, 65 unfolded_sections: dotclear.unfolded_sections, 65 66 hide: true, 66 67 speed: 0, 67 68 legend_click: false, 68 69 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 71 74 }; 72 75 var p = jQuery.extend(defaults,s); … … 78 81 p.hide = p.reverse_cookie; 79 82 } 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 } 81 88 var toggle = function(i,speed) { 82 89 speed = speed || 0; … … 102 109 } 103 110 } 104 105 111 p.hide = !p.hide; 106 112 }; … … 125 131 } 126 132 $(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 } 127 145 toggle(i,p.speed); 128 146 return false; … … 348 366 } 349 367 $('#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) 351 369 ); 352 370 $('#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) 354 372 ); 355 373 $('#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) 357 375 ); 358 376 $('#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) 360 378 ); 361 379 -
admin/media.php
r1678 r1681 231 231 $core->auth->user_prefs->addWorkspace('interface'); 232 232 $user_ui_enhanceduploader = $core->auth->user_prefs->interface->enhanceduploader; 233 234 233 235 234 if (!isset($core->media)) { … … 343 342 if ($core_media_writable) 344 343 { 345 echo '<div class="two-cols">'; 344 echo 345 '<h3>'.sprintf(__('In %s:'),($d == '' ? '“'.__('Media manager').'”' : '“'.$d.'”')).'</h3>'. 346 '<div class="media-action-box">'; 346 347 347 348 if ($user_ui_enhanceduploader) { 348 349 echo 349 '<div class=" colenhanced_uploader">';350 '<div class="enhanced_uploader">'; 350 351 } else { 351 352 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>'. 358 358 '<p>'.__('Please take care to publish media that you own and that are not protected by copyright.').'</p>'. 359 359 '<p class="max-sizer form-note info"> '.__('Maximum file size allowed:').' '.files::size(DC_MAX_UPLOAD_SIZE).'</p>'. … … 391 391 '<p style="clear:both;">'.form::hidden(array('d'),$d).'</p>'. 392 392 '</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">'. 398 399 '<div id="new-dir-f">'. 399 '<h 3>'.__('New directory').'</h3>'.400 '<h4>'.__('Create new directory').'</h4>'. 400 401 $core->formNonce(). 401 402 '<p><label for="newdir">'.__('Directory Name:').'</label>'. … … 404 405 form::hidden(array('d'),html::escapeHTML($d)).'</p>'. 405 406 '</div>'. 406 '</form></div>'; 407 408 echo '</div>'; 409 } 407 '</form>'. 408 '</div>'; 409 } 410 410 411 411 # Empty remove form (for javascript actions) 412 412 echo 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>'. 414 415 form::hidden('rmyes',1).form::hidden('d',html::escapeHTML($d)). 415 416 form::hidden('remove',''). 416 417 $core->formNonce(). 417 '</div></form>'; 418 '</div>'. 419 '</form>'; 418 420 419 421 # Get zip directory … … 422 424 { 423 425 echo 424 '<p class="zip-dl"><a class="submit" href="'.html::escapeURL($page_url).'&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).'&zipdl=1">'. 430 __('Download').'</a></p>'. 431 '</div>'; 426 432 } 427 433 -
admin/post.php
r1711 r1714 518 518 "post_excerpt" => 519 519 '<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> '. 521 521 form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt)). 522 522 '</p>', … … 530 530 "post_notes" => 531 531 '<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>'. 533 533 form::textarea('post_notes',50,5,html::escapeHTML($post_notes)). 534 534 '</p>' -
admin/services.php
r1538 r1699 26 26 $core->rest->addFunction('setPostMeta',array('dcRestMethods','setPostMeta')); 27 27 $core->rest->addFunction('searchMeta',array('dcRestMethods','searchMeta')); 28 $core->rest->addFunction('setSectionFold',array('dcRestMethods','setSectionFold')); 28 29 29 30 $core->rest->serve(); … … 412 413 return $rsp; 413 414 } 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 414 446 } 415 447 ?> -
admin/style/default.css
r1678 r1698 797 797 border: none; 798 798 } 799 .media-item {799 .media-item, .media-action-box { 800 800 position: relative; 801 801 border: 1px solid #ccc; … … 803 803 padding: 1em; 804 804 width: 300px; 805 height: 120px;806 805 display: inline-block; 807 806 vertical-align: top; 808 } 809 div.media-list .media-item { 807 min-height: 120px 810 808 } 811 809 a.media-icon { … … 905 903 margin-left: 0; 906 904 } 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 } 930 li.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 } 936 li.user_admin { 937 background-image: url(../images/admin.png); 938 } 939 907 940 /* -------------------------------------------------------------------- Themes */ 908 941 #themes { … … 1162 1195 .success a { 1163 1196 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 } 1209 a.info { 1210 margin-left: 2em; 1211 font-weight: bold; 1164 1212 } 1165 1213 /* ------------------------------------------------------------------ navigation */ -
admin/style/jsToolBar/jsToolBar.css
r1636 r1697 48 48 width: 12em; 49 49 margin-right: .6rem; 50 border: 1px solid #ccc; 50 51 } 51 52 .jstElements button { … … 71 72 background: #dfdfdf; 72 73 } 73 74 .jstSpacer { 75 width : 2px; 74 span.jstSpacer { 75 width : 6px; 76 76 height: 28px; 77 77 margin-right: 0; -
inc/admin/lib.dc.page.php
r1655 r1699 114 114 echo 115 115 self::jsCommon(). 116 self::jsToggles(). 116 117 $head; 117 118 … … 253 254 echo 254 255 self::jsCommon(). 256 self::jsToggles(). 255 257 $head; 256 258 … … 444 446 } 445 447 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 446 469 public static function jsCommon() 447 470 { … … 544 567 self::jsVar('dotclear.msg.load_enhanced_uploader', 545 568 __('Loading enhanced uploader, please wait.')). 546 "\n//]]>\n".569 "\n//]]>\n". 547 570 "</script>\n"; 548 571 } … … 792 815 } 793 816 817 public 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 794 829 public static function jsMetaEditor() 795 830 { -
inc/core/class.dc.blog.php
r1620 r1689 199 199 /** 200 200 Updates comments and trackbacks counters in post table. Should be called 201 every time comments or trackbacks are added, removed or changed the restatus.201 every time comments or trackbacks are added, removed or changed their status. 202 202 203 203 @param ids <b>mixed</b> Comment(s) ID(s) … … 1880 1880 - cat_id: (integer or array) Get comments belonging to entries of given category ID 1881 1881 - comment_id: (integer) Get comment with given ID 1882 - comment_site: (string) Get comments with given comment_site 1882 1883 - comment_status: (integer) Get comments with given comment_status 1883 1884 - comment_trackback: (integer) Get only comments (0) or trackbacks (1) … … 1969 1970 if (isset($params['comment_id']) && $params['comment_id'] !== '') { 1970 1971 $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."' "; 1971 1977 } 1972 1978 -
inc/core/class.dc.core.php
r1593 r1698 345 345 } 346 346 347 public function setPostType($type,$admin_url,$public_url )347 public function setPostType($type,$admin_url,$public_url,$label='') 348 348 { 349 349 $this->post_types[$type] = array( 350 350 'admin_url' => $admin_url, 351 'public_url' => $public_url 351 'public_url' => $public_url, 352 'label' => ($label != '' ? $label : $type) 352 353 ); 353 354 } … … 817 818 $strReq = 818 819 'SELECT U.user_id AS user_id, user_super, user_name, user_firstname, '. 819 'user_displayname, permissions '.820 'user_displayname, user_email, permissions '. 820 821 'FROM '.$this->prefix.'user U '. 821 822 'JOIN '.$this->prefix.'permissions P ON U.user_id = P.user_id '. … … 826 827 'UNION '. 827 828 '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 ". 829 830 'FROM '.$this->prefix.'user U '. 830 831 'WHERE user_super = 1 '; … … 841 842 'firstname' => $rs->user_firstname, 842 843 'displayname' => $rs->user_displayname, 844 'email' => $rs->user_email, 843 845 'super' => (boolean) $rs->user_super, 844 846 'p' => $this->auth->parsePermissions($rs->permissions) -
inc/core/class.dc.trackback.php
r1674 r1689 14 14 /** 15 15 @ingroup DC_CORE 16 @brief Trackbacks sender and server17 18 Sends and receives trackbacks . Also handles trackbacks auto discovery.16 @brief Trackbacks/Pingbacks sender and server 17 18 Sends and receives trackbacks/pingbacks. Also handles trackbacks/pingbacks auto discovery. 19 19 */ 20 20 class dcTrackback … … 146 146 } 147 147 //@} 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 } 148 194 149 195 /// @name Receive trackbacks … … 176 222 $charset = ''; 177 223 $comment = ''; 178 224 179 225 $err = false; 180 226 $msg = ''; … … 209 255 $msg = 'Trackbacks are not allowed for this post or weblog.'; 210 256 } 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 } 211 263 } 212 264 … … 216 268 217 269 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); 222 271 } 223 272 … … 244 293 $blog_name = text::cutString($blog_name,60); 245 294 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 266 295 try 267 296 { 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); 276 298 } 277 299 catch (Exception $e) … … 281 303 } 282 304 } 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";294 305 295 306 $resp = … … 303 314 304 315 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"; 306 325 } 307 326 … … 362 381 } 363 382 383 if ($this->pingAlreadyDone($posts->post_id, $from_url)) { 384 throw new Exception(__('Don\'t repeat yourself, please.'), 48); 385 } 386 364 387 # OK. We've found our champion. Time to check the remote part. 365 388 try { … … 381 404 $remote_content = $http->getContent(); 382 405 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 388 412 if (strtolower($charset) != 'utf-8') { 389 413 $remote_content = iconv($charset,'UTF-8',$remote_content); … … 416 440 } 417 441 if ($excerpt) { 418 $excerpt = '(…) '.text::cutString(html::escapeHTML($excerpt),2 55).' (…)';442 $excerpt = '(…) '.text::cutString(html::escapeHTML($excerpt),200).' (…)'; 419 443 } 420 444 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 = '(…)'; 446 } 447 448 $this->addBacklink($posts->post_id, $from_url, '', $title, $excerpt, $comment); 446 449 } 447 450 catch (Exception $e) { … … 464 467 } 465 468 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)) { 471 477 return $m[1]; 472 478 } … … 475 481 return null; 476 482 } 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 478 492 /// @name Trackbacks auto discovery 479 493 //@{ -
inc/core/class.dc.xmlrpc.php
r1674 r1688 1644 1644 throw new Exception(__('No valid source URL provided? Try again!'), 0); 1645 1645 } 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... 1647 1656 $this->setBlog(true); 1648 1657 $tb = new dcTrackback($this->core); -
inc/prepend.php
r1468 r1694 220 220 $core->url->register('xmlrpc','xmlrpc','^xmlrpc/(.+)$',array('dcUrlHandlers','xmlrpc')); 221 221 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'); 223 223 224 224 # Store upload_max_filesize in bytes -
locales/fr/main.po
r1678 r1697 3038 3038 msgstr "Billet précédent" 3039 3039 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."3040 msgid "Introduction to the post." 3041 msgstr "Introduction au billet." 3042 3043 msgid "Unpublished notes." 3044 msgstr "Notes non publiées." 3045 3045 3046 3046 msgid "Edit basename:" … … 3286 3286 msgstr "Modifier le %1$s de %2$s" 3287 3287 3288 msgid "Backup" 3289 msgstr "Sauvegarde" 3288 msgid "Backup content" 3289 msgstr "Sauvegarder le contenu" 3290 3291 msgid "Create new directory" 3292 msgstr "Créer un répertoire" 3293 3294 msgid "In %s:" 3295 msgstr "Dans %s :" 3296 3297 msgid "Download" 3298 msgstr "Télécharger" 3299 3300 msgid "Compress this directory with its content as a zip file and download it." 3301 msgstr "Compressez ce dossier et son contenu dans un fichier zip et téléchargez-le." 3302 3303 msgid "Permissions:" 3304 msgstr "Permissions :" 3305 3306 msgid "Publications on this blog:" 3307 msgstr "Publications sur ce blog :" 3308 3309 msgid "Posts" 3310 msgstr "Billets" 3311 3312 msgid "%1$s: %2$s" 3313 msgstr "%1$s : %2$s" -
locales/fr/plugins.po
r1669 r1694 1987 1987 msgid "Drag widgets here to remove them from this sidebar." 1988 1988 msgstr "Glisser les widgets ici pour les retirer du volet." 1989 1990 msgid "Pages" 1991 msgstr "Pages" -
plugins/attachments/js/post.js
r1606 r1699 1 1 $(function() { 2 2 $('h5.s-attachments').toggleWithLegend($('.s-attachments').not('h5'),{ 3 cookie: 'dcx_attachments',3 user_pref: 'dcx_attachments', 4 4 legend_click: true 5 5 }); -
plugins/pages/_prepend.php
r1179 r1694 17 17 $core->url->register('pagespreview','pagespreview','^pagespreview/(.+)$',array('urlPages','pagespreview')); 18 18 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'); 20 20 21 21 # We should put this as settings later -
plugins/pings/post.js
r1606 r1699 13 13 } 14 14 $('h5.ping-services').toggleWithLegend($('p.ping-services'),{ 15 cookie: 'dcx_ping_services',15 user_pref: 'dcx_ping_services', 16 16 legend_click: true 17 17 }); -
plugins/tags/js/post.js
r1606 r1699 60 60 61 61 $('h5 .s-tags').toggleWithLegend($('.s-tags').not('label'),{ 62 cookie: 'post_tags',62 user_pref: 'post_tags', 63 63 legend_clik: true 64 64 });
Note: See TracChangeset
for help on using the changeset viewer.