Example #1
0
 /**
  * call all gateway notification
  *
  * @param int $uidList
  * @param messageToSend $message
  * @param int $messageId
  */
 public static function notify($uidList, $message, $messageId)
 {
     // list all file in ./notifier/
     $notifierFile = new Claro_FileFinder_Extension(dirname(__FILE__) . '/notifier/', '.notifier.lib.php', false);
     $classNotLoad = '';
     foreach ($notifierFile as $file) {
         require_once $file->getPathname();
         //take the name of the class
         // convention file: name.lib.php classe: name
         $className = substr($file->getFilename(), 0, strlen($file->getFilename()) - strlen(".notifier.lib.php")) . 'Notifier';
         if (class_exists($className)) {
             $notifier = new $className();
             $notifier->notify($uidList, $message, $messageId);
         } else {
             if ($classNotLoad != '') {
                 $classNotLoad .= ', ';
             }
             $classNotLoad .= $className;
         }
     }
     if ($classNotLoad != '') {
         claro_die(get_lang("The message sent but the notification by " . $classNotLoad . " failed"));
     }
 }
Example #2
0
$userId = isset($_REQUEST['userId']) ? (int) $_REQUEST['userId'] : null;
$link_arg = array();
if (!is_null($userId) && !empty($userId)) {
    $currentUserId = (int) $_REQUEST['userId'];
    $link_arg['userId'] = $currentUserId;
} else {
    $currentUserId = claro_get_current_user_id();
}
if ($currentUserId != claro_get_current_user_id() && !claro_is_platform_admin()) {
    claro_die(get_lang("Not allowed"));
}
// user exist ?
if ($currentUserId != claro_get_current_user_id()) {
    $userData = user_get_properties($currentUserId);
    if ($userData === false) {
        claro_die(get_lang("User not found"));
    } else {
        $title = get_lang('Messages of %firstName %lastName', array('%firstName' => claro_htmlspecialchars($userData['firstname']), '%lastName' => claro_htmlspecialchars($userData['lastname'])));
    }
} else {
    $title = get_lang('My messages');
}
$linkPage = $_SERVER['PHP_SELF'];
$acceptedValues = array('inbox', 'outbox', 'trashbox');
if (!isset($_REQUEST['box']) || !in_array($_REQUEST['box'], $acceptedValues)) {
    $_REQUEST['box'] = "inbox";
}
$link_arg['box'] = $_REQUEST['box'];
require_once dirname(__FILE__) . '/lib/tools.lib.php';
$content = "";
if ($link_arg['box'] == "inbox") {
        $pathInfo = strtolower(str_replace('\\', '/', $pathInfo));
    }
    $document_url = str_replace($rootSys, $urlAppend . '/', $pathInfo);
    if (get_conf('useSendfile', true) && ($mimeType != 'text/html' || $extension == 'url') || $wasFolder) {
        if (claro_send_file($pathInfo) !== false) {
            $claroline->notifier->event('download', array('data' => array('url' => $document_url)));
            if ($wasFolder) {
                unlink($pathInfo);
            }
            if (!$canRetry) {
                $sql = 'DELETE FROM `' . $tableName . '` WHERE token = \'' . claro_sql_escape($token) . '\'';
                Claroline::getDatabase()->exec($sql);
            }
        } else {
            header('HTTP/1.1 404 Not Found');
            claro_die(get_lang('File download failed : %failureMSg%', array('%failureMsg%' => claro_failure::get_last_failure())));
        }
    } else {
        $sql = 'DELETE FROM `' . $tableName . '` WHERE token = \'' . claro_sql_escape($token) . '\'';
        Claroline::getDatabase()->exec($sql);
        // redirect to document
        claro_redirect($document_url);
    }
} else {
    header('HTTP/1.1 404 Not Found');
}
//Clean left zip here
$sql = 'SELECT * FROM `' . $tableName . '` WHERE ADDTIME(`requestTime`,\'0 0:0:30\') < NOW() AND NOT `wasFolder` = \'0\'';
$result = Claroline::getDatabase()->query($sql);
while (($row = $result->fetch()) !== false) {
    if (is_file($row['requestedPath'])) {
Example #4
0
/**
 * @param array $criterionList -
 *        Allowed keys are 'name', 'firstname', 'email', 'officialCode','username'
 * @param string $courseId (optional)
 *        permit check if user are already enrolled in the concerned cours
 * @param boolean $allCriterion (optional)
 *        define if all submited criterion has to be set.
 * @param boolean $strictCompare (optional)
 *        define if criterion comparison use wildcard or not
 * @return array : existing users who met the criterions
 */
function user_search($criterionList = array(), $courseId = null, $allCriterion = true, $strictCompare = false, $ignoreDisabledAccounts = false)
{
    $validatedCritList = array('lastname' => '', 'firstname' => '', 'email' => '', 'officialCode' => '', 'username' => '');
    foreach ($criterionList as $thisCritKey => $thisCritValue) {
        if (array_key_exists($thisCritKey, $validatedCritList)) {
            $validatedCritList[$thisCritKey] = str_replace('%', '\\%', $thisCritValue);
        } else {
            claro_die('user_search(): WRONG CRITERION KEY !');
        }
    }
    $operator = $allCriterion ? 'AND' : 'OR';
    $wildcard = $strictCompare ? '' : '%';
    $tbl_mdb_names = claro_sql_get_main_tbl();
    $tbl_user = $tbl_mdb_names['user'];
    $tbl_course_user = $tbl_mdb_names['rel_course_user'];
    $sql = "SELECT U.nom           lastname,\n                    U.prenom        firstname,\n                    U.email         email,\n                    U.officialCode  officialCode,\n                    U.username      username,\n                    U.`user_id` AS  uid\n                   " . ($courseId ? ', CU.user_id AS registered' : '') . "\n             FROM `" . $tbl_user . "` AS U ";
    if ($courseId) {
        $sql .= " LEFT JOIN `" . $tbl_course_user . "` AS CU\n                                    ON CU.`user_id`=U.`user_id`\n                                   AND CU.`code_cours` = '" . $courseId . "' ";
    }
    $sqlCritList = array();
    if ($validatedCritList['lastname']) {
        $sqlCritList[] = " U.nom    LIKE '" . claro_sql_escape($validatedCritList['lastname']) . $wildcard . "'";
    }
    if ($validatedCritList['firstname']) {
        $sqlCritList[] = " U.prenom LIKE '" . claro_sql_escape($validatedCritList['firstname']) . $wildcard . "'";
    }
    if ($validatedCritList['email']) {
        $sqlCritList[] = " U.email  LIKE '" . claro_sql_escape($validatedCritList['email']) . $wildcard . "'";
    }
    if ($validatedCritList['officialCode']) {
        $sqlCritList[] = " U.officialCode = '" . claro_sql_escape($validatedCritList['officialCode']) . "'";
    }
    if ($validatedCritList['username']) {
        $sqlCritList[] = " U.username = '******'username']) . "'";
    }
    if (count($sqlCritList) > 0) {
        $sql .= 'WHERE ' . implode(" {$operator} ", $sqlCritList);
    }
    // ignore disabled account if needed
    if ($ignoreDisabledAccounts) {
        if (count($sqlCritList) > 0) {
            $sql .= " AND U.authSource != 'disabled' ";
        } else {
            $sql .= "WHERE U.authSource != 'disabled' ";
        }
    }
    $sql .= " ORDER BY U.nom, U.prenom";
    return claro_sql_query_fetch_all($sql);
}
Example #5
0
/*---------------------------------------------------------------------------
  Group initialisation
 ---------------------------------------------------------------------------*/
// if the requested group is different from the group in session
if ($gidReq && (!isset($_SESSION['_gid']) || $gidReq != $_SESSION['_gid'])) {
    $gidReset = true;
}
if ($gidReset || $cidReset) {
    if ($gidReq && $_cid) {
        $context = array(CLARO_CONTEXT_COURSE => $_cid, CLARO_CONTEXT_GROUP => $gidReq);
        $course_group_data = claro_get_group_data($context, true);
        $_group = $course_group_data;
        if ($_group) {
            $_gid = $course_group_data['id'];
        } else {
            claro_die('WARNING !! Undefined groupd id: the requested group ' . ' doesn\'t exist at line ' . __LINE__ . '.  ' . 'Please contact your platform administrator.');
        }
    } else {
        $_gid = null;
        $_group = null;
    }
} else {
    $_gid = !empty($_SESSION['_gid']) ? $_SESSION['_gid'] : null;
    $_group = !empty($_SESSION['_group']) ? $_SESSION['_group'] : null;
}
/*---------------------------------------------------------------------------
  Group / User relation initialisation
 ---------------------------------------------------------------------------*/
if ($uidReset || $cidReset || $gidReset) {
    if ($_uid && $_cid && $_gid) {
        $sql = "SELECT status,\n                       role\n                FROM `" . $_course['dbNameGlu'] . "group_rel_team_user`\n                WHERE `user` = '" . (int) $_uid . "'\n                AND `team`   = '" . (int) $gidReq . "'";
Example #6
0
                $sqlPrepareList[] = 'nom = "' . addslashes(utf8_decode($_SERVER[$shibbolethData['nom']])) . '"';
                $sqlPrepareList[] = 'prenom = "' . addslashes(utf8_decode($_SERVER[$shibbolethData['prenom']])) . '"';
                // Use first email only
                $shibbolethEmail = explode($shibbolethEmailSep, $_SERVER[$shibbolethData['email']]);
                if ($shibbolethEmail[0] == '') {
                    $shibbolethEmail[0] = $shibbolethDefaultEmail;
                }
                $sqlPrepareList[] = 'email = "' . addslashes($shibbolethEmail[0]) . '"';
                $sqlPrepareList[] = 'authSource = "' . $shibbolethAuthSource . '"';
                $sqlPrepareList[] = '`' . $shibbolethUidTbl . '` = "' . $_SERVER[$shibbolethUniqueIdAttr] . '"';
                if ($shibbolethUidTbl != 'username') {
                    $sqlPrepareList[] = 'username = "******"';
                }
                $sql = 'UPDATE `' . $tbl_user . '` ' . 'SET ' . implode(', ', $sqlPrepareList) . ' ' . 'WHERE user_id = ' . (int) $_uid;
                $res = mysql_query($sql) or die('<center>UPDATE QUERY FAILED LINE ' . __LINE__ . '<center>');
                // redirect as normal login back to "My User Account"
                session_destroy();
                claro_redirect(get_conf('claro_ShibbolethPath') . 'index.php?sourceUrl=' . base64_encode($rootWeb . "claroline/auth/profile.php"));
            }
        } else {
            // was not logged in
            claro_die("<center>WARNING ! UNABLE TO CHANGE AUTHSOURCE. <a href=\"" . $rootWeb . "\">LOGIN FIRST</a>!.</center>");
        }
    } else {
        // Shibboleth authentication failed
        claro_die("<center>WARNING ! SHIBBOLETH AUTHENTICATION FAILED.</center>");
    }
} else {
    // Directory not protected
    claro_die("<center>WARNING ! PROTECT THIS FOLDER IN YOUR WEBSERVER CONFIGURATION.</center>");
}
Example #7
0
        } else {
            $properties['isCourseManager'] = 0;
            $properties['tutor'] = 0;
        }
        user_set_course_properties($user_id, $cidToEdit, $properties);
        //set dialogbox message
        if ($done) {
            $dialogBox->success(get_lang('The user has been enroled to the course'));
        }
        break;
}
//build and call DB to get info about current course (for title) if needed :
$courseData = claro_get_course_data($cidToEdit);
if (!$courseData) {
    unset($_REQUEST['cidToEdit']);
    claro_die('ERROR : COURSE NOT FOUND!!!');
}
//----------------------------------
// Build query and find info in db
//----------------------------------
$sql = "\nSELECT\n    U.nom, U.prenom, U.`user_id` AS ID,\n    CU.*,\n    CU.`user_id` AS Register\nFROM  `" . $tbl_user . "` AS U";
$toAdd = "\nLEFT JOIN `" . $tbl_course_user . "` AS CU\n    ON             CU.`user_id`=U.`user_id`\n            AND CU.`code_cours` = '" . claro_sql_escape($cidToEdit) . "'\n        ";
$sql .= $toAdd;
//deal with LETTER classification call
if (isset($_GET['letter'])) {
    $toAdd = "\n            AND U.`nom` LIKE '" . claro_sql_escape($_GET['letter']) . "%' ";
    $sql .= $toAdd;
}
//deal with KEY WORDS classification call
if (isset($_REQUEST['search']) && $_REQUEST['search'] != '') {
    $toAdd = " WHERE (U.`nom` LIKE '" . claro_sql_escape($_REQUEST['search']) . "%'\n              OR U.`username` LIKE '" . claro_sql_escape($_REQUEST['search']) . "%'\n              OR U.`prenom` LIKE '" . claro_sql_escape($_REQUEST['search']) . "%') ";
Example #8
0
$portletLabel = isset($_REQUEST['portletLabel']) ? $_REQUEST['portletLabel'] : null;
$portletClass = isset($portletLabel) ? $portletLabel . '_portlet' : null;
require '../inc/claro_init_global.inc.php';
require_once get_path('incRepositorySys') . '/lib/claroCourse.class.php';
require_once get_path('incRepositorySys') . '/lib/users/userlist.lib.php';
require_once dirname(__FILE__) . '/coursehomepage/lib/coursehomepageportlet.class.php';
require_once dirname(__FILE__) . '/coursehomepage/lib/coursehomepageportletiterator.class.php';
// Instanciate dialog box
$dialogBox = new DialogBox();
// Display the auth form if necessary
// Also redirect if no cid specified
if (!claro_is_in_a_course() || !claro_is_course_allowed()) {
    claro_disp_auth_form(true);
}
if (empty($cidReq)) {
    claro_die(get_lang('Cannot find course'));
}
// Fetch this course's portlets
$portletiterator = new CourseHomePagePortletIterator(ClaroCourse::getIdFromCode($cidReq));
// Include specific CSS if any
if (file_exists(get_conf('coursesRepositorySys') . $_course['path'] . '/css/course.css')) {
    $claroline->display->header->addHtmlHeader('<link rel="stylesheet" media="screen" type="text/css" href="' . get_path('url') . '/' . get_path('coursesRepositoryAppend') . $_course['path'] . '/css/course.css" />');
}
// Instantiate course
$thisCourse = new ClaroCourse();
$thisCourse->load($cidReq);
include claro_get_conf_repository() . 'rss.conf.php';
// Include the course home page special CSS
CssLoader::getInstance()->load('coursehomepage', 'all');
$toolRepository = get_path('clarolineRepositoryWeb');
claro_set_display_mode_available(true);
Example #9
0
}
/* ************************************************************************** */
/*  Initialise variables and include libraries
/* ************************************************************************** */
$dialogBox = new DialogBox();
// Initialisation of global variables and used libraries
require_once get_path('incRepositorySys') . '/lib/pager.lib.php';
require_once get_path('incRepositorySys') . '/lib/course_user.lib.php';
include claro_get_conf_repository() . 'user_profile.conf.php';
$tbl_mdb_names = claro_sql_get_main_tbl();
/**
 * Manage incoming.
 */
