Beispiel #1
0
 protected function isDocumentDownloadableInCourse($requestedUrl)
 {
     if (claro_is_in_a_group()) {
         $groupContext = true;
         $courseContext = false;
         $is_allowedToEdit = claro_is_group_member() || claro_is_group_tutor() || claro_is_course_manager();
     } else {
         $groupContext = false;
         $courseContext = true;
         $is_allowedToEdit = claro_is_course_manager();
     }
     if ($courseContext) {
         $courseTblList = claro_sql_get_course_tbl();
         $tbl_document = $courseTblList['document'];
         if (strtoupper(substr(PHP_OS, 0, 3)) == "WIN") {
             $modifier = '';
         } else {
             $modifier = 'BINARY ';
         }
         $sql = "SELECT visibility\n                    FROM `{$tbl_document}`\n                    WHERE {$modifier} path = '" . claro_sql_escape($requestedUrl) . "'";
         $docVisibilityStatus = claro_sql_query_get_single_value($sql);
         if (!is_null($docVisibilityStatus) && $docVisibilityStatus == 'i' && !$is_allowedToEdit) {
             return false;
         } else {
             return true;
         }
     } else {
         // ????
     }
 }
Beispiel #2
0
 protected function isModuleAllowed()
 {
     $moduleData = get_module_data($this->moduleLabel);
     if ($moduleData['type'] == 'tool') {
         $contextList = get_module_context_list($this->moduleLabel);
         if (claro_is_in_a_course()) {
             $_mainToolId = get_tool_id_from_module_label($this->moduleLabel);
             $_profileId = claro_get_current_user_profile_id_in_course();
             $_cid = claro_get_current_course_id();
             if (claro_is_in_a_group()) {
                 $_groupProperties = claro_get_main_group_properties(claro_get_current_course_id());
                 $_mainToolId = get_tool_id_from_module_label('CLGRP');
                 $is_toolAllowed = array_key_exists($this->moduleLabel, $_groupProperties['tools']) && $_groupProperties['tools'][$this->moduleLabel] && claro_is_allowed_tool_read($_mainToolId, $_profileId, $_cid);
                 if ($_groupProperties['private']) {
                     $is_toolAllowed = $is_toolAllowed && (claro_is_group_member() || claro_is_group_tutor());
                 }
                 $is_toolAllowed = $is_toolAllowed || (claro_is_course_manager() || claro_is_platform_admin());
             } else {
                 // we ignore course visibility
                 if (!claro_is_allowed_tool_edit($_mainToolId, $_profileId, $_cid) && !claro_is_allowed_tool_read($_mainToolId, $_profileId, $_cid)) {
                     $is_toolAllowed = false;
                 } else {
                     $is_toolAllowed = true;
                 }
             }
         } else {
             if (in_array('platform', iterator_to_array($contextList))) {
                 $is_toolAllowed = get_module_data($this->moduleLabel, 'activation') == 'activated';
             } else {
                 $is_toolAllowed = false;
             }
         }
         return $is_toolAllowed;
     } else {
         // if an applet "tool", return true if activated
         // and let module manage it's access by itself
         return $moduleData['activation'] == 'activated';
     }
 }
Beispiel #3
0
} else {
    $_groupUser = !empty($_SESSION['_groupUser']) ? $_SESSION['_groupUser'] : null;
    $is_groupMember = !empty($_SESSION['is_groupMember']) ? $_SESSION['is_groupMember'] : null;
    $is_groupTutor = !empty($_SESSION['is_groupTutor']) ? $_SESSION['is_groupTutor'] : null;
    $is_groupAllowed = !empty($_SESSION['is_groupAllowed']) ? $_SESSION['is_groupAllowed'] : null;
}
/*---------------------------------------------------------------------------
  COURSE TOOL / USER / GROUP REL. INIT
 ---------------------------------------------------------------------------*/
