plugins/SpecialAdmin.php
changeset 329 0437a7cf1acc
parent 328 dc838fd61a06
child 334 c72b545f1304
equal deleted inserted replaced
328:dc838fd61a06 329:0437a7cf1acc
    55     echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
    55     echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
    56     echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
    56     echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
    57     return;
    57     return;
    58   }
    58   }
    59   
    59   
       
    60   if ( $paths->getParam(0) == 'updates.xml' )
       
    61   {
       
    62     require_once(ENANO_ROOT . '/includes/http.php');
       
    63     $req = new Request_HTTP('germantown.enanocms.org', '/meta/updates.xml');
       
    64     $response = $req->get_response_body();
       
    65     header('Content-type: application/xml');
       
    66     if ( $req->response_code != HTTP_OK )
       
    67     {
       
    68       // Error in response
       
    69       echo '<enano><latest><error><![CDATA[
       
    70 Did not properly receive response from server. Response code: ' . $req->response_code . ' ' . $req->response_string . '
       
    71 ]]></error></latest></enano>';
       
    72     }
       
    73     else
       
    74     {
       
    75       // Retrieve first update
       
    76       $first_update = preg_match('/<release tag="([^"]+)" version="([^"]+)" (codename="([^"]+)" )?relnotes="([^"]+)" ?\/>/', $response, $match);
       
    77       if ( !$first_update )
       
    78       {
       
    79         echo '<enano><latest><error><![CDATA[
       
    80 Received invalid XML response.
       
    81 ]]></error></latest></enano>';
       
    82       }
       
    83       if ( version_compare(enano_version(true), $match[2], '<') )
       
    84       {
       
    85         $response = str_replace_once('</latest>', "  <haveupdates />\n  </latest>", $response);
       
    86       }
       
    87       echo $response;
       
    88     }
       
    89     return;
       
    90   }
       
    91   
    60   // Basic information
    92   // Basic information
    61   echo RenderMan::render(
    93   echo RenderMan::render(
    62 '== Welcome to Runt, the Enano administration panel. ==
    94 '== Welcome to Runt, the Enano administration panel. ==
    63 
    95 
    64 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.
    96 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.
    75   // Check for the installer scripts
   107   // Check for the installer scripts
    76   if( ( file_exists(ENANO_ROOT.'/install.php') || file_exists(ENANO_ROOT.'/schema.sql') ) && !defined('ENANO_DEMO_MODE') )
   108   if( ( file_exists(ENANO_ROOT.'/install.php') || file_exists(ENANO_ROOT.'/schema.sql') ) && !defined('ENANO_DEMO_MODE') )
    77   {
   109   {
    78     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>';
   110     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>';
    79   }
   111   }
       
   112   
       
   113   echo '<h3>Check for updates</h3>';
       
   114   echo '<p>Periodically, new releases of Enano will be made available. Click the button below to check for updates to Enano. During this process, a request will be sent to the Enano CMS server (germantown.enanocms.org) over HTTP. No information about your Enano installation will be transmitted.</p>';
       
   115   echo '<div id="update_check_container"><input type="button" onclick="ajaxUpdateCheck(this.parentNode.id);" value="Check for updates" /></div>';
    80   
   116   
    81   // Inactive users
   117   // Inactive users
    82   $q = $db->sql_query('SELECT * FROM '.table_prefix.'logs WHERE log_type=\'admin\' AND action=\'activ_req\';');
   118   $q = $db->sql_query('SELECT * FROM '.table_prefix.'logs WHERE log_type=\'admin\' AND action=\'activ_req\';');
    83   if($q)
   119   if($q)
    84     if($db->numrows() > 0)
   120     if($db->numrows() > 0)