mardi 3 février 2015

Module Country Filter v1.0 [DLE English]

Module Country Filter v1.0 - Datalife Engine English

The module adds functionality DLE content filtering depending on the country of the visitor. Filtering is based on a database of IP addresses. Database of IP addresses from 01.01.2015 with service ip2location.com

The module adds tags:
[Country = RU, UA] display unit only for visitors from Russia and Ukraine [/ Country]
[not-Country = RU, UA] display unit for all visitors, except of Russia and Ukraine [/ not-country]

Author: MSW
Версия DLE: 9.6, 9.7, 9.8, 10.0, 10.1, 10.2, 10.3
Support Site: 0-web.ru

Download Country-Filter-v.1.0.zip

================================================== ===
  Module: Country Filter
  Version: 1.0
-------------------------------------------------- ---
  Author: MSW
  Website: https://0-web.ru/
-------------------------------------------------- ---
  Copyright (c) 2015 MSW
================================================== ===
  This code is copyrighted
================================================== ===

1. Load dump the database through phpmyadmin.

2. Open files:
- /engine/modules/show.full.php
- /engine/modules/show.short.php
- /engine/modules/show.custom.php

Search for:
================================================== ===
if (stripos ( $tpl->copy_template, "{image-" ) !== false) {
================================================== ===

Add above:
================================================== ===
# ****** Country Filter *** srart ****** #
if (strpos ( $tpl->result['content'], "[country=" ) !== false) {
$tpl->result['content'] = preg_replace_callback ( "#\[(country)=(.+?)\](.*?)\[/country\]#is", 'check_country', $tpl->result['content'] );
}
if (strpos ( $tpl->result['content'], "[not-country=" ) !== false) {
$tpl->result['content'] = preg_replace_callback ( "#\[(not-country)=(.+?)\](.*?)\[/not-country\]#is", 'check_country', $tpl->result['content'] );
}
# ****** Country Filter *** stop ****** #
================================================== ===

3. File: /engine/modules/functions.php
Find:
================================================== ===
function formatsize($file_size) {
================================================== ===

Add above:
================================================== ===
# ****** Country Filter *** srart ****** #
function check_country( $matches=array() ) {
global $member_id;
$block = $matches[3];
$country = explode( ',', $matches[2] );
if( $matches[1] == "country" ) {
if( ! in_array( $member_id['user_country'], $country ) ) return "";
} else {
if( in_array( $member_id['user_country'], $country ) ) return "";
}
return $block;
}
# ****** Country Filter *** stop ****** #
================================================== ===

4. File: /engine/modules/sitelogin.php
Find:
================================================== ===
?>
================================================== ===

Add above:
================================================== ===
# ****** Country Filter *** srart ****** #
if( $_IP != $_SESSION['dle_user_ip'] ) {
$_IP_COD = sprintf( "%u", ip2long( $_IP ) );
$_IP_SQL = $db->super_query( "SELECT country_code FROM " . PREFIX . "_ip2location1 WHERE ip_from <= '{$_IP_COD}' AND ip_to >= '{$_IP_COD}'" );
if($_IP_SQL['country_code']) {
$dle_user_country = $_IP_SQL['country_code'];
} else {
$dle_user_country = "no";
}
$_SESSION['dle_user_ip'] = $_IP;
$_SESSION['dle_user_country'] = $dle_user_country;
}
$member_id['user_country'] = $_SESSION['dle_user_country'];
# ****** Country Filter *** stop ****** #
================================================== ===

5. File: /engine/classes/templates.class.php
Find:
================================================== ===
if (strpos ( $this->template, "[group=" ) !== false) {
$this->template = preg_replace_callback ( "#\[(group)=(.+?)\](.*?)\[/group\]#is", array( &$this, 'check_group'), $this->template );
}
================================================== ===

Add above:
================================================== ===
# ****** Country Filter *** srart ****** #
if (strpos ( $this->template, "[country=" ) !== false) {
$this->template = preg_replace_callback ( "#\[(country)=(.+?)\](.*?)\[/country\]#is", 'check_country', $this->template );
}
if (strpos ( $this->template, "[not-country=" ) !== false) {
$this->template = preg_replace_callback ( "#\[(not-country)=(.+?)\](.*?)\[/not-country\]#is", 'check_country', $this->template );
}
# ****** Country Filter *** stop ****** #
================================================== ===

Find:
================================================== ===
if (strpos ( $template, "[group=" ) !== false) {
$template = preg_replace_callback ( "#\[(group)=(.+?)\](.*?)\[/group\]#is", array( &$this, 'check_group'), $template );
}
================================================== ===

Add above:
================================================== ===
# ****** Country Filter *** srart ****** #
if (strpos ( $template, "[country=" ) !== false) {
$template = preg_replace_callback ( "#\[(country)=(.+?)\](.*?)\[/country\]#is", 'check_country', $template );
}
if (strpos ( $template, "[not-country=" ) !== false) {
$template = preg_replace_callback ( "#\[(not-country)=(.+?)\](.*?)\[/not-country\]#is", 'check_country', $template );
}
# ****** Country Filter *** stop ****** #
================================================== ===

6. Tags can be used in the text of news and template files:
================================================== ===
[country = RU, UA] display unit only for visitors from Russia and Ukraine [/ country]
[not-country = RU, UA] display unit for all visitors, except of Russia and Ukraine [/ not-country]
================================================== ===

Some country code that I know
"AF" = AFGHANISTAN
"AL" = ALBANIA
"DZ" = ALGERIA
"AS" = AMERICAN SAMOA
"AD" = ANDORRA
"AO" = ANGOLA
"AI" = ANGUILLA
"AQ" = ANTARCTICA
"AG" = ANTIGUA AND BARBUDA
"AR" = ARGENTINA
"AM" = ARMENIA
"AW" = ARUBA
"AP" = ASIA PACIFIC
"AU" = AUSTRALIA
"AT" = AUSTRIA
"AZ" = AZERBAIJAN
"BS" = BAHAMAS
"BH" = BAHRAIN
"BD" = BANGLADESH
"BB" = BARBADOS
"BY" = BELARUS
"BE" = BELGIUM
"BZ" = BELIZE
"BJ" = BENIN
"BM" = BERMUDA
"BT" = BHUTAN
"BO" = BOLIVIA
"BA" = BOSNIA AND HERZEGOWINA
"BW" = BOTSWANA
"BV" = BOUVET ISLAND
"BR" = BRAZIL
"IO" = BRITISH INDIAN OCEAN TERRITORY
"BN" = BRUNEI DARUSSALAM
"BG" = BULGARIA
"BF" = BURKINA FASO
"BI" = BURUNDI
"KH" = CAMBODIA
"CM" = CAMEROON
"CA" = CANADA
"CV" = CAPE VERDE
"KY" = CAYMAN ISLANDS
"CF" = CENTRAL AFRICAN REPUBLIC
"TD" = CHAD
"CL" = CHILE
"CN" = CHINA
"CX" = CHRISTMAS ISLAND
"CC" = COCOS (KEELING) ISLANDS
"CO" = COLOMBIA
"KM" = COMOROS
"CG" = CONGO
"CD" = CONGO, THE DEMOCRATIC REPUBLIC OF THE
"CK" = COOK ISLANDS
"CR" = COSTA RICA
"CI" = COTE D'IVOIRE
"HR" = CROATIA
"CU" = CUBA
"CY" = CYPRUS
"CZ" = CZECH REPUBLIC
"CS" = CZECHOSLOVAKIA (FORMER)
"DK" = DENMARK
"DJ" = DJIBOUTI
"DM" = DOMINICA
"DO" = DOMINICAN REPUBLIC
"TP" = EAST TIMOR
"EC" = ECUADOR
"EG" = EGYPT
"SV" = EL SALVADOR
"GQ" = EQUATORIAL GUINEA
"ER" = ERITREA
"EE" = ESTONIA
"ET" = ETHIOPIA
"EU" = EUROPEAN UNION
"FK" = FALKLAND ISLANDS (MALVINAS)
"FO" = FAROE ISLANDS
"FJ" = FIJI
"FI" = FINLAND
"FR" = FRANCE
"FX" = FRANCE, METROPOLITAN
"GF" = FRENCH GUIANA
"PF" = FRENCH POLYNESIA
"TF" = FRENCH SOUTHERN TERRITORIES
"GA" = GABON
"GM" = GAMBIA
"GE" = GEORGIA
"DE" = GERMANY
"GH" = GHANA
"GI" = GIBRALTAR
"GB" = GREAT BRITAIN
"GR" = GREECE
"GL" = GREENLAND
"GD" = GRENADA
"GP" = GUADELOUPE
"GU" = GUAM
"GT" = GUATEMALA
"GN" = GUINEA
"GW" = GUINEA-BISSAU
"GY" = GUYANA
"HT" = HAITI
"HM" = HEARD ISLAND AND MCDONALD ISLANDS
"VA" = HOLY SEE (VATICAN CITY STATE)
"HN" = HONDURAS
"HK" = HONG KONG
"HU" = HUNGARY
"IS" = ICELAND
"IN" = INDIA
"ID" = INDONESIA
"IR" = IRAN, ISLAMIC REPUBLIC OF
"IQ" = IRAQ
"IE" = IRELAND
"IL" = ISRAEL
"IT" = ITALY
"JM" = JAMAICA
"JP" = JAPAN
"JO" = JORDAN
"KZ" = KAZAKSTAN
"KE" = KENYA
"KI" = KIRIBATI
"KP" = KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF
"KR" = KOREA, REPUBLIC OF
"KW" = KUWAIT
"KG" = KYRGYZSTAN
"LA" = LAO PEOPLE'S DEMOCRATIC REPUBLIC
"LV" = LATVIA
"LB" = LEBANON
"LS" = LESOTHO
"LR" = LIBERIA
"LY" = LIBYAN ARAB JAMAHIRIYA
"LI" = LIECHTENSTEIN
"LT" = LITHUANIA
"LU" = LUXEMBOURG
"MO" = MACAU
"MK" = MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF
"MG" = MADAGASCAR
"MW" = MALAWI
"MY" = MALAYSIA
"MV" = MALDIVES
"ML" = MALI
"MT" = MALTA
"MH" = MARSHALL ISLANDS
"MQ" = MARTINIQUE
"MR" = MAURITANIA
"MU" = MAURITIUS
"YT" = MAYOTTE
"MX" = MEXICO
"FM" = MICRONESIA, FEDERATED STATES OF
"MD" = MOLDOVA, REPUBLIC OF
"MC" = MONACO
"MN" = MONGOLIA
"MS" = MONTSERRAT
"MA" = MOROCCO
"MZ" = MOZAMBIQUE
"MM" = MYANMAR
"NA" = NAMIBIA
"NR" = NAURU
"NP" = NEPAL
"NL" = NETHERLANDS
"AN" = NETHERLANDS ANTILLES
"NC" = NEW CALEDONIA
"NZ" = NEW ZEALAND
"NI" = NICARAGUA
"NE" = NIGER
"NG" = NIGERIA
"NU" = NIUE
"NF" = NORFOLK ISLAND
"MP" = NORTHERN MARIANA ISLANDS
"NO" = NORWAY
"OM" = OMAN
"PK" = PAKISTAN
"PW" = PALAU
"PS" = PALESTINIAN TERRITORY, OCCUPIED
"PA" = PANAMA
"PG" = PAPUA NEW GUINEA
"PY" = PARAGUAY
"PE" = PERU
"PH" = PHILIPPINES
"PN" = PITCAIRN
"PL" = POLAND
"PT" = PORTUGAL
"PR" = PUERTO RICO
"QA" = QATAR
"RE" = REUNION
"RO" = ROMANIA
"SU" = RUSSIAN FEDERATION
"RW" = RWANDA
"SH" = SAINT HELENA
"KN" = SAINT KITTS AND NEVIS
"LC" = SAINT LUCIA
"PM" = SAINT PIERRE AND MIQUELON
"VC" = SAINT VINCENT AND THE GRENADINES
"WS" = SAMOA
"SM" = SAN MARINO
"ST" = SAO TOME AND PRINCIPE
"SA" = SAUDI ARABIA
"SN" = SENEGAL
"YU" = SERBIA AND MONTENEGRO
"SC" = SEYCHELLES
"SL" = SIERRA LEONE
"SG" = SINGAPORE
"SK" = SLOVAKIA
"SI" = SLOVENIA
"SB" = SOLOMON ISLANDS
"SO" = SOMALIA
"ZA" = SOUTH AFRICA
"GS" = SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS
"ES" = SPAIN
"LK" = SRI LANKA
"SD" = SUDAN
"SR" = SURINAME
"SJ" = SVALBARD AND JAN MAYEN
"SZ" = SWAZILAND
"SE" = SWEDEN
"CH" = SWITZERLAND
"SY" = SYRIAN ARAB REPUBLIC
"TW" = TAIWAN, PROVINCE OF CHINA
"TJ" = TAJIKISTAN
"TZ" = TANZANIA, UNITED REPUBLIC OF
"TH" = THAILAND
"TG" = TOGO
"TK" = TOKELAU
"TO" = TONGA
"TT" = TRINIDAD AND TOBAGO
"TN" = TUNISIA
"TR" = TURKEY
"TM" = TURKMENISTAN
"TC" = TURKS AND CAICOS ISLANDS
"TV" = TUVALU
"UG" = UGANDA
"UA" = UKRAINE
"AE" = UNITED ARAB EMIRATES
"UK" = UNITED KINGDOM
"US" = UNITED STATES
"UM" = UNITED STATES MINOR OUTLYING ISLANDS
"UY" = URUGUAY
"UZ" = UZBEKISTAN
"VU" = VANUATU
"VE" = VENEZUELA
"VN" = VIET NAM
"VG" = VIRGIN ISLANDS, BRITISH
"VI" = VIRGIN ISLANDS, U.S.
"WF" = WALLIS AND FUTUNA
"EH" = WESTERN SAHARA
"YE" = YEMEN
"ZM" = ZAMBIA
"ZW" = ZIMBABWE

dimanche 1 février 2015

Herald Template For DLE 10.4 English


Herald Template For Datalife Engine 10.4 English
Features:

Adaptive. Template Herald (Test-Templates) - a pattern that would look equally well on PCs and all popular mobile devices. Adaptive design - a modern solution that will allow you to forget about the development of a separate template version for mobile users.

Easy installation. Template fast and easy to install! Even beginners will be able to install and configure the template in minutes! Included is a detailed manual for quick start.

Social Networks. The template is already integrated social bookmarking script. Thanks to him, visitors can advise your content to its subscribers in social networks.

SEO Ready. Layout template is made at the highest level and ready for SEO Professionals.

Cross-browser compatibility. Pattern works equally well on all popular browsers. You will be quiet for visitors to your site - everyone will see the same thing!.

Fitting: news, blog, information,
Developer: Test-Templates
Template Type: Original
For version DLE: 10.3-10.4
Content in the archive: tpl, jpg, png, gif, css, js, psd, ttf, instruction
Tested browsers: IE10, Mozilla, Opera, Google Chrome, Safari
Width: 1000px - adaptive!
Additional fields: no

Download Herald Template For DLE 10.3 English
Instructions
1) Installation Template
- Uploading a folder template to a site in the templates
- Set to the folder with the template injected write permissions (CHMOD 777)
- Install all files in a folder with the template write permissions (CHMOD 666)
- Choose the settings our template engine.
- Enable automatic support for smartphones - to put No


2) Custom
Conclusion of news on the home page is realized by tag {custom}
example:
{custom category="1" template="template" aviable="global" from="0" limit="6" cache="no"}
where:
category="1" -a unit of this category id from which the news will be displayed (you can perecheslyat several comma - id can be found right in the admin opposite category)
template="template" -a pattern of appearance (no need to change)
aviable="global" -output in all sections (no need to change)
from="0" -from which the account is news to display
limit="4" -number of stories (no need to change)
cache="no" -to use or not to cache (recommended setting to reduce the load on the server - yes)

Find in main.tpl desired unit and shall id category. Need to specify the id to that category, in which there is news. If you want to conclude the news of the parent category, you need to list all sub-categories separated by commas.