Completed
Push — master ( 85914a...2ce878 )
by Harald
06:39 queued 03:01
created

main.php ➔ tep_date_raw()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 2
dl 7
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/*
3
  $Id$
4
5
  osCommerce, Open Source E-Commerce Solutions
6
  http://www.oscommerce.com
7
8
  Copyright (c) 2014 osCommerce
9
10
  Released under the GNU General Public License
11
*/
12
13
// look in your $PATH_LOCALE/locale directory for available locales..
14
// on RedHat6.0 I used 'en_US'
15
// on FreeBSD 4.0 I use 'en_US.ISO_8859-1'
16
// this may not work under win32 environments..
17
setlocale(LC_ALL, array('en_US.UTF-8', 'en_US.UTF8', 'enu_usa'));
18
define('DATE_FORMAT_SHORT', '%m/%d/%Y');  // this is used for strftime()
19
define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()
20
define('DATE_FORMAT', 'm/d/Y'); // this is used for date()
21
define('PHP_DATE_TIME_FORMAT', 'm/d/Y H:i:s'); // this is used for date()
22
define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');
23
define('JQUERY_DATEPICKER_I18N_CODE', ''); // leave empty for en_US; see http://jqueryui.com/demos/datepicker/#localization
24
define('JQUERY_DATEPICKER_FORMAT', 'mm/dd/yy'); // see http://docs.jquery.com/UI/Datepicker/formatDate
25
26
////
27
// Return date in raw format
28
// $date should be in format mm/dd/yyyy
29
// raw date is in format YYYYMMDD, or DDMMYYYY
30 View Code Duplication
function tep_date_raw($date, $reverse = false) {
0 ignored issues
show
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
31
  if ($reverse) {
32
    return substr($date, 3, 2) . substr($date, 0, 2) . substr($date, 6, 4);
33
  } else {
34
    return substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2);
35
  }
