/**
* @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'] = '';
$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) ) {
// 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);
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;
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);
// parse the skin
$skin->parse($type);
+
+ // check to see we should throw JustPosted event
+ $blog->checkJustPosted();
}
/**
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;
+}
+
+?>