Author: Vasiliy Pedak (truvazia@gmail.com)
Inheritance: extends RestController
 public function approve()
 {
     if (Request::ajax()) {
         $pending = PendingEnrollment::find(Input::get('id'));
         SectionCode::find($pending->section_code_id)->push('students_id', $pending->student_id, true);
         $pending->delete();
         return Response::json(array('code' => "00", 'stats' => MessageController::getStats()));
     }
 }
示例#2
0
 /**
  * Show all subjects of an University 
  * 
  * @return View
  */
 public function showAllSubjectsView()
 {
     return View::make('university.show_all_subjects')->with(array('subjects' => $this->getSubjects(), 'stats' => MessageController::getStats()));
 }
示例#3
0
 /**
  *	Return the stats message for a User
  * 
  * @return Array(Stats)
  */
 public static function getStats()
 {
     $messages = UserController::getUser(Auth::user())->messages();
     $inbox = $messages->where('from', '!=', Auth::id())->where('archived', false)->count();
     $sent = $messages->where('from', Auth::id())->where('archived', false)->count();
     $archived = $messages->where('archived', true)->count();
     return array('inbox' => $inbox, 'unread' => count(MessageController::unReadMessages("all")), 'sent' => $sent, 'archived' => $archived, 'approve' => PendingEnrollment::where('teacher_id', Auth::id())->count(), 'join' => PendingGroup::where('teamleader_id', Auth::id())->count());
 }
示例#4
0
<?php

include '../../../../Conf/Include.php';
//INICIAMOS SESION
Session::InitSession();
//CARGAMOS LA DEPENDENCIA
set_dependencies(array("MessageController"));
$messages = new MessageController();
$r = $messages->GetMessageTrash(Session::GetSession("login", "id"), MESSAGE_TO);
$a = array("count" => sizeof($r), "data" => $r);
unset($messages);
echo json_encode($a);
exit;
示例#5
0
<?php

include '../../../../Conf/Include.php';
//INICIAMOS SESION
Session::InitSession();
//CARGAMOS LA DEPENDENCIA
set_dependencies(array("MessageController"));
//OBTENEMOS EL ID DEL MENSAJE
$id = $_GET['id'];
//CARGAMOS EL CONTROLADOR
$msj = new MessageController();
$msj->SetReadChat($id);
exit;
示例#6
0
<?php

include '../../../../Conf/Include.php';
//INICIAMOS SESION
Session::InitSession();
//CARGAMOS LA DEPENDENCIA
set_dependencies(array("MessageController"));
//OBTENEMOS EL ID DEL MENSAJE
$id = $_GET['id_message'];
//CARGAMOS EL CONTROLADOR
$msj = new MessageController();
$request = $msj->GetChatById($id);
$first = $msj->GetMessageById($id);
if (count($first) == 0) {
    $first = "";
} else {
    $first = $first[0]['mensaje'];
}
$data = array("me" => Session::GetSession("login", "id"), "chat" => $request, "mensaje" => htmlspecialchars_decode($first, ENT_QUOTES));
$json = new SivarApi\Tools\Services_JSON();
echo $json->encode($data);
exit;
//CONVERTIMOS EN FORMATO JSON
//echo "<pre>";
//print_r($request);
//echo "</pre>";
示例#7
0
 public function spotmenu()
 {
     global $varChecker;
     $page = $this->getPage();
     if ($userId = MemoryHandler::getInstance()->pageLocked($page) !== false) {
         $userWithLock = $this->dRep->getUser($userId);
         if ($userWithLock->getId() != $this->INK_User->getId()) {
             $this->pixelcms->disable = true;
             $msgController = new MessageController($this->dRep);
             return $msgController->getMessage('isLocked');
         }
     }
     if ($varChecker->getVAlue('tplId') < 1) {
         throw new DataException('invalidpixelcms');
     }
     //if pixelcms has changed set the new one.
     if ($varChecker->getValue('tplId') != $page->getpixelcms()->getId()) {
         $pixelcms = $this->dRep->getpixelcms($varChecker->getValue('tplId'));
         $page->setProperties(array('pixelcms' => $pixelcms));
     }
     $this->dRep->savePage($page, false);
     ob_start();
     foreach ($page->getpixelcms()->getSpots() as $tplSpotId => $spot) {
         if (!$spot->uservalue()) {
             continue;
         }
         $id = $tplSpotId;
         $order = $spot->order();
         $name = $spot->getName();
         $spotType = $spot->getType();
         $sysName = $spot->systemName();
         $description = $spot->getDescription();
         $buttonSrc = $spot->getButtonimage();
         include 'view/pages/spotbutton.pages.php';
     }
     $spots = ob_get_clean();
     ob_start();
     include 'view/pages/spotmenu.pages.php';
     echo json_encode(array('success' => 'spotmenu', 'html' => ob_get_clean()));
 }
