@@ -64,9 +64,10 @@ |
||
64 | 64 | $new_comment = isset($_POST['comment']) ? Database::escape_string(trim($_POST['comment'])) : ''; |
65 | 65 | $new_title = isset($_POST['title']) ? Database::escape_string(trim($_POST['title'])) : ''; |
66 | 66 | |
67 | - if ($new_path && ($new_comment || $new_title)) |
|
68 | - if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
67 | + if ($new_path && ($new_comment || $new_title)) { |
|
68 | + if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
69 | 69 | $table_document = Database::get_course_table(TABLE_DOCUMENT); |
70 | + } |
|
70 | 71 | $ct = ''; |
71 | 72 | if ($new_comment) { |
72 | 73 | $ct .= ", comment='$new_comment'"; |
@@ -679,12 +679,15 @@ discard block |
||
679 | 679 | $option1 = $option2 = $option3 = ''; |
680 | 680 | for ($k = 1; $k <= 100; $k++) { |
681 | 681 | $selected1 = $selected2 = $selected3 = ''; |
682 | - if ($k == $threadhold1[$i]) |
|
683 | - $selected1 = 'selected="selected"'; |
|
684 | - if ($k == $threadhold2[$i]) |
|
685 | - $selected2 = 'selected="selected"'; |
|
686 | - if ($k == $threadhold3[$i]) |
|
687 | - $selected3 = 'selected="selected"'; |
|
682 | + if ($k == $threadhold1[$i]) { |
|
683 | + $selected1 = 'selected="selected"'; |
|
684 | + } |
|
685 | + if ($k == $threadhold2[$i]) { |
|
686 | + $selected2 = 'selected="selected"'; |
|
687 | + } |
|
688 | + if ($k == $threadhold3[$i]) { |
|
689 | + $selected3 = 'selected="selected"'; |
|
690 | + } |
|
688 | 691 | $option1.='<option ' . $selected1 . ' >' . $k . ' % </option>'; |
689 | 692 | $option2.='<option ' . $selected2 . ' >' . $k . ' % </option>'; |
690 | 693 | $option3.='<option ' . $selected3 . '>' . $k . ' %</option>'; |
@@ -731,7 +734,10 @@ discard block |
||
731 | 734 | <div class="checkbox"> |
732 | 735 | <p> |
733 | 736 | <label> |
734 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
737 | + <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) { |
|
738 | + echo'checked'; |
|
739 | +} |
|
740 | +?> /> |
|
735 | 741 | <?php echo get_lang('TryAgain'); ?> |
736 | 742 | </label> |
737 | 743 | </p> |
@@ -784,7 +790,10 @@ discard block |
||
784 | 790 | <div class="checkbox"> |
785 | 791 | <p> |
786 | 792 | <label> |
787 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
793 | + <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) { |
|
794 | + echo'checked'; |
|
795 | +} |
|
796 | +?> /> |
|
788 | 797 | <?php echo get_lang('TryAgain'); ?> |
789 | 798 | </label> |
790 | 799 | </p> |
@@ -823,7 +832,10 @@ discard block |
||
823 | 832 | <th ><?php echo get_lang('OAR'); ?>*</th> |
824 | 833 | <?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?> |
825 | 834 | <th colspan="2" ><?php echo get_lang('Comment'); ?></th> |
826 | - <th ><?php if ($answerType == HOT_SPOT_DELINEATION) echo get_lang('Scenario'); ?></th> |
|
835 | + <th ><?php if ($answerType == HOT_SPOT_DELINEATION) { |
|
836 | + echo get_lang('Scenario'); |
|
837 | +} |
|
838 | +?></th> |
|
827 | 839 | <?php } else { ?> |
828 | 840 | <th colspan="3" ><?php echo get_lang('Comment'); ?></th> |
829 | 841 | <?php } ?> |
@@ -849,7 +861,10 @@ discard block |
||
849 | 861 | <div class="checkbox"> |
850 | 862 | <p> |
851 | 863 | <label> |
852 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> /> |
|
864 | + <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) { |
|
865 | + echo'checked'; |
|
866 | +} |
|
867 | +?> /> |
|
853 | 868 | <?php echo get_lang('TryAgain'); ?> |
854 | 869 | </label> |
855 | 870 | </p> |
@@ -998,7 +1013,10 @@ discard block |
||
998 | 1013 | <div class="checkbox"> |
999 | 1014 | <p> |
1000 | 1015 | <label> |
1001 | - <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) echo'checked'; ?> /> |
|
1016 | + <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) { |
|
1017 | + echo'checked'; |
|
1018 | +} |
|
1019 | +?> /> |
|
1002 | 1020 | <?php echo get_lang('TryAgain'); ?> |
1003 | 1021 | </label> |
1004 | 1022 | </p> |
@@ -1007,8 +1007,9 @@ discard block |
||
1007 | 1007 | $blog_post_actions .= '</a>'; |
1008 | 1008 | } |
1009 | 1009 | |
1010 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_rate')) |
|
1011 | - $rating_select = Blog::display_rating_form('post',$blog_id,$post_id); |
|
1010 | + if (api_is_allowed('BLOG_' . $blog_id, 'article_rate')) { |
|
1011 | + $rating_select = Blog::display_rating_form('post',$blog_id,$post_id); |
|
1012 | + } |
|
1012 | 1013 | |
1013 | 1014 | $blog_post_text=stripslashes($blog_post_text); |
1014 | 1015 | |
@@ -1652,8 +1653,9 @@ discard block |
||
1652 | 1653 | |
1653 | 1654 | $arrPermissions = array(); |
1654 | 1655 | |
1655 | - while ($row = Database::fetch_array($result)) |
|
1656 | - $arrPermissions[] = $row['action']; |
|
1656 | + while ($row = Database::fetch_array($result)) { |
|
1657 | + $arrPermissions[] = $row['action']; |
|
1658 | + } |
|
1657 | 1659 | |
1658 | 1660 | echo '<tr>'; |
1659 | 1661 | echo '<td style="text-align:right; vertical-align:top;">' . get_lang('TaskManager') . ': </td>'; |
@@ -2329,8 +2331,9 @@ discard block |
||
2329 | 2331 | //Handle leap year |
2330 | 2332 | $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
2331 | 2333 | |
2332 | - if(($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) |
|
2333 | - $numberofdays[2] = 29; |
|
2334 | + if(($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) { |
|
2335 | + $numberofdays[2] = 29; |
|
2336 | + } |
|
2334 | 2337 | |
2335 | 2338 | //Get the first day of the month |
2336 | 2339 | $dayone = getdate(mktime(0, 0, 0, $month, 1, $year)); |
@@ -2360,8 +2363,9 @@ discard block |
||
2360 | 2363 | if( Database::num_rows($result) > 0) { |
2361 | 2364 | while($blog_post = Database::fetch_array($result)) { |
2362 | 2365 | // If the day of this post is not yet in the array, add it. |
2363 | - if (!in_array($blog_post['post_day'], $posts)) |
|
2364 | - $posts[] = $blog_post['post_day']; |
|
2366 | + if (!in_array($blog_post['post_day'], $posts)) { |
|
2367 | + $posts[] = $blog_post['post_day']; |
|
2368 | + } |
|
2365 | 2369 | } |
2366 | 2370 | } |
2367 | 2371 | |
@@ -2400,8 +2404,9 @@ discard block |
||
2400 | 2404 | |
2401 | 2405 | echo "<tr>"; |
2402 | 2406 | |
2403 | - for($ii = 1; $ii < 8; $ii ++) |
|
2404 | - echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>"; |
|
2407 | + for($ii = 1; $ii < 8; $ii ++) { |
|
2408 | + echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>"; |
|
2409 | + } |
|
2405 | 2410 | |
2406 | 2411 | echo "</tr>"; |
2407 | 2412 | |
@@ -2411,8 +2416,9 @@ discard block |
||
2411 | 2416 | while ($curday <= $numberofdays[$month]) { |
2412 | 2417 | echo "<tr>"; |
2413 | 2418 | for ($ii = 0; $ii < 7; $ii ++) { |
2414 | - if (($curday == -1) && ($ii == $startdayofweek)) |
|
2415 | - $curday = 1; |
|
2419 | + if (($curday == -1) && ($ii == $startdayofweek)) { |
|
2420 | + $curday = 1; |
|
2421 | + } |
|
2416 | 2422 | |
2417 | 2423 | if (($curday > 0) && ($curday <= $numberofdays[$month])) { |
2418 | 2424 | $bgcolor = $ii < 5 ? $class="class=\"days_week\"" : $class="class=\"days_weekend\""; |
@@ -2426,10 +2432,11 @@ discard block |
||
2426 | 2432 | echo "<td " . $class.">"; |
2427 | 2433 | |
2428 | 2434 | // If there are posts on this day, create a filter link. |
2429 | - if(in_array($curday, $posts)) |
|
2430 | - echo '<a href="blog.php?blog_id=' . $blog_id . '&filter=' . $year . '-' . $month . '-' . $curday . '&month=' . $month . '&year=' . $year . '" title="' . get_lang('ViewPostsOfThisDay') . '">' . $curday . '</a>'; |
|
2431 | - else |
|
2432 | - echo $dayheader; |
|
2435 | + if(in_array($curday, $posts)) { |
|
2436 | + echo '<a href="blog.php?blog_id=' . $blog_id . '&filter=' . $year . '-' . $month . '-' . $curday . '&month=' . $month . '&year=' . $year . '" title="' . get_lang('ViewPostsOfThisDay') . '">' . $curday . '</a>'; |
|
2437 | + } else { |
|
2438 | + echo $dayheader; |
|
2439 | + } |
|
2433 | 2440 | |
2434 | 2441 | if (count($tasks) > 0) { |
2435 | 2442 | if (isset($tasks[$curday]) && is_array($tasks[$curday])) { |
@@ -2444,8 +2451,9 @@ discard block |
||
2444 | 2451 | |
2445 | 2452 | echo "</td>"; |
2446 | 2453 | $curday ++; |
2447 | - } else |
|
2448 | - echo "<td> </td>"; |
|
2454 | + } else { |
|
2455 | + echo "<td> </td>"; |
|
2456 | + } |
|
2449 | 2457 | } |
2450 | 2458 | echo "</tr>"; |
2451 | 2459 | } |
@@ -972,8 +972,7 @@ discard block |
||
972 | 972 | <?php echo get_lang('Error'); ?>!<br /> |
973 | 973 | Chamilo <?php echo implode('|', $update_from_version_8).' '.get_lang('HasNotBeenFoundInThatDir'); ?>. |
974 | 974 | </div> |
975 | - <?php } |
|
976 | - else { |
|
975 | + <?php } else { |
|
977 | 976 | echo '<br />'; |
978 | 977 | } |
979 | 978 | ?> |
@@ -1088,7 +1087,10 @@ discard block |
||
1088 | 1087 | <button type="submit" name="step1" class="btn btn-default" onclick="javascript: window.location='index.php'; return false;" value="<?php echo get_lang('Previous'); ?>" > |
1089 | 1088 | <em class="fa fa-backward"> </em> <?php echo get_lang('Previous'); ?> |
1090 | 1089 | </button> |
1091 | - <button type="submit" name="step2_install" class="btn btn-success" value="<?php echo get_lang("NewInstallation"); ?>" <?php if ($error) echo 'disabled="disabled"'; ?> > |
|
1090 | + <button type="submit" name="step2_install" class="btn btn-success" value="<?php echo get_lang("NewInstallation"); ?>" <?php if ($error) { |
|
1091 | + echo 'disabled="disabled"'; |
|
1092 | +} |
|
1093 | +?> > |
|
1092 | 1094 | <em class="fa fa-forward"> </em> <?php echo get_lang('NewInstallation'); ?> |
1093 | 1095 | </button> |
1094 | 1096 | <input type="hidden" name="is_executable" id="is_executable" value="-" /> |
@@ -1374,7 +1376,7 @@ discard block |
||
1374 | 1376 | <input type="hidden" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" /><?php echo $dbHostForm; ?> |
1375 | 1377 | </div> |
1376 | 1378 | <div class="col-sm-3"></div> |
1377 | - <?php }else{ ?> |
|
1379 | + <?php } else{ ?> |
|
1378 | 1380 | <div class="col-sm-5"> |
1379 | 1381 | <input type="text" class="form-control" size="25" maxlength="50" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" /> |
1380 | 1382 | </div> |
@@ -1388,7 +1390,7 @@ discard block |
||
1388 | 1390 | <input type="hidden" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" /><?php echo $dbPortForm; ?> |
1389 | 1391 | </div> |
1390 | 1392 | <div class="col-sm-3"></div> |
1391 | - <?php }else{ ?> |
|
1393 | + <?php } else{ ?> |
|
1392 | 1394 | <div class="col-sm-5"> |
1393 | 1395 | <input type="text" class="form-control" size="25" maxlength="50" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" /> |
1394 | 1396 | </div> |
@@ -1470,9 +1472,12 @@ discard block |
||
1470 | 1472 | Database port: <strong><?php echo $manager->getConnection()->getPort(); ?></strong><br/> |
1471 | 1473 | Database driver: <strong><?php echo $manager->getConnection()->getDriver()->getName(); ?></strong><br/> |
1472 | 1474 | </div> |
1473 | - <?php else: ?> |
|
1475 | + <?php else { |
|
1476 | + : ?> |
|
1474 | 1477 | <div id="db_status" class="alert alert-danger"> |
1475 | - <p><?php echo get_lang('FailedConectionDatabase'); ?></strong></p> |
|
1478 | + <p><?php echo get_lang('FailedConectionDatabase'); |
|
1479 | +} |
|
1480 | +?></strong></p> |
|
1476 | 1481 | <code><?php echo $database_exists_text ?></code> |
1477 | 1482 | </div> |
1478 | 1483 | <?php endif; ?> |
@@ -260,10 +260,11 @@ |
||
260 | 260 | <td colspan="3" align="center"> |
261 | 261 | <br /> |
262 | 262 | <?php |
263 | - if(isset($_GET['add'])) |
|
264 | - echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>'; |
|
265 | - else |
|
266 | - echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>'; |
|
263 | + if(isset($_GET['add'])) { |
|
264 | + echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>'; |
|
265 | + } else { |
|
266 | + echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>'; |
|
267 | + } |
|
267 | 268 | ?> |
268 | 269 | </td> |
269 | 270 | </tr> |
@@ -509,7 +509,9 @@ discard block |
||
509 | 509 | if ($file != '.' && $file != '..') { |
510 | 510 | $filetype = 'file'; |
511 | 511 | |
512 | - if (is_dir($course_sys_dir.$new_dir.$file)) $filetype = 'folder'; |
|
512 | + if (is_dir($course_sys_dir.$new_dir.$file)) { |
|
513 | + $filetype = 'folder'; |
|
514 | + } |
|
513 | 515 | |
514 | 516 | // TODO: RENAMING FILES CAN BE VERY DANGEROUS AICC-WISE, avoid that as much as possible! |
515 | 517 | //$safe_file = api_replace_dangerous_char($file, 'strict'); |
@@ -908,37 +910,43 @@ discard block |
||
908 | 910 | if ($enclosed && $data{$i+1} == $enclosure) { |
909 | 911 | $fldval .= $chr; |
910 | 912 | ++$i; // Skip the next character. |
911 | - } else |
|
912 | - $enclosed = !$enclosed; |
|
913 | + } else { |
|
914 | + $enclosed = !$enclosed; |
|
915 | + } |
|
913 | 916 | break; |
914 | 917 | case $delim: |
915 | 918 | if (!$enclosed) { |
916 | 919 | $ret_array[$linecount][$fldcount++] = $fldval; |
917 | 920 | $fldval = ''; |
918 | - } else |
|
919 | - $fldval .= $chr; |
|
921 | + } else { |
|
922 | + $fldval .= $chr; |
|
923 | + } |
|
920 | 924 | break; |
921 | 925 | case "\r": |
922 | - if (!$enclosed&&$data{$i+1} == "\n") |
|
923 | - continue; |
|
926 | + if (!$enclosed&&$data{$i+1} == "\n") { |
|
927 | + continue; |
|
928 | + } |
|
924 | 929 | case "\n": |
925 | 930 | if (!$enclosed) { |
926 | 931 | $ret_array[$linecount++][$fldcount] = $fldval; |
927 | 932 | $fldcount = 0; |
928 | 933 | $fldval = ''; |
929 | - } else |
|
930 | - $fldval .= $chr; |
|
934 | + } else { |
|
935 | + $fldval .= $chr; |
|
936 | + } |
|
931 | 937 | break; |
932 | 938 | case "\\r": |
933 | - if (!$enclosed&&$data{$i+1} == "\\n") |
|
934 | - continue; |
|
939 | + if (!$enclosed&&$data{$i+1} == "\\n") { |
|
940 | + continue; |
|
941 | + } |
|
935 | 942 | case "\\n": |
936 | 943 | if (!$enclosed) { |
937 | 944 | $ret_array[$linecount++][$fldcount] = $fldval; |
938 | 945 | $fldcount = 0; |
939 | 946 | $fldval = ''; |
940 | - } else |
|
941 | - $fldval .= $chr; |
|
947 | + } else { |
|
948 | + $fldval .= $chr; |
|
949 | + } |
|
942 | 950 | break; |
943 | 951 | default: |
944 | 952 | $fldval .= $chr; |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | ?> |
136 | 136 | <div id="message" style="display: none"> |
137 | 137 | <?php |
138 | - if(!empty($message)) |
|
139 | - Display::display_normal_message($message) |
|
138 | + if(!empty($message)) { |
|
139 | + Display::display_normal_message($message) |
|
140 | 140 | ?> |
141 | 141 | </div> |
142 | 142 | |
@@ -150,7 +150,9 @@ discard block |
||
150 | 150 | </div> |
151 | 151 | <div class="row"> |
152 | 152 | <div class="col-md-5"> |
153 | - <?php Display::display_icon('screenshot_ppt2lp.jpg', get_lang('Ppt2lp'), array('class'=>'img-responsive')); ?> |
|
153 | + <?php Display::display_icon('screenshot_ppt2lp.jpg', get_lang('Ppt2lp'), array('class'=>'img-responsive')); |
|
154 | + } |
|
155 | + ?> |
|
154 | 156 | </div> |
155 | 157 | <div class="col-md-7"> |
156 | 158 | <form method="POST" class="form-horizontal" action="<?php echo api_get_self(); ?>"> |
@@ -2165,8 +2165,9 @@ discard block |
||
2165 | 2165 | if (empty($user_id)) { |
2166 | 2166 | $user_id = 0; |
2167 | 2167 | } else { |
2168 | - if ($user_id != strval(intval($user_id))) |
|
2169 | - return array(); |
|
2168 | + if ($user_id != strval(intval($user_id))) { |
|
2169 | + return array(); |
|
2170 | + } |
|
2170 | 2171 | } |
2171 | 2172 | $extra_data = array(); |
2172 | 2173 | $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD); |
@@ -2258,8 +2259,9 @@ discard block |
||
2258 | 2259 | if (empty($user_id)) { |
2259 | 2260 | $user_id = 0; |
2260 | 2261 | } else { |
2261 | - if ($user_id != strval(intval($user_id))) |
|
2262 | - return array(); |
|
2262 | + if ($user_id != strval(intval($user_id))) { |
|
2263 | + return array(); |
|
2264 | + } |
|
2263 | 2265 | } |
2264 | 2266 | $extra_data = array(); |
2265 | 2267 | $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD); |
@@ -3042,13 +3044,15 @@ discard block |
||
3042 | 3044 | */ |
3043 | 3045 | public static function get_api_keys($user_id = null, $api_service = 'dokeos') |
3044 | 3046 | { |
3045 | - if ($user_id != strval(intval($user_id))) |
|
3046 | - return false; |
|
3047 | + if ($user_id != strval(intval($user_id))) { |
|
3048 | + return false; |
|
3049 | + } |
|
3047 | 3050 | if (empty($user_id)) { |
3048 | 3051 | $user_id = api_get_user_id(); |
3049 | 3052 | } |
3050 | - if ($user_id === false) |
|
3051 | - return false; |
|
3053 | + if ($user_id === false) { |
|
3054 | + return false; |
|
3055 | + } |
|
3052 | 3056 | $service_name = Database::escape_string($api_service); |
3053 | 3057 | if (is_string($service_name) === false) { |
3054 | 3058 | return false; |
@@ -3056,11 +3060,14 @@ discard block |
||
3056 | 3060 | $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY); |
3057 | 3061 | $sql = "SELECT * FROM $t_api WHERE user_id = $user_id AND api_service='$api_service';"; |
3058 | 3062 | $res = Database::query($sql); |
3059 | - if ($res === false) |
|
3060 | - return false; //error during query |
|
3063 | + if ($res === false) { |
|
3064 | + return false; |
|
3065 | + } |
|
3066 | + //error during query |
|
3061 | 3067 | $num = Database::num_rows($res); |
3062 | - if ($num == 0) |
|
3063 | - return false; |
|
3068 | + if ($num == 0) { |
|
3069 | + return false; |
|
3070 | + } |
|
3064 | 3071 | $list = array(); |
3065 | 3072 | while ($row = Database::fetch_array($res)) { |
3066 | 3073 | $list[$row['id']] = $row['api_key']; |
@@ -3075,13 +3082,15 @@ discard block |
||
3075 | 3082 | */ |
3076 | 3083 | public static function add_api_key($user_id = null, $api_service = 'dokeos') |
3077 | 3084 | { |
3078 | - if ($user_id != strval(intval($user_id))) |
|
3079 | - return false; |
|
3085 | + if ($user_id != strval(intval($user_id))) { |
|
3086 | + return false; |
|
3087 | + } |
|
3080 | 3088 | if (empty($user_id)) { |
3081 | 3089 | $user_id = api_get_user_id(); |
3082 | 3090 | } |
3083 | - if ($user_id === false) |
|
3084 | - return false; |
|
3091 | + if ($user_id === false) { |
|
3092 | + return false; |
|
3093 | + } |
|
3085 | 3094 | $service_name = Database::escape_string($api_service); |
3086 | 3095 | if (is_string($service_name) === false) { |
3087 | 3096 | return false; |
@@ -3090,8 +3099,10 @@ discard block |
||
3090 | 3099 | $md5 = md5((time() + ($user_id * 5)) - rand(10000, 10000)); //generate some kind of random key |
3091 | 3100 | $sql = "INSERT INTO $t_api (user_id, api_key,api_service) VALUES ($user_id,'$md5','$service_name')"; |
3092 | 3101 | $res = Database::query($sql); |
3093 | - if ($res === false) |
|
3094 | - return false; //error during query |
|
3102 | + if ($res === false) { |
|
3103 | + return false; |
|
3104 | + } |
|
3105 | + //error during query |
|
3095 | 3106 | $num = Database::insert_id(); |
3096 | 3107 | return ($num == 0) ? false : $num; |
3097 | 3108 | } |
@@ -3103,22 +3114,29 @@ discard block |
||
3103 | 3114 | */ |
3104 | 3115 | public static function delete_api_key($key_id) |
3105 | 3116 | { |
3106 | - if ($key_id != strval(intval($key_id))) |
|
3107 | - return false; |
|
3108 | - if ($key_id === false) |
|
3109 | - return false; |
|
3117 | + if ($key_id != strval(intval($key_id))) { |
|
3118 | + return false; |
|
3119 | + } |
|
3120 | + if ($key_id === false) { |
|
3121 | + return false; |
|
3122 | + } |
|
3110 | 3123 | $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY); |
3111 | 3124 | $sql = "SELECT * FROM $t_api WHERE id = ".$key_id; |
3112 | 3125 | $res = Database::query($sql); |
3113 | - if ($res === false) |
|
3114 | - return false; //error during query |
|
3126 | + if ($res === false) { |
|
3127 | + return false; |
|
3128 | + } |
|
3129 | + //error during query |
|
3115 | 3130 | $num = Database::num_rows($res); |
3116 | - if ($num !== 1) |
|
3117 | - return false; |
|
3131 | + if ($num !== 1) { |
|
3132 | + return false; |
|
3133 | + } |
|
3118 | 3134 | $sql = "DELETE FROM $t_api WHERE id = ".$key_id; |
3119 | 3135 | $res = Database::query($sql); |
3120 | - if ($res === false) |
|
3121 | - return false; //error during query |
|
3136 | + if ($res === false) { |
|
3137 | + return false; |
|
3138 | + } |
|
3139 | + //error during query |
|
3122 | 3140 | return true; |
3123 | 3141 | } |
3124 | 3142 | |
@@ -3130,10 +3148,12 @@ discard block |
||
3130 | 3148 | */ |
3131 | 3149 | public static function update_api_key($user_id, $api_service) |
3132 | 3150 | { |
3133 | - if ($user_id != strval(intval($user_id))) |
|
3134 | - return false; |
|
3135 | - if ($user_id === false) |
|
3136 | - return false; |
|
3151 | + if ($user_id != strval(intval($user_id))) { |
|
3152 | + return false; |
|
3153 | + } |
|
3154 | + if ($user_id === false) { |
|
3155 | + return false; |
|
3156 | + } |
|
3137 | 3157 | $service_name = Database::escape_string($api_service); |
3138 | 3158 | if (is_string($service_name) === false) { |
3139 | 3159 | return false; |
@@ -3159,12 +3179,15 @@ discard block |
||
3159 | 3179 | */ |
3160 | 3180 | public static function get_api_key_id($user_id, $api_service) |
3161 | 3181 | { |
3162 | - if ($user_id != strval(intval($user_id))) |
|
3163 | - return false; |
|
3164 | - if ($user_id === false) |
|
3165 | - return false; |
|
3166 | - if (empty($api_service)) |
|
3167 | - return false; |
|
3182 | + if ($user_id != strval(intval($user_id))) { |
|
3183 | + return false; |
|
3184 | + } |
|
3185 | + if ($user_id === false) { |
|
3186 | + return false; |
|
3187 | + } |
|
3188 | + if (empty($api_service)) { |
|
3189 | + return false; |
|
3190 | + } |
|
3168 | 3191 | $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY); |
3169 | 3192 | $api_service = Database::escape_string($api_service); |
3170 | 3193 | $sql = "SELECT id FROM $t_api WHERE user_id=".$user_id." AND api_service='".$api_service."'"; |
@@ -4666,8 +4689,9 @@ discard block |
||
4666 | 4689 | $form->applyFilter('extra_'.$field_details[1], 'stripslashes'); |
4667 | 4690 | $form->applyFilter('extra_'.$field_details[1], 'trim'); |
4668 | 4691 | if (!$admin_permissions) { |
4669 | - if ($field_details[7] == 0) |
|
4670 | - $form->freeze('extra_'.$field_details[1]); |
|
4692 | + if ($field_details[7] == 0) { |
|
4693 | + $form->freeze('extra_'.$field_details[1]); |
|
4694 | + } |
|
4671 | 4695 | } |
4672 | 4696 | break; |
4673 | 4697 | case ExtraField::FIELD_TYPE_RADIO: |
@@ -4724,8 +4748,9 @@ discard block |
||
4724 | 4748 | ); |
4725 | 4749 | |
4726 | 4750 | if (!$admin_permissions) { |
4727 | - if ($field_details[7] == 0) |
|
4728 | - $form->freeze('extra_'.$field_details[1]); |
|
4751 | + if ($field_details[7] == 0) { |
|
4752 | + $form->freeze('extra_'.$field_details[1]); |
|
4753 | + } |
|
4729 | 4754 | } |
4730 | 4755 | break; |
4731 | 4756 | case ExtraField::FIELD_TYPE_SELECT_MULTIPLE: |
@@ -4741,8 +4766,9 @@ discard block |
||
4741 | 4766 | array('multiple' => 'multiple') |
4742 | 4767 | ); |
4743 | 4768 | if (!$admin_permissions) { |
4744 | - if ($field_details[7] == 0) |
|
4745 | - $form->freeze('extra_'.$field_details[1]); |
|
4769 | + if ($field_details[7] == 0) { |
|
4770 | + $form->freeze('extra_'.$field_details[1]); |
|
4771 | + } |
|
4746 | 4772 | } |
4747 | 4773 | break; |
4748 | 4774 | case ExtraField::FIELD_TYPE_DATE: |
@@ -4750,8 +4776,9 @@ discard block |
||
4750 | 4776 | $defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00'); |
4751 | 4777 | $form->setDefaults($defaults); |
4752 | 4778 | if (!$admin_permissions) { |
4753 | - if ($field_details[7] == 0) |
|
4754 | - $form->freeze('extra_'.$field_details[1]); |
|
4779 | + if ($field_details[7] == 0) { |
|
4780 | + $form->freeze('extra_'.$field_details[1]); |
|
4781 | + } |
|
4755 | 4782 | } |
4756 | 4783 | $form->applyFilter('theme', 'trim'); |
4757 | 4784 | break; |
@@ -4760,8 +4787,9 @@ discard block |
||
4760 | 4787 | $defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00'); |
4761 | 4788 | $form->setDefaults($defaults); |
4762 | 4789 | if (!$admin_permissions) { |
4763 | - if ($field_details[7] == 0) |
|
4764 | - $form->freeze('extra_'.$field_details[1]); |
|
4790 | + if ($field_details[7] == 0) { |
|
4791 | + $form->freeze('extra_'.$field_details[1]); |
|
4792 | + } |
|
4765 | 4793 | } |
4766 | 4794 | $form->applyFilter('theme', 'trim'); |
4767 | 4795 | break; |
@@ -4780,8 +4808,9 @@ discard block |
||
4780 | 4808 | $form->addGroup($group, 'extra_'.$field_details[1], $field_details[3]); |
4781 | 4809 | |
4782 | 4810 | if (!$admin_permissions) { |
4783 | - if ($field_details[7] == 0) |
|
4784 | - $form->freeze('extra_'.$field_details[1]); |
|
4811 | + if ($field_details[7] == 0) { |
|
4812 | + $form->freeze('extra_'.$field_details[1]); |
|
4813 | + } |
|
4785 | 4814 | } |
4786 | 4815 | |
4787 | 4816 | /* Recoding the selected values for double : if the user has |
@@ -4841,8 +4870,9 @@ discard block |
||
4841 | 4870 | break; |
4842 | 4871 | case ExtraField::FIELD_TYPE_TIMEZONE: |
4843 | 4872 | $form->addElement('select', 'extra_'.$field_details[1], $field_details[3], api_get_timezones(), ''); |
4844 | - if ($field_details[7] == 0) |
|
4845 | - $form->freeze('extra_'.$field_details[1]); |
|
4873 | + if ($field_details[7] == 0) { |
|
4874 | + $form->freeze('extra_'.$field_details[1]); |
|
4875 | + } |
|
4846 | 4876 | break; |
4847 | 4877 | case ExtraField::FIELD_TYPE_SOCIAL_PROFILE: |
4848 | 4878 | // get the social network's favicon |
@@ -4867,8 +4897,9 @@ discard block |
||
4867 | 4897 | ); |
4868 | 4898 | $form->applyFilter('extra_'.$field_details[1], 'stripslashes'); |
4869 | 4899 | $form->applyFilter('extra_'.$field_details[1], 'trim'); |
4870 | - if ($field_details[7] == 0) |
|
4871 | - $form->freeze('extra_'.$field_details[1]); |
|
4900 | + if ($field_details[7] == 0) { |
|
4901 | + $form->freeze('extra_'.$field_details[1]); |
|
4902 | + } |
|
4872 | 4903 | break; |
4873 | 4904 | case ExtraField::FIELD_TYPE_FILE: |
4874 | 4905 | $extra_field = 'extra_'.$field_details[1]; |
@@ -5277,8 +5308,9 @@ discard block |
||
5277 | 5308 | $url .= "?s=$s&d=$d&r=$r"; |
5278 | 5309 | if ( $img ) { |
5279 | 5310 | $url = '<img src="' . $url . '"'; |
5280 | - foreach ( $atts as $key => $val ) |
|
5281 | - $url .= ' ' . $key . '="' . $val . '"'; |
|
5311 | + foreach ( $atts as $key => $val ) { |
|
5312 | + $url .= ' ' . $key . '="' . $val . '"'; |
|
5313 | + } |
|
5282 | 5314 | $url .= ' />'; |
5283 | 5315 | } |
5284 | 5316 | return $url; |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | $isAdmin = api_is_platform_admin(); |
139 | 139 | |
140 | 140 | Display::display_header(get_lang('MyTickets')); |
141 | -if (!empty($projectId)) |
|
142 | -if ($isAdmin) { |
|
141 | +if (!empty($projectId)) { |
|
142 | + if ($isAdmin) { |
|
143 | 143 | $getParameters = [ |
144 | 144 | 'keyword', |
145 | 145 | 'keyword_status', |
@@ -151,6 +151,7 @@ discard block |
||
151 | 151 | 'Tickets_per_page', |
152 | 152 | 'Tickets_column' |
153 | 153 | ]; |
154 | +} |
|
154 | 155 | $get_parameter = ''; |
155 | 156 | foreach ($getParameters as $getParameter) { |
156 | 157 | if (isset($_GET[$getParameter])) { |