Example #1
0
function demo_process_thread($act, $outformat, $lastid, $isuser, $canpost, $istyping, $postmessage)
{
    global $kind_for_agent, $kind_info, $kind_events, $kind_user, $kind_agent, $webimroot, $settings;
    loadsettings();
    if ($act == "refresh" || $act == "post") {
        $lastid++;
        if ($outformat == "xml") {
            start_xml_output();
            print "<thread lastid=\"{$lastid}\" typing=\"" . ($istyping ? 1 : 0) . "\" canpost=\"" . ($canpost ? 1 : 0) . "\">";
        } else {
            start_html_output();
            $url = "{$webimroot}/thread.php?act=refresh&amp;thread=0&amp;token=123&amp;html=on&amp;user="******"true" : "false");
            print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">" . "<html>\n<head>\n" . "<link href=\"{$webimroot}/styles/default/chat.css\" rel=\"stylesheet\" type=\"text/css\">\n" . "<meta http-equiv=\"Refresh\" content=\"" . $settings['updatefrequency_oldchat'] . "; URL={$url}&amp;sn=11\">\n" . "<meta http-equiv=\"Pragma\" content=\"no-cache\">\n" . "<title>chat</title>\n" . "</head>\n" . "<body bgcolor='#FFFFFF' text='#000000' link='#C28400' vlink='#C28400' alink='#C28400'>" . "<table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td valign='top' class='message'>";
        }
        if ($lastid == 1) {
            demo_print_message(array('ikind' => $kind_for_agent, 'created' => time() - 15, 'tname' => '', 'tmessage' => getstring2('chat.came.from', array("http://google.com"))), $outformat);
            demo_print_message(array('ikind' => $kind_info, 'created' => time() - 15, 'tname' => '', 'tmessage' => getstring('chat.wait')), $outformat);
            demo_print_message(array('ikind' => $kind_events, 'created' => time() - 10, 'tname' => '', 'tmessage' => getstring2("chat.status.operator.joined", array("Administrator"))), $outformat);
            demo_print_message(array('ikind' => $kind_agent, 'created' => time() - 9, 'tname' => 'Administrator', 'tmessage' => getstring("demo.chat.welcome")), $outformat);
            demo_print_message(array('ikind' => $kind_user, 'created' => time() - 5, 'tname' => getstring("chat.default.username"), 'tmessage' => getstring("demo.chat.question")), $outformat);
            if ($canpost && $outformat == 'xml') {
                demo_print_message(array('ikind' => $kind_info, 'created' => time() - 5, 'tname' => '', 'tmessage' => 'Hint: type something in message field to see typing notification'), $outformat);
            }
        }
        if ($act == 'post') {
            demo_print_message(array('ikind' => $isuser ? $kind_user : $kind_agent, 'created' => time(), 'tmessage' => $postmessage, 'tname' => $isuser ? getstring("chat.default.username") : "Administrator"), $outformat);
        }
        if ($outformat == "xml") {
            print "</thread>";
        } else {
            print "</td></tr></table><a name='aend'></a>" . "</body></html>";
        }
    }
}
 public function getInstruments()
 {
     //$instruments = [];
     $settings = loadsettings();
     $instruments = $settings['oanda']['pairs'];
     return $instruments;
 }
Example #3
0
 public function setUp()
 {
     // load the $settings
     require_once __DIR__ . '/../loadsettings.php';
     $settings = loadsettings();
     $this->settings = $settings;
     $setup['settings'] = $settings;
     $container = new Container($setup);
     $this->container = $container;
     // Set up dependencies
     require_once __DIR__ . '/../dependencies.php';
 }
