sincronizando con el master

This commit is contained in:
Hacky Purple 2018-07-05 15:55:58 -05:00
commit dd1f91a8b2
457 changed files with 426 additions and 133809 deletions

244
index.php
View File

@ -15,7 +15,7 @@ if(isset($_REQUEST['debug'])) {ini_set('display_errors', 'On');}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head > <head >
<meta http-equiv="Cache-control" content="public"> <meta http-equiv="Cache-control" content="public">
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="user-scalable=no, width=device-width, maximum-scale=1, initial-scale=1"> <meta name="viewport" content="user-scalable=no, width=device-width, maximum-scale=1, initial-scale=1">
@ -77,8 +77,8 @@ $librerias_pie ="";
/// k= suite /// k= suite
/// l= Listado /// l= Listado
/// m = checklist /// m = checklist
/// n=notas /// n=notas
/// o=parallax /// o=parallax
/// p= Planilla /// p= Planilla
/// s= SET DE DATOS * /// s= SET DE DATOS *
@ -130,10 +130,10 @@ $presentacion_cabeza = "
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src='lib/js/html5shiv.js'></script> <script src='lib/js/html5shiv.js'></script>
<![endif]--> <![endif]-->
"; ";
$presentacion_pie=" $presentacion_pie="
<script src='librerias/reveal/lib/js/head.min.js'></script> <script src='librerias/reveal/lib/js/head.min.js'></script>
<script src='librerias/reveal/js/reveal.js'></script> <script src='librerias/reveal/js/reveal.js'></script>
@ -160,11 +160,11 @@ $presentacion_pie="
] ]
}); });
</script> </script>
"; ";
if ($variable !=''){ if ($variable !=''){
if($v[0] =='e') { if($v[0] =='e') {
/// e = EMPRESA /// e = EMPRESA
$id_empresa = $v[1]; $id_empresa = $v[1];
@ -177,7 +177,7 @@ if ($variable !=''){
"; ";
if($titulo[0] !="") { if($titulo[0] !="") {
$logo = remplacetas('empresa','id',"$id_empresa",'imagen','') ; $logo = remplacetas('empresa','id',"$id_empresa",'imagen','') ;
$descripcion = remplacetas('empresa','id',"$id_empresa",'slogan','') ; $descripcion = remplacetas('empresa','id',"$id_empresa",'slogan','') ;
//$background_imagen = buscar_imagen('',"","","$id_empresa"); //$background_imagen = buscar_imagen('',"","","$id_empresa");
$background_imagen = remplacetas('empresa','id',"$id_empresa",'imagen','') ; $background_imagen = remplacetas('empresa','id',"$id_empresa",'imagen','') ;
@ -188,7 +188,7 @@ if ($variable !=''){
$vista_favorita = vista_favorita($pagina_inicio_definida[0]); $vista_favorita = vista_favorita($pagina_inicio_definida[0]);
//$set= $pagina_inicio_definida[0]; //$set= $pagina_inicio_definida[0];
$onload = "<script type=\"text/javascript\">window.location.href='$vista_favorita';</script> "; $onload = "<script type=\"text/javascript\">window.location.href='$vista_favorita';</script> ";
} }
$acceso = 1; $acceso = 1;
$menu =" $menu ="
<div class='col-sm-3 col-lg-2 hidden-xs hidden-sm' id='caja_lateral_derecha'> <div class='col-sm-3 col-lg-2 hidden-xs hidden-sm' id='caja_lateral_derecha'>
@ -198,7 +198,7 @@ if ($variable !=''){
</div>"; </div>";
$cols_interior ="10"; $cols_interior ="10";
}else { }else {
$onload = "<script type=\"text/javascript\">location.href='404';</script> "; $onload = "<script type=\"text/javascript\">location.href='404';</script> ";
} }
} }
elseif($v[0] =='b') { elseif($v[0] =='b') {
@ -220,7 +220,7 @@ if ($variable !=''){
<script src='./librerias/bootstrap-toc/bootstrap-toc.min.js'></script> <script src='./librerias/bootstrap-toc/bootstrap-toc.min.js'></script>
"; ";
$orden=""; $orden="";
$menu ="</div> $menu ="</div>
<div class='col-sm-2 hidden-xs hidden-sm' id='caja_lateral_derecha'> <div class='col-sm-2 hidden-xs hidden-sm' id='caja_lateral_derecha'>
<div class='container'> <div class='container'>
@ -231,7 +231,7 @@ if ($variable !=''){
$cols_interior ="10"; $cols_interior ="10";
//$onload = landingpage_contenido_formulario($set); //$onload = landingpage_contenido_formulario($set);
$publico = remplacetas('form_id','id',"$set",'publico',"") ; $publico = remplacetas('form_id','id',"$set",'publico',"") ;
if($publico[0] =='1' OR $_SESSION['id_empresa'] == $id_empresa ) {$acceso = 1;} if($publico[0] =='1' OR $_SESSION['id_empresa'] == $id_empresa ) {$acceso = 1;}
} }
elseif($v[0] =='s') { elseif($v[0] =='s') {
/// s= SET DE DATOS /// s= SET DE DATOS
@ -246,9 +246,9 @@ if ($variable !=''){
$uri_set = ""; $uri_set = "";
//$onload = landingpage_contenido_formulario($set); //$onload = landingpage_contenido_formulario($set);
//$onload = "".consultar_contenido_formulario("$set",'5','','','',"$plantilla").""; //$onload = "".consultar_contenido_formulario("$set",'5','','','',"$plantilla")."";
$publico = remplacetas('form_id','id',"$set",'publico',"") ; $publico = remplacetas('form_id','id',"$set",'publico',"") ;
if($publico[0] =='1' OR $_SESSION['id_empresa'] == $id_empresa ) {$acceso = 1;} if($publico[0] =='1' OR $_SESSION['id_empresa'] == $id_empresa ) {$acceso = 1;}
//$acceso=1; //$acceso=1;
} }
elseif($v[0] =='S') { elseif($v[0] =='S') {
@ -276,7 +276,7 @@ if ($variable !=''){
$empresa = remplacetas('form_id','id',"$set",'id_empresa',"") ; $empresa = remplacetas('form_id','id',"$set",'id_empresa',"") ;
$logo = remplacetas('empresa','id',"$id_empresa[0]",'imagen','') ; $logo = remplacetas('empresa','id',"$id_empresa[0]",'imagen','') ;
$id_empresa = $empresa[0]; $id_empresa = $empresa[0];
if(strlen($identificador) > 32) { if(strlen($identificador) > 32) {
$identificador_original= $identificador; $identificador_original= $identificador;
$key = substr($identificador, 32, $length = 40); $key = substr($identificador, 32, $length = 40);
@ -350,15 +350,15 @@ if ($variable !=''){
//$onload = formulario_embebido_ajax($form[0],'$identificador','edit'); //$onload = formulario_embebido_ajax($form[0],'$identificador','edit');
$librerias_cabeza =" $librerias_cabeza ="
<script src='./librerias/summernote/summernote.js'></script> <script src='./librerias/summernote/summernote.js'></script>
<link href='./librerias/summernote/summernote.css' rel='stylesheet'> <link href='./librerias/summernote/summernote.css' rel='stylesheet'>
"; ";
$librerias_pie =" $librerias_pie ="
<script type='text/javascript'> <script type='text/javascript'>
//// wysiwyg //// wysiwyg
var edit = function() { var edit = function() {
$('.wysiwyg').summernote({height: 250, codemirror: { theme: 'default' },dialogsInBody: true, toolbar: $('.wysiwyg').summernote({height: 250, codemirror: { theme: 'default' },dialogsInBody: true, toolbar:
[ [
['style', ['bold', 'italic', 'underline', 'clear']], ['style', ['bold', 'italic', 'underline', 'clear']],
['font', ['strikethrough', 'superscript', 'subscript', 'fontname']], ['font', ['strikethrough', 'superscript', 'subscript', 'fontname']],
@ -409,15 +409,15 @@ if ($variable !=''){
$empresa = remplacetas('form_id','id',$form,'id_empresa',"") ; $empresa = remplacetas('form_id','id',$form,'id_empresa',"") ;
$id_empresa = $empresa[0]; $id_empresa = $empresa[0];
$librerias_cabeza =" $librerias_cabeza ="
<script src='./librerias/summernote/summernote.js'></script> <script src='./librerias/summernote/summernote.js'></script>
<link href='./librerias/summernote/summernote.css' rel='stylesheet'> <link href='./librerias/summernote/summernote.css' rel='stylesheet'>
"; ";
$librerias_pie =" $librerias_pie ="
<script type='text/javascript'> <script type='text/javascript'>
//// wysiwyg //// wysiwyg
var edit = function() { var edit = function() {
$('.wysiwyg').summernote({height: 250, codemirror: { theme: 'default' },dialogsInBody: true, toolbar: $('.wysiwyg').summernote({height: 250, codemirror: { theme: 'default' },dialogsInBody: true, toolbar:
[ [
['style', ['bold', 'italic', 'underline', 'clear']], ['style', ['bold', 'italic', 'underline', 'clear']],
['font', ['strikethrough', 'superscript', 'subscript', 'fontname']], ['font', ['strikethrough', 'superscript', 'subscript', 'fontname']],
@ -458,7 +458,7 @@ if ($variable !=''){
else {$tema="moon";} else {$tema="moon";}
$librerias_cabeza =$presentacion_cabeza; $librerias_cabeza =$presentacion_cabeza;
$librerias_pie =$presentacion_pie; $librerias_pie =$presentacion_pie;
$onload=" $onload="
<div class='reveal'> <div class='reveal'>
<div class='slides'> <div class='slides'>
@ -485,7 +485,7 @@ if ($variable !=''){
<script src='librerias/reveal/js/reveal.js'></script> <script src='librerias/reveal/js/reveal.js'></script>
<script> <script>
@ -505,36 +505,36 @@ if ($variable !=''){
// More info https://github.com/hakimel/reveal.js#dependencies // More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [ dependencies: [
] ]
}); });
</script> </script>
<script src='librerias/slick/slick.js' type='text/javascript' charset='utf-8'></script> <script src='librerias/slick/slick.js' type='text/javascript' charset='utf-8'></script>
"; ";
$librerias_galeria =" $librerias_galeria ="
<!-- <link rel='manifest' href='manifest.json'> --> <!-- <link rel='manifest' href='manifest.json'> -->
<link rel='stylesheet' type='text/css' href='librerias/slick/slick.css'> <link rel='stylesheet' type='text/css' href='librerias/slick/slick.css'>
<link rel='stylesheet' type='text/css' href='librerias/slick/slick-theme.css'> <link rel='stylesheet' type='text/css' href='librerias/slick/slick-theme.css'>
<link rel='stylesheet' type='text/css' href='librerias/slick/style.css'> <link rel='stylesheet' type='text/css' href='librerias/slick/style.css'>
<script src='manup.js'></script> <script src='manup.js'></script>
"; ";
$registros=1; $registros=1;
$plantilla="landingpage"; $plantilla="landingpage";
$librerias_cabeza =" $librerias_cabeza ="
<script src='./librerias/ekko-lightbox/4.0.1/ekko-lightbox.min.js'></script> <script src='./librerias/ekko-lightbox/4.0.1/ekko-lightbox.min.js'></script>
<script src='./librerias/charts/Chart.bundle.js'></script> <script src='./librerias/charts/Chart.bundle.js'></script>
<script src='./librerias/charts/utils.js'></script> <script src='./librerias/charts/utils.js'></script>
$presentacion_cabeza $librerias_galeria $presentacion_cabeza $librerias_galeria
"; ";
$librerias_pie =" $librerias_pie ="
$aplicacion_pie $aplicacion_pie
<!-- <script> <!-- <script>
if('serviceWorker' in navigator) { if('serviceWorker' in navigator) {
navigator.serviceWorker navigator.serviceWorker
@ -570,7 +570,7 @@ if('serviceWorker' in navigator) {
count++; count++;
} }
}); });
loadArticle(1,$form,'galeria',$registros,'scroll-galeria'); loadArticle(1,$form,'galeria',$registros,'scroll-galeria');
loadArticle(2,$form,'galeria',$registros,'scroll-galeria'); loadArticle(2,$form,'galeria',$registros,'scroll-galeria');
loadArticle(3,$form,'galeria',$registros,'scroll-galeria'); loadArticle(3,$form,'galeria',$registros,'scroll-galeria');
@ -594,7 +594,7 @@ if('serviceWorker' in navigator) {
count++; count++;
} }
}); });
}); });
@ -604,7 +604,7 @@ if('serviceWorker' in navigator) {
</script> </script>
"; ";
@ -621,7 +621,7 @@ if('serviceWorker' in navigator) {
$id_campo = $campo_imagen[0]; $id_campo = $campo_imagen[0];
if($id_campo[0] =="") { if($id_campo[0] =="") {
$galeria=""; $galeria="";
}else{ }else{
$galeria= " $galeria= "
<section id='galeria' class='' > <section id='galeria' class='' >
@ -630,24 +630,24 @@ if('serviceWorker' in navigator) {
</div> </div>
</div> </div>
</section> </section>
"; ";
} }
if($geo[0] != "") { if($geo[0] != "") {
$mapa = " $mapa = "
<a name='mapa'></a> <a name='mapa'></a>
<embed class='' src='mapero.php?id=$form' width='100%' style='height: calc(100vh - 150px);' webkitAllowFullScreen mozallowfullscreen allowFullScreen ></embed> <embed class='' src='mapero.php?id=$form' width='100%' style='height: calc(100vh - 150px);' webkitAllowFullScreen mozallowfullscreen allowFullScreen ></embed>
"; ";
}else {$mapa = "";} }else {$mapa = "";}
$estadisticas = portal_listado_campos("$form"); $estadisticas = portal_listado_campos("$form");
$acciones= formulario_acciones("$form","aplicacion"); $acciones= formulario_acciones("$form","aplicacion");
$no_mostrar="display:none; "; $no_mostrar="display:none; ";
$footer=" $footer="
<nav class='navbar navbar-inverse navbar-fixed-bottom'> <nav class='navbar navbar-inverse navbar-fixed-bottom'>
<div class='list-inline'> <div class='list-inline'>
<ul class='center-block' style=' <ul class='center-block' style='
float:none; float:none;
margin:0 auto; margin:0 auto;
@ -658,10 +658,10 @@ if('serviceWorker' in navigator) {
</div> </div>
</nav>"; </nav>";
$onload=" $onload="
<div class='reveal' style='bottom: 80px !important; '> <div class='reveal' style='bottom: 80px !important; '>
<div class='slides' > <div class='slides' >
<section id='inicio' class='text-center scrollable' > <section id='inicio' class='text-center scrollable' >
@ -677,12 +677,12 @@ if('serviceWorker' in navigator) {
<hr> <hr>
<a href='https://tupale.co'>Tupale.co</a> <a href='https://tupale.co'>Tupale.co</a>
</section> </section>
$galeria $galeria
<section id='estadisticas' class='scrollable' > <section id='estadisticas' class='scrollable' >
$estadisticas $estadisticas
</section> </section>
<section id='mapa'> <section id='mapa'>
$mapa $mapa
@ -709,15 +709,15 @@ if('serviceWorker' in navigator) {
$embebido = "1"; $embebido = "1";
$onload = formulario_embebido($form,$opciones); $onload = formulario_embebido($form,$opciones);
$librerias_cabeza =" $librerias_cabeza ="
<script src='./librerias/summernote/summernote.js'></script> <script src='./librerias/summernote/summernote.js'></script>
<link href='./librerias/summernote/summernote.css' rel='stylesheet'> <link href='./librerias/summernote/summernote.css' rel='stylesheet'>
"; ";
$librerias_pie =" $librerias_pie ="
<script type='text/javascript'> <script type='text/javascript'>
//// wysiwyg //// wysiwyg
var edit = function() { var edit = function() {
$('.wysiwyg').summernote({height: 250, codemirror: { theme: 'default' },dialogsInBody: true, toolbar: $('.wysiwyg').summernote({height: 250, codemirror: { theme: 'default' },dialogsInBody: true, toolbar:
[ [
['style', ['bold', 'italic', 'underline', 'clear']], ['style', ['bold', 'italic', 'underline', 'clear']],
['font', ['strikethrough', 'superscript', 'subscript', 'fontname']], ['font', ['strikethrough', 'superscript', 'subscript', 'fontname']],
@ -762,7 +762,7 @@ if('serviceWorker' in navigator) {
$no_mostrar ="display:none; "; $no_mostrar ="display:none; ";
/*if($titulo[0] !="") { /*if($titulo[0] !="") {
$logo = remplacetas('empresa','id',"$id_empresa",'imagen','') ; $logo = remplacetas('empresa','id',"$id_empresa",'imagen','') ;
$descripcion = remplacetas('empresa','id',"$id_empresa",'slogan','') ; $descripcion = remplacetas('empresa','id',"$id_empresa",'slogan','') ;
//$background_imagen = buscar_imagen('',"","","$id_empresa"); //$background_imagen = buscar_imagen('',"","","$id_empresa");
$background_imagen = remplacetas('empresa','id',"$id_empresa",'imagen','') ; $background_imagen = remplacetas('empresa','id',"$id_empresa",'imagen','') ;
@ -798,22 +798,22 @@ $aplicacion_pie="
// More info https://github.com/hakimel/reveal.js#dependencies // More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [ dependencies: [
] ]
}); });
</script> </script>
<script src='librerias/slick/slick.js' type='text/javascript' charset='utf-8'></script> <script src='librerias/slick/slick.js' type='text/javascript' charset='utf-8'></script>
"; ";
$librerias_pie = "$aplicacion_pie"; $librerias_pie = "$aplicacion_pie";
$librerias_cabeza =" $librerias_cabeza ="
$presentacion_cabeza "; $presentacion_cabeza ";
$suite_listado = suite_listado("$id","$_REQUEST[suite]"); $suite_listado = suite_listado("$id","$_REQUEST[suite]");
$onload = "$suite_listado"; $onload = "$suite_listado";
} }
elseif($v[0] =='m') { elseif($v[0] =='m') {
@ -822,7 +822,7 @@ $aplicacion_pie="
$librerias_cabeza=' $librerias_cabeza='
<link rel="stylesheet" type="text/css" href="librerias/datatables/datatables.css"> <link rel="stylesheet" type="text/css" href="librerias/datatables/datatables.css">
<script type="text/javascript" charset="utf8" src="librerias/datatables/datatables.js"></script> <script type="text/javascript" charset="utf8" src="librerias/datatables/datatables.js"></script>
'; ';
$empresa = remplacetas('form_id','id',$form,'id_empresa',"") ; $empresa = remplacetas('form_id','id',$form,'id_empresa',"") ;
$razon_social_portal = remplacetas('empresa','id',"$empresa[0]",'razon_social','') ; $razon_social_portal = remplacetas('empresa','id',"$empresa[0]",'razon_social','') ;
@ -837,32 +837,32 @@ $aplicacion_pie="
$form =$v[1]; $form =$v[1];
$embebido = "1"; $embebido = "1";
$no_mostrar ="display:none; "; $no_mostrar ="display:none; ";
$publico = remplacetas('form_id','id',$form,'publico','') ; $publico = remplacetas('form_id','id',$form,'publico','') ;
$empresa_seguridad = remplacetas('form_id','id',$form,'id_empresa','') ; $empresa_seguridad = remplacetas('form_id','id',$form,'id_empresa','') ;
if($publico[0] != "1" and ( $_SESSION['id_empresa'] != $empresa_seguridad[0] ) ) { if($publico[0] != "1" and ( $_SESSION['id_empresa'] != $empresa_seguridad[0] ) ) {
$resultado = " <div class='alert alert-danger'><h1><a href='./milfs/'>Ingresa</a> con tu usuario para consultar esta aplicación. <i class='fa fa-user-circle-o'></i></h1>"; $resultado = " <div class='alert alert-danger'><h1><a href='./milfs/'>Ingresa</a> con tu usuario para consultar esta aplicación. <i class='fa fa-user-circle-o'></i></h1>";
$onload =$resultado; $onload =$resultado;
} }
else { else {
$librerias_cabeza =" $librerias_cabeza ="
<script type='text/javascript' src='librerias/notas/script.js'></script> <script type='text/javascript' src='librerias/notas/script.js'></script>
<script type='text/javascript' src='./librerias/jquery/jquery-ui.min.js'></script> <script type='text/javascript' src='./librerias/jquery/jquery-ui.min.js'></script>
<script type='text/javascript' src='./librerias/jquery/jquery.ui.touch-punch.js'></script> <script type='text/javascript' src='./librerias/jquery/jquery.ui.touch-punch.js'></script>
<script type='text/javascript' src='./librerias/jquery/jquery.touch.js'></script> <script type='text/javascript' src='./librerias/jquery/jquery.touch.js'></script>
<script type='text/javascript' src='./librerias/notas/jquery.infinitedrag.js'></script> <script type='text/javascript' src='./librerias/notas/jquery.infinitedrag.js'></script>
<link rel='stylesheet' type='text/css' href='./librerias/notas/styles.css' /> <link rel='stylesheet' type='text/css' href='./librerias/notas/styles.css' />
"; ";
$tablero = notas_tablero("$form"); $tablero = notas_tablero("$form");
$onload = "$tablero"; $onload = "$tablero";
} }
} }
elseif($v[0] =='o') { elseif($v[0] =='o') {
/// f= FORMULARIO /// f= FORMULARIO
$form =$v[1]; $form =$v[1];
@ -882,20 +882,20 @@ $aplicacion_pie="
if($geo[0] != "") { if($geo[0] != "") {
$mapa = " $mapa = "
<a name='mapa'></a> <a name='mapa'></a>
<embed class='' src='mapero.php?id=$form' width='100%' style='height: calc(100vh - 50px);' webkitAllowFullScreen mozallowfullscreen allowFullScreen ></embed> <embed class='' src='mapero.php?id=$form' width='100%' style='height: calc(100vh - 50px);' webkitAllowFullScreen mozallowfullscreen allowFullScreen ></embed>
"; ";
$boton_mapa ="<li><a href='#mapa'><i class='fa fa-map-o' aria-hidden='true'></i> Mapa</a></li>"; $boton_mapa ="<li><a href='#mapa'><i class='fa fa-map-o' aria-hidden='true'></i> Mapa</a></li>";
}else {$mapa = ""; $boton_mapa="";} }else {$mapa = ""; $boton_mapa="";}
$onload=" $onload="
<style> <style>
.parallax_banner { .parallax_banner {
/* The image used */ /* The image used */
background-image: url('milfs/images/secure/?file=600/$logo[0]'); background-image: url('milfs/images/secure/?file=600/$logo[0]');
/* Full height */ /* Full height */
height: 50%; height: 50%;
/* Create the parallax scrolling effect */ /* Create the parallax scrolling effect */
background-attachment: fixed; background-attachment: fixed;
@ -924,18 +924,18 @@ $aplicacion_pie="
</style> </style>
<div class='parallax_banner'></div> <div class='parallax_banner'></div>
<div style='min-height:200px;'> <div style='min-height:200px;'>
$banner $banner
</div> </div>
<div class='barra nav ' id='barra_aplicaciones'> <div class='barra nav ' id='barra_aplicaciones'>
<div class='navbar-header'> <div class='navbar-header'>
@ -966,10 +966,10 @@ $aplicacion_pie="
</div> </div>
<div id='mapa' class='container'><a name ='mapa' ></a>$mapa</div> <div id='mapa' class='container'><a name ='mapa' ></a>$mapa</div>
$presentacion $presentacion
<script> <script>
// When the user scrolls the page, execute myFunction // When the user scrolls the page, execute myFunction
window.onscroll = function() {myFunction()}; window.onscroll = function() {myFunction()};
// Get the header // Get the header
@ -986,7 +986,7 @@ function myFunction() {
header.classList.remove('sticky'); header.classList.remove('sticky');
} }
} }
</script> </script>
"; ";
} }
@ -1081,7 +1081,7 @@ $uri = $_SERVER['REQUEST_URI'];
<script type='text/javascript' src='librerias/exif/exif.js'></script> <script type='text/javascript' src='librerias/exif/exif.js'></script>
<link rel="apple-touch-icon-precomposed" href="<?php echo "milfs/images/secure/?file=150/$logo[0]"; ?>"> <link rel="apple-touch-icon-precomposed" href="<?php echo "milfs/images/secure/?file=150/$logo[0]"; ?>">
<title><?php echo @$titulo[0]; ?> <?php echo strip_tags($slogan[0]); ?> Tupale.co </title> <title><?php echo @$titulo[0]; ?> <?php echo strip_tags($slogan[0]); ?> Tupale.co </title>
<!-- <!--
<link href="./librerias/sidebar/css/simple-sidebar.css" rel="stylesheet" > <link href="./librerias/sidebar/css/simple-sidebar.css" rel="stylesheet" >
@ -1089,7 +1089,7 @@ $uri = $_SERVER['REQUEST_URI'];
<?php $xajax->printJavascript("milfs/xajax/"); <?php $xajax->printJavascript("milfs/xajax/");
$xajax->statusMessagesOn(); $xajax->statusMessagesOn();
$css = remplacetas('form_parametrizacion','campo',"index",'descripcion'," tabla='css' and opcion = 'bootstrap' and id_empresa = '$id_empresa'") ; $css = remplacetas('form_parametrizacion','campo',"index",'descripcion'," tabla='css' and opcion = 'bootstrap' and id_empresa = '$id_empresa'") ;
if($css[0] !="") { if($css[0] !="") {
@ -1148,11 +1148,11 @@ $uri = $_SERVER['REQUEST_URI'];
<!-- <script src="./librerias/charts/Chart.bundle.js"></script> <!-- <script src="./librerias/charts/Chart.bundle.js"></script>
<script src="./librerias/charts/utils.js"></script> --> <script src="./librerias/charts/utils.js"></script> -->
<script src="./librerias/lazy/jquery.lazy.min.js"></script> <script src="./librerias/lazy/jquery.lazy.min.js"></script>
<script src='./librerias/summernote/summernote.js'></script> <script src='./librerias/summernote/summernote.js'></script>
<link href='./librerias/summernote/summernote.css' rel='stylesheet'> <link href='./librerias/summernote/summernote.css' rel='stylesheet'>
<script type='text/javascript'> var edit = function() { $('.wysiwyg').summernote({height: 250, codemirror: { theme: 'default' },dialogsInBody: true, toolbar:[ ['style', ['bold', 'italic', 'underline', 'clear']], ['font', ['strikethrough', 'superscript', 'subscript', 'fontname']], ['fontsize', ['fontsize']], ['color', ['color']], ['para', ['ul', 'ol', 'paragraph', 'style']], ['height', ['height']], ['insert', ['picture', 'link', 'video', 'table', 'hr']], ['misc', ['fullscreen', 'codeview', 'undo', 'redo']] ] }); }; var save = function() { var makrup = $('.wysiwyg').summernote('code'); $('.wysiwyg').summernote('destroy'); }; $(document).ready(function() { $('.wysiwyg_auto').summernote({dialogsInBody: true}); }); </script> <script type='text/javascript'> var edit = function() { $('.wysiwyg').summernote({height: 250, codemirror: { theme: 'default' },dialogsInBody: true, toolbar:[ ['style', ['bold', 'italic', 'underline', 'clear']], ['font', ['strikethrough', 'superscript', 'subscript', 'fontname']], ['fontsize', ['fontsize']], ['color', ['color']], ['para', ['ul', 'ol', 'paragraph', 'style']], ['height', ['height']], ['insert', ['picture', 'link', 'video', 'table', 'hr']], ['misc', ['fullscreen', 'codeview', 'undo', 'redo']] ] }); }; var save = function() { var makrup = $('.wysiwyg').summernote('code'); $('.wysiwyg').summernote('destroy'); }; $(document).ready(function() { $('.wysiwyg_auto').summernote({dialogsInBody: true}); }); </script>
<script> <script>
$(function() { $(function() {
$('.lazy').lazy({ $('.lazy').lazy({
// your configuration goes here // your configuration goes here
@ -1161,7 +1161,7 @@ $uri = $_SERVER['REQUEST_URI'];
// scrollDirection: 'vertical', // scrollDirection: 'vertical',
//effect: 'fadeIn', //effect: 'fadeIn',
//visibleOnly: true, //visibleOnly: true,
onError: function(element) { onError: function(element) {
console.log('error loading ' + element.data('src')); console.log('error loading ' + element.data('src'));
} }
@ -1214,8 +1214,8 @@ $menu_lateral = "
<h3 >".@$titulo[0]."</h3> <h3 >".@$titulo[0]."</h3>
<p>".@$descripcion[0]." </p> <p>".@$descripcion[0]." </p>
<ul class='fh5co-social'> <ul class='fh5co-social'>
$soporte $soporte
<li><a href='https://twitter.com/$twitter[0]'><i class='icon-twitter'></i></a></li> <li><a href='https://twitter.com/$twitter[0]'><i class='icon-twitter'></i></a></li>
<li><a href='https://www.facebook.com/$facebook[0]'><i class='icon-facebook'></i></a></li> <li><a href='https://www.facebook.com/$facebook[0]'><i class='icon-facebook'></i></a></li>
@ -1245,7 +1245,7 @@ $menu_lateral = "
} }
?> ?>
<link href="./milfs/css/style.css" rel="stylesheet"> <link href="./milfs/css/style.css" rel="stylesheet">
<script src="milfs/js/scripts.js"></script> <script src="milfs/js/scripts.js"></script>
@ -1260,7 +1260,7 @@ $menu_lateral = "
<!-- <script src="./librerias/ekko-lightbox/4.0.1/ekko-lightbox.min.js"></script> --> <!-- <script src="./librerias/ekko-lightbox/4.0.1/ekko-lightbox.min.js"></script> -->
<!--firma --> <!--firma -->
<!-- <!--
<script src="librerias/firma/signature_pad.js"></script> <script src="librerias/firma/signature_pad.js"></script>
<!-- firma pie --> <!-- firma pie -->
@ -1268,10 +1268,10 @@ $menu_lateral = "
<script src="librerias/firma/app.js"></script> <script src="librerias/firma/app.js"></script>
--> -->
<?php echo $css_adicional; <?php echo $css_adicional;
if(!isset($_SESSION['id']) ){ ?> if(!isset($_SESSION['id']) ){ ?>
<script type="text/javascript"> <script type="text/javascript">
function addLink() { function addLink() {
var body_element = document.getElementsByTagName('body')[0]; var body_element = document.getElementsByTagName('body')[0];
var selection; var selection;
@ -1304,12 +1304,12 @@ document.oncopy = addLink;
echo " " ; echo " " ;
} }
if(isset($_SESSION['id'])) {$id_empresa_portada='1'; echo " if(isset($_SESSION['id'])) {$id_empresa_portada='1'; echo "
<span style=' $no_mostrar '>".panel_aplicaciones('1',"$_SESSION[id_empresa]","")."</span>"; } <span style=' $no_mostrar '>".panel_aplicaciones('1',"$_SESSION[id_empresa]","")."</span>"; }
if(isset($_REQUEST['eventos'])) { if(isset($_REQUEST['eventos'])) {
//$embebido='1'; //$embebido='1';
$librerias_pie=" $librerias_pie="
<link href='librerias/calendar/fullcalendar.min.css' rel='stylesheet' /> <link href='librerias/calendar/fullcalendar.min.css' rel='stylesheet' />
<link href='librerias/calendar/fullcalendar.print.min.css' rel='stylesheet' media='print' /> <link href='librerias/calendar/fullcalendar.print.min.css' rel='stylesheet' media='print' />
@ -1333,7 +1333,7 @@ $css_adicional
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('#calendar').fullCalendar({ $('#calendar').fullCalendar({
header: { header: {
left: 'prev,next today', left: 'prev,next today',
@ -1345,7 +1345,7 @@ $css_adicional
themeSystem: 'bootstrap3', themeSystem: 'bootstrap3',
navLinks: true, // can click day/week names to navigate views navLinks: true, // can click day/week names to navigate views
editable: false, editable: false,
eventLimit: true, // allow \"more\" link when too many events eventLimit: true, // allow \"more\" link when too many events
events: { events: {
url: 'milfs/api.php', url: 'milfs/api.php',
@ -1357,7 +1357,7 @@ $css_adicional
error: function() { error: function() {
$('#script-warning').show(); $('#script-warning').show();
} }
}, },
buttonText: { buttonText: {
listMonth: 'Agenda', listMonth: 'Agenda',
listYear: 'Año', listYear: 'Año',
@ -1366,7 +1366,7 @@ $css_adicional
loading: function(bool) { loading: function(bool) {
$('#loading').toggle(bool); $('#loading').toggle(bool);
} }
, ,
eventMouseover: function (data, event, view) { eventMouseover: function (data, event, view) {
@ -1403,9 +1403,9 @@ $css_adicional
viewDisplay: function () { viewDisplay: function () {
tooltip.hide() tooltip.hide()
}, },
}); });
}); });
</script><h1 class='titulo_eventos text-center'>$titulo[0]</h1><div class='container-fluid' id='calendar'></div><br>"; </script><h1 class='titulo_eventos text-center'>$titulo[0]</h1><div class='container-fluid' id='calendar'></div><br>";
@ -1457,7 +1457,7 @@ echo $css_adicional;
</body> </body>
</html> </html>
<!-- fin embebido --> <!-- fin embebido -->
<?php <?php
@ -1491,17 +1491,17 @@ echo $css_adicional;
<div id='meta_cabecera' class="col-lg-12 col-md-12 "> <div id='meta_cabecera' class="col-lg-12 col-md-12 ">
<div class="container"> <div class="container">
<div class="col-md-9"> <div class="col-md-9">
<div id='formulario_login' class='' ></div> <div id='formulario_login' class='' ></div>
<div class='container' div='contenedor_cabecera'> <div class='container' id='contenedor_cabecera'>
<div class='col-md-3' id='logo_cabecera'> <div class='col-md-3' id='logo_cabecera'>
<a href="./e<?php echo $id_empresa; ?>"> <a href="./e<?php echo $id_empresa; ?>">
<img id='logo_cabecera' class='center-block img img-responsive' style='' src="milfs/images/secure/?file=300/<?php echo $logo[0]; ?>"> <img id='logo_cabecera' class='center-block img img-responsive' style='' src="milfs/images/secure/?file=300/<?php echo $logo[0]; ?>">
</a> </a>
</div> </div>
<div class='col-md-9'> <div class='col-md-9'>
<h1 id="titulo_cabecera" data-toc-skip ><a href="<?php if($id_form !=""){echo "s".$id_form;} ?>"><?php echo $titulo[0]; ?></a></h1> <h1 id="titulo_cabecera" data-toc-skip ><a href="<?php if($id_form !=""){echo "s".$id_form;} ?>"><?php echo $titulo[0]; ?></a></h1>
<div id='slogan_cabecera'><p><?php echo "$slogan[0] "; ?> </p></div> <div id='slogan_cabecera'><p><?php echo "$slogan[0] "; ?> </p></div>
</div> </div>
</div> </div>
@ -1542,17 +1542,17 @@ echo $css_adicional;
</header> </header>
<div class="container"> <div class="container">
<?php <?php
$id_campo = campo_titulo($set) ; $id_campo = campo_titulo($set) ;
$corpus = formulario_corpus("$set","$id_campo","contenido","barras","texto_articulo"); $corpus = formulario_corpus("$set","$id_campo","contenido","barras","texto_articulo");
$ultimos = mas_visto("ultimos","5","1","$set","$id_empresa"); $ultimos = mas_visto("ultimos","5","1","$set","$id_empresa");
if ($v[0]=='s'){ if ($v[0]=='s'){
$buscar_datos = buscar_datos("*formato*","$set","$plantilla","texto_articulo"); $buscar_datos = buscar_datos("*formato*","$set","$plantilla","texto_articulo");
echo " echo "
<div class='col-md-3 hidden-xs '> <div class='col-md-3 hidden-xs '>
<aside id='aside_index'> <aside id='aside_index'>
$buscar_datos $buscar_datos
<div id='grid_resultado_landing'></div> <div id='grid_resultado_landing'></div>
<br> <br>
<hr> <hr>
@ -1581,7 +1581,7 @@ echo $css_adicional;
//echo mas_visto("formulario","4",""); //echo mas_visto("formulario","4","");
echo ""; echo "";
} }
if($acceso ==1) { if($acceso ==1) {
if($set != "") { if($set != "") {

View File

@ -1,6 +1,6 @@
<?php session_start(); <?php session_start();
//ini_set('display_errors', 'On'); //ini_set('display_errors', 'On');
if(isset($_REQUEST['debug'])) {ini_set('display_errors', 'On');} if(isset($_REQUEST['debug'])) {ini_set('display_errors', 'On');}
require ('milfs/xajax/xajax.inc.php'); require ('milfs/xajax/xajax.inc.php');
$xajax = new xajax(); $xajax = new xajax();
require ("milfs/funciones/conex.php"); require ("milfs/funciones/conex.php");
@ -23,10 +23,10 @@ if(isset($_REQUEST['debug'])) {ini_set('display_errors', 'On');}
<?php $xajax->printJavascript("xajax/"); ?> <?php $xajax->printJavascript("xajax/"); ?>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha256-k2/8zcNbxVIh5mnQ52A0r3a6jAgMGxFJFE2707UxGCk= sha512-ZV9KawG2Legkwp3nAlxLIVFudTauWuBpC10uEafMHYL0Sarrz5A7G79kXh5+5+woxQ5HM559XX2UZjMJ36Wplg==" crossorigin="anonymous"> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha256-k2/8zcNbxVIh5mnQ52A0r3a6jAgMGxFJFE2707UxGCk= sha512-ZV9KawG2Legkwp3nAlxLIVFudTauWuBpC10uEafMHYL0Sarrz5A7G79kXh5+5+woxQ5HM559XX2UZjMJ36Wplg==" crossorigin="anonymous">
<?php <?php
//$xajax->debugOn(''); //$xajax->debugOn('');
$embebido =0; $embebido =0;
if( isset($_REQUEST['empresa']) OR empty($_REQUEST) OR isset($_REQUEST['set']) OR isset($_REQUEST['identificador']) ) { if( isset($_REQUEST['empresa']) OR empty($_REQUEST) OR isset($_REQUEST['set']) OR isset($_REQUEST['identificador']) ) {
@ -38,7 +38,7 @@ if($id[0]=="") { $id_empresa = "1";}
if(!isset($_REQUEST['set'])){ if(!isset($_REQUEST['set'])){
$titulo = remplacetas('empresa','id',"$id_empresa",'razon_social','') ; $titulo = remplacetas('empresa','id',"$id_empresa",'razon_social','') ;
$descripcion = remplacetas('empresa','id',"$id_empresa",'slogan','') ; $descripcion = remplacetas('empresa','id',"$id_empresa",'slogan','') ;
$background_imagen = buscar_imagen('',"","","$id_empresa"); $background_imagen = buscar_imagen('',"","","$id_empresa");
$uri_set = ""; $uri_set = "";
$acceso = 1; $acceso = 1;
} }
@ -47,19 +47,19 @@ if($id[0]=="") { $id_empresa = "1";}
$id_empresa = $empresa[0]; $id_empresa = $empresa[0];
$titulo = remplacetas('form_id','id',$_REQUEST['set'],'nombre',"") ; $titulo = remplacetas('form_id','id',$_REQUEST['set'],'nombre',"") ;
$descripcion = remplacetas('form_id','id',$_REQUEST['set'],'descripcion',"") ; $descripcion = remplacetas('form_id','id',$_REQUEST['set'],'descripcion',"") ;
$background_imagen = buscar_imagen($_REQUEST['set'],"","","$id_empresa"); $background_imagen = buscar_imagen($_REQUEST['set'],"","","$id_empresa");
$uri_set = ""; $uri_set = "";
$publico = remplacetas('form_id','id',$_REQUEST['set'],'publico',"") ; $publico = remplacetas('form_id','id',$_REQUEST['set'],'publico',"") ;
if($publico[0] =='1') {$acceso = 1;} if($publico[0] =='1') {$acceso = 1;}
} }
if( isset($_REQUEST['identificador'])){ if( isset($_REQUEST['identificador'])){
$empresa = remplacetas('form_datos','control',$_REQUEST['identificador'],'id_empresa',"") ; $empresa = remplacetas('form_datos','control',$_REQUEST['identificador'],'id_empresa',"") ;
$id_empresa = $empresa[0]; $id_empresa = $empresa[0];
$form = remplacetas('form_datos','control',$_REQUEST['identificador'],'form_id',"") ; $form = remplacetas('form_datos','control',$_REQUEST['identificador'],'form_id',"") ;
$titulo = remplacetas('form_id','id',$form['0'],'nombre',"") ; $titulo = remplacetas('form_id','id',$form['0'],'nombre',"") ;
$descripcion = remplacetas('form_id','id',$form['0'],'descripcion',"") ; $descripcion = remplacetas('form_id','id',$form['0'],'descripcion',"") ;
$background_imagen = buscar_imagen($form[0],"","","$id_empresa"); $background_imagen = buscar_imagen($form[0],"","","$id_empresa");
$uri_set = "<a class='' href='?set=$form[0]'>$titulo[0]</a>"; $uri_set = "<a class='' href='?set=$form[0]'>$titulo[0]</a>";
$publico = remplacetas('form_id','id',$form[0],'publico',"") ; $publico = remplacetas('form_id','id',$form[0],'publico',"") ;
if($publico[0] =='1') {$acceso = 1;} if($publico[0] =='1') {$acceso = 1;}
@ -80,7 +80,7 @@ $sigla = remplacetas('empresa','id',"$id_empresa",'sigla','') ;
<!-- Custom CSS --> <!-- Custom CSS -->
<!-- Custom Fonts --> <!-- Custom Fonts -->
<link href="http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css"> <link href="http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
@ -115,7 +115,7 @@ h6 {
} }
.topnav { .topnav {
font-size: 14px; font-size: 14px;
} }
.lead { .lead {
@ -282,7 +282,7 @@ p.copyright {
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<a class="navbar-brand topnav" href="?empresa=<?php echo $id_empresa; ?>"><i class='fa fa-home'></i> <?php echo $sigla[0]; ?></a> <a class="navbar-brand topnav" href="?empresa=<?php echo $id_empresa; ?>"><i class='fa fa-home'></i> <?php echo $sigla[0]; ?></a>
</div> </div>
<!-- Collect the nav links, forms, and other content for toggling --> <!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
@ -309,9 +309,9 @@ p.copyright {
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="intro-message"> <div class="intro-message">
<h1><?php echo $titulo[0]; ?></h1> <h1><?php echo $titulo[0]; ?></h1>
<h3><?php echo $descripcion[0]; ?></h3> <h3><?php echo $descripcion[0]; ?></h3>
<hr class="intro-divider"> <hr class="intro-divider">
<ul class="list-inline intro-social-buttons"> <ul class="list-inline intro-social-buttons">
@ -337,17 +337,17 @@ p.copyright {
<!-- Page Content --> <!-- Page Content -->
<a name="formularios"></a> <a name="formularios"></a>
<?php <?php
if($acceso ==1) { if($acceso ==1) {
if(isset($_REQUEST['set'])) { if(isset($_REQUEST['set'])) {
echo landingpage_contenido_formulario($_REQUEST['set']); } echo landingpage_contenido_formulario($_REQUEST['set']); }
elseif(isset($_REQUEST['identificador'])) { echo landingpage_contenido_identificador($_REQUEST['identificador']); } elseif(isset($_REQUEST['identificador'])) { echo landingpage_contenido_identificador($_REQUEST['identificador']); }
else{ echo landingpage_contenido($id_empresa);} else{ echo landingpage_contenido($id_empresa);}
} }
?> ?>
<a name="contact"></a> <a name="contact"></a>
<div class="banner"> <div class="banner">
@ -439,7 +439,7 @@ if (isset($_REQUEST['c'])) {$c = $_REQUEST['c'];} else {$c = "";}
if (isset($_REQUEST['f'])) {$f = $_REQUEST['f'];} else {$f = "";} if (isset($_REQUEST['f'])) {$f = $_REQUEST['f'];} else {$f = "";}
if (isset($_REQUEST['t'])) {$t = $_REQUEST['t'];} else {$t = "";} if (isset($_REQUEST['t'])) {$t = $_REQUEST['t'];} else {$t = "";}
?> ?>
<link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap-markdown.css"> <link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap-markdown.css">
<link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap-markdown.min.css"> <link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap-markdown.min.css">
<link href='css/estilos.php?dd' rel='stylesheet'> <link href='css/estilos.php?dd' rel='stylesheet'>
@ -447,7 +447,7 @@ if (isset($_REQUEST['t'])) {$t = $_REQUEST['t'];} else {$t = "";}
<style> <style>
#map {width: 500px;height:200px;} #map {width: 500px;height:200px;}
</style> </style>
@ -467,11 +467,11 @@ if (isset($_REQUEST['t'])) {$t = $_REQUEST['t'];} else {$t = "";}
<script src="js/scripts.js"></script> <script src="js/scripts.js"></script>
<script type="text/javascript"> <script type="text/javascript">
function evdragstart(ev,el) { //ev= el evento, el=elemento arrastrado. function evdragstart(ev,el) { //ev= el evento, el=elemento arrastrado.
cont1=el.parentNode; //guardamos el elemento padre del elemento en una variable. cont1=el.parentNode; //guardamos el elemento padre del elemento en una variable.
ev.dataTransfer.setData("text",ev.target.id); //guardamos datos del elemento. ev.dataTransfer.setData("text",ev.target.id); //guardamos datos del elemento.
} }
function evdragover (ev) { //ev=el evento. function evdragover (ev) { //ev=el evento.
@ -479,7 +479,7 @@ function evdragover (ev) { //ev=el evento.
} }
function evdrop(ev,el) { //ev=el evento; el=receptor de soltado function evdrop(ev,el) { //ev=el evento; el=receptor de soltado
ev.stopPropagation(); //impedir otras acciones ev.stopPropagation(); //impedir otras acciones
ev.preventDefault(); //quitar comportamiento por defecto ev.preventDefault(); //quitar comportamiento por defecto
var data=ev.dataTransfer.getData("text"); //recogemos datos del elemento var data=ev.dataTransfer.getData("text"); //recogemos datos del elemento
mielem=ev.target.appendChild(document.getElementById(data)); //obtenemos el elemento arrastrado mielem=ev.target.appendChild(document.getElementById(data)); //obtenemos el elemento arrastrado
@ -504,7 +504,7 @@ function evdrop(ev,el) { //ev=el evento; el=receptor de soltado
</head> </head>
<body > <body >
<?php if($embebido ==1) { <?php if($embebido ==1) {
if($form!=''){ echo formulario_embebido($form,$opciones);} if($form!=''){ echo formulario_embebido($form,$opciones);}
elseif($identificador !='') { echo mostrar_identificador($identificador,$id);} elseif($identificador !='') { echo mostrar_identificador($identificador,$id);}
//elseif($_REQUEST['psi'] !='') { include("psi.php") ; echo $aviso;} //elseif($_REQUEST['psi'] !='') { include("psi.php") ; echo $aviso;}
@ -514,7 +514,7 @@ else{}
?> ?>
<?php echo @$onload; ?> <?php echo @$onload; ?>
<?php <?php
if ( isset ( $_SESSION['id'] ) ) { ?> if ( isset ( $_SESSION['id'] ) ) { ?>
<div class="navbar navbar-inverse navbar-fixed-top " role="navigation"> <div class="navbar navbar-inverse navbar-fixed-top " role="navigation">
<div class="container-fluid"> <div class="container-fluid">
@ -538,12 +538,12 @@ else{}
<div id='debug'></div> <div id='debug'></div>
<div class='container'> <div class='container'>
<div id='contenido'> <div id='contenido'>
<?php <?php
if(!isset($_SESSION['id_empresa'])) {$id_empresa_portada='1';} else{$id_empresa_portada = $_SESSION['id_empresa'];} if(!isset($_SESSION['id_empresa'])) {$id_empresa_portada='1';} else{$id_empresa_portada = $_SESSION['id_empresa'];}
$encabezado = empresa_datos("$id_empresa_portada",'encabezado'); $encabezado = empresa_datos("$id_empresa_portada",'encabezado');
$pie = empresa_datos("$id_empresa_portada",'pie'); $pie = empresa_datos("$id_empresa_portada",'pie');
echo "$encabezado"; echo "$encabezado";
?>xxx ?>xxx
<?php echo buscar_imagen("21","","",""); ?> <?php echo buscar_imagen("21","","",""); ?>
xxx xxx
@ -551,7 +551,7 @@ else{}
echo cambiar_password_formato("$_REQUEST[change]"); echo cambiar_password_formato("$_REQUEST[change]");
} }
revisar_ingreso(''); revisar_ingreso('');
?> ?>
<?php echo $pie; ?> <?php echo $pie; ?>
<img class='img-responsive center-block' src="images/logo.png" alt="MILFS"> <img class='img-responsive center-block' src="images/logo.png" alt="MILFS">
@ -577,8 +577,8 @@ revisar_ingreso('');
<div id='muestra_form'></div> <div id='muestra_form'></div>
</div> </div>
<div class='modal-footer' id='pie_modal'> <div class='modal-footer' id='pie_modal'>
</div> </div>
</div> </div>
</div> </div>
@ -591,7 +591,7 @@ revisar_ingreso('');
<div class="container"> <div class="container">
<a href='http://QWERTY.co/milfs'>&copy; MILFS Un proyecto de http://QWERTY.co</a> Se distribuye bajo licencia GPL V3 <a href='http://QWERTY.co/milfs'>&copy; MILFS Un proyecto de http://QWERTY.co</a> Se distribuye bajo licencia GPL V3
<a href="?psi" target="_psi"><i class="fa fa-smile-o "></i> Políticas de privacidad y protección de datos.</a> <a href="?psi" target="_psi"><i class="fa fa-smile-o "></i> Políticas de privacidad y protección de datos.</a>
</div> </div>
</div> </div>
<?php } ?> <?php } ?>

View File

@ -1,510 +0,0 @@
<?php
//include("funciones/funciones.php");
$id_formulario = "58";
$ancho = "500";
$tags = array();
$tags[] = "milfs/addon/logis/images/logos/c.png";
foreach ($tags as &$valor) {
$imagen .= "<td onclick=\" document.getElementById('marca').src='$valor' ; marcar('top-left') \" ><a href='#medio' class='' >
<img class='img ' src='$valor'>
</a></td>";
}
$imagen = "
<div class='table-responsive'>
<table class='table table table-condensed text-center '>
<tr >
$imagen
</tr>
</table>
</div>";
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<div>
<style type="text/css">
.fa{
font-size:60px important!;
}
#imagen_origina{
width: <?echo $ancho ?>px;
}
body{
background-color:white !important;
}
.pin {
text-align: center;
/*border: solid 1px red;*/
opacity: 0.5;
}
.fileUpload {
position: relative;
overflow: hidden;
margin: 10px;
width: 80%;
}
.fileUpload input.upload {
position: absolute;
top: 0;
right: 0;
margin: 10;
padding: 0;
font-size: 50px;
cursor: pointer;
opacity: 0;
filter: alpha(opacity=0);
}
.ing-touch{
border: solid 1px red;
width:20% !important;
}
</style>
<div class='container' style='backgroun-color:white;' >
<div class='fileUpload btn btn-primary center-block'>
<span><h1><i class="fa fa-camera"></i></h1></span>
<input class='upload' type="file" id="file-input" /></span>
<div id="original" ></div>
</div>
<!-- <p><input type="file" id="file-input"></p> -->
<div id="actions" style="display:none;">
<img class="center-block" src= "<?php echo $tags[0]; ?>" style='display:none' id="marca" name="marca">
<img class="center-block" style='' id="image_output" name="image_output">
<img class="center-block" style='' id="otra_imagen" name="otra_imagen">
<div id="result" class="result">
<p></p>
</div>
<a name="arriba"></a>
<div style="position:relative">
<div style="position:absolute; width:100%; height:100%;" >
<table style="width:100%; height:100%;" class="">
<tr >
<td class="pin" ><a href="#arriba" onclick=" javascript: marcar('top-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:20%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:20%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
</tr>
<tr>
<td class="pin"><a name="medio"></a><a href="#arriba" onclick=" javascript: marcar('middle-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin" ><a href="#medio" onclick=" javascript: marcar('middle-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></td>
</tr>
<tr>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
</tr>
</table>
</div>
<canvas id="micanvas" style="position:absolute" >
Tu navegador no soporta canvas.
</canvas>
</div>
<div class="row " style="position:relative">
<form id='formulario_brigadistas' name='formulario_brigadistas' >
<input class='form-control' type='' id="debugConsole" name="debugConsole" >
<input type='' id="identificador" name="identificador" >
<input type='hidden' id="formulario_id" name="formulario_id" value="<?php echo $id_formulario; ?>">
<input type='hidden' id="imagen" name="imagen" value="">
<?php $formulario = formulario_areas("$id_formulario",'campos','','');
echo $formulario; ?>
</form>
</div>
<div id='aviso'>Aviso</div>
<div class="row">
<div class="col-md-12">
<!-- this.disabled= true; xajax_wait('aviso','Grabando... un momento por favor...'); -->
<button class='fileUpload btn btn-success btn-block' onclick=" xajax_brigadistas_grabar(xajax.getFormValues('formulario_brigadistas'))">
<span><i class="fa fa-save"></i> <span class='fa'> Grabalo! </span></span>
</button>
</div>
</div>
</div>
</div>
<script language="javascript">
$(function () {
'use strict';
var result = $('#result'),
exifNode = $('#exif'),
thumbNode = $('#thumbnail'),
actionsNode = $('#actions'),
currentFile,
replaceResults = function (img) {
var content;
if (!(img.src || img instanceof HTMLCanvasElement)) {
content = $('<span>Loading image file failed</span>');
} else {
content = $('<img />').append(img)
//.attr('download', currentFile.name)
.attr('src', img.src || img.toDataURL())
.attr('width', '<?echo $ancho ?>px')
.attr('style', 'width:100%')
.attr('id', 'imagen_original');
}
//document.getElementById('image_output').src = img.src;
result.children().replaceWith(content);
if (img.getContext) {
actionsNode.show();
window.setTimeout("marcar('middle-center');", 500);
}
},
displayImage = function (file, options) {
currentFile = file;
if (!loadImage(
file,
replaceResults,
options
)) {
result.children().replaceWith(
$('<span>Your browser does not support the URL or FileReader API.</span>')
);
}
},
displayExifData = function (exif) {
var thumbnail = exif.get('Thumbnail'),
tags = exif.getAll(),
table = exifNode.find('table').empty(),
row = $('<tr></tr>'),
cell = $('<td></td>'),
prop;
if (thumbnail) {
thumbNode.empty();
loadImage(thumbnail, function (img) {
thumbNode.append(img).show();
}, {orientation: exif.get('Orientation')});
}
for (prop in tags) {
if (tags.hasOwnProperty(prop)) {
table.append(
row.clone()
.append(cell.clone().text(prop))
.append(cell.clone().text(tags[prop]))
);
}
}
exifNode.show();
},
dropChangeHandler = function (e) {
e.preventDefault();
e = e.originalEvent;
var target = e.dataTransfer || e.target,
file = target && target.files && target.files[0],
options = {
maxWidth: result.width(),
canvas: true
};
if (!file) {
return;
}
exifNode.hide();
thumbNode.hide();
loadImage.parseMetaData(file, function (data) {
if (data.exif) {
options.orientation = data.exif.get('Orientation');
displayExifData(data.exif);
}
displayImage(file, options);
});
},
coordinates;
// Hide URL/FileReader API requirement message in capable browsers:
if (window.createObjectURL || window.URL || window.webkitURL || window.FileReader) {
result.children().hide();
}
$(document)
.on('dragover', function (e) {
e.preventDefault();
e = e.originalEvent;
e.dataTransfer.dropEffect = 'copy';
})
.on('drop', dropChangeHandler);
$('#file-input').on('change', dropChangeHandler);
$('#edit').on('click', function (event) {
event.preventDefault();
var imgNode = result.find('img, canvas'),
img = imgNode[0];
imgNode.Jcrop({
setSelect: [40, 40, img.width - 40, img.height - 40],
onSelect: function (coords) {
coordinates = coords;
},
onRelease: function () {
coordinates = null;
}
}).parent().on('click', function (event) {
event.preventDefault();
});
});
$('#crop').on('click', function (event) {
event.preventDefault();
var img = result.find('img, canvas')[0];
if (img && coordinates) {
replaceResults(loadImage.scale(img, {
left: coordinates.x,
top: coordinates.y,
sourceWidth: coordinates.w,
sourceHeight: coordinates.h,
minWidth: result.width()
}));
coordinates = null;
}
});
});
</script>
<script language="javascript">
function cargaContextoCanvas(idCanvas){
var elemento = document.getElementById(idCanvas);
if(elemento && elemento.getContext){
var contexto = elemento.getContext('2d');
if(contexto){
return contexto;
}
}
return FALSE;
}
function marcar(ubicacion){
//if (ubicacion == 'arriba'){ var x = '0';var y = '0';}
//if (ubicacion == 'abajo'){ var x = '10';var y = '50';}
//Recibimos el elemento canvas
var ctx = cargaContextoCanvas('micanvas');
if(ctx){
//Creo una imagen conun objeto Image de Javascript
var img = new Image();
var img2 = new Image();
//img.src = document.getElementById("image_output2").src;
//readAsDataURL(
img.src = document.getElementById("imagen_original").src;
document.getElementById("imagen_original").style.display="none";
//img2.src = 'images/logos/a.png';
img2.src = document.getElementById("marca").src;
if (ubicacion =='') {
ubicacion ='middle-center';
}
x = 0,
y = 0;
if(ubicacion.indexOf("top")!=-1)
y = 10;
else if(ubicacion.indexOf("middle")!=-1)
y = (micanvas.height - img2.height)/2;
else
y = micanvas.height-img2.height-10;
if(ubicacion.indexOf("left")!=-1)
x = 10;
else if(ubicacion.indexOf("center")!=-1)
x = (micanvas.width - img2.width) /2;
else
x = micanvas.width-img2.width-10;
var proporcion = ( img.height / img.width );
var ancho = <?echo $ancho ?>;
micanvas.width =ancho;
micanvas.height = (micanvas.width * proporcion);
micanvas.setAttribute('width', ancho);
micanvas.setAttribute('height', micanvas.height);
micanvas.setAttribute('style',"width:100%");
img.onload = function(){
ctx.drawImage(img, 0, 0,micanvas.width,micanvas.height);
ctx.drawImage(img2, x, y);
var debugConsole= document.getElementById("debugConsole");
var testCanvas = document.getElementById("micanvas");
var canvasData = testCanvas.toDataURL("image/png");
var postData = "canvasData="+canvasData;
debugConsole.value=canvasData;
var identificador = Math.random();
document.getElementById('identificador').value= identificador;
}
}
}
$(function () {
'use strict';
var result = $('#result'),
exifNode = $('#exif'),
thumbNode = $('#thumbnail'),
actionsNode = $('#actions'),
currentFile,
replaceResults = function (img) {
var content;
if (!(img.src || img instanceof HTMLCanvasElement)) {
content = $('<span>Loading image file failed</span>');
} else {
content = $('<img />').append(img)
//.attr('download', currentFile.name)
.attr('src', img.src || img.toDataURL())
.attr('width', '<?echo $ancho ?>')
.attr('style', 'width:100%')
.attr('id', 'imagen_original');
}
//document.getElementById('image_output').src = img.src;
result.children().replaceWith(content);
if (img.getContext) {
actionsNode.show();
window.setTimeout("marcar('middle-center');", 500);
}
},
displayImage = function (file, options) {
currentFile = file;
if (!loadImage(
file,
replaceResults,
options
)) {
result.children().replaceWith(
$('<span>Your browser does not support the URL or FileReader API.</span>')
);
}
},
displayExifData = function (exif) {
var thumbnail = exif.get('Thumbnail'),
tags = exif.getAll(),
table = exifNode.find('table').empty(),
row = $('<tr></tr>'),
cell = $('<td></td>'),
prop;
if (thumbnail) {
thumbNode.empty();
loadImage(thumbnail, function (img) {
thumbNode.append(img).show();
}, {orientation: exif.get('Orientation')});
}
for (prop in tags) {
if (tags.hasOwnProperty(prop)) {
table.append(
row.clone()
.append(cell.clone().text(prop))
.append(cell.clone().text(tags[prop]))
);
}
}
exifNode.show();
},
dropChangeHandler = function (e) {
e.preventDefault();
e = e.originalEvent;
var target = e.dataTransfer || e.target,
file = target && target.files && target.files[0],
options = {
maxWidth: result.width(),
canvas: true
};
if (!file) {
return;
}
exifNode.hide();
thumbNode.hide();
loadImage.parseMetaData(file, function (data) {
if (data.exif) {
options.orientation = data.exif.get('Orientation');
displayExifData(data.exif);
}
displayImage(file, options);
});
},
coordinates;
// Hide URL/FileReader API requirement message in capable browsers:
if (window.createObjectURL || window.URL || window.webkitURL || window.FileReader) {
result.children().hide();
}
$(document)
.on('dragover', function (e) {
e.preventDefault();
e = e.originalEvent;
e.dataTransfer.dropEffect = 'copy';
})
.on('drop', dropChangeHandler);
$('#file-input').on('change', dropChangeHandler);
$('#edit').on('click', function (event) {
event.preventDefault();
var imgNode = result.find('img, canvas'),
img = imgNode[0];
imgNode.Jcrop({
setSelect: [40, 40, img.width - 40, img.height - 40],
onSelect: function (coords) {
coordinates = coords;
},
onRelease: function () {
coordinates = null;
}
}).parent().on('click', function (event) {
event.preventDefault();
});
});
$('#crop').on('click', function (event) {
event.preventDefault();
var img = result.find('img, canvas')[0];
if (img && coordinates) {
replaceResults(loadImage.scale(img, {
left: coordinates.x,
top: coordinates.y,
sourceWidth: coordinates.w,
sourceHeight: coordinates.h,
minWidth: result.width()
}));
coordinates = null;
}
});
});
</script>
<br>
<script src="milfs/addon/logis/js/load-image.all.min.js"></script>
<!-- <script src="js/load-image.js"></script> -->
<!-- <script src="js/load-image-ios.js"></script> -->
<!-- <script src="js/load-image-orientation.js"></script> -->
<!-- <script src="js/load-image-meta.js"></script> -->
<!-- <script src="js/load-image-exif.js"></script> -->
<!-- <script src="js/load-image-exif-map.js"></script> -->
<!-- jQuery and Jcrop are not required by JavaScript Load Image, but included for the demo -->
<!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> -->
<!-- <script src="js/vendor/jquery.Jcrop.js"></script> -->
<!-- <script src="js/demo.js"></script> -->
</div>

View File

@ -1,91 +0,0 @@
<?php
function brigadistas_grabar_imagen($data,$identificador) {
$respuesta = new xajaxResponse('utf-8');
$control = md5("$identificador");
//$form_id = $fomulario["formulario_id"];
$imagen= grabar_imagen($data,$control);
$preview = "<img src='$_SESSION[url]/images/secure/?file=150/$imagen'>";
$respuesta->addScript("javascript: document.getElementById('imagen').value= '$imagen' ;");
$respuesta->addAssign("aviso","innerHTML","$preview");
return $respuesta;
}
$xajax->registerFunction("brigadistas_grabar_imagen");
function brigadistas_grabar($formulario) {
$identificador = $formulario['identificador'];
$control = md5("$identificador");
$data = $formulario['debugConsole'];
$imagen= grabar_imagen($data,$control);
$texto_url = urlencode("#BrigadaDigital");
$uri = urlencode("$_SESSION[url]/images/secure/?file=600/$imagen");
$url ="https://twitter.com/share?url=$uri&text=$texto_url";
//$respuesta->addScript("window.location.href ='$url';");
$respuesta = new xajaxResponse('utf-8');
//$identificador = $formulario['identificador'];
$id_formulario = $formulario['formulario_id'];
$campo_imagen = buscar_campo_tipo("$id_formulario","15");
$formulario[$campo_imagen[0]][0] = $imagen;
$empresa = remplacetas('form_id','id',"$id_formulario",'id_empresa',"") ;
$id_empresa = $empresa[0];
include_once("librerias/conex.php");
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
foreach($formulario as $campo=>$valor){
if(is_array($valor)) {
foreach($valor as $c=>$v){
$consulta = "INSERT INTO form_datos ( timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
( UNIX_TIMESTAMP(),'$_SESSION[id]','$id_empresa','$id_formulario','$ip' ,'$control', '$campo' , '".mysql_real_escape_string( $v )."')
";
$sql=mysqli_query($consulta,$link);
// $campos .= " $campo // $valor // $c -> $v $consulta <br>";
}
}
}
$twitter = $formulario['498'][0];
$_SESSION['logis'] = "$control";
$_SESSION['mensaje'] = "$twitter";
$preview = "
<div class='row'>
<div class='center-block'>
<div class='thumbnail'>
<img src='$_SESSION[url]/images/secure/?file=300/$imagen'>
<h2 class='text-center'>$twitter<h2>
<a download='brigadistas.png' href='$_SESSION[url]images/secure/?file=600/$imagen' >
<span class='btn btn-default'><i class='fa fa-download'></i> </span>
</a>
<span class='btn btn-default'>
<a target= 'twitter' href ='milfs/addon/logis/funciones/twitter/tuitear.php' ><i class='fa fa-twitter'></i></a>
</span>
<a href='S58'>
<span class='btn btn-default'><i class='fa fa-eye'></i> </span>
</a>
<a href='#' onclick = \"javascript:location.reload(); \">
<span class='btn btn-default'><i class='fa fa-refresh'></i> </span>
</a>
</div>
</div>
</div>
";
$resultado = "$preview ";
$respuesta->addAssign("aviso","innerHTML","$preview");
//$respuesta->addAlert("$resultado");
//$respuesta->addScript("javascript:location.reload(true);");
return $respuesta;
}
$xajax->registerFunction("brigadistas_grabar");
?>

View File

@ -1,36 +0,0 @@
<?php
/**
* Use to autoload needed classes without Composer.
*
* @param string $class The fully-qualified class name.
* @return void
*/
spl_autoload_register(function ($class) {
// project-specific namespace prefix
$prefix = 'Abraham\\TwitterOAuth\\';
// base directory for the namespace prefix
$base_dir = __DIR__ . '/src/';
// does the class use the namespace prefix?
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
// no, move to the next registered autoloader
return;
}
// get the relative class name
$relative_class = substr($class, $len);
// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
// if the file exists, require it
if (file_exists($file)) {
require $file;
}
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

View File

@ -1,6 +0,0 @@
<?php
define('CONSUMER_KEY', 'QS1JHXs7OgJcFArJmMv117JEn');
define('CONSUMER_SECRET', 'NoO1FUXHmTB74HUrnDbcs64XgZoroBkaPav8w0FgbK3ZYSU9PZ');
define('OAUTH_CALLBACK', 'http://datos.labmde.org/milfs/toa/hola.php');
?>

View File

@ -1,31 +0,0 @@
<?php
ini_set('display_errors', 1);
require 'autoload.php';
use Abraham\TwitterOAuth\TwitterOAuth;
/*
define('CONSUMER_KEY', getenv('wMtivKDSAgZmkP7EZhYcfw'));
define('CONSUMER_SECRET', getenv('AvWbHfjuSJkZYhkxsU8ojsDpNtvapBoiRUzwF3OAvbo'));
define('OAUTH_CALLBACK', getenv('http://datos.labmde.org/milfs/toa/hola.php'));
*/
define('CONSUMER_KEY', 'QS1JHXs7OgJcFArJmMv117JEn');
define('CONSUMER_SECRET', 'NoO1FUXHmTB74HUrnDbcs64XgZoroBkaPav8w0FgbK3ZYSU9PZ');
define('OAUTH_CALLBACK', 'http://datos.labmde.org/milfs/addon/logis/funciones/twitter/hola.php');
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
//print $connection; //print connection contents
//$request_token = $connection->oauth('oauth/request_token', array('oauth_callback' => OAUTH_CALLBACK));
$request_token = $connection->oauth('oauth/request_token');
//$url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
$user = $connection->get("account/verify_credentials");
//print $user->screen_name;
print_r($user);
// Post Update
$content = $connection->post('statuses/update', array('status' => 'Bonito dia'));
print_r( $content);
print_r($url);
//print_r($request_token); //print connection contentsa
?>

View File

@ -1,65 +0,0 @@
<?php
session_start();
ini_set('display_errors', 1);
require 'autoload.php';
use Abraham\TwitterOAuth\TwitterOAuth;
require_once('config.php');
/* Crear un objeto TwitteroAuth con las credenciales de la aplicacion y el token temporal */
//$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
$_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
/* Solicitar a twitter el token de acceso */
//$access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']);
$access_token = $connection->oauth("oauth/access_token", array("oauth_verifier" => $_REQUEST['oauth_verifier']));
/* Guardar el token de acceso. Normalmente, este token se guardará también en una base
de datos para volver a ser utilizado en otras ocasiones. */
$_SESSION['access_token'] = $access_token;
/* Eliminar el token temporal de solicitud */
unset($_SESSION['oauth_token']);
unset($_SESSION['oauth_token_secret']);
/* Si todo va bien, presentar al usuario la página principal "index.php" del servicio */
//if (200 == $connection->http_code) {
/* El usuario ha sido verificado */
$_SESSION['status'] = 'verified';
echo send_tweet($access_token);
//}
function base64_encode_image ($filename=string,$filetype=string) {
if ($filename) {
$imgbinary = fread(fopen($filename, "r"), filesize($filename));
return base64_encode($imgbinary);
}
}
function send_tweet($access_token) {
$tweet = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
$access_token['oauth_token'], $access_token['oauth_token_secret']);
$nombre= $_SESSION['logis'].".png";
$nombre = "$_SESSION[path_images_secure]/600/$nombre";
$media1 = $tweet->upload('media/upload', array('media' => "$nombre"));
$parameters = array('status' =>"$_SESSION[mensaje] #BrigadaDigital #CD2015 http://datos.labmde.org/jlogis",'media_ids' => implode(',', array($media1->media_id_string)),
);
$result = $tweet-> post('statuses/update', $parameters);
$image = "$nombre";
$base64 = base64_encode_image (''.$image,'png');
$result = $tweet-> post('account/update_profile_image', array('image' => $base64.';type=image/jpg;filename='.$image));
// $message = "Bonito dia $nombre";
// $tweet->post('statuses/update', array('status' => "$message"));
//
}
header('Location: https://twitter.com/hashtag/CD2015');
// header('Location: ./index.php');
//} else {
//header('Location: ./clearsessions.php');
//

View File

@ -1,64 +0,0 @@
<?php
namespace Abraham\TwitterOAuth;
/**
* Handle setting and storing config for TwitterOAuth.
*
* @author Abraham Williams <abraham@abrah.am>
*/
class Config
{
/** @var int How long to wait for a response from the API */
protected $timeout = 5;
/** @var int how long to wait while connecting to the API */
protected $connectionTimeout = 5;
/**
* Decode JSON Response as associative Array
*
* @see http://php.net/manual/en/function.json-decode.php
*
* @var bool
*/
protected $decodeJsonAsArray = false;
/** @var string User-Agent header */
protected $userAgent = 'TwitterOAuth (+https://twitteroauth.com)';
/** @var array Store proxy connection details */
protected $proxy = [];
/**
* Set the connection and response timeouts.
*
* @param int $connectionTimeout
* @param int $timeout
*/
public function setTimeouts($connectionTimeout, $timeout)
{
$this->connectionTimeout = (int)$connectionTimeout;
$this->timeout = (int)$timeout;
}
/**
* @param bool $value
*/
public function setDecodeJsonAsArray($value)
{
$this->decodeJsonAsArray = (bool)$value;
}
/**
* @param string $userAgent
*/
public function setUserAgent($userAgent)
{
$this->userAgent = (string)$userAgent;
}
/**
* @param array $proxy
*/
public function setProxy(array $proxy)
{
$this->proxy = $proxy;
}
}

View File

@ -1,36 +0,0 @@
<?php
/**
* The MIT License
* Copyright (c) 2007 Andy Smith
*/
namespace Abraham\TwitterOAuth;
class Consumer
{
/** @var string */
public $key;
/** @var string */
public $secret;
/** @var string|null */
public $callbackUrl;
/**
* @param string $key
* @param string $secret
* @param null $callbackUrl
*/
public function __construct($key, $secret, $callbackUrl = null)
{
$this->key = $key;
$this->secret = $secret;
$this->callbackUrl = $callbackUrl;
}
/**
* @return string
*/
public function __toString()
{
return "Consumer[key=$this->key,secret=$this->secret]";
}
}

View File

@ -1,39 +0,0 @@
<?php
/**
* The MIT License
* Copyright (c) 2007 Andy Smith
*/
namespace Abraham\TwitterOAuth;
/**
* The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104]
* where the Signature Base String is the text and the key is the concatenated values (each first
* encoded per Parameter Encoding) of the Consumer Secret and Token Secret, separated by an '&'
* character (ASCII code 38) even if empty.
* - Chapter 9.2 ("HMAC-SHA1")
*/
class HmacSha1 extends SignatureMethod
{
/**
* {@inheritDoc}
*/
public function getName()
{
return "HMAC-SHA1";
}
/**
* {@inheritDoc}
*/
public function buildSignature(Request $request, Consumer $consumer, Token $token = null)
{
$signatureBase = $request->getSignatureBaseString();
$parts = [$consumer->secret, null !== $token ? $token->secret : ""];
$parts = Util::urlencodeRfc3986($parts);
$key = implode('&', $parts);
return base64_encode(hash_hmac('sha1', $signatureBase, $key, true));
}
}

View File

@ -1,254 +0,0 @@
<?php
/**
* The MIT License
* Copyright (c) 2007 Andy Smith
*/
namespace Abraham\TwitterOAuth;
class Request
{
protected $parameters;
protected $httpMethod;
protected $httpUrl;
public static $version = '1.0';
/**
* Constructor
*
* @param string $httpMethod
* @param string $httpUrl
* @param array|null $parameters
*/
public function __construct($httpMethod, $httpUrl, array $parameters = [])
{
$parameters = array_merge(Util::parseParameters(parse_url($httpUrl, PHP_URL_QUERY)), $parameters);
$this->parameters = $parameters;
$this->httpMethod = $httpMethod;
$this->httpUrl = $httpUrl;
}
/**
* pretty much a helper function to set up the request
*
* @param Consumer $consumer
* @param Token $token
* @param string $httpMethod
* @param string $httpUrl
* @param array $parameters
*
* @return Request
*/
public static function fromConsumerAndToken(
Consumer $consumer,
Token $token = null,
$httpMethod,
$httpUrl,
array $parameters = []
) {
$defaults = [
"oauth_version" => Request::$version,
"oauth_nonce" => Request::generateNonce(),
"oauth_timestamp" => time(),
"oauth_consumer_key" => $consumer->key
];
if (null !== $token) {
$defaults['oauth_token'] = $token->key;
}
$parameters = array_merge($defaults, $parameters);
return new Request($httpMethod, $httpUrl, $parameters);
}
/**
* @param string $name
* @param string $value
*/
public function setParameter($name, $value)
{
$this->parameters[$name] = $value;
}
/**
* @param $name
*
* @return string|null
*/
public function getParameter($name)
{
return isset($this->parameters[$name]) ? $this->parameters[$name] : null;
}
/**
* @return array
*/
public function getParameters()
{
return $this->parameters;
}
/**
* @param $name
*/
public function removeParameter($name)
{
unset($this->parameters[$name]);
}
/**
* The request parameters, sorted and concatenated into a normalized string.
*
* @return string
*/
public function getSignableParameters()
{
// Grab all parameters
$params = $this->parameters;
// Remove oauth_signature if present
// Ref: Spec: 9.1.1 ("The oauth_signature parameter MUST be excluded.")
if (isset($params['oauth_signature'])) {
unset($params['oauth_signature']);
}
return Util::buildHttpQuery($params);
}
/**
* Returns the base string of this request
*
* The base string defined as the method, the url
* and the parameters (normalized), each urlencoded
* and the concated with &.
*
* @return string
*/
public function getSignatureBaseString()
{
$parts = [
$this->getNormalizedHttpMethod(),
$this->getNormalizedHttpUrl(),
$this->getSignableParameters()
];
$parts = Util::urlencodeRfc3986($parts);
return implode('&', $parts);
}
/**
* Returns the HTTP Method in uppercase
*
* @return string
*/
public function getNormalizedHttpMethod()
{
return strtoupper($this->httpMethod);
}
/**
* parses the url and rebuilds it to be
* scheme://host/path
*
* @return string
*/
public function getNormalizedHttpUrl()
{
$parts = parse_url($this->httpUrl);
$scheme = $parts['scheme'];
$host = strtolower($parts['host']);
$path = $parts['path'];
return "$scheme://$host$path";
}
/**
* Builds a url usable for a GET request
*
* @return string
*/
public function toUrl()
{
$postData = $this->toPostdata();
$out = $this->getNormalizedHttpUrl();
if ($postData) {
$out .= '?' . $postData;
}
return $out;
}
/**
* Builds the data one would send in a POST request
*
* @return string
*/
public function toPostdata()
{
return Util::buildHttpQuery($this->parameters);
}
/**
* Builds the Authorization: header
*
* @return string
* @throws TwitterOAuthException
*/
public function toHeader()
{
$first = true;
$out = 'Authorization: OAuth';
foreach ($this->parameters as $k => $v) {
if (substr($k, 0, 5) != "oauth") {
continue;
}
if (is_array($v)) {
throw new TwitterOAuthException('Arrays not supported in headers');
}
$out .= ($first) ? ' ' : ', ';
$out .= Util::urlencodeRfc3986($k) . '="' . Util::urlencodeRfc3986($v) . '"';
$first = false;
}
return $out;
}
/**
* @return string
*/
public function __toString()
{
return $this->toUrl();
}
/**
* @param SignatureMethod $signatureMethod
* @param Consumer $consumer
* @param Token $token
*/
public function signRequest(SignatureMethod $signatureMethod, Consumer $consumer, Token $token = null)
{
$this->setParameter("oauth_signature_method", $signatureMethod->getName());
$signature = $this->buildSignature($signatureMethod, $consumer, $token);
$this->setParameter("oauth_signature", $signature);
}
/**
* @param SignatureMethod $signatureMethod
* @param Consumer $consumer
* @param Token $token
*
* @return string
*/
public function buildSignature(SignatureMethod $signatureMethod, Consumer $consumer, Token $token = null)
{
return $signatureMethod->buildSignature($this, $consumer, $token);
}
/**
* @return string
*/
public static function generateNonce()
{
return md5(microtime() . mt_rand());
}
}

View File

@ -1,107 +0,0 @@
<?php
namespace Abraham\TwitterOAuth;
/**
* The result of the most recent API request.
*
* @author Abraham Williams <abraham@abrah.am>
*/
class Response
{
/** @var string|null API path from the most recent request */
private $apiPath;
/** @var int HTTP status code from the most recent request */
private $httpCode = 0;
/** @var array HTTP headers from the most recent request */
private $headers = [];
/** @var array|object Response body from the most recent request */
private $body = [];
/** @var array HTTP headers from the most recent request that start with X */
private $xHeaders = [];
/**
* @param string $apiPath
*/
public function setApiPath($apiPath)
{
$this->apiPath = $apiPath;
}
/**
* @return string|null
*/
public function getApiPath()
{
return $this->apiPath;
}
/**
* @param array|object $body
*/
public function setBody($body)
{
$this->body = $body;
}
/**
* @return array|object|string
*/
public function getBody()
{
return $this->body;
}
/**
* @param int $httpCode
*/
public function setHttpCode($httpCode)
{
$this->httpCode = $httpCode;
}
/**
* @return int
*/
public function getHttpCode()
{
return $this->httpCode;
}
/**
* @param array $headers
*/
public function setHeaders($headers)
{
foreach ($headers as $key => $value) {
if (substr($key, 0, 1) == 'x') {
$this->xHeaders[$key] = $value;
}
}
$this->headers = $headers;
}
/**
* @return array
*/
public function getsHeaders()
{
return $this->headers;
}
/**
* @param array $xHeaders
*/
public function setXHeaders($xHeaders)
{
$this->xHeaders = $xHeaders;
}
/**
* @return array
*/
public function getXHeaders()
{
return $this->xHeaders;
}
}

View File

@ -1,66 +0,0 @@
<?php
/**
* The MIT License
* Copyright (c) 2007 Andy Smith
*/
namespace Abraham\TwitterOAuth;
/**
* A class for implementing a Signature Method
* See section 9 ("Signing Requests") in the spec
*/
abstract class SignatureMethod
{
/**
* Needs to return the name of the Signature Method (ie HMAC-SHA1)
*
* @return string
*/
abstract public function getName();
/**
* Build up the signature
* NOTE: The output of this function MUST NOT be urlencoded.
* the encoding is handled in OAuthRequest when the final
* request is serialized
*
* @param Request $request
* @param Consumer $consumer
* @param Token $token
*
* @return string
*/
abstract public function buildSignature(Request $request, Consumer $consumer, Token $token = null);
/**
* Verifies that a given signature is correct
*
* @param Request $request
* @param Consumer $consumer
* @param Token $token
* @param string $signature
*
* @return bool
*/
public function checkSignature(Request $request, Consumer $consumer, Token $token, $signature)
{
$built = $this->buildSignature($request, $consumer, $token);
// Check for zero length, although unlikely here
if (strlen($built) == 0 || strlen($signature) == 0) {
return false;
}
if (strlen($built) != strlen($signature)) {
return false;
}
// Avoid a timing leak with a (hopefully) time insensitive compare
$result = 0;
for ($i = 0; $i < strlen($signature); $i++) {
$result |= ord($built{$i}) ^ ord($signature{$i});
}
return $result == 0;
}
}

View File

@ -1,38 +0,0 @@
<?php
/**
* The MIT License
* Copyright (c) 2007 Andy Smith
*/
namespace Abraham\TwitterOAuth;
class Token
{
/** @var string */
public $key;
/** @var string */
public $secret;
/**
* @param string $key The OAuth Token
* @param string $secret The OAuth Token Secret
*/
public function __construct($key, $secret)
{
$this->key = $key;
$this->secret = $secret;
}
/**
* Generates the basic string serialization of a token that a server
* would respond to request_token and access_token calls with
*
* @return string
*/
public function __toString()
{
return sprintf("oauth_token=%s&oauth_token_secret=%s",
Util::urlencodeRfc3986($this->key),
Util::urlencodeRfc3986($this->secret)
);
}
}

View File

@ -1,448 +0,0 @@
<?php
/**
* The most popular PHP library for use with the Twitter OAuth REST API.
*
* @license MIT
*/
namespace Abraham\TwitterOAuth;
use Abraham\TwitterOAuth\Util\JsonDecoder;
/**
* TwitterOAuth class for interacting with the Twitter API.
*
* @author Abraham Williams <abraham@abrah.am>
*/
class TwitterOAuth extends Config
{
const API_VERSION = '1.1';
const API_HOST = 'https://api.twitter.com';
const UPLOAD_HOST = 'https://upload.twitter.com';
const UPLOAD_CHUNK = 40960; // 1024 * 40
/** @var Response details about the result of the last request */
private $response;
/** @var string|null Application bearer token */
private $bearer;
/** @var Consumer Twitter application details */
private $consumer;
/** @var Token|null User access token details */
private $token;
/** @var HmacSha1 OAuth 1 signature type used by Twitter */
private $signatureMethod;
/**
* Constructor
*
* @param string $consumerKey The Application Consumer Key
* @param string $consumerSecret The Application Consumer Secret
* @param string|null $oauthToken The Client Token (optional)
* @param string|null $oauthTokenSecret The Client Token Secret (optional)
*/
public function __construct($consumerKey, $consumerSecret, $oauthToken = null, $oauthTokenSecret = null)
{
$this->resetLastResponse();
$this->signatureMethod = new HmacSha1();
$this->consumer = new Consumer($consumerKey, $consumerSecret);
if (!empty($oauthToken) && !empty($oauthTokenSecret)) {
$this->token = new Token($oauthToken, $oauthTokenSecret);
}
if (empty($oauthToken) && !empty($oauthTokenSecret)) {
$this->bearer = $oauthTokenSecret;
}
}
/**
* @param string $oauthToken
* @param string $oauthTokenSecret
*/
public function setOauthToken($oauthToken, $oauthTokenSecret)
{
$this->token = new Token($oauthToken, $oauthTokenSecret);
}
/**
* @return string|null
*/
public function getLastApiPath()
{
return $this->response->getApiPath();
}
/**
* @return int
*/
public function getLastHttpCode()
{
return $this->response->getHttpCode();
}
/**
* @return array
*/
public function getLastXHeaders()
{
return $this->response->getXHeaders();
}
/**
* @return array|object|null
*/
public function getLastBody()
{
return $this->response->getBody();
}
/**
* Resets the last response cache.
*/
public function resetLastResponse()
{
$this->response = new Response();
}
/**
* Make URLs for user browser navigation.
*
* @param string $path
* @param array $parameters
*
* @return string
*/
public function url($path, array $parameters)
{
$this->resetLastResponse();
$this->response->setApiPath($path);
$query = http_build_query($parameters);
return sprintf('%s/%s?%s', self::API_HOST, $path, $query);
}
/**
* Make /oauth/* requests to the API.
*
* @param string $path
* @param array $parameters
*
* @return array
* @throws TwitterOAuthException
*/
public function oauth($path, array $parameters = [])
{
$response = [];
$this->resetLastResponse();
$this->response->setApiPath($path);
$url = sprintf('%s/%s', self::API_HOST, $path);
$result = $this->oAuthRequest($url, 'POST', $parameters);
if ($this->getLastHttpCode() != 200) {
throw new TwitterOAuthException($result);
}
parse_str($result, $response);
$this->response->setBody($response);
return $response;
}
/**
* Make /oauth2/* requests to the API.
*
* @param string $path
* @param array $parameters
*
* @return array|object
*/
public function oauth2($path, array $parameters = [])
{
$method = 'POST';
$this->resetLastResponse();
$this->response->setApiPath($path);
$url = sprintf('%s/%s', self::API_HOST, $path);
$request = Request::fromConsumerAndToken($this->consumer, $this->token, $method, $url, $parameters);
$authorization = 'Authorization: Basic ' . $this->encodeAppAuthorization($this->consumer);
$result = $this->request($request->getNormalizedHttpUrl(), $method, $authorization, $parameters);
$response = JsonDecoder::decode($result, $this->decodeJsonAsArray);
$this->response->setBody($response);
return $response;
}
/**
* Make GET requests to the API.
*
* @param string $path
* @param array $parameters
*
* @return array|object
*/
public function get($path, array $parameters = [])
{
return $this->http('GET', self::API_HOST, $path, $parameters);
}
/**
* Make POST requests to the API.
*
* @param string $path
* @param array $parameters
*
* @return array|object
*/
public function post($path, array $parameters = [])
{
return $this->http('POST', self::API_HOST, $path, $parameters);
}
/**
* Make DELETE requests to the API.
*
* @param string $path
* @param array $parameters
*
* @return array|object
*/
public function delete($path, array $parameters = [])
{
return $this->http('DELETE', self::API_HOST, $path, $parameters);
}
/**
* Make PUT requests to the API.
*
* @param string $path
* @param array $parameters
*
* @return array|object
*/
public function put($path, array $parameters = [])
{
return $this->http('PUT', self::API_HOST, $path, $parameters);
}
/**
* Upload media to upload.twitter.com.
*
* @param string $path
* @param array $parameters
* @param boolean $chunked
*
* @return array|object
*/
public function upload($path, array $parameters = [], $chunked = false)
{
if ($chunked) {
return $this->uploadMediaChunked($path, $parameters);
} else {
return $this->uploadMediaNotChunked($path, $parameters);
}
}
/**
* Private method to upload media (not chunked) to upload.twitter.com.
*
* @param string $path
* @param array $parameters
*
* @return array|object
*/
private function uploadMediaNotChunked($path, $parameters)
{
$file = file_get_contents($parameters['media']);
$base = base64_encode($file);
$parameters['media'] = $base;
return $this->http('POST', self::UPLOAD_HOST, $path, $parameters);
}
/**
* Private method to upload media (chunked) to upload.twitter.com.
*
* @param string $path
* @param array $parameters
*
* @return array|object
*/
private function uploadMediaChunked($path, $parameters)
{
// Init
$init = $this->http('POST', self::UPLOAD_HOST, $path, [
'command' => 'INIT',
'media_type' => $parameters['media_type'],
'total_bytes' => filesize($parameters['media'])
]);
// Append
$segment_index = 0;
$media = fopen($parameters['media'], 'rb');
while (!feof($media))
{
$this->http('POST', self::UPLOAD_HOST, 'media/upload', [
'command' => 'APPEND',
'media_id' => $init->media_id_string,
'segment_index' => $segment_index++,
'media_data' => base64_encode(fread($media, self::UPLOAD_CHUNK))
]);
}
fclose($media);
// Finalize
$finalize = $this->http('POST', self::UPLOAD_HOST, 'media/upload', [
'command' => 'FINALIZE',
'media_id' => $init->media_id_string
]);
return $finalize;
}
/**
* @param string $method
* @param string $host
* @param string $path
* @param array $parameters
*
* @return array|object
*/
private function http($method, $host, $path, array $parameters)
{
$this->resetLastResponse();
$url = sprintf('%s/%s/%s.json', $host, self::API_VERSION, $path);
$this->response->setApiPath($path);
$result = $this->oAuthRequest($url, $method, $parameters);
$response = JsonDecoder::decode($result, $this->decodeJsonAsArray);
$this->response->setBody($response);
return $response;
}
/**
* Format and sign an OAuth / API request
*
* @param string $url
* @param string $method
* @param array $parameters
*
* @return string
* @throws TwitterOAuthException
*/
private function oAuthRequest($url, $method, array $parameters)
{
$request = Request::fromConsumerAndToken($this->consumer, $this->token, $method, $url, $parameters);
if (array_key_exists('oauth_callback', $parameters)) {
// Twitter doesn't like oauth_callback as a parameter.
unset($parameters['oauth_callback']);
}
if ($this->bearer === null) {
$request->signRequest($this->signatureMethod, $this->consumer, $this->token);
$authorization = $request->toHeader();
} else {
$authorization = 'Authorization: Bearer ' . $this->bearer;
}
return $this->request($request->getNormalizedHttpUrl(), $method, $authorization, $parameters);
}
/**
* Make an HTTP request
*
* @param string $url
* @param string $method
* @param string $authorization
* @param array $postfields
*
* @return string
* @throws TwitterOAuthException
*/
private function request($url, $method, $authorization, $postfields)
{
/* Curl settings */
$options = [
// CURLOPT_VERBOSE => true,
CURLOPT_CAINFO => __DIR__ . DIRECTORY_SEPARATOR . 'cacert.pem',
CURLOPT_CONNECTTIMEOUT => $this->connectionTimeout,
CURLOPT_HEADER => true,
CURLOPT_HTTPHEADER => ['Accept: application/json', $authorization, 'Expect:'],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_TIMEOUT => $this->timeout,
CURLOPT_URL => $url,
CURLOPT_USERAGENT => $this->userAgent,
CURLOPT_ENCODING => 'gzip',
];
if (!empty($this->proxy)) {
$options[CURLOPT_PROXY] = $this->proxy['CURLOPT_PROXY'];
$options[CURLOPT_PROXYUSERPWD] = $this->proxy['CURLOPT_PROXYUSERPWD'];
$options[CURLOPT_PROXYPORT] = $this->proxy['CURLOPT_PROXYPORT'];
$options[CURLOPT_PROXYAUTH] = CURLAUTH_BASIC;
$options[CURLOPT_PROXYTYPE] = CURLPROXY_HTTP;
}
switch ($method) {
case 'GET':
break;
case 'POST':
$options[CURLOPT_POST] = true;
$options[CURLOPT_POSTFIELDS] = Util::buildHttpQuery($postfields);
break;
case 'DELETE':
$options[CURLOPT_CUSTOMREQUEST] = 'DELETE';
break;
case 'PUT':
$options[CURLOPT_CUSTOMREQUEST] = 'PUT';
break;
}
if (in_array($method, ['GET', 'PUT', 'DELETE']) && !empty($postfields)) {
$options[CURLOPT_URL] .= '?' . Util::buildHttpQuery($postfields);
}
$curlHandle = curl_init();
curl_setopt_array($curlHandle, $options);
$response = curl_exec($curlHandle);
// Throw exceptions on cURL errors.
if (curl_errno($curlHandle) > 0) {
throw new TwitterOAuthException(curl_error($curlHandle), curl_errno($curlHandle));
}
$this->response->setHttpCode(curl_getinfo($curlHandle, CURLINFO_HTTP_CODE));
$parts = explode("\r\n\r\n", $response);
$responseBody = array_pop($parts);
$responseHeader = array_pop($parts);
$this->response->setHeaders($this->parseHeaders($responseHeader));
curl_close($curlHandle);
return $responseBody;
}
/**
* Get the header info to store.
*
* @param string $header
*
* @return array
*/
private function parseHeaders($header)
{
$headers = [];
foreach (explode("\r\n", $header) as $line) {
if (strpos($line, ':') !== false) {
list ($key, $value) = explode(': ', $line);
$key = str_replace('-', '_', strtolower($key));
$headers[$key] = trim($value);
}
}
return $headers;
}
/**
* Encode application authorization header with base64.
*
* @param Consumer $consumer
*
* @return string
*/
private function encodeAppAuthorization($consumer)
{
// TODO: key and secret should be rfc 1738 encoded
$key = $consumer->key;
$secret = $consumer->secret;
return base64_encode($key . ':' . $secret);
}
}

View File

@ -1,10 +0,0 @@
<?php
namespace Abraham\TwitterOAuth;
/**
* @author Abraham Williams <abraham@abrah.am>
*/
class TwitterOAuthException extends \Exception
{
}

View File

@ -1,115 +0,0 @@
<?php
/**
* The MIT License
* Copyright (c) 2007 Andy Smith
*/
namespace Abraham\TwitterOAuth;
class Util
{
/**
* @param $input
*
* @return array|mixed|string
*/
public static function urlencodeRfc3986($input)
{
$output = '';
if (is_array($input)) {
$output = array_map([__NAMESPACE__ . '\Util', 'urlencodeRfc3986'], $input);
} elseif (is_scalar($input)) {
$output = rawurlencode($input);
}
return $output;
}
/**
* @param string $string
*
* @return string
*/
public static function urldecodeRfc3986($string)
{
return urldecode($string);
}
/**
* This function takes a input like a=b&a=c&d=e and returns the parsed
* parameters like this
* array('a' => array('b','c'), 'd' => 'e')
*
* @param mixed $input
*
* @return array
*/
public static function parseParameters($input)
{
if (!isset($input) || !$input) {
return [];
}
$pairs = explode('&', $input);
$parameters = [];
foreach ($pairs as $pair) {
$split = explode('=', $pair, 2);
$parameter = Util::urldecodeRfc3986($split[0]);
$value = isset($split[1]) ? Util::urldecodeRfc3986($split[1]) : '';
if (isset($parameters[$parameter])) {
// We have already recieved parameter(s) with this name, so add to the list
// of parameters with this name
if (is_scalar($parameters[$parameter])) {
// This is the first duplicate, so transform scalar (string) into an array
// so we can add the duplicates
$parameters[$parameter] = [$parameters[$parameter]];
}
$parameters[$parameter][] = $value;
} else {
$parameters[$parameter] = $value;
}
}
return $parameters;
}
/**
* @param $params
*
* @return string
*/
public static function buildHttpQuery($params)
{
if (!$params) {
return '';
}
// Urlencode both keys and values
$keys = Util::urlencodeRfc3986(array_keys($params));
$values = Util::urlencodeRfc3986(array_values($params));
$params = array_combine($keys, $values);
// Parameters are sorted by name, using lexicographical byte value ordering.
// Ref: Spec: 9.1.1 (1)
uksort($params, 'strcmp');
$pairs = [];
foreach ($params as $parameter => $value) {
if (is_array($value)) {
// If two or more parameters share the same name, they are sorted by their value
// Ref: Spec: 9.1.1 (1)
// June 12th, 2010 - changed to sort because of issue 164 by hidetaka
sort($value, SORT_STRING);
foreach ($value as $duplicateValue) {
$pairs[] = $parameter . '=' . $duplicateValue;
}
} else {
$pairs[] = $parameter . '=' . $value;
}
}
// For each parameter, the name is separated from the corresponding value by an '=' character (ASCII code 61)
// Each name-value pair is separated by an '&' character (ASCII code 38)
return implode('&', $pairs);
}
}

View File

@ -1,26 +0,0 @@
<?php
namespace Abraham\TwitterOAuth\Util;
/**
* @author louis <louis@systemli.org>
*/
class JsonDecoder
{
/**
* Decodes a JSON string to stdObject or associative array
*
* @param string $string
* @param bool $asArray
*
* @return array|object
*/
public static function decode($string, $asArray)
{
if (version_compare(PHP_VERSION, '5.4.0', '>=') && !(defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) {
return json_decode($string, $asArray, 512, JSON_BIGINT_AS_STRING);
}
return json_decode($string, $asArray);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +0,0 @@
<?php
session_start();
ini_set('display_errors', 1);
require 'autoload.php';
use Abraham\TwitterOAuth\TwitterOAuth;
require_once('config.php');
/* Prepara la conexión */
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
/* Solicita a twitter las credenciales temporales */
//$request_token = $connection->getRequestToken(OAUTH_CALLBACK);
$request_token = $connection->oauth('oauth/request_token');
/* Guarda la credenciales temporales en sesión. */
$_SESSION['oauth_token'] = $token = $request_token['oauth_token'];
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
//switch ($connection->http_code) {
// case 200:
/* Construye la url de autorización y envía al usuario a Twitter. */
$url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
//$url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
//$url = $connection->getAuthorizeURL($token);
// print $url;
header('Location: ' . $url);
//break;
// default:
/* Indica que se ha producido un error. */
// echo 'Error de conexión a Twitter.';
// echo "\nHTTP CODE: " . $connection->http_code;
//}

View File

@ -1,177 +0,0 @@
<?php session_start();
ini_set('display_errors', 'On');
if(isset($_REQUEST['debug'])) {ini_set('display_errors', 'On');}
include_once("$_SESSION[path]/funciones/conex.php");
echo brigadistas_grabar($_POST);
function brigadistas_grabar($formulario) {
$identificador = $_POST['identificador'];
$control = md5("$identificador");
$data = $_POST['debugConsole'];
$imagen= grabar_imagen($data,$control);
$texto_url = urlencode("#BrigadaDigital");
$uri = urlencode("$_SESSION[url]/images/secure/?file=600/$imagen");
$url ="https://twitter.com/share?url=$uri&text=$texto_url";
//$respuesta->addScript("window.location.href ='$url';");
$preview = "
<div class='row'>
<div class='center-block'>
<div class='thumbnail'>
<img src='$_SESSION[url]/images/secure/?file=300/$imagen'>
<a download='brigadistas.png' href='$_SESSION[url]images/secure/?file=600/$imagen' >
<span class='btn btn-default'><i class='fa fa-download'></i> </span>
</a>
<span class='btn btn-default'>
<a onclick =\"javascript:window.location.href ='$url'; \" ><i class='fa fa-twitter'></i> </a>
</span>
<a href='?set=$formulario[formulario_id]&embebido'>
<span class='btn btn-default'><i class='fa fa-eye'></i> </span>
</a>
<a href='#' onclick = \"javascript:location.reload(); \">
<span class='btn btn-default'><i class='fa fa-refresh'></i> </span>
</a>
</div>
</div>
</div>
";
//$respuesta = new xajaxResponse('utf-8');
//$identificador = $formulario['identificador'];
$id_formulario = $_POST['formulario_id'];
$campo_imagen = buscar_campo_tipo("$id_formulario","15");
$_POST[$campo_imagen[0]][0] = $imagen;
$empresa = remplacetas('form_id','id',"$id_formulario",'id_empresa',"") ;
$id_empresa = $empresa[0];
include_once("$_SESSION[path]/funciones/conex.php");
//include_once("$_SESSION[url]funciones/conex.php");
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$ip = obtener_ip();
$ip = " INET_ATON('".$ip."') ";
foreach($_POST as $campo=>$valor){
if(is_array($valor)) {
foreach($valor as $c=>$v){
$consulta = "INSERT INTO form_datos ( timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
( UNIX_TIMESTAMP(),'$_SESSION[id]','$id_empresa','$id_formulario','$ip' ,'$control', '$campo' , '$v')
";
$sql=mysqli_query($consulta,$link);
// $campos .= " $campo // $valor // $c -> $v $consulta <br>";
}
}
}
$resultado = "$preview $consulta ";
///$respuesta->addAssign("aviso","innerHTML","$preview");
//$respuesta->addAlert("$resultado");
//$respuesta->addScript("javascript:location.reload(true);");
return $resultado;
}
function remplacetas($tabla,$campo,$valor,$por,$and){
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
if(@$and !=''){$AND = "AND $and";}else{$AND ="";}
//$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by $campo DESC limit 1";
$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by id DESC limit 1";
$sql=mysqli_query($consulta,$link);
if (@mysql_num_rows($sql)!=0){
$resultado[] = mysql_result($sql,0,$por);
$resultado[] = mysql_result($sql,0,'id');
$resultado[] = $consulta;
$resultado[] = mysql_result($sql,0,"md5_$por");
}else{
$resultado[0] = '';
$resultado[1] ="";
$resultado[2] = $consulta;
$resultado[3] = NULL;
}
return $resultado;
}
function grabar_imagen($imagen,$control) {
$imgData = str_replace(' ','+',$imagen);
$imgData = substr($imgData,strpos($imgData,",")+1);
$imgData = base64_decode($imgData);
$nombre= $control.".png";
$filePath = "$_SESSION[path]/tmp/".$nombre;
$file = fopen($filePath, 'w');
fwrite($file, $imgData);
fclose($file);
$full= "$_SESSION[path_images_secure]/full/".$nombre;
if (!rename($filePath,$full)){}
else {
echo generar_miniatura($nombre,"150");
echo generar_miniatura($nombre,"300");
echo generar_miniatura($nombre,"600");
}
//return "$nombre";
return "$nombre";
}
function generar_miniatura($file,$width) { //$archivo = $file;
$archivo = "$_SESSION[path_images_secure]/full/".$file; // Ponemos el . antes del nombre del archivo porque estamos considerando que la ruta está a partir del archivo thumb.php $file_info = getimagesize($archivo); // Obtenemos la relación de aspecto $ratio = $file_info[0] / $file_info[1]; // Calculamos las nuevas dimensiones $newwidth = $width; $newheight = round($newwidth / $ratio); // Sacamos la extensión del archivo $ext = explode(".", $file); $ext = strtolower($ext[count($ext) - 1]); if ($ext == "jpeg") $ext = "jpg"; // Dependiendo de la extensión llamamos a distintas funciones switch ($ext) { case "jpg": $img = imagecreatefromjpeg($archivo); break; case "png": $img = imagecreatefrompng($archivo); break; case "gif": $img = imagecreatefromgif($archivo); break; } // Creamos la miniatura $thumb = imagecreatetruecolor($newwidth, $newheight);
imagealphablending( $thumb, false );
imagesavealpha( $thumb, true ); // La redimensionamos imagecopyresampled($thumb, $img, 0, 0, 0, 0, $newwidth, $newheight, $file_info[0], $file_info[1]); // La mostramos como jpg //header("Content-type: image/jpeg"); imagejpeg($thumb,"$_SESSION[path_images_secure]/".$width."/$file", 80);
imagepng($thumb,"$_SESSION[path_images_secure]/".$width."/$file", 9);
//imagegif($thumb,"$_SESSION[path_images_secure]/".$width."/$file");
//imagejpeg($thumb,null, 80);
}
function buscar_campo_tipo($id,$tipo) {
//// esta función retorna el id para un campo de un tipo especifico dentro de un formulario.
$consulta ="SELECT form_campos.id, form_campos.campo_nombre FROM form_tipo_campo,form_campos,form_contenido_campos
WHERE form_tipo_campo.id_tipo_campo = form_campos.campo_tipo
AND form_contenido_campos.id_campo = form_campos.id
AND form_tipo_campo.id_tipo_campo = '$tipo'
AND form_contenido_campos.id_form = '$id'";
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
if (mysql_num_rows($sql)!='0'){
$resultado[0]=mysql_result($sql,0,"id");
$resultado[1]=mysql_result($sql,0,"campo_nombre");
$resultado[2] =$consulta;
}else{ $resultado[0]='';
$resultado[2] =$consulta;
}
return $resultado;
}
function obtener_ip()
{
if (isset($_SERVER["HTTP_CLIENT_IP"]))
{
return $_SERVER["HTTP_CLIENT_IP"];
}
elseif (isset($_SERVER["HTTP_X_FORWARDED_FOR"]))
{
return $_SERVER["HTTP_X_FORWARDED_FOR"];
}
elseif (isset($_SERVER["HTTP_X_FORWARDED"]))
{
return $_SERVER["HTTP_X_FORWARDED"];
}
elseif (isset($_SERVER["HTTP_FORWARDED_FOR"]))
{
return $_SERVER["HTTP_FORWARDED_FOR"];
}
elseif (isset($_SERVER["HTTP_FORWARDED"]))
{
return $_SERVER["HTTP_FORWARDED"];
}
else
{
return $_SERVER["REMOTE_ADDR"];
}
}
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

View File

@ -1,13 +0,0 @@
/*
* JavaScript Load Image Demo JS 1.9.1
* https://github.com/blueimp/JavaScript-Load-Image
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/

View File

@ -1,143 +0,0 @@
/*
* JavaScript Load Image Meta 1.0.2
* https://github.com/blueimp/JavaScript-Load-Image
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Image meta data handling implementation
* based on the help and contribution of
* Achim Stöhr.
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
/*jslint continue:true */
/*global define, window, DataView, Blob, Uint8Array, console */
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
define(['load-image'], factory);
} else {
// Browser globals:
factory(window.loadImage);
}
}(function (loadImage) {
'use strict';
var hasblobSlice = window.Blob && (Blob.prototype.slice ||
Blob.prototype.webkitSlice || Blob.prototype.mozSlice);
loadImage.blobSlice = hasblobSlice && function () {
var slice = this.slice || this.webkitSlice || this.mozSlice;
return slice.apply(this, arguments);
};
loadImage.metaDataParsers = {
jpeg: {
0xffe1: [] // APP1 marker
}
};
// Parses image meta data and calls the callback with an object argument
// with the following properties:
// * imageHead: The complete image head as ArrayBuffer (Uint8Array for IE10)
// The options arguments accepts an object and supports the following properties:
// * maxMetaDataSize: Defines the maximum number of bytes to parse.
// * disableImageHead: Disables creating the imageHead property.
loadImage.parseMetaData = function (file, callback, options) {
options = options || {};
var that = this,
// 256 KiB should contain all EXIF/ICC/IPTC segments:
maxMetaDataSize = options.maxMetaDataSize || 262144,
data = {},
noMetaData = !(window.DataView && file && file.size >= 12 &&
file.type === 'image/jpeg' && loadImage.blobSlice);
if (noMetaData || !loadImage.readFile(
loadImage.blobSlice.call(file, 0, maxMetaDataSize),
function (e) {
if (e.target.error) {
// FileReader error
console.log(e.target.error);
callback(data);
return;
}
// Note on endianness:
// Since the marker and length bytes in JPEG files are always
// stored in big endian order, we can leave the endian parameter
// of the DataView methods undefined, defaulting to big endian.
var buffer = e.target.result,
dataView = new DataView(buffer),
offset = 2,
maxOffset = dataView.byteLength - 4,
headLength = offset,
markerBytes,
markerLength,
parsers,
i;
// Check for the JPEG marker (0xffd8):
if (dataView.getUint16(0) === 0xffd8) {
while (offset < maxOffset) {
markerBytes = dataView.getUint16(offset);
// Search for APPn (0xffeN) and COM (0xfffe) markers,
// which contain application-specific meta-data like
// Exif, ICC and IPTC data and text comments:
if ((markerBytes >= 0xffe0 && markerBytes <= 0xffef) ||
markerBytes === 0xfffe) {
// The marker bytes (2) are always followed by
// the length bytes (2), indicating the length of the
// marker segment, which includes the length bytes,
// but not the marker bytes, so we add 2:
markerLength = dataView.getUint16(offset + 2) + 2;
if (offset + markerLength > dataView.byteLength) {
console.log('Invalid meta data: Invalid segment size.');
break;
}
parsers = loadImage.metaDataParsers.jpeg[markerBytes];
if (parsers) {
for (i = 0; i < parsers.length; i += 1) {
parsers[i].call(
that,
dataView,
offset,
markerLength,
data,
options
);
}
}
offset += markerLength;
headLength = offset;
} else {
// Not an APPn or COM marker, probably safe to
// assume that this is the end of the meta data
break;
}
}
// Meta length must be longer than JPEG marker (2)
// plus APPn marker (2), followed by length bytes (2):
if (!options.disableImageHead && headLength > 6) {
if (buffer.slice) {
data.imageHead = buffer.slice(0, headLength);
} else {
// Workaround for IE10, which does not yet
// support ArrayBuffer.slice:
data.imageHead = new Uint8Array(buffer)
.subarray(0, headLength);
}
}
} else {
console.log('Invalid JPEG file: Missing JPEG marker.');
}
callback(data);
},
'readAsArrayBuffer'
)) {
callback(data);
}
};
}));

View File

@ -1,166 +0,0 @@
/*
* JavaScript Load Image Orientation 1.1.0
* https://github.com/blueimp/JavaScript-Load-Image
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
/*global define, window */
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
define(['load-image'], factory);
} else {
// Browser globals:
factory(window.loadImage);
}
}(function (loadImage) {
'use strict';
var originalHasCanvasOption = loadImage.hasCanvasOption,
originalTransformCoordinates = loadImage.transformCoordinates,
originalGetTransformedOptions = loadImage.getTransformedOptions;
// This method is used to determine if the target image
// should be a canvas element:
loadImage.hasCanvasOption = function (options) {
return originalHasCanvasOption.call(loadImage, options) ||
options.orientation;
};
// Transform image orientation based on
// the given EXIF orientation option:
loadImage.transformCoordinates = function (canvas, options) {
originalTransformCoordinates.call(loadImage, canvas, options);
var ctx = canvas.getContext('2d'),
width = canvas.width,
height = canvas.height,
orientation = options.orientation;
if (!orientation || orientation > 8) {
return;
}
if (orientation > 4) {
canvas.width = height;
canvas.height = width;
}
switch (orientation) {
case 2:
// horizontal flip
ctx.translate(width, 0);
ctx.scale(-1, 1);
break;
case 3:
// 180° rotate left
ctx.translate(width, height);
ctx.rotate(Math.PI);
break;
case 4:
// vertical flip
ctx.translate(0, height);
ctx.scale(1, -1);
break;
case 5:
// vertical flip + 90 rotate right
ctx.rotate(0.5 * Math.PI);
ctx.scale(1, -1);
break;
case 6:
// 90° rotate right
ctx.rotate(0.5 * Math.PI);
ctx.translate(0, -height);
break;
case 7:
// horizontal flip + 90 rotate right
ctx.rotate(0.5 * Math.PI);
ctx.translate(width, -height);
ctx.scale(-1, 1);
break;
case 8:
// 90° rotate left
ctx.rotate(-0.5 * Math.PI);
ctx.translate(-width, 0);
break;
}
};
// Transforms coordinate and dimension options
// based on the given orientation option:
loadImage.getTransformedOptions = function (img, opts) {
var options = originalGetTransformedOptions.call(loadImage, img, opts),
orientation = options.orientation,
newOptions,
i;
if (!orientation || orientation > 8 || orientation === 1) {
return options;
}
newOptions = {};
for (i in options) {
if (options.hasOwnProperty(i)) {
newOptions[i] = options[i];
}
}
switch (options.orientation) {
case 2:
// horizontal flip
newOptions.left = options.right;
newOptions.right = options.left;
break;
case 3:
// 180° rotate left
newOptions.left = options.right;
newOptions.top = options.bottom;
newOptions.right = options.left;
newOptions.bottom = options.top;
break;
case 4:
// vertical flip
newOptions.top = options.bottom;
newOptions.bottom = options.top;
break;
case 5:
// vertical flip + 90 rotate right
newOptions.left = options.top;
newOptions.top = options.left;
newOptions.right = options.bottom;
newOptions.bottom = options.right;
break;
case 6:
// 90° rotate right
newOptions.left = options.top;
newOptions.top = options.right;
newOptions.right = options.bottom;
newOptions.bottom = options.left;
break;
case 7:
// horizontal flip + 90 rotate right
newOptions.left = options.bottom;
newOptions.top = options.right;
newOptions.right = options.top;
newOptions.bottom = options.left;
break;
case 8:
// 90° rotate left
newOptions.left = options.bottom;
newOptions.top = options.left;
newOptions.right = options.top;
newOptions.bottom = options.right;
break;
}
if (options.orientation > 4) {
newOptions.maxWidth = options.maxHeight;
newOptions.maxHeight = options.maxWidth;
newOptions.minWidth = options.minHeight;
newOptions.minHeight = options.minWidth;
newOptions.sourceWidth = options.sourceHeight;
newOptions.sourceHeight = options.sourceWidth;
}
return newOptions;
};
}));

File diff suppressed because one or more lines are too long

View File

@ -1,305 +0,0 @@
/*
* JavaScript Load Image 1.10.0
* https://github.com/blueimp/JavaScript-Load-Image
*
* Copyright 2011, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
/*jslint nomen: true */
/*global define, window, document, URL, webkitURL, Blob, File, FileReader */
(function ($) {
'use strict';
// Loads an image for a given File object.
// Invokes the callback with an img or optional canvas
// element (if supported by the browser) as parameter:
var loadImage = function (file, callback, options) {
var img = document.createElement('img'),
url,
oUrl;
//img.setAttribute('class', 'watermark');
// img.setAttribute('id', 'image_output2');
img.onerror = callback;
img.onload = function () {
if (oUrl && !(options && options.noRevoke)) {
loadImage.revokeObjectURL(oUrl);
}
if (callback) {
callback(loadImage.scale(img, options));
}
};
if (loadImage.isInstanceOf('Blob', file) ||
// Files are also Blob instances, but some browsers
// (Firefox 3.6) support the File API but not Blobs:
loadImage.isInstanceOf('File', file)) {
url = oUrl = loadImage.createObjectURL(file);
// Store the file type for resize processing:
img._type = file.type;
} else if (typeof file === 'string') {
url = file;
if (options && options.crossOrigin) {
img.crossOrigin = options.crossOrigin;
}
} else {
return false;
}
if (url) {
img.src = url;
//document.getElementById('image_output').src = url ;
//document.getElementById('image_output').className = "watermark" ;
return img;
}
return loadImage.readFile(file, function (e) {
var target = e.target;
if (target && target.result) {
img.src = target.result;
} else {
if (callback) {
callback(e);
}
}
});
},
// The check for URL.revokeObjectURL fixes an issue with Opera 12,
// which provides URL.createObjectURL but doesn't properly implement it:
urlAPI = (window.createObjectURL && window) ||
(window.URL && URL.revokeObjectURL && URL) ||
(window.webkitURL && webkitURL);
loadImage.isInstanceOf = function (type, obj) {
// Cross-frame instanceof check
return Object.prototype.toString.call(obj) === '[object ' + type + ']';
};
// Transform image coordinates, allows to override e.g.
// the canvas orientation based on the orientation option,
// gets canvas, options passed as arguments:
loadImage.transformCoordinates = function () {
return;
};
// Returns transformed options, allows to override e.g.
// maxWidth, maxHeight and crop options based on the aspectRatio.
// gets img, options passed as arguments:
loadImage.getTransformedOptions = function (img, options) {
var aspectRatio = options.aspectRatio,
newOptions,
i,
width,
height;
if (!aspectRatio) {
return options;
}
newOptions = {};
for (i in options) {
if (options.hasOwnProperty(i)) {
newOptions[i] = options[i];
}
}
newOptions.crop = true;
width = img.naturalWidth || img.width;
height = img.naturalHeight || img.height;
if (width / height > aspectRatio) {
newOptions.maxWidth = height * aspectRatio;
newOptions.maxHeight = height;
} else {
newOptions.maxWidth = width;
newOptions.maxHeight = width / aspectRatio;
}
return newOptions;
};
// Canvas render method, allows to override the
// rendering e.g. to work around issues on iOS:
loadImage.renderImageToCanvas = function (
canvas,
img,
sourceX,
sourceY,
sourceWidth,
sourceHeight,
destX,
destY,
destWidth,
destHeight
) {
canvas.getContext('2d').drawImage(
img,
sourceX,
sourceY,
sourceWidth,
sourceHeight,
destX,
destY,
destWidth,
destHeight
);
return canvas;
};
// This method is used to determine if the target image
// should be a canvas element:
loadImage.hasCanvasOption = function (options) {
return options.canvas || options.crop || options.aspectRatio;
};
// Scales and/or crops the given image (img or canvas HTML element)
// using the given options.
// Returns a canvas object if the browser supports canvas
// and the hasCanvasOption method returns true or a canvas
// object is passed as image, else the scaled image:
loadImage.scale = function (img, options) {
options = options || {};
var canvas = document.createElement('canvas'),
useCanvas = img.getContext ||
(loadImage.hasCanvasOption(options) && canvas.getContext),
width = img.naturalWidth || img.width,
height = img.naturalHeight || img.height,
destWidth = width,
destHeight = height,
maxWidth,
maxHeight,
minWidth,
minHeight,
sourceWidth,
sourceHeight,
sourceX,
sourceY,
tmp,
scaleUp = function () {
var scale = Math.max(
(minWidth || destWidth) / destWidth,
(minHeight || destHeight) / destHeight
);
if (scale > 1) {
destWidth = destWidth * scale;
destHeight = destHeight * scale;
}
},
scaleDown = function () {
var scale = Math.min(
(maxWidth || destWidth) / destWidth,
(maxHeight || destHeight) / destHeight
);
if (scale < 1) {
destWidth = destWidth * scale;
destHeight = destHeight * scale;
}
};
if (useCanvas) {
options = loadImage.getTransformedOptions(img, options);
sourceX = options.left || 0;
sourceY = options.top || 0;
if (options.sourceWidth) {
sourceWidth = options.sourceWidth;
if (options.right !== undefined && options.left === undefined) {
sourceX = width - sourceWidth - options.right;
}
} else {
sourceWidth = width - sourceX - (options.right || 0);
}
if (options.sourceHeight) {
sourceHeight = options.sourceHeight;
if (options.bottom !== undefined && options.top === undefined) {
sourceY = height - sourceHeight - options.bottom;
}
} else {
sourceHeight = height - sourceY - (options.bottom || 0);
}
destWidth = sourceWidth;
destHeight = sourceHeight;
}
maxWidth = options.maxWidth;
maxHeight = options.maxHeight;
minWidth = options.minWidth;
minHeight = options.minHeight;
if (useCanvas && maxWidth && maxHeight && options.crop) {
destWidth = maxWidth;
destHeight = maxHeight;
tmp = sourceWidth / sourceHeight - maxWidth / maxHeight;
if (tmp < 0) {
sourceHeight = maxHeight * sourceWidth / maxWidth;
if (options.top === undefined && options.bottom === undefined) {
sourceY = (height - sourceHeight) / 2;
}
} else if (tmp > 0) {
sourceWidth = maxWidth * sourceHeight / maxHeight;
if (options.left === undefined && options.right === undefined) {
sourceX = (width - sourceWidth) / 2;
}
}
} else {
if (options.contain || options.cover) {
minWidth = maxWidth = maxWidth || minWidth;
minHeight = maxHeight = maxHeight || minHeight;
}
if (options.cover) {
scaleDown();
scaleUp();
} else {
scaleUp();
scaleDown();
}
}
if (useCanvas) {
canvas.width = destWidth;
canvas.height = destHeight;
loadImage.transformCoordinates(
canvas,
options
);
return loadImage.renderImageToCanvas(
canvas,
img,
sourceX,
sourceY,
sourceWidth,
sourceHeight,
0,
0,
destWidth,
destHeight
);
}
img.width = destWidth;
img.height = destHeight;
return img;
};
loadImage.createObjectURL = function (file) {
return urlAPI ? urlAPI.createObjectURL(file) : false;
};
loadImage.revokeObjectURL = function (url) {
return urlAPI ? urlAPI.revokeObjectURL(url) : false;
};
// Loads a given File object via FileReader interface,
// invokes the callback with the event object (load or error).
// The result can be read via event.target.result:
loadImage.readFile = function (file, callback, method) {
if (window.FileReader) {
var fileReader = new FileReader();
fileReader.onload = fileReader.onerror = callback;
method = method || 'readAsDataURL';
if (fileReader[method]) {
fileReader[method](file);
return fileReader;
}
}
return false;
};
if (typeof define === 'function' && define.amd) {
define(function () {
return loadImage;
});
} else {
$.loadImage = loadImage;
}
}(window));

View File

@ -1,363 +0,0 @@
<?php
//include("funciones/funciones.php");
$id_formulario = "58";
$ancho = "600";
$tags = array();
$tags[] = "milfs/addon/logis/images/logos/250.png";
$imagen="";
foreach ($tags as &$valor) {
$imagen .= "<td onclick=\" document.getElementById('marca').src='$valor' ; marcar('top-left') \" ><a href='#medio' class='' >
<img class='img ' src='$valor'>
</a></td>";
}
$imagen = "
<div class='table-responsive'>
<table class='table table table-condensed text-center '>
<tr >
$imagen
</tr>
</table>
</div>";
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<div>
<style type="text/css">
.fa{
font-size:60px important!;
}
#imagen_origina{
width: <?echo $ancho ?>px;
}
body{
background-color:white !important;
}
.pin {
text-align: center;
/*border: solid 1px red;*/
opacity: 0.5;
}
.fileUpload {
position: relative;
overflow: hidden;
margin: 10px;
width: 80%;
}
.fileUpload input.upload {
position: absolute;
top: 0;
right: 0;
margin: 10;
padding: 0;
font-size: 50px;
cursor: pointer;
opacity: 0;
filter: alpha(opacity=0);
}
.ing-touch{
border: solid 5px white;
width:20% !important;
}
</style>
<div class='container' style='height:100%; backgroun-color:white;' id='aviso'>
<div class='fileUpload btn btn-primary center-block'>
<span><h1><i class="fa fa-camera"></i> + tu Foto</h1></span>
<input class='upload' type="file" id="file-input" /></span>
<div id="original" ></div>
</div>
<!-- <p><input type="file" id="file-input"></p> -->
<div id="actions" style="display:none;">
<img class="center-block" src= "<?php echo $tags[0]; ?>" style='display:none' id="marca" name="marca">
<img class="center-block" style='' id="image_output" name="image_output">
<img class="center-block" style='' id="otra_imagen" name="otra_imagen">
<div id="result" class="result">
<p></p>
</div>
<a name="arriba"></a>
<canvas id="micanvasOriginal" style="position:absolute" >
Tu navegador no soporta canvas.
</canvas>
<div style="position:relative">
<div style="position:absolute; width:100%; height:100%;" >
<table style="width:100%; height:100%;" class="">
<tr >
<td class="pin" ><a href="#arriba" onclick=" javascript: marcar('top-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:20%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:20%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
</tr>
<tr>
<td class="pin"><a name="medio"></a><a href="#arriba" onclick=" javascript: marcar('middle-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin" ><a href="#medio" onclick=" javascript: marcar('middle-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></td>
</tr>
<tr>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
</tr>
</table>
</div>
<canvas id="micanvas" style="position:absolute" >
Tu navegador no soporta canvas.
</canvas>
</div>
<div class="row " style="position:relative">
<form id='formulario_brigadistas' name='formulario_brigadistas' >
<!-- <input class='form-control' type='' id="debugConsole" name="debugConsole" > -->
<textarea class='form-control' id="debugConsole" name="debugConsole" style="display:none;" ></textarea>
<input type='hidden' id="identificador" name="identificador" >
<input type='hidden' id="formulario_id" name="formulario_id" value="<?php echo $id_formulario; ?>">
<input type='hidden' id="imagen" name="imagen" value="">
<?php $formulario = formulario_areas("$id_formulario",'campos','','');
echo $formulario; ?>
</form>
</div>
<!-- <div id='aviso'></div> -->
<div class="row">
<div class="col-md-12">
<!-- this.disabled= true; xajax_wait('aviso','Grabando... un momento por favor...'); xajax_brigadistas_grabar(xajax.getFormValues('formulario_brigadistas')) -->
<!-- <button class='fileUpload btn btn-success btn-block' onclick="document.getElementById('formulario_brigadistas').submit(); "> -->
<button class='fileUpload btn btn-success btn-block' onclick=" xajax_wait('aviso','Grabando... un momento por favor...'); xajax_brigadistas_grabar(xajax.getFormValues('formulario_brigadistas')) ; ">
<span><i class="fa fa-save"></i> <span class='fa'> Grabalo! </span></span>
</button>
</div>
</div>
</div>
<?php $ultimo = formulario_uso("$id_formulario",'','ultimo') ;
//echo $ultimo[1];
echo mostrar_identificador("$ultimo[1]","","landingpage",'simple');
?>
</div>
<script language="javascript">
function cargaContextoCanvas(idCanvas){
var elemento = document.getElementById(idCanvas);
if(elemento && elemento.getContext){
var contexto = elemento.getContext('2d');
if(contexto){
return contexto;
}
}
return FALSE;
}
function marcar(ubicacion){
//if (ubicacion == 'arriba'){ var x = '0';var y = '0';}
//if (ubicacion == 'abajo'){ var x = '10';var y = '50';}
//Recibimos el elemento canvas
var ctx = cargaContextoCanvas('micanvas');
if(ctx){
//Creo una imagen conun objeto Image de Javascript
var img = new Image();
var img2 = new Image();
//img.src = document.getElementById("image_output2").src;
//readAsDataURL(
img.src = document.getElementById("imagen_original").src;
document.getElementById("imagen_original").style.display="none";
//img2.src = 'images/logos/a.png';
img2.src = document.getElementById("marca").src;
if (ubicacion =='') {
ubicacion ='middle-center';
}
x = 0,
y = 0;
if(ubicacion.indexOf("top")!=-1)
y = 10;
else if(ubicacion.indexOf("middle")!=-1)
y = (micanvas.height - img2.height)/2;
else
y = micanvas.height-img2.height-10;
if(ubicacion.indexOf("left")!=-1)
x = 10;
else if(ubicacion.indexOf("center")!=-1)
x = (micanvas.width - img2.width) /2;
else
x = micanvas.width-img2.width-10;
var proporcion = ( img.height / img.width );
var ancho = <?echo $ancho ?>;
micanvas.width =ancho;
micanvas.height = (micanvas.width * proporcion);
micanvas.setAttribute('width', ancho);
micanvas.setAttribute('height', micanvas.height);
micanvas.setAttribute('style',"width:100%");
img.onload = function(){
ctx.drawImage(img, 0, 0,micanvas.width,micanvas.height);
ctx.drawImage(img2, x, y);
var debugConsole= document.getElementById("debugConsole");
var testCanvas = document.getElementById("micanvas");
var canvasData = testCanvas.toDataURL("image/png");
var postData = "canvasData="+canvasData;
debugConsole.value=canvasData;
var identificador = Math.random();
document.getElementById('identificador').value= identificador;
}
}
}
$(function () {
'use strict';
var result = $('#result'),
exifNode = $('#exif'),
thumbNode = $('#thumbnail'),
actionsNode = $('#actions'),
currentFile,
replaceResults = function (img) {
var content;
if (!(img.src || img instanceof HTMLCanvasElement)) {
content = $('<span>Loading image file failed</span>');
} else {
content = $('<img />').append(img)
//.attr('download', currentFile.name)
.attr('src', img.src || img.toDataURL())
.attr('width', '<?echo $ancho ?>')
.attr('style', 'width:100%')
.attr('id', 'imagen_original');
}
//document.getElementById('image_output').src = img.src;
result.children().replaceWith(content);
if (img.getContext) {
actionsNode.show();
/// render(img.src);
window.setTimeout("marcar('middle-center');", 500);
}
},
displayImage = function (file, options) {
currentFile = file;
if (!loadImage(
file,
replaceResults,
options
)) {
result.children().replaceWith(
$('<span>Your browser does not support the URL or FileReader API.</span>')
);
}
},
dropChangeHandler = function (e) {
e.preventDefault();
e = e.originalEvent;
var target = e.dataTransfer || e.target,
file = target && target.files && target.files[0],
options = {
//maxWidth: result.width(),
maxWidth: <?echo $ancho ?>,
canvas: true
};
if (!file) {
return;
}
exifNode.hide();
thumbNode.hide();
loadImage.parseMetaData(file, function (data) {
if (data.exif) {
options.orientation = data.exif.get('Orientation');
// displayExifData(data.exif);
}
displayImage(file, options);
});
},
coordinates;
// Hide URL/FileReader API requirement message in capable browsers:
if (window.createObjectURL || window.URL || window.webkitURL || window.FileReader) {
result.children().hide();
}
$(document)
.on('dragover', function (e) {
e.preventDefault();
e = e.originalEvent;
e.dataTransfer.dropEffect = 'copy';
})
.on('drop', dropChangeHandler);
$('#file-input').on('change', dropChangeHandler);
$('#edit').on('click', function (event) {
event.preventDefault();
var imgNode = result.find('img, canvas'),
img = imgNode[0];
imgNode.Jcrop({
setSelect: [40, 40, img.width - 40, img.height - 40],
onSelect: function (coords) {
coordinates = coords;
},
onRelease: function () {
coordinates = null;
}
}).parent().on('click', function (event) {
event.preventDefault();
});
});
$('#crop').on('click', function (event) {
event.preventDefault();
var img = result.find('img, canvas')[0];
if (img && coordinates) {
replaceResults(loadImage.scale(img, {
left: coordinates.x,
top: coordinates.y,
sourceWidth: coordinates.w,
sourceHeight: coordinates.h,
minWidth: result.width()
}));
coordinates = null;
}
});
});
</script>
<br>
<script src="milfs/addon/logis/js/load-image.all.min.js"></script>
<!-- <script src="js/load-image.js"></script> -->
<!-- <script src="js/load-image-ios.js"></script> -->
<!-- <script src="js/load-image-orientation.js"></script> -->
<!-- <script src="js/load-image-meta.js"></script> -->
<!-- <script src="js/load-image-exif.js"></script> -->
<!-- <script src="js/load-image-exif-map.js"></script> -->
<!-- jQuery and Jcrop are not required by JavaScript Load Image, but included for the demo -->
<!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> -->
<!-- <script src="js/vendor/jquery.Jcrop.js"></script> -->
<!-- <script src="js/demo.js"></script> -->
</div>

View File

@ -1,207 +0,0 @@
<?php
//include("funciones/funciones.php");
$id_formulario = "58";
$ancho = "600";
$tags = array();
$tags[] = "images/logos/c.png";
foreach ($tags as &$valor) {
$imagen .= "<td onclick=\" document.getElementById('marca').src='$valor' ; marcar('top-left') \" ><a href='#medio' class='' >
<img class='img ' src='$valor'>
</a></td>";
}
$imagen = "
<div class='table-responsive'>
<table class='table table table-condensed text-center '>
<tr >
$imagen
</tr>
</table>
</div>";
?>
<html lang="en">
<head>
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<![endif]-->
<meta charset="utf-8">
<title></title>
<meta name="description" content="JavaScript Load Image is a library to load images provided as File or Blob objects or via URL. It returns an optionally scaled and/or cropped HTML img or canvas element. It also provides a method to parse image meta data to extract Exif tags and thumbnails and to restore the complete image header after resizing.">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Jcrop is not required by JavaScript Load Image, but included for the demo -->
<!-- <link rel="stylesheet" href="css/vendor/jquery.Jcrop.css"> -->
<!-- <link rel="stylesheet" href="css/demo.css"> -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<style type="text/css">
.fa{
font-size:60px;
}
#imagen_origina{
width: 800px;
}
.pin {
text-align: center;
border: solid 1px red;
opacity: 0.5;
}
.fileUpload {
position: relative;
overflow: hidden;
margin: 10px;
width: 80%;
}
.fileUpload input.upload {
position: absolute;
top: 0;
right: 0;
margin: 10;
padding: 0;
font-size: 50px;
cursor: pointer;
opacity: 0;
filter: alpha(opacity=0);
}
</style>
</head>
<body>
<div class='container'>
<div class='fileUpload btn btn-primary '>
<span> <i class="fa fa-picture-o"></i> <span class='fa' > Imagen <i class="fa fa-camera"></i> </span>
<input class='upload' type="file" id="file-input" /></span>
<div id="original" ></div>
</div>
</div>
<!-- <p><input type="file" id="file-input"></p> -->
<div id="actions" style="display:none;">
<img class="center-block" src= "<?php echo $tags[0]; ?>" style='display:none' id="marca" name="marca">
<img class="center-block" style='' id="image_output" name="image_output">
<img class="center-block" style='' id="otra_imagen" name="otra_imagen">
<input type="hidden" id='identificador' name='identificador'>
<div id="result" class="result">
<p></p>
</div>
<a name="arriba"></a>
<div style="position:relative">
<div style="position:absolute; width:100%; height:100%;" >
<table style="width:100%; height:100%;" class="">
<tr >
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-left')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-center')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-rigth')"><i class="fa fa-circle-o"></i></a></td>
</tr>
<tr>
<td class="pin"><a name="medio"></a><a href="#arriba" onclick=" javascript: marcar('middle-left')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-center')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-rigth')"><i class="fa fa-circle-o"></i></td>
</tr>
<tr>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-left')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-center')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-rigth')"><i class="fa fa-circle-o"></i></a></td>
</tr>
</table>
</div>
<canvas id="micanvas" style="position:absolute" >
Tu navegador no soporta canvas.
</canvas>
</div>
</div>
<script language="javascript">
function cargaContextoCanvas(idCanvas){
var elemento = document.getElementById(idCanvas);
if(elemento && elemento.getContext){
var contexto = elemento.getContext('2d');
if(contexto){
return contexto;
}
}
return FALSE;
}
function marcar(ubicacion){
//if (ubicacion == 'arriba'){ var x = '0';var y = '0';}
//if (ubicacion == 'abajo'){ var x = '10';var y = '50';}
//Recibimos el elemento canvas
var ctx = cargaContextoCanvas('micanvas');
if(ctx){
//Creo una imagen conun objeto Image de Javascript
var img = new Image();
var img2 = new Image();
//img.src = document.getElementById("image_output2").src;
//readAsDataURL(
img.src = document.getElementById("imagen_original").src;
document.getElementById("imagen_original").style.display="none";
//img2.src = 'images/logos/a.png';
img2.src = document.getElementById("marca").src;
if (ubicacion =='') {
ubicacion ='middle-center';
}
x = 0,
y = 0;
if(ubicacion.indexOf("top")!=-1)
y = 10;
else if(ubicacion.indexOf("middle")!=-1)
y = (micanvas.height - img2.height)/2;
else
y = micanvas.height-img2.height-10;
if(ubicacion.indexOf("left")!=-1)
x = 10;
else if(ubicacion.indexOf("center")!=-1)
x = (micanvas.width - img2.width) /2;
else
x = micanvas.width-img2.width-10;
var proporcion = ( img.height / img.width );
var ancho = 800;
micanvas.width = ancho;
micanvas.height = (micanvas.width * proporcion);
micanvas.setAttribute('width', ancho);
micanvas.setAttribute('height', micanvas.height);
micanvas.setAttribute('style',"width:100%");
img.onload = function(){
ctx.drawImage(img, 0, 0,micanvas.width,micanvas.height);
ctx.drawImage(img2, x, y);
var identificador = Math.random();
document.getElementById('identificador').value= identificador;
}
}
}
</script>
<br>
<script src="js/load-image.all.min.js"></script>
<!-- <script src="js/load-image.js"></script> -->
<!-- <script src="js/load-image-ios.js"></script> -->
<!-- <script src="js/load-image-orientation.js"></script> -->
<!-- <script src="js/load-image-meta.js"></script> -->
<!-- <script src="js/load-image-exif.js"></script> -->
<!-- <script src="js/load-image-exif-map.js"></script> -->
<!-- jQuery and Jcrop are not required by JavaScript Load Image, but included for the demo -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- <script src="js/vendor/jquery.Jcrop.js"></script> -->
<script src="js/demo.js"></script>
</body>
</html>

View File

@ -1,207 +0,0 @@
<?php
//include("funciones/funciones.php");
$id_formulario = "58";
$ancho = "600";
$tags = array();
$tags[] = "images/logos/c.png";
foreach ($tags as &$valor) {
$imagen .= "<td onclick=\" document.getElementById('marca').src='$valor' ; marcar('top-left') \" ><a href='#medio' class='' >
<img class='img ' src='$valor'>
</a></td>";
}
$imagen = "
<div class='table-responsive'>
<table class='table table table-condensed text-center '>
<tr >
$imagen
</tr>
</table>
</div>";
?>
<!DOCTYPE HTML>
<html lang="en">
<head>
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<![endif]-->
<meta charset="utf-8">
<title></title>
<meta name="description" content="JavaScript Load Image is a library to load images provided as File or Blob objects or via URL. It returns an optionally scaled and/or cropped HTML img or canvas element. It also provides a method to parse image meta data to extract Exif tags and thumbnails and to restore the complete image header after resizing.">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Jcrop is not required by JavaScript Load Image, but included for the demo -->
<!-- <link rel="stylesheet" href="css/vendor/jquery.Jcrop.css"> -->
<!-- <link rel="stylesheet" href="css/demo.css"> -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<style type="text/css">
.fa{
font-size:60px;
}
#imagen_origina{
width: 800px;
}
.pin {
text-align: center;
border: solid 1px red;
opacity: 0.5;
}
.fileUpload {
position: relative;
overflow: hidden;
margin: 10px;
width: 80%;
}
.fileUpload input.upload {
position: absolute;
top: 0;
right: 0;
margin: 10;
padding: 0;
font-size: 50px;
cursor: pointer;
opacity: 0;
filter: alpha(opacity=0);
}
</style>
</head>
<body>
<div class='container'>
<div class='fileUpload btn btn-primary '>
<span> <i class="fa fa-picture-o"></i> <span class='fa' > Imagen <i class="fa fa-camera"></i> </span>
<input class='upload' type="file" id="file-input" /></span>
<div id="original" ></div>
</div>
</div>
<!-- <p><input type="file" id="file-input"></p> -->
<div id="actions" style="display:none;">
<img class="center-block" src= "<?php echo $tags[0]; ?>" style='display:none' id="marca" name="marca">
<img class="center-block" style='' id="image_output" name="image_output">
<img class="center-block" style='' id="otra_imagen" name="otra_imagen">
<input type="hidden" id='identificador' name='identificador'>
<div id="result" class="result">
<p></p>
</div>
<a name="arriba"></a>
<div style="position:relative">
<div style="position:absolute; width:100%; height:100%;" >
<table style="width:100%; height:100%;" class="">
<tr >
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-left')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-center')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-rigth')"><i class="fa fa-circle-o"></i></a></td>
</tr>
<tr>
<td class="pin"><a name="medio"></a><a href="#arriba" onclick=" javascript: marcar('middle-left')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-center')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-rigth')"><i class="fa fa-circle-o"></i></td>
</tr>
<tr>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-left')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-center')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-rigth')"><i class="fa fa-circle-o"></i></a></td>
</tr>
</table>
</div>
<canvas id="micanvas" style="position:absolute" >
Tu navegador no soporta canvas.
</canvas>
</div>
</div>
<script language="javascript">
function cargaContextoCanvas(idCanvas){
var elemento = document.getElementById(idCanvas);
if(elemento && elemento.getContext){
var contexto = elemento.getContext('2d');
if(contexto){
return contexto;
}
}
return FALSE;
}
function marcar(ubicacion){
//if (ubicacion == 'arriba'){ var x = '0';var y = '0';}
//if (ubicacion == 'abajo'){ var x = '10';var y = '50';}
//Recibimos el elemento canvas
var ctx = cargaContextoCanvas('micanvas');
if(ctx){
//Creo una imagen conun objeto Image de Javascript
var img = new Image();
var img2 = new Image();
//img.src = document.getElementById("image_output2").src;
//readAsDataURL(
img.src = document.getElementById("imagen_original").src;
document.getElementById("imagen_original").style.display="none";
//img2.src = 'images/logos/a.png';
img2.src = document.getElementById("marca").src;
if (ubicacion =='') {
ubicacion ='middle-center';
}
x = 0,
y = 0;
if(ubicacion.indexOf("top")!=-1)
y = 10;
else if(ubicacion.indexOf("middle")!=-1)
y = (micanvas.height - img2.height)/2;
else
y = micanvas.height-img2.height-10;
if(ubicacion.indexOf("left")!=-1)
x = 10;
else if(ubicacion.indexOf("center")!=-1)
x = (micanvas.width - img2.width) /2;
else
x = micanvas.width-img2.width-10;
var proporcion = ( img.height / img.width );
var ancho = 800;
micanvas.width = ancho;
micanvas.height = (micanvas.width * proporcion);
micanvas.setAttribute('width', ancho);
micanvas.setAttribute('height', micanvas.height);
micanvas.setAttribute('style',"width:100%");
img.onload = function(){
ctx.drawImage(img, 0, 0,micanvas.width,micanvas.height);
ctx.drawImage(img2, x, y);
var identificador = Math.random();
document.getElementById('identificador').value= identificador;
}
}
}
</script>
<br>
<script src="js/load-image.all.min.js"></script>
<!-- <script src="js/load-image.js"></script> -->
<!-- <script src="js/load-image-ios.js"></script> -->
<!-- <script src="js/load-image-orientation.js"></script> -->
<!-- <script src="js/load-image-meta.js"></script> -->
<!-- <script src="js/load-image-exif.js"></script> -->
<!-- <script src="js/load-image-exif-map.js"></script> -->
<!-- jQuery and Jcrop are not required by JavaScript Load Image, but included for the demo -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- <script src="js/vendor/jquery.Jcrop.js"></script> -->
<script src="js/demo.js"></script>
</body>
</html>

View File

@ -1,436 +0,0 @@
<?php
//include("funciones/funciones.php");
$id_formulario = "58";
$ancho = "600";
$tags = array();
$tags[] = "milfs/addon/brigadistas/images/logos/a.png";
$tags[] = "milfs/addon/brigadistas/images/logos/b.png";
$tags[] = "milfs/addon/brigadistas/images/logos/c.png";
foreach ($tags as &$valor) {
$imagen .= "<td><a href='#medio' class='' onclick=\" document.getElementById('marca').src='$valor' \" >
<img class='img ' src='$valor'>
</a></td>";
}
$imagen = "
<div class='table-responsive'>
<table class='table table table-condensed text-center '>
<tr>
$imagen
</tr>
</table>
</div>";
?>
<script src="https://9b8d22ae00fff2954b7cdd00a6feb4176bc56576.googledrive.com/host/0B7R2T-U-1ZrheTlfaHNQMm0zTWM/plump_modernizr.js"></script>
<link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/cabin" type="text/css"/>
<style type="text/css">
body {
font-family: 'CabinRegular';
font-weight: normal;
font-style: normal;
}
.fileUpload {
position: relative;
overflow: hidden;
margin: 10px;
}
.fileUpload input.upload {
position: absolute;
top: 0;
right: 0;
margin: 10;
padding: 0;
font-size: 50px;
cursor: pointer;
opacity: 0;
filter: alpha(opacity=0);
}
.fa{
font-size:60px;
}
#downlink_hidden , #fieldset_General , #canvas_ed , #original{
display:none;
}
#body{
background-color: white;
}
#aviso{
background-color: gray;
width: 100%;
}
</style>
<div id='aviso'>
<div id ="body" class="container" >
<div id="div_brigadistas" class="">
<span class='btn btn-primary btn-block' > <!-- <i class="fa fa-picture-o"></i> --> <span class='fa' > Elige un Logo </span></span>
<?php echo $imagen; ?>
<a name="medio"></a>
<div class="row">
<div class="col-md-12">
<div class='fileUpload btn btn-primary btn-block'>
<span> <i class="fa fa-picture-o"></i> <span class='fa' > Sube una imágen</span>
<input class='upload' type="file" id="files" name="files[]" /></span>
<div id="original" ></div>
</div>
</div>
</div>
<a name="abajo"></a>
<div class="row">
<div class="col-md-12">
<div class='container-fluid'>
<table style="" class="table text-center table-responsive">
<tr>
<td><a href="#abajo" onclick=" javascript: marcar('top-left')"><i class="fa fa-caret-square-o-left"></i></a></td>
<td><a href="#abajo" onclick=" javascript: marcar('top-center')"><i class="fa fa-caret-square-o-up"></i></a></td>
<td><a href="#abajo" onclick=" javascript: marcar('top-rigth')"><i class="fa fa-caret-square-o-right"></i></a></td>
</tr>
<tr>
<td><a href="#abajo" onclick=" javascript: marcar('middle-left')"><i class="fa fa-caret-square-o-left"></i></a></td>
<td><a href="#abajo" onclick=" javascript: marcar('middle-center')"><i class="fa fa-circle-o"></i></a></td>
<td><a href="#abajo" onclick=" javascript: marcar('middle-rigth')"><i class="fa fa-caret-square-o-right"></i></td>
</tr>
<tr>
<td><a href="#abajo" onclick=" javascript: marcar('bottom-left')"><i class="fa fa-caret-square-o-left"></i></a></td>
<td><a href="#abajo" onclick=" javascript: marcar('bottom-center')"><i class="fa fa-caret-square-o-down"></i></a></td>
<td><a href="#abajo" onclick=" javascript: marcar('bottom-rigth')"><i class="fa fa-caret-square-o-right"></i></a></td>
</tr>
</table>
</div>
</div>
</div>
<!-- editor -->
<div class='container-fluid'>
<div style="background-color:; " >
<img class="center-block" style='' id="marca" name="marca">
<div id="list" style=" "></div>
<img id='image_output2' name='image_output2' src="" class="" />
<div id='div_canvas' style='display: none'> </div>
</div>
</div>
<div class="row">
<form id='formulario_brigadistas' name='formulario_brigadistas' >
<input type='hidden' id="debugConsole" name="debugConsole" >
<input type='hidden' id="identificador" name="identificador" >
<input type='hidden' id="formulario_id" name="formulario_id" value="<?php echo $id_formulario; ?>">
<input type='hidden' id="imagen" name="imagen" value="">
<?php $formulario = formulario_areas("$id_formulario",'campos','','');
echo $formulario; ?>
</form>
</div>
<div class="row">
<div class="col-md-12">
<!-- -->
<button class='fileUpload btn btn-success btn-block' onclick=" this.disabled= true; xajax_wait('aviso','Grabando... un momento por favor...'); saveViaAJAX(); xajax_brigadistas_grabar(xajax.getFormValues('formulario_brigadistas'))">
<span><i class="fa fa-save"></i> <span class='fa'> Grabalo! </span></span>
</button>
</div>
</div>
</div><!-- fin aviso -->
</div>
</div>
<script type="text/javascript">
function convertImageToCanvas(i, image) {
var canvas = document.createElement("canvas");
canvas.width = image.width;
canvas.height = image.height;
var ctx = canvas.getContext("2d");
ctx.drawImage(image, 0, 0);
$("body").append(canvas);
};
function convertImageToCanvas(image) {
var canvas = document.createElement("canvas");
canvas.width = image.width;
canvas.height = image.height;
canvas.getContext("2d").drawImage(image, 0, 0);
return canvas;
}
function convertCanvasToImage(canvas) {
var image = new Image();
image.src = canvas.toDataURL("image/png");
return image;
}
function saveViaAJAX()
{
$(document).ready(function() {
function convertImageToCanvas(i, image) {
var canvasOld = document.getElementById("holamundo");
// canvasOld.holamundo.removeChild(canvasOld);
document.getElementById("div_canvas").innerHTML=""
var canvas = document.createElement("canvas");
div = document.getElementById('div_canvas');
canvas.width = image.width;
canvas.height = image.height;
canvas.id = "holamundo";
var ctx = canvas.getContext("2d");
ctx.drawImage(image, 0, 0);
div.appendChild(canvas);
};
$('.watermark').each(convertImageToCanvas);
});
var testCanvas = document.getElementById("holamundo");
var canvasData = testCanvas.toDataURL("image/png");
var postData = "canvasData="+canvasData;
var debugConsole= document.getElementById("debugConsole");
debugConsole.value=canvasData;
}
function archivo(evt) {
var files = evt.target.files; // FileList object
// Obtenemos la imagen del campo "file".
for (var i = 0, f; f = files[i]; i++) {
//Solo admitimos imágenes.
if (!f.type.match('image.*')) {
continue;
}
var reader = new FileReader();
reader.onload = (function(theFile) {
return function(e) {
// Insertamos la imagen
document.getElementById("original").innerHTML = ['<img id="image_output2" name="image_output2" src="', e.target.result,'" title="', escape(theFile.name), '"/>'].join('');
document.getElementById("list").innerHTML = ['<img style="width:<?php echo $ancho; ?>px;" id="image_output" name="image_output" class="img img-responsive watermark center-block" src="', e.target.result,'" title="', escape(theFile.name), '"/>'].join('');
};
})(f);
reader.readAsDataURL(f);
}
}
document.getElementById('files').addEventListener('change', archivo, false);
/* marca */
(function(w){
var wm = (function(w){
var doc = w.document,
gcanvas = {},
gctx = {},
imgQueue = [],
className = "watermark",
watermark = false,
watermarkPosition = "bottom-right",
watermarkPath = "<?php echo $tags['1']; ?>"+(+(new Date())),
opacity = (255/(100/50)), // 50%
initCanvas = function(){
gcanvas = doc.createElement("canvas");
gcanvas.style.cssText = "display:none;";
gctx = gcanvas.getContext("2d");
doc.body.appendChild(gcanvas);
},
initWatermark = function(){
watermark = new Image();
watermark.src = "";
watermark.src = watermarkPath;
if(opacity != 255){
if(!watermark.complete)
watermark.onload = function(){
applyTransparency();
}
else
applyTransparency();
}else{
applyWatermarks();
}
},
// function for applying transparency to the watermark
applyTransparency = function(){
var w = watermark.width || watermark.offsetWidth,
h = watermark.height || watermark.offsetHeight;
setCanvasSize(w, h);
gctx.drawImage(watermark, 0, 0);
var image = gctx.getImageData(0, 0, w, h);
var imageData = image.data,
length = imageData.length;
for(var i=3; i < length; i+=4){
imageData[i] = (imageData[i]<opacity)?imageData[i]:opacity;
}
image.data = imageData;
gctx.putImageData(image, 0, 0);
watermark.onload = null;
watermark.src = "";
watermark.src = gcanvas.toDataURL();
// assign img attributes to the transparent watermark
// because browsers recalculation doesn't work as fast as needed
watermark.width = w;
watermark.height = h;
applyWatermarks();
},
configure = function(config){
if(config["watermark"])
watermark = config["watermark"];
if(config["path"])
watermarkPath = config["path"];
if(config["position"])
watermarkPosition = config["position"];
if(config["opacity"])
opacity = (255/(100/config["opacity"]));
if(config["className"])
className = config["className"];
initCanvas();
initWatermark();
}
setCanvasSize = function(w, h){
gcanvas.width = w;
gcanvas.height = h;
},
applyWatermark = function(img){
/*
var f = image.height / image.width;
var newHeight = canvas.width * f;
*/
var proporcion = ( img.height / img.width );
var ancho = <?php echo $ancho; ?>;
//var alto_orginal = img.height;
//var alto = (alto_original * proporcion);
//alert("hola pro"+alto);
gcanvas.width = ancho;// || img.offsetWidth;
//gcanvas.width = img.width || img.offsetWidth;
//gcanvas.height = img.height || img.offsetHeight;
gcanvas.height = (gcanvas.width * proporcion);// || img.offsetHeight;
gctx.drawImage(img, 0, 0,ancho,gcanvas.height);
var position = watermarkPosition,
x = 0,
y = 0;
if(position.indexOf("top")!=-1)
y = 20;
else if(position.indexOf("middle")!=-1)
y = (gcanvas.height -watermark.height)/2;
else
y = gcanvas.height-watermark.height-20;
if(position.indexOf("left")!=-1)
x = 20;
else if(position.indexOf("center")!=-1)
x = (gcanvas.width - watermark.width) /2;
else
x = gcanvas.width-watermark.width-20;
gctx.drawImage(watermark, x, y);
img.onload = null;
img.src = gcanvas.toDataURL();
},
applyWatermarks = function(){
setTimeout(function(){
var els = doc.getElementsByClassName(className),
len = els.length;
while(len--){
var img = els[len];
if(img.tagName.toUpperCase() != "IMG")
continue;
if(!img.complete){
img.onload = function(){
applyWatermark(this);
};
}else{
applyWatermark(img);
}
}
},10);
};
return {
init: function(config){
configure(config);
}
};
})(w);
w.wmark = wm;
})(window);
/* marca */
</script>
<script>
function marcar(position){
var position = position;
var original = document.getElementById('image_output2').src ;
var marca = document.getElementById('marca').src ;
document.getElementById('image_output').src = original ;
wmark.init({
/* config goes here */
"position": position, // default "bottom-right"
"opacity": 100, // default 50
"className": "watermark", // default "watermark"
"path": marca
// "path": "../milfs/addon/machitroll/images/054843d530f3c83fcdbd55e688d874ec.png"
});
var identificador = Math.random();
document.getElementById('identificador').value= identificador;
//window.setTimeout("saveViaAJAX()", 3000); ///
//saveViaAJAX(); ///
//xajax_wait('aviso','Subiendo imágen');
//window.setTimeout("xajax_machitroll_grabar_imagen(document.getElementById('debugConsole').value,"+identificador+")", 5000);
}
</script>

View File

@ -1,84 +0,0 @@
<?php
function brigadiastas_grabar_imagen($data,$identificador) {
$respuesta = new xajaxResponse('utf-8');
$control = md5("$identificador");
//$form_id = $fomulario["formulario_id"];
$imagen= grabar_imagen($data,$control);
$preview = "<img src='$_SESSION[url]/images/secure/?file=150/$imagen'>";
$respuesta->addScript("javascript: document.getElementById('imagen').value= '$imagen' ;");
$respuesta->addAssign("aviso","innerHTML","$preview");
return $respuesta;
}
$xajax->registerFunction("brigadistas_grabar_imagen");
function brigadistas_grabar($formulario) {
$identificador = $formulario['identificador'];
$control = md5("$identificador");
$data = $formulario['debugConsole'];
$imagen= grabar_imagen($data,$control);
$texto_url = urlencode("#BrigadaDigital");
$uri = urlencode("$_SESSION[url]/images/secure/?file=600/$imagen");
$url ="https://twitter.com/share?url=$uri&text=$texto_url";
//$respuesta->addScript("window.location.href ='$url';");
$preview = "
<div class='row'>
<div class='center-block'>
<div class='thumbnail'>
<img src='$_SESSION[url]/images/secure/?file=300/$imagen'>
<a download='brigadistas.png' href='$_SESSION[url]images/secure/?file=600/$imagen' >
<span class='btn btn-default'><i class='fa fa-download'></i> </span>
</a>
<span class='btn btn-default'>
<a onclick =\"javascript:window.location.href ='$url'; \" ><i class='fa fa-twitter'></i> </a>
</span>
<a href='?set=$formulario[formulario_id]&embebido'>
<span class='btn btn-default'><i class='fa fa-eye'></i> </span>
</a>
<a href='#' onclick = \"javascript:location.reload(); \">
<span class='btn btn-default'><i class='fa fa-refresh'></i> </span>
</a>
</div>
</div>
</div>
";
$respuesta = new xajaxResponse('utf-8');
//$identificador = $formulario['identificador'];
$id_formulario = $formulario['formulario_id'];
$campo_imagen = buscar_campo_tipo("$id_formulario","15");
$formulario[$campo_imagen[0]][0] = $imagen;
$empresa = remplacetas('form_id','id',"$id_formulario",'id_empresa',"") ;
$id_empresa = $empresa[0];
include_once("librerias/conex.php");
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
foreach($formulario as $campo=>$valor){
if(is_array($valor)) {
foreach($valor as $c=>$v){
$consulta = "INSERT INTO form_datos ( timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
( UNIX_TIMESTAMP(),'$_SESSION[id]','$id_empresa','$id_formulario','$ip' ,'$control', '$campo' , '$v')
";
$sql=mysqli_query($consulta,$link);
// $campos .= " $campo // $valor // $c -> $v $consulta <br>";
}
}
}
$resultado = "$preview ";
$respuesta->addAssign("aviso","innerHTML","$preview");
//$respuesta->addAlert("$resultado");
//$respuesta->addScript("javascript:location.reload(true);");
return $respuesta;
}
$xajax->registerFunction("brigadistas_grabar");
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

View File

@ -1,6 +0,0 @@
<?php
require("machitroll/funciones/funciones.php");
require("logis/funciones/funciones.php");
require("tuitealo/funciones/funciones.php");
//require("dummy/funciones/funciones.php");
?>

View File

@ -1,510 +0,0 @@
<?php
//include("funciones/funciones.php");
$id_formulario = "58";
$ancho = "500";
$tags = array();
$tags[] = "milfs/addon/logis/images/logos/c.png";
foreach ($tags as &$valor) {
$imagen .= "<td onclick=\" document.getElementById('marca').src='$valor' ; marcar('top-left') \" ><a href='#medio' class='' >
<img class='img ' src='$valor'>
</a></td>";
}
$imagen = "
<div class='table-responsive'>
<table class='table table table-condensed text-center '>
<tr >
$imagen
</tr>
</table>
</div>";
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<div>
<style type="text/css">
.fa{
font-size:60px important!;
}
#imagen_origina{
width: <?echo $ancho ?>px;
}
body{
background-color:white !important;
}
.pin {
text-align: center;
/*border: solid 1px red;*/
opacity: 0.5;
}
.fileUpload {
position: relative;
overflow: hidden;
margin: 10px;
width: 80%;
}
.fileUpload input.upload {
position: absolute;
top: 0;
right: 0;
margin: 10;
padding: 0;
font-size: 50px;
cursor: pointer;
opacity: 0;
filter: alpha(opacity=0);
}
.ing-touch{
border: solid 1px red;
width:20% !important;
}
</style>
<div class='container' style='backgroun-color:white;' >
<div class='fileUpload btn btn-primary center-block'>
<span><h1><i class="fa fa-camera"></i></h1></span>
<input class='upload' type="file" id="file-input" /></span>
<div id="original" ></div>
</div>
<!-- <p><input type="file" id="file-input"></p> -->
<div id="actions" style="display:none;">
<img class="center-block" src= "<?php echo $tags[0]; ?>" style='display:none' id="marca" name="marca">
<img class="center-block" style='' id="image_output" name="image_output">
<img class="center-block" style='' id="otra_imagen" name="otra_imagen">
<div id="result" class="result">
<p></p>
</div>
<a name="arriba"></a>
<div style="position:relative">
<div style="position:absolute; width:100%; height:100%;" >
<table style="width:100%; height:100%;" class="">
<tr >
<td class="pin" ><a href="#arriba" onclick=" javascript: marcar('top-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:20%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:20%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
</tr>
<tr>
<td class="pin"><a name="medio"></a><a href="#arriba" onclick=" javascript: marcar('middle-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin" ><a href="#medio" onclick=" javascript: marcar('middle-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></td>
</tr>
<tr>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
</tr>
</table>
</div>
<canvas id="micanvas" style="position:absolute" >
Tu navegador no soporta canvas.
</canvas>
</div>
<div class="row " style="position:relative">
<form id='formulario_brigadistas' name='formulario_brigadistas' >
<input class='form-control' type='' id="debugConsole" name="debugConsole" >
<input type='' id="identificador" name="identificador" >
<input type='hidden' id="formulario_id" name="formulario_id" value="<?php echo $id_formulario; ?>">
<input type='hidden' id="imagen" name="imagen" value="">
<?php $formulario = formulario_areas("$id_formulario",'campos','','');
echo $formulario; ?>
</form>
</div>
<div id='aviso'>Aviso</div>
<div class="row">
<div class="col-md-12">
<!-- this.disabled= true; xajax_wait('aviso','Grabando... un momento por favor...'); -->
<button class='fileUpload btn btn-success btn-block' onclick=" xajax_brigadistas_grabar(xajax.getFormValues('formulario_brigadistas'))">
<span><i class="fa fa-save"></i> <span class='fa'> Grabalo! </span></span>
</button>
</div>
</div>
</div>
</div>
<script language="javascript">
$(function () {
'use strict';
var result = $('#result'),
exifNode = $('#exif'),
thumbNode = $('#thumbnail'),
actionsNode = $('#actions'),
currentFile,
replaceResults = function (img) {
var content;
if (!(img.src || img instanceof HTMLCanvasElement)) {
content = $('<span>Loading image file failed</span>');
} else {
content = $('<img />').append(img)
//.attr('download', currentFile.name)
.attr('src', img.src || img.toDataURL())
.attr('width', '<?echo $ancho ?>px')
.attr('style', 'width:100%')
.attr('id', 'imagen_original');
}
//document.getElementById('image_output').src = img.src;
result.children().replaceWith(content);
if (img.getContext) {
actionsNode.show();
window.setTimeout("marcar('middle-center');", 500);
}
},
displayImage = function (file, options) {
currentFile = file;
if (!loadImage(
file,
replaceResults,
options
)) {
result.children().replaceWith(
$('<span>Your browser does not support the URL or FileReader API.</span>')
);
}
},
displayExifData = function (exif) {
var thumbnail = exif.get('Thumbnail'),
tags = exif.getAll(),
table = exifNode.find('table').empty(),
row = $('<tr></tr>'),
cell = $('<td></td>'),
prop;
if (thumbnail) {
thumbNode.empty();
loadImage(thumbnail, function (img) {
thumbNode.append(img).show();
}, {orientation: exif.get('Orientation')});
}
for (prop in tags) {
if (tags.hasOwnProperty(prop)) {
table.append(
row.clone()
.append(cell.clone().text(prop))
.append(cell.clone().text(tags[prop]))
);
}
}
exifNode.show();
},
dropChangeHandler = function (e) {
e.preventDefault();
e = e.originalEvent;
var target = e.dataTransfer || e.target,
file = target && target.files && target.files[0],
options = {
maxWidth: result.width(),
canvas: true
};
if (!file) {
return;
}
exifNode.hide();
thumbNode.hide();
loadImage.parseMetaData(file, function (data) {
if (data.exif) {
options.orientation = data.exif.get('Orientation');
displayExifData(data.exif);
}
displayImage(file, options);
});
},
coordinates;
// Hide URL/FileReader API requirement message in capable browsers:
if (window.createObjectURL || window.URL || window.webkitURL || window.FileReader) {
result.children().hide();
}
$(document)
.on('dragover', function (e) {
e.preventDefault();
e = e.originalEvent;
e.dataTransfer.dropEffect = 'copy';
})
.on('drop', dropChangeHandler);
$('#file-input').on('change', dropChangeHandler);
$('#edit').on('click', function (event) {
event.preventDefault();
var imgNode = result.find('img, canvas'),
img = imgNode[0];
imgNode.Jcrop({
setSelect: [40, 40, img.width - 40, img.height - 40],
onSelect: function (coords) {
coordinates = coords;
},
onRelease: function () {
coordinates = null;
}
}).parent().on('click', function (event) {
event.preventDefault();
});
});
$('#crop').on('click', function (event) {
event.preventDefault();
var img = result.find('img, canvas')[0];
if (img && coordinates) {
replaceResults(loadImage.scale(img, {
left: coordinates.x,
top: coordinates.y,
sourceWidth: coordinates.w,
sourceHeight: coordinates.h,
minWidth: result.width()
}));
coordinates = null;
}
});
});
</script>
<script language="javascript">
function cargaContextoCanvas(idCanvas){
var elemento = document.getElementById(idCanvas);
if(elemento && elemento.getContext){
var contexto = elemento.getContext('2d');
if(contexto){
return contexto;
}
}
return FALSE;
}
function marcar(ubicacion){
//if (ubicacion == 'arriba'){ var x = '0';var y = '0';}
//if (ubicacion == 'abajo'){ var x = '10';var y = '50';}
//Recibimos el elemento canvas
var ctx = cargaContextoCanvas('micanvas');
if(ctx){
//Creo una imagen conun objeto Image de Javascript
var img = new Image();
var img2 = new Image();
//img.src = document.getElementById("image_output2").src;
//readAsDataURL(
img.src = document.getElementById("imagen_original").src;
document.getElementById("imagen_original").style.display="none";
//img2.src = 'images/logos/a.png';
img2.src = document.getElementById("marca").src;
if (ubicacion =='') {
ubicacion ='middle-center';
}
x = 0,
y = 0;
if(ubicacion.indexOf("top")!=-1)
y = 10;
else if(ubicacion.indexOf("middle")!=-1)
y = (micanvas.height - img2.height)/2;
else
y = micanvas.height-img2.height-10;
if(ubicacion.indexOf("left")!=-1)
x = 10;
else if(ubicacion.indexOf("center")!=-1)
x = (micanvas.width - img2.width) /2;
else
x = micanvas.width-img2.width-10;
var proporcion = ( img.height / img.width );
var ancho = <?echo $ancho ?>;
micanvas.width =ancho;
micanvas.height = (micanvas.width * proporcion);
micanvas.setAttribute('width', ancho);
micanvas.setAttribute('height', micanvas.height);
micanvas.setAttribute('style',"width:100%");
img.onload = function(){
ctx.drawImage(img, 0, 0,micanvas.width,micanvas.height);
ctx.drawImage(img2, x, y);
var debugConsole= document.getElementById("debugConsole");
var testCanvas = document.getElementById("micanvas");
var canvasData = testCanvas.toDataURL("image/png");
var postData = "canvasData="+canvasData;
debugConsole.value=canvasData;
var identificador = Math.random();
document.getElementById('identificador').value= identificador;
}
}
}
$(function () {
'use strict';
var result = $('#result'),
exifNode = $('#exif'),
thumbNode = $('#thumbnail'),
actionsNode = $('#actions'),
currentFile,
replaceResults = function (img) {
var content;
if (!(img.src || img instanceof HTMLCanvasElement)) {
content = $('<span>Loading image file failed</span>');
} else {
content = $('<img />').append(img)
//.attr('download', currentFile.name)
.attr('src', img.src || img.toDataURL())
.attr('width', '<?echo $ancho ?>')
.attr('style', 'width:100%')
.attr('id', 'imagen_original');
}
//document.getElementById('image_output').src = img.src;
result.children().replaceWith(content);
if (img.getContext) {
actionsNode.show();
window.setTimeout("marcar('middle-center');", 500);
}
},
displayImage = function (file, options) {
currentFile = file;
if (!loadImage(
file,
replaceResults,
options
)) {
result.children().replaceWith(
$('<span>Your browser does not support the URL or FileReader API.</span>')
);
}
},
displayExifData = function (exif) {
var thumbnail = exif.get('Thumbnail'),
tags = exif.getAll(),
table = exifNode.find('table').empty(),
row = $('<tr></tr>'),
cell = $('<td></td>'),
prop;
if (thumbnail) {
thumbNode.empty();
loadImage(thumbnail, function (img) {
thumbNode.append(img).show();
}, {orientation: exif.get('Orientation')});
}
for (prop in tags) {
if (tags.hasOwnProperty(prop)) {
table.append(
row.clone()
.append(cell.clone().text(prop))
.append(cell.clone().text(tags[prop]))
);
}
}
exifNode.show();
},
dropChangeHandler = function (e) {
e.preventDefault();
e = e.originalEvent;
var target = e.dataTransfer || e.target,
file = target && target.files && target.files[0],
options = {
maxWidth: result.width(),
canvas: true
};
if (!file) {
return;
}
exifNode.hide();
thumbNode.hide();
loadImage.parseMetaData(file, function (data) {
if (data.exif) {
options.orientation = data.exif.get('Orientation');
displayExifData(data.exif);
}
displayImage(file, options);
});
},
coordinates;
// Hide URL/FileReader API requirement message in capable browsers:
if (window.createObjectURL || window.URL || window.webkitURL || window.FileReader) {
result.children().hide();
}
$(document)
.on('dragover', function (e) {
e.preventDefault();
e = e.originalEvent;
e.dataTransfer.dropEffect = 'copy';
})
.on('drop', dropChangeHandler);
$('#file-input').on('change', dropChangeHandler);
$('#edit').on('click', function (event) {
event.preventDefault();
var imgNode = result.find('img, canvas'),
img = imgNode[0];
imgNode.Jcrop({
setSelect: [40, 40, img.width - 40, img.height - 40],
onSelect: function (coords) {
coordinates = coords;
},
onRelease: function () {
coordinates = null;
}
}).parent().on('click', function (event) {
event.preventDefault();
});
});
$('#crop').on('click', function (event) {
event.preventDefault();
var img = result.find('img, canvas')[0];
if (img && coordinates) {
replaceResults(loadImage.scale(img, {
left: coordinates.x,
top: coordinates.y,
sourceWidth: coordinates.w,
sourceHeight: coordinates.h,
minWidth: result.width()
}));
coordinates = null;
}
});
});
</script>
<br>
<script src="milfs/addon/logis/js/load-image.all.min.js"></script>
<!-- <script src="js/load-image.js"></script> -->
<!-- <script src="js/load-image-ios.js"></script> -->
<!-- <script src="js/load-image-orientation.js"></script> -->
<!-- <script src="js/load-image-meta.js"></script> -->
<!-- <script src="js/load-image-exif.js"></script> -->
<!-- <script src="js/load-image-exif-map.js"></script> -->
<!-- jQuery and Jcrop are not required by JavaScript Load Image, but included for the demo -->
<!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> -->
<!-- <script src="js/vendor/jquery.Jcrop.js"></script> -->
<!-- <script src="js/demo.js"></script> -->
</div>

View File

@ -1,91 +0,0 @@
<?php
function brigadistas_grabar_imagen($data,$identificador) {
$respuesta = new xajaxResponse('utf-8');
$control = md5("$identificador");
//$form_id = $fomulario["formulario_id"];
$imagen= grabar_imagen($data,$control);
$preview = "<img src='$_SESSION[url]/images/secure/?file=150/$imagen'>";
$respuesta->addScript("javascript: document.getElementById('imagen').value= '$imagen' ;");
$respuesta->addAssign("aviso","innerHTML","$preview");
return $respuesta;
}
$xajax->registerFunction("brigadistas_grabar_imagen");
function brigadistas_grabar($formulario) {
$identificador = $formulario['identificador'];
$control = md5("$identificador");
$data = $formulario['debugConsole'];
$imagen= grabar_imagen($data,$control);
$texto_url = urlencode("#BrigadaDigital");
$uri = urlencode("$_SESSION[url]/images/secure/?file=600/$imagen");
$url ="https://twitter.com/share?url=$uri&text=$texto_url";
//$respuesta->addScript("window.location.href ='$url';");
$respuesta = new xajaxResponse('utf-8');
//$identificador = $formulario['identificador'];
$id_formulario = $formulario['formulario_id'];
$campo_imagen = buscar_campo_tipo("$id_formulario","15");
$formulario[$campo_imagen[0]][0] = $imagen;
$empresa = remplacetas('form_id','id',"$id_formulario",'id_empresa',"") ;
$id_empresa = $empresa[0];
include_once("librerias/conex.php");
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
foreach($formulario as $campo=>$valor){
if(is_array($valor)) {
foreach($valor as $c=>$v){
$consulta = "INSERT INTO form_datos ( timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
( UNIX_TIMESTAMP(),'$_SESSION[id]','$id_empresa','$id_formulario','$ip' ,'$control', '$campo' , '".mysql_real_escape_string( $v )."')
";
$sql=mysqli_query($consulta,$link);
// $campos .= " $campo // $valor // $c -> $v $consulta <br>";
}
}
}
$twitter = $formulario['498'][0];
$_SESSION['logis'] = "$control";
$_SESSION['mensaje'] = "$twitter";
$preview = "
<div class='row'>
<div class='center-block'>
<div class='thumbnail'>
<img src='$_SESSION[url]/images/secure/?file=300/$imagen'>
<h2 class='text-center'>$twitter<h2>
<a download='brigadistas.png' href='$_SESSION[url]images/secure/?file=600/$imagen' >
<span class='btn btn-default'><i class='fa fa-download'></i> </span>
</a>
<span class='btn btn-default'>
<a target= 'twitter' href ='milfs/addon/logis/funciones/twitter/tuitear.php' ><i class='fa fa-twitter'></i></a>
</span>
<a href='S58'>
<span class='btn btn-default'><i class='fa fa-eye'></i> Ver</span>
</a>
<a href='#' onclick = \"javascript:location.reload(); \">
<span class='btn btn-default'><i class='fa fa-refresh'></i> Actualizar</span>
</a>
</div>
</div>
</div>
";
$resultado = "$preview ";
$respuesta->addAssign("aviso","innerHTML","$preview");
//$respuesta->addAlert("$resultado");
//$respuesta->addScript("javascript:location.reload(true);");
return $respuesta;
}
$xajax->registerFunction("brigadistas_grabar");
?>

View File

@ -1,36 +0,0 @@
<?php
/**
* Use to autoload needed classes without Composer.
*
* @param string $class The fully-qualified class name.
* @return void
*/
spl_autoload_register(function ($class) {
// project-specific namespace prefix
$prefix = 'Abraham\\TwitterOAuth\\';
// base directory for the namespace prefix
$base_dir = __DIR__ . '/src/';
// does the class use the namespace prefix?
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
// no, move to the next registered autoloader
return;
}
// get the relative class name
$relative_class = substr($class, $len);
// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
// if the file exists, require it
if (file_exists($file)) {
require $file;
}
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

View File

@ -1,6 +0,0 @@
<?php
define('CONSUMER_KEY', 'QS1JHXs7OgJcFArJmMv117JEn');
define('CONSUMER_SECRET', 'NoO1FUXHmTB74HUrnDbcs64XgZoroBkaPav8w0FgbK3ZYSU9PZ');
define('OAUTH_CALLBACK', 'http://datos.labmde.org/milfs/toa/hola.php');
?>

View File

@ -1,31 +0,0 @@
<?php
ini_set('display_errors', 1);
require 'autoload.php';
use Abraham\TwitterOAuth\TwitterOAuth;
/*
define('CONSUMER_KEY', getenv('wMtivKDSAgZmkP7EZhYcfw'));
define('CONSUMER_SECRET', getenv('AvWbHfjuSJkZYhkxsU8ojsDpNtvapBoiRUzwF3OAvbo'));
define('OAUTH_CALLBACK', getenv('http://datos.labmde.org/milfs/toa/hola.php'));
*/
define('CONSUMER_KEY', 'QS1JHXs7OgJcFArJmMv117JEn');
define('CONSUMER_SECRET', 'NoO1FUXHmTB74HUrnDbcs64XgZoroBkaPav8w0FgbK3ZYSU9PZ');
define('OAUTH_CALLBACK', 'http://datos.labmde.org/milfs/addon/logis/funciones/twitter/hola.php');
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
//print $connection; //print connection contents
//$request_token = $connection->oauth('oauth/request_token', array('oauth_callback' => OAUTH_CALLBACK));
$request_token = $connection->oauth('oauth/request_token');
//$url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
$user = $connection->get("account/verify_credentials");
//print $user->screen_name;
print_r($user);
// Post Update
$content = $connection->post('statuses/update', array('status' => 'Bonito dia'));
print_r( $content);
print_r($url);
//print_r($request_token); //print connection contentsa
?>

View File

@ -1,65 +0,0 @@
<?php
session_start();
ini_set('display_errors', 1);
require 'autoload.php';
use Abraham\TwitterOAuth\TwitterOAuth;
require_once('config.php');
/* Crear un objeto TwitteroAuth con las credenciales de la aplicacion y el token temporal */
//$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
$_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
/* Solicitar a twitter el token de acceso */
//$access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']);
$access_token = $connection->oauth("oauth/access_token", array("oauth_verifier" => $_REQUEST['oauth_verifier']));
/* Guardar el token de acceso. Normalmente, este token se guardará también en una base
de datos para volver a ser utilizado en otras ocasiones. */
$_SESSION['access_token'] = $access_token;
/* Eliminar el token temporal de solicitud */
unset($_SESSION['oauth_token']);
unset($_SESSION['oauth_token_secret']);
/* Si todo va bien, presentar al usuario la página principal "index.php" del servicio */
//if (200 == $connection->http_code) {
/* El usuario ha sido verificado */
$_SESSION['status'] = 'verified';
echo send_tweet($access_token);
//}
function base64_encode_image ($filename=string,$filetype=string) {
if ($filename) {
$imgbinary = fread(fopen($filename, "r"), filesize($filename));
return base64_encode($imgbinary);
}
}
function send_tweet($access_token) {
$tweet = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
$access_token['oauth_token'], $access_token['oauth_token_secret']);
$nombre= $_SESSION['logis'].".png";
$nombre = "$_SESSION[path_images_secure]/600/$nombre";
$media1 = $tweet->upload('media/upload', array('media' => "$nombre"));
$parameters = array('status' =>"$_SESSION[mensaje] #BrigadaDigital #CD2015 http://datos.labmde.org/jlogis",'media_ids' => implode(',', array($media1->media_id_string)),
);
$result = $tweet-> post('statuses/update', $parameters);
/*$image = "$nombre";
$base64 = base64_encode_image (''.$image,'png');
$result = $tweet-> post('account/update_profile_image', array('image' => $base64.';type=image/jpg;filename='.$image));
*/
// $message = "Bonito dia $nombre";
// $tweet->post('statuses/update', array('status' => "$message"));
//
}
header('Location: https://twitter.com/hashtag/CD2015');
// header('Location: ./index.php');
//} else {
//header('Location: ./clearsessions.php');
//

View File

@ -1,64 +0,0 @@
<?php
namespace Abraham\TwitterOAuth;
/**
* Handle setting and storing config for TwitterOAuth.
*
* @author Abraham Williams <abraham@abrah.am>
*/
class Config
{
/** @var int How long to wait for a response from the API */
protected $timeout = 5;
/** @var int how long to wait while connecting to the API */
protected $connectionTimeout = 5;
/**
* Decode JSON Response as associative Array
*
* @see http://php.net/manual/en/function.json-decode.php
*
* @var bool
*/
protected $decodeJsonAsArray = false;
/** @var string User-Agent header */
protected $userAgent = 'TwitterOAuth (+https://twitteroauth.com)';
/** @var array Store proxy connection details */
protected $proxy = [];
/**
* Set the connection and response timeouts.
*
* @param int $connectionTimeout
* @param int $timeout
*/
public function setTimeouts($connectionTimeout, $timeout)
{
$this->connectionTimeout = (int)$connectionTimeout;
$this->timeout = (int)$timeout;
}
/**
* @param bool $value
*/
public function setDecodeJsonAsArray($value)
{
$this->decodeJsonAsArray = (bool)$value;
}
/**
* @param string $userAgent
*/
public function setUserAgent($userAgent)
{
$this->userAgent = (string)$userAgent;
}
/**
* @param array $proxy
*/
public function setProxy(array $proxy)
{
$this->proxy = $proxy;
}
}

View File

@ -1,36 +0,0 @@
<?php
/**
* The MIT License
* Copyright (c) 2007 Andy Smith
*/
namespace Abraham\TwitterOAuth;
class Consumer
{
/** @var string */
public $key;
/** @var string */
public $secret;
/** @var string|null */
public $callbackUrl;
/**
* @param string $key
* @param string $secret
* @param null $callbackUrl
*/
public function __construct($key, $secret, $callbackUrl = null)
{
$this->key = $key;
$this->secret = $secret;
$this->callbackUrl = $callbackUrl;
}
/**
* @return string
*/
public function __toString()
{
return "Consumer[key=$this->key,secret=$this->secret]";
}
}

View File

@ -1,39 +0,0 @@
<?php
/**
* The MIT License
* Copyright (c) 2007 Andy Smith
*/
namespace Abraham\TwitterOAuth;
/**
* The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104]
* where the Signature Base String is the text and the key is the concatenated values (each first
* encoded per Parameter Encoding) of the Consumer Secret and Token Secret, separated by an '&'
* character (ASCII code 38) even if empty.
* - Chapter 9.2 ("HMAC-SHA1")
*/
class HmacSha1 extends SignatureMethod
{
/**
* {@inheritDoc}
*/
public function getName()
{
return "HMAC-SHA1";
}
/**
* {@inheritDoc}
*/
public function buildSignature(Request $request, Consumer $consumer, Token $token = null)
{
$signatureBase = $request->getSignatureBaseString();
$parts = [$consumer->secret, null !== $token ? $token->secret : ""];
$parts = Util::urlencodeRfc3986($parts);
$key = implode('&', $parts);
return base64_encode(hash_hmac('sha1', $signatureBase, $key, true));
}
}

View File

@ -1,254 +0,0 @@
<?php
/**
* The MIT License
* Copyright (c) 2007 Andy Smith
*/
namespace Abraham\TwitterOAuth;
class Request
{
protected $parameters;
protected $httpMethod;
protected $httpUrl;
public static $version = '1.0';
/**
* Constructor
*
* @param string $httpMethod
* @param string $httpUrl
* @param array|null $parameters
*/
public function __construct($httpMethod, $httpUrl, array $parameters = [])
{
$parameters = array_merge(Util::parseParameters(parse_url($httpUrl, PHP_URL_QUERY)), $parameters);
$this->parameters = $parameters;
$this->httpMethod = $httpMethod;
$this->httpUrl = $httpUrl;
}
/**
* pretty much a helper function to set up the request
*
* @param Consumer $consumer
* @param Token $token
* @param string $httpMethod
* @param string $httpUrl
* @param array $parameters
*
* @return Request
*/
public static function fromConsumerAndToken(
Consumer $consumer,
Token $token = null,
$httpMethod,
$httpUrl,
array $parameters = []
) {
$defaults = [
"oauth_version" => Request::$version,
"oauth_nonce" => Request::generateNonce(),
"oauth_timestamp" => time(),
"oauth_consumer_key" => $consumer->key
];
if (null !== $token) {
$defaults['oauth_token'] = $token->key;
}
$parameters = array_merge($defaults, $parameters);
return new Request($httpMethod, $httpUrl, $parameters);
}
/**
* @param string $name
* @param string $value
*/
public function setParameter($name, $value)
{
$this->parameters[$name] = $value;
}
/**
* @param $name
*
* @return string|null
*/
public function getParameter($name)
{
return isset($this->parameters[$name]) ? $this->parameters[$name] : null;
}
/**
* @return array
*/
public function getParameters()
{
return $this->parameters;
}
/**
* @param $name
*/
public function removeParameter($name)
{
unset($this->parameters[$name]);
}
/**
* The request parameters, sorted and concatenated into a normalized string.
*
* @return string
*/
public function getSignableParameters()
{
// Grab all parameters
$params = $this->parameters;
// Remove oauth_signature if present
// Ref: Spec: 9.1.1 ("The oauth_signature parameter MUST be excluded.")
if (isset($params['oauth_signature'])) {
unset($params['oauth_signature']);
}
return Util::buildHttpQuery($params);
}
/**
* Returns the base string of this request
*
* The base string defined as the method, the url
* and the parameters (normalized), each urlencoded
* and the concated with &.
*
* @return string
*/
public function getSignatureBaseString()
{
$parts = [
$this->getNormalizedHttpMethod(),
$this->getNormalizedHttpUrl(),
$this->getSignableParameters()
];
$parts = Util::urlencodeRfc3986($parts);
return implode('&', $parts);
}
/**
* Returns the HTTP Method in uppercase
*
* @return string
*/
public function getNormalizedHttpMethod()
{
return strtoupper($this->httpMethod);
}
/**
* parses the url and rebuilds it to be
* scheme://host/path
*
* @return string
*/
public function getNormalizedHttpUrl()
{
$parts = parse_url($this->httpUrl);
$scheme = $parts['scheme'];
$host = strtolower($parts['host']);
$path = $parts['path'];
return "$scheme://$host$path";
}
/**
* Builds a url usable for a GET request
*
* @return string
*/
public function toUrl()
{
$postData = $this->toPostdata();
$out = $this->getNormalizedHttpUrl();
if ($postData) {
$out .= '?' . $postData;
}
return $out;
}
/**
* Builds the data one would send in a POST request
*
* @return string
*/
public function toPostdata()
{
return Util::buildHttpQuery($this->parameters);
}
/**
* Builds the Authorization: header
*
* @return string
* @throws TwitterOAuthException
*/
public function toHeader()
{
$first = true;
$out = 'Authorization: OAuth';
foreach ($this->parameters as $k => $v) {
if (substr($k, 0, 5) != "oauth") {
continue;
}
if (is_array($v)) {
throw new TwitterOAuthException('Arrays not supported in headers');
}
$out .= ($first) ? ' ' : ', ';
$out .= Util::urlencodeRfc3986($k) . '="' . Util::urlencodeRfc3986($v) . '"';
$first = false;
}
return $out;
}
/**
* @return string
*/
public function __toString()
{
return $this->toUrl();
}
/**
* @param SignatureMethod $signatureMethod
* @param Consumer $consumer
* @param Token $token
*/
public function signRequest(SignatureMethod $signatureMethod, Consumer $consumer, Token $token = null)
{
$this->setParameter("oauth_signature_method", $signatureMethod->getName());
$signature = $this->buildSignature($signatureMethod, $consumer, $token);
$this->setParameter("oauth_signature", $signature);
}
/**
* @param SignatureMethod $signatureMethod
* @param Consumer $consumer
* @param Token $token
*
* @return string
*/
public function buildSignature(SignatureMethod $signatureMethod, Consumer $consumer, Token $token = null)
{
return $signatureMethod->buildSignature($this, $consumer, $token);
}
/**
* @return string
*/
public static function generateNonce()
{
return md5(microtime() . mt_rand());
}
}

View File

@ -1,107 +0,0 @@
<?php
namespace Abraham\TwitterOAuth;
/**
* The result of the most recent API request.
*
* @author Abraham Williams <abraham@abrah.am>
*/
class Response
{
/** @var string|null API path from the most recent request */
private $apiPath;
/** @var int HTTP status code from the most recent request */
private $httpCode = 0;
/** @var array HTTP headers from the most recent request */
private $headers = [];
/** @var array|object Response body from the most recent request */
private $body = [];
/** @var array HTTP headers from the most recent request that start with X */
private $xHeaders = [];
/**
* @param string $apiPath
*/
public function setApiPath($apiPath)
{
$this->apiPath = $apiPath;
}
/**
* @return string|null
*/
public function getApiPath()
{
return $this->apiPath;
}
/**
* @param array|object $body
*/
public function setBody($body)
{
$this->body = $body;
}
/**
* @return array|object|string
*/
public function getBody()
{
return $this->body;
}
/**
* @param int $httpCode
*/
public function setHttpCode($httpCode)
{
$this->httpCode = $httpCode;
}
/**
* @return int
*/
public function getHttpCode()
{
return $this->httpCode;
}
/**
* @param array $headers
*/
public function setHeaders($headers)
{
foreach ($headers as $key => $value) {
if (substr($key, 0, 1) == 'x') {
$this->xHeaders[$key] = $value;
}
}
$this->headers = $headers;
}
/**
* @return array
*/
public function getsHeaders()
{
return $this->headers;
}
/**
* @param array $xHeaders
*/
public function setXHeaders($xHeaders)
{
$this->xHeaders = $xHeaders;
}
/**
* @return array
*/
public function getXHeaders()
{
return $this->xHeaders;
}
}

View File

@ -1,66 +0,0 @@
<?php
/**
* The MIT License
* Copyright (c) 2007 Andy Smith
*/
namespace Abraham\TwitterOAuth;
/**
* A class for implementing a Signature Method
* See section 9 ("Signing Requests") in the spec
*/
abstract class SignatureMethod
{
/**
* Needs to return the name of the Signature Method (ie HMAC-SHA1)
*
* @return string
*/
abstract public function getName();
/**
* Build up the signature
* NOTE: The output of this function MUST NOT be urlencoded.
* the encoding is handled in OAuthRequest when the final
* request is serialized
*
* @param Request $request
* @param Consumer $consumer
* @param Token $token
*
* @return string
*/
abstract public function buildSignature(Request $request, Consumer $consumer, Token $token = null);
/**
* Verifies that a given signature is correct
*
* @param Request $request
* @param Consumer $consumer
* @param Token $token
* @param string $signature
*
* @return bool
*/
public function checkSignature(Request $request, Consumer $consumer, Token $token, $signature)
{
$built = $this->buildSignature($request, $consumer, $token);
// Check for zero length, although unlikely here
if (strlen($built) == 0 || strlen($signature) == 0) {
return false;
}
if (strlen($built) != strlen($signature)) {
return false;
}
// Avoid a timing leak with a (hopefully) time insensitive compare
$result = 0;
for ($i = 0; $i < strlen($signature); $i++) {
$result |= ord($built{$i}) ^ ord($signature{$i});
}
return $result == 0;
}
}

View File

@ -1,38 +0,0 @@
<?php
/**
* The MIT License
* Copyright (c) 2007 Andy Smith
*/
namespace Abraham\TwitterOAuth;
class Token
{
/** @var string */
public $key;
/** @var string */
public $secret;
/**
* @param string $key The OAuth Token
* @param string $secret The OAuth Token Secret
*/
public function __construct($key, $secret)
{
$this->key = $key;
$this->secret = $secret;
}
/**
* Generates the basic string serialization of a token that a server
* would respond to request_token and access_token calls with
*
* @return string
*/
public function __toString()
{
return sprintf("oauth_token=%s&oauth_token_secret=%s",
Util::urlencodeRfc3986($this->key),
Util::urlencodeRfc3986($this->secret)
);
}
}

View File

@ -1,448 +0,0 @@
<?php
/**
* The most popular PHP library for use with the Twitter OAuth REST API.
*
* @license MIT
*/
namespace Abraham\TwitterOAuth;
use Abraham\TwitterOAuth\Util\JsonDecoder;
/**
* TwitterOAuth class for interacting with the Twitter API.
*
* @author Abraham Williams <abraham@abrah.am>
*/
class TwitterOAuth extends Config
{
const API_VERSION = '1.1';
const API_HOST = 'https://api.twitter.com';
const UPLOAD_HOST = 'https://upload.twitter.com';
const UPLOAD_CHUNK = 40960; // 1024 * 40
/** @var Response details about the result of the last request */
private $response;
/** @var string|null Application bearer token */
private $bearer;
/** @var Consumer Twitter application details */
private $consumer;
/** @var Token|null User access token details */
private $token;
/** @var HmacSha1 OAuth 1 signature type used by Twitter */
private $signatureMethod;
/**
* Constructor
*
* @param string $consumerKey The Application Consumer Key
* @param string $consumerSecret The Application Consumer Secret
* @param string|null $oauthToken The Client Token (optional)
* @param string|null $oauthTokenSecret The Client Token Secret (optional)
*/
public function __construct($consumerKey, $consumerSecret, $oauthToken = null, $oauthTokenSecret = null)
{
$this->resetLastResponse();
$this->signatureMethod = new HmacSha1();
$this->consumer = new Consumer($consumerKey, $consumerSecret);
if (!empty($oauthToken) && !empty($oauthTokenSecret)) {
$this->token = new Token($oauthToken, $oauthTokenSecret);
}
if (empty($oauthToken) && !empty($oauthTokenSecret)) {
$this->bearer = $oauthTokenSecret;
}
}
/**
* @param string $oauthToken
* @param string $oauthTokenSecret
*/
public function setOauthToken($oauthToken, $oauthTokenSecret)
{
$this->token = new Token($oauthToken, $oauthTokenSecret);
}
/**
* @return string|null
*/
public function getLastApiPath()
{
return $this->response->getApiPath();
}
/**
* @return int
*/
public function getLastHttpCode()
{
return $this->response->getHttpCode();
}
/**
* @return array
*/
public function getLastXHeaders()
{
return $this->response->getXHeaders();
}
/**
* @return array|object|null
*/
public function getLastBody()
{
return $this->response->getBody();
}
/**
* Resets the last response cache.
*/
public function resetLastResponse()
{
$this->response = new Response();
}
/**
* Make URLs for user browser navigation.
*
* @param string $path
* @param array $parameters
*
* @return string
*/
public function url($path, array $parameters)
{
$this->resetLastResponse();
$this->response->setApiPath($path);
$query = http_build_query($parameters);
return sprintf('%s/%s?%s', self::API_HOST, $path, $query);
}
/**
* Make /oauth/* requests to the API.
*
* @param string $path
* @param array $parameters
*
* @return array
* @throws TwitterOAuthException
*/
public function oauth($path, array $parameters = [])
{
$response = [];
$this->resetLastResponse();
$this->response->setApiPath($path);
$url = sprintf('%s/%s', self::API_HOST, $path);
$result = $this->oAuthRequest($url, 'POST', $parameters);
if ($this->getLastHttpCode() != 200) {
throw new TwitterOAuthException($result);
}
parse_str($result, $response);
$this->response->setBody($response);
return $response;
}
/**
* Make /oauth2/* requests to the API.
*
* @param string $path
* @param array $parameters
*
* @return array|object
*/
public function oauth2($path, array $parameters = [])
{
$method = 'POST';
$this->resetLastResponse();
$this->response->setApiPath($path);
$url = sprintf('%s/%s', self::API_HOST, $path);
$request = Request::fromConsumerAndToken($this->consumer, $this->token, $method, $url, $parameters);
$authorization = 'Authorization: Basic ' . $this->encodeAppAuthorization($this->consumer);
$result = $this->request($request->getNormalizedHttpUrl(), $method, $authorization, $parameters);
$response = JsonDecoder::decode($result, $this->decodeJsonAsArray);
$this->response->setBody($response);
return $response;
}
/**
* Make GET requests to the API.
*
* @param string $path
* @param array $parameters
*
* @return array|object
*/
public function get($path, array $parameters = [])
{
return $this->http('GET', self::API_HOST, $path, $parameters);
}
/**
* Make POST requests to the API.
*
* @param string $path
* @param array $parameters
*
* @return array|object
*/
public function post($path, array $parameters = [])
{
return $this->http('POST', self::API_HOST, $path, $parameters);
}
/**
* Make DELETE requests to the API.
*
* @param string $path
* @param array $parameters
*
* @return array|object
*/
public function delete($path, array $parameters = [])
{
return $this->http('DELETE', self::API_HOST, $path, $parameters);
}
/**
* Make PUT requests to the API.
*
* @param string $path
* @param array $parameters
*
* @return array|object
*/
public function put($path, array $parameters = [])
{
return $this->http('PUT', self::API_HOST, $path, $parameters);
}
/**
* Upload media to upload.twitter.com.
*
* @param string $path
* @param array $parameters
* @param boolean $chunked
*
* @return array|object
*/
public function upload($path, array $parameters = [], $chunked = false)
{
if ($chunked) {
return $this->uploadMediaChunked($path, $parameters);
} else {
return $this->uploadMediaNotChunked($path, $parameters);
}
}
/**
* Private method to upload media (not chunked) to upload.twitter.com.
*
* @param string $path
* @param array $parameters
*
* @return array|object
*/
private function uploadMediaNotChunked($path, $parameters)
{
$file = file_get_contents($parameters['media']);
$base = base64_encode($file);
$parameters['media'] = $base;
return $this->http('POST', self::UPLOAD_HOST, $path, $parameters);
}
/**
* Private method to upload media (chunked) to upload.twitter.com.
*
* @param string $path
* @param array $parameters
*
* @return array|object
*/
private function uploadMediaChunked($path, $parameters)
{
// Init
$init = $this->http('POST', self::UPLOAD_HOST, $path, [
'command' => 'INIT',
'media_type' => $parameters['media_type'],
'total_bytes' => filesize($parameters['media'])
]);
// Append
$segment_index = 0;
$media = fopen($parameters['media'], 'rb');
while (!feof($media))
{
$this->http('POST', self::UPLOAD_HOST, 'media/upload', [
'command' => 'APPEND',
'media_id' => $init->media_id_string,
'segment_index' => $segment_index++,
'media_data' => base64_encode(fread($media, self::UPLOAD_CHUNK))
]);
}
fclose($media);
// Finalize
$finalize = $this->http('POST', self::UPLOAD_HOST, 'media/upload', [
'command' => 'FINALIZE',
'media_id' => $init->media_id_string
]);
return $finalize;
}
/**
* @param string $method
* @param string $host
* @param string $path
* @param array $parameters
*
* @return array|object
*/
private function http($method, $host, $path, array $parameters)
{
$this->resetLastResponse();
$url = sprintf('%s/%s/%s.json', $host, self::API_VERSION, $path);
$this->response->setApiPath($path);
$result = $this->oAuthRequest($url, $method, $parameters);
$response = JsonDecoder::decode($result, $this->decodeJsonAsArray);
$this->response->setBody($response);
return $response;
}
/**
* Format and sign an OAuth / API request
*
* @param string $url
* @param string $method
* @param array $parameters
*
* @return string
* @throws TwitterOAuthException
*/
private function oAuthRequest($url, $method, array $parameters)
{
$request = Request::fromConsumerAndToken($this->consumer, $this->token, $method, $url, $parameters);
if (array_key_exists('oauth_callback', $parameters)) {
// Twitter doesn't like oauth_callback as a parameter.
unset($parameters['oauth_callback']);
}
if ($this->bearer === null) {
$request->signRequest($this->signatureMethod, $this->consumer, $this->token);
$authorization = $request->toHeader();
} else {
$authorization = 'Authorization: Bearer ' . $this->bearer;
}
return $this->request($request->getNormalizedHttpUrl(), $method, $authorization, $parameters);
}
/**
* Make an HTTP request
*
* @param string $url
* @param string $method
* @param string $authorization
* @param array $postfields
*
* @return string
* @throws TwitterOAuthException
*/
private function request($url, $method, $authorization, $postfields)
{
/* Curl settings */
$options = [
// CURLOPT_VERBOSE => true,
CURLOPT_CAINFO => __DIR__ . DIRECTORY_SEPARATOR . 'cacert.pem',
CURLOPT_CONNECTTIMEOUT => $this->connectionTimeout,
CURLOPT_HEADER => true,
CURLOPT_HTTPHEADER => ['Accept: application/json', $authorization, 'Expect:'],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_TIMEOUT => $this->timeout,
CURLOPT_URL => $url,
CURLOPT_USERAGENT => $this->userAgent,
CURLOPT_ENCODING => 'gzip',
];
if (!empty($this->proxy)) {
$options[CURLOPT_PROXY] = $this->proxy['CURLOPT_PROXY'];
$options[CURLOPT_PROXYUSERPWD] = $this->proxy['CURLOPT_PROXYUSERPWD'];
$options[CURLOPT_PROXYPORT] = $this->proxy['CURLOPT_PROXYPORT'];
$options[CURLOPT_PROXYAUTH] = CURLAUTH_BASIC;
$options[CURLOPT_PROXYTYPE] = CURLPROXY_HTTP;
}
switch ($method) {
case 'GET':
break;
case 'POST':
$options[CURLOPT_POST] = true;
$options[CURLOPT_POSTFIELDS] = Util::buildHttpQuery($postfields);
break;
case 'DELETE':
$options[CURLOPT_CUSTOMREQUEST] = 'DELETE';
break;
case 'PUT':
$options[CURLOPT_CUSTOMREQUEST] = 'PUT';
break;
}
if (in_array($method, ['GET', 'PUT', 'DELETE']) && !empty($postfields)) {
$options[CURLOPT_URL] .= '?' . Util::buildHttpQuery($postfields);
}
$curlHandle = curl_init();
curl_setopt_array($curlHandle, $options);
$response = curl_exec($curlHandle);
// Throw exceptions on cURL errors.
if (curl_errno($curlHandle) > 0) {
throw new TwitterOAuthException(curl_error($curlHandle), curl_errno($curlHandle));
}
$this->response->setHttpCode(curl_getinfo($curlHandle, CURLINFO_HTTP_CODE));
$parts = explode("\r\n\r\n", $response);
$responseBody = array_pop($parts);
$responseHeader = array_pop($parts);
$this->response->setHeaders($this->parseHeaders($responseHeader));
curl_close($curlHandle);
return $responseBody;
}
/**
* Get the header info to store.
*
* @param string $header
*
* @return array
*/
private function parseHeaders($header)
{
$headers = [];
foreach (explode("\r\n", $header) as $line) {
if (strpos($line, ':') !== false) {
list ($key, $value) = explode(': ', $line);
$key = str_replace('-', '_', strtolower($key));
$headers[$key] = trim($value);
}
}
return $headers;
}
/**
* Encode application authorization header with base64.
*
* @param Consumer $consumer
*
* @return string
*/
private function encodeAppAuthorization($consumer)
{
// TODO: key and secret should be rfc 1738 encoded
$key = $consumer->key;
$secret = $consumer->secret;
return base64_encode($key . ':' . $secret);
}
}

View File

@ -1,10 +0,0 @@
<?php
namespace Abraham\TwitterOAuth;
/**
* @author Abraham Williams <abraham@abrah.am>
*/
class TwitterOAuthException extends \Exception
{
}

View File

@ -1,115 +0,0 @@
<?php
/**
* The MIT License
* Copyright (c) 2007 Andy Smith
*/
namespace Abraham\TwitterOAuth;
class Util
{
/**
* @param $input
*
* @return array|mixed|string
*/
public static function urlencodeRfc3986($input)
{
$output = '';
if (is_array($input)) {
$output = array_map([__NAMESPACE__ . '\Util', 'urlencodeRfc3986'], $input);
} elseif (is_scalar($input)) {
$output = rawurlencode($input);
}
return $output;
}
/**
* @param string $string
*
* @return string
*/
public static function urldecodeRfc3986($string)
{
return urldecode($string);
}
/**
* This function takes a input like a=b&a=c&d=e and returns the parsed
* parameters like this
* array('a' => array('b','c'), 'd' => 'e')
*
* @param mixed $input
*
* @return array
*/
public static function parseParameters($input)
{
if (!isset($input) || !$input) {
return [];
}
$pairs = explode('&', $input);
$parameters = [];
foreach ($pairs as $pair) {
$split = explode('=', $pair, 2);
$parameter = Util::urldecodeRfc3986($split[0]);
$value = isset($split[1]) ? Util::urldecodeRfc3986($split[1]) : '';
if (isset($parameters[$parameter])) {
// We have already recieved parameter(s) with this name, so add to the list
// of parameters with this name
if (is_scalar($parameters[$parameter])) {
// This is the first duplicate, so transform scalar (string) into an array
// so we can add the duplicates
$parameters[$parameter] = [$parameters[$parameter]];
}
$parameters[$parameter][] = $value;
} else {
$parameters[$parameter] = $value;
}
}
return $parameters;
}
/**
* @param $params
*
* @return string
*/
public static function buildHttpQuery($params)
{
if (!$params) {
return '';
}
// Urlencode both keys and values
$keys = Util::urlencodeRfc3986(array_keys($params));
$values = Util::urlencodeRfc3986(array_values($params));
$params = array_combine($keys, $values);
// Parameters are sorted by name, using lexicographical byte value ordering.
// Ref: Spec: 9.1.1 (1)
uksort($params, 'strcmp');
$pairs = [];
foreach ($params as $parameter => $value) {
if (is_array($value)) {
// If two or more parameters share the same name, they are sorted by their value
// Ref: Spec: 9.1.1 (1)
// June 12th, 2010 - changed to sort because of issue 164 by hidetaka
sort($value, SORT_STRING);
foreach ($value as $duplicateValue) {
$pairs[] = $parameter . '=' . $duplicateValue;
}
} else {
$pairs[] = $parameter . '=' . $value;
}
}
// For each parameter, the name is separated from the corresponding value by an '=' character (ASCII code 61)
// Each name-value pair is separated by an '&' character (ASCII code 38)
return implode('&', $pairs);
}
}

View File

@ -1,26 +0,0 @@
<?php
namespace Abraham\TwitterOAuth\Util;
/**
* @author louis <louis@systemli.org>
*/
class JsonDecoder
{
/**
* Decodes a JSON string to stdObject or associative array
*
* @param string $string
* @param bool $asArray
*
* @return array|object
*/
public static function decode($string, $asArray)
{
if (version_compare(PHP_VERSION, '5.4.0', '>=') && !(defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) {
return json_decode($string, $asArray, 512, JSON_BIGINT_AS_STRING);
}
return json_decode($string, $asArray);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +0,0 @@
<?php
session_start();
ini_set('display_errors', 1);
require 'autoload.php';
use Abraham\TwitterOAuth\TwitterOAuth;
require_once('config.php');
/* Prepara la conexión */
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
/* Solicita a twitter las credenciales temporales */
//$request_token = $connection->getRequestToken(OAUTH_CALLBACK);
$request_token = $connection->oauth('oauth/request_token');
/* Guarda la credenciales temporales en sesión. */
$_SESSION['oauth_token'] = $token = $request_token['oauth_token'];
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
//switch ($connection->http_code) {
// case 200:
/* Construye la url de autorización y envía al usuario a Twitter. */
$url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
//$url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
//$url = $connection->getAuthorizeURL($token);
// print $url;
header('Location: ' . $url);
//break;
// default:
/* Indica que se ha producido un error. */
// echo 'Error de conexión a Twitter.';
// echo "\nHTTP CODE: " . $connection->http_code;
//}

View File

@ -1,177 +0,0 @@
<?php session_start();
ini_set('display_errors', 'On');
if(isset($_REQUEST['debug'])) {ini_set('display_errors', 'On');}
include_once("$_SESSION[path]/funciones/conex.php");
echo brigadistas_grabar($_POST);
function brigadistas_grabar($formulario) {
$identificador = $_POST['identificador'];
$control = md5("$identificador");
$data = $_POST['debugConsole'];
$imagen= grabar_imagen($data,$control);
$texto_url = urlencode("#BrigadaDigital");
$uri = urlencode("$_SESSION[url]/images/secure/?file=600/$imagen");
$url ="https://twitter.com/share?url=$uri&text=$texto_url";
//$respuesta->addScript("window.location.href ='$url';");
$preview = "
<div class='row'>
<div class='center-block'>
<div class='thumbnail'>
<img src='$_SESSION[url]/images/secure/?file=300/$imagen'>
<a download='brigadistas.png' href='$_SESSION[url]images/secure/?file=600/$imagen' >
<span class='btn btn-default'><i class='fa fa-download'></i> </span>
</a>
<span class='btn btn-default'>
<a onclick =\"javascript:window.location.href ='$url'; \" ><i class='fa fa-twitter'></i> </a>
</span>
<a href='?set=$formulario[formulario_id]&embebido'>
<span class='btn btn-default'><i class='fa fa-eye'></i> </span>
</a>
<a href='#' onclick = \"javascript:location.reload(); \">
<span class='btn btn-default'><i class='fa fa-refresh'></i> </span>
</a>
</div>
</div>
</div>
";
//$respuesta = new xajaxResponse('utf-8');
//$identificador = $formulario['identificador'];
$id_formulario = $_POST['formulario_id'];
$campo_imagen = buscar_campo_tipo("$id_formulario","15");
$_POST[$campo_imagen[0]][0] = $imagen;
$empresa = remplacetas('form_id','id',"$id_formulario",'id_empresa',"") ;
$id_empresa = $empresa[0];
include_once("$_SESSION[path]/funciones/conex.php");
//include_once("$_SESSION[url]funciones/conex.php");
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$ip = obtener_ip();
$ip = " INET_ATON('".$ip."') ";
foreach($_POST as $campo=>$valor){
if(is_array($valor)) {
foreach($valor as $c=>$v){
$consulta = "INSERT INTO form_datos ( timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
( UNIX_TIMESTAMP(),'$_SESSION[id]','$id_empresa','$id_formulario','$ip' ,'$control', '$campo' , '$v')
";
$sql=mysqli_query($consulta,$link);
// $campos .= " $campo // $valor // $c -> $v $consulta <br>";
}
}
}
$resultado = "$preview $consulta ";
///$respuesta->addAssign("aviso","innerHTML","$preview");
//$respuesta->addAlert("$resultado");
//$respuesta->addScript("javascript:location.reload(true);");
return $resultado;
}
function remplacetas($tabla,$campo,$valor,$por,$and){
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
if(@$and !=''){$AND = "AND $and";}else{$AND ="";}
//$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by $campo DESC limit 1";
$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by id DESC limit 1";
$sql=mysqli_query($consulta,$link);
if (@mysql_num_rows($sql)!=0){
$resultado[] = mysql_result($sql,0,$por);
$resultado[] = mysql_result($sql,0,'id');
$resultado[] = $consulta;
$resultado[] = mysql_result($sql,0,"md5_$por");
}else{
$resultado[0] = '';
$resultado[1] ="";
$resultado[2] = $consulta;
$resultado[3] = NULL;
}
return $resultado;
}
function grabar_imagen($imagen,$control) {
$imgData = str_replace(' ','+',$imagen);
$imgData = substr($imgData,strpos($imgData,",")+1);
$imgData = base64_decode($imgData);
$nombre= $control.".png";
$filePath = "$_SESSION[path]/tmp/".$nombre;
$file = fopen($filePath, 'w');
fwrite($file, $imgData);
fclose($file);
$full= "$_SESSION[path_images_secure]/full/".$nombre;
if (!rename($filePath,$full)){}
else {
echo generar_miniatura($nombre,"150");
echo generar_miniatura($nombre,"300");
echo generar_miniatura($nombre,"600");
}
//return "$nombre";
return "$nombre";
}
function generar_miniatura($file,$width) { //$archivo = $file;
$archivo = "$_SESSION[path_images_secure]/full/".$file; // Ponemos el . antes del nombre del archivo porque estamos considerando que la ruta está a partir del archivo thumb.php $file_info = getimagesize($archivo); // Obtenemos la relación de aspecto $ratio = $file_info[0] / $file_info[1]; // Calculamos las nuevas dimensiones $newwidth = $width; $newheight = round($newwidth / $ratio); // Sacamos la extensión del archivo $ext = explode(".", $file); $ext = strtolower($ext[count($ext) - 1]); if ($ext == "jpeg") $ext = "jpg"; // Dependiendo de la extensión llamamos a distintas funciones switch ($ext) { case "jpg": $img = imagecreatefromjpeg($archivo); break; case "png": $img = imagecreatefrompng($archivo); break; case "gif": $img = imagecreatefromgif($archivo); break; } // Creamos la miniatura $thumb = imagecreatetruecolor($newwidth, $newheight);
imagealphablending( $thumb, false );
imagesavealpha( $thumb, true ); // La redimensionamos imagecopyresampled($thumb, $img, 0, 0, 0, 0, $newwidth, $newheight, $file_info[0], $file_info[1]); // La mostramos como jpg //header("Content-type: image/jpeg"); imagejpeg($thumb,"$_SESSION[path_images_secure]/".$width."/$file", 80);
imagepng($thumb,"$_SESSION[path_images_secure]/".$width."/$file", 9);
//imagegif($thumb,"$_SESSION[path_images_secure]/".$width."/$file");
//imagejpeg($thumb,null, 80);
}
function buscar_campo_tipo($id,$tipo) {
//// esta función retorna el id para un campo de un tipo especifico dentro de un formulario.
$consulta ="SELECT form_campos.id, form_campos.campo_nombre FROM form_tipo_campo,form_campos,form_contenido_campos
WHERE form_tipo_campo.id_tipo_campo = form_campos.campo_tipo
AND form_contenido_campos.id_campo = form_campos.id
AND form_tipo_campo.id_tipo_campo = '$tipo'
AND form_contenido_campos.id_form = '$id'";
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
if (mysql_num_rows($sql)!='0'){
$resultado[0]=mysql_result($sql,0,"id");
$resultado[1]=mysql_result($sql,0,"campo_nombre");
$resultado[2] =$consulta;
}else{ $resultado[0]='';
$resultado[2] =$consulta;
}
return $resultado;
}
function obtener_ip()
{
if (isset($_SERVER["HTTP_CLIENT_IP"]))
{
return $_SERVER["HTTP_CLIENT_IP"];
}
elseif (isset($_SERVER["HTTP_X_FORWARDED_FOR"]))
{
return $_SERVER["HTTP_X_FORWARDED_FOR"];
}
elseif (isset($_SERVER["HTTP_X_FORWARDED"]))
{
return $_SERVER["HTTP_X_FORWARDED"];
}
elseif (isset($_SERVER["HTTP_FORWARDED_FOR"]))
{
return $_SERVER["HTTP_FORWARDED_FOR"];
}
elseif (isset($_SERVER["HTTP_FORWARDED"]))
{
return $_SERVER["HTTP_FORWARDED"];
}
else
{
return $_SERVER["REMOTE_ADDR"];
}
}
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

View File

@ -1,13 +0,0 @@
/*
* JavaScript Load Image Demo JS 1.9.1
* https://github.com/blueimp/JavaScript-Load-Image
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/

View File

@ -1,143 +0,0 @@
/*
* JavaScript Load Image Meta 1.0.2
* https://github.com/blueimp/JavaScript-Load-Image
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Image meta data handling implementation
* based on the help and contribution of
* Achim Stöhr.
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
/*jslint continue:true */
/*global define, window, DataView, Blob, Uint8Array, console */
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
define(['load-image'], factory);
} else {
// Browser globals:
factory(window.loadImage);
}
}(function (loadImage) {
'use strict';
var hasblobSlice = window.Blob && (Blob.prototype.slice ||
Blob.prototype.webkitSlice || Blob.prototype.mozSlice);
loadImage.blobSlice = hasblobSlice && function () {
var slice = this.slice || this.webkitSlice || this.mozSlice;
return slice.apply(this, arguments);
};
loadImage.metaDataParsers = {
jpeg: {
0xffe1: [] // APP1 marker
}
};
// Parses image meta data and calls the callback with an object argument
// with the following properties:
// * imageHead: The complete image head as ArrayBuffer (Uint8Array for IE10)
// The options arguments accepts an object and supports the following properties:
// * maxMetaDataSize: Defines the maximum number of bytes to parse.
// * disableImageHead: Disables creating the imageHead property.
loadImage.parseMetaData = function (file, callback, options) {
options = options || {};
var that = this,
// 256 KiB should contain all EXIF/ICC/IPTC segments:
maxMetaDataSize = options.maxMetaDataSize || 262144,
data = {},
noMetaData = !(window.DataView && file && file.size >= 12 &&
file.type === 'image/jpeg' && loadImage.blobSlice);
if (noMetaData || !loadImage.readFile(
loadImage.blobSlice.call(file, 0, maxMetaDataSize),
function (e) {
if (e.target.error) {
// FileReader error
console.log(e.target.error);
callback(data);
return;
}
// Note on endianness:
// Since the marker and length bytes in JPEG files are always
// stored in big endian order, we can leave the endian parameter
// of the DataView methods undefined, defaulting to big endian.
var buffer = e.target.result,
dataView = new DataView(buffer),
offset = 2,
maxOffset = dataView.byteLength - 4,
headLength = offset,
markerBytes,
markerLength,
parsers,
i;
// Check for the JPEG marker (0xffd8):
if (dataView.getUint16(0) === 0xffd8) {
while (offset < maxOffset) {
markerBytes = dataView.getUint16(offset);
// Search for APPn (0xffeN) and COM (0xfffe) markers,
// which contain application-specific meta-data like
// Exif, ICC and IPTC data and text comments:
if ((markerBytes >= 0xffe0 && markerBytes <= 0xffef) ||
markerBytes === 0xfffe) {
// The marker bytes (2) are always followed by
// the length bytes (2), indicating the length of the
// marker segment, which includes the length bytes,
// but not the marker bytes, so we add 2:
markerLength = dataView.getUint16(offset + 2) + 2;
if (offset + markerLength > dataView.byteLength) {
console.log('Invalid meta data: Invalid segment size.');
break;
}
parsers = loadImage.metaDataParsers.jpeg[markerBytes];
if (parsers) {
for (i = 0; i < parsers.length; i += 1) {
parsers[i].call(
that,
dataView,
offset,
markerLength,
data,
options
);
}
}
offset += markerLength;
headLength = offset;
} else {
// Not an APPn or COM marker, probably safe to
// assume that this is the end of the meta data
break;
}
}
// Meta length must be longer than JPEG marker (2)
// plus APPn marker (2), followed by length bytes (2):
if (!options.disableImageHead && headLength > 6) {
if (buffer.slice) {
data.imageHead = buffer.slice(0, headLength);
} else {
// Workaround for IE10, which does not yet
// support ArrayBuffer.slice:
data.imageHead = new Uint8Array(buffer)
.subarray(0, headLength);
}
}
} else {
console.log('Invalid JPEG file: Missing JPEG marker.');
}
callback(data);
},
'readAsArrayBuffer'
)) {
callback(data);
}
};
}));

View File

@ -1,166 +0,0 @@
/*
* JavaScript Load Image Orientation 1.1.0
* https://github.com/blueimp/JavaScript-Load-Image
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
/*global define, window */
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
define(['load-image'], factory);
} else {
// Browser globals:
factory(window.loadImage);
}
}(function (loadImage) {
'use strict';
var originalHasCanvasOption = loadImage.hasCanvasOption,
originalTransformCoordinates = loadImage.transformCoordinates,
originalGetTransformedOptions = loadImage.getTransformedOptions;
// This method is used to determine if the target image
// should be a canvas element:
loadImage.hasCanvasOption = function (options) {
return originalHasCanvasOption.call(loadImage, options) ||
options.orientation;
};
// Transform image orientation based on
// the given EXIF orientation option:
loadImage.transformCoordinates = function (canvas, options) {
originalTransformCoordinates.call(loadImage, canvas, options);
var ctx = canvas.getContext('2d'),
width = canvas.width,
height = canvas.height,
orientation = options.orientation;
if (!orientation || orientation > 8) {
return;
}
if (orientation > 4) {
canvas.width = height;
canvas.height = width;
}
switch (orientation) {
case 2:
// horizontal flip
ctx.translate(width, 0);
ctx.scale(-1, 1);
break;
case 3:
// 180° rotate left
ctx.translate(width, height);
ctx.rotate(Math.PI);
break;
case 4:
// vertical flip
ctx.translate(0, height);
ctx.scale(1, -1);
break;
case 5:
// vertical flip + 90 rotate right
ctx.rotate(0.5 * Math.PI);
ctx.scale(1, -1);
break;
case 6:
// 90° rotate right
ctx.rotate(0.5 * Math.PI);
ctx.translate(0, -height);
break;
case 7:
// horizontal flip + 90 rotate right
ctx.rotate(0.5 * Math.PI);
ctx.translate(width, -height);
ctx.scale(-1, 1);
break;
case 8:
// 90° rotate left
ctx.rotate(-0.5 * Math.PI);
ctx.translate(-width, 0);
break;
}
};
// Transforms coordinate and dimension options
// based on the given orientation option:
loadImage.getTransformedOptions = function (img, opts) {
var options = originalGetTransformedOptions.call(loadImage, img, opts),
orientation = options.orientation,
newOptions,
i;
if (!orientation || orientation > 8 || orientation === 1) {
return options;
}
newOptions = {};
for (i in options) {
if (options.hasOwnProperty(i)) {
newOptions[i] = options[i];
}
}
switch (options.orientation) {
case 2:
// horizontal flip
newOptions.left = options.right;
newOptions.right = options.left;
break;
case 3:
// 180° rotate left
newOptions.left = options.right;
newOptions.top = options.bottom;
newOptions.right = options.left;
newOptions.bottom = options.top;
break;
case 4:
// vertical flip
newOptions.top = options.bottom;
newOptions.bottom = options.top;
break;
case 5:
// vertical flip + 90 rotate right
newOptions.left = options.top;
newOptions.top = options.left;
newOptions.right = options.bottom;
newOptions.bottom = options.right;
break;
case 6:
// 90° rotate right
newOptions.left = options.top;
newOptions.top = options.right;
newOptions.right = options.bottom;
newOptions.bottom = options.left;
break;
case 7:
// horizontal flip + 90 rotate right
newOptions.left = options.bottom;
newOptions.top = options.right;
newOptions.right = options.top;
newOptions.bottom = options.left;
break;
case 8:
// 90° rotate left
newOptions.left = options.bottom;
newOptions.top = options.left;
newOptions.right = options.top;
newOptions.bottom = options.right;
break;
}
if (options.orientation > 4) {
newOptions.maxWidth = options.maxHeight;
newOptions.maxHeight = options.maxWidth;
newOptions.minWidth = options.minHeight;
newOptions.minHeight = options.minWidth;
newOptions.sourceWidth = options.sourceHeight;
newOptions.sourceHeight = options.sourceWidth;
}
return newOptions;
};
}));

File diff suppressed because one or more lines are too long

View File

@ -1,305 +0,0 @@
/*
* JavaScript Load Image 1.10.0
* https://github.com/blueimp/JavaScript-Load-Image
*
* Copyright 2011, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
/*jslint nomen: true */
/*global define, window, document, URL, webkitURL, Blob, File, FileReader */
(function ($) {
'use strict';
// Loads an image for a given File object.
// Invokes the callback with an img or optional canvas
// element (if supported by the browser) as parameter:
var loadImage = function (file, callback, options) {
var img = document.createElement('img'),
url,
oUrl;
//img.setAttribute('class', 'watermark');
// img.setAttribute('id', 'image_output2');
img.onerror = callback;
img.onload = function () {
if (oUrl && !(options && options.noRevoke)) {
loadImage.revokeObjectURL(oUrl);
}
if (callback) {
callback(loadImage.scale(img, options));
}
};
if (loadImage.isInstanceOf('Blob', file) ||
// Files are also Blob instances, but some browsers
// (Firefox 3.6) support the File API but not Blobs:
loadImage.isInstanceOf('File', file)) {
url = oUrl = loadImage.createObjectURL(file);
// Store the file type for resize processing:
img._type = file.type;
} else if (typeof file === 'string') {
url = file;
if (options && options.crossOrigin) {
img.crossOrigin = options.crossOrigin;
}
} else {
return false;
}
if (url) {
img.src = url;
//document.getElementById('image_output').src = url ;
//document.getElementById('image_output').className = "watermark" ;
return img;
}
return loadImage.readFile(file, function (e) {
var target = e.target;
if (target && target.result) {
img.src = target.result;
} else {
if (callback) {
callback(e);
}
}
});
},
// The check for URL.revokeObjectURL fixes an issue with Opera 12,
// which provides URL.createObjectURL but doesn't properly implement it:
urlAPI = (window.createObjectURL && window) ||
(window.URL && URL.revokeObjectURL && URL) ||
(window.webkitURL && webkitURL);
loadImage.isInstanceOf = function (type, obj) {
// Cross-frame instanceof check
return Object.prototype.toString.call(obj) === '[object ' + type + ']';
};
// Transform image coordinates, allows to override e.g.
// the canvas orientation based on the orientation option,
// gets canvas, options passed as arguments:
loadImage.transformCoordinates = function () {
return;
};
// Returns transformed options, allows to override e.g.
// maxWidth, maxHeight and crop options based on the aspectRatio.
// gets img, options passed as arguments:
loadImage.getTransformedOptions = function (img, options) {
var aspectRatio = options.aspectRatio,
newOptions,
i,
width,
height;
if (!aspectRatio) {
return options;
}
newOptions = {};
for (i in options) {
if (options.hasOwnProperty(i)) {
newOptions[i] = options[i];
}
}
newOptions.crop = true;
width = img.naturalWidth || img.width;
height = img.naturalHeight || img.height;
if (width / height > aspectRatio) {
newOptions.maxWidth = height * aspectRatio;
newOptions.maxHeight = height;
} else {
newOptions.maxWidth = width;
newOptions.maxHeight = width / aspectRatio;
}
return newOptions;
};
// Canvas render method, allows to override the
// rendering e.g. to work around issues on iOS:
loadImage.renderImageToCanvas = function (
canvas,
img,
sourceX,
sourceY,
sourceWidth,
sourceHeight,
destX,
destY,
destWidth,
destHeight
) {
canvas.getContext('2d').drawImage(
img,
sourceX,
sourceY,
sourceWidth,
sourceHeight,
destX,
destY,
destWidth,
destHeight
);
return canvas;
};
// This method is used to determine if the target image
// should be a canvas element:
loadImage.hasCanvasOption = function (options) {
return options.canvas || options.crop || options.aspectRatio;
};
// Scales and/or crops the given image (img or canvas HTML element)
// using the given options.
// Returns a canvas object if the browser supports canvas
// and the hasCanvasOption method returns true or a canvas
// object is passed as image, else the scaled image:
loadImage.scale = function (img, options) {
options = options || {};
var canvas = document.createElement('canvas'),
useCanvas = img.getContext ||
(loadImage.hasCanvasOption(options) && canvas.getContext),
width = img.naturalWidth || img.width,
height = img.naturalHeight || img.height,
destWidth = width,
destHeight = height,
maxWidth,
maxHeight,
minWidth,
minHeight,
sourceWidth,
sourceHeight,
sourceX,
sourceY,
tmp,
scaleUp = function () {
var scale = Math.max(
(minWidth || destWidth) / destWidth,
(minHeight || destHeight) / destHeight
);
if (scale > 1) {
destWidth = destWidth * scale;
destHeight = destHeight * scale;
}
},
scaleDown = function () {
var scale = Math.min(
(maxWidth || destWidth) / destWidth,
(maxHeight || destHeight) / destHeight
);
if (scale < 1) {
destWidth = destWidth * scale;
destHeight = destHeight * scale;
}
};
if (useCanvas) {
options = loadImage.getTransformedOptions(img, options);
sourceX = options.left || 0;
sourceY = options.top || 0;
if (options.sourceWidth) {
sourceWidth = options.sourceWidth;
if (options.right !== undefined && options.left === undefined) {
sourceX = width - sourceWidth - options.right;
}
} else {
sourceWidth = width - sourceX - (options.right || 0);
}
if (options.sourceHeight) {
sourceHeight = options.sourceHeight;
if (options.bottom !== undefined && options.top === undefined) {
sourceY = height - sourceHeight - options.bottom;
}
} else {
sourceHeight = height - sourceY - (options.bottom || 0);
}
destWidth = sourceWidth;
destHeight = sourceHeight;
}
maxWidth = options.maxWidth;
maxHeight = options.maxHeight;
minWidth = options.minWidth;
minHeight = options.minHeight;
if (useCanvas && maxWidth && maxHeight && options.crop) {
destWidth = maxWidth;
destHeight = maxHeight;
tmp = sourceWidth / sourceHeight - maxWidth / maxHeight;
if (tmp < 0) {
sourceHeight = maxHeight * sourceWidth / maxWidth;
if (options.top === undefined && options.bottom === undefined) {
sourceY = (height - sourceHeight) / 2;
}
} else if (tmp > 0) {
sourceWidth = maxWidth * sourceHeight / maxHeight;
if (options.left === undefined && options.right === undefined) {
sourceX = (width - sourceWidth) / 2;
}
}
} else {
if (options.contain || options.cover) {
minWidth = maxWidth = maxWidth || minWidth;
minHeight = maxHeight = maxHeight || minHeight;
}
if (options.cover) {
scaleDown();
scaleUp();
} else {
scaleUp();
scaleDown();
}
}
if (useCanvas) {
canvas.width = destWidth;
canvas.height = destHeight;
loadImage.transformCoordinates(
canvas,
options
);
return loadImage.renderImageToCanvas(
canvas,
img,
sourceX,
sourceY,
sourceWidth,
sourceHeight,
0,
0,
destWidth,
destHeight
);
}
img.width = destWidth;
img.height = destHeight;
return img;
};
loadImage.createObjectURL = function (file) {
return urlAPI ? urlAPI.createObjectURL(file) : false;
};
loadImage.revokeObjectURL = function (url) {
return urlAPI ? urlAPI.revokeObjectURL(url) : false;
};
// Loads a given File object via FileReader interface,
// invokes the callback with the event object (load or error).
// The result can be read via event.target.result:
loadImage.readFile = function (file, callback, method) {
if (window.FileReader) {
var fileReader = new FileReader();
fileReader.onload = fileReader.onerror = callback;
method = method || 'readAsDataURL';
if (fileReader[method]) {
fileReader[method](file);
return fileReader;
}
}
return false;
};
if (typeof define === 'function' && define.amd) {
define(function () {
return loadImage;
});
} else {
$.loadImage = loadImage;
}
}(window));

View File

@ -1,365 +0,0 @@
<?php
//include("funciones/funciones.php");
//$id_formulario = "58";
$id_formulario = "88";
$ancho = "600";
$tags = array();
//$tags[] = "milfs/addon/logis/images/logos/250.png";
$tags[] = "milfs/addon/logis/images/logos/c.png";
$imagen="";
foreach ($tags as &$valor) {
$imagen .= "<td onclick=\" document.getElementById('marca').src='$valor' ; marcar('top-left') \" ><a href='#medio' class='' >
<img class='img ' src='$valor'>
</a></td>";
}
$imagen = "
<div class='table-responsive'>
<table class='table table table-condensed text-center '>
<tr >
$imagen
</tr>
</table>
</div>";
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<div>
<style type="text/css">
.fa{
font-size:60px important!;
}
#imagen_origina{
width: <?php echo $ancho ?>px;
}
body{
background-color:white !important;
}
.pin {
text-align: center;
/*border: solid 1px red;*/
opacity: 0.5;
}
.fileUpload {
position: relative;
overflow: hidden;
margin: 10px;
width: 80%;
}
.fileUpload input.upload {
position: absolute;
top: 0;
right: 0;
margin: 10;
padding: 0;
font-size: 50px;
cursor: pointer;
opacity: 0;
filter: alpha(opacity=0);
}
.ing-touch{
border: solid 5px white;
width:20% !important;
}
</style>
<div class='container' style='height:100%; backgroun-color:white;' id='aviso'>
<div class='fileUpload btn btn-primary center-block'>
<span><h1><i class="fa fa-camera"></i> + tu Foto</h1></span>
<input class='upload' type="file" id="file-input" /></span>
<div id="original" ></div>
</div>
<!-- <p><input type="file" id="file-input"></p> -->
<div id="actions" style="display:none;">
<img class="center-block" src= "<?php echo $tags[0]; ?>" style='display:none' id="marca" name="marca">
<img class="center-block" style='' id="image_output" name="image_output">
<img class="center-block" style='' id="otra_imagen" name="otra_imagen">
<div id="result" class="result">
<p></p>
</div>
<a name="arriba"></a>
<canvas id="micanvasOriginal" style="position:absolute" >
Tu navegador no soporta canvas.
</canvas>
<div style="position:relative">
<div style="position:absolute; width:100%; height:100%;" >
<table style="width:100%; height:100%;" class="">
<tr >
<td class="pin" ><a href="#arriba" onclick=" javascript: marcar('top-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:20%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:20%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
</tr>
<tr>
<td class="pin"><a name="medio"></a><a href="#arriba" onclick=" javascript: marcar('middle-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin" ><a href="#medio" onclick=" javascript: marcar('middle-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></td>
</tr>
<tr>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
</tr>
</table>
</div>
<canvas id="micanvas" style="position:absolute" >
Tu navegador no soporta canvas.
</canvas>
</div>
<div class="row " style="position:relative">
<form id='formulario_brigadistas' name='formulario_brigadistas' >
<!-- <input class='form-control' type='' id="debugConsole" name="debugConsole" > -->
<textarea class='form-control' id="debugConsole" name="debugConsole" style="display:none;" ></textarea>
<input type='hidden' id="identificador" name="identificador" >
<input type='hidden' id="formulario_id" name="formulario_id" value="<?php echo $id_formulario; ?>">
<input type='hidden' id="imagen" name="imagen" value="">
<?php $formulario = formulario_areas("$id_formulario",'campos','','');
echo $formulario; ?>
</form>
</div>
<!-- <div id='aviso'></div> -->
<div class="row">
<div class="col-md-12">
<!-- this.disabled= true; xajax_wait('aviso','Grabando... un momento por favor...'); xajax_brigadistas_grabar(xajax.getFormValues('formulario_brigadistas')) -->
<!-- <button class='fileUpload btn btn-success btn-block' onclick="document.getElementById('formulario_brigadistas').submit(); "> -->
<button class='fileUpload btn btn-success btn-block' onclick=" xajax_wait('aviso','Grabando... un momento por favor...'); xajax_brigadistas_grabar(xajax.getFormValues('formulario_brigadistas')) ; ">
<span><i class="fa fa-save"></i> <span class='fa'> Grabalo! </span></span>
</button>
</div>
</div>
</div>
<?php $ultimo = formulario_uso("$id_formulario",'','ultimo') ;
//echo $ultimo[1];
echo mostrar_identificador("$ultimo[1]","","landingpage",'simple');
?>
</div>
<script language="javascript">
function cargaContextoCanvas(idCanvas){
var elemento = document.getElementById(idCanvas);
if(elemento && elemento.getContext){
var contexto = elemento.getContext('2d');
if(contexto){
return contexto;
}
}
return FALSE;
}
function marcar(ubicacion){
//if (ubicacion == 'arriba'){ var x = '0';var y = '0';}
//if (ubicacion == 'abajo'){ var x = '10';var y = '50';}
//Recibimos el elemento canvas
var ctx = cargaContextoCanvas('micanvas');
if(ctx){
//Creo una imagen conun objeto Image de Javascript
var img = new Image();
var img2 = new Image();
//img.src = document.getElementById("image_output2").src;
//readAsDataURL(
img.src = document.getElementById("imagen_original").src;
document.getElementById("imagen_original").style.display="none";
//img2.src = 'images/logos/a.png';
img2.src = document.getElementById("marca").src;
if (ubicacion =='') {
ubicacion ='middle-center';
}
x = 0,
y = 0;
if(ubicacion.indexOf("top")!=-1)
y = 10;
else if(ubicacion.indexOf("middle")!=-1)
y = (micanvas.height - img2.height)/2;
else
y = micanvas.height-img2.height-10;
if(ubicacion.indexOf("left")!=-1)
x = 10;
else if(ubicacion.indexOf("center")!=-1)
x = (micanvas.width - img2.width) /2;
else
x = micanvas.width-img2.width-10;
var proporcion = ( img.height / img.width );
var ancho = <?php echo $ancho ?>;
micanvas.width =ancho;
micanvas.height = (micanvas.width * proporcion);
micanvas.setAttribute('width', ancho);
micanvas.setAttribute('height', micanvas.height);
micanvas.setAttribute('style',"width:100%");
img.onload = function(){
ctx.drawImage(img, 0, 0,micanvas.width,micanvas.height);
ctx.drawImage(img2, x, y);
var debugConsole= document.getElementById("debugConsole");
var testCanvas = document.getElementById("micanvas");
var canvasData = testCanvas.toDataURL("image/png");
var postData = "canvasData="+canvasData;
debugConsole.value=canvasData;
var identificador = Math.random();
document.getElementById('identificador').value= identificador;
}
}
}
$(function () {
'use strict';
var result = $('#result'),
exifNode = $('#exif'),
thumbNode = $('#thumbnail'),
actionsNode = $('#actions'),
currentFile,
replaceResults = function (img) {
var content;
if (!(img.src || img instanceof HTMLCanvasElement)) {
content = $('<span>Loading image file failed</span>');
} else {
content = $('<img />').append(img)
//.attr('download', currentFile.name)
.attr('src', img.src || img.toDataURL())
.attr('width', '<?php echo $ancho ?>')
.attr('style', 'width:100%')
.attr('id', 'imagen_original');
}
//document.getElementById('image_output').src = img.src;
result.children().replaceWith(content);
if (img.getContext) {
actionsNode.show();
/// render(img.src);
window.setTimeout("marcar('middle-center');", 500);
}
},
displayImage = function (file, options) {
currentFile = file;
if (!loadImage(
file,
replaceResults,
options
)) {
result.children().replaceWith(
$('<span>Your browser does not support the URL or FileReader API.</span>')
);
}
},
dropChangeHandler = function (e) {
e.preventDefault();
e = e.originalEvent;
var target = e.dataTransfer || e.target,
file = target && target.files && target.files[0],
options = {
//maxWidth: result.width(),
maxWidth: <?php echo $ancho ?>,
canvas: true
};
if (!file) {
return;
}
exifNode.hide();
thumbNode.hide();
loadImage.parseMetaData(file, function (data) {
if (data.exif) {
options.orientation = data.exif.get('Orientation');
// displayExifData(data.exif);
}
displayImage(file, options);
});
},
coordinates;
// Hide URL/FileReader API requirement message in capable browsers:
if (window.createObjectURL || window.URL || window.webkitURL || window.FileReader) {
result.children().hide();
}
$(document)
.on('dragover', function (e) {
e.preventDefault();
e = e.originalEvent;
e.dataTransfer.dropEffect = 'copy';
})
.on('drop', dropChangeHandler);
$('#file-input').on('change', dropChangeHandler);
$('#edit').on('click', function (event) {
event.preventDefault();
var imgNode = result.find('img, canvas'),
img = imgNode[0];
imgNode.Jcrop({
setSelect: [40, 40, img.width - 40, img.height - 40],
onSelect: function (coords) {
coordinates = coords;
},
onRelease: function () {
coordinates = null;
}
}).parent().on('click', function (event) {
event.preventDefault();
});
});
$('#crop').on('click', function (event) {
event.preventDefault();
var img = result.find('img, canvas')[0];
if (img && coordinates) {
replaceResults(loadImage.scale(img, {
left: coordinates.x,
top: coordinates.y,
sourceWidth: coordinates.w,
sourceHeight: coordinates.h,
minWidth: result.width()
}));
coordinates = null;
}
});
});
</script>
<br>
<script src="milfs/addon/logis/js/load-image.all.min.js"></script>
<!-- <script src="js/load-image.js"></script> -->
<!-- <script src="js/load-image-ios.js"></script> -->
<!-- <script src="js/load-image-orientation.js"></script> -->
<!-- <script src="js/load-image-meta.js"></script> -->
<!-- <script src="js/load-image-exif.js"></script> -->
<!-- <script src="js/load-image-exif-map.js"></script> -->
<!-- jQuery and Jcrop are not required by JavaScript Load Image, but included for the demo -->
<!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> -->
<!-- <script src="js/vendor/jquery.Jcrop.js"></script> -->
<!-- <script src="js/demo.js"></script> -->
</div>

View File

@ -1,207 +0,0 @@
<?php
//include("funciones/funciones.php");
$id_formulario = "58";
$ancho = "600";
$tags = array();
$tags[] = "images/logos/c.png";
foreach ($tags as &$valor) {
$imagen .= "<td onclick=\" document.getElementById('marca').src='$valor' ; marcar('top-left') \" ><a href='#medio' class='' >
<img class='img ' src='$valor'>
</a></td>";
}
$imagen = "
<div class='table-responsive'>
<table class='table table table-condensed text-center '>
<tr >
$imagen
</tr>
</table>
</div>";
?>
<html lang="en">
<head>
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<![endif]-->
<meta charset="utf-8">
<title></title>
<meta name="description" content="JavaScript Load Image is a library to load images provided as File or Blob objects or via URL. It returns an optionally scaled and/or cropped HTML img or canvas element. It also provides a method to parse image meta data to extract Exif tags and thumbnails and to restore the complete image header after resizing.">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Jcrop is not required by JavaScript Load Image, but included for the demo -->
<!-- <link rel="stylesheet" href="css/vendor/jquery.Jcrop.css"> -->
<!-- <link rel="stylesheet" href="css/demo.css"> -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<style type="text/css">
.fa{
font-size:60px;
}
#imagen_origina{
width: 800px;
}
.pin {
text-align: center;
border: solid 1px red;
opacity: 0.5;
}
.fileUpload {
position: relative;
overflow: hidden;
margin: 10px;
width: 80%;
}
.fileUpload input.upload {
position: absolute;
top: 0;
right: 0;
margin: 10;
padding: 0;
font-size: 50px;
cursor: pointer;
opacity: 0;
filter: alpha(opacity=0);
}
</style>
</head>
<body>
<div class='container'>
<div class='fileUpload btn btn-primary '>
<span> <i class="fa fa-picture-o"></i> <span class='fa' > Imagen <i class="fa fa-camera"></i> </span>
<input class='upload' type="file" id="file-input" /></span>
<div id="original" ></div>
</div>
</div>
<!-- <p><input type="file" id="file-input"></p> -->
<div id="actions" style="display:none;">
<img class="center-block" src= "<?php echo $tags[0]; ?>" style='display:none' id="marca" name="marca">
<img class="center-block" style='' id="image_output" name="image_output">
<img class="center-block" style='' id="otra_imagen" name="otra_imagen">
<input type="hidden" id='identificador' name='identificador'>
<div id="result" class="result">
<p></p>
</div>
<a name="arriba"></a>
<div style="position:relative">
<div style="position:absolute; width:100%; height:100%;" >
<table style="width:100%; height:100%;" class="">
<tr >
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-left')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-center')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-rigth')"><i class="fa fa-circle-o"></i></a></td>
</tr>
<tr>
<td class="pin"><a name="medio"></a><a href="#arriba" onclick=" javascript: marcar('middle-left')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-center')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-rigth')"><i class="fa fa-circle-o"></i></td>
</tr>
<tr>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-left')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-center')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-rigth')"><i class="fa fa-circle-o"></i></a></td>
</tr>
</table>
</div>
<canvas id="micanvas" style="position:absolute" >
Tu navegador no soporta canvas.
</canvas>
</div>
</div>
<script language="javascript">
function cargaContextoCanvas(idCanvas){
var elemento = document.getElementById(idCanvas);
if(elemento && elemento.getContext){
var contexto = elemento.getContext('2d');
if(contexto){
return contexto;
}
}
return FALSE;
}
function marcar(ubicacion){
//if (ubicacion == 'arriba'){ var x = '0';var y = '0';}
//if (ubicacion == 'abajo'){ var x = '10';var y = '50';}
//Recibimos el elemento canvas
var ctx = cargaContextoCanvas('micanvas');
if(ctx){
//Creo una imagen conun objeto Image de Javascript
var img = new Image();
var img2 = new Image();
//img.src = document.getElementById("image_output2").src;
//readAsDataURL(
img.src = document.getElementById("imagen_original").src;
document.getElementById("imagen_original").style.display="none";
//img2.src = 'images/logos/a.png';
img2.src = document.getElementById("marca").src;
if (ubicacion =='') {
ubicacion ='middle-center';
}
x = 0,
y = 0;
if(ubicacion.indexOf("top")!=-1)
y = 10;
else if(ubicacion.indexOf("middle")!=-1)
y = (micanvas.height - img2.height)/2;
else
y = micanvas.height-img2.height-10;
if(ubicacion.indexOf("left")!=-1)
x = 10;
else if(ubicacion.indexOf("center")!=-1)
x = (micanvas.width - img2.width) /2;
else
x = micanvas.width-img2.width-10;
var proporcion = ( img.height / img.width );
var ancho = 800;
micanvas.width = ancho;
micanvas.height = (micanvas.width * proporcion);
micanvas.setAttribute('width', ancho);
micanvas.setAttribute('height', micanvas.height);
micanvas.setAttribute('style',"width:100%");
img.onload = function(){
ctx.drawImage(img, 0, 0,micanvas.width,micanvas.height);
ctx.drawImage(img2, x, y);
var identificador = Math.random();
document.getElementById('identificador').value= identificador;
}
}
}
</script>
<br>
<script src="js/load-image.all.min.js"></script>
<!-- <script src="js/load-image.js"></script> -->
<!-- <script src="js/load-image-ios.js"></script> -->
<!-- <script src="js/load-image-orientation.js"></script> -->
<!-- <script src="js/load-image-meta.js"></script> -->
<!-- <script src="js/load-image-exif.js"></script> -->
<!-- <script src="js/load-image-exif-map.js"></script> -->
<!-- jQuery and Jcrop are not required by JavaScript Load Image, but included for the demo -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- <script src="js/vendor/jquery.Jcrop.js"></script> -->
<script src="js/demo.js"></script>
</body>
</html>

View File

@ -1,207 +0,0 @@
<?php
//include("funciones/funciones.php");
$id_formulario = "58";
$ancho = "600";
$tags = array();
$tags[] = "images/logos/c.png";
foreach ($tags as &$valor) {
$imagen .= "<td onclick=\" document.getElementById('marca').src='$valor' ; marcar('top-left') \" ><a href='#medio' class='' >
<img class='img ' src='$valor'>
</a></td>";
}
$imagen = "
<div class='table-responsive'>
<table class='table table table-condensed text-center '>
<tr >
$imagen
</tr>
</table>
</div>";
?>
<!DOCTYPE HTML>
<html lang="en">
<head>
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<![endif]-->
<meta charset="utf-8">
<title></title>
<meta name="description" content="JavaScript Load Image is a library to load images provided as File or Blob objects or via URL. It returns an optionally scaled and/or cropped HTML img or canvas element. It also provides a method to parse image meta data to extract Exif tags and thumbnails and to restore the complete image header after resizing.">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Jcrop is not required by JavaScript Load Image, but included for the demo -->
<!-- <link rel="stylesheet" href="css/vendor/jquery.Jcrop.css"> -->
<!-- <link rel="stylesheet" href="css/demo.css"> -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<style type="text/css">
.fa{
font-size:60px;
}
#imagen_origina{
width: 800px;
}
.pin {
text-align: center;
border: solid 1px red;
opacity: 0.5;
}
.fileUpload {
position: relative;
overflow: hidden;
margin: 10px;
width: 80%;
}
.fileUpload input.upload {
position: absolute;
top: 0;
right: 0;
margin: 10;
padding: 0;
font-size: 50px;
cursor: pointer;
opacity: 0;
filter: alpha(opacity=0);
}
</style>
</head>
<body>
<div class='container'>
<div class='fileUpload btn btn-primary '>
<span> <i class="fa fa-picture-o"></i> <span class='fa' > Imagen <i class="fa fa-camera"></i> </span>
<input class='upload' type="file" id="file-input" /></span>
<div id="original" ></div>
</div>
</div>
<!-- <p><input type="file" id="file-input"></p> -->
<div id="actions" style="display:none;">
<img class="center-block" src= "<?php echo $tags[0]; ?>" style='display:none' id="marca" name="marca">
<img class="center-block" style='' id="image_output" name="image_output">
<img class="center-block" style='' id="otra_imagen" name="otra_imagen">
<input type="hidden" id='identificador' name='identificador'>
<div id="result" class="result">
<p></p>
</div>
<a name="arriba"></a>
<div style="position:relative">
<div style="position:absolute; width:100%; height:100%;" >
<table style="width:100%; height:100%;" class="">
<tr >
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-left')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-center')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-rigth')"><i class="fa fa-circle-o"></i></a></td>
</tr>
<tr>
<td class="pin"><a name="medio"></a><a href="#arriba" onclick=" javascript: marcar('middle-left')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-center')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-rigth')"><i class="fa fa-circle-o"></i></td>
</tr>
<tr>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-left')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-center')"><i class="fa fa-circle-o"></i></a></td>
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-rigth')"><i class="fa fa-circle-o"></i></a></td>
</tr>
</table>
</div>
<canvas id="micanvas" style="position:absolute" >
Tu navegador no soporta canvas.
</canvas>
</div>
</div>
<script language="javascript">
function cargaContextoCanvas(idCanvas){
var elemento = document.getElementById(idCanvas);
if(elemento && elemento.getContext){
var contexto = elemento.getContext('2d');
if(contexto){
return contexto;
}
}
return FALSE;
}
function marcar(ubicacion){
//if (ubicacion == 'arriba'){ var x = '0';var y = '0';}
//if (ubicacion == 'abajo'){ var x = '10';var y = '50';}
//Recibimos el elemento canvas
var ctx = cargaContextoCanvas('micanvas');
if(ctx){
//Creo una imagen conun objeto Image de Javascript
var img = new Image();
var img2 = new Image();
//img.src = document.getElementById("image_output2").src;
//readAsDataURL(
img.src = document.getElementById("imagen_original").src;
document.getElementById("imagen_original").style.display="none";
//img2.src = 'images/logos/a.png';
img2.src = document.getElementById("marca").src;
if (ubicacion =='') {
ubicacion ='middle-center';
}
x = 0,
y = 0;
if(ubicacion.indexOf("top")!=-1)
y = 10;
else if(ubicacion.indexOf("middle")!=-1)
y = (micanvas.height - img2.height)/2;
else
y = micanvas.height-img2.height-10;
if(ubicacion.indexOf("left")!=-1)
x = 10;
else if(ubicacion.indexOf("center")!=-1)
x = (micanvas.width - img2.width) /2;
else
x = micanvas.width-img2.width-10;
var proporcion = ( img.height / img.width );
var ancho = 800;
micanvas.width = ancho;
micanvas.height = (micanvas.width * proporcion);
micanvas.setAttribute('width', ancho);
micanvas.setAttribute('height', micanvas.height);
micanvas.setAttribute('style',"width:100%");
img.onload = function(){
ctx.drawImage(img, 0, 0,micanvas.width,micanvas.height);
ctx.drawImage(img2, x, y);
var identificador = Math.random();
document.getElementById('identificador').value= identificador;
}
}
}
</script>
<br>
<script src="js/load-image.all.min.js"></script>
<!-- <script src="js/load-image.js"></script> -->
<!-- <script src="js/load-image-ios.js"></script> -->
<!-- <script src="js/load-image-orientation.js"></script> -->
<!-- <script src="js/load-image-meta.js"></script> -->
<!-- <script src="js/load-image-exif.js"></script> -->
<!-- <script src="js/load-image-exif-map.js"></script> -->
<!-- jQuery and Jcrop are not required by JavaScript Load Image, but included for the demo -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- <script src="js/vendor/jquery.Jcrop.js"></script> -->
<script src="js/demo.js"></script>
</body>
</html>

View File

@ -1,145 +0,0 @@
<?php
function machitroll_grabar_imagen($data,$identificador) {
$respuesta = new xajaxResponse('utf-8');
$control = md5("$identificador");
//$form_id = $fomulario["formulario_id"];
$imagen= grabar_imagen($data,$control);
$preview = "<img src='$_SESSION[url]/images/secure/?file=150/$imagen'>";
$respuesta->addScript("javascript: document.getElementById('imagen').value= '$imagen' ;");
$respuesta->addAssign("aviso","innerHTML","$preview");
return $respuesta;
}
$xajax->registerFunction("machitroll_grabar_imagen");
function machitroll_grabar($formulario) {
$identificador = $formulario['identificador'];
$control = md5("$identificador");
$data = $formulario['debugConsole'];
$imagen= grabar_imagen($data,$control);
$texto_url = urlencode("#AlertaMachiTroll https://actua.karisma.org.co/alertamachitroll");
$uri = urlencode("$_SESSION[url]/images/secure/?file=600/$imagen");
$url ="https://twitter.com/share?url=$uri&text=$texto_url";
//$respuesta->addScript("window.location.href ='$url';");
$preview = "
<div class='row'>
<div class='center-block'>
<div class='thumbnail'>
<img src='$_SESSION[url]/images/secure/?file=600/$imagen'>
<a download='machitroll.png' href='$_SESSION[url]images/secure/?file=600/$imagen' >
<span class='btn btn-default'><i class='fa fa-download'></i> </span>
</a>
<span class='btn btn-default'>
<a onclick =\"javascript:window.location.href ='$url'; \" ><i class='fa fa-twitter'></i> </a>
</span>
<a href='?set=$formulario[formulario_id]&embebido'>
<span class='btn btn-default'><i class='fa fa-eye'></i> </span>
</a>
<a href='#' onclick = \"javascript:location.reload(); \">
<span class='btn btn-default'><i class='fa fa-refresh'></i> </span>
</a>
</div>
</div>
</div>
";
$respuesta = new xajaxResponse('utf-8');
//$identificador = $formulario['identificador'];
$id_formulario = $formulario['formulario_id'];
$campo_imagen = buscar_campo_tipo("$id_formulario","15");
$formulario[$campo_imagen[0]][0] = $imagen;
$empresa = remplacetas('form_id','id',"$id_formulario",'id_empresa',"") ;
$id_empresa = $empresa[0];
include_once("librerias/conex.php");
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
foreach($formulario as $campo=>$valor){
if(is_array($valor)) {
foreach($valor as $c=>$v){
$consulta = "INSERT INTO form_datos ( timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
( UNIX_TIMESTAMP(),'$_SESSION[id]','$id_empresa','$id_formulario','$ip' ,'$control', '$campo' , '$v')
";
$sql=mysqli_query($consulta,$link);
// $campos .= " $campo // $valor // $c -> $v $consulta <br>";
}
}
}
$resultado = "$preview ";
$respuesta->addAssign("aviso","innerHTML","$resultado");
//$respuesta->addAlert("$resultado");
//$respuesta->addScript("javascript:location.reload(true);");
return $respuesta;
}
$xajax->registerFunction("machitroll_grabar");
function machitroll_grabarX($formulario) {
$respuesta = new xajaxResponse('utf-8');
$control = md5($formulario['identificador']);
$form_id = $fomulario["formulario_id"];
if($formulario['debugConsole'] !="") {
$imagen= grabar_imagen($formulario['debugConsole'],$control);
}
$campo_imagen = buscar_campo_tipo("$form_id","15");
$formulario["$campo_imagen[0]"][0] = "$imagen";
$formulario["formulario_id"] = $fomulario["formulario_id"];
$formulario["formulario_id"] = $fomulario["formulario_id"];
include_once("librerias/conex.php");
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
/*
foreach($formulario as $c=>$v){
$campo .= "( $c : $v )<br> ";
//LISTA ELEMENTOS DE UN ARRAY
if (is_array($v) ){
foreach($v as $C=>$V){
$campo .= " Array ( $c : $V )<br> ";
if($V != '') {
}
}
}
}
*/
foreach($formulario as $C=>$V){
$campo = "$C";
$form_id= $formulario['formulario_id'];
if(is_array($V)) {
foreach($V as $c=>$v){
//$hora = $id_orden['hora'][$C];
//$dia = "$V";
//$control = md5(rand(1,99999999).microtime());
$consulta = "INSERT INTO form_datos ( timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
( UNIX_TIMESTAMP(),'$_SESSION[id]','$_SESSION[id_empresa]','$form_id','$ip' ,'$control', '$campo' , '$v')
";
$sql=mysqli_query($consulta,$link);
$filas .= "<li> $C - $V - $c - $v ///$campo -> $V $consulta $debug </li>";
}
}
}
//$resultado = "Hola mundo ".$formulario[498][0]." <textarea class='form-group'>$formulario[debugConsole]</textarea> ";
//$resultado= " $campo ";
$respuesta->addAssign("aviso","innerHTML","$resultado ");
//$respuesta->addAlert("$resultado");
//$respuesta->addScript("javascript:location.reload(true);");
return $respuesta;
}
$xajax->registerFunction("machitroll_grabarX");
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 KiB

View File

@ -1,487 +0,0 @@
<?php
//include("funciones/funciones.php");
$id_formulario = "61";
$ancho = "600";
/*
$tags = array();
$tags[] = "milfs/addon/machitroll/images/incurable/100.png";
$tags[] = "milfs/addon/machitroll/images/incurable/200.png";
//$tags[] = "milfs/addon/machitroll/images/incurable/300.png";
//$tags[] = "milfs/addon/machitroll/images/incurable/400.png";
//$tags[] = "milfs/addon/machitroll/images/incurable/500.png";
$tags[] = "milfs/addon/machitroll/images/rescatable/100.png";
$tags[] = "milfs/addon/machitroll/images/rescatable/200.png";
//$tags[] = "milfs/addon/machitroll/images/rescatable/300.png";
//$tags[] = "milfs/addon/machitroll/images/rescatable/400.png";
//$tags[] = "milfs/addon/machitroll/images/rescatable/500.png";
foreach ($tags as &$valor) {
$imagen .= "<td><a href='#medio' class='' onclick=\" document.getElementById('marca').src='$valor' \" >
<img class='img ' src='$valor'>
</a></td>";
}
$imagen = "
<div class='table-responsive'>
<table class='table table table-condensed text-center '>
<tr>
$imagen
</tr>
</table>
</div>";
*/
$imagen = "
<div class='table-responsive'>
<table class='table table table-condensed text-center '>
<tbody>
<tr>
<td>
<a href='#medio' class='' onclick=\" document.getElementById('marca').src='milfs/addon/machitroll/images/incurable/100.png '\" >
<img class='img ' src='milfs/addon/machitroll/images/incurable/100.png'>
</a>
<br>
<span>INCURABLE</span>
</td>
<td>
<a href='#medio' class='' onclick=\" document.getElementById('marca').src='milfs/addon/machitroll/images/incurable/200.png '\" >
<img class='img ' src='milfs/addon/machitroll/images/incurable/200.png'>
</a><br>
<span>INCURABLE</span>
</td>
<td>
<a href='#medio' class='' onclick=\" document.getElementById('marca').src='milfs/addon/machitroll/images/rescatable/100.png '\" >
<img class='img ' src='milfs/addon/machitroll/images/rescatable/100.png'>
</a><br>
<span>RESCATABLE</span>
</td>
<td>
<a href='#medio' class='' onclick=\" document.getElementById('marca').src='milfs/addon/machitroll/images/rescatable/200.png '\" >
<img class='img ' src='milfs/addon/machitroll/images/rescatable/200.png'>
</a><br>
<span>RESCATABLE</span>
</td>
</tr>
</tbody>
</table>
</div>";
?>
<script src="https://9b8d22ae00fff2954b7cdd00a6feb4176bc56576.googledrive.com/host/0B7R2T-U-1ZrheTlfaHNQMm0zTWM/plump_modernizr.js"></script>
<link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/cabin" type="text/css"/>
<style type="text/css">
body {
font-family: 'CabinRegular';
font-weight: normal;
font-style: normal;
}
.fileUpload {
position: relative;
overflow: hidden;
margin: 10px;
}
.fileUpload input.upload {
position: absolute;
top: 0;
right: 0;
margin: 10;
padding: 0;
font-size: 50px;
cursor: pointer;
opacity: 0;
filter: alpha(opacity=0);
}
.fa{
font-size:20px;
}
#downlink_hidden , #fieldset_General , #canvas_ed , #original{
display:none;
}
#body{
background-color: white;
}
</style>
<div id='aviso'>
<div id ="body" class="container-fluid">
<div id="div_machitroll" class="container">
<span class='btn btn-primary btn-block' > <!-- <i class="fa fa-picture-o"></i> --> <span class='fa' > Elige un #MachiTroll </span></span>
<?php echo $imagen; ?>
<a name="medio"></a>
<div class="row">
<div class="col-md-12">
<div class='fileUpload btn btn-primary btn-block'>
<span> <i class="fa fa-picture-o"></i> <span class='fa' > Sube pantallazo</span>
<input class='upload' type="file" id="files" name="files[]" /></span>
<div id="original" ></div>
</div>
</div>
</div>
<a name="abajo"></a>
<div class="row">
<div class="col-md-12">
<div class='container-fluid'>
<table style="" class="table text-center table-responsive">
<tr>
<td><a href="#abajo" onclick=" javascript: marcar('top-left')"><i class="fa fa-caret-square-o-left"></i></a></td>
<td><a href="#abajo" onclick=" javascript: marcar('top-center')"><i class="fa fa-caret-square-o-up"></i></a></td>
<td><a href="#abajo" onclick=" javascript: marcar('top-rigth')"><i class="fa fa-caret-square-o-right"></i></a></td>
</tr>
<tr>
<td><a href="#abajo" onclick=" javascript: marcar('middle-left')"><i class="fa fa-caret-square-o-left"></i></a></td>
<td><a href="#abajo" onclick=" javascript: marcar('middle-center')"><i class="fa fa-circle-o"></i></a></td>
<td><a href="#abajo" onclick=" javascript: marcar('middle-rigth')"><i class="fa fa-caret-square-o-right"></i></td>
</tr>
<tr>
<td><a href="#abajo" onclick=" javascript: marcar('bottom-left')"><i class="fa fa-caret-square-o-left"></i></a></td>
<td><a href="#abajo" onclick=" javascript: marcar('bottom-center')"><i class="fa fa-caret-square-o-down"></i></a></td>
<td><a href="#abajo" onclick=" javascript: marcar('bottom-rigth')"><i class="fa fa-caret-square-o-right"></i></a></td>
</tr>
</table>
</div>
</div>
</div>
<!-- editor -->
<div class='container-fluid'>
<div style="background-color:; " >
<img class="center-block" style='display: none' id="marca" name="marca">
<div id="list" style=" "></div>
<img id='image_output2' name='image_output2' src="" class="" />
<div id='div_canvas' style='display: none'> </div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<form id='formulario_machitroll' name='formulario_machitroll' >
<input type='hidden' id="debugConsole" name="debugConsole" >
<input type='hidden' id="identificador" name="identificador" >
<input type='hidden' id="formulario_id" name="formulario_id" value="<?php echo $id_formulario; ?>">
<input type='hidden' id="imagen" name="imagen" value="">
<?php $formulario = formulario_areas("$id_formulario",'campos','','');
echo $formulario; ?>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<!-- -->
<button class='fileUpload btn btn-success btn-block' onclick=" this.disabled= true; xajax_wait('aviso','Grabando... un momento por favor...'); saveViaAJAX(); xajax_machitroll_grabar(xajax.getFormValues('formulario_machitroll'))">
<span><i class="fa fa-save"></i> <span class='fa'> Grabalo! </span></span>
</button>
</div>
</div>
</div><!-- fin aviso -->
</div>
</div>
<script type="text/javascript">
function convertImageToCanvas(i, image) {
var canvas = document.createElement("canvas");
canvas.width = image.width;
canvas.height = image.height;
var ctx = canvas.getContext("2d");
ctx.drawImage(image, 0, 0);
$("body").append(canvas);
};
function convertImageToCanvas(image) {
var canvas = document.createElement("canvas");
canvas.width = image.width;
canvas.height = image.height;
canvas.getContext("2d").drawImage(image, 0, 0);
return canvas;
}
function convertCanvasToImage(canvas) {
var image = new Image();
image.src = canvas.toDataURL("image/png");
return image;
}
function saveViaAJAX()
{
/* function loadCanvas(id) {
var canvas = document.createElement('canvas');
div = document.getElementById(id);
canvas.id = "CursorLayer";
canvas.width = 1224;
canvas.height = 768;
canvas.style.zIndex = 8;
canvas.style.position = "absolute";
canvas.style.border = "1px solid";
div.appendChild(canvas)
}
*/
$(document).ready(function() {
function convertImageToCanvas(i, image) {
var canvasOld = document.getElementById("holamundo");
// canvasOld.holamundo.removeChild(canvasOld);
document.getElementById("div_canvas").innerHTML=""
var canvas = document.createElement("canvas");
div = document.getElementById('div_canvas');
canvas.width = image.width;
canvas.height = image.height;
canvas.id = "holamundo";
var ctx = canvas.getContext("2d");
ctx.drawImage(image, 0, 0);
div.appendChild(canvas);
};
$('.watermark').each(convertImageToCanvas);
});
var testCanvas = document.getElementById("holamundo");
var canvasData = testCanvas.toDataURL("image/png");
var postData = "canvasData="+canvasData;
var debugConsole= document.getElementById("debugConsole");
debugConsole.value=canvasData;
}
</script>
<script>
function archivo(evt) {
var files = evt.target.files; // FileList object
// Obtenemos la imagen del campo "file".
for (var i = 0, f; f = files[i]; i++) {
//Solo admitimos imágenes.
if (!f.type.match('image.*')) {
continue;
}
var reader = new FileReader();
reader.onload = (function(theFile) {
return function(e) {
// Insertamos la imagen
document.getElementById("original").innerHTML = ['<img id="image_output2" name="image_output2" src="', e.target.result,'" title="', escape(theFile.name), '"/>'].join('');
document.getElementById("list").innerHTML = ['<img style="width:<?php echo $ancho; ?>px;" id="image_output" name="image_output" class="img img-responsive watermark center-block" src="', e.target.result,'" title="', escape(theFile.name), '"/>'].join('');
};
})(f);
reader.readAsDataURL(f);
}
}
document.getElementById('files').addEventListener('change', archivo, false);
/* marca */
(function(w){
var wm = (function(w){
var doc = w.document,
gcanvas = {},
gctx = {},
imgQueue = [],
className = "watermark",
watermark = false,
watermarkPosition = "bottom-right",
watermarkPath = "milfs/addon/machitroll/images/incurable/100.png?"+(+(new Date())),
opacity = (255/(100/50)), // 50%
initCanvas = function(){
gcanvas = doc.createElement("canvas");
gcanvas.style.cssText = "display:none;";
gctx = gcanvas.getContext("2d");
doc.body.appendChild(gcanvas);
},
initWatermark = function(){
watermark = new Image();
watermark.src = "";
watermark.src = watermarkPath;
if(opacity != 255){
if(!watermark.complete)
watermark.onload = function(){
applyTransparency();
}
else
applyTransparency();
}else{
applyWatermarks();
}
},
// function for applying transparency to the watermark
applyTransparency = function(){
var w = watermark.width || watermark.offsetWidth,
h = watermark.height || watermark.offsetHeight;
setCanvasSize(w, h);
gctx.drawImage(watermark, 0, 0);
var image = gctx.getImageData(0, 0, w, h);
var imageData = image.data,
length = imageData.length;
for(var i=3; i < length; i+=4){
imageData[i] = (imageData[i]<opacity)?imageData[i]:opacity;
}
image.data = imageData;
gctx.putImageData(image, 0, 0);
watermark.onload = null;
watermark.src = "";
watermark.src = gcanvas.toDataURL();
// assign img attributes to the transparent watermark
// because browsers recalculation doesn't work as fast as needed
watermark.width = w;
watermark.height = h;
applyWatermarks();
},
configure = function(config){
if(config["watermark"])
watermark = config["watermark"];
if(config["path"])
watermarkPath = config["path"];
if(config["position"])
watermarkPosition = config["position"];
if(config["opacity"])
opacity = (255/(100/config["opacity"]));
if(config["className"])
className = config["className"];
initCanvas();
initWatermark();
}
setCanvasSize = function(w, h){
gcanvas.width = w;
gcanvas.height = h;
},
applyWatermark = function(img){
/*
var f = image.height / image.width;
var newHeight = canvas.width * f;
*/
var proporcion = ( img.height / img.width );
var ancho = <?php echo $ancho; ?>;
//var alto_orginal = img.height;
//var alto = (alto_original * proporcion);
//alert("hola pro"+alto);
gcanvas.width = ancho;// || img.offsetWidth;
//gcanvas.width = img.width || img.offsetWidth;
//gcanvas.height = img.height || img.offsetHeight;
gcanvas.height = (gcanvas.width * proporcion);// || img.offsetHeight;
gctx.drawImage(img, 0, 0,ancho,gcanvas.height);
var position = watermarkPosition,
x = 0,
y = 0;
if(position.indexOf("top")!=-1)
y = 20;
else if(position.indexOf("middle")!=-1)
y = (gcanvas.height -watermark.height)/2;
else
y = gcanvas.height-watermark.height-20;
if(position.indexOf("left")!=-1)
x = 20;
else if(position.indexOf("center")!=-1)
x = (gcanvas.width - watermark.width) /2;
else
x = gcanvas.width-watermark.width-20;
gctx.drawImage(watermark, x, y);
img.onload = null;
img.src = gcanvas.toDataURL();
},
applyWatermarks = function(){
setTimeout(function(){
var els = doc.getElementsByClassName(className),
len = els.length;
while(len--){
var img = els[len];
if(img.tagName.toUpperCase() != "IMG")
continue;
if(!img.complete){
img.onload = function(){
applyWatermark(this);
};
}else{
applyWatermark(img);
}
}
},10);
};
return {
init: function(config){
configure(config);
}
};
})(w);
w.wmark = wm;
})(window);
/* marca */
</script>
<script>
function marcar(position){
var position = position;
var original = document.getElementById('image_output2').src ;
var marca = document.getElementById('marca').src ;
document.getElementById('image_output').src = original ;
wmark.init({
/* config goes here */
"position": position, // default "bottom-right"
"opacity": 100, // default 50
"className": "watermark", // default "watermark"
"path": marca
// "path": "../milfs/addon/machitroll/images/054843d530f3c83fcdbd55e688d874ec.png"
});
var identificador = Math.random();
document.getElementById('identificador').value= identificador;
//window.setTimeout("saveViaAJAX()", 3000); ///
//saveViaAJAX(); ///
//xajax_wait('aviso','Subiendo imágen');
//window.setTimeout("xajax_machitroll_grabar_imagen(document.getElementById('debugConsole').value,"+identificador+")", 5000);
}
</script>

View File

@ -1,24 +0,0 @@
<?php
function marcador_grabar($formulario) {
$respuesta = new xajaxResponse('utf-8');
$resultado = "Hola mundo ".$formulario[498][0]."--- $formulario[debugConsole] ---";
$imgData = str_replace(' ','+',$formulario['debugConsole']);
$imgData = substr($imgData,strpos($imgData,",")+1);
$imgData = base64_decode($imgData);
// Path where the image is going to be saved
$nombre= MD5(rand().time());
$filePath = "milfs/tmp/".$nombre.".png";
// Write $imgData into the image file
$file = fopen($filePath, 'w');
fwrite($file, $imgData);
fclose($file);
$respuesta->addAssign("aviso","innerHTML","$resultado");
//$respuesta->addAlert("$resultado");
//$respuesta->addScript("javascript:location.reload(true);");
return $respuesta;
}
$xajax->registerFunction("marcador_grabar");
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -1,412 +0,0 @@
<?php
//include("funciones/funciones.php");
$tags = array();
$tags[] = "milfs/addon/marcador/images/fb198e8742561eb1a9d8da9d95fddeae.png";
$tags[] = "milfs/addon/marcador/images/fca0a98bc665e9f026d5ea4331046893.png";
$tags[] = "milfs/addon/marcador/images/054843d530f3c83fcdbd55e688d874ec.png";
$id_formulario = "58";
foreach ($tags as &$valor) {
$imagen .= "<a href='#' class='list-group-item ' onclick=\" document.getElementById('marca').src='$valor' \" >
<img class='img img-responsive center-block' src='$valor'>
</a>";
}
$imagen = "<div class='container-fluid'><ul class='list-group list-inline'>$imagen<div><div class='clearfix'></ul></div>";
?>
<script src="https://9b8d22ae00fff2954b7cdd00a6feb4176bc56576.googledrive.com/host/0B7R2T-U-1ZrheTlfaHNQMm0zTWM/plump_modernizr.js"></script>
<style type="text/css">
.fileUpload {
position: relative;
overflow: hidden;
margin: 10px;
}
.fileUpload input.upload {
position: absolute;
top: 0;
right: 0;
margin: 10;
padding: 0;
font-size: 50px;
cursor: pointer;
opacity: 0;
filter: alpha(opacity=0);
}
.fa{
font-size:50px;
}
#downlink_hidden , #canvas_ed, #original{
display:none;
}
#body{
background-color: white;
}
</style>
<div id ="body" class="container-fluid">
<div id="div_marcador" class="container">
<?php echo $imagen; ?>
<div class="row">
<div class="col-md-12">
<div class='fileUpload btn btn-primary btn-block'>
<span> <i class="fa fa-picture-o"></i>
<input class='upload' type="file" id="files" name="files[]" /></span>
<div id="original" ></div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class='container-fluid'>
<table style="" class="table text-center table-responsive">
<tr>
<td><a href="#abajo" onclick=" javascript: marcar('top-left')"><i class="fa fa-caret-square-o-left"></i></a></td>
<td><a href="#abajo" onclick=" javascript: marcar('top-center')"><i class="fa fa-caret-square-o-up"></i></a></td>
<td><a href="#abajo" onclick=" javascript: marcar('top-rigth')"><i class="fa fa-caret-square-o-right"></i></a></td>
</tr>
<tr>
<td><a href="#abajo" onclick=" javascript: marcar('middle-left')"><i class="fa fa-caret-square-o-left"></i></a></td>
<td><a href="#abajo" onclick=" javascript: marcar('middle-center')"><i class="fa fa-circle-o"></i></a></td>
<td><a href="#abajo" onclick=" javascript: marcar('middle-rigth')"><i class="fa fa-caret-square-o-right"></i></td>
</tr>
<tr>
<td><a href="#abajo" onclick=" javascript: marcar('bottom-left')"><i class="fa fa-caret-square-o-left"></i></a></td>
<td><a href="#abajo" onclick=" javascript: marcar('bottom-center')"><i class="fa fa-caret-square-o-down"></i></a></td>
<td><a href="#abajo" onclick=" javascript: marcar('bottom-rigth')"><i class="fa fa-caret-square-o-right"></i></a></td>
</tr>
</table>
</div>
</div>
</div>
<!-- editor -->
<div class='container-fluid'>
<a name="abajo"></a>
<div style="background-color:; " >
<img class="center-block" style='display: none' id="marca" name="marca">
<div id="list" style=" "></div>
<img id='image_output2' name='image_output2' src="" class="" />
<div id='div_canvas' style='display: none'> </div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<form id='formulario_marcador' >
<input type='hidden' id="debugConsole" name="debugConsole" >
<?php $formulario = formulario_areas("$id_formulario",'campos','','');
echo $formulario; ?>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class='fileUpload btn btn-success btn-block' onclick="saveViaAJAX(); xajax_marcador_grabar(xajax.getFormValues('formulario_marcador'))"><span><i class="fa fa-save"></i></span> </div>
<div id='aviso'></div>
</div>
</div>
</div>
<script type="text/javascript">
function convertImageToCanvas(i, image) {
var canvas = document.createElement("canvas");
canvas.width = image.width;
canvas.height = image.height;
var ctx = canvas.getContext("2d");
ctx.drawImage(image, 0, 0);
$("body").append(canvas);
};
function convertImageToCanvas(image) {
var canvas = document.createElement("canvas");
canvas.width = image.width;
canvas.height = image.height;
canvas.getContext("2d").drawImage(image, 0, 0);
return canvas;
}
function convertCanvasToImage(canvas) {
var image = new Image();
image.src = canvas.toDataURL("image/png");
return image;
}
function saveViaAJAX()
{
/* function loadCanvas(id) {
var canvas = document.createElement('canvas');
div = document.getElementById(id);
canvas.id = "CursorLayer";
canvas.width = 1224;
canvas.height = 768;
canvas.style.zIndex = 8;
canvas.style.position = "absolute";
canvas.style.border = "1px solid";
div.appendChild(canvas)
}
*/
$(document).ready(function() {
function convertImageToCanvas(i, image) {
var canvasOld = document.getElementById("holamundo");
// canvasOld.holamundo.removeChild(canvasOld);
document.getElementById("div_canvas").innerHTML=""
var canvas = document.createElement("canvas");
div = document.getElementById('div_canvas');
canvas.width = image.width;
canvas.height = image.height;
canvas.id = "holamundo";
var ctx = canvas.getContext("2d");
ctx.drawImage(image, 0, 0);
div.appendChild(canvas);
};
$('.watermark').each(convertImageToCanvas);
});
var testCanvas = document.getElementById("holamundo");
var canvasData = testCanvas.toDataURL("image/png");
var postData = "canvasData="+canvasData;
var debugConsole= document.getElementById("debugConsole");
debugConsole.value=canvasData;
}
</script>
<script>
function archivo(evt) {
var files = evt.target.files; // FileList object
// Obtenemos la imagen del campo "file".
for (var i = 0, f; f = files[i]; i++) {
//Solo admitimos imágenes.
if (!f.type.match('image.*')) {
continue;
}
var reader = new FileReader();
reader.onload = (function(theFile) {
return function(e) {
// Insertamos la imagen
document.getElementById("original").innerHTML = ['<img id="image_output2" name="image_output2" src="', e.target.result,'" title="', escape(theFile.name), '"/>'].join('');
document.getElementById("list").innerHTML = ['<img style="width:max-600px;" id="image_output" name="image_output" class="img img-responsive watermark center-block" src="', e.target.result,'" title="', escape(theFile.name), '"/>'].join('');
};
})(f);
reader.readAsDataURL(f);
}
}
document.getElementById('files').addEventListener('change', archivo, false);
/* marca */
(function(w){
var wm = (function(w){
var doc = w.document,
gcanvas = {},
gctx = {},
imgQueue = [],
className = "watermark",
watermark = false,
watermarkPosition = "bottom-right",
watermarkPath = "watermark.png?"+(+(new Date())),
opacity = (255/(100/50)), // 50%
initCanvas = function(){
gcanvas = doc.createElement("canvas");
gcanvas.style.cssText = "display:none;";
gctx = gcanvas.getContext("2d");
doc.body.appendChild(gcanvas);
},
initWatermark = function(){
watermark = new Image();
watermark.src = "";
watermark.src = watermarkPath;
if(opacity != 255){
if(!watermark.complete)
watermark.onload = function(){
applyTransparency();
}
else
applyTransparency();
}else{
applyWatermarks();
}
},
// function for applying transparency to the watermark
applyTransparency = function(){
var w = watermark.width || watermark.offsetWidth,
h = watermark.height || watermark.offsetHeight;
setCanvasSize(w, h);
gctx.drawImage(watermark, 0, 0);
var image = gctx.getImageData(0, 0, w, h);
var imageData = image.data,
length = imageData.length;
for(var i=3; i < length; i+=4){
imageData[i] = (imageData[i]<opacity)?imageData[i]:opacity;
}
image.data = imageData;
gctx.putImageData(image, 0, 0);
watermark.onload = null;
watermark.src = "";
watermark.src = gcanvas.toDataURL();
// assign img attributes to the transparent watermark
// because browsers recalculation doesn't work as fast as needed
watermark.width = w;
watermark.height = h;
applyWatermarks();
},
configure = function(config){
if(config["watermark"])
watermark = config["watermark"];
if(config["path"])
watermarkPath = config["path"];
if(config["position"])
watermarkPosition = config["position"];
if(config["opacity"])
opacity = (255/(100/config["opacity"]));
if(config["className"])
className = config["className"];
initCanvas();
initWatermark();
}
setCanvasSize = function(w, h){
gcanvas.width = w;
gcanvas.height = h;
},
applyWatermark = function(img){
/*
var f = image.height / image.width;
var newHeight = canvas.width * f;
*/
var proporcion = ( img.height / img.width );
var ancho = 600;
//var alto_orginal = img.height;
//var alto = (alto_original * proporcion);
//alert("hola pro"+alto);
gcanvas.width = ancho;// || img.offsetWidth;
//gcanvas.width = img.width || img.offsetWidth;
//gcanvas.height = img.height || img.offsetHeight;
gcanvas.height = (gcanvas.width * proporcion);// || img.offsetHeight;
gctx.drawImage(img, 0, 0,ancho,gcanvas.height);
var position = watermarkPosition,
x = 0,
y = 0;
if(position.indexOf("top")!=-1)
y = 20;
else if(position.indexOf("middle")!=-1)
y = (gcanvas.height -watermark.height)/2;
else
y = gcanvas.height-watermark.height-20;
if(position.indexOf("left")!=-1)
x = 20;
else if(position.indexOf("center")!=-1)
x = (gcanvas.width - watermark.width) /2;
else
x = gcanvas.width-watermark.width-20;
gctx.drawImage(watermark, x, y);
img.onload = null;
img.src = gcanvas.toDataURL();
},
applyWatermarks = function(){
setTimeout(function(){
var els = doc.getElementsByClassName(className),
len = els.length;
while(len--){
var img = els[len];
if(img.tagName.toUpperCase() != "IMG")
continue;
if(!img.complete){
img.onload = function(){
applyWatermark(this);
};
}else{
applyWatermark(img);
}
}
},10);
};
return {
init: function(config){
configure(config);
}
};
})(w);
w.wmark = wm;
})(window);
/* marca */
</script>
<script>
function marcar(position){
var position = position;
var original = document.getElementById('image_output2').src ;
var marca = document.getElementById('marca').src ;
document.getElementById('image_output').src = original ;
wmark.init({
/* config goes here */
"position": position, // default "bottom-right"
"opacity": 100, // default 50
"className": "watermark", // default "watermark"
"path": marca
// "path": "../milfs/addon/marcador/images/054843d530f3c83fcdbd55e688d874ec.png"
});
}
</script>

View File

@ -1,108 +0,0 @@
<?php
function tuitealo($form,$tipo) {
if($tipo =='formulario') {
$formulario = formulario_areas('297','campos');
$descripcion = remplacetas('form_id','id','297','descripcion',"") ;
$nombre = remplacetas('form_id','id','297','nombre',"") ;
$formulario ="
<h1 >$nombre[0]</h1>
<h2>$descripcion[0]</h2>
<form id='form_tuitealo' >
$formulario
<br>
<div id='tuitealo_div'>
<div id='tuitealo_error'></div>
<a class='btn btn-block btn-primary' onclick=\"xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'previsualizar');\">Previsualizar</a>
</div>
</form>
</div>
<br>
<div class='text-center'>
<p class='text-center'>Powered by: <a href='https://qwerty.co/milfs'>MILFS</a></p>
</div>
<br>
";
return $formulario;
}
$respuesta = new xajaxResponse('utf-8');
$sujeto = $form[1301][0];
$accion = $form[1302][0];
$verbo = $form[1303][0];
$tiempo = $form[1305][0];
$ht = $form[1306][0];
$mensaje = $form[1307][0];
$arroba = $form[1301][0];
if( $accion =="" or $verbo =="" or $tiempo =="" or $ht =="" or $arroba =="" ) {
$error ="<div class='alert alert-warning text-center'><h1><i class='fa fa-exclamation-triangle'></i> Hay campos vacíos</h1></div>";
$respuesta->addAssign("tuitealo_error","innerHTML","$error");
return $respuesta;
}
$arroba = remplacetas('form_datos','control',"$arroba",'contenido',"id_campo = '77'") ;
$arroba = $arroba[0];
$url_propia = urlencode("https://patos.redpatodos.co");
$texto="$sujeto $accion $verbo $tiempo $ht $mensaje cc $arroba ";
$texto = ucfirst($texto);
$texto_url=urlencode($texto);
$largo = strlen($texto.$url_propia);
if($largo > 140) { $alert ="danger"; $mensaje ="<i class='fa fa-exclamation-triangle'></i> El texto es demasiado largo y se recortará";
$texto = substr($texto, 0, 140)."..."; }
else{$alert='success'; $mensaje="";}
$url ="https://twitter.com/share?url=$url_propia&text=$texto_url";
$previsualizar ="<br>
<div id='tuitealo_error'></div>
<div class='alert alert-$alert'><div class='badge'>$largo</div>$mensaje<h1>$texto</h1></div>
<a class='btn btn-block btn-primary' onclick=\"xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'previsualizar');\">Previsualizar</a>
<a class='btn btn-block btn-success' onclick=\"xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'confirmar');\">Tuitéalo</a>
<img style='width:1px;' src='milfs/images/100x100.png'
onload=\"
document.getElementById('1301[0]').onchange = function(){xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'previsualizar')};
document.getElementById('1302[0]').onkeyup = function(){xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'previsualizar')};
document.getElementById('1303[0]').onchange = function(){xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'previsualizar')};
document.getElementById('1304[0]').onchange = function(){xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'previsualizar')};
document.getElementById('1305[0]').onchange = function(){xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'previsualizar')};
document.getElementById('1306[0]').onchange = function(){xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'previsualizar')};
document.getElementById('1307[0]').onchange = function(){xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'previsualizar')};
\" >
";
if( $tipo =="previsualizar") {
$control = md5(rand(1,99999999).microtime());
$formulario_grabar ="
<input type='hidden' id= '1308[0]' name= '1308[0]' value='$texto' >
<input type='hidden' id= 'form_id' name= 'form_id' value='297' >
<input type='hidden' id= 'control' name= 'control' value='$control' >
";
$previsualizar .="$formulario_grabar";
$respuesta->addAssign("tuitealo_div","innerHTML","$previsualizar");
}else{
// <div onclick=\" xajax_formulario_grabar(xajax.getFormValues('$control'));\" class='btn btn-block btn-success'>Grabar</div>
//$respuesta->addAssign("xajax_formulario_grabar(xajax.getFormValues('form_tuitealo'));");
$respuesta->addScript("window.location.href ='$url';");
}
return $respuesta;
}
$xajax->registerFunction("tuitealo");
?>

View File

@ -1,66 +0,0 @@
<?php
///este archivo debe estar un nivel superior al directorio milfs
//session_start();
//ini_set('display_errors', 'On');
//require ('milfs/xajax/xajax.inc.php');
//$xajax = new xajax();
//require ('milfs/funciones/funciones.php');
//require("tuitealo/funciones/funciones.php");
//require ('milfs/funciones/convert.php');
//require ('milfs/funciones/login.php');
//require_once ('milfs/includes/markdown.php');
//require ("milfs/funciones/conex.php");
//$xajax->processRequests();
$logo = remplacetas('empresa','id','1','imagen') ;
$direccion = remplacetas('empresa','id','1','direccion') ;
$telefono = remplacetas('empresa','id','1','telefono') ;
$email = remplacetas('empresa','id','1','email') ;
?>
<!DOCTYPE html>
<html lang="en">
<head >
<meta charset="utf-8">
<meta name="viewport" content="user-scalable=no, width=device-width, maximum-scale=1, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="fredyrivera" >
<?php $xajax->printJavascript("milfs/xajax/");
?>
<link rel="shortcut icon" href="favicon-152.png">
<link rel="apple-touch-icon-precomposed" href="favicon-152.png">
<link href="milfs/css/font-awesome/css/font-awesome.css" rel="stylesheet">
<link href="milfs/css/bootstrap.min.css" rel="stylesheet">
<!-- <link href="milfs/css/estilos.php" rel="stylesheet"> -->
<script src="milfs/js/jquery.min.js"></script>
<script src="milfs/js/jquery.timelinr-0.9.54.js"></script>
<script type="text/javascript">
//se.onchange = function(){alert('Dynamic')};
</script>
</head>
<body >
<!-- /container -->
<div id ='contenedor' style=' ' class="container-fluid">
<?php echo tuitealo("",'formulario'); ?>
</div>
<br>
<br>
<script src="milfs/js/bootstrap.min.js"></script>
<script src="milfs/js/scripts.js"></script>
</body>
</html>

View File

@ -1,40 +0,0 @@
<?php
session_start();
//ini_set('display_errors', 'On');
require ('xajax/xajax.inc.php');
$xajax = new xajax();
require ('funciones/funciones.php');
require ('funciones/convert.php');
require ("includes/markdown.php");
require ("funciones/conex.php");
$datos['id']=$_REQUEST['id'];
if(isset($_REQUEST['identificador'])) {$datos['identificador']=$_REQUEST['identificador'];}
if(isset($_REQUEST['dato'])) {$datos['dato']=$_REQUEST['dato'];}
if(isset($_REQUEST['inicio'])) {$datos['inicio']=$_REQUEST['inicio'];}
if(isset($_REQUEST['start'])) {$datos['start']=$_REQUEST['start'];}
if(isset($_REQUEST['fin'])) {$datos['fin']=$_REQUEST['fin'];}
if(isset($_REQUEST['end'])) {$datos['end']=$_REQUEST['end'];}
if(isset($_REQUEST['tipo'])) {$datos['tipo']=$_REQUEST['tipo'];}
if(isset($_REQUEST['formato'])) {$datos['formato']=$_REQUEST['formato'];}
if(isset($_REQUEST['registros'])) {$datos['registros']=$_REQUEST['registros'];}
if(isset($_REQUEST['pagina'])) {$datos['pagina']=$_REQUEST['pagina'];}
if(isset($_REQUEST['plantilla'])) {$datos['plantilla']=$_REQUEST['plantilla'];}
/*$datos['dato']=$_REQUEST['dato'];
$datos['inicio']=$_REQUEST['inicio'];
$datos['start']=$_REQUEST['start'];
$datos['fin']=$_REQUEST['fin'];
$datos['end']=$_REQUEST['end'];
$datos['tipo']=$_REQUEST['tipo'];*/
if(isset($_REQUEST['debug'])) {ini_set('display_errors', 'On');}
if(!isset($_REQUEST['formato'])) {
header('Content-Type: application/json');
echo json($datos);
}else{
echo "<br><br><div class='container-fluid '>".consultar_contenido_formulario("$datos[id]","$datos[registros]","$datos[pagina]","$datos[formato]",'',"$datos[plantilla]")."</div>";
}
//echo "hola /// $_REQUEST[id] // " ;
?>

Some files were not shown because too many files have changed in this diff Show More