Changeset 235


Ignore:
Timestamp:
Mar 7, 2007 11:32:07 AM (17 years ago)
Author:
quinn
Message:

Q - fixed some fv->err() usage bugs, increased resolution of textColor(), improved formatting of some Utilities.inc.php functions.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/revision_history.txt

    r137 r235  
    2121
    2222remove interdependencies:
    23     - App() is the only dependency for other classes. It includes Utilities.inc.php silently.
    24     - Update libs requiring external files, such as html templates and email templates, classes now self-contained.
     23    - App() is the primary dependency for other classes. It includes Utilities.inc.php silently.
     24    - Updated classes requiring external files, such as html templates and email templates, classes now self-contained.
    2525
    2626Things with modified interfaces:
  • trunk/lib/ImageThumb.inc.php

    r224 r235  
    156156     *
    157157     * @access  public
    158      * @param   array $spec The specifications for a size of output image.
     158     * @param   array   $spec   The specifications for a size of output image.
     159     * @param   int     $index  The position of the specification in the spec array
     160     *                          Use to overwrite existing spev array values.
    159161     */
    160162    function setSpec($spec, $index=null)
  • trunk/lib/Lock.inc.php

    r202 r235  
    377377        ?></p>
    378378
    379         <?php if ($this->getSecondsElapsed() > $this->getParam('timeout')) { ?>
     379        <?php if ($this->getSecondsElapsed() >= $this->getParam('timeout')) { ?>
    380380        <p><?php printf(_("You can forcibly unlock the record if you believe the editing session has expired. You might want to confirm with %s before doing this."), $this->getEditor()) ?></p>
    381381        <input type="submit" name="unlock" value="<?php echo _("Unlock"); ?>" />
     
    416416    function getSecondsElapsed()
    417417    {
    418         if (isset($this->data['lock_datetime']) && $this->data['lock_datetime'] < time()) {
     418        if (isset($this->data['lock_datetime']) && strtotime($this->data['lock_datetime']) < time()) {
    419419            return time() - strtotime($this->data['lock_datetime']);
    420420        } else {
  • trunk/lib/Utilities.inc.php

    r224 r235  
    150150function getTextColor($text, $method=1)
    151151{
    152     $r = substr(md5($text), 0, 1);
    153     $g = substr(md5($text), 1, 1);
    154     $b = substr(md5($text), 2, 1);
     152    $hash = md5($text);
     153    $rgb = array(
     154        substr($hash, 0, 1),
     155        substr($hash, 1, 1),
     156        substr($hash, 2, 1),
     157        substr($hash, 3, 1),
     158        substr($hash, 4, 1),
     159        substr($hash, 5, 1),
     160    );
    155161
    156162    switch ($method) {
    157     case 2 :
    158         if (hexdec($r) > hexdec('c')) {
    159             $r = dechex(hexdec('f') - hexdec($r));
    160         }
    161         if (hexdec($g) > hexdec('c')) {
    162             $g = dechex(hexdec('f') - hexdec($g));
    163         }
    164         if (hexdec($b) > hexdec('c')) {
    165             $b = dechex(hexdec('f') - hexdec($b));
    166         }
    167         break;
    168 
    169163    case 1 :
    170164    default :
    171         $r = dechex(round(hexdec($r) * .8));
    172         $g = dechex(round(hexdec($g) * .8));
    173         $b = dechex(round(hexdec($b) * .6));
     165        // Reduce all hex values slighly to avoid all white.
     166        array_walk($rgb, create_function('&$v', '$v = dechex(round(hexdec($v) * 0.87));'));
    174167        break;
    175     }
    176 
    177     return $r . $r . $g . $g . $b . $b;
     168    case 2 :
     169        foreach ($rgb as $i => $v) {
     170            if (hexdec($v) > hexdec('c')) {
     171                $rgb[$i] = dechex(hexdec('f') - hexdec($v));
     172            }
     173        }
     174        break;
     175    }
     176
     177    return join('', $rgb);
    178178}
    179179
     
    392392 * @return array              URL with array elements as URL key=value arguments.
    393393 */
    394 function urlEncodeArray($data, $prefix='', $_return=true) {
     394function urlEncodeArray($data, $prefix='', $_return=true)
     395{
    395396
    396397    // Data is stored in static variable.
     
    428429 * @return string url         A string ready to append to a url.
    429430 */
    430 function urlEncodeArrayToString($data, $prefix='') {
     431function urlEncodeArrayToString($data, $prefix='')
     432{
    431433
    432434    $array_args = urlEncodeArray($data, $prefix);
     
    708710 * will see data before the page is finished processing.
    709711 */
    710 function flushBuffer() {
     712function flushBuffer()
     713{
    711714    echo str_repeat('          ', 205);
    712715    flush();
  • trunk/services/templates/admin_form.ihtml

    r185 r235  
    1313    </tr>
    1414    <tr>
    15         <td class="sc-right"><label for="username"<?php $fv->err('username', ' class="error"') ?>><?php echo _("Username"); ?></label></td>
     15        <td class="sc-right"><label for="username" class="<?php $fv->err('username'); ?>"><?php echo _("Username"); ?></label></td>
    1616        <td>
    1717            <input type="text" class="sc-small" size="50" name="username" value="<?php echo oTxt($frm['username']); ?>" />
     
    1919    </tr>
    2020    <tr>
    21         <td class="sc-right"><label for="userpass"<?php $fv->err('userpass', ' class="error"') ?>><?php echo _("Password"); ?></label></td>
     21        <td class="sc-right"><label for="userpass" class="<?php $fv->err('userpass'); ?>"><?php echo _("Password"); ?></label></td>
    2222        <td>
    2323            <input type="password" class="sc-small" size="50" name="userpass" value="<?php echo oTxt($frm['userpass']); ?>" />
     
    2525    </tr>
    2626    <tr>
    27         <td class="sc-right"><label for="first_name"<?php $fv->err('first_name', ' class="error"') ?>><?php echo _("First name"); ?></label></td>
     27        <td class="sc-right"><label for="first_name" class="<?php $fv->err('first_name'); ?>"><?php echo _("First name"); ?></label></td>
    2828        <td>
    2929            <input type="text" class="sc-small" size="50" name="first_name" value="<?php echo oTxt($frm['first_name']); ?>" />
     
    3131    </tr>
    3232    <tr>
    33         <td class="sc-right"><label for="last_name"<?php $fv->err('last_name', ' class="error"') ?>><?php echo _("Last name"); ?></label></td>
     33        <td class="sc-right"><label for="last_name" class="<?php $fv->err('last_name'); ?>"><?php echo _("Last name"); ?></label></td>
    3434        <td>
    3535            <input type="text" class="sc-small" size="50" name="last_name" value="<?php echo oTxt($frm['last_name']); ?>" />
     
    3737    </tr>
    3838    <tr>
    39         <td class="sc-right"><label for="email"<?php $fv->err('email', ' class="error"') ?>><?php echo _("Email"); ?></label></td>
     39        <td class="sc-right"><label for="email" class="<?php $fv->err('email'); ?>"><?php echo _("Email"); ?></label></td>
    4040        <td>
    4141            <input type="text" class="sc-medium" size="50" name="email" value="<?php echo oTxt($frm['email']); ?>" />
     
    4343    </tr>
    4444    <tr>
    45         <td class="sc-right"><label for="user_type"<?php $fv->err('user_type', ' class="error"') ?>><?php echo _("User type"); ?></label></td>
     45        <td class="sc-right"><label for="user_type" class="<?php $fv->err('user_type'); ?>"><?php echo _("User type"); ?></label></td>
    4646        <td>
    4747            <select name="user_type" class="sc-small">
  • trunk/services/templates/password.ihtml

    r185 r235  
    66<table>
    77    <tr>
    8         <td class="sc-right"><label for="oldpassword"<?php $fv->err('oldpassword', ' class="error"') ?>><?php echo _("Old password"); ?></label></td>
     8        <td class="sc-right"><label for="oldpassword" class="<?php $fv->err('oldpassword'); ?>"><?php echo _("Old password"); ?></label></td>
    99        <td>
    1010            <input type="password" class="sc-medium" size="50" name="oldpassword" />
     
    1212    </tr>
    1313    <tr>
    14         <td class="sc-right"><label for="newpassword"<?php $fv->err('newpassword', ' class="error"') ?>><?php echo _("New password"); ?></label></td>
     14        <td class="sc-right"><label for="newpassword" class="<?php $fv->err('newpassword'); ?>"><?php echo _("New password"); ?></label></td>
    1515        <td>
    1616            <input type="password" class="sc-medium" size="50" name="newpassword" />
     
    1818    </tr>
    1919    <tr>
    20         <td class="sc-right"><label for="newpassword2"<?php $fv->err('newpassword2', ' class="error"') ?>><?php echo _("New password again"); ?></label></td>
     20        <td class="sc-right"><label for="newpassword2" class="<?php $fv->err('newpassword2'); ?>"><?php echo _("New password again"); ?></label></td>
    2121        <td>
    2222            <input type="password" class="sc-medium" size="50" name="newpassword2" />
Note: See TracChangeset for help on using the changeset viewer.