/**
  * Constructor of the Class
  *
  * @author Jonathan Sandoval <*****@*****.**>
  * @param  integer $idUser    idUser
  * @param  integer $idChurch  idChurch
  * @param  boolean $full      full document
  */
 function __construct($idUser = 0, $idChurch = 0)
 {
     //Define the constructor
     parent::FPDF('L', 'mm', 'Letter');
     $this->church = ChurchManager::getSingleChurch('id', $idChurch);
     $this->user = SessionManager::getSingleUser('id', $idUser);
 }
Ejemplo n.º 2
0
 public function startApp()
 {
     $rootLocation = "Location:http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
     $lv = new LayoutView();
     $ud = new userDAL();
     $sm = new SessionManager();
     $lm = new LoginModel($ud, $sm);
     if (!$lm->isUserLoggedIn()) {
         if ($lv->userWantsToRegister()) {
             $validate = new ValidateCredentials();
             $v = new RegisterView($validate, $sm);
             $c = new RegisterController($v, $ud, $sm);
             $c->userPost();
             if ($sm->SessionGetSuccessfulRegistration()) {
                 header($rootLocation);
             }
         } else {
             $v = new LoginView($lm, $sm);
             $c = new LoginController($v, $lm);
             $c->userPost();
         }
     }
     if ($lm->isUserLoggedIn()) {
         $c = new GameController($lm, $ud, $sm, $lv);
         $v = $c->startApp();
         if ($c->userWantsToLogout()) {
             header($rootLocation);
         }
     }
     $lv->render($v, $lm->isUserLoggedIn());
 }
Ejemplo n.º 3
0
 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param Array $config the application configuration.
  * @see BaseMeli::__construct in Meli.php
  */
 public function __construct($config, $sm = NULL)
 {
     if (is_null($sm)) {
         $sm = new SessionManager();
     }
     $sm->start();
     parent::__construct($config);
 }
Ejemplo n.º 4
0
 public function Init()
 {
     $xmlFiles = $this->sessionManager->get("xml");
     $this->fileParams["filePath"] = $xmlFiles->xml_menus;
     $this->fileParams["rootNode"] = "menu";
     $this->fileParams["menuId"] = "side";
     $this->xml = new XmlLoader($this->fileParams);
     $this->Render();
 }
 function login()
 {
     if (session_id() == '') {
         session_start();
     }
     if (isset($_POST["mail"]) & isset($_POST["password"]) & isset($_POST["cre"])) {
         if ($_POST["mail"] != "" and $_POST["password"] != "" and $_POST["cre"] != "") {
             $mail = $_POST["mail"];
             $password = $_POST["password"];
             $role = $_POST["cre"];
             require_once 'SessionManager.php';
             $session_manager = new SessionManager();
             require_once 'medoo.min.php';
             $database = new medoo();
             $count = $database->count("triotrack_users", ["email" => "{$mail}"]);
             if ($count > 0) {
                 $profile = $database->get("triotrack_users", ["username", "password", "salt", "client"], ["email" => "{$mail}"]);
                 if ($role === "admin") {
                     if ($profile["password"] === sha1($password . $profile["salt"])) {
                         $username = $profile["username"];
                         $client = $profile["client"];
                         $cookie = array("email" => "{$mail}", "username" => "{$username}", "password" => "{$password}", "client" => "{$client}", "role" => "{$role}");
                         $encoded_cookie = $session_manager->encode_session(json_encode($cookie));
                         $_SESSION["user_id"] = $encoded_cookie;
                         setcookie("user_id", $encoded_cookie, time() + 86400 * 1, "/");
                         // 86400 = 1 day
                         echo "admin";
                         exit;
                     } else {
                         echo "failed";
                         exit;
                     }
                 } else {
                     if ($profile["client"] === $password) {
                         $username = $profile["username"];
                         $client = $profile["client"];
                         $cookie = array("email" => "{$mail}", "username" => "{$username}", "password" => "{$password}", "client" => "{$client}", "role" => "{$role}");
                         $encoded_cookie = $session_manager->encode_session(json_encode($cookie));
                         $_SESSION["user_id"] = $encoded_cookie;
                         setcookie("user_id", $encoded_cookie, time() + 86400 * 1, "/");
                         // 86400 = 1 day
                         echo "client";
                         exit;
                     } else {
                         echo "failed";
                         exit;
                     }
                 }
             }
         } else {
             echo "failed";
         }
         exit;
     }
 }
