Changeset 620
- Timestamp:
- 12/31/08 02:11:59 (15 years ago)
- Location:
- plugins/contribute
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/contribute/_admin.php
r614 r620 46 46 public static function adminBeforePostUpdate($cur,$post_id) 47 47 { 48 $meta = new dcMeta($GLOBALS['core']); 49 50 try 51 { 52 if (isset($_POST['contribute_author'])) 53 { 54 $meta->delPostMeta($post_id,'contribute_author'); 55 $meta->setPostMeta($post_id,'contribute_author', 56 $_POST['contribute_author']); 57 } 58 59 if (isset($_POST['contribute_mail'])) 60 { 61 $meta->delPostMeta($post_id,'contribute_mail'); 62 $meta->setPostMeta($post_id,'contribute_mail', 63 $_POST['contribute_mail']); 64 } 65 66 if (isset($_POST['contribute_site'])) 67 { 68 $meta->delPostMeta($post_id,'contribute_site'); 69 $meta->setPostMeta($post_id,'contribute_site', 70 $_POST['contribute_site']); 71 } 72 } 73 catch (Exception $e) 74 { 75 $core->error->add($e->getMessage()); 76 } 77 48 78 if (isset($_POST['contribute_delete_author']) 49 79 && ($_POST['contribute_delete_author'] == '1')) 50 80 { 51 $meta = new dcMeta($GLOBALS['core']);52 53 81 try 54 82 { … … 76 104 $site = ($post) ? $meta->getMetaStr($post->post_meta,'contribute_site') : ''; 77 105 78 $ infos = array();106 $str = ''; 79 107 80 108 if (!empty($author)) 81 { 82 // fixme : display fields83 $infos[] = sprintf(__('Post submitted by %s'),$author);84 85 if (!empty($mail))86 {87 $infos[] = sprintf(__('Email address : %s'),'<a href="mailto:'.$mail.'">'.$mail.'</a>');88 }109 { 110 $str .= '<p>'. 111 '<label class="classic" for="contribute_author">'. 112 __('Author:'). 113 form::field('contribute_author',10,255,html::escapeHTML($author),'maximal'). 114 '</label>'. 115 '</p>'; 116 89 117 if (!empty($site)) 90 118 { 91 # prevent malformed URLs 92 # inspirated by /dotclear/inc/clearbricks/net.http/class.net.http.php 93 $parsed_url = @parse_url($site); 94 if ($parsed_url != false) 95 { 96 $host = '['.$parsed_url['host'].']'; 97 } 98 else 99 { 100 $host = ''; 101 } 102 $infos[] = sprintf(__('Website : %s'),'<a href="'.$site.'">'.$host.'</a>'); 103 } 104 if (!empty($infos)) 105 { 106 $infos = '<ul><li>'.implode('</li><li>',$infos).'</li></ul>'; 119 $link = '<br />'.'<a href="mailto:'.html::escapeHTML($mail).'">'. 120 __('send email').'</a>'; 107 121 } 108 122 else 109 123 { 110 $infos = ''; 111 } 124 $link = ''; 125 } 126 127 $str .= '<p>'. 128 '<label class="classic" for="contribute_mail">'. 129 __('Email:'). 130 form::field('contribute_mail',10,255,html::escapeHTML($mail),'maximal'). 131 '</label>'. 132 $link. 133 '</p>'; 134 135 # prevent malformed URLs 136 # inspirated by /dotclear/inc/clearbricks/net.http/class.net.http.php 137 if (!empty($site)) 138 { 139 $parsed_url = @parse_url($site); 140 $host = (($parsed_url != false) ? '['.$parsed_url['host'].']' : ''); 141 $link = '<br />'. 142 '<a href="'.html::escapeHTML($site).'">'.$host.'</a>'; 143 } 144 else 145 { 146 $link = ''; 147 } 148 149 $str .= '<p>'. 150 '<label class="classic" for="contribute_site">'. 151 __('Web site:'). 152 form::field('contribute_site',10,255,html::escapeHTML($site),'maximal'). 153 '</label>'. 154 $link. 155 '</p>'; 112 156 113 157 echo 114 158 '<div id="planet-infos">'.'<h3>'.('Contribute').'</h3>'. 115 $ infos.159 $str. 116 160 '<p>'. 117 161 '<label class="classic" for="contribute_delete_author">'. -
plugins/contribute/_define.php
r614 r620 26 26 /* Description*/ "Allow visitors to contribute to your blog", 27 27 /* Author */ "Moe (http://gniark.net/)", 28 /* Version */ '1.0-alpha 5',28 /* Version */ '1.0-alpha6', 29 29 /* Permissions */ 'admin' 30 30 ); -
plugins/contribute/_public.php
r614 r620 48 48 $_ctx->contribute->selected_tags = array(); 49 49 50 # Metadata 50 51 if ($core->plugins->moduleExists('metadata')) 51 52 { … … 57 58 } 58 59 60 # My Meta 59 61 if ($core->plugins->moduleExists('mymeta')) 60 62 { … … 129 131 } 130 132 } 133 # /My Meta 131 134 } 132 135 # empty post … … 157 160 # My Meta 158 161 $post->mymeta = array(); 162 # /My Meta 159 163 160 164 # formats … … 169 173 170 174 if ((isset($_POST['post_format'])) 171 && in_array($_POST['post_format'],$core->getFormaters()))175 && in_array($_POST['post_format'],$core->getFormaters())) 172 176 { 173 177 $post->post_format = $_POST['post_format']; … … 324 328 foreach ($_ctx->contribute->mymeta->getAll() as $k => $v) 325 329 { 326 if ($v->enabled) 330 if ($v->enabled && isset($_POST['mymeta_'.$k]) 331 && in_array($k,$mymeta_values)) 327 332 { 328 if (isset($_POST['mymeta_'.$k])) 329 { 330 if (in_array($k,$mymeta_values)) 331 { 332 $post->mymeta[$k] = $_POST['mymeta_'.$k]; 333 } 334 } 333 $post->mymeta[$k] = $_POST['mymeta_'.$k]; 335 334 } 336 335 } … … 483 482 && ($core->blog->settings->contribute_allow_mymeta === true)) 484 483 { 485 $_ctx->contribute->mymeta->setMeta($post_id,$_POST); 486 // fixme : filter My Meta values 484 foreach ($_ctx->contribute->mymeta->getAll() as $k => $v) 485 { 486 if ($v->enabled && isset($_POST['mymeta_'.$k]) 487 && in_array($k,$mymeta_values)) 488 { 489 $meta->setPostMeta($post_id,$k,$_POST['mymeta_'.$k]); 490 } 491 } 487 492 } 493 # /My Meta 488 494 } 489 490 491 492 $separator = '?';493 if ($core->blog->settings->url_scan == 'query_string')494 {$separator = '&';}495 495 496 496 # send email notification -
plugins/contribute/index.php
r614 r620 182 182 <?php echo(__('Only the users with the following permissions on this blog are shown:')); ?> 183 183 </p> 184 <ul class="form-note">184 <ul> 185 185 <li><!-- usage --><?php echo(__('manage their own entries and comments')); ?></li> 186 186 </ul>
Note: See TracChangeset
for help on using the changeset viewer.