Changeset 1069
- Timestamp:
- 05/10/08 17:35:35 (7 months ago)
- Files:
-
- bb-attachments/trunk/bb-attachments.php (modified) (4 diffs)
- bb-attachments/trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
bb-attachments/trunk/bb-attachments.php
r1036 r1069 6 6 Author: _ck_ 7 7 Author URI: http://bbShowcase.org 8 Version: 0.1. 08 Version: 0.1.1 9 9 10 10 License: CC-GNU-GPL http://creativecommons.org/licenses/GPL/2.0/ … … 45 45 46 46 $bb_attachments['path']=dirname($_SERVER['DOCUMENT_ROOT'])."/bb-attachments/"; // make *NOT* WEB ACCESSABLE for security 47 48 $bb_attachments['upload_on_new']=true; // allow uploads directly on new posts (set FALSE if incompatible for some reason) 47 49 48 50 $bb_attachments['icons']=array('default'=>'default.gif','bmp'=>'img.gif','doc'=>'doc.gif','gif'=>'img.gif','gz'=>'zip.gif','jpeg'=>'img.gif','jpg'=>'img.gif','pdf'=>'pdf.gif','png'=>'img.gif','txt'=>'txt.gif','xls'=>'xls.gif','zip'=>'zip.gif'); … … 89 91 if ($bb_attachments['title']) {add_filter('topic_title', 'bb_attachments_title',200);} 90 92 } 91 add_action('post_edit_form','bb_attachments'); // auto-insert on post edit form 92 add_action('post_form','bb_attachments_upload_form'); // auto-insert on new post form 93 add_action('pre_post_form','bb_attachments_enctype'); // multipart workaround on new post form 93 94 94 if ($bb_attachments['style']) {add_action('bb_head', 'bb_attachments_add_css');} // add css if present (including Kakumei 0.9.0.2 LI fix!) 95 } 95 96 if (bb_current_user_can($bb_attachments['role']['upload'])) { 97 add_action('post_edit_form','bb_attachments'); // auto-insert on post edit form 98 99 if ($bb_attachments['upload_on_new']) { 100 add_action('post_form','bb_attachments_upload_form'); // auto-insert on new post form 101 add_action('pre_post_form','bb_attachments_enctype'); // multipart workaround on new post form 96 102 97 103 // insane bbPress workaround - adds multipart enctype to the new post form via uri patch … … 99 105 function bb_attachments_uri($uri) {remove_filter( 'bb_get_option_uri','bb_attachments_uri',999); 100 106 return $uri. 'bb-post.php" enctype="multipart/form-data" hack="';} 107 } 108 } 109 } 101 110 102 111 function bb_attachments_add_css() { global $bb_attachments; echo '<style type="text/css">'.$bb_attachments['style'].'</style>';} // inject css bb-attachments/trunk/readme.txt
r1032 r1069 50 50 * 0.0.9 no longer necessary to edit `edit-post.php` template if using bbPress 0.9.0.2 or newer 51 51 * 0.1.0 uploading now possible directly on new posts (instead of only attaching afterwards) 52 * 0.1.1 role check before hooks, ability to disable upload on new posts if compatibility issues 52 53 53 54 == To Do ==
