commit 384d67a4b07e045496fdce746a3110d0caa1bcfd Author: 小松 Date: Tue Oct 16 16:57:57 2012 +0800 1.5版 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..412eeda --- /dev/null +++ b/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5ebd21a --- /dev/null +++ b/.gitignore @@ -0,0 +1,163 @@ +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Rr]elease/ +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.vspscc +.builds +*.dotCover + +## TODO: If you have NuGet Package Restore enabled, uncomment this +#packages/ + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf + +# Visual Studio profiler +*.psess +*.vsp + +# ReSharper is a .NET coding add-in +_ReSharper* + +# Installshield output folder +[Ee]xpress + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish + +# Others +[Bb]in +[Oo]bj +sql +TestResults +*.Cache +ClientBin +stylecop.* +~$* +*.dbmdl +Generated_Code #added for RIA/Silverlight projects + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML + + + +############ +## Windows +############ + +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg + +# Mac crap +.DS_Store diff --git a/README.md b/README.md new file mode 100644 index 0000000..737cf8a --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +emlog 日志归档插件 +==================== + +为你的博客添加一个归档页面,展示全部的文章,访客可选择按时间或者分类显示。与博客内置的归档相比,这个就多了一个统计功能,用户可自行选择。 + +[插件主页](http://xiaosong.org/share/emlog-log-archiving-plug-in-released) \ No newline at end of file diff --git a/archiver.php b/archiver.php new file mode 100644 index 0000000..5a15d74 --- /dev/null +++ b/archiver.php @@ -0,0 +1,65 @@ +readCache('record'); + $output = ''; + foreach($record_cache as $value){ + $output .= '
  • '.$value['record'].'('.$value['lognum'].')'.displayRecordItem($value['date']).'
  • '; + } + $output = ''; + return $output; +} +function displayRecordItem($record){ + if (preg_match("/^([\d]{4})([\d]{2})$/", $record, $match)) { + $days = getMonthDayNum($match[2], $match[1]); + $record_stime = emStrtotime($record . '01'); + $record_etime = $record_stime + 3600 * 24 * $days; + } else { + $record_stime = emStrtotime($record); + $record_etime = $record_stime + 3600 * 24; + } + $sql = "and date>=$record_stime and date<$record_etime order by top desc ,date desc"; + $result = archiver_db($sql); + return $result; +} +function displaySort(){ + global $CACHE; + $sort_cache = $CACHE->readCache('sort'); + $output = ''; + foreach($sort_cache as $value){ + $output .= '
  • '.$value['sortname'].'('.$value['lognum'].')'.displaySortItem($value['sid']).'
  • '; + } + $output = ''; + return $output; +} +function displaySortItem($sortid){ + $sql = "and sortid=$sortid order by date desc"; + $result = archiver_db($sql); + return $result; +} +function archiver_db($condition = ''){ + $DB = MySql::getInstance(); + $sql = "SELECT gid, title, comnum, views FROM " . DB_PREFIX . "blog WHERE type='blog' and hide='n' $condition"; + $result = $DB->query($sql); + $output = ''; + while ($row = $DB->fetch_array($result)) { + $log_url = Url::log($row['gid']); + $output .= '
  • '.$row['title'].' ('.$row['comnum'].'/'.$row['views'].')
  • '; + } + $output = empty($output) ? '
  • 暂无日志
  • ' : $output; + $output = '
      '.$output.'
    '; + return $output; +} +?> \ No newline at end of file diff --git a/archiver_callback.php b/archiver_callback.php new file mode 100644 index 0000000..6edce97 --- /dev/null +++ b/archiver_callback.php @@ -0,0 +1,21 @@ +query("SELECT 1 FROM ".DB_PREFIX."navi WHERE url='".BLOG_URL."?plugin=archiver'"); + if (!$DB->num_rows($inDB)) { + $DB->query("INSERT INTO ".DB_PREFIX."navi (naviname, url, newtab, hide, taxis, isdefault) VALUES('归档', '".BLOG_URL."?plugin=archiver', 'n', 'n', 1, 'n')"); + } else { + $DB->query("UPDATE ".DB_PREFIX."navi SET hide='n' WHERE url='".BLOG_URL."?plugin=archiver'"); + } + $CACHE->updateCache('navi'); +} + +function callback_rm(){ + global $CACHE; + $DB = MySql::getInstance(); + $DB->query("UPDATE ".DB_PREFIX."navi SET hide='y' WHERE url='".BLOG_URL."?plugin=archiver'"); + $CACHE->updateCache('navi'); +} + +?> \ No newline at end of file diff --git a/archiver_show.php b/archiver_show.php new file mode 100644 index 0000000..d031e39 --- /dev/null +++ b/archiver_show.php @@ -0,0 +1,45 @@ +readCache('options'); +$DB = MySql::getInstance(); +$res = $DB->once_fetch_array("SELECT naviname, hide FROM ".DB_PREFIX."navi WHERE url='".BLOG_URL."?plugin=archiver'"); +$site_title = $res['naviname'].' - '.Option::get('blogname'); +$log_title = $res['naviname']; +$blogname = Option::get('blogname'); +$site_description = $bloginfo = Option::get('bloginfo'); +$site_key = Option::get('site_key'); +$istwitter = Option::get('istwitter'); +$comments = array("commentStacks" => array()); +$ckname = $ckmail = $ckurl = $verifyCode = false; +$icp = Option::get('icp'); +$footer_info = Option::get('footer_info'); +if($res['hide'] == 'y' || !function_exists('displaySort') || !function_exists('displayRecord')) emMsg('不存在的页面!'); +include View::getView('header'); + +$log_content = '

    + + + \ No newline at end of file