Skip to content

Commit 254510a

Browse files
committed
Merge pull request #10 from nosolored/master
Fix Notice of Renewal and Adminer integration
2 parents 0a9e333 + 5c782f3 commit 254510a

7 files changed

+914
-13
lines changed

adminer/adminer.php

+818
Large diffs are not rendered by default.

adminer/loader.adminer.php

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
require '../funciones.php';
3+
session_start();
4+
seguridad();
5+
if(isset($_POST['logout'])){
6+
header('Location: '.$_SESSION['url_main']);
7+
}
8+
9+
function adminer_object() {
10+
class AdminerSoftware extends Adminer {
11+
function credentials() {
12+
require '../config.php';
13+
// server, username and password for connecting to database
14+
return array($config['db']['host'], $config['db']['user'], $config['db']['pass']);
15+
}
16+
17+
function database() {
18+
require '../config.php';
19+
// database name, will be escaped by Adminer
20+
return $config['db']['name'];
21+
}
22+
}
23+
return new AdminerSoftware;
24+
}
25+
require_once 'adminer.php';

adminer/login.php

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
header('Location: ../index.php');

funciones/configuracion_searcher.php

+39-2
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,43 @@
512512
$postal_code = '';
513513
$vat = '';
514514
}
515-
$sql = "UPDATE members SET name='".$name."',surname='".$surname."',country='".$country."',language='".$language."',phone='".$phone."',email='".$email."',renewal='".date("Y-m-d",strtotime($renewal))."',quota='".$quota."',type='".$type."',comment='".$comment."',status='".$status."', institution='".$institution."', address='".$address."', postal_code='".$postal_code."', vat='".$vat."' WHERE cod='".$cod."'";
515+
516+
$sql = "SELECT renewal,email_renewal,email_expired FROM members WHERE cod='".$cod."'";
517+
$result = $link->query($sql);
518+
$row = $result->fetch_assoc();
519+
if( $row['renewal'] == date("Y-m-d",strtotime($renewal))){
520+
$email_renewal = $row['email_renewal'];
521+
$email_expired = $row['email_expired'];
522+
if($row['email_renewal'] == '1'){
523+
$notice_email = "Yes";
524+
}else{
525+
$notice_email = "No";
526+
}
527+
}else{
528+
$email_renewal = 0;
529+
$email_expired = 0;
530+
$notice_email = "No";
531+
}
532+
533+
$sql = "UPDATE members SET
534+
name='".$name."',
535+
surname='".$surname."',
536+
country='".$country."',
537+
language='".$language."',
538+
phone='".$phone."',
539+
email='".$email."',
540+
renewal='".date("Y-m-d",strtotime($renewal))."',
541+
email_renewal='".$email_renewal."',
542+
email_expired='".$email_expired."',
543+
quota='".$quota."',
544+
type='".$type."',
545+
comment='".$comment."',
546+
status='".$status."',
547+
institution='".$institution."',
548+
address='".$address."',
549+
postal_code='".$postal_code."',
550+
vat='".$vat."'
551+
WHERE cod='".$cod."'";
516552
//echo $sql;
517553
$result = $link->query($sql);
518554
if (!$result) {
@@ -522,7 +558,8 @@
522558
$result = $link->query($sql);
523559
$aux = $result->fetch_assoc();
524560

525-
echo json_encode(array("status"=>"true","name"=>$name,"surname"=>$surname,"email"=>$email,"cod"=>"member".$cod,"renewal"=>date("d/m/Y",strtotime($renewal)),"type"=>$aux['name'],"quota"=>$quota));
561+
$status_name = obtener("status","cod",$status,"status");
562+
echo json_encode(array("status"=>"true","name"=>$name,"surname"=>$surname,"email"=>$email,"cod"=>"member".$cod,"renewal"=>date("d/m/Y",strtotime($renewal)),"type"=>$aux['name'],"quota"=>$quota,"status"=>$status_name,"notice_email"=>$notice_email));
526563
}
527564

