Index: trunk/kernel/include/config.php =================================================================== diff -u -r1566 -r2000 --- trunk/kernel/include/config.php (.../config.php) (revision 1566) +++ trunk/kernel/include/config.php (.../config.php) (revision 2000) @@ -259,12 +259,12 @@ $sql = substr($string,$start+5,$len-5); $sql_val = $this->explode_sql($sql); - $s = substr($string,0,$start) . $sql_val . substr($string,$end+5); + $s = substr($string,0,$start) . $sql_val . substr($string,$end+6); $string = $s; $start = strpos($string,""); } - return $string; + return preg_replace('/(.*)$,/','\\1', $string); } function ItemFormElement($StartFrom=1) Index: trunk/admin/install.php =================================================================== diff -u -r1943 -r2000 --- trunk/admin/install.php (.../install.php) (revision 1943) +++ trunk/admin/install.php (.../install.php) (revision 2000) @@ -529,8 +529,9 @@ } } } - + usort($upgrades_arr, "VersionSort"); + $result=0; $failCheck=1; $stopCheck=2; @@ -556,6 +557,7 @@ $Modules[] = Array('module'=>$rs->fields['Name'],'curver'=>$rs->fields['Version'],'newver'=>$newver,'error'=>$result!='pass'); // $Texts[] = $rs->fields['Name']." (".$rs->fields['Version']." ".prompt_language("la_to")." ".GetMaxPortalVersion($dir_name).")"; } + /*$dir = @dir($dir_name); while ($file = $dir->read()) { @@ -643,17 +645,27 @@ usort($upgrades_arr, "VersionSort"); - foreach($upgrades_arr as $file) { - $file_tmp = str_replace("inportal_upgrade_v", "", $file); - $file_tmp = str_replace(".sql", "", $file_tmp); + foreach($upgrades_arr as $file) + { + preg_match('/inportal_upgrade_v(.*).(php|sql)$/', $file, $rets); + $tmp_version = $rets[1]; + $tmp_extension = $rets[2]; - if (ConvertVersion($file_tmp) > ConvertVersion($current_version)) { + if (ConvertVersion($tmp_version) > ConvertVersion($current_version) ) + { $filename = $pathtoroot.$mod_path."/admin/install/upgrades/$file"; //echo "Running: $filename
"; - if(file_exists($filename)) - { - RunSQLFile($ado, $filename); - } + if( file_exists($filename) ) + { + if($tmp_extension == 'sql') + { + RunSQLFile($ado, $filename); + } + else + { + include_once $filename; + } + } } } Index: trunk/kernel/include/usersession.php =================================================================== diff -u -r1868 -r2000 --- trunk/kernel/include/usersession.php (.../usersession.php) (revision 1868) +++ trunk/kernel/include/usersession.php (.../usersession.php) (revision 2000) @@ -485,21 +485,18 @@ $GroupList[] = $g; $result->MoveNext(); } - $extra_groups = implode(",",$GroupList); - if($PrimaryGroup) - $extra_groups = $PrimaryGroup.",".$extra_groups; - if($PersonalGroup) - { - $this->Set("GroupId",$PersonalGroup); - //$extra_groups .= ",".$PersonalGroup; - } - else - { - $this->Set("GroupId",$PrimaryGroup); - } + + if($PrimaryGroup) array_unshift($GroupList, $PrimaryGroup); + array_push($GroupList, $objConfig->Get('User_LoggedInGroup') ); + + $extra_groups = implode(',', $GroupList); - $this->Set("GroupList", $extra_groups); - $this->Set("LastAccessed",date("U")); + $this->SetVariable('UserGroups', $extra_groups); + + $this->Set('GroupId', $PersonalGroup ? $PersonalGroup : $PrimaryGroup); + + $this->Set('GroupList', $extra_groups); + $this->Set('LastAccessed', date('U') ); $this_login = $this->GetPersistantVariable("ThisLogin"); $this->SetPersistantVariable("LastLogin", $this_login); $this->SetPersistantVariable("ThisLogin", time()); Index: trunk/admin/install/install_lib.php =================================================================== diff -u -r1867 -r2000 --- trunk/admin/install/install_lib.php (.../install_lib.php) (revision 1867) +++ trunk/admin/install/install_lib.php (.../install_lib.php) (revision 2000) @@ -15,17 +15,28 @@ function VersionSort($a, $b) { - if ($a == $b) { - return 0; + preg_match('/inportal_upgrade_v(.*).(php|sql)$/', $a, $rets); + $a_version = $rets[1]; + $a_extension = $rets[2]; + + preg_match('/inportal_upgrade_v(.*).(php|sql)$/', $b, $rets); + $b_version = $rets[1]; + $b_extension = $rets[2]; + + if($a_version == $b_version) // got PHP and SQL file for one version + { + if($a_extension == $b_extension) + { + return 0; + } + else + { + return ($a_extension == 'php') ? 1 : -1; + } } - else { - $tmp_a = str_replace("inportal_upgrade_v", "", $a); - $tmp_a = str_replace(".sql", "", $a); - - $tmp_b = str_replace("inportal_upgrade_v", "", $b); - $tmp_b = str_replace(".sql", "", $b); - - return (ConvertVersion($a) < ConvertVersion($b)) ? -1 : 1; + else + { + return (ConvertVersion($a_version) < ConvertVersion($b_version)) ? -1 : 1; } } @@ -36,22 +47,23 @@ $upgrades_arr = Array(); $version = ''; - while ($file = $dir->read()) { - if ($file != "." && $file != ".." && !is_dir($admindirname.$file)) { - if (strstr($file, 'inportal_upgrade_v')) { - $upgrades_arr[] = $file; - } + while($file = $dir->read()) + { + if ($file != "." && $file != ".." && !is_dir($admindirname.$file)) + { + if (strstr($file, 'inportal_upgrade_v')) $upgrades_arr[] = $file; } } - + usort($upgrades_arr, "VersionSort"); - foreach($upgrades_arr as $file) { - $file_tmp = str_replace("inportal_upgrade_v", "", $file); - $file_tmp = str_replace(".sql", "", $file_tmp); + foreach($upgrades_arr as $file) + { + preg_match('/inportal_upgrade_v(.*).(php|sql)$/', $file, $rets); + $a_version = $rets[1]; - if (ConvertVersion($file_tmp) > ConvertVersion($version)) { - $version = $file_tmp; + if (ConvertVersion($a_version) > ConvertVersion($version)) { + $version = $a_version; } } Index: trunk/admin/install/upgrades/inportal_upgrade_v1.1.1.sql =================================================================== diff -u --- trunk/admin/install/upgrades/inportal_upgrade_v1.1.1.sql (revision 0) +++ trunk/admin/install/upgrades/inportal_upgrade_v1.1.1.sql (revision 2000) @@ -0,0 +1,4 @@ +INSERT INTO ConfigurationAdmin VALUES ('User_LoggedInGroup', 'la_Text_General', 'la_users_loggedin_group', 'select', NULL, '0=lu_none,SELECT GroupId as OptionName, Name as OptionValue FROM PortalGroup WHERE Enabled=1 AND Personal=0', 3, 1); +INSERT INTO ConfigurationValues VALUES ('User_LoggedInGroup', '15', 'In-Portal:Users', 'in-portal:configure_users'); + +UPDATE Modules SET Version = '1.1.1' WHERE Name = 'In-Portal'; \ No newline at end of file Index: trunk/kernel/units/users/users_event_handler.php =================================================================== diff -u -r1977 -r2000 --- trunk/kernel/units/users/users_event_handler.php (.../users_event_handler.php) (revision 1977) +++ trunk/kernel/units/users/users_event_handler.php (.../users_event_handler.php) (revision 2000) @@ -37,7 +37,10 @@ if( $object->GetDBField('Status') == STATUS_ACTIVE ) { $sql = 'SELECT DISTINCT GroupId FROM '.TABLE_PREFIX.'UserGroup WHERE PortalUserId = '.$user_id; - if( $groups = $this->Conn->GetCol($sql) ) $this->Application->StoreVar( 'UserGroups', implode(',', $groups) ); + $groups = $this->Conn->GetCol($sql); + if(!$groups) $groups = Array(); + array_push($groups, $this->Application->ConfigValue('User_LoggedInGroup') ); + $this->Application->StoreVar( 'UserGroups', implode(',', $groups) ); if( $this->Application->CheckPermission('LOGIN',0) ) { Index: trunk/core/units/users/users_event_handler.php =================================================================== diff -u -r1977 -r2000 --- trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 1977) +++ trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 2000) @@ -37,7 +37,10 @@ if( $object->GetDBField('Status') == STATUS_ACTIVE ) { $sql = 'SELECT DISTINCT GroupId FROM '.TABLE_PREFIX.'UserGroup WHERE PortalUserId = '.$user_id; - if( $groups = $this->Conn->GetCol($sql) ) $this->Application->StoreVar( 'UserGroups', implode(',', $groups) ); + $groups = $this->Conn->GetCol($sql); + if(!$groups) $groups = Array(); + array_push($groups, $this->Application->ConfigValue('User_LoggedInGroup') ); + $this->Application->StoreVar( 'UserGroups', implode(',', $groups) ); if( $this->Application->CheckPermission('LOGIN',0) ) { Index: trunk/admin/install/upgrades/inportal_upgrade_v1.1.1.php =================================================================== diff -u --- trunk/admin/install/upgrades/inportal_upgrade_v1.1.1.php (revision 0) +++ trunk/admin/install/upgrades/inportal_upgrade_v1.1.1.php (revision 2000) @@ -0,0 +1,8 @@ +Add_Group('Everyone', 'Every logged-in user'); + + $inst_ado =& inst_GetADODBConnection(); + + $sql = 'UPDATE '.GetTablePrefix().'ConfigurationValues SET VariableValue = %s WHERE VariableName = '.$inst_ado->qstr('User_LoggedInGroup'); + $inst_ado->Execute( sprintf($sql, $group->UniqueId() ) ); +?> \ No newline at end of file Index: trunk/admin/install/inportal_data.sql =================================================================== diff -u -r1888 -r2000 --- trunk/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 1888) +++ trunk/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 2000) @@ -40,6 +40,7 @@ INSERT INTO ConfigurationAdmin VALUES ('Min_UserName', 'la_Text_General', 'la_text_min_username', 'text', '', '', 1, 0); INSERT INTO ConfigurationAdmin VALUES ('Min_Password', 'la_Text_General', 'la_text_min_password', 'text', '', '', 2, 0); INSERT INTO ConfigurationAdmin VALUES ('Email_As_Login', 'la_Text_General', 'la_use_emails_as_login', 'checkbox', NULL, NULL, 1, 0); +INSERT INTO ConfigurationAdmin VALUES ('User_LoggedInGroup', 'la_Text_General', 'la_users_loggedin_group', 'select', NULL, '0=lu_none,SELECT GroupId as OptionName, Name as OptionValue FROM PortalGroup WHERE Enabled=1 AND Personal=0', 3, 1); INSERT INTO ConfigurationValues VALUES ('Columns_Category', '2', 'In-Portal', 'Categories') INSERT INTO ConfigurationValues VALUES ('DomainSelect','1','In-Portal','in-portal:configure_general') @@ -155,6 +156,7 @@ INSERT INTO ConfigurationValues VALUES ('Search_MinKeyword_Length', '3', 'In-Portal', ''); INSERT INTO ConfigurationValues VALUES ('Users_AllowReset', '180', 'In-Portal:Users', 'in-portal:configure_users'); INSERT INTO ConfigurationValues VALUES ('Email_As_Login', '0', 'In-Portal:Users', 'in-portal:configure_users'); +INSERT INTO ConfigurationValues VALUES ('User_LoggedInGroup', '15', 'In-Portal:Users', 'in-portal:configure_users'); INSERT INTO Events VALUES (30, 'USER.ADD', 1, 0, 'In-Portal:Users', 'la_event_user.add', 0) INSERT INTO Events VALUES (32, 'USER.ADD', 2, 0, 'In-Portal:Users', 'la_event_user.add', 1) @@ -193,7 +195,7 @@ INSERT INTO ItemTypes VALUES (1, 'In-Portal', 'Category', 'Name', 'CreatedById', NULL, NULL, 'la_ItemTab_Categories', 1, 'admin/category/addcategory.php', 'clsCategory', 'Category'); INSERT INTO ItemTypes VALUES (6, 'In-Portal', 'PortalUser', 'Login', 'PortalUserId', NULL, NULL, '', 0, '', 'clsPortalUser', 'User'); -INSERT INTO Modules (Name, Path, Var, Version, Loaded, LoadOrder, TemplatePath, RootCat, BuildDate) VALUES ('In-Portal', 'kernel/', 'm', '1.1.0', 1, 0, '', 0, '1054738405'); +INSERT INTO Modules (Name, Path, Var, Version, Loaded, LoadOrder, TemplatePath, RootCat, BuildDate) VALUES ('In-Portal', 'kernel/', 'm', '1.1.1', 1, 0, '', 0, '1054738405'); INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('CATEGORY.VIEW', 'lu_PermName_Category.View_desc', 'lu_PermName_Category.View_error', 'In-Portal'); INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('CATEGORY.ADD', 'lu_PermName_Category.Add_desc', 'lu_PermName_Category.Add_error', 'In-Portal'); @@ -210,6 +212,7 @@ INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('FAVORITES', 'lu_PermName_favorites_desc', 'lu_PermName_favorites_error', 'In-Portal'); INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('SYSTEM_ACCESS.READONLY', 'la_PermName_SystemAccess.ReadOnly_desc', 'la_PermName_SystemAccess.ReadOnly_error', 'Admin'); +INSERT INTO PortalGroup VALUES (15, 'Everyone', 'Everyone', 0, 0, 0, 1, 15); INSERT INTO PortalGroup VALUES (13, 'Member', '', '1054738682', 0, 0, 1, 13); INSERT INTO PortalGroup VALUES (12, 'Subscribers', '', '1054738670', 0, 0, 1, 12); INSERT INTO PortalGroup VALUES (14, 'Guest', 'Guest User', '0', 1, 0, 1, 14);