Пример #1
0
 public function isAllowedToDownload($requestedUrl)
 {
     if (!$this->isModuleAllowed()) {
         return false;
     }
     if (claro_is_in_a_course()) {
         if (!claro_is_course_allowed()) {
             pushClaroMessage('course not allowed', 'debug');
             return false;
         } else {
             if (claro_is_in_a_group()) {
                 if (!claro_is_group_allowed()) {
                     pushClaroMessage('group not allowed', 'debug');
                     return false;
                 } else {
                     return true;
                 }
             } else {
                 return $this->isDocumentDownloadableInCourse($requestedUrl);
             }
         }
     } else {
         return false;
     }
 }
Пример #2
0
 /**
  * Get the given context array formated for use in urls
  * @param array $givenContext
  * @return array
  */
 public static function getUrlContext($givenContext)
 {
     $context = array();
     if (claro_is_in_a_group() && !isset($givenContext[CLARO_CONTEXT_GROUP]) || isset($givenContext[CLARO_CONTEXT_GROUP])) {
         $context['gidReset'] = 'true';
     }
     if (claro_is_in_a_course() && !isset($givenContext[CLARO_CONTEXT_COURSE]) || isset($givenContext[CLARO_CONTEXT_COURSE])) {
         $context['cidReset'] = 'true';
     }
     if (isset($givenContext[CLARO_CONTEXT_COURSE])) {
         $context['cidReq'] = $givenContext[CLARO_CONTEXT_COURSE];
     }
     if (isset($givenContext[CLARO_CONTEXT_GROUP])) {
         $context['gidReq'] = $givenContext[CLARO_CONTEXT_GROUP];
     }
     if (isset($_REQUEST['inPopup'])) {
         $context['inPopup'] = $_REQUEST['inPopup'];
     }
     if (isset($_REQUEST['inFrame'])) {
         $context['inFrame'] = $_REQUEST['inFrame'];
     }
     if (isset($_REQUEST['embedded'])) {
         $context['embedded'] = $_REQUEST['embedded'];
     }
     if (isset($_REQUEST['hide_banner'])) {
         $context['hide_banner'] = $_REQUEST['hide_banner'];
     }
     if (isset($_REQUEST['hide_footer'])) {
         $context['hide_footer'] = $_REQUEST['hide_footer'];
     }
     if (isset($_REQUEST['hide_body'])) {
         $context['hide_body'] = $_REQUEST['hide_body'];
     }
     if ($moduleLabel = claro_called_from()) {
         $context['calledFrom'] = $moduleLabel;
     }
     return $context;
 }
Пример #3
0
/**
 * return the autorisation of the current user to send a message to the user in parameter
 *
 * @param int $userId user id of the recipient
 * @return bool true if the current user is autorised do send a message to the user in parameter
 *                 flase if the current user is not autorised do send a message to the user in parameter
 */
function current_user_is_allowed_to_send_message_to_user($userId)
{
    if (claro_is_platform_admin()) {
        return true;
    }
    if (claro_is_in_a_group()) {
        if (claro_is_group_tutor() || claro_is_course_manager()) {
            $userList = get_group_user_list(claro_get_current_group_id(), claro_get_current_course_id());
            for ($count = 0; $count < count($userList); $count++) {
                if ($userList[$count]['id'] == $userId) {
                    return true;
                }
            }
        }
        return false;
    } elseif (claro_is_in_a_course()) {
        if (claro_is_course_manager()) {
            $userList = claro_get_course_user_list();
            for ($count = 0; $count < count($userList); $count++) {
                if ($userList[$count]['user_id'] == $userId) {
                    return true;
                }
            }
        }
        return false;
    } else {
        // can answerd to a user
        $tableName = get_module_main_tbl(array('im_message', 'im_recipient'));
        $select = "SELECT count(*)\n" . " FROM `" . $tableName['im_message'] . "` as M\n" . " INNER JOIN `" . $tableName['im_recipient'] . "` as R ON R.message_id = M.message_id\n" . " WHERE (R.user_id = " . (int) claro_get_current_user_id() . " OR R.user_id = 0)\n" . " AND M.sender = " . (int) $userId;
        $nbMessage = claro_sql_query_fetch_single_value($select);
        if ($nbMessage > 0) {
            return true;
        } elseif (get_conf('userCanSendMessage')) {
        }
        return true;
        return false;
    }
}
Пример #4
0
 public function event($type, $args = null)
 {
     if (!is_array($args)) {
         $args = array();
     }
     if (!array_key_exists('cid', $args) && claro_is_in_a_course()) {
         $args['cid'] = claro_get_current_course_id();
     }
     if (!array_key_exists('gid', $args) && claro_is_in_a_group()) {
         $args['gid'] = claro_get_current_group_id();
     }
     if (!array_key_exists('tid', $args) && claro_is_in_a_tool()) {
         $args['tid'] = claro_get_current_tool_id();
         // $args['tlabel'] = get_current_module_label();
     }
     if (!array_key_exists('uid', $args) && claro_is_user_authenticated()) {
         $args['uid'] = claro_get_current_user_id();
     }
     if (!array_key_exists('date', $args)) {
         $args['date'] = claro_date("Y-m-d H:i:00");
     }
     $this->notifyEvent($type, $args);
 }
Пример #5
0
 /**
  * @param   string $template name of the template
  */
 public function __construct($template)
 {
     $template = secure_file_path($template);
     $customTemplatePath = get_path('rootSys') . '/platform/templates/' . $template;
     $defaultTemplatePath = get_path('includePath') . '/templates/' . $template;
     if (file_exists($customTemplatePath)) {
         parent::__construct($customTemplatePath);
     } elseif (file_exists($defaultTemplatePath)) {
         parent::__construct($defaultTemplatePath);
     } else {
         throw new Exception("Template not found {$template} " . "at custom location {$customTemplatePath} " . "or default location {$defaultTemplatePath} !");
     }
     if (claro_is_in_a_course()) {
         $this->course = claro_get_current_course_data();
         require_once dirname(__FILE__) . '/../claroCourse.class.php';
         $this->courseObject = new ClaroCourse();
         $this->courseObject->load(claro_get_current_course_id());
         // Fetch related courses
         $this->relatedCourses = $this->courseObject->getRelatedCourses();
         // $this->relatedUserCourses = $this->courseObject->getRelatedUserCourses(claro_get_current_user_id());
         if (claro_is_in_a_group()) {
             $this->group = claro_get_current_group_data();
         }
     }
     if (claro_is_user_authenticated()) {
         $this->user = claro_get_current_user_data();
     }
 }
Пример #6
0
/**
 * Return the breadcrumb to display in the header
 *
 * @global string  $nameTools
 * @global array   $interbredcrump
 * @global boolean $noPHP_SELF
 * @global boolean $noQUERY_STRING
 *
 * @return string html content
 */
