if (is_null($exId)) { $dialogBox->success(get_lang('Exercise added')); $eventNotifier->notifyCourseEvent("exercise_added", claro_get_current_course_id(), claro_get_current_tool_id(), $insertedId, claro_get_current_group_id(), "0"); $exId = $insertedId; } else { $dialogBox->success(get_lang('Exercise modified')); $eventNotifier->notifyCourseEvent("exercise_updated", claro_get_current_course_id(), claro_get_current_tool_id(), $insertedId, claro_get_current_group_id(), "0"); } $displaySettings = true; } else { // sql error in save() ? $cmd = 'rqEdit'; } } else { if (claro_failure::get_last_failure() == 'exercise_no_title') { $dialogBox->error(get_lang('Field \'%name\' is required', array('%name' => get_lang('Title')))); } elseif (claro_failure::get_last_failure() == 'exercise_incorrect_dates') { $dialogBox->error(get_lang('Start date must be before end date ...')); } $cmd = 'rqEdit'; } } if ($cmd == 'rqEdit') { $form['title'] = $exercise->getTitle(); $form['description'] = $exercise->getDescription(); $form['displayType'] = $exercise->getDisplayType(); $form['randomize'] = (bool) $exercise->getShuffle() > 0; $form['questionDrawn'] = $exercise->getShuffle(); $form['useSameShuffle'] = (bool) $exercise->getUseSameShuffle(); $form['showAnswers'] = $exercise->getShowAnswers(); $form['startDate'] = $exercise->getStartDate();
case 'exdoNotNotify': $topicId = $userInput->getMandatory('topic'); break; case 'show': $topicId = $userInput->getMandatory('topic'); break; } } catch (Exception $ex) { if (claro_debug_mode()) { pushClaroMessage('<pre>' . $ex->__toString() . '</pre>', 'error'); // claro_die( '<pre>' . $ex->__toString() . '</pre>' ); } if ($ex instanceof Claro_Validator_Exception) { switch ($cmd) { case 'rqPost': $dialogBox->error(get_lang('Unknown post or edition mode')); $cmd = 'dialog_only'; break; case 'exSavePost': $dialogBox->error(get_lang('Missing information')); $inputMode = 'missing_input'; break; case 'exDelete': $dialogBox->error(get_lang('Unknown post')); break; case 'exNotify': $dialogBox->error(get_lang('Unknown topic')); break; case 'exdoNotNotify': $dialogBox->error(get_lang('Unknown topic')); break;
if ($fp = @fopen($question->questionDirSys . "/question_" . $quId . ".xml", 'w')) { fwrite($fp, $xml); fclose($fp); } else { // interrupt process } // list of dirs to add in archive $filePathList[] = $question->questionDirSys; /* * BUILD THE ZIP ARCHIVE */ // build and send the zip if (sendZip($question->getTitle(), $filePathList, $question->questionDirSys)) { exit; } else { $dialogBox->error(get_lang("Unable to send zip file")); } } if ($cmd == 'recupMultipleQuestions' && !is_null($exId)) { // add multiple question selection $sql = "SELECT `id` FROM `" . $tbl_quiz_question . "` ORDER BY `id`"; $list = claro_sql_query_fetch_all_rows($sql); $ok = true; foreach ($list as $questionInfo) { $quId = $questionInfo['id']; if (isset($_REQUEST[$quId])) { if (!$exercise->addQuestion($quId)) { $ok = false; } } }
// Manage portlets if (claro_is_course_manager() && !empty($portletClass)) { // Require the right class $portletPath = get_module_path($portletLabel) . '/connector/coursehomepage.cnr.php'; if (file_exists($portletPath)) { require_once $portletPath; } else { throw new Exception(get_lang('Cannot find this portlet')); } if ($portletCmd == 'exAdd') { $portlet = new $portletClass(); $portlet->handleForm(); if ($portlet->save()) { $dialogBox->success(get_lang('Portlet created')); } else { $dialogBox->error(get_lang('Can\'t create this portlet (%portlet)', array('%portlet' => $portlet->getLabel()))); } } elseif ($portletCmd == 'delete' && !empty($portletId) && class_exists($portletClass)) { $portlet = new $portletClass(); $portlet->load($portletId); if ($portlet->delete()) { $dialogBox->success(get_lang('Portlet deleted')); } } elseif ($portletCmd == 'makeVisible' && !empty($portletId) && class_exists($portletClass)) { $portlet = new $portletClass(); if ($portlet->load($portletId)) { $portlet->makeVisible(); if ($portlet->save()) { $dialogBox->success(get_lang('Portlet visibility modified')); } }
//DECLARE NEEDED LIBRARIES require_once get_path('incRepositorySys') . '/lib/pager.lib.php'; require_once get_path('incRepositorySys') . '/lib/module/manage.lib.php'; //SQL table name $tbl_name = claro_sql_get_main_tbl(); $tbl_module = $tbl_name['module']; $tbl_dock = $tbl_name['dock']; $dialogBox = new DialogBox(); if (isset($_REQUEST['dock'])) { $dockList = get_dock_list('applet'); $dock = $_REQUEST['dock']; $dockName = isset($dockList[$dock]) ? $dockList[$dock] : $dock; $nameTools = get_lang('Dock') . ' : ' . $dockName; } else { $dock = null; $dialogBox->error(get_lang('No dock selected')); $nameTools = get_lang('Dock'); } ClaroBreadCrumbs::getInstance()->prepend(get_lang('Module list'), get_path('rootAdminWeb') . 'module/module_list.php'); ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb')); //CONFIG and DEVMOD vars : $modulePerPage = get_conf('moduleDockPerPage', 10); //---------------------------------- // EXECUTE COMMAND //---------------------------------- $cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null; $module_id = isset($_REQUEST['module_id']) ? $_REQUEST['module_id'] : null; if (!empty($dock)) { switch ($cmd) { case 'up': move_module_in_dock($module_id, $dock, 'up');
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($coursePath)) as $file) { try { if ($file->getType() == 'file') { $type = strtolower(pathinfo($file->getFilename(), PATHINFO_EXTENSION)); if (in_array($type, $extensions)) { $courseStats[$type]['count']++; $courseStats[$type]['size'] += $file->getSize(); } else { $courseStats['others']['count']++; $courseStats['others']['size'] += $file->getSize(); } $courseStats['sum']['count']++; $courseStats['sum']['size'] += $file->getSize(); } } catch (Exception $ex) { $dialogBox->error($ex->getMessage()); } } $stats[$course['sysCode']]['courseTitle'] = $course['title']; $stats[$course['sysCode']]['courseTitulars'] = $course['titulars']; $stats[$course['sysCode']]['courseStats'] = $courseStats; // Get categories datas $cat = array(); $sql2 = "SELECT cat.name AS categoryName\n FROM `" . $tbl_category . "` AS cat\n LEFT JOIN `" . $tbl_rel_course_category . "` AS rcc\n ON ( cat.id = rcc.categoryId )\n WHERE rcc.courseId = '" . $course['id'] . "'"; $arrayCat = Claroline::getDatabase()->query($sql2); foreach ($arrayCat as $item) { $cat[] .= $item['categoryName']; } $stats[$course['sysCode']]['courseCategory'] = $cat; $i++; // Courses pool's limit reached ?
break; case 'exEmptyForum': $forumId = $userInput->getMandatory('forumId'); break; case 'exMvUpForum': $forumId = $userInput->getMandatory('forumId'); break; case 'exMvDownForum': $forumId = $userInput->getMandatory('forumId'); break; default: break; } } catch (Exception $ex) { if (claro_debug_mode()) { $dialogBox->error('<pre>' . $ex->__toString() . '</pre>'); } if ($ex instanceof Claro_Validator_Exception) { if (!isset($cmd)) { $cmd = 'cmd'; } switch ($cmd) { case 'cmd': $cmd = 'show'; break; case 'exMkCat': $dialogBox->error(get_lang('Category name cannot be empty')); $cmd = 'rqMkCat'; break; case 'exEdCat': $dialogBox->error(get_lang('Category name cannot be empty'));
// Notify that the introsection has been modified $claroline->notifier->notifyCourseEvent('introsection_modified', claro_get_current_course_id(), claro_get_current_tool_id(), $toolIntro->getId(), claro_get_current_group_id(), '0'); } } elseif ($cmd == 'exDel') { $toolIntro = new ToolIntro($id); if ($toolIntro->delete()) { $dialogBox->success(get_lang('Introduction deleted')); //TODO linker_delete_resource('CLINTRO_'); } } elseif ($cmd == 'exMvUp') { $toolIntro = new ToolIntro($id); if ($toolIntro->load()) { if ($toolIntro->moveUp()) { $dialogBox->success(get_lang('Introduction moved up')); } else { $dialogBox->error(get_lang('This introduction can\'t be moved up')); } } } elseif ($cmd == 'exMvDown') { $toolIntro = new ToolIntro($id); if ($toolIntro->load()) { if ($toolIntro->moveDown()) { $dialogBox->success(get_lang('Introduction moved down')); } else { $dialogBox->error(get_lang('This introduction can\'t be moved down')); } } } elseif ($cmd == 'mkVisible') { $toolIntro = new ToolIntro($id); if ($toolIntro->load()) { $toolIntro->setVisibility('SHOW');
} if (isset($_REQUEST['descCategory'])) { $description->setCategory($_REQUEST['descCategory']); } if ($description->validate()) { // Update description if ($description->save()) { if ($descId) { $eventNotifier->notifyCourseEvent('course_description_modified', claro_get_current_course_id(), claro_get_current_tool_id(), $descId, claro_get_current_group_id(), '0'); $dialogBox->success(get_lang('Description updated')); } else { $eventNotifier->notifyCourseEvent('course_description_added', claro_get_current_course_id(), claro_get_current_tool_id(), $descId, claro_get_current_group_id(), '0'); $dialogBox->success(get_lang('Description added')); } } else { $dialogBox->error(get_lang('Unable to update')); } } else { $cmd = 'rqEdit'; } } /*------------------------------------------------------------------------- REQUEST DESCRIPTION ITEM EDITION -------------------------------------------------------------------------*/ if ($cmd == 'rqEdit') { claro_set_display_mode_available(false); // Manage the tips $tips['isTitleEditable'] = isset($tipList[$category]['isEditable']) ? $tipList[$category]['isEditable'] : true; $tips['presetTitle'] = !empty($tipList[$category]['title']) ? claro_htmlspecialchars($tipList[$category]['title']) : ''; $tips['question'] = !empty($tipList[$category]['question']) ? $tipList[$category]['question'] : ''; $tips['information'] = !empty($tipList[$category]['information']) ? $tipList[$category]['information'] : '';
$date_selection = $_REQUEST['fyear'] . '-' . $_REQUEST['fmonth'] . '-' . $_REQUEST['fday']; $hour = $_REQUEST['fhour'] . ':' . $_REQUEST['fminute'] . ':00'; $entryId = agenda_add_item($title, $content, $date_selection, $hour, $lasting, $speakers, $location); if ($entryId != false) { $dialogBox->success(get_lang('Event added to the agenda')); $currentLocator = ResourceLinker::$Navigator->getCurrentLocator(array('id' => (int) $entryId)); $resourceList = isset($_REQUEST['resourceList']) ? $_REQUEST['resourceList'] : array(); ResourceLinker::updateLinkList($currentLocator, $resourceList); if (CONFVAL_LOG_CALENDAR_INSERT) { $claroline->log('CALENDAR', array('ADD_ENTRY' => $entryId)); } // notify that a new agenda event has been posted $eventNotifier->notifyCourseEvent('agenda_event_added', claro_get_current_course_id(), claro_get_current_tool_id(), $entryId, claro_get_current_group_id(), '0'); $autoExportRefresh = true; } else { $dialogBox->error(get_lang('Unable to add the event to the agenda')); } } /*------------------------------------------------------------------------ EDIT EVENT COMMAND --------------------------------------------------------------------------*/ if ('exEdit' == $cmd) { $date_selection = $_REQUEST['fyear'] . '-' . $_REQUEST['fmonth'] . '-' . $_REQUEST['fday']; $hour = $_REQUEST['fhour'] . ':' . $_REQUEST['fminute'] . ':00'; if (!empty($id)) { if (agenda_update_item($id, $title, $content, $date_selection, $hour, $lasting, $speakers, $location)) { $dialogBox->success(get_lang('Event updated into the agenda')); $currentLocator = ResourceLinker::$Navigator->getCurrentLocator(array('id' => (int) $id)); $resourceList = isset($_REQUEST['resourceList']) ? $_REQUEST['resourceList'] : array(); ResourceLinker::updateLinkList($currentLocator, $resourceList); $eventNotifier->notifyCourseEvent('agenda_event_modified', claro_get_current_course_id(), claro_get_current_tool_id(), $id, claro_get_current_group_id(), '0');
//check if newname is not already used in another module of the same course $sql = "SELECT `name`\n FROM `" . $TABLEMODULE . "`\n WHERE `name` = '" . claro_sql_escape($_POST['newName']) . "'\n AND `module_id` != '" . (int) $_REQUEST['module_id'] . "'"; $query = claro_sql_query($sql); $num = mysql_num_rows($query); if ($num == 0) { // if no error occurred, update module's name in the database $query = "UPDATE `" . $TABLEMODULE . "`\n SET `name`= '" . claro_sql_escape($_POST['newName']) . "'\n WHERE `module_id` = '" . (int) $_REQUEST['module_id'] . "'"; $result = claro_sql_query($query); } else { $dialogBox = new DialogBox(); $dialogBox->error(get_lang('Error : Name already exists in the learning path or in the module pool')); $out .= $dialogBox->render(); } } else { $dialogBox = new DialogBox(); $dialogBox->error(get_lang('Name cannot be empty')); $out .= $dialogBox->render(); } break; //display the form to modify the comment //display the form to modify the comment case "rqComment": if (isset($_REQUEST['module_id'])) { //get current comment from DB $query = "SELECT `comment`\n FROM `" . $TABLEMODULE . "`\n WHERE `module_id` = '" . (int) $_REQUEST['module_id'] . "'"; $result = claro_sql_query($query); $comment = mysql_fetch_array($result); if (isset($comment['comment'])) { $out .= '<form method="get" action="' . $_SERVER['PHP_SELF'] . '">' . "\n" . claro_form_relay_context() . claro_html_textarea_editor('comment', $comment['comment'], 15, 55) . "\n" . '<br />' . "\n" . '<input type="hidden" name="cmd" value="exComment" />' . "\n" . '<input type="hidden" name="module_id" value="' . $_REQUEST['module_id'] . '" />' . "\n" . '<input type="submit" value="' . get_lang('Ok') . '" />' . "\n" . '<br /><br />' . "\n" . '</form>' . "\n"; } }
$cidRequired = isset($_REQUEST['cidRequired']) ? $_REQUEST['cidRequired'] : false; //TODO: possibility to continue in anonymous $uidRequired = true; // The script needs the user to be authentificated if (!claro_is_user_authenticated() && $uidRequired) { $defaultLoginValue = ''; $dialogBox = new DialogBox(); if (isset($_SESSION['lastUserName'])) { $defaultLoginValue = strip_tags($_SESSION['lastUserName']); unset($_SESSION['lastUserName']); } if (get_conf('claro_displayLocalAuthForm', true) == true) { if ($claro_loginRequested && !$claro_loginSucceeded) { if (AuthManager::getFailureMessage()) { // need to use get_lang two times... $dialogBox->error(get_lang(AuthManager::getFailureMessage())); } else { $dialogBox->error(get_lang('Login failed.') . ' ' . get_lang('Please try again.')); } if (get_conf('allowSelfReg', false)) { $dialogBox->warning(get_lang('If you haven\'t a user account yet, use the <a href="%url">the account creation form</a>.', array('%url' => get_path('url') . '/claroline/auth/inscription.php'))); } else { $dialogBox->error(get_lang('Contact your administrator.')); } $dialogBox->warning(get_lang('Warning the system distinguishes uppercase (capital) and lowercase (small) letters')); } if (get_conf('claro_secureLogin', false)) { $formAction = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; } else { $formAction = $_SERVER['PHP_SELF']; }
$visibleOnInstall = array_key_exists('visibleOnInstall', $_REQUEST) && $_REQUEST['visibleOnInstall'] == 'on' ? true : false; $deleteModuleDatabase = array_key_exists('deleteModuleDatabase', $_REQUEST) && $_REQUEST['deleteModuleDatabase'] == 'on' ? true : false; //---------------------------------- // EXECUTE COMMAND //---------------------------------- // TODO improve status message and backlog display switch ($cmd) { case 'activ': list($backlog, $success) = activate_module($module_id); $details = $backlog->output(); if ($success) { $summary = get_lang('Module activation succeeded'); $dialogBox->success(Backlog_Reporter::report($summary, $details)); } else { $summary = get_lang('Module activation failed'); $dialogBox->error(Backlog_Reporter::report($summary, $details)); } break; case 'desactiv': list($backlog, $success) = deactivate_module($module_id); $details = $backlog->output(); if ($success) { $summary = get_lang('Module desactivation succeeded'); $dialogBox->success(Backlog_Reporter::report($summary, $details)); } else { $summary = get_lang('Module desactivation failed'); $dialogBox->error(Backlog_Reporter::report($summary, $details)); } break; case 'mvUp': if (!is_null($courseToolId)) {
} else { $failedList[] = $userInfo; } } if ($sendEmail && !$mailSent) { $failedMailList[] = $userInfo; } } if (empty($failedList)) { $dialogBox->success(get_lang('Password changed successfully for all concerned users')); } else { $failedStudents = ''; foreach ($failedList as $failed) { $failedStudents .= '<br />' . $failed['firstname'] . ' ' . $failed['lastname']; } $dialogBox->error(get_lang('Cannot change password for the following users:') . $failedStudents); } if ($sendEmail) { if (empty($failedMailList)) { $dialogBox->success(get_lang('Email sent successfully to all users')); } else { $failedStudents = ''; foreach ($failedMailList as $failed) { $failedStudents .= '<br />' . $failed['firstname'] . ' ' . $failed['lastname']; } $dialogBox->error(get_lang('Cannot send email to the following users:') . $failedStudents); } } break; case 'exDelete': if (user_delete($userIdReq)) {
$con = Claroline::getDatabase(); // DEVEL_MODE database initialisation if (defined('DEVEL_MODE') && DEVEL_MODE == true) { init_wiki_tables($con, false); } // Objects instantiation $wikiStore = new WikiStore($con, $config); $wikiList = array(); // --------- Start of command processing ---------------- switch ($action) { case 'exExport': require_once "lib/class.wiki2xhtmlexport.php"; if (!$wikiStore->wikiIdExists($wikiId)) { // die( get_lang("Invalid Wiki Id") ); $message = get_lang("Invalid Wiki Id"); $dialogBox->error($message); $action = 'error'; } else { $wiki = $wikiStore->loadWiki($wikiId); $wikiTitle = $wiki->getTitle(); $renderer = new WikiToSingleHTMLExporter($wiki); $contents = $renderer->export(); if (0 != $groupId) { $groupPart = '_group' . (int) $groupId; } else { $groupPart = ''; } require_once get_conf('includePath') . '/lib/fileUpload.lib.php'; // TODO : use function wich return get_conf('coursesRepositorySys') . '/' . $_course['path'] $exportDir = get_conf('coursesRepositorySys') . '/' . claro_get_course_path() . '/document'; $exportFile = replace_dangerous_char($wikiTitle, 'strict') . $groupPart;
$out .= '<br />' . "\n" . get_lang('An email has been sent to help you remember your username and password.'); } $out .= '</p>' . "\n"; if (claro_is_allowed_to_create_course()) { $out .= '<p>' . get_lang('You can now create your course') . '</p>' . "\n"; } else { $out .= '<p>' . get_lang('You can now select, in the list, the courses you want to access') . '</p>' . "\n"; } $out .= '<form action="../../index.php?cidReset=1" >' . '<input type="submit" name="next" value="' . get_lang('Next') . '" />' . "\n" . '</form>' . "\n"; } elseif (DISP_REGISTRATION_AGREEMENT == $display) { if (trim($agreementText) != '') { $out .= '<div class="info">' . $agreementText . '</div>'; } $out .= '<br />' . '<form action="' . $_SERVER['PHP_SELF'] . '" >' . '<input type="hidden" name="cmd" value="agree" />' . "\n" . '<input type="submit" name="next" value="' . get_lang('Ok') . '" /> ' . "\n" . claro_html_button(get_conf('urlAppend') . '/index.php', get_lang('Cancel')) . '</form>' . "\n"; } elseif (DISP_REGISTRATION_NOT_ALLOWED == $display) { $out .= claro_html_msg_list(array(array('info' => get_lang('Subscription not allowed')))); $out .= '<br />' . '<form action="' . get_conf('rootWeb', '/') . '" >' . '<input type="submit" name="next" value="' . get_lang('Ok') . '" />' . "\n" . '</form>' . "\n"; } elseif (DISP_REGISTRATION_FORM == $display) { // If registration failed display error message if (count($messageList) > 0) { $dialogBox = new DialogBox(); $dialogBox->error(implode('<br />', $messageList)); $out .= $dialogBox->render(); } if (trim($subscriptionText) != '') { $out .= '<div class="info subscribe">' . $subscriptionText . '</div>'; } $out .= user_html_form(); } $claroline->display->body->appendContent($out); echo $claroline->display->render();
$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); // MESSAGE if (get_conf('allow_html') == 0 || isset($html)) { $message = htmlspecialchars($message); } $message = trim($message); // USER
$starttime = get_time(); $dialogBox = new DialogBox(); /* * Compare */ $urlSDK = get_path('rootAdminWeb') . 'xtra/sdk/'; $urlTranslation = $urlSDK . 'translation_index.php'; $pathSDK = get_path('rootSys') . 'claroline/admin/xtra/sdk/'; $path_lang = get_path('rootSys') . 'claroline/lang/'; // copy the last 1.8 english complete in this dir $pathTo18Complete = $pathSDK . 'lang/complete.lang.php'; // missing for 1.9 should be empty $pathTo19Complete = $path_lang . 'english/complete.lang.php'; $pathTo19Missing = $path_lang . 'english/missing.lang.php'; if (!file_exists($pathTo18Complete)) { $dialogBox->error('Claroline 1.8 english complete is missing, should be located at ' . $pathTo18Complete); } elseif (!file_exists($pathTo19Complete)) { $dialogBox->error('Claroline 1.9 english complete is missing, should be located at ' . $pathTo19Complete); } elseif (!file_exists($pathTo19Missing)) { $dialogBox->error('Claroline 1.9 english complete is missing, should be located at ' . $pathTo19Missing); } else { /* * Compare */ include $pathTo18Complete; $_lang18 = $_lang; $_lang = null; include $pathTo19Complete; $_lang19 = $_lang; $_lang = null; include $pathTo19Missing;
if (isset($_REQUEST['file'])) { $_REQUEST['file'] = strip_tags(download_url_decode($_REQUEST['file'])); } /* > > > > > > MAIN SECTION < < < < < < <*/ if ($is_allowedToEdit) { /*= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = UPLOAD FILE = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ /* * check the request method in place of a variable from POST * because if the file size exceed the maximum file upload * size set in php.ini, all variables from POST are cleared ! */ if ('exUpload' == $cmd) { if (!isset($_FILES['userFile'])) { $dialogBox->error(get_lang('No file uploaded')); } else { if (isset($_REQUEST['uncompress']) && $_REQUEST['uncompress'] == 1 && $is_allowedToUnzip && preg_match('/.zip$/i', $_FILES['userFile']['name'])) { $unzip = 'unzip'; } else { $unzip = ''; } if (isset($_REQUEST['comment']) && trim($_REQUEST['comment']) != '') { $comment = trim($_REQUEST['comment']); } else { $comment = ''; } $cwd = secure_file_path($cwd); $uploadedFileName = treat_uploaded_file($_FILES['userFile'], $baseWorkDir, $cwd, $maxFilledSpace, $unzip); $uploadedFileNameList = array(); if ($uploadedFileName !== false) {
} $dialogBox = new DialogBox(); // Parse command if (!empty($courseCode)) { $courseToDelete = new ClaroCourse(); $courseToDelete->load($courseCode); } else { $courseToDelete = null; } if ('exDelete' == $cmd) { if (!is_null($courseToDelete)) { // Cannot delete a course if it has session courses if (!ClaroCourse::isSourceCourse($courseId)) { $do = 'delete'; } else { $dialogBox->error(get_lang('This course has session courses. You have to delete them before.')); } } else { switch (claro_failure::get_last_failure()) { case 'course_not_found': $dialogBox->error(get_lang('Course not found')); break; default: $dialogBox->error(get_lang('Course not found')); } } } elseif ('rqDelete' == $cmd) { if (!is_null($courseToDelete)) { $dialogBox->question(get_lang('Are you sure to delete course %name', array('%name' => $courseToDelete->title)) . '<br/><br/>' . "\n" . '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=exDelete&delCode=' . $courseCode . '&offsetC=' . $offsetC . $addToURL . '">' . get_lang('Yes') . '</a>' . ' | ' . '<a href="' . $_SERVER['PHP_SELF'] . '">' . get_lang('No') . '</a>' . "\n"); } else { $dialogBox->error(get_lang('Course not found'));
pushClaroMessage("User desktop : class {$portlet['label']} not found !", 'warning'); continue; } if ($portlet['label'] == 'mycourselist') { continue; } $plabel = $portlet['label']; $portlet = new $plabel($plabel); if (!$portlet instanceof UserDesktopPortlet) { pushClaroMessage("{$portlet['label']} is not a valid user desktop portlet !"); continue; } $outPortlet .= $portlet->render(); } catch (Exception $e) { $portletDialog = new DialogBox(); $portletDialog->error(get_lang('An error occured while loading the portlet : %error%', array('%error%' => $e->getMessage()))); $outPortlet .= '<div class="claroBlock portlet">' . '<h3 class="blockHeader">' . "\n" . $portlet->renderTitle() . '</h3>' . "\n" . '<div class="claroBlockContent">' . "\n" . $portletDialog->render() . '</div>' . "\n" . '</div>' . "\n\n"; } } } else { $dialogBox->error(get_lang('Cannot load portlet list')); } // Generate Script Output CssLoader::getInstance()->load('desktop', 'all'); $template = new CoreTemplate('user_desktop.tpl.php'); $userProfileBox = new UserProfileBox(false); $myCourseList = new MyCourseList(); $template->assign('dialogBox', $dialogBox); $template->assign('userProfileBox', $userProfileBox); $template->assign('outPortlet', $outPortlet); $template->assign('mycourselist', $myCourseList->render());
$user_data['language'] = trim($_POST['language']); } if (isset($_POST['isCourseCreator'])) { $user_data['isCourseCreator'] = (int) $_POST['isCourseCreator']; } if (isset($_POST['is_admin'])) { $user_data['is_admin'] = (bool) $_POST['is_admin']; } if (isset($_POST['delPicture']) && $_POST['delPicture'] == 'true') { $picturePath = user_get_picture_path($user_data); if ($picturePath) { claro_delete_file($picturePath); $user_data['picture'] = ''; $dialogBox->success(get_lang("User picture deleted")); } else { $dialogBox->error(get_lang("Cannot delete user picture")); } } // Handle user picture if (isset($_FILES['picture']['name']) && $_FILES['picture']['size'] > 0) { $fileName = $_FILES['picture']['name']; $fileTmpName = $_FILES['picture']['tmp_name']; if (is_uploaded_file($fileTmpName)) { if (is_image($fileName)) { list($width, $height, $type, $attr) = getimagesize($fileTmpName); if ($width > 0 && $width <= get_conf('maxUserPictureWidth', 150) && $height > 0 && $height <= get_conf('maxUserPictureHeight', 200) && $_FILES['picture']['size'] <= get_conf('maxUserPictureSize', 100 * 1024)) { $uploadDir = user_get_private_folder_path($user_data['user_id']); if (!file_exists($uploadDir)) { claro_mkdir($uploadDir, CLARO_FILE_PERMISSIONS, true); } if (false !== ($pictureName = treat_uploaded_file($_FILES['picture'], $uploadDir, '', 1000000000000.0))) {
$cmd = isset($_REQUEST['cmd']) ? $cmd = $_REQUEST['cmd'] : ''; if ($is_allowedToEdit) { if (isset($_REQUEST['cmd']) && ($_REQUEST['cmd'] == 'rqCreate' || $_REQUEST['cmd'] == 'rqEdit')) { if ('rqEdit' == $_REQUEST['cmd']) { $currentLocator = ResourceLinker::$Navigator->getCurrentLocator(array('id' => (int) $_REQUEST['id'])); ResourceLinker::setCurrentLocator($currentLocator); } } $autoExportRefresh = false; if (!empty($cmd)) { // Move announcements up or down if ('exMvDown' == $cmd) { if (move_entry($id, 'DOWN')) { $dialogBox->success(get_lang('Item has been moved down')); } else { $dialogBox->error(get_lang('Item can\'t be moved down')); } } if ('exMvUp' == $cmd) { if (move_entry($id, 'UP')) { $dialogBox->success(get_lang('Item has been moved up')); } else { $dialogBox->error(get_lang('Item can\'t be moved up')); } } // Delete announcement if ('exDelete' == $cmd) { if (announcement_delete_item($id)) { $dialogBox->success(get_lang('Announcement has been deleted')); if (CONFVAL_LOG_ANNOUNCEMENT_DELETE) { $claroline->log('ANNOUNCEMENT', array('DELETE_ENTRY' => $id));
//------------------------------------ // Execute COMMAND section //------------------------------------ $cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null; $req['uidToEdit'] = isset($_REQUEST['uidToEdit']) && ctype_digit($_REQUEST['uidToEdit']) ? (int) $_REQUEST['uidToEdit'] : false; $cmdList[] = '<a class="claroCmd" href="index.php" >' . get_lang('Back to administration page') . '</a>'; $cmdList[] = '<a class="claroCmd" href="admin_users.php" >' . get_lang('Back to user list') . '</a>'; $dialogBox = new DialogBox(); if ($cmd == 'exDelete' && $req['uidToEdit']) { $claroline->log('DELETE_USER', array('USER' => $req['uidToEdit'])); if (false !== ($deletionResult = user_delete($req['uidToEdit']))) { $dialogBox->success(get_lang('Deletion of the user was done sucessfully')); } else { switch (claro_failure::get_last_failure()) { case 'user_cannot_remove_himself': $dialogBox->error(get_lang('You can not change your own settings!')); break; default: $dialogBox->error(get_lang('Unable to delete')); } } } elseif ($cmd == 'rqDelete' && $req['uidToEdit']) { $user_properties = user_get_properties($req['uidToEdit']); if (is_array($user_properties)) { $dialogBox->question(get_lang('Are you sure to delete user %firstname %lastname', array('%firstname' => $user_properties['firstname'], '%lastname' => $user_properties['lastname'])) . '<br/><br/>' . "\n" . '<a href="adminuserdeleted.php?cmd=exDelete&uidToEdit=' . $req['uidToEdit'] . '">' . get_lang('Yes') . '</a>' . ' | ' . '<a href="admin_profile.php?uidToEdit=' . $req['uidToEdit'] . '">' . get_lang('No') . '</a>' . "\n"); } } else { $dialogBox->error(get_lang('Unable to delete')); } //------------------------------------ // DISPLAY
// clean exercise session vars unset($_SESSION['serializedExercise']); unset($_SESSION['serializedQuestionList']); unset($_SESSION['exeStartTime']); if (!empty($_REQUEST['copyFrom']) && $is_allowedToEdit) { $_SESSION['returnToTrackingUserId'] = (int) $_GET['copyFrom']; $copyError = false; //we could simply copy the requested module progression... //but since we can navigate between modules while completing a module, //we have to copy the whole learning path progression. if (!copyLearnPathProgression((int) $_SESSION['returnToTrackingUserId'], (int) claro_get_current_user_id(), (int) $_SESSION['path_id'])) { $copyError = true; } $dialogBox = new DialogBox(); if ($copyError) { $dialogBox->error(get_lang('An error occured while accessing student module')); $claroline->display->body->appendContent($dialogBox->render()); echo $claroline->display->render(); exit; } else { $user_data = user_get_properties((int) $_SESSION['returnToTrackingUserId']); $dialogBox->success(get_lang('Currently viewing module of ') . $user_data['firstname'] . ' ' . $user_data['lastname']); unset($user_data); } unset($copyError); } else { unset($_SESSION['returnToTrackingUserId']); } // main page // FIRST WE SEE IF USER MUST SKIP THE PRESENTATION PAGE OR NOT // triggers are : if there is no introdution text or no user module progression statistics yet and user is not admin,
if ($passwordFound) { /* * Prepare the email message wich has to be send to the user */ // mail subject $emailSubject = get_lang('Login request') . ' ' . get_conf('siteName'); $blockLoginInfo = ''; foreach ($userAccountList as $userAccount) { $blockLoginInfo .= get_block('blockLoginInfo', array('%firstname' => $userAccount['firstname'], '%lastname' => $userAccount['lastname'], '%username' => $userAccount['username'], '%password' => $userAccount['password'])); } $emailBody = get_block('blockLoginRequest', array('%siteName' => get_conf('siteName'), '%rootWeb' => get_path('rootWeb'), '%loginInfo' => $blockLoginInfo)); // send message if (claro_mail_user($userList[0]['uid'], $emailBody, $emailSubject)) { $dialogBox->success(get_lang('Your password has been emailed to') . ' : ' . $emailTo); } else { $dialogBox->error(get_lang('The system is unable to send you an e-mail.') . '<br />' . get_lang('Please contact') . ' : ' . '<a href="mailto:' . get_conf('administrator_email') . '?BODY=' . $emailTo . '">' . get_lang('Platform administrator') . '</a>'); } } } else { $dialogBox->error(get_lang('There is no user account with this email address.')); } if ($extAuthPasswordCount > 0) { if ($extAuthPasswordCount == count($userList)) { $dialogBox->warning(get_lang('Your password(s) is (are) recorded in an external authentication system outside the platform.')); } else { $dialogBox->warning(get_lang('Passwords of some of your user account(s) are recorded an in external authentication system outside the platform.')); } $dialogBox->info(get_lang('For more information take contact with the platform administrator.')); } } ////////////////////////////////////////////////////
$exId = (int) $item_list['2']; } else { $exId = null; } if ($cmd == 'download') { // find exercise informations $exercise = new Exercise(); if ($exercise->load($exId) || $is_allowedToEdit) { if ($exercise->getVisibility() == 'VISIBLE' || $is_allowedToEdit) { $question = new Question(); if ($question->load($quId)) { $attachmentFile = $question->getQuestionDirSys() . $question->getAttachment(); if (claro_send_file($attachmentFile)) { die; } else { $dialogBox->error(get_lang('Not found')); } } else { $dialogBox->error(get_lang('Not found')); } } else { $dialogBox->error(get_lang('Not allowed')); } } else { $dialogBox->error(get_lang('Not found')); } } // Not Found 404 header('HTTP/1.1 404 Not Found'); $out = ''; $out .= $dialogBox->render();
claro_disp_auth_form(); } if (!claro_is_platform_admin()) { claro_die(get_lang('Not allowed')); } /* ************************************************************************** */ /* Initialise variables and include libraries /* ************************************************************************** */ require_once get_path('incRepositorySys') . '/lib/configHtml.class.php'; require_once get_path('incRepositorySys') . '/lib/user.lib.php'; /* ************************************************************************** */ /* Process /* ************************************************************************** */ $form = ''; if (!isset($_REQUEST['config_code'])) { $dialogBox->error(get_lang('Wrong parameters')); } else { // get config_code $config_code = trim($_REQUEST['config_code']); $newPropertyList = isset($_REQUEST['property']) ? $_REQUEST['property'] : array(); // new config object $config = new ConfigHtml($config_code, 'config_list.php'); // load configuration if ($config->load()) { $section = isset($_REQUEST['section']) ? $_REQUEST['section'] : null; // display section menu $form .= $config->display_section_menu($section); // init config name $config_name = $config->get_conf_name(); if (isset($_REQUEST['cmd']) && !empty($newPropertyList)) { if ('save' == $_REQUEST['cmd']) {
$cmd = ''; } if (isset($_REQUEST['applyChange'])) { // Get params form the form $userData = user_initialise(); if (get_conf('allow_profile_picture', true)) { // Handle user picture $pictureUpdated = user_handle_profile_picture($userData); if ($pictureUpdated['success']) { $userData['picture'] = $pictureUpdated['pictureName']; foreach ($pictureUpdated['messages'] as $success) { $dialogBox->success($success); } } else { foreach ($pictureUpdated['messages'] as $error) { $dialogBox->error($error); } } } // Manage password if (empty($userData['password']) && empty($userData['password_conf'])) { unset($userData['password']); unset($userData['password_conf']); } if (empty($userData['authSource'])) { unset($userData['authSource']); } if (!get_conf('allowSelfRegProf') && !claro_is_platform_admin()) { unset($userData['isCourseCreator']); } if (!claro_is_platform_admin()) {
$nameTools = get_lang('User settings'); $dialogBox = new DialogBox(); // BC ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb')); $user_id = $_REQUEST['uidToEdit']; //------------------------------------ // Execute COMMAND section //------------------------------------ if (isset($_REQUEST['cmd']) && claro_is_platform_admin()) { if ($_REQUEST['cmd'] == 'UnReg') { if (user_remove_from_course($user_id, $_REQUEST['cidToEdit'], true, false)) { $dialogBox->success(get_lang('The user has been successfully unregistered')); } else { switch (claro_failure::get_last_failure()) { case 'cannot_unsubscribe_the_last_course_manager': $dialogBox->error(get_lang('You cannot unsubscribe the last course manager of the course')); break; case 'course_manager_cannot_unsubscribe_himself': $dialogBox->error(get_lang('Course manager cannot unsubscribe himself')); break; default: } } } } /** * PREPARE DISPLAY */ $cmdList[] = '<a class="claroCmd" href="index.php">' . get_lang('Back to administration page') . '</a>'; $cmdList[] = '<a class="claroCmd" href="adminusercourses.php?uidToEdit=' . $user_id . '">' . get_lang('Back to course list') . '</a>'; /**