* as published by the Free Software Foundation; either version 2\r
* of the License, or (at your option) any later version.\r
* (see nucleus/documentation/index.html#license for more info)\r
- * This script will install the Nucleus tables in your SQL-database, and initialize the data in\r
- * those tables.\r
+ * \r
+ * This script will install the Nucleus tables in your SQL-database, \r
+ * and initialize the data in those tables.\r
*\r
* Below is a friendly way of letting users on non-php systems know that Nucleus won't run there.\r
* ?><div style="font-size: xx-large;">If you see this text in your browser when you open <i>/install/</i>, your web server is not able to run PHP-scripts, and therefor Nucleus will not be able to run there. </div><div style="display: none"><?php\r
$CONF['installscript'] = 1;\r
}\r
\r
+// compatibility script for php < 4.1.0\r
+// ToDo: remove this here and from the core\r
if (phpversion() >= '4.1.0') {\r
include_once('../nucleus/libs/vars4.1.0.php');\r
} else {\r
\r
exit;\r
\r
+/*\r
+ * Show the form for the installation settings\r
+ */\r
function showInstallForm() {\r
// 0. pre check if all necessary files exist\r
doCheckFiles();\r
\r
<?php }\r
\r
+/*\r
+ * Add a table prefix if it is used\r
+ * \r
+ * @param $unPrefixed\r
+ * table name with prefix\r
+ */\r
function tableName($unPrefixed) {\r
global $mysql_usePrefix, $mysql_prefix;\r
\r
}\r
}\r
\r
+/*\r
+ * The installation process itself\r
+ */\r
function doInstall() {\r
global $mysql_usePrefix, $mysql_prefix, $weblog_ping;\r
\r
<?php\r
}\r
\r
+/**\r
+ * Install custom plugins\r
+ */\r
function installCustomPlugs(&$manager) {\r
global $aConfPlugsToInstall, $DIR_LIBS;\r
\r
return $aErrors;\r
}\r
\r
+/**\r
+ * Install custom skins\r
+ * Prepares the installation of custom skins\r
+ */\r
function installCustomSkins(&$manager) {\r
global $aConfSkinsToImport, $DIR_LIBS, $DIR_SKINS;\r
\r
return $aErrors;\r
}\r
\r
-// give an error if one or more nucleus are not accessible\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
+ */\r
function doCheckFiles() {\r
$missingfiles = array();\r
$files = array(\r
}\r
}\r
\r
+/**\r
+ * Updates the configuration in the database\r
+ * \r
+ * @param $name\r
+ * name of the config var\r
+ * @param $val\r
+ * new value of the config var\r
+ */\r
function updateConfig($name, $val) {\r
global $MYSQL_CONN;\r
$name = addslashes($name);\r
return sql_insert_id($MYSQL_CONN);\r
}\r
\r
+/**\r
+ * Replaces doubled backslashs\r
+ * \r
+ * @param $input\r
+ * string that could have double backslashs\r
+ */\r
function replaceDoubleBackslash($input) {\r
return str_replace('\\', '/', $input);\r
}\r
\r
+/**\r
+ * Checks if a string ends with a slash \r
+ * \r
+ * @param $s\r
+ * string\r
+ */\r
function endsWithSlash($s) {\r
return (strrpos($s, '/') == strlen($s) - 1);\r
}\r
\r
/**\r
* Checks if email address is valid\r
+ * \r
+ * @param $address\r
+ * address which should be tested\r
*/\r
function _isValidMailAddress($address) {\r
if (preg_match("#^[a-zA-Z0-9\._-]+@+[A-Za-z0-9\._-]+\.+[A-Za-z]{2,4}$#", $address) ) {\r
}\r
}\r
\r
-// returns true if the given string is a valid shortname\r
-// (to check short blog names and nicknames)\r
-// logic: starts and ends with a non space, can contain spaces in between\r
-// min 2 chars\r
+/*\r
+ * Check if short blog names and nicknames are allowed\r
+ * Returns true if the given string is a valid shortname\r
+ * logic: only letters and numbers are allowed, no spaces allowed\r
+ * \r
+ * FIX: function eregi is deprecated since PHP 5.3.0\r
+ * \r
+ * @param $name\r
+ * name which should be tested \r
+ */\r
function _isValidShortName($name) {\r
if (preg_match("#^[a-zA-Z0-9]+$#", $name) ) {\r
return 1;\r
}\r
}\r
\r
-\r
-\r
-// returns true if the given string is a valid display name\r
-// (to check nicknames)\r
+/*\r
+ * Check if a display name is allowed\r
+ * Returns true if the given string is a valid display name\r
+ * \r
+ * FIX: function eregi is deprecated since PHP 5.3.0\r
+ * \r
+ * @param $name\r
+ * name which should be tested\r
+ */\r
function _isValidDisplayName($name) {\r
if (preg_match("#^[a-zA-Z0-9]+[a-zA-Z0-9 ]*[a-zA-Z0-9]+$#", $name) ) {\r
return 1;\r
}\r
}\r
\r
+/*\r
+ * Shows error message\r
+ * \r
+ * @param $msg\r
+ * error message\r
+ */\r
function _doError($msg) {\r
?>\r
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
exit;\r
}\r
\r
+/*\r
+ * Shows error messages\r
+ * \r
+ * @param $errors\r
+ * array with error messages\r
+ */\r
function showErrorMessages($errors) {\r
?>\r
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r