Move update_operator_permissions function to libs/operator.php

This commit is contained in:
Dmitriy Simushev 2013-04-26 09:39:39 +00:00
parent a31cdfce24
commit a23d9fa216
2 changed files with 13 additions and 9 deletions

View File

@ -53,6 +53,19 @@ function permission_ids() {
); );
} }
/**
* Set new permissions to operator
* @param int $operator_id Operator ID
* @param int $perm New permissions value
*/
function update_operator_permissions($operator_id, $perm) {
$db = Database::getInstance();
$db->query(
"update {chatoperator} set iperm = ? where operatorid = ?",
array($perm, $operator_id)
);
}
function operator_by_login($login) function operator_by_login($login)
{ {
$db = Database::getInstance(); $db = Database::getInstance();

View File

@ -22,15 +22,6 @@ require_once('../libs/operator_settings.php');
$operator = check_login(); $operator = check_login();
csrfchecktoken(); csrfchecktoken();
function update_operator_permissions($operatorid, $newvalue)
{
$db = Database::getInstance();
$db->query(
"update {chatoperator} set iperm = ? where operatorid = ?",
array($newvalue, $operatorid)
);
}
$opId = verifyparam("op", "/^\d{1,9}$/"); $opId = verifyparam("op", "/^\d{1,9}$/");
$page = array('opid' => $opId, 'canmodify' => is_capable(CAN_ADMINISTRATE, $operator) ? "1" : ""); $page = array('opid' => $opId, 'canmodify' => is_capable(CAN_ADMINISTRATE, $operator) ? "1" : "");
$errors = array(); $errors = array();