Ejemplo n.º 6
0
function vtws_logout($sessionId, $user)
{
    $sessionManager = new SessionManager();
    $sid = $sessionManager->startSession($sessionId);
    if (!isset($sessionId) || !$sessionManager->isValid()) {
        return $sessionManager->getError();
    }
    $sessionManager->destroy();
    //	$sessionManager->setExpire(1);
    return array("message" => "successfull");
}
Ejemplo n.º 7
0
 public function __construct()
 {
     if (SessionManager::getInstance()->isAdmin()) {
         $aid = SessionManager::getInstance()->getAdminID();
         $admin = DBManager::getInstance()->getAdmin($aid);
         $this->isGlobalAdmin = $admin['isGlobalAdmin'];
         $this->adminGroups = DBManager::getInstance()->getAdminGroupsByAdminID($aid);
         $this->servers = DBManager::getInstance()->getAdminGroupServersByAdminId($aid);
         $this->perms = array();
         foreach ($this->adminGroups as $group) {
             foreach ($group['adminOnServers'] as $serverId) {
                 foreach ($group['perms'] as $perm => $value) {
                     if ($perm != 'serverID' && $perm != 'groupID') {
                         if (!isset($this->perms[$serverId])) {
                             $this->perms[$serverId] = array();
                         }
                         $this->perms[$serverId][$perm] = $value;
                     }
                 }
             }
         }
     } else {
         $this->isGlobalAdmin = false;
         $this->perms = DBManager::$defaultAdminGroupPerms;
         $this->servers = array();
     }
 }
Ejemplo n.º 8
0
 /**
  * Return filters for a saved search.
  *
  * @param int $id Search hash
  *
  * @return mixed array of filters or false if the given search has no filters.
  */
 protected function getSearchSettings($id)
 {
     $search = $this->table->get('Search')->select(['finna_search_id' => $id])->current();
     if (empty($search)) {
         return false;
     }
     $sessId = $this->session->getId();
     if ($search->session_id == $sessId) {
         $minSO = $search->getSearchObject();
         $savedSearch = $minSO->deminify($this->results);
         $params = $savedSearch->getUrlQuery()->getParamArray();
         $settings = [];
         if (isset($params['filter'])) {
             $settings['filters'] = $params['filter'];
         }
         $params = $savedSearch->getParams();
         $daterange = $params->getSpatialDateRangeFilter();
         if ($daterange) {
             $field = $params->getSpatialDateRangeField() . '_type';
             $type = $daterange['type'];
             $settings['params'] = [$field => $type];
         }
         return $settings;
     }
     return false;
 }
