echo '</select>', "\n"; echo '</td>', "\n"; echo '<td>', $group['type'], '</td>', "\n"; echo '<td class="r" colspan="2">', "\n"; echo '<button type="submit" name="id" value="' . $group['id'] . '" title="', __('Gruppe Einfügen'), '" class="plain"><img alt="', __('Einfügen'), '" src="', GS_URL_PATH, 'img/plus.gif" /></button>'; echo '</td>', "\n"; echo '</tr>', "\n"; echo '</form>', "\n"; } foreach ($groups_my_info as $group) { echo '<tr class="', $i % 2 === 0 ? 'odd' : 'even', '">', "\n"; echo '<td class="l nobr">'; echo $group['name'], '</td>', "\n"; echo '<td>', $group['title'], '</td>', "\n"; echo '<td>', $group['type'], '</td>', "\n"; echo '<td class="r">', count(gs_group_members_get(array($group['id']))), '</td>', "\n"; echo '<td class="r">', "\n"; if (!gs_group_connections_get($group['id'])) { echo '<a href="', gs_url($SECTION, $MODULE, null, '&edit=' . rawUrlEncode($edit_user) . '&name=' . rawUrlEncode($name) . '&number=' . rawUrlEncode($number) . '&page=' . $page . '&sort=' . $sort . '&sortorder=' . $sortorder . '&action=remove-group&group=' . $group['id']), '"><img alt="', __('Entfernen'), '" title="', __('Entfernen'), '" src="', GS_URL_PATH, 'img/minus.gif" /></a>'; } echo '</td>', "\n"; echo '</tr>', "\n"; $i++; } ?> </tbody> </table> <?php //FIXME - invalid XHTML! }
$day_d = 0; # current month $h_start = 7; $h_end = 18; } if (!$group) { $group = @$_SESSION['sudo_user']['name']; } $user_groups = gs_group_members_groups_get(array(@$_SESSION['sudo_user']['info']['id']), 'user'); $select_groups = gs_group_permissions_get($user_groups, 'call_stats', 'user'); $group_info = gs_group_info_get($select_groups); $queue_groups = gs_group_members_get(gs_group_permissions_get($user_groups, 'call_stats', 'queue')); if (array_search($group, $select_groups) === FALSE) { $exts_sql = ''; } else { $users = gs_group_members_get(array($group)); $exts_sql = userids_to_exts($users); } if (array_search($queue_id, $queue_groups) === FALSE) { $queue_id = 0; } ?> <form method="get" action="<?php echo GS_URL_PATH; ?> "> <?php
return $m . ':' . str_pad($s, 2, '0', STR_PAD_LEFT); } $sudo_url = @$_SESSION['sudo_user']['name'] == @$_SESSION['real_user']['name'] ? '' : '&sudo=' . @$_SESSION['sudo_user']['name']; $action = @$_REQUEST['action']; if ($action == 'report') { $queue_id = (int) @$_REQUEST['queue_id']; $month_d = (int) @$_REQUEST['month']; } else { $action = ''; $queue_id = 0; //$month_d = -1; # previous month $month_d = 0; # current month } $user_groups = gs_group_members_groups_get(array(@$_SESSION['sudo_user']['info']['id']), 'user'); $queue_groups = gs_group_members_get(gs_group_permissions_get($user_groups, 'call_stats', 'queue')); ?> <form method="get" action="<?php echo GS_URL_PATH; ?> "> <?php echo gs_form_hidden($SECTION, $MODULE); ?> <input type="hidden" name="action" value="report" /> <label for="ipt-queue_id"><?php echo __('Warteschlange'); ?>
echo '<h2>'; if (@$MODULES[$SECTION]['icon']) { echo '<img alt=" " src="', GS_URL_PATH, str_replace('%s', '32', $MODULES[$SECTION]['icon']), '" /> '; } if (count($MODULES[$SECTION]['sub']) > 1) { echo $MODULES[$SECTION]['title'], ' - '; } echo $MODULES[$SECTION]['sub'][$MODULE]['title']; echo '</h2>', "\n"; $action = @$_REQUEST['action']; $user_id = @$_SESSION['sudo_user']['info']['id']; if (!$user_id) { exit; } $user_groups = gs_group_members_groups_get(array($user_id), 'user'); $queue_ids = gs_group_members_get(gs_group_permissions_get($user_groups, 'monitor_queues', 'queue')); if ($action == 'save') { $colors = array(); for ($status = 0; $status <= 255; ++$status) { if (array_key_exists('ec' . $status, $_REQUEST)) { $colors[$status] = trim($_REQUEST['ec' . $status]); } } $queues = array(); foreach ($queue_ids as $queue_id) { $queue = array(); if (array_key_exists('qa' . $queue_id, $_REQUEST) && $_REQUEST['qa' . $queue_id] == "on") { $queue['active'] = 1; } else { $queue['active'] = 0; }
$actives['vmln-' . ++$ncnt] = sprintf(__('Ansg. %u'), $ncnt); $timeruleactives['vmln-' . $r['id']] = sprintf(__('Ansg. %u'), $ncnt); } $id = (int) $DB->executeGetOne('SELECT `_queue_id` from `queue_cf_timerules` WHERE `_queue_id`=' . $queue_id); if ($id) { $actives['trl'] = __('Zeitsteuerung'); } $id = (int) $DB->executeGetOne('SELECT `_queue_id` from `queue_cf_parallelcall` WHERE `_queue_id`=' . $queue_id); if ($id) { $actives['par'] = __('Parallelruf'); $timeruleactives['par'] = __('Parallelruf'); } } $queues = @gs_queues_get(); $user_groups = gs_group_members_groups_get(array(@$_SESSION['sudo_user']['info']['id']), 'user'); $queue_groups = gs_group_members_get(gs_group_permissions_get($user_groups, 'forward_queues', 'queue')); if (isGsError($queues)) { echo __('Fehler beim Abfragen der Warteschlangen.'), ' - ', $queues->getMsg(); return; # return to parent file } elseif (!is_array($queues)) { echo __('Fehler beim Abfragen der Warteschlangen.'); return; # return to parent file } $queue = null; if ($queue_ext != '') { foreach ($queues as $q) { if ($q['name'] == $queue_ext && array_search($q['id'], $queue_groups) !== false) { $queue = $q; break;
* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. \*******************************************************************/ defined('GS_VALID') or die('No direct access.'); include_once GS_DIR . 'inc/group-fns.php'; $user_id = (int) @$_SESSION['sudo_user']['info']['id']; $user_groups = gs_group_members_groups_get(array($user_id), 'user'); $permission_groups = gs_group_permissions_get($user_groups, 'phonebook_user'); $group_members = gs_group_members_get($permission_groups); echo '<h2>'; if (@$MODULES[$SECTION]['icon']) { echo '<img alt=" " src="', GS_URL_PATH, str_replace('%s', '32', $MODULES[$SECTION]['icon']), '" /> '; } if (count($MODULES[$SECTION]['sub']) > 1) { echo $MODULES[$SECTION]['title'], ' - '; } echo $MODULES[$SECTION]['sub'][$MODULE]['title']; echo '</h2>', "\n"; echo '<script type="text/javascript" src="', GS_URL_PATH, 'js/arrnav.js"></script>', "\n"; $per_page = (int) GS_GUI_NUM_RESULTS; $name = trim(@$_REQUEST['name']); $number = trim(@$_REQUEST['number']); $page = (int) @$_REQUEST['page']; if ($number != '') {
function gui_get_grouped_peers($user_id, $type) { require_once GS_DIR . 'inc/group-fns.php'; $user_groups = gs_group_members_groups_get(array($user_id), 'user'); $permission_groups = gs_group_permissions_get($user_groups, $type); $group_members = gs_group_members_get($permission_groups); return $group_members; }
echo '<br /><p align="center"><a href="setup/">Setup</a></p>', "\n"; echo '</body>', "\n"; echo '</html>'; exit; } } } } include_once GS_DIR . 'inc/gettext.php'; require_once GS_DIR . 'htdocs/gui/inc/session.php'; # defines $DB require_once GS_HTDOCS_DIR . 'inc/modules.php'; if (!@$_SESSION['login_ok']) { $display_modules = array(); } else { $display_modules = gs_group_members_get(gs_group_permissions_get(gs_group_members_groups_get(array(@$_SESSION['sudo_user']['info']['id']), 'user'), 'display_module_gui', 'module_gui')); } # get section & module # if (array_key_exists('s', $_REQUEST)) { $SECTION = $_REQUEST['s']; if ($SECTION != '') { $MODULE = array_key_exists('m', $_REQUEST) ? $_REQUEST['m'] : ''; } else { $SECTION = 'home'; $MODULE = ''; } } else { $SECTION = 'home'; $MODULE = ''; }
} if ($groups) { foreach ($groups as $group_id => $group) { $sql_query = 'REPLACE `monitor_groups` (`user_id`, `group_id`, `' . implode('`,`', array_keys($group)) . '`) VALUES (' . $user_id . ',' . $group_id . ',' . implode(',', $group) . ')'; $rs = $DB->execute($sql_query); } } $action = "edit"; } $groups = array(); $groups_array = gs_group_info_get($monitor_group_ids); foreach ($groups_array as $group) { group_defaults($group); $group['memberids'] = gs_group_members_get(array($group['id'])); $groups[$group['id']] = $group; } unset($groups_array); $sql_query = 'SELECT `m`.`group_id` `id`, `m`.`active`, `m`.`display_columns`, `m`.`display_width`, `m`.`display_height`, `m`.`display_extension`, `m`.`display_name`, `m`.`display_forw`, `m`.`display_comment` FROM `monitor_groups` `m` WHERE `m`.`user_id` = ' . $user_id;
function gs_group_members_get_names($group, $includes = true) { $members = gs_group_members_get(array($group), $includes); if (isGsError($members)) { gs_script_error($members->getMsg()); } if (!$members) { return array(); } $db_slave = gs_db_slave_connect(); if (!$db_slave) { return new GsError('Could not connect to database.'); } if (!$members) { return array(); } $type = $db_slave->executeGetOne('SELECT `type` FROM `groups` WHERE `id` = ' . $group . ' LIMIT 1'); switch ($type) { case 'user': $sql_query = 'SELECT `user` AS `member` FROM `users` WHERE `id` IN (' . implode(',', $members) . ')'; break; case 'queue': $sql_query = 'SELECT `name` AS `member` FROM `ast_queues` WHERE `_id` IN (' . implode(',', $members) . ')'; break; case 'host': $sql_query = 'SELECT `host` AS `member` FROM `hosts` WHERE `id` IN (' . implode(',', $members) . ')'; break; default: $sql_query = false; break; } $members_a = array(); if ($sql_query === false) { foreach ($members as $member) { $r = array(); $r['type'] = $type; $r['member'] = $member; $members_a[] = $r; } } else { $rs = $db_slave->execute($sql_query); if ($rs) { while ($r = $rs->fetchRow()) { $r['type'] = $type; $members_a[] = $r; } } } return $members_a; }
echo '</tr>'; } } echo '<tr><td><input type="text" name="uuser" value="" size="8" maxlength="20" /></td>'; echo '<td><input type="text" name="ufname" value="" size="8" maxlength="20" /></td>'; echo '<td><input type="text" name="ulname" value="" size="8" maxlength="20" /></td>'; echo '<td><input type="text" name="uexten" value="" size="8" maxlength="20" /></td>'; echo '<td><input type="text" name="upin" value="" size="8" maxlength="20" /></td></tr>'; echo '</tbody></table>'; echo '<div class="fr"><button type="submit" title="', __('Speichern'), '" class="plain">'; echo '<img alt="', __('Hinzufügen'), '" src="', GS_URL_PATH, 'crystal-svg/16/act/filesave.png" /></button></div><br /><hr />', "\n"; echo '</form>'; } echo '<div class="fl"><a href="', GS_URL_PATH, 'setup/?step=login">', __('zurück'), '</a></div>', "\n"; echo '<div class="fr">'; $count_admins = count(gs_group_members_get(array($group_id))); if ($count_admins < 1) { $can_continue = false; } else { $can_continue = true; } if ($can_continue) { switch ($GS_INSTALLATION_TYPE) { # "system-check" unnecessary for the GPBX case 'gpbx': $next_step = 'network'; break; default: $next_step = 'system-check'; break; }
array_multisort($sort_key, SORT_ASC, SORT_STRING, $groups); if (isGsError($groups)) { echo '<tr><td colspan="5">', $groups->getMsg(), '</td></tr>'; } else { $i = 1; foreach ($groups as $group) { if ($i > $per_page * ($page + 1) || $i < $per_page * $page + 1) { $i++; continue; } $groups_same_type = gs_group_info_get(false, $group['type']); $group_includes_ids = gs_group_includes_get(array($group['id']), true, true); $group_includes = gs_group_info_get(array_diff($group_includes_ids, array($group['id']))); echo '<tr class="', $i % 2 === 0 ? 'odd' : 'even', '">', "\n"; echo '<td class="l nobr">'; echo $group['name'], '</td>', "\n"; echo '<td>', $group['title'], '</td>', "\n"; echo '<td class="r">', count(gs_group_members_get(array($group['id']))), ' / ', $num_sections + $num_modules, '</td>', "\n"; echo '<td class="r">', "\n"; echo '<a href="', gs_url($SECTION, $MODULE, null, 'action=edit&id=' . $group['id'] . '&page=' . $page), '"><img alt="', __('Bearbeiten'), '" title="', __('Bearbeiten'), '" src="', GS_URL_PATH, 'crystal-svg/16/act/edit.png" /></a>'; echo '</td>', "\n"; echo '</tr>', "\n"; $i++; } } ?> </tbody> </table> <?php } }
if (@$_REQUEST['action'] == 'save') { $clir_internal = @$_REQUEST['clir-internal'] == 'yes' ? 'yes' : 'no'; $clir_external = @$_REQUEST['clir-external'] == 'yes' ? 'yes' : 'no'; gs_clir_activate($_SESSION['sudo_user']['name'], 'internal', $clir_internal); gs_clir_activate($_SESSION['sudo_user']['name'], 'external', $clir_external); $cw = !!@$_REQUEST['callwaiting']; # setting this reboots phone, so check if it has really changed $cw_old = gs_callwaiting_get($_SESSION['sudo_user']['name']); if (!isGsError($cw_old)) { if ($cw != $cw_old) { gs_callwaiting_activate($_SESSION['sudo_user']['name'], $cw); } } } $user_groups = gs_group_members_groups_get(array(@$_SESSION['sudo_user']['info']['id']), 'user'); $queues_allowed = gs_group_members_get(gs_group_permissions_get($user_groups, 'login_queues', 'queue')); $user = gs_user_get($_SESSION['sudo_user']['name']); $queue_ids = @$_REQUEST['queue_id']; if (@$_REQUEST['action'] == 'loginqueue' && !empty($queue_ids)) { $ami = new AMI(); $ami->ami_login('gscc', 'gspass', '127.0.0.1', 5038); $agent = $DB->executeGetOne('SELECT `name` FROM `ast_sipfriends` WHERE `_user_id`=' . $user['id']); // Ich vertraue gs_group_members_get // in dem array sind NUR int() $queue_ids = array_intersect($queue_ids, $queues_allowed); $rs = $DB->execute('SELECT `_id`, `name` FROM `ast_queues` WHERE `_host_id`=' . $user['host_id'] . ' AND `_id` IN (' . implode(",", $queue_ids) . ') AND `_id` NOT IN (SELECT `_queue_id` FROM `ast_queue_members` WHERE `_user_id`=' . $user['id'] . ')'); while ($queue_map = $rs->fetchRow()) { $penalty = $DB->executeGetOne('SELECT `penalty` FROM `penalties` WHERE `_user_id`=' . $user['id'] . ' AND `_queue_id`=' . $queue_map['_id']);
echo "\n"; # hints for pickup groups # echo "// hints for pickup groups (auto-generated):\n"; $query = 'SELECT `permit` `pg_id` FROM `group_permissions` WHERE `type` = \'group_pickup\' GROUP BY `pg_id`'; $rs = $db->execute($query); if ($rs) { while ($r = $rs->fetchRow()) { if ($group_members = gs_group_members_get(array($r['pg_id']))) { $query = 'SELECT `name` `ext` FROM `ast_sipfriends` WHERE `_user_id` IN (' . implode(',', $group_members) . ') '; $rsa = $db->execute($query); if ($rsa) { $devices = array(); while ($ra = $rsa->fetchRow()) { $ext = preg_replace('/[^0-9*a-z\\-_]/iS', '', $ra['ext']); if ($ext != '') { $devices[] = 'SIP/' . $ext; }
@header('Status: 500 Internal Server Error', true, 500); @header('Content-Type: text/plain; charset=utf-8'); echo '/* ', $errmsg ? $errmsg : 'Internal Server Error.', ' */'; gs_log(GS_LOG_NOTICE, $errmsg ? $errmsg : 'LDAP lookup: Error'); exit(1); } function _not_found($errmsg = '') { @header('HTTP/1.0 404 Not Found', true, 404); @header('Status: 404 Not Found', true, 404); @header('Content-Type: text/plain; charset=utf-8'); echo '/* ', $errmsg ? $errmsg : 'Not found.', ' */'; gs_log(GS_LOG_DEBUG, $errmsg ? $errmsg : 'LDAP lookup: User not found'); exit(1); } $admin_ids = gs_group_members_get(array(gs_group_id_get('admins'))); if (!in_array(@$_SESSION['real_user']['info']['id'], $admin_ids)) { _not_allowed(); } if (!array_key_exists('u', $_REQUEST)) { _not_found('Username not specified.'); } $user = $_REQUEST['u']; include_once GS_DIR . 'inc/gs-fns/gs_ldap_user_search.php'; $user_info = gs_ldap_user_search($user); if (isGsError($user_info)) { _server_error($user_info->getMsg()); } if (!is_array($user_info)) { _server_error('Failed to look up user "' . $user . '" in LDAP.'); }