diff --git a/main/admin/export_exercise_results.php b/main/admin/export_exercise_results.php index d12dd32ed1..57a8e1dee4 100644 --- a/main/admin/export_exercise_results.php +++ b/main/admin/export_exercise_results.php @@ -181,9 +181,9 @@ Display::display_header(get_lang('ExportExerciseAllResults')); echo Display::return_message( get_lang('PleaseWaitThisCouldTakeAWhile'), 'normal', - false, + false ); -echo $form->display(); +$form->display(); Display::display_footer(); diff --git a/main/cron/forum_bulk_notification_to_course_teacher_for_new_post_in_last_X_days.php b/main/cron/forum_bulk_notification_to_course_teacher_for_new_post_in_last_X_days.php index 1e6c61ad5c..eef10c26c9 100644 --- a/main/cron/forum_bulk_notification_to_course_teacher_for_new_post_in_last_X_days.php +++ b/main/cron/forum_bulk_notification_to_course_teacher_for_new_post_in_last_X_days.php @@ -109,7 +109,7 @@ function sendMessage( $toUserId, $subject, $content, - 1, + 1 ); } diff --git a/plugin/buycourses/src/stripe_success.php b/plugin/buycourses/src/stripe_success.php index 209083cef9..545e3fcb3e 100644 --- a/plugin/buycourses/src/stripe_success.php +++ b/plugin/buycourses/src/stripe_success.php @@ -45,7 +45,7 @@ if (!empty($globalParameters['sale_email'])) { $plugin->get_lang('bc_subject'), $messageConfirmBuyerTemplate->fetch('buycourses/view/message_confirm_buyer.tpl'), '', - $globalParameters['sale_email'], + $globalParameters['sale_email'] ); $messageConfirmTemplate = new Template(); diff --git a/plugin/h5pimport/Entity/H5pImport.php b/plugin/h5pimport/Entity/H5pImport.php index 4a5215d5e2..1dc8094f83 100644 --- a/plugin/h5pimport/Entity/H5pImport.php +++ b/plugin/h5pimport/Entity/H5pImport.php @@ -74,7 +74,7 @@ class H5pImport private $course; /** - * @var null|Session + * @var Session|null * * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session") * @@ -83,14 +83,14 @@ class H5pImport private $session; /** - * @var null|string + * @var string|null * * @ORM\Column(name="name", type="text", nullable=true) */ private $name; /** - * @var null|string + * @var string|null * * @ORM\Column(name="description", type="text", nullable=true) */ diff --git a/plugin/h5pimport/Entity/H5pImportLibrary.php b/plugin/h5pimport/Entity/H5pImportLibrary.php index 47ac3df74b..1faccca8d9 100644 --- a/plugin/h5pimport/Entity/H5pImportLibrary.php +++ b/plugin/h5pimport/Entity/H5pImportLibrary.php @@ -298,24 +298,24 @@ class H5pImportLibrary extends EntityRepository return $this; } - public function getCreatedAt(): \DateTime + public function getCreatedAt(): DateTime { return $this->createdAt; } - public function setCreatedAt(\DateTime $createdAt): H5pImportLibrary + public function setCreatedAt(DateTime $createdAt): H5pImportLibrary { $this->createdAt = $createdAt; return $this; } - public function getModifiedAt(): \DateTime + public function getModifiedAt(): DateTime { return $this->modifiedAt; } - public function setModifiedAt(\DateTime $modifiedAt): H5pImportLibrary + public function setModifiedAt(DateTime $modifiedAt): H5pImportLibrary { $this->modifiedAt = $modifiedAt; diff --git a/plugin/h5pimport/Entity/H5pImportResults.php b/plugin/h5pimport/Entity/H5pImportResults.php index 187e933678..721a5270a1 100644 --- a/plugin/h5pimport/Entity/H5pImportResults.php +++ b/plugin/h5pimport/Entity/H5pImportResults.php @@ -68,7 +68,7 @@ class H5pImportResults private $course; /** - * @var null|Session + * @var Session|null * * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session") * @@ -205,7 +205,7 @@ class H5pImportResults return $this; } - public function getCreatedAt(): \DateTime + public function getCreatedAt(): DateTime { return $this->createdAt; } @@ -246,19 +246,19 @@ class H5pImportResults return $this; } - public function setCreatedAt(\DateTime $createdAt): H5pImportResults + public function setCreatedAt(DateTime $createdAt): H5pImportResults { $this->createdAt = $createdAt; return $this; } - public function getModifiedAt(): \DateTime + public function getModifiedAt(): DateTime { return $this->modifiedAt; } - public function setModifiedAt(\DateTime $modifiedAt): H5pImportResults + public function setModifiedAt(DateTime $modifiedAt): H5pImportResults { $this->modifiedAt = $modifiedAt; diff --git a/plugin/h5pimport/src/H5pPackageImporter.php b/plugin/h5pimport/src/H5pPackageImporter.php index 1d72a5bf4e..5dbce90eeb 100644 --- a/plugin/h5pimport/src/H5pPackageImporter.php +++ b/plugin/h5pimport/src/H5pPackageImporter.php @@ -65,9 +65,9 @@ abstract class H5pPackageImporter /** * Check the package and unzip it, checking if it has the 'h5p.json' file or some php script. * - * @return mixed - * * @throws \Exception + * + * @return mixed */ abstract public function import(): string; diff --git a/plugin/h5pimport/src/H5pPackageTools.php b/plugin/h5pimport/src/H5pPackageTools.php index 3d1b51bc3b..e09c0409e8 100644 --- a/plugin/h5pimport/src/H5pPackageTools.php +++ b/plugin/h5pimport/src/H5pPackageTools.php @@ -88,8 +88,8 @@ class H5pPackageTools * @param string $packagePath the path to the H5P package file * @param object $h5pJson the parsed H5P JSON object * @param Course $course the course entity related to the package - * @param null|Session $session the session entity related to the package - * @param null|array $values the advance options in upload form + * @param Session|null $session the session entity related to the package + * @param array|null $values the advance options in upload form */ public static function storeH5pPackage( string $packagePath, @@ -196,7 +196,7 @@ class H5pPackageTools * * @return array the core settings for H5P content */ - public static function getCoreSettings(H5pImport $h5pImport, \H5PCore $h5pCore): array + public static function getCoreSettings(H5pImport $h5pImport, H5PCore $h5pCore): array { $originIsLearnpath = 'learnpath' === api_get_origin(); @@ -270,7 +270,7 @@ class H5pPackageTools * * @param mixed $h5pNode */ - public static function getContentSettings($h5pNode, \H5PCore $h5pCore): array + public static function getContentSettings($h5pNode, H5PCore $h5pCore): array { $filtered = $h5pCore->filterParameters($h5pNode); $contentUserData = [ diff --git a/plugin/h5pimport/src/ZipPackageImporter.php b/plugin/h5pimport/src/ZipPackageImporter.php index bffaaf0181..8d244ae2a4 100644 --- a/plugin/h5pimport/src/ZipPackageImporter.php +++ b/plugin/h5pimport/src/ZipPackageImporter.php @@ -67,9 +67,9 @@ class ZipPackageImporter extends H5pPackageImporter /** * Import an H5P package. No DB change. * - * @return string The path to the extracted package directory. - * * @throws Exception When the H5P package is invalid. + * + * @return string The path to the extracted package directory. */ public function import(): string { @@ -160,7 +160,7 @@ class ZipPackageImporter extends H5pPackageImporter while ($fs->exists($directoryPath)) { $modifiedName = $safeName.'_'.$counter; $directoryPath = $baseDirectory.$modifiedName; - ++$counter; + $counter++; } } diff --git a/plugin/h5pimport/src/ajax.php b/plugin/h5pimport/src/ajax.php index c157a6cd06..d563534940 100644 --- a/plugin/h5pimport/src/ajax.php +++ b/plugin/h5pimport/src/ajax.php @@ -27,7 +27,7 @@ if ('set_finished' === $action && 0 !== $h5pId) { } if (is_numeric($_POST['score']) && is_numeric($_POST['maxScore'])) { - /** @var null|H5pImport $h5pImport */ + /** @var H5pImport|null $h5pImport */ $h5pImport = $h5pImportRepo->find($h5pId); $entityManager = Database::getManager(); @@ -48,7 +48,7 @@ if ('set_finished' === $action && 0 !== $h5pId) { $lpObject = Session::read('oLP'); $clpItemViewRepo = $em->getRepository('ChamiloCourseBundle:CLpItemView'); - /** @var null|CLpItemView $lpItemView */ + /** @var CLpItemView|null $lpItemView */ $lpItemView = $clpItemViewRepo->findOneBy( [ 'lpViewId' => $lpObject->lp_view_id, @@ -56,7 +56,7 @@ if ('set_finished' === $action && 0 !== $h5pId) { ] ); - /** @var null|CLpItem $lpItem */ + /** @var CLpItem|null $lpItem */ $lpItem = $entityManager->find('ChamiloCourseBundle:CLpItem', $lpItemView->getLpItemId()); if ('h5p' !== $lpItem->getItemType()) { return null; @@ -83,7 +83,7 @@ if ('set_finished' === $action && 0 !== $h5pId) { H5PCore::ajaxError($plugin->get_lang('h5p_error_invalid_token')); } - /** @var null|H5pImport $h5pImport */ + /** @var H5pImport|null $h5pImport */ $h5pImport = $h5pImportRepo->find($h5pId); } else { H5PCore::ajaxError(get_lang('InvalidAction')); diff --git a/plugin/h5pimport/view.php b/plugin/h5pimport/view.php index ebbfed1af3..dea3901c20 100644 --- a/plugin/h5pimport/view.php +++ b/plugin/h5pimport/view.php @@ -32,7 +32,7 @@ if (!$h5pImportId) { api_not_allowed(true); } -/** @var null|H5pImport $h5pImport */ +/** @var H5pImport|null $h5pImport */ $h5pImport = $embedRepo->find($h5pImportId); if (!$h5pImport) { diff --git a/plugin/onlyoffice/ajax/saveas.php b/plugin/onlyoffice/ajax/saveas.php index 9a9a2983e3..e6ab2e6f1e 100644 --- a/plugin/onlyoffice/ajax/saveas.php +++ b/plugin/onlyoffice/ajax/saveas.php @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - require_once __DIR__.'/../../../main/inc/global.inc.php'; use ChamiloSession as Session; diff --git a/plugin/onlyoffice/callback.php b/plugin/onlyoffice/callback.php index f4c468ff9d..a1c60720be 100644 --- a/plugin/onlyoffice/callback.php +++ b/plugin/onlyoffice/callback.php @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - require_once __DIR__.'/../../main/inc/global.inc.php'; use ChamiloSession as Session; @@ -230,10 +229,10 @@ function emptyFile() global $appSettings; global $jwtManager; - if ($type !== 'empty') { $result['status'] = 'error'; $result['error'] = 'Download empty with other action'; + return $result; } @@ -244,6 +243,7 @@ function emptyFile() } catch (UnexpectedValueException $e) { $result['status'] = 'error'; $result['error'] = '403 Access denied'; + return $result; } } @@ -253,6 +253,7 @@ function emptyFile() if (!$template) { $result['status'] = 'error'; $result['error'] = 'File not found'; + return $result; } @@ -260,4 +261,4 @@ function emptyFile() @header('Content-Disposition: attachment; filename='.'docx.docx'); readfile($template); exit; -} \ No newline at end of file +} diff --git a/plugin/onlyoffice/create.php b/plugin/onlyoffice/create.php index 70a080fb69..074c5aa92b 100644 --- a/plugin/onlyoffice/create.php +++ b/plugin/onlyoffice/create.php @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - require_once __DIR__.'/../../main/inc/global.inc.php'; use ChamiloSession as Session; diff --git a/plugin/onlyoffice/editor.php b/plugin/onlyoffice/editor.php index 1a4658969d..18b54579f3 100644 --- a/plugin/onlyoffice/editor.php +++ b/plugin/onlyoffice/editor.php @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - require_once __DIR__.'/../../main/inc/global.inc.php'; $plugin = OnlyofficePlugin::create(); @@ -50,7 +49,7 @@ $courseCode = $courseInfo['code']; $docInfo = DocumentManager::get_document_data_by_id($docId, $courseCode, false, $sessionId); $langInfo = LangManager::getLangUser(); $jwtManager = new OnlyofficeJwtManager($appSettings); -if (isset($_GET['forceEdit']) && (bool)$_GET['forceEdit'] === true) { +if (isset($_GET['forceEdit']) && (bool) $_GET['forceEdit'] === true) { $docInfo['forceEdit'] = $_GET['forceEdit']; } $documentManager = new OnlyofficeDocumentManager($appSettings, $docInfo); diff --git a/plugin/onlyoffice/error.php b/plugin/onlyoffice/error.php index 5422008ee9..739d28f967 100644 --- a/plugin/onlyoffice/error.php +++ b/plugin/onlyoffice/error.php @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - require_once __DIR__.'/../../main/inc/global.inc.php'; const ErrorStatus_UpdateOnlyoffice = 1; diff --git a/plugin/onlyoffice/install.php b/plugin/onlyoffice/install.php index 9212ece2b8..c197a1f9e3 100644 --- a/plugin/onlyoffice/install.php +++ b/plugin/onlyoffice/install.php @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - require_once __DIR__.'/../../main/inc/global.inc.php'; /* diff --git a/plugin/onlyoffice/lib/langManager.php b/plugin/onlyoffice/lib/langManager.php index 55f6cb306f..7c0b459a60 100644 --- a/plugin/onlyoffice/lib/langManager.php +++ b/plugin/onlyoffice/lib/langManager.php @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - require_once __DIR__.'/../../../main/inc/global.inc.php'; class LangManager diff --git a/plugin/onlyoffice/lib/onlyofficeAppRequests.php b/plugin/onlyoffice/lib/onlyofficeAppRequests.php index 4c4b240d90..0543182373 100644 --- a/plugin/onlyoffice/lib/onlyofficeAppRequests.php +++ b/plugin/onlyoffice/lib/onlyofficeAppRequests.php @@ -40,7 +40,7 @@ class OnlyofficeAppRequests extends RequestService 'sessionId' => api_get_session_id(), ]; $hashUrl = $this->jwtManager->getHash($data); + return api_get_path(WEB_PLUGIN_PATH).'onlyoffice/callback.php?hash='.$hashUrl; } - } diff --git a/plugin/onlyoffice/lib/onlyofficeConfigService.php b/plugin/onlyoffice/lib/onlyofficeConfigService.php index 2e5191dd91..61a39555fd 100644 --- a/plugin/onlyoffice/lib/onlyofficeConfigService.php +++ b/plugin/onlyoffice/lib/onlyofficeConfigService.php @@ -143,7 +143,7 @@ class OnlyofficeConfigService extends DocEditorConfigService { $permsEdit = $this->getAccessRights() && !$this->isReadOnly(); $isFillable = $this->documentManager->isDocumentFillable($this->documentManager->getDocInfo('title')); - + $permissions = new Permissions(null, null, null, diff --git a/plugin/onlyoffice/lib/onlyofficeDocumentManager.php b/plugin/onlyoffice/lib/onlyofficeDocumentManager.php index 971fa8ea0d..0ac7bca4cb 100644 --- a/plugin/onlyoffice/lib/onlyofficeDocumentManager.php +++ b/plugin/onlyoffice/lib/onlyofficeDocumentManager.php @@ -23,7 +23,7 @@ class OnlyofficeDocumentManager extends DocumentManager public function __construct($settingsManager, array $docInfo, $formats = null, $systemLangCode = 'en') { - $formats = new OnlyofficeFormatsManager; + $formats = new OnlyofficeFormatsManager(); parent::__construct($settingsManager, $formats, $systemLangCode); $this->docInfo = $docInfo; } diff --git a/plugin/onlyoffice/lib/onlyofficeFormatsManager.php b/plugin/onlyoffice/lib/onlyofficeFormatsManager.php index fbfe3a792e..dcae84763a 100644 --- a/plugin/onlyoffice/lib/onlyofficeFormatsManager.php +++ b/plugin/onlyoffice/lib/onlyofficeFormatsManager.php @@ -70,4 +70,4 @@ class OnlyofficeFormatsManager extends FormatsManager } throw new \Exception(CommonError::message(CommonError::EMPTY_FORMATS_ASSET)); } -} \ No newline at end of file +} diff --git a/plugin/onlyoffice/lib/onlyofficeSettingsFormBuilder.php b/plugin/onlyoffice/lib/onlyofficeSettingsFormBuilder.php index 80440f8b19..ff323546c4 100644 --- a/plugin/onlyoffice/lib/onlyofficeSettingsFormBuilder.php +++ b/plugin/onlyoffice/lib/onlyofficeSettingsFormBuilder.php @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - require_once __DIR__.'/../../../main/inc/global.inc.php'; class OnlyofficeSettingsFormBuilder diff --git a/plugin/onlyoffice/lib/onlyofficeTools.php b/plugin/onlyoffice/lib/onlyofficeTools.php index c5302ffe9a..3bf2b34e70 100644 --- a/plugin/onlyoffice/lib/onlyofficeTools.php +++ b/plugin/onlyoffice/lib/onlyofficeTools.php @@ -152,7 +152,8 @@ class OnlyofficeTools /** * Return path to OnlyOffice viewer for a given file. - * @param int $documentId The ID from c_document.iid + * + * @param int $documentId The ID from c_document.iid * @param bool $showHeaders Whether to show Chamilo headers on top of the OnlyOffice frame or not * * @return string A link to open the OnlyOffice viewer diff --git a/plugin/onlyoffice/lib/templateManager.php b/plugin/onlyoffice/lib/templateManager.php index 24b6054143..00bf809d24 100644 --- a/plugin/onlyoffice/lib/templateManager.php +++ b/plugin/onlyoffice/lib/templateManager.php @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - require_once __DIR__.'/../../../main/inc/global.inc.php'; class TemplateManager diff --git a/plugin/onlyoffice/plugin.php b/plugin/onlyoffice/plugin.php index 76df2f1e67..7e4fe912c7 100644 --- a/plugin/onlyoffice/plugin.php +++ b/plugin/onlyoffice/plugin.php @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - require_once __DIR__.'/../../main/inc/global.inc.php'; require_once __DIR__.'/lib/onlyofficeSettingsFormBuilder.php'; require_once __DIR__.'/lib/onlyofficeAppSettings.php'; diff --git a/plugin/onlyoffice/uninstall.php b/plugin/onlyoffice/uninstall.php index a1617098a4..9505e1f096 100644 --- a/plugin/onlyoffice/uninstall.php +++ b/plugin/onlyoffice/uninstall.php @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - require_once __DIR__.'/../../main/inc/global.inc.php'; /*