Ejemplo n.º 9
0
 private function showConnectedProfiles()
 {
     $output = '<div class="clearfix networks">';
     $facebookLoginUrl = SessionManager::getInstance()->getFacebook()->getLoginUrl(array('redirect_uri' => APP_URL . '/' . Content::l() . '/login/facebookcallback/' . Content::l() . '/settings/', 'scope' => 'publish_stream'));
     $linkedInLoginUrl = APP_URL . '/' . Content::l() . '/login/linkedin/' . Content::l() . '/settings/';
     $twitterLoginUrl = APP_URL . '/' . Content::l() . '/login/twitter/' . Content::l() . '/settings/';
     // Facebook
     $output .= '<div class="clearfix">';
     if ($this->userDetails['facebook_access_token']) {
         $output .= '<a href="' . $facebookLoginUrl . '" id="loginFacebook" class="ir loggedIn">Facebook</a>' . '<a href="/' . Content::l() . '/ajax/disconnect/?network=Facebook" class="disconnect">' . str_replace('SOCIAL_NETWORK_NAME', 'Facebook', Content::c()->settings->disconnect) . '</a>';
     } else {
         $output .= '<a href="' . $facebookLoginUrl . '" id="loginFacebook" class="ir">Facebook</a>' . '<a href="' . $facebookLoginUrl . '" class="connect">' . str_replace('SOCIAL_NETWORK_NAME', 'Facebook', Content::c()->settings->connect) . '</a>';
     }
     // LinkedIn
     $output .= '</div><div class="clearfix">';
     if ($this->userDetails['linkedin_access_token']) {
         $output .= '<a href="' . $linkedInLoginUrl . '" id="loginLinkedIn" class="ir loggedIn">LinkedIn</a>' . '<a href="/' . Content::l() . '/ajax/disconnect/?network=LinkedIn" class="disconnect">' . str_replace('SOCIAL_NETWORK_NAME', 'LinkedIn', Content::c()->settings->disconnect) . '</a>';
     } else {
         $output .= '<a href="' . $linkedInLoginUrl . '" id="loginLinkedIn" class="ir">LinkedIn</a>' . '<a href="' . $linkedInLoginUrl . '" class="connect">' . str_replace('SOCIAL_NETWORK_NAME', 'LinkedIn', Content::c()->settings->connect) . '</a>';
     }
     // Twitter
     $output .= '</div><div class="clearfix">';
     if ($this->userDetails['twitter_access_token']) {
         $output .= '<a href="' . $twitterLoginUrl . '" id="loginTwitter" class="ir loggedIn">Twitter</a>' . '<a href="/' . Content::l() . '/ajax/disconnect/?network=Twitter" class="disconnect">' . str_replace('SOCIAL_NETWORK_NAME', 'Twitter', Content::c()->settings->disconnect) . '</a>';
     } else {
         $output .= '<a href="' . $twitterLoginUrl . '" id="loginTwitter" class="ir">Twitter</a>' . '<a href="' . $twitterLoginUrl . '" class="connect">' . str_replace('SOCIAL_NETWORK_NAME', 'Twitter', Content::c()->settings->connect) . '</a>';
     }
     $output .= '</div></div>';
     return $output;
 }
Ejemplo n.º 10
0
 /**
  * Return filters for a saved search.
  *
  * @param int $id Search hash
  *
  * @return mixed array of filters or false if the given search has no filters.
  */
 protected function getSearchSettings($id)
 {
     $search = $this->table->get('Search')->select(['finna_search_id' => $id])->current();
     if (empty($search)) {
         return false;
     }
     $sessId = $this->session->getId();
     if ($search->session_id == $sessId) {
         $minSO = $search->getSearchObject();
         $savedSearch = $minSO->deminify($this->results);
         $params = $savedSearch->getUrlQuery()->getParamArray();
         $settings = [];
         if (isset($params['filter'])) {
             $settings['filters'] = $params['filter'];
             $params = $savedSearch->getParams();
             if ($daterange = $params->getSpatialDateRangeFilter()) {
                 $daterangeField = $params->getSpatialDateRangeField();
                 foreach ($settings['filters'] as $filter) {
                     list($field, $val) = explode(':', $filter, 2);
                     if ($field == $daterangeField) {
                         $type = $daterange['type'];
                         $settings['params'] = ["{$daterangeField}_type" => $type];
                         break;
                     }
                 }
             }
         }
         $params = $savedSearch->getParams();
         if ($set = $params->getMetaLibSearchSet()) {
             $settings['params'] = ['set' => $set];
         }
         return $settings;
     }
     return false;
 }
Ejemplo n.º 11
0
 public static function getInstance()
 {
     if (is_null(self::$_sessionManager)) {
         self::$_sessionManager = new SessionManager();
     }
     return self::$_sessionManager;
 }
Ejemplo n.º 12
0
 function __construct()
 {
     if (SessionManager::isAuthorized()) {
         header('Location:/main');
         die;
     }
 }
Ejemplo n.º 13
0
 public static function getInstance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Ejemplo n.º 14