if ($uidReset || $cidReset || $gidReset || $tidReset) {
    if ($_tid && $_gid) {
        //echo 'passed here';
        $toolLabel = trim($_courseTool['label'], '_');
        $is_toolAllowed = array_key_exists($toolLabel, $_groupProperties['tools']) && $_groupProperties['tools'][$toolLabel] && claro_is_allowed_tool_read(get_tool_id_from_module_label('CLGRP'), $_profileId, $_cid);
        if ($_groupProperties['private']) {
            $is_toolAllowed = $is_toolAllowed && ($is_groupMember || claro_is_group_tutor());
        }
        $is_toolAllowed = $is_toolAllowed || ($is_courseAdmin || $is_platformAdmin);
    } elseif ($_tid) {
        if (!$_courseTool['visibility'] && !claro_is_allowed_tool_edit($_mainToolId, $_profileId, $_cid) || !claro_is_allowed_tool_read($_mainToolId, $_profileId, $_cid)) {
            $is_toolAllowed = false;
        } else {
            $is_toolAllowed = true;
        }
    } else {
        $is_toolAllowed = false;
    }
} else {
    $is_toolAllowed = !empty($_SESSION['is_toolAllowed']) ? $_SESSION['is_toolAllowed'] : null;
}
/*---------------------------------------------------------------------------
Beispiel #4
0
// (needed to give or refuse selfreg right)
$groupMemberCount = group_count_students_in_group(claro_get_current_group_id());
$groupMemberQuotaExceeded = (bool) (!is_null(claro_get_current_group_data('maxMember')) && claro_get_current_group_data('maxMember') <= $groupMemberCount);
// no limit assign to group per user;
$userGroupRegCount = group_count_group_of_a_user(claro_get_current_user_id());
// The previous request compute the quantity of subscription for the current user.
// the following request compare with the quota of subscription allowed to each student
$userGroupQuotaExceeded = (bool) ($_groupProperties['nbGroupPerUser'] <= $userGroupRegCount && !is_null($_groupProperties['nbGroupPerUser']) && $_groupProperties['nbGroupPerUser'] != 'ALL');
// no limit assign to group per user;
$is_allowedToSelfRegInGroup = (bool) ($_groupProperties['registrationAllowed'] && !$groupMemberQuotaExceeded && !$userGroupQuotaExceeded && (!claro_is_course_tutor() || claro_is_course_tutor() && get_conf('tutorCanBeSimpleMemberOfOthersGroupsAsStudent')));
$is_allowedToSelfRegInGroup = (bool) $is_allowedToSelfRegInGroup && claro_is_in_a_course() && !claro_is_group_member() && claro_is_course_member();
$is_allowedToSelfUnregInGroup = (bool) $_groupProperties['unregistrationAllowed'] && claro_is_in_a_course() && claro_is_group_member() && claro_is_course_member();
$is_allowedToDocAccess = (bool) (claro_is_course_manager() || claro_is_group_member() || claro_is_group_tutor());
$is_allowedToChatAccess = (bool) (claro_is_course_manager() || claro_is_group_member() || claro_is_group_tutor());
$isTutorRegAllowed = ($is_allowedToManage || $_groupProperties['tutorRegistrationAllowed']) && !claro_is_group_member() && !claro_is_group_tutor() && claro_is_course_tutor() && !claro_get_current_group_data('tutorId');
$isTutorUnregAllowed = ($is_allowedToManage || $_groupProperties['tutorRegistrationAllowed']) && claro_is_group_tutor();
/**
 * SELF-REGISTRATION PROCESS
 */
