function osc_is_writable($file) { if (strtolower(substr(PHP_OS, 0, 3)) === 'win') { if (file_exists($file)) { $file = realpath($file); if (is_dir($file)) { $result = @tempnam($file, 'osc'); if (is_string($result) && file_exists($result)) { unlink($result); return strpos($result, $file) === 0 ? true : false; } } else { $handle = @fopen($file, 'r+'); if (is_resource($handle)) { fclose($handle); return true; } } } else { $dir = dirname($file); if (file_exists($dir) && is_dir($dir) && tep_is_writable($dir)) { return true; } } return false; } else { return is_writable($file); } }
function getMessage() { if (STORE_SESSIONS == '') { if (!is_dir(tep_session_save_path())) { return WARNING_SESSION_DIRECTORY_NON_EXISTENT; } elseif (!tep_is_writable(tep_session_save_path())) { return WARNING_SESSION_DIRECTORY_NOT_WRITEABLE; } } }
function tep_opendir($path) { $path = rtrim($path, '/') . '/'; $exclude_array = array('.', '..', '.DS_Store', 'Thumbs.db'); $result = array(); if ($handle = opendir($path)) { while (false !== ($filename = readdir($handle))) { if (!in_array($filename, $exclude_array)) { $file = array('name' => $path . $filename, 'is_dir' => is_dir($path . $filename), 'writable' => tep_is_writable($path . $filename), 'size' => filesize($path . $filename), 'last_modified' => strftime(DATE_TIME_FORMAT, filemtime($path . $filename))); $result[] = $file; if ($file['is_dir'] == true) { $result = array_merge($result, tep_opendir($path . $filename)); } } } closedir($handle); } return $result; }
Copyright (c) 2014 osCommerce Released under the GNU General Public License */ require 'includes/application_top.php'; $action = isset($_GET['action']) ? $_GET['action'] : ''; if (tep_not_null($action)) { if ($action == 'reset') { tep_reset_cache_block($_GET['block']); } tep_redirect(tep_href_link(FILENAME_CACHE)); } // check if the cache directory exists if (is_dir(DIR_FS_CACHE)) { if (!tep_is_writable(DIR_FS_CACHE)) { $messageStack->add(ERROR_CACHE_DIRECTORY_NOT_WRITEABLE, 'error'); } } else { $messageStack->add(ERROR_CACHE_DIRECTORY_DOES_NOT_EXIST, 'error'); } require DIR_WS_INCLUDES . 'template_top.php'; ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?>
$store_logo->set_filename('store_logo.png'); if ($store_logo->save()) { $messageStack->add_session(SUCCESS_LOGO_UPDATED, 'success'); } else { $error = true; } } else { $error = true; } if ($error == false) { tep_redirect(tep_href_link(FILENAME_STORE_LOGO)); } break; } } if (!tep_is_writable(DIR_FS_CATALOG_IMAGES)) { $messageStack->add(sprintf(ERROR_IMAGES_DIRECTORY_NOT_WRITEABLE, tep_href_link(FILENAME_SEC_DIR_PERMISSIONS)), 'error'); } require DIR_WS_INCLUDES . 'template_top.php'; ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?> </td> <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT);
case 'deleteconfirm': if (strstr($_GET['file'], '..')) { tep_redirect(tep_href_link(FILENAME_BACKUP)); } tep_remove(DIR_FS_BACKUP . '/' . $_GET['file']); if (!$tep_remove_error) { $messageStack->add_session(SUCCESS_BACKUP_DELETED, 'success'); tep_redirect(tep_href_link(FILENAME_BACKUP)); } break; } } // check if the backup directory exists $dir_ok = false; if (is_dir(DIR_FS_BACKUP)) { if (tep_is_writable(DIR_FS_BACKUP)) { $dir_ok = true; } else { $messageStack->add(ERROR_BACKUP_DIRECTORY_NOT_WRITEABLE, 'error'); } } else { $messageStack->add(ERROR_BACKUP_DIRECTORY_DOES_NOT_EXIST, 'error'); } require DIR_WS_INCLUDES . 'template_top.php'; ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php
osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ require 'includes/application_top.php'; $type = isset($HTTP_GET_VARS['type']) ? $HTTP_GET_VARS['type'] : ''; $banner_extension = tep_banner_image_extension(); // check if the graphs directory exists $dir_ok = false; if (function_exists('imagecreate') && tep_not_null($banner_extension)) { if (is_dir('images/graphs')) { if (tep_is_writable('images/graphs')) { $dir_ok = true; } else { $messageStack->add(ERROR_GRAPHS_DIRECTORY_NOT_WRITEABLE, 'error'); } } else { $messageStack->add(ERROR_GRAPHS_DIRECTORY_DOES_NOT_EXIST, 'error'); } } $banner_query = tep_db_query("select banners_title from " . TABLE_BANNERS . " where banners_id = '" . (int) $HTTP_GET_VARS['bID'] . "'"); $banner = tep_db_fetch_array($banner_query); $years_array = array(); $years_query = tep_db_query("select distinct year(banners_history_date) as banner_year from " . TABLE_BANNERS_HISTORY . " where banners_id = '" . (int) $HTTP_GET_VARS['bID'] . "'"); while ($years = tep_db_fetch_array($years_query)) { $years_array[] = array('id' => $years['banner_year'], 'text' => $years['banner_year']); }
function atleastOneFolderWritable($dir) { global $writable_folders_found; $ffs = scandir($dir); foreach ($ffs as $ff) { if ($ff != '.' && $ff != '..' && is_dir($dir . '/' . $ff)) { if (tep_is_writable($dir . '/' . $ff)) { $writable_folders_found = true; break; } atleastOneFolderWritable($dir . '/' . $ff); } } return $writable_folders_found; }
if (is_file(DIR_WS_IMAGES . 'graphs/banner_daily-' . $banners_id . '.' . $banner_extension)) { if (tep_is_writable(DIR_WS_IMAGES . 'graphs/banner_daily-' . $banners_id . '.' . $banner_extension)) { unlink(DIR_WS_IMAGES . 'graphs/banner_daily-' . $banners_id . '.' . $banner_extension); } } } $messageStack->add_session(SUCCESS_BANNER_REMOVED, 'success'); tep_redirect(tep_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'])); break; } } // check if the graphs directory exists $dir_ok = false; if (function_exists('imagecreate') && tep_not_null($banner_extension)) { if (is_dir(DIR_WS_IMAGES . 'graphs')) { if (tep_is_writable(DIR_WS_IMAGES . 'graphs')) { $dir_ok = true; } else { $messageStack->add(ERROR_GRAPHS_DIRECTORY_NOT_WRITEABLE, 'error'); } } else { $messageStack->add(ERROR_GRAPHS_DIRECTORY_DOES_NOT_EXIST, 'error'); } } require DIR_WS_INCLUDES . 'template_top.php'; ?> <script type="text/javascript"><!-- function popupImageWindow(url) { window.open(url,'popupImageWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150') }
function check_destination() { global $messageStack; if (!tep_is_writable($this->destination)) { if (is_dir($this->destination)) { if ($this->message_location == 'direct') { $messageStack->add(sprintf(ERROR_DESTINATION_NOT_WRITEABLE, $this->destination), 'error'); } else { $messageStack->add_session(sprintf(ERROR_DESTINATION_NOT_WRITEABLE, $this->destination), 'error'); } } else { if ($this->message_location == 'direct') { $messageStack->add(sprintf(ERROR_DESTINATION_DOES_NOT_EXIST, $this->destination), 'error'); } else { $messageStack->add_session(sprintf(ERROR_DESTINATION_DOES_NOT_EXIST, $this->destination), 'error'); } } return false; } else { return true; } }
function pass() { return file_exists(DIR_FS_CATALOG . 'includes/configure.php') && !tep_is_writable(DIR_FS_CATALOG . 'includes/configure.php'); }
/* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2009 osCommerce Released under the GNU General Public License */ require 'includes/application_top.php'; $htaccess_array = null; $htpasswd_array = null; $authuserfile_array = array('##### OSCOMMERCE ADMIN PROTECTION - BEGIN #####', 'AuthType Basic', 'AuthName "osCommerce Online Merchant Administration Tool"', 'AuthUserFile ' . DIR_FS_ADMIN . '.htpasswd_oscommerce', 'Require valid-user', '##### OSCOMMERCE ADMIN PROTECTION - END #####'); if (file_exists(DIR_FS_ADMIN . '.htpasswd_oscommerce') && tep_is_writable(DIR_FS_ADMIN . '.htpasswd_oscommerce') && file_exists(DIR_FS_ADMIN . '.htaccess') && tep_is_writable(DIR_FS_ADMIN . '.htaccess')) { $htaccess_array = array(); $htpasswd_array = array(); if (filesize(DIR_FS_ADMIN . '.htaccess') > 0) { $fg = fopen(DIR_FS_ADMIN . '.htaccess', 'rb'); $data = fread($fg, filesize(DIR_FS_ADMIN . '.htaccess')); fclose($fg); $htaccess_array = explode("\n", $data); } if (filesize(DIR_FS_ADMIN . '.htpasswd_oscommerce') > 0) { $fg = fopen(DIR_FS_ADMIN . '.htpasswd_oscommerce', 'rb'); $data = fread($fg, filesize(DIR_FS_ADMIN . '.htpasswd_oscommerce')); fclose($fg); $htpasswd_array = explode("\n", $data); } }