Index: trunk/admin/images/toolbar/tool_import_language_f2.gif =================================================================== diff -u -N -r293 -r415 Binary files differ Index: trunk/admin/install.php =================================================================== diff -u -N -r410 -r415 --- trunk/admin/install.php (.../install.php) (revision 410) +++ trunk/admin/install.php (.../install.php) (revision 415) @@ -429,12 +429,12 @@ $Modules = array(); $Texts = array(); - if (str_replace('.', '', GetMaxPortalVersion($pathtoroot.$admin)) >= 105 && ($g_LicenseCode == '' && $g_License != '')) { + if (ConvertVersion(GetMaxPortalVersion($pathtoroot.$admin)) >= ConvertVersion("1.0.5") && ($g_LicenseCode == '' && $g_License != '')) { $state = 'reinstall'; $inst_error = "Your license must be updated before you can upgrade. Please don't use 'Existing License' option, instead either Download from Intechnic or Upload a new license file!"; } else { - $sql = "SELECT Name, Version FROM ".$g_TablePrefix."Modules"; + $sql = "SELECT Name, Version FROM ".$g_TablePrefix."Modules ORDER BY LoadOrder asc"; $rs = $ado->Execute($sql); @@ -485,8 +485,8 @@ if ($state == "upgrade_process") { $ado =& inst_GetADODBConnection(); - $mod_arr = $_POST['modules']; - + $mod_arr = $_POST['modules']; + foreach($mod_arr as $p) { $mod_name = strtolower($p); @@ -503,31 +503,38 @@ $dir_name = $pathtoroot.$mod_name."/admin/install/upgrades/"; $dir = @dir($dir_name); + $upgrades_arr = Array(); + $new_version = ''; - $tmp1 = 0; - $tmp2 = 0; while ($file = $dir->read()) { - if ($file != "." && $file != ".." && !is_dir($dir_name.$file)) { + if ($file != "." && $file != ".." && !is_dir($dir_name.$file)) { if (strstr($file, 'inportal_upgrade_v')) { - $file_tmp = str_replace("inportal_upgrade_v", "", $file); - $file_tmp = str_replace(".sql", "", $file_tmp); - - if (ConvertVersion($file_tmp) > ConvertVersion($current_version)) { - $filename = $pathtoroot.$mod_name."/admin/install/upgrades/$file"; - //echo "Running: $filename
"; - if(file_exists($filename)) - { - RunSQLFile($ado, $filename); - set_ini_value("Module Versions", $p, $try_version); - save_values(); - } + $upgrades_arr[] = $file; } - } - //$tmp2 = $tmp1; - } + } } + + usort($upgrades_arr, "VersionSort"); + + foreach($upgrades_arr as $file) { + $file_tmp = str_replace("inportal_upgrade_v", "", $file); + $file_tmp = str_replace(".sql", "", $file_tmp); + + if (ConvertVersion($file_tmp) > ConvertVersion($current_version)) { + $filename = $pathtoroot.$mod_name."/admin/install/upgrades/$file"; + //echo "Running: $filename
"; + if(file_exists($filename)) + { + RunSQLFile($ado, $filename); + } + } + } + + set_ini_value("Module Versions", $p, GetMaxPortalVersion($pathtoroot.$mod_name."/admin/")); + save_values(); } - $state = 'languagepack_upgrade'; + + $state = 'languagepack_upgrade'; } // upgrade language pack @@ -1104,6 +1111,12 @@ } if ($state == "finish") { + $ado =& inst_GetADODBConnection(); + $PhraseTable = GetTablePrefix()."ImportPhrases"; + $EventTable = GetTablePrefix()."ImportEvents"; + $ado->Execute("DROP TABLE IF EXISTS $PhraseTable"); + $ado->Execute("DROP TABLE IF EXISTS $EventTable"); + $include_file = $pathtoroot.$admin."/install/install_finish.php"; } Index: trunk/kernel/include/usersession.php =================================================================== diff -u -N -r402 -r415 --- trunk/kernel/include/usersession.php (.../usersession.php) (revision 402) +++ trunk/kernel/include/usersession.php (.../usersession.php) (revision 415) @@ -669,15 +669,15 @@ if(strlen($GroupList) && $GroupList !="0") { $this->SysPermCache = array(); - $sql = "SELECT * FROM ".GetTablePrefix()."Permissions WHERE Type=1 AND PermissionValue=1 AND GroupId IN (".$GroupList.")"; + $sql = "SELECT * FROM ".GetTablePrefix()."Permissions WHERE Type=1 AND GroupId IN (".$GroupList.")"; //echo $sql."
\n"; $rs = $this->adodbConnection->Execute($sql); while($rs && !$rs->EOF) { $val = $rs->fields["PermissionValue"]; - if($val==1) - $this->SysPermCache[$rs->fields["Permission"]] = 1; + //if($val==1) + $this->SysPermCache[$rs->fields["Permission"]] = $val; $PermList[] = $rs->fields["Permission"]; $rs->MoveNext(); } Index: trunk/admin/images/toolbar/tool_import_language_f3.gif =================================================================== diff -u -N -r293 -r415 Binary files differ Index: trunk/admin/install/install_lib.php =================================================================== diff -u -N -r383 -r415 --- trunk/admin/install/install_lib.php (.../install_lib.php) (revision 383) +++ trunk/admin/install/install_lib.php (.../install_lib.php) (revision 415) @@ -13,25 +13,48 @@ return true; } +function VersionSort($a, $b) +{ + if ($a == $b) { + return 0; + } + 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; + } +} + function GetMaxPortalVersion($admindirname) { $dir = @dir($admindirname.'/install/upgrades'); + $upgrades_arr = Array(); + $version = ''; while ($file = $dir->read()) { - if ($file != "." && $file != ".." && !is_dir($admindirname.$file)) - { + if ($file != "." && $file != ".." && !is_dir($dir_name.$file)) { if (strstr($file, 'inportal_upgrade_v')) { - $file = str_replace("inportal_upgrade_v", "", $file); - $file = str_replace(".sql", "", $file); - - if (ConvertVersion($file) > ConvertVersion($version)) { - $version = $file; - } + $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); + + if (ConvertVersion($file_tmp) > ConvertVersion($current_version)) { + $version = $file_tmp; + } + } + return $version; } @@ -121,7 +144,7 @@ $sql = ereg_replace($what, $replace, $sql); $what = "DROP TABLE "; - $replace = "DROP TABLE ".$g_TablePrefix; + $replace = "DROP TABLE IF EXISTS ".$g_TablePrefix; $sql = ereg_replace($what, $replace, $sql); $what = "INSERT INTO "; @@ -280,8 +303,9 @@ if(count($AllSql)>0) RunSQLText($ado,$AllSql); return (int)$FileOffset; -} +} + function inst_keyED($txt,$encrypt_key) { $encrypt_key = md5($encrypt_key); Index: trunk/globals.php =================================================================== diff -u -N -r407 -r415 --- trunk/globals.php (.../globals.php) (revision 407) +++ trunk/globals.php (.../globals.php) (revision 415) @@ -1375,14 +1375,13 @@ // functions for dealign with enviroment variable construction function GenerateModuleEnv($prefix, $var_list) -{ +{ // globalize module varible arrays $main =& $GLOBALS[$prefix.'_var_list']; $update =& $GLOBALS[$prefix.'_var_list_update']; - //echo "VAR: [$main]; VAR_UPDATE: [$update]
"; - // enshure that we have no empty values in enviroment variable + // ensure that we have no empty values in enviroment variable foreach($update as $vl_key => $vl_value) if(!$vl_value) $update[$vl_key] = '0'; // unset($update[$vl_key]); @@ -1405,6 +1404,7 @@ // (used in module parsers to build env string) $main =& $GLOBALS[$prefix.'_var_list']; $update =& $GLOBALS[$prefix.'_var_list_update']; + return isset($update[$name]) ? $update[$name] : ( isset($main[$name]) ? $main[$name] : ''); } Index: trunk/kernel/include/portaluser.php =================================================================== diff -u -N -r402 -r415 --- trunk/kernel/include/portaluser.php (.../portaluser.php) (revision 402) +++ trunk/kernel/include/portaluser.php (.../portaluser.php) (revision 415) @@ -170,7 +170,7 @@ { global $objGroups; - $GroupList = $this->GetGroupList(); + $GroupList = $this->GetGroupList(); for($i=0;$iGetItem($GroupList[$i]); Index: trunk/admin/images/toolbar/tool_import_language.gif =================================================================== diff -u -N -r293 -r415 Binary files differ Index: trunk/admin/install/inportal_remove.sql =================================================================== diff -u -N -r325 -r415 --- trunk/admin/install/inportal_remove.sql (.../inportal_remove.sql) (revision 325) +++ trunk/admin/install/inportal_remove.sql (.../inportal_remove.sql) (revision 415) @@ -100,5 +100,9 @@ # -------------------------------------------------------- DROP TABLE ImportScripts # -------------------------------------------------------- +DROP TABLE ImportPhrases +# -------------------------------------------------------- +DROP TABLE ImportEvents +# -------------------------------------------------------- DROP TABLE EmailLog # \ No newline at end of file Index: trunk/kernel/include/portalgroup.php =================================================================== diff -u -N -r402 -r415 --- trunk/kernel/include/portalgroup.php (.../portalgroup.php) (revision 402) +++ trunk/kernel/include/portalgroup.php (.../portalgroup.php) (revision 415) @@ -31,7 +31,7 @@ function HasSystemPermission($PermissionName) - { + { $GroupId = $this->Get("GroupId"); $sql = "SELECT * FROM ".GetTablePrefix()."Permissions WHERE GroupId=$GroupId AND Permission='$PermissionName' AND type=1"; $result = $this->adodbConnection->Execute($sql); Index: trunk/kernel/include/modules.php =================================================================== diff -u -N -r402 -r415 --- trunk/kernel/include/modules.php (.../modules.php) (revision 402) +++ trunk/kernel/include/modules.php (.../modules.php) (revision 415) @@ -153,6 +153,7 @@ $env = $sessionkey; } $env .= "-"; + if (isset($var_list_update["t"])) { if($var_list_update["t"]=="_referer_") @@ -182,6 +183,7 @@ } $env .= $t; } + if(is_array($mod_prefix)) { foreach($mod_prefix as $key => $value) Index: trunk/kernel/action.php =================================================================== diff -u -N -r407 -r415 --- trunk/kernel/action.php (.../action.php) (revision 407) +++ trunk/kernel/action.php (.../action.php) (revision 415) @@ -2109,6 +2109,7 @@ //echo "==== BEGIN ====
"; $has_perm = $objSession->HasSystemPermission("SYSTEM_ACCESS.READONLY"); //echo "PortalUserID: [".$objSession->Get("PortalUserId")."]
"; +//print_pre($objSession); //echo "PermSet: [".$has_perm."]
"; if( !$has_perm )