示例#1
0
 /**
  * Admin class constructor
  * Sets up GUI and gets the current tool
  */
 function Admin($tool)
 {
     $this->pager = CmnFns::getNewPager();
     $this->pager->setTextStyle('font-size: 10px;');
     $this->pager->setTbClass('textbox');
     $this->db = new AdminDB();
     // Make sure its a proper tool
     if (!isset($this->tools[$tool])) {
         $this->is_error = true;
         $this->error_msg = translate('Could not determine tool');
     } else {
         $this->tool = $this->tools[$tool];
     }
 }
示例#2
0
文件: index.php 项目: razagilani/srrs
/**
* Prints html header
* @param none
*/
function doPrintHeader()
{
    global $conf;
    ?>
<p align="center">
<?php 
    CmnFns::print_language_pulldown();
    ?>
</p>
<h3 align="center">phpScheduleIt v<?php 
    echo $conf['app']['version'];
    ?>
</h3>
<?php 
}
示例#3
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>';
}
示例#4
0
文件: rss.php 项目: razagilani/srrs
* @package phpScheduleIt
*
* Copyright (C) 2003 - 2007 phpScheduleIt
* License: GPL, see LICENSE
*/
include_once 'lib/DBEngine.class.php';
if (!(bool) $conf['app']['allowRss'] || (bool) $conf['app']['allowRss'] && !isset($_GET['id'])) {
    die;
}
$db = new DBEngine();
$res = $db->get_user_reservations($_GET['id'], 'res.start_date', 'DESC', true);
global $charset;
header('Content-Type: text/xml');
echo "<?xml version=\"1.0\" encoding=\"{$charset}\"?" . ">\n<rss version=\"2.0\">\n";
echo "<channel>\n<title>{$conf['app']['title']} Reservations</title>\n";
if (!$res) {
    echo "<item>\n";
    echo '<title>' . $db->err_msg . "</title>\n";
    echo '<link>' . CmnFns::getScriptURL() . "</link>\n";
    echo '<description>' . $db->err_msg . "</description>\n";
    echo "</item>\n";
}
for ($i = 0; $i < count($res) && $res != false; $i++) {
    $cur = $res[$i];
    echo "<item>\n";
    echo '<title>' . $cur['name'] . ' [' . Time::formatDate($cur['start_date']) . ' @ ' . Time::formatTime($cur['starttime']) . "]</title>\n";
    echo '<link>' . CmnFns::getScriptURL() . "/reserve.php?type=m&amp;resid={$cur['resid']}&amp;scheduleid={$cur['scheduleid']}" . "</link>\n";
    echo '<description>' . "</description>\n";
    echo "</item>\n";
}
echo "</channel>\n</rss>";
示例#5
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();
示例#6
0
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>";
    }
    endMessage();
}
endDataDisplayCol();
$t->endMain();
$t->printHTMLFooter();
示例#7
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']);
}
示例#8
0
    $search_array1 = $db->convertSearch2SQL('msgs.from_addr', CmnFns::getGlobalVar('f_criterion', GET), CmnFns::getGlobalVar('f_string', GET));
    $search_array2 = $db->convertSearch2SQL('msgs.subject', CmnFns::getGlobalVar('s_criterion', GET), CmnFns::getGlobalVar('s_string', GET));
    $search_array3 = $db->convertSearch2SQL('recip.email', CmnFns::getGlobalVar('t_criterion', GET), CmnFns::getGlobalVar('t_string', GET));
    $search_array4 = $db->convertSearch2SQL('msgs.mail_id', CmnFns::getGlobalVar('m_criterion', GET), CmnFns::getGlobalVar('m_string', GET));
    $search_array = array_merge($search_array1, $search_array2, $search_array3, $search_array4);
    $order = array('msgs.time_num', 'from_addr', 'msgs.subject', 'spam_level', 'recip.email', 'msgs.content', 'mail_id');
    // Arbitrary type for Admin
    //$content_type = (CmnFns::get_ctype() ? CmnFns::get_ctype() : 'A');
    //echo "Before query: " . date("l dS of F Y h:i:s A") . "<br><br>";
    if (CmnFns::getGlobalVar('searchOnly', GET) != 1) {
        // Print a loading message until database returns...
        printMessage(translate('Retrieving Messages...'));
        $messages = $db->get_user_messages($content_type, $_SESSION['sessionMail'], CmnFns::get_value_order($order), CmnFns::get_vert_order(), $search_array, 1, 0, $requestedPage);
    }
    // Compute maximum number of pages
    $maxPage = ceil($db->numRows / $sizeLimit) - 1;
    // If $requestedPage > $maxPage, then redirect to $maxPage instead of $requestedPage
    if ($requestedPage > $maxPage) {
        $query_string = CmnFns::array_to_query_string($_GET, array('page'));
        $query_string = str_replace('&amp;', '&', $query_string);
        CmnFns::redirect_js($_SERVER['PHP_SELF'] . '?' . $query_string . '&page=' . $maxPage);
    }
    if (CmnFns::getGlobalVar('searchOnly', GET) != 1) {
        showMessagesTable($content_type, $messages, $requestedPage, CmnFns::get_value_order($order), CmnFns::get_vert_order(), $db->numRows);
        // Hide the message after the table loads.
        hideMessage(translate('Retrieving Messages...'));
    }
}
endDataDisplayCol();
$t->endMain();
$t->printHTMLFooter();
示例#9
0
$t->printWelcome();
$t->startMain();
$user = new User(Auth::getCurrentID());
$is_group_admin = $user->is_group_admin();
$t->startNavLinkTable();
$t->showNavLinksTable(Auth::isAdmin());
$t->endNavLinkTable();
$t->splitTable();
$order = array('number');
$announcements = $db->get_announcements(mktime());
if ($announcements) {
    showAnnouncementTable($announcements, $db->get_err());
    printCpanelBr();
}
// Valid order values in reservation retreival
$order = array('start_date', 'name', 'starttime', 'endtime', 'created', 'modified');
$res = $db->get_user_reservations(Auth::getCurrentID(), CmnFns::get_value_order($order), CmnFns::get_vert_order());
showReservationTable($res, $db->get_err());
// Print out My Reservations
printCpanelBr();
// AK: Invitations are not used in our case.
//showInvitesTable($db->get_user_invitations(Auth::getCurrentID(), true), $db->get_err());
//printCpanelBr();
//showParticipatingTable($db->get_user_invitations(Auth::getCurrentID(), false), $db->get_err());
//printCpanelBr();
if ($conf['app']['use_perms']) {
    showTrainingTable($db->get_user_permissions(Auth::getCurrentID()), $db->get_err());
}
endDataDisplayCol();
$t->endMain();
$t->printHTMLFooter();
示例#10
0
<?php