0
/**
 * Handle a new request.
 */
function handleRequest()
{
    if (!Config::getVar('general', 'installed') && pageRequiresInstall()) {
        // Redirect to installer if application has not been installed
        Request::redirect(null, 'install');
    }
    // Determine the handler for this request
    $page = Request::getRequestedPage();
    $op = Request::getRequestedOp();
    $sourceFile = sprintf('pages/%s/index.php', $page);
    // If a hook has been registered to handle this page, give it the
    // opportunity to load required resources and set HANDLER_CLASS.
    if (!HookRegistry::call('LoadHandler', array(&$page, &$op, &$sourceFile))) {
        if (file_exists($sourceFile)) {
            require $sourceFile;
        } else {
            require 'pages/index/index.php';
        }
    }
    if (!defined('SESSION_DISABLE_INIT')) {
        // Initialize session
        $sessionManager =& SessionManager::getManager();
        $session =& $sessionManager->getUserSession();
    }
    $methods = array_map('strtolower', get_class_methods(HANDLER_CLASS));
    if (in_array(strtolower($op), $methods)) {
        // Call a specific operation
        call_user_func(array(HANDLER_CLASS, $op), Request::getRequestedArgs());
    } else {
        // Call the selected handler's index operation
        call_user_func(array(HANDLER_CLASS, 'index'), Request::getRequestedArgs());
    }
}
Ejemplo n.º 15
0
 public function __construct()
 {
     session_start();
     header('Content-type: text/json');
     // Get the website user
     $userId = SessionManager::getInstance()->getUserId();
     // Make sure a user is logged in
     if (empty($userId)) {
         Debug::l('No user logged in');
         $json['result'] = 'false';
         echo json_encode($json);
         exit;
     }
     // Validate input
     if (empty($_POST['email']) || !filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL)) {
         Debug::l('Invalid email');
         $json['result'] = 'false';
         echo json_encode($json);
         exit;
     }
     // Update email address
     $db = Database::getInstance();
     $sth = $db->prepare('UPDATE person SET email = :email WHERE id = :id');
     $sth->execute(array(':email' => $_POST['email'], ':id' => $userId));
     $json['result'] = 'true';
     echo json_encode($json);
 }
Ejemplo n.º 16
0
 /**
  * Public function that creates a single instance
  */
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Ejemplo n.º 17
0
 public static function Init($params)
 {
     DebugManager::Log("Got a logout request!", '@');
     $account = AccountController::Create($params);
     SessionManager::Create($account);
     return new ResponseObject();
 }
