Index: trunk/extensions/Storyboard/storyboard.sql |
— | — | @@ -1,16 +1,19 @@ |
2 | 2 | -- MySQL version of the database schema for the Storyboard extension. |
3 | 3 | |
4 | 4 | CREATE TABLE /*$wgDBprefix*/storyboard ( |
5 | | - story_id INT(8) unsigned NOT NULL auto_increment PRIMARY KEY, |
6 | | - story_author_id INT unsigned NULL, |
7 | | - story_author_name VARCHAR(255) NULL, |
8 | | - story_hit_count INT(8) unsigned NOT NULL, |
9 | | - story_title VARCHAR(255) NOT NULL, |
10 | | - story_text MEDIUMBLOB NULL, |
11 | | - story_modified CHAR(14) binary NOT NULL default '', |
12 | | - story_created CHAR(14) binary NOT NULL default '', |
13 | | - story_is_published TINYINT NOT NULL default '0', |
14 | | - story_is_hidden TINYINT NOT NULL default '0' |
| 5 | + story_id INT(8) unsigned NOT NULL auto_increment PRIMARY KEY, |
| 6 | + story_author_id INT unsigned NULL, |
| 7 | + story_author_name VARCHAR(100) NOT NULL, |
| 8 | + story_author_location VARCHAR(150) NOT NULL, |
| 9 | + story_author_occupation VARCHAR(100) NOT NULL, |
| 10 | + story_author_image VARCHAR(50) NULL, -- TODO: find out if this is an acceptible way to refer to an image |
| 11 | + story_hit_count INT(8) unsigned NOT NULL, |
| 12 | + story_title VARCHAR(255) NOT NULL, |
| 13 | + story_text MEDIUMBLOB NOT NULL, |
| 14 | + story_modified CHAR(14) binary NOT NULL default '', |
| 15 | + story_created CHAR(14) binary NOT NULL default '', |
| 16 | + story_is_published TINYINT NOT NULL default '0', |
| 17 | + story_is_hidden TINYINT NOT NULL default '0' |
15 | 18 | ) /*$wgDBTableOptions*/; |
16 | 19 | |
17 | 20 | CREATE INDEX story_published_modified ON /*$wgDBprefix*/storyboard (story_is_published, story_modified); |
Index: trunk/extensions/Storyboard/storyboard.pg.sql |
— | — | @@ -1,4 +1,5 @@ |
2 | 2 | -- Postgres version of the database schema for the Storyboard extension. |
| 3 | +-- TODO: update to equivalent of latest MySQL sql |
3 | 4 | |
4 | 5 | BEGIN; |
5 | 6 | |
Index: trunk/extensions/Storyboard/tags/Storysubmission/Storysubmission_body.php |
— | — | @@ -23,11 +23,9 @@ |
24 | 24 | public static function render( $input, $args, $parser, $frame ) { |
25 | 25 | wfProfileIn( __METHOD__ ); |
26 | 26 | |
27 | | - global $wgRequest; |
| 27 | + global $wgRequest, $wgUser; |
28 | 28 | |
29 | | - var_dump($wgRequest->wasPosted()); die(); |
30 | | - |
31 | | - if ( $wgRequest->wasPosted() ) { |
| 29 | + if ( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
32 | 30 | $output = self::doSubmissionAndGetResult(); |
33 | 31 | } else { |
34 | 32 | $output = self::getFrom( $parser, $args ); |
— | — | @@ -39,7 +37,7 @@ |
40 | 38 | } |
41 | 39 | |
42 | 40 | private static function getFrom( $parser, $args ) { |
43 | | - global $wgOut, $wgJsMimeType, $wgSc, $egStoryboardScriptPath, $egStorysubmissionWidth, $egStoryboardMaxStoryLen, $egStoryboardMinStoryLen; |
| 41 | + global $wgOut, $wgUser, $wgJsMimeType, $wgSc, $egStoryboardScriptPath, $egStorysubmissionWidth, $egStoryboardMaxStoryLen, $egStoryboardMinStoryLen; |
44 | 42 | |
45 | 43 | $wgOut->addStyle( $egStoryboardScriptPath . '/tags/Storysubmission/storysubmission.css' ); |
46 | 44 | $wgOut->addScriptFile( $egStoryboardScriptPath . '/tags/Storysubmission/storysubmission.js' ); |
— | — | @@ -50,7 +48,7 @@ |
51 | 49 | $maxLen = array_key_exists('maxlength', $args) && is_numeric($args['maxlength']) ? $args['maxlength'] : $egStoryboardMaxStoryLen; |
52 | 50 | $minLen = array_key_exists('minlength', $args) && is_numeric($args['minlength']) ? $args['minlength'] : $egStoryboardMinStoryLen; |
53 | 51 | |
54 | | - $submissionUrl = $parser->getTitle()->getLocalURL( '' ); // TODO: fix parameters |
| 52 | + $submissionUrl = $parser->getTitle()->getLocalURL( 'action=purge' ); // TODO: fix parameters |
55 | 53 | |
56 | 54 | $formBody = "<table width='$width'>"; |
57 | 55 | |
— | — | @@ -107,6 +105,8 @@ |
108 | 106 | |
109 | 107 | $formBody .= '</table>'; |
110 | 108 | |
| 109 | + $formBody .= Html::hidden( 'wpEditToken', $wgUser->editToken() ); |
| 110 | + |
111 | 111 | $formHtml = Html::rawElement( |
112 | 112 | 'form', |
113 | 113 | array( |
— | — | @@ -125,8 +125,13 @@ |
126 | 126 | return $formHtml . $formJs; |
127 | 127 | } |
128 | 128 | |
| 129 | + /** |
| 130 | + * Store the submitted story in the database, and return a page telling the user his story has been submitted. |
| 131 | + */ |
129 | 132 | private static function doSubmissionAndGetResult() { |
| 133 | + global $wgRequest, $wgUser; |
130 | 134 | |
| 135 | + |
131 | 136 | } |
132 | 137 | |
133 | 138 | } |
\ No newline at end of file |