36
}
37
38
// Global entries for the <html> tag
39
define('HTML_PARAMS','dir="ltr" lang="en"');
40
41
// charset for web pages and emails
42
define('CHARSET', 'utf-8');
43
44
// page title
45
define('TITLE', 'osCommerce Online Merchant Administration Tool');
46
47
// header text in includes/header.php
48
define('HEADER_TITLE_TOP', 'Administration');
49
define('HEADER_TITLE_SUPPORT_SITE', 'Support Site');
50
define('HEADER_TITLE_ONLINE_CATALOG', 'Online Catalog');
51
define('HEADER_TITLE_ADMINISTRATION', 'Administration');
52
53
// text for gender
54
define('MALE', 'Male');
55
define('FEMALE', 'Female');
56
57
// text for date of birth example
58
define('DOB_FORMAT_STRING', 'mm/dd/yyyy');
59
60
define('ADMIN_MENU_SHOP', 'Shop');
61
define('ADMIN_MENU_APPS', 'Apps');
62
define('ADMIN_MENU_LEGACY', 'Legacy');
63
64
// modules box text in includes/boxes/modules.php
65
define('BOX_HEADING_MODULES', 'Modules');
66
67
// customers box text in includes/boxes/customers.php
68
define('BOX_HEADING_CUSTOMERS', 'Customers');
69
define('BOX_CUSTOMERS_CUSTOMERS', 'Customers');
70
71
// taxes box text in includes/boxes/taxes.php
72
define('BOX_HEADING_LOCATION_AND_TAXES', 'Locations / Taxes');
73
define('BOX_TAXES_COUNTRIES', 'Countries');
74
define('BOX_TAXES_ZONES', 'Zones');
75
define('BOX_TAXES_GEO_ZONES', 'Tax Zones');
76
define('BOX_TAXES_TAX_CLASSES', 'Tax Classes');
77
define('BOX_TAXES_TAX_RATES', 'Tax Rates');
78
79
// reports box text in includes/boxes/reports.php
80
define('BOX_HEADING_REPORTS', 'Reports');
81
define('BOX_REPORTS_PRODUCTS_VIEWED', 'Products Viewed');
82
define('BOX_REPORTS_PRODUCTS_PURCHASED', 'Products Purchased');
83
define('BOX_REPORTS_ORDERS_TOTAL', 'Customer Orders-Total');
84
85
// localizaion box text in includes/boxes/localization.php
86
define('BOX_HEADING_LOCALIZATION', 'Localization');
87
define('BOX_LOCALIZATION_CURRENCIES', 'Currencies');
88
define('BOX_LOCALIZATION_LANGUAGES', 'Languages');
89
define('BOX_LOCALIZATION_ORDERS_STATUS', 'Orders Status');
90
91
// javascript messages
92
define('JS_ERROR', 'Errors have occured during the process of your form!\nPlease make the following corrections:\n\n');
93
94
define('JS_OPTIONS_VALUE_PRICE', '* The new product atribute needs a price value\n');
95
define('JS_OPTIONS_VALUE_PRICE_PREFIX', '* The new product atribute needs a price prefix\n');
96
97
define('JS_PRODUCTS_NAME', '* The new product needs a name\n');
98
define('JS_PRODUCTS_DESCRIPTION', '* The new product needs a description\n');
99
define('JS_PRODUCTS_PRICE', '* The new product needs a price value\n');
100
define('JS_PRODUCTS_WEIGHT', '* The new product needs a weight value\n');
101
define('JS_PRODUCTS_QUANTITY', '* The new product needs a quantity value\n');
102
define('JS_PRODUCTS_MODEL', '* The new product needs a model value\n');
103
define('JS_PRODUCTS_IMAGE', '* The new product needs an image value\n');
104
105
define('JS_SPECIALS_PRODUCTS_PRICE', '* A new price for this product needs to be set\n');
106
107
define('JS_GENDER', '* The \'Gender\' value must be chosen.\n');
108
define('JS_FIRST_NAME', '* The \'First Name\' entry must have at least ' . ENTRY_FIRST_NAME_MIN_LENGTH . ' characters.\n');
109
define('JS_LAST_NAME', '* The \'Last Name\' entry must have at least ' . ENTRY_LAST_NAME_MIN_LENGTH . ' characters.\n');
110
define('JS_DOB', '* The \'Date of Birth\' entry must be in the format: xx/xx/xxxx (month/date/year).\n');
111
define('JS_EMAIL_ADDRESS', '* The \'E-Mail Address\' is not formatted correctly.\n');
112
define('JS_ADDRESS', '* The \'Street Address\' entry must have at least ' . ENTRY_STREET_ADDRESS_MIN_LENGTH . ' characters.\n');
113
define('JS_POST_CODE', '* The \'Post Code\' entry must have at least ' . ENTRY_POSTCODE_MIN_LENGTH . ' characters.\n');
114
define('JS_CITY', '* The \'City\' entry must have at least ' . ENTRY_CITY_MIN_LENGTH . ' characters.\n');
115
define('JS_STATE', '* The \'State\' entry is must be selected.\n');
116
define('JS_STATE_SELECT', '-- Select Above --');
117
define('JS_ZONE', '* The \'State\' entry must be selected from the list for this country.');
118
define('JS_COUNTRY', '* The \'Country\' value must be chosen.\n');
119
define('JS_TELEPHONE', '* The \'Telephone Number\' entry must have at least ' . ENTRY_TELEPHONE_MIN_LENGTH . ' characters.\n');
120
define('JS_PASSWORD', '* The \'Password\' amd \'Confirmation\' entries must match amd have at least ' . ENTRY_PASSWORD_MIN_LENGTH . ' characters.\n');
121
122
define('JS_ORDER_DOES_NOT_EXIST', 'Order Number %s does not exist!');
123
124
define('CATEGORY_PERSONAL', 'Personal');
125
define('CATEGORY_ADDRESS', 'Address');
126
define('CATEGORY_CONTACT', 'Contact');
127
define('CATEGORY_COMPANY', 'Company');
128
define('CATEGORY_OPTIONS', 'Options');
129
130
define('ENTRY_GENDER', 'Gender:');
131
define('ENTRY_GENDER_ERROR', '&nbsp;<span class="errorText">required</span>');
132
define('ENTRY_FIRST_NAME', 'First Name:');
133
define('ENTRY_FIRST_NAME_ERROR', '&nbsp;<span class="errorText">min ' . ENTRY_FIRST_NAME_MIN_LENGTH . ' chars</span>');
134
define('ENTRY_LAST_NAME', 'Last Name:');
135
define('ENTRY_LAST_NAME_ERROR', '&nbsp;<span class="errorText">min ' . ENTRY_LAST_NAME_MIN_LENGTH . ' chars</span>');
136
define('ENTRY_DATE_OF_BIRTH', 'Date of Birth:');
137
define('ENTRY_DATE_OF_BIRTH_ERROR', '&nbsp;<span class="errorText">(eg. 05/21/1970)</span>');
138
define('ENTRY_EMAIL_ADDRESS', 'E-Mail Address:');
139
define('ENTRY_EMAIL_ADDRESS_ERROR', '&nbsp;<span class="errorText">not formatted correctly</span>');
140
define('ENTRY_EMAIL_ADDRESS_CHECK_ERROR', '&nbsp;<span class="errorText">The email address doesn\'t appear to be valid!</span>');
141
define('ENTRY_EMAIL_ADDRESS_ERROR_EXISTS', '&nbsp;<span class="errorText">This email address already exists!</span>');
142
define('ENTRY_COMPANY', 'Company name:');
143
define('ENTRY_STREET_ADDRESS', 'Street Address:');
144
define('ENTRY_STREET_ADDRESS_ERROR', '&nbsp;<span class="errorText">min ' . ENTRY_STREET_ADDRESS_MIN_LENGTH . ' chars</span>');
145
define('ENTRY_SUBURB', 'Suburb:');
146
define('ENTRY_POST_CODE', 'Post Code:');
147
define('ENTRY_POST_CODE_ERROR', '&nbsp;<span class="errorText">min ' . ENTRY_POSTCODE_MIN_LENGTH . ' chars</span>');
148
define('ENTRY_CITY', 'City:');
149
define('ENTRY_CITY_ERROR', '&nbsp;<span class="errorText">min ' . ENTRY_CITY_MIN_LENGTH . ' chars</span>');
150
define('ENTRY_STATE', 'State:');
151
define('ENTRY_STATE_ERROR', '&nbsp;<span class="errorText">required</span>');
152
define('ENTRY_COUNTRY', 'Country:');
153
define('ENTRY_COUNTRY_ERROR', 'You must select a country from the Countries pull down menu.');
154
define('ENTRY_TELEPHONE_NUMBER', 'Telephone Number:');
155
define('ENTRY_TELEPHONE_NUMBER_ERROR', '&nbsp;<span class="errorText">min ' . ENTRY_TELEPHONE_MIN_LENGTH . ' chars</span>');
156
define('ENTRY_FAX_NUMBER', 'Fax Number:');
157
define('ENTRY_NEWSLETTER', 'Newsletter:');
158
define('ENTRY_NEWSLETTER_YES', 'Subscribed');
159
define('ENTRY_NEWSLETTER_NO', 'Unsubscribed');
160
161
// images
162
define('IMAGE_ANI_SEND_EMAIL', 'Sending E-Mail');
163
define('IMAGE_BACK', 'Back');
164
define('IMAGE_BACKUP', 'Backup');
165
define('IMAGE_CANCEL', 'Cancel');
166
define('IMAGE_CONFIRM', 'Confirm');
167
define('IMAGE_COPY', 'Copy');
168
define('IMAGE_COPY_TO', 'Copy To');
169
define('IMAGE_DETAILS', 'Details');
170
define('IMAGE_DELETE', 'Delete');
171
define('IMAGE_EDIT', 'Edit');
172
define('IMAGE_EMAIL', 'Email');
173
define('IMAGE_EXPORT', 'Export');
174
define('IMAGE_ICON_STATUS_GREEN', 'Active');
175
define('IMAGE_ICON_STATUS_GREEN_LIGHT', 'Set Active');
176
define('IMAGE_ICON_STATUS_RED', 'Inactive');
177
define('IMAGE_ICON_STATUS_RED_LIGHT', 'Set Inactive');
178
define('IMAGE_ICON_INFO', 'Info');
179
define('IMAGE_INSERT', 'Insert');
180
define('IMAGE_LOCK', 'Lock');
181
define('IMAGE_MODULE_INSTALL', 'Install Module');
182
define('IMAGE_MODULE_REMOVE', 'Remove Module');
183
define('IMAGE_MOVE', 'Move');
184
define('IMAGE_NEW_BANNER', 'New Banner');
185
define('IMAGE_NEW_CATEGORY', 'New Category');
186
define('IMAGE_NEW_COUNTRY', 'New Country');
187
define('IMAGE_NEW_CURRENCY', 'New Currency');
188
define('IMAGE_NEW_FILE', 'New File');
189
define('IMAGE_NEW_FOLDER', 'New Folder');
190
define('IMAGE_NEW_LANGUAGE', 'New Language');
191
define('IMAGE_NEW_NEWSLETTER', 'New Newsletter');
192
define('IMAGE_NEW_PRODUCT', 'New Product');
193
define('IMAGE_NEW_TAX_CLASS', 'New Tax Class');
194
define('IMAGE_NEW_TAX_RATE', 'New Tax Rate');
195
define('IMAGE_NEW_TAX_ZONE', 'New Tax Zone');
196
define('IMAGE_NEW_ZONE', 'New Zone');
197
define('IMAGE_ORDERS', 'Orders');
198
define('IMAGE_ORDERS_INVOICE', 'Invoice');
199
define('IMAGE_ORDERS_PACKINGSLIP', 'Packing Slip');
200
define('IMAGE_PREVIEW', 'Preview');
201
define('IMAGE_RESTORE', 'Restore');
202
define('IMAGE_RESET', 'Reset');
203
define('IMAGE_SAVE', 'Save');
204
define('IMAGE_SEARCH', 'Search');
205
define('IMAGE_SELECT', 'Select');
206
define('IMAGE_SEND', 'Send');
207
define('IMAGE_SEND_EMAIL', 'Send Email');
208
define('IMAGE_UNDO', 'Undo');
209
define('IMAGE_UNLOCK', 'Unlock');
210
define('IMAGE_UPDATE', 'Update');
211
define('IMAGE_UPDATE_CURRENCIES', 'Update Exchange Rate');
212
define('IMAGE_UPLOAD', 'Upload');
213
214
define('ICON_CROSS', 'False');
215
define('ICON_CURRENT_FOLDER', 'Current Folder');
216
define('ICON_DELETE', 'Delete');
217
define('ICON_ERROR', 'Error');
218
define('ICON_FILE', 'File');
219
define('ICON_FILE_DOWNLOAD', 'Download');
220
define('ICON_FOLDER', 'Folder');
221
define('ICON_LOCKED', 'Locked');
222
define('ICON_PREVIOUS_LEVEL', 'Previous Level');
223
define('ICON_PREVIEW', 'Preview');
224
define('ICON_STATISTICS', 'Statistics');
225
define('ICON_SUCCESS', 'Success');
226
define('ICON_TICK', 'True');
227
define('ICON_UNLOCKED', 'Unlocked');
228
define('ICON_WARNING', 'Warning');
229
230
// constants for use in tep_prev_next_display function
231
define('TEXT_RESULT_PAGE', 'Page %s of %d');
232
define('TEXT_DISPLAY_NUMBER_OF_BANNERS', 'Displaying <strong>%d</strong> to <strong>%d</strong> (of <strong>%d</strong> banners)');
233
define('TEXT_DISPLAY_NUMBER_OF_COUNTRIES', 'Displaying <strong>%d</strong> to <strong>%d</strong> (of <strong>%d</strong> countries)');
234
define('TEXT_DISPLAY_NUMBER_OF_CUSTOMERS', 'Displaying <strong>%d</strong> to <strong>%d</strong> (of <strong>%d</strong> customers)');
235
define('TEXT_DISPLAY_NUMBER_OF_CURRENCIES', 'Displaying <strong>%d</strong> to <strong>%d</strong> (of <strong>%d</strong> currencies)');
236
define('TEXT_DISPLAY_NUMBER_OF_ENTRIES', 'Displaying <strong>%d</strong> to <strong>%d</strong> (of <strong>%d</strong> entries)');
237
define('TEXT_DISPLAY_NUMBER_OF_LANGUAGES', 'Displaying <strong>%d</strong> to <strong>%d</strong> (of <strong>%d</strong> languages)');
238
define('TEXT_DISPLAY_NUMBER_OF_MANUFACTURERS', 'Displaying <strong>%d</strong> to <strong>%d</strong> (of <strong>%d</strong> manufacturers)');
239
define('TEXT_DISPLAY_NUMBER_OF_NEWSLETTERS', 'Displaying <strong>%d</strong> to <strong>%d</strong> (of <strong>%d</strong> newsletters)');
240
define('TEXT_DISPLAY_NUMBER_OF_ORDERS', 'Displaying <strong>%d</strong> to <strong>%d</strong> (of <strong>%d</strong> orders)');
241
define('TEXT_DISPLAY_NUMBER_OF_ORDERS_STATUS', 'Displaying <strong>%d</strong> to <strong>%d</strong> (of <strong>%d</strong> orders status)');
242
define('TEXT_DISPLAY_NUMBER_OF_PRODUCTS', 'Displaying <strong>%d</strong> to <strong>%d</strong> (of <strong>%d</strong> products)');
243
define('TEXT_DISPLAY_NUMBER_OF_PRODUCTS_EXPECTED', 'Displaying <strong>%d</strong> to <strong>%d</strong> (of <strong>%d</strong> products expected)');
244
define('TEXT_DISPLAY_NUMBER_OF_REVIEWS', 'Displaying <strong>%d</strong> to <strong>%d</strong> (of <strong>%d</strong> product reviews)');
245
define('TEXT_DISPLAY_NUMBER_OF_SPECIALS', 'Displaying <strong>%d</strong> to <strong>%d</strong> (of <strong>%d</strong> products on special)');
246
define('TEXT_DISPLAY_NUMBER_OF_TAX_CLASSES', 'Displaying <strong>%d</strong> to <strong>%d</strong> (of <strong>%d</strong> tax classes)');
247
define('TEXT_DISPLAY_NUMBER_OF_TAX_ZONES', 'Displaying <strong>%d</strong> to <strong>%d</strong> (of <strong>%d</strong> tax zones)');
248
define('TEXT_DISPLAY_NUMBER_OF_TAX_RATES', 'Displaying <strong>%d</strong> to <strong>%d</strong> (of <strong>%d</strong> tax rates)');
249
define('TEXT_DISPLAY_NUMBER_OF_ZONES', 'Displaying <strong>%d</strong> to <strong>%d</strong> (of <strong>%d</strong> zones)');
250
251
define('PREVNEXT_BUTTON_PREV', '&lt;&lt;');
252
define('PREVNEXT_BUTTON_NEXT', '&gt;&gt;');
253
254
define('PREVNEXT_TITLE_PREVIOUS_PAGE', 'Previous Page');
255
define('PREVNEXT_TITLE_NEXT_PAGE', 'Next Page');
256
define('PREVNEXT_TITLE_PAGE_NO', 'Page %d');
257
define('PREVNEXT_TITLE_NEXT_SET_OF_NO_PAGE', 'Next Set of %d Pages');
258
259
define('TEXT_DEFAULT', 'default');
260
define('TEXT_SET_DEFAULT', 'Set as default');
261
define('TEXT_FIELD_REQUIRED', '&nbsp;<span class="fieldRequired">* Required</span>');
262
263
define('TEXT_CACHE_CATEGORIES', 'Categories Box');
264
define('TEXT_CACHE_MANUFACTURERS', 'Manufacturers Box');
265
define('TEXT_CACHE_ALSO_PURCHASED', 'Also Purchased Module');
266
267
define('TEXT_NONE', '--none--');
268
define('TEXT_TOP', 'Top');
269
270
define('ERROR_DESTINATION_DOES_NOT_EXIST', 'Error: Destination does not exist.');
271
define('ERROR_DESTINATION_NOT_WRITEABLE', 'Error: Destination not writeable.');
272
define('ERROR_FILE_NOT_SAVED', 'Error: File upload not saved.');
273
define('ERROR_FILETYPE_NOT_ALLOWED', 'Error: File upload type not allowed.');
274
define('SUCCESS_FILE_SAVED_SUCCESSFULLY', 'Success: File upload saved successfully.');
275
define('WARNING_NO_FILE_UPLOADED', 'Warning: No file uploaded.');
276
277
// bootstrap helper
278
define('MODULE_CONTENT_BOOTSTRAP_ROW_DESCRIPTION', '<p>Content Width can be 12 or less per column per row.</p><p>12/12 = 100% width, 6/12 = 50% width, 4/12 = 33% width.</p><p>Total of all columns in any one row must equal 12 (eg:  3 boxes of 4 columns each, 1 box of 12 columns and so on).</p>');
279
280