Skip to content
Browse files

New Store Logo page to upload a new store logo

  • Loading branch information...
1 parent 53464be commit 47532bc2afc97c94c2d78f6224f457ff51f5cea0 @haraldpdl haraldpdl committed Jun 24, 2010
View
5 catalog/admin/includes/boxes/configuration.php
@@ -5,7 +5,7 @@
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
- Copyright (c) 2007 osCommerce
+ Copyright (c) 2010 osCommerce
Released under the GNU General Public License
*/
@@ -21,7 +21,8 @@
'link' => tep_href_link(FILENAME_CONFIGURATION, 'gID=1&selected_box=configuration'));
if ($selected_box == 'configuration') {
- $cfg_groups = '<a href="' . tep_href_link(FILENAME_ADMINISTRATORS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CONFIGURATION_ADMINISTRATORS . '</a><br>';
+ $cfg_groups = '<a href="' . tep_href_link(FILENAME_ADMINISTRATORS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CONFIGURATION_ADMINISTRATORS . '</a><br>' .
+ '<a href="' . tep_href_link(FILENAME_STORE_LOGO, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CONFIGURATION_STORE_LOGO . '</a><br>';
$configuration_groups_query = tep_db_query("select configuration_group_id as cgID, configuration_group_title as cgTitle from " . TABLE_CONFIGURATION_GROUP . " where visible = '1' order by sort_order");
while ($configuration_groups = tep_db_fetch_array($configuration_groups_query)) {
$cfg_groups .= '<a href="' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $configuration_groups['cgID'], 'NONSSL') . '" class="menuBoxContentLink">' . $configuration_groups['cgTitle'] . '</a><br>';
View
1 catalog/admin/includes/filenames.php
@@ -47,6 +47,7 @@
define('FILENAME_STATS_CUSTOMERS', 'stats_customers.php');
define('FILENAME_STATS_PRODUCTS_PURCHASED', 'stats_products_purchased.php');
define('FILENAME_STATS_PRODUCTS_VIEWED', 'stats_products_viewed.php');
+ define('FILENAME_STORE_LOGO', 'store_logo.php');
define('FILENAME_TAX_CLASSES', 'tax_classes.php');
define('FILENAME_TAX_RATES', 'tax_rates.php');
define('FILENAME_VERSION_CHECK', 'version_check.php');
View
1 catalog/admin/includes/languages/english.php
@@ -61,6 +61,7 @@ function tep_date_raw($date, $reverse = false) {
define('BOX_CONFIGURATION_LOGGING', 'Logging');
define('BOX_CONFIGURATION_CACHE', 'Cache');
define('BOX_CONFIGURATION_ADMINISTRATORS', 'Administrators');
+define('BOX_CONFIGURATION_STORE_LOGO', 'Store Logo');
// modules box text in includes/boxes/modules.php
define('BOX_HEADING_MODULES', 'Modules');
View
21 catalog/admin/includes/languages/english/store_logo.php
@@ -0,0 +1,21 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2010 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+define('HEADING_TITLE', 'Store Logo');
+
+define('TEXT_LOGO_IMAGE', 'New Logo:');
+define('TEXT_FORMAT_AND_LOCATION', 'The store logo must be in PNG format and will be saved as:');
+
+define('SUCCESS_LOGO_UPDATED', 'Success: The store logo has successfully been updated!');
+
+define('ERROR_IMAGES_DIRECTORY_NOT_WRITEABLE', 'Error: The images directory cannot be uploaded to. (<a href="%s">click here to review the directory permissions</a>)');
+?>
View
128 catalog/admin/store_logo.php
@@ -0,0 +1,128 @@
+<?php
+/*
+ $Id$
+
+ 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');
+
+ $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
+
+ if (tep_not_null($action)) {
+ switch ($action) {
+ case 'save':
+ $error = false;
+
+ $store_logo = new upload('store_logo');
+ $store_logo->set_extensions('png');
+ $store_logo->set_destination(DIR_FS_CATALOG_IMAGES);
+
+ if ($store_logo->parse()) {
+ $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, 'selected_box=tools')), 'error');
+ }
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html <?php echo HTML_PARAMS; ?>>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
+<title><?php echo TITLE; ?></title>
+<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
+<script language="javascript" src="includes/general.js"></script>
+</head>
+<body onload="SetFocus();">
+<!-- header //-->
+<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
+<!-- header_eof //-->
+
+<!-- body //-->
+<table border="0" width="100%" cellspacing="2" cellpadding="2">
+ <tr>
+ <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
+<!-- left_navigation //-->
+<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
+<!-- left_navigation_eof //-->
+ </table></td>
+<!-- body_text //-->
+ <td width="100%" valign="top"><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); ?></td>
+ </tr>
+ </table></td>
+ </tr>
+ <tr>
+ <td><?php echo tep_image(HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES . 'store_logo.png'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
+ </tr>
+ <tr><?php echo tep_draw_form('logo', FILENAME_STORE_LOGO, 'action=save', 'post', 'enctype="multipart/form-data"'); ?>
+ <td><table border="0" cellspacing="0" cellpadding="2">
+ <tr>
+ <td class="main" valign="top"><?php echo TEXT_LOGO_IMAGE; ?></td>
+ <td class="main"><?php echo tep_draw_file_field('store_logo'); ?></td>
+ </tr>
+ </table></td>
+ </tr>
+ <tr>
+ <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
+ </tr>
+ <tr>
+ <td class="main"><?php echo TEXT_FORMAT_AND_LOCATION; ?></td>
+ </tr>
+ <tr>
+ <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
+ </tr>
+ <tr>
+ <td class="main"><?php echo DIR_FS_CATALOG_IMAGES . 'store_logo.png'; ?></td>
+ </tr>
+ <tr>
+ <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
+ </tr>
+ <tr>
+ <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
+ <tr>
+ <td class="main" align="right"><?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?></td>
+ </tr>
+ </table></td>
+ </form></tr>
+ </table></td>
+<!-- body_text_eof //-->
+ </tr>
+</table>
+<!-- body_eof //-->
+
+<!-- footer //-->
+<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
+<!-- footer_eof //-->
+<br>
+</body>
+</html>
+<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

0 comments on commit 47532bc

Please sign in to comment.
Something went wrong with that request. Please try again.