Minor - flint fixes

pull/2573/head
Julio 7 years ago
parent 0d4e57d176
commit 90a09b545c
  1. 15
      main/auth/profile.php
  2. 2
      main/inc/ajax/record_audio_wami.ajax.php
  3. 2
      main/inc/lib/api.lib.php
  4. 37
      main/inc/lib/message.lib.php
  5. 3
      main/inc/lib/pear/HTML/QuickForm.php
  6. 140
      main/inc/lib/template.lib.php
  7. 2
      main/lp/learnpath.class.php
  8. 2
      main/messages/record_audio.php

@ -723,11 +723,11 @@ if (api_get_setting('allow_social_tool') === 'true') {
$tpl->display_one_col_template();
}
// Helper functions defined below this point
/**
* Is user auth_source is platform ?
*
* @return bool Whether auth_source is 'platform' or not
*/
function is_platform_authentication()
@ -739,6 +739,7 @@ function is_platform_authentication()
/**
* Can a user edit his/her profile?
*
* @return bool Whether the profile can be edited by the user or not
*/
function is_profile_editable()
@ -752,8 +753,10 @@ function is_profile_editable()
/**
* Upload a submitted user production.
* @param int $userId User id
* @return mixed The filename of the new production or FALSE if the upload has failed
*
* @param int $userId User id
*
* @return mixed The filename of the new production or FALSE if the upload has failed
*/
function upload_user_production($userId)
{
@ -776,8 +779,10 @@ function upload_user_production($userId)
/**
* Check current user's current password.
* @param string $email E-mail
* @return bool Whether this e-mail is already in use or not
*
* @param string $email E-mail
*
* @return bool Whether this e-mail is already in use or not
*/
function check_user_email($email)
{

@ -153,5 +153,3 @@ switch ($type) {
api_upload_file('audio_message', $file, api_get_user_id());
break;
}

@ -9072,7 +9072,7 @@ function api_remove_uploaded_file($type, $file)
*/
function api_remove_uploaded_file_by_id($type, $itemId, $file)
{
$file = api_get_uploaded_file($type, $itemId, $file, false);
$file = api_get_uploaded_file($type, $itemId, $file, false);
$typePath = api_get_path(SYS_UPLOAD_PATH).$type;
if (Security::check_abs_path($file, $typePath) && file_exists($file) && is_file($file)) {
unlink($file);

@ -302,12 +302,12 @@ class MessageManager
* @param int $receiver_user_id
* @param string $subject
* @param string $content
* @param array $attachments files array($_FILES) (optional)
* @param array $fileCommentList about attachment files (optional)
* @param int $group_id (optional)
* @param int $parent_id (optional)
* @param int $editMessageId id for updating the message (optional)
* @param int $topic_id (optional) the default value is the current user_id
* @param array $attachments files array($_FILES) (optional)
* @param array $fileCommentList about attachment files (optional)
* @param int $group_id (optional)
* @param int $parent_id (optional)
* @param int $editMessageId id for updating the message (optional)
* @param int $topic_id (optional) the default value is the current user_id
* @param int $sender_id
* @param bool $directMessage
* @param int $forwardId
@ -387,7 +387,6 @@ class MessageManager
'tmp_name' => $file,
'error' => 0,
'type' => DocumentManager::file_get_mime_type(basename($file)),
];
// create attachment from audio message
$attachmentList[] = $audioAttachment;
@ -2529,6 +2528,18 @@ class MessageManager
}
}
/**
* Clean audio messages already added in the message tool.
*/
public static function cleanAudioMessage()
{
$audioId = Session::read('current_audio_id');
if (!empty($audioId)) {
api_remove_uploaded_file_by_id('audio_message', api_get_user_id(), $audioId);
Session::erase('current_audio_id');
}
}
/**
* Execute the SQL necessary to know the number of messages in the database.
*
@ -2552,16 +2563,4 @@ class MessageManager
return $row['count'];
}
/**
* Clean audio messages already added in the message tool
*/
public static function cleanAudioMessage()
{
$audioId = Session::read('current_audio_id');
if (!empty($audioId)) {
api_remove_uploaded_file_by_id('audio_message', api_get_user_id(), $audioId);
Session::erase('current_audio_id');
}
}
}

