Exemplo n.º 1
0
function receive($server, $type, $msg)
{
    antixss($msg);
    global $app;
    $servicer = $app->users->getByUsername($msg->username);
    $from_name = $app->service->migrate();
    if (empty($from_name)) {
        $server->push($servicer['fd'], json_encode(["system", ['from_name' => "系统消息", 'content' => "当前没有可接待用户!"]]));
        return;
    }
    $app->service->save($from_name, $msg->username);
    $from_user = $app->users->getByUsername($from_name);
    $content = "您好,我是客服" . $servicer['u_username'] . "请问有什么可以帮到您?";
    // 记录消息
    $app->messages->save($content, $servicer['u_username'], $from_user['u_username'], "service", 0);
    //发送给会员消息
    $server->push($from_user['fd'], json_encode([$type, ['from_name' => $servicer['u_username'], 'content' => $content]]));
    //给客服发送消息
    $server->push($servicer['fd'], json_encode([$type, ['to_name' => $from_user['u_username'], 'from_name' => $servicer['u_username'], 'content' => $content]]));
}
Exemplo n.º 2
0
 * 
 * This file initializes up most variables for the site. It is also where most files
 * are included from. It also reads and stores certain variables.
 *
 * @package GetSimple
 * @subpackage init
 */
/**
 * Bad stuff protection
 */
define('IN_GS', TRUE);
include_once 'nonce.php';
include_once 'xss.php';
if (version_compare(PHP_VERSION, "5") >= 0) {
    foreach ($_GET as &$xss) {
        $xss = antixss($xss);
    }
}
/**
 * Basic file inclusions
 */
include 'basic.php';
include 'template_functions.php';
define('GSROOTPATH', get_root_path());
if (file_exists(GSROOTPATH . 'gsconfig.php')) {
    require_once GSROOTPATH . 'gsconfig.php';
}
if (defined('GSADMIN')) {
    $GSADMIN = GSADMIN;
} else {
    $GSADMIN = 'admin';
Exemplo n.º 3
0
 *
 * Displays all installed plugins 
 *
 * @package GetSimple
 * @subpackage Plugins
 */
// Setup inclusions
$load['plugin'] = true;
// Include common.php
include 'inc/common.php';
login_cookie_check();
$pluginid = isset($_GET['set']) ? $_GET['set'] : null;
$nonce = isset($_GET['nonce']) ? $_GET['nonce'] : null;
if ($pluginid) {
    if (check_nonce($nonce, "set_" . pathinfo_filename($pluginid), "plugins.php")) {
        $plugin = antixss($pluginid);
        change_plugin($plugin);
        redirect('plugins.php?success=' . i18n_r('PLUGIN_UPDATED'));
    } else {
        redirect('plugins.php?error=' . i18n_r('ERROR_OCCURED'));
    }
}
// Variable settings
$counter = 0;
$table = '';
$needsupdate = false;
$plugin_info_sorted = subval_sort($plugin_info, 'name');
foreach ($plugin_info_sorted as $pluginid => $plugininfo) {
    $setNonce = '&nonce=' . get_nonce("set_" . $pluginid, "plugins.php");
    // @todo disabled plugins have a version of (str) 'disabled', should be 0 or null
    $pluginver = $plugininfo['version'] == 'disabled' ? 0 : $plugininfo['version'];