Ejemplo n.º 1
0
 /**
  * Determine if a specific method is supported
  *
  */
 static function Supported($method)
 {
     if (common::IniGet('safe_mode')) {
         return false;
     }
     $url_fopen = common::IniGet('allow_url_fopen');
     $php5 = version_compare(phpversion(), '5.0', '>=');
     switch ($method) {
         case 'stream':
             return $url_fopen && $php5;
         case 'fopen':
             return $url_fopen;
         case 'fsockopen':
             return function_exists('fsockopen');
     }
     return false;
 }
Ejemplo n.º 2
0
 function CheckFolders()
 {
     global $ok, $langmessage;
     $ok = true;
     echo '<h2>' . $langmessage['Checking_server'] . '...</h2>';
     echo '<table class="styledtable fullwidth">';
     echo '<thead>';
     echo '<tr>';
     echo '<th>' . $langmessage['Checking'] . '...</th>';
     echo '<th>' . $langmessage['Status'] . '</th>';
     echo '<th>' . $langmessage['Current_Value'] . '</th>';
     echo '<th>' . $langmessage['Expected_Value'] . '</th>';
     echo '</tr>';
     echo '</thead>';
     echo '<tbody>';
     $this->CheckDataFolder();
     //Check PHP Version
     echo '<tr>';
     echo '<td>';
     echo $langmessage['PHP_Version'];
     echo '</td>';
     if (!function_exists('version_compare')) {
         echo '<td class="failed">' . $langmessage['Failed'] . '</td>';
         echo '<td class="failed">???</td>';
         $ok = false;
     } elseif (version_compare(phpversion(), '5.3', '>=')) {
         echo '<td class="passed">' . $langmessage['Passed'] . '</td>';
         echo '<td class="passed">' . phpversion() . '</td>';
     } else {
         echo '<td class="failed">' . $langmessage['Failed'] . '</td>';
         echo '<td class="failed">' . phpversion() . '</td>';
         $ok = false;
     }
     echo '<td>5.3+</td>';
     echo '</tr>';
     //make sure $_SERVER['SCRIPT_NAME'] is set
     echo '<tr>';
     echo '<td>';
     echo '<a href="http://www.php.net/manual/reserved.variables.server.php" target="_blank">';
     echo 'SCRIPT_NAME or PHP_SELF';
     echo '</a>';
     echo '</td>';
     $checkValue = common::GetEnv('SCRIPT_NAME', 'index.php') || common::GetEnv('PHP_SELF', 'index.php');
     $ok = $ok && $checkValue;
     $this->StatusRow($checkValue, $langmessage['Set'], $langmessage['Not_Set']);
     echo '</tr>';
     //Check Safe Mode
     $checkValue = common::IniGet('safe_mode');
     echo '<tr>';
     echo '<td>';
     echo '<a href="http://php.net/manual/features.safe-mode.php" target="_blank">';
     echo 'Safe Mode';
     echo '</a>';
     echo '</td>';
     if ($checkValue) {
         echo '<td class="failed">' . $langmessage['Failed'] . ': ' . $langmessage['See_Below'] . '</td>';
         echo '<td class="failed">' . $langmessage['On'] . '</td>';
         $ok = false;
     } else {
         echo '<td class="passed">' . $langmessage['Passed'] . '</td>';
         echo '<td class="passed">' . $langmessage['Off'] . '</td>';
     }
     echo '<td>' . $langmessage['Off'] . '</td>';
     echo '</tr>';
     //Check register_globals
     $checkValue = common::IniGet('register_globals');
     echo '<tr>';
     echo '<td>';
     echo '<a href="http://php.net/manual/security.globals.php" target="_blank">';
     echo 'Register Globals';
     echo '</a>';
     echo '</td>';
     if ($checkValue) {
         echo '<td class="passed_orange">' . $langmessage['Passed'] . '</td>';
         echo '<td class="passed_orange">' . $langmessage['On'] . '</td>';
     } else {
         echo '<td class="passed">' . $langmessage['Passed'] . '</td>';
         echo '<td class="passed">' . $langmessage['Off'] . '</td>';
     }
     echo '<td>' . $langmessage['Off'] . '</td>';
     echo '</tr>';
     //Check common::IniGet( 'magic_quotes_sybase' )
     $checkValue = !common::IniGet('magic_quotes_sybase');
     $ok = $ok && $checkValue;
     echo '<tr>';
     echo '<td>';
     echo '<a href="http://php.net/manual/security.magicquotes.disabling.php" target="_blank">';
     echo 'Magic Quotes Sybase';
     echo '</a>';
     echo '</td>';
     $this->StatusRow($checkValue, $langmessage['Off'], $langmessage['On']);
     echo '</tr>';
     //magic_quotes_runtime
     $checkValue = !common::IniGet('magic_quotes_runtime');
     $ok = $ok && $checkValue;
     echo '<tr>';
     echo '<td>';
     echo '<a href="http://php.net/manual/security.magicquotes.disabling.php" target="_blank">';
     echo 'Magic Quotes Runtime';
     echo '</a>';
     echo '</td>';
     $this->StatusRow($checkValue, $langmessage['Off'], $langmessage['On']);
     echo '</tr>';
     // memory_limit
     // LESS compiling uses a fair amount of memory
     $checkValue = ini_get('memory_limit');
     echo '<tr>';
     echo '<td>';
     echo '<a href="http://php.net/manual/ini.core.php#ini.memory-limit" target="_blank">';
     echo 'Memory Limit';
     echo '</a>';
     echo '</td>';
     //can't get memory_limit value
     if (@ini_set('memory_limit', '96M') !== false) {
         echo '<td class="passed">' . $langmessage['Passed'] . '</td>';
         echo '<td class="passed">Adjustable</td>';
     } elseif (!$checkValue) {
         echo '<td class="passed_orange">' . $langmessage['Passed'] . '</td>';
         echo '<td class="passed_orange">';
         echo '???';
         echo '</td>';
     } else {
         $byte_value = common::getByteValue($checkValue);
         $mb_16 = common::getByteValue('16M');
         if ($byte_value > 100663296) {
             echo '<td class="passed">' . $langmessage['Passed'] . '</td>';
             echo '<td class="passed">';
             echo $checkValue;
             echo '</td>';
         } elseif ($byte_value >= $mb_16) {
             echo '<td class="passed_orange">' . $langmessage['Passed'] . '</td>';
             echo '<td class="passed_orange">';
             echo $checkValue;
             echo '</td>';
         } else {
             echo '<td class="failed">' . $langmessage['Failed'] . '</td>';
             echo '<td class="failed">' . $checkValue . '</td>';
             $ok = false;
         }
     }
     echo '<td> 16M+ or Adjustable</td>';
     echo '</tr>';
     echo '<tr>';
     echo '<th>' . $langmessage['Checking'] . '...</th>';
     echo '<th>' . $langmessage['Status'] . '</th>';
     echo '<th colspan="2">' . $langmessage['Notes'] . '</th>';
     echo '</tr>';
     echo '</tbody>';
     echo '<tbody>';
     $this->CheckIndexHtml();
     $this->CheckImages();
     $ok = $ok && $this->CheckPath();
     echo '</tbody>';
     echo '</table>';
     echo '<p>';
     echo common::Link('', $langmessage['Refresh']);
     echo '</p>';
     echo '<br/>';
     if ($ok) {
         $this->Form_Entry();
         return;
     }
     if (!$this->can_write_data) {
         $this->Form_Permissions();
     } else {
         echo '<h3>' . $langmessage['Notes'] . '</h3>';
         echo '<div>';
         echo $langmessage['Install_Conflict'];
         echo '</div>';
         echo '<p>';
         echo sprintf($langmessage['Install_Fix'], '');
         echo '</p>';
     }
 }
Ejemplo n.º 3
0
 /**
  * Test if function exists.  Also handles case where function is disabled via Suhosin.
  * Modified from: http://dev.piwik.org/trac/browser/trunk/plugins/Installation/Controller.php
  *
  * @param string $function Function name
  * @return bool True if function exists (not disabled); False otherwise.
  */
 static function function_exists($function)
 {
     $function = strtolower($function);
     // eval() is a language construct
     if ($function == 'eval') {
         // does not check suhosin.executor.eval.whitelist (or blacklist)
         if (extension_loaded('suhosin') && common::IniGet('suhosin.executor.disable_eval')) {
             return false;
         }
         return true;
     }
     if (!function_exists($function)) {
         return false;
     }
     $blacklist = @ini_get('disable_functions');
     if (extension_loaded('suhosin')) {
         $blacklist .= ',' . @ini_get('suhosin.executor.func.blacklist');
     }
     $blacklist = explode(',', $blacklist);
     $blacklist = array_map('trim', $blacklist);
     $blacklist = array_map('strtolower', $blacklist);
     if (in_array($function, $blacklist)) {
         return false;
     }
     return true;
 }
Ejemplo n.º 4
0
 function CanRate()
 {
     /*
     if( $this->rate_testing ){
     	message('rate_testing is enabled');
     }elseif( strpos($_SERVER['SERVER_ADDR'],'127') === 0 ){
     	$this->messages[] = 'This installation of gpEasy is on a local server and is not accessible via the internet.';
     }
     */
     if (!common::IniGet('allow_url_fopen')) {
         $this->messages[] = 'Your installation of PHP does not support url fopen wrappers.';
     }
     if (count($this->messages) > 0) {
         $message = 'Oops, you are currently unable to rate this addon for the following reasons:';
         $message .= '<ul>';
         $message .= '<li>' . implode('</li><li>', $this->messages) . '</li>';
         $message .= '</ul>';
         message($message);
         $this->ShowRatingText = false;
         return false;
     }
     return true;
 }
