diff --git a/admin/editOrder.php b/admin/editOrder.php index 32a41de..b10c9cc 100644 --- a/admin/editOrder.php +++ b/admin/editOrder.php @@ -27,11 +27,11 @@ $activityCode = strtoupper(trim(rtrim($activityCode))); $error = false; - if (!eregi('^1-[0-9]{6}-[0-9]{6}-[0-9]{6}$',$cfop)) { + if (!preg_match('/^1-[0-9]{6}-[0-9]{6}-[0-9]{6}$/',$cfop)) { $error = true; $cfopMsg = "
Invalid CFOP Number"; } - elseif (!eregi('^[a-zA-Z0-9]{6}',$activityCode) && (strlen($activityCode) > 0)) { + elseif (!preg_match('/^[a-zA-Z0-9]{3,6}/',$activityCode) && (strlen($activityCode) > 0)) { $error = true; $activityCodeMsg = "Invalid Activity Code"; } diff --git a/admin/includes/main.inc.php b/admin/includes/main.inc.php index 0f1aebb..3937b10 100644 --- a/admin/includes/main.inc.php +++ b/admin/includes/main.inc.php @@ -11,6 +11,7 @@ // ////////////////////////////////////////////////////// +require_once '../includes/app.inc.php'; require_once '../includes/settings.inc.php'; require_once '../vendor/autoload.php'; set_include_path(get_include_path() . ':../libs'); diff --git a/includes/apps.inc.php b/includes/apps.inc.php new file mode 100644 index 0000000..22cd353 --- /dev/null +++ b/includes/apps.inc.php @@ -0,0 +1,9 @@ + diff --git a/includes/poster.inc.js b/includes/poster.inc.js index b313660..40be2ca 100644 --- a/includes/poster.inc.js +++ b/includes/poster.inc.js @@ -92,7 +92,7 @@ function validateCFOP(cfop) { } function validateActivityCode(activityCode) { - var activityCodeRegex = /^[a-zA-Z0-9]{6}/; + var activityCodeRegex = /^[a-zA-Z0-9]{3,6}/; if ((activityCode != "") && (!activityCode.match(activityCodeRegex))) { document.getElementById('activityCodeWarning').innerHTML = "Please enter a valid activity code."; return false; diff --git a/includes/settings.inc.php.dist b/includes/settings.inc.php.dist index 96bd3ff..3e2d2df 100644 --- a/includes/settings.inc.php.dist +++ b/includes/settings.inc.php.dist @@ -12,7 +12,6 @@ //////////////////////////////////////////////// define("enable",TRUE); -define("app_version","1.2.3"); define("admin_email",""); define("mysql_host",""); define("mysql_user",""); diff --git a/index.php b/index.php index 2f5af8d..2472675 100644 --- a/index.php +++ b/index.php @@ -12,6 +12,7 @@ ////////////////////////////////////////////////////// //include files for the script to run +require_once 'includes/app.inc.php'; require_once 'includes/settings.inc.php'; require_once 'vendor/autoload.php'; set_include_path(get_include_path() . ':libs'); diff --git a/libs/finishOptions.inc.php b/libs/finishOptions.inc.php index ca6b8ce..d546bfc 100644 --- a/libs/finishOptions.inc.php +++ b/libs/finishOptions.inc.php @@ -50,16 +50,16 @@ function addFinishOption($db,$name,$cost,$maxWidth,$maxLength,$default = 0) { $message .= "
Pleae enter finish option name"; $errors++; } - if (($cost == "") || !eregi('^[0-9]{1}[0-9]*[.]{1}[0-9]{2}$',$cost)) { + if (($cost == "") || !preg_match('/^[0-9]{1}[0-9]*[.]{1}[0-9]{2}$/',$cost)) { $message .= "
Please enter a valid cost"; $errors++; } - if (($maxWidth == "") || ($maxWidth > max_printer_width) || !(eregi("^[0-9]{1,2}$", $maxWidth))) { + if (($maxWidth == "") || ($maxWidth > max_printer_width) || !(preg_match("/^[0-9]{1,2}$/", $maxWidth))) { $message .= "
Please enter a valid Max Width. Maximum is " . max_printer_width . " inches"; $errors++; } - if (($maxLength == "") || !(eregi("^[0-9]{1,3}$", $maxLength))) { + if (($maxLength == "") || !(preg_match("/^[0-9]{1,3}$/", $maxLength))) { $message .= "
Please enter a valid Max Length"; $errors++; } diff --git a/libs/paperTypes.inc.php b/libs/paperTypes.inc.php index ab79048..cc8adab 100644 --- a/libs/paperTypes.inc.php +++ b/libs/paperTypes.inc.php @@ -46,12 +46,12 @@ function addPaperType($db,$name,$cost,$width,$default = 0) { $message .= "
Please enter finish option name"; $errors++; } - if (($cost == "") || !eregi('^[0-9]{1}[0-9]*[.]{1}[0-9]{2}$',$cost)) { + if (($cost == "") || !preg_match('/^[0-9]{1}[0-9]*[.]{1}[0-9]{2}$/',$cost)) { $message .= "
Please enter a valid cost"; $errors++; } - if (($width == "") || ($width > max_printer_width) || !(eregi("^[0-9]{1,2}$", $width))) { + if (($width == "") || ($width > max_printer_width) || !(preg_match("/^[0-9]{1,2}$/", $width))) { $message .= "
Please enter a valid Width. Maximum is " . max_printer_width . ""; $errors++; } diff --git a/libs/posterTube.inc.php b/libs/posterTube.inc.php index 548d514..3bd2557 100644 --- a/libs/posterTube.inc.php +++ b/libs/posterTube.inc.php @@ -32,7 +32,7 @@ function getPosterTubeInfo($db) { } function updatePosterTube($db,$cost) { - if (($cost == "") || !eregi('^[0-9]{1}[0-9]*[.]{1}[0-9]{2}$',$cost)) { + if (($cost == "") || !preg_match('/^[0-9]{1}[0-9]*[.]{1}[0-9]{2}$/',$cost)) { $message = "Please enter a valid poster tube cost."; return array('RESULT'=>FALSE, 'MESSAGE'=>$message); diff --git a/libs/rushOrder.inc.php b/libs/rushOrder.inc.php index d57ef32..d8e76a3 100644 --- a/libs/rushOrder.inc.php +++ b/libs/rushOrder.inc.php @@ -32,7 +32,7 @@ function getRushOrderInfo($db) { function updateRushOrder($db, $cost) { - if (($cost == "") || !eregi('^[0-9]{1}[0-9]*[.]{1}[0-9]{2}$',$cost)) { + if (($cost == "") || !preg_match('/^[0-9]{1}[0-9]*[.]{1}[0-9]{2}$/',$cost)) { $message = "Please enter a valid rush order cost"; return array('RESULT'=>FALSE, 'MESSAGE'=>$message);