Minor - format code

pull/2467/head
jmontoyaa 8 years ago
parent 26e3a1bee1
commit 1f57321064
  1. 21
      main/inc/lib/api.lib.php
  2. 5
      plugin/resubscription/src/HookResubscription.php
  3. 1
      plugin/test2pdf/src/test2pdf.lib.php

@ -279,15 +279,17 @@ define('USERNAME_PURIFIER_SHALLOW', '/\s/');
define('IS_WINDOWS_OS', api_is_windows_os());
// Checks for installed optional php-extensions.
define('INTL_INSTALLED', function_exists('intl_get_error_code')); // intl extension (from PECL), it is installed by default as of PHP 5.3.0
define('ICONV_INSTALLED', function_exists('iconv')); // iconv extension, for PHP5 on Windows it is installed by default.
// intl extension (from PECL), it is installed by default as of PHP 5.3.0.
define('INTL_INSTALLED', function_exists('intl_get_error_code'));
// iconv extension, for PHP5 on Windows it is installed by default.
define('ICONV_INSTALLED', function_exists('iconv'));
define('MBSTRING_INSTALLED', function_exists('mb_strlen')); // mbstring extension.
// Patterns for processing paths. // Examples:
// Patterns for processing paths. Examples.
define('REPEATED_SLASHES_PURIFIER', '/\/{2,}/'); // $path = preg_replace(REPEATED_SLASHES_PURIFIER, '/', $path);
define('VALID_WEB_PATH', '/https?:\/\/[^\/]*(\/.*)?/i'); // $is_valid_path = preg_match(VALID_WEB_PATH, $path);
define('VALID_WEB_SERVER_BASE', '/https?:\/\/[^\/]*/i'); // $new_path = preg_replace(VALID_WEB_SERVER_BASE, $new_base, $path);
// $new_path = preg_replace(VALID_WEB_SERVER_BASE, $new_base, $path);
define('VALID_WEB_SERVER_BASE', '/https?:\/\/[^\/]*/i');
// Constants for api_get_path() and api_get_path_type(), etc. - registered path types.
// basic (leaf elements)
define('REL_CODE_PATH', 'REL_CODE_PATH');
@ -737,9 +739,10 @@ function api_get_path($path = '', $configuration = [])
: (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST']
: (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR']
: 'localhost')));
if (isset($_SERVER['SERVER_PORT']) && !strpos($server_name, ':')
&& (($server_protocol == 'http'
&& $_SERVER['SERVER_PORT'] != 80) || ($server_protocol == 'https' && $_SERVER['SERVER_PORT'] != 443))
if (isset($_SERVER['SERVER_PORT']) &&
!strpos($server_name, ':') &&
(($server_protocol == 'http' && $_SERVER['SERVER_PORT'] != 80) ||
($server_protocol == 'https' && $_SERVER['SERVER_PORT'] != 443))
) {
$server_name .= ":".$_SERVER['SERVER_PORT'];
}
@ -754,7 +757,7 @@ function api_get_path($path = '', $configuration = [])
if (isset($configuration['multiple_access_urls']) &&
$configuration['multiple_access_urls']
) {
// To avoid that the api_get_access_url() function fails since global.inc.php also calls the main_api.lib.php
// To avoid that the api_get_access_url() function fails since global.inc.php also calls the api.lib.php.
if (isset($configuration['access_url']) && !empty($configuration['access_url'])) {
// We look into the DB the function api_get_access_url
$urlInfo = api_get_access_url($configuration['access_url']);

@ -100,7 +100,10 @@ class HookResubscription extends HookObserver implements HookResubscribeObserver
$endDate = $userSessionCourses[$currentSessionCourse['c_id']];
$resubscriptionDate = gmdate($limitDateFormat, strtotime($endDate." +$resubscriptionOffset"));
$icon = Display::return_icon('students.gif', get_lang('Student'));
$canResubscribeFrom = sprintf(get_plugin_lang('CanResubscribeFromX', 'resubscription'), $resubscriptionDate);
$canResubscribeFrom = sprintf(
get_plugin_lang('CanResubscribeFromX', 'resubscription'),
$resubscriptionDate
);
throw new Exception(Display::label($icon.' '.$canResubscribeFrom, "info"));
}
}

@ -117,6 +117,7 @@ function getQuestions($courseId, $quizId, $sessionId = 0)
while ($row = Database::fetch_assoc($res)) {
$aux[] = $row['question_id'];
}
return $aux;
}

Loading…
Cancel
Save