示例#8
0
function message_on_send(&$api)
{
    include dirname(__FILE__) . '/message_controller.class.php';
    $parent_id = (int) $_POST['parent_id'];
    $may_quote = (int) $_POST['may_quote'];
    $controller = new MessageController($api);
    $user = $api->user();
    $forum_id = $api->forum()->get_id();
    $forumdb = $api->forumdb();
    $api->group()->assert_may('write');
    // Check whether editing is allowed per configuration.
    if ($_POST['msg_id'] && !cfg('postings_editable')) {
        die('Postings may not be changed as per configuration.');
    }
    // Fetch the posting from the database (when editing an existing one) or
    // create a new one from the POST data.
    if ($_POST['msg_id']) {
        $posting = $forumdb->get_posting_from_id($_POST['msg_id']);
        $old_hash = $posting->get_hash();
        $posting->set_subject($_POST['subject']);
        $posting->set_body($_POST['body']);
        $new_hash = $posting->get_hash();
        // Was the content changed?
        if ($old_hash === $new_hash) {
            $api->refer_to_posting($posting);
        } else {
            // Processing without labeling as modified after creation for xx seconds.
            $marker_delay = (int) cfg('posting_marker_delay', 10);
            $created_on = (int) $posting->get_created_unixtime();
            $updated_on = time();
            if ($created_on + $marker_delay < $updated_on) {
                $posting->set_updated_unixtime($updated_on);
            }
        }
    } else {
        $posting = message_get_new_posting($api);
        message_init_posting_from_post_data($posting);
    }
    // Make sure that the user is not trying to spoof a name.
    if (!$user->is_anonymous() && $user->get_name() !== $posting->get_username()) {
        die('Username does not match currently logged in user');
    }
    // Check the posting for completeness.
    $err = $posting->check_complete();
    if ($err) {
        $controller->add_hint(new \hint\Error($err));
        return $controller->show_compose($posting, $parent_id, $may_quote);
    }
    // Make sure that the username is not in use.
    if ($user->is_anonymous() && !$api->userdb()->username_is_available($posting->get_username())) {
        $err = _('The entered username is not available.');
        $controller->add_hint(new \hint\Error($err));
        return $controller->show_compose($posting, $parent_id, $may_quote);
    }
    if ($posting->get_id() <= 0) {
        // If the posting a new one (not an edited one), check for duplicates.
        $duplicate_id = $forumdb->get_duplicate_id_from_posting($posting);
        if ($duplicate_id) {
            $api->refer_to_posting_id($duplicate_id);
        }
        // Check whether too many messages were sent.
        $blocked_until = $api->forumdb()->get_flood_blocked_until($posting);
        if ($blocked_until) {
            $err = sprintf(_('You have sent too many messages.' . ' %d seconds until your message may be sent.'), $blocked_until - time());
            $controller->add_hint(new \hint\Error($err));
            return $controller->show_compose($posting, $parent_id, $may_quote);
        }
        // Check whether the user or IP is spam-locked.
        if ($api->forumdb()->is_spam($posting)) {
            $controller->add_hint(new \hint\Error(_('Message rejected by spamblocker.')));
            return $controller->show_compose($posting, $parent_id, $may_quote);
        }
    }
    // Save the posting.
    $eventbus = $api->eventbus();
    if ($posting->get_id()) {
        $forumdb->save($forum_id, $parent_id, $posting);
        /* Plugin hook: on_message_edit_after
         *   Called after a message was edited.
         *   Args: parent: The parent message id or NULL.
         *         posting: The posting that was saved.
         */
        $eventbus->emit('on_message_edit_after', $api, $parent_id, $posting);
    } else {
        $forumdb->insert($forum_id, $parent_id, $posting);
        /* Plugin hook: on_message_insert_after
         *   Called after a new message was posted.
         *   Args: parent: The parent message id or NULL.
         *         posting: The posting that was sent.
         */
        $eventbus->emit('on_message_insert_after', $api, $parent_id, $posting);
    }
    if (!$posting->get_id()) {
        $controller->add_hint(new \hint\Error(_('Failed to save the posting.')));
        return $controller->show_compose($posting, $parent_id, $may_quote);
    }
    // Success! Refer to the new item.
    $api->refer_to_posting($posting);
}
示例#9
0
<?php

