/** * Builds a page with form for edit operator's permissions. * * @param Request $request Incoming request. * @return string Rendered page content. * @throws NotFoundException If the operator with specified ID is not found * in the system. */ public function showFormAction(Request $request) { $operator = $this->getOperator(); $op_id = $request->attributes->get('operator_id'); $page = array('opid' => $op_id, 'canmodify' => is_capable(CAN_ADMINISTRATE, $operator) ? '1' : '', 'errors' => array()); $op = operator_by_id($op_id); if (!$op) { throw new NotFoundException('The operator is not found.'); } // Check if the target operator exists $page['currentop'] = $op ? get_operator_name($op) . ' (' . $op['vclogin'] . ')' : getlocal('-not found-'); // Build list of permissions which belongs to the target operator. $checked_permissions = array(); foreach (permission_ids() as $perm => $id) { if (is_capable($perm, $op)) { $checked_permissions[] = $id; } } // Build list of all available permissions $page['permissionsList'] = array(); foreach (get_permission_list() as $perm) { $perm['checked'] = in_array($perm['id'], $checked_permissions); $page['permissionsList'][] = $perm; } $page['stored'] = $request->query->has('stored'); $page['title'] = getlocal('Permissions'); $page['menuid'] = $operator['operatorid'] == $op_id ? 'profile' : 'operators'; $page = array_merge($page, prepare_menu($operator)); $page['tabs'] = $this->buildTabs($request); return $this->render('operator_permissions', $page); }
/** * Builds list of the localization tabs. * * @param Request $request Current request. * @return array Tabs list. The keys of the array are tabs titles and the * values are tabs URLs. */ protected function buildTabs(Request $request) { $tabs = array(); $route = $request->attributes->get('_route'); $tabs[getlocal('Translations')] = ($route != 'translations') ? $this->generateUrl('translations') : ''; $import = ($route == 'translation_import' || $route == 'translation_import_process'); $tabs[getlocal('Translations import')] = !$import ? $this->generateUrl('translation_import') : ''; $export = ($route == 'translation_export' || $route == 'translation_export_process'); $tabs[getlocal('Translations export')] = !$export ? $this->generateUrl('translation_export') : ''; $tabs[getlocal('Locales')] = ($route != 'locales') ? $this->generateUrl('locales') : ''; return $tabs; }
/** * Generates list of all available groups. * * @param Request $request Incoming request. * @return string Rendered page content. */ public function indexAction(Request $request) { $operator = $this->getOperator(); $page = array('errors' => array()); $sort_by = $request->query->get('sortby'); if (!in_array($sort_by, array('name', 'lastseen', 'weight'))) { $sort_by = 'name'; } $sort['by'] = $sort_by; $sort['desc'] = $request->query->get('sortdirection', 'desc') == 'desc'; // Load and prepare groups $groups = get_sorted_groups($sort); foreach ($groups as &$group) { $group['vclocalname'] = $group['vclocalname']; $group['vclocaldescription'] = $group['vclocaldescription']; $group['isOnline'] = group_is_online($group); $group['isAway'] = group_is_away($group); $group['lastTimeOnline'] = time() - ($group['ilastseen'] ? $group['ilastseen'] : time()); $group['inumofagents'] = $group['inumofagents']; } unset($group); // Set values that are needed to build sorting block. $page['groups'] = $groups; $page['formsortby'] = $sort['by']; $page['formsortdirection'] = $sort['desc'] ? 'desc' : 'asc'; $page['canmodify'] = is_capable(CAN_ADMINISTRATE, $operator); $page['availableOrders'] = array(array('id' => 'name', 'name' => getlocal('Name')), array('id' => 'lastseen', 'name' => getlocal('Last active')), array('id' => 'weight', 'name' => getlocal('Weight'))); $page['availableDirections'] = array(array('id' => 'desc', 'name' => getlocal('descending')), array('id' => 'asc', 'name' => getlocal('ascending'))); // Set other variables and render the response. $page['title'] = getlocal('Groups'); $page['menuid'] = 'groups'; $page = array_merge($page, prepare_menu($operator)); $this->getAssetManager()->attachJs('js/compiled/groups.js'); return $this->render('groups', $page); }
/** * Generates a page with awaiting visitors. * * @param Request $request * @return string Rendered page content */ public function indexAction(Request $request) { $operator = $this->getOperator(); // Operator becomes online as soon as he open "operator/users" page notify_operator_alive($operator['operatorid'], 0); $operator['istatus'] = 0; $this->getAuthenticationManager()->setOperator($operator); $_SESSION[SESSION_PREFIX . "operatorgroups"] = get_operator_groups_list($operator['operatorid']); $page = array(); $page['havemenu'] = !$request->query->has('nomenu'); $page['showonline'] = (Settings::get('showonlineoperators') == '1'); $page['showvisitors'] = (Settings::get('enabletracking') == '1'); $page['title'] = getlocal("List of visitors waiting"); $page['menuid'] = "users"; $page = array_merge($page, prepare_menu($operator)); // Attach files of the client side application and start it $this->getAssetManager()->attachJs('js/compiled/users_app.js'); $this->getAssetManager()->attachJs( $this->startJsApplication($request, $operator), \Mibew\Asset\AssetManagerInterface::INLINE, 1000 ); return $this->render('users', $page); }
/** * Builds a page with form for edit operator's groups. * * @param Request $request Incoming request. * @return string Rendered page content. * @throws NotFoundException If the operator with specified ID is not found * in the system. */ public function showFormAction(Request $request) { $operator = $this->getOperator(); $operator_in_isolation = in_isolation($operator); $op_id = $request->attributes->getInt('operator_id'); // Check if the target user exists $op = operator_by_id($op_id); if (!$op) { throw new NotFoundException('The operator is not found.'); } $page = array('opid' => $op_id, 'errors' => array()); $groups = $operator_in_isolation ? get_groups_for_operator($operator) : get_all_groups(); $can_modify = is_capable(CAN_ADMINISTRATE, $operator); $page['currentop'] = $op ? get_operator_name($op) . ' (' . $op['vclogin'] . ')' : getlocal('-not found-'); $page['canmodify'] = $can_modify ? '1' : ''; // Get IDs of groups the operator belongs to. $checked_groups = array(); if ($op) { $checked_groups = get_operator_group_ids($op_id); } // Get all available groups $page['groups'] = array(); foreach ($groups as $group) { $group['vclocalname'] = $group['vclocalname']; $group['vclocaldescription'] = $group['vclocaldescription']; $group['checked'] = in_array($group['groupid'], $checked_groups); $page['groups'][] = $group; } $page['stored'] = $request->query->has('stored'); $page['title'] = getlocal('Operator groups'); $page['menuid'] = $operator['operatorid'] == $op_id ? 'profile' : 'operators'; $page = array_merge($page, prepare_menu($operator)); $page['tabs'] = $this->buildTabs($request); return $this->render('operator_groups', $page); }
function tpl_menu() { global $page, $webimroot, $errors, $current_locale; ?> <li> <h2><b><?php echo getlocal("lang.choose"); ?> </b></h2> <ul class="locales"> <?php foreach ($page['localeLinks'] as $id => $title) { ?> <li<?php menuloc($id); ?> ><a href='?locale=<?php echo $id; ?> '><?php echo $title; ?> </a></li> <?php } ?> </ul> </li> <?php }
/** * Builds a page with members edit form. * * @param Request $request Incoming request. * @return string Rendered page content. * @throws NotFoundException If the operator's group with specified ID is * not found in the system. */ public function showFormAction(Request $request) { $operator = $this->getOperator(); $group_id = $request->attributes->getInt('group_id'); $page = array('groupid' => $group_id, 'errors' => $request->attributes->get('errors', array())); $operators = get_operators_list(); $group = group_by_id($group_id); // Check if the group exists if (!$group) { throw new NotFoundException('The group is not found.'); } $page['formop'] = array(); $page['currentgroup'] = $group ? htmlspecialchars($group['vclocalname']) : ''; // Get list of group's members $checked_operators = get_group_members($group_id); // Prepare the list of all operators $page['operators'] = array(); foreach ($operators as $op) { $op['vclocalename'] = $op['vclocalename']; $op['vclogin'] = $op['vclogin']; $op['checked'] = in_array($op['operatorid'], $checked_operators); $page['operators'][] = $op; } // Set other values and render the page $page['stored'] = $request->query->get('stored'); $page['title'] = getlocal('Members'); $page['menuid'] = 'groups'; $page = array_merge($page, prepare_menu($operator)); $page['tabs'] = $this->buildTabs($request); return $this->render('group_members', $page); }
/** * Runs the Updater. * * @param Request $request Incoming request. * @return Response|string Rendered page contents or Symfony's response * object. */ public function runUpdateAction(Request $request) { $upd = $this->getUpdater(); $upd->run(); $parameters = array('version' => MIBEW_VERSION, 'fixedwrap' => true, 'title' => getlocal('Update'), 'done' => $this->getUpdater()->getLog(), 'errors' => $this->getUpdater()->getErrors()); return $this->render('update_progress', $parameters); }
/** * Builds a page with form for features system settings. * * @param Request $request Incoming request. * @return string Rendered page content. */ public function showFormAction(Request $request) { $operator = $this->getOperator(); $page = array( 'agentId' => '', 'errors' => array(), ); // Load all needed options and fill form with them. $options = $this->getOptionsList(); foreach ($options as $opt) { $page['form' . $opt] = (Settings::get($opt) == '1'); } $page['canmodify'] = is_capable(CAN_ADMINISTRATE, $operator); $page['stored'] = $request->query->get('stored'); $page['title'] = getlocal('Messenger settings'); $page['menuid'] = 'settings'; $page = array_merge($page, prepare_menu($operator)); $page['tabs'] = $this->buildTabs($request); $this->getAssetManager()->attachJs('js/compiled/features.js'); return $this->render('settings_features', $page); }
function tpl_menu() { global $page, $mibewroot, $errors, $current_locale; ?> <li> <h2><b><?php echo getlocal("lang.choose"); ?> </b></h2> <ul class="locales"> <?php foreach ($page['localeLinks'] as $id => $title) { ?> <li<?php menuloc($id); ?> ><a href="?locale=<?php echo urlencode($id); ?> "><?php echo safe_htmlspecialchars($title); ?> </a></li> <?php } ?> </ul> </li> <?php }
/** * {@inheritdoc} */ public function execute(Template $template, Context $context, $args, $source) { // Check if there is at least one argument $parsed_arguments = $template->parseArguments($args); if (count($parsed_arguments) == 0) { throw new \InvalidArgumentException('"l10n" helper expects at least one argument.'); } $text = $context->get(array_shift($parsed_arguments)); // We need to escape extra arguments passed to the helper. Thus we need // to get escape function and its arguments from the template engine. $escape_func = $template->getEngine()->getEscape(); $escape_args = $template->getEngine()->getEscapeArgs(); // Check if there are any other arguments passed into helper and escape // them. $local_args = array(); foreach ($parsed_arguments as $parsed_argument) { // Get locale argument string and add it to escape function // arguments. array_unshift($escape_args, $context->get($parsed_argument)); // Escape locale argument's value $local_args[] = call_user_func_array($escape_func, array_values($escape_args)); // Remove locale argument's value from escape function argument array_shift($escape_args); } $result = getlocal($text, $local_args); return new SafeString($result); }
/** * Renders operator's home page. * * @param Request $request Incoming request * @return string Rendered page content. */ public function dashboardAction(Request $request) { $operator = $this->getOperator(); $is_online = is_operator_online($operator['operatorid']); $page = array('version' => MIBEW_VERSION, 'localeLinks' => get_locale_links(), 'needUpdate' => version_compare(Settings::get('dbversion'), MIBEW_VERSION, '<'), 'profilePage' => $this->generateUrl('operator_edit', array('operator_id' => $operator['operatorid'])), 'isOnline' => $is_online, 'warnOffline' => true, 'title' => getlocal('Home'), 'menuid' => 'main'); $page = array_merge($page, prepare_menu($operator)); return $this->render('index', $page); }
function setup_group_settings_tabs($gid, $active) { global $page, $webimroot, $settings; if ($gid) { $page['tabs'] = array(getlocal("page_group.tab.main") => $active != 0 ? "{$webimroot}/operator/group.php?gid={$gid}" : "", getlocal("page_group.tab.members") => $active != 1 ? "{$webimroot}/operator/groupmembers.php?gid={$gid}" : ""); } else { $page['tabs'] = array(); } }
function setup_group_settings_tabs($gid, $active) { global $page, $webimroot, $settings; if ($gid) { $page['tabselected'] = $active; $page['tabs'] = array(array('title' => getlocal("page_group.tab.main"), 'link' => "{$webimroot}/operator/group.php?gid={$gid}"), array('title' => getlocal("page_group.tab.members"), 'link' => "{$webimroot}/operator/groupmembers.php?gid={$gid}")); } else { $page['tabs'] = array(); } }
/** * Builds list of the styles tabs. * * @param Request $request Current request. * @return array Tabs list. The keys of the array are tabs titles and the * values are tabs URLs. */ protected function buildTabs(Request $request) { $tabs = array(); $type = $request->attributes->get('type'); $tabs[getlocal("Operator pages themes preview")] = $type != self::TYPE_PAGE ? $this->generateUrl('style_preview', array('type' => self::TYPE_PAGE)) : ''; $tabs[getlocal("Chat themes preview")] = $type != self::TYPE_CHAT ? $this->generateUrl('style_preview', array('type' => self::TYPE_CHAT)) : ''; if (Settings::get('enabletracking')) { $tabs[getlocal("Invitation themes preview")] = $type != self::TYPE_INVITATION ? $this->generateUrl('style_preview', array('type' => self::TYPE_INVITATION)) : ''; } return $tabs; }
/** * Builds list of the group tabs. * * @param Request $request Current request. * @return array Tabs list. The keys of the array are tabs titles and the * values are tabs URLs. */ protected function buildTabs(Request $request) { $tabs = array(); $route = $request->attributes->get('_route'); $group_id = $request->attributes->get('group_id', false); $args = array('group_id' => $group_id); if ($group_id) { $tabs[getlocal('General')] = $route == 'group_members' ? $this->generateUrl('group_edit', $args) : ''; $tabs[getlocal('Members')] = $route != 'group_members' ? $this->generateUrl('group_members', $args) : ''; } return $tabs; }
/** * Builds list of the settings tabs. * * @param Request $request Current request. * @return array Tabs list. The keys of the array are tabs titles and the * values are tabs URLs. */ protected function buildTabs(Request $request) { $tabs = array(); $route = $request->attributes->get('_route'); $common = $route == 'settings_common' || $route == 'settings_common_save'; $features = $route == 'settings_features' || $route == 'settings_features_save'; $performance = $route == 'settings_performance' || $route == 'settings_performance_save'; $tabs[getlocal('General')] = !$common ? $this->generateUrl('settings_common') : ''; $tabs[getlocal('Optional Services')] = !$features ? $this->generateUrl('settings_features') : ''; $tabs[getlocal('Performance')] = !$performance ? $this->generateUrl('settings_performance') : ''; return $tabs; }
function tpl_content() { global $page, $webimroot, $errors; ?> <?php require_once 'inc_errors.php'; echo getlocal("install.err.back"); ?> <?php }
/** * Builds list of available updates to display in the template. * * @return array List of updates data. Each item of the list is associative * array with the following keys: * - "title": string, title of the update. * - "version": string, the latest available version. * - "url": string, URL of the page the updated version can be downloaded * from. * - "description": string, description of the update. */ protected function getAvailableUpdates() { $updates = AvailableUpdate::all(); if (!$updates) { return array(); } $data = array(); foreach ($updates as $update) { $title = $update->target == 'core' ? 'Mibew' : getlocal('{0} plugin', array($update->target)); $data[] = array('title' => $title, 'version' => $update->version, 'url' => $update->url, 'description' => $update->description); } return $data; }
/** * Builds list of the operator tabs. * * @param Request $request Current request. * @return array Tabs list. The keys of the array are tabs titles and the * values are tabs URLs. */ protected function buildTabs(Request $request) { $tabs = array(); $route = $request->attributes->get('_route'); $operator_id = $request->attributes->get('operator_id', false); $args = array('operator_id' => $operator_id); if ($operator_id) { $tabs[getlocal('General')] = $route != 'operator_edit' ? $this->generateUrl('operator_edit', $args) : ''; $tabs[getlocal('Photo')] = $route != 'operator_avatar' ? $this->generateUrl('operator_avatar', $args) : ''; $tabs[getlocal('Groups')] = $route != 'operator_groups' ? $this->generateUrl('operator_groups', $args) : ''; $tabs[getlocal('Permissions')] = $route != 'operator_permissions' ? $this->generateUrl('operator_permissions', $args) : ''; } return $tabs; }
function setup_operator_settings_tabs($opId, $active) { global $page, $webimroot, $settings; loadsettings(); if ($opId) { if ($settings['enablegroups'] == '1') { $page['tabs'] = array(getlocal("page_agent.tab.main") => $active != 0 ? "{$webimroot}/operator/operator.php?op={$opId}" : "", getlocal("page_agent.tab.avatar") => $active != 1 ? "{$webimroot}/operator/avatar.php?op={$opId}" : "", getlocal("page_agent.tab.groups") => $active != 2 ? "{$webimroot}/operator/opgroups.php?op={$opId}" : "", getlocal("page_agent.tab.permissions") => $active != 3 ? "{$webimroot}/operator/permissions.php?op={$opId}" : ""); } else { $page['tabs'] = array(getlocal("page_agent.tab.main") => $active != 0 ? "{$webimroot}/operator/operator.php?op={$opId}" : "", getlocal("page_agent.tab.avatar") => $active != 1 ? "{$webimroot}/operator/avatar.php?op={$opId}" : "", getlocal("page_agent.tab.permissions") => $active != 3 ? "{$webimroot}/operator/permissions.php?op={$opId}" : ""); } } else { $page['tabs'] = array(); } }
function get_groups_list() { global $settings; $result = array(); if ($settings['enablegroups'] == '1') { $link = connect(); $allgroups = get_all_groups($link); mysql_close($link); $result[] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group")); foreach ($allgroups as $g) { $result[] = $g; } } return $result; }
function date_to_text($unixtime) { if ($unixtime < 60 * 60 * 24 * 30) { return getlocal("Never"); } $then = getdate($unixtime); $now = getdate(); if ($then['yday'] == $now['yday'] && $then['year'] == $now['year']) { return getlocal("Today at {0}", array(format_date($unixtime, 'time'))); } elseif ($then['yday'] + 1 == $now['yday'] && $then['year'] == $now['year']) { return getlocal("Yesterday at {0}", array(format_date($unixtime, 'time'))); } else { return format_date($unixtime, 'full'); } }
function setup_operator_settings_tabs($opId, $active) { global $page, $mibewroot, $settings; loadsettings(); if ($opId) { if ($settings['enablegroups'] == '1') { $page['tabs'] = array(array('title' => getlocal("page_agent.tab.main"), 'link' => "{$mibewroot}/operator/operator.php?op={$opId}"), array('title' => getlocal("page_agent.tab.avatar"), 'link' => "{$mibewroot}/operator/avatar.php?op={$opId}"), array('title' => getlocal("page_agent.tab.groups"), 'link' => "{$mibewroot}/operator/opgroups.php?op={$opId}"), array('title' => getlocal("page_agent.tab.permissions"), 'link' => "{$mibewroot}/operator/permissions.php?op={$opId}")); } else { $page['tabs'] = array(array('title' => getlocal("page_agent.tab.main"), 'link' => "{$mibewroot}/operator/operator.php?op={$opId}"), array('title' => getlocal("page_agent.tab.avatar"), 'link' => "{$mibewroot}/operator/avatar.php?op={$opId}"), array('title' => getlocal("page_agent.tab.permissions"), 'link' => "{$mibewroot}/operator/permissions.php?op={$opId}")); if ($active == 3) { $active--; } } $page['tabselected'] = $active; } else { $page['tabs'] = array(); } }
/** * Builds a page with form for downloading translation file. * * @param Request $request Incoming request. * @return string Rendered page content. */ public function showFormAction(Request $request) { $operator = $this->getOperator(); $target = $request->request->get('target'); if (!preg_match("/^[\\w-]{2,5}\$/", $target)) { $target = get_current_locale(); } // Load list of all available locales. $locales_list = array(); $all_locales = get_available_locales(); foreach ($all_locales as $loc) { $locales_list[] = array('id' => $loc, 'name' => $this->getLocaleName($loc)); } $page['localesList'] = $locales_list; $page['formtarget'] = $target; $page['title'] = getlocal('Translations export'); $page['menuid'] = 'translation'; $page = array_merge($page, prepare_menu($operator)); $page['tabs'] = $this->buildTabs($request); return $this->render('translation_export', $page); }
/** * Builds a page with form for mail template settings. * * @param Request $request Incoming request. * @return string Rendered page content. */ public function showEditFormAction(Request $request) { $operator = $this->getOperator(); $lang = $this->extractLocale($request); $template_name = $request->attributes->get('name'); $page = array('errors' => $request->attributes->get('errors', array())); $template = MailTemplate::loadByName($template_name, $lang); if (!$template) { throw new NotFoundException('The template is not found'); } // Use values from the request or the default ones if they are not // available. $page['formsubject'] = $request->request->get('subject', $template->subject); $page['formbody'] = $request->request->get('body', $template->body); $page['formname'] = $template_name; $page['formlang'] = $lang; $page['formaction'] = $this->generateUrl('mail_template_edit', array('name' => $template_name)); $page['title'] = getlocal('Mail templates'); $page['menuid'] = 'mail_templates'; $page = array_merge($page, prepare_menu($operator)); return $this->render('mail_template_edit', $page); }
/** * Generates "about" page. * * @param Request $request * @return string Rendered page content */ public function indexAction(Request $request) { $page = array_merge( array( 'localizations' => get_available_locales(), 'phpVersion' => phpversion(), 'extensions' => $this->getExtensionsInfo(), 'version' => MIBEW_VERSION, 'title' => getlocal('About'), 'menuid' => 'about', ), prepare_menu($this->getOperator()) ); $this->getAssetManager()->attachJs('js/compiled/about.js'); $this->getAssetManager()->attachJs( 'https://mibew.org/api/updates', AssetManagerInterface::ABSOLUTE_URL ); return $this->render('about', $page); }
setup_logo(); expand("../styles", "{$preview}", "{$show}.tpl"); exit; } if ($show == 'redirect' || $show == 'redirected' || $show == 'agentchat' || $show == 'agentrochat') { setup_chatview_for_operator(array('threadid' => 0, 'userName' => getstring("chat.default.username"), 'remote' => "1.2.3.4", 'agentId' => 1, 'groupid' => 0, 'userid' => 'visitor1', 'locale' => $current_locale, 'ltoken' => $show == 'agentrochat' ? 124 : 123), array('operatorid' => $show == 'agentrochat' ? 2 : 1)); if ($show == 'redirect') { setup_redirect_links(0, $show == 'agentrochat' ? 124 : 123); } elseif ($show == 'redirected') { $page['message'] = getlocal2("chat.redirected.content", array("Administrator")); } $page['redirectLink'] = "{$webimroot}/operator/themes.php?preview={$preview}&show=redirect"; expand("../styles", "{$preview}", "{$show}.tpl"); exit; } $templateList = array(array('label' => getlocal("page.preview.userchat"), 'id' => 'chat', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.chatsimple"), 'id' => 'chatsimple', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.nochat"), 'id' => 'nochat', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.survey"), 'id' => 'survey', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.leavemessage"), 'id' => 'leavemessage', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.leavemessagesent"), 'id' => 'leavemessagesent', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.mail"), 'id' => 'mail', 'h' => 254, 'w' => 603), array('label' => getlocal("page.preview.mailsent"), 'id' => 'mailsent', 'h' => 254, 'w' => 603), array('label' => getlocal("page.preview.redirect"), 'id' => 'redirect', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.redirected"), 'id' => 'redirected', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.agentchat"), 'id' => 'agentchat', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.agentrochat"), 'id' => 'agentrochat', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.error"), 'id' => 'error', 'h' => 480, 'w' => 640)); $template = verifyparam("template", "/^\\w+\$/", "chat"); $page['formpreview'] = $preview; $page['formtemplate'] = $template; $page['canshowerrors'] = $template == 'leavemessage' || $template == 'mail' || $template == 'all'; $page['formshowerr'] = $showerrors; $page['availablePreviews'] = $stylelist; $page['availableTemplates'] = array("chat", "chatsimple", "nochat", "survey", "leavemessage", "leavemessagesent", "mail", "mailsent", "redirect", "redirected", "agentchat", "agentrochat", "error", "all"); $page['showlink'] = "{$webimroot}/operator/themes.php?preview={$preview}&" . ($showerrors ? "showerr=on&" : "") . "show="; $page['previewList'] = array(); foreach ($templateList as $tpl) { if ($tpl['id'] == $template || $template == 'all') { $page['previewList'][] = $tpl; } } prepare_menu($operator);
} } else { $page['formlogin'] = topage($login); $page['formname'] = topage($localname); $page['formemail'] = topage($email); $page['formjabber'] = topage($jabber); $page['formjabbernotify'] = $jabbernotify; $page['formcommonname'] = topage($commonname); $page['opid'] = topage($opId); } } else { if (isset($_GET['op'])) { $opId = verifyparam('op', "/^\\d{1,9}\$/"); $op = operator_by_id($opId); if (!$op) { $errors[] = getlocal("no_such_operator"); $page['opid'] = topage($opId); } else { $page['formlogin'] = topage($op['vclogin']); $page['formname'] = topage($op['vclocalename']); $page['formemail'] = topage($op['vcemail']); $page['formjabber'] = topage($op['vcjabbername']); $page['formjabbernotify'] = $op['inotify'] != 0; $page['formcommonname'] = topage($op['vccommonname']); $page['opid'] = topage($op['operatorid']); } } } if (!$opId && !is_capable($can_administrate, $operator)) { $errors[] = "You are not allowed to create operators"; }
function tpl_content() { global $page, $mibewroot, $errors; ?> <?php if ($page['grid']) { echo getlocal("page.group.intro"); } if (!$page['grid']) { echo getlocal("page.group.create_new"); } ?> <br /> <br /> <?php require_once 'inc_errors.php'; if ($page['stored']) { ?> <div id="formmessage"><?php echo getlocal("data.saved"); ?> </div> <?php } ?> <form name="groupForm" method="post" action="<?php echo $mibewroot; ?> /operator/group.php"> <?php print_csrf_token_input(); ?> <input type="hidden" name="gid" value="<?php echo safe_htmlspecialchars($page['grid']); ?> "/> <div> <?php print_tabbar(); ?> <div class="mform"><div class="formtop"><div class="formtopi"></div></div><div class="forminner"> <div class="fieldForm"> <div class="field"> <div class="flabel"><?php echo getlocal('form.field.groupname'); ?> <span class="required">*</span></div> <div class="fvalue"> <input type="text" name="name" size="40" value="<?php echo form_value('name'); ?> " class="formauth"/> </div> <div class="fdescr"> — <?php echo getlocal('form.field.groupname.description'); ?> </div> <br clear="all"/> </div> <div class="field"> <div class="flabel"><?php echo getlocal('form.field.groupdesc'); ?> </div> <div class="fvalue"> <input type="text" name="description" size="40" value="<?php echo form_value('description'); ?> " class="formauth"/> </div> <div class="fdescr"> — <?php echo getlocal('form.field.groupdesc.description'); ?> </div> <br clear="all"/> </div> <div class="field"> <div class="flabel"><?php echo getlocal('form.field.groupcommonname'); ?> </div> <div class="fvalue"> <input type="text" name="commonname" size="40" value="<?php echo form_value('commonname'); ?> " class="formauth"/> </div> <div class="fdescr"> — <?php echo getlocal('form.field.groupcommonname.description'); ?> </div> <br clear="all"/> </div> <div class="field"> <div class="flabel"><?php echo getlocal('form.field.groupcommondesc'); ?> </div> <div class="fvalue"> <input type="text" name="commondescription" size="40" value="<?php echo form_value('commondescription'); ?> " class="formauth"/> </div> <div class="fdescr"> — <?php echo getlocal('form.field.groupcommondesc.description'); ?> </div> <br clear="all"/> </div> <div class="field"> <div class="flabel"><?php echo getlocal('form.field.mail'); ?> </div> <div class="fvalue"> <input type="text" name="email" size="40" value="<?php echo form_value('email'); ?> " class="formauth"/> </div> <div class="fdescr"> — <?php echo getlocal('form.field.groupemail.description'); ?> </div> <br clear="all"/> </div> <div class="fbutton"> <input type="image" name="save" value="" src="<?php echo $mibewroot . safe_htmlspecialchars(getlocal("image.button.save")); ?> " alt="<?php echo safe_htmlspecialchars(getlocal("button.save")); ?> "/> </div> </div> </div><div class="formbottom"><div class="formbottomi"></div></div></div> </div> <div class="asterisk"> <?php echo getlocal("common.asterisk_explanation"); ?> </div> </form> <?php }