Author: benj
Date: Wed Sep 21 12:28:49 2016
New Revision: 1744

URL: http://svn.gna.org/viewcvs/gdtc?rev=1744&view=rev
Log:
Fix annoying warning messages


Modified:
    trunk/gdtc/include/mail.php
    trunk/gdtc/include/utils.php
    trunk/gdtc/scripts/send_mail.php

Modified: trunk/gdtc/include/mail.php
URL: 
http://svn.gna.org/viewcvs/gdtc/trunk/gdtc/include/mail.php?rev=1744&r1=1743&r2=1744&view=diff
==============================================================================
--- trunk/gdtc/include/mail.php (original)
+++ trunk/gdtc/include/mail.php Wed Sep 21 12:28:49 2016
@@ -152,7 +152,7 @@
 
     #$from = mb_encode_mimeheader ( DTC_MAIL_BOT, "UTF-8", "Q" );
 
-    if ( $additional [ 'sender' ] )
+    if ( array_key_exists( 'sender', $additional ) )
        $sender = $additional [ 'sender' ];
     else
        $sender = $template [ 'sender' ];
@@ -186,7 +186,7 @@
       {
        if ( $actor_id != -1 )
          {
-           if ( ! $additional [ 'contact_id' ] )
+           if ( ! array_key_exists ( 'contact_id', $additional ) )
              do_add_contact ( $actor_id, 'mail', DTC_MAIL_BOT, 
                               addslashes ( "Subject: $subject\n\n" ). 
                               addslashes ( $content ) );

Modified: trunk/gdtc/include/utils.php
URL: 
http://svn.gna.org/viewcvs/gdtc/trunk/gdtc/include/utils.php?rev=1744&r1=1743&r2=1744&view=diff
==============================================================================
--- trunk/gdtc/include/utils.php        (original)
+++ trunk/gdtc/include/utils.php        Wed Sep 21 12:28:49 2016
@@ -117,10 +117,10 @@
   $smarty -> assign ( 'dosubmit', '' );
 
   $smarty -> assign ( 'id', my_id() );
-  if ( $_SESSION && array_key_exists ( 'login', $_SESSION ) ) {
+  if ( isset($_SESSION) && array_key_exists ( 'login', $_SESSION ) ) {
     $smarty -> assign ( 'login', $_SESSION [ 'login' ] );
   }
-  if ( $_SESSION && array_key_exists ( 'is_admin', $_SESSION ) )
+  if ( isset($_SESSION) && array_key_exists ( 'is_admin', $_SESSION ) )
   {
       $smarty -> assign ( 'is_admin', 1 );
   }
@@ -144,7 +144,7 @@
   $smarty -> assign ( 'dtc_admin_base_url', DTC_ADMIN_BASE_URL );
   $smarty -> assign ( 'dtc_my_base_url', DTC_MY_BASE_URL );
   if ( array_key_exists ( 'REQUEST_URI', $_SERVER ) )
-      $smarty -> assign ( 'url', DTC_HOST_NAME . $_SERVER [ 'REQUEST_URI' ] );
+      $smarty -> assign ( 'url', $_SERVER [ 'REQUEST_URI' ] );
   if ( array_key_exists ( 'HTTP_REFERER', $_SERVER ) )
       $smarty -> assign ( 'url_referer', $_SERVER [ 'HTTP_REFERER' ] );
   $smarty -> assign ( 'dtc_mail_bot', DTC_MAIL_BOT );
@@ -833,7 +833,7 @@
  */
 function my_id ( )
 {
-    if ( ! $_SESSION || ! array_key_exists ( 'login', $_SESSION ) )
+    if ( ! isset($_SESSION) || ! array_key_exists ( 'login', $_SESSION ) )
        return Array();
 
     $me = simple_unique_query ( sprintf ( "select actor_id from actor where 
nickname = '%s';",

Modified: trunk/gdtc/scripts/send_mail.php
URL: 
http://svn.gna.org/viewcvs/gdtc/trunk/gdtc/scripts/send_mail.php?rev=1744&r1=1743&r2=1744&view=diff
==============================================================================
--- trunk/gdtc/scripts/send_mail.php    (original)
+++ trunk/gdtc/scripts/send_mail.php    Wed Sep 21 12:28:49 2016
@@ -36,12 +36,18 @@
 setlocale(LC_ALL, 'fr_FR.UTF-8');
 
 $actor_id = $opts [ 'i' ];
-$dst = $opts [ 'd' ];
-$template = $opts [ 't' ];
-$cc = $opts [ 'c' ];
-$preview = isset ( $opts [ 'p' ] );
+if ( array_key_exists ( 'd', $opts ) )
+  $dst = $opts [ 'd' ];
+if ( array_key_exists ( 't', $opts ) )
+  $template = $opts [ 't' ];
+if ( array_key_exists ( 'c', $opts ) )
+  $cc = $opts [ 'c' ];
+else
+  $cc = false;
+if ( array_key_exists ( 'p', $opts ) )
+  $preview = isset ( $opts [ 'p' ] );
 
-if ( $opts [ 'h' ] || ! $actor_id || ! $template )
+if ( array_key_exists ( 'h', $opts ) || ! $actor_id || ! $template )
 {
     print "Usage: send_mail.php [-p] {-h | {-i <actor_id>|-d <dst>} -t 
<template> [-c <cc>]}\n";
     exit ( 1 );
@@ -72,13 +78,13 @@
 
 setlocale ( LC_ALL, 'fr_FR' );
 
-if ( $preview )
+if ( isset($preview) )
 {
     mail_template_preview ( $result [ 'mail_template_id' ] , $actor_id );
     exit;
 }
 
-if ( $dst )
+if ( isset($dst) )
 {
     send_mail_dst ( $template, $actor_id, $dst, Array(), $cc );
 }


_______________________________________________
Gdtc-commits mailing list
Gdtc-commits@gna.org
https://mail.gna.org/listinfo/gdtc-commits

Reply via email to