//NOT TESTED. NEED TO TEST.
@define('BASE_DIR', dirname(__FILE__) . '/../..');
include_once 'AdminDB.class.php';
$db = new AdminDB();
//get users ids to delete
$date = date('Y-m-d', time() - 30 * 24 * 60 * 60);
$query = 'SELECT memberid FROM' . ' ' . $db->get_table('login') . ' ' . 'WHERE last_login <' . ' ' . $date . ' ' . 'OR last_login IS NULL';
$result = $db->db->query($query);
$db->check_for_error($result);
$memberids = array();
print $query;
while ($id = $result->fetchRow()) {
    $memberids[] = $id['memberid'];
    #print $id['memberid'];
}
//delet users
$db->del_users($memberids);
CmnFns::write_log('Users deleted based because of inactivity. ' . join(', ', 'memberids'), 'sessionID');
示例#11
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());
示例#12
0
 /**
  * Sets the link class variable to reference a new Link object
  * @param none
  */
 function set_link()
 {
     $this->link = CmnFns::getNewLink();
 }
示例#13
0
 /**
  * Queries LDAP for user information
  * @param string $dn
  * @return boolean indicating success or failure
  */
 function loadUserData($dn)
 {
     $this->emailAddress = array();
     // We are instered in getting just the user's first name and his/her mail attribute(s)
     $attributes = $this->mailAttr;
     array_push($attributes, strtolower($this->name));
     switch ($this->serverType) {
         case "ldap":
             $result = ldap_search($this->connection, $dn, "objectclass=*", $attributes);
             break;
         case "ad":
             if (strtolower($this->login) == 'samaccountname') {
                 // dn is of the form 'user@domain'
                 list($samaccountname, $domain) = explode("@", $dn);
                 $result = ldap_search($this->connection, $this->getSearchBase(), $this->login . "=" . $samaccountname, $attributes);
             } else {
                 // dn is standard LDAP dn
                 $result = ldap_search($this->connection, $dn, "objectclass=*", $attributes);
             }
             break;
     }
     $entries = ldap_get_entries($this->connection, $result);
     if ($result and $entries["count"] > 0) {
         // The search should give a single entry
         // If several results are found get the first entry
         $this->firstName = $entries[0][strtolower($this->name)][0];
         foreach ($this->mailAttr as $value) {
             // For single value or multiple value attribute
             for ($i = 0; $i < $entries[0][strtolower($value)]["count"]; $i++) {
                 # AD proxyAddresses attribute values have 'smtp:' string before the actual email address
                 if (preg_match("/^smtp:/i", strtolower($entries[0][strtolower($value)][$i])) == 1) {
                     array_push($this->emailAddress, preg_replace("/^\\w+:/", '', strtolower($entries[0][strtolower($value)][$i])));
                 } else {
                     array_push($this->emailAddress, strtolower($entries[0][strtolower($value)][$i]));
                 }
             }
         }
     } else {
         // If no results returned
         $this->ldapErrorCode = -1;
         $this->ldapErrorText = "No entry found matching search criteria";
         CmnFns::write_log($this->ldapErrorCode . ': ' . $this->ldapErrorText, '');
         return false;
     }
     return true;
 }
