<?php /* * This script gets english language xml-files and compares with language extensions. * Use for testing and fixing of language extensions! * Just set START_DIR absolute path and run it via browser * */ define('START_DIR', ''); ####################################### ## DO NOT TOUCH CODE BELOW ####################################### $admin_lang_files = get_all_files_dirs(START_DIR . 'admin/language/'); $sf_lang_files = get_all_files_dirs(START_DIR . 'storefront/language/'); if (!$admin_lang_files || !$sf_lang_files) { exit('no one language file found!'); } $not_exists = array(); /* * * ADMIN SECTION * */ $extension_dirs = glob(START_DIR . 'extensions/*', GLOB_ONLYDIR); foreach ($extension_dirs as $extdir) { $extension_name = basename($extdir); //check is extension have type "language" $config = simplexml_load_file(START_DIR . 'extensions/' . $extension_name . '/config.xml'); if (!$config) { continue; } if ((string) $config->type != 'language') { continue; }
function check_file_permissions($registry) { //check file permissions. $ret_array = array(); $index = DIR_ROOT . '/index.php'; if (is_writable($index) || substr(sprintf("%o", fileperms($index)), -3) == '777') { $ret_array[] = array('title' => 'Incorrect index.php file permissions', 'body' => $index . ' file is writable. It is recommended to set read and execute modes (644 or 755) for this file to keep it secured and running properly!', 'type' => 'W'); } if (is_writable(DIR_SYSTEM . 'config.php')) { $ret_array[] = array('title' => 'Incorrect config.php file permissions', 'body' => DIR_SYSTEM . 'config.php' . ' file needs to be set to read and execute modes (644 or 755) to keep it secured from editing!', 'type' => 'W'); } //if cache is anabled if ($registry->get('config')->get('config_cache_enable')) { $cache_files = get_all_files_dirs(DIR_SYSTEM . 'cache/'); $cache_message = ''; foreach ($cache_files as $file) { if (!is_writable($file)) { $cache_message .= $file . "<br/>"; } } if ($cache_message) { $ret_array[] = array('title' => 'Incorrect cache files permissions', 'body' => "Following files do not have write permissions. AbanteCart will not function properly. <br/>" . $cache_message, 'type' => 'E'); } } if (!is_writable(DIR_SYSTEM . 'logs') || !is_writable(DIR_SYSTEM . 'logs/error.txt')) { $ret_array[] = array('title' => 'Incorrect log dir/file permissions', 'body' => DIR_SYSTEM . 'logs' . ' directory or error.txt file needs to be set to full permissions(777)! Error logs can not be saved', 'type' => 'W'); } $image_files = get_all_files_dirs(DIR_ROOT . '/image/thumbnails/'); $image_message = ''; foreach ($image_files as $file) { if (!is_writable($file)) { $image_message .= $file . "<br/>"; } } if ($image_message) { $ret_array[] = array('title' => 'Incorrect image files permissions', 'body' => "Following files do not have write permissions. AbanteCart thumbnail images will not function properly. <br/>" . $cache_message, 'type' => 'W'); } if (!is_writable(DIR_ROOT . '/admin/system/backup')) { $ret_array[] = array('title' => 'Incorrect backup directory permission', 'body' => DIR_ROOT . '/admin/system/backup' . ' directory needs to be set to full permissions(777)! AbanteCart backups and upgrade will not work.', 'type' => 'W'); } return $ret_array; }
/** * @param Registry $registry * @return array */ function check_file_permissions($registry) { //check file permissions. $ret_array = array(); $index = DIR_ROOT . '/index.php'; if (is_writable($index) || substr(sprintf("%o", fileperms($index)), -3) == '777') { $ret_array[] = array('title' => 'Incorrect index.php file permissions', 'body' => $index . ' file is writable. It is recommended to set read and execute modes for this file to keep it secured and running properly!', 'type' => 'W'); } if (is_writable(DIR_SYSTEM . 'config.php')) { $ret_array[] = array('title' => 'Incorrect config.php file permissions', 'body' => DIR_SYSTEM . 'config.php' . ' file needs to be set to read and execute modes to keep it secured from editing!', 'type' => 'W'); } //if cache is enabled if ($registry->get('config')->get('config_cache_enable') && CACHE_DRIVER == 'file') { $cache_files = get_all_files_dirs(DIR_SYSTEM . 'cache/'); $cache_message = ''; foreach ($cache_files as $file) { if (!is_file($file)) { continue; } $cache_message = ''; if (in_array(basename($file), array('index.html', 'index.html', '.', '', '..'))) { continue; } if (!is_writable($file)) { $cache_message .= $file . "<br/>"; } } if ($cache_message) { $ret_array[] = array('title' => 'Incorrect cache files permissions', 'body' => "Following files do not have write permissions. AbanteCart will not function properly. <br/>" . $cache_message, 'type' => 'E'); } } if (!is_writable(DIR_SYSTEM . 'logs') || !is_writable(DIR_SYSTEM . 'logs/error.txt')) { $ret_array[] = array('title' => 'Incorrect log dir/file permissions', 'body' => DIR_SYSTEM . 'logs' . ' directory or error.txt file needs to be set to full permissions(777)! Error logs can not be saved', 'type' => 'W'); } //check resource directories $resource_files = get_all_files_dirs(DIR_ROOT . '/resources/'); $resource_message = ''; foreach ($resource_files as $file) { if (in_array(basename($file), array('.htaccess', 'index.php', 'index.html', '.', '', '..'))) { continue; } if (!is_writable($file)) { $resource_message .= $file . "<br/>"; } } if ($resource_message) { $ret_array[] = array('title' => 'Incorrect resource files permissions', 'body' => "Following files(folders) do not have write permissions. AbanteCart Media Manager will not function properly. <br/>" . $resource_message, 'type' => 'W'); } $image_files = get_all_files_dirs(DIR_ROOT . '/image/thumbnails/'); $image_message = ''; foreach ($image_files as $file) { if (in_array(basename($file), array('index.php', 'index.html', '.', '', '..'))) { continue; } if (!is_writable($file)) { $image_message .= $file . "<br/>"; } } if ($image_message) { $ret_array[] = array('title' => 'Incorrect image files permissions', 'body' => "Following files do not have write permissions. AbanteCart thumbnail images will not function properly. <br/>" . $image_message, 'type' => 'W'); } if (!is_writable(DIR_ROOT . '/admin/system')) { $ret_array[] = array('title' => 'Incorrect directory permission', 'body' => DIR_ROOT . '/admin/system' . ' directory needs to be set to full permissions(777)! AbanteCart backups and upgrade will not work.', 'type' => 'W'); } if (is_dir(DIR_ROOT . '/admin/system/backup') && !is_writable(DIR_ROOT . '/admin/system/backup')) { $ret_array[] = array('title' => 'Incorrect backup directory permission', 'body' => DIR_ROOT . '/admin/system/backup' . ' directory needs to be set to full permissions(777)! AbanteCart backups and upgrade will not work.', 'type' => 'W'); } if (is_dir(DIR_ROOT . '/admin/system/temp') && !is_writable(DIR_ROOT . '/admin/system/temp')) { $ret_array[] = array('title' => 'Incorrect temp directory permission', 'body' => DIR_ROOT . '/admin/system/temp' . ' directory needs to be set to full permissions(777)!', 'type' => 'W'); } if (is_dir(DIR_ROOT . '/admin/system/uploads') && !is_writable(DIR_ROOT . '/admin/system/uploads')) { $ret_array[] = array('title' => 'Incorrect "uploads" directory permission', 'body' => DIR_ROOT . '/admin/system/uploads' . ' directory needs to be set to full permissions(777)! Probably AbanteCart file uploads will not work.', 'type' => 'W'); } return $ret_array; }