Ejemplo n.º 18
0
 /**
  * Initialize Page Manager
  *
  * ## Overview
  *
  * @uses SatanBarbaraApp
  * @uses SessionManager
  * @uses ViewManager
  * @uses DebugManager
  * @uses RouteManager
  * @uses PageView
  *
  * @see RouteManager
  *
  * @param array An array of creds for SendGrid API.
  * @return true Always unless fatal error or exception is thrown.
  *
  * @version 2015-07-05.1
  * @since 0.5.1b
  * @author TronNet DevOps [Sean Murray] <*****@*****.**>
  */
 public static function Init($params)
 {
     DebugManager::Log("Initializing Page Manager", '@');
     DebugManager::Log($params);
     $appConfig = SatanBarbaraApp::GetConfig();
     /**
      * @todo have config in it's own 'config' position instead of array_merge
      */
     $data = array('app' => array_merge($appConfig[SATANBARBARA_CURRENT_ENVIRONMENT], array()), 'page' => $params);
     DebugManager::Log("checking if logged in...", null, 3);
     if (SessionManager::IsLoggedIn()) {
         $data['session'] = array('is_auth' => true, 'account' => SessionManager::GetAccount());
         DebugManager::Log("Got an account, checking for a saved program...", null, 3);
     }
     $Page = ucfirst($params['page']) . 'View';
     DebugManager::Log("Searching for view with class name: " . $Page);
     if ($Page::HasAccess(SessionManager::GetAccessLevel())) {
         $Page::Init($data);
         ViewManager::Render($Page);
     } else {
         DebugManager::Log("looks like this page requires auth but user isn't authenticated!");
         RouteManager::GoToPageURI('login');
     }
     return true;
 }
 /**
  * Loads the current locale. It works so that it tries to fetch the parameter "lang" from the
  * request. If it's not available, then it will try to look for it in the session. If it is not
  * there either, it will try to guess the most prefered language according to what the User Agent 
  * included in the HTTP_ACCEPT_LANGUAGE string sent with the request. If none matches available 
  * languages we have to use the value of "default_locale" and display the default language.
  *
  * @private
  * @return Returns a reference to a Locale object
  */
 function &_loadLocale()
 {
     $requestLocale =& $this->_request->getValue("lang");
     $localeCode = "";
     $serverVars =& HttpVars::getServer();
     // check if there's something in the request...
     // if not, check the session or at least try to
     // guess the apropriate languege from the http_accept_lnaguage string
     if ($requestLocale) {
         // check if it's a valid one
         if (Locales::isValidLocale($requestLocale)) {
             $localeCode = $requestLocale;
         }
     } else {
         $sessionLocale =& SessionManager::getSessionValue("summaryLang");
         if ($sessionLocale) {
             $localeCode = $sessionLocale;
         } elseif ($this->_config->getValue("use_http_accept_language_detection", HTTP_ACCEPT_LANGUAGE_DETECTION) == 1) {
             $localeCode =& $this->_matchHttpAcceptLanguages($serverVars['HTTP_ACCEPT_LANGUAGE']);
         }
     }
     // check if the locale code is correct
     // and as a valid resort, use the default one if the locale ist not valid or 'false'
     if ($localeCode === false || !Locales::isValidLocale($localeCode)) {
         $localeCode = $this->_config->getValue("default_locale");
     }
     // now put whatever locale value back to the session
     SessionManager::setSessionValue("summaryLang", $localeCode);
     // load the correct locale
     $locale =& Locales::getLocale($localeCode);
     return $locale;
 }
Ejemplo n.º 20
0
 /**
  * singleton function to return
  * the instance of the class
  *
  * @return SessionManager
  */
 public static function singleton($args = NULL)
 {
     if (!self::$instance) {
         self::$instance = new SessionManager($args);
     }
     return self::$instance;
 }
