Changeset 592 for trunk/lib/Lock.inc.php


Ignore:
Timestamp:
Apr 3, 2017 8:24:25 AM (7 years ago)
Author:
anonymous
Message:

Update wording of lock messages. Add SQL escaping. Code formatting.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Lock.inc.php

    r560 r592  
    371371            $db->query("
    372372                DELETE FROM " . $db->escapeString($this->getParam('db_table')) . "
    373                 WHERE DATE_ADD(lock_datetime, INTERVAL '" . $this->getParam('auto_timeout') . "' SECOND) < NOW()
     373                WHERE DATE_ADD(lock_datetime, INTERVAL '" . $db->escapeString($this->getParam('auto_timeout')) . "' SECOND) < NOW()
    374374            ");
    375375            $_timeout_run = true;
     
    388388
    389389    /**
    390      * Print error page.
     390     * Print error page. This method is probably not used anywhere; instead, we're including this via the template codebase/services/templates/lock.ihtml
    391391     */
    392392    public function printErrorHTML()
     
    399399            <div id="sc-msg" class="sc-msg">
    400400                <div class="sc-msg-notice">
    401                 <?php printf(_("The record %s is currently being edited by %s (%d minutes elapsed). You cannot modify the record while it is locked by another user."),
    402                     $this->getTitle(),
     401                <?php printf(_("<em>%s</em> is currently being edited by %s (%d minutes elapsed). You cannot modify this database record while it is locked. Please try again later."),
     402                    ucfirst($this->getTitle()),
    403403                    $this->getEditor(),
    404404                    date('i', $this->getSecondsElapsed() + 60)
     
    450450    public function getSecondsElapsed()
    451451    {
    452         if (isset($this->data['lock_datetime']) && strtotime($this->data['lock_datetime']) < time()) {
    453             return time() - strtotime($this->data['lock_datetime']);
     452        if (isset($this->data['lock_datetime']) && false !== ($lock_timestamp = strtotime($this->data['lock_datetime'])) && $lock_timestamp < time()) {
     453            return time() - $lock_timestamp;
    454454        } else {
    455455            return 0;
Note: See TracChangeset for help on using the changeset viewer.