/** * @param int $pId database Id of exiting object of this type * @param int $pContentId database Id of existing LibertyContent object */ function __construct($pId = NULL, $pContentId = NULL) { $this->mContentTypeGuid = self::CONTENT_TYPE_GUID; $this->registerContentType(self::CONTENT_TYPE_GUID, array('content_type_guid' => self::CONTENT_TYPE_GUID, 'content_name' => 'Bitweaver person data', 'content_name_plural' => 'Bitweaver persons data', 'handler_class' => 'BitPerson', 'handler_package' => 'person', 'handler_file' => 'BitPerson.php', 'maintainer_url' => 'http://www.lrcnh.com/')); // Permission setup $this->mViewContentPerm = 'p_person_view'; $this->mCreateContentPerm = 'p_person_create'; $this->mUpdateContentPerm = 'p_person_update'; $this->mAdminContentPerm = 'p_person_admin'; $this->mExpungeContentPerm = 'p_person_expunge'; // Selectable Citizenship/Country from defined list $country_options = @BitAddressCountry::getPossibles('country_name', TRUE); $country_options[0] = "Unknown"; // Unknown entry is not stored in the DB ksort($country_options); $altname_fields = array("type" => array("description" => "Type", "type" => "options", "options" => NULL, "required" => TRUE, "maxlen" => 16), "text" => array("description" => "Name", "type" => "text", "required" => TRUE, "maxlen" => 32), "note" => array("description" => "Notes", "type" => "text", "maxlen" => 32), "altname_1_id" => array("description" => "Preferred", "type" => "radio"), "remove" => array("description" => "Remove", "type" => "remove"), "altname_id" => array("type" => "hidden")); $email_fields = array("type" => array("description" => "Type", "type" => "options", "options" => NULL, "required" => TRUE, "maxlen" => 16), "text" => array("description" => "Email address", "type" => "text", "required" => TRUE, "maxlen" => 32), "note" => array("description" => "Notes", "type" => "text", "maxlen" => 32), "email_1_id" => array("description" => "Preferred", "type" => "radio", "required" => TRUE), "remove" => array("description" => "Remove", "type" => "remove"), "email_id" => array("type" => "hidden")); $phone_fields = array("type" => array("description" => "Type", "type" => "options", "options" => NULL, "required" => TRUE, "maxlen" => 16), "text" => array("description" => "Phone Number", "type" => "text", "required" => TRUE, "maxlen" => 32), "note" => array("description" => "Notes", "type" => "text", "maxlen" => 32), "phone_1_id" => array("description" => "Preferred", "type" => "radio", "required" => TRUE), "remove" => array("description" => "Remove", "type" => "remove"), "phone_id" => array("type" => "hidden")); $address_fields = array("address_id" => array("description" => "Address", "type" => "options", "options" => NULL, "required" => TRUE, "shownullopt" => TRUE, "createonly" => TRUE), "active" => array("description" => "Active", "type" => "checkbox", "defval" => "y"), "address_1_id" => array("description" => "Preferred", "type" => "radio", "required" => TRUE), "remove" => array("description" => "Remove", "type" => "remove")); $this->mFields = array("name_title" => array("description" => "Title", "type" => "options", "options" => array("" => "<none>", "Mr" => "Mr", "Mrs" => "Mrs", "Ms" => "Ms", "Miss" => "Miss")), "name_1sts" => array("description" => "First Names", "type" => "text", "maxlen" => 72, "required" => TRUE, "helptext" => "Persons legal first or forenames, used on passport, birth certificate, etc."), "name_last" => array("description" => "Last Name", "type" => "text", "maxlen" => 64, "required" => TRUE, "helptext" => "Persons legal last or surname, used on passport, birth certificate, etc."), "name_suffix" => array("description" => "Name Suffix", "type" => "text", "maxlen" => 32, "helptext" => "Any suffix text a person may have to there name, eg. Jr/Sr/II/III."), self::ALTNAME_TBL => array("description" => "Alternate names", "type" => "multiple", "fields" => $altname_fields, "idfield" => "altname_id", "sequence" => self::ALTNAME_TBL_SEQ, "helptext" => "Other names the person might be known as, or have been known as."), "gender" => array("description" => "Gender", "type" => "radios", "required" => TRUE, "options" => array("M" => "Male", "F" => "Female"), "helptext" => "Sex of the person."), "date_born" => array("description" => "Birth Date", "type" => "date", "typopt" => "past", "defval" => strtotime("-30 years"), "required" => TRUE, "helptext" => "Date the person was born."), "citizenship" => array("description" => "Citizenship", "type" => "options", "options" => &$country_options, "helptext" => "Country the person is a citizen of, for Visa purposes."), self::EMAIL_TBL => array("description" => "Email Addresses", "type" => "multiple", "fields" => $email_fields, "idfield" => "email_id", "sequence" => self::EMAIL_TBL_SEQ, "helptext" => "Internet email addresses the person can be reached at"), self::PHONE_TBL => array("description" => "Telephone Numbers", "type" => "multiple", "fields" => $phone_fields, "idfield" => "phone_id", "sequence" => self::PHONE_TBL_SEQ, "helptext" => "Numbers that can be used to reach this person"), self::ADDRESS_TBL => array("description" => "Addresses", "type" => "multiple", "fields" => $address_fields, "idfield" => "address_id", "helptext" => "Addresses for this person")); parent::__construct($pId, $pContentId, 'person', self::DATA_TBL, self::DATA_TBL_SEQ); }
<?php /** * @version $Header$ * @package address */ require_once ADDRESS_PKG_PATH . 'BitAddress.php'; $pkgname = ADDRESS_PKG_NAME; $grpname = $pkgname . '_admin'; $gBitSmarty->assign('grpname', $grpname); $list_grpname = $grpname . '_list'; $gBitSmarty->assign('list_grpname', $list_grpname); $country_grpname = $grpname . '_country'; $gBitSmarty->assign('country_grpname', $country_grpname); // Process the form if we've made some changes if (isset($_REQUEST[$grpname . '_submit'])) { LibertyForm::storeConfigs($_REQUEST[$list_grpname], $pkgname); @BitAddressCountry::setDefault($_REQUEST[$country_grpname]['country_def']); @BitAddressCountry::setActive($_REQUEST[$country_grpname]['countries']); } $list_fields = array("list_country" => array('description' => 'Country', 'helptext' => 'Display the country.', 'type' => 'checkbox', 'value' => $gBitSystem->getConfig($pkgname . '_list_country')), "list_description" => array('description' => 'Description', 'helptext' => 'Display the address description field.', 'type' => 'checkbox', 'value' => $gBitSystem->getConfig($pkgname . '_list_description'))); $gBitSmarty->assign('list_fields', $list_fields); $countries = @BitAddressCountry::getPossibles('country_name'); $country_fields = array("country_def" => array("description" => "Default Country", "type" => "options", "options" => $countries, "value" => @BitAddressCountry::getDefault(), "required" => TRUE, "helptext" => "This selects the country that is selected by default when a new address is created."), "countries" => array("description" => "Available Countries", "type" => "options", "typopt" => "multiple", "options" => $countries, "value" => array_keys(BitAddressCountry::getPossibles('isocode2', TRUE)), "required" => TRUE, "helptext" => "Select the multiple countries available by holding down Shift/Ctrl.")); $gBitSmarty->assign_by_ref('country_fields', $country_fields);
<?php /** * @version $Header$ * @package address */ global $gBitInstaller; require_once ADDRESS_PKG_PATH . 'BitAddress.php'; require_once ADDRESS_PKG_PATH . 'BitAddressCountry.php'; $gBitInstaller->registerPackageInfo(ADDRESS_PKG_NAME, array('description' => "This package is to store and manipulate location address data.", 'license' => '<a href="http://www.gnu.org/licenses/licenses.html#LGPL">LGPL</a>')); // Get definition of DB tables used by this packages objects. $tables = array_merge(BitAddress::getSchemaTables(), BitAddressCountry::getSchemaTables()); foreach (array_keys($tables) as $tableName) { $gBitInstaller->registerSchemaTable(ADDRESS_PKG_NAME, $tableName, $tables[$tableName]); } // $indices = array(); // $gBitInstaller->registerSchemaIndexes(ADDRESS_PKG_NAME, $indices); // Sequences $gBitInstaller->registerSchemaSequences(ADDRESS_PKG_NAME, array_merge(BitAddress::getSchemaSequences(), BitAddressCountry::getSchemaSequences())); $country_table = BIT_DB_PREFIX . BitAddressCountry::DATA_TBL; $fields_table = BIT_DB_PREFIX . BitAddress::FIELDS_TBL; // Schema defaults $gBitInstaller->registerSchemaDefault(ADDRESS_PKG_NAME, array("INSERT INTO `" . $country_table . "` VALUES(1,'Afghanistan', 'AF', 'AFG', '4', 'y')", "INSERT INTO `" . $country_table . "` VALUES(2,'Albania', 'AL', 'ALB', '8', 'y')", "INSERT INTO `" . $country_table . "` VALUES(3,'Algeria', 'DZ', 'DZA', '12', 'y')", "INSERT INTO `" . $country_table . "` VALUES(4,'American Samoa', 'AS', 'ASM', '16', 'y')", "INSERT INTO `" . $country_table . "` VALUES(5,'Andorra', 'AD', 'AND', '20', 'y')", "INSERT INTO `" . $country_table . "` VALUES(6,'Angola', 'AO', 'AGO', '24', 'y')", "INSERT INTO `" . $country_table . "` VALUES(7,'Anguilla', 'AI', 'AIA', '660', 'y')", "INSERT INTO `" . $country_table . "` VALUES(8,'Antarctica', 'AQ', 'ATA', '10', 'y')", "INSERT INTO `" . $country_table . "` VALUES(9,'Antigua and Barbuda', 'AG', 'ATG', '28', 'y')", "INSERT INTO `" . $country_table . "` VALUES(10,'Argentina', 'AR', 'ARG', '32', 'y')", "INSERT INTO `" . $country_table . "` VALUES(11,'Armenia', 'AM', 'ARM', '51', 'y')", "INSERT INTO `" . $country_table . "` VALUES(12,'Aruba', 'AW', 'ABW', '533', 'y')", "INSERT INTO `" . $country_table . "` VALUES(13,'Australia', 'AU', 'AUS', '36', 'y')", "INSERT INTO `" . $country_table . "` VALUES(14,'Austria', 'AT', 'AUT', '40', 'y')", "INSERT INTO `" . $country_table . "` VALUES(15,'Azerbaijan', 'AZ', 'AZE', '31', 'y')", "INSERT INTO `" . $country_table . "` VALUES(16,'Bahamas', 'BS', 'BHS', '44', 'y')", "INSERT INTO `" . $country_table . "` VALUES(17,'Bahrain', 'BH', 'BHR', '48', 'y')", "INSERT INTO `" . $country_table . "` VALUES(18,'Bangladesh', 'BD', 'BGD', '50', 'y')", "INSERT INTO `" . $country_table . "` VALUES(19,'Barbados', 'BB', 'BRB', '52', 'y')", "INSERT INTO `" . $country_table . "` VALUES(20,'Belarus', 'BY', 'BLR', '112', 'y')", "INSERT INTO `" . $country_table . "` VALUES(21,'Belgium', 'BE', 'BEL', '56', 'y')", "INSERT INTO `" . $country_table . "` VALUES(22,'Belize', 'BZ', 'BLZ', '84', 'y')", "INSERT INTO `" . $country_table . "` VALUES(23,'Benin', 'BJ', 'BEN', '204', 'y')", "INSERT INTO `" . $country_table . "` VALUES(24,'Bermuda', 'BM', 'BMU', '60', 'y')", "INSERT INTO `" . $country_table . "` VALUES(25,'Bhutan', 'BT', 'BTN', '64', 'y')", "INSERT INTO `" . $country_table . "` VALUES(26,'Bolivia', 'BO', 'BOL', '68', 'y')", "INSERT INTO `" . $country_table . "` VALUES(27,'Bosnia and Herzegowina', 'BA', 'BIH', '70', 'y')", "INSERT INTO `" . $country_table . "` VALUES(28,'Botswana', 'BW', 'BWA', '72', 'y')", "INSERT INTO `" . $country_table . "` VALUES(29,'Bouvet Island', 'BV', 'BVT', '74', 'y')", "INSERT INTO `" . $country_table . "` VALUES(30,'Brazil', 'BR', 'BRA', '76', 'y')", "INSERT INTO `" . $country_table . "` VALUES(31,'British Indian Ocean Territory', 'IO', 'IOT', '86', 'y')", "INSERT INTO `" . $country_table . "` VALUES(32,'Brunei Darussalam', 'BN', 'BRN', '96', 'y')", "INSERT INTO `" . $country_table . "` VALUES(33,'Bulgaria', 'BG', 'BGR', '100', 'y')", "INSERT INTO `" . $country_table . "` VALUES(34,'Burkina Faso', 'BF', 'BFA', '854', 'y')", "INSERT INTO `" . $country_table . "` VALUES(35,'Burundi', 'BI', 'BDI', '108', 'y')", "INSERT INTO `" . $country_table . "` VALUES(36,'Cambodia', 'KH', 'KHM', '116', 'y')", "INSERT INTO `" . $country_table . "` VALUES(37,'Cameroon', 'CM', 'CMR', '120', 'y')", "INSERT INTO `" . $country_table . "` VALUES(38,'Canada', 'CA', 'CAN', '124', 'y')", "INSERT INTO `" . $country_table . "` VALUES(39,'Cape Verde', 'CV', 'CPV', '132', 'y')", "INSERT INTO `" . $country_table . "` VALUES(40,'Cayman Islands', 'KY', 'CYM', '136', 'y')", "INSERT INTO `" . $country_table . "` VALUES(41,'Central African Republic', 'CF', 'CAF', '140', 'y')", "INSERT INTO `" . $country_table . "` VALUES(42,'Chad', 'TD', 'TCD', '148', 'y')", "INSERT INTO `" . $country_table . "` VALUES(43,'Chile', 'CL', 'CHL', '152', 'y')", "INSERT INTO `" . $country_table . "` VALUES(44,'China', 'CN', 'CHN', '156', 'y')", "INSERT INTO `" . $country_table . "` VALUES(45,'Christmas Island', 'CX', 'CXR', '162', 'y')", "INSERT INTO `" . $country_table . "` VALUES(46,'Cocos (Keeling) Islands', 'CC', 'CCK', '166', 'y')", "INSERT INTO `" . $country_table . "` VALUES(47,'Colombia', 'CO', 'COL', '170', 'y')", "INSERT INTO `" . $country_table . "` VALUES(48,'Comoros', 'KM', 'COM', '174', 'y')", "INSERT INTO `" . $country_table . "` VALUES(49,'Congo', 'CG', 'COG', '178', 'y')", "INSERT INTO `" . $country_table . "` VALUES(50,'Cook Islands', 'CK', 'C*K', '184', 'y')", "INSERT INTO `" . $country_table . "` VALUES(51,'Costa Rica', 'CR', 'CRI', '188', 'y')", "INSERT INTO `" . $country_table . "` VALUES(52,'Cote D''Ivoire', 'CI', 'CIV', '384', 'y')", "INSERT INTO `" . $country_table . "` VALUES(53,'Croatia', 'HR', 'HRV', '191', 'y')", "INSERT INTO `" . $country_table . "` VALUES(55,'Cyprus', 'CY', 'CYP', '196', 'y')", "INSERT INTO `" . $country_table . "` VALUES(54,'Cuba', 'CU', 'CUB', '203', 'y')", "INSERT INTO `" . $country_table . "` VALUES(56,'Czech Republic', 'CZ', 'CZE', '203', 'y')", "INSERT INTO `" . $country_table . "` VALUES(57,'Denmark', 'DK', 'DNK', '208', 'y')", "INSERT INTO `" . $country_table . "` VALUES(58,'Djibouti', 'DJ', 'DJI', '262', 'y')", "INSERT INTO `" . $country_table . "` VALUES(59,'Dominica', 'DM', 'DMA', '212', 'y')", "INSERT INTO `" . $country_table . "` VALUES(60,'Dominican Republic', 'DO', 'DOM', '214', 'y')", "INSERT INTO `" . $country_table . "` VALUES(61,'East Timor', 'TP', 'TMP', '626', 'y')", "INSERT INTO `" . $country_table . "` VALUES(62,'Ecuador', 'EC', 'ECU', '218', 'y')", "INSERT INTO `" . $country_table . "` VALUES(63,'Egypt', 'EG', 'EGY', '818', 'y')", "INSERT INTO `" . $country_table . "` VALUES(64,'El Salvador', 'SV', 'SLV', '222', 'y')", "INSERT INTO `" . $country_table . "` VALUES(65,'Equatorial Guinea', 'GQ', 'GNQ', '226', 'y')", "INSERT INTO `" . $country_table . "` VALUES(66,'Eritrea', 'ER', 'ERI', '232', 'y')", "INSERT INTO `" . $country_table . "` VALUES(67,'Estonia', 'EE', 'EST', '233', 'y')", "INSERT INTO `" . $country_table . "` VALUES(68,'Ethiopia', 'ET', 'ETH', '231', 'y')", "INSERT INTO `" . $country_table . "` VALUES(69,'Falkland Islands (Malvinas)', 'FK', 'FLK', '238', 'y')", "INSERT INTO `" . $country_table . "` VALUES(70,'Faroe Islands', 'FO', 'FRO', '234', 'y')", "INSERT INTO `" . $country_table . "` VALUES(71,'Fiji', 'FJ', 'FJI', '242', 'y')", "INSERT INTO `" . $country_table . "` VALUES(72,'Finland', 'FI', 'FIN', '246', 'y')", "INSERT INTO `" . $country_table . "` VALUES(74,'France, Metropolitan', 'FX', 'FXX', '249', 'y')", "INSERT INTO `" . $country_table . "` VALUES(73,'France', 'FR', 'FRA', '250', 'y')", "INSERT INTO `" . $country_table . "` VALUES(75,'French Guiana', 'GF', 'GUF', '254', 'y')", "INSERT INTO `" . $country_table . "` VALUES(76,'French Polynesia', 'PF', 'PYF', '258', 'y')", "INSERT INTO `" . $country_table . "` VALUES(77,'French Southern Territories', 'TF', 'ATF', '260', 'y')", "INSERT INTO `" . $country_table . "` VALUES(78,'Gabon', 'GA', 'GAB', '266', 'y')", "INSERT INTO `" . $country_table . "` VALUES(79,'Gambia', 'GM', 'GMB', '270', 'y')", "INSERT INTO `" . $country_table . "` VALUES(80,'Georgia', 'GE', 'GEO', '268', 'y')", "INSERT INTO `" . $country_table . "` VALUES(81,'Germany', 'DE', 'DEU', '276', 'y')", "INSERT INTO `" . $country_table . "` VALUES(82,'Ghana', 'GH', 'GHA', '288', 'y')", "INSERT INTO `" . $country_table . "` VALUES(83,'Gibraltar', 'GI', 'GIB', '292', 'y')", "INSERT INTO `" . $country_table . "` VALUES(84,'Greece', 'GR', 'GRC', '300', 'y')", "INSERT INTO `" . $country_table . "` VALUES(85,'Greenland', 'GL', 'GRL', '304', 'y')", "INSERT INTO `" . $country_table . "` VALUES(86,'Grenada', 'GD', 'GRD', '308', 'y')", "INSERT INTO `" . $country_table . "` VALUES(87,'Guadeloupe', 'GP', 'GLP', '312', 'y')", "INSERT INTO `" . $country_table . "` VALUES(88,'Guam', 'GU', 'GUM', '316', 'y')", "INSERT INTO `" . $country_table . "` VALUES(89,'Guatemala', 'GT', 'GTM', '320', 'y')", "INSERT INTO `" . $country_table . "` VALUES(90,'Guinea', 'GN', 'GIN', '324', 'y')", "INSERT INTO `" . $country_table . "` VALUES(91,'Guinea-bissau', 'GW', 'GNB', '624', 'y')", "INSERT INTO `" . $country_table . "` VALUES(92,'Guyana', 'GY', 'GUY', '328', 'y')", "INSERT INTO `" . $country_table . "` VALUES(93,'Haiti', 'HT', 'HTI', '332', 'y')", "INSERT INTO `" . $country_table . "` VALUES(94,'Heard and Mc Donald Islands', 'HM', 'HMD', '334', 'y')", "INSERT INTO `" . $country_table . "` VALUES(95,'Honduras', 'HN', 'HND', '340', 'y')", "INSERT INTO `" . $country_table . "` VALUES(96,'Hong Kong', 'HK', 'HKG', '344', 'y')", "INSERT INTO `" . $country_table . "` VALUES(97,'Hungary', 'HU', 'HUN', '348', 'y')", "INSERT INTO `" . $country_table . "` VALUES(98,'Iceland', 'IS', 'ISL', '352', 'y')", "INSERT INTO `" . $country_table . "` VALUES(99,'India', 'IN', 'IND', '356', 'y')", "INSERT INTO `" . $country_table . "` VALUES(100,'Indonesia', 'ID', 'IDN', '360', 'y')", "INSERT INTO `" . $country_table . "` VALUES(101,'Iran (Islamic Republic of)', 'IR', 'IRN', '364', 'y')", "INSERT INTO `" . $country_table . "` VALUES(102,'Iraq', 'IQ', 'IRQ', '368', 'y')", "INSERT INTO `" . $country_table . "` VALUES(103,'Ireland', 'IE', 'IRL', '372', 'y')", "INSERT INTO `" . $country_table . "` VALUES(104,'Israel', 'IL', 'ISR', '376', 'y')", "INSERT INTO `" . $country_table . "` VALUES(105,'Italy', 'IT', 'ITA', '380', 'y')", "INSERT INTO `" . $country_table . "` VALUES(106,'Jamaica', 'JM', 'JAM', '388', 'y')", "INSERT INTO `" . $country_table . "` VALUES(107,'Japan', 'JP', 'JPN', '392', 'y')", "INSERT INTO `" . $country_table . "` VALUES(108,'Jordan', 'JO', 'JOR', '400', 'y')", "INSERT INTO `" . $country_table . "` VALUES(109,'Kazakhstan', 'KZ', 'KAZ', '398', 'y')", "INSERT INTO `" . $country_table . "` VALUES(110,'Kenya', 'KE', 'KEN', '404', 'y')", "INSERT INTO `" . $country_table . "` VALUES(111,'Kiribati', 'KI', 'KIR', '296', 'y')", "INSERT INTO `" . $country_table . "` VALUES(112,'Korea, Democratic People''s Republic of', 'KP', 'PRK', '408', 'y')", "INSERT INTO `" . $country_table . "` VALUES(113,'Korea, Republic of', 'KR', 'KOR', '410', 'y')", "INSERT INTO `" . $country_table . "` VALUES(114,'Kuwait', 'KW', 'KWT', '414', 'y')", "INSERT INTO `" . $country_table . "` VALUES(115,'Kyrgyzstan', 'KG', 'KGZ', '417', 'y')", "INSERT INTO `" . $country_table . "` VALUES(116,'Lao People''s Democratic Republic', 'LA', 'LAO', '418', 'y')", "INSERT INTO `" . $country_table . "` VALUES(117,'Latvia', 'LV', 'LVA', '428', 'y')", "INSERT INTO `" . $country_table . "` VALUES(118,'Lebanon', 'LB', 'LBN', '422', 'y')", "INSERT INTO `" . $country_table . "` VALUES(119,'Lesotho', 'LS', 'LSO', '426', 'y')", "INSERT INTO `" . $country_table . "` VALUES(120,'Liberia', 'LR', 'LBR', '430', 'y')", "INSERT INTO `" . $country_table . "` VALUES(121,'Libyan Arab Jamahiriya', 'LY', 'LBY', '434', 'y')", "INSERT INTO `" . $country_table . "` VALUES(122,'Liechtenstein', 'LI', 'LIE', '438', 'y')", "INSERT INTO `" . $country_table . "` VALUES(123,'Lithuania', 'LT', 'LTU', '440', 'y')", "INSERT INTO `" . $country_table . "` VALUES(124,'Luxembourg', 'LU', 'LUX', '442', 'y')", "INSERT INTO `" . $country_table . "` VALUES(125,'Macau', 'MO', 'MAC', '446', 'y')", "INSERT INTO `" . $country_table . "` VALUES(126,'Macedonia, The Former Yugoslav Republic of', 'MK', 'MKD', '807', 'y')", "INSERT INTO `" . $country_table . "` VALUES(127,'Madagascar', 'MG', 'MDG', '450', 'y')", "INSERT INTO `" . $country_table . "` VALUES(128,'Malawi', 'MW', 'MWI', '454', 'y')", "INSERT INTO `" . $country_table . "` VALUES(129,'Malaysia', 'MY', 'MYS', '458', 'y')", "INSERT INTO `" . $country_table . "` VALUES(130,'Maldives', 'MV', 'MDV', '462', 'y')", "INSERT INTO `" . $country_table . "` VALUES(131,'Mali', 'ML', 'MLI', '466', 'y')", "INSERT INTO `" . $country_table . "` VALUES(132,'Malta', 'MT', 'MLT', '470', 'y')", "INSERT INTO `" . $country_table . "` VALUES(133,'Marshall Islands', 'MH', 'MHL', '584', 'y')", "INSERT INTO `" . $country_table . "` VALUES(134,'Martinique', 'MQ', 'MTQ', '474', 'y')", "INSERT INTO `" . $country_table . "` VALUES(135,'Mauritania', 'MR', 'MRT', '478', 'y')", "INSERT INTO `" . $country_table . "` VALUES(136,'Mauritius', 'MU', 'MUS', '480', 'y')", "INSERT INTO `" . $country_table . "` VALUES(137,'Mayotte', 'YT', 'MYT', '175', 'y')", "INSERT INTO `" . $country_table . "` VALUES(138,'Mexico', 'MX', 'MEX', '484', 'y')", "INSERT INTO `" . $country_table . "` VALUES(139,'Micronesia, Federated States of', 'FM', 'FSM', '583', 'y')", "INSERT INTO `" . $country_table . "` VALUES(140,'Moldova, Republic of', 'MD', 'MDA', '498', 'y')", "INSERT INTO `" . $country_table . "` VALUES(141,'Monaco', 'MC', 'MCO', '492', 'y')", "INSERT INTO `" . $country_table . "` VALUES(142,'Mongolia', 'MN', 'MNG', '496', 'y')", "INSERT INTO `" . $country_table . "` VALUES(143,'Montserrat', 'MS', 'MSR', '500', 'y')", "INSERT INTO `" . $country_table . "` VALUES(144,'Morocco', 'MA', 'MAR', '504', 'y')", "INSERT INTO `" . $country_table . "` VALUES(145,'Mozambique', 'MZ', 'MOZ', '508', 'y')", "INSERT INTO `" . $country_table . "` VALUES(146,'Myanmar', 'MM', 'MMR', '104', 'y')", "INSERT INTO `" . $country_table . "` VALUES(147,'Namibia', 'NA', 'NAM', '516', 'y')", "INSERT INTO `" . $country_table . "` VALUES(148,'Nauru', 'NR', 'NRU', '520', 'y')", "INSERT INTO `" . $country_table . "` VALUES(149,'Nepal', 'NP', 'NPL', '524', 'y')", "INSERT INTO `" . $country_table . "` VALUES(150,'Netherlands', 'NL', 'NLD', '528', 'y')", "INSERT INTO `" . $country_table . "` VALUES(151,'Netherlands Antilles', 'AN', 'ANT', '530', 'y')", "INSERT INTO `" . $country_table . "` VALUES(152,'New Caledonia', 'NC', 'NCL', '540', 'y')", "INSERT INTO `" . $country_table . "` VALUES(153,'New Zealand', 'NZ', 'NZL', '554', 'y')", "INSERT INTO `" . $country_table . "` VALUES(154,'Nicaragua', 'NI', 'NIC', '558', 'y')", "INSERT INTO `" . $country_table . "` VALUES(155,'Niger', 'NE', 'NER', '562', 'y')", "INSERT INTO `" . $country_table . "` VALUES(156,'Nigeria', 'NG', 'NGA', '566', 'y')", "INSERT INTO `" . $country_table . "` VALUES(157,'Niue', 'NU', 'NIU', '570', 'y')", "INSERT INTO `" . $country_table . "` VALUES(158,'Norfolk Island', 'NF', 'NFK', '574', 'y')", "INSERT INTO `" . $country_table . "` VALUES(159,'Northern Mariana Islands', 'MP', 'MNP', '580', 'y')", "INSERT INTO `" . $country_table . "` VALUES(160,'Norway', 'NO', 'NOR', '578', 'y')", "INSERT INTO `" . $country_table . "` VALUES(161,'Oman', 'OM', 'OMN', '512', 'y')", "INSERT INTO `" . $country_table . "` VALUES(162,'Pakistan', 'PK', 'PAK', '586', 'y')", "INSERT INTO `" . $country_table . "` VALUES(163,'Palau', 'PW', 'PLW', '585', 'y')", "INSERT INTO `" . $country_table . "` VALUES(164,'Panama', 'PA', 'PAN', '591', 'y')", "INSERT INTO `" . $country_table . "` VALUES(165,'Papua New Guinea', 'PG', 'PNG', '598', 'y')", "INSERT INTO `" . $country_table . "` VALUES(166,'Paraguay', 'PY', 'PRY', '600', 'y')", "INSERT INTO `" . $country_table . "` VALUES(167,'Peru', 'PE', 'PER', '604', 'y')", "INSERT INTO `" . $country_table . "` VALUES(168,'Philippines', 'PH', 'PHL', '608', 'y')", "INSERT INTO `" . $country_table . "` VALUES(169,'Pitcairn', 'PN', 'PCN', '612', 'y')", "INSERT INTO `" . $country_table . "` VALUES(170,'Poland', 'PL', 'POL', '616', 'y')", "INSERT INTO `" . $country_table . "` VALUES(171,'Portugal', 'PT', 'PRT', '620', 'y')", "INSERT INTO `" . $country_table . "` VALUES(172,'Puerto Rico', 'PR', 'PRI', '630', 'y')", "INSERT INTO `" . $country_table . "` VALUES(173,'Qatar', 'QA', 'QAT', '634', 'y')", "INSERT INTO `" . $country_table . "` VALUES(174,'Reunion', 'RE', 'REU', '638', 'y')", "INSERT INTO `" . $country_table . "` VALUES(175,'Romania', 'RO', 'ROM', '642', 'y')", "INSERT INTO `" . $country_table . "` VALUES(176,'Russian Federation', 'RU', 'RUS', '643', 'y')", "INSERT INTO `" . $country_table . "` VALUES(177,'Rwanda', 'RW', 'RWA', '646', 'y')", "INSERT INTO `" . $country_table . "` VALUES(178,'Saint Kitts and Nevis', 'KN', 'KNA', '659', 'y')", "INSERT INTO `" . $country_table . "` VALUES(179,'Saint Lucia', 'LC', 'LCA', '662', 'y')", "INSERT INTO `" . $country_table . "` VALUES(180,'Saint Vincent and the Grenadines', 'VC', 'VCT', '670', 'y')", "INSERT INTO `" . $country_table . "` VALUES(181,'Samoa', 'WS', 'WSM', '882', 'y')", "INSERT INTO `" . $country_table . "` VALUES(182,'San Marino', 'SM', 'SMR', '674', 'y')", "INSERT INTO `" . $country_table . "` VALUES(183,'Sao Tome and Principe', 'ST', 'STP', '678', 'y')", "INSERT INTO `" . $country_table . "` VALUES(184,'Saudi Arabia', 'SA', 'SAU', '682', 'y')", "INSERT INTO `" . $country_table . "` VALUES(185,'Senegal', 'SN', 'SEN', '686', 'y')", "INSERT INTO `" . $country_table . "` VALUES(186,'Seychelles', 'SC', 'SYC', '690', 'y')", "INSERT INTO `" . $country_table . "` VALUES(187,'Sierra Leone', 'SL', 'SLE', '694', 'y')", "INSERT INTO `" . $country_table . "` VALUES(188,'Singapore', 'SG', 'SGP', '702', 'y')", "INSERT INTO `" . $country_table . "` VALUES(189,'Slovakia (Slovak Republic)', 'SK', 'SVK', '703', 'y')", "INSERT INTO `" . $country_table . "` VALUES(190,'Slovenia', 'SI', 'SVN', '705', 'y')", "INSERT INTO `" . $country_table . "` VALUES(191,'Solomon Islands', 'SB', 'SLB', '90', 'y')", "INSERT INTO `" . $country_table . "` VALUES(192,'Somalia', 'SO', 'SOM', '706', 'y')", "INSERT INTO `" . $country_table . "` VALUES(193,'South Africa', 'ZA', 'ZAF', '710', 'y')", "INSERT INTO `" . $country_table . "` VALUES(194,'South Georgia and the South Sandwich Islands', 'GS', 'SGS', '239', 'y')", "INSERT INTO `" . $country_table . "` VALUES(195,'Spain', 'ES', 'ESP', '724', 'y')", "INSERT INTO `" . $country_table . "` VALUES(196,'Sri Lanka', 'LK', 'LKA', '144', 'y')", "INSERT INTO `" . $country_table . "` VALUES(197,'St. Helena', 'SH', 'SHN', '654', 'y')", "INSERT INTO `" . $country_table . "` VALUES(198,'St. Pierre and Miquelon', 'PM', 'SPM', '666', 'y')", "INSERT INTO `" . $country_table . "` VALUES(199,'Sudan', 'SD', 'SDN', '736', 'y')", "INSERT INTO `" . $country_table . "` VALUES(200,'Suriname', 'SR', 'SUR', '740', 'y')", "INSERT INTO `" . $country_table . "` VALUES(201,'Svalbard and Jan Mayen Islands', 'SJ', 'SJM', '744', 'y')", "INSERT INTO `" . $country_table . "` VALUES(202,'Swaziland', 'SZ', 'SWZ', '748', 'y')", "INSERT INTO `" . $country_table . "` VALUES(203,'Sweden', 'SE', 'SWE', '752', 'y')", "INSERT INTO `" . $country_table . "` VALUES(204,'Switzerland', 'CH', 'CHE', '756', 'y')", "INSERT INTO `" . $country_table . "` VALUES(205,'Syrian Arab Republic', 'SY', 'SYR', '760', 'y')", "INSERT INTO `" . $country_table . "` VALUES(206,'Taiwan', 'TW', 'TWN', '158', 'y')", "INSERT INTO `" . $country_table . "` VALUES(207,'Tajikistan', 'TJ', 'TJK', '762', 'y')", "INSERT INTO `" . $country_table . "` VALUES(208,'Tanzania, United Republic of', 'TZ', 'TZA', '834', 'y')", "INSERT INTO `" . $country_table . "` VALUES(209,'Thailand', 'TH', 'THA', '764', 'y')", "INSERT INTO `" . $country_table . "` VALUES(210,'Togo', 'TG', 'TGO', '768', 'y')", "INSERT INTO `" . $country_table . "` VALUES(211,'Tokelau', 'TK', 'TKL', '772', 'y')", "INSERT INTO `" . $country_table . "` VALUES(212,'Tonga', 'TO', 'TON', '776', 'y')", "INSERT INTO `" . $country_table . "` VALUES(213,'Trinidad and Tobago', 'TT', 'TTO', '780', 'y')", "INSERT INTO `" . $country_table . "` VALUES(214,'Tunisia', 'TN', 'TUN', '788', 'y')", "INSERT INTO `" . $country_table . "` VALUES(215,'Turkey', 'TR', 'TUR', '792', 'y')", "INSERT INTO `" . $country_table . "` VALUES(216,'Turkmenistan', 'TM', 'TKM', '795', 'y')", "INSERT INTO `" . $country_table . "` VALUES(217,'Turks and Caicos Islands', 'TC', 'TCA', '796', 'y')", "INSERT INTO `" . $country_table . "` VALUES(218,'Tuvalu', 'TV', 'TUV', '798', 'y')", "INSERT INTO `" . $country_table . "` VALUES(219,'Uganda', 'UG', 'UGA', '800', 'y')", "INSERT INTO `" . $country_table . "` VALUES(220,'Ukraine', 'UA', 'UKR', '804', 'y')", "INSERT INTO `" . $country_table . "` VALUES(221,'United Arab Emirates', 'AE', 'ARE', '784', 'y')", "INSERT INTO `" . $country_table . "` VALUES(222,'United Kingdom', 'GB', 'GBR', '826', 'y')", "INSERT INTO `" . $country_table . "` VALUES(223,'United States', 'US', 'USA', '840', 'y')", "INSERT INTO `" . $country_table . "` VALUES(224,'United States Minor Outlying Islands', 'UM', 'UMI', '581', 'y')", "INSERT INTO `" . $country_table . "` VALUES(225,'Uruguay', 'UY', 'URY', '858', 'y')", "INSERT INTO `" . $country_table . "` VALUES(226,'Uzbekistan', 'UZ', 'UZB', '860', 'y')", "INSERT INTO `" . $country_table . "` VALUES(227,'Vanuatu', 'VU', 'VUT', '548', 'y')", "INSERT INTO `" . $country_table . "` VALUES(228,'Vatican City State (Holy See)', 'VA', 'VAT', '336', 'y')", "INSERT INTO `" . $country_table . "` VALUES(229,'Venezuela', 'VE', 'VEN', '862', 'y')", "INSERT INTO `" . $country_table . "` VALUES(230,'Viet Nam', 'VN', 'VNM', '704', 'y')", "INSERT INTO `" . $country_table . "` VALUES(231,'Virgin Islands (British)', 'VG', 'VGB', '92', 'y')", "INSERT INTO `" . $country_table . "` VALUES(232,'Virgin Islands (U.S.)', 'VI', 'VIR', '850', 'y')", "INSERT INTO `" . $country_table . "` VALUES(233,'Wallis and Futuna Islands', 'WF', 'WLF', '876', 'y')", "INSERT INTO `" . $country_table . "` VALUES(234,'Western Sahara', 'EH', 'ESH', '732', 'y')", "INSERT INTO `" . $country_table . "` VALUES(235,'Yemen', 'YE', 'YEM', '887', 'y')", "INSERT INTO `" . $country_table . "` VALUES(237,'Zaire', 'ZR', 'ZAR', '180', 'y')", "INSERT INTO `" . $country_table . "` VALUES(238,'Zambia', 'ZM', 'ZMB', '894', 'y')", "INSERT INTO `" . $country_table . "` VALUES(239,'Zimbabwe', 'ZW', 'ZWE', '716', 'y')", "INSERT INTO `" . $fields_table . "` values('country_id',0,'Country',NULL,'options',NULL,0,'C,BitAddressCountry,country_name,y',NULL,'y',NULL, 1)", "INSERT INTO `" . $fields_table . "` VALUES('postcode',0,'Postal Code','Country assigned code for address (ZIP, postcode, ...)','text','',16,'','','n','',10)", "INSERT INTO `" . $fields_table . "` VALUES('region',0,'Region','Area of country for address (State, County, ...)','text','',64,'','','n','',20)", "INSERT INTO `" . $fields_table . "` VALUES('town',0,'Town/City','Name of urban area address located in','text','',64,'','','n','',30)", "INSERT INTO `" . $fields_table . "` VALUES('street2',0,'Street Extra','Any additional location data','text','',64,'','','n','',40)", "INSERT INTO `" . $fields_table . "` VALUES('street1',0,'Street Address','Location name/number and street name','text','',64,'','','n','',50)", "INSERT INTO `" . $fields_table . "` VALUES('type_bits',0,'Location Type','Uses of this location','checkboxes','',0,'0,Business,Home','','n','',60)", "INSERT INTO `" . $fields_table . "` VALUES('delivery_bits',0,'Delivery Options','Types of delivery accepted at location','checkboxes','',0,'0,Carrier,Post','','n','',70)", "INSERT INTO `" . $fields_table . "` VALUES('postcode',222,'Postcode','UK postal code, 5-8 alphanumerics with space in middle','text','',16,'','','n','',NULL)", "INSERT INTO `" . $fields_table . "` VALUES('postcode',223,'ZIP code','US postal code, 5digits followed by optional -4digits','text','',16,'','','n','',NULL)", "INSERT INTO `" . $fields_table . "` VALUES('region',222,'County','UK Postal County name','text','',64,'','','n','',NULL)", "INSERT INTO `" . $fields_table . "` VALUES('region',223,'State','US State, as 2 letter abbreviation or in full','text','',64,'','','n','',NULL)", "INSERT INTO `" . $fields_table . "` VALUES('town',222,'Town','Town or City locality name in the UK','text','',64,'','','n','',NULL)", "INSERT INTO `" . $fields_table . "` VALUES('town',223,'City','Name of urban area in the US','text','',64,'','','n','',NULL)")); // User Permissions $gBitInstaller->registerUserPermissions(ADDRESS_PKG_NAME, array(array('p_address_admin', 'Can admin address', 'admin', ADDRESS_PKG_NAME), array('p_address_update', 'Can update any address entry', 'editors', ADDRESS_PKG_NAME), array('p_address_create', 'Can create a address entry', 'registered', ADDRESS_PKG_NAME), array('p_address_view', 'Can view address data', 'basic', ADDRESS_PKG_NAME), array('p_address_expunge', 'Can delete any address entry', 'admin', ADDRESS_PKG_NAME))); // Default Preferences $gBitInstaller->registerPreferences(ADDRESS_PKG_NAME, array(array(ADDRESS_PKG_NAME, 'address_default_ordering', 'address_id_desc'), array(ADDRESS_PKG_NAME, 'address_list_country', 'y'), array(ADDRESS_PKG_NAME, 'address_list_description', 'y'), array(ADDRESS_PKG_NAME, 'address_country_default', 223))); // Version - now use upgrades dir to set package version number. // $gBitInstaller->registerPackageVersion( ADDRESS_PKG_NAME, '0.1.0' ); // Requirements $gBitInstaller->registerRequirements(ADDRESS_PKG_NAME, array('liberty' => array('min' => '2.1.0'), 'libertyform' => array('min' => '0.1.0'), 'kernel' => array('min' => '2.0.0'), 'themes' => array('min' => '2.0.0'), 'languages' => array('min' => '2.0.0')));
if (!empty($_REQUEST['address_id']) || !empty($_REQUEST['content_id'])) { if (!$gContent->isValid()) { // If the content failed to load $gBitSystem->setHttpStatus(404); if (!empty($_REQUEST['address_id'])) { // Specified by address ID $gBitSystem->fatalError(tra("The requested address (id=" . $_REQUEST['address_id'] . ") has invalid content.")); } else { // Specified by content ID $gBitSystem->fatalError(tra("The requested content (id=" . $_REQUEST['content_id'] . ") has invalid address content.")); } } $gContent->verifyViewPermission(); $gContent->addHit(); $address = $gContent->getDataShort(); if ($country_id = $gContent->mInfo['country_id']) { if (!empty($address)) { $address .= ', '; } $address .= BitAddressCountry::getText($country_id, 'isocode3'); } $gBitSmarty->assign_by_ref('address', $address); $gBitSystem->display('bitpackage:address/view.tpl', tra('Address'), array('display_mode' => 'display')); } else { // List the available addresses $addressList = $gContent->getList($_REQUEST); $gBitSmarty->assign_by_ref('addressList', $addressList); // getList() places all the pagination information in $_REQUEST['listInfo'] $gBitSmarty->assign_by_ref('listInfo', $_REQUEST['listInfo']); $gBitSystem->display('bitpackage:address/list.tpl', tra('Address'), array('display_mode' => 'list')); }