function search_sessions($needle, $type)
{
    global $_configuration, $tbl_session_rel_access_url, $tbl_session, $user_id;
    $xajax_response = new XajaxResponse();
    $return = '';
    if (!empty($needle) && !empty($type)) {
        // xajax send utf8 datas... datas in db can be non-utf8 datas
        $charset = api_get_system_encoding();
        $needle = api_convert_encoding($needle, $charset, 'utf-8');
        $assigned_sessions_to_hrm = SessionManager::get_sessions_followed_by_drh($user_id);
        $assigned_sessions_id = array_keys($assigned_sessions_to_hrm);
        $without_assigned_sessions = '';
        if (count($assigned_sessions_id) > 0) {
            $without_assigned_sessions = " AND s.id NOT IN(" . implode(',', $assigned_sessions_id) . ")";
        }
        if ($_configuration['multiple_access_urls']) {
            $sql = " SELECT s.id, s.name FROM {$tbl_session} s LEFT JOIN {$tbl_session_rel_access_url} a ON (s.id = a.session_id)\n\t\t\t\t\t\tWHERE  s.name LIKE '{$needle}%' {$without_assigned_sessions} AND access_url_id = " . api_get_current_access_url_id() . "";
        } else {
            $sql = "SELECT s.id, s.name FROM {$tbl_session} s\n\t\t\t\tWHERE  s.name LIKE '{$needle}%' {$without_assigned_sessions} ";
        }
        $rs = Database::query($sql);
        $return .= '<select id="origin" name="NoAssignedSessionsList[]" multiple="multiple" size="20" style="width:340px;">';
        while ($session = Database::fetch_array($rs)) {
            $return .= '<option value="' . $session['id'] . '" title="' . htmlspecialchars($session['name'], ENT_QUOTES) . '">' . $session['name'] . '</option>';
        }
        $return .= '</select>';
        $xajax_response->addAssign('ajax_list_sessions_multiple', 'innerHTML', api_utf8_encode($return));
    }
    return $xajax_response;
}
Ejemplo n.º 22
0
function vtws_extendSession()
{
    global $adb, $API_VERSION, $application_unique_key;
    if (isset($_SESSION["authenticated_user_id"]) && $_SESSION["app_unique_key"] == $application_unique_key) {
        $userId = $_SESSION["authenticated_user_id"];
        $sessionManager = new SessionManager();
        $sessionManager->set("authenticatedUserId", $userId);
        $crmObject = VtigerWebserviceObject::fromName($adb, "Users");
        $userId = vtws_getId($crmObject->getEntityId(), $userId);
        $vtigerVersion = vtws_getVtigerVersion();
        $resp = array("sessionName" => $sessionManager->getSessionId(), "userId" => $userId, "version" => $API_VERSION, "vtigerVersion" => $vtigerVersion);
        return $resp;
    } else {
        throw new WebServiceException(WebServiceErrorCode::$AUTHFAILURE, "Authencation Failed");
    }
}
Ejemplo n.º 23
0
 /**
  * @return SessionManager_obj
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new SessionManager_obj();
     }
     return self::$instance;
 }
Ejemplo n.º 24
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  * @return mixed
  */
 public function handle($request, \Closure $next)
 {
     // Check if the user is logged in
     if (!$this->auth->check()) {
         // Store the current uri in the session
         $this->session->put('url.intended', $this->request->url());
         // Redirect to the login page
         return $this->redirect->route('login');
     }
     // Check if the user has access to the dashboard page
     if (!$this->auth->hasAccess('dashboard.index')) {
         // Show the insufficient permissions page
         return $this->application->abort(403);
     }
     return $next($request);
 }
function search_sessions($needle, $type)
{
    global $tbl_session_rel_access_url, $tbl_session, $user_id;
    $xajax_response = new xajaxResponse();
    $return = '';
    if (!empty($needle) && !empty($type)) {
        $needle = Database::escape_string($needle);
        $assigned_sessions_to_hrm = SessionManager::get_sessions_followed_by_drh($user_id);
        $assigned_sessions_id = array_keys($assigned_sessions_to_hrm);
        $without_assigned_sessions = '';
        if (count($assigned_sessions_id) > 0) {
            $without_assigned_sessions = " AND s.id NOT IN(" . implode(',', $assigned_sessions_id) . ")";
        }
        if (api_is_multiple_url_enabled()) {
            $sql = " SELECT s.id, s.name FROM {$tbl_session} s\n                        LEFT JOIN {$tbl_session_rel_access_url} a ON (s.id = a.session_id)\n                        WHERE  s.name LIKE '{$needle}%' {$without_assigned_sessions} AND access_url_id = " . api_get_current_access_url_id() . "";
        } else {
            $sql = "SELECT s.id, s.name FROM {$tbl_session} s\n                    WHERE  s.name LIKE '{$needle}%' {$without_assigned_sessions} ";
        }
        $rs = Database::query($sql);
        $return .= '<select class="form-control" id="origin" name="NoAssignedSessionsList[]" multiple="multiple" size="20">';
        while ($session = Database::fetch_array($rs)) {
            $return .= '<option value="' . $session['id'] . '" title="' . htmlspecialchars($session['name'], ENT_QUOTES) . '">' . $session['name'] . '</option>';
        }
        $return .= '</select>';
        $xajax_response->addAssign('ajax_list_sessions_multiple', 'innerHTML', api_utf8_encode($return));
    }
    return $xajax_response;
}
Ejemplo n.º 26
0
 /** 
  * Jeweilige Action ausführen
  */
 protected function processActions()
 {
     switch ($this->action) {
         // Loginversuch
         case 'login':
             if (isset($_POST['username']) && isset($_POST['password'])) {
                 SessionManager::login($_POST['username'], $_POST['password']);
             } else {
                 header('backend.php?show=login&action=login_failed');
             }
             break;
             // Login fehlgeschlagen
         // Login fehlgeschlagen
         case 'login_failed':
             $this->pageTitle = 'Login fehlgeschlagen';
             $this->failedLogin = true;
             break;
             // Default Action
         // Default Action
         default:
             // Setzte Page title
             $this->pageTitle = 'Login';
             break;
     }
 }
 /**
  * Gathers the state of a given cell given a $row/$column combination
  * @param $row GridRow
  * @param $column GridColumn
  * @return string
  */
 function getCellState(&$row, &$column)
 {
     $element =& $row->getData();
     $columnId = $column->getId();
     assert(is_a($element, 'DataObject') && !empty($columnId));
     switch ($columnId) {
         case 'name':
             return $element->getDateCompleted() ? 'linkReview' : '';
         case is_numeric($columnId):
             // numeric implies a role column.
             if ($element->getDateCompleted()) {
                 $viewsDao =& DAORegistry::getDAO('ViewsDAO');
                 $sessionManager =& SessionManager::getManager();
                 $session =& $sessionManager->getUserSession();
                 $user =& $session->getUser();
                 $lastViewed = $viewsDao->getLastViewDate(ASSOC_TYPE_REVIEW_RESPONSE, $element->getId(), $user->getId());
                 if ($lastViewed) {
                     return 'completed';
                 } else {
                     return 'new';
                 }
             } else {
                 return '';
             }
         case 'reviewer':
             if ($element->getDateCompleted()) {
                 return 'completed';
             } elseif ($element->getDateDue() < Core::getCurrentDate()) {
                 return 'overdue';
             } elseif ($element->getDateConfirmed()) {
                 return $element->getDeclined() ? 'declined' : 'accepted';
             }
             return 'new';
     }
 }
