/**\r
* @license http://nucleuscms.org/license.txt GNU General Public License\r
* @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: index.php 1705 2012-03-23 15:46:55Z sakamocchi $\r
+ * @version $Id: index.php 1745 2012-04-12 23:45:47Z sakamocchi $\r
*/\r
\r
/* global values initialize */\r
/* reporting all errors for support */\r
error_reporting(E_ALL);\r
\r
-$minimum_php_version = '5.0.6';\r
-$minimum_mysql_version = '3.23';\r
+$minimum_php_version = '5.0.6';\r
+$minimum_mysql_version = '3.23';\r
\r
-$page_footer_copyright = '© 2001-2012 The Nucleus Groupe . Running Nucleus CMS v4.00';\r
+$page_footer_copyright = '© 2001-2012 The Nucleus Groupe . Running Nucleus CMS v4.00';\r
\r
// begin if: server's PHP version is below the minimum; halt installation\r
if ( version_compare(PHP_VERSION, $minimum_php_version, '<') )\r
{\r
- exit('<div style="font-size: xx-large;"> Nucleus requires at least PHP version '. $minimum_php_version .'</div>');\r
+ exit('<div style="font-size: xx-large;"> Nucleus requires at least PHP version ' . $minimum_php_version . '</div>');\r
}\r
\r
// make sure there's no unnecessary escaping: # set_magic_quotes_runtime(0);\r
}\r
\r
/* default installed plugins and skins */\r
-$aConfPlugsToInstall = array('NP_SecurityEnforcer', 'NP_SkinFiles', 'NP_Text');\r
-$aConfSkinsToImport = array('atom', 'rss2.0', 'rsd', 'default');\r
+$aConfPlugsToInstall = array('NP_SecurityEnforcer', 'NP_SkinFiles', 'NP_Text');\r
+$aConfSkinsToImport = array('atom', 'rss2.0', 'rsd', 'default');\r
\r
// Check if some important files\r
do_check_files();\r
}\r
\r
// include core classes that are needed for login & plugin handling\r
-include_once('../nucleus/libs/mysql.php');\r
\r
// added for 3.5 sql_* wrapper\r
global $MYSQL_HANDLER;\r
{\r
$MYSQL_HANDLER = array('mysql', '');\r
}\r
-include_once('../nucleus/libs/sql/' . $MYSQL_HANDLER[0] . '.php');\r
+include_once('../nucleus/libs/sql/sql.php');\r
\r
session_start();\r
if ( count($_GET) == 0 && count($_POST) == 0 )\r
}\r
else\r
{\r
- $param = new PARAM_MANAGER();\r
+ $param = new ParamManager();\r
}\r
\r
// include translation file\r
}\r
exit;\r
\r
-\r
/**\r
* installer action\r
*/\r
header("Cache-Control: no-cache, must-revalidate");\r
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");\r
header('Content-Type: text/html; charset=' . i18n::get_current_charset());\r
-\r
?>\r
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
<html xmlns="http://www.w3.org/1999/xhtml">\r
<?php echo _BODYFONTSTYLE; ?>\r
-->\r
</style>\r
+ <script type="text/javascript">\r
+ function SelectText( element ) {\r
+ window.setTimeout( function() { element.select() }, 0 );\r
+ }\r
+ var isSubmit = false;\r
+ function OnceSubmit() {\r
+ if (!isSubmit) {\r
+ isSubmit = true;\r
+ window.setTimeout( function() { isSubmit = false; }, 10000 );\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+ </script>\r
</head>\r
<body>\r
<div id="header">\r
<div id="navigation">\r
<h1><img src="./styles/nucleus_rogo.png" alt="NucleusCMS" /></h1>\r
<ul>\r
- <?php\r
- if ( in_array($param->state, array('mysql', 'weblog', 'install')) )\r
- {\r
- echo '<li>', _STEP1, '</li><li';\r
- if ( $param->state == 'mysql' )\r
- {\r
- echo ' class="gry"';\r
- }\r
- echo '> > ', _STEP2, '</li><li';\r
- if ( in_array($param->state, array('mysql', 'weblog')) )\r
- {\r
- echo ' class="gry"';\r
- }\r
- echo '> > ', _STEP3, "</li>¥n";\r
- }\r
- if ( in_array($param->state, array('mysql', 'weblog', 'detail')) )\r
- {\r
- echo '<li class="rightbox">';\r
- if ( in_array($param->state, array('mysql', 'weblog')) )\r
- {\r
- echo '<a href="./?mode=detail">', _MODE2, '</a>';\r
- }\r
- else\r
- {\r
- echo '<a href="./?mode=simple">', _MODE1, '</a>';\r
- }\r
- echo '</li>';\r
- }\r
- ?>\r
+<?php\r
+ if ( in_array($param->state, array('mysql', 'weblog', 'install')) )\r
+ {\r
+ echo '<li>', _STEP1, '</li><li';\r
+ if ( $param->state == 'mysql' )\r
+ {\r
+ echo ' class="gry"';\r
+ }\r
+ echo '> > ', _STEP2, '</li><li';\r
+ if ( in_array($param->state, array('mysql', 'weblog')) )\r
+ {\r
+ echo ' class="gry"';\r
+ }\r
+ echo '> > ', _STEP3, "</li>\n";\r
+ }\r
+ if ( in_array($param->state, array('mysql', 'weblog', 'detail')) )\r
+ {\r
+ echo '<li class="rightbox">';\r
+ if ( in_array($param->state, array('mysql', 'weblog')) )\r
+ {\r
+ echo '<a href="./?mode=detail">', _MODE2, '</a>';\r
+ }\r
+ else\r
+ {\r
+ echo '<a href="./?mode=simple">', _MODE1, '</a>';\r
+ }\r
+ echo '</li>';\r
+ }\r
+?>\r
</ul>\r
</div>\r
</div>\r
// Get the browser language that can be displayed\r
// TODO: default locale select simple implementation\r
$languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);\r
- foreach ($languages as $language)\r
+ foreach ( $languages as $language )\r
{\r
- $language = preg_replace('#([¥w]+).*#', '$1', $language);\r
+ $language = preg_replace('#([\w]+).*#', '$1', $language);\r
break;\r
}\r
\r
<?php\r
foreach ( $locales as $locale )\r
{\r
- echo "<option value=¥"$locale[0]¥"";\r
+ echo "<option value=\"$locale[0]\"";\r
if ( i18n::strpos($locale[0], $language) === 0 )\r
{\r
echo ' selected';\r
}\r
- echo ">$locale[1]</option>¥n";\r
+ echo ">$locale[1]</option>\n";\r
}\r
?>\r
</select>\r
\r
$config_writable = canConfigFileWritable();\r
$mysql_version = getMySqlVersion();\r
- ?>\r
+?>\r
<div id="container">\r
<p class="msg">\r
<?php\r
}\r
if ( $mysql_version == '0.0.0' )\r
{\r
- echo '<span class="err">', _ERROR21, '</span>';\r
+ echo '<span class="err">', _DBVERSION_UNKOWN, '</span>';\r
}\r
elseif ( version_compare($mysql_version, $minimum_mysql_version, '<') )\r
{\r
- echo '<span class="err">', sprintf(_ERROR20 , $minimum_mysql_version), '</span>';\r
+ echo '<span class="err">', sprintf(_DBVERSION_TOOLOW, $minimum_mysql_version), '</span>';\r
}\r
?>\r
</p>\r
{\r
foreach ( $errors as $error )\r
{\r
- echo '<span class="err">', $error, "</span>¥n";\r
+ echo '<span class="err">', $error, "</span>\n";\r
}\r
}\r
}\r
<td><input type="text" name="mysql_user" value="<?php echo $param->mysql_user; ?>" /></td>\r
</tr>\r
<tr>\r
- <th><span class="nam"><?php echo _DB_FIELD3; ?></span><span class="sub"><?php echo _DB_FIELD3_DESC; ?></span></th>\r
+ <th><span class="nam"><?php echo _DB_FIELD3; ?></span></th>\r
<td><input type="text" name="mysql_password" value="<?php echo $param->mysql_password; ?>" /></td>\r
</tr>\r
<tr>\r
function show_blog_setting_form($isPostback)\r
{\r
global $param;\r
-\r
?>\r
<div id="container">\r
<p class="msg">\r
{\r
foreach ( $errors as $error )\r
{\r
- echo '<span class="err">', $error, "</span>¥n";\r
+ echo '<span class="err">', $error, "</span>\n";\r
}\r
}\r
}\r
{\r
foreach ( $errors as $error )\r
{\r
- echo '<span class="err">', $error, "</span>¥n";\r
+ echo '<span class="err">', $error, "</span>\n";\r
}\r
}\r
}\r
<td><input type="text" name="user_name" value="<?php echo $param->user_name; ?>" /></td>\r
</tr>\r
<tr>\r
- <th><span class="nam"><?php echo _ADMIN_FIELD3; ?></span><span class="sub"><?php echo _ADMIN_FIELD3_DESC; ?></span></th>\r
+ <th><span class="nam"><?php echo _ADMIN_FIELD3; ?></span></th>\r
<td><input type="password" name="user_password" /></td>\r
</tr>\r
<tr>\r
- <th><span class="nam"><?php echo _ADMIN_FIELD4; ?></span><span class="sub"><?php echo _ADMIN_FIELD4_DESC; ?></span></th>\r
+ <th><span class="nam"><?php echo _ADMIN_FIELD4; ?></span></th>\r
<td><input type="password" name="user_password2" /></td>\r
</tr>\r
<tr>\r
</tr>\r
</table>\r
<p class="sbt">\r
- <button type="submit" name="action" value="weblog" class="sbt_arw"><?php echo _INSTALL; ?></button>\r
+ <button type="submit" name="action" value="weblog" class="sbt_arw" onclick="OnceSubmit()"><?php echo _INSTALL; ?></button>\r
</p>\r
</div>\r
</form>\r
<?php\r
if ( $isPostback && !$param->check_all_parameters() )\r
{\r
- echo '<span class="err">', _ERROR26, "</span>¥n";\r
+ echo '<span class="err">', _VALID_ERROR, "</span>\n";\r
}\r
?>\r
</p>\r
<li>PHP: <?php echo phpversion(); ?></li>\r
<li>MySQL:\r
<?php\r
- echo ($mysql_version == '0.0.0') ? _ERROR21 : $mysql_version;\r
+ echo ($mysql_version == '0.0.0') ? _DBVERSION_UNKOWN : $mysql_version;\r
if ( version_compare($mysql_version, $minimum_mysql_version, '<') )\r
{\r
- echo '<span class="err">', sprintf(_ERROR20 , $minimum_mysql_version), '</span>';\r
+ echo '<span class="err">', sprintf(_DBVERSION_TOOLOW, $minimum_mysql_version), '</span>';\r
}\r
?></li>\r
</ul>\r
{\r
foreach ( $errors as $error )\r
{\r
- echo '<span class="err">', $error, "</span>¥n";\r
+ echo '<span class="err">', $error, "</span>\n";\r
}\r
}\r
}\r
<td><input type="text" name="mysql_user" value="<?php echo $param->mysql_user; ?>" /></td>\r
</tr>\r
<tr>\r
- <th><span class="nam"><?php echo _DB_FIELD3; ?></span><span class="sub"><?php echo _DB_FIELD3_DESC; ?></span></th>\r
+ <th><span class="nam"><?php echo _DB_FIELD3; ?></span></th>\r
<td><input type="text" name="mysql_password" value="<?php echo $param->mysql_password; ?>" /></td>\r
</tr>\r
<tr>\r
{\r
foreach ( $errors as $error )\r
{\r
- echo '<span class="err">', $error, "</span>¥n";\r
+ echo '<span class="err">', $error, "</span>\n";\r
}\r
}\r
$errors = $param->check_path_parameters();\r
{\r
foreach ( $errors as $error )\r
{\r
- echo '<span class="err">', $error, "</span>¥n";\r
+ echo '<span class="err">', $error, "</span>\n";\r
}\r
}\r
}\r
{\r
foreach ( $errors as $error )\r
{\r
- echo '<span class="err">', $error, "</span>¥n";\r
+ echo '<span class="err">', $error, "</span>\n";\r
}\r
}\r
}\r
<td><input type="text" name="user_name" value="<?php echo $param->user_name; ?>" /></td>\r
</tr>\r
<tr>\r
- <th><span class="nam"><?php echo _ADMIN_FIELD3; ?></span><span class="sub"><?php echo _ADMIN_FIELD3_DESC; ?></span></th>\r
+ <th><span class="nam"><?php echo _ADMIN_FIELD3; ?></span></th>\r
<td><input type="password" name="user_password" /></td>\r
</tr>\r
<tr>\r
- <th><span class="nam"><?php echo _ADMIN_FIELD4; ?></span><span class="sub"><?php echo _ADMIN_FIELD4_DESC; ?></span></th>\r
+ <th><span class="nam"><?php echo _ADMIN_FIELD4; ?></span></th>\r
<td><input type="password" name="user_password2" /></td>\r
</tr>\r
<tr>\r
{\r
foreach ( $errors as $error )\r
{\r
- echo '<span class="err">', $error, "</span>¥n";\r
+ echo '<span class="err">', $error, "</span>\n";\r
}\r
}\r
}\r
</p>\r
\r
<p class="sbt">\r
- <button type="submit" name="action" value="detail" class="sbt_arw"><?php echo _INSTALL; ?></button>\r
+ <button type="submit" name="action" value="detail" class="sbt_arw" onclick="OnceSubmit()"><?php echo _INSTALL; ?></button>\r
</p>\r
</div>\r
</form>\r
<?php\r
if ( is_array($errors) && count($errors) > 0 )\r
{\r
- echo _ERROR27;\r
+ echo _INST_ERROR;\r
foreach ( $errors as $error )\r
{\r
- echo '<span class="err">', $error, "</span>¥n";\r
+ echo '<span class="err">', $error, "</span>\n";\r
}\r
}\r
else\r
{\r
echo '<span class="err">', _INST_TEXT4, '</span>';\r
?>\r
-<textarea id="config_text" readonly="readonly" onfocus="SelectText(this);"><?php echo htmlentities($_SESSION['config_data'], null, i18n::get_current_charset() ) ?></textarea>\r
-<script type="text/javascript">\r
- function SelectText( element ) {window.setTimeout( function() { element.select(); }, 0 );}\r
-</script>\r
+<textarea id="config_text" readonly="readonly" onfocus="SelectText(this);"><?php echo htmlentities($_SESSION['config_data'], null, i18n::get_current_charset()) ?></textarea>\r
<?php\r
}\r
else\r
function do_install()\r
{\r
global $param;\r
- global $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE, $MYSQL_PREFIX, $MYSQL_CONN;\r
+ global $MYSQL_HANDLER, $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE, $MYSQL_PREFIX, $MYSQL_CONN;\r
global $DIR_NUCLEUS, $DIR_MEDIA, $DIR_SKINS, $DIR_PLUGINS, $DIR_LANG, $DIR_LIBS;\r
$errors = array();\r
\r
/*\r
* 1. put all param-vars into vars\r
*/\r
- $MYSQL_HOST = $param->mysql_host;\r
- $MYSQL_USER = $param->mysql_user;\r
- $MYSQL_PASSWORD = $param->mysql_password;\r
- $MYSQL_DATABASE = $param->mysql_database;\r
- $MYSQL_PREFIX = $param->mysql_tablePrefix;\r
-\r
- $DIR_NUCLEUS = $param->AdminPath;\r
- $DIR_MEDIA = $param->MediaPath;\r
- $DIR_SKINS = $param->SkinsPath;\r
- $DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/';\r
- $DIR_LOCALES = $DIR_NUCLEUS . 'locales/';\r
- $DIR_LIBS = $DIR_NUCLEUS . 'libs/';\r
+ $MYSQL_HOST = $param->mysql_host;\r
+ $MYSQL_USER = $param->mysql_user;\r
+ $MYSQL_PASSWORD = $param->mysql_password;\r
+ $MYSQL_DATABASE = $param->mysql_database;\r
+ $MYSQL_PREFIX = $param->mysql_tablePrefix;\r
+\r
+ $DIR_NUCLEUS = $param->AdminPath;\r
+ $DIR_MEDIA = $param->MediaPath;\r
+ $DIR_SKINS = $param->SkinsPath;\r
+ $DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/';\r
+ $DIR_LOCALES = $DIR_NUCLEUS . 'locales/';\r
+ $DIR_LIBS = $DIR_NUCLEUS . 'libs/';\r
\r
/*\r
* 2.open mySQL connection\r
*/\r
- $MYSQL_CONN = @sql_connect_args($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD);\r
- if ( $MYSQL_CONN == false )\r
+ $MYSQL_CONN = @DB::setConnectionInfo($MYSQL_HANDLER[1], $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD);\r
+ if ( $MYSQL_CONN == FALSE )\r
{\r
- $errors[] = _ERROR3;\r
+ $errors[] = _DBCONNECT_ERROR;\r
return $errors;\r
}\r
\r
/*\r
* 3. try to create database if needed\r
*/\r
- if ( !sql_query('CREATE DATABASE IF NOT EXISTS `' . $MYSQL_DATABASE . '`') )\r
+ if ( DB::execute("CREATE DATABASE IF NOT EXISTS {$MYSQL_DATABASE}") === FALSE )\r
{\r
- $errors[] = _ERROR12 . ': ' . sql_error();\r
+ $errinfo = DB::getError();\r
+ $errors[] = _INST_ERROR1 . ': ' . $errinfo[2];\r
}\r
\r
/*\r
* 4. try to select database\r
*/\r
- if ( !sql_select_db($MYSQL_DATABASE) )\r
+ $MYSQL_CONN = @DB::setConnectionInfo($MYSQL_HANDLER[1], $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE);\r
+ if ( !$MYSQL_CONN )\r
{\r
- $errors[] = _ERROR13;\r
+ $errors[] = _INST_ERROR2;\r
}\r
- sql_set_charset('utf8');\r
\r
if ( count($errors) > 0 )\r
{\r
}\r
\r
// table exists check\r
- $result = sql_query('SHOW TABLES');\r
- while ($row = mysql_fetch_array($result, MYSQL_NUM))\r
+ $result = DB::getResult('SHOW TABLES');\r
+ foreach ( $result as $row )\r
{\r
if ( in_array($row[0], $prefixed_table_names) )\r
{\r
- $errors[] = _ERROR14;\r
+ $errors[] = _INST_ERROR3;\r
break;\r
}\r
}\r
\r
$filename = 'install.sql';\r
$fd = fopen($filename, 'r');\r
- $queries = fread($fd, filesize($filename) );\r
+ $queries = fread($fd, filesize($filename));\r
fclose($fd);\r
\r
- $queries = preg_split('#(;¥n|;¥r)#', $queries);\r
+ $queries = preg_split('#(;\n|;\r)#', $queries);\r
\r
foreach ( $queries as $query )\r
{\r
- if ( preg_match('/¥w+/', $query) )\r
+ if ( preg_match('/\w+/', $query) )\r
{\r
if ( $MYSQL_PREFIX )\r
{\r
$query = str_replace($table_names, $prefixed_table_names, $query);\r
}\r
\r
- if ( !sql_query($query) )\r
+ if ( DB::execute($query) === FALSE )\r
{\r
- $errors[] = _ERROR15 . ' (<small>' . $query . '</small>): ' . sql_error();\r
+ $errinfo = DB::getError();\r
+ $errors[] = _INST_ERROR4 . ' (<small>' . $query . '</small>): ' . $errinfo[2];\r
}\r
}\r
}\r
* 6. put needed records\r
*/\r
/* push first post */\r
- $query = "INSERT INTO %s VALUES (1, '%s', '%s', '%s', 1, 1, '%s', 0, 0, 0, 1, 0, 1)";\r
- $query = sprintf($query, tableName('nucleus_item'), _1ST_POST_TITLE, _1ST_POST, _1ST_POST2, i18n::formatted_datetime('mysql', time()));\r
- if ( !sql_query($query) )\r
+ $query = "INSERT INTO %s VALUES (1, %s, %s, %s, 1, 1, %s, 0, 0, 0, 1, 0, 1)";\r
+ $query = sprintf($query,\r
+ tableName('nucleus_item'),\r
+ DB::quoteValue(_1ST_POST_TITLE),\r
+ DB::quoteValue(_1ST_POST),\r
+ DB::quoteValue(_1ST_POST2),\r
+ DB::formatDateTime()\r
+ );\r
+ if ( DB::execute($query) === FALSE )\r
{\r
- $errors[] = _ERROR15 . ' (<small>' . $newpost . '</small>): ' . sql_error();\r
+ $errinfo = DB::getError();\r
+ $errors[] = _INST_ERROR4 . ' (<small>' . $newpost . '</small>): ' . $errinfo[2];\r
}\r
\r
/* push configurations */\r
array_merge($errors, updateConfig('SiteName', $param->blog_name));\r
array_merge($errors, updateConfig('Locale', i18n::get_current_locale()));\r
\r
- /* escape strings for SQL */\r
- $user_name = sql_real_escape_string($param->user_name);\r
- $user_realname = sql_real_escape_string($param->user_realname);\r
- $user_password = sql_real_escape_string(md5($param->user_password));\r
- $user_email = sql_real_escape_string($param->user_email);\r
- $blog_name = sql_real_escape_string($param->blog_name);\r
- $blog_shortname = sql_real_escape_string($param->blog_shortname);\r
- $config_indexurl = sql_real_escape_string($param->IndexURL);\r
-\r
/* push super admin */\r
- $query = "UPDATE %s SET mname = '%s', mrealname = '%s', mpassword = '%s', memail = '%s', murl = '%s', madmin = 1, mcanlogin = 1 WHERE mnumber = 1";\r
- $query = sprintf($query, tableName('nucleus_member'), $user_name, $user_realname, $user_password, $user_email, $config_indexurl);\r
- if ( !sql_query($query) )\r
+ $query = "UPDATE %s SET mname = %s, mrealname = %s, mpassword = %s, memail = %s, murl = %s, madmin = 1, mcanlogin = 1 WHERE mnumber = 1";\r
+ $query = sprintf($query,\r
+ tableName('nucleus_member'),\r
+ DB::quoteValue($param->user_name),\r
+ DB::quoteValue($param->user_realname),\r
+ DB::quoteValue(md5($param->user_password)),\r
+ DB::quoteValue($param->user_email),\r
+ DB::quoteValue($param->IndexURL)\r
+ );\r
+ if ( DB::execute($query) === FALSE )\r
{\r
- $errors[] = _ERROR16 . ': ' . sql_error();\r
+ $errinfo = DB::getError();\r
+ $errors[] = _INST_ERROR5 . ': ' . $errinfo[2];\r
}\r
\r
/* push new weblog */\r
- $query = "UPDATE %s SET bname = '%s', bshortname = '%s', burl = '%s' WHERE bnumber = 1";\r
- $query = sprintf($query, tableName('nucleus_blog'), $blog_name, $blog_shortname, $config_indexurl);\r
- if ( !sql_query($query) )\r
+ $query = "UPDATE %s SET bname = %s, bshortname = %s, burl = %s WHERE bnumber = 1";\r
+ $query = sprintf($query,\r
+ tableName('nucleus_blog'),\r
+ DB::quoteValue($param->blog_name),\r
+ DB::quoteValue($param->blog_shortname),\r
+ DB::quoteValue($param->IndexURL)\r
+ );\r
+ if ( DB::execute($query) === FALSE )\r
{\r
- $errors[] = _ERROR17 . ': ' . sql_error();\r
+ $errinfo = DB::getError();\r
+ $errors[] = _INST_ERROR6 . ': ' . $errinfo[2];\r
}\r
\r
/* push default category */\r
$query = "UPDATE %s SET cname = '%s', cdesc = '%s' WHERE catid = 1";\r
- $query = sprintf($query, tableName('nucleus_category'), _GENERALCAT_NAME, _GENERALCAT_DESC);\r
- if ( !sql_query($query) )\r
+ $query = sprintf($query,\r
+ tableName('nucleus_category'),\r
+ DB::quoteValue(_GENERALCAT_NAME),\r
+ DB::quoteValue(_GENERALCAT_DESC)\r
+ );\r
+ if ( DB::execute($query) === FALSE )\r
{\r
- $errors[] = _ERROR17 . ': ' . sql_error();\r
+ $errinfo = DB::getError();\r
+ $errors[] = _INST_ERROR6 . ': ' . $errinfo[2];\r
}\r
\r
- sql_close();\r
-\r
/*\r
* 7. install default plugins and skins\r
*/\r
global $manager;\r
if ( !isset($manager) )\r
{\r
- $manager = new MANAGER;\r
+ $manager = new Manager();\r
}\r
\r
+ include_once($DIR_LIBS . 'skinie.php');\r
+ \r
$aSkinErrors = installCustomSkins();\r
if ( count($aSkinErrors) > 0 )\r
{\r
array_merge($errors, $aSkinErrors);\r
}\r
\r
- $query = "SELECT sdnumber FROM %s WHERE sdname='default'";\r
- $query = sprintf($query, tableName('nucleus_skin_desc'));\r
- $res = sql_query($query);\r
- $obj = sql_fetch_assoc($res);\r
- $defSkinID = (integer) $obj['sdnumber'];\r
+ $query = "SELECT sdnumber FROM %s WHERE sdname='default'";\r
+ $query = sprintf($query, tableName('nucleus_skin_desc'));\r
+ $defSkinID = intval(DB::getValue($query));\r
\r
$query = "UPDATE %s SET bdefskin=%d WHERE bnumber=1";\r
$query = sprintf($query, tableName('nucleus_blog'), $defSkinID);\r
- sql_query($query);\r
+ DB::execute($query);\r
$query = "UPDATE %s SET value=%d WHERE name='BaseSkin'";\r
$query = sprintf($query, tableName('nucleus_config'), $defSkinID);\r
- sql_query($query);\r
+ DB::execute($query);\r
\r
- $aPlugErrors = installCustomPlugs($manager);\r
+ $aPlugErrors = installCustomPlugs();\r
if ( count($aPlugErrors) > 0 )\r
{\r
array_merge($errors, $aPlugErrors);\r
/*\r
* 8. Write config file ourselves (if possible)\r
*/\r
- $config_data = '<' . '?php' . "¥n";\r
- $config_data .= "// mySQL connection information¥n";\r
- $config_data .= "¥$MYSQL_HOST = '" . $MYSQL_HOST . "';¥n";\r
- $config_data .= "¥$MYSQL_USER = '" . $MYSQL_USER . "';¥n";\r
- $config_data .= "¥$MYSQL_PASSWORD = '" . $MYSQL_PASSWORD . "';¥n";\r
- $config_data .= "¥$MYSQL_DATABASE = '" . $MYSQL_DATABASE . "';¥n";\r
- $config_data .= "¥$MYSQL_PREFIX = '" . $MYSQL_PREFIX . "';¥n";\r
- $config_data .= "// new in 3.50. first element is db handler, the second is the db driver used by the handler¥n";\r
- $config_data .= "// default is ¥$MYSQL_HANDLER = array('mysql','mysql');¥n";\r
- $config_data .= "//¥$MYSQL_HANDLER = array('mysql','mysql');¥n";\r
- $config_data .= "//¥$MYSQL_HANDLER = array('pdo','mysql');¥n";\r
- $config_data .= "¥$MYSQL_HANDLER = array('".$MYSQL_HANDLER[0]."','".$MYSQL_HANDLER[1]."');¥n";\r
- $config_data .= "¥n";\r
- $config_data .= "// main nucleus directory¥n";\r
- $config_data .= "¥$DIR_NUCLEUS = '" . $DIR_NUCLEUS . "';¥n";\r
- $config_data .= "¥n";\r
- $config_data .= "// path to media dir¥n";\r
- $config_data .= "¥$DIR_MEDIA = '" . $DIR_MEDIA . "';¥n";\r
- $config_data .= "¥n";\r
- $config_data .= "// extra skin files for imported skins¥n";\r
- $config_data .= "¥$DIR_SKINS = '" . $DIR_SKINS . "';¥n";\r
- $config_data .= "¥n";\r
- $config_data .= "// these dirs are normally sub dirs of the nucleus dir, but ¥n";\r
- $config_data .= "// you can redefine them if you wish¥n";\r
- $config_data .= "¥$DIR_PLUGINS = ¥$DIR_NUCLEUS . 'plugins/';¥n";\r
- $config_data .= "¥$DIR_LOCALES = ¥$DIR_NUCLEUS . 'locales/';¥n";\r
- $config_data .= "¥$DIR_LIBS = ¥$DIR_NUCLEUS . 'libs/';¥n";\r
- $config_data .= "¥n";\r
- $config_data .= "// include libs¥n";\r
- $config_data .= "include(¥$DIR_LIBS.'globalfunctions.php');¥n";\r
+ $config_data = '<' . '?php' . "\n";\r
+ $config_data .= "// mySQL connection information\n";\r
+ $config_data .= "\$MYSQL_HOST = '" . $MYSQL_HOST . "';\n";\r
+ $config_data .= "\$MYSQL_USER = '" . $MYSQL_USER . "';\n";\r
+ $config_data .= "\$MYSQL_PASSWORD = '" . $MYSQL_PASSWORD . "';\n";\r
+ $config_data .= "\$MYSQL_DATABASE = '" . $MYSQL_DATABASE . "';\n";\r
+ $config_data .= "\$MYSQL_PREFIX = '" . $MYSQL_PREFIX . "';\n";\r
+ $config_data .= "// new in 3.50. first element is db handler, the second is the db driver used by the handler\n";\r
+ $config_data .= "// default is \$MYSQL_HANDLER = array('mysql','mysql');\n";\r
+ $config_data .= "//\$MYSQL_HANDLER = array('mysql','mysql');\n";\r
+ $config_data .= "//\$MYSQL_HANDLER = array('pdo','mysql');\n";\r
+ $config_data .= "\$MYSQL_HANDLER = array('" . $MYSQL_HANDLER[0] . "','" . $MYSQL_HANDLER[1] . "');\n";\r
+ $config_data .= "\n";\r
+ $config_data .= "// main nucleus directory\n";\r
+ $config_data .= "\$DIR_NUCLEUS = '" . $DIR_NUCLEUS . "';\n";\r
+ $config_data .= "\n";\r
+ $config_data .= "// path to media dir\n";\r
+ $config_data .= "\$DIR_MEDIA = '" . $DIR_MEDIA . "';\n";\r
+ $config_data .= "\n";\r
+ $config_data .= "// extra skin files for imported skins\n";\r
+ $config_data .= "\$DIR_SKINS = '" . $DIR_SKINS . "';\n";\r
+ $config_data .= "\n";\r
+ $config_data .= "// these dirs are normally sub dirs of the nucleus dir, but \n";\r
+ $config_data .= "// you can redefine them if you wish\n";\r
+ $config_data .= "\$DIR_PLUGINS = \$DIR_NUCLEUS . 'plugins/';\n";\r
+ $config_data .= "\$DIR_LOCALES = \$DIR_NUCLEUS . 'locales/';\n";\r
+ $config_data .= "\$DIR_LIBS = \$DIR_NUCLEUS . 'libs/';\n";\r
+ $config_data .= "\n";\r
+ $config_data .= "// include libs\n";\r
+ $config_data .= "include(\$DIR_LIBS.'globalfunctions.php');\n";\r
$config_data .= "?" . ">";\r
\r
$result = false;\r
{\r
if ( $fp = @fopen('../config.php', 'w') )\r
{\r
- $result = @fwrite($fp, $config_data, i18n::strlen($config_data) );\r
+ $result = @fwrite($fp, $config_data, i18n::strlen($config_data));\r
fclose($fp);\r
}\r
}\r
if ( $result )\r
{\r
// try to change the read-only permission.\r
- if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' )\r
+ if ( strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' )\r
{\r
@chmod('../config.php', 0444);\r
}\r
if ( @file_exists('../config.php') && @!is_writable('../config.php') )\r
{\r
// try to change the read-write permission.\r
- if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' )\r
+ if ( strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' )\r
{\r
@chmod('../config.php', 0666);\r
}\r
\r
if ( @!is_writable('../config.php') )\r
{\r
- return _ERROR19;\r
+ return _INST_ERROR8;\r
}\r
}\r
return '';\r
*/\r
function getMySqlVersion()\r
{\r
- global $minimum_mysql_version, $errors;\r
+ global $MYSQL_HANDLER, $minimum_mysql_version, $errors;\r
// Turn on output buffer\r
// Needed to repress the output of the sql function that are\r
// not part of php (in this case the @ operator doesn't work)\r
ob_start();\r
\r
// note: this piece of code is taken from phpMyAdmin\r
- $conn = sql_connect_args('localhost', '', '');\r
- $result = @sql_query('SELECT VERSION() AS version', $conn);\r
+ $conn = @DB::setConnectionInfo($MYSQL_HANDLER[1], 'localhost', '', '');\r
\r
- if ( $result != FALSE && sql_num_rows($result) > 0 )\r
+ if ( $conn )\r
{\r
- $row = sql_fetch_array($result);\r
- $match = i18n::explode('.', $row['version']);\r
+ $row = DB::getAttribute(PDO::ATTR_SERVER_VERSION);\r
+ $match = preg_split('#\.#', $row);\r
}\r
else\r
{\r
- $result = @sql_query('SHOW VARIABLES LIKE ¥'version¥'', $conn);\r
+ $row = @DB::getRow('SHOW VARIABLES LIKE \'version\'');\r
\r
- if ( $result != FALSE && @sql_num_rows($result) > 0 )\r
+ if ( $row )\r
{\r
- $row = sql_fetch_row($result);\r
- $match = i18n::explode('.', $row[1]);\r
+ $match = preg_split('#\.#', $row[1]);\r
}\r
else\r
{\r
- //$output = shell_exec('mysql -V');\r
- $output = ( function_exists('shell_exec') ) ? @shell_exec('mysql -V') : '0.0.0';\r
- preg_match('@[0-9]+¥.[0-9]+¥.[0-9]+@', $output, $version);\r
- $match = i18n::explode('.', $version[0]);\r
+ $output = (function_exists('shell_exec')) ? @shell_exec('mysql -V') : '0.0.0';\r
+ preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);\r
+ $match = preg_split('#\.#', $version[0]);\r
\r
if ( $match[0] == '' )\r
{\r
}\r
}\r
\r
- @sql_disconnect($conn);\r
+ @DB::disConnect();\r
\r
//End and clean output buffer\r
ob_end_clean();\r
\r
/**\r
* Install custom plugins\r
- *\r
- * @param object $manager MANAGER class instance\r
*/\r
-function installCustomPlugs($manager)\r
+function installCustomPlugs()\r
{\r
- global $aConfPlugsToInstall, $DIR_LIBS;\r
+ global $aConfPlugsToInstall, $DIR_LIBS, $manager;\r
\r
$aErrors = array();\r
if ( count($aConfPlugsToInstall) == 0 )\r
return $aErrors;\r
}\r
\r
- $res = sql_query('SELECT * FROM ' . tableName('nucleus_plugin') );\r
- $numCurrent = sql_num_rows($res);\r
+ $query = sprintf('SELECT * FROM %s', tableName('nucleus_plugin'));\r
+ $res = DB::getResult($query);\r
+ $numCurrent = $res->rowCount();\r
\r
foreach ( $aConfPlugsToInstall as $plugName )\r
{\r
- $query = 'INSERT INTO ' . tableName('nucleus_plugin') . ' (porder, pfile) VALUES (' . (++$numCurrent) . ", '" . sql_real_escape_string($plugName) . "')";\r
- sql_query($query);\r
+ $query = sprintf('INSERT INTO %s (porder, pfile) VALUES (%d, %s)',\r
+ tableName('nucleus_plugin'),\r
+ (++$numCurrent),\r
+ DB::quoteValue($plugName));\r
+ DB::execute($query);\r
\r
$manager->clearCachedInfo('installedPlugins');\r
$plugin =& $manager->getPlugin($plugName);\r
\r
if ( !$plugin )\r
{\r
- sql_query('DELETE FROM ' . tableName('nucleus_plugin') . " WHERE pfile = '" . sql_real_escape_string($plugName) . "'");\r
+ $query = sprintf('DELETE FROM %s WHERE pfile = %s',\r
+ tableName('nucleus_plugin'),\r
+ DB::quoteValue($plugName));\r
+ DB::execute($query);\r
$numCurrent--;\r
- array_push($aErrors, sprintf(_ERROR22 ,$plugName));\r
+ array_push($aErrors, sprintf(_INST_ERROR9, $plugName));\r
continue;\r
}\r
$plugin->install();\r
}\r
\r
- sql_query('DELETE FROM ' . tableName('nucleus_plugin_event') );\r
- $res = sql_query('SELECT pid, pfile FROM ' . tableName('nucleus_plugin') );\r
+ $query = sprintf('DELETE FROM %s', tableName('nucleus_plugin_event'));\r
+ DB::execute($query);\r
+ $query = sprintf('SELECT pid, pfile FROM %s', tableName('nucleus_plugin'));\r
+ $res = DB::getResult($query);\r
\r
- while ( $o = sql_fetch_object($res) )\r
+ foreach ( $res as $row )\r
{\r
- $pid = $o->pid;\r
- $plug =& $manager->getPlugin($o->pfile);\r
+ $plug =& $manager->getPlugin($row['pfile']);\r
\r
if ( $plug )\r
{\r
$eventList = $plug->getEventList();\r
foreach ( $eventList as $eventName )\r
{\r
- sql_query('INSERT INTO ' . tableName('nucleus_plugin_event') . ' (pid, event) VALUES (' . $pid . ", '" . $eventName . "')");\r
+ $query = sprintf('INSERT INTO %s (pid, event) VALUES (%d, %s)',\r
+ tableName('nucleus_plugin_event'),\r
+ intval($row['pid']),\r
+ DB::quoteValue($eventName));\r
+ DB::execute($query);\r
}\r
}\r
}\r
return $aErrors;\r
}\r
\r
- include_once($DIR_LIBS . 'skinie.php');\r
- $importer = new SKINIMPORT();\r
+ $importer = new SkinImport();\r
\r
foreach ( $aConfSkinsToImport as $skinName )\r
{\r
\r
if ( !@file_exists($skinFile) )\r
{\r
- array_push($aErrors, sprintf(_ERROR23, $skinFile));\r
+ array_push($aErrors, sprintf(_INST_ERROR10, $skinFile));\r
continue;\r
}\r
\r
\r
if ( $error )\r
{\r
- array_push($aErrors, sprintf(_ERROR24, $skinName) . ' : ' . $error);\r
+ array_push($aErrors, sprintf(_INST_ERROR11, $skinName) . ' : ' . $error);\r
continue;\r
}\r
\r
\r
if ( $error )\r
{\r
- array_push($aErrors, sprintf(_ERROR25, $skinName) . ' : ' . $error);\r
+ array_push($aErrors, sprintf(_INST_ERROR12, $skinName) . ' : ' . $error);\r
continue;\r
}\r
}\r
return $aErrors;\r
}\r
\r
-\r
/**\r
* Check if some important files of the Nucleus CMS installation are available\r
* Give an error if one or more files are not accessible\r
'../nucleus/libs/MANAGER.php',\r
'../nucleus/libs/MEDIA.php',\r
'../nucleus/libs/MEMBER.php',\r
- '../nucleus/libs/mysql.php',\r
'../nucleus/libs/NOTIFICATION.php',\r
'../nucleus/libs/PAGEFACTORY.php',\r
'../nucleus/libs/PARSER.php',\r
'../nucleus/libs/vars4.1.0.php',\r
'../nucleus/libs/xmlrpc.inc.php',\r
'../nucleus/libs/xmlrpcs.inc.php',\r
- '../nucleus/libs/sql/mysql.php'\r
+ '../nucleus/libs/data/DB.php',\r
+ '../nucleus/libs/data/MYSQLPDO.php'\r
);\r
\r
$count = count($files);\r
{\r
if ( !is_readable($files[$i]) )\r
{\r
- array_push( $missingfiles, 'File <b>' . $files[$i] . '</b> is missing or not readable.<br />');\r
+ array_push($missingfiles, 'File <b>' . $files[$i] . '</b> is missing or not readable.<br />');\r
}\r
}\r
\r
if ( count($missingfiles) > 0 )\r
{\r
- exit(implode( "¥n", $missingfiles));\r
+ exit(implode("\n", $missingfiles));\r
}\r
}\r
\r
-\r
/**\r
* Updates the configuration in the database\r
*\r
function updateConfig($name, $value)\r
{\r
$errors = array();\r
- $name = sql_real_escape_string($name);\r
- $value = trim(sql_real_escape_string($value) );\r
\r
- $query = "UPDATE %s SET value = '%s' WHERE name = '%s'";\r
- $query = sprintf($query, tableName('nucleus_config'), $value, $name);\r
+ $query = "UPDATE %s SET value = %s WHERE name = %s";\r
+ $query = sprintf($query, tableName('nucleus_config'), DB::quoteValue(trim($value)), DB::quoteValue($name));\r
\r
- if ( !sql_query($query) )\r
+ if ( DB::execute($query) === FALSE )\r
{\r
- $errors[] = _ERROR15 . ': ' . sql_error();\r
+ $errinfo = DB::getError();\r
+ $errors[] = _INST_ERROR4 . ': ' . $errinfo[2];\r
}\r
return $errors;\r
}\r
\r
-\r
-class PARAM_MANAGER\r
+class ParamManager\r
{\r
/* process parameter */\r
public $state;\r
$this->blog_shortname = 'mynucleuscms';\r
\r
/* root path */\r
- $this->root_path = realpath(dirname(__FILE__) . '/..');\r
+ $directory_separator = preg_quote(DIRECTORY_SEPARATOR, '|');\r
+ $this->root_path = implode('/', preg_split("|$directory_separator|", realpath(dirname(__FILE__) . '/..')));\r
if ( substr($this->root_path, -1, 1) !== '/' )\r
{\r
$this->root_path .= '/';\r
}\r
- $base_path_pcre = preg_quote($this->root_path, '#');\r
+ $base_path_pcre = preg_quote($this->root_path, '|');\r
\r
/* current directry name */\r
- $directory_name = preg_replace("#$base_path_pcre#", '', dirname(__FILE__));\r
- $directory_name_pcre = preg_quote($directory_name, '#');\r
+ $directory_name = preg_replace("#{$base_path_pcre}#", '', implode('/', preg_split("#{$directory_separator}#", realpath(dirname(__FILE__)))));\r
+ $directory_name_pcre = preg_quote($directory_name, '|');\r
\r
/* root uri */\r
$root_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];\r
- $this->root_url = preg_replace("#$directory_name_pcre(.*)$#", '', $root_url);\r
+ $this->root_url = preg_replace("|$directory_name_pcre(.*)$|", '', $root_url);\r
\r
- $this->AdminPath = $this->root_path . 'nucleus' . DIRECTORY_SEPARATOR;\r
- $this->MediaPath = $this->root_path . 'media' . DIRECTORY_SEPARATOR;\r
- $this->SkinsPath = $this->root_path . 'skins' . DIRECTORY_SEPARATOR;\r
+ $this->AdminPath = $this->root_path . 'nucleus/';\r
+ $this->MediaPath = $this->root_path . 'media/';\r
+ $this->SkinsPath = $this->root_path . 'skins/';\r
\r
$this->IndexURL = $this->root_url;\r
$this->AdminURL = $this->root_url . 'nucleus/';\r
\r
public function check_mysql_parameters()\r
{\r
+ global $MYSQL_HANDLER;\r
+ \r
$parameters = array('mysql_host', 'mysql_user', 'mysql_password', 'mysql_database', 'mysql_tablePrefix');\r
$this->read_parameter($parameters);\r
\r
$errors = array();\r
if ( $this->mysql_host == '' )\r
{\r
- $errors[] = sprintf(_ERROR1, _DB_FIELD1);\r
+ $errors[] = sprintf(_VALID_ERROR1, _DB_FIELD1);\r
}\r
\r
if ( $this->mysql_user == '' )\r
{\r
- $errors[] = sprintf(_ERROR1, _DB_FIELD2);\r
+ $errors[] = sprintf(_VALID_ERROR1, _DB_FIELD2);\r
}\r
\r
if ( $this->mysql_user != ''\r
- && !preg_match('/^[a-z0-9_¥-]+$/i', $this->mysql_user) )\r
+ && !preg_match('/^[a-z0-9_\-]+$/i', $this->mysql_user) )\r
{\r
- $errors[] = sprintf(_ERROR2, _DB_FIELD2);\r
+ $errors[] = sprintf(_VALID_ERROR2, _DB_FIELD2);\r
}\r
\r
- if ( $this->mysql_password == '' )\r
- {\r
- $errors[] = sprintf(_ERROR1, _DB_FIELD3);\r
- }\r
-\r
if ( $this->mysql_database == '' )\r
{\r
- $errors[] = sprintf(_ERROR1, _DB_FIELD4);\r
+ $errors[] = sprintf(_VALID_ERROR1, _DB_FIELD4);\r
}\r
\r
if ( $this->mysql_database != ''\r
- && !preg_match('/^[a-z0-9_¥-]+$/i', $this->mysql_database) )\r
+ && !preg_match('/^[a-z0-9_\-]+$/i', $this->mysql_database) )\r
{\r
- $errors[] = sprintf(_ERROR2, _DB_FIELD4);\r
+ $errors[] = sprintf(_VALID_ERROR2, _DB_FIELD4);\r
}\r
\r
if ( $this->mysql_tablePrefix != ''\r
- && !preg_match('/^[a-z0-9_-]+$/i', $this->mysql_tablePrefix) )\r
+ && !preg_match('/^[a-z0-9_]+$/i', $this->mysql_tablePrefix) )\r
{\r
- $errors[] = sprintf(_ERROR2, _DB_FIELD5);\r
+ $errors[] = sprintf(_VALID_ERROR3, _DB_FIELD5);\r
}\r
\r
if ( count($errors) == 0 )\r
{\r
- $mysql_conn = @sql_connect_args($this->mysql_host, $this->mysql_user, $this->mysql_password);\r
+ $mysql_conn = @DB::setConnectionInfo($MYSQL_HANDLER[1], $this->mysql_host, $this->mysql_user, $this->mysql_password);\r
if ( $mysql_conn == false )\r
{\r
- $errors[] = _ERROR3;\r
+ $errors[] = _DBCONNECT_ERROR;\r
}\r
else\r
{\r
- @sql_close($mysql_conn);\r
+ @DB::disConnect();\r
}\r
}\r
\r
$this->read_parameter($parameters);\r
\r
$errors = array();\r
- if ( $this->user_name == '' )\r
+ if ( $this->user_realname == '' )\r
{\r
- $errors[] = sprintf(_ERROR1, _ADMIN_FIELD2);\r
+ $errors[] = sprintf(_VALID_ERROR1, _ADMIN_FIELD1);\r
}\r
- elseif ( !preg_match("/^[a-z0-9]+([ a-z0-9]*[a-z0-9]+)?$/i", $this->user_name) )\r
+\r
+ if ( $this->user_name == '' )\r
{\r
- $errors[] = _ERROR5;\r
+ $errors[] = sprintf(_VALID_ERROR1, _ADMIN_FIELD2);\r
}\r
-\r
- if ( $this->user_realname == '' )\r
+ elseif ( !preg_match("/^[a-z0-9]+([ a-z0-9]*[a-z0-9]+)?$/i", $this->user_name) )\r
{\r
- $errors[] = sprintf(_ERROR1, _ADMIN_FIELD1);\r
+ $errors[] = _VALID_ERROR5;\r
}\r
\r
if ( $this->user_password == '' || $this->user_password2 == '' )\r
{\r
- $errors[] = sprintf(_ERROR1, _ADMIN_FIELD3);\r
+ $errors[] = sprintf(_VALID_ERROR1, _ADMIN_FIELD3);\r
$this->user_password = '';\r
}\r
elseif ( $this->user_password != $this->user_password2 )\r
{\r
- $errors[] = _ERROR6;\r
+ $errors[] = _VALID_ERROR6;\r
$this->user_password = '';\r
}\r
\r
- if ( !preg_match("/^[a-z0-9¥._+¥-]+@[a-z0-9¥._¥-]+¥.[a-z]{2,6}$/i", $this->user_email) )\r
+ if ( !preg_match("/^[a-z0-9\._+\-]+@[a-z0-9\._\-]+\.[a-z]{2,6}$/i", $this->user_email) )\r
{\r
- $errors[] = _ERROR7;\r
+ $errors[] = _VALID_ERROR7;\r
}\r
\r
return $errors;\r
$errors = array();\r
if ( $this->blog_name == '' )\r
{\r
- $errors[] = sprintf(_ERROR1, _BLOG_FIELD1);\r
+ $errors[] = sprintf(_VALID_ERROR1, _BLOG_FIELD1);\r
}\r
\r
if ( $this->blog_shortname == '' )\r
{\r
- $errors[] = sprintf(_ERROR1, _BLOG_FIELD2);\r
+ $errors[] = sprintf(_VALID_ERROR1, _BLOG_FIELD2);\r
}\r
\r
if ( !preg_match("/^[a-z0-9]+$/i", $this->blog_shortname) )\r
{\r
- $errors[] = _ERROR4;\r
+ $errors[] = _VALID_ERROR4;\r
}\r
\r
return $errors;\r
$errors = array();\r
if ( substr($this->IndexURL, -1, 1) !== '/' )\r
{\r
- $errors[] = sprintf(_ERROR8, _PATH_FIELD1);\r
+ $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD1);\r
}\r
\r
if ( substr($this->AdminURL, -1, 1) !== '/' )\r
{\r
- $errors[] = sprintf(_ERROR8, _PATH_FIELD2);\r
+ $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD2);\r
}\r
\r
if ( substr($this->MediaURL, -1, 1) !== '/' )\r
{\r
- $errors[] = sprintf(_ERROR8, _PATH_FIELD4);\r
+ $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD4);\r
}\r
\r
if ( substr($this->SkinsURL, -1, 1) !== '/' )\r
{\r
- $errors[] = sprintf(_ERROR8, _PATH_FIELD6);\r
+ $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD6);\r
}\r
\r
if ( substr($this->PluginURL, -1, 1) !== '/' )\r
{\r
- $errors[] = sprintf(_ERROR8, _PATH_FIELD8);\r
+ $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD8);\r
}\r
\r
if ( strrchr($this->ActionURL, '/') != '/action.php' )\r
{\r
- $errors[] = sprintf(_ERROR9, _PATH_FIELD9);\r
+ $errors[] = sprintf(_VALID_ERROR9, _PATH_FIELD9);\r
}\r
\r
return $errors;\r
\r
$separators = array('/', DIRECTORY_SEPARATOR);\r
$errors = array();\r
- if ( !in_array(substr($this->AdminPath, -1, 1), $separators) || !file_exists($this->AdminPath) )\r
+ if ( !in_array(substr($this->AdminPath, -1, 1), $separators) )\r
{\r
- $errors[] = sprintf(_ERROR10, _PATH_FIELD3);\r
+ $errors[] = sprintf(_VALID_ERROR10, _PATH_FIELD3);\r
+ }\r
+ elseif ( !file_exists($this->AdminPath) )\r
+ {\r
+ $errors[] = sprintf(_VALID_ERROR11, _PATH_FIELD3);\r
}\r
\r
- if ( !in_array(substr($this->MediaPath, -1, 1), $separators) || !file_exists($this->MediaPath) )\r
+ if ( !in_array(substr($this->MediaPath, -1, 1), $separators) )\r
+ {\r
+ $errors[] = sprintf(_VALID_ERROR10, _PATH_FIELD5);\r
+ }\r
+ elseif ( !file_exists($this->MediaPath) )\r
{\r
- $errors[] = sprintf(_ERROR10, _PATH_FIELD5);\r
+ $errors[] = sprintf(_VALID_ERROR11, _PATH_FIELD5);\r
}\r
\r
- if ( !in_array(substr($this->SkinsPath, -1, 1), $separators) || !file_exists($this->SkinsPath) )\r
+ if ( !in_array(substr($this->SkinsPath, -1, 1), $separators) )\r
+ {\r
+ $errors[] = sprintf(_VALID_ERROR10, _PATH_FIELD7);\r
+ }\r
+ elseif ( !file_exists($this->SkinsPath) )\r
{\r
- $errors[] = sprintf(_ERROR10, _PATH_FIELD7);\r
+ $errors[] = sprintf(_VALID_ERROR11, _PATH_FIELD7);\r
}\r
\r
return $errors;\r