Changeset 26065 for extensions/GuestBook/include/guestbook.inc.php
- Timestamp:
- Dec 21, 2013, 5:33:24 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/GuestBook/include/guestbook.inc.php
r24889 r26065 4 4 global $user; 5 5 6 include(GUESTBOOK_PATH . ' /include/functions.inc.php');6 include(GUESTBOOK_PATH . 'include/functions.inc.php'); 7 7 8 8 $url_self = empty($page['start']) ? GUESTBOOK_URL : add_url_params(GUESTBOOK_URL, array('start' => $page['start'])); … … 106 106 // | add comment | 107 107 // +-----------------------------------------------------------------------+ 108 if ( isset( $_POST['content']) && (!is_a_guest() || $conf['guestbook']['guest_can_add']))108 if (isset($_POST['content']) && (!is_a_guest() || $conf['guestbook']['guest_can_add'])) 109 109 { 110 110 $comm = array( 111 'author' => trim( @$_POST['author']),112 'email' => trim( @$_POST['email']),113 'content' => trim( $_POST['content']),114 'website' => trim( $_POST['website']),111 'author' => trim(@$_POST['author']), 112 'email' => trim(@$_POST['email']), 113 'content' => trim($_POST['content']), 114 'website' => trim($_POST['website']), 115 115 'rate' => @$_POST['score'], 116 116 ); … … 123 123 { 124 124 case 'moderate': 125 array_push($page['infos'], l10n('An administrator must authorize your comment before it is visible.'));125 $page['infos'][] = l10n('An administrator must authorize your comment before it is visible.'); 126 126 case 'validate': 127 array_push($page['infos'], l10n('Your comment has been registered'));127 $page['infos'][] = l10n('Your comment has been registered'); 128 128 break; 129 129 case 'reject': 130 130 set_status_header(403); 131 array_push($page['errors'], l10n('Your comment has NOT been registered because it did not pass the validation rules') ); 131 $template->assign('GB_OPEN', true); 132 $page['errors'][] = l10n('Your comment has NOT been registered because it did not pass the validation rules'); 132 133 break; 133 134 default: … … 136 137 137 138 // allow plugins to notify what's going on 138 trigger_action( 139 array_merge($comm, array('action'=>$comment_action) 139 trigger_action('user_comment_insertion', 140 array_merge($comm, array('action'=>$comment_action)) 140 141 ); 141 142 } … … 145 146 // +-----------------------------------------------------------------------+ 146 147 $where_clauses = array('1=1'); 147 if ( !is_admin())148 { 149 array_push($where_clauses, 'validated = \'true\'');148 if (!is_admin()) 149 { 150 $where_clauses[] = 'validated = \'true\''; 150 151 } 151 152 if (isset($_GET['comment_id'])) 152 153 { 153 array_push($where_clauses, 'com.id = '.pwg_db_real_escape_string($_GET['comment_id']));154 $where_clauses[] = 'com.id = '.pwg_db_real_escape_string($_GET['comment_id']); 154 155 } 155 156 … … 161 162 WHERE '.implode(' AND ', $where_clauses).' 162 163 ;'; 163 $row = pwg_db_fetch_assoc( pwg_query( $query ));164 $row = pwg_db_fetch_assoc(pwg_query($query)); 164 165 165 166 // navigation bar creation … … 178 179 ); 179 180 180 $template->assign( 181 array( 182 'COMMENT_COUNT' => $row['nb_comments'], 183 'navbar' => $navigation_bar, 184 ) 185 ); 181 $template->assign(array( 182 'COMMENT_COUNT' => $row['nb_comments'], 183 'navbar' => $navigation_bar, 184 )); 186 185 187 186 if ($row['nb_comments'] > 0) … … 223 222 } 224 223 225 $tpl_comment = 226 array( 227 'ID' => $row['id'], 228 'AUTHOR' => trigger_event('render_comment_author', $author), 229 'DATE' => format_date($row['date'], true), 230 'CONTENT' => trigger_event('render_comment_content',$row['content']), 231 'WEBSITE' => $row['website'], 224 $tpl_comment = array( 225 'ID' => $row['id'], 226 'AUTHOR' => trigger_event('render_comment_author', $author), 227 'DATE' => format_date($row['date'], true), 228 'CONTENT' => trigger_event('render_comment_content', $row['content']), 229 'WEBSITE' => $row['website'], 232 230 ); 233 231 … … 276 274 { 277 275 $tpl_comment['U_VALIDATE'] = add_url_params( 278 279 280 281 282 283 284 276 $url_self, 277 array( 278 'action' => 'validate_comment', 279 'comment_to_validate' => $row['id'], 280 'pwg_token' => get_pwg_token(), 281 ) 282 ); 285 283 } 286 284 } … … 316 314 317 315 $template->assign('comment_add', 318 array( 319 'F_ACTION' => $url_self, 320 'KEY' => get_ephemeral_key(3), 321 'CONTENT' => $content, 322 'IS_LOGGED' => is_classic_user(), 323 'AUTHOR' => $author, 324 'WEBSITE' => $website, 325 'EMAIL' => $email, 326 'ACTIVATE_RATING' => $conf['guestbook']['activate_rating'], 327 'EMAIL_MANDATORY' => $conf['comments_email_mandatory'], 328 )); 329 } 330 331 $template->assign('ABS_GUESTBOOK_PATH', realpath(GUESTBOOK_PATH) . '/'); 332 $template->assign('GUESTBOOK_PATH', GUESTBOOK_PATH); 333 334 $template->set_filename('index', realpath(GUESTBOOK_PATH . 'template/guestbook.tpl')); 316 array( 317 'F_ACTION' => $url_self, 318 'KEY' => get_ephemeral_key(3), 319 'CONTENT' => $content, 320 'IS_LOGGED' => is_classic_user(), 321 'AUTHOR' => $author, 322 'WEBSITE' => $website, 323 'EMAIL' => $email, 324 'ACTIVATE_RATING' => $conf['guestbook']['activate_rating'], 325 'EMAIL_MANDATORY' => $conf['comments_email_mandatory'], 326 )); 327 } 328 329 $template->assign(array( 330 'GUESTBOOK_PATH' => GUESTBOOK_PATH, 331 'ABS_GUESTBOOK_PATH' => realpath(GUESTBOOK_PATH) . '/', 332 )); 333 334 $template->set_filename('guestbook', realpath(GUESTBOOK_PATH . 'template/guestbook.tpl')); 335 $template->assign_var_from_handle('CONTENT', 'guestbook');
Note: See TracChangeset
for help on using the changeset viewer.