861 } |
861 } |
862 } |
862 } |
863 } |
863 } |
864 else |
864 else |
865 { |
865 { |
|
866 $disabled = ( $r['user_id'] == $session->user_id ) ? ' disabled="disabled" ' : ''; |
866 echo(' |
867 echo(' |
867 <h3>Edit User Info</h3> |
868 <h3>Edit User Info</h3> |
868 <form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post"> |
869 <form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post"> |
869 <table border="0" style="margin-left: 0.2in;"> |
870 <table border="0" style="margin-left: 0.2in;"> |
870 <tr><td>Username:</td><td><input type="text" name="new_username" value="'.$r['username'].'" /></td></tr> |
871 <tr><td>Username:</td><td><input type="text" name="new_username" value="'.$r['username'].'" /></td></tr> |
871 <tr><td>New Password:</td><td><input type="password" name="new_pass" /></td></tr> |
872 <tr><td>New Password:</td><td><input ' . $disabled . ' type="password" name="new_pass" /></td></tr> |
872 <tr><td>E-mail:</td><td><input type="text" name="email" value="'.$r['email'].'" /></td></tr> |
873 <tr><td>E-mail:</td><td><input ' . $disabled . ' type="text" name="email" value="'.$r['email'].'" /></td></tr> |
873 <tr><td>Real Name:</td><td><input type="text" name="real_name" value="'.$r['real_name'].'" /></td></tr> |
874 <tr><td>Real Name:</td><td><input ' . $disabled . ' type="text" name="real_name" value="'.$r['real_name'].'" /></td></tr> |
|
875 ' . ( ( !empty($disabled) ) ? '<tr><td colspan="2"><small>To change your e-mail address, password, or real name, please use the user control panel.</small></td></tr>' : '' ) . ' |
874 <tr><td>User level:</td><td><select name="level"><option '); if($r['user_level']==USER_LEVEL_CHPREF) echo('SELECTED'); echo(' value="'.USER_LEVEL_CHPREF.'">Regular User</option><option '); if($r['user_level']==USER_LEVEL_MOD) echo('SELECTED'); echo(' value="'.USER_LEVEL_MOD.'">Moderator</option><option '); if($r['user_level']==USER_LEVEL_ADMIN) echo('SELECTED'); echo(' value="'.USER_LEVEL_ADMIN.'">Administrator</option></select></td></tr> |
876 <tr><td>User level:</td><td><select name="level"><option '); if($r['user_level']==USER_LEVEL_CHPREF) echo('SELECTED'); echo(' value="'.USER_LEVEL_CHPREF.'">Regular User</option><option '); if($r['user_level']==USER_LEVEL_MOD) echo('SELECTED'); echo(' value="'.USER_LEVEL_MOD.'">Moderator</option><option '); if($r['user_level']==USER_LEVEL_ADMIN) echo('SELECTED'); echo(' value="'.USER_LEVEL_ADMIN.'">Administrator</option></select></td></tr> |
875 <tr><td>Delete user:</td><td><input type="hidden" name="go" /><input type="hidden" name="username" value="'.$r['username'].'" /><input onclick="return confirm(\'This is your last warning.\n\nAre you sure you want to delete this user account? Even if you delete this user account, the username will be shown in page edit history, comments, and other areas of the site.\n\nDeleting a user account CANNOT BE UNDONE and should only be done in extreme circumstances.\n\nIf the user has violated the site policy, deleting the account will not prevent him from using the site, for that you need to add a new ban rule.\n\nContinue deleting this user account?\')" type="submit" name="deleteme" value="Delete this user" style="color: red;" /> <label><input type="checkbox" name="delete_conf" /> I\'m absolutely sure</label> |
877 <tr><td>Delete user:</td><td><input type="hidden" name="go" /><input type="hidden" name="username" value="'.$r['username'].'" /><input onclick="return confirm(\'This is your last warning.\n\nAre you sure you want to delete this user account? Even if you delete this user account, the username will be shown in page edit history, comments, and other areas of the site.\n\nDeleting a user account CANNOT BE UNDONE and should only be done in extreme circumstances.\n\nIf the user has violated the site policy, deleting the account will not prevent him from using the site, for that you need to add a new ban rule.\n\nContinue deleting this user account?\')" type="submit" name="deleteme" value="Delete this user" style="color: red;" /> <label><input type="checkbox" name="delete_conf" /> I\'m absolutely sure</label> |
876 <tr><td align="center" colspan="2"> |
878 <tr><td align="center" colspan="2"> |
877 <input type="submit" name="save" value="Save Changes" /></td></tr> |
879 <input type="submit" name="save" value="Save Changes" /></td></tr> |
878 </table> |
880 </table> |
888 } |
890 } |
889 else |
891 else |
890 { |
892 { |
891 // Get the current session information so the user doesn't get logged out |
893 // Get the current session information so the user doesn't get logged out |
892 $aes = new AESCrypt(); |
894 $aes = new AESCrypt(); |
893 $sk = md5($session->sid_super); |
895 $sk = md5(strrev($session->sid_super)); |
894 $qb = $db->sql_query('SELECT session_key,salt,auth_level,source_ip,time FROM '.table_prefix.'session_keys WHERE session_key=\''.$sk.'\' AND user_id='.$session->user_id.' AND auth_level='.USER_LEVEL_ADMIN); |
896 $qb = $db->sql_query('SELECT session_key,salt,auth_level,source_ip,time FROM '.table_prefix.'session_keys WHERE session_key=\''.$sk.'\' AND user_id='.$session->user_id.' AND auth_level='.USER_LEVEL_ADMIN); |
895 if(!$qb) die('Error selecting session key info block B: '.$db->get_error()); |
897 if ( !$qb ) |
896 if($db->numrows($qb) < 1) die('Error: cannot read admin session info block B, aborting table clear process'); |
898 { |
|
899 die('Error selecting session key info block B: '.$db->get_error()); |
|
900 } |
|
901 if ( $db->numrows($qb) < 1 ) |
|
902 { |
|
903 die('Error: cannot read admin session info block B, aborting table clear process'); |
|
904 } |
897 $qa = $db->sql_query('SELECT session_key,salt,auth_level,source_ip,time FROM '.table_prefix.'session_keys WHERE session_key=\''.md5($session->sid).'\' AND user_id='.$session->user_id.' AND auth_level='.USER_LEVEL_MEMBER); |
905 $qa = $db->sql_query('SELECT session_key,salt,auth_level,source_ip,time FROM '.table_prefix.'session_keys WHERE session_key=\''.md5($session->sid).'\' AND user_id='.$session->user_id.' AND auth_level='.USER_LEVEL_MEMBER); |
898 if(!$qa) die('Error selecting session key info block A: '.$db->get_error()); |
906 if ( !$qa ) |
899 if($db->numrows($qa) < 1) die('Error: cannot read user session info block A, aborting table clear process'); |
907 { |
|
908 die('Error selecting session key info block A: '.$db->get_error()); |
|
909 } |
|
910 if ( $db->numrows($qa) < 1 ) |
|
911 { |
|
912 die('Error: cannot read user session info block A, aborting table clear process'); |
|
913 } |
900 $ra = mysql_fetch_object($qa); |
914 $ra = mysql_fetch_object($qa); |
901 $rb = mysql_fetch_object($qb); |
915 $rb = mysql_fetch_object($qb); |
902 $db->free_result($qa); |
916 $db->free_result($qa); |
903 $db->free_result($qb); |
917 $db->free_result($qb); |
|
918 |
904 $db->sql_query('DELETE FROM '.table_prefix.'session_keys;'); |
919 $db->sql_query('DELETE FROM '.table_prefix.'session_keys;'); |
905 $db->sql_query('INSERT INTO '.table_prefix.'session_keys( session_key,salt,user_id,auth_level,source_ip,time ) VALUES( \''.$ra->session_key.'\', \''.$ra->salt.'\', \''.$session->user_id.'\', \''.$ra->auth_level.'\', \''.$ra->source_ip.'\', '.$ra->time.' ),( \''.$rb->session_key.'\', \''.$rb->salt.'\', \''.$session->user_id.'\', \''.$rb->auth_level.'\', \''.$rb->source_ip.'\', '.$rb->time.' )'); |
920 $db->sql_query('INSERT INTO '.table_prefix.'session_keys( session_key,salt,user_id,auth_level,source_ip,time ) VALUES( \''.$ra->session_key.'\', \''.$ra->salt.'\', \''.$session->user_id.'\', \''.$ra->auth_level.'\', \''.$ra->source_ip.'\', '.$ra->time.' ),( \''.$rb->session_key.'\', \''.$rb->salt.'\', \''.$session->user_id.'\', \''.$rb->auth_level.'\', \''.$rb->source_ip.'\', '.$rb->time.' )'); |
|
921 |
906 echo(' |
922 echo(' |
907 <div class="info-box">The session key table has been cleared. Your database should be a little bit smaller now.</div> |
923 <div class="info-box">The session key table has been cleared. Your database should be a little bit smaller now.</div> |
908 '); |
924 '); |
909 } |
925 } |
910 } |
926 } |
1384 if(isset($_POST['page_id']) && isset($_POST['namespace']) && !isset($_POST['cancel'])) |
1400 if(isset($_POST['page_id']) && isset($_POST['namespace']) && !isset($_POST['cancel'])) |
1385 { |
1401 { |
1386 $cpage = $paths->pages[$paths->nslist[$_POST['namespace']].$_POST['old_page_id']]; |
1402 $cpage = $paths->pages[$paths->nslist[$_POST['namespace']].$_POST['old_page_id']]; |
1387 if(isset($_POST['submit'])) |
1403 if(isset($_POST['submit'])) |
1388 { |
1404 { |
1389 // Create a list of things to update |
1405 switch(true) |
1390 $page_info = Array( |
1406 { |
1391 'name'=>$_POST['name'], |
1407 case true: |
1392 'urlname'=>$_POST['page_id'], |
1408 // Create a list of things to update |
1393 'namespace'=>$_POST['namespace'], |
1409 $page_info = Array( |
1394 'special'=>isset($_POST['special']) ? '1' : '0', |
1410 'name'=>$_POST['name'], |
1395 'visible'=>isset($_POST['visible']) ? '1' : '0', |
1411 'urlname'=>sanitize_page_id($_POST['page_id']), |
1396 'comments_on'=>isset($_POST['comments_on']) ? '1' : '0', |
1412 'namespace'=>$_POST['namespace'], |
1397 'protected'=>isset($_POST['protected']) ? '1' : '0' |
1413 'special'=>isset($_POST['special']) ? '1' : '0', |
1398 ); |
1414 'visible'=>isset($_POST['visible']) ? '1' : '0', |
1399 // Build the query |
1415 'comments_on'=>isset($_POST['comments_on']) ? '1' : '0', |
1400 $q = 'UPDATE '.table_prefix.'pages SET '; |
1416 'protected'=>isset($_POST['protected']) ? '1' : '0' |
1401 $k = array_keys($page_info); |
1417 ); |
1402 foreach($k as $c) |
1418 |
1403 { |
1419 $updating_urlname_or_namespace = ( $page_info['namespace'] != $cpage['namespace'] || $page_info['urlname'] != $cpage['urlname'] ); |
1404 $q .= $c.'=\''.$db->escape($page_info[$c]).'\','; |
1420 |
1405 } |
1421 if ( !isset($paths->nslist[ $page_info['namespace'] ]) ) |
1406 $q = substr($q, 0, strlen($q)-1); |
1422 { |
1407 // Build the WHERE statements |
1423 echo '<div class="error-box">The namespace you selected is not properly registered.</div>'; |
1408 $q .= ' WHERE '; |
1424 break; |
1409 $k = array_keys($cpage); |
1425 } |
1410 foreach($k as $c) |
1426 if ( isset($paths->pages[ $paths->nslist[$page_info['namespace']] . $page_info[ 'urlname' ] ]) && $updating_urlname_or_namespace ) |
1411 { |
1427 { |
1412 if($c != 'urlname_nons' && $c != 'urlname' && $c != 'really_protected') $q .= $c.'=\''.$cpage[$c].'\' AND '; |
1428 echo '<div class="error-box">There is already a page that exists with that URL string and namespace.</div>'; |
1413 elseif($c == 'urlname') $q .= $c.'=\''.$cpage['urlname_nons'].'\' AND '; |
1429 break; |
1414 } |
1430 } |
1415 $q = substr($q, 0, strlen($q)-5) . ';'; |
1431 // Build the query |
1416 // Send the completed query to MySQL |
1432 $q = 'UPDATE '.table_prefix.'pages SET '; |
1417 $e = $db->sql_query($q); |
1433 $k = array_keys($page_info); |
1418 if(!$e) $db->_die('The page data could not be updated.'); |
1434 foreach($k as $c) |
1419 // Update any additional tables |
1435 { |
1420 $q = Array( |
1436 $q .= $c.'=\''.$db->escape($page_info[$c]).'\','; |
1421 'UPDATE '.table_prefix.'categories SET page_id=\''.$page_info['urlname'].'\',namespace=\''.$page_info['namespace'].'\' WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
1437 } |
1422 'UPDATE '.table_prefix.'comments SET page_id=\''.$page_info['urlname'].'\',namespace=\''.$page_info['namespace'].'\' WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
1438 $q = substr($q, 0, strlen($q)-1); |
1423 'UPDATE '.table_prefix.'logs SET page_id=\''.$page_info['urlname'].'\',namespace=\''.$page_info['namespace'].'\' WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
1439 // Build the WHERE statements |
1424 'UPDATE '.table_prefix.'page_text SET page_id=\''.$page_info['urlname'].'\',namespace=\''.$page_info['namespace'].'\' WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
1440 $q .= ' WHERE '; |
1425 ); |
1441 $k = array_keys($cpage); |
1426 foreach($q as $cq) |
1442 foreach($k as $c) |
1427 { |
1443 { |
1428 $e = $db->sql_query($cq); |
1444 if($c != 'urlname_nons' && $c != 'urlname' && $c != 'really_protected') |
1429 if(!$e) $db->_die('Some of the additional tables containing page information could not be updated.'); |
1445 { |
1430 } |
1446 $q .= $c.'=\''.$db->escape($cpage[$c]).'\' AND '; |
1431 // Update $cpage |
1447 } |
1432 $cpage = $page_info; |
1448 else if($c == 'urlname') |
1433 $cpage['urlname_nons'] = $cpage['urlname']; |
1449 { |
1434 $cpage['urlname'] = $paths->nslist[$cpage['namespace']].$cpage['urlname']; |
1450 $q .= $c.'=\''.$db->escape($cpage['urlname_nons']).'\' AND '; |
1435 $_POST['old_page_id'] = $page_info['urlname']; |
1451 } |
1436 $_POST['old_namespace'] = $page_info['namespace']; |
1452 } |
1437 echo '<div class="info-box">Your changes have been saved.</div>'; |
1453 // Trim off the last " AND " and append a semicolon |
|
1454 $q = substr($q, 0, strlen($q)-5) . ';'; |
|
1455 // Send the completed query to MySQL |
|
1456 $e = $db->sql_query($q); |
|
1457 if(!$e) $db->_die('The page data could not be updated.'); |
|
1458 // Update any additional tables |
|
1459 $q = Array( |
|
1460 'UPDATE '.table_prefix.'categories SET page_id=\''.$page_info['urlname'].'\',namespace=\''.$page_info['namespace'].'\' WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
|
1461 'UPDATE '.table_prefix.'comments SET page_id=\''.$page_info['urlname'].'\',namespace=\''.$page_info['namespace'].'\' WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
|
1462 'UPDATE '.table_prefix.'logs SET page_id=\''.$page_info['urlname'].'\',namespace=\''.$page_info['namespace'].'\' WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
|
1463 'UPDATE '.table_prefix.'page_text SET page_id=\''.$page_info['urlname'].'\',namespace=\''.$page_info['namespace'].'\' WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
|
1464 ); |
|
1465 foreach($q as $cq) |
|
1466 { |
|
1467 $e = $db->sql_query($cq); |
|
1468 if(!$e) $db->_die('Some of the additional tables containing page information could not be updated.'); |
|
1469 } |
|
1470 // Update $cpage |
|
1471 $cpage = $page_info; |
|
1472 $cpage['urlname_nons'] = $cpage['urlname']; |
|
1473 $cpage['urlname'] = $paths->nslist[$cpage['namespace']].$cpage['urlname']; |
|
1474 $_POST['old_page_id'] = $page_info['urlname']; |
|
1475 $_POST['old_namespace'] = $page_info['namespace']; |
|
1476 echo '<div class="info-box">Your changes have been saved.</div>'; |
|
1477 break; |
|
1478 } |
1438 } elseif(isset($_POST['delete'])) { |
1479 } elseif(isset($_POST['delete'])) { |
1439 $q = Array( |
1480 $q = Array( |
1440 'DELETE FROM '.table_prefix.'categories WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
1481 'DELETE FROM '.table_prefix.'categories WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
1441 'DELETE FROM '.table_prefix.'comments WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
1482 'DELETE FROM '.table_prefix.'comments WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
1442 'DELETE FROM '.table_prefix.'logs WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
1483 'DELETE FROM '.table_prefix.'logs WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
1458 ?> |
1499 ?> |
1459 <h3>Modify page: <?php echo $_POST['name']; ?></h3> |
1500 <h3>Modify page: <?php echo $_POST['name']; ?></h3> |
1460 <table border="0"> |
1501 <table border="0"> |
1461 <tr><td>Namespace:</td><td><select name="namespace"><?php $nm = array_keys($paths->nslist); foreach($nm as $ns) { if($ns != 'Special' && $ns != 'Admin') { echo '<option '; if($_POST['namespace']==$ns) echo 'selected="selected" '; echo 'value="'.$ns.'">'; if($paths->nslist[$ns] == '') echo '[No prefix]'; else echo $paths->nslist[$ns]; echo '</option>'; } } ?></select></td></tr> |
1502 <tr><td>Namespace:</td><td><select name="namespace"><?php $nm = array_keys($paths->nslist); foreach($nm as $ns) { if($ns != 'Special' && $ns != 'Admin') { echo '<option '; if($_POST['namespace']==$ns) echo 'selected="selected" '; echo 'value="'.$ns.'">'; if($paths->nslist[$ns] == '') echo '[No prefix]'; else echo $paths->nslist[$ns]; echo '</option>'; } } ?></select></td></tr> |
1462 <tr><td>Page title:</td><td><input type="text" name="name" value="<?php echo $cpage['name']; ?>" /></td></tr> |
1503 <tr><td>Page title:</td><td><input type="text" name="name" value="<?php echo $cpage['name']; ?>" /></td></tr> |
1463 <tr><td>Page URL string:<br /><small>No spaces, and don't enter the namespace prefix (e.g. User:).<br />Changing this value is usually not a good idea, especially for templates and project pages.</small></td><td><input type="text" name="page_id" value="<?php echo $cpage['urlname_nons']; ?>" /></td></tr> |
1504 <tr><td>Page URL string:<br /><small>No spaces, and don't enter the namespace prefix (e.g. User:).<br />Changing this value is usually not a good idea, especially for templates and project pages.</small></td><td><input type="text" name="page_id" value="<?php echo htmlspecialchars(dirtify_page_id($cpage['urlname_nons'])); ?>" /></td></tr> |
1464 <tr><td></td><td><input <?php if($cpage['comments_on']) echo 'checked="checked"'; ?> name="comments_on" type="checkbox" id="cmt" /> <label for="cmt">Enable comments for this page</label></td></tr> |
1505 <tr><td></td><td><input <?php if($cpage['comments_on']) echo 'checked="checked"'; ?> name="comments_on" type="checkbox" id="cmt" /> <label for="cmt">Enable comments for this page</label></td></tr> |
1465 <tr><td></td><td><input <?php if($cpage['special']) echo 'checked="checked"'; ?> name="special" type="checkbox" id="spc" /> <label for="spc">Bypass the template engine for this page</label><br /><small>This option enables you to use your own HTML headers and other code. It is recommended that only advanced users enable this feature. As with other Enano pages, you may use PHP code in your pages, meaning you can use Enano's API on the page.</small></td></tr> |
1506 <tr><td></td><td><input <?php if($cpage['special']) echo 'checked="checked"'; ?> name="special" type="checkbox" id="spc" /> <label for="spc">Bypass the template engine for this page</label><br /><small>This option enables you to use your own HTML headers and other code. It is recommended that only advanced users enable this feature. As with other Enano pages, you may use PHP code in your pages, meaning you can use Enano's API on the page.</small></td></tr> |
1466 <tr><td></td><td><input <?php if($cpage['visible']) echo 'checked="checked"'; ?> name="visible" type="checkbox" id="vis" /> <label for="vis">Allow this page to be shown in page lists</label><br /><small>Unchecking this checkbox prevents the page for being indexed for searching. The index is rebuilt each time a page is saved, and you can force an index rebuild by going to the page <?php echo $paths->nslist['Special']; ?>SearchRebuild.</small></td></tr> |
1507 <tr><td></td><td><input <?php if($cpage['visible']) echo 'checked="checked"'; ?> name="visible" type="checkbox" id="vis" /> <label for="vis">Allow this page to be shown in page lists</label><br /><small>Unchecking this checkbox prevents the page for being indexed for searching. The index is rebuilt each time a page is saved, and you can force an index rebuild by going to the page <?php echo $paths->nslist['Special']; ?>SearchRebuild.</small></td></tr> |
1467 <tr><td></td><td><input <?php if($cpage['protected']) echo 'checked="checked"'; ?> name="protected" type="checkbox" id="prt" /> <label for="prt">Prevent non-administrators from editing this page</label><br /><small>This option only has an effect when Wiki Mode is enabled.</small></td></tr> |
1508 <tr><td></td><td><input <?php if($cpage['protected']) echo 'checked="checked"'; ?> name="protected" type="checkbox" id="prt" /> <label for="prt">Prevent non-administrators from editing this page</label><br /><small>This option only has an effect when Wiki Mode is enabled.</small></td></tr> |
1468 <tr><td></td><td><input type="submit" name="delete" value="Delete page" style="color: red" onclick="return confirm('Do you REALLY want to delete this page?')" /></td></tr> |
1509 <tr><td></td><td><input type="submit" name="delete" value="Delete page" style="color: red" onclick="return confirm('Do you REALLY want to delete this page?')" /></td></tr> |