plugins/SpecialAdmin.php
changeset 741 a216e412c439
parent 731 8e6dbf6882c2
child 792 b55b87e5fafd
equal deleted inserted replaced
740:098e744df928 741:a216e412c439
   244   {
   244   {
   245     
   245     
   246     // Global site options
   246     // Global site options
   247     setConfig('site_name', $_POST['site_name']);
   247     setConfig('site_name', $_POST['site_name']);
   248     setConfig('site_desc', $_POST['site_desc']);
   248     setConfig('site_desc', $_POST['site_desc']);
   249     setConfig('main_page', str_replace(' ', '_', $_POST['main_page']));
   249     setConfig('main_page', sanitize_page_id($_POST['main_page']));
   250     setConfig('copyright_notice', $_POST['copyright']);
   250     setConfig('copyright_notice', $_POST['copyright']);
   251     setConfig('contact_email', $_POST['contact_email']);
   251     setConfig('contact_email', $_POST['contact_email']);
       
   252     
       
   253     setConfig('main_page_alt_enable', ( isset($_POST['main_page_alt_enable']) && $_POST['main_page_alt_enable'] === '1' ? '1' : '0' ));
       
   254     if ( !empty($_POST['main_page_alt']) )
       
   255     {
       
   256       setConfig('main_page_alt', sanitize_page_id($_POST['main_page_alt']));
       
   257     }
   252     
   258     
   253     // Wiki mode
   259     // Wiki mode
   254     if(isset($_POST['wikimode']))                setConfig('wiki_mode', '1');
   260     if(isset($_POST['wikimode']))                setConfig('wiki_mode', '1');
   255     else                                         setConfig('wiki_mode', '0');
   261     else                                         setConfig('wiki_mode', '0');
   256     if(isset($_POST['wiki_mode_require_login'])) setConfig('wiki_mode_require_login', '1');
   262     if(isset($_POST['wiki_mode_require_login'])) setConfig('wiki_mode_require_login', '1');
   411     <table border="0" width="100%" cellspacing="1" cellpadding="4">
   417     <table border="0" width="100%" cellspacing="1" cellpadding="4">
   412       
   418       
   413     <!-- Global options -->
   419     <!-- Global options -->
   414     
   420     
   415       <tr><th colspan="2"><?php echo $lang->get('acpgc_heading_main'); ?></th></tr>
   421       <tr><th colspan="2"><?php echo $lang->get('acpgc_heading_main'); ?></th></tr>
   416       <tr><th colspan="2" class="subhead"><?php echo $lang->get('acpgc_heading_submain'); ?></th></tr>
   422       
   417       
   423       <tr>
   418       <tr><td class="row1" style="width: 50%;"><?php echo $lang->get('acpgc_field_site_name'); ?></td>  <td class="row1" style="width: 50%;"><input type="text" name="site_name" size="30" value="<?php echo htmlspecialchars(getConfig('site_name')); ?>" /></td></tr>
   424         <th colspan="2" class="subhead"><?php echo $lang->get('acpgc_heading_submain'); ?></th>
   419       <tr><td class="row2"><?php echo $lang->get('acpgc_field_site_desc'); ?></td>               <td class="row2"><input type="text" name="site_desc" size="30" value="<?php echo htmlspecialchars(getConfig('site_desc')); ?>" /></td></tr>
   425       </tr>
   420       <tr><td class="row1"><?php echo $lang->get('acpgc_field_main_page'); ?></td>                      <td class="row1"><?php echo $template->pagename_field('main_page', sanitize_page_id(getConfig('main_page'))); ?></td></tr>
   426       
   421       <tr><td class="row2"><?php echo $lang->get('acpgc_field_copyright'); ?></td><td class="row2"><input type="text" name="copyright" size="30" value="<?php echo htmlspecialchars(getConfig('copyright_notice')); ?>" /></td></tr>
   427       <!-- site name -->
   422       <tr><td class="row1" colspan="2"><?php echo $lang->get('acpgc_field_copyright_hint'); ?></td></tr>
   428       
   423       <tr><td class="row2"><?php echo $lang->get('acpgc_field_contactemail'); ?><br /><small><?php echo $lang->get('acpgc_field_contactemail_hint'); ?></small></td><td class="row2"><input name="contact_email" type="text" size="40" value="<?php echo htmlspecialchars(getConfig('contact_email')); ?>" /></td></tr>
   429       <tr>
       
   430         <td class="row1" style="width: 50%;">
       
   431           <?php echo $lang->get('acpgc_field_site_name'); ?>
       
   432         </td>
       
   433         <td class="row1" style="width: 50%;">
       
   434           <input type="text" name="site_name" size="30" value="<?php echo htmlspecialchars(getConfig('site_name')); ?>" />
       
   435         </td>
       
   436       </tr>
       
   437       
       
   438       <!-- site tagline -->
       
   439       <tr>
       
   440         <td class="row2">
       
   441           <?php echo $lang->get('acpgc_field_site_desc'); ?>
       
   442         </td>
       
   443         <td class="row2">
       
   444           <input type="text" name="site_desc" size="30" value="<?php echo htmlspecialchars(getConfig('site_desc')); ?>" />
       
   445         </td>
       
   446       </tr>
       
   447       
       
   448       <!-- main page -->
       
   449       <tr>
       
   450         <td class="row1">
       
   451           <?php echo $lang->get('acpgc_field_main_page'); ?></td>
       
   452         <td class="row1">
       
   453           <?php echo $template->pagename_field('main_page', sanitize_page_id(getConfig('main_page'))); ?><br />
       
   454             <label><input type="radio" name="main_page_alt_enable" value="0" onclick="$('#main_page_alt_tr').hide();" <?php if ( getConfig('main_page_alt_enable', '0') == '0' ) echo 'checked="checked" '; ?>/> <?php echo $lang->get('acpgc_field_main_page_option_same'); ?></label><br />
       
   455             <label><input type="radio" name="main_page_alt_enable" value="1" onclick="$('#main_page_alt_tr').show();" <?php if ( getConfig('main_page_alt_enable', '0') == '1' ) echo 'checked="checked" '; ?>/> <?php echo $lang->get('acpgc_field_main_page_option_members'); ?></label>
       
   456         </td>
       
   457       </tr>
       
   458       <tr id="main_page_alt_tr"<?php if ( getConfig('main_page_alt_enable', '0') == '0' ) echo ' style="display: none;"'; ?>>
       
   459         <td class="row3">
       
   460           <?php echo $lang->get('acpgc_field_main_page_members'); ?>
       
   461         </td>
       
   462         <td class="row3">
       
   463           <?php echo $template->pagename_field('main_page_alt', sanitize_page_id(getConfig('main_page_alt', /* default alt to current main page */ getConfig('main_page', 'Main_Page')))); ?>
       
   464         </td>
       
   465       </tr>
       
   466       
       
   467       <!-- copyright notice -->
       
   468       <tr>
       
   469         <td class="row2">
       
   470             <?php echo $lang->get('acpgc_field_copyright'); ?>
       
   471         </td>
       
   472         <td class="row2">
       
   473           <input type="text" name="copyright" size="30" value="<?php echo htmlspecialchars(getConfig('copyright_notice')); ?>" />
       
   474         </td>
       
   475       </tr>
       
   476       <tr>
       
   477         <td class="row1" colspan="2">
       
   478           <?php echo $lang->get('acpgc_field_copyright_hint'); ?>
       
   479         </td>
       
   480       </tr>
       
   481       
       
   482       <!-- contact e-mail -->
       
   483       <tr>
       
   484         <td class="row2">
       
   485           <?php echo $lang->get('acpgc_field_contactemail'); ?><br />
       
   486           <small><?php echo $lang->get('acpgc_field_contactemail_hint'); ?></small>
       
   487         </td>
       
   488         <td class="row2">
       
   489           <input name="contact_email" type="text" size="40" value="<?php echo htmlspecialchars(getConfig('contact_email')); ?>" />
       
   490         </td>
       
   491       </tr>
   424       
   492       
   425     <!-- Wiki mode -->
   493     <!-- Wiki mode -->
   426       
   494       
   427       <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_wikimode'); ?></th></tr>
   495       <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_wikimode'); ?></th></tr>
   428       
   496       
  2082     return;
  2150     return;
  2083   }
  2151   }
  2084   
  2152   
  2085   $session->logout(USER_LEVEL_ADMIN);
  2153   $session->logout(USER_LEVEL_ADMIN);
  2086   echo '<h3>' . $lang->get('acplo_heading_main') . '</h3>
  2154   echo '<h3>' . $lang->get('acplo_heading_main') . '</h3>
  2087          <p>' . $lang->get('acplo_msg_logout_complete', array('mainpage_link' => makeUrl(getConfig('main_page')))) . '</p>';
  2155          <p>' . $lang->get('acplo_msg_logout_complete', array('mainpage_link' => makeUrl(get_main_page()))) . '</p>';
  2088 }
  2156 }
  2089 
  2157 
  2090 function page_Special_Administration()
  2158 function page_Special_Administration()
  2091 {
  2159 {
  2092   global $db, $session, $paths, $template, $plugins; // Common objects
  2160   global $db, $session, $paths, $template, $plugins; // Common objects
  2532             </p>
  2600             </p>
  2533             
  2601             
  2534           </form>
  2602           </form>
  2535           
  2603           
  2536           <script type="text/javascript">
  2604           <script type="text/javascript">
  2537             var divs = getElementsByClassName(document, 'div', 'sbadd_block');
  2605             addOnloadHook(function()
  2538             for(var i in divs)
  2606               {
  2539             {
  2607                 var divs = getElementsByClassName(document, 'div', 'sbadd_block');
  2540               if(divs[i].id != 'blocktype_<?php echo BLOCK_WIKIFORMAT; ?>') setTimeout("document.getElementById('"+divs[i].id+"').style.display = 'none';", 500);
  2608                 for(var i in divs)
  2541             }
  2609                 {
       
  2610                   if(divs[i].id != 'blocktype_<?php echo BLOCK_WIKIFORMAT; ?>') setTimeout("document.getElementById('"+divs[i].id+"').style.display = 'none';", 500);
       
  2611                 }
       
  2612               });
  2542           </script>
  2613           </script>
  2543           
  2614           
  2544           <?php
  2615           <?php
  2545           $template->footer();
  2616           $template->footer();
  2546           return;
  2617           return;
  2767           ob_end_clean();
  2838           ob_end_clean();
  2768           $c = preg_replace('#<a (.*?)>(.*?)</a>#is', '<a href="#" onclick="return false;">\\2</a>', $c);
  2839           $c = preg_replace('#<a (.*?)>(.*?)</a>#is', '<a href="#" onclick="return false;">\\2</a>', $c);
  2769           break;
  2840           break;
  2770         case BLOCK_PLUGIN:
  2841         case BLOCK_PLUGIN:
  2771           $parser = $template->makeParserText($vars['sidebar_section_raw']);
  2842           $parser = $template->makeParserText($vars['sidebar_section_raw']);
  2772           $c = ($template->fetch_block($row['block_content'])) ? $template->fetch_block($row['block_content']) : $lang->get('sbedit_msg_plugin_not_loaded');
  2843           $c = ($template->fetch_block($row['block_content'], true)) ? $template->fetch_block($row['block_content'], true) : $lang->get('sbedit_msg_plugin_not_loaded');
       
  2844           
  2773           break;
  2845           break;
  2774       }
  2846       }
  2775       $c = preg_replace('/\{(restrict|hideif) ([a-z0-9_\(\)\|&! ]+)\}/', '', $c);
  2847       $c = preg_replace('/\{(restrict|hideif) ([a-z0-9_\(\)\|&! ]+)\}/', '', $c);
  2776       $block_name = $row['block_name']; // $template->tplWikiFormat($row['block_name']);
  2848       $block_name = $row['block_name']; // $template->tplWikiFormat($row['block_name']);
  2777       if ( empty($block_name) )
  2849       if ( empty($block_name) )
  2802     echo '
  2874     echo '
  2803           <div style="margin: 0 auto 0 auto; text-align: center;">
  2875           <div style="margin: 0 auto 0 auto; text-align: center;">
  2804             <input type="submit" name="save" style="font-weight: bold;" value="' . $lang->get('etc_save_changes') . '" />
  2876             <input type="submit" name="save" style="font-weight: bold;" value="' . $lang->get('etc_save_changes') . '" />
  2805             <input type="submit" name="revert" style="font-weight: normal;" value="' . $lang->get('sbedit_btn_revert') . '" onclick="return confirm($lang.get(\'sbedit_msg_discard_order_confirm\'))" />
  2877             <input type="submit" name="revert" style="font-weight: normal;" value="' . $lang->get('sbedit_btn_revert') . '" onclick="return confirm($lang.get(\'sbedit_msg_discard_order_confirm\'))" />
  2806             <br />
  2878             <br />
  2807             <a href="'.makeUrl($paths->page, 'action=new&id=0', true).'">' . $lang->get('sbedit_btn_create_new_stage1') . '</a>  |  <a href="'.makeUrl(getConfig('main_page'), false, true).'">' . $lang->get('sbedit_btn_main_page') . '</a>
  2879             <a href="'.makeUrl($paths->page, 'action=new&id=0', true).'">' . $lang->get('sbedit_btn_create_new_stage1') . '</a>  |  <a href="'.makeUrl(get_main_page(), false, true).'">' . $lang->get('sbedit_btn_main_page') . '</a>
  2808           </div>
  2880           </div>
  2809         </form>
  2881         </form>
  2810          ';
  2882          ';
  2811   }
  2883   }
  2812   
  2884