Compare commits

...

7 Commits

Author SHA1 Message Date
Clemens Schwaighofer
d0753512a3 Fix path calls, add better js html options block
in admin set paths, only call smarty sets if smarty object is initalized

Add better JS html options creation with multi block allow. Old call is
still there as wrapper to new call html_options_block

missing variable init in Class Basic
2019-07-31 15:36:28 +09:00
Clemens Schwaighofer
d0de3821f8 Basic class date diff calc fix for including last day 2019-07-08 12:02:15 +09:00
Clemens Schwaighofer
0d89eea1af Basic class fix for calc interval, smarty test page fix
- smarty test page used old variable names
- the interval date calc function was private but should be public
static
2019-06-28 11:50:40 +09:00
Clemens Schwaighofer
d87033d57d Update include files for more cleaner work 2019-06-28 10:13:40 +09:00
Clemens Schwaighofer
19a44d9340 Clean up edit_* pages, some config changes, bug fixes
- Class Basic convert string to bytes fix
- admin edit_* pages do not need JS except pop call, moved that into the
template and do not load any other JS anymore
- changed the EDIT_STYLESHEET/JAVACSRIPT names to ADMIN_ to give them
the proper name that they are admin based functions
- paths are in an extra config file
- plan on moving edit_* css rules into a special CSS file just for this
2019-06-27 14:41:56 +09:00
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
14 changed files with 266 additions and 219 deletions

1
.phplint-cache Normal file

File diff suppressed because one or more lines are too long

View File

@@ -16,10 +16,10 @@ $CSS_NAME = 'smart_test.css';
$USE_PROTOTYPE = false;
$USE_JQUERY = true;
if ($USE_PROTOTYPE) {
$EDIT_JAVASCRIPT = 'edit.pt.js';
$ADMIN_JAVASCRIPT = 'edit.pt.js';
$JS_NAME = 'prototype.test.js';
} else if ($USE_JQUERY) {
$EDIT_JAVASCRIPT = 'edit.jq.js';
} elseif ($USE_JQUERY) {
$ADMIN_JAVASCRIPT = 'edit.jq.js';
$JS_NAME = 'jquery.test.js';
}
$PAGE_WIDTH = "100%";

View File

