Example #1
1
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     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/operator.php';
require_once '../libs/chat.php';
$operator = check_login();
$page = array();
setlocale(LC_TIME, getstring("time.locale"));
function notification_info($id)
{
    global $mysqlprefix;
    $link = connect();
    $notification = select_one_row(db_build_select("id, locale, vckind, vcto, unix_timestamp(dtmcreated) as created, vcsubject, tmessage, refoperator", "{$mysqlprefix}chatnotification", array("id = {$id}"), ""), $link);
    mysql_close($link);
    return $notification;
}
$notificationid = verifyparam("id", "/^(\\d{1,9})\$/");
$page['notification'] = notification_info($notificationid);
prepare_menu($operator, false);
start_html_output();
require '../view/notification.php';
Example #2
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>";
        }
    }
}
Example #3
0
function userLogin($username, $password, $log = true)
{
    global $USER, $MSG;
    if ($username == "") {
        array_push($MSG, getstring('warning.login.noemail'));
        return false;
    }
    if ($password == "") {
        array_push($MSG, getstring('warning.login.nopassword'));
        return false;
    }
    $USER = new User($username);
    $USER->setUsername($username);
    $USER->password = $password;
    if ($USER instanceof User) {
        if ($USER->validPassword($password)) {
            $_SESSION["session_username"] = $USER->getUsername();
            setcookie("user", $USER->getUsername(), time() + 60 * 60 * 24 * 30, "/");
            setLang($USER->getProp('lang'));
            if ($log) {
                writeToLog('info', 'login', 'user logged in');
            }
            return true;
        } else {
            array_push($MSG, getstring('warning.login.invalid'));
            writeToLog('info', 'loginfailure', 'username: ' . $username);
            unset($USER);
            return false;
        }
    } else {
        return false;
    }
}
Example #4
0
function thread_to_xml($thread, $link)
{
    global $state_chatting, $threadstate_to_string, $threadstate_key, $mibew_encoding, $operator, $settings, $can_viewthreads, $can_takeover, $mysqlprefix;
    $state = $threadstate_to_string[$thread['istate']];
    $result = "<thread id=\"" . safe_htmlspecialchars(safe_htmlspecialchars($thread['threadid'])) . "\" stateid=\"{$state}\"";
    if ($state == "closed") {
        return $result . "/>";
    }
    $state = getstring($threadstate_key[$thread['istate']]);
    $nextagent = $thread['nextagent'] != 0 ? operator_by_id_($thread['nextagent'], $link) : null;
    $threadoperator = $nextagent ? get_operator_name($nextagent) : ($thread['agentName'] ? $thread['agentName'] : "-");
    if ($threadoperator == "-" && $thread['groupname']) {
        $threadoperator = "- " . $thread['groupname'] . " -";
    }
    if (!($thread['istate'] == $state_chatting && $thread['agentId'] != $operator['operatorid'] && !is_capable($can_takeover, $operator))) {
        $result .= " canopen=\"true\"";
    }
    if ($thread['agentId'] != $operator['operatorid'] && $thread['nextagent'] != $operator['operatorid'] && is_capable($can_viewthreads, $operator)) {
        $result .= " canview=\"true\"";
    }
    if ($settings['enableban'] == "1") {
        $result .= " canban=\"true\"";
    }
    $banForThread = $settings['enableban'] == "1" ? ban_for_addr_($thread['remote'], $link) : false;
    if ($banForThread) {
        $result .= " ban=\"blocked\" banid=\"" . safe_htmlspecialchars(safe_htmlspecialchars($banForThread['banid'])) . "\"";
    }
    $result .= " state=\"{$state}\" typing=\"" . safe_htmlspecialchars(safe_htmlspecialchars($thread['userTyping'])) . "\">";
    $result .= "<name>";
    if ($banForThread) {
        $result .= safe_htmlspecialchars(getstring('chat.client.spam.prefix'));
    }
    $result .= safe_htmlspecialchars(safe_htmlspecialchars(get_user_name($thread['userName'], $thread['remote'], $thread['userid']))) . "</name>";
    $result .= "<addr>" . safe_htmlspecialchars(get_user_addr($thread['remote'])) . "</addr>";
    $result .= "<agent>" . safe_htmlspecialchars(safe_htmlspecialchars($threadoperator)) . "</agent>";
    $result .= "<time>" . safe_htmlspecialchars(safe_htmlspecialchars($thread['unix_timestamp(dtmcreated)'])) . "000</time>";
    $result .= "<modified>" . safe_htmlspecialchars(safe_htmlspecialchars($thread['unix_timestamp(dtmmodified)'])) . "000</modified>";
    if ($banForThread) {
        $result .= "<reason>" . safe_htmlspecialchars(safe_htmlspecialchars($banForThread['comment'])) . "</reason>";
    }
    $userAgent = get_useragent_version($thread['userAgent']);
    $result .= "<useragent>" . safe_htmlspecialchars($userAgent) . "</useragent>";
    if ($thread["shownmessageid"] != 0) {
        $query = "select tmessage from {$mysqlprefix}chatmessage where messageid = " . intval($thread["shownmessageid"]);
        $line = select_one_row($query, $link);
        if ($line) {
            $message = preg_replace("/[\r\n\t]+/", " ", $line["tmessage"]);
            $result .= "<message>" . safe_htmlspecialchars(safe_htmlspecialchars($message)) . "</message>";
        }
    }
    $result .= "</thread>";
    return $result;
}
Example #5
0
include_once "../config.php";
$PAGE = "viewquiz";
$HEADER = "<script type='text/javascript' src='https://www.google.com/jsapi'></script>";
include_once "../includes/header.php";
$ref = optional_param("ref", "", PARAM_TEXT);
$days = optional_param("days", 14, PARAM_INT);
$view = optional_param("view", "bydate", PARAM_TEXT);
$groupid = optional_param("groupid", 0, PARAM_INT);
$views = array('bydate' => 'Attempts by date', 'scoredist' => 'Score distribution', 'question' => 'Average score by question');
if ($API->isOwner($ref)) {
    $views['list'] = 'Detailed list';
}
$quiz = $API->getQuiz($ref);
if ($quiz == null) {
    echo getstring("warning.quiz.notfound");
    include_once "../includes/footer.php";
    die;
}
printf("<h1>%s</h1>", $quiz->quiztitle);
if ($quiz->quizdescription != "") {
    printf("<p class='desc'>%s</p>", $quiz->quizdescription);
}
if (!$API->quizHasAttempts($ref)) {
    printf("No attempts have been made on this quiz yet.");
    include_once "../includes/footer.php";
    die;
}
// get user groups
$groups = $API->getUserGroupQuiz($quiz->quizid);
if (count($groups) > 0) {
Example #6
0
 /**
  * Handle parsing error
  */
 protected function error($message, $text = '', $questionname = '')
 {
     global $MSG;
     array_push($MSG, getstring("import.quiz.error.questionformat", array($questionname)));
     $this->importerrors++;
 }
Example #7
0
        echo "<li>" . $err . "</li>";
    }
    echo "</ul></div>";
}
echo "<p>" . getstring("reset.text") . "</h1>";
?>

