Esempio n. 1
0
session_cache_limiter('none');
session_start();
//print_r($_SESSION);
$path = "../libraries/";
/** The configuration file.*/
require_once $path . "configuration.php";
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Date in the past
try {
    $currentUser = EfrontUser::checkUserAccess();
    $smarty->assign("T_CURRENT_USER", $currentUser);
} catch (Exception $e) {
    eF_redirect("index.php?ctg=expired");
    exit;
}
if (G_VERSIONTYPE != 'community') {
    #cpp#ifndef COMMUNITY
    if (isset($_GET['fb_authenticated']) && $_GET['fb_authenticated'] == 1) {
        if ($GLOBALS['configuration']['facebook_api_key'] && $GLOBALS['configuration']['facebook_secret']) {
            if (EfrontFacebook::userConnected()) {
                new EfrontFacebook();
            }
        }
    }
    if (isset($_SESSION['facebook_user'])) {
        EfrontFacebook::setEfUser($_SESSION['facebook_user'], $_SESSION['s_login'], $_SESSION['facebook_details']['name']);
    }
}
Esempio n. 2
0
    try {
        //$currentUser = EfrontUserFactory :: factory($_SESSION['s_login']);
        $currentUser = EfrontUser::checkUserAccess();
        refreshLogin();
        //$_SESSION['last_action_timestamp'] = time();		//Keep the last time something happened to the session
        if ($accounts = unserialize($currentUser->user['additional_accounts'])) {
            $result = eF_getTableData("users", "login, user_type", 'login in ("' . implode('","', array_values($accounts)) . '")');
            $smarty->assign("T_MAPPED_ACCOUNTS", $result);
        }
    } catch (Exception $e) {
    }
}
if (isset($_GET['ctg']) && is_numeric($_GET['ctg'])) {
    //cheking a possible issue with search engine robots that overloads server
    if (empty($customBlocks) || in_array($_GET['ctg'], array_keys($customBlocks)) !== true) {
        eF_redirect("HTTP/1.0 404 Not Found");
    }
}
if (isset($_SESSION['s_login']) && $_SESSION['s_login']) {
    //This way, logged in users that stay on index.php are not logged out
    $loadScripts[] = 'sidebar';
}
$smarty->assign("T_MESSAGE", $message);
$smarty->assign("T_MESSAGE_TYPE", $message_type);
if (isset($search_message)) {
    $smarty->assign("T_SEARCH_MESSAGE", $search_message);
}
if (!$smarty->is_cached('index.tpl', $cacheId) || !$GLOBALS['configuration']['smarty_caching']) {
    foreach (eF_loadAllModules(true, true) as $module) {
        $module->onIndexPageLoad();
    }
 public static function checkWebserverAuthentication()
 {
     try {
         eval('$usernameVar=' . $GLOBALS['configuration']['username_variable'] . ';');
         if (!$usernameVar) {
             eF_redirect(G_SERVERNAME . $GLOBALS['configuration']['error_page'], true, 'top', true);
             exit;
         } else {
             try {
                 $user = EfrontUserFactory::factory($usernameVar);
                 if (!$_SESSION['s_login'] || $usernameVar != $_SESSION['s_login']) {
                     $user->login($user->user['password'], true);
                 }
             } catch (EfrontUserException $e) {
                 if ($e->getCode() == EfrontUserException::USER_NOT_EXISTS && $GLOBALS['configuration']['webserver_registration']) {
                     try {
                         include $GLOBALS['configuration']['registration_file'];
                         $user = EfrontUserFactory::factory($usernameVar);
                         if (!$_SESSION['s_login'] || $usernameVar != $_SESSION['s_login']) {
                             $user->login($user->user['password'], true);
                         }
                     } catch (Exception $e) {
                         eF_redirect(G_SERVERNAME . $GLOBALS['configuration']['unauthorized_page'], true, 'top', true);
                         exit;
                     }
                 } else {
                     eF_redirect(G_SERVERNAME . $GLOBALS['configuration']['unauthorized_page'], true, 'top', true);
                     exit;
                 }
             }
         }
     } catch (Exception $e) {
         eF_redirect(G_SERVERNAME . $GLOBALS['configuration']['unauthorized_page'], true, 'top', true);
         //header("location:".G_SERVERNAME.$GLOBALS['configuration']['unauthorized_page']);
     }
     return $user;
 }
Esempio n. 4
0
 if (isset($_GET['add_topic']) || isset($_GET['del_topic']) || isset($_GET['edit_topic'])) {
     /* Check permissions: only professors are allowed to manage topics */
     if ($currentUser->getType() != 'professor') {
         eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=personal&message=" . urlencode(_SORRYYOUDONOTHAVEPERMISSIONTOPERFORMTHISACTION) . "&message_type=failure");
         exit;
     }
     // ON DELETING A LESSONTIMELINE TOPIC
     if (isset($_GET['del_topic']) && eF_checkParameter($_GET['del_topic'], 'id')) {
         //The administrator asked to delete a skill
         //@todo: delete events too?
         //eF_deleteTableData("lessons_timeline_topics", "type = " . . "  AND lessons_ID = ". ." AND entity_ID = '".$_GET['del_topic']."'");
         eF_deleteTableData("lessons_timeline_topics_data", "topics_ID = '" . $_GET['del_topic'] . "'");
         eF_deleteTableData("lessons_timeline_topics", "id = '" . $_GET['del_topic'] . "'");
         $message = _LESSONTIMELINETOPICDELETED;
         $message_type = 'success';
         eF_redirect("" . $_SESSION['s_type'] . ".php?ctg=social&op=timeline&lessons_ID=" . $_GET['lessons_ID'] . "&all=1&message=" . $message . "&message_type=" . $message_type);
         exit;
         //ON INSERTING OR EDITING A LESSONTIMELINE TOPIC
     } else {
         if (isset($_GET['add_topic']) || isset($_GET['edit_topic'])) {
             if (isset($_GET['add_topic'])) {
                 $form = new HTML_QuickForm("topic_form", "post", $_SESSION['s_type'] . ".php?ctg=social&op=timeline&lessons_ID=" . $_SESSION['s_lessons_ID'] . "&add_topic=1", "", null, true);
             } elseif (eF_checkParameter($_GET['edit_topic'], 'id')) {
                 $form = new HTML_QuickForm("topic_form", "post", $_SESSION['s_type'] . ".php?ctg=social&op=timeline&lessons_ID=" . $_SESSION['s_lessons_ID'] . "&edit_topic=" . $_GET['edit_topic'], "", null, true);
                 $topic = eF_getTableData("lessons_timeline_topics", "title", "id ='" . $_GET['edit_topic'] . "'");
             }
             $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
             //Register this rule for checking user input with our function, eF_checkParameter
             $form->addElement('text', 'topic_description', _LESSONTIMELINETOPIC, 'id="topic_description" class = "inputText" tabindex="1"');
             $form->addRule('topic_description', _THEFIELD . ' ' . _LESSONTIMELINETOPIC . ' ' . _ISMANDATORY, 'required', null, 'client');
             // Hidden for maintaining the previous_url value
Esempio n. 5
0
session_id($_COOKIE['parent_sid']);
session_start();
$path = "../../libraries/";
/** Configuration file.*/
include_once $path . "configuration.php";
//Access is not allowed to users that are not logged in
if (isset($_SESSION['s_login']) && $_SESSION['s_password']) {
    try {
        $currentUser = EfrontUserFactory::factory($_SESSION['s_login']);
    } catch (EfrontException $e) {
        $message = $e->getMessage() . ' (' . $e->getCode() . ')';
        eF_redirect("index.php?message=" . urlencode($message) . "&message_type=failure");
        exit;
    }
} else {
    eF_redirect("index.php?message=" . urlencode(_YOUCANNOTACCESSTHISPAGE) . "&message_type=failure");
    exit;
}
try {
    //There are 2 legal modes: 'lessons' and 'external'. In the first case, we read the legitimate directory from the session. In the second case, we take it from global constant
    if ($_GET['mode'] == 'lesson') {
        $currentLesson = new EfrontLesson($_SESSION['s_lessons_ID']);
        $rootDir = new EfrontDirectory($currentLesson->getDirectory());
        $filesBaseUrl = $currentLesson->getDirectoryUrl();
    } elseif ($_GET['mode'] == 'external') {
        $rootDir = new EfrontDirectory(G_EXTERNALPATH);
        $filesBaseUrl = G_EXTERNALURL;
    } elseif ($_GET['mode'] == 'upload') {
        $rootDir = new EfrontDirectory(G_UPLOADPATH . $_SESSION['s_login']);
        $filesBaseUrl = G_UPLOADPATH . $_SESSION['s_login'];
    } else {
                         if ($trackActivityInfo['success_status'] == 'failed') {
                             $iterator->current()->offsetset('failed', true);
                         }
                     }
                 }
                 if ($_student_) {
                     if ($iterator->current()->offsetGet('completed')) {
                         $currentUser->setSeenUnit($iterator->current(), $currentLesson, true);
                     } else {
                         $currentUser->setSeenUnit($iterator->current(), $currentLesson, false);
                     }
                 }
             }
             $scormState = $scoContent->checkControlsValidy();
             if ($navigation->end_sequencing_session == 'true') {
                 eF_redirect("" . basename($_SERVER['PHP_SELF']) . '?ctg=content&');
             }
             if (in_array($currentUnit['scorm_version'], EfrontContentTreeSCORM::$scorm2004Versions)) {
                 $scormVersion = '1.3';
             } else {
                 $scormVersion = '1.2';
             }
         } catch (Exception $e) {
             //pr($e);
             unset($_GET['view_unit']);
             $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
             $message = $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
             $message_type = 'failure';
         }
     }
 }