Ejemplo n.º 5
0
 /**
  * Test if function exists.  Also handles case where function is disabled via Suhosin.
  * Modified from: http://dev.piwik.org/trac/browser/trunk/plugins/Installation/Controller.php
  *
  * @param string $functionName Function name
  * @return bool True if function exists (not disabled); False otherwise.
  */
 function function_exists($functionName)
 {
     $functionName = strtolower($functionName);
     // eval() is a language construct
     if ($functionName == 'eval') {
         // does not check suhosin.executor.eval.whitelist (or blacklist)
         if (extension_loaded('suhosin') && common::IniGet('suhosin.executor.disable_eval')) {
             return false;
         }
         return true;
     }
     if (!function_exists($functionName)) {
         return false;
     }
     if (extension_loaded('suhosin')) {
         $blacklist = @ini_get('suhosin.executor.func.blacklist');
         if (!empty($blacklist)) {
             $blacklistFunctions = array_map('strtolower', array_map('trim', explode(',', $blacklist)));
             return !in_array($functionName, $blacklistFunctions);
         }
     }
     return true;
 }
Ejemplo n.º 6
0
 function CheckFolders()
 {
     global $ok, $langmessage;
     $ok = true;
     echo '<h2>' . $langmessage['Checking_server'] . '...</h2>';
     echo '<table cellpadding="5" cellspacing="0" class="styledtable fullwidth">';
     echo '<thead>';
     echo '<tr>';
     echo '<th>' . $langmessage['Checking'] . '...</th>';
     echo '<th>' . $langmessage['Status'] . '</th>';
     echo '<th>' . $langmessage['Current_Value'] . '</th>';
     echo '<th>' . $langmessage['Expected_Value'] . '</th>';
     echo '</tr>';
     echo '</thead>';
     echo '<tbody>';
     $this->CheckDataFolder();
     //Check PHP Version
     echo '<tr>';
     echo '<td>';
     echo $langmessage['PHP_Version'];
     echo '</td>';
     if (!function_exists('version_compare')) {
         echo '<td class="failed">' . $langmessage['Failed'] . '</td>';
         echo '<td class="failed">???</td>';
         $ok = false;
     } elseif (version_compare(phpversion(), '5.2', '>=')) {
         echo '<td class="passed">' . $langmessage['Passed'] . '</td>';
         echo '<td class="passed">' . phpversion() . '</td>';
     } else {
         echo '<td class="failed">' . $langmessage['Failed'] . '</td>';
         echo '<td class="failed">' . phpversion() . '</td>';
         $ok = false;
     }
     echo '<td>5.2+</td>';
     echo '</tr>';
     //make sure $_SERVER['SCRIPT_NAME'] is set
     echo '<tr>';
     echo '<td>';
     echo '<a href="http://www.php.net/manual/reserved.variables.server.php" target="_blank">';
     echo 'SCRIPT_NAME or PHP_SELF';
     echo '</a>';
     echo '</td>';
     $checkValue = common::GetEnv('SCRIPT_NAME', 'index.php') || common::GetEnv('PHP_SELF', 'index.php');
     $ok = $ok && $checkValue;
     $this->StatusRow($checkValue, $langmessage['Set'], $langmessage['Not_Set']);
     echo '</tr>';
     //Check Safe Mode
     $checkValue = common::IniGet('safe_mode');
     echo '<tr>';
     echo '<td>';
     echo '<a href="http://php.net/manual/features.safe-mode.php" target="_blank">';
     echo 'Safe Mode';
     echo '</a>';
     echo '</td>';
     if ($checkValue) {
         echo '<td class="failed">' . $langmessage['Failed'] . ': ' . $langmessage['See_Below'] . '</td>';
         echo '<td class="failed">' . $langmessage['On'] . '</td>';
         $ok = false;
     } else {
         echo '<td class="passed">' . $langmessage['Passed'] . '</td>';
         echo '<td class="passed">' . $langmessage['Off'] . '</td>';
     }
     echo '<td>' . $langmessage['Off'] . '</td>';
     echo '</tr>';
     //Check register_globals
     $checkValue = common::IniGet('register_globals');
     echo '<tr>';
     echo '<td>';
     echo '<a href="http://php.net/manual/security.globals.php" target="_blank">';
     echo 'Register Globals';
     echo '</a>';
     echo '</td>';
     if ($checkValue) {
         echo '<td class="passed_orange">' . $langmessage['Passed'] . '</td>';
         echo '<td class="passed_orange">' . $langmessage['On'] . '</td>';
     } else {
         echo '<td class="passed">' . $langmessage['Passed'] . '</td>';
         echo '<td class="passed">' . $langmessage['Off'] . '</td>';
     }
     echo '<td>' . $langmessage['Off'] . '</td>';
     echo '</tr>';
     //Check common::IniGet( 'magic_quotes_sybase' )
     $checkValue = !common::IniGet('magic_quotes_sybase');
     $ok = $ok && $checkValue;
     echo '<tr>';
     echo '<td>';
     echo '<a href="http://php.net/manual/security.magicquotes.disabling.php" target="_blank">';
     echo 'Magic Quotes Sybase';
     echo '</a>';
     echo '</td>';
     $this->StatusRow($checkValue, $langmessage['Off'], $langmessage['On']);
     echo '</tr>';
     //magic_quotes_runtime
     $checkValue = !common::IniGet('magic_quotes_runtime');
     $ok = $ok && $checkValue;
     echo '<tr>';
     echo '<td>';
     echo '<a href="http://php.net/manual/security.magicquotes.disabling.php" target="_blank">';
     echo 'Magic Quotes Runtime';
     echo '</a>';
     echo '</td>';
     $this->StatusRow($checkValue, $langmessage['Off'], $langmessage['On']);
     echo '</tr>';
     echo '<tr>';
     echo '<th>' . $langmessage['Checking'] . '...</th>';
     echo '<th>' . $langmessage['Status'] . '</th>';
     echo '<th colspan="2">' . $langmessage['Notes'] . '</th>';
     echo '</tr>';
     echo '</tbody>';
     echo '<tbody>';
     $this->CheckIndexHtml();
     $this->CheckImages();
     $ok = $ok && $this->CheckPath();
     echo '</tbody>';
     echo '</table>';
     echo '<p>';
     echo common::Link('', $langmessage['Refresh']);
     echo '</p>';
     echo '<br/>';
     if ($ok) {
         Form_Entry();
         return;
     }
     if (!$this->can_write_data) {
         Form_Permissions();
     } else {
         echo '<h3>' . $langmessage['Notes'] . '</h3>';
         echo '<div>';
         echo $langmessage['Install_Conflict'];
         echo '</div>';
         echo '<p>';
         echo sprintf($langmessage['Install_Fix'], '');
         echo '</p>';
     }
 }