8 Author URI: http://enanocms.org/ |
8 Author URI: http://enanocms.org/ |
9 */ |
9 */ |
10 |
10 |
11 /* |
11 /* |
12 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
12 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
13 * Version 1.0 release candidate 2 |
13 * Version 1.0 release candidate 3 |
14 * Copyright (C) 2006-2007 Dan Fuhry |
14 * Copyright (C) 2006-2007 Dan Fuhry |
15 * |
15 * |
16 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
16 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
17 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
17 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
18 * |
18 * |
56 |
56 |
57 Thank you for choosing Enano as your CMS. This screen allows you to see some information about your website, plus some details about how your site is doing statistically. |
57 Thank you for choosing Enano as your CMS. This screen allows you to see some information about your website, plus some details about how your site is doing statistically. |
58 |
58 |
59 Using the links on the left you can control every aspect of your website\'s look and feel, plus you can manage users, work with pages, and install plugins to make your Enano installation even better.'); |
59 Using the links on the left you can control every aspect of your website\'s look and feel, plus you can manage users, work with pages, and install plugins to make your Enano installation even better.'); |
60 |
60 |
|
61 // Demo mode |
|
62 if ( defined('ENANO_DEMO_MODE') ) |
|
63 { |
|
64 echo '<h3>Enano is running in demo mode.</h3> |
|
65 <p>If you borked something up, or if you\'re done testing, you can <a href="' . makeUrlNS('Special', 'DemoReset', false, true) . '">reset this site</a>. The site is reset automatically once every two hours. When a reset is performed, all custom modifications to the site are lost and replaced with default values.</p>'; |
|
66 } |
|
67 |
61 // Check for the installer scripts |
68 // Check for the installer scripts |
62 if(file_exists(ENANO_ROOT.'/install.php') || file_exists(ENANO_ROOT.'/schema.sql')) |
69 if( ( file_exists(ENANO_ROOT.'/install.php') || file_exists(ENANO_ROOT.'/schema.sql') ) && !defined('ENANO_DEMO_MODE') ) |
63 { |
70 { |
64 echo '<div class="error-box"><b>NOTE:</b> It appears that your install.php and/or schema.sql files still exist. It is HIGHLY RECOMMENDED that you delete or rename these files, to prevent getting your server hacked.</div>'; |
71 echo '<div class="error-box"><b>NOTE:</b> It appears that your install.php and/or schema.sql files still exist. It is HIGHLY RECOMMENDED that you delete or rename these files, to prevent getting your server hacked.</div>'; |
65 } |
72 } |
66 |
73 |
67 // Inactive users |
74 // Inactive users |
139 { |
146 { |
140 echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
147 echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
141 return; |
148 return; |
142 } |
149 } |
143 |
150 |
144 if(isset($_POST['submit'])) { |
151 if(isset($_POST['submit']) && !defined('ENANO_DEMO_MODE') ) |
|
152 { |
145 |
153 |
146 // Global site options |
154 // Global site options |
147 setConfig('site_name', $_POST['site_name']); |
155 setConfig('site_name', $_POST['site_name']); |
148 setConfig('site_desc', $_POST['site_desc']); |
156 setConfig('site_desc', $_POST['site_desc']); |
149 setConfig('main_page', str_replace(' ', '_', $_POST['main_page'])); |
157 setConfig('main_page', str_replace(' ', '_', $_POST['main_page'])); |
211 setConfig('smtp_user', $_POST['smtp_user']); |
219 setConfig('smtp_user', $_POST['smtp_user']); |
212 if($_POST['smtp_pass'] != 'XXXXXXXXXXXX') setConfig('smtp_password', $_POST['smtp_pass']); |
220 if($_POST['smtp_pass'] != 'XXXXXXXXXXXX') setConfig('smtp_password', $_POST['smtp_pass']); |
213 |
221 |
214 echo '<div class="info-box">Your changes to the site configuration have been saved.</div><br />'; |
222 echo '<div class="info-box">Your changes to the site configuration have been saved.</div><br />'; |
215 |
223 |
|
224 } |
|
225 else if ( isset($_POST['submit']) && defined('ENANO_DEMO_MODE') ) |
|
226 { |
|
227 echo '<div class="error-box">Saving the general site configuration is blocked in the administration demo.</div>'; |
216 } |
228 } |
217 echo('<form name="main" action="'.htmlspecialchars(makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module'])).'" method="post" onsubmit="if(!submitAuthorized) return false;">'); |
229 echo('<form name="main" action="'.htmlspecialchars(makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module'])).'" method="post" onsubmit="if(!submitAuthorized) return false;">'); |
218 ?> |
230 ?> |
219 <div class="tblholder"> |
231 <div class="tblholder"> |
220 <table border="0" width="100%" cellspacing="1" cellpadding="4"> |
232 <table border="0" width="100%" cellspacing="1" cellpadding="4"> |
459 if(isset($_POST['cache_thumbs'])) setConfig('cache_thumbs', '1'); else setConfig('cache_thumbs', '0'); |
471 if(isset($_POST['cache_thumbs'])) setConfig('cache_thumbs', '1'); else setConfig('cache_thumbs', '0'); |
460 if(isset($_POST['file_history'])) setConfig('file_history', '1'); else setConfig('file_history', '0'); |
472 if(isset($_POST['file_history'])) setConfig('file_history', '1'); else setConfig('file_history', '0'); |
461 if(file_exists($_POST['imagemagick_path'])) setConfig('imagemagick_path', $_POST['imagemagick_path']); |
473 if(file_exists($_POST['imagemagick_path'])) setConfig('imagemagick_path', $_POST['imagemagick_path']); |
462 else echo '<span style="color: red"><b>Warning:</b> the file "'.$_POST['imagemagick_path'].'" was not found, and the ImageMagick file path was not updated.</span>'; |
474 else echo '<span style="color: red"><b>Warning:</b> the file "'.$_POST['imagemagick_path'].'" was not found, and the ImageMagick file path was not updated.</span>'; |
463 $max_upload = floor((float)$_POST['max_file_size'] * (int)$_POST['fs_units']); |
475 $max_upload = floor((float)$_POST['max_file_size'] * (int)$_POST['fs_units']); |
464 setConfig('max_file_size', $max_upload.''); |
476 if ( $max_upload > 1048576 && defined('ENANO_DEMO_MODE') ) |
|
477 { |
|
478 echo '<div class="error-box">Wouldn\'t want the server DoS\'ed now. Stick to under a megabyte for the demo, please.</div>'; |
|
479 } |
|
480 else |
|
481 { |
|
482 setConfig('max_file_size', $max_upload.''); |
|
483 } |
465 } |
484 } |
466 echo '<form name="main" action="'.htmlspecialchars(makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module'])).'" method="post">'; |
485 echo '<form name="main" action="'.htmlspecialchars(makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module'])).'" method="post">'; |
467 ?> |
486 ?> |
468 <h3>File upload configuration</h3> |
487 <h3>File upload configuration</h3> |
469 <p>Enano supports the ability to upload files to your website and store the files in the database. This enables you to embed images |
488 <p>Enano supports the ability to upload files to your website and store the files in the database. This enables you to embed images |
611 echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
635 echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
612 return; |
636 return; |
613 } |
637 } |
614 |
638 |
615 global $mime_types, $mimetype_exps, $mimetype_extlist; |
639 global $mime_types, $mimetype_exps, $mimetype_extlist; |
616 if(isset($_POST['save'])) |
640 if(isset($_POST['save']) && !defined('ENANO_DEMO_MODE')) |
617 { |
641 { |
618 $bits = ''; |
642 $bits = ''; |
619 $keys = array_keys($mime_types); |
643 $keys = array_keys($mime_types); |
620 foreach($keys as $i => $k) |
644 foreach($keys as $i => $k) |
621 { |
645 { |
623 else $bits .= '0'; |
647 else $bits .= '0'; |
624 } |
648 } |
625 $bits = compress_bitfield($bits); |
649 $bits = compress_bitfield($bits); |
626 setConfig('allowed_mime_types', $bits); |
650 setConfig('allowed_mime_types', $bits); |
627 echo '<div class="info-box">Your changes have been saved.</div>'; |
651 echo '<div class="info-box">Your changes have been saved.</div>'; |
|
652 } |
|
653 else if ( isset($_POST['save']) && defined('ENANO_DEMO_MODE') ) |
|
654 { |
|
655 echo '<div class="error-box">Hmm, enabling executables, are we? Tsk tsk. I\'d love to know what\'s in that EXE file you want to upload. OK, maybe you didn\'t enable EXEs. But nevertheless, changing allowed filetypes is disabled in the demo.</div>'; |
628 } |
656 } |
629 $allowed = fetch_allowed_extensions(); |
657 $allowed = fetch_allowed_extensions(); |
630 ?> |
658 ?> |
631 <h3>Allowed file types</h3> |
659 <h3>Allowed file types</h3> |
632 <p>Using the form below, you can decide which file types are allowed to be uploaded to this site.</p> |
660 <p>Using the form below, you can decide which file types are allowed to be uploaded to this site.</p> |
725 { |
753 { |
726 echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
754 echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
727 return; |
755 return; |
728 } |
756 } |
729 |
757 |
730 if(isset($_POST['go'])) { |
758 if(isset($_POST['go'])) |
|
759 { |
731 // We need the user ID before we can do anything |
760 // We need the user ID before we can do anything |
732 $q = $db->sql_query('SELECT user_id,username,email,real_name,style,user_level FROM '.table_prefix.'users WHERE username=\'' . $db->escape($_POST['username']) . '\''); |
761 $q = $db->sql_query('SELECT user_id,username,email,real_name,style,user_level FROM '.table_prefix.'users WHERE username=\'' . $db->escape($_POST['username']) . '\''); |
733 if(!$q) die('Error selecting user ID: '.mysql_error()); |
762 if ( !$q ) |
734 if($db->numrows() < 1) { echo('User does not exist, please enter another username.'); return; } |
763 { |
|
764 die('Error selecting user ID: '.mysql_error()); |
|
765 } |
|
766 if ( $db->numrows() < 1 ) |
|
767 { |
|
768 echo('User does not exist, please enter another username.'); |
|
769 return; |
|
770 } |
735 $r = $db->fetchrow(); |
771 $r = $db->fetchrow(); |
736 $db->free_result(); |
772 $db->free_result(); |
737 if(isset($_POST['save'])) |
773 if(isset($_POST['save'])) |
738 { |
774 { |
739 $_POST['level'] = intval($_POST['level']); |
775 $_POST['level'] = intval($_POST['level']); |
740 |
776 |
741 $new_level = $_POST['level']; |
777 $new_level = $_POST['level']; |
742 $old_level = intval($r['user_level']); |
778 $old_level = intval($r['user_level']); |
743 |
779 |
744 $re = $session->update_user((int)$r['user_id'], $_POST['new_username'], false, $_POST['new_pass'], $_POST['email'], $_POST['real_name'], false, $_POST['level']); |
780 if ( defined('ENANO_DEMO_MODE') ) |
|
781 { |
|
782 echo '<div class="error-box">You cannot delete or modify user accounts in demo mode - they are cleaned up once every two hours.</div>'; |
|
783 $re = Array('permission denied'); |
|
784 } |
|
785 else |
|
786 { |
|
787 $re = $session->update_user((int)$r['user_id'], $_POST['new_username'], false, $_POST['new_pass'], $_POST['email'], $_POST['real_name'], false, $_POST['level']); |
|
788 } |
745 |
789 |
746 if($re == 'success') |
790 if($re == 'success') |
747 { |
791 { |
748 |
792 |
749 if ( $new_level != $old_level ) |
793 if ( $new_level != $old_level ) |
815 <input type="submit" name="save" value="Save Changes" /></td></tr> |
866 <input type="submit" name="save" value="Save Changes" /></td></tr> |
816 </table> |
867 </table> |
817 </form> |
868 </form> |
818 '); |
869 '); |
819 } |
870 } |
820 } elseif(isset($_POST['clearsessions'])) { |
871 } |
821 // Get the current session information so the user doesn't get logged out |
872 else if(isset($_POST['clearsessions'])) |
822 $aes = new AESCrypt(); |
873 { |
823 $sk = md5($session->sid_super); |
874 if ( defined('ENANO_DEMO_MODE') ) |
824 $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); |
875 { |
825 if(!$qb) die('Error selecting session key info block B: '.$db->get_error()); |
876 echo '<div class="error-box">Sorry Charlie, no can do. You might mess up other people logged into the demo site.</div>'; |
826 if($db->numrows($qb) < 1) die('Error: cannot read admin session info block B, aborting table clear process'); |
877 } |
827 $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); |
878 else |
828 if(!$qa) die('Error selecting session key info block A: '.$db->get_error()); |
879 { |
829 if($db->numrows($qa) < 1) die('Error: cannot read user session info block A, aborting table clear process'); |
880 // Get the current session information so the user doesn't get logged out |
830 $ra = mysql_fetch_object($qa); |
881 $aes = new AESCrypt(); |
831 $rb = mysql_fetch_object($qb); |
882 $sk = md5($session->sid_super); |
832 $db->free_result($qa); |
883 $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); |
833 $db->free_result($qb); |
884 if(!$qb) die('Error selecting session key info block B: '.$db->get_error()); |
834 $db->sql_query('DELETE FROM '.table_prefix.'session_keys;'); |
885 if($db->numrows($qb) < 1) die('Error: cannot read admin session info block B, aborting table clear process'); |
835 $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.' )'); |
886 $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); |
836 echo(' |
887 if(!$qa) die('Error selecting session key info block A: '.$db->get_error()); |
837 <div class="info-box">The session key table has been cleared. Your database should be a little bit smaller now.</div> |
888 if($db->numrows($qa) < 1) die('Error: cannot read user session info block A, aborting table clear process'); |
838 '); |
889 $ra = mysql_fetch_object($qa); |
|
890 $rb = mysql_fetch_object($qb); |
|
891 $db->free_result($qa); |
|
892 $db->free_result($qb); |
|
893 $db->sql_query('DELETE FROM '.table_prefix.'session_keys;'); |
|
894 $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.' )'); |
|
895 echo(' |
|
896 <div class="info-box">The session key table has been cleared. Your database should be a little bit smaller now.</div> |
|
897 '); |
|
898 } |
839 } |
899 } |
840 echo(' |
900 echo(' |
841 <h3>User Management</h3> |
901 <h3>User Management</h3> |
842 <form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;"> |
902 <form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;"> |
843 <p>Username: '.$template->username_field('username').' <input type="submit" name="go" value="Go" /></p> |
903 <p>Username: '.$template->username_field('username').' <input type="submit" name="go" value="Go" /></p> |
1765 if(isset($_GET['action']) && $_GET['action'] == 'delete' && isset($_GET['id']) && $_GET['id'] != '') |
1825 if(isset($_GET['action']) && $_GET['action'] == 'delete' && isset($_GET['id']) && $_GET['id'] != '') |
1766 { |
1826 { |
1767 $e = $db->sql_query('DELETE FROM '.table_prefix.'banlist WHERE ban_id=' . $db->escape($_GET['id']) . ''); |
1827 $e = $db->sql_query('DELETE FROM '.table_prefix.'banlist WHERE ban_id=' . $db->escape($_GET['id']) . ''); |
1768 if(!$e) $db->_die('The ban list entry was not deleted.'); |
1828 if(!$e) $db->_die('The ban list entry was not deleted.'); |
1769 } |
1829 } |
1770 if(isset($_POST['create'])) |
1830 if(isset($_POST['create']) && !defined('ENANO_DEMO_MODE')) |
1771 { |
1831 { |
1772 $q = 'INSERT INTO '.table_prefix.'banlist(ban_type,ban_value,reason,is_regex) VALUES( ' . $db->escape($_POST['type']) . ', \'' . $db->escape($_POST['value']) . '\', \''.$db->escape($_POST['reason']).'\''; |
1832 $q = 'INSERT INTO '.table_prefix.'banlist(ban_type,ban_value,reason,is_regex) VALUES( ' . $db->escape($_POST['type']) . ', \'' . $db->escape($_POST['value']) . '\', \''.$db->escape($_POST['reason']).'\''; |
1773 if(isset($_POST['regex'])) $q .= ', 1'; |
1833 if(isset($_POST['regex'])) $q .= ', 1'; |
1774 else $q .= ', 0'; |
1834 else $q .= ', 0'; |
1775 $q .= ');'; |
1835 $q .= ');'; |
1776 $e = $db->sql_query($q); |
1836 $e = $db->sql_query($q); |
1777 if(!$e) $db->_die('The banlist could not be updated.'); |
1837 if(!$e) $db->_die('The banlist could not be updated.'); |
|
1838 } |
|
1839 else if ( isset($_POST['create']) && defined('ENANO_DEMO_MODE') ) |
|
1840 { |
|
1841 echo '<div class="error-box">This function is disabled in the demo. Just because <i>you</i> don\'t like ' . htmlspecialchars($_POST['value']) . ' doesn\'t mean <i>we</i> don\'t like ' . htmlspecialchars($_POST['value']) . '.</div>'; |
1778 } |
1842 } |
1779 $q = $db->sql_query('SELECT ban_id,ban_type,ban_value,is_regex FROM '.table_prefix.'banlist ORDER BY ban_type;'); |
1843 $q = $db->sql_query('SELECT ban_id,ban_type,ban_value,is_regex FROM '.table_prefix.'banlist ORDER BY ban_type;'); |
1780 if(!$q) $db->_die('The banlist data could not be selected.'); |
1844 if(!$q) $db->_die('The banlist data could not be selected.'); |
1781 echo '<table border="0" cellspacing="1" cellpadding="4">'; |
1845 echo '<table border="0" cellspacing="1" cellpadding="4">'; |
1782 echo '<tr><th>Type</th><th>Value</th><th>Regular Expression</th><th></th></tr>'; |
1846 echo '<tr><th>Type</th><th>Value</th><th>Regular Expression</th><th></th></tr>'; |
2020 global $db, $session, $paths, $template, $plugins; // Common objects |
2088 global $db, $session, $paths, $template, $plugins; // Common objects |
2021 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
2089 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
2022 { |
2090 { |
2023 echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
2091 echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
2024 return; |
2092 return; |
|
2093 } |
|
2094 |
|
2095 if(isset($_GET['submitting']) && $_GET['submitting'] == 'yes' && defined('ENANO_DEMO_MODE') ) |
|
2096 { |
|
2097 redirect(makeUrlComplete('Special', 'Administration'), 'Access denied', 'You\'ve got to be kidding me. Forget it, kid.', 4 ); |
2025 } |
2098 } |
2026 |
2099 |
2027 global $system_table_list; |
2100 global $system_table_list; |
2028 if(isset($_GET['submitting']) && $_GET['submitting'] == 'yes') |
2101 if(isset($_GET['submitting']) && $_GET['submitting'] == 'yes') |
2029 { |
2102 { |
2356 break; |
2429 break; |
2357 case BLOCK_PLUGIN: |
2430 case BLOCK_PLUGIN: |
2358 $content = $_POST['plugin_id']; |
2431 $content = $_POST['plugin_id']; |
2359 break; |
2432 break; |
2360 } |
2433 } |
|
2434 |
|
2435 if ( defined('ENANO_DEMO_MODE') ) |
|
2436 { |
|
2437 // Sanitize the HTML |
|
2438 $content = sanitize_html($content, true); |
|
2439 } |
|
2440 |
|
2441 if ( defined('ENANO_DEMO_MODE') && intval($_POST['type']) == BLOCK_PHP ) |
|
2442 { |
|
2443 echo '<div class="error-box" style="margin: 10px 0 10px 0;">Adding PHP code blocks in the Enano administration demo has been disabled for security reasons.</div>'; |
|
2444 $_POST['php_content'] = '?><Nulled>'; |
|
2445 $content = $_POST['php_content']; |
|
2446 } |
|
2447 |
2361 // Get the value of item_order |
2448 // Get the value of item_order |
2362 |
2449 |
2363 $q = $db->sql_query('SELECT * FROM '.table_prefix.'sidebar WHERE sidebar_id='.$db->escape($_POST['sidebar_id']).';'); |
2450 $q = $db->sql_query('SELECT * FROM '.table_prefix.'sidebar WHERE sidebar_id='.$db->escape($_POST['sidebar_id']).';'); |
2364 if(!$q) $db->_die('The order number could not be selected'); |
2451 if(!$q) $db->_die('The order number could not be selected'); |
2365 $io = $db->numrows(); |
2452 $io = $db->numrows(); |
2584 $db->free_result(); |
2675 $db->free_result(); |
2585 if($r['block_type'] == BLOCK_PLUGIN) die('HOUSTON_WE_HAVE_A_PLUGIN'); |
2676 if($r['block_type'] == BLOCK_PLUGIN) die('HOUSTON_WE_HAVE_A_PLUGIN'); |
2586 die($r['block_content']); |
2677 die($r['block_content']); |
2587 break; |
2678 break; |
2588 case 'save': |
2679 case 'save': |
|
2680 if ( defined('ENANO_DEMO_MODE') ) |
|
2681 { |
|
2682 $q = $db->sql_query('SELECT block_type FROM '.table_prefix.'sidebar WHERE item_id=' . $db->escape($_GET['id']) . ';'); |
|
2683 if(!$q) |
|
2684 { |
|
2685 echo 'var status=unescape(\''.hexencode($db->get_error()).'\');'; |
|
2686 exit; |
|
2687 } |
|
2688 $row = $db->fetchrow(); |
|
2689 if ( $row['block_type'] == BLOCK_PHP ) |
|
2690 { |
|
2691 $_POST['content'] = '?><Nulled>'; |
|
2692 } |
|
2693 else |
|
2694 { |
|
2695 $_POST['content'] = sanitize_html($_POST['content'], true); |
|
2696 } |
|
2697 } |
2589 $q = $db->sql_query('UPDATE '.table_prefix.'sidebar SET block_content=\''.$db->escape(rawurldecode($_POST['content'])).'\' WHERE item_id=' . $db->escape($_GET['id']) . ';'); |
2698 $q = $db->sql_query('UPDATE '.table_prefix.'sidebar SET block_content=\''.$db->escape(rawurldecode($_POST['content'])).'\' WHERE item_id=' . $db->escape($_GET['id']) . ';'); |
2590 if(!$q) |
2699 if(!$q) |
2591 { |
2700 { |
2592 echo 'var status=unescape(\''.hexencode($db->get_error()).'\');'; |
2701 echo 'var status=unescape(\''.hexencode($db->get_error()).'\');'; |
2593 exit; |
2702 exit; |