置頂文章

八月 19, 2007

[架設技術]新生部落格升級1.2.1→1.2.4版

新生部落格系統升級(1.2.1 1.2.4)

1.下載以下更新程式:

lifetype-1.2.1-upgrade-1.2.2.zip

smtp-hotfix-lifetype-1.2.2-20070523.zip 

flashplayer-hotfix-lifetype-1.2.2-20070523.zip

LifeType upgrade package from 1.2.2 (.zip) 

lifetype-1.2.3-visual-editor-hotfix-20070611.zip 

LifeType upgrade package from 1.2.3 (.zip)

2.將以上程式解壓縮後,依序取代原1.2.1程式。(直接覆蓋、取代)

3.刪除plugins資料夾內所有的plugin(bedbehavior),將新的plugin 複製到plugins資料夾。

1.2__all_plugins.zip

4將新的模版複製到templates資料夾。

1.2__all_templates.zip

5.修改新生部落格特有功能及函數:


(一)修改 class/summary/dao/summarystats.class.php
1.getRecentPicture() 最近上傳的圖片檔案
------------程式--------------
/**
* gets all links in the first blog(blogid=1)
* write by cmchuang in Taipei SNES
* 2006.02.28
*/


function getRecentPicture( )
{
include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresources.class.php" );

$query = "SELECT * from ".$this->getPrefix()."gallery_resources where resource_type = '".GALLERY_RESOURCE_IMAGE."' order by date DESC LIMIT 0, 12";
$result = $this->Execute( $query );
$recentresources = Array();
$resources = new GalleryResources();

if( !$result ){
return Array();
}

while( $row = $result->FetchRow()) {
$recentresource = $resources->mapRow($row);
array_push( $recentresources, $recentresource );
}

$result->Close();
return $recentresources;
}
--------------------------------------------------------------

2.getRecentAnnounce() 最近公告文章(讀取第一個部落格的第一個類別文章)
※在檔案最前面加入以下一列:lt_include( PLOG_CLASS_PATH."class/summary/dao/summarystatsconstants.class.php" );

-----
程式------------
/**
* gets all announce article in the first blog (blogid=1 category=1)
* write by cmchuang at Taipei SNES
*/
function getRecentAnnounce( )
{
$query = "select ".$this->getPrefix()."articles.* from ".$this->getPrefix()."article_categories_link left join ".$this->getPrefix()."articles on (".$this->getPrefix()."article_categories_link.article_id = ".$this->getPrefix()."articles.id) where ".$this->getPrefix()."article_categories_link.category_id = 1 ORDER BY ".$this->getPrefix()."articles.date DESC LIMIT 0, 2";
$result = $this->Execute( $query );
$blogs = Array();
$posts = Array();
$articles = new Articles();
if( !$result ){
return Array();
}

while( $row = $result->FetchRow()) {
$post = $articles->mapRow($row);
array_push( $posts, $post );
}

$result->Close();
return $posts;
}

-----------------------------------------------------------
3.getViewedTotal()總瀏覽數
-------程式------------------------------------------------
function getViewedTotal()
{
$query = "SELECT SUM(num_reads) as total FROM ".$this->getPrefix()."articles WHERE blog_id >=0";

$result = $this->Execute( $query );

if (!$result)
return false;

$row = $result->FetchRow();

if (!isset($row["total"]))
return 0;

$result->close();

return $row["total"];
}
---------------------------------------------------------------


4.getTotalPosts() 文章總數
---------------程式------------------
/** write by cmchuang in Taipei SNES
* Retrieves the total number of posts in all blogs
*
* @param blogId The identifier of the blog from which we'd like to fetch the settings
* @return Returns an integer with the number of posts
*/
function getTotalPosts()
{
$query = "SELECT COUNT(*) as total FROM ".$this->getPrefix()."articles WHERE blog_id >=0 AND status = ".POST_STATUS_PUBLISHED;
$result = $this->Execute( $query );

if (!$result)
return false;

$row = $result->FetchRow();

if (!isset($row["total"]))
return false;

$posts = intval($row["total"]);

$result->Close();

return( $posts );
}
----------------------------------------------------

