bug fixes mailaddress in search and evaliation activation
authorKilian Saffran <ksaffran@dks.lu>
Wed, 13 Mar 2019 16:32:22 +0000 (17:32 +0100)
committerKilian Saffran <ksaffran@dks.lu>
Wed, 13 Mar 2019 16:32:22 +0000 (17:32 +0100)
index.php
lib/processdata.php
site.js
tmpl/blocks/avocatsearch.php
tmpl/css.php
tmpl/javascript.php
tmpl/pages/profile/package.php

index 8252e39..354dd72 100644 (file)
--- a/index.php
+++ b/index.php
@@ -25,7 +25,7 @@
     $sp = explode("/",$_GET["p"]);
     $p = $sp[0];
   }
-  if ($p == "rendezvous") && (count($sp) == 2){
+  if (($p == "rendezvous") && (count($sp) == 2)){
     //TODO: get id by ident name
     // $userident = $db->dbquery("select id from users where ident=");
     // if ($userident){
index a0efd96..b5ba8cb 100644 (file)
@@ -22,7 +22,7 @@
                     save_rendezvous($pdt);
                     break;
                 case 'submit_profile':
-                    if (!isset($pdt["uservisibility"])) { $pdt["uservisibility"] = "";}
+                    //if (!isset($pdt["uservisibility"])) { $pdt["uservisibility"] = "";}
                     save_data('users',$pdt);
                     break;
                 // case 'submit_profileetude':
 
     function activate_evaluation($gdt){
       global $db,$user,$msg;
-      $sql = "select us.service,us.expiration,us.payeddate,us.isevaluation,apps.name from userservices us join apps on (us.id_app=apps.id) where us.id_app='".$gdt["id"]."' and us.id_user=".$user["id"].";";
+      $sql = "select us.service,us.expiration,us.payeddate,us.isevaluation,apps.name from userservices us join apps on (us.id_app=apps.id) where us.id_app='".$gdt["app"]."' and us.id_user=".$user["id"].";";
       $eval = $db->dbquery($sql);
       if ($eval){
-        $msg = '<div class=\"alert alert-danger">Vous avez déjà testé le service '.$eval["name"].'</div>';
+        $msg = '<div class="alert alert-danger">Vous avez déjà testé le service '.$eval["name"].'</div>';
       } else {
-        $sql = "select id,app,name,evaluationdays from apps where id=".$gdt["id"];
+        $sql = "select id,app,name,evaluationdays from apps where id=".$gdt["app"];
         
         $eapp = $db->dbquery($sql);
         if ($eapp["evaluationdays"] == null){
-          $msg = '<div class=\"alert alert-danger">Cette Application n\'a pas une periode d\'évaluation</div>';
+          $msg = '<div class="alert alert-danger">Cette Application n\'a pas une periode d\'évaluation</div>';
         }else {
           $evaldate = date('Y-m-d',strtotime("+".$eapp["evaluationdays"]." days"));
           $evaldateshow = date('d.m.Y',strtotime("+".$eapp["evaluationdays"]." days"));
-          $sql = "INSERT INTO userservices (id_user,service,expiration,isevaluation,id_app) VALUES (".$user["id"].",".$eapp["app"].",date('".$evaldate."'),1,".$gdt["id"].")";
+          $sql = "INSERT INTO userservices (id_user,service,expiration,isevaluation,id_app) VALUES (".$user["id"].",'".$eapp["app"]."',date('".$evaldate."'),1,".$eapp["id"].")";
           $db->dbexec($sql);
-          $msg = '<div class=\"alert alert-success">Periode d\'évaluation a été activé jusqu\'au '.$evaldateshow.'</div>';
+          $msg = '<div class="alert alert-success">Periode d\'évaluation a été activé jusqu\'au '.$evaldateshow.'</div>';
         }
         
         
           }
         }
       }
+
+    function crypt_mailaddress($mailadr){
+        $n = 0;
+        $r = "";
+        $mailadr = 'mailto:'.$mailadr;
+        $xdata = str_split($mailadr);
+        for($i=0; $i < count($xdata); $i++ ){
+            $n = ord( $xdata[$i] );
+            if( $n >= 8364 ){$n = 128;}
+            $r .= chr($n+1);
+        }
+        return $r;
+    }
 ?>
\ No newline at end of file
diff --git a/site.js b/site.js
index 3571c61..90c69f3 100644 (file)
--- a/site.js
+++ b/site.js
@@ -120,4 +120,21 @@ function initstandard(){
       
   });
 }
