Index: trunk/admin/install.php =================================================================== diff -u -r271 -r282 --- trunk/admin/install.php (.../install.php) (revision 271) +++ trunk/admin/install.php (.../install.php) (revision 282) @@ -349,10 +349,10 @@ else { $act = ''; - if (str_replace('.', '', $g_InPortal) >= 105) { + if (ConvertVersion($g_InPortal) >= ConvertVersion("1.0.5")) { $act = 'check'; } - $rfile = @fopen(GET_LICENSE_URL."?login=".md5($_POST['UserName'])."&password=".md5($_POST['UserPass'])."&action=$act&license_code=".base64_encode($g_LicenseCode)."&version=".str_replace('.', '', GetMaxPortalVersion($pathtoroot.$admin))."&domain=".base64_encode($_SERVER['SERVER_NAME']), "r"); + $rfile = @fopen(GET_LICENSE_URL."?login=".md5($_POST['UserName'])."&password=".md5($_POST['UserPass'])."&action=$act&license_code=".base64_encode($g_LicenseCode)."&version=".ConvertVersion(GetMaxPortalVersion($pathtoroot.$admin))."&domain=".base64_encode($_SERVER['SERVER_NAME']), "r"); if (!$rfile) { $login_err_mesg = "Unable to connect to the Intechnic server!"; $LoggedIn = false; @@ -447,20 +447,10 @@ $sql = "SELECT Name, Version FROM ".$g_TablePrefix."Modules"; $rs = $ado->Execute($sql); - //echo '
'.print_r($rs->GetRows(), true).''; - $i = 0; - + $i = 0; while ($rs && !$rs->EOF) { - $p = strtolower($rs->fields['Name']); - // $modules .= strtolower($rs->fields['Name']).','; - // $rs->MoveNext(); - // } - - // $mod_arr = explode(",", substr($modules, 0, strlen($modules) - 1)); - - // foreach($mod_arr as $p) - // { + $p = strtolower($rs->fields['Name']); if ($p == 'in-portal') { $p = ''; @@ -469,24 +459,20 @@ $dir_name = $pathtoroot.$p."/admin/install/upgrades/"; $dir = @dir($dir_name); - //echo "
"; print_r($dir); echo ""; while ($file = $dir->read()) { if ($file != "." && $file != ".." && !is_dir($dir_name.$file)) - { - $file = str_replace("inportal_upgrade_v", "", $file); - $file = str_replace(".sql", "", $file); - - if ($file != '' && !strstr($file, 'changelog') && !strstr($file, 'readme')) { + { + if (strstr($file, 'inportal_upgrade_v')) { + $file = str_replace("inportal_upgrade_v", "", $file); + $file = str_replace(".sql", "", $file); + $sql = "SELECT count(*) AS count FROM ".$g_TablePrefix."Modules WHERE Name = '".$rs->fields['Name']."' AND Version = '$file'"; $rs1 = $ado->Execute($sql); - if ($rs1->fields['count'] == 0 && str_replace('.', '', $file) > str_replace('.', '', $rs->fields['Version'])) { - //$sql = "SELECT Version FROM ".$g_TablePrefix."Modules WHERE Name = '".$p."'"; - //$rs2 = $ado->Execute($sql); + if ($rs1->fields['count'] == 0 && ConvertVersion($file) > ConvertVersion($rs->fields['Version'])) { if ($Modules[$i-1] == $rs->fields['Name']) { $Texts[$i-1] = $rs->fields['Name']." (".$rs->fields['Version']." ".prompt_language("la_to")." ".$file.")"; - //$Modules[] = $rs->fields['Name']; $i--; } else { @@ -532,22 +518,32 @@ $tmp2 = 0; while ($file = $dir->read()) { if ($file != "." && $file != ".." && !is_dir($dir_name.$file)) - { - $file = str_replace("inportal_upgrade_v", "", $file); - $file = str_replace(".sql", "", $file); - - if ($file != '' && !strstr($file, 'changelog') && !strstr($file, 'readme')) { - $tmp1 = str_replace(".", "", $file); + { + if (strstr($file, 'inportal_upgrade_v')) { + $file_tmp = str_replace("inportal_upgrade_v", "", $file); + $file_tmp = str_replace(".sql", "", $file); + + if (ConvertVersion($file_tmp) > ConvertVersion($current_version)) { + $filename = $pathtoroot.$mod_name."/admin/install/upgrades/$file"; + //echo "Trying Version: $try_version