public function render() { $out = ''; if (!claro_is_user_authenticated()) { if (get_conf('claro_displayLocalAuthForm', true) == true) { $out .= $this->renderLoginLink(); } } elseif (!claro_is_platform_admin() && (claro_is_in_a_course() && !claro_is_course_member()) && claro_get_current_course_data('registrationAllowed')) { if (claro_is_current_user_enrolment_pending()) { $out .= '<img src="' . get_icon_url('warning') . '" alt="off" /> ' . '<b>' . get_lang('Enrolment pending') . '</b>'; } else { $out .= $this->renderRegistrationLink(); } } elseif (claro_is_display_mode_available()) { $out .= $this->renderViewModeSwitch(); } return $out; }
} /*============================================================================ 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(); if ($assignment->getAssignmentType() == 'INDIVIDUAL') { // user is authed and allowed $userCanPost = (bool) (claro_is_user_authenticated() && claro_is_course_allowed() && claro_is_course_member()); } else { $userGroupList = get_user_group_list(claro_get_current_user_id()); // check if user is member of at least one group $userCanPost = (bool) (!empty($userGroupList)); } $is_allowedToSubmit = (bool) ($assignmentIsVisible && $uploadDateIsOk && $userCanPost) || $is_allowedToEditAll; /*============================================================================ Update notification ============================================================================*/ if (claro_is_user_authenticated()) { // call this function to set the __assignment__ as seen, all the submission as seen $claro_notifier->is_a_notified_ressource(claro_get_current_course_id(), $claro_notifier->get_notification_date(claro_get_current_user_id()), claro_get_current_user_id(), claro_get_current_group_id(), claro_get_current_tool_id(), $req['assignmentId']); } /*============================================================================ Prepare List
} } } else { $dialogBox->form(get_lang('Confirm your subscription to the group "<b>%group_name</b>"', array('%group_name' => claro_get_current_group_data('name'))) . "\n" . '<form action="' . claro_htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">' . "\n" . claro_form_relay_context() . '<input type="hidden" name="registration" value="1" />' . "\n" . '<input type="hidden" name="doReg" value="1" />' . "\n" . '<br />' . "\n" . '<input type="submit" value="' . get_lang("Ok") . '" />' . "\n" . claro_html_button(claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'])), get_lang("Cancel")) . "\n" . '</form>' . "\n"); } } } if (isset($_REQUEST['regDone'])) { $dialogBox->success(get_lang("You are now a member of this group.")); } if (isset($_REQUEST['unregistration'])) { //RECHECK if subscribe is aivailable if (claro_is_course_member() && claro_is_group_member() && $is_allowedToSelfUnregInGroup) { if (isset($_REQUEST['doUnreg'])) { //RECHECK if subscribe is aivailable if (claro_is_course_member() && claro_is_group_member() && $is_allowedToSelfUnregInGroup) { $sql = "DELETE FROM `" . $tbl_group_rel_team_user . "`\n WHERE `user` = " . (int) claro_get_current_user_id() . "\n AND `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(dirname($_SERVER['PHP_SELF']) . '/group.php?gidReset=1&unregDone=1'); exit; } } } else { $dialogBox->form(get_lang('Confirm your unsubscription from the group "<b>%group_name</b>"', array('%group_name' => claro_get_current_group_data('name'))) . "\n" . '<form action="' . claro_htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">' . "\n" . claro_form_relay_context() . '<input type="hidden" name="unregistration" value="1" />' . "\n" . '<input type="hidden" name="doUnreg" value="1" />' . "\n" . '<br />' . "\n" . '<input type="submit" value="' . get_lang("Ok") . '" />' . "\n" . claro_html_button(claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'])), get_lang("Cancel")) . "\n" . '</form>' . "\n"); } } } /** * TUTOR REGISTRATION PROCESS */
$topicId = $topicSettingList['topic_id']; } 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'); }
/** * 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, ' > ', 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; }
<!-- // $Id: forum_viewforum.tpl.php 14314 2012-11-07 09:09:19Z zefredz $ --> <table class="claroTable emphaseLine" width="100%"> <tbody> <tr class="superHeader"> <th colspan="<?php echo $this->is_allowedToEdit ? 9 : 6; ?> "> <?php // Allow course managers to receive notification for all new contributions in this forum or disable it if (claro_is_user_authenticated() && claro_is_course_member()) { //anonymous user do not have this function ?> <span style="float: right;" class="claroCmd"> <?php if (is_forum_notification_requested($this->forumId, claro_get_current_user_id())) { // display link NOT to be notified ?> <img src="<?php echo get_icon_url('mail_close'); ?> " alt="" style="vertical-align: text-bottom" /> <?php echo get_lang('Notify by email when topics are created'); ?> [<a href="<?php echo claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?forum=' . $this->forumId . '&cmd=exdoNotNotify')); ?> "><?php echo get_lang('Disable');
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>"; }
} elseif ($size > 1 && 2 === $passes) { $checked1 = ''; $checked2 = ' checked="checked"'; } else { $checked1 = ''; $checked2 = ''; } $out .= '<td>' . '<input type="radio" name="old" value="' . $version['id'] . '"' . $checked1 . ' />' . "\n" . '</td>' . "\n"; $out .= '<td>' . '<input type="radio" name="new" value="' . $version['id'] . '"' . $checked2 . ' />' . "\n" . '</td>' . "\n"; $userInfo = user_get_properties($version['editor_id']); if (!empty($userInfo)) { $userStr = $userInfo['firstname'] . " " . $userInfo['lastname']; } else { $userStr = get_lang('Unknown user'); } if (claro_is_course_member()) { $userUrl = '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLUSR') . '/userInfo.php?uInfo=' . (int) $version['editor_id'])) . '">' . $userStr . '</a>'; } else { $userUrl = $userStr; } $versionUrl = '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?wikiId=' . (int) $wikiId . '&title=' . rawurlencode($title) . '&action=show' . '&versionId=' . (int) $version['id'])) . '">' . claro_html_localised_date(get_locale('dateTimeFormatLong'), strtotime($version['mtime'])) . '</a>'; $out .= '<td>' . sprintf(get_lang('%1\\$s by %2\\$s'), $versionUrl, $userUrl) . '</td>' . "\n"; $out .= '</tr>' . "\n"; } } $out .= '</table>' . "\n"; $out .= '</form>'; break; case 'exSearch': $out .= '<h3>' . get_lang("Search result") . '</h3>' . "\n"; $out .= '<ul>' . "\n";
} if (!claro_is_platform_admin()) { $courseStatus = claro_get_current_course_data('status'); if ($courseStatus == 'trash' || $courseStatus == 'disable') { Claroline::getDisplay()->body->hideCourseTitleAndTools(); claro_die(get_lang('This course is not available anymore, please contact the platform administrator.')); } } // post kernel access check if (claro_is_in_a_course()) { if (!(basename(php_self()) == 'courses.php' && isset($_REQUEST['cmd']) && $_REQUEST['cmd'] == 'exReg')) { if (!claro_is_course_allowed()) { if (!claro_is_user_authenticated()) { claro_disp_auth_form(); } else { if (claro_get_current_course_data('access') == 'private' && !claro_is_course_member()) { claro_die(get_lang("You have to be enroled to this course to access its contents") . '<br /><a href="' . claro_htmlspecialchars(get_path('clarolineRepositoryWeb') . 'auth/courses.php?cmd=exReg&course=' . claro_get_current_course_id()) . '">' . claro_html_icon('enroll') . ' ' . '<b>' . get_lang('Enrolment') . '</b>' . '</a>'); } else { claro_die(get_lang("Not allowed!")); } } } } } // group_space.php?registration=1&selfReg=1 if (claro_is_in_a_group()) { if (!(basename(php_self()) == 'group_space.php' && isset($_REQUEST['registration']) && $_REQUEST['registration'] == '1')) { if (!claro_is_group_allowed()) { if (!claro_is_user_authenticated()) { claro_disp_auth_form(); } else {