@@ -24,72 +24,72 @@ |
||
| 24 | 24 | define('KW_CATEGORY_SCIENCE', 0); |
| 25 | 25 | define('KW_CATEGORY_LOC', 1); |
| 26 | 26 | |
| 27 | -define('KW_ASTRONOMY', 1); |
|
| 28 | -define('KW_SETI', 2); |
|
| 29 | -define('KW_PULSARS', 3); |
|
| 30 | -define('KW_GW', 4); |
|
| 31 | -define('KW_COSMOLOGY', 5); |
|
| 32 | -define('KW_PHYSICS', 6); |
|
| 27 | +define('KW_ASTRONOMY', 1); |
|
| 28 | +define('KW_SETI', 2); |
|
| 29 | +define('KW_PULSARS', 3); |
|
| 30 | +define('KW_GW', 4); |
|
| 31 | +define('KW_COSMOLOGY', 5); |
|
| 32 | +define('KW_PHYSICS', 6); |
|
| 33 | 33 | define('KW_PARTICLE_PHYSICS', 7); |
| 34 | -define('KW_NANOSCIENCE', 8); |
|
| 35 | -define('KW_BIOMED', 9); |
|
| 34 | +define('KW_NANOSCIENCE', 8); |
|
| 35 | +define('KW_BIOMED', 9); |
|
| 36 | 36 | define('KW_DRUG_DISCOVERY', 10); |
| 37 | -define('KW_PROTEINS', 11); |
|
| 38 | -define('KW_GENETICS', 12); |
|
| 39 | -define('KW_DISEASE', 13); |
|
| 40 | -define('KW_CANCER', 14); |
|
| 41 | -define('KW_MATH_CS', 15); |
|
| 42 | -define('KW_AI', 16); |
|
| 43 | -define('KW_OCEANIA', 17); |
|
| 44 | -define('KW_AUSTRALIA', 18); |
|
| 37 | +define('KW_PROTEINS', 11); |
|
| 38 | +define('KW_GENETICS', 12); |
|
| 39 | +define('KW_DISEASE', 13); |
|
| 40 | +define('KW_CANCER', 14); |
|
| 41 | +define('KW_MATH_CS', 15); |
|
| 42 | +define('KW_AI', 16); |
|
| 43 | +define('KW_OCEANIA', 17); |
|
| 44 | +define('KW_AUSTRALIA', 18); |
|
| 45 | 45 | |
| 46 | -define('KW_EUROPE', 20); |
|
| 47 | -define('KW_GERMANY', 21); |
|
| 48 | -define('KW_ASIA', 22); |
|
| 49 | -define('KW_AMERICAS', 23); |
|
| 50 | -define('KW_US', 24); |
|
| 51 | -define('KW_UCB', 25); |
|
| 52 | -define('KW_AEI', 26); |
|
| 53 | -define('KW_CERN', 27); |
|
| 54 | -define('KW_UW', 28); |
|
| 55 | -define('KW_EARTH_SCI', 29); |
|
| 56 | -define('KW_SPAIN', 30); |
|
| 57 | -define('KW_SAN_JORGE', 31); |
|
| 58 | -define('KW_NUMBER_THEORY', 32); |
|
| 59 | -define('KW_CRYPTO', 33); |
|
| 60 | -define('KW_ENV_RESEARCH', 34); |
|
| 61 | -define('KW_CLIMATE', 35); |
|
| 62 | -define('KW_CZECH', 36); |
|
| 46 | +define('KW_EUROPE', 20); |
|
| 47 | +define('KW_GERMANY', 21); |
|
| 48 | +define('KW_ASIA', 22); |
|
| 49 | +define('KW_AMERICAS', 23); |
|
| 50 | +define('KW_US', 24); |
|
| 51 | +define('KW_UCB', 25); |
|
| 52 | +define('KW_AEI', 26); |
|
| 53 | +define('KW_CERN', 27); |
|
| 54 | +define('KW_UW', 28); |
|
| 55 | +define('KW_EARTH_SCI', 29); |
|
| 56 | +define('KW_SPAIN', 30); |
|
| 57 | +define('KW_SAN_JORGE', 31); |
|
| 58 | +define('KW_NUMBER_THEORY', 32); |
|
| 59 | +define('KW_CRYPTO', 33); |
|
| 60 | +define('KW_ENV_RESEARCH', 34); |
|
| 61 | +define('KW_CLIMATE', 35); |
|
| 62 | +define('KW_CZECH', 36); |
|
| 63 | 63 | define('KW_CHARLES_PRAGUE', 37); |
| 64 | -define('KW_RECHENKRAFT', 38); |
|
| 65 | -define('KW_RHEINMAIN', 39); |
|
| 66 | -define('KW_HUNGARY', 40); |
|
| 67 | -define('KW_IRELAND', 41); |
|
| 68 | -define('KW_UC_DUBLIN', 42); |
|
| 69 | -define('KW_POLAND', 43); |
|
| 70 | -define('KW_RUSSIA', 44); |
|
| 64 | +define('KW_RECHENKRAFT', 38); |
|
| 65 | +define('KW_RHEINMAIN', 39); |
|
| 66 | +define('KW_HUNGARY', 40); |
|
| 67 | +define('KW_IRELAND', 41); |
|
| 68 | +define('KW_UC_DUBLIN', 42); |
|
| 69 | +define('KW_POLAND', 43); |
|
| 70 | +define('KW_RUSSIA', 44); |
|
| 71 | 71 | define('KW_SW_STATE_RUSSIA', 45); |
| 72 | -define('KW_RAS', 46); |
|
| 73 | -define('KW_PRBB', 47); |
|
| 74 | -define('KW_UK', 48); |
|
| 75 | -define('KW_OXFORD', 49); |
|
| 76 | -define('KW_CHINA', 50); |
|
| 77 | -define('KW_U_DAYTON', 51); |
|
| 78 | -define('KW_WRIGHT_STATE', 52); |
|
| 79 | -define('KW_USC', 53); |
|
| 80 | -define('KW_FULLERTON', 54); |
|
| 81 | -define('KW_ARIZONA_STATE', 55); |
|
| 82 | -define('KW_U_ILLINOIS', 56); |
|
| 83 | -define('KW_U_WARSAW', 57); |
|
| 84 | -define('KW_RPI', 58); |
|
| 85 | -define('KW_INTERNATIONAL', 59); |
|
| 86 | -define('KW_UND', 60); |
|
| 87 | -define('KW_HOLLAND', 61); |
|
| 88 | -define('KW_CHEMISTRY', 62); |
|
| 89 | -define('KW_GAMES', 63); |
|
| 90 | -define('KW_VIRUS', 64); |
|
| 91 | -define('KW_FRANCE', 65); |
|
| 92 | -define('KW_CANADA', 66); |
|
| 72 | +define('KW_RAS', 46); |
|
| 73 | +define('KW_PRBB', 47); |
|
| 74 | +define('KW_UK', 48); |
|
| 75 | +define('KW_OXFORD', 49); |
|
| 76 | +define('KW_CHINA', 50); |
|
| 77 | +define('KW_U_DAYTON', 51); |
|
| 78 | +define('KW_WRIGHT_STATE', 52); |
|
| 79 | +define('KW_USC', 53); |
|
| 80 | +define('KW_FULLERTON', 54); |
|
| 81 | +define('KW_ARIZONA_STATE', 55); |
|
| 82 | +define('KW_U_ILLINOIS', 56); |
|
| 83 | +define('KW_U_WARSAW', 57); |
|
| 84 | +define('KW_RPI', 58); |
|
| 85 | +define('KW_INTERNATIONAL', 59); |
|
| 86 | +define('KW_UND', 60); |
|
| 87 | +define('KW_HOLLAND', 61); |
|
| 88 | +define('KW_CHEMISTRY', 62); |
|
| 89 | +define('KW_GAMES', 63); |
|
| 90 | +define('KW_VIRUS', 64); |
|
| 91 | +define('KW_FRANCE', 65); |
|
| 92 | +define('KW_CANADA', 66); |
|
| 93 | 93 | |
| 94 | 94 | $job_keywords = array(); |
| 95 | 95 | |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | $offset = get_int("offset", true); |
| 35 | -if (!$offset) $offset=0; |
|
| 35 | +if (!$offset) $offset = 0; |
|
| 36 | 36 | |
| 37 | 37 | if ($offset > 1000) { |
| 38 | 38 | error_page(tra("Limit exceeded: Can only display the first 1000 members.")); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | function show_forum_rss_item($thread, $userid, $threads_only, $no_images) { |
| 33 | - $unique_url=secure_url_base()."forum_thread.php?id=".$thread->id; |
|
| 33 | + $unique_url = secure_url_base()."forum_thread.php?id=".$thread->id; |
|
| 34 | 34 | |
| 35 | 35 | $clause2 = " and hidden=0 "; |
| 36 | 36 | if ($userid) $clause2 .= "and user=$userid"; |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | if (!count($posts)) return; |
| 43 | 43 | $post = $posts[0]; |
| 44 | - $post_date = gmdate('D, d M Y H:i:s',$post->timestamp).' GMT'; |
|
| 44 | + $post_date = gmdate('D, d M Y H:i:s', $post->timestamp).' GMT'; |
|
| 45 | 45 | $post_user = BOincUser::lookup_id($post->user); |
| 46 | 46 | BoincForumPrefs::lookup($post_user); |
| 47 | 47 | $options = new output_options(); |
@@ -84,25 +84,25 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | // Now construct header |
| 86 | 86 | // |
| 87 | - header ("Expires: " . gmdate('D, d M Y H:i:s', time()+86400) . " GMT"); |
|
| 87 | + header("Expires: ".gmdate('D, d M Y H:i:s', time() + 86400)." GMT"); |
|
| 88 | 88 | if (sizeof($threads)) { |
| 89 | 89 | $t = $threads[0]; |
| 90 | - $last_mod_time = $threads_only?$t->create_time:$t->timestamp; |
|
| 91 | - $create_date = gmdate('D, d M Y H:i:s', $last_mod_time) . ' GMT'; |
|
| 92 | - header ("Last-Modified: " . $create_date); |
|
| 90 | + $last_mod_time = $threads_only ? $t->create_time : $t->timestamp; |
|
| 91 | + $create_date = gmdate('D, d M Y H:i:s', $last_mod_time).' GMT'; |
|
| 92 | + header("Last-Modified: ".$create_date); |
|
| 93 | 93 | } else { |
| 94 | - $create_date = gmdate('D, d M Y H:i:s') . ' GMT'; |
|
| 94 | + $create_date = gmdate('D, d M Y H:i:s').' GMT'; |
|
| 95 | 95 | } |
| 96 | - header ("Content-Type: application/xml"); |
|
| 96 | + header("Content-Type: application/xml"); |
|
| 97 | 97 | |
| 98 | - $forum=BoincForum::lookup_id($forumid); |
|
| 98 | + $forum = BoincForum::lookup_id($forumid); |
|
| 99 | 99 | // Create channel header and open XML content |
| 100 | 100 | // |
| 101 | 101 | $description = PROJECT.": $forum->title"; |
| 102 | 102 | if ($userid) { |
| 103 | 103 | $description .= " (posts by $user->name)"; |
| 104 | 104 | } |
| 105 | - $channel_image = secure_url_base() . "rss_image.gif"; |
|
| 105 | + $channel_image = secure_url_base()."rss_image.gif"; |
|
| 106 | 106 | $language = "en-us"; |
| 107 | 107 | echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> |
| 108 | 108 | <rss version=\"2.0\"> |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | continue; |
| 69 | 69 | } |
| 70 | 70 | // only do files ending in .po |
| 71 | - if (substr($file,-3) != ".po"){ |
|
| 71 | + if (substr($file,-3) != ".po") { |
|
| 72 | 72 | //debug("File $file with unknown extension found in $info_dir"); |
| 73 | 73 | continue; |
| 74 | 74 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | "-------------Compiling $transdir$file------------", 0 |
| 77 | 77 | ); |
| 78 | 78 | $language = parse_po_file($langdir.$transdir.$file); |
| 79 | - if (!$language){ |
|
| 79 | + if (!$language) { |
|
| 80 | 80 | language_log( |
| 81 | 81 | "WARNING: Could not parse language ".$file |
| 82 | 82 | ); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | ); |
| 96 | 96 | exit; |
| 97 | 97 | } |
| 98 | - foreach ($language as $key => $value){ |
|
| 98 | + foreach ($language as $key => $value) { |
|
| 99 | 99 | if ($value !== "") { |
| 100 | 100 | // Skip if the msgstr is empty |
| 101 | 101 | fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n"); |
@@ -121,13 +121,13 @@ discard block |
||
| 121 | 121 | $parsing_text = false; |
| 122 | 122 | $size = sizeof($translation_file); |
| 123 | 123 | $output = array(); |
| 124 | - for ($i=0; $i<$size; $i++){ |
|
| 124 | + for ($i=0; $i<$size; $i++) { |
|
| 125 | 125 | $entry = trim($translation_file[$i]); |
| 126 | 126 | //echo "line $i: $entry\n"; |
| 127 | 127 | if (substr($entry, 0, 1)=="#") { |
| 128 | 128 | continue; |
| 129 | 129 | } elseif (strpos($entry, "msgid") !== false) { |
| 130 | - if (!$first_entry){ |
|
| 130 | + if (!$first_entry) { |
|
| 131 | 131 | //If this is not the first, save the previous entry |
| 132 | 132 | $output[$current_token]=$current_token_text; |
| 133 | 133 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | // Get the last token |
| 151 | 151 | // |
| 152 | - if ($current_token && $current_token_text){ |
|
| 152 | + if ($current_token && $current_token_text) { |
|
| 153 | 153 | $output[$current_token] = $current_token_text; |
| 154 | 154 | } |
| 155 | 155 | return $output; |
@@ -180,11 +180,11 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | // Find the string in the user's language |
| 182 | 182 | // |
| 183 | - foreach ($languages_in_use as $language){ |
|
| 183 | + foreach ($languages_in_use as $language) { |
|
| 184 | 184 | if (isset($language_lookup_array[$language][$text])) { |
| 185 | 185 | $text = $language_lookup_array[$language][$text]; |
| 186 | 186 | break; |
| 187 | - } else if ($language=="en"){ |
|
| 187 | + } else if ($language=="en") { |
|
| 188 | 188 | // This language is defined in the code and is always available |
| 189 | 189 | break; |
| 190 | 190 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | // Replace relevant substrings with given arguments. |
| 194 | 194 | // Use strtr to avoid problems if an argument contains %n. |
| 195 | 195 | $replacements = array(); |
| 196 | - for ($i=1; $i<func_num_args(); $i++){ |
|
| 196 | + for ($i=1; $i<func_num_args(); $i++) { |
|
| 197 | 197 | $replacements["%".$i] = func_get_arg($i); |
| 198 | 198 | } |
| 199 | 199 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | if ($loglevel==1) $msg = "[ Warning ]"; |
| 218 | 218 | if ($loglevel==2) $msg = "[ CRITICAL ]"; |
| 219 | 219 | |
| 220 | - if ($loglevel >= $lang_log_level){ |
|
| 220 | + if ($loglevel >= $lang_log_level) { |
|
| 221 | 221 | echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n"; |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | // (by looking at cookies and browser settings) |
| 227 | 227 | // cookies have highest priority. |
| 228 | 228 | |
| 229 | -if (isset($_COOKIE['lang'])){ |
|
| 229 | +if (isset($_COOKIE['lang'])) { |
|
| 230 | 230 | $language_string = $_COOKIE['lang'].","; |
| 231 | 231 | } else { |
| 232 | 232 | $language_string = ''; |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | for ($i=0; $i<$size; $i++) { |
| 261 | 261 | if ((strlen($client_languages[$i])>2) |
| 262 | 262 | && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-") |
| 263 | - ){ |
|
| 263 | + ) { |
|
| 264 | 264 | // If this is defined as primary-secondary, represent it as xx_YY |
| 265 | 265 | // |
| 266 | 266 | $language = substr( |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | // |
| 288 | 288 | $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc"; |
| 289 | 289 | if (file_exists($file_name)) { |
| 290 | - if (!in_array($language, $languages_in_use)){ |
|
| 290 | + if (!in_array($language, $languages_in_use)) { |
|
| 291 | 291 | require_once($file_name); |
| 292 | 292 | $languages_in_use[] = $language; |
| 293 | 293 | } |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | if ($language2) { |
| 296 | 296 | $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc"; |
| 297 | 297 | if (file_exists($file_name)) { |
| 298 | - if (!in_array($language2, $languages_in_use)){ |
|
| 298 | + if (!in_array($language2, $languages_in_use)) { |
|
| 299 | 299 | require_once($file_name); |
| 300 | 300 | $languages_in_use[] = $language2; |
| 301 | 301 | } |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | $dh = opendir($langdir.$transdir); |
| 65 | 65 | if (!$dh) die("can't open translation dir"); |
| 66 | 66 | while (($file = readdir($dh)) !== false) { |
| 67 | - if ($file==".." || $file==".") { |
|
| 67 | + if ($file == ".." || $file == ".") { |
|
| 68 | 68 | continue; |
| 69 | 69 | } |
| 70 | 70 | // only do files ending in .po |
| 71 | - if (substr($file,-3) != ".po"){ |
|
| 71 | + if (substr($file, -3) != ".po") { |
|
| 72 | 72 | //debug("File $file with unknown extension found in $info_dir"); |
| 73 | 73 | continue; |
| 74 | 74 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | "-------------Compiling $transdir$file------------", 0 |
| 77 | 77 | ); |
| 78 | 78 | $language = parse_po_file($langdir.$transdir.$file); |
| 79 | - if (!$language){ |
|
| 79 | + if (!$language) { |
|
| 80 | 80 | language_log( |
| 81 | 81 | "WARNING: Could not parse language ".$file |
| 82 | 82 | ); |
@@ -95,10 +95,10 @@ discard block |
||
| 95 | 95 | ); |
| 96 | 96 | exit; |
| 97 | 97 | } |
| 98 | - foreach ($language as $key => $value){ |
|
| 98 | + foreach ($language as $key => $value) { |
|
| 99 | 99 | if ($value !== "") { |
| 100 | 100 | // Skip if the msgstr is empty |
| 101 | - fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n"); |
|
| 101 | + fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file, 0, -3))."\"][\"".$key."\"] = \"".$value."\";\n"); |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | // don't write \?\> - may append |
@@ -115,27 +115,27 @@ discard block |
||
| 115 | 115 | function parse_po_file($file) { |
| 116 | 116 | $translation_file = file($file); |
| 117 | 117 | $first_entry = true; |
| 118 | - $current_token_text=""; |
|
| 119 | - $current_token =""; |
|
| 118 | + $current_token_text = ""; |
|
| 119 | + $current_token = ""; |
|
| 120 | 120 | $parsing_token = false; |
| 121 | 121 | $parsing_text = false; |
| 122 | 122 | $size = sizeof($translation_file); |
| 123 | 123 | $output = array(); |
| 124 | - for ($i=0; $i<$size; $i++){ |
|
| 124 | + for ($i = 0; $i < $size; $i++) { |
|
| 125 | 125 | $entry = trim($translation_file[$i]); |
| 126 | 126 | //echo "line $i: $entry\n"; |
| 127 | - if (substr($entry, 0, 1)=="#") { |
|
| 127 | + if (substr($entry, 0, 1) == "#") { |
|
| 128 | 128 | continue; |
| 129 | 129 | } elseif (strpos($entry, "msgid") !== false) { |
| 130 | - if (!$first_entry){ |
|
| 130 | + if (!$first_entry) { |
|
| 131 | 131 | //If this is not the first, save the previous entry |
| 132 | - $output[$current_token]=$current_token_text; |
|
| 132 | + $output[$current_token] = $current_token_text; |
|
| 133 | 133 | } |
| 134 | 134 | $current_token = get_po_line($entry, $file); |
| 135 | - $current_token_text=""; |
|
| 135 | + $current_token_text = ""; |
|
| 136 | 136 | $parsing_token = true; |
| 137 | 137 | $parsing_text = false; |
| 138 | - $first_entry=false; |
|
| 138 | + $first_entry = false; |
|
| 139 | 139 | } elseif (strpos($entry, "msgstr") !== false) { |
| 140 | 140 | $current_token_text = get_po_line($entry, $file); |
| 141 | 141 | $parsing_token = false; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | // Get the last token |
| 151 | 151 | // |
| 152 | - if ($current_token && $current_token_text){ |
|
| 152 | + if ($current_token && $current_token_text) { |
|
| 153 | 153 | $output[$current_token] = $current_token_text; |
| 154 | 154 | } |
| 155 | 155 | return $output; |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | // Returns the contents of a line (ie removes "" from start and end) |
| 160 | 160 | // |
| 161 | 161 | function get_po_line($line, $file) { |
| 162 | - $start = strpos($line, '"')+1; |
|
| 162 | + $start = strpos($line, '"') + 1; |
|
| 163 | 163 | $stop = strrpos($line, '"'); |
| 164 | - $x = substr($line, $start, $stop-$start); |
|
| 164 | + $x = substr($line, $start, $stop - $start); |
|
| 165 | 165 | $n = preg_match("/[^\\\\]\"/", $x); |
| 166 | 166 | if ($n) { |
| 167 | 167 | echo "ERROR - MISMATCHED QUOTES IN $file: $line\n"; |
@@ -180,11 +180,11 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | // Find the string in the user's language |
| 182 | 182 | // |
| 183 | - foreach ($languages_in_use as $language){ |
|
| 183 | + foreach ($languages_in_use as $language) { |
|
| 184 | 184 | if (isset($language_lookup_array[$language][$text])) { |
| 185 | 185 | $text = $language_lookup_array[$language][$text]; |
| 186 | 186 | break; |
| 187 | - } else if ($language=="en"){ |
|
| 187 | + } else if ($language == "en") { |
|
| 188 | 188 | // This language is defined in the code and is always available |
| 189 | 189 | break; |
| 190 | 190 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | // Replace relevant substrings with given arguments. |
| 194 | 194 | // Use strtr to avoid problems if an argument contains %n. |
| 195 | 195 | $replacements = array(); |
| 196 | - for ($i=1; $i<func_num_args(); $i++){ |
|
| 196 | + for ($i = 1; $i < func_num_args(); $i++) { |
|
| 197 | 197 | $replacements["%".$i] = func_get_arg($i); |
| 198 | 198 | } |
| 199 | 199 | |
@@ -210,14 +210,14 @@ discard block |
||
| 210 | 210 | return $text; |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | -function language_log($message, $loglevel=0) { |
|
| 213 | +function language_log($message, $loglevel = 0) { |
|
| 214 | 214 | global $lang_log_level; |
| 215 | 215 | $msg = ""; |
| 216 | - if ($loglevel==0) $msg = "[ Debug ]"; |
|
| 217 | - if ($loglevel==1) $msg = "[ Warning ]"; |
|
| 218 | - if ($loglevel==2) $msg = "[ CRITICAL ]"; |
|
| 216 | + if ($loglevel == 0) $msg = "[ Debug ]"; |
|
| 217 | + if ($loglevel == 1) $msg = "[ Warning ]"; |
|
| 218 | + if ($loglevel == 2) $msg = "[ CRITICAL ]"; |
|
| 219 | 219 | |
| 220 | - if ($loglevel >= $lang_log_level){ |
|
| 220 | + if ($loglevel >= $lang_log_level) { |
|
| 221 | 221 | echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n"; |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | // (by looking at cookies and browser settings) |
| 227 | 227 | // cookies have highest priority. |
| 228 | 228 | |
| 229 | -if (isset($_COOKIE['lang'])){ |
|
| 229 | +if (isset($_COOKIE['lang'])) { |
|
| 230 | 230 | $language_string = $_COOKIE['lang'].","; |
| 231 | 231 | } else { |
| 232 | 232 | $language_string = ''; |
@@ -257,10 +257,10 @@ discard block |
||
| 257 | 257 | // Loop over languages that the client requests |
| 258 | 258 | // |
| 259 | 259 | $size = sizeof($client_languages); |
| 260 | -for ($i=0; $i<$size; $i++) { |
|
| 261 | - if ((strlen($client_languages[$i])>2) |
|
| 260 | +for ($i = 0; $i < $size; $i++) { |
|
| 261 | + if ((strlen($client_languages[$i]) > 2) |
|
| 262 | 262 | && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-") |
| 263 | - ){ |
|
| 263 | + ) { |
|
| 264 | 264 | // If this is defined as primary-secondary, represent it as xx_YY |
| 265 | 265 | // |
| 266 | 266 | $language = substr( |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | // if main language is english, look no further |
| 281 | 281 | // |
| 282 | - if ((count($languages_in_use)==0) && ($language == 'en' || $language2 == 'en')) { |
|
| 282 | + if ((count($languages_in_use) == 0) && ($language == 'en' || $language2 == 'en')) { |
|
| 283 | 283 | break; |
| 284 | 284 | } |
| 285 | 285 | |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | // |
| 288 | 288 | $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc"; |
| 289 | 289 | if (file_exists($file_name)) { |
| 290 | - if (!in_array($language, $languages_in_use)){ |
|
| 290 | + if (!in_array($language, $languages_in_use)) { |
|
| 291 | 291 | require_once($file_name); |
| 292 | 292 | $languages_in_use[] = $language; |
| 293 | 293 | } |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | if ($language2) { |
| 296 | 296 | $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc"; |
| 297 | 297 | if (file_exists($file_name)) { |
| 298 | - if (!in_array($language2, $languages_in_use)){ |
|
| 298 | + if (!in_array($language2, $languages_in_use)) { |
|
| 299 | 299 | require_once($file_name); |
| 300 | 300 | $languages_in_use[] = $language2; |
| 301 | 301 | } |
@@ -303,6 +303,6 @@ discard block |
||
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | -$GLOBALS['languages_in_use'] = $languages_in_use; // for Drupal |
|
| 306 | +$GLOBALS['languages_in_use'] = $languages_in_use; // for Drupal |
|
| 307 | 307 | |
| 308 | 308 | ?> |
@@ -259,10 +259,10 @@ |
||
| 259 | 259 | // "[vbox|5.0.0|1|1]", where now two additional flags give information about |
| 260 | 260 | // hardware virtualization support. Older clients may have the old-style |
| 261 | 261 | // serialnum in the DB despite the server being upgraded. |
| 262 | -function vbox_desc($x){ |
|
| 263 | - if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/",$x,$matches)){ |
|
| 262 | +function vbox_desc($x) { |
|
| 263 | + if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/",$x,$matches)) { |
|
| 264 | 264 | $desc = "Virtualbox (".$matches[1].") ".tra("installed"); |
| 265 | - if (sizeof($matches)>2){ |
|
| 265 | + if (sizeof($matches)>2) { |
|
| 266 | 266 | if ($matches[3]=="1" and $matches[4]=="1") { |
| 267 | 267 | return $desc.tra(", CPU has hardware virtualization support and it is enabled"); |
| 268 | 268 | } elseif ($matches[3]=="1" and $matches[4]=="0") { |
@@ -32,12 +32,12 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | function sched_log_name($x) { |
| 34 | 34 | if ($x == 0) return "NO_SUCH_LOG"; |
| 35 | - return gmdate('Y-m-d_H/Y-m-d_H:i', $x) . ".txt"; |
|
| 35 | + return gmdate('Y-m-d_H/Y-m-d_H:i', $x).".txt"; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | function sched_log_link($x) { |
| 39 | 39 | if (file_exists("sched_logs")) { |
| 40 | - return "<a href=\"../sched_logs/" . sched_log_name($x) . "\">" . time_str($x) . "</a>"; |
|
| 40 | + return "<a href=\"../sched_logs/".sched_log_name($x)."\">".time_str($x)."</a>"; |
|
| 41 | 41 | } else { |
| 42 | 42 | return time_str($x); |
| 43 | 43 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | function location_form($host) { |
| 47 | 47 | $none = "selected"; |
| 48 | - $h=$w=$s=$m=""; |
|
| 48 | + $h = $w = $s = $m = ""; |
|
| 49 | 49 | if ($host->venue == "home") $h = "selected"; |
| 50 | 50 | if ($host->venue == "work") $w = "selected"; |
| 51 | 51 | if ($host->venue == "school") $s = "selected"; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | row2(tra("Product name"), $host->product_name); |
| 100 | 100 | } |
| 101 | 101 | $x = $host->timezone/3600; |
| 102 | - if ($x >= 0) $x="+$x"; |
|
| 102 | + if ($x >= 0) $x = "+$x"; |
|
| 103 | 103 | row2(tra("Local Standard Time"), tra("UTC %1 hours", $x)); |
| 104 | 104 | } else { |
| 105 | 105 | $owner = BoincUser::lookup_id($host->userid); |
@@ -259,15 +259,15 @@ discard block |
||
| 259 | 259 | // "[vbox|5.0.0|1|1]", where now two additional flags give information about |
| 260 | 260 | // hardware virtualization support. Older clients may have the old-style |
| 261 | 261 | // serialnum in the DB despite the server being upgraded. |
| 262 | -function vbox_desc($x){ |
|
| 263 | - if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/",$x,$matches)){ |
|
| 262 | +function vbox_desc($x) { |
|
| 263 | + if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/", $x, $matches)) { |
|
| 264 | 264 | $desc = "Virtualbox (".$matches[1].") ".tra("installed"); |
| 265 | - if (sizeof($matches)>2){ |
|
| 266 | - if ($matches[3]=="1" and $matches[4]=="1") { |
|
| 265 | + if (sizeof($matches) > 2) { |
|
| 266 | + if ($matches[3] == "1" and $matches[4] == "1") { |
|
| 267 | 267 | return $desc.tra(", CPU has hardware virtualization support and it is enabled"); |
| 268 | - } elseif ($matches[3]=="1" and $matches[4]=="0") { |
|
| 268 | + } elseif ($matches[3] == "1" and $matches[4] == "0") { |
|
| 269 | 269 | return $desc.tra(", CPU has hardware virtualization support but it is disabled"); |
| 270 | - } elseif ($matches[3]=="0") { |
|
| 270 | + } elseif ($matches[3] == "0") { |
|
| 271 | 271 | return $desc.tra(", CPU does not have hardware virtualization support"); |
| 272 | 272 | } |
| 273 | 273 | } else { |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | // Given string of the form [BOINC|vers][type|model|count|RAM|driver-vers][vbox|vers], |
| 282 | 282 | // return a human-readable version of the GPU info |
| 283 | 283 | // |
| 284 | -function gpu_desc($x, $detail=true) { |
|
| 284 | +function gpu_desc($x, $detail = true) { |
|
| 285 | 285 | $descs = explode("]", $x); |
| 286 | 286 | array_pop($descs); |
| 287 | 287 | $str = ""; |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | if ($d[0] == "vbox") continue; |
| 294 | 294 | if (count($d) < 4) continue; |
| 295 | 295 | if ($str) $str .= "<p>"; |
| 296 | - if ($d[2]!="" && $d[2]!="1") $str .= "[".$d[2]."] "; |
|
| 296 | + if ($d[2] != "" && $d[2] != "1") $str .= "[".$d[2]."] "; |
|
| 297 | 297 | if ($d[0] == "CUDA") { |
| 298 | 298 | $str .= "NVIDIA"; |
| 299 | 299 | } else if ($d[0] == "CAL") { |
@@ -500,14 +500,14 @@ discard block |
||
| 500 | 500 | if ($pos1 === false) return $x; |
| 501 | 501 | $pos2 = strpos($model, ']'); |
| 502 | 502 | if ($pos2 === false) return $x; |
| 503 | - $a = substr($model, $pos1+1, $pos2-$pos1-1); |
|
| 503 | + $a = substr($model, $pos1 + 1, $pos2 - $pos1 - 1); |
|
| 504 | 504 | $y = explode(" ", $a); |
| 505 | 505 | if (count($y) == 0) return $x; |
| 506 | 506 | if ($y[0] == "Family") { |
| 507 | 507 | $x->info = $a; |
| 508 | 508 | } else { |
| 509 | 509 | $x->arch = $y[0]; |
| 510 | - $x->info = substr($a, strlen($y[0])+1); |
|
| 510 | + $x->info = substr($a, strlen($y[0]) + 1); |
|
| 511 | 511 | } |
| 512 | 512 | return $x; |
| 513 | 513 | } |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | $avg_time = 0; |
| 597 | 597 | |
| 598 | 598 | $results = BoincResult::enum("hostid=$hostid order by received_time"); |
| 599 | - foreach($results as $result) { |
|
| 599 | + foreach ($results as $result) { |
|
| 600 | 600 | if ($result->granted_credit <= 0) continue; |
| 601 | 601 | $total += $result->granted_credit; |
| 602 | 602 | |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | |
| 690 | 690 | function link_url($sort, $rev, $show_all) { |
| 691 | 691 | global $userid; |
| 692 | - $x = $userid ? "&userid=$userid":""; |
|
| 692 | + $x = $userid ? "&userid=$userid" : ""; |
|
| 693 | 693 | return "hosts_user.php?sort=$sort&rev=$rev&show_all=$show_all$x"; |
| 694 | 694 | } |
| 695 | 695 | |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | function show_user_hosts($userid, $private, $show_all, $sort, $rev) { |
| 766 | - $desc = false; // whether the sort order's default is decreasing |
|
| 766 | + $desc = false; // whether the sort order's default is decreasing |
|
| 767 | 767 | switch ($sort) { |
| 768 | 768 | case "total_credit": $sort_clause = "total_credit"; $desc = true; break; |
| 769 | 769 | case "expavg_credit": $sort_clause = "expavg_credit"; $desc = true; break; |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | more_or_less($sort, $rev, $show_all); |
| 787 | 787 | |
| 788 | 788 | $now = time(); |
| 789 | - $old_hosts=0; |
|
| 789 | + $old_hosts = 0; |
|
| 790 | 790 | $i = 1; |
| 791 | 791 | $hosts = BoincHost::enum("userid=$userid order by $sort_clause"); |
| 792 | 792 | $any_product_name = false; |
@@ -798,9 +798,9 @@ discard block |
||
| 798 | 798 | } |
| 799 | 799 | user_host_table_start($private, $sort, $rev, $show_all, $any_product_name); |
| 800 | 800 | foreach ($hosts as $host) { |
| 801 | - $is_old=false; |
|
| 801 | + $is_old = false; |
|
| 802 | 802 | if (($now - $host->rpc_time) > 30*86400) { |
| 803 | - $is_old=true; |
|
| 803 | + $is_old = true; |
|
| 804 | 804 | $old_hosts++; |
| 805 | 805 | } |
| 806 | 806 | if (!$show_all && $is_old) continue; |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | } |
| 810 | 810 | end_table(); |
| 811 | 811 | |
| 812 | - if ($old_hosts>0) { |
|
| 812 | + if ($old_hosts > 0) { |
|
| 813 | 813 | more_or_less($sort, $rev, $show_all); |
| 814 | 814 | } |
| 815 | 815 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | db_init(); |
| 27 | 27 | |
| 28 | 28 | function current_tally($voteid) { |
| 29 | - $query="select sum(yes) as ayes,count(id)-sum(yes) as nays from banishment_votes where voteid=".$voteid; |
|
| 29 | + $query = "select sum(yes) as ayes,count(id)-sum(yes) as nays from banishment_votes where voteid=".$voteid; |
|
| 30 | 30 | $result = _mysql_query($query); |
| 31 | 31 | $foobar = _mysql_fetch_object($result); |
| 32 | 32 | echo "<b>Current Tally</b> Ayes: ".$foobar->ayes." Nays: ".$foobar->nays."<p>"; |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | function vote_is_in_progress($userid) { |
| 37 | 37 | // check whether a vote is already ongoing |
| 38 | - $now=time(); |
|
| 39 | - $query="select count(id) as count from banishment_vote where userid=".$userid." and end_time>".$now; |
|
| 38 | + $now = time(); |
|
| 39 | + $query = "select count(id) as count from banishment_vote where userid=".$userid." and end_time>".$now; |
|
| 40 | 40 | $result = _mysql_query($query); |
| 41 | 41 | if (!$result) { |
| 42 | 42 | echo "Database error attempting to read banishment_vote table 1.<p>"; |
@@ -51,56 +51,56 @@ discard block |
||
| 51 | 51 | return $foobar->count; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -function start_vote($config,$logged_in_user,$user,$category,$reason) { |
|
| 55 | - $now=time(); |
|
| 56 | - $fin=$now+21600; |
|
| 54 | +function start_vote($config, $logged_in_user, $user, $category, $reason) { |
|
| 55 | + $now = time(); |
|
| 56 | + $fin = $now + 21600; |
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | - if ( vote_is_in_progress($user->id) !=0 ) { |
|
| 59 | + if (vote_is_in_progress($user->id) != 0) { |
|
| 60 | 60 | echo "A banishment vote is already underway for this user.<p>"; |
| 61 | 61 | return 0; |
| 62 | 62 | } |
| 63 | - $query="insert into banishment_vote (userid,modid,start_time,end_time) values (".$user->id.",".$logged_in_user->id.",".$now.",".$fin.")"; |
|
| 63 | + $query = "insert into banishment_vote (userid,modid,start_time,end_time) values (".$user->id.",".$logged_in_user->id.",".$now.",".$fin.")"; |
|
| 64 | 64 | $result = _mysql_query($query); |
| 65 | 65 | if (!$result) { |
| 66 | 66 | echo "Database error attempting to insert to banishment_vote table.<p>"; |
| 67 | 67 | return 0; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - $voteid=_mysql_insert_id(); |
|
| 71 | - $query="insert into banishment_votes (voteid,modid,time,yes) values (". $voteid .",". $logged_in_user->id .",". $now .",1)"; |
|
| 70 | + $voteid = _mysql_insert_id(); |
|
| 71 | + $query = "insert into banishment_votes (voteid,modid,time,yes) values (".$voteid.",".$logged_in_user->id.",".$now.",1)"; |
|
| 72 | 72 | $result = _mysql_query($query); |
| 73 | 73 | if (!$result) { |
| 74 | 74 | echo "Database error attempting to insert to banishment_votes table.<p>"; |
| 75 | 75 | return 0; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $query="update forum_preferences set banished_until=".$fin." where userid=".$user->id; |
|
| 78 | + $query = "update forum_preferences set banished_until=".$fin." where userid=".$user->id; |
|
| 79 | 79 | $result = _mysql_query($query); |
| 80 | 80 | |
| 81 | 81 | echo "Banishment vote started.<p><p>"; |
| 82 | 82 | current_tally($voteid); |
| 83 | - return send_banish_vote_email($user, 86400*14, $reason, $now+21600); |
|
| 83 | + return send_banish_vote_email($user, 86400*14, $reason, $now + 21600); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | -function vote_yes($config,$logged_in_user,$user) { |
|
| 87 | - $now=time(); |
|
| 86 | +function vote_yes($config, $logged_in_user, $user) { |
|
| 87 | + $now = time(); |
|
| 88 | 88 | // Check that a vote is underway. |
| 89 | - if (vote_is_in_progress($user->id)<1) { |
|
| 89 | + if (vote_is_in_progress($user->id) < 1) { |
|
| 90 | 90 | echo "No banishment vote is underway for this user.<p><p>"; |
| 91 | 91 | return 0; |
| 92 | 92 | } |
| 93 | 93 | // Find the voteid |
| 94 | - $query="select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now; |
|
| 94 | + $query = "select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now; |
|
| 95 | 95 | $result = _mysql_query($query); |
| 96 | 96 | $foobar = _mysql_fetch_object($result); |
| 97 | 97 | if (!$foobar) { |
| 98 | 98 | echo "Database error attempting to read banishment_vote table.<p>"; |
| 99 | 99 | return 0; |
| 100 | 100 | } |
| 101 | - $voteid=$foobar->voteid; |
|
| 101 | + $voteid = $foobar->voteid; |
|
| 102 | 102 | // Check whether mod has voted already. |
| 103 | - $query="select count(id) as count from banishment_votes where voteid=".$voteid." and modid=".$logged_in_user->id; |
|
| 103 | + $query = "select count(id) as count from banishment_votes where voteid=".$voteid." and modid=".$logged_in_user->id; |
|
| 104 | 104 | $result = _mysql_query($query); |
| 105 | 105 | $foobar = _mysql_fetch_object($result); |
| 106 | 106 | if (!$foobar) { |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | return 0; |
| 114 | 114 | } |
| 115 | 115 | // insert the vote |
| 116 | - $query="insert into banishment_votes (voteid,modid,time,yes) values (" . $voteid .",". $logged_in_user->id .",". $now .",1)"; |
|
| 116 | + $query = "insert into banishment_votes (voteid,modid,time,yes) values (".$voteid.",".$logged_in_user->id.",".$now.",1)"; |
|
| 117 | 117 | $result = _mysql_query($query); |
| 118 | 118 | if (!$result) { |
| 119 | 119 | echo "Database error attempting to insert to banishment_votes table.<p>"; |
@@ -124,24 +124,24 @@ discard block |
||
| 124 | 124 | return 1; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | -function vote_no($config,$logged_in_user,$user) { |
|
| 127 | +function vote_no($config, $logged_in_user, $user) { |
|
| 128 | 128 | // Check that a vote is underway. |
| 129 | - $now=time(); |
|
| 130 | - if (vote_is_in_progress($user->id)<1) { |
|
| 129 | + $now = time(); |
|
| 130 | + if (vote_is_in_progress($user->id) < 1) { |
|
| 131 | 131 | echo "No banishment vote is underway for this user.<p>"; |
| 132 | 132 | return 0; |
| 133 | 133 | } |
| 134 | 134 | // Find the voteid |
| 135 | - $query="select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now; |
|
| 135 | + $query = "select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now; |
|
| 136 | 136 | $result = _mysql_query($query); |
| 137 | 137 | $foobar = _mysql_fetch_object($result); |
| 138 | 138 | if (!$foobar) { |
| 139 | 139 | echo "Database error attempting to read banishment_vote table.<p>"; |
| 140 | 140 | return 0; |
| 141 | 141 | } |
| 142 | - $voteid=$foobar->voteid; |
|
| 142 | + $voteid = $foobar->voteid; |
|
| 143 | 143 | // Check whether mod has voted already. |
| 144 | - $query="select count(id) as count from banishment_votes where voteid=".$voteid ." and modid=".$logged_in_user->id; |
|
| 144 | + $query = "select count(id) as count from banishment_votes where voteid=".$voteid." and modid=".$logged_in_user->id; |
|
| 145 | 145 | $result = _mysql_query($query); |
| 146 | 146 | $foobar = _mysql_fetch_object($result); |
| 147 | 147 | if (!$foobar) { |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | return 0; |
| 155 | 155 | } |
| 156 | 156 | // insert the vote |
| 157 | - $query="insert into banishment_votes (voteid,modid,time,yes) values (" . $voteid .",". $logged_in_user->id .",". $now .",0)"; |
|
| 157 | + $query = "insert into banishment_votes (voteid,modid,time,yes) values (".$voteid.",".$logged_in_user->id.",".$now.",0)"; |
|
| 158 | 158 | $result = _mysql_query($query); |
| 159 | 159 | if (!$result) { |
| 160 | 160 | echo "Database error attempting to insert to banishment_votes table.<p>"; |
@@ -31,18 +31,18 @@ discard block |
||
| 31 | 31 | global $app_name,$log; |
| 32 | 32 | |
| 33 | 33 | $timestamp = date("Y-m-d H:i",time()); |
| 34 | - // read the list of template filenames |
|
| 35 | - // |
|
| 36 | - $files = file("../../tree_threader_template_files"); |
|
| 37 | - if ($files === false) { |
|
| 34 | + // read the list of template filenames |
|
| 35 | + // |
|
| 36 | + $files = file("../../tree_threader_template_files"); |
|
| 37 | + if ($files === false) { |
|
| 38 | 38 | fwrite($log,"$timestamp\ttemplate file tree_threader_template_files\n"); |
| 39 | 39 | error("no templates file"); |
| 40 | 40 | |
| 41 | 41 | } |
| 42 | - $njobs = sizeof($files); |
|
| 43 | - $now = time(); |
|
| 42 | + $njobs = sizeof($files); |
|
| 43 | + $now = time(); |
|
| 44 | 44 | $batch_id = BoincBatch::insert( |
| 45 | - "(user_id, create_time, njobs, name, app_id, state) values ($user->id, $now, $njobs, 'tree_threader batch', $app->id, ".BATCH_STATE_IN_PROGRESS.")" |
|
| 45 | + "(user_id, create_time, njobs, name, app_id, state) values ($user->id, $now, $njobs, 'tree_threader batch', $app->id, ".BATCH_STATE_IN_PROGRESS.")" |
|
| 46 | 46 | ); |
| 47 | 47 | if (!$batch_id) { |
| 48 | 48 | $log_msg = "$timestamp\tfailed to create batch for user $user->id\n"; |
@@ -68,20 +68,20 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | $i = 1; |
| 71 | - foreach ($files as $file) { |
|
| 71 | + foreach ($files as $file) { |
|
| 72 | 72 | $file = trim($file); |
| 73 | 73 | $wu_name = "ICT_".$batch_id."_$i"; |
| 74 | 74 | |
| 75 | - $cmd = "cd ../..; ./bin/create_work --appname $app_name --batch $batch_id --wu_name $wu_name --wu_template templates/ICT_in --result_template templates/ICT_out $seq_fname $file"; |
|
| 75 | + $cmd = "cd ../..; ./bin/create_work --appname $app_name --batch $batch_id --wu_name $wu_name --wu_template templates/ICT_in --result_template templates/ICT_out $seq_fname $file"; |
|
| 76 | 76 | fwrite($log, "$timestamp\t$cmd\n"); |
| 77 | 77 | system($cmd, $ret); |
| 78 | - if ($ret != 0) { |
|
| 78 | + if ($ret != 0) { |
|
| 79 | 79 | fwrite($log, "can not creat job $wu_name\n"); |
| 80 | - error("can't create job"); |
|
| 80 | + error("can't create job"); |
|
| 81 | 81 | } |
| 82 | 82 | $i++; |
| 83 | - } |
|
| 84 | - echo "<tt_reply>\n<batch_id>$batch_id</batch_id>\n</tt_reply>\n"; |
|
| 83 | + } |
|
| 84 | + echo "<tt_reply>\n<batch_id>$batch_id</batch_id>\n</tt_reply>\n"; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // Enumerate all the successfully completed WUs for this batch. |
@@ -93,51 +93,51 @@ discard block |
||
| 93 | 93 | function handle_get_output($r, $batch) { |
| 94 | 94 | global $log; |
| 95 | 95 | $timestamp = date("Y-m-d H:i",time()); |
| 96 | - $wus = BoincWorkUnit::enum("batch=$batch->id"); |
|
| 97 | - $outdir = "/tmp/treeThreader_result_".$batch->id; |
|
| 96 | + $wus = BoincWorkUnit::enum("batch=$batch->id"); |
|
| 97 | + $outdir = "/tmp/treeThreader_result_".$batch->id; |
|
| 98 | 98 | @mkdir($outdir); |
| 99 | - foreach ($wus as $wu) { |
|
| 100 | - if (!$wu->canonical_resultid) continue; |
|
| 101 | - $result = BoincResult::lookup_id($wu->canonical_resultid); |
|
| 102 | - if (!$result) continue; |
|
| 103 | - $paths = get_outfile_paths($result); |
|
| 104 | - if (sizeof($paths) < 1) continue; |
|
| 105 | - |
|
| 106 | - // there's only one output file |
|
| 107 | - // |
|
| 108 | - $path = $paths[0]; |
|
| 109 | - |
|
| 110 | - // unzip it into a directory in /tmp |
|
| 111 | - // |
|
| 112 | - $dir = "/tmp/$wu->name"; |
|
| 99 | + foreach ($wus as $wu) { |
|
| 100 | + if (!$wu->canonical_resultid) continue; |
|
| 101 | + $result = BoincResult::lookup_id($wu->canonical_resultid); |
|
| 102 | + if (!$result) continue; |
|
| 103 | + $paths = get_outfile_paths($result); |
|
| 104 | + if (sizeof($paths) < 1) continue; |
|
| 105 | + |
|
| 106 | + // there's only one output file |
|
| 107 | + // |
|
| 108 | + $path = $paths[0]; |
|
| 109 | + |
|
| 110 | + // unzip it into a directory in /tmp |
|
| 111 | + // |
|
| 112 | + $dir = "/tmp/$wu->name"; |
|
| 113 | 113 | @mkdir($dir); |
| 114 | - $cmd = "cd $dir; unzip -q $path"; |
|
| 115 | - system($cmd, $ret); |
|
| 116 | - if ($ret != 0) { |
|
| 117 | - error("can't unzip output file"); |
|
| 118 | - } |
|
| 119 | - $cmd = "cp $dir/Aln/* $outdir"; |
|
| 120 | - system($cmd, $ret); |
|
| 121 | - if ($ret != 0) { |
|
| 122 | - error("can't copy output files"); |
|
| 123 | - } |
|
| 114 | + $cmd = "cd $dir; unzip -q $path"; |
|
| 115 | + system($cmd, $ret); |
|
| 116 | + if ($ret != 0) { |
|
| 117 | + error("can't unzip output file"); |
|
| 118 | + } |
|
| 119 | + $cmd = "cp $dir/Aln/* $outdir"; |
|
| 120 | + system($cmd, $ret); |
|
| 121 | + if ($ret != 0) { |
|
| 122 | + error("can't copy output files"); |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | 125 | system("rm -rf $dir"); |
| 126 | - } |
|
| 127 | - |
|
| 128 | - $cmd = "zip -r -q $outdir $outdir"; |
|
| 129 | - system($cmd, $ret); |
|
| 130 | - if ($ret != $ret) { |
|
| 131 | - error("can't zip output files"); |
|
| 132 | - } |
|
| 133 | - $fname = "treeThreader_result_".$batch->id.".zip"; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + $cmd = "zip -r -q $outdir $outdir"; |
|
| 129 | + system($cmd, $ret); |
|
| 130 | + if ($ret != $ret) { |
|
| 131 | + error("can't zip output files"); |
|
| 132 | + } |
|
| 133 | + $fname = "treeThreader_result_".$batch->id.".zip"; |
|
| 134 | 134 | $treeThreader_dir="treeThreaderResult"; |
| 135 | 135 | if(!is_dir("../../download/$treeThreader_dir"))mkdir("../../download/$treeThreader_dir"); |
| 136 | - @symlink("/tmp/$fname", "../../download/$treeThreader_dir/$fname"); |
|
| 136 | + @symlink("/tmp/$fname", "../../download/$treeThreader_dir/$fname"); |
|
| 137 | 137 | system("rm -fr $outdir"); |
| 138 | 138 | $config = simplexml_load_string(file_get_contents("../../config.xml")); |
| 139 | 139 | $download_url = trim((string)$config->config->download_url); |
| 140 | - echo "<tt_reply>\n<url>$download_url/$treeThreader_dir/$fname</url>\n</tt_reply>\n"; |
|
| 140 | + echo "<tt_reply>\n<url>$download_url/$treeThreader_dir/$fname</url>\n</tt_reply>\n"; |
|
| 141 | 141 | $log_msg="$timestamp\tuser $batch->user_id downloads results for batch $batch->id : $download_url/$treeThreader_dir/$fname\n"; |
| 142 | 142 | fwrite($log, $log_msg); |
| 143 | 143 | } |
@@ -177,12 +177,12 @@ discard block |
||
| 177 | 177 | handle_submit($r, $user, $app); |
| 178 | 178 | break; |
| 179 | 179 | case 'get_output': |
| 180 | - $batch_id = (int)$r->batch_id; |
|
| 181 | - $batch = BoincBatch::lookup_id($batch_id); |
|
| 182 | - if (!$batch) error("no such batch"); |
|
| 183 | - if ($batch->user_id != $user->id) error("not owner of batch"); |
|
| 184 | - handle_get_output($r, $batch); |
|
| 185 | - break; |
|
| 180 | + $batch_id = (int)$r->batch_id; |
|
| 181 | + $batch = BoincBatch::lookup_id($batch_id); |
|
| 182 | + if (!$batch) error("no such batch"); |
|
| 183 | + if ($batch->user_id != $user->id) error("not owner of batch"); |
|
| 184 | + handle_get_output($r, $batch); |
|
| 185 | + break; |
|
| 186 | 186 | default: error("bad command"); |
| 187 | 187 | } |
| 188 | 188 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | display_errors(); |
| 19 | 19 | |
| 20 | 20 | $app_name = "treeThreader"; |
| 21 | -$log = fopen("/tmp/tt_job.log","a+"); |
|
| 21 | +$log = fopen("/tmp/tt_job.log", "a+"); |
|
| 22 | 22 | |
| 23 | 23 | function error($s) { |
| 24 | 24 | echo "<error>\n<message>$s</message>\n</error>\n"; |
@@ -26,14 +26,14 @@ discard block |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | function handle_submit($r, $user, $app) { |
| 29 | - global $app_name,$log; |
|
| 29 | + global $app_name, $log; |
|
| 30 | 30 | |
| 31 | - $timestamp = date("Y-m-d H:i",time()); |
|
| 31 | + $timestamp = date("Y-m-d H:i", time()); |
|
| 32 | 32 | // read the list of template filenames |
| 33 | 33 | // |
| 34 | 34 | $files = file("../../tree_threader_template_files"); |
| 35 | 35 | if ($files === false) { |
| 36 | - fwrite($log,"$timestamp\ttemplate file tree_threader_template_files\n"); |
|
| 36 | + fwrite($log, "$timestamp\ttemplate file tree_threader_template_files\n"); |
|
| 37 | 37 | error("no templates file"); |
| 38 | 38 | |
| 39 | 39 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | // |
| 91 | 91 | function handle_get_output($r, $batch) { |
| 92 | 92 | global $log; |
| 93 | - $timestamp = date("Y-m-d H:i",time()); |
|
| 93 | + $timestamp = date("Y-m-d H:i", time()); |
|
| 94 | 94 | $wus = BoincWorkUnit::enum("batch=$batch->id"); |
| 95 | 95 | $outdir = "/tmp/treeThreader_result_".$batch->id; |
| 96 | 96 | @mkdir($outdir); |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | error("can't zip output files"); |
| 130 | 130 | } |
| 131 | 131 | $fname = "treeThreader_result_".$batch->id.".zip"; |
| 132 | - $treeThreader_dir="treeThreaderResult"; |
|
| 133 | - if(!is_dir("../../download/$treeThreader_dir"))mkdir("../../download/$treeThreader_dir"); |
|
| 132 | + $treeThreader_dir = "treeThreaderResult"; |
|
| 133 | + if (!is_dir("../../download/$treeThreader_dir"))mkdir("../../download/$treeThreader_dir"); |
|
| 134 | 134 | @symlink("/tmp/$fname", "../../download/$treeThreader_dir/$fname"); |
| 135 | 135 | system("rm -fr $outdir"); |
| 136 | 136 | $config = simplexml_load_string(file_get_contents("../../config.xml")); |
| 137 | 137 | $download_url = trim((string)$config->config->download_url); |
| 138 | 138 | echo "<tt_reply>\n<url>$download_url/$treeThreader_dir/$fname</url>\n</tt_reply>\n"; |
| 139 | - $log_msg="$timestamp\tuser $batch->user_id downloads results for batch $batch->id : $download_url/$treeThreader_dir/$fname\n"; |
|
| 139 | + $log_msg = "$timestamp\tuser $batch->user_id downloads results for batch $batch->id : $download_url/$treeThreader_dir/$fname\n"; |
|
| 140 | 140 | fwrite($log, $log_msg); |
| 141 | 141 | } |
| 142 | 142 | |
@@ -25,17 +25,17 @@ |
||
| 25 | 25 | page_head(tra("Download BOINC add-on software")); |
| 26 | 26 | echo " |
| 27 | 27 | <p>" . |
| 28 | - tra("You can download applications in several categories.") ." |
|
| 28 | + tra("You can download applications in several categories.")." |
|
| 29 | 29 | <ul> |
| 30 | 30 | <li>". |
| 31 | - tra("These applications are not endorsed by %1 and you use them at your own risk.", PROJECT) ." |
|
| 31 | + tra("These applications are not endorsed by %1 and you use them at your own risk.", PROJECT)." |
|
| 32 | 32 | <li>" . |
| 33 | 33 | tra("We do not provide instructions for installing these applications. |
| 34 | 34 | However, the author may have provided some help on installing or uninstalling the application. |
| 35 | 35 | If this is not enough you should contact the author."). |
| 36 | 36 | tra("Instructions for installing and running BOINC are %1 here %2.", "<a href=https://boinc.berkeley.edu/download.php>", "</a>") |
| 37 | - . "<li>" . |
|
| 38 | - tra("This list is managed centrally at %1 the BOINC website %2.", "<a href=\"https://boinc.berkeley.edu/addons.php\">", "</a>") ." |
|
| 37 | + . "<li>". |
|
| 38 | + tra("This list is managed centrally at %1 the BOINC website %2.", "<a href=\"https://boinc.berkeley.edu/addons.php\">", "</a>")." |
|
| 39 | 39 | </ul> |
| 40 | 40 | "; |
| 41 | 41 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | start_table(); |
| 50 | 50 | |
| 51 | 51 | $get_reason = true; |
| 52 | -if (get_str('action')=="hide") { |
|
| 52 | +if (get_str('action') == "hide") { |
|
| 53 | 53 | //display input that selects reason |
| 54 | 54 | echo "<input type=hidden name=action value=hide>"; |
| 55 | 55 | row1(tra("Hide post")); |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | ) |
| 67 | 67 | ) |
| 68 | 68 | ); |
| 69 | -} elseif (get_str('action')=="move") { |
|
| 69 | +} elseif (get_str('action') == "move") { |
|
| 70 | 70 | row1(tra("Move post")); |
| 71 | 71 | echo "<input type=hidden name=action value=move>"; |
| 72 | 72 | row2(tra("Destination thread ID:"), "<input name=\"threadid\">"); |
| 73 | 73 | // TODO: display where to move the post as a dropdown instead of having to get ID |
| 74 | -} elseif (get_str('action')=="banish_user") { |
|
| 74 | +} elseif (get_str('action') == "banish_user") { |
|
| 75 | 75 | $userid = get_int('userid'); |
| 76 | 76 | $user = BoincUser::lookup_id($userid); |
| 77 | 77 | BoincForumPrefs::lookup($user); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | error_page("no user found"); |
| 80 | 80 | } |
| 81 | 81 | $x = $user->prefs->banished_until; |
| 82 | - if ($x>time()) { |
|
| 82 | + if ($x > time()) { |
|
| 83 | 83 | error_page(tra("User is already banished")); |
| 84 | 84 | } |
| 85 | 85 | row1(tra("Banish user")); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | echo "<input type=\"hidden\" name=\"id\" value=\"".$postid."\">\n"; |
| 98 | 98 | echo "<input type=\"hidden\" name=\"userid\" value=\"".$userid."\">\n"; |
| 99 | 99 | echo "<input type=\"hidden\" name=\"confirmed\" value=\"yes\">\n"; |
| 100 | -} elseif (get_str('action')=="delete") { |
|
| 100 | +} elseif (get_str('action') == "delete") { |
|
| 101 | 101 | echo "<input type=hidden name=action value=delete>"; |
| 102 | 102 | row2( |
| 103 | 103 | "Are you sure want to delete this post? This cannot be undone.", |