Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sun, Feb 2, 10:01 PM

in-portal

Index: trunk/themes/default/login/login_form.tpl
===================================================================
--- trunk/themes/default/login/login_form.tpl (revision 1828)
+++ trunk/themes/default/login/login_form.tpl (revision 1829)
@@ -1,60 +1,67 @@
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<FORM method="POST" NAME="login" ACTION="<inp:m_form_action _form="login" _Template="index" />">
<input type="hidden" name="dest" value="<inp:m_get_var _Type="get" _Name="dest" />">
<tr>
<!--<td valign="top"><img src="img/pic_login.jpg" width="45" height="236" alt="" /><br /></td>-->
<td valign="top" width="10000">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" class="field-content-top"><h2><inp:m_language _Phrase="lu_existing_users" /></h2></td>
</tr>
<tr>
<td colspan="3" class="error"><inp:m_list_form_errors _Form="login" _ItemTemplate="misc/form_error.tpl" /></td>
</tr>
<tr>
- <td class="field-name"><inp:m_form_prompt _field="login_user" _Form="login" _langtext="lu_prompt_username" _Template="misc/form_prompt.tpl" _ErrorTemplate="misc/form_prompt_error.tpl" /> <span class="error">*</span></td>
+ <td class="field-name">
+ <inp2:m_if check="u_UseUsernames">
+ <inp:m_form_prompt _field="login_user" _Form="login" _langtext="lu_prompt_username" _Template="misc/form_prompt.tpl" _ErrorTemplate="misc/form_prompt_error.tpl" />
+ <inp2:m_else/>
+ <inp:m_form_prompt _field="login_user" _Form="login" _langtext="lu_prompt_email" _Template="misc/form_prompt.tpl" _ErrorTemplate="misc/form_prompt_error.tpl" />
+ </inp2:m_if>
+ <span class="error">*</span>
+ </td>
<td width="100%" class="field-content-input"><inp:m_form_input type="text" class="input" style="width:135px;" _field="login_user" _Form="login" _Required="1" /><br /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="field-name"><inp:m_form_prompt _form="login" _Field="login_password" _langtext="lu_prompt_password" _Template="misc/form_prompt.tpl" _ErrorTemplate="misc/form_prompt_error.tpl" /> <span class="error">*</span></td>
<td class="field-content-input"><inp:m_form_input type="password" class="input" _field="login_password" _Form="login" _Required="1" style="width:135px;" /><br /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="field-name">&nbsp;</TD>
<TD CLASS="field-content-input"><INPUT TYPE="CHECKBOX" name="usercookie" VALUE="1"><inp:m_language _Phrase="lu_remember_login" /></TD>
<td>&nbsp;</td>
<tr>
<tr>
<td class="field-name">&nbsp;</td>
<td class="field-content" valign="top">
<span class="tips"><a href="<inp:m_template_link _Template="forgotpw" />"><inp:m_language _Phrase="lu_forgot_password_link" /></a></span><br />
<img src="img/s.gif" width="1" height="15" alt="" /><br />
<INPUT type="submit" name="login" value="<inp:m_language _Phrase="lu_login" />" class="button">&nbsp;&nbsp;<INPUT type="button" name="cancel" value="<inp:m_language _Phrase="lu_cancel" />" class="button" onClick="javascript:history.back(1);">
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><img src="img/s.gif" width="1" height="1" alt="" /><br /></td>
<td colspan="2" class="field-content"><img src="img/s.gif" width="1" height="1" alt="" /><br /></td>
</tr>
<tr>
<td colspan="3" class="field-content-top">
<br />
<h2><inp:m_language _Phrase="lu_new_users" /></h2>
<inp:m_language _Phrase="lu_register_text" />
</td>
</tr>
<tr>
<td class="field-name"><br /><br /></td>
<td colspan="2" class="field-content">
<span class="item-my"><a href="<inp:m_template_link _Template="register" />"><inp:m_language _Phrase="lu_register" /></a></span>
<img src="img/arr_more.gif" width="16" height="7" alt="" />
</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
\ No newline at end of file
Property changes on: trunk/themes/default/login/login_form.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.3
\ No newline at end of property
Index: trunk/themes/default/rate_access_denied.tpl
===================================================================
--- trunk/themes/default/rate_access_denied.tpl (revision 1828)
+++ trunk/themes/default/rate_access_denied.tpl (revision 1829)
@@ -1,56 +1,63 @@
<SPAN CLASS="error">
<inp:m_language _Phrase="lu_rate_access_denied" />
</SPAN>
<FORM method="POST" NAME="login" ACTION="<inp:m_form_action _form="login"/>">
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<!--<td valign="top"><img src="img/pic_login.jpg" width="45" height="236" alt="" /><br /></td>-->
<td valign="top" width="10000">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" class="field-content-top"><h2><inp:m_language _Phrase="lu_existing_users" /></h2></td>
</tr>
<tr>
<td colspan="3" class="error"><inp:m_list_form_errors _Form="login" _ItemTemplate="misc/form_error.tpl" /></td>
</tr>
<tr>
- <td class="field-name"><inp:m_form_prompt _field="login_user" _Form="login" _langtext="lu_prompt_username" _Template="misc/form_prompt.tpl" _ErrorTemplate="misc/form_prompt_error.tpl" /> <span class="error">*</span></td>
+ <td class="field-name">
+ <inp2:m_if check="u_UseUsernames">
+ <inp:m_form_prompt _field="login_user" _Form="login" _langtext="lu_prompt_username" _Template="misc/form_prompt.tpl" _ErrorTemplate="misc/form_prompt_error.tpl" />
+ <inp2:m_else/>
+ <inp:m_form_prompt _field="login_user" _Form="login" _langtext="lu_prompt_email" _Template="misc/form_prompt.tpl" _ErrorTemplate="misc/form_prompt_error.tpl" />
+ </inp2:m_if>
+ <span class="error">*</span>
+ </td>
<td width="100%" class="field-content-input"><inp:m_form_input type="text" class="input" style="width:135px;" _field="login_user" _Form="login" _Required="1" /><br /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="field-name"><inp:m_form_prompt _form="login" _Field="login_password" _langtext="lu_prompt_password" _Template="misc/form_prompt.tpl" _ErrorTemplate="misc/form_prompt_error.tpl" /> <span class="error">*</span></td>
<td class="field-content-input"><inp:m_form_input type="password" class="input" _field="login_password" _Form="login" _Required="1" style="width:135px;" /><br /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="field-name">&nbsp;</td>
<td class="field-content" valign="top">
<span class="tips"><a href="<inp:m_template_link _Template="forgotpw" />"><inp:m_language _Phrase="lu_forgot_password_link" /></a></span><br />
<img src="img/s.gif" width="1" height="15" alt="" /><br />
<INPUT type="submit" name="login" value="<inp:m_language _Phrase="lu_login" />" class="button">
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><img src="img/s.gif" width="1" height="1" alt="" /><br /></td>
<td colspan="2" class="field-content"><img src="img/s.gif" width="1" height="1" alt="" /><br /></td>
</tr>
<tr>
<td colspan="3" class="field-content-top">
<br />
<h2><inp:m_language _Phrase="lu_new_users" /></h2>
<inp:m_language _Phrase="lu_register_text" />
</td>
</tr>
<tr>
<td class="field-name"><br /><br /></td>
<td colspan="2" class="field-content"><span class="item-my"><a href="<inp:m_template_link _Template="register" />"><inp:m_language _Phrase="lu_register" /></a></span></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
Property changes on: trunk/themes/default/rate_access_denied.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/themes/default/review_access_denied.tpl
===================================================================
--- trunk/themes/default/review_access_denied.tpl (revision 1828)
+++ trunk/themes/default/review_access_denied.tpl (revision 1829)
@@ -1,56 +1,63 @@
<SPAN CLASS="error">
<inp:m_language _Phrase="lu_review_access_denied" />
</SPAN>
<FORM method="POST" NAME="login" ACTION="<inp:m_form_action _form="login"/>">
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<!--<td valign="top"><img src="img/pic_login.jpg" width="45" height="236" alt="" /><br /></td>-->
<td valign="top" width="10000">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" class="field-content-top"><h2><inp:m_language _Phrase="lu_existing_users" /></h2></td>
</tr>
<tr>
<td colspan="3" class="error"><inp:m_list_form_errors _Form="login" _ItemTemplate="misc/form_error.tpl" /></td>
</tr>
<tr>
- <td class="field-name"><inp:m_form_prompt _field="login_user" _Form="login" _langtext="lu_prompt_username" _Template="misc/form_prompt.tpl" _ErrorTemplate="misc/form_prompt_error.tpl" /> <span class="error">*</span></td>
+ <td class="field-name">
+ <inp2:m_if check="u_UseUsernames">
+ <inp:m_form_prompt _field="login_user" _Form="login" _langtext="lu_prompt_username" _Template="misc/form_prompt.tpl" _ErrorTemplate="misc/form_prompt_error.tpl" />
+ <inp2:m_else/>
+ <inp:m_form_prompt _field="login_user" _Form="login" _langtext="lu_prompt_email" _Template="misc/form_prompt.tpl" _ErrorTemplate="misc/form_prompt_error.tpl" />
+ </inp2:m_if>
+ <span class="error">*</span>
+ </td>
<td width="100%" class="field-content-input"><inp:m_form_input type="text" class="input" style="width:135px;" _field="login_user" _Form="login" _Required="1" /><br /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="field-name"><inp:m_form_prompt _form="login" _Field="login_password" _langtext="lu_prompt_password" _Template="misc/form_prompt.tpl" _ErrorTemplate="misc/form_prompt_error.tpl" /> <span class="error">*</span></td>
<td class="field-content-input"><inp:m_form_input type="password" class="input" _field="login_password" _Form="login" _Required="1" style="width:135px;" /><br /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="field-name">&nbsp;</td>
<td class="field-content" valign="top">
<span class="tips"><a href="<inp:m_template_link _Template="forgotpw" />"><inp:m_language _Phrase="lu_forgot_password_link" /></a></span><br />
<img src="img/s.gif" width="1" height="15" alt="" /><br />
<INPUT type="submit" name="login" value="<inp:m_language _Phrase="lu_login" />" class="button">
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><img src="img/s.gif" width="1" height="1" alt="" /><br /></td>
<td colspan="2" class="field-content"><img src="img/s.gif" width="1" height="1" alt="" /><br /></td>
</tr>
<tr>
<td colspan="3" class="field-content-top">
<br />
<h2><inp:m_language _Phrase="lu_new_users" /></h2>
<inp:m_language _Phrase="lu_register_text" />
</td>
</tr>
<tr>
<td class="field-name"><br /><br /></td>
<td colspan="2" class="field-content"><span class="item-my"><a href="<inp:m_template_link _Template="register" />"><inp:m_language _Phrase="lu_register" /></a></span></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
Property changes on: trunk/themes/default/review_access_denied.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/themes/default/misc/right_login.tpl
===================================================================
--- trunk/themes/default/misc/right_login.tpl (revision 1828)
+++ trunk/themes/default/misc/right_login.tpl (revision 1829)
@@ -1,72 +1,78 @@
<!-- template=right_login.tpl -->
<!-- login box -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="login-box-top"><inp:m_language _Phrase="lu_login" /></td>
<td class="login-box-top" align="right">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="img/ic_notloggedin.gif" width="11" height="11" alt="" /><br /></td>
<td><img src="img/s.gif" width="3" height="1" alt="" /><br /></td>
<td class="copyright"><inp:m_language _Phrase="lu_not_logged_in" /></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bgr-login">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<FORM method="POST" NAME="login" ACTION="<inp:m_form_action _form="login"/>">
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
- <td class="field-title"><inp:m_language _Phrase="lu_prompt_username" />:</td>
+ <td class="field-title">
+ <inp2:m_if check="u_UseUsernames">
+ <inp:m_language _Phrase="lu_prompt_username" />:
+ <inp2:m_else/>
+ <inp:m_language _Phrase="lu_prompt_email" />:
+ </inp2:m_if>
+ </td>
</tr>
<tr>
<td><inp:m_form_input type="text" class="input" style="width:135px;" _field="login_user" _Form="login" _Required="1" /><br /></td>
</tr>
<tr>
<td class="field-title"><inp:m_language _Phrase="lu_prompt_password" />:</td>
</tr>
<tr>
<td><inp:m_form_input type="password" class="input" _field="login_password" _Form="login" _Required="1" style="width:135px;" /><br /></td>
</tr>
<tr>
<td class="tips" nowrap>
<INPUT type="submit" name="login" value="<inp:m_language _Phrase="lu_login" />" class="button"> <input type="checkbox" name="usercookie" VALUE="1"><inp:m_language _Phrase="lu_remember_login" />
</td>
</tr>
<tr>
<td class="field-title"><span class="error"><inp:m_list_form_errors _Form="login" _ItemTemplate="misc/form_error.tpl" /></span></td>
</tr>
<tr>
<td class="option-txt"><br /><br />
<a href="<inp:m_template_link _Template="register" />"><inp:m_language _Phrase="lu_register" /></a> <img src="img/arr_more.gif" width="16" height="7" alt="" /><br />
<a href="<inp:m_template_link _Template="forgotpw" />"><inp:m_language _Phrase="lu_forgot_password_link" /></a> <img src="img/arr_more.gif" width="16" height="7" alt="" /><br />
</td>
</tr>
</table>
</td>
<td valign="top">
<img src="img/s.gif" width="1" height="13" alt="" /><br />
<img src="img/lock.gif" width="31" height="49" alt="" /><br />
</td>
</tr>
</FORM>
</table>
</td>
</tr>
<tr>
<td><img src="img/s.gif" width="218" height="1" alt="" /><br /></td>
</tr>
</table>
<!-- end login box -->
Property changes on: trunk/themes/default/misc/right_login.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.5
\ No newline at end of property
+1.6
\ No newline at end of property
Index: trunk/admin/install/upgrades/inportal_upgrade_v1.1.0.sql
===================================================================
--- trunk/admin/install/upgrades/inportal_upgrade_v1.1.0.sql (revision 1828)
+++ trunk/admin/install/upgrades/inportal_upgrade_v1.1.0.sql (revision 1829)
@@ -1,330 +1,330 @@
ALTER TABLE SysCache DROP INDEX Expire;
ALTER TABLE Category MODIFY COLUMN Priority INTEGER(11) DEFAULT NULL;
ALTER TABLE Phrase ADD COLUMN LastChanged INTEGER(10) UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE Phrase ADD COLUMN LastChangeIP VARCHAR(15) NOT NULL;
ALTER TABLE Phrase ADD COLUMN Module VARCHAR(30) NOT NULL;
ALTER TABLE PortalUser MODIFY COLUMN State VARCHAR(20) NOT NULL;
ALTER TABLE SearchConfig MODIFY COLUMN ForeignField TEXT;
ALTER TABLE SearchConfig MODIFY COLUMN JoinClause TEXT;
ALTER TABLE Theme ADD COLUMN StylesheetId INTEGER(10) UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE Phrase ADD KEY LanguageId (LanguageId);
CREATE TABLE Cache (VarName varchar(255) NOT NULL default '', Data longtext, Cached int(11) default NULL, PRIMARY KEY (VarName), KEY Cached (Cached) );
CREATE TABLE StylesheetSelectors (SelectorId int(11) NOT NULL auto_increment, StylesheetId int(11) NOT NULL default '0', Name varchar(255) NOT NULL default '', SelectorName varchar(255) NOT NULL default '', SelectorData text NOT NULL, Description text NOT NULL, Type tinyint(4) NOT NULL default '0', AdvancedCSS text NOT NULL, ParentId int(11) NOT NULL default '0', PRIMARY KEY (SelectorId) );
CREATE TABLE Stylesheets ( StylesheetId int(11) NOT NULL auto_increment, Name varchar(255) NOT NULL default '', Description varchar(255) NOT NULL default '', AdvancedCSS text NOT NULL, LastCompiled int(10) unsigned NOT NULL default '0', Enabled int(11) NOT NULL default '0', PRIMARY KEY (StylesheetId) );
INSERT INTO ConfigurationAdmin VALUES ('Email_As_Login', 'la_Text_General', 'la_use_emails_as_login', 'checkbox', NULL, NULL, 1, 0);
-INSERT INTO ConfigurationValues VALUES ('Email_As_Login', '1', 'In-Portal:Users', 'in-portal:configure_users');
+INSERT INTO ConfigurationValues VALUES ('Email_As_Login', '0', 'In-Portal:Users', 'in-portal:configure_users');
ALTER TABLE Language ADD COLUMN UnitSystem TINYINT DEFAULT '1' NOT NULL;
UPDATE Language SET UnitSystem = 2 WHERE PackName = 'English';
CREATE TABLE StdDestinations (DestId int(11) NOT NULL auto_increment, DestType int(11) NOT NULL default '0', DestParentId int(11) default NULL, DestName varchar(255) NOT NULL default '', DestAbbr char(3) NOT NULL default '', DestAbbr2 char(2) default '', PRIMARY KEY (DestId));
INSERT INTO StdDestinations VALUES (1, 1, NULL, 'la_country_AFG', 'AFG', 'AF');
INSERT INTO StdDestinations VALUES (2, 1, NULL, 'la_country_ALB', 'ALB', 'AL');
INSERT INTO StdDestinations VALUES (3, 1, NULL, 'la_country_DZA', 'DZA', 'DZ');
INSERT INTO StdDestinations VALUES (4, 1, NULL, 'la_country_ASM', 'ASM', 'AS');
INSERT INTO StdDestinations VALUES (5, 1, NULL, 'la_country_AND', 'AND', 'AD');
INSERT INTO StdDestinations VALUES (6, 1, NULL, 'la_country_AGO', 'AGO', 'AO');
INSERT INTO StdDestinations VALUES (7, 1, NULL, 'la_country_AIA', 'AIA', 'AI');
INSERT INTO StdDestinations VALUES (8, 1, NULL, 'la_country_ATA', 'ATA', 'AQ');
INSERT INTO StdDestinations VALUES (9, 1, NULL, 'la_country_ATG', 'ATG', 'AG');
INSERT INTO StdDestinations VALUES (10, 1, NULL, 'la_country_ARG', 'ARG', 'AR');
INSERT INTO StdDestinations VALUES (11, 1, NULL, 'la_country_ARM', 'ARM', 'AM');
INSERT INTO StdDestinations VALUES (12, 1, NULL, 'la_country_ABW', 'ABW', 'AW');
INSERT INTO StdDestinations VALUES (13, 1, NULL, 'la_country_AUS', 'AUS', 'AU');
INSERT INTO StdDestinations VALUES (14, 1, NULL, 'la_country_AUT', 'AUT', 'AT');
INSERT INTO StdDestinations VALUES (15, 1, NULL, 'la_country_AZE', 'AZE', 'AZ');
INSERT INTO StdDestinations VALUES (16, 1, NULL, 'la_country_BHS', 'BHS', 'BS');
INSERT INTO StdDestinations VALUES (17, 1, NULL, 'la_country_BHR', 'BHR', 'BH');
INSERT INTO StdDestinations VALUES (18, 1, NULL, 'la_country_BGD', 'BGD', 'BD');
INSERT INTO StdDestinations VALUES (19, 1, NULL, 'la_country_BRB', 'BRB', 'BB');
INSERT INTO StdDestinations VALUES (20, 1, NULL, 'la_country_BLR', 'BLR', 'BY');
INSERT INTO StdDestinations VALUES (21, 1, NULL, 'la_country_BEL', 'BEL', 'BE');
INSERT INTO StdDestinations VALUES (22, 1, NULL, 'la_country_BLZ', 'BLZ', 'BZ');
INSERT INTO StdDestinations VALUES (23, 1, NULL, 'la_country_BEN', 'BEN', 'BJ');
INSERT INTO StdDestinations VALUES (24, 1, NULL, 'la_country_BMU', 'BMU', 'BM');
INSERT INTO StdDestinations VALUES (25, 1, NULL, 'la_country_BTN', 'BTN', 'BT');
INSERT INTO StdDestinations VALUES (26, 1, NULL, 'la_country_BOL', 'BOL', 'BO');
INSERT INTO StdDestinations VALUES (27, 1, NULL, 'la_country_BIH', 'BIH', 'BA');
INSERT INTO StdDestinations VALUES (28, 1, NULL, 'la_country_BWA', 'BWA', 'BW');
INSERT INTO StdDestinations VALUES (29, 1, NULL, 'la_country_BVT', 'BVT', 'BV');
INSERT INTO StdDestinations VALUES (30, 1, NULL, 'la_country_BRA', 'BRA', 'BR');
INSERT INTO StdDestinations VALUES (31, 1, NULL, 'la_country_IOT', 'IOT', 'IO');
INSERT INTO StdDestinations VALUES (32, 1, NULL, 'la_country_BRN', 'BRN', 'BN');
INSERT INTO StdDestinations VALUES (33, 1, NULL, 'la_country_BGR', 'BGR', 'BG');
INSERT INTO StdDestinations VALUES (34, 1, NULL, 'la_country_BFA', 'BFA', 'BF');
INSERT INTO StdDestinations VALUES (35, 1, NULL, 'la_country_BDI', 'BDI', 'BI');
INSERT INTO StdDestinations VALUES (36, 1, NULL, 'la_country_KHM', 'KHM', 'KH');
INSERT INTO StdDestinations VALUES (37, 1, NULL, 'la_country_CMR', 'CMR', 'CM');
INSERT INTO StdDestinations VALUES (38, 1, NULL, 'la_country_CAN', 'CAN', 'CA');
INSERT INTO StdDestinations VALUES (39, 1, NULL, 'la_country_CPV', 'CPV', 'CV');
INSERT INTO StdDestinations VALUES (40, 1, NULL, 'la_country_CYM', 'CYM', 'KY');
INSERT INTO StdDestinations VALUES (41, 1, NULL, 'la_country_CAF', 'CAF', 'CF');
INSERT INTO StdDestinations VALUES (42, 1, NULL, 'la_country_TCD', 'TCD', 'TD');
INSERT INTO StdDestinations VALUES (43, 1, NULL, 'la_country_CHL', 'CHL', 'CL');
INSERT INTO StdDestinations VALUES (44, 1, NULL, 'la_country_CHN', 'CHN', 'CN');
INSERT INTO StdDestinations VALUES (45, 1, NULL, 'la_country_CXR', 'CXR', 'CX');
INSERT INTO StdDestinations VALUES (46, 1, NULL, 'la_country_CCK', 'CCK', 'CC');
INSERT INTO StdDestinations VALUES (47, 1, NULL, 'la_country_COL', 'COL', 'CO');
INSERT INTO StdDestinations VALUES (48, 1, NULL, 'la_country_COM', 'COM', 'KM');
INSERT INTO StdDestinations VALUES (49, 1, NULL, 'la_country_COD', 'COD', 'CD');
INSERT INTO StdDestinations VALUES (50, 1, NULL, 'la_country_COG', 'COG', 'CG');
INSERT INTO StdDestinations VALUES (51, 1, NULL, 'la_country_COK', 'COK', 'CK');
INSERT INTO StdDestinations VALUES (52, 1, NULL, 'la_country_CRI', 'CRI', 'CR');
INSERT INTO StdDestinations VALUES (53, 1, NULL, 'la_country_CIV', 'CIV', 'CI');
INSERT INTO StdDestinations VALUES (54, 1, NULL, 'la_country_HRV', 'HRV', 'HR');
INSERT INTO StdDestinations VALUES (55, 1, NULL, 'la_country_CUB', 'CUB', 'CU');
INSERT INTO StdDestinations VALUES (56, 1, NULL, 'la_country_CYP', 'CYP', 'CY');
INSERT INTO StdDestinations VALUES (57, 1, NULL, 'la_country_CZE', 'CZE', 'CZ');
INSERT INTO StdDestinations VALUES (58, 1, NULL, 'la_country_DNK', 'DNK', 'DK');
INSERT INTO StdDestinations VALUES (59, 1, NULL, 'la_country_DJI', 'DJI', 'DJ');
INSERT INTO StdDestinations VALUES (60, 1, NULL, 'la_country_DMA', 'DMA', 'DM');
INSERT INTO StdDestinations VALUES (61, 1, NULL, 'la_country_DOM', 'DOM', 'DO');
INSERT INTO StdDestinations VALUES (62, 1, NULL, 'la_country_TLS', 'TLS', 'TL');
INSERT INTO StdDestinations VALUES (63, 1, NULL, 'la_country_ECU', 'ECU', 'EC');
INSERT INTO StdDestinations VALUES (64, 1, NULL, 'la_country_EGY', 'EGY', 'EG');
INSERT INTO StdDestinations VALUES (65, 1, NULL, 'la_country_SLV', 'SLV', 'SV');
INSERT INTO StdDestinations VALUES (66, 1, NULL, 'la_country_GNQ', 'GNQ', 'GQ');
INSERT INTO StdDestinations VALUES (67, 1, NULL, 'la_country_ERI', 'ERI', 'ER');
INSERT INTO StdDestinations VALUES (68, 1, NULL, 'la_country_EST', 'EST', 'EE');
INSERT INTO StdDestinations VALUES (69, 1, NULL, 'la_country_ETH', 'ETH', 'ET');
INSERT INTO StdDestinations VALUES (70, 1, NULL, 'la_country_FLK', 'FLK', 'FK');
INSERT INTO StdDestinations VALUES (71, 1, NULL, 'la_country_FRO', 'FRO', 'FO');
INSERT INTO StdDestinations VALUES (72, 1, NULL, 'la_country_FJI', 'FJI', 'FJ');
INSERT INTO StdDestinations VALUES (73, 1, NULL, 'la_country_FIN', 'FIN', 'FI');
INSERT INTO StdDestinations VALUES (74, 1, NULL, 'la_country_FRA', 'FRA', 'FR');
INSERT INTO StdDestinations VALUES (75, 1, NULL, 'la_country_FXX', 'FXX', 'FX');
INSERT INTO StdDestinations VALUES (76, 1, NULL, 'la_country_GUF', 'GUF', 'GF');
INSERT INTO StdDestinations VALUES (77, 1, NULL, 'la_country_PYF', 'PYF', 'PF');
INSERT INTO StdDestinations VALUES (78, 1, NULL, 'la_country_ATF', 'ATF', 'TF');
INSERT INTO StdDestinations VALUES (79, 1, NULL, 'la_country_GAB', 'GAB', 'GA');
INSERT INTO StdDestinations VALUES (80, 1, NULL, 'la_country_GMB', 'GMB', 'GM');
INSERT INTO StdDestinations VALUES (81, 1, NULL, 'la_country_GEO', 'GEO', 'GE');
INSERT INTO StdDestinations VALUES (82, 1, NULL, 'la_country_DEU', 'DEU', 'DE');
INSERT INTO StdDestinations VALUES (83, 1, NULL, 'la_country_GHA', 'GHA', 'GH');
INSERT INTO StdDestinations VALUES (84, 1, NULL, 'la_country_GIB', 'GIB', 'GI');
INSERT INTO StdDestinations VALUES (85, 1, NULL, 'la_country_GRC', 'GRC', 'GR');
INSERT INTO StdDestinations VALUES (86, 1, NULL, 'la_country_GRL', 'GRL', 'GL');
INSERT INTO StdDestinations VALUES (87, 1, NULL, 'la_country_GRD', 'GRD', 'GD');
INSERT INTO StdDestinations VALUES (88, 1, NULL, 'la_country_GLP', 'GLP', 'GP');
INSERT INTO StdDestinations VALUES (89, 1, NULL, 'la_country_GUM', 'GUM', 'GU');
INSERT INTO StdDestinations VALUES (90, 1, NULL, 'la_country_GTM', 'GTM', 'GT');
INSERT INTO StdDestinations VALUES (91, 1, NULL, 'la_country_GIN', 'GIN', 'GN');
INSERT INTO StdDestinations VALUES (92, 1, NULL, 'la_country_GNB', 'GNB', 'GW');
INSERT INTO StdDestinations VALUES (93, 1, NULL, 'la_country_GUY', 'GUY', 'GY');
INSERT INTO StdDestinations VALUES (94, 1, NULL, 'la_country_HTI', 'HTI', 'HT');
INSERT INTO StdDestinations VALUES (95, 1, NULL, 'la_country_HMD', 'HMD', 'HM');
INSERT INTO StdDestinations VALUES (96, 1, NULL, 'la_country_HND', 'HND', 'HN');
INSERT INTO StdDestinations VALUES (97, 1, NULL, 'la_country_HKG', 'HKG', 'HK');
INSERT INTO StdDestinations VALUES (98, 1, NULL, 'la_country_HUN', 'HUN', 'HU');
INSERT INTO StdDestinations VALUES (99, 1, NULL, 'la_country_ISL', 'ISL', 'IS');
INSERT INTO StdDestinations VALUES (100, 1, NULL, 'la_country_IND', 'IND', 'IN');
INSERT INTO StdDestinations VALUES (101, 1, NULL, 'la_country_IDN', 'IDN', 'ID');
INSERT INTO StdDestinations VALUES (102, 1, NULL, 'la_country_IRN', 'IRN', 'IR');
INSERT INTO StdDestinations VALUES (103, 1, NULL, 'la_country_IRQ', 'IRQ', 'IQ');
INSERT INTO StdDestinations VALUES (104, 1, NULL, 'la_country_IRL', 'IRL', 'IE');
INSERT INTO StdDestinations VALUES (105, 1, NULL, 'la_country_ISR', 'ISR', 'IL');
INSERT INTO StdDestinations VALUES (106, 1, NULL, 'la_country_ITA', 'ITA', 'IT');
INSERT INTO StdDestinations VALUES (107, 1, NULL, 'la_country_JAM', 'JAM', 'JM');
INSERT INTO StdDestinations VALUES (108, 1, NULL, 'la_country_JPN', 'JPN', 'JP');
INSERT INTO StdDestinations VALUES (109, 1, NULL, 'la_country_JOR', 'JOR', 'JO');
INSERT INTO StdDestinations VALUES (110, 1, NULL, 'la_country_KAZ', 'KAZ', 'KZ');
INSERT INTO StdDestinations VALUES (111, 1, NULL, 'la_country_KEN', 'KEN', 'KE');
INSERT INTO StdDestinations VALUES (112, 1, NULL, 'la_country_KIR', 'KIR', 'KI');
INSERT INTO StdDestinations VALUES (113, 1, NULL, 'la_country_PRK', 'PRK', 'KP');
INSERT INTO StdDestinations VALUES (114, 1, NULL, 'la_country_KOR', 'KOR', 'KR');
INSERT INTO StdDestinations VALUES (115, 1, NULL, 'la_country_KWT', 'KWT', 'KW');
INSERT INTO StdDestinations VALUES (116, 1, NULL, 'la_country_KGZ', 'KGZ', 'KG');
INSERT INTO StdDestinations VALUES (117, 1, NULL, 'la_country_LAO', 'LAO', 'LA');
INSERT INTO StdDestinations VALUES (118, 1, NULL, 'la_country_LVA', 'LVA', 'LV');
INSERT INTO StdDestinations VALUES (119, 1, NULL, 'la_country_LBN', 'LBN', 'LB');
INSERT INTO StdDestinations VALUES (120, 1, NULL, 'la_country_LSO', 'LSO', 'LS');
INSERT INTO StdDestinations VALUES (121, 1, NULL, 'la_country_LBR', 'LBR', 'LR');
INSERT INTO StdDestinations VALUES (122, 1, NULL, 'la_country_LBY', 'LBY', 'LY');
INSERT INTO StdDestinations VALUES (123, 1, NULL, 'la_country_LIE', 'LIE', 'LI');
INSERT INTO StdDestinations VALUES (124, 1, NULL, 'la_country_LTU', 'LTU', 'LT');
INSERT INTO StdDestinations VALUES (125, 1, NULL, 'la_country_LUX', 'LUX', 'LU');
INSERT INTO StdDestinations VALUES (126, 1, NULL, 'la_country_MAC', 'MAC', 'MO');
INSERT INTO StdDestinations VALUES (127, 1, NULL, 'la_country_MKD', 'MKD', 'MK');
INSERT INTO StdDestinations VALUES (128, 1, NULL, 'la_country_MDG', 'MDG', 'MG');
INSERT INTO StdDestinations VALUES (129, 1, NULL, 'la_country_MWI', 'MWI', 'MW');
INSERT INTO StdDestinations VALUES (130, 1, NULL, 'la_country_MYS', 'MYS', 'MY');
INSERT INTO StdDestinations VALUES (131, 1, NULL, 'la_country_MDV', 'MDV', 'MV');
INSERT INTO StdDestinations VALUES (132, 1, NULL, 'la_country_MLI', 'MLI', 'ML');
INSERT INTO StdDestinations VALUES (133, 1, NULL, 'la_country_MLT', 'MLT', 'MT');
INSERT INTO StdDestinations VALUES (134, 1, NULL, 'la_country_MHL', 'MHL', 'MH');
INSERT INTO StdDestinations VALUES (135, 1, NULL, 'la_country_MTQ', 'MTQ', 'MQ');
INSERT INTO StdDestinations VALUES (136, 1, NULL, 'la_country_MRT', 'MRT', 'MR');
INSERT INTO StdDestinations VALUES (137, 1, NULL, 'la_country_MUS', 'MUS', 'MU');
INSERT INTO StdDestinations VALUES (138, 1, NULL, 'la_country_MYT', 'MYT', 'YT');
INSERT INTO StdDestinations VALUES (139, 1, NULL, 'la_country_MEX', 'MEX', 'MX');
INSERT INTO StdDestinations VALUES (140, 1, NULL, 'la_country_FSM', 'FSM', 'FM');
INSERT INTO StdDestinations VALUES (141, 1, NULL, 'la_country_MDA', 'MDA', 'MD');
INSERT INTO StdDestinations VALUES (142, 1, NULL, 'la_country_MCO', 'MCO', 'MC');
INSERT INTO StdDestinations VALUES (143, 1, NULL, 'la_country_MNG', 'MNG', 'MN');
INSERT INTO StdDestinations VALUES (144, 1, NULL, 'la_country_MSR', 'MSR', 'MS');
INSERT INTO StdDestinations VALUES (145, 1, NULL, 'la_country_MAR', 'MAR', 'MA');
INSERT INTO StdDestinations VALUES (146, 1, NULL, 'la_country_MOZ', 'MOZ', 'MZ');
INSERT INTO StdDestinations VALUES (147, 1, NULL, 'la_country_MMR', 'MMR', 'MM');
INSERT INTO StdDestinations VALUES (148, 1, NULL, 'la_country_NAM', 'NAM', 'NA');
INSERT INTO StdDestinations VALUES (149, 1, NULL, 'la_country_NRU', 'NRU', 'NR');
INSERT INTO StdDestinations VALUES (150, 1, NULL, 'la_country_NPL', 'NPL', 'NP');
INSERT INTO StdDestinations VALUES (151, 1, NULL, 'la_country_NLD', 'NLD', 'NL');
INSERT INTO StdDestinations VALUES (152, 1, NULL, 'la_country_ANT', 'ANT', 'AN');
INSERT INTO StdDestinations VALUES (153, 1, NULL, 'la_country_NCL', 'NCL', 'NC');
INSERT INTO StdDestinations VALUES (154, 1, NULL, 'la_country_NZL', 'NZL', 'NZ');
INSERT INTO StdDestinations VALUES (155, 1, NULL, 'la_country_NIC', 'NIC', 'NI');
INSERT INTO StdDestinations VALUES (156, 1, NULL, 'la_country_NER', 'NER', 'NE');
INSERT INTO StdDestinations VALUES (157, 1, NULL, 'la_country_NGA', 'NGA', 'NG');
INSERT INTO StdDestinations VALUES (158, 1, NULL, 'la_country_NIU', 'NIU', 'NU');
INSERT INTO StdDestinations VALUES (159, 1, NULL, 'la_country_NFK', 'NFK', 'NF');
INSERT INTO StdDestinations VALUES (160, 1, NULL, 'la_country_MNP', 'MNP', 'MP');
INSERT INTO StdDestinations VALUES (161, 1, NULL, 'la_country_NOR', 'NOR', 'NO');
INSERT INTO StdDestinations VALUES (162, 1, NULL, 'la_country_OMN', 'OMN', 'OM');
INSERT INTO StdDestinations VALUES (163, 1, NULL, 'la_country_PAK', 'PAK', 'PK');
INSERT INTO StdDestinations VALUES (164, 1, NULL, 'la_country_PLW', 'PLW', 'PW');
INSERT INTO StdDestinations VALUES (165, 1, NULL, 'la_country_PSE', 'PSE', 'PS');
INSERT INTO StdDestinations VALUES (166, 1, NULL, 'la_country_PAN', 'PAN', 'PA');
INSERT INTO StdDestinations VALUES (167, 1, NULL, 'la_country_PNG', 'PNG', 'PG');
INSERT INTO StdDestinations VALUES (168, 1, NULL, 'la_country_PRY', 'PRY', 'PY');
INSERT INTO StdDestinations VALUES (169, 1, NULL, 'la_country_PER', 'PER', 'PE');
INSERT INTO StdDestinations VALUES (170, 1, NULL, 'la_country_PHL', 'PHL', 'PH');
INSERT INTO StdDestinations VALUES (171, 1, NULL, 'la_country_PCN', 'PCN', 'PN');
INSERT INTO StdDestinations VALUES (172, 1, NULL, 'la_country_POL', 'POL', 'PL');
INSERT INTO StdDestinations VALUES (173, 1, NULL, 'la_country_PRT', 'PRT', 'PT');
INSERT INTO StdDestinations VALUES (174, 1, NULL, 'la_country_PRI', 'PRI', 'PR');
INSERT INTO StdDestinations VALUES (175, 1, NULL, 'la_country_QAT', 'QAT', 'QA');
INSERT INTO StdDestinations VALUES (176, 1, NULL, 'la_country_REU', 'REU', 'RE');
INSERT INTO StdDestinations VALUES (177, 1, NULL, 'la_country_ROU', 'ROU', 'RO');
INSERT INTO StdDestinations VALUES (178, 1, NULL, 'la_country_RUS', 'RUS', 'RU');
INSERT INTO StdDestinations VALUES (179, 1, NULL, 'la_country_RWA', 'RWA', 'RW');
INSERT INTO StdDestinations VALUES (180, 1, NULL, 'la_country_KNA', 'KNA', 'KN');
INSERT INTO StdDestinations VALUES (181, 1, NULL, 'la_country_LCA', 'LCA', 'LC');
INSERT INTO StdDestinations VALUES (182, 1, NULL, 'la_country_VCT', 'VCT', 'VC');
INSERT INTO StdDestinations VALUES (183, 1, NULL, 'la_country_WSM', 'WSM', 'WS');
INSERT INTO StdDestinations VALUES (184, 1, NULL, 'la_country_SMR', 'SMR', 'SM');
INSERT INTO StdDestinations VALUES (185, 1, NULL, 'la_country_STP', 'STP', 'ST');
INSERT INTO StdDestinations VALUES (186, 1, NULL, 'la_country_SAU', 'SAU', 'SA');
INSERT INTO StdDestinations VALUES (187, 1, NULL, 'la_country_SEN', 'SEN', 'SN');
INSERT INTO StdDestinations VALUES (188, 1, NULL, 'la_country_SYC', 'SYC', 'SC');
INSERT INTO StdDestinations VALUES (189, 1, NULL, 'la_country_SLE', 'SLE', 'SL');
INSERT INTO StdDestinations VALUES (190, 1, NULL, 'la_country_SGP', 'SGP', 'SG');
INSERT INTO StdDestinations VALUES (191, 1, NULL, 'la_country_SVK', 'SVK', 'SK');
INSERT INTO StdDestinations VALUES (192, 1, NULL, 'la_country_SVN', 'SVN', 'SI');
INSERT INTO StdDestinations VALUES (193, 1, NULL, 'la_country_SLB', 'SLB', 'SB');
INSERT INTO StdDestinations VALUES (194, 1, NULL, 'la_country_SOM', 'SOM', 'SO');
INSERT INTO StdDestinations VALUES (195, 1, NULL, 'la_country_ZAF', 'ZAF', 'ZA');
INSERT INTO StdDestinations VALUES (196, 1, NULL, 'la_country_SGS', 'SGS', 'GS');
INSERT INTO StdDestinations VALUES (197, 1, NULL, 'la_country_ESP', 'ESP', 'ES');
INSERT INTO StdDestinations VALUES (198, 1, NULL, 'la_country_LKA', 'LKA', 'LK');
INSERT INTO StdDestinations VALUES (199, 1, NULL, 'la_country_SHN', 'SHN', 'SH');
INSERT INTO StdDestinations VALUES (200, 1, NULL, 'la_country_SPM', 'SPM', 'PM');
INSERT INTO StdDestinations VALUES (201, 1, NULL, 'la_country_SDN', 'SDN', 'SD');
INSERT INTO StdDestinations VALUES (202, 1, NULL, 'la_country_SUR', 'SUR', 'SR');
INSERT INTO StdDestinations VALUES (203, 1, NULL, 'la_country_SJM', 'SJM', 'SJ');
INSERT INTO StdDestinations VALUES (204, 1, NULL, 'la_country_SWZ', 'SWZ', 'SZ');
INSERT INTO StdDestinations VALUES (205, 1, NULL, 'la_country_SWE', 'SWE', 'SE');
INSERT INTO StdDestinations VALUES (206, 1, NULL, 'la_country_CHE', 'CHE', 'CH');
INSERT INTO StdDestinations VALUES (207, 1, NULL, 'la_country_SYR', 'SYR', 'SY');
INSERT INTO StdDestinations VALUES (208, 1, NULL, 'la_country_TWN', 'TWN', 'TW');
INSERT INTO StdDestinations VALUES (209, 1, NULL, 'la_country_TJK', 'TJK', 'TJ');
INSERT INTO StdDestinations VALUES (210, 1, NULL, 'la_country_TZA', 'TZA', 'TZ');
INSERT INTO StdDestinations VALUES (211, 1, NULL, 'la_country_THA', 'THA', 'TH');
INSERT INTO StdDestinations VALUES (212, 1, NULL, 'la_country_TGO', 'TGO', 'TG');
INSERT INTO StdDestinations VALUES (213, 1, NULL, 'la_country_TKL', 'TKL', 'TK');
INSERT INTO StdDestinations VALUES (214, 1, NULL, 'la_country_TON', 'TON', 'TO');
INSERT INTO StdDestinations VALUES (215, 1, NULL, 'la_country_TTO', 'TTO', 'TT');
INSERT INTO StdDestinations VALUES (216, 1, NULL, 'la_country_TUN', 'TUN', 'TN');
INSERT INTO StdDestinations VALUES (217, 1, NULL, 'la_country_TUR', 'TUR', 'TR');
INSERT INTO StdDestinations VALUES (218, 1, NULL, 'la_country_TKM', 'TKM', 'TM');
INSERT INTO StdDestinations VALUES (219, 1, NULL, 'la_country_TCA', 'TCA', 'TC');
INSERT INTO StdDestinations VALUES (220, 1, NULL, 'la_country_TUV', 'TUV', 'TV');
INSERT INTO StdDestinations VALUES (221, 1, NULL, 'la_country_UGA', 'UGA', 'UG');
INSERT INTO StdDestinations VALUES (222, 1, NULL, 'la_country_UKR', 'UKR', 'UA');
INSERT INTO StdDestinations VALUES (223, 1, NULL, 'la_country_ARE', 'ARE', 'AE');
INSERT INTO StdDestinations VALUES (224, 1, NULL, 'la_country_GBR', 'GBR', 'GB');
INSERT INTO StdDestinations VALUES (225, 1, NULL, 'la_country_USA', 'USA', 'US');
INSERT INTO StdDestinations VALUES (226, 1, NULL, 'la_country_UMI', 'UMI', 'UM');
INSERT INTO StdDestinations VALUES (227, 1, NULL, 'la_country_URY', 'URY', 'UY');
INSERT INTO StdDestinations VALUES (228, 1, NULL, 'la_country_UZB', 'UZB', 'UZ');
INSERT INTO StdDestinations VALUES (229, 1, NULL, 'la_country_VUT', 'VUT', 'VU');
INSERT INTO StdDestinations VALUES (230, 1, NULL, 'la_country_VAT', 'VAT', 'VA');
INSERT INTO StdDestinations VALUES (231, 1, NULL, 'la_country_VEN', 'VEN', 'VE');
INSERT INTO StdDestinations VALUES (232, 1, NULL, 'la_country_VNM', 'VNM', 'VN');
INSERT INTO StdDestinations VALUES (233, 1, NULL, 'la_country_VGB', 'VGB', 'VG');
INSERT INTO StdDestinations VALUES (234, 1, NULL, 'la_country_VIR', 'VIR', 'VI');
INSERT INTO StdDestinations VALUES (235, 1, NULL, 'la_country_WLF', 'WLF', 'WF');
INSERT INTO StdDestinations VALUES (236, 1, NULL, 'la_country_ESH', 'ESH', 'EH');
INSERT INTO StdDestinations VALUES (237, 1, NULL, 'la_country_YEM', 'YEM', 'YE');
INSERT INTO StdDestinations VALUES (238, 1, NULL, 'la_country_YUG', 'YUG', 'YU');
INSERT INTO StdDestinations VALUES (239, 1, NULL, 'la_country_ZMB', 'ZMB', 'ZM');
INSERT INTO StdDestinations VALUES (240, 1, NULL, 'la_country_ZWE', 'ZWE', 'ZW');
INSERT INTO StdDestinations VALUES (370, 2, 38, 'la_state_YT', 'YT', NULL);
INSERT INTO StdDestinations VALUES (369, 2, 38, 'la_state_SK', 'SK', NULL);
INSERT INTO StdDestinations VALUES (368, 2, 38, 'la_state_QC', 'QC', NULL);
INSERT INTO StdDestinations VALUES (367, 2, 38, 'la_state_PE', 'PE', NULL);
INSERT INTO StdDestinations VALUES (366, 2, 38, 'la_state_ON', 'ON', NULL);
INSERT INTO StdDestinations VALUES (365, 2, 38, 'la_state_NU', 'NU', NULL);
INSERT INTO StdDestinations VALUES (364, 2, 38, 'la_state_NS', 'NS', NULL);
INSERT INTO StdDestinations VALUES (363, 2, 38, 'la_state_NT', 'NT', NULL);
INSERT INTO StdDestinations VALUES (362, 2, 38, 'la_state_NL', 'NL', NULL);
INSERT INTO StdDestinations VALUES (361, 2, 38, 'la_state_NB', 'NB', NULL);
INSERT INTO StdDestinations VALUES (360, 2, 38, 'la_state_MB', 'MB', NULL);
INSERT INTO StdDestinations VALUES (359, 2, 38, 'la_state_BC', 'BC', NULL);
INSERT INTO StdDestinations VALUES (358, 2, 38, 'la_state_AB', 'AB', NULL);
INSERT INTO StdDestinations VALUES (357, 2, 225, 'la_state_DC', 'DC', NULL);
INSERT INTO StdDestinations VALUES (356, 2, 225, 'la_state_WY', 'WY', NULL);
INSERT INTO StdDestinations VALUES (355, 2, 225, 'la_state_WI', 'WI', NULL);
INSERT INTO StdDestinations VALUES (354, 2, 225, 'la_state_WV', 'WV', NULL);
INSERT INTO StdDestinations VALUES (353, 2, 225, 'la_state_WA', 'WA', NULL);
INSERT INTO StdDestinations VALUES (352, 2, 225, 'la_state_VA', 'VA', NULL);
INSERT INTO StdDestinations VALUES (351, 2, 225, 'la_state_VT', 'VT', NULL);
INSERT INTO StdDestinations VALUES (350, 2, 225, 'la_state_UT', 'UT', NULL);
INSERT INTO StdDestinations VALUES (349, 2, 225, 'la_state_TX', 'TX', NULL);
INSERT INTO StdDestinations VALUES (348, 2, 225, 'la_state_TN', 'TN', NULL);
INSERT INTO StdDestinations VALUES (347, 2, 225, 'la_state_SD', 'SD', NULL);
INSERT INTO StdDestinations VALUES (346, 2, 225, 'la_state_SC', 'SC', NULL);
INSERT INTO StdDestinations VALUES (345, 2, 225, 'la_state_RI', 'RI', NULL);
INSERT INTO StdDestinations VALUES (344, 2, 225, 'la_state_PR', 'PR', NULL);
INSERT INTO StdDestinations VALUES (343, 2, 225, 'la_state_PA', 'PA', NULL);
INSERT INTO StdDestinations VALUES (342, 2, 225, 'la_state_OR', 'OR', NULL);
INSERT INTO StdDestinations VALUES (341, 2, 225, 'la_state_OK', 'OK', NULL);
INSERT INTO StdDestinations VALUES (340, 2, 225, 'la_state_OH', 'OH', NULL);
INSERT INTO StdDestinations VALUES (339, 2, 225, 'la_state_ND', 'ND', NULL);
INSERT INTO StdDestinations VALUES (338, 2, 225, 'la_state_NC', 'NC', NULL);
INSERT INTO StdDestinations VALUES (337, 2, 225, 'la_state_NY', 'NY', NULL);
INSERT INTO StdDestinations VALUES (336, 2, 225, 'la_state_NM', 'NM', NULL);
INSERT INTO StdDestinations VALUES (335, 2, 225, 'la_state_NJ', 'NJ', NULL);
INSERT INTO StdDestinations VALUES (334, 2, 225, 'la_state_NH', 'NH', NULL);
INSERT INTO StdDestinations VALUES (333, 2, 225, 'la_state_NV', 'NV', NULL);
INSERT INTO StdDestinations VALUES (332, 2, 225, 'la_state_NE', 'NE', NULL);
INSERT INTO StdDestinations VALUES (331, 2, 225, 'la_state_MT', 'MT', NULL);
INSERT INTO StdDestinations VALUES (330, 2, 225, 'la_state_MO', 'MO', NULL);
INSERT INTO StdDestinations VALUES (329, 2, 225, 'la_state_MS', 'MS', NULL);
INSERT INTO StdDestinations VALUES (328, 2, 225, 'la_state_MN', 'MN', NULL);
INSERT INTO StdDestinations VALUES (327, 2, 225, 'la_state_MI', 'MI', NULL);
INSERT INTO StdDestinations VALUES (326, 2, 225, 'la_state_MA', 'MA', NULL);
INSERT INTO StdDestinations VALUES (325, 2, 225, 'la_state_MD', 'MD', NULL);
INSERT INTO StdDestinations VALUES (324, 2, 225, 'la_state_ME', 'ME', NULL);
INSERT INTO StdDestinations VALUES (323, 2, 225, 'la_state_LA', 'LA', NULL);
INSERT INTO StdDestinations VALUES (322, 2, 225, 'la_state_KY', 'KY', NULL);
INSERT INTO StdDestinations VALUES (321, 2, 225, 'la_state_KS', 'KS', NULL);
INSERT INTO StdDestinations VALUES (320, 2, 225, 'la_state_IA', 'IA', NULL);
INSERT INTO StdDestinations VALUES (319, 2, 225, 'la_state_IN', 'IN', NULL);
INSERT INTO StdDestinations VALUES (318, 2, 225, 'la_state_IL', 'IL', NULL);
INSERT INTO StdDestinations VALUES (317, 2, 225, 'la_state_ID', 'ID', NULL);
INSERT INTO StdDestinations VALUES (316, 2, 225, 'la_state_HI', 'HI', NULL);
INSERT INTO StdDestinations VALUES (315, 2, 225, 'la_state_GA', 'GA', NULL);
INSERT INTO StdDestinations VALUES (314, 2, 225, 'la_state_FL', 'FL', NULL);
INSERT INTO StdDestinations VALUES (313, 2, 225, 'la_state_DE', 'DE', NULL);
INSERT INTO StdDestinations VALUES (312, 2, 225, 'la_state_CT', 'CT', NULL);
INSERT INTO StdDestinations VALUES (311, 2, 225, 'la_state_CO', 'CO', NULL);
INSERT INTO StdDestinations VALUES (310, 2, 225, 'la_state_CA', 'CA', NULL);
INSERT INTO StdDestinations VALUES (309, 2, 225, 'la_state_AR', 'AR', NULL);
INSERT INTO StdDestinations VALUES (308, 2, 225, 'la_state_AZ', 'AZ', NULL);
INSERT INTO StdDestinations VALUES (307, 2, 225, 'la_state_AK', 'AK', NULL);
INSERT INTO StdDestinations VALUES (306, 2, 225, 'la_state_AL', 'AL', NULL);
UPDATE Modules SET Version = '1.1.0' WHERE Name = 'In-Portal';
\ No newline at end of file
Property changes on: trunk/admin/install/upgrades/inportal_upgrade_v1.1.0.sql
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.8
\ No newline at end of property
+1.9
\ No newline at end of property
Index: trunk/core/kernel/utility/formatters.php
===================================================================
--- trunk/core/kernel/utility/formatters.php (revision 1828)
+++ trunk/core/kernel/utility/formatters.php (revision 1829)
@@ -1,1027 +1,1027 @@
<?php
class kFormatter extends kBase {
/**
* Convert's value to match type from config
*
* @param mixed $value
* @param Array $options
* @return mixed
* @access protected
*/
function TypeCast($value, $options)
{
$ret = true;
if( isset($options['type']) )
{
$field_type = $options['type'];
$type_ok = preg_match('#int|integer|double|float|real|numeric|string#', $field_type);
if($field_type == 'string') return $value;
if ($value != '' && $type_ok)
{
$ret = is_numeric($value);
if($ret)
{
$f = 'is_'.$field_type;
settype($value, $field_type);
$ret = $f($value);
}
}
}
return $ret ? $value : false;
}
//function Format($value, $options, &$errors)
function Format($value, $field_name, &$object, $format=null)
{
if ( is_null($value) ) return '';
$options = $object->GetFieldOptions($field_name);
if ( isset($format) ) $options['format'] = $format;
$tc_value = $this->TypeCast($value,$options);
if( ($tc_value === false) || ($tc_value != $value) ) return $value; // for leaving badly formatted date on the form
if (isset($options['format'])) return sprintf($options['format'], $tc_value);
return $tc_value;
}
//function Parse($value, $options, &$errors)
function Parse($value, $field_name, &$object)
{
if ($value == '') return NULL;
$options = $object->GetFieldOptions($field_name);
$tc_value = $this->TypeCast($value,$options);
if($tc_value === false) return $value; // for leaving badly formatted date on the form
if( isset($options['type']) )
{
if( preg_match('#double|float|real|numeric#', $options['type']) ) $tc_value = str_replace(',', '.', $tc_value);
}
if( isset($options['regexp']) )
{
if( !preg_match($options['regexp'], $value) )
{
$object->FieldErrors[$field_name]['pseudo'] = 'invalid_format';
}
}
return $tc_value;
}
function HumanFormat($format)
{
return $format;
}
/**
* The method is supposed to alter config options or cofigure object in some way based on its usage of formatters
* The methods is called for every field with formatter defined when configuring item.
* Could be used for adding additional VirtualFields to an object required by some special Formatter
*
* @param string $field_name
* @param array $field_options
* @param kDBBase $object
*/
function PrepareOptions($field_name, &$field_options, &$object)
{
}
/**
* Used for split fields like timestamp -> date, time
* Called from DBItem to update sub fields values after loading item
*
* @param unknown_type $field
* @param unknown_type $value
* @param unknown_type $options
* @param unknown_type $object
*/
function UpdateSubFields($field, $value, &$options, &$object)
{
}
/**
* Used for split fields like timestamp -> date, time
* Called from DBItem Validate (before validation) to get back master field value from its sub_fields
*
* @param unknown_type $field
* @param unknown_type $value
* @param unknown_type $options
* @param unknown_type $object
*/
function UpdateMasterFields($field, $value, &$options, &$object)
{
}
/* function GetErrorMsg($pseudo_error, $options)
{
if ( isset($options['error_msgs'][$pseudo_error]) ) {
return $options['error_msgs'][$pseudo_error];
}
else {
return $this->ErrorMsgs[$pseudo_error];
}
}*/
function GetSample($field, &$options, &$object)
{
}
}
class kOptionsFormatter extends kFormatter {
//function Format($value, $options, &$errors)
function Format($value, $field_name, &$object, $format=null)
{
if ( is_null($value) ) return '';
$options = $object->GetFieldOptions($field_name);
if ( isset($format) ) $options['format'] = $format;
$label = getArrayValue($options['options'], $value);
if( getArrayValue($options,'use_phrases') )
{
return $this->Application->Phrase($label);
}
else
{
return $label;
}
}
}
/**
* Replacement for kOptionsFormatter in case if options
* should be selected from database. Use this formatter
* only in case if formatter attached field is in edit form.
*
* For usage in grid just use LEFT JOIN clause to table
* where requested options are located.
*/
class kLEFTFormatter extends kFormatter {
//function Format($value, $options, &$errors)
function Format($value, $field_name, &$object, $format=null)
{
if ( is_null($value) ) return '';
$options = $object->GetFieldOptions($field_name);
if ( isset($format) ) $options['format'] = $format;
if( !isset($options['options'][$value]) )
{
// required option is not defined in config => query for it
$db =& $this->Application->GetADODBConnection();
$sql = sprintf($options['left_sql'],$options['left_title_field'],$options['left_key_field'],$value);
$options['options'][$value] = $db->GetOne($sql);
}
return $options['options'][$value];
}
//function Parse($value, $options, &$errors)
function Parse($value, $field_name, &$object)
{
if ($value == '') return NULL;
$options = $object->GetFieldOptions($field_name);
if( !array_search($value,$options['options']) )
{
// required option is not defined in config => query for it
$db =& $this->Application->GetADODBConnection();
$sql = sprintf($options['left_sql'],$options['left_key_field'],$options['left_title_field'],$value);
$found = $db->GetOne($sql);
if($found !== false) $options['options'][$found] = $value;
}
else
{
$found = array_search($value,$options['options']);
}
if($found === false) $found = $options['default'];
return $found;
}
}
class kDateFormatter extends kFormatter {
/* function kDateFormatter()
{
parent::kFormatter();
$this->ErrorMsgs['bad_dformat'] = 'Please use correct date format (%s) ex. (%s)';
}
*/
function PrepareOptions($field_name, &$field_options, &$object)
{
$date_format = getArrayValue($field_options, 'date_format');
$time_format = getArrayValue($field_options, 'time_format');
$language =& $this->Application->recallObject('lang.current');
if ($date_format === false) $date_format = $language->GetDBField('DateFormat');
if ($time_format === false) $time_format = $language->GetDBField('TimeFormat');
if (!isset($field_options['date_time_separator'])) $field_options['date_time_separator'] = ' ';
$field_options['format'] = $date_format.$field_options['date_time_separator'].$time_format;
$field_options['sub_fields'] = Array('date' => $field_name.'_date', 'time' => $field_name.'_time');
$add_fields = Array();
$opts = Array('master_field' => $field_name, 'formatter'=>'kDateFormatter', 'format'=>$date_format);
if ( isset($field_options['default']) ) $opts['default'] = $field_options['default'];
if ( isset($field_options['required']) ) $opts['required'] = $field_options['required'];
$add_fields[$field_name.'_date'] = $opts;
$opts['format'] = $time_format;
$add_fields[$field_name.'_time'] = $opts;
if ( !isset($object->VirtualFields[$field_name]) ) {
// adding caluclated field to format date directly in the query
if ( !isset($object->CalculatedFields) || !is_array($object->CalculatedFields) ) {
$object->CalculatedFields = Array();
}
$object->CalculatedFields[$field_name.'_formatted'] = 'FROM_UNIXTIME('.'`%1$s`.'.$field_name.', \''.$this->SQLFormat($field_options['format']).'\')';
$opts['format'] = $field_options['format'];
$opts['required'] = 0;
unset($opts['master_field']);
$add_fields[$field_name.'_formatted'] = $opts;
}
$add_fields = array_merge_recursive2($add_fields, $object->VirtualFields);
$object->setVirtualFields($add_fields);
}
function UpdateSubFields($field, $value, &$options, &$object)
{
if ( $sub_fields = getArrayValue($options, 'sub_fields') ) {
if( isset($value) && $value )
{
$object->SetDBField( $sub_fields['date'], $value );
$object->SetDBField( $sub_fields['time'], $value );
}
}
}
function UpdateMasterFields($field, $value, &$options, &$object)
{
// when in master field - set own value from sub_fields
if ( $sub_fields = getArrayValue($options, 'sub_fields') ) {
// if date is not empty, but time is empty - set time to 0, otherwise master field fomratter will complain
// when we have only date field on form, we need time hidden field always empty, don't ask me why!
if ( $object->GetDBField($sub_fields['date']) != '' && $object->GetDBField($sub_fields['time']) == '' ) {
$empty_time = getArrayValue($options,'empty_time');
if($empty_time === false) $empty_time = mktime(0,0,0);
$object->SetDBField($sub_fields['time'], $empty_time);
}
$object->SetField($field, $object->GetField($sub_fields['date']).$options['date_time_separator'].$object->GetField($sub_fields['time']));
}
// when in one of sub_fields - call update for master_field to update its value from sub_fields [are you following ? :) ]
elseif ($master_field = getArrayValue($options, 'master_field') ) {
$this->UpdateMasterFields($master_field, null, $object->GetFieldOptions($master_field), $object);
}
}
//function Format($value, $options, &$errors)
function Format($value, $field_name, &$object, $format=null)
{
if ( is_null($value) ) return '';
if ( !is_numeric($value) ) return $value; // for leaving badly formatted date on the form
settype($value, 'int');
if ( !is_int($value) ) return $value;
$options = $object->GetFieldOptions($field_name);
if ( isset($format) ) $options['format'] = $format;
return date($options['format'], $value);
}
function HumanFormat($format)
{
$patterns = Array('/m/',
'/n/',
'/d/',
'/j/',
'/y/',
'/Y/',
'/h|H/',
'/g|G/',
'/i/',
'/s/',
'/a|A/');
$replace = Array( 'mm',
'm',
'dd',
'd',
'yy',
'yyyy',
'hh',
'h',
'mm',
'ss',
'AM');
$res = preg_replace($patterns, $replace, $format);
return $res;
}
function SQLFormat($format)
{
$mapping = Array(
'/%/' => '%%',
'/(?<!%)a/' => '%p', // Lowercase Ante meridiem and Post meridiem => MySQL provides only uppercase
'/(?<!%)A/' => '%p', // Uppercase Ante meridiem and Post meridiem
'/(?<!%)d/' => '%d', // Day of the month, 2 digits with leading zeros
'/(?<!%)D/' => '%a', // A textual representation of a day, three letters
'/(?<!%)F/' => '%M', // A full textual representation of a month, such as January or March
'/(?<!%)g/' => '%l', // 12-hour format of an hour without leading zeros
'/(?<!%)G/' => '%k', // 24-hour format of an hour without leading zeros
'/(?<!%)h/' => '%h', // 12-hour format of an hour with leading zeros
'/(?<!%)H/' => '%H', // 24-hour format of an hour with leading zeros
'/(?<!%)i/' => '%i', // Minutes with leading zeros
'/(?<!%)I/' => 'N/A', // Whether or not the date is in daylights savings time
'/(?<!%)S/' => 'N/A', // English ordinal suffix for the day of the month, 2 characters, see below
'/jS/' => '%D', // MySQL can't return separate suffix, but could return date with suffix
'/(?<!%)j/' => '%e', // Day of the month without leading zeros
'/(?<!%)l/' => '%W', // A full textual representation of the day of the week
'/(?<!%)L/' => 'N/A', // Whether it's a leap year
'/(?<!%)m/' => '%m', // Numeric representation of a month, with leading zeros
'/(?<!%)M/' => '%b', // A short textual representation of a month, three letters
'/(?<!%)n/' => '%c', // Numeric representation of a month, without leading zeros
'/(?<!%)O/' => 'N/A', // Difference to Greenwich time (GMT) in hours
'/(?<!%)r/' => 'N/A', // RFC 2822 formatted date
'/(?<!%)s/' => '%s', // Seconds, with leading zeros
// S and jS moved before j - see above
'/(?<!%)t/' => 'N/A', // Number of days in the given month
'/(?<!%)T/' => 'N/A', // Timezone setting of this machine
'/(?<!%)U/' => 'N/A', // Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
'/(?<!%)w/' => '%w', // Numeric representation of the day of the week
'/(?<!%)W/' => '%v', // ISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0)
'/(?<!%)Y/' => '%Y', // A full numeric representation of a year, 4 digits
'/(?<!%)y/' => '%y', // A two digit representation of a year
'/(?<!%)z/' => 'N/A', // The day of the year (starting from 0) => MySQL starts from 1
'/(?<!%)Z/' => 'N/A', // Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive.
);
$patterns = array_keys($mapping);
$replacements = array_values($mapping);
$res = preg_replace($patterns, $replacements, $format);
return $res;
}
//function Parse($value, $options, &$errors)
function Parse($value, $field_name, &$object)
{
$options = $object->GetFieldOptions($field_name);
$dt_separator = getArrayValue($options,'date_time_separator');
if($dt_separator) $value = trim($value, $dt_separator);
if($value == '') return NULL;
//return strtotime($value);
$format = $options['format'];
if($dt_separator) $format = trim($format, $dt_separator);
$object->FieldErrors[$field_name]['params'] = Array( $this->HumanFormat($format), date($format) );
$object->FieldErrors[$field_name]['value'] = $value;
$hour = 0;
$minute = 0;
$second = 0;
$month = 1;
$day = 1;
$year = 1970;
$patterns['n'] = '([0-9]{1,2})';
$patterns['m'] = '([0-9]{1,2})';
$patterns['d'] = '([0-9]{1,2})';
$patterns['j'] = '([0-9]{1,2})';
$patterns['Y'] = '([0-9]{4})';
$patterns['y'] = '([0-9]{2})';
$patterns['G'] = '([0-9]{1,2})';
$patterns['g'] = '([0-9]{1,2})';
$patterns['H'] = '([0-9]{2})';
$patterns['h'] = '([0-9]{2})';
$patterns['i'] = '([0-9]{2})';
$patterns['s'] = '([0-9]{2})';
$patterns['a'] = '(am|pm)';
$patterns['A'] = '(AM|PM)';
$holders_mask = eregi_replace('[a-zA-Z]{1}', '([a-zA-Z]{1})', $format);
if (!ereg($holders_mask, $format, $holders)) {
$object->FieldErrors[$field_name]['pseudo'] = 'bad_date_format';
return $value;
}
$values_mask = '/^'.str_replace('/','\/',$format).'$/';
foreach ($patterns as $key => $val) {
$values_mask = ereg_replace($key, $val, $values_mask);
}
// echo " values_mask : $values_mask <br>";
if (!preg_match($values_mask, $value, $values)) {
$object->FieldErrors[$field_name]['pseudo'] = 'bad_date_format';
return $value;
}
for ($i = 1; $i < count($holders); $i++) {
switch ($holders[$i]) {
case 'n':
case 'm':
$month = $values[$i];
$month = ereg_replace("^0{1}", '', $month);
break;
case 'd':
$day = $values[$i];
$day = ereg_replace("^0{1}", '', $day);
break;
case 'Y':
$year = $values[$i];
break;
case 'y':
$year = $values[$i] >= 70 ? 1900 + $values[$i] : 2000 + $values[$i];
break;
case 'H':
case 'h':
case 'G':
case 'g':
$hour = $values[$i];
$hour = ereg_replace("^0{1}", '', $hour);
break;
case 'i':
$minute = $values[$i];
$minute = ereg_replace("^0{1}", '', $minute);
break;
case 's':
$second = $values[$i];
$second = ereg_replace("^0{1}", '', $second);
break;
case 'a':
case 'A':
if ($hour <= 12) { // if AM/PM used with 24-hour - could happen :)
if ($values[$i] == 'pm' || $values[$i] == 'PM') {
$hour += 12;
if ($hour == 24) $hour = 12;
}
elseif ($values[$i] == 'am' || $values[$i] == 'AM') {
if ($hour == 12) $hour = 0;
}
}
break;
}
}
//echo "day: $day, month: $month, year: $year, hour: $hour, minute: $minute<br>";
/*if (!($year >= 1970 && $year <= 2037)) {
$object->FieldErrors[$field_name]['pseudo'] = 'bad_date_format';
return $value;
}*/
if (!($month >= 1 && $month <= 12)) {
$object->FieldErrors[$field_name]['pseudo'] = 'bad_date_format';
return $value;
}
$months_days = Array ( 1 => 31,2 => 28, 3 => 31, 4 => 30,5 => 31,6 => 30, 7 => 31, 8 => 31,9 => 30,10 => 31,11 => 30,12 => 31);
if ($year % 4 == 0) $months_days[2] = 29;
if (!($day >=1 && $day <= $months_days[$month])) {
$object->FieldErrors[$field_name]['pseudo'] = 'bad_date_format';
return $value;
}
if (!($hour >=0 && $hour <= 23)) {
$object->FieldErrors[$field_name]['pseudo'] = 'bad_date_format';
return $value;
}
if (!($minute >=0 && $minute <= 59)) {
$object->FieldErrors[$field_name]['pseudo'] = 'bad_date_format';
return $value;
}
if (!($second >=0 && $second <= 59)) {
$object->FieldErrors[$field_name]['pseudo'] = 'bad_date_format';
return $value;
}
// echo "day: $day, month: $month, year: $year, hour: $hour, minute: $minute<br>";
return (mktime($hour, $minute, $second, $month, $day, $year));
}
function GetSample($field, &$options, &$object)
{
return $this->Format( time(), $field, $object);
}
}
class kUploadFormatter extends kFormatter
{
var $DestinationPath;
var $FullPath;
function kUploadFormatter()
{
if ($this->DestinationPath)
{
$this->FullPath = DOC_ROOT.BASE_PATH.$this->DestinationPath;
}
parent::kBase();
}
//function Parse($value, $options, &$errors)
function Parse($value, $field_name, &$object)
{
$ret = '';
$options = $object->GetFieldOptions($field_name);
if (getArrayValue($value, 'upload') && getArrayValue($value, 'error') == UPLOAD_ERR_NO_FILE)
{
return getArrayValue($value, 'upload');
}
if ( is_array($value) && $value['size'] )
{
if ( is_array($value) && $value['error'] === UPLOAD_ERR_OK )
{
if ( !in_array($value['type'], $options['allowed_types']) )
{
$object->FieldErrors[$field_name]['pseudo'] = 'bad_file_format';
}
elseif ( $value['size'] > ($options['max_size'] ? $options['max_size'] : MAX_UPLOAD_SIZE) )
{
$object->FieldErrors[$field_name]['pseudo'] = 'bad_file_size';
}
elseif ( !is_writable($this->FullPath) )
{
$object->FieldErrors[$field_name]['pseudo'] = 'cant_save_file';
}
else
{
$real_name = $this->ValidateFileName($this->FullPath, $value['name']);
$file_name = $this->FullPath.$real_name;
if ( !move_uploaded_file($value['tmp_name'], $file_name) )
{
$object->FieldErrors[$field_name]['pseudo'] = 'cant_save_file';
}
else
{
$ret = $this->DestinationPath.$real_name;
}
}
}
else
{
$object->FieldErrors[$field_name]['pseudo'] = 'cant_save_file';
}
}
if ($value['error'] && !( $value['error'] == UPLOAD_ERR_NO_FILE ) && !$object->FieldErrors[$field_name]['pseudo'])
{
$object->FieldErrors[$field_name]['pseudo'] = 'cant_save_file';
}
return $ret;
}
function ValidateFileName($path, $name)
{
$parts = pathinfo($name);
$ext = '.'.$parts['extension'];
$filename = substr($parts['basename'], 0, -strlen($ext));
$new_name = $filename.$ext;
while ( file_exists($path.'/'.$new_name) )
{
if ( preg_match("/({$filename}_)([0-9]*)($ext)/", $new_name, $regs) ) {
$new_name = $regs[1].($regs[2]+1).$regs[3];
}
else {
$new_name = $filename.'_1'.$ext;
}
}
return $new_name;
}
}
class kPictureFormatter extends kUploadFormatter
{
function kPictureFormatter()
{
$this->NakeLookupPath = IMAGES_PATH;
$this->DestinationPath = IMAGES_PENDING_PATH;
parent::kUploadFormatter();
}
}
class kMultiLanguage extends kFormatter
{
function LangFieldName($field_name)
{
$lang = $this->Application->GetVar('m_lang');
return 'l'.$lang.'_'.$field_name;
}
function PrepareOptions($field_name, &$field_options, &$object)
{
if (getArrayValue($object->Fields, $field_name, 'master_field')) return;
$lang_field_name = $this->LangFieldName($field_name);
//substitude title field
$title_field = $this->Application->getUnitOption($object->Prefix, 'TitleField');
if ($title_field == $field_name) {
$this->Application->setUnitOption($object->Prefix, 'TitleField', $lang_field_name);
}
//substitude fields
$fields = $this->Application->getUnitOption($object->Prefix, 'Fields');
if ( isset($fields[$field_name]) ) {
$fields[$lang_field_name] = $fields[$field_name];
$fields[$lang_field_name]['master_field'] = $field_name;
$object->Fields[$lang_field_name] = $fields[$lang_field_name];
$fields[$field_name]['required'] = false;
$object->Fields[$field_name]['required'] = false;
$object->VirtualFields[$field_name] = $object->Fields[$field_name];
}
$this->Application->setUnitOption($object->Prefix, 'Fields', $fields);
//substitude virtual fields
$virtual_fields = $this->Application->getUnitOption($object->Prefix, 'VirtualFields');
if ( isset($virtual_fields[$field_name]) ) {
$virtual_fields[$lang_field_name] = $virtual_fields[$field_name];
$virtual_fields[$lang_field_name]['master_field'] = $field_name;
$object->VirtualFields[$lang_field_name] = $virtual_fields[$lang_field_name];
$virtual_fields[$field_name]['required'] = false;
$object->VirtualFields[$field_name]['required'] = false;
}
$this->Application->setUnitOption($object->Prefix, 'VirtualFields', $virtual_fields);
//substitude grid fields
$grids = $this->Application->getUnitOption($object->Prefix, 'Grids');
foreach ($grids as $name => $grid) {
if ( getArrayValue($grid, 'Fields', $field_name) ) {
array_rename_key($grids[$name]['Fields'], $field_name, $lang_field_name);
}
}
$this->Application->setUnitOption($object->Prefix, 'Grids', $grids);
//substitude default sortings
$sortings = $this->Application->getUnitOption($object->Prefix, 'ListSortings');
foreach ($sortings as $special => $the_sortings) {
if (isset($the_sortings['ForcedSorting'])) {
array_rename_key($sortings[$special]['ForcedSorting'], $field_name, $lang_field_name);
}
if (isset($the_sortings['Sorting'])) {
array_rename_key($sortings[$special]['Sorting'], $field_name, $lang_field_name);
}
}
$this->Application->setUnitOption($object->Prefix, 'ListSortings', $sortings);
//TODO: substitude possible language-fields sortings after changing language
}
/*function UpdateSubFields($field, $value, &$options, &$object)
{
}
function UpdateMasterFields($field, $value, &$options, &$object)
{
}*/
function Format($value, $field_name, &$object, $format=null)
{
$master_field = getArrayValue($object->Fields, $field_name, 'master_field');
if (!$master_field) { // if THIS field is master it does NOT have reference to it's master_field
$lang = $this->Application->GetVar('m_lang');
$value = $object->GetDBField('l'.$lang.'_'.$field_name); //getting value of current language
$master_field = $field_name; // THIS is master_field
}
if ( $value == '' && $format != 'no_default') { // try to get default language value
$def_lang_value = $object->GetDBField('l'.$this->Application->GetDefaultLanguageId().'_'.$master_field);
if ($def_lang_value == '') return NULL;
return $def_lang_value; //return value from default language
}
return $value;
}
function Parse($value, $field_name, &$object)
{
$lang = $this->Application->GetVar('m_lang');
$def_lang = $this->Application->GetDefaultLanguageId();
$master_field = getArrayValue($object->Fields, $field_name, 'master_field');
if ( getArrayValue($object->Fields, $field_name, 'required') && ( (string) $value == '' ) ) {
$object->FieldErrors[$master_field]['pseudo'] = 'required';
};
if (!$this->Application->GetVar('allow_translation') && $lang != $def_lang && getArrayValue($object->Fields, $field_name, 'required')) {
$def_lang_field = 'l'.$def_lang.'_'.$master_field;
if ( !$object->ValidateRequired($def_lang_field, $object->Fields[$field_name]) ) {
$object->FieldErrors[$master_field]['pseudo'] = 'primary_lang_required';
}
}
if ($value == '') return NULL;
return $value;
}
}
class kPasswordFormatter extends kFormatter
{
function PrepareOptions($field_name, &$field_options, &$object)
{
if( isset( $field_options['verify_field'] ) )
{
$add_fields = Array();
$options = Array('master_field' => $field_name, 'formatter'=>'kPasswordFormatter');
$add_fields[ $field_options['verify_field'] ] = $options;
$add_fields[$field_name.'_plain'] = Array('type'=>'string', 'error_field'=>$field_name);
$add_fields[ $field_options['verify_field'].'_plain' ] = Array('type'=>'string', 'error_field'=>$field_options['verify_field'] );
$add_fields = array_merge_recursive2($add_fields, $object->VirtualFields);
$object->setVirtualFields($add_fields);
}
}
function Format($value, $field_name, &$object, $format=null)
{
return $value;
}
function Parse($value, $field_name, &$object)
{
$options = $object->GetFieldOptions($field_name);
$fields = Array('master_field','verify_field');
$fields_set = true;
$flip_count = 0;
while($flip_count < 2)
{
if( getArrayValue($options,$fields[0]) )
{
$object->SetDBField($field_name.'_plain', $value);
if( !getArrayValue($object->Fields[ $options[ $fields[0] ] ], $fields[1].'_set') )
{
$object->Fields[ $options[ $fields[0] ] ][$fields[1].'_set'] = true;
}
$password_field = $options[ $fields[0] ];
$verify_field = $field_name;
}
$fields = array_reverse($fields);
$flip_count++;
}
if( getArrayValue($object->Fields[$password_field], 'verify_field_set') && getArrayValue($object->Fields[$verify_field], 'master_field_set') )
{
$new_password = $object->GetDBField($password_field.'_plain');
$verify_password = $object->GetDBField($verify_field.'_plain');
if($new_password == '' && $verify_password == '')
{
if( $object->GetDBField($password_field) != $this->EncryptPassword('') )
{
return $this->EncryptPassword($value);
}
else
{
$object->Fields[$password_field.'_plain']['required'] = true;
$object->Fields[$verify_field.'_plain']['required'] = true;
return null;
}
}
$min_length = $this->Application->ConfigValue('Min_Password');
if( strlen($new_password) >= $min_length )
{
if($new_password != $verify_password)
{
$object->ErrorMsgs['passwords_do_not_match'] = $this->Application->Phrase('lu_passwords_do_not_match');
$object->FieldErrors[$password_field]['pseudo'] = 'passwords_do_not_match';
$object->FieldErrors[$verify_field]['pseudo'] = 'passwords_do_not_match';
}
}
else
{
$object->FieldErrors[$password_field]['pseudo'] = 'length_out_of_range';
$object->FieldErrors[$verify_field]['pseudo'] = 'length_out_of_range';
}
}
if($value == '') return $object->GetDBField($field_name);
return $this->EncryptPassword($value);
}
function EncryptPassword($value)
{
return md5($value);
}
}
/**
* Credit card expiration date formatter
*
*/
class kCCDateFormatter extends kFormatter
{
function PrepareOptions($field_name, &$field_options, &$object)
{
$add_fields = Array();
$i = 1;
$options = Array('00' => '');
while($i <= 12)
{
$options[ sprintf('%02d',$i) ] = sprintf('%02d',$i);
$i++;
}
$add_fields[ $field_options['month_field'] ] = Array('formatter'=>'kOptionsFormatter', 'options' => $options, 'not_null' => true, 'default' => '00');
$add_fields[ $field_options['year_field'] ] = Array('type' => 'string', 'default' => '');
$add_fields = array_merge_recursive2($add_fields, $object->VirtualFields);
$object->setVirtualFields($add_fields);
}
function UpdateSubFields($field, $value, &$options, &$object)
{
if(!$value) return false;
$date = explode('/', $value);
$object->SetDBField( $options['month_field'], $date[0] );
$object->SetDBField( $options['year_field'], $date[1] );
}
/**
* Will work in future if we could attach 2 formatters to one field
*
* @param string $value
* @param string $field_name
* @param kBase $object
* @return string
*/
function Parse($value, $field_name, &$object)
{
// if ( is_null($value) ) return '';
$options = $object->GetFieldOptions($field_name);
$month = $object->GetDirtyField($options['month_field']);
$year = $object->GetDirtyField($options['year_field']);
if( !(int)$month && !(int)$year ) return NULL;
$is_valid = ($month >= 1 && $month <= 12) && ($year >= 0 && $year <= 99);
if(!$is_valid) $object->FieldErrors[$field_name]['pseudo'] = 'bad_type';
return $month.'/'.$year;
}
}
class kUnitFormatter extends kFormatter {
function PrepareOptions($field_name, &$field_options, &$object)
{
if( !isset($field_options['master_field']) )
{
$regional =& $this->Application->recallObject('lang.current');
$add_fields = Array();
$options_a = Array('type' => 'int','error_field' => $field_name,'master_field' => $field_name,'format' => '%d','min_value_inc' => 0 );
$options_b = Array('type' => 'double','error_field' => $field_name,'master_field' => $field_name,'format' => '%0.1f','min_value_inc' => 0);
switch( $regional->GetDBField('UnitSystem') )
{
case 2: // US/UK
$field_options_copy = $field_options;
unset($field_options_copy['min_value_exc']);
$add_fields[$field_name.'_a'] = array_merge_recursive2($field_options_copy, $options_a);
$add_fields[$field_name.'_b'] = array_merge_recursive2($field_options_copy, $options_b);
break;
default:
}
$add_fields = array_merge_recursive2($add_fields, $object->VirtualFields);
$object->setVirtualFields($add_fields);
}
}
function UpdateMasterFields($field, $value, &$options, &$object)
{
if( !isset($options['master_field']) )
{
$regional =& $this->Application->recallObject('lang.current');
switch( $regional->GetDBField('UnitSystem') )
{
case 2: // US/UK
$major = $object->GetDirtyField($field.'_a');
$minor = $object->GetDirtyField($field.'_b');
if($major === '' && $minor === '')
{
$value = null;
}
elseif($major === null && $minor === null)
{
unset($object->Fields[$field]);
return;
}
else
{
$value = $major / 2 + $minor / 32;
}
break;
default:
}
$object->SetDBField($field, $value);
}
}
function UpdateSubFields($field, $value, &$options, &$object)
{
if( !isset($options['master_field']) )
{
$regional =& $this->Application->recallObject('lang.current');
switch( $regional->GetDBField('UnitSystem') )
{
case 2: // US/UK
if($value === null)
{
$major = null;
$minor = null;
}
else
{
$major = floor( $value / 0.5 );
$minor = ($value - $major * 0.5) * 32;
}
$object->SetDBField($field.'_a', $major);
$object->SetDBField($field.'_b', $minor);
break;
default:
}
}
}
- function Format($value, $field_name, &$object, $format=null)
+ /*function Format($value, $field_name, &$object, $format=null)
{
return parent::Format($value, $field_name, $object, $format);
- }
+ }*/
/* function Format($value, $field_name, &$object, $format=null)
{
if( isset($field_options['master_field']) )
{
$regional =& $this->Application->recallObject('lang.current');
switch( $regional->GetDBField('UnitSystem') )
{
case 2: // US/UK
$major = floor( $value / 0.5 );
$minor = $value - $major;
$major = $object->SetDBField($field_name.'_a', $major);
$minor = $object->SetDBField($field_name.'_b', $minor);
break;
default:
}
}
return parent::Format($value, $field_name, $object);
}*/
/*function Parse($value, $field_name, &$object)
{
$regional =& $this->Application->recallObject('lang.current');
switch($regional->GetDBField('UnitSystem'))
{
case 1: // metric
return $object->GetDBField('UnitSystem_a');
break;
case 2: // US/UK
return $object->GetDBField('UnitSystem_a') * 0.5 +
$object->GetDBField('UnitSystem_b') * 0.5 / 16;
break;
default:
}
}*/
}
?>
Property changes on: trunk/core/kernel/utility/formatters.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.9
\ No newline at end of property
+1.10
\ No newline at end of property

Event Timeline