Index: trunk/core/kernel/db/db_tag_processor.php =================================================================== diff -u -N -r7902 -r8029 --- trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 7902) +++ trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 8029) @@ -1339,17 +1339,9 @@ // b. setting object's titlefield value (in titlebar ONLY) to default in case if object beeing created with no titlefield filled in if( $object_status[ $prefix_data['prefix_special'] ] == 'new' ) { - $title = str_replace('\'#'.$prefix_data['prefix_special'].'_titlefield#\'', '#'.$prefix_data['prefix_special'].'_titlefield#', $title); $new_value = $this->getInfo( $objects[ $prefix_data['prefix_special'] ], 'titlefield' ); - if(!$new_value && getArrayValue($title_info['new_titlefield'],$prefix_data['prefix_special']) ) { - $new_value = $this->Application->Phrase($title_info['new_titlefield'][ $prefix_data['prefix_special'] ]); - } - // old format had single quotes in the format - $title = str_replace('\'#'.$prefix_data['prefix_special'].'_titlefield#\'', "'$new_value'", $title); - // new format has no quotes and $new_value should be empty when creating items - if ($new_value) { - $title = str_replace('#'.$prefix_data['prefix_special'].'_titlefield#', "'$new_value'", $title); - } + if(!$new_value && getArrayValue($title_info['new_titlefield'],$prefix_data['prefix_special']) ) $new_value = $this->Application->Phrase($title_info['new_titlefield'][ $prefix_data['prefix_special'] ]); + $title = str_replace('#'.$prefix_data['prefix_special'].'_titlefield#', $new_value, $title); } } } @@ -1359,24 +1351,19 @@ // 3. find and replace any replacement vars preg_match_all('/#(.*_.*)#/Uis',$title,$rets); - if($rets[1]) - { + if ($rets[1]) { $replacement_vars = array_keys( array_flip($rets[1]) ); - foreach($replacement_vars as $replacement_var) - { + foreach ($replacement_vars as $replacement_var) { $var_info = explode('_',$replacement_var,2); $object =& $objects[ $var_info[0] ]; $new_value = $this->getInfo($object,$var_info[1]); - $title = str_replace('\'#'.$replacement_var.'#\'', "'$new_value'", $title); - if ($new_value) { - $title = str_replace('#'.$replacement_var.'#', "'$new_value'", $title); - } - else { - $title = str_replace('#'.$replacement_var.'#', $new_value, $title); - } + $title = str_replace('#'.$replacement_var.'#', $new_value, $title); } } + // replace trailing spaces inside title preset + '' occurences into single space + $title = preg_replace('/[ ]*\'\'[ ]*/', ' ', $title); + $cut_first = getArrayValue($params,'cut_first'); if( $cut_first && strlen($title) > $cut_first && !preg_match('/(.*)<\/a>/',$title) ) $title = substr($title, 0, $cut_first).' ...'; @@ -1446,6 +1433,7 @@ switch ($element_type) { case 'select': + case 'multiselect': case 'radio': $field_options = $object->GetFieldOptions($field, 'options'); $field_options['options'] = $helper->GetValuesHash( $object->GetDBField($params['value_list_field']) ); Index: trunk/admin/install.php =================================================================== diff -u -N -r7867 -r8029 --- trunk/admin/install.php (.../install.php) (revision 7867) +++ trunk/admin/install.php (.../install.php) (revision 8029) @@ -1695,6 +1695,12 @@ } if ($state == "adm_login") { + $ado =& inst_GetADODBConnection(); + $sql = 'UPDATE '.TABLE_PREFIX.'UserSession + SET LastAccessed = 0 + WHERE PortalUserId IN (0,-2)'; + $ado->Execute($sql); + echo ""; } Index: trunk/kernel/include/usersession.php =================================================================== diff -u -N -r7884 -r8029 --- trunk/kernel/include/usersession.php (.../usersession.php) (revision 7884) +++ trunk/kernel/include/usersession.php (.../usersession.php) (revision 8029) @@ -55,7 +55,7 @@ else { $this->Set("PortalUserId", 0); - $this->Set("Language", $objLanguages->GetPrimary()); + $this->Set("Language", (int)$objLanguages->GetPrimary()); $ThemeId = $m_var_list["theme"]; $this->SetThemeName($ThemeId); //$this->Set("Theme", $objConfig->Get("Default_Theme")); @@ -127,7 +127,7 @@ $this->Set("PortalUserId",$this->Get("PortalUserId")); $this->Set("GroupId",$this->Get("GroupId")); $this->Set("GroupList",$this->Get("GroupList")); - $this->Set("Language",$this->Get("Language")); + $this->Set("Language", (int)$this->Get("Language")); $this->Set("tz",$this->Get("tz")); $this->Set("LastAccessed",adodb_date("U")); $this->Update(); @@ -355,7 +355,7 @@ //$this->Set("CurrentTempKey",$this->GetUniqueKey()); $this->UseTempKeys=FALSE; $this->Set("PortalUserId", 0); - $this->Set("Language", $objLanguages->GetPrimary()); + $this->Set("Language", (int)$objLanguages->GetPrimary()); $ThemeId = $m_var_list["theme"]; $this->SetThemeName($ThemeId); //$this->Set("Theme", $objConfig->Get("Default_Theme")); @@ -370,7 +370,7 @@ else { $this->Set("PortalUserId", 0); - $this->Set("Language", $objLanguages->GetPrimary()); + $this->Set("Language", (int)$objLanguages->GetPrimary()); $ThemeId = $m_var_list["theme"]; $this->SetThemeName($ThemeId); //$this->Set("Theme", $objConfig->Get("Default_Theme")); @@ -587,6 +587,11 @@ { global $objConfig, $FrontEnd; + if (!$variableName) { + trigger_error('Attempt to set session variable without name', E_USER_WARNING); + return ; + } + $objConfig->Set($variableName,$variableValue,2); $variableValue = addslashes($variableValue); @@ -695,7 +700,7 @@ } } if((int)$this->GetPersistantVariable("Language")) - $this->Set("Language",$objConfig->Get("Language")); + $this->Set("Language", (int)$objConfig->Get("Language")); $this->DeleteExpiredSessions(); return true; } @@ -1098,8 +1103,8 @@ $item->Set("SessionKey",$result->fields["SessionKey"]); $item->Set("LastAccessed", $result->fields["LastAccessed"]); $item->Set("PortalUserId", $result->fields["PortalUserId"]); - $item->Set("Language", $result->fields["Language"]); - $item->Set("Theme" , $result->fields["Theme"]); + $item->Set("Language", (int)$result->fields["Language"]); + $item->Set("Theme" , (int)$result->fields["Theme"]); array_push($resultSet,$item); $result->MoveNext(); } @@ -1108,24 +1113,8 @@ function GetUniqueKey() { - while(true) - { - /* create the new session key here */ - mt_srand(100000000*(double)microtime()); - $sessionId=strtoupper(sprintf("AD%xFD",mt_rand(100000000,999999999))); //9 digit hex session id - $query = "select SessionKey from ".GetTablePrefix()."UserSession "; - $query .= "where SessionKey='$sessionId' OR CurrentTempKey='$sessionId' OR PrevTempKey='$sessionId'"; - $rs = $this->adodbConnection->Execute($query); - if($rs->EOF) - break; - if($i>100) - { - return ""; - } - $i++; - } - //echo "Getting Unique Key: $sessionId
"; - return $sessionId; + $application =& kApplication::Instance(); + return $application->Session->GenerateSID(); } function GetNewSession() @@ -1142,10 +1131,10 @@ $this->Set("CurrentTempKey",$sessionId); if($m_var_list["lang"]) { - $this->Set("Language",$m_var_list["lang"]); + $this->Set("Language", (int)$m_var_list["lang"]); } else - $this->Set("Language", $objLanguages->GetPrimary()); + $this->Set("Language", (int)$objLanguages->GetPrimary()); $this->SetThemeName(); //$this->Set("Theme", $objConfig->Get("Default_Theme")); $this->UpdateAccessTime(); @@ -1186,7 +1175,7 @@ $Theme = $objThemes->GetItem($id); $name = $Theme->Get("Name"); - $this->Set("Theme",$name); + $this->Set("Theme", (int)$name); //$this->Update(); } Index: trunk/core/install/install_schema.sql =================================================================== diff -u -N -r8015 -r8029 --- trunk/core/install/install_schema.sql (.../install_schema.sql) (revision 8015) +++ trunk/core/install/install_schema.sql (.../install_schema.sql) (revision 8029) @@ -109,8 +109,8 @@ TimeFormat varchar(50) NOT NULL default '', InputDateFormat varchar(50) NOT NULL default 'm/d/Y', InputTimeFormat varchar(50) NOT NULL default 'g:i:s A', - DecimalPoint char(2) NOT NULL default '', - ThousandSep TINYTEXT NOT NULL default '', + DecimalPoint VARCHAR(10) NOT NULL DEFAULT '', + ThousandSep VARCHAR(10) NOT NULL DEFAULT '', `Charset` varchar(20) NOT NULL default '', UnitSystem tinyint(4) NOT NULL default '1', PRIMARY KEY (LanguageId) @@ -145,7 +145,7 @@ LanguageId int(11) NOT NULL default '0', LastChanged int(10) unsigned NOT NULL default '0', LastChangeIP varchar(15) NOT NULL default '', - Module varchar(30) NOT NULL default '', + Module VARCHAR(30) NOT NULL DEFAULT 'In-Portal', PRIMARY KEY (PhraseId), KEY LanguageId (LanguageId), INDEX Phrase_Index (Phrase) @@ -165,7 +165,7 @@ GroupId int(11) NOT NULL auto_increment, Name varchar(255) NOT NULL default '', Description varchar(255) default NULL, - CreatedOn double NOT NULL default '0', + CreatedOn INT UNSIGNED NULL DEFAULT NULL, System tinyint(4) NOT NULL default '0', Personal tinyint(4) NOT NULL default '0', Enabled tinyint(4) NOT NULL default '1', @@ -265,16 +265,16 @@ ); CREATE TABLE UserSession ( - SessionKey varchar(50) NOT NULL default '', - CurrentTempKey varchar(50) default NULL, - PrevTempKey varchar(50) default NULL, - LastAccessed double NOT NULL default '0', - PortalUserId varchar(255) NOT NULL default '', - Language varchar(255) NOT NULL default '', - Theme varchar(255) NOT NULL default '', + SessionKey int(10) unsigned NOT NULL default '0', + CurrentTempKey int(10) unsigned default NULL, + PrevTempKey int(10) unsigned default NULL, + LastAccessed int(10) unsigned NOT NULL default '0', + PortalUserId int(11) NOT NULL default '-2', + `Language` int(11) NOT NULL default '1', + Theme int(11) NOT NULL default '1', GroupId int(11) NOT NULL default '0', IpAddress varchar(20) NOT NULL default '0.0.0.0', - Status int(11) NOT NULL default '1', + `Status` int(11) NOT NULL default '1', GroupList varchar(255) default NULL, tz int(11) default NULL, PRIMARY KEY (SessionKey), Index: trunk/core/units/email_messages/email_messages_config.php =================================================================== diff -u -N -r8015 -r8029 --- trunk/core/units/email_messages/email_messages_config.php (.../email_messages_config.php) (revision 8015) +++ trunk/core/units/email_messages/email_messages_config.php (.../email_messages_config.php) (revision 8029) @@ -56,7 +56,7 @@ 'Fields' => Array ( 'EmailMessageId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), 'Template' => Array('type' => 'string', 'default' => null), - 'ReplacementTags' => Array ('type' => 'string', 'not_null' => 1, 'default' => null), + 'ReplacementTags' => Array ('type' => 'string', 'default' => null), 'MessageType' => Array('type' => 'string', 'formatter' => 'kOptionsFormatter', 'options' => Array('text'=>'la_Text','html'=>'la_Html'), 'not_null' => '1','default' => 'text'), 'LanguageId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), 'EventId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), Index: trunk/core/units/groups/groups_config.php =================================================================== diff -u -N -r8015 -r8029 --- trunk/core/units/groups/groups_config.php (.../groups_config.php) (revision 8015) +++ trunk/core/units/groups/groups_config.php (.../groups_config.php) (revision 8029) @@ -74,7 +74,7 @@ 'GroupId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), 'Name' => Array('type' => 'string', 'not_null' => 1, 'required' => 1, 'default' => ''), 'Description' => Array('type' => 'string', 'default' => null), - 'CreatedOn' => Array('type' => 'double', 'formatter' => 'kDateFormatter', 'not_null' => '1','default' => '#NOW#'), + 'CreatedOn' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'), 'System' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), 'Personal' => Array('type' => 'int','not_null' => 1, 'default' => 0), 'Enabled' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(1 => 'la_Enabled', 0 => 'la_Disabled'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 1), Index: trunk/core/units/reviews/reviews_config.php =================================================================== diff -u -N -r7997 -r8029 --- trunk/core/units/reviews/reviews_config.php (.../reviews_config.php) (revision 7997) +++ trunk/core/units/reviews/reviews_config.php (.../reviews_config.php) (revision 8029) @@ -96,7 +96,7 @@ 'Fields' => Array( 'ReviewId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), - 'CreatedOn' => Array('type' => 'double', 'formatter'=>'kDateFormatter','not_null'=>1,'default'=>'#NOW#'), + 'CreatedOn' => Array('type' => 'int', 'formatter'=>'kDateFormatter', 'default'=>'#NOW#'), 'ReviewText' => Array('type'=>'string','required'=>1,'not_null'=>1,'default'=>''), 'IPAddress' => Array('type'=>'string','max_value_inc'=>15,'not_null'=>1,'default'=>''), 'ItemId' => Array('type'=>'int','not_null'=>1,'default'=>0), Index: trunk/kernel/units/reviews/reviews_config.php =================================================================== diff -u -N -r7997 -r8029 --- trunk/kernel/units/reviews/reviews_config.php (.../reviews_config.php) (revision 7997) +++ trunk/kernel/units/reviews/reviews_config.php (.../reviews_config.php) (revision 8029) @@ -96,7 +96,7 @@ 'Fields' => Array( 'ReviewId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), - 'CreatedOn' => Array('type' => 'double', 'formatter'=>'kDateFormatter','not_null'=>1,'default'=>'#NOW#'), + 'CreatedOn' => Array('type' => 'int', 'formatter'=>'kDateFormatter', 'default'=>'#NOW#'), 'ReviewText' => Array('type'=>'string','required'=>1,'not_null'=>1,'default'=>''), 'IPAddress' => Array('type'=>'string','max_value_inc'=>15,'not_null'=>1,'default'=>''), 'ItemId' => Array('type'=>'int','not_null'=>1,'default'=>0), Index: trunk/core/kernel/application.php =================================================================== diff -u -N -r8006 -r8029 --- trunk/core/kernel/application.php (.../application.php) (revision 8006) +++ trunk/core/kernel/application.php (.../application.php) (revision 8029) @@ -2459,7 +2459,7 @@ */ function TableFound($table_name) { - $this->Conn->TableFound($table_name); + return $this->Conn->TableFound($table_name); } } Index: trunk/admin/install/inportal_schema.sql =================================================================== diff -u -N -r8015 -r8029 --- trunk/admin/install/inportal_schema.sql (.../inportal_schema.sql) (revision 8015) +++ trunk/admin/install/inportal_schema.sql (.../inportal_schema.sql) (revision 8029) @@ -63,7 +63,7 @@ CREATE TABLE ItemRating ( RatingId int(11) NOT NULL auto_increment, IPAddress varchar(255) NOT NULL default '', - CreatedOn double NOT NULL default '0', + CreatedOn INT UNSIGNED NULL DEFAULT NULL, RatingValue int(11) NOT NULL default '0', ItemId int(11) NOT NULL default '0', PRIMARY KEY (RatingId) @@ -73,7 +73,7 @@ CREATE TABLE ItemReview ( ReviewId int(11) NOT NULL auto_increment, - CreatedOn double NOT NULL default '0', + CreatedOn INT UNSIGNED NULL DEFAULT NULL, ReviewText longtext NOT NULL, IPAddress varchar(255) NOT NULL default '', ItemId int(11) NOT NULL default '0', @@ -131,7 +131,7 @@ AdvancedSearch tinyint(4) NOT NULL default '1', Description varchar(255) default NULL, DisplayName varchar(80) default NULL, - ModuleName VARCHAR(20) NULL DEFAULT 'In-Portal', + ModuleName VARCHAR(20) NOT NULL DEFAULT 'In-Portal', ConfigHeader varchar(255) default NULL, DisplayOrder int(11) NOT NULL default '0', SearchConfigId int(11) NOT NULL auto_increment, @@ -169,7 +169,7 @@ CREATE TABLE SpamControl ( ItemResourceId int(11) NOT NULL default '0', IPaddress varchar(20) NOT NULL default '', - Expire double NOT NULL default '0', + Expire INT UNSIGNED NULL DEFAULT NULL, PortalUserId int(11) NOT NULL default '0', DataType varchar(20) default NULL ) @@ -191,7 +191,7 @@ CREATE TABLE SuggestMail ( email varchar(255) NOT NULL default '', - sent double, + sent INT UNSIGNED NULL DEFAULT NULL, PRIMARY KEY (email) ) @@ -201,7 +201,7 @@ SysCacheId int(11) NOT NULL auto_increment, Name varchar(255) NOT NULL default '', Value mediumtext, - Expire double NOT NULL default '0', + Expire INT UNSIGNED NULL DEFAULT NULL, Module varchar(20) default NULL, Context varchar(255) default NULL, GroupList varchar(255) NOT NULL default '', Index: trunk/core/install/upgrades.sql =================================================================== diff -u -N -r8015 -r8029 --- trunk/core/install/upgrades.sql (.../upgrades.sql) (revision 8015) +++ trunk/core/install/upgrades.sql (.../upgrades.sql) (revision 8029) @@ -9,7 +9,10 @@ # ===== v 4.0.2 ===== ALTER TABLE EmailMessage ADD ReplacementTags TEXT AFTER Template; -ALTER TABLE Phrase CHANGE Translation Translation TEXT NOT NULL; +ALTER TABLE Phrase + CHANGE Translation Translation TEXT NOT NULL, + CHANGE Module Module VARCHAR(30) NOT NULL DEFAULT 'In-Portal'; + ALTER TABLE Category CHANGE Description Description TEXT, CHANGE l1_Description l1_Description TEXT, @@ -48,11 +51,22 @@ CHANGE Enabled Enabled INT(11) NOT NULL DEFAULT '1', CHANGE InputDateFormat InputDateFormat VARCHAR(50) NOT NULL DEFAULT 'm/d/Y', CHANGE InputTimeFormat InputTimeFormat VARCHAR(50) NOT NULL DEFAULT 'g:i:s A', - CHANGE DecimalPoint DecimalPoint CHAR(2) NOT NULL DEFAULT '', - CHANGE ThousandSep ThousandSep TINYTEXT NOT NULL DEFAULT ''; + CHANGE DecimalPoint DecimalPoint VARCHAR(10) NOT NULL DEFAULT '', + CHANGE ThousandSep ThousandSep VARCHAR(10) NOT NULL DEFAULT ''; ALTER TABLE Events CHANGE FromUserId FromUserId INT(11) NOT NULL DEFAULT '-1'; ALTER TABLE StdDestinations CHANGE DestAbbr2 DestAbbr2 CHAR(2) NULL DEFAULT NULL; ALTER TABLE PermCache DROP DACL; + +ALTER TABLE PortalGroup CHANGE CreatedOn CreatedOn INT UNSIGNED NULL DEFAULT NULL; + +ALTER TABLE UserSession + CHANGE SessionKey SessionKey INT UNSIGNED NULL DEFAULT NULL , + CHANGE CurrentTempKey CurrentTempKey INT UNSIGNED NULL DEFAULT NULL , + CHANGE PrevTempKey PrevTempKey INT UNSIGNED NULL DEFAULT NULL , + CHANGE LastAccessed LastAccessed INT UNSIGNED NOT NULL DEFAULT '0', + CHANGE PortalUserId PortalUserId INT(11) NOT NULL DEFAULT '-2', + CHANGE Language Language INT(11) NOT NULL DEFAULT '1', + CHANGE Theme Theme INT(11) NOT NULL DEFAULT '1'; Index: trunk/admin/install/upgrades/inportal_upgrade_v4.0.2.sql =================================================================== diff -u -N -r8015 -r8029 --- trunk/admin/install/upgrades/inportal_upgrade_v4.0.2.sql (.../inportal_upgrade_v4.0.2.sql) (revision 8015) +++ trunk/admin/install/upgrades/inportal_upgrade_v4.0.2.sql (.../inportal_upgrade_v4.0.2.sql) (revision 8029) @@ -1,8 +1,7 @@ ALTER TABLE EmailMessage ADD ReplacementTags TEXT AFTER Template; -ALTER TABLE Phrase CHANGE Translation Translation TEXT NOT NULL; +ALTER TABLE Phrase CHANGE Translation Translation TEXT NOT NULL, CHANGE Module Module VARCHAR(30) NOT NULL DEFAULT 'In-Portal'; ALTER TABLE Category CHANGE Description Description TEXT, CHANGE l1_Description l1_Description TEXT, CHANGE l2_Description l2_Description TEXT, CHANGE l3_Description l3_Description TEXT, CHANGE l4_Description l4_Description TEXT, CHANGE l5_Description l5_Description TEXT, CHANGE CachedNavbar CachedNavbar text, CHANGE l1_CachedNavbar l1_CachedNavbar text, CHANGE l2_CachedNavbar l1_CachedNavbar text, CHANGE l3_CachedNavbar l1_CachedNavbar text, CHANGE l4_CachedNavbar l1_CachedNavbar text, CHANGE l5_CachedNavbar l1_CachedNavbar text; - ALTER TABLE ConfigurationAdmin CHANGE ValueList ValueList TEXT; ALTER TABLE EmailQueue CHANGE `Subject` `Subject` TEXT, CHANGE toaddr toaddr TEXT, CHANGE fromaddr fromaddr TEXT; @@ -11,17 +10,26 @@ ALTER TABLE PortalUser CHANGE CreatedOn CreatedOn INT NOT NULL DEFAULT '0', CHANGE dob dob INT(11) NULL DEFAULT NULL, CHANGE PassResetTime PassResetTime INT(11) UNSIGNED NULL DEFAULT NULL, CHANGE PwRequestTime PwRequestTime INT(11) UNSIGNED NULL DEFAULT NULL, CHANGE `Password` `Password` VARCHAR(255) NULL DEFAULT 'd41d8cd98f00b204e9800998ecf8427e'; ALTER TABLE Modules CHANGE BuildDate BuildDate INT UNSIGNED NULL DEFAULT NULL, CHANGE Version Version VARCHAR(10) NOT NULL DEFAULT '0.0.0'; -ALTER TABLE Language CHANGE Enabled Enabled INT(11) NOT NULL DEFAULT '1', CHANGE InputDateFormat InputDateFormat VARCHAR(50) NOT NULL DEFAULT 'm/d/Y', CHANGE InputTimeFormat InputTimeFormat VARCHAR(50) NOT NULL DEFAULT 'g:i:s A', CHANGE DecimalPoint DecimalPoint CHAR(2) NOT NULL DEFAULT '', CHANGE ThousandSep ThousandSep TINYTEXT NOT NULL DEFAULT ''; +ALTER TABLE Language CHANGE Enabled Enabled INT(11) NOT NULL DEFAULT '1', CHANGE InputDateFormat InputDateFormat VARCHAR(50) NOT NULL DEFAULT 'm/d/Y', CHANGE InputTimeFormat InputTimeFormat VARCHAR(50) NOT NULL DEFAULT 'g:i:s A', CHANGE DecimalPoint DecimalPoint VARCHAR(10) NOT NULL DEFAULT '', CHANGE ThousandSep ThousandSep VARCHAR(10) NOT NULL DEFAULT ''; ALTER TABLE Events CHANGE FromUserId FromUserId INT(11) NOT NULL DEFAULT '-1'; - + ALTER TABLE StdDestinations CHANGE DestAbbr2 DestAbbr2 CHAR(2) NULL DEFAULT NULL; ALTER TABLE PermCache DROP DACL; ALTER TABLE Images CHANGE LocalThumb LocalThumb TINYINT(4) NOT NULL DEFAULT '1', CHANGE SameImages SameImages TINYINT(4) NOT NULL DEFAULT '1', CHANGE AltName AltName VARCHAR(255) NOT NULL DEFAULT ''; -ALTER TABLE SearchConfig CHANGE SimpleSearch SimpleSearch TINYINT(4) NOT NULL DEFAULT '1', CHANGE AdvancedSearch AdvancedSearch TINYINT(4) NOT NULL DEFAULT '1', CHANGE ModuleName ModuleName VARCHAR(20) NULL DEFAULT 'In-Portal'; -ALTER TABLE ItemReview CHANGE CreatedById CreatedById INT(11) NOT NULL DEFAULT '-1', CHANGE Status Status TINYINT(4) NOT NULL DEFAULT '2'; +ALTER TABLE SearchConfig CHANGE SimpleSearch SimpleSearch TINYINT(4) NOT NULL DEFAULT '1', CHANGE AdvancedSearch AdvancedSearch TINYINT(4) NOT NULL DEFAULT '1', CHANGE ModuleName ModuleName VARCHAR(20) NOT NULL DEFAULT 'In-Portal'; +ALTER TABLE ItemReview CHANGE CreatedById CreatedById INT(11) NOT NULL DEFAULT '-1', CHANGE Status Status TINYINT(4) NOT NULL DEFAULT '2', CHANGE CreatedOn CreatedOn INT UNSIGNED NULL DEFAULT NULL; ALTER TABLE Visits CHANGE PortalUserId PortalUserId INT(11) NOT NULL DEFAULT '-2'; +ALTER TABLE ItemRating CHANGE CreatedOn CreatedOn INT UNSIGNED NULL DEFAULT NULL; +ALTER TABLE PortalGroup CHANGE CreatedOn CreatedOn INT UNSIGNED NULL DEFAULT NULL; + +ALTER TABLE SpamControl CHANGE Expire Expire INT UNSIGNED NULL DEFAULT NULL; +ALTER TABLE SuggestMail CHANGE sent sent INT UNSIGNED NULL DEFAULT NULL; +ALTER TABLE SysCache CHANGE Expire Expire INT UNSIGNED NULL DEFAULT NULL; + +ALTER TABLE UserSession CHANGE SessionKey SessionKey INT UNSIGNED NULL DEFAULT NULL, CHANGE CurrentTempKey CurrentTempKey INT UNSIGNED NULL DEFAULT NULL, CHANGE PrevTempKey PrevTempKey INT UNSIGNED NULL DEFAULT NULL, CHANGE LastAccessed LastAccessed INT UNSIGNED NOT NULL DEFAULT '0', CHANGE PortalUserId PortalUserId INT(11) NOT NULL DEFAULT '-2', CHANGE Language Language INT(11) NOT NULL DEFAULT '1', CHANGE Theme Theme INT(11) NOT NULL DEFAULT '1'; + UPDATE Modules SET Version = '4.0.2' WHERE Name = 'In-Portal'; \ No newline at end of file Index: trunk/core/units/modules/modules_config.php =================================================================== diff -u -N -r8015 -r8029 --- trunk/core/units/modules/modules_config.php (.../modules_config.php) (revision 8015) +++ trunk/core/units/modules/modules_config.php (.../modules_config.php) (revision 8029) @@ -101,7 +101,7 @@ 'LoadOrder' => Array('type' => 'int','not_null' => 1, 'default' => 0), 'TemplatePath' => Array('type' => 'string','not_null' => 1, 'default' => ''), 'RootCat' => Array('type' => 'int','not_null' => 1, 'default' => 0), - 'BuildDate' => Array('type' => 'double', 'formatter' => 'kDateFormatter', 'not_null' => '1','default' => ''), + 'BuildDate' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => null), ), 'VirtualFields' => Array(), Index: trunk/kernel/units/modules/modules_config.php =================================================================== diff -u -N -r7391 -r8029 --- trunk/kernel/units/modules/modules_config.php (.../modules_config.php) (revision 7391) +++ trunk/kernel/units/modules/modules_config.php (.../modules_config.php) (revision 8029) @@ -92,15 +92,15 @@ ), 'Fields' => Array( - 'Name' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Name' => Array('type' => 'string', 'not_null' => 1, 'default' => ''), 'Path' => Array('type' => 'string','not_null' => '1','default' => ''), 'Var' => Array('type' => 'string','not_null' => '1','default' => ''), - 'Version' => Array('type' => 'string','not_null' => '1','default' => ''), - 'Loaded' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(1 => 'la_Enabled', 0 => 'la_Disabled'), 'use_phrases' => 1, 'not_null' => '1','default' => '1'), - 'LoadOrder' => Array('type' => 'int','not_null' => '1','default' => '0'), - 'TemplatePath' => Array('type' => 'string','not_null' => '1','default' => ''), - 'RootCat' => Array('type' => 'int','not_null' => '1','default' => '0'), - 'BuildDate' => Array('type' => 'double', 'formatter' => 'kDateFormatter', 'not_null' => '1','default' => ''), + 'Version' => Array('type' => 'string','not_null' => '1','default' => '0.0.0'), + 'Loaded' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(1 => 'la_Enabled', 0 => 'la_Disabled'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 1), + 'LoadOrder' => Array('type' => 'int','not_null' => 1, 'default' => 0), + 'TemplatePath' => Array('type' => 'string','not_null' => 1, 'default' => ''), + 'RootCat' => Array('type' => 'int','not_null' => 1, 'default' => 0), + 'BuildDate' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => null), ), 'VirtualFields' => Array(), Index: trunk/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -N -r8015 -r8029 --- trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 8015) +++ trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 8029) @@ -381,6 +381,7 @@ 'default_missing' => 'Default value for field %s not set in config', 'not_null_error1' => 'Field %s is NOT NULL in the database, but is not configured as not_null or required', 'not_null_error2' => 'Field %s is described as NOT NULL in config, but does not have DEFAULT value', + 'not_null_error3' => 'Field %s is described as NOT NULL in config, but is NULL in db', 'invalid_default' => 'Default value for field %s%s not sync. to db (in config = %s, in db = %s)', 'type_missing' => 'Type definition for field %s missing in config', ); @@ -413,21 +414,26 @@ } if ($field['Null'] != 'YES') { - // MySQL5 for null returns "NO", but MySQL4 returns "" + // field is NOT NULL in database (MySQL5 for null returns "NO", but MySQL4 returns "") if ( $f_name != $config['IDField'] && !isset($options['not_null']) && !isset($options['required']) ) { $config_errors[] = sprintf($error_messages['not_null_error1'], $f_name); } - if ( isset($options['not_null']) && !isset($options['default']) ) { + if (isset($options['not_null']) && $options['not_null'] && !isset($options['default']) ) { $config_errors[] = sprintf($error_messages['not_null_error2'], $f_name); } } + else { + if (isset($options['not_null']) && $options['not_null']) { + $config_errors[] = sprintf($error_messages['not_null_error3'], $f_name); + } + } if (!array_key_exists('type', $options)) { $config_errors[] = sprintf($error_messages['type_missing'], $f_name); } if (!$default_missing) { - if ($f_name == $config['IDField'] && $options['default'] !== 0) { + if ($f_name == $config['IDField'] && $options['type'] != 'string' && $options['default'] !== 0) { $config_errors[] = sprintf($error_messages['invalid_default'], 'IDField ', $f_name, $this->varDump($options['default']), $this->varDump($field['Default'])); } else if ($options['default'] != '#NOW#' && $field['Default'] !== $options['default'] && !in_array($options['type'], $float_types)) { Index: trunk/core/units/admin/admin_tag_processor.php =================================================================== diff -u -N -r8005 -r8029 --- trunk/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 8005) +++ trunk/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 8029) @@ -697,8 +697,8 @@ list(, $env) = explode('|', $last_template); $vars = $this->Application->HttpQuery->processQueryString($env, 'pass'); - if ($vars['t'] == 'login') { - // prevents redirect recursion + if ($vars['t'] == 'login' || $vars['t'] == 'index') { + // prevents redirect recursion OR old in-portal pages return false; } Index: trunk/kernel/include/adodb/drivers/adodb-mysql.inc.php =================================================================== diff -u -N -r7867 -r8029 --- trunk/kernel/include/adodb/drivers/adodb-mysql.inc.php (.../adodb-mysql.inc.php) (revision 7867) +++ trunk/kernel/include/adodb/drivers/adodb-mysql.inc.php (.../adodb-mysql.inc.php) (revision 8029) @@ -50,6 +50,10 @@ // if magic quotes disabled, use mysql_real_escape_string() function qstr($s,$magic_quotes=false) { + if (is_null($s)) { + return 'NULL'; + } + if (!$magic_quotes) { if (ADODB_PHPVER >= 0x4300) { Index: trunk/kernel/include/modules.php =================================================================== diff -u -N -r7391 -r8029 --- trunk/kernel/include/modules.php (.../modules.php) (revision 7391) +++ trunk/kernel/include/modules.php (.../modules.php) (revision 8029) @@ -946,7 +946,7 @@ { if($objSession->Get("Language")!=$m_var_list["lang"]) { - $objSession->Set("Language",$m_var_list["lang"]); + $objSession->Set("Language", (int)$m_var_list["lang"]); } $objSession->LoadSessionData(); $objSession->UpdateAccessTime(); @@ -962,7 +962,7 @@ $CurrentTheme = $objThemes->GetItem($m_var_list["theme"]); $var_list["t"] = $CurrentTheme->GetTemplateById($var_list["t"]); - $objSession->Set("Theme",$CurrentTheme->Get("Name")); + $objSession->Set("Theme", (int)$CurrentTheme->Get("Name")); } /*create the global current user object */ $UserID=$objSession->Get("PortalUserId"); @@ -1016,10 +1016,6 @@ } } -if (strstr($_SERVER['SCRIPT_NAME'], 'install') && $objSession->Get("PortalUserId") == 0) { - $objSession->Delete(); -} - if( !isset($SearchPerformed) ) $SearchPerformed = false; if($SearchPerformed == true) $objSearch->BuildIndexes(); LogEntry("Finished Loading Module action scripts\n");