# HG changeset patch # User Dan # Date 1188161295 14400 # Node ID d807dcd7aed74577e99bf46124174c427cdd557b # Parent bb4e677a4da96cb665767ef045b6784f4e6b529c [comments] fixed edit button (source wasn't getting filled) [editor] fixed issue with PHP execution and preview (PHP code is executed now, ACL-permitting) [admin] added checkbox to toggle account activation status in user manager (thanks Manoj) diff -r bb4e677a4da9 -r d807dcd7aed7 includes/clientside/static/comments.js --- a/includes/clientside/static/comments.js Sat Aug 25 12:53:03 2007 -0400 +++ b/includes/clientside/static/comments.js Sun Aug 26 16:48:15 2007 -0400 @@ -147,10 +147,10 @@ document.getElementById('ajaxEditContainer').innerHTML = html; - //for ( i = 0; i < data.comments.length; i++ ) - //{ - // document.getElementById('comment_source_'+i).value = data.comments[i].comment_source; - //} + for ( i = 0; i < data.comments.length; i++ ) + { + document.getElementById('comment_source_'+i).value = data.comments[i].comment_source; + } } @@ -230,7 +230,7 @@ function editComment(id, link) { var ctr = document.getElementById('subject_'+id); - var subj = trim(ctr.firstChild.nodeValue); // If there's a span in there that says 'unapproved', this eliminates it + var subj = ( ctr.firstChild ) ? trim(ctr.firstChild.nodeValue) : ''; // If there's a span in there that says 'unapproved', this eliminates it ctr.innerHTML = ''; var ipt = document.createElement('input'); ipt.id = 'subject_edit_'+id; @@ -273,9 +273,12 @@ function deleteComment(id) { - //var c = confirm('Do you really want to delete this comment?'); - //if(!c); - // return false; + if ( !shift ) + { + var c = confirm('Do you really want to delete this comment?'); + if(!c) + return false; + } var div = document.getElementById('comment_holder_'+id); var real_id = div.getElementsByTagName('input')[0]['value']; var req = { @@ -301,6 +304,16 @@ var captcha_code = ''; var captcha_id = ''; } + if ( subj == '' ) + { + new messagebox(MB_OK|MB_ICONSTOP, 'Input validation failed', 'Please enter a subject for your comment.'); + return false; + } + if ( text == '' ) + { + new messagebox(MB_OK|MB_ICONSTOP, 'Input validation failed', 'Please enter some text for the body of your comment .'); + return false; + } var req = { 'mode' : 'submit', 'name' : name, diff -r bb4e677a4da9 -r d807dcd7aed7 includes/pageutils.php --- a/includes/pageutils.php Sat Aug 25 12:53:03 2007 -0400 +++ b/includes/pageutils.php Sun Aug 26 16:48:15 2007 -0400 @@ -1591,7 +1591,15 @@ function genPreview($text) { - return '
Reminder: This is only a preview - your changes to this page have not yet been saved.
'.RenderMan::render(RenderMan::preprocess_text($text, false, false)).'
'; + $ret = '
Reminder: This is only a preview - your changes to this page have not yet been saved.
'; + $text = RenderMan::render(RenderMan::preprocess_text($text, false, false)); + ob_start(); + eval('?>' . $text); + $text = ob_get_contents(); + ob_end_clean(); + $ret .= $text; + $ret .= '
'; + return $ret; } /** diff -r bb4e677a4da9 -r d807dcd7aed7 includes/template.php --- a/includes/template.php Sat Aug 25 12:53:03 2007 -0400 +++ b/includes/template.php Sun Aug 26 16:48:15 2007 -0400 @@ -446,7 +446,7 @@ $ctmp = ' style="text-decoration: underline;"'; } $menubtn->assign_vars(array( - 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { ajaxSetWikiMode(1); return false; }" id="wikibtn_1" title="Forces wiki functions to be allowed on this page."'.$ctmp, + 'FLAGS' => /* 'onclick="if ( !KILL_SWITCH ) { ajaxSetWikiMode(1); return false; }" id="wikibtn_1" title="Forces wiki functions to be allowed on this page."'. */ $ctmp, 'HREF' => makeUrl($paths->page, 'do=setwikimode&level=1', true), 'TEXT' => 'on' )); @@ -459,7 +459,7 @@ $ctmp=' style="text-decoration: underline;"'; } $menubtn->assign_vars(array( - 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { ajaxSetWikiMode(0); return false; }" id="wikibtn_0" title="Forces wiki functions to be disabled on this page."'.$ctmp, + 'FLAGS' => /* 'onclick="if ( !KILL_SWITCH ) { ajaxSetWikiMode(0); return false; }" id="wikibtn_0" title="Forces wiki functions to be disabled on this page."'. */ $ctmp, 'HREF' => makeUrl($paths->page, 'do=setwikimode&level=0', true), 'TEXT' => 'off' )); @@ -472,7 +472,7 @@ $ctmp=' style="text-decoration: underline;"'; } $menubtn->assign_vars(array( - 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { ajaxSetWikiMode(2); return false; }" id="wikibtn_2" title="Causes this page to use the global wiki mode setting (default)"'.$ctmp, + 'FLAGS' => /* 'onclick="if ( !KILL_SWITCH ) { ajaxSetWikiMode(2); return false; }" id="wikibtn_2" title="Causes this page to use the global wiki mode setting (default)"'. */ $ctmp, 'HREF' => makeUrl($paths->page, 'do=setwikimode&level=2', true), 'TEXT' => 'global' )); diff -r bb4e677a4da9 -r d807dcd7aed7 plugins/SpecialAdmin.php --- a/plugins/SpecialAdmin.php Sat Aug 25 12:53:03 2007 -0400 +++ b/plugins/SpecialAdmin.php Sun Aug 26 16:48:15 2007 -0400 @@ -793,7 +793,7 @@ if(isset($_POST['go'])) { // We need the user ID before we can do anything - $q = $db->sql_query('SELECT user_id,username,email,real_name,style,user_level FROM '.table_prefix.'users WHERE username=\'' . $db->escape($_POST['username']) . '\''); + $q = $db->sql_query('SELECT user_id,username,email,real_name,style,user_level,account_active FROM '.table_prefix.'users WHERE username=\'' . $db->escape($_POST['username']) . '\''); if ( !$q ) { die('Error selecting user ID: '.mysql_error()); @@ -848,13 +848,30 @@ } } + // update account activation + if ( isset($_POST['account_active']) ) + { + // activate account + $q = $db->sql_query('UPDATE '.table_prefix.'users SET account_active=1 WHERE user_id=' . intval($r['user_id']) . ';'); + if ( !$q ) + $db->_die(); + } + else + { + // deactivate account and throw away the old key + $actkey = sha1 ( microtime() . mt_rand() ); + $q = $db->sql_query('UPDATE '.table_prefix.'users SET account_active=0,activation_key=\'' . $actkey . '\' WHERE user_id=' . intval($r['user_id']) . ';'); + if ( !$q ) + $db->_die(); + } + echo('
Your changes have been saved.
'); } else { echo('
Error saving changes: '.implode('
', $re).'
'); } - $q = $db->sql_query('SELECT user_id,username,email,real_name,style,user_level FROM '.table_prefix.'users WHERE username=\''.$db->escape($_POST['username']).'\''); + $q = $db->sql_query('SELECT user_id,username,email,real_name,style,user_level,account_active FROM '.table_prefix.'users WHERE username=\''.$db->escape($_POST['username']).'\''); if ( !$q ) { die('Error selecting user ID: '.mysql_error()); @@ -898,6 +915,7 @@ Real Name: ' . ( ( !empty($disabled) ) ? 'To change your e-mail address, password, or real name, please use the user control panel.' : '' ) . ' User level: +
If this is unchecked, the activation key will be reset, meaning that any activation e-mails sent will be invalidated. Delete user: