From: shizuki Date: Fri, 10 Jul 2009 14:06:15 +0000 (+0000) Subject: Code Cleanup(BLOG.php/ADMIN.php) X-Git-Tag: release-3-50~22 X-Git-Url: http://git.sourceforge.jp/view?p=nucleus-jp%2Fnucleus-jp-ancient.git;a=commitdiff_plain;h=e25a5c9db7e283bc88c8fd87d8c3f746409440db Code Cleanup(BLOG.php/ADMIN.php) CHANGE:Notify ITEM link after karma votes(ACTION.php) CHANGE:Remove bsendping col from nucleus_blog table(install.sql/upgrade3.5.php) ADD:sql_field_name function for backup class(mysql.php/pdo.php) FIX:Fix short open tag(NP_Ping.php) CHANGE:remove bsendping flag related code in core NP_Ping option move to plugin level git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@1030 1ca29b6e-896d-4ea0-84a5-967f57386b96 --- diff --git a/utf8/install.sql b/utf8/install.sql index afb2fbd..9ae4a02 100755 --- a/utf8/install.sql +++ b/utf8/install.sql @@ -15,9 +15,9 @@ CREATE TABLE `nucleus_activation` ( CREATE TABLE `nucleus_ban` ( `iprange` varchar(15) NOT NULL default '', `reason` varchar(255) NOT NULL default '', - `blogid` int(11) NOT NULL default '0', - KEY `iprange` (`iprange`), - KEY `blogid` (`blogid`) + `blogid` int(11) NOT NULL default '0' +-- KEY `iprange` (`iprange`), +-- KEY `blogid` (`blogid`) ) TYPE=MyISAM; CREATE TABLE `nucleus_blog` ( @@ -33,7 +33,7 @@ CREATE TABLE `nucleus_blog` ( `bupdate` varchar(60) default NULL, `bdefskin` int(11) NOT NULL default '1', `bpublic` tinyint(2) NOT NULL default '1', - `bsendping` tinyint(2) NOT NULL default '0', +-- `bsendping` tinyint(2) NOT NULL default '0', `bconvertbreaks` tinyint(2) NOT NULL default '1', `bdefcat` int(11) default NULL, `bnotifytype` int(11) NOT NULL default '15', @@ -48,7 +48,6 @@ CREATE TABLE `nucleus_blog` ( INSERT INTO `nucleus_blog` VALUES (1, 'My Nucleus CMS', 'mynucleuscms', '', 1, 0, 0.0, '', 'http://localhost:8080/nucleus/', '', 5, 1, 0, 1, 1, 1, 1, 0, 0, 0); - CREATE TABLE `nucleus_category` ( `catid` int(11) NOT NULL auto_increment, `cblog` int(11) NOT NULL default '0', @@ -140,8 +139,8 @@ CREATE TABLE `nucleus_item` ( CREATE TABLE `nucleus_karma` ( `itemid` int(11) NOT NULL default '0', - `ip` char(15) NOT NULL default '', - KEY `itemid` (`itemid`) + `ip` char(15) NOT NULL default '' +--, KEY `itemid` (`itemid`) ) TYPE=MyISAM; CREATE TABLE `nucleus_member` ( diff --git a/utf8/nucleus/bookmarklet.php b/utf8/nucleus/bookmarklet.php index ba30150..298901d 100755 --- a/utf8/nucleus/bookmarklet.php +++ b/utf8/nucleus/bookmarklet.php @@ -110,7 +110,7 @@ function bm_doAddItem() { $aTag = ' '; $message = _BOOKMARKLET_NEW_CATEGORY . $aTag . _BOOKMARKLET_NEW_CATEGORY_EDIT . ''; $extrahead = ''; - } elseif ( (postVar('actiontype') == 'addnow') && $blog->sendPing() ) { + } elseif ( (postVar('actiontype') == 'addnow')) { $message = _BOOKMARKLET_SEND_PING; $pingUrl = $manager->addTicketToUrl($CONF['AdminURL'] . 'index.php?action=sendping&blogid=' . intval($blogid) ); $extrahead = ''; diff --git a/utf8/nucleus/documentation/devdocs/sqltables.html b/utf8/nucleus/documentation/devdocs/sqltables.html index 05c14b3..7ea28f1 100755 --- a/utf8/nucleus/documentation/devdocs/sqltables.html +++ b/utf8/nucleus/documentation/devdocs/sqltables.html @@ -279,12 +279,6 @@ メンバーー以外にもコメントを許可するかどうか(1=許可/0=不許可) - bsendping - tinyint(2) - 0 - 更新があったときにブログ検索サービスにpingを送る。(1=送る/0=送らない) このオプションは NP_Ping 及びそれに類するプラグインがインストールされている時のみ表示されます。 - - bconvertbreaks tinyint(2) 1 diff --git a/utf8/nucleus/libs/ADMIN.php b/utf8/nucleus/libs/ADMIN.php index bd956cf..3679e9b 100755 --- a/utf8/nucleus/libs/ADMIN.php +++ b/utf8/nucleus/libs/ADMIN.php @@ -1210,7 +1210,7 @@ class ADMIN { } else { $timestamp =0; } - $doping = ($publish && $timestamp < $blog->getCorrectTime() && postVar('dosendping')) ? 1 : 0; + $doping = ($publish && $timestamp < $blog->getCorrectTime()) ? 1 : 0; // edit the item for real ITEM::update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp); @@ -1222,7 +1222,7 @@ class ADMIN { ITEM::delete($draftid); } - if (!$closed && $doping && $blog->sendPing() && numberOfEventSubscriber('SendPing') > 0) { // + if (!$closed && $doping && numberOfEventSubscriber('SendPing') > 0) { $this->action_sendping($blogid); return; } @@ -1449,11 +1449,14 @@ class ADMIN { $blog =& $manager->getBlog($blogid); $btimestamp = $blog->getCorrectTime(); $item = $manager->getItem(intval($result['itemid']), 1, 1); - if (!$item['draft'] && postVar('dosendping') && $item['timestamp'] <= $btimestamp) { + + // TODO: ED$ should be skipping to itemlist always eventually + if (!$item['draft'] && $item['timestamp'] <= $btimestamp) { $nextAction = 'sendping'; } else { $nextAction = 'itemlist'; } + if ($result['status'] == 'newcategory') { $distURI = $manager->addTicketToUrl($CONF['AdminURL'] . 'index.php?action=' . $nextAction . '&blogid=' . intval($blogid)); $this->action_categoryedit($result['catid'], $blogid, $distURI); @@ -2589,15 +2592,6 @@ class ADMIN { /> - 0) { - ?> - - input_yesno('sendping',$blog->sendPing(),85); ?> - - @@ -3058,7 +3052,6 @@ class ADMIN { $blog->setDefaultSkin(intPostVar('defskin')); $blog->setDescription(trim(postVar('desc'))); $blog->setPublic(postVar('public')); - $blog->setPingUserland(postVar('sendping')); $blog->setConvertBreaks(intPostVar('convertbreaks')); $blog->setAllowPastPosting(intPostVar('allowpastposting')); $blog->setDefaultCategory(intPostVar('defcat')); diff --git a/utf8/nucleus/libs/BLOG.php b/utf8/nucleus/libs/BLOG.php index d2de922..b36e05e 100755 --- a/utf8/nucleus/libs/BLOG.php +++ b/utf8/nucleus/libs/BLOG.php @@ -79,12 +79,15 @@ class BLOG { * @param $template * String representing the template name to be used */ - function showArchive($templatename, $year, $month, $day=0) { + function showArchive($templatename, $year, $month = 0, $day = 0) { // create extra where clause for select query - if ($day == 0) { + if ($day == 0 && $month != 0) { $timestamp_start = mktime(0,0,0,$month,1,$year); $timestamp_end = mktime(0,0,0,$month+1,1,$year); // also works when $month==12 + } elseif ($month == 0) { + $timestamp_start = mktime(0,0,0,1,1,$year); + $timestamp_end = mktime(0,0,0,12,31,$year); // also works when $month==12 } else { $timestamp_start = mktime(0,0,0,$month,$day,$year); $timestamp_end = mktime(0,0,0,$month,$day+1,$year); @@ -580,7 +583,6 @@ class BLOG { if ($mode == 'day') $query .= ', Day'; - $query .= ' ORDER BY itime DESC'; if ($limit > 0) @@ -610,6 +612,7 @@ class BLOG { $data['day'] = ''; $archive['day'] = ''; } + $data['year'] = date('Y',$current->itime); $archive['year'] = $data['year']; $data['archivelink'] = createArchiveLink($this->getID(),$archivedate,$linkparams); @@ -828,7 +831,6 @@ class BLOG { . " btimeoffset=" . $offset . "," . " bpublic=" . intval($this->isPublic()) . "," . " breqemail=" . intval($this->emailRequired()) . "," - . " bsendping=" . intval($this->sendPing()) . "," . " bconvertbreaks=" . intval($this->convertBreaks()) . "," . " ballowpast=" . intval($this->allowPastPosting()) . "," . " bnotify='" . addslashes($this->getNotifyAddress()) . "'," @@ -884,14 +886,6 @@ class BLOG { } } - function sendPing() { - return $this->getSetting('bsendping'); - } - - function setPingUserland($val) { - $this->setSetting('bsendping',$val); - } - function convertBreaks() { return $this->getSetting('bconvertbreaks'); } diff --git a/utf8/nucleus/libs/sql/mysql.php b/utf8/nucleus/libs/sql/mysql.php index 3aa8360..beeeb80 100755 --- a/utf8/nucleus/libs/sql/mysql.php +++ b/utf8/nucleus/libs/sql/mysql.php @@ -2,7 +2,7 @@ /* * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) - * Copyright (C) 2002-2007 The Nucleus Group + * Copyright (C) 2002-2009 The Nucleus Group * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ */ /** * @license http://nucleuscms.org/license.txt GNU General Public License - * @copyright Copyright (C) 2002-2007 The Nucleus Group + * @copyright Copyright (C) 2002-2009 The Nucleus Group * @version $Id$ */ diff --git a/utf8/nucleus/libs/sql/pdo.php b/utf8/nucleus/libs/sql/pdo.php index f9b29f5..a29c2f0 100755 --- a/utf8/nucleus/libs/sql/pdo.php +++ b/utf8/nucleus/libs/sql/pdo.php @@ -2,7 +2,7 @@ /* * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) - * Copyright (C) 2002-2007 The Nucleus Group + * Copyright (C) 2002-2009 The Nucleus Group * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ */ /** * @license http://nucleuscms.org/license.txt GNU General Public License - * @copyright Copyright (C) 2002-2007 The Nucleus Group + * @copyright Copyright (C) 2002-2009 The Nucleus Group * @version $Id$ */ diff --git a/utf8/nucleus/plugins/NP_Ping.php b/utf8/nucleus/plugins/NP_Ping.php index 3fc4b6d..26bc1dd 100644 --- a/utf8/nucleus/plugins/NP_Ping.php +++ b/utf8/nucleus/plugins/NP_Ping.php @@ -10,6 +10,8 @@ v1.4 - language file support v1.5 - remove arg1 in exec() call v1.6 - move send update ping override option to plugin + v1.7 - move send ping option from blog to plugin/blog level + - remove ping override option */ class NP_Ping extends NucleusPlugin { @@ -18,7 +20,7 @@ class NP_Ping extends NucleusPlugin { function getAuthor() { return 'admun (Edmond Hui)'; } function getURL() { return 'http://edmondhui.homeip.net/nudn'; } - function getVersion() { return '1.6'; } + function getVersion() { return '1.7'; } function getMinNucleusVersion() { return '330'; } @@ -53,15 +55,18 @@ class NP_Ping extends NucleusPlugin { $this->createOption('pingpong_blogs',_PING_BLOGS,'yesno','no'); // http://blo.gs $this->createOption('pingpong_weblogues',_PING_WEBLOGUES,'yesno','no'); // http://weblogues.com/ $this->createOption('pingpong_bloggde',_PING_BLOGGDE,'yesno','no'); // http://blogg.de - $this->createOption('ping_background',_PING_BG,'yesno','yes'); + $this->createOption('ping_background',_PING_BG,'yesno','no'); + + $this->createBlogOption('ping_sendping', _PING_SENDPING, 'yesno', 'yes'); } function getEventList() { return array( 'SendPing', 'JustPosted' - 'AddItemFormExtras', - 'EditItemFormExtras'); +// 'AddItemFormExtras', +// 'EditItemFormExtras' + ); } function event_JustPosted($data) { @@ -72,12 +77,13 @@ class NP_Ping extends NucleusPlugin { return; } - if ($this->getOption('ping_background') == "yes") { + if ($this->getBlogOption('ping_sendping') == "yes") { +// if ($this->getOption('ping_background') == "yes") { exec("php $DIR_PLUGINS/ping/ping.php " . $data['blogid'] . " &"); } else { $this->sendPings($data['blogid']); - ACTIONLOG::add(INFO, 'NP_Ping: Sending ping (from foreground)'); +// ACTIONLOG::add(INFO, 'NP_Ping: Sending ping (from foreground)'); } // mark the ping has been sent @@ -88,7 +94,7 @@ class NP_Ping extends NucleusPlugin { $this->sendPings($data); } - function DisplayFormOptions($sendping) { +/* function DisplayFormOptions($sendping) { if ($sendping) { $check = 'checked="checked"'; } else { @@ -107,8 +113,9 @@ class NP_Ping extends NucleusPlugin { // we are not sending ping by default after edit an item $this->DisplayFormOptions(0); } - +*/ function sendPings($data) { + if (!class_exists('xmlrpcmsg')) { global $DIR_LIBS; include($DIR_LIBS . 'xmlrpc.inc.php'); @@ -157,6 +164,8 @@ class NP_Ping extends NucleusPlugin { echo $this->pingBloggDe(); echo "
"; } + + ACTIONLOG::add(INFO, 'NP_Ping: ping sent'); } function pingPingomatic() { diff --git a/utf8/nucleus/plugins/ping/english.php b/utf8/nucleus/plugins/ping/english.php index 627aa50..226c58c 100644 --- a/utf8/nucleus/plugins/ping/english.php +++ b/utf8/nucleus/plugins/ping/english.php @@ -15,4 +15,5 @@ define('_PING_SUCCESS', 'Success'); define('_UPDATEDPING_GOSENDPING', 'Send Update ping'); define('_PING_EXTRA_PLUGIN_OPTION', 'Blog Tracking Ping Service'); + define('_PING_SENDPING', 'Notify ping service when new post is added?'); ?> diff --git a/utf8/nucleus/plugins/ping/japanese-euc.php b/utf8/nucleus/plugins/ping/japanese-euc.php index c2ec03a..f4afce6 100644 --- a/utf8/nucleus/plugins/ping/japanese-euc.php +++ b/utf8/nucleus/plugins/ping/japanese-euc.php @@ -15,4 +15,5 @@ define('_PING_SUCCESS', 'À®¸ù'); define('_UPDATEDPING_GOSENDPING', 'ping¤òÁ÷¿®¤¹¤ë'); define('_PING_EXTRA_PLUGIN_OPTION', '¹¹¿·ping'); + define('_PING_SENDPING', '¿·¤·¤¯µ­»ö¤¬Åê¹Æ¤µ¤ì¤¿»þ¤Ë¹¹¿·ping¤òÁ÷¿®¤·¤Þ¤¹¤«¡©'); ?> diff --git a/utf8/nucleus/plugins/ping/japanese-utf8.php b/utf8/nucleus/plugins/ping/japanese-utf8.php index 5d7e029..f35abcb 100644 --- a/utf8/nucleus/plugins/ping/japanese-utf8.php +++ b/utf8/nucleus/plugins/ping/japanese-utf8.php @@ -15,4 +15,5 @@ define('_PING_SUCCESS', '成功'); define('_UPDATEDPING_GOSENDPING', 'pingを送信する'); define('_PING_EXTRA_PLUGIN_OPTION', '更新ping'); + define('_PING_SENDPING', '新しく記事が投稿された時に更新pingを送信しますか?'); ?> diff --git a/utf8/nucleus/upgrades/upgrade3.5.php b/utf8/nucleus/upgrades/upgrade3.5.php index d6ac4d8..17bc13a 100755 --- a/utf8/nucleus/upgrades/upgrade3.5.php +++ b/utf8/nucleus/upgrades/upgrade3.5.php @@ -33,6 +33,12 @@ function upgrade_do350() { upgrade_query('Altering ' . sql_table('member') . ' table', $query); + // changing the blog table to remove bsendping flag + $query = " ALTER TABLE `" . sql_table('blog') . "` + DROP `bsendping`;"; + + upgrade_query('Altering ' . sql_table('blog') . ' table', $query); + // 3.4 -> 3.5 // update database version update_version('350');