@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | require_once("../inc/boinc_db.inc"); |
| 22 | 22 | require_once("../inc/util.inc"); |
| 23 | 23 | |
| 24 | -define('CONSENT_TYPE_ENROLL','ENROLL'); |
|
| 24 | +define('CONSENT_TYPE_ENROLL', 'ENROLL'); |
|
| 25 | 25 | |
| 26 | 26 | function check_termsofuse() { |
| 27 | 27 | return defined('TERMSOFUSE_FILE') and file_exists(TERMSOFUSE_FILE); |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | $source, $ctime = 0 |
| 33 | 33 | ) { |
| 34 | 34 | $mys = BoincDb::escape_string($source); |
| 35 | - if ($ctime==0) { |
|
| 35 | + if ($ctime == 0) { |
|
| 36 | 36 | $mytime = $user->create_time; |
| 37 | 37 | } else { |
| 38 | 38 | $mytime = $ctime; |
| 39 | 39 | } |
| 40 | 40 | return BoincConsent::insert( |
| 41 | - "(userid, consent_type_id, consent_time, consent_flag, consent_not_required, source) " . |
|
| 41 | + "(userid, consent_type_id, consent_time, consent_flag, consent_not_required, source) ". |
|
| 42 | 42 | "values($user->id, $consent_type_id, $mytime, $consent_flag, $consent_not_required, '$mys')" |
| 43 | 43 | ); |
| 44 | 44 | |
@@ -65,10 +65,10 @@ discard block |
||
| 65 | 65 | // The integer is the consent_type_id- the id from consent_type table. |
| 66 | 66 | // If the boolean is FALSE, the integer returned is -1. |
| 67 | 67 | // |
| 68 | -function check_consent_type($name, $checkenabled=TRUE) { |
|
| 68 | +function check_consent_type($name, $checkenabled = TRUE) { |
|
| 69 | 69 | $name = BoincDb::escape_string($name); |
| 70 | 70 | $ct = BoincConsentType::lookup("shortname = '$name'"); |
| 71 | - if ($ct and ( !$checkenabled or ($ct->enabled)) ) { |
|
| 71 | + if ($ct and (!$checkenabled or ($ct->enabled))) { |
|
| 72 | 72 | return array(TRUE, $ct->id); |
| 73 | 73 | } |
| 74 | 74 | return array(FALSE, -1); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | // You should have received a copy of the GNU Lesser General Public License |
| 17 | 17 | // along with BOINC. If not, see <http://www.gnu.org/licenses/>. |
| 18 | 18 | |
| 19 | -NOT FINISHED. DON'T USE |
|
| 19 | +NOT FINISHED.DON'T USE |
|
| 20 | 20 | |
| 21 | 21 | require 'openid.php'; |
| 22 | 22 | include_once("../inc/boinc_db.inc"); |
@@ -26,14 +26,14 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | function show_error($str) { |
| 28 | 28 | page_head("Can't create account"); |
| 29 | - echo "$str<br>\n"; |
|
| 29 | + echo "$str < br > \n"; |
|
| 30 | 30 | page_tail(); |
| 31 | 31 | exit(); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | try { |
| 35 | 35 | $openid = new LightOpenID; |
| 36 | - echo "<pre>"; |
|
| 36 | + echo " < pre > "; |
|
| 37 | 37 | if(!$openid->mode) { |
| 38 | 38 | if(isset($_POST['openid_identifier'])) { |
| 39 | 39 | $openid->identity = $_POST['openid_identifier']; |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | $subset = sanitize_tags(get_str("subset")); |
| 28 | 28 | $venue = sanitize_tags(get_str("venue", true)); |
| 29 | 29 | $columns = get_int("cols", true); |
| 30 | -$c = $columns?"&cols=$columns":""; |
|
| 30 | +$c = $columns ? "&cols=$columns" : ""; |
|
| 31 | 31 | check_subset($subset); |
| 32 | 32 | if ($action) { |
| 33 | 33 | check_tokens($user->authenticator); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | error_page("Forums are disabled"); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | -if (user_can_create_thread($logged_in_user, $forum)=='no') { |
|
| 46 | +if (user_can_create_thread($logged_in_user, $forum) == 'no') { |
|
| 47 | 47 | error_page(tra("Only project admins may create a thread here. However, you may reply to existing threads.")); |
| 48 | 48 | } |
| 49 | 49 | check_post_access($logged_in_user, $forum); |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | $preview = post_str("preview", true); |
| 57 | 57 | $warning = null; |
| 58 | 58 | |
| 59 | -if ($content && $title && (!$preview)){ |
|
| 59 | +if ($content && $title && (!$preview)) { |
|
| 60 | 60 | if (post_str('add_signature', true)) { |
| 61 | - $add_signature = true; // set a flag and concatenate later |
|
| 62 | - } else { |
|
| 61 | + $add_signature = true; // set a flag and concatenate later |
|
| 62 | + } else { |
|
| 63 | 63 | $add_signature = false; |
| 64 | 64 | } |
| 65 | 65 | check_tokens($logged_in_user->authenticator); |
@@ -74,14 +74,14 @@ discard block |
||
| 74 | 74 | if (post_str('subscribe', true)) { |
| 75 | 75 | BoincSubscription::replace($logged_in_user->id, $thread->id); |
| 76 | 76 | } |
| 77 | - header('Location: forum_thread.php?id=' . $thread->id); |
|
| 77 | + header('Location: forum_thread.php?id='.$thread->id); |
|
| 78 | 78 | } else { |
| 79 | 79 | error_page("Can't create thread. $forum_error"); |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | -page_head(tra("Create new thread"),'','','', $bbcode_js); |
|
| 84 | +page_head(tra("Create new thread"), '', '', '', $bbcode_js); |
|
| 85 | 85 | show_forum_header($logged_in_user); |
| 86 | 86 | |
| 87 | 87 | if ($warning) { |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $submit_help = "<br /><font color=\"red\">".tra("Remember to add a title")."</font>"; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | -if ($force_title && $title){ |
|
| 125 | +if ($force_title && $title) { |
|
| 126 | 126 | row2( |
| 127 | 127 | tra("Title"), |
| 128 | 128 | sprintf( |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | row2( |
| 137 | 137 | tra("Title").$submit_help, |
| 138 | 138 | sprintf('<input type="text" class="form-control" name="title" value="%s">', |
| 139 | - $title?htmlspecialchars($title):'' |
|
| 139 | + $title ?htmlspecialchars($title) : '' |
|
| 140 | 140 | ), |
| 141 | 141 | null, FORUM_LH_PCT |
| 142 | 142 | ); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | sprintf( |
| 148 | 148 | '%s <textarea class="form-control" name="content" rows="12" cols="80">%s</textarea>', |
| 149 | 149 | $bbcode_html, |
| 150 | - $content?htmlspecialchars($content):'' |
|
| 150 | + $content ?htmlspecialchars($content) : '' |
|
| 151 | 151 | ), |
| 152 | 152 | null, FORUM_LH_PCT |
| 153 | 153 | ); |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | if (!$logged_in_user->prefs->no_signature_by_default) { |
| 156 | 156 | $enable_signature = 'checked="true"'; |
| 157 | 157 | } else { |
| 158 | - $enable_signature=''; |
|
| 158 | + $enable_signature = ''; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | if (is_news_forum($forum)) { |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $user = BoincUser::lookup_id($userid); |
| 30 | 30 | if (!$user) error_page('no such user'); |
| 31 | 31 | $offset = get_int("offset", true); |
| 32 | -if (!$offset) $offset=0; |
|
| 32 | +if (!$offset) $offset = 0; |
|
| 33 | 33 | $items_per_page = 20; |
| 34 | 34 | |
| 35 | 35 | $logged_in_user = get_logged_in_user(false); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | break; |
| 115 | 115 | } |
| 116 | 116 | if ($n >= $offset) { |
| 117 | - show_post_and_context($post, $thread, $forum, $options, $n+1); |
|
| 117 | + show_post_and_context($post, $thread, $forum, $options, $n + 1); |
|
| 118 | 118 | } |
| 119 | 119 | $n++; |
| 120 | 120 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | // See if "action" is provided - either through post or get |
| 39 | 39 | if (!post_str('action', true)) { |
| 40 | - if (!get_str('action', true)){ |
|
| 40 | + if (!get_str('action', true)) { |
|
| 41 | 41 | error_page(tra("You must specify an action...")); |
| 42 | 42 | } else { |
| 43 | 43 | $action = get_str('action'); |
@@ -47,10 +47,10 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $userid = post_int('userid'); |
| 50 | -$user=BoincUser::lookup_id($userid); |
|
| 50 | +$user = BoincUser::lookup_id($userid); |
|
| 51 | 51 | if (!$user) error_page('No such user'); |
| 52 | 52 | |
| 53 | -if ($action!="start"){ |
|
| 53 | +if ($action != "start") { |
|
| 54 | 54 | error_page("Unknown action"); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | $mod_category = tra("Other"); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | -if (post_str('reason', true)){ |
|
| 70 | - start_vote($config,$logged_in_user,$user, $mod_category,post_str("reason")); |
|
| 69 | +if (post_str('reason', true)) { |
|
| 70 | + start_vote($config, $logged_in_user, $user, $mod_category, post_str("reason")); |
|
| 71 | 71 | } else { |
| 72 | - start_vote($config,$logged_in_user,$user, $mod_category,"None given"); |
|
| 72 | + start_vote($config, $logged_in_user, $user, $mod_category, "None given"); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | ?> |
@@ -30,6 +30,6 @@ |
||
| 30 | 30 | if (!$thread) error_page('No such thread'); |
| 31 | 31 | $logged_in_user = get_logged_in_user(); |
| 32 | 32 | |
| 33 | -$posts = get_thread_posts($threadid, 0,true); |
|
| 33 | +$posts = get_thread_posts($threadid, 0, true); |
|
| 34 | 34 | header("Location: forum_rate.php?choice=p&post=".$posts[0]->id); |
| 35 | 35 | ?> |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | start_table(); |
| 51 | 51 | |
| 52 | 52 | $get_reason = true; |
| 53 | -if (get_str('action')=="hide") { |
|
| 53 | +if (get_str('action') == "hide") { |
|
| 54 | 54 | //display input that selects reason |
| 55 | 55 | echo "<input type=hidden name=action value=hide>"; |
| 56 | 56 | row1(tra("Hide post")); |
@@ -67,12 +67,12 @@ discard block |
||
| 67 | 67 | ) |
| 68 | 68 | ) |
| 69 | 69 | ); |
| 70 | -} elseif (get_str('action')=="move") { |
|
| 70 | +} elseif (get_str('action') == "move") { |
|
| 71 | 71 | row1(tra("Move post")); |
| 72 | 72 | echo "<input type=hidden name=action value=move>"; |
| 73 | 73 | row2(tra("Destination thread ID:"), "<input name=\"threadid\">"); |
| 74 | 74 | // TODO: display where to move the post as a dropdown instead of having to get ID |
| 75 | -} elseif (get_str('action')=="banish_user") { |
|
| 75 | +} elseif (get_str('action') == "banish_user") { |
|
| 76 | 76 | $userid = get_int('userid'); |
| 77 | 77 | $user = BoincUser::lookup_id($userid); |
| 78 | 78 | if (!$user) { |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | BoincForumPrefs::lookup($user); |
| 82 | 82 | $x = $user->prefs->banished_until; |
| 83 | - if ($x>time()) { |
|
| 83 | + if ($x > time()) { |
|
| 84 | 84 | error_page(tra("User is already banished")); |
| 85 | 85 | } |
| 86 | 86 | row1(tra("Banish user")); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | echo "<input type=\"hidden\" name=\"id\" value=\"".$postid."\">\n"; |
| 99 | 99 | echo "<input type=\"hidden\" name=\"userid\" value=\"".$userid."\">\n"; |
| 100 | 100 | echo "<input type=\"hidden\" name=\"confirmed\" value=\"yes\">\n"; |
| 101 | -} elseif (get_str('action')=="delete") { |
|
| 101 | +} elseif (get_str('action') == "delete") { |
|
| 102 | 102 | echo "<input type=hidden name=action value=delete>"; |
| 103 | 103 | row2( |
| 104 | 104 | "Are you sure want to delete this post? This cannot be undone.", |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | // Optionally filters by forum, user, time, or hidden if specified. |
| 32 | 32 | // |
| 33 | 33 | function search_thread_titles( |
| 34 | - $keyword_list, $forum="", $user="", $time="", $limit=200, |
|
| 35 | - $sort_style=CREATE_TIME_NEW, $show_hidden = false |
|
| 36 | -){ |
|
| 37 | - $search_string="%"; |
|
| 34 | + $keyword_list, $forum = "", $user = "", $time = "", $limit = 200, |
|
| 35 | + $sort_style = CREATE_TIME_NEW, $show_hidden = false |
|
| 36 | +) { |
|
| 37 | + $search_string = "%"; |
|
| 38 | 38 | foreach ($keyword_list as $key => $word) { |
| 39 | 39 | $search_string .= BoincDb::escape_string($word)."%"; |
| 40 | 40 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | if (!$show_hidden) { |
| 52 | 52 | $query .= " and thread.hidden = 0"; |
| 53 | 53 | } |
| 54 | - switch($sort_style) { |
|
| 54 | + switch ($sort_style) { |
|
| 55 | 55 | case MODIFIED_NEW: |
| 56 | 56 | $query .= ' ORDER BY timestamp DESC'; |
| 57 | 57 | break; |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | // |
| 85 | 85 | function search_post_content( |
| 86 | 86 | $keyword_list, $forum, $user, $time, $limit, $sort_style, $show_hidden |
| 87 | -){ |
|
| 87 | +) { |
|
| 88 | 88 | $db = BoincDb::get(); |
| 89 | 89 | |
| 90 | - $search_string="%"; |
|
| 91 | - foreach ($keyword_list as $key => $word){ |
|
| 90 | + $search_string = "%"; |
|
| 91 | + foreach ($keyword_list as $key => $word) { |
|
| 92 | 92 | $search_string .= BoincDb::escape_string($word)."%"; |
| 93 | 93 | } |
| 94 | 94 | $optional_join = ""; |
@@ -100,20 +100,20 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | $query = "select post.* from ".$db->db_name.".post".$optional_join." where content like '".$search_string."'"; |
| 102 | 102 | if ($forum) { |
| 103 | - $query.=" and forum = $forum->id"; |
|
| 103 | + $query .= " and forum = $forum->id"; |
|
| 104 | 104 | } |
| 105 | 105 | if ($user) { |
| 106 | - $query.=" and post.user = $user->id "; |
|
| 106 | + $query .= " and post.user = $user->id "; |
|
| 107 | 107 | } |
| 108 | 108 | if ($time) { |
| 109 | - $query.=" and post.timestamp > $time"; |
|
| 109 | + $query .= " and post.timestamp > $time"; |
|
| 110 | 110 | } |
| 111 | 111 | if (!$show_hidden) { |
| 112 | 112 | $query .= " AND post.hidden = 0"; |
| 113 | 113 | } |
| 114 | - switch($sort_style) { |
|
| 114 | + switch ($sort_style) { |
|
| 115 | 115 | case VIEWS_MOST: |
| 116 | - $query.= ' ORDER BY views DESC'; |
|
| 116 | + $query .= ' ORDER BY views DESC'; |
|
| 117 | 117 | break; |
| 118 | 118 | case CREATE_TIME_NEW: |
| 119 | 119 | $query .= ' ORDER by post.timestamp desc'; |
@@ -128,13 +128,13 @@ discard block |
||
| 128 | 128 | $query .= ' ORDER BY post.timestamp DESC'; |
| 129 | 129 | break; |
| 130 | 130 | } |
| 131 | - $query.= " limit $limit"; |
|
| 131 | + $query .= " limit $limit"; |
|
| 132 | 132 | return BoincPost::enum_general($query); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | $logged_in_user = get_logged_in_user(false); |
| 136 | 136 | BoincForumPrefs::lookup($logged_in_user); |
| 137 | -if ($logged_in_user && $logged_in_user->prefs->privilege(S_MODERATOR)){ |
|
| 137 | +if ($logged_in_user && $logged_in_user->prefs->privilege(S_MODERATOR)) { |
|
| 138 | 138 | $show_hidden_posts = true; |
| 139 | 139 | } else { |
| 140 | 140 | $show_hidden_posts = false; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $search_max_time = post_int("search_max_time"); |
| 148 | 148 | $search_forum = post_int("search_forum"); |
| 149 | 149 | $search_sort = post_int("search_sort"); |
| 150 | -$search_list = explode(" ",$search_keywords); |
|
| 150 | +$search_list = explode(" ", $search_keywords); |
|
| 151 | 151 | if ($search_max_time) { |
| 152 | 152 | $min_timestamp = time() - ($search_max_time*3600*24); |
| 153 | 153 | } else { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | $limit = 100; |
| 158 | 158 | |
| 159 | -if ($search_forum==-1){ |
|
| 159 | +if ($search_forum == -1) { |
|
| 160 | 160 | $forum = null; |
| 161 | 161 | } else if ($search_forum) { |
| 162 | 162 | $forum = BoincForum::lookup_id($search_forum); |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | // Display the threads |
| 178 | 178 | // |
| 179 | -if (count($threads)){ |
|
| 180 | - echo "<h3>" . tra("Thread titles matching your query:") . "</h3>"; |
|
| 179 | +if (count($threads)) { |
|
| 180 | + echo "<h3>".tra("Thread titles matching your query:")."</h3>"; |
|
| 181 | 181 | start_table('table-striped'); |
| 182 | 182 | thread_list_header(); |
| 183 | - foreach ($threads as $thread){ |
|
| 183 | + foreach ($threads as $thread) { |
|
| 184 | 184 | if (!$show_hidden_posts) { |
| 185 | 185 | $u = BoincUser::lookup_id($thread->owner); |
| 186 | 186 | if ($u && is_banished($u)) continue; |
@@ -200,8 +200,8 @@ discard block |
||
| 200 | 200 | $show_hidden_posts |
| 201 | 201 | ); |
| 202 | 202 | |
| 203 | -if (count($posts)){ |
|
| 204 | - echo "<h3>" . tra("Messages matching your query:") . "</h3>"; |
|
| 203 | +if (count($posts)) { |
|
| 204 | + echo "<h3>".tra("Messages matching your query:")."</h3>"; |
|
| 205 | 205 | start_table('table-striped'); |
| 206 | 206 | row_heading_array(['Info', 'Post'], ['', 'width=70%']); |
| 207 | 207 | $n = 1; |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | end_table(); |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | -if (!count($threads) && !count($posts)){ |
|
| 231 | +if (!count($threads) && !count($posts)) { |
|
| 232 | 232 | echo "<p>".tra("Sorry, couldn't find anything matching your search query. You can try to broaden your search by using less words (or less specific words).")."</p> |
| 233 | 233 | <p>" |
| 234 | 234 | .tra("You can also %1 try the same search on Google. %2", |