@ -1440,8 +1440,7 @@ class HTML_QuickForm extends HTML_Common
*/
public function validate()
{
if (count($this->_rules) == 0 && count($this->_formRules) == 0 &&
$this->isSubmitted()) {
if (count($this->_rules) == 0 && count($this->_formRules) == 0 && $this->isSubmitted()) {
return (0 == count($this->_errors));
} elseif (!$this->isSubmitted()) {

@ -1,9 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Component\Utils\ChamiloApi;
use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser;
use Chamilo\UserBundle\Entity\User;
use Chamilo\CoreBundle\Component\Utils\ChamiloApi;
/**
* Class Template.
@ -59,7 +59,7 @@ class Template
* @param bool $hide_global_chat
* @param bool $load_plugins
* @param int $responseCode
* @param bool $sendHeaders send http headers or not
* @param bool $sendHeaders send http headers or not
*/
public function __construct(
$title = '',
@ -948,7 +948,7 @@ class Template
/**
* Render the template.
*
* @param string $template The template path
* @param string $template The template path
* @param bool $clearFlashMessages Clear the $_SESSION variables for flash messages
*/
public function display($template, $clearFlashMessages = true)
@ -1254,6 +1254,62 @@ class Template
return $this->responseCode;
}
/**
* Assign HTML code to the 'bug_notification' template variable for the side tabs to report issues.
*
* @return bool Always return true because there is always a string, even if empty
*/
public function assignBugNotification()
{
//@todo move this in the template
$rightFloatMenu = '';
$iconBug = Display::return_icon(
'bug.png',
get_lang('ReportABug'),
[],
ICON_SIZE_LARGE
);
if (api_get_setting('show_link_bug_notification') == 'true' && $this->user_is_logged_in) {
$rightFloatMenu = '<div class="report">
<a href="https://github.com/chamilo/chamilo-lms/wiki/How-to-report-issues" target="_blank">
'.$iconBug.'
</a>
</div>';
}
if (api_get_setting('show_link_ticket_notification') == 'true' &&
$this->user_is_logged_in
) {
// by default is project_id = 1
$defaultProjectId = 1;
$allow = TicketManager::userIsAllowInProject(api_get_user_info(), $defaultProjectId);
if ($allow) {
$iconTicket = Display::return_icon(
'help.png',
get_lang('Ticket'),
[],
ICON_SIZE_LARGE
);
$courseInfo = api_get_course_info();
$courseParams = '';
if (!empty($courseInfo)) {
$courseParams = api_get_cidreq();
}
$url = api_get_path(WEB_CODE_PATH).
'ticket/tickets.php?project_id='.$defaultProjectId.'&'.$courseParams;
$rightFloatMenu .= '<div class="help">
<a href="'.$url.'" target="_blank">
'.$iconTicket.'
</a>
</div>';
}
}
$this->assign('bug_notification', $rightFloatMenu);
return true;
}
/**
* Prepare the _c array for template files. The _c array contains
* information about the current course.
@ -1686,8 +1742,9 @@ class Template
}
/**
* Assign favicon to the 'favico' template variable
* @return bool Always return true because there is always at least one correct favicon.ico
* Assign favicon to the 'favico' template variable.
*
* @return bool Always return true because there is always at least one correct favicon.ico
*/
private function assignFavIcon()
{
@ -1722,66 +1779,14 @@ class Template
}
$this->assign('favico', $favico);
return true;
}
/**
* Assign HTML code to the 'bug_notification' template variable for the side tabs to report issues
* @return bool Always return true because there is always a string, even if empty
*/
function assignBugNotification()
{
//@todo move this in the template
$rightFloatMenu = '';
$iconBug = Display::return_icon(
'bug.png',
get_lang('ReportABug'),
[],
ICON_SIZE_LARGE
);
if (api_get_setting('show_link_bug_notification') == 'true' && $this->user_is_logged_in) {
$rightFloatMenu = '<div class="report">
<a href="https://github.com/chamilo/chamilo-lms/wiki/How-to-report-issues" target="_blank">
'.$iconBug.'
</a>
</div>';
}
if (api_get_setting('show_link_ticket_notification') == 'true' &&
$this->user_is_logged_in
) {
// by default is project_id = 1
$defaultProjectId = 1;
$allow = TicketManager::userIsAllowInProject(api_get_user_info(), $defaultProjectId);
if ($allow) {
$iconTicket = Display::return_icon(
'help.png',
get_lang('Ticket'),
[],
ICON_SIZE_LARGE
);
$courseInfo = api_get_course_info();
$courseParams = '';
if (!empty($courseInfo)) {
$courseParams = api_get_cidreq();
}
$url = api_get_path(WEB_CODE_PATH).
'ticket/tickets.php?project_id='.$defaultProjectId.'&'.$courseParams;
$rightFloatMenu .= '<div class="help">
<a href="'.$url.'" target="_blank">
'.$iconTicket.'
</a>
</div>';
}
}
$this->assign('bug_notification', $rightFloatMenu);
return true;
}
/**
* Assign HTML code to the 'accessibility' template variable (usually shown above top menu)
* @return bool Always return true (even if empty string)
* Assign HTML code to the 'accessibility' template variable (usually shown above top menu).
*
* @return bool Always return true (even if empty string)
*/
private function assignAccessibilityBlock()
{
@ -1796,12 +1801,14 @@ class Template
$resize .= '</div>';
}
$this->assign('accessibility', $resize);
return true;
}
/**
* Assign HTML code to the 'social_meta' template variable (usually shown above top menu)
* @return bool Always return true (even if empty string)
* Assign HTML code to the 'social_meta' template variable (usually shown above top menu).
*
* @return bool Always return true (even if empty string)
*/
private function assignSocialMeta()
{
@ -1850,7 +1857,6 @@ class Template
} else {
$socialMeta .= $this->getMetaPortalImagePath();
}
} elseif ($sessionId !== 0) {
// If we are on a session "about" screen, publish info about the session
$em = Database::getManager();
@ -1869,8 +1875,6 @@ class Template
} else {
$socialMeta .= $this->getMetaPortalImagePath();
}
} else {
// Otherwise (not a course nor a session, nor a user, nor a badge), publish portal info
$socialMeta .= '<meta property="og:title" content="'.$metaTitle.'" />'."\n";
@ -1886,11 +1890,13 @@ class Template
}
$this->assign('social_meta', $socialMeta);
return true;
}
/**
* Get platform meta image tag (check meta_image_path setting, then use the logo)
* Get platform meta image tag (check meta_image_path setting, then use the logo).
*
* @return string The meta image HTML tag, or empty
*/
private function getMetaPortalImagePath()
@ -1910,7 +1916,7 @@ class Template
$portalImageMeta = '<meta property="og:image" content="'.$logo.'" />'."\n";
}
}
return $portalImageMeta;
return $portalImageMeta;
}
}

@ -8548,7 +8548,6 @@ class learnpath
$parentSelect->setSelected($s_selected_parent);
}
if (is_array($arrLP)) {
reset($arrLP);
}
@ -8900,7 +8899,6 @@ class learnpath
if (($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) ||
$arrLP[$i]['item_type'] == TOOL_LP_FINAL_ITEM
) {
$arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
}
}

@ -21,4 +21,4 @@ $tpl->assign('reload_page', 0);
$tpl->assign('content', $tpl->fetch($record));
$tpl->display_no_layout_template();
exit;
exit;

Loading…
Cancel
Save