$line) { $line_trim = trim($line); $str_define = strpos($line_trim, 'define("'); if ($str_define === false || $str_define != 0) continue; $line_temp = str_replace('define(', '', $line_trim); $line_temp = str_replace(');', '', $line_temp); $matches = explode(",", $line_temp); $constant = $matches[0]; $padding = $matches[1]; $constant = str_replace('"', "", $constant); json_decode(substr($str_replace, 1, -1)); if (json_last_error() == 0) { $data['key'] = 'file_uploads'; $config = new AstraConfig(); if($config->get_config($data)){ $data['value'] = ""; $config->delete_config($data); $data['value'] = json_decode(substr($str_replace, 1, -1)); $data['autoload'] = 1; $config->add_config($data); }else{ $data['value'] = json_decode(substr($str_replace, 1, -1)); $data['autoload'] = 1; $config->add_config($data); } }else{ if ($constant == $str_constant) { $config_file[$line_num] = 'define("' . $constant . '", ' . $str_replace . ');' . "\r\n"; break; } else { } } } $handle = fopen($path_to_astra_config, 'w'); foreach ($config_file as $line) { fwrite($handle, rtrim($line) . "\r\n"); } fclose($handle); chmod($path_to_astra_config, 0666); return TRUE; } }