Esempio n. 7
0
* @package eFront
* @version 3.6.0
*/
//This file cannot be called directly, only included.
if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) {
    exit;
}
$redirectPage = $GLOBALS['configuration']['login_redirect_page'];
//$centerLinkInfo = $module -> getCenterLinkInfo();
if (array_key_exists($GLOBALS['configuration']['login_redirect_page'], $loadedModules)) {
    //in case module is inactive
    $InnertableHTML = $loadedModules[$redirectPage]->getLandingPageModule();
    $InnertableHTML === true ? $module_smarty_file = $loadedModules[$redirectPage]->getLandingPageSmartyTpl() : ($module_smarty_file = false);
    // If the module has a lesson innertable
    if ($InnertableHTML) {
        // Get module html - two ways: pure HTML or PHP+smarty
        // If no smarty file is defined then false will be returned
        if ($module_smarty_file) {
            // Execute the php code -> The code has already been executed by above (**HERE**)
            // Let smarty know to include the module smarty file
            $innertable_module[$redirectPage] = array('smarty_file' => $module_smarty_file);
        } else {
            // Present the pure HTML cod
            $innertable_module[$redirectPage] = array('html_code' => $InnertableHTML);
        }
    }
    //pr($innertable_module);
    $smarty->assign("T_INNERTABLE_MODULE", $innertable_module);
} else {
    eF_redirect($_SESSION['s_type'] . ".php");
}
Esempio n. 8
0
 public function redirect($url)
 {
     if ($this->in_fb_canvas()) {
         echo '<fb:redirect url="' . $url . '"/>';
     } else {
         if (preg_match('/^https?:\\/\\/([^\\/]*\\.)?facebook\\.com(:\\d+)?/i', $url)) {
             // make sure facebook.com url's load in the full frame so that we don't
             // get a frame within a frame.
             echo "<script type=\"text/javascript\">\ntop.location.href = \"{$url}\";\n</script>";
         } else {
             eF_redirect(' ' . $url);
         }
     }
     exit;
 }
                    //if supervisors can't see unassigned users, then attach this new user to the supervisor's firts branch and job
                    $branch = new EfrontBranch(current($currentEmployee->getSupervisedBranchesRecursive()));
                    $nospecific = false;
                    foreach ($branch->getJobDescriptions() as $value) {
                        if ($value['description'] == _NOSPECIFICJOB) {
                            $nospecific = $value['job_description_ID'];
                        }
                    }
                    if (!$nospecific) {
                        $nospecific = EfrontJob::createJob(array('description' => _NOSPECIFICJOB, 'branch_ID' => $branch->branch['branch_ID']));
                    }
                    $editedEmployee->addJob($editedUser, $nospecific, $branch->branch['branch_ID'], 0);
                }
            }
        }
        #cpp#endif
        if (isset($_SESSION['missing_fields'])) {
            unset($_SESSION['missing_fields']);
            loginRedirect($editedUser->user['user_type'], urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY . $ldapMessage), 'success');
        } else {
            if ($editedUser->user['user_type'] == 'administrator' || !isset($_GET['add_user'])) {
                eF_redirect($_SERVER['PHP_SELF'] . "?ctg=personal&user="******"&op=profile&message=" . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY . $ldapMessage) . "&message_type=success");
            } else {
                eF_redirect($_SERVER['PHP_SELF'] . "?ctg=personal&user="******"&op=user_courses&message=" . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY . $ldapMessage) . "&message_type=success");
            }
        }
    } catch (Exception $e) {
        handleNormalFlowExceptions($e);
    }
}
$smarty->assign("T_PROFILE_FORM", $form->toArray());
 /**
  * The main functionality
  *
  * (non-PHPdoc)
  * @see libraries/EfrontModule#getModule()
  */
 public function getModule()
 {
     $smarty = $this->getSmartyVar();
     $smarty->assign("T_MODULE_BASEDIR", $this->moduleBaseDir);
     $smarty->assign("T_MODULE_BASELINK", $this->moduleBaseLink);
     $smarty->assign("T_MODULE_BASEURL", $this->moduleBaseUrl);
     $smarty->assign("T_TABLE_OPTIONS", array(array('image' => $this->moduleBaseLink . 'img/order.png', 'text' => _MODULE_SECURITY_RECHECKLOCALFILES, 'href' => $this->moduleBaseUrl . '&delete_local_list=1'), array('image' => $this->moduleBaseLink . 'img/refresh.png', 'text' => _MODULE_SECURITY_RECHECKSERVERFILES, 'href' => $this->moduleBaseUrl . '&delete_remote_list=1'), array('image' => $this->moduleBaseLink . 'img/rules.png', 'text' => _MODULE_SECURITY_RESETIGNORELIST, 'href' => $this->moduleBaseUrl . '&delete_ignore_list=1')));
     if (isset($_GET['download_ignore_list'])) {
         try {
             $file = new EfrontFile($this->getIgnoreListName());
             $file->sendFile(true);
         } catch (Exception $e) {
             $this->setMessageVar('The list is empty', 'failure');
         }
     } else {
         if ($_GET['delete_remote_list']) {
             $file = new EfrontFile($this->getCachedRemoteListName());
             $file->delete();
         } else {
             if ($_GET['delete_local_list']) {
                 $file = new EfrontFile($this->getLocalListName());
                 $file->delete();
             } else {
                 if ($_GET['delete_ignore_list']) {
                     try {
                         $file = new EfrontFile($this->getIgnoreListName());
                         $file->delete();
                     } catch (Exception $e) {
                     }
                 }
             }
         }
     }
     if (isset($_GET['download'])) {
         $_GET['download'] = base64_decode($_GET['download']);
     }
     $form = new HTML_QuickForm("demo_form", "post", $this->moduleBaseUrl . "&type=" . $_GET['type'], "", null, true);
     switch ($_GET['type']) {
         case 'install':
             $form->addElement('submit', 'submit_delete_install', _MODULE_SECURITY_DELETEINSTALLDIRECTORY, 'class = "flatButton"');
             break;
         case 'magic_quotes_gpc':
             break;
         case 'default_accounts':
             $form->addElement('submit', 'submit_deactivate', _MODULE_SECURITY_DEACTIVATEDEFAULTACCOUNTS, 'class = "flatButton"  title = "Click this to deactivate these accounts"');
             break;
         case 'changed_files':
             list($changed_files, $new_files) = $this->checksumCheck();
             $smarty->assign("T_CHANGED_FILES", $changed_files);
             if (isset($_GET['download']) && in_array($_GET['download'], array_keys($changed_files)) && $_GET['download'] != 'libraries/configuration.php') {
                 try {
                     $file = new EfrontFile(G_ROOTPATH . $_GET['download']);
                     $file->sendFile(true);
                     exit;
                 } catch (Exception $e) {
                     $this->setMessageVar(_MODULE_SECURITY_FILECOULDNOTBEDELETED, 'failure');
                 }
             } else {
                 if (isset($_GET['ignore']) && in_array($_GET['ignore'], array_keys($changed_files))) {
                     $this->addToIgnoreList($_GET['ignore']);
                     echo json_encode(array('success' => true));
                     exit;
                 }
             }
             $form->addElement('submit', 'submit_recheck', _MODULE_SECURITY_RECHECKFILES, 'class = "flatButton" ');
             $form->addElement('submit', 'reset_ignore_list', _MODULE_SECURITY_RESETIGNORELIST, 'class = "flatButton" ');
             $form->addElement('submit', 'ignore_changed_all', _MODULE_SECURITY_IGNOREALL, 'class = "flatButton" ');
             break;
         case 'new_files':
             list($changed_files, $new_files) = $this->checksumCheck();
             if (isset($_GET['download']) && in_array($_GET['download'], array_keys($new_files)) && $_GET['download'] != 'libraries/configuration.php') {
                 try {
                     $file = new EfrontFile(G_ROOTPATH . $_GET['download']);
                     $file->sendFile(true);
                     exit;
                 } catch (Exception $e) {
                     $this->setMessageVar(_MODULE_SECURITY_FILECOULDNOTBEDELETED, 'failure');
                 }
             } else {
                 if (isset($_GET['ignore']) && in_array($_GET['ignore'], array_keys($new_files))) {
                     $this->addToIgnoreList($_GET['ignore']);
                 } else {
                     if (isset($_GET['delete']) && in_array($_GET['delete'], array_keys($new_files))) {
                         try {
                             $file = new EfrontFile(G_ROOTPATH . $_GET['delete']);
                             $file->delete();
                         } catch (Exception $e) {
                         }
                         $file = new EfrontFile($this->getLocalListName());
                         $file->delete();
                         list($changed_files, $new_files) = $this->checksumCheck();
                     }
                 }
             }
             $smarty->assign("T_NEW_FILES", $new_files);
             $form->addElement('submit', 'submit_recheck', _MODULE_SECURITY_RECHECKFILES, 'class = "flatButton" ');
             $form->addElement('submit', 'reset_ignore_list', _MODULE_SECURITY_RESETIGNORELIST, 'class = "flatButton" ');
             $form->addElement('submit', 'ignore_new_all', _MODULE_SECURITY_IGNOREALL, 'class = "flatButton" ');
             break;
         default:
             $smarty->assign("T_SECURITY_FEEDS", $this->getRssFeeds());
             try {
                 $smarty->assign("T_LOCAL_ISSUES", $this->checkLocalIssues());
             } catch (Exception $e) {
                 $this->setMessageVar($e->getMessage(), 'failure');
             }
             break;
     }
     if ($form->isSubmitted() && $form->validate()) {
         try {
             $values = $form->exportValues();
             if ($values['submit_recheck']) {
                 $file = new EfrontFile($this->getLocalListName());
                 $file->delete();
                 eF_redirect($this->moduleBaseUrl . '&type=' . $_GET['type'] . '&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success');
             } else {
                 if ($values['submit_delete_install']) {
                     file_get_contents(G_SERVERNAME . 'index.php?delete_install=1');
                     eF_redirect($this->moduleBaseUrl . '&type=' . $_GET['type'] . '&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success');
                 } else {
                     if ($values['submit_deactivate']) {
                         $result = eF_updateTableData("users", array('active' => 0), "(login = '******' and password = '******') or (login = '******' and password = '******')");
                         eF_redirect($this->moduleBaseUrl . '&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success');
                     } else {
                         if ($values['reset_ignore_list']) {
                             try {
                                 $file = new EfrontFile($this->getIgnoreListName());
                                 $file->delete();
                                 eF_redirect($this->moduleBaseUrl . '&type=' . $_GET['type'] . '&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success');
                             } catch (Exception $e) {
                                 $this->setMessageVar(_MODULE_SECURITY_THELISTISEMTPY, 'failure');
                             }
                         } else {
                             if ($values['ignore_new_all']) {
                                 list($changed_files, $new_files) = $this->checksumCheck();
                                 foreach ($new_files as $key => $value) {
                                     $this->addToIgnoreList($key);
                                 }
                                 eF_redirect($this->moduleBaseUrl . '&type=new_files&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success');
                             } else {
                                 if ($values['ignore_changed_all']) {
                                     list($changed_files, $new_files) = $this->checksumCheck();
                                     foreach ($changed_files as $key => $value) {
                                         $this->addToIgnoreList($key);
                                     }
                                     eF_redirect($this->moduleBaseUrl . '&type=changed_files&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success');
                                 }
                             }
                         }
                     }
                 }
             }
         } catch (Exception $e) {
             $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
             $message = $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
             $this->setMessageVar($message, 'failure');
         }
     }
     $renderer = prepareFormRenderer($form);
     $smarty->assign('T_SECURITY_FORM', $renderer->toArray());
     //$feeds = $this->getRssFeeds(true, false);
     //$smarty->assign("T_SECURITY_FEEDS", $feeds);
     return true;
 }