Example #4
0
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();
    }
}
Example #5
0
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();
    }
}
function getsetting($settingname, $default)
{
    global $settings;
    global $DB_USEDATACACHE, $DB_DATACACHEPATH;
    if ($settingname == "usedatacache") {
        return $DB_USEDATACACHE;
    } elseif ($settingname == "datacachepath") {
        return $DB_DATACACHEPATH;
    }
    if (!isset($settings[$settingname])) {
        loadsettings();
    } else {
        return $settings[$settingname];
    }
    if (!isset($settings[$settingname])) {
        savesetting($settingname, $default);
        return $default;
    } else {
        return $settings[$settingname];
    }
}
function getsetting(string $settingname, $default)
{
    global $settings, $DB_USEDATACACHE, $DB_DATACACHEPATH;
    if ($settingname == 'usedatacache') {
        return $DB_USEDATACACHE;
    } else {
        if ($settingname == 'datacachepath') {
            return $DB_DATACACHEPATH;
        }
    }
    if (!isset($settings[$settingname])) {
        loadsettings();
    } else {
        return $settings[$settingname];
    }
    if (!isset($settings[$settingname])) {
        savesetting($settingname, $default);
        return $default;
    } else {
        return $settings[$settingname];
    }
}
Example #8
0
function check_status()
{
    global $page, $webimroot, $settings, $dbversion;
    $page['done'][] = getlocal2("install.0.php", array(phpversion()));
    if (!check_webimroot()) {
        return;
    }
    if (!check_files()) {
        return;
    }
    $link = check_connection();
    if (!$link) {
        return;
    }
    if (!check_database($link)) {
        mysql_close($link);
        return;
    }
    if (!check_tables($link)) {
        mysql_close($link);
        return;
    }
    if (!check_columns($link)) {
        mysql_close($link);
        return;
    }
    check_sound();
    $page['done'][] = getlocal("installed.message");
    if (!check_admin($link)) {
        $page['nextstep'] = getlocal("installed.login_link");
        $page['nextnotice'] = getlocal2("installed.notice", array("{$webimroot}/install/"));
        $page['nextstepurl'] = "{$webimroot}/operator/login.php?login=admin";
    }
    $page['show_small_login'] = true;
    mysql_close($link);
    loadsettings();
    $settings['dbversion'] = $dbversion;
    update_settings();
}
Example #9
0
function getchatstyle()
{
    global $settings;
    $chatstyle = verifyparam("style", "/^\\w+\$/", "");
    if ($chatstyle) {
        return $chatstyle;
    }
    loadsettings();
    return $settings['chatstyle'];
}
Example #10
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'];
}
Example #11
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'];
    }
}
function getsetting($settingname, $default)
{
    global $settings;
    loadsettings();
    if (!isset($settings[$settingname])) {
        savesetting($settingname, $default);
        return $default;
    } else {
        if (trim($settings[$settingname]) == "") {
            $settings[$settingname] = $default;
        }
        return $settings[$settingname];
    }
}
Example #13
0
function insertobject($object, $taglevel, $charinfo = array(), $offset = 0)
{
    global $settings, $cfg;
    if (!preg_match('/^([0-9]+),([0-9]+)$/', $object->coords, $coords)) {
        return;
    }
    //not be able to set object properly without coords
    loadsettings($object, $taglevel);
    foreach ($object->attributes() as $attributeskey => $attributesvalue) {
        $attributes[$attributeskey] = "" . $attributesvalue;
    }
    switch ($attributes['class']) {
        case "symbol_land":
            $picture = "symbol_land";
            break;
        case "symbol_sea":
            $picture = "symbol_sea";
            break;
        case "symbol_class":
            if (!$charinfo['jobclass']) {
                return;
            }
            switch ($charinfo['jobclass']) {
                case "Saint":
                    $picture = "class_s";
                    break;
                case "Shaman":
                    $picture = "class_s";
                    break;
                case "Priest":
                    $picture = "class_s";
                    break;
                case "Noble":
                    $picture = "class_n";
                    break;
                case "Court Magician":
                    $picture = "class_n";
                    break;
                case "Magic Knight":
                    $picture = "class_n";
                    break;
                case "Mercenary":
                    $picture = "class_w";
                    break;
                case "Guardian Swordsman":
                    $picture = "class_w";
                    break;
                case "Gladiator":
                    $picture = "class_w";
                    break;
                case "Explorer":
                    $picture = "class_e";
                    break;
                case "Sniper":
                    $picture = "class_e";
                    break;
                case "Excavator":
                    $picture = "class_e";
                    break;
                default:
                    return;
            }
            break;
        default:
            return;
    }
    $picture = $cfg['signature_abs'] . "/objects/" . $picture;
    if (!is_file($picture)) {
        return;
    }
    // load objectpicture
    global $Teilgrafik;
    $info = getimagesize($picture);
    if ($info[2] == 2) {
        //JPEG / JPG
        $objectpicture = imagecreatefromjpeg($picture);
    } elseif ($info[2] == 3) {
        //PNG
        $objectpicture = imagecreatefrompng($picture);
    } elseif ($info[2] == 1) {
        // GIF
        $objectpicture = imagecreatefromgif($picture);
    } else {
        //BMP
        require_once $cfg['root_abs'] . "/convertbmp.php";
        $objectpicture = imagecreatefrombmp($picture);
    }
    //some global options (not in loadsettings()?)
    // 	if (isset($object->transparency) && 0<intval($object->transparency)) {
    // 		$transparency = $object->transparency+0;
    // 	}
    // 	else { $transparency = 100; }
    $width = imagesx($objectpicture);
    $height = imagesy($objectpicture);
    if (isset($object->height) && 0 < intval($object->height)) {
        $height = $object->height + 0;
        if (!$object->width) {
            //if only height set, resize in width
            $width = ceil(imagesx($objectpicture) * ($height / imagesy($objectpicture)));
        }
    }
    if (isset($object->width) && 0 < intval($object->width)) {
        $width = $object->width + 0;
        if (!$object->height) {
            //if only width set, resize in height
            $height = ceil(imagesy($objectpicture) * ($width / imagesx($objectpicture)));
        }
    }
    switch ($object->align) {
        case "right":
            $coords[1] = imagesx($Teilgrafik) - $coords[1] - $width;
            break;
        case "center":
            $coords[1] = $coords[1] - $width / 2;
            break;
    }
    //offset
    if ($offset) {
        $offset = explode(",", $offset);
        $coords[1] += $offset[0];
        $coords[2] += $offset[1];
    }
    imagecopyresized($Teilgrafik, $objectpicture, $coords[1], $coords[2], 0, 0, $width, $height, imagesx($objectpicture), imagesy($objectpicture));
}
Example #14
0
<?php