<form method="post" action="">
	<div class="formblock">
		<div class="formlabel"><?php 
echo getstring('register.email');
?>
</div>
		<div class="formfield"><input type="text" name="email" value="<?php 
echo $email;
?>
"></input></div>
	</div>
	<div class="formblock">
		<div class="formlabel">&nbsp;</div>
		<div class="formfield">
			<input type="submit" name="submit" value="<?php 
echo getstring("reset.submit.button");
?>
"></input>
		</div>
	</div>
</form>

<?php 
include_once "./includes/footer.php";
Example #8
0
$new = optional_param("new", "", PARAM_TEXT);
$view = optional_param("view", "invite", PARAM_TEXT);
$q = $API->getQuizForUser($qref, $USER->userid);
if (!$q) {
    die;
}
printf("<h1>%s</h1>", $q->title);
if ($new == "true") {
    printf("<div class='info'>%s</div>", getstring("quiz.new.saved", array($CONFIG->homeAddress . "m/?preview=true#" . $q->ref, $CONFIG->homeAddress . "quiz/edit.php?ref=" . $q->ref)));
} else {
    if ($new == "false") {
        printf("<div class='info'>%s</div>", getstring("quiz.edit.saved", array($CONFIG->homeAddress . "m/?preview=true#" . $q->ref, $CONFIG->homeAddress . "quiz/edit.php?ref=" . $q->ref)));
    }
}
if ($q->draft) {
    printf("<div class='info'>%s</div>", getstring('quiz.draft'));
} else {
    ?>
<div id="share">
	<h2>Share:</h2>
	<div id="tweet">


	<?php 
    printf('<a href="https://twitter.com/share" class="twitter-share-button"
			data-url="%sm/#%s" data-text="Try my new quiz \'%s\'" 
			data-size="large" data-count="none"
			data-hashtags="mquiz">Tweet</a>', $CONFIG->homeAddress, $q->ref, $q->title);
    ?>
		<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
	</div>
Example #9
0
<?php

/* 
 * 
 * Данный файл является частью проекта Веб Мессенджер.
 * 
 * Все права защищены. (c) 2005-2009 ООО "ТОП".
 * Данное программное обеспечение и все сопутствующие материалы
 * предоставляются на условиях лицензии, доступной по адресу
 * http://webim.ru/license.html
 * 
 */
require_once '../classes/functions.php';
require_once '../classes/class.operator.php';
require_once '../classes/class.thread.php';
$operator = Operator::getInstance()->GetLoggedOperator(false);
// папка online в мэмкэш --------------------
//touch_online_file(OPERATOR_VIEW_TRACKER_FILE);
$mem_buff->set('OPERATOR_VIEW_TRACKER_FILE', time(), 1800);
if (!$operator) {
    Browser::SendXmlHeaders();
    echo "<error><descr>" . escape_with_cdata(getstring("agent.not_logged_in")) . "</descr></error>";
    exit;
}
$xml = Thread::getInstance()->BuildVisitorsXml();
Browser::SendXmlHeaders();
echo $xml;
Example #10
0
</h1>

<?php 
if (!empty($MSG)) {
    echo "<div class='warning'><ul>";
    foreach ($MSG as $err) {
        echo "<li>" . $err . "</li>";
    }
    echo "</ul></div>";
}
?>

<form method="post" action="">
	<div class="formblock">
		<div class="formlabel"><?php 
echo getstring('import.quiz.title');
?>
</div>
		<div class="formfield"><input type="text" name="title" size="60" value="<?php 
echo htmlentities($q->title);
?>
"></input></div>
	</div>
	<div class="formblock">
		<div class="formlabel">&nbsp;</div>
		<div class='formfield'>
			<input type="checkbox" name="quizdraft" value="1"
			<?php 
if ($q->draft == 1) {
    echo "checked='checked'";
}
Example #11
0
if (!in_array($PAGE, $nologinpages)) {
    checkLogin();
}
$lang = optional_param("lang", "", PARAM_TEXT);
if ($lang != "") {
    setLang($lang, true);
}
?>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<META name="description" content="mQuiz: mobile quiz application"/> 
	<META name="keywords" content="mquiz,quiz,assessment,mobile,android"/> 
	<title><?php 
echo getstring("app.title");
?>
</title>
	<script type="text/javascript" src="https://www.google.com/jsapi"></script>
	<script type="text/javascript" src="<?php 
echo $CONFIG->homeAddress;
?>
m/includes/lib/jquery-1.7.1.min.js"></script>
	<script type="text/javascript" src="<?php 
echo $CONFIG->homeAddress;
?>
m/includes/lib/jquery-ui-1.8.19.custom.min.js"></script>
	<script type="text/javascript" src="<?php 
echo $CONFIG->homeAddress;
?>
includes/script.php"></script>
function Start($id){
	global	$serversockets, $clientsockets, $sockets_status, $settings, $reqmessage,
		$timeout;
	$message = '';
	if(($message = getstring($clientsockets[$id], 10)) === CLOSED_SOCKET){
		close($id);
		return CLOSED_SOCKET;
	}
	
	elseif($message === NO_DATA)
		return NOT_ALL_DATA;
        @$reqmessage[$id] .= $message;
        // Checking the packet
        if($reqmessage[$id][0] !== VER){
		close($id);
		return CLOSED_SOCKET;
	}

	if(!isset($reqmessage[$id][1]))
		return NOT_ALL_DATA;

	if(ord($reqmessage[$id][1]) > strlen($reqmessage[$id]) - 2)
		return NOT_ALL_DATA;
	elseif(ord($reqmessage[$id][1]) === strlen($reqmessage[$id]) - 2){
		if($settings['AUTH'] !== 1){
			sendstring($clientsockets[$id],	VER.AUTH_NOT_REQ);
			unset($reqmessage[$id]);
			$sockets_status[$id]	= STATUS_REQUESTRECV;
			$timeout[$id]           = time();
			return 0;
		}
	
		if(strstr(substr($reqmessage[$id], 2, ord($reqmessage[$id][1])), AUTH_METHOD))
		{
		        $timeout[$id]		= time();
			$sockets_status[$id]	= STATUS_RECVAUTHREQ;
			sendstring($clientsockets[$id],	VER.AUTH_METHOD);
			unset($reqmessage[$id]);
			return 0;
		}
		else{
			sendstring($clientsockets[$id],	VER.WRONG_AUTH_METHODS);
			return 0;
			close($id);
			return CLOSED_SOCKET;
		}
		$sockets_status[$id] = STATUS_REQUEST;
		return 0;
	}
	else{
		close($id);
		
		return CLOSED_SOCKET;
	}
}
Example #13
0
<?php

include_once "../config.php";
$PAGE = "myresults";
include_once "../includes/header.php";
$results = $API->getMyQuizScores();
?>
<h1><?php 
echo getstring("myresults.title");
?>
</h1>

<?php 
if (count($results) == 0) {
    echo "<div class='info'>";
    echo getstring("myresults.none");
    echo "</div>";
} else {
    echo "<div id='title' class='quizlist'>";
    echo "<div style='clear:both'></div>";
    echo "<div class='quiztitle'>&nbsp;</div>";
    echo "<div class='quizcell'>Attempts</div>";
    echo "<div class='quizcell'>Highest Score</div>";
    echo "<div class='quizcell'>Lowest score</div>";
    echo "<div class='quizcell'>Average Score</div>";
    echo "<div class='quizcell'>Best Ranking</div>";
    echo "<div style='clear:both'></div>";
    echo "</div>";
    foreach ($results as $r) {
        echo "<div id='" . $r->ref . "' class='quizlist'>";
        echo "<div class='quiztitle'><a href='" . $CONFIG->homeAddress . "quiz/view.php?ref=" . $r->ref . "'>" . $r->title . "</a></div>";
Example #14
0
?>
</div>
	</div>
	<div class="formblock">
		<div class="formlabel"><?php 
echo getstring("profile.newpassword");
?>
</div>
		<div class="formfield"><input type="password" name="password" value=""></input></div>
	</div>
	<div class="formblock">
		<div class="formlabel"><?php 
echo getstring("profile.repeatnewpassword");
?>
</div>
		<div class="formfield"><input type="password" name="repeatpassword" value=""></input></div>
	</div>
	<div class="formblock">
		<div class="formlabel">&nbsp;</div>
		<div class="formfield"><input type="submit" name="submit" value="<?php 
echo getstring("profile.submit.button");
?>
"></input></div>
	</div>
</form>




<?php 
include_once "./includes/footer.php";
Example #15
0
    printf("<div class='warning'>%s</div>", getstring("warning.quiz.hasattempts"));
}
?>

<div id="quizform">
<form method="post" action="">
	<div class="info">
		You you sure you want to delete the quiz '<?php 
echo $q->title;
?>
'?
		<p>This will completely remove the quiz and all its questions and cannot be undone.</p>
	</div>
	<div class="formblock">
		<div class="formlabel">&nbsp;</div>
		<div class="formfield">
			<input type="submit" name="delete" value="<?php 
echo getstring("quiz.delete.button");
?>
"></input>
			<input type="submit" name="cancel" value="<?php 
echo getstring("quiz.delete.cancel.button");
?>
"></input>
		</div>
	</div>
</form>
</div>

<?php 
include_once "../includes/footer.php";
Example #16
0
    }
    ?>
						</div>
					</div>
				</div>
			<?php 
}
?>
			
	
		</div>
		<div class="formblock">
			<div class="formlabel">&nbsp;</div>
			<div class="formfield"><input type="button" name="addquestion" value="<?php 
echo getstring("quiz.new.add");
?>
" onclick="addQuestion()"/></div>
		</div>
		<div class="formblock">
			<div class="formlabel">&nbsp;</div>
			<div class="formfield"><input type="submit" name="submit" value="<?php 
echo getstring("quiz.new.submit.button");
?>
"></input></div>
		</div>
		<input type="hidden" id="noquestions" name="noquestions" value="2"/>

</form>
</div>
<?php 
include_once "../includes/footer.php";
Example #17
0
function visitor_from_request()
{
    global $namecookie, $webim_encoding, $usercookie;
    $defaultName = getstring("chat.default.username");
    $userName = $defaultName;
    if (isset($_COOKIE[$namecookie])) {
        $data = base64_decode(strtr($_COOKIE[$namecookie], '-_,', '+/='));
        if (strlen($data) > 0) {
            $userName = myiconv("utf-8", $webim_encoding, $data);
        }
    }
    if ($userName == $defaultName) {
        $userName = getgetparam('name', $userName);
    }
    if (isset($_COOKIE[$usercookie])) {
        $userId = $_COOKIE[$usercookie];
    } else {
        $userId = get_user_id();
        setcookie($usercookie, $userId, time() + 60 * 60 * 24 * 365);
    }
    return array('id' => $userId, 'name' => $userName);
}
Example #18
0
 function createQuizfromGIFT($content, $title, $quizdraft, $description, $tags)
 {
     global $IMPORT_INFO, $MSG, $CONFIG, $USER;
     //first check if this quiz already exists
     $sql = sprintf("SELECT q.qref FROM quizprop qp\n\t\t\t\t\t\tINNER JOIN quiz q ON q.quizid = qp.quizid\n\t\t\t\t\t\tWHERE qp.quizpropname='content' \n\t\t\t\t\t\tAND qp.quizpropvalue='%s'\n\t\t\t\t\t\tAND q.createdby=%d", $content, $USER->userid);
     $result = _mysql_query($sql, $this->DB);
     while ($o = mysql_fetch_object($result)) {
         // store JSON object for quiz (for caching)
         $obj = $this->getQuizObject($o->qref);
         return $obj;
     }
     $supported_qtypes = array('truefalse', 'multichoice', 'essay', 'shortanswer', 'numerical');
     $questions_to_import = array();
     include_once $CONFIG->homePath . 'quiz/import/gift/import.php';
     $import = new qformat_gift();
     $lines = explode("\n", $content);
     $questions = $import->readquestions($lines);
     foreach ($questions as $q) {
         if (in_array($q->qtype, $supported_qtypes)) {
             array_push($questions_to_import, $q);
         } else {
             if ($q->qtype != 'category') {
                 array_push($IMPORT_INFO, $q->qtype . " question type not yet supported ('" . $q->questiontext . "')");
             }
         }
     }
     if (count($questions_to_import) == 0) {
         array_push($MSG, getstring('import.quiz.error.nosuppportedquestions'));
         return;
     }
     if (count($MSG) == 0) {
         // now do the actual import
         // setup quiz with default props
         $quizid = $this->addQuiz($title, $quizdraft, $description);
         $this->setProp('quiz', $quizid, 'generatedby', 'import');
         $this->setProp('quiz', $quizid, 'content', $content);
         $this->updateQuizTags($quizid, $tags);
         $importer = new GIFTImporter();
         $importer->quizid = $quizid;
         $importer->import($questions_to_import);
         $this->setProp('quiz', $quizid, 'maxscore', $importer->quizmaxscore);
         $q = $this->getQuizById($quizid);
         // store JSON object for quiz (for caching)
         $obj = $this->getQuizObject($q->ref);
         $json = json_encode($obj);
         $this->setProp('quiz', $quizid, 'json', $json);
         return $obj;
     }
     return;
 }
Example #19
0
/**
 * Triggered when a track assignment takes place.
 * This function should use the CM configured values to send messages to appropriate users when a track assignment
 * takes place. Users will be ones configured for the context, which can include the user that is assigned and users
 * assigned to configured roles for that context. The message template used should be the one configured as well.
 *
 * @param object $eventdata the track assignment record
 * @return boolean success
 *
 */
function pm_notify_track_assign_handler($eventdata)
{
    global $CFG, $DB, $USER;
    /// Does the user receive a notification?
    $sendtouser = isset(elis::$config->local_elisprogram->notify_trackenrol_user) ? elis::$config->local_elisprogram->notify_trackenrol_user : '';
    $sendtorole = isset(elis::$config->local_elisprogram->notify_trackenrol_role) ? elis::$config->local_elisprogram->notify_trackenrol_role : '';
    $sendtosupervisor = isset(elis::$config->local_elisprogram->notify_trackenrol_supervisor) ? elis::$config->local_elisprogram->notify_trackenrol_supervisor : '';
    /// If nobody receives a notification, we're done.
    if (!$sendtouser && !$sendtorole && !$sendtosupervisor) {
        return true;
    }
    /// We get all context assigns, so check that this is a class. If not, we're done.
    $context = context_system::instance();
    /// Make sure this is a valid user.
    $enroluser = new user($eventdata->userid);
    if (!$enroluser) {
        if (in_cron()) {
            mtrace(getstring('nouser', 'local_elisprogram'));
        } else {
            print_error('nouser', 'local_elisprogram');
        }
        return true;
    }
    // Due to lazy loading, we need to pre-load this object
    $enroluser->load();
    if (empty($enroluser->id)) {
        if (in_cron()) {
            mtrace(getstring('nouser', 'local_elisprogram'));
        } else {
            print_error('nouser', 'local_elisprogram');
        }
        return true;
    }
    /// Get the track record from the track id.
    if (!($track = $DB->get_record('local_elisprogram_trk', array('id' => $eventdata->trackid)))) {
        if (in_cron()) {
            mtrace(get_string('notrack', 'local_elisprogram'));
        } else {
            print_error('notrack', 'local_elisprogram');
        }
        return true;
    }
    $message = new notification();
    /// Set up the text of the message
    $text = empty(elis::$config->local_elisprogram->notify_trackenrol_message) ? get_string('notifytrackenrolmessagedef', 'local_elisprogram') : elis::$config->local_elisprogram->notify_trackenrol_message;
    $search = array('%%userenrolname%%', '%%trackname%%');
    $replace = array($enroluser->moodle_fullname(), $track->name);
    $text = str_replace($search, $replace, $text);
    if ($sendtouser) {
        $message->send_notification($text, $enroluser);
    }
    $users = array();
    if ($sendtorole) {
        /// Get all users with the notify_trackenrol capability.
        if ($roleusers = get_users_by_capability($context, 'local/elisprogram:notify_trackenrol')) {
            $users = $users + $roleusers;
        }
    }
    if ($sendtosupervisor) {
        /// Get parent-context users.
        if ($supervisors = pm_get_users_by_capability('user', $eventdata->userid, 'local/elisprogram:notify_trackenrol')) {
            $users = $users + $supervisors;
        }
    }
    foreach ($users as $user) {
        $message->send_notification($text, $user, $enroluser);
    }
    /// If you don't return true, the message queue will clog and no more will be sent.
    return true;
}
Example #20
0
					</div>
				</div>
			</div>
		<?php 
}
?>
		

	</div>
	<div class="formblock">
		<div class="formlabel">&nbsp;</div>
		<div class="formfield"><input type="button" name="addquestion" value="<?php 
