Index: trunk/extensions/SemanticForms/specials/SF_CreateForm.php |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | } |
47 | 47 | |
48 | 48 | function doSpecialCreateForm() { |
49 | | - global $wgOut, $wgRequest, $wgUser, $sfgScriptPath, $wgContLang; |
| 49 | + global $wgOut, $wgRequest, $wgUser, $sfgScriptPath; |
50 | 50 | $db = wfGetDB( DB_SLAVE ); |
51 | 51 | |
52 | 52 | SFUtils::loadMessages(); |
— | — | @@ -53,7 +53,6 @@ |
54 | 54 | // Create Javascript to populate fields to let the user input |
55 | 55 | // parameters for the field, based on the input type selected in the |
56 | 56 | // dropdown. |
57 | | - global $wgUser; |
58 | 57 | $skin = $wgUser->getSkin(); |
59 | 58 | $url = $skin->makeSpecialUrl( 'CreateForm', "showinputtypeoptions=' + this.val() + '&formfield=' + this.attr('formfieldid') + '" ); |
60 | 59 | foreach ( $wgRequest->getValues() as $param => $value ) { |
— | — | @@ -205,10 +204,10 @@ |
206 | 205 | } |
207 | 206 | |
208 | 207 | $text = ' <form action="" method="post">' . "\n"; |
| 208 | + |
209 | 209 | // Set 'title' field, in case there's no URL niceness. |
210 | | - $mw_namespace_labels = $wgContLang->getNamespaces(); |
211 | | - $special_namespace = $mw_namespace_labels[NS_SPECIAL]; |
212 | | - $text .= "\t" . Xml::hidden( 'title', "$special_namespace:CreateForm" ) . "\n"; |
| 210 | + $cf = Title::makeTitleSafe( NS_SPECIAL, 'CreateForm' ); |
| 211 | + $text .= "\t" . Xml::hidden( 'title', SFUtils::titleURLString( $cf ) ) . "\n"; |
213 | 212 | $text .= ' <p>' . wfMsg( 'sf_createform_nameinput' ) . ' ' . wfMsg( 'sf_createform_nameinputdesc' ) . ' <input size=25 name="form_name" value="' . $form_name . '">'; |
214 | 213 | if ( ! empty( $form_name_error_str ) ) |
215 | 214 | $text .= ' ' . Xml::element( 'font', array( 'color' => 'red' ), $form_name_error_str ); |
Index: trunk/extensions/SemanticForms/specials/SF_CreateClass.php |
— | — | @@ -110,11 +110,6 @@ |
111 | 111 | |
112 | 112 | $datatype_labels = $smwgContLang->getDatatypeLabels(); |
113 | 113 | |
114 | | - // set 'title' as hidden field, in case there's no URL niceness |
115 | | - global $wgContLang; |
116 | | - $mw_namespace_labels = $wgContLang->getNamespaces(); |
117 | | - $special_namespace = $mw_namespace_labels[NS_SPECIAL]; |
118 | | - |
119 | 114 | // make links to all the other 'Create...' pages, in order to |
120 | 115 | // link to them at the top of the page |
121 | 116 | $sk = $wgUser->getSkin(); |
— | — | @@ -231,16 +226,12 @@ |
232 | 227 | 'onclick' => "addRowDynamic('$optionsStr')" |
233 | 228 | ) |
234 | 229 | ); |
235 | | - $text .= Xml::tags( 'p', null, $add_another_button ); |
| 230 | + $text .= Xml::tags( 'p', null, $add_another_button ) . "\n"; |
| 231 | + // Set 'title' as hidden field, in case there's no URL niceness |
| 232 | + $cc = Title::makeTitleSafe( NS_SPECIAL, 'CreateClass' ); |
| 233 | + $text .= Xml::hidden( 'title', SFUtils::titleURLString( $cc ) ) . "\n"; |
236 | 234 | $text .= Xml::element( 'input', |
237 | 235 | array( |
238 | | - 'type' => 'hidden', |
239 | | - 'name' => 'title', |
240 | | - 'value' => "$special_namespace:CreateClass", |
241 | | - ) |
242 | | - ); |
243 | | - $text .= Xml::element( 'input', |
244 | | - array( |
245 | 236 | 'type' => 'submit', |
246 | 237 | 'name' => 'save', |
247 | 238 | 'value' => $create_button_text |
Index: trunk/extensions/SemanticForms/specials/SF_CreateTemplate.php |
— | — | @@ -6,10 +6,6 @@ |
7 | 7 | * @author Yaron Koren |
8 | 8 | */ |
9 | 9 | |
10 | | -/** |
11 | | - * Protect against register_globals vulnerabilities. |
12 | | - * This line must be present before any global variable is referenced. |
13 | | - */ |
14 | 10 | if ( !defined( 'MEDIAWIKI' ) ) die(); |
15 | 11 | |
16 | 12 | class SFCreateTemplate extends SpecialPage { |
— | — | @@ -30,10 +26,11 @@ |
31 | 27 | public static function getAllPropertyNames() { |
32 | 28 | $all_properties = array(); |
33 | 29 | |
34 | | - // set limit on results - a temporary fix until SMW's |
| 30 | + // Set limit on results - we don't want a massive dropdown |
| 31 | + // of properties, if there are a lot of properties in this wiki. |
35 | 32 | // getProperties() functions stop requiring a limit |
36 | 33 | $options = new SMWRequestOptions(); |
37 | | - $options->limit = 10000; |
| 34 | + $options->limit = 500; |
38 | 35 | $used_properties = smwfGetStore()->getPropertiesSpecial( $options ); |
39 | 36 | |
40 | 37 | foreach ( $used_properties as $property ) { |
— | — | @@ -92,7 +89,7 @@ |
93 | 90 | } |
94 | 91 | |
95 | 92 | static function printCreateTemplateForm() { |
96 | | - global $wgOut, $wgRequest, $wgUser, $sfgScriptPath, $wgContLang; |
| 93 | + global $wgOut, $wgRequest, $wgUser, $sfgScriptPath; |
97 | 94 | |
98 | 95 | SFUtils::loadMessages(); |
99 | 96 | |
— | — | @@ -103,7 +100,8 @@ |
104 | 101 | $category = $wgRequest->getVal( 'category' ); |
105 | 102 | $cur_id = 1; |
106 | 103 | $fields = array(); |
107 | | - # cycle through the query values, setting the appropriate local variables |
| 104 | + // Cycle through the query values, setting the appropriate |
| 105 | + // local variables. |
108 | 106 | foreach ( $wgRequest->getValues() as $var => $val ) { |
109 | 107 | $var_elements = explode( "_", $var ); |
110 | 108 | // we only care about query variables of the form "a_b" |
— | — | @@ -148,10 +146,10 @@ |
149 | 147 | } |
150 | 148 | |
151 | 149 | $text .= ' <form action="" method="post">' . "\n"; |
| 150 | + |
152 | 151 | // set 'title' field, in case there's no URL niceness |
153 | | - $mw_namespace_labels = $wgContLang->getNamespaces(); |
154 | | - $special_namespace = $mw_namespace_labels[NS_SPECIAL]; |
155 | | - $text .= "\t" . '<input type="hidden" name="title" value="' . $special_namespace . ':CreateTemplate">' . "\n"; |
| 152 | + $ct = Title::makeTitleSafe( NS_SPECIAL, 'CreateTemplate' ); |
| 153 | + $text .= "\t" . Xml::hidden( 'title', SFUtils::titleURLString( $ct ) ) . "\n"; |
156 | 154 | $text .= "\t<p>" . wfMsg( 'sf_createtemplate_namelabel' ) . ' <input size="25" name="template_name" value="' . $template_name . '"> <font color="red">' . $template_name_error_str . '</font></p>' . "\n"; |
157 | 155 | $text .= "\t<p>" . wfMsg( 'sf_createtemplate_categorylabel' ) . ' <input size="25" name="category" value="' . $category . '"></p>' . "\n"; |
158 | 156 | $text .= "\t<fieldset>\n"; |