plugins/SpecialAdmin.php
changeset 1226 de56132c008d
parent 1175 1e2c9819ede3
child 1227 bdac73ed481e
equal deleted inserted replaced
1225:4c6da61e613e 1226:de56132c008d
    80     echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
    80     echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
    81     echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
    81     echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
    82     return;
    82     return;
    83   }
    83   }
    84   
    84   
       
    85   // FIXME: is this a bad place for this? I couldn't think of anything much better. Not helped by the fact that I hate misc scripts.
       
    86   if ( isset($_POST['act']) && $_POST['act'] === 'gzip_check' )
       
    87   {
       
    88     global $is_https;
       
    89     header('Content-type: application/json');
       
    90     require(ENANO_ROOT . '/includes/http.php');
       
    91     try
       
    92     {
       
    93       if ( !isset($_SERVER['SERVER_ADDR']) )
       
    94         throw new Exception('No SERVER_ADDR support - can\'t test server environment');
       
    95       
       
    96       $server_addr = $_SERVER['SERVER_ADDR'];
       
    97       // cheap ipv6 test
       
    98       if ( strstr($server_addr, ":") )
       
    99         $server_addr = "[$server_addr]";
       
   100       
       
   101       $req = new Request_HTTP($server_addr, makeUrlNS('System', 'GzipTest', 'disable_builtin_gzip'), 'GET', intval($_SERVER['SERVER_PORT']), $is_https);
       
   102       $req->add_header('Accept-Encoding', 'gzip,deflate');
       
   103       $headers = $req->get_response_headers_array();
       
   104       $send = array(
       
   105           'server_does_it' => ( isset($headers['Content-encoding']) && in_array($headers['Content-encoding'], array('gzip', 'deflate')) ),
       
   106           'php_supports_gzip' => function_exists('gzdeflate')
       
   107         );
       
   108     }
       
   109     catch ( Exception $e )
       
   110     {
       
   111       $send = array(
       
   112         'mode' => 'error',
       
   113         'error' => "HTTP request exception: <pre>$e</pre>"
       
   114         );
       
   115     }
       
   116     echo enano_json_encode($send);
       
   117     return;
       
   118   }
       
   119   
    85   if(isset($_POST['submit']) && !defined('ENANO_DEMO_MODE') )
   120   if(isset($_POST['submit']) && !defined('ENANO_DEMO_MODE') )
    86   {
   121   {
    87     
   122     
    88     // Global site options
   123     // Global site options
    89     setConfig('site_name', $_POST['site_name']);
   124     setConfig('site_name', $_POST['site_name']);
   234     }
   269     }
   235     
   270     
   236     setConfig('avatar_directory', 'files/avatars');
   271     setConfig('avatar_directory', 'files/avatars');
   237     
   272     
   238     setConfig('userpage_grant_acl', ( isset($_POST['userpage_grant_acl']) ? '1' : '0' ));
   273     setConfig('userpage_grant_acl', ( isset($_POST['userpage_grant_acl']) ? '1' : '0' ));
       
   274     setConfig('gzip_output', ( isset($_POST['gzip_output']) ? '1' : '0' ));
   239     
   275     
   240     // Allow plugins to save their changes
   276     // Allow plugins to save their changes
   241     $code = $plugins->setHook('acp_general_save');
   277     $code = $plugins->setHook('acp_general_save');
   242     foreach ( $code as $cmd )
   278     foreach ( $code as $cmd )
   243     {
   279     {
   494     
   530     
   495       <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_default_theme'); ?></th></tr>
   531       <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_default_theme'); ?></th></tr>
   496       
   532       
   497       <tr>
   533       <tr>
   498         <td class="row2">
   534         <td class="row2">
   499           <?php echo $lang->get('acpgc_field_defualt_theme'); ?>
   535           <?php echo $lang->get('acpgc_field_default_theme'); ?>
   500         </td>
   536         </td>
   501         <td class="row2">
   537         <td class="row2">
   502           <select name="default_theme">
   538           <select name="default_theme">
   503           <?php
   539           <?php
   504               foreach ( $template->named_theme_list as $theme_id => $theme_data )
   540               foreach ( $template->named_theme_list as $theme_id => $theme_data )
   548             <small><?php echo $lang->get('acpgc_field_cdn_path_example'); ?></small>
   584             <small><?php echo $lang->get('acpgc_field_cdn_path_example'); ?></small>
   549           </p>
   585           </p>
   550         </td>
   586         </td>
   551         <td class="row2">
   587         <td class="row2">
   552           <input type="text" name="cdn_path" value="<?php echo htmlspecialchars(getConfig('cdn_path', '')); ?>" style="width: 98%;" />
   588           <input type="text" name="cdn_path" value="<?php echo htmlspecialchars(getConfig('cdn_path', '')); ?>" style="width: 98%;" />
       
   589         </td>
       
   590       </tr>
       
   591       
       
   592     <!-- Gzip -->
       
   593     
       
   594       <tr>
       
   595         <td class="row1">
       
   596           <b><?php echo $lang->get('acpgc_field_gzip'); ?></b><br />
       
   597           <small><?php echo $lang->get('acpgc_field_gzip_hint'); ?></small><br />
       
   598           <br />
       
   599           <a href="#" onclick="ajaxGzipCheck(); return false;"><?php echo $lang->get('acpgc_field_gzip_btn_check'); ?></a>
       
   600         </td>
       
   601         <td class="row1">
       
   602           <div id="gzip_check_result"></div>
       
   603           <label>
       
   604             <input type="checkbox" name="gzip_output" <?php if ( getConfig('gzip_output', false) == 1 ) echo 'checked="checked" '; ?>/>
       
   605             <?php echo $lang->get('acpgc_field_gzip_lbl'); ?>
       
   606           </label>
   553         </td>
   607         </td>
   554       </tr>
   608       </tr>
   555       
   609       
   556     <!-- Allow plugins to add code -->
   610     <!-- Allow plugins to add code -->
   557       <?php
   611       <?php