install
[ class tree: install ] [ index: install ] [ all elements ]

Source for file install_admin_inc.php

Documentation is available at install_admin_inc.php

  1. <?php
  2. /**
  3.  * @version $Header$
  4.  * @package install
  5.  * @subpackage functions
  6.  */
  7.  
  8. // Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
  9. // All Rights Reserved. See below for details and a complete list of authors.
  10. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
  11.  
  12. // assign next step in installation process
  13. $gBitSmarty->assign( 'next_step', $step );
  14.  
  15. if( !empty( $_REQUEST['admin_submit'] )) {
  16.     $mail = $errors = array();
  17.     if( empty( $_REQUEST['login'] ) ) {
  18.         $errors['login'] = "You must specify an administrator name.";
  19.     }
  20.     if( empty( $_REQUEST['email'] ) ) {
  21.         $errors['email'] = "You must specify an email address.";
  22.     } else {
  23.         BitUser::verifyAnonEmail( $_REQUEST['email'], $errors );
  24.     }
  25.  
  26.     if( $_REQUEST['password'] != $_REQUEST['pass_confirm'] ) {
  27.         $errors['password'] = "The passwords you entered do not match.";
  28.         $_REQUEST['password'] = '';
  29.     } elseif( strlen( $_REQUEST['password'] ) < 4 ) {
  30.         $errors['password'] = "The administrator password has to be at least 4 characters.";
  31.         $_REQUEST['password'] = '';
  32.     }
  33.  
  34.     if( empty( $errors )) {
  35.         $app = '_done';
  36.         $gBitSmarty->assign( 'next_step', $step + 1 );
  37.         $gBitSmarty->assign( 'pass_disp', preg_replace( '/./i','&bull;',$_REQUEST['password'] ) );
  38.  
  39.         // do a mailer check as well - we need to remove trailing options for the sendmail_path check
  40.         if( !empty( $_REQUEST['testemail'] )) {
  41.             if(( $mail_path = trim( preg_replace( "#\s+\-[a-zA-Z]+.*$#", "", ini_get( 'sendmail_path' )))) && is_file( $mail_path )) {
  42.                 $to      = $_REQUEST['email'];
  43.                 $from    = "bitweaver@".$_SERVER['SERVER_NAME'];
  44.                 $subject = "bitweaver test email";
  45.                 $message = "Congratulations!\r\n".
  46.                     "The email system on your server at ".$_SERVER['SERVER_NAME']." is working!\r\n\r\n".
  47.                     "Thank you for trying bitweaver,\r\n".
  48.                     "The bitweaver team.\r\n";
  49.                 $headers = "From: $from\r\n".
  50.                     "Reply-To: $from\r\n".
  51.                     "X-Mailer: PHP/".phpversion();
  52.  
  53.                 if( mail( $to, $subject, $message, $headers )) {
  54.                     $mail['success'] = "We sent an email to <strong>$to</strong>.";
  55.                 } else {
  56.                     $mail['warning'] = "We have tried to send an email to <strong>$to</strong> and the mailing system on the server has not accepted the email.";
  57.                 }
  58.             } else {
  59.                 $mail['warning'] = "The email settings on your php server are not set up correctly. Please make sure to set a valid <strong>sendmail_path</strong> if you plan to send emails with bitweaver.";
  60.             }
  61.         }
  62.     }
  63.  
  64.     $_SESSION['real_name'] = $_REQUEST['real_name'];
  65.     $_SESSION['login']     = $_REQUEST['login'];
  66.     $_SESSION['password']  = $_REQUEST['password'];
  67.     $_SESSION['email']     = $_REQUEST['email'];
  68.  
  69.     $gBitSmarty->assign( 'mail', $mail );
  70.     $gBitSmarty->assign( 'real_name', $_SESSION['real_name'] );
  71.     $gBitSmarty->assign( 'login', $_SESSION['login'] );
  72.     $gBitSmarty->assign( 'password', $_SESSION['password'] );
  73.     $gBitSmarty->assign( 'pass_confirm', $_SESSION['password'] );
  74.     $gBitSmarty->assign( 'email', $_SESSION['email'] );
  75.     $gBitSmarty->assign( 'errors', $errors );
  76. } else {
  77.     $gBitSmarty->assign( 'user', '');
  78.     $gBitSmarty->assign( 'email', 'admin@localhost');
  79. }
  80. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:42 +0000 by phpDocumentor 1.5.0-lsces