if (isset($_REQUEST['registration'])) {
    //RECHECK if subscribe is aivailable
    if (claro_is_course_member() && !claro_is_group_member() && $is_allowedToSelfRegInGroup) {
        if (isset($_REQUEST['doReg'])) {
            //RECHECK if subscribe is aivailable
            if (claro_is_course_member() && !claro_is_group_member() && $is_allowedToSelfRegInGroup) {
                $sql = "INSERT INTO `" . $tbl_group_rel_team_user . "`\n                SET `user` = " . (int) claro_get_current_user_id() . ",\n                    `team` = " . (int) claro_get_current_group_id();
                if (claro_sql_query($sql)) {
                    // REFRESH THE SCRIPT TO COMPUTE NEW PERMISSIONS ON THE BASSIS OF THIS CHANGE
                    claro_redirect($_SERVER['PHP_SELF'] . '?gidReset=1&gidReq=' . claro_get_current_group_id() . '&regDone=1');
                    exit;
                }
Beispiel #5
0
 *              GNU GENERAL PUBLIC LICENSE version 2 or later
 * @package     CLFRM
 */
$tlabelReq = 'CLFRM';
//load claroline kernel
require_once dirname(__FILE__) . '/../../claroline/inc/claro_init_global.inc.php';
//security check
if (!claro_is_in_a_course() || !claro_is_course_allowed()) {
    claro_disp_auth_form(true);
}
//load required libraries
require_once get_path('incRepositorySys') . '/lib/forum.lib.php';
require_once get_path('incRepositorySys') . '/lib/user.lib.php';
//init general purpose vars
claro_set_display_mode_available(true);
$is_allowedToEdit = claro_is_allowed_to_edit() || claro_is_group_tutor() && !claro_is_course_manager();
$dialogBox = new DialogBox();
//handle user input and possible associated exceptions
try {
    $userInput = Claro_UserInput::getInstance();
    if ($is_allowedToEdit) {
        $userInput->setValidator('cmd', new Claro_Validator_AllowedList(array('rqPost', 'exSavePost', 'exDelete', 'show', 'exNotify', 'exdoNotNotify')));
        $userInput->setValidator('mode', new Claro_Validator_AllowedList(array('add', 'edit', 'reply', 'quote')));
        $userInput->setValidator('mode', new Claro_Validator_NotEmpty());
    } else {
        $userInput->setValidator('cmd', new Claro_Validator_AllowedList(array('rqPost', 'exSavePost', 'show', 'exNotify', 'exdoNotNotify')));
        $userInput->setValidator('mode', new Claro_Validator_AllowedList(array('add', 'reply', 'quote')));
        $userInput->setValidator('mode', new Claro_Validator_NotEmpty());
    }
    $userInput->setValidator('forum', new Claro_Validator_ValueType('numeric'));
    $userInput->setValidator('forum', new Claro_Validator_NotEmpty());
Beispiel #6
0
  = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
$baseServDir = get_path('coursesRepositorySys');
$baseServUrl = get_path('url') . '/';
$dialogBox = new DialogBox();
/*
 * The following variables depends on the use context
 * The document tool can be used at course or group level
 * (one document area for each group)
 */
if (claro_is_in_a_group() && claro_is_group_allowed()) {
    $_group = claro_get_current_group_data();
    $groupContext = true;
    $courseContext = false;
    $maxFilledSpace = get_conf('maxFilledSpace_for_groups');
    $courseDir = claro_get_course_path() . '/group/' . claro_get_current_group_data('directory');
    $is_allowedToEdit = claro_is_group_member() || claro_is_group_tutor() || claro_is_course_manager();
    $is_allowedToUnzip = false;
    if (!claro_is_group_allowed()) {
        die('<center>You are not allowed to see this group\'s documents!!!</center>');
    }
} else {
    $groupContext = false;
    $courseContext = true;
    $courseDir = claro_get_course_path() . '/document';
    // initialise view mode tool
    claro_set_display_mode_available(true);
    $is_allowedToEdit = claro_is_allowed_to_edit();
    $is_allowedToUnzip = claro_is_allowed_to_edit();
    $maxFilledSpace = get_conf('maxFilledSpace_for_course');
    // table names for learning path (needed to check integrity)
    /*
Beispiel #7
0
// THIS FILE IS STORED IN THE COURSE DIRECTORY
$curChatRep = $coursePath . '/chat/';
// IN CASE OF AN UPGRADE THE DIRECTORY MAY NOT EXIST
// A PREVIOUS CHECK (AND CREATE IF NEEDED) IS THUS NECESSARY
if (!is_dir($curChatRep)) {
    mkdir($curChatRep, CLARO_FILE_PERMISSIONS);
}
// DETERMINE IF THE CHAT SYSTEM WILL WORK
// EITHER AT THE COURSE LEVEL OR THE GROUP LEVEL
if (claro_is_in_a_group()) {
    if (claro_is_group_allowed()) {
        $groupContext = TRUE;
        $courseContext = FALSE;
        $is_allowedToManage = $is_allowedToManage || claro_is_group_tutor();
        $is_allowedToStore = $is_allowedToStore || claro_is_group_tutor();
        $is_allowedToReset = $is_allowedToReset || claro_is_group_tutor();
        $activeChatFile = $curChatRep . $courseId . '.' . $groupId . '.chat.html';
        $onflySaveFile = $curChatRep . $courseId . '.' . $groupId . '.tmpChatArchive.html';
        $exportFile = $coursePath . '/group/' . claro_get_current_group_data('directory') . '/';
    } else {
        die('<center>' . get_lang('You are not a member of this group') . '</center>');
    }
} else {
    $groupContext = FALSE;
    $courseContext = TRUE;
    $activeChatFile = $curChatRep . $courseId . '.chat.html';
    $onflySaveFile = $curChatRep . $courseId . '.tmpChatArchive.html';
    $exportFile = $coursePath . '/document/';
}
$dateNow = claro_html_localised_date(get_locale('dateTimeFormatLong'));
$timeNow = claro_html_localised_date('[%d/%m/%y %H:%M]');
Beispiel #8
0
 *
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 *
 * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 *
 * @see http://www.claroline.net/wiki/index.php/CLCHT
 *
 * @package CLCHT
 *
 * @author Claro Team <*****@*****.**>
 * @author Christophe Gesché <*****@*****.**>
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 *
 */
require '../inc/claro_init_global.inc.php';
$is_allowedToManage = claro_is_course_manager() || claro_is_in_a_group() && claro_is_group_tutor();
// header
$htmlHeadXtra[] = '
<script type="text/javascript">
function prepare_message()
{
    document.chatForm.chatLine.value=document.chatForm.msg.value;
    document.chatForm.msg.value = "";
    document.chatForm.msg.focus();
    return true;
}
</script>';
$cmdMenu = array();
if ($is_allowedToManage) {
    $cmdMenu[] = claro_html_cmd_link('messageList.php?cmd=reset' . claro_url_relay_context('&amp;'), get_lang('Reset'), array('target' => "messageList"));
    $cmdMenu[] = claro_html_cmd_link('messageList.php?cmd=store' . claro_url_relay_context('&amp;'), get_lang('Store Chat'), array('target' => "messageList"));
Beispiel #9
0
function printInit($selection = "*")
{
    global $uidReset, $cidReset, $gidReset, $tidReset, $uidReq, $cidReq, $gidReq, $tidReq, $tlabelReq, $_user, $_course, $_groupUser, $_courseTool, $_SESSION, $_claro_local_run;
    if ($_claro_local_run) {
        echo "local init runned";
    } else {
        echo '<font color="red"> local init never runned during this script </font>';
    }
    echo '
<table width="100%" border="1" cellspacing="4" cellpadding="1" bordercolor="#808080" bgcolor="#C0C0C0" lang="en">
    <TR>';
    if ($selection == "*" or strstr($selection, "u")) {
        echo '
        <TD valign="top" >
            <strong>User</strong> :
            (_uid)             : ' . var_export(claro_get_current_user_id(), 1) . ' |
            (session[_uid]) : ' . var_export($_SESSION["_uid"], 1) . '
            <br />
            reset = ' . var_export($uidReset, 1) . ' |
            req = ' . var_export($uidReq, 1) . '<br />
            _user : <pre>' . var_export($_user, 1) . '</pre>
            <br />is_platformAdmin            :' . var_export(claro_is_platform_admin(), 1) . '
            <br />is_allowedCreateCourse    :' . var_export(claro_is_allowed_to_create_course(), 1) . '
        </TD>';
    }
    if ($selection == "*" or strstr($selection, "c")) {
        echo "\n        <TD valign=\"top\" >\n            <strong>Course</strong> : (_cid)" . var_export(claro_get_current_course_id(), 1) . "\n            <br />\n            reset = " . var_export($cidReset, 1) . " | req = " . var_export($cidReq, 1) . "\n            <br />\n            _course : <pre>" . var_export($_course, 1) . "</pre>\n            <br />\n            _groupProperties :\n            <PRE>\n                " . var_export(claro_get_current_group_properties_data(), 1) . "\n            </PRE>\n        </TD>";
    }
    echo '
    </TR>
    <TR>';
    if ($selection == "*" or strstr($selection, "g")) {
        echo '<TD valign="top" ><strong>Group</strong> : (_gid) ' . var_export(claro_get_current_group_id(), 1) . '<br />
        reset = ' . var_export($GLOBALS['gidReset'], 1) . ' | req = ' . var_export($gidReq, 1) . "<br />\n        _group :<pre>" . var_export(claro_get_current_group_data(), 1) . "</pre></TD>";
    }
    if ($selection == "*" or strstr($selection, "t")) {
        echo '<TD valign="top" ><strong>Tool</strong> : (_tid)' . var_export(claro_get_current_tool_id(), 1) . '<br />
        reset = ' . var_export($tidReset, 1) . ' |
        req = ' . var_export($tidReq, 1) . '|
        req = ' . var_export($tlabelReq, 1) . '
        <br />
        _tool :' . var_export(get_init('_tool'), 1) . "</TD>";
    }
    echo "</TR>";
    if ($selection == "*" or strstr($selection, "u") && strstr($selection, "c")) {
        echo '<TR><TD valign="top" colspan="2"><strong>Course-User</strong>';
        if (claro_is_user_authenticated()) {
            echo '<br /><strong>User</strong> :' . var_export(claro_is_in_a_course(), 1);
        }
        if (claro_is_in_a_course()) {
            echo ' in ' . var_export(claro_get_current_course_id(), 1) . '<br />';
        }
        if (claro_is_user_authenticated() && claro_get_current_course_id()) {
            echo '_courseUser            : <pre>' . var_export(getInit('_courseUser'), 1) . '</pre>';
        }
        echo '<br />is_courseMember    : ' . var_export(claro_is_course_member(), 1);
        echo '<br />is_courseAdmin    : ' . var_export(claro_is_course_manager(), 1);
        echo '<br />is_courseAllowed    : ' . var_export(claro_is_course_allowed(), 1);
        echo '<br />is_courseTutor    : ' . var_export(claro_is_course_tutor(), 1);
        echo '</TD></TR>';
    }
    echo "";
    if ($selection == "*" or strstr($selection, "u") && strstr($selection, "g")) {
        echo '<TR><TD valign="top"  colspan="2">' . '<strong>Course-Group-User</strong>';
        if (claro_is_user_authenticated()) {
            echo '<br /><strong>User</strong> :' . var_export(claro_is_in_a_course(), 1);
        }
        if (claro_is_in_a_group()) {
            echo ' in ' . var_export(claro_get_current_group_id(), 1);
        }
        if (claro_is_in_a_group()) {
            echo '<br />_groupUser:'******'_groupUser'), 1);
        }
        echo '<br />is_groupMember:' . var_export(claro_is_group_member(), 1) . '<br />is_groupTutor: ' . var_export(claro_is_group_tutor(), 1) . '<br />is_groupAllowed:' . var_export(claro_is_group_allowed(), 1) . '</TD>' . '</tr>';
    }
    if ($selection == "*" or strstr($selection, "c") && strstr($selection, "t")) {
        echo '<tr>
        <TD valign="top" colspan="2" ><strong>Course-Tool</strong><br />';
        if (claro_get_current_tool_id()) {
            echo 'Tool :' . claro_get_current_tool_id();
        }
        if (claro_is_in_a_course()) {
            echo ' in ' . claro_get_current_course_id() . '<br />';
        }
        if (claro_get_current_tool_id()) {
            echo "_courseTool    : <pre>" . var_export($_courseTool, 1) . '</pre><br />';
        }
        echo 'is_toolAllowed : ' . var_export(claro_is_tool_allowed(), 1);
        echo "</TD>";
    }
    echo "</TR></TABLE>";
}
Beispiel #10
0
require_once '../inc/claro_init_global.inc.php';
if (!claro_is_tool_allowed()) {
    if (!claro_is_in_a_course()) {
        claro_die(get_lang("Not allowed"));
    } else {
        claro_disp_auth_form(true);
    }
}
// check and set user access level for the tool
if (!isset($_REQUEST['wikiId'])) {
    claro_redirect(Url::Contextualize("wiki.php"));
    exit;
}
// set admin mode and groupId
claro_set_display_mode_available(TRUE);
$is_allowedToAdmin = claro_is_allowed_to_edit() || claro_is_in_a_group() && claro_is_group_tutor();
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();
}
// Wiki specific classes and libraries
require_once "lib/class.wiki2xhtmlrenderer.php";
require_once "lib/class.wikipage.php";
require_once "lib/class.wikistore.php";
Beispiel #11
0
/**
 * return the autorisation of the current user to send a message to the current group
 *
 * @return bool true if the current user is autorised do send a message to the current group
 *                 false if the current user is not autorised do send a message to the current group
 */
function current_user_is_allowed_to_send_message_to_current_group()
{
    if (claro_is_platform_admin()) {
        return true;
    }
    if (claro_is_group_tutor() || claro_is_course_admin()) {
        return true;
    }
    return false;
}