home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / groupoffice-com-2.01 / configuration / account / privacy.inc < prev    next >
Text File  |  2004-03-08  |  4KB  |  108 lines

  1. <br />
  2. <?php
  3. if ($task == 'authorize')
  4. {
  5.     if ($profile)
  6.     {
  7.         if ($user = $users->get_profile_by_email($_POST['auth_email_address']))
  8.         {
  9.             $mail_body  = '<html><body>';
  10.  
  11.             $middle_name = $user['middle_name'] == '' ? '' : $user['middle_name'].' ';
  12.             $user_name = $middle_name.$user['last_name'];
  13.  
  14.             $middle_name = $profile['middle_name'] == '' ? '' : $profile['middle_name'].' ';
  15.             $profile_name = $profile['first_name'].' '.$middle_name.$profile['last_name'];
  16.  
  17.             $mail_body .= $ac_salutation.' '.$sir_madam[$user['sex']].' '.$user_name.',<br /><br />';
  18.             $mail_body .= $profile_name.' '.$ac_request_auth.'<br /><br />';
  19.  
  20.             $mail_body .= '<a href="'.$GO_CONFIG->full_url.'configuration/account/index.php?requesting_user_id='.$GO_SECURITY->user_id.'&authcode='.$profile['authcode'].'&requested_user_id='.$user['id'].'&task=accept'.'">'.$ac_accept.'</a>   ';
  21.             $mail_body .= '<a href="'.$GO_CONFIG->full_url.'configuration/account/index.php?requesting_user_id='.$GO_SECURITY->user_id.'&authcode='.$profile['authcode'].'&requested_user_id='.$user['id'].'&task=decline'.'">'.$ac_decline.'</a>   ';
  22.             $mail_body .= '</body></html>';
  23.             if(!sendmail($user['email'], $profile['email'], $GO_CONFIG->title, $ac_request_auth_mail_title, $mail_body,'3 (Normal)', 'text/html'))
  24.             {
  25.                 $feedback = '<p class="Error">'.$strEmailFail.'</p>';
  26.                 $task = 'add_user';
  27.             }
  28.  
  29.         }else
  30.         {
  31.             $feedback = '<p class="Error">'.$ac_invalid_email.'</p>';
  32.             $task = 'add_user';
  33.         }
  34.     }else
  35.     {
  36.         $feedback = '<p class="Error">'.$strDataError.'</p>';
  37.         $task = 'add_user';
  38.     }
  39. }
  40.  
  41. if (isset($feedback))
  42. {
  43.     echo $feedback;
  44. }
  45.  
  46. switch($task)
  47. {
  48.     case 'add_user':
  49.         echo '<table border="0"><tr><td colspan="2">'.$ac_auth_text.'<br /><br /></td></tr><tr><td>'.$strEmail.':</td>';
  50.         echo '<td><input type="text" class="textbox" name="auth_email_address"  maxlength="100" size="50" /></td></tr>';
  51.         echo '<tr><td colspan="2"><br />';
  52.         $button = new button($cmdOk, "javascript:send_request()");
  53.         echo '  ';
  54.         $button = new button($cmdCancel, "javascript:document.forms[0].task.value='privacy';document.forms[0].submit()");
  55.         echo '</td></tr></table>';
  56.  
  57.         echo '
  58.         <script type="text/javascript">
  59.  
  60.         function send_request()
  61.         {
  62.             document.forms[0].task.value="authorize";
  63.             document.forms[0].submit();
  64.         }
  65.  
  66.         var nav4 = window.Event ? true : false;
  67.         function processkeypress(e)
  68.         {
  69.             if(nav4)
  70.             {
  71.                 var whichCode = e.which;
  72.             }else
  73.             {
  74.                 var whichCode = event.keyCode;
  75.             }
  76.  
  77.             if (whichCode == 13)
  78.             {
  79.                 send_request();
  80.                 return true;
  81.             }
  82.         }
  83.         if (window.Event) //if Navigator 4.X
  84.         {
  85.             document.captureEvents(Event.KEYPRESS)
  86.         }
  87.         document.onkeypress = processkeypress;
  88.         document.forms[0].auth_email_address.focus();
  89.         </script>';
  90.     break;
  91.  
  92.     case 'authorize':
  93.         echo $ac_request_mail_body_prefix.' '.$user['first_name'].' '.$user_name.' '.$ac_request_mail_body_suffix.'<br /><br />';
  94.         $button = new button($cmdContinue, "javascript:document.forms[0].task.value='privacy';document.forms[0].submit()");
  95.     break;
  96.  
  97.  
  98.     default:
  99.         echo '<a href="javascript:document.forms[0].task.value=\'add_user\';document.forms[0].submit();" class="normal">'.$ac_add_user.'</a><br /><br />';
  100.         echo $privacy_text."<br /><br />";
  101.  
  102.         print_acl($profile['acl_id'], false);
  103.         echo '<br />';
  104.         $button = new button($cmdClose, "javascript:document.location='".$return_to ."'");
  105.     break;
  106. }
  107. ?>
  108.