示例#1
0
 public static function Decod_Header($variable, $charset_conv = "utf-8")
 {
     $decod = imap_mime_header_decode($variable);
     if (array_key_exists(0, $decod)) {
         if ($decod[0]->charset == "default") {
             $subject = $variable;
         } else {
             if ($decod[0]->text != "") {
                 $subject = Charset::CambiaCharset($decod[0]->text, $decod[0]->charset, $charset_conv);
             }
         }
     } else {
         $subject = $variable;
     }
     return $subject;
 }
示例#2
0
 public static function Inserta_Actualiza_Registros($conexion, $tabla, $registros, $parametros, $seleccion, $codif_fte = 'CP850', $codif_dest = 'UTF-8')
 {
     foreach ($registros as $r) {
         $linea_sel = array();
         $linea_ins = array();
         $linea_upd = array();
         foreach ($parametros as $k => $p) {
             $linea_upd[$k] = strcmp(substr($p, 0, 1), ':') ? Charset::CambiaCharset($r[$p], $codif_fte, $codif_dest) : substr($p, 1, strlen($p) - 1);
         }
         foreach ($seleccion as $k => $p) {
             $linea_sel[$k] = strcmp(substr($p, 0, 1), ':') ? Charset::CambiaCharset($r[$p], $codif_fte, $codif_dest) : substr($p, 1, strlen($p) - 1);
         }
         $linea_ins = array_merge($linea_sel, $linea_upd);
         try {
             Conexion::Inserta_Registro($conexion, $tabla, $linea_ins);
         } catch (Exception $e) {
             Conexion::Actualiza_Registro($conexion, $tabla, $linea_upd, $linea_sel);
         }
     }
 }