Commit 3c32efa9 authored by Michael Stucki's avatar Michael Stucki
Browse files

* Backported secureFormmail patch which adds a new option...

* Backported secureFormmail patch which adds a new option TYPO3_CONF_VARS[FE][secureFormmail] which is enabled by default. For details, see http://typo3.org/teams/security/security-bulletins/typo3-20050307-1/
* A new button to automatically create a random encryptionKey has been added to class.tx_install.php
* Backported fix for bugs #0000292 and #0000464: ReturnPath is disabled in t3lib_htmlmail unless TYPO3_CONF_VARS[SYS][enableReturnPath] is set (disabled by default)
* Changed some small MySQL related things in class.tx_install.php


git-svn-id: https://svn.typo3.org/TYPO3v4/Core/branches/TYPO3_3-7@743 709f56b5-9817-0410-a4d7-c38de5d9e867
parent 3d21f139
2005-05-20 Michael Stucki <michael@typo3.org>
* Backported secureFormmail patch which adds a new option TYPO3_CONF_VARS[FE][secureFormmail] which is enabled by default. For details, see http://typo3.org/teams/security/security-bulletins/typo3-20050307-1/
* A new button to automatically create a random encryptionKey has been added to class.tx_install.php
* Backported fix for bugs #0000292 and #0000464: ReturnPath is disabled in t3lib_htmlmail unless TYPO3_CONF_VARS[SYS][enableReturnPath] is set (disabled by default)
* Changed some small MySQL related things in class.tx_install.php
2005-05-19 Peter Niederlag <pn@kreativwert.de>
* backported fix for Bug #849: TSConfig forceDisplayFieldIcons will work regardless of settings for adminPanel
* backported fix for db_new_content_el.php: Consider allow/deny for CE's
* backported fix from HEAD for Bug #416 in class.t3lib_install.php: Problems with auto_increment and default values
* backported fix from HEAD for Bug #422 in class.t3lib_stdgraphic.php: potential problems with Charset Conversion
* backported fix for Bug #958: require_once() instead of require()
* Backported bugfix #0000849: TSConfig forceDisplayFieldIcons will work regardless of settings for adminPanel
* Backported bugfix for db_new_content_el.php: Consider allow/deny for CE's
* Backported bugfix #0000416 in class.t3lib_install.php: Problems with auto_increment and default values
* Backported bugfix #0000422 in class.t3lib_stdgraphic.php: potential problems with Charset Conversion
* Backported bugfix #0000958: require_once() instead of require()
2005-02-24 Michael Stucki <michael@typo3.org>
......
......@@ -207,7 +207,6 @@ class t3lib_htmlmail {
var $http_username="";
var $postfix_version1=false;
// Internal
/* This is how the $theParts-array is normally looking
......@@ -247,34 +246,13 @@ class t3lib_htmlmail {
/**
* Constructor for the class. Make a check to see if Postfix version below 2.0 is used.
* If this is the case all calls to mail() must not be called with the -f parameter to correctly set
* the Return-Path header.
* Constructor. If the configuration variable forceReturnPath is set, calls to mail will be called with a 5th parameter.
* See function sendTheMail for more info
*
* @return [type] ...
*/
function t3lib_htmlmail () {
if(!ini_get('safe_mode')) {
$res = Array();
$postconfPathList = '/usr/sbin,/sbin,/usr/local/sbin,'. $TYPO3_CONF_VARS['SYS']['binPath'];
foreach(t3lib_div::trimExplode(',',$postconfPathList,1) as $path) {
if(@is_file($path.'/postconf')) {
$postconfPath = $path;
break;
}
}
if(strlen($postconfPath)) {
@exec('/usr/sbin/postconf mail_version',$res);
if(!empty($res[0])) {
$temp = explode("=",$res[0]);
list($major,$minor,$micro) = explode(".",trim($temp[1]));
if($major == 1) {
$this->postfix_version1 = true;
}
}
}
}
$this->forceReturnPath = $GLOBALS['TYPO3_CONF_VARS']['SYS']['enableReturnPath'];
}
/**
......@@ -283,6 +261,7 @@ class t3lib_htmlmail {
function start () {
// Sets the message id
$this->messageid = md5(microtime()).'@domain.tld';
}
/**
......@@ -423,9 +402,9 @@ class t3lib_htmlmail {
if ($this->from_email) {
if ($this->from_name) {
$name = $this->convertName($this->from_name);
$this->add_header("From: $name <$this->from_email>");
$this->add_header('From: '.$name.' <'.$this->from_email.'>');
} else {
$this->add_header("From: $this->from_email");
$this->add_header('From: '.$this->from_email);
}
}
// Reply
......@@ -631,7 +610,7 @@ class t3lib_htmlmail {
* For setting the return-path correctly, the parameter -f has to be added to the system call to sendmail.
* This obviously does not have any effect on Windows, but on Sendmail compliant systems this works. If safe mode
* is enabled, then extra parameters is not allowed, so a safe mode check is made before the mail() command is
* invoked. When using the -f parameter, some MTA's will put an X-AUTHENTICATION-WARING saying that
* invoked. When using the -f parameter, some MTA's will put an X-AUTHENTICATION-WARNING saying that
* the return path was modified manually with the -f flag. To disable this warning make sure that the user running
* Apache is in the /etc/mail/trusted-users table.
*
......@@ -640,15 +619,13 @@ class t3lib_htmlmail {
*
* cannot handle command-line recipients with -t
*
* This problem is solved by making a call to /usr/sbin/postconf mail_version and checking if the postfix is version
* 1.XX.YY If this is the case, the -f parameter is not used in the call to mail().
* The -f parameter is only enabled if the parameter forceReturnPath is enabled in the install tool.
*
* This whole problem of return-path turns out to be quite tricky. If you have a solution that works better, on all
* standard MTA's then we are very open for suggestions.
*
* With time this function should be made such that several ways of sending the mail is possible (local MTA, smtp other).
*
*
* @return [type] ...
*/
function sendTheMail () {
......@@ -656,12 +633,12 @@ class t3lib_htmlmail {
// Sends the mail, requires the recipient, message and headers to be set.
if (trim($this->recipient) && trim($this->message)) { // && trim($this->headers)
$returnPath = (strlen($this->returnPath)>0)?"-f".$this->returnPath:'';
//On windows the -f flag is not used (specific for Sendmail and Postfix), but instead the php.ini parameter sendmail_from is used.
// On Windows the -f flag is not used (specific for Sendmail and Postfix), but instead the php.ini parameter sendmail_from is used.
if($this->returnPath) {
ini_set(sendmail_from, $this->returnPath);
}
//If safe mode is on, the fifth parameter to mail is not allowed, so the fix wont work on unix with safe_mode=On
if(!ini_get('safe_mode') && !$this->postfix_version1) {
// If safe_mode is on, the fifth parameter to mail is not allowed, so the fix wont work on unix with safe_mode=On
if(!ini_get('safe_mode') && $this->forceReturnPath) {
mail($this->recipient,
$this->subject,
$this->message,
......@@ -675,7 +652,7 @@ class t3lib_htmlmail {
}
// Sending copy:
if ($this->recipient_copy) {
if(!ini_get('safe_mode') && !$this->postfix_version1) {
if(!ini_get('safe_mode') && $this->forceReturnPath) {
mail( $this->recipient_copy,
$this->subject,
$this->message,
......@@ -692,7 +669,7 @@ class t3lib_htmlmail {
if ($this->auto_respond_msg) {
$theParts = explode('/',$this->auto_respond_msg,2);
$theParts[1] = str_replace("/",chr(10),$theParts[1]);
if(!ini_get('safe_mode') && !$this->postfix_version1) {
if(!ini_get('safe_mode') && $this->forceReturnPath) {
mail( $this->from_email,
$theParts[0],
$theParts[1],
......
......@@ -74,6 +74,7 @@ $TYPO3_CONF_VARS = Array(
'no_pconnect' => 0, // Boolean: If true, "connect" is used instead of "pconnect" when connecting to the database!
'multiplyDBfieldSize' => 1, // Double: 1-5: Amount used to multiply the DB field size when the install tool is evaluating the database size (eg. "2.5"). This is useful if you want to expand the size of fields for utf-8 etc. For western european sites using utf-8 the need should not be for more than twice the normal single-byte size (2) and for chinese / asian languages 3 should suffice.
'setMemoryLimit' => 0, // Integer, memory_limit in MB: If more than 16, TYPO3 will try to use ini_set() to set the memory limit of PHP to the value. This works only if the function ini_set() is not disabled by your sysadmin.
'forceReturnPath' => 0, // Boolean: Force return path in mail() calls. If this is set, all calls to mail() done by t3lib_htmlmail will be called with '-f<return_path> as the 5th parameter. This will make the return-path correct on almost all unix systems. There is a known problem with postfix below version 2: Mails are not sent if this option is set and postfix is used. On windows platforms, the Return-Path is set via a call to ini_set. This has no effect if php safe_mode is on.
),
'EXT' => Array ( // Options related to the Extension Management
'noEdit' => 1, // Boolean: If set, the Extension Manager does NOT allow extension files to be edited! (Otherwise both local and global extensions can be edited.)
......@@ -165,6 +166,7 @@ $TYPO3_CONF_VARS = Array(
'simulateStaticDocuments' => 0, // Boolean. This is the default value for simulateStaticDocuments (configurable with TypoScript which overrides this, if the TypoScript value is present)
'noPHPscriptInclude' => 0, // Boolean. If set, PHP-scripts are not included by TypoScript configurations, unless they reside in 'media/scripts/'-folder. This is a security option to ensure that users with template-access do not terrorize
'strictFormmail' => TRUE, // Boolean. If set, the internal "formmail" feature in TYPO3 will send mail ONLY to recipients which has been encoded by the system itself. This protects against spammers misusing the formmailer.
'secureFormmail' => TRUE, // Boolean. If set, the internal "formmail" feature in TYPO3 will send mail ONLY to the recipients that are defined in the form CE record. This protects against spammers misusing the formmailer.
'compressionLevel' => 0, // Determines output compression. Requires zlib in your php4 install. Range 1-9, where 1 is least compression (approx. 50%) and 9 is greatest compression (approx 33%). 'true' as value will set the compression based on system load (works with Linux, freebsd). Good default value is 3. For more info, see class in t3lib/class.gzip_encode.php written by Sandy McArthur, Jr. <Leknor@Leknor.com>
'compressionDebugInfo' => 0, // Boolean. If set, then in the end of the pages, the sizes of the compressed and non-compressed document is output. This should be used ONLY as a test, because the content is compressed twice in order to output this statistics!
'pageNotFound_handling' => '', // How TYPO3 should handle requests for non-existing/accessible pages. false (default): The 'nearest' page is shown. TRUE or '1': An TYPO3 error box is displayed. Integer > 1: Not used yet (outputs "ERROR: ###"). Strings: redirect URL, eg. 'notfound.html' or 'http://www.domain.org/errors/notfound.html'. If prefixed with "READFILE:" then it will expect the remaining string to be a HTML file which will be read and outputted directly after having the marker "###CURRENT_URL###" substituted with REQUEST_URI and ###REASON### with reason text, for example: "READFILE:fileadmin/notfound.html"
......@@ -207,7 +209,7 @@ $TYPO3_CONF_VARS = Array(
$T3_VAR = array(); // Initialize.
// TYPO3 version
$TYPO_VERSION = '3.7.0';
$TYPO_VERSION = '3.7-dev';
define('TYPO3_version', $TYPO_VERSION);
// Database-variables are cleared!
......
......@@ -1741,24 +1741,32 @@
$formmail = t3lib_div::makeInstance('t3lib_formmail');
$EMAIL_VARS = t3lib_div::_POST();
$locationData = $EMAIL_VARS['locationData'];
unset($EMAIL_VARS['locationData']);
unset($EMAIL_VARS['formtype_mail']);
$integrityCheck = $this->TYPO3_CONF_VARS['FE']['strictFormmail'];
// Check recipient field:
$encodedFields = explode(',','recipient,recipient_copy'); // These two fields are the ones which contain recipient addresses that can be misused to send mail from foreign servers.
foreach($encodedFields as $fieldKey) {
if (strlen($EMAIL_VARS[$fieldKey])) {
if ($res = $this->codeString($EMAIL_VARS[$fieldKey], TRUE)) { // Decode...
$EMAIL_VARS[$fieldKey] = $res; // Set value if OK
} elseif ($integrityCheck) { // Otherwise abort:
$GLOBALS['TT']->setTSlogMessage('"Formmail" discovered a field ('.$fieldKey.') which could not be decoded to a valid string. Sending formmail aborted due to security reasons!',3);
return FALSE;
} else {
$GLOBALS['TT']->setTSlogMessage('"Formmail" discovered a field ('.$fieldKey.') which could not be decoded to a valid string. The security level accepts this, but you should consider a correct coding though!',2);
if(!$this->TYPO3_CONF_VARS['FE']['secureFormmail']) {
// Check recipient field:
$encodedFields = explode(',','recipient,recipient_copy'); // These two fields are the ones which contain recipient addresses that can be misused to send mail from foreign servers.
foreach($encodedFields as $fieldKey) {
if (strlen($EMAIL_VARS[$fieldKey])) {
if ($res = $this->codeString($EMAIL_VARS[$fieldKey], TRUE)) { // Decode...
$EMAIL_VARS[$fieldKey] = $res; // Set value if OK
} elseif ($integrityCheck) { // Otherwise abort:
$GLOBALS['TT']->setTSlogMessage('"Formmail" discovered a field ('.$fieldKey.') which could not be decoded to a valid string. Sending formmail aborted due to security reasons!',3);
return false;
} else {
$GLOBALS['TT']->setTSlogMessage('"Formmail" discovered a field ('.$fieldKey.') which could not be decoded to a valid string. The security level accepts this, but you should consider a correct coding though!',2);
}
}
}
} else {
$locData = explode(':',$locationData);
$record = $this->sys_page->checkRecord($locData[1],$locData[2],1);
$EMAIL_VARS['recipient'] = $record['subheader'];
$EMAIL_VARS['recipient_copy'] = $this->extractRecipientCopy($record['bodytext']);
}
// Hook for preprocessing of the content for formmails:
......@@ -1774,6 +1782,20 @@
$GLOBALS['TT']->setTSlogMessage('"Formmail" invoked, sending mail to '.$EMAIL_VARS['recipient'],0);
}
/**
* Extracts the value of recipient copy field from a formmail CE bodytext
*
* @param string $bodytext The content of the related bodytext field
* @return string The value of the recipient_copy field, or an empty string
*/
function extractRecipientCopy($bodytext) {
$recipient_copy = '';
$fdef = array();
preg_match('/^[\s]*\|[\s]*recipient_copy[\s]*=[\s]*hidden[\s]*\|(.*)$/m', $bodytext, $fdef);
$recipient_copy = (!empty($fdef[1])) ? $fdef[1] : '';
return $recipient_copy;
}
/**
* Checks if jumpurl is set.
* This function also takes care of jumpurl utilized by the Direct Mail module (ext: direct_mail) which may set an integer value for jumpurl which refers to a link in a certain mail-record, mid
......
......@@ -425,6 +425,10 @@ REMOTE_ADDR was '".t3lib_div::getIndpEnv("REMOTE_ADDR")."' (".t3lib_div::getIndp
When you change the settings for Image Processing you <i>must</i> take into account that <u>old images</u> may still be in typo3temp/ folder and prevent new files from being generated! This is especially important to know, if you're trying to set up image processing for the very first time.
The problem is solved by <a href=\"".$this->setScriptName("typo3temp")."\">clearing the typo3temp/ folder</a>. Also make sure to clear the cache_pages table.
",1,1);
$this->message($ext, "Very Important: Changing Encryption Key setting", "
When you change the setting for the Encryption Key you <i>must</i> take into account that a change to this value might invalidate temporary information, URLs etc.
The problem is solved by <a href=\"".$this->setScriptName("typo3temp")."\">clearing the typo3temp/ folder</a>. Also make sure to clear the cache_pages table.
",1,1);
$this->message($ext, "Update localconf.php", "
This form updates the localconf.php file with the suggested values you see below. The values are based on the analysis above.
You can change the values in case you have alternatives to the suggested defaults.
......@@ -1572,13 +1576,26 @@ From sub-directory:
switch($cmd) {
case "get_form":
$out='
You can check the mail() function by entering your email address here and press the button. You should then receive a testmail from test@test.test.
<form action="'.$this->action.'" method="POST"><input type="text" name="TYPO3_INSTALL[check_mail]">
You can check the mail() function by entering your email address here and press the button. You should then receive a testmail from test@test.test.<br /> Since almost all mails in TYPO3 are sent using the t3lib_htmlmail class, sending with this class can be tested by checking the box <strong>Test t3lib_htmlmail</strong> below. The return-path of the mail is set to null@'.t3lib_div::getIndpEnv('HTTP_HOST').'. Some mail servers won\'t send the mail if the host of the return-path is not resolved correctly.
<form action="'.$this->action.'" method="POST"><input type="text" name="TYPO3_INSTALL[check_mail]"><br /><input type="checkbox" name="TYPO3_INSTALL[use_htmlmail]" >Test t3lib_htmlmail.
<input type="submit" value="Send test mail"></form>';
break;
default:
if (trim($this->INSTALL["check_mail"])) {
mail(trim($this->INSTALL["check_mail"]), "TEST SUBJECT", "TEST CONTENT", "From: test@test.test");
if($this->INSTALL["use_htmlmail"]) {
require_once (PATH_t3lib.'class.t3lib_htmlmail.php');
$email = t3lib_div::makeInstance("t3lib_htmlmail");
$email->start();
$email->subject = "TEST SUBJECT";
$email->from_email = "Test@test.test";
$email->from_name = "TYPO3 Install tool";
$email->returnPath = "null@".t3lib_div::getIndpEnv("HTTP_HOST");
$email->addPlain("TEST CONTENT");
$email->setHTML($email->encodeMsg("<html><body>HTML TEST CONTENT</body></html>"));
$email->send($this->INSTALL["check_mail"]);
} else {
mail(trim($this->INSTALL["check_mail"]), "TEST SUBJECT", "TEST CONTENT", "From: test@test.test");
}
$this->messages[]= "MAIL WAS SENT TO: ".$this->INSTALL["check_mail"];
}
break;
......@@ -1930,7 +1947,7 @@ From sub-directory:
// Database:
$out='
<table border=0 cellpadding=0 cellspacing=0>
<form action="'.$this->action.'" method="POST">';
<form name="setupGeneral" action="'.$this->action.'" method="POST">';
$out.=$this->wrapInCells("Username:", '<input type="text" name="TYPO3_INSTALL[localconf.php][typo_db_username]" value="'.htmlspecialchars(TYPO3_db_username?TYPO3_db_username:($this->config_array["sql.safe_mode_user"]?$this->config_array["sql.safe_mode_user"]:"")).'">'.($this->config_array["sql.safe_mode_user"]?"<BR>sql.safe_mode_user: <strong>".$this->config_array["sql.safe_mode_user"]."</strong>":""));
$out.=$this->wrapInCells("Password:", '<input type="text" name="TYPO3_INSTALL[localconf.php][typo_db_password]" value="'.htmlspecialchars(TYPO3_db_password).'">');
......@@ -1957,6 +1974,9 @@ From sub-directory:
if ($this->mode!="123") {
$out.=$this->wrapInCells("Site name:", '<input type="text" name="TYPO3_INSTALL[localconf.php][sitename]" value="'.htmlspecialchars($GLOBALS["TYPO3_CONF_VARS"]["SYS"]["sitename"]).'">');
$out.=$this->wrapInCells("", "<BR>");
$out.='<script type="text/javascript" src="../md5.js"></script><script type="text/javascript">function generateEncryptionKey(key) {time=new Date(); key=MD5(key)+MD5(time.getMilliseconds().toString());while(key.length<66){key=key+MD5(key)};return key;}</script>';
$out.=$this->wrapInCells("Encryption key:", '<input type="text" name="TYPO3_INSTALL[localconf.php][encryptionKey]" value="'.htmlspecialchars($GLOBALS["TYPO3_CONF_VARS"]["SYS"]["encryptionKey"]).'"><br /><input type="button" onclick="document.forms[\'setupGeneral\'].elements[\'TYPO3_INSTALL[localconf.php][encryptionKey]\'].value=generateEncryptionKey(document.forms[\'setupGeneral\'].elements[\'TYPO3_INSTALL[localconf.php][encryptionKey]\'].value);" value="Generate random key">');
$out.=$this->wrapInCells("", "<BR>");
// Other
......@@ -2041,6 +2061,9 @@ From sub-directory:
case "sitename":
if (strcmp($GLOBALS["TYPO3_CONF_VARS"]["SYS"]["sitename"],$value)) $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS["SYS"]["sitename"]', $value);
break;
case "encryptionKey":
if (strcmp($GLOBALS["TYPO3_CONF_VARS"]["SYS"]["encryptionKey"],$value)) $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS["SYS"]["encryptionKey"]', $value);
break;
case "im_combine_filename":
if (strcmp($GLOBALS["TYPO3_CONF_VARS"]["GFX"]["im_combine_filename"],$value)) $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS["GFX"]["im_combine_filename"]', $value);
break;
......@@ -3332,23 +3355,22 @@ From sub-directory:
break;
case "cmpTCA":
$this->includeTCA();
$this->mysqlVersion = "3.23"; // Set this previously to calling the function below in order to make the rendering right for the comparison.
$FDdb = $this->getFieldDefinitions_database();
// Displaying configured fields which are not in the database
$tLabel="Tables and fields in \$TCA, but not in database";
$cmpTCA_DB = $this->compareTCAandDatabase($GLOBALS["TCA"],$FDdb);
if (!count($cmpTCA_DB["extra"])) {
$this->message($tLabel,"Table and field definitions OK","
$tLabel='Tables and fields in $TCA, but not in database';
$cmpTCA_DB = $this->compareTCAandDatabase($GLOBALS['TCA'],$FDdb);
if (!count($cmpTCA_DB['extra'])) {
$this->message($tLabel,'Table and field definitions OK','
All fields and tables configured in $TCA appeared to exist in the database as well
",-1);
',-1);
} else {
$this->message($tLabel,"Invalid table and field definitions in \$TCA!","
$this->message($tLabel,'Invalid table and field definitions in $TCA!','
There are some tables and/or fields configured in the \$TCA array which does not exist in the database!
This will most likely cause you trouble with the TYPO3 backend interface!
",3);
while(list($tableName, $conf)=each($cmpTCA_DB["extra"])) {
$this->message($tLabel, $tableName,$this->displayFields($conf["fields"],0,"Suggested database field:"),2);
',3);
while(list($tableName, $conf)=each($cmpTCA_DB['extra'])) {
$this->message($tLabel, $tableName,$this->displayFields($conf['fields'],0,'Suggested database field:'),2);
}
}
......@@ -4000,8 +4022,7 @@ From sub-directory:
switch($fieldInfo["config"]["type"]) {
case "input":
if (ereg("date|time|int|year",$fieldInfo["config"]["eval"])) {
$us=ereg("date|time",$fieldInfo["config"]["eval"]) ? " unsigned" : "";
$out = "int(11)".$us." NOT NULL default '0'";
$out = "int(11) NOT NULL default '0'";
} else {
$max = intval($fieldInfo["config"]["max"]);
if ($max>0 && $max<200) {
......@@ -4016,9 +4037,9 @@ From sub-directory:
break;
case "check":
if (is_array($fieldInfo["config"]["items"]) && count($fieldInfo["config"]["items"])>8) {
$out = "int(11) unsigned NOT NULL default '0'";
$out = "int(11) NOT NULL default '0'";
} else {
$out = "tinyint(3) unsigned NOT NULL default '0'";
$out = "tinyint(3) NOT NULL default '0'";
}
break;
case "radio":
......@@ -4035,7 +4056,7 @@ From sub-directory:
$len = $max*(10+1+5+1); // Tablenames are 10, "_" 1, uid's 5, comma 1
$out=$this->getItemBlobSize($len);
} elseif ($max<=1) {
$out = "int(11) unsigned NOT NULL default '0'";
$out = "int(11) NOT NULL default '0'";
} else {
$len = $max*(5+1); // uid's 5, comma 1
$out=$this->getItemBlobSize($len);
......@@ -4051,7 +4072,7 @@ From sub-directory:
$max = t3lib_div::intInRange($fieldInfo["config"]["maxitems"],1,10000);
if ($max<=1) {
if ($fieldInfo["config"]["foreign_table"]) {
$out = "int(11) unsigned NOT NULL default '0'";
$out = "int(11) NOT NULL default '0'";
} else {
$out = $this->getItemArrayType($fieldInfo["config"]["items"]);
}
......@@ -4088,10 +4109,8 @@ From sub-directory:
$us = min($intSize)>=0 ? " unsigned" : "";
if (max($type)>0) {
$out = "varchar(".max($type).") NOT NULL default ''";
} elseif (max($intSize)>(!$us?127:255)) {
$out = "int(11)".$us." NOT NULL default '0'";
} else {
$out = "tinyint(3)".$us." NOT NULL default '0'";
$out = "int(11) NOT NULL default '0'";
}
}
return $out;
......@@ -4565,10 +4584,10 @@ A:hover {color: #000066}
}
/**
* [Describe function...]
* Convert a size from human-readable form into bytes
*
* @param [type] $bytes: ...
* @return [type] ...
* @param string A string containing the size in bytes, kilobytes or megabytes. Example: 64M
* @return string The string is returned in bytes and can also hold floating values
*/
function convertByteSize($bytes) {
if (stristr($bytes,"m")) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment