Changeset 909
- Timestamp:
- 03/19/09 13:56:25 (14 years ago)
- Location:
- plugins/contribute
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/contribute/_admin.php
r893 r909 24 24 if (!defined('DC_CONTEXT_ADMIN')) {return;} 25 25 26 $_menu['Plugins']->addItem( ('Contribute'),26 $_menu['Plugins']->addItem(__('Contribute'), 27 27 'plugin.php?p=contribute', 28 28 'index.php?pf=contribute/icon.png', -
plugins/contribute/_define.php
r893 r909 28 28 /* Description*/ "Allow visitors to contribute to your blog", 29 29 /* Author */ "Moe (http://gniark.net/)", 30 /* Version */ '1.0-alpha 9',30 /* Version */ '1.0-alpha10', 31 31 /* Permissions */ 'admin' 32 32 ); -
plugins/contribute/_public.php
r893 r909 37 37 { 38 38 global $core; 39 40 if (!$core->blog->settings->contribute_active) {self::p404();} 39 40 $settings =& $core->blog->settings; 41 42 if (!$settings->contribute_active) {self::p404();} 41 43 42 44 $_ctx =& $GLOBALS['_ctx']; … … 68 70 69 71 if (($_ctx->contribute->mymeta->hasMeta()) 70 && ($ core->blog->settings->contribute_allow_mymeta === true))72 && ($settings->contribute_allow_mymeta === true)) 71 73 { 72 74 $mymeta_values = @unserialize(@base64_decode( 73 $ core->blog->settings->contribute_mymeta_values));75 $settings->contribute_mymeta_values)); 74 76 75 77 if (!is_array($mymeta_values)) {$mymeta_values = array();} … … 118 120 { 119 121 # default post 120 $default_post = $ core->blog->settings->contribute_default_post;122 $default_post = $settings->contribute_default_post; 121 123 if (is_int($default_post) && ($default_post > 0)) 122 124 { … … 188 190 # formats 189 191 # default format setting 190 $post->post_format = $ core->blog->settings->contribute_format;192 $post->post_format = $settings->contribute_format; 191 193 192 194 # contributor can choose the post format, 193 195 # it overrides the default format 194 if ($ core->blog->settings->contribute_format == '')196 if ($settings->contribute_format == '') 195 197 { 196 198 $_ctx->contribute->choose_format = true; … … 226 228 # current date 227 229 $post->post_dt = dt::str('%Y-%m-%d %T',null, 228 $ core->blog->settings->blog_timezone);230 $settings->blog_timezone); 229 231 $post->post_url = ''; 230 232 … … 235 237 236 238 # HTML filter 237 $filter = new htmlFilter; 239 # get the setting value 240 $enable_html_filter = $settings->enable_html_filter; 241 # set the setting to true 242 $settings->enable_html_filter = true; 238 243 # excerpt 239 if (($ core->blog->settings->contribute_allow_excerpt === true)244 if (($settings->contribute_allow_excerpt === true) 240 245 && (isset($_POST['post_excerpt']))) 241 246 { 242 $post->post_excerpt = trim($filter->apply($_POST['post_excerpt']));247 $post->post_excerpt = $core->HTMLfilter($_POST['post_excerpt']); 243 248 } 244 249 # content 245 250 if (isset($_POST['post_content'])) 246 251 { 247 $post->post_content = trim($filter->apply($_POST['post_content'])); 248 } 249 unset($filter); 252 $post->post_content = $core->HTMLfilter($_POST['post_content']); 253 } 254 # set the old value to the setting 255 $settings->enable_html_filter = $enable_html_filter; 256 unset($enable_html_filter); 250 257 251 258 # avoid Notice: Indirect modification of overloaded property … … 258 265 259 266 $core->blog->setPostContent( 260 '',$post->post_format,$ core->blog->settings->lang,267 '',$post->post_format,$settings->lang, 261 268 $post_excerpt,$post_excerpt_xhtml, 262 269 $post_content,$post_content_xhtml … … 284 291 285 292 # category 286 if (($ core->blog->settings->contribute_allow_category === true)293 if (($settings->contribute_allow_category === true) 287 294 && (isset($_POST['cat_id']))) 288 295 { … … 316 323 if ($meta !== false) 317 324 { 318 if (($ core->blog->settings->contribute_allow_tags === true)325 if (($settings->contribute_allow_tags === true) 319 326 && (isset($_POST['post_tags']))) 320 327 { … … 324 331 unset($post_meta['tag']); 325 332 326 if ($ core->blog->settings->contribute_allow_new_tags === true)333 if ($settings->contribute_allow_new_tags === true) 327 334 { 328 335 foreach ($meta->splitMetaValues($_POST['post_tags']) as $k => $tag) … … 374 381 375 382 # notes 376 if (($ core->blog->settings->contribute_allow_notes === true)383 if (($settings->contribute_allow_notes === true) 377 384 && (isset($_POST['post_notes']))) 378 385 { … … 382 389 # author 383 390 if (($meta !== false) 384 && ($ core->blog->settings->contribute_allow_author === true))391 && ($settings->contribute_allow_author === true)) 385 392 { 386 393 $post_meta = unserialize($_ctx->posts->post_meta); … … 410 417 $post_content = $post->post_content; 411 418 412 if (isset($_POST['post_title']) && empty($post_title)) 419 if (isset($_POST['post_content']) && empty($post_content)) 420 { 421 throw new Exception(__('No entry content')); 422 } elseif (isset($_POST['post_title']) && empty($post_title)) 413 423 { 414 424 throw new Exception(__('No entry title')); 415 } elseif (isset($_POST['post_content']) && empty($post_content))416 {417 throw new Exception(__('No entry content'));418 425 } else { 419 426 if (isset($_POST['preview'])) … … 424 431 } 425 432 433 unset($post_title,$post_content); 434 435 if ($settings->contribute_require_name_email) 436 { 437 if (empty($_ctx->comment_preview['name'])) 438 { 439 $_ctx->contribute->preview = false; 440 $_ctx->contribute->message = ''; 441 throw new Exception(__('You must provide an author name')); 442 } elseif (!text::isEmail($_ctx->comment_preview['mail'])) 443 { 444 $_ctx->contribute->preview = false; 445 $_ctx->contribute->message = ''; 446 throw new Exception( 447 __('You must provide a valid email address.')); 448 } 449 } 450 426 451 if (isset($_POST) && empty($_POST)) 427 452 { … … 434 459 # log in as the user 435 460 # usage OR contentadmin permission is needed 436 $core->auth->checkUser($ core->blog->settings->contribute_user);461 $core->auth->checkUser($settings->contribute_user); 437 462 438 463 if (!$core->auth->check('usage,contentadmin',$core->blog->id)) … … 454 479 $cur->post_notes = $post->post_notes; 455 480 $cur->post_lang = $core->auth->getInfo('user_lang'); 456 $cur->post_open_comment = (integer) $ core->blog->settings->allow_comments;457 $cur->post_open_tb = (integer) $ core->blog->settings->allow_trackbacks;481 $cur->post_open_comment = (integer) $settings->allow_comments; 482 $cur->post_open_tb = (integer) $settings->allow_trackbacks; 458 483 459 484 # --BEHAVIOR-- publicBeforePostCreate … … 482 507 if (isset($_POST['post_tags'])) 483 508 { 484 if ($ core->blog->settings->contribute_allow_new_tags === true)509 if ($settings->contribute_allow_new_tags === true) 485 510 { 486 511 foreach ($meta->splitMetaValues($_POST['post_tags']) as $k => $tag) … … 522 547 523 548 # send email notification 524 if ($ core->blog->settings->contribute_email_notification)549 if ($settings->contribute_email_notification) 525 550 { 526 551 $headers = array( … … 538 563 $content .= "\n\n"; 539 564 540 if ($ core->blog->settings->contribute_allow_author === true)565 if ($settings->contribute_allow_author === true) 541 566 { 542 567 if (!empty($_ctx->comment_preview['name'])) … … 571 596 572 597 foreach(explode(',', 573 $ core->blog->settings->contribute_email_notification)598 $settings->contribute_email_notification) 574 599 as $to) 575 600 { -
plugins/contribute/default-templates/contribute.html
r872 r909 106 106 107 107 <tpl:ContributeIf message="preview"> 108 <p class="message">{{tpl:lang This is a preview }}108 <p class="message">{{tpl:lang This is a preview.}} 109 109 {{tpl:lang Click on <strong>save</strong> when the post is ready.}} 110 110 {{tpl:lang It needs to be approved by an administrator to be published.}} -
plugins/contribute/index.php
r872 r909 69 69 $settings->put('contribute_allow_author', 70 70 !empty($_POST['contribute_allow_author']), 71 'boolean','Allow contributors to choose the name of the author'); 71 'boolean','Allow contributors to enter their name, email address and website URL'); 72 $settings->put('contribute_require_name_email', 73 !empty($_POST['contribute_require_name_email']), 74 'boolean','require name and email'); 72 75 73 76 $settings->put('contribute_author_format', … … 148 151 }); 149 152 150 $('#contribute_allow_tags').change( function() {151 if ($(this).attr('checked')) {152 $('#contribute_allow_new_tags').attr('disabled','');153 } else {154 $('#contribute_allow_new_tags').attr('disabled','disabled');155 }156 });157 158 153 $('#contribute_default_post').change( function() { 159 154 if ($(this).val() == '') { … … 169 164 <body> 170 165 171 <h2><?php echo html::escapeHTML($core->blog->name).' › '. ('Contribute'); ?></h2>166 <h2><?php echo html::escapeHTML($core->blog->name).' › '.__('Contribute'); ?></h2> 172 167 173 168 <?php … … 196 191 <?php echo(__('Only the users with the following permissions on this blog are shown:')); ?> 197 192 </p> 198 <ul >193 <ul class="form-note"> 199 194 <li><!-- usage --><?php echo(__('manage their own entries and comments')); ?></li> 200 195 </ul> … … 259 254 $settings->contribute_allow_author)); ?> 260 255 <label class="classic" for="contribute_allow_author"> 261 <?php echo(__('choose the name of the author')); ?> 256 <?php echo(__('enter their name, email address and website URL')); ?> 257 </label> 258 </p> 259 260 <p> 261 <?php echo(form::checkbox('contribute_require_name_email',1, 262 $settings->contribute_require_name_email)); ?> 263 <label class="classic" for="contribute_require_name_email"> 264 <?php echo(__('require name and email (only if name, email address and website URL are allowed)')); ?> 262 265 </label> 263 266 </p> … … 367 370 368 371 <p> 369 <?php printf(__('URL of the %s page:'), ('Contribute')); ?>372 <?php printf(__('URL of the %s page:'),__('Contribute')); ?> 370 373 <br /> 371 374 <code><?php echo($core->blog->url.$core->url->getBase('contribute')); ?></code> 372 375 <br /> 373 376 <a href="<?php echo($core->blog->url.$core->url->getBase('contribute')); ?>"> 374 <?php printf(__('View the %s page'), ('Contribute')); ?></a>377 <?php printf(__('View the %s page'),__('Contribute')); ?></a> 375 378 </p> 376 379 -
plugins/contribute/js/contribute.js
r848 r909 52 52 // Load toolbar 53 53 contentTb.switchMode(formatField.value); 54 // fixme : formatField is undefined ?55 54 }); 56 55 -
plugins/contribute/locales/fr/main.po
r872 r909 3 3 "Project-Id-Version: Contribute\n" 4 4 "Report-Msgid-Bugs-To: \n" 5 "POT-Creation-Date: 2009-03-1 3 15:10+0100\n"6 "PO-Revision-Date: 2009-03-1 3 15:10+0100\n"5 "POT-Creation-Date: 2009-03-19 13:54+0100\n" 6 "PO-Revision-Date: 2009-03-19 13:54+0100\n" 7 7 "Last-Translator: Moe <poedit@gniark.net>\n" 8 8 "Language-Team: Moe <poedit@gniark.net>\n" … … 17 17 "X-Poedit-SearchPath-0: .\n" 18 18 19 #: _public.php:10 119 #: _public.php:103 20 20 msgid "Anonymous" 21 21 msgstr "Anonyme" 22 22 23 #: _public.php:1 2923 #: _public.php:131 24 24 msgid "No default post." 25 25 msgstr "Pas de billet par défaut." 26 26 27 #: _public.php: 29227 #: _public.php:300 28 28 msgid "Invalid cat_id" 29 29 msgstr "cat_id invalide" 30 30 31 #: _public.php:413 31 #: _public.php:421 32 msgid "No entry content" 33 msgstr "Pas de contenu de billet" 34 35 #: _public.php:424 32 36 msgid "No entry title" 33 37 msgstr "Pas de titre de billet" 34 38 35 #: _public.php:416 36 msgid "No entry content" 37 msgstr "Pas de contenu de billet" 38 39 #: _public.php:440 39 #: _public.php:441 40 msgid "You must provide an author name" 41 msgstr "" 42 43 #: _public.php:447 44 msgid "You must provide a valid email address." 45 msgstr "" 46 47 #: _public.php:466 40 48 msgid "The user is not allowed to create an entry" 41 49 msgstr "L'utilisateur n'est pas autorisé à créer des billets" 42 50 43 #: _public.php:4 6451 #: _public.php:490 44 52 msgid "You are not allowed to create an entry" 45 53 msgstr "Vous n'êtes pas autorisé à créer des billets" 46 54 47 #: _public.php:5 3355 #: _public.php:559 48 56 #, php-format 49 57 msgid "New post submitted on %s" 50 58 msgstr "Nouveau billet envoyé sur %s." 51 59 52 #: _public.php:5 3660 #: _public.php:562 53 61 #, php-format 54 62 msgid "Title : %s" 55 63 msgstr "Titre : %s" 56 64 57 #: _public.php:5 4365 #: _public.php:569 58 66 #, php-format 59 67 msgid "Author : %s" 60 68 msgstr "Auteur : %s" 61 69 62 #: _public.php:5 5070 #: _public.php:576 63 71 #, php-format 64 72 msgid "Email address : %s" 65 73 msgstr "Adresse email : %s" 66 74 67 #: _public.php:5 6175 #: _public.php:587 68 76 msgid "URL:" 69 77 msgstr "URL :" 70 78 71 #: _public.php:5 6579 #: _public.php:591 72 80 msgid "Edit this entry:" 73 81 msgstr "Éditer ce billet :" 74 82 75 #: _public.php:5 6983 #: _public.php:595 76 84 msgid "You must log in on the backend before clicking on this link to go directly to the post." 77 85 msgstr "Vous devez vous enregistrer sur l'interface d'administration avant de cliquer sur ce lien pour aller directement sur ce billet." … … 79 87 #: _widget.php:40 80 88 #: _widget.php:43 81 #: index.php:142 89 #: _admin.php:26 90 #: index.php:145 91 #: index.php:166 92 #: index.php:372 93 #: index.php:377 82 94 #: public_l10n.php:10 83 95 msgid "Contribute" … … 126 138 msgstr "Effacer cet auteur" 127 139 128 #: index.php:9 6140 #: index.php:99 129 141 msgid "Configuration successfully updated." 130 142 msgstr "Configuration mise à jour avec succès." 131 143 132 #: index.php:1 19144 #: index.php:122 133 145 msgid "me" 134 146 msgstr "moi" 135 147 136 #: index.php:1 37148 #: index.php:140 137 149 #, php-format 138 150 msgid "%s (contributor)" 139 151 msgstr "%s (contributeur)" 140 152 141 #: index.php:17 9153 #: index.php:174 142 154 msgid "General settings" 143 155 msgstr "Paramètres généraux" 144 156 145 #: index.php:18 5157 #: index.php:180 146 158 msgid "Allow visitors to contribute to your blog." 147 159 msgstr "Permettre aux visiteurs de contribuer à votre blog." 148 160 149 #: index.php:1 91161 #: index.php:186 150 162 msgid "Owner of the posts:" 151 163 msgstr "Propriétaire des billets :" 152 164 153 #: index.php:19 6165 #: index.php:191 154 166 msgid "Only the users with the following permissions on this blog are shown:" 155 167 msgstr "Seuls les utilisateurs avec les permissions suivantes sur le blog sont affichés :" 156 168 169 #: index.php:194 170 msgid "manage their own entries and comments" 171 msgstr "" 172 157 173 #: index.php:199 158 msgid "manage their own entries and comments"159 msgstr ""160 161 #: index.php:204162 174 msgid "Send emails to these email adresses when a new post is submitted:" 163 175 msgstr "Envoyer des emails à ces adresses emails quand un nouveau billet est soumis :" 164 176 165 #: index.php:2 10177 #: index.php:205 166 178 msgid "You can enter several email adresses by separating these by a comma (<code>,</code>)." 167 179 msgstr "Vous pouvez entrer plusieurs adresses email en les séparant par une virgule (<code>,</code>)." 168 180 181 #: index.php:206 182 #: index.php:278 183 #: index.php:302 184 #: index.php:315 185 msgid "Leave empty to cancel this feature." 186 msgstr "" 187 169 188 #: index.php:211 170 #: index.php:275171 #: index.php:299172 #: index.php:312173 msgid "Leave empty to cancel this feature."174 msgstr ""175 176 #: index.php:216177 189 msgid "Allow contributors to" 178 190 msgstr "Permettre aux contributeurs de" 179 191 180 #: index.php:2 21192 #: index.php:216 181 193 msgid "write an excerpt" 182 194 msgstr "écrire un extrait" 183 195 184 #: index.php:22 9196 #: index.php:224 185 197 msgid "choose the category" 186 198 msgstr "choisir la catégorie" 187 199 188 #: index.php:23 7200 #: index.php:232 189 201 msgid "choose the tags" 190 202 msgstr "choisir les tags" 191 203 192 #: index.php:24 5204 #: index.php:240 193 205 msgid "add new tags (only if tags are allowed)" 194 206 msgstr "ajouter des nouveaux tags (seulement si les tags sont permis)" 195 207 196 #: index.php:2 53208 #: index.php:248 197 209 msgid "write notes" 198 210 msgstr "écrire des notes" 199 211 200 #: index.php:261 201 msgid "choose the name of the author" 202 msgstr "choisir le nom de l'auteur" 203 204 #: index.php:267 212 #: index.php:256 213 msgid "enter their name, email address and website URL" 214 msgstr "entrer leur nom, adresse email et URL de leur site" 215 216 #: index.php:264 217 msgid "require name and email (only if name, email address and website URL are allowed)" 218 msgstr "rendre obligatoire le nom et l'adresse email (seulement si le nom, l'adresse email et l'URL de leur site est aurotisé)" 219 220 #: index.php:270 205 221 msgid "Display" 206 222 msgstr "" 207 223 208 #: index.php:27 0224 #: index.php:273 209 225 msgid "Display of the author name on the blog:" 210 226 msgstr "Affichage du nom de l'auteur sur le blog :" 211 227 212 #: index.php:27 0228 #: index.php:273 213 229 #, php-format 214 230 msgid "(%s is the author name or nickname)" 215 231 msgstr "(%s est le nom ou le pseudo de l'auteur)" 216 232 217 #: index.php:28 0233 #: index.php:283 218 234 msgid "Default post and format" 219 235 msgstr "Billet par défaut et format" 220 236 221 #: index.php:28 3237 #: index.php:286 222 238 msgid "Default post:" 223 239 msgstr "Billet par défaut :" 224 240 225 #: index.php:29 0241 #: index.php:293 226 242 msgid "edit this post" 227 243 msgstr "éditer ce billet" 228 244 229 #: index.php:29 5245 #: index.php:298 230 246 msgid "Select an existing post or create a new post, then select it." 231 247 msgstr "Sélectionner un billet existant ou créer un nouveau billet puis le sélectionner." 232 248 233 #: index.php:29 6249 #: index.php:299 234 250 #, php-format 235 251 msgid "The post can be %s or %s." 236 252 msgstr "Le billet peut être %s ou %s." 237 253 238 #: index.php:29 6254 #: index.php:299 239 255 msgid "pending" 240 256 msgstr "" 241 257 242 #: index.php: 297258 #: index.php:300 243 259 msgid "unpublished" 244 260 msgstr "" 245 261 246 #: index.php: 298262 #: index.php:301 247 263 msgid "The form will be filled with the values of this post." 248 264 msgstr "Le formulaire sera rempli avec les valeurs du billet." 249 265 250 #: index.php:30 4266 #: index.php:307 251 267 msgid "Text formating (only if no default post is selected):" 252 268 msgstr "Format du texte (seulement si aucun billet par défaut n'est sélectionné) :" 253 269 254 #: index.php:31 0270 #: index.php:313 255 271 msgid "Contributors will be able to choose the format." 256 272 msgstr "Permettre aux contributeurs de choisir le format." 257 273 258 #: index.php:31 1274 #: index.php:314 259 275 msgid "Some formats may be unavailable on the blog." 260 276 msgstr "Certains formats peuvent ne pas être disponibles sur le blog." 261 277 262 #: index.php:317 263 #: index.php:323 278 #: index.php:320 264 279 #: index.php:326 265 #: index.php:343 280 #: index.php:329 281 #: index.php:346 266 282 msgid "My Meta" 267 283 msgstr "" 268 284 269 #: index.php:32 2285 #: index.php:325 270 286 #, php-format 271 287 msgid "Allow contributors to choose %s values." 272 288 msgstr "Permettre aux contributeurs de choisir les valeurs de %s." 273 289 274 #: index.php:32 5290 #: index.php:328 275 291 #, php-format 276 292 msgid "It requires the %s plugin." 277 293 msgstr "Cela nécessite le plugin %s." 278 294 279 #: index.php:34 3295 #: index.php:346 280 296 #, php-format 281 297 msgid "Enable these %s values:" 282 298 msgstr "Activer ces valeurs de %s :" 283 299 284 #: index.php:36 3300 #: index.php:366 285 301 msgid "Save configuration" 286 302 msgstr "Enregistrer la configuration" 287 303 288 #: index.php:3 69304 #: index.php:372 289 305 #, php-format 290 306 msgid "URL of the %s page:" 291 307 msgstr "URL de la page %s :" 292 308 293 #: index.php:37 4309 #: index.php:377 294 310 #, php-format 295 311 msgid "View the %s page" … … 481 497 482 498 #: public_l10n.php:50 483 msgid "This is a preview "499 msgid "This is a preview." 484 500 msgstr "Ceci est un aperçu." 485 501 -
plugins/contribute/public_l10n.php
r872 r909 48 48 __("Text formating"); 49 49 __("The post has been saved."); 50 __("This is a preview ");50 __("This is a preview."); 51 51 __("Title"); 52 52 __("Unordered list");
Note: See TracChangeset
for help on using the changeset viewer.