Changeset 432


Ignore:
Timestamp:
Nov 2, 2013 11:44:56 PM (11 years ago)
Author:
anonymous
Message:

Removed all usage of 'user_type' from admin management; minor update to module maker.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/module_maker/_config.inc.php

    r396 r432  
    3939}
    4040
    41 // Set include path.
    42 ini_set('include_path',
    43       PATH_SEPARATOR . '/usr/lib/php'
    44     . PATH_SEPARATOR . COMMON_BASE
    45 );
     41// Set include path for all templates and libraries.
     42ini_set('include_path', join(PATH_SEPARATOR, array(
     43    COMMON_BASE,
     44    get_include_path(),
     45)));
    4646
    4747// Include core libraries.
  • trunk/docs/examples/_config.inc.php

    r396 r432  
    8282
    8383    'display_errors' => true,
     84    'error_reporting' => E_ALL & ~E_DEPRECATED & ~E_STRICT,
    8485
    8586    'log_directory' => COMMON_BASE . '/log',
  • trunk/lib/Auth_SQL.inc.php

    r421 r432  
    426426        }
    427427       
    428         // Convert 'priv' to 'user_type' nomenclature.
    429         if (isset($user_data['priv'])) {
    430             $user_data['user_type'] = $user_data['priv'];
    431         }
    432 
    433428        // Register authenticated session.
    434429        $_SESSION['_auth_sql'][$this->_ns] = array(
  • trunk/services/admins.php

    r408 r432  
    6666$so->setColumn('last_name', $auth->getParam('db_table') . '.last_name ASC', $auth->getParam('db_table') . '.last_name DESC');
    6767$so->setColumn('email', $auth->getParam('db_table') . '.email ASC', $auth->getParam('db_table') . '.email DESC');
    68 $so->setColumn('user_type', $auth->getParam('db_table') . '.user_type ASC', $auth->getParam('db_table') . '.user_type DESC');
    6968$so->setColumn('seconds_online', $auth->getParam('db_table') . '.seconds_online ASC', $auth->getParam('db_table') . '.seconds_online DESC');
    7069$so->setColumn('last_login_datetime', $auth->getParam('db_table') . '.last_login_datetime ASC', $auth->getParam('db_table') . '.last_login_datetime DESC');
     
    230229    }
    231230
    232     if (getFormData('user_type') == 'root' && 'root' != $auth->get('user_type')) {
    233         $fv->addError('user_type', sprintf(_("You do not have clearance to create a user with root privileges."), null));
    234     }
    235 
    236231    $fv->numericRange('admin_id', -32768, 32767, _("<strong>Admin id</strong> must be a valid number between -32768 and 32767."));
    237232
     
    249244    $fv->stringLength('email', 0, 255, _("<strong>Email</strong> must contain less than 256 characters."));
    250245    $fv->validateEmail('email');
    251 
    252     $fv->isEmpty('user_type', _("<strong>User type</strong> cannot be blank."));
    253     $fv->stringLength('user_type', 0, 255, _("<strong>User type</strong> has an invalid selection."));
    254246}
    255247
     
    265257        'last_name' => '',
    266258        'email' => '',
    267         'user_type' => '',
    268259        'seconds_online' => '0',
    269260        'last_login_datetime' => '0000-00-00 00:00:00',
     
    322313        'last_name' => '',
    323314        'email' => '',
    324         'user_type' => '',
    325315        'seconds_online' => '0',
    326316        'last_login_datetime' => '0000-00-00 00:00:00',
     
    362352    // Get the information for this object.
    363353    $qid = $db->query("
    364         SELECT " . $auth->getParam('db_username_column') . ", user_type from " . $auth->getParam('db_table') . "
     354        SELECT " . $auth->getParam('db_username_column') . "
    365355        WHERE " . $auth->getParam('db_primary_key') . " = '" . $db->escapeString($id) . "'
    366356    ");
    367     if (! list($name, $user_type) = mysql_fetch_row($qid)) {
     357    if (! list($name) = mysql_fetch_row($qid)) {
    368358        $app->logMsg('Could not find record with admin_id: ' . $id, LOG_WARNING, __FILE__, __LINE__);
    369359        $app->raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);
     
    374364    $qid = $db->query("SELECT COUNT(*) from " . $auth->getParam('db_table') . "");
    375365    list($num_admins) = mysql_fetch_row($qid);
    376     if ('root' == $user_type && 'root' != $auth->get('user_type')) {
    377         // Only root users can delete root users!
    378         $app->raiseMsg(_("You do not have clearance to delete a root administrator."), MSG_NOTICE, __FILE__, __LINE__);
    379     } else if ($num_admins <= 1) {
     366    if ($num_admins <= 1) {
    380367        // There must always be at least one admnistrator!
    381368        $app->raiseMsg(_("You cannot delete the only administrator in the database. There must be at least one to log in and create other users."), MSG_NOTICE, __FILE__, __LINE__);
     
    410397            last_name,
    411398            email,
    412             user_type,
    413399            added_by_user_id,
    414400            added_datetime
     
    418404            '" . $db->escapeString($frm['last_name']) . "',
    419405            '" . $db->escapeString($frm['email']) . "',
    420             '" . $db->escapeString($frm['user_type']) . "',
    421406            '" . $db->escapeString($auth->get('user_id')) . "',
    422407            NOW()
     
    466451            last_name = '" . $db->escapeString($frm['last_name']) . "',
    467452            email = '" . $db->escapeString($frm['email']) . "',
    468             user_type = '" . $db->escapeString($frm['user_type']) . "',
    469453            modified_by_user_id = '" . $db->escapeString($auth->get('user_id')) . "',
    470454            modified_datetime = NOW()
  • trunk/services/templates/admin_form.ihtml

    r296 r432  
    4343    </tr>
    4444    <tr class="sc-form-row">
    45         <td class="sc-right"><label for="user_type" class="<?php $fv->err('user_type'); ?>"><?php echo _("User type"); ?></label></td>
    46         <td>
    47             <select name="user_type" class="sc-small">
    48                 <?php printSetSelectForm($auth->getParam('db_table'), 'user_type', $frm['user_type'], true); ?>
    49             </select>
    50         </td>
    51     </tr>
    52     <tr class="sc-form-row">
    5345        <td>&nbsp;</td>
    5446        <td><?php printSubmitButtons($frm['submit_buttons']); ?></td>
  • trunk/services/templates/admin_list.ihtml

    r320 r432  
    2121        <th><?php echo $so->printSortHeader('admin_tbl.username', _("Username"), 'ASC'); ?></th>
    2222        <th><?php echo $so->printSortHeader('admin_tbl.first_name', _("First"), 'ASC'); ?> <?php echo $so->printSortHeader('admin_tbl.last_name', _("Last name"), 'ASC'); ?></th>
    23         <th><?php echo $so->printSortHeader('admin_tbl.user_type', _("User type"), 'ASC'); ?></th>
    2423        <th><?php echo $so->printSortHeader('admin_tbl.seconds_online', _("Min online"), 'ASC'); ?></th>
    2524        <th><?php echo $so->printSortHeader('admin_tbl.last_login_datetime', _("Last login"), 'ASC'); ?></th>
    2625        <th><?php echo $so->printSortHeader('admin_tbl.last_login_ip', _("Remote host"), 'ASC'); ?></th>
    2726        <th><?php echo $so->printSortHeader('admin_tbl.added_datetime', _("Added"), 'ASC'); ?></th>
    28         <th><?php echo $so->printSortHeader('admin_tbl.added_by_user_id', _("by admin"), 'ASC'); ?></th>
     27        <th><?php echo $so->printSortHeader('admin_tbl.added_by_user_id', _("by"), 'ASC'); ?></th>
    2928        <th><?php echo $so->printSortHeader('admin_tbl.modified_datetime', _("Last modified"), 'ASC'); ?></th>
     29        <th><?php echo $so->printSortHeader('admin_tbl.modified_by_user_id', _("by"), 'ASC'); ?></th>
    3030        <th>&nbsp;</th>
    3131    </tr>
     
    3737        <td class="sc-nowrap"><?php echo oTxt($list[$i]['username'], true); ?> &nbsp;</td>
    3838        <td class="sc-nowrap"><?php echo oTxt($list[$i]['first_name'], true); ?> <?php echo oTxt($list[$i]['last_name'], true); ?> &nbsp;</td>
    39         <td class="sc-nowrap"><?php echo oTxt($list[$i]['user_type'], true); ?> &nbsp;</td>
    4039        <td class="sc-nowrap"><?php echo round($list[$i]['seconds_online'] / 60); ?> &nbsp;</td>
    4140        <td class="sc-nowrap"><?php
     
    5049        <td class="sc-nowrap"><?php echo oTxt($list[$i]['added_admin_username'], true); ?> &nbsp;</td>
    5150        <td class="sc-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>
     51        <td class="sc-nowrap"><?php echo oTxt($list[$i]['modified_admin_username'], true); ?> &nbsp;</td>
    5252        <td class="sc-padleft sc-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/i/trash.gif" alt="Delete" width="10" height="10" border="0" /></a> &nbsp;</td>
    5353    </tr>
Note: See TracChangeset for help on using the changeset viewer.