Minor - format code, update comments

remotes/angel/1.11.x
jmontoyaa 9 years ago
parent a32a3a251b
commit 6ee2856479
  1. 23
      main/inc/lib/internationalization.lib.php
  2. 8
      main/inc/lib/pear/PEAR.php
  3. 24
      plugin/bbb/lib/bbb.lib.php

@ -3,7 +3,7 @@
/** /**
* File: internationalization.lib.php * File: internationalization.lib.php
* Internationalization library for Chamilo 1.8.7 LMS * Internationalization library for Chamilo 1.x LMS
* A library implementing internationalization related functions. * A library implementing internationalization related functions.
* License: GNU General Public License Version 3 (Free Software Foundation)ww * License: GNU General Public License Version 3 (Free Software Foundation)ww
* @author Ivan Tcholakov, <ivantcholakov@gmail.com>, 2009, 2010 * @author Ivan Tcholakov, <ivantcholakov@gmail.com>, 2009, 2010
@ -275,7 +275,7 @@ function api_get_language_isocode($language = null, $default_code = 'en')
} }
/** /**
* Gets language isocode column from the language table * Gets language iso code column from the language table
* *
* @return array An array with the current isocodes * @return array An array with the current isocodes
* *
@ -283,7 +283,8 @@ function api_get_language_isocode($language = null, $default_code = 'en')
function api_get_platform_isocodes() function api_get_platform_isocodes()
{ {
$iso_code = array(); $iso_code = array();
$sql_result = Database::query("SELECT isocode FROM ".Database::get_main_table(TABLE_MAIN_LANGUAGE)." ORDER BY isocode "); $sql = "SELECT isocode FROM ".Database::get_main_table(TABLE_MAIN_LANGUAGE)." ORDER BY isocode ";
$sql_result = Database::query($sql);
if (Database::num_rows($sql_result)) { if (Database::num_rows($sql_result)) {
while ($row = Database::fetch_array($sql_result)) {; while ($row = Database::fetch_array($sql_result)) {;
$iso_code[] = trim($row['isocode']); $iso_code[] = trim($row['isocode']);
@ -348,6 +349,7 @@ function api_get_timezones()
} }
$null_option = array('' => ''); $null_option = array('' => '');
$result = array_merge($null_option, $out); $result = array_merge($null_option, $out);
return $result; return $result;
} }
@ -439,8 +441,12 @@ function api_get_utc_datetime($time = null, $return_null_if_invalid_date = false
* *
* @author Guillaume Viguier <guillaume.viguier@beeznest.com> * @author Guillaume Viguier <guillaume.viguier@beeznest.com>
*/ */
function api_get_local_time($time = null, $to_timezone = null, $from_timezone = null, $return_null_if_invalid_date = false) function api_get_local_time(
{ $time = null,
$to_timezone = null,
$from_timezone = null,
$return_null_if_invalid_date = false
) {
// Determining the timezone to be converted from // Determining the timezone to be converted from
if (is_null($from_timezone)) { if (is_null($from_timezone)) {
$from_timezone = 'UTC'; $from_timezone = 'UTC';
@ -471,8 +477,10 @@ function api_get_local_time($time = null, $to_timezone = null, $from_timezone =
try { try {
$date = new DateTime($time, new DateTimezone($from_timezone)); $date = new DateTime($time, new DateTimezone($from_timezone));
$date->setTimezone(new DateTimeZone($to_timezone)); $date->setTimezone(new DateTimeZone($to_timezone));
return $date->format('Y-m-d H:i:s'); return $date->format('Y-m-d H:i:s');
} catch (Exception $e) { } catch (Exception $e) {
return null; return null;
} }
} }
@ -480,8 +488,8 @@ function api_get_local_time($time = null, $to_timezone = null, $from_timezone =
/** /**
* Converts a string into a timestamp safely (handling timezones), using strtotime * Converts a string into a timestamp safely (handling timezones), using strtotime
* *
* @param string String to be converted * @param string $time to be converted
* @param string Timezone (if null, the timezone will be determined based * @param string $timezone (if null, the timezone will be determined based
* on user preference, or timezone chosen by the admin for the platform) * on user preference, or timezone chosen by the admin for the platform)
* @return int Timestamp * @return int Timestamp
* *
@ -494,6 +502,7 @@ function api_strtotime($time, $timezone = null) {
} }
$timestamp = strtotime($time); $timestamp = strtotime($time);
date_default_timezone_set($system_timezone); date_default_timezone_set($system_timezone);
return $timestamp; return $timestamp;
} }

@ -253,7 +253,7 @@ class PEAR
$GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args); $GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args);
} }
// }}} // }}}
// {{{ isError() // {{{ isError()
/** /**
@ -558,12 +558,6 @@ class PEAR
$ec = 'PEAR_Error'; $ec = 'PEAR_Error';
} }
if (intval(PHP_VERSION) < 5) {
// little non-eval hack to fix bug #12147
include 'PEAR/FixPHP5PEARWarnings.php';
return $a;
}
if ($skipmsg) { if ($skipmsg) {
$a = new $ec($code, $mode, $options, $userinfo); $a = new $ec($code, $mode, $options, $userinfo);
} else { } else {

@ -20,7 +20,7 @@ class bbb
public $url; public $url;
public $salt; public $salt;
public $api; public $api;
public $user_complete_name = ''; public $userCompleteName = '';
public $protocol = 'http://'; public $protocol = 'http://';
public $debug = false; public $debug = false;
public $logoutUrl = ''; public $logoutUrl = '';
@ -34,6 +34,7 @@ class bbb
* required for the connection to the video conference server) * required for the connection to the video conference server)
* @param string $host * @param string $host
* @param string $salt * @param string $salt
* @param bool $isGlobalConference
*/ */
public function __construct($host = '', $salt = '', $isGlobalConference = false) public function __construct($host = '', $salt = '', $isGlobalConference = false)
{ {
@ -65,7 +66,7 @@ class bbb
if ($bbbPlugin === true) { if ($bbbPlugin === true) {
$userInfo = api_get_user_info(); $userInfo = api_get_user_info();
$this->user_complete_name = $userInfo['complete_name']; $this->userCompleteName = $userInfo['complete_name'];
$this->salt = $bbb_salt; $this->salt = $bbb_salt;
$info = parse_url($bbb_host); $info = parse_url($bbb_host);
$this->url = $bbb_host.'/bigbluebutton/'; $this->url = $bbb_host.'/bigbluebutton/';
@ -82,7 +83,7 @@ class bbb
$this->pluginEnabled = true; $this->pluginEnabled = true;
} }
} }
/** /**
* @return bool * @return bool
*/ */
@ -151,7 +152,8 @@ class bbb
# a user joins. If after this period, a user hasn't joined, the meeting is # a user joins. If after this period, a user hasn't joined, the meeting is
# removed from memory. # removed from memory.
defaultMeetingCreateJoinDuration=5 defaultMeetingCreateJoinDuration=5
* *
* @return mixed
*/ */
public function createMeeting($params) public function createMeeting($params)
{ {
@ -385,7 +387,7 @@ class bbb
if ($meetingInfoExists) { if ($meetingInfoExists) {
$joinParams = array( $joinParams = array(
'meetingId' => $meetingData['remote_id'], // -- REQUIRED - A unique id for the meeting 'meetingId' => $meetingData['remote_id'], // -- REQUIRED - A unique id for the meeting
'username' => $this->user_complete_name, //-- REQUIRED - The name that will display for the user in the meeting 'username' => $this->userCompleteName, //-- REQUIRED - The name that will display for the user in the meeting
'password' => $pass, //-- REQUIRED - The attendee or moderator password, depending on what's passed here 'password' => $pass, //-- REQUIRED - The attendee or moderator password, depending on what's passed here
//'createTime' => api_get_utc_datetime(), //-- OPTIONAL - string. Leave blank ('') unless you set this correctly. //'createTime' => api_get_utc_datetime(), //-- OPTIONAL - string. Leave blank ('') unless you set this correctly.
'userID' => api_get_user_id(), //-- OPTIONAL - string 'userID' => api_get_user_id(), //-- OPTIONAL - string
@ -437,7 +439,7 @@ class bbb
{ {
$pass = $this->getUserMeetingPassword(); $pass = $this->getUserMeetingPassword();
$courseId = api_get_course_int_id(); $courseId = api_get_course_int_id();
$sessionId = api_get_session_id(); $sessionId = api_get_session_id();
$conditions = array( $conditions = array(
'where' => array( 'where' => array(
@ -669,7 +671,7 @@ class bbb
if ($meetingDB['status'] == 1) { if ($meetingDB['status'] == 1) {
$joinParams = array( $joinParams = array(
'meetingId' => $meetingDB['remote_id'], //-- REQUIRED - A unique id for the meeting 'meetingId' => $meetingDB['remote_id'], //-- REQUIRED - A unique id for the meeting
'username' => $this->user_complete_name, //-- REQUIRED - The name that will display for the user in the meeting 'username' => $this->userCompleteName, //-- REQUIRED - The name that will display for the user in the meeting
'password' => $pass, //-- REQUIRED - The attendee or moderator password, depending on what's passed here 'password' => $pass, //-- REQUIRED - The attendee or moderator password, depending on what's passed here
'createTime' => '', //-- OPTIONAL - string. Leave blank ('') unless you set this correctly. 'createTime' => '', //-- OPTIONAL - string. Leave blank ('') unless you set this correctly.
'userID' => '', // -- OPTIONAL - string 'userID' => '', // -- OPTIONAL - string
@ -928,7 +930,7 @@ class bbb
} }
/** /**
* Checks if the videoconference server is running. * Checks if the video conference server is running.
* Function currently disabled (always returns 1) * Function currently disabled (always returns 1)
* @return bool True if server is running, false otherwise * @return bool True if server is running, false otherwise
* @assert () === false * @assert () === false
@ -968,12 +970,6 @@ class bbb
header("Location: $url"); header("Location: $url");
exit; exit;
} }
// js
/*echo '<script>';
echo 'window.location = "'.$url.'"';
echo '</script>';
exit;*/
} }
/** /**

Loading…
Cancel
Save