function loadsettings()
{
    // Instantiate the app
    $path = __DIR__ . '/../app/settings.php';
    if (!file_exists($path)) {
        $settings = (require __DIR__ . '/../app/settings_dist.php');
    } else {
        $settings = (require $path);
    }
    return $settings;
}
$settings = ['settings' => loadsettings()];
Example #15
0
 public function workers(Request $request, Response $response, array $args)
 {
     $data = [];
     $settings = loadsettings();
     $REDIS_BACKEND = $settings['resque']['REDIS_BACKEND'];
     if (!empty($REDIS_BACKEND)) {
         \Resque::setBackend($REDIS_BACKEND);
     }
     $workerlist = \Resque_Worker::all();
     $workers = [];
     foreach ($workerlist as $worker) {
         $job = $worker->job();
         if (empty($job)) {
             $job = "Idle";
         }
         $workers[] = ['name' => (string) $worker, 'job' => $job];
     }
     $data['workers'] = $workers;
     $this->view->render($response, 'workers.twig', $data);
     return $response;
 }
Example #16
0
}
$show = verifyparam("show", "/^(chat|chatsimple|nochat|mail|mailsent|survey|leavemessage|leavemessagesent|redirect|redirected|agentchat|agentrochat|error)\$/", "");
$showerrors = verifyparam("showerr", "/^on\$/", "") == "on";
$errors = array();
if ($showerrors || $show == 'error') {
    $errors[] = "Test error";
}
if ($show == 'chat' || $show == 'mail' || $show == 'leavemessage' || $show == 'leavemessagesent' || $show == 'chatsimple' || $show == 'nochat') {
    setup_chatview_for_user(array('threadid' => 0, 'userName' => getstring("chat.default.username"), 'ltoken' => 123), "ajaxed");
    $page['mailLink'] = "{$webimroot}/operator/themes.php?preview={$preview}&amp;show=mail";
    $page['info'] = "";
    expand("../styles", "{$preview}", "{$show}.tpl");
    exit;
}
if ($show == 'survey') {
    loadsettings();
    setup_survey("Visitor", "", "", "", "http://google.com");
    setup_logo();
    expand("../styles", "{$preview}", "{$show}.tpl");
    exit;
}
if ($show == 'mailsent' || $show == 'error') {
    $page['email'] = "*****@*****.**";
    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);
Example #17
0
<?php 
/**
 * Launch resque scheduler workers
 * User: Neil
 * Date: 21/09/2015
 * Time: 09:17
 */
require __DIR__ . '/../../../vendor/autoload.php';
date_default_timezone_set('Europe/London');
require __DIR__ . '/../../loadsettings.php';
$settings = loadsettings();
$REDIS_BACKEND = $settings['resque']['REDIS_BACKEND'];
if (!empty($REDIS_BACKEND)) {
    Resque::setBackend($REDIS_BACKEND);
}
$logLevel = 0;
$LOGGING = $settings['resque']['LOGGING'];
$VERBOSE = $settings['resque']['VERBOSE'];
$VVERBOSE = $settings['resque']['VVERBOSE'];
if (!empty($LOGGING) || !empty($VERBOSE)) {
    $logLevel = ResqueScheduler_Worker::LOG_NORMAL;
} else {
    if (!empty($VVERBOSE)) {
        $logLevel = ResqueScheduler_Worker::LOG_VERBOSE;
    }
}
$interval = 5;
$INTERVAL = $settings['resque']['INTERVAL'];
if (!empty($INTERVAL)) {
    $interval = $INTERVAL;