- vafonseca escreveu:
- FabioRK escreveu:
- Sim. O seu ocomon é o original ou você já tem ele customizado?
Fabio Original tenho voce no skype posso falar PM?
<?php session_start();
/* Copyright 2005 Flávio Ribeiro
This file is part of OCOMON.
OCOMON is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
OCOMON is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
include ("../../includes/include_geral.inc.php");
include ("../../includes/include_geral_II.inc.php");
$auth = new auth;
$auth->testa_user_hidden($_SESSION['s_usuario'],$_SESSION['s_nivel'],$_SESSION['s_nivel_desc'],4);
$qry_config = "SELECT * FROM config ";
$exec_config = mysql_query($qry_config) or die (TRANS('ERR_QUERY'));
$row_config = mysql_fetch_array($exec_config);
$qryarea = "SELECT * FROM sistemas WHERE sis_id = ".$_SESSION['s_area']."";
$execarea = mysql_query($qryarea);
$rowarea = mysql_fetch_array($execarea);
$qry = $QRY["useropencall_custom"];
$execqry = mysql_query($qry);
$rowconf = mysql_fetch_array($execqry);
/* EDT 17.01.12 FRK - Inclusão de campo Aberto por, para abrir chamado em nome de outro usuário*/
$qryconfglobal = $QRY["useropencall_custom"];
$qryconfglobal .= " and c.conf_cod = ";// + $rowarea['sis_screen'];
$qryconfglobal .= $rowarea['sis_screen'];
$execqryglobal = mysql_query($qryconfglobal);
$rowconf_global = mysql_fetch_array($execqryglobal);
print "<form name='comment' id='form' method='POST' action='".$_SERVER['PHP_SELF']."' enctype='multipart/form-data'>";
//print "<form name='form1' action='".$_SERVER['PHP_SELF']."' method='post' >";
print "<table border='0' align='center' width='100%' bgcolor='".BODY_COLOR."'>";
$urlid = "";
$cod = "";
if (isset($_GET['urlid'])){
$urlid = $_GET['urlid'];
} else
$urlid = "";
if (isset($_GET['numero'])){
$cod = $_GET['numero'];
} else
$cod = "";
if (!isset($_POST['submit'])){
print "<tr>";
print "<td width='20%' align='left' bgcolor='".TD_COLOR."'>".TRANS('FIELD_NESTING').":</td>";
print "<td width='80%' align='left' bgcolor='".BODY_COLOR."'><textarea id='idAssentamento' class='textarea' name='assentamento'></textarea></td>";
print "</tr>";
/* ----------------- INICIO ALTERACAO ----------------- */
print "<tr>";
print "<td colspan='4'>";
//if ((!empty($rowconf) && $rowconf['conf_scr_upload']) || empty($rowconf)) {
if ($rowconf_global['conf_scr_upload']) {
for($i=1;$i<=$row_config['conf_qtd_max_anexos']; $i++){
$estilo = 'width: 100%; margin: 0; height: 20px; margin-bottom: 2px;';
if($i > 1)
$estilo .= " display: none;";
print "<div id='tr_anexo_".$i."' style=\"".$estilo."\">";
//print "<tr id='tr_anexo_$i' $estilo>";
print "<div style=\"width: 20%; height: 100%; background-color: ".TD_COLOR."; float: left; margin: 0;\">".TRANS('OCO_FIELD_ATTACH_FILE','Anexar arquivo').":</div>";
print "<div style=\"width: 70%; background-color: ".BODY_COLOR."; float: left; margin-left: 2px;\">";
print " <input type='file' class='anexo' name='anexo_".$i."' id='id_anexo_".$i."' ></input>";
if ($i != $row_config['conf_qtd_max_anexos']){
print "<a id='link_adic_".$i."'
onclick=\"
javascript:document.getElementById('tr_anexo_".($i+1)."').style.display='block';
document.getElementById('link_adic_".($i)."').style.display='none';\">";
// ".TRANS('ATTACH_ANOTHER')."</a>";
print "<img align='absmiddle' src='".ICONS_PATH."add.png' title='".TRANS('ATTACH_ANOTHER')."'/></a>";
}
print "</div>";
print "</div>";
}
}
print "</td>";
print "</tr>";
print "</table>";
/* ----------------- FIM ALTERACAO ----------------- */
print "<table border='0' align='center' width='100%' bgcolor='".BODY_COLOR."'>";
print "<input type='hidden' name='numero' value='".$cod."'>";
print "<input type='hidden' name='urlid' value='".$urlid."'>";
print "<tr>";
print "<td align='center' bgcolor='".BODY_COLOR."'>";
print "<input type='submit' class='button' name='submit' value='".TRANS('BT_CAD')."'></td>";
print "<td align='center' bgcolor='".BODY_COLOR."'>";
print "<input type='reset' class='button' value='".TRANS('BT_CANCEL')."' onClick='javascript:history.back()' name='cancelar'></td>";
print "</tr>";
print "</table>";
print "</form>";
}
if (isset($_POST['submit']) && $_POST['submit'] == TRANS('BT_CAD')) {
if (!empty($_POST['assentamento'])) {
/* TESTE DO ANEXO */
/* ----------------- INICIO ALTERACAO ----------------- */
$gravaImg = false;
$qryConf = "SELECT * FROM config";
$execConf = mysql_query($qryConf) or die (TRANS('ERR_QUERY').", A TABELA CONF FOI CRIADA?");
$rowConf = mysql_fetch_array($execConf);
$arrayConf = array();
$arrayConf = montaArray($execConf,$rowConf);
for($i=1;$i<=$row_config['conf_qtd_max_anexos']; $i++) {
$nomeAnexo = 'anexo_'.$i;
if (isset($_FILES[$nomeAnexo]) and $_FILES[$nomeAnexo]['name']!="") {
$upld = upload($nomeAnexo,$arrayConf,$rowConf['conf_upld_file_types']);
if ($upld =="OK") {
$gravaImg[$i] = true;
} else {
$gravaImg[$i] = false;
$upld.="<br><a align='center' onClick=\"exibeEscondeImg('idAlerta');\"><img src='".ICONS_PATH."/stop.png' width='16px' height='16px'> ".TRANS('LINK_CLOSE','Fechar')."</a>";
print "</table>";
print "<div class='alerta' id='idAlerta'><table bgcolor='#999999'><tr><td colspan='2' bgcolor='yellow'>".$upld."</td></tr></table></div>";
exit;
}
}
}
/* ----------------- FIM ALTERACAO ----------------- */
/* ----------------- INICIO ALTERACAO ----------------- */
for($i=1;$i<=$row_config['conf_qtd_max_anexos']; $i++){
if ($gravaImg[$i]) {
$nomeAnexo = 'anexo_'.$i;
//INSERSAO DO ARQUIVO NO BANCO
$fileinput=$_FILES[$nomeAnexo]['tmp_name'];
$tamanho = getimagesize($fileinput);
$tamanho2 = filesize($fileinput);
if(chop($fileinput)!=""){
// $fileinput should point to a temp file on the server
// which contains the uploaded image. so we will prepare
// the file for upload with addslashes and form an sql
// statement to do the load into the database.
$image = addslashes(fread(fopen($fileinput,"r"), 1000000));
$SQL = "INSERT INTO imagens (img_nome, img_oco, img_tipo, img_bin, img_largura, img_altura, img_size) VALUES ".
"('".noSpace($_FILES[$nomeAnexo]['name'])."',".$_POST['numero'].", '".$_FILES[$nomeAnexo]['type']."', ".
"'".$image."', '".$tamanho[0]."', '".$tamanho[1]."', '".$tamanho2."')";
// now we can delete the temp file
unlink($fileinput);
} /*else {
echo "".TRANS('MSG_NOT_IMAGE_SELECT')."";
exit;
}*/
$exec = mysql_query($SQL) or die (TRANS('ERR_QUERY')."</br>".$SQL);
if ($exec == 0)
$aviso.= TRANS('MSG_ATTACH_IMAGE')."<br>";
}
}
/* ----------------- FIM ALTERACAO ----------------- */
$queryA = "INSERT INTO assentamentos (ocorrencia, assentamento, data, responsavel, asset_privated)".
" VALUES (".$_POST['numero'].",";
if ($_SESSION['s_formatBarOco']) {
$queryA.= " '".$_POST['assentamento']."',";
} else {
$queryA.= " '".noHtml($_POST['assentamento'])."',";
}
$queryA.=" '".date('Y-m-d H:i:s')."', ".$_SESSION['s_uid'].", 0)";
$exec = mysql_query($queryA) or die (TRANS('ERR_QUERY')."</br>".$queryA);
/* ENVIO DE EMAIL */
$sqlMailLogado = "SELECT * FROM usuarios WHERE login = '".$_SESSION['s_usuario']."'";
$execMailLogado = mysql_query($sqlMailLogado) or die(TRANS('MSG_ERR_RESCUE_INFO_USER'));
$rowMailLogado = mysql_fetch_array($execMailLogado);
$qryfull = $QRY["ocorrencias_full_ini"]." WHERE o.numero = ".$_POST['numero']."";
$execfull = mysql_query($qryfull) or die(TRANS('MSG_ERR_RESCUE_VARIA_SURROU').$qryfull);
$rowfull = mysql_fetch_array($execfull);
$VARS = array();
$VARS['%numero%'] = $rowfull['numero'];
$VARS['%usuario%'] = $rowfull['contato'];
$VARS['%contato%'] = $rowfull['contato'];
$VARS['%descricao%'] = $rowfull['descricao'];
$VARS['%setor%'] = $rowfull['setor'];
$VARS['%ramal%'] = $rowfull['telefone'];
$VARS['%assentamento%'] = $_POST['assentamento'];
$VARS['%site%'] = "<a href='".$row_config['conf_ocomon_site']."'>".$row_config['conf_ocomon_site']."</a>";
$VARS['%area%'] = $rowfull['area'];
$VARS['%operador%'] = $rowfull['nome'];
$VARS['%editor%'] = $rowMailLogado['nome'];
//$VARS['%editor%'] = $_SESSION['s_nome'];
$VARS['%aberto_por%'] = $rowfull['aberto_por'];
$VARS['%problema%'] = $rowfull['problema'];
$VARS['%versao%'] = VERSAO;
$sqlMailArea = "SELECT * FROM sistemas WHERE sis_id = ".$rowfull['area_cod']."";
$execMailArea = mysql_query($sqlMailArea);
$rowMailArea = mysql_fetch_array($execMailArea);
$qryconfmail = "SELECT * FROM mailconfig";
$execconfmail = mysql_query($qryconfmail) or die (TRANS('ERR_QUERY'));
$rowconfmail = mysql_fetch_array($execconfmail);
//if (isset($_POST['mailAR']) || isIn($_SESSION['s_area'],$rowconf['conf_custom_areas'])) {
$event = 'edita-para-area';
$qrymsg = "SELECT * FROM msgconfig WHERE msg_event like ('".$event."')";
$execmsg = mysql_query($qrymsg) or die(TRANS('ERR_QUERY'));
$rowmsg = mysql_fetch_array($execmsg);
send_mail($event, $rowMailArea['sis_email'], $rowconfmail, $rowmsg, $VARS, $rowfull['area_cod']);
//}
print "<script>redirect('mostra_consulta.php?numero=".$_POST['numero']."&id=".$_POST['urlid']."');</script>";
}
else {
print "<script>alert('O campo [ Comentário ] deve ser preenchido!')</script>";
exit;
}
}
?>