示例#1
0
function reporton(&$row, &$last_area_room)
{
    global $typel;
    global $enable_periods;
    # Display Area/Room, but only when it changes:
    $area_room = htmlspecialchars($row[8]) . " - " . htmlspecialchars($row[9]);
    if ($area_room != $last_area_room) {
        echo "<hr><h2>" . get_vocab("room") . $area_room . "</h2>\n";
        $last_area_room = $area_room;
    }
    echo "<hr><table width=\"100%\">\n";
    # Brief Description (title), linked to view_entry:
    echo "<tr><td class=\"BL\"><a href=\"view_entry.php?id={$row['0']}\">" . htmlspecialchars($row[3]) . "</a></td>\n";
    # From date-time and duration:
    echo "<td class=\"BR\" align=right>" . (empty($enable_periods) ? describe_span($row[1], $row[2]) : describe_period_span($row[1], $row[2])) . "</td></tr>\n";
    # Description:
    echo "<tr><td class=\"BL\" colspan=2><b>" . get_vocab("description") . "</b> " . nl2br(htmlspecialchars($row[4])) . "</td></tr>\n";
    # Entry Type:
    $et = empty($typel[$row[5]]) ? "?{$row['5']}?" : $typel[$row[5]];
    echo "<tr><td class=\"BL\" colspan=2><b>" . get_vocab("type") . "</b> {$et}</td></tr>\n";
    # Created by and last update timestamp:
    echo "<tr><td class=\"BL\" colspan=2><small><b>" . get_vocab("createdby") . "</b> " . htmlspecialchars($row[6]) . ", <b>" . get_vocab("lastupdate") . "</b> " . date_time_string(MDB_Date::mdbstamp2Unix($row[7])) . "</small></td></tr>\n";
    echo "</table>\n";
}
示例#2
0
function reporton(&$row, &$last_area_room, &$last_date, $sortby, $display)
{
    global $typel;
    global $enable_periods;
    # Display Area/Room, but only when it changes:
    $area_room = htmlspecialchars($row[8]) . " - " . htmlspecialchars($row[9]);
    $date = utf8_strftime("%d-%b-%Y", $row[1]);
    # entries to be sorted on area/room
    if ($sortby == "r") {
        if ($area_room != $last_area_room) {
            echo "<hr><h2>" . get_vocab("room") . ": " . $area_room . "</h2>\n";
        }
        if ($date != $last_date || $area_room != $last_area_room) {
            echo "<hr noshade=\"true\"><h3>" . get_vocab("date") . " " . $date . "</h3>\n";
            $last_date = $date;
        }
        # remember current area/room that is being processed.
        # this is done here as the if statement above needs the old
        # values
        if ($area_room != $last_area_room) {
            $last_area_room = $area_room;
        }
    } else {
        if ($date != $last_date) {
            echo "<hr><h2>" . get_vocab("date") . " " . $date . "</h2>\n";
        }
        if ($area_room != $last_area_room || $date != $last_date) {
            echo "<hr noshade=\"true\"><h3>" . get_vocab("room") . ": " . $area_room . "</h3>\n";
            $last_area_room = $area_room;
        }
        # remember current date that is being processed.
        # this is done here as the if statement above needs the old
        # values
        if ($date != $last_date) {
            $last_date = $date;
        }
    }
    echo "<hr><table width=\"100%\">\n";
    # Brief Description (title), linked to view_entry:
    echo "<tr><td class=\"BL\"><a href=\"view_entry.php?id={$row['0']}\">" . htmlspecialchars($row[3]) . "</a></td>\n";
    # what do you want to display duration or end date/time
    if ($display == "d") {
        # Start date/time and duration:
        echo "<td class=\"BR\" align=right>" . (empty($enable_periods) ? describe_span($row[1], $row[2]) : describe_period_span($row[1], $row[2])) . "</td></tr>\n";
    } else {
        # Start date/time and End date/time:
        echo "<td class=\"BR\" align=right>" . (empty($enable_periods) ? start_to_end($row[1], $row[2]) : start_to_end_period($row[1], $row[2])) . "</td></tr>\n";
    }
    # Description:
    echo "<tr><td class=\"BL\" colspan=2><b>" . get_vocab("description") . "</b> " . nl2br(htmlspecialchars($row[4])) . "</td></tr>\n";
    # Entry Type:
    $et = empty($typel[$row[5]]) ? "?{$row['5']}?" : $typel[$row[5]];
    echo "<tr><td class=\"BL\" colspan=2><b>" . get_vocab("type") . "</b> {$et}</td></tr>\n";
    # Created by and last update timestamp:
    echo "<tr><td class=\"BL\" colspan=2><small><b>" . get_vocab("createdby") . "</b> " . htmlspecialchars($row[6]) . ", <b>" . get_vocab("lastupdate") . "</b> " . date_time_string(MDB_Date::mdbstamp2Unix($row[7])) . "</small></td></tr>\n";
    echo "</table>\n";
}
示例#3
0
 /**
  * Reads auth_user_id, passwd, is_active flag
  * lastlogin timestamp from the database
  * If only $handle is given, it will read the data
  * from the first user with that handle and return
  * true on success.
  * If $handle and $passwd are given, it will try to
  * find the first user with both handle and password
  * matching and return true on success (this allows
  * multiple users having the same handle but different
  * passwords - yep, some people want this).
  * If no match is found, false is being returned.
  *
  * @access private
  * @param  string   user handle
  * @param  boolean  user password
  * @return boolean  true upon success, false otherwise
  */
 function _readUserData($handle, $passwd = false)
 {
     if (!$this->init_ok) {
         return false;
     }
     $success = false;
     $fields = array();
     foreach ($this->authTableCols as $key => $value) {
         if (sizeof($value) > 0) {
             foreach ($value as $alias => $field_data) {
                 $fields[] = $field_data['name'] . ' AS ' . $alias;
                 $types[] = $field_data['type'];
             }
         }
     }
     if ($passwd !== false) {
         // If $passwd is set, try to find the first user with the given
         // handle and password.
         $sql = 'SELECT ' . implode(',', $fields) . '
                    FROM ' . $this->authTable . '
                    WHERE ' . $this->authTableCols['required']['handle']['name'] . '=' . $this->dbc->getValue($this->authTableCols['handle']['type'], $handle) . '
                     AND ' . $this->authTableCols['required']['passwd']['name'] . '=' . $this->dbc->getValue($this->authTableCols['passwd']['type'], $this->encryptPW($passwd));
     } else {
         // If only $handle is set, try to find the first matching user
         $sql = 'SELECT ' . implode(',', $fields) . '
                    FROM  ' . $this->authTable . '
                    WHERE ' . $this->authTableCols['required']['handle']['name'] . '=' . $this->dbc->getValue($this->authTableCols['handle']['type'], $handle);
     }
     // Query database
     $result = $this->dbc->queryRow($sql, $types, MDB_FETCHMODE_ASSOC);
     // If a user was found, read data into class variables and set
     // return value to true
     if (!MDB::isError($result) && is_array($result)) {
         $this->handle = $result['handle'];
         $this->passwd = $this->decryptPW($result['passwd']);
         $this->isActive = !isset($result['is_active']) || $result['is_active'] ? true : false;
         $this->authUserId = $result['auth_user_id'];
         $this->lastLogin = !empty($result['lastlogin']) ? MDB_Date::mdbstamp2Unix($result['lastlogin']) : '';
         $success = true;
     }
     return $success;
 }