echo getstring("quiz.edit.add");
?>
" onclick="addQuestion()"/></div>
	</div>
	<div class="formblock">
		<div class="formlabel">&nbsp;</div>
		<div class="formfield"><input type="submit" name="submit" value="<?php 
echo getstring("quiz.edit.submit.button");
?>
"></input></div>
	</div>
	<input type="hidden" id="noquestions" name="noquestions" value="<?php 
echo count($qq);
?>
">
</form>
</div>
<?php 
include_once "../includes/footer.php";
Example #21
0
function start_html_output()
{
    $charset = getstring("output_charset");
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Pragma: no-cache");
    header("Content-type: text/html" . (isset($charset) ? "; charset=" . $charset : ""));
}
Example #22
0
<?php

include_once "../config.php";
$PAGE = "myquizzes";
include_once "../includes/header.php";
$quizzes = $API->getQuizzesForUser($USER->userid);
?>
<h1><?php 
echo getstring("myquizzes.title");
?>
</h1>
<?php 
if (count($quizzes) == 0) {
    echo "<div class='info'>";
    echo getstring("myquizzes.none", array($CONFIG->homeAddress . "quiz/new.php"));
    echo "</div>";
} else {
    echo "<div id='th' class='quizlist'>";
    echo "<div class='quiztitle'>Quiz</div>";
    echo "<div class='quizattempts'>Attempts</div>";
    echo "<div class='quizavg'>Average Score</div>";
    echo "<div class='quizopts'></div>";
    echo "<div style='clear:both'></div>";
    echo "</div>";
}
foreach ($quizzes as $q) {
    echo "<div id='" . $q->ref . "' class='quizlist'>";
    echo "<div class='quiztitle'><a href='" . $CONFIG->homeAddress . "quiz/view.php?ref=" . $q->ref . "'>" . $q->title . "</a>";
    if ($q->quizdraft == 1) {
        echo " (draft)";
    }
Example #23
0
<?php

/* 
 * 
 * Данный файл является частью проекта Веб Мессенджер.
 * 
 * Все права защищены. (c) 2005-2009 ООО "ТОП".
 * Данное программное обеспечение и все сопутствующие материалы
 * предоставляются на условиях лицензии, доступной по адресу
 * http://webim.ru/license.html
 * 
 */
require_once '../classes/functions.php';
require_once '../classes/class.operator.php';
require_once '../classes/class.thread.php';
$operator = Operator::getInstance()->GetLoggedOperator(false);
// папка online в мэмкэш --------------------
//touch_online_file(OPERATOR_VIEW_TRACKER_FILE);
$mem_buff->set('OPERATOR_VIEW_TRACKER_FILE', time(), 1800);
if (!$operator) {
    Browser::SendXmlHeaders();
    echo '<error><descr>' . escape_with_cdata(getstring('agent.not_logged_in')) . '</descr></error>';
    exit;
}
$xml = Thread::getInstance()->BuildVisitorsXml();
Browser::SendXmlHeaders();
echo $xml;
function spellStrings($spell, $trigger)
{
    switch ($trigger) {
        case 0:
            $sdesc = "<div class='armory-spellinfo'><font color='#1eff00'>Use: </font><a href='#'>" . getstring($spell) . "</a></div>";
            break;
        case 1:
            $sdesc = "<div class='armory-spellinfo'><font color='#1eff00'>Equip: </font><a href='#'>" . getstring($spell) . "</a></div>";
            break;
        case 2:
            $sdesc = "<div class='armory-spellinfo'><font color='#1eff00'>Chance on hit: </font><a href='#'>" . getstring($spell) . "</a></div>";
            break;
        case 4:
            $sdesc = "<div class='armory-spellinfo'><font color='#1eff00'>Soulstone: </font><a href='#'>" . getstring($spell) . "</a></div>";
            break;
        case 5:
            $sdesc = "<div class='armory-spellinfo'><font color='#1eff00'>No Delay: </font><a href='#'>" . getstring($spell) . "</a></div>";
            break;
        case 6:
            $sdesc = "<div class='armory-spellinfo'><font color='#1eff00'>Learn: </font><a href='#'>" . getstring($spell) . "</a></div>";
            break;
    }
    return $sdesc;
}
Example #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';
Example #26
0
     $link = connect();
     if (!check_connections_from_remote($remoteHost, $link)) {
         mysql_close($link);
         die("number of connections from your IP is exceeded, try again later");
     }
     $thread = create_thread($groupid, $visitor['name'], $remoteHost, $referrer, $current_locale, $visitor['id'], $userbrowser, $state_loading, $link);
     $_SESSION['threadid'] = $thread['threadid'];
     // Store own thread ids to restrict access for other people
     if (!isset($_SESSION['own_threads'])) {
         $_SESSION['own_threads'] = array();
     }
     $_SESSION['own_threads'][] = $thread['threadid'];
     if ($referrer) {
         post_message_($thread['threadid'], $kind_for_agent, getstring2('chat.came.from', array($referrer), true), $link);
     }
     post_message_($thread['threadid'], $kind_info, getstring('chat.wait', true), $link);
     if ($email) {
         post_message_($thread['threadid'], $kind_for_agent, getstring2('chat.visitor.email', array($email), true), $link);
     }
     if ($info) {
         post_message_($thread['threadid'], $kind_for_agent, getstring2('chat.visitor.info', array($info), true), $link);
     }
     if ($firstmessage) {
         $postedid = post_message_($thread['threadid'], $kind_user, $firstmessage, $link, $visitor['name']);
         if ($postedid) {
             commit_thread($thread['threadid'], array('shownmessageid' => intval($postedid)), $link);
         }
     }
     notify_operators($thread, $firstmessage, $link);
     mysql_close($link);
 }
