<?php
/* --------------------------------------------------------------
GMJanolaw.php 2010-06-08 gambio
Gambio GmbH
http://www.gambio.de
Copyright (c) 2010 Gambio GmbH
Released under the GNU General Public License (Version 2)
[http://www.gnu.org/licenses/gpl-2.0.html]
--------------------------------------------------------------
*/
class GMJanolaw
{
var $m_user_id = false;
var $m_shop_id = false;
var $m_cache_seconds = 7200; # 2hours
function GMJanolaw()
{
$this->m_user_id = xtc_cleanName(MODULE_GAMBIO_JANOLAW_USER_ID);
$this->m_shop_id = xtc_cleanName(MODULE_GAMBIO_JANOLAW_SHOP_ID);
if($this->get_status() == true)
{
# phantom call for creating checkout cache-file
$this->get_page_content('widerrufsbelehrung', false, true, 'checkout-widerrufsbelehrung');
$this->get_page_content('agb', false, true, 'checkout-agb');
}
}
function get_status()
{
if(defined('MODULE_GAMBIO_JANOLAW_STATUS') == false || MODULE_GAMBIO_JANOLAW_STATUS == 'False')
{
# module not found or not activated.
return false;
}
# module installed and active
return true;
}
function get_page_content($p_page_name, $p_include_mode=true, $p_html_format=true, $p_cache_filename='')
{
if($this->get_status() == false) {
return 'Das Janolaw-Modul ist nicht aktiviert.';
}
$c_page_name = xtc_cleanName($p_page_name);
if($p_include_mode) {
$t_include_mode_suffix = '_include';
} else {
$t_include_mode_suffix = '';
}
if($p_html_format) {
$t_format_suffix = 'html';
} else {
$t_format_suffix = 'txt';
}
if($p_cache_filename != '')
{
$t_cache_file = DIR_FS_CATALOG . 'cache/'. xtc_cleanName($p_cache_filename) .'.'. $t_format_suffix;
}
else {
# build page-specific source path for cache file
$t_cache_file = DIR_FS_CATALOG . 'cache/'.
$this->m_user_id .'-'.
$this->m_shop_id .'-'.
$c_page_name.
$t_include_mode_suffix.'.'.$t_format_suffix;
}
$t_create_cache = false;
if(file_exists($t_cache_file) == false) {
$t_create_cache = true;
}
elseif(filesize($t_cache_file) < 100) {
$t_create_cache = true;
}
elseif(filemtime($t_cache_file) < time() - $this->m_cache_seconds) {
$t_create_cache = true;
}
# load page and create cache
if($t_create_cache)
{
# build source url for getting page content
$t_source_url = 'http://www.janolaw.de/agb-service/shops/'.
$this->m_user_id .'/'.
$this->m_shop_id .'/'.
$c_page_name.
$t_include_mode_suffix.'.'.$t_format_suffix;
$t_content = '';
# load page from janolaw site
if(function_exists('file_get_contents'))
{
$t_content = @file_get_contents($t_source_url);
}
if(empty($t_content) && function_exists('curl_init'))
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $t_source_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$t_content = curl_exec($ch);
curl_close($ch);
}
# looking for success
if($t_content != false || strlen($t_content) > 100)
{
# write page content to cache file on success
$fp = fopen($t_cache_file, 'w+');
fwrite($fp, $t_content);
fclose($fp);
}
}
# use cache file for output
$t_content = file_get_contents($t_cache_file);
if($p_html_format)
{
# append needed css styles
$t_content = '<style type="text/css">#janolaw-paragraph, #janolaw-footer { margin-top: 20px; } #janolaw-body ol { margin: 8px 4px 4px 8px; } #janolaw-body li { margin: 8px 4px 4px 24px; }</style>' . $t_content;
}
# display page content
return $t_content;
}
}
?>| 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----- | |