Пример #1
0
 *
 * PHP version 5.3.0
 *
 * @category  LiteCommerce
 * @author    Creative Development LLC <*****@*****.**>
 * @copyright Copyright (c) 2011-2012 Creative Development LLC <*****@*****.**>. All rights reserved
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 * @link      http://www.litecommerce.com/
 */
/**
 * Initialization of LiteCommerce installation
 *
 * @package LiteCommerce
 */
if (!defined('XLITE_INSTALL_MODE')) {
    die('Incorrect call of the script. Stopping.');
}
if (version_compare(phpversion(), '5.3.0') >= 0) {
    error_reporting(E_ALL ^ E_DEPRECATED);
} else {
    die('LiteCommerce cannot start on PHP version earlier than 5.3.0 (' . phpversion() . ' is currently used)');
}
ini_set('display_errors', true);
ini_set('display_startup_errors', true);
@set_time_limit(300);
umask(0);
require_once realpath(dirname(__FILE__) . '/../..') . '/top.inc.php';
require_once constant('LC_DIR_ROOT') . 'Includes/install/install_settings.php';
// suphp mode
define('LC_SUPHP_MODE', get_php_execution_mode());
Пример #2
0
function get_filesystem_permissions($mode, $file = null)
{
    static $mode0777, $mode0755, $mode0666, $mode0644, $mode0666_fnp, $mode0644_fnp;
    // try to setup values from config
    if ((!isset($mode0777) || !isset($mode0755) || !isset($mode0666) || !isset($mode0644)) && \Includes\Utils\ConfigParser::getOptions('filesystem_permissions')) {
        $options = \Includes\Utils\ConfigParser::getOptions('filesystem_permissions');
        $phpExecutionMode = get_php_execution_mode();
        // 0777
        if (!isset($mode0777)) {
            if ($phpExecutionMode != 0) {
                if (isset($options['privileged_permission_dir'])) {
                    $mode0777 = base_convert($options['privileged_permission_dir'], 8, 10);
                }
            } elseif (isset($options['nonprivileged_permission_dir_all'])) {
                $mode0777 = base_convert($options['nonprivileged_permission_dir_all'], 8, 10);
            }
        }
        // 0755
        if (!isset($mode0755)) {
            if ($phpExecutionMode != 0) {
                if (isset($options['privileged_permission_dir'])) {
                    $mode0755 = base_convert($options['privileged_permission_dir'], 8, 10);
                }
            } elseif (isset($options['nonprivileged_permission_dir'])) {
                $mode0755 = base_convert($options['nonprivileged_permission_dir'], 8, 10);
            }
        }
        // 0666
        if (!isset($mode0666)) {
            if ($phpExecutionMode != 0) {
                if (isset($options['privileged_permission_file'])) {
                    $mode0666 = base_convert($options['privileged_permission_file'], 8, 10);
                    if (isset($options['privileged_permission_file_nonphp'])) {
                        $mode0666_fnp = base_convert($options['privileged_permission_file_nonphp'], 8, 10);
                    } else {
                        $mode0666_fnp = $mode0666;
                    }
                }
            } elseif (isset($options['nonprivileged_permission_file_all'])) {
                $mode0666 = base_convert($options['nonprivileged_permission_file_all'], 8, 10);
                $mode0666_fnp = $mode0666;
            }
        }
        // 0644
        if (!isset($mode0644)) {
            if ($phpExecutionMode != 0) {
                if (isset($options['privileged_permission_file'])) {
                    $mode0644 = base_convert($options['privileged_permission_file'], 8, 10);
                    if (isset($options['privileged_permission_file_nonphp'])) {
                        $mode0644_fnp = base_convert($options['privileged_permission_file_nonphp'], 8, 10);
                    } else {
                        $mode0644_fnp = $mode0644;
                    }
                }
            } elseif (isset($options['nonprivileged_permission_file'])) {
                $mode0644 = base_convert($options['nonprivileged_permission_file'], 8, 10);
                $mode0644_fnp = $mode0644;
            }
        }
    }
    if ($mode == 0777 && isset($mode0777)) {
        $mode = $mode0777;
    } elseif ($mode == 0755 && isset($mode0755)) {
        $modet = $mode0755;
    } elseif ($mode == 0666 && isset($mode0666)) {
        if (isset($file) && @is_file($file)) {
            $path_parts = @pathinfo($file);
            $mode = 'php' == strtolower($path_parts['extension']) ? $mode0666 : $mode0666_fnp;
        } else {
            $mode = $mode0666;
        }
    } elseif ($mode == 0644 && isset($mode0644)) {
        if (isset($file) && @is_file($file)) {
            $path_parts = @pathinfo($file);
            $mode = 'php' == strtolower($path_parts['extension']) ? $mode0644 : $mode0644_fnp;
        } else {
            $mode = $mode0644;
        }
    }
    return $mode;
}