function claro_html_breadcrumb()
{
    // dirty global to keep value (waiting a refactoring)
    global $nameTools, $interbredcrump, $noPHP_SELF, $noQUERY_STRING;
    /******************************************************************************
       BREADCRUMB LINE
       ******************************************************************************/
    $htmlBC = '';
    if (claro_is_in_a_course() || isset($nameTools) || isset($interbredcrump) && is_array($interbredcrump)) {
        $htmlBC .= '<div id="breadcrumbLine">' . "\n\n" . '<hr />' . "\n";
        $breadcrumbUrlList = array();
        $breadcrumbNameList = array();
        $breadcrumbUrlList[] = get_path('url') . '/index.php';
        $breadcrumbNameList[] = get_conf('siteName');
        if (claro_is_in_a_course()) {
            $breadcrumbUrlList[] = get_path('clarolineRepositoryWeb') . 'course/index.php?cid=' . claro_htmlspecialchars(claro_get_current_course_id());
            $breadcrumbNameList[] = claro_get_current_course_data('officialCode');
        }
        if (claro_is_in_a_group()) {
            $breadcrumbUrlList[] = get_module_url('CLGRP') . '/index.php?cidReq=' . claro_htmlspecialchars(claro_get_current_course_id());
            $breadcrumbNameList[] = get_lang('Groups');
            $breadcrumbUrlList[] = get_module_url('CLGRP') . '/group_space.php?cidReq=' . claro_htmlspecialchars(claro_get_current_course_id()) . '&gidReq=' . (int) claro_get_current_group_id();
            $breadcrumbNameList[] = claro_get_current_group_data('name');
        }
        if (isset($interbredcrump) && is_array($interbredcrump)) {
            while (list(, $bredcrumpStep) = each($interbredcrump)) {
                $breadcrumbUrlList[] = $bredcrumpStep['url'];
                $breadcrumbNameList[] = $bredcrumpStep['name'];
            }
        }
        if (isset($nameTools)) {
            $breadcrumbNameList[] = $nameTools;
            if (isset($noPHP_SELF) && $noPHP_SELF) {
                $breadcrumbUrlList[] = null;
            } elseif (isset($noQUERY_STRING) && $noQUERY_STRING) {
                $breadcrumbUrlList[] = $_SERVER['PHP_SELF'];
            } else {
                // set Query string to empty if not exists
                if (!isset($_SERVER['QUERY_STRING'])) {
                    $_SERVER['QUERY_STRING'] = '';
                }
                $breadcrumbUrlList[] = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
            }
        }
        $htmlBC .= claro_html_breadcrumbtrail($breadcrumbNameList, $breadcrumbUrlList, ' &gt; ', get_icon_url('home'));
        if (!claro_is_user_authenticated()) {
            $htmlBC .= "\n" . '<div id="toolViewOption" style="padding-right:10px">' . '<a href="' . get_path('clarolineRepositoryWeb') . 'auth/login.php' . '?sourceUrl=' . urlencode(base64_encode((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) . '" target="_top">' . get_lang('Login') . '</a>' . '</div>' . "\n";
        } elseif (claro_is_in_a_course() && !claro_is_course_member() && claro_get_current_course_data('registrationAllowed') && !claro_is_platform_admin()) {
            $htmlBC .= '<div id="toolViewOption">' . '<a href="' . get_path('clarolineRepositoryWeb') . 'auth/courses.php?cmd=exReg&course=' . claro_get_current_course_id() . '">' . '<img src="' . get_icon_url('enroll') . '" alt="" /> ' . '<b>' . get_lang('Enrolment') . '</b>' . '</a>' . '</div>' . "\n";
        } elseif (claro_is_display_mode_available()) {
            $htmlBC .= "\n" . '<div id="toolViewOption">' . "\n";
            if (isset($_REQUEST['View mode'])) {
                $htmlBC .= claro_html_tool_view_option($_REQUEST['View mode']);
            } else {
                $htmlBC .= claro_html_tool_view_option();
            }
            if (claro_is_platform_admin() && !claro_is_course_member()) {
                $htmlBC .= ' | <a href="' . get_path('clarolineRepositoryWeb') . 'auth/courses.php?cmd=exReg&course=' . claro_get_current_course_id() . '">';
                $htmlBC .= '<img src="' . get_icon_url('enroll') . '" alt="" /> ';
                $htmlBC .= '<b>' . get_lang('Enrolment') . '</b>';
                $htmlBC .= '</a>';
            }
            $htmlBC .= "\n" . '</div>' . "\n";
        }
        $htmlBC .= '<div class="spacer"></div>' . "\n" . '<hr />' . "\n" . '</div>' . "\n";
    } else {
        // $htmlBC .= '<div style="height:1em"></div>';
    }
    return $htmlBC;
}
Пример #7
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"));
Пример #8
0
//  is added to give admin status to tutor
// && !claro_is_course_manager())
// is added  to let course admin, tutor of current group, use student mode
if (!claro_is_user_authenticated() || !claro_is_in_a_course()) {
    claro_disp_auth_form(true);
} elseif ($forumSettingList) {
    $forum_name = stripslashes($forumSettingList['forum_name']);
    $forum_post_allowed = $forumSettingList['forum_access'] != 0 ? true : false;
    $forum_type = $forumSettingList['forum_type'];
    $forum_groupId = $forumSettingList['idGroup'];
    $forum_cat_id = $forumSettingList['cat_id'];
    /*
     * Check if the topic isn't attached to a group,  or -- if it is attached --,
     * check the user is allowed to see the current group forum.
     */
    if (!$forum_post_allowed || !is_null($forumSettingList['idGroup']) && (!claro_is_in_a_group() || !claro_is_group_allowed() || $forumSettingList['idGroup'] != claro_get_current_group_id())) {
        // NOTE : $forumSettingList['idGroup'] != claro_get_current_group_id() is necessary to prevent any hacking
        // attempt like rewriting the request without $cidReq. If we are in group
        // forum and the group of the concerned forum isn't the same as the session
        // one, something weird is happening, indeed ...
        $allowed = FALSE;
        $dialogBox->error(get_lang('Not allowed'));
    } else {
        if (isset($_REQUEST['submit'])) {
            // Either valid user/pass, or valid session. continue with post.. but first:
            // Check that, if this is a private forum, the current user can post here.
            /*------------------------------------------------------------------------
                                        PREPARE THE DATA
              ------------------------------------------------------------------------*/
            // SUBJECT
            $subject = trim($subject);
Пример #9
0
 private function autoPrepend()
 {
     if (empty($this->currentNode) && array_key_exists('nameTools', $GLOBALS)) {
         $name = $GLOBALS['nameTools'];
         if (array_key_exists('noPHP_SELF', $GLOBALS) && $GLOBALS['noPHP_SELF']) {
             $url = null;
         } elseif (array_key_exists('noQUERY_STRING', $GLOBALS) && $GLOBALS['noQUERY_STRING']) {
             $url = $_SERVER['PHP_SELF'];
         } else {
             if (!array_key_exists('noQUERY_STRING', $_SERVER)) {
                 $url = $_SERVER['PHP_SELF'];
             } else {
                 $url = $_SERVER['PHP_SELF'] . '?' . claro_htmlspecialchars(strip_tags($_SERVER['QUERY_STRING']));
             }
         }
         $url = claro_htmlspecialchars(Url::Contextualize($url));
         $this->setCurrentNode(new BreadCrumbsNode($name, $url));
     }
     if (claro_is_in_a_group()) {
         $this->prependNode(new BreadCrumbsNode(claro_get_current_group_data('name'), claro_htmlspecialchars(get_module_url('CLGRP') . '/group_space.php?cidReq=' . claro_htmlspecialchars(claro_get_current_course_id()) . '&gidReq=' . (int) claro_get_current_group_id())));
         $this->prependNode(new BreadCrumbsNode(get_lang('Groups'), claro_htmlspecialchars(get_module_url('CLGRP') . '/index.php?cidReq=' . claro_htmlspecialchars(claro_get_current_course_id()))));
     }
     if (claro_is_in_a_course()) {
         $this->prependNode(new BreadCrumbsNode(claro_get_current_course_data('officialCode'), claro_htmlspecialchars(get_path('clarolineRepositoryWeb') . 'course/index.php?cid=' . claro_get_current_course_id())));
     }
     $this->prependNode(new BreadCrumbsNode(get_conf('siteName'), claro_htmlspecialchars(get_path('url') . '/index.php'), get_icon_url('home')));
 }
Пример #10
0
$cidNeeded = true;
$gidNeeded = true;
$tlabelReq = 'CLGRP';
require '../inc/claro_init_global.inc.php';
require_once get_path('incRepositorySys') . '/lib/group.lib.inc.php';
require_once dirname(__FILE__) . '/../messaging/lib/permission.lib.php';
$toolNameList = claro_get_tool_name_list();
$toolRepository = get_path('clarolineRepositoryWeb');
$dialogBox = new DialogBox();
if (!claro_is_in_a_course() || !claro_is_course_allowed()) {
    claro_disp_auth_form(true);
}
// block if !claro_is_in_a_group()
// accept  if claro_is_group_allowed()
if (!claro_is_allowed_to_edit()) {
    if (!claro_is_in_a_group()) {
        claro_redirect('group.php');
        exit;
    } elseif (!claro_is_group_allowed() && !(isset($_REQUEST['selfReg']) || isset($_REQUEST['doReg']))) {
        claro_redirect('group.php');
        exit;
    }
}
// use viewMode
claro_set_display_mode_available(true);
/********************
* CONNECTION SECTION
*********************/
$is_allowedToManage = claro_is_allowed_to_edit();
/*
* DB tables definition
Пример #11
0
 public function getCurrentLocator($params = array())
 {
     $locator = new ClarolineResourceLocator();
     if (claro_is_in_a_course()) {
         $locator->setCourseId(claro_get_current_course_id());
     }
     if (claro_is_in_a_group()) {
         $locator->setGroupId(claro_get_current_group_id());
     }
     if (get_current_module_label()) {
         $locator->setModuleLabel(get_current_module_label());
         $navigator = $this->loadModuleNavigator(get_current_module_label());
         if ($resourceId = $navigator->getResourceId($params)) {
             $locator->setResourceId($resourceId);
         }
     }
     return $locator;
 }
 /**
  * Check that the user has the privilege required to download the requested file
  * @param String $requestedUrl path of the requested file to test 
  * @return boolean true if the user can download the file
  */
 public function isAllowedToDownload($requestedUrl)
 {
     if (!$this->isModuleAllowed()) {
         return false;
     }
     if (!is_null($this->cid)) {
         $courseUserPrivilege = claro_get_course_user_privilege($this->cid, $this->uid);
         if (!$courseUserPrivilege['is_courseMember']) {
             pushClaroMessage('course not allowed', 'debug');
             return false;
         } else {
             if (claro_is_in_a_group()) {
                 if (!claro_is_group_allowed()) {
                     pushClaroMessage('group not allowed', 'debug');
                     return false;
                 } else {
                     return true;
                 }
             } else {
                 return $this->isDocumentDownloadableInCourse($requestedUrl);
             }
         }
     } else {
         return false;
     }
 }
Пример #13
0
 public function getFilePath($requestedUrl)
 {
     if (claro_is_in_a_course()) {
         $basePath = get_path('coursesRepositorySys') . claro_get_course_path(claro_get_current_course_id()) . '/' . $this->moduleLabel;
         if (claro_is_in_a_group()) {
             $basePath .= '/.group/' . claro_get_current_group_id();
         }
     } else {
         $basePath = get_path('rootSys') . 'platform/module_data/' . $this->moduleLabel;
     }
     return $basePath . '/' . $requestedUrl;
 }
Пример #14
0
function trig_topic_notification($topicId)
{
    $tbl_mdb_names = claro_sql_get_main_tbl();
    $tbl_course_user = $tbl_mdb_names['rel_course_user'];
    $tbl_cdb_names = claro_sql_get_course_tbl();
    $tbl_user_notify = $tbl_cdb_names['bb_rel_topic_userstonotify'];
    $sql = "SELECT\n                notif.user_id\n            FROM\n                `" . $tbl_user_notify . "` AS notif\n            JOIN\n                `" . $tbl_course_user . "` AS cu\n            ON\n                notif.user_id = cu.user_id\n            AND\n                cu.code_cours = '" . claro_sql_escape(claro_get_current_course_id()) . "'\n            WHERE\n                notif.topic_id = " . (int) $topicId;
    $notifyResult = claro_sql_query_fetch_all_rows($sql);
    if (is_array($notifyResult) && count($notifyResult)) {
        $subject = get_lang('A reply to your topic has been posted');
        $url_topic = get_path('rootWeb') . 'claroline/phpbb/viewtopic.php?topic=' . $topicId . '&cidReq=' . claro_get_current_course_id();
        $url_forum = get_path('rootWeb') . 'claroline/phpbb/index.php?cidReq=' . claro_get_current_course_id();
        // send mail to registered user for notification
        $message = get_lang('You are receiving this notification because you are watching a topic on the forum of one of your courses.') . '<br/>' . "\n" . get_lang('View topic') . '<br/>' . "\n" . '<a href="' . claro_htmlspecialchars(Url::Contextualize($url_topic)) . '">' . Url::Contextualize($url_topic) . '</a><br/><br/>' . "\n" . get_lang('View forum') . '<br/>' . '<a href="' . claro_htmlspecialchars(Url::Contextualize($url_forum)) . '">' . Url::Contextualize($url_forum) . '</a><br/>' . "\n";
        require_once dirname(__FILE__) . '/../../messaging/lib/recipient/userlistrecipient.lib.php';
        require_once dirname(__FILE__) . '/../../messaging/lib/message/platformmessagetosend.lib.php';
        $recipient = new UserListRecipient();
        foreach ($notifyResult as $user) {
            $recipient->addUserId($user['user_id']);
        }
        $message = new PlatformMessageToSend($subject, $message);
        $message->setCourse(claro_get_current_course_id());
        $message->setTools('CLFRM');
        if (claro_is_in_a_group()) {
            $message->setGroup(claro_get_current_group_id());
        }
        //$message->sendTo($recipient);
        $recipient->sendMessage($message);
    }
}
Пример #15
0
require '../inc/claro_init_global.inc.php';
require_once get_path('incRepositorySys') . '/lib/fileManage.lib.php';
$_course = claro_get_current_course_data();
function is_parent_path($parentPath, $childPath)
{
    // convert the path for operating system harmonize
    $parentPath = realpath($parentPath);
    $childPath = realpath($parentPath . $childPath);
    if ($childPath !== false) {
        // verify if the file exists and if the file is under parent path
        return preg_match('|^' . preg_quote($parentPath) . '|', $childPath);
    } else {
        return false;
    }
}
if (claro_is_in_a_group() && claro_is_group_allowed()) {
    $_group = claro_get_current_group_data();
    $courseDir = claro_get_course_path() . '/group/' . claro_get_current_group_data('directory');
    ClaroBreadCrumbs::getInstance()->prepend(get_lang('Documents and Links'), 'document.php');
    ClaroBreadCrumbs::getInstance()->prepend(get_lang('Groups'), '../group/group.php');
} else {
    $courseDir = claro_get_course_path() . '/document';
    ClaroBreadCrumbs::getInstance()->prepend(get_lang('Documents and Links'), 'document.php');
}
$noPHP_SELF = true;
$baseWorkDir = get_path('coursesRepositorySys') . $courseDir;
if (!empty($_REQUEST['cmd'])) {
    $cmd = $_REQUEST['cmd'];
} else {
    $cmd = null;
}
Пример #16
0
} elseif (false !== $topicSettingList) {
    $forumSettingList = get_forum_settings($topicSettingList['forum_id']);
    $forumId = $forumSettingList['forum_id'];
} else {
    $forumSettingList = get_forum_settings($forumId);
}
$incrementViewCount = 'show' == $cmd ? true : false;
//init anonymity status
if (get_conf('clfrm_anonymity_enabled') == 'TRUE') {
    $anonymityStatus = $forumSettingList['anonymity'];
} else {
    $anonymityStatus = 'forbidden';
}
//check access rights
$is_postAllowed = !claro_is_current_user_enrolment_pending() && claro_is_course_member() && $forumSettingList['forum_access'] != 0 && (!$topicId || !$topicSettingList['topic_status']) || claro_is_allowed_to_edit() ? true : false;
$is_viewAllowed = !is_null($forumSettingList['idGroup']) && !($forumSettingList['idGroup'] == claro_get_current_group_id() || claro_is_in_a_group() || claro_is_group_allowed()) && !claro_is_allowed_to_edit() ? false : true;
// NOTE : $forumSettingList['idGroup'] != claro_get_current_group_id() is necessary to prevent any hacking
// attempt like rewriting the request without $cidReq. If we are in group
// forum and the group of the concerned forum isn't the same as the session
// one, something weird is happening, indeed ...
if (!isset($_REQUEST['submit']) && !$is_postAllowed && 'show' != $cmd || !$is_viewAllowed) {
    $dialogBox->error(get_lang('Not allowed'));
} else {
    //handle user commands
    if ('exDelete' == $cmd) {
        if (delete_post($postId, $topicSettingList['topic_id'], $forumSettingList['forum_id'])) {
            $dialogBox->success('Post successfully deleted');
        } else {
            $dialogBox->error('Error while deleting post');
        }
        $cmd = 'show';
Пример #17
0
 /**
  * Singleton constructor
  * @todo avoid using the singleton pattern and use a factory instead ?
  * @param int $uid user id
  * @param boolean $forceReload force reloading the data
  * @return Claro_CurrentUser current user
  */
 public static function getInstance($groupId = null, $forceReload = false)
 {
     if ($forceReload || !self::$instance) {
         self::$instance = new self($groupId);
         if (!$forceReload && claro_is_in_a_group()) {
             self::$instance->loadFromSession();
         } else {
             self::$instance->load($forceReload);
         }
     }
     return self::$instance;
 }
Пример #18
0
--------------------------------------------------------------------*/
$assignment = new Assignment();
if (!$req['assignmentId'] || !$assignment->load($req['assignmentId'])) {
    // we NEED to know in which assignment we are, so if assigId is not set
    // relocate the user to the previous page
    claro_redirect(Url::Contextualize('work.php'));
    exit;
}
/*============================================================================
    Group Publish Option
  ============================================================================*/
// redirect to the submission form prefilled with a .url document targetting the published document
/**
 * @todo $_REQUEST['submitGroupWorkUrl'] must be treated in  filter process
 */
if (isset($_REQUEST['submitGroupWorkUrl']) && !empty($_REQUEST['submitGroupWorkUrl']) && claro_is_in_a_group()) {
    claro_redirect(Url::Contextualize('user_work.php?authId=' . claro_get_current_group_id() . '&cmd=rqSubWrk' . '&assigId=' . $req['assignmentId'] . '&submitGroupWorkUrl=' . urlencode($_REQUEST['submitGroupWorkUrl'])));
    exit;
}
/*============================================================================
    Permissions
  ============================================================================*/
$assignmentIsVisible = (bool) ($assignment->getVisibility() == 'VISIBLE');
$is_allowedToEditAll = (bool) claro_is_allowed_to_edit();
if (!$assignmentIsVisible && !$is_allowedToEditAll) {
    // if assignment is not visible and user is not course admin or upper
    claro_redirect(Url::Contextualize('work.php'));
    exit;
}
// upload or update is allowed between start and end date or after end date if late upload is allowed
$uploadDateIsOk = $assignment->isUploadDateOk();
Пример #19
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>";
}
Пример #20
0
 */
// load Claroline kernel
require_once dirname(__FILE__) . '/../../../../../inc/claro_init_global.inc.php';
require_once get_path('incRepositorySys') . '/lib/fileDisplay.lib.php';
require_once get_path('incRepositorySys') . '/lib/image.lib.php';
/*
 * Permissions
 */
if (claro_is_in_a_course() && !claro_is_in_a_group()) {
    // course context
    $is_allowedToEdit = claro_is_allowed_to_edit();
    $pathSys = get_path('coursesRepositorySys') . claro_get_course_path() . '/document/';
    $pathWeb = get_path('coursesRepositoryWeb') . claro_get_course_path() . '/document/';
    require claro_get_conf_repository() . 'CLDOC.conf.php';
    $maxFilledSpace = get_conf('maxFilledSpace_for_course');
} elseif (claro_is_in_a_group()) {
    // course context
    $is_allowedToEdit = claro_is_allowed_to_edit();
    $pathSys = get_path('coursesRepositorySys') . claro_get_course_path() . '/group/' . claro_get_current_group_data('directory');
    $pathWeb = get_path('coursesRepositoryWeb') . claro_get_course_path() . '/group/' . claro_get_current_group_data('directory');
    require claro_get_conf_repository() . 'CLDOC.conf.php';
    $maxFilledSpace = get_conf('maxFilledSpace_for_course');
} else {
    // platform context
    $is_allowedToEdit = claro_is_platform_admin();
    $pathSys = get_path('rootSys') . 'platform/document/';
    $pathWeb = get_path('rootWeb') . 'platform/document/';
}
/*
 * Libraries
 */
Пример #21
0
            </p>
            
            <?php 
        }
        ?>
 <!-- basename -->
            
            </div>
            
            <?php 
    }
    ?>
 <!-- in a group -->
            
            <?php 
    if (claro_is_in_a_group() || get_conf('course_maskToolListByDefault', false)) {
        ?>
            <script type="text/javascript">
                $( function() {
                    (Claroline.getLeftMenuToggleFunction())();
                });
            </script>
            <?php 
    }
    ?>
            
            <div class="clearer"></div>
        </div>
        
        <div class="clearer"></div>