Changeset 19 for trunk/services


Ignore:
Timestamp:
Nov 14, 2005 6:22:44 AM (18 years ago)
Author:
scdev
Message:

Rebuilt the services/admins.php script and templates. Fixes since v2 conversion. Lots of bugs and more to come!

Location:
trunk/services
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/services/admins.php

    r18 r19  
    2121
    2222/******************************************************************************
    23  * CODE CONFIG
     23 * CONFIG
    2424 *****************************************************************************/
    2525 
     
    3131
    3232// Instantiate a sorting object with the default sort and order. Add SQL for each column.
    33 $so = new SortOrder('admin_id', 'DESC');
    34 $so->setColumn('admin_id', 'admin_id ASC', 'admin_id DESC');
    35 $so->setColumn('username', 'username ASC', 'username DESC');
    36 $so->setColumn('userpass', 'userpass ASC', 'userpass DESC');
    37 $so->setColumn('first_name', 'first_name ASC', 'first_name DESC');
    38 $so->setColumn('last_name', 'last_name ASC', 'last_name DESC');
    39 $so->setColumn('phone', 'phone ASC', 'phone DESC');
    40 $so->setColumn('email', 'email ASC', 'email DESC');
    41 $so->setColumn('priv', 'priv ASC', 'priv DESC');
    42 $so->setColumn('seconds_online', 'seconds_online ASC', 'seconds_online DESC');
    43 $so->setColumn('added_datetime', 'added_datetime ASC', 'added_datetime DESC');
    44 $so->setColumn('last_login_datetime', 'last_login_datetime ASC', 'last_login_datetime DESC');
    45 $so->setColumn('last_access_datetime', 'last_access_datetime ASC', 'last_access_datetime DESC');
    46 $so->setColumn('last_login_ip', 'last_login_ip ASC', 'last_login_ip DESC');
     33$so = new SortOrder('admin_tbl.admin_id', 'DESC');
     34$so->setColumn('admin_tbl.admin_id', 'admin_tbl.admin_id ASC', 'admin_tbl.admin_id DESC');
     35$so->setColumn('admin_tbl.username', 'admin_tbl.username ASC', 'admin_tbl.username DESC');
     36$so->setColumn('admin_tbl.userpass', 'admin_tbl.userpass ASC', 'admin_tbl.userpass DESC');
     37$so->setColumn('admin_tbl.first_name', 'admin_tbl.first_name ASC', 'admin_tbl.first_name DESC');
     38$so->setColumn('admin_tbl.last_name', 'admin_tbl.last_name ASC', 'admin_tbl.last_name DESC');
     39$so->setColumn('admin_tbl.email', 'admin_tbl.email ASC', 'admin_tbl.email DESC');
     40$so->setColumn('admin_tbl.user_type', 'admin_tbl.user_type ASC', 'admin_tbl.user_type DESC');
     41$so->setColumn('admin_tbl.seconds_online', 'admin_tbl.seconds_online ASC', 'admin_tbl.seconds_online DESC');
     42$so->setColumn('admin_tbl.last_login_datetime', 'admin_tbl.last_login_datetime ASC', 'admin_tbl.last_login_datetime DESC');
     43$so->setColumn('admin_tbl.last_access_datetime', 'admin_tbl.last_access_datetime ASC', 'admin_tbl.last_access_datetime DESC');
     44$so->setColumn('admin_tbl.last_login_ip', 'admin_tbl.last_login_ip ASC', 'admin_tbl.last_login_ip DESC');
     45$so->setColumn('admin_tbl.added_by_user_id', 'admin_tbl.added_by_user_id ASC', 'admin_tbl.added_by_user_id DESC');
     46$so->setColumn('admin_tbl.modified_by_user_id', 'admin_tbl.modified_by_user_id ASC', 'admin_tbl.modified_by_user_id DESC');
     47$so->setColumn('admin_tbl.added_datetime', 'admin_tbl.added_datetime ASC', 'admin_tbl.added_datetime DESC');
     48$so->setColumn('admin_tbl.modified_datetime', 'admin_tbl.modified_datetime ASC', 'admin_tbl.modified_datetime DESC');
    4749
    4850// Instantiate page numbers. Total items are set and calculation is done in the getRecordList function.
     
    192194
    193195    // If the username was changed during edit, verify.
    194     if (getFormData('priv') == 'root' && 'root' != $auth->getVal('priv')) {
    195         $fv->addError('priv', sprintf(_("You do not have clearance to create a user with root privileges."), null));
     196    if (getFormData('user_type') == 'root' && 'root' != $auth->getVal('user_type')) {
     197        $fv->addError('user_type', sprintf(_("You do not have clearance to create a user with root privileges."), null));
    196198    }
    197199
     
    207209   
    208210    $fv->stringLength('last_name', 0, 255, _("<strong>Last name</strong> must contain less than 256 characters."));
    209    
    210     $fv->stringLength('phone', 0, 255, _("<strong>Phone</strong> must contain less than 256 characters."));
    211     $fv->validatePhone('phone');
    212    
     211
     212    $fv->isEmpty('email', _("<strong>Email</strong> cannot be blank."));
    213213    $fv->stringLength('email', 0, 255, _("<strong>Email</strong> must contain less than 256 characters."));
    214214    $fv->validateEmail('email');
    215215   
    216     $fv->stringLength('county', 0, 255, _("<strong>County</strong> has an invalid selection."));
    217    
    218     $fv->stringLength('priv', 0, 255, _("<strong>Priv</strong> has an invalid selection."));
     216    $fv->isEmpty('user_type', _("<strong>User type</strong> cannot be blank."));
     217    $fv->stringLength('user_type', 0, 255, _("<strong>User type</strong> has an invalid selection."));
    219218}
    220219
    221220function &addRecordForm()
    222221{
    223     // set default values for the reset of the fields.
    224     $frm['priv'] = 'admin';
    225     $frm['new_op'] = 'insert';
    226     $frm['submit_caption'] = _("Add admin");
    227     $frm['repeat_caption'] = _("Add &amp; repeat");
    228     $frm['cancel_caption'] = _("Cancel");
     222    // Set default values for the reset of the fields.
     223    $frm = array(
     224        'admin_id' => '',
     225        'username' => '',
     226        'userpass' => '',
     227        'first_name' => '',
     228        'last_name' => '',
     229        'email' => '',
     230        'user_type' => '',
     231        'seconds_online' => '0',
     232        'last_login_datetime' => '0000-00-00 00:00:00',
     233        'last_access_datetime' => '0000-00-00 00:00:00',
     234        'last_login_ip' => '0.0.0.0',
     235        'added_by_user_id' => '',
     236        'modified_by_user_id' => '',
     237        'added_datetime' => '0000-00-00 00:00:00',
     238        'modified_datetime' => '0000-00-00 00:00:00',
     239        'new_op' => 'insert',
     240        'submit_buttons' => array(
     241            'submit' => _("Add Admin"),
     242            'repeat' => _("Add &amp; repeat"),
     243            'cancel' => _("Cancel"),
     244        ),
     245    );
    229246
    230247    return $frm;
     
    237254    if ($lock->isLocked() && !$lock->isMine()) {
    238255        $lock->dieErrorPage();
    239     } else {
    240         // Get the information for the form.
    241         $qid = DB::query("
    242             SELECT * from admin_tbl
    243             WHERE admin_id = '" . addslashes($id) . "'
    244         ");
    245         if (!$frm = mysql_fetch_assoc($qid)) {
    246             App::logMsg('Could not find record with admin_id: ' . $id, LOG_WARNING, __FILE__, __LINE__);
    247             App::raiseMsg(sprintf(_("The requested record %s could not be found"), $id), MSG_ERR, __FILE__, __LINE__);
    248             App::dieBoomerangURL();
    249         }
    250        
    251         // Lock this record.
    252         $lock->set('admin_tbl', 'admin_id', $id, $frm['address']);
    253        
    254         // Set misc values for the form.
    255         $frm['old_username'] = $frm['username'];
    256         $frm['userpass'] = '***************';
    257         $frm['new_op'] = 'update';
    258         $frm['submit_caption'] = _("Save changes");
    259         $frm['repeat_caption'] = _("Save &amp; edit next");
    260         $frm['reset_caption']  = _("Reset");
    261         $frm['cancel_caption'] = _("Cancel");
    262         $frm['admin_id'] = $id;
    263    
    264         return $frm;
    265     }
     256    }
     257
     258    // Get the information for the form.
     259    $qid = DB::query("
     260        SELECT *
     261        FROM admin_tbl
     262        WHERE admin_id = '" . addslashes($id) . "'
     263    ");
     264    if (!$frm = mysql_fetch_assoc($qid)) {
     265        App::logMsg('Could not find record with admin_id: ' . $id, LOG_WARNING, __FILE__, __LINE__);
     266        App::raiseMsg(sprintf(_("The requested record %s could not be found"), $id), MSG_ERR, __FILE__, __LINE__);
     267        App::dieBoomerangURL();
     268    }
     269   
     270    // Lock this record.
     271    $lock->set('admin_tbl', 'admin_id', $id, $frm['username']);
     272   
     273    // Set misc values for the form.
     274    $frm = array_merge(array(
     275        'admin_id' => '',
     276        'old_username' => $frm['username'],
     277        'username' => '',
     278//         'userpass' => '****************',
     279        'first_name' => '',
     280        'last_name' => '',
     281        'email' => '',
     282        'user_type' => '',
     283        'seconds_online' => '0',
     284        'last_login_datetime' => '0000-00-00 00:00:00',
     285        'last_access_datetime' => '0000-00-00 00:00:00',
     286        'last_login_ip' => '0.0.0.0',
     287        'added_by_user_id' => '',
     288        'modified_by_user_id' => '',
     289        'added_datetime' => '0000-00-00 00:00:00',
     290        'modified_datetime' => '0000-00-00 00:00:00',
     291        'new_op' => 'update',
     292        'submit_buttons' => array(
     293            'submit' => _("Save changes"),
     294            'repeat' => _("Save &amp; edit next"),
     295            'reset' => _("Reset"),
     296            'cancel' => _("Cancel"),
     297        ),
     298    ), $frm, array('userpass' => '****************'));
     299
     300    return $frm;
    266301}
    267302
     
    280315        // Get the information for this object.
    281316        $qid = DB::query("
    282             SELECT username, priv from admin_tbl
     317            SELECT username, user_type from admin_tbl
    283318            WHERE admin_id = '" . addslashes($id) . "'
    284319        ");
    285         if (! list($name, $priv) = mysql_fetch_row($qid)) {
     320        if (! list($name, $user_type) = mysql_fetch_row($qid)) {
    286321            App::logMsg('Could not find record with admin_id: ' . $id, LOG_WARNING, __FILE__, __LINE__);
    287322            App::raiseMsg(sprintf(_("The requested record %s could not be found"), $id), MSG_ERR, __FILE__, __LINE__);
     
    292327        $qid = DB::query("SELECT COUNT(*) from admin_tbl");
    293328        list($num_admins) = mysql_fetch_row($qid);
    294         if ('root' == $priv && 'root' != $auth->getVal('priv')) {
     329        if ('root' == $user_type && 'root' != $auth->getVal('user_type')) {
    295330            // Only root users can delete root users!
    296331            App::raiseMsg(_("You do not have clearance to delete a root administrator."), MSG_NOTICE, __FILE__, __LINE__);
     
    325360            first_name,
    326361            last_name,
    327             phone,
    328362            email,
    329             priv,
     363            user_type,
     364            added_by_user_id,
    330365            added_datetime
    331366        ) VALUES (
     
    333368            '" . addslashes($frm['first_name']) . "',
    334369            '" . addslashes($frm['last_name']) . "',
    335             '" . addslashes($frm['phone']) . "',
    336370            '" . addslashes($frm['email']) . "',
    337             '" . addslashes($frm['priv']) . "',
     371            '" . addslashes($frm['user_type']) . "',
     372            '" . addslashes($auth->getVal('user_id')) . "',
    338373            NOW()
    339374        )
     
    344379    $auth->setPassword($last_insert_id, $frm['userpass']);
    345380   
    346     App::raiseMsg(sprintf(_("The admin <strong>%s</strong> has been added."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
     381    // Create version.
     382    $version = new RecordVersion($GLOBALS['auth']);
     383    $version->create('admin_tbl', 'admin_id', $last_insert_id, $frm['username']);
     384   
     385    App::raiseMsg(sprintf(_("The Admin <strong>%s</strong> has been added."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
    347386   
    348387    return $last_insert_id;
     
    373412                first_name = '" . addslashes($frm['first_name']) . "',
    374413                last_name = '" . addslashes($frm['last_name']) . "',
    375                 phone = '" . addslashes($frm['phone']) . "',
    376414                email = '" . addslashes($frm['email']) . "',
    377                 priv = '" . addslashes($frm['priv']) . "'
     415                user_type = '" . addslashes($frm['user_type']) . "',
     416                modified_by_user_id = '" . addslashes($auth->getVal('user_id')) . "',
     417                modified_datetime = NOW()
    378418            WHERE admin_id = '" . addslashes($frm['admin_id']) . "'
    379419        ");
    380420
    381         App::raiseMsg(sprintf(_("The admin <strong>%s</strong> has been updated."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
     421        // Create version.
     422        $version = new RecordVersion($GLOBALS['auth']);
     423        $version->create('admin_tbl', 'admin_id', $frm['admin_id'], $frm['username']);
     424   
     425        App::raiseMsg(sprintf(_("The Admin <strong>%s</strong> has been updated."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
    382426
    383427        // Unlock record.
     
    391435    global $so;
    392436   
    393     // Build search query if $qry is not empty.
    394     $sql_delim = 'WHERE';
    395     $search_where_clause = '';
    396     $qry = getFormData('search_query');
    397     if (!empty($qry)) {
    398         $qry_words = preg_split('/[^\w]/', $qry);
     437    $where_clause = '';
     438   
     439    // Build search query if available.
     440    if (getFormData('search_query', false)) {
     441        $qry_words = preg_split('/[^\w]/', getFormData('search_query'));
    399442        for ($i=0; $i<sizeof($qry_words); $i++) {
    400             $search_where_clause .= "
    401                 $sql_delim (
    402                     username LIKE '%" . addslashes($qry_words[$i]) . "%'
    403                     OR first_name LIKE '%" . addslashes($qry_words[$i]) . "%'
    404                     OR last_name LIKE '%" . addslashes($qry_words[$i]) . "%'
    405                     OR phone LIKE '%" . addslashes($qry_words[$i]) . "%'
    406                     OR email LIKE '%" . addslashes($qry_words[$i]) . "%'
    407                     OR priv LIKE '%" . addslashes($qry_words[$i]) . "%'
     443            $where_clause .= (empty($where_clause) ? 'WHERE' : 'AND') . "
     444                (
     445                    admin_tbl.username LIKE '%" . addslashes($qry_words[$i]) . "%'
     446                    OR admin_tbl.first_name LIKE '%" . addslashes($qry_words[$i]) . "%'
     447                    OR admin_tbl.last_name LIKE '%" . addslashes($qry_words[$i]) . "%'
     448                    OR admin_tbl.email LIKE '%" . addslashes($qry_words[$i]) . "%'
    408449                )
    409450            ";
    410             $sql_delim = 'AND';
    411         }
    412     }
    413    
    414     $where_clause = '';
     451        }
     452    }
     453
    415454    if (getFormData('search_query', false)) {
    416455        // Search query.
    417456        $where_clause = $search_where_clause;
    418457    }
    419     if (getFormData('filter_admin_priv', false)) {
     458    if (getFormData('filter_admin_user_type', false)) {
    420459        // Limit by filter.
    421         $where_clause .= (empty($where_clause) ? 'WHERE' : 'AND') . " priv = '" . addslashes(getFormData('filter_admin_priv')) . "'";
     460        $where_clause .= (empty($where_clause) ? 'WHERE' : 'AND') . " user_type = '" . addslashes(getFormData('filter_admin_user_type')) . "'";
    422461    }
    423462
    424463    // Count the total number of records so we can do something about the page numbers.
    425     $qid = DB::query("SELECT COUNT(*) FROM admin_tbl $where_clause");
     464    $qid = DB::query("
     465        SELECT COUNT(*)
     466        FROM admin_tbl
     467        $where_clause
     468    ");
    426469    list($num_results) = mysql_fetch_row($qid);
    427470   
     
    432475    // Final SQL, with sort and page limiters.
    433476    $sql = "
    434         SELECT * FROM admin_tbl
     477        SELECT
     478            admin_tbl.*,
     479            a1.username AS added_admin_username,
     480            a2.username AS modified_admin_username
     481        FROM admin_tbl
     482        LEFT JOIN admin_tbl a1 ON (admin_tbl.added_by_user_id = a1.admin_id)
     483        LEFT JOIN admin_tbl a2 ON (admin_tbl.modified_by_user_id = a2.admin_id)
    435484        $where_clause
    436485        " . $so->getSortOrderSQL() . "
     
    449498    }
    450499   
    451     if (SessionCache::isCached($_SERVER['PHP_SELF']) && FALSE) { ///
     500    if (SessionCache::isCached($_SERVER['PHP_SELF']) && false) {
    452501        // Get the cached results.
    453502        $list = SessionCache::getCache($_SERVER['PHP_SELF']);
     
    460509        }
    461510           
    462         // Cache the results.
    463         SessionCache::putCache($list, $_SERVER['PHP_SELF']);
     511        if (isset($list) && !empty($list)) {
     512            // Cache the results.
     513            SessionCache::putCache($list, $_SERVER['PHP_SELF']);
     514        }
    464515    }
    465516
  • trunk/services/templates/admin_form.ihtml

    r18 r19  
    77<input type="hidden" name="old_username" value="<?php echo $frm['old_username']; ?>">
    88
    9 <table border="0" cellspacing="0" cellpadding="4">
     9<table>
    1010    <tr>
    11         <td class="formlabel" align="right" valign="top">&nbsp;</td>
    12         <td valign="top">
    13         <?php if (!empty($frm['submit_caption'])) { ?><input type="submit" class="formsubmitbutton" name="submit" value="<?php echo oTxt($frm['submit_caption']); ?>" /><?php } ?>
    14         <?php if (!empty($frm['repeat_caption'])) { ?><input type="submit" class="formsubmitbutton" name="repeat" value="<?php echo oTxt($frm['repeat_caption']); ?>" /><?php } ?>
    15         <?php if (!empty($frm['reset_caption'])) { ?><input type="submit" class="formsubmitbutton" name="reset" value="<?php echo oTxt($frm['reset_caption']); ?>" /><?php } ?>
    16         <?php if (!empty($frm['cancel_caption'])) { ?><input type="submit" class="formsubmitbutton" name="cancel" value="<?php echo oTxt($frm['cancel_caption']); ?>" /><?php } ?>
    17         </td>
     11        <td>&nbsp;</td>
     12        <td valign="top"><?php printSubmitButtons($frm['submit_buttons']); ?></td>
    1813    </tr>
    1914    <tr>
    20         <td class="formlabel" align="right" valign="top"<?php $fv->err('username', ' style="color:#f33;"') ?>><?php echo _("Username"); ?></td>
     15        <td class="formlabel" align="right" valign="top"<?php $fv->err('username', ' class="error"') ?>><?php echo _("Username"); ?></td>
    2116        <td valign="top">
    2217            <input type="text" class="forminputtext" size="50" name="username" value="<?php echo oTxt($frm['username']); ?>">
     
    2419    </tr>
    2520    <tr>
    26         <td class="formlabel" align="right" valign="top"<?php $fv->err('userpass', ' style="color:#f33;"') ?>><?php echo _("Password"); ?></td>
     21        <td class="formlabel" align="right" valign="top"<?php $fv->err('userpass', ' class="error"') ?>><?php echo _("Password"); ?></td>
    2722        <td valign="top">
    2823            <input type="password" class="forminputtext" size="50" name="userpass" value="<?php echo oTxt($frm['userpass']); ?>">
     
    3025    </tr>
    3126    <tr>
    32         <td class="formlabel" align="right" valign="top"<?php $fv->err('first_name', ' style="color:#f33;"') ?>><?php echo _("First name"); ?></td>
     27        <td class="formlabel" align="right" valign="top"<?php $fv->err('first_name', ' class="error"') ?>><?php echo _("First name"); ?></td>
    3328        <td valign="top">
    3429            <input type="text" class="forminputtext" size="50" name="first_name" value="<?php echo oTxt($frm['first_name']); ?>">
     
    3631    </tr>
    3732    <tr>
    38         <td class="formlabel" align="right" valign="top"<?php $fv->err('last_name', ' style="color:#f33;"') ?>><?php echo _("Last name"); ?></td>
     33        <td class="formlabel" align="right" valign="top"<?php $fv->err('last_name', ' class="error"') ?>><?php echo _("Last name"); ?></td>
    3934        <td valign="top">
    4035            <input type="text" class="forminputtext" size="50" name="last_name" value="<?php echo oTxt($frm['last_name']); ?>">
     
    4237    </tr>
    4338    <tr>
    44         <td class="formlabel" align="right" valign="top"<?php $fv->err('phone', ' style="color:#f33;"') ?>><?php echo _("Phone"); ?></td>
    45         <td valign="top">
    46             <input type="text" class="forminputtext" size="50" name="phone" value="<?php echo oTxt($frm['phone']); ?>">
    47         </td>
    48     </tr>
    49     <tr>
    50         <td class="formlabel" align="right" valign="top"<?php $fv->err('email', ' style="color:#f33;"') ?>><?php echo _("Email"); ?></td>
     39        <td class="formlabel" align="right" valign="top"<?php $fv->err('email', ' class="error"') ?>><?php echo _("Email"); ?></td>
    5140        <td valign="top">
    5241            <input type="text" class="forminputtext" size="50" name="email" value="<?php echo oTxt($frm['email']); ?>">
     
    5443    </tr>
    5544    <tr>
    56         <td class="formlabel" align="right" valign="top"<?php $fv->err('priv', ' style="color:#f33;"') ?>><?php echo _("Priv"); ?></td>
     45        <td class="formlabel" align="right" valign="top"<?php $fv->err('user_type', ' class="error"') ?>><?php echo _("User type"); ?></td>
    5746        <td valign="top">
    58             <select name="priv">
    59             <?php printSetSelectForm('admin_tbl', 'priv', $frm['priv'], true); ?>
     47            <select name="user_type">
     48            <?php printSetSelectForm('admin_tbl', 'user_type', $frm['user_type'], true); ?>
    6049            </select>
    6150        </td>
    6251    </tr>
    6352    <tr>
    64         <td class="formlabel" align="right" valign="top">&nbsp;</td>
    65         <td valign="top">
    66         <?php if (!empty($frm['submit_caption'])) { ?><input type="submit" class="formsubmitbutton" name="submit" value="<?php echo oTxt($frm['submit_caption']); ?>" /><?php } ?>
    67         <?php if (!empty($frm['repeat_caption'])) { ?><input type="submit" class="formsubmitbutton" name="repeat" value="<?php echo oTxt($frm['repeat_caption']); ?>" /><?php } ?>
    68         <?php if (!empty($frm['reset_caption'])) { ?><input type="submit" class="formsubmitbutton" name="reset" value="<?php echo oTxt($frm['reset_caption']); ?>" /><?php } ?>
    69         <?php if (!empty($frm['cancel_caption'])) { ?><input type="submit" class="formsubmitbutton" name="cancel" value="<?php echo oTxt($frm['cancel_caption']); ?>" /><?php } ?>
    70         </td>
     53        <td>&nbsp;</td>
     54        <td valign="top"><?php printSubmitButtons($frm['submit_buttons']); ?></td>
    7155    </tr>
    7256</table>
  • trunk/services/templates/admin_list.ihtml

    r18 r19  
    22<?php $fv->printErrorMessages(); ?>
    33<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    4 <?php $carry_queries = array('search_query', 'filter_admin_priv'); ?>
     4<?php $carry_queries = array('search_query', 'filter_admin_user_type'); ?>
    55<?php App::printHiddenSession(false); ?>
    66<div id="commandbox">
     
    88    <br />
    99   
    10     <input type="text" class="forminputtext" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" title="<?php echo oTxt(_("Fields searched: username, first & last name, phone, email, county.")); ?>" />
    11     <input type="submit" name="list" value="<?php echo _("Search"); ?>" class="formsubmitbutton" />
    12    
    13 <!--     <select name="filter_admin_priv"> -->
    14 <!--     <?php printSetSelectForm('admin_tbl', 'filter_admin_priv', getFormData('filter_admin_priv'), true); ?> -->
    15 <!--     </select> -->
    16 <!--     <input type="submit" name="list" value="Filter by privilege" class="formsubmitbutton"> -->
     10    <input type="text" class="forminputtext" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" title="<?php echo oTxt(_("Fields searched: Admin id, Username, Userpass, First name, Last name, Email, User type, Login abuse exempt, Blocked, Blocked reason, Abuse warning level, Seconds online, Last login datetime, Last access datetime, Last login ip, Added by user id, Modified by user id, Added datetime, Modified datetime.")); ?>" />
     11<!--
     12    <select name="filter_<##>">
     13        <?php // printSelectForm('<##>_tbl', "CONCAT(<##>_id, '&mdash;', city, '&mdash;', title)", '<##>_id', getFormData('filter_<##>'), array('Any <##>'), 'ORDER BY <##> ASC'); ?>
     14    </select>
     15 -->
     16    <input type="submit" name="list" value="<?php echo _("Search"); ?>" />
    1717</div>
    1818
    1919<?php include 'list_info.ihtml'; ?>
    2020
    21 <table class="list" border="0" cellpadding="2" cellspacing="0">
     21<table class="list">
    2222    <tr>
    23         <th class="padleft">&nbsp;</th>
    24         <th class="padleft"><?php $so->printSortHeader('admin_id', _("ID"), 'ASC'); ?></th>
    25         <th class="padleft"><?php $so->printSortHeader('username', _("Username"), 'ASC'); ?></th>
    26         <th class="padleft"><?php $so->printSortHeader('first_name', _("First"), 'ASC'); ?>
    27             <?php $so->printSortHeader('last_name', _("Last name"), 'ASC'); ?></th>
    28         <th class="padleft"><?php $so->printSortHeader('last_access_datetime', _("Logged-in"), 'DESC'); ?></th>
    29         <th class="padleft"><?php $so->printSortHeader('seconds_online', _("Total min logged-in"), 'DESC'); ?></th>
    30         <th class="padleft"><?php $so->printSortHeader('last_login_ip', _("Last remote addr"), 'ASC'); ?></th>
    31         <th class="padleft">&nbsp;</th>
     23        <th>&nbsp;</th>
     24        <th>&nbsp;</th>
     25        <th><?php echo $so->printSortHeader('admin_tbl.admin_id', _("ID"), 'ASC'); ?></th>
     26        <th><?php echo $so->printSortHeader('admin_tbl.username', _("Username"), 'ASC'); ?></th>
     27        <th><?php echo $so->printSortHeader('admin_tbl.first_name', _("First"), 'ASC'); ?> <?php echo $so->printSortHeader('admin_tbl.last_name', _("Last name"), 'ASC'); ?></th>
     28        <th><?php echo $so->printSortHeader('admin_tbl.email', _("Email"), 'ASC'); ?></th>
     29        <th><?php echo $so->printSortHeader('admin_tbl.user_type', _("User type"), 'ASC'); ?></th>
     30        <th><?php echo $so->printSortHeader('admin_tbl.seconds_online', _("Min online"), 'ASC'); ?></th>
     31        <th><?php echo $so->printSortHeader('admin_tbl.last_login_datetime', _("Last login"), 'ASC'); ?></th>
     32        <th><?php echo $so->printSortHeader('admin_tbl.last_login_ip', _("Remote host"), 'ASC'); ?></th>
     33        <th><?php echo $so->printSortHeader('admin_tbl.added_datetime', _("Added"), 'ASC'); ?></th>
     34        <th><?php echo $so->printSortHeader('admin_tbl.added_by_user_id', _("by admin"), 'ASC'); ?></th>
     35        <th><?php echo $so->printSortHeader('admin_tbl.modified_datetime', _("Last modified"), 'ASC'); ?></th>
     36        <th>&nbsp;</th>
    3237    </tr>
    33     <?php for ($i = 0; $i <= $page->last_item - $page->first_item && $page->total_items; $i++) { ?>
     38    <?php for ($i = 0; $i <= $page->last_item - $page->first_item && $page->total_items > 0; $i++) { ?>
    3439    <tr>
    35         <td class="padleft nowrap">
    36             <a title="<?php printf(_("Edit %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo App::oHREF('/admin/admins.php?op=edit&admin_id=' . $list[$i]['admin_id']); ?>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0"></a>
    37         </td>
    38         <td class="padleft nowrap"><?php echo $list[$i]['admin_id']; ?> &nbsp;</td>
    39         <td class="padleft nowrap"><?php echo oTxt($list[$i]['username']); ?> &nbsp;</td>
    40         <td class="padleft nowrap"><a href="mailto:<?php echo oTxt($list[$i]['email']); ?>"><?php echo oTxt($list[$i]['first_name']); ?>
    41             <?php echo oTxt($list[$i]['last_name']); ?></a> &nbsp;</td>
    42         <td class="padleft nowrap"><a href="#" style="text-decoration:none;" title="<?php printf(_("Last accessed %s"), $list[$i]['last_access_datetime']) ?>"><?php echo $auth->isLoggedIn($list[$i]['admin_id']) ? '<strong>' . _("yes") . '</strong>' : _("no"); ?></a>  &nbsp;</td>
    43         <td class="padleft nowrap"><?php echo round($list[$i]['seconds_online'] / 60); ?> &nbsp;</td>
    44         <td class="padleft nowrap"><?php echo gethostbyaddr($list[$i]['last_login_ip']); ?> &nbsp;</td>
    45         <td class="padleft right nowrap">
    46             <a title="<?php printf(_("Delete %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo App::oHREF('/admin/admins.php?op=del&admin_id=' . $list[$i]['admin_id']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to delete %s? This action is permanent and cannot be undone."), oTxt($list[$i]['username'])) ?>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0"></a>
    47         </td>
     40        <td class="padleft nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . $list[$i]['admin_id']); ?>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0"></a> &nbsp;</td>
     41        <td class="padleft nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo App::oHREF('/admin/versions.php?record_table=admin_tbl&record_key=admin_id&boomerang=true&record_val=' . $list[$i]['admin_id']); ?>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
     42        <td class="nowrap"><?php echo oTxt($list[$i]['admin_id'], true); ?> &nbsp;</td>
     43        <td class="nowrap"><?php echo oTxt($list[$i]['username'], true); ?> &nbsp;</td>
     44        <td class="nowrap"><?php echo oTxt($list[$i]['first_name'], true); ?> <?php echo oTxt($list[$i]['last_name'], true); ?> &nbsp;</td>
     45        <td class="nowrap"><?php echo oTxt($list[$i]['email'], true); ?> &nbsp;</td>
     46        <td class="nowrap"><?php echo oTxt($list[$i]['user_type'], true); ?> &nbsp;</td>
     47        <td class="nowrap"><?php echo round($list[$i]['seconds_online'] / 60); ?> &nbsp;</td>
     48        <td class="nowrap"><?php echo '0000-00-00 00:00:00' == $list[$i]['last_login_datetime'] ? '' : date(App::getParam('date_format'), strtotime($list[$i]['last_login_datetime'])); ?> &nbsp;</td>
     49        <td class="nowrap"><?php echo gethostbyaddr($list[$i]['last_login_ip']); ?> &nbsp;</td>
     50        <td class="nowrap"><?php echo '0000-00-00 00:00:00' == $list[$i]['added_datetime'] ? '' : date(App::getParam('date_format'), strtotime($list[$i]['added_datetime'])); ?> &nbsp;</td>
     51        <td class="nowrap"><?php echo oTxt($list[$i]['added_admin_username'], true); ?> &nbsp;</td>
     52        <td class="nowrap"><?php echo '0000-00-00 00:00:00' == $list[$i]['modified_datetime'] ? '' : date(App::getParam('date_format'), strtotime($list[$i]['modified_datetime'])); ?> &nbsp;</td>
     53        <td class="padleft nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . "?op=del&admin_id=" . $list[$i]['admin_id']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt($list[$i]['username'])) ?>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0"></a> &nbsp;</td>
    4854    </tr>
    4955    <?php } ?>
  • trunk/services/templates/passwd.ihtml

    r18 r19  
    66<table border="0" cellspacing="0" cellpadding="4">
    77    <tr>
    8         <td class="formlabel" align="right" valign="top"<?php $fv->err('oldpassword', ' style="color:#f33;"') ?>><?php echo _("Old password"); ?></td>
     8        <td class="formlabel" align="right" valign="top"<?php $fv->err('oldpassword', ' class="error"') ?>><?php echo _("Old password"); ?></td>
    99        <td valign="top"><input type="password" class="forminputtext" size="25" name="oldpassword" /></td>
    1010    </tr>
    1111    <tr>
    12         <td class="formlabel" align="right" valign="top"<?php $fv->err('newpassword', ' style="color:#f33;"') ?>><?php echo _("New password"); ?></td>
     12        <td class="formlabel" align="right" valign="top"<?php $fv->err('newpassword', ' class="error"') ?>><?php echo _("New password"); ?></td>
    1313        <td valign="top"><input type="password" class="forminputtext" size="25" name="newpassword" /></td>
    1414    </tr>
    1515    <tr>
    16         <td class="formlabel" align="right" valign="top"<?php $fv->err('newpassword2', ' style="color:#f33;"') ?>><?php echo _("New password again"); ?></td>
     16        <td class="formlabel" align="right" valign="top"<?php $fv->err('newpassword2', ' class="error"') ?>><?php echo _("New password again"); ?></td>
    1717        <td valign="top"><input type="password" class="forminputtext" size="25" name="newpassword2" /></td>
    1818    </tr>
  • trunk/services/versions.php

    r18 r19  
    1717 *****************************************************************************/
    1818
    19 $version = new RecordVersion();
     19$version = new RecordVersion($GLOBALS['auth']);
    2020
    2121// These values must be kept across requests.
Note: See TracChangeset for help on using the changeset viewer.