bug 1138: added function to display all email addresses of a user
authorINOPIAE <inopiae@cacert.org>
Sun, 8 Dec 2013 12:45:02 +0000 (13:45 +0100)
committerINOPIAE <inopiae@cacert.org>
Sun, 8 Dec 2013 12:45:02 +0000 (13:45 +0100)
includes/notary.inc.php
pages/account/43.php
pages/account/59.php
www/styles/default.css

index bca285b..b9a13d2 100644 (file)
@@ -1156,14 +1156,14 @@ function valid_ticket_number($ticketno){
  * get_user_data()
  *  returns all data of to an account given by the id
  * @param mixed $userid - account id
- * @param mixed $deleted - states is the account is deleted, default = 0
+ * @param mixed $deleted - states if the account is deleted, default = 0
  * @return
  */
 function get_user_data($userid, $deleted=0){
        $userid = intval($userid);
        $filter='';
        if (0==$deleted) {
-               $filter='and `users`.`deleted`=0';
+               $filter=' and `users`.`deleted`=0';
        }
        $query = "select * from `users` where `users`.`id`='$userid' ".$filter;
        return mysql_query($query);
@@ -1177,4 +1177,52 @@ function get_user_data($userid, $deleted=0){
  */
 function get_alerts($userid){
        return mysql_fetch_assoc(mysql_query("select * from `alerts` where `memid`='".intval($userid)."'"));
+}
+
+/**
+ * get_email_address()
+ *  returns all email address linked to one account
+ * @param mixed $userid
+ * @param string $primary if given the primary email address is not retirned
+ * @param integer $deleted - states if the account is deleted, default = 0
+ * @return
+ */
+function get_email_address($userid, $primary,$deleted=0){
+       $userid = intval($userid);
+       $filter='';
+       if (0==$deleted) {
+               $filter=' and `deleted`=0';
+       }
+       if ($primary) {
+               $filter= $filter." and `email`!='".mysql_real_escape_string($primary)."'";
+       }
+       $query = "select * from `email` where `memid`='".$userid."'".$filter." order by `created`";
+       return mysql_query($query);
+}
+
+function output_log_email_header(){
+       ?>
+       <tr
+               <td>_("Email, primary bold")</td>
+               <td>_("Created")</td>
+               <td>_("Deleted")</td>
+       </tr>
+
+       <?
+}
+function output_log_email($row,$primary){
+       $italic='';
+       $bold='';
+       if (0==$row['deleted']) {
+               $italic='italic ';
+       }
+       if ($primary==$row['email']) {
+               $bold= 'bold ';
+       }
+
+       <tr>
+       <td class="<?$bold . $italic ?>">$row['email']</td>
+       <td class="<?$bold . $italic ?>">$row['created']</td>
+       <td class="<?$bold . $italic ?>">$row['deleted']</td>
+       </tr>
 }
\ No newline at end of file
index 7e4d00a..8dcedad 100644 (file)
@@ -325,9 +325,11 @@ include_once($_SESSION['_config']['filepath']."/includes/notary.inc.php");
 <br/>
 <?
 //list secondary email addresses
-  $query = "select * from `email` where `memid`='".intval($row['id'])."' and `deleted`=0 and `hash`=''
-      and `email`!='".mysql_escape_string($row['email'])."'";
-  $dres = mysql_query($query);
+// comment to be deleted before release
+//  $query = "select * from `email` where `memid`='".intval($row['id'])."' and `deleted`=0 and `hash`=''
+//      and `email`!='".mysql_escape_string($row['email'])."'";
+//  $dres = mysql_query($query);
+  $dres = get_email_address(intval($row['id']),mysql_real_escape_string($row['email']));
   if(mysql_num_rows($dres) > 0) { ?>
 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
   <tr>
index 4c5b63f..53c885b 100644 (file)
@@ -97,10 +97,26 @@ $alerts =get_alerts($userid)
     <td class="DataTD"><?=_("Within 200km Announcements")?>:</td>
     <td class="DataTD"><?= ($row['id']==0)? _('No'):_('Yes')?></td>
   </tr>
-
+</table>
+<br/>
+<?
+$dres = get_email_address($userid,'',1);
+if(mysql_num_rows($dres) > 0) {
+?>
+<table>
   <tr>
-    <td colspan="<? $colspandefault ?>" class="title"><?=_('Address')?></td>
+    <td colspan="3" class="title"><?=_('Email addresses')?></td>
   </tr>
+<?
+output_log_email_header();
+while($drow = mysql_fetch_assoc($dres))
+{
+       output_log_email($drow,$email);
+ } ?>
+</table>
+<br/>
+
+<table>
   <tr>
     <td colspan="<? $colspandefault ?>" class="title"><?=_('CATS')?></td>
   </tr>
index f2b3c95..3c5c8e3 100644 (file)
@@ -9,10 +9,10 @@
 body{
        font-family: Arial,sans-serif;
        color: #333333;
-       line-height: 1.166;     
+       line-height: 1.166;
        margin: 0px;
        padding: 0px;
-       background: #cccccc; 
+       background: #cccccc;
 /*      url("/siteimages/bg_grad.jpg") fixed;   */
 }
 
@@ -101,7 +101,7 @@ padding: 0px;
        right: 2%;
        width: 96%;
        background-color: #ffffff;
-       
+
 }
 
 #tl {
@@ -128,7 +128,7 @@ padding: 0px;
        left: 2%;
        right: 2%;
        width:95.6%;
-       
+
 }
 
 #pageNav{
@@ -213,7 +213,7 @@ background-image:  url("siteimages/glbnav_background.gif");
 
 #globalNav img{
        margin-bottom: -4px;
+
 }
 
 #gnl {
@@ -335,11 +335,11 @@ a.glink:hover {
   font-size: 70%;
   margin: 0px  0px 0px 10px;
 }
+
 #search a:link, #search a:visited {
        font-size: 80%;
        font-weight: bold;
-       
+
 }
 
 #search a:hover {
@@ -476,7 +476,7 @@ td.storyLeft{
 }
 
 .relatedLinks a{
-       display: block; 
+       display: block;
 }
 
 
@@ -557,7 +557,12 @@ td.greytxt {
        text-align: right;
        vertical-align: bottom;
 }
-
+.bold {
+       font-weight:bold;
+}
+.italic {
+       font-style:italic;
+}
 .title {
        background: #E2E2E2;
        font-weight:BOLD;