47
|
測試 / LifeType 1.1 測試 / 文章列表中不會顯示不在首頁顯示的群組文章?
|
於: 七月 31, 2006, 10:43:23 上午
|
這個不知道算不算 bug.
我有幾個群組是設定為不會顯示在首頁上頭. 而在登入 admin 介面後, 如果去點選文章列表, 會把目前這個月的文章顯示出來. 但是, 並不會包含這些群組的文章. 必須要再按一次更新, 這些文章才會出現.
如果就更新列表上頭的條件來看, 兩者並無改變, 照說在第一次進來時, 就必須要顯示那些文章, 這樣子才比較合理吧?
|
|
|
50
|
開發 / 核心補強 / 修正 Lifetype 文章標題有 -- 出現時, 會顯示不正常的情形
|
於: 六月 14, 2006, 01:58:27 下午
|
前幾天有篇文章在標題中出現 -- 字元, 結果在 Firefox 看這篇文章時, 在標題前會出現一個多餘的 //--> (也可能是 -->, 看你的 template 怎麼寫的), 而這個問題在 IE 中是不會出現的. 這會是 Firefox 的 bug 嗎? 上網問了一下, 有人給了 這個 html 註解的定義網頁, 上面有提到註解的定義. 其中, 有說明當使用 -- 當註解之後, 不應該有 -- 存在於註解之中. 所以, 我想 Firefox 這樣子處理, 並不能算是 bug 吧. 既然這不能算是 Firefox 的問題, 所以... 就要想法子由 LifeType 來解決. 會出現這個問題的原因是因為文章的標題會有 -- 出現, 而 LifeType 的 postTrackbackLink() 在輸出資料於註解的時候, 也會把文章標題列在其中, 所以, 我們只要想辦法在這個輸出的地方, 把文章標題有出現 - 的, 都改成 \-, 來避免這個問題. (PS. 會不會造成這個運作有問題呢? 我想應該不會吧, 頂多看到的 topic 不太正確, 並不會影響 trackback 的 link, 而且 \- 在 browser 上頭, 看到的應該也是 - 吧.) 這個 patch 可以由這兒抓取: http://www.teatime.com.tw/~tommy/mypatch/lifetype_postTrackbackLink_topic.patchdiff -Nur class.orig/net/customrequestgenerator.class.php class/net/customrequestgenerator.class.php --- class.orig/net/customrequestgenerator.class.php 2006-06-16 08:25:45.680792558 +0800 +++ class/net/customrequestgenerator.class.php 2006-06-16 08:36:23.160057155 +0800 @@ -283,11 +283,13 @@ xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">'; - $trackbackLink = $this->getTrackbackUrl()."?id=".$post->getId(); + $trackbackLink = str_replace('-', '%2D', $this->getTrackbackUrl()."?id=".$post->getId()); + $postLink = str_replace('-', '%2D', $this->postLink($post)); + $topic = str_replace('-', '\-', $post->getTopic()); $rdfBody = "<rdf:Description - rdf:about=\"".$this->postLink($post)."\" - dc:identifier=\"".$this->postLink($post)."\" - dc:title=\"".$post->getTopic()."\" + rdf:about=\"".$postLink."\" + dc:identifier=\"".$postLink."\" + dc:title=\"".$topic."\" trackback:ping=\"".$trackbackLink."\"/>"; $rdfFooter = "</rdf:RDF>"; diff -Nur class.orig/net/modrewriterequestgenerator.class.php class/net/modrewriterequestgenerator.class.php --- class.orig/net/modrewriterequestgenerator.class.php 2006-06-16 08:26:08.656621134 +0800 +++ class/net/modrewriterequestgenerator.class.php 2006-06-16 08:36:55.351819113 +0800 @@ -224,12 +224,13 @@ xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">'; - $trackbackLink = $this->getTrackbackUrl()."?id=".$post->getId(); - + $trackbackLink = str_replace('-', '%2D', $this->getTrackbackUrl()."?id=".$post->getId()); + $postLink = str_replace('-', '%2D', $this->postLink($post)); + $topic = str_replace('-', '\-', $post->getTopic()); $rdfBody = "<rdf:Description - rdf:about=\"".$this->postLink($post)."\" - dc:identifier=\"".$this->postLink($post)."\" - dc:title=\"".$post->getTopic()."\" + rdf:about=\"".$postLink."\" + dc:identifier=\"".$postLink."\" + dc:title=\"".$topic."\" trackback:ping=\"".$trackbackLink."\"/>"; $rdfFooter = "</rdf:RDF>"; diff -Nur class.orig/net/prettyrequestgenerator.class.php class/net/prettyrequestgenerator.class.php --- class.orig/net/prettyrequestgenerator.class.php 2006-06-16 08:26:18.596546991 +0800 +++ class/net/prettyrequestgenerator.class.php 2006-06-16 08:37:11.207701904 +0800 @@ -245,11 +245,13 @@ xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">'; - $trackbackLink = $this->getTrackbackUrl()."?id=".$post->getId(); + $trackbackLink = str_replace('-', '%2D', $this->getTrackbackUrl()."?id=".$post->getId()); + $postLink = str_replace('-', '%2D', $this->postLink($post)); + $topic = str_replace('-', '\-', $post->getTopic()); $rdfBody = "<rdf:Description - rdf:about=\"".$this->postLink($post)."\" - dc:identifier=\"".$this->postLink($post)."\" - dc:title=\"".$post->getTopic()."\" + rdf:about=\"".$postLink."\" + dc:identifier=\"".$postLink."\" + dc:title=\"".$topic."\" trackback:ping=\"".$trackbackLink."\"/>"; $rdfFooter = "</rdf:RDF>"; diff -Nur class.orig/net/rawrequestgenerator.class.php class/net/rawrequestgenerator.class.php --- class.orig/net/rawrequestgenerator.class.php 2006-06-16 08:26:28.660471933 +0800 +++ class/net/rawrequestgenerator.class.php 2006-06-16 08:37:23.439611499 +0800 @@ -260,11 +260,13 @@ xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">'; - $trackbackLink = $this->getTrackbackUrl()."?id=".$post->getId(); + $trackbackLink = str_replace('-', '%2D', $this->getTrackbackUrl()."?id=".$post->getId()); + $postLink = str_replace('-', '%2D', $this->postLink($post)); + $topic = str_replace('-', '\-', $post->getTopic()); $rdfBody = "<rdf:Description - rdf:about=\"".$this->postLink($post)."\" - dc:identifier=\"".$this->postLink($post)."\" - dc:title=\"".$post->getTopic()."\" + rdf:about=\"".$postLink."\" + dc:identifier=\"".$postLink."\" + dc:title=\"".$topic."\" trackback:ping=\"".$trackbackLink."\"/>"; $rdfFooter = "</rdf:RDF>";
http://bugs.lifetype.net/view.php?id=9562006/6/16 修正: 1. str_replace() 參數順序寫錯. 2. 如果有用自訂的 url, 則 url 也要把 '-' 改成 '%2D'
|
|
|
51
|
站務 / 站務公告 / Re: 重要安全性修補:LifeType 1.0.5 釋出
|
於: 六月 11, 2006, 12:03:38 下午
|
可否建議一下官方, 加上一個 patch 方式的 upgrade 包? 目前那個檔案只是有修改過的檔案而已, 要用覆蓋的方式來更新. 如果有自行修改過, 就無法直接覆蓋.
用 patch 的方式, 就不會有這個困擾, 且檔案通常用小很多. 我現在每次更新都要抓兩個完整的版本, 自己用 diff 產生 patch file, 再用 patch 來更新...
還有... 怪怪的, upgrade 包裡頭的 version.php 是用 PLOG 不是 lifetype, 內容和完整的壓縮檔內的不同.
|
|
|
52
|
開發 / 核心補強 / Re: bug 單引號問題
|
於: 四月 26, 2006, 03:10:13 下午
|
這個存檔的 bug 在我這兒沒出現過. (也許是之前改過的 backslash 問題也順便避開了這個問題, 不過那個 patch 似乎只存在 1.1 的 svn 中, 在 1.0.4 中並沒有加入) 不過顯示的地方是在編輯文章時, 標題的 ' 並沒有被 escape, 所以在列表及一般顯示是正常, 只有在編輯文章時, 在 ' 之後的東西, 會被 browser 忽視. (可以看 html code, 東西有傳出, 只是沒有被 escape) 只要修改 template/admin/editpost.template 內, 把 加上 escape 就可以 value="{$postTopic|escape}"
|
|
|
53
|
開發 / 核心補強 / Re: [patch] 對 \ 字元的處理
|
於: 三月 06, 2006, 09:42:45 上午
|
另外, 這個不知道算不算 bug. 如果把 xhtml 的轉換功能打開時, 會把 & 這個字串轉換成 & 字元. 所以 &#92; 這個字串, 會被轉換成 \ 後存入資料庫, 後頭再顯示時就變成 \ 字元, 而非 \ 了. 我目前是把 xhtml 轉換的功能 disable 就不會發生這個問題了. 再舉個例子, 如果我要顯示 & 這個字串, 在編輯器輸入後, 會被轉成 &amp; 這個 html code, 但是在 xhtml filter 運作後, 會被改成 & 這個字串. 所以實際存入資料庫的是 & 而不是 &amp;. 結果就是, 當顯示這個文章時, 這個 & 字串就被顯示成 & 而已. 而不是我要的 & 字串了. 以結果來說, 這個轉換是不正常的. 在 xhtml filter 應該要避免轉換 & 到 &. 或者應該檢查 & 後頭的字串是否會在轉換成 & 之後, 又變成一個特殊意義的字. 如果是, 就不應該轉換. 我有 submit 這個問題到 http://bugs.lifetype.net/view.php?id=853
|
|
|
55
|
開發 / 核心補強 / [patch] 對 \ 字元的處理
|
於: 三月 05, 2006, 01:41:06 下午
|
如果 PHP 的 magic_quotes_gpc 打開時, LifeType 會在 qstr() 對 SQL 指令的字串用 stripslashes() 移除 \ 字元. 所以會影響文章內有 \ 字元時, 存入資料庫前會被移除. (且不管 magic_quotes_gpc 是否打開, 在 EditPost 動作去 update 資料時, 一定都會用 stripslashes() 處理) 就算 magic_quotes_gpc 關閉時, 上述 update 指令同樣會用 stripslashes() 處理過而造成 \ 消失. 而 AddPost 的動作, 雖然沒有做 stripslashes() 的動作, 但是 \ 字元在 PHP 字串中有特別的用意, 沒有改成 \\ 來表示一個 \ 字元時, 實際存入資料庫後, \ 字元也會與後頭的字元被當成跳脫字元給處理掉而不見. magic_quotes_gpc 應該只會對 ', ", \ 及 NUL 字元加上 \ 字元. stripslashes() 並非是只針對上述四個字元來移除 \ 字元, 這個函式是用來還原 addslashes() 所產生的字串而設計的, 直接用在轉換 magic_quotes_gpc 應該是不適用的. 這個 patch, 會把 update post 的 stripslashes() 移除. 然後在 qstr() 中, 用 str_replace() 針對 ', ", \ 字元在 magic_quotes_gpc 開啟時特別處理. 最後在傳回字串前, 再把 \ 改成 \\. 目前在我的網站上頭看起來是可以正常運作的. 詳細說明可參考 http://blog.teatime.com.tw/post/1/30這個 patch 也 submit 到 http://bugs.lifetype.net diff -Nur class.orig/action/admin/adminupdatepostaction.class.php class/action/admin/adminupdatepostaction.class.php --- class.orig/action/admin/adminupdatepostaction.class.php 2006-03-04 22:21:01.434358824 +0800 +++ class/action/admin/adminupdatepostaction.class.php 2006-03-05 14:13:59.971805184 +0800 @@ -88,9 +88,9 @@ } // if we got it, update some fields - $post->setTopic( stripslashes($this->_postTopic)); $postText = $this->_postText.POST_EXTENDED_TEXT_MODIFIER.$this->_postExtendedText; - $post->setText( stripslashes($postText)); + $post->setTopic( $this->_postTopic ); + $post->setText( $postText ); $post->setCategoryIds( $this->_postCategories ); $post->setStatus( $this->_postStatus ); $post->setDateObject( $this->_postTimestamp ); diff -Nur class.orig/database/db.class.php class/database/db.class.php --- class.orig/database/db.class.php 2006-03-04 22:19:56.205520124 +0800 +++ class/database/db.class.php 2006-03-05 14:13:05.191183578 +0800 @@ -93,9 +93,13 @@ function qstr($string) { if (get_magic_quotes_gpc()) { - $string = stripslashes($string); + //$string = stripslashes($string); + $string = str_replace('\\\\', '\\', $string); + $string = str_replace("\\'", "'", $string); + $string = str_replace('\\"', '"', $string); } + $string = str_replace("\\", "\\\\", $string); $string = str_replace("'", "''", $string); return $string;
|
|
|
57
|
開發 / 外掛程式 / 讓 LifeType 使用 TinyMCE 的 g2image plugin 來選取 Gallery2 的照片
|
於: 三月 03, 2006, 08:44:22 下午
|
把 Gallery2 與 LifeType 做了初步的整合後, 我們可以在 LifeType 顯示 Gallery 的 ImageBlock 了. 不過, 如果要在文章內貼上一張 Gallery2 的相片時, 能不能像 LifeType 內建的檔案中心那樣的方便, 直接在 TinyMCE 中就使用類似 insertresource 的功能那樣的方便嗎? 在 Google 找了一下, 我們可以找到一個 TinyMCE 的 plugin: g2image, 透過這個 plugin, 可以讓 TinyMCE 搭配 WordPress 有一個直接選取 Gallery2 相片的功能. 而我們是使用 LifeType, 是否也能用呢? 看了一下這個軟體的說明, 並非只能在 WordPress 中使用, 應該只要 TinyMCE 能用, 這個軟體就可以使用. 二話不說, 先抓回來裝看看. 在做一些簡單的修改之後, 果然可以搭配使用, 方便了不少. 首先是修改 tinymce 的 tinymce-plog.js 檔案, 在 plugins 的設定加上 g2image, 然後在 theme_advanced_buttons2 中, 自己找個位置加上 g2image. 然後把下載的檔案中的 g2image 目錄, 搬到 tinymce 的 plugins 目錄中. 接著, 修改 g2image 目錄中的 config.php, 修改下列的設定: # 設定使用中文 $g2ic_language = 'zh_TW';
# gallery2 安裝的路徑 $g2ic_gallery2_path = '/usr/share/gallery2/';
# 後面這兩個設定是原本沒有的, 為了配合 LifeType 加上的 # gallery2 的 URL, 注意一定要有 http, 且, 後頭要有 / 字元. $g2ic_gallery2_url = 'http://gallery.teatime.com.tw/';
# 你的 LifeType 的路徑, # 如果 URL 是 http://blog.teatime.com.tw/ 就是用 / # 如果 URL 是 http://www.teatime.com.tw/blog/ 就是用 /blog/ $g2ic_gallery2_embed_uri = '/'; 然後把 g2image 目錄下的 init.php 先改成 init.old.php, 再把下頭的程式存成 init.php: <?php // Initialization File for Gallery 2 Image Chooser for TinyMCE // Version 2.0 // By Kirk Steffensen - http://g2image.steffensenfamily.com/ // Released under the GPL version 2. // A copy of the license is in the root folder of this plugin.
// ====( Initialize Variables )================================= $g2ic_current_page = 1; $g2ic_rel_path = '/'; $g2ic_embedded_mode = FALSE; $g2ic_wpg2_valid = FALSE; $g2ic_dirs = null; $g2ic_wp_rel_path = ''; $g2ic_base_path = str_repeat("../", substr_count(dirname($_SERVER['PHP_SELF']), "/")); if(isset($_SESSION['g2ic_last_album_visited'])) { $g2ic_last_album = $_SESSION['g2ic_last_album_visited']; } else { $g2ic_last_album = '/'; }
// ============================================================== // Native embedded mode // ==============================================================
// Else use the native Gallery2 functions if (!$g2ic_embedded_mode){ if(file_exists($g2ic_gallery2_path.'embed.php')) { $g2ic_option['gallery2_url'] = $g2ic_gallery2_url; $g2ic_option['embedUri'] = $g2ic_gallery2_embed_uri; require_once($g2ic_gallery2_path.'embed.php'); g2ic_init($g2ic_option,$g2ic_embedded_mode); } // Else die on a fatal error else { print g2ic_make_html_header(); print $g2ic_lang['g2_embedded_error']; print "</body>\n\n"; print "</html>"; die; } }
//--------------------------------------------------------------------- // Function: g2ic_init // Parameters: $option,$embedded_mode // Returns: None // Purpose: Initialize the emedded functions of Gallery2. // Notes: Exit on Fatal //---------------------------------------------------------------------
function g2ic_init($option,$embedded_mode) {
// Initialise GalleryAPI $ret = GalleryEmbed::init( array( 'g2Uri' => $option['gallery2_url'], 'embedUri' => $option['embedUri'], 'fullInit' => true) ); if ($ret) { print g2ic_make_html_header(); print '{$lang_g2image_g2_fatal_error}' .$ret->getAsHtml() . "\n"; print "</body>\n\n"; print "</html>"; die; }
return; } ?> 這樣子就應該可以在 TinyMCE 中使用 g2image 來選擇你要顯示的照片了. 另外, 原本的中文檔案有兩個小問題, 如果你要使用中文, 可以把 g2image 目錄下的 langs/zh_TW.php 改成下列這個樣子: <?php
// Traditional Chinese lang variables - Version 2.0
$g2ic_lang = array( 'about' => '關於 G2Image', 'alignment_class' => '對齊級別:', 'alignment_legend' => '對齊級別(CSS必需支援 g2image classes 級別才能發生效用)>:', 'click_advanced' => '開啟進階設定選單', 'click_image' => '在圖像上按滑鼠會出現圖像選項。', 'click_one_click' => '使用預設方式插入', 'click_options' => '在圖像上按滑鼠鍵的動作:', 'current_album' => '目前相簿:', 'custom_url' => '自定網址:', 'description' => '描述:', 'description_legend' => '圖像或文字鏈接的替代文字說明:', 'display_legend' => '顯示選項', 'drupal_g2_filter' => 'Drupal Gallery2 過濾器', 'empty_album' => '這個相簿中沒有照片。<br /><br />'. '請在上面的導覽選項中另選一個相簿。', 'filename' => '檔名:', 'filenames' => '檔名:', 'g2_directory_error' => '無法打開 Gallery2 資料目錄。 :-(', 'g2_embedded_error' => '<h2>嚴重 Gallery2 錯誤:</h2><br />'. '無法啟動 Gallery2 內>嵌功能。<br />'. '請為 WordPress 安裝 WPG2 外掛模組(位於 http://wpg2.ozgreg.com/)<br />'. '或確認你的 config.php 中的 Gallery2 路徑。', 'g2_entities_by_id_error' => '<h2>嚴重 Gallery2 錯誤:</h2><br />'. '無法取得這個 Gallery2 ID 的圖像資訊。<br />'. 'G2 傳回的錯誤:', 'g2_fatal_error' => '<h2>嚴重 Gallery2 錯誤:</h2><br />'. 'G2 傳回的錯誤:', 'g2_id_by_path_error' => '<h2>嚴重 Gallery2 錯誤:</h2><br />'. '無法取得要求路徑的 Gallery2 ID。<br />'. 'G2 傳回的錯誤:', 'g2_id_not_found_error' => '<h2>嚴重 Gallery2 錯誤:</h2><br />'. '無法取得這個檔案>的 Gallery2 ID。<br />'. 'G2 傳回的錯誤:', 'g2_image_title' => 'Gallery2 主題:', 'go' => '前往', 'how_insert' => '插入方式:', 'image_title' => 'Title: ', 'img_float_left' => '浮動對左', 'img_float_right' => '浮動對右', 'img_centered' => '對中', 'img_none' => '無', 'img_normal' => '正常', 'insert' => '插入', 'insert_legend' => '按下按鈕以插入圖像:', 'last_modification_new' => '上次更新日期(最新的在前)', 'last_modification_old' => '上次更新日期(最舊的在前)', 'link_album' => '指到上層相簿的文字鏈接', 'link_image' => '指到圖像的文字鏈接', 'name_a_to_z' => '檔案名稱(A-z)', 'name_z_to_a' => '檔案名稱(z-A)', 'page' => '頁數:', 'page_navigation' => '頁面導覽:', 'photo_albums' => '相簿', 'redraw' => '重新顯示', 'sort_error' => '排序方式錯誤', 'sorted_by' => '排序方式:', 'subalbums' => '子相簿:', 'thumbnails' => '縮略圖', 'thumbnail_album' => '指到上層相簿的縮略圖', 'thumbnail_custom_url' => '指到自定網址(在下列文字框中)的縮略圖', 'thumbnail_image' => '指到圖像的縮略圖', 'thumbnail_only' => '只顯示縮略圖:不含鏈接', 'thumbnails_per_page' => '每頁項數:', 'title' => '選取 Gallery 2 圖像', 'title_a_to_z' => 'Gallery 2 主題(A-z)', 'title_z_to_a' => 'Gallery 2 主題(z-A)', 'url' => '網址:', 'wpg2_album_legend' => '插入目前相簿的 WPG2 標籤:', 'wpg2_configuration_error' => '組態設定錯誤:<br />'. 'WPG2 已用,可是並未通過驗証手續。<br />'. '請在 WordPress 管理面板中設定並驗証 WPG2。<br />'. '說明可在 http://www.ozgreg.com 網站中找到。', 'wpg2_link_album' => '指到上層相簿的文字鏈接(HTML)', 'wpg2_link_image' => '指到圖像的文字鏈接(HTML)', 'wpg2_tag_image' => '圖像的 WPG2 標籤', 'wpg2_thumbnail_album' => '指到上層相簿的縮略圖(HTML)', 'wpg2_thumbnail_custom_url' => '指到自定網址(在下列文字框中)的縮略圖(HTML)', 'wpg2_thumbnail_image' => '指到圖像的縮略圖(HTML)', 'wpg2_thumbnail_only' => '只顯示縮略圖:不含鏈接(HTML)') ?> 注意: 我的修改適用下列的版本: * G2Image 2.0RC2 或之後的版本 http://g2image.steffensenfamily.com/index.php?title=Download * Gallery 2.1 RC1 或之後版本 * LifeType 1.0.3 * TinyMCE 2.0.1 我的環境是使用 rewrite 的簡短路徑功能, 不確定是否別的環境也適用, 不過應該是可以用才對. 可參考 http://blog.teatime.com.tw/post/1/29 的說明與使用的結果.
|
|
|
|
|
|