Index: trunk/extensions/SocialProfile/SystemGifts/SpecialSystemGiftManager.php |
— | — | @@ -79,6 +79,7 @@ |
80 | 80 | function displayGiftList() { |
81 | 81 | global $wgScriptPath; |
82 | 82 | $output = ''; // Prevent E_NOTICE |
| 83 | + $page = 0; |
83 | 84 | $per_page = 10; |
84 | 85 | $gifts = SystemGifts::getGiftList( $per_page, $page ); |
85 | 86 | if ( $gifts ) { |
— | — | @@ -104,11 +105,11 @@ |
105 | 106 | <table border="0" cellpadding="5" cellspacing="0" width="500"> |
106 | 107 | <tr> |
107 | 108 | <td width="200" class="view-form">' . wfMsg( 'ga-giftname' ) . '</td> |
108 | | - <td width="695"><input type="text" size="45" class="createbox" name="gift_name" value="' . $gift['gift_name'] . '"/></td> |
| 109 | + <td width="695"><input type="text" size="45" class="createbox" name="gift_name" value="' . ( isset( $gift['gift_name'] ) ? $gift['gift_name'] : '' ) . '"/></td> |
109 | 110 | </tr> |
110 | 111 | <tr> |
111 | 112 | <td width="200" class="view-form" valign="top">' . wfMsg( 'ga-giftdesc' ) . '</td> |
112 | | - <td width="695"><textarea class="createbox" name="gift_description" rows="2" cols="30">' . $gift['gift_description'] . '</textarea></td> |
| 113 | + <td width="695"><textarea class="createbox" name="gift_description" rows="2" cols="30">' . ( isset( $gift['gift_description'] ) ? $gift['gift_description'] : '' ) . '</textarea></td> |
113 | 114 | </tr> |
114 | 115 | <tr> |
115 | 116 | <td width="200" class="view-form">' . wfMsg( 'ga-gifttype' ) . '</td> |
— | — | @@ -116,30 +117,39 @@ |
117 | 118 | <select name="gift_category">'; |
118 | 119 | $g = new SystemGifts(); |
119 | 120 | foreach ( $g->categories as $category => $id ) { |
120 | | - $form .= '<option' . ( ( $gift['gift_category'] == $id ) ? ' selected="selected"' : '' ) . " value=\"{$id}\">{$category}</option>"; |
| 121 | + $sel = ''; |
| 122 | + if ( isset( $gift['gift_category'] ) && $gift['gift_category'] == $id ) { |
| 123 | + $sel = ' selected="selected"'; |
| 124 | + } |
| 125 | + $form .= '<option' . $sel . " value=\"{$id}\">{$category}</option>"; |
121 | 126 | } |
122 | 127 | $form .= '</select> |
123 | 128 | </td> |
124 | 129 | </tr> |
125 | 130 | <tr> |
126 | 131 | <td width="200" class="view-form">' . wfMsg( 'ga-threshold' ) . '</td> |
127 | | - <td width="695"><input type="text" size="25" class="createbox" name="gift_threshold" value="' . $gift['gift_threshold'] . '"/></td> |
| 132 | + <td width="695"><input type="text" size="25" class="createbox" name="gift_threshold" value="' . ( isset( $gift['gift_threshold'] ) ? $gift['gift_threshold'] : '' ) . '"/></td> |
128 | 133 | </tr>'; |
129 | 134 | |
130 | 135 | if ( $gift_id ) { |
131 | 136 | $gift_image = '<img src="' . $wgUploadPath . '/awards/' . SystemGifts::getGiftImage( $gift_id, 'l' ) . '" border="0" alt="gift" />'; |
132 | 137 | $form .= '<tr> |
133 | 138 | <td width="200" class="view-form" valign="top">' . wfMsg( 'ga-giftimage' ) . '</td> |
134 | | - <td width="695">' . $gift_image . ' |
135 | | - <a href="' . $wgScriptPath . '/index.php?title=Special:SystemGiftManagerLogo&gift_id=' . $gift_id . '">' . wfMsg( 'ga-img' ) . '</a> |
| 139 | + <td width="695">' . $gift_image . |
| 140 | + '<a href="' . $wgScriptPath . '/index.php?title=Special:SystemGiftManagerLogo&gift_id=' . $gift_id . '">' . wfMsg( 'ga-img' ) . '</a> |
136 | 141 | </td> |
137 | 142 | </tr>'; |
138 | 143 | } |
139 | 144 | |
| 145 | + if ( isset( $gift['gift_id'] ) ) { |
| 146 | + $button = wfMsg( 'edit' ); |
| 147 | + } else { |
| 148 | + $button = wfMsg( 'ga-create-gift' ); |
| 149 | + } |
140 | 150 | $form .= '<tr> |
141 | 151 | <td colspan="2"> |
142 | | - <input type="hidden" name="id" value="' . $gift['gift_id'] . '" /> |
143 | | - <input type="button" class="createbox" value="' . ( ( $gift['gift_id'] ) ? wfMsg( 'edit' ) : wfMsg( 'ga-create-gift' ) ) . '" size="20" onclick="document.gift.submit()" /> |
| 152 | + <input type="hidden" name="id" value="' . ( isset( $gift['gift_id'] ) ? $gift['gift_id'] : '' ) . '" /> |
| 153 | + <input type="button" class="createbox" value="' . $button . '" size="20" onclick="document.gift.submit()" /> |
144 | 154 | <input type="button" class="createbox" value="' . wfMsg( 'cancel' ) . '" size="20" onclick="history.go(-1)" /> |
145 | 155 | </td> |
146 | 156 | </tr> |
Index: trunk/extensions/SocialProfile/SystemGifts/TopAwards.php |
— | — | @@ -77,31 +77,29 @@ |
78 | 78 | $output .= '</div>'; |
79 | 79 | $output .= '<div class="top-awards">'; |
80 | 80 | |
81 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
82 | | - |
| 81 | + foreach ( $res as $row ) { |
83 | 82 | $user_name = $row->sg_user_name; |
84 | 83 | $user_id = $row->sg_user_id; |
85 | 84 | $avatar = new wAvatar( $user_id, 'm' ); |
86 | 85 | $top_gift = $row->top_gift; |
87 | 86 | $gift_name = number_format( $top_gift ) . " {$categories[$category_number][category_name]}" . ( ( $top_gift > 1 ) ? 's' : '' ) . " Milestone"; |
88 | 87 | |
89 | | - if ( $gift_name !== $gift_name_check ) { |
90 | | - $x = 1; |
91 | | - $output .= "<div class=\"top-award-title\"> |
92 | | - {$gift_name} |
93 | | - </div>"; |
94 | | - } else { |
95 | | - $x++; |
96 | | - } |
| 88 | + if ( $gift_name !== $gift_name_check ) { |
| 89 | + $x = 1; |
| 90 | + $output .= "<div class=\"top-award-title\"> |
| 91 | + {$gift_name} |
| 92 | + </div>"; |
| 93 | + } else { |
| 94 | + $x++; |
| 95 | + } |
97 | 96 | |
98 | | - $output .= "<div class=\"top-award\"> |
| 97 | + $output .= "<div class=\"top-award\"> |
99 | 98 | <span class=\"top-award-number\">{$x}.</span> |
100 | 99 | {$avatar->getAvatarURL()} |
101 | 100 | <a href=\"" . $wgScriptPath . "/index.php?title=User:{$row->sg_user_name}\">{$user_name}</a> |
102 | 101 | </div>"; |
103 | 102 | |
104 | | - $gift_name_check = $gift_name; |
105 | | - |
| 103 | + $gift_name_check = $gift_name; |
106 | 104 | } |
107 | 105 | |
108 | 106 | $output .= '</div> |
Index: trunk/extensions/SocialProfile/UserGifts/SpecialGiftManager.php |
— | — | @@ -118,7 +118,7 @@ |
119 | 119 | global $wgScriptPath; |
120 | 120 | wfLoadExtensionMessages( 'UserGifts' ); |
121 | 121 | $output = ''; // Prevent E_NOTICE |
122 | | - // FIXME: undefined variable page |
| 122 | + $page = 0; |
123 | 123 | $per_page = 10; |
124 | 124 | $gifts = Gifts::getManagedGiftList( $per_page, $page ); |
125 | 125 | if ( $gifts ) { |
— | — | @@ -150,14 +150,13 @@ |
151 | 151 | |
152 | 152 | $form .= '<form action="" method="post" enctype="multipart/form-data" name="gift">'; |
153 | 153 | $form .= '<table border="0" cellpadding="5" cellspacing="0" width="500">'; |
154 | | - // FIXME: undefined variable gift (twice) |
155 | 154 | $form .= '<tr> |
156 | 155 | <td width="200" class="view-form">' . wfMsg( 'g-gift-name' ) . '</td> |
157 | | - <td width="695"><input type="text" size="45" class="createbox" name="gift_name" value="' . $gift['gift_name'] . '"/></td> |
| 156 | + <td width="695"><input type="text" size="45" class="createbox" name="gift_name" value="' . ( isset( $gift['gift_name'] ) ? $gift['gift_name'] : '' ) . '"/></td> |
158 | 157 | </tr> |
159 | 158 | <tr> |
160 | 159 | <td width="200" class="view-form" valign="top">' . wfMsg( 'giftmanager-description' ) . '</td> |
161 | | - <td width="695"><textarea class="createbox" name="gift_description" rows="2" cols="30">' . $gift['gift_description'] . '</textarea></td> |
| 160 | + <td width="695"><textarea class="createbox" name="gift_description" rows="2" cols="30">' . ( isset( $gift['gift_description'] ) ? $gift['gift_description'] : '' ) . '</textarea></td> |
162 | 161 | </tr>'; |
163 | 162 | if ( $gift_id ) { |
164 | 163 | $creator = Title::makeTitle( NS_USER, $gift['creator_user_name'] ); |
— | — | @@ -186,21 +185,25 @@ |
187 | 186 | $gift_image = '<img src="' . $wgUploadPath . '/awards/' . Gifts::getGiftImage( $gift_id, 'l' ) . '" border="0" alt="' . wfMsg( 'g-gift' ) . '" />'; |
188 | 187 | $form .= '<tr> |
189 | 188 | <td width="200" class="view-form" valign="top">' . wfMsg( 'giftmanager-giftimage' ) . '</td> |
190 | | - <td width="695">' . $gift_image . ' |
191 | | - <p> |
| 189 | + <td width="695">' . $gift_image . |
| 190 | + '<p> |
192 | 191 | <a href="' . $wgScriptPath . '/index.php?title=Special:GiftManagerLogo&gift_id=' . $gift_id . '">' . wfMsg( 'giftmanager-image' ) . '</a> |
193 | 192 | </td> |
194 | 193 | </tr>'; |
195 | 194 | } |
196 | 195 | |
197 | | - // FIXME: undefined variable gift (twice) |
198 | | - $form .= ' |
199 | | - <tr> |
200 | | - <td colspan="2"> |
201 | | - <input type="hidden" name="id" value="' . $gift['gift_id'] . '" /> |
202 | | - <input type="button" class="createbox" value="' . ( ( $gift['gift_id'] ) ? wfMsg( 'edit' ) : wfMsg( 'g-create-gift' ) ) . '" size="20" onclick="document.gift.submit()" /> |
203 | | - <input type="button" class="createbox" value="' . wfMsg( 'cancel' ) . '" size="20" onclick="history.go(-1)" /> |
204 | | - </td> |
| 196 | + if ( isset( $gift['gift_id'] ) ) { |
| 197 | + $button = wfMsg( 'edit' ); |
| 198 | + } else { |
| 199 | + $button = wfMsg( 'g-create-gift' ); |
| 200 | + } |
| 201 | + |
| 202 | + $form .= '<tr> |
| 203 | + <td colspan="2"> |
| 204 | + <input type="hidden" name="id" value="' . ( isset( $gift['gift_id'] ) ? $gift['gift_id'] : '' ) . '" /> |
| 205 | + <input type="button" class="createbox" value="' . $button . '" size="20" onclick="document.gift.submit()" /> |
| 206 | + <input type="button" class="createbox" value="' . wfMsg( 'cancel' ) . '" size="20" onclick="history.go(-1)" /> |
| 207 | + </td> |
205 | 208 | </tr> |
206 | 209 | </table> |
207 | 210 | |