Changes in [1714:28737e5f6607:1713:e29741a2433d]
- Files:
-
- 8 deleted
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
.hgsubstate
r1693 r1624 1 3811959404614e7014b897d3d3b96caad10e214f inc/libs/clearbricks1 f5e0517435fc94082b6acaad5f4f111252b6149f inc/libs/clearbricks -
admin/blog_pref.php
r1698 r1636 580 580 $user_url_p = '%1$s'; 581 581 } 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 582 592 583 foreach ($blog_users as $k => $v) 593 584 { … … 595 586 { 596 587 echo 597 '<div class="user-perm">'.598 588 '<h4>'.sprintf($user_url_p,html::escapeHTML($k)). 599 589 ' ('.html::escapeHTML(dcUtils::getUserCN( 600 590 $k, $v['name'], $v['firstname'], $v['displayname'] 601 591 )).')</h4>'; 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>'; 592 593 echo '<ul class="nice">'; 626 594 if ($v['super']) { 627 echo '<li class="user_super">'.__('Super administrator').'</li>';595 echo '<li>'.__('Super administrator').'</li>'; 628 596 } else { 629 597 foreach ($v['p'] as $p => $V) { 630 echo '<li '.($p == 'admin' ? 'class="user_admin"' : '').'>'.__($perm_types[$p]).'</li>';598 echo '<li>'.__($perm_types[$p]).'</li>'; 631 599 } 632 600 } 633 echo 634 '</ul>'; 601 echo '</ul>'; 635 602 636 603 if (!$v['super'] && $core->auth->isSuperAdmin()) { 637 604 echo 638 605 '<form action="users_actions.php" method="post">'. 639 '<p class="change-user-perm"><input type="submit" class="reset" value="'.__('Change permissions').'" />'.606 '<p><input type="submit" value="'.__('Change permissions').'" />'. 640 607 form::hidden(array('redir'),'blog_pref.php?id='.$k). 641 608 form::hidden(array('action'),'perms'). … … 646 613 '</form>'; 647 614 } 648 echo '</div>';649 615 } 650 }651 if ($current_blog_id != $core->blog->id) {652 $core->setBlog($current_blog_id);653 616 } 654 617 } -
admin/index.php
r1699 r1620 63 63 $core->auth->user_prefs->dashboard->put('quickentry',false,'boolean'); 64 64 } 65 66 // Handle folded/unfolded sections in admin from user preferences67 $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 65 73 66 # Dashboard icons … … 217 210 218 211 if ($updater->getNotify() && $new_v) { 219 echo220 '<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>';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); 226 219 } 227 220 } -
admin/js/_index.js
r1699 r1638 75 75 $('#quick h3').toggleWithLegend($('#quick').children().not('h3'),{ 76 76 legend_click: true, 77 user_pref: 'dcx_quick_entry'77 cookie: 'dcx_quick_entry' 78 78 }); 79 79 }); -
admin/js/_post.js
r1714 r1712 120 120 // Hide some fields 121 121 $('#notes-area label').toggleWithLegend($('#notes-area').children().not('label'),{ 122 user_pref: 'dcx_post_notes',122 cookie: '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 user_pref: 'dcx_post_lang',131 cookie: 'dcx_post_lang', 132 132 legend_click: true 133 133 }); 134 134 $('#post_password').parent().children('label').toggleWithLegend($('#post_password'),{ 135 user_pref: 'dcx_post_password',135 cookie: '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 user_pref: 'dcx_post_status',140 cookie: '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 user_pref: 'dcx_post_dt',144 cookie: 'dcx_post_dt', 145 145 legend_click: true 146 146 }); 147 147 $('#label_format').toggleWithLegend($('#label_format').parent().children().not('#label_format'),{ 148 user_pref: 'dcx_post_format',148 cookie: 'dcx_post_format', 149 149 legend_click: true 150 150 }); 151 151 $('#cat_id').parent().children('label').toggleWithLegend($('#cat_id'),{ 152 user_pref: 'cat_id',152 cookie: '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 user_pref: 'post_url',160 cookie: '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 user_pref: 'dcx_post_excerpt',165 cookie: 'dcx_post_excerpt', 166 166 legend_click: true, 167 167 hide: $('#post_excerpt').val() == '' -
admin/js/common.js
r1699 r1635 63 63 img_off_src: dotclear.img_minus_src, 64 64 img_off_alt: dotclear.img_minus_alt, 65 unfolded_sections: dotclear.unfolded_sections,66 65 hide: true, 67 66 speed: 0, 68 67 legend_click: false, 69 68 fn: false, // A function called on first display, 70 user_pref: false, 71 reverse_user_pref: false, // Reverse cookie behavior 72 user_pref:false, 73 reverse_user_pref: false 69 cookie: false, 70 reverse_cookie: false // Reverse cookie behavior 74 71 }; 75 72 var p = jQuery.extend(defaults,s); … … 81 78 p.hide = p.reverse_cookie; 82 79 } 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 } 80 88 81 var toggle = function(i,speed) { 89 82 speed = speed || 0; … … 109 102 } 110 103 } 104 111 105 p.hide = !p.hide; 112 106 }; … … 131 125 } 132 126 $(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 }145 127 toggle(i,p.speed); 146 128 return false; … … 366 348 } 367 349 $('#blog-menu h3:first').toggleWithLegend($('#blog-menu ul:first'), 368 $.extend({ user_pref:'dc_blog_menu'},menu_settings)350 $.extend({cookie:'dc_blog_menu'},menu_settings) 369 351 ); 370 352 $('#system-menu h3:first').toggleWithLegend($('#system-menu ul:first'), 371 $.extend({ user_pref:'dc_system_menu'},menu_settings)353 $.extend({cookie:'dc_system_menu'},menu_settings) 372 354 ); 373 355 $('#plugins-menu h3:first').toggleWithLegend($('#plugins-menu ul:first'), 374 $.extend({ user_pref:'dc_plugins_menu'},menu_settings)356 $.extend({cookie:'dc_plugins_menu'},menu_settings) 375 357 ); 376 358 $('#favorites-menu h3:first').toggleWithLegend($('#favorites-menu ul:first'), 377 $.extend({ user_pref:'dc_favorites_menu',hide:false,reverse_user_pref:true},menu_settings)359 $.extend({cookie:'dc_favorites_menu',hide:false,reverse_cookie:true},menu_settings) 378 360 ); 379 361 -
admin/media.php
r1681 r1678 231 231 $core->auth->user_prefs->addWorkspace('interface'); 232 232 $user_ui_enhanceduploader = $core->auth->user_prefs->interface->enhanceduploader; 233 233 234 234 235 if (!isset($core->media)) { … … 342 343 if ($core_media_writable) 343 344 { 344 echo 345 '<h3>'.sprintf(__('In %s:'),($d == '' ? '“'.__('Media manager').'”' : '“'.$d.'”')).'</h3>'. 346 '<div class="media-action-box">'; 345 echo '<div class="two-cols">'; 347 346 348 347 if ($user_ui_enhanceduploader) { 349 348 echo 350 '<div class=" enhanced_uploader">';349 '<div class="col enhanced_uploader">'; 351 350 } else { 352 351 echo 353 '<div>'; 354 } 355 356 echo 357 '<h4>'.__('Add files').'</h4>'. 352 '<div class="col">'; 353 } 354 355 echo 356 '<div class="fieldset">'. 357 '<h3>'.__('Add files').'</h3>'. 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>'. 394 '</div>'; 395 396 echo 397 '<div class="media-action-box">'. 398 '<form action="'.html::escapeURL($page_url).'" method="post">'. 393 '</div></div>'; 394 395 echo 396 '<div class="col">'. 397 '<form class="clear fieldset" action="'.html::escapeURL($page_url).'" method="post">'. 399 398 '<div id="new-dir-f">'. 400 '<h 4>'.__('Create new directory').'</h4>'.399 '<h3>'.__('New directory').'</h3>'. 401 400 $core->formNonce(). 402 401 '<p><label for="newdir">'.__('Directory Name:').'</label>'. … … 405 404 form::hidden(array('d'),html::escapeHTML($d)).'</p>'. 406 405 '</div>'. 407 '</form>'. 408 '</div>'; 409 } 406 '</form></div>'; 407 408 echo '</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" class="hidden">'. 414 '<div>'. 413 '<form id="media-remove-hide" action="'.html::escapeURL($page_url).'" method="post"><div class="clear">'. 415 414 form::hidden('rmyes',1).form::hidden('d',html::escapeHTML($d)). 416 415 form::hidden('remove',''). 417 416 $core->formNonce(). 418 '</div>'. 419 '</form>'; 417 '</div></form>'; 420 418 421 419 # Get zip directory … … 424 422 { 425 423 echo 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>'; 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>'; 432 426 } 433 427 -
admin/post.php
r1714 r1711 518 518 "post_excerpt" => 519 519 '<p class="area" id="excerpt-area"><label for="post_excerpt">'.__('Excerpt:').'<span class="form-note">'. 520 __(' Introduction to the post.').'</span></label> '.520 __('Add an 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 __(' Unpublished notes.').'</span></label>'.532 __('Add unpublished notes.').'</span></label>'. 533 533 form::textarea('post_notes',50,5,html::escapeHTML($post_notes)). 534 534 '</p>' -
admin/services.php
r1699 r1538 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'));29 28 30 29 $core->rest->serve(); … … 413 412 return $rsp; 414 413 } 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 list433 if ($k !== false) {434 unset($toggles[$k]);435 }436 } else { // false == unfold section ==> add it to unfolded list437 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 446 414 } 447 415 ?> -
admin/style/default.css
r1698 r1678 797 797 border: none; 798 798 } 799 .media-item , .media-action-box{799 .media-item { 800 800 position: relative; 801 801 border: 1px solid #ccc; … … 803 803 padding: 1em; 804 804 width: 300px; 805 height: 120px; 805 806 display: inline-block; 806 807 vertical-align: top; 807 min-height: 120px 808 } 809 div.media-list .media-item { 808 810 } 809 811 a.media-icon { … … 903 905 margin-left: 0; 904 906 } 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 940 907 /* -------------------------------------------------------------------- Themes */ 941 908 #themes { … … 1195 1162 .success a { 1196 1163 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;1212 1164 } 1213 1165 /* ------------------------------------------------------------------ navigation */ -
admin/style/jsToolBar/jsToolBar.css
r1697 r1636 48 48 width: 12em; 49 49 margin-right: .6rem; 50 border: 1px solid #ccc;51 50 } 52 51 .jstElements button { … … 72 71 background: #dfdfdf; 73 72 } 74 span.jstSpacer { 75 width : 6px; 73 74 .jstSpacer { 75 width : 2px; 76 76 height: 28px; 77 77 margin-right: 0; -
inc/admin/lib.dc.page.php
r1699 r1655 114 114 echo 115 115 self::jsCommon(). 116 self::jsToggles().117 116 $head; 118 117 … … 254 253 echo 255 254 self::jsCommon(). 256 self::jsToggles().257 255 $head; 258 256 … … 446 444 } 447 445 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 469 446 public static function jsCommon() 470 447 { … … 567 544 self::jsVar('dotclear.msg.load_enhanced_uploader', 568 545 __('Loading enhanced uploader, please wait.')). 569 546 "\n//]]>\n". 570 547 "</script>\n"; 571 548 } … … 815 792 } 816 793 817 public static function jsToolMan()818 {819 return820 '<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 829 794 public static function jsMetaEditor() 830 795 { -
inc/core/class.dc.blog.php
r1689 r1620 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 irstatus.201 every time comments or trackbacks are added, removed or changed there 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_site1883 1882 - comment_status: (integer) Get comments with given comment_status 1884 1883 - comment_trackback: (integer) Get only comments (0) or trackbacks (1) … … 1970 1969 if (isset($params['comment_id']) && $params['comment_id'] !== '') { 1971 1970 $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."' ";1977 1971 } 1978 1972 -
inc/core/class.dc.core.php
r1698 r1593 345 345 } 346 346 347 public function setPostType($type,$admin_url,$public_url ,$label='')347 public function setPostType($type,$admin_url,$public_url) 348 348 { 349 349 $this->post_types[$type] = array( 350 350 'admin_url' => $admin_url, 351 'public_url' => $public_url, 352 'label' => ($label != '' ? $label : $type) 351 'public_url' => $public_url 353 352 ); 354 353 } … … 818 817 $strReq = 819 818 'SELECT U.user_id AS user_id, user_super, user_name, user_firstname, '. 820 'user_displayname, user_email,permissions '.819 'user_displayname, permissions '. 821 820 'FROM '.$this->prefix.'user U '. 822 821 'JOIN '.$this->prefix.'permissions P ON U.user_id = P.user_id '. … … 827 826 'UNION '. 828 827 'SELECT U.user_id AS user_id, user_super, user_name, user_firstname, '. 829 "user_displayname, user_email,NULL AS permissions ".828 "user_displayname, NULL AS permissions ". 830 829 'FROM '.$this->prefix.'user U '. 831 830 'WHERE user_super = 1 '; … … 842 841 'firstname' => $rs->user_firstname, 843 842 'displayname' => $rs->user_displayname, 844 'email' => $rs->user_email,845 843 'super' => (boolean) $rs->user_super, 846 844 'p' => $this->auth->parsePermissions($rs->permissions) -
inc/core/class.dc.trackback.php
r1689 r1674 14 14 /** 15 15 @ingroup DC_CORE 16 @brief Trackbacks /Pingbackssender and server17 18 Sends and receives trackbacks /pingbacks. Also handles trackbacks/pingbacks auto discovery.16 @brief Trackbacks sender and server 17 18 Sends and receives trackbacks. Also handles trackbacks 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-- publicBeforeTrackbackCreate186 $this->core->callBehavior('publicBeforeTrackbackCreate',$cur);187 if ($cur->post_id) {188 $comment_id = $this->core->blog->addComment($cur);189 190 # --BEHAVIOR-- publicAfterTrackbackCreate191 $this->core->callBehavior('publicAfterTrackbackCreate',$cur,$comment_id);192 }193 }194 148 195 149 /// @name Receive trackbacks … … 222 176 $charset = ''; 223 177 $comment = ''; 224 178 225 179 $err = false; 226 180 $msg = ''; … … 255 209 $msg = 'Trackbacks are not allowed for this post or weblog.'; 256 210 } 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 }263 211 } 264 212 … … 268 216 269 217 if (!$charset) { 270 $charset = self::detectCharset($title.' '.$excerpt.' '.$blog_name); 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'); 271 222 } 272 223 … … 293 244 $blog_name = text::cutString($blog_name,60); 294 245 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 295 266 try 296 267 { 297 $this->addBacklink($post_id, $url, $blog_name, $title, $excerpt, $comment); 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 } 298 276 } 299 277 catch (Exception $e) … … 303 281 } 304 282 } 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"; 305 294 306 295 $resp = … … 314 303 315 304 if (!empty($_POST['__debug'])) { 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"; 305 $resp .= $debug_trace; 325 306 } 326 307 … … 381 362 } 382 363 383 if ($this->pingAlreadyDone($posts->post_id, $from_url)) {384 throw new Exception(__('Don\'t repeat yourself, please.'), 48);385 }386 387 364 # OK. We've found our champion. Time to check the remote part. 388 365 try { … … 404 381 $remote_content = $http->getContent(); 405 382 406 $charset = self::getCharsetFromRequest($http->getHeader('content-type')); 407 408 if (!$charset) { 409 $charset = self::detectCharset($remote_content); 410 } 411 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 412 388 if (strtolower($charset) != 'utf-8') { 413 389 $remote_content = iconv($charset,'UTF-8',$remote_content); … … 440 416 } 441 417 if ($excerpt) { 442 $excerpt = '(…) '.text::cutString(html::escapeHTML($excerpt),2 00).' (…)';418 $excerpt = '(…) '.text::cutString(html::escapeHTML($excerpt),255).' (…)'; 443 419 } 444 420 else { 445 $excerpt = '(…)'; 446 } 447 448 $this->addBacklink($posts->post_id, $from_url, '', $title, $excerpt, $comment); 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 } 449 446 } 450 447 catch (Exception $e) { … … 467 464 } 468 465 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)) { 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)) { 477 471 return $m[1]; 478 472 } … … 481 475 return null; 482 476 } 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 477 492 478 /// @name Trackbacks auto discovery 493 479 //@{ -
inc/core/class.dc.xmlrpc.php
r1688 r1674 1644 1644 throw new Exception(__('No valid source URL provided? Try again!'), 0); 1645 1645 } 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... 1646 1656 1647 $this->setBlog(true); 1657 1648 $tb = new dcTrackback($this->core); -
inc/prepend.php
r1694 r1468 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') ,'Posts');222 $core->setPostType('post','post.php?id=%d',$core->url->getURLFor('post','%s')); 223 223 224 224 # Store upload_max_filesize in bytes -
locales/fr/main.po
r1697 r1678 3038 3038 msgstr "Billet précédent" 3039 3039 3040 msgid " Introduction to the post."3041 msgstr " Introduction au billet."3042 3043 msgid " Unpublished notes."3044 msgstr " Notes non publiées."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." 3045 3045 3046 3046 msgid "Edit basename:" … … 3286 3286 msgstr "Modifier le %1$s de %2$s" 3287 3287 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" 3288 msgid "Backup" 3289 msgstr "Sauvegarde" -
locales/fr/plugins.po
r1694 r1669 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
r1699 r1606 1 1 $(function() { 2 2 $('h5.s-attachments').toggleWithLegend($('.s-attachments').not('h5'),{ 3 user_pref: 'dcx_attachments',3 cookie: 'dcx_attachments', 4 4 legend_click: true 5 5 }); -
plugins/pages/_prepend.php
r1694 r1179 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') ,'Pages');19 $core->setPostType('page','plugin.php?p=pages&act=page&id=%d',$core->url->getURLFor('pages','%s')); 20 20 21 21 # We should put this as settings later -
plugins/pings/post.js
r1699 r1606 13 13 } 14 14 $('h5.ping-services').toggleWithLegend($('p.ping-services'),{ 15 user_pref: 'dcx_ping_services',15 cookie: 'dcx_ping_services', 16 16 legend_click: true 17 17 }); -
plugins/tags/js/post.js
r1699 r1606 60 60 61 61 $('h5 .s-tags').toggleWithLegend($('.s-tags').not('label'),{ 62 user_pref: 'post_tags',62 cookie: 'post_tags', 63 63 legend_clik: true 64 64 });
Note: See TracChangeset
for help on using the changeset viewer.