Esempio n. 1
0
	background:#fff2a3;
	color:#4d4931;


}


</style>

</head>
<body>
<div class="wrapper">

<?php 
new gp_install();
echo common::ErrorBuffer(false);
echo '</div>';
echo '</body></html>';
//Install Class
class gp_install
{
    var $can_write_data = true;
    var $ftp_root = false;
    var $root_mode;
    function __construct()
    {
        global $languages, $install_language, $langmessage;
        //language preferences
        $install_language = 'en';
        if (isset($_GET['lang']) && isset($languages[$_GET['lang']])) {
            $install_language = $_GET['lang'];
Esempio n. 2
0
 /**
  * Complete the response by adding final content to the <head> of the document
  * @static
  * @since 2.4.1
  * @param string $buffer html content
  * @return string finalized response
  */
 static function BufferOut($buffer)
 {
     global $config, $gp_head_content, $addonFolderName, $dataDir, $addon_current_id, $wbErrorBuffer;
     //add error notice if there was a fatal error
     if (!ini_get('display_errors') && function_exists('error_get_last')) {
         //check for fatal error
         $fatal_errors = array(E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR);
         $last_error = error_get_last();
         if (is_array($last_error) && in_array($last_error['type'], $fatal_errors)) {
             $last_error['request'] = $_SERVER['REQUEST_URI'];
             if ($addon_current_id) {
                 $last_error['addon_name'] = $config['addons'][$addonFolderName]['name'];
                 $last_error['addon_id'] = $addon_current_id;
             }
             $last_error['file'] = realpath($last_error['file']);
             //may be redundant
             showError($last_error['type'], $last_error['message'], $last_error['file'], $last_error['line'], false);
             //send error to logger
             $reload = false;
             //disable execution
             if (count(self::$catchable)) {
                 $last_error['time'] = time();
                 $last_error['request_method'] = $_SERVER['REQUEST_METHOD'];
                 if (!empty($last_error['file'])) {
                     $last_error['file_modified'] = filemtime($last_error['file']);
                     $last_error['file_size'] = filesize($last_error['file']);
                 }
                 //error text, check for existing fatal notice
                 if (count(self::$fatal_notices)) {
                     $content = end(self::$fatal_notices);
                     reset(self::$fatal_notices);
                     if ($content[0] == '{' && ($temp = json_decode($content, true))) {
                         $last_error = $temp;
                     }
                 } else {
                     $content = json_encode($last_error);
                 }
                 //$buffer .= pre(self::$catchable).'<hr/>';
                 //$buffer .= '<h3>Existing Fatal Notices</h3>'.pre(self::$fatal_notices).'<hr/>';
                 $temp = array_reverse(self::$catchable);
                 foreach ($temp as $error_hash => $info) {
                     $file = $dataDir . '/data/_site/fatal_' . $error_hash;
                     gpFiles::Save($file, $content);
                     $reload = true;
                     if ($info['catchable_type'] == 'exec') {
                         break;
                     }
                 }
             }
             //reload non-logged in users automatically, display message to admins
             $buffer .= '<p>Oops, an error occurred while generating this page.<p>';
             if (!common::LoggedIn()) {
                 if ($reload) {
                     $buffer .= 'Reloading... <script type="text/javascript">window.setTimeout(function(){window.location.href = window.location.href},1000);</script>';
                 } else {
                     $buffer .= '<p>If you are the site administrator, you can troubleshoot the problem by changing php\'s display_errors setting to 1 in the gpconfig.php file.</p>' . '<p>If the problem is being caused by an addon, you may also be able to bypass the error by enabling gpEasy\'s safe mode in the gpconfig.php file.</p>' . '<p>More information is available in the <a href="http://docs.gpeasy.com/Main/Troubleshooting">gpEasy documentation</a>.</p>' . '<p><a href="">Reload this page to continue</a>.</p>';
                 }
             } else {
                 $buffer .= '<h3>Error Details</h3>' . pre($last_error) . '<p><a href="">Reload this page</a></p>';
                 if ($reload) {
                     $buffer .= '<p><a href="">Reload this page with the faulty component disabled</a></p>' . '<p><a href="?cmd=enable_component&hash=' . $error_hash . '">Reload this page with the faulty component enabled</a></p>';
                 }
                 $buffer .= '<p style="font-size:90%">Note: Error details are only displayed for logged in administrators</p>' . common::ErrorBuffer(true, false);
             }
         }
     }
     //remove lock
     if (defined('gp_has_lock') && gp_has_lock) {
         gpFiles::Unlock('write', gp_random);
     }
     //replace the <head> placeholder with header content
     $placeholder = '<!-- get_head_placeholder ' . gp_random . ' -->';
     $pos = strpos($buffer, $placeholder);
     if ($pos === false) {
         return $buffer;
     }
     $buffer = substr_replace($buffer, $gp_head_content, $pos, strlen($placeholder));
     //add jquery if needed
     $placeholder = '<!-- jquery_placeholder ' . gp_random . ' -->';
     $pos = strpos($buffer, $placeholder);
     if ($pos !== false) {
         $replacement = '';
         if (strpos($buffer, '<script') !== false) {
             if ($config['jquery'] != 'local') {
                 $replacement = "\n<script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js\"></script>";
             } else {
                 $replacement = "\n<script type=\"text/javascript\" src=\"" . common::GetDir('/include/thirdparty/js/jquery.js') . "\"></script>";
             }
         }
         $buffer = substr_replace($buffer, $replacement, $pos, strlen($placeholder));
     }
     //messages
     $pos = strpos($buffer, '<!-- message_start ' . gp_random . ' -->');
     $len = strpos($buffer, '<!-- message_end -->') - $pos;
     if ($pos && $len) {
         $replacement = GetMessages(false);
         $buffer = substr_replace($buffer, $replacement, $pos, $len + 20);
     }
     if (strpos($buffer, '<body') !== false && class_exists('admin_tools')) {
         if (function_exists('memory_get_peak_usage')) {
             $buffer = str_replace('<span gpeasy-memory-usage>?</span>', admin_tools::FormatBytes(memory_get_usage()), $buffer);
             $buffer = str_replace('<span gpeasy-memory-max>?</span>', admin_tools::FormatBytes(memory_get_peak_usage()), $buffer);
         }
         if (isset($_SERVER['REQUEST_TIME_FLOAT'])) {
             $time = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
         } else {
             $time = microtime(true) - gp_start_time;
         }
         $buffer = str_replace('<span gpeasy-seconds>?</span>', round($time, 3), $buffer);
         $buffer = str_replace('<span gpeasy-ms>?</span>', round($time * 1000), $buffer);
     }
     return $buffer;
 }
Esempio n. 3
0
 /**
  * Stop loading gpEasy
  * Check to see if gpEasy has already been installed
  *
  */
 static function stop()
 {
     global $dataDir;
     if (!gpFiles::Exists($dataDir . '/data/_site/config.php')) {
         if (file_exists($dataDir . '/include/install/install.php')) {
             common::SetLinkPrefix();
             includeFile('install/install.php');
             die;
         }
     }
     die('<p>Notice: The site configuration did not load properly.</p>' . '<p>If you are the site administrator, you can troubleshoot the problem turning debugging "on" or bypass it by enabling gpEasy safe mode.</p>' . '<p>More information is available in the <a href="http://docs.gpeasy.com/Main/Troubleshooting">gpEasy documentation</a>.</p>' . common::ErrorBuffer(true, false));
 }
Esempio n. 4
0
 /**
  * Perform admin only changes to the content buffer
  *
  */
 function AdminBuffer($buffer)
 {
     global $gp_random, $wbErrorBuffer, $gp_admin_html;
     $nonce = common::new_nonce('post', true);
     // Add a generic admin nonce field to each post form
     // Admin nonces are also added with javascript if needed
     $count = preg_match_all('#<form[^<>]+method=[\'"]post[\'"][^<>]+>#i', $buffer, $matches);
     if ($count) {
         $matches[0] = array_unique($matches[0]);
         foreach ($matches[0] as $match) {
             //make sure it's a local action
             if (preg_match('#action=[\'"]([^\'"]+)[\'"]#i', $match, $sub_matches)) {
                 $action = $sub_matches[1];
                 if (substr($action, 0, 2) === '//') {
                     continue;
                 } elseif (strpos($action, '://')) {
                     continue;
                 }
             }
             $replacement = $match . '<span class="nodisplay"><input type="hidden" name="verified" value="' . $nonce . '"/></span>';
             $buffer = str_replace($match, $replacement, $buffer);
         }
     }
     //add error notice if there was a fatal error
     if (!gpdebug && function_exists('error_get_last')) {
         //check for fatal error
         $fatal_errors = array(E_ERROR, E_PARSE);
         $last_error = error_get_last();
         if (is_array($last_error) && in_array($last_error['type'], $fatal_errors)) {
             showError($last_error['type'], $last_error['message'], $last_error['file'], $last_error['line'], false);
             $buffer .= '<p>An error occurred while generating this page.<p> ' . '<p>If you are the site administrator, you can troubleshoot the problem turning debugging "on" or bypass it by enabling safe mode.</p>' . '<p>More information is available in the <a href="http://docs.gpeasy.com/Main/Troubleshooting">gpEasy documentation</a>.</p>' . common::ErrorBuffer(true, false);
         }
     }
     //add $gp_admin_html to the document
     if (strlen($gp_admin_html)) {
         $pos = false;
         $pos_admin_html = strpos($buffer, 'id="gp_admin_html"');
         $pos_body = strpos($buffer, '<body');
         if ($pos_admin_html !== false) {
             $pos = $pos_admin_html;
         } elseif ($pos_body !== false) {
             $gp_admin_html = '<div id="gp_admin_html" class="a2">' . $gp_admin_html . '</div>';
             $pos = $pos_body;
         }
         if ($pos !== false) {
             $pos = strpos($buffer, '>', $pos);
             $buffer = substr_replace($buffer, $gp_admin_html, $pos + 1, 0);
         }
     }
     return $buffer;
 }
Esempio n. 5
0
 /**
  * Return the message displayed when a fatal error has been caught
  *
  */
 public static function FatalMessage($error_details)
 {
     $message = '<p>Oops, an error occurred while generating this page.<p>';
     if (!common::LoggedIn()) {
         //reload non-logged in users automatically if there were catchable errors
         if (self::$catchable) {
             $message .= 'Reloading... <script type="text/javascript">window.setTimeout(function(){window.location.href = window.location.href},1000);</script>';
         } else {
             $message .= '<p>If you are the site administrator, you can troubleshoot the problem by changing php\'s display_errors setting to 1 in the gpconfig.php file.</p>' . '<p>If the problem is being caused by an addon, you may also be able to bypass the error by enabling gpEasy\'s safe mode in the gpconfig.php file.</p>' . '<p>More information is available in the <a href="http://docs.gpeasy.com/Main/Troubleshooting">gpEasy documentation</a>.</p>' . '<p><a href="">Reload this page to continue</a>.</p>';
         }
         return $message;
     }
     $message .= '<h3>Error Details</h3>' . pre($error_details) . '<p><a href="">Reload this page</a></p>' . '<p style="font-size:90%">Note: Error details are only displayed for logged in administrators</p>' . common::ErrorBuffer(true, false);
     return $message;
 }
Esempio n. 6
0
 function stop()
 {
     die('<p>Notice: The site configuration did not load properly.</p>' . '<p>If you are the site administrator, you can troubleshoot the problem turning debugging "on" or bypass it by enabling safe mode.</p>' . '<p>More information is available in the <a href="http://docs.gpeasy.com/Main/Troubleshooting">gpEasy documentation</a>.</p>' . common::ErrorBuffer(true, false));
 }