\r
/*\r
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2010 The Nucleus Group\r
+ * Copyright (C) 2002-2011 The Nucleus Group\r
*\r
* This program is free software; you can redistribute it and/or\r
* modify it under the terms of the GNU General Public License\r
*/\r
/**\r
* @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2010 The Nucleus Group\r
+ * @copyright Copyright (C) 2002-2011 The Nucleus Group\r
* @version $Id$\r
* $NucleusJP: globalfunctions.php,v 1.23.2.7 2008/02/05 08:30:08 kimitake Exp $\r
*/\r
// needed if we include globalfunctions from install.php\r
global $nucleus, $CONF, $DIR_LIBS, $DIR_LANG, $manager, $member;\r
\r
-$nucleus['version'] = 'v3.61';\r
+$nucleus['version'] = 'v3.62_Beta-jp';\r
$nucleus['codename'] = '';\r
\r
// check and die if someone is trying to override internal globals (when register_globals turn on)\r
}\r
\r
/*\r
+ * Set default time zone\r
+ * By Japanese Packaging Team, Jan.27, 2011\r
+ * For private server which has no condition for default time zone\r
+ */\r
+\r
+if (function_exists('date_default_timezone_get')) {\r
+ if (FALSE == ($timezone = @date_default_timezone_get()) {\r
+ $timezone = 'UTC';\r
+ }\r
+}\r
+if (function_exists('date_default_timezone_set')) {\r
+ @date_default_timezone_set($timezone);\r
+}\r
+\r
+/*\r
Indicates when Nucleus should display startup errors. Set to 1 if you want\r
the error enabled (default), false otherwise\r
\r
ACTIONLOG::add(INFO, "Login successful for $login (sharedpc=$shared)");\r
} else {\r
// errormessage for [%errordiv%]\r
- $errormessage = 'Login failed for ' . $login;\r
-\r
+ $trimlogin = trim($login);\r
+ if (empty($trimlogin))\r
+ {\r
+ $errormessage = "Please enter a username.";\r
+ }\r
+ else \r
+ {\r
+ $errormessage = 'Login failed for ' . $login;\r
+ } \r
$manager->notify('LoginFailed', array('username' => $login) );\r
ACTIONLOG::add(INFO, $errormessage);\r
}\r
}\r
\r
/*\r
+ * for preventing I/O strings from auto-detecting the charactor encodings by MySQL\r
+ * since 3.62_beta-jp\r
+ * Jan.20, 2011 by kotorisan and cacher\r
+ * refering to their conversation below,\r
+ * http://japan.nucleuscms.org/bb/viewtopic.php?p=26581\r
+ * \r
+ * NOTE: shift_jis is only supported for output. Using shift_jis in DB is prohibited.\r
+ * NOTE: iso-8859-x,windows-125x if _CHARSET is unset.\r
+ */\r
+if (in_array('mysql',$MYSQL_HANDLER)) {\r
+ switch(strtolower(_CHARSET)){\r
+ case 'utf-8':\r
+ $charset = 'utf8';\r
+ break;\r
+ case 'euc-jp':\r
+ $charset = 'ujis';\r
+ break;\r
+ case 'gb2312':\r
+ $charset = 'gb2312';\r
+ break;\r
+ case 'shift_jis':\r
+ $charset = 'sjis';\r
+ break;\r
+ default:\r
+ $resource = sql_query("show variables LIKE 'character_set_database'");\r
+ $fetchDat = sql_fetch_assoc($resource);\r
+ $charset = $fetchDat['Value'];\r
+ break;\r
+ }\r
+ $mySqlVer = implode('.', array_map('intval', explode('.', sql_get_server_info($MYSQL_CONN))));\r
+ if ($mySqlVer >= '5.0.7' && function_exists('mysql_set_charset')) {\r
+ mysql_set_charset($charset);\r
+ } elseif ($mySqlVer >= '4.1.0') {\r
+ sql_query("SET CHARACTER SET " . $charset);\r
+ }\r
+}\r
+\r
+/*\r
Backed out for now: See http://forum.nucleuscms.org/viewtopic.php?t=3684 for details\r
\r
// To remove after v2.5 is released and language files have been updated.\r
$i++;\r
\r
if ($i < sizeof($data) ) {\r
- $_REQUEST['special'] = $data[$i];\r
+ $special = $data[$i];\r
}\r
break;\r
\r
* returns the currently used version (100 = 1.00, 101 = 1.01, etc...)\r
*/\r
function getNucleusVersion() {\r
- return 361;\r
+ return 362;\r
}\r
\r
/**\r
{\r
return $text;\r
}\r
-\r
+ \r
if (is_array($expression) && (count($expression) == 0) )\r
{\r
return $text;\r
}\r
-\r
+ \r
// add a tag in front (is needed for preg_match_all to work correct)\r
$text = '<!--h-->' . $text;\r
-\r
+ \r
// split the HTML up so we have HTML tags\r
// $matches[0][i] = HTML + text\r
// $matches[1][i] = HTML\r
// $matches[2][i] = text\r
preg_match_all('/(<[^>]+>)([^<>]*)/', $text, $matches);\r
-\r
+ \r
// throw it all together again while applying the highlight to the text pieces\r
$result = '';\r
$count_matches = count($matches[2]);\r
{\r
$result .= $matches[1][$i];\r
}\r
-\r
+ \r
if (is_array($expression) )\r
{\r
foreach ($expression as $regex)\r
{\r
if ($regex)\r
{\r
- $matches[2][$i] = @eregi_replace($regex, $highlight, $matches[2][$i]);\r
+ //$matches[2][$i] = @eregi_replace($regex, $highlight, $matches[2][$i]);\r
+ $matches[2][$i] = @preg_replace("#".$regex."#i", $highlight, $matches[2][$i]);\r
}\r
}\r
-\r
+ \r
$result .= $matches[2][$i];\r
}\r
else\r
{\r
- $result .= @eregi_replace($expression, $highlight, $matches[2][$i]);\r
+ //$result .= @eregi_replace($expression, $highlight, $matches[2][$i]);\r
+ $result .= @preg_replace("#".$expression."#i", $highlight, $matches[2][$i]);\r
}\r
}\r
-\r
+ \r
return $result;\r
}\r
\r
// try to get line number/filename (extra headers_sent params only exists in PHP 4.3+)\r
if (function_exists('version_compare') && version_compare('4.3.0', phpversion(), '<=') ) {\r
headers_sent($hsFile, $hsLine);\r
- $extraInfo = ' in <code>' . $hsFile . '</code> line <code>' . $hsLine . '</code>';\r
+ $extraInfo = sprintf(_GFUNCTIONS_HEADERSALREADYSENT_FILE,$hsFile,$hsLine);\r
} else {\r
$extraInfo = '';\r
}\r
// itemid given -> only show that item\r
$type = 'item';\r
\r
- if (!$manager->existsItem($itemid,intval($CONF['allowFuture']),intval($CONF['allowDrafts']) ) {\r
+ if (!$manager->existsItem($itemid,intval($CONF['allowFuture']),intval($CONF['allowDrafts']))) {\r
doError(_ERROR_NOSUCHITEM);\r
}\r
\r
*/\r
function selectBlog($shortname) {\r
global $blogid, $archivelist;\r
- $blogid = getBlogIDFromName($shortname);\r
+ if (!$blogid) {\r
+ $blogid = getBlogIDFromName($shortname);\r
+ }\r
\r
// also force archivelist variable, if it is set\r
if ($archivelist) {\r
\r
function selectSkin($skinname) {\r
global $skinid;\r
- $skinid = SKIN::getIdFromName($skinname);\r
+ if (!$skinid) {\r
+ $skinid = SKIN::getIdFromName($skinname);\r
+ }\r
}\r
\r
/**\r
*/\r
function selectCategory($cat) {\r
global $catid;\r
- if (is_numeric($cat) ) {\r
- $catid = intval($cat);\r
- } else {\r
- $catid = getCatIDFromName($cat);\r
+ if (!$catid) {\r
+ if (is_numeric($cat) ) {\r
+ $catid = intval($cat);\r
+ } else {\r
+ $catid = getCatIDFromName($cat);\r
+ }\r
}\r
}\r
\r
function selectItem($id) {\r
global $itemid;\r
- $itemid = intval($id);\r
+ if (!$itemid) {\r
+ $itemid = intval($id);\r
+ }\r
}\r
\r
// force the use of a language file (warning: can cause warnings)\r
}\r
\r
/* Return if not index.php */\r
- if ( $phppath!=strtolower($plugin_name).'/' && $phppath!=strtolower($plugin_name).'/index.php' ) {\r
+ if ( ($phppath != strtolower($plugin_name) . '/') && ($phppath != strtolower($plugin_name) . '/index.php') )\r
+ {\r
return;\r
}\r
\r
/* Exit if not logged in. */\r
- if ( !$member->isLoggedIn() ) {\r
+ if ( !$member->isLoggedIn() )\r
+ {\r
exit(_GFUNCTIONS_YOU_AERNT_LOGGEDIN);\r
}\r
\r
global $manager,$DIR_LIBS,$DIR_LANG,$HTTP_GET_VARS,$HTTP_POST_VARS;\r
\r
/* Check if this feature is needed (ie, if "$manager->checkTicket()" is not included in the script). */\r
- if (!($p_translated=serverVar('PATH_TRANSLATED'))) {\r
+ if (!($p_translated=serverVar('PATH_TRANSLATED')))\r
+ {\r
$p_translated=serverVar('SCRIPT_FILENAME');\r
}\r
if ($file=@file($p_translated))\r
$prevline='';\r
foreach($file as $line)\r
{\r
- if (preg_match('/[\$]manager([\s]*)[\-]>([\s]*)checkTicket([\s]*)[\(]/i',$prevline.$line)) {\r
+ if (preg_match('/[\$]manager([\s]*)[\-]>([\s]*)checkTicket([\s]*)[\(]/i',$prevline.$line))\r
+ {\r
return;\r
}\r
$prevline=$line;\r
if ($uri=serverVar('REQUEST_URI'))\r
{\r
list($uri,$qstring)=explode('?',$uri);\r
- } else {\r
- if ( !($uri=serverVar('PHP_SELF')) ) {\r
+ }\r
+ else\r
+ {\r
+ if ( !($uri=serverVar('PHP_SELF')) )\r
+ {\r
$uri=serverVar('SCRIPT_NAME');\r
}\r
$qstring=serverVar('QUERY_STRING');\r
}\r
- if ($qstring) {\r
+ if ($qstring)\r
+ {\r
$qstring='?'.$qstring;\r
}\r
echo '<p>'._SETTINGS_UPDATE.' : '._QMENU_PLUGINS.' <span style="color:red;">'.htmlspecialchars($plugin_name)."</span> ?</p>\n";\r
$document = 'document';\r
$bookmarkletline = "javascript:Q='';x=".$document.";y=window;if(x.selection){Q=x.selection.createRange().text;}else if(y.getSelection){Q=y.getSelection();}else if(x.getSelection){Q=x.getSelection();}wingm=window.open('";\r
$bookmarkletline .= $CONF['AdminURL'] . "bookmarklet.php?blogid=$blogid";\r
- $bookmarkletline .="&logtext='+escape(Q)+'&loglink='+escape(x.location.href)+'&loglinktitle='+escape(x.title),'nucleusbm','toolbar=no,scrollbars=no,width=710,height=550,left=10,top=10,status=no,resizable=yes');wingm.focus();";\r
+ $bookmarkletline .="&logtext='+escape(Q)+'&loglink='+encodeURIComponent(x.location.href)+'&loglinktitle='+escape(x.title),'nucleusbm','toolbar=no,scrollbars=no,width=600,height=550,left=10,top=10,status=no,resizable=yes');wingm.focus();";\r
\r
return $bookmarkletline;\r
}\r
$cleaner[] = array('expression'=>"/[ç]/",'replace'=>"c");\r
\r
$str = strtolower($str);\r
- $ext_point = strripos($str,".");\r
+ $ext_point = strrpos($str,".");\r
if ($ext_point===false) return false;\r
$ext = substr($str,$ext_point,strlen($str));\r
$str = substr($str,0,$ext_point);\r
\r
- foreach( $cleaner as $cv ) $str = preg_replace($cv["expression"],$cv["replace"],$str);\r
+ //foreach( $cleaner as $cv ) $str = preg_replace($cv["expression"],$cv["replace"],$str);\r
\r
return preg_replace("/[^a-z0-9-]/","_",$str).$ext;\r
}\r