<?php
/**
* Country Flag
*
*
* By: Zahet1988
* Website: http://www.thetechex.net
*/
$plugins->add_hook("postbit", "country");
function country_info()
{
return array(
'name' => 'Landesflaggen',
'description' => 'Zeigt die Flagge des Herkunftslandes eines Benutzers in seinen Beiträgen.',
'website' => 'http://www.thetechex.net',
'author' => 'Zaher1988',
'authorsite' => 'http://www.thetechex.net',
'version' => '1.0',
);
}
function country_activate()
{
require '../inc/adminfunctions_templates.php';
global $db;
$country_group = array(
"gid" => "NULL",
"name" => "Landesflaggen",
"description" => "Einstellungen zum Plugin.",
"disporder" => "3",
"isdefault" => "no",
);
$db->insert_query(TABLE_PREFIX."settinggroups", $country_group);
$gid = $db->insert_id();
$country_setting_1 = array(
"sid" => "NULL",
"name" => "field",
"title" => "ID#",
"description" => "Soll nicht das Standardprofilfeld für die Angabe zum Herkuftsland verwendet werden,
bitte hier die ID des neuen Feldes eingeben.",
"optionscode" => "text",
"value" => '',
"disporder" => '1',
"gid" => intval($gid),
);
$db->insert_query(TABLE_PREFIX."settings", $country_setting_1);
$profilefield = array(
"name" => "Herkunftsland",
"description" => "Bitte den Namen des Herkunftslandes wählen",
"disporder" => '0',
"type" => "select\n
United States
Canada
Vietnam
Abu Dhabi
Afghanistan
Ajman
Aland Islands
Albania
Alderney
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua and Barbuda
Argentina
Armenia
Aruba
Australia-Aboriginal
Australia
Austria
Azerbaijan
Azores
Bahamas
Bahrain
Balearic Islands
Bangladesh
Barbados
Belarus
Belgium
Belize
Benin
Bermuda
Bhutan
Bolivia
Bosnia and Herzegovina
Botswana
Bouvet Island
Brazil
British Antarctic Territory
British Indian Ocean Territory
British Virgin Islands
Brunei
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Canary Islands
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos Islands
Colombia
Comoros
Congo-Brazzaville
Congo-Kinshasa
Cook Islands
Coral Sea Islands
Costa Rica
Cote DIvoire
Croatia
Cuba
Cyprus
Czech Republic
Denmark
Djibouti
Dominica
Dominican Republic
Dubai
East Timor
Ecuador
Egypt
El Salvador
England
Equatorial Guinea
Eritrea
Estonia
Ethiopia
Falkland Islands
Faroe Islands
Fiji
Finland
France
French Guiana Independentist
French Guiana
French Polynesia
Fujairah
Gabon
Gambia
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea-Bissau
Guinea
Guyana
Haiti
Heard and McDonald Islands
Honduras
Hong Kong
Hungary
Iceland
India
Indonesia
Iran
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Japan
Jersey
Jordan
Kazakhstan
Kenya
Kiribati
Kuwait
Kyrgyzstan
Laos
Latvia
Lebanon
Lesotho
Liberia
Libya
Liechtenstein
Lithuania
Lord Howe Island
Luxembourg
Macao
Macedonia
Madagascar
Madeira
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia
Midway Islands
Moldova
Monaco
Mongolia
Montenegro
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands Antilles
Netherlands
New Caledonia
New Zealand-Maori
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
North Korea
Northern Cyprus
Northern Ireland
Northern Marianas
Norway
Oman
Orkney Islands
Pakistan
Palau
Palestine
Panama
Papua New Guinea
Paraguay
Peru
Philippine
Pitcairn Islands
Poland
Portugal
Puerto Rico
Qatar
Ras al-Khaimah
Reunion
Romania
Russian Federation
Rwanda
Sami
Samoa
San Marino
Sao Tome e Principe
Sark
Saudi Arabia
Scotland
Seborga
Senegal
Serbia
Seychelles
Sharjah
Shetland Islands
Sierra Leone
Sikkim
Singapore
Slovakia
Slovenia
Solomon Islands
Somalia
Somaliland
South Africa
South Korea
Spain
Sri Lanka
St Helena
St Kitts and Nevis
St Lucia
St Pierre and Miquelon
St Vincent and the Grenadines
Sudan
uriname
Swaziland
Sweden
Switzerland
Syria
Tahiti
Taiwan
Tajikstan
Tanzania
Thailand
Tibet
Togo
Tokelau
Tonga
Trinidad and Tobago
Tromelin
Tunisia
Turkey
Turkmenistan
Tuvalu
US Virgin Islands
Uganda
Ukraine
Umm al-Qaiwan
United Kingdom
United Nations
Uruguay
Uzbekistan
Vanuatu
Vatican City State
Venezuela
Wake Island
Wales
Wallis & Futuna
Western Sahara
Yemen
Yugoslavia
Zambia
Zimbabwe",
"length" => '0',
"maxlength" => '0',
"required" => "no",
"editable" => "yes",
"hidden" => "no",
);
$db->insert_query(TABLE_PREFIX."profilefields", $profilefield);
$fid = $db->insert_id();
$fieldname = "fid$fid";
$db->query("ALTER TABLE ".TABLE_PREFIX."userfields ADD $fieldname TEXT;");
$db->query("OPTIMIZE TABLE ".TABLE_PREFIX."userfields");
find_replace_templatesets("postbit", '#'.preg_quote('$post[onlinestatus]').'#', '$post[onlinestatus] $post[country]');
}
function country_deactivate()
{
require '../inc/adminfunctions_templates.php';
global $db;
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='field'");
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='Landesflaggen'");
$db->query("DELETE FROM ".TABLE_PREFIX."profilefields WHERE name='Herkunftsland'");
find_replace_templatesets("postbit", '#'.preg_quote('$post[country]').'#', '',0);
}
function country()
{
global $db, $mybb, $templates, $country, $post;
$query = $db->query("select * FROM ".TABLE_PREFIX."profilefields WHERE name='Herkunftsland'");
$ffid = $db->fetch_array($query);
$fid = $ffid['fid'];
if ($mybb->settings['field'] == '')
{
$source = "fid".$fid;
if ($post[$source] != '')
{
$post[country] = "<!-- Start: country --><br><div>Country: <img src=\"images/flags/$post[$source].gif\"
title=\"$post[$source]\" align=\"center\"></div><!-- End: lsop -->";
}
} else {
$source = "fid".$mybb->settings['field'];
if ($post[$source] != '')
{
$post[country] = "<!-- Start: country --><br><div>Country: <img src=\"images/flags/$post[$source].gif\"
title=\"$post[$source]\" align=\"center\"></div><!-- End: lsop -->";
}
}
}
?>