Ejemplo n.º 1
0
function demo_print_message($msg, $format)
{
    global $webim_encoding;
    if ($format == "xml") {
        print "<message>" . myiconv($webim_encoding, "utf-8", escape_with_cdata(message_to_html($msg))) . "</message>\n";
    } else {
        print topage(message_to_html($msg));
    }
}
Ejemplo n.º 2
0
}
$groupid = verifyparam("gid", "/^\\d{1,10}\$/");
$page = array('groupid' => $groupid);
$page['operators'] = get_operators();
$errors = array();
$group = group_by_id($groupid);
if (!$group) {
    $errors[] = getlocal("page.group.no_such");
} else {
    if (isset($_POST['gid'])) {
        $new_members = array();
        foreach ($page['operators'] as $op) {
            if (verifyparam("op" . $op['operatorid'], "/^on\$/", "") == "on") {
                $new_members[] = $op['operatorid'];
            }
        }
        update_group_members($groupid, $new_members);
        header("Location: {$mibewroot}/operator/groupmembers.php?gid=" . intval($groupid) . "&stored");
        exit;
    }
}
$page['formop'] = array();
$page['currentgroup'] = $group ? topage($group['vclocalname']) : "";
foreach (get_group_members($groupid) as $rel) {
    $page['formop'][] = $rel['operatorid'];
}
$page['stored'] = isset($_GET['stored']);
prepare_menu($operator);
setup_group_settings_tabs($groupid, 1);
start_html_output();
require '../view/groupmembers.php';
Ejemplo n.º 3
0
function tpl_content()
{
    global $page, $webimroot;
    ?>

<?php 
    echo getlocal("page.translate.descr");
    ?>
<br />
<br />

<form name="translateForm" method="get" action="<?php 
    echo $webimroot;
    ?>
/operator/translate.php">
	
	<div class="mform"><div class="formtop"><div class="formtopi"></div></div><div class="forminner">

	<div class="packedFormField">
		<?php 
    echo getlocal("translate.direction");
    ?>
<br/>
		<select name="source" onchange="this.form.submit();"><?php 
    foreach ($page['availableLocales'] as $k) {
        echo "<option value=\"" . $k["id"] . "\"" . ($k["id"] == form_value("source") ? " selected=\"selected\"" : "") . ">" . $k["name"] . "</option>";
    }
    ?>
</select>
		=&gt;
		<select name="target" onchange="this.form.submit();"><?php 
    foreach ($page['availableLocales'] as $k) {
        echo "<option value=\"" . $k["id"] . "\"" . ($k["id"] == form_value("target") ? " selected=\"selected\"" : "") . ">" . $k["name"] . "</option>";
    }
    ?>
</select>
	</div>
	
	<div class="packedFormField">
		<?php 
    echo getlocal("translate.sort");
    ?>
<br/>
		<select name="sort" onchange="this.form.submit();"><?php 
    foreach ($page['availableOrders'] as $k) {
        echo "<option value=\"" . $k["id"] . "\"" . ($k["id"] == form_value("sort") ? " selected=\"selected\"" : "") . ">" . $k["name"] . "</option>";
    }
    ?>
</select>
	</div>
	
	<div class="packedFormField">
		<?php 
    echo getlocal("translate.show");
    ?>
<br/>
		<select name="show" onchange="this.form.submit();"><?php 
    foreach ($page['showOptions'] as $k) {
        echo "<option value=\"" . $k["id"] . "\"" . ($k["id"] == form_value("show") ? " 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']) {
        if ($page['pagination.items']) {
            echo generate_pagination($page['pagination'], false);
        }
        ?>

<table class="translate">
<thead>
	<tr class="header"><th>
		Key
	</th><th>
		<?php 
        echo topage($page['title1']);
        ?>
	</th><th>
		<?php 
        echo topage($page['title2']);
        ?>
	</th></tr>
</thead>
<tbody>
<?php 
        if ($page['pagination.items']) {
            foreach ($page['pagination.items'] as $localstr) {
                ?>
	<tr>
		<td>
			<a href="<?php 
                echo $webimroot;
                ?>
/operator/translate.php?source=<?php 
                echo $page['lang1'];
                ?>
&amp;target=<?php 
                echo $page['lang2'];
                ?>
&amp;key=<?php 
                echo $localstr['id'];
                ?>
" target="_blank" onclick="this.newWindow = window.open('<?php 
                echo $webimroot;
                ?>
/operator/translate.php?source=<?php 
                echo $page['lang1'];
                ?>
&amp;target=<?php 
                echo $page['lang2'];
                ?>
&amp;key=<?php 
                echo $localstr['id'];
                ?>
', '', 'toolbar=0,scrollbars=1,location=0,status=1,menubar=0,width=640,height=480,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;"><?php 
                echo topage($localstr['id']);
                ?>
</a>
		</td>
		<td>
			<?php 
                echo topage($localstr['l1']);
                ?>
		</td>
		<td>
			<?php 
                echo topage($localstr['l2']);
                ?>
		</td>
	</tr>
<?php 
            }
        } else {
            ?>
	<tr>
	<td colspan="3">
		<?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 
}
Ejemplo n.º 4
0
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&amp;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 
}
Ejemplo n.º 5
0
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 
}
Ejemplo n.º 6
0
        if ($thread['istate'] == $state_chatting) {
            $link = connect();
            commit_thread($threadid, array("istate" => intval($state_waiting), "nextagent" => 0, "groupid" => intval($nextid), "agentId" => 0, "agentName" => "''"), $link);
            post_message_($thread['threadid'], $kind_events, getstring2_("chat.status.operator.redirect", array(get_operator_name($operator)), $thread['locale'], true), $link);
            mysql_close($link);
        } else {
            $errors[] = getlocal("chat.redirect.cannot");
        }
    } else {
        $errors[] = getlocal("chat.redirect.unknown_group");
    }
} else {
    $nextid = verifyparam("nextAgent", "/^\\d{1,10}\$/");
    $nextOperator = operator_by_id($nextid);
    if ($nextOperator) {
        $page['message'] = getlocal2("chat.redirected.content", array(safe_htmlspecialchars(topage(get_operator_name($nextOperator)))));
        if ($thread['istate'] == $state_chatting) {
            $link = connect();
            $threadupdate = array("istate" => intval($state_waiting), "nextagent" => intval($nextid), "agentId" => 0);
            if ($thread['groupid'] != 0) {
                if (FALSE === select_one_row("select groupid from {$mysqlprefix}chatgroupoperator where operatorid = " . intval($nextid) . " and groupid = " . intval($thread['groupid']), $link)) {
                    $threadupdate['groupid'] = 0;
                }
            }
            commit_thread($threadid, $threadupdate, $link);
            post_message_($thread['threadid'], $kind_events, getstring2_("chat.status.operator.redirect", array(get_operator_name($operator)), $thread['locale'], true), $link);
            mysql_close($link);
        } else {
            $errors[] = getlocal("chat.redirect.cannot");
        }
    } else {
Ejemplo n.º 7
0
function prepare_menu($operator, $hasright = true)
{
    global $page, $settings, $can_administrate, $can_viewnotifications;
    $page['operator'] = topage(get_operator_name($operator));
    if ($hasright) {
        loadsettings();
        $page['showban'] = $settings['enableban'] == "1";
        $page['showgroups'] = $settings['enablegroups'] == "1";
        $page['showstat'] = $settings['enablestatistics'] == "1";
        $page['shownotifications'] = is_capable($can_viewnotifications, $operator);
        $page['showadmin'] = is_capable($can_administrate, $operator);
        $page['currentopid'] = $operator['operatorid'];
    }
}
Ejemplo n.º 8
0
function tpl_content()
{
    global $page, $mibewroot, $errors;
    ?>

<?php 
    echo safe_htmlspecialchars(getlocal("page.groupmembers.intro"));
    ?>
<br />
<br />
<?php 
    require_once 'inc_errors.php';
    if ($page['stored']) {
        ?>
<div id="formmessage"><?php 
        echo safe_htmlspecialchars(getlocal("data.saved"));
        ?>
</div>
<?php 
    }
    ?>

<form name="membersForm" method="post" action="<?php 
    echo $mibewroot;
    ?>
/operator/groupmembers.php">
<?php 
    print_csrf_token_input();
    ?>
<input type="hidden" name="gid" value="<?php 
    echo safe_htmlspecialchars($page['groupid']);
    ?>
"/>
	<div>
<?php 
    print_tabbar();
    ?>
	<div class="mform"><div class="formtop"><div class="formtopi"></div></div><div class="forminner">

	<p>
		<b><?php 
    echo safe_htmlspecialchars($page['currentgroup']);
    ?>
</b>
	</p>
<?php 
    foreach ($page['operators'] as $pm) {
        ?>
	<div class="field">
		<div class="fvaluenodesc">
			<input type="checkbox" name="op<?php 
        echo safe_htmlspecialchars($pm['operatorid']);
        ?>
" value="on"<?php 
        echo form_value_mb('op', $pm['operatorid']) ? " checked=\"checked\"" : "";
        ?>
/>
			<?php 
        echo safe_htmlspecialchars(topage($pm['vclocalename']));
        ?>
 (<a href="operator.php?op=<?php 
        echo urlencode($pm['operatorid']);
        ?>
"
				><?php 
        echo safe_htmlspecialchars(topage($pm['vclogin']));
        ?>
</a>)
		</div>
	</div>
<?php 
    }
    ?>

	<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 class="formbottom"><div class="formbottomi"></div></div></div>
	</div>
</form>

<?php 
}
Ejemplo n.º 9
0
}
$groupid = verifyparam("gid", "/^\\d{1,9}\$/");
$page = array('groupid' => $groupid);
$page['operators'] = get_operators();
$errors = array();
$group = group_by_id($groupid);
if (!$group) {
    $errors[] = getlocal("page.group.no_such");
} else {
    if (isset($_POST['gid'])) {
        $new_members = array();
        foreach ($page['operators'] as $op) {
            if (verifyparam("op" . $op['operatorid'], "/^on\$/", "") == "on") {
                $new_members[] = $op['operatorid'];
            }
        }
        update_group_members($groupid, $new_members);
        header("Location: {$webimroot}/operator/groupmembers.php?gid={$groupid}&stored");
        exit;
    }
}
$page['formop'] = array();
$page['currentgroup'] = $group ? topage(htmlspecialchars($group['vclocalname'])) : "";
foreach (get_group_members($groupid) as $rel) {
    $page['formop'][] = $rel['operatorid'];
}
$page['stored'] = isset($_GET['stored']);
prepare_menu($operator);
setup_group_settings_tabs($groupid, 1);
start_html_output();
require '../view/groupmembers.php';
Ejemplo n.º 10
0
 *    Pavel Petroshenko - initial API and implementation
 */
require_once '../libs/common.php';
require_once '../libs/operator.php';
require_once '../libs/chat.php';
require_once '../libs/userinfo.php';
require_once '../libs/pagination.php';
$operator = check_login();
loadsettings();
setlocale(LC_TIME, getstring("time.locale"));
$page = array();
$query = isset($_GET['q']) ? myiconv(getoutputenc(), $webim_encoding, $_GET['q']) : false;
if ($query !== false) {
    $link = connect();
    $result = mysql_query("select {$mysqlprefix}chatgroup.groupid as groupid, vclocalname " . "from {$mysqlprefix}chatgroup order by vclocalname", $link);
    $groupName = array();
    while ($group = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $groupName[$group['groupid']] = $group['vclocalname'];
    }
    mysql_free_result($result);
    $page['groupName'] = $groupName;
    $escapedQuery = mysql_real_escape_string($query, $link);
    select_with_pagintation("DISTINCT unix_timestamp({$mysqlprefix}chatthread.dtmcreated) as created, " . "unix_timestamp({$mysqlprefix}chatthread.dtmmodified) as modified, {$mysqlprefix}chatthread.threadid, " . "{$mysqlprefix}chatthread.remote, {$mysqlprefix}chatthread.agentName, {$mysqlprefix}chatthread.userName, groupid, " . "messageCount as size", "{$mysqlprefix}chatthread, {$mysqlprefix}chatmessage", array("{$mysqlprefix}chatmessage.threadid = {$mysqlprefix}chatthread.threadid", "(({$mysqlprefix}chatthread.userName LIKE '%%{$escapedQuery}%%') or ({$mysqlprefix}chatmessage.tmessage LIKE '%%{$escapedQuery}%%'))"), "order by created DESC", "DISTINCT {$mysqlprefix}chatthread.dtmcreated", $link);
    mysql_close($link);
    $page['formq'] = topage($query);
} else {
    setup_empty_pagination();
}
prepare_menu($operator);
start_html_output();
require '../view/thread_search.php';
Ejemplo n.º 11
0
Archivo: ban.php Proyecto: kuell/chat
} else {
    if (isset($_GET['id'])) {
        $banId = verifyparam('id', "/^\\d{1,10}\$/");
        $link = connect();
        $ban = select_one_row("select banid,(unix_timestamp(dtmtill)-unix_timestamp(CURRENT_TIMESTAMP)) as days,address,comment from {$mysqlprefix}chatban where banid = " . intval($banId), $link);
        mysql_close($link);
        if ($ban) {
            $page['banId'] = topage($ban['banid']);
            $page['formaddress'] = topage($ban['address']);
            $page['formdays'] = topage(round($ban['days'] / 86400));
            $page['formcomment'] = topage($ban['comment']);
        } else {
            $errors[] = "Wrong id";
        }
    } else {
        if (isset($_GET['thread'])) {
            $threadid = verifyparam('thread', "/^\\d{1,10}\$/");
            $thread = thread_by_id($threadid);
            if ($thread) {
                $page['thread'] = topage($thread['userName']);
                $page['threadid'] = $threadid;
                $page['formaddress'] = topage($thread['remote']);
                $page['formdays'] = 15;
            }
        }
    }
}
prepare_menu($operator, false);
start_html_output();
require '../view/ban.php';
exit;
Ejemplo n.º 12
0
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 
}
Ejemplo n.º 13
0
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 
}
Ejemplo n.º 14
0
        }
    } else {
        $page['formname'] = topage($name);
        $page['formdescription'] = topage($description);
        $page['formcommonname'] = topage($commonname);
        $page['formcommondescription'] = topage($commondescription);
        $page['formemail'] = topage($email);
        $page['grid'] = topage($groupid);
    }
} else {
    if (isset($_GET['gid'])) {
        $groupid = verifyparam('gid', "/^\\d{1,9}\$/");
        $group = group_by_id($groupid);
        if (!$group) {
            $errors[] = getlocal("page.group.no_such");
            $page['grid'] = topage($groupid);
        } else {
            $page['formname'] = topage($group['vclocalname']);
            $page['formdescription'] = topage($group['vclocaldescription']);
            $page['formcommonname'] = topage($group['vccommonname']);
            $page['formcommondescription'] = topage($group['vccommondescription']);
            $page['formemail'] = topage($group['vcemail']);
            $page['grid'] = topage($group['groupid']);
        }
    }
}
$page['stored'] = isset($_GET['stored']);
prepare_menu($operator);
setup_group_settings_tabs($groupid, 0);
start_html_output();
require '../view/group.php';
Ejemplo n.º 15
0
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
require_once '../libs/common.php';
require_once '../libs/chat.php';
require_once '../libs/operator.php';
$operator = check_login();
setlocale(LC_TIME, getstring("time.locale"));
$page = array();
$page['operator'] = topage(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;
$errors = array();
if (isset($_GET['startday'])) {
    $startday = verifyparam("startday", "/^\\d+\$/");
    $startmonth = verifyparam("startmonth", "/^\\d{2}.\\d{2}\$/");
    $endday = verifyparam("endday", "/^\\d+\$/");
    $endmonth = verifyparam("endmonth", "/^\\d{2}.\\d{2}\$/");
    $start = get_form_date($startday, $startmonth);
    $end = get_form_date($endday, $endmonth) + 24 * 60 * 60;
} else {
    $curr = getdate(time());
    if ($curr['mday'] < 7) {
        // previous month
Ejemplo n.º 16
0
function tpl_content()
{
    global $page, $mibewroot, $errors;
    ?>

<?php 
    echo getlocal("operator.groups.intro");
    ?>
<br />
<br />
<?php 
    require_once 'inc_errors.php';
    if ($page['stored']) {
        ?>
<div id="formmessage"><?php 
        echo getlocal("data.saved");
        ?>
</div>
<?php 
    }
    ?>

<form name="opgroupsForm" method="post" action="<?php 
    echo $mibewroot;
    ?>
/operator/opgroups.php">
<?php 
    print_csrf_token_input();
    ?>
<input type="hidden" name="op" value="<?php 
    echo safe_htmlspecialchars($page['opid']);
    ?>
"/>
	<div>
<?php 
    print_tabbar();
    ?>
	<div class="mform"><div class="formtop"><div class="formtopi"></div></div><div class="forminner">

	<p>
		<b><?php 
    echo safe_htmlspecialchars($page['currentop']);
    ?>
&lrm;</b>
	</p>
<?php 
    foreach ($page['groups'] as $pm) {
        ?>
	<div class="field">
		<div class="flabel"><?php 
        echo safe_htmlspecialchars(topage($pm['vclocalname']));
        ?>
</div>
		<div class="fvalue">
			<input type="checkbox" name="group<?php 
        echo safe_htmlspecialchars($pm['groupid']);
        ?>
" value="on"<?php 
        echo form_value_mb('group', $pm['groupid']) ? " checked=\"checked\"" : "";
        echo $page['canmodify'] ? "" : " disabled=\"disabled\"";
        ?>
/>
		</div>
		<div class="fdescr"> &mdash; <?php 
        echo $pm['vclocaldescription'] ? safe_htmlspecialchars(topage($pm['vclocaldescription'])) : getlocal("operator.group.no_description");
        ?>
</div>
		<br clear="all"/>
	</div>
<?php 
    }
    ?>

<?php 
    if ($page['canmodify']) {
        ?>
	<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>
<?php 
    }
    ?>
	</div><div class="formbottom"><div class="formbottomi"></div></div></div>
	</div>
</form>

<?php 
}
Ejemplo n.º 17
0
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'])) : "&lt;none&gt;";
            ?>
	</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&amp;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 
}
Ejemplo n.º 18
0
        foreach (preg_split("/,/", $params['geolinkparams']) as $oneparam) {
            if (!preg_match("/^\\s*(toolbar|scrollbars|location|status|menubar|width|height|resizable)=\\d{1,4}\$/", $oneparam)) {
                $errors[] = "Wrong link parameter: \"{$oneparam}\", should be one of 'toolbar, scrollbars, location, status, menubar, width, height or resizable'";
            }
        }
    }
    if (count($errors) == 0) {
        foreach ($options as $opt) {
            $settings[$opt] = $params[$opt];
        }
        update_settings();
        header("Location: {$webimroot}/operator/settings.php?stored");
        exit;
    }
}
$page['formemail'] = topage($params['email']);
$page['formtitle'] = topage($params['title']);
$page['formlogo'] = topage($params['logo']);
$page['formhosturl'] = topage($params['hosturl']);
$page['formgeolink'] = topage($params['geolink']);
$page['formgeolinkparams'] = topage($params['geolinkparams']);
$page['formusernamepattern'] = topage($params['usernamepattern']);
$page['formchatstyle'] = $params['chatstyle'];
$page['formchattitle'] = topage($params['chattitle']);
$page['formsendmessagekey'] = $params['sendmessagekey'];
$page['availableStyles'] = $stylelist;
$page['stored'] = isset($_GET['stored']);
prepare_menu($operator);
setup_settings_tabs(0);
start_html_output();
require '../view/settings.php';
Ejemplo n.º 19
0
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 
}
Ejemplo n.º 20
0
function tpl_content()
{
    global $page, $webimroot, $errors;
    ?>

<?php 
    echo getlocal("statistics.description");
    ?>
<br />
<br />
<?php 
    require_once 'inc_errors.php';
    ?>

<form name="statisticsForm" method="get" action="<?php 
    echo $webimroot;
    ?>
/operator/statistics.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("statistics.dates");
    ?>
</div>
			<div class="fvaluenodesc">
				<div class="searchctrl">
					<?php 
    echo getlocal("statistics.from");
    ?>
					<select name="startday"><?php 
    foreach ($page['availableDays'] as $k) {
        echo "<option value=\"" . $k . "\"" . ($k == form_value("startday") ? " selected=\"selected\"" : "") . ">" . $k . "</option>";
    }
    ?>
</select>
			
					<select name="startmonth"><?php 
    foreach ($page['availableMonth'] as $k => $v) {
        echo "<option value=\"" . $k . "\"" . ($k == form_value("startmonth") ? " selected=\"selected\"" : "") . ">" . $v . "</option>";
    }
    ?>
</select>
				</div>
				<div class="searchctrl">
					<?php 
    echo getlocal("statistics.till");
    ?>
					<select name="endday"><?php 
    foreach ($page['availableDays'] as $k) {
        echo "<option value=\"" . $k . "\"" . ($k == form_value("endday") ? " selected=\"selected\"" : "") . ">" . $k . "</option>";
    }
    ?>
</select>
			
					<select name="endmonth"><?php 
    foreach ($page['availableMonth'] as $k => $v) {
        echo "<option value=\"" . $k . "\"" . ($k == form_value("endmonth") ? " selected=\"selected\"" : "") . ">" . $v . "</option>";
    }
    ?>
</select>
				</div>
				<div id="searchbutton">
					<input type="image" name="search" src='<?php 
    echo $webimroot . getlocal("image.button.search");
    ?>
' alt='<?php 
    echo getlocal("button.search");
    ?>
'/>
				</div>
			</div>
			<br clear="all"/>
		</div>
	</div>

	</div><div class="formbottom"><div class="formbottomi"></div></div></div>
</form>

<?php 
    if ($page['showresults']) {
        ?>

<br/>
<br/>

<div class="tabletitle">
<?php 
        echo getlocal("report.bydate.title");
        ?>
</div>
<table class="statistics">
<thead>
<tr><th>
	<?php 
        echo getlocal("report.bydate.1");
        ?>
</th><th>
	<?php 
        echo getlocal("report.bydate.2");
        ?>
</th><th>
	<?php 
        echo getlocal("report.bydate.3");
        ?>
</th><th>
	<?php 
        echo getlocal("report.bydate.4");
        ?>
</th></tr>
</thead>
<tbody>
<?php 
        if ($page['reportByDate']) {
            ?>
	<?php 
            foreach ($page['reportByDate'] as $row) {
                ?>
	<tr>
		<td><?php 
                echo $row['date'];
                ?>
</td>
		<td><?php 
                echo $row['threads'];
                ?>
</td>
		<td><?php 
                echo $row['agents'];
                ?>
</td>
		<td><?php 
                echo $row['users'];
                ?>
</td>
	</tr>
	<?php 
            }
            ?>
	<tr>
		<td><b><?php 
            echo getlocal("report.total");
            ?>
</b></td>
		<td><?php 
            echo $page['reportByDateTotal']['threads'];
            ?>
</td>
		<td><?php 
            echo $page['reportByDateTotal']['agents'];
            ?>
</td>
		<td><?php 
            echo $page['reportByDateTotal']['users'];
            ?>
</td>
	</tr>
<?php 
        } else {
            ?>
	<tr>
	<td colspan="4">
		<?php 
            echo getlocal("report.no_items");
            ?>
	</td>
	</tr>
<?php 
        }
        ?>
</tbody>
</table>

<br/>
<br/>

<div class="tabletitle"><?php 
        echo getlocal("report.byoperator.title");
        ?>
</div>
<table class="statistics">
<thead>
<tr><th>
	<?php 
        echo getlocal("report.byoperator.1");
        ?>
</th><th>
	<?php 
        echo getlocal("report.byoperator.2");
        ?>
</th><th>
	<?php 
        echo getlocal("report.byoperator.3");
        ?>
</th><th>
	<?php 
        echo getlocal("report.byoperator.4");
        ?>
</th></tr>
</thead>
<tbody>	
<?php 
        if ($page['reportByAgent']) {
            ?>
	<?php 
            foreach ($page['reportByAgent'] as $row) {
                ?>
	<tr>
		<td><?php 
                echo topage(htmlspecialchars($row['name']));
                ?>
</td>
		<td><?php 
                echo $row['threads'];
                ?>
</td>
		<td><?php 
                echo $row['msgs'];
                ?>
</td>
    	<td><?php 
                echo $row['avglen'];
                ?>
</td>
	</tr>
	<?php 
            }
        } else {
            ?>
	<tr>
	<td colspan="4">
		<?php 
            echo getlocal("report.no_items");
            ?>
	</td>
	</tr>
<?php 
        }
        ?>
</tbody>
</table>

<?php 
    }
    ?>

<?php 
}
Ejemplo n.º 21
0
function setup_chatview_for_operator($thread, $operator)
{
    global $page, $webimroot, $company_logo_link, $company_name, $settings;
    loadsettings();
    $page = array();
    $page['agent'] = true;
    $page['user'] = false;
    $page['canpost'] = $thread['agentId'] == $operator['operatorid'];
    $page['ct.chatThreadId'] = $thread['threadid'];
    $page['ct.token'] = $thread['ltoken'];
    $page['ct.user.name'] = htmlspecialchars(topage(get_user_name($thread['userName'], $thread['remote'], $thread['userid'])));
    $page['chat.title'] = topage($settings['chattitle']);
    setup_logo();
    if ($settings['sendmessagekey'] == 'enter') {
        $page['send_shortcut'] = "Enter";
        $page['ignorectrl'] = 1;
    } else {
        $page['send_shortcut'] = is_mac_opera() ? "&#8984;-Enter" : "Ctrl-Enter";
        $page['ignorectrl'] = 0;
    }
    if ($settings['enablessl'] == "1" && !is_secure_request()) {
        $page['sslLink'] = get_app_location(true, true) . "/operator/agent.php?thread=" . $thread['threadid'] . "&amp;token=" . $thread['ltoken'];
    }
    $page['isOpera95'] = is_agent_opera95();
    $page['neediframesrc'] = needsFramesrc();
    $page['historyParams'] = array("userid" => "" . $thread['userid']);
    $page['historyParamsLink'] = add_params($webimroot . "/operator/userhistory.php", $page['historyParams']);
    $predefinedres = "";
    $canned_messages = load_canned_messages($thread['locale'], $thread['groupid']);
    foreach ($canned_messages as $answer) {
        $predefinedres .= "<option>" . htmlspecialchars(topage($answer['vcvalue'])) . "</option>";
    }
    $page['predefinedAnswers'] = $predefinedres;
    $params = "thread=" . $thread['threadid'] . "&amp;token=" . $thread['ltoken'];
    $page['redirectLink'] = "{$webimroot}/operator/agent.php?" . $params . "&amp;act=redirect";
    $page['namePostfix'] = "";
    $page['frequency'] = $settings['updatefrequency_chat'];
}
Ejemplo n.º 22
0
Archivo: agent.php Proyecto: kuell/chat
 }
 $thread = thread_by_id($threadid);
 if (!$thread || !isset($thread['ltoken'])) {
     die("wrong thread");
 }
 $viewonly = verifyparam("viewonly", "/^true\$/", false);
 $forcetake = verifyparam("force", "/^true\$/", false);
 if (!$viewonly && $thread['istate'] == $state_chatting && $operator['operatorid'] != $thread['agentId']) {
     if (!is_capable($can_takeover, $operator)) {
         $errors = array("Cannot take over");
         start_html_output();
         expand("../styles", getchatstyle(), "error.tpl");
         exit;
     }
     if ($forcetake == false) {
         $page = array('user' => topage($thread['userName']), 'agent' => topage($thread['agentName']), 'link' => $_SERVER['PHP_SELF'] . "?thread={$threadid}&force=true");
         start_html_output();
         require '../view/confirm.php';
         exit;
     }
 }
 if (!$viewonly) {
     take_thread($thread, $operator);
 } else {
     if (!is_capable($can_viewthreads, $operator)) {
         $errors = array("Cannot view threads");
         start_html_output();
         expand("../styles", getchatstyle(), "error.tpl");
         exit;
     }
 }