5.getNumofBlogs()網誌總數

----------------------------程式-----------------
/* gets number of blogs in this Suite .. Writen by CMchuang in SNES */
function getNumofBlogs()
{
$query = "SELECT COUNT(*) as total FROM ".$this->getPrefix()."blogs WHERE status = ".BLOG_STATUS_ACTIVE;
$result = $this->Execute( $query );

if (!$result)
return false;

$row = $result->FetchRow();

if (!isset($row["total"]))
return false;

$posts = intval($row["total"]);

$result->Close();

return( $posts );
}

---------------------------------------------------


6.getNumofComments() 迴響總數
-----------------------------程式-----------------------
/* gets number of Comments in this Suite .. Writen by CMchuang in SNES */
function getNumofComments()
{
$query = "SELECT COUNT(*) as total FROM ".$this->getPrefix()."articles_comments WHERE status = ".COMMENT_STATUS_NONSPAM;
$result = $this->Execute( $query );

if (!$result)
return false;

$row = $result->FetchRow();

if (!isset($row["total"]))
return false;

$posts = intval($row["total"]);

$result->Close();

return( $posts );
}

  7.修改原有的getMostReadArticles()      將以下程式碼移至檔案最前方的列表 lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );

-------------------------------------------------------

(
二)修改class/dao/bloginfo.class.php

1.getViewedTotal() 網誌總瀏覽數

--------程式---------
/* getViewedTotal
Writen by Cmchuang in SNES 2006.09.10
*/
function getViewedTotal()
{
include_once( PLOG_CLASS_PATH."class/dao/model.class.php" );
$db = new Model();
$query = "SELECT SUM(num_reads) as total FROM ".$db->getPrefix()."articles WHERE blog_id =".$this->getId();

$result = $db->Execute( $query );

if (!$result)
return false;

$row = $result->FetchRow();

if (!isset($row["total"]))
return 0;

$result->close();

return $row["total"];
}
----------------------------------------------------

(三)增加lightbox效果   

(1) 新生部落格已將lightbox放置在/js/lightbox 資料夾中,且於header.template中已加入了以下指令

      <script type="text/javascript" src="http://blog.snes.tp.edu.tw/js/lightbox/js/prototype.js"></script>
      <script type="text/javascript" src="
http://blog.snes.tp.edu.tw/js/lightbox/js/scriptaculous.js?load=effects"></script>
      <script type="text/javascript" src="
http://blog.snes.tp.edu.tw/js/lightbox/js/lightbox.js"></script>
      <link rel="stylesheet" href="
http://blog.snes.tp.edu.tw/js/lightbox/css/lightbox.css" type="text/css" media="screen" />
  

 (2)修改/js/tinymce/tiny_mce-plog-resourcelist.js-----tiny_mce-plog-resourcelist.js程式碼(黃色為修改部份)

---------

function _generateResourceLink( resourceId, resourceLink, targetLink, resourceName, resourceDesc, resourceType, resourceMimeType )
{
    var htmlCode = '';
  if( resourceType == 1 ) {
                if( targetLink != '' ) {
                    htmlCode = '<a id="res_'+resourceId+ '" rel="lightbox[roadtrip]" title="'+resourceDesc+'" href="'+targetLink+'" type="'+resourceMimeType+'">';
                    htmlCode += '<img style="margin: 5px;" border="0" alt="'+resourceDesc+'" src="'+resourceLink+'" />';^M
                    htmlCode += '</a>';
            }
------------------------------------------------------------------
 


發佈者: 莊志明 at 09:25│  點閱次數 (3662)│ 修改文章管理迴響[專業成長]部落格架設技術

回應文章

 

發表迴響

(必要)
authimage
   

Powered by LifeType. Design by colaccl.com


Bad Behavior 已經阻擋了 229 個過去 7 天試圖闖關的垃圾迴響與引用。