Internal: Add array checks to avoid notices

See 36ea4c22dc
pull/4616/head
Angel Fernando Quiroz Campos 3 years ago
parent 7945e72d20
commit 86c1bb626b
  1. BIN
      foo.htaccess
  2. 2
      main/user/user.php
  3. 2
      src/Chamilo/CoreBundle/Entity/AgendaEventInvitation.php
  4. 2
      src/Chamilo/CoreBundle/Entity/AgendaEventInvitee.php
  5. 2
      src/Chamilo/CoreBundle/Entity/AgendaReminder.php
  6. 2
      src/Chamilo/CoreBundle/Entity/PersonalAgenda.php
  7. 2
      src/Chamilo/CoreBundle/Entity/Portfolio.php
  8. 2
      src/Chamilo/CoreBundle/Entity/PortfolioAttachment.php
  9. 2
      src/Chamilo/CoreBundle/Entity/PortfolioCategory.php
  10. 4
      src/Chamilo/CoreBundle/Entity/PortfolioComment.php
  11. 2
      src/Chamilo/CoreBundle/Entity/PortfolioRelTag.php
  12. 4
      src/Chamilo/CourseBundle/Entity/CWiki.php
  13. 2
      src/Chamilo/CourseBundle/Entity/CWikiCategory.php
  14. 4
      tests/scripts/update_user_extra_field.php

Binary file not shown.

@ -448,7 +448,7 @@ if (api_is_allowed_to_edit(null, true)) {
$result = Database::query($sql);
$row = Database::fetch_array($result, 'ASSOC');
if (!empty($row) && is_array($row) && isset($row['user_id']) && ($row['user_id'] == $user_id || $row['user_id'] == "")) {
if ((!empty($row['user_id']) && ($row['user_id'] == $user_id || $row['user_id'] == "")) || empty($row)) {
CourseManager::unsubscribe_user($_GET['user_id'], $courseCode);
Display::addFlash(
Display::return_message(get_lang('UserUnsubscribed'))

@ -13,7 +13,7 @@ use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="agenda_event_invitation")
* Add @ to the next lineactivating the agenda_collective_invitations configuration setting.
* ORM\Entity()
* @ORM\Entity()
*/
class AgendaEventInvitation
{

@ -11,7 +11,7 @@ use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="agenda_event_invitee")
* Add @ to the next lineactivating the agenda_collective_invitations configuration setting.
* ORM\Entity()
* @ORM\Entity()
*/
class AgendaEventInvitee
{

@ -10,7 +10,7 @@ use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="agenda_reminder")
* Add @ to the next line when activatiing the agenda_reminders configuration setting
* ORM\Entity()
* @ORM\Entity()
*/
class AgendaReminder
{

@ -16,7 +16,7 @@ use Doctrine\ORM\Mapping as ORM;
class PersonalAgenda
{
// Uncomment next line when activating the agenda_collective_invitations configuration setting.
//use EventCollectiveTrait;
use EventCollectiveTrait;
/**
* @var int

@ -24,7 +24,7 @@ use Doctrine\ORM\Mapping as ORM;
* }
* )
* Add @ to the next line if api_get_configuration_value('allow_portfolio_tool') is true
* ORM\Entity(repositoryClass="Chamilo\CoreBundle\Entity\Repository\PortfolioRepository")
* @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Entity\Repository\PortfolioRepository")
*/
class Portfolio
{

@ -13,7 +13,7 @@ use Doctrine\ORM\Mapping as ORM;
*
* @ORM\Table(name="portfolio_attachment")
* Add @ to the next line if api_get_configuration_value('allow_portfolio_tool') is true
* ORM\Entity(repositoryClass="Chamilo\CoreBundle\Entity\Repository\PortfolioAttachmentRepository")
* @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Entity\Repository\PortfolioAttachmentRepository")
*/
class PortfolioAttachment
{

@ -20,7 +20,7 @@ use Doctrine\ORM\Mapping as ORM;
* }
* )
* Add @ to the next line if api_get_configuration_value('allow_portfolio_tool') is true
* ORM\Entity()
* @ORM\Entity()
*/
class PortfolioCategory
{

@ -18,7 +18,7 @@ use Gedmo\Mapping\Annotation as Gedmo;
* @Gedmo\Tree(type="nested")
* @ORM\Table(name="portfolio_comment")
* Add @ to the next line if api_get_configuration_value('allow_portfolio_tool') is true
* ORM\Entity(repositoryClass="Chamilo\CoreBundle\Entity\Repository\PortfolioCommentRepository")
* @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Entity\Repository\PortfolioCommentRepository")
*/
class PortfolioComment
{
@ -29,7 +29,7 @@ class PortfolioComment
* @var int
*
* Add @ to the next line if portfolio_advanced_sharing config setting is true
* ORM\Column(name="visibility", type="smallint", options={"default": 1})
* @ORM\Column(name="visibility", type="smallint", options={"default": 1})
*/
protected $visibility = 1;

@ -8,7 +8,7 @@ use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="portfolio_rel_tag")
* ORM\Entity()
* @ORM\Entity()
*/
class PortfolioRelTag
{

@ -225,8 +225,8 @@ class CWiki
* @var Collection<int, CWikiCategory>
*
* Add @ to the next lines if api_get_configuration_value('wiki_categories_enabled') is true
* ORM\ManyToMany(targetEntity="Chamilo\CourseBundle\Entity\CWikiCategory", inversedBy="wikiPages")
* ORM\JoinTable(
* @ORM\ManyToMany(targetEntity="Chamilo\CourseBundle\Entity\CWikiCategory", inversedBy="wikiPages")
* @ORM\JoinTable(
* name="c_wiki_rel_category",
* joinColumns={@ORM\JoinColumn(name="wiki_id", referencedColumnName="iid", onDelete="CASCADE")},
* inverseJoinColumns={@ORM\JoinColumn(name="category_id", referencedColumnName="id", onDelete="CASCADE")}

@ -15,7 +15,7 @@ use Gedmo\Mapping\Annotation as Gedmo;
* @Gedmo\Tree(type="nested")
* @ORM\Table(name="c_wiki_category")
* Add @ to the next line if api_get_configuration_value('wiki_categories_enabled') is true
* ORM\Entity(repositoryClass="Chamilo\CourseBundle\Entity\Repository\CWikiCategoryRepository")
* @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Entity\Repository\CWikiCategoryRepository")
*/
class CWikiCategory
{

@ -35,10 +35,10 @@ foreach ($users as $user) {
UserManager::update_extra_field_value(
$userInfo['user_id'],
$extraFieldName,
$user[$extraFieldName]
api_replace_dangerous_char($user[$extraFieldName])
);
}
echo 'Updating extrafield "'.$extraFieldName.'": '.$user[$extraFieldName].'<br />';
echo 'Updating extrafield "'.$extraFieldName.'" - user:'.$userInfo['username'].' -> value: '.$user[$extraFieldName].'<br />';
} else {
echo 'User does not exists: '.$user['user'].'<br />';
}

Loading…
Cancel
Save