Esempio n. 11
0
     $loadScripts[] = 'includes/personal';
     $editedUser = EfrontUserFactory::factory($_GET['sel_user']);
     $editedEmployee = $editedUser->aspects['hcd'];
     include 'personal/user_form.php';
     //exit;
 }
 if ($currentUser->user['user_type'] != 'administrator' && $isSupervisor) {
     if ($currentUser->aspects['hcd']->supervisesEmployee($_GET['sel_user'])) {
         $validUsers[] = $_GET['sel_user'];
         $supervisesUser = 1;
     }
 }
 if (eF_local_canAccessUser()) {
     $infoUser = EfrontUserFactory::factory($_GET['sel_user']);
 } else {
     eF_redirect(basename($_SERVER['PHP_SELF']) . '?ctg=statistics&option=user&message=' . urlencode(_USERISNOTVALIDORYOUCANNOTSEEUSER . ": " . $_GET['sel_user']));
     exit;
 }
 if ($isSupervisor || $currentUser->user['user_type'] == 'administrator') {
     $smarty->assign("T_EDIT_USER_LINK", array(array('text' => _EDITUSER, 'image' => "16x16/edit.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=personal&user="******"T_USER_LOGIN", $infoUser->user['login']);
 $smarty->assign("T_REPORTS_USER", $infoUser);
 if ($_GET['specific_lesson_info'] && $_GET['lesson']) {
     $lessons = $infoUser->getUserStatusInLessons($_GET['lesson']);
     $smarty->assign("T_USER_STATUS_IN_LESSON", $lessons[$_GET['lesson']]);
     $status = EfrontStats::getUsersLessonStatus($_GET['lesson'], $infoUser->user['login']);
     $doneTests = EfrontStats::getStudentsDoneTests($_GET['lesson'], $infoUser->user['login']);
     $feedbacks = eF_getTableDataFlat("tests t, content c", "t.id, t.content_ID", "c.id=t.content_ID and c.ctg_type='feedback'");
Esempio n. 12
0
 public function getModule()
 {
     $currentLesson = $this->getCurrentLesson();
     $smarty = $this->getSmartyVar();
     $smarty->assign("T_LESSON_ID", $currentLesson->lesson['id']);
     if (isset($_GET['delete_link']) && eF_checkParameter($_GET['delete_link'], 'id')) {
         eF_deleteTableData("module_links", "id=" . $_GET['delete_link']);
         $this->setMessageVar(_LINKS_SUCCESFULLYDELETEDLINK, 'success');
         eF_redirect("" . $this->moduleBaseUrl . "&message=" . urlencode($message) . "&message_type={$message_type}");
     } else {
         if (isset($_GET['add_link']) || isset($_GET['edit_link']) && eF_checkParameter($_GET['edit_link'], 'id')) {
             $form = new HTML_QuickForm("link_entry_form", "POST", $_SERVER['REQUEST_URI'], "");
             $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
             //Register this rule for checking user input with our function, eF_checkParameter
             $form->addElement('text', 'display', null);
             $form->addElement('text', 'link', null);
             $form->addElement('textarea', 'description', null);
             $form->addElement('submit', 'submit_link', _SUBMIT, 'class = "flatButton"');
             $element =& $form->getElement('display');
             $element->setSize(50);
             $element =& $form->getElement('link');
             $element->setSize(50);
             $element =& $form->getElement('description');
             $element->setCols(50);
             if (isset($_GET['edit_link'])) {
                 $link_entry = eF_getTableData("module_links", "*", "id=" . $_GET['edit_link']);
                 $form->setDefaults(array('display' => $link_entry[0]['display'], 'link' => $link_entry[0]['link'], 'description' => $link_entry[0]['description']));
             } else {
                 $form->setDefaults(array('link' => "http://"));
             }
             if ($form->isSubmitted() && $form->validate()) {
                 $fields = array('lessons_ID' => $_SESSION['s_lessons_ID'], 'display' => $form->exportValue('display'), 'link' => $form->exportValue('link'), 'description' => $form->exportValue('description'));
                 if (isset($_GET['edit_link'])) {
                     if (eF_updateTableData("module_links", $fields, "id=" . $_GET['edit_link'])) {
                         $message = _LINKS_SUCCESFULLYUPDATEDLINKENTRY;
                         $message_type = 'success';
                         eF_redirect("" . $_SERVER['PHP_SELF'] . "?ctg=module&op=module_links&message=" . urlencode($message) . "&message_type={$message_type}");
                     } else {
                         $message = _LINKS_PROBLEMUPDATINGLINKENTRY;
                         $message_type = 'failure';
                         eF_redirect("" . $_SERVER['PHP_SELF'] . "?ctg=module&op=module_links&message=" . urlencode($message) . "&message_type={$message_type}");
                     }
                 } else {
                     if (eF_insertTableData("module_links", $fields)) {
                         $message = _LINKS_SUCCESFULLYINSERTEDLINKENTRY;
                         $message_type = 'success';
                         eF_redirect("" . $_SERVER['PHP_SELF'] . "?ctg=module&op=module_links&message=" . urlencode($message) . "&message_type={$message_type}");
                     } else {
                         $message = _LINKS_PROBLEMINSERTINGLINKENTRY;
                         $message_type = 'failure';
                         eF_redirect("" . $_SERVER['PHP_SELF'] . "?ctg=module&op=module_links&message=" . urlencode($message) . "&message_type={$message_type}");
                     }
                 }
             }
             $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
             $form->accept($renderer);
             $smarty->assign('T_LINKS_FORM', $renderer->toArray());
         } else {
             $links = eF_getTableDataFlat("module_links", "*", "lessons_ID = " . $_SESSION['s_lessons_ID']);
             $smarty->assign("T_LINKS", $links);
         }
     }
     return true;
 }
Esempio n. 13
0
}
//Create shorthands for user type, to avoid long variable names
//Create shorthands for user access rights, to avoid long variable names
$_change_ = 0;
if (!isset($currentUser->coreAccess['content']) || $currentUser->coreAccess['content'] == 'change') {
    $_change_ = 1;
} elseif (isset($currentUser->coreAccess['content']) && $currentUser->coreAccess['content'] == 'hidden') {
    eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
}
if (!isset($GLOBALS['currentLesson'])) {
    if (isset($_GET['lesson_info'])) {
        $currentLesson = new EfrontLesson($_GET['lesson_info']);
        $currentContent = new EfrontContentTree($currentLesson);
        $smarty->assign("T_CURRENT_LESSON", $currentLesson);
    } else {
        eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . rawurlencode(_INVALIDID) . "&message_type=failure");
    }
}
if ($_GET['edit_info'] && $_change_ && !$_student_) {
    $form = new HTML_QuickForm("empty_form", "post", null, null, null, true);
    try {
        $lessonInformation = unserialize($currentLesson->lesson['info']);
        $information = new LearningObjectInformation($lessonInformation);
        if (!isset($currentUser->coreAccess['content']) || $currentUser->coreAccess['content'] == 'change') {
            $smarty->assign("T_LESSON_INFO_HTML", $information->toHTML($form, false));
        } else {
            $smarty->assign("T_LESSON_INFO_HTML", $information->toHTML($form, false, false));
        }
        $lessonMetadata = unserialize($currentLesson->lesson['metadata']);
        $metadata = new DublinCoreMetadata($lessonMetadata);
        if (!isset($currentUser->coreAccess['content']) || $currentUser->coreAccess['content'] == 'change') {
Esempio n. 14
0
     /***/
     require_once "ims.php";
 } elseif ($ctg == 'tincan') {
     $_SESSION['s_lessons_ID'] or eF_redirect(basename($_SERVER['PHP_SELF']));
     /***/
     require_once "tincan.php";
 } elseif ($ctg == 'lesson_information') {
     $_SESSION['s_lessons_ID'] or eF_redirect(basename($_SERVER['PHP_SELF']));
     /***/
     require_once "lesson_information.php";
 } elseif ($ctg == 'news') {
     //$_SESSION['s_lessons_ID'] OR eF_redirect(basename($_SERVER['PHP_SELF']));		//Commented out so that dashboard news links are working
     /***/
     include "news.php";
 } elseif ($ctg == 'progress') {
     $_SESSION['s_lessons_ID'] or eF_redirect(basename($_SERVER['PHP_SELF']));
     /***/
     require_once "progress.php";
 } elseif ($ctg == 'module_hcd') {
     include "module_hcd.php";
 } elseif ($ctg == "emails") {
     include "emails.php";
 } elseif ($ctg == 'users') {
     $_GET['op'] = "employees";
     include "module_hcd.php";
 } elseif ($ctg == 'evaluations') {
     /**This part is used to display the evaluations that have been written for the employee*/
     // Administrators and supervisors will see all evaluations for the employee while employee-professors will see only their own
     if (eF_checkParameter($_GET['user'], 'login')) {
         if ($_SESSION['s_type'] == "administrator" || $_SESSION['employee_type'] == _SUPERVISOR) {
             $evaluations = eF_getTableData("module_hcd_events", "*", "users_login = '******'user'] . "' AND event_code >=10", "timestamp");
Esempio n. 15
0
     $form->addElement('submit', 'submit_poll', _VOTE, 'class = "flatButton"');
     if ($form->isSubmitted() && $form->validate()) {
         $values = $form->exportValues();
         //pr($values);
         //debug();
         $res = eF_getTableData("f_users_to_polls", "*", "f_poll_ID=" . $values['options']['vote'] . " and users_LOGIN='******'login'] . "'");
         //debug(false);
         if (sizeof($res) > 0) {
             $message = _YOUHAVEALREADYVOTED;
             $message_type = 'failure';
         } else {
             $fields = array('f_poll_ID' => $_GET['poll'], 'users_LOGIN' => $_SESSION['s_login'], 'vote' => $values['options']['vote'], 'timestamp' => time());
             if (eF_insertTableData("f_users_to_polls", $fields)) {
                 $message = _SUCCESFULLYVOTED;
                 $message_type = 'success';
                 eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=forum&poll=" . $_GET['poll']);
             } else {
                 $message = _SOMEPROBLEMEMERGED;
                 $message_type = 'failure';
             }
         }
     }
     $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
     //Create a smarty renderer
     $form->accept($renderer);
     //Assign this form to the renderer, so that corresponding template code is created
     $smarty->assign('T_POLL_FORM', $renderer->toArray());
     //Assign the form to the template
     $smarty->assign("T_POLL", $poll_data[0]);
 } else {
     if ($_SESSION['s_type'] != 'administrator' && $_SESSION['s_current_branch']) {
Esempio n. 16
0
                    }
                    if (isset($_GET['auto_save'])) {
                        $testInstance->autoSave($values['question'], $_POST['goto_question']);
                        //$testInstance -> pause($values['question'], $_POST['goto_question']);
                        echo json_encode(array('success' => 1));
                        exit;
                    } else {
                        if (isset($values['pause_test'])) {
                            $testInstance->pause($values['question'], $_POST['goto_question']);
                            eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=content&type=tests");
                        } else {
                            //Set the unit as "seen"
                            $testInstance->complete($values['question']);
                            if ($testInstance->completedTest['status'] == 'failed') {
                                $currentUser->setSeenUnit($currentUnit, $currentLesson, 0);
                            } else {
                                $currentUser->setSeenUnit($currentUnit, $currentLesson, 1);
                            }
                            eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?view_unit=" . $_GET['view_unit']);
                        }
                    }
                } catch (Exception $e) {
                    handleNormalFlowExceptions($e);
                }
            }
        }
        $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
        $form->accept($renderer);
        $smarty->assign('T_TEST_FORM', $renderer->toArray());
    }
}
 private function doGlobalLessonSettings()
 {
     $smarty = $this->getSmartyVar();
     $currentUser = $this->getCurrentUser();
     $lessonSettings = $this->getLessonSettings();
     $smarty->assign("T_LESSON_SETTINGS", $lessonSettings);
     $smarty->assign("T_LESSON_SETTINGS_GROUPS", array(1 => _LESSONOPTIONS, 2 => _LESSONMODULES, 3 => _MODULES));
     try {
         if (isset($_GET['ajax']) && isset($_GET['activate']) && in_array($_GET['activate'], array_keys($lessonSettings))) {
             $this->toggleSetting($_GET['activate'], 1);
             exit;
         } elseif (isset($_GET['ajax']) && isset($_GET['deactivate']) && in_array($_GET['deactivate'], array_keys($lessonSettings))) {
             $this->toggleSetting($_GET['deactivate'], 0);
             exit;
         } elseif ($_GET['tab'] == "global_settings" && isset($_GET['lessons_ID']) && eF_checkParameter($_GET['lessons_ID'], 'id') && isset($_GET['copy_block_order'])) {
             $res = eF_getTableData("lessons", "id,options", "id=" . $_GET['lessons_ID']);
             $options = unserialize($res[0]["options"]);
             $order = unserialize($options['default_positions']);
             //pr($order);exit;
             $result = eF_getTableData("lessons", "id,options");
             foreach ($result as $key => $value) {
                 $temp = unserialize($value["options"]);
                 $temp['default_positions'] = $options['default_positions'];
                 eF_updateTableData("lessons", array('options' => serialize($temp)), "id=" . $value['id']);
             }
             //$this -> setMessageVar(urlencode(_MODULE_ADMINISTRATOR_TOOLS_BLOCKORDERCOPIED), 'success');
             eF_redirect($this->moduleBaseUrl . "&do=learning&tab=global_settings&message_type=success&message=" . urlencode(_MODULE_ADMINISTRATOR_TOOLS_BLOCKORDERCOPIED));
         }
     } catch (Exception $e) {
         handleAjaxExceptions($e);
     }
 }
Esempio n. 18
0
 * This file offers the user the ability to access many efront resources, in a unified way
 * Usage:
 * view_resource.php&type=<type>&id=<identifier>
 *
 * @package eFront
 * @version 3.5.0
 */
//General initialization and parameters
session_cache_limiter('none');
session_start();
$path = "../libraries/";
/** Configuration file.*/
include_once $path . "configuration.php";
try {
    switch ($_GET['type']) {
        case 'content':
            $unit = new EfrontUnit($_GET['id']);
            if (!$unit['options']['indexed']) {
                throw new Exception(_RESOURCEISNOTACCESSIBLEFROMOUTSIDE);
            }
            if (!$unit['active']) {
                throw new Exception(_RESOURCEISNOTAVAILABLE);
            }
            echo $unit['data'];
            break;
        default:
            break;
    }
} catch (Exception $e) {
    eF_redirect("student.php?message=" . $e->getMessage());
}
Esempio n. 19
0
}
$backup_form = new HTML_QuickForm("backup_form", "post", basename($_SERVER['PHP_SELF']) . '?ctg=backup', "", null, true);
$backup_form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
//Register this rule for checking user input with our function, eF_checkParameter
$backup_form->addElement('text', 'backupname', null, 'class = "inputText"');
$backup_form->addRule('backupname', _THEFIELD . ' ' . _FILENAME . ' ' . _ISMANDATORY, 'required', null, 'client');
$backup_form->setDefaults(array("backupname" => "backup_" . date('Y_m_d_h.i.s', time())));
if ($GLOBALS['configuration']['version_hosted']) {
    $backupTypes = array("0" => _DATABASEONLY);
} else {
    $backupTypes = array("0" => _DATABASEONLY, "1" => _ALLDATABACKUP);
    if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
        $backupTypes[3] = _ALLDATASYSTEMBACKUP;
    }
}
$backup_form->addElement('select', 'backuptype', null, $backupTypes);
$backup_form->addElement('submit', 'submit_backup', _TAKEBACKUP, 'class = "flatButton" onclick = "$(\'backup_image\').show();"');
if ($backup_form->isSubmitted() && $backup_form->validate()) {
    $values = $backup_form->exportValues();
    try {
        $backupFile = EfrontSystem::backup($values['backupname'] . '.zip', $values['backuptype']);
        eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=backup&message=" . urlencode(_SUCCESFULLYBACKEDUP) . "&message_type=success");
    } catch (EfrontFileException $e) {
        $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
        $message = $e->getMessage() . ' &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
        $message_type = failure;
    }
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$backup_form->accept($renderer);
$smarty->assign('T_BACKUP_FORM', $renderer->toArray());
Esempio n. 20
0
     $smarty->assign("T_BASE_URL", $baseUrl);
     require_once 'course_settings.php';
     //The main courses list
 } else {
     //Directly import course
     $form = new HTML_QuickForm("import_course_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=courses", "", null, true);
     //Build the form
     $form->addElement('file', 'import_content', _UPLOADFILE, 'class = "inputText"');
     $form->addElement('submit', 'submit_course', _SUBMIT, 'class = "flatButton"');
     $form->setMaxFileSize(FileSystemTree::getUploadMaxSize() * 1024);
     try {
         if ($form->isSubmitted() && $form->validate()) {
             //If the form is submitted and validated
             $directionsTree = new EfrontDirectionsTree();
             if (sizeof($directionsTree->tree) == 0) {
                 eF_redirect(basename($_SERVER['PHP_SELF']) . '?ctg=directions&add_direction=1&message=' . urlencode(_TOCREATECOURSEYOUMUSTFIRSTCREATECATEGORY) . '&message_type=failure');
                 exit;
             }
             $userTempDir = $GLOBALS['currentUser']->user['directory'] . '/temp';
             if (!is_dir($userTempDir)) {
                 //If the user's temp directory does not exist, create it
                 $userTempDir = EfrontDirectory::createDirectory($userTempDir, false);
             } else {
                 $userTempDir = new EfrontDirectory($userTempDir);
             }
             $filesystem = new FileSystemTree($userTempDir, true);
             $file = $filesystem->uploadFile('import_content', $userTempDir);
             $newCourse = EfrontCourse::createCourse();
             $exportedFile = $file;
             $newCourse->import($exportedFile, false, true);
         }
Esempio n. 21
0
<?php

if (G_VERSIONTYPE == 'enterprise') {
    #cpp#ifdef ENTERPRISE
    //This file cannot be called directly, only included.
    if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) {
        exit;
    }
    if ($currentUser->coreAccess['organization'] == 'hidden') {
        eF_redirect(basename($_SERVER['PHP_SELF']));
        exit;
    }
    if (isset($currentUser->coreAccess['organization']) && $currentUser->coreAccess['organization'] != 'change') {
        $_change_placements_ = false;
    } else {
        if ($currentUser->user['user_type'] == 'administrator') {
            $_change_placements_ = true;
        } else {
            if ($currentUser->user['login'] == $editedUser->user['login']) {
                $_change_placements_ = false;
            } else {
                if (!$currentEmployee->isSupervisor()) {
                    $_change_placements_ = false;
                } else {
                    if ($currentEmployee->supervisesEmployee($editedUser->user['login'])) {
                        $_change_placements_ = true;
                    } else {
                        $_change_placements_ = false;
                    }
                }
            }
 /**
  * The main functionality
  *
  * (non-PHPdoc)
  * @see libraries/EfrontModule#getModule()
  */
 public function getModule()
 {
     $smarty = $this->getSmartyVar();
     $currentUser = $this->getCurrentUser();
     $directionsTree = new EfrontDirectionsTree();
     $directionsPaths = $directionsTree->toPathString();
     $smarty->assign("T_MODULE_OUTLOOK_INVITATION_DIRECTION_PATHS", $directionsPaths);
     $temp = eF_getTableData("module_outlook_invitation as m,courses as c", "m.*,c.name,c.directions_ID", "m.courses_ID=c.id");
     $events = array();
     foreach ($temp as $value) {
         $events[$value['courses_ID']] = $value;
     }
     if (isset($_GET['delete_event']) && eF_checkParameter($_GET['delete_event'], 'id') && in_array($_GET['delete_event'], array_keys($events))) {
         try {
             $event = $events[$_GET['delete_event']];
             $course = new EfrontCourse($event['courses_ID']);
             $users = $course->getCourseUsers(array('active' => true, archive => false, 'return_objects' => false));
             $recipients = array();
             foreach ($users as $value) {
                 $recipients[] = $value['email'];
             }
             $this->cancelInvitation($course->course['id'], $recipients);
             eF_deleteTableData("module_outlook_invitation", "courses_ID=" . $_GET['delete_event']);
         } catch (Exception $e) {
             header("HTTP/1.0 500 ");
             echo $e->getMessage() . ' (' . $e->getCode() . ')';
         }
         exit;
     }
     if ($_SESSION['s_type'] != 'administrator') {
         $userCourses = $currentUser->getUserCourses(array('archive' => 0, 'active' => true, 'return_objects' => false));
         if (G_VERSIONTYPE == 'enterprise') {
             if ($_SESSION['s_current_branch']) {
                 $result = eF_getTableData("module_hcd_course_to_branch", "courses_ID", "branches_ID='{$_SESSION['s_current_branch']}'");
             } else {
                 if ($currentUser->aspects['hcd']->isSupervisor()) {
                     $result = eF_getTableData("module_hcd_course_to_branch", "courses_ID", "branches_ID in (select branches_ID from module_hcd_employee_works_at_branch where users_login='******'login']}' and supervisor=1)");
                 }
             }
             $branchCourses = array();
             foreach ($result as $value) {
                 $branchCourses[$value['courses_ID']] = $value['courses_ID'];
             }
             foreach ($events as $key => $value) {
                 if (!isset($branchCourses[$key]) && !isset($userCourses[$key])) {
                     unset($events[$key]);
                 }
             }
         } else {
             foreach ($events as $key => $value) {
                 if (!isset($userCourses[$key])) {
                     unset($events[$key]);
                 }
             }
         }
     }
     if (!isset($_GET['course'])) {
         $dataSource = $events;
         $tableName = 'outlookInvitationsTable';
         isset($_GET['limit']) && eF_checkParameter($_GET['limit'], 'uint') ? $limit = $_GET['limit'] : ($limit = G_DEFAULT_TABLE_SIZE);
         if (isset($_GET['sort']) && eF_checkParameter($_GET['sort'], 'text')) {
             $sort = $_GET['sort'];
             isset($_GET['order']) && $_GET['order'] == 'desc' ? $order = 'desc' : ($order = 'asc');
         } else {
             $sort = 'login';
         }
         $dataSource = eF_multiSort($dataSource, $sort, $order);
         $smarty->assign("T_TABLE_SIZE", sizeof($dataSource));
         if (isset($_GET['filter'])) {
             $dataSource = eF_filterData($dataSource, $_GET['filter']);
         }
         if (isset($_GET['limit']) && eF_checkParameter($_GET['limit'], 'int')) {
             isset($_GET['offset']) && eF_checkParameter($_GET['offset'], 'int') ? $offset = $_GET['offset'] : ($offset = 0);
             $dataSource = array_slice($dataSource, $offset, $limit);
         }
         $smarty->assign("T_DATA_SOURCE", $dataSource);
     } else {
         $course = new EfrontCourse($_GET['course']);
         $form = new HTML_QuickForm("import_outlook_invitation_form", "post", $this->moduleBaseUrl . "&course={$course->course['id']}&add_event=1" . (isset($_GET['popup']) ? '&popup=1' : ''), "", null, true);
         $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
         //Register this rule for checking user input with our function, eF_checkParameter
         $form->addElement('text', 'email', _SENDER, 'class = "inputText"');
         $form->addElement('text', 'location', _LOCATION, 'class = "inputText"');
         $form->addElement('text', 'subject', _SUBJECT, 'class = "inputText"');
         $form->addElement('textarea', 'description', _DESCRIPTION, 'class = "inputTestTextarea" style = "width:80%;height:6em;"');
         //$form -> addElement('checkbox', 'calendar', _MODULE_OUTLOOK_INVITATION_CREATE_CALENDAR);
         //$form -> addElement('static', 'static', _MODULE_OUTLOOK_INVITATION_INFO);
         $form->addElement('submit', 'submit_event_all', _MODULE_OUTLOOK_INVITATION_SENDALL, 'class=flatButton');
         $form->addElement('submit', 'submit_event_new', _MODULE_OUTLOOK_INVITATION_SENDNEW, 'class=flatButton');
         if (empty($events[$course->course['id']])) {
             //new invitation
             $currentEvent = null;
             $form->setDefaults(array('email' => $currentUser->user['email'], 'subject' => 'Invitation to attend training: ' . $course->course['name']));
         } else {
             //existing invitation
             $currentEvent = $events[$course->course['id']];
             $form->setDefaults(array('email' => $currentEvent['email'], 'description' => $currentEvent['description'], 'subject' => $currentEvent['subject'], 'location' => $currentEvent['location']));
         }
         if ($form->isSubmitted() && $form->validate()) {
             try {
                 $message = "";
                 // Set info to store into database
                 $permanent_info = array("courses_ID" => $course->course['id'], "email" => $form->exportValue('email') ? $form->exportValue('email') : $GLOBALS['configuration']['system_email'], "location" => $form->exportValue('location'), "subject" => $form->exportValue('subject'), "description" => $form->exportValue('description'));
                 if ($currentEvent) {
                     $permanent_info['sequence'] = $currentEvent['sequence'] + 1;
                     eF_updateTableData("module_outlook_invitation", $permanent_info, "courses_ID={$course->course['id']}");
                 } else {
                     eF_insertTableData("module_outlook_invitation", $permanent_info);
                 }
                 if ($form->exportValue('submit_event_all')) {
                     $users = $course->getCourseUsers(array('active' => true, archive => false, 'return_objects' => false));
                     $recipients = array();
                     foreach ($users as $value) {
                         $recipients[] = $value['email'];
                     }
                     $this->sendInvitation($course->course['id'], $recipients);
                 }
                 //					$smarty->assign('T_RELOAD', true);
                 if (isset($_GET['popup'])) {
                     $this->setMessageVar(_OPERATIONCOMPLETEDSUCCESSFULLY, 'success');
                 } else {
                     eF_redirect($this->moduleBaseUrl . "&message=" . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . "&message_type=success");
                 }
             } catch (Exception $e) {
                 $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
                 $this->setMessageVar($e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>', 'failure');
             }
         }
         $form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
         $form->setRequiredNote(_REQUIREDNOTE);
         $smarty->assign('T_MODULE_OUTLOOK_INVITATION_FORM', $form->toArray());
     }
     $smarty->assign("T_MODULE_BASEDIR", $this->moduleBaseDir);
     $smarty->assign("T_MODULE_BASELINK", $this->moduleBaseLink);
     $smarty->assign("T_MODULE_BASEURL", $this->moduleBaseUrl);
     return true;
 }
Esempio n. 23
0
}
$editedUser = EfrontUserFactory::factory($_GET['user']);
$editedEmployee = $editedUser->aspects['hcd'];
$smarty->assign("T_EDITEDUSER", $editedUser);
if (G_VERSIONTYPE == 'enterprise') {
    #cpp#ifdef ENTERPRISE
    $currentEmployee = $currentUser->aspects['hcd'];
    if ($currentUser->user['login'] != $editedUser->user['login'] && $currentUser->user['user_type'] != 'administrator') {
        if (!$currentEmployee->isSupervisor() || !$currentEmployee->supervisesEmployee($editedUser->user['login'])) {
            eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=personal&user="******"&op=profile&message=" . urlencode(_YOUCANNOTEDITTHISUSER) . "&message_type=failure");
        }
    }
} else {
    #cpp#else
    if ($currentUser->user['login'] != $editedUser->user['login'] && $currentUser->user['user_type'] != 'administrator') {
        eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=personal&user="******"&op=profile&message=" . urlencode(_YOUCANNOTEDITTHISUSER) . "&message_type=failure");
    }
}
#cpp#endif
$enterpriseOperations = array();
$learningOperations = array('user_courses', 'user_lessons');
$accountOperations = array('profile', 'user_groups');
$fileOperations = array();
if (G_VERSIONTYPE == 'enterprise') {
    #cpp#ifdef ENTERPRISE
    $enterpriseOperations = array('placements', 'skills', 'evaluations', 'history', 'org_form');
}
#cpp#endif
if (G_VERSIONTYPE != 'community') {
    #cpp#ifndef COMMUNITY
    $learningOperations[] = 'certificates';
Esempio n. 24
0
    $smarty->assign("T_ACTIVE_MENU", $active_menu);
    $_SESSION['last_id'] = 0;
    // Each time the sidebar reloads you need to get the five last minuites
    $smarty->assign("T_MENU", $newMenu->menu);
    if ($currentUser->getType() != "administrator" && !isset($currentLesson)) {
        $smarty->assign("T_MENUCOUNT", $newMenu->menuCount - 1);
    } else {
        $smarty->assign("T_MENUCOUNT", $newMenu->menuCount);
    }
}
if (isset($GLOBALS['currentTheme']->options['sidebar_interface']) && $GLOBALS['currentTheme']->options['sidebar_interface'] < 2 || $GLOBALS['currentTheme']->options['sidebar_interface'] == 2 && $GLOBALS['currentTheme']->options['show_header'] == 2) {
    if (isset($GLOBALS['currentLesson']) && $GLOBALS['currentLesson']->options['online'] && $GLOBALS['currentLesson']->options['online'] == 1 || $_SESSION['s_type'] == 'administrator') {
        //$currentUser = EfrontUserFactory :: factory($_SESSION['s_login']);
        $onlineUsers = EfrontUser::getUsersOnline($GLOBALS['configuration']['autologout_time'] * 60);
        if (!$_SESSION['s_login']) {
            eF_redirect("index.php?message=" . rawurlencode(_INACTIVITYLOGOUT));
        }
        $size = sizeof($onlineUsers);
        if ($size) {
            $smarty->assign("T_ONLINE_USERS_COUNT", $size);
        }
        $smarty->assign("T_ONLINE_USERS_LIST", $onlineUsers);
    }
}
if (!isset($horizontal_inframe_version) || !$horizontal_inframe_version) {
    if (EfrontUser::isOptionVisible('messages')) {
        if ($currentUser->coreAccess['personal_messages'] || $currentUser->coreAccess['personal_messages'] != 'hidden') {
            $unreadMessages = $messages = eF_getTableData("f_personal_messages pm, f_folders ff", "count(*)", "pm.users_LOGIN='******'s_login'] . "' and viewed='no' and f_folders_ID=ff.id and ff.name='Incoming'");
            $smarty->assign("T_UNREAD_MESSAGES", $messages[0]['count(*)']);
        } else {
            $smarty->assign("T_NO_MESSAGES", true);
Esempio n. 25
0
     require_once "lesson_settings.php";
 } else {
     //The default action is to just print a list with the lessons defined in the system
     //    $filesystem = new FileSystemTree(G_LESSONSPATH, true);
     $form = new HTML_QuickForm("import_lesson_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=lessons", "", null, true);
     //Build the form
     $form->addElement('file', 'import_content', _UPLOADLESSONFILE, 'class = "inputText"');
     $form->setMaxFileSize(FileSystemTree::getUploadMaxSize() * 1024);
     //getUploadMaxSize returns size in KB
     $form->addElement('submit', 'submit_lesson', _SUBMIT, 'class = "flatButton"');
     try {
         if ($form->isSubmitted() && $form->validate()) {
             //If the form is submitted and validated
             $directionsTree = new EfrontDirectionsTree();
             if (sizeof($directionsTree->tree) == 0) {
                 eF_redirect(basename($_SERVER['PHP_SELF']) . '?ctg=directions&add_direction=1&message=' . urlencode(_YOUMUSTFIRSTCREATEDIRECTION) . '&message_type=failure');
                 exit;
             }
             //changed because of #1462
             $newLesson = EfrontLesson::createLesson();
             $filesystem = new FileSystemTree($newLesson->getDirectory(), true);
             $file = $filesystem->uploadFile('import_content', $newLesson->getDirectory());
             $newLesson->import($file, false, true, true);
             $message = _OPERATIONCOMPLETEDSUCCESSFULLY;
             $message_type = 'success';
         }
     } catch (EfrontFileException $e) {
         handleNormalFlowExceptions($e);
     }
     $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
     //Create a smarty renderer
Esempio n. 26
0
             $value->delete();
         }
         EfrontConfiguration::setValue('theme', $_GET['set_theme']);
         foreach ($themes as $key => $value) {
             //$value = new themes($value['id']);
             unset($value->options['browsers']);
             $value->persist();
         }
         $theme = new themes($_GET['set_theme']);
         if ($theme->options['sidebar_interface'] > 0) {
             echo json_encode(array('success' => true, 'data' => array('url' => basename($_SERVER['PHP_SELF']) . '?ctg=themes&tab=set_theme')));
         } else {
             echo json_encode(array('success' => true, 'data' => array('url' => basename($_SERVER['PHP_SELF'], '.php') . 'page.php?ctg=themes&tab=set_theme')));
         }
         if (!isset($_GET['ajax'])) {
             eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=themes");
         }
     } catch (Exception $e) {
         handleAjaxExceptions($e);
     }
     exit;
 }
 if (isset($_GET['reset_theme']) && $_GET['reset_theme'] == $currentSetTheme->{$currentSetTheme->entity}['id']) {
     try {
         $currentSetTheme->applySettings();
     } catch (Exception $e) {
         handleAjaxExceptions($e);
     }
     exit;
 }
 if (isset($_GET['export_theme']) && in_array($_GET['export_theme'], $legalValues) && eF_checkParameter($_GET['export_theme'], 'id')) {
Esempio n. 27
0
} catch (Exception $e) {
    echo "<script>parent.location = 'index.php?logout=true&message=" . urlencode($e->getMessage() . ' (' . $e->getCode() . ')') . "&message_type=failure'</script>";
    //This way the frameset will revert back to single frame, and the annoying effect of 2 index.php, one in each frame, will not happen
    exit;
}
try {
    if ($_SESSION['s_lessons_ID']) {
        $currentLesson = new EfrontLesson($_SESSION['s_lessons_ID']);
    } elseif ($_POST['lessons_ID']) {
        $currentLesson = new EfrontLesson($_POST['lessons_ID']);
    }
    if (isset($currentUser->coreAccess['settings']) && $currentUser->coreAccess['settings'] != 'change') {
        throw new Exception();
    }
} catch (Exception $e) {
    eF_redirect("index.php?message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
    exit;
}
try {
    $roles = EfrontUser::getRoles();
    if (isset($_POST['firstlist']) && isset($_POST['secondlist'])) {
        parse_str($_POST['firstlist']);
        parse_str($_POST['secondlist']);
        parse_str($_POST['visibility']);
        mb_internal_encoding('utf-8');
        //This must be put here due to PHP bug #48697
        if ($visibility) {
            $positions = serialize(array('first' => array_unique($firstlist), 'second' => array_unique($secondlist), 'visibility' => $visibility));
        } else {
            $positions = serialize(array('first' => array_unique($firstlist), 'second' => array_unique($secondlist)));
        }
Esempio n. 28
0
                 //$dir = new EfrontDirectory(G_MODULESPATH.$module_folder.'/');
                 //$dir -> delete();
                 //eF_deleteFolder(G_MODULESPATH.$module_folder.'/');
             }
         } else {
             // If the module is to be installed to a different than the existing folder that
             // already exists (like the directory name of another module) then the upgrade should
             // be aborted
             // If everything went ok, then upgrade the module
             if ($module->onUpgrade()) {
                 // If the upgrade is successful, then update the modules table
                 if (eF_updateTableData("modules", $fields, "className ='" . $_GET['upgrade'] . "'")) {
                     // Delete the existing module folder
                     $message = _MODULESUCCESFULLYUPGRADED;
                     $message_type = 'success';
                     eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=modules&message=" . urlencode($message) . "&message_type=" . $message_type);
                 } else {
                     $message = _PROBLEMINSERTINGPARSEDXMLVALUESORMODULEEXISTS;
                     $message_type = 'failure';
                 }
             } else {
                 $message = _MODULEDBERRORONUPGRADECHECKUPGRADEFUNCTION;
                 $message_type = 'failure';
             }
         }
     }
 } else {
     $message = '"' . $className . '" ' . _MODULECLASSNOTEXISTSIN . ' ' . G_MODULESPATH . $module_folder . '/' . $className . '.class.php';
     $message_type = 'failure';
     $dir = new EfrontDirectory(G_MODULESPATH . $module_folder . '/');
     $dir->delete();
Esempio n. 29
0
<?php

#cpp#ifndef COMMUNITY
if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) {
    exit;
}
if (isset($currentLesson->options['smart_content']) && $currentLesson->options['smart_content'] == 0) {
    eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
}
/*
define("_IMPORTMETHOD", "Import method");
define("_FROMURL", "From URL");
define("_FROMPATH", "From path");
*/
$loadScripts[] = 'includes/import';
$form = new HTML_QuickForm("import_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=import", "", null, true);
/*
$form -> addElement('select', 'import_type', _IMPORTTYPE, array('efront'    => _EFRONTFILE,
'scorm2004' => _SCORM2004,
'scorm12'   => _SCORM12,
//'aicc'      => _AICC,
//'csv'       => _CSV,
'pdf'       => _PDF,
//'doc'       => _DOC,
'html'      => _HTML,
'xml'       => _XML,
'auto'      => _AUTODETECT));
*/
$form->addElement('advcheckbox', 'folders_to_hierarchy', _CONVERTFOLDERSTOHIERARCHY, null, 'class = "inputCheckbox"', array(0, 1));
$form->addElement('advcheckbox', 'uncompress_recursive', _UNCOMPRESSRECURSIVELYIMPORT, null, 'class = "inputCheckbox"', array(0, 1));
$form->addElement('advcheckbox', 'prompt_download', _FORCEDOWNLOADFILE, null, 'class = "inputCheckbox"', array(0, 1));
Esempio n. 30
0
             $certificate = str_replace("#user_surname#", utf8ToUnicode($issued_data['user_surname']), $certificate);
             $certificate = str_replace("#course_name#", utf8ToUnicode($issued_data['course_name']), $certificate);
             $certificate = str_replace("#grade#", utf8ToUnicode($issued_data['grade']), $certificate);
             if (eF_checkParameter($issued_data['date'], 'timestamp')) {
                 $issued_data['date'] = formatTimestamp($issued_data['date']);
             }
             $certificate = str_replace("#date#", utf8ToUnicode($issued_data['date']), $certificate);
             $certificate = str_replace("#serial_number#", utf8ToUnicode($issued_data['serial_number']), $certificate);
         }
     } else {
         if ($_SESSION['s_type'] == 'student') {
             $offset = '?ctg=lessons_list';
         } else {
             $offset = '?ctg=courses&course=' . $_GET['course'] . '&op=course_certificates';
         }
         eF_redirect("" . basename($_SERVER['PHP_SELF']) . $offset . "&message=" . urlencode(_UNPRIVILEGEDATTEMPT) . "&message_type=failure");
         exit;
     }
 } else {
     $certificateDirectory = G_CERTIFICATETEMPLATEPATH;
     $selectedCertificate = $_GET['certificate_tpl'];
     $certificate = file_get_contents($certificateDirectory . $selectedCertificate);
 }
 $filenameRtf = "certificate_" . $_GET['user'] . ".rtf";
 $webserver = explode(' ', $_SERVER['SERVER_SOFTWARE']);
 //GET Server information from $_SERVER
 $webserver_type = explode('/', $webserver[0]);
 $filenamePdf = G_ROOTPATH . "www/phplivedocx/samples/mail-merge/convert/certificate_" . $_GET['user'] . ".pdf";
 $filenameRtf = G_ROOTPATH . "www/phplivedocx/samples/mail-merge/convert/certificate_" . $_GET['user'] . ".rtf";
 file_put_contents(G_ROOTPATH . "www/phplivedocx/samples/mail-merge/convert/certificate_" . $_GET['user'] . ".rtf", $certificate);
 if (stristr($webserver_type[0], "IIS") === false) {