Esempio n. 1
0
function ini_loader_warnings()
{
    $warnings = array();
    if (find_server_type() == SERVER_SHARED) {
        if (own_php_ini_possible()) {
            $sys = get_sysinfo();
            $ini_name = ini_file_name();
            $rootpath = realpath($_SERVER['DOCUMENT_ROOT']);
            $root_ini_file = $rootpath . DIRECTORY_SEPARATOR . $ini_name;
            $cgibinpath = @realpath($_SERVER['DOCUMENT_ROOT'] . "/cgi-bin");
            $cgibin_ini_file = empty($cgibinpath) ? '' : $cgibinpath . DIRECTORY_SEPARATOR . $ini_name;
            $here = unix_path_dir();
            $ini_files = unrecognised_inis_webspace($here);
            $shared_ini_loc = shared_ini_location();
            $shared_ini_file = $shared_ini_loc . DIRECTORY_SEPARATOR . $ini_name;
            $ini_dir = dirname($sys['PHP_INI']);
            $all_ini_locations_used = !empty($ini_files);
            foreach ($ini_files as $full_ini_loc) {
                $advice = "文件 {$full_ini_loc} 没有被PHP认可。";
                $advice .= " 请检查文件名、路径是正确的。";
                if (!ini_same_dir_as_wizard()) {
                    $ini_loc_dir = dirname($full_ini_loc);
                    if (!@file_exists($shared_ini_file) && !empty($shared_ini_loc) && $ini_loc_dir != $shared_ini_loc && $ini_dir != $shared_ini_loc) {
                        $all_ini_locations_used = false;
                        $advice .= " 请将<code>{$full_ini_loc}</code> 复制到<code>" . $shared_ini_loc . "</code>。";
                    } else {
                        if (!@file_exists($root_ini_file) && $rootpath != $shared_ini_loc && $full_ini_loc != $rootpath) {
                            $all_ini_locations_used = false;
                            $advice .= " 请将文件 <code>{$full_ini_loc}</code> 复制到 <code>" . $rootpath . "</code>.";
                        }
                        if (!empty($cgibin_ini_file) && !@file_exists($cgibin_ini_file) && $cgibinpath != $shared_ini_loc && $full_ini_loc != $cgibinpath && $cgibinpath != $rootpath) {
                            $all_ini_locations_used = false;
                            $advice .= "  请将文件 <code>{$full_ini_loc}</code> 复制到 <code>" . $cgibinpath . "</code>。";
                        }
                        $herepath = realpath($here);
                        $here_ini_file = $herepath . DIRECTORY_SEPARATOR . $ini_name;
                        if (!@file_exists($here_ini_file) && $herepath != $rootpath && $herepath != $cgibinpath) {
                            $all_ini_locations_used = false;
                            $advice .= " 需要将文件 <code>{$full_ini_loc}</code> 复制到 <code>{$herepath}</code> 和所有加密文件所在的路径。";
                        }
                    }
                } else {
                    $all_ini_locations_used = false;
                }
                $warnings[] = $advice;
            }
            if ($all_ini_locations_used) {
                $warnings[] = "<strong>好像ini配置文件不在默认的位置,请联系服务器提供商,询问是否能够创建自己的PHP ini文件和创建位置。</strong>";
            }
        } else {
            if (own_php_ini_possible(true)) {
                $warnings[] = "你可能没有权限在共享服务器上创建自己的ini文件。 <br><strong>请联系管理员安装ionCube loader。</strong>";
            }
        }
    } else {
        $loader_dir_pair = correct_loader_wrong_location();
        if (!empty($loader_dir_pair)) {
            $advice = "在<code>{$loader_dir_pair['loader']}</code>已经找到可用的loader。";
            if ($loader_dir_pair['loader'] != $loader_dir_pair['newloc']) {
                $advice .= " 你可能想将loader文件 <code>{$loader_dir_pair['loader']}</code> 复制到 <code>{$loader_dir_pair['newloc']}</code>。";
            }
            $warnings[] = $advice;
        }
    }
    return $warnings;
}
function ini_loader_warnings()
{
    $warnings = array();
    if (find_server_type() == SERVER_SHARED) {
        if (own_php_ini_possible()) {
            $sys = get_sysinfo();
            $ini_name = ini_file_name();
            $rootpath = realpath($_SERVER['DOCUMENT_ROOT']);
            $root_ini_file = $rootpath . DIRECTORY_SEPARATOR . $ini_name;
            $cgibinpath = @realpath($_SERVER['DOCUMENT_ROOT'] . "/cgi-bin");
            $cgibin_ini_file = empty($cgibinpath) ? '' : $cgibinpath . DIRECTORY_SEPARATOR . $ini_name;
            $here = unix_path_dir();
            $ini_files = unrecognised_inis_webspace($here);
            $shared_ini_loc = shared_ini_location();
            $shared_ini_file = $shared_ini_loc . DIRECTORY_SEPARATOR . $ini_name;
            $ini_dir = dirname($sys['PHP_INI']);
            $all_ini_locations_used = !empty($ini_files);
            foreach ($ini_files as $full_ini_loc) {
                $advice = "The file {$full_ini_loc} is not being recognised by PHP.";
                $advice .= " Please check that the name and location of the file are correct.";
                if (!ini_same_dir_as_wizard()) {
                    $ini_loc_dir = dirname($full_ini_loc);
                    if (!@file_exists($shared_ini_file) && !empty($shared_ini_loc) && $ini_loc_dir != $shared_ini_loc && $ini_dir != $shared_ini_loc) {
                        $all_ini_locations_used = false;
                        $advice .= " Please try copying the <code>{$full_ini_loc}</code> file to <code>" . $shared_ini_loc . "</code>.";
                    } else {
                        if (!@file_exists($root_ini_file) && $rootpath != $shared_ini_loc && $full_ini_loc != $rootpath) {
                            $all_ini_locations_used = false;
                            $advice .= " Please try copying the <code>{$full_ini_loc}</code> file to <code>" . $rootpath . "</code>.";
                        }
                        if (!empty($cgibin_ini_file) && !@file_exists($cgibin_ini_file) && $cgibinpath != $shared_ini_loc && $full_ini_loc != $cgibinpath && $cgibinpath != $rootpath) {
                            $all_ini_locations_used = false;
                            $advice .= "  Please try copying the <code>{$full_ini_loc}</code> file to <code>" . $cgibinpath . "</code>.";
                        }
                        $herepath = realpath($here);
                        $here_ini_file = $herepath . DIRECTORY_SEPARATOR . $ini_name;
                        if (!@file_exists($here_ini_file) && $herepath != $rootpath && $herepath != $cgibinpath) {
                            $all_ini_locations_used = false;
                            $advice .= " It may be necessary to copy the <code>{$full_ini_loc}</code> file to <code>{$herepath}</code> and to all " . (is_ms_windows() ? 'folders' : 'directories') . ' in which you have encoded files';
                        }
                    }
                } else {
                    $all_ini_locations_used = false;
                }
                $warnings[] = $advice;
            }
            if ($all_ini_locations_used) {
                $warnings[] = "<strong>It looks as if ini files are not being recognised in any of the standard locations in your webspace. Please contact your hosting provider to check whether you can create your own PHP ini file and where it should go.</strong>";
            }
        } else {
            if (own_php_ini_possible(true)) {
                $warnings[] = "You may not be able to create your own ini files on your shared server. <br><strong>You might need to ask your server administrator to install the ionCube Loader for you.</strong>";
            }
        }
    } else {
        $loader_dir_pair = correct_loader_wrong_location();
        if (!empty($loader_dir_pair)) {
            $advice = "The correct loader for your system has been found at <code>{$loader_dir_pair['loader']}</code>.";
            if ($loader_dir_pair['loader'] != $loader_dir_pair['newloc']) {
                $advice .= " You may wish to copy the loader from <code>{$loader_dir_pair['loader']}</code> to <code>{$loader_dir_pair['newloc']}</code>.";
            }
            $warnings[] = $advice;
        }
    }
    return $warnings;
}
Esempio n. 3
0
function zend_extension_instructions($server_type,$loader_dir)
{
    $sysinfo = get_sysinfo();
    $editing_ini = true;

    $php_ini_name = ini_file_name();

    if (is_bool($sysinfo['THREAD_SAFE'])) {
        $kwd = zend_extension_line_start();
    } else {
        $kwd = 'zend_extension/zend_extension_ts';
    }

    $zend_extension_lines = zend_extension_lines($loader_dir);

    if (SERVER_SHARED_INI == $server_type) {
        $html_dir = shared_ini_location();
        $ini_path = $html_dir . "/" . $php_ini_name;
        if (file_exists($ini_path)) {
            $loader_loc = get_loader_location_from_ini($ini_path);
            $missing_ze_line = is_array($loader_loc) && array_key_exists(ERROR_INI_ZE_LINE_NOT_FOUND,$loader_loc);
            if ($missing_ze_line && is_writeable($ini_path)) {
                if (function_exists('file_get_contents')) {
                    $ini_strs = @file_get_contents($ini_path);
                } else {
                    $lines = @file($ini_path);
                    $ini_strs = join(' ',$lines);
                }
                $fh = fopen($ini_path,"w");
                foreach ($zend_extension_lines as $zl) {
                    fwrite($fh,$zl . PHP_EOL);
                }
                fwrite($fh,$ini_strs);
                fclose($fh);
                $editing_ini = false;
                echo "<li>Your php.ini file at $ini_path has been modified to include the necessary line for the ionCube Loader.";
            } else {
               echo "<li>Edit the <code>$php_ini_name</code> in your <code>$html_dir</code> directory";
            }
        } else {
           if (is_writeable($html_dir)) {
               $fh = fopen($ini_path,"w");
               foreach ($zend_extension_lines as $zl) {
                   fwrite($fh,$zl . PHP_EOL);
               }
               fwrite($fh,$ini_strs);
               fclose($fh); 
               echo "<li>A <code>$php_ini_name</code> file has been created for you in <code>$html_dir</code>.";
           } else {
               echo "<li><a href=\"$self?page=phpini\">Save this  <code>$php_ini_name</code> file</a> and upload it to your html directory, <code>$html_dir</code>";
           }
           $editing_ini = false;
        }
    } elseif (!empty($sysinfo['PHP_INI'])) {
        if (empty($sysinfo['PHP_INI_DIR'])) {
            echo "<li>Edit the file <code>${sysinfo['PHP_INI']}</code>";
        } else {
            $php_ini_name = 'ioncube.ini';
            echo "<li><a href=\"$self?page=phpini&amp;ininame=$php_ini_name\">Save this $php_ini_name file</a> and put it in your ini files directory, <code>${sysinfo['PHP_INI_DIR']}</code>";
            $editing_ini = false;
        }
    } else {
        echo "<li>Edit the system <code>$php_ini_name</code> file";
    }
    if ($editing_ini) {
        echo " and <b>before</b> any other $kwd lines add:<br>";
        foreach ($zend_extension_lines as $zl) {
            echo "<code>$zl</code><br>";
        }
        if (isset($sysinfo['PHP_INI']) && file_exists($sysinfo['PHP_INI'])) {
            $loader_loc = get_loader_location_from_ini();
            $missing_ze_line = is_array($loader_loc) && array_key_exists(ERROR_INI_ZE_LINE_NOT_FOUND,$loader_loc);
            if ($missing_ze_line) {
                echo "<a>Alternatively, replace your current <code>${sysinfo['PHP_INI']}</code> file with <a href=\"$self?page=phpconfig&amp;download=1&amp;prepend=1\">this new $php_ini_name file</a>."; 
            }
        }
    }
    echo '</li>';
}