diff --git a/custompages/first_login-dist.php b/custompages/first_login-dist.php index 436069ae71..79d37e0fa7 100644 --- a/custompages/first_login-dist.php +++ b/custompages/first_login-dist.php @@ -11,17 +11,17 @@ require_once __DIR__.'/language.php'; /** * Security checks */ -if (! isset($_SESSION['conditional_login']['uid'])) +if (!isset($_SESSION['conditional_login']['uid'])) die("Not Authorised"); if (isset($_POST['password'])) { $u = api_get_user_info($_SESSION['conditional_login']['uid']); if ($_POST['password'] != $_POST['password2']) { - header('Location: '. api_get_self().'?invalid=2'); + header('Location: '.api_get_self().'?invalid=2'); exit(); } - if (empty($_POST['password'])){ //|| !api_check_password($password)) { //Pass must be at least 5 char long with 2 digits and 3 letters - header('Location: '. api_get_self().'?invalid=1'); + if (empty($_POST['password'])) { //|| !api_check_password($password)) { //Pass must be at least 5 char long with 2 digits and 3 letters + header('Location: '.api_get_self().'?invalid=1'); exit(); } $password = $_POST['password']; @@ -97,23 +97,23 @@ $www = api_get_path('WEB_PATH');
:
+:
UserName;ClassName
jdoe;class01
diff --git a/main/auth/external_login/ldap.inc.php b/main/auth/external_login/ldap.inc.php
index 3e965e5d1e..971888e999 100755
--- a/main/auth/external_login/ldap.inc.php
+++ b/main/auth/external_login/ldap.inc.php
@@ -330,7 +330,7 @@ function extldap_add_user_by_array($data, $update_if_exists = true)
// TODO the password, if encrypted at the source, will be encrypted twice, which makes it useless. Try to fix that.
$passwordKey = isset($extldap_user_correspondance['password']) ? $extldap_user_correspondance['password'] : 'userPassword';
- $password = $data[$passwordKey][0];
+ $password = $data[$passwordKey][0];
// To ease management, we add the step-year (etape-annee) code
//$official_code = $etape."-".$annee;
diff --git a/main/auth/sso/sso.Drupal.class.php b/main/auth/sso/sso.Drupal.class.php
index 7a1e795214..b66883667d 100755
--- a/main/auth/sso/sso.Drupal.class.php
+++ b/main/auth/sso/sso.Drupal.class.php
@@ -22,11 +22,11 @@ use ChamiloSession as Session;
*/
class ssoDrupal
{
- public $protocol; // 'http://',
- public $domain; // 'localhost/project/drupal',
- public $auth_uri; // '/?q=user',
+ public $protocol; // 'http://',
+ public $domain; // 'localhost/project/drupal',
+ public $auth_uri; // '/?q=user',
public $deauth_uri; // '/?q=logout',
- public $referer; // http://my.chamilo.com/main/auth/profile.php
+ public $referer; // http://my.chamilo.com/main/auth/profile.php
/**
* Instanciates the object, initializing all relevant URL strings
@@ -123,9 +123,9 @@ class ssoDrupal
&& ($sso['username'] == $uData['username'])) {
//Check if the account is active (not locked)
- if ($uData['active']=='1') {
+ if ($uData['active'] == '1') {
// check if the expiration date has not been reached
- if (empty($uData['expiration_date']) OR $uData['expiration_date'] > date('Y-m-d H:i:s') OR $uData['expiration_date']=='0000-00-00 00:00:00') {
+ if (empty($uData['expiration_date']) OR $uData['expiration_date'] > date('Y-m-d H:i:s') OR $uData['expiration_date'] == '0000-00-00 00:00:00') {
//If Multiple URL is enabled
if (api_get_multiple_access_url()) {
@@ -158,11 +158,11 @@ class ssoDrupal
// the user credentials are OK, which
// should be protection enough
// against evil URL spoofing...
- $sso_target = api_get_path(WEB_PATH) . base64_decode($sso['ruri']);
+ $sso_target = api_get_path(WEB_PATH).base64_decode($sso['ruri']);
} else {
- $sso_target = isset($sso['target']) ? $sso['target'] : api_get_path(WEB_PATH) . 'index.php';
+ $sso_target = isset($sso['target']) ? $sso['target'] : api_get_path(WEB_PATH).'index.php';
}
- header('Location: '. $sso_target);
+ header('Location: '.$sso_target);
exit;
} else {
// user does not have permission for this site
@@ -279,12 +279,12 @@ class ssoDrupal
// If this is an administrator, allow him to make some changes in
// the Chamilo profile
if ($asAdmin && api_is_platform_admin(true)) {
- return api_get_path(WEB_CODE_PATH) . "admin/user_edit.php?user_id=$userId";
+ return api_get_path(WEB_CODE_PATH)."admin/user_edit.php?user_id=$userId";
}
// If the user doesn't match a Drupal user, give the normal profile
// link
if ($drupalUserIdData === false) {
- return api_get_path(WEB_CODE_PATH) . 'auth/profile.php';
+ return api_get_path(WEB_CODE_PATH).'auth/profile.php';
}
// In all other cases, generate a link to the Drupal profile edition
$drupalUserId = $drupalUserIdData['value'];
diff --git a/main/auth/sso/sso_server_test.php b/main/auth/sso/sso_server_test.php
index 4bb4ba37ff..cd335e9f23 100755
--- a/main/auth/sso/sso_server_test.php
+++ b/main/auth/sso/sso_server_test.php
@@ -48,7 +48,7 @@ if (isset($_POST['user']) && isset($_POST['password'])) {
/* 2.Get the chamilo username and password from your system or from webservices */
- $account['username'] = 'jbrion525'; //username in Chamilo
+ $account['username'] = 'jbrion525'; //username in Chamilo
$account['password'] = sha1(sha1('jbrion525')); //encrypted password with assuming that the first encrypted method is sha1 in chamilo
$master_auth_uri = $my_chamilo_server.'/?q=user';
@@ -64,9 +64,9 @@ if (isset($_POST['user']) && isset($_POST['password'])) {
);
$cookie = base64_encode(serialize($sso));
- $url = chamilo_sso_protocol() . $master_auth_uri;
- $params = 'sso_referer='. urlencode($url) .'&sso_cookie='. urlencode($cookie);
- $final_url = filter_xss($_GET['sso_referer']) .'?'. $params;
+ $url = chamilo_sso_protocol().$master_auth_uri;
+ $params = 'sso_referer='.urlencode($url).'&sso_cookie='.urlencode($cookie);
+ $final_url = filter_xss($_GET['sso_referer']).'?'.$params;
//If your user exists redirect to chamilo and set the account in a session to check it later
$_SESSION['my_server_user_session'] = $account;
diff --git a/main/cron/course_finished.php b/main/cron/course_finished.php
index b82d6cb59c..42ed8c4b5f 100644
--- a/main/cron/course_finished.php
+++ b/main/cron/course_finished.php
@@ -6,7 +6,7 @@
* @author Angel Fernando Quiroz Campos
* @package chamilo.cron
*/
-require_once __DIR__ . '/../inc/global.inc.php';
+require_once __DIR__.'/../inc/global.inc.php';
if (php_sapi_name() != 'cli') {
exit; //do not run from browser
@@ -32,7 +32,7 @@ $sessions = $sessionRepo->createQueryBuilder('s')
->getResult();
if (empty($sessions)) {
- echo "No sessions finishing today $endDate" . PHP_EOL;
+ echo "No sessions finishing today $endDate".PHP_EOL;
exit;
}
@@ -50,7 +50,7 @@ foreach ($sessions as $session) {
$sessionUsers = $session->getUsers();
if (empty($sessionUsers)) {
- echo 'No users to send mail' . PHP_EOL;
+ echo 'No users to send mail'.PHP_EOL;
exit;
}
@@ -81,9 +81,9 @@ foreach ($sessions as $session) {
$administrator['email']
);
- echo '============' . PHP_EOL;
- echo "Email sent to: {$user->getCompleteName()} ({$user->getEmail()})" . PHP_EOL;
- echo "Session: {$session->getName()}" . PHP_EOL;
- echo "End date: {$session->getAccessEndDate()->format('Y-m-d h:i')}" . PHP_EOL;
+ echo '============'.PHP_EOL;
+ echo "Email sent to: {$user->getCompleteName()} ({$user->getEmail()})".PHP_EOL;
+ echo "Session: {$session->getName()}".PHP_EOL;
+ echo "End date: {$session->getAccessEndDate()->format('Y-m-d h:i')}".PHP_EOL;
}
}
diff --git a/main/cron/create_course_sessions.php b/main/cron/create_course_sessions.php
index 1a28bd52fd..a5bcb9f158 100644
--- a/main/cron/create_course_sessions.php
+++ b/main/cron/create_course_sessions.php
@@ -14,7 +14,7 @@ if (php_sapi_name() != 'cli') {
exit; //do not run from browser
}
-require_once __DIR__ . "/../inc/global.inc.php";
+require_once __DIR__."/../inc/global.inc.php";
// First day of the current month to create sessions and add courses for the next month (e.g. "07")
define("OFFSET", "15");
@@ -41,7 +41,7 @@ function getQuarterFirstAndLastDates($initialDate = null)
{
$startDate = $initialDate ? $initialDate : date("Y-m-01");
$month = getQuarterFirstMonth(getQuarter(date('m', $startDate)));
- $startDate = substr($startDate, 0, 5) . $month . '-01';
+ $startDate = substr($startDate, 0, 5).$month.'-01';
$nextQuarterStartDate = date('Y-m-d', api_strtotime($startDate.' + 3 month'));
$endDate = date('Y-m-d', api_strtotime($nextQuarterStartDate.' - 1 minute'));
return array('startDate' => $startDate, 'endDate' => $endDate);
@@ -148,8 +148,7 @@ function createCourseSessions($courses, $administratorId, $startDate, $endDate)
{
echo "\n";
echo $courses ?
- "Creating sessions and adding courses for the period between ".$startDate." and ".$endDate :
- "Every course is already in session for the period between ".$startDate." and ".$endDate;
+ "Creating sessions and adding courses for the period between ".$startDate." and ".$endDate : "Every course is already in session for the period between ".$startDate." and ".$endDate;
echo "\n=====================================================================================\n\n";
// Loop through courses creating one session per each and adding them
foreach ($courses as $course) {
@@ -158,8 +157,8 @@ function createCourseSessions($courses, $administratorId, $startDate, $endDate)
$year = date("Y", api_strtotime($startDate));
$quarter = getQuarter($month);
$quarter = getQuarterRoman($quarter);
- $period = $year . '-' . $quarter;
- $sessionName = '[' . $period . '] ' . $course['title'];
+ $period = $year.'-'.$quarter;
+ $sessionName = '['.$period.'] '.$course['title'];
$sessionId = SessionManager::create_session(
$sessionName,
$startDate,
@@ -178,7 +177,7 @@ function createCourseSessions($courses, $administratorId, $startDate, $endDate)
}
// Starts the script
-echo "Starting process..." . PHP_EOL;
+echo "Starting process...".PHP_EOL;
// Get first active administrator
$administrators = array_reverse(UserManager::get_all_administrators());
$lastingAdministrators = count($administrators);
@@ -199,7 +198,7 @@ createCourseSessions($courses, $administratorId, $dates['startDate'], $dates['en
// Creates course sessions for the following month
$offsetDay = intval(substr($dates['endDate'], 8, 2)) - OFFSET;
-if (date("Y-m-d") >= date(substr($dates['endDate'], 0, 8) . $offsetDay)) {
+if (date("Y-m-d") >= date(substr($dates['endDate'], 0, 8).$offsetDay)) {
$dates = getQuarterFirstAndLastDates(date("Y-m-d", api_strtotime(date("Y-m-01")." + 3 month")));
// Get courses that don't have any session the next month
$courses = CourseManager::getCoursesWithoutSession($dates['startDate'], $dates['endDate']);
diff --git a/main/cron/document/finddoc.php b/main/cron/document/finddoc.php
index b79ee240a5..8aaf074e73 100755
--- a/main/cron/document/finddoc.php
+++ b/main/cron/document/finddoc.php
@@ -12,13 +12,13 @@ if (empty($_GET['doc'])) {
} else {
echo "Received param ".Security::remove_XSS($_GET['doc'])."
";
}
-$courses_list = CourseManager::get_courses_list();
+$courses_list = CourseManager::get_courses_list();
foreach ($courses_list as $course) {
$title = Database::escape_string($_GET['doc']);
$td = Database::get_course_table(TABLE_DOCUMENT);
$sql = "SELECT id, path FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' OR title LIKE '%$title%'";
$res = Database::query($sql);
- if (Database::num_rows($res)>0) {
+ if (Database::num_rows($res) > 0) {
while ($row = Database::fetch_array($res)) {
echo "Found doc ".$row['id']."-> ".$row['path']." in course ".$course['code']."
";
}
diff --git a/main/cron/fix_fill_blank.php b/main/cron/fix_fill_blank.php
index 34dc6cbfcc..1458f9bf2c 100644
--- a/main/cron/fix_fill_blank.php
+++ b/main/cron/fix_fill_blank.php
@@ -9,7 +9,7 @@ $table = Database::get_course_table(TABLE_QUIZ_ANSWER);
$execute = isset($_GET['execute']) ? $_GET['execute'] : null;
$courseId = isset($_GET['c_id']) ? $_GET['c_id'] : null;
-$questionId = isset($_GET['question_id']) ? $_GET['question_id'] : null;
+$questionId = isset($_GET['question_id']) ? $_GET['question_id'] : null;
$sql2 = "SELECT * FROM $table WHERE answer LIKE '%[%]%'";
diff --git a/main/cron/fix_online_time.php b/main/cron/fix_online_time.php
index 4e641401a8..008fa02f02 100644
--- a/main/cron/fix_online_time.php
+++ b/main/cron/fix_online_time.php
@@ -6,7 +6,7 @@
* @package chamilo.cron
* @author Imanol Losada
*/
-require_once __DIR__ . '/../inc/global.inc.php';
+require_once __DIR__.'/../inc/global.inc.php';
/**
* Get ids of COURSEMANAGERs that are inside a course right now
@@ -15,9 +15,9 @@ require_once __DIR__ . '/../inc/global.inc.php';
function getTeachersInCourseIds()
{
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
- $joinStatement = ' JOIN ' . Database::get_main_table(TABLE_MAIN_USER) . ' ON login_user_id = user_id';
+ $joinStatement = ' JOIN '.Database::get_main_table(TABLE_MAIN_USER).' ON login_user_id = user_id';
return Database::select(
- 'login_user_id', $table . $joinStatement,
+ 'login_user_id', $table.$joinStatement,
array(
'where' => array(
'c_id IS NOT NULL AND status = ?' => array(
@@ -44,7 +44,7 @@ function updateTeachersInCourseIdleForTimeLimit($teachersInCourseIds)
$dataBaseCurrentHour = array_shift($utcResult);
$maximumIdleTimeInCourse = date(
'Y-m-d H:i:s',
- strtotime($dataBaseCurrentHour . ' ' . $timeLimit)
+ strtotime($dataBaseCurrentHour.' '.$timeLimit)
);
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$onLineTrackTable = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
@@ -69,7 +69,7 @@ function updateTeachersInCourseIdleForTimeLimit($teachersInCourseIds)
array(
'logout_course_date' => date(
'Y-m-d H:i:s',
- strtotime($currentTeacherData['logout_course_date'] . ' ' . $extraTime)
+ strtotime($currentTeacherData['logout_course_date'].' '.$extraTime)
)
),
array(
diff --git a/main/cron/hosting_total_size_limit.php b/main/cron/hosting_total_size_limit.php
index 759a32777b..10db4ed2e5 100644
--- a/main/cron/hosting_total_size_limit.php
+++ b/main/cron/hosting_total_size_limit.php
@@ -97,7 +97,7 @@ function calculateTotalPortalSize($debug)
$totalSize = $row['total'];
if ($debug) {
- echo "Total size in table $table " . (round($totalSize / 1024)) . " MB \n";
+ echo "Total size in table $table ".(round($totalSize / 1024))." MB \n";
}
$table = Database::get_course_table(TABLE_FORUM_ATTACHMENT);
@@ -107,7 +107,7 @@ function calculateTotalPortalSize($debug)
$subTotal = $row['total'];
$totalSize += $subTotal;
if ($debug) {
- echo "Total size in table $table " . (round($subTotal / 1024)) . " MB \n";
+ echo "Total size in table $table ".(round($subTotal / 1024))." MB \n";
}
$totalSize = $totalSize / 1024;
diff --git a/main/cron/lang/check_parse_lang.php b/main/cron/lang/check_parse_lang.php
index 1bbf362304..b4cc8f8ba1 100755
--- a/main/cron/lang/check_parse_lang.php
+++ b/main/cron/lang/check_parse_lang.php
@@ -9,7 +9,7 @@
//die();
require_once '../../inc/global.inc.php';
$path = api_get_path(SYS_LANG_PATH).'english';
-ini_set('memory_limit','128M');
+ini_set('memory_limit', '128M');
/**
* Main code
*/
@@ -18,7 +18,7 @@ $list = SubLanguageManager::get_lang_folder_files_list($path);
$langs = scandir(api_get_path(SYS_LANG_PATH));
foreach ($langs as $lang) {
$dir = api_get_path(SYS_LANG_PATH).$lang;
- if (is_dir($dir) && substr($lang,0,1) != '.' && !empty($lang)) {
+ if (is_dir($dir) && substr($lang, 0, 1) != '.' && !empty($lang)) {
echo "$lang...";
$ok = true;
foreach ($list as $entry) {
@@ -26,8 +26,8 @@ foreach ($langs as $lang) {
$out = array();
if (is_file($file)) {
//$terms = array_merge($terms,SubLanguageManager::get_all_language_variable_in_file($file,true));
- @exec('php5 -l '.$file,$out);
- if (substr($out[0],0,2)!='No') {
+ @exec('php5 -l '.$file, $out);
+ if (substr($out[0], 0, 2) != 'No') {
echo $out[0]."\n";
$ok = false;
}
diff --git a/main/cron/lang/langstats_file_builder.php b/main/cron/lang/langstats_file_builder.php
index 2cb7e084e6..fb6f70fcfd 100755
--- a/main/cron/lang/langstats_file_builder.php
+++ b/main/cron/lang/langstats_file_builder.php
@@ -34,7 +34,7 @@ $arch_dir = api_get_path(SYS_ARCHIVE_PATH);
*/
foreach ($terms as $row) {
if ($words_counter > 10000) { break; }
- $words = str_word_count(get_lang($row['term_name'],null,$orig_lang));
+ $words = str_word_count(get_lang($row['term_name'], null, $orig_lang));
$words_counter += $words;
$terms_in_limit[$row['term_name']] = $i;
//echo "Term ".$row['term_name']." is '".get_lang($row['term_name'],null,$orig_lang)."' which means $words words
\n";
@@ -59,37 +59,37 @@ $words_found = 0;
$global_var = array(); //keep the combination of all vars
$terms_in_limit = array_flip($terms_in_limit);
foreach ($list_files as $file) {
- if (substr($file,0,1) == '.') {continue;}
+ if (substr($file, 0, 1) == '.') {continue; }
//echo "'".substr($file,0,-8)."',
"; //print in a PHP array format
$vars = file($lang_dir.'/'.$orig_lang.'/'.$file);
$local_var = array();
$file_string = '0) {
+ $res = preg_match('/^(\$\w*)/', $line, $var);
+ if ($res > 0) {
//echo $var[1]."
";
- if (in_array(substr($var[1],1),$terms_in_limit)) {
+ if (in_array(substr($var[1], 1), $terms_in_limit)) {
//echo "Var ".$var[1]." was in the limit
";
$local_var[$var[1]] = $line;
$file_string .= $line;
- $terms_found[] = substr($var[1],1); //e.g. store Tools
- $words_found += str_word_count(get_lang($var[1],null,$orig_lang));
- } elseif (in_array(substr($var[1],5),$terms_in_limit)) {
+ $terms_found[] = substr($var[1], 1); //e.g. store Tools
+ $words_found += str_word_count(get_lang($var[1], null, $orig_lang));
+ } elseif (in_array(substr($var[1], 5), $terms_in_limit)) {
//echo "Var ".$var[1]." was in the limit
";
$local_var[$var[1]] = $line;
$file_string .= $line;
- $terms_found[] = substr($var[1],5); //e.g. store langTools
- $words_found += str_word_count(get_lang(substr($var[1],5),null,$orig_lang));
+ $terms_found[] = substr($var[1], 5); //e.g. store langTools
+ $words_found += str_word_count(get_lang(substr($var[1], 5), null, $orig_lang));
} //else do not care
}
}
echo "Writing ".$arch_dir.'/langstats/'.$orig_lang.'/'.$file."
\n";
- file_put_contents($arch_dir.'/langstats/'.$orig_lang.'/'.$file,$file_string);
+ file_put_contents($arch_dir.'/langstats/'.$orig_lang.'/'.$file, $file_string);
$global_var += $local_var;
};
-$terms_diff = count($global_var)-count($terms_in_limit);
+$terms_diff = count($global_var) - count($terms_in_limit);
echo count($global_var)." terms found in English files (summing up to $words_found words). Some terms ($terms_diff in this case) might have appeared in two different files
";
/**
* Display results
@@ -97,5 +97,5 @@ echo count($global_var)." terms found in English files (summing up to $words_fou
echo "Difference between filtered and found in English:
";
//print_r($terms_found);
-echo "".print_r(array_diff($terms_in_limit,$terms_found),1)."
";
+echo "".print_r(array_diff($terms_in_limit, $terms_found), 1)."
";
echo "#";
diff --git a/main/cron/lang/list_undefined_langvars.php b/main/cron/lang/list_undefined_langvars.php
index e3a409c2bd..31cb31290e 100755
--- a/main/cron/lang/list_undefined_langvars.php
+++ b/main/cron/lang/list_undefined_langvars.php
@@ -9,7 +9,7 @@
die();
require_once '../../inc/global.inc.php';
$path = api_get_path(SYS_LANG_PATH).'english';
-ini_set('memory_limit','128M');
+ini_set('memory_limit', '128M');
/**
* Main code
*/
@@ -18,7 +18,7 @@ $list = SubLanguageManager::get_lang_folder_files_list($path);
foreach ($list as $entry) {
$file = $path.'/'.$entry;
if (is_file($file)) {
- $terms = array_merge($terms,SubLanguageManager::get_all_language_variable_in_file($file,true));
+ $terms = array_merge($terms, SubLanguageManager::get_all_language_variable_in_file($file, true));
}
}
// get only the array keys (the language variables defined in language files)
@@ -31,13 +31,13 @@ $l = strlen(api_get_path(SYS_PATH));
$files = get_all_php_files(api_get_path(SYS_PATH));
foreach ($files as $file) {
//echo 'Analyzing '.$file."
";
- $shortfile = substr($file,$l);
+ $shortfile = substr($file, $l);
$lines = file($file);
foreach ($lines as $line) {
$myterms = array();
- $res = preg_match_all('/get_lang\(\'(\\w*)\'\)/',$line,$myterms);
+ $res = preg_match_all('/get_lang\(\'(\\w*)\'\)/', $line, $myterms);
if ($res > 0) {
- foreach($myterms[1] as $term) {
+ foreach ($myterms[1] as $term) {
if (!isset($defined_terms[$term]) && !isset($defined_terms['lang'.$term])) {
$undefined_terms[$term] = $shortfile;
//echo "Undefined: $term
";
@@ -45,9 +45,9 @@ foreach ($files as $file) {
}
}
$res = 0;
- $res = preg_match_all('/\{[\'"](\\w*)[\'"]\|get_lang\}/',$line,$myterms);
+ $res = preg_match_all('/\{[\'"](\\w*)[\'"]\|get_lang\}/', $line, $myterms);
if ($res > 0) {
- foreach($myterms[1] as $term) {
+ foreach ($myterms[1] as $term) {
if (!isset($defined_terms[$term]) && !isset($defined_terms['lang'.$term])) {
$undefined_terms[$term] = $shortfile;
//echo "Undefined: $term
";
@@ -58,10 +58,10 @@ foreach ($files as $file) {
flush();
}
//$undefined_terms = array_flip($undefined_terms);
-if (count($undefined_terms)<1) { die("No missing terms
\n"); } else { echo "The following terms were nowhere to be found:
\n"; }
+if (count($undefined_terms) < 1) { die("No missing terms
\n"); } else { echo "The following terms were nowhere to be found:
\n"; }
foreach ($undefined_terms as $term => $file) {
echo "$term in $file";
- if (substr($file,0,7)=='plugin/') {
+ if (substr($file, 0, 7) == 'plugin/') {
echo " (this one should be taken care of by the plugin's language files)";
}
echo " \n";
@@ -73,14 +73,14 @@ function get_all_php_files($base_path) {
$list = scandir($base_path);
$files = array();
foreach ($list as $item) {
- if (substr($item,0,1)=='.') {continue;}
- $special_dirs = array(api_get_path(SYS_TEST_PATH),api_get_path(SYS_COURSE_PATH),api_get_path(SYS_LANG_PATH),api_get_path(SYS_ARCHIVE_PATH));
- if (in_array($base_path.$item.'/',$special_dirs)) {continue;}
+ if (substr($item, 0, 1) == '.') {continue; }
+ $special_dirs = array(api_get_path(SYS_TEST_PATH), api_get_path(SYS_COURSE_PATH), api_get_path(SYS_LANG_PATH), api_get_path(SYS_ARCHIVE_PATH));
+ if (in_array($base_path.$item.'/', $special_dirs)) {continue; }
if (is_dir($base_path.$item)) {
- $files = array_merge($files,get_all_php_files($base_path.$item.'/'));
+ $files = array_merge($files, get_all_php_files($base_path.$item.'/'));
} else {
//only analyse php files
- $sub = substr($item,-4);
+ $sub = substr($item, -4);
if ($sub == '.php' or $sub == '.tpl') {
$files[] = $base_path.$item;
}
diff --git a/main/cron/lang/list_unused_langvars.php b/main/cron/lang/list_unused_langvars.php
index d188833052..92681e3b5b 100755
--- a/main/cron/lang/list_unused_langvars.php
+++ b/main/cron/lang/list_unused_langvars.php
@@ -43,7 +43,7 @@ foreach ($files as $file) {
$res = preg_match_all('/get_lang\(\'(\\w*)\'\)/', $line, $myTerms);
if ($res > 0) {
foreach ($myTerms[1] as $term) {
- if (substr($term, 0, 4)=='lang') {
+ if (substr($term, 0, 4) == 'lang') {
$term = substr($term, 4);
}
$usedTerms[$term] = $shortFile;
@@ -53,7 +53,7 @@ foreach ($files as $file) {
$res = preg_match_all('/\{[\'"](\\w*)[\'"]\|get_lang\}/', $line, $myTerms);
if ($res > 0) {
foreach ($myTerms[1] as $term) {
- if (substr($term, 0, 4)=='lang') {
+ if (substr($term, 0, 4) == 'lang') {
$term = substr($term, 4);
}
$usedTerms[$term] = $shortFile;
@@ -67,7 +67,7 @@ foreach ($files as $file) {
// Compare defined terms VS used terms. Used terms should be smaller than
// defined terms, and this should prove the concept that there are much
// more variables than what we really use
-if (count($usedTerms)<1) {
+if (count($usedTerms) < 1) {
die("No used terms
\n");
} else {
echo "The following terms were defined but never used:
\n";
@@ -75,7 +75,7 @@ if (count($usedTerms)<1) {
$i = 1;
foreach ($defined_terms as $term => $file) {
// remove "lang" prefix just in case
- if (substr($term,0,4)=='lang') { $term = substr($term,4); }
+ if (substr($term, 0, 4) == 'lang') { $term = substr($term, 4); }
if (!isset($usedTerms[$term])) {
echo "$i $term \n";
$i++;
@@ -88,14 +88,14 @@ function get_all_php_files($base_path) {
$list = scandir($base_path);
$files = array();
foreach ($list as $item) {
- if (substr($item,0,1)=='.') {continue;}
- $special_dirs = array(api_get_path(SYS_TEST_PATH),api_get_path(SYS_COURSE_PATH),api_get_path(SYS_LANG_PATH),api_get_path(SYS_ARCHIVE_PATH));
- if (in_array($base_path.$item.'/',$special_dirs)) {continue;}
+ if (substr($item, 0, 1) == '.') {continue; }
+ $special_dirs = array(api_get_path(SYS_TEST_PATH), api_get_path(SYS_COURSE_PATH), api_get_path(SYS_LANG_PATH), api_get_path(SYS_ARCHIVE_PATH));
+ if (in_array($base_path.$item.'/', $special_dirs)) {continue; }
if (is_dir($base_path.$item)) {
- $files = array_merge($files,get_all_php_files($base_path.$item.'/'));
+ $files = array_merge($files, get_all_php_files($base_path.$item.'/'));
} else {
//only analyse php files
- $sub = substr($item,-4);
+ $sub = substr($item, -4);
if ($sub == '.php' or $sub == '.tpl') {
$files[] = $base_path.$item;
}
diff --git a/main/cron/user_import/resend_email_with_new_password.php b/main/cron/user_import/resend_email_with_new_password.php
index dcf48c09ed..d7d83bb075 100755
--- a/main/cron/user_import/resend_email_with_new_password.php
+++ b/main/cron/user_import/resend_email_with_new_password.php
@@ -34,13 +34,13 @@ foreach ($list as $mail) {
FROM $users WHERE email = '$mail'\n";
$res = Database::query($sql);
if ($res === false) {
- echo 'Error in database with email ' . $mail . "\n";
+ echo 'Error in database with email '.$mail."\n";
}
if (Database::num_rows($res) == 0) {
- echo '[Error] Email not found in database: ' . $row['email'] . "\n";
+ echo '[Error] Email not found in database: '.$row['email']."\n";
} else {
$row = Database::fetch_assoc($res);
- $pass = api_substr($row['username'], 0, 4) . rand(0, 9) . rand(0, 9);
+ $pass = api_substr($row['username'], 0, 4).rand(0, 9).rand(0, 9);
if ($user) {
@@ -71,8 +71,8 @@ foreach ($list as $mail) {
null,
PERSON_NAME_EMAIL_ADDRESS
);
- $emailsubject = '[' . api_get_setting('siteName') . '] ' . get_lang('YourReg', null, $l) . ' ' . api_get_setting('siteName');
- $emailbody = get_lang('Dear', null, $l) . ' ' . api_get_person_name($user['FirstName'], $user['LastName']) . ",\n\n" . get_lang('YouAreReg', null, $l) . " " . api_get_setting('siteName') . " " . get_lang('WithTheFollowingSettings', null, $l) . "\n\n" . get_lang('Username', null, $l) . " : " . $user['UserName'] . "\n" . get_lang('Pass', null, $l) . " : " . $user['Password'] . "\n\n" . get_lang('Address', null, $l) . " " . api_get_setting('siteName') . " " . get_lang('Is', null, $l) . " : " . api_get_path(WEB_PATH) . " \n\n" . get_lang('Problem', null, $l) . "\n\n" . get_lang('Formula', null, $l) . ",\n\n" . api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname')) . "\n" . get_lang('Manager', null, $l) . " " . api_get_setting('siteName') . "\nT. " . api_get_setting('administratorTelephone') . "\n" . get_lang('Email', null, $l) . " : " . api_get_setting('emailAdministrator') . "";
+ $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg', null, $l).' '.api_get_setting('siteName');
+ $emailbody = get_lang('Dear', null, $l).' '.api_get_person_name($user['FirstName'], $user['LastName']).",\n\n".get_lang('YouAreReg', null, $l)." ".api_get_setting('siteName')." ".get_lang('WithTheFollowingSettings', null, $l)."\n\n".get_lang('Username', null, $l)." : ".$user['UserName']."\n".get_lang('Pass', null, $l)." : ".$user['Password']."\n\n".get_lang('Address', null, $l)." ".api_get_setting('siteName')." ".get_lang('Is', null, $l)." : ".api_get_path(WEB_PATH)." \n\n".get_lang('Problem', null, $l)."\n\n".get_lang('Formula', null, $l).",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n".get_lang('Manager', null, $l)." ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n".get_lang('Email', null, $l)." : ".api_get_setting('emailAdministrator')."";
$sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
$email_admin = api_get_setting('emailAdministrator');
@api_mail_html(
diff --git a/main/inc/lib/array.lib.php b/main/inc/lib/array.lib.php
index a07aac9614..21411bf49f 100755
--- a/main/inc/lib/array.lib.php
+++ b/main/inc/lib/array.lib.php
@@ -110,10 +110,10 @@ function utf8_sort($array)
{
$old_locale = setlocale(LC_ALL, null);
$code = api_get_language_isocode();
- $locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8');
+ $locale_list = array($code.'.utf8', 'en.utf8', 'en_US.utf8', 'en_GB.utf8');
$try_sort = false;
- foreach($locale_list as $locale) {
+ foreach ($locale_list as $locale) {
$my_local = setlocale(LC_COLLATE, $locale);
if ($my_local) {
$try_sort = true;
@@ -151,7 +151,7 @@ function array_flatten(array $array)
$flatten = array();
array_walk_recursive(
$array,
- function ($value) use (&$flatten) {
+ function($value) use (&$flatten) {
$flatten[] = $value;
}
);
diff --git a/main/inc/lib/baker.lib.php b/main/inc/lib/baker.lib.php
index 920f8d32cd..a28223a03f 100644
--- a/main/inc/lib/baker.lib.php
+++ b/main/inc/lib/baker.lib.php
@@ -51,7 +51,7 @@ class PNGImageBaker
foreach (array_keys($this->_chunks[$type]) as $typekey) {
list($key, $data) = explode("\0", $this->_chunks[$type][$typekey]);
if (strcmp($key, $check) == 0) {
- echo 'Key "' . $check . '" already exists in "' . $type . '" chunk.';
+ echo 'Key "'.$check.'" already exists in "'.$type.'" chunk.';
return false;
}
}
@@ -70,11 +70,11 @@ class PNGImageBaker
*/
public function addChunk($chunkType, $key, $value) {
- $chunkData = $key . "\0" . $value;
- $crc = pack("N", crc32($chunkType . $chunkData));
+ $chunkData = $key."\0".$value;
+ $crc = pack("N", crc32($chunkType.$chunkData));
$len = pack("N", strlen($chunkData));
- $newChunk = $len . $chunkType . $chunkData . $crc;
+ $newChunk = $len.$chunkType.$chunkData.$crc;
$result = substr($this->_contents, 0, $this->_size - 12)
. $newChunk
. substr($this->_contents, $this->_size - 12, 12);
@@ -92,30 +92,30 @@ class PNGImageBaker
*/
public function removeChunks($chunkType, $key, $png) {
// Read the magic bytes and verify
- $retval = substr($png,0,8);
+ $retval = substr($png, 0, 8);
$ipos = 8;
if ($retval != "\x89PNG\x0d\x0a\x1a\x0a")
throw new Exception('Is not a valid PNG image');
// Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type
- $chunkHeader = substr($png,$ipos,8);
+ $chunkHeader = substr($png, $ipos, 8);
$ipos = $ipos + 8;
while ($chunkHeader) {
// Extract length and type from binary data
$chunk = @unpack('Nsize/a4type', $chunkHeader);
$skip = false;
- if ( $chunk['type'] == $chunkType ) {
- $data = substr($png,$ipos,$chunk['size']);
+ if ($chunk['type'] == $chunkType) {
+ $data = substr($png, $ipos, $chunk['size']);
$sections = explode("\0", $data);
print_r($sections);
- if ( $sections[0] == $key ) $skip = true;
+ if ($sections[0] == $key) $skip = true;
}
// Extract the data and the CRC
- $data = substr($png,$ipos,$chunk['size']+4);
+ $data = substr($png, $ipos, $chunk['size'] + 4);
$ipos = $ipos + $chunk['size'] + 4;
// Add in the header, data, and CRC
- if ( ! $skip ) $retval = $retval . $chunkHeader . $data;
+ if (!$skip) $retval = $retval.$chunkHeader.$data;
// Read next chunk header
- $chunkHeader = substr($png,$ipos,8);
+ $chunkHeader = substr($png, $ipos, 8);
$ipos = $ipos + 8;
}
return $retval;
@@ -131,34 +131,34 @@ class PNGImageBaker
* If there is PNG information that matches the key an array is returned
*
*/
- public function extractBadgeInfo($png, $key='openbadges') {
+ public function extractBadgeInfo($png, $key = 'openbadges') {
// Read the magic bytes and verify
- $retval = substr($png,0,8);
+ $retval = substr($png, 0, 8);
$ipos = 8;
if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") {
return false;
}
// Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type
- $chunkHeader = substr($png,$ipos,8);
+ $chunkHeader = substr($png, $ipos, 8);
$ipos = $ipos + 8;
while ($chunkHeader) {
// Extract length and type from binary data
$chunk = @unpack('Nsize/a4type', $chunkHeader);
$skip = false;
if ($chunk['type'] == 'tEXt') {
- $data = substr($png,$ipos,$chunk['size']);
+ $data = substr($png, $ipos, $chunk['size']);
$sections = explode("\0", $data);
if ($sections[0] == $key) {
return $sections;
}
}
// Extract the data and the CRC
- $data = substr($png,$ipos,$chunk['size']+4);
+ $data = substr($png, $ipos, $chunk['size'] + 4);
$ipos = $ipos + $chunk['size'] + 4;
// Read next chunk header
- $chunkHeader = substr($png,$ipos,8);
+ $chunkHeader = substr($png, $ipos, 8);
$ipos = $ipos + 8;
}
}
diff --git a/main/inc/lib/custom_pages.class.php b/main/inc/lib/custom_pages.class.php
index 4eb11b874c..252f8f1968 100755
--- a/main/inc/lib/custom_pages.class.php
+++ b/main/inc/lib/custom_pages.class.php
@@ -35,7 +35,7 @@ class CustomPages
*/
public static function path($name = '')
{
- return api_get_path(SYS_PATH) . 'custompages/' . $name;
+ return api_get_path(SYS_PATH).'custompages/'.$name;
}
/**
@@ -50,12 +50,12 @@ class CustomPages
return false;
}
- $file = self::path($page_name . '.php');
+ $file = self::path($page_name.'.php');
if (file_exists($file)) {
include($file);
exit;
} else {
- error_log('CustomPages::displayPage : could not read file ' . $file);
+ error_log('CustomPages::displayPage : could not read file '.$file);
}
}
@@ -69,14 +69,14 @@ class CustomPages
public static function getURLImages($url_id = null)
{
if (is_null($url_id)) {
- $url = 'http://' . $_SERVER['HTTP_HOST'] . '/';
+ $url = 'http://'.$_SERVER['HTTP_HOST'].'/';
$url_id = UrlManager::get_url_id($url);
}
- $url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/';
+ $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/';
$images = array();
for ($img_id = 1; $img_id <= 3; $img_id++) {
- if (file_exists($url_images_dir . $url_id . '_url_image_' . $img_id . '.png')) {
- $images[] = api_get_path(WEB_PATH) . 'custompages/url-images/' . $url_id . '_url_image_' . $img_id . '.png';
+ if (file_exists($url_images_dir.$url_id.'_url_image_'.$img_id.'.png')) {
+ $images[] = api_get_path(WEB_PATH).'custompages/url-images/'.$url_id.'_url_image_'.$img_id.'.png';
}
}
diff --git a/main/inc/lib/events_email.class.php b/main/inc/lib/events_email.class.php
index d444ea50f0..f1199bf9a4 100755
--- a/main/inc/lib/events_email.class.php
+++ b/main/inc/lib/events_email.class.php
@@ -123,7 +123,7 @@ class EventsMail
// If the mail only need to be send once (we know that thanks to the events.conf), we log it in the table
if ($event_config[$event_name]["sending_mail_once"]) {
- $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . ' (user_from, user_to, event_type_name)
+ $sql = 'INSERT INTO '.Database::get_main_table(TABLE_EVENT_SENT).' (user_from, user_to, event_type_name)
VALUES ('.$event_data["user_id"].', '.$id.' ,"'.Database::escape_string($event_name).'")
';
Database::query($sql);
@@ -134,9 +134,9 @@ class EventsMail
// Second, we send to people linked to the event
// So, we get everyone
$sql = 'SELECT u.user_id, u.language, u.email, u.firstname, u.lastname
- FROM ' . Database::get_main_table(TABLE_EVENT_TYPE_REL_USER) . ' ue
+ FROM ' . Database::get_main_table(TABLE_EVENT_TYPE_REL_USER).' ue
INNER JOIN '.Database::get_main_table(TABLE_MAIN_USER).' u ON u.user_id = ue.user_id
- WHERE event_type_name = "' . $event_name . '"';
+ WHERE event_type_name = "' . $event_name.'"';
$result = Database::store_result(Database::query($sql), 'ASSOC');
// for each of the linked users
foreach ($result as $key => $value) {
@@ -176,7 +176,7 @@ class EventsMail
// If the mail only need to be send once (we know that thanks to the events.conf, we log it in the table
if ($event_config[$event_name]["sending_mail_once"]) {
- $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . '
+ $sql = 'INSERT INTO '.Database::get_main_table(TABLE_EVENT_SENT).'
(user_from, user_to, event_type_name)
VALUES ('.$event_data["user_id"].', '.$value["user_id"].' , "'.Database::escape_string($event_name).'");
';
@@ -201,16 +201,16 @@ class EventsMail
$current_language = api_get_interface_language();
$sql = 'SELECT COUNT(*) as total
- FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE) . ' em
- INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE) . ' l
+ FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE).' em
+ INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE).' l
ON em.language_id = l.id
WHERE
- em.event_type_name = "' . $event_name . '" and
+ em.event_type_name = "' . $event_name.'" and
l.dokeos_folder = "'.$current_language.'" and
em.activated = 1';
$exists = Database::store_result(Database::query($sql), 'ASSOC');
- if ($exists[0]["total"]) {
+ if ($exists[0]["total"]) {
return true;
} else {
return false;
@@ -227,12 +227,12 @@ class EventsMail
private static function getMessage($event_name, $language)
{
$sql = 'SELECT message, subject, l.dokeos_folder
- FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE) . ' em
- INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE) . ' l
+ FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE).' em
+ INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE).' l
ON em.language_id = l.id
WHERE
- em.event_type_name = "' . $event_name . '" AND
- (l.dokeos_folder = "' . $language . '" OR l.dokeos_folder = "english") AND
+ em.event_type_name = "' . $event_name.'" AND
+ (l.dokeos_folder = "' . $language.'" OR l.dokeos_folder = "english") AND
em.message <> ""
';
return Database::store_result(Database::query($sql), 'ASSOC');
@@ -273,8 +273,8 @@ class EventsMail
private static function formatMessage(&$message, &$subject, $event_config, $event_name, &$event_data)
{
foreach ($event_config[$event_name]["available_keyvars"] as $key => $word) {
- $message = str_replace('((' . $key . '))', $event_data[$word], $message);
- $subject = str_replace('((' . $key . '))', $event_data[$word], $subject);
+ $message = str_replace('(('.$key.'))', $event_data[$word], $message);
+ $subject = str_replace('(('.$key.'))', $event_data[$word], $subject);
}
}
}
diff --git a/main/inc/lib/export.lib.inc.php b/main/inc/lib/export.lib.inc.php
index 8e6939e5a6..b8adc78e60 100755
--- a/main/inc/lib/export.lib.inc.php
+++ b/main/inc/lib/export.lib.inc.php
@@ -102,7 +102,7 @@ class Export
}
foreach ($data as $row) {
$string = implode("", $row);
- $string = ' ' . $string . ' ';
+ $string = ''.$string.' ';
if ($encoding != 'utf-8') {
$string = api_convert_encoding($string, $encoding, $systemEncoding);
}
@@ -176,7 +176,7 @@ class Export
fwrite($handle, '<'.$wrapper_tagname.'>');
}
$s = self::_export_complex_table_xml_helper($data);
- fwrite($handle,$s);
+ fwrite($handle, $s);
if (!is_null($wrapper_tagname)) {
fwrite($handle, ''.$wrapper_tagname.'>'."\n");
}
@@ -198,10 +198,10 @@ class Export
}
$string = '';
foreach ($data as $row) {
- $string .= "\n".str_repeat("\t",$level).'<'.$row['name'].'>';
+ $string .= "\n".str_repeat("\t", $level).'<'.$row['name'].'>';
if (is_array($row['value'])) {
- $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n";
- $string .= str_repeat("\t",$level).''.$row['name'].'>';
+ $string .= self::_export_complex_table_xml_helper($row['value'], $level + 1)."\n";
+ $string .= str_repeat("\t", $level).''.$row['name'].'>';
} else {
$string .= $row['value'];
$string .= ''.$row['name'].'>';
diff --git a/main/inc/lib/formvalidator/Element/DateRangePicker.php b/main/inc/lib/formvalidator/Element/DateRangePicker.php
index 1386841379..9cd99fb742 100755
--- a/main/inc/lib/formvalidator/Element/DateRangePicker.php
+++ b/main/inc/lib/formvalidator/Element/DateRangePicker.php
@@ -88,7 +88,7 @@ class DateRangePicker extends HTML_QuickForm_text
}
$timePicker = 'true';
- $timePickerValue = $this->getAttribute('timePicker');
+ $timePickerValue = $this->getAttribute('timePicker');
if (!empty($timePickerValue)) {
$timePicker = $timePickerValue;
}
diff --git a/main/inc/lib/formvalidator/Rule/MultipleRequired.php b/main/inc/lib/formvalidator/Rule/MultipleRequired.php
index 93f2d3abdb..51fd068bc9 100755
--- a/main/inc/lib/formvalidator/Rule/MultipleRequired.php
+++ b/main/inc/lib/formvalidator/Rule/MultipleRequired.php
@@ -27,11 +27,11 @@ class HTML_QuickForm_Rule_MultipleRequired extends HTML_QuickForm_Rule
*/
function validate($value, $options = null)
{
- if(is_array($value))
+ if (is_array($value))
{
- $value = implode(null,$value);
+ $value = implode(null, $value);
}
- if ((string)$value == '') {
+ if ((string) $value == '') {
return false;
}
return true;
diff --git a/main/inc/lib/hook/HookManagement.php b/main/inc/lib/hook/HookManagement.php
index 46d0da5d74..083e1c7761 100644
--- a/main/inc/lib/hook/HookManagement.php
+++ b/main/inc/lib/hook/HookManagement.php
@@ -145,10 +145,10 @@ class HookManagement implements HookManagementInterface
public function listHookObservers($eventName)
{
$array = array();
- $joinTable = $this->tables[TABLE_HOOK_CALL] . ' hc' .
- ' INNER JOIN ' . $this->tables[TABLE_HOOK_EVENT] . ' he' .
- ' ON hc.hook_event_id = he.id ' .
- ' INNER JOIN ' . $this->tables[TABLE_HOOK_OBSERVER] . ' ho ' .
+ $joinTable = $this->tables[TABLE_HOOK_CALL].' hc'.
+ ' INNER JOIN '.$this->tables[TABLE_HOOK_EVENT].' he'.
+ ' ON hc.hook_event_id = he.id '.
+ ' INNER JOIN '.$this->tables[TABLE_HOOK_OBSERVER].' ho '.
' ON hc.hook_observer_id = ho.id ';
$columns = 'ho.class_name, ho.path, ho.plugin_name, hc.enabled';
$where = array('where' => array('he.class_name = ? ' => $eventName, 'AND hc.enabled = ? ' => 1));
@@ -202,10 +202,10 @@ class HookManagement implements HookManagementInterface
public function listAllHookCalls()
{
$array = array();
- $joinTable = $this->tables[TABLE_HOOK_CALL] . ' hc' .
- ' INNER JOIN ' . $this->tables[TABLE_HOOK_EVENT] . ' he' .
- ' ON hc.hook_event_id = he.id ' .
- ' INNER JOIN ' . $this->tables[TABLE_HOOK_OBSERVER] . ' ho ' .
+ $joinTable = $this->tables[TABLE_HOOK_CALL].' hc'.
+ ' INNER JOIN '.$this->tables[TABLE_HOOK_EVENT].' he'.
+ ' ON hc.hook_event_id = he.id '.
+ ' INNER JOIN '.$this->tables[TABLE_HOOK_OBSERVER].' ho '.
' ON hc.hook_observer_id = ho.id ';
$columns = 'he.class_name AS event_class_name, ho.class_name AS observer_class_name, hc.id AS id, hc.type AS type';
$rows = Database::select($columns, $joinTable);
@@ -231,7 +231,7 @@ class HookManagement implements HookManagementInterface
if (isset($eventName) && !isset($this->hookEvents[$eventName])) {
$attributes = array(
'class_name' => $eventName,
- 'description' => get_lang('HookDescription' . $eventName),
+ 'description' => get_lang('HookDescription'.$eventName),
);
$id = Database::insert($this->tables[TABLE_HOOK_EVENT], $attributes);
$this->hookEvents[$eventName] = $id;
@@ -240,7 +240,7 @@ class HookManagement implements HookManagementInterface
// Check if exists hook observer
if (isset($observerClassName) &&
!isset($this->hookObservers[$observerClassName])
- ){
+ ) {
$object = $observerClassName::create();
$attributes = array(
'class_name' => $observerClassName,
@@ -338,10 +338,10 @@ class HookManagement implements HookManagementInterface
$eventName = Database::escape_string($eventName);
$observerClassName($observerClassName);
$type = Database::escape_string($type);
- $joinTable = $this->tables[TABLE_HOOK_CALL] . ' hc' .
- ' INNER JOIN ' . $this->tables[TABLE_HOOK_EVENT] . ' he' .
- ' ON hc.hook_event_id = he.id ' .
- ' INNER JOIN ' . $this->tables[TABLE_HOOK_OBSERVER] . ' ho ' .
+ $joinTable = $this->tables[TABLE_HOOK_CALL].' hc'.
+ ' INNER JOIN '.$this->tables[TABLE_HOOK_EVENT].' he'.
+ ' ON hc.hook_event_id = he.id '.
+ ' INNER JOIN '.$this->tables[TABLE_HOOK_OBSERVER].' ho '.
' ON hc.hook_observer_id = ho.id ';
$row = Database::select(
'id',
diff --git a/main/inc/lib/login_redirection.class.php b/main/inc/lib/login_redirection.class.php
index 801bf638cf..8a495f1d77 100755
--- a/main/inc/lib/login_redirection.class.php
+++ b/main/inc/lib/login_redirection.class.php
@@ -18,30 +18,30 @@ class LoginRedirection
if (api_is_student() && !api_get_setting('student_page_after_login') == '') {
$redirect_url = html_entity_decode(api_get_setting('student_page_after_login'));
if ($redirect_url[0] == "/") {
- $redirect_url = substr(api_get_path(WEB_PATH), 0, -1) . $redirect_url;
+ $redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url;
}
}
if (api_is_teacher() && !api_get_setting('teacher_page_after_login') == '') {
$redirect_url = html_entity_decode(api_get_setting('teacher_page_after_login'));
if ($redirect_url[0] == "/") {
- $redirect_url = substr(api_get_path(WEB_PATH), 0, -1) . $redirect_url;
+ $redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url;
}
}
if (api_is_drh() && !api_get_setting('drh_page_after_login') == '') {
$redirect_url = html_entity_decode(api_get_setting('drh_page_after_login'));
if ($redirect_url[0] == "/") {
- $redirect_url = substr(api_get_path(WEB_PATH), 0, -1) . $redirect_url;
+ $redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url;
}
}
if (api_is_session_admin() && !api_get_setting('sessionadmin_page_after_login') == '') {
$redirect_url = html_entity_decode(api_get_setting('sessionadmin_page_after_login'));
if ($redirect_url[0] == "/") {
- $redirect_url = substr(api_get_path(WEB_PATH), 0, -1) . $redirect_url;
+ $redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url;
}
}
if (!empty($redirect_url)) {
- header('Location: ' . $redirect_url . $param);
+ header('Location: '.$redirect_url.$param);
exit();
}
@@ -49,7 +49,7 @@ class LoginRedirection
if (CustomPages::enabled()) {
CustomPages::display(CustomPages::INDEX_LOGGED);
}
- header('location: ' . api_get_path(WEB_PATH) . api_get_setting('page_after_login') . $param);
+ header('location: '.api_get_path(WEB_PATH).api_get_setting('page_after_login').$param);
exit();
}
}
diff --git a/main/inc/lib/portfolio.class.php b/main/inc/lib/portfolio.class.php
index e300f170e4..6a7e92997d 100755
--- a/main/inc/lib/portfolio.class.php
+++ b/main/inc/lib/portfolio.class.php
@@ -482,14 +482,14 @@ class PortfolioShare
$attributes['z-index'] = 100000;
$s = ' ';
foreach ($attributes as $key => $value) {
- $s .= $key . '="' . $value . '" ';
+ $s .= $key.'="'.$value.'" ';
}
$result = array();
- $result[] = '';
+ $result[] = '';
$result[] = '';
$result[] = '';
- $result[] = Display::return_icon('document_send.png', get_lang('Send'), array(), ICON_SIZE_SMALL) . '';
+ $result[] = Display::return_icon('document_send.png', get_lang('Send'), array(), ICON_SIZE_SMALL).'';
$result[] = '';
$result[] = '';
@@ -505,7 +505,7 @@ class PortfolioShare
$parameters[PortfolioController::PARAM_TOOL] = $tool;
$url = api_get_path(WEB_CODE_PATH).'portfolio/share.php?';
$result[] = '- ';
- $result[] = '' . $portfolio->get_title() . '';
+ $result[] = ''.$portfolio->get_title().'';
$result[] = '
';
}
$result[] = '
';
@@ -564,8 +564,8 @@ class PortfolioBulkAction
*/
public function __construct($portfolio)
{
- $this->name = md5(__CLASS__) . '_' . $portfolio->get_name();
- $this->title = $portfolio->get_title() ? $portfolio->get_title() : get_lang('SendTo') . ' ' . $portfolio->get_name();
+ $this->name = md5(__CLASS__).'_'.$portfolio->get_name();
+ $this->title = $portfolio->get_title() ? $portfolio->get_title() : get_lang('SendTo').' '.$portfolio->get_name();
$this->portfolio = $portfolio;
}
diff --git a/main/inc/lib/redirect.class.php b/main/inc/lib/redirect.class.php
index fcc85833e8..4c2664d1ef 100755
--- a/main/inc/lib/redirect.class.php
+++ b/main/inc/lib/redirect.class.php
@@ -34,7 +34,7 @@ class Redirect
self::navigate($url);
}
- $url = self::www() . $url;
+ $url = self::www().$url;
self::navigate($url);
}
@@ -67,25 +67,25 @@ class Redirect
case COURSEMANAGER:
$redir = api_get_setting('teacher_page_after_login');
if (!empty($redir)) {
- self::navigate(api_get_path(WEB_PATH) . $redir);
+ self::navigate(api_get_path(WEB_PATH).$redir);
}
break;
case STUDENT:
$redir = api_get_setting('student_page_after_login');
if (!empty($redir)) {
- self::navigate(api_get_path(WEB_PATH) . $redir);
+ self::navigate(api_get_path(WEB_PATH).$redir);
}
break;
case DRH:
$redir = api_get_setting('drh_page_after_login');
if (!empty($redir)) {
- self::navigate(api_get_path(WEB_PATH) . $redir);
+ self::navigate(api_get_path(WEB_PATH).$redir);
}
break;
case SESSIONADMIN:
$redir = api_get_setting('sessionadmin_page_after_login');
if (!empty($redir)) {
- self::navigate(api_get_path(WEB_PATH) . $redir);
+ self::navigate(api_get_path(WEB_PATH).$redir);
}
break;
default:
@@ -111,7 +111,7 @@ class Redirect
}
$page_after_login = api_get_setting('page_after_login');
if (!empty($page_after_login)) {
- self::navigate(api_get_path(WEB_PATH) . $page_after_login);
+ self::navigate(api_get_path(WEB_PATH).$page_after_login);
}
}
}
diff --git a/main/inc/lib/rights.lib.php b/main/inc/lib/rights.lib.php
index 701adc4e03..98ba8e044f 100755
--- a/main/inc/lib/rights.lib.php
+++ b/main/inc/lib/rights.lib.php
@@ -7,9 +7,9 @@
*/
class Rights {
private static $rights_cache = array();
- private static $rights = array (
+ private static $rights = array(
'show_tabs:reports' =>
- array (
+ array(
'type' => 'const',
'const' => 'true' )
);
diff --git a/main/inc/lib/search/ChamiloQuery.php b/main/inc/lib/search/ChamiloQuery.php
index 50f387a047..1c56d48641 100755
--- a/main/inc/lib/search/ChamiloQuery.php
+++ b/main/inc/lib/search/ChamiloQuery.php
@@ -18,12 +18,12 @@ require 'xapian/XapianQuery.php';
* @param array extra Extra queries to join with. Optional
* @return array
*/
-function chamilo_query_query($query_string, $offset=0, $length=10, $extra=NULL) {
+function chamilo_query_query($query_string, $offset = 0, $length = 10, $extra = NULL) {
list($count, $results) = xapian_query($query_string, NULL, $offset, $length, $extra);
return chamilo_preprocess_results($results);
}
-function chamilo_query_simple_query($query_string, $offset=0, $length=10, $extra=NULL) {
+function chamilo_query_simple_query($query_string, $offset = 0, $length = 10, $extra = NULL) {
return xapian_query($query_string, NULL, $offset, $length, $extra);
}
@@ -42,7 +42,7 @@ function chamilo_get_boolean_query($term) {
function chamilo_preprocess_results($results) {
// group by toolid
$results_by_tool = array();
- if (count($results)>0) {
+ if (count($results) > 0) {
foreach ($results as $key => $row) {
$results_by_tool[$row['toolid']][] = $row;
@@ -50,8 +50,8 @@ function chamilo_preprocess_results($results) {
$processed_results = array();
foreach ($results_by_tool as $toolid => $rows) {
- $tool_processor_class = $toolid .'_processor';
- $tool_processor_path = api_get_path(LIBRARY_PATH) .'search/tool_processors/'. $tool_processor_class .'.class.php';
+ $tool_processor_class = $toolid.'_processor';
+ $tool_processor_path = api_get_path(LIBRARY_PATH).'search/tool_processors/'.$tool_processor_class.'.class.php';
if (file_exists($tool_processor_path)) {
require_once($tool_processor_path);
$tool_processor = new $tool_processor_class($rows);
@@ -71,6 +71,6 @@ function chamilo_preprocess_results($results) {
* @param string $op
* @return XapianQuery query joined
*/
-function chamilo_join_queries($query1, $query2=NULL, $op='or') {
+function chamilo_join_queries($query1, $query2 = NULL, $op = 'or') {
return xapian_join_queries($query1, $query2, $op);
}
diff --git a/main/inc/lib/system/web/request.class.php b/main/inc/lib/system/web/request.class.php
index 46504ec11a..18f73f1a38 100755
--- a/main/inc/lib/system/web/request.class.php
+++ b/main/inc/lib/system/web/request.class.php
@@ -15,7 +15,7 @@ class Request
return isset($_REQUEST[$key]) ? $_REQUEST[$key] : $default;
}
- public static function has($key){
+ public static function has($key) {
return isset($_REQUEST[$key]);
}
diff --git a/main/inc/lib/table_sort.class.php b/main/inc/lib/table_sort.class.php
index c7dd896c15..0a707f5f61 100755
--- a/main/inc/lib/table_sort.class.php
+++ b/main/inc/lib/table_sort.class.php
@@ -157,7 +157,7 @@ class TableSort
$new_data_order = array();
if (!empty($docs_to_sort)) {
- foreach($docs_to_sort as $id => $document) {
+ foreach ($docs_to_sort as $id => $document) {
if (isset($new_data[$id])) {
$new_data_order[] = $new_data[$id];
}
@@ -165,7 +165,7 @@ class TableSort
}
if (!empty($folder_to_sort)) {
- foreach($folder_to_sort as $id => $document) {
+ foreach ($folder_to_sort as $id => $document) {
if (isset($new_data[$id])) {
$new_data_order[] = $new_data[$id];
}
diff --git a/main/permissions/roles.php b/main/permissions/roles.php
index 6398afd716..7b5f48662d 100755
--- a/main/permissions/roles.php
+++ b/main/permissions/roles.php
@@ -20,49 +20,49 @@ if ($_POST['StoreRolePermissions'])
{
if (!empty($_POST['role_name']))
{
- $table_role=Database::get_course_table(TABLE_ROLE);
- $sql="INSERT INTO $table_role (role_name, role_comment, default_role)
+ $table_role = Database::get_course_table(TABLE_ROLE);
+ $sql = "INSERT INTO $table_role (role_name, role_comment, default_role)
VALUES ('".Database::escape_string($_POST['role_name'])."','".Database::escape_string($_POST['role_comment'])."','".Database::escape_string($_POST['default_role'])."')";
- $result=Database::query($sql);
- $role_id=Database::insert_id();
- $result_message=store_permissions('role', $role_id);
+ $result = Database::query($sql);
+ $role_id = Database::insert_id();
+ $result_message = store_permissions('role', $role_id);
}
else
{
- $result_message=get_lang('ErrorPleaseGiveRoleName');
+ $result_message = get_lang('ErrorPleaseGiveRoleName');
}
}
// storing a permission for a given role when the image approach is used
if (isset($_GET['action']) AND isset($_GET['permission']) AND isset($_GET['tool']))
{
- if ($_GET['action']=='grant' OR $_GET['action']=='revoke')
+ if ($_GET['action'] == 'grant' OR $_GET['action'] == 'revoke')
{
- $result_message=store_one_permission('role', $_GET['action'], $role_id, $_GET['tool'], $_GET['permission']);
+ $result_message = store_one_permission('role', $_GET['action'], $role_id, $_GET['tool'], $_GET['permission']);
}
}
// deleting a role
-if (isset($_GET['action']) AND isset($_GET['role_id']) AND $_GET['action']=='delete') {
+if (isset($_GET['action']) AND isset($_GET['role_id']) AND $_GET['action'] == 'delete') {
//deleting the assignments fo this role: users
- $table=Database::get_course_table(TABLE_ROLE_USER);
- $sql="DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'";
- $result=Database::query($sql);
+ $table = Database::get_course_table(TABLE_ROLE_USER);
+ $sql = "DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'";
+ $result = Database::query($sql);
// deleting the assignments of this role: groups
- $table=Database::get_course_table(TABLE_ROLE_GROUP);
- $sql="DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'";
- $result=Database::query($sql);
+ $table = Database::get_course_table(TABLE_ROLE_GROUP);
+ $sql = "DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'";
+ $result = Database::query($sql);
// deleting the permissions of this role
- $table=Database::get_course_table(TABLE_ROLE_PERMISSION);
- $sql="DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'";
- $result=Database::query($sql);
+ $table = Database::get_course_table(TABLE_ROLE_PERMISSION);
+ $sql = "DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'";
+ $result = Database::query($sql);
// deleting the role
- $table_role=Database::get_course_table(TABLE_ROLE);
- $sql="DELETE FROM $table_role WHERE role_id='".intval($_GET['role_id'])."'";
- $result=Database::query($sql);
- $result_message=get_lang('RoleDeleted');
+ $table_role = Database::get_course_table(TABLE_ROLE);
+ $sql = "DELETE FROM $table_role WHERE role_id='".intval($_GET['role_id'])."'";
+ $result = Database::query($sql);
+ $result_message = get_lang('RoleDeleted');
}
// displaying the return message of the actions
@@ -73,7 +73,7 @@ if (isset($result_message)) {
// ADDING A NEW ROLE (FORM AND LINK)
echo '
'.get_lang('AddRole').'';
-if ($_GET['action']=='add')
+if ($_GET['action'] == 'add')
{
echo "