if (isset($_REQUEST['cidToEdit']) && $_REQUEST['cidToEdit'] == '' || !isset($_REQUEST['cidToEdit'])) {
    unset($_REQUEST['cidToEdit']);
    claro_die('ERROR : NO COURSE SET!!!');
} else {
    $cidToEdit = $_REQUEST['cidToEdit'];
}
// See SESSION variables used for reorder criteria
$validCmdList = array('unsub');
$validRefererList = array('clist');
$cmd = isset($_REQUEST['cmd']) && in_array($_REQUEST['cmd'], $validCmdList) ? $_REQUEST['cmd'] : null;
$cfrom = isset($_REQUEST['cfrom']) && in_array($_REQUEST['cfrom'], $validRefererList) ? $_REQUEST['cfrom'] : null;
$pager_offset = isset($_REQUEST['pager_offset']) ? $_REQUEST['pager_offset'] : '0';
$addToURL = '';
$do = null;
// Parse command
if ($cmd == 'unsub') {
    $do = 'unsub';
}
Example #10
0
        claro_die(get_lang("Wrong page title"));
    }
}
// --------- Start of wiki command processing ----------
// init message
$message = '';
switch ($action) {
    case 'rqSearch':
        break;
    case 'exSearch':
        $pattern = isset($_REQUEST['searchPattern']) ? trim($_REQUEST['searchPattern']) : null;
        if (!empty($pattern)) {
            $searchEngine = new WikiSearchEngine($con, $config);
            $searchResult = $searchEngine->searchInWiki($pattern, $wikiId, CLWIKI_SEARCH_ANY);
            if ($searchEngine->hasError()) {
                claro_die($searchEngine->getError());
            }
            if (is_null($searchResult)) {
                $searchResult = array();
            }
            $wikiList = $searchResult;
        } else {
            $message = get_lang("Missing search keywords");
            $dialogBox->error($message);
            $action = 'rqSearch';
        }
        break;
        // show differences
    // show differences
    case 'diff':
        require_once 'lib/lib.diff.php';
Example #11
0
$dialogBox = new DialogBox();
$cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null;
$adminContext = isset($_REQUEST['adminContext']) ? (bool) $_REQUEST['adminContext'] : null;
// $sourceCourseId has a value only if we're about to create a session course; it's null otherwise
$sourceCourseId = isset($_REQUEST['course_sourceCourseId']) ? (int) $_REQUEST['course_sourceCourseId'] : null;
// New course object
$thisUser = claro_get_current_user_data();
$course = new ClaroCourse($thisUser['firstName'], $thisUser['lastName'], $thisUser['mail']);
if (!is_null($sourceCourseId)) {
    $course->sourceCourseId = $sourceCourseId;
}
if (!is_null($course->sourceCourseId) && !empty($course->sourceCourseId)) {
    $sourceCourse = new claroCourse();
    $sourceCourse->load(claroCourse::getCodeFromId($course->sourceCourseId));
    if ($sourceCourse->sourceCourseId) {
        claro_die(get_lang('You cannot create a course session from another course session'));
    }
    $course->categories = $sourceCourse->categories;
}
if ($adminContext && claro_is_platform_admin()) {
    // From admin, add param to form
    $course->addHtmlParam('adminContext', '1');
}
if (claro_is_platform_admin() || get_conf('courseCreationAllowed', true)) {
    if ($cmd == 'exEdit') {
        $course->handleForm();
        if ($course->validate()) {
            if ($course->save()) {
                // include the platform language file with all language variables
                language::load_translation();
                language::load_locale_settings();
Example #12
0
            $claroline->log('DELETION COURSE', array('courseName' => $course->title, 'uid' => claro_get_current_user_id()));
            if ($adminContext) {
                claro_redirect(get_path('rootAdminWeb') . '/admin_courses.php');
            } else {
                claro_redirect(get_path('url') . '/index.php');
            }
        } else {
            $dialogBox->error(get_lang('Unable to delete'));
        }
    }
    if ($cmd == 'rqDelete') {
        $display = DISP_COURSE_RQ_DELETE;
    }
} else {
    // course data load failed
    claro_die(get_lang('Wrong parameters'));
}
// Command list
$cmdList = array();
$cmdList[] = array('img' => 'edit', 'name' => get_lang('Edit Tool list'), 'url' => claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'course/tools.php')));
// Main group settings
$cmdList[] = array('img' => 'settings', 'name' => get_lang('Main Group Settings'), 'url' => claro_htmlspecialchars(Url::Contextualize(get_module_url('CLGRP') . '/group_properties.php')));
// Add tracking link
if (get_conf('is_trackingEnabled')) {
    $cmdList[] = array('img' => 'statistics', 'name' => get_lang('Statistics'), 'url' => claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'tracking/courseReport.php')));
}
// Add delete course link
if (get_conf('showLinkToDeleteThisCourse')) {
    $paramString = $course->getHtmlParamList('GET');
    $cmdList[] = array('img' => 'delete', 'name' => get_lang('Delete the whole course website'), 'url' => claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'course/settings.php?cmd=rqDelete' . (!empty($paramString) ? '&' . $paramString : ''))));
}
Example #13
0
$tbl_dock = $tbl_name['dock'];
//NEEDED LIBRAIRIES
require_once get_path('incRepositorySys') . '/lib/module/manage.lib.php';
require_once get_path('incRepositorySys') . '/lib/admin.lib.inc.php';
$undeactivable_tool_array = get_not_deactivable_tool_list();
$htmlHeadXtra[] = "<script type=\"text/javascript\">\nfunction confirmMakeVisible ()\n{\n    if (confirm(\" " . clean_str_for_javascript(get_lang("Are you sure you want to make this module visible in all courses ?")) . "\"))\n        {return true;}\n    else\n        {return false;}\n}\nfunction confirmMakeInVisible ()\n{\n    if (confirm(\" " . clean_str_for_javascript(get_lang("Are you sure you want to make this module invisible in all courses ?")) . "\"))\n        {return true;}\n    else\n        {return false;}\n}\n</script>";
//----------------------------------
// GET REQUEST VARIABLES
//----------------------------------
$cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null;
$item = isset($_REQUEST['item']) ? $_REQUEST['item'] : 'GLOBAL';
$section_selected = isset($_REQUEST['section']) ? $_REQUEST['section'] : null;
$moduleId = isset($_REQUEST['module_id']) ? (int) $_REQUEST['module_id'] : null;
$module = get_module_info($moduleId);
if (!$module) {
    claro_die("ERROR: INVALID MODULE ID!!!");
}
language::load_module_translation($module['label']);
$dockList = get_dock_list($module['type']);
$nameTools = get_lang('Module settings');
$noPHP_SELF = true;
// FIXME : BAD use of get_lang !!!!!
ClaroBreadCrumbs::getInstance()->prepend(get_lang($module['module_name']));
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Module list'), get_path('rootAdminWeb') . 'module/module_list.php?typeReq=' . $module['type']);
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb'));
ClaroBreadCrumbs::getInstance()->setCurrent($nameTools);
$dialogBox = new dialogBox();
//----------------------------------
// EXECUTE COMMAND
//----------------------------------
switch ($cmd) {
Example #14
0
$toolTitle['mainTitle'] = $nameTools;
$is_allowedToTrack = claro_is_course_manager();
$out = '';
if ($is_allowedToTrack && get_conf('is_trackingEnabled')) {
    if (isset($_REQUEST['cmd']) && ($_REQUEST['cmd'] == 'tool' && !empty($_REQUEST['id']))) {
        $toolTitle['subTitle'] = claro_get_tool_name(claro_get_tool_id_from_course_tid((int) $_REQUEST['id']));
        // prepare SQL query
        $sql = "SELECT `U`.`nom` AS `lastName`,\n                       `U`.`prenom` AS `firstName`,\n                        MAX(UNIX_TIMESTAMP(`TE`.`date`)) AS `data`,\n                        COUNT(`TE`.`date`) AS `nbr`\n                  FROM `" . $tbl_course_tracking_event . "` AS `TE`\n             LEFT JOIN `" . $tbl_user . "` AS `U`\n                    ON `TE`.`user_id` = `U`.`user_id`\n                 WHERE `TE`.`tool_id` = '" . (int) $_REQUEST['id'] . "'\n              GROUP BY `U`.`nom`, `U`.`prenom`\n              ORDER BY `U`.`nom`, `U`.`prenom`";
    } elseif (isset($_REQUEST['cmd']) && ($_REQUEST['cmd'] == 'doc' && !empty($_REQUEST['path']))) {
        // FIXME : fix query, probably not a good idea to use like to find a match inside serialized data
        // set the subtitle for the echo claro_html_tool_title function
        $toolTitle['subTitle'] = get_lang('Documents and Links') . " : " . claro_htmlspecialchars($_REQUEST['path']);
        // prepare SQL query
        $sql = "SELECT `U`.`nom` as `lastName`,\n                       `U`.`prenom` as `firstName`,\n                        MAX(UNIX_TIMESTAMP(`TE`.`date`)) AS `data`,\n                        COUNT(`TE`.`date`) AS `nbr`\n                  FROM `" . $tbl_course_tracking_event . "` AS `TE`\n             LEFT JOIN `" . $tbl_user . "` AS `U`\n                    ON `U`.`user_id` = `TE`.`user_id`\n                 WHERE `TE`.`data` LIKE '%" . claro_sql_escape($_REQUEST['path']) . "%'\n              GROUP BY `U`.`nom`, `U`.`prenom`\n              ORDER BY `U`.`nom`, `U`.`prenom`";
    } else {
        claro_die(get_lang('Wrong operation'));
    }
    $out .= claro_html_tool_title($toolTitle);
    // TODO  use datagrid
    $out .= '<br />' . "\n\n" . '<table class="claroTable" border="0" cellpadding="5" cellspacing="1">' . "\n" . '<tr class="headerX">' . "\n" . '<th>' . get_lang('Username') . '</th>' . "\n" . '<th>' . get_lang('Last access') . '</th>' . "\n" . '<th>' . get_lang('Access count') . '</th>' . "\n" . '</tr>' . "\n" . '<tbody>' . "\n\n";
    $i = 0;
    $anonymousCount = 0;
    if (isset($sql)) {
        $accessList = claro_sql_query_fetch_all($sql);
        // display the list
        foreach ($accessList as $userAccess) {
            $userName = $userAccess['lastName'] . " " . $userAccess['firstName'];
            if (empty($userAccess['lastName'])) {
                $anonymousCount = $userAccess['nbr'];
                continue;
            }
Example #15
0
require_once get_path('incRepositorySys') . '/lib/display/dialogBox.lib.php';
// Initialise variables
$nameTools = get_lang('User settings');
$dialogBox = new DialogBox();
/*=====================================================================
  Main Section
 =====================================================================*/
// see which user we are working with ...
if (empty($_REQUEST['uidToEdit'])) {
    claro_redirect('adminusers.php');
} else {
    $userId = $_REQUEST['uidToEdit'];
}
$user_data = user_get_properties($userId);
if (empty($user_data)) {
    claro_die(get_lang('Unable to load user information'));
}
$user_extra_data = user_get_extra_data($userId);
if (count($user_extra_data)) {
    $dgExtra = new claro_datagrid(user_get_extra_data($userId));
} else {
    $dgExtra = null;
}
if (isset($_REQUEST['applyChange'])) {
    // get params form the form
    if (isset($_POST['lastname'])) {
        $user_data['lastname'] = trim($_POST['lastname']);
    }
    if (isset($_POST['firstname'])) {
        $user_data['firstname'] = trim($_POST['firstname']);
    }
Example #16
0
    if (!claro_is_in_a_course()) {
        claro_disp_auth_form(true);
    } else {
        claro_die(get_lang("Not allowed"));
    }
}
// display mode
claro_set_display_mode_available(TRUE);
// check and set user access level for the tool
// set admin mode and groupId
$is_allowedToAdmin = claro_is_allowed_to_edit();
if (claro_is_in_a_group() && claro_is_group_allowed()) {
    // group context
    $groupId = (int) claro_get_current_group_id();
} elseif (claro_is_in_a_group() && !claro_is_group_allowed()) {
    claro_die(get_lang("Not allowed"));
} elseif (claro_is_course_allowed()) {
    // course context
    $groupId = 0;
} else {
    claro_disp_auth_form();
}
// require wiki files
require_once "lib/class.wiki.php";
require_once "lib/class.wikistore.php";
require_once "lib/class.wikipage.php";
require_once "lib/lib.requestfilter.php";
require_once "lib/lib.wikisql.php";
require_once "lib/lib.javascript.php";
require_once "lib/lib.wikidisplay.php";
$dialogBox = new DialogBox();
Example #17
0
}
/*
 * Init some other vars
 */
// user's course list
if ($canSwitchCourses) {
    // get all
    $userCourseList = get_user_course_list($userId, true);
    if (!is_array($userCourseList)) {
        $userCourseList = array();
    }
}
// user's data
$userData = user_get_properties($userId);
if (!is_array($userData)) {
    claro_die(get_lang('Cannot find user'));
}
// Command list
$cmdList = array();
if ($canSwitchCourses && count($userCourseList)) {
    $cmdList[] = array('name' => get_lang('View platform statistics'), 'url' => claro_htmlspecialchars('userReport.php?cidReset=true&userId=' . (int) $userId));
} else {
    $cmdList[] = array('img' => 'back', 'name' => get_lang('Back to user list'), 'url' => claro_htmlspecialchars(Url::Contextualize(get_path('url') . '/claroline/user/user.php')));
}
/*
 * Output
 */
CssLoader::getInstance()->load('tracking', 'screen');
$nameTools = get_lang('Statistics');
ClaroBreadCrumbs::getInstance()->setCurrent($nameTools, claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?userId=' . $userId)));
if ($canSwitchCourses && $selfStatistics) {
Example #18
0
}
$nameTools = get_lang('Create/edit document');
$out = '';
$out .= claro_html_tool_title(array('mainTitle' => get_lang('Documents and Links'), 'subTitle' => get_lang('Create/edit document')));
/*========================================================================
CREATE DOCUMENT
========================================================================*/
if ($cmd == 'rqMkHtml') {
    $out .= '<form action="' . claro_htmlspecialchars(get_module_entry_url('CLDOC')) . '" method="post">' . "\n" . claro_form_relay_context() . "\n" . '<input type="hidden" name="cmd" value="exMkHtml" />' . "\n" . '<input type="hidden" name="cwd" value="' . claro_htmlspecialchars(strip_tags($cwd)) . '" />' . "\n" . '<p>' . "\n" . '<b>' . get_lang('Document name') . '&nbsp;: </b><br />' . "\n" . '<input type="text" name="fileName" size="80" />' . "\n" . '</p>' . "\n" . '<p>' . "\n" . '<b>' . get_lang('Document content') . '&nbsp;: </b>' . "\n";
    if (!empty($_REQUEST['htmlContent'])) {
        $content = $_REQUEST['htmlContent'];
    } else {
        $content = "";
    }
    $out .= claro_html_textarea_editor('htmlContent', $content);
    // the second argument _REQUEST['htmlContent'] for the case when we have to
    // get to the editor because of an error at creation
    // (eg forgot to give a file name)
    $out .= '</p>' . "\n" . '<p>' . "\n" . '<input type="submit" value="' . get_lang('Ok') . '" />&nbsp;' . claro_html_button(claro_htmlspecialchars(Url::Contextualize('./document.php?cmd=exChDir&amp;file=' . strip_tags($cwd))), get_lang('Cancel')) . '</p>' . "\n" . '</form>' . "\n";
} elseif ($cmd == "rqEditHtml" && !empty($file)) {
    if (is_parent_path($baseWorkDir, $file)) {
        $fileContent = implode("\n", file($baseWorkDir . $file));
    } else {
        claro_die('WRONG PATH');
    }
    $fileContent = get_html_body_content($fileContent);
    $out .= '<form action="' . claro_htmlspecialchars(get_module_entry_url('CLDOC')) . '" method="post">' . "\n" . claro_form_relay_context() . "\n" . '<input type="hidden" name="cmd" value="exEditHtml" />' . "\n" . '<input type="hidden" name="file" value="' . claro_htmlspecialchars(base64_encode($file)) . '" />' . "\n" . '<b>' . get_lang('Document name') . ' : </b><br />' . "\n" . $file . "\n" . '</p>' . "\n" . '<p>' . "\n" . '<b>' . get_lang('Document content') . ' : </b>' . "\n" . claro_html_textarea_editor('htmlContent', $fileContent) . "\n" . '</p>' . '<p>' . '<input type="submit" value="' . get_lang('Ok') . '" />&nbsp;' . "\n" . claro_html_button(claro_htmlspecialchars(Url::Contextualize('./document.php?cmd=rqEdit&file=' . base64_encode($file))), get_lang('Cancel')) . "\n" . '</p>' . "\n" . '</form>' . "\n";
}
$out .= '<br />' . "\n" . '<br />' . "\n";
$claroline->display->body->appendContent($out);
echo $claroline->display->render();
Example #19
0
 *
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 *
 * @author Sebastien Piraux <*****@*****.**>
 *
 * @package CLTRACK
 */
/*
 * Kernel
 */
require_once dirname(__FILE__) . '/../inc/claro_init_global.inc.php';
/*
 * Permissions
 */
if (!get_conf('is_trackingEnabled')) {
    claro_die(get_lang('Tracking has been disabled by system administrator.'));
}
if (!claro_is_user_authenticated() || !claro_is_in_a_course()) {
    claro_disp_auth_form(true);
}
/*
 * Libraries
 */
require_once get_path('incRepositorySys') . '/lib/statsUtils.lib.inc.php';
/*
 * DB tables definition
 */
$tbl_cdb_names = claro_sql_get_course_tbl(claro_get_course_db_name_glued(claro_get_current_course_id()));
$tbl_course_tracking_event = $tbl_cdb_names['tracking_event'];
/*
 * Input
Example #20
0
                     if ($activableOnlyByPlatformAdmin) {
                         if (allow_module_activation_by_course_manager($moduleInfo['label'], false)) {
                             $dialogBox->success(get_lang('Only PLATFORM_ADMIN can activate this module'));
                         } else {
                             $dialogBox->error(get_lang('Cannot change module activation on course creation'));
                         }
                     }
                 }
             } else {
                 $dialogBox->error(get_lang('Module installation failed'));
             }
         }
     } else {
         $summary = get_lang('Module upload failed');
         $details = 'No file uploaded';
         claro_die(Backlog_Reporter::report($summary, $details));
     }
     break;
 case 'rqInstall':
     /**
      * Check input possibilities
      *
      *
      */
     $inputPackage = array();
     if (get_conf('can_install_local_module', false)) {
         $inputPackage[] = 'local';
     }
     if (get_conf('can_install_upload_module', true)) {
         $inputPackage[] = 'upload';
     }
Example #21
0
}
require_once get_path('incRepositorySys') . '/lib/course_user.lib.php';
include claro_get_conf_repository() . 'user_profile.conf.php';
// find this file to modify values.
// used tables
$tbl_mdb_names = claro_sql_get_main_tbl();
// deal with session variables (must unset variables if come back from enroll script)
unset($_SESSION['userEdit']);
$nameTools = get_lang('User course settings');
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb'));
// see which user we are working with ...
if (isset($_REQUEST['uidToEdit']) && isset($_REQUEST['cidToEdit'])) {
    $uidToEdit = $_REQUEST['uidToEdit'];
    $cidToEdit = $_REQUEST['cidToEdit'];
} else {
    claro_die('Missing parameters');
}
$dialogBox = new DialogBox();
//------------------------------------
// Execute COMMAND section
//------------------------------------
//Display "form and info" about the user
$ccfrom = isset($_REQUEST['ccfrom']) ? $_REQUEST['ccfrom'] : '';
$cfrom = isset($_REQUEST['cfrom']) ? $_REQUEST['cfrom'] : '';
$cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null;
switch ($cmd) {
    case 'exUpdateCourseUserProperties':
        if (isset($_REQUEST['profileId'])) {
            $properties['profileId'] = $_REQUEST['profileId'];
        }
        if (isset($_REQUEST['isTutor'])) {
Example #22
0
//----------------------------------------------------------------------
// Copyright (c) 2001-2006 Universite catholique de Louvain (UCL)
//----------------------------------------------------------------------
// This program is under the terms of the GENERAL PUBLIC LICENSE (GPL)
// as published by the FREE SOFTWARE FOUNDATION. The GPL is available
// through the world-wide-web at http://www.gnu.org/copyleft/gpl.html
//----------------------------------------------------------------------
// Authors: see 'credits' file
//----------------------------------------------------------------------
require '../../../../inc/claro_init_global.inc.php';
// Security check
if (!claro_is_user_authenticated()) {
    claro_disp_auth_form();
}
if (!claro_is_platform_admin()) {
    claro_die(get_lang('Not allowed'));
}
set_time_limit(0);
/*
 * This script scans and retrieves all the language variables of an existing Claroline
 */
// include configuration and library file
include 'language.conf.php';
require_once 'language.lib.php';
require_once get_path('incRepositorySys') . '/lib/config.lib.inc.php';
// table
$tbl_used_lang = '`' . $mainDbName . '`.`' . $mainTblPrefix . TABLE_USED_LANG_VAR . '`';
// get start time
$starttime = get_time();
// Start content
$nameTools = 'Extract variables from installation script';
Example #23
0
            $dialogBox->info(get_lang('Invalid date'));
            $content .= $dialogBox->render();
        }
    }
    // -------- delete platform message
    if ('rqPlatformMessage' == $_REQUEST['cmd']) {
        $subTitle = get_lang('Delete platform messages');
        $displayRemovePlatformMessageConfirmation = TRUE;
    } elseif ('exPlatformMessage' == $_REQUEST['cmd']) {
        $subTitle = get_lang('Delete platform messages');
        $box = new AdminMessageBox();
        $box->deletePlatformMessage();
        $displayRemovePlatformMessageValidated = TRUE;
    }
} else {
    claro_die(get_lang('Missing command'));
}
// ----------- delete all --------------
if ($displayRemoveAllConfirmation) {
    $dialogBox = new DialogBox();
    $dialogBox->question(get_lang('Are you sure to delete all messages?'));
    $dialogBox->warning(get_lang('There is no way to restore deleted messages.'));
    $dialogBox->info('<br /><br />' . '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=exDeleteAll">' . get_lang('Yes') . '</a> | <a href="admin.php">' . get_lang('No') . '</a>');
    $dialogBox->setBoxType('question');
    $content .= '<br />' . $dialogBox->render();
}
if ($displayRemoveAllValidated) {
    $dialogBoxMsg = get_lang('All messages have been deleted') . '<br /><br />' . '<a href="admin.php">' . get_lang('Back') . '</a>';
    $dialogBox = new DialogBox();
    $dialogBox->success($dialogBoxMsg);
    $content .= '<br />' . $dialogBox->render();
Example #24
0
 function add_sort_key($key, $direction)
 {
     if ($this->resultList) {
         claro_die('add_sort_key() IMPOSSIBLE : SORT ALREADY PROCESSED.');
     }
     if (!array_key_exists($key, $this->sortKeyList)) {
         $this->sortKeyList[$key] = $direction;
         return true;
     }
     return false;
 }
Example #25
0
                    } else {
                        //No context to load
                    }
                } elseif ($_REQUEST['typeRecipient'] == 'course') {
                    $recipient = new CourseRecipient($_POST['courseRecipient']);
                    $message->setCourse($_POST['courseRecipient']);
                } elseif ($_REQUEST['typeRecipient'] == 'all') {
                    $recipient = new AllUsersRecipient();
                    // breadcrump
                    $claroline->display->banner->breadcrumbs->append(get_lang('Administration'), get_path('rootAdminWeb'));
                } elseif ($_REQUEST['typeRecipient'] == 'group') {
                    $recipient = new GroupRecipient($_POST['groupRecipient'], $_POST['courseRecipient']);
                    $message->setCourse($_POST['courseRecipient']);
                    $message->setGroup($_POST['groupRecipient']);
                } else {
                    claro_die(get_lang('unknow recipient type'));
                }
                $recipient->sendMessage($message);
                $informationString = get_lang('Message sent') . '<br /><br />' . '<a href="messagebox.php?box=inbox">' . get_lang('Back to inbox') . '</a>';
                $dialogbox = new DialogBox();
                $dialogbox->info($informationString);
                if ($failure = claro_failure::get_last_failure()) {
                    $dialogbox->warning($failure);
                }
                $content .= $dialogbox->render();
            }
        }
    }
}
// ------------ Prepare display --------------------
if ($addForm) {