1.9版
This commit is contained in:
22
.gitattributes
vendored
Normal file
22
.gitattributes
vendored
Normal file
@@ -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
|
||||||
163
.gitignore
vendored
Normal file
163
.gitignore
vendored
Normal file
@@ -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
|
||||||
40
autopub.php
Normal file
40
autopub.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
Plugin Name: 自动发布
|
||||||
|
Version: 1.9
|
||||||
|
Plugin URL: http://xiaosong.org/share/auto-pub-plugin-update
|
||||||
|
Description: 自动发布文章,修正时区问题,增加相关挂载点,自动删除缓存文件。
|
||||||
|
Author: 小松
|
||||||
|
Author Email: sahala_2007@126.com
|
||||||
|
Author URL: http://xiaosong.org
|
||||||
|
*/
|
||||||
|
!defined('EMLOG_ROOT') && exit('access deined!');
|
||||||
|
!defined('AUTOPUB_CACHE_DIR') && define('AUTOPUB_CACHE_DIR', EMLOG_ROOT.'/content/plugins/autopub/cache/');
|
||||||
|
|
||||||
|
function dir_is_empty($dir){
|
||||||
|
if($handle = opendir($dir)){
|
||||||
|
while($item = readdir($handle)){
|
||||||
|
if ($item != "." && $item != "..") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function autopub(){
|
||||||
|
emLoadJQuery();
|
||||||
|
echo '<script type="text/javascript">$(function(){$.get("'.DYNAMIC_BLOGURL.'?plugin=autopub");})</script>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dir_is_empty(AUTOPUB_CACHE_DIR)) {
|
||||||
|
addAction('index_footer', 'autopub');
|
||||||
|
addAction('adm_footer', 'autopub');
|
||||||
|
}
|
||||||
|
|
||||||
|
function autopub_menu() {
|
||||||
|
echo '<div class="sidebarsubmenu" id="autopub"><a href="./plugin.php?plugin=autopub">自动发布</a></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
addAction('adm_sidebar_ext', 'autopub_menu');
|
||||||
|
?>
|
||||||
75
autopub_setting.php
Normal file
75
autopub_setting.php
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* autopub_setting.php
|
||||||
|
* design by 小松
|
||||||
|
*/
|
||||||
|
|
||||||
|
!defined('EMLOG_ROOT') && exit('access deined!');
|
||||||
|
!defined('AUTOPUB_CACHE_DIR') && define('AUTOPUB_CACHE_DIR', EMLOG_ROOT.'/content/plugins/autopub/cache/');
|
||||||
|
function plugin_setting_view(){
|
||||||
|
}
|
||||||
|
function adminview(){
|
||||||
|
$DB = MySql::getInstance();
|
||||||
|
$sql = "SELECT gid,title FROM ".DB_PREFIX."blog where hide ='y' and type = 'blog' order by date DESC";
|
||||||
|
$result = $DB->query($sql);
|
||||||
|
$i = 1;
|
||||||
|
while($row = $DB->fetch_array($result)){
|
||||||
|
if(file_exists(AUTOPUB_CACHE_DIR.$row['gid'].'.php')){
|
||||||
|
include_once(AUTOPUB_CACHE_DIR.$row['gid'].'.php');
|
||||||
|
}else{
|
||||||
|
$year = $month = $day = $hour = $minute = $second = '';
|
||||||
|
}
|
||||||
|
$output .= '<form action="plugin.php?plugin=autopub&action=setting&pub='.$row['gid'].'" method="post"><p>';
|
||||||
|
$output .= $i.'、<a href="'.BLOG_URL.'admin/write_log.php?action=edit&gid='.$row['gid'].'">'.$row['title'].'</a> ';
|
||||||
|
$output .= '预发布时间:<input name="year" type="text" value="'.$year.'" size="3" />年<input name="month" type="text" value="'.$month.'" size="3" />月<input name="day" type="text" value="'.$day.'" size="3" />日<input name="hour" type="text" value="'.$hour.'" size="3" />时<input name="minute" type="text" value="'.$minute.'" size="3" />分<input name="second" type="text" value="'.$second.'" size="3" />秒 ';
|
||||||
|
$output .= '<input type="submit" value="保 存" class="submit" /></p></form>';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
if(empty($output)){
|
||||||
|
$output = '<p>暂无待发布日志!请将待发布日志保存为草稿!</p>';
|
||||||
|
}
|
||||||
|
echo $output;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
$("#autopub").addClass('sidebarsubmenu1');
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<div class="containertitle"><b>自动发布</b>
|
||||||
|
<?php if(isset($_GET['setting'])):?><span class="actived">插件设置完成</span><?php endif;?>
|
||||||
|
<?php if(isset($_GET['error'])):?><span class="error">插件设置失败,请填写合理日期!年月日必填</span><?php endif;?>
|
||||||
|
</div>
|
||||||
|
<div class="line"></div>
|
||||||
|
<div>
|
||||||
|
<?php adminview(); ?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
function plugin_setting(){
|
||||||
|
if(isset($_GET['pub']))
|
||||||
|
{
|
||||||
|
$gid = isset($_GET['pub']) ? intval($_GET['pub']) : -1;
|
||||||
|
$year = isset($_POST['year']) ? intval($_POST['year']) : 0;
|
||||||
|
$month = isset($_POST['month']) ? intval($_POST['month']) : 0;
|
||||||
|
$day = isset($_POST['day']) ? intval($_POST['day']) : 0;
|
||||||
|
$hour = isset($_POST['hour']) ? intval($_POST['hour']) : 0;
|
||||||
|
$minute = isset($_POST['minute']) ? intval($_POST['minute']) : 0;
|
||||||
|
$second = isset($_POST['second']) ? intval($_POST['second']) : 0;
|
||||||
|
$data = "<?php
|
||||||
|
\$year = ".$year.";
|
||||||
|
\$month = ".$month.";
|
||||||
|
\$day = ".$day.";
|
||||||
|
\$hour = ".$hour.";
|
||||||
|
\$minute = ".$minute.";
|
||||||
|
\$second = ".$second.";
|
||||||
|
?>";
|
||||||
|
$file = AUTOPUB_CACHE_DIR.$gid.'.php';
|
||||||
|
if($year != 0 && $month != 0 && $day != 0){
|
||||||
|
@ $fp = fopen($file, 'wb') OR emMsg('读取文件失败,如果您使用的是Unix/Linux主机,请修改/content/plugins/autopub/cache/目录的权限为777。如果您使用的是Windows主机,请联系管理员,将该文件设为everyone可写');
|
||||||
|
@ $fw = fwrite($fp,$data) OR emMsg('写入文件失败,如果您使用的是Unix/Linux主机,请修改/content/plugins/autopub/cache/目录的权限为777。如果您使用的是Windows主机,请联系管理员,将该文件设为everyone可写');
|
||||||
|
fclose($fp);
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
autopub_show.php
Normal file
22
autopub_show.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
!defined('EMLOG_ROOT') && exit('access deined!');
|
||||||
|
define('AUTOPUB_CACHE_DIR', EMLOG_ROOT.'/content/plugins/autopub/cache/');
|
||||||
|
set_time_limit(0);
|
||||||
|
$DB = MySql::getInstance();
|
||||||
|
$CACHE = Cache::getInstance();
|
||||||
|
$sql = "SELECT gid FROM ".DB_PREFIX."blog where hide ='y' order by date DESC";
|
||||||
|
$result = $DB->query($sql);
|
||||||
|
while($row = $DB->fetch_array($result)){
|
||||||
|
if(file_exists(AUTOPUB_CACHE_DIR.$row['gid'].'.php')){
|
||||||
|
include_once(AUTOPUB_CACHE_DIR.$row['gid'].'.php');
|
||||||
|
$pub_time = emStrtotime($year.'-'.$month.'-'.$day.' '.$hour.':'.$minute.':'.$second);
|
||||||
|
if(time() > $pub_time){
|
||||||
|
$sql_do = "UPDATE ".DB_PREFIX."blog SET hide = 'n',date = '".$pub_time."' WHERE gid='".$row['gid']."'";
|
||||||
|
$DB->query($sql_do);
|
||||||
|
$CACHE->updateCache();
|
||||||
|
doAction('save_log', $row['gid']);
|
||||||
|
unlink(AUTOPUB_CACHE_DIR.$row['gid'].'.php');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user