Index: .hgsubstate =================================================================== --- .hgsubstate (revision 1624) +++ .hgsubstate (revision 1693) @@ -1,1 +1,1 @@ -f5e0517435fc94082b6acaad5f4f111252b6149f inc/libs/clearbricks +3811959404614e7014b897d3d3b96caad10e214f inc/libs/clearbricks Index: admin/blog_pref.php =================================================================== --- admin/blog_pref.php (revision 1636) +++ admin/blog_pref.php (revision 1698) @@ -580,5 +580,14 @@ $user_url_p = '%1$s'; } - + + # Sort users list on user_id key + ksort($blog_users); + + $post_type = $core->getPostTypes(); + $current_blog_id = $core->blog->id; + if ($blog_id != $core->blog->id) { + $core->setBlog($blog_id); + } + foreach ($blog_users as $k => $v) { @@ -586,23 +595,47 @@ { echo + '
'.__('Email:').' '. + ($v['email'] != '' ? ''.$v['email'].'' : __('(none)')). + '
'; + } + + echo + ''.sprintf(__('Dotclear %s is available!'),$new_v).'
'. - ''.sprintf(__('Upgrade now'),$new_v).' '. + ''.__('Remind me later').''. + ($version_info ? '
'. + ''. + ''.__('Please take care to publish media that you own and that are not protected by copyright.').'
'. ''.__('Maximum file size allowed:').' '.files::size(DC_MAX_UPLOAD_SIZE).'
'. @@ -391,11 +391,12 @@ ''.form::hidden(array('d'),$d).'
'. ''. - ''. - __('Download this directory as a zip file').'
'; + ''.__('Compress this directory with its content as a zip file and download it.').'
'. + ''. + ''. + __('Introduction to the post.').' '. form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt)). '
', @@ -530,5 +530,5 @@ "post_notes" => ''. + __('Unpublished notes.').''. form::textarea('post_notes',50,5,html::escapeHTML($post_notes)). '
' Index: admin/services.php =================================================================== --- admin/services.php (revision 1538) +++ admin/services.php (revision 1699) @@ -26,4 +26,5 @@ $core->rest->addFunction('setPostMeta',array('dcRestMethods','setPostMeta')); $core->rest->addFunction('searchMeta',array('dcRestMethods','searchMeta')); +$core->rest->addFunction('setSectionFold',array('dcRestMethods','setSectionFold')); $core->rest->serve(); @@ -412,4 +413,35 @@ return $rsp; } + + public static function setSectionFold($core,$get,$post) + { + if (empty($post['section'])) { + throw new Exception('No section name'); + } + if ($core->auth->user_prefs->toggles === null) { + $core->auth->user_prefs->addWorkspace('toggles'); + } + $section = $post['section']; + $status = isset($post['value']) && ($post['value'] != 0); + if ($core->auth->user_prefs->toggles->prefExists('unfolded_sections')) { + $toggles = explode(',',trim($core->auth->user_prefs->toggles->unfolded_sections)); + } else { + $toggles = array(); + } + $k = array_search($section,$toggles); + if ($status) { // true == Fold section ==> remove it from unfolded list + if ($k !== false) { + unset($toggles[$k]); + } + } else { // false == unfold section ==> add it to unfolded list + if ($k === false) { + $toggles[]=$section; + }; + } + $core->auth->user_prefs->toggles->put('unfolded_sections',join(',',$toggles)); + return true; + } + + } ?> Index: admin/style/default.css =================================================================== --- admin/style/default.css (revision 1678) +++ admin/style/default.css (revision 1698) @@ -797,5 +797,5 @@ border: none; } -.media-item { +.media-item, .media-action-box { position: relative; border: 1px solid #ccc; @@ -803,9 +803,7 @@ padding: 1em; width: 300px; - height: 120px; display: inline-block; vertical-align: top; -} -div.media-list .media-item { + min-height: 120px } a.media-icon { @@ -905,4 +903,39 @@ margin-left: 0; } +/* in blog_pref */ +.user-perm { + margin: 2em 0px; + background: transparent url(user.png) no-repeat left top; + width: 320px; + display: inline-block; + vertical-align: top; +} +.user-perm h4, .user-perm h5, .user-perm p, .user-perm ul, .user-perm li { + margin: .5em 0 .33em; + padding: 0; +} +.user-perm h4 { + padding-left: 28px; +} +.user-perm ul { + list-style-type: inside; +} +.user-perm li { + margin-left: 1em; + padding-left: 0; +} +.user-perm h5 { + margin: 1em 0 0 0; +} +li.user_super, li.user_admin { + margin-left: 0; + padding-left: 1em; + list-style: none; + background: transparent url(../images/superadmin.png) no-repeat -2px 2px; +} +li.user_admin { + background-image: url(../images/admin.png); +} + /* -------------------------------------------------------------------- Themes */ #themes { @@ -1162,4 +1195,19 @@ .success a { color: #666; +} +.dc-update { + padding: 1em 48px 0.5em 48px; + margin-bottom: 1em; + border-radius: 8px; + background: #A2CBE9 url(msg-success.png) no-repeat .7em .7em; +} +.dc-update a { + color: #000; + border-color: #000; + margin-right: 1em; +} +a.info { + margin-left: 2em; + font-weight: bold; } /* ------------------------------------------------------------------ navigation */ Index: admin/style/jsToolBar/jsToolBar.css =================================================================== --- admin/style/jsToolBar/jsToolBar.css (revision 1636) +++ admin/style/jsToolBar/jsToolBar.css (revision 1697) @@ -48,4 +48,5 @@ width: 12em; margin-right: .6rem; + border: 1px solid #ccc; } .jstElements button { @@ -71,7 +72,6 @@ background: #dfdfdf; } - -.jstSpacer { - width : 2px; +span.jstSpacer { + width : 6px; height: 28px; margin-right: 0; Index: inc/admin/lib.dc.page.php =================================================================== --- inc/admin/lib.dc.page.php (revision 1655) +++ inc/admin/lib.dc.page.php (revision 1699) @@ -114,4 +114,5 @@ echo self::jsCommon(). + self::jsToggles(). $head; @@ -253,4 +254,5 @@ echo self::jsCommon(). + self::jsToggles(). $head; @@ -444,4 +446,25 @@ } + public static function jsToggles() + { + if($GLOBALS['core']->auth->user_prefs->toggles) { + $unfolded_sections = explode(',',$GLOBALS['core']->auth->user_prefs->toggles->unfolded_sections); + foreach ($unfolded_sections as $k=>&$v) { + if ($v == '') { + unset($unfolded_sections[$k]); + } else { + $v = "'".html::escapeJS($v)."':true"; + } + } + } else { + $unfolded_sections=array(); + } + return '\n"; + } + public static function jsCommon() { @@ -544,5 +567,5 @@ self::jsVar('dotclear.msg.load_enhanced_uploader', __('Loading enhanced uploader, please wait.')). - "\n//]]>\n". + "\n//]]>\n". "\n"; } @@ -792,4 +815,16 @@ } +public static function jsToolMan() +{ + return + ''. + ''. + ''. + ''. + ''. + ''. + ''; +} + public static function jsMetaEditor() { Index: inc/core/class.dc.blog.php =================================================================== --- inc/core/class.dc.blog.php (revision 1620) +++ inc/core/class.dc.blog.php (revision 1689) @@ -199,5 +199,5 @@ /** Updates comments and trackbacks counters in post table. Should be called - every time comments or trackbacks are added, removed or changed there status. + every time comments or trackbacks are added, removed or changed their status. @param ids mixed Comment(s) ID(s) @@ -1880,4 +1880,5 @@ - cat_id: (integer or array) Get comments belonging to entries of given category ID - comment_id: (integer) Get comment with given ID + - comment_site: (string) Get comments with given comment_site - comment_status: (integer) Get comments with given comment_status - comment_trackback: (integer) Get only comments (0) or trackbacks (1) @@ -1969,4 +1970,9 @@ if (isset($params['comment_id']) && $params['comment_id'] !== '') { $strReq .= 'AND comment_id = '.(integer) $params['comment_id'].' '; + } + + if (isset($params['comment_site'])) { + $comment_site = $this->con->escape(str_replace('*','%',$params['comment_site'])); + $strReq .= "AND comment_site LIKE '".$comment_site."' "; } Index: inc/core/class.dc.core.php =================================================================== --- inc/core/class.dc.core.php (revision 1593) +++ inc/core/class.dc.core.php (revision 1698) @@ -345,9 +345,10 @@ } - public function setPostType($type,$admin_url,$public_url) + public function setPostType($type,$admin_url,$public_url,$label='') { $this->post_types[$type] = array( 'admin_url' => $admin_url, - 'public_url' => $public_url + 'public_url' => $public_url, + 'label' => ($label != '' ? $label : $type) ); } @@ -817,5 +818,5 @@ $strReq = 'SELECT U.user_id AS user_id, user_super, user_name, user_firstname, '. - 'user_displayname, permissions '. + 'user_displayname, user_email, permissions '. 'FROM '.$this->prefix.'user U '. 'JOIN '.$this->prefix.'permissions P ON U.user_id = P.user_id '. @@ -826,5 +827,5 @@ 'UNION '. 'SELECT U.user_id AS user_id, user_super, user_name, user_firstname, '. - "user_displayname, NULL AS permissions ". + "user_displayname, user_email, NULL AS permissions ". 'FROM '.$this->prefix.'user U '. 'WHERE user_super = 1 '; @@ -841,4 +842,5 @@ 'firstname' => $rs->user_firstname, 'displayname' => $rs->user_displayname, + 'email' => $rs->user_email, 'super' => (boolean) $rs->user_super, 'p' => $this->auth->parsePermissions($rs->permissions) Index: inc/core/class.dc.trackback.php =================================================================== --- inc/core/class.dc.trackback.php (revision 1674) +++ inc/core/class.dc.trackback.php (revision 1689) @@ -14,7 +14,7 @@ /** @ingroup DC_CORE -@brief Trackbacks sender and server - -Sends and receives trackbacks. Also handles trackbacks auto discovery. +@brief Trackbacks/Pingbacks sender and server + +Sends and receives trackbacks/pingbacks. Also handles trackbacks/pingbacks auto discovery. */ class dcTrackback @@ -146,4 +146,50 @@ } //@} + + private function pingAlreadyDone($post_id, $from_url) + { + $params = array( + 'post_id' => $post_id, + 'comment_site' => $from_url, + 'comment_trackback' => 1, + ); + + $rs = $this->core->blog->getComments($params, true); + if ($rs && !$rs->isEmpty()) { + return ($rs->f(0)); + } + + return false; + } + + private function addBacklink($post_id, $url, $blog_name, $title, $excerpt, &$comment) + { + if (empty($blog_name)) { + $blog_name = 'Anonymous blog'; + } + + $comment = + "\n". + ''.($title ? $title : $blog_name)."
\n". + ''.$excerpt.'
'; + + $cur = $this->core->con->openCursor($this->core->prefix.'comment'); + $cur->comment_author = (string) $blog_name; + $cur->comment_site = (string) $url; + $cur->comment_content = (string) $comment; + $cur->post_id = $post_id; + $cur->comment_trackback = 1; + $cur->comment_status = $this->core->blog->settings->system->trackbacks_pub ? 1 : -1; + $cur->comment_ip = http::realIP(); + + # --BEHAVIOR-- publicBeforeTrackbackCreate + $this->core->callBehavior('publicBeforeTrackbackCreate',$cur); + if ($cur->post_id) { + $comment_id = $this->core->blog->addComment($cur); + + # --BEHAVIOR-- publicAfterTrackbackCreate + $this->core->callBehavior('publicAfterTrackbackCreate',$cur,$comment_id); + } + } /// @name Receive trackbacks @@ -176,5 +222,5 @@ $charset = ''; $comment = ''; - + $err = false; $msg = ''; @@ -209,4 +255,10 @@ $msg = 'Trackbacks are not allowed for this post or weblog.'; } + + $url = trim(html::clean($url)); + if ($this->pingAlreadyDone($post->post_id, $url)) { + $err = true; + $msg = 'The trackback has already been registered'; + } } @@ -216,8 +268,5 @@ if (!$charset) { - $charset = mb_detect_encoding($title.' '.$excerpt.' '.$blog_name, - 'UTF-8,ISO-8859-1,ISO-8859-2,ISO-8859-3,'. - 'ISO-8859-4,ISO-8859-5,ISO-8859-6,ISO-8859-7,ISO-8859-8,'. - 'ISO-8859-9,ISO-8859-10,ISO-8859-13,ISO-8859-14,ISO-8859-15'); + $charset = self::detectCharset($title.' '.$excerpt.' '.$blog_name); } @@ -244,34 +293,7 @@ $blog_name = text::cutString($blog_name,60); - $url = trim(html::clean($url)); - - if (!$blog_name) { - $blog_name = 'Anonymous blog'; - } - - $comment = - "\n". - ''.($title ? $title : $blog_name)."
\n". - ''.$excerpt.'
'; - - $cur = $this->core->con->openCursor($this->core->prefix.'comment'); - $cur->comment_author = (string) $blog_name; - $cur->comment_site = (string) $url; - $cur->comment_content = (string) $comment; - $cur->post_id = $post_id; - $cur->comment_trackback = 1; - $cur->comment_status = $this->core->blog->settings->system->trackbacks_pub ? 1 : -1; - $cur->comment_ip = http::realIP(); - try { - # --BEHAVIOR-- publicBeforeTrackbackCreate - $this->core->callBehavior('publicBeforeTrackbackCreate',$cur); - if ($cur->post_id) { - $comment_id = $this->core->blog->addComment($cur); - - # --BEHAVIOR-- publicAfterTrackbackCreate - $this->core->callBehavior('publicAfterTrackbackCreate',$cur,$comment_id); - } + $this->addBacklink($post_id, $url, $blog_name, $title, $excerpt, $comment); } catch (Exception $e) @@ -281,15 +303,4 @@ } } - - - $debug_trace = - "'.$title."
\n". - ''.$excerpt.'
'; - - $cur = $this->core->con->openCursor($this->core->prefix.'comment'); - $cur->comment_author = 'Anonymous blog'; - $cur->comment_site = (string) $from_url; - $cur->comment_content = (string) $comment; - $cur->post_id = $posts->post_id; - $cur->comment_trackback = 1; - $cur->comment_status = $this->core->blog->settings->system->trackbacks_pub ? 1 : -1; - $cur->comment_ip = http::realIP(); - - # --BEHAVIOR-- publicBeforeTrackbackCreate - $this->core->callBehavior('publicBeforeTrackbackCreate',$cur); - if ($cur->post_id) { - $comment_id = $this->core->blog->addComment($cur); - - # --BEHAVIOR-- publicAfterTrackbackCreate - $this->core->callBehavior('publicAfterTrackbackCreate',$cur,$comment_id); - } + $excerpt = '(…)'; + } + + $this->addBacklink($posts->post_id, $from_url, '', $title, $excerpt, $comment); } catch (Exception $e) { @@ -464,9 +467,12 @@ } - private static function getCharsetFromRequest() - { - if (isset($_SERVER['CONTENT_TYPE'])) - { - if (preg_match('|charset=([a-zA-Z0-9-]+)|',$_SERVER['CONTENT_TYPE'],$m)) { + private static function getCharsetFromRequest($header = '') + { + if (!$header && isset($_SERVER['CONTENT_TYPE'])) { + $header = $_SERVER['CONTENT_TYPE']; + } + + if ($header) { + if (preg_match('|charset=([a-zA-Z0-9-]+)|',$header,$m)) { return $m[1]; } @@ -475,5 +481,13 @@ return null; } - + + private static function detectCharset($string) + { + return mb_detect_encoding($remote_content, + 'UTF-8,ISO-8859-1,ISO-8859-2,ISO-8859-3,'. + 'ISO-8859-4,ISO-8859-5,ISO-8859-6,ISO-8859-7,ISO-8859-8,'. + 'ISO-8859-9,ISO-8859-10,ISO-8859-13,ISO-8859-14,ISO-8859-15'); + } + /// @name Trackbacks auto discovery //@{ Index: inc/core/class.dc.xmlrpc.php =================================================================== --- inc/core/class.dc.xmlrpc.php (revision 1674) +++ inc/core/class.dc.xmlrpc.php (revision 1688) @@ -1644,5 +1644,14 @@ throw new Exception(__('No valid source URL provided? Try again!'), 0); } - + + if (!(filter_var($to_url, FILTER_VALIDATE_URL) && preg_match('!^https?://!',$to_url))) { + throw new Exception(__('No valid target URL provided? Try again!'), 0); + } + + if (html::sanitizeURL(urldecode($from_url)) == html::sanitizeURL(urldecode($to_url))) { + throw new Exception(__('LOL!'), 0); + } + + # Time to get things done... $this->setBlog(true); $tb = new dcTrackback($this->core); Index: inc/prepend.php =================================================================== --- inc/prepend.php (revision 1468) +++ inc/prepend.php (revision 1694) @@ -220,5 +220,5 @@ $core->url->register('xmlrpc','xmlrpc','^xmlrpc/(.+)$',array('dcUrlHandlers','xmlrpc')); -$core->setPostType('post','post.php?id=%d',$core->url->getURLFor('post','%s')); +$core->setPostType('post','post.php?id=%d',$core->url->getURLFor('post','%s'),'Posts'); # Store upload_max_filesize in bytes Index: locales/fr/main.po =================================================================== --- locales/fr/main.po (revision 1678) +++ locales/fr/main.po (revision 1697) @@ -3038,9 +3038,9 @@ msgstr "Billet précédent" -msgid "Add an introduction to the post." -msgstr "Ajoute une introduction au billet." - -msgid "Add unpublished notes." -msgstr "Ajoute des notes non publiées." +msgid "Introduction to the post." +msgstr "Introduction au billet." + +msgid "Unpublished notes." +msgstr "Notes non publiées." msgid "Edit basename:" @@ -3286,4 +3286,28 @@ msgstr "Modifier le %1$s de %2$s" -msgid "Backup" -msgstr "Sauvegarde" +msgid "Backup content" +msgstr "Sauvegarder le contenu" + +msgid "Create new directory" +msgstr "Créer un répertoire" + +msgid "In %s:" +msgstr "Dans %s :" + +msgid "Download" +msgstr "Télécharger" + +msgid "Compress this directory with its content as a zip file and download it." +msgstr "Compressez ce dossier et son contenu dans un fichier zip et téléchargez-le." + +msgid "Permissions:" +msgstr "Permissions :" + +msgid "Publications on this blog:" +msgstr "Publications sur ce blog :" + +msgid "Posts" +msgstr "Billets" + +msgid "%1$s: %2$s" +msgstr "%1$s : %2$s" Index: locales/fr/plugins.po =================================================================== --- locales/fr/plugins.po (revision 1669) +++ locales/fr/plugins.po (revision 1694) @@ -1987,2 +1987,5 @@ msgid "Drag widgets here to remove them from this sidebar." msgstr "Glisser les widgets ici pour les retirer du volet." + +msgid "Pages" +msgstr "Pages" Index: plugins/attachments/js/post.js =================================================================== --- plugins/attachments/js/post.js (revision 1606) +++ plugins/attachments/js/post.js (revision 1699) @@ -1,5 +1,5 @@ $(function() { $('h5.s-attachments').toggleWithLegend($('.s-attachments').not('h5'),{ - cookie: 'dcx_attachments', + user_pref: 'dcx_attachments', legend_click: true }); Index: plugins/pages/_prepend.php =================================================================== --- plugins/pages/_prepend.php (revision 1179) +++ plugins/pages/_prepend.php (revision 1694) @@ -17,5 +17,5 @@ $core->url->register('pagespreview','pagespreview','^pagespreview/(.+)$',array('urlPages','pagespreview')); -$core->setPostType('page','plugin.php?p=pages&act=page&id=%d',$core->url->getURLFor('pages','%s')); +$core->setPostType('page','plugin.php?p=pages&act=page&id=%d',$core->url->getURLFor('pages','%s'),'Pages'); # We should put this as settings later Index: plugins/pings/post.js =================================================================== --- plugins/pings/post.js (revision 1606) +++ plugins/pings/post.js (revision 1699) @@ -13,5 +13,5 @@ } $('h5.ping-services').toggleWithLegend($('p.ping-services'),{ - cookie: 'dcx_ping_services', + user_pref: 'dcx_ping_services', legend_click: true }); Index: plugins/tags/js/post.js =================================================================== --- plugins/tags/js/post.js (revision 1606) +++ plugins/tags/js/post.js (revision 1699) @@ -60,5 +60,5 @@ $('h5 .s-tags').toggleWithLegend($('.s-tags').not('label'),{ - cookie: 'post_tags', + user_pref: 'post_tags', legend_clik: true });