1
0
Fork 0
This commit is contained in:
Hacky Purple 2018-07-03 00:00:02 -05:00
commit 48d39b03b2
470 changed files with 205 additions and 133295 deletions

BIN
.DS_Store vendored

Binary file not shown.

8
.gitignore_global Normal file
View File

@ -0,0 +1,8 @@
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
milfs/includes/datos.php

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "milfs"]
path = milfs
url = https://code.tupale.co/qwerty/milfs.git

BIN
iconoclasta/.DS_Store vendored

Binary file not shown.

BIN
images/.DS_Store vendored

Binary file not shown.

236
index.php
View File

@ -170,6 +170,11 @@ if ($variable !=''){
$id_empresa = $v[1];
$id =$id_empresa;
$titulo = remplacetas('empresa','id',"$id_empresa",'razon_social','') ;
$librerias_cabeza ="
<!-- tabla de contenido -->
<link rel='stylesheet' href='./librerias/bootstrap-toc/bootstrap-toc.min.css'>
<script src='./librerias/bootstrap-toc/bootstrap-toc.min.js'></script>
";
if($titulo[0] !="") {
$logo = remplacetas('empresa','id',"$id_empresa",'imagen','') ;
@ -186,7 +191,7 @@ if ($variable !=''){
}
$acceso = 1;
$menu ="
<div class='col-sm-2 hidden-xs hidden-sm'>
<div class='col-sm-2 hidden-xs hidden-sm' id='caja_lateral_derecha'>
<div class='container'>
<nav style=' max-height:95% !important ; overflow:auto !important; ' id='toc' data-spy='affix' data-toggle='toc'></nav>
</div>
@ -209,10 +214,15 @@ if ($variable !=''){
$background_imagen = buscar_imagen("$set","","","$id_empresa");
$uri_set = "";
$cantidad_registros="";
$orden="DESC";
$librerias_cabeza ="
<!-- tabla de contenido -->
<link rel='stylesheet' href='./librerias/bootstrap-toc/bootstrap-toc.min.css'>
<script src='./librerias/bootstrap-toc/bootstrap-toc.min.js'></script>
";
$orden="";
$menu ="
<div class='col-sm-2 hidden-xs hidden-sm'>
$menu ="</div>
<div class='col-sm-2 hidden-xs hidden-sm' id='caja_lateral_derecha'>
<div class='container'>
<nav style=' max-height:95% !important ; overflow:auto !important; ' id='toc' data-spy='affix' data-toggle='toc'></nav>
</div>
@ -339,7 +349,40 @@ if ($variable !=''){
//$embebido = "1";
//$onload = formulario_embebido_ajax($form[0],'$identificador','edit');
$librerias_cabeza ="
<script src='./librerias/summernote/summernote.js'></script>
<link href='./librerias/summernote/summernote.css' rel='stylesheet'>
";
$librerias_pie ="
<script type='text/javascript'>
//// wysiwyg
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>
";
$form = remplacetas('form_datos','control',$identificador,'form_id',"") ;
$empresa = remplacetas('form_id','id',$form['0'],'id_empresa',"") ;
$id_empresa = $empresa[0];
@ -365,6 +408,40 @@ if ($variable !=''){
$form =$v[1];
$empresa = remplacetas('form_id','id',$form,'id_empresa',"") ;
$id_empresa = $empresa[0];
$librerias_cabeza ="
<script src='./librerias/summernote/summernote.js'></script>
<link href='./librerias/summernote/summernote.css' rel='stylesheet'>
";
$librerias_pie ="
<script type='text/javascript'>
//// wysiwyg
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>
";
$onload =" <script type=\"text/javascript\">xajax_formulario_embebido_ajax('','$form','','nuevo')</script>";
}
elseif($v[0] =='c') {
@ -446,11 +523,18 @@ if ($variable !=''){
$registros=1;
$plantilla="landingpage";
$librerias_cabeza ="$presentacion_cabeza $librerias_galeria
$librerias_cabeza ="
<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/utils.js'></script>
$presentacion_cabeza $librerias_galeria
";
$librerias_pie ="$aplicacion_pie
$librerias_pie ="
$aplicacion_pie
<!-- <script>
if('serviceWorker' in navigator) {
navigator.serviceWorker
@ -618,11 +702,47 @@ if('serviceWorker' in navigator) {
/// g=FORMULARIO EMBEBIDO
$no_mostrar ="display:none; ";
$form =$v[1];
if($form =="" ){ header ("Location:./"); }
$empresa = remplacetas('form_id','id',$form,'id_empresa',"") ;
$razon_social_portal = remplacetas('empresa','id',"1",'razon_social','') ;
$id_empresa = $empresa[0];
$embebido = "1";
$onload = formulario_embebido($form,$opciones);
$librerias_cabeza ="
<script src='./librerias/summernote/summernote.js'></script>
<link href='./librerias/summernote/summernote.css' rel='stylesheet'>
";
$librerias_pie ="
<script type='text/javascript'>
//// wysiwyg
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>
";
}
elseif($v[0] =='h') {
/// h=ADDON
@ -961,10 +1081,11 @@ $uri = $_SERVER['REQUEST_URI'];
<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]"; ?>">
<title><?php echo @$titulo[0]; ?> <?php echo strip_tags($slogan[0]); ?> Tupale.co </title>
<link href="./librerias/font-awesome/css/font-awesome.min.css" rel="stylesheet" >
<!--
<link href="./librerias/sidebar/css/simple-sidebar.css" rel="stylesheet" >
-->
<?php $xajax->printJavascript("milfs/xajax/");
$xajax->statusMessagesOn();
@ -990,7 +1111,7 @@ $uri = $_SERVER['REQUEST_URI'];
$barra="
<div class='noprint nomostrar' style=' $no_mostrar '>
<nav class='navbar navbar-inverse navbar-fixed-top topnav navbar-principal ' role='navigation'>
<nav class='navbar navbar-fixed-top topnav navbar-principal ' role='navigation'>
<div style='padding:10px; ' class='container topnav '>
@ -1000,7 +1121,7 @@ $uri = $_SERVER['REQUEST_URI'];
<li class='dropdown ' >
<a style='background-color:#F3F1F0; color:red; border-top-left-radius: 0px; border-bottom-left-radius: 0px;' href='#' class='dropdown-toggle menu_tupale img-rounded' data-toggle='dropdown' role='button' aria-haspopup='true' aria-expanded='false'><i class='fa fa-bars'></i><span class='hidden-xs'> $portal_sigla<span></a>
<ul class='dropdown-menu' style='background-color: white;' >
<ul class='dropdown-menu' >
<li><a class='' href='$portal_url'><i class='fa fa-home'></i> Portal</a></li>
<li><a class='' href='$link_empresa'>$sigla[0] Inicio</a></li>
<li><a href='milfs/'>Administrador</a></li>
@ -1024,19 +1145,23 @@ $uri = $_SERVER['REQUEST_URI'];
echo $css; ?>
<script src="./librerias/jquery/jquery-2.1.4.min.js" ></script>
<script src="./librerias/bootstrap/js/bootstrap.min.js" ></script>
<script src="./librerias/charts/Chart.bundle.js"></script>
<script src="./librerias/charts/utils.js"></script>
<!-- <script src="./librerias/charts/Chart.bundle.js"></script>
<script src="./librerias/charts/utils.js"></script> -->
<script src="./librerias/lazy/jquery.lazy.min.js"></script>
<script src='./librerias/summernote/summernote.js'></script>
<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>
$(function() {
$('.lazy').lazy({
// your configuration goes here
combined: true,
//combined: true,
delay: 1000,
scrollDirection: 'vertical',
effect: 'fadeIn',
visibleOnly: true,
// scrollDirection: 'vertical',
//effect: 'fadeIn',
//visibleOnly: true,
onError: function(element) {
console.log('error loading ' + element.data('src'));
}
@ -1120,33 +1245,28 @@ $menu_lateral = "
}
?>
<link href="./milfs/css/style.css" rel="stylesheet">
<script src="milfs/js/scripts.js"></script>
<!-- include codemirror (codemirror.css, codemirror.js, xml.js, formatting.js) -->
<link rel="stylesheet" type="text/css" href="./librerias/codemirror/codemirror.css">
<link rel="stylesheet" type="text/css" href="./librerias/codemirror/monokai.css">
<script type="text/javascript" src="./librerias/codemirror/codemirror.js"></script>
<script type="text/javascript" src="./librerias/codemirror/xml.js"></script>
<script type="text/javascript" src="./librerias/codemirror/formatting.js"></script>
<!-- wysiwyg -->
<script src="./librerias/summernote/summernote.js"></script>
<!-- include summernote css/js-->
<link href="./librerias/summernote/summernote.css" rel="stylesheet">
<link href="./milfs/css/style.css" rel="stylesheet">
<!-- add after bootstrap.min.js -->
<script src="milfs/js/scripts.js"></script>
<link rel="stylesheet" href="./librerias/bootstrap-toc/bootstrap-toc.min.css">
<script src="./librerias/bootstrap-toc/bootstrap-toc.min.js"></script>
<script src="./librerias/ekko-lightbox/4.0.1/ekko-lightbox.min.js"></script>
<link href='librerias/calendar/fullcalendar.min.css' rel='stylesheet' />
<link href='librerias/calendar/fullcalendar.print.min.css' rel='stylesheet' media='print' />
<script src='librerias/calendar/lib/moment.min.js'></script>
<script src='librerias/calendar/fullcalendar.min.js'></script>
<script src='librerias/calendar/locale/es.js'></script>
<!-- tabla de contenido -->
<!--
<link rel="stylesheet" href="./librerias/bootstrap-toc/bootstrap-toc.min.css">
<script src="./librerias/bootstrap-toc/bootstrap-toc.min.js"></script>
-->
<!-- <script src="./librerias/ekko-lightbox/4.0.1/ekko-lightbox.min.js"></script> -->
<!--firma -->
<!--
<script src="librerias/firma/signature_pad.js"></script>
<!-- firma pie -->
<!--
<script src="librerias/firma/app.js"></script>
-->
<?php echo $css_adicional;
if(!isset($_SESSION['id']) ){ ?>
@ -1183,9 +1303,22 @@ document.oncopy = addLink;
}else{
echo " " ;
}
if(isset($_SESSION['id'])) {$id_empresa_portada='1'; echo "<span style=' $no_mostrar '>".panel_aplicaciones('1',"$_SESSION[id_empresa]","")."</span>"; }
if(isset($_SESSION['id'])) {$id_empresa_portada='1'; echo "
<span style=' $no_mostrar '>".panel_aplicaciones('1',"$_SESSION[id_empresa]","")."</span>"; }
if(isset($_REQUEST['eventos'])) {
//$embebido='1';
$librerias_pie="
<link href='librerias/calendar/fullcalendar.min.css' rel='stylesheet' />
<link href='librerias/calendar/fullcalendar.print.min.css' rel='stylesheet' media='print' />
<script src='librerias/calendar/lib/moment.min.js'></script>
<script src='librerias/calendar/fullcalendar.min.js'></script>
<script src='librerias/calendar/locale/es.js'></script>
";
$empresa = remplacetas('form_id','id',$_REQUEST['eventos'],'id_empresa',"") ;
$css_adicional = remplacetas('form_parametrizacion','campo',"index",'descripcion'," tabla='css' and opcion = 'adicional' and id_empresa = '$empresa[0]'") ;
if($css_adicional[0] !="") {
@ -1361,13 +1494,13 @@ echo $css_adicional;
<div class="col-md-9">
<div id='formulario_login' class='' ></div>
<div class='container' id='contenedor_cabecera'>
<div class='col-sm-12 col-md-3' id='logo_cabecera'>
<div class='container' div='contenedor_cabecera'>
<div class='col-md-3' id='logo_cabecera'>
<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]; ?>">
</a>
</div>
<div class='col-sm-12 col-md-9' id="encabezado_proyecto">
<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>
<div id='slogan_cabecera'><p><?php echo "$slogan[0] "; ?> </p></div>
</div>
@ -1518,12 +1651,9 @@ echo $css_adicional;
<?php echo $onload; } ?>
<script src="librerias/firma/app.js"></script>
<script type="text/javascript" >
</script>
<script type="text/javascript">
<script type="text/javascript">
$(document).delegate('*[data-toggle="lightbox"]', 'click', function(event) {
@ -1531,20 +1661,6 @@ $(document).delegate('*[data-toggle="lightbox"]', 'click', function(event) {
$(this).ekkoLightbox();
});
//// wysiwyg
var edit = function() {
$('.wysiwyg').summernote({height: 250, codemirror: { theme: 'default' },dialogsInBody: true});
};
var save = function() {
var makrup = $('.wysiwyg').summernote('code');
$('.wysiwyg').summernote('destroy');
};
$(document).ready(function() {
$('.wysiwyg_auto').summernote({dialogsInBody: true});
});
$(".menu-toggle").click(function(e) {
e.preventDefault();
@ -1569,7 +1685,7 @@ $(document).ready(function() {
<noscript><p><img src="//stats.tupale.co/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
<?php echo $librerias_pie; ?>
<link href="./librerias/font-awesome/css/font-awesome.min.css" rel="stylesheet" >
<style>

View File

@ -1033,35 +1033,35 @@
<div class="col-sm-4 col-lg-4">
<img class="img-circle" src="temas/landingpage/images/equipo_manada.png" alt="manada malinois" width="140" height="140">
<h2>La manada Malinois</h2>
<p>Donec sed odio dui. Etiam porta sem malesuada magna mollis euismod. Nullam id dolor id nibh ultricies vehicula ut id elit. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
<p>Motivación, inspiración y terapia. Los animales como fuente de amor incondicional, desestress, entretenimiento y enfoque para levantarse cada día y seguir adelante.
</p>
<p><a class="btn btn-default" href="#" role="button">Conocer más</a></p>
</div>
<div class="col-sm-4 col-lg-4">
<img class="img-circle" src="temas/landingpage/images/equipo_tigre.png" alt="tigre" width="140" height="140">
<h2>El Tigre</h2>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.
<p>Cocinero de vocación, Programador Senior de oficio, apasionado por el aprendizaje autodidacta y la participación activa en la creación de productos tecnológicos, acciones y oportunidades, para el desarrollo personal, comunitario y social, apasionado por la gestión del riesgo, borrador de goloza profesional.
</p>
<p><a class="btn btn-default" href="#" role="button">Conocer más</a></p>
</div>
<div class="col-sm-4 col-lg-4">
<img class="img-circle" src="temas/landingpage/images/equipo_tigra.png" alt="tigra" width="140" height="140">
<h2>La Tigra</h2>
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
<p>Contadora de profesión, transformando mi proyecto de vida hacia una vida en el campo, gestionando la constitución, formalización y administración de las empresas y fundaciones que nos permiten dar vida y ejecutar proyectos, contrataciones y convenios de asociación con impacto, transparencia y gestión profesional, apasionada por mi manada Malinois.
</p>
<p><a class="btn btn-default" href="#" role="button">Conocer más</a></p>
</div>
<div class="col-sm-4 col-sm-offset-2 col-lg-4 col-lg-offset-2">
<img class="img-circle" src="temas/landingpage/images/equipo_kleper.png" alt="kleper" width="140" height="140">
<h2>Kleper</h2>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.
<p>Filósofo y experto en redes y seguridad informática, afrontando las contradicciones de la vida sin ser inconsecuente, apasionado por las redes libres y nuevas formas de construir comunidad a través del uso y apropiación de las tecnologías.
</p>
<p><a class="btn btn-default" href="#" role="button">Conocer más</a></p>
</div>
<div class="col-sm-4 col-lg-4">
<img class="img-circle" src="temas/landingpage/images/equipo_pionerita.png" alt="pionerita" width="140" height="140">
<h2>Pionerita</h2>
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
<p>Profesional Transdisciplinar en Diseño Estratégico, Ciencias Sociales y Programación Web, apasionada por la Neoruralidad en la búsqueda de modelos, herramientas y proyectos que aporten al desarrollo del campo y las nuevas ruralidades como proyecto de Vida viable
</p>
<p><a class="btn btn-default" href="#" role="button">Conocer más</a></p>
</div>

BIN
librerias/.DS_Store vendored

Binary file not shown.

View File

@ -5,6 +5,13 @@
*/
@import url(../../lib/font/source-sans-pro/source-sans-pro.css);
@media (max-width: 991px) {
#inicio img{
width: 90% !important;
}
}
.scrollable {
bottom: 0px;
overflow-y: auto !important;
@ -269,10 +276,10 @@ body {
*********************************************/
.reveal section img {
margin: 15px 0px;
background: rgba(255, 255, 255, 0.12);
/* border: 4px solid #222;*/
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15); }
/* background: rgba(255, 255, 255, 0.12);
border: 4px solid #222;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15); */
}
.reveal section img.plain {
border: 0;
box-shadow: none; }

1
milfs Submodule

@ -0,0 +1 @@
Subproject commit 3abf313533b9ec3763a76db79bd5e785b1874672

BIN
milfs/.DS_Store vendored

Binary file not shown.

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");
?>

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