528565
if ( $_REQUEST['tab'] == 'renovar_miembro'){

index.php

+21-6
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<link rel="stylesheet" type="text/css" href="css/custom.css" media="screen">
3131
<!-- <link type="text/css" href="css/green.css" rel="stylesheet">-->
3232
<!-- Your Custom Stylesheet -->
33+
<link rel="stylesheet" type="text/css" href="css/jquery-ui-1.8.17.custom.css" media="screen">
3334

3435
<!--swfobject - needed only if you require <video> tag support for older browsers -->
3536
<script src="js/swfobject.js" type="text/javascript"></script>
@@ -55,12 +56,13 @@
5556
<!--[if IE]> <link rel="stylesheet" type="text/css" media="all" href="css/ie.css"/> <script src="js/html5.js"></script> <![endif]-->
5657
<!--Upgrade MSIE5.5-7 to be compatible with MSIE8: http://ie7-js.googlecode.com/svn/version/2.1(beta3)/IE8.js -->
5758
<!--[if lt IE 8]> <script src="js/IE8.js"></script> <![endif]-->
59+
<script src="js/jquery-ui.min.js" type="text/javascript"></script>
5860
<script type="text/javascript">
5961
$(document).ready(function(){
6062
/* setup navigation, content boxes, etc... */
6163
Administry.setup();
6264

63-
$(".icon-1").click(function(e) {
65+
$(".edit-member").click(function(e) {
6466
e.preventDefault();
6567
e.stopPropagation();
6668
var vcod = $(this).parent().attr("id");
@@ -100,10 +102,17 @@ function(data){
100102
$("#result_edit").html('');
101103
//Actualizar los 3 campos de la tabla que se ha editado
102104
alert("updated correctly");
103-
$("#"+data.cod).prev().prev().prev().prev().html(data.name);
104-
$("#"+data.cod).prev().prev().prev().html(data.surname);
105-
$("#"+data.cod).prev().prev().html(data.email);
106-
$("#"+data.cod).prev().html(data.renewal);
105+
$("#"+data.cod).prev().prev().prev().prev().prev().html(data.name);
106+
$("#"+data.cod).prev().prev().prev().prev().html(data.surname);
107+
$("#"+data.cod).prev().prev().prev().html(data.email);
108+
$("#"+data.cod).prev().prev().html(data.renewal);
109+
if(data.notice_email == "YES"){
110+
$("#"+data.cod).prev().css("background","#A5DF00");
111+
$("#"+data.cod).prev().html('<strong>'+data.notice_email+'</strong>');
112+
}else{
113+
$("#"+data.cod).prev().css("background","#F5D0A9");
114+
$("#"+data.cod).prev().html('<strong>'+data.notice_email+'</strong>');
115+
}
107116
}
108117
}, "json");
109118

@@ -121,6 +130,12 @@ function(data){
121130
$("#institution").attr("disabled","disabled");
122131
}
123132
});
133+
134+
$("#renewal").datepicker({
135+
dateFormat: 'dd/mm/yy',
136+
changeMonth: true,
137+
changeYear: true
138+
});
124139
}
125140
},"json");
126141
});
@@ -373,7 +388,7 @@ function(data){
373388
}
374389
echo '<td id="member'.$row['cod'].'" class="options-width">';
375390
echo '<a href="renovar-user.php?cod='.$row['cod'].'" title="Renewal" class="renovar"><img src="images/update.png" /></a>&nbsp;';
376-
echo '<a href="edit-user.php?cod='.$row['cod'].'" title="Edit '.$row['usuario'].'" class="icon-1 info-tooltip"><img src="images/note_edit.png" /></a>&nbsp;';
391+
echo '<a href="edit-user.php?cod='.$row['cod'].'" title="Edit '.$row['usuario'].'" class="edit-member info-tooltip"><img src="images/note_edit.png" /></a>&nbsp;';
377392
echo '<a href="delete-user.php?cod='.$row['cod'].'" title="Delete" '.$row['usuario'].'" class="eliminar-usuario"><img src="images/delete.png" /></a>';
378393
echo '</td>';
379394
echo '</tr>';

js/conf_searcher.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,12 @@ function Editarusuario()
8181
$("#result_edit").html('');
8282
//Actualizar los 3 campos de la tabla que se ha editado
8383
alert("updated correctly");
84-
$("#"+data.cod).prev().prev().prev().prev().prev().prev().html(data.name);
85-
$("#"+data.cod).prev().prev().prev().prev().prev().html(data.surname);
86-
$("#"+data.cod).prev().prev().prev().prev().html(data.email);
87-
$("#"+data.cod).prev().prev().prev().html(data.renewal);
88-
$("#"+data.cod).prev().prev().html(data.type);
84+
$("#"+data.cod).prev().prev().prev().prev().prev().prev().prev().html(data.name);
85+
$("#"+data.cod).prev().prev().prev().prev().prev().prev().html(data.surname);
86+
$("#"+data.cod).prev().prev().prev().prev().prev().html(data.email);
87+
$("#"+data.cod).prev().prev().prev().prev().html(data.renewal);
88+
$("#"+data.cod).prev().prev().prev().html(data.type);
89+
$("#"+data.cod).prev().prev().html(data.status);
8990
$("#"+data.cod).prev().html(data.quota+' &euro;');
9091
}
9192
}, "json");

setting.php

+3
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,9 @@
467467
echo '</div>';
468468
?>
469469
<br>
470+
<h4>Database: data and structure</h4>
471+
<?php require 'config.php'; ?>
472+
<a href="adminer/loader.adminer.php?username=<?php echo $config['db']['user']; ?>">Adminer extension</a>
470473

471474
</div>
472475
</div>

0 commit comments

Comments
 (0)