Ejemplo n.º 28
0
 /**
  * Add a new event log entry with the specified parameters
  * @param $request object
  * @param $submission object
  * @param $eventType int
  * @param $messageKey string
  * @param $params array optional
  * @return object SubmissionLogEntry iff the event was logged
  */
 static function logEvent($request, $submission, $eventType, $messageKey, $params = array())
 {
     // Create a new entry object
     $submissionEventLogDao = DAORegistry::getDAO('SubmissionEventLogDAO');
     $entry = $submissionEventLogDao->newDataObject();
     // Set implicit parts of the log entry
     $entry->setDateLogged(Core::getCurrentDate());
     $entry->setIPAddress($request->getRemoteAddr());
     if (Validation::isLoggedInAs()) {
         // If user is logged in as another user log with real userid
         $sessionManager = SessionManager::getManager();
         $session = $sessionManager->getUserSession();
         $userId = $session->getSessionVar('signedInAs');
         if ($userId) {
             $entry->setUserId($userId);
         }
     } else {
         $user = $request->getUser();
         if ($user) {
             $entry->setUserId($user->getId());
         }
     }
     $entry->setSubmissionId($submission->getId());
     // Set explicit parts of the log entry
     $entry->setEventType($eventType);
     $entry->setMessage($messageKey);
     $entry->setParams($params);
     $entry->setIsTranslated(0);
     // Legacy for old entries. All messages now use locale keys.
     // Insert the resulting object
     $submissionEventLogDao->insertObject($entry);
     return $entry;
 }
Ejemplo n.º 29
0
 /**
  * Constructor
  */
 public function __construct($user_id)
 {
     $this->user_id = $user_id;
     $this->path = 'block_session';
     if ($this->is_block_visible_for_user($user_id)) {
         $this->sessions = SessionManager::get_sessions_followed_by_drh($user_id);
     }
 }
Ejemplo n.º 30
0
 static function GetAccountId()
 {
     $accountId = SessionManager::GetAccountId();
     if ($accountId == -1) {
         $accountId = Config::Get(Application::CONFIG_ACCOUNTID);
     }
     return $accountId;
 }