Changeset 432 for trunk/services/admins.php
- Timestamp:
- Nov 2, 2013 11:44:56 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/services/admins.php
r408 r432 66 66 $so->setColumn('last_name', $auth->getParam('db_table') . '.last_name ASC', $auth->getParam('db_table') . '.last_name DESC'); 67 67 $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');69 68 $so->setColumn('seconds_online', $auth->getParam('db_table') . '.seconds_online ASC', $auth->getParam('db_table') . '.seconds_online DESC'); 70 69 $so->setColumn('last_login_datetime', $auth->getParam('db_table') . '.last_login_datetime ASC', $auth->getParam('db_table') . '.last_login_datetime DESC'); … … 230 229 } 231 230 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 236 231 $fv->numericRange('admin_id', -32768, 32767, _("<strong>Admin id</strong> must be a valid number between -32768 and 32767.")); 237 232 … … 249 244 $fv->stringLength('email', 0, 255, _("<strong>Email</strong> must contain less than 256 characters.")); 250 245 $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."));254 246 } 255 247 … … 265 257 'last_name' => '', 266 258 'email' => '', 267 'user_type' => '',268 259 'seconds_online' => '0', 269 260 'last_login_datetime' => '0000-00-00 00:00:00', … … 322 313 'last_name' => '', 323 314 'email' => '', 324 'user_type' => '',325 315 'seconds_online' => '0', 326 316 'last_login_datetime' => '0000-00-00 00:00:00', … … 362 352 // Get the information for this object. 363 353 $qid = $db->query(" 364 SELECT " . $auth->getParam('db_username_column') . " , user_type from " . $auth->getParam('db_table') . "354 SELECT " . $auth->getParam('db_username_column') . " 365 355 WHERE " . $auth->getParam('db_primary_key') . " = '" . $db->escapeString($id) . "' 366 356 "); 367 if (! list($name , $user_type) = mysql_fetch_row($qid)) {357 if (! list($name) = mysql_fetch_row($qid)) { 368 358 $app->logMsg('Could not find record with admin_id: ' . $id, LOG_WARNING, __FILE__, __LINE__); 369 359 $app->raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__); … … 374 364 $qid = $db->query("SELECT COUNT(*) from " . $auth->getParam('db_table') . ""); 375 365 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) { 380 367 // There must always be at least one admnistrator! 381 368 $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__); … … 410 397 last_name, 411 398 email, 412 user_type,413 399 added_by_user_id, 414 400 added_datetime … … 418 404 '" . $db->escapeString($frm['last_name']) . "', 419 405 '" . $db->escapeString($frm['email']) . "', 420 '" . $db->escapeString($frm['user_type']) . "',421 406 '" . $db->escapeString($auth->get('user_id')) . "', 422 407 NOW() … … 466 451 last_name = '" . $db->escapeString($frm['last_name']) . "', 467 452 email = '" . $db->escapeString($frm['email']) . "', 468 user_type = '" . $db->escapeString($frm['user_type']) . "',469 453 modified_by_user_id = '" . $db->escapeString($auth->get('user_id')) . "', 470 454 modified_datetime = NOW()
Note: See TracChangeset
for help on using the changeset viewer.