@@ -26,6 +26,8 @@ DEFINE('LIBS', 'lib'.DS);
DEFINE('CONFIGS', 'configs'.DS);
// includes (strings, arrays for static, etc)
DEFINE('INCLUDES', 'includes'.DS);
// data folder (mostly in includes)
DEFINE('DATA', 'data'.DS);
// layout base path
DEFINE('LAYOUT', 'layout'.DS);
// pic-root (compatible to CMS)
@@ -130,6 +132,10 @@ DEFINE('SESSION_NAME', 'SESSION_NAME'.SERVER_NAME_HASH);
// SET_SESSION_NAME should be set in the header if a special session name is needed
// DEFINE('SET_SESSION_NAME', SESSION_NAME);
/************* CACHE/COMPILE IDS *************/
DEFINE('CACHE_ID', 'CACHE_'.SERVER_NAME_HASH);
DEFINE('COMPILE_ID', 'COMPILE_'.SERVER_NAME_HASH);
/************* LANGUAGE / ENCODING *******/
DEFINE('DEFAULT_LANG', 'en_utf8');
// default web page encoding setting
@@ -153,13 +159,6 @@ DEFINE('DEV_SCHEMA', 'public');
DEFINE('TEST_SCHEMA', 'public');
DEFINE('LIVE_SCHEMA', 'public');
/************* OTHER PATHS *****************/
// File and Folder paths
// ID is TARGET (first array element)
// $PATHS['test']['csv_path'] = '';
// $PATHS['test']['perl_bin'] = '';
// $PATHS['test']['redirect_url'] = '';
/************* DB ACCESS *****************/
if (file_exists(BASE.CONFIGS.'config.db.inc')) {
require BASE.CONFIGS.'config.db.inc';
@@ -168,6 +167,10 @@ if (file_exists(BASE.CONFIGS.'config.db.inc')) {
if (file_exists(BASE.CONFIGS.'config.host.inc')) {
require BASE.CONFIGS.'config.host.inc';
}
/************* OTHER PATHS *****************/
if (file_exists(BASE.CONFIGS.'config.path.inc')) {
require BASE.CONFIGS.'config.path.inc';
}
// set the USE_DATABASE var, if there is nothing set, we assume TRUE
$USE_DATABASE = defined('USE_DATABASE') ? USE_DATABASE : true;
@@ -213,14 +216,13 @@ DEFINE('SITE_LANG', $SITE_LANG[$HOST_NAME]);
DEFINE('SHOW_ALL_ERRORS', true); // show all errors if debug_all & show_error_handling are enabled
/************* GENERAL PAGE TITLE ********/
$G_TITLE = '<OVERALL PAGE TITLE>';
DEFINE('G_TITLE', '<OVERALL FALLBACK PAGE TITLE>');
/************ STYLE SHEETS / JS **********/
$EDIT_STYLESHEET = 'edit.css';
$EDIT_JAVASCRIPT = 'edit.js';
$STYLESHEET = 'frontend.css';
$JAVASCRIPT = 'frontend.js';
DEFINE('ADMIN_STYLESHEET', 'edit.css');
DEFINE('ADMIN_JAVASCRIPT', 'edit.js');
DEFINE('STYLESHEET', 'frontend.css');
DEFINE('JAVASCRIPT', 'frontend.js');
// anything optional
/************* INTERNAL ******************/

17
www/configs/config.path.inc Executable file
View File

@@ -0,0 +1,17 @@
<?php
/********************************************************************
* AUTHOR: Clemens Schwaighofer
* CREATED: 2018/10/11
* SHORT DESCRIPTION:
* configuration file for core path settings
* CSV target paths, and other download access URLS or paths needed
* HISTORY:
*********************************************************************/
// File and Folder paths
// ID is TARGET (first array element)
// $PATHS['test']['csv_path'] = '';
// $PATHS['test']['perl_bin'] = '';
// $PATHS['test']['redirect_url'] = '';
// __END__

View File

@@ -33,12 +33,14 @@ if (!isset($encoding)) {
if (session_id() && $_SESSION['DEFAULT_LANG']) {
$lang = $_SESSION['DEFAULT_LANG'];
} elseif (!$lang) {
$lang = DEFAULT_LANG;
$lang = defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;
}
// end the stop of the output flow, but only if we didn't request a csv file download
if (array_key_exists('action', $_POST) && $_POST['action'] != 'download_csv') {
header("Content-type: text/html; charset=".$encoding);
ob_end_flush();
}
if ($AJAX_PAGE && !$ZIP_STREAM) {
header("Content-Type: application/json; charset=UTF-8");
}
//------------------------------ basic variable settings start
@@ -59,6 +61,8 @@ $cms->menu_show_flag = 'main';
$cms->dbInfo();
// set acl
$cms->acl = $login->acl;
// flush
ob_end_flush();
//------------------------------ class init end
//------------------------------ logging start

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;
@@ -44,6 +48,9 @@ $cms->CSS_TEMPLATE_NAME = str_replace(".tpl", ".css", $CONTENT_INCLUDE);
$cms->CSS_SPECIAL_TEMPLATE_NAME = $CSS_NAME;
// special JS file
$cms->JS_SPECIAL_TEMPLATE_NAME = $JS_NAME;
// compile & cache id
$cms->CACHE_ID = isset($CACHE_ID) ? $CACHE_ID : CACHE_ID;
$cms->COMPILE_ID = isset($COMPILE_ID) ? $COMPILE_ID : CACHE_ID;
// set basic template path (tmp)
$cms->includes = BASE.INCLUDES; // no longer in templates, only global
@@ -52,7 +59,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 +71,51 @@ $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 if we have an external file with the template name
if (file_exists($cms->includes.$cms->INC_TEMPLATE_NAME) &&
is_file($cms->includes.$cms->INC_TEMPLATE_NAME)
) {
include($cms->includes.$cms->INC_TEMPLATE_NAME);
}
if (isset($TEMPLATE_NAME) && !file_exists($smarty->getTemplateDir()[0].DS.$TEMPLATE_NAME)) {
exit('INCLUDE TEMPLATE: '.$TEMPLATE_NAME.' could not be found');
// only CSS/JS/etc include stuff if we have non AJAX page
if (!$AJAX_PAGE) {
// check for template include
if (isset($USE_INCLUDE_TEMPLATE) && $USE_INCLUDE_TEMPLATE === true && !isset($TEMPLATE_NAME)) {
$TEMPLATE_NAME = $CONTENT_INCLUDE;
// add to cache & compile id
$cms->COMPILE_ID .= '_'.$TEMPLATE_NAME;
$cms->CACHE_ID .= '_'.$TEMPLATE_NAME;
}
// additional per page Javascript include
$cms->JS_INCLUDE = '';
if (file_exists($cms->javascript.$cms->JS_TEMPLATE_NAME) && is_file($cms->javascript.$cms->JS_TEMPLATE_NAME)) {
$cms->JS_INCLUDE = $cms->javascript.$cms->JS_TEMPLATE_NAME;
}
// per page css file
$cms->CSS_INCLUDE = '';
if (file_exists($cms->css.$cms->CSS_TEMPLATE_NAME) && is_file($cms->css.$cms->CSS_TEMPLATE_NAME)) {
$cms->CSS_INCLUDE = $cms->css.$cms->CSS_TEMPLATE_NAME;
}
// optional CSS file
$cms->CSS_SPECIAL_INCLUDE = '';
if (file_exists($cms->css.$cms->CSS_SPECIAL_TEMPLATE_NAME) && is_file($cms->css.$cms->CSS_SPECIAL_TEMPLATE_NAME)) {
$cms->CSS_SPECIAL_INCLUDE = $cms->css.$cms->CSS_SPECIAL_TEMPLATE_NAME;
}
// optional JS file
$cms->JS_SPECIAL_INCLUDE = '';
if (file_exists($cms->javascript.$cms->JS_SPECIAL_TEMPLATE_NAME) && is_file($cms->javascript.$cms->JS_SPECIAL_TEMPLATE_NAME)) {
$cms->JS_SPECIAL_INCLUDE = $cms->javascript.$cms->JS_SPECIAL_TEMPLATE_NAME;
}
if ($smarty) {
// 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
@@ -81,7 +125,7 @@ if (false === strstr(BASE.INCLUDES.LANG.CONTENT_PATH, $cms->lang_dir) ||
) {
$cms->debug('LANG', 'Orig: '.BASE.INCLUDES.LANG.CONTENT_PATH.', New: '.$cms->lang_dir.' | Orig Lang: '.(defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG).', New Lang: '.$lang);
$cms->l->l10nReloadMOfile($lang, $cms->lang_dir);
// if we have login class
// if we have login class
if ($login) {
$login->l->l10nReloadMOfile($lang, $cms->lang_dir);
}
@@ -91,28 +135,32 @@ 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 ($smarty && !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);
$cms->debug("LANGUAGE", "SL: ".$_SESSION['DEFAULT_CHARSET']." | ".$_SESSION['LANG']." | ".$_SESSION['DEFAULT_LANG']);
$cms->debug("TEMPLATE", "P: ".$smarty->getTemplateDir()[0]);
if ($smarty) {
$cms->debug("TEMPLATE", "P: ".$smarty->getTemplateDir()[0]);
}
// __END__

View File

@@ -16,34 +16,6 @@ if ($cms->HEADER['USE_PROTOTYPE']) {
// jquery and prototype should not be used together
$cms->HEADER['USE_JQUERY'] = isset($USE_JQUERY) ? $USE_JQUERY : USE_JQUERY; // don't use either of those two together
// set basic template path (tmp)
// paths are set in the 'set_paths.inc' file
// check if we have an external file with the template name
if (file_exists($cms->includes.$cms->INC_TEMPLATE_NAME) && is_file($cms->includes.$cms->INC_TEMPLATE_NAME)) {
include($cms->includes.$cms->INC_TEMPLATE_NAME);
}
// additional per page Javascript include
$cms->JS_INCLUDE = '';
if (file_exists($cms->javascript.$cms->JS_TEMPLATE_NAME) && is_file($cms->javascript.$cms->JS_TEMPLATE_NAME)) {
$cms->JS_INCLUDE = $cms->javascript.$cms->JS_TEMPLATE_NAME;
}
// per page css file
$cms->CSS_INCLUDE = '';
if (file_exists($cms->css.$cms->CSS_TEMPLATE_NAME) && is_file($cms->css.$cms->CSS_TEMPLATE_NAME)) {
$cms->CSS_INCLUDE = $cms->css.$cms->CSS_TEMPLATE_NAME;
}
// optional CSS file
$cms->CSS_SPECIAL_INCLUDE = '';
if (file_exists($cms->css.$cms->CSS_SPECIAL_TEMPLATE_NAME) && is_file($cms->css.$cms->CSS_SPECIAL_TEMPLATE_NAME)) {
$cms->CSS_SPECIAL_INCLUDE = $cms->css.$cms->CSS_SPECIAL_TEMPLATE_NAME;
}
// optional JS file
$cms->JS_SPECIAL_INCLUDE = '';
if (file_exists($cms->javascript.$cms->JS_SPECIAL_TEMPLATE_NAME) && is_file($cms->javascript.$cms->JS_SPECIAL_TEMPLATE_NAME)) {
$cms->JS_SPECIAL_INCLUDE = $cms->javascript.$cms->JS_SPECIAL_TEMPLATE_NAME;
}
// the actual include files for javascript (per page)
$cms->HEADER['JS_INCLUDE'] = $cms->JS_INCLUDE;
$cms->HEADER['CSS_INCLUDE'] = $cms->CSS_INCLUDE;
@@ -61,11 +33,11 @@ $cms->HEADER['CSS'] = CSS;
$cms->HEADER['JS'] = JS;
$cms->HEADER['ENCODING'] = $encoding;
$cms->HEADER['DEFAULT_ENCODING'] = DEFAULT_ENCODING;
$cms->HEADER['STYLESHEET'] = $EDIT_STYLESHEET;
$cms->HEADER['JAVASCRIPT'] = $EDIT_JAVASCRIPT;
$cms->HEADER['STYLESHEET'] = isset($ADMIN_STYLESHEET) ? $ADMIN_STYLESHEET : ADMIN_STYLESHEET;
$cms->HEADER['JAVASCRIPT'] = isset($ADMIN_JAVASCRIPT) ? $ADMIN_JAVASCRIPT : ADMIN_JAVASCRIPT;
// html title
$cms->HEADER['HTML_TITLE'] = (!isset($L_TITLE) || !$L_TITLE) ? $cms->l->__($G_TITLE) : $cms->l->__($L_TITLE);
$cms->DATA['table_width'] = $PAGE_WIDTH ? $PAGE_WIDTH : PAGE_WIDTH;
$cms->HEADER['HTML_TITLE'] = isset($L_TITLE) ? $cms->l->__($L_TITLE) : $cms->l->__(G_TITLE);
$cms->DATA['table_width'] = isset($PAGE_WIDTH) ? $PAGE_WIDTH : PAGE_WIDTH;
// messages = array('msg' =>, 'class' => 'error/warning/...')
$cms->DATA['messages'] = $cms->messages;
@@ -99,6 +71,10 @@ 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,
$cms->CACHE_ID.($cms->CACHE_ID ? '_' : '').$lang,
$cms->COMPILE_ID.($cms->COMPILE_ID ? '_' : '').$lang
);
// __END__

View File

@@ -106,6 +106,11 @@ $data = array (
// log action
EditLog('Edit Submit', serialize($data));
// define all needed smarty stuff for the general HTML/page building
$HEADER['CSS'] = CSS;
$HEADER['DEFAULT_ENCODING'] = DEFAULT_ENCODING;
$HEADER['STYLESHEET'] = isset($ADMIN_STYLESHEET) ? $ADMIN_STYLESHEET : ADMIN_STYLESHEET;
if ($form->my_page_name == 'edit_order') {
// get is for "table_name" and "where" only
$table_name = isset($_GET['table_name']) ? $_GET['table_name'] : '';
@@ -176,18 +181,12 @@ if ($form->my_page_name == 'edit_order') {
);
} // while read data ...
// define all needed smarty stuff for the general HTML/page building
$HEADER['CSS'] = CSS;
$HEADER['DEFAULT_ENCODING'] = DEFAULT_ENCODING;
$HEADER['JS'] = JS;
$HEADER['STYLESHEET'] = $EDIT_STYLESHEET;
$HEADER['JAVASCRIPT'] = $EDIT_JAVASCRIPT;
// html title
$HEADER['HTML_TITLE'] = (!$L_TITLE) ? $smarty->l10n->__($G_TITLE) : $smarty->l10n->__($L_TITLE);
$HEADER['HTML_TITLE'] = $form->l->__('Edit Order');
// error msg
if ($error) {
$messages[] = array('msg' => $msg, 'class' => 'error', 'width' => '100%');
$messages[] = array ('msg' => $msg, 'class' => 'error', 'width' => '100%');
}
$DATA['form_error_msg'] = $messages;
@@ -235,13 +234,6 @@ if ($form->my_page_name == 'edit_order') {
$form->formProcedureDelete();
$form->formProcedureDeleteFromElementList($element_list, $remove_name);
// define all needed smarty stuff for the general HTML/page building
$HEADER['CSS'] = CSS;
$HEADER['DEFAULT_ENCODING'] = DEFAULT_ENCODING;
$HEADER['JS'] = JS;
$HEADER['STYLESHEET'] = $EDIT_STYLESHEET;
$HEADER['JAVASCRIPT'] = $EDIT_JAVASCRIPT;
$DATA['table_width'] = $table_width;
// write out error / status messages
@@ -314,7 +306,7 @@ if ($form->my_page_name == 'edit_order') {
$DATA['page_name'] = $menuarray[$position]["page_name"];
$L_TITLE = $DATA['page_name'];
// html title
$HEADER['HTML_TITLE'] = ((!$L_TITLE) ? $form->l->__($G_TITLE) : $form->l->__($L_TITLE));
$HEADER['HTML_TITLE'] = $form->l->__($L_TITLE);
// END MENU
// LOAD AND NEW
$DATA['load'] = $form->formCreateLoad();
@@ -445,7 +437,7 @@ if (is_dir(BASE.TEMPLATES_C)) {
if (is_dir(BASE.CACHE)) {
$smarty->setCacheDir(BASE.CACHE);
}
$smarty->display($EDIT_TEMPLATE, $lang, $lang);
$smarty->display($EDIT_TEMPLATE, 'editAdmin_'.$lang, 'editAdmin_'.$lang);
// debug output
echo $login->printErrorMsg();

View File

@@ -15,12 +15,14 @@
{if $STYLESHEET}
<link rel=stylesheet type="text/css" href="{$css}{$STYLESHEET}">
{/if}
{if $JAVASCRIPT}
<script language="JavaScript" src="{$js}{$JAVASCRIPT}"></script>
{/if}
{if $DATE_JAVASCRIPT}
<script language="JavaScript" src="{$JS}{$DATE_JAVASCRIPT}"></script>
{/if}
<script language="JavaScript">
<!--
function pop(theURL, winName, features) {
winName = window.open(theURL, winName, features);
winName.focus();
}
//-->
</script>
</head>
<body>
<table width="{$table_width}" border="0" cellpadding="0" cellspacing="1">

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

@@ -221,6 +221,38 @@ function getTimestamp()
return date.getTime();
}
// METHOD: dec2hex
// PARAMS: decimal string
// RETURN: string
// DESC : dec2hex :: Integer -> String
// i.e. 0-255 -> '00'-'ff'
function dec2hex(dec)
{
return ('0' + dec.toString(16)).substr(-2);
}
// METHOD: generateId
// PARAMS: lenght in int
// RETURN: random string
// DESC : generateId :: Integer -> String
// only works on mondern browsers
function generateId(len)
{
var arr = new Uint8Array((len || 40) / 2);
(window.crypto || window.msCrypto).getRandomValues(arr);
return Array.from(arr, dec2hex).join('');
}
// METHOD: randomIdF()
// PARAMS: none
// RETURN: not true random string
// DESC : creates a pseudo random string of 10 characters
// after many runs it will create duplicates
function randomIdF()
{
return Math.random().toString(36).substring(2);
}
// METHOD: isObject
// PARAMS: possible object
// RETURN: true/false if it is an object or not
@@ -554,6 +586,8 @@ function phfo(tree)
// *** DOM MANAGEMENT FUNCTIONS
// BLOCK: html wrappers for quickly creating html data blocks
// NOTE : OLD FORMAT which misses multiple block set
// METHOD: html_options
// PARAMS: name/id, array for the options, selected item uid
// options_only [def false] if this is true, it will not print the select part
@@ -563,15 +597,36 @@ function phfo(tree)
// DESC : creates an select/options drop down block.
// the array needs to be key -> value format. key is for the option id and value is for the data output
function html_options(name, data, selected = '', options_only = false, return_string = false, sort = '')
{
// wrapper to new call
return html_options_block(name, data, selected, false, options_only, return_string, sort);
}
// NOTE : USE THIS CALL, the above one is deprecated
// METHOD: html_options
// PARAMS: name/id, array for the options,
// selected item uid
// multiple [def false] if this is true, the drop down will be turned into multiple select
// options_only [def false] if this is true, it will not print the select part
// return_string [def false]: return as string and not as element
// sort [def '']: if empty as is, else allowed 'keys', 'values' all others are ignored
// RETURN: html with build options block
// DESC : creates an select/options drop down block.
// the array needs to be key -> value format. key is for the option id and value is for the data output
function html_options_block(name, data, selected = '', multiple = false, options_only = false, return_string = false, sort = '')
{
var content = [];
var element_select;
var select_options = {};
var element_option;
var data_list = []; // for sorted output
var value;
var options;
var option;
if (multiple === true) {
select_options.multiple = '';
}
// set outside select, gets stripped on return if options only is true
element_select = cel('select', name);
element_select = cel('select', name, '', [], select_options);
// console.log('Call for %s, options: %s', name, options_only);
if (sort == 'keys') {
data_list = Object.keys(data).sort();

View File

@@ -14,7 +14,7 @@ if (!DEBUG) {
// METHOD: pop
// PARAMS: url, window name, features
// RETURN: none
// DESC : opens a popup window with winNAme and given features (string)
// DESC : opens a popup window with winName and given features (string)
function pop(theURL, winName, features) {
winName = window.open(theURL, winName, features);
winName.focus();
@@ -299,6 +299,38 @@ function getTimestamp()
return date.getTime();
}
// METHOD: dec2hex
// PARAMS: decimal string
// RETURN: string
// DESC : dec2hex :: Integer -> String
// i.e. 0-255 -> '00'-'ff'
function dec2hex(dec)
{
return ('0' + dec.toString(16)).substr(-2);
}
// METHOD: generateId
// PARAMS: lenght in int
// RETURN: random string
// DESC : generateId :: Integer -> String
// only works on mondern browsers
function generateId(len)
{
var arr = new Uint8Array((len || 40) / 2);
(window.crypto || window.msCrypto).getRandomValues(arr);
return Array.from(arr, dec2hex).join('');
}
// METHOD: randomIdF()
// PARAMS: none
// RETURN: not true random string
// DESC : creates a pseudo random string of 10 characters
// after many runs it will create duplicates
function randomIdF()
{
return Math.random().toString(36).substring(2);
}
// METHOD: isObject
// PARAMS: possible object
// RETURN: true/false if it is an object or not
@@ -632,6 +664,8 @@ function phfo(tree)
// *** DOM MANAGEMENT FUNCTIONS
// BLOCK: html wrappers for quickly creating html data blocks
// NOTE : OLD FORMAT which misses multiple block set
// METHOD: html_options
// PARAMS: name/id, array for the options, selected item uid
// options_only [def false] if this is true, it will not print the select part
@@ -641,15 +675,36 @@ function phfo(tree)
// DESC : creates an select/options drop down block.
// the array needs to be key -> value format. key is for the option id and value is for the data output
function html_options(name, data, selected = '', options_only = false, return_string = false, sort = '')
{
// wrapper to new call
return html_options_block(name, data, selected, false, options_only, return_string, sort);
}
// NOTE : USE THIS CALL, the above one is deprecated
// METHOD: html_options
// PARAMS: name/id, array for the options,
// selected item uid
// multiple [def false] if this is true, the drop down will be turned into multiple select
// options_only [def false] if this is true, it will not print the select part
// return_string [def false]: return as string and not as element
// sort [def '']: if empty as is, else allowed 'keys', 'values' all others are ignored
// RETURN: html with build options block
// DESC : creates an select/options drop down block.
// the array needs to be key -> value format. key is for the option id and value is for the data output
function html_options_block(name, data, selected = '', multiple = false, options_only = false, return_string = false, sort = '')
{
var content = [];
var element_select;
var select_options = {};
var element_option;
var data_list = []; // for sorted output
var value;
var options;
var option;
if (multiple === true) {
select_options.multiple = '';
}
// set outside select, gets stripped on return if options only is true
element_select = cel('select', name);
element_select = cel('select', name, '', [], select_options);
// console.log('Call for %s, options: %s', name, options_only);
if (sort == 'keys') {
data_list = Object.keys(data).sort();

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 @
@@ -1241,8 +1241,8 @@ class Basic
// DESC : calculates the bytes based on a string with nnG, nnM, etc
public static function stringByteFormat($number)
{
$number = (int)trim($number);
$last = strtolower($number[strlen($number) - 1]);
$number = (int)trim($number);
switch ($last) {
case 't':
$number *= 1024;
@@ -1322,6 +1322,7 @@ class Basic
if (preg_match("/(d|h|m|s|ms)/", $timestring)) {
// pos for preg match read + multiply factor
$timegroups = array (2 => 86400, 4 => 3600, 6 => 60, 8 => 1);
$matches = array ();
// preg match: 0: full strsing
// 2, 4, 6, 8 are the to need values
preg_match("/^((\d+)d ?)?((\d+)h ?)?((\d+)m ?)?((\d+)s ?)?((\d+)ms)?$/", $timestring, $matches);
@@ -1453,12 +1454,14 @@ class Basic
// PARAMS: start date, end date
// RETURN: overall days, week days, weekend days as array 0...2 or named
// DESC : calculates the days between two dates
private function calcDaysInterval($start_date, $end_date, $return_named = false)
public static function calcDaysInterval($start_date, $end_date, $return_named = false)
{
// pos 0 all, pos 1 weekday, pos 2 weekend
$days = array ();
$start = new \DateTime($start_date);
$end = new \DateTime($end_date);
// so we include the last day too, we need to add +1 second in the time
$end->setTime(0, 0, 1);
$days[0] = $end->diff($start)->days;

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";