Example #27
0
$page['email'] = $email;
if (!$email) {
    $errors[] = no_field("form.field.email");
} else {
    if (!is_valid_email($email)) {
        $errors[] = wrong_field("form.field.email");
    }
}
if (count($errors) > 0) {
    $page['formemail'] = $email;
    $page['ct.chatThreadId'] = $thread['threadid'];
    $page['ct.token'] = $thread['ltoken'];
    $page['level'] = "";
    setup_logo();
    expand("styles", getchatstyle(), "mail.tpl");
    exit;
}
$history = "";
$lastid = -1;
$output = get_messages($threadid, "text", true, $lastid);
foreach ($output as $msg) {
    $history .= $msg;
}
$subject = getstring("mail.user.history.subject");
$body = getstring2("mail.user.history.body", array($thread['userName'], $history));
$link = connect();
webim_mail($email, $webim_mailbox, $subject, $body, $link);
mysql_close($link);
setup_logo();
expand("styles", getchatstyle(), "mailsent.tpl");
exit;
Example #28
0
echo count($scores);
?>
);

			<?php 
$c = 0;
foreach ($scores as $k => $v) {
    printf("data.setValue(%d, 0, 'scored %d %%');", $c, $k);
    printf('data.setValue(%d, 1, %d);', $c, $v);
    $c++;
}
?>
	
			var chart = new google.visualization.PieChart(document.getElementById('chart_div<?php 
echo $ref;
?>
'));
			chart.draw(data, {
					width: 800, 
					height: 400, 
					chartArea:{left:50,top:50,width:"80%",height:"75%"}
				});
		}
		</script>
		<div id="chart_div<?php 
echo $ref;
?>
"><?php 
echo getstring('warning.graph.unavailable');
?>
</div>
Example #29
0
}
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);
    } elseif ($show == 'redirected') {
        $page['message'] = getlocal2("chat.redirected.content", array("Administrator"));
    }
    $page['redirectLink'] = "{$webimroot}/operator/themes.php?preview={$preview}&amp;show=redirect";
    expand("../styles", "{$preview}", "{$show}.tpl");
    exit;
}
$templateList = array(array('label' => getlocal("page.preview.userchat"), 'id' => 'chat', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.chatsimple"), 'id' => 'chatsimple', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.nochat"), 'id' => 'nochat', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.survey"), 'id' => 'survey', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.leavemessage"), 'id' => 'leavemessage', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.leavemessagesent"), 'id' => 'leavemessagesent', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.mail"), 'id' => 'mail', 'h' => 254, 'w' => 603), array('label' => getlocal("page.preview.mailsent"), 'id' => 'mailsent', 'h' => 254, 'w' => 603), array('label' => getlocal("page.preview.redirect"), 'id' => 'redirect', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.redirected"), 'id' => 'redirected', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.agentchat"), 'id' => 'agentchat', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.agentrochat"), 'id' => 'agentrochat', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.error"), 'id' => 'error', 'h' => 480, 'w' => 640));
$template = verifyparam("template", "/^\\w+\$/", "chat");
$page['formpreview'] = $preview;
$page['formtemplate'] = $template;
$page['canshowerrors'] = $template == 'leavemessage' || $template == 'mail' || $template == 'all';
$page['formshowerr'] = $showerrors;
Example #30
0
		<div class="formlabel"><?php 
echo getstring("register.firstname");
?>
</div>
		<div class="formfield"><input type="text" name="firstname" value="<?php 
echo $firstname;
?>
"></input></div>
	</div>
	<div class="formblock">
		<div class="formlabel"><?php 
echo getstring("register.surname");
?>
</div>
		<div class="formfield"><input type="text" name="surname" value="<?php 
echo $surname;
?>
"></input></div>
	</div>
	<div class="formblock">
		<div class="formlabel">&nbsp;</div>
		<div class="formfield"><input type="submit" name="submit" value="<?php 
echo getstring("register.submit.button");
?>
"></input></div>
	</div>
	
</form>

<?php 
include_once "./includes/footer.php";