/** * notify by email the user of the reception of a message * * @param array of int: $userDataList user identificatin list * @param MessageToSend $message message envoy� * @param int $messageId identification of the message * */ public function notify($userDataList, $message, $messageId) { if (!get_conf('mailNotification', TRUE)) { return; } // sender name and email if ($message->getSender() == 0) { $userData = array('mail' => get_conf('no_reply_mail') ? get_conf('no_reply_mail') : get_conf('administrator_email'), 'firstName' => get_lang('Message from %platformName', array('%platformName' => get_conf('siteName'))), 'lastName' => ''); } else { $userData = claro_get_current_user_data(); } //************************************ IS MANAGER $stringManager = false; $courseManagers = claro_get_course_manager_id($message->getCourseCode()); $nbrOfManagers = count($courseManagers); for ($countManager = 0; $countManager < $nbrOfManagers; $countManager++) { if ($message->getSender() == $courseManagers[$countManager]) { $courseData = claro_get_course_data($message->getCourseCode()); $stringManager = get_block('Course manager of %course%(%courseCode%)', array('%course%' => $courseData['name'], '%courseCode%' => $courseData['officialCode'])); } } //---------------------- email subject $emailSubject = '[' . get_conf('siteName'); if (!is_null($message->getCourseCode())) { $courseData = claro_get_course_data($message->getCourseCode()); if ($courseData) { $emailSubject .= ' - ' . $courseData['officialCode']; } } $emailSubject .= '] ' . $message->getSubject(); //------------------------------subject /* $altBody = get_lang('If you can\'t read this message go to: ') . rtrim( get_path('rootWeb'), '/' ) . '/claroline/messaging/readmessage.php?messageId=' . $messageId . '&type=received' . "\n\n" . '-- ' . claro_get_current_user_data('lastName') . " " . claro_get_current_user_data('firstName') . "\n" . $stringManager . "\n\n" . get_conf('siteName') ." <" . get_conf('rootWeb') . '>' . "\n" . ' ' . get_lang('Administrator') . ' : ' . get_conf('administrator_name') . ' <' . get_conf('administrator_email') . '>' . "\n" ; */ //-------------------------BODY $msgContent = claro_parse_user_text($message->getMessage()); $urlAppend = get_path('url'); if (!empty($urlAppend)) { $msgContent = preg_replace('!href="' . get_path('url') . '!', 'href="' . rtrim(get_path('rootWeb'), '/') . '/', $msgContent); $msgContent = preg_replace('!\\>' . get_path('url') . '!', '>' . get_path('rootWeb'), $msgContent); } else { $msgContent = preg_replace('!href="/!', 'href="' . rtrim(get_path('rootWeb'), '/') . '/', $msgContent); } $emailBody = "<html><head></head><body>" . $msgContent . '<br /><br />' . '-- <br />' . get_lang('%firstName %lastName', array('%firstName' => $userData['firstName'], '%lastName' => $userData['lastName'])) . "<br />" . $stringManager . '<br /><br /><a href="' . get_conf('rootWeb') . '">' . get_conf('siteName') . '</a><br />' . ' ' . get_lang('Administrator') . ': <a href="mailto:' . get_conf('administrator_email') . '">' . get_conf('administrator_name') . '</a><br />' . '</body></html>'; //******************************** END BODY //****************************************** if (empty($userData['mail']) || !is_well_formed_email_address($userData['mail'])) { // do not send email for a user with no mail address pushClaroMessage('Mail Notification Failed : User has no email or an invalid one : ' . var_export($userData, true) . '!'); return claro_failure::set_failure(get_lang("Mail Notification Failed : You don't have any email address defined in your user profile or the defined email address is not valid.")); } self::emailNotification($userDataList, $emailBody, $emailSubject, $userData['mail'], get_lang('%firstName %lastName', array('%firstName' => $userData['firstName'], '%lastName' => $userData['lastName']))); }
/** * Returns the data of the current user. * @webservice{/module/MOBILE/User/getUserData} * @ws_arg{Method,getUserData} * @return array of string */ function getUserData() { $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://"; $userData = claro_get_current_user_data(); //Bug fix for kernel bug, into user_get_picture_***() into user.lib. Bad index ? $userData['user_id'] = $userData['userId']; $userData['picture'] = $protocol . $_SERVER['SERVER_NAME'] . user_get_picture_url($userData); unset($userData['authSource'], $userData['creatorId'], $userData['lastLogin'], $userData['mail'], $userData['officialEmail'], $userData['phone']); $userData['platformName'] = get_conf('siteName', "Claroline"); $userData['institutionName'] = get_conf('institution_name', ""); return $userData; }
if (!claro_is_in_a_course() || !claro_is_course_allowed()) { claro_disp_auth_form(true); } require_once './lib/assignment.class.php'; include_once get_path('incRepositorySys') . '/lib/fileManage.lib.php'; include_once get_path('incRepositorySys') . '/lib/pager.lib.php'; include_once get_path('incRepositorySys') . '/lib/group.lib.inc.php'; $tbl_mdb_names = claro_sql_get_main_tbl(); $tbl_user = $tbl_mdb_names['user']; $tbl_rel_course_user = $tbl_mdb_names['rel_course_user']; $tbl_cdb_names = claro_sql_get_course_tbl(); $tbl_wrk_submission = $tbl_cdb_names['wrk_submission']; $tbl_group_team = $tbl_cdb_names['group_team']; $tbl_group_rel_team_user = $tbl_cdb_names['group_rel_team_user']; $currentUserFirstName = claro_get_current_user_data('firstName'); $currentUserLastName = claro_get_current_user_data('lastName'); // 'step' of pager $usersPerPage = get_conf('usersPerPage', 20); // use viewMode claro_set_display_mode_available(true); /*============================================================================ Basic Variables Definitions ============================================================================*/ $fileAllowedSize = get_conf('max_file_size_per_works'); //file size in bytes (from config file) $maxFilledSpace = get_conf('maxFilledSpace', 100000000); // initialise dialog box to an empty string, all dialog will be concat to it $dialogBox = new DialogBox(); /*============================================================================ Clean informations sent by user ============================================================================*/
if (delete_post($postId, $topicSettingList['topic_id'], $forumSettingList['forum_id'])) { $dialogBox->success('Post successfully deleted'); } else { $dialogBox->error('Error while deleting post'); } $cmd = 'show'; } elseif ('exSavePost' == $cmd) { $error = false; //this test should be handled by a "html not empty" validator if (trim(strip_tags($message, '<img><audio><video><embed><object><canvas><iframe>')) == '') { $dialogBox->error(get_lang('You cannot post an empty message')); $error = true; } else { // USER $userLastname = $is_post_anonymous ? 'anonymous' : claro_get_current_user_data('lastName'); $userFirstname = $is_post_anonymous ? '' : claro_get_current_user_data('firstName'); $poster_ip = $_SERVER['REMOTE_ADDR']; $time = date('Y-m-d H:i'); // record new topic if required if ('add' == $editMode) { if ('' == $subject) { $dialogBox->error(get_lang('Subject cannot be empty')); $error = true; } if (!$error) { $topicId = create_new_topic($subject, $time, $forumId, claro_get_current_user_id(), $userFirstname, $userLastname); if (false !== $topicId) { $eventNotifier->notifyCourseEvent('forum_new_topic', claro_get_current_course_id(), claro_get_current_tool_id(), $forumId . '-' . $topicId, claro_get_current_group_id(), 0); $dialogBox->success('Your topic has been recorded'); // send message to user registered for notifications of new topics in this forum trig_forum_notification($forumId);
* * @version $Revision: 14314 $ * @copyright (c) 2001-2011, Universite catholique de Louvain (UCL) * @copyright (c) 2001 The phpBB Group * @author Claroline Team <*****@*****.**> * @author FUNDP - WebCampus <*****@*****.**> * @license http://www.gnu.org/copyleft/gpl.html * GNU GENERAL PUBLIC LICENSE version 2 or later * @package CLFRM */ $tlabelReq = 'CLFRM'; require '../inc/claro_init_global.inc.php'; require_once get_path('incRepositorySys') . '/lib/forum.lib.php'; require_once get_path('incRepositorySys') . '/lib/group.lib.inc.php'; require_once get_path('incRepositorySys') . '/lib/user.lib.php'; $last_visit = claro_get_current_user_data('lastLogin'); $is_groupPrivate = claro_get_current_group_properties_data('private'); $is_allowedToEdit = claro_is_allowed_to_edit(); if (!claro_is_in_a_course() || !claro_is_course_allowed()) { claro_disp_auth_form(true); } if (isset($_REQUEST['searchUser'])) { $sqlClauseString = ' p.poster_id = ' . (int) $_REQUEST['searchUser']; } elseif (isset($_REQUEST['searchPattern'])) { $searchPatternString = trim($_REQUEST['searchPattern']); if ($searchPatternString != '') { $searchPatternList = explode(' ', $searchPatternString); $sqlClauseList = ''; foreach ($searchPatternList as $thisSearchPattern) { $thisSearchPattern = str_replace('_', '\\_', $thisSearchPattern); $thisSearchPattern = str_replace('%', '\\%', $thisSearchPattern);
/** * @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(); } }
if ($failure = claro_failure::get_last_failure()) { $dialogBox->error($failure); } else { $dialogBox->error(get_lang('Impossible to add the announcement')); } $emailOption = 0; } } else { $dialogBox->error(get_lang('The "visible from" date can\'t exceed the "visible until" date')); $emailOption = 0; } } // end elseif cmd == exCreate // Email sending (optionnal) if (1 == $emailOption) { $courseSender = claro_get_current_user_data('firstName') . ' ' . claro_get_current_user_data('lastName'); $courseOfficialCode = claro_get_current_course_data('officialCode'); $subject = ''; if (!empty($title)) { $subject .= $title; } else { $subject .= get_lang('Message from your lecturer'); } $msgContent = $content; // Enclosed resource $body = $msgContent . "\n" . "\n" . ResourceLinker::renderLinkList($currentLocator, true); require_once dirname(__FILE__) . '/../messaging/lib/message/messagetosend.lib.php'; require_once dirname(__FILE__) . '/../messaging/lib/recipient/courserecipient.lib.php'; $courseRecipient = new CourseRecipient(claro_get_current_course_id()); $message = new MessageToSend(claro_get_current_user_id(), $subject, $body); $message->setCourse(claro_get_current_course_id());
* */ // CLAROLINE INIT $tlabelReq = 'CLCHT'; // required require '../inc/claro_init_global.inc.php'; if (!claro_is_in_a_course() || !claro_is_course_allowed() && !claro_is_user_authenticated()) { die('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">' . "\n" . '<html>' . "\n" . '<head>' . "\n" . '<title>' . get_lang('Chat') . '</title>' . "\n" . '</head>' . "\n" . '<body>' . "\n" . "\n" . '<a href="./chat.php" >click</a>' . "\n" . '</body>' . "\n" . "\n"); } /*============================================================================ CONNECTION BLOC ============================================================================*/ $coursePath = get_path('coursesRepositorySys') . claro_get_course_path(); $courseId = claro_get_current_course_id(); $groupId = claro_get_current_group_id(); $_user = claro_get_current_user_data(); $_course = claro_get_current_course_data(); $_group = claro_get_current_group_data(); $is_allowedToManage = claro_is_course_manager(); $is_allowedToStore = claro_is_course_manager(); $is_allowedToReset = claro_is_course_manager(); if ($_user['firstName'] == '' && $_user['lastName'] == '') { $nick = get_lang('Anonymous'); } else { $nick = $_user['firstName'] . ' ' . $_user['lastName']; if (strlen($nick) > get_conf('max_nick_length')) { $nick = $_user['firstName'] . ' ' . $_user['lastName'][0] . '.'; } } // theses line prevent missing config file $refresh_display_rate = get_conf('refresh_display_rate', 10);
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 $userLastname = claro_get_current_user_data('lastName'); $userFirstname = claro_get_current_user_data('firstName'); $poster_ip = $_SERVER['REMOTE_ADDR']; $time = date('Y-m-d H:i'); // prevent to go further if the fields are actually empty if (strip_tags($message) == '' || $subject == '') { $dialogBox->error(get_lang('You cannot post an empty message')); $error = TRUE; } if (!$error) { // record new topic $topic_id = create_new_topic($subject, $time, $forum_id, claro_get_current_user_id(), $userFirstname, $userLastname); if ($topic_id) { create_new_post($topic_id, $forum_id, claro_get_current_user_id(), $time, $poster_ip, $userLastname, $userFirstname, $message); } // notify eventmanager that a new message has been posted $eventNotifier->notifyCourseEvent('forum_new_topic', claro_get_current_course_id(), claro_get_current_tool_id(), $forum_id . "-" . $topic_id, claro_get_current_group_id(), 0);
// $Id: course_install.php 13708 2011-10-19 10:46:34Z abourguignon $ // vim: expandtab sw=4 ts=4 sts=4: if (count(get_included_files()) == 1) { die('The file ' . basename(__FILE__) . ' cannot be accessed directly, use include instead'); } ############################## FORUMS ####################################### $TABLEPHPBBCATEGORIES = $moduleCourseTblList['bb_categories']; // "bb_categories"; claro_sql_query("INSERT INTO `" . $TABLEPHPBBCATEGORIES . "` VALUES (2,'" . claro_sql_escape(get_lang('sampleForumMainCategory')) . "',1)"); // Create a hidden category for group forums claro_sql_query("INSERT INTO `" . $TABLEPHPBBCATEGORIES . "` VALUES (1,'" . claro_sql_escape(get_lang('sampleForumGroupCategory')) . "',2)"); if (get_conf('fill_course_example', true)) { // Create an example category $lastname = claro_get_current_user_data('lastName'); $firstname = claro_get_current_user_data('firstName'); $email = claro_get_current_user_data('mail'); $TABLEPHPBBFORUMS = $moduleCourseTblList['bb_forums']; // "bb_forums"; $TABLEPHPBBPOSTS = $moduleCourseTblList['bb_posts']; // "bb_posts"; $TABLEPHPBBPOSTSTEXT = $moduleCourseTblList['bb_posts_text']; // "bb_posts_text"; $TABLEPHPBBTOPICS = $moduleCourseTblList['bb_topics']; // "bb_topics"; $TABLEPHPBBUSERS = $moduleCourseTblList['bb_users']; // "bb_users"; claro_sql_query("INSERT\n INTO `" . $TABLEPHPBBFORUMS . "`\n VALUES ( 1\n , NULL\n , '" . claro_sql_escape(get_lang('sampleForumTitle')) . "'\n , '" . claro_sql_escape(get_lang('sampleForumDescription')) . "'\n ,2,1,1,1,1,2,0,1)"); claro_sql_query("INSERT INTO `" . $TABLEPHPBBTOPICS . "` VALUES (1,'" . claro_sql_escape(get_lang('sampleForumTopicTitle')) . "',-1,NOW(),1,0,1,1,'0','1', '" . addslashes($lastname) . "', '" . claro_sql_escape($firstname) . "')"); claro_sql_query("INSERT INTO `" . $TABLEPHPBBPOSTS . "` VALUES (1,1,1,1,NOW(),'127.0.0.1',\"" . claro_sql_escape($lastname) . "\",\"" . claro_sql_escape($firstname) . "\")"); claro_sql_query("INSERT INTO `" . $TABLEPHPBBPOSTSTEXT . "` VALUES ('1', '" . claro_sql_escape(get_lang('sampleForumMessage')) . "')"); // Contenu de la table 'users'
/** * @param int $user_id * @return string */ public function getLastActionBeforeLoginDate($user_id) { $tbl_mdb_names = claro_sql_get_main_tbl(); $tbl_rel_course_user = $tbl_mdb_names['rel_course_user']; $_user = claro_get_current_user_data(); //if we already knwo in session what is the last action date, just retrieve it from the session if (isset($_SESSION['last_action'])) { return $_SESSION['last_action']; } //otherwise we must find it in the access statistics information of the database $last_login_date = date("Y-m-d H:i:s", $_user['lastLogin']); // 1 - retriev course list in which the user is subscribed $sql = "SELECT `code_cours`\n FROM `" . $tbl_rel_course_user . "` AS CU\n WHERE CU.`user_id`='" . (int) $user_id . "'"; $courses = claro_sql_query_fetch_all($sql); // 2 - retrieve each max(date) of acces for each date $last_action_date = "0000-00-00 00:00:00"; //set default last action date //look for last action date in every tracking table of courses where the user is registered foreach ($courses as $course) { $tbl_c_names = claro_sql_get_course_tbl(claro_get_course_db_name_glued($course['code_cours'])); $tbl_course_tracking_event = $tbl_c_names['tracking_event']; $sqlMaxDate = "SELECT MAX(`date`) AS MAXDATE\n FROM `" . $tbl_course_tracking_event . "` AS STAT,\n `" . $tbl_rel_course_user . "` AS CU\n WHERE `type` = 'course_access'\n AND STAT.`user_id` = " . (int) $user_id . "\n AND STAT.`user_id` = CU.`user_id`\n AND CU.`user_id` = " . (int) $user_id; $maxDate = claro_sql_query_get_single_value($sqlMaxDate); if ($maxDate && strtotime($maxDate) > strtotime($last_action_date)) { $last_action_date = $maxDate; } } // return (and save in session) the latest action : // last login or latest action in the tracking tables if (strtotime($last_action_date) > strtotime($last_login_date)) { $_SESSION['last_action'] = $last_action_date; return $last_action_date; } else { $_SESSION['last_action'] = $last_login_date; return $last_login_date; } }
} if (!file_exists($cache_options['cacheDir'])) { include_once get_path('incRepositorySys') . '/lib/fileManage.lib.php'; claro_mkdir($cache_options['cacheDir'], CLARO_FILE_PERMISSIONS, true); } $Cache_LiteCLCALDIGEST = new Cache_Lite($cache_options); $courseDigestList = array('courseSysCode' => array(), 'courseOfficialCode' => array(), 'toolLabel' => array(), 'date' => array(), 'content' => array()); if (false === ($htmlCLCALDIGEST = $Cache_LiteCLCALDIGEST->get('CALDIGEST' . claro_get_current_user_id()))) { $personnalCourseList = get_user_course_list(claro_get_current_user_id()); foreach ($personnalCourseList as $thisCourse) { /* * ANNOUNCEMENTS : get announcements of this course since last user loggin */ if (is_tool_activated_in_course(get_tool_id_from_module_label('CLANN'), $thisCourse['sysCode'])) { $tableAnn = get_conf('courseTablePrefix') . $thisCourse['db'] . get_conf('dbGlu') . 'announcement'; $sql = "SELECT '" . claro_sql_escape($thisCourse['sysCode']) . "' AS `courseSysCode`,\n '" . claro_sql_escape($thisCourse['officialCode']) . "' AS `courseOfficialCode`,\n 'CLANN' AS `toolLabel`,\n CONCAT(`temps`, ' ', '00:00:00') AS `date`,\n CONCAT(`title`,' - ',`contenu`) AS `content`\n \n FROM `" . $tableAnn . "`\n WHERE CONCAT(`title`, `contenu`) != ''\n AND DATE_FORMAT( `temps`, '%Y %m %d') >= '" . date('Y m d', claro_get_current_user_data('lastLogin')) . "'\n AND visibility = 'SHOW'\n ORDER BY `date` DESC\n LIMIT 1"; $resultList = claro_sql_query_fetch_all_cols($sql); foreach ($resultList as $colName => $colValue) { if (count($colValue) == 0) { break; } $courseDigestList[$colName] = array_merge($courseDigestList[$colName], $colValue); } } /* * AGENDA : get the next agenda entries of this course from now */ if (is_tool_activated_in_course(get_tool_id_from_module_label('CLCAL'), $thisCourse['sysCode'])) { $tableCal = get_conf('courseTablePrefix') . $thisCourse['db'] . get_conf('dbGlu') . 'calendar_event'; $sql = "SELECT '" . claro_sql_escape($thisCourse['sysCode']) . "' AS `courseSysCode`,\n '" . claro_sql_escape($thisCourse['officialCode']) . "' AS `courseOfficialCode`,\n 'CLCAL' AS `toolLabel`,\n CONCAT(`day`, ' ',`hour`) AS `date`,\n CONCAT(`titre`,' - ',`contenu`) AS `content`\n FROM `" . $tableCal . "`\n \n WHERE CONCAT(`day`, ' ',`hour`) >= CURDATE()\n AND CONCAT(`titre`, `contenu`) != ''\n AND visibility = 'SHOW'\n \n ORDER BY `date`\n LIMIT 1"; $resultList = claro_sql_query_fetch_all_cols($sql);
/** * Current logged user send a mail to ask course creator status * @param string explanation message * @author Mathieu Laurent <*****@*****.**> */ function profile_send_request_revoquation($explanation, $login, $password) { if (empty($explanation)) { return claro_failure::set_failure('EXPLANATION_EMPTY'); } require_once dirname(__FILE__) . '/../../messaging/lib/message/messagetosend.lib.php'; require_once dirname(__FILE__) . '/../../messaging/lib/recipient/userlistrecipient.lib.php'; $_user = claro_get_current_user_data(); $mailToUidList = claro_get_uid_of_request_admin(); if (empty($mailToUidList)) { $mailToUidList = claro_get_uid_of_platform_admin(); } $requestMessage_Title = get_block('Revocation of %firstname %lastname', array('%firstname' => $_user['firstName'], '%lastname' => $_user['lastName'])); $requestMessage_Content = nl2br(get_block('blockRequestUserRevoquationMail', array('%time' => claro_html_localised_date(get_locale('dateFormatLong')), '%user_id' => claro_get_current_user_id(), '%firstname' => $_user['firstName'], '%lastname' => $_user['lastName'], '%email' => $_user['mail'], '%login' => $login, '%password' => '**********', '%comment' => nl2br($explanation), '%url' => rtrim(get_path('rootWeb'), '/') . '/claroline/admin/admin_profile.php?uidToEdit=' . claro_get_current_user_id()))); $message = new MessageToSend(claro_get_current_user_id(), $requestMessage_Title, $requestMessage_Content); $recipient = new UserListRecipient(); $recipient->addUserIdList($mailToUidList); $recipient->sendMessage($message); return true; }