include_once "include/session.php";
session_start();
$user = get_loggedin_user();
if (isset($user)) {
    // if the user is currently logged in
    include_once "controller/message.php";
    $message_controller = new MessageController();
    $message_controller->invoke_message_box();
} else {
    // if the user is currently not logged in
    header("Location: login.php");
}
示例#10
0
    MessageController::createMessage($id);
});
$routes->get('/message/:id/edit', function ($id) {
    BaseController::check_message_rights($id);
    MessageController::editMessage($id);
});
$routes->post('/thread/:thread_id/message', 'check_logged_in', function ($thread_id) {
    MessageController::addMessage($thread_id);
});
$routes->post('/message/:id/update', function ($id) {
    BaseController::check_message_rights($id);
    MessageController::updateMessage($id);
});
$routes->post('/message/:id/destroy', function ($id) {
    BaseController::check_message_rights($id);
    MessageController::destroyMessage($id);
});
//Login
$routes->get('/login', function () {
    LoginController::login();
});
$routes->post('/login', function () {
    LoginController::handleLogin();
});
$routes->post('/logout', function () {
    LoginController::logout();
});
$routes->get('/register', function () {
    LoginController::register();
});
$routes->post('/register', function () {
示例#11
0
<?php

/**
 * @version 1.0
 * @license MIT
 * @copyright (c) 2015, Lieison
 * 
 * ULTIMA ALTERACION 
 *      JUNIO 2015
 * 
 * ESTE SCRIPT SE MANEJA EN js/chat.js 
 * SE ENCARGA DE CARGAR AL SIDEBAR LOS CHATS
 * 
 * 
 */
include '../../../../Conf/Include.php';
//INICIAMOS SESION
Session::InitSession();
//CARGAMOS LA DEPENDENCIA
set_dependencies(array("MessageController"));
//OBTENEMOS EL ID DEL MENSAJE
$id = $_GET['id_message'];
//CARGAMOS EL CONTROLADOR
$msj = new MessageController();
//OBTENEMOS LOS DATOS
$request = $msj->GetChatById($id);
//CONVERTIMOS EN FORMATO JSON
echo "<pre>";
print_r($request);
echo "</pre>";
<?php

include_once "include/session.php";
session_start();
$user = get_loggedin_user();
if (isset($user)) {
    // if the user is currently logged in
    include_once "controller/message.php";
    $message_controller = new MessageController();
    $message_controller->invoke_get_received_message();
} else {
    // if the user is currently not logged in
    header("Location: login.php");
}
示例#13
0
<?php

include '../../../../Conf/Include.php';
//INICIAMOS SESION
Session::InitSession();
//CARGAMOS LA DEPENDENCIA
set_dependencies(array("MessageController"));
//VERIFICAMOS LOS MULTIPLES IDS
$id = explode(",", $_GET['id_message']);
$array_ = array();
//RECORREMOS LOS IDS
foreach ($id as $value) {
    $msj = new MessageController();
    //controlador
    $request = $msj->GetActiveUserChat($value);
    //data
    $count_msj = $msj->GetCountSubMessage($value, Session::GetSession("login", "id"));
    //cantidad de mensajes
    $array_[] = array("date" => $request['fecha'], "time" => $request['hora'], "count" => $count_msj, "data" => $request, "id" => $value, "id_user" => $request['id_user']);
    unset($msj);
}
function comparedate($a, $b)
{
    if ($a['date'] < $b['date']) {
        return $b;
    }
}
function comparetime($a, $b)
{
    return $a['time'] < $b['time'];
}
示例#14
0
<?php

include '../../../Conf/Include.php';
Session::InitSession();
set_dependencies(array("AdminController", "MessageController"));
$messagecontroller = new MessageController();
$id_user = $_SESSION['login']['id'];
$count = $messagecontroller->GetMessageCountFrom($id_user);
$msjto = $messagecontroller->GetMessageFrom($id_user, null);
$count_submsj = 0;
if (count($msjto) == 0) {
    $msjto = $messagecontroller->GetMessageTo($id_user, null);
}
foreach ($msjto as $k => $v) {
    $r = $messagecontroller->GetCountSubMessage($v['id_mensaje'], $id_user);
    $count_submsj += count($r);
}
$count += $count_submsj;
if ($count == 0) {
    echo 0;
} else {
    echo $count;
}
unset($messagecontroller);
exit;
示例#15
0
$type = $_REQUEST['type'] ?: null;
set_dependencies(array("TaskController", "LogsController", "MessageController"));
if (SivarApi\Tools\Validation::Is_Empty_OrNull($type)) {
    echo 0;
    exit;
}
try {
    $task = new TaskController();
    Session::InitSession();
    $id_user = Session::GetSession("login", "id");
    $encript = new \SivarApi\Tools\Encriptacion\Encriptacion();
    $id_mt = $encript->Md5Encrypt(mt_rand(0, 1000) . mt_rand(100, 500) . $id_user . $_REQUEST['title']);
    $box_files = $_REQUEST['box_nodes'] ?: "";
    $mensaje = htmlspecialchars("<b>La tarea Consiste en :</b><br> " . $_REQUEST['client_description'] . "<div align='center'><a target='_blank' class='btn btn-circle green-haze btn-sm ' href='" . FunctionsController::GetUrl("task/show_task.php?id={$id_mt}") . "'>Ver tarea ...</a></div>", ENT_QUOTES);
    $asunto = " Tarea :" . $_REQUEST['title'];
    $msj = new MessageController();
    $id_msj = $msj->SetmessageLastId($_REQUEST['id_user'], $id_user, $mensaje, $asunto);
    $val = $task->SaveTask(array("id_multitask" => $id_mt, "id_client" => $_REQUEST['id_client'], "id_user_from" => $id_user, "description" => $_REQUEST['client_description'] ?: "ERROR", "title" => $_REQUEST['title'], "status" => 1), array("id_multitask" => $id_mt, "id_type" => 1, "id_user_from" => $id_user, "id_user_to" => $_REQUEST['id_user'], "id_message" => $id_msj[0]['id'], "date_asign" => FunctionsController::get_date(), "time_asign" => FunctionsController::get_time(), "box_files" => $box_files, "files" => $_REQUEST['other_docs'] ?: "", "comments" => $_REQUEST['user_comment'], "date_deadline" => FunctionsController::ReWriteDate($_REQUEST['deadline']), "time_deadline" => $_REQUEST['hourdead'], "status" => $_REQUEST['user_activate']));
    if (!$val) {
        echo 0;
    } else {
        echo $id_mt;
    }
} catch (Exception $ex) {
    $error = "(" . FunctionsController::get_date() . ")";
    $error .= "(" . FunctionsController::get_time() . ")";
    $error .= "(ERROR==>" . $ex->getMessage() . ")";
    $dir = "../../task/logs/";
    $log = new LogsController($dir);
    $log->SetLog($error);
    $log->CloseLog();
示例#16
0
<?php

include '../../../../Conf/Include.php';
//INICIAMOS SESION
Session::InitSession();
//CARGAMOS LA DEPENDENCIA
set_dependencies(array("MessageController"));
//OBTENEMOS EL ID DEL MENSAJE
$id = $_GET['id'];
//CARGAMOS EL CONTROLADOR
$msj = new MessageController();
$msj->SetReadInbox($id);
exit;
 public function testRepeat()
 {
     $message = new MessageController('messageTest');
     $this->assertEquals($message->repeat("Hello, Any One Out There?"), "Hello, Any One Out There?");
 }
示例#18
0
<?php

include '../../../../Conf/Include.php';
//INICIAMOS SESION
Session::InitSession();
$to = $_GET['msj_to'];
$from = Session::GetSession("login", "id");
$business = $_GET['msj_bussines'];
$msj = $_GET['msj'];
//CARGAMOS LA DEPENDENCIA
set_dependencies(array("MessageController"));
$messages = new MessageController();
$request = $messages->SetMessage($to, $from, $msj, $business);
echo $request;
unset($messages);
exit;
示例#19
0
<?php

include '../../../../Conf/Include.php';
//INICIAMOS SESION
Session::InitSession();
//CARGAMOS LA DEPENDENCIA
set_dependencies(array("MessageController"));
$messages = new MessageController();
$r = $messages->GetMessageTo(Session::GetSession("login", "id"));
$a = array("count" => sizeof($r), "data" => $r);
unset($messages);
echo json_encode($a);
exit;
示例#20
0
});
$routes->get('/groups/:group_id/edit', function ($group_id) {
    GroupController::edit($group_id);
});
$routes->post('/groups/:group_id/edit', function ($group_id) {
    GroupController::update($group_id);
});
$routes->post('/groups/:group_id/expel/:user_id', function ($group_id, $user_id) {
    GroupController::expel($group_id, $user_id);
});
$routes->post('/groups/:group_id/invite', function ($group_id) {
    GroupController::invite($group_id);
});
$routes->post('/groups/:group_id/delete', function ($group_id) {
    GroupController::destroy($group_id);
});
$routes->get('/topics/:topic_id', function ($topic_id) {
    ForumController::topic($topic_id);
});
$routes->post('/topics/:topic_id/', function ($topic_id) {
    MessageController::store($topic_id);
});
$routes->get('/topics/:topic_id/:message_id/edit', function ($topic_id, $message_id) {
    MessageController::edit($message_id, $topic_id);
});
$routes->post('/topics/:topic_id/:message_id/edit', function ($topic_id, $message_id) {
    MessageController::update($message_id, $topic_id);
});
$routes->post('/topics/:topic_id/:message_id/delete', function ($topic_id, $message_id) {
    MessageController::delete($message_id, $topic_id);
});
 /**
  *	Show all assigments view
  * 
  * @return View
  */
 public function showAllAssignmentsView()
 {
     return View::make('university.show_all_enrollment')->with(array('teachers' => TeacherController::getTeachers(), 'stats' => MessageController::getStats()));
 }
示例#22
0
<?php

include '../../../../Conf/Include.php';
//INICIAMOS SESION
Session::InitSession();
//CARGAMOS LA DEPENDENCIA
set_dependencies(array("MessageController"));
//OBTENEMOS EL ID DEL MENSAJE
$message = $_GET['message'];
$iduser = Session::GetSession("login", "id");
$id = $_GET['id'];
//CARGAMOS EL CONTROLADOR
$msj = new MessageController();
if ($msj->SetSubmessage($id, $iduser, $message)) {
    echo 1;
} else {
    echo 0;
}
exit;
示例#23
0
    }
    /*** run the controller ***/
    $router->RunController($hasUser);
    //print out the page
    $router->printHtml($hasUser);
} catch (AccessException $e) {
    $message['css'] = 'hidden';
    $message['text'] = '';
    $message['icon'] = '';
    if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']) !== false) {
        try {
            if ($e->getMessage() == 'logout') {
                $fido->kill();
            }
            include_once 'controllers/message.controller.php';
            $messageController = new MessageController($dRep);
            $message = $messageController->getLoginMessage($e);
        } catch (Exception $e) {
            $message['css'] = 'error-box';
            $message['text'] = $e->getMessage();
        }
    }
    include_once 'view/login/login.php';
} catch (PDOException $e) {
    print_r($e);
} catch (DataException $e) {
    if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
        echo json_encode(array('error' => $e->getMessage(), 'elements' => implode(',', $e->getElements())));
    } else {
        echo 'Message: ' . $e->getMessage();
        echo '<br/>';
示例#24
0
<?php

include '../../../../Conf/Include.php';
//INICIAMOS SESION
Session::InitSession();
//CARGAMOS LA DEPENDENCIA
set_dependencies(array("MessageController"));
$messages = new MessageController();
$r = $messages->GetMessageFrom(Session::GetSession("login", "id"), NULL, 2, TRUE);
$a = array("count" => sizeof($r), "data" => $r);
unset($messages);
echo json_encode($a);
exit;
示例#25
0
     $rulesView = new View();
     $sMainContentView = $rulesView->fetch('rules.tpl');
     break;
 case 'play':
     $CardsView = new CardsView();
     $userController = new AccountController();
     $userId = $_SESSION['user']['id'];
     if (isset($userId)) {
         $totalChips = $userController->getTotalChips($userId);
         $sMainContentView = $CardsView->getMainPlay($totalChips);
     } else {
         $sMainContentView = $CardsView->fetch('play.tpl');
     }
     if (isset($_POST)) {
         $CardsController = new CardsController();
         $MessageController = new MessageController();
         $CardsView = new CardsView();
         if (isset($_POST['deal'])) {
             $bet = $_POST['bet'];
             $bankroll = $_POST['bankroll'];
             $cards = $CardsController->deal($bet, $bankroll);
             $sMainContentView = $CardsView->getCards($cards, $message);
         } elseif (isset($_POST['hit'])) {
             $previousRound = $_SESSION['cards'];
             $previousRound['user_id'] = $_POST['userId'];
             $cards = $CardsController->hit($previousRound);
             $message = $MessageController->gameResult($cards);
             $sMainContentView = $CardsView->getCards($cards, $message);
         } elseif (isset($_POST['stand'])) {
             $previousRound = $_SESSION['cards'];
             $previousRound['user_id'] = $_POST['userId'];
示例#26
0
@extends(Auth::user()->rank.'.master')
@section('content')
	<div class="content">
		<div class="row">
			<div class="panel-heading">
				@yield('header')
			</div>
		</div>
		<div class="row inbox">
			<div class="col-md-2 mail-left-box">
				<?php 
$stats = MessageController::getStats();
?>
				<a data-toggle="modal" data-target="#sendMessage" class="btn btn-block btn-compose btn-lg"><i class="fa fa-"></i>{{Lang::get('messages.compose')}}</a> 
				<div class="list-group inbox-options">
					<a href="{{Lang::get('routes.inbox')}}" class="list-group-item">
						<i class="fa fa-inbox"></i> {{Lang::get('messages.inbox')}} 
						@if($stats['inbox'] > 0)
							<span id="span_inbox" class="badge bg-primary">{{$stats['inbox']}}</span>
						@endif 
					</a> 
					<a href="{{Lang::get('routes.unread')}}"class="list-group-item">
						<i class="fa fa-bolt"></i> {{Lang::get('messages.unread')}} 
						@if($stats['unread'] > 0)
							<span id="span_unread" class="badge bg-primary">{{$stats['unread']}}</span> 
						@endif
					</a> 
					<a href="{{Lang::get('routes.mail_sent')}}" id="sent" class="list-group-item">
						<i class="fa fa-check-square-o"></i> {{Lang::get('messages.sent')}} 
						@if($stats['sent'] > 0)
							<span id="span_sent" class="badge  bg-primary">{{$stats['sent']}}</span> 
示例#27
0
 public function showApprovalStudentView()
 {
     $pending = PendingEnrollment::where('teacher_id', Auth::id())->get();
     if (count($pending) > 0) {
         return View::make('teacher.approval_student')->with(array('pending' => $pending, 'stats' => MessageController::getStats()));
     } else {
         return Redirect::to(Lang::get('routes.' . Auth::user()->rank));
     }
 }