@@ -28,10 +28,10 @@ |
||
28 | 28 | error_log('In xajax_save_objectives('.$lp_id.','.$user_id.','.$view_id.','.$item_id.',"'.(count($objectives) > 0 ? count($objectives) : '').'")', 0); |
29 | 29 | } |
30 | 30 | $mylp = learnpath::getLpFromSession(api_get_course_id(), $lp_id, $user_id); |
31 | - $mylpi =& $mylp->items[$item_id]; |
|
32 | - if (is_array($objectives) && count($objectives)>0){ |
|
33 | - foreach ($objectives as $index=>$objective){ |
|
34 | - $mylpi->add_objective($index,$objectives[$index]); |
|
31 | + $mylpi = & $mylp->items[$item_id]; |
|
32 | + if (is_array($objectives) && count($objectives) > 0) { |
|
33 | + foreach ($objectives as $index=>$objective) { |
|
34 | + $mylpi->add_objective($index, $objectives[$index]); |
|
35 | 35 | } |
36 | 36 | $mylpi->write_objectives_to_db(); |
37 | 37 | } |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | $a_dir = realpath($dir.'/../../archive/'); |
16 | 16 | $list = scandir($a_dir); |
17 | 17 | // calculate 7 days |
18 | -$t = time()-(86400*7); |
|
18 | +$t = time() - (86400 * 7); |
|
19 | 19 | foreach ($list as $item) { |
20 | - if (substr($item,0,1) == '.') { |
|
20 | + if (substr($item, 0, 1) == '.') { |
|
21 | 21 | continue; |
22 | 22 | } |
23 | 23 | $stat = @stat($a_dir.'/'.$item); |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | * Delete a file or recursively delete a directory |
35 | 35 | * @param string $str Path to file or directory |
36 | 36 | */ |
37 | -function recursive_delete($str){ |
|
37 | +function recursive_delete($str) { |
|
38 | 38 | if (is_file($str)) { |
39 | 39 | return @unlink($str); |
40 | 40 | } elseif (is_dir($str)) { |
41 | - $scan = glob(rtrim($str,'/').'/*'); |
|
41 | + $scan = glob(rtrim($str, '/').'/*'); |
|
42 | 42 | foreach ($scan as $index=>$path) { |
43 | 43 | recursive_delete($path); |
44 | 44 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @package chamilo.cron |
6 | 6 | * @author Imanol Losada <[email protected]> |
7 | 7 | */ |
8 | -require_once __DIR__ . '/../inc/global.inc.php'; |
|
8 | +require_once __DIR__.'/../inc/global.inc.php'; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Initialization |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | foreach ($sessions as $sessionId => $userIds) { |
66 | 66 | $userId = 0; |
67 | - $userIds = $userIds ? " AND sessionUser.user_id NOT IN (" . implode(", ", $userIds) . ")" : null; |
|
67 | + $userIds = $userIds ? " AND sessionUser.user_id NOT IN (".implode(", ", $userIds).")" : null; |
|
68 | 68 | $query = " |
69 | 69 | SELECT sessionUser.session_id, sessionUser.user_id, session.name, session.access_end_date |
70 | 70 | FROM $sessionUserTable AS sessionUser |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | $administrator['completeName'], |
157 | 157 | $administrator['email'] |
158 | 158 | ); |
159 | - echo "Email sent to $userCompleteName (" . $user['email'] . ")\n"; |
|
160 | - echo "Session: " . $session['name'] . "\n"; |
|
161 | - echo "Date end: " . $session['access_end_date'] . "\n"; |
|
162 | - echo "Days remaining: " . $daysRemaining->format("%d") . "\n\n"; |
|
159 | + echo "Email sent to $userCompleteName (".$user['email'].")\n"; |
|
160 | + echo "Session: ".$session['name']."\n"; |
|
161 | + echo "Date end: ".$session['access_end_date']."\n"; |
|
162 | + echo "Days remaining: ".$daysRemaining->format("%d")."\n\n"; |
|
163 | 163 | } |
164 | 164 | echo "======================================================================\n\n"; |
165 | 165 | } |
@@ -6,7 +6,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -97,7 +97,7 @@ discard block |
||
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 |
||
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; |
@@ -7,7 +7,7 @@ |
||
7 | 7 | /** |
8 | 8 | * Initialization |
9 | 9 | */ |
10 | -if (PHP_SAPI!='cli') { |
|
10 | +if (PHP_SAPI != 'cli') { |
|
11 | 11 | die('Run this script through the command line or comment this line in the code'); |
12 | 12 | } |
13 | 13 |
@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | die(); |
9 | 9 | require '../../inc/global.inc.php'; |
10 | 10 | if (empty($_GET['doc'])) { |
11 | - echo "To add a document name to search, add ?doc=abc to the URL\n"; |
|
11 | + echo "To add a document name to search, add ?doc=abc to the URL\n"; |
|
12 | 12 | } else { |
13 | - echo "Received param ".$_GET['doc']."<br />\n"; |
|
13 | + echo "Received param ".$_GET['doc']."<br />\n"; |
|
14 | 14 | } |
15 | 15 | $allowed_mime_types = DocumentManager::file_get_mime_type(true); |
16 | 16 | $allowed_extensions = array( |
@@ -40,30 +40,30 @@ discard block |
||
40 | 40 | $specific_fields = get_specific_field_list(); |
41 | 41 | $specific_fields_values = array(); |
42 | 42 | foreach ($specific_fields as $sf) { |
43 | - $specific_fields_values[$sf['code']] = ''; |
|
43 | + $specific_fields_values[$sf['code']] = ''; |
|
44 | 44 | } |
45 | 45 | $td = Database::get_course_table(TABLE_DOCUMENT); |
46 | 46 | |
47 | 47 | foreach ($courses_list as $course) { |
48 | - $course_dir = $course['directory'].'/document'; |
|
49 | - $title = Database::escape_string($_GET['doc']); |
|
50 | - $sql = "SELECT id, path, session_id FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' or title LIKE '%$title%'"; |
|
51 | - $res = Database::query($sql); |
|
52 | - if (Database::num_rows($res)>0) { |
|
48 | + $course_dir = $course['directory'].'/document'; |
|
49 | + $title = Database::escape_string($_GET['doc']); |
|
50 | + $sql = "SELECT id, path, session_id FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' or title LIKE '%$title%'"; |
|
51 | + $res = Database::query($sql); |
|
52 | + if (Database::num_rows($res)>0) { |
|
53 | 53 | while ($row = Database::fetch_array($res)) { |
54 | - $doc_path = api_get_path(SYS_COURSE_PATH).$course_dir.$row['path']; |
|
55 | - $extensions = preg_split("/[\/\\.]/", $doc_path); |
|
56 | - $doc_ext = strtolower($extensions[count($extensions) - 1]); |
|
57 | - if (in_array($doc_ext, $allowed_extensions) && !is_dir($doc_path)) { |
|
54 | + $doc_path = api_get_path(SYS_COURSE_PATH).$course_dir.$row['path']; |
|
55 | + $extensions = preg_split("/[\/\\.]/", $doc_path); |
|
56 | + $doc_ext = strtolower($extensions[count($extensions) - 1]); |
|
57 | + if (in_array($doc_ext, $allowed_extensions) && !is_dir($doc_path)) { |
|
58 | 58 | $doc_mime = mime_content_type($doc_path); |
59 | 59 | echo "Indexing doc ".$row['id']." (".$row['path'].") in course ".$course['code']."\n"; |
60 | 60 | $residx = DocumentManager::index_document($row['id'], $course['code'], $row['session_id'], $course['course_language'], $specific_fields_values); |
61 | 61 | if ($residx) { |
62 | - echo "Success\n"; |
|
62 | + echo "Success\n"; |
|
63 | 63 | } else { |
64 | - echo "Failure\n"; |
|
64 | + echo "Failure\n"; |
|
65 | 65 | } |
66 | - } |
|
66 | + } |
|
67 | + } |
|
67 | 68 | } |
68 | - } |
|
69 | 69 | } |
@@ -12,13 +12,13 @@ |
||
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 | } |
@@ -12,13 +12,13 @@ |
||
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 | } |
@@ -8,19 +8,19 @@ |
||
8 | 8 | die(); |
9 | 9 | require '../../inc/global.inc.php'; |
10 | 10 | if (empty($_GET['doc'])) { |
11 | - echo "To add a document name to search, add ?doc=abc to the URL"; |
|
11 | + echo "To add a document name to search, add ?doc=abc to the URL"; |
|
12 | 12 | } else { |
13 | - echo "Received param ".Security::remove_XSS($_GET['doc'])."<br />"; |
|
13 | + echo "Received param ".Security::remove_XSS($_GET['doc'])."<br />"; |
|
14 | 14 | } |
15 | 15 | $courses_list = CourseManager::get_courses_list(); |
16 | 16 | foreach ($courses_list as $course) { |
17 | - $title = Database::escape_string($_GET['doc']); |
|
18 | - $td = Database::get_course_table(TABLE_DOCUMENT); |
|
19 | - $sql = "SELECT id, path FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' OR title LIKE '%$title%'"; |
|
20 | - $res = Database::query($sql); |
|
21 | - if (Database::num_rows($res)>0) { |
|
17 | + $title = Database::escape_string($_GET['doc']); |
|
18 | + $td = Database::get_course_table(TABLE_DOCUMENT); |
|
19 | + $sql = "SELECT id, path FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' OR title LIKE '%$title%'"; |
|
20 | + $res = Database::query($sql); |
|
21 | + if (Database::num_rows($res)>0) { |
|
22 | 22 | while ($row = Database::fetch_array($res)) { |
23 | - echo "Found doc ".$row['id']."-> ".$row['path']." in course ".$course['code']."<br />"; |
|
23 | + echo "Found doc ".$row['id']."-> ".$row['path']." in course ".$course['code']."<br />"; |
|
24 | + } |
|
24 | 25 | } |
25 | - } |
|
26 | 26 | } |
@@ -34,13 +34,13 @@ discard block |
||
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 |
||
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( |