/** * {@inheritdoc} */ public function execute(Template $template, Context $context, $args, $source) { $parsed_args = $template->parseArguments($args); if (count($parsed_args) != 1) { throw new \InvalidArgumentException('"formatDate" helper expects exactly one argument.'); } $timestamp = intval($context->get($parsed_args[0])); return date_to_text($timestamp); }
/** * Generates a page with statistics info. * * @param Request $request * @return string Rendered page content */ public function indexAction(Request $request) { $operator = $this->getOperator(); $statistics_type = $request->attributes->get('type'); $page = array(); $page['operator'] = get_operator_name($operator); $page['availableDays'] = range(1, 31); $page['availableMonth'] = get_month_selection(time() - 400 * 24 * 60 * 60, time() + 50 * 24 * 60 * 60); $page['showresults'] = false; $page['type'] = $statistics_type; $page['showbydate'] = $statistics_type == self::TYPE_BY_DATE; $page['showbyagent'] = $statistics_type == self::TYPE_BY_OPERATOR; $page['showbypage'] = $statistics_type == self::TYPE_BY_PAGE; $cron_uri = $this->generateUrl('cron', array('cron_key' => Settings::get('cron_key')), UrlGeneratorInterface::ABSOLUTE_URL); $page['pageDescription'] = getlocal('From this page you can generate a variety of usage reports. Last time statistics was calculated {0}. You can calculate it <a href="{1}" target="_blank">manually</a>.', array(date_to_text(Settings::get('_last_cron_run')), $cron_uri)); $page['show_invitations_info'] = (bool) Settings::get('enabletracking'); $page['errors'] = array(); // Get and validate time interval $time_interval = $this->extractTimeInterval($request); $start = $time_interval['start']; $end = $time_interval['end']; if ($start > $end) { $page['errors'][] = getlocal('You have selected From date after Till date'); } $page = array_merge($page, set_form_date($start, 'start'), set_form_date($end - 24 * 60 * 60, 'end')); // Get statistics info if ($statistics_type == self::TYPE_BY_DATE) { $statistics = get_by_date_statistics($start, $end); $page['reportByDate'] = $statistics['records']; $page['reportByDateTotal'] = $statistics['total']; } elseif ($statistics_type == self::TYPE_BY_OPERATOR) { $page['reportByAgent'] = get_by_operator_statistics($start, $end); } elseif ($statistics_type == self::TYPE_BY_PAGE) { $page['reportByPage'] = get_by_page_statistics($start, $end); } $page['showresults'] = count($page['errors']) == 0; $page['title'] = getlocal("Statistics"); $page['menuid'] = "statistics"; $page = array_merge($page, prepare_menu($operator)); $page['tabs'] = $this->buildTabs($request); return $this->render('statistics', $page); }
protected function set_up_display() { global $session; $this->user_id = $session->user_id; if (!empty($this->web_address) && isset($this->id)) { $this->link = "<a href='{$this->web_address}'><u>link</u></a>"; $this->todos = "<a href='{$this->web_address}'><u>" . $this->todo . "</u></a>"; } else { $this->todos = $this->todo; } if (isset($this->done) && (int) $this->done === 1) { $this->progress = 100; } if (isset($this->due_date)) { $this->due_on = date_to_text($this->due_date); } if (isset($this->progress)) { $this->prog = "<input type='number' value='" . $this->progress . "' class='dial m-r disabled' data-fgColor='#1AB394' data-width='60' data-height='60'/>"; } }
function tpl_content() { global $page, $mibewroot, $errors; ?> <?php echo getlocal("page_ban.intro"); ?> <br /> <br /> <?php require_once 'inc_errors.php'; ?> <div class="tabletool"> <img src="<?php echo $mibewroot; ?> /images/buttons/createban.gif" border="0" alt=""/> <a href="<?php echo $mibewroot; ?> /operator/ban.php" title="<?php echo safe_htmlspecialchars(getlocal("page_bans.add")); ?> "> <?php echo getlocal("page_bans.add"); ?> </a> </div> <br clear="all"/> <?php if ($page['pagination']) { ?> <table class="list"> <thead> <tr class="header"> <th> <?php echo getlocal("form.field.address"); ?> </th><th> <?php echo getlocal("page_bans.to"); ?> </th><th> <?php echo getlocal("form.field.ban_comment"); ?> </th><th> </th> </tr> </thead> <tbody> <?php if ($page['pagination.items']) { foreach ($page['pagination.items'] as $b) { ?> <tr> <td class="notlast"> <a href="ban.php?id=<?php echo urlencode($b['banid']); ?> " class="man" id="ti<?php echo safe_htmlspecialchars($b['banid']); ?> "> <?php echo safe_htmlspecialchars($b['address']); ?> </a> </td> <td class="notlast"> <?php echo date_to_text($b['till']); ?> </td> <td> <?php if (strlen(topage($b['comment'])) > 30) { echo safe_htmlspecialchars(substr(topage($b['comment']), 0, 30)); } else { echo safe_htmlspecialchars(topage($b['comment'])); } ?> </td> <td> <a class="removelink" id="i<?php echo safe_htmlspecialchars($b['banid']); ?> " href="<?php echo $mibewroot; ?> /operator/blocked.php?act=del&id=<?php echo urlencode($b['banid']); print_csrf_token_in_url(); ?> "> remove </a> </td> </tr> <?php } } else { ?> <tr> <td colspan="4"> <?php echo getlocal("tag.pagination.no_items.elements"); ?> </td> </tr> <?php } ?> </tbody> </table> <?php if ($page['pagination.items']) { echo "<br/>"; echo generate_pagination($page['pagination']); } } ?> <script type="text/javascript" language="javascript"><!-- $('a.removelink').click(function(){ var addr = $("#t"+this.id).text(); return confirm("<?php echo getlocalforJS("page_bans.confirm", array('"+$.trim(addr)+"')); ?> "); }); //--></script> <?php }
function tpl_content() { global $page, $webimroot, $errors; ?> <?php echo getlocal("page.notifications.intro"); ?> <br /> <br /> <?php require_once 'inc_errors.php'; ?> <form name="notifyFilterForm" method="get" action="<?php echo $webimroot; ?> /operator/notifications.php"> <div class="mform"><div class="formtop"><div class="formtopi"></div></div><div class="forminner"> <div class="packedFormField"> <?php echo getlocal("notifications.kind"); ?> <br/> <select name="kind" onchange="this.form.submit();"><?php foreach ($page['allkinds'] as $k) { echo "<option value=\"" . $k . "\"" . ($k == form_value("kind") ? " selected=\"selected\"" : "") . ">" . getlocal("notifications.kind." . ($k ? $k : "all")) . "</option>"; } ?> </select> </div> <div class="packedFormField"> <?php echo getlocal("notifications.locale"); ?> <br/> <select name="lang" onchange="this.form.submit();"><?php foreach ($page['locales'] as $k) { echo "<option value=\"" . $k["id"] . "\"" . ($k["id"] == form_value("lang") ? " selected=\"selected\"" : "") . ">" . $k["name"] . "</option>"; } ?> </select> </div> <br clear="all"/> </div><div class="formbottom"><div class="formbottomi"></div></div></div> </form> <br/> <?php if ($page['pagination']) { ?> <table class="list"> <thead> <tr class="header"> <th> <?php echo getlocal("notifications.head.to"); ?> </th><th> <?php echo getlocal("notifications.head.subj"); ?> </th><th> <?php echo getlocal("notifications.head.msg"); ?> </th><th> <?php echo getlocal("notifications.head.time"); ?> </th> </tr> </thead> <tbody> <?php if ($page['pagination.items']) { foreach ($page['pagination.items'] as $b) { ?> <tr> <td class="notlast"> <a href="<?php echo $webimroot; ?> /operator/notification.php?id=<?php echo $b['id']; ?> " target="_blank" onclick="this.newWindow = window.open('<?php echo $webimroot; ?> /operator/notification.php?id=<?php echo $b['id']; ?> ', '', 'toolbar=0,scrollbars=1,location=0,status=1,menubar=0,width=720,height=520,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;" class="<?php echo $b['vckind'] == 'xmpp' ? 'xmpp' : 'mail'; ?> "> <?php echo htmlspecialchars(shorten(topage($b['vcto']), 30)); ?> </a> </td> <td class="notlast"> <?php echo htmlspecialchars(shorten(topage($b['vcsubject']), 30)); ?> </td> <td class="notlast"> <?php echo htmlspecialchars(shorten(topage($b['tmessage']), 30)); ?> </td> <td> <?php echo date_to_text($b['created']); ?> </td> </tr> <?php } } else { ?> <tr> <td colspan="4"> <?php echo getlocal("tag.pagination.no_items.elements"); ?> </td> </tr> <?php } ?> </tbody> </table> <?php if ($page['pagination.items']) { echo "<br/>"; echo generate_pagination($page['pagination']); } } ?> <?php }
function tpl_content() { global $page, $webimroot, $errors; ?> <?php echo getlocal("page_agents.intro"); ?> <br /> <br /> <?php require_once 'inc_errors.php'; ?> <?php if ($page['canmodify']) { ?> <div class="tabletool"> <img src='<?php echo $webimroot; ?> /images/buttons/createagent.gif' border="0" alt="" /> <a href='<?php echo $webimroot; ?> /operator/operator.php' title="<?php echo getlocal("page_agents.new_agent"); ?> "> <?php echo getlocal("page_agents.new_agent"); ?> </a> </div> <br clear="all"/> <?php } ?> <table class="list"> <thead> <tr class="header"> <th> <?php echo getlocal("page_agents.login"); ?> </th><th> <?php echo getlocal("page_agents.agent_name"); ?> </th><th> <?php echo getlocal("page_agents.status"); if ($page['canmodify']) { ?> </th><th> <?php } ?> </th> </tr> </thead> <tbody> <?php foreach ($page['allowedAgents'] as $a) { ?> <tr> <td class="notlast"> <a id="ti<?php echo $a['operatorid']; ?> " href="<?php echo $webimroot; ?> /operator/operator.php?op=<?php echo $a['operatorid']; ?> " class="man"> <?php echo htmlspecialchars(topage($a['vclogin'])); ?> </a> </td> <td class="notlast"> <?php echo htmlspecialchars(topage($a['vclocalename'])); ?> / <?php echo htmlspecialchars(topage($a['vccommonname'])); ?> </td> <td class="notlast"> <?php if (operator_is_available($a)) { ?> <?php echo getlocal("page_agents.isonline"); } else { if (operator_is_away($a)) { ?> <?php echo getlocal("page_agents.isaway"); } else { ?> <?php echo date_to_text(time() - $a['time']); } } ?> </td> <?php if ($page['canmodify']) { ?> <td> <a class="removelink" id="i<?php echo $a['operatorid']; ?> " href="<?php echo $webimroot; ?> /operator/operators.php?act=del&id=<?php echo $a['operatorid']; print_csrf_token_in_url(); ?> "> remove </a> </td> <?php } ?> </tr> <?php } ?> </tbody> </table> <script type="text/javascript" language="javascript"><!-- $('a.removelink').click(function(){ var login = $("#t"+this.id).text(); return confirm("<?php echo getlocalforJS("page_agents.confirm", array('"+$.trim(login)+"')); ?> "); }); //--></script> <?php }
function tpl_content() { global $page, $mibewroot, $errors; $notification = $page['notification']; ?> <?php echo getlocal("notification.intro"); ?> <br/><br/> <div class="logpane"> <div class="header"> <div class="wlabel"> <?php echo getlocal("notification.label.to"); ?> : </div> <div class="wvalue"> <?php echo topage(safe_htmlspecialchars($notification['vcto'])); ?> </div> <br clear="all"/> <div class="wlabel"> <?php echo getlocal("notification.label.time"); ?> : </div> <div class="wvalue"> <?php echo date_to_text($notification['created']); ?> </div> <br clear="all"/> <div class="wlabel"> <?php echo getlocal("notification.label.subj"); ?> : </div> <div class="wvalue"> <?php echo topage(safe_htmlspecialchars($notification['vcsubject'])); ?> </div> <br clear="all"/> </div> <div class="message"> <?php echo topage(prepare_html_message($notification['tmessage'])); ?> </div> </div> <br /> <a href="<?php echo $mibewroot; ?> /operator/notifications.php"> <?php echo getlocal("notification.back_to_list"); ?> </a> <br /> <?php }
function tpl_content() { global $page, $webimroot, $errors; ?> <?php echo getlocal("page.groups.intro"); ?> <br /> <br /> <?php require_once 'inc_errors.php'; ?> <?php if ($page['canmodify']) { ?> <div class="tabletool"> <img src='<?php echo $webimroot; ?> /images/buttons/createdep.gif' border="0" alt="" /> <a href='<?php echo $webimroot; ?> /operator/group.php' title="<?php echo getlocal("page.groups.new"); ?> "> <?php echo getlocal("page.groups.new"); ?> </a> </div> <br clear="all"/> <?php } ?> <table class="list"> <thead> <tr class="header"> <th> <?php echo getlocal("form.field.groupname"); ?> </th><th> <?php echo getlocal("form.field.groupdesc"); ?> </th><th> <?php echo getlocal("page_agents.status"); ?> </th><th> <?php echo getlocal("page.group.membersnum"); if ($page['canmodify']) { ?> </th><th> <?php } ?> </th> </tr> </thead> <tbody> <?php if (count($page['groups']) > 0) { foreach ($page['groups'] as $grp) { ?> <tr> <td class="notlast"> <a href="<?php echo $webimroot; ?> /operator/group.php?gid=<?php echo $grp['groupid']; ?> " id="ti<?php echo $grp['groupid']; ?> " class="man"> <?php echo htmlspecialchars(topage($grp['vclocalname'])); ?> </a> </td> <td class="notlast"> <?php echo $grp['vclocaldescription'] ? htmlspecialchars(topage($grp['vclocaldescription'])) : "<none>"; ?> </td> <td class="notlast"> <?php if (is_online($grp)) { ?> <?php echo getlocal("page.groups.isonline"); } else { if (is_away($grp)) { ?> <?php echo getlocal("page.groups.isaway"); } else { ?> <?php echo date_to_text(time() - ($grp['ilastseen'] ? $grp['ilastseen'] : time())); } } ?> </td> <td> <a href="<?php echo $webimroot; ?> /operator/groupmembers.php?gid=<?php echo $grp['groupid']; ?> "> <?php echo htmlspecialchars(topage($grp['inumofagents'])); ?> </a> </td> <?php if ($page['canmodify']) { ?> <td> <a href="<?php echo $webimroot; ?> /operator/groups.php?act=del&gid=<?php echo $grp['groupid']; ?> " id="i<?php echo $grp['groupid']; ?> " class="removelink"> remove </a> </td> <?php } ?> </tr> <?php } } else { ?> <tr> <td colspan="4"> <?php echo getlocal("tag.pagination.no_items.elements"); ?> </td> </tr> <?php } ?> </tbody> </table> <script type="text/javascript" language="javascript"><!-- $('a.removelink').click(function(){ var groupname = $("#t"+this.id).text(); return confirm("<?php echo getlocalforJS("page.groups.confirm", array('"+$.trim(groupname)+"')); ?> "); }); //--></script> <?php }
function tpl_content() { global $page, $webimroot, $errors; $chatthread = $page['thread']; ?> <?php echo getlocal("thread.intro"); ?> <br/><br/> <div class="logpane"> <div class="header"> <div class="wlabel"> <?php echo getlocal("page.analysis.search.head_name"); ?> : </div> <div class="wvalue"> <?php echo topage(htmlspecialchars($chatthread['userName'])); ?> </div> <br clear="all"/> <div class="wlabel"> <?php echo getlocal("page.analysis.search.head_host"); ?> : </div> <div class="wvalue"> <?php echo get_user_addr(topage($chatthread['remote'])); ?> </div> <br clear="all"/> <div class="wlabel"> <?php echo getlocal("page.analysis.search.head_browser"); ?> : </div> <div class="wvalue"> <?php echo get_useragent_version(topage($chatthread['userAgent'])); ?> </div> <br clear="all"/> <?php if ($chatthread['groupName']) { ?> <div class="wlabel"> <?php echo getlocal("page.analysis.search.head_group"); ?> : </div> <div class="wvalue"> <?php echo topage(htmlspecialchars($chatthread['groupName'])); ?> </div> <br clear="all"/> <?php } ?> <?php if ($chatthread['agentName']) { ?> <div class="wlabel"> <?php echo getlocal("page.analysis.search.head_operator"); ?> : </div> <div class="wvalue"> <?php echo topage(htmlspecialchars($chatthread['agentName'])); ?> </div> <br clear="all"/> <?php } ?> <div class="wlabel"> <?php echo getlocal("page.analysis.search.head_time"); ?> : </div> <div class="wvalue"> <?php echo date_diff_to_text($chatthread['modified'] - $chatthread['created']); ?> (<?php echo date_to_text($chatthread['created']); ?> ) </div> <br clear="all"/> </div> <div class="message"> <?php foreach ($page['threadMessages'] as $message) { echo $message; } ?> </div> </div> <br /> <a href="<?php echo $webimroot; ?> /operator/history.php"> <?php echo getlocal("thread.back_to_search"); ?> </a> <br /> <?php }
/** * Generates a page with user tracking information. * * @param Request $request * @return string Rendered page content */ public function userTrackAction(Request $request) { if (Settings::get('enabletracking') == '0') { throw new BadRequestException('Tracking is disabled.'); } if ($request->query->has('thread')) { $thread_id = $request->query->get('thread'); if (!preg_match("/^\\d{1,8}\$/", $thread_id)) { throw new BadRequestException('Wrong thread ID.'); } $visitor = track_get_visitor_by_thread_id($thread_id); if (!$visitor) { throw new BadRequestException('Wrong thread.'); } } else { $visitor_id = $request->query->get('visitor'); if (!preg_match("/^\\d{1,8}\$/", $visitor_id)) { throw new BadRequestException('Wrong visitor ID.'); } $visitor = track_get_visitor_by_id($visitor_id); if (!$visitor) { throw new BadRequestException('Wrong visitor.'); } } $path = track_get_path($visitor); $page['entry'] = htmlspecialchars($visitor['entry']); $page['history'] = array(); ksort($path); foreach ($path as $k => $v) { $page['history'][] = array('date' => date_to_text($k), 'link' => htmlspecialchars($v)); } $page['title'] = getlocal('Tracked path of visitor'); $page['show_small_login'] = false; return $this->render('tracked', $page); }
function tpl_content() { global $page, $mibewroot; ?> <?php echo getlocal("page_search.intro"); ?> <br /> <br /> <form name="searchForm" method="get" action="<?php echo $mibewroot; ?> /operator/history.php"> <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("page_analysis.full.text.search"); ?> </div> <div class="fvaluenodesc"> <div id="searchtext"> <input type="text" name="q" size="80" value="<?php echo form_value('q'); ?> " class="formauth"/> </div> <div id="searchbutton"> <input type="image" name="search" src="<?php echo $mibewroot . safe_htmlspecialchars(getlocal("image.button.search")); ?> " alt="<?php echo safe_htmlspecialchars(getlocal("button.search")); ?> "/> </div> </div> <br clear="all"/> </div> </div> </div><div class="formbottom"><div class="formbottomi"></div></div></div> </form> <br/> <?php if ($page['pagination']) { ?> <table class="list"> <thead> <tr class="header"> <th> <?php echo getlocal("page.analysis.search.head_name"); ?> </th><th> <?php echo getlocal("page.analysis.search.head_host"); ?> </th><th> <?php echo getlocal("page.analysis.search.head_operator"); ?> </th><th> <?php echo getlocal("page.analysis.search.head_messages"); ?> </th><th> <?php echo getlocal("page.analysis.search.head_time"); ?> </th></tr> </thead> <tbody> <?php if ($page['pagination.items']) { foreach ($page['pagination.items'] as $chatthread) { ?> <tr> <td> <a href="<?php echo $mibewroot; ?> /operator/threadprocessor.php?threadid=<?php echo urlencode($chatthread['threadid']); ?> " target="_blank" onclick="this.newWindow = window.open('<?php echo $mibewroot; ?> /operator/threadprocessor.php?threadid=<?php echo urlencode($chatthread['threadid']); ?> ', '', 'toolbar=0,scrollbars=1,location=0,status=1,menubar=0,width=720,height=520,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;"><?php echo topage(safe_htmlspecialchars($chatthread['userName'])); ?> </a> </td> <td> <?php echo get_user_addr(topage($chatthread['remote'])); ?> </td> <td> <?php if ($chatthread['agentName']) { echo topage(safe_htmlspecialchars($chatthread['agentName'])); } else { if ($chatthread['groupid'] && $chatthread['groupid'] != 0 && isset($page['groupName'][$chatthread['groupid']])) { echo "- " . topage(safe_htmlspecialchars($page['groupName'][$chatthread['groupid']])) . " -"; } } ?> </td> <td> <?php echo topage(safe_htmlspecialchars($chatthread['size'])); ?> </td> <td> <?php echo date_diff_to_text($chatthread['modified'] - $chatthread['created']); ?> , <?php echo date_to_text($chatthread['created']); ?> </td> </tr> <?php } } else { ?> <tr> <td colspan="5"> <?php echo getlocal("tag.pagination.no_items"); ?> </td> </tr> <?php } ?> </tbody> </table> <?php if ($page['pagination.items']) { echo "<br/>"; echo generate_pagination($page['pagination']); } } ?> <?php }
function tpl_content() { global $page, $mibewroot; ?> <?php echo getlocal("page.analysis.userhistory.intro"); ?> <br /> <br /> <?php if ($page['pagination']) { ?> <table class="list"> <thead> <tr class="header"> <th> <?php echo getlocal("page.analysis.search.head_name"); ?> </th><th> <?php echo getlocal("page.analysis.search.head_host"); ?> </th><th> <?php echo getlocal("page.analysis.search.head_operator"); ?> </th><th> <?php echo getlocal("page.analysis.search.head_time"); ?> </th></tr> </thead> <tbody> <?php if ($page['pagination.items']) { foreach ($page['pagination.items'] as $chatthread) { ?> <tr> <td> <a href="<?php echo $mibewroot; ?> /operator/threadprocessor.php?threadid=<?php echo urlencode($chatthread['threadid']); ?> " target="_blank" onclick="this.newWindow = window.open('<?php echo $mibewroot; ?> /operator/threadprocessor.php?threadid=<?php echo urlencode($chatthread['threadid']); ?> ', '', 'toolbar=0,scrollbars=1,location=0,status=1,menubar=0,width=720,height=520,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;"><?php echo topage(safe_htmlspecialchars($chatthread['userName'])); ?> </a> </td> <td> <?php echo get_user_addr(topage($chatthread['remote'])); ?> </td> <td> <?php if ($chatthread['agentName']) { echo topage(safe_htmlspecialchars($chatthread['agentName'])); } ?> </td> <td> <?php echo date_diff_to_text($chatthread['modified'] - $chatthread['created']); ?> , <?php echo date_to_text($chatthread['created']); ?> </td> </tr> <?php } } else { ?> <tr> <td colspan="5"> <?php echo getlocal("tag.pagination.no_items"); ?> </td> </tr> <?php } ?> </tbody> </table> <?php if ($page['pagination.items']) { echo "<br/>"; echo generate_pagination($page['pagination']); } } ?> <?php }