Compare commits

..

4 Commits

Author SHA1 Message Date
Clemens Schwaighofer
436025dd22 admin includes updates, Class L10n fix
- Class L10n had wrong default path to the language file, so the file
load failed
- Fix some default admin includes file for template settings
2019-06-25 17:07:47 +09:00
Clemens Schwaighofer
19458a2eba Escape - in email regex in Basic class 2019-06-14 14:50:46 +09:00
Clemens Schwaighofer
aa9e985120 Fix for CoreLibs/Output/Form/Generate 2019-06-10 13:14:41 +09:00
Clemens Schwaighofer
a0d5e18832 Bug fix for Basic class date/time compare 2019-06-07 16:40:12 +09:00
6 changed files with 45 additions and 141 deletions

View File

@@ -29,7 +29,11 @@ if (isset($_SESSION['DEFAULT_LANG'])) {
$lang_short = substr($lang, 0, 2);
// set include & template names
$CONTENT_INCLUDE = str_replace(".php", ".tpl", $cms->page_name);
$PAGE_FILE_NAME = str_replace(".php", "", $cms->page_name);
// set include & template names
if (!isset($CONTENT_INCLUDE)) {
$CONTENT_INCLUDE = $PAGE_FILE_NAME.'.tpl';
}
$FORM_NAME = !isset($FORM_NAME) || !$FORM_NAME ? str_replace(".php", "", $cms->page_name) : $FORM_NAME;
// set local page title
$L_TITLE = ucfirst(str_replace('_', ' ', $cms->getPageName(1))).' - '.$G_TITLE;
@@ -52,7 +56,7 @@ if ($smarty) {
$smarty->setTemplateDir($cms->template_path);
}
if (isset($LANGUAGE_FOLDER)) {
$cms->kang_dir = $LANGUAGE_FOLDER;
$cms->lang_dir = $LANGUAGE_FOLDER;
} else {
$cms->lang_dir = BASE.INCLUDES.LANG.CONTENT_PATH; // no outside
}
@@ -64,14 +68,20 @@ $cms->cache_pictures_root = ROOT.$cms->cache_pictures;
if (!is_dir($cms->cache_pictures_root)) {
mkdir($cms->cache_pictures_root);
}
// check if template names exist
if (!file_exists($smarty->getTemplateDir()[0].DS.$MASTER_TEMPLATE_NAME)) {
// abort if master template could not be found
exit('MASTER TEMPLATE: '.$MASTER_TEMPLATE_NAME.' could not be found');
// check for template include
if (isset($USE_INCLUDE_TEMPLATE) && $USE_INCLUDE_TEMPLATE === true && !isset($TEMPLATE_NAME)) {
$TEMPLATE_NAME = $CONTENT_INCLUDE;
}
if (isset($TEMPLATE_NAME) && !file_exists($smarty->getTemplateDir()[0].DS.$TEMPLATE_NAME)) {
exit('INCLUDE TEMPLATE: '.$TEMPLATE_NAME.' could not be found');
if (!$AJAX_PAGE) {
// check if template names exist
if (!file_exists($smarty->getTemplateDir()[0].DS.$MASTER_TEMPLATE_NAME)) {
// abort if master template could not be found
exit('MASTER TEMPLATE: '.$MASTER_TEMPLATE_NAME.' could not be found');
}
if (isset($TEMPLATE_NAME) && !file_exists($smarty->getTemplateDir()[0].DS.$TEMPLATE_NAME)) {
exit('INCLUDE TEMPLATE: '.$TEMPLATE_NAME.' could not be found');
}
}
// if the lang folder is different to the default one
@@ -91,24 +101,26 @@ if (false === strstr(BASE.INCLUDES.LANG.CONTENT_PATH, $cms->lang_dir) ||
}
}
// javascript translate data as template for auto translate
if (!$TEMPLATE_TRANSLATE) {
$TEMPLATE_TRANSLATE = 'jsTranslate_'.$lang.'.tpl';
$cms->debug('LANG', 'Load lang: '.$lang.', for page file '.$TEMPLATE_TRANSLATE);
} else {
// we assume we have some fixed set
// we must add _<$lang>
// if .tpl, put before .tpl
// if not .tpl, add _<$lang>.tpl
if (strpos($TEMPLATE_TRANSLATE, '.tpl')) {
$TEMPLATE_TRANSLATE = str_replace('.tpl', '_'.$lang.'.tpl', $TEMPLATE_TRANSLATE);
if (!$AJAX_PAGE) {
// javascript translate data as template for auto translate
if (!$TEMPLATE_TRANSLATE) {
$TEMPLATE_TRANSLATE = 'jsTranslate_'.$lang.'.tpl';
$cms->debug('LANG', 'Load lang: '.$lang.', for page file '.$TEMPLATE_TRANSLATE);
} else {
$TEMPLATE_TRANSLATE .= '_'.$lang.'.tpl';
// we assume we have some fixed set
// we must add _<$lang>
// if .tpl, put before .tpl
// if not .tpl, add _<$lang>.tpl
if (strpos($TEMPLATE_TRANSLATE, '.tpl')) {
$TEMPLATE_TRANSLATE = str_replace('.tpl', '_'.$lang.'.tpl', $TEMPLATE_TRANSLATE);
} else {
$TEMPLATE_TRANSLATE .= '_'.$lang.'.tpl';
}
}
// if we can't find it, dump it
if (!file_exists($smarty->getTemplateDir()[0].DS.$TEMPLATE_TRANSLATE)) {
unset($TEMPLATE_TRANSLATE);
}
}
// if we can't find it, dump it
if (!file_exists($smarty->getTemplateDir()[0].DS.$TEMPLATE_TRANSLATE)) {
unset($TEMPLATE_TRANSLATE);
}
// $cms->debug("LANGUAGE", "L: $lang | ".$cms->lang_dir." | MO File: ".$cms->l->mofile);

View File

@@ -99,6 +99,6 @@ if (is_dir(BASE.TEMPLATES_C)) {
if (is_dir(BASE.CACHE)) {
$smarty->setCacheDir(BASE.CACHE);
}
$smarty->display($MASTER_TEMPLATE_NAME, $TEMPLATE.$lang, $TEMPLATE.$lang);
$smarty->display($MASTER_TEMPLATE_NAME, $CACHE_ID.($CACHE_ID ? '_' : '').$lang, $COMPILE_ID.($COMPILE_ID ? '_' : '').$lang);
// __END__

View File

@@ -1,108 +0,0 @@
{*
********************************************************************
* AUTHOR: Clemens Schwaighofer
* DATE: 2005/06/23
* DESCRIPTION:
* edit body part
* HISTORY:
********************************************************************
*}
<div style="position:relative; width: {$table_width}px; margin-top: 5px; margin-bottom: 5px; top: 0px; left: 0px;">
{* <div style="position: absolute; top: 0px; left: 0px; width: 240px; height: 100%; z-index: 1; overflow: auto; border: 1px solid blue;">
left
</div> *}
<div style="position: relative; top: 0px; left: 0px; width: 790px; z-index: 2; margin: 2px; padding: 2px;">
<div style="margin-bottom: 2px; padding: 2px; position: relative; border: 1px solid #e5ddba;">
<div style="margin-bottom: 2px; padding: 2px; font-size: 12px; font-weight: bold;">
Status
</div>
<div id="index_issues_data" style="margin-bottom: 2px; padding: 2px; border: 1px solid gray;">
<b>Shops</b><br>
Shops Flagged Delete: {$shop_delete_flagged}<br>
Shops Flagged Offline: {$shop_offline_flagged}<br>
Shops Flagged Online: {$shop_online_flagged}<br>
Shops without any categories: {$shop_no_category}<br>
<br>
<b>Products</b><br>
Products Flagged no image: {$products_no_image_flagged}<br>
Products Flagged offline: {$products_offline_flagged}<br>
Products Flagged online: {$products_online_flagged}<br>
Products without any color tags: {$products_no_color_tags}<br>
<br>
<b>Categories</b><br>
Categories without Products: {$categories_no_products}<br>
</div>
</div>
{ * shows shops to be uploaded *}
{if $queued_items}
<form method="post" name="{$form_name}">
<div style="margin-bottom: 2px; padding: 2px; position: relative; border: 2px solid #8a1113;">
<div style="margin-bottom: 2px; padding: 2px; position: relative; height: 30px;">
<div style="position: absolute; top: 2px; left: 2px; height: 20px; width: 140px; padding: 2px; font-size: 12px; font-weight: bold;">
Items to push live
</div>
<div style="position: absolute; top: 2px; right: 2px; height: 25px; width: 450px; padding: 2px; text-align: right;">
<input type="button" id="cancel_push_live" name="cancel_push_live" value="Delete from live Queue" OnClick="document.{$form_name}.action.value='cancel_push_live';document.{$form_name}.action_yes.value=confirm('Do you want to want to delete the selected items from the live queue?');if (document.{$form_name}.action_yes.value == 'true') document.{$form_name}.submit();" {if $page_acl < 90}disabled{/if}>
<input type="button" id="push_live" name="push_live" value="Push data to live server" OnClick="document.{$form_name}.action.value='push_live';document.{$form_name}.action_yes.value=confirm('Do you want to push all the changes to the live server?');if (document.{$form_name}.action_yes.value == 'true') document.{$form_name}.submit();" {if $locked || $page_acl < 90}disabled{/if}>
</div>
</div>
<div id="index_issues_data" style="margin-bottom: 2px; padding: 2px; border: 1px solid gray;">
<div style="clear: both;"></div>
<div style="float: left; width: 40px; text-align: right; font-weight: bold; padding-right: 2px; border-right: 1px solid gray; border-bottom: 1px solid gray;">del</div>
<div style="float: left; width: 30px; font-weight: bold; border-bottom: 1px solid gray; padding-left: 2px;">GK</div>
<div style="float: left; width: 140px; font-weight: bold; border-bottom: 1px solid gray;">Date</div>
<div style="float: left; width: 70px; font-weight: bold; border-bottom: 1px solid gray;">Type</div>
<div style="float: left; width: 50px; font-weight: bold; border-bottom: 1px solid gray;">Action</div>
<div style="float: left; width: 80px; font-weight: bold; border-bottom: 1px solid gray;">Target</div>
<div style="float: left; width: 80px; font-weight: bold; border-bottom: 1px solid gray;">Key</div>
<div style="float: left; width: 170px; font-weight: bold; border-bottom: 1px solid gray;">Key ID</div>
<div style="float: left; width: 30px; font-weight: bold; border-bottom: 1px solid gray;">Asc</div>
<div style="float: left; width: 50px; font-weight: bold; border-bottom: 1px solid gray;">Lock</div>
<div style="clear: both;"></div>
{foreach from=$queued_items key=key item=item}
<div style="float: left; width: 40px; text-align: right; padding-right: 2px; margin-right: 2px; border-right: 1px solid gray; background-color: {$item.color};">{if $item.checkbox}<input type="checkbox" name="group_key[]" value="{$item.group_key}" style="height: 9px;" {if $item.associate != '-'}disabled{/if}>{else}&nbsp;{/if}</div>
<div style="float: left; width: 30px; background-color: {$item.color};" {popup width="30" caption="ID" text="`$key`"}>{$item.group_key}</div>
<div style="float: left; width: 140px; background-color: {$item.color};">{$item.date_created}</div>
<div style="float: left; width: 70px; background-color: {$item.color}; font-weight: bold; color: {$item.type_color};" {popup width="450" caption="Data" text="`$item.data`"}>{$item.type}</div>
<div style="float: left; width: 50px; background-color: {$item.color};">{$item.action}</div>
<div style="float: left; width: 80px; background-color: {$item.color};">{$item.target}</div>
<div style="float: left; width: 80px; background-color: {$item.color};">{$item.key_name}</div>
<div style="float: left; width: 170px; background-color: {$item.color};" {popup width="250" caption="Key ID" text="`$item.key_value`"}>{$item.key_value}</div>
<div style="float: left; width: 30px; background-color: {$item.color};">{$item.associate}</div>
<div style="float: left; width: 50px; background-color: {$item.color}; font-weight: bold; color: red;">{$item.locked}</div>
<div style="clear: both;"></div>
{/foreach}
</div>
</div>
<input type="hidden" id="action" name="action" value="">
<input type="hidden" id="action_yes" name="action_yes" value="">
<input type="hidden" name="action_loaded" value="true">
</form>
{/if}
<div style="margin-bottom: 2px; padding: 2px; position: relative; border: 1px solid #e5ddba;">
<div style="margin-bottom: 2px; padding: 2px; font-size: 12px; font-weight: bold;">
Issues
</div>
<div id="index_issues_data" style="margin-bottom: 2px; padding: 2px; border: 1px solid gray;">
{$issue_data}
</div>
</div>
<div style="margin-bottom: 2px; padding: 2px; position: relative; border: 1px solid #e5ddba;">
<div style="margin-bottom: 2px; padding: 2px; position: relative; height: 26px;">
<div style="position: absolute; top: 2px; left: 2px; height: 20px; width: 250px; padding: 2px; font-size: 12px; font-weight: bold;">
Quick Search
</div>
<div style="position: absolute; top: 2px; right: 2px; height: 20px; width: 350px; padding: 2px; text-align: right;" {popup width="100" text="Search in Key, Name, Prefecture, Category"}>
<span id="search_status">Search for Key / String:</span> <input type="text" id="quick_search_shop" name="quick_search_shop" value="" onKeyup="QuickSearchInput(); return false;">
</div>
</div>
<div id="quick_search_results" style="margin-bottom: 2px; padding: 2px; position: relative; border: 1px solid gray;">
Enter something to search into the search field
</div>
</div>
</div>
</div>

View File

@@ -276,7 +276,7 @@ class Basic
}
// set the regex for checking emails
$this->email_regex = "^[A-Za-z0-9!#$%&'*+-\/=?^_`{|}~][A-Za-z0-9!#$%:\(\)&'*+-\/=?^_`{|}~\.]{0,63}@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,})*\.([a-zA-Z]{2,}){1}$";
$this->email_regex = "^[A-Za-z0-9!#$%&'*+\-\/=?^_`{|}~][A-Za-z0-9!#$%:\(\)&'*+\-\/=?^_`{|}~\.]{0,63}@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]{1,})*\.([a-zA-Z]{2,}){1}$";
// this is for error check parts in where the email regex failed
$this->email_regex_check = array (
1 => "@(.*)@(.*)", // double @
@@ -1375,7 +1375,7 @@ class Basic
return false;
}
if (($hour < 0 || $hour > 24) ||
($min < 0 || $hour > 60) ||
($min < 0 || $min > 60) ||
($sec && ($sec < 0 || $sec > 60))
) {
return false;

View File

@@ -45,7 +45,7 @@ class L10n extends \CoreLibs\Basic
// override path check
if (!is_dir($path)) {
$path = INCLUDES.LANG.CONTENT_PATH;
$path = BASE.INCLUDES.LANG.CONTENT_PATH;
}
$this->mofile = $path.$this->lang.".mo";
@@ -70,7 +70,7 @@ class L10n extends \CoreLibs\Basic
// override path check
if (!is_dir($path)) {
$path = INCLUDES.LANG.CONTENT_PATH;
$path = BASE.INCLUDES.LANG.CONTENT_PATH;
}
$this->mofile = $path.$this->lang.".mo";

View File

@@ -1351,11 +1351,11 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
}
// set type and boundaries for insert/update
if ($data_array['pk_id'] && $_POST[$prfx.$el_name][$i]) {
$q_begin[$i] = 'UPDATE $table_name SET ';
$q_end[$i] = ' WHERE $el_name = '.$_POST[$prfx.$el_name][$i];
$q_begin[$i] = 'UPDATE '.$table_name.' SET ';
$q_end[$i] = ' WHERE '.$el_name.' = '.$_POST[$prfx.$el_name][$i];
$type[$i] = 'update';
} elseif ($data_array['pk_id'] && !$_POST[$prfx.$el_name][$i]) {
$q_begin[$i] = 'INSERT INTO $table_name (';
$q_begin[$i] = 'INSERT INTO '.$table_name.' (';
$q_middle[$i] = ') VALUES (';
$q_end[$i] = ')';
$type[$i] = 'insert';