OSDN Git Service

sync with Rev1130,1132,1133
authorkimitake <kimitake@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Wed, 5 Sep 2007 06:26:17 +0000 (06:26 +0000)
committerkimitake <kimitake@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Wed, 5 Sep 2007 06:26:17 +0000 (06:26 +0000)
move weblogs.com ping to plugin, add ping SendPing event and infrastructure
JustPosted event
NP_Ping background ping

git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/branches/branch-3-3@314 1ca29b6e-896d-4ea0-84a5-967f57386b96

utf8/nucleus/libs/globalfunctions.php

index 35f0022..1806f2b 100755 (executable)
 /**
  * @license http://nucleuscms.org/license.txt GNU General Public License
  * @copyright Copyright (C) 2002-2007 The Nucleus Group
- * @version $Id: globalfunctions.php,v 1.23 2007-04-09 23:21:34 kmorimatsu Exp $
- * $NucleusJP: globalfunctions.php,v 1.22 2007/04/06 22:08:39 kmorimatsu Exp $
+ * @version $Id: globalfunctions.php,v 1.23.2.1 2007-09-05 06:26:17 kimitake Exp $
+ * $NucleusJP: globalfunctions.php,v 1.23 2007/04/09 23:21:34 kmorimatsu Exp $
  */
 
 // needed if we include globalfunctions from install.php
 global $nucleus, $CONF, $DIR_LIBS, $DIR_LANG, $manager, $member;
 
-//$nucleus['version'] = 'v3.3SVN';
-//$nucleus['codename'] = 'Lithium';
 $nucleus['version'] = 'v3.3';
 $nucleus['codename'] = '';
 
@@ -196,7 +194,7 @@ if ($action == 'login') {
        $login = postVar('login');
        $pw = postVar('password');
        $shared = intPostVar('shared'); // shared computer or not
-       
+
        $pw=substr($pw,0,40); // avoid md5 collision by using a long key
 
        if ($member->login($login, $pw) ) {
@@ -843,7 +841,7 @@ function selector() {
 
                // get next and prev month links ...
                global $archivenext, $archiveprev, $archivetype, $archivenextexists, $archiveprevexists;
-
+               
                // sql queries for the timestamp of the first and the last published item
                $query = "SELECT UNIX_TIMESTAMP(itime) as result FROM ".sql_table('item')." WHERE idraft=0 ORDER BY itime ASC";
                $first_timestamp=quickQuery ($query); 
@@ -855,8 +853,8 @@ function selector() {
                if ($d != 0) {
                        $archivetype = _ARCHIVETYPE_DAY;
                        $t = mktime(0, 0, 0, $m, $d, $y);
-
-                       $archiveprev = strftime('%Y-%m-%d', $t - (24 * 60 * 60) );
+                       // one day has 24 * 60 * 60 = 86400 seconds                     
+                       $archiveprev = strftime('%Y-%m-%d', $t - 86400 );
                        // check for published items                    
                        if ($t > $first_timestamp) {
                                $archiveprevexists = true;
@@ -864,31 +862,29 @@ function selector() {
                        else {
                                $archiveprevexists = false;
                        }
-
+                       
                        // one day later
-//                     $t += 86400; 
-//                     $archivenext = strftime('%Y-%m-%d', $t);
-                       $archivenext = strftime('%Y-%m-%d', $t + (24 * 60 * 60) );
-                       if ($t + (24 * 60 * 60) < $last_timestamp) {
+                       $t += 86400; 
+                       $archivenext = strftime('%Y-%m-%d', $t);
+                       if ($t < $last_timestamp) {
                                $archivenextexists = true;
                        }
                        else {
                                $archivenextexists = false;
                        }
-
+                       
                } else {
                        $archivetype = _ARCHIVETYPE_MONTH;
                        $t = mktime(0, 0, 0, $m, 1, $y);
-
-                       $archiveprev = strftime('%Y-%m', $t - (1 * 24 * 60 * 60) );
+                       // one day before is in the previous month
+                       $archiveprev = strftime('%Y-%m', $t - 86400);
                        if ($t > $first_timestamp) {
                                $archiveprevexists = true;
                        }
                        else {
                                $archiveprevexists = false;
                        }
-
-//                     $archivenext = strftime('%Y-%m', $t + (32 * 24 * 60 * 60) );
+                       
                        // timestamp for the next month                 
                        $t = mktime(0, 0, 0, $m+1, 1, $y);
                        $archivenext = strftime('%Y-%m', $t);
@@ -992,6 +988,9 @@ function selector() {
 
        // parse the skin
        $skin->parse($type);
+
+       // check to see we should throw JustPosted event
+       $blog->checkJustPosted();
 }
 
 /**
@@ -1981,4 +1980,17 @@ function ifset(&$var) {
        return null;
 }
 
-?>
\ No newline at end of file
+/**
+ * Returns number of subscriber to an event
+ *
+ * @param event
+ * @return number of subscriber(s)
+ */
+function numberOfEventSubscriber($event) {
+       $query = 'SELECT COUNT(*) as count FROM ' . sql_table('plugin_event') . ' WHERE event=\'' . $event . '\'';
+       $res = sql_query($query);
+       $obj = mysql_fetch_object($res);
+       return $obj->count;
+}
+
+?>