示例#4
0
 /**
  * Reads user data from the given data source
  * If only $handle is given, it will read the data
  * from the first user with that handle and return
  * true on success.
  * If $handle and $passwd are given, it will try to
  * find the first user with both handle and password
  * matching and return true on success (this allows
  * multiple users having the same handle but different
  * passwords - yep, some people want this).
  * if only an auth_user_id is passed it will try to read the data based on the id
  * If no match is found, false is being returned.
  *
  * @param  string user handle
  * @param  string user password
  * @param  bool|int if the user data should be read using the auth user id
  * @return bool true on success or false on failure
  *
  * @access public
  */
 function readUserData($handle = '', $passwd = '', $auth_user_id = false)
 {
     $fields = $types = array();
     foreach ($this->tables['users']['fields'] as $field => $req) {
         $fields[] = $this->alias[$field] . ' AS ' . $field;
         $types[] = $this->fields[$field];
     }
     // Setting the default query.
     $query = 'SELECT ' . implode(',', $fields) . '
                FROM ' . $this->prefix . $this->alias['users'] . '
                WHERE  ';
     if ($auth_user_id) {
         $query .= $this->alias['auth_user_id'] . '=' . $this->dbc->getValue($this->fields['auth_user_id'], $auth_user_id);
     } else {
         if (!is_array($this->handles) || empty($this->handles)) {
             $this->stack->push(LIVEUSER_ERROR_CONFIG, 'exception', array('reason' => 'No handle set in storage config.'));
             return false;
         }
         $handles = array();
         foreach ($this->handles as $field) {
             $handles[] = $this->alias[$field] . '=' . $this->dbc->getValue($this->fields[$field], $handle);
         }
         $query .= '(' . implode(' OR ', $handles) . ')';
         if (!is_null($this->tables['users']['fields']['passwd'])) {
             // If $passwd is set, try to find the first user with the given
             // handle and password.
             $query .= ' AND   ' . $this->alias['passwd'] . '=' . $this->dbc->getValue($this->fields['passwd'], $this->encryptPW($passwd));
         }
     }
     // Query database
     $result = $this->dbc->queryRow($query, $types, MDB_FETCHMODE_ASSOC);
     if (PEAR::isError($result)) {
         $this->stack->push(LIVEUSER_ERROR, 'exception', array('reason' => $result->getMessage() . '-' . $result->getUserInfo()));
         return false;
     }
     if (!is_array($result)) {
         return null;
     }
     // User was found, read data into class variables and set return value to true
     if (array_key_exists('lastlogin', $result) && !empty($result['lastlogin'])) {
         $result['lastlogin'] = MDB_Date::mdbstamp2Unix($result['lastlogin']);
     }
     $this->propertyValues = $result;
     return true;
 }
示例#5
0
}
if (NULL == $row) {
    fatal_error(0, $series ? get_vocab('invalid_series_id') : get_vocab('invalid_entry_id'));
}
# Note: Removed stripslashes() calls from name and description. Previous
# versions of MRBS mistakenly had the backslash-escapes in the actual database
# records because of an extra addslashes going on. Fix your database and
# leave this code alone, please.
$name = htmlspecialchars($row[0]);
$description = htmlspecialchars($row[1]);
$create_by = htmlspecialchars($row[2]);
$room_name = htmlspecialchars($row[3]);
$area_name = htmlspecialchars($row[4]);
$type = $row[5];
$room_id = $row[6];
$updated = time_date_string(MDB_Date::mdbstamp2Unix($row[7]));
# need to make DST correct in opposite direction to entry creation
# so that user see what he expects to see
$duration = $row[8] - cross_dst($row[9], $row[10]);
if ($enable_periods) {
    list($start_period, $start_date) = period_date_string($row[9]);
} else {
    $start_date = time_date_string($row[9]);
}
if ($enable_periods) {
    list(, $end_date) = period_date_string($row[10], -1);
} else {
    $end_date = time_date_string($row[10]);
}
$rep_type = 0;
if ($series == 1) {