+}
+
+function  imsg(data){
+  var tmp = h1(data);
+  console.log(tmp);
+  window.location.href=tmp;
+}
+
+function h1(s) {
+  var n = 0;
+  var r = "";
+  for( var i = 0; i < s.length; i++){
+      n = s.charCodeAt( i );
+      if( n >= 8364 ){n = 128;}
+      r += String.fromCharCode( n - 1 );
+  }
+  return r;
 }
\ No newline at end of file
index f56bb8c..3141309 100644 (file)
@@ -53,10 +53,10 @@ foreach ($avocats as $avo) {
         echo '<div>'.(($avo['userzip'] != "")?$avo['userzip']:'').' '.(($avo['usercity'] != "")?$avo['usercity']:'').'</div>';
       }
       if ($avo['userphone'] != ''){
-        echo '<div><i class="fas fa-phone"></i>: <a href="tel://'.$avo['userphone'].'">'.$avo['userphone'].'</a></div>';
+        echo '<div><i class="fas fa-phone"></i>: <a href="tel://'.$avo['userphone'].'">'.$avo['userphone'].'</a></div>';
       }
       if ($avo['useremail']){
-        echo '<i class="fas fa-at"></i>: <a a href="mailto://'.$avo['useremail'].'">'.$avo['useremail'].'</a>';
+        echo '<i class="fas fa-at"></i>: <button class="btn btn-default" onclick="imsg(\''.crypt_mailaddress($avo['useremail']).'\');">'.str_replace('@',' [ at ] ',$avo['useremail']).'</button>';
       }
       echo '</div>';
     }
index 5fb6e0a..97c759d 100644 (file)
@@ -1,8 +1,8 @@
-<link href="<?php echo $baseurl; ?>/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
-<link href="<?php echo $baseurl; ?>/vendor/juridig.epic.css" rel="stylesheet">
-<link href="<?php echo $baseurl; ?>/vendor/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
-<link href="<?php echo $baseurl; ?>/vendor/bootstrap-datepicker/css/bootstrap-datepicker.min.css" rel="stylesheet">
-<link href="<?php echo $baseurl; ?>/vendor/bootstrap4-tagsinput/tagsinput.css" rel="stylesheet">
-<link href="<?php echo $baseurl; ?>/vendor/fontawesome/css/all.min.css" rel="stylesheet">
+<link href="<?php echo $baseurl; ?>/vendor/bootstrap/css/bootstrap.min.css?v=1" rel="stylesheet">
+<link href="<?php echo $baseurl; ?>/vendor/juridig.epic.css?v=1" rel="stylesheet">
+<link href="<?php echo $baseurl; ?>/vendor/bootstrap-table/bootstrap-table.min.css?v=1" rel="stylesheet">
+<link href="<?php echo $baseurl; ?>/vendor/bootstrap-datepicker/css/bootstrap-datepicker.min.css?v=1" rel="stylesheet">
+<link href="<?php echo $baseurl; ?>/vendor/bootstrap4-tagsinput/tagsinput.css?v=1" rel="stylesheet">
+<link href="<?php echo $baseurl; ?>/vendor/fontawesome/css/all.min.css?v=1" rel="stylesheet">
 
-<link href="<?php echo $baseurl; ?>/style.css" rel="stylesheet">
\ No newline at end of file
+<link href="<?php echo $baseurl; ?>/style.css?v=1" rel="stylesheet">
\ No newline at end of file
index e6ab0cc..ceb91a3 100644 (file)
@@ -8,4 +8,4 @@
 <script src="<?php echo $baseurl; ?>/vendor/bootstrap4-tagsinput/tagsinput.js"></script> 
 <script src="<?php echo $baseurl; ?>/vendor/twbs-toggle-buttons/jquery.twbs-toggle-buttons.min.js"></script> 
 <script src="<?php echo $baseurl; ?>/vendor/tinymce/js/tinymce/tinymce.min.js"></script> 
-<script src="<?php echo $baseurl; ?>/site.js"></script>
\ No newline at end of file
+<script src="<?php echo $baseurl; ?>/site.js?v=2"></script>
\ No newline at end of file
index 37e3086..ae94fc5 100644 (file)
@@ -27,7 +27,7 @@
             <h5 class="card-title text-muted text-uppercase text-center">Evaluation</h5>
             <h6 class="card-price text-center"><?php echo $userapps["0"]["evaluationdays"]; ?> jours gratuit</span></h6>
             <hr>
-            <a href="<?php echo $baseurl.'/profile/application?app='.$_GET["id"]."&activate=evaluation" ?>" class="btn btn-block btn-primary text-uppercase">Activer</a>
+            <a href="<?php echo $baseurl.'/profile/applications?app='.$_GET["id"]."&activate=evaluation" ?>" class="btn btn-block btn-primary text-uppercase">Activer</a>
           </div>
         </div>
       </div>