require "proteger.php"; extract(recupera($_REQUEST, 1)); $return = empty($retorno) || !isset($retorno) ? $tipo : $retorno; $referer = $_SESSION['referer']; if(!empty($tipo)){ criaPasta("../arquivos", "config"); $types = "JPG|JPEG|GIF|PNG|BMP|ICO|MP3|PDF"; $pasta = "../arquivos/config"; $imagem = $arquivoatual; if(is_array($texto)){ $out = array(); $c = 0; foreach($texto as $i => $v){ if(is_array($v)){ if($setIndice){ $out[$i] = utf8_encode_array($v); }else{ $out[$c] = utf8_encode_array($v); $c++; } }else{ if(!is_numeric($i)){ $out[$i] = _rtrim($v); }else{ $out[] = _rtrim($v); } } } $texto = base64_encode_json($out); } if($foto_recorte == "1") $arqArquivo = sendImagem($pasta, "arquivo", 1, 0, $foto_largura, $imagem); else $arqArquivo = sendArquivo("arquivo", $types, $pasta, $imagem, 1); //verifica se existe este tipo, se nao, cria o mesmo $rows = count(getDadosList("SELECT id FROM {$db_table_config} WHERE tipo = '$tipo' LIMIT 1")); if($rows == 0) execSQL("INSERT INTO {$db_table_config} SET tipo = '$tipo'"); if($codify == "1") $texto = md5($texto); $sql = "UPDATE {$db_table_config} SET titulo = '$titulo', texto = '$texto', arquivo = '$arqArquivo' WHERE tipo = '$tipo'"; if(execSQL($sql)){ if(!empty($arqArquivo)){ jQuery(" $('.content#".$tipo."').find('input[name=arquivoatual]').val('{$arqArquivo}'); "); } if($reload_page) reload($_SERVER['HTTP_REFERER']); die(PROCESSADO); }else{ die(ERROR); } }elseif($funcao == "excluiImagem"){ $out = array(); $out['status'] = 0; if(empty($arquivo)) die(json_encode($out)); $sql = "UPDATE {$db_table_config} SET arquivo = '' WHERE arquivo = '$arquivo' LIMIT 1"; if(execSQL($sql)){ deleta("../arquivos/config/".$arquivo); $out['status'] = 1; die(json_encode($out)); }else{ die(ERROR); } }elseif($funcao == "referer"){ $referer = $_REQUEST['referer']; $_SESSION['referer'] = $referer; }else{ die(VOLTA); }