".$lang['admin']['incs']['error_editing'].""; } if (count($new) < 1){ return ""; exit; } // add old config vars not in $new array if(is_array($prevArray)){ foreach($prevArray as $key => $value) { if($new[$key]!==$prevArray[$key]){ $value = preg_replace("/\r/", "" , $value); $newConfig[$key] = $value; } } } // build new config vars from $new array foreach($new as $key => $value) { $value = preg_replace("/\r/", "" , $value); $newConfig[$key] = $value; } @chmod($path,0777); @rename($path, $path.".bak"); @chmod($path.".bak", 0644); $content = " $value){ // strip quotes if already in $value = str_replace(array("\'","'"),"'",$value); if (!get_magic_quotes_gpc()) { $value = addslashes($value); } $content .= "\$".$arrayName."['".$key."'] = '".$value."';\n"; } $content .= "?>"; if($handle = @fopen($path, "w")){ fwrite($handle, $content, strlen($content)); fclose($handle); $msg = "".$lang['admin']['incs']['config_updated'].""; $returnVal = TRUE; } else { $msg = "
".sprintf($lang['admin']['incs']['cant_write'],$path)."
"; $returnVal = FALSE; } @chmod($path,0644); if($output == TRUE){ return $msg; } else { return $returnVal; } } function writeDbConf($new = "", $confName, $prevArray, $output = TRUE) { global $lang, $db, $glob; if (!is_array($new)){ $msg = "
".$lang['admin']['incs']['error_editing']."
"; } if (count($new) < 1){ return ""; exit; } // add old config vars not in $new array if(is_array($prevArray)){ foreach($prevArray as $key => $value) { if($new[$key]!==$prevArray[$key]){ $newConfig[$key] = $value; } } } // build new config vars from $new array if(is_array($new)){ foreach($new as $key => $value) { $newConfig[$key] = $value; } } // serialise the array for DB storage bas64 encode to stop serialize bug foreach($newConfig as $key => $value) { $value = str_replace(array("\'","'"),"'",$value); $newConfigBase64[base64_encode($key)] = base64_encode($value); } $configText = serialize($newConfigBase64); // see if database config exists $result = $db->numrows("SELECT * FROM ".$glob['dbprefix']."CubeCart_config WHERE name = ".$db->mySQLSafe($confName)); if($result>0){ $array['array'] = $db->mySQLSafe($configText); $store = $db->update($glob['dbprefix']."CubeCart_config",$array,"name = ".$db->mySQLSafe($confName)); } else { $array['name'] = $db->mySQLSafe($confName); $array['array'] = $db->mySQLSafe($configText); $store = $db->insert($glob['dbprefix']."CubeCart_config",$array); } if($store == TRUE){ $msg = "".$lang['admin']['incs']['db_config_updated'].""; $returnVal = TRUE; } else { $msg = "
".sprintf($lang['admin']['incs']['db_cant_write'],$path)."
"; $returnVal = FALSE; } if($output == TRUE){ return $msg; } else { return $returnVal; } } function jsGeoLocation($countryVar, $countyVar, $nullText){ global $config, $db, $lang, $glob; // get iso counties $isoCounties = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_iso_counties"); $jsScript = ""; return $jsScript; } ?>