Пример #1
0
                // Add the user to the invite list in the db
                $res->add_participant($userid, $accept_code);
                // Send the invite email
                $info[$userid] = $user->email;
                $res->invite_users($info, array($res->start_date), $accept_code);
            } else {
                CmnFns::do_error_box(translate('You are already invited to this reservation. Please follow participation instructions previously sent to your email.'), '', false);
            }
        } else {
            CmnFns::do_error_box(translate('Sorry, we could not find that user in the database.'), '', false);
        }
    } else {
        CmnFns::do_error_box(translate('Please go back and correct any errors.'), '', false);
    }
} else {
    CmnFns::do_error_box(translate('That record could not be found.'), '', false);
}
echo '<p align="center"><a href="javascript:close();">' . translate('Close') . '</a></p>';
$t->endMain();
$t->printHTMLFooter();
function findUser($userid)
{
    $found_user = false;
    if (!empty($userid)) {
        $user = new User($userid);
        if ($user != null) {
            $userid = $user->get_id();
            $fname = $user->get_fname();
            $lname = $user->get_lname();
            $email_address = $user->get_email();
            $found_user = true;
Пример #2
0
 /**
  * Prints out all the error messages in an error box
  * @param boolean $kill whether to kill the app after printing messages
  */
 function print_all_errors($kill)
 {
     if ($this->has_errors()) {
         $div = '<hr size="1"/>';
         CmnFns::do_error_box('<a href="javascript: history.back();">' . translate('Please go back and correct any errors.') . '</a><br /><br />' . join($div, $this->errors) . '<br /><br /><a href="javascript: history.back();">' . translate('Please go back and correct any errors.') . '</a>', 'width: 90%;', $kill);
     }
 }
Пример #3
0
/**
* Function that sends:
* 	- an error report if $action = 'Release', 'Delete' or 'Delete All'
*	- an request if $action = 'Request release'
* to $conf['app']['adminEmail']
* @param string $action 'Release', 'Delete', 'Delete All', 'Request release'
* @param $messages_array array containing messages info
*/
function sendMailToAdmin($myaction, $messages_array)
{
    global $conf;
    $title = $conf['app']['title'];
    $adminEmail = $conf['app']['adminEmail'];
    $sub = "[" . $title . "] Notification from '" . $_SESSION['sessionID'] . "'";
    $msg = "Mail notification sent by '" . $_SESSION['sessionID'] . "' <" . $_SESSION['sessionMail'][0] . ">.\r\n\r\n";
    switch ($myaction) {
        case translate('Release'):
        case translate('Release/Request release'):
            $msg .= translate('A problem occured when trying to release the following messages') . ":\r\n\r\n";
            break;
        case translate('Request release'):
            $msg .= translate('Please release the following messages') . ":\r\n\r\n";
            break;
        case translate('Delete'):
        case translate('Delete All'):
            $msg .= translate('A problem occured when trying to delete the following messages') . ":\r\n\r\n";
            break;
        default:
            CmnFns::do_error_box(translate('Unknown action type'), '');
    }
    for ($i = 0; is_array($messages_array) && $i < count($messages_array); $i++) {
        $rs = $messages_array[$i];
        $msg .= "Message #" . ($i + 1) . ":\r\n";
        $msg .= "\tmail_id = " . $rs['mail_id'] . "\r\n";
        $msg .= "\t" . translate('From') . " = " . $rs['from_addr'] . "\r\n";
        $msg .= "\t" . translate('Subject') . " = " . $rs['subject'] . "\r\n";
        $msg .= "\t" . translate('Date') . " = " . CmnFns::formatDateTime($rs['time_num']) . "\r\n";
        $msg .= "\t" . translate('Score') . " = " . $rs['spam_level'] . "\r\n";
        $msg .= "\t" . translate('Status') . " = " . $rs['status'] . "\r\n";
        $msg .= "\t" . translate('Content Type') . " = " . $rs['content'] . "\r\n\r\n";
    }
    // Send email
    $mailer = new PHPMailer();
    if (is_array($adminEmail)) {
        foreach ($adminEmail as $email) {
            $mailer->AddAddress($email, '');
        }
    } else {
        $mailer->AddAddress($adminEmail, '');
    }
    $mailer->FromName = $_SESSION['sessionID'];
    $mailer->From = $_SESSION['sessionMail'][0];
    $mailer->Subject = $sub;
    $mailer->Body = $msg;
    $mailer->Send();
    return true;
}
Пример #4
0
* @author Nick Korbel <*****@*****.**>
* @author Attila <*****@*****.**>
* @version 05-04-06
* @package phpScheduleIt
*
* Copyright (C) 2003 - 2007 phpScheduleIt
* License: GPL, see LICENSE
*/
include_once 'lib/Template.class.php';
include_once 'lib/db/UsageDB.class.php';
include_once 'templates/usage.template.php';
$timer = new Timer();
$timer->start();
// Check to make sure this is the administrator
if (!Auth::isAdmin()) {
    CmnFns::do_error_box(translate('This is only accessable to the administrator'));
}
$t = new Template(isset($_POST['search']) ? translate('Search Results') : translate('Search Resource Usage'));
$t->printHTMLHeader();
// Print HTML header
$t->printWelcome();
// Print welcome message
$t->startMain();
// Start main table
$t->startNavLinkTable();
$t->showNavLinksTable(Auth::isAdmin());
$t->endNavLinkTable();
$t->splitTable();
$db = new UsageDB();
// Connect to database
$link = CmnFns::getNewLink();
Пример #5
0
* Include quarantine-specific output functions
*/
include_once 'templates/summary.template.php';
if (!Auth::is_logged_in()) {
    Auth::print_login_msg();
    // Check if user is logged in
}
$_SESSION['sessionNav'] = "Site Quarantine Summary";
$t = new Template(translate('Site Quarantine Summary'));
$db = new DBEngine();
$t->printHTMLHeader();
$t->printWelcome();
$t->startMain();
// Break table into 2 columns, put quick links on left side and all other tables on the right
startQuickLinksCol();
showQuickLinks();
// Print out My Quick Links
startDataDisplayCol();
if (!Auth::isMailAdmin() || !$conf['app']['siteSummary']) {
    CmnFns::do_error_box(translate('Access Denied'));
} else {
    // Print a loading message until database returns...
    printMessage(translate('Loading Summary...'));
    $count_array = $db->get_site_summary();
    showSummary($count_array);
    // Hide the message after the table loads.
    hideMessage(translate('Loading Summary...'));
}
endDataDisplayCol();
$t->endMain();
$t->printHTMLFooter();
Пример #6
0
* It will also allow other users to view this blackout.
* @author Nick Korbel <*****@*****.**>
* @version 02-22-04
* @package phpScheduleIt
*/
/**
* Template class
*/
include_once 'lib/Template.class.php';
/**
* Reservation class
*/
include_once 'lib/Blackout.class.php';
// Check that the admin is logged in
if (!Auth::isAdmin()) {
    CmnFns::do_error_box('This section is only available to the administrator.<br />' . '<a href="ctrlpnl.php">Back to My Control Panel</a>');
}
$t = new Template();
//AK HTTP_REFERER is blocked is cleared by gelman firewall will not run this check
if (isset($_POST['submit'])) {
    $t->set_title('Processing Blackout');
    $t->printHTMLHeader();
    $t->startMain();
    process_blackout($_POST['fn']);
} else {
    $blackout_info = getBlackoutInfo();
    $t->set_title($blackout_info['title']);
    $t->printHTMLHeader();
    $t->startMain();
    present_blackout($blackout_info['resid']);
}
Пример #7
0
 /**
  * Returns the correct user username that matches the search filter (array with single username)
  * If several usernames are found, return the array of usernames.
  * @param string $searchFilter search filter in a standard LDAP query
  * @return array
  */
 function searchUserDN($searchFilter)
 {
     switch ($this->serverType) {
         case "ldap":
             if ($this->searchUser != '') {
                 // If a search user is defined bind with this user
                 $this->authBind($this->searchUser, $this->searchPassword);
             } else {
                 // Otherwise bind anonymously
                 $this->anonBind();
             }
             break;
         case "ad":
             // if the directory is AD, then bind first with the search user
             $this->authBind($this->searchUser, $this->searchPassword);
             break;
         default:
             CmnFns::do_error_box(translate('Unknown server type'), '', false);
     }
     $sr = ldap_search($this->connection, $this->getSearchBase(), $searchFilter, array('dn'));
     $entries = ldap_get_entries($this->connection, $sr);
     if ($entries["count"] < 1) {
         // If no results returned
         $this->ldapErrorCode = -1;
         $this->ldapErrorText = "No users found matching search criteria";
         CmnFns::write_log($this->ldapErrorCode . ': ' . $this->ldapErrorText, '');
     } else {
         // The search should give an unique dn
         // If several results are found get the first one
         $dn = $entries[0]['dn'];
     }
     return $dn;
 }
Пример #8
0
 /**
  * Checks to see if there was a database error, log in file and die if there was
  * @param object $result result object of query
  * @param SQL query $query
  */
 function check_for_error($result, $query)
 {
     global $conf;
     if (DB::isError($result)) {
         $this->err_msg = $result->getMessage();
         CmnFns::write_log($this->err_msg, $_SESSION['sessionID']);
         CmnFns::write_log('There was an error executing your query' . ' ' . $query, $_SESSION['sessionID']);
         CmnFns::do_error_box(translate('There was an error executing your query') . '<br />' . $this->err_msg . '<br />' . '<a href="javascript: history.back();">' . translate('Back') . '</a>');
     } else {
         if ($conf['app']['debug']) {
             CmnFns::write_log("[DEBUG SQL QUERY]: {$query}");
         }
     }
     return false;
 }
Пример #9
0
include_once 'lib/db/UserInfoDB.class.php';
/**
* Templates for output
*/
include_once 'templates/userinfo.template.php';
$user = new User($_GET['user']);
$t = new Template(translate('User Info') . ' ' . $user->get_name());
$t->printHTMLHeader();
// Print HTML header
// Make sure this is the admin
if (!Auth::isAdmin()) {
    CmnFns::do_error_box(translate('This is only accessable to the administrator') . '<br />' . '<a href="ctrlpnl.php">' . translate('Back to My Control Panel') . '</a>');
}
if (!$user->is_valid()) {
    // Make sure member ID is valid
    CmnFns::do_error_box(translate('Memberid is not available.', array($user->get_id())));
}
$db = new UserInfoDB();
$prev = $db->get_prev_userid($user);
// Prev memberid
$next = $db->get_next_userid($user);
// Next memberid
$t->startMain();
// Start main table
printUI($user);
// Print user info
printLinks($prev, $next);
// Print links
$t->endMain();
// End main table
$t->printHTMLFooter();
Пример #10
0
 function _checkForError($result)
 {
     if (DB::isError($result)) {
         CmnFns::do_error_box(translate('There was an error executing your query') . '<br />' . $result->getMessage() . '<br />' . '<a href="javascript: history.back();">' . translate('Back') . '</a>');
     }
     return false;
 }
Пример #11
0
$t = new Template(translate('Message View'));
$t->printHTMLHeader();
$t->printWelcome();
$t->startMain();
// Break table into 2 columns, put quick links on left side and all other tables on the right
startQuickLinksCol();
showQuickLinks();
// Print out My Quick Links
startDataDisplayCol();
$mail_id = CmnFns::get_mail_id();
$content_type = CmnFns::getGlobalVar('ctype', GET);
$recip_email = CmnFns::getGlobalVar('recip_email', GET);
$query_string = CmnFns::querystring_exclude_vars(array('mail_id', 'recip_email'));
$m = new MailEngine($mail_id, $recip_email);
if (!$m->msg_found) {
    CmnFns::do_error_box(translate('Message Unavailable'));
} else {
    echo '<form name="messages_process_form" action="messagesProcessing.php" method="POST">';
    echo '  <input type="hidden" name="mail_id_array[]" value="' . $mail_id . '_' . $recip_email . '">';
    echo '  <input type="hidden" name="query_string" value="' . $query_string . '">';
    printActionButtons(false);
    echo '</form>';
    MsgDisplayOptions(CmnFns::get_mail_id(), $recip_email);
    startMessage();
    MsgDisplayHeaders($m->struct);
    // Give a space before the body displays
    echo '<br>' . "\n";
    if (!$m->msg_error) {
        MsgDisplayBody($m->struct);
    } else {
        echo "<p> {$m->last_error} </p>";
Пример #12
0
* @package Admin
*
* Copyright (C) 2003 - 2007 phpScheduleIt
* License: GPL, see LICENSE
*/
include_once 'lib/Template.class.php';
include_once 'lib/Admin.class.php';
$admin = new Admin(trim($_GET['tool']));
$admin->user = new User(Auth::getCurrentID());
if (!$admin->user->get_isadmin()) {
    $admin->user->is_admin = Auth::isAdmin();
}
$t = new Template(translate('System Administration'));
$t->printHTMLHeader();
// Make sure this is the admin
if (!$admin->isUserAllowed()) {
    CmnFns::do_error_box(translate('This is only accessable to the administrator') . '<br />' . '<a href="ctrlpnl.php">' . translate('Back to My Control Panel') . '</a>');
}
$t->printWelcome();
$t->startMain();
$t->startNavLinkTable();
$t->showNavLinksTable(Auth::isAdmin());
$t->endNavLinkTable();
$t->splitTable();
if (!$admin->is_error()) {
    $admin->execute();
} else {
    CmnFns::do_error_box($admin->get_error_msg());
}
$t->endMain();
$t->printHTMLFooter();
Пример #13
0
/**
* Prints out a login form and any error messages
* @param string $msg error messages to display for user
* @param string $resume page to resume on after login
*/
function printLoginForm($msg = '', $resume = '')
{
    global $conf;
    $link = CmnFns::getNewLink();
    $use_logonname = (bool) $conf['app']['useLogonName'] || (bool) $conf['ldap']['authentication'];
    $is_exceeded = false;
    // Check browser information
    echo '<script language="JavaScript" type="text/javascript">checkBrowser();</script>';
    if (isset($_SESSION['loginAttempts']) && $_SESSION['loginAttempts'] >= $conf['app']['loginAttempts']) {
        $msg .= translate('The number of login attempts is exceeded.') . '<br/>';
        $is_exceeded = true;
    }
    if (!empty($msg)) {
        CmnFns::do_error_box($msg, '', false);
    }
    if (!$is_exceeded) {
        ?>

<form name="login" method="post" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
">
<table width="350px" border="0" cellspacing="0" cellpadding="1" align="center">
<tr>
  <td bgcolor="#CCCCCC">
	<table width="100%" border="0" cellspacing="0" cellpadding="3">
	  <tr bgcolor="#EDEDED">
		<td colspan="2" style="border-bottom: solid 1px #CCCCCC;">
		  <h5 align="center"><?php 
        echo translate('Please Log In');
        ?>
</h5>
		</td>
	  </tr>
	<?php 
        if ($conf['app']['wrlc']) {
            ?>
	  <tr bgcolor="#FFFFFF">
		<td>
		  <p><b><?php 
            echo translate('Last Name');
            ?>
</b></p>
		</td>
		<td>
		  <input type="password" name="name" class="textbox" />
		</td>
	  </tr>
	  <tr bgcolor="#FFFFFF">
		<td width="150">
		  <p><b><?php 
            echo translate("GWId");
            ?>
</b></p>
		</td>
		<td>
		  <input type="password" name="gwid" class="textbox" />
		</td>
	  </tr>  

	<?php 
        } else {
            ?>
	  <tr bgcolor="#FFFFFF">
		<td width="150">
		  <p><b><?php 
            echo translate($use_logonname ? 'Logon name' : 'Email address');
            ?>
</b></p>
		</td>
		<td>
		  <input type="text" name="email" class="textbox" />
		</td>
	  </tr>
	  <tr bgcolor="#FFFFFF">
		<td>
		  <p><b><?php 
            echo translate('Password');
            ?>
</b></p>
		</td>
		<td>
		  <input type="password" name="password" class="textbox" />
		</td>
	  </tr>
	<!--   AK: language selection is not required at this point
		<tr bgcolor="#FFFFFF">
		<td>
		  <p><b><?php 
            echo translate('Language');
            ?>
</b></p>
		</td>
		<td>
		<?php 
            CmnFns::print_language_pulldown();
            ?>
		</td>
	  </tr> -->
	  <tr bgcolor="#FFFFFF">
		<td>
		  <p><b><?php 
            echo translate('Keep me logged in');
            ?>
</b></p>
		</td>
		<td>
		  <input type="checkbox" name="setCookie" value="true" />
		</td>
	  </tr>
		<?php 
        }
        ?>
		
	  <tr bgcolor="#FAFAFA">
		<td colspan="2" style="border-top: solid 1px #CCCCCC;">
		   <p align="center">
			<input type="submit" name="login" value="<?php 
        echo translate('Log In');
        ?>
" class="button" />
			<input type="hidden" name="resume" value="<?php 
        echo $resume;
        ?>
" />
		  </p>
		  <?php 
        if ((bool) $conf['app']['allowSelfRegistration']) {
            ?>
		  <h4 align="center" style="margin-bottom:1px;"><b><?php 
            echo translate('First time user');
            ?>
			<?php 
            $link->doLink('register.php', translate('Click here to register'), '', '', translate('Register for phpScheduleIt'));
            ?>
		  </h4>
		  <?php 
        }
        ?>
		</td>
	  </tr>
	</table>
  </td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
	<td>
	Our login system currently cannot handle hyphenated names. If you have a hyphen in your name, please substitute a space for it when logging in.
	</td>
</tr>
<tr><td>&nbsp;</td></tr>
</table>
<?php 
    }
    ?>
<p align="center">
<?php 
    $link->doLink('roschedule.php', translate('View Schedule'), '', '', translate('View a read-only version of the schedule'));
    ?>
|
<?php 
    if (!$conf['app']['wrlc']) {
        $link->doLink('forgot_pwd.php', translate('I Forgot My Password'), '', '', translate('Retreive lost password'));
        ?>
|
<?php 
    }
    ?>

<?php 
    $link->doLink('javascript: help();', translate('Help'), '', '', translate('Get online help'));
    ?>
</p>
</form>
<?php 
}
Пример #14
0
//Turn off all error reporting, useless for users
error_reporting(0);
$t = new Template(translate('Message Processing'));
$t->printHTMLHeader();
$t->printWelcome();
$t->startMain();
// Break table into 2 columns, put quick links on left side and all other tables on the right
startQuickLinksCol();
showQuickLinks();
// Print out My Quick Links
startDataDisplayCol();
$action = CmnFns::getGlobalVar('action', POST);
$query_string = CmnFns::get_query_string();
if (isset($action)) {
    switch ($action) {
        case translate('Send report and go back'):
            $process_action = CmnFns::getGlobalVar('process_action', POST);
            $error_array = unserialize(urldecode(CmnFns::getGlobalVar('serialized_error_array', POST)));
            sendMailToAdmin($process_action, $error_array);
            CmnFns::redirect_js('messagesIndex.php?' . $query_string);
            break;
        case translate('Go back'):
            CmnFns::redirect_js('messagesIndex.php?' . $query_string);
            break;
        default:
            CmnFns::do_error_box(translate('Unknown action type'), '', false);
    }
}
endDataDisplayCol();
$t->endMain();
$t->printHTMLFooter();
Пример #15
0
// Start execution timer
/**
* Include Template class
*/
include_once 'lib/Template.class.php';
/**
* Include scheduler-specific output functions
*/
include_once 'lib/Schedule.class.php';
$t = new Template(translate('Manage Blackout Times'));
$s = new Schedule(isset($_GET['scheduleid']) ? $_GET['scheduleid'] : null, BLACKOUT_ONLY);
// Print HTML headers
$t->printHTMLHeader();
// Check that the admin is logged in
if (!Auth::isAdmin()) {
    CmnFns::do_error_box(translate('This is only accessable to the administrator') . '<br />' . '<a href="ctrlpnl.php">' . translate('Back to My Control Panel') . '</a>');
}
// Print welcome box
$t->printWelcome();
// Begin main table
$t->startMain();
$t->startNavLinkTable();
$t->showNavLinksTable(Auth::isAdmin());
$t->endNavLinkTable();
$t->splitTable();
$s->print_schedule();
// Print out links to jump to new date
$s->print_jump_links();
// End main table
$t->endMain();
list($e_sec, $e_msec) = explode(' ', microtime());
Пример #16
0
/**
* Actually sends the email to all addresses in POST
* @param string $subject subject of email
* @param string $msg email message
* @param array $success array of users that email was successful for
*/
function print_email_results($subject, $msg, $success)
{
    if (!$success) {
        CmnFns::do_error_box(translate('problem sending email'), '', false);
    } else {
        CmnFns::do_message_box(translate('The email sent successfully.'));
    }
    echo '<h4 align="center">' . translate('do not refresh page') . '<br/>' . '<a href="' . $_SERVER['PHP_SELF'] . '?tool=email">' . translate('Return to email management') . '</a></h4>';
}
Пример #17
0
 /**
  * Logs the user in
  * @param string $login login
  * @param string $pass password
  * @param string $cookieVal y or n if we are using cookie
  * @param string $isCookie id value of user stored in the cookie
  * @param string $resume page to forward the user to after a login
  * @param string $lang language code to set
  * @return any error message that occured during login
  */
 function doLogin($login, $pass, $cookieVal = null, $isCookie = false, $resume = '', $lang = '', $domain = '')
 {
     global $conf;
     $msg = '';
     $allowedToLogin = true;
     if (empty($resume)) {
         $resume = 'summary.php';
     }
     // Go to control panel by default
     $_SESSION['sessionID'] = null;
     $_SESSION['sessionName'] = null;
     $_SESSION['sessionMail'] = null;
     $_SESSION['sessionAdmin'] = null;
     $_SESSION['sessionMailAdmin'] = null;
     $_SESSION['sessionNav'] = null;
     $login = stripslashes($login);
     $pass = stripslashes($pass);
     $ok_user = $ok_pass = false;
     $authMethod = $conf['auth']['serverType'];
     if ($isCookie != false) {
         // Cookie is set
         $id = $isCookie;
         if ($this->db->verifyID($id)) {
             $ok_user = $ok_pass = true;
         } else {
             $ok_user = $ok_pass = false;
             setcookie('ID', '', time() - 3600, '/');
             // Clear out all cookies
             $msg .= translate('That cookie seems to be invalid') . '<br/>';
         }
     } else {
         switch (strtolower($authMethod)) {
             case "ad":
             case "ldap":
                 // Added this check for LDAP servers that switch to anonymous bind whenever
                 // provided password is left blank
                 if ($pass == '') {
                     return translate('Invalid User Name/Password.');
                 }
                 // Include LDAPEngine class
                 include_once 'LDAPEngine.class.php';
                 $ldap = new LDAPEngine();
                 if ($ldap->connect()) {
                     // Get user DN
                     // For AD it could be of the form of 'user@domain' or standard LDAP dn
                     $dn = $ldap->getUserDN($login);
                     // Check if user is allowed to log in
                     if (!$this->isAllowedToLogin($login)) {
                         $allowedToLogin = false;
                         $msg .= 'User is not allowed to login';
                         // If user is allowed to log in try a bind
                     } elseif ($dn != '' && $ldap->authBind($dn, $pass)) {
                         $ldap->logonName = $login;
                         $ldap->loadUserData($dn);
                         $data = $ldap->getUserData();
                         $ok_user = true;
                         $ok_pass = true;
                     } else {
                         $msg .= 'Invalid User Name/Password.';
                     }
                     $ldap->disconnect();
                 }
                 break;
             case "sql":
                 // Include DBAuth class
                 include_once 'DBAuth.class.php';
                 $db = new DBAuth();
                 // Check if user is allowed to log in
                 if (!$this->isAllowedToLogin($login)) {
                     $allowedToLogin = false;
                     $msg .= 'User is not allowed to login';
                     // If user is allowed to log in try to authenticate
                 } elseif ($db->authUser($login, $pass)) {
                     $data = $db->getUserData();
                     $ok_user = true;
                     $ok_pass = true;
                 } else {
                     $msg .= 'Invalid User Name/Password.';
                 }
                 break;
             case "exchange":
                 // Include ExchAuth class
                 include_once 'ExchAuth.class.php';
                 $exch = new ExchAuth();
                 // Check if user is allowed to log in
                 if (!$this->isAllowedToLogin($login)) {
                     $allowedToLogin = false;
                     $msg .= 'User is not allowed to login';
                     // If user is allowed to log in try to authenticate
                 } elseif ($exch->authUser($login, $pass, $domain)) {
                     $data = $exch->getUserData();
                     $ok_user = true;
                     $ok_pass = true;
                 } else {
                     $msg .= 'Invalid User Name/Password.';
                 }
                 break;
             case "imap":
                 // Include IMAPAuth class
                 include_once 'IMAPAuth.class.php';
                 $imap = new IMAPAuth();
                 // Check if user is allowed to log in
                 if (!$this->isAllowedToLogin($login)) {
                     $allowedToLogin = false;
                     $msg .= 'User is not allowed to login';
                     // If user is allowed to log in try to authenticate
                 } elseif ($imap->authUser($login, $pass)) {
                     $data = $imap->getUserData();
                     $ok_user = true;
                     $ok_pass = true;
                 } else {
                     $msg .= 'Invalid User Name/Password.';
                 }
                 break;
             default:
                 CmnFns::do_error_box(translate('Unknown server type'), '', false);
                 break;
         }
     }
     // If the login failed, notify the user and quit the app
     if (!$ok_user || !$ok_pass || !$allowedToLogin) {
         CmnFns::write_log('Authentication failed' . ', ' . $msg, $login);
         return translate($msg);
     } else {
         $this->is_loggedin = true;
         CmnFns::write_log('Authentication successful', $login);
         /*
         			$user = new User($id);	// Get user info
         // If the user wants to set a cookie, set it
         			// for their ID and fname.  Expires in 30 days (2592000 seconds)
         			if (!empty($cookieVal)) {
         				//die ('Setting cookie');
         				setcookie('ID', $user->get_id(), time() + 2592000, '/');
         			}
         */
         // Set other session variables
         $_SESSION['sessionID'] = $data['logonName'];
         $_SESSION['sessionName'] = $data['firstName'];
         $_SESSION['sessionMail'] = $data['emailAddress'];
         // If it is the super admin, set session variable
         foreach ($conf['auth']['s_admins'] as $s_admin) {
             if (strtolower($s_admin) == strtolower($_SESSION['sessionID'])) {
                 $_SESSION['sessionAdmin'] = true;
             }
         }
         // If it is the mail admin, set session variable
         foreach ($conf['auth']['m_admins'] as $m_admin) {
             if (strtolower($m_admin) == strtolower($_SESSION['sessionID'])) {
                 $_SESSION['sessionMailAdmin'] = true;
             }
         }
         if ($lang != '') {
             set_language($lang);
         }
         // Send them to the control panel
         CmnFns::redirect(urldecode($resume));
     }
 }
Пример #18
0
 /**
  * Prints out an error message for the user
  * @param none
  */
 function print_error()
 {
     CmnFns::do_error_box(translate('That schedule is not available.') . '<br/><a href="javascript: history.back();">' . translate('Back') . '</a>', '', false);
 }
Пример #19
0
/**
* Prints a page notifiying the admin that the requirest failed.
* It will also assign the data passed in to a session variable
*  so it can be reinserted into the form that it came from
* @param string or array $msg message(s) to print to user
* @param array $data array of data to post back into the form
*/
function print_fail($msg, $data = null)
{
    if (!is_array($msg)) {
        $msg = array($msg);
    }
    if (!empty($data)) {
        $_SESSION['post'] = $data;
    }
    $t = new Template(translate('Update failed!'));
    $t->printHTMLHeader();
    $t->printWelcome();
    $t->startMain();
    CmnFns::do_error_box(translate('There were problems processing your request.') . '<br /><br />' . '- ' . join('<br />- ', $msg) . '<br />' . '<br /><a href="' . $_SERVER['HTTP_REFERER'] . '">' . translate('Please go back and correct any errors.') . '</a>');
    $t->endMain();
    $t->printHTMLFooter();
    die;
}
Пример #20
0
function verifyAndSendMail()
{
    global $conf;
    $subject = "[MailZu] " . stripslashes(CmnFns::getGlobalVar('subject', POST));
    $body = stripslashes(CmnFns::getGlobalVar('body', POST));
    if ($subject != '' && $body != '') {
        $adminEmail = $conf['app']['adminEmail'];
        $sub = "[ Email Administrator ] Notification from '" . $_SESSION['sessionID'] . "'";
        $mailer = new PHPMailer();
        if (is_array($adminEmail)) {
            foreach ($adminEmail as $email) {
                $mailer->AddAddress($email, '');
            }
        } else {
            $mailer->AddAddress($adminEmail, '');
        }
        $mailer->FromName = $_SESSION['sessionID'];
        $mailer->From = $_SESSION['sessionMail'][0];
        $mailer->Subject = $subject;
        $mailer->Body = $body;
        $mailer->Send();
        CmnFns::redirect_js('summary.php');
    } else {
        CmnFns::do_error_box(translate('You have to type some text'), '', false);
        printsendmail();
    }
}
Пример #21
0
/**
* Change user password
* This function creates a new random 8 character password,
*  sets it in the database and emails it to the user
* @return boolean true or false on success of function
* @see make_seed()
*/
function changePassword()
{
    global $conf;
    $adminemail = $conf['app']['adminEmail'];
    $title = $conf['app']['title'];
    $use_logon_name = (bool) $conf['app']['useLogonName'];
    // Check if user exists
    $email = stripslashes(trim($_POST['email_address']));
    // Connect to database
    $AuthDB = new AuthDB();
    $id = $AuthDB->userExists($email);
    if (empty($id)) {
        CmnFns::do_error_box(translate('Sorry, we could not find that user in the database.'), '', false);
        return false;
    } else {
        $user = new User($id);
        $result = $user->get_user_data();
    }
    // Generate new 8 character password by choosing random
    // ASCII characters between 48 and 122
    // (valid password characters)
    $pwd = '';
    $num = 0;
    for ($i = 0; $i < 8; $i++) {
        // Seed random for older versions of PHP
        mt_srand(make_seed());
        if ($i % 2 == 0) {
            $num = mt_rand(97, 122);
        } else {
            if ($i % 3 == 0) {
                $num = mt_rand(48, 58);
            } else {
                $num = mt_rand(63, 90);
            }
        }
        // Uppercase letters and '@ ?'
        // Put password together
        $pwd .= chr($num);
    }
    // Set password in database
    $user->set_password($pwd);
    // Send email to user
    $sub = translate('Your New Password', array($title));
    $msg = translate_email('new_password', $result['fname'], $conf['app']['title'], $pwd, CmnFns::getScriptURL(), $adminemail);
    $msg .= $use_logon_name ? "\r\n" . translate('Your logon name is', array($result['logon_name'])) : '';
    // Send email
    $mailer = new PHPMailer();
    $mailer->AddAddress($result['email'], $result['fname']);
    $mailer->FromName = $conf['app']['title'];
    $mailer->From = $adminemail;
    $mailer->Subject = $sub;
    $mailer->Body = $msg;
    $mailer->Send();
    return true;
}
Пример #22
0
            $msg = Link::getLink('index.php', translate('Login to manage all of your invitiations'));
        }
        CmnFns::do_message_box($msg);
    } else {
        $resid = $_GET['id'];
        $action = $_GET['action'];
        $res = new Reservation($resid);
        $resource = new Resource();
        $max_participants = $resource->get_property('max_participants', $res->get_machid());
        // If the total number of users (minus the owner) already participating is less than the max, let this user participate
        if ($action == INVITE_DECLINE || ($max_participants == '' || count($res->participating_users) < $max_participants)) {
            $msg = '<h5>' . translate('Confirm reservation participation') . '</h5><br/>';
            $word = $_GET['action'] == INVITE_ACCEPT ? 'Accept' : 'Decline';
            $msg .= '<input type="submit" class="button" name="y" value="' . translate($word) . '"/>';
            $msg .= ' ';
            $msg .= '<input type="submit" class="button" name="n" value="' . translate('Cancel') . '"/>';
            if ($res->is_repeat()) {
                $msg .= '<br/><input type="checkbox" name="update_all" value="yes"/> ' . translate('Do for all reservations in the group?');
            }
            echo '<form name="inv_mgmt" action="' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] . '" method="post">';
            CmnFns::do_message_box($msg);
            echo '</form>';
        } else {
            CmnFns::do_error_box(translate('That reservation is at full capacity.'), '', false);
        }
    }
}
// End main table
$t->endMain();
// Print HTML footer
$t->printHTMLFooter();
Пример #23
0
/**
* Prints out a login form and any error messages
* @param string $msg error messages to display for user
* @param string $resume page to resume on after login
*/
function printLoginForm($msg = '', $resume = '')
{
    global $conf;
    $link = CmnFns::getNewLink();
    // Check browser information
    echo '<script language="JavaScript" type="text/javascript">checkBrowser();</script>';
    if (!empty($msg)) {
        CmnFns::do_error_box($msg, '', false);
    }
    ?>
<form name="login" method="post" action="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
">
<table width="350px" border="0" cellspacing="0" cellpadding="1" align="center">
<tr>
  <td bgcolor="#CCCCCC">
	<table width="100%" border="0" cellspacing="0" cellpadding="3">
	  <tr bgcolor="#EDEDED">
		<td colspan="2" style="border-bottom: solid 1px #CCCCCC;">
		  <h5 align="center"><?php 
    echo translate('Please Log In');
    ?>
</h5>
		</td>
	  </tr>
	  <tr bgcolor="#FFFFFF">
		<td width="150">
		  <p><b><?php 
    echo translate('Login');
    ?>
</b></p>
		</td>
		<td>
		  <input type="text" name="email" class="textbox" />
		</td>
	  </tr>
	  <tr bgcolor="#FFFFFF">
		<td>
		  <p><b><?php 
    echo translate('Password');
    ?>
</b></p>
		</td>
		<td>
		  <input type="password" name="password" class="textbox" />
		</td>
	  </tr>
	  <?php 
    if ($conf['auth']['serverType'] === 'exchange') {
        ?>
	  <tr bgcolor="#FFFFFF">
		<td>
		  <p><b><?php 
        echo translate('Domain');
        ?>
</b></p>
		</td>
		<td>
		  <input type="text" name="domain" class="textbox" value="<?php 
        echo $conf['auth']['exch_domain'];
        ?>
"/>
		</td>
	  </tr>
	  <?php 
    }
    if ($conf['app']['selectLanguage']) {
        ?>
	  <tr bgcolor="#FFFFFF">
		<td>
		  <p><b><?php 
        echo translate('Language');
        ?>
</b></p>
		</td>
		<td>
		<?php 
        CmnFns::print_language_pulldown();
        ?>
		</td>
	  </tr>
	  <?php 
    }
    ?>
	  <tr bgcolor="#FFFFFF">
		<td>
		  <p><b><?php 
    echo translate('Keep me logged in');
    ?>
</b></p>
		</td>
		<td>
		  <input type="checkbox" name="setCookie" value="true" />
		</td>
	  </tr>
	  <tr bgcolor="#FAFAFA">
		<td colspan="2" style="border-top: solid 1px #CCCCCC;">
		   <p align="center">
			<input type="submit" name="login" value="<?php 
    echo translate('Log In');
    ?>
" class="button" />
			<input type="hidden" name="resume" value="<?php 
    echo $resume;
    ?>
" />
		  </p>
		</td>
	  </tr>
	</table>
  </td>
</tr>
</table>
<p align="center">
<?php 
    $link->doLink('javascript: help();', translate('Help'), '', '', translate('Get online help'));
    ?>
</p>
</form>
<?php 
}