Ejemplo n.º 23
0
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&amp;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 
}
Ejemplo n.º 24
0
function tpl_content()
{
    global $page, $webimroot, $errors;
    ?>

<?php 
    echo getlocal("canned.descr");
    ?>
<br />
<br />
<?php 
    require_once 'inc_errors.php';
    ?>

<form name="cannedForm" method="get" action="<?php 
    echo $webimroot;
    ?>
/operator/canned.php">
	
	<div class="mform"><div class="formtop"><div class="formtopi"></div></div><div class="forminner">

	<div class="packedFormField">
		<?php 
    echo getlocal("canned.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>
	
<?php 
    if ($page['showgroups']) {
        ?>
	<div class="packedFormField">
		<?php 
        echo getlocal("canned.group");
        ?>
<br/>
		<select name="group" onchange="this.form.submit();"><?php 
        foreach ($page['groups'] as $k) {
            echo "<option value=\"" . $k["groupid"] . "\"" . ($k["groupid"] == form_value("group") ? " selected=\"selected\"" : "") . ">" . $k["vclocalname"] . "</option>";
        }
        ?>
</select>
	</div>
<?php 
    }
    ?>
	
	<br clear="all"/>
	
	</div><div class="formbottom"><div class="formbottomi"></div></div></div>
</form>
<br/>

<div class="tabletool">
	<img src="<?php 
    echo $webimroot;
    ?>
/images/buttons/createban.gif" border="0" alt=""/>
	<a href="<?php 
    echo $webimroot;
    ?>
/operator/cannededit.php?lang=<?php 
    echo form_value("lang");
    ?>
&amp;group=<?php 
    echo form_value("group");
    ?>
" target="_blank" 
				onclick="this.newWindow = window.open('<?php 
    echo $webimroot;
    ?>
/operator/cannededit.php?lang=<?php 
    echo form_value("lang");
    ?>
&amp;group=<?php 
    echo form_value("group");
    ?>
', '', 'toolbar=0,scrollbars=1,location=0,status=1,menubar=0,width=640,height=480,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;">
		<?php 
    echo getlocal("canned.add");
    ?>
	</a>
</div>
<br clear="all"/>

<?php 
    if ($page['pagination']) {
        ?>

<table class="translate">
<thead>
	<tr class="header"><th>
		<?php 
        echo getlocal("cannededit.message");
        ?>
	</th><th>
		<?php 
        echo getlocal("canned.actions");
        ?>
	</th></tr>
</thead>
<tbody>
<?php 
        if ($page['pagination.items']) {
            foreach ($page['pagination.items'] as $localstr) {
                ?>
	<tr>
		<td>
			<?php 
                echo str_replace("\n", "<br/>", htmlspecialchars(topage($localstr['vcvalue'])));
                ?>
		</td>
		<td>
			<a href="<?php 
                echo $webimroot;
                ?>
/operator/cannededit.php?key=<?php 
                echo $localstr['id'];
                ?>
" target="_blank" 
				onclick="this.newWindow = window.open('<?php 
                echo $webimroot;
                ?>
/operator/cannededit.php?key=<?php 
                echo $localstr['id'];
                ?>
', '', 'toolbar=0,scrollbars=1,location=0,status=1,menubar=0,width=640,height=480,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;"><?php 
                echo getlocal("canned.actions.edit");
                ?>
</a>, 
			<a href="<?php 
                echo $webimroot;
                ?>
/operator/canned.php?act=delete&amp;key=<?php 
                echo $localstr['id'];
                ?>
&amp;lang=<?php 
                echo form_value("lang");
                ?>
&amp;group=<?php 
                echo form_value("group");
                print_csrf_token_in_url();
                ?>
"><?php 
                echo getlocal("canned.actions.del");
                ?>
</a>
		</td>
	</tr>
<?php 
            }
        } else {
            ?>
	<tr>
	<td colspan="3">
		<?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 
}
Ejemplo n.º 25
0
$errors = array();
$page = array('version' => $version);
$loginoremail = "";
if (isset($_POST['loginoremail'])) {
    $loginoremail = getparam("loginoremail");
    $torestore = is_valid_email($loginoremail) ? operator_by_email($loginoremail) : operator_by_login($loginoremail);
    if (!$torestore) {
        $errors[] = getlocal("no_such_operator");
    }
    $email = $torestore['vcemail'];
    if (count($errors) == 0 && !is_valid_email($email)) {
        $errors[] = "Operator hasn't set his e-mail";
    }
    if (count($errors) == 0) {
        $token = md5(time() + microtime() . rand(0, 99999999));
        $link = connect();
        $query = "update {$mysqlprefix}chatoperator set dtmrestore = CURRENT_TIMESTAMP, vcrestoretoken = '{$token}' where operatorid = " . $torestore['operatorid'];
        perform_query($query, $link);
        $href = get_app_location(true, false) . "/operator/resetpwd.php?id=" . $torestore['operatorid'] . "&token={$token}";
        webim_mail($email, $email, getstring("restore.mailsubj"), getstring2("restore.mailtext", array(get_operator_name($torestore), $href)), $link);
        mysql_close($link);
        $page['isdone'] = true;
        require '../view/restore.php';
        exit;
    }
}
$page['formloginoremail'] = topage($loginoremail);
$page['localeLinks'] = get_locale_links("{$webimroot}/operator/restore.php");
$page['isdone'] = false;
start_html_output();
require '../view/restore.php';
Ejemplo n.º 26
0
            if (verifyparam("permissions{$id}", "/^on\$/", "") == "on") {
                $new_permissions |= 1 << $perm;
            } else {
                $new_permissions &= ~(1 << $perm);
            }
        }
        if (count($errors) == 0) {
            update_operator_permissions($op['operatorid'], $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;
        }
    }
}
$page['permissionsList'] = get_permission_list();
$page['formpermissions'] = array("");
$page['currentop'] = $op ? topage(get_operator_name($op)) . " (" . $op['vclogin'] . ")" : "-not found-";
if ($op) {
    foreach ($permission_ids as $perm => $id) {
        if (is_capable($perm, $op)) {
            $page['formpermissions'][] = $id;
        }
    }
}
$page['stored'] = isset($_GET['stored']);
prepare_menu($operator);
setup_operator_settings_tabs($opId, 3);
start_html_output();
require '../view/permissions.php';
Ejemplo n.º 27
0
    $page['locale'] = verifyparam("lang", "/^[\\w-]{2,5}\$/", "");
    $page['groupid'] = "";
    if ($settings['enablegroups'] == '1') {
        $page['groupid'] = verifyparam("group", "/^\\d{0,10}\$/");
    }
}
if (isset($_POST['message'])) {
    $message = getparam('message');
    if (!$message) {
        $errors[] = no_field("form.field.message");
    }
    if (count($errors) == 0) {
        if ($stringid) {
            save_message($stringid, $message);
        } else {
            add_message($page['locale'], $page['groupid'], $message);
        }
        $page['saved'] = true;
        prepare_menu($operator, false);
        start_html_output();
        require '../view/cannededit.php';
        exit;
    }
}
$page['saved'] = false;
$page['key'] = $stringid;
$page['formmessage'] = topage($message);
prepare_menu($operator, false);
start_html_output();
require '../view/cannededit.php';
exit;
Ejemplo n.º 28
0
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 
}
Ejemplo n.º 29
0
    }
} 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";
}
$canmodify = $opId == $operator['operatorid'] && is_capable($can_modifyprofile, $operator) || is_capable($can_administrate, $operator);
$page['stored'] = isset($_GET['stored']);
$page['canmodify'] = $canmodify ? "1" : "";
$page['showjabber'] = $settings['enablejabber'] == "1";
$page['needChangePassword'] = $operator['vcpassword'] == md5('');
prepare_menu($operator);
setup_operator_settings_tabs($opId, 0);
start_html_output();
require '../view/agent.php';
Ejemplo n.º 30
0
        if ($thread['istate'] == $state_chatting) {
            $link = connect();
            commit_thread($threadid, array("istate" => $state_waiting, "nextagent" => 0, "groupid" => $nextid, "agentId" => 0, "agentName" => "''"), $link);
            post_message_($thread['threadid'], $kind_events, getstring2_("chat.status.operator.redirect", array(get_operator_name($operator)), $thread['locale']), $link);
            mysql_close($link);
        } else {
            $errors[] = getlocal("chat.redirect.cannot");
        }
    } else {
        $errors[] = "Unknown group";
    }
} else {
    $nextid = verifyparam("nextAgent", "/^\\d{1,8}\$/");
    $nextOperator = operator_by_id($nextid);
    if ($nextOperator) {
        $page['message'] = getlocal2("chat.redirected.content", array(topage(get_operator_name($nextOperator))));
        if ($thread['istate'] == $state_chatting) {
            $link = connect();
            $threadupdate = array("istate" => $state_waiting, "nextagent" => $nextid, "agentId" => 0);
            if ($thread['groupid'] != 0) {
                if (FALSE === select_one_row("select groupid from {$mysqlprefix}chatgroupoperator where operatorid = {$nextid} and groupid = " . $thread['groupid'], $link)) {
                    $threadupdate['groupid'] = 0;
                }
            }
            commit_thread($threadid, $threadupdate, $link);
            post_message_($thread['threadid'], $kind_events, getstring2_("chat.status.operator.redirect", array(get_operator_name($operator)), $thread['locale']), $link);
            mysql_close($link);
        } else {
            $errors[] = getlocal("chat.redirect.cannot");
        }
    } else {