示例#14
0
 /**
  * Function that convert $_GET into query string and exclude array
  * @param array of variables to exclude
  * @return query string
  */
 function querystring_exclude_vars($excl_array = array())
 {
     return CmnFns::array_to_query_string($_GET, $excl_array);
 }
示例#15
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;
 }
示例#16
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();
示例#17
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;
 }
示例#18
0
 /**
  * Prints out the latest success box
  * @param none
  */
 function print_success_box()
 {
     CmnFns::do_message_box($this->success);
 }
示例#19
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);
 }
示例#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
* 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();
示例#22
0
/**
* This file provides the output functions for
*  an interface for reserving resources,
*  viewing other reservations and modifying their own.
* @author Nick Korbel <*****@*****.**>
* @author David Poole <*****@*****.**>
* @author Richard Cantzler <*****@*****.**>
* @version 06-23-07
* @package Templates
*
* Copyright (C) 2003 - 2007 phpScheduleIt
* License: GPL, see LICENSE
*/
// Get Link object
$link = CmnFns::getNewLink();
/**
* Print out week being viewed above schedule tables
* @param array $d array of date information about this schedule
* @param string $title title of schedule
*/
function print_date_span($d, $title)
{
    // Print out current week being viewed
    // echo '<h3 align="center">' . $title . '<br/>' . Time::formatDate($d['firstDayTs']) . ' - ' . Time::formatDate($d['lastDayTs']) . '</h3>';
    // AK: Updated version. We want to display current date only.
    echo '<h3 align="center">' . Time::formatDate($d['todayTs']) . '</h3>';
}
/**
* Prints out a jump menu for the schedules
* @param array $links array of schedule links
示例#23
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;
}
示例#24
0
文件: admin.php 项目: razagilani/srrs
* @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();
示例#25
0
文件: ical.php 项目: razagilani/srrs
* @package phpScheduleIt.iCalendar
*
* Copyright (C) 2003 - 2007 phpScheduleIt
* License: GPL, see LICENSE
*/
require_once '../lib/pagebase/download/StreamDownload.php';
require_once '../lib/icalendar/ICalExport.php';
require_once '../lib/icalendar/ICalReservationFormatter.php';
require_once '../lib/vcalendar/VCalExport.php';
require_once '../lib/vcalendar/VCalReservationFormatter.php';
require_once '../lib/ReservationSearch.php';
require_once '../lib/Auth.class.php';
define('ICAL', 'ical');
define('VCAL', 'vcal');
if (!Auth::is_logged_in()) {
    CmnFns::redirect('../ctrlpnl.php', 1, false);
}
$export = getExport();
$ext = getExtension();
$page = new StreamDownload("phpScheduleIt.{$ext}", $export->toString());
$page->download();
function getExport()
{
    $results = getResults();
    if (isset($_GET['type']) && $_GET['type'] == VCAL) {
        return new VCalExport($results);
    } else {
        return new ICalExport($results);
    }
}
function getExtension()
示例#26
0
/**
* Print success message after changed password
* This function simply prints out a message informing
*  the user that thier password was changed and how to
*  log in now
* @param none
*/
function printSuccess()
{
    CmnFns::do_message_box(translate('Your new passsword has been emailed to you.'), 'width: 75%;');
}
示例#27
0
文件: join1.php 项目: razagilani/srrs
                // 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;
示例#28
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);
     }
 }
示例#29
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();
示例#30
0
include_once 'templates/usergroup.template.php';
$t = new Template(translate('Manage Groups'));
$t->printHTMLHeader();
$t->startMain();
if (!isset($_POST['submit'])) {
    $user = new User($_GET['memberid']);
    $cur_user = new User();
    $cur_user->userid = Auth::getCurrentID();
    if (!Auth::isAdmin() && !$cur_user->is_group_admin($user->get_groupids())) {
        CmnFns::do_error_box(translate('This is only accessable to the administrator'));
        die;
    }
    print_edit((bool) $_GET['edit'] && Auth::isAdmin(), $user);
} else {
    if (!Auth::isAdmin()) {
        CmnFns::do_error_box(translate('This is only accessable to the administrator'));
        die;
    }
    $to_add = isset($_POST['add_groups']) ? $_POST['add_groups'] : array();
    update_groups($_POST['memberid'], $to_add);
}
$t->endMain();
$t->printHTMLFooter();
/**
* Prints out the display/edit UI to add/remove groups for this user
* @param string $memberid id of the member to to change groups for
*/
function print_edit($edit, &$user)
{
    $group = new Group(new GroupDB());
    $non_user_groups = $group->getGroups($user->get_id());