mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 20:50:21 +01:00
MDL-38654 do not test $CFG->gdversion
GD PHP extension is now required. Add-ons need to remove $CFG->gdversion tests. The worst case regression is that add-on will think GD is not available.
This commit is contained in:
parent
373a8e052c
commit
689096bc26
@ -7,9 +7,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
// "systempaths" settingpage
|
||||
$temp = new admin_settingpage('systempaths', new lang_string('systempaths','admin'));
|
||||
$temp->add(new admin_setting_configselect('gdversion', new lang_string('gdversion','admin'), new lang_string('configgdversion', 'admin'), check_gd_version(), array('0' => new lang_string('gdnot'),
|
||||
'1' => new lang_string('gd1'),
|
||||
'2' => new lang_string('gd2'))));
|
||||
|
||||
$temp->add(new admin_setting_configexecutable('pathtodu', new lang_string('pathtodu', 'admin'), new lang_string('configpathtodu', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configexecutable('aspellpath', new lang_string('aspellpath', 'admin'), new lang_string('edhelpaspellpath'), ''));
|
||||
$temp->add(new admin_setting_configexecutable('pathtodot', new lang_string('pathtodot', 'admin'), new lang_string('pathtodot_help', 'admin'), ''));
|
||||
|
@ -67,13 +67,11 @@ class group_form extends moodleform {
|
||||
$mform->addHelpButton('enrolmentkey', 'enrolmentkey', 'group');
|
||||
$mform->setType('enrolmentkey', PARAM_RAW);
|
||||
|
||||
if (!empty($CFG->gdversion)) {
|
||||
$options = array(get_string('no'), get_string('yes'));
|
||||
$mform->addElement('select', 'hidepicture', get_string('hidepicture'), $options);
|
||||
$options = array(get_string('no'), get_string('yes'));
|
||||
$mform->addElement('select', 'hidepicture', get_string('hidepicture'), $options);
|
||||
|
||||
$mform->addElement('filepicker', 'imagefile', get_string('newpicture', 'group'));
|
||||
$mform->addHelpButton('imagefile', 'newpicture', 'group');
|
||||
}
|
||||
$mform->addElement('filepicker', 'imagefile', get_string('newpicture', 'group'));
|
||||
$mform->addHelpButton('imagefile', 'newpicture', 'group');
|
||||
|
||||
$mform->addElement('hidden','id');
|
||||
$mform->setType('id', PARAM_INT);
|
||||
|
@ -324,20 +324,18 @@ function groups_update_group_icon($group, $data, $editform) {
|
||||
$context = context_course::instance($group->courseid, MUST_EXIST);
|
||||
|
||||
//TODO: it would make sense to allow picture deleting too (skodak)
|
||||
if (!empty($CFG->gdversion)) {
|
||||
if ($iconfile = $editform->save_temp_file('imagefile')) {
|
||||
if (process_new_icon($context, 'group', 'icon', $group->id, $iconfile)) {
|
||||
$DB->set_field('groups', 'picture', 1, array('id'=>$group->id));
|
||||
$group->picture = 1;
|
||||
} else {
|
||||
$fs->delete_area_files($context->id, 'group', 'icon', $group->id);
|
||||
$DB->set_field('groups', 'picture', 0, array('id'=>$group->id));
|
||||
$group->picture = 0;
|
||||
}
|
||||
@unlink($iconfile);
|
||||
// Invalidate the group data as we've updated the group record.
|
||||
cache_helper::invalidate_by_definition('core', 'groupdata', array(), array($group->courseid));
|
||||
if ($iconfile = $editform->save_temp_file('imagefile')) {
|
||||
if (process_new_icon($context, 'group', 'icon', $group->id, $iconfile)) {
|
||||
$DB->set_field('groups', 'picture', 1, array('id'=>$group->id));
|
||||
$group->picture = 1;
|
||||
} else {
|
||||
$fs->delete_area_files($context->id, 'group', 'icon', $group->id);
|
||||
$DB->set_field('groups', 'picture', 0, array('id'=>$group->id));
|
||||
$group->picture = 0;
|
||||
}
|
||||
@unlink($iconfile);
|
||||
// Invalidate the group data as we've updated the group record.
|
||||
cache_helper::invalidate_by_definition('core', 'groupdata', array(), array($group->courseid));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,6 @@ $string['configforceloginforprofiles'] = 'This setting forces people to login as
|
||||
$string['configfrontpage'] = 'The items selected above will be displayed on the site\'s front page.';
|
||||
$string['configfrontpageloggedin'] = 'The items selected above will be displayed on the site\'s front page when a user is logged in.';
|
||||
$string['configfullnamedisplay'] = 'This defines how names are shown when they are displayed in full. For most mono-lingual sites the most efficient setting is "First name + Surname", but you may choose to hide surnames altogether, or to leave it up to the current language pack to decide (some languages have different conventions).';
|
||||
$string['configgdversion'] = 'Indicate the version of GD that is installed. The version shown by default is the one that has been auto-detected. Don\'t change this unless you really know what you\'re doing.';
|
||||
$string['configgeoipfile'] = 'Location of GeoIP City binary data file. This file is not part of Moodle distribution and must be obtained separately from <a href="http://www.maxmind.com/">MaxMind</a>. You can either buy a commercial version or use the free version.<br />Simply download <a href="http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz" >http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz</a> and extract it into "{$a}" directory on your server.';
|
||||
$string['configgetremoteaddrconf'] = 'If your server is behind a reverse proxy, you can use this setting to specify which HTTP headers can be trusted to contain the remote IP address. The headers are read in order, using the first one that is available.';
|
||||
$string['configgradebookroles'] = 'This setting allows you to control who appears on the gradebook. Users need to have at least one of these roles in a course to be shown in the gradebook for that course.';
|
||||
@ -546,7 +545,6 @@ $string['frontpageroles'] = 'Front page roles';
|
||||
$string['frontpagesettings'] = 'Front page settings';
|
||||
$string['fullnamedisplay'] = 'Full name format';
|
||||
$string['gdrecommended'] = 'GD extension is used for conversion of images, some features such as user profile images will not be available if missing.';
|
||||
$string['gdversion'] = 'GD version';
|
||||
$string['generalsettings'] = 'General settings';
|
||||
$string['geoipfile'] = 'GeoIP city data file';
|
||||
$string['getremoteaddrconf'] = 'Logged IP address source';
|
||||
|
@ -226,18 +226,6 @@ $string['fileuploadshelp'] = '<p>File uploading seems to be disabled on your ser
|
||||
<p>To enable file uploading you (or your system administrator) will need to
|
||||
edit the main php.ini file on your system and change the setting for
|
||||
<b>file_uploads</b> to \'1\'.</p>';
|
||||
$string['gdversion'] = 'GD version';
|
||||
$string['gdversionerror'] = 'The GD library should be present to process and create images';
|
||||
$string['gdversionhelp'] = '<p>Your server does not seem to have GD installed.</p>
|
||||
|
||||
<p>GD is a library that is required by PHP to allow Moodle to process images
|
||||
(such as the user profile icons) and to create new images (such as
|
||||
the log graphs). Moodle will still work without GD - these features
|
||||
will just not be available to you.</p>
|
||||
|
||||
<p>To add GD to PHP under Unix, compile PHP using the --with-gd parameter.</p>
|
||||
|
||||
<p>Under Windows you can usually edit php.ini and uncomment the line referencing php_gd2.dll.</p>';
|
||||
$string['globalsquotes'] = 'Insecure handling of globals';
|
||||
$string['globalsquoteserror'] = 'Fix your PHP settings: disable register_globals and/or enable magic_quotes_gpc';
|
||||
$string['globalsquoteshelp'] = '<p>Combination of disabled magic quotes GPC and enabled register globals both at the same time is not recommended.</p>
|
||||
|
@ -731,10 +731,6 @@ $string['fullnameuser'] = 'User full name';
|
||||
$string['fullprofile'] = 'Full profile';
|
||||
$string['fullsitename'] = 'Full site name';
|
||||
$string['functiondisabled'] = 'That functionality is currently disabled';
|
||||
$string['gdneed'] = 'GD must be installed to see this graph';
|
||||
$string['gdnot'] = 'GD is not installed';
|
||||
$string['gd1'] = 'GD 1.x is installed';
|
||||
$string['gd2'] = 'GD 2.x is installed';
|
||||
$string['general'] = 'General';
|
||||
$string['geolocation'] = 'latitude - longitude';
|
||||
$string['gettheselogs'] = 'Get these logs';
|
||||
|
@ -1756,5 +1756,12 @@ function xmldb_main_upgrade($oldversion) {
|
||||
// No savepoint needed for this change.
|
||||
}
|
||||
|
||||
if ($oldversion < 2013032200.01) {
|
||||
// GD is now always available
|
||||
unset_config('gdversion');
|
||||
|
||||
upgrade_main_savepoint(true, 2013032200.01);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -30,6 +30,51 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Hack to find out the GD version by parsing phpinfo output
|
||||
*
|
||||
* @return int GD version (1, 2, or 0)
|
||||
*/
|
||||
function check_gd_version() {
|
||||
// TODO: delete function in Moodle 2.7
|
||||
debugging('check_gd_version() is deprecated, GD extension is always available now');
|
||||
|
||||
$gdversion = 0;
|
||||
|
||||
if (function_exists('gd_info')){
|
||||
$gd_info = gd_info();
|
||||
if (substr_count($gd_info['GD Version'], '2.')) {
|
||||
$gdversion = 2;
|
||||
} else if (substr_count($gd_info['GD Version'], '1.')) {
|
||||
$gdversion = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
ob_start();
|
||||
phpinfo(INFO_MODULES);
|
||||
$phpinfo = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$phpinfo = explode("\n", $phpinfo);
|
||||
|
||||
|
||||
foreach ($phpinfo as $text) {
|
||||
$parts = explode('</td>', $text);
|
||||
foreach ($parts as $key => $val) {
|
||||
$parts[$key] = trim(strip_tags($val));
|
||||
}
|
||||
if ($parts[0] == 'GD Version') {
|
||||
if (substr_count($parts[1], '2.0')) {
|
||||
$parts[1] = '2.0';
|
||||
}
|
||||
$gdversion = intval($parts[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $gdversion; // 1, 2 or 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Not used any more, the account lockout handling is now
|
||||
* part of authenticate_user_login().
|
||||
|
@ -67,10 +67,6 @@ class filestoragelib_testcase extends advanced_testcase {
|
||||
public function test_get_file_preview(stored_file $file) {
|
||||
global $CFG;
|
||||
|
||||
if (empty($CFG->gdversion)) {
|
||||
$this->markTestSkipped('GD extension is disabled');
|
||||
}
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
$fs = get_file_storage();
|
||||
|
||||
|
@ -48,7 +48,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function imagecopybicubic($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) {
|
||||
global $CFG;
|
||||
|
||||
if (function_exists('imagecopyresampled') and $CFG->gdversion >= 2) {
|
||||
if (function_exists('imagecopyresampled')) {
|
||||
return imagecopyresampled($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y,
|
||||
$dst_w, $dst_h, $src_w, $src_h);
|
||||
}
|
||||
@ -100,10 +100,6 @@ function imagecopybicubic($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $d
|
||||
function process_new_icon($context, $component, $filearea, $itemid, $originalfile) {
|
||||
global $CFG;
|
||||
|
||||
if (empty($CFG->gdversion)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_file($originalfile)) {
|
||||
return false;
|
||||
}
|
||||
@ -169,7 +165,7 @@ function process_new_icon($context, $component, $filearea, $itemid, $originalfil
|
||||
return false;
|
||||
}
|
||||
|
||||
if (function_exists('imagecreatetruecolor') and $CFG->gdversion >= 2) {
|
||||
if (function_exists('imagecreatetruecolor')) {
|
||||
$im1 = imagecreatetruecolor(100, 100);
|
||||
$im2 = imagecreatetruecolor(35, 35);
|
||||
$im3 = imagecreatetruecolor(512, 512);
|
||||
@ -274,7 +270,7 @@ function process_new_icon($context, $component, $filearea, $itemid, $originalfil
|
||||
function generate_image_thumbnail($filepath, $width, $height) {
|
||||
global $CFG;
|
||||
|
||||
if (empty($CFG->gdversion) or empty($filepath) or empty($width) or empty($height)) {
|
||||
if (empty($filepath) or empty($width) or empty($height)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -306,7 +302,7 @@ function generate_image_thumbnail($filepath, $width, $height) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (function_exists('imagecreatetruecolor') and $CFG->gdversion >= 2) {
|
||||
if (function_exists('imagecreatetruecolor')) {
|
||||
$thumbnail = imagecreatetruecolor($width, $height);
|
||||
if ($imagefnc === 'imagepng') {
|
||||
imagealphablending($thumbnail, false);
|
||||
|
@ -9081,48 +9081,6 @@ function can_use_rotated_text() {
|
||||
check_browser_version('Opera', 12) || check_browser_version('Safari iOS', 533);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hack to find out the GD version by parsing phpinfo output
|
||||
*
|
||||
* @return int GD version (1, 2, or 0)
|
||||
*/
|
||||
function check_gd_version() {
|
||||
$gdversion = 0;
|
||||
|
||||
if (function_exists('gd_info')){
|
||||
$gd_info = gd_info();
|
||||
if (substr_count($gd_info['GD Version'], '2.')) {
|
||||
$gdversion = 2;
|
||||
} else if (substr_count($gd_info['GD Version'], '1.')) {
|
||||
$gdversion = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
ob_start();
|
||||
phpinfo(INFO_MODULES);
|
||||
$phpinfo = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$phpinfo = explode("\n", $phpinfo);
|
||||
|
||||
|
||||
foreach ($phpinfo as $text) {
|
||||
$parts = explode('</td>', $text);
|
||||
foreach ($parts as $key => $val) {
|
||||
$parts[$key] = trim(strip_tags($val));
|
||||
}
|
||||
if ($parts[0] == 'GD Version') {
|
||||
if (substr_count($parts[1], '2.0')) {
|
||||
$parts[1] = '2.0';
|
||||
}
|
||||
$gdversion = intval($parts[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $gdversion; // 1, 2 or 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if moodle installation requires update
|
||||
*
|
||||
|
@ -34,6 +34,7 @@ information provided here is intended especially for developers.
|
||||
* condition_info:get_condition_user_fields($formatoptions) now accepts the optional
|
||||
param $formatoptions, that will determine if the field names are processed by
|
||||
format_string() with the passed options.
|
||||
* remove all references to $CFG->gdversion, GD PHP extension is now required
|
||||
|
||||
YUI changes:
|
||||
* M.util.help_icon has been deprecated. Code should be updated to use moodle-core-popuphelp
|
||||
|
@ -1166,11 +1166,7 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
public function graph(moodle_url $url, $title) {
|
||||
global $CFG;
|
||||
|
||||
if (empty($CFG->gdversion)) {
|
||||
$graph = get_string('gdneed');
|
||||
} else {
|
||||
$graph = html_writer::empty_tag('img', array('src' => $url, 'alt' => $title));
|
||||
}
|
||||
$graph = html_writer::empty_tag('img', array('src' => $url, 'alt' => $title));
|
||||
|
||||
return $this->heading($title) . html_writer::tag('div', $graph, array('class' => 'graph'));
|
||||
}
|
||||
|
@ -665,13 +665,8 @@ function survey_question_rowclass($qnum) {
|
||||
function survey_print_graph($url) {
|
||||
global $CFG, $SURVEY_GHEIGHT, $SURVEY_GWIDTH;
|
||||
|
||||
if (empty($CFG->gdversion)) {
|
||||
echo "(".get_string("gdneed").")";
|
||||
|
||||
} else {
|
||||
echo "<img class='resultgraph' height=\"$SURVEY_GHEIGHT\" width=\"$SURVEY_GWIDTH\"".
|
||||
" src=\"$CFG->wwwroot/mod/survey/graph.php?$url\" alt=\"".get_string("surveygraph", "survey")."\" />";
|
||||
}
|
||||
echo "<img class='resultgraph' height=\"$SURVEY_GHEIGHT\" width=\"$SURVEY_GWIDTH\"".
|
||||
" src=\"$CFG->wwwroot/mod/survey/graph.php?$url\" alt=\"".get_string("surveygraph", "survey")."\" />";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -113,11 +113,7 @@ if (!empty($report) && !empty($time)) {
|
||||
echo '</td></tr></table>';
|
||||
|
||||
} else {
|
||||
if (empty($CFG->gdversion)) {
|
||||
echo '<div class="graph">(' . get_string("gdneed") .')</div>';
|
||||
} else {
|
||||
echo '<div class="graph"><img alt="'.get_string('courseoverviewgraph').'" src="'.$CFG->wwwroot.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></div>';
|
||||
}
|
||||
echo '<div class="graph"><img alt="'.get_string('courseoverviewgraph').'" src="'.$CFG->wwwroot.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></div>';
|
||||
|
||||
$table = new html_table();
|
||||
$table->align = array('left','center','center','center');
|
||||
|
@ -45,12 +45,8 @@ require_once(dirname(__FILE__).'/lib.php');
|
||||
function report_log_print_graph($course, $userid, $type, $date=0) {
|
||||
global $CFG;
|
||||
|
||||
if (empty($CFG->gdversion)) {
|
||||
echo "(".get_string("gdneed").")";
|
||||
} else {
|
||||
echo '<img src="'.$CFG->wwwroot.'/report/log/graph.php?id='.$course->id.
|
||||
'&user='.$userid.'&type='.$type.'&date='.$date.'" alt="" />';
|
||||
}
|
||||
echo '<img src="'.$CFG->wwwroot.'/report/log/graph.php?id='.$course->id.
|
||||
'&user='.$userid.'&type='.$type.'&date='.$date.'" alt="" />';
|
||||
}
|
||||
/**
|
||||
* This function is used to generate and display Mnet selector form
|
||||
|
@ -201,14 +201,10 @@ function report_stats_report($course, $report, $mode, $user, $roleid, $time) {
|
||||
.((!empty($roleid)) ? ' '.$DB->get_field('role','name', array('id'=>$roleid)) : ''));
|
||||
|
||||
|
||||
if (empty($CFG->gdversion)) {
|
||||
echo "(".get_string("gdneed").")";
|
||||
if ($mode == STATS_MODE_DETAILED) {
|
||||
echo '<div class="graph"><img src="'.$CFG->wwwroot.'/report/stats/graph.php?mode='.$mode.'&course='.$course->id.'&time='.$time.'&report='.$report.'&userid='.$userid.'" alt="'.get_string('statisticsgraph').'" /></div>';
|
||||
} else {
|
||||
if ($mode == STATS_MODE_DETAILED) {
|
||||
echo '<div class="graph"><img src="'.$CFG->wwwroot.'/report/stats/graph.php?mode='.$mode.'&course='.$course->id.'&time='.$time.'&report='.$report.'&userid='.$userid.'" alt="'.get_string('statisticsgraph').'" /></div>';
|
||||
} else {
|
||||
echo '<div class="graph"><img src="'.$CFG->wwwroot.'/report/stats/graph.php?mode='.$mode.'&course='.$course->id.'&time='.$time.'&report='.$report.'&roleid='.$roleid.'" alt="'.get_string('statisticsgraph').'" /></div>';
|
||||
}
|
||||
echo '<div class="graph"><img src="'.$CFG->wwwroot.'/report/stats/graph.php?mode='.$mode.'&course='.$course->id.'&time='.$time.'&report='.$report.'&roleid='.$roleid.'" alt="'.get_string('statisticsgraph').'" /></div>';
|
||||
}
|
||||
|
||||
$table = new html_table();
|
||||
|
@ -113,9 +113,7 @@ if (empty($stats)) {
|
||||
print_error('nostatstodisplay', '', $CFG->wwwroot.'/course/user.php?id='.$course->id.'&user='.$user->id.'&mode=outline');
|
||||
}
|
||||
|
||||
if (!empty($CFG->gdversion)) {
|
||||
echo '<center><img src="'.$CFG->wwwroot.'/report/stats/graph.php?mode='.STATS_MODE_DETAILED.'&course='.$course->id.'&time='.$time.'&report='.STATS_REPORT_USER_VIEW.'&userid='.$user->id.'" alt="'.get_string('statisticsgraph').'" /></center>';
|
||||
}
|
||||
echo '<center><img src="'.$CFG->wwwroot.'/report/stats/graph.php?mode='.STATS_MODE_DETAILED.'&course='.$course->id.'&time='.$time.'&report='.STATS_REPORT_USER_VIEW.'&userid='.$user->id.'" alt="'.get_string('statisticsgraph').'" /></center>';
|
||||
|
||||
// What the heck is this about? -- MD
|
||||
$stats = stats_fix_zeros($stats,$param->timeafter,$param->table,(!empty($param->line2)),(!empty($param->line3)));
|
||||
|
@ -224,7 +224,7 @@ if ($usernew = $userform->get_data()) {
|
||||
}
|
||||
|
||||
//update user picture
|
||||
if (!empty($CFG->gdversion) and empty($CFG->disableuserimages)) {
|
||||
if (empty($CFG->disableuserimages)) {
|
||||
useredit_update_picture($usernew, $userform, $filemanageroptions);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ class user_edit_form extends moodleform {
|
||||
useredit_shared_definition($mform, $editoroptions, $filemanageroptions);
|
||||
|
||||
/// extra settigs
|
||||
if (!empty($CFG->gdversion) and !empty($CFG->disableuserimages)) {
|
||||
if (!empty($CFG->disableuserimages)) {
|
||||
$mform->removeElement('deletepicture');
|
||||
$mform->removeElement('imagefile');
|
||||
$mform->removeElement('imagealt');
|
||||
@ -82,21 +82,19 @@ class user_edit_form extends moodleform {
|
||||
}
|
||||
|
||||
// print picture
|
||||
if (!empty($CFG->gdversion)) {
|
||||
$context = context_user::instance($user->id, MUST_EXIST);
|
||||
$fs = get_file_storage();
|
||||
$hasuploadedpicture = ($fs->file_exists($context->id, 'user', 'icon', 0, '/', 'f2.png') || $fs->file_exists($context->id, 'user', 'icon', 0, '/', 'f2.jpg'));
|
||||
if (!empty($user->picture) && $hasuploadedpicture) {
|
||||
$imagevalue = $OUTPUT->user_picture($user, array('courseid' => SITEID, 'size'=>64));
|
||||
} else {
|
||||
$imagevalue = get_string('none');
|
||||
}
|
||||
$imageelement = $mform->getElement('currentpicture');
|
||||
$imageelement->setValue($imagevalue);
|
||||
$context = context_user::instance($user->id, MUST_EXIST);
|
||||
$fs = get_file_storage();
|
||||
$hasuploadedpicture = ($fs->file_exists($context->id, 'user', 'icon', 0, '/', 'f2.png') || $fs->file_exists($context->id, 'user', 'icon', 0, '/', 'f2.jpg'));
|
||||
if (!empty($user->picture) && $hasuploadedpicture) {
|
||||
$imagevalue = $OUTPUT->user_picture($user, array('courseid' => SITEID, 'size'=>64));
|
||||
} else {
|
||||
$imagevalue = get_string('none');
|
||||
}
|
||||
$imageelement = $mform->getElement('currentpicture');
|
||||
$imageelement->setValue($imagevalue);
|
||||
|
||||
if ($mform->elementExists('deletepicture') && !$hasuploadedpicture) {
|
||||
$mform->removeElement('deletepicture');
|
||||
}
|
||||
if ($mform->elementExists('deletepicture') && !$hasuploadedpicture) {
|
||||
$mform->removeElement('deletepicture');
|
||||
}
|
||||
|
||||
/// disable fields that are locked by auth plugins
|
||||
|
@ -214,7 +214,7 @@ if ($usernew = $userform->get_data()) {
|
||||
}
|
||||
|
||||
//update user picture
|
||||
if (!empty($CFG->gdversion) and empty($USER->newadminuser)) {
|
||||
if (empty($USER->newadminuser)) {
|
||||
useredit_update_picture($usernew, $userform, $filemanageroptions);
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ class user_editadvanced_form extends moodleform {
|
||||
}
|
||||
|
||||
// print picture
|
||||
if (!empty($CFG->gdversion) and empty($USER->newadminuser)) {
|
||||
if (empty($USER->newadminuser)) {
|
||||
if ($user) {
|
||||
$context = context_user::instance($user->id, MUST_EXIST);
|
||||
$fs = get_file_storage();
|
||||
|
@ -259,7 +259,7 @@ function useredit_shared_definition(&$mform, $editoroptions = null, $filemanager
|
||||
$mform->setType('description_editor', PARAM_CLEANHTML);
|
||||
$mform->addHelpButton('description_editor', 'userdescription');
|
||||
|
||||
if (!empty($CFG->gdversion) and empty($USER->newadminuser)) {
|
||||
if (empty($USER->newadminuser)) {
|
||||
$mform->addElement('header', 'moodle_picture', get_string('pictureofuser'));
|
||||
|
||||
if (!empty($CFG->enablegravatar)) {
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2013032200.00; // YYYYMMDD = weekly release date of this DEV branch
|
||||
$version = 2013032200.01; // YYYYMMDD = weekly release date of this DEV branch
|
||||
// RR = release increments - 00 in DEV branches
|
||||
// .XX = incremental changes
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user