mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-01 05:44:41 +03:00
use mysqlprefix in names of session vars
This commit is contained in:
parent
b18085de38
commit
e160af13ef
70
src/messenger/.idea/projectCodeStyle.xml
Normal file
70
src/messenger/.idea/projectCodeStyle.xml
Normal file
@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CodeStyleSettingsManager">
|
||||
<option name="PER_PROJECT_SETTINGS">
|
||||
<value>
|
||||
<ADDITIONAL_INDENT_OPTIONS fileType="js">
|
||||
<option name="INDENT_SIZE" value="4" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="8" />
|
||||
<option name="TAB_SIZE" value="4" />
|
||||
<option name="USE_TAB_CHARACTER" value="false" />
|
||||
<option name="SMART_TABS" value="false" />
|
||||
<option name="LABEL_INDENT_SIZE" value="0" />
|
||||
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
|
||||
<option name="USE_RELATIVE_INDENTS" value="false" />
|
||||
</ADDITIONAL_INDENT_OPTIONS>
|
||||
<ADDITIONAL_INDENT_OPTIONS fileType="php">
|
||||
<option name="INDENT_SIZE" value="4" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="8" />
|
||||
<option name="TAB_SIZE" value="4" />
|
||||
<option name="USE_TAB_CHARACTER" value="false" />
|
||||
<option name="SMART_TABS" value="false" />
|
||||
<option name="LABEL_INDENT_SIZE" value="0" />
|
||||
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
|
||||
<option name="USE_RELATIVE_INDENTS" value="false" />
|
||||
</ADDITIONAL_INDENT_OPTIONS>
|
||||
<ADDITIONAL_INDENT_OPTIONS fileType="sass">
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="8" />
|
||||
<option name="TAB_SIZE" value="4" />
|
||||
<option name="USE_TAB_CHARACTER" value="false" />
|
||||
<option name="SMART_TABS" value="false" />
|
||||
<option name="LABEL_INDENT_SIZE" value="0" />
|
||||
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
|
||||
<option name="USE_RELATIVE_INDENTS" value="false" />
|
||||
</ADDITIONAL_INDENT_OPTIONS>
|
||||
<ADDITIONAL_INDENT_OPTIONS fileType="sql">
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="8" />
|
||||
<option name="TAB_SIZE" value="4" />
|
||||
<option name="USE_TAB_CHARACTER" value="false" />
|
||||
<option name="SMART_TABS" value="false" />
|
||||
<option name="LABEL_INDENT_SIZE" value="0" />
|
||||
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
|
||||
<option name="USE_RELATIVE_INDENTS" value="false" />
|
||||
</ADDITIONAL_INDENT_OPTIONS>
|
||||
<ADDITIONAL_INDENT_OPTIONS fileType="xml">
|
||||
<option name="INDENT_SIZE" value="4" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="8" />
|
||||
<option name="TAB_SIZE" value="4" />
|
||||
<option name="USE_TAB_CHARACTER" value="false" />
|
||||
<option name="SMART_TABS" value="false" />
|
||||
<option name="LABEL_INDENT_SIZE" value="0" />
|
||||
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
|
||||
<option name="USE_RELATIVE_INDENTS" value="false" />
|
||||
</ADDITIONAL_INDENT_OPTIONS>
|
||||
<ADDITIONAL_INDENT_OPTIONS fileType="yml">
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="8" />
|
||||
<option name="TAB_SIZE" value="4" />
|
||||
<option name="USE_TAB_CHARACTER" value="false" />
|
||||
<option name="SMART_TABS" value="false" />
|
||||
<option name="LABEL_INDENT_SIZE" value="0" />
|
||||
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
|
||||
<option name="USE_RELATIVE_INDENTS" value="false" />
|
||||
</ADDITIONAL_INDENT_OPTIONS>
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
|
@ -33,7 +33,8 @@ $permission_ids = array(
|
||||
$can_modifyprofile => "modifyprofile"
|
||||
);
|
||||
|
||||
function operator_by_login($login) {
|
||||
function operator_by_login($login)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$operator = select_one_row(
|
||||
@ -42,7 +43,8 @@ function operator_by_login($login) {
|
||||
return $operator;
|
||||
}
|
||||
|
||||
function operator_by_email($mail) {
|
||||
function operator_by_email($mail)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$operator = select_one_row(
|
||||
@ -51,20 +53,23 @@ function operator_by_email($mail) {
|
||||
return $operator;
|
||||
}
|
||||
|
||||
function operator_by_id_($id,$link) {
|
||||
function operator_by_id_($id, $link)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
return select_one_row(
|
||||
"select * from ${mysqlprefix}chatoperator where operatorid = $id", $link);
|
||||
}
|
||||
|
||||
function operator_by_id($id) {
|
||||
function operator_by_id($id)
|
||||
{
|
||||
$link = connect();
|
||||
$operator = operator_by_id_($id, $link);
|
||||
mysql_close($link);
|
||||
return $operator;
|
||||
}
|
||||
|
||||
function operator_get_all() {
|
||||
function operator_get_all()
|
||||
{
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
|
||||
@ -75,22 +80,26 @@ function operator_get_all() {
|
||||
return $operators;
|
||||
}
|
||||
|
||||
function operator_is_online($operator) {
|
||||
function operator_is_online($operator)
|
||||
{
|
||||
global $settings;
|
||||
return $operator['time'] < $settings['online_timeout'];
|
||||
}
|
||||
|
||||
function operator_is_available($operator) {
|
||||
function operator_is_available($operator)
|
||||
{
|
||||
global $settings;
|
||||
return $operator['istatus'] == 0 && $operator['time'] < $settings['online_timeout'] ? "1" : "";
|
||||
}
|
||||
|
||||
function operator_is_away($operator) {
|
||||
function operator_is_away($operator)
|
||||
{
|
||||
global $settings;
|
||||
return $operator['istatus'] != 0 && $operator['time'] < $settings['online_timeout'] ? "1" : "";
|
||||
}
|
||||
|
||||
function update_operator($operatorid,$login,$email,$password,$localename,$commonname) {
|
||||
function update_operator($operatorid, $login, $email, $password, $localename, $commonname)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$query = sprintf(
|
||||
@ -109,7 +118,8 @@ function update_operator($operatorid,$login,$email,$password,$localename,$common
|
||||
mysql_close($link);
|
||||
}
|
||||
|
||||
function update_operator_avatar($operatorid,$avatar) {
|
||||
function update_operator_avatar($operatorid, $avatar)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$query = sprintf(
|
||||
@ -120,7 +130,8 @@ function update_operator_avatar($operatorid,$avatar) {
|
||||
mysql_close($link);
|
||||
}
|
||||
|
||||
function create_operator_($login,$email,$password,$localename,$commonname,$avatar,$link) {
|
||||
function create_operator_($login, $email, $password, $localename, $commonname, $avatar, $link)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
$query = sprintf(
|
||||
"insert into ${mysqlprefix}chatoperator (vclogin,vcpassword,vclocalename,vccommonname,vcavatar,vcemail,vcjabbername) values ('%s','%s','%s','%s','%s','%s','%s')",
|
||||
@ -137,21 +148,24 @@ function create_operator_($login,$email,$password,$localename,$commonname,$avata
|
||||
return select_one_row("select * from ${mysqlprefix}chatoperator where operatorid = $id", $link);
|
||||
}
|
||||
|
||||
function create_operator($login,$email,$password,$localename,$commonname,$avatar) {
|
||||
function create_operator($login, $email, $password, $localename, $commonname, $avatar)
|
||||
{
|
||||
$link = connect();
|
||||
$newop = create_operator_($login, $email, $password, $localename, $commonname, $avatar, $link);
|
||||
mysql_close($link);
|
||||
return $newop;
|
||||
}
|
||||
|
||||
function notify_operator_alive($operatorid, $istatus) {
|
||||
function notify_operator_alive($operatorid, $istatus)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
perform_query("update ${mysqlprefix}chatoperator set istatus = $istatus, dtmlastvisited = CURRENT_TIMESTAMP where operatorid = $operatorid", $link);
|
||||
mysql_close($link);
|
||||
}
|
||||
|
||||
function has_online_operators($groupid="") {
|
||||
function has_online_operators($groupid = "")
|
||||
{
|
||||
global $settings, $mysqlprefix;
|
||||
loadsettings();
|
||||
$link = connect();
|
||||
@ -166,7 +180,8 @@ function has_online_operators($groupid="") {
|
||||
return $row['time'] < $settings['online_timeout'] && $row['total'] > 0;
|
||||
}
|
||||
|
||||
function is_operator_online($operatorid, $link) {
|
||||
function is_operator_online($operatorid, $link)
|
||||
{
|
||||
global $settings, $mysqlprefix;
|
||||
loadsettings_($link);
|
||||
$query = "select count(*) as total, min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time " .
|
||||
@ -175,7 +190,8 @@ function is_operator_online($operatorid, $link) {
|
||||
return $row['time'] < $settings['online_timeout'] && $row['total'] == 1;
|
||||
}
|
||||
|
||||
function get_operator_name($operator) {
|
||||
function get_operator_name($operator)
|
||||
{
|
||||
global $home_locale, $current_locale;
|
||||
if ($home_locale == $current_locale)
|
||||
return $operator['vclocalename'];
|
||||
@ -183,21 +199,23 @@ function get_operator_name($operator) {
|
||||
return $operator['vccommonname'];
|
||||
}
|
||||
|
||||
function append_query($link,$pv) {
|
||||
function append_query($link, $pv)
|
||||
{
|
||||
$infix = '?';
|
||||
if (strstr($link, $infix) !== FALSE)
|
||||
$infix = '&';
|
||||
return "$link$infix$pv";
|
||||
}
|
||||
|
||||
function check_login($redirect=true) {
|
||||
global $webimroot;
|
||||
if( !isset( $_SESSION['operator'] ) ) {
|
||||
function check_login($redirect = true)
|
||||
{
|
||||
global $webimroot, $mysqlprefix;
|
||||
if (!isset($_SESSION["${mysqlprefix}operator"])) {
|
||||
if (isset($_COOKIE['webim_lite'])) {
|
||||
list($login, $pwd) = preg_split("/,/", $_COOKIE['webim_lite'], 2);
|
||||
$op = operator_by_login($login);
|
||||
if ($op && isset($pwd) && isset($op['vcpassword']) && md5($op['vcpassword']) == $pwd) {
|
||||
$_SESSION['operator'] = $op;
|
||||
$_SESSION["${mysqlprefix}operator"] = $op;
|
||||
return $op;
|
||||
}
|
||||
}
|
||||
@ -213,16 +231,19 @@ function check_login($redirect=true) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return $_SESSION['operator'];
|
||||
return $_SESSION["${mysqlprefix}operator"];
|
||||
}
|
||||
|
||||
function get_logged_in() {
|
||||
return isset( $_SESSION['operator'] ) ? $_SESSION['operator'] : FALSE;
|
||||
function get_logged_in()
|
||||
{
|
||||
global $mysqlprefix;
|
||||
return isset($_SESSION["${mysqlprefix}operator"]) ? $_SESSION["${mysqlprefix}operator"] : FALSE;
|
||||
}
|
||||
|
||||
function login_operator($operator,$remember) {
|
||||
global $webimroot;
|
||||
$_SESSION['operator'] = $operator;
|
||||
function login_operator($operator, $remember)
|
||||
{
|
||||
global $webimroot, $mysqlprefix;
|
||||
$_SESSION["${mysqlprefix}operator"] = $operator;
|
||||
if ($remember) {
|
||||
$value = $operator['vclogin'] . "," . md5($operator['vcpassword']);
|
||||
setcookie('webim_lite', $value, time() + 60 * 60 * 24 * 1000, "$webimroot/");
|
||||
@ -232,16 +253,18 @@ function login_operator($operator,$remember) {
|
||||
}
|
||||
}
|
||||
|
||||
function logout_operator() {
|
||||
global $webimroot;
|
||||
unset($_SESSION['operator']);
|
||||
function logout_operator()
|
||||
{
|
||||
global $webimroot, $mysqlprefix;
|
||||
unset($_SESSION["${mysqlprefix}operator"]);
|
||||
unset($_SESSION['backpath']);
|
||||
if (isset($_COOKIE['webim_lite'])) {
|
||||
setcookie('webim_lite', '', time() - 3600, "$webimroot/");
|
||||
}
|
||||
}
|
||||
|
||||
function setup_redirect_links($threadid,$token) {
|
||||
function setup_redirect_links($threadid, $token)
|
||||
{
|
||||
global $page, $webimroot, $settings, $mysqlprefix;
|
||||
loadsettings();
|
||||
$link = connect();
|
||||
@ -309,7 +332,8 @@ function setup_redirect_links($threadid,$token) {
|
||||
|
||||
$permission_list = array();
|
||||
|
||||
function get_permission_list() {
|
||||
function get_permission_list()
|
||||
{
|
||||
global $permission_list, $permission_ids;
|
||||
if (count($permission_list) == 0) {
|
||||
foreach ($permission_ids as $permid) {
|
||||
@ -322,12 +346,14 @@ function get_permission_list() {
|
||||
return $permission_list;
|
||||
}
|
||||
|
||||
function is_capable($perm,$operator) {
|
||||
function is_capable($perm, $operator)
|
||||
{
|
||||
$permissions = $operator && isset($operator['iperm']) ? $operator['iperm'] : 0;
|
||||
return $perm >= 0 && $perm < 32 && ($permissions & (1 << $perm)) != 0;
|
||||
}
|
||||
|
||||
function prepare_menu($operator,$hasright=true) {
|
||||
function prepare_menu($operator, $hasright = true)
|
||||
{
|
||||
global $page, $settings, $can_administrate;
|
||||
$page['operator'] = topage(get_operator_name($operator));
|
||||
if ($hasright) {
|
||||
@ -340,13 +366,15 @@ function prepare_menu($operator,$hasright=true) {
|
||||
}
|
||||
}
|
||||
|
||||
function get_all_groups($link) {
|
||||
function get_all_groups($link)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
$query = "select ${mysqlprefix}chatgroup.groupid as groupid, vclocalname, vclocaldescription from ${mysqlprefix}chatgroup order by vclocalname";
|
||||
return select_multi_assoc($query, $link);
|
||||
}
|
||||
|
||||
function get_groups($link,$checkaway) {
|
||||
function get_groups($link, $checkaway)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
$query = "select ${mysqlprefix}chatgroup.groupid as groupid, vclocalname, vclocaldescription" .
|
||||
", (SELECT count(*) from ${mysqlprefix}chatgroupoperator where ${mysqlprefix}chatgroup.groupid = ${mysqlprefix}chatgroupoperator.groupid) as inumofagents" .
|
||||
@ -363,7 +391,8 @@ function get_groups($link,$checkaway) {
|
||||
return select_multi_assoc($query, $link);
|
||||
}
|
||||
|
||||
function get_operator_groupids($operatorid) {
|
||||
function get_operator_groupids($operatorid)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$query = "select groupid from ${mysqlprefix}chatgroupoperator where operatorid = $operatorid";
|
||||
|
@ -77,8 +77,8 @@ if( !$op ) {
|
||||
if(count($errors) == 0) {
|
||||
update_operator_avatar($op['operatorid'],$avatar);
|
||||
|
||||
if ($opId && $avatar && $_SESSION['operator'] && $operator['operatorid'] == $opId) {
|
||||
$_SESSION['operator']['vcavatar'] = $avatar;
|
||||
if ($opId && $avatar && $_SESSION["${mysqlprefix}operator"] && $operator['operatorid'] == $opId) {
|
||||
$_SESSION["${mysqlprefix}operator"]['vcavatar'] = $avatar;
|
||||
}
|
||||
header("Location: $webimroot/operator/avatar.php?op=$opId");
|
||||
exit;
|
||||
|
@ -25,7 +25,8 @@ require_once('../libs/operator_settings.php');
|
||||
|
||||
$operator = check_login();
|
||||
|
||||
function update_operator_permissions($operatorid,$newvalue) {
|
||||
function update_operator_permissions($operatorid, $newvalue)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$query = "update ${mysqlprefix}chatoperator set iperm = $newvalue where operatorid = $operatorid";
|
||||
@ -62,8 +63,8 @@ if( !$op ) {
|
||||
if (count($errors) == 0) {
|
||||
update_operator_permissions($op['operatorid'], $new_permissions);
|
||||
|
||||
if ($opId && $_SESSION['operator'] && $operator['operatorid'] == $opId) {
|
||||
$_SESSION['operator']['iperm'] = $new_permissions;
|
||||
if ($opId && $_SESSION["${mysqlprefix}operator"] && $operator['operatorid'] == $opId) {
|
||||
$_SESSION["${mysqlprefix}operator"]['iperm'] = $new_permissions;
|
||||
}
|
||||
header("Location: $webimroot/operator/permissions.php?op=$opId&stored");
|
||||
exit;
|
||||
|
@ -23,6 +23,7 @@ require_once('../libs/common.php');
|
||||
require_once('../libs/chat.php');
|
||||
require_once('../libs/userinfo.php');
|
||||
require_once('../libs/operator.php');
|
||||
require_once('../libs/groups.php');
|
||||
|
||||
$operator = get_logged_in();
|
||||
if( !$operator ) {
|
||||
@ -167,8 +168,13 @@ $since = verifyparam( "since", "/^\d{1,9}$/", 0);
|
||||
$status = verifyparam( "status", "/^\d{1,2}$/", 0);
|
||||
$showonline = verifyparam( "showonline", "/^1$/", 0);
|
||||
|
||||
loadsettings();
|
||||
$groupids = $_SESSION['operatorgroups'];
|
||||
$link = connect();
|
||||
loadsettings_($link);
|
||||
if(!isset($_SESSION['operatorgroups'])) {
|
||||
$_SESSION["${mysqlprefix}operatorgroups"] = get_operator_groupslist($operator['operatorid'], $link);
|
||||
}
|
||||
mysql_close($link);
|
||||
$groupids = $_SESSION["${mysqlprefix}operatorgroups"];
|
||||
|
||||
start_xml_output();
|
||||
echo '<update>';
|
||||
|
@ -30,7 +30,7 @@ notify_operator_alive($operator['operatorid'], $status);
|
||||
|
||||
$link = connect();
|
||||
loadsettings_($link);
|
||||
$_SESSION['operatorgroups'] = get_operator_groupslist($operator['operatorid'], $link);
|
||||
$_SESSION["${mysqlprefix}operatorgroups"] = get_operator_groupslist($operator['operatorid'], $link);
|
||||
mysql_close($link);
|
||||
|
||||
$page = array();
|
||||
|
Loading…
Reference in New Issue
Block a user