<?php
/*
--------------------------------------------------------------
GMLogoManager.php 2010-08-12 gm
Gambio GmbG
http://www.gambio.de
Copyright (c) 2010 Gambio GmbG
Released under the GNU General Public License
--------------------------------------------------------------
*/
/*
* a class to manage the logo files
*/
class GMLogoManager {
var $logo_path;
var $logo_src;
var $logo_use;
var $logo_file;
var $logo_key;
/*
* -> constructor
*/
function GMLogoManager($logo_key) {
if(!defined(GM_HTTP_SERVER)) {
define(GM_HTTP_SERVER, HTTP_SERVER);
}
$this->logo_src = DIR_FS_CATALOG . DIR_WS_IMAGES . 'logos/';
$this->logo_path = GM_HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . 'logos/';
$this->logo_use = gm_get_conf(strtoupper($logo_key) . '_USE');
$this->logo_file = gm_get_conf(strtoupper($logo_key));
$this->logo_key = $logo_key;
return;
}
/*
* -> to get the logo html
*/
function get_logo($gm_alt='logo') {
$_w = gm_get_conf(strtoupper($this->logo_key) . '_SIZE_W');
$_h = gm_get_conf(strtoupper($this->logo_key) . '_SIZE_H');
if($this->logo_key == 'gm_logo_flash') {
$logo_html = ' <object type="application/x-shockwave-flash" data="' . $this->logo_path . $this->logo_file . '" width="' . $_w . '" height="' . $_h . '" codebase="https://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0">
<param name="movie" value="' . $this->logo_path . $this->logo_file . '" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
</object>
';
return $logo_html;
} else {
if(!empty($_w)) $width='width="' . $_w . '"';
if(!empty($_h)) $height='height="' . $_h . '"';
$logo_html = '<img '.$width.' '.$height.' src="' . $this->logo_path . $this->logo_file . '" alt="' . htmlspecialchars(STORE_NAME) . '" title="' . htmlspecialchars(STORE_NAME) . '" />';
return $logo_html;
}
}
/*
* -> file exist
*/
function logo_exist() {
if(file_exists($this->logo_src . $this->logo_file) && !empty($this->logo_file)) {
return true;
} else {
return false;
}
}
/*
* -> check upload by mime-type
*/
function check_upload($filetype){
if($filetype == 'image/x-icon' || $filetype == "image/ico") {
if($filetype == 'image/x-icon') {
return true;
} else {
return false;
}
} else if($this->logo_key == 'gm_logo_flash') {
if($filetype == "application/x-shockwave-flash") {
return true;
} else {
return false;
}
} else if($this->logo_key == 'gm_logo_overlay') {
if($filetype == "image/gif") {
return true;
} else {
return false;
}
} else {
if($filetype == "image/gif"
|| $filetype == "image/png"
|| $filetype == "image/x-png"
|| $filetype == "image/jpg"
|| $filetype == "image/jpeg"
|| $filetype == "image/gif"
|| $filetype == "image/pjpeg") {
return true;
} else {
return false;
}
}
}
/*
* -> upload manager
*/
function upload() {
$this->manage_logos();
if($_POST['GM_LOGO_DELETE'] == 'on') {
// delete old file if exists
if(file_exists($this->logo_src . $this->logo_file)) {
unlink($this->logo_src . $this->logo_file);
gm_set_conf(strtoupper($this->logo_key), '');
}
gm_set_conf(strtoupper($this->logo_key) . '_USE', '0');
$this->logo_use = '0';
return GM_LOGO_FILE_DELETED;
} else if(!empty($_FILES['GM_LOGO']['name'])) {
$myparts = pathinfo($_FILES['GM_LOGO']['name']);
$myextension = strtolower($myparts['extension']);
if(($this->check_upload($_FILES['GM_LOGO']['type']) && $this->logo_key != 'gm_logo_favicon')
|| ($this->logo_key == 'gm_logo_favicon' && $myextension == 'ico')) {
// prepare filenames
if($this->logo_key == 'gm_logo_favicon') {
$new_filename = 'favicon.ico';
} else if($this->logo_key == 'gm_logo_overlay') {
$new_filename = 'overlay.gif';
} else {
$new_filename = gm_prepare_filename($_FILES['GM_LOGO']['name']);
}
if(!file_exists($this->logo_src . $new_filename) || $this->logo_file == $new_filename) {
// delete old file if exists
if(file_exists($this->logo_src . $this->logo_file)) {
@unlink($this->logo_src . $this->logo_file);
}
@copy($_FILES['GM_LOGO']['tmp_name'], $this->logo_src . $new_filename);
@chmod($this->logo_src . $new_filename, 0777);
// save data to configuration
gm_set_conf(strtoupper($this->logo_key), $new_filename);
// set size once a time
$imagesize = @getimagesize($this->logo_src . $new_filename);
gm_set_conf(strtoupper($this->logo_key) . '_SIZE_W', $imagesize[0]);
gm_set_conf(strtoupper($this->logo_key) . '_SIZE_H', $imagesize[1]);
if(strtoupper($this->logo_key) == 'GM_LOGO_CAT') {
gm_set_conf(strtoupper($this->logo_key) . '_USE', '1');
}
// save data to configuration
gm_set_conf(strtoupper($this->logo_key), $new_filename);
$this->logo_file = $new_filename;
return GM_LOGO_UPLOAD_SUCCEEDED;
// file in use
} else {
return GM_LOGO_FILE_EXISTS;
}
// file not allowed
} else {
return GM_LOGO_FILETYP_WRONG;
}
}
}
/*
* -> manage logos
*/
function manage_logos() {
if($this->logo_key == 'gm_logo_flash' && file_exists($this->logo_src . gm_get_conf('GM_LOGO_FLASH')) && $_POST['GM_LOGO_USE'] == 'on') {
gm_set_conf('GM_LOGO_FLASH_USE', '1');
gm_set_conf('GM_LOGO_SHOP_USE', '0');
$this->logo_use = '1';
} else if($this->logo_key == 'gm_logo_shop' && file_exists($this->logo_src . gm_get_conf('GM_LOGO_SHOP')) && $_POST['GM_LOGO_USE'] == 'on') {
gm_set_conf('GM_LOGO_FLASH_USE', '0');
gm_set_conf('GM_LOGO_SHOP_USE', '1');
$this->logo_use = '1';
} else if(($this->logo_key == 'gm_logo_mail' || $this->logo_key == 'gm_logo_ebay' || $this->logo_key == 'gm_logo_favicon' || $this->logo_key == 'gm_logo_pdf') && $this->logo_exist() && $_POST['GM_LOGO_USE'] == 'on') {
gm_set_conf(strtoupper($this->logo_key) . '_USE', '1');
$this->logo_use = '1';
} else if(empty($_POST['GM_LOGO_USE'])) {
gm_set_conf(strtoupper($this->logo_key) . '_USE', '0');
$this->logo_use = '0';
}
return;
}
}
?>| nama | waktu | ukuran | owner | perm | aksi |
|---|---|---|---|---|---|
| .. | |||||
| csstidy/ | 2013-11-12 21:03 | 125.89 KB | 76129f60960:kunden | dxwrx-rx-r | |
| lib/ | 2013-11-12 21:03 | 601.96 KB | 76129f60960:kunden | dxwrx-rx-r | |
| ErrorHandler.php | 2013-11-12 21:03 | 10.34 KB | 76129f60960:kunden | -xw-x----- | |
| FileLog.php | 2013-11-12 21:02 | 2.93 KB | 76129f60960:kunden | -xw-x----- | |
| GMAltText.php | 2013-11-12 21:03 | 2.94 KB | 76129f60960:kunden | -xw-x----- | |
| GMAttributesCalculator.php | 2013-11-12 21:03 | 4.65 KB | 76129f60960:kunden | -xw-x----- | |
| GMCSSMonitor.php | 2013-11-12 21:03 | 13.19 KB | 76129f60960:kunden | -xw-x----- | |
| GMCSSOptimizer.php | 2013-11-12 21:03 | 32.87 KB | 76129f60960:kunden | -xw-x----- | |
| GMCat.php | 2013-11-12 21:03 | 9.08 KB | 76129f60960:kunden | -xw-x----- | |
| GMCounter.php | 2013-11-12 21:03 | 17.05 KB | 76129f60960:kunden | -xw-x----- | |
| GMEbay.php | 2013-11-12 21:02 | 9.16 KB | 76129f60960:kunden | -xw-x----- | |
| GMGMotion.php | 2013-11-12 21:02 | 24.31 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintCartManager.php | 2013-11-12 21:03 | 14.66 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintConfiguration.php | 2013-11-12 21:03 | 2.17 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintContentManager.php | 2013-11-12 21:02 | 8.79 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintElements.php | 2013-11-12 21:03 | 15.79 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintFileManager.php | 2013-11-12 21:02 | 6.06 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintOrderElements.php | 2013-11-12 21:03 | 7.46 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintOrderManager.php | 2013-11-12 21:03 | 6.27 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintOrderSurfaces.php | 2013-11-12 21:03 | 6.41 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintOrderSurfacesManager.php | 2013-11-12 21:03 | 4.86 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintProductManager.php | 2013-11-12 21:02 | 4.55 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintSurfaces.php | 2013-11-12 21:03 | 9.99 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintSurfacesGroupsManager.php | 2013-11-12 21:03 | 1.96 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintSurfacesManager.php | 2013-11-12 21:03 | 9.62 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintWishlistManager.php | 2013-11-12 21:03 | 14.81 KB | 76129f60960:kunden | -xw-x----- | |
| GMJSON.php | 2013-11-12 21:03 | 2.44 KB | 76129f60960:kunden | -xw-x----- | |
| GMJanolaw.php | 2013-11-12 21:03 | 3.76 KB | 76129f60960:kunden | -xw-x----- | |
| GMLangFileMaster.php | 2013-11-12 21:03 | 965 B | 76129f60960:kunden | -xw-x----- | |
| GMLightboxControl.php | 2013-11-12 21:03 | 691 B | 76129f60960:kunden | -xw-x----- | |
| GMLogoManager.php | 2013-11-12 21:03 | 6.78 KB | 76129f60960:kunden | -xw-x----- | |
| GMMeta.php | 2013-11-12 21:02 | 8.29 KB | 76129f60960:kunden | -xw-x----- | |
| GMProduct.php | 2013-11-12 21:03 | 2.37 KB | 76129f60960:kunden | -xw-x----- | |
| GMSEOBoost.php | 2013-11-12 21:03 | 25.63 KB | 76129f60960:kunden | -xw-x----- | |
| GMSitemap.php | 2013-11-12 21:03 | 5.32 KB | 76129f60960:kunden | -xw-x----- | |
| GMStatusbar.php | 2013-11-12 21:02 | 2.46 KB | 76129f60960:kunden | -xw-x----- | |
| GMTSWidget.php | 2013-11-12 21:03 | 4.93 KB | 76129f60960:kunden | -xw-x----- | |
| GMTabTokenizer.php | 2013-11-12 21:03 | 2.81 KB | 76129f60960:kunden | -xw-x----- | |
| GMTracker.php | 2013-11-12 21:03 | 3.49 KB | 76129f60960:kunden | -xw-x----- | |
| JSON.php | 2013-11-12 21:03 | 39.98 KB | 76129f60960:kunden | -xw-x----- | |
| application_top.php | 2013-11-12 21:03 | 34.02 KB | 76129f60960:kunden | -xw-x----- | |