Skip to content

Commit

Permalink
Merge pull request #2971 from BOINC/cb_fix_deprecated_php_stuff
Browse files Browse the repository at this point in the history
Web: fix deprecated php stuff
  • Loading branch information
davidpanderson authored Mar 18, 2019
2 parents 775f5c6 + 83af843 commit e65a6b1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion html/inc/bolt_ex.inc
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ function fitb() {
}
break;
case 1:
if (ereg($answer->ans, $response)) {
if (preg_match('/'.$answer->ans.'/', $response)) {
$bolt_ex->score = 1;
}
break;
Expand Down
12 changes: 7 additions & 5 deletions html/inc/translation.inc
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ function parse_po_file($file) {
$current_token ="";
$parsing_token = false;
$parsing_text = false;
$size = sizeof($translation_file);
$output = array();
for ($i=0; $i<sizeof($translation_file); $i++){
for ($i=0; $i<$size; $i++){
$entry = trim($translation_file[$i]);
//echo "line $i: $entry\n";
if (substr($entry, 0, 1)=="#") {
Expand Down Expand Up @@ -160,7 +161,7 @@ function parse_po_file($file) {
function get_po_line($line, $file) {
$start = strpos($line, '"')+1;
$stop = strrpos($line, '"');
$x = substr($line, $start, $stop-$start);
$x = substr($line, $start, $stop-$start);
$n = preg_match("/[^\\\\]\"/", $x);
if ($n) {
echo "ERROR - MISMATCHED QUOTES IN $file: $line\n";
Expand Down Expand Up @@ -195,9 +196,8 @@ function tra($text /* ...arglist... */) {
for ($i=1; $i<func_num_args(); $i++){
$replacements["%".$i] = func_get_arg($i);
}
$text = strtr($text, $replacements);

return $text;
return strtr($text, $replacements);
}

function tr_specific($text, $language) {
Expand All @@ -212,6 +212,7 @@ function tr_specific($text, $language) {

function language_log($message, $loglevel=0) {
global $lang_log_level;
$msg = "";
if ($loglevel==0) $msg = "[ Debug ]";
if ($loglevel==1) $msg = "[ Warning ]";
if ($loglevel==2) $msg = "[ CRITICAL ]";
Expand Down Expand Up @@ -255,7 +256,8 @@ $languages_in_use = array();

// Loop over languages that the client requests
//
for ($i=0; $i<sizeof($client_languages); $i++) {
$size = sizeof($client_languages);
for ($i=0; $i<$size; $i++) {
if ((strlen($client_languages[$i])>2)
&& (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-")
){
Expand Down
6 changes: 3 additions & 3 deletions html/ops/mass_email_script.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function read_log() {
exit();
}
$startid = 0;
while (fscanf($f, '%d', &$startid)) {
while (fscanf($f, '%d', $startid)) {
// read to the last entry in the file
}
fclose($f);
Expand All @@ -287,13 +287,13 @@ function main() {
$startid = $new_startid;
}
} else {
$fid = fopen($id_file, 'r');
$fid = fopen($id_file, 'r');
if (!$fid) {
echo $id_file . ' not found - create ID list and run again\n';
exit();
}
$thisid = 0;
while (fscanf($fid, '%d', &$thisid)) {
while (fscanf($fid, '%d', $thisid)) {
if ($thisid > $startid) {
do_one($thisid, $f);
}
Expand Down
2 changes: 1 addition & 1 deletion html/user/bolt_sched.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ function show_next($iter, $view) {
//
show_refresh_finished();
$refresh->update('count=count+1');
break;
return;
}
}

Expand Down

0 comments on commit e65a6b1

Please sign in to comment.