Completed
Push — 1.11.x ( ca7787...41c0f2 )
by José
31:51
created
main/cron/course_finished.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @author Angel Fernando Quiroz Campos <[email protected]>
7 7
  * @package chamilo.cron
8 8
  */
9
-require_once __DIR__ . '/../inc/global.inc.php';
9
+require_once __DIR__.'/../inc/global.inc.php';
10 10
 
11 11
 if (php_sapi_name() != 'cli') {
12 12
     exit; //do not run from browser
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     ->getResult();
33 33
 
34 34
 if (empty($sessions)) {
35
-    echo "No sessions finishing today $endDate" . PHP_EOL;
35
+    echo "No sessions finishing today $endDate".PHP_EOL;
36 36
     exit;
37 37
 }
38 38
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     $sessionUsers = $session->getUsers();
51 51
 
52 52
     if (empty($sessionUsers)) {
53
-        echo 'No users to send mail' . PHP_EOL;
53
+        echo 'No users to send mail'.PHP_EOL;
54 54
         exit;
55 55
     }
56 56
 
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
             $administrator['email']
82 82
         );
83 83
 
84
-        echo '============' . PHP_EOL;
85
-        echo "Email sent to: {$user->getCompleteName()} ({$user->getEmail()})" . PHP_EOL;
86
-        echo "Session: {$session->getName()}" . PHP_EOL;
87
-        echo "End date: {$session->getAccessEndDate()->format('Y-m-d h:i')}" . PHP_EOL;
84
+        echo '============'.PHP_EOL;
85
+        echo "Email sent to: {$user->getCompleteName()} ({$user->getEmail()})".PHP_EOL;
86
+        echo "Session: {$session->getName()}".PHP_EOL;
87
+        echo "End date: {$session->getAccessEndDate()->format('Y-m-d h:i')}".PHP_EOL;
88 88
     }
89 89
 }
Please login to merge, or discard this patch.
main/cron/hosting_total_size_limit.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     $totalSize = $row['total'];
98 98
 
99 99
     if ($debug) {
100
-        echo "Total size in table $table " . (round($totalSize / 1024)) . " MB \n";
100
+        echo "Total size in table $table ".(round($totalSize / 1024))." MB \n";
101 101
     }
102 102
 
103 103
     $table = Database::get_course_table(TABLE_FORUM_ATTACHMENT);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     $subTotal = $row['total'];
108 108
     $totalSize += $subTotal;
109 109
     if ($debug) {
110
-        echo "Total size in table $table " . (round($subTotal / 1024)) . " MB \n";
110
+        echo "Total size in table $table ".(round($subTotal / 1024))." MB \n";
111 111
     }
112 112
 
113 113
     $totalSize = $totalSize / 1024;
Please login to merge, or discard this patch.
main/cron/document/index_all_docs.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     'html',
34 34
     'htm',
35 35
 );
36
-$courses_list =  CourseManager::get_courses_list();
36
+$courses_list = CourseManager::get_courses_list();
37 37
 
38 38
 // Simulating empty specific fields (this is necessary for indexing)
39 39
 require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
   $title = Database::escape_string($_GET['doc']);
50 50
   $sql = "SELECT id, path, session_id FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' or title LIKE '%$title%'";
51 51
   $res = Database::query($sql);
52
-  if (Database::num_rows($res)>0) {
52
+  if (Database::num_rows($res) > 0) {
53 53
     while ($row = Database::fetch_array($res)) {
54 54
       $doc_path = api_get_path(SYS_COURSE_PATH).$course_dir.$row['path'];
55 55
       $extensions = preg_split("/[\/\\.]/", $doc_path);
Please login to merge, or discard this patch.
main/cron/document/finddoc.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@
 block discarded – undo
12 12
 } else {
13 13
   echo "Received param ".Security::remove_XSS($_GET['doc'])."<br />";
14 14
 }
15
-$courses_list =  CourseManager::get_courses_list();
15
+$courses_list = CourseManager::get_courses_list();
16 16
 foreach ($courses_list as $course) {
17 17
   $title = Database::escape_string($_GET['doc']);
18 18
   $td = Database::get_course_table(TABLE_DOCUMENT);
19 19
   $sql = "SELECT id, path FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' OR title LIKE '%$title%'";
20 20
   $res = Database::query($sql);
21
-  if (Database::num_rows($res)>0) {
21
+  if (Database::num_rows($res) > 0) {
22 22
     while ($row = Database::fetch_array($res)) {
23 23
       echo "Found doc ".$row['id']."-> ".$row['path']." in course ".$course['code']."<br />";
24 24
     }
Please login to merge, or discard this patch.
main/cron/user_import/resend_email_with_new_password.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
             FROM $users WHERE email = '$mail'\n";
35 35
     $res = Database::query($sql);
36 36
     if ($res === false) {
37
-        echo 'Error in database with email ' . $mail . "\n";
37
+        echo 'Error in database with email '.$mail."\n";
38 38
     }
39 39
     if (Database::num_rows($res) == 0) {
40
-        echo '[Error] Email not found in database: ' . $row['email'] . "\n";
40
+        echo '[Error] Email not found in database: '.$row['email']."\n";
41 41
     } else {
42 42
         $row = Database::fetch_assoc($res);
43
-        $pass = api_substr($row['username'], 0, 4) . rand(0, 9) . rand(0, 9);
43
+        $pass = api_substr($row['username'], 0, 4).rand(0, 9).rand(0, 9);
44 44
 
45 45
         if ($user) {
46 46
 
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
             null,
72 72
             PERSON_NAME_EMAIL_ADDRESS
73 73
         );
74
-        $emailsubject = '[' . api_get_setting('siteName') . '] ' . get_lang('YourReg', null, $l) . ' ' . api_get_setting('siteName');
75
-        $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') . "";
74
+        $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg', null, $l).' '.api_get_setting('siteName');
75
+        $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')."";
76 76
         $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
77 77
         $email_admin = api_get_setting('emailAdministrator');
78 78
         @api_mail_html(
Please login to merge, or discard this patch.
main/cron/user_import/get_data_from_mail.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
 $list = file('input.txt');
19 19
 require_once '../../inc/global.inc.php';
20 20
 $users = Database::get_main_table(TABLE_MAIN_USER);
21
-$string='';
21
+$string = '';
22 22
 foreach ($list as $mail) {
23 23
   $mail = trim($mail);
24 24
   $sql = "SELECT user_id, official_code, firstname, lastname, email FROM $users WHERE email = '$mail'\n";
25 25
   $res = Database::query($sql);
26
-  if ($res === false) { die(mysql_error());}
26
+  if ($res === false) { die(mysql_error()); }
27 27
   if (Database::num_rows($res) == 0) {
28 28
     $string .= 'No encontrado;'.$row['email'];
29 29
   } else {
@@ -32,4 +32,4 @@  discard block
 block discarded – undo
32 32
   }
33 33
 }
34 34
 echo $string;
35
-file_put_contents('/tmp/list.txt',$string);
35
+file_put_contents('/tmp/list.txt', $string);
Please login to merge, or discard this patch.
main/cron/user_import/client.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
  */
15 15
 require_once dirname(__FILE__).'/../../inc/global.inc.php';
16 16
 // check if this client has been called by php_cli (command line or cron)
17
-if (php_sapi_name()!='cli') {
17
+if (php_sapi_name() != 'cli') {
18 18
     echo 'You can\'t call this service through a browser';
19 19
     die();
20 20
 }
Please login to merge, or discard this patch.
main/cron/create_course_sessions.php 1 patch
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     exit; //do not run from browser
15 15
 }
16 16
 
17
-require_once __DIR__ . "/../inc/global.inc.php";
17
+require_once __DIR__."/../inc/global.inc.php";
18 18
 
19 19
 // First day of the current month to create sessions and add courses for the next month (e.g. "07")
20 20
 define("OFFSET", "15");
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 {
42 42
     $startDate = $initialDate ? $initialDate : date("Y-m-01");
43 43
     $month = getQuarterFirstMonth(getQuarter(date('m', $startDate)));
44
-    $startDate = substr($startDate, 0, 5) . $month . '-01';
44
+    $startDate = substr($startDate, 0, 5).$month.'-01';
45 45
     $nextQuarterStartDate = date('Y-m-d', api_strtotime($startDate.' + 3 month'));
46 46
     $endDate = date('Y-m-d', api_strtotime($nextQuarterStartDate.' - 1 minute'));
47 47
     return array('startDate' => $startDate, 'endDate' => $endDate);
@@ -145,8 +145,7 @@  discard block
 block discarded – undo
145 145
 {
146 146
     echo "\n";
147 147
     echo $courses ?
148
-        "Creating sessions and adding courses for the period between ".$startDate." and ".$endDate :
149
-        "Every course is already in session for the period between ".$startDate." and ".$endDate;
148
+        "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;
150 149
     echo "\n=====================================================================================\n\n";
151 150
     // Loop through courses creating one session per each and adding them
152 151
     foreach ($courses as $course) {
@@ -155,8 +154,8 @@  discard block
 block discarded – undo
155 154
         $year = date("Y", api_strtotime($startDate));
156 155
         $quarter = getQuarter($month);
157 156
         $quarter = getQuarterRoman($quarter);
158
-        $period = $year . '-' . $quarter;
159
-        $sessionName = '[' . $period . '] ' . $course['title'];
157
+        $period = $year.'-'.$quarter;
158
+        $sessionName = '['.$period.'] '.$course['title'];
160 159
         $sessionId = SessionManager::create_session(
161 160
             $sessionName,
162 161
             $startDate,
@@ -175,7 +174,7 @@  discard block
 block discarded – undo
175 174
 }
176 175
 
177 176
 // Starts the script
178
-echo "Starting process..." . PHP_EOL;
177
+echo "Starting process...".PHP_EOL;
179 178
 // Get first active administrator
180 179
 $administrators = array_reverse(UserManager::get_all_administrators());
181 180
 $lastingAdministrators = count($administrators);
@@ -196,7 +195,7 @@  discard block
 block discarded – undo
196 195
 
197 196
 // Creates course sessions for the following month
198 197
 $offsetDay = intval(substr($dates['endDate'], 8, 2)) - OFFSET;
199
-if (date("Y-m-d") >= date(substr($dates['endDate'], 0, 8) . $offsetDay)) {
198
+if (date("Y-m-d") >= date(substr($dates['endDate'], 0, 8).$offsetDay)) {
200 199
     $dates = getQuarterFirstAndLastDates(date("Y-m-d", api_strtotime(date("Y-m-01")." + 3 month")));
201 200
     // Get courses that don't have any session the next month
202 201
     $courses = CourseManager::getCoursesWithoutSession($dates['startDate'], $dates['endDate']);
Please login to merge, or discard this patch.
main/cron/lang/langstats.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,16 +32,16 @@  discard block
 block discarded – undo
32 32
 /**
33 33
  * Display
34 34
  */
35
-if (count($list)==0) { echo 'No terms loaded so far'; }
36
-if (count($list)>0) {
35
+if (count($list) == 0) { echo 'No terms loaded so far'; }
36
+if (count($list) > 0) {
37 37
   $i = 1;
38 38
   $j = 1;
39 39
   $k = 0;
40 40
   $files = array();
41 41
   $trans = array();
42 42
   echo 'Number of records: '.count($list).'<br />';
43
-  echo '<table><tr><th>Index</th><th>Registration order</th><th>Term</th>'.($output==1?'<th>Origin</th>':'').'<th>Count</th></tr>';
44
-  foreach($list as $elem) {
43
+  echo '<table><tr><th>Index</th><th>Registration order</th><th>Term</th>'.($output == 1 ? '<th>Origin</th>' : '').'<th>Count</th></tr>';
44
+  foreach ($list as $elem) {
45 45
     if ($k > $terms_limit) { break; }
46 46
     $fixed_elem = $elem;
47 47
     if ($output) {
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
       $trans[$fixed_elem['term_name']] = $translation;
58 58
       $j++;
59 59
     }
60
-    echo '<tr><td>',$i,
61
-      '</td><td>',$fixed_elem['id'],
62
-      '</td><td>',$fixed_elem['term_name'];
60
+    echo '<tr><td>', $i,
61
+      '</td><td>', $fixed_elem['id'],
62
+      '</td><td>', $fixed_elem['term_name'];
63 63
     if ($output) {
64 64
       echo '</td><td>'.$variables_origin[$fixed_elem['term_name']];
65 65
     }
66
-    echo '</td><td>',$fixed_elem['term_count'],'</td></tr>';
66
+    echo '</td><td>', $fixed_elem['term_count'], '</td></tr>';
67 67
     $i++;
68 68
   }
69 69
   echo '</table>';
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
     @mkdir('/tmp/lang');
72 72
     foreach ($files as $file => $terms) {
73 73
       @touch('/tmp/lang/'.$file);
74
-      file_put_contents('/tmp/lang/'.$file,"<?php".PHP_EOL);
74
+      file_put_contents('/tmp/lang/'.$file, "<?php".PHP_EOL);
75 75
       foreach ($terms as $term) {
76
-        file_put_contents('/tmp/lang/'.$file,'$'.$term.' = "'.str_replace('"','\"',$trans[$term]).'";'.PHP_EOL, FILE_APPEND);
76
+        file_put_contents('/tmp/lang/'.$file, '$'.$term.' = "'.str_replace('"', '\"', $trans[$term]).'";'.PHP_EOL, FILE_APPEND);
77 77
       }
78 78
     }  
79 79
   }
Please login to merge, or discard this patch.