Issue #306 - The UserManager class: Fixing an accidentally noticed issue related with getimagesize(), see http://www.dokeos.com/forum/viewtopic.php?t=16355 . Minir modification of the function get_lang() as it is needed for UserManager. Other minor changes.

skala
Ivan Tcholakov 16 years ago
parent adc74d7b26
commit cb1a44e1a2
  1. 4
      main/inc/lib/htmlpurifier/library/HTMLPurifier/Encoder.php
  2. 7
      main/inc/lib/internationalization.lib.php
  3. 16
      main/inc/lib/usermanager.lib.php

@ -289,7 +289,7 @@ class HTMLPurifier_Encoder
return $str;
}
// Added Ivan Tcholakov, 09-SEP-2009.
// Next try - encoding conversion related functions form Dokeos LMS,
// Next try - encoding conversion related functions from Dokeos LMS,
// for some encodings they work even without iconv or mbstring installed.
elseif (function_exists('api_is_encoding_supported')) {
if (api_is_encoding_supported($encoding)) {
@ -334,7 +334,7 @@ class HTMLPurifier_Encoder
return $str;
}
// Added Ivan Tcholakov, 09-SEP-2009.
// Next try - encoding conversion related functions form Dokeos LMS,
// Next try - encoding conversion related functions from Dokeos LMS,
// for some encodings they work even without iconv or mbstring installed.
elseif (function_exists('api_is_encoding_supported')) {
if (api_is_encoding_supported($encoding)) {

@ -126,7 +126,12 @@ function get_lang($variable, $notrans = 'DLTT', $language = null) {
$ot = '[='; // opening tag for missing vars
$ct = '=]'; // closing tag for missing vars
if (api_get_setting('hide_dltt_markup') == 'true') {
if (api_get_setting('hide_dltt_markup') == 'true' || !$dltt) {
// The opening and closing tags do not show up in these two cases:
// 1. when the special setting hide_dltt_markup "says" so;
// 2. when showing the DLTT link (on untranslated variable) is intentionaly suppressed by a developer
// using the input parameter $notrans, i.e. when the function is called in this way: get_lang('MyText', '')
// This behaviour is valid for test and production server modes.
$ot = '';
$ct = '';
}

@ -243,8 +243,9 @@ class UserManager {
if ($_configuration['multiple_access_urls']) {
require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
$url_id = 1;
if (api_get_current_access_url_id()!=-1)
if (api_get_current_access_url_id() != -1) {
$url_id = api_get_current_access_url_id();
}
UrlManager::delete_url_rel_user($user_id, $url_id);
}
@ -476,6 +477,7 @@ class UserManager {
}
return $return_array;
}
/**
* Get a list of users of which the given conditions match with a LIKE '%cond%'
* @param array $conditions a list of condition (exemple : status=>STUDENT)
@ -505,7 +507,6 @@ class UserManager {
return $return_array;
}
/**
* Get user information
* @param string The username
@ -564,6 +565,7 @@ class UserManager {
* @param array Content the list ID of user_id selected
*/
//for survey
// TODO: Ivan, 14-SEP-2009: It seems that this method is not used at all (it can be located in a test unit only. To be deprecated?
public static function get_teacher_list($course_id, $sel_teacher = '') {
$user_course_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$user_table = Database :: get_main_table(TABLE_MAIN_USER);
@ -949,6 +951,7 @@ class UserManager {
2 => $rowf['field_type'],
//3 => (empty($rowf['field_display_text']) ? '' : get_lang($rowf['field_display_text'], '')),
// Temporarily removed auto-translation. Need update to get_lang() to know if translation exists (todo)
// Ivan, 15-SEP-2009: get_lang() has been modified accordingly in order this issue to be solved.
3 => (empty($rowf['field_display_text']) ? '' : $rowf['field_display_text']),
4 => $rowf['field_default_value'],
5 => $rowf['field_order'],
@ -1880,10 +1883,10 @@ class UserManager {
*/
public static function resize_picture($file, $max_size_for_picture) {
if (!class_exists('image')) {
require_once(api_get_path(LIBRARY_PATH).'image.lib.php');
require_once api_get_path(LIBRARY_PATH).'image.lib.php';
}
$temp = new image($file);
$picture_infos = getimagesize($file); // TODO: Unsafe call when $file is URL actually.
$picture_infos = @getimagesize(api_url_to_local_path($file));
if ($picture_infos[0] > $max_size_for_picture) {
$thumbwidth = $max_size_for_picture;
if (empty($thumbwidth) or $thumbwidth == 0) {
@ -1945,11 +1948,10 @@ class UserManager {
* @param string The content message
*/
public static function send_message_in_outbox($email_administrator, $user_id, $title, $content) {
global $charset;
$table_message = Database::get_main_table(TABLE_MESSAGE);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$title = api_convert_encoding($title, $charset, 'UTF-8');
$content = api_convert_encoding($content, $charset, 'UTF-8');
$title = api_utf8_decode($title);
$content = api_utf8_decode($content);
//message in inbox
$sql_message_outbox = 'SELECT user_id from '.$table_user.' WHERE email="'.$email_administrator.'" ';
//$num_row_query = Database::num_rows